macros.h
changeset 22 fe6f35cc987b
parent 0 29654efe3188
child 193 0a7025304867
equal deleted inserted replaced
21:67cde01e8359 22:fe6f35cc987b
   128 
   128 
   129 #define PLAYER_SPRITE_COLOR(owner) ((_player_colors[owner] << 16) + 0x3070000)
   129 #define PLAYER_SPRITE_COLOR(owner) ((_player_colors[owner] << 16) + 0x3070000)
   130 #define SPRITE_PALETTE(x) ((x) + 0x8000)
   130 #define SPRITE_PALETTE(x) ((x) + 0x8000)
   131 
   131 
   132 extern const byte _ffb_64[128];
   132 extern const byte _ffb_64[128];
       
   133 /* Returns the position of the first bit that is not zero, counted from the
       
   134  * left. Ie, 10110100 returns 2, 00000001 returns 0, etc. When x == 0 returns
       
   135  * 0.
       
   136  */
   133 #define FIND_FIRST_BIT(x) _ffb_64[(x)]
   137 #define FIND_FIRST_BIT(x) _ffb_64[(x)]
       
   138 /* Returns x with the first bit that is not zero, counted from the left, set
       
   139  * to zero. So, 10110100 returns 10110000, 00000001 returns 00000000, etc.
       
   140  */
   134 #define KILL_FIRST_BIT(x) _ffb_64[(x)+64]
   141 #define KILL_FIRST_BIT(x) _ffb_64[(x)+64]
   135 
   142 
   136 static INLINE int FindFirstBit2x64(int value)
   143 static INLINE int FindFirstBit2x64(int value)
   137 {
   144 {
   138 	int i = 0;
   145 	int i = 0;
   210 static INLINE void WRITE_LE_UINT16(const void *b, uint16 x) {
   217 static INLINE void WRITE_LE_UINT16(const void *b, uint16 x) {
   211 	((byte*)b)[0] = (byte)x;
   218 	((byte*)b)[0] = (byte)x;
   212 	((byte*)b)[1] = (byte)(x >> 8);
   219 	((byte*)b)[1] = (byte)(x >> 8);
   213 }
   220 }
   214 
   221 
       
   222 #define MAX_DETOUR 6
       
   223 
   215 #endif /* MACROS_H */
   224 #endif /* MACROS_H */