From 65b80571b230d08426e6329dc7eb4348ca5012d1 Mon Sep 17 00:00:00 2001 From: theo3 Date: Mon, 28 Mar 2022 21:01:02 -0700 Subject: [PATCH 1/2] naming --- asm/non_matching/game/sub_08054974.inc | 2 +- asm/src/code_080043E8.s | 2 +- .../dhc/script_Object69DarkNutsRoom.inc | 2 +- include/area.h | 2 +- include/functions.h | 4 +-- include/game.h | 2 +- include/npc.h | 2 +- include/object.h | 2 +- include/player.h | 6 ++-- src/collision.c | 10 +++--- src/enemy/bladeTrap.c | 4 +-- src/enemy/bombarossa.c | 4 +-- src/enemy/enemy64.c | 10 +++--- src/enemy/gyorgMale.c | 6 ++-- src/enemy/lakituCloud.c | 2 +- src/enemy/mazaalMacro.c | 2 +- src/enemy/vaatiWrath.c | 2 +- src/entity.c | 2 +- src/game.c | 34 +++++++++---------- src/manager/manager22.c | 22 ++++++------ src/npc/npc23.c | 4 +-- src/npcUtils.c | 2 +- src/object/bigPushableLever.c | 2 +- src/object/bird.c | 6 ++-- src/object/board.c | 2 +- src/object/button.c | 2 +- src/object/fan.c | 2 +- src/object/floatingPlatform.c | 12 +++---- src/object/gyorgBossObject.c | 4 +-- src/object/lavaPlatform.c | 12 +++---- src/object/lightableSwitch.c | 4 +-- src/object/lilypadSmall.c | 12 +++---- src/object/object98.c | 4 +-- src/object/pushableLever.c | 2 +- src/object/warpPoint.c | 2 +- src/objectUtils.c | 4 +-- src/player.c | 18 +++++----- src/playerUtils.c | 10 +++--- src/roomInit.c | 4 +-- src/script.c | 2 +- src/staffroll.c | 3 +- 41 files changed, 117 insertions(+), 118 deletions(-) diff --git a/asm/non_matching/game/sub_08054974.inc b/asm/non_matching/game/sub_08054974.inc index f9ba2e01..4e8e998a 100644 --- a/asm/non_matching/game/sub_08054974.inc +++ b/asm/non_matching/game/sub_08054974.inc @@ -33,7 +33,7 @@ _080549BC: ldrb r0, [r6, #2] ldrb r1, [r6, #3] bl sub_08052FF4 - bl sub_0807C740 + bl InitializeCamera ldr r1, _08054A00 @ =gUpdateVisibleTiles movs r0, #1 strb r0, [r1] diff --git a/asm/src/code_080043E8.s b/asm/src/code_080043E8.s index 9bd9eeee..f2487878 100644 --- a/asm/src/code_080043E8.s +++ b/asm/src/code_080043E8.s @@ -61,7 +61,7 @@ _08004458: .4byte sub_080043B0 sub_0800445C: @ 0x0800445C push {r4, r5, lr} adds r4, r0, #0 - bl sub_08079F8C + bl PlayerCanBeMoved cmp r0, #0 beq _08004482 ldr r5, _080044D8 @ =gPlayerEntity diff --git a/data/scripts/dhc/script_Object69DarkNutsRoom.inc b/data/scripts/dhc/script_Object69DarkNutsRoom.inc index c2f30cae..2b05c72c 100644 --- a/data/scripts/dhc/script_Object69DarkNutsRoom.inc +++ b/data/scripts/dhc/script_Object69DarkNutsRoom.inc @@ -14,7 +14,7 @@ script_0800E550: PlaySound SFX_105 Wait 0x001e EzloMessage 0x1622 - Call sub_08053494 + Call StartDarkNutTimer SetLocalFlag 0x007e script_0800E582: EnablePlayerControl diff --git a/include/area.h b/include/area.h index e6e749d7..00a2339d 100644 --- a/include/area.h +++ b/include/area.h @@ -28,7 +28,7 @@ typedef struct { u16 localFlagOffset; u8 filler[4]; u16 lightLevel; - u8 unk_0b; + u8 lightType; u8 unk_0c_0 : 1; u8 unk_0c_1 : 3; u8 unk_0c_4 : 4; diff --git a/include/functions.h b/include/functions.h index 631f5176..db1b8baf 100644 --- a/include/functions.h +++ b/include/functions.h @@ -211,7 +211,7 @@ extern u32 sub_0807953C(void); extern void sub_08079BD8(Entity*); extern u32 sub_08079D48(); extern void sub_08079D84(void); -extern bool32 sub_08079F8C(void); +extern bool32 PlayerCanBeMoved(void); extern u32 sub_08079FC4(u32); extern void sub_0807A050(void); extern void sub_0807A5B8(u32); @@ -243,7 +243,7 @@ extern void sub_080A1ED0(u32, u32, u32); extern Entity* sub_080A2A3C(Entity*, u32, u32, u32); extern Entity* sub_080A2AD4(Entity*); extern void sub_080A2AF4(Entity*, s32, s32); -extern void sub_080A2CC0(Entity*, u16**, u16*); +extern void UpdateRailMovement(Entity*, u16**, u16*); extern void sub_080A57F4(void); extern void sub_080A71C4(u32, u32, u32, u32); extern void InitItemGetSequence(u32, u32, u32); diff --git a/include/game.h b/include/game.h index a0bf8a98..ca722d7c 100644 --- a/include/game.h +++ b/include/game.h @@ -261,7 +261,7 @@ void sub_08052EA0(void); void sub_08053250(void); void sub_080533CC(void); -void sub_08053494(void); +void StartDarkNutTimer(void); void sub_080534AC(void); void InitBiggoronTimer(void); diff --git a/include/npc.h b/include/npc.h index 1a57ccc9..43c399fe 100644 --- a/include/npc.h +++ b/include/npc.h @@ -36,7 +36,7 @@ Entity* CreateNPC(u32 subtype, u32 form, u32 parameter); u32 UpdateFuseInteraction(Entity*); void NPCInit(Entity* ent); -void sub_0806F0A4(void); +void CollideFollowers(void); // TODO move? void sub_08078784(Entity* ent, u32 arg1); diff --git a/include/object.h b/include/object.h index c8b46a16..d2c17e5a 100644 --- a/include/object.h +++ b/include/object.h @@ -19,7 +19,7 @@ extern void sub_080787B4(Entity*); extern void sub_0808C650(Entity*, u32); extern u32 sub_0808C67C(void); extern void sub_0808C688(void); -extern void sub_080A2BE4(Entity*, bool32); +extern void SyncPlayerToPlatform(Entity*, bool32); void CreateDust(Entity* parent); void CreateDustAt(s32, s32, u32); diff --git a/include/player.h b/include/player.h index d5037141..90d4f9a9 100644 --- a/include/player.h +++ b/include/player.h @@ -20,7 +20,7 @@ enum PlayerActions { PLAYER_EMPTYBOTTLE, PLAYER_FROZEN, PLAYER_0807204C, - PLAYER_080720DC, + PLAYER_ROOM_EXIT, PLAYER_PULL, PLAYER_LAVA, PLAYER_WARP, @@ -33,7 +33,7 @@ enum PlayerActions { PLAYER_080728AC, PLAYER_INHOLE, PLAYER_08072C9C, - PLAYER_08074C44, + PLAYER_SLEEP, PLAYER_CLIMB, PLAYER_USEENTRANCE, PLAYER_PARACHUTE, @@ -77,7 +77,7 @@ enum PlayerSpawnType { PL_SPAWN_DROP, PL_SPAWN_WALKING, PL_SPAWN_STEP_IN, - PL_SPAWN_SPECIAL, + PL_SPAWN_SLEEPING, PL_SPAWN_DROP_MINISH, PL_SPAWN_STAIRS_ASCEND, PL_SPAWN_STAIRS_DESCEND, diff --git a/src/collision.c b/src/collision.c index 911b3f11..11d94675 100644 --- a/src/collision.c +++ b/src/collision.c @@ -207,7 +207,7 @@ bool32 IsColliding(Entity* this, Entity* that) { } bool32 IsCollidingPlayer(Entity* this) { - if (sub_08079F8C()) + if (PlayerCanBeMoved()) return IsColliding(this, &gPlayerEntity); return FALSE; } @@ -528,7 +528,7 @@ s32 sub_08017F3C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if (tgt->confusedTime == 0) { if (org == &gPlayerEntity) { - if (sub_08079F8C() && + if (PlayerCanBeMoved() && #ifdef EU (gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 && #else @@ -568,7 +568,7 @@ s32 sub_0801802C(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) kind = org->kind; if (kind == 1) { - if (sub_08079F8C()) { + if (PlayerCanBeMoved()) { if (((((direction ^ 0x10) - 4 * tgt->animationState + 5) & 0x1F)) > 0xA) { x = 0x11aa; return sub_08018308(org, tgt, direction, &gCollisionMtx[x + org->hurtType]); @@ -622,7 +622,7 @@ s32 sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if (tgt->confusedTime == 0) { if (org == &gPlayerEntity) { - if (sub_08079F8C() && + if (PlayerCanBeMoved() && #ifdef EU (gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 && #else @@ -651,7 +651,7 @@ s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) } s32 sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { - if (org == &gPlayerEntity && sub_08079F8C()) + if (org == &gPlayerEntity && PlayerCanBeMoved()) sub_08004484(tgt, org); return 0; } diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index d534242a..5a44b954 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -14,7 +14,7 @@ void BladeTrap(Entity* this) { if (this->action == 0) { this->action = 1; this->child = GetCurrentRoomProperty(this->type); - sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD); + UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); } if (!(this->direction & 0x80)) { LinearMoveUpdate(this); @@ -24,6 +24,6 @@ void BladeTrap(Entity* this) { if (!(this->direction & 0x80)) { EnqueueSFX(SFX_METAL_CLINK); } - sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD); + UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); } } diff --git a/src/enemy/bombarossa.c b/src/enemy/bombarossa.c index f873f5c4..aec4f188 100644 --- a/src/enemy/bombarossa.c +++ b/src/enemy/bombarossa.c @@ -27,7 +27,7 @@ void Bombarossa_OnTick(BombarossaEntity* this) { InitializeAnimation(super, 0); if (super->type != 0) { super->child = GetCurrentRoomProperty(super->type); - sub_080A2CC0(super, (u16**)&super->child, &this->unk_0x76); + UpdateRailMovement(super, (u16**)&super->child, &this->unk_0x76); } } @@ -68,7 +68,7 @@ void sub_0803350C(BombarossaEntity* this) { } if (--this->unk_0x76 == 0) { - sub_080A2CC0(super, (u16**)&super->child, &this->unk_0x76); + UpdateRailMovement(super, (u16**)&super->child, &this->unk_0x76); } } diff --git a/src/enemy/enemy64.c b/src/enemy/enemy64.c index 9f3f242d..007d7a32 100644 --- a/src/enemy/enemy64.c +++ b/src/enemy/enemy64.c @@ -309,7 +309,7 @@ void Enemy64_Action4(Enemy64Entity* this) { void Enemy64_Action4_SubAction0(Enemy64Entity* this) { SoundReq(SFX_BOSS_DIE); - if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) { + if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) { SetPlayerControl(CONTROL_2); super->subAction = 2; super->timer = 0x1e; @@ -320,7 +320,7 @@ void Enemy64_Action4_SubAction0(Enemy64Entity* this) { } void Enemy64_Action4_SubAction1(Enemy64Entity* this) { - if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) { + if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) { SetPlayerControl(CONTROL_2); super->subAction = 2; super->timer = 1; @@ -438,7 +438,7 @@ void sub_08049998(Enemy64Entity* this, u32 param_2) { tmpX = super->x.HALF.HI; tmpY = super->y.HALF.HI; LinearMoveAngle(super, super->speed, super->direction); - if (((this->unk_7c & 1) != 0) && sub_08079F8C()) { + if (((this->unk_7c & 1) != 0) && PlayerCanBeMoved()) { gPlayerEntity.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.x.HALF.HI; gPlayerEntity.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.y.HALF.HI; } @@ -447,7 +447,7 @@ void sub_08049998(Enemy64Entity* this, u32 param_2) { void sub_080499F0(Enemy64Entity* this) { u32 tmp; - if ((((super->action != 0) && (gPlayerEntity.z.HALF.HI == 0)) && (sub_08079F8C())) && ((this->unk_7c & 1) == 0)) { + if ((((super->action != 0) && (gPlayerEntity.z.HALF.HI == 0)) && (PlayerCanBeMoved())) && ((this->unk_7c & 1) == 0)) { if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24) && ((this->unk_7c & 2) == 0)) { tmp = sub_080045DA((s32)gPlayerEntity.x.HALF.HI - super->x.HALF.HI, @@ -491,7 +491,7 @@ void sub_08049B20(Enemy64Entity* this) { tmpX = super->x.HALF.HI; tmpY = super->y.HALF.HI; LinearMoveAngle(super, super->speed, super->direction); - if (((this->unk_7c & 1) != 0) && sub_08079F8C()) { + if (((this->unk_7c & 1) != 0) && PlayerCanBeMoved()) { gPlayerEntity.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.x.HALF.HI; gPlayerEntity.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.y.HALF.HI; } diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 975424f7..a0c05067 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -1035,7 +1035,7 @@ void sub_08047DF0(GyorgMaleEntity* this, u32 unk1) { oldY = super->y.HALF.HI; LinearMoveAngle(super, super->speed, super->direction); if (this->unk_7c & 1) { - if (sub_08079F8C()) { + if (PlayerCanBeMoved()) { gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX; gPlayerEntity.y.HALF.HI += super->y.HALF.HI - oldY; } @@ -1053,7 +1053,7 @@ void sub_08047E58(GyorgMaleEntity* this) { oldY = super->y.HALF.HI; LinearMoveAngle(super, super->speed, super->direction); if (this->unk_7c & 1) { - if (sub_08079F8C()) { + if (PlayerCanBeMoved()) { gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX; gPlayerEntity.y.HALF.HI += super->y.HALF.HI - oldY; } @@ -1126,7 +1126,7 @@ void sub_08048004(GyorgMaleEntity* this) { COLLISION_OFF(super); if (gPlayerEntity.z.HALF.HI != 0) return; - if (!sub_08079F8C()) + if (!PlayerCanBeMoved()) return; if (this->unk_7c & 1) { u32 b = super->spriteRendering.b3; diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 98ee064d..26eb535b 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -118,7 +118,7 @@ void sub_0803CDD8(Entity* this) { void sub_0803CE14(Entity* this) { u8 direction; - sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD); + UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); direction = this->direction; if (direction & 0x80) { diff --git a/src/enemy/mazaalMacro.c b/src/enemy/mazaalMacro.c index 4dbf53d6..c672248d 100644 --- a/src/enemy/mazaalMacro.c +++ b/src/enemy/mazaalMacro.c @@ -144,7 +144,7 @@ void sub_08034E68(Entity* this) { sub_08035120(this); } if (gRoomTransition.field_0x39 == 0) { - if (sub_08079F8C()) { + if (PlayerCanBeMoved()) { this->action = 3; scriptExecutionContext = StartCutscene(this, (u16*)script_MazaalMacroDefeated); *(ScriptExecutionContext**)&this->cutsceneBeh = scriptExecutionContext; diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index 44c2569b..4b05b5e1 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -561,7 +561,7 @@ void VaatiWrathType0ActionD(Entity* this) { void sub_08041BE8(Entity* this) { Entity* entity; - if (sub_08079F8C()) { + if (PlayerCanBeMoved()) { this->subAction = 1; this->timer = 120; this->updatePriority = PRIO_NO_BLOCK; diff --git a/src/entity.c b/src/entity.c index be882d66..f85ccb3f 100644 --- a/src/entity.c +++ b/src/entity.c @@ -203,7 +203,7 @@ void UpdateEntities(void) { UpdatePlayerInput(); UpdatePriority(); ClearHitboxList(); - sub_0806F0A4(); + CollideFollowers(); f = ram_UpdateEntities; f(0); ClearAllDeletedEntities(); diff --git a/src/game.c b/src/game.c index 6578ea67..6ebd0579 100644 --- a/src/game.c +++ b/src/game.c @@ -123,7 +123,7 @@ extern void sub_080186D4(void); extern void sub_0806F364(void); extern void sub_08052FF4(u32 area, u32 room); extern void CloneMapData(void); -extern void sub_0807C740(void); +extern void InitializeCamera(void); extern void SetBGDefaults(void); extern void LoadItemGfx(void); @@ -137,7 +137,7 @@ static void UpdateWindcrests(void); static void UpdateFakeScroll(void); static void UpdatePlayerMapCoords(void); static void sub_08052C3C(void); -static void sub_0805340C(void); +static void UpdateTimerCallbacks(void); static void sub_08051D98(void); static void sub_08051DCC(void); static bool32 CheckGameOver(void); @@ -155,7 +155,7 @@ static void sub_080534E4(u32* a1); static void InitAllRoomResInfo(void); static void InitRoomResInfo(RoomResInfo* info, RoomHeader* hdr, u32 area, u32 room); static void sub_080532E4(void); -static void sub_08053460(void); +static void ResetTimerFlags(void); typedef struct { u8 _0; @@ -406,7 +406,7 @@ static void GameMain_Update(void) { if (CheckInitPauseMenu() || CheckInitPortal()) { return; } - sub_0805340C(); + UpdateTimerCallbacks(); // leave early if player is now entering a portal if (gMain.substate != GAMEMAIN_UPDATE) { @@ -499,7 +499,7 @@ static void InitializeEntities(void) { CallRoomProp6(); InitializePlayer(); gUnk_03004030.unk_00 = NULL; - sub_0807C740(); + InitializeCamera(); gUpdateVisibleTiles = 1; LoadRoomBgm(); SetColor(0, 0); @@ -648,7 +648,7 @@ void sub_08051F9C(u32 a1, u32 a2, u32 a3, u32 a4) { sub_08052FF4(a1, a2); gRoomControls.scroll_x = gRoomControls.origin_x + a3; gRoomControls.scroll_y = gRoomControls.origin_y + a4; - sub_0807C740(); + InitializeCamera(); gUpdateVisibleTiles = 1; gUsedPalettes = 0; gScreen.lcd.displayControl |= tmp; @@ -950,8 +950,8 @@ static void InitializePlayer(void) { [PL_SPAWN_MINISH] = PLAYER_MINISH, [PL_SPAWN_DROP] = PLAYER_INIT, [PL_SPAWN_WALKING] = PLAYER_ROOMTRANSITION, - [PL_SPAWN_STEP_IN] = PLAYER_080720DC, - [PL_SPAWN_SPECIAL] = PLAYER_08074C44, + [PL_SPAWN_STEP_IN] = PLAYER_ROOM_EXIT, + [PL_SPAWN_SLEEPING] = PLAYER_SLEEP, [PL_SPAWN_DROP_MINISH] = PLAYER_MINISH, [PL_SPAWN_STAIRS_ASCEND] = PLAYER_USEENTRANCE, [PL_SPAWN_STAIRS_DESCEND] = PLAYER_USEENTRANCE, @@ -1503,7 +1503,7 @@ void LoadAuxiliaryRoom(u32 area, u32 room) { sub_08052FF4(area, room); gRoomControls.camera_target = NULL; CloneMapData(); - sub_0807C740(); + InitializeCamera(); } void sub_08052FF4(u32 area, u32 room) { @@ -1637,7 +1637,7 @@ static void sub_0805329C(void) { sub_080532E4(); break; default: - sub_08053460(); + ResetTimerFlags(); break; } } @@ -1690,7 +1690,7 @@ void sub_080533CC(void) { gUsedPalettes |= 8; } -static void sub_0805340C(void) { +static void UpdateTimerCallbacks(void) { static void (*const sHandlers[])(u32*) = { sub_08053434, DummyHandler, sub_080534E4, DummyHandler, DummyHandler, DummyHandler, DummyHandler, DummyHandler, }; @@ -1710,13 +1710,13 @@ static void DummyHandler(u32* a1) { static void sub_08053434(u32* a1) { if (gArea.locationIndex == 29 && *a1) { if (!--*a1) { - sub_08053460(); + ResetTimerFlags(); MenuFadeIn(5, 6); } } } -static void sub_08053460(void) { +static void ResetTimerFlags(void) { static const u16 sClearFlags[] = { FLAG_BANK_10, LV6_GUFUU1_GISHIKI, FLAG_BANK_10, LV6_GUFUU1_DEMO, FLAG_BANK_10, LV6_ZELDA_DISCURSE, FLAG_BANK_10, LV6_00_ESCAPE, FLAG_BANK_10, LV6_GUFUU2_DEAD, FLAG_BANK_G, ENDING, @@ -1730,7 +1730,7 @@ static void sub_08053460(void) { ClearFlagArray(sClearFlags); } -void sub_08053494(void) { +void StartDarkNutTimer(void) { gSave.timers[0] = 10800; } @@ -1762,7 +1762,7 @@ static void ResetTmpFlags(void) { FLAG_BANK_2, SHOP00_ITEM_01, FLAG_BANK_2, SHOP01_CAFE_01, 0xFFFF }; - sub_08053460(); + ResetTimerFlags(); ClearFlagArray(sClearFlags); if (!CheckGlobalFlag(WATERBEAN_PUT)) @@ -2084,7 +2084,7 @@ void sub_08053DB4(void) { if (gFadeControl.active == 0) { u8* ptr = gMenu.field_0xc; sub_08052FF4(gMenu.field_0xc[4], gMenu.field_0xc[5]); - sub_0807C740(); + InitializeCamera(); gUpdateVisibleTiles = 1; gRoomControls.scroll_x = (s8)ptr[6] + gRoomControls.scroll_x; gRoomControls.scroll_y = (s8)ptr[7] + gRoomControls.scroll_y; @@ -2143,7 +2143,7 @@ void sub_08053F20(void) { DeleteAllEntities(); ptr = gMenu.field_0xc; sub_08052FF4(gMenu.field_0xc[8], gMenu.field_0xc[9]); - sub_0807C740(); + InitializeCamera(); gUpdateVisibleTiles = 1; gRoomControls.scroll_x = (s8)ptr[10] + gRoomControls.scroll_x; gRoomControls.scroll_y = (s8)ptr[0xb] + gRoomControls.scroll_y; diff --git a/src/manager/manager22.c b/src/manager/manager22.c index df516e8d..9f456551 100644 --- a/src/manager/manager22.c +++ b/src/manager/manager22.c @@ -27,7 +27,7 @@ void Manager22_Main(Manager22* this) { s32 sVar1; u32 uVar3; - if (gArea.unk_0b == 0) { + if (gArea.lightType == 0) { sub_0801E104(); gScreen.lcd.displayControl &= ~(DISPCNT_BG3_ON | DISPCNT_WIN0_ON); DeleteThisEntity(); @@ -46,7 +46,7 @@ void Manager22_Main(Manager22* this) { sub_0805BA78(); sub_0805BAD4(); } - if (gArea.unk_0b == 2) { + if (gArea.lightType == 2) { gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON; } else { if (CheckRectOnScreen(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x, @@ -56,7 +56,7 @@ void Manager22_Main(Manager22* this) { gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON; } uVar3 = this->manager.unk_0e; - if (((gPlayerState.flags & PL_USE_LANTERN)) && (gArea.unk_0b)) { + if (((gPlayerState.flags & PL_USE_LANTERN)) && (gArea.lightType)) { if (uVar3 < 0x48) { uVar3 += 4; sub_0801E154(uVar3); @@ -127,13 +127,13 @@ extern u16 gUnk_08108CA8[]; void sub_0805BAD4() { static const u16 gUnk_08108CA8[] = { 0x10, 0x10f, 0x20e, 0x30d, 0x40c, 0x50b, 0x60a, 0x709, 0x808, 0x907, 0xa06, 0xb05, 0xc04, 0xd03, 0xe02, 0xf01, 0x1000, 0x00 }; - if (gArea.unk_0b) { + if (gArea.lightType != 0) { gScreen.controls.alphaBlend = gUnk_08108CA8[(gArea.lightLevel << 0x10) >> 0x14]; } } void sub_0805BB00(s32 lightLevel, s32 param_2) { - if (gArea.unk_0b == 0) { + if (gArea.lightType == 0) { Manager* pManager = GetEmptyManager(); if (pManager != 0) { pManager->type = 9; @@ -146,9 +146,9 @@ void sub_0805BB00(s32 lightLevel, s32 param_2) { gScreen.controls.layerFXControl = 0x3e48; gRoomVars.lightLevel = lightLevel; if (param_2) { - gArea.unk_0b = 1; + gArea.lightType = 1; } else { - gArea.unk_0b = 2; + gArea.lightType = 2; } } @@ -173,7 +173,7 @@ s32 UpdateLightLevel() { s32 iVar1; iVar1 = 0; - if (gArea.unk_0b && gRoomVars.lightLevel < (s16)gArea.lightLevel) { + if (gArea.lightType && gRoomVars.lightLevel < (s16)gArea.lightLevel) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; iVar1 = sub_0805BA78(); if (iVar1) { @@ -187,7 +187,7 @@ s32 sub_0805BC04(void) { s32 iVar1; iVar1 = 0; - if (gArea.unk_0b && gRoomVars.lightLevel > (short)gArea.lightLevel) { + if (gArea.lightType && gRoomVars.lightLevel > (short)gArea.lightLevel) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; iVar1 = sub_0805BA78(); if (iVar1) { @@ -198,8 +198,8 @@ s32 sub_0805BC04(void) { } void sub_0805BC4C() { - if (gArea.unk_0b != 0) { - gArea.unk_0b = 0; + if (gArea.lightType != 0) { + gArea.lightType = 0; gScreen.lcd.displayControl &= ~(DISPCNT_BG3_ON | DISPCNT_WIN0_ON); } } diff --git a/src/npc/npc23.c b/src/npc/npc23.c index ee98b803..c0b01efb 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -63,7 +63,7 @@ void nullsub_110(void) { void sub_080663D4(Entity* this) { if (this->x.HALF.HI == this->field_0x7c.HALF_U.HI - 8) { - if (gPlayerEntity.action != PLAYER_080720DC) { + if (gPlayerEntity.action != PLAYER_ROOM_EXIT) { this->action = 4; this->direction = 0; this->speed = 0; @@ -94,7 +94,7 @@ void sub_0806643C(Entity* this) { } void sub_08066474(void) { - if (gPlayerEntity.action != PLAYER_080720DC) { + if (gPlayerEntity.action != PLAYER_ROOM_EXIT) { gPauseMenuOptions.disabled = 0; } } diff --git a/src/npcUtils.c b/src/npcUtils.c index 813f8772..c6cf4c74 100644 --- a/src/npcUtils.c +++ b/src/npcUtils.c @@ -274,7 +274,7 @@ s32 sub_0806F078(Entity* ent, s32 a2) { return 0; } -void sub_0806F0A4(void) { +void CollideFollowers(void) { LinkedList* entityList = gEntityLists + 7; Entity* currentEntity; u32 val; diff --git a/src/object/bigPushableLever.c b/src/object/bigPushableLever.c index 23aa475f..b36a0c00 100644 --- a/src/object/bigPushableLever.c +++ b/src/object/bigPushableLever.c @@ -57,7 +57,7 @@ void BigPushableLever_Idle(BigPushableLeverEntity* this) { SetTile(this->tileIndexLower, this->tilePositionLower, super->collisionLayer); EnqueueSFX(SFX_132); RequestPriorityDuration(super, 0x1e); - if (sub_08079F8C()) { + if (PlayerCanBeMoved()) { gPlayerState.pushedObject = 0x98; gPlayerState.queued_action = 5; gPlayerState.flags |= PL_BUSY; diff --git a/src/object/bird.c b/src/object/bird.c index 78798b49..94b13bf2 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -211,9 +211,9 @@ void Bird_Type8(Entity* this) { this->speed = 0x300; } - if ((gPlayerEntity.flags & 0x80) != 0 && (gMessage.doTextBox & 0x7f) == 0 && gPlayerEntity.action != 28 && - gPlayerEntity.action != 6 && gPlayerEntity.action != 9 && gPlayerState.framestate != 24 && - gPlayerState.framestate != 11 && gPlayerState.framestate != 8 && sub_08079F8C() && + if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.doTextBox & 0x7f) == 0 && gPlayerEntity.action != PLAYER_SLEEP && + gPlayerEntity.action != PLAYER_BOUNCE && gPlayerEntity.action != PLAYER_MINISH && gPlayerState.framestate != PL_STATE_CLIMB && + gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_PARACHUTE && PlayerCanBeMoved() && (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe))) { s32 z = gPlayerEntity.z.HALF.HI - this->z.HALF.HI - 8; if ((u16)z < 0x20 && gPlayerEntity.health != 0) { diff --git a/src/object/board.c b/src/object/board.c index 7c3607c3..18e7ff97 100644 --- a/src/object/board.c +++ b/src/object/board.c @@ -58,7 +58,7 @@ void sub_08098BE0(BoardEntity* this) { } void sub_08098BE8(BoardEntity* this) { - if ((gPlayerState.flags & PL_MINISH) && sub_08098C30(this, &gPlayerEntity) && sub_08079F8C() && + if ((gPlayerState.flags & PL_MINISH) && sub_08098C30(this, &gPlayerEntity) && PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) { gPlayerState.field_0x14 = 1; sub_0807AAF8(&gPlayerEntity, this->tile); diff --git a/src/object/button.c b/src/object/button.c index 20a34d21..c16a1334 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -165,7 +165,7 @@ Entity* sub_08081D74(Entity* this) { u32 sub_08081E0C(Entity* this) { Entity* tmp = &gPlayerEntity; - if (tmp->z.HALF.HI != 0 || !sub_08079F8C()) { + if (tmp->z.HALF.HI != 0 || !PlayerCanBeMoved()) { return 0; } else { return EntityInRectRadius(this, tmp, 5, 6); diff --git a/src/object/fan.c b/src/object/fan.c index 51815c83..882edd33 100644 --- a/src/object/fan.c +++ b/src/object/fan.c @@ -113,7 +113,7 @@ void sub_0809EE44(FanEntity* this) { if (uVar4 != 0) { pEVar1 = &gPlayerEntity; if (sub_0809EF78(this, pEVar1)) { - if (sub_08079F8C()) { + if (PlayerCanBeMoved()) { sub_08079E58(super->speed, super->direction); } } diff --git a/src/object/floatingPlatform.c b/src/object/floatingPlatform.c index 74ab1231..f762a719 100644 --- a/src/object/floatingPlatform.c +++ b/src/object/floatingPlatform.c @@ -29,7 +29,7 @@ void sub_080860D8(FloatingPlatformEntity* this) { super->frameIndex = super->type; super->spritePriority.b0 = 7; super->child = (Entity*)GetCurrentRoomProperty(super->type2); - sub_080A2CC0(super, (u16**)&super->child, &this->unk70); + UpdateRailMovement(super, (u16**)&super->child, &this->unk70); } void sub_0808611C(FloatingPlatformEntity* this) { @@ -41,15 +41,15 @@ void sub_0808611C(FloatingPlatformEntity* this) { super->parent->timer++; } - sub_080A2BE4(super, iVar2); + SyncPlayerToPlatform(super, iVar2); } else if (super->timer == 0) { - sub_080A2BE4(super, iVar2); + SyncPlayerToPlatform(super, iVar2); } else { - sub_080A2BE4(super, FALSE); + SyncPlayerToPlatform(super, FALSE); } if (--this->unk70 == 0) { - sub_080A2CC0(super, (u16**)&super->child, &this->unk70); + UpdateRailMovement(super, (u16**)&super->child, &this->unk70); } } @@ -58,7 +58,7 @@ bool32 sub_08086168(FloatingPlatformEntity* this) { const u8* ptr; ptr = gUnk_08120658 + super->type * 2; - if (((EntityInRectRadius(super, &gPlayerEntity, ptr[0], ptr[1])) && sub_08079F8C())) { + if (((EntityInRectRadius(super, &gPlayerEntity, ptr[0], ptr[1])) && PlayerCanBeMoved())) { gPlayerState.field_0x14 = 1; if (gPlayerEntity.z.HALF.HI == 0) { return TRUE; diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c index b0f0920b..047c9a40 100644 --- a/src/object/gyorgBossObject.c +++ b/src/object/gyorgBossObject.c @@ -225,7 +225,7 @@ void GyorgBossObject_FemalePhase4(GyorgBossObjectEntity* this) { } this->unk_6c = 0; gRoomTransition.field_0x39 = 0; - if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) { + if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) { super->action = 9; super->timer = 0; super->subtimer = 0xF0; @@ -479,7 +479,7 @@ u32 sub_080A20B8(GyorgBossObjectEntity* this, GyorgMaleEntity* other) { if (other == NULL) { return 1; } - if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) { + if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) { return other->unk_7c == 0 && gPlayerState.field_0x14 != 0; } return 0; diff --git a/src/object/lavaPlatform.c b/src/object/lavaPlatform.c index 830ba02e..4459128b 100644 --- a/src/object/lavaPlatform.c +++ b/src/object/lavaPlatform.c @@ -18,11 +18,11 @@ typedef struct { /*0x72*/ u16 wobbleTime; /**< Time the player can stand on the platform. */ /*0x74*/ u16 respawnTime; /**< Time until the platform respawns after it has sunk. */ /*0x76*/ u16 unk_76; - /*0x78*/ Entity* unk_78; // Typed same as second argument of sub_080A2CC0 + /*0x78*/ Entity* unk_78; // Typed same as second argument of UpdateRailMovement } LavaPlatformEntity; typedef struct { - /*0x00*/ Entity* unk_78; // Typed same as second argument of sub_080A2CC0 + /*0x00*/ Entity* unk_78; // Typed same as second argument of UpdateRailMovement /*0x04*/ s16 x; /*0x06*/ s16 y; /*0x08*/ u8 collisionLayer; @@ -246,7 +246,7 @@ void LavaPlatform_SpawnPlatforms(LavaPlatformEntity* this) { platform->respawnTime = entry->respawnTime; platform->unk_78 = entry->unk_78; UpdateSpriteForCollisionLayer((Entity*)platform); - sub_080A2CC0(&platform->base, (u16**)&platform->unk_78, &platform->unk_76); + UpdateRailMovement(&platform->base, (u16**)&platform->unk_78, &platform->unk_76); } entry++; } @@ -282,7 +282,7 @@ void sub_0809264C(LavaPlatformEntity* this) { bool32 LavaPlatform_IsPlayerOnPlatform(LavaPlatformEntity* this) { if ((gPlayerState.flags & PL_MINISH) == 0 && EntityInRectRadius(super, &gPlayerEntity, 0x10, 0x10) && - sub_08079F8C()) { + PlayerCanBeMoved()) { gPlayerState.field_0x14 = 1; if (gPlayerEntity.z.HALF.HI == 0) { super->subtimer = 1; @@ -294,12 +294,12 @@ bool32 LavaPlatform_IsPlayerOnPlatform(LavaPlatformEntity* this) { } void sub_080926E4(LavaPlatformEntity* this) { - sub_080A2BE4(super, super->subtimer); + SyncPlayerToPlatform(super, super->subtimer); if (super->action == 1) { (super->parent)->x.HALF.HI = super->x.HALF.HI; (super->parent)->y.HALF.HI = super->y.HALF.HI; } if (--this->unk_76 == 0) { - sub_080A2CC0(super, (u16**)&this->unk_78, &this->unk_76); + UpdateRailMovement(super, (u16**)&this->unk_78, &this->unk_76); } } diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c index dcf5ca1e..3c5aefd0 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -65,7 +65,7 @@ void sub_0809EAD8(Entity* this) { if (this->type2 != 0) { this->child = GetCurrentRoomProperty(this->type2); - sub_080A2CC0(this, (u16**)&this->child, &this->field_0x74.HWORD); + UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); } else { SetTile(0x4050, COORD_TO_TILE(this), this->collisionLayer); @@ -82,7 +82,7 @@ void sub_0809EB30(Entity* this) { } puVar2 = &this->field_0x74.HWORD; if (!--*puVar2) { - sub_080A2CC0(this, (u16**)&this->child, puVar2); + UpdateRailMovement(this, (u16**)&this->child, puVar2); } } } diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c index 3f72f3e3..6cbd40e4 100644 --- a/src/object/lilypadSmall.c +++ b/src/object/lilypadSmall.c @@ -4,7 +4,7 @@ extern u16 gUnk_08123318[]; static void sub_08097B24(Entity* this); -static bool32 sub_08097ADC(Entity* this); +static bool32 CheckMovePlayer(Entity* this); void LilypadSmall(Entity* this) { u32 rand; @@ -19,22 +19,22 @@ void LilypadSmall(Entity* this) { this->spriteSettings.draw = TRUE; this->spritePriority.b0 = 7; this->child = GetCurrentRoomProperty(this->type2); - sub_080A2CC0(this, (u16**)&this->child, &this->field_0x70.HALF.LO); + UpdateRailMovement(this, (u16**)&this->child, &this->field_0x70.HALF.LO); } - sub_080A2BE4(this, sub_08097ADC(this)); + SyncPlayerToPlatform(this, CheckMovePlayer(this)); sub_08097B24(this); psVar4 = (u16*)&this->field_0x70; if (--*psVar4 == 0) { - sub_080A2CC0(this, (u16**)&this->child, psVar4); + UpdateRailMovement(this, (u16**)&this->child, psVar4); } } -static bool32 sub_08097ADC(Entity* this) { +static bool32 CheckMovePlayer(Entity* this) { if (!(gPlayerState.flags & PL_MINISH)) { return FALSE; } else if (EntityInRectRadius(this, &gPlayerEntity, 8, 8) == 0) { return FALSE; - } else if (!sub_08079F8C()) { + } else if (!PlayerCanBeMoved()) { return FALSE; } else { gPlayerState.field_0x14 = 1; diff --git a/src/object/object98.c b/src/object/object98.c index d39d7ea2..a5de48e9 100644 --- a/src/object/object98.c +++ b/src/object/object98.c @@ -48,7 +48,7 @@ void sub_0809E360(Object98Entity* this) { SetDefaultPriority(super, 0); if (super->type != 0) { super->child = (Entity*)GetCurrentRoomProperty(super->type); - sub_080A2CC0(super, (u16**)&super->child, &this->unk74); + UpdateRailMovement(super, (u16**)&super->child, &this->unk74); } } } @@ -62,7 +62,7 @@ void sub_0809E3E4(Object98Entity* this) { } if (--this->unk74 == 0) { - sub_080A2CC0(super, (u16**)&super->child, &this->unk74); + UpdateRailMovement(super, (u16**)&super->child, &this->unk74); } } } diff --git a/src/object/pushableLever.c b/src/object/pushableLever.c index 8142a0f9..bdd17fa9 100644 --- a/src/object/pushableLever.c +++ b/src/object/pushableLever.c @@ -56,7 +56,7 @@ void PushableLever_Idle(PushableLeverEntity* this) { SetTile(this->tileIndex, this->tilePosition, super->collisionLayer); EnqueueSFX(SFX_16A); RequestPriorityDuration(super, 0x1e); - if (sub_08079F8C()) { + if (PlayerCanBeMoved()) { gPlayerState.pushedObject = 0x90; gPlayerState.queued_action = 5; gPlayerState.flags |= PL_BUSY; diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index 84949f45..c558ce37 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -205,7 +205,7 @@ void sub_0808B73C(Entity* this) { u32 sub_0808B7C8(Entity* this) { if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.framestate != PL_STATE_DIE && gPlayerEntity.health != 0 && - sub_08079F8C() && EntityInRectRadius(this, &gPlayerEntity, 5, 5) && gPlayerEntity.z.HALF.HI == 0) { + PlayerCanBeMoved() && EntityInRectRadius(this, &gPlayerEntity, 5, 5) && gPlayerEntity.z.HALF.HI == 0) { if (this->timer == 0 && gPlayerEntity.action == PLAYER_08072C9C) { ResetPlayerAnimationAndAction(); } diff --git a/src/objectUtils.c b/src/objectUtils.c index 2640c180..42ef2df5 100644 --- a/src/objectUtils.c +++ b/src/objectUtils.c @@ -261,7 +261,7 @@ void CreateSparkle(Entity* entity) { } } -NONMATCH("asm/non_matching/objectUtils/sub_080A2BE4.inc", void sub_080A2BE4(Entity* this, bool32 param_2)) { +NONMATCH("asm/non_matching/objectUtils/sub_080A2BE4.inc", void SyncPlayerToPlatform(Entity* this, bool32 param_2)) { s16 oldValue; s32 diff; u16 newValue; @@ -307,7 +307,7 @@ NONMATCH("asm/non_matching/objectUtils/sub_080A2BE4.inc", void sub_080A2BE4(Enti } END_NONMATCH -void sub_080A2CC0(Entity* this, u16** param_2, u16* param_3) { +void UpdateRailMovement(Entity* this, u16** param_2, u16* param_3) { u16* ptr = *param_2; if (ptr != NULL) { if (*ptr == 0xfe) { diff --git a/src/player.c b/src/player.c index 835d7ec3..18dbb005 100644 --- a/src/player.c +++ b/src/player.c @@ -63,7 +63,7 @@ static EntityAction sub_08071DB8; static EntityAction PlayerEmptyBottle; static EntityAction PlayerFrozen; static EntityAction sub_0807204C; -static EntityAction sub_080720DC; +static EntityAction PlayerRoomExit; static EntityAction PlayerPull; static EntityAction PlayerLava; EntityAction PlayerWarp; // why is this defined in playerUtils.c? We may never know : ( @@ -76,7 +76,7 @@ static EntityAction PlayerRoll; static EntityAction PlayerWaitForScroll; static EntityAction PlayerInHole; static EntityAction sub_08072C9C; -static EntityAction sub_08074C44; +static EntityAction PlayerSleep; static EntityAction PlayerClimb; static EntityAction PlayerUseEntrance; static EntityAction PlayerParachute; @@ -152,7 +152,7 @@ static EntityAction PlayerFrozenUpdate; static EntityAction sub_08072064; static EntityAction sub_08072098; -// PLAYER_080720DC +// PLAYER_ROOM_EXIT static EntityAction sub_08072100; static EntityAction sub_08072168; @@ -229,7 +229,7 @@ static EntityAction sub_08074018; static EntityAction sub_08074060; static EntityAction sub_080740D8; -// PLAYER_08074C44 +// PLAYER_SLEEP static EntityAction sub_08074C68; static EntityAction sub_08074CF8; static EntityAction sub_08074F00; @@ -317,7 +317,7 @@ void DoPlayerAction(Entity* this) { [PLAYER_EMPTYBOTTLE] = PlayerEmptyBottle, [PLAYER_FROZEN] = PlayerFrozen, [PLAYER_0807204C] = sub_0807204C, - [PLAYER_080720DC] = sub_080720DC, + [PLAYER_ROOM_EXIT] = PlayerRoomExit, [PLAYER_PULL] = PlayerPull, [PLAYER_LAVA] = PlayerLava, [PLAYER_WARP] = PlayerWarp, @@ -330,7 +330,7 @@ void DoPlayerAction(Entity* this) { [PLAYER_080728AC] = PlayerWaitForScroll, [PLAYER_INHOLE] = PlayerInHole, [PLAYER_08072C9C] = sub_08072C9C, - [PLAYER_08074C44] = sub_08074C44, + [PLAYER_SLEEP] = PlayerSleep, [PLAYER_CLIMB] = PlayerClimb, [PLAYER_USEENTRANCE] = PlayerUseEntrance, [PLAYER_PARACHUTE] = PlayerParachute, @@ -1773,7 +1773,7 @@ static void sub_08072098(Entity* this) { SetPlayerActionNormal(); } -static void sub_080720DC(Entity* this) { +static void PlayerRoomExit(Entity* this) { static EntityAction* const gUnk_0811BB60[] = { sub_08072100, sub_08072168, @@ -3787,7 +3787,7 @@ static void conveyer_push(Entity* this) { LinearMoveUpdate(this); } -static void sub_08074C44(Entity* this) { +static void PlayerSleep(Entity* this) { static EntityAction* const gUnk_0811BC88[] = { sub_08074C68, sub_08074CF8, @@ -4068,7 +4068,7 @@ void sub_080751E8(u32 a1, u32 a2, void* script) { MemClear(&gPlayerScriptExecutionContext, sizeof(ScriptExecutionContext)); gPlayerScriptExecutionContext.scriptInstructionPointer = script; ((fixme*)&gPlayerEntity)->ctx = &gPlayerScriptExecutionContext; - gPlayerState.queued_action = PLAYER_08074C44; + gPlayerState.queued_action = PLAYER_SLEEP; gPlayerState.field_0x38 = 1; gPlayerState.field_0x39 = 0; gPlayerState.field_0x3a = a2; diff --git a/src/playerUtils.c b/src/playerUtils.c index 00c8902d..6a94deb9 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -861,7 +861,7 @@ void CreateEzloHint(u32 hintId, u32 hintHeight) { } void sub_08078AC0(u32 param_1, u32 param_2, u32 param_3) { - gPlayerState.queued_action = PLAYER_080720DC; + gPlayerState.queued_action = PLAYER_ROOM_EXIT; gPlayerState.field_0x38 = param_1; gPlayerState.field_0x39 = param_2 != 0; gPlayerState.field_0x3a = param_3 != 0; @@ -1272,11 +1272,11 @@ bool32 sub_08079F48(u32 param_1, u32 param_2) { return TRUE; } -bool32 sub_08079F8C(void) { +bool32 PlayerCanBeMoved(void) { if ((gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_FROZEN | PL_FALLING | PL_DISABLE_ITEMS | PL_PIT_IS_EXIT | PL_IN_MINECART | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING)) != 0 || - gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == 3 || gPlayerEntity.action == 0xb) { + gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == PLAYER_FALL || gPlayerEntity.action == PLAYER_08071DB8) { return FALSE; } else { return TRUE; @@ -1309,7 +1309,7 @@ void DeleteClones(void) { gPlayerClones[2] = NULL; gPlayerState.flags &= ~PL_CLONING; if (((gPlayerEntity.action != 0x17) || (gPlayerState.chargeState.action != 4)) && - ((u8)(gPlayerState.chargeState.action - 4) < 2)) { + (gPlayerState.chargeState.action == 4 || gPlayerState.chargeState.action == 5)) { gPlayerState.chargeState.action = 1; } } @@ -2010,7 +2010,7 @@ ASM_FUNC("asm/non_matching/playerUtils/sub_0807C5F4.inc", void sub_0807C5F4()) ASM_FUNC("asm/non_matching/playerUtils/sub_0807C69C.inc", void sub_0807C69C()) -ASM_FUNC("asm/non_matching/playerUtils/sub_0807C740.inc", void sub_0807C740()) +ASM_FUNC("asm/non_matching/playerUtils/sub_0807C740.inc", void InitializeCamera()) void sub_0807C810(void) { struct_03004030* ptr; diff --git a/src/roomInit.c b/src/roomInit.c index 709cbcff..84a090cb 100644 --- a/src/roomInit.c +++ b/src/roomInit.c @@ -667,7 +667,7 @@ void sub_StateChange_HyruleCastle_3(void) { u32 sub_unk3_HyruleCastle_4(void) { if (!CheckLocalFlag(CASTLE_04_MEZAME)) { - gRoomTransition.player_status.spawn_type = PL_SPAWN_SPECIAL; + gRoomTransition.player_status.spawn_type = PL_SPAWN_SLEEPING; ClearGlobalFlag(ZELDA_CHASE); } return 1; @@ -5472,7 +5472,7 @@ void sub_StateChange_HouseInteriors3_Bakery(void) { u32 sub_unk3_HouseInteriors3_Simon(void) { if (CheckGlobalFlag(MAROYA_WAKEUP)) { - gRoomTransition.player_status.spawn_type = PL_SPAWN_SPECIAL; + gRoomTransition.player_status.spawn_type = PL_SPAWN_SLEEPING; } return 1; } diff --git a/src/script.c b/src/script.c index 64692f23..46ffb747 100644 --- a/src/script.c +++ b/src/script.c @@ -218,7 +218,7 @@ void StartPlayerScript(u16* script) { gPlayerScriptExecutionContext.scriptInstructionPointer = script; player = &gPlayerEntity; *(ScriptExecutionContext**)&player->cutsceneBeh = &gPlayerScriptExecutionContext; - gPlayerState.queued_action = PLAYER_08074C44; + gPlayerState.queued_action = PLAYER_SLEEP; gPlayerState.field_0x3a = 0; gPlayerState.field_0x39 = 0; gPlayerState.field_0x38 = 0; diff --git a/src/staffroll.c b/src/staffroll.c index d2813369..529f7b51 100644 --- a/src/staffroll.c +++ b/src/staffroll.c @@ -97,8 +97,7 @@ void StaffrollTask_State1(void) { } void StaffrollTask_State1MenuType0(void) { - gMenu.transitionTimer -= 1; - if (gMenu.transitionTimer == 0) { + if (--gMenu.transitionTimer == 0) { sub_080A3954(); } } From a633efd88ca533b8d601eb9a673c5eb7e68dd19d Mon Sep 17 00:00:00 2001 From: theo3 Date: Wed, 30 Mar 2022 00:52:53 -0700 Subject: [PATCH 2/2] sort out most of functions.h --- data/scripts/hyruleTown/script_Pita.inc | 2 +- include/asm.h | 12 ++ include/collision.h | 2 + include/enemy.h | 37 +++- include/entity.h | 1 + include/functions.h | 138 ------------- include/map.h | 2 + include/message.h | 2 + include/object.h | 16 +- include/physics.h | 23 +++ include/player.h | 62 ++++++ include/projectile.h | 3 +- include/room.h | 2 + src/code_08049DF4.c | 1 + src/createEnemy.c | 2 +- src/enemy/acroBandits.c | 19 +- src/enemy/bladeTrap.c | 2 +- src/enemy/bombarossa.c | 1 - src/enemy/enemy64.c | 3 +- src/enemy/helmasaur.c | 1 + src/enemy/keese.c | 3 +- src/enemy/lakitu.c | 3 +- src/enemy/lakituCloud.c | 4 +- src/enemy/leever.c | 2 +- src/enemy/likeLike.c | 1 - src/enemy/miniSlime.c | 2 +- src/enemy/mulldozer.c | 1 - src/enemy/octorok.c | 2 +- src/enemy/octorokGolden.c | 8 +- src/enemy/peahat.c | 3 +- src/enemy/pesto.c | 1 - src/enemy/puffstool.c | 1 - src/enemy/rockChuchu.c | 2 +- src/enemy/rollobite.c | 5 +- src/enemy/rope.c | 2 +- src/enemy/ropeGolden.c | 3 +- src/enemy/rupeeLike.c | 4 +- src/enemy/scissorsBeetle.c | 1 - src/enemy/sensorBladeTrap.c | 3 +- src/enemy/slime.c | 3 +- src/enemy/sluggula.c | 2 +- src/enemy/smallPesto.c | 2 +- src/enemy/spark.c | 1 - src/enemy/torchTrap.c | 4 +- src/enemy/treeItem.c | 1 - src/enemy/vaatiArm.c | 262 ++++++++++++------------ src/interrupts.c | 6 +- src/menu/figurine_menu.c | 1 + src/npc/bigGoron.c | 7 +- src/npc/cat.c | 1 + src/npc/forestMinish.c | 4 +- src/npc/mayorHagen.c | 1 - src/npc/melari.c | 1 - src/npc/minishEzlo.c | 2 +- src/npc/npc5.c | 1 + src/npc/phonograph.c | 1 + src/npc/pita.c | 4 +- src/object/bird.c | 10 +- src/object/book.c | 1 + src/object/fairy.c | 1 + src/object/fan.c | 1 + src/object/fourElements.c | 1 + src/object/heartContainer.c | 1 + src/object/itemOnGround.c | 1 + src/object/lightableSwitch.c | 11 +- src/object/macroShoes.c | 1 - src/object/object30.c | 1 + src/object/object96.c | 1 + src/object/object98.c | 1 + src/object/objectA8.c | 1 + src/object/objectB2.c | 1 + src/object/pressurePlate.c | 1 + src/object/treeHidingPortal.c | 11 +- src/object/windTribeTeleporter.c | 1 + src/playerItem/playerItemGustBig.c | 1 + src/playerUtils.c | 7 +- src/projectile/dekuSeedProjectile.c | 1 + src/projectile/guardLineOfSight.c | 1 + src/room.c | 4 +- src/roomInit.c | 4 +- src/text.c | 7 +- 81 files changed, 400 insertions(+), 357 deletions(-) diff --git a/data/scripts/hyruleTown/script_Pita.inc b/data/scripts/hyruleTown/script_Pita.inc index 4c554ae1..90603f57 100644 --- a/data/scripts/hyruleTown/script_Pita.inc +++ b/data/scripts/hyruleTown/script_Pita.inc @@ -18,7 +18,7 @@ script_080106BE: MessageNoOverlap 0x3c07 Jump script_08010726 script_080106E0: - Call sub_08062EB8 + Call RemoveAllBakedGoods CallWithArg sub_0807F78C, 0x00000000 WaitUntilTextboxCloses CheckTextboxResult diff --git a/include/asm.h b/include/asm.h index d501bbd7..34d77cc6 100644 --- a/include/asm.h +++ b/include/asm.h @@ -4,6 +4,7 @@ #include "global.h" extern u32 Random(void); +extern u32 GetRandomByWeight(const u8*); extern void CloneTile(u32, u32, u32); extern u32 GetTileTypeByEntity(struct Entity_*); extern u32 GetTileTypeByPos(s32 x, s32 y, u32 layer); @@ -34,5 +35,16 @@ extern u32 ResolveCollisionLayer(struct Entity_*); extern void sub_0800417E(struct Entity_*, u32); extern u32 sub_0800442E(struct Entity_*); extern u32 sub_08007DD6(u32, const u16*); +extern void SoundReqClipped(struct Entity_*, u32); +extern u32 sub_0800132C(struct Entity_*, struct Entity_*); +extern u32 sub_080B1B44(u32, u32); +extern u32 sub_080B1A48(u32, u32, u32); +extern u32 sub_080B1B18(s32, s32, u32); +extern u32 sub_080B1AE0(u16, u8); +extern u32 GetTileUnderEntity(struct Entity_*); +extern u32 sub_0800445C(struct Entity_*); +extern u32 sub_080B1AF0(struct Entity_*, s32, s32); +extern u32 GetRelativeCollisionTile(struct Entity_*, u32, u32); +extern bool32 sub_080B1B54(u32); #endif // ASM_H diff --git a/include/collision.h b/include/collision.h index d57258a6..4a591e6a 100644 --- a/include/collision.h +++ b/include/collision.h @@ -27,6 +27,8 @@ typedef enum { } Collisions; bool32 IsTileCollision(const u8*, s32, s32, u32); +bool32 IsColliding(Entity*, Entity*); +bool32 IsCollidingPlayer(Entity*); void CalculateEntityTileCollisions(Entity*, u32, u32); bool32 ProcessMovementInternal(Entity*, s32, s32, u32); diff --git a/include/enemy.h b/include/enemy.h index f2ffb760..1ff32c7b 100644 --- a/include/enemy.h +++ b/include/enemy.h @@ -13,19 +13,34 @@ #include "projectile.h" bool32 EnemyInit(Entity* this); -extern u32 GetNextFunction(Entity*); -extern void EnemyFunctionHandler(Entity*, EntityActionArray); -extern void GenericKnockback(Entity*); -extern Entity* CreateDeathFx(Entity*, u32, u32); +u32 GetNextFunction(Entity*); +void EnemyFunctionHandler(Entity*, EntityActionArray); +void EnemyFunctionHandlerAfterCollision(Entity*, void (*const[])()); +void GenericKnockback(Entity*); +Entity* CreateDeathFx(Entity*, u32, u32); +void sub_0804A720(Entity*); +bool32 sub_08049FDC(Entity*, u32); -extern Entity* Create0x68FX(Entity*, u32); -extern void SetChildOffset(Entity*, s32, s32, s32); -extern Entity* CreateProjectileWithParent(Entity*, u8, u8); +Entity* Create0x68FX(Entity*, u32); +void SetChildOffset(Entity*, s32, s32, s32); +Entity* CreateProjectileWithParent(Entity*, u8, u8); -extern void GenericDeath(Entity*); -extern void sub_08002724(void*, u8*); -extern void sub_080026C4(u8*, u8*, u8*, u32); -extern void sub_080026F2(u8*, void*, u8*, u32); +void GenericDeath(Entity*); +void sub_08002724(void*, u8*); +void sub_080026C4(u8*, u8*, u8*, u32); +void sub_080026F2(u8*, void*, u8*, u32); +bool32 sub_08049FA0(Entity*); +u32 sub_08049EE4(Entity*); +bool32 sub_08049F84(Entity*, s32); +Entity* sub_08049DF4(u32); +u32 sub_0804A044(Entity*, Entity*, u32); +s32 sub_080012DC(Entity*); +u32 sub_080044EC(Entity*, u32); +void sub_0804AA1C(Entity*); +bool32 sub_08049F1C(Entity*, Entity*, s32); +bool32 PlayerInRange(Entity*, u32, s32); +void sub_0804A4E4(Entity*, Entity*); +void GenericKnockback2(Entity*); typedef enum { /*0x00*/ OCTOROK, diff --git a/include/entity.h b/include/entity.h index a75ff456..618bb701 100644 --- a/include/entity.h +++ b/include/entity.h @@ -265,6 +265,7 @@ void SetExtraSpriteFrame(Entity*, u32, u32); void SetSpriteSubEntryOffsetData1(Entity*, u32, u32); void SetSpriteSubEntryOffsetData2(Entity*, u32, u32); u8* GetSpriteSubEntryOffsetDataPointer(u32, u32); +bool32 SetAffineInfo(Entity*, u32, u32, u32); /** * Return the direction pointing from one Entity to another. diff --git a/include/functions.h b/include/functions.h index db1b8baf..53f1821a 100644 --- a/include/functions.h +++ b/include/functions.h @@ -13,57 +13,28 @@ #include "map.h" // Identified - to be sorted into header files -extern void CalculateEntityTileCollisions(Entity*, u32, u32); -extern u32 CheckOnScreen(Entity*); extern u32 CheckRegionOnScreen(u32, u32, u32, u32); extern void CopyOAM(void); extern void CreateChestSpawner(Entity*); extern Entity* CreateGroundItem(Entity*, u32, u32); extern Entity* CreateGroundItemWithFlags(Entity*, u32, u32, u32); extern void CreateItemOnGround(Entity*); -extern Entity* CreateLargeWaterTrace(Entity*); extern void CreateMagicSparkles(u32, u32, u32); extern void CreateMinishEntrance(u32 tile); -extern Entity* CreatePlayerItemWithParent(ItemBehavior*, u32); extern u32 CreateRandomItemDrop(Entity*, u32); -extern void CreateSparkle(Entity*); -extern void DoPlayerAction(Entity*); extern void DrawDirect(u32, u32); extern void DrawEntities(void); extern void DrawUIElements(void); -extern void EnemyFunctionHandlerAfterCollision(Entity*, void (*const[])()); extern bool32 EntityWithinDistance(Entity*, s32, s32, s32); extern void FlushSprites(void); -extern void GenericKnockback2(Entity*); extern LayerStruct* GetLayerByIndex(u32); -extern u32 GetRandomByWeight(const u8*); extern u32 GetTileIndex(u32, u32); extern u32 GiveItem(u32, u32); -extern void HandlePlayerLife(Entity*); -extern bool32 HasSwordEquipped(); -extern bool32 IsColliding(Entity*, Entity*); -extern bool32 IsCollidingPlayer(Entity*); -extern bool32 IsProjectileOffScreen(Entity*); -extern bool32 IsTileCollision(const u8*, s32, s32, u32); -extern void LinearMoveAngle(Entity*, u32, u32); -extern void LinearMoveDirection(Entity*, u32, u32); extern bool32 LoadFixedGFX(Entity*, u32); extern void LoadResources(void); extern bool32 LoadSwapGFX(Entity*, u16, u32); extern void MenuFadeIn(u32, u32); -extern void ModBombs(s32); -extern bool32 PlayerInRange(Entity*, u32, s32); -extern bool32 ProcessMovement1(Entity*); -extern bool32 ProcessMovement12(Entity*); -extern bool32 ProcessMovement2(Entity*); -extern bool32 ProcessMovement3(Entity*); -extern bool32 ProcessMovement4(Entity*); -extern bool32 ProcessMovement5(Entity*); -extern bool32 ProcessMovement6(Entity*); -extern bool32 ProcessMovementInternal(Entity*, s32, s32, u32); extern void SetDirtTile(u32); -/** @see Item */ -extern void SetInventoryValue(u32, u32); /** * @brief Sets multiple tiles at once * @@ -72,26 +43,21 @@ extern void SetInventoryValue(u32, u32); * @param layer the tile layer */ extern void SetMultipleTiles(u16* tileData, u32 basePosition, u32 layer); -extern void SoundReqClipped(Entity*, u32); extern void TryLoadPrologueHyruleTown(void); extern void UnloadGFXSlots(Entity*); extern void UnloadOBJPalette(Entity*); extern void UpdateDisplayControls(void); -extern void UpdateItemAnim(ItemBehavior*); // Unidentified extern void sub_08000148(u32, u32, u32); extern u32 sub_080B1A0C(Entity*, s32, s32); extern u32 sub_080B1A48(u32, u32, u32); -extern u32 GetRelativeCollisionTile(Entity*, u32, u32); -extern u32 GetTileUnderEntity(Entity*); extern u32 sub_080B1AE0(u16, u8); extern u32 sub_080B1AF0(Entity*, s32, s32); extern u32 sub_080B1B18(s32, s32, u32); extern u32 sub_080B1B44(u32, u32); extern s32 sub_080012DC(Entity*); extern void sub_08001318(Entity*); -extern u32 sub_0800132C(Entity*, Entity*); extern void sub_080027EA(Entity*, u32, u32); extern void sub_080028E0(Entity*); extern u32 sub_080040A2(Entity*); @@ -110,40 +76,20 @@ extern void sub_08004542(Entity*); extern void sub_080085B0(Entity*); extern void sub_08008796(Entity*, u32, u32, u32); extern void sub_08016AD2(Entity*); -extern void sub_080171F0(void); extern u32 sub_0801766C(Entity*); -extern void sub_0801AF18(const u8*, u32, u32); extern void sub_0801AFE4(void); extern void UpdateUIElements(void); extern void sub_0801C25C(void); extern void sub_0801E104(void); extern void sub_08027870(Entity*); extern void sub_08030118(u32); -extern u32 sub_08031E04(Entity*); -extern void sub_08031E48(Entity*, Entity*); -extern void sub_08032290(Entity*); -extern u32 sub_080322A4(Entity*); -extern void sub_080322E8(Entity*); -extern void sub_08032338(Entity*); extern void sub_0803C0AC(Entity*); extern void sub_08049CF4(Entity*); -extern Entity* sub_08049DF4(u32); -extern u32 sub_08049EE4(Entity*); -extern bool32 sub_08049F1C(Entity*, Entity*, s32); -extern bool32 sub_08049F84(Entity*, s32); -extern bool32 sub_08049FA0(Entity*); -extern bool32 sub_08049FDC(Entity*, u32); extern u32 sub_0804A024(Entity*, u32, u32); -extern u32 sub_0804A044(Entity*, Entity*, u32); -extern void sub_0804A4E4(Entity*, Entity*); -extern void sub_0804A720(Entity*); -extern void sub_0804AA1C(Entity*); -extern void sub_0804C128(void); extern u32 sub_080542AC(u32); extern void sub_08054564(); extern void sub_08054570(void); extern s32 sub_08056338(void); -extern void sub_08057044(u32, struct_020227E8*, u32); extern void sub_080575C8(u32); extern void sub_08057688(void); extern void sub_080580B0(u32); @@ -152,80 +98,11 @@ extern void sub_08059278(void); extern void sub_0805B4D0(u32); extern void sub_0805BC4C(void); extern void sub_0805EC60(Entity*); -extern void SetAffineInfo(Entity*, u32, u32, u32); extern void InitPlayerMacro(u32*); extern u32* sub_0805F25C(u32); -extern u32 sub_0805F7A0(u32); extern void sub_0805F8E4(u32 r0, WStruct* r1); -extern u32 sub_0805F8F8(u32); -extern void sub_080600F0(Entity*); extern void sub_08060158(Entity*); -extern void sub_0806D02C(Entity*); extern void sub_0806D0B0(Entity*); -extern void sub_0806F4E8(Entity*); -extern bool32 sub_0806F520(Entity*); -extern u32 sub_0806F5B0(u32); -extern u32 sub_0806F824(Entity*, Entity*, s32, s32); -extern u32 sub_0806F948(Entity*); -extern void sub_0806FBB4(Entity*); -extern bool32 sub_0806FC80(Entity*, Entity*, s32); -extern void sub_0806FCF4(Entity*, s32, s32, s32); -extern void sub_0806FD3C(Entity*); -extern bool32 sub_0806FDA0(Entity*); -extern void sub_0806FEBC(Entity*, u32, Entity*); -extern void sub_080751E8(u32, u32, void*); -extern void sub_08077B98(ItemBehavior*); -extern void sub_08077BB8(ItemBehavior*); -extern Entity* sub_08077C0C(ItemBehavior*, u32); -extern Entity* sub_08077C94(ItemBehavior*, u32); -extern void sub_08077D38(ItemBehavior*, u32); -extern void sub_08077DF4(ItemBehavior*, u32); -extern void sub_08077E3C(ItemBehavior*, u32); -extern void sub_08077E54(ItemBehavior*); -extern void DeletePlayerItem(ItemBehavior*, u32); -extern bool32 sub_08077EC8(ItemBehavior*); -extern bool32 sub_08077EFC(ItemBehavior*); -extern bool32 sub_08077F10(ItemBehavior*); -extern bool32 sub_08077F24(ItemBehavior*, u32); -extern void PlayerCancelHoldItem(ItemBehavior*, u32); -extern bool32 sub_08077FEC(u32); -extern void sub_08078180(void); -extern void sub_080784C8(); -extern void sub_08078790(Entity*, u32); -extern void sub_080787CC(Entity*); -extern s32 sub_08078800(Entity*); -extern void sub_08078850(Entity*, u32, u32, void*); -extern s32 sub_0807887C(Entity*, u32, u32); -extern void sub_080788E0(Entity*); -extern s32 sub_08078904(); -extern void RegisterCarryEntity(Entity*); -extern void FreeCarryEntity(Entity*); -extern void sub_08078AC0(u32, u32, u32); -extern void sub_08078B48(void); -extern void sub_08078E84(Entity*, Entity*); -extern void sub_08078FB0(Entity*); -extern void PlayerDropHeldObject(); -extern void PlayerResetStateFromFusion(); -extern void sub_080792BC(s32, u32, u32); -extern u32 sub_0807953C(void); -extern void sub_08079BD8(Entity*); -extern u32 sub_08079D48(); -extern void sub_08079D84(void); -extern bool32 PlayerCanBeMoved(void); -extern u32 sub_08079FC4(u32); -extern void sub_0807A050(void); -extern void sub_0807A5B8(u32); -extern void sub_0807A8D8(Entity*); -extern void sub_0807AA80(Entity*); -extern void sub_0807AABC(Entity*); -extern void sub_0807ACCC(Entity*); -extern u32 sub_0807B014(); -extern void sub_0807B0C8(void); -extern void sub_0807B7D8(u32, u32, u32); -extern void sub_0807B9B8(u32, u32, u32); -extern void RestorePrevTileEntity(u32, u32); -extern void sub_0807BB68(s16*, u32, u32); -extern bool32 sub_0807BD14(Entity*, u32); extern bool32 sub_080806BC(u32, u32, u32, u32); extern void sub_0808091C(const ScreenTransitionData*, u32); extern void sub_080809D4(void); @@ -233,23 +110,8 @@ extern void sub_08080CB4(Entity*); extern u32 sub_0808288C(Entity*, u32, u32, u32); extern bool32 sub_08083734(Entity*, u32); extern void sub_08095C48(Entity*); -extern void sub_0809E918(Entity*); -extern void sub_0809E96C(Entity*); -extern u32 sub_0809E9A0(void); -extern void sub_0809EABC(Entity*); -extern void sub_0809EAD8(Entity*); -extern void sub_0809EB30(Entity*); -extern void sub_080A1ED0(u32, u32, u32); -extern Entity* sub_080A2A3C(Entity*, u32, u32, u32); -extern Entity* sub_080A2AD4(Entity*); -extern void sub_080A2AF4(Entity*, s32, s32); -extern void UpdateRailMovement(Entity*, u16**, u16*); extern void sub_080A57F4(void); extern void sub_080A71C4(u32, u32, u32, u32); -extern void InitItemGetSequence(u32, u32, u32); extern void sub_080ADD70(void); -extern bool32 sub_080AE4CC(Entity*, u32, u32, u32); -extern void sub_080AE58C(Entity*, u32, u32); extern void sub_080AF284(void); -extern bool32 sub_080B1B54(u32); #endif diff --git a/include/map.h b/include/map.h index 52263a5b..8c8adb46 100644 --- a/include/map.h +++ b/include/map.h @@ -17,4 +17,6 @@ typedef struct { extern LayerStruct gMapTop; extern LayerStruct gMapBottom; +LayerStruct* GetLayerByIndex(u32); + #endif // MAP_H \ No newline at end of file diff --git a/include/message.h b/include/message.h index 4a450767..7f02d61c 100644 --- a/include/message.h +++ b/include/message.h @@ -136,4 +136,6 @@ void MessageClose(void); void DispMessageFrame(u16*, s32, s32, u32); +void sub_08057044(u32, struct_020227E8*, u32); + #endif // MESSAGE_H diff --git a/include/object.h b/include/object.h index d2c17e5a..a4aa6e44 100644 --- a/include/object.h +++ b/include/object.h @@ -14,12 +14,16 @@ #include "entity.h" #include "player.h" -extern void sub_080787C0(Entity*); -extern void sub_080787B4(Entity*); -extern void sub_0808C650(Entity*, u32); -extern u32 sub_0808C67C(void); -extern void sub_0808C688(void); -extern void SyncPlayerToPlatform(Entity*, bool32); +void sub_080787C0(Entity*); +void sub_080787B4(Entity*); +void sub_0808C650(Entity*, u32); +u32 sub_0808C67C(void); +void sub_0808C688(void); +void SyncPlayerToPlatform(Entity*, bool32); +void UpdateRailMovement(Entity*, u16**, u16*); +void sub_080A2AF4(Entity*, s32, s32); +Entity* CreateLargeWaterTrace(Entity*); +void CreateSparkle(Entity*); void CreateDust(Entity* parent); void CreateDustAt(s32, s32, u32); diff --git a/include/physics.h b/include/physics.h index 2c243c35..0046fbd5 100644 --- a/include/physics.h +++ b/include/physics.h @@ -18,6 +18,10 @@ void sub_0806FA90(Entity*, Entity*, s32, s32); void SortEntityAbove(Entity* below_ent, Entity* above_ent); void SortEntityBelow(Entity* above_ent, Entity* below_ent); +void LinearMoveDirection(Entity* ent, u32 a, u32 b); +void LinearMoveAngle(Entity* ent, u32 a, u32 b); + +bool32 EntityWithinDistance(Entity*, s32, s32, s32); u32 sub_0806FCA0(Entity*, Entity*); u32 sub_0806F58C(Entity*, Entity*); u32 PointInsideRadius(s32 x, s32 y, s32 radius); @@ -28,6 +32,25 @@ bool32 sub_0806FD54(Entity*); u32 sub_0806FCAC(Entity*, Entity*); u32 sub_0806F854(Entity*, s32, s32); u32 sub_0806F730(Entity*); +bool32 sub_0806F520(Entity*); +void sub_0806F4E8(Entity*); +bool32 sub_0806FC80(Entity*, Entity*, s32); +u32 sub_0806F5B0(u32); +u32 sub_0806F824(Entity*, Entity*, s32, s32); +u32 sub_0806F948(Entity*); +void sub_0806FBB4(Entity*); +void sub_0806FCF4(Entity*, s32, s32, s32); +void sub_0806FD3C(Entity*); +bool32 sub_0806FDA0(Entity*); +void sub_0806FEBC(Entity*, u32, Entity*); +extern bool32 ProcessMovement1(Entity*); +extern bool32 ProcessMovement12(Entity*); +extern bool32 ProcessMovement2(Entity*); +extern bool32 ProcessMovement3(Entity*); +extern bool32 ProcessMovement4(Entity*); +extern bool32 ProcessMovement5(Entity*); +extern bool32 ProcessMovement6(Entity*); +extern bool32 ProcessMovementInternal(Entity*, s32, s32, u32); extern const s16 gSineTable[64]; extern const s16 gCosineTable[256]; diff --git a/include/player.h b/include/player.h index 90d4f9a9..5a914e87 100644 --- a/include/player.h +++ b/include/player.h @@ -337,8 +337,11 @@ void CreateEzloHint(u32, u32); u32 IsItemEquipped(u32); /** @see Item */ u32 GetInventoryValue(u32); +/** @see Item */ +void SetInventoryValue(u32, u32); s32 ModHealth(s32 delta); void ModRupees(s32 delta); +void ModBombs(s32 delta); // playerUtils.c void DeleteClones(void); @@ -375,6 +378,65 @@ u32 sub_08078F74(Entity*); void sub_0807879C(Entity*); void PlayerSetNormalAndCollide(void); bool32 PlayerTryDropObject(ItemBehavior* arg0, u32 unk); +void InitItemGetSequence(u32, u32, u32); +void sub_0807B7D8(u32, u32, u32); +void sub_08078850(Entity*, u32, u32, void*); +void sub_08079D84(void); +u32 sub_0807953C(void); +void sub_0807BB68(s16*, u32, u32); +void sub_0807B9B8(u32, u32, u32); +void sub_0807B7D8(u32, u32, u32); +void RestorePrevTileEntity(u32, u32); +void UpdateItemAnim(ItemBehavior*); +void PlayerCancelHoldItem(ItemBehavior*, u32); +void RegisterCarryEntity(Entity*); +void FreeCarryEntity(Entity*); +void PlayerDropHeldObject(); +void PlayerResetStateFromFusion(); +void DeletePlayerItem(ItemBehavior*, u32); +void sub_08077D38(ItemBehavior*, u32); +void sub_08077DF4(ItemBehavior*, u32); +void sub_08077E3C(ItemBehavior*, u32); +void sub_080751E8(u32, u32, void*); +void sub_08077B98(ItemBehavior*); +void sub_08077BB8(ItemBehavior*); +Entity* sub_08077C0C(ItemBehavior*, u32); +Entity* sub_08077C94(ItemBehavior*, u32); +bool32 PlayerCanBeMoved(void); +bool32 sub_08077EC8(ItemBehavior*); +bool32 sub_08077EFC(ItemBehavior*); +bool32 sub_08077F10(ItemBehavior*); +bool32 sub_08077F24(ItemBehavior*, u32); +bool32 sub_08077FEC(u32); +void sub_08078180(void); +void sub_080784C8(); +void sub_08078790(Entity*, u32); +void sub_080787CC(Entity*); +s32 sub_08078800(Entity*); +s32 sub_0807887C(Entity*, u32, u32); +void sub_080788E0(Entity*); +s32 sub_08078904(); +void sub_08078AC0(u32, u32, u32); +void sub_08078B48(void); +void sub_08078E84(Entity*, Entity*); +void sub_08078FB0(Entity*); +void sub_080792BC(s32, u32, u32); +u32 sub_0807953C(void); +void sub_08079BD8(Entity*); +u32 sub_08079D48(); +void sub_08079D84(void); +u32 sub_08079FC4(u32); +void sub_0807A050(void); +void sub_0807A5B8(u32); +void sub_0807A8D8(Entity*); +void sub_0807AA80(Entity*); +void sub_0807AABC(Entity*); +void sub_0807ACCC(Entity*); +u32 sub_0807B014(); +void sub_0807B0C8(void); +bool32 sub_0807BD14(Entity*, u32); +Entity* CreatePlayerItemWithParent(ItemBehavior*, u32); +bool32 HasSwordEquipped(); // player.s extern u32 PlayerCheckNEastTile(); diff --git a/include/projectile.h b/include/projectile.h index 74b3580a..dd73d433 100644 --- a/include/projectile.h +++ b/include/projectile.h @@ -1,7 +1,8 @@ #ifndef PROJECTILE_H #define PROJECTILE_H -extern Entity* CreateProjectile(u32); +Entity* CreateProjectile(u32); +bool32 IsProjectileOffScreen(Entity*); void DarkNutSwordSlash(Entity*); void RockProjectile(Entity*); diff --git a/include/room.h b/include/room.h index 33f95d68..5cd1c1d6 100644 --- a/include/room.h +++ b/include/room.h @@ -225,6 +225,8 @@ void* GetCurrentRoomProperty(u32); void LoadRoomTileEntities(); void LoadRoomEntityList(EntityData* listPtr); +bool32 LoadFixedGFX(Entity*, u32); +void UnloadGFXSlots(Entity*); void sub_0804B3C4(void*); void sub_0804B0B0(u32 arg0, u32 arg1); diff --git a/src/code_08049DF4.c b/src/code_08049DF4.c index 06b77524..91029146 100644 --- a/src/code_08049DF4.c +++ b/src/code_08049DF4.c @@ -6,6 +6,7 @@ #include "map.h" #include "player.h" #include "room.h" +#include "enemy.h" extern Entity* gUnk_020000B0; extern Entity* (*const gUnk_080D3BE8[])(void); diff --git a/src/createEnemy.c b/src/createEnemy.c index 36c4d4d4..6c97985c 100644 --- a/src/createEnemy.c +++ b/src/createEnemy.c @@ -1,7 +1,7 @@ #include "enemy.h" /** Unsets bitfield 0x80 before calling GetNextFunction, so that the enemyFunction 1 is not called. */ -void EnemyFunctionHandlerAfterCollision(Entity* entity, void (*fntable[])()) { +void EnemyFunctionHandlerAfterCollision(Entity* entity, void (*const fntable[])()) { u32 idx; entity->contactFlags &= ~0x80; idx = GetNextFunction(entity); diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 0fd0c667..3adbbea4 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -11,6 +11,13 @@ extern Entity* gUnk_020000B0; extern void (*const gUnk_080012C8[])(Entity*); +static void sub_08031E48(Entity* this, Entity* child); +static void sub_08032290(Entity* this); +static bool32 sub_080322A4(Entity* this); +static void sub_08032338(Entity* this); +static void sub_080322E8(Entity* this); +static bool32 sub_08031E04(Entity* this); + void AcroBandit_OnTick(Entity* this); void AcroBandit_OnCollision(Entity* this); void AcroBandit_OnKnockback(Entity* this); @@ -319,7 +326,7 @@ void AcroBandit_Type0Action8(Entity* this) { } } -bool32 sub_08031E04(Entity* this) { +static bool32 sub_08031E04(Entity* this) { static const s8 gUnk_080CE5C0[] = { -32, 0, 0, 32, 32, 0, 0, 0 }; Entity* ent; const s8* tmp; @@ -332,7 +339,7 @@ bool32 sub_08031E04(Entity* this) { return EntityWithinDistance(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50); } -void sub_08031E48(Entity* this, Entity* child) { +static void sub_08031E48(Entity* this, Entity* child) { CopyPosition(this, child); child->field_0x6c.HALF.LO = this->field_0x6c.HALF.LO; child->field_0x70.HALF.LO = this->field_0x70.HALF.LO; @@ -534,13 +541,13 @@ void AcroBandit_Type1Action9(Entity* this) { } } -void sub_08032290(Entity* this) { +static void sub_08032290(Entity* this) { this->action = 6; this->timer = 12; InitializeAnimation(this, 11); } -bool32 sub_080322A4(Entity* this) { +static bool32 sub_080322A4(Entity* this) { if (this->child != NULL && (this->child->z.HALF.HI + 8) >= this->z.HALF.HI) { if (this->z.HALF.HI) { this->action = 5; @@ -555,7 +562,7 @@ bool32 sub_080322A4(Entity* this) { return FALSE; } -void sub_080322E8(Entity* this) { +static void sub_080322E8(Entity* this) { if (this->field_0x78.HALF.LO) { if (--this->field_0x78.HALF.LO == 0) { u32 flipX = this->spriteSettings.flipX; @@ -573,7 +580,7 @@ void sub_080322E8(Entity* this) { } } -void sub_08032338(Entity* this) { +static void sub_08032338(Entity* this) { if ((((Entity*)this->field_0x7c.WORD)->timer += 15) != 80) this->field_0x6c.HALF.LO = 0; } diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index 5a44b954..86fe70d0 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -8,7 +8,7 @@ #include "sound.h" #include "entity.h" #include "room.h" -#include "functions.h" +#include "object.h" void BladeTrap(Entity* this) { if (this->action == 0) { diff --git a/src/enemy/bombarossa.c b/src/enemy/bombarossa.c index aec4f188..fb2c8f31 100644 --- a/src/enemy/bombarossa.c +++ b/src/enemy/bombarossa.c @@ -3,7 +3,6 @@ #include "enemy.h" #include "room.h" #include "object.h" -#include "functions.h" typedef struct { Entity base; diff --git a/src/enemy/enemy64.c b/src/enemy/enemy64.c index 007d7a32..529bce1e 100644 --- a/src/enemy/enemy64.c +++ b/src/enemy/enemy64.c @@ -447,7 +447,8 @@ void sub_08049998(Enemy64Entity* this, u32 param_2) { void sub_080499F0(Enemy64Entity* this) { u32 tmp; - if ((((super->action != 0) && (gPlayerEntity.z.HALF.HI == 0)) && (PlayerCanBeMoved())) && ((this->unk_7c & 1) == 0)) { + if ((((super->action != 0) && (gPlayerEntity.z.HALF.HI == 0)) && (PlayerCanBeMoved())) && + ((this->unk_7c & 1) == 0)) { if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24) && ((this->unk_7c & 2) == 0)) { tmp = sub_080045DA((s32)gPlayerEntity.x.HALF.HI - super->x.HALF.HI, diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 609a4b07..bce46d65 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -8,6 +8,7 @@ #include "enemy.h" #include "object.h" #include "functions.h" +#include "collision.h" extern u32 sub_0804A024(Entity*, u32, u32); diff --git a/src/enemy/keese.c b/src/enemy/keese.c index 424432a5..a493142b 100644 --- a/src/enemy/keese.c +++ b/src/enemy/keese.c @@ -6,7 +6,8 @@ */ #include "enemy.h" -#include "functions.h" +#include "physics.h" +#include "player.h" extern void GenericKnockback2(Entity*); extern void Keese_StartFly(Entity*); diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index a4c2e6a0..784c21a5 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -7,7 +7,8 @@ #include "global.h" #include "enemy.h" -#include "functions.h" +#include "physics.h" +#include "player.h" extern void (*const LakituActionFuncs[])(Entity*); diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 26eb535b..6e2c7091 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -9,9 +9,11 @@ #include "asm.h" #include "entity.h" #include "player.h" -#include "functions.h" #include "effects.h" #include "enemy.h" +#include "physics.h" +#include "room.h" +#include "object.h" extern void (*const LakituCloud_Functions[6])(Entity*); extern void (*const gUnk_080D0430[3])(Entity*); diff --git a/src/enemy/leever.c b/src/enemy/leever.c index fe7095da..fd041835 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -6,7 +6,7 @@ */ #include "enemy.h" -#include "functions.h" +#include "physics.h" extern u32 sub_080B1B18(s32, s32, u32); extern u32 sub_080B1AB4(s32, s32, u32); diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index bca36368..0e7abeb9 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -9,7 +9,6 @@ #include "message.h" #include "save.h" #include "object.h" -#include "functions.h" #include "item.h" extern bool32 ItemIsShield(u32); diff --git a/src/enemy/miniSlime.c b/src/enemy/miniSlime.c index 80e0666e..2231c83e 100644 --- a/src/enemy/miniSlime.c +++ b/src/enemy/miniSlime.c @@ -6,7 +6,7 @@ */ #include "enemy.h" -#include "functions.h" +#include "physics.h" void sub_08045374(Entity*); diff --git a/src/enemy/mulldozer.c b/src/enemy/mulldozer.c index adaa991a..89e0a002 100644 --- a/src/enemy/mulldozer.c +++ b/src/enemy/mulldozer.c @@ -9,7 +9,6 @@ #include "global.h" #include "collision.h" #include "enemy.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c index e36bc8af..267b0acf 100644 --- a/src/enemy/octorok.c +++ b/src/enemy/octorok.c @@ -6,7 +6,7 @@ */ #include "enemy.h" -#include "functions.h" +#include "physics.h" void Octorok_Pause(Entity*); bool32 Octorok_FacesPlayer(Entity*); diff --git a/src/enemy/octorokGolden.c b/src/enemy/octorokGolden.c index c630053d..7af19a82 100644 --- a/src/enemy/octorokGolden.c +++ b/src/enemy/octorokGolden.c @@ -1,6 +1,7 @@ -#include "entity.h" +#include "collision.h" +#include "map.h" #include "enemy.h" -#include "functions.h" +#include "player.h" void (*const OctorokGolden_Functions[])(Entity*); void (*const gUnk_080CF484[])(Entity*); @@ -10,6 +11,7 @@ const u8 gUnk_080CF498[]; void sub_08037E14(Entity* this); bool32 sub_08037E90(Entity* this); +static void sub_08037D54(Entity* this); void OctorokGolden(Entity* this) { u32 index; @@ -68,7 +70,7 @@ void sub_08037D0C(Entity* this) { } } -void sub_08037D54(Entity* this) { +static void sub_08037D54(Entity* this) { UpdateAnimationVariableFrames(this, 2); if (this->frame & 0x1) { diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index 9b2c8787..2af3a5ff 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -6,7 +6,8 @@ */ #include "enemy.h" -#include "functions.h" +#include "room.h" +#include "physics.h" extern void (*const Peahat_Functions[])(Entity*); extern void (*const gPeahatPropellerFunctions[])(Entity*); diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 4da32bcb..05920fac 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -9,7 +9,6 @@ #include "collision.h" #include "object.h" #include "game.h" -#include "functions.h" #include "save.h" #include "playeritem.h" diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index aac1c3e7..f07f5bc0 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -8,7 +8,6 @@ #include "enemy.h" #include "collision.h" #include "object.h" -#include "functions.h" extern u8 gUnk_080B37A0[]; extern u8 gUnk_080B3E80[]; diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c index 89f62eb5..893ec8b6 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -6,7 +6,7 @@ */ #include "enemy.h" -#include "functions.h" +#include "player.h" extern void (*const RockChuchu_Functions[])(Entity*); extern void (*const gUnk_080CB960[])(Entity*); diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index 3308f3b6..a8fd55e8 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -6,7 +6,10 @@ */ #include "enemy.h" -#include "functions.h" +#include "physics.h" +#include "player.h" +#include "room.h" +#include "collision.h" extern void (*const Rollobite_Functions[])(Entity*); extern void (*const gRollobiteActions[])(Entity*); diff --git a/src/enemy/rope.c b/src/enemy/rope.c index c62edf1e..c21b7540 100644 --- a/src/enemy/rope.c +++ b/src/enemy/rope.c @@ -6,7 +6,7 @@ */ #include "enemy.h" -#include "functions.h" +#include "physics.h" extern void (*const Rope_Functions[6])(Entity*); extern void (*const gUnk_080CE460[4])(Entity*); diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c index 5bb3796b..757f5438 100644 --- a/src/enemy/ropeGolden.c +++ b/src/enemy/ropeGolden.c @@ -7,8 +7,9 @@ #include "global.h" #include "entity.h" -#include "functions.h" #include "enemy.h" +#include "physics.h" +#include "player.h" extern void (*const gUnk_080012C8[])(Entity*); extern void (*const RopeGolden_Functions[6])(Entity*); diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 9a9fc7cd..3209e1c4 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -6,14 +6,12 @@ */ #include "global.h" -#include "asm.h" -#include "sound.h" #include "entity.h" #include "enemy.h" #include "object.h" -#include "functions.h" #include "save.h" #include "hitbox.h" +#include "room.h" extern void sub_080293DC(Entity*); extern void sub_080296D8(Entity*); diff --git a/src/enemy/scissorsBeetle.c b/src/enemy/scissorsBeetle.c index b4be1979..34ebb195 100644 --- a/src/enemy/scissorsBeetle.c +++ b/src/enemy/scissorsBeetle.c @@ -2,7 +2,6 @@ #include "collision.h" #include "entity.h" #include "enemy.h" -#include "functions.h" typedef struct { Entity base; diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c index 7ca53a62..3736305c 100644 --- a/src/enemy/sensorBladeTrap.c +++ b/src/enemy/sensorBladeTrap.c @@ -6,7 +6,8 @@ */ #include "enemy.h" -#include "functions.h" +#include "physics.h" +#include "collision.h" extern u32 sub_0804A024(Entity*, u32, u32); diff --git a/src/enemy/slime.c b/src/enemy/slime.c index 70f43914..57301468 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -6,7 +6,8 @@ */ #include "enemy.h" -#include "functions.h" +#include "physics.h" +#include "room.h" typedef struct { s8 h, v; diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c index 5dc003ef..9648e71a 100644 --- a/src/enemy/sluggula.c +++ b/src/enemy/sluggula.c @@ -6,7 +6,7 @@ */ #include "enemy.h" -#include "functions.h" +#include "physics.h" void sub_08023E10(Entity*); void sub_08023E54(Entity*); diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index a5d7b38f..9f1eaebd 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -6,7 +6,7 @@ */ #include "enemy.h" -#include "functions.h" +#include "physics.h" extern void sub_080317F8(Entity*); diff --git a/src/enemy/spark.c b/src/enemy/spark.c index 6326654d..8eaeac39 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -8,7 +8,6 @@ #include "collision.h" #include "enemy.h" #include "object.h" -#include "functions.h" extern void (*const Spark_Functions[])(Entity*); extern void (*const gUnk_080CD24C[])(Entity*); diff --git a/src/enemy/torchTrap.c b/src/enemy/torchTrap.c index 527a87b7..dc3c07cf 100644 --- a/src/enemy/torchTrap.c +++ b/src/enemy/torchTrap.c @@ -1,7 +1,9 @@ #define NENT_DEPRECATED #include "entity.h" #include "enemy.h" -#include "functions.h" +#include "room.h" +#include "physics.h" +#include "player.h" typedef struct { Entity base; diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c index 00005671..95ed60f7 100644 --- a/src/enemy/treeItem.c +++ b/src/enemy/treeItem.c @@ -12,7 +12,6 @@ static bool32 ShouldSpawnTreeItem(Entity*); -extern u32 GetRandomByWeight(const u8*); extern void sub_08049CF4(Entity*); const u8 gTreeItemDropTables[][16] = { diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index e032cdaa..1512c92f 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -29,71 +29,72 @@ typedef struct VaatiArm_HeapStruct { VaatiArm_HeapStruct1 s1[5]; } VaatiArm_HeapStruct; -u32 sub_080437DC(Entity*); -u32 sub_08043C98(Entity*); -void VaatiArm_OnTick(Entity*); -void VaatiArm_OnCollision(Entity*); -void sub_080425B4(Entity*); -void sub_08042818(Entity*); -void sub_08042870(Entity*); -void sub_08042A3C(Entity*); -void sub_08042C14(Entity*); -void sub_0804325C(Entity*); -void sub_08043420(Entity*); -void sub_08043680(Entity*); -void VaatiArm_OnGrabbed(Entity*); -void sub_08042654(Entity*); -void sub_0804259C(Entity*); -void sub_08043A10(Entity*); -void sub_08043ABC(Entity*); -void sub_08043BC8(Entity*); -void sub_08043EB8(Entity*); -void sub_08044000(Entity*); -void sub_08044078(Entity*); -void sub_080440CC(Entity*); -void sub_08043CD4(Entity*); -void sub_08042894(Entity*); -void sub_080428AC(Entity*); -void sub_080428FC(Entity*); -void sub_08042944(Entity*); -void sub_08042970(Entity*); -void sub_080429D4(Entity*); -void sub_080429FC(Entity*); -void sub_08043BF0(Entity*); -void sub_08042A6C(Entity*); -void sub_08042A88(Entity*); -void sub_08042AEC(Entity*); -void sub_08042B20(Entity*); -void sub_08043C40(Entity*, VaatiArm_HeapStruct1*); -void sub_08043A78(Entity*); -void sub_08042C34(Entity*); -void sub_08042D24(Entity*); -void sub_08042D6C(Entity*); -void sub_08042E30(Entity*); -void sub_08042EF4(Entity*); -void sub_08042FD8(Entity*); -void sub_08043048(Entity*); -void sub_080430D0(Entity*); -void sub_08043130(Entity*); -void sub_080431E8(Entity*); -void sub_08043B9C(Entity*); +static u32 sub_080437DC(Entity*); +static u32 sub_08043C98(Entity*); +static void VaatiArm_OnTick(Entity*); +static void VaatiArm_OnCollision(Entity*); +static void sub_080425B4(Entity*); +static void sub_08042818(Entity*); +static void sub_08042870(Entity*); +static void sub_08042A3C(Entity*); +static void sub_08042C14(Entity*); +static void sub_0804325C(Entity*); +static void sub_08043420(Entity*); +static void sub_08043680(Entity*); +static void VaatiArm_OnGrabbed(Entity*); +static void sub_08042654(Entity*); +static void sub_0804259C(Entity*); +static void sub_08043A10(Entity*); +static void sub_08043ABC(Entity*); +static void sub_08043BC8(Entity*); +static void sub_08043EB8(Entity*); +static void sub_08044000(Entity*); +static void sub_08044078(Entity*); +static void sub_080440CC(Entity*); +static void sub_08043CD4(Entity*); +static void sub_08042894(Entity*); +static void sub_080428AC(Entity*); +static void sub_080428FC(Entity*); +static void sub_08042944(Entity*); +static void sub_08042970(Entity*); +static void sub_080429D4(Entity*); +static void sub_080429FC(Entity*); +static void sub_08043BF0(Entity*); +static void sub_08042A6C(Entity*); +static void sub_08042A88(Entity*); +static void sub_08042AEC(Entity*); +static void sub_08042B20(Entity*); +static void sub_08043C40(Entity*, VaatiArm_HeapStruct1*); +static void sub_08043A78(Entity*); +static void sub_08042C34(Entity*); +static void sub_08042D24(Entity*); +static void sub_08042D6C(Entity*); +static void sub_08042E30(Entity*); +static void sub_08042EF4(Entity*); +static void sub_08042FD8(Entity*); +static void sub_08043048(Entity*); +static void sub_080430D0(Entity*); +static void sub_08043130(Entity*); +static void sub_080431E8(Entity*); +static void sub_08043B9C(Entity*); +static void sub_08043DB0(Entity*); +static void sub_08043B7C(Entity*); +static void sub_08043D08(Entity*); +static void sub_080432A8(Entity*); +static void sub_0804334C(Entity*); +static void sub_08043440(Entity*); +static void sub_08043490(Entity*); +static void sub_08043520(Entity*); +static void sub_0804355C(Entity*); +static void sub_08043580(Entity*); +static void sub_080435F4(Entity*); +static void sub_08043698(Entity*); +static void sub_080436C0(Entity*); +static void sub_08043700(Entity*); +static void sub_08043738(Entity*); +static void sub_08043770(Entity*); + void sub_0804AA1C(Entity*); -void sub_08043DB0(Entity*); -void sub_08043B7C(Entity*); -void sub_08043D08(Entity*); -void sub_080432A8(Entity*); -void sub_0804334C(Entity*); -void sub_08043440(Entity*); -void sub_08043490(Entity*); -void sub_08043520(Entity*); -void sub_0804355C(Entity*); -void sub_08043580(Entity*); -void sub_080435F4(Entity*); -void sub_08043698(Entity*); -void sub_080436C0(Entity*); -void sub_08043700(Entity*); -void sub_08043738(Entity*); -void sub_08043770(Entity*); void (*const VaatiArm_Functions[])(Entity*) = { VaatiArm_OnTick, VaatiArm_OnCollision, GenericKnockback, GenericDeath, GenericConfused, VaatiArm_OnGrabbed, @@ -175,22 +176,22 @@ void VaatiArm(Entity* this) { VaatiArm_Functions[GetNextFunction(this)](this); } -void VaatiArm_OnTick(Entity* this) { +static void VaatiArm_OnTick(Entity* this) { gUnk_080D1248[this->type](this); } -void VaatiArm_OnCollision(Entity* this) { +static void VaatiArm_OnCollision(Entity* this) { EnemyFunctionHandlerAfterCollision(this, VaatiArm_Functions); } -void VaatiArm_OnGrabbed(Entity* this) { +static void VaatiArm_OnGrabbed(Entity* this) { } -void sub_0804259C(Entity* this) { +static void sub_0804259C(Entity* this) { gUnk_080D125C[this->action](this); } -void sub_080425B4(Entity* this) { +static void sub_080425B4(Entity* this) { if (sub_080437DC(this)) { this->field_0x7c.BYTES.byte0 = 0; this->field_0x7c.BYTES.byte1 = 0; @@ -219,7 +220,7 @@ void sub_080425B4(Entity* this) { } } -void sub_08042654(Entity* this) { +static void sub_08042654(Entity* this) { u32 uVar8; int index; VaatiArm_HeapStruct1* ptr; @@ -289,7 +290,7 @@ void sub_08042654(Entity* this) { sub_08043A10(this); } -void sub_08042818(Entity* this) { +static void sub_08042818(Entity* this) { VaatiArm_HeapStruct1* ptr; sub_08043CD4(this); @@ -307,18 +308,18 @@ void sub_08042818(Entity* this) { sub_08043A10(this); } -void sub_08042870(Entity* this) { +static void sub_08042870(Entity* this) { sub_08043CD4(this); gUnk_080D1290[this->subAction](this); sub_08043A10(this); } -void sub_08042894(Entity* this) { +static void sub_08042894(Entity* this) { this->subAction = 1; ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk08 = gUnk_080D12AC[this->type2]; } -void sub_080428AC(Entity* this) { +static void sub_080428AC(Entity* this) { u8 bVar1; VaatiArm_HeapStruct1* pVVar3; @@ -340,7 +341,7 @@ void sub_080428AC(Entity* this) { sub_08043BF0(this); } -void sub_080428FC(Entity* this) { +static void sub_080428FC(Entity* this) { u32 uVar2; VaatiArm_HeapStruct1* ptr; @@ -357,7 +358,7 @@ void sub_080428FC(Entity* this) { } } -void sub_08042944(Entity* this) { +static void sub_08042944(Entity* this) { VaatiArm_HeapStruct1* pVVar1; pVVar1 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; @@ -370,7 +371,7 @@ void sub_08042944(Entity* this) { sub_08043BF0(this); } -void sub_08042970(Entity* this) { +static void sub_08042970(Entity* this) { u32 uVar2; VaatiArm_HeapStruct1* pVVar3; @@ -390,7 +391,7 @@ void sub_08042970(Entity* this) { sub_08043BF0(this); } -void sub_080429D4(Entity* this) { +static void sub_080429D4(Entity* this) { s16 sVar2; VaatiArm_HeapStruct1* pVVar3; @@ -402,7 +403,7 @@ void sub_080429D4(Entity* this) { } } -void sub_080429FC(Entity* this) { +static void sub_080429FC(Entity* this) { VaatiArm_HeapStruct1* pVVar1; pVVar1 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; @@ -415,7 +416,7 @@ void sub_080429FC(Entity* this) { } } -void sub_08042A3C(Entity* this) { +static void sub_08042A3C(Entity* this) { Entity* entity; gUnk_080D12B8[this->subAction](this); @@ -424,14 +425,14 @@ void sub_08042A3C(Entity* this) { entity->z.HALF.HI += this->field_0x78.HALF.LO; } -void sub_08042A6C(Entity* this) { +static void sub_08042A6C(Entity* this) { this->subAction = 1; this->field_0x78.HALF.LO = 0; this->field_0x7c.BYTES.byte2 = 1; ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk0a = 0x200; } -void sub_08042A88(Entity* this) { +static void sub_08042A88(Entity* this) { VaatiArm_HeapStruct1* pVVar4; pVVar4 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; @@ -452,7 +453,7 @@ void sub_08042A88(Entity* this) { } } -void sub_08042AEC(Entity* this) { +static void sub_08042AEC(Entity* this) { if (--this->timer == 0) { this->subAction = 3; this->timer = 4; @@ -462,7 +463,7 @@ void sub_08042AEC(Entity* this) { } } -void sub_08042B20(Entity* this) { +static void sub_08042B20(Entity* this) { VaatiArm_HeapStruct1* ptr; Entity* object; Entity* entity; @@ -510,12 +511,12 @@ void sub_08042B20(Entity* this) { } } -void sub_08042C14(Entity* this) { +static void sub_08042C14(Entity* this) { gUnk_080D12D0[this->subAction](this); sub_08043A78(this); } -void sub_08042C34(Entity* this) { +static void sub_08042C34(Entity* this) { u32 random; int y; u32 i; @@ -572,7 +573,7 @@ void sub_08042C34(Entity* this) { } } -void sub_08042D24(Entity* this) { +static void sub_08042D24(Entity* this) { Entity* entity; if (--this->timer == 0) { @@ -588,7 +589,7 @@ void sub_08042D24(Entity* this) { } } -void sub_08042D6C(Entity* this) { +static void sub_08042D6C(Entity* this) { Entity* object; Entity* entity; u32 i; @@ -622,7 +623,7 @@ void sub_08042D6C(Entity* this) { } } -void sub_08042E30(Entity* this) { +static void sub_08042E30(Entity* this) { short sVar3; u32 uVar6; VaatiArm_HeapStruct1* pVVar9; @@ -660,7 +661,7 @@ void sub_08042E30(Entity* this) { UpdateAnimationSingleFrame(this); } -void sub_08042EF4(Entity* this) { +static void sub_08042EF4(Entity* this) { VaatiArm_HeapStruct1* ptr; Entity* entity; u32 temp; @@ -700,7 +701,7 @@ void sub_08042EF4(Entity* this) { } } -void sub_08042FD8(Entity* this) { +static void sub_08042FD8(Entity* this) { Entity* entity; UpdateAnimationSingleFrame(this); @@ -727,7 +728,7 @@ void sub_08042FD8(Entity* this) { } } -void sub_08043048(Entity* this) { +static void sub_08043048(Entity* this) { VaatiArm_HeapStruct1* ptr; u32 i; @@ -754,7 +755,7 @@ void sub_08043048(Entity* this) { } } -void sub_080430D0(Entity* this) { +static void sub_080430D0(Entity* this) { VaatiArm_HeapStruct1* ptr; if (sub_08043C98(this) == 0) { @@ -775,7 +776,7 @@ void sub_080430D0(Entity* this) { } } -void sub_08043130(Entity* this) { +static void sub_08043130(Entity* this) { VaatiArm_HeapStruct1* ptr; Entity* entity; u32 i; @@ -817,7 +818,7 @@ void sub_08043130(Entity* this) { } } -void sub_080431E8(Entity* this) { +static void sub_080431E8(Entity* this) { u32 i; VaatiArm_HeapStruct1* ptr; @@ -838,7 +839,7 @@ void sub_080431E8(Entity* this) { } } -void sub_0804325C(Entity* this) { +static void sub_0804325C(Entity* this) { Entity* entity; sub_08043CD4(this); @@ -855,9 +856,9 @@ void sub_0804325C(Entity* this) { } } -ASM_FUNC("asm/non_matching/vaati/sub_080432A8.inc", void sub_080432A8(Entity* this)) +static ASM_FUNC("asm/non_matching/vaati/sub_080432A8.inc", void sub_080432A8(Entity* this)) -NONMATCH("asm/non_matching/vaati/sub_0804334C.inc", void sub_0804334C(Entity* this)) { + static NONMATCH("asm/non_matching/vaati/sub_0804334C.inc", void sub_0804334C(Entity* this)) { int bVar1; Entity* entity; VaatiArm_HeapStruct1* s; @@ -904,12 +905,12 @@ NONMATCH("asm/non_matching/vaati/sub_0804334C.inc", void sub_0804334C(Entity* th } END_NONMATCH -void sub_08043420(Entity* this) { +static void sub_08043420(Entity* this) { gUnk_080D1320[this->subAction](this); sub_08043ABC(this); } -void sub_08043440(Entity* this) { +static void sub_08043440(Entity* this) { u32 i; int iVar4; u8* ptr; @@ -942,7 +943,7 @@ void sub_08043440(Entity* this) { } } -void sub_08043490(Entity* this) { +static void sub_08043490(Entity* this) { Entity* entity; Entity* entity2; Entity* entity3; @@ -970,7 +971,7 @@ void sub_08043490(Entity* this) { UpdateAnimationSingleFrame(this); } -void sub_08043520(Entity* this) { +static void sub_08043520(Entity* this) { Entity* entity; entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; @@ -982,7 +983,7 @@ void sub_08043520(Entity* this) { } } -void sub_0804355C(Entity* this) { +static void sub_0804355C(Entity* this) { sub_08043DB0(this); if (--this->field_0x7a.HWORD == 0) { this->subAction = 4; @@ -990,7 +991,7 @@ void sub_0804355C(Entity* this) { UpdateAnimationSingleFrame(this); } -void sub_08043580(Entity* this) { +static void sub_08043580(Entity* this) { Entity* entity; u32 i; @@ -1013,7 +1014,7 @@ void sub_08043580(Entity* this) { } } -void sub_080435F4(Entity* this) { +static void sub_080435F4(Entity* this) { Entity* entity; u32 i; VaatiArm_HeapStruct1* ptr; @@ -1038,11 +1039,11 @@ void sub_080435F4(Entity* this) { } } -void sub_08043680(Entity* this) { +static void sub_08043680(Entity* this) { gUnk_080D1348[this->subAction](this); } -void sub_08043698(Entity* this) { +static void sub_08043698(Entity* this) { Entity* entity; u32 i; @@ -1067,19 +1068,19 @@ static inline void deleteThing(Entity* this, const u32 index) { } } -void sub_080436C0(Entity* this) { +static void sub_080436C0(Entity* this) { deleteThing(this, 1); } -void sub_08043700(Entity* this) { +static void sub_08043700(Entity* this) { deleteThing(this, 2); } -void sub_08043738(Entity* this) { +static void sub_08043738(Entity* this) { deleteThing(this, 3); } -void sub_08043770(Entity* this) { +static void sub_08043770(Entity* this) { Entity* entity; if (--this->timer == 0) { @@ -1101,7 +1102,7 @@ void sub_08043770(Entity* this) { } } -u32 sub_080437DC(Entity* this) { +static u32 sub_080437DC(Entity* this) { u16 temp; VaatiArm_HeapStruct* heapStruct; Entity* entity; @@ -1159,9 +1160,9 @@ u32 sub_080437DC(Entity* this) { return 1; } -ASM_FUNC("asm/non_matching/vaati/sub_0804393C.inc", void sub_0804393C(Entity* this)) +static ASM_FUNC("asm/non_matching/vaati/sub_0804393C.inc", void sub_0804393C(Entity* this)) -void sub_08043A10(Entity* this) { + static void sub_08043A10(Entity* this) { sub_08043B7C(this); sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[4]); ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->y.HALF.HI -= 8; @@ -1177,7 +1178,7 @@ void sub_08043A10(Entity* this) { } } -void sub_08043A78(Entity* this) { +static void sub_08043A78(Entity* this) { this->field_0x7c.BYTES.byte0 = 0; sub_08043B7C(this); sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[2]); @@ -1187,7 +1188,7 @@ void sub_08043A78(Entity* this) { ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spriteOffsetY--; } -void sub_08043ABC(Entity* this) { +static void sub_08043ABC(Entity* this) { this->field_0x7c.BYTES.byte0 = 0; sub_08043B7C(this); sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[3]); @@ -1198,22 +1199,22 @@ void sub_08043ABC(Entity* this) { ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spriteOffsetY--; } -ASM_FUNC("asm/non_matching/vaati/sub_08043B08.inc", void sub_08043B08(Entity* this)) +static ASM_FUNC("asm/non_matching/vaati/sub_08043B08.inc", void sub_08043B08(Entity* this)) -void sub_08043B7C(Entity* this) { + static void sub_08043B7C(Entity* this) { sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[1]); sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[2]); sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[3]); } -void sub_08043B9C(Entity* this) { +static void sub_08043B9C(Entity* this) { u32 index = ((((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk00.HALF.HI + 4) & 0xff) >> 3; if (gUnk_080D13B7[index] != this->frameIndex - 1) { InitAnimationForceUpdate(this, gUnk_080D13B7[index]); } } -void sub_08043BC8(Entity* this) { +static void sub_08043BC8(Entity* this) { VaatiArm_HeapStruct1* pVVar2; const Coords* ptr; @@ -1226,7 +1227,7 @@ void sub_08043BC8(Entity* this) { pVVar2->unk0e = 0x28; } -void sub_08043BF0(Entity* this) { +static void sub_08043BF0(Entity* this) { u8 bVar1; u32 uVar2; VaatiArm_HeapStruct1* ptr; @@ -1250,7 +1251,7 @@ void sub_08043BF0(Entity* this) { } } -void sub_08043C40(Entity* this, VaatiArm_HeapStruct1* heapStruct) { +static void sub_08043C40(Entity* this, VaatiArm_HeapStruct1* heapStruct) { u8* iVar3; int offset; const u8* puVar6; @@ -1281,7 +1282,7 @@ void sub_08043C40(Entity* this, VaatiArm_HeapStruct1* heapStruct) { } } -u32 sub_08043C98(Entity* this) { +static u32 sub_08043C98(Entity* this) { #if defined EU || defined JP Entity* e1 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; if ((e1->contactFlags == 0x9d)) { @@ -1303,7 +1304,7 @@ u32 sub_08043C98(Entity* this) { #endif } -void sub_08043CD4(Entity* this) { +static void sub_08043CD4(Entity* this) { u32 i; for (i = 0; i < 5; i++) { if (((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->contactFlags == 0x9d) { @@ -1314,7 +1315,7 @@ void sub_08043CD4(Entity* this) { } } -void sub_08043D08(Entity* this) { +static void sub_08043D08(Entity* this) { Entity* entity; Entity* fx; u32 i; @@ -1341,7 +1342,7 @@ void sub_08043D08(Entity* this) { EnqueueSFX(SFX_HIT); } -void sub_08043DB0(Entity* this) { +static void sub_08043DB0(Entity* this) { s32 cVar1; Entity* pEVar2; Entity* pEVar3; @@ -1381,7 +1382,7 @@ void sub_08043DB0(Entity* this) { } } -void sub_08043EB8(Entity* this) { +static void sub_08043EB8(Entity* this) { u32 i; Entity* pEVar4; VaatiArm_HeapStruct1* ptr; @@ -1421,7 +1422,8 @@ void sub_08043EB8(Entity* this) { ptr->unk0c = gUnk_080D1419[i]; } } -NONMATCH("asm/non_matching/vaati/sub_08044000.inc", void sub_08044000(Entity* this)) { + +static NONMATCH("asm/non_matching/vaati/sub_08044000.inc", void sub_08044000(Entity* this)) { Entity* entity; u32 i; VaatiArm_HeapStruct1* ptr; @@ -1442,7 +1444,7 @@ NONMATCH("asm/non_matching/vaati/sub_08044000.inc", void sub_08044000(Entity* th } END_NONMATCH -void sub_08044078(Entity* this) { +static void sub_08044078(Entity* this) { if (this->action == 0) { this->action = 1; if (this->type != 3 || @@ -1456,7 +1458,7 @@ void sub_08044078(Entity* this) { GetNextFrame(this); } -void sub_080440CC(Entity* this) { +static void sub_080440CC(Entity* this) { if (this->action == 0) { this->action = 1; if ((gRoomTransition.field_0x38 & 1) != 0 && diff --git a/src/interrupts.c b/src/interrupts.c index 1ea6b512..0477426a 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -18,6 +18,8 @@ extern Entity* gPlayerClones[3]; extern u16 gUnk_080B2CD8[]; void ram_IntrMain(void); +static void sub_080171F0(void); +static void HandlePlayerLife(Entity* this); struct { u8 ready; @@ -223,7 +225,7 @@ void PlayerUpdate(Entity* this) { } // Responsible for some life things like low health beep and initiating the death sequence -void HandlePlayerLife(Entity* this) { +static void HandlePlayerLife(Entity* this) { u32 temp; gUnk_0200AF00.unk_2f = 0; @@ -308,7 +310,7 @@ void HandlePlayerLife(Entity* this) { } } -void sub_080171F0(void) { +static void sub_080171F0(void) { if (gPlayerState.mobility != 0) ResetPlayerItem(); if (gPlayerState.field_0x14 != 0) diff --git a/src/menu/figurine_menu.c b/src/menu/figurine_menu.c index 22e9decc..1c9f6557 100644 --- a/src/menu/figurine_menu.c +++ b/src/menu/figurine_menu.c @@ -10,6 +10,7 @@ #include "object.h" #include "game.h" #include "functions.h" +#include "message.h" extern const struct { u8 filler[7]; diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index 26749520..7f75c55b 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -5,14 +5,13 @@ #include "item.h" extern void (*gUnk_081140D4[])(Entity*); - extern u16 gUnk_081140CC[]; +extern u8 gMapDataTopSpecial[]; void sub_0806D520(Entity*, u32); - void sub_0806D41C(Entity* this); -extern u8 gMapDataTopSpecial[]; +static void sub_0806D02C(Entity* this); typedef struct { u8 filler[0x40]; @@ -96,7 +95,7 @@ Entity* sub_0806D00C(Entity* this) { return entity; } -void sub_0806D02C(Entity* this) { +static void sub_0806D02C(Entity* this) { s32 tmp1; s32 tmp2; sub_0806D164(this); diff --git a/src/npc/cat.c b/src/npc/cat.c index d7be469c..b93d13e1 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -4,6 +4,7 @@ #include "save.h" #include "message.h" #include "npc.h" +#include "enemy.h" extern void sub_08067C44(Entity*); diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index 0227e6ba..567e8328 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -12,6 +12,8 @@ extern Dialog gUnk_08109DC8[]; extern u16 gUnk_0810A35A[]; extern u16 gUnk_0810A362[]; +static void sub_080600F0(Entity* this); + void ForestMinish(Entity* this) { switch (this->action) { case 0: @@ -66,7 +68,7 @@ void ForestMinish_Head(Entity* this) { sub_0807000C(this); } -void sub_080600F0(Entity* this) { +static void sub_080600F0(Entity* this) { u32 uVar1; u32 uVar2; diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index 1c2bfd5e..a68d2b72 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -3,7 +3,6 @@ #include "player.h" #include "flags.h" #include "npc.h" -#include "functions.h" #include "item.h" extern u32 gUnk_08113F44; diff --git a/src/npc/melari.c b/src/npc/melari.c index c6b29640..9bc4b8a4 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -1,5 +1,4 @@ #include "npc.h" -#include "functions.h" #include "item.h" extern void sub_08068780(Entity*); diff --git a/src/npc/minishEzlo.c b/src/npc/minishEzlo.c index 8eaccbcf..130c58c9 100644 --- a/src/npc/minishEzlo.c +++ b/src/npc/minishEzlo.c @@ -1,6 +1,6 @@ #include "entity.h" -#include "functions.h" #include "sound.h" +#include "script.h" extern SpriteLoadData gUnk_0810C48C; diff --git a/src/npc/npc5.c b/src/npc/npc5.c index 27459f66..163f8c88 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -2,6 +2,7 @@ #include "message.h" #include "npc.h" #include "hitbox.h" +#include "collision.h" typedef struct { u8 unk_0; // u8 diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c index 8643cf95..44be7575 100644 --- a/src/npc/phonograph.c +++ b/src/npc/phonograph.c @@ -5,6 +5,7 @@ #include "screen.h" #include "common.h" #include "flags.h" +#include "message.h" #ifdef EU void sub_0806EABC(Entity* this); diff --git a/src/npc/pita.c b/src/npc/pita.c index 397128de..c4272f5c 100644 --- a/src/npc/pita.c +++ b/src/npc/pita.c @@ -1,4 +1,3 @@ -#include "functions.h" #include "npc.h" #include "item.h" @@ -7,7 +6,6 @@ extern Hitbox gUnk_0810C428; extern u8 gUnk_0810C430[4]; extern u8 gUnk_0810C435[]; extern u8 gUnk_0810C43D[]; -extern u32 GetRandomByWeight(const u8*); void Pita(Entity* this) { if (this->action == 0) { @@ -25,7 +23,7 @@ void Pita(Entity* this) { } /** Reset the players baked goods? */ -void sub_08062EB8(void) { +void RemoveAllBakedGoods(void) { SetInventoryValue(ITEM_BRIOCHE, 0); SetInventoryValue(ITEM_CROISSANT, 0); SetInventoryValue(ITEM_PIE, 0); diff --git a/src/object/bird.c b/src/object/bird.c index 94b13bf2..44af688e 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -4,6 +4,7 @@ #include "item.h" #include "message.h" #include "game.h" +#include "collision.h" extern u16 script_EzloTalkOcarina[]; @@ -211,10 +212,11 @@ void Bird_Type8(Entity* this) { this->speed = 0x300; } - if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.doTextBox & 0x7f) == 0 && gPlayerEntity.action != PLAYER_SLEEP && - gPlayerEntity.action != PLAYER_BOUNCE && gPlayerEntity.action != PLAYER_MINISH && gPlayerState.framestate != PL_STATE_CLIMB && - gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_PARACHUTE && PlayerCanBeMoved() && - (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe))) { + if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.doTextBox & 0x7f) == 0 && + gPlayerEntity.action != PLAYER_SLEEP && gPlayerEntity.action != PLAYER_BOUNCE && + gPlayerEntity.action != PLAYER_MINISH && gPlayerState.framestate != PL_STATE_CLIMB && + gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_PARACHUTE && + PlayerCanBeMoved() && (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe))) { s32 z = gPlayerEntity.z.HALF.HI - this->z.HALF.HI - 8; if ((u16)z < 0x20 && gPlayerEntity.health != 0) { pEVar5 = CreateObject(0x95, 10, 0); diff --git a/src/object/book.c b/src/object/book.c index 05af98ed..01f3a15e 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -3,6 +3,7 @@ #include "message.h" #include "item.h" #include "npc.h" +#include "collision.h" extern void (*const BookActionFuncs[])(Entity*); extern s8 const gUnk_08123D94[]; diff --git a/src/object/fairy.c b/src/object/fairy.c index 76fdb2df..988d56e7 100644 --- a/src/object/fairy.c +++ b/src/object/fairy.c @@ -11,6 +11,7 @@ #include "functions.h" #include "item.h" #include "hitbox.h" +#include "collision.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/fan.c b/src/object/fan.c index 882edd33..b9a98d01 100644 --- a/src/object/fan.c +++ b/src/object/fan.c @@ -6,6 +6,7 @@ #include "functions.h" #include "sound.h" #include "object.h" +#include "collision.h" typedef struct { Entity base; diff --git a/src/object/fourElements.c b/src/object/fourElements.c index 8fd25f49..fb26c54b 100644 --- a/src/object/fourElements.c +++ b/src/object/fourElements.c @@ -12,6 +12,7 @@ #include "hitbox.h" #include "screen.h" #include "message.h" +#include "collision.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c index 89f7cc8e..b195e6f6 100644 --- a/src/object/heartContainer.c +++ b/src/object/heartContainer.c @@ -3,6 +3,7 @@ #include "flags.h" #include "functions.h" #include "item.h" +#include "collision.h" static void sub_0808E6A0(Entity*); static void sub_0808E6E4(Entity*); diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index b356c38a..f9806ec8 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -8,6 +8,7 @@ #include "itemMetaData.h" #include "functions.h" #include "hitbox.h" +#include "collision.h" void sub_08081150(Entity*); u8 sub_0808147C(u32); diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c index 3c5aefd0..a3680f93 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -6,11 +6,16 @@ #include "flags.h" #include "functions.h" #include "hitbox.h" +#include "object.h" extern void (*const gUnk_081243B4[])(Entity*); extern void (*const gUnk_081243BC[])(Entity*); extern void (*const gUnk_081243C4[])(Entity*); +static void sub_0809EB30(Entity* this); +static void sub_0809EAD8(Entity* this); +static void sub_0809EABC(Entity* this); + void LightableSwitch(Entity* this) { gUnk_081243B4[this->type](this); sub_0809EB30(this); @@ -47,7 +52,7 @@ void sub_0809EA80(Entity* this) { sub_0809EABC(this); } -void sub_0809EABC(Entity* this) { +static void sub_0809EABC(Entity* this) { bool32 anySet = 0; if (CheckFlags(this->field_0x86.HWORD)) { @@ -58,7 +63,7 @@ void sub_0809EABC(Entity* this) { } } -void sub_0809EAD8(Entity* this) { +static void sub_0809EAD8(Entity* this) { u8 bVar1; Entity* pEVar2; @@ -72,7 +77,7 @@ void sub_0809EAD8(Entity* this) { } } -void sub_0809EB30(Entity* this) { +static void sub_0809EB30(Entity* this) { u16 uVar1; u16* puVar2; diff --git a/src/object/macroShoes.c b/src/object/macroShoes.c index 36cc84e5..1de5ee00 100644 --- a/src/object/macroShoes.c +++ b/src/object/macroShoes.c @@ -1,7 +1,6 @@ #include "entity.h" #include "asm.h" -void sub_0800445C(Entity*); void MacroShoes_Init(Entity*); void MacroShoes_Idle(Entity*); diff --git a/src/object/object30.c b/src/object/object30.c index 4f6f1d33..5dc2cff7 100644 --- a/src/object/object30.c +++ b/src/object/object30.c @@ -10,6 +10,7 @@ #include "object.h" #include "functions.h" #include "item.h" +#include "collision.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/object96.c b/src/object/object96.c index fde07cb0..ab630662 100644 --- a/src/object/object96.c +++ b/src/object/object96.c @@ -7,6 +7,7 @@ #include "item.h" #include "flags.h" #include "effects.h" +#include "collision.h" typedef struct _struct_gUnk_08123FB0 { void (*const funcEnt)(Entity*); diff --git a/src/object/object98.c b/src/object/object98.c index a5de48e9..96626eeb 100644 --- a/src/object/object98.c +++ b/src/object/object98.c @@ -3,6 +3,7 @@ #include "projectile.h" #include "room.h" #include "functions.h" +#include "object.h" typedef struct { Entity base; diff --git a/src/object/objectA8.c b/src/object/objectA8.c index 4f2c0c13..83f9d422 100644 --- a/src/object/objectA8.c +++ b/src/object/objectA8.c @@ -11,6 +11,7 @@ #include "functions.h" #include "item.h" #include "hitbox.h" +#include "collision.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/objectB2.c b/src/object/objectB2.c index a791b9fb..dae02bf1 100644 --- a/src/object/objectB2.c +++ b/src/object/objectB2.c @@ -1,6 +1,7 @@ #include "global.h" #include "entity.h" #include "functions.h" +#include "collision.h" extern u8 gUnk_02027EB4[]; extern u8 gUnk_0200D654[]; diff --git a/src/object/pressurePlate.c b/src/object/pressurePlate.c index 4536eeda..bcbe72d1 100644 --- a/src/object/pressurePlate.c +++ b/src/object/pressurePlate.c @@ -2,6 +2,7 @@ #include "object.h" #include "functions.h" #include "hitbox.h" +#include "collision.h" typedef struct { Entity base; diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index 696f469e..6756d82f 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -6,6 +6,7 @@ #include "room.h" #include "functions.h" #include "effects.h" +#include "object.h" extern const s16 gUnk_080B4468[]; @@ -14,6 +15,10 @@ void sub_0809E86C(Entity* this); void sub_0809E8BC(Entity* this); void sub_0809E8EC(Entity* this); +static void sub_0809E96C(Entity* this); +static u32 sub_0809E9A0(void); +static void sub_0809E918(Entity* this); + void TreeHidingPortal(Entity* this) { static void (*const actionFuncs[])(Entity*) = { sub_0809E83C, @@ -69,7 +74,7 @@ void sub_0809E8EC(Entity* this) { } } -void sub_0809E918(Entity* this) { +static void sub_0809E918(Entity* this) { static const s16 gUnk_08124364[] = { 0, -4, 8, -4, 16, -4, 22, -4, -8, -4, -16, -4, -22, -4, 0, -12, 0, 4, 8, -12, 8, 4, -8, -12, -8, 4, 8, -16, -8, -16, 12, -16, -12, -16, 16, -14, -16, -14, -1000, 0, @@ -88,11 +93,11 @@ void sub_0809E918(Entity* this) { } } -void sub_0809E96C(Entity* this) { +static void sub_0809E96C(Entity* this) { CreateMinishEntrance(COORD_TO_TILE_OFFSET(this, 0x20, 0x8)); } -u32 sub_0809E9A0(void) { +static u32 sub_0809E9A0(void) { u32 rv; const s16* ptr; diff --git a/src/object/windTribeTeleporter.c b/src/object/windTribeTeleporter.c index c76a6190..5e4cb50e 100644 --- a/src/object/windTribeTeleporter.c +++ b/src/object/windTribeTeleporter.c @@ -10,6 +10,7 @@ #include "object.h" #include "functions.h" #include "hitbox.h" +#include "collision.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/playerItem/playerItemGustBig.c b/src/playerItem/playerItemGustBig.c index 8430cbcf..ede960db 100644 --- a/src/playerItem/playerItemGustBig.c +++ b/src/playerItem/playerItemGustBig.c @@ -3,6 +3,7 @@ #include "player.h" #include "functions.h" #include "sound.h" +#include "asm.h" extern void sub_08078CD0(Entity*); extern void sub_08018FA0(Entity*); diff --git a/src/playerUtils.c b/src/playerUtils.c index 6a94deb9..c8179c97 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -15,6 +15,8 @@ #include "item.h" #include "message.h" +static void sub_08077E54(ItemBehavior* beh); + extern void sub_080752E8(ItemBehavior* behavior, u32 arg1); // item.c extern void sub_0800857C(Entity*); extern void SetDefaultPriorityForKind(Entity*); @@ -498,7 +500,7 @@ void sub_08077E3C(ItemBehavior* ent, u32 idx) { sub_08077E54(ent); } -void sub_08077E54(ItemBehavior* beh) { +static void sub_08077E54(ItemBehavior* beh) { beh->field_0x5[7] = gPlayerEntity.animIndex; beh->field_0x12[0] = gPlayerEntity.frameIndex; beh->field_0x5[8] = gPlayerEntity.frameDuration; @@ -1276,7 +1278,8 @@ bool32 PlayerCanBeMoved(void) { if ((gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_FROZEN | PL_FALLING | PL_DISABLE_ITEMS | PL_PIT_IS_EXIT | PL_IN_MINECART | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING)) != 0 || - gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == PLAYER_FALL || gPlayerEntity.action == PLAYER_08071DB8) { + gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == PLAYER_FALL || + gPlayerEntity.action == PLAYER_08071DB8) { return FALSE; } else { return TRUE; diff --git a/src/projectile/dekuSeedProjectile.c b/src/projectile/dekuSeedProjectile.c index 588ad284..f4ca7fbf 100644 --- a/src/projectile/dekuSeedProjectile.c +++ b/src/projectile/dekuSeedProjectile.c @@ -1,6 +1,7 @@ #include "entity.h" #include "enemy.h" #include "functions.h" +#include "collision.h" extern void (*const DekuSeedProjectile_Functions[])(Entity*); extern void (*const DekuSeedProjectile_Actions[])(Entity*); diff --git a/src/projectile/guardLineOfSight.c b/src/projectile/guardLineOfSight.c index 9fc3a49f..37027b06 100644 --- a/src/projectile/guardLineOfSight.c +++ b/src/projectile/guardLineOfSight.c @@ -4,6 +4,7 @@ #include "functions.h" #include "projectile.h" #include "hitbox.h" +#include "collision.h" extern u32 sub_080644C8(Entity*); extern u8 gUnk_02027EB4[]; diff --git a/src/room.c b/src/room.c index 339c238d..92c4057a 100644 --- a/src/room.c +++ b/src/room.c @@ -7,7 +7,7 @@ #include "object.h" #include "game.h" -extern void sub_0804B058(EntityData* dat); +static void sub_0804B058(EntityData* dat); extern void sub_0801AC98(void); extern u32 sub_08049D1C(u32); extern Entity* LoadRoomEntity(EntityData*); @@ -179,7 +179,7 @@ void LoadRoom(void) { sub_0801AC98(); } -void sub_0804B058(EntityData* dat) { +static void sub_0804B058(EntityData* dat) { Entity* ent; u32 uVar2; diff --git a/src/roomInit.c b/src/roomInit.c index 84a090cb..7f2b8d4e 100644 --- a/src/roomInit.c +++ b/src/roomInit.c @@ -35,6 +35,8 @@ void sub_080AF250(); void sub_0804C290(); void sub_0804C258(); +static void sub_0804C128(void); + extern void** gCurrentRoomProperties; u32 sub_unk3_ArmosInteriors_RuinsEntranceNorth(u32 arg0) { @@ -1074,7 +1076,7 @@ extern u8 gUnk_080D9338[]; extern u8 gUnk_080D9340[]; extern TileEntity gUnk_080D9328[]; -void sub_0804C128() { +static void sub_0804C128(void) { sub_080AF250(0); if (gRoomVars.field_0x0 != 0) { if ((gArea.unk_0c_1) == 0) { diff --git a/src/text.c b/src/text.c index 10b504f8..a56d23ea 100644 --- a/src/text.c +++ b/src/text.c @@ -41,6 +41,9 @@ u32 sub_0805EF8C(Token*); u32 sub_0805EFB4(Token*); u32 sub_0805F9A0(u32); +static u32 sub_0805F8F8(u32 idx); +static u32 sub_0805F7A0(u32 param_1); + typedef struct { u16 unk0; s8 unk2; @@ -606,7 +609,7 @@ u32 sub_0805F76C(u8* param_1, WStruct* param_2) { return uVar1; } -u32 sub_0805F7A0(u32 param_1) { +static u32 sub_0805F7A0(u32 param_1) { u32 uVar1; u32 uVar2; u32 uVar3; @@ -707,7 +710,7 @@ void sub_0805F8E4(u32 r0, WStruct* r1) { r1->unk1 = old; } -u32 sub_0805F8F8(u32 idx) { +static u32 sub_0805F8F8(u32 idx) { u8* temp = &gUnk_0810942E[idx].filler0[10][10]; return gUnk_0810926C[*temp]; }