]> git.jsancho.org Git - lugaru.git/commitdiff
Problem fixed (LoadCampaign added when going back to campaign menu)
authorCôme BERNIGAUD <come.bernigaud@gmail.com>
Wed, 11 May 2011 16:49:18 +0000 (18:49 +0200)
committerCôme BERNIGAUD <come.bernigaud@gmail.com>
Wed, 11 May 2011 16:49:18 +0000 (18:49 +0200)
1  2 
Source/GameTick.cpp

index e88ff0e803dc4d87c716809cb6c4c5b69b418e1e,11b72f65bbaa9322848f51834025af4fa1361008..2a9cbd519dba303c29fc98491b3a6c2e35b64978
@@@ -5928,10 -5928,23 +5928,24 @@@ void Game::Tick()
          //campaign over?
                if(mainmenu&&endgame==1)
              mainmenu=10;
 -        if(campaign&&winfreeze&&mainmenu==0&&campaignchoosenext[campaignchoicewhich[whichchoice]]==1){
+         //go to level select after completing a campaign level
++        if(campaign&&winfreeze&&mainmenu==0&&campaignchoosenext[campaignchoicewhich[whichchoice]]==1) {
+             mainmenu=5;
+             gameon=0;
+             winfreeze=0;
+             fireSound();
+             flash();
+             if(musictoggle){
+                 OPENAL_SetFrequency(OPENAL_ALL, 0.001);
+                 emit_stream_np(stream_menutheme);
+                 pause_sound(leveltheme);
+             }
++                      LoadCampaign();
+         }
          //escape key pressed
          //TODO: there must be code somewhere else that handles clicking the Back button, merge it with this
                if(Input::isKeyPressed(SDLK_ESCAPE)&&
--                (gameon||mainmenu==0||(mainmenu>=3&&mainmenu!=8&&!(mainmenu==7&&entername)))){
++                (gameon||mainmenu==0||(mainmenu>=3&&mainmenu!=8&&!(mainmenu==7&&entername)))) {
                        selected=-1;
              if(mainmenu==0&&!winfreeze)
                  mainmenu=2; //pause
@@@ -7776,12 -7787,19 +7787,16 @@@ void Game::TickOnceAfter()
                                }
                        }
  
-                       if(campaign)
-                               if(mainmenu==0&&winfreeze&&(campaignchoosenext[campaignchoicewhich[whichchoice]]==1)) {
 -                      if(campaign){
++                      if(campaign) {
+                 // campaignchoosenext determines what to do when the level is complete:
+                 // 0 = load next level
+                 // 1 = go back to level select screen
+                 // 2 = stealthload next level
+                               if(mainmenu==0&&winfreeze&&(campaignchoosenext[campaignchoicewhich[whichchoice]])==1){
                                        if(campaignnumnext[campaignchoicewhich[whichchoice]]==0)
                                                endgame=1;
 -                }else if(mainmenu==0&&winfreeze){
 -                                      if(campaignchoosenext[campaignchoicewhich[whichchoice]]==2)
 -                                              stealthloading=1;
 -                                      else
 -                        stealthloading=0;
 +                              } else if(mainmenu==0&&winfreeze) {
 +                                      stealthloading = (campaignchoosenext[campaignchoicewhich[whichchoice]]==2);
  
                                        if(!stealthloading){
                                                fireSound(firestartsound);