Change Flags.cpp to use macros
Pixel probably did this tbh Signed-off-by: Gabriel Ravier <gabravier@gmail.com>
This commit is contained in:
parent
71015da19b
commit
7a3bea3c0a
1 changed files with 10 additions and 6 deletions
|
@ -7,6 +7,10 @@
|
||||||
unsigned char gFlagNPC[1000];
|
unsigned char gFlagNPC[1000];
|
||||||
unsigned char gSkipFlag[8];
|
unsigned char gSkipFlag[8];
|
||||||
|
|
||||||
|
#define SET_BIT(x, i) ((x)[(i) / 8] |= 1 << (i) % 8;)
|
||||||
|
#define UNSET_BIT(x, i) ((x)[(i) / 8] &= ~(1 << (i) % 8);)
|
||||||
|
#define GET_BIT(x, i) ((x)[(i) / 8] & (1 << (i) % 8))
|
||||||
|
|
||||||
//Flag inits
|
//Flag inits
|
||||||
void InitFlags()
|
void InitFlags()
|
||||||
{
|
{
|
||||||
|
@ -21,17 +25,17 @@ void InitSkipFlags()
|
||||||
//NPC flags
|
//NPC flags
|
||||||
void SetNPCFlag(long a)
|
void SetNPCFlag(long a)
|
||||||
{
|
{
|
||||||
gFlagNPC[a / 8] |= 1 << a % 8;
|
SET_BIT(gFlagNPC, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutNPCFlag(long a)
|
void CutNPCFlag(long a)
|
||||||
{
|
{
|
||||||
gFlagNPC[a / 8] &= ~(1 << a % 8);
|
UNSET_BIT(gFlagNPC, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL GetNPCFlag(long a)
|
BOOL GetNPCFlag(long a)
|
||||||
{
|
{
|
||||||
if (gFlagNPC[a / 8] & (1 << a % 8))
|
if (GET_BIT(gFlagNPC, a))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -40,17 +44,17 @@ BOOL GetNPCFlag(long a)
|
||||||
//Skip flags
|
//Skip flags
|
||||||
void SetSkipFlag(long a)
|
void SetSkipFlag(long a)
|
||||||
{
|
{
|
||||||
gSkipFlag[a / 8] |= 1 << a % 8;
|
SET_BIT(gSkipFlag, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutSkipFlag(long a)
|
void CutSkipFlag(long a)
|
||||||
{
|
{
|
||||||
gSkipFlag[a / 8] &= ~(1 << a % 8);
|
UNSET_BIT(gSkipFlag, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL GetSkipFlag(long a)
|
BOOL GetSkipFlag(long a)
|
||||||
{
|
{
|
||||||
if (gSkipFlag[a / 8] & (1 << a % 8))
|
if (GET_BIT(gSkipFlag, a))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue