Advertisement
ZoriaRPG

Link Death Gameover Menu Script v2

Dec 24th, 2018
411
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 18.85 KB | None | 0 0
  1. import "std.zh"
  2.  
  3. dmapdata script dmapscript
  4. {
  5.     void run()
  6.     {
  7.         int f;
  8.         while(1)
  9.         {
  10.             ++f;
  11.             if (!(f%180))
  12.             {
  13.                 TraceS("Dmap Script Before Waitdraw()"); TraceNL();
  14.                
  15.             }
  16.             Waitdraw();
  17.             if (!(f%180))
  18.             {
  19.                 TraceS("Dmap Script After Waitdraw()"); TraceNL();
  20.                
  21.             }
  22.             Waitframe();
  23.         }
  24.  
  25.     }
  26. }
  27.  
  28. screendata script sd1
  29. {
  30. void run(){}
  31. }
  32.  
  33. link script link_init1
  34. {
  35.     void run()
  36.     {
  37.         TraceS("Running Link Init Script"); TraceNL();
  38.         Link->X = 100;
  39.         Link->Y = 60;
  40.        
  41.     }
  42. }
  43.  
  44. link script link_active
  45. {
  46.     void run()
  47.     {
  48.         //lweapon l = Screen->CreateLWeapon(LW_SCRIPT1);
  49.         while(1)
  50.         {
  51.             //TraceS("Link Active Script Running"); TraceNL();
  52.             if ( Input->ReadKey[KEY_T] ) { Game->ShowContinueScreen(); }
  53.             if ( Input->ReadKey[KEY_U] ) { Game->SkipF6 = (!Game->SkipF6); }
  54.             Waitframe();
  55.         }
  56.     }
  57. }
  58.  
  59. link script onWin
  60. {
  61.     void run()
  62.     {
  63.         int q;
  64.         while(1)
  65.         {
  66.             ++q;
  67.             Trace(q);
  68.             if ( q > 100 ) Quit();
  69.             Waitframe();
  70.         }
  71.     }
  72. }
  73. ///////////////////////////////
  74. /// Custom Game Over Screen ///
  75. /// v1.2 for ZC 2.55        ///
  76. /// 24th October, 2018      ///
  77. /// By: ZoriaRPG            ///
  78. //////////////////////////////////////
  79. /// Requested by: Korben on PureZC ///
  80. //////////////////////////////////////
  81.  
  82. typedef const int DEFINE;
  83. typedef const int config;
  84.  
  85. script typedef ffc namespace;
  86.  
  87. namespace script gameover
  88. {
  89.     // Sounds and MIDIs
  90. config SFX_WINKOUT          = 38; //Sound to play during wink-out animation.
  91. config SFX_LINKDEATH            = 28; //Sound to play when Link dies.
  92. config SFX_GAMEOVERSCREEN_CURSOR    = 6;  //Sound to play when the player moves the game over cursor.
  93. config SFX_GAMEOVERSCREEN_SELECTION     = 44; //Sound to play when the user selectsl a game over menu option.
  94. config MIDI_GAMEOVER            = -4; //MIDI to play on Game Over screen.
  95.     //Defaults: -3 is the internal Game Over, -2 is Level 9, -1 is Overworld
  96.  
  97. // Sprites (Weapons/Misc)
  98. config SPR_DEATH        = 88; //Sprite of Link Spinning
  99. config SPR_DEATH_WINKOUT    = 89; //Sprite of wink-out
  100. // Sprite Timing
  101. config END_DEATH_SPIN       = 40; //Frames to display death spin animation.
  102. config END_WINKOUT      = 10; //Frames to display wink-out animation.
  103.  
  104. // Other Graphics and Colours
  105. config TILE_SAVECURSOR      = 20;
  106. config TILE_SAVECURSOR_CSET     = 1;    //CSet for minitile cursor.
  107. config BLACK            = 0x0F; //Black in the current palette
  108. config RED          = 0x93; //Red in the current palette
  109. config WHITE            = 0x01; //White in the current palette
  110.  
  111. // Menu Object Positions and Settings
  112. config DONT_SAVE_X      = 102; //X position of the RETRY string.
  113. config SAVE_X           = 102; //X position of the SAVE string.
  114. config DONT_SAVE_Y      = 68;  //Y position of the RETRY string.
  115. config SAVE_Y           = 54;  //X position of the SAVE string.
  116. config CURSOR_OFFSET        = 26;  //X offset of the cursor from the text.
  117.  
  118. //Global Variables and Arrays
  119.  
  120. //Indices for values[]
  121. DEFINE MENU_SEL_STATE       = 0; //The current selected menu option.
  122. DEFINE MENU_SEL_POS_X       = 1; //Stores where to draw menu selector.
  123. DEFINE MENU_SEL_POS_Y       = 2; //Stores where to draw menu selector.
  124. DEFINE DEATH_LX         = 3; //Cache of Link's last X position before death.
  125. DEFINE DEATH_LY         = 4; //Cache of Link's last Y position before death.
  126. DEFINE DEATHFRAME       = 5; //Timer for death animations.
  127. DEFINE QUIT             = 6; //The game 'QUIT' type, SAVE or RETRY
  128.  
  129. //gameover.QUIT Types
  130. DEFINE quitSAVE = 1;
  131. DEFINE quitRETRY = 2;
  132.  
  133.     int values[8] = {1,SAVE_Y,DONT_SAVE_Y, 0,0};
  134.     void run(){}
  135.     bool check()
  136.     {
  137.         if ( Link->HP < 1 )
  138.         {
  139.             Link->HP = 1;
  140.             Link->Invisible = true;
  141.             Link->CollDetection = false;
  142.             values[DEATH_LX] = Link->X;
  143.             values[DEATH_LY] = Link->Y;
  144.             return true;
  145.         }
  146.         return false;
  147.     }
  148.     void clean_up()
  149.     {
  150.         int q;
  151.         if ( Screen->NumNPCs() )
  152.         {
  153.             for ( q = Screen->NumNPCs(); q > 0; --q )
  154.             {
  155.                 npc n = Screen->LoadNPC(q); Remove(n);
  156.             }
  157.         }
  158.         if ( Screen->NumLWeapons() )
  159.         {
  160.             for ( q = Screen->NumLWeapons(); q > 0; --q )
  161.             { lweapon n = Screen->LoadLWeapon(q); Remove(n); }
  162.         }
  163.         if ( Screen->NumEWeapons() )
  164.         {
  165.             for ( q = Screen->NumEWeapons(); q > 0; --q )
  166.             { eweapon n = Screen->LoadEWeapon(q); Remove(n); }
  167.         }
  168.         if ( Screen->NumItems() )
  169.         {
  170.             for ( q = Screen->NumItems(); q > 0; --q )
  171.             { item n = Screen->LoadItem(q); Remove(n); }
  172.         }
  173.         //clear all ffcs
  174.         for ( q = 1; q < 33; ++q )
  175.         {
  176.             ffc f = Screen->LoadFFC(q);
  177.             f->Data = 0; f->Script = 0;
  178.         }
  179.     }
  180.     void draw()
  181.     {
  182.         //Draw black background with Rectangle()
  183.        
  184.  
  185.         if ( values[MENU_SEL_STATE] )
  186.         {
  187.             Screen->Rectangle(5,0,0,256,256,BLACK,100, 0,0,0,true,128);
  188.             //int ss1[]="Drawing cursor and text.";
  189.             //TraceS(ss1);
  190.             Screen->FastTile(6,SAVE_X-CURSOR_OFFSET, SAVE_Y, TILE_SAVECURSOR, TILE_SAVECURSOR_CSET,128);
  191.             //draw strings, red for selected
  192.             Screen->DrawString(6,SAVE_X,SAVE_Y,0,RED, -1,0,"SAVE",128);
  193.             Screen->DrawString(6,DONT_SAVE_X,DONT_SAVE_Y,0,WHITE, -1,0,"RETRY",128);
  194.         }
  195.         else
  196.         {
  197.             Screen->Rectangle(5,0,0,256,256,BLACK,100, 0,0,0,true,128);
  198.             //Draw cursor
  199.             Screen->FastTile(6,DONT_SAVE_X-CURSOR_OFFSET, DONT_SAVE_Y, TILE_SAVECURSOR, TILE_SAVECURSOR_CSET,128);
  200.             //draw strings, red for selected
  201.             Screen->DrawString(6,SAVE_X,SAVE_Y,0,WHITE, -1,0,"SAVE",128);
  202.             Screen->DrawString(6,DONT_SAVE_X,DONT_SAVE_Y,0,RED, -1,0,"RETRY",128);
  203.         }
  204.     }
  205.     bool choice()
  206.     {
  207.         if ( Link->PressDown || Link->PressUp )
  208.         {
  209.             values[MENU_SEL_STATE] = Cond(values[MENU_SEL_STATE],0,1);
  210.             Game->PlaySound(SFX_GAMEOVERSCREEN_CURSOR);
  211.             return true;
  212.         }
  213.        
  214.         if ( Link->PressStart )
  215.         {
  216.             Game->PlaySound(SFX_GAMEOVERSCREEN_SELECTION);
  217.             if ( values[MENU_SEL_STATE] ) values[QUIT] = quitSAVE;
  218.             else values[QUIT] = quitRETRY; //no save
  219.             return false;
  220.         }
  221.         return true;
  222.     }
  223.     void animation()
  224.     {
  225.     if ( values[DEATHFRAME] == 0 ) Game->PlaySound(SFX_LINKDEATH);
  226.         lweapon death = Screen->CreateLWeapon(LW_SPARKLE);
  227.        
  228.         death->UseSprite(SPR_DEATH);
  229.         death->X = values[DEATH_LX];
  230.         death->Y = values[DEATH_LY];
  231.  
  232.         while ( values[DEATHFRAME] < END_DEATH_SPIN )
  233.         {
  234.             ++values[DEATHFRAME];
  235.             //spin Link around by drawing his tiles, then make the wink out.
  236.             NoAction(); Waitdraw(); Waitframe();
  237.         }
  238.         Remove(death);
  239.         Game->PlaySound(SFX_WINKOUT);
  240.         lweapon death2 = Screen->CreateLWeapon(LW_SPARKLE);
  241.         death2->UseSprite(SPR_DEATH_WINKOUT);
  242.         death2->X = values[DEATH_LX];
  243.         death2->Y = values[DEATH_LY];
  244.         while ( values[DEATHFRAME] < END_DEATH_SPIN+END_WINKOUT )
  245.         {
  246.             ++values[DEATHFRAME];
  247.             //wink-out
  248.             NoAction();  Waitdraw(); Waitframe();
  249.         }
  250.         Remove(death2);
  251.     }
  252. }
  253.  
  254. link script win
  255. {
  256.    
  257.     void run()
  258.     {
  259.         while(1)
  260.         {
  261.         TraceS("Running onWin script.()");TraceNL();
  262.        
  263.             Screen->FastTile(6,60,60,11979,0,128);
  264.             Waitframe();
  265.         }
  266.         Quit();
  267.     }
  268. }
  269. //Global Active Script
  270. link script noF6
  271. {
  272.     void run()
  273.     {
  274.         TraceS("Running onDeath script.()");TraceNL();
  275.         //while(!gameover.values[gameover.QUIT])
  276.         while(1)
  277.         {
  278.             //gameover.values[gameover.DEATH_LX] = Link->X;
  279.             //gameover.values[gameover.DEATH_LY] = Link->Y;
  280.             //Set game music to a silent MIDI.
  281.  
  282.             //Link->HP = Link->MaxHP;
  283.             //Link->Invisible = true;
  284.             //Link->CollDetection = false;
  285.             //Clean up screen objects
  286.             //gameover.clean_up();
  287.             //Do Link Death animation
  288.             //TraceS("Doing gameover.animation()");TraceNL();
  289.             //gameover.animation();
  290.            
  291.             bool menu = true;
  292.             Game->PlayMIDI(gameover.MIDI_GAMEOVER);//Play game over midi.
  293.             Game->DisableActiveSubscreen = true;   
  294.             TraceS("Loading gameover menu()");TraceNL();
  295.             Screen->FastTile(6,60,60,11979,0,128);
  296.             //while(menu) //menu loop
  297.             //{
  298.                 //    GAME OVER SCREEN
  299.             //  Screen->FastTile(6,60,60,11979,0,128);
  300.                 //gameover.draw();
  301.                 //menu = gameover.choice();
  302.                 //Waitdraw();
  303.             //  Waitframe();
  304.             //}
  305.             //Waitdraw();
  306.             Waitframe();
  307.         }
  308.         if ( gameover.values[gameover.QUIT] == gameover.quitSAVE )
  309.         {
  310.             ++Game->NumDeaths;
  311.             Game->Save();
  312.             Game->End();
  313.         }
  314.         else Game->End(); //Retry
  315.     }
  316. }
  317.  
  318. global script OnExit
  319. {
  320.     void run()
  321.     {
  322.         Link->Invisible = false;
  323.     }
  324. }
  325. eweapon script E2
  326. {
  327.     void run(){}
  328. }
  329.  
  330. eweapon script E
  331. {
  332.     void run()
  333.     {
  334.         //TraceS("eweapon script E: this: "); Trace(this); TraceNL();
  335.         int f;
  336.         Trace(this->ID);
  337.         while(this->isValid())
  338.         {
  339. TraceS("EWeapon Script Running"); TraceNL();
  340.             ++f;
  341.             if ( !(f%10) )
  342.             {
  343.                 this->Dir = Rand(0,3);
  344.                 TraceS("EWeapon Script Running"); TraceNL();
  345.             }
  346.             if ( !(this->isValid()) ) Quit();
  347.             Waitframe();
  348.        
  349.         }
  350.     }
  351. }
  352.  
  353. lweapon script L
  354. {
  355.     void run()
  356.     {
  357.         TraceS("Script L: this: "); Trace(this); TraceNL();
  358.         int f = 0;
  359.         while(this->isValid())
  360.         {
  361.              
  362.             ++f;
  363.             if ( !(f%10) )
  364.             {
  365.                 this->Dir = Rand(0,3);
  366.                 TraceS("LWeapon Script Running"); TraceNL();
  367.             }
  368.             if ( !(this->isValid()) ) Quit();
  369.             Waitframe();
  370.        
  371.         }
  372.     }
  373. }
  374.  
  375. lweapon script sword
  376. {
  377.     void run()
  378.     {
  379.         TraceS("Script sword: this: "); Trace(this); TraceNL();
  380.         Trace(this->ID);
  381.         while(this->isValid())
  382.         {
  383.             //this->X += 10;
  384.             TraceS("LWeapon Script Running"); TraceNL();
  385.             Waitframe();
  386.         }
  387.     }
  388. }
  389.  
  390. lweapon script beam
  391. {
  392.     void run()
  393.     {
  394.         //TraceS("Script beam: this: "); Trace(this); TraceNL();
  395.         int f;
  396.         Trace(this->ID);
  397.         while(this->isValid())
  398.         {
  399.             ++f;
  400.             if ( !(f%10) )
  401.             {
  402.                 this->Dir = Rand(0,3);
  403.                 //TraceS("LWeapon Script Running"); TraceNL();
  404.             }
  405.             if ( !(this->isValid()) ) Quit();
  406.             Waitframe();
  407.        
  408.         }
  409.     }
  410. }
  411.  
  412. lweapon script bait
  413. {
  414.     void run()
  415.     {
  416.         TraceS("Script bait: this: "); Trace(this); TraceNL();
  417.         int f = 0; int dir = Rand(0,3); int step = 2;
  418.         while(this->isValid())
  419.         {
  420.             ++f; if (!(f%6)) { dir = Rand(0,3); step = Rand(2,6); }
  421.             switch(dir)
  422.             {
  423.                 case DIR_UP: this->Y -= step; break;
  424.                 case DIR_DOWN: this->Y += step; break;
  425.                 case DIR_LEFT: this->X -= step; break;
  426.                 case DIR_RIGHT: this->X += step; break;
  427.                 default: break;
  428.             }
  429.             if ( !(this->isValid()) ) Quit();
  430.             Waitframe();
  431.         }
  432.     }
  433. }      
  434.  
  435. global script a
  436. {
  437.     void run()
  438.     {
  439.         while(1)
  440.         {
  441.             for ( int q = Screen->NumLWeapons(); q > 0; --q )
  442.             {
  443.                 lweapon l = Screen->LoadLWeapon(q);
  444.                 if ( l->ID == LW_SCRIPT1 )
  445.                 {
  446.                     //TraceS("Found LW_SCRIPT1"); TraceNL();
  447.                 }
  448.             }
  449.             Waitframe();
  450.         }
  451.     }
  452. }
  453.  
  454.  
  455.  
  456.  
  457.  
  458. link script menu
  459. {
  460.     config SFX_WINKOUT          = 38; //Sound to play during wink-out animation.
  461. config SFX_LINKDEATH            = 28; //Sound to play when Link dies.
  462. config SFX_GAMEOVERSCREEN_CURSOR    = 6;  //Sound to play when the player moves the game over cursor.
  463. config SFX_GAMEOVERSCREEN_SELECTION     = 44; //Sound to play when the user selectsl a game over menu option.
  464. config MIDI_GAMEOVER            = -4; //MIDI to play on Game Over screen.
  465.     //Defaults: -3 is the internal Game Over, -2 is Level 9, -1 is Overworld
  466.  
  467. // Sprites (Weapons/Misc)
  468. config SPR_DEATH        = 88; //Sprite of Link Spinning
  469. config SPR_DEATH_WINKOUT    = 89; //Sprite of wink-out
  470. // Sprite Timing
  471. config END_DEATH_SPIN       = 40; //Frames to display death spin animation.
  472. config END_WINKOUT      = 10; //Frames to display wink-out animation.
  473.  
  474. // Other Graphics and Colours
  475. config TILE_SAVECURSOR      = 20;
  476. config TILE_SAVECURSOR_CSET     = 1;    //CSet for minitile cursor.
  477. config BLACK            = 0x0F; //Black in the current palette
  478. config RED          = 0x93; //Red in the current palette
  479. config WHITE            = 0x01; //White in the current palette
  480.  
  481. // Menu Object Positions and Settings
  482. config DONT_SAVE_X      = 102-12; //X position of the RETRY string.
  483. config SAVE_X           = 102-12; //X position of the SAVE string.
  484. config DONT_CONTINUE_Y      = 82;  //Y position of the RETRY string.
  485. config DONT_SAVE_Y      = 68;  //Y position of the RETRY string.
  486. config SAVE_Y           = 54;  //X position of the SAVE string.
  487. config CURSOR_OFFSET        = 12;  //X offset of the cursor from the text.
  488.  
  489. //Global Variables and Arrays
  490.  
  491. //Indices for values[]
  492. DEFINE MENU_SEL_STATE       = 0; //The current selected menu option.
  493. DEFINE MENU_SEL_POS_X       = 1; //Stores where to draw menu selector.
  494. DEFINE MENU_SEL_POS_Y       = 2; //Stores where to draw menu selector.
  495. //DEFINE DEATH_LX       = 3; //Cache of Link's last X position before death.
  496. int DEATH_LX        = 0; //Cache of Link's last X position before death.
  497. //DEFINE DEATH_LY       = 4; //Cache of Link's last Y position before death.
  498. int DEATH_LY        = 0; //Cache of Link's last Y position before death.
  499. //DEFINE DEATHFRAME         = 5; //Timer for death animations.
  500. int DEATHFRAME      = 0; //Timer for death animations.
  501. //DEFINE QUIT           = 6; //The game 'QUIT' type, SAVE or RETRY
  502. int QUIT;
  503.  
  504. //gameover.QUIT Types
  505. DEFINE quitSAVE = 1;
  506. DEFINE quitRETRY = 2;
  507. DEFINE quitCONTINUE = 3;
  508. int MENU_STATE = quitCONTINUE;
  509.  
  510.     int values[8] = {1,SAVE_Y,DONT_SAVE_Y, 0,0};
  511.     bool check()
  512.     {
  513.         if ( Link->HP < 1 )
  514.         {
  515.             Link->HP = 1;
  516.             Link->Invisible = true;
  517.             Link->CollDetection = false;
  518.             values[DEATH_LX] = Link->X;
  519.             values[DEATH_LY] = Link->Y;
  520.             return true;
  521.         }
  522.         return false;
  523.     }
  524.     void clean_up()
  525.     {
  526.         int q;
  527.         if ( Screen->NumNPCs() )
  528.         {
  529.             for ( q = Screen->NumNPCs(); q > 0; --q )
  530.             {
  531.                 npc n = Screen->LoadNPC(q); Remove(n);
  532.             }
  533.         }
  534.         if ( Screen->NumLWeapons() )
  535.         {
  536.             for ( q = Screen->NumLWeapons(); q > 0; --q )
  537.             { lweapon n = Screen->LoadLWeapon(q); Remove(n); }
  538.         }
  539.         if ( Screen->NumEWeapons() )
  540.         {
  541.             for ( q = Screen->NumEWeapons(); q > 0; --q )
  542.             { eweapon n = Screen->LoadEWeapon(q); Remove(n); }
  543.         }
  544.         if ( Screen->NumItems() )
  545.         {
  546.             for ( q = Screen->NumItems(); q > 0; --q )
  547.             { item n = Screen->LoadItem(q); Remove(n); }
  548.         }
  549.         //clear all ffcs
  550.         for ( q = 1; q < 33; ++q )
  551.         {
  552.             ffc f = Screen->LoadFFC(q);
  553.             f->Data = 0; f->Script = 0;
  554.         }
  555.     }
  556.     int getgood_x = 256;
  557.     void draw()
  558.     {
  559.         --getgood_x;
  560.         if ( getgood_x < -128) getgood_x = 256;
  561.         //Draw black background with Rectangle()
  562.         //Screen->Rectangle(5,0,0,256,256,BLACK,100, 0,0,0,true,128);
  563.        
  564.         if ( MENU_STATE == quitSAVE )
  565.         {
  566.             //int ss1[]="Drawing cursor and text.";
  567.             //TraceS(ss1);
  568.             Screen->Rectangle(7,0,-56,256,256,BLACK,100, 0,0,0,true,128);
  569.             Screen->DrawString(7,getgood_x,0,FONT_SATURN,0x04, -1,0,"Git Gud!",128);
  570.             Screen->FastTile(7,SAVE_X-CURSOR_OFFSET, SAVE_Y-4, TILE_SAVECURSOR, TILE_SAVECURSOR_CSET,128);
  571.             //draw strings, red for selected
  572.             Screen->DrawString(7,SAVE_X,SAVE_Y,FONT_SATURN,RED, -1,0,"SAVE",128);
  573.             Screen->DrawString(7,DONT_SAVE_X,DONT_SAVE_Y,FONT_SATURN,WHITE, -1,0,"RETRY",128);
  574.             Screen->DrawString(7,DONT_SAVE_X,DONT_CONTINUE_Y,FONT_SATURN,WHITE, -1,0,"CONTINUE",128);
  575.         }
  576.         else if ( MENU_STATE == quitRETRY )//retry
  577.         {
  578.             //Draw cursor
  579.             Screen->Rectangle(7,0,-56,256,256,BLACK,100, 0,0,0,true,128);
  580.             Screen->DrawString(7,getgood_x,0,FONT_SATURN,0x04, -1,0,"Git Gud!",128);
  581.             Screen->FastTile(7,DONT_SAVE_X-CURSOR_OFFSET, DONT_SAVE_Y-4, TILE_SAVECURSOR, TILE_SAVECURSOR_CSET,128);
  582.             //draw strings, red for selected
  583.             Screen->DrawString(7,SAVE_X,SAVE_Y,FONT_SATURN,WHITE, -1,0,"SAVE",128);
  584.             Screen->DrawString(7,DONT_SAVE_X,DONT_SAVE_Y,FONT_SATURN,RED, -1,0,"RETRY",128);
  585.             Screen->DrawString(7,DONT_SAVE_X,DONT_CONTINUE_Y,FONT_SATURN,WHITE, -1,0,"CONTINUE",128);
  586.         }
  587.         else if ( MENU_STATE == quitCONTINUE )
  588.         {
  589.             //Draw cursor
  590.             Screen->Rectangle(7,0,-56,256,256,BLACK,100, 0,0,0,true,128);
  591.             Screen->DrawString(7,getgood_x,0,FONT_SATURN,0x04, -1,0,"Git Gud!",128);
  592.             Screen->FastTile(7,DONT_SAVE_X-CURSOR_OFFSET, DONT_CONTINUE_Y-4, TILE_SAVECURSOR, TILE_SAVECURSOR_CSET,128);
  593.             //draw strings, red for selected
  594.             Screen->DrawString(7,SAVE_X,SAVE_Y,FONT_SATURN,WHITE, -1,0,"SAVE",128);
  595.             Screen->DrawString(7,DONT_SAVE_X,DONT_SAVE_Y,FONT_SATURN,WHITE, -1,0,"RETRY",128);
  596.             Screen->DrawString(7,DONT_SAVE_X,DONT_CONTINUE_Y,FONT_SATURN,RED, -1,0,"CONTINUE",128);
  597.         }
  598.     }
  599.     bool choice()
  600.     {
  601.         //if ( Input->ReadKey[KEY_P] )
  602.         if ( Link->PressDown )
  603.         {
  604.             switch(MENU_STATE)
  605.             {
  606.                 case quitSAVE: MENU_STATE = quitRETRY; LogPrint("Menu PressDOWN Selection is: %s \n", "quitRETRY"); break;
  607.                 case quitRETRY: MENU_STATE = quitCONTINUE; LogPrint("Menu PressDown Selection is: %s \n", "quitCONTINUE"); break;
  608.                 case quitCONTINUE: MENU_STATE = quitSAVE; LogPrint("Menu PressDown Selection is: %s \n", "quitSAVE");break;
  609.                 default: break;
  610.             }
  611.             //MENU_STATE = Cond(MENU_STATE,0,1);
  612.             Game->PlaySound(SFX_GAMEOVERSCREEN_CURSOR);
  613.             return true;
  614.         }
  615.         if ( Link->PressUp )
  616.         {
  617.             switch(MENU_STATE)
  618.             {
  619.                 case quitSAVE: MENU_STATE = quitCONTINUE; LogPrint("Menu PressUp Selection is: %s \n", "quitCONTINUE"); break;
  620.                 case quitRETRY: MENU_STATE = quitSAVE; LogPrint("Menu PressUp Selection is: %s \n", "quitSAVE"); break;
  621.                 case quitCONTINUE: MENU_STATE = quitRETRY; LogPrint("Menu PressUp Selection is: %s \n", "quitRETRY"); break;
  622.                 default: break;
  623.             }
  624.             //MENU_STATE = Cond(MENU_STATE,0,1);
  625.             Game->PlaySound(SFX_GAMEOVERSCREEN_CURSOR);
  626.             return true;
  627.         }
  628.        
  629.         if ( Link->PressStart )
  630.         {
  631.             Game->PlaySound(SFX_GAMEOVERSCREEN_SELECTION);
  632.             QUIT = MENU_STATE;
  633.             //switch(MENU_STATE)
  634.             //{
  635.             //  case 0:  QUIT = quitRETRY; //no save
  636.             //  case 1:  QUIT = quitSAVE; //no save
  637.             //  case 2:  QUIT = quitCONTINUE; //no save
  638.             //  default: break;
  639.             //}
  640.             return false;
  641.         }
  642.         return true;
  643.     }
  644.     void animation()
  645.     {
  646.         Link->Invisible = true;
  647.     int DEATHFRAME;
  648.     if ( DEATHFRAME == 0 ) Game->PlaySound(SFX_LINKDEATH);
  649.         lweapon death = Screen->CreateLWeapon(LW_SPARKLE);
  650.         Graphics->Monochrome(TINT_GREY);
  651.         death->UseSprite(SPR_DEATH);
  652.         death->X = Link->X;//DEATH_LX;
  653.         death->Y = Link->Y; //DEATH_LY;
  654.  
  655.         while ( DEATHFRAME < END_DEATH_SPIN )
  656.         {
  657.             ++DEATHFRAME;
  658.             //++Link->X;
  659.             //spin Link around by drawing his tiles, then make the wink out.
  660.             NoAction(); Waitframe();
  661.         }
  662.         Remove(death);
  663.         Game->PlaySound(SFX_WINKOUT);
  664.         lweapon death2 = Screen->CreateLWeapon(LW_SPARKLE);
  665.         death2->UseSprite(SPR_DEATH_WINKOUT);
  666.         death2->X = Link->X;//DEATH_LX;
  667.         death2->Y = Link->Y; //DEATH_LY;
  668.         while ( DEATHFRAME < END_DEATH_SPIN+END_WINKOUT )
  669.         {
  670.             ++DEATHFRAME;
  671.             //wink-out
  672.             NoAction(); Waitframe();
  673.         }
  674.         Remove(death2);
  675.     }
  676.     void run()
  677.     {
  678.         Trace(12345);
  679. TraceS("Running menu script");
  680.         bool menu = true;
  681.         //while(1)
  682.         //{
  683.             clean_up();
  684.             animation();
  685.             Graphics->ClearTint();
  686.             while(menu) //menu loop
  687.             {
  688.                 //    GAME OVER SCREEN
  689.                 draw();
  690.                 menu = choice();
  691.                 //itdraw();
  692.                 Waitframe();
  693.             }
  694.             //Waitdraw();
  695.             Waitframe();
  696.         //}
  697.         switch(QUIT)
  698.         {
  699.             case quitSAVE:
  700.             {
  701.                 if ( Link->HP < 1 ) ++Game->NumDeaths;
  702.                 LogPrint("Death Menu returned a QUIT state of: %s \n", "quitSAVE");
  703.                 Game->Save();
  704.                 Game->End();
  705.                 break;
  706.             }
  707.             case quitRETRY:
  708.             {
  709.                 LogPrint("Death Menu returned a QUIT state of: %s", "quitRETRY");
  710.                 Game->End();
  711.                 break;
  712.             }
  713.             case quitCONTINUE:
  714.             {
  715.                 if ( Link->HP < 1 ) ++Game->NumDeaths;
  716.                 LogPrint("Death Menu returned a QUIT state of: %s", "quitCONTINUE");
  717.                 Game->Continue();
  718.                 break;
  719.             }
  720.             default: break;
  721.         }
  722.         //if ( QUIT == quitSAVE )
  723.         //{
  724.         //  ++Game->NumDeaths;
  725.         //  Game->Save();
  726.         //  Game->End();
  727.         //}
  728.         //else Game->End(); //Retry
  729.     }
  730. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement