mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-18 14:22:17 -05:00
34 lines
658 B
C
34 lines
658 B
C
#include "global.h"
|
|
|
|
void Flags_UnsetAllEnv(PlayState* play) {
|
|
u8 i;
|
|
|
|
for (i = 0; i < 20; i++) {
|
|
play->envFlags[i] = 0;
|
|
}
|
|
}
|
|
|
|
void Flags_SetEnv(PlayState* play, s16 flag) {
|
|
s16 index = flag / 16;
|
|
s16 bit = flag % 16;
|
|
s16 mask = 1 << bit;
|
|
|
|
play->envFlags[index] |= mask;
|
|
}
|
|
|
|
void Flags_UnsetEnv(PlayState* play, s16 flag) {
|
|
s16 index = flag / 16;
|
|
s16 bit = flag % 16;
|
|
s16 mask = (1 << bit) ^ 0xFFFF;
|
|
|
|
play->envFlags[index] &= mask;
|
|
}
|
|
|
|
s32 Flags_GetEnv(PlayState* play, s16 flag) {
|
|
s16 index = flag / 16;
|
|
s16 bit = flag % 16;
|
|
s16 mask = 1 << bit;
|
|
|
|
return (play->envFlags[index] & mask) != 0;
|
|
}
|