Advertisement
ZoriaRPG

Simple Menu

Mar 4th, 2018
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.40 KB | None | 0 0
  1. const int SM_POINTER_TILE = 500;
  2. const int SM_OPTION_1_Y = 40;
  3. const int SM_OPTION_2_Y = 40;
  4. const int SM_OPTION_3_Y = 40;
  5. const int SM_OPTION_4_Y = 40;
  6. const int SM_POINTER_X = 35;
  7. const int SM_TEXT_X = 55;
  8. const int  SM_COST_1 = 10;
  9. const int  SM_COST_2 = 10;
  10. const int  SM_COST_3 = 5;
  11. const int  SM_COST_4 = 5;
  12. ffc script SimpleMenu
  13. {
  14.      void run()
  15.      {
  16.           bool done; int choice; int curpos = SM_OPTION_1_Y;
  17.           int curpositions[]={ SM_OPTION_1_Y, SM_OPTION_2_Y, SM_OPTION_3_Y, SM_OPTION_4_Y};
  18.           int costs[]={ SM_COST_1, SM_COST_2, SM_COST_3, SM_COST_4};
  19.           int refills[]={CR_LIFE, CR_MAGIC, CR_ARROWS, CR_BOMBS};
  20.           int ch1[]="Refill Life";
  21.           int ch2[]="Refill Magic";
  22.           int ch3[]="Refill Bombs";
  23.           int ch4[]="Refill Arrows";
  24.           while(!done)
  25.           {
  26.                Screen->Rectangle(6,0,0,256,176, 0x0F, true, OP_OPAQUE);
  27.                Screen->DrawString(6, SM_TEXT_X, SM_OPTION_1_Y,
  28.                     ch1, FONT_Z1, 1, -1, OP_OPAQUE);
  29.                Screen->DrawString(6, SM_TEXT_X, SM_OPTION_2_Y,
  30.                     ch2, FONT_Z1, 1, -1, OP_OPAQUE);
  31.                Screen->DrawString(6, SM_TEXT_X, SM_OPTION_3_Y,
  32.                     ch3, FONT_Z1, 1, -1, OP_OPAQUE);
  33.                Screen->DrawString(6, 1, -1, SM_TEXT_X, SM_OPTION_4_Y,
  34.                     ch4, FONT_Z1, OP_OPAQUE);
  35.                Screen->DrawTile(6, SM_POINTER_X, curpos,          
  36.                     SM_POINTER_TILE, 1,1, -1, -1, 0,0,0, OP_OPAQUE);
  37.                If ( Link->PressDown )
  38.                {
  39.                     if ( choice < 3 ) ++choice;
  40.                     else choice = 0;
  41.                     curpos = curpositions[choice];
  42.                }
  43.                if ( Link->PressUp )
  44.                {
  45.                     if ( choice > 0 ) --choice;
  46.                     else choice = 3;
  47.                     curpos = curpositions[choice];
  48.                }
  49.                if ( Link->PressA )
  50.                {
  51.                     if ( Game->Counter[CR_RUPEES] >= costs[choice] )
  52.                     {
  53.                          Game->DCounter[CR_RUPEES] -= costs[choice];
  54.                          Game->Counter[refills[choice]] = Game->MCounter[refills[choice]];
  55.                          done = true;
  56.                     }
  57.                }
  58.                if ( Link->PressA ) done = true; //cancel
  59.                Waitframe();
  60.           }
  61.      }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement