Advertisement
NightFox

Funcion CharacterCheckRight();

Aug 28th, 2012
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. // Funcion CharacterCheckRight();
  2. u16 CharacterCheckRight(s8 add) {
  3.  
  4.     // Variables
  5.     s32 x, y;
  6.     s32 fx, fy;
  7.     s32 start, end;
  8.     s16 tile = 0;
  9.     s16 result = T_AIR;
  10.  
  11.     // Variables de posicion
  12.     fx = (CHARACTER.pos_fx >> 8);
  13.     fy = (CHARACTER.pos_fy >> 8);
  14.  
  15.     // Calcula el rango de tiles a analizar
  16.     x = (fx + CHARACTER.right + add);
  17.     start = (fy - CHARACTER.up[0]);
  18.     end = (fy + CHARACTER.down);
  19.  
  20.     // Analiza los tiles del lateral (steps de 1/2 tile)
  21.     for (y = start; y <= end; y += 4) {
  22.         tile = NF_GetTile(MAINMAP_SLOT, x, y);
  23.         // Si el tile es pared...
  24.         if (tile == T_WALL) {
  25.             result = T_WALL;
  26.             y = end;
  27.         }
  28.     }
  29.  
  30.     // Devuelve el resultado
  31.     return result;
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement