From dc8bcb32e0db99420b35b4254c5218711bc1e3a0 Mon Sep 17 00:00:00 2001 From: theo3 Date: Mon, 27 Dec 2021 18:19:47 -0800 Subject: [PATCH] dungeon stuff --- asm/code_08018500.s | 4 +-- asm/code_08049D30.s | 4 +-- asm/code_08077B98.s | 8 ++--- include/player.h | 3 +- include/room.h | 16 ++++----- src/code_08077B98.c | 4 +-- src/collision.c | 4 +-- src/enemy/octorokBoss.c | 4 +-- src/enemy/vaatiTransfigured.c | 2 +- src/item/itemSword.c | 3 +- src/manager/manager17.c | 3 +- src/manager/manager24.c | 4 +-- src/manager/managerF.c | 14 ++++---- src/npc/npc4E.c | 4 +-- src/npc/picolyteBottle.c | 3 +- src/npc/postman.c | 2 +- src/object/houseDoorExterior.c | 2 +- src/object/minishSizedEntrance.c | 2 +- src/object/object6A.c | 60 ++++++++++++++++---------------- src/object/warpPoint.c | 2 +- src/overworld.c | 48 ++++++++++++------------- src/player.c | 10 +++--- src/playerItem/playerItem10.c | 5 +-- src/projectile/removableDust.c | 3 +- src/room.c | 2 +- src/roomInit.c | 4 +-- 26 files changed, 114 insertions(+), 106 deletions(-) diff --git a/asm/code_08018500.s b/asm/code_08018500.s index b12aa134..0e2026d7 100644 --- a/asm/code_08018500.s +++ b/asm/code_08018500.s @@ -160,8 +160,8 @@ _08018620: _08018624: .4byte gUnk_02033AB8 _08018628: .4byte gUnk_080B3D20 - thumb_func_start sub_0801862C -sub_0801862C: @ 0x0801862C + thumb_func_start GenerateAreaHint +GenerateAreaHint: @ 0x0801862C push {r4, r5, lr} ldr r1, _0801864C @ =gPlayerState movs r2, #0 diff --git a/asm/code_08049D30.s b/asm/code_08049D30.s index 95661e64..77b661aa 100644 --- a/asm/code_08049D30.s +++ b/asm/code_08049D30.s @@ -6,8 +6,8 @@ .text - thumb_func_start sub_08049D30 -sub_08049D30: @ 0x08049D30 + thumb_func_start UpdateRoomTracker +UpdateRoomTracker: @ 0x08049D30 push {r4, r5, r6, lr} ldr r1, _08049D58 @ =gUnk_020354B0 ldr r0, _08049D5C @ =gUnk_02024050 diff --git a/asm/code_08077B98.s b/asm/code_08077B98.s index 8f480ce5..6143589a 100644 --- a/asm/code_08077B98.s +++ b/asm/code_08077B98.s @@ -221,8 +221,8 @@ _0807815C: pop {pc} .align 2, 0 - thumb_func_start sub_08078160 -sub_08078160: @ 0x08078160 + thumb_func_start ForceSetPlayerState +ForceSetPlayerState: @ 0x08078160 push {lr} ldr r1, _08078178 @ =gPlayerState adds r1, #0xa8 @@ -558,7 +558,7 @@ _08078418: bl CreateEzloHint _08078420: movs r0, #0x13 - bl sub_08078160 + bl ForceSetPlayerState b _080784C4 .align 2, 0 _08078428: .4byte 0x00000B65 @@ -599,7 +599,7 @@ _08078484: movs r0, #7 strb r0, [r4, #0xc] movs r0, #0x13 - bl sub_08078160 + bl ForceSetPlayerState _0807848E: adds r1, r6, #0 adds r1, #0x39 diff --git a/include/player.h b/include/player.h index f664b6f3..7d29812c 100644 --- a/include/player.h +++ b/include/player.h @@ -216,7 +216,8 @@ typedef struct { /*0x8b*/ u8 controlMode; /*0x8c*/ u16 vel_x; /*0x8e*/ u16 vel_y; - /*0x90*/ union SplitWord field_0x90; + /*0x90*/ u16 field_0x90; + /*0x92*/ u16 field_0x92; /*0x94*/ u32 field_0x94; /*0x98*/ u16 field_0x98; /*0x9a*/ u16 field_0x9a; diff --git a/include/room.h b/include/room.h index 64729622..5e603926 100644 --- a/include/room.h +++ b/include/room.h @@ -101,14 +101,14 @@ typedef struct { Coords start_pos; u8 layer; u8 field_0x15; - u8 field_0x16; - u8 field_0x17; - s16 field_0x18; - s16 field_0x1a; - s16 field_0x1c; - s16 field_0x1e; - s16 field_0x20; - s16 field_0x22; + u8 dungeon_area; + u8 dungeon_room; + s16 dungeon_x; + s16 dungeon_y; + s16 dungeon_map_x; + s16 dungeon_map_y; + s16 overworld_map_x; + s16 overworld_map_y; u8 field_0x24[0x8]; } PlayerWorldStatus; static_assert(sizeof(PlayerWorldStatus) == 0x20); diff --git a/src/code_08077B98.c b/src/code_08077B98.c index ca1863f7..fddfcace 100644 --- a/src/code_08077B98.c +++ b/src/code_08077B98.c @@ -195,11 +195,11 @@ u32 sub_08077EC8(ItemBehavior* beh) { } bool32 sub_08077EFC(ItemBehavior* arg0) { - return sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.LO); + return sub_08077F24(arg0, (u16)gPlayerState.field_0x90); } bool32 sub_08077F10(ItemBehavior* arg0) { - return sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.HI); + return sub_08077F24(arg0, (u16)gPlayerState.field_0x92); } ASM_FUNC("asm/non_matching/sub_08077F24.inc", bool32 sub_08077F24(ItemBehavior* beh, u32 arg1)) diff --git a/src/collision.c b/src/collision.c index 1c22f7d6..43ffe8d8 100644 --- a/src/collision.c +++ b/src/collision.c @@ -60,7 +60,7 @@ void CollisionMain(void) { if (gPriorityHandler.sys_priority <= gPriorityHandler.ent_priority) prio = gPriorityHandler.ent_priority; - // if any min priority is set, dont do collision + // if any priority is set, dont do collision if (prio) return; @@ -303,7 +303,7 @@ void sub_080179EC(Entity* a1, Entity* a2) { Entity* sub_08017A90(Entity* a1, Entity* parent) { Entity* e; - e = (Entity*)CreateObject(153, 0, 0); + e = (Entity*)CreateObject(OBJECT_99, 0, 0); if (e != NULL) { e->animationState = (a1->direction >> 3) & 3; e->spriteOffsetX = a1->x.HALF.HI - parent->x.HALF.HI; diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c index fb16b706..0730b642 100644 --- a/src/enemy/octorokBoss.c +++ b/src/enemy/octorokBoss.c @@ -343,9 +343,9 @@ void OctorokBoss_Hit_SubAction6(Entity* this) { if (GET_TIMER(this) == 0) { if ((gScreenTransition.frameCount & 0xfU) == 0) { // Explosion in the center - CreateFx(this, 0x48, 0); + CreateFx(this, FX_GIANT_EXPLOSION3, 0); // Explosion at the front right leg - CreateFx(GET_HELPER(this)->legObjects[0], 0x48, 0); + CreateFx(GET_HELPER(this)->legObjects[0], FX_GIANT_EXPLOSION3, 0); } if (++this->field_0x82.HALF.LO == 0x79) { GET_HELPER(this)->mouthObject->health = 1; diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 8c80bbbd..bd462e33 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -341,7 +341,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { this->field_0x86.HALF.LO = 0; sub_080408EC(this); } else { - if (((this->actionDelay & 1) != 0) && (pEVar3 = CreateObject(0x9b, 1, 0xff), pEVar3 != NULL)) { + if (((this->actionDelay & 1) != 0) && (pEVar3 = CreateObject(OBJECT_9B, 1, 0xff), pEVar3 != NULL)) { pEVar3->parent = this; CopyPosition(this, pEVar3); pEVar3->x.HALF.HI += (Random() & 0xf) - 7; diff --git a/src/item/itemSword.c b/src/item/itemSword.c index 37a91ef4..4b9f1605 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -1,6 +1,7 @@ #include "item.h" #include "functions.h" #include "audio.h" +#include "object.h" extern void (*const gUnk_0811BD44[])(ItemBehavior*, u32); @@ -36,7 +37,7 @@ void sub_08075580(ItemBehavior* this, u32 arg1) { this->field_0x5[2] = 0x50; } sub_08077DF4(this, 0x168); - CreateObject(0x43, 0, 0); + CreateObject(OBJECT_43, 0, 0); return; } sub_080759B8(this, arg1); diff --git a/src/manager/manager17.c b/src/manager/manager17.c index d19440b0..139c4c2f 100644 --- a/src/manager/manager17.c +++ b/src/manager/manager17.c @@ -1,6 +1,7 @@ #include "manager.h" #include "flags.h" #include "room.h" +#include "object.h" typedef struct { Manager manager; @@ -32,7 +33,7 @@ void sub_0805AD60(Manager17* manager) { void sub_0805AD80(Manager17* manager) { if (CheckFlags(manager->field_0x3e) != 0) { - Entity* object = CreateObject(0, manager->manager.unk_0a, manager->manager.unk_0b); + Entity* object = CreateObject(GROUND_ITEM, manager->manager.unk_0a, manager->manager.unk_0b); if (object != NULL) { object->actionDelay = manager->field_0x35; object->collisionLayer = manager->field_0x36; diff --git a/src/manager/manager24.c b/src/manager/manager24.c index 7b3f2d19..532fdfd0 100644 --- a/src/manager/manager24.c +++ b/src/manager/manager24.c @@ -178,7 +178,7 @@ void sub_0805C294(u32 pos, u32 layer) { SetTileType(0xd7, pos + 0x41, layer); if (layer == 1) { if (CheckIsInteriorWithEnemies() != 0) { - object = CreateObject(0x4f, 0xe, 2); + object = CreateObject(ARCHWAY, 0xe, 2); if (object != NULL) { object->x.HALF.HI = ((pos & 0x3f) << 4) + 8 + gRoomControls.roomOriginX; object->y.HALF.HI = ((pos & 0xfc0) >> 2) + 0x20 + gRoomControls.roomOriginY; @@ -199,7 +199,7 @@ void sub_0805C294(u32 pos, u32 layer) { if (CheckIsDungeon() == 0) { return; } - object = CreateObject(0x4f, sub_0805C608(), 8); + object = CreateObject(ARCHWAY, sub_0805C608(), 8); if (object == NULL) { return; } diff --git a/src/manager/managerF.c b/src/manager/managerF.c index cc7b7692..70c810ac 100644 --- a/src/manager/managerF.c +++ b/src/manager/managerF.c @@ -10,6 +10,8 @@ #include "script.h" #include "utils.h" #include "tiles.h" +#include "object.h" +#include "item.h" void sub_08058ECC(ManagerF*); @@ -125,7 +127,7 @@ void sub_08058F44(u32 unk0, u32 unk1, u32 unk2) { void sub_08058F84(u32 unk0, u32 unk1) { Entity* tmp; - tmp = CreateObject(0x21, 0, 0); + tmp = CreateObject(OBJECT_21, 0, 0); if (!tmp) return; tmp->x.HALF.HI = gRoomControls.roomOriginX + unk0; @@ -177,7 +179,7 @@ void sub_08058FB0(ManagerF* this) { void sub_08059064(ManagerF* this) { Entity* tmp; - tmp = CreateObject(0, 0x53, 0); + tmp = CreateObject(GROUND_ITEM, ITEM_SMALL_KEY, 0); if (!tmp) return; tmp->actionDelay = 2; @@ -324,9 +326,9 @@ void sub_080592EC(ManagerF* this) { void sub_0805930C(ManagerF* this) { Entity* tmp; #ifdef EU - tmp = CreateObject(0xF, 0x43, 0x0); + tmp = CreateObject(SPECIAL_FX, FX_BIG_EXPLOSION2, 0x0); #else - tmp = CreateObject(0xF, 0x43, 0x40); + tmp = CreateObject(SPECIAL_FX, FX_BIG_EXPLOSION2, 0x40); #endif if (!tmp) return; @@ -361,7 +363,7 @@ void sub_0805938C(ManagerF* this) { u32 sub_080593CC(ManagerF* this) { if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swimState != 0 && gPlayerEntity.animationState == 0 && - (gPlayerState.field_0x90.HALF.LO & 0xF00) == 0x400) { + (gPlayerState.field_0x90 & 0xF00) == 0x400) { return sub_0806FCB8(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6); } return 0; @@ -374,7 +376,7 @@ void sub_08059424(ManagerF* this) { } if (!CheckFlags(this->unk_3c)) return; - tmp = CreateObject(0xF, 0x35, 0); + tmp = CreateObject(SPECIAL_FX, FX_BIG_EXPLOSION, 0); if (!tmp) return; tmp->collisionLayer = 2; diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c index 84d18da1..0f79c152 100644 --- a/src/npc/npc4E.c +++ b/src/npc/npc4E.c @@ -206,8 +206,8 @@ void sub_0806DCA0() { } void sub_0806DCC0() { - gScreenTransition.player_status.field_0x20 = 0x7c8; - gScreenTransition.player_status.field_0x22 = 0xf8; + gScreenTransition.player_status.overworld_map_x = 0x7c8; + gScreenTransition.player_status.overworld_map_y = 0xf8; } void NPC4E_Fusion(Entity* this) { diff --git a/src/npc/picolyteBottle.c b/src/npc/picolyteBottle.c index 25d56034..fa39f1b9 100644 --- a/src/npc/picolyteBottle.c +++ b/src/npc/picolyteBottle.c @@ -3,6 +3,7 @@ #include "structures.h" #include "functions.h" #include "textbox.h" +#include "object.h" extern ScreenTransitionData gUnk_0813AD4C; @@ -60,7 +61,7 @@ void sub_0806DFB4(Entity* this) { } else { if (this->actionDelay != 0) { this->actionDelay = 0; - obj = CreateObject(0x35, 2, this->field_0xf); + obj = CreateObject(OBJECT_35, 2, this->field_0xf); if (obj != NULL) { obj->parent = this; this->child = obj; diff --git a/src/npc/postman.c b/src/npc/postman.c index 9e643e8e..d8cdb5aa 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -99,7 +99,7 @@ void sub_080604DC(Entity* this) { if (this->spriteSettings.draw == 1 && CheckOnScreen(this)) { if ((this->frame & 1) != 0) { this->frame &= 0xfe; - ent = CreateFx(this, 17, 0x40); + ent = CreateFx(this, FX_DASH, 0x40); if (ent != NULL) { ent->y.HALF.HI++; SetDefaultPriority(ent, 3); diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index 79b8425c..137b19a5 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -168,7 +168,7 @@ void sub_0808692C(Entity* this) { static u8 sub_08086954(Entity* this) { if (sub_0800445C(this)) { if (sub_0806ED9C(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 && - (u16)gPlayerState.field_0x90.HALF.LO == 0x400 && gPlayerState.jumpStatus == 0) { + (u16)gPlayerState.field_0x90 == 0x400 && gPlayerState.jumpStatus == 0) { this->actionDelay--; } } else { diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c index a92a887c..5b891dd0 100644 --- a/src/object/minishSizedEntrance.c +++ b/src/object/minishSizedEntrance.c @@ -30,7 +30,7 @@ void sub_08090F00(Entity* this) { } } if ((gPlayerState.flags & PL_MINISH) && EntityInRectRadius(this, &gPlayerEntity, 4, 4) && - (gPlayerEntity.z.HALF.HI == 0) && (((u16)gPlayerState.field_0x90.HALF.LO) & gUnk_0812225C[this->type2])) { + (gPlayerEntity.z.HALF.HI == 0) && (((u16)gPlayerState.field_0x90) & gUnk_0812225C[this->type2])) { DoExitTransition(GetCurrentRoomProperty(this->actionDelay)); } } diff --git a/src/object/object6A.c b/src/object/object6A.c index 11dcfc48..c1b065a8 100644 --- a/src/object/object6A.c +++ b/src/object/object6A.c @@ -152,7 +152,7 @@ void sub_08094A90(Object6AEntity* this) { } void sub_08094AE8(Entity* this, ScriptExecutionContext* ctx) { - Object6AEntity* e = (Object6AEntity*)CreateObject(0x6A, 1, 0); + Object6AEntity* e = (Object6AEntity*)CreateObject(OBJECT_6A, 1, 0); if (e != NULL) { e->ctx = StartCutscene(&e->base, (void*)ctx->intVariable); } @@ -182,7 +182,7 @@ void sub_08094B80(Object6AEntity* this) { } void sub_08094B94(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x22, 0); + Entity* e = CreateObject(OBJECT_6A, 0x22, 0); if (e != NULL) { CopyPosition(&gPlayerEntity, e); e->z.HALF.HI = -48; @@ -194,7 +194,7 @@ void sub_08094B94(Object6AEntity* this) { } void sub_08094BE0(Entity* this) { - Entity* e = FindEntity(6, 0x6A, 6, 0x22, 0); + Entity* e = FindEntity(6, OBJECT_6A, 6, 0x22, 0); if (e != NULL) { CopyPosition(&gPlayerEntity, e); e->z.HALF.HI = -12; @@ -382,7 +382,7 @@ void sub_08094E30(Object6AEntity* this) { } void sub_08094F98(Object6AEntity* this) { - CreateObject(0x6A, 5, 0); + CreateObject(OBJECT_6A, 5, 0); } void sub_08094FA8(Object6AEntity* this) { @@ -531,7 +531,7 @@ void sub_080951C4(Object6AEntity* this) { void sub_08095244(Object6AEntity* this) { if (super->type == 0) { - Entity* e = CreateObject(0x6A, 0xA, 0); + Entity* e = CreateObject(OBJECT_6A, 0xA, 0); if (e != NULL) { e->parent = super; PositionRelative(super, e, 0x100000, -0x100000); @@ -575,7 +575,7 @@ void sub_08095288(Object6AEntity* this) { } void sub_08095330(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0xB, 0); + Entity* e = CreateObject(OBJECT_6A, 0xB, 0); if (e != NULL) { super->child = e; e->child = super; @@ -622,7 +622,7 @@ void sub_080953A4(Object6AEntity* this) { } void sub_08095420(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0xC, 0); + Entity* e = CreateObject(OBJECT_6A, 0xC, 0); if (e != NULL) { PositionRelative(super, e, 0, -0x100000); ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); @@ -633,12 +633,12 @@ void nullsub_527(Object6AEntity* this) { } void sub_0809545C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* p = CreateObject(0x6A, 0xD, 0); + Entity* p = CreateObject(OBJECT_6A, 0xD, 0); Entity* e; if (p != NULL) { PositionRelative(super, p, 0, -0x100000); ((Object6AEntity*)p)->ctx = StartCutscene(p, (u16*)ctx->intVariable); - e = CreateObject(0x6A, 2, 0); + e = CreateObject(OBJECT_6A, 2, 0); if (e != NULL) { CopyPosition(p, e); e->parent = p; @@ -647,7 +647,7 @@ void sub_0809545C(Object6AEntity* this, ScriptExecutionContext* ctx) { } void sub_080954AC(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x1A, 0); + Entity* e = CreateObject(OBJECT_6A, 0x1A, 0); if (e != NULL) { CopyPosition(super, e); ((Object6AEntity*)e)->ctx = StartCutscene(e, &script_08015B14); @@ -759,7 +759,7 @@ void sub_080956B4(Object6AEntity* this) { } void sub_08095754(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0xF, super->type2); + Entity* e = CreateObject(OBJECT_6A, 0xF, super->type2); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -779,7 +779,7 @@ void sub_0809577C(Object6AEntity* this) { } void sub_080957B4(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x10, 0); + Entity* e = CreateObject(OBJECT_6A, 0x10, 0); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -799,7 +799,7 @@ void sub_080957DC(Object6AEntity* this) { } void sub_08095810(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x11, 0); + Entity* e = CreateObject(OBJECT_6A, 0x11, 0); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -860,7 +860,7 @@ void sub_08095954(Object6AEntity* this) { s8 x, y; } s8XY; - Entity* e = CreateObject(0x6A, 0x14, 0); + Entity* e = CreateObject(OBJECT_6A, 0x14, 0); if (e != NULL) { u32 tmp, x, y; e->parent = super; @@ -891,7 +891,7 @@ void sub_080959CC(Object6AEntity* this) { } void sub_08095A1C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0x16, 0); + Entity* e = CreateObject(OBJECT_6A, 0x16, 0); if (e != NULL) { e->x.HALF.HI = gRoomControls.roomOriginX + 232; e->y.HALF.HI = gRoomControls.roomOriginY + 312; @@ -902,7 +902,7 @@ void sub_08095A1C(Object6AEntity* this, ScriptExecutionContext* ctx) { } void sub_08095A68(Object6AEntity* this) { - Entity* e = FindEntity(6, 0x6A, 6, 0x16, 0); + Entity* e = FindEntity(6, OBJECT_6A, 6, 0x16, 0); if (e != NULL) { e->action = 0xFF; } @@ -974,7 +974,7 @@ void sub_08095B48(Object6AEntity* this) { } void sub_08095BE0(Object6AEntity* this, u32 val) { - Entity* e = CreateObject(0x6A, 0x18, val); + Entity* e = CreateObject(OBJECT_6A, 0x18, val); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -997,7 +997,7 @@ void sub_08095C00(Object6AEntity* this) { } void sub_08095C48(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x19, 0); + Entity* e = CreateObject(OBJECT_6A, 0x19, 0); if (e != NULL) { super->child = e; e->parent = super; @@ -1022,7 +1022,7 @@ void sub_08095C68(Object6AEntity* this) { } void sub_08095CB0(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x1B, 0); + Entity* e = CreateObject(OBJECT_6A, 0x1B, 0); if (e != NULL) { super->child = e; e->parent = super; @@ -1052,7 +1052,7 @@ void sub_08095D30(Object6AEntity* this, u32 a2) { } void sub_08095D54(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0x1C, 0); + Entity* e = CreateObject(OBJECT_6A, 0x1C, 0); if (e != NULL) { CopyPosition(&gPlayerEntity, e); e->collisionLayer = 2; @@ -1061,7 +1061,7 @@ void sub_08095D54(Object6AEntity* this, ScriptExecutionContext* ctx) { } void sub_08095D8C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0x1D, 0); + Entity* e = CreateObject(OBJECT_6A, 0x1D, 0); if (e != NULL) { CopyPosition(super, e); ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); @@ -1098,7 +1098,7 @@ void sub_08095DBC(Object6AEntity* this) { } void sub_08095E7C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0x1E, 0); + Entity* e = CreateObject(OBJECT_6A, 0x1E, 0); if (e != NULL) { CopyPosition(super, e); ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); @@ -1107,7 +1107,7 @@ void sub_08095E7C(Object6AEntity* this, ScriptExecutionContext* ctx) { NONMATCH("asm/non_matching/object6A/sub_08095EAC.inc", void sub_08095EAC(Object6AEntity* this, ScriptExecutionContext* ctx)) { - Entity* e = CreateObject(0x6A, 0x1E, 1); + Entity* e = CreateObject(OBJECT_6A, 0x1E, 1); s32 x, y; if (e != NULL) { @@ -1186,7 +1186,7 @@ void sub_08096028(Object6AEntity* this) { type2 = 4; if (!CheckLocalFlagByBank(768, 122)) type2 = 3; - CreateObject(0x6A, 0x1F, type2); + CreateObject(OBJECT_6A, 0x1F, type2); } void sub_08096058(Object6AEntity* this) { @@ -1214,7 +1214,7 @@ void sub_08096084(Object6AEntity* this) { } void sub_080960C4(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0x23, 0x49); + Entity* e = CreateObject(OBJECT_6A, 0x23, 0x49); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -1222,7 +1222,7 @@ void sub_080960C4(Object6AEntity* this, ScriptExecutionContext* ctx) { ResolveEntityBelow(super, e); ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); } - e = CreateObject(0x6A, 0x24, 0x4A); + e = CreateObject(OBJECT_6A, 0x24, 0x4A); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -1248,7 +1248,7 @@ void sub_08096168(Object6AEntity* this) { void sub_080961B0(Object6AEntity* this) { int i; for (i = 0; i < 8; ++i) { - Entity* e = CreateObject(0x6A, 0x25, 0); + Entity* e = CreateObject(OBJECT_6A, 0x25, 0); if (e != NULL) { CopyPosition(super, e); e->direction = 32 * i; @@ -1264,21 +1264,21 @@ void sub_080961F4(Object6AEntity* this) { void sub_08096208(Object6AEntity* this, u32 x) { s8* p = &gUnk_08122B2E[x * 2]; - Entity* e = CreateObject(0x6A, 0x26, 0); + Entity* e = CreateObject(OBJECT_6A, 0x26, 0); if (e != NULL) { PositionRelative(super, e, p[0] << 16, p[1] << 16); } } void sub_0809623C(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x27, 0); + Entity* e = CreateObject(OBJECT_6A, 0x27, 0); if (e != NULL) { PositionRelative(super, e, 0, -0x100000); } } void sub_08096260(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x28, 0); + Entity* e = CreateObject(OBJECT_6A, 0x28, 0); if (e != NULL) { PositionRelative(super, e, 0, -0x100000); } diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index df5a9ba2..bd5fc8cf 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -224,7 +224,7 @@ void sub_0808B830(Entity* this) { this->action = 3; this->actionDelay = 0; this->spriteSettings.draw = 1; - tmp = CreateObject(0x34, 0, 0); + tmp = CreateObject(WARP_POINT, 0, 0); if (tmp) { tmp->field_0x70.BYTES.byte0 = 1; tmp->parent = this; diff --git a/src/overworld.c b/src/overworld.c index ff90afc8..fdd22b3e 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -41,11 +41,11 @@ void CleanUpGFXSlots(); void sub_080ADE24(); void sub_0801C370(u32); void sub_0801AE44(u32); -void sub_0801862C(void); -void sub_08078160(u32); +void GenerateAreaHint(void); +void ForceSetPlayerState(u32); void SetPlayerEventPriority(void); RoomResInfo* GetCurrentRoomInfo(void); -void sub_08049D30(void); +void UpdateRoomTracker(void); void InitScriptData(void); void sub_08054524(void); void sub_080186D4(void); @@ -673,8 +673,8 @@ u32 sub_08052B24(void) { if ((gPlayerEntity.z.HALF.HI & 0x8000) && !gPlayerState.field_0xa) return 0; - sub_0801862C(); - sub_08078160(19); + GenerateAreaHint(); + ForceSetPlayerState(PL_STATE_TALKEZLO); SetPlayerEventPriority(); return 1; } @@ -728,25 +728,25 @@ void sub_08052C3C(void) { void sub_08052C5C(void) { if (!CheckIsInteriorNoEnemies()) { if (CheckIsOverworld()) { - gScreenTransition.player_status.field_0x20 = gPlayerEntity.x.HALF_U.HI; - gScreenTransition.player_status.field_0x22 = gPlayerEntity.y.HALF_U.HI; + gScreenTransition.player_status.overworld_map_x = gPlayerEntity.x.HALF_U.HI; + gScreenTransition.player_status.overworld_map_y = gPlayerEntity.y.HALF_U.HI; } else if (CheckIsDungeon()) { - gScreenTransition.player_status.field_0x1c = gPlayerEntity.x.HALF.HI; - gScreenTransition.player_status.field_0x1e = gPlayerEntity.y.HALF.HI; + gScreenTransition.player_status.dungeon_map_x = gPlayerEntity.x.HALF.HI; + gScreenTransition.player_status.dungeon_map_y = gPlayerEntity.y.HALF.HI; } } } void sub_08052CA4(u32 area, u32 room, u32 x, u32 y) { RoomHeader* hdr = gAreaRoomHeaders[area] + room; - gScreenTransition.player_status.field_0x20 = hdr->map_x + x; - gScreenTransition.player_status.field_0x22 = hdr->map_y + y; + gScreenTransition.player_status.overworld_map_x = hdr->map_x + x; + gScreenTransition.player_status.overworld_map_y = hdr->map_y + y; } void sub_08052CD0(u32 area, u32 room, u32 x, u32 y) { RoomHeader* hdr = gAreaRoomHeaders[area] + room; - gScreenTransition.player_status.field_0x1c = hdr->map_x + x; - gScreenTransition.player_status.field_0x1e = hdr->map_y + y; + gScreenTransition.player_status.dungeon_map_x = hdr->map_x + x; + gScreenTransition.player_status.dungeon_map_y = hdr->map_y + y; } void sub_08052CFC(void) { @@ -817,7 +817,7 @@ void sub_08052EA0(void) { gRoomVars.unk_10[3] = gRoomVars.unk_10[0]; gRoomVars.lightLevel = 256; gArea.locationIndex = gAreaMetadata[gRoomControls.areaID].location; - sub_08049D30(); + UpdateRoomTracker(); InitScriptData(); sub_08054524(); sub_080186D4(); @@ -979,10 +979,10 @@ void sub_080531F8(void) { if (sub_08053144()) { MemCopy(&gScreenTransition.player_status, &gSave.saved_status, sizeof gScreenTransition.player_status); if (CheckIsDungeon()) { - gScreenTransition.player_status.field_0x16 = gRoomControls.areaID; - gScreenTransition.player_status.field_0x17 = gRoomControls.roomID; - gScreenTransition.player_status.field_0x18 = gPlayerEntity.x.HALF.HI; - gScreenTransition.player_status.field_0x1a = gPlayerEntity.y.HALF.HI; + gScreenTransition.player_status.dungeon_area = gRoomControls.areaID; + gScreenTransition.player_status.dungeon_room = gRoomControls.roomID; + gScreenTransition.player_status.dungeon_x = gPlayerEntity.x.HALF.HI; + gScreenTransition.player_status.dungeon_y = gPlayerEntity.y.HALF.HI; } } } @@ -1022,13 +1022,13 @@ static void sub_080532E4(void) { RoomHeader* r_hdr = gAreaRoomHeaders[AREA_FORTRESS_OF_WINDS] + 33; - gScreenTransition.player_status.field_0x16 = AREA_FORTRESS_OF_WINDS; - gScreenTransition.player_status.field_0x17 = 33; + gScreenTransition.player_status.dungeon_area = AREA_FORTRESS_OF_WINDS; + gScreenTransition.player_status.dungeon_room = 33; - gScreenTransition.player_status.field_0x18 = r_hdr->map_x + r_hdr->pixel_width / 2; - gScreenTransition.player_status.field_0x1c = gScreenTransition.player_status.field_0x18; - gScreenTransition.player_status.field_0x1a = r_hdr->map_y + r_hdr->pixel_height + 0xa0; - gScreenTransition.player_status.field_0x1e = gScreenTransition.player_status.field_0x1a; + gScreenTransition.player_status.dungeon_x = r_hdr->map_x + r_hdr->pixel_width / 2; + gScreenTransition.player_status.dungeon_map_x = gScreenTransition.player_status.dungeon_x; + gScreenTransition.player_status.dungeon_y = r_hdr->map_y + r_hdr->pixel_height + 0xa0; + gScreenTransition.player_status.dungeon_map_y = gScreenTransition.player_status.dungeon_y; } void sub_08053320(void) { diff --git a/src/player.c b/src/player.c index 0ead68bc..3cde33dd 100644 --- a/src/player.c +++ b/src/player.c @@ -2493,7 +2493,7 @@ static const u16 gUnk_0811BC30[] = { static NONMATCH("asm/non_matching/player/sub_08073584.inc", void sub_08073584(Entity* this)) { u32 state, dir, tmp, tmp2, idx; - if ((gPlayerState.field_0x90.HALF.HI & 0x80) || this->iframes > 0 || gPlayerState.field_0x3c[0] || + if ((gPlayerState.field_0x92 & 0x80) || this->iframes > 0 || gPlayerState.field_0x3c[0] || (gPlayerState.flags & PL_PARACHUTE) == 0) { gPlayerState.jumpStatus |= 0x40; sub_0807921C(); @@ -2871,7 +2871,7 @@ static void sub_08073D20(Entity* this) { gPlayerState.framestate = PL_STATE_CAPE; if (gPlayerState.floor_type != SURFACE_SHALLOW_WATER && gPlayerState.floor_type != SURFACE_WATER) { gPlayerState.swimState = 0; - this->field_0x3c &= 0xFBu; + this->field_0x3c &= ~4; } if (!RunQueuedAction() && this->subAction != 2) { if ((gPlayerState.flags & PL_HIDDEN) == 0) { @@ -3254,7 +3254,7 @@ void SurfaceAction_ShallowWater(Entity* this) { this->spritePriority.b0 = 4; gPlayerState.swimState = 0; } - if ((gPlayerState.field_0x90.HALF.HI & 0xF00) || gPlayerState.field_0x11 == 1) + if ((gPlayerState.field_0x92 & 0xF00) || gPlayerState.field_0x11 == 1) SoundReq(SFX_WATER_WALK); } } @@ -3406,7 +3406,7 @@ void SurfaceAction_22(Entity* this) { void SurfaceAction_Dust(Entity* this) { if (!sub_080741C4()) { gPlayerState.field_0x80 -= 128; - if (gPlayerState.field_0x11 == 1 || (gPlayerState.field_0x90.HALF.HI & 0xF00) != 0) { + if (gPlayerState.field_0x11 == 1 || (gPlayerState.field_0x92 & 0xF00) != 0) { if (gPlayerState.floor_type == SURFACE_DUST) CreateObjectWithParent(this, OBJECT_21, 1, 0); else @@ -3770,7 +3770,7 @@ NONMATCH("asm/non_matching/player/sub_080751E8.inc", void sub_080751E8(u32 a1, u gPlayerState.field_0x39 = 1; tmp = &script_08009EF0; } - e = CreateObject(0x5B, !gPlayerState.field_0x39 ? 2 : 0, 0); + e = CreateObject(OBJECT_5B, !gPlayerState.field_0x39 ? 2 : 0, 0); if (e != NULL) { CopyPosition(&gPlayerEntity, e); StartCutscene(e, tmp); diff --git a/src/playerItem/playerItem10.c b/src/playerItem/playerItem10.c index 02ff1fb6..b0a495bb 100644 --- a/src/playerItem/playerItem10.c +++ b/src/playerItem/playerItem10.c @@ -2,6 +2,7 @@ #include "player.h" #include "functions.h" #include "asm.h" +#include "object.h" extern void (*const gUnk_0812AA80[])(Entity*); @@ -115,7 +116,7 @@ void sub_080ACC78(Entity* this) { } o = sub_08008782(this, 0xe, puVar8[*(u32*)&this->field_0x74], puVar8[*(u32*)&this->field_0x74 + 1]); if (o != NULL) { - child = CreateObject(0x11, o->type, o->type2); + child = CreateObject(OBJECT_11, o->type, o->type2); if (child != NULL) { child->actionDelay = o->actionDelay; child->x.HALF.HI = puVar8[*(u32*)&this->field_0x74] + this->x.HALF.HI; @@ -136,7 +137,7 @@ void sub_080ACC78(Entity* this) { } else { this->field_0x70.WORD = gUnk_0812AABC[this->type]; } - child = CreateObject(0x17, 0, 0); + child = CreateObject(OBJECT_17, 0, 0); if (child == NULL) { return; } diff --git a/src/projectile/removableDust.c b/src/projectile/removableDust.c index f6bc3346..5fbf3c76 100644 --- a/src/projectile/removableDust.c +++ b/src/projectile/removableDust.c @@ -4,6 +4,7 @@ #include "functions.h" #include "flags.h" #include "utils.h" +#include "object.h" extern u32 sub_080002C8(u16, u8); extern Entity* LoadRoomEntity(EntityData*); @@ -50,7 +51,7 @@ void sub_080AA464(Entity* this) { if (this->type == 0) { sub_080AA544(this); } - entity = CreateObject(0x21, 3, 0); + entity = CreateObject(OBJECT_21, 3, 0); if (entity != NULL) { CopyPosition(this, entity); } diff --git a/src/room.c b/src/room.c index f685c833..629e05e6 100644 --- a/src/room.c +++ b/src/room.c @@ -366,7 +366,7 @@ static void LoadDestructibleTile(TileEntity* tile) { void sub_0804B388(u32 a1, u32 a2) { Entity* e; SetTileType(a2 == 1 ? 38 : 52, a1, a2); - e = CreateObject(0xF, 2, 0); + e = CreateObject(SPECIAL_FX, 2, 0); if (e != NULL) { e->collisionLayer = a2; sub_0806F704(e, a1); diff --git a/src/roomInit.c b/src/roomInit.c index fc0a2ff2..80ff8a1c 100644 --- a/src/roomInit.c +++ b/src/roomInit.c @@ -4901,8 +4901,8 @@ void sub_StateChange_HouseInteriors4_Mayor(void) { if (!GetInventoryValue(ITEM_FLIPPERS) && CheckGlobalFlag(MIZUKAKI_START) && !GetInventoryValue(ITEM_QST_BOOK3)) { LoadRoomEntityList(&gUnk_080F3A48); } - gScreenTransition.player_status.field_0x20 = 0xf28; - gScreenTransition.player_status.field_0x22 = 0x82d; + gScreenTransition.player_status.overworld_map_x = 0xf28; + gScreenTransition.player_status.overworld_map_y = 0x82d; } extern u32 Enemies_LakeHylia_Main;