Advertisement
ZoriaRPG

SMB.zh

Jan 12th, 2020
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.14 KB | None | 0 0
  1.  #include "time.zh"
  2.  
  3. namespace smb
  4. {
  5.     namespace version
  6.     {
  7.         const float ID = 0.0003;
  8.         const int YEAR = 2020;
  9.         const int MONTH = 1;
  10.         const int DAY = 12;
  11.         const int HOUR = 7;
  12.         const int MINUTE = 25;
  13.         const int TIMEZONE = tzGMT;
  14.     }
  15.    
  16.     const int PIPEDIR_DOWN = 0;
  17.     const int PIPEDIR_UP = 1;
  18.     const int PIPEDIR_EXIT_UP = 0;
  19.     const int PIPEDIR_EXIT_DOWN = 1;
  20.     const int PIPEBLOCK_LEFT = 0;
  21.     const int PIPEBLOCK_RIGHT = 0;
  22.     const int PLAYER_USING_PIPE  = 31; //Hero->Misc[]
  23.     const int PLAYER_USING_PIPE_DOWN  = 1; //Value
  24.     const int PLAYER_USING_PIPE_UP  = 2; //Value
  25.     const int PLAYER_USING_PIPE_CLEANUP  = 3; //Value
  26.     int isBig = 0;
  27.    
  28.     combodata script pipe
  29.     {
  30.         void run(int destscreen, int destdmap)
  31.         {
  32.             int sfx = this->Attribytes[0];
  33.             int lr = this->Attribytes[1];
  34.             int pipedir = this->Attribytes[2];
  35.             bool usingpipe = false;
  36.             int hero_y_adj = 0;
  37.             int clk = 0;
  38.             if ( Hero->Misc[PLAYER_USING_PIPE] ) Quit();
  39.             until(usingpipe)
  40.             {
  41.                 switch(pipedir)
  42.                 {
  43.                     case PIPEDIR_DOWN:
  44.                     {
  45.                         if(Hero->Y == this->PosY() - 16)
  46.                         {
  47.                             switch(lr) //left or right
  48.                             {
  49.                                 case PIPEBLOCK_LEFT:
  50.                                 {
  51.                                     if ( (Hero->X >= (this->PosX() + 2)) && Hero->X <= (this->PosX() + 16) )
  52.                                     {
  53.                                         if ( Hero->InputDown )
  54.                                         {
  55.                                             usingpipe = true;
  56.                                             Hero->Misc[PLAYER_USING_PIPE] = PLAYER_USING_PIPE_DOWN;
  57.                                         }
  58.                                     }
  59.                                     break;
  60.                                 }
  61.                                 case PIPEBLOCK_RIGHT:
  62.                                 {
  63.                                     if ( (Hero->X >= (this->PosX())) && Hero->X <= (this->PosX() + 14) )
  64.                                     {
  65.                                         if ( Hero->InputDown )
  66.                                         {
  67.                                             usingpipe = true;
  68.                                             Hero->Misc[PLAYER_USING_PIPE] = PLAYER_USING_PIPE_DOWN;
  69.                                         }
  70.                                     }
  71.                                     break;
  72.                                 }
  73.                                 default: break;
  74.                             }
  75.                         }
  76.                         break;
  77.                     }
  78.                     case PIPEDIR_UP:
  79.                     {
  80.                         if(Hero->Y == this->PosY() + 16)
  81.                         {
  82.                             switch(lr) //left or right
  83.                             {
  84.                                 case PIPEBLOCK_LEFT:
  85.                                 {
  86.                                     if ( (Hero->X >= (this->PosX() + 2)) && Hero->X <= (this->PosX() + 16) )
  87.                                     {
  88.                                         if ( Hero->InputUp )
  89.                                         {
  90.                                             usingpipe = true;
  91.                                             Hero->Misc[PLAYER_USING_PIPE] = PLAYER_USING_PIPE_UP;
  92.                                         }
  93.                                     }
  94.                                     break;
  95.                                 }
  96.                                 case PIPEBLOCK_RIGHT:
  97.                                 {
  98.                                     if ( (Hero->X >= (this->PosX())) && Hero->X <= (this->PosX() + 14) )
  99.                                     {
  100.                                         if ( Hero->InputUp )
  101.                                         {
  102.                                             usingpipe = true;
  103.                                             Hero->Misc[PLAYER_USING_PIPE] = PLAYER_USING_PIPE_UP;
  104.                                         }
  105.                                     }
  106.                                     break;
  107.                                 }
  108.                                 default: break;
  109.                             }
  110.                         }
  111.                         break;
  112.                     }
  113.                     default: break;
  114.                 }
  115.                 Waitframe();
  116.             }
  117.             Audio->PlaySound(sfx);
  118.             while(usingpipe)
  119.             {
  120.                 ++clk;
  121.                 unless(clk%4)
  122.                 {
  123.                     switch(lr)
  124.                     {
  125.                         case PIPEDIR_DOWN: ++Hero->Y; ++hero_y_adj; break;
  126.                         case PIPEDIR_UP: --Hero->Y; ++hero_y_adj; break;
  127.                         default: break;
  128.                     }
  129.                 }
  130.                 if ( hero_y_adj > ( isBig ? 33 : 17 ) )
  131.                 {
  132.                     break;
  133.                 }
  134.                 Waitframe();
  135.             }
  136.             Hero->Misc[PLAYER_USING_PIPE] = PLAYER_USING_PIPE_CLEANUP;
  137.             Hero->Warp({wtSCROLL,destdmap,destscreen,-1,0,warpEffectNONE,0,0});
  138.         }
  139.     }
  140.     void PipeCleanup()
  141.     {
  142.         if ( Hero->Misc[PLAYER_USING_PIPE] == PLAYER_USING_PIPE_CLEANUP )
  143.         {
  144.             Hero->Misc[PLAYER_USING_PIPE] = 0;
  145.         }
  146.     }
  147.     //Place warp return 0 over this combo
  148.     combodata script exitpipe
  149.     {
  150.         void run(int pipe_exit_dir, int sfx)
  151.         {
  152.             unless(Hero->Misc[PLAYER_USING_PIPE] == PLAYER_USING_PIPE_CLEANUP) Quit(); //Only if exiting a warp.
  153.             int clk; int hero_y_adj;
  154.             Hero->X = this->PosX()+8; //Centre over exit pipe.
  155.             int done = 0;
  156.             Audio->PlaySound(sfx);
  157.             until(done)
  158.             {
  159.                 ++clk;
  160.                 unless(clk%4)
  161.                 {
  162.                     switch(pipe_exit_dir)
  163.                     {
  164.                         case PIPEDIR_EXIT_UP: --Hero->Y; ++hero_y_adj; break;
  165.                         case PIPEDIR_EXIT_DOWN: ++Hero->Y; ++hero_y_adj; break;
  166.                         default: break;
  167.                     }
  168.                 }
  169.                 if ( hero_y_adj > ( isBig ? 33 : 17 ) )
  170.                 {
  171.                     done = true; break;
  172.                 }
  173.                 Waitframe();
  174.             }
  175.             Hero->Misc[PLAYER_USING_PIPE] = 0;
  176.         }
  177.     }
  178. } //end namespace smb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement