diff options
| author | Ibot02 <jtp.jtp@gmx.de> | 2022-01-09 20:46:03 +0100 |
|---|---|---|
| committer | Ibot02 <jtp.jtp@gmx.de> | 2022-01-09 20:46:03 +0100 |
| commit | 4fc5a7c3e4dd240db3bc190439d07fcecba7b0e1 (patch) | |
| tree | fc7aa8be7f80de6c1a2c5a760e4862e86b863f07 /src/object | |
| parent | 85fa74cc57166378e150086abb407ca0f3b756db (diff) | |
| parent | 7b87141d9b708b5baa0458303bf7d68c4d11a99a (diff) | |
Merge branch 'master' into gyorg
Diffstat (limited to 'src/object')
51 files changed, 297 insertions, 322 deletions
diff --git a/src/object/archway.c b/src/object/archway.c index d0ed7559..556d5268 100644 --- a/src/object/archway.c +++ b/src/object/archway.c @@ -1,6 +1,5 @@ -#include "global.h" #include "entity.h" -#include "overworld.h" +#include "game.h" void Archway(Entity* this) { if (this->action == 0) { @@ -9,7 +8,7 @@ void Archway(Entity* this) { this->frameIndex = this->type2; this->collisionLayer = 2; UpdateSpriteForCollisionLayer(this); - if (CheckIsDungeon()) { + if (AreaIsDungeon()) { this->spritePriority.b0 = 1; } } diff --git a/src/object/backgroundCloud.c b/src/object/backgroundCloud.c index edd764d2..176bdd58 100644 --- a/src/object/backgroundCloud.c +++ b/src/object/backgroundCloud.c @@ -1,5 +1,4 @@ #include "object.h" -#include "functions.h" extern void (*const gUnk_08121EA4[])(Entity*); extern const u8 gUnk_08121EB0[]; @@ -18,8 +17,8 @@ void sub_0808F658(Entity* this) { this->frameIndex = this->type; this->direction = 8; this->speed = gUnk_08121EB0[this->type]; - this->field_0x78.HWORD = gRoomControls.roomOriginX - 0x60; - this->field_0x7a.HWORD = gRoomControls.roomOriginX + gRoomControls.width + 0x60; + this->field_0x78.HWORD = gRoomControls.origin_x - 0x60; + this->field_0x7a.HWORD = gRoomControls.origin_x + gRoomControls.width + 0x60; this->animationState = 0; this->x.HALF.HI += (Random() & 0xf) << 4; this->actionDelay = 0; @@ -27,7 +26,7 @@ void sub_0808F658(Entity* this) { } void sub_0808F6E0(Entity* this) { - sub_0806F69C(this); + LinearMoveUpdate(this); if ((s16)this->x.HALF.HI < (s16)this->field_0x78.HWORD || (s16)this->x.HALF.HI > (s16)this->field_0x7a.HWORD) this->action = 2; diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c index ffe11cd9..a5b344ba 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -1,6 +1,6 @@ #include "object.h" -extern void sub_0800449C(Entity*, u32); +extern void SoundReqClipped(Entity*, u32); extern u32 sub_0806FC80(Entity*, Entity*, s32); extern void sub_0809CDF0(Entity*); @@ -61,7 +61,7 @@ void sub_0809CD0C(Entity* this) { sub_0806FC80(this, &gPlayerEntity, 4)) { this->field_0xf++; ModHealth(-2); - sub_0800449C(&gPlayerEntity, 0x7a); + SoundReqClipped(&gPlayerEntity, 0x7a); gPlayerEntity.iframes = 16; gPlayerEntity.knockbackDirection = 16; gPlayerEntity.knockbackDuration = 12; @@ -85,8 +85,8 @@ void sub_0809CDB4(Entity* this) { void sub_0809CDF0(Entity* this) { u32 y; - this->field_0x80.HWORD = (((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3f) | - (((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4 & 0x3f) << 6); + this->field_0x80.HWORD = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3f) | + (((this->y.HALF.HI - gRoomControls.origin_y) >> 4 & 0x3f) << 6); y = this->field_0x80.HWORD; SetTile(0x402e, y - 0x01, this->collisionLayer); diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index 5e7f87eb..a26b7aae 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -3,7 +3,6 @@ #include "flags.h" #include "object.h" #include "functions.h" -#include "effects.h" extern void sub_08098E3C(Entity*); extern void sub_08098E88(Entity*); @@ -67,7 +66,7 @@ void sub_08098DC4(Entity* this) { sub_08004542(&gPlayerEntity); gPlayerEntity.collisionLayer = 1; ResolveEntityOnTop(this, &gPlayerEntity); - gPlayerState.playerAction = 0x1f; + gPlayerState.queued_action = PLAYER_PARACHUTE; gPlayerState.field_0x34[4] = 1; gPlayerState.field_0x34[5] = this->type2; this->action = 4; diff --git a/src/object/bird.c b/src/object/bird.c index b7774df4..24e2693b 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -1,6 +1,7 @@ #include "save.h" #include "object.h" #include "functions.h" +#include "item.h" extern void (*const gUnk_08123EC0[])(Entity*); extern void (*const gUnk_08123EEC[])(Entity*); @@ -29,7 +30,7 @@ void sub_0809CF54(Entity* this) { this->speed = 0x280; this->direction = 8; this->collisionLayer = 2; - this->x.HALF.HI = gRoomControls.roomScrollX; + this->x.HALF.HI = gRoomControls.scroll_x; SoundReq(SFX_123); UpdateSpriteForCollisionLayer(this); InitAnimationForceUpdate(this, 0); @@ -43,13 +44,13 @@ void sub_0809CF54(Entity* this) { void sub_0809CFEC(Entity* this) { - sub_0806F69C(this); - sub_08003FC4(this, *(s16*)&this->field_0x68.HWORD); + LinearMoveUpdate(this); + GravityUpdate(this, *(s16*)&this->field_0x68.HWORD); if (this->actionDelay != 0) { if (--this->actionDelay == 0) { this->field_0xf = 0; } - } else if (sub_080040A8(this) == 0) { + } else if (CheckOnScreen(this) == 0) { DeleteThisEntity(); } UpdateAnimationSingleFrame(this); diff --git a/src/object/book.c b/src/object/book.c index 9a99b928..7c3bf57e 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -1,7 +1,7 @@ #include "object.h" #include "functions.h" -#include "script.h" -#include "textbox.h" +#include "message.h" +#include "item.h" extern void (*const BookActionFuncs[])(Entity*); extern s8 const gUnk_08123D94[]; @@ -55,7 +55,7 @@ void sub_0809B3C4(Entity* this) { u32 scroll; u32 height; this->action = 3; - scroll = (u16)gRoomControls.roomScrollY - 0x10; + scroll = (u16)gRoomControls.scroll_y - 0x10; height = (u16)this->y.HALF.HI - scroll; this->z.HALF.HI -= height; return; @@ -92,8 +92,8 @@ void sub_0809B4A8(Entity* this) { this->direction = 16; gPlayerState.pushedObject = 0x9e; - gPlayerState.playerAction = 5; - gPlayerState.flags |= 1; + gPlayerState.queued_action = PLAYER_PUSH; + gPlayerState.flags |= PL_BUSY; gPlayerEntity.x.HALF.LO = 0; gPlayerEntity.y.HALF.LO = 0; @@ -117,7 +117,7 @@ void sub_0809B524(Entity* this) { } } - sub_0806F69C(this); + LinearMoveUpdate(this); } void sub_0809B56C(Entity* this) { diff --git a/src/object/button.c b/src/object/button.c index 76b48da8..1d1c88d9 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -16,8 +16,8 @@ void sub_08081AE0(Entity* this) { if (this->cutsceneBeh.HWORD != 0) { this->collisionLayer = this->cutsceneBeh.HWORD; } - this->field_0x74.HWORD = (((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) | - ((((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) << 6); + this->field_0x74.HWORD = (((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) | + ((((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) << 6); this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer); if (this->type == 0 && CheckFlags(this->field_0x86.HWORD)) { this->action = 5; @@ -39,7 +39,6 @@ void sub_08081B84(Entity* this) { } u32 sub_08081CB0(Entity*); -void RequestPriorityDuration(Entity*, u32); void sub_08081FF8(Entity*); void sub_08081BAC(Entity* this) { @@ -138,7 +137,7 @@ u32 sub_08081D28(Entity* this) { } extern u32 sub_080002E0(u32, u32); -extern Entity* gUnk_03004040[3]; +extern Entity* gPlayerClones[3]; u32 sub_08081E0C(Entity*); Entity* sub_08081D74(Entity* this) { @@ -148,17 +147,17 @@ Entity* sub_08081D74(Entity* this) { } ent = 0; if (sub_08081E0C(this)) { - if (!(gPlayerState.flags & 0x10) && !(gPlayerState.flags & PL_MINISH)) { + if ((gPlayerState.flags & PL_CAPTURED) == 0 && (gPlayerState.flags & PL_MINISH) == 0) { ent = &gPlayerEntity; } } else { - if (gPlayerState.flags & 0x400000) { - if (EntityInRectRadius(this, gUnk_03004040[0], 5, 6)) { - ent = gUnk_03004040[0]; - } else if (EntityInRectRadius(this, gUnk_03004040[1], 5, 6)) { - ent = gUnk_03004040[1]; - } else if (EntityInRectRadius(this, gUnk_03004040[2], 5, 6)) { - ent = gUnk_03004040[2]; + if (gPlayerState.flags & PL_CLONING) { + if (EntityInRectRadius(this, gPlayerClones[0], 5, 6)) { + ent = gPlayerClones[0]; + } else if (EntityInRectRadius(this, gPlayerClones[1], 5, 6)) { + ent = gPlayerClones[1]; + } else if (EntityInRectRadius(this, gPlayerClones[2], 5, 6)) { + ent = gPlayerClones[2]; } } } @@ -272,8 +271,8 @@ void sub_08081FF8(Entity* this) { direction = GetFacingDirection(this->child, this); sub_080044AE(this->child, 0x200, direction); for (i = 0; i < 3; i++) { - if (gUnk_03004040[i]) { - sub_080044AE(gUnk_03004040[i], 0x200, direction); + if (gPlayerClones[i]) { + sub_080044AE(gPlayerClones[i], 0x200, direction); } } } diff --git a/src/object/cloud.c b/src/object/cloud.c index 22494391..5c4383d8 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -2,6 +2,8 @@ #include "structures.h" #include "functions.h" +void sub_0809F814(u32 r0); + extern void sub_0809F7BC(Entity*); extern void sub_0809F7F4(Entity*); extern void (*gUnk_08124798[])(Entity*); @@ -30,7 +32,7 @@ void sub_0809F514(Entity* this) { this->actionDelay = 120; this->spriteSettings.draw = 0; this->field_0x68.HALF.LO = 12; - gRoomControls.cameraTarget = this; + gRoomControls.camera_target = this; gUnk_02034490[0] = 255; sub_0809F7BC(this); } @@ -41,10 +43,10 @@ void sub_0809F548(Entity* this) { this->action = 2; this->actionDelay = 90; SoundReq(SFX_11D); - sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) | - (((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6); + sub_0809F814((((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 63) | + (((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 63) << 6); } else { - if ((gScreenTransition.frameCount & 7) == 0) { + if ((gRoomTransition.frameCount & 7) == 0) { sub_0809F7BC(this); } sub_0809F7F4(this); @@ -75,13 +77,13 @@ void sub_0809F5F0(Entity* this) { this->actionDelay = 120; SetPlayerControl(3); sub_08078B48(); - gRoomControls.cameraTarget = this; + gRoomControls.camera_target = this; } } void sub_0809F61C(Entity* this) { - if ((gRoomControls.unk6 & 4) == 0) { + if ((gRoomControls.scroll_flags & 4) == 0) { if (this->actionDelay == 30) { SetLocalFlag(this->type2); } @@ -89,10 +91,10 @@ void sub_0809F61C(Entity* this) { this->action = 3; this->actionDelay = 120; SoundReq(SFX_11D); - sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) | - (((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6); + sub_0809F814((((this->x.HALF.HI - gRoomControls.origin_x) >> 4) & 63) | + (((this->y.HALF.HI - gRoomControls.origin_y) >> 4) & 63) << 6); } else { - if ((gScreenTransition.frameCount & 7) == 0) { + if ((gRoomTransition.frameCount & 7) == 0) { sub_0809F7BC(this); } sub_0809F7F4(this); @@ -105,14 +107,14 @@ void sub_0809F69C(Entity* this) { if (--this->actionDelay == 0) { this->actionDelay = 30; this->action = 4; - gRoomControls.cameraTarget = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity; SoundReq(SFX_SECRET_BIG); } } void sub_0809F6CC(Entity* this) { - if (((gRoomControls.unk6 & 4) == 0) && (--this->actionDelay == 0)) { + if (((gRoomControls.scroll_flags & 4) == 0) && (--this->actionDelay == 0)) { gPlayerState.controlMode = 1; DeleteThisEntity(); } @@ -127,12 +129,12 @@ void sub_0809F700(Entity* this) { this->actionDelay = (Random() & 30) + 8; this->flags = this->flags | 12; } - if ((gScreenTransition.frameCount & 3) == 0) { + if ((gRoomTransition.frameCount & 3) == 0) { uVar2 = Random(); this->spriteOffsetX = gUnk_081247C0[uVar2 & 7]; this->spriteOffsetY = gUnk_081247C0[uVar2 >> 4 & 7]; } - sub_0806F69C(this); + LinearMoveUpdate(this); if (--this->actionDelay == 0) { DeleteThisEntity(); } diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c index 345e8a2b..004f98d5 100644 --- a/src/object/fileScreenObjects.c +++ b/src/object/fileScreenObjects.c @@ -1,9 +1,7 @@ #include "object.h" #include "main.h" #include "menu.h" -#include "npc.h" -#include "fileScreen.h" -#include "structures.h" +#include "fileselect.h" #include "functions.h" extern int sub_0807A094(int); @@ -177,7 +175,7 @@ void sub_0808EA28(Entity* this) { u32 var1; if (this->type == 3) { - if (gSaveHeader->gameLanguage > LANGUAGE_EN) { + if (gSaveHeader->language > LANGUAGE_EN) { this->spriteSettings.draw = 2; } else { this->spriteSettings.draw = 0; @@ -296,7 +294,7 @@ void sub_0808EBB8(Entity* this) { case 0: break; case 1: - y = ((struct_02000000*)0x2000000)->gameLanguage * 16 + 24; + y = ((SaveHeader*)0x2000000)->language * 16 + 24; x = 112; break; case 2: @@ -321,7 +319,7 @@ void sub_0808EBB8(Entity* this) { } static Entity* sub_0808EC80(int form) { - Entity* entityA = (Entity*)&gUnk_03003DA0; + Entity* entityA = (Entity*)&gEntityLists[6]; Entity* entityB = entityA->next; while (entityB != entityA) { if ((entityB->kind == 0x6 && entityB->id == 0x48) && form == entityB->type) { @@ -404,7 +402,7 @@ void sub_0808ED98(Entity* this) { void sub_0808EE00(Entity* this) { int var0, var1, var2; - var0 = ((struct_02000000*)0x2000000)->gameLanguage != 0; + var0 = ((SaveHeader*)0x2000000)->language != 0; var1 = this->type - 10; this->frameIndex = gUnk_08121D38[var0][var1]; this->x.HALF.HI = gUnk_08121D18[var0][var1]; @@ -454,9 +452,9 @@ void sub_0808EF24(Entity* this) { } else { this->spriteSettings.draw = 2; if (this->type == 21) { - var0 = ((struct_02000000*)0x2000000)->messageSpeed; + var0 = ((SaveHeader*)0x2000000)->msg_speed; } else { - var0 = ((struct_02000000*)0x2000000)->brightnessPref; + var0 = ((SaveHeader*)0x2000000)->brightness; } this->frameIndex = this->lastFrameIndex + var0; } @@ -506,7 +504,7 @@ static u32 sub_0808EF6C(Entity* this) { } this->speed = var7; this->direction = sub_080045DA(var0, var2) >> 3; - sub_0806F69C(this); + LinearMoveUpdate(this); return 1; } diff --git a/src/object/fireplace.c b/src/object/fireplace.c index 1fda4e9f..a4513cb8 100644 --- a/src/object/fireplace.c +++ b/src/object/fireplace.c @@ -1,10 +1,9 @@ #include "object.h" -#include "script.h" #include "functions.h" extern void (*gUnk_08123D98[])(Entity*); -void sub_0809B7A0(Entity* e); +void sub_0809B7A0(Entity* this); void sub_0809B7DC(Entity* this); void sub_0809B7C0(Entity* this); diff --git a/src/object/giantLeaf.c b/src/object/giantLeaf.c index a5d25b30..ab3ebac8 100644 --- a/src/object/giantLeaf.c +++ b/src/object/giantLeaf.c @@ -22,8 +22,8 @@ void sub_0808D618(Entity* ent) { u32 i; arr = (ent->type != 0) ? gUnk_0812176A : gUnk_08121750; - tilePos = (((ent->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) | - ((((ent->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) * 64); + tilePos = (((ent->x.HALF.HI - gRoomControls.origin_x) >> 4) & 0x3F) | + ((((ent->y.HALF.HI - gRoomControls.origin_y) >> 4) & 0x3F) * 64); for (i = 0; i < 13; i++) { SetTile(16500, tilePos + arr[i], 1); diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index ccb1adbf..3a1f9a13 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -1,13 +1,12 @@ #include "object.h" #include "save.h" #include "script.h" -#include "structures.h" #include "functions.h" #include "screen.h" void GreatFairy_InitializeAnimation(Entity*); Entity* GreatFairy_CreateForm(Entity*, u32, u32); -void sub_080873D0(); +void sub_080873D0(Entity*); extern void (*const GreatFairy_Main[])(Entity*); extern void (*const GreatFairy_Behaviors[])(Entity*); extern void (*const GreatFairy_WingsBehaviors[])(Entity*); @@ -53,12 +52,12 @@ void GreatFairy(Entity* this) { void GreatFairy_CallBehavior(Entity* this) { GreatFairy_Behaviors[this->action](this); - if ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) < 168) { + if ((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) < 168) { - gRoomControls.cameraTarget = this; + gRoomControls.camera_target = this; gRoomControls.unk5 = 2; } else { - gRoomControls.cameraTarget = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity; gRoomControls.unk5 = 2; } } @@ -120,7 +119,7 @@ void GreatFairy_SpawningUpdate(Entity* this) { mini = GreatFairy_CreateForm(this, WAKE, 0); //??? if (mini != NULL) { CopyPosition(this, mini); - DoFade(6, 4); + SetFade(6, 4); SoundReq(SFX_145); this->action = 4; this->actionDelay = 60; @@ -422,7 +421,7 @@ void sub_080871F8(Entity* this) { this->action = 2; } else { this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, temp->x.HALF.HI, temp->y.HALF.HI - 32); - sub_0806F69C(this); + LinearMoveUpdate(this); } } @@ -437,7 +436,7 @@ void sub_08087240(Entity* this) { void sub_08087264(Entity* this) { if (this->actionDelay != 0) { this->actionDelay--; - sub_0806F69C(this); + LinearMoveUpdate(this); } } @@ -464,7 +463,7 @@ void sub_080872AC(Entity* this) { void sub_080872F8(Entity* this) { s32 temp; - sub_0806F69C(this); + LinearMoveUpdate(this); GetNextFrame(this); if (((u16)(this->field_0x68.HWORD - this->x.HALF.HI) > 0xc) || ((u16)(this->field_0x6a.HWORD - this->y.HALF.HI) > 0xc)) { @@ -516,7 +515,7 @@ void sub_080873FC(void) { Entity* ent; SoundReq(SFX_APPARATE); - gRoomControls.cameraTarget = NULL; + gRoomControls.camera_target = NULL; while (ent = FindEntityByID(0x6, 0x1b, 0x6), ent != NULL) { DeleteEntity(ent); @@ -526,7 +525,7 @@ void sub_080873FC(void) { void sub_08087424(Entity* this, ScriptExecutionContext* context) { Entity* ent; - sub_080791D0(); + ResetPlayerAnimationAndAction(); ent = CreateObject(OBJECT_64, 0, 0); if (ent != NULL) { ent->parent = &gPlayerEntity; diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c index 12256c82..ea0dc245 100644 --- a/src/object/gyorgBossObject.c +++ b/src/object/gyorgBossObject.c @@ -64,20 +64,20 @@ void sub_080A1704(GyorgBossObjectEntity* this) { tmp->myHeap = heap; heap->female = (GyorgFemaleEntity*)tmp; tmp = CreateEnemy(GYORG_MALE, 0); - tmp->x.HALF.HI = gRoomControls.roomOriginX + 0x200; + tmp->x.HALF.HI = gRoomControls.origin_x + 0x200; #ifdef EU - tmp->y.HALF.HI = gRoomControls.roomOriginY + 0x380; + tmp->y.HALF.HI = gRoomControls.origin_y + 0x380; #else - tmp->y.HALF.HI = gRoomControls.roomOriginY + 0x330; + tmp->y.HALF.HI = gRoomControls.origin_y + 0x330; #endif tmp->myHeap = heap; heap->male1 = (GyorgMaleEntity*)tmp; tmp = CreateEnemy(GYORG_MALE, 1); - tmp->x.HALF.HI = gRoomControls.roomOriginX + 0x260; + tmp->x.HALF.HI = gRoomControls.origin_x + 0x260; #ifdef EU - tmp->y.HALF.HI = gRoomControls.roomOriginY + 0x360; + tmp->y.HALF.HI = gRoomControls.origin_y + 0x360; #else - tmp->y.HALF.HI = gRoomControls.roomOriginY + 0x310; + tmp->y.HALF.HI = gRoomControls.origin_y + 0x310; #endif tmp->myHeap = heap; heap->male2 = (GyorgMaleEntity*)tmp; @@ -89,13 +89,13 @@ void sub_080A1704(GyorgBossObjectEntity* this) { this->unk_7a = 0; this->unk_76 = 0xc0; this->unk_78 = 0xc0; - gScreenTransition.field_0x39 = 1; + gRoomTransition.field_0x39 = 1; gPlayerState.flags |= 0x20000; - gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; - gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; + gPlayerState.startPosX = gRoomControls.origin_x + 0x200; + gPlayerState.startPosY = gRoomControls.origin_y + 0x210; #ifndef EU SoundReq(0x80100000); - gArea.musicIndex = gArea.pMusicIndex; + gArea.bgm = gArea.queued_bgm; #endif } @@ -105,8 +105,8 @@ void sub_080A184C(GyorgBossObjectEntity* this) { this->unk_6c = 8; ((GyorgHeap*)super->myHeap)->female->base.health = 8; } - gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; - gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; + gPlayerState.startPosX = gRoomControls.origin_x + 0x200; + gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } void sub_080A189C(GyorgBossObjectEntity* this) { @@ -118,10 +118,10 @@ void sub_080A189C(GyorgBossObjectEntity* this) { this->unk_7b = 1; ((GyorgHeap*)super->myHeap)->male1->base.health = 0xC; SoundReq(0x128); - sub_08080964(0x96, 1); + InitScreenShake(0x96, 1); } - gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; - gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; + gPlayerState.startPosX = gRoomControls.origin_x + 0x200; + gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } void sub_080A190C(GyorgBossObjectEntity* this) { @@ -134,8 +134,8 @@ void sub_080A190C(GyorgBossObjectEntity* this) { sub_080A1D70(this, ((GyorgHeap*)super->myHeap)->female->base.animationState); ((GyorgHeap*)super->myHeap)->female->base.health = 0x18; } - gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; - gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; + gPlayerState.startPosX = gRoomControls.origin_x + 0x200; + gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } else { gPlayerState.startPosX = ((GyorgHeap*)super->myHeap)->male1->base.x.HALF.HI; gPlayerState.startPosY = ((GyorgHeap*)super->myHeap)->male1->base.y.HALF.HI; @@ -151,10 +151,10 @@ void sub_080A1990(GyorgBossObjectEntity* this) { this->unk_78 = 0x400; this->unk_7b = 1; SoundReq(0x128); - sub_08080964(0x96, 1); + InitScreenShake(0x96, 1); } - gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; - gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; + gPlayerState.startPosX = gRoomControls.origin_x + 0x200; + gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } void sub_080A19FC(GyorgBossObjectEntity* this) { @@ -167,8 +167,8 @@ void sub_080A19FC(GyorgBossObjectEntity* this) { sub_080A1D70(this, ((GyorgHeap*)super->myHeap)->female->base.animationState); ((GyorgHeap*)super->myHeap)->female->base.health = 0x18; } - gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; - gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; + gPlayerState.startPosX = gRoomControls.origin_x + 0x200; + gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } else { gPlayerState.startPosX = ((GyorgHeap*)super->myHeap)->male2->base.x.HALF.HI; gPlayerState.startPosY = ((GyorgHeap*)super->myHeap)->male2->base.y.HALF.HI; @@ -183,10 +183,10 @@ void sub_080A1A80(GyorgBossObjectEntity* this) { this->unk_6c = 0x104; this->unk_78 = 0x400; SoundReq(SFX_BOSS_DIE); - sub_08080964(0x96, 1); + InitScreenShake(0x96, 1); } - gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; - gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; + gPlayerState.startPosX = gRoomControls.origin_x + 0x200; + gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } void sub_080A1AE8(GyorgBossObjectEntity* this) { @@ -199,19 +199,19 @@ void sub_080A1AE8(GyorgBossObjectEntity* this) { ((GyorgHeap*)super->myHeap)->female->base.health = 0xC; } } - gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; - gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; + gPlayerState.startPosX = gRoomControls.origin_x + 0x200; + gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } void sub_080A1B4C(GyorgBossObjectEntity* this) { if (((GyorgHeap*)super->myHeap)->female->base.health == 0) { if (this->unk_6c != 0) { - sub_08080964(0x2d, 1); + InitScreenShake(0x2d, 1); SoundReq(SFX_BOSS_DIE); this->unk_78 = 0x600; } this->unk_6c = 0; - gScreenTransition.field_0x39 = 0; + gRoomTransition.field_0x39 = 0; if (sub_08079F8C() && gPlayerEntity.z.HALF.HI == 0) { super->action = 9; super->actionDelay = 0; @@ -221,17 +221,17 @@ void sub_080A1B4C(GyorgBossObjectEntity* this) { super->speed = 0x60; gPlayerState.flags &= ~0x20000; CopyPosition(&gPlayerEntity, super); - gRoomControls.cameraTarget = super; + gRoomControls.camera_target = super; SetPlayerControl(2); } } - gPlayerState.startPosX = gRoomControls.roomOriginX + 0x200; - gPlayerState.startPosY = gRoomControls.roomOriginY + 0x210; + gPlayerState.startPosX = gRoomControls.origin_x + 0x200; + gPlayerState.startPosY = gRoomControls.origin_y + 0x210; } void sub_080A1C04(GyorgBossObjectEntity* this) { if (this->unk_6e == 0) { - sub_0806F69C(super); + LinearMoveUpdate(super); sub_080A1E54(this); if (--super->field_0xf == 0) { SetFlag(0x7B); @@ -239,7 +239,7 @@ void sub_080A1C04(GyorgBossObjectEntity* this) { return; } if (super->field_0xf == 0x3C) { - DoFade(7, 4); + SetFade(7, 4); } return; } @@ -250,11 +250,11 @@ void sub_080A1C04(GyorgBossObjectEntity* this) { switch (this->unk_6e) { case 0xb4: SoundReq(SFX_BOSS_DIE); - sub_08080964(0x2d0, 2); + InitScreenShake(0x2d0, 2); break; case 0x12C: SoundReq(SFX_BOSS_DIE); - sub_08080964(0x4b, 1); + InitScreenShake(0x4b, 1); break; } } @@ -341,8 +341,8 @@ void sub_080A1E54(GyorgBossObjectEntity* this) { fx = CreateFx(super, 0x51, 0); if (fx) { u32 r = Random(); - fx->x.HALF.HI = gRoomControls.roomOriginX + 0x200 + (r & 0xf0) - 0x78; - fx->y.HALF.HI = gRoomControls.roomOriginY + 0x210 + ((r >> 8) & 0x70) - 0x38; + fx->x.HALF.HI = gRoomControls.origin_x + 0x200 + (r & 0xf0) - 0x78; + fx->y.HALF.HI = gRoomControls.origin_y + 0x210 + ((r >> 8) & 0x70) - 0x38; fx->spritePriority.b0 = 5; fx->collisionLayer = 2; UpdateSpriteForCollisionLayer(fx); @@ -355,8 +355,8 @@ void sub_080A1ED0(u32 unk0, u32 unk1, u32 unk2) { u32 i = 0; s16* p; u32 x, y; - x = gUnk_08124EF8[unk2 * 2] + gRoomControls.roomOriginX; - y = gUnk_08124EF8[unk2 * 2 + 1] + gRoomControls.roomOriginY; + x = gUnk_08124EF8[unk2 * 2] + gRoomControls.origin_x; + y = gUnk_08124EF8[unk2 * 2 + 1] + gRoomControls.origin_y; p = gUnk_08124FF0[unk0]; while (*p != 1) { GyorgChildEntity* tmp = (GyorgChildEntity*)CreateEnemy(GYORG_CHILD, unk1); @@ -409,8 +409,8 @@ void sub_080A1FF0(GyorgBossObjectEntity* this) { fx = CreateFx(super, 0x51, 0); if (fx) { u32 r = Random(); - fx->x.HALF.HI = gRoomControls.roomOriginX + 0x200 + (r & 0x78) - 0x3C; - fx->y.HALF.HI = gRoomControls.roomOriginY + 0x210 + (r & 0x78) - 0x3C; + fx->x.HALF.HI = gRoomControls.origin_x + 0x200 + (r & 0x78) - 0x3C; + fx->y.HALF.HI = gRoomControls.origin_y + 0x210 + (r & 0x78) - 0x3C; fx->spritePriority.b0 = 6; fx->collisionLayer = 1; UpdateSpriteForCollisionLayer(fx); @@ -418,12 +418,12 @@ void sub_080A1FF0(GyorgBossObjectEntity* this) { } } if (this->unk_7b) { - if (sub_0806FCB8(&gPlayerEntity, gRoomControls.roomOriginX + 0x200, gRoomControls.roomOriginY + 0x210, 0x100)) { + if (sub_0806FCB8(&gPlayerEntity, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, 0x100)) { if (super->actionDelay == 0) { super->actionDelay = 0x78; } else { if (super->actionDelay == 0x23) { - sub_08080964(0x1e, 0); + InitScreenShake(0x1e, 0); } } } else { diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c index b0fb32e1..9e8346b3 100644 --- a/src/object/heartContainer.c +++ b/src/object/heartContainer.c @@ -1,8 +1,8 @@ -#include "global.h" -#include "audio.h" +#include "sound.h" #include "entity.h" #include "flags.h" #include "functions.h" +#include "item.h" static void sub_0808E6A0(Entity*); static void sub_0808E6E4(Entity*); diff --git a/src/object/hiddenLadderDown.c b/src/object/hiddenLadderDown.c index 7d1c7abd..55831a80 100644 --- a/src/object/hiddenLadderDown.c +++ b/src/object/hiddenLadderDown.c @@ -1,7 +1,7 @@ #include "global.h" +#include "asm.h" #include "entity.h" #include "functions.h" -#include "room.h" #include "flags.h" extern void (*const gUnk_08122604[])(Entity*); diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index 79b8425c..a1495848 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -3,7 +3,7 @@ #include "flags.h" #include "room.h" #include "script.h" -#include "audio.h" +#include "sound.h" #include "object.h" #include "functions.h" #include "npc.h" @@ -58,8 +58,8 @@ void sub_080866D8(Entity* this) { entity = CreateObject(HOUSE_DOOR_EXT, prop->unk7, prop->unk6); if (entity) { entity->field_0x6c.HALF.LO = i; - entity->x.HALF.HI = gRoomControls.roomOriginX + prop->unk0 + 16; - entity->y.HALF.HI = gRoomControls.roomOriginY + prop->unk2 + 32; + entity->x.HALF.HI = gRoomControls.origin_x + prop->unk0 + 16; + entity->y.HALF.HI = gRoomControls.origin_y + prop->unk2 + 32; entity->parent = this; entity->field_0x68.HWORD = prop->unk0; entity->field_0x6a.HWORD = prop->unk2; @@ -168,7 +168,7 @@ void sub_0808692C(Entity* this) { static u8 sub_08086954(Entity* this) { if (sub_0800445C(this)) { if (sub_0806ED9C(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 && - (u16)gPlayerState.field_0x90.HALF.LO == 0x400 && gPlayerState.jumpStatus == 0) { + (u16)gPlayerState.field_0x90 == 0x400 && gPlayerState.jump_status == 0) { this->actionDelay--; } } else { diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index 2c025c77..35cb741b 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -1,10 +1,11 @@ #include "global.h" -#include "audio.h" +#include "sound.h" #include "entity.h" #include "flags.h" #include "player.h" #include "object.h" #include "functions.h" +#include "item.h" void sub_08081150(Entity*); u8 sub_0808147C(u32); @@ -17,7 +18,6 @@ void sub_080813BC(Entity*); void sub_080810FC(Entity*); bool32 CheckShouldPlayItemGetCutscene(Entity*); -extern u32 sub_080002D0(Entity*); extern u32 sub_080177A0(Entity*, Entity*); extern void GiveItem(u32, u32); @@ -88,7 +88,7 @@ void sub_08080F20(Entity* this) { DeleteThisEntity(); } - if (this->type != 0x60) { + if (this->type != ITEM_FAIRY) { this->spriteSettings.draw = 1; this->spritePriority.b1 = 3; this->spriteSettings.shadow = 0; @@ -98,16 +98,16 @@ void sub_08080F20(Entity* this) { this->health = 0xFF; this->hitbox = &gUnk_080FD1A8; switch (this->type) { - case 0x3f: - case 0x54: - case 0x55: - case 0x56: - case 0x57: - case 0x58: - case 0x5c: - case 0x5d: - case 0x5e: - case 0x5f: + case ITEM_SHELLS: + case ITEM_RUPEE1: + case ITEM_RUPEE5: + case ITEM_RUPEE20: + case ITEM_RUPEE50: + case ITEM_RUPEE100: + case ITEM_KINSTONE: + case ITEM_BOMBS5: + case ITEM_ARROWS5: + case ITEM_HEART: this->flags2 = 0x17; break; default: @@ -125,12 +125,11 @@ void sub_08080F20(Entity* this) { gUnk_0811E7E8[this->field_0x68.HALF.HI](this); } else { Entity* entity = CreateObject(FAIRY, 0x60, 0); - if (entity) { + if (entity != NULL) { entity->actionDelay = 0; if (this->actionDelay == 1) { entity->type2 = 2; } - CopyPosition(this, entity); DeleteThisEntity(); } @@ -154,12 +153,12 @@ void sub_080810A8(Entity* this) { } if (this->collisionLayer == 2) { - sub_08016A30(this); + ResolveCollisionLayer(this); } } void sub_080810FC(Entity* this) { - if (this->type != 0x5F) { + if (this->type != ITEM_HEART) { sub_08081598(this); } else { this->action = 2; @@ -189,7 +188,7 @@ void sub_08081188(Entity* this) { this->action = 2; COLLISION_ON(this); if (this->collisionLayer == 2) { - sub_08016A30(this); + ResolveCollisionLayer(this); } } @@ -213,10 +212,10 @@ void sub_080811EC(Entity* this) { if (this->field_0x68.HALF.HI != 6) { sub_080AEFE0(this); } else { - sub_0806F69C(this); + LinearMoveUpdate(this); } - sub_08003FC4(this, 0x2800); + GravityUpdate(this, 0x2800); if (this->zVelocity <= 0) { this->action = 2; COLLISION_ON(this); @@ -270,9 +269,10 @@ void sub_080812A8(Entity* this) { void sub_080812E8(Entity* this) { PlayerState* playerState = &gPlayerState; #ifdef EU - if ((playerState->swimState & 0x80) && sub_080177A0(this, &gPlayerEntity)) { + if ((playerState->swim_state & 0x80) && sub_080177A0(this, &gPlayerEntity)) { #else - if ((playerState->swimState & 0x80) && !(playerState->flags & 0x80) && sub_080177A0(this, &gPlayerEntity)) { + if ((playerState->swim_state & 0x80) && (playerState->flags & PL_MINISH) == 0 && + sub_080177A0(this, &gPlayerEntity)) { #endif sub_080810FC(this); } @@ -302,7 +302,7 @@ void sub_0808136C(Entity* this) { this->y.WORD = other->y.WORD; this->spriteOrientation.flipY = other->spriteOrientation.flipY; this->spriteRendering.b3 = other->spriteRendering.b3; - sub_08003FC4(this, 0x2800); + GravityUpdate(this, 0x2800); } else { sub_08081404(this, 1); } @@ -410,14 +410,14 @@ void sub_0808153C(Entity* this) { return; if (this->field_0x68.HALF.LO == 0) { - if (!sub_08003FC4(this, 0x1000) && !sub_0800442E(this)) { + if (!GravityUpdate(this, 0x1000) && !sub_0800442E(this)) { this->field_0x68.HALF.LO = 1; this->zVelocity = 0x1E000; sub_0808148C(this->type); UpdateSpriteForCollisionLayer(this); } } else { - if (!sub_08003FC4(this, 0x2800)) { + if (!GravityUpdate(this, 0x2800)) { this->field_0x68.HALF.LO = 2; sub_0808148C(this->type); } diff --git a/src/object/jailBars.c b/src/object/jailBars.c index da5844e5..84b44b61 100644 --- a/src/object/jailBars.c +++ b/src/object/jailBars.c @@ -2,7 +2,7 @@ #include "entity.h" #include "flags.h" #include "room.h" -#include "audio.h" +#include "sound.h" extern void sub_080A0960(Entity*, u32); extern void sub_0801AF18(u8*, u32, u32); diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index d84c12b6..61ebb19a 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -57,7 +57,7 @@ void sub_0808BF14(Entity* this) { } void sub_0808BF58(Entity* this) { - sub_08003FC4(this, 0x2000); + GravityUpdate(this, 0x2000); switch (this->subAction) { case 0: if (this->zVelocity <= 98303) { @@ -108,7 +108,7 @@ void sub_0808C01C(Entity* this, u32 r1) { type = 2; gArea.curPortalType = type; if (r1 == 1) { - if (((gPlayerState.flags & 0x20) != 0) && (gPlayerState.jumpStatus == 0)) { + if ((gPlayerState.flags & PL_USE_PORTAL) && (gPlayerState.jump_status == 0)) { gArea.field_0x18 = 2; } else { if (sub_08057810() != 0) { @@ -125,7 +125,7 @@ void sub_0808C01C(Entity* this, u32 r1) { } void sub_0808C0AC(Entity* this) { - sub_08003FC4(this, 0x2000); + GravityUpdate(this, 0x2000); switch (this->subAction) { case 0: if (this->zVelocity <= 98303) { diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c index 54716b5e..639ffa17 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -1,5 +1,6 @@ #include "global.h" -#include "audio.h" +#include "asm.h" +#include "sound.h" #include "entity.h" #include "room.h" #include "flags.h" @@ -83,7 +84,7 @@ void sub_0809EB30(Entity* this) { if (this->type2 != 0) { if ((this->direction & 0x80) == 0) { - sub_0806F69C(this); + LinearMoveUpdate(this); } puVar2 = &this->field_0x74.HWORD; if (!--*puVar2) { diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c index 31c5c3a8..5ec5fb84 100644 --- a/src/object/lilypadSmall.c +++ b/src/object/lilypadSmall.c @@ -6,6 +6,7 @@ extern void sub_080A2CC0(Entity*, Entity**, u16*); extern u16 gUnk_08123318[]; static void sub_08097B24(Entity* this); +static u32 sub_08097ADC(Entity* this); void LilypadSmall(Entity* this) { u32 rand; @@ -30,7 +31,7 @@ void LilypadSmall(Entity* this) { } } -u32 sub_08097ADC(Entity* this) { +static u32 sub_08097ADC(Entity* this) { if ((gPlayerState.flags & PL_MINISH) == 0) { return 0; } else if (EntityInRectRadius(this, &gPlayerEntity, 8, 8) == 0) { diff --git a/src/object/lockedDoor.c b/src/object/lockedDoor.c index fccc8b5f..9762c83c 100644 --- a/src/object/lockedDoor.c +++ b/src/object/lockedDoor.c @@ -1,10 +1,12 @@ #include "global.h" +#include "asm.h" #include "entity.h" #include "flags.h" -#include "audio.h" +#include "sound.h" #include "functions.h" #include "effects.h" -#include "overworld.h" +#include "game.h" +#include "common.h" void sub_08083338(Entity*); void sub_080834B4(Entity*); @@ -37,7 +39,6 @@ extern Hitbox gHitbox_2; extern u32 sub_080001DA(u32, u32); extern void sub_08078850(Entity*, u32, u32, u32); -extern void RequestPriorityDuration(Entity*, u32); typedef struct PACKED { s8 x; @@ -126,7 +127,7 @@ void sub_08083338(Entity* this) { if (!CheckFlags(this->field_0x86.HWORD)) { this->frameIndex |= 4; sub_080836DC(this, this->field_0x7c.BYTES.byte2, this->field_0x76.HWORD); - if (!CheckIsDungeon()) { + if (!AreaIsDungeon()) { this->action = 5; } else { this->action = 8; @@ -153,7 +154,7 @@ void sub_080834B4(Entity* this) { } void sub_080834EC(Entity* this) { - sub_0806F69C(this); + LinearMoveUpdate(this); if (--this->actionDelay == 0) { if (this->type & 0x80) { sub_08083638(this); @@ -171,7 +172,7 @@ void sub_08083518(Entity* this) { } void sub_08083540(Entity* this) { - sub_0806F69C(this); + LinearMoveUpdate(this); if (!--this->actionDelay) { if (this->type & 0x10) { this->type &= ~0x10; @@ -287,7 +288,7 @@ u32 sub_08083734(Entity* this, u32 unk0) { u32 sub_080837B0(Entity* this) { u32 tmp; - u32 tmp2 = gRoomControls.areaID; + u32 tmp2 = gRoomControls.area; if (tmp2 < 0x40) { switch (tmp2) { default: diff --git a/src/object/mask.c b/src/object/mask.c index 854cd5c2..4e9810c3 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -1,5 +1,4 @@ #include "object.h" -#include "structures.h" #include "functions.h" extern void (*MaskActionFuncs[])(Entity*); @@ -21,7 +20,7 @@ void sub_080929A4(Entity* this) { switch (this->type2 & 0xC0) { case 0x40: - field_0x0a = gScreenTransition.stairs_idx; + field_0x0a = gRoomTransition.stairs_idx; switch (field_0x0a) { case 0x44D ... 0x44F: diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c index 531d41b9..ed89d276 100644 --- a/src/object/metalDoor.c +++ b/src/object/metalDoor.c @@ -1,8 +1,9 @@ #include "global.h" +#include "asm.h" #include "entity.h" #include "room.h" #include "flags.h" -#include "audio.h" +#include "sound.h" #include "functions.h" #include "effects.h" @@ -50,7 +51,7 @@ void sub_080A074C(Entity* this) { u8 bVar1; Entity* ent; - sub_0806F69C(this); + LinearMoveUpdate(this); if (--this->actionDelay == 0) { this->action = 3; @@ -84,7 +85,7 @@ void sub_080A07BC(Entity* this) { void sub_080A07F0(Entity* this) { - sub_0806F69C(this); + LinearMoveUpdate(this); if (--this->actionDelay == 0) { DeleteThisEntity(); diff --git a/src/object/minecart.c b/src/object/minecart.c index 8f5e9360..fee9da56 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -7,18 +7,8 @@ extern u32 sub_08007DD6(u32, u32); extern void sub_08017744(Entity*); extern void sub_08091C0C(Entity*); -typedef struct { - u16 field_0x0; - u16 field_0x2; - u8 field_0x4; - u8 field_0x5; - u8 field_0x6; - u8 field_0x7; -} struct_030010EC; - extern void (*const gUnk_081223A8[])(Entity*); -extern struct_030010EC gUnk_030010EC[]; extern Hitbox gUnk_080FD310; extern const s8 gUnk_081223C8[]; @@ -30,14 +20,14 @@ void Minecart(Entity* this) { } void sub_080916EC(Entity* this) { - struct_030010EC* unk = &gUnk_030010EC[this->actionDelay]; + struct_030010EC* unk = &gRoomTransition.minecart_data[this->actionDelay]; *(struct_030010EC**)&this->cutsceneBeh.HWORD = unk; - if ((gRoomControls.roomID != unk->field_0x4) || (gPlayerState.flags & 0x1000) != 0) { + if ((gRoomControls.room != unk->field_0x4) || (gPlayerState.flags & PL_IN_MINECART) != 0) { DeleteThisEntity(); } - this->x.HALF.HI = gRoomControls.roomOriginX + ((unk->field_0x0 & 0x3f) << 4) + 8; - this->y.HALF.HI = gRoomControls.roomOriginY + ((unk->field_0x0 & 0xfc << 4) >> 2) + 8; + this->x.HALF.HI = gRoomControls.origin_x + ((unk->field_0x0 & 0x3f) << 4) + 8; + this->y.HALF.HI = gRoomControls.origin_y + ((unk->field_0x0 & 0xfc << 4) >> 2) + 8; this->animationState = unk->field_0x5; this->type2 = unk->field_0x6; this->action = 1; @@ -55,7 +45,6 @@ void sub_080916EC(Entity* this) { } void sub_080917DC(Entity* this) { - if ((this->bitfield & 0x7f) == 0x1d) { this->zVelocity = 0x2a000; this->action = 7; @@ -63,8 +52,8 @@ void sub_080917DC(Entity* this) { SoundReq(SFX_13B); } else { if (sub_0800445C(this) != 0) { - if (((gPlayerState.flags & 0x40080) == 0) && (gPlayerState.field_0x1c == 0) && - (gPlayerState.heldObject == 0) && (gPlayerState.jumpStatus == 0)) { + if (!((gPlayerState.flags & (PL_MINISH | PL_ROLLING)) || gPlayerState.field_0x1c || + gPlayerState.heldObject || gPlayerState.jump_status)) { this->actionDelay++; } else { this->actionDelay = 0; @@ -73,15 +62,15 @@ void sub_080917DC(Entity* this) { this->actionDelay = 0; } if (this->type2 == 0) { - if (8 < this->actionDelay) { - this->action = this->action + 1; - gPlayerState.jumpStatus = 0x81; - gPlayerState.flags |= 0x4000000; + if (this->actionDelay > 8) { + this->action++; + gPlayerState.jump_status = 0x81; + gPlayerState.flags |= PL_ENTER_MINECART; gPlayerEntity.zVelocity = 0x20000; gPlayerEntity.speed = 0x100; - gPlayerEntity.flags &= 0x7f; + gPlayerEntity.flags &= ~PL_MINISH; ResetPlayer(); - sub_0807A108(); + DeleteClones(); SoundReq(SFX_PLY_JUMP); } } else { @@ -95,14 +84,14 @@ void sub_080918A4(Entity* this) { gPlayerEntity.x.HALF.HI = this->x.HALF.HI; gPlayerEntity.y.HALF.HI = this->y.HALF.HI; if (gPlayerEntity.z.HALF.HI > -0x10) { - if ((s32)gPlayerEntity.zVelocity > -1) { + if (gPlayerEntity.zVelocity >= 0) { return; } gPlayerEntity.animationState = this->animationState << 1; - gPlayerState.flags = (gPlayerState.flags ^ 0x4000000) | 0x1000; + gPlayerState.flags = (gPlayerState.flags ^ PL_ENTER_MINECART) | PL_IN_MINECART; this->action++; this->field_0xf = 1; - this->flags |= ENT_20; + this->flags |= ENT_PERSIST; this->hitType = 0x97; this->field_0x3c = (gPlayerEntity.field_0x3c + 1) | 0x20; this->flags2 = gPlayerEntity.flags2; @@ -125,7 +114,7 @@ void sub_080919AC(Entity* this) { u32 uVar3; gRoomControls.unk5 = 7; - if ((gPlayerState.flags & 0x1000) == 0) { + if ((gPlayerState.flags & PL_IN_MINECART) == 0) { this->action = 1; return; } @@ -141,11 +130,11 @@ void sub_080919AC(Entity* this) { } else { COLLISION_ON(this); gPlayerEntity.speed = 0; - sub_0806F69C(this); + LinearMoveUpdate(this); CopyPosition(this, &gPlayerEntity); gPlayerEntity.spritePriority.b0 = this->spritePriority.b0 - 1; if (!sub_08091DDC(this)) { - if ((gScreenTransition.frameCount & 0xf) == 0) { + if ((gRoomTransition.frameCount & 0xf) == 0) { SoundReq(SFX_138); } @@ -158,25 +147,25 @@ void sub_080919AC(Entity* this) { gUnk_081223C8[this->animationState * 2 + 1]); iVar2 = sub_08007DD6(uVar3, gUnk_081223D8[this->animationState]); if (iVar2 == 0) { - this->direction = this->direction ^ 0x10; + this->direction = DirectionTurnAround(this->direction); this->animationState = this->animationState ^ 2; } else { switch (uVar3) { case 0x64: - this->flags &= ~ENT_20; + this->flags &= ~ENT_PERSIST; this->hitType = 1; this->field_0x3c = 0x47; this->hurtType = 0x44; this->flags2 = 0x80; this->action = 6; sub_08017744(this); - gPlayerState.jumpStatus = 0x41; - gPlayerState.flags = (gPlayerState.flags ^ 0x1000) | 0x4000000; + gPlayerState.jump_status = 0x41; + gPlayerState.flags = (gPlayerState.flags ^ PL_IN_MINECART) | PL_ENTER_MINECART; gPlayerEntity.zVelocity = 0x20000; gPlayerEntity.speed = 0x200; gPlayerEntity.animationState = this->animationState << 1; gPlayerEntity.direction = this->direction; - gPlayerEntity.flags |= 0x80; + gPlayerEntity.flags |= PL_MINISH; sub_08004168(this); InitAnimationForceUpdate(this, this->animationState + 0xc); SoundReq(SFX_PLY_VO4); diff --git a/src/object/minishLight.c b/src/object/minishLight.c index d7fc7bb4..a316e499 100644 --- a/src/object/minishLight.c +++ b/src/object/minishLight.c @@ -1,4 +1,3 @@ -#include "global.h" #include "entity.h" extern void (*const gUnk_081247F8[])(Entity*); diff --git a/src/object/minishSizedArchway.c b/src/object/minishSizedArchway.c index ad001c83..31162457 100644 --- a/src/object/minishSizedArchway.c +++ b/src/object/minishSizedArchway.c @@ -1,6 +1,5 @@ -#include "global.h" #include "entity.h" -#include "overworld.h" +#include "game.h" void MinishSizedArchway(Entity* this) { if (this->action == 0) { @@ -8,7 +7,7 @@ void MinishSizedArchway(Entity* this) { this->frameIndex = this->type; this->collisionLayer = 2; UpdateSpriteForCollisionLayer(this); - if (CheckIsDungeon()) { + if (AreaIsDungeon()) { this->spritePriority.b0 = 1; } } diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c index a92a887c..a4c9c296 100644 --- a/src/object/minishSizedEntrance.c +++ b/src/object/minishSizedEntrance.c @@ -1,5 +1,5 @@ #include "object.h" -#include "overworld.h" +#include "game.h" #include "functions.h" extern void (*const gUnk_08122254[])(Entity*); @@ -14,7 +14,7 @@ void sub_08090EC0(Entity* this) { this->spriteRendering.b3 = 3; this->spritePriority.b0 = 7; this->frameIndex = this->type2; - if (CheckIsDungeon()) { + if (AreaIsDungeon()) { this->frameIndex += 4; sub_080AE068(this); LoadFixedGFX(this, 0x184); @@ -30,7 +30,7 @@ void sub_08090F00(Entity* this) { } } if ((gPlayerState.flags & PL_MINISH) && EntityInRectRadius(this, &gPlayerEntity, 4, 4) && - (gPlayerEntity.z.HALF.HI == 0) && (((u16)gPlayerState.field_0x90.HALF.LO) & gUnk_0812225C[this->type2])) { + (gPlayerEntity.z.HALF.HI == 0) && (((u16)gPlayerState.field_0x90) & gUnk_0812225C[this->type2])) { DoExitTransition(GetCurrentRoomProperty(this->actionDelay)); } } diff --git a/src/object/object1A.c b/src/object/object1A.c index bdc3fe49..292a70f6 100644 --- a/src/object/object1A.c +++ b/src/object/object1A.c @@ -1,7 +1,7 @@ #include "object.h" #include "functions.h" -extern void sub_08086A6C(); +extern void sub_08086A6C(Entity*); extern void (*gUnk_081206C4[99])(Entity*); diff --git a/src/object/object1D.c b/src/object/object1D.c index f7343fbe..f1e13a00 100644 --- a/src/object/object1D.c +++ b/src/object/object1D.c @@ -1,4 +1,3 @@ -#include "global.h" #include "entity.h" extern void (*gUnk_081208A0[])(Entity*); diff --git a/src/object/object2A.c b/src/object/object2A.c index 9e36b439..5ef7ba3e 100644 --- a/src/object/object2A.c +++ b/src/object/object2A.c @@ -1,5 +1,5 @@ #include "global.h" -#include "audio.h" +#include "sound.h" #include "entity.h" #include "functions.h" #include "flags.h" diff --git a/src/object/object49.c b/src/object/object49.c index 125c6440..f1873fc2 100644 --- a/src/object/object49.c +++ b/src/object/object49.c @@ -1,5 +1,4 @@ #include "object.h" -#include "structures.h" #include "functions.h" static void sub_0808F2B0(Entity*); @@ -53,7 +52,7 @@ void sub_0808F0D0(Entity* this) { void sub_0808F14C(Entity* this) { sub_0808F2B0(this); - if (sub_08003FC4(this, 0x2000) == 0) { + if (GravityUpdate(this, 0x2000) == 0) { this->action++; SoundReq(SFX_WATER_SPLASH); } @@ -213,7 +212,7 @@ void sub_0808F498(Entity* this) { if (this->action != 0) { if (sub_0806F3E4(this)) { - if (gScreenTransition.frameCount % 16 == 0) { + if (gRoomTransition.frameCount % 16 == 0) { SoundReq(SFX_EF); } DeleteThisEntity(); diff --git a/src/object/object6A.c b/src/object/object6A.c index 9b674aea..6813f69c 100644 --- a/src/object/object6A.c +++ b/src/object/object6A.c @@ -2,9 +2,10 @@ #include "object.h" #include "area.h" #include "script.h" -#include "textbox.h" +#include "message.h" #include "functions.h" #include "screen.h" +#include "item.h" extern u8 gUnk_08114F30[]; extern u8 gUnk_08114F34[]; @@ -104,7 +105,7 @@ Object6ATypeAction sub_08096290; extern void sub_08080CB4(Entity*); extern u32 sub_080002B8(Entity*); -extern u32 sub_080040A8(Entity*); +extern u32 CheckOnScreen(Entity*); extern void sub_08078850(Entity*, u32, u32, u8*); void sub_08095754(Object6AEntity*); @@ -152,7 +153,7 @@ void sub_08094A90(Object6AEntity* this) { } void sub_08094AE8(Entity* this, ScriptExecutionContext* ctx) { - Object6AEntity* e = (Object6AEntity*)CreateObject(0x6A, 1, 0); + Object6AEntity* e = (Object6AEntity*)CreateObject(OBJECT_6A, 1, 0); if (e != NULL) { e->ctx = StartCutscene(&e->base, (void*)ctx->intVariable); } @@ -182,7 +183,7 @@ void sub_08094B80(Object6AEntity* this) { } void sub_08094B94(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x22, 0); + Entity* e = CreateObject(OBJECT_6A, 0x22, 0); if (e != NULL) { CopyPosition(&gPlayerEntity, e); e->z.HALF.HI = -48; @@ -194,7 +195,7 @@ void sub_08094B94(Object6AEntity* this) { } void sub_08094BE0(Entity* this) { - Entity* e = FindEntity(6, 0x6A, 6, 0x22, 0); + Entity* e = FindEntity(6, OBJECT_6A, 6, 0x22, 0); if (e != NULL) { CopyPosition(&gPlayerEntity, e); e->z.HALF.HI = -12; @@ -249,8 +250,8 @@ void sub_08094C88(Object6AEntity* this) { void sub_08094CDC(Object6AEntity* this) { Entity* e = CreateObject(0x6a, 3, 0x62); if (e != NULL) { - e->x.HALF.HI = gRoomControls.roomOriginX + 224; - e->y.HALF.HI = gRoomControls.roomOriginY + 600; + e->x.HALF.HI = gRoomControls.origin_x + 224; + e->y.HALF.HI = gRoomControls.origin_y + 600; SoundReq(324); } } @@ -265,8 +266,8 @@ void sub_08094D10(Object6AEntity* this) { void sub_08094D34(Object6AEntity* this) { Entity* e = CreateObject(0x6a, 0x15, 0xd); if (e != NULL) { - e->x.HALF.HI = gRoomControls.roomOriginX + 256; - e->y.HALF.HI = gRoomControls.roomOriginY + 600; + e->x.HALF.HI = gRoomControls.origin_x + 256; + e->y.HALF.HI = gRoomControls.origin_y + 600; SoundReq(324); } } @@ -298,8 +299,8 @@ void sub_08094D94(Object6AEntity* this) { void sub_08094DD8(Object6AEntity* this) { Entity* e = CreateObject(0x6a, 0x4, 0); if (e != NULL) { - e->x.HALF.HI = gRoomControls.roomOriginX + 240; - e->y.HALF.HI = gRoomControls.roomOriginY + 600; + e->x.HALF.HI = gRoomControls.origin_x + 240; + e->y.HALF.HI = gRoomControls.origin_y + 600; SoundReq(324); } } @@ -313,11 +314,11 @@ void sub_08094E0C(Object6AEntity* this) { void sub_08094E30(Object6AEntity* this) { if (super->type2 == 0) { - if ((gScreenTransition.frameCount % 32) == 0) { + if ((gRoomTransition.frameCount % 32) == 0) { Entity* e = CreateObject(0x6A, 5, 1); if (e != NULL) { - e->x.HALF.HI = gRoomControls.roomScrollX + (s32)Random() % DISPLAY_WIDTH; - e->y.HALF.HI = gRoomControls.roomScrollY + (s32)Random() % DISPLAY_HEIGHT; + e->x.HALF.HI = gRoomControls.scroll_x + (s32)Random() % DISPLAY_WIDTH; + e->y.HALF.HI = gRoomControls.scroll_y + (s32)Random() % DISPLAY_HEIGHT; } } return; @@ -355,7 +356,7 @@ void sub_08094E30(Object6AEntity* this) { case 3: super->z.WORD -= super->zVelocity; super->zVelocity -= 0x2000; - if (!sub_080040A8(super)) { + if (!CheckOnScreen(super)) { DeleteThisEntity(); } break; @@ -382,7 +383,7 @@ void sub_08094E30(Object6AEntity* this) { } void sub_08094F98(Object6AEntity* this) { - CreateObject(0x6A, 5, 0); + CreateObject(OBJECT_6A, 5, 0); } void sub_08094FA8(Object6AEntity* this) { @@ -398,7 +399,7 @@ void sub_08094FA8(Object6AEntity* this) { super->interactType = 0; super->action = 2; sub_080788E0(super); - gPlayerState.playerAction = 12; + gPlayerState.queued_action = PLAYER_EMPTYBOTTLE; gPlayerState.field_0x38 = 54; #ifndef EU SetPlayerControl(2); @@ -531,7 +532,7 @@ void sub_080951C4(Object6AEntity* this) { void sub_08095244(Object6AEntity* this) { if (super->type == 0) { - Entity* e = CreateObject(0x6A, 0xA, 0); + Entity* e = CreateObject(OBJECT_6A, 0xA, 0); if (e != NULL) { e->parent = super; PositionRelative(super, e, 0x100000, -0x100000); @@ -556,7 +557,7 @@ void sub_08095288(Object6AEntity* this) { } else { sub_0805EC9C(super, 0x100, 0x100, super->actionDelay << 8); super->actionDelay += 10; - sub_0806F69C(super); + LinearMoveUpdate(super); } } p = super->child; @@ -575,7 +576,7 @@ void sub_08095288(Object6AEntity* this) { } void sub_08095330(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0xB, 0); + Entity* e = CreateObject(OBJECT_6A, 0xB, 0); if (e != NULL) { super->child = e; e->child = super; @@ -622,7 +623,7 @@ void sub_080953A4(Object6AEntity* this) { } void sub_08095420(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0xC, 0); + Entity* e = CreateObject(OBJECT_6A, 0xC, 0); if (e != NULL) { PositionRelative(super, e, 0, -0x100000); ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); @@ -633,12 +634,12 @@ void nullsub_527(Object6AEntity* this) { } void sub_0809545C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* p = CreateObject(0x6A, 0xD, 0); + Entity* p = CreateObject(OBJECT_6A, 0xD, 0); Entity* e; if (p != NULL) { PositionRelative(super, p, 0, -0x100000); ((Object6AEntity*)p)->ctx = StartCutscene(p, (u16*)ctx->intVariable); - e = CreateObject(0x6A, 2, 0); + e = CreateObject(OBJECT_6A, 2, 0); if (e != NULL) { CopyPosition(p, e); e->parent = p; @@ -647,7 +648,7 @@ void sub_0809545C(Object6AEntity* this, ScriptExecutionContext* ctx) { } void sub_080954AC(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x1A, 0); + Entity* e = CreateObject(OBJECT_6A, 0x1A, 0); if (e != NULL) { CopyPosition(super, e); ((Object6AEntity*)e)->ctx = StartCutscene(e, &script_08015B14); @@ -695,7 +696,7 @@ void sub_080954DC(Object6AEntity* this) { break; } this->off += 4; - if (super->subAction != 0 && !sub_080040A8(super)) + if (super->subAction != 0 && !CheckOnScreen(super)) DeleteThisEntity(); if (super->direction & 0x80) super->spriteSettings.flipX = 0; @@ -738,7 +739,7 @@ void sub_080956B4(Object6AEntity* this) { } } GetNextFrame(super); - if ((super->type2 + gScreenTransition.frameCount) % 16 == 0) + if ((super->type2 + gRoomTransition.frameCount) % 16 == 0) sub_080957B4(this); p = super->parent; if (p != NULL) { @@ -759,7 +760,7 @@ void sub_080956B4(Object6AEntity* this) { } void sub_08095754(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0xF, super->type2); + Entity* e = CreateObject(OBJECT_6A, 0xF, super->type2); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -779,7 +780,7 @@ void sub_0809577C(Object6AEntity* this) { } void sub_080957B4(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x10, 0); + Entity* e = CreateObject(OBJECT_6A, 0x10, 0); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -799,7 +800,7 @@ void sub_080957DC(Object6AEntity* this) { } void sub_08095810(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x11, 0); + Entity* e = CreateObject(OBJECT_6A, 0x11, 0); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -860,7 +861,7 @@ void sub_08095954(Object6AEntity* this) { s8 x, y; } s8XY; - Entity* e = CreateObject(0x6A, 0x14, 0); + Entity* e = CreateObject(OBJECT_6A, 0x14, 0); if (e != NULL) { u32 tmp, x, y; e->parent = super; @@ -891,10 +892,10 @@ void sub_080959CC(Object6AEntity* this) { } void sub_08095A1C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0x16, 0); + Entity* e = CreateObject(OBJECT_6A, 0x16, 0); if (e != NULL) { - e->x.HALF.HI = gRoomControls.roomOriginX + 232; - e->y.HALF.HI = gRoomControls.roomOriginY + 312; + e->x.HALF.HI = gRoomControls.origin_x + 232; + e->y.HALF.HI = gRoomControls.origin_y + 312; e->z.HALF.HI = -4; e->collisionLayer = 2; ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); @@ -902,7 +903,7 @@ void sub_08095A1C(Object6AEntity* this, ScriptExecutionContext* ctx) { } void sub_08095A68(Object6AEntity* this) { - Entity* e = FindEntity(6, 0x6A, 6, 0x16, 0); + Entity* e = FindEntity(6, OBJECT_6A, 6, 0x16, 0); if (e != NULL) { e->action = 0xFF; } @@ -974,7 +975,7 @@ void sub_08095B48(Object6AEntity* this) { } void sub_08095BE0(Object6AEntity* this, u32 val) { - Entity* e = CreateObject(0x6A, 0x18, val); + Entity* e = CreateObject(OBJECT_6A, 0x18, val); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -997,7 +998,7 @@ void sub_08095C00(Object6AEntity* this) { } void sub_08095C48(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x19, 0); + Entity* e = CreateObject(OBJECT_6A, 0x19, 0); if (e != NULL) { super->child = e; e->parent = super; @@ -1022,7 +1023,7 @@ void sub_08095C68(Object6AEntity* this) { } void sub_08095CB0(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x1B, 0); + Entity* e = CreateObject(OBJECT_6A, 0x1B, 0); if (e != NULL) { super->child = e; e->parent = super; @@ -1052,7 +1053,7 @@ void sub_08095D30(Object6AEntity* this, u32 a2) { } void sub_08095D54(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0x1C, 0); + Entity* e = CreateObject(OBJECT_6A, 0x1C, 0); if (e != NULL) { CopyPosition(&gPlayerEntity, e); e->collisionLayer = 2; @@ -1061,7 +1062,7 @@ void sub_08095D54(Object6AEntity* this, ScriptExecutionContext* ctx) { } void sub_08095D8C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0x1D, 0); + Entity* e = CreateObject(OBJECT_6A, 0x1D, 0); if (e != NULL) { CopyPosition(super, e); ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); @@ -1090,15 +1091,15 @@ void sub_08095DBC(Object6AEntity* this) { super->zVelocity = 0x40000; super->speed = 0xC000; } - sub_08003FC4(super, super->speed); + GravityUpdate(super, super->speed); GetNextFrame(super); - if (!sub_080040A8(super)) + if (!CheckOnScreen(super)) DeleteThisEntity(); } } void sub_08095E7C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0x1E, 0); + Entity* e = CreateObject(OBJECT_6A, 0x1E, 0); if (e != NULL) { CopyPosition(super, e); ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); @@ -1107,7 +1108,7 @@ void sub_08095E7C(Object6AEntity* this, ScriptExecutionContext* ctx) { NONMATCH("asm/non_matching/object6A/sub_08095EAC.inc", void sub_08095EAC(Object6AEntity* this, ScriptExecutionContext* ctx)) { - Entity* e = CreateObject(0x6A, 0x1E, 1); + Entity* e = CreateObject(OBJECT_6A, 0x1E, 1); s32 x, y; if (e != NULL) { @@ -1186,7 +1187,7 @@ void sub_08096028(Object6AEntity* this) { type2 = 4; if (!CheckLocalFlagByBank(768, 122)) type2 = 3; - CreateObject(0x6A, 0x1F, type2); + CreateObject(OBJECT_6A, 0x1F, type2); } void sub_08096058(Object6AEntity* this) { @@ -1214,7 +1215,7 @@ void sub_08096084(Object6AEntity* this) { } void sub_080960C4(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(0x6A, 0x23, 0x49); + Entity* e = CreateObject(OBJECT_6A, 0x23, 0x49); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -1222,7 +1223,7 @@ void sub_080960C4(Object6AEntity* this, ScriptExecutionContext* ctx) { ResolveEntityBelow(super, e); ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); } - e = CreateObject(0x6A, 0x24, 0x4A); + e = CreateObject(OBJECT_6A, 0x24, 0x4A); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -1241,14 +1242,14 @@ void sub_08096168(Object6AEntity* this) { } GetNextFrame(super); sub_0806F62C(super, super->speed, super->direction); - if (!sub_080040A8(super)) + if (!CheckOnScreen(super)) DeleteThisEntity(); } void sub_080961B0(Object6AEntity* this) { int i; for (i = 0; i < 8; ++i) { - Entity* e = CreateObject(0x6A, 0x25, 0); + Entity* e = CreateObject(OBJECT_6A, 0x25, 0); if (e != NULL) { CopyPosition(super, e); e->direction = 32 * i; @@ -1264,21 +1265,21 @@ void sub_080961F4(Object6AEntity* this) { void sub_08096208(Object6AEntity* this, u32 x) { s8* p = &gUnk_08122B2E[x * 2]; - Entity* e = CreateObject(0x6A, 0x26, 0); + Entity* e = CreateObject(OBJECT_6A, 0x26, 0); if (e != NULL) { PositionRelative(super, e, p[0] << 16, p[1] << 16); } } void sub_0809623C(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x27, 0); + Entity* e = CreateObject(OBJECT_6A, 0x27, 0); if (e != NULL) { PositionRelative(super, e, 0, -0x100000); } } void sub_08096260(Object6AEntity* this) { - Entity* e = CreateObject(0x6A, 0x28, 0); + Entity* e = CreateObject(OBJECT_6A, 0x28, 0); if (e != NULL) { PositionRelative(super, e, 0, -0x100000); } @@ -1301,7 +1302,7 @@ void sub_0809629C(Object6AEntity* this, u32 type) { } ExecuteScriptForEntity(super, 0); HandleEntity0x82Actions(super); - sub_08003FC4(super, 0x1000); + GravityUpdate(super, 0x1000); tmp = super->type; super->type = type; sub_08080CB4(super); @@ -1309,11 +1310,11 @@ void sub_0809629C(Object6AEntity* this, u32 type) { } void sub_080962D8(Object6AEntity* this) { - DoFade(6, 0x100); + SetFade(6, 0x100); } void sub_080962E8(Object6AEntity* this) { - DoFade(7, 0x100); + SetFade(7, 0x100); } void sub_080962F8(Object6AEntity* this, ScriptExecutionContext* ctx) { diff --git a/src/object/object86.c b/src/object/object86.c index b5c9e60b..e6968b42 100644 --- a/src/object/object86.c +++ b/src/object/object86.c @@ -1,8 +1,6 @@ #include "object.h" -#include "functions.h" void sub_08099ECC(Entity*); -extern void RequestPriorityDuration(Entity*, u32); extern void sub_0805B390(u32); extern void (*const gUnk_081237F8[])(Entity*); @@ -69,7 +67,7 @@ void nullsub_534(Entity* this) { void sub_08099ECC(Entity* this) { this->subAction = 1; CopyPosition(this, &gPlayerEntity); - gPlayerState.playerAction = 3; + gPlayerState.queued_action = PLAYER_FALL; gPlayerState.field_0x34[4] = 0; gPlayerState.flags |= 0x8000; } diff --git a/src/object/objectA.c b/src/object/objectA.c index 8578c1be..37132e10 100644 --- a/src/object/objectA.c +++ b/src/object/objectA.c @@ -4,7 +4,7 @@ #include "flags.h" #include "object.h" #include "functions.h" -#include "overworld.h" +#include "game.h" extern Hitbox gHitbox_2; @@ -24,7 +24,7 @@ void ObjectA(Entity* this) { this->field_0x70.HALF.LO = uVar2; if (CheckFlags(this->field_0x86.HWORD) != 0) { SetTileType(*(u16*)&this->field_0x70.HALF.LO, COORD_TO_TILE(this), this->collisionLayer); - if ((gRoomControls.unk2 & 1) != 0) { + if ((gRoomControls.reload_flags & 1) != 0) { gUpdateVisibleTiles = 0; } DeleteThisEntity(); diff --git a/src/object/objectA2.c b/src/object/objectA2.c index c3ad215b..cc0e350a 100644 --- a/src/object/objectA2.c +++ b/src/object/objectA2.c @@ -40,9 +40,9 @@ void sub_0809F318(Entity* this) { } void sub_0809F374(Entity* this) { - sub_0806F69C(this); + LinearMoveUpdate(this); #ifndef EU - if (gSaveHeader->gameLanguage < 2) { + if (gSaveHeader->language < 2) { if (sub_080044EC(this, 0x2000) < 2) { this->z.WORD = 0; this->action = 2; diff --git a/src/object/objectA8.c b/src/object/objectA8.c index fbba13c3..8a347a1f 100644 --- a/src/object/objectA8.c +++ b/src/object/objectA8.c @@ -1,7 +1,7 @@ -#include "global.h" #include "entity.h" #include "player.h" #include "functions.h" +#include "item.h" extern void (*gUnk_08124824[])(Entity*); diff --git a/src/object/objectB2.c b/src/object/objectB2.c index 75150bab..b40c73b6 100644 --- a/src/object/objectB2.c +++ b/src/object/objectB2.c @@ -23,7 +23,7 @@ void ObjectB2(Entity* this) { InitializeAnimation(this, this->type); } this->speed = this->parent->speed; - sub_0806F69C(this); + LinearMoveUpdate(this); if (sub_080AE4CC(this->child, this->x.HALF.HI, this->y.HALF.HI, 9) != 0) { DeleteThisEntity(); } diff --git a/src/object/objectB5.c b/src/object/objectB5.c index 5aae8152..a93011ed 100644 --- a/src/object/objectB5.c +++ b/src/object/objectB5.c @@ -8,7 +8,7 @@ void ObjectB5(Entity* this) { this->action = 1; } #ifndef EU - gRoomControls.cameraTarget = this; + gRoomControls.camera_target = this; #endif PositionRelative(&gPlayerEntity, this, 0, -0x280000); } diff --git a/src/object/octorokBossObject.c b/src/object/octorokBossObject.c index 6e69a7db..a6e3a625 100644 --- a/src/object/octorokBossObject.c +++ b/src/object/octorokBossObject.c @@ -1,6 +1,6 @@ #include "functions.h" #include "object.h" -#include "overworld.h" +#include "game.h" extern void sub_0807B9B8(s32, s32, s32); @@ -38,7 +38,7 @@ enum OctorokBossObjectType { TYPE8, // OctorokBoss_Hit_SubAction1 TYPE9 // OctorokBoss_Hit_SubAction4 }; -#define GET_HELPER(this) (*(HelperStruct**)&this->cutsceneBeh) +#define GET_HELPER(this) (*(HelperStruct**)&(this)->cutsceneBeh) extern u32 sub_0806FC80(Entity*, Entity*, s32); @@ -127,8 +127,8 @@ void OctorokBossObject_Init(Entity* this) { this->type2 = this->parent->field_0x7c.BYTES.byte0; this->actionDelay = 4; this->field_0xf = 0; - this->field_0x82.HWORD = (this->x.HALF.HI - (gRoomControls.roomOriginX)) & 0x1f0; - this->field_0x80.HWORD = (this->y.HALF.HI - ((u32)gRoomControls.roomOriginY)) & 0x1f0; + this->field_0x82.HWORD = (this->x.HALF.HI - (gRoomControls.origin_x)) & 0x1f0; + this->field_0x80.HWORD = (this->y.HALF.HI - ((u32)gRoomControls.origin_y)) & 0x1f0; *(int*)&this->cutsceneBeh = ((s32)(this->field_0x82.HWORD - 0x10) >> 4) + (this->field_0x80.HWORD >> 4) * 0x1f; sub_0809A6F8(this->field_0x82.HWORD, this->field_0x80.HWORD, *(int*)&this->cutsceneBeh, this->type2); @@ -304,7 +304,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc", case 9: sub_08078B48(); if ((*(int*)&this->field_0x78)-- == 0) { - gRoomControls.cameraTarget = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity; DeleteThisEntity(); } break; diff --git a/src/object/palaceArchway.c b/src/object/palaceArchway.c index 13e6d3bb..f1c0abb9 100644 --- a/src/object/palaceArchway.c +++ b/src/object/palaceArchway.c @@ -14,5 +14,5 @@ void sub_0809F2A0(Entity* this) { SetTile(0x4069, COORD_TO_TILE(this), this->collisionLayer); } -void nullsub_537() { +void nullsub_537(Entity* this) { } diff --git a/src/object/pinwheel.c b/src/object/pinwheel.c index b44f5a8c..519b96a3 100644 --- a/src/object/pinwheel.c +++ b/src/object/pinwheel.c @@ -3,8 +3,6 @@ #include "flags.h" #include "object.h" -extern u32 ReadBit(u32*, u32); - extern u32 gUnk_020342F8; extern u16 gUnk_08125050[]; extern void (*gUnk_0812505C[])(Entity*); diff --git a/src/object/pot.c b/src/object/pot.c index dd645021..bf94a8be 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -1,12 +1,11 @@ #include "global.h" -#include "audio.h" +#include "sound.h" #include "entity.h" #include "flags.h" #include "player.h" #include "room.h" #include "object.h" #include "functions.h" -#include "effects.h" void sub_08082824(Entity*); static void sub_08082850(Entity*, Entity*); @@ -45,7 +44,7 @@ void sub_0808222C(Entity* this) { this->flags2 = 0x84; this->field_0x1c = 0x12; if (this->collisionLayer == 0) { - sub_08016A30(this); + ResolveCollisionLayer(this); } this->field_0x70.HALF.LO = sub_080001DA(COORD_TO_TILE(this), this->collisionLayer); @@ -175,7 +174,7 @@ void sub_08082614(Entity* this) { sub_0800445C(this); if (--this->actionDelay != 0xFF) { - sub_0806F69C(this); + LinearMoveUpdate(this); sub_08016A6C(this); return; } @@ -256,7 +255,7 @@ void sub_08082824(Entity* this) { this->spriteSettings.flipY = 1; } - if (sub_08003FC4(this, 0x2000) == 0) { + if (GravityUpdate(this, 0x2000) == 0) { sub_08082850(this, NULL); } } diff --git a/src/object/railtrack.c b/src/object/railtrack.c index 223a5603..d92a9546 100644 --- a/src/object/railtrack.c +++ b/src/object/railtrack.c @@ -1,5 +1,6 @@ #include "global.h" -#include "audio.h" +#include "asm.h" +#include "sound.h" #include "entity.h" #include "room.h" #include "flags.h" diff --git a/src/object/smoke.c b/src/object/smoke.c index d603ea1c..7fed0867 100644 --- a/src/object/smoke.c +++ b/src/object/smoke.c @@ -43,7 +43,7 @@ void sub_0808A484(Entity* this) { void sub_0808A4D0(Entity* this) { GetNextFrame(this); - sub_0806F69C(this); + LinearMoveUpdate(this); if (this->frame & 0x80) { DeleteEntity(this); } diff --git a/src/object/swordsmanNewsletter.c b/src/object/swordsmanNewsletter.c index 1cca2ba0..d71fd1f8 100644 --- a/src/object/swordsmanNewsletter.c +++ b/src/object/swordsmanNewsletter.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "textbox.h" +#include "message.h" extern void sub_080787B4(Entity*); diff --git a/src/object/thoughtBubble.c b/src/object/thoughtBubble.c index e90cfbd7..57ba5cae 100644 --- a/src/object/thoughtBubble.c +++ b/src/object/thoughtBubble.c @@ -1,6 +1,6 @@ #include "global.h" #include "entity.h" -#include "audio.h" +#include "sound.h" extern void (*const ThoughtBubble_Behaviors[])(Entity*); diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index 69db7173..fa58b1c3 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -1,10 +1,9 @@ #include "global.h" -#include "audio.h" +#include "sound.h" #include "entity.h" #include "flags.h" #include "player.h" #include "room.h" -#include "structures.h" #include "functions.h" #include "effects.h" @@ -36,7 +35,7 @@ void sub_0809E86C(Entity* this) { if (sub_0800419C(this, &gPlayerEntity, 0x30, 0x30)) { if (CheckGlobalFlag(EZERO_1ST)) { - if (((gScreenTransition.frameCount & 3) == 0)) { + if (((gRoomTransition.frameCount & 3) == 0)) { CreateSparkle(this); } } diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index df5a9ba2..3ed7ed2f 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -1,9 +1,6 @@ #include "global.h" #include "object.h" -#include "player.h" -#include "flags.h" -#include "overworld.h" -#include "audio.h" +#include "game.h" #include "functions.h" extern Hitbox gHitbox_1; @@ -11,7 +8,6 @@ extern Hitbox gHitbox_1; extern void sub_0807CAC8(u32); extern u32 sub_0807CAEC(u32); -void WarpPoint(Entity*); void sub_0808B474(Entity*); void sub_0808B530(Entity*); void sub_0808B564(Entity*); @@ -49,7 +45,7 @@ void sub_0808B474(Entity* this) { if (CheckFlags(this->field_0x86.HWORD)) { sub_0808B830(this); } else { - if (CheckIsDungeon() && sub_0807CAEC(this->type)) { + if (AreaIsDungeon() && sub_0807CAEC(this->type)) { sub_0808B830(this); } } @@ -67,7 +63,7 @@ void sub_0808B474(Entity* this) { void sub_0808B530(Entity* this) { if (CheckFlags(this->field_0x86.HWORD)) { sub_0808B830(this); - if (CheckIsDungeon()) { + if (AreaIsDungeon()) { sub_0807CAC8(this->type); } this->action = 2; @@ -148,17 +144,17 @@ void sub_0808B5E8(Entity* this) { void sub_0808B684(Entity* this) { u32 tmp; if (!--this->field_0xf) { - gScreenTransition.transitioningOut = 1; - gScreenTransition.transitionType = TRANSITION_DEFAULT; - gScreenTransition.player_status.area_next = this->field_0x7c.BYTES.byte0; - gScreenTransition.player_status.room_next = this->field_0x7c.BYTES.byte1; - gScreenTransition.player_status.start_pos.HALF.x = ((this->cutsceneBeh.HWORD & 0x3f) << 4) + 8; - gScreenTransition.player_status.start_pos.HALF.y = ((this->cutsceneBeh.HWORD & 0xfc0) >> 2) + 8; - gScreenTransition.player_status.layer = 0; - gScreenTransition.player_status.start_anim = 4; - gScreenTransition.player_status.spawn_type = 0; + gRoomTransition.transitioningOut = 1; + gRoomTransition.type = TRANSITION_DEFAULT; + gRoomTransition.player_status.area_next = this->field_0x7c.BYTES.byte0; + gRoomTransition.player_status.room_next = this->field_0x7c.BYTES.byte1; + gRoomTransition.player_status.start_pos_x = ((this->cutsceneBeh.HWORD & 0x3f) << 4) + 8; + gRoomTransition.player_status.start_pos_y = ((this->cutsceneBeh.HWORD & 0xfc0) >> 2) + 8; + gRoomTransition.player_status.layer = 0; + gRoomTransition.player_status.start_anim = 4; + gRoomTransition.player_status.spawn_type = 0; if (this->type == 2) { - gScreenTransition.transitionType = TRANSITION_FADE_WHITE_SLOW; + gRoomTransition.type = TRANSITION_FADE_WHITE_SLOW; } return; } @@ -212,7 +208,7 @@ 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) { if (this->actionDelay == 0 && gPlayerEntity.action == PLAYER_08072C9C) { - sub_080791D0(); + ResetPlayerAnimationAndAction(); } return 1; } @@ -224,7 +220,7 @@ void sub_0808B830(Entity* this) { this->action = 3; this->actionDelay = 0; this->spriteSettings.draw = 1; - tmp = CreateObject(0x34, 0, 0); + tmp = CreateObject(WARP_POINT, 0, 0); if (tmp) { tmp->field_0x70.BYTES.byte0 = 1; tmp->parent = this; diff --git a/src/object/well.c b/src/object/well.c index 86710ac6..dfc61a9c 100644 --- a/src/object/well.c +++ b/src/object/well.c @@ -1,4 +1,5 @@ #include "global.h" +#include "asm.h" #include "entity.h" #include "room.h" #include "player.h" diff --git a/src/object/windcrest.c b/src/object/windcrest.c index 3ebaef24..15828253 100644 --- a/src/object/windcrest.c +++ b/src/object/windcrest.c @@ -1,9 +1,8 @@ #include "global.h" -#include "audio.h" +#include "sound.h" #include "entity.h" #include "save.h" #include "script.h" -#include "functions.h" #include "effects.h" extern void sub_08078850(Entity*, u32, u32, u8*); |
