X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FGameTick.cpp;h=b3114ede00ef316177d82a46fc01e3b8a03aea50;hb=dc03d60e08bdc0b97ea7b07e8973ed42450c9482;hp=e1ea0433fa973fb4d3bb962e31458ee5d770a2a8;hpb=b4cb68756603ec3f7edfcf94107fd05a1fc5a8f6;p=lugaru.git diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index e1ea043..b3114ed 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -213,14 +213,6 @@ extern bool campaign; extern float oldgamespeed; -extern float accountcampaignhighscore[10]; -extern float accountcampaignfasttime[10]; -extern float accountcampaignscore[10]; -extern float accountcampaigntime[10]; - -extern int accountcampaignchoicesmade[10]; -extern int accountcampaignchoices[10][5000]; - static const char *rabbitskin[] = { ":Data:Textures:Fur3.jpg", ":Data:Textures:Fur.jpg", @@ -322,142 +314,131 @@ static void ch_save(Game *game, const char *args) fpackf(tfile, "Bi Bi", player[0].whichskin, player[0].creature); fpackf(tfile, "Bi", numdialogues); - if(numdialogues) - for(k=0;k1&&numplayers0&&player[j].num_weapons<5) - for(k=0;knumpathpoints); - if(game->numpathpoints) - for(j=0;jnumpathpoints;j++){ - fpackf(tfile, "Bf Bf Bf Bi", game->pathpoint[j].x, game->pathpoint[j].y, game->pathpoint[j].z, game->numpathpointconnect[j]); - for(k=0;knumpathpointconnect[j];k++){ - fpackf(tfile, "Bi", game->pathpointconnect[j][k]); - } - } + for(j=0;jnumpathpoints;j++){ + fpackf(tfile, "Bf Bf Bf Bi", game->pathpoint[j].x, game->pathpoint[j].y, game->pathpoint[j].z, game->numpathpointconnect[j]); + for(k=0;knumpathpointconnect[j];k++){ + fpackf(tfile, "Bi", game->pathpointconnect[j][k]); + } + } fpackf(tfile, "Bf Bf Bf Bf", game->mapcenter.x, game->mapcenter.y, game->mapcenter.z, game->mapradius); @@ -544,9 +525,7 @@ static void set_proportion(int pnum, const char *args) player[pnum].proportionbody=1.1*bodyprop; player[pnum].proportionarms=1.1*armprop; player[pnum].proportionlegs=1.1*legprop; - } - - if(player[pnum].creature==rabbittype){ + } else if(player[pnum].creature==rabbittype){ player[pnum].proportionhead=1.2*headprop; player[pnum].proportionbody=1.05*bodyprop; player[pnum].proportionarms=1.00*armprop; @@ -818,23 +797,21 @@ static void ch_notindemo(Game *game, const char *args) static void ch_type(Game *game, const char *args) { int i, n = sizeof(editortypenames) / sizeof(editortypenames[0]); - for (i = 0; i < n; i++) - if (stripfx(args, editortypenames[i])) - { - editoractive = i; - break; - } + for (i = 0; i < n; i++) + if (stripfx(args, editortypenames[i])) { + editoractive = i; + break; + } } static void ch_path(Game *game, const char *args) { int i, n = sizeof(pathtypenames) / sizeof(pathtypenames[0]); for (i = 0; i < n; i++) - if (stripfx(args, pathtypenames[i])) - { - editorpathtype = i; - break; - } + if (stripfx(args, pathtypenames[i])) { + editorpathtype = i; + break; + } } static void ch_hs(Game *game, const char *args) @@ -1003,9 +980,7 @@ static void ch_default(Game *game, const char *args) player[0].proportionbody=1.1; player[0].proportionarms=1.1; player[0].proportionlegs=1.1; - } - - if(player[0].creature==rabbittype){ + } else if(player[0].creature==rabbittype){ player[0].proportionhead=1.2; player[0].proportionbody=1.05; player[0].proportionarms=1.00; @@ -2539,7 +2514,7 @@ void Game::Tick() if(mainmenu){ //menu buttons if(mainmenu==1||mainmenu==2){ - if(Button()&&!oldbutton&&selected==1){ + if(Input::Button()&&!oldbutton&&selected==1){ if(!gameon){ fireSound(firestartsound); @@ -2562,7 +2537,7 @@ void Game::Tick() } } - if(Button()&&!oldbutton&&selected==2){ + if(Input::Button()&&!oldbutton&&selected==2){ fireSound(); flash(); @@ -2579,7 +2554,7 @@ void Game::Tick() if(newscreenheight<0)newscreenheight=screenheight; } - if(Button()&&!oldbutton&&selected==3){ + if(Input::Button()&&!oldbutton&&selected==3){ fireSound(); flash(); @@ -2597,10 +2572,10 @@ void Game::Tick() } } if(mainmenu==3){ - if(Button()&&!oldbutton&&selected!=-1){ + if(Input::Button()&&!oldbutton&&selected!=-1){ fireSound(); } - if(Button()&&!oldbutton&&selected==0){ + if(Input::Button()&&!oldbutton&&selected==0){ extern SDL_Rect **resolutions; bool isCustomResolution = true; @@ -2648,25 +2623,25 @@ void Game::Tick() } - if(Button()&&!oldbutton&&selected==1){ + if(Input::Button()&&!oldbutton&&selected==1){ newdetail++; if(newdetail>2)newdetail=0; } - if(Button()&&!oldbutton&&selected==2){ + if(Input::Button()&&!oldbutton&&selected==2){ bloodtoggle++; if(bloodtoggle>2)bloodtoggle=0; } - if(Button()&&!oldbutton&&selected==3){ + if(Input::Button()&&!oldbutton&&selected==3){ difficulty++; if(difficulty>2)difficulty=0; } - if(Button()&&!oldbutton&&selected==4){ + if(Input::Button()&&!oldbutton&&selected==4){ ismotionblur=1-ismotionblur; } - if(Button()&&!oldbutton&&selected==5){ + if(Input::Button()&&!oldbutton&&selected==5){ decals=1-decals; } - if(Button()&&!oldbutton&&selected==6){ + if(Input::Button()&&!oldbutton&&selected==6){ musictoggle=1-musictoggle; if(!musictoggle){ @@ -2686,19 +2661,19 @@ void Game::Tick() OPENAL_SetVolume(channels[stream_music3], 256); } } - if(Button()&&!oldbutton&&selected==9){ + if(Input::Button()&&!oldbutton&&selected==9){ invertmouse=1-invertmouse; } - if(Button()&&!oldbutton&&selected==10){ + if(Input::Button()&&!oldbutton&&selected==10){ usermousesensitivity+=.2; if(usermousesensitivity>2)usermousesensitivity=.2; } - if(Button()&&!oldbutton&&selected==11){ + if(Input::Button()&&!oldbutton&&selected==11){ volume+=.1f; if(volume>1.0001f)volume=0; OPENAL_SetSFXMasterVolume((int)(volume*255)); } - if(Button()&&!oldbutton&&selected==7){ + if(Input::Button()&&!oldbutton&&selected==7){ /*fireSound(); */ flash(); @@ -2709,17 +2684,17 @@ void Game::Tick() selected=-1; keyselect=-1; } - if(Button() && !oldbutton && selected == 12) { + if(Input::Button() && !oldbutton && selected == 12) { flash(); newstereomode = stereomode; mainmenu=18; keyselect=-1; } - if(Button() && !oldbutton && selected == 13) { + if(Input::Button() && !oldbutton && selected == 13) { showdamagebar=!showdamagebar; } - if(Button()&&!oldbutton&&selected==8){ + if(Input::Button()&&!oldbutton&&selected==8){ fireSound(); flash(); @@ -2736,7 +2711,7 @@ void Game::Tick() } } if(mainmenu==4){ - if(Button()&&!oldbutton&&selected!=-1&&!waiting){ + if(Input::Button()&&!oldbutton&&selected!=-1&&!waiting){ fireSound(); if(selected<9&&keyselect==-1) keyselect=selected; @@ -2764,7 +2739,7 @@ void Game::Tick() endgame=0; } - if(Button()&&!oldbutton&&selected==1){ + if(Input::Button()&&!oldbutton&&selected==1){ fireSound(); flash(); @@ -2784,7 +2759,7 @@ void Game::Tick() gameon=1; OPENAL_SetPaused(channels[stream_music3], true); } - if(Button()&&!oldbutton&&(selected-7>=accountactive->getCampaignChoicesMade())){//selected>=7&&(selected-7<=campaignnumchoices)){ + if(Input::Button()&&!oldbutton&&(selected-7>=accountactive->getCampaignChoicesMade())){//selected>=7&&(selected-7<=campaignnumchoices)){ fireSound(); flash(); @@ -2821,7 +2796,7 @@ void Game::Tick() gameon=1; OPENAL_SetPaused(channels[stream_music3], true); } - if(Button()&&!oldbutton&&selected==4){ + if(Input::Button()&&!oldbutton&&selected==4){ fireSound(); flash(); @@ -2829,21 +2804,21 @@ void Game::Tick() if(mainmenu==5&&gameon)mainmenu=2; if(mainmenu==5&&!gameon)mainmenu=1; } - if(Button()&&!oldbutton&&selected==5){ + if(Input::Button()&&!oldbutton&&selected==5){ fireSound(); flash(); mainmenu=7; } - if(Button()&&!oldbutton&&selected==3){ + if(Input::Button()&&!oldbutton&&selected==3){ fireSound(); flash(); mainmenu=6; } - if(Button()&&!oldbutton&&selected==2){ + if(Input::Button()&&!oldbutton&&selected==2){ fireSound(); flash(); @@ -2852,7 +2827,7 @@ void Game::Tick() } } if(mainmenu==9){ - if(Button()&&!oldbutton&&selected=0&&selected<=accountactive->getProgress()){ + if(Input::Button()&&!oldbutton&&selected=0&&selected<=accountactive->getProgress()){ fireSound(); flash(); @@ -2873,7 +2848,7 @@ void Game::Tick() gameon=1; OPENAL_SetPaused(channels[stream_music3], true); } - if(Button()&&!oldbutton&&selected==numchallengelevels){ + if(Input::Button()&&!oldbutton&&selected==numchallengelevels){ fireSound(); flash(); @@ -2882,7 +2857,7 @@ void Game::Tick() } } if(mainmenu==11){ - if(Button()&&!oldbutton&&selected=0&&selected<=accountactive->getProgress()){ + if(Input::Button()&&!oldbutton&&selected=0&&selected<=accountactive->getProgress()){ fireSound(); flash(); @@ -2903,7 +2878,7 @@ void Game::Tick() gameon=1; OPENAL_SetPaused(channels[stream_music3], true); } - if(Button()&&!oldbutton&&selected==numchallengelevels){ + if(Input::Button()&&!oldbutton&&selected==numchallengelevels){ fireSound(); flash(); @@ -2913,7 +2888,7 @@ void Game::Tick() } if(mainmenu==10){ endgame=2; - if(Button()&&!oldbutton&&selected==3){ + if(Input::Button()&&!oldbutton&&selected==3){ fireSound(); flash(); @@ -2923,7 +2898,7 @@ void Game::Tick() } if(mainmenu==6){ - if(Button()&&!oldbutton) { + if(Input::Button()&&!oldbutton) { if(selected>-1){ fireSound(); if(selected==1) { @@ -2938,7 +2913,7 @@ void Game::Tick() } } if(mainmenu==7){ - if(Button()&&!oldbutton) { + if(Input::Button()&&!oldbutton) { if(selected!=-1){ fireSound(); if(selected==0&&Account::getNbAccounts()<8){ @@ -2963,7 +2938,7 @@ void Game::Tick() } } if(mainmenu==8){ - if(Button()&&!oldbutton&&selected>-1){ + if(Input::Button()&&!oldbutton&&selected>-1){ fireSound(); if(selected<=2) @@ -2976,7 +2951,7 @@ void Game::Tick() } } if (mainmenu==18) { - if(Button()&&!oldbutton&&selected==0) { + if(Input::Button()&&!oldbutton&&selected==0) { newstereomode = (StereoMode)(newstereomode + 1); while(!CanInitStereo(newstereomode)) { printf("Failed to initialize mode %s (%i)\n", StereoModeName(newstereomode), newstereomode); @@ -2994,11 +2969,11 @@ void Game::Tick() stereoseparation-=0.001; } - if(Button()&&!oldbutton&&selected==2) { + if(Input::Button()&&!oldbutton&&selected==2) { stereoreverse =! stereoreverse; } - if(Button()&&!oldbutton&&selected==3) { + if(Input::Button()&&!oldbutton&&selected==3) { flash(); stereomode = newstereomode; @@ -3009,7 +2984,7 @@ void Game::Tick() } - if(Button()||Input::isKeyDown(MOUSEBUTTON2))oldbutton=1; + if(Input::Button()||Input::isKeyDown(MOUSEBUTTON2))oldbutton=1; else oldbutton=0; if(Input::isKeyDown(SDLK_q)&&Input::isKeyDown(SDLK_LMETA)){