Merge pull request #31 from notyouraveragehooman/master

global flag decomps
This commit is contained in:
notyouraveragehooman 2020-07-18 16:04:50 -07:00 committed by GitHub
commit 70134a56ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 241 additions and 199 deletions

View File

@ -1,96 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_0804B938
sub_0804B938: @ 0x0804B938
push {lr}
ldr r0, _0804B968 @ =gUnk_02002A40
ldrb r0, [r0, #8]
cmp r0, #3
bls _0804B9F2
movs r0, #0x2b
bl CheckGlobalFlag
cmp r0, #0
beq _0804B970
movs r0, #0x2f
bl CheckGlobalFlag
cmp r0, #0
bne _0804B984
movs r0, #0x30
bl CheckGlobalFlag
cmp r0, #0
bne _0804B9BC
ldr r0, _0804B96C @ =gUnk_080D6C64
bl LoadRoomEntityList
b _0804B9F2
.align 2, 0
_0804B968: .4byte gUnk_02002A40
_0804B96C: .4byte gUnk_080D6C64
_0804B970:
movs r0, #0x2c
bl CheckGlobalFlag
cmp r0, #0
beq _0804B9A8
movs r0, #0x2e
bl CheckGlobalFlag
cmp r0, #0
beq _0804B990
_0804B984:
ldr r0, _0804B98C @ =gUnk_080D6D04
bl LoadRoomEntityList
b _0804B9F2
.align 2, 0
_0804B98C: .4byte gUnk_080D6D04
_0804B990:
movs r0, #0x30
bl CheckGlobalFlag
cmp r0, #0
bne _0804B9D2
ldr r0, _0804B9A4 @ =gUnk_080D6C94
bl LoadRoomEntityList
b _0804B9F2
.align 2, 0
_0804B9A4: .4byte gUnk_080D6C94
_0804B9A8:
movs r0, #0x2d
bl CheckGlobalFlag
cmp r0, #0
beq _0804B9EC
movs r0, #0x2e
bl CheckGlobalFlag
cmp r0, #0
beq _0804B9C8
_0804B9BC:
ldr r0, _0804B9C4 @ =gUnk_080D6CE4
bl LoadRoomEntityList
b _0804B9F2
.align 2, 0
_0804B9C4: .4byte gUnk_080D6CE4
_0804B9C8:
movs r0, #0x2f
bl CheckGlobalFlag
cmp r0, #0
beq _0804B9E0
_0804B9D2:
ldr r0, _0804B9DC @ =gUnk_080D6CC4
bl LoadRoomEntityList
b _0804B9F2
.align 2, 0
_0804B9DC: .4byte gUnk_080D6CC4
_0804B9E0:
ldr r0, _0804B9E8 @ =gUnk_080D6C34
bl LoadRoomEntityList
b _0804B9F2
.align 2, 0
_0804B9E8: .4byte gUnk_080D6C34
_0804B9EC:
ldr r0, _0804B9F4 @ =gUnk_080D6BF4
bl LoadRoomEntityList
_0804B9F2:
pop {pc}
.align 2, 0
_0804B9F4: .4byte gUnk_080D6BF4

View File

@ -499,25 +499,25 @@ gUnk_080D6BC4:: @ 080D6BC4
gUnk_080D6BE4:: @ 080D6BE4 gUnk_080D6BE4:: @ 080D6BE4
.incbin "baserom.gba", 0x0D6BE4, 0x0000010 .incbin "baserom.gba", 0x0D6BE4, 0x0000010
gUnk_080D6BF4:: @ 080D6BF4 UpperInn_Oracles:: @ 080D6BF4
.incbin "baserom.gba", 0x0D6BF4, 0x0000040 .incbin "baserom.gba", 0x0D6BF4, 0x0000040
gUnk_080D6C34:: @ 080D6C34 UpperInn_NoFarore:: @ 080D6C34
.incbin "baserom.gba", 0x0D6C34, 0x0000030 .incbin "baserom.gba", 0x0D6C34, 0x0000030
gUnk_080D6C64:: @ 080D6C64 UpperInn_NoDin:: @ 080D6C64
.incbin "baserom.gba", 0x0D6C64, 0x0000030 .incbin "baserom.gba", 0x0D6C64, 0x0000030
gUnk_080D6C94:: @ 080D6C94 UpperInn_NoNayru:: @ 080D6C94
.incbin "baserom.gba", 0x0D6C94, 0x0000030 .incbin "baserom.gba", 0x0D6C94, 0x0000030
gUnk_080D6CC4:: @ 080D6CC4 UpperInn_Din:: @ 080D6CC4
.incbin "baserom.gba", 0x0D6CC4, 0x0000020 .incbin "baserom.gba", 0x0D6CC4, 0x0000020
gUnk_080D6CE4:: @ 080D6CE4 UpperInn_Nayru:: @ 080D6CE4
.incbin "baserom.gba", 0x0D6CE4, 0x0000020 .incbin "baserom.gba", 0x0D6CE4, 0x0000020
gUnk_080D6D04:: @ 080D6D04 UpperInn_Farore:: @ 080D6D04
.incbin "baserom.gba", 0x0D6D04, 0x0000020 .incbin "baserom.gba", 0x0D6D04, 0x0000020
gUnk_080D6D24:: @ 080D6D24 gUnk_080D6D24:: @ 080D6D24

View File

@ -28,4 +28,108 @@ void SetRoomFlag(u32);
extern u32 gGlobalFlags; extern u32 gGlobalFlags;
extern u32 gRoomFlags; extern u32 gRoomFlags;
enum {
NONE,
/*0x01*/ LV0_CLEAR, /* Simulation Lv. 0 */
/*0x02*/ LV1_CLEAR, /* Simulation Lv. 1 */
/*0x03*/ LV2_CLEAR, /* Simulation Lv. 2 */
/*0x04*/ LV3_CLEAR, /* Simulation Lv. 3 */
/*0x05*/ LV4_CLEAR, /* Simulation Lv. 4 */
/*0x06*/ LV5_CLEAR, /* Simulation Lv. 5 */
/*0x07*/ LV6_CLEAR, /* Simulation Lv. 6 */
/*0x08*/ LV7_CLEAR, /* Simulation Lv. 7 */
/*0x09*/ LV8_CLEAR, /* Simulation Lv. 8 */
/*0x0a*/ MACHI_SET_1, /* Defeated Big Green Chuchu */
/*0x0b*/ MACHI_SET_2, /* Defeated Gleerok */
/*0x0c*/ MACHI_SET_3, /* */
/*0x0d*/ MACHI_SET_4, /* Defeated Big Octorok */
/*0x0e*/ MACHI_SET_5, /* Defeated Gyorg Pair */
/*0x0f*/ MACHI_SET_6, /* */
/*0x10*/ MACHI_SET_7, /* */
/*0x11*/ MACHI_SET_8, /* */
/*0x12*/ MACHI_MACHIHOKORI, /* Sucked dust from carpet */
/*0x13*/ START, /* Met Zelda */
/*0x14*/ EZERO_1ST, /* Met Ezlo */
/*0x15*/ TABIDACHI, /* Talked to Daltus and Smith */
/*0x16*/ LV1TARU, /* */
/*0x17*/ LV1TARU_OPEN, /* Sucked barrel web */
/*0x18*/ TATEKAKE_HOUSE, /* Red house complete */
/*0x19*/ TATEKAKE_TOCHU, /* Red house frame */
/*0x1a*/ WATERBEAN_OUT, /* Holding bean */
/*0x1b*/ WATERBEAN_PUT, /* Threw bean in hole */
/*0x1c*/ ZELDA_CHASE, /* Enter town festival */
/*0x1d*/ INLOCK, /* Gave key to Talon */
/*0x1e*/ DASHBOOTS, /* Read Castor Wilds sign */
/*0x1f*/ LEFT_DOOR_OPEN, /* Spoke to Dr. Left */
/*0x20*/ HAKA_KEY_LOST, /* Graveyard key stolen */
/*0x21*/ HAKA_KEY_FOUND, /* Graveyard key obtained back */
/*0x22*/ ENTRANCE_OK, /* */
/*0x23*/ TATSUMAKI, /* */
/*0x24*/ KUMOTATSUMAKI, /* Vortex spawned */
/*0x25*/ KAITENGIRI, /* */
/*0x26*/ DAIKAITENGIRI, /* */
/*0x27*/ GATOTSU, /* */
/*0x28*/ KABUTOWARI, /* */
/*0x29*/ MIZUKAKI_START, /* Spoke to Lake Hylia Minish */
/*0x2a*/ MIZUKAKI_HARIFALL, /* Library book falling */
/*0x2b*/ RENTED_HOUSE_DIN, /* Din moves to blue house */
/*0x2c*/ RENTED_HOUSE_NAYRU, /* Nayru moves to blue house */
/*0x2d*/ RENTED_HOUSE_FARORE, /* Farore moves to blue house */
/*0x2e*/ NEW_HOUSE_DIN, /* Din moves to red house */
/*0x2f*/ NEW_HOUSE_NAYRU, /* Nayru moves to red house */
/*0x30*/ NEW_HOUSE_FARORE, /* Farore moves to red house */
/*0x31*/ OUGONTEKI_A, /* Golden Octorok defeated */
/*0x32*/ OUGONTEKI_B, /* Golden Tektite defeated */
/*0x33*/ OUGONTEKI_C, /* Golden Rope defeated */
/*0x34*/ OUGONTEKI_D, /* Golden Rope defeated */
/*0x35*/ OUGONTEKI_E, /* Golden Rope defeated */
/*0x36*/ OUGONTEKI_F, /* Golden Tektite defeated */
/*0x37*/ OUGONTEKI_G, /* Golden Tektite defeated */
/*0x38*/ OUGONTEKI_H, /* Golden Octorok defeated */
/*0x39*/ OUGONTEKI_I, /* Golden Octorok defeated */
/*0x3a*/ KAKERA_COMPLETE, /* All fusions complete */
/*0x3b*/ DRUG_1, /* Yellow pico bloomed */
/*0x3c*/ DRUG_2, /* Blue pico bloomed */
/*0x3d*/ DRUG_3, /* Orange pico bloomed */
/*0x3e*/ GORON_KAKERA_LV2, /* Goron merchant restock 1 */
/*0x3f*/ GORON_KAKERA_LV3, /* Goron merchant restock 2 */
/*0x40*/ GORON_KAKERA_LV4, /* Goron merchant restock 3 */
/*0x41*/ GORON_KAKERA_LV5, /* Goron merchant restock 4 */
/*0x42*/ GORON_KAKERA_L, /* Red kinstone sold out */
/*0x43*/ GORON_KAKERA_M, /* Blue kinstone sold out */
/*0x44*/ GORON_KAKERA_R, /* Green kinstone sold out */
/*0x45*/ CHIKATSURO_SHUTTER, /* Castle basement door open */
/*0x46*/ ENTRANCE_USED, /* */
/*0x47*/ GOMAN_RENTED_HOUSE, /* Spoke to Gorman blue house */
/*0x48*/ GOMAN_NEW_HOUSE, /* Spoke to Gorman red house */
/*0x49*/ OUTDOOR, /* Exited Link's house */
/*0x4a*/ POWERGLOVE_HINT, /* Spoke to Dr. Left Minish */
/*0x4b*/ ANJU_LV_BIT0, /* Cucco game 1 bit */
/*0x4c*/ ANJU_LV_BIT1, /* Cucco game 2 bit */
/*0x4d*/ ANJU_LV_BIT2, /* Cucco game 4 bit */
/*0x4e*/ ANJU_LV_BIT3, /* Cucco game 8 bit */
/*0x4f*/ ANJU_HEART, /* Cucco heart piece */
/*0x50*/ MAROYA_WAKEUP, /* */
/*0x51*/ ENDING, /* Vaati's wrath defeated */
/*0x52*/ WARP_1ST, /* Wind ocarina unlocked */
/*0x53*/ WARP_MONUMENT, /* First windcrest discovered */
/*0x54*/ DRUG_COUNT, /* Pico bloom minish items */
/*0x55*/ GAMECLEAR, /* Watched end cutscene */
/*0x56*/ WHITE_SWORD_END, /* Exit mines with white sword */
/*0x57*/ SOUGEN_06_HASHIGO, /* Boomerang cave ladder */
/*0x58*/ WARP_EVENT_END, /* Wind tribe tower state */
/*0x59*/ FIGURE_ALLCOMP, /* Obtained Carlov Medal */
/*0x5a*/ AKINDO_BOTTLE_SELL, /* Bought bottle from scrub */
/*0x5b*/ BIN_DOGFOOD, /* */
/*0x5c*/ TINGLE_TALK1ST, /* Spoke to Tingle */
/*0x5d*/ SEIIKI_BGM, /* Elemental sanctuary BGM */
/*0x5e*/ ENTRANCE_0, /* Trunk entrance cutscene */
/*0x5f*/ ENTRANCE_1, /* Rock entrance cutscene */
/*0x60*/ ENTRANCE_2, /* Pot entrance cutscene */
/*0x61*/ MIZUKAKI_NECHAN, /* Spoke to librarian */
/*0x62*/ MAZE_CLEAR, /* Cleared Castle maze */
/*0x63*/ TINY_ENTRANCE, /* Ezlo described entrances */
/*0x64*/ CASTLE_BGM, /* Castle intro BGM */
};
#endif #endif

View File

@ -442,7 +442,6 @@ SECTIONS {
src/loadRoom.o(.text); src/loadRoom.o(.text);
asm/code_0804B058.o(.text); asm/code_0804B058.o(.text);
src/room.o(.text); src/room.o(.text);
asm/upperInn.o(.text);
asm/code_0804B9F8.o(.text); asm/code_0804B9F8.o(.text);
src/sub_08050008.o(.text); src/sub_08050008.o(.text);
src/sub_08050024.o(.text); src/sub_08050024.o(.text);

View File

@ -1,8 +1,8 @@
#include "global.h" #include "global.h"
#include "room.h" #include "room.h"
#include "flags.h"
void LoadRoomEntityList(EntityData* dat); void LoadRoomEntityList(EntityData* dat);
s32 CheckGlobalFlag(u32 flag);
extern EntityData* GetCurrentRoomProperty(u32 unk); extern EntityData* GetCurrentRoomProperty(u32 unk);
extern void sub_0804B058(EntityData* dat); extern void sub_0804B058(EntityData* dat);
extern void sub_0804B1AC(EntityData* dat); extern void sub_0804B1AC(EntityData* dat);
@ -21,7 +21,7 @@ void LoadRoom(void) {
LoadRoomEntityList(GetCurrentRoomProperty(1)); LoadRoomEntityList(GetCurrentRoomProperty(1));
LoadRoomEntityList(GetCurrentRoomProperty(0)); LoadRoomEntityList(GetCurrentRoomProperty(0));
if (CheckGlobalFlag(21)) if (CheckGlobalFlag(TABIDACHI))
sub_0804B058(GetCurrentRoomProperty(2)); sub_0804B058(GetCurrentRoomProperty(2));
sub_0804B1AC(GetCurrentRoomProperty(3)); sub_0804B1AC(GetCurrentRoomProperty(3));
@ -51,13 +51,11 @@ void sub_0804B058(EntityData* dat) {
} }
} }
void sub_0804B0B0(u32 arg0, u32 arg1) void sub_0804B0B0(u32 arg0, u32 arg1) {
{
LoadRoomEntityList(GetRoomProperty(arg0, arg1, 1)); LoadRoomEntityList(GetRoomProperty(arg0, arg1, 1));
} }
void SetCurrentRoomPropertyList(u32 arg0, u32 arg1) void SetCurrentRoomPropertyList(u32 arg0, u32 arg1) {
{
u32** arr; u32** arr;
gUnk_02017654 = 0; gUnk_02017654 = 0;
arr = &gUnk_080D50FC; arr = &gUnk_080D50FC;
@ -66,9 +64,8 @@ void SetCurrentRoomPropertyList(u32 arg0, u32 arg1)
} }
} }
void sub_0804B0E8(u32 arg0, u32 arg1) void sub_0804B0E8(u32 arg0, u32 arg1) {
{ void (*func)();
void (* func)();
func = (void (*)())GetRoomProperty(arg0, arg1, 4); func = (void (*)())GetRoomProperty(arg0, arg1, 4);
if (func != NULL) { if (func != NULL) {
@ -77,8 +74,7 @@ void sub_0804B0E8(u32 arg0, u32 arg1)
} }
// returns multiple types of data? // returns multiple types of data?
void* GetRoomProperty(u32 arg0, u32 arg1, u32 arg2) void* GetRoomProperty(u32 arg0, u32 arg1, u32 arg2) {
{
u32 temp; u32 temp;
u32** arr; u32** arr;
temp = 0; temp = 0;
@ -86,7 +82,7 @@ void* GetRoomProperty(u32 arg0, u32 arg1, u32 arg2)
if (arr[arg0] != NULL) { if (arr[arg0] != NULL) {
temp = arr[arg0][arg1]; temp = arr[arg0][arg1];
if (temp != 0) { if (temp != 0) {
temp = *(u32 *)(arg2 * 4 + temp); temp = *(u32*)(arg2 * 4 + temp);
} }
} }
return (void*)temp; return (void*)temp;

View File

@ -155,7 +155,7 @@ void sub_080601D4(Entity* this) {
u32 temp; u32 temp;
u32 uVar2; u32 uVar2;
if (CheckGlobalFlag(4) == 0) { if (CheckGlobalFlag(LV3_CLEAR) == 0) {
uVar2 = 2; uVar2 = 2;
} else { } else {
temp = CheckKinstoneFused(0x17); temp = CheckKinstoneFused(0x17);
@ -202,9 +202,9 @@ void sub_08060270(Entity *this)
//flippers //flippers
if (GetInventoryValue(0x46) == 0) { if (GetInventoryValue(0x46) == 0) {
index = 1; index = 1;
if (CheckGlobalFlag(0x29) == 0) { if (CheckGlobalFlag(MIZUKAKI_START) == 0) {
index = 0; index = 0;
SetGlobalFlag(0x29); SetGlobalFlag(MIZUKAKI_START);
} }
} }
else { else {
@ -266,19 +266,19 @@ u32 sub_08060354(void)
s32 iVar2; s32 iVar2;
iVar2 = gUnk_02002A40.unk2 - gUnk_02002A40.unk3; iVar2 = gUnk_02002A40.unk2 - gUnk_02002A40.unk3;
if (CheckGlobalFlag(0x3b) == 0) { if (CheckGlobalFlag(DRUG_1) == 0) {
if (4 < iVar2) { if (4 < iVar2) {
return 0x8444; return 0x8444;
} }
} }
else { else {
if (CheckGlobalFlag(0x3c) == 0) { if (CheckGlobalFlag(DRUG_2) == 0) {
if (iVar2 > 9) { if (iVar2 > 9) {
return 0x8444; return 0x8444;
} }
} }
else { else {
if (CheckGlobalFlag(0x3d) == 0) { if (CheckGlobalFlag(DRUG_3) == 0) {
if (iVar2 > 14) { if (iVar2 > 14) {
return 0x8444; return 0x8444;
} }

View File

@ -67,7 +67,7 @@ void sub_080670B4(Entity *this)
uVar2 = 0; uVar2 = 0;
if (GetInventoryValue(0x11) == 0) { if (GetInventoryValue(0x11) == 0) {
uVar1 = CheckGlobalFlag(0x15); uVar1 = CheckGlobalFlag(TABIDACHI);
uVar2 = (-uVar1 | uVar1) >> 0x1f; uVar2 = (-uVar1 | uVar1) >> 0x1f;
} }
TextboxNoOverlap(gUnk_08110C0C[uVar2],this); TextboxNoOverlap(gUnk_08110C0C[uVar2],this);

View File

@ -49,7 +49,7 @@ void Simon_CreateChest(Entity *this)
void sub_0806C280(void) void sub_0806C280(void)
{ {
SetGlobalFlag(0x50); SetGlobalFlag(MAROYA_WAKEUP);
DoExitTransition(&gUnk_0813AD74); DoExitTransition(&gUnk_0813AD74);
gUnk_030010A0.unk = 6; gUnk_030010A0.unk = 6;
} }

View File

@ -283,7 +283,7 @@ void sub_0806200C(Entity* this) {
u32 index; u32 index;
index = 0; index = 0;
if ((CheckGlobalFlag(0x29) != 0) && (CheckLocalFlag(0x6b))) { if ((CheckGlobalFlag(MIZUKAKI_START) != 0) && (CheckLocalFlag(0x6b))) {
// hyrule bestiary // hyrule bestiary
if (GetInventoryValue(0x39) == 2) { if (GetInventoryValue(0x39) == 2) {

View File

@ -52,7 +52,7 @@ void sub_0806C7D4(Entity* this) {
sub_0806F118(this); sub_0806F118(this);
} else { } else {
sub_0807DD94(this, 0); 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))) { (CheckRoomFlag(0))) {
(this->entityType).parameter = 7; (this->entityType).parameter = 7;
sub_0807DD80(this, &gUnk_08014A80); sub_0807DD80(this, &gUnk_08014A80);
@ -130,7 +130,7 @@ void sub_0806C944(Entity *this)
int iVar1; int iVar1;
int iVar2; int iVar2;
iVar1 = CheckGlobalFlag(0x58); iVar1 = CheckGlobalFlag(WARP_EVENT_END);
if (iVar1 == 0) { if (iVar1 == 0) {
iVar2 = 0; iVar2 = 0;
} }

View File

@ -84,7 +84,7 @@ void sub_08066D94(Entity* ent) {
u32 roomID; u32 roomID;
Entity* npc; Entity* npc;
SetGlobalFlag(0x1C); SetGlobalFlag(ZELDA_CHASE);
npc = CreateNPC(0x2E, 0, 0); npc = CreateNPC(0x2E, 0, 0);
if (npc != NULL) { if (npc != NULL) {
npc->animationState = gLinkEntity.animationState; npc->animationState = gLinkEntity.animationState;

View File

@ -72,7 +72,7 @@ void sub_0809F548(Entity* this) {
void sub_0809F5B0(Entity* this) { void sub_0809F5B0(Entity* this) {
if (--this->actionDelay == 0) { if (--this->actionDelay == 0) {
PlaySFX(115); PlaySFX(115);
SetGlobalFlag(36); SetGlobalFlag(KUMOTATSUMAKI);
LoadRoomEntityList(&gUnk_080DD750); LoadRoomEntityList(&gUnk_080DD750);
DeleteThisEntity(); DeleteThisEntity();
} }

View File

@ -35,7 +35,7 @@ void sub_0809E83C(Entity* this) {
void sub_0809E86C(Entity* this) { void sub_0809E86C(Entity* this) {
if (sub_0800419C(this, &gLinkEntity, 0x30, 0x30)) { if (sub_0800419C(this, &gLinkEntity, 0x30, 0x30)) {
if (CheckGlobalFlag(0x14)) { if (CheckGlobalFlag(EZERO_1ST)) {
if (((gUnk_030010A0 & 3) == 0)) { if (((gUnk_030010A0 & 3) == 0)) {
sub_080A2B80(this); sub_080A2B80(this);
} }

View File

@ -165,7 +165,7 @@ void sub_0804B4E4(void) {
sub_080580B0(0x22); sub_080580B0(0x22);
// white sword // white sword
if (GetInventoryValue(0x2)) if (GetInventoryValue(0x2))
SetGlobalFlag(0x56); SetGlobalFlag(WHITE_SWORD_END);
} }
void sub_0804B500() { void sub_0804B500() {
@ -361,7 +361,7 @@ void sub_0804B738(void) {
LoadRoomEntityList(&gUnk_080D6714); LoadRoomEntityList(&gUnk_080D6714);
} }
// flippers // flippers
if (!GetInventoryValue(0x46) && CheckGlobalFlag(0x29) && CheckLocalFlag(0x6a)) { if (!GetInventoryValue(0x46) && CheckGlobalFlag(MIZUKAKI_START) && CheckLocalFlag(0x6a)) {
LoadRoomEntityList(&gUnk_080D6734); LoadRoomEntityList(&gUnk_080D6734);
} else { } else {
LoadRoomEntityList(&gUnk_080D66F4); LoadRoomEntityList(&gUnk_080D66F4);
@ -398,8 +398,7 @@ u32 sub_0804B7A8(void) {
extern void* gUnk_08010A5C[]; extern void* gUnk_08010A5C[];
void sub_0804B7E8(void) void sub_0804B7E8(void) {
{
if (CheckLocalFlag(0x91)) { if (CheckLocalFlag(0x91)) {
ClearLocalFlag(0x91); ClearLocalFlag(0x91);
DoFade(5, 0x100); DoFade(5, 0x100);
@ -411,15 +410,13 @@ void sub_0804B7E8(void)
extern u32 gUnk_080D6B18[]; extern u32 gUnk_080D6B18[];
u32 sub_0804B82C(void) u32 sub_0804B82C(void) {
{
u32 index; u32 index;
if (CheckLocalFlag(0x91) != 0) { if (CheckLocalFlag(0x91) != 0) {
index = Random() & 1; index = Random() & 1;
ClearLocalFlag(2); ClearLocalFlag(2);
} } else {
else {
index = 0; index = 0;
SetLocalFlag(2); SetLocalFlag(2);
} }
@ -427,8 +424,7 @@ u32 sub_0804B82C(void)
return 1; return 1;
} }
void sub_0804B86C(void) void sub_0804B86C(void) {
{
if (CheckLocalFlag(0x91) != 0) { if (CheckLocalFlag(0x91) != 0) {
ClearLocalFlag(0x91); ClearLocalFlag(0x91);
DoFade(5, 0x100); DoFade(5, 0x100);
@ -440,15 +436,13 @@ void sub_0804B86C(void)
extern u32 gUnk_080D6BB8[]; extern u32 gUnk_080D6BB8[];
u32 sub_0804B8B0(void) u32 sub_0804B8B0(void) {
{
s32 index; s32 index;
if (CheckLocalFlag(0x91) != 0) { if (CheckLocalFlag(0x91) != 0) {
index = (s32)Random() % 3; index = (s32)Random() % 3;
ClearLocalFlag(3); ClearLocalFlag(3);
} } else {
else {
index = 0; index = 0;
SetLocalFlag(3); SetLocalFlag(3);
} }
@ -458,17 +452,62 @@ u32 sub_0804B8B0(void)
extern void* gUnk_08010A5C[]; extern void* gUnk_08010A5C[];
void sub_0804B8F0(void) void sub_0804B8F0(void) {
{
if (CheckLocalFlag(0x91)) { if (CheckLocalFlag(0x91)) {
ClearLocalFlag(0x91); ClearLocalFlag(0x91);
DoFade(5 ,0x100); DoFade(5, 0x100);
gLinkEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x60; gLinkEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x60;
gLinkEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38; gLinkEntity.y.HALF.HI = gRoomControls.roomOriginY + 0x38;
sub_080751E8(1,2, &gUnk_08010A5C); sub_080751E8(1, 2, &gUnk_08010A5C);
} }
} }
u32 sub_0804B934() { u32 sub_0804B934() {
return 1; return 1;
} }
extern EntityData* UpperInn_Oracles;
extern EntityData* UpperInn_NoFarore;
extern EntityData* UpperInn_NoNayru;
extern EntityData* UpperInn_NoDin;
extern EntityData* UpperInn_Farore;
extern EntityData* UpperInn_Nayru;
extern EntityData* UpperInn_Din;
void sub_0804B938(void) {
int iVar1;
if (gUnk_02002A40.field_0x8 < 4) {
return;
}
if (CheckGlobalFlag(RENTED_HOUSE_DIN)) {
if (!CheckGlobalFlag(NEW_HOUSE_NAYRU)) {
if (!CheckGlobalFlag(NEW_HOUSE_FARORE)) {
LoadRoomEntityList(&UpperInn_NoDin);
} else {
LoadRoomEntityList(&UpperInn_Nayru);
}
} else {
LoadRoomEntityList(&UpperInn_Farore);
}
} else if (CheckGlobalFlag(RENTED_HOUSE_NAYRU)) {
if (CheckGlobalFlag(NEW_HOUSE_DIN)) {
LoadRoomEntityList(&UpperInn_Farore);
} else if (!CheckGlobalFlag(NEW_HOUSE_FARORE)) {
LoadRoomEntityList(&UpperInn_NoNayru);
} else {
LoadRoomEntityList(&UpperInn_Din);
}
} else if (CheckGlobalFlag(RENTED_HOUSE_FARORE)) {
if (CheckGlobalFlag(NEW_HOUSE_DIN)) {
LoadRoomEntityList(&UpperInn_Nayru);
} else if (CheckGlobalFlag(NEW_HOUSE_NAYRU)) {
LoadRoomEntityList(&UpperInn_Din);
} else {
LoadRoomEntityList(&UpperInn_NoFarore);
}
} else {
LoadRoomEntityList(&UpperInn_Oracles);
}
}