2020-10-03 15:22:44 +00:00
|
|
|
#include "global.h"
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Flags_UnsetAllEnv(PlayState* play) {
|
2020-05-01 02:00:39 +00:00
|
|
|
u8 i;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
for (i = 0; i < ARRAY_COUNT(play->envFlags); i++) {
|
|
|
|
play->envFlags[i] = 0;
|
2020-05-01 02:00:39 +00:00
|
|
|
}
|
|
|
|
}
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Flags_SetEnv(PlayState* play, s16 flag) {
|
2020-05-01 02:00:39 +00:00
|
|
|
s16 index = flag / 16;
|
|
|
|
s16 bit = flag % 16;
|
|
|
|
s16 mask = 1 << bit;
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
play->envFlags[index] |= mask;
|
2020-05-01 02:00:39 +00:00
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
void Flags_UnsetEnv(PlayState* play, s16 flag) {
|
2020-05-01 02:00:39 +00:00
|
|
|
s16 index = flag / 16;
|
|
|
|
s16 bit = flag % 16;
|
|
|
|
s16 mask = (1 << bit) ^ 0xFFFF;
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
play->envFlags[index] &= mask;
|
2020-05-01 02:00:39 +00:00
|
|
|
}
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
s32 Flags_GetEnv(PlayState* play, s16 flag) {
|
2020-05-01 02:00:39 +00:00
|
|
|
s16 index = flag / 16;
|
|
|
|
s16 bit = flag % 16;
|
|
|
|
s16 mask = 1 << bit;
|
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
return play->envFlags[index] & mask;
|
2020-05-01 02:00:39 +00:00
|
|
|
}
|