diff --git a/include/flags.h b/include/flags.h index 48e56749..27595e70 100644 --- a/include/flags.h +++ b/include/flags.h @@ -130,6 +130,6 @@ enum { /*0x62*/ MAZE_CLEAR, /* Cleared Castle maze */ /*0x63*/ TINY_ENTRANCE, /* Ezlo described entrances */ /*0x64*/ CASTLE_BGM, /* Castle intro BGM */ -} FLAG; +}; #endif \ No newline at end of file diff --git a/src/loadRoom.c b/src/loadRoom.c index 27946eb8..4cfb8788 100644 --- a/src/loadRoom.c +++ b/src/loadRoom.c @@ -1,8 +1,8 @@ #include "global.h" #include "room.h" +#include "flags.h" void LoadRoomEntityList(EntityData* dat); -s32 CheckGlobalFlag(u32 flag); extern EntityData* GetCurrentRoomProperty(u32 unk); extern void sub_0804B058(EntityData* dat); extern void sub_0804B1AC(EntityData* dat); @@ -21,7 +21,7 @@ void LoadRoom(void) { LoadRoomEntityList(GetCurrentRoomProperty(1)); LoadRoomEntityList(GetCurrentRoomProperty(0)); - if (CheckGlobalFlag(21)) + if (CheckGlobalFlag(TABIDACHI)) sub_0804B058(GetCurrentRoomProperty(2)); sub_0804B1AC(GetCurrentRoomProperty(3)); @@ -51,42 +51,38 @@ void sub_0804B058(EntityData* dat) { } } -void sub_0804B0B0(u32 arg0, u32 arg1) -{ - LoadRoomEntityList(GetRoomProperty(arg0, arg1, 1)); +void sub_0804B0B0(u32 arg0, u32 arg1) { + LoadRoomEntityList(GetRoomProperty(arg0, arg1, 1)); } -void SetCurrentRoomPropertyList(u32 arg0, u32 arg1) -{ +void SetCurrentRoomPropertyList(u32 arg0, u32 arg1) { u32** arr; - gUnk_02017654 = 0; - arr = &gUnk_080D50FC; - if (arr[arg0] != 0) { - gUnk_02017654 = arr[arg0][arg1]; - } + gUnk_02017654 = 0; + arr = &gUnk_080D50FC; + if (arr[arg0] != 0) { + gUnk_02017654 = arr[arg0][arg1]; + } } -void sub_0804B0E8(u32 arg0, u32 arg1) -{ - void (* func)(); - - func = (void (*)())GetRoomProperty(arg0, arg1, 4); - if (func != NULL) { - func(); - } +void sub_0804B0E8(u32 arg0, u32 arg1) { + void (*func)(); + + func = (void (*)())GetRoomProperty(arg0, arg1, 4); + if (func != NULL) { + func(); + } } // returns multiple types of data? -void* GetRoomProperty(u32 arg0, u32 arg1, u32 arg2) -{ +void* GetRoomProperty(u32 arg0, u32 arg1, u32 arg2) { u32 temp; - u32** arr; + u32** arr; temp = 0; arr = &gUnk_080D50FC; if (arr[arg0] != NULL) { temp = arr[arg0][arg1]; if (temp != 0) { - temp = *(u32 *)(arg2 * 4 + temp); + temp = *(u32*)(arg2 * 4 + temp); } } return (void*)temp; diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index 29a4ea6a..e83a40d1 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -155,7 +155,7 @@ void sub_080601D4(Entity* this) { u32 temp; u32 uVar2; - if (CheckGlobalFlag(4) == 0) { + if (CheckGlobalFlag(LV3_CLEAR) == 0) { uVar2 = 2; } else { temp = CheckKinstoneFused(0x17); @@ -202,9 +202,9 @@ void sub_08060270(Entity *this) //flippers if (GetInventoryValue(0x46) == 0) { index = 1; - if (CheckGlobalFlag(0x29) == 0) { + if (CheckGlobalFlag(MIZUKAKI_START) == 0) { index = 0; - SetGlobalFlag(0x29); + SetGlobalFlag(MIZUKAKI_START); } } else { @@ -266,19 +266,19 @@ u32 sub_08060354(void) s32 iVar2; iVar2 = gUnk_02002A40.unk2 - gUnk_02002A40.unk3; - if (CheckGlobalFlag(0x3b) == 0) { + if (CheckGlobalFlag(DRUG_1) == 0) { if (4 < iVar2) { return 0x8444; } } else { - if (CheckGlobalFlag(0x3c) == 0) { + if (CheckGlobalFlag(DRUG_2) == 0) { if (iVar2 > 9) { return 0x8444; } } else { - if (CheckGlobalFlag(0x3d) == 0) { + if (CheckGlobalFlag(DRUG_3) == 0) { if (iVar2 > 14) { return 0x8444; } diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c index b50ff552..46256dbe 100644 --- a/src/npc/mutoh.c +++ b/src/npc/mutoh.c @@ -67,7 +67,7 @@ void sub_080670B4(Entity *this) uVar2 = 0; if (GetInventoryValue(0x11) == 0) { - uVar1 = CheckGlobalFlag(0x15); + uVar1 = CheckGlobalFlag(TABIDACHI); uVar2 = (-uVar1 | uVar1) >> 0x1f; } TextboxNoOverlap(gUnk_08110C0C[uVar2],this); diff --git a/src/npc/simon.c b/src/npc/simon.c index 4e01af67..911fd745 100644 --- a/src/npc/simon.c +++ b/src/npc/simon.c @@ -49,7 +49,7 @@ void Simon_CreateChest(Entity *this) void sub_0806C280(void) { - SetGlobalFlag(0x50); + SetGlobalFlag(MAROYA_WAKEUP); DoExitTransition(&gUnk_0813AD74); gUnk_030010A0.unk = 6; } diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index c99cce93..a10aed22 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -283,7 +283,7 @@ void sub_0806200C(Entity* this) { u32 index; index = 0; - if ((CheckGlobalFlag(0x29) != 0) && (CheckLocalFlag(0x6b))) { + if ((CheckGlobalFlag(MIZUKAKI_START) != 0) && (CheckLocalFlag(0x6b))) { // hyrule bestiary if (GetInventoryValue(0x39) == 2) { diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c index d01f22d4..b95db3d4 100644 --- a/src/npc/windTribespeople.c +++ b/src/npc/windTribespeople.c @@ -52,7 +52,7 @@ void sub_0806C7D4(Entity* this) { sub_0806F118(this); } else { sub_0807DD94(this, 0); - if ((this->entityType.parameter == 3) && (!CheckGlobalFlag(0x58)) && (CheckLocalFlag(0x63)) && + if ((this->entityType.parameter == 3) && (!CheckGlobalFlag(WARP_EVENT_END)) && (CheckLocalFlag(0x63)) && (CheckRoomFlag(0))) { (this->entityType).parameter = 7; sub_0807DD80(this, &gUnk_08014A80); @@ -130,7 +130,7 @@ void sub_0806C944(Entity *this) int iVar1; int iVar2; - iVar1 = CheckGlobalFlag(0x58); + iVar1 = CheckGlobalFlag(WARP_EVENT_END); if (iVar1 == 0) { iVar2 = 0; } diff --git a/src/npc/zelda.c b/src/npc/zelda.c index 2ba8bf28..b70e3b9a 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -84,7 +84,7 @@ void sub_08066D94(Entity* ent) { u32 roomID; Entity* npc; - SetGlobalFlag(0x1C); + SetGlobalFlag(ZELDA_CHASE); npc = CreateNPC(0x2E, 0, 0); if (npc != NULL) { npc->animationState = gLinkEntity.animationState; diff --git a/src/object/cloud.c b/src/object/cloud.c index 027899cd..c55e0d57 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -72,7 +72,7 @@ void sub_0809F548(Entity* this) { void sub_0809F5B0(Entity* this) { if (--this->actionDelay == 0) { PlaySFX(115); - SetGlobalFlag(36); + SetGlobalFlag(KUMOTATSUMAKI); LoadRoomEntityList(&gUnk_080DD750); DeleteThisEntity(); } diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index 8ea54861..8bab5747 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -35,7 +35,7 @@ void sub_0809E83C(Entity* this) { void sub_0809E86C(Entity* this) { if (sub_0800419C(this, &gLinkEntity, 0x30, 0x30)) { - if (CheckGlobalFlag(0x14)) { + if (CheckGlobalFlag(EZERO_1ST)) { if (((gUnk_030010A0 & 3) == 0)) { sub_080A2B80(this); } diff --git a/src/room.c b/src/room.c index 4891ae9f..ff38c438 100644 --- a/src/room.c +++ b/src/room.c @@ -165,7 +165,7 @@ void sub_0804B4E4(void) { sub_080580B0(0x22); // white sword if (GetInventoryValue(0x2)) - SetGlobalFlag(0x56); + SetGlobalFlag(WHITE_SWORD_END); } void sub_0804B500() { @@ -361,7 +361,7 @@ void sub_0804B738(void) { LoadRoomEntityList(&gUnk_080D6714); } // flippers - if (!GetInventoryValue(0x46) && CheckGlobalFlag(0x29) && CheckLocalFlag(0x6a)) { + if (!GetInventoryValue(0x46) && CheckGlobalFlag(MIZUKAKI_START) && CheckLocalFlag(0x6a)) { LoadRoomEntityList(&gUnk_080D6734); } else { LoadRoomEntityList(&gUnk_080D66F4); @@ -481,9 +481,9 @@ void sub_0804B938(void) { return; } - if (CheckGlobalFlag(0x2b)) { - if (!CheckGlobalFlag(0x2f)) { - if (!CheckGlobalFlag(0x30)) { + if (CheckGlobalFlag(RENTED_HOUSE_DIN)) { + if (!CheckGlobalFlag(NEW_HOUSE_NAYRU)) { + if (!CheckGlobalFlag(NEW_HOUSE_FARORE)) { LoadRoomEntityList(&UpperInn_NoDin); } else { LoadRoomEntityList(&UpperInn_Nayru); @@ -491,18 +491,18 @@ void sub_0804B938(void) { } else { LoadRoomEntityList(&UpperInn_Farore); } - } else if (CheckGlobalFlag(0x2c)) { - if (CheckGlobalFlag(0x2e)) { + } else if (CheckGlobalFlag(RENTED_HOUSE_NAYRU)) { + if (CheckGlobalFlag(NEW_HOUSE_DIN)) { LoadRoomEntityList(&UpperInn_Farore); - } else if (!CheckGlobalFlag(0x30)) { + } else if (!CheckGlobalFlag(NEW_HOUSE_FARORE)) { LoadRoomEntityList(&UpperInn_NoNayru); } else { LoadRoomEntityList(&UpperInn_Din); } - } else if (CheckGlobalFlag(0x2d)) { - if (CheckGlobalFlag(0x2e)) { + } else if (CheckGlobalFlag(RENTED_HOUSE_FARORE)) { + if (CheckGlobalFlag(NEW_HOUSE_DIN)) { LoadRoomEntityList(&UpperInn_Nayru); - } else if (CheckGlobalFlag(0x2f)) { + } else if (CheckGlobalFlag(NEW_HOUSE_NAYRU)) { LoadRoomEntityList(&UpperInn_Din); } else { LoadRoomEntityList(&UpperInn_NoFarore);