mirror of
https://github.com/zeldaret/mm.git
synced 2026-06-25 01:12:00 -04:00
EnvFlags OK (#404)
* Matched * Remove magic number * Rename system to EnvFlags
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F12D0/func_800F12D0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F12D0/func_800F1304.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F12D0/func_800F1374.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F12D0/func_800F13E8.s")
|
||||
@@ -0,0 +1,33 @@
|
||||
#include "global.h"
|
||||
|
||||
void EnvFlags_UnsetAll(GlobalContext* globalCtx) {
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(globalCtx->envFlags); i++) {
|
||||
globalCtx->envFlags[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void EnvFlags_Set(GlobalContext* globalCtx, s16 flag) {
|
||||
s16 index = flag / 16;
|
||||
s16 bit = flag % 16;
|
||||
s16 mask = 1 << bit;
|
||||
|
||||
globalCtx->envFlags[index] |= mask;
|
||||
}
|
||||
|
||||
void EnvFlags_Unset(GlobalContext* globalCtx, s16 flag) {
|
||||
s16 index = flag / 16;
|
||||
s16 bit = flag % 16;
|
||||
s16 mask = (1 << bit) ^ 0xFFFF;
|
||||
|
||||
globalCtx->envFlags[index] &= mask;
|
||||
}
|
||||
|
||||
s32 EnvFlags_Get(GlobalContext* globalCtx, s16 flag) {
|
||||
s16 index = flag / 16;
|
||||
s16 bit = flag % 16;
|
||||
s16 mask = 1 << bit;
|
||||
|
||||
return globalCtx->envFlags[index] & mask;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) {
|
||||
|
||||
if (grottoType == DOORANA_TYPE_UNK) {
|
||||
// in OOT decomp its marked as open with storms, but does not seem to open with storms in MM
|
||||
if ((this->actor.xyzDistToPlayerSq < 40000.0f) && (func_800F13E8(globalCtx, 5))) {
|
||||
if ((this->actor.xyzDistToPlayerSq < 40000.0f) && (EnvFlags_Get(globalCtx, 5))) {
|
||||
grottoIsOpen = 1;
|
||||
this->actor.flags &= ~0x10; // always update OFF
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user