void gameovermenu(void) { //int count; //int scoretemp; //int scorecountdelay; //int simtimer; //int simcount; resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !menuitem[1].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); if (game.difficulty<2) { createmenuitem(TXT_CONTINUE,(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_C); } checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(580); drawtext(TXT_GAME_OVER,(320|TEXT_CENTER),224,16,1.0f,1.0f,1.0f,1.0f); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); } if (menuitem[0].active) game.exit=GAMEEXIT_EXITGAME; if (menuitem[1].active) game.exit=GAMEEXIT_DIED; resetmenuitems(); }
void postgamemenu(void) { int count; int scoretemp; int scorecountdelay; int simtimer; int simcount; savereplay(game.levelnum+100); scoretemp=game.totalscore; scorecountdelay=0; simtimer=SDL_GetTicks(); resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !menuitem[1].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); if (game.levelnum!=34) { createmenuitem(TXT_NEXTLEVEL,(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_N); } else { createmenuitem(TXT_ENDING,(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_N); } checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); soundsimulation(view.position,view.orientation); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(580); drawbackground(468,(320|TEXT_CENTER),48,384,64,640,480); drawbackground(469,400,160,128,128,640,480); if (!game.bosslevel) { count=128; drawtext(TXT_SMALL_AMBER" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[5],game.numofbonus[5]); count+=16; drawtext(TXT_MEDIUM_AMBER" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[6],game.numofbonus[6]); count+=16; drawtext(TXT_LARGE_AMBER" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[7],game.numofbonus[7]); count+=16; drawtext(TXT_TARBALLS" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[4],game.numofbonus[4]); count+=16; drawtext(TXT_EXTRA_LIVES" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[3],game.numofbonus[3]); count+=16; drawtext(TXT_SECRETS" /i///i",64,count,16,1.0f,1.0f,1.0f,1.0f,game.bonus[8],game.numofbonus[8]); count+=16; drawtext(TXT_LIFE_BONUS":/i",64,352,16,1.0f,1.0f,1.0f,1.0f,(object[0].hitpoints/50)*10); drawtext(TXT_LEVEL_POINTS":/i",64,368,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(object[0].hitpoints/50)*10); } else { if (game.levelnum==34 && game.exit==GAMEEXIT_WON) drawtext(TXT_GF_RESCUING_BONUS,64,336,16,1.0f,1.0f,1.0f,1.0f); drawtext(TXT_LIFE_BONUS":/i",64,352,16,1.0f,1.0f,1.0f,1.0f,(object[0].hitpoints/50)*10); if (game.levelnum==34 && game.exit==GAMEEXIT_WON) drawtext(TXT_BOSS_POINTS":/i",64,368,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(object[0].hitpoints/50)*10-1); else drawtext(TXT_BOSS_POINTS":/i",64,368,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(object[0].hitpoints/50)*10); } drawtext(TXT_TOTAL_POINTS":/i",64,384,16,1.0f,1.0f,1.0f,1.0f,scoretemp); drawtext("+/i",64+19*16,384,16,1.0f,1.0f,1.0f,1.0f,game.score[0]-(scoretemp-game.totalscore)); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); simcount=0; while (SDL_GetTicks()-simtimer>20 && simcount<5) { simcount++; count=SDL_GetTicks()-simtimer-20; simtimer=SDL_GetTicks()-count; scorecountdelay++; if (scorecountdelay>=25) if (scoretemp<game.totalscore+game.score[0]) { if (scoretemp<=game.totalscore+game.score[0]-10) scoretemp+=10; else scoretemp++; if ((scorecountdelay&1)==1) playsound(15,view.position,NULL,0.2f,0,1.0f,-1,0); } } } if (menuitem[0].active) { game.exit=GAMEEXIT_EXITGAME; } for (count=numofsounds-1;count>=0;count--) deletesound(count); resetmenuitems(); }
void pregamemenu(void) { int count,count2; int simtimer; int simcount; int startdelay; game.exit=GAMEEXIT_NONE; startdelay=0; simtimer=SDL_GetTicks(); resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); createmenuitem(TXT_START,(320|TEXT_CENTER),320,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_S); checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(540); if (game.levelnum<35) { count=(game.levelnum-1)/7+1; count2=(game.levelnum-1)%7+1; if (count==1) drawbackground(521,(320|TEXT_CENTER),48,192,192,640,480); if (count==2) drawbackground(522,(320|TEXT_CENTER),48,192,192,640,480); if (count==3) drawbackground(523,(320|TEXT_CENTER),48,192,192,640,480); if (count==4) drawbackground(524,(320|TEXT_CENTER),48,192,192,640,480); if (count==5) drawbackground(525,(320|TEXT_CENTER),48,192,192,640,480); drawtext("/i-/i",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f,count,count2); drawtext(TXT_LIVES" /i",(320|TEXT_CENTER),272,16,1.0f,1.0f,1.0f,1.0f,game.numoflives); drawtext(TXT_POINTS" /i",(320|TEXT_CENTER),288,16,1.0f,1.0f,1.0f,1.0f,game.totalscore); } if (game.levelnum==64) { drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480); drawtext(" -1",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f); } if (game.levelnum==65) { drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480); drawtext(" -2",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f); } if (game.levelnum==66) { drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480); drawtext(" -3",(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f); } if (game.levelnum==67) { drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480); drawtext(TXT_ISLE_OF_THE,(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f); drawtext(TXT_DEAD,(320|TEXT_CENTER),272,16,1.0f,1.0f,1.0f,1.0f); } if (game.levelnum==68) { drawbackground(526,(320|TEXT_CENTER),48,192,192,640,480); drawtext(TXT_SATANS_LAIR,(320|TEXT_CENTER),256,16,1.0f,1.0f,1.0f,1.0f); } drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); if (menuitem[1].active)// || startdelay>=150) { loadstorylevel(game.levelnum); gameloop(); if (game.exit==GAMEEXIT_EXITGAME || game.exit==GAMEEXIT_DIED) if (game.levelnum<64) { if (game.numoflives<99) game.numoflives--; if (game.numoflives<0) { if (player[playernum].highscore<game.totalscore) player[playernum].highscore=game.totalscore; game.totalscore=0; game.numoflives=5; if (game.difficulty==1) { count2=(game.levelnum-1)%7+1; if (count2!=7) { count=(game.levelnum-1)/7; game.levelnum=count*7+1; } } if (game.difficulty>=2) game.levelnum=0; gameovermenu(); goto changelevelbypass; } } if (game.levelnum==34) if (game.exit==GAMEEXIT_WON || game.exit==GAMEXIT_WARPZONE) { game.score[0]=10000; if (game.levelnum==34 && game.exit==GAMEEXIT_WON) game.score[0]+=1; game.score[0]+=(object[0].hitpoints/50)*10; postgamemenu(); game.totalscore+=game.score[0]; endingmenu(); menuitem[0].active=1; game.levelnum=35; goto changelevelbypass; } if (game.exit==GAMEEXIT_WON) { //if (!game.bosslevel) if (game.levelnum!=68 || game.dialog==0) { if (game.levelnum==6) game.score[0]=1000; if (game.levelnum==13) game.score[0]=2000; if (game.levelnum==20) game.score[0]=3000; if (game.levelnum==27) game.score[0]=4000; if (game.levelnum==33) game.score[0]=5000; if (game.levelnum==34) game.score[0]=10000; if (game.levelnum==68) game.score[0]=20000; //if (game.levelnum==34 && game.exit==won) // game.score[0]+=10; game.oldschool=0; game.score[0]+=(object[0].hitpoints/50)*10; postgamemenu(); game.totalscore+=game.score[0]; if (game.exit==GAMEEXIT_EXITGAME) { game.exit=GAMEEXIT_WON; menuitem[0].active=1; } } if (game.levelnum<35) game.levelnum++; } if (game.levelnum==64) { game.levelnum=4; if (game.over==3) game.levelnum=22; if (game.over==4) game.levelnum=15; if (game.over==5) game.levelnum=8; goto changelevelbypass; } if (game.levelnum==65) { game.levelnum=9; goto changelevelbypass; } if (game.levelnum==66) { game.levelnum=26; goto changelevelbypass; } if (game.levelnum==67) { if (game.exit==GAMEEXIT_EXITGAME || game.exit==GAMEEXIT_DIED) game.levelnum=19; else game.levelnum=68; goto changelevelbypass; } if (game.levelnum==68) { game.levelnum=19; goto changelevelbypass; } if (game.exit==GAMEXIT_WARPZONE) { game.totalscore+=game.score[0]; if (game.levelnum==3) game.levelnum=64; if (game.levelnum==4) game.levelnum=24; if (game.levelnum==8) game.levelnum=65; if (game.levelnum==18) game.levelnum=67; if (game.levelnum==25) game.levelnum=66; goto changelevelbypass; } changelevelbypass:; simtimer=SDL_GetTicks(); startdelay=0; joymenunum=1; } simcount=0; while (SDL_GetTicks()-simtimer>20 && simcount<5) { simcount++; count=SDL_GetTicks()-simtimer-20; simtimer=SDL_GetTicks()-count; //startdelay++; } if (game.exit==GAMEEXIT_EXITGAME) menuitem[0].active=1; } resetmenuitems(); }
void editlevelobjects(void) { int count,count2; int x,y; int simtimer; int simcount; float vec[3],vec2[3]; simtimer=SDL_GetTicks(); resetmenuitems(); while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); glStencilMask(~0); glClearStencil(0); glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_FALSE); glStencilMask(0); setuptextdisplay(); glColor3fv(level.ambient[3]); if (level.background[0]!=0) displaybackground(660); numofmenuitems=0; createmenuitem("",0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); if (editor.objectnum!=-1) { createmenuitem("Mass ",(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_FLOATINPUT,&level.object[editor.objectnum].mass); setmenuitem(MO_HOTKEY,SCAN_M); createmenuitem("Friction",(640|TEXT_END),32,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_FLOATINPUT,&level.object[editor.objectnum].friction); setmenuitem(MO_HOTKEY,SCAN_F); createmenuitem("LType",(640|TEXT_END),64,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_INTINPUT,&level.object[editor.objectnum].lighttype); createmenuitem("Red ",(640|TEXT_END),96,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_FLOATINPUT,&level.object[editor.objectnum].lightcolor[0]); createmenuitem("Green",(640|TEXT_END),128,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_FLOATINPUT,&level.object[editor.objectnum].lightcolor[1]); createmenuitem("Blue ",(640|TEXT_END),160,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_FLOATINPUT,&level.object[editor.objectnum].lightcolor[2]); createmenuitem("Inten",(640|TEXT_END),192,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_FLOATINPUT,&level.object[editor.objectnum].lightintensity); } checksystemmessages(); checkkeyboard(); checkmouse(); checkmenuitems(); view.zoom=10.0f; if (keyboard[SCAN_EQUALS]) view.zoom=20.0f; if (keyboard[SCAN_MINUS]) view.zoom=5.0f; view.zoomx=view.zoom+0.5f; view.zoomy=view.zoom*0.75f+0.5f; setuporthoviewport(0,0,640,480,view.zoom,view.zoom*0.75f,20.0f); setupviewpoint(view.position,view.orientation); setupframelighting(); rendershadows(); renderlevelback(); renderlevel(); //renderlevelfore(); renderlevelfore(); renderlevelobjects(); if (keyboard[SCAN_L]) renderlevellines(); setuptextdisplay(); drawtext(TXT_OBJECTSET":/i",0,352,16,1.0f,1.0f,1.0f,1.0f,editor.objecttype); drawtext(TXT_OBJECTNUM":/i",0,368,16,1.0f,1.0f,1.0f,1.0f,editor.objectnum); if (editor.objectnum!=-1) drawtext(TXT_OBJECTYPE":/i",0,384,16,1.0f,1.0f,1.0f,1.0f,level.object[editor.objectnum].type); drawtext(TXT_OBJECTS":/i",0,400,16,1.0f,1.0f,1.0f,1.0f,level.numofobjects); drawtext(TXT_ROPES":/i",0,416,16,1.0f,1.0f,1.0f,1.0f,level.numofropes); if (editor.objectnum!=-1) { drawtext(TXT_LINK":/i",0,432,16,1.0f,1.0f,1.0f,1.0f,level.object[editor.objectnum].link); } drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); if (mouse.x<512 || mouse.y>224) { x=view.position[0]+(float)(mouse.x-320)/32.0f; y=view.position[1]+(float)(240-mouse.y)/32.0f; if (!keyboard[SCAN_K]) { if (mouse.lmb && !prevmouse.lmb) { if (!keyboard[SCAN_H]) { vec[0]=(float)x+0.5f; vec[1]=(float)y+0.5f; vec[2]=0.0f; } else { vec[0]=(float)x; vec[1]=(float)y; vec[2]=0.0f; } memset(&level.object[level.numofobjects],0,sizeof(level.object[level.numofobjects])); level.object[level.numofobjects].type=editor.objecttype; level.object[level.numofobjects].link=-1; copyvector(level.object[level.numofobjects].position,vec); if (editor.objectnum==-1 || level.object[level.numofobjects].type!=level.object[editor.objectnum].type) { level.object[level.numofobjects].texturenum=0; level.object[level.numofobjects].size[0]=1.0f; level.object[level.numofobjects].size[1]=1.0f; level.object[level.numofobjects].mass=1.0f; level.object[level.numofobjects].friction=0.8f; level.object[level.numofobjects].lightcolor[0]=1.0f; level.object[level.numofobjects].lightcolor[1]=1.0f; level.object[level.numofobjects].lightcolor[2]=1.0f; level.object[level.numofobjects].lightintensity=16.0f; } else { level.object[level.numofobjects].texturenum=level.object[editor.objectnum].texturenum; level.object[level.numofobjects].size[0]=level.object[editor.objectnum].size[0]; level.object[level.numofobjects].size[1]=level.object[editor.objectnum].size[1]; level.object[level.numofobjects].mass=level.object[editor.objectnum].mass; level.object[level.numofobjects].friction=level.object[editor.objectnum].friction; level.object[level.numofobjects].lighttype=level.object[editor.objectnum].lighttype; level.object[level.numofobjects].lightcolor[0]=level.object[editor.objectnum].lightcolor[0]; level.object[level.numofobjects].lightcolor[1]=level.object[editor.objectnum].lightcolor[1]; level.object[level.numofobjects].lightcolor[2]=level.object[editor.objectnum].lightcolor[2]; level.object[level.numofobjects].lightintensity=level.object[editor.objectnum].lightintensity; } editor.objectnum=level.numofobjects; level.numofobjects++; } } if (keyboard[SCAN_K]) { vec[0]=view.position[0]+(float)(mouse.x-320)/32.0f; vec[1]=view.position[1]+(float)(240-mouse.y)/32.0f; vec[2]=0.0f; if (mouse.lmb && !prevmouse.lmb) { if (editor.objectnum!=-1) for (count=0;count<level.numofobjects;count++) { subtractvectors(vec2,vec,level.object[count].position); if (vectorlength(vec2)<0.5f) level.object[editor.objectnum].link=count; } } if (mouse.rmb && !prevmouse.rmb) level.object[editor.objectnum].link=-1; } if (mouse.rmb && !prevmouse.rmb) { vec[0]=view.position[0]+(float)(mouse.x-320)/32.0f; vec[1]=view.position[1]+(float)(240-mouse.y)/32.0f; vec[2]=0.0f; editor.objectnum=-1; for (count=0;count<level.numofobjects;count++) { subtractvectors(vec2,vec,level.object[count].position); if (vectorlength(vec2)<0.5f) editor.objectnum=count; } } } if (!menuinputkeyboard) { if (editor.objectnum!=-1) { vec[0]=1.0f; if (level.object[editor.objectnum].type==6 || level.object[editor.objectnum].type==7 || level.object[editor.objectnum].type==17) vec[0]=0.2f; if (keyboard[SCAN_HOME] && !prevkeyboard[SCAN_HOME]) if (level.numofobjects>1) { count2=0; if (keyboard[SCAN_SHIFT]) count2=2; memcpy(&level.object[255],&level.object[count2],sizeof(level.object[0])); memcpy(&level.object[count2],&level.object[editor.objectnum],sizeof(level.object[0])); memcpy(&level.object[editor.objectnum],&level.object[255],sizeof(level.object[0])); for (count=0;count<level.numofobjects;count++) { if (level.object[count].link==count2) level.object[count].link=editor.objectnum; else if (level.object[count].link==editor.objectnum) level.object[count].link=count2; } for (count=0;count<level.numofropes;count++) { if (level.rope[count].obj1==count2) level.rope[count].obj1=editor.objectnum; else if (level.rope[count].obj1==editor.objectnum) level.rope[count].obj1=count2; if (level.rope[count].obj2==count2) level.rope[count].obj2=editor.objectnum; else if (level.rope[count].obj2==editor.objectnum) level.rope[count].obj2=count2; } editor.objectnum=count2; } if (keyboard[SCAN_END] && !prevkeyboard[SCAN_END]) if (level.numofobjects>2) { count2=1; if (keyboard[SCAN_SHIFT]) count2=3; memcpy(&level.object[255],&level.object[count2],sizeof(level.object[0])); memcpy(&level.object[count2],&level.object[editor.objectnum],sizeof(level.object[0])); memcpy(&level.object[editor.objectnum],&level.object[255],sizeof(level.object[0])); for (count=0;count<level.numofobjects;count++) { if (level.object[count].link==count2) level.object[count].link=editor.objectnum; else if (level.object[count].link==editor.objectnum) level.object[count].link=count2; } for (count=0;count<level.numofropes;count++) { if (level.rope[count].obj1==count2) level.rope[count].obj1=editor.objectnum; else if (level.rope[count].obj1==editor.objectnum) level.rope[count].obj1=count2; if (level.rope[count].obj2==count2) level.rope[count].obj2=editor.objectnum; else if (level.rope[count].obj2==editor.objectnum) level.rope[count].obj2=count2; } editor.objectnum=count2; } if (keyboard[SCAN_LEFT] && !prevkeyboard[SCAN_LEFT]) if (level.object[editor.objectnum].size[0]>vec[0]) level.object[editor.objectnum].size[0]-=vec[0]; if (keyboard[SCAN_RIGHT] && !prevkeyboard[SCAN_RIGHT]) if (level.object[editor.objectnum].size[0]<16.0f) level.object[editor.objectnum].size[0]+=vec[0]; if (keyboard[SCAN_DOWN] && !prevkeyboard[SCAN_DOWN]) if (level.object[editor.objectnum].size[1]>vec[0]) level.object[editor.objectnum].size[1]-=vec[0]; if (keyboard[SCAN_UP] && !prevkeyboard[SCAN_UP]) if (level.object[editor.objectnum].size[1]<16.0f) level.object[editor.objectnum].size[1]+=vec[0]; if (keyboard[SCAN_LFT_BRACKET] && !prevkeyboard[SCAN_LFT_BRACKET]) { if (!keyboard[SCAN_SHIFT]) level.object[editor.objectnum].texturenum--; else level.object[editor.objectnum].texturenum-=10; if (level.object[editor.objectnum].texturenum<0) level.object[editor.objectnum].texturenum=0; } if (keyboard[SCAN_RGT_BRACKET] && !prevkeyboard[SCAN_RGT_BRACKET]) { if (!keyboard[SCAN_SHIFT]) level.object[editor.objectnum].texturenum++; else level.object[editor.objectnum].texturenum+=10; if (level.object[editor.objectnum].texturenum>255) level.object[editor.objectnum].texturenum=255; } } if (keyboard[SCAN_Q] && !prevkeyboard[SCAN_Q]) { if (!keyboard[SCAN_SHIFT]) editor.objecttype++; else editor.objecttype+=10; if (editor.objecttype>255) editor.objecttype=255; } if (keyboard[SCAN_Z] && !prevkeyboard[SCAN_Z]) { if (!keyboard[SCAN_SHIFT]) editor.objecttype--; else editor.objecttype-=10; if (editor.objecttype<0) editor.objecttype=0; } if (keyboard[SCAN_DELETE] && !prevkeyboard[SCAN_DELETE]) deletelevelobject(editor.objectnum); if (keyboard[SCAN_F5] && !prevkeyboard[SCAN_F5]) { setuplevel(); setupgame(); } } simcount=0; while (SDL_GetTicks()-simtimer>20 && simcount<5) { simcount++; count=SDL_GetTicks()-simtimer-20; simtimer=SDL_GetTicks()-count; if (!menuinputkeyboard) { if (keyboard[SCAN_W]) view.position[1]+=0.2f; if (keyboard[SCAN_S]) view.position[1]-=0.2f; if (keyboard[SCAN_A]) view.position[0]-=0.2f; if (keyboard[SCAN_D]) view.position[0]+=0.2f; } } } resetmenuitems(); }
void newmappackmenu(void) { int count; joystickmenu=0; resetmenuitems(); while (!menuitem[0].active && !menuitem[1].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); createmenuitem(TXT_SAVE,(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f); createmenuitem(TXT_ADD_LEVEL,(640|TEXT_END),464,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_A); createmenuitem(TXT_DELETE_LEVEL,0,464,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_DELETE); createmenuitem(TXT_FILENAME" ",0,32,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_STRINGINPUT,mappack.filename); setmenuitem(MO_HOTKEY,SCAN_ENTER); createmenuitem(TXT_NAME" ",0,64,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_STRINGINPUT,mappack.name); createmenuitem(TXT_LEVEL" "TXT_FILENAME" ",0,128,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_STRINGINPUT,mappack.level[mappack.numoflevels]); setmenuitem(MO_HOTKEY,SCAN_F); createmenuitem(TXT_LEVELNAME" ",0,160,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_STRINGINPUT,mappack.levelname[mappack.numoflevels]); checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); setuptextdisplay(); drawtext(TXT_FILENAME,320,52,12,1.0f,1.0f,1.0f,1.0f); drawtext(TXT_LEVELNAME,480,52,12,1.0f,1.0f,1.0f,1.0f); for (count=0;count<mappack.numoflevels;count++) { drawtext(mappack.level[count],320,64+count*12,12,1.0f,1.0f,1.0f,1.0f); drawtext(mappack.levelname[count],480,64+count*12,12,1.0f,1.0f,1.0f,1.0f); } drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); if (menuitem[2].active) { if (mappack.level[mappack.numoflevels][0]!=0) if (mappack.numoflevels<63) { strcpy(mappack.level[mappack.numoflevels+1],mappack.level[mappack.numoflevels]); strcpy(mappack.levelname[mappack.numoflevels+1],mappack.levelname[mappack.numoflevels]); mappack.numoflevels++; } menuitem[2].active=0; } if (menuitem[3].active) { if (mappack.numoflevels>0) mappack.numoflevels--; menuitem[3].active=0; } } if (menuitem[1].active) savemappack(); resetmenuitems(); joystickmenu=1; }
void campaignmenu(void) { int count; loadplayermappack(); resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); count=352; if (playermappack[playernum].levelnum>0) { createmenuitem(TXT_CONTINUE,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_C); count+=16; } else createmenuitemempty(); createmenuitem(TXT_NEW_GAME,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_N); count+=16; checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(620); drawtext(mappack.name,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f); if (player[playernum].levelnum>0) drawtext(TXT_PLAYER_INFO_MAPPACK,(320|TEXT_CENTER),320,12,1.0f,1.0f,1.0f,1.0f,mappack.levelname[playermappack[playernum].levelnum-1],playermappack[playernum].numoflives,playermappack[playernum].totalscore,playermappack[playernum].highscore); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); if (menuitem[1].active || menuitem[2].active) { if (menuitem[2].active) { playerdifficultymenu(); if (game.difficulty==-1) { game.difficulty=0; goto newgamebypass; } playermappack[playernum].difficulty=game.difficulty; playermappack[playernum].levelnum=1; playermappack[playernum].totalscore=0; playermappack[playernum].numoflives=5; if (playermappack[playernum].difficulty==3) playermappack[playernum].numoflives=0; } mappackpregamemenu(); newgamebypass:; } } resetmenuitems(); saveplayermappack(); }
void playcampaignmenu(void) { int count,count2; int changeddir; int numoffiles; int pagenum; changeddir=chdir("level"); listfiles("*.gmp",levellist,0); if (changeddir==0) chdir(".."); numoffiles=0; while (levellist[numoffiles][0]!=0) numoffiles++; pagenum=0; resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); count=0; for (count2=0;count2<8;count2++) if (pagenum+count<numoffiles) { createmenuitem(levellist[pagenum+count],64,320+count2*12,12,1.0f,1.0f,1.0f,1.0f); count++; } for (count2=0;count2<8;count2++) if (pagenum+count<numoffiles) { createmenuitem(levellist[pagenum+count],256,320+count2*12,12,1.0f,1.0f,1.0f,1.0f); count++; } for (count2=0;count2<8;count2++) if (pagenum+count<numoffiles) { createmenuitem(levellist[pagenum+count],448,320+count2*12,12,1.0f,1.0f,1.0f,1.0f); count++; } createmenuitem(TXT_PAGE_UP,(304|TEXT_END),416,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_PAGEUP); setmenuitem(MO_SET,&pagenum,pagenum-24); if (pagenum<24) setmenuitem(MO_HIGHLIGHT,0); createmenuitem(TXT_PAGE_DOWN,320,416,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_PAGEDOWN); setmenuitem(MO_SET,&pagenum,pagenum+24); if (pagenum+24>=numoffiles) setmenuitem(MO_HIGHLIGHT,0); checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(620); drawtext(TXT_PLAY_CAMPAIGN,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); for (count=1;count<=24;count++) if (pagenum+count-1<numoffiles) if (menuitem[count].active) { strcpy(mappack.filename,levellist[pagenum+count-1]); loadmappack(); campaignmenu(); } } resetmenuitems(); }
void highscoremenu(int levelnum) { int count,count2; int replaysaved; float bright; replaysaved=0; count2=-1; if (game.exit==GAMEEXIT_WON) { count2=10; while (count2>0 && game.time>highscore[levelnum][count2-1].time) count2--; if (count2!=10) { for (count=10;count>=count2;count--) { highscore[levelnum][count+1].time=highscore[levelnum][count].time; memcpy(highscore[levelnum][count+1].name,highscore[levelnum][count].name,32); } highscore[levelnum][count2].time=game.time; memcpy(highscore[levelnum][count2].name,player[playernum].name,32); } } resetmenuitems(); while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); if (game.exit==GAMEEXIT_WON) if (!replaysaved) createmenuitem(TXT_SAVEREPLAY,96,356,16,1.0f,1.0f,1.0f,1.0f); if (game.exit!=GAMEEXIT_WON) { count=320; createmenuitem(TXT_LEVEL" 1",64,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,1); count+=16; createmenuitem(TXT_LEVEL" 2",64,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,2); count+=16; createmenuitem(TXT_LEVEL" 3",64,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,3); count+=16; createmenuitem(TXT_LEVEL" 4",64,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,4); count+=16; createmenuitem(TXT_LEVEL" 5",64,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,5); count+=16; createmenuitem(TXT_LEVEL" 6",64,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,6); count+=16; createmenuitem(TXT_LEVEL" 7",64,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,7); count+=16; createmenuitem(TXT_LEVEL" 8",64,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,8); count+=16; count=320; createmenuitem(TXT_LEVEL" 9",240,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,9); count+=16; createmenuitem(TXT_LEVEL" 10",240,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,10); count+=16; createmenuitem(TXT_LEVEL" 11",240,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,11); count+=16; createmenuitem(TXT_LEVEL" 12",240,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,12); count+=16; createmenuitem(TXT_LEVEL" 13",240,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,13); count+=16; createmenuitem(TXT_LEVEL" 14",240,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,14); count+=16; createmenuitem(TXT_LEVEL" 15",240,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,15); count+=16; createmenuitem(TXT_LEVEL" 16",240,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,16); count+=16; count=320; createmenuitem(TXT_LEVEL" 17",416,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,17); count+=16; createmenuitem(TXT_LEVEL" 18",416,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,18); count+=16; createmenuitem(TXT_LEVEL" 19",416,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,19); count+=16; createmenuitem(TXT_LEVEL" 20",416,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,20); count+=16; createmenuitem(TXT_LEVEL" 21",416,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,21); count+=16; createmenuitem(TXT_LEVEL" 22",416,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,22); count+=16; createmenuitem(TXT_LEVEL" 23",416,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_SET,&levelnum,23); count+=16; } checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); updateogg(); checkmusic(); game.songnum=8; soundsimulation(view.position,view.orientation); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(580); drawtext(TXT_LEVEL_HIGHSCORE,(320|TEXT_CENTER),48,16,1.0f,1.0f,1.0f,1.0f,levelnum); drawtext(TXT_NAME,96+64,80,16,1.0f,1.0f,1.0f,1.0f); drawtext(TXT_TIME,96+320,80,16,1.0f,1.0f,1.0f,1.0f); for (count=0;count<10;count++) { if (count==count2 || count2==-1) bright=1.0f; else bright=0.5f; drawtext("/i.",96,112+count*16,16,bright,bright,bright,1.0f,count+1); drawtext(highscore[levelnum][count].name,96+64,112+count*16,16,bright,bright,bright,1.0f); if (((highscore[levelnum][count].time/50)%60)>=10) drawtext("/i:/i./i",96+320,112+count*16,16,bright,bright,bright,1.0f,(highscore[levelnum][count].time/3000),((highscore[levelnum][count].time/50)%60),((highscore[levelnum][count].time/5)%10)); else drawtext("/i:0/i./i",96+320,112+count*16,16,bright,bright,bright,1.0f,(highscore[levelnum][count].time/3000),((highscore[levelnum][count].time/50)%60),((highscore[levelnum][count].time/5)%10)); } if (game.exit==GAMEEXIT_WON) { drawtext(player[playernum].name,96+64,292,16,1.0f,1.0f,1.0f,1.0f); if (((game.time/50)%60)>=10) drawtext("/i:/i./i",96+320,292,16,1.0f,1.0f,1.0f,1.0f,(game.time/3000),((game.time/50)%60),((game.time/5)%10)); else drawtext("/i:0/i./i",96+320,292,16,1.0f,1.0f,1.0f,1.0f,(game.time/3000),((game.time/50)%60),((game.time/5)%10)); } if (game.exit==GAMEEXIT_WON) if (replaysaved) createmenuitem(TXT_REPLAYSAVED,96,356,16,1.0f,1.0f,1.0f,1.0f); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); if (game.exit==GAMEEXIT_WON) if (menuitem[1].active) { savereplay(levelnum); replaysaved=1; menuitem[1].active=0; } } resetmenuitems(); }
void editlevelrope(void) { int count,count2; int simtimer; int simcount; float vec[3],vec2[3]; ropeedit.numofpoints=0; for (count=0;count<level.numofobjects;count++) { if (level.object[count].type>=2 && level.object[count].type<=5) { for (count2=0;count2<4;count2++) { if (count2==0 || count2==3) vec[0]=level.object[count].position[0]-level.object[count].size[0]*0.5f; else vec[0]=level.object[count].position[0]+level.object[count].size[0]*0.5f; if (count2<2) vec[1]=level.object[count].position[1]+level.object[count].size[1]*0.5f; else vec[1]=level.object[count].position[1]-level.object[count].size[1]*0.5f; vec[2]=0.0f; copyvector(ropeedit.point[ropeedit.numofpoints].position,vec); ropeedit.point[ropeedit.numofpoints].objectnum=count; ropeedit.point[ropeedit.numofpoints].particlenum=count2; ropeedit.numofpoints++; copyvector(level.object[count].vertex[count2],vec); } } if (level.object[count].type>=6 && level.object[count].type<=7) { for (count2=0;count2<4;count2++) { vec[0]=level.object[count].position[0]; vec[1]=level.object[count].position[1]; if (count2==0) vec[0]=level.object[count].position[0]+level.object[count].size[0]*0.5f; if (count2==1) vec[1]=level.object[count].position[1]-level.object[count].size[1]*0.5f; if (count2==2) vec[0]=level.object[count].position[0]-level.object[count].size[0]*0.5f; if (count2==3) vec[1]=level.object[count].position[1]+level.object[count].size[1]*0.5f; vec[2]=0.0f; copyvector(ropeedit.point[ropeedit.numofpoints].position,vec); ropeedit.point[ropeedit.numofpoints].objectnum=count; ropeedit.point[ropeedit.numofpoints].particlenum=count2*4; ropeedit.numofpoints++; copyvector(level.object[count].vertex[count2],vec); } count2=4; vec[0]=level.object[count].position[0]; vec[1]=level.object[count].position[1]; vec[2]=0.0f; copyvector(ropeedit.point[ropeedit.numofpoints].position,vec); ropeedit.point[ropeedit.numofpoints].objectnum=count; ropeedit.point[ropeedit.numofpoints].particlenum=16; ropeedit.numofpoints++; copyvector(level.object[count].vertex[count2],vec); } if (level.object[count].type==8) { vec[0]=level.object[count].position[0]; vec[1]=level.object[count].position[1]; vec[2]=0.0f; copyvector(ropeedit.point[ropeedit.numofpoints].position,vec); ropeedit.point[ropeedit.numofpoints].objectnum=count; ropeedit.point[ropeedit.numofpoints].particlenum=0; ropeedit.numofpoints++; copyvector(level.object[count].vertex[0],vec); } } ropeedit.pointnum=-1; simtimer=SDL_GetTicks(); resetmenuitems(); while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_TRUE); glStencilMask(~0); glClearStencil(0); glClear(GL_COLOR_BUFFER_BIT|GL_STENCIL_BUFFER_BIT); glColorMask(GL_TRUE,GL_TRUE,GL_TRUE,GL_FALSE); glStencilMask(0); setuptextdisplay(); glColor3fv(level.ambient[3]); if (level.background[0]!=0) displaybackground(660); numofmenuitems=0; createmenuitem("",0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); checksystemmessages(); checkkeyboard(); checkmouse(); checkmenuitems(); //setupperspectiveviewport(0,0,640,480,1.0f,100.0f); setuporthoviewport(0,0,640,480,10.0f,7.5f,20.0f); setupviewpoint(view.position,view.orientation); setupframelighting(); rendershadows(); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER,0.0f); renderlevelback(); renderlevel(); renderlevelobjects(); renderlevelfore(); glDisable(GL_ALPHA_TEST); renderropeedit(); setuptextdisplay(); drawtext(TXT_NUMOFROPES":/i",0,368,16,1.0f,1.0f,1.0f,1.0f,level.numofropes); drawtext(TXT_TEXTURENUM":/i",0,384,16,1.0f,1.0f,1.0f,1.0f,ropeedit.texturenum); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); vec[0]=view.position[0]+(float)(mouse.x-320)/32.0f; vec[1]=view.position[1]+(float)(240-mouse.y)/32.0f; vec[2]=0.0f; ropeedit.pointhighlight=-1; for (count=0;count<ropeedit.numofpoints;count++) { subtractvectors(vec2,ropeedit.point[count].position,vec); if (vectorlength(vec2)<0.25f) ropeedit.pointhighlight=count; } if (ropeedit.pointnum==-1) { if (mouse.lmb && !prevmouse.lmb) if (ropeedit.pointhighlight!=-1) ropeedit.pointnum=ropeedit.pointhighlight; } else { if (mouse.lmb && !prevmouse.lmb) { if (ropeedit.pointhighlight!=-1) if (ropeedit.point[ropeedit.pointnum].objectnum!=ropeedit.point[ropeedit.pointhighlight].objectnum) { level.rope[level.numofropes].type=1; if (keyboard[SCAN_2]) level.rope[level.numofropes].type=2; if (keyboard[SCAN_3]) level.rope[level.numofropes].type=3; if (keyboard[SCAN_4]) level.rope[level.numofropes].type=4; if (keyboard[SCAN_5]) level.rope[level.numofropes].type=5; if (keyboard[SCAN_6]) level.rope[level.numofropes].type=6; if (keyboard[SCAN_7]) level.rope[level.numofropes].type=7; if (keyboard[SCAN_8]) level.rope[level.numofropes].type=8; if (keyboard[SCAN_9]) level.rope[level.numofropes].type=9; if (keyboard[SCAN_0]) level.rope[level.numofropes].type=10; level.rope[level.numofropes].obj1=ropeedit.point[ropeedit.pointnum].objectnum; level.rope[level.numofropes].obj1part=ropeedit.point[ropeedit.pointnum].particlenum; level.rope[level.numofropes].obj2=ropeedit.point[ropeedit.pointhighlight].objectnum; level.rope[level.numofropes].obj2part=ropeedit.point[ropeedit.pointhighlight].particlenum; level.rope[level.numofropes].texturenum=ropeedit.texturenum; level.numofropes++; } ropeedit.pointnum=-1; } } if (mouse.rmb && !prevmouse.rmb) { for (count=0;count<level.numofropes;count++) { if (ropeedit.point[ropeedit.pointhighlight].objectnum==level.rope[count].obj1 && ropeedit.point[ropeedit.pointhighlight].particlenum==level.rope[count].obj1part) deletelevelrope(count); } for (count=0;count<level.numofropes;count++) { if (ropeedit.point[ropeedit.pointhighlight].objectnum==level.rope[count].obj2 && ropeedit.point[ropeedit.pointhighlight].particlenum==level.rope[count].obj2part) deletelevelrope(count); } /* for (count=0;count<level.numofropes;count++) { if (pointintersectline(vec,level.object[level.rope[count].obj1].vertex[level.rope[count].obj1part],level.object[level.rope[count].obj2].vertex[level.rope[count].obj2part],0.25f)) deletelevelrope(count); } */ } simcount=0; while (SDL_GetTicks()-simtimer>20 && simcount<5) { simcount++; count=SDL_GetTicks()-simtimer-20; simtimer=SDL_GetTicks()-count; if (!menuinputkeyboard) { if (keyboard[SCAN_W]) view.position[1]+=0.2f; if (keyboard[SCAN_S]) view.position[1]-=0.2f; if (keyboard[SCAN_A]) view.position[0]-=0.2f; if (keyboard[SCAN_D]) view.position[0]+=0.2f; } } if (keyboard[SCAN_Q] && !prevkeyboard[SCAN_Q]) if (ropeedit.texturenum<3) ropeedit.texturenum++; if (keyboard[SCAN_Z] && !prevkeyboard[SCAN_Z]) if (ropeedit.texturenum>0) ropeedit.texturenum--; } resetmenuitems(); }
void singlelevelmenu(void) { int count; resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); count=320; createmenuitem(TXT_LEVEL" 1-1",64,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 1-2",64,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 1-3",64,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 1-4",64,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 1-5",64,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 1-6",64,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 1-7",64,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 2-1",64,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 2-2",64,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; count=320; createmenuitem(TXT_LEVEL" 2-3",192,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 2-4",192,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 2-5",192,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 2-6",192,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 2-7",192,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 3-1",192,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 3-2",192,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 3-3",192,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 3-4",192,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; count=320; createmenuitem(TXT_LEVEL" 3-5",320,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 3-6",320,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 3-7",320,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 4-1",320,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 4-2",320,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 4-3",320,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 4-4",320,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 4-5",320,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 4-6",320,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; count=320; createmenuitem(TXT_LEVEL" 4-7",448,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 5-1",448,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 5-2",448,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 5-3",448,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 5-4",448,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 5-5",448,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; createmenuitem(TXT_LEVEL" 5-6",448,count,12,1.0f,1.0f,1.0f,1.0f); count+=12; checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); updateogg(); checkmusic(); game.songnum=8; soundsimulation(view.position,view.orientation); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(620); drawtext(TXT_SINGLE_LEVEL,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); for (count=1;count<=34;count++) if (menuitem[count].active) { game.songnum=-1; checkmusic(); game.editing=0; game.levelnum=0; loadstorylevel(count); gameloop(); savereplay(count+100); joymenunum=count; } } resetmenuitems(); }
void collectionmenu(void) { int count; resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); count=320; createmenuitem(TXT_LEVEL" 1",64,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 2",64,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 3",64,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 4",64,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 5",64,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 6",64,count,16,1.0f,1.0f,1.0f,1.0f); count+=16; createmenuitem(TXT_LEVEL" 7",64,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 8",64,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; count=320; createmenuitem(TXT_LEVEL" 9",240,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 10",240,count,16,1.0f,1.0f,1.0f,1.0f); count+=16; createmenuitem(TXT_LEVEL" 11",240,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 12",240,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 13",240,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 14",240,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 15",240,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 16",240,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; count=320; createmenuitem(TXT_LEVEL" 17",416,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 18",416,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 19",416,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 20",416,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 21",416,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 22",416,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_LEVEL" 23",416,count,16,1.0f,1.0f,1.0f,1.0f); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=16; createmenuitem(TXT_HIGH_SCORE,416,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_H); count+=16; checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); updateogg(); checkmusic(); game.songnum=8; soundsimulation(view.position,view.orientation); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(620); drawtext(TXT_COLLECTION_MODE,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); for (count=1;count<24;count++) if (menuitem[count].active) { game.songnum=-1; checkmusic(); game.editing=0; game.levelnum=0; loadcollectionlevel(count); gameloop(); if (!game.playreplay) if (game.exit==4) highscoremenu(count); joymenunum=count; } if (menuitem[24].active) { game.exit=3; highscoremenu(1); } } resetmenuitems(); }
void playerdifficultymenu(void) { int count; resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !menuitem[1].active && !menuitem[2].active && !menuitem[3].active && !menuitem[4].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_CANCEL,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); count=352; createmenuitem(TXT_EASY,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_E); count+=16; createmenuitem(TXT_NORMAL,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_N); count+=16; createmenuitem(TXT_HARD,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_H); count+=16; if (player[playernum].unlock[1]) { createmenuitem(TXT_LUDICROUS,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_L); count+=16; if (player[playernum].unlock[2]) { createmenuitem(TXT_MINI_GISH,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_M); count+=16; } } checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); updateogg(); checkmusic(); game.songnum=8; soundsimulation(view.position,view.orientation); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(620); if (!player[playernum].gamepassed) drawtext(player[playernum].name,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f); else drawtext(player[playernum].name,(320|TEXT_CENTER),304,16,1.0f,1.0f,0.0f,1.0f); drawtext(TXT_SELECT_DIFFICULTY,48,336,16,1.0f,1.0f,1.0f,1.0f); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); if (menuitem[0].active) game.difficulty=-1; if (menuitem[1].active) game.difficulty=0; if (menuitem[2].active) game.difficulty=1; if (menuitem[3].active) game.difficulty=2; if (menuitem[4].active) game.difficulty=3; if (menuitem[5].active) game.difficulty=4; } resetmenuitems(); }
void playerstartmenu(void) { int count,count2,count3; if (playernum==-1) return; resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); count=352; if (player[playernum].levelnum>0) { createmenuitem(TXT_CONTINUE,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_C); count+=16; createmenuitem(TXT_COLLECTION_GAME,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_O); count+=16; createmenuitem(TXT_NEW_GAME,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_N); count+=16; createmenuitem(TXT_PRACTICE,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_P); count+=16; createmenuitem(TXT_REPLAY,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_R); count+=16; #ifndef DEMO /* if (player[playernum].unlock[0]) { createmenuitem(TXT_SINGLE_LEVEL,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_S); count+=16; } else */ createmenuitemempty(); #endif #ifndef DEMO createmenuitem(TXT_CUSTOM_LEVELS,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_U); count+=16; #endif } else { createmenuitem(TXT_NEW_GAME,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_N); count+=16; createmenuitem(TXT_COLLECTION_GAME,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_O); count+=16; createmenuitemempty(); createmenuitem(TXT_PRACTICE,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_P); count+=16; createmenuitem(TXT_REPLAY,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_R); count+=16; /* if (player[playernum].unlock[0]) { createmenuitem(TXT_SINGLE_LEVEL,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_S); count+=16; } else */ createmenuitemempty(); #ifndef DEMO createmenuitem(TXT_CUSTOM_LEVELS,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_U); count+=16; #endif } checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); updateogg(); checkmusic(); game.songnum=8; soundsimulation(view.position,view.orientation); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(620); count2=(player[playernum].levelnum-1)/7+1; count3=(player[playernum].levelnum-1)%7+1; if (count3==0) count3=1; if (!player[playernum].gamepassed) { drawtext(player[playernum].name,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f); if (player[playernum].levelnum>0) { drawtext(TXT_PLAYER_INFO,(320|TEXT_CENTER),320,12,1.0f,1.0f,1.0f,1.0f,count2,count3,player[playernum].numoflives,player[playernum].totalscore,player[playernum].highscore); if (player[playernum].difficulty==0) drawtext(TXT_EASY,(320|TEXT_CENTER),332,12,1.0f,1.0f,1.0f,1.0f); if (player[playernum].difficulty==1) drawtext(TXT_NORMAL,(320|TEXT_CENTER),332,12,1.0f,1.0f,1.0f,1.0f); if (player[playernum].difficulty==2) drawtext(TXT_HARD,(320|TEXT_CENTER),332,12,1.0f,1.0f,1.0f,1.0f); if (player[playernum].difficulty==3) drawtext(TXT_LUDICROUS,(320|TEXT_CENTER),332,12,1.0f,1.0f,1.0f,1.0f); if (player[playernum].difficulty==4) drawtext(TXT_MINI_GISH,(320|TEXT_CENTER),332,12,1.0f,1.0f,1.0f,1.0f); } } else { drawtext(player[playernum].name,(320|TEXT_CENTER),304,16,1.0f,1.0f,0.0f,1.0f); if (player[playernum].levelnum>0) { drawtext(TXT_PLAYER_INFO,(320|TEXT_CENTER),320,12,1.0f,1.0f,0.0f,1.0f,count2,count3,player[playernum].numoflives,player[playernum].totalscore,player[playernum].highscore); if (player[playernum].difficulty==0) drawtext(TXT_EASY,(320|TEXT_CENTER),332,12,1.0f,1.0f,0.0f,1.0f); if (player[playernum].difficulty==1) drawtext(TXT_NORMAL,(320|TEXT_CENTER),332,12,1.0f,1.0f,0.0f,1.0f); if (player[playernum].difficulty==2) drawtext(TXT_HARD,(320|TEXT_CENTER),332,12,1.0f,1.0f,0.0f,1.0f); if (player[playernum].difficulty==3) drawtext(TXT_LUDICROUS,(320|TEXT_CENTER),332,12,1.0f,1.0f,0.0f,1.0f); if (player[playernum].difficulty==4) drawtext(TXT_MINI_GISH,(320|TEXT_CENTER),332,12,1.0f,1.0f,0.0f,1.0f); } } drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); if (menuitem[1].active) { if (player[playernum].levelnum>0) { game.levelnum=player[playernum].levelnum; game.totalscore=player[playernum].totalscore; game.difficulty=player[playernum].difficulty; game.numoflives=player[playernum].numoflives; } else { playerdifficultymenu(); if (game.difficulty==-1) { game.difficulty=0; goto newgamebypass; } player[playernum].difficulty=game.difficulty; game.levelnum=1; game.totalscore=0; game.numoflives=5; if (player[playernum].difficulty==3) { game.numoflives=0; game.turbomode=1; } storyscreen(); } game.songnum=-1; checkmusic(); pregamemenu(); player[playernum].levelnum=game.levelnum; player[playernum].totalscore=game.totalscore; player[playernum].numoflives=game.numoflives; if (player[playernum].highscore<player[playernum].totalscore) player[playernum].highscore=player[playernum].totalscore; #ifdef DEMO if (player[playernum].levelnum==6) { player[playernum].levelnum=0; player[playernum].totalscore=0; player[playernum].numoflives=5; player[playernum].gamepassed=1; } #endif if (player[playernum].levelnum==35) { if (player[playernum].difficulty==1 || player[playernum].difficulty==2) player[playernum].unlock[0]=1; if (player[playernum].difficulty==2) player[playernum].unlock[1]=1; if (player[playernum].difficulty==3) player[playernum].unlock[2]=1; if (player[playernum].difficulty==4) player[playernum].unlock[3]=1; player[playernum].levelnum=0; player[playernum].totalscore=0; player[playernum].numoflives=5; player[playernum].gamepassed=1; } //game.difficulty=0; //menuitem[0].active=1; newgamebypass:; } if (menuitem[2].active) { collectionmenu(); //menuitem[0].active=1; } if (menuitem[3].active) { playerdifficultymenu(); if (game.difficulty==-1) { game.difficulty=0; goto newgamebypass2; } player[playernum].difficulty=game.difficulty; game.levelnum=1; game.totalscore=0; game.numoflives=5; if (player[playernum].difficulty==3) { game.numoflives=0; game.turbomode=1; } storyscreen(); game.songnum=-1; checkmusic(); pregamemenu(); player[playernum].levelnum=game.levelnum; player[playernum].totalscore=game.totalscore; player[playernum].numoflives=game.numoflives; if (player[playernum].highscore<player[playernum].totalscore) player[playernum].highscore=player[playernum].totalscore; #ifdef DEMO if (player[playernum].levelnum==6) { player[playernum].levelnum=0; player[playernum].totalscore=0; player[playernum].numoflives=5; player[playernum].gamepassed=1; } #endif if (player[playernum].levelnum==35) { if (player[playernum].difficulty==1 || player[playernum].difficulty==2) player[playernum].unlock[0]=1; if (player[playernum].difficulty==2) player[playernum].unlock[1]=1; if (player[playernum].difficulty==3) player[playernum].unlock[2]=1; if (player[playernum].difficulty==4) player[playernum].unlock[3]=1; player[playernum].levelnum=0; player[playernum].totalscore=0; player[playernum].numoflives=5; player[playernum].gamepassed=1; } //game.difficulty=0; //menuitem[0].active=1; newgamebypass2:; } if (menuitem[4].active) { game.songnum=-1; checkmusic(); game.editing=0; game.levelnum=0; loadlevel("playroom.lvl"); gameloop(); } if (menuitem[5].active) { game.songnum=-1; checkmusic(); replaymenu(); } if (menuitem[6].active) { singlelevelmenu(); } if (menuitem[7].active) { custommenu(); } } resetmenuitems(); }
void playermenu(void) { int count,count2,count3; int deleteplayer; resetmenuitems(); joymenunum=1; playernum=-1; deleteplayer=0; while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); if (playernum==-1) { count=128; createmenuitem("",64,count,32,0.25f,0.25f,0.25f,1.0f); setmenuitem(MO_SET,&playernum,0); setmenuitem(MO_HOTKEY,SCAN_1); count+=40; createmenuitem("",64,count,32,0.25f,0.25f,0.25f,1.0f); setmenuitem(MO_SET,&playernum,1); setmenuitem(MO_HOTKEY,SCAN_2); count+=40; createmenuitem("",64,count,32,0.25f,0.25f,0.25f,1.0f); setmenuitem(MO_SET,&playernum,2); setmenuitem(MO_HOTKEY,SCAN_3); count+=40; createmenuitem("",64,count,32,0.25f,0.25f,0.25f,1.0f); setmenuitem(MO_SET,&playernum,3); setmenuitem(MO_HOTKEY,SCAN_4); count+=40; createmenuitem("",64,count,32,0.25f,0.25f,0.25f,1.0f); setmenuitem(MO_SET,&playernum,4); setmenuitem(MO_HOTKEY,SCAN_5); count+=40; createmenuitem("",64,count,32,0.25f,0.25f,0.25f,1.0f); setmenuitem(MO_SET,&playernum,5); setmenuitem(MO_HOTKEY,SCAN_6); count+=40; count+=16; createmenuitem(TXT_DELETE_PLAYER,64,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_TOGGLE,&deleteplayer); } else if (!deleteplayer) { count=128+playernum*40-16; createmenuitem(" ",96,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_STRINGINPUT,player[playernum].name); if (player[playernum].name[0]!=0) { createmenuitem(TXT_CREATE,432,count+16,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_C); } } checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); updateogg(); checkmusic(); game.songnum=8; soundsimulation(view.position,view.orientation); if (playernum!=-1) { if (numofmenuitems>3) { if (player[playernum].name[0]!=0) menuitem[2].active=1; else menuitem[1].active=1; } } setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(580); drawmenuitems(); for (count=0;count<6;count++) { if (count!=playernum || deleteplayer) { if (player[count].name[0]!=0) { count2=(player[count].levelnum-1)/7+1; count3=(player[count].levelnum-1)%7+1; if (count3==0) count3=1; if (!player[count].gamepassed) { drawtext("/i-/s",64,128+count*40,16,1.0f,1.0f,1.0f,1.0f,count+1,player[count].name); drawtext(TXT_PLAYER_INFO,64,128+count*40+16,12,1.0f,1.0f,1.0f,1.0f,count2,count3,player[count].numoflives,player[count].totalscore,player[count].highscore); } else { drawtext("/i-/s",64,128+count*40,16,1.0f,1.0f,0.0f,1.0f,count+1,player[count].name); drawtext(TXT_PLAYER_INFO,64,128+count*40+16,12,1.0f,1.0f,0.0f,1.0f,count2,count3,player[count].numoflives,player[count].totalscore,player[count].highscore); } if (count==playernum && deleteplayer) { drawtext("/i-/s",64,128+count*40,16,1.0f,0.0f,0.0f,1.0f,count+1,player[count].name); drawtext(TXT_PLAYER_INFO,64,128+count*40+16,12,1.0f,0.0f,0.0f,1.0f,count2,count3,player[count].numoflives,player[count].totalscore,player[count].highscore); } } else drawtext(TXT_NEW_PLAYER,64,128+count*40,16,1.0f,1.0f,1.0f,1.0f,count+1); } else drawtext("/i-",64,128+count*40,16,1.0f,1.0f,1.0f,1.0f,count+1); } if (playernum==-1) drawtext(TXT_CHOOSE_PLAYER,(320|TEXT_CENTER),64,16,1.0f,1.0f,1.0f,1.0f); else { if (!deleteplayer || player[playernum].name[0]==0) drawtext(TXT_ENTER_NAME,(320|TEXT_CENTER),64,16,1.0f,1.0f,1.0f,1.0f); else drawtext(TXT_DELETE_Y_N,(320|TEXT_CENTER),64,16,1.0f,1.0f,1.0f,1.0f,player[playernum].name); } drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); if (deleteplayer) if (playernum!=-1) { if (player[playernum].name[0]==0) deleteplayer=0; else { #ifdef GERMAN if (keyboard[SCAN_J]) #else if (keyboard[SCAN_Y]) #endif { memset(&player[playernum],0,sizeof(player[playernum])); playernum=-1; deleteplayer=0; resetmenuitems(); } if (keyboard[SCAN_N] || keyboard[SCAN_ESC]) { playernum=-1; deleteplayer=0; resetmenuitems(); } } } if (playernum!=-1) if (player[playernum].name[0]!=0) if (menuitem[2].active) { if (!deleteplayer) { playerstartmenu(); joymenunum=0;//playernum+1; playernum=-1; } /* else { //menuitem[2].active=0; //playernum=-1; } */ } } if (playernum!=-1) player[playernum].name[0]=0; resetmenuitems(); }
void versusmodemenu(int versusnum) { int count; int unlocked; char filename[32]; unlocked=0; for (count=0;count<6;count++) if (player[count].unlock[1]) unlocked=1; resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_EXIT,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); count=250; createmenuitem(TXT_LEVEL" 1",(320|TEXT_CENTER),count,20,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_1); count+=20; createmenuitem(TXT_LEVEL" 2",(320|TEXT_CENTER),count,20,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_2); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=20; createmenuitem(TXT_LEVEL" 3",(320|TEXT_CENTER),count,20,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_3); #ifdef DEMO setmenuitem(MO_HIGHLIGHT,0); #endif count+=20; #ifndef DEMO if (unlocked) { createmenuitem(TXT_LEVEL" 4",(320|TEXT_CENTER),count,20,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_4); count+=20; } else createmenuitemempty(); #endif #ifndef DEMO count=360; if (versusnum==0 || versusnum==1) { createmenuitem(TXT_LEVEL" 5",(320|TEXT_CENTER),count,20,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_5); count+=20; createmenuitem(TXT_LEVEL" 6",(320|TEXT_CENTER),count,20,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_6); count+=20; } #endif checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); updateogg(); checkmusic(); game.songnum=8; soundsimulation(view.position,view.orientation); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(540); drawbackground(530+versusnum,(320|TEXT_CENTER),48,192,192,640,480); drawtext("2 "TXT_PLAYER,(320|TEXT_CENTER),234,16,1.0f,1.0f,1.0f,1.0f); if (versusnum==0 || versusnum==1) drawtext("4 "TXT_PLAYER,(320|TEXT_CENTER),344,16,1.0f,1.0f,1.0f,1.0f); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); if (versusnum==0) strcpy(filename,"bathhouse"); if (versusnum==1) strcpy(filename,"field"); if (versusnum==2) strcpy(filename,"amber"); if (versusnum==3) strcpy(filename,"fight"); if (versusnum==4) strcpy(filename,"dragster"); if (versusnum==5) strcpy(filename,"colvs"); if (versusnum==6) strcpy(filename,"racing"); if (menuitem[1].active) { game.songnum=-1; checkmusic(); game.levelnum=0; strcat(filename,".lvl"); loadlevel(filename); gameloop(); } if (menuitem[2].active) { game.songnum=-1; checkmusic(); game.levelnum=0; strcat(filename,"2.lvl"); loadlevel(filename); gameloop(); } if (menuitem[3].active) { game.songnum=-1; checkmusic(); game.levelnum=0; strcat(filename,"3.lvl"); loadlevel(filename); gameloop(); } if (menuitem[4].active) { game.songnum=-1; checkmusic(); game.levelnum=0; strcat(filename,"4.lvl"); loadlevel(filename); gameloop(); } if (menuitem[5].active) { game.songnum=-1; checkmusic(); if (versusnum==0) strcpy(filename,"4bath"); if (versusnum==1) strcpy(filename,"4field"); game.levelnum=0; strcat(filename,".lvl"); loadlevel(filename); gameloop(); } if (menuitem[6].active) { game.songnum=-1; checkmusic(); if (versusnum==0) strcpy(filename,"4bath"); if (versusnum==1) strcpy(filename,"4field"); game.levelnum=0; strcat(filename,"2.lvl"); loadlevel(filename); gameloop(); } } resetmenuitems(); }
void custommenu(void) { int count; resetmenuitems(); joymenunum=1; while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_EXIT,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); count=352; createmenuitem(TXT_PLAY_CAMPAIGN,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_C); count+=16; createmenuitem(TXT_LOAD_LEVEL,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_L); count+=16; createmenuitem(TXT_LEVEL_EDITOR,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_E); count+=16; createmenuitem(TXT_CAMPAIGN_EDITOR,48,count,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_A); count+=16; checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); updateogg(); checkmusic(); game.songnum=8; soundsimulation(view.position,view.orientation); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(620); drawtext(TXT_CUSTOM_LEVELS,(320|TEXT_CENTER),304,16,1.0f,1.0f,1.0f,1.0f); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); if (menuitem[1].active) { game.songnum=-1; checkmusic(); game.editing=0; playcampaignmenu(); } if (menuitem[2].active) { game.songnum=-1; checkmusic(); game.editing=0; loadlevelmenu(); } if (menuitem[3].active) { game.songnum=-1; checkmusic(); game.editing=1; game.levelnum=0; createlevel(); gameloop(); game.editing=0; } if (menuitem[4].active) { newmappackmenu(); } } resetmenuitems(); }
void endingmenu(void) { int count; resetmenuitems(); while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem("Next",(640|TEXT_END),0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(580); count=192; if (game.exit==GAMEEXIT_WON) { drawbackground(520,(320|TEXT_CENTER),48,256,128,640,480); drawtext(TXT_ENDING_LINE1,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_LINE2,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_LINE3,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_LINE4,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_LINE5,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_LINE6,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; count+=14; drawtext(TXT_ENDING_LINE7,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_LINE8,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_LINE9,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_LINE10,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_LINE11,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_LINE12,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; } if (game.exit==GAMEXIT_WARPZONE) { drawbackground(519,(320|TEXT_CENTER),48,256,128,640,480); drawtext(TXT_ENDING_BAD_LINE1,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_BAD_LINE2,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_BAD_LINE3,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_BAD_LINE4,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_BAD_LINE5,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_BAD_LINE6,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_BAD_LINE7,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; count+=14; drawtext(TXT_ENDING_BAD_LINE8,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_BAD_LINE9,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_BAD_LINE10,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_BAD_LINE11,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_BAD_LINE12,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; drawtext(TXT_ENDING_BAD_LINE13,64,count,14,1.0f,1.0f,1.0f,1.0f); count+=14; } drawtext(TXT_TOTAL_POINTS":/i",64,400,16,1.0f,1.0f,1.0f,1.0f,game.totalscore); if (player[playernum].difficulty==1 || player[playernum].difficulty==2) drawtext(TXT_NEW_VS_MODE,64,416,16,1.0f,1.0f,1.0f,1.0f); if (player[playernum].difficulty==2) drawtext(TXT_NEW_VS_LEVEL,64,432,16,1.0f,1.0f,1.0f,1.0f); if (player[playernum].difficulty==3) drawtext(TXT_MINI_GISH_MODE,64,432,16,1.0f,1.0f,1.0f,1.0f); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); } resetmenuitems(); while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem(TXT_BACK,0,0,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); checksystemmessages(); checkkeyboard(); checkmouse(); checkjoystick(); checkmenuitems(); setuptextdisplay(); glColor4f(1.0f,1.0f,1.0f,1.0f); displaybackground(560); if (game.exit==GAMEXIT_WARPZONE) drawbackground(256+68,288,320,96,96,640,480); drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); } resetmenuitems(); }
void notsupportedmenu(void) { int count; char *glvendor; char *glrenderer; char *glversion; char *ext; glvendor=(char *) glGetString(GL_VENDOR); glrenderer=(char *) glGetString(GL_RENDERER); glversion=(char *) glGetString(GL_VERSION); ext=(char *) glGetString(GL_EXTENSIONS); resetmenuitems(); while (!menuitem[0].active && !windowinfo.shutdown) { glClearColor(0.0f,0.0f,0.0f,0.0f); glClear(GL_COLOR_BUFFER_BIT); numofmenuitems=0; createmenuitem("Exit",8,8,16,1.0f,1.0f,1.0f,1.0f); setmenuitem(MO_HOTKEY,SCAN_ESC); count=352; createmenuitem("NVIDIA Drivers",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f); count+=16; createmenuitem("ATI Drivers",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f); count+=16; createmenuitem("Intel Drivers",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f); count+=16; checksystemmessages(); checkkeyboard(); checkmouse(); checkmenuitems(); setuptextdisplay(); count=224; drawtext("Multitexture required",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f); count+=16; count+=16; drawtext("Make sure you have the",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f); count+=16; drawtext("latest video card drivers",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f); count+=16; drawtext("for your computer",(320|TEXT_CENTER),count,16,1.0f,1.0f,1.0f,1.0f); count+=16; count=432; drawtext("GL_VERSION: /s",8,count,12,1.0f,1.0f,1.0f,1.0f,glversion); count+=12; drawtext("GL_VENDOR: /s",8,count,12,1.0f,1.0f,1.0f,1.0f,glvendor); count+=12; drawtext("GL_RENDERER: /s",8,count,12,1.0f,1.0f,1.0f,1.0f,glrenderer); count+=12; drawmenuitems(); drawmousecursor(768+font.cursornum,mouse.x,mouse.y,16,1.0f,1.0f,1.0f,1.0f); SDL_GL_SwapBuffers(); if (menuitem[1].active) { launchwebpage("www.nvidia.com/content/drivers/drivers.asp"); menuitem[1].active=0; } if (menuitem[2].active) { launchwebpage("ati.amd.com/support/driver.html"); menuitem[2].active=0; } if (menuitem[3].active) { launchwebpage("downloadcenter.intel.com"); menuitem[3].active=0; } } resetmenuitems(); if ((fp=fopen("glreport.txt","wb"))==NULL) return; fprintf(fp,"%s\r\n",glversion); fprintf(fp,"%s\r\n",glvendor); fprintf(fp,"%s\r\n",glrenderer); fprintf(fp,"%s\r\n",ext); }