Here is the error i get from cygwin:
Code: Select all
$ make kxploit
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G4 -Wall -02 -c -o main.o mai
n.c
main.c: In function 'p1CalcPos':
main.c:77: error: syntax error before 'else'
make: *** [main.o] Error 1
Code: Select all
#include <oslib/oslib.h>
#include <math.h>
PSP_MODULE_INFO("Sams Game", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
OSL_IMAGE *player1;
void Keys();
void p1CalcPos();
int main()
{
//Initialize the different parts of the library
oslInit(0);
oslInitGfx(OSL_PF_8888, 1);
oslInitConsole();
//load files
player1 = oslLoadImageFile("player1.png", OSL_IN_RAM, OSL_PF_5551);
//Configure the joypad
oslSetKeyAutorepeatInit(40);
oslSetKeyAutorepeatInterval(10);
//Initialize variables
player1->centerX = player1->sizeX / 2; //Rotation center of player1s sprite
player1->centerY = player1->sizeY / 2;
player1->x = 240; //Place player1 at the center of the screen
player1->y = 136;
//Main loop
while (!osl_quit)
{
oslStartDrawing(); //Display code
Keys();
oslClearScreen(RGB(0,0,0)); //Black screen
oslSetBilinearFilter(1); //Smoothing
p1CalcPos();
oslDrawImage(player1);
oslEndDrawing(); //End of display code
oslSyncFrame(); //Synchronization
}
//Game terminated (HOME -> quit)
oslEndGfx();
oslQuit();
return 0;
}
void Keys()
{
oslReadKeys();
//buttons
if (osl_keys->pressed.triangle) oslSetBilinearFilter(0);
if (osl_keys->held.L) player1->angle -= 3; //make a rotation to player1
if (osl_keys->held.R) player1->angle += 3;
if (osl_keys->pressed.start) oslQuit(); //exit the game
}
void p1CalcPos()
{
float pi = 3.141592;
float thrust = 0.6;
float decay = 0.98;
int maxSpeed = 25;
static int xSpeed = 0;
static int ySpeed = 0;
static int speed = 0;
if (osl_keys->held.cross)
xSpeed+=(thrust*sin(player1->angle*(pi/180)));
ySpeed+=(thrust*cos(player1->angle*(pi/180)));
else
xSpeed *= decay;
ySpeed *= decay;
speed = sqrt( ( xSpeed * xSpeed ) + ( ySpeed * ySpeed ) );
if (speed>maxSpeed)
xSpeed *= ( maxSpeed / speed );
ySpeed *= ( maxSpeed / speed );
player1->x -= xSpeed;
player1->y -= ySpeed;
}
Code: Select all
TARGET = main
OBJS = main.o
YOURLIBS=
INCDIR =
CFLAGS = -G4 -Wall -O2
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
STDLIBS= -losl -lpng -lz \
-lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgu -lpspaudiolib -lpspaudio -lm
LIBS=$(STDLIBS)$(YOURLIBS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Sams Game
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
But i can't for the life of me figure out what the hell is causing this error.
this is the first time i have used C, and only the seccond game i have coded. The first one being a flash version of what i hope this will be eventually.
Basicly, i need all the help i can get.
Thanks in advance,
Cogboy.