Advertisement
ZoriaRPG

Game Over Screen Alpha 2

Feb 23rd, 2018
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.19 KB | None | 0 0
  1. const int GAMEOVER_SPRITE_LINK_SPIN =  0; //lweapon sparkle
  2. const int GAMEOVER_SPRITE_WINKOUT = 0; //winkout sparkle
  3. const int GAMEOVER_SPRITE_MISC = 15;
  4. const int GAMEOVER_SPRITE_MISC_VAL = 9316.7810;
  5.  
  6. const int GAMEOVER_SFX_CURSOR = 0;
  7. const int GAMEOVER_SFX_SELECTION = 0;
  8. const int GAMEOVER_SFX_LINKDEATH = 0;
  9. const int GAMEOVER_MAX_DEATHFRAME = 0;
  10. const int GAMEOVER_BLACK = 10;
  11. const int GAMEOVER_BG = 10;
  12. const int GAMEOVER_TEXT =  1;
  13. const int GAMEOVER_CURSOR_TILE = 1;
  14. const int GAMEOVER_CURSOR_X = 0;
  15. const int GAMEOVER_CURSOR_SAVE_Y = 0;
  16. const int GAMEOVER_CURSOR_DONTSAVE_Y = 0;
  17. const int GAMEOVER_TEXT_X = 0;
  18. const int GAMEOVER_TEXT_SAVE_Y = 0;
  19. const int GAMEOVER_TEXT_DONTSAVE_Y = 0;
  20. const int GAMEOVER_MIDI_SILENT = 0;
  21. const int GAMEOVER_MIDI = 0;
  22. const int GAMEOVER_LINKSPINTILE_FIRST = 0;
  23.  
  24. const int GAMEOVER_LINKSPINTILE_LAST = 0;
  25. const int GAMEOVER_LINKSPINTILE_FRAMES_PER_TILE = 0;
  26.  
  27. const int GAMEOVER_LINKSPINTILE_NUM_SPINS = 0;
  28.  
  29.  
  30.  
  31. global script noF6
  32. {
  33.      void run()
  34.      {
  35.           int quit = 0; int deathframe; bool cur_selection; int spinframes; int spinloops = GAMEOVER_LINKSPINTILE_NUM_SPINS;
  36.           while(Link->HP > 0)
  37.           {
  38.                //This replaces your normal while(true) loop!
  39.                //Function calls for that, go here!
  40.                Waitdraw();
  41.                Waitframe();
  42.           }
  43.           //standard game loop ended, so we're on Game Over.
  44.           while(!quit)
  45.           {
  46.                //Set game music to a silent MIDI.
  47.  
  48.                Link->HP = 1;
  49.                Link->Invisible = true;
  50.                Link->CollDetection = false;
  51.                //Clean up screen objects
  52.                if ( Screen->NumNPCs() )
  53.                {
  54.                     for ( int q = Screen->NumNPCs(); q > 0; --q )
  55.                     { npc n = Screen->LoadNPC(q); Remove(n); }
  56.                }
  57.                if ( Screen->NumLWeapons() )
  58.                {
  59.                     for ( int q = Screen->NumLWeapons(); q > 0; --q )
  60.                     {
  61.                          lweapon n = Screen->LoadLWeapon(q);          
  62.                          if ( n->Misc[GAMEOVER_SPRITE_MISC] != GAMEOVER_SPRITE_MISC_VAL ) { Remove(n); }
  63.                     }
  64.                }
  65.                if ( Screen->NumEWeapons() )
  66.                {
  67.                     for ( int q = Screen->NumEWeapons(); q > 0; --q )
  68.                     { eweapon n = Screen->LoadEWeapon(q); Remove(n); }
  69.                }
  70.                if ( Screen->NumItems() )
  71.                {
  72.                     for ( int q = Screen->NumItems(); q > 0; --q )
  73.                     { item n = Screen->LoadItem(q); Remove(n); }
  74.                }
  75.                //clear all ffcs
  76.                for ( int q = 1; q < 33; ++q )
  77.                {
  78.                     ffc f = Screen->LoadFFC(q);
  79.                     f->Data = 0; f->Script = 0;
  80.                }
  81.                //Do Link Death animation
  82.                if ( deathframe == 0 ) Game->PlaySound( GAMEOVER_SFX_LINKDEATH );
  83.                ++deathframe;
  84.                lweapon sprite = Game->CreateLWeapon(LW_SPARKLE);
  85.                sprite->UseSprite( GAMEOVER_SPRITE_LINK_SPIN );
  86.                sprite->Misc[GAMEOVER_SPRITE_MISC] = GAMEOVER_SPRITE_MISC_VAL;
  87.                if ( deathframe == 1 )
  88.                {
  89.                     spinframes = sprite->deadstate;
  90.                }
  91.                while(sprite->isValid())
  92.                {
  93.                     //Kill all inputs.
  94.                     if ( sprite->DeadState == 0 )
  95.                     {
  96.                          if ( spinloops > 0 )
  97.                          {
  98.                               sprite->DeadState = spinframes;
  99.                               --spinloops;
  100.                          }
  101.                     }
  102.                     Waitdraw(); Waitframe();
  103.                }
  104.                lweapon winkout = Screen->CreateLWeapon(LW_SPARKLE);
  105.                winkout->UseSprite( GAMEOVER_SPRITE_WINKOUT );
  106.                winkout->Misc[GAMEOVER_SPRITE_MISC] = GAMEOVER_SPRITE_MISC_VAL;
  107.                while(winkout->isValid())
  108.                {
  109.                     //Kill all inputs
  110.                     Waitdraw(); Waitframe();
  111.                }
  112.                //Play game over midi.
  113.                //Draw black background with Quad()
  114.                //Draw text SAVE / DON'T SAVE
  115.                //Draw cursor, with SAVE as the default.
  116.                cur_selection = true;
  117.                if ( Link->PressDown || Link->PressUp )
  118.                {
  119.                     cur_selection = !cur_selection; //flip its state
  120.                     Game->PlaySound( GAMEOVER_SFX_CURSOR );
  121.                }
  122.                if ( Link->PressStart )
  123.                {
  124.                     Link->PressStart = false; Link->InputStart = false;
  125.                     Game->PlaySound( GAMEOVER_SFX_SELECTION );
  126.                     if ( cur_selection ) quit = 1;
  127.                     else quit = 2; //no save
  128.                }
  129.                Waitdraw(); Waitframe();
  130.           }
  131.           //The user has made a selection, so the quit loop is over.
  132.           if ( quit == 1 )
  133.           {
  134.                Game->Save();
  135.                Game->End();
  136.           }
  137.           else Game->End();
  138.      }
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement