Advertisement
ZoriaRPG

Solid FFCs (In-Source Model)

Mar 29th, 2019
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.92 KB | None | 0 0
  1. //ffc solidity for canwalk
  2. //chexck this in the canwalk() function that Link uses
  3.  
  4. //FFCs are part of the current mapscreen, and all of their values are available.
  5. for ( int q = 0; q < 31; ++q )
  6. {
  7.     /*skip all ffs with the solid flag off, to save system overhead*/
  8.     if ( !(Maps.FFCFlags[q]&FFCSOLID) ) continue;
  9.    
  10.     switch(dir)//Link's dir
  11.     {
  12.         case DIR_UP:
  13.         {
  14.             /*find the bottom of the ffc effectheight
  15.             and is Y
  16.             */
  17.            
  18.             if ( stepdest_y > bottom_hitbox || stepdest_y < ffc_y )
  19.                 /* before its edge, or beyond its other edge*/
  20.                 break;
  21.            
  22.             /*then find out if Link's X is within the X+effectwidth
  23.             of the ffc*/
  24.            
  25.             /*if not, then we break*/
  26.            
  27.             /*if it is, then we can't walk, and return false*/
  28.            
  29.         }
  30.         case DIR_DOWN:
  31.         {
  32.             /*find the top of the ffc effectheight
  33.             and is Y
  34.             */
  35.             if ( stepdest_y < top_hitbox || stepdest_y > ffc_Y )
  36.                 /* before its edge, or beyond its other edge*/
  37.                 break;
  38.             /*then find out if Link's X is within the X+effectwidth
  39.             of the ffc*/
  40.            
  41.             /*if not, then we break*/
  42.            
  43.             /*if it is, then we can't walk, and return false*/
  44.         }
  45.         case DIR_LEFT:
  46.         {
  47.             /* find the right edge of the ffc effectwidth
  48.             and its X*/
  49.             if ( stepdest_x > right_hitbox || stepdest_x < ffc_x )              )
  50.                 /* before its edge, or beyond its other edge*/
  51.                 break;
  52.            
  53.             /*then find out if Link's Y is within the Y+effectheight
  54.             of the ffc*/
  55.            
  56.             /*if not, then we break*/
  57.            
  58.             /*if it is, then we can't walk, and return false*/
  59.            
  60.         }
  61.            
  62.         case DIR_RIGHT:
  63.         {
  64.             /* find the left edge of the ffc effectwidth
  65.             and its X*/
  66.             if ( stepdest_x < right_hitbox || stepdest_x > ffc_x )              )
  67.                 /* before its edge, or beyond its other edge*/
  68.                 break;
  69.            
  70.             /*then find out if Link's Y is within the Y+effectheight
  71.             of the ffc*/
  72.            
  73.             /*if not, then we break*/
  74.            
  75.             /*if it is, then we can't walk, and return false*/
  76.            
  77.         }
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement