Advertisement
ZoriaRPG

Custom Game Over Menu [2.50.x]

Oct 24th, 2018
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.22 KB | None | 0 0
  1. const int SPR_DEATH = 88;
  2. const int SPR_DEATH_WINKOUT = 89;
  3.  
  4. const int SFX_WINKOUT = 38;
  5.  
  6. bool dead = false;
  7.  
  8. const int MENU_SEL_POS = 0;
  9. const int MENU_SEL_POS_X = 1;
  10. const int MENU_SEL_POS_Y = 2;
  11. const int DEATH_LX = 3;
  12. const int DEATH_LY = 4;
  13.  
  14. const int DONT_SAVE_X = 86;
  15. const int SAVE_X = 86;
  16. const int DONT_SAVE_Y = 68;
  17. const int SAVE_Y = 54;
  18. const int CURSOR_WIDTH = 8;
  19. const int CURSOR_OFFSET = 18;
  20.  
  21. const int SFX_LINKDEATH = 28;
  22. const int SFX_GAMEOVERSCREEN_CURSOR = 6; //cursor move
  23. const int SFX_GAMEOVERSCREEN_SELECTION = 44; //press start to select it
  24.  
  25. const int TILE_SAVECURSOR = 20;
  26. const int TILE_SAVECURSOR_CSET = 1;
  27.  
  28.  
  29. const int MIDI_GAMEOVER = -4;
  30. const int _COL_BLACK = 0x0F;
  31. const int _COL_RED = 0x93;
  32. const int _COL_WHITE = 0x01;
  33. const int END_DEATH_SPIN = 40;
  34. const int END_WINKOUT = 10;
  35.  
  36. int sv[]="SAVE";
  37. int dsv[]="DON'T SAVE";
  38. int menu_selection[5] = {1,SAVE_Y,DONT_SAVE_Y, 0,0};
  39.  
  40.  
  41. global script noF6
  42. {
  43.     void run()
  44.     {
  45.         int quit = 0; int deathframe;
  46.         while(Link->HP > 0)
  47.         {
  48.             if ( Link->HP < 1 )
  49.             {
  50.                 Link->HP = 1;
  51.                 Link->Invisible = true;
  52.                 Link->CollDetection = false;
  53.                 menu_selection[DEATH_LX] = Link->X;
  54.                 menu_selection[DEATH_LY] = Link->Y;
  55.                 break;
  56.             }
  57.             Waitdraw();
  58.            
  59.             Waitframe();
  60.         }
  61.         while(!quit)
  62.         {
  63.             menu_selection[DEATH_LX] = Link->X;
  64.             menu_selection[DEATH_LY] = Link->Y;
  65.             //Set game music to a silent MIDI.
  66.  
  67.             Link->HP = Link->MaxHP;
  68.             Link->Invisible = true;
  69.             Link->CollDetection = false;
  70.             //Clean up screen objects
  71.             if ( Screen->NumNPCs() )
  72.             {
  73.                 for ( int q = Screen->NumNPCs(); q > 0; --q )
  74.                 {
  75.                     npc n = Screen->LoadNPC(q); Remove(n);
  76.                 }
  77.             }
  78.             if ( Screen->NumLWeapons() )
  79.             {
  80.                 for ( int q = Screen->NumLWeapons(); q > 0; --q )
  81.                 { lweapon n = Screen->LoadLWeapon(q); Remove(n); }
  82.             }
  83.             if ( Screen->NumEWeapons() )
  84.             {
  85.                 for ( int q = Screen->NumEWeapons(); q > 0; --q )
  86.                 { eweapon n = Screen->LoadEWeapon(q); Remove(n); }
  87.             }
  88.             if ( Screen->NumItems() )
  89.             {
  90.                 for ( int q = Screen->NumItems(); q > 0; --q )
  91.                 { item n = Screen->LoadItem(q); Remove(n); }
  92.             }
  93.             //clear all ffcs
  94.             for ( int q = 1; q < 33; ++q )
  95.             {
  96.                 ffc f = Screen->LoadFFC(q);
  97.                 f->Data = 0; f->Script = 0;
  98.             }
  99.             //Do Link Death animation
  100.             if ( deathframe == 0 ) Game->PlaySound(SFX_LINKDEATH);
  101.             lweapon death = Screen->CreateLWeapon(LW_SPARKLE);
  102.            
  103.             death->UseSprite(SPR_DEATH);
  104.             death->X = menu_selection[DEATH_LX];
  105.             death->Y = menu_selection[DEATH_LY];
  106.  
  107.             while ( deathframe < END_DEATH_SPIN )
  108.             {
  109.                 ++deathframe;
  110.                 //spin Link around by drawing his tiles, then make the wink out.
  111.                 NoAction(); Waitdraw(); Waitframe();
  112.             }
  113.             Remove(death);
  114.             Game->PlaySound(SFX_WINKOUT);
  115.             lweapon death2 = Screen->CreateLWeapon(LW_SPARKLE);
  116.             death2->UseSprite(SPR_DEATH_WINKOUT);
  117.             death2->X = menu_selection[DEATH_LX];
  118.             death2->Y = menu_selection[DEATH_LY];
  119.             while ( deathframe < END_DEATH_SPIN+END_WINKOUT )
  120.             {
  121.                 ++deathframe;
  122.                 //wink-out
  123.                
  124.                
  125.                 NoAction();  Waitdraw(); Waitframe();
  126.             }
  127.             Remove(death2);
  128.             bool menu = true;
  129.             while(menu)
  130.             {
  131.                 Link->PressStart = false;
  132.                 //    GAME OVER SCREEN
  133.                 //Play game over midi.
  134.                 Game->PlayMIDI(MIDI_GAMEOVER);
  135.                 //int ss[]="Drawing black rect.";
  136.                 //TraceS(ss);
  137.                 //Draw black background with Rectangle()
  138.                    
  139.                 Screen->Rectangle(5,0,0,256,256,_COL_BLACK,100, 0,0,0,true,128);
  140.  
  141.  
  142.  
  143.                
  144.                
  145.                 //Draw text SAVE / DON'T SAVE
  146.                
  147.                 //int ss1[]="Drawing cursor and text.";
  148.                 //TraceS(ss1);
  149.                 if ( menu_selection[MENU_SEL_POS] )
  150.                 {
  151.                     //int ss1[]="Drawing cursor and text.";
  152.                     //TraceS(ss1);
  153.                     Screen->FastTile(6,SAVE_X-CURSOR_OFFSET, SAVE_Y, TILE_SAVECURSOR, TILE_SAVECURSOR_CSET,128);
  154.                     //draw strings, red for selected
  155.                     Screen->DrawString(6,SAVE_X,SAVE_Y,0,_COL_RED, -1,0,sv,128);
  156.                     Screen->DrawString(6,DONT_SAVE_X,DONT_SAVE_Y,0,_COL_WHITE, -1,0,dsv,128);
  157.                 }
  158.                 else
  159.                 {
  160.                     //Draw cursor
  161.                     Screen->FastTile(6,DONT_SAVE_X-CURSOR_OFFSET, DONT_SAVE_Y, TILE_SAVECURSOR, TILE_SAVECURSOR_CSET,128);
  162.                     //draw strings, red for selected
  163.                     Screen->DrawString(6,SAVE_X,SAVE_Y,0,_COL_WHITE, -1,0,sv,128);
  164.                     Screen->DrawString(6,DONT_SAVE_X,DONT_SAVE_Y,0,_COL_RED, -1,0,dsv,128);
  165.                 }
  166.                
  167.                 if ( Link->PressDown || Link->PressUp )
  168.                 {
  169.                     menu_selection[MENU_SEL_POS] = Cond(menu_selection[MENU_SEL_POS],0,1);
  170.                     Game->PlaySound(SFX_GAMEOVERSCREEN_CURSOR);
  171.                 }
  172.                 Link->InputStart = false;
  173.                 Link->PressStart = false;
  174.                 //Screw it. This is why I added a way to disable the active subscreen to 2.55
  175.                 //Global scripts DO NOT LIKE to block the active subscreen!
  176.                 //if ( Link->PressStart )
  177.                 if ( Link->PressA || Link->PressB )
  178.                 {
  179.                     //Link->PressStart = false;
  180.                     //Link->InputStart = false;
  181.                     Game->PlaySound(SFX_GAMEOVERSCREEN_SELECTION);
  182.                     if ( menu_selection[MENU_SEL_POS] ) quit = 1;
  183.                     else quit = 2; //no save
  184.                     menu = false;
  185.                 }
  186.                
  187.                 Waitdraw();
  188.                
  189.                 Waitframe();
  190.                
  191.                
  192.                
  193.                
  194.             }
  195.             Waitdraw(); Waitframe();
  196.         }
  197.         if ( quit == 1 )
  198.         {
  199.             ++Game->NumDeaths;
  200.             Game->Save();
  201.             Game->End();
  202.         }
  203.         else Game->End();
  204.      }
  205. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement