diff options
Diffstat (limited to 'src')
328 files changed, 3555 insertions, 2687 deletions
diff --git a/src/code_0805EC04.c b/src/code_0805EC04.c index dbcf312f..7892299d 100644 --- a/src/code_0805EC04.c +++ b/src/code_0805EC04.c @@ -58,10 +58,10 @@ void sub_0805ECEC(int param_1, u32 param_2, u32 param_3, u32 param_4) { temp[2] = param_4; } -void InitPlayerMacro(u32 param_1) { - gPlayerState.field_0x9c = param_1; - gPlayerState.field_0x98 = 0; - gPlayerState.field_0x9a = 0; +void InitPlayerMacro(PlayerMacroEntry* playerMacro) { + gPlayerState.playerInput.playerMacro = playerMacro; + gPlayerState.playerInput.playerMacroWaiting = 0; + gPlayerState.playerInput.playerMacroHeldKeys = 0; } ASM_FUNC("asm/non_matching/code_0805EC04/UpdatePlayerInput.inc", void UpdatePlayerInput()) @@ -74,29 +74,29 @@ u32 ConvInputToState(u32 keys) { result = 0; } if (keys & R_BUTTON) { - result |= 0x20; - result |= 0x8000; - result |= 0x80; + result |= PLAYER_INPUT_20; + result |= PLAYER_INPUT_8000; + result |= PLAYER_INPUT_80; } if (keys & A_BUTTON) { - result |= 0x8; - result |= 0x41; + result |= PLAYER_INPUT_8; + result |= PLAYER_INPUT_40 | PLAYER_INPUT_1; } if (keys & B_BUTTON) { - result |= 0x10; - result |= 0x2; + result |= PLAYER_INPUT_10; + result |= PLAYER_INPUT_2; } if (keys & DPAD_RIGHT) { - result |= 0x100; + result |= PLAYER_INPUT_RIGHT; } if (keys & DPAD_LEFT) { - result |= 0x200; + result |= PLAYER_INPUT_LEFT; } if (keys & DPAD_UP) { - result |= 0x400; + result |= PLAYER_INPUT_UP; } if (keys & DPAD_DOWN) { - result |= 0x800; + result |= PLAYER_INPUT_DOWN; } return result; } diff --git a/src/collision.c b/src/collision.c index 3482954f..cb63f494 100644 --- a/src/collision.c +++ b/src/collision.c @@ -297,7 +297,7 @@ void sub_080179EC(Entity* a1, Entity* a2) { Entity* sub_08017A90(Entity* a1, Entity* parent) { Entity* e; - e = (Entity*)CreateObject(OBJECT_99, 0, 0); + e = (Entity*)CreateObject(HIT_SWITCH, 0, 0); if (e != NULL) { e->animationState = (a1->direction >> 3) & 3; e->spriteOffsetX = a1->x.HALF.HI - parent->x.HALF.HI; @@ -384,7 +384,7 @@ s32 sub_08017B58(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) s32 sub_08017BBC(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if ((gPlayerState.flags & (PL_BUSY | PL_MINISH | PL_BURNING | PL_IN_MINECART)) == 0) { - Entity* e = CreateObject(OBJECT_42, 1, 0); + Entity* e = CreateObject(LINK_FIRE, 1, 0); if (e != NULL) { e->child = org; gPlayerState.flags |= PL_BURNING; diff --git a/src/common.c b/src/common.c index ecd82763..3568b425 100644 --- a/src/common.c +++ b/src/common.c @@ -291,7 +291,6 @@ void LoadGfxGroup(u32 group) { } } -// regalloc void sub_0801D898(void* dest, void* src, u32 word, u32 size) { u32 v6; u32 i; @@ -303,7 +302,8 @@ void sub_0801D898(void* dest, void* src, u32 word, u32 size) { size &= (short)~0x8000; do { - DmaSet(3, src, dest, word | 0x80000000) src += word * 2; + DmaCopy16(3, src, dest, word * 2); + src += word * 2; dest += v6 * 2; } while (--size); } @@ -344,8 +344,8 @@ void DispReset(bool32 refresh) { gMain.interruptFlag = 1; gUnk_03003DE0 = 0; gFadeControl.active = 0; - gScreen._6d = 0; - gScreen._6c = 0; + gScreen.vBlankDMA.readyBackup = FALSE; + gScreen.vBlankDMA.ready = FALSE; DmaStop(0); REG_DISPCNT = 0; ClearOAM(); @@ -516,7 +516,7 @@ void sub_0801E0E0(u32 textIndex) { void sub_0801E104(void) { gScreen.lcd.displayControl &= ~0x6000; - gScreen._6c = 0; + gScreen.vBlankDMA.ready = FALSE; } void sub_0801E120(void) { @@ -534,7 +534,9 @@ void sub_0801E154(u32 a1) { void sub_0801E160(u32 a1, u32 a2, u32 a3) { MemClear(&gUnk_02017AA0[gUnk_03003DE4[0]], sizeof(gUnk_02017AA0[gUnk_03003DE4[0]])); sub_0801E290(a1, a2, a3); - sub_0805622C((struct BgAffineDstData*)&gUnk_02017AA0[gUnk_03003DE4[0]], 0x4000040, 0xA2600001); + SetVBlankDMA((u16*)&gUnk_02017AA0[gUnk_03003DE4[0]], (u16*)REG_ADDR_WIN0H, + ((DMA_ENABLE | DMA_START_HBLANK | DMA_16BIT | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_RELOAD) << 16) + + 0x1); } void sub_0801E1B8(u32 a1, u32 a2) { @@ -549,7 +551,9 @@ void sub_0801E1EC(u32 a1, u32 a2, u32 a3) { MemClear(&gUnk_02017AA0[gUnk_03003DE4[0]], sizeof(gUnk_02017AA0[gUnk_03003DE4[0]])); sub_0801E24C(a3, 0); sub_0801E290(a1, a2, a3); - sub_0805622C((struct BgAffineDstData*)&gUnk_02017AA0[gUnk_03003DE4[0]], 0x4000040, 0xA2600001); + SetVBlankDMA((u16*)&gUnk_02017AA0[gUnk_03003DE4[0]], (u16*)REG_ADDR_WIN0H, + ((DMA_ENABLE | DMA_START_HBLANK | DMA_16BIT | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_RELOAD) << 16) + + 0x1); } ASM_FUNC("asm/non_matching/common/sub_0801E24C.inc", void sub_0801E24C(u32 a1, u32 a2)); diff --git a/src/debug.c b/src/debug.c index f7f70c8a..8a8fc291 100644 --- a/src/debug.c +++ b/src/debug.c @@ -48,10 +48,10 @@ void sub_0805FA98(void) { switch (gInput.newKeys) { case DPAD_UP: - gGenericMenu.unk10.a[1] -= 1; + gGenericMenu.unk10.a[1]--; break; case DPAD_DOWN: - gGenericMenu.unk10.a[1] += 1; + gGenericMenu.unk10.a[1]++; break; case L_BUTTON: gGenericMenu.unk10.a[0] ^= 1; diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index b39be6e5..86d5d1db 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -147,12 +147,12 @@ void AcroBandit_OnGrabbed(Entity* this) { } void AcroBandit_Type0(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { + static void (*const AcroBandit_Type0_Actions[])(Entity*) = { AcroBandit_Type0Action0, AcroBandit_Type0Action1, AcroBandit_Type0Action2, AcroBandit_Type0Action3, AcroBandit_Type0Action4, AcroBandit_Type0Action5, AcroBandit_Type0Action6, AcroBandit_Type0Action7, AcroBandit_Type0Action8, }; - actionFuncs[this->action](this); + AcroBandit_Type0_Actions[this->action](this); } void AcroBandit_Type0Action0(Entity* this) { @@ -350,12 +350,12 @@ static void sub_08031E48(Entity* this, Entity* child) { } void AcroBandit_Type1(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { + static void (*const AcroBandit_Type1_Actions[])(Entity*) = { AcroBandit_Type1Init, AcroBandit_Type1Action1, AcroBandit_Type1Action2, AcroBandit_Type1Action3, AcroBandit_Type1Action4, AcroBandit_Type1Action5, AcroBandit_Type1Action6, AcroBandit_Type1Action7, AcroBandit_Type1Action8, AcroBandit_Type1Action9, }; - actionFuncs[this->action](this); + AcroBandit_Type1_Actions[this->action](this); } void AcroBandit_Type1Init(Entity* this) { diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index 732b07b6..bfc8f092 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -289,7 +289,7 @@ void sub_0802CBC4(Entity* this) { } FreeCarryEntity(this); - ent = CreateObjectWithParent(this, OBJECT_20, 0, 0); + ent = CreateObjectWithParent(this, SMOKE_PARTICLE, 0, 0); if (ent != NULL) { ent->collisionLayer = this->collisionLayer; } diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 8583b78d..a3e4ea60 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -588,7 +588,7 @@ void sub_0802B048(Entity* this) { if (this->parent->next != NULL) { this->parent->field_0x80.HALF.HI = 0; } - ent = CreateObjectWithParent(this, OBJECT_20, 0, 0); + ent = CreateObjectWithParent(this, SMOKE_PARTICLE, 0, 0); if (ent != NULL) { this->collisionLayer = 1; } else { diff --git a/src/enemy/bombarossa.c b/src/enemy/bombarossa.c index fb2c8f31..8ef13341 100644 --- a/src/enemy/bombarossa.c +++ b/src/enemy/bombarossa.c @@ -42,7 +42,7 @@ void Bombarossa_OnCollision(BombarossaEntity* this) { Entity* ent; switch (super->contactFlags & 0x7f) { default: - ent = CreateObject(OBJECT_20, 0, 0); + ent = CreateObject(SMOKE_PARTICLE, 0, 0); if (ent != NULL) { CopyPosition(super, ent); } diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 62e5e0ff..115a2e08 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -405,12 +405,12 @@ NONMATCH("asm/non_matching/chuchuBoss/sub_08025DD8.inc", void sub_08025DD8(Chuch if (tmp) { tmp->child = super; } - tmp = CreateObjectWithParent(super, OBJECT_49, 1, 0); + tmp = CreateObjectWithParent(super, CHUCHU_BOSS_START_PARTICLE, 1, 0); if (tmp) { tmp->child = super->child; } if (super->type != 0) { - tmp = CreateObjectWithParent(super, OBJECT_49, 3, 0); + tmp = CreateObjectWithParent(super, CHUCHU_BOSS_START_PARTICLE, 3, 0); if (tmp) { tmp->child = super->child; } @@ -603,7 +603,7 @@ void sub_080263B4(ChuchuBossEntity* this) { this->unk_7c = 0x78; this->unk_84->unk_03++; } else { - CreateObjectWithParent(super, OBJECT_49, super->type2, 0); + CreateObjectWithParent(super, CHUCHU_BOSS_START_PARTICLE, super->type2, 0); } } } @@ -926,7 +926,7 @@ void sub_080269CC(ChuchuBossEntity* this) { pEVar7->unk_74.HALF.HI += 3; InitScreenShake(0x20, 0); SoundReq(SFX_10B); - entity = (GenericEntity*)CreateObjectWithParent(super, OBJECT_15, 0, 0); + entity = (GenericEntity*)CreateObjectWithParent(super, CHUCHU_BOSS_PARTICLE, 0, 0); if (entity != NULL) { entity->base.spriteIndex = 0xc9; #ifdef EU @@ -962,7 +962,7 @@ void sub_080269CC(ChuchuBossEntity* this) { pEVar7->unk_78.HALF.HI = 0x98; this->unk_7c = gUnk_080CC278[Random() & 3]; this->unk_84->unk_03++; - entity = (GenericEntity*)CreateObjectWithParent(&pEVar7->base, OBJECT_49, 10, 0); + entity = (GenericEntity*)CreateObjectWithParent(&pEVar7->base, CHUCHU_BOSS_START_PARTICLE, 10, 0); if (entity != NULL) { *(u32*)&entity->cutsceneBeh = this->unk_7c; } @@ -1702,7 +1702,7 @@ bool32 sub_08027AA4(ChuchuBossEntity* this) { switch (super->contactFlags & 0x7f) { case 19: SoundReq(SFX_WATER_SPLASH); - CreateObjectWithParent(super, OBJECT_49, 9, super->type2); + CreateObjectWithParent(super, CHUCHU_BOSS_START_PARTICLE, 9, super->type2); SoundReq(SFX_155); pHelper = this->unk_84; super->iframes = 3; @@ -1823,7 +1823,7 @@ void sub_08027C9C(ChuchuBossEntity* this, u32 param_2) { } Entity* sub_08027D20(ChuchuBossEntity* this) { - Entity* r4 = CreateObjectWithParent(super, OBJECT_15, 0, 0); + Entity* r4 = CreateObjectWithParent(super, CHUCHU_BOSS_PARTICLE, 0, 0); if (r4 != NULL) { r4->spriteIndex = 0xc9; #ifdef EU diff --git a/src/enemy/dust.c b/src/enemy/dust.c index 464cd41d..d4babd2f 100644 --- a/src/enemy/dust.c +++ b/src/enemy/dust.c @@ -277,7 +277,7 @@ void sub_08044498(DustEntity* this) { u32 xdiff, ydiff; uVar4 = COORD_TO_TILE(&gPlayerEntity); - tmp = (gPlayerState.field_0x92 & 0xf00); + tmp = (gPlayerState.playerInput.field_0x92 & 0xf00); if (tmp != this->unk_75 || uVar4 != this->unk_76) { this->unk_75 = tmp; this->unk_76 = uVar4; @@ -320,7 +320,7 @@ void sub_08044550(DustEntity* this) { void sub_080445C0(DustEntity* this) { Entity* pEVar1; - pEVar1 = CreateObject(OBJECT_21, 1, 1); + pEVar1 = CreateObject(DIRT_PARTICLE, 1, 1); if (pEVar1 != NULL) { CopyPosition(super, pEVar1); } diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index 6ae9ba74..db1bf3da 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -17,9 +17,9 @@ void sub_08045178(Entity*, Entity*, int, int); void FireballGuy_OnTick(Entity*); void FireballGuy_OnCollision(Entity*); void FireballGuy_OnGrabbed(Entity*); -void sub_080453E8(Entity*); -void sub_08045430(Entity*); -void sub_08045454(Entity*); +void FireballGuy_Init(Entity*); +void FireballGuy_Action1(Entity*); +void FireballGuy_Action2(Entity*); static void (*const FireballGuy_Functions[])(Entity*) = { FireballGuy_OnTick, FireballGuy_OnCollision, GenericKnockback, GenericDeath, GenericConfused, FireballGuy_OnGrabbed, @@ -30,12 +30,12 @@ void FireballGuy(Entity* this) { } void FireballGuy_OnTick(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_080453E8, - sub_08045430, - sub_08045454, + static void (*const FireballGuy_Actions[])(Entity*) = { + FireballGuy_Init, + FireballGuy_Action1, + FireballGuy_Action2, }; - actionFuncs[this->action](this); + FireballGuy_Actions[this->action](this); } void FireballGuy_OnCollision(Entity* this) { @@ -49,7 +49,7 @@ void FireballGuy_OnCollision(Entity* this) { void FireballGuy_OnGrabbed(Entity* this) { } -void sub_080453E8(Entity* this) { +void FireballGuy_Init(Entity* this) { this->action = 1; this->timer = 0; this->spriteSettings.draw = 1; @@ -61,7 +61,7 @@ void sub_080453E8(Entity* this) { sub_08045524(this); } -void sub_08045430(Entity* this) { +void FireballGuy_Action1(Entity* this) { ProcessMovement2(this); GetNextFrame(this); if (GravityUpdate(this, Q_8_8(24.0)) == 0) @@ -69,7 +69,7 @@ void sub_08045430(Entity* this) { } /* Split FireballGuy into new ones */ -void sub_08045454(Entity* this) { +void FireballGuy_Action2(Entity* this) { // Entity count per form static const u8 typeEntityCount[4] = { 2, 3, 4, 5 }; static const PosOffset gUnk_080D1810[4] = { { 6, 0 }, { -6, 0 }, { 0, 6 }, { 0, -6 } }; diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index 030e9b25..69935171 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -377,7 +377,7 @@ void sub_08037B10(GibdoEntity* this) { void Gibdo_CreateObjects(GibdoEntity* this) { Entity* object; - object = CreateObject(OBJECT_2A, 3, 0); + object = CreateObject(FLAME, 3, 0); if (object != NULL) { object->type2 = super->timer; object->spritePriority.b0 = 3; @@ -387,7 +387,7 @@ void Gibdo_CreateObjects(GibdoEntity* this) { } this->field_0x80 = object; - object = CreateObject(OBJECT_2A, 3, 0); + object = CreateObject(FLAME, 3, 0); if (object != NULL) { object->type2 = super->timer; object->spritePriority.b0 = 3; @@ -397,7 +397,7 @@ void Gibdo_CreateObjects(GibdoEntity* this) { } this->field_0x84 = object; - object = CreateObject(OBJECT_2A, 3, 0); + object = CreateObject(FLAME, 3, 0); if (object != NULL) { object->type2 = super->timer; object->spritePriority.b0 = 3; diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index 1b8cdc30..a95d0607 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -537,7 +537,7 @@ NONMATCH("asm/non_matching/gleerok/sub_0802D86C.inc", void sub_0802D86C(GleerokE super->timer = 0; do { - CreateObjectWithParent(super, OBJECT_67, 0, super->timer); + CreateObjectWithParent(super, GLEEROK_PARTICLE, 0, super->timer); } while (++super->timer < 8); SoundReq(SFX_150); @@ -1021,7 +1021,7 @@ void sub_0802E1D0(GleerokEntity* this) { InitScreenShake(240, 0); } else { for (this->unk_7c.HALF_U.LO = 0; this->unk_7c.HALF_U.LO < 4; this->unk_7c.HALF_U.LO++) { - CreateObjectWithParent(super, OBJECT_67, 1, this->unk_7c.HALF_U.LO); + CreateObjectWithParent(super, GLEEROK_PARTICLE, 1, this->unk_7c.HALF_U.LO); } this->unk_74 = 0; this->unk_75 = 0x10; diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 731404a8..42c07766 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -617,13 +617,13 @@ void sub_080473F0(GyorgMaleEntity* this) { if (tmp2 < -1) { super->direction -= 2; } else { - super->direction -= 1; + super->direction--; } } else { if (tmp2 > 1) { super->direction += 2; } else { - super->direction += 1; + super->direction++; } } } @@ -1105,9 +1105,9 @@ u32 sub_08047F68(GyorgMaleEntity* this) { approx += 2; } if (distSquared < gUnk_080D1C04[approx]) { - approx -= 1; + approx--; } else { - approx += 1; + approx++; } if (distSquared < gUnk_080D1C04[approx]) { s32 tmp = gUnk_080D1C04[approx - 1]; diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c index d1cbd490..3ef48b9e 100644 --- a/src/enemy/keaton.c +++ b/src/enemy/keaton.c @@ -12,12 +12,12 @@ extern Entity* gUnk_020000B0; void Keaton_OnTick(Entity*); void Keaton_OnCollision(Entity*); void Keaton_OnGrabbed(Entity*); -void sub_08032468(Entity*); -void sub_0803248C(Entity*); -void sub_080324CC(Entity*); -void sub_080324FC(Entity*); -void sub_08032574(Entity*); -void sub_080325C4(Entity*); +void Keaton_Init(Entity*); +void Keaton_Action1(Entity*); +void Keaton_Action2(Entity*); +void Keaton_Action3(Entity*); +void Keaton_Action4(Entity*); +void Keaton_Action5(Entity*); static void (*const Keaton_Functions[])(Entity*) = { Keaton_OnTick, Keaton_OnCollision, GenericKnockback, GenericDeath, GenericConfused, Keaton_OnGrabbed, @@ -41,10 +41,10 @@ void Keaton(Entity* this) { } void Keaton_OnTick(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_08032468, sub_0803248C, sub_080324CC, sub_080324FC, sub_08032574, sub_080325C4, + static void (*const Keaton_Actions[])(Entity*) = { + Keaton_Init, Keaton_Action1, Keaton_Action2, Keaton_Action3, Keaton_Action4, Keaton_Action5, }; - actionFuncs[this->action](this); + Keaton_Actions[this->action](this); } void Keaton_OnCollision(Entity* this) { @@ -69,7 +69,7 @@ void Keaton_OnCollision(Entity* this) { void Keaton_OnGrabbed(Entity* this) { } -void sub_08032468(Entity* this) { +void Keaton_Init(Entity* this) { sub_0804A720(this); this->animationState = 0; InitAnimationForceUpdate(this, 0); @@ -77,7 +77,7 @@ void sub_08032468(Entity* this) { sub_08032740(this); } -void sub_0803248C(Entity* this) { +void Keaton_Action1(Entity* this) { if (!sub_080325E8(this) && !sub_0803271C(this)) { this->timer--; if (this->timer == 0) { @@ -90,7 +90,7 @@ void sub_0803248C(Entity* this) { } } -void sub_080324CC(Entity* this) { +void Keaton_Action2(Entity* this) { if (!sub_080325E8(this)) { UpdateAnimationSingleFrame(this); if (this->frame & ANIM_DONE) { @@ -100,7 +100,7 @@ void sub_080324CC(Entity* this) { } } -void sub_080324FC(Entity* this) { +void Keaton_Action3(Entity* this) { if (this->timer != 0) { this->timer--; if (this->timer == 0) { @@ -128,7 +128,7 @@ void sub_080324FC(Entity* this) { } } -void sub_08032574(Entity* this) { +void Keaton_Action4(Entity* this) { if (this->child && (this->child->contactFlags & 0x80)) { sub_0803275C(this); return; @@ -145,7 +145,7 @@ void sub_08032574(Entity* this) { } } -void sub_080325C4(Entity* this) { +void Keaton_Action5(Entity* this) { this->timer--; if ((this->timer == 0) && !sub_080325E8(this)) { sub_08032784(this); diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index e6cf088c..757bb843 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -182,7 +182,7 @@ void sub_0803A274(Entity* this) { pEVar1 = CreateEnemy(MAZAAL_BRACELET, 2); pEVar1->parent = this; *(Entity**)&this->field_0x74 = pEVar1; - pEVar1 = CreateObject(OBJECT_7E, 1, 0); + pEVar1 = CreateObject(MAZAAL_OBJECT, 1, 0); pEVar1->parent = this; pEVar1->child = this->child; PositionRelative(this->parent, this, Q_16_16(16.0), Q_16_16(32.0)); @@ -193,7 +193,7 @@ void sub_0803A274(Entity* this) { pEVar1 = CreateEnemy(MAZAAL_BRACELET, 3); pEVar1->parent = this; *(Entity**)&this->field_0x74 = pEVar1; - pEVar1 = CreateObject(OBJECT_7E, 2, 0); + pEVar1 = CreateObject(MAZAAL_OBJECT, 2, 0); pEVar1->parent = this; pEVar1->child = this->child; this->spriteSettings.flipX = 1; diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index 39b500a7..1d247091 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -138,7 +138,7 @@ void sub_08033F3C(Entity* this) { InitializeAnimation(this, 0); pEVar1 = CreateEnemy(MAZAAL_HEAD, 1); pEVar1->parent = this; - pEVar2 = CreateObject(OBJECT_7E, 0, 0); + pEVar2 = CreateObject(MAZAAL_OBJECT, 0, 0); pEVar2->parent = this; if (gRoomTransition.field_0x39 == 0) { this->action = 0xd; diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c index 0ecc6cd4..cf313f3e 100644 --- a/src/enemy/octorokBoss.c +++ b/src/enemy/octorokBoss.c @@ -1058,7 +1058,7 @@ void OctorokBoss_SetAttackTimer(OctorokBossEntity* this) { this->unk_80 = 0; attackPatterns = OctorokBoss_Phase4AttackPatterns[this->phase4AttackPattern]; this->currentAttack = attackPatterns[this->nextAttackIndex]; - this->nextAttackIndex += 1; + this->nextAttackIndex++; if (this->currentAttack != END_OF_ATTACK_PATTERN) { return; } diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 5969fc6d..822dc777 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -58,7 +58,7 @@ void Pesto_OnCollision(Entity* this) { this->z.HALF.HI = -0x10; this->field_0x82.HALF.LO = 0; this->field_0x78.HWORD = -0x10; - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; /* fallthrough */ case 2: this->field_0x82.HALF.HI &= ~0x80; @@ -337,8 +337,8 @@ void sub_080244E8(Entity* this) { case 0: if (--this->timer == 0) { if (sub_080B1B44(COORD_TO_TILE(this), 1) == 0) { - this->field_0x80.HALF.LO += 1; - this->field_0x82.HALF.LO += 1; + this->field_0x80.HALF.LO++; + this->field_0x82.HALF.LO++; this->subtimer = 0; this->speed = 0; } else { @@ -426,7 +426,7 @@ void sub_080244E8(Entity* this) { if (EntityInRectRadius(this, this->child, 6, 6)) { Entity* ent; - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->timer = 12; this->field_0x82.HALF.HI &= ~0x80; ent = this->child; @@ -480,7 +480,7 @@ void sub_080244E8(Entity* this) { } break; case 1 ... 2: - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->timer = 192; this->subtimer = 8; this->speed = 0x80; diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index 1311fcd7..1ded4e9a 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -84,7 +84,7 @@ void Puffstool_OnCollide(Entity* this) { break; default: if (this->hitType == 0x82 && this->iframes < 0) { - Entity* ent = CreateObject(OBJECT_21, 2, 0); + Entity* ent = CreateObject(DIRT_PARTICLE, 2, 0); if (ent != NULL) { ent->spritePriority.b0 = 3; CopyPosition(this, ent); @@ -335,7 +335,7 @@ void sub_080255AC(Entity* this) { tmp = Random() & 0xf; if (tmp < 8) { - tmp -= 1; + tmp--; } tmp -= 7; @@ -551,7 +551,7 @@ void sub_08025B18(Entity* this) { for (; i < 9; i++, offset += 2) { sub_08025AB8((((x + offset[0]) >> 4) & 0x3fU) | ((((y + offset[1]) >> 4) & 0x3fU) << 6), layer); - ent = CreateObject(OBJECT_21, 2, 0); + ent = CreateObject(DIRT_PARTICLE, 2, 0); if (ent != NULL) { PositionRelative(this, ent, Q_16_16(offset[0]), Q_16_16(offset[1])); ent->x.HALF.HI &= -0x10; @@ -565,7 +565,7 @@ void sub_08025B18(Entity* this) { void sub_08025BD4(Entity* this) { if (this->field_0x82.HALF.LO && (this->frame & 1) == 0) { - Entity* ent = CreateObject(OBJECT_21, 0, 0); + Entity* ent = CreateObject(DIRT_PARTICLE, 0, 0); if (ent != NULL) { PositionRelative(this, ent, Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 0]), Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 1])); diff --git a/src/enemy/spinyBeetle.c b/src/enemy/spinyBeetle.c index 54de6f62..fe57c230 100644 --- a/src/enemy/spinyBeetle.c +++ b/src/enemy/spinyBeetle.c @@ -235,7 +235,7 @@ void sub_08033B44(SpinyBeetleEntity* this) { this->tileIndex = GetTileIndex(this->tile, super->collisionLayer); if (this->tileIndex != 0x4022) { - stop += 1; + stop++; } else { switch (DirectionRound(super->direction) >> 2) { case 0: diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c index 95ed60f7..3226609d 100644 --- a/src/enemy/treeItem.c +++ b/src/enemy/treeItem.c @@ -60,7 +60,7 @@ void TreeItem(Entity* this) { } break; case 0 ...(FAIRY_INDEX - 1): - itemEntity = CreateObject(OBJECT_96, 0x7, gTreeItemDrops[this->field_0x68.HALF.LO]); + itemEntity = CreateObject(GRAVEYARD_KEY, 0x7, gTreeItemDrops[this->field_0x68.HALF.LO]); if (itemEntity) { CopyPosition(this, itemEntity); itemEntity->y.HALF.HI += 16; diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index d20adbf2..8e69fd33 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -486,12 +486,12 @@ static void sub_08042B20(Entity* this) { entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; if ((-0xa <= entity->z.HALF.HI) && ((entity->spriteSettings.draw) == 1)) { if (i == 0) { - object = CreateObject(OBJECT_AF, 0, 0); + object = CreateObject(VAATI3_ARM, 0, 0); if (object != NULL) { object->parent = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; } *(Entity**)&((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->field_0x68 = object; - object = CreateObject(OBJECT_AF, 2, 0); + object = CreateObject(VAATI3_ARM, 2, 0); if (object != NULL) { CopyPosition(((VaatiArm_HeapStruct*)this->myHeap)->entities[4], object); } @@ -582,7 +582,7 @@ static void sub_08042D24(Entity* this) { this->subAction = 2; this->hitType = 0x3d; ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->hitType = 0x3d; - entity = CreateObject(OBJECT_AF, 1, 0); + entity = CreateObject(VAATI3_ARM, 1, 0); if (entity != NULL) { entity->parent = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; } @@ -602,7 +602,7 @@ static void sub_08042D6C(Entity* this) { if (i != 2) { entity->flags = entity->flags | ENT_COLLIDE; } - if ((entity->spriteSettings.draw == 0u) && (object = CreateObject(OBJECT_AF, 2, 0), object != NULL)) { + if ((entity->spriteSettings.draw == 0u) && (object = CreateObject(VAATI3_ARM, 2, 0), object != NULL)) { CopyPosition(entity, object); SoundReq(SFX_166); } @@ -796,7 +796,7 @@ static void sub_08043130(Entity* this) { for (i = 1; i < 4; i++) { ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i]; if (ptr->unk04.HALF.HI != 0) { - ptr->unk04.HALF.HI -= 1; + ptr->unk04.HALF.HI--; } } } else { @@ -1276,9 +1276,9 @@ static void sub_08043C40(Entity* this, VaatiArm_HeapStruct1* heapStruct) { iVar3 = (u8*)(int)((VaatiArm_HeapStruct*)this->myHeap) + offset; if (puVar6[i] != iVar3[0xc]) { if (puVar6[i] < iVar3[0xc]) { - iVar3[0xc] -= 1; + iVar3[0xc]--; } else { - iVar3[0xc] += 1; + iVar3[0xc]++; } } } @@ -1412,7 +1412,7 @@ static void sub_08043EB8(Entity* this) { pEVar4->collisionFlags = pEVar4->collisionFlags & 0xef; pEVar4->hitType = 0x3a; pEVar4->hitbox = (Hitbox*)&gUnk_080FD450; - pEVar4 = CreateObject(OBJECT_AF, 0, 0); + pEVar4 = CreateObject(VAATI3_ARM, 0, 0); if (pEVar4 != NULL) { pEVar4->parent = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; } diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c index 3bf2b7f4..3a99ae35 100644 --- a/src/enemy/vaatiEyesMacro.c +++ b/src/enemy/vaatiEyesMacro.c @@ -181,7 +181,7 @@ void VaatiEyesMacroFunction0Type2(Entity* this) { } } this->y.HALF.HI++; - this->spriteOffsetY -= 1; + this->spriteOffsetY--; } void VaatiEyesMacroFunction0Type3(Entity* this) { diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 23c820bf..5e3ccd6b 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -186,21 +186,21 @@ void VaatiTransfiguredType0Action1(Entity* this) { break; case 0: if (--this->timer == 0) { - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->speed = 0x180; this->timer = 20; } break; case 1: if (--this->timer == 0) { - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->speed = 0xc0; this->timer = 12; } break; case 2: if (--this->timer == 0) { - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->speed = 0; if (this->animationState < 2) { this->timer = (Random() & 0x7f) + 64; @@ -240,7 +240,7 @@ void VaatiTransfiguredType0Action1(Entity* this) { if (--this->field_0x82.HALF.LO == 0) { this->field_0x82.HALF.LO = 4; - object = CreateObject(OBJECT_9B, 0, ((this->direction + 0x12) & 0x1c) >> 2); + object = CreateObject(VAATI2_PARTICLE, 0, ((this->direction + 0x12) & 0x1c) >> 2); if (object != NULL) { object->parent = this; object->x.HALF.HI += (Random() & 0xf) - 7; @@ -347,7 +347,7 @@ void VaatiTransfiguredType0Action3(Entity* this) { this->field_0x86.HALF.LO = 0; sub_080408EC(this); } else { - if (((this->timer & 1) != 0) && (pEVar3 = CreateObject(OBJECT_9B, 1, 0xff), pEVar3 != NULL)) { + if (((this->timer & 1) != 0) && (pEVar3 = CreateObject(VAATI2_PARTICLE, 1, 0xff), pEVar3 != NULL)) { pEVar3->parent = this; CopyPosition(this, pEVar3); pEVar3->x.HALF.HI += (Random() & 0xf) - 7; @@ -376,7 +376,7 @@ void VaatiTransfiguredType0Action4(Entity* this) { switch (this->field_0x80.HALF.LO) { case 0: if (--this->timer == 0) { - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->field_0x74.HALF.LO = 0; this->timer = 128; this->subtimer = 0; @@ -387,7 +387,7 @@ void VaatiTransfiguredType0Action4(Entity* this) { case 1: if (GravityUpdate(this, Q_8_8(40)) != 0) break; - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; switch (this->cutsceneBeh.HALF.LO) { case 1: case 3: @@ -409,7 +409,7 @@ void VaatiTransfiguredType0Action4(Entity* this) { break; case 2: if (--this->timer == 0) { - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->timer = gUnk_080D0ABF[((u32)this->animationState << 1 | 1)]; } else { if ((this->timer & 7) == 0) { @@ -444,7 +444,7 @@ void VaatiTransfiguredType0Action5(Entity* this) { switch (this->field_0x80.HALF.LO) { case 0: if (--this->timer == 0) { - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->timer = 64; if (1 < this->animationState) { this->timer = 128; @@ -454,7 +454,7 @@ void VaatiTransfiguredType0Action5(Entity* this) { break; case 1: if (--this->timer == 0) { - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->timer = gUnk_080D0ABF[(this->animationState << 1 | 1)]; } else { if (this->subtimer) { @@ -497,7 +497,7 @@ void VaatiTransfiguredType0Action6(Entity* this) { switch (this->field_0x80.HALF.LO) { case 0: if (--this->timer == 0) { - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->timer = 128; if (1 < this->animationState) { this->subtimer = 1; @@ -506,7 +506,7 @@ void VaatiTransfiguredType0Action6(Entity* this) { break; case 1: if (--this->timer == 0) { - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->timer = gUnk_080D0ABF[(this->animationState << 1) | 1]; } else { if (this->subtimer) { @@ -746,7 +746,7 @@ void VaatiTransfiguredType4Action1(Entity* this) { } } else { if (this->field_0x80.HALF.LO == 0) { - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->spriteSettings.draw = 1; } if (--this->timer == 0) { @@ -781,7 +781,7 @@ void VaatiTransfiguredType5Action1(Entity* this) { if (this->parent->action != 6) { return; } - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; this->spriteSettings.draw = 1; InitializeAnimation(this, 1); break; @@ -815,7 +815,7 @@ void VaatiTransfiguredType5Action2(Entity* this) { if (this->field_0x80.HALF.LO == 0) { if (this->parent->parent->action != 6) { if ((this->frame & ANIM_DONE) != 0) { - this->field_0x80.HALF.LO += 1; + this->field_0x80.HALF.LO++; InitializeAnimation(this, 3); } } @@ -904,7 +904,7 @@ void sub_08040770(Entity* this) { if (EntityWithinDistance(this, tmp5, tmp6, 0x1c)) { if (this->animationState != 2) { if (tmp & 8) { - tmp2 += 1; + tmp2++; } else { tmp2 += 3; } @@ -936,7 +936,7 @@ void sub_08040770(Entity* this) { } else { if (this->field_0x86.HALF.HI & 0x7f) { if (this->field_0x86.HALF.HI & 0x80) { - tmp2 += 1; + tmp2++; } else { tmp2 += 3; } @@ -952,7 +952,7 @@ void sub_08040770(Entity* this) { } this->field_0x86.HALF.HI = tmp3; if (tmp3 & 0x80) { - tmp2 += 1; + tmp2++; } else { tmp2 += 3; } diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c index 2f6a632e..f56a6eb0 100644 --- a/src/enemy/vaatiTransfiguredEye.c +++ b/src/enemy/vaatiTransfiguredEye.c @@ -65,7 +65,7 @@ void VaatiTransfiguredEye_OnCollision(Entity* this) { if (this->field_0x80.HALF.HI == 0) { this->action = 3; - this->field_0x80.HALF.HI += 1; + this->field_0x80.HALF.HI++; InitializeAnimation(this, (this->type << 3) | (this->timer + 2)); InitializeAnimation(this->parent, (this->parent->type << 3) | (this->timer + 2)); } @@ -80,7 +80,7 @@ void VaatiTransfiguredEye_OnCollision(Entity* this) { if (this->timer != 0 && (pEVar4->field_0x80.HALF.HI != 0)) { pEVar4->field_0x76.HALF.LO |= (1 << this->type2); if (this->cutsceneBeh.HALF.HI == 0) { - this->cutsceneBeh.HALF.HI += 1; + this->cutsceneBeh.HALF.HI++; InitializeAnimation(this, this->type << 3 | 6); InitializeAnimation(this->parent, this->parent->type << 3 | 6); } diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index af1851c0..3f91afd9 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -327,7 +327,7 @@ void VaatiWrathType0Action5(Entity* this) { if (this->field_0x78.HALF.HI == 0) { if (this->subAction == 2) { if ((gRoomTransition.field_0x39 & 3) == 0) { - object = CreateObject(OBJECT_B5, 0, 0); + object = CreateObject(VAATI3_PLAYER_OBJECT, 0, 0); if (object != NULL) { object->parent = this; ((VaatiWrathHeapStruct*)this->myHeap)->object5b = object; @@ -639,10 +639,10 @@ void sub_08041D14(Entity* this) { this->timer--; } else { if (gEntCount < 0x46) { - pEVar1 = CreateObject(OBJECT_B6, 0, 0); + pEVar1 = CreateObject(VAATI3_DEATH, 0, 0); pEVar1->parent = this; this->child = pEVar1; - pEVar1 = CreateObject(OBJECT_B6, 1, 0); + pEVar1 = CreateObject(VAATI3_DEATH, 1, 0); pEVar1->parent = this; this->subAction = 3; this->timer = 150; @@ -680,7 +680,7 @@ void sub_08041D84(Entity* this) { } void sub_08041E20(Entity* this) { - this->subtimer += 1; + this->subtimer++; sub_08041E78(this); GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); if (gFadeControl.active == 0) { @@ -1052,7 +1052,7 @@ void VaatiWrathType2(Entity* this) { InitializeAnimation(this, 0x12); } sub_0806FA90(((VaatiWrathHeapStruct*)this->myHeap)->type0, this, 0, -1); - this->spriteOffsetY += 1; + this->spriteOffsetY++; if (this->animIndex == 0x12) { uVar1 = GetFacingDirection(this, &gPlayerEntity); this->x.HALF.HI = gUnk_080D0EB0[uVar1] + this->x.HALF.HI; @@ -1069,6 +1069,6 @@ void VaatiWrathType3(Entity* this) { InitializeAnimation(this, 0x1c); } sub_0806FA90(((VaatiWrathHeapStruct*)this->myHeap)->type0, this, 0, -1); - this->spriteOffsetY += 1; + this->spriteOffsetY++; GetNextFrame(this); } diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index cdd7298b..2563f82c 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -33,7 +33,7 @@ void sub_0802A250(Entity* this) { InitializeAnimation(this, 0); UpdateSpriteForCollisionLayer(this); - ent = CreateObject(OBJECT_66, 0, 0); + ent = CreateObject(WATER_DROP_OBJECT, 0, 0); if (ent != NULL) { ent->parent = this; } diff --git a/src/enemy/wizzrobeIce.c b/src/enemy/wizzrobeIce.c index aade807b..a467200d 100644 --- a/src/enemy/wizzrobeIce.c +++ b/src/enemy/wizzrobeIce.c @@ -30,7 +30,7 @@ void WizzrobeIce_OnCollision(WizzrobeEntity* this) { } EnemyFunctionHandlerAfterCollision(super, WizzrobeIce_Functions); if (super->contactFlags == 0x87) { - Entity* obj = CreateObject(OBJECT_2A, 3, 0); + Entity* obj = CreateObject(FLAME, 3, 0); if (obj != NULL) { obj->spritePriority.b0 = 3; obj->spriteOffsetY = -4; @@ -99,7 +99,7 @@ void WizzrobeIce_Action2(WizzrobeEntity* this) { case 0: switch (--super->timer) { case 0: - this->timer2 += 1; + this->timer2++; super->timer = 56; super->subtimer = 0; super->child->spriteSettings.draw = 0; diff --git a/src/enemy/wizzrobeWind.c b/src/enemy/wizzrobeWind.c index 8c157cde..ed28e49f 100644 --- a/src/enemy/wizzrobeWind.c +++ b/src/enemy/wizzrobeWind.c @@ -37,7 +37,7 @@ void WizzrobeWind_OnCollision(WizzrobeEntity* this) { } EnemyFunctionHandlerAfterCollision(super, WizzrobeWind_Functions); if (super->contactFlags == 0x87) { - Entity* obj = CreateObject(OBJECT_2A, 3, 0); + Entity* obj = CreateObject(FLAME, 3, 0); if (obj != NULL) { obj->spritePriority.b0 = 3; obj->spriteOffsetY = -4; diff --git a/src/enemyUtils.c b/src/enemyUtils.c index ae4f3462..cd0747cb 100644 --- a/src/enemyUtils.c +++ b/src/enemyUtils.c @@ -53,7 +53,7 @@ bool32 EnemyInit(GenericEntity* this) { if ((this->field_0x6c.HALF.HI & 0x20) != 0) { u32 uVar4 = gUnk_080D3E74[super->id >> 3] >> ((super->id & 7) << 1) & 3; if (uVar4 != 0) { - Entity* object = CreateObject(OBJECT_A9, uVar4 - 1, 0); + Entity* object = CreateObject(MULLDOZER_SPAWN_POINT, uVar4 - 1, 0); if (object != NULL) { object->timer = super->flags; object->subtimer = super->spriteSettings.draw; @@ -128,7 +128,7 @@ void CreateDeathFx(GenericEntity* parent, u32 parentId, u32 fixedItem) { int tmp = parent->base.gustJarState & 2; if (tmp == 0) { sub_08049CF4(&(parent->base)); - gSave.unk50 += 1; + gSave.unk50++; parent->base.gustJarState |= 2; parent->base.timer = 255; SetDefaultPriority(&(parent->base), 3); diff --git a/src/enterPortalSubtask.c b/src/enterPortalSubtask.c index 5e616656..5987267e 100644 --- a/src/enterPortalSubtask.c +++ b/src/enterPortalSubtask.c @@ -49,7 +49,7 @@ void sub_0804AAD4(void) { MemClear(&gUnk_02018EB0, 0x28); gUnk_02018EB0.unk_14 = NULL; EraseAllEntities(); - CreateObject(OBJECT_3D, gArea.portal_type, 0); + CreateObject(MINISH_PORTAL_CLOSEUP, gArea.portal_type, 0); gArea.filler[8]++; } diff --git a/src/fileselect.c b/src/fileselect.c index df25bdc9..15af7964 100644 --- a/src/fileselect.c +++ b/src/fileselect.c @@ -5,17 +5,17 @@ * @brief File select task */ +#include "common.h" #include "fileselect.h" +#include "functions.h" +#include "game.h" +#include "item.h" #include "main.h" -#include "common.h" -#include "screen.h" #include "menu.h" #include "message.h" #include "object.h" -#include "functions.h" +#include "screen.h" #include "subtask.h" -#include "item.h" -#include "game.h" #include "ui.h" // copy, erase, start @@ -99,7 +99,7 @@ extern void (*const gUnk_080FC9B0[])(void); extern void (*const gUnk_080FC9BC[])(void); extern void (*const gUnk_080FC9C8[])(void); -static void sub_08050624(u32); +static void ResetEmptyOrDeletedSaveFile(u32); static void sub_0805066C(void); static void HideButtonR(void); static void ShowButtonR(void); @@ -216,10 +216,10 @@ static void HandleFileScreenEnter(void) { gUI.lastState = 8; SetFileSelectState(STATE_NONE); InitDMA(); - sub_08050624(0); - sub_08050624(1); - sub_08050624(2); - sub_08056208(); + ResetEmptyOrDeletedSaveFile(0); + ResetEmptyOrDeletedSaveFile(1); + ResetEmptyOrDeletedSaveFile(2); + InitVBlankDMA(); sub_080503A8(0x5); LoadPaletteGroup(0x9); for (i = 0; i < 26; i++) { @@ -247,18 +247,18 @@ static void HandleFileScreenExit(void) { } } -static void sub_08050624(u32 idx) { - SaveFile* saveFile = &gMapDataBottomSpecial.saves[idx]; - int status = ReadSaveFile(idx, saveFile); +static void ResetEmptyOrDeletedSaveFile(u32 index) { + SaveFile* saveFile = &gMapDataBottomSpecial.saves[index]; + int status = ReadSaveFile(index, saveFile); switch (status) { case SAVE_DELETED: - SetFileStatusDeleted(idx); + SetFileStatusDeleted(index); // fallthrough case SAVE_EMPTY: - sub_0805194C(idx); + ResetSaveFile(index); break; } - gMapDataBottomSpecial.saveStatus[idx] = status; + gMapDataBottomSpecial.saveStatus[index] = status; } static void sub_0805066C(void) { @@ -378,14 +378,14 @@ void sub_08050888(void) { if (!gFadeControl.active) { switch (gMapDataBottomSpecial.saveStatus[gMapDataBottomSpecial.unk7]) { case SAVE_EMPTY: - sub_0805194C(gMapDataBottomSpecial.unk7); + ResetSaveFile(gMapDataBottomSpecial.unk7); gChooseFileState.subState = 2; break; case SAVE_VALID: gChooseFileState.subState = 2; break; default: - sub_0805194C(gMapDataBottomSpecial.unk7); + ResetSaveFile(gMapDataBottomSpecial.unk7); CreateDialogBox(0, gMapDataBottomSpecial.unk7 + 1); gChooseFileState.timer = 30; gChooseFileState.subState = 1; @@ -834,7 +834,7 @@ void sub_08050FFC(void) { switch (HandleSave(0)) { case SAVE_ERROR: gMenu.transitionTimer = 30; - sub_0805194C(gMapDataBottomSpecial.unk6); + ResetSaveFile(gMapDataBottomSpecial.unk6); CreateDialogBox(9, 0); case SAVE_OK: SetMenuType(3); @@ -903,7 +903,7 @@ void sub_080513C0(void) { case 0: break; case -1: - sub_0805194C(gMapDataBottomSpecial.unk6); + ResetSaveFile(gMapDataBottomSpecial.unk6); CreateDialogBox(6, 0); gMenu.transitionTimer = 30; gMenu.overlayType = 2; @@ -1083,7 +1083,7 @@ void sub_080515D4(void) { void sub_080516E0(void) { if (HandleSave(1)) { - sub_0805194C(gMapDataBottomSpecial.unk6); + ResetSaveFile(gMapDataBottomSpecial.unk6); sub_08050AFC(gMapDataBottomSpecial.unk6); gMenu.transitionTimer = 2; SetFileSelectState(0); @@ -1192,7 +1192,7 @@ void sub_08051874(void) { SetFileSelectState(0); break; case -1: - sub_0805194C(gMapDataBottomSpecial.unk7); + ResetSaveFile(gMapDataBottomSpecial.unk7); CreateDialogBox(3, 0); gMenu.transitionTimer = 30; SetMenuType(3); @@ -1223,12 +1223,12 @@ void HandleFileStart(void) { } } -void sub_0805194C(u32 save_idx) { +void ResetSaveFile(u32 save_idx) { SaveFile* save; gMapDataBottomSpecial.saveStatus[save_idx] = 0; save = &gMapDataBottomSpecial.saves[save_idx]; - MemClear(save, sizeof(*save)); + MemClear(save, sizeof(SaveFile)); save->msg_speed = 1; save->brightness = 1; save->stats.health = 24; @@ -2682,7 +2682,7 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) { droptable.s.arrows += 3; } if (gSave.stats.rupees <= 10) { - droptable.s.rupee5 += 1; + droptable.s.rupee5++; } ptr2 = &gDroptableModifiers[DROPTABLE_NONE]; r0 = gSave.stats.hasAllFigurines; diff --git a/src/interrupts.c b/src/interrupts.c index d98fbf23..5b1a6a52 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -22,15 +22,10 @@ void ram_IntrMain(void); static void sub_080171F0(void); static void HandlePlayerLife(Entity* this); -struct { - u8 ready; - u16* src; - u16* dest; - u32 size; -} extern gUnk_02022730; +extern VBlankDMA gVBlankDMA; void sub_08016CA8(BgSettings* bg); -void sub_08016BF8(void); +void PerformVBlankDMA(void); void DispCtrlSet(void); void DummyIntr(void) { @@ -49,10 +44,10 @@ void VBlankIntr(void) { m4aSoundVSync(); if (gMain.interruptFlag == 0) { DispCtrlSet(); - DmaCopy32(0, &gScreen._6c, &gUnk_02022730, 16); + DmaCopy32(0, &gScreen.vBlankDMA, &gVBlankDMA, sizeof(VBlankDMA)); gMain.interruptFlag = 1; } - sub_08016BF8(); + PerformVBlankDMA(); INTR_CHECK |= 1; } @@ -61,13 +56,14 @@ void HBlankIntr(void) { m4aSoundMain(); } -void sub_08016BF8(void) { - if (gUnk_02022730.ready) { - const u16* src = gUnk_02022730.src; - u16* dest = gUnk_02022730.dest; - s32 size, i = size = gUnk_02022730.size; +void PerformVBlankDMA(void) { + if (gVBlankDMA.ready) { + const u16* src = gVBlankDMA.src; + u16* dest = gVBlankDMA.dest; + s32 size, i = size = gVBlankDMA.size; DmaSet(0, src, dest, size); + // TODO Why is it copied again? i = size & 0x3fff; if (i == 0) { i = 0x4000; diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c index 717b9250..bf702e6a 100644 --- a/src/item/itemLantern.c +++ b/src/item/itemLantern.c @@ -41,7 +41,7 @@ void sub_08075A0C(ItemBehavior* this, u32 idx) { this->behaviorID = 0x10; ForceEquipItem(ITEM_LANTERN_ON, itemSlot); tmp = &gUnk_08126EEC[gPlayerEntity.animationState & 6]; - object = CreateObjectWithParent(&gPlayerEntity, OBJECT_45, 1, 0); + object = CreateObjectWithParent(&gPlayerEntity, LAMP_PARTICLE, 1, 0); if (object != NULL) { object->spriteVramOffset = gPlayerEntity.spriteVramOffset; object->x.HALF.HI = tmp[0] + object->x.HALF.HI; @@ -60,7 +60,7 @@ void sub_08075ADC(ItemBehavior* this, u32 idx) { (this->field_0x5[9] & 1) == 0 || (gPlayerState.flags & (PL_DISABLE_ITEMS | PL_CAPTURED)) != 0 || sub_08079D48() == 0) { this->field_0xf = 0; - this->stateID += 1; + this->stateID++; gPlayerState.flags |= PL_USE_LANTERN; bVar1 = 8 >> idx; gPlayerState.field_0x3[1] = gPlayerState.field_0x3[1] & ~((bVar1 << 4) | bVar1); @@ -95,9 +95,9 @@ void sub_08075B54(ItemBehavior* this, u32 idx) { (sub_080B1BA4(TILE(gPlayerEntity.x.HALF.HI + tmp[0], gPlayerEntity.y.HALF.HI + tmp[1]), gPlayerEntity.collisionLayer, 0x40) != 0)) { this->field_0xf = 0xf; - this->stateID += 1; + this->stateID++; gPlayerEntity.field_0x7a.HWORD = 2; - object = CreateObjectWithParent(&gPlayerEntity, OBJECT_45, 1, 0); + object = CreateObjectWithParent(&gPlayerEntity, LAMP_PARTICLE, 1, 0); if (object != NULL) { object->spriteVramOffset = gPlayerEntity.spriteVramOffset; object->x.HALF.HI = tmp[0] + object->x.HALF.HI; @@ -123,10 +123,10 @@ void sub_08075C9C(ItemBehavior* this, u32 idx) { } if ((this->field_0x5[9] & 0x80) != 0) { this->field_0xf = 0; - this->stateID -= 1; + this->stateID--; gPlayerState.field_0xa = (~(8 >> idx)) & gPlayerState.field_0xa; gPlayerState.keepFacing = (~(8 >> idx)) & gPlayerState.keepFacing; } else { - gPlayerEntity.field_0x7a.HWORD += 1; + gPlayerEntity.field_0x7a.HWORD++; } } diff --git a/src/item/itemMoleMitts.c b/src/item/itemMoleMitts.c index a2e04e6f..59607eb9 100644 --- a/src/item/itemMoleMitts.c +++ b/src/item/itemMoleMitts.c @@ -138,7 +138,7 @@ void sub_080772A8(ItemBehavior* this, u32 idx) { gPlayerEntity.frameDuration = 1; if (sub_0807B5B0(&gPlayerEntity)) { SoundReq(SFX_108); - CreateObjectWithParent(&gPlayerEntity, OBJECT_1E, this->field_0x5[9], 0); + CreateObjectWithParent(&gPlayerEntity, MOLE_MITTS_PARTICLE, this->field_0x5[9], 0); } else { sub_08077DF4(this, 0x51c); effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0); diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index eb2696c6..a0424387 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -156,7 +156,7 @@ void sub_08076A88(ItemBehavior* this, u32 idx) { return; } ptr = gUnk_0811BE38; - if ((*(u16*)&ptr[(gPlayerEntity.animationState & 0xfe)] & gPlayerState.field_0x90) == 0) { + if ((*(u16*)&ptr[(gPlayerEntity.animationState & 0xfe)] & gPlayerState.playerInput.field_0x90) == 0) { this->field_0x5[6] = (this->field_0x5[5] & 0xe) * 4; if ((gPlayerState.field_0xd != 0xff) && (gPlayerState.field_0xd != this->field_0x5[6])) { if (((gPlayerState.field_0xd - this->field_0x5[6]) & 0x1f) < 0x10) { diff --git a/src/item/itemSword.c b/src/item/itemSword.c index 6e5b0d6f..814e1cf9 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -148,7 +148,7 @@ void sub_08075580(ItemBehavior* this, u32 idx) { this->field_0x5[2] = 0x50; } sub_08077DF4(this, 0x168); - CreateObject(OBJECT_43, 0, 0); + CreateObject(SWORD_PARTICLE, 0, 0); return; } sub_080759B8(this, idx); diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index 976366ca..cae32fd5 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -91,12 +91,12 @@ void sub_08076488(ItemBehavior* this, u32 idx) { bVar1 = ~(8 >> idx); gPlayerState.keepFacing = bVar1 & gPlayerState.keepFacing; gPlayerState.field_0xa = bVar1 & gPlayerState.field_0xa; - this->stateID += 1; + this->stateID++; this->field_0xf = 0; } } } else { - this->field_0x5[2] -= 1; + this->field_0x5[2]--; } gPlayerState.framestate = PL_STATE_HOLD; } @@ -108,7 +108,8 @@ void sub_08076518(ItemBehavior* this, u32 index) { if (gPlayerEntity.knockbackDuration != 0) { PlayerCancelHoldItem(this, index); } else { - if ((gPlayerState.field_0x92 & 0x8018) != 0) { + if ((gPlayerState.playerInput.field_0x92 & (PLAYER_INPUT_8000 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != + 0) { sub_0806F948(&gPlayerEntity); gPlayerState.heldObject = 5; this->field_0x18->subAction = 2; @@ -1,18 +1,25 @@ -#include "sound.h" -#include "functions.h" +/** + * @file main.c + * + * @brief Contains the main game loop. + */ #include "main.h" -#include "screen.h" + #include "common.h" -#include "save.h" -#include "message.h" -#include "interrupts.h" +#include "functions.h" #include "game.h" +#include "interrupts.h" +#include "message.h" +#include "save.h" +#include "screen.h" +#include "sound.h" extern u32 gRand; static void InitOverlays(void); static bool32 SoftResetKeysPressed(void); /*static*/ u32 CheckHeaderValid(void); +/*static*/ void InitSaveHeader(void); void (*const sTaskHandlers[])(void) = { [TASK_TITLE] = TitleTask, @@ -26,16 +33,15 @@ void (*const sTaskHandlers[])(void) = { [TASK_STAFFROLL] = StaffrollTask, [TASK_DEBUG] = DebugTask, }; -/*static*/ void sub_080560B8(void); - void AgbMain(void) { + // Initialization InitOverlays(); InitSound(); InitDMA(); InitSaveData(); - sub_080560B8(); - sub_08056208(); - gUnk_02000010.field_0x4 = 193; + InitSaveHeader(); + InitVBlankDMA(); + gUnk_02000010.field_0x4 = 0xc1; InitFade(); DmaCopy32(3, BG_PLTT, gPaletteBuffer, BG_PLTT_SIZE); SetBrightness(1); @@ -44,7 +50,9 @@ void AgbMain(void) { gRand = 0x1234567; MemClear(&gMain, sizeof(gMain)); SetTask(TASK_TITLE); - while (1) { + + // Game Loop + while (TRUE) { ReadKeyInput(); if (SoftResetKeysPressed()) { DoSoftReset(); @@ -71,7 +79,7 @@ void AgbMain(void) { } } - gMain.ticks.HWORD++; + gMain.ticks++; sTaskHandlers[gMain.task](); MessageMain(); FadeMain(); @@ -144,18 +152,7 @@ void DoSoftReset(void) { SoftReset(RESET_ALL & ~(RESET_EWRAM | RESET_SIO_REGS)); } -typedef struct { - int signature; - u8 saveFileId; - u8 msg_speed; - u8 brightness; - u8 language; - u8 name[6]; - u8 invalid; - u8 initialized; -} Defaults; - -const Defaults sDefaultSettings = { +const SaveHeader sDefaultSettings = { .signature = SIGNATURE, .saveFileId = 0, .msg_speed = 1, @@ -171,19 +168,19 @@ const Defaults sDefaultSettings = { }; // single misplaced ldr -NONMATCH("asm/non_matching/sub_080560B8.inc", /*static*/ void sub_080560B8(void)) { +NONMATCH("asm/non_matching/InitSaveHeader.inc", /*static*/ void InitSaveHeader(void)) { u32 b; if (!CheckHeaderValid()) { - switch ((s32)Read_02000000(gSaveHeader)) { + switch ((s32)ReadSaveHeader(gSaveHeader)) { case 1: if (CheckHeaderValid()) break; case 0: case -1: default: - MemCopy(&sDefaultSettings, gSaveHeader, sizeof *gSaveHeader); - Write_02000000(gSaveHeader); + MemCopy(&sDefaultSettings, gSaveHeader, sizeof(SaveHeader)); + WriteSaveHeader(gSaveHeader); break; } } @@ -220,8 +217,8 @@ END_NONMATCH void InitDMA(void) { SoundReq(SONG_VSYNC_OFF); - gScreen._6d = gScreen._6c; - gScreen._6c = 0; + gScreen.vBlankDMA.readyBackup = gScreen.vBlankDMA.ready; + gScreen.vBlankDMA.ready = FALSE; DmaStop(0); @@ -231,27 +228,27 @@ void InitDMA(void) { DmaWait(3); } -void sub_08056208(void) { +void InitVBlankDMA(void) { SoundReq(SONG_VSYNC_ON); - gScreen._6c = gScreen._6d; - gScreen._6d = 0; + gScreen.vBlankDMA.ready = gScreen.vBlankDMA.readyBackup; + gScreen.vBlankDMA.readyBackup = FALSE; } -void sub_0805622C(struct BgAffineDstData* a1, u32 a2, u32 a3) { - gScreen._70 = a1; - gScreen._74 = a2; - gScreen._78 = a3; - gScreen._6c = 1; +void SetVBlankDMA(u16* src, u16* dest, u32 size) { + gScreen.vBlankDMA.src = src; + gScreen.vBlankDMA.dest = dest; + gScreen.vBlankDMA.size = size; + gScreen.vBlankDMA.ready = TRUE; gUnk_03003DE4[0] ^= 1; } -void sub_08056250(void) { - gScreen._6c = 0; +void DisableVBlankDMA(void) { + gScreen.vBlankDMA.ready = FALSE; } void SetSleepMode(void) { u32 restore; - Main* m; + Main* main; REG_DISPCNT = DISPCNT_FORCED_BLANK; REG_KEYCNT = KEY_AND_INTR | L_BUTTON | R_BUTTON | SELECT_BUTTON; @@ -263,9 +260,9 @@ void SetSleepMode(void) { REG_IME = 0; REG_IE = restore; REG_IME = 1; - m = &gMain; - *(vu8*)&m->sleepStatus; // force a read - m->sleepStatus = 0; + main = &gMain; + *(vu8*)&main->sleepStatus; // force a read + main->sleepStatus = 0; } // Convert AABB to screen coordinates and check if it's within the viewport diff --git a/src/manager/angryStatueManager.c b/src/manager/angryStatueManager.c index 691a8e3a..c24d026e 100644 --- a/src/manager/angryStatueManager.c +++ b/src/manager/angryStatueManager.c @@ -41,7 +41,7 @@ void AngryStatueManager_Init(AngryStatueManager* this) { object->parent = (Entity*)this; ResolveCollisionLayer(object); this->field_0x20[counter] = object; - counter += 1; + counter++; objectData += 3; } super->action = 1; diff --git a/src/manager/cameraTargetManager.c b/src/manager/cameraTargetManager.c index 22347855..b1023f2d 100644 --- a/src/manager/cameraTargetManager.c +++ b/src/manager/cameraTargetManager.c @@ -45,7 +45,7 @@ void CameraTargetManager_Action1(CameraTargetManager* this) { super->timer = 30; } super->parent = gRoomControls.camera_target; - object = CreateObject(OBJECT_69, 0, 0); + object = CreateObject(CUTSCENE_ORCHESTRATOR, 0, 0); if (object != NULL) { object->x.HALF.HI = this->field_0x38 + gRoomControls.origin_x; object->y.HALF.HI = this->field_0x3a + gRoomControls.origin_y; diff --git a/src/manager/goronMerchantShopManager.c b/src/manager/goronMerchantShopManager.c index 5bb67e43..3f6ed6b5 100644 --- a/src/manager/goronMerchantShopManager.c +++ b/src/manager/goronMerchantShopManager.c @@ -72,8 +72,8 @@ void GoronMerchantShopManager_Main(GoronMerchantShopManager* this) { this->itemActive[count] = 1; } } - count += 1; - spawnData += 1; + count++; + spawnData++; } } for (count = 0; count < 3; ++count) { diff --git a/src/manager/holeManager.c b/src/manager/holeManager.c index a79dd62e..3b1d17cf 100644 --- a/src/manager/holeManager.c +++ b/src/manager/holeManager.c @@ -87,14 +87,14 @@ void sub_0805B048(HoleManager* this) { } if (!tmp->unk_10) return; - obj = CreateObject(OBJECT_28, tmp->unk_10->unk_00, tmp->unk_10->unk_01); + obj = CreateObject(PARALLAX_ROOM_VIEW, tmp->unk_10->unk_00, tmp->unk_10->unk_01); if (obj) { obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.origin_x; obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.origin_y; } if (super->type != 0xa || CheckLocalFlag(0x4B)) return; - obj = CreateObject(OBJECT_28, 3, 3); + obj = CreateObject(PARALLAX_ROOM_VIEW, 3, 3); if (obj) { obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.origin_x; obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.origin_y; diff --git a/src/manager/horizontalMinishPathBackgroundManager.c b/src/manager/horizontalMinishPathBackgroundManager.c index b5fbf6d6..f2a8b1fb 100644 --- a/src/manager/horizontalMinishPathBackgroundManager.c +++ b/src/manager/horizontalMinishPathBackgroundManager.c @@ -62,13 +62,13 @@ void sub_08057F20(HorizontalMinishPathBackgroundManager* this) { } } -void sub_08058004(u32 unk1, void* unk2, void* unk3) { +void sub_08058004(u32 unk1, void* src, void* dest) { u32 tmp = 0x20; - unk2 += (unk1 >> 4) << 2; + src += (unk1 >> 4) << 2; for (tmp; tmp != 0; tmp--) { - DmaSet(3, unk2, unk3, 0x80000020); - unk2 += 0x100; - unk3 += 0x40; + DmaCopy16(3, src, dest, 0x20 * 2); + src += 0x100; + dest += 0x40; } } @@ -94,7 +94,7 @@ void sub_08058034(void) { void sub_08058084(u16* unk1, u16* unk2) { u32 tmp; for (tmp = 0; tmp < 0x20; tmp++, unk1 += 0x20, unk2 += 0x80) { - DmaSet(3, unk1, unk2, 0x80000020); + DmaCopy16(3, unk1, unk2, 0x20 * 2); } } diff --git a/src/manager/houseSignManager.c b/src/manager/houseSignManager.c index 1f5b3ff5..6478310e 100644 --- a/src/manager/houseSignManager.c +++ b/src/manager/houseSignManager.c @@ -4,7 +4,7 @@ * * @brief Keeps track in its bitfield of whether 0x10 x 0x10 rects at certain positions are on the screen. * - * Spawns OBJECT_1C objects that check this and unsets the value in the bitfield. + * Spawns HOUSE_SIGN objects that check this and unsets the value in the bitfield. * Creates the signs on the houses in hyrule town. */ #include "manager/houseSignManager.h" @@ -57,7 +57,7 @@ void HouseSignManager_Main(HouseSignManager* this) { u32 bitfieldFlag = 1 << type2; if ((((this->bitfield & bitfieldFlag) == 0) && (CheckRectOnScreen(spawnData->x, spawnData->y, 0x10, 0x10) != 0))) { - Entity* object = CreateObject(OBJECT_1C, spawnData->type, type2); + Entity* object = CreateObject(HOUSE_SIGN, spawnData->type, type2); if (object != NULL) { object->frameIndex = spawnData->frameIndex; object->x.HALF.HI = gRoomControls.origin_x + spawnData->x; diff --git a/src/manager/hyruleTownBellManager.c b/src/manager/hyruleTownBellManager.c index b7348c75..bc8eb795 100644 --- a/src/manager/hyruleTownBellManager.c +++ b/src/manager/hyruleTownBellManager.c @@ -24,7 +24,7 @@ void HyruleTownBellManager_Main(HyruleTownBellManager* this) { } } else { if (--super->timer == 0) { - Entity* object = CreateObject(OBJECT_96, 1, 0); + Entity* object = CreateObject(GRAVEYARD_KEY, 1, 0); if (object != NULL) { object->x.HALF.HI = roomControls->origin_x + 0x1f8; object->y.HALF.HI = roomControls->origin_y + 0x140; diff --git a/src/manager/lightLevelSetManager.c b/src/manager/lightLevelSetManager.c index c5b9f02d..c111e3f7 100644 --- a/src/manager/lightLevelSetManager.c +++ b/src/manager/lightLevelSetManager.c @@ -144,7 +144,7 @@ void sub_0805BE94(LightLevelSetManager* this) { } void sub_0805BEC4(LightLevelSetManager* this) { - Entity* object = CreateObject(OBJECT_2A, 1, 0); + Entity* object = CreateObject(FLAME, 1, 0); if (object != NULL) { *(s8*)(&object->flags + 1) = ((*(s8*)(&object->flags + 1)) & (-0x10)) | 3; object->x.HALF.HI = this->field_0x38 + gRoomControls.origin_x; diff --git a/src/manager/lightRayManager.c b/src/manager/lightRayManager.c index fb704702..48c48a6f 100644 --- a/src/manager/lightRayManager.c +++ b/src/manager/lightRayManager.c @@ -13,9 +13,9 @@ #include "main.h" #include "screen.h" -extern void sub_08056250(void); +extern void DisableVBlankDMA(void); -void (*const gUnk_08107C5C[])(LightRayManager*); +void (*const LightRayManager_Actions[])(LightRayManager*); void (*const gUnk_08107C48[])(LightRayManager*); const u16 gUnk_08107C1C[]; const u16 gUnk_08107C30[]; @@ -35,22 +35,22 @@ typedef struct { #define ZS(this) ((u8*)&this->speed) void LightRayManager_Main(LightRayManager* this) { - u8 bVar1; + u8 gfxGroup; u8* pbVar2; - gUnk_08107C5C[super->action](this); + LightRayManager_Actions[super->action](this); gUnk_08107C48[this->unk_21](this); - bVar1 = gLightRayManagerGfxGroups[this->unk_21]; - if ((bVar1 != 0) && (this->unk_20 != bVar1)) { - this->unk_20 = bVar1; - LoadGfxGroup(bVar1); + gfxGroup = gLightRayManagerGfxGroups[this->unk_21]; + if ((gfxGroup != 0) && (this->gfxGroup != gfxGroup)) { + this->gfxGroup = gfxGroup; + LoadGfxGroup(gfxGroup); } } -static void sub_080570B8(LightRayManager* this) { +static void LightRayManager_EnterRoom(LightRayManager* this) { u8* pbVar1; - LoadGfxGroup(this->unk_20); + LoadGfxGroup(this->gfxGroup); this->unk_34 = NULL; pbVar1 = &this->unk_21; if (*pbVar1 == 3) { @@ -60,15 +60,15 @@ static void sub_080570B8(LightRayManager* this) { } } -static void sub_080570F8(void) { +static void LightRayManager_ExitRoom(void) { gScreen.lcd.displayControl &= ~DISPCNT_BG3_ON; gScreen.controls.layerFXControl = 0; - sub_08056250(); + DisableVBlankDMA(); } -void sub_08057118(LightRayManager* this) { +void LightRayManager_Init(LightRayManager* this) { super->timer = 0; - this->unk_20 = 0; + this->gfxGroup = 0; this->unk_21 = 0; this->unk_22 = 0; super->action = 1; @@ -76,10 +76,10 @@ void sub_08057118(LightRayManager* this) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; gScreen.controls.layerFXControl = 0x3648; gScreen.controls.alphaBlend = 0x1000; - RegisterTransitionManager(this, sub_080570B8, sub_080570F8); + RegisterTransitionManager(this, LightRayManager_EnterRoom, LightRayManager_ExitRoom); } -void sub_08057174(LightRayManager* this) { +void LightRayManager_Action1(LightRayManager* this) { LightRayManagerProp* prop = GetCurrentRoomProperty(super->type); s32 temp; s32 x; @@ -114,7 +114,7 @@ void sub_08057174(LightRayManager* this) { if (this->unk_21 == 0) { super->action = 2; super->timer = 0; - this->unk_20 = 0; + this->gfxGroup = 0; } break; case 6: @@ -149,7 +149,7 @@ void sub_08057174(LightRayManager* this) { } } -void sub_0805728C(LightRayManager* this) { +void LightRayManager_Action2(LightRayManager* this) { if (--super->subtimer == 0) { super->subtimer = 8; gScreen.controls.alphaBlend = gUnk_08107C1C[super->timer++]; @@ -161,7 +161,7 @@ void sub_0805728C(LightRayManager* this) { } } -void sub_080572D4(LightRayManager* this) { +void LightRayManager_Action3(LightRayManager* this) { if (--super->subtimer == 0) { super->subtimer = 8; gScreen.controls.alphaBlend = gUnk_08107C1C[super->timer--]; @@ -170,7 +170,7 @@ void sub_080572D4(LightRayManager* this) { super->action = 1; this->unk_22 = 0; this->unk_21 = 0; - gScreen._6c = 0; + gScreen.vBlankDMA.ready = FALSE; } } } @@ -183,7 +183,9 @@ void sub_0805732C(u32 param_1, u32 param_2) { *ptr = gSineTable[(param_2 + index) & 0xff] * param_1 / 0x100 + gScreen.bg3.xOffset; } - sub_0805622C((struct BgAffineDstData*)&gUnk_02017AA0[gUnk_03003DE4[0] * 0x500], REG_ADDR_BG3HOFS, 0xa2600001UL); + SetVBlankDMA(&gUnk_02017AA0[gUnk_03003DE4[0] * 0x500], (u16*)REG_ADDR_BG3HOFS, + ((DMA_ENABLE | DMA_START_HBLANK | DMA_16BIT | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_RELOAD) << 16) + + 0x1); } void nullsub_494() { @@ -253,9 +255,9 @@ void (*const gUnk_08107C48[])(LightRayManager*) = { nullsub_494, nullsub_494, sub_080573AC, nullsub_494, sub_08057450, }; -void (*const gUnk_08107C5C[])(LightRayManager*) = { - sub_08057118, - sub_08057174, - sub_0805728C, - sub_080572D4, +void (*const LightRayManager_Actions[])(LightRayManager*) = { + LightRayManager_Init, + LightRayManager_Action1, + LightRayManager_Action2, + LightRayManager_Action3, }; diff --git a/src/manager/minishRaftersBackgroundManager.c b/src/manager/minishRaftersBackgroundManager.c index a337c862..e55e989b 100644 --- a/src/manager/minishRaftersBackgroundManager.c +++ b/src/manager/minishRaftersBackgroundManager.c @@ -57,7 +57,7 @@ void sub_080582A0(u32 unk, u32* unk2, u16* unk3) { int i = 0x20; unk2 += unk >> 4; for (; i != 0; i--) { - DmaSet(3, unk2, unk3, 0x80000020); + DmaCopy16(3, unk2, unk3, 0x20 * 2); unk2 += 0x40; unk3 += 0x20; } @@ -75,7 +75,7 @@ void sub_080582D0(void) { void sub_080582F8(u8* unk, u8* unk2) { u32 i; for (i = 0; i < 0x20; i++, unk += 0x40, unk2 += 0x100) { - DmaSet(3, unk, unk2, 0x80000020); + DmaCopy16(3, unk, unk2, 0x20 * 2); } } diff --git a/src/manager/minishSizedEntranceManager.c b/src/manager/minishSizedEntranceManager.c index 71776a39..de5a1969 100644 --- a/src/manager/minishSizedEntranceManager.c +++ b/src/manager/minishSizedEntranceManager.c @@ -47,7 +47,7 @@ void MinishSizedEntranceManager_Main(MinishSizedEntranceManager* this) { } else { this->field_0x20 &= ~(1 << count); } - spawnData += 1; + spawnData++; } } diff --git a/src/manager/minishVillageTilesetManager.c b/src/manager/minishVillageTilesetManager.c index bb8374a3..f82b9153 100644 --- a/src/manager/minishVillageTilesetManager.c +++ b/src/manager/minishVillageTilesetManager.c @@ -185,7 +185,7 @@ void sub_08057E7C(u32 unk1) { LoadPaletteGroup(gUnk_081081E4[unk1]); tmp2 = &gUnk_081080A4[unk1 << 4]; for (tmp = 0; tmp < 8; tmp++, tmp2 += 2) { - DmaSet(3, &gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x84000400); + DmaCopy32(3, &gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x400 * 4); } gRoomVars.unk_10[0] = unk1; } diff --git a/src/manager/miscManager.c b/src/manager/miscManager.c index 5d52ad2d..cca46468 100644 --- a/src/manager/miscManager.c +++ b/src/manager/miscManager.c @@ -129,7 +129,7 @@ void sub_08058F44(u32 unk0, u32 unk1, u32 unk2) { void sub_08058F84(u32 unk0, u32 unk1) { Entity* tmp; - tmp = CreateObject(OBJECT_21, 0, 0); + tmp = CreateObject(DIRT_PARTICLE, 0, 0); if (!tmp) return; tmp->x.HALF.HI = gRoomControls.origin_x + unk0; @@ -363,12 +363,12 @@ void MiscManager_TypeB(MiscManager* this) { } } -u32 sub_080593CC(MiscManager* this) { +bool32 sub_080593CC(MiscManager* this) { if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.animationState == 0 && - (gPlayerState.field_0x90 & 0xF00) == 0x400) { + (gPlayerState.playerInput.field_0x90 & PLAYER_INPUT_ANY_DIRECTION) == PLAYER_INPUT_UP) { return EntityWithinDistance(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6); } - return 0; + return FALSE; } void MiscManager_TypeC(MiscManager* this) { diff --git a/src/manager/rollingBarrelManager.c b/src/manager/rollingBarrelManager.c index 9e2c161f..3b1d6d41 100644 --- a/src/manager/rollingBarrelManager.c +++ b/src/manager/rollingBarrelManager.c @@ -44,7 +44,9 @@ void RollingBarrelManager_Main(RollingBarrelManager* this) { u32 tmp; RollingBarrelManager_Actions[super->action](this); sub_08058BC8(this); - sub_0805622C(&gUnk_02017AA0[gUnk_03003DE4[0] * 0xA0], 0x04000020, 0xA2600008); + SetVBlankDMA((u16*)&gUnk_02017AA0[gUnk_03003DE4[0] * 0xA0], (u16*)REG_ADDR_BG2PA, + ((DMA_ENABLE | DMA_START_HBLANK | DMA_16BIT | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_RELOAD) << 16) + + 0x8); } void RollingBarrelManager_Init(RollingBarrelManager* this) { super->action = 1; diff --git a/src/manager/steamOverlayManager.c b/src/manager/steamOverlayManager.c index 7214fb0c..0052f5e1 100644 --- a/src/manager/steamOverlayManager.c +++ b/src/manager/steamOverlayManager.c @@ -137,7 +137,7 @@ void SteamOverlayManager_Action3(SteamOverlayManager* this) { gScreen.controls.alphaBlend = gUnk_08108588[super->timer--]; if (super->timer == 0xFF) { gScreen.lcd.displayControl &= ~DISPCNT_BG3_ON; - sub_08056250(); + DisableVBlankDMA(); DeleteThisEntity(); } } @@ -165,7 +165,9 @@ void sub_0805A114(u32 unk0, u32 unk1) { } *p++ = gScreen.bg3.xOffset + ((gSineTable[(unk1 + tmp) & 0xFF] * unk0) >> 8); } - sub_0805622C((struct BgAffineDstData*)&gUnk_02017AA0[gUnk_03003DE4[0] * 0x500], 0x0400001C, 0xA2600001); + SetVBlankDMA((u16*)&gUnk_02017AA0[gUnk_03003DE4[0] * 0x500], (u16*)REG_ADDR_BG3HOFS, + ((DMA_ENABLE | DMA_START_HBLANK | DMA_16BIT | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_RELOAD) << 16) + + 0x1); } void sub_0805A1D8(SteamOverlayManager* this) { @@ -175,7 +177,7 @@ void sub_0805A1D8(SteamOverlayManager* this) { gScreen.bg3.yOffset = gRoomControls.bg3OffsetY.HALF.HI; if (gScreen.lcd.displayControl & DISPCNT_BG3_ON) { sub_0805A114(6, this->unk_20 >> 1); - if (this->unk_22 == 0 && (gMain.ticks.HWORD & 0x1F) == 0) { + if (this->unk_22 == 0 && (gMain.ticks & 0x1F) == 0) { this->unk_24++; this->unk_24 &= 3; gScreen.controls.alphaBlend = gUnk_0810859A[this->unk_24]; @@ -189,5 +191,5 @@ void nullsub_495(void* this) { void sub_0805A25C(void* this) { gScreen.controls.layerFXControl = 0; gScreen.lcd.displayControl &= ~DISPCNT_BG3_ON; - sub_08056250(); + DisableVBlankDMA(); } diff --git a/src/manager/templeOfDropletsManager.c b/src/manager/templeOfDropletsManager.c index 8377d455..b1b97aba 100644 --- a/src/manager/templeOfDropletsManager.c +++ b/src/manager/templeOfDropletsManager.c @@ -191,7 +191,7 @@ void TempleOfDropletsManager_Type2_Action4(TempleOfDropletsManager* this) { void sub_0805A4CC(TempleOfDropletsManager* this, u32 unk_0) { Entity* tmp; - tmp = CreateObject(OBJECT_8E, unk_0, 0); + tmp = CreateObject(LIGHT_RAY, unk_0, 0); if (tmp) { tmp->x.HALF.HI = this->unk_38 + gRoomControls.origin_x; tmp->y.HALF.HI = this->unk_3a + gRoomControls.origin_y - 0x30; @@ -493,13 +493,13 @@ extern struct { u8 unk_00[0x20]; } gUnk_085A97A0[]; void sub_0805AA58(TempleOfDropletsManager* this) { if (--super->timer == 0) { super->timer = 8; - this->unk_21 += 1; + this->unk_21++; this->unk_21 &= 3; LoadPalettes(gUnk_085A97A0[this->unk_21].unk_00, 5, 1); } if (--super->subtimer == 0) { super->subtimer = 16; - this->unk_22 += 1; + this->unk_22++; this->unk_22 &= 0xF; gScreen.controls.alphaBlend = gUnk_081085B8[this->unk_22]; } diff --git a/src/manager/vaati3StartManager.c b/src/manager/vaati3StartManager.c index 9a5f5290..9f727808 100644 --- a/src/manager/vaati3StartManager.c +++ b/src/manager/vaati3StartManager.c @@ -72,7 +72,7 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) { super->timer = 120; SetPlayerControl(2); sub_08078B48(); - object = CreateObject(OBJECT_64, 0, 0); + object = CreateObject(THUNDERBOLD, 0, 0); if (object != NULL) { object->x.HALF.HI = gRoomControls.origin_x + 0x88; object->y.HALF.HI = gRoomControls.origin_y + 0x48; diff --git a/src/manager/vaatiAppearingManager.c b/src/manager/vaatiAppearingManager.c index 6fc89add..9e349cb1 100644 --- a/src/manager/vaatiAppearingManager.c +++ b/src/manager/vaatiAppearingManager.c @@ -9,6 +9,7 @@ #include "common.h" #include "functions.h" #include "game.h" +#include "main.h" #include "room.h" #include "screen.h" @@ -22,8 +23,6 @@ void sub_0805DA08(u32, u32, u32); static const u8 gUnk_08108D74[] = { 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x0 }; extern struct BgAffineDstData gUnk_02017AA0[]; -extern u8 gUnk_03003DE4[0xC]; -extern void sub_0805622C(struct BgAffineDstData*, u32, u32); void VaatiAppearingManager_Main(VaatiAppearingManager* this) { static void (*const VaatiAppearingManager_Actions[])(VaatiAppearingManager*) = { @@ -121,7 +120,7 @@ void VaatiAppearingManager_Action2(VaatiAppearingManager* this) { } break; case 2: - this->field_0x20 += 1; + this->field_0x20++; if (--super->timer != 0) { return; } @@ -140,16 +139,16 @@ void VaatiAppearingManager_Action2(VaatiAppearingManager* this) { void VaatiAppearingManager_Action3(VaatiAppearingManager* this) { if ((gInput.heldKeys & 0x40) != 0) { - this->field_0x20 -= 1; + this->field_0x20--; } if ((gInput.heldKeys & 0x80) != 0) { - this->field_0x20 += 1; + this->field_0x20++; } if ((gInput.heldKeys & 0x20) != 0) { - this->field_0x28 -= 1; + this->field_0x28--; } if ((gInput.heldKeys & 0x10) != 0) { - this->field_0x28 += 1; + this->field_0x28++; } } @@ -168,7 +167,9 @@ void sub_0805DA08(u32 x, u32 y, u32 param_3) { affineDstData->pa = ((gSineTable[(param_3 + i + y) & 0xff] * x) >> 8) + gScreen.bg3.xOffset; affineDstData = (struct BgAffineDstData*)&affineDstData->pb; } - sub_0805622C(&gUnk_02017AA0[gUnk_03003DE4[0] * 0xa0], REG_ADDR_BG3HOFS, 0xa2600001); + SetVBlankDMA((u16*)&gUnk_02017AA0[gUnk_03003DE4[0] * 0xa0], (u16*)REG_ADDR_BG3HOFS, + ((DMA_ENABLE | DMA_START_HBLANK | DMA_16BIT | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_RELOAD) << 16) + + 0x1); } void CreateVaatiApparateManager(VaatiAppearingManager* this, u32 type) { diff --git a/src/menu/figurine_menu.c b/src/menu/figurine_menu.c index 6e7ee26b..5a15d133 100644 --- a/src/menu/figurine_menu.c +++ b/src/menu/figurine_menu.c @@ -17,7 +17,6 @@ extern const struct { u8 filler[7]; u8 unk7; } gUnk_080FC3E4[]; -extern u32 gUnk_02002B0E; void sub_080A4DA8(u32); void sub_080A4B44(void); @@ -146,10 +145,10 @@ void FigurineMenu0_Type2(void) { Sound sound; if (gMenu.field_0x0 != 0) { - gFigurineMenu.unk20 += 1; + gFigurineMenu.unk20++; switch (gFigurineMenu.unk20) { case 0x40: - gFigurineMenu.duplicate = WriteBit(&gUnk_02002B0E, gFigurineMenu.figure_idx); + gFigurineMenu.duplicate = WriteBit(&gSave.stats.filler4[4], gFigurineMenu.figure_idx); gMenu.column_idx = 1; default: bVar1 = gFigurineMenu.unk20 >> 2; @@ -329,7 +328,7 @@ void FigurineMenu_080A4978(void) { r0 += 0x20; gOamCmd.y = r0; DrawDirect(sub_080A4978_draw_constant, 1); - r0 = gMain.ticks.HWORD & 0x10; + r0 = gMain.ticks & 0x10; r4 = (r0) ? 4 : 2; gOamCmd.x = 0xe8; gOamCmd.y = 0x1a; @@ -339,7 +338,7 @@ void FigurineMenu_080A4978(void) { DrawDirect(sub_080A4978_draw_constant, r4 + 1); } } - if (gMain.ticks.HWORD & 0x10) { + if (gMain.ticks & 0x10) { if (gMenu.column_idx & 0x10) { if (gFigurineMenu.unk1e) { gOamCmd.y = 0x10; @@ -589,7 +588,7 @@ void sub_080A4DA8(u32 param_1) { void sub_080A4DB8(u32 param_1) { const struct_08128AD8* ptr; - sub_08056250(); + DisableVBlankDMA(); MemClear(&gBG0Buffer, 0x800); MemClear(&gBG1Buffer, 0x800); MemClear(&gBG2Buffer, 0x800); diff --git a/src/menu/kinstone_menu.c b/src/menu/kinstone_menu.c index 814c1b39..8e78e296 100644 --- a/src/menu/kinstone_menu.c +++ b/src/menu/kinstone_menu.c @@ -43,7 +43,6 @@ typedef struct { extern const u32 gUnk_080CA06C[]; extern const u8 gGlobalGfxAndPalettes[]; extern u8 gTextGfxBuffer[]; -extern u8 gUnk_02002AC0[]; u32 sub_080A44E0(WStruct*, u8*, u32); u32 sub_080A4418(u32, u32); @@ -180,11 +179,11 @@ NONMATCH("asm/non_matching/menu/kinstone_menu/KinstoneMenu_Type1.inc", void Kins switch (gInput.unk4) { case 0x20: case 0x40: - tmp3 -= 1; + tmp3--; break; case 0x10: case 0x80: - tmp3 += 1; + tmp3++; break; case 1: if (gMenu.column_idx == 2) { @@ -301,13 +300,11 @@ void KinstoneMenu_Type5(void) { kinstoneMenu_Type5_Overlays[gMenu.overlayType](); } -extern u8 gUnk_02002C81[]; - void KinstoneMenu_Type5_Overlay0(void) { gMenu.column_idx = 5; - WriteBit((u32*)gUnk_02002C81, gFuseInfo._3); - if (99 < ++gUnk_02002C81[-298]) { - gUnk_02002C81[-299] = 1; + WriteBit(gSave.unk241, gFuseInfo._3); + if (++gSave.unk117 > 99) { + gSave.didAllFusions = 1; } KinstoneMenu_080A4468(); SoundReq(SFX_TASK_COMPLETE); @@ -324,7 +321,7 @@ void KinstoneMenu_Type5_Overlay1(void) { } void KinstoneMenu_Type5_Overlay2(void) { - gMenu.transitionTimer -= 1; + gMenu.transitionTimer--; if (gMenu.transitionTimer != 0) { gKinstoneMenu.unk18 += gKinstoneMenu.unk1a; gKinstoneMenu.unk1a += 0x20; @@ -332,7 +329,7 @@ void KinstoneMenu_Type5_Overlay2(void) { gMenu.column_idx = 6; gMenu.overlayType = 3; gMenu.transitionTimer = 79; - CreateObject(OBJECT_B3, 1, 0); + CreateObject(KINSTONE_SPARK, 1, 0); SoundReq(SFX_1CA); } } @@ -359,7 +356,7 @@ void KinstoneMenu_080A4054(void) { KinstoneMenu_080A4080(); for (uVar2 = 0; uVar2 < 0x10; uVar2++) { if (gMapDataBottomSpecial[uVar2].unk_01 != 0) { - gMapDataBottomSpecial[uVar2].unk_01 -= 1; + gMapDataBottomSpecial[uVar2].unk_01--; } } } @@ -398,7 +395,7 @@ void KinstoneMenu_080A4080(void) { gOamCmd.x = 0xb8; gOamCmd._8 = 0x4a0; DrawDirect(t, 1); - uVar1 = gMain.ticks.HWORD >> 2 & 0xe; + uVar1 = gMain.ticks >> 2 & 0xe; temp = &gUnk_08128110[uVar1]; gOamCmd.x = 10 - temp[0]; gOamCmd._8 = 0x4e0; @@ -439,7 +436,7 @@ NONMATCH("asm/non_matching/menu/kinstone_menu/KinstoneMenu_080A414C.inc", void K switch (gMenu.column_idx) { case 3: case 4: - uVar3 -= 1; + uVar3--; break; default: break; @@ -609,7 +606,7 @@ u32 KinstoneMenu_080A4494(void) { psVar1->charColor = 0; psVar1->bgColor = 5; psVar1->unk1 = 0; - sub_080A44E0(psVar1, gUnk_02002AC0, 0x80); + sub_080A44E0(psVar1, gSave.name, 0x80); #if NON_MATCHING ret = sub_080A44E0(psVar1, sub_08002632(gFuseInfo.ent) >> 0x20, 0xa0); #else diff --git a/src/menu/pause_menu.c b/src/menu/pause_menu.c index 45012f83..6a64c87d 100644 --- a/src/menu/pause_menu.c +++ b/src/menu/pause_menu.c @@ -511,7 +511,7 @@ void PauseMenu_ItemMenu_Draw(void) { entry = &gItemMenuTable[slot]; gOamCmd.x = entry->x; gOamCmd.y = entry->y; - tmp = entry->type + ((gMain.ticks.HWORD & 0x10) != 0 ? 3 : 4); + tmp = entry->type + ((gMain.ticks & 0x10) != 0 ? 3 : 4); DrawDirect(sub_080A5384_draw_constant0, tmp); } { diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index fde93fb5..564e7e2d 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -185,7 +185,7 @@ void sub_0806D164(Entity* this) { puVar2 = &ptr[-0x4000]; for (index = 0x20, ptr = &puVar1[(xOffset >> 4) * 4]; index != 0; index--) { - DmaSet(3, ptr, puVar2, 0x80000020); + DmaCopy16(3, ptr, puVar2, 0x20 * 2); ptr += 0x100; puVar2 += 0x40; } @@ -341,11 +341,11 @@ void sub_0806D41C(Entity* this) { if ((gRoomTransition.frameCount & 1) == 0) { if (CheckPlayerProximity(this->x.HALF.HI - 0x20, this->y.HALF.HI, 0x40, 0x40) != 0) { if (this->spriteOffsetY > -8) { - this->spriteOffsetY -= 1; + this->spriteOffsetY--; } } else { if (this->spriteOffsetY < 0) { - this->spriteOffsetY += 1; + this->spriteOffsetY++; } } } diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index c9f597c0..8e05ed27 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -15,8 +15,8 @@ extern void (*gUnk_081115C0[])(Entity*); extern void (*gUnk_081115D0[])(Entity*); extern u16 gUnk_081115DC[]; -extern u8 gUnk_08111618[]; -extern u32* gUnk_081115EC[]; +extern u8 BladeBrothers_EquippedItem[]; +extern PlayerMacroEntry* BladeBrothers_PlayerMacros[]; extern u8 gUnk_08111623[]; extern u8 gUnk_0811162B[]; extern u16 gUnk_08111664[]; @@ -98,7 +98,7 @@ void sub_08068AA4(Entity* this) { this->type2++; this->type2 &= 7; if (this->type2 == 0) { - this->type2 += 1; + this->type2++; } ChangeObjPalette(this, gUnk_081115DC[this->type2]); } @@ -139,14 +139,14 @@ void sub_08068B70(Entity* this) { } } -void sub_08068B84(Entity* this) { +void BladeBrothers_StartPlayerDemonstration(Entity* this, ScriptExecutionContext* context) { u8 p; - if (gUnk_08111618) {} - if (p = this->timer, gUnk_08111618[p]) { - ForceEquipItem(gUnk_08111618[this->timer], 0); + if (BladeBrothers_EquippedItem) {} + if (p = this->timer, BladeBrothers_EquippedItem[p]) { + ForceEquipItem(BladeBrothers_EquippedItem[this->timer], 0); } - InitPlayerMacro(gUnk_081115EC[this->timer]); + InitPlayerMacro(BladeBrothers_PlayerMacros[this->timer]); } void sub_08068BB4(Entity* this) { @@ -190,7 +190,7 @@ void sub_08068C28(Entity* this) { } } -void sub_08068C6C(Entity* this) { +void BladeBrothers_GetScroll(Entity* this) { InitItemGetSequence(gUnk_0811162B[this->timer] & 0xffffff7f, 0, 0); } @@ -380,7 +380,7 @@ void sub_08068F3C(Entity* this) { void BladeBrothers_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 0; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 4); diff --git a/src/npc/brocco.c b/src/npc/brocco.c index d5dbb1f2..5a860d69 100644 --- a/src/npc/brocco.c +++ b/src/npc/brocco.c @@ -121,7 +121,7 @@ void sub_080636F4(Entity* this) { void Brocco_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; this->y.HALF.HI -= 4; InitAnimationForceUpdate(this, 2); diff --git a/src/npc/castorWildsStatue.c b/src/npc/castorWildsStatue.c index 351d174a..c0557905 100644 --- a/src/npc/castorWildsStatue.c +++ b/src/npc/castorWildsStatue.c @@ -170,7 +170,7 @@ void sub_080675D4(Entity* this) { static const Hitbox gUnk_08110E94 = { 0, 3, { 5, 3, 3, 5 }, 12, 20 }; void sub_080676D8(Entity* this) { - this->subAction += 1; + this->subAction++; } void sub_080676E0(Entity* this, ScriptExecutionContext* context) { @@ -208,7 +208,7 @@ void sub_080676E0(Entity* this, ScriptExecutionContext* context) { void CastorWildsStatue_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; this->y.HALF.HI -= 0x18; InitializeAnimation(this, 1); diff --git a/src/npc/cat.c b/src/npc/cat.c index cb8e1c99..11c85fd3 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -175,7 +175,7 @@ void sub_08067904(Entity* this) { return; } - this->field_0x70.HALF.HI -= 1; + this->field_0x70.HALF.HI--; if (this->field_0x70.HALF.HI == 0) { sub_08067B70(this); return; @@ -405,7 +405,7 @@ u32 sub_08067D20(Entity* this) { Entity* entity; int iVar4; if (this->field_0x74.HALF.HI != 0) { - this->field_0x74.HALF.HI -= 1; + this->field_0x74.HALF.HI--; } else { entity = sub_08049DF4(2); if (entity != NULL) { @@ -425,7 +425,7 @@ u32 sub_08067D74(Entity* this) { if (this->type != 5) { if (this->timer != 0) { - this->timer -= 1; + this->timer--; } entity = sub_08049DF4(2); if (entity != NULL) { @@ -454,7 +454,7 @@ void sub_08067DDC(Entity* this) { void Cat_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 5); } else { diff --git a/src/npc/cucco.c b/src/npc/cucco.c index 173b183a..c79084a8 100644 --- a/src/npc/cucco.c +++ b/src/npc/cucco.c @@ -14,7 +14,7 @@ void Cucco(Entity* this) { } void Cucco_Init(Entity* this) { - this->action += 1; + this->action++; this->field_0x68.HALF.LO = sub_0801E99C(this); sub_080787A8(this, this->field_0x68.HALF.LO); SetDefaultPriority(this, PRIO_MESSAGE); @@ -24,7 +24,7 @@ void Cucco_Init(Entity* this) { void sub_0806E4EC(Entity* this) { if (this->subAction == 0) { - this->subAction += 1; + this->subAction++; this->timer = (Random() & 0x1f) + 60; InitAnimationForceUpdate(this, 0); } @@ -122,7 +122,7 @@ void Cucco_ShowMessage(Entity* this) { void Cucco_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 1); } else { diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c index 7947a99f..e73045ca 100644 --- a/src/npc/cuccoChick.c +++ b/src/npc/cuccoChick.c @@ -22,7 +22,7 @@ void CuccoChick(Entity* this) { } void CuccoChick_Init(Entity* this) { - this->action += 1; + this->action++; this->field_0x68.HALF.LO = sub_0801E99C(this); sub_080787A8(this, this->field_0x68.HALF.LO); SetDefaultPriority(this, PRIO_MESSAGE); @@ -32,7 +32,7 @@ void CuccoChick_Init(Entity* this) { void sub_0806E764(Entity* this) { if (this->subAction == 0) { - this->subAction += 1; + this->subAction++; this->timer = (Random() & 0x1f) + 30; this->frameIndex = 0; } @@ -96,7 +96,7 @@ void sub_0806E884(Entity* this) { void CuccoChick_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; this->frameIndex = 1; } else { diff --git a/src/npc/din.c b/src/npc/din.c index 7ddc0a3f..894edab4 100644 --- a/src/npc/din.c +++ b/src/npc/din.c @@ -39,7 +39,7 @@ void sub_08064828(Entity* this) { void Din_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } else { diff --git a/src/npc/dog.c b/src/npc/dog.c index 82bd62d2..cacabce8 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -88,7 +88,7 @@ void sub_08069C40(Entity* this) { } this->timer = 30; } else { - this->timer -= 1; + this->timer--; if (this->timer == 0) { this->action = 2; this->timer = (Random() & 0x1f) + 30; @@ -132,7 +132,7 @@ void sub_08069D00(Entity* this) { void sub_08069D54(Entity* this) { u16 collisions; if (!sub_08069F90(this)) { - this->timer -= 1; + this->timer--; if (this->timer != 0) { UpdateAnimationSingleFrame(this); ProcessMovement0(this); @@ -170,7 +170,7 @@ void sub_08069DF8(Entity* this) { if (sub_08069F90(this)) { this->action = 1; } else { - this->timer -= 1; + this->timer--; if (this->timer != 0) { sub_08069D00(this); return; @@ -359,7 +359,7 @@ void sub_0806A144(Entity* this) { void Dog_Fusion(Entity* this) { if (this->action == 0) { if (sub_08069EF0(this) != 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; SetDefaultPriority(this, PRIO_MESSAGE); InitializeAnimation(this, 0x23); diff --git a/src/npc/emma.c b/src/npc/emma.c index 088f01a0..a3a7e6a3 100644 --- a/src/npc/emma.c +++ b/src/npc/emma.c @@ -8,7 +8,7 @@ extern ScreenTransitionData gUnk_0813AD38; void Emma(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; SetDefaultPriority(this, PRIO_MESSAGE); sub_0807DD50(this); } else { diff --git a/src/npc/ezlo.c b/src/npc/ezlo.c index 7ce78d54..307ec550 100644 --- a/src/npc/ezlo.c +++ b/src/npc/ezlo.c @@ -6,7 +6,7 @@ const u8 gUnk_08114144[]; // Ezlo as a cap in the Minish Woods, is destroyed as soon as link wears ezlo void Ezlo(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; SetDefaultPriority(this, PRIO_MESSAGE); sub_0807DD50(this); } diff --git a/src/npc/farore.c b/src/npc/farore.c index f9bfe746..32f6e6ee 100644 --- a/src/npc/farore.c +++ b/src/npc/farore.c @@ -39,7 +39,7 @@ void sub_08064A28(Entity* this) { void Farore_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } else { diff --git a/src/npc/festari.c b/src/npc/festari.c index 235463ce..5d698d36 100644 --- a/src/npc/festari.c +++ b/src/npc/festari.c @@ -110,7 +110,7 @@ void sub_0805FF2C(Entity* this, ScriptExecutionContext* context) { void Festari_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; SetDefaultPriority(this, PRIO_MESSAGE); InitAnimationForceUpdate(this, 8); diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c index 15d11888..e427c01e 100644 --- a/src/npc/ghostBrothers.c +++ b/src/npc/ghostBrothers.c @@ -229,7 +229,7 @@ void sub_08065F20(Entity* this) { if (this->interactType != 0) { this->interactType = 0; MessageFromTarget(0); - this->animIndex += 1; + this->animIndex++; if (gSpriteAnimations_GhostBrothers[this->animIndex] == 0) { this->animIndex = 0; } @@ -285,7 +285,7 @@ void sub_08065F64(Entity* this) { void GhostBrothers_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); } else { diff --git a/src/npc/gina.c b/src/npc/gina.c index 0f4973b8..4a729d2e 100644 --- a/src/npc/gina.c +++ b/src/npc/gina.c @@ -36,7 +36,7 @@ void Gina(Entity* this) { void Gina_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); } else { diff --git a/src/npc/gorman.c b/src/npc/gorman.c index fbeb916d..bfb30084 100644 --- a/src/npc/gorman.c +++ b/src/npc/gorman.c @@ -58,7 +58,7 @@ void sub_080697EC(Entity* this) { InitializeAnimation(this, tmp); } } else { - this->subtimer -= 1; + this->subtimer--; } } if (this->interactType != 0) { @@ -72,7 +72,7 @@ void sub_08069838(Entity* this) { if (LoadExtraSpriteData(this, &gUnk_08111C3C) == 0) { return; } - this->action += 1; + this->action++; this->field_0x68.HALF.LO = 0; this->field_0x68.HALF.HI = 0; sub_0807DD64(this); diff --git a/src/npc/gregal.c b/src/npc/gregal.c index 66ca8b4b..87333383 100644 --- a/src/npc/gregal.c +++ b/src/npc/gregal.c @@ -27,7 +27,7 @@ void sub_0806CAF4(Entity* this) { Entity* npc; if (this->action == 0) { - this->action += 1; + this->action++; SetDefaultPriority(this, PRIO_MESSAGE); npc = CreateNPC(GREGAL, 1, 0); if (npc != NULL) { @@ -52,7 +52,7 @@ void sub_0806CAF4(Entity* this) { void sub_0806CB80(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->animationState = 2; this->frameIndex = 0; SetDefaultPriority(this, PRIO_MESSAGE); @@ -64,7 +64,7 @@ void sub_0806CB80(Entity* this) { void sub_0806CBB4(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->animationState = 2; SetDefaultPriority(this, PRIO_MESSAGE); InitializeAnimation(this, 0x11); @@ -161,7 +161,7 @@ void sub_0806CD58(Entity* this) { void Gregal_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; SetDefaultPriority(this, PRIO_MESSAGE); InitAnimationForceUpdate(this, 6); diff --git a/src/npc/hurdyGurdyMan.c b/src/npc/hurdyGurdyMan.c index 64a4df9b..c56d745e 100644 --- a/src/npc/hurdyGurdyMan.c +++ b/src/npc/hurdyGurdyMan.c @@ -111,7 +111,7 @@ void HurdyGurdyMan_Fusion(Entity* this) { if (this->action == 0) { uVar1 = LoadExtraSpriteData(this, gUnk_081144F0); if (uVar1 != 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; SetDefaultPriority(this, PRIO_MESSAGE); InitializeAnimation(this, 10); diff --git a/src/npc/kid.c b/src/npc/kid.c index e546f3c8..77b91db9 100644 --- a/src/npc/kid.c +++ b/src/npc/kid.c @@ -229,7 +229,7 @@ void sub_080626E0(Entity* this, ScriptExecutionContext* context) { s32 uVar4; if (context->unk_18 == 0) { - context->unk_18 += 1; + context->unk_18++; context->unk_19 = 10; context->postScriptActions |= 2; sVar1 = *(s16*)&context->intVariable; @@ -332,7 +332,7 @@ void sub_08062948(Entity* this, ScriptExecutionContext* context) { s32 iVar4; if (context->unk_18 == 0) { - context->unk_18 += 1; + context->unk_18++; context->unk_12 = (Random() & 0x3f) + 0x20; uVar3 = Random() & 0x18; switch (this->direction) { diff --git a/src/npc/kingDaltus.c b/src/npc/kingDaltus.c index bb7c4743..bc22daa4 100644 --- a/src/npc/kingDaltus.c +++ b/src/npc/kingDaltus.c @@ -52,7 +52,7 @@ void sub_08066688(Entity* this) { if (this->subtimer == 0) { this->subtimer = 16; } else { - this->subtimer -= 1; + this->subtimer--; tmp = this->animIndex; } } @@ -112,7 +112,7 @@ void sub_0806673C(Entity* this) { void KingDaltus_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } else { diff --git a/src/npc/kingGustaf.c b/src/npc/kingGustaf.c index ae33c16c..c09d7de0 100644 --- a/src/npc/kingGustaf.c +++ b/src/npc/kingGustaf.c @@ -7,7 +7,7 @@ void KingGustaf(Entity* this) { s32 speed; if (this->action == 0) { - this->action += 1; + this->action++; this->spriteRendering.alphaBlend = 1; this->collisionLayer = 2; SetDefaultPriority(this, PRIO_MESSAGE); diff --git a/src/npc/marcy.c b/src/npc/marcy.c index d91dde22..57f979dd 100644 --- a/src/npc/marcy.c +++ b/src/npc/marcy.c @@ -6,7 +6,7 @@ void Marcy(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; SetDefaultPriority(this, PRIO_MESSAGE); sub_0807DD64(this); } diff --git a/src/npc/minishEzlo.c b/src/npc/minishEzlo.c index ff6742ed..2296d384 100644 --- a/src/npc/minishEzlo.c +++ b/src/npc/minishEzlo.c @@ -25,7 +25,7 @@ void MinishEzlo(Entity* this) { if (LoadExtraSpriteData(this, gUnk_0810C48C) == 0) { return; } - this->action += 1; + this->action++; this->animationState = this->timer * 2; SetDefaultPriority(this, PRIO_MESSAGE); sub_0807DD50(this); diff --git a/src/npc/ministerPotho.c b/src/npc/ministerPotho.c index d746dbaf..72323ed3 100644 --- a/src/npc/ministerPotho.c +++ b/src/npc/ministerPotho.c @@ -38,7 +38,7 @@ void sub_08066808(Entity* this) { if (this->subtimer == 0) { this->subtimer = 16; } else { - this->subtimer -= 1; + this->subtimer--; tmp = this->animIndex; } } @@ -107,7 +107,7 @@ void sub_08066904(Entity* this) { void MinisterPotho_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } else { diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c index 4901ae30..228d3341 100644 --- a/src/npc/mountainMinish.c +++ b/src/npc/mountainMinish.c @@ -266,7 +266,7 @@ void MountainMinish_Head(Entity* this) { void MountainMinish_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, gUnk_08111358) != 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitializeAnimation(this, 6); } diff --git a/src/npc/nayru.c b/src/npc/nayru.c index 9e3bea24..262b251c 100644 --- a/src/npc/nayru.c +++ b/src/npc/nayru.c @@ -39,7 +39,7 @@ void sub_08064928(Entity* this) { void Nayru_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 6); } else { diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c index 6e2701d3..ea11cd38 100644 --- a/src/npc/npc4E.c +++ b/src/npc/npc4E.c @@ -15,8 +15,8 @@ typedef struct { s8 unk_04; } gUnk_0810C89C_struct; -extern void script_Object3ELeftStoneOpening; // Cutscene data type? -extern void script_Object3ERightStoneOpening; // Cutscene data type? +extern void script_MinishVillageObjectLeftStoneOpening; // Cutscene data type? +extern void script_MinishVillageObjectRightStoneOpening; // Cutscene data type? const Hitbox gUnk_08114154; const u8 gUnk_0811415C[]; @@ -137,15 +137,15 @@ void sub_0806DB44(Entity* this, ScriptExecutionContext* context) { void sub_0806DB84(Entity* this, ScriptExecutionContext* context) { Entity* ent; this->hitbox = (Hitbox*)&gUnk_08114154; - ent = CreateObject(OBJECT_3E, 4, 0); + ent = CreateObject(MINISH_VILLAGE_OBJECT, 4, 0); if (ent != NULL) { PositionRelative(this, ent, Q_16_16(-8.0), 0); - *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_Object3ELeftStoneOpening); + *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_MinishVillageObjectLeftStoneOpening); } - ent = CreateObject(OBJECT_3E, 5, 0); + ent = CreateObject(MINISH_VILLAGE_OBJECT, 5, 0); if (ent != NULL) { PositionRelative(this, ent, Q_16_16(8.0), 0); - *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_Object3ERightStoneOpening); + *(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_MinishVillageObjectRightStoneOpening); } } @@ -209,7 +209,7 @@ void sub_0806DCC0(void) { void NPC4E_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; switch (this->type) { case 1: case 2: diff --git a/src/npc/npc4F.c b/src/npc/npc4F.c index 0ab80863..69cee66d 100644 --- a/src/npc/npc4F.c +++ b/src/npc/npc4F.c @@ -2,7 +2,7 @@ void NPC4F(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; InitAnimationForceUpdate(this, this->type); } UpdateAnimationSingleFrame(this); diff --git a/src/npc/npc5.c b/src/npc/npc5.c index 8c9948fd..2a78cc26 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -534,7 +534,7 @@ u32 sub_08061230(Entity* this) { } this->contactFlags = this->contactFlags & 0x7f; if (this->iframes != 0) { - this->iframes += 1; + this->iframes++; } return 0; } @@ -557,7 +557,7 @@ void sub_08061358(Entity* this) { sub_08060E70(this, 0); break; case 1: - this->timer -= 1; + this->timer--; if (this->timer != 0) { return; } diff --git a/src/npc/percy.c b/src/npc/percy.c index d2900a59..bb318c3b 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -130,7 +130,7 @@ void sub_0806B540(Entity* this) { if (CheckLocalFlag(0x3f) != 0) { return; } - context->unk_18 += 1; + context->unk_18++; SetLocalFlag(0x3f); break; case 1: @@ -169,7 +169,7 @@ void sub_0806B60C(Entity* this) { void Percy_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, gUnk_08112E1C) != 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitializeAnimation(this, 2); } diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c index 27640c14..15233b7b 100644 --- a/src/npc/phonograph.c +++ b/src/npc/phonograph.c @@ -15,7 +15,7 @@ void sub_0806EABC(Entity* this, u32 param); void Phonograph(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; this->field_0x68.HWORD = 1; this->field_0x6a.HWORD = 0xffff; diff --git a/src/npc/picolyteBottle.c b/src/npc/picolyteBottle.c index 24cd8acf..cda0f3c6 100644 --- a/src/npc/picolyteBottle.c +++ b/src/npc/picolyteBottle.c @@ -92,7 +92,7 @@ void PicolyteBottle_Action2(PicolyteBottleEntity* this) { } else { if (super->timer != 0) { super->timer = 0; - obj = CreateObject(OBJECT_35, 2, super->subtimer); + obj = CreateObject(CARLOV_OBJECT, 2, super->subtimer); if (obj != NULL) { obj->parent = super; super->child = obj; diff --git a/src/npc/pita.c b/src/npc/pita.c index 37cbd77d..a55c4012 100644 --- a/src/npc/pita.c +++ b/src/npc/pita.c @@ -18,7 +18,7 @@ void Pita(Entity* this) { #endif }; if (this->action == 0) { - this->action += 1; + this->action++; SetDefaultPriority(this, PRIO_MESSAGE); SortEntityAbove(this, this); this->hitbox = (Hitbox*)&gUnk_0810C428; diff --git a/src/npc/postman.c b/src/npc/postman.c index d80f92c4..37c773ef 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -150,7 +150,7 @@ void sub_08060528(Entity* this) { sub_080788E0(this); EnqueueSFX(SFX_PLY_JUMP); } else { - this->field_0x6a.HWORD -= 1; + this->field_0x6a.HWORD--; } } GravityUpdate(this, Q_8_8(24.0)); @@ -272,7 +272,7 @@ END_NONMATCH void Postman_Fusion(Entity* this) { if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitAnimationForceUpdate(this, 2); } else { diff --git a/src/npc/rem.c b/src/npc/rem.c index bd1bc6a4..f59f642c 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -84,7 +84,7 @@ void sub_0806A458(Entity* this) { switch (this->subAction) { case 0: if (--this->timer == 0) { - this->subAction += 1; + this->subAction++; } break; case 1: @@ -168,7 +168,7 @@ void sub_0806A5E8(Entity* this) { InitializeAnimation(this, 0x10); this->timer = (Random() & 0x3f) + 60; } - this->timer -= 1; + this->timer--; if (this->timer == 0) { this->timer = (Random() & 0x3f) + 120; SoundReq(SFX_REM_SLEEP); diff --git a/src/npc/sittingPerson.c b/src/npc/sittingPerson.c index 043aae5f..6f60f47e 100644 --- a/src/npc/sittingPerson.c +++ b/src/npc/sittingPerson.c @@ -6,9 +6,7 @@ extern void (*SittingPersion_Actions[])(Entity*); extern Dialog gUnk_0810CC08[]; extern SpriteLoadData gUnk_0810CB78[]; -extern u8 gUnk_02002B0E[]; extern u16 gUnk_0810CC04[]; -extern u8 gUnk_02002B0E[]; extern u16 gUnk_0810CBE4[][4]; extern u8 gUnk_0810CBC0[]; extern u8 gUnk_0810CD88[][4]; @@ -90,7 +88,7 @@ void sub_0806387C(Entity* this) { if (CheckLocalFlag(SHOP05_OPEN) == 0) { r5 = 0; for (r4 = 1; r4 <= 0x82; r4++) { - if (ReadBit(gUnk_02002B0E, r4)) { + if (ReadBit(&gSave.stats.filler4[4], r4)) { r5++; } } @@ -151,7 +149,7 @@ void sub_080639D0(Entity* this) { void SittingPerson_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_0810CB78[this->type * 3]) != 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; this->spriteSettings.flipX = 0; this->y.HALF.HI -= 4; diff --git a/src/npc/smallTownMinish.c b/src/npc/smallTownMinish.c index 207fcfdf..96e4d1b4 100644 --- a/src/npc/smallTownMinish.c +++ b/src/npc/smallTownMinish.c @@ -11,7 +11,7 @@ void SmallTownMinish(Entity* this) { static const Hitbox gUnk_081142FC = { -2, 1, { 0, 0, 0, 0 }, 6, 6 }; static const u8 gUnk_08114304[] = { -2, 1, 6, 6 }; if (this->action == 0) { - this->action += 1; + this->action++; this->hitbox = (Hitbox*)&gUnk_081142FC; sub_0807DD50(this); sub_08078850(this, 1, 0, gUnk_08114304); diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index 3c81cfd3..d7187ee3 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -130,7 +130,7 @@ void sub_0806522C(Entity* this) { void sub_08065250(Entity* this) { switch (sub_08056338()) { case 0: - this->subAction += 1; + this->subAction++; this->timer = 30; this->subtimer = 0; CreateSpeechBubbleExclamationMark(this, 8, 0xffffffe8); @@ -152,7 +152,7 @@ void sub_0806528C(Entity* this) { void sub_080652B0(Entity* this) { if ((gMessage.doTextBox & 0x7f) == 0) { - this->subAction += 1; + this->subAction++; this->timer = 10; gRoomVars.animFlags = this->subtimer; CreateItemEntity(ITEM_QST_DOGFOOD, 0, 0); @@ -161,10 +161,10 @@ void sub_080652B0(Entity* this) { void sub_080652E4(Entity* this) { if (this->timer != 0) { - this->timer -= 1; + this->timer--; } else { if (gPlayerEntity.action != PLAYER_ITEMGET) { - this->subAction += 1; + this->subAction++; MessageNoOverlap(TEXT_INDEX(TEXT_STOCKWELL, 0x19), this); } } @@ -172,7 +172,7 @@ void sub_080652E4(Entity* this) { void sub_08065314(Entity* this) { if ((gMessage.doTextBox & 0x7f) == 0) { - this->subAction += 1; + this->subAction++; MenuFadeIn(3, 3); } } @@ -252,7 +252,7 @@ void sub_08065370(Entity* this, ScriptExecutionContext* context) { SetLocalFlag(localFlag); } if (gSave.unk5C <= -2) { - gSave.unk5C += 1; + gSave.unk5C++; } if (gSave.unk5C >= 10) { diff --git a/src/npc/sturgeon.c b/src/npc/sturgeon.c index a181b50c..6d1c467d 100644 --- a/src/npc/sturgeon.c +++ b/src/npc/sturgeon.c @@ -153,7 +153,7 @@ void sub_08064D10(Entity* this) { void Sturgeon_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_0810FA38) != 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitializeAnimation(this, 6); } diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c index 6c998270..5204be36 100644 --- a/src/npc/tingleSiblings.c +++ b/src/npc/tingleSiblings.c @@ -189,7 +189,7 @@ void sub_08064F28(Entity* this, ScriptExecutionContext* context) { void TingleSiblings_Fusion(Entity* this) { u32 tmp; if (this->action == 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; tmp = 6; if (this->type == 0) { diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index 93c215e4..58299104 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -64,13 +64,18 @@ void sub_08061C00(Entity* this) { } } -NONMATCH("asm/non_matching/townsperson/Townsperson_Head.inc", void Townsperson_Head(Entity* this)) { - SetExtraSpriteFrame(this, 0, *(gUnk_0810B78C + (this->animIndex & 3)) + gUnk_0810B680[this->type].frame1); - SetExtraSpriteFrame(this, 1, this->frameIndex + gUnk_0810B680[this->type].frame2); +void Townsperson_Head(Entity* this) { + u32 tmp = this->animIndex & 3; + u32 tmp2 = gUnk_0810B78C[tmp]; + u32 tmp3; + tmp3 = tmp2 + (tmp3 = gUnk_0810B680[this->type].frame1); + SetExtraSpriteFrame(this, 0, tmp3); + tmp3 = this->frameIndex; + tmp3 += gUnk_0810B680[this->type].frame2; + SetExtraSpriteFrame(this, 1, tmp3); SetSpriteSubEntryOffsetData1(this, 1, 0); sub_0807000C(this); } -END_NONMATCH void sub_08061CB4(Entity* this, u32 arg1) { if (this->animIndex != arg1) { diff --git a/src/npc/vaatiReborn.c b/src/npc/vaatiReborn.c index a0e00fc0..f2837926 100644 --- a/src/npc/vaatiReborn.c +++ b/src/npc/vaatiReborn.c @@ -126,7 +126,7 @@ void VaatiRebornAction1(Entity* this) { switch (this->subAction) { case 0: if (--this->timer == 0) { - this->subAction += 1; + this->subAction++; } break; case 1: diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c index 0cf6e3a0..7951715c 100644 --- a/src/npc/windTribespeople.c +++ b/src/npc/windTribespeople.c @@ -205,7 +205,7 @@ void sub_0806C99C(Entity* this, ScriptExecutionContext* context) { flagAsBool = 2; } if (CheckLocalFlag(99) != 0) { - flagAsBool += 1; + flagAsBool++; } MessageNoOverlap(messageIndices[flagAsBool], this); } @@ -275,7 +275,7 @@ void sub_0806CA5C(Entity* this, ScriptExecutionContext* context) { void WindTribespeople_Fusion(Entity* this) { if (this->action == 0) { if (LoadExtraSpriteData(this, &gUnk_08113A1C[this->type * 4]) != 0) { - this->action += 1; + this->action++; this->spriteSettings.draw = 1; InitializeAnimation(this, 6); } diff --git a/src/object.c b/src/object.c index 42aed751..d4771b3f 100644 --- a/src/object.c +++ b/src/object.c @@ -11,41 +11,41 @@ void (*const gObjectFunctions[])(Entity*) = { [EZLO_CAP] = EzloCap, [PUSHED_BLOCK] = BlockPushed, [LOCKED_DOOR] = LockedDoor, - [OBJECT_9] = Object9, + [CAMERA_TARGET] = CameraTarget, [OBJECT_A] = ObjectA, - [OBJECT_B] = ObjectB, + [LINK_HOLDING_ITEM] = LinkHoldingItem, [CHEST_SPAWNER] = ChestSpawner, - [OBJECT_D] = ObjectD, - [OBJECT_E] = ObjectE, + [UNUSED_SKULL] = UnusedSkull, + [CRACKING_GROUND] = CrackingGround, [SPECIAL_FX] = SpecialFx, [PLAYER_CLONE] = PlayerClone, - [OBJECT_11] = Object11, - [OBJECT_12] = Object12, + [BUSH] = Bush, + [LIGHT_DOOR] = LightDoor, [RAILTRACK] = Railtrack, [LILYPAD_LARGE] = LilypadLarge, - [OBJECT_15] = Object15, + [CHUCHU_BOSS_PARTICLE] = ChuchuBossParticle, [FLOATING_PLATFORM] = FloatingPlatform, - [OBJECT_17] = Object17, + [GUST_JAR_PARTICLE] = GustJarParticle, [EVIL_SPIRIT] = EvilSpirit, [HOUSE_DOOR_EXT] = HouseDoorExterior, [RUPEE_OBJECT] = Rupee, [GREAT_FAIRY] = GreatFairy, - [OBJECT_1C] = Object1C, + [HOUSE_SIGN] = HouseSign, [OBJECT_1D] = Object1D, - [OBJECT_1E] = Object1E, + [MOLE_MITTS_PARTICLE] = MoleMittsParticle, [OBJECT_1F] = Object1F, - [OBJECT_20] = Object20, - [OBJECT_21] = Object21, + [SMOKE_PARTICLE] = SmokeParticle, + [DIRT_PARTICLE] = DirtParticle, [FIGURINE_DEVICE] = FigurineDevice, [EYE_SWITCH] = EyeSwitch, [PRESSURE_PLATE] = PressurePlate, [BIG_BARREL] = BigBarrel, [BARREL_INSIDE] = BarrelInside, [PUSHABLE_STATUE] = PushableStatue, - [OBJECT_28] = Object28, + [PARALLAX_ROOM_VIEW] = ParallaxRoomView, [AMBIENT_CLOUDS] = AmbientClouds, - [OBJECT_2A] = Object2A, - [OBJECT_2B] = Object2B, + [FLAME] = Flame, + [LILYPAD_LARGE_FALLING] = LilypadLargeFalling, [BEANSTALK] = Beanstalk, [SMOKE] = Smoke, [PUSHABLE_ROCK] = PushableRock, @@ -55,36 +55,36 @@ void (*const gObjectFunctions[])(Entity*) = { [PULLABLE_MUSHROOM] = PullableMushroom, [BOLLARD] = Bollard, [WARP_POINT] = WarpPoint, - [OBJECT_35] = Object35, - [OBJECT_36] = Object36, + [CARLOV_OBJECT] = CarlovObject, + [BARREL_SPIDERWEB] = BarrelSpiderweb, [OBJECT_37] = Object37, [JAR_PORTAL] = JarPortal, [BOSS_DOOR] = BossDoor, - [OBJECT_3A] = Object3A, - [PORTAL_MUSHROOM_STALKS] = MacroMushroomStalks, + [WHITE_TRIANGLE_EFFECT] = WhiteTriangleEffect, + [PORTAL_MUSHROOM_STALKS] = MacroMushroomStalk, [PORTAL_FALLING_PLAYER] = MacroPlayer, - [OBJECT_3D] = Object3D, - [OBJECT_3E] = Object3E, + [MINISH_PORTAL_CLOSEUP] = MinishPortalCloseup, + [MINISH_VILLAGE_OBJECT] = MinishVillageObject, [GIANT_LEAF] = GiantLeaf, [FAIRY] = Fairy, [LADDER_UP] = LadderUp, - [OBJECT_42] = Object42, - [OBJECT_43] = Object43, - [OBJECT_44] = Object44, - [OBJECT_45] = Object45, + [LINK_FIRE] = LinkFire, + [SWORD_PARTICLE] = SwordParticle, + [ROTATING_TRAPDOOR] = RotatingTrapdoor, + [LAMP_PARTICLE] = LampParticle, [GIANT_BOOK_LADDER] = GiantBookLadder, [HEART_CONTAINER] = HeartContainer, [FILE_SCREEN_OBJECTS] = FileScreenObjects, - [OBJECT_49] = Object49, + [CHUCHU_BOSS_START_PARTICLE] = ChuchuBossStartParticle, [BACKGROUND_CLOUD] = BackgroundCloud, - [OBJECT_4B] = Object4B, + [CHUCHU_BOSS_CUTSCENE] = ChuchuBossCutscene, [PUSHABLE_FURNITURE] = PushableFurniture, [FURNITURE] = Furniture, [MINISH_SIZED_ENTRANCE] = MinishSizedEntrance, [ARCHWAY] = Archway, [GIANT_ROCK] = GiantRock, [GIANT_ROCK2] = GiantRock2, - [OBJECT_52] = Object52, + [SPECIAL_CHEST] = SpecialChest, [OBJECT_53] = Object53, [PULLABLE_LEVER] = PullableLever, [MINECART] = Minecart, @@ -93,22 +93,22 @@ void (*const gObjectFunctions[])(Entity*) = { [GENTARI_CURTAIN] = GentariCurtain, [LAVA_PLATFORM] = LavaPlatform, [PAPER] = Paper, - [OBJECT_5B] = Object5B, + [BED_COVER] = BedCover, [MASK] = Mask, [HOUSE_DOOR_INT] = HouseDoorInterior, [WHIRLWIND] = Whirlwind, [OBJECT_BLOCKING_STAIRS] = ObjectBlockingStairs, [SWORDSMAN_NEWSLETTER] = SwordsmanNewsletter, - [OBJECT_61] = Object61, + [EZLO_CAP_FLYING] = EzloCapFlying, [GIANT_TWIG] = GiantTwig, [OBJECT_63] = Object63, - [OBJECT_64] = Object64, + [THUNDERBOLD] = Thunderbold, [LADDER_HOLE] = LadderHoleInBookshelf, - [OBJECT_66] = Object66, - [OBJECT_67] = Object67, - [OBJECT_68] = Object68, - [OBJECT_69] = Object69, - [OBJECT_6A] = Object6A, + [WATER_DROP_OBJECT] = WaterDropObject, + [GLEEROK_PARTICLE] = GleerokParticle, + [LINK_EMPTYING_BOTTLE] = LinkEmptyingBottle, + [CUTSCENE_ORCHESTRATOR] = CutsceneOrchestrator, + [CUTSCENE_MISC_OBJECT] = CutsceneMiscObject, [CRENEL_BEAN_SPROUT] = CrenelBeanSprout, [MINECART_DOOR] = MinecartDoor, [OBJECT_ON_PILLAR] = ObjectOnPillar, @@ -118,25 +118,25 @@ void (*const gObjectFunctions[])(Entity*) = { [PUSHABLE_GRAVE] = PushableGrave, [STONE_TABLET] = StoneTablet, [LILYPAD_SMALL] = LilypadSmall, - [OBJECT_74] = Object74, - [OBJECT_75] = Object75, - [OBJECT_76] = Object76, + [MINISH_PORTAL_STONE] = MinishPortalStone, + [MACRO_CRYSTAL] = MacroCrystal, + [MACRO_LEAF] = MacroLeaf, [BELL] = Bell, [HUGE_DECORATION] = MacroDecoration, - [OBJECT_79] = Object79, + [SHRINKING_HIEROGLYPHS] = ShrinkingHieroglyphs, [STEAM] = Steam, [PUSHABLE_LEVER] = PushableLever, - [HUGE_SHOES] = MacroShoes, + [HUGE_SHOES] = MacroShoe, [OBJECT_ON_BEETLE] = ObjectOnSpinyBeetle, - [OBJECT_7E] = Object7E, + [MAZAAL_OBJECT] = MazaalObject, [PICO_BLOOM] = PicoBloom, [BOARD] = Board, - [OBJECT_81] = Object81, + [BENCH] = Bench, [BIG_VORTEX] = BigVortex, [BIG_PUSHABLE_LEVER] = BigPushableLever, [SMALL_ICE_BLOCK] = SmallIceBlock, [BIG_ICE_BLOCK] = BigIceBlock, - [OBJECT_86] = Object86, + [TRAPDOOR] = Trapdoor, [OCTOROK_BOSS_OBJECT] = OctorokBossObject, [HUGE_BOOK] = MacroBook, [MAZAAL_BOSS_OBJECT] = MazaalBossObject, @@ -144,20 +144,20 @@ void (*const gObjectFunctions[])(Entity*) = { [DOUBLE_BOOKSHELF] = DoubleBookshelf, [BOOK] = Book, [FIREPLACE] = Fireplace, - [OBJECT_8E] = Object8E, + [LIGHT_RAY] = LightRay, [FROZEN_WATER_ELEMENT] = FrozenWaterElement, - [OBJECT_90] = Object90, + [WATER_ELEMENT] = WaterElement, [FROZEN_OCTOROK] = FrozenOctorok, [BAKER_OVEN] = BakerOven, [LAMP] = Lamp, [WIND_TRIBE_FLAG] = WindTribeFlag, [BIRD] = Bird, - [OBJECT_96] = Object96, + [GRAVEYARD_KEY] = GraveyardKey, [KEY_STEALING_TAKKURI] = KeyStealingTakkuri, - [OBJECT_98] = Object98, - [OBJECT_99] = Object99, + [GURUGURU_BAR] = GuruguruBar, + [HIT_SWITCH] = HitSwitch, [HUGE_ACORN] = MacroAcorn, - [OBJECT_9B] = Object9B, + [VAATI2_PARTICLE] = Vaati2Particle, [TREE_HIDING_PORTAL] = TreeHidingPortal, [LIGHTABLE_SWITCH] = LightableSwitch, [TREE_THORNS] = TreeThorns, @@ -168,34 +168,34 @@ void (*const gObjectFunctions[])(Entity*) = { [CLOUD] = Cloud, [MINISH_LIGHT] = MinishLight, [FIREBALL_CHAIN] = FireballChain, - [OBJECT_A6] = ObjectA6, + [SANCTUARY_STONE_TABLET] = SanctuaryStoneTablet, [OBJECT_A7] = ObjectA7, [OBJECT_A8] = ObjectA8, - [OBJECT_A9] = ObjectA9, + [MULLDOZER_SPAWN_POINT] = MulldozerSpawnPoint, [WATERFALL_OPENING] = WaterfallOpening, - [OBJECT_AB] = ObjectAB, + [VAATI1_PORTAL] = Vaati1Portal, [FOUR_ELEMENTS] = FourElements, - [OBJECT_AD] = ObjectAD, + [ELEMENTS_BACKGROUND] = ElementsBackground, [FLOATING_BLOCK] = FloatingBlock, - [OBJECT_AF] = ObjectAF, + [VAATI3_ARM] = Vaati3Arm, [METAL_DOOR] = MetalDoor, [JAIL_BARS] = JailBars, - [OBJECT_B2] = ObjectB2, - [OBJECT_B3] = ObjectB3, - [OBJECT_B4] = ObjectB4, - [OBJECT_B5] = ObjectB5, - [OBJECT_B6] = ObjectB6, + [FAN_WIND] = FanWind, + [KINSTONE_SPARK] = KinstoneSpark, + [JAPANESE_SUBTITLE] = JapaneseSubtitle, + [VAATI3_PLAYER_OBJECT] = Vaati3PlayerObject, + [VAATI3_DEATH] = Vaati3Death, [WELL] = Well, [WIND_TRIBE_TELEPORTER] = WindTribeTeleporter, - [CUCCO_MINIGAME] = ObjectB9, + [CUCCO_MINIGAME] = CuccoMinigame, [GYORG_BOSS_OBJECT] = GyorgBossObject, [WINDCREST] = Windcrest, [LIT_AREA] = LitArea, - [OBJECT_BD] = ObjectBD, + [TITLE_SCREEN_OBJECT] = TitleScreenObject, [PINWHEEL] = Pinwheel, [OBJECT_BF] = ObjectBF, [ENEMY_ITEM] = EnemyItem, - [OBJECT_C1] = ObjectC1, + [OBJECT_C1] = LinkAnimation, }; void ObjectInit(Entity*); diff --git a/src/object/ambientClouds.c b/src/object/ambientClouds.c index acddf0c1..3cd73953 100644 --- a/src/object/ambientClouds.c +++ b/src/object/ambientClouds.c @@ -1,26 +1,32 @@ -#include "entity.h" +/** + * @file ambientClouds.c + * @ingroup Objects + * + * @brief Ambient Clouds object + */ #include "asm.h" -#include "object.h" -#include "functions.h" #include "effects.h" +#include "entity.h" +#include "functions.h" +#include "object.h" -void sub_08089874(Entity* this); -void sub_08089944(Entity* this); -void sub_08089A7C(Entity* this); -void sub_08089AE0(Entity* this); +void AmbientClouds_Init(Entity* this); +void AmbientClouds_Action1(Entity* this); +void AmbientClouds_Action2(Entity* this); +void AmbientClouds_Action3(Entity* this); void AmbientClouds(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_08089874, - sub_08089944, - sub_08089A7C, - sub_08089AE0, + static void (*const AmbientClouds_Actions[])(Entity*) = { + AmbientClouds_Init, + AmbientClouds_Action1, + AmbientClouds_Action2, + AmbientClouds_Action3, }; - actionFuncs[this->action](this); + AmbientClouds_Actions[this->action](this); UpdateAnimationVariableFrames(this, (Random() & 1) + 1); } -void sub_08089874(Entity* this) { +void AmbientClouds_Init(Entity* this) { Entity* pEVar2; #ifndef EU @@ -32,7 +38,7 @@ void sub_08089874(Entity* this) { this->action = 3; this->spriteRendering.b3 = 3; InitializeAnimation(this, 0); - sub_08089AE0(this); + AmbientClouds_Action3(this); return; } else { this->parent = NULL; @@ -70,7 +76,7 @@ void sub_08089874(Entity* this) { #endif } -void sub_08089944(Entity* this) { +void AmbientClouds_Action1(Entity* this) { int iVar1; Entity* pEVar2; @@ -123,7 +129,7 @@ void sub_08089944(Entity* this) { } } -void sub_08089A7C(Entity* this) { +void AmbientClouds_Action2(Entity* this) { this->y.HALF.HI += this->type2 * -0x24; if (EntityInRectRadius(this, &gPlayerEntity, 0xf, 0xf)) { gPlayerState.field_0x14 = 1; @@ -137,7 +143,7 @@ void sub_08089A7C(Entity* this) { this->y.HALF.HI += this->type2 * 0x24; } -void sub_08089AE0(Entity* this) { +void AmbientClouds_Action3(Entity* this) { if (EntityInRectRadius(this, &gPlayerEntity, 0xf, 0xf)) { gPlayerState.field_0x14 = 1; } diff --git a/src/object/angryStatue.c b/src/object/angryStatue.c index f997a69f..107ba864 100644 --- a/src/object/angryStatue.c +++ b/src/object/angryStatue.c @@ -1,9 +1,15 @@ -#include "entity.h" +/** + * @file angryStatue.c + * @ingroup Objects + * + * @brief Angry Statue object + */ #include "asm.h" +#include "entity.h" +#include "physics.h" +#include "projectile.h" #include "room.h" #include "sound.h" -#include "projectile.h" -#include "physics.h" extern Hitbox gUnk_080FD178; diff --git a/src/object/archway.c b/src/object/archway.c index 556d5268..76a9df16 100644 --- a/src/object/archway.c +++ b/src/object/archway.c @@ -1,3 +1,9 @@ +/** + * @file archway.c + * @ingroup Objects + * + * @brief Archway object + */ #include "entity.h" #include "game.h" diff --git a/src/object/backgroundCloud.c b/src/object/backgroundCloud.c index bd76632d..658b5e5d 100644 --- a/src/object/backgroundCloud.c +++ b/src/object/backgroundCloud.c @@ -1,19 +1,25 @@ +/** + * @file backgroundCloud.c + * @ingroup Objects + * + * @brief BackgroundCloud object + */ #include "object.h" -void sub_0808F658(Entity*); -void sub_0808F6E0(Entity*); -void sub_0808F70C(Entity*); +void BackgroundCloud_Init(Entity*); +void BackgroundCloud_Action1(Entity*); +void BackgroundCloud_Action2(Entity*); void BackgroundCloud(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0808F658, - sub_0808F6E0, - sub_0808F70C, + static void (*const BackgroundCloud_Actions[])(Entity*) = { + BackgroundCloud_Init, + BackgroundCloud_Action1, + BackgroundCloud_Action2, }; - actionFuncs[this->action](this); + BackgroundCloud_Actions[this->action](this); } -void sub_0808F658(Entity* this) { +void BackgroundCloud_Init(Entity* this) { static const u8 gUnk_08121EB0[] = { 0x30, 0x28, 0x20 }; this->action = 1; this->spriteSettings.draw = 1; @@ -31,14 +37,14 @@ void sub_0808F658(Entity* this) { this->subAction = 0; } -void sub_0808F6E0(Entity* this) { +void BackgroundCloud_Action1(Entity* 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; } -void sub_0808F70C(Entity* this) { +void BackgroundCloud_Action2(Entity* this) { static const u8 gUnk_08121EB3[] = { 0x8, 0x28, 0x48, 0x98, 0 }; if (this->subAction == 0) { this->subAction = 1; diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c index 5d48244f..754f029c 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -1,22 +1,28 @@ -#include "object.h" +/** + * @file bakerOven.c + * @ingroup Objects + * + * @brief Baker Oven object + */ #include "functions.h" +#include "object.h" extern void SoundReqClipped(Entity*, u32); void sub_0809CDF0(Entity*); -void sub_0809CC74(Entity*); -void sub_0809CD0C(Entity*); -void sub_0809CDB4(Entity*); +void BakerOven_Init(Entity*); +void BakerOven_Action1(Entity*); +void BakerOven_Action2(Entity*); void BakerOven(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0809CC74, - sub_0809CD0C, - sub_0809CDB4, + static void (*const BakerOven_Actions[])(Entity*) = { + BakerOven_Init, + BakerOven_Action1, + BakerOven_Action2, }; - actionFuncs[this->action](this); + BakerOven_Actions[this->action](this); } -void sub_0809CC74(Entity* this) { +void BakerOven_Init(Entity* this) { u32 i; Entity* ent; @@ -46,7 +52,7 @@ void sub_0809CC74(Entity* this) { } } -void sub_0809CD0C(Entity* this) { +void BakerOven_Action1(Entity* this) { u8* frames; if (this->type) { @@ -76,7 +82,7 @@ void sub_0809CD0C(Entity* this) { } } -void sub_0809CDB4(Entity* this) { +void BakerOven_Action2(Entity* this) { /* Reset cloud position and start animation. */ if (--this->timer == 0) { this->action = 1; diff --git a/src/object/barrelInside.c b/src/object/barrelInside.c index adc437ba..9c67eeb4 100644 --- a/src/object/barrelInside.c +++ b/src/object/barrelInside.c @@ -1,3 +1,9 @@ +/** + * @file barrelInside.c + * @ingroup Objects + * + * @brief Barrel Inside object + */ #include "entity.h" const u8 gUnk_08120C80[]; diff --git a/src/object/object36.c b/src/object/barrelSpiderweb.c index e7f23a70..4c608779 100644 --- a/src/object/object36.c +++ b/src/object/barrelSpiderweb.c @@ -1,37 +1,37 @@ /** - * @file object36.c + * @file barrelSpiderweb.c * @ingroup Objects * - * @brief Object36 object + * @brief Barrel Spiderweb object */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "hitbox.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; -} Object36Entity; +} BarrelSpiderwebEntity; -void sub_0808BB30(Object36Entity*); -void sub_0808BC3C(Object36Entity*); -void sub_0808BD14(Object36Entity*); -void sub_0808BDB0(Object36Entity*); -void sub_0808BBE0(Object36Entity*); -void sub_0808BD00(Object36Entity*); +void BarrelSpiderweb_Init(BarrelSpiderwebEntity*); +void BarrelSpiderweb_Action1(BarrelSpiderwebEntity*); +void BarrelSpiderweb_Action2(BarrelSpiderwebEntity*); +void sub_0808BDB0(BarrelSpiderwebEntity*); +void sub_0808BBE0(BarrelSpiderwebEntity*); +void sub_0808BD00(BarrelSpiderwebEntity*); -void Object36(Object36Entity* this) { - static void (*const gUnk_08121440[])(Object36Entity*) = { - sub_0808BB30, - sub_0808BC3C, - sub_0808BD14, +void BarrelSpiderweb(BarrelSpiderwebEntity* this) { + static void (*const BarrelSpiderweb_Actions[])(BarrelSpiderwebEntity*) = { + BarrelSpiderweb_Init, + BarrelSpiderweb_Action1, + BarrelSpiderweb_Action2, }; - gUnk_08121440[super->action](this); + BarrelSpiderweb_Actions[super->action](this); } -void sub_0808BB30(Object36Entity* this) { +void BarrelSpiderweb_Init(BarrelSpiderwebEntity* this) { if (CheckGlobalFlag(LV1TARU_OPEN)) { LoadGfxGroup(0x4a); DeleteThisEntity(); @@ -57,7 +57,7 @@ void sub_0808BB30(Object36Entity* this) { } } -void sub_0808BBE0(Object36Entity* this) { +void sub_0808BBE0(BarrelSpiderwebEntity* this) { static const u16 gUnk_0812144C[] = { 192, 256, 208, 240, 224, 224, 240, 208, 256, 192, 256, 192, 240, 208, 224, 224, 208, 240, 192, 256 }; static const u8 gUnk_08121474[] = { @@ -75,7 +75,7 @@ void sub_0808BBE0(Object36Entity* this) { } } -void sub_0808BC3C(Object36Entity* this) { +void BarrelSpiderweb_Action1(BarrelSpiderwebEntity* this) { s32 tmp; super->x.HALF.HI = gRoomControls.origin_x + 0x78; tmp = -0x170; @@ -109,13 +109,13 @@ void sub_0808BC3C(Object36Entity* this) { } } -void sub_0808BD00(Object36Entity* this) { +void sub_0808BD00(BarrelSpiderwebEntity* this) { SetGlobalFlag(LV1TARU_OPEN); SoundReq(SFX_SECRET); DeleteThisEntity(); } -void sub_0808BD14(Object36Entity* this) { +void BarrelSpiderweb_Action2(BarrelSpiderwebEntity* this) { if (super->subtimer != 0) { super->subtimer -= 8; @@ -140,7 +140,7 @@ void sub_0808BD14(Object36Entity* this) { } } -void sub_0808BDB0(Object36Entity* this) { +void sub_0808BDB0(BarrelSpiderwebEntity* this) { LinkedList* list = &gEntityLists[6]; Entity* it = list->first; super->parent = NULL; diff --git a/src/object/beanstalk.c b/src/object/beanstalk.c index 48d3ac96..801c89d2 100644 --- a/src/object/beanstalk.c +++ b/src/object/beanstalk.c @@ -4,7 +4,6 @@ * * @brief Beanstalk object */ - #define NENT_DEPRECATED #include "global.h" #include "object.h" @@ -312,7 +311,7 @@ void Beanstalk_Action1Type8SubAction0(BeanstalkEntity* this) { this->unk_70 = COORD_TO_TILE(super); SetTile(0x4017, this->unk_70, 1); super->subAction = 1; - obj = CreateObjectWithParent(super, OBJECT_15, 0, 0); + obj = CreateObjectWithParent(super, CHUCHU_BOSS_PARTICLE, 0, 0); if (obj != NULL) { obj->y.HALF.HI = super->y.HALF.HI + 0x38; obj->spriteIndex = super->spriteIndex; diff --git a/src/object/object5B.c b/src/object/bedCover.c index 01c324d7..fe21b77e 100644 --- a/src/object/object5B.c +++ b/src/object/bedCover.c @@ -1,34 +1,34 @@ /** - * @file object5B.c + * @file bedCover.c * @ingroup Objects * - * @brief Object5B object + * @brief Bed Cover object */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; /*0x68*/ u8 unk_68[0x1a]; /*0x82*/ u16 unk_82; /*0x84*/ ScriptExecutionContext* unk_84; -} Object5BEntity; +} BedCoverEntity; -void sub_080928C8(Object5BEntity*); -void nullsub_119(Object5BEntity*); -void sub_08092930(Object5BEntity*); -void sub_08092940(Object5BEntity*); -void sub_08092958(Object5BEntity*, ScriptExecutionContext*); +void sub_080928C8(BedCoverEntity*); +void nullsub_119(BedCoverEntity*); +void sub_08092930(BedCoverEntity*); +void sub_08092940(BedCoverEntity*); +void sub_08092958(BedCoverEntity*, ScriptExecutionContext*); -void Object5B(Object5BEntity* this) { - static void (*const gUnk_08122794[])(Object5BEntity*) = { +void BedCover(BedCoverEntity* this) { + static void (*const gUnk_08122794[])(BedCoverEntity*) = { sub_080928C8, nullsub_119, }; - static void (*const gUnk_0812279C[])(Object5BEntity*) = { + static void (*const gUnk_0812279C[])(BedCoverEntity*) = { sub_08092930, sub_08092940, }; @@ -39,7 +39,7 @@ void Object5B(Object5BEntity* this) { } } -void sub_080928C8(Object5BEntity* this) { +void sub_080928C8(BedCoverEntity* this) { super->action = 1; super->spriteSettings.draw = 1; super->frameIndex = super->type; @@ -48,7 +48,7 @@ void sub_080928C8(Object5BEntity* this) { super->spriteOrientation.flipY = 2; switch (super->type) { case 2: - CreateObjectWithParent(super, OBJECT_5B, 4, 0); + CreateObjectWithParent(super, BED_COVER, 4, 0); break; case 4: super->spritePriority.b0 = 7; @@ -56,20 +56,20 @@ void sub_080928C8(Object5BEntity* this) { } } -void nullsub_119(Object5BEntity* this) { +void nullsub_119(BedCoverEntity* this) { } -void sub_08092930(Object5BEntity* this) { +void sub_08092930(BedCoverEntity* this) { sub_080928C8(this); this->unk_82 = 0; } -void sub_08092940(Object5BEntity* this) { +void sub_08092940(BedCoverEntity* this) { ExecuteScript(super, this->unk_84); sub_08092958(this, this->unk_84); } -void sub_08092958(Object5BEntity* this, ScriptExecutionContext* context) { +void sub_08092958(BedCoverEntity* this, ScriptExecutionContext* context) { u32 tmp; while (context->postScriptActions != 0) { tmp = (~context->postScriptActions + 1) & context->postScriptActions; diff --git a/src/object/bell.c b/src/object/bell.c index da1043c3..28edcb79 100644 --- a/src/object/bell.c +++ b/src/object/bell.c @@ -1,17 +1,23 @@ +/** + * @file bell.c + * @ingroup Objects + * + * @brief Bell object + */ #include "object.h" -void sub_08097D90(Entity*); -void sub_08097DCC(Entity*); +void Bell_Init(Entity*); +void Bell_Action1(Entity*); void Bell(Entity* ent) { - static void (*const actionFuncs[])(Entity*) = { - sub_08097D90, - sub_08097DCC, + static void (*const Bell_Actions[])(Entity*) = { + Bell_Init, + Bell_Action1, }; - actionFuncs[ent->action](ent); + Bell_Actions[ent->action](ent); } -void sub_08097D90(Entity* ent) { +void Bell_Init(Entity* ent) { ent->action = 1; ent->spriteSettings.draw = 1; ent->collisionLayer = 1; @@ -20,6 +26,6 @@ void sub_08097D90(Entity* ent) { InitAnimationForceUpdate(ent, 0); } -void sub_08097DCC(Entity* ent) { +void Bell_Action1(Entity* ent) { UpdateAnimationSingleFrame(ent); } diff --git a/src/object/object81.c b/src/object/bench.c index 975fbd2b..47514668 100644 --- a/src/object/object81.c +++ b/src/object/bench.c @@ -1,28 +1,34 @@ +/** + * @file bench.c + * @ingroup Objects + * + * @brief Bench object + */ #define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "functions.h" +#include "player.h" #include "sound.h" typedef struct { Entity base; u8 filler[0x18]; u16 tilePos; -} Object81Entity; +} BenchEntity; -void Object81_Init(Object81Entity*); -void Object81_Action1(Object81Entity*); +void Bench_Init(BenchEntity*); +void Bench_Action1(BenchEntity*); -void Object81(Entity* this) { - static void (*const actionFuncs[])(Object81Entity*) = { - Object81_Init, - Object81_Action1, +void Bench(Entity* this) { + static void (*const Bench_Actions[])(BenchEntity*) = { + Bench_Init, + Bench_Action1, }; - actionFuncs[this->action]((Object81Entity*)this); + Bench_Actions[this->action]((BenchEntity*)this); } -void Object81_Init(Object81Entity* this) { +void Bench_Init(BenchEntity* this) { super->action = 1; super->timer = 0; this->tilePos = COORD_TO_TILE(super); @@ -35,5 +41,5 @@ void Object81_Init(Object81Entity* this) { sub_08000148(0x47, this->tilePos - 0x40, 1); } -void Object81_Action1(Object81Entity* this) { +void Bench_Action1(BenchEntity* this) { } diff --git a/src/object/bigBarrel.c b/src/object/bigBarrel.c index 25c8a48d..6b12f308 100644 --- a/src/object/bigBarrel.c +++ b/src/object/bigBarrel.c @@ -1,12 +1,18 @@ +/** + * @file bigBarrel.c + * @ingroup Objects + * + * @brief Big Barrel object + */ #define NENT_DEPRECATED +#include "asm.h" +#include "common.h" #include "entity.h" #include "flags.h" -#include "save.h" +#include "object.h" #include "room.h" -#include "asm.h" +#include "save.h" #include "sound.h" -#include "common.h" -#include "object.h" typedef struct { Entity base; @@ -248,7 +254,7 @@ void sub_08088E74(BigBarrelEntity* this) { DeleteEntity(super); } else { if ((gRoomTransition.frameCount & 7U) == 0) { - ent = CreateObjectWithParent(super, OBJECT_2A, 0, 0x1e); + ent = CreateObjectWithParent(super, FLAME, 0, 0x1e); if (ent != NULL) { ent->updatePriority = 3; ent->spriteRendering.b3 = 0; @@ -279,7 +285,7 @@ void sub_08088F20(BigBarrelEntity* this) { super->action = 2; super->timer = 30; RequestPriorityDuration(super, 270); - pEVar3 = CreateObject(OBJECT_2A, 1, 0); + pEVar3 = CreateObject(FLAME, 1, 0); if (pEVar3 != NULL) { pEVar3->updatePriority = 3; pEVar3->x.HALF.HI = super->x.HALF.HI; diff --git a/src/object/bigIceBlock.c b/src/object/bigIceBlock.c index 289c41ef..bb0fb7ca 100644 --- a/src/object/bigIceBlock.c +++ b/src/object/bigIceBlock.c @@ -6,11 +6,11 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "hitbox.h" #include "item.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; @@ -84,7 +84,7 @@ void BigIceBlock_Action2(BigIceBlockEntity* this) { return; } } else { - super->timer += 1; + super->timer++; } tmp = gUnk_081237B0[super->timer >> 5]; SetAffineInfo(super, 0x100, tmp, 0); diff --git a/src/object/bigPushableLever.c b/src/object/bigPushableLever.c index 8403bbea..8f5a3808 100644 --- a/src/object/bigPushableLever.c +++ b/src/object/bigPushableLever.c @@ -6,9 +6,9 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index 0347dd24..6d11e27a 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -1,29 +1,35 @@ -#include "global.h" +/** + * @file bigVortex.c + * @ingroup Objects + * + * @brief Big Vortex object + */ #include "entity.h" #include "flags.h" -#include "object.h" #include "functions.h" +#include "global.h" +#include "object.h" void sub_08098E3C(Entity*); void sub_08098E88(Entity*); -void sub_08098D1C(Entity*); -void sub_08098D6C(Entity*); -void sub_08098D9C(Entity*); -void sub_08098DC4(Entity*); -void sub_08098E34(Entity*); +void BigVortex_Init(Entity*); +void BigVortex_Action1(Entity*); +void BigVortex_Action2(Entity*); +void BigVortex_Action3(Entity*); +void BigVortex_Action4(Entity*); void BigVortex(Entity* this) { - static void (*const gUnk_0812367C[])(Entity*) = { - sub_08098D1C, sub_08098D6C, sub_08098D9C, sub_08098DC4, sub_08098E34, + static void (*const BigVortex_Actions[])(Entity*) = { + BigVortex_Init, BigVortex_Action1, BigVortex_Action2, BigVortex_Action3, BigVortex_Action4, }; if (this->type == 0) { - gUnk_0812367C[this->action](this); + BigVortex_Actions[this->action](this); } else { sub_08098E3C(this); } } -void sub_08098D1C(Entity* this) { +void BigVortex_Init(Entity* this) { u32 temp; this->action = 1; this->z.HALF.HI = -0x10; @@ -41,7 +47,7 @@ void sub_08098D1C(Entity* this) { InitAnimationForceUpdate(this, 0); } -void sub_08098D6C(Entity* this) { +void BigVortex_Action1(Entity* this) { Entity* ent; if (CheckFlags(this->field_0x86.HWORD)) { @@ -54,7 +60,7 @@ void sub_08098D6C(Entity* this) { } } -void sub_08098D9C(Entity* this) { +void BigVortex_Action2(Entity* this) { if (--this->timer == 0) { this->action = 3; this->spriteSettings.draw = TRUE; @@ -62,7 +68,7 @@ void sub_08098D9C(Entity* this) { } } -void sub_08098DC4(Entity* this) { +void BigVortex_Action3(Entity* this) { if (sub_0800419C(this, &gPlayerEntity, 8, 8) != 0) { CopyPosition(this, &gPlayerEntity); @@ -82,7 +88,7 @@ void sub_08098DC4(Entity* this) { UpdateAnimationSingleFrame(this); } -void sub_08098E34(Entity* this) { +void BigVortex_Action4(Entity* this) { UpdateAnimationSingleFrame(this); } diff --git a/src/object/bird.c b/src/object/bird.c index 499f413b..480cc984 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -1,10 +1,16 @@ -#include "save.h" -#include "object.h" +/** + * @file bird.c + * @ingroup Objects + * + * @brief Bird object + */ +#include "collision.h" #include "functions.h" +#include "game.h" #include "item.h" #include "message.h" -#include "game.h" -#include "collision.h" +#include "object.h" +#include "save.h" extern u16 script_EzloTalkOcarina[]; @@ -33,12 +39,12 @@ void Bird(Entity* this) { } void Bird_Type0(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { + static void (*const Bird_Type0_Actions[])(Entity*) = { Bird_Type0_Init, Bird_Type0_Action1, }; - actionFuncs[this->action](this); + Bird_Type0_Actions[this->action](this); } void Bird_Type0_Init(Entity* this) { @@ -80,11 +86,11 @@ void Bird_Type0_Action1(Entity* this) { } void Bird_Type1(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { + static void (*const Bird_Type1_Actions[])(Entity*) = { Bird_Type1_Init, Bird_Type1_Action1, }; - actionFuncs[this->action](this); + Bird_Type1_Actions[this->action](this); } void Bird_Type1_Init(Entity* this) { @@ -95,11 +101,11 @@ void Bird_Type1_Init(Entity* this) { } void Bird_Type1_Action1(Entity* this) { - static void (*const subActionFuncs[])(Entity*) = { + static void (*const Bird_Type1_Action1_Subactions[])(Entity*) = { Bird_Type1_Action1_Subaction0, Bird_Type1_Action1_Subaction1, }; - subActionFuncs[this->subAction](this); + Bird_Type1_Action1_Subactions[this->subAction](this); } void Bird_Type1_Action1_Subaction0(Entity* this) { @@ -134,11 +140,11 @@ void Bird_Type1_Action1_Subaction1(Entity* this) { } void Bird_Type2(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { + static void (*const Bird_Type2_Actions[])(Entity*) = { Bird_Type2_Init, Bird_Type2_Action1, }; - actionFuncs[this->action](this); + Bird_Type2_Actions[this->action](this); } void Bird_Type2_Init(Entity* this) { @@ -325,7 +331,7 @@ void Bird_Type9(Entity* this) { ResetPlayerEventPriority(); gPauseMenuOptions.disabled = 0; if (!CheckGlobalFlag(WARP_1ST)) { - pEVar1 = CreateObject(OBJECT_69, 0, 0); + pEVar1 = CreateObject(CUTSCENE_ORCHESTRATOR, 0, 0); if (pEVar1 != NULL) { *(ScriptExecutionContext**)&pEVar1->cutsceneBeh = StartCutscene(pEVar1, script_EzloTalkOcarina); SetGlobalFlag(WARP_1ST); diff --git a/src/object/blockPushed.c b/src/object/blockPushed.c index 35d9d883..eb19a284 100644 --- a/src/object/blockPushed.c +++ b/src/object/blockPushed.c @@ -6,26 +6,26 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; /*0x68*/ u32 unk_68; } BlockPushedEntity; -extern void (*const gUnk_0811F624[])(BlockPushedEntity*); +extern void (*const BlockPushed_Actions[])(BlockPushedEntity*); extern const Hitbox* const gUnk_0811F64C[]; void sub_080832D8(u32, BlockPushedEntity*); void sub_080830B8(BlockPushedEntity*); void BlockPushed(BlockPushedEntity* this) { - gUnk_0811F624[super->action](this); + BlockPushed_Actions[super->action](this); } -void sub_08082EB4(BlockPushedEntity* this) { +void BlockPushed_Init(BlockPushedEntity* this) { u16 tmp; u32 pos; @@ -90,7 +90,7 @@ void sub_08082EB4(BlockPushedEntity* this) { EnqueueSFX(SFX_10F); } -void sub_08083094(BlockPushedEntity* this) { +void BlockPushed_Action1(BlockPushedEntity* this) { LinearMoveUpdate(super); sub_0800445C(super); if (--super->timer == 0) { @@ -164,9 +164,9 @@ void sub_080832D8(u32 param_1, BlockPushedEntity* this) { } } -void (*const gUnk_0811F624[])(BlockPushedEntity*) = { - sub_08082EB4, - sub_08083094, +void (*const BlockPushed_Actions[])(BlockPushedEntity*) = { + BlockPushed_Init, + BlockPushed_Action1, }; const Hitbox gUnk_0811F62C = { 0, 0, { 0, 0, 0, 0 }, 5, 4 }; const Hitbox gUnk_0811F634 = { 0, 0, { 0, 0, 0, 0 }, 13, 12 }; diff --git a/src/object/board.c b/src/object/board.c index 18e7ff97..6bb75f1c 100644 --- a/src/object/board.c +++ b/src/object/board.c @@ -1,48 +1,54 @@ +/** + * @file board.c + * @ingroup Objects + * + * @brief Board object + */ #define NENT_DEPRECATED -#include "entity.h" -#include "room.h" #include "asm.h" -#include "player.h" +#include "entity.h" #include "functions.h" +#include "player.h" +#include "room.h" typedef struct { Entity base; u8 filler[0x10]; - u16 unk78; - u16 unk7a; + u16 x; + u16 y; u16 unk7c; u16 unk7e; u16 tile; - u8 unk82; - u8 unk83; + u8 width; + u8 height; } BoardEntity; void Board_Init(BoardEntity*); -void sub_08098BE0(BoardEntity*); +void Board_Action1(BoardEntity*); void sub_08098BE8(BoardEntity*); bool32 sub_08098C30(BoardEntity*, Entity*); void sub_0807AAF8(Entity*, u32); void Board(Entity* this) { - static void (*const actionFuncs[])(BoardEntity*) = { + static void (*const Board_Actions[])(BoardEntity*) = { Board_Init, - sub_08098BE0, + Board_Action1, }; - actionFuncs[this->action]((BoardEntity*)this); + Board_Actions[this->action]((BoardEntity*)this); } void Board_Init(BoardEntity* this) { - static const u8 gUnk_0812366C[] = { 0x10, 0x1e, 0xc, 0x6, 0x10, 0x6, 0x0, 0x0 }; - const u8* pbVar2 = &gUnk_0812366C[super->type * 2]; + static const u8 Board_Sizes[] = { 0x10, 0x1e, 0xc, 0x6, 0x10, 0x6, 0x0, 0x0 }; + const u8* size = &Board_Sizes[super->type * 2]; super->action = 1; super->spriteSettings.draw = 1; super->frameIndex = super->type; - this->unk82 = pbVar2[0]; - this->unk83 = pbVar2[1]; - this->unk78 = super->x.HALF.HI - (this->unk82 >> 1); - this->unk7a = super->y.HALF.HI - (this->unk83 >> 1); + this->width = size[0]; + this->height = size[1]; + this->x = super->x.HALF.HI - (this->width >> 1); + this->y = super->y.HALF.HI - (this->height >> 1); this->tile = COORD_TO_TILE(super); super->collisionLayer = 1; UpdateSpriteForCollisionLayer(super); @@ -53,7 +59,7 @@ void Board_Init(BoardEntity* this) { sub_08098BE8(this); } -void sub_08098BE0(BoardEntity* this) { +void Board_Action1(BoardEntity* this) { sub_08098BE8(this); } @@ -66,12 +72,12 @@ void sub_08098BE8(BoardEntity* this) { } bool32 sub_08098C30(BoardEntity* this, Entity* ent) { - u32 uVar1 = 0; - u32 diffx = ent->x.HALF.HI - this->unk78; - u32 diffy = ent->y.HALF.HI - this->unk7a; + u32 result = FALSE; + u32 diffX = ent->x.HALF.HI - this->x; + u32 diffY = ent->y.HALF.HI - this->y; - if (diffx <= this->unk82 && diffy <= this->unk83) { - uVar1 = 1; + if (diffX <= this->width && diffY <= this->height) { + result = TRUE; } - return uVar1; + return result; } diff --git a/src/object/bollard.c b/src/object/bollard.c index 1c6a8bda..2f73e5be 100644 --- a/src/object/bollard.c +++ b/src/object/bollard.c @@ -1,10 +1,16 @@ +/** + * @file bollard.c + * @ingroup Objects + * + * @brief Bollard object + */ #define NENT_DEPRECATED +#include "asm.h" #include "entity.h" #include "flags.h" -#include "asm.h" -#include "sound.h" -#include "room.h" #include "functions.h" +#include "room.h" +#include "sound.h" typedef struct { Entity base; @@ -17,24 +23,24 @@ typedef struct { u16 flags; } BollardEntity; -void sub_0808B2AC(BollardEntity*); -void sub_0808B2CC(BollardEntity*); -void sub_0808B324(BollardEntity*); -void sub_0808B344(BollardEntity*); -void sub_0808B38C(BollardEntity*); +void Bollard_Init(BollardEntity*); +void Bollard_Action1(BollardEntity*); +void Bollard_Action2(BollardEntity*); +void Bollard_Action3(BollardEntity*); +void Bollard_Action4(BollardEntity*); void sub_0808B41C(BollardEntity*); void sub_0808B3AC(BollardEntity*); void sub_0808B42C(BollardEntity*); void Bollard(Entity* this) { - static void (*const actionFuncs[])(BollardEntity*) = { - sub_0808B2AC, sub_0808B2CC, sub_0808B324, sub_0808B344, sub_0808B38C, + static void (*const Bollard_Actions[])(BollardEntity*) = { + Bollard_Init, Bollard_Action1, Bollard_Action2, Bollard_Action3, Bollard_Action4, }; - actionFuncs[this->action]((BollardEntity*)this); + Bollard_Actions[this->action]((BollardEntity*)this); } -void sub_0808B2AC(BollardEntity* this) { +void Bollard_Init(BollardEntity* this) { if (super->type2 == 0) { sub_0808B41C(this); sub_0808B3AC(this); @@ -43,7 +49,7 @@ void sub_0808B2AC(BollardEntity* this) { } } -void sub_0808B2CC(BollardEntity* this) { +void Bollard_Action1(BollardEntity* this) { if (super->type2 == 0) { if (CheckFlags(this->flags) == 0) { return; @@ -57,14 +63,14 @@ void sub_0808B2CC(BollardEntity* this) { EnqueueSFX(SFX_1A5); } -void sub_0808B324(BollardEntity* this) { +void Bollard_Action2(BollardEntity* this) { GetNextFrame(super); if (super->frame & ANIM_DONE) { sub_0808B42C(this); } } -void sub_0808B344(BollardEntity* this) { +void Bollard_Action3(BollardEntity* this) { if (super->type2 == 0) { if (CheckFlags(this->flags) != 0) { return; @@ -78,7 +84,7 @@ void sub_0808B344(BollardEntity* this) { EnqueueSFX(SFX_1A5); } -void sub_0808B38C(BollardEntity* this) { +void Bollard_Action4(BollardEntity* this) { GetNextFrame(super); if (super->frame & ANIM_DONE) { sub_0808B41C(this); diff --git a/src/object/book.c b/src/object/book.c index 01f3a15e..941b5c52 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -1,21 +1,27 @@ -#include "object.h" +/** + * @file book.c + * @ingroup Objects + * + * @brief Book object + */ +#include "collision.h" #include "functions.h" -#include "message.h" #include "item.h" +#include "message.h" #include "npc.h" -#include "collision.h" +#include "object.h" -extern void (*const BookActionFuncs[])(Entity*); +extern void (*const Book_Actions[])(Entity*); extern s8 const gUnk_08123D94[]; u32 sub_0809B688(Entity*); void sub_0809B6B0(Entity*, Entity*); void Book(Entity* this) { - BookActionFuncs[this->action](this); + Book_Actions[this->action](this); } -void sub_0809B3C4(Entity* this) { +void Book_Init(Entity* this) { u32 obtained = GetInventoryValue(this->type + ITEM_QST_BOOK1); if (this->type2 != 3) { if (obtained != 0) { @@ -74,7 +80,7 @@ void sub_0809B3C4(Entity* this) { } } -void sub_0809B4A8(Entity* this) { +void Book_Action1(Entity* this) { sub_0800445C(this); if (this->field_0x80.HALF.LO != 0) { @@ -105,7 +111,7 @@ void sub_0809B4A8(Entity* this) { } } -void sub_0809B524(Entity* this) { +void Book_Action2(Entity* this) { if (--this->timer == 0) { if (--this->subtimer == 0) { this->action = 3; @@ -121,7 +127,7 @@ void sub_0809B524(Entity* this) { LinearMoveUpdate(this); } -void sub_0809B56C(Entity* this) { +void Book_Action3(Entity* this) { Entity* fx; if (sub_080044EC(this, 0x2800) != 1) { @@ -139,7 +145,7 @@ void sub_0809B56C(Entity* this) { } } -void sub_0809B5B4(Entity* this) { +void Book_Action4(Entity* this) { if (gPlayerState.flags & PL_MINISH) { sub_0800445C(this); } else if (IsCollidingPlayer(this)) { @@ -148,7 +154,7 @@ void sub_0809B5B4(Entity* this) { } } -void sub_0809B5EC(Entity* this) { +void Book_Action5(Entity* this) { if (this->spriteSettings.draw == 1) { switch (this->subAction) { case 0: { @@ -223,8 +229,8 @@ void sub_0809B6B0(Entity* parent, Entity* this) { this->spritePriority.b0 = 3 - this->type; } -void (*const BookActionFuncs[])(Entity*) = { - sub_0809B3C4, sub_0809B4A8, sub_0809B524, sub_0809B56C, sub_0809B5B4, sub_0809B5EC, +void (*const Book_Actions[])(Entity*) = { + Book_Init, Book_Action1, Book_Action2, Book_Action3, Book_Action4, Book_Action5, }; const s8 gUnk_08123D94[] = { -22, -20, -20, -20 }; diff --git a/src/object/bossDoor.c b/src/object/bossDoor.c index c24d41ff..4f9a5220 100644 --- a/src/object/bossDoor.c +++ b/src/object/bossDoor.c @@ -6,10 +6,10 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "hitbox.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; @@ -206,7 +206,7 @@ void sub_0808C5D0(BossDoorEntity* this) { } void sub_0808C650(Entity* this, u32 param_2) { - Entity* obj = CreateObject(OBJECT_3A, 0, param_2); + Entity* obj = CreateObject(WHITE_TRIANGLE_EFFECT, 0, param_2); if (obj != NULL) { obj->parent = this; gUnk_02036BB8 = FALSE; diff --git a/src/object/object11.c b/src/object/bush.c index 76f688b7..acdac424 100644 --- a/src/object/object11.c +++ b/src/object/bush.c @@ -1,10 +1,9 @@ /** - * @file object11.c + * @file bush.c * @ingroup Objects * - * @brief Object11 object + * @brief Bush object */ - #define NENT_DEPRECATED #include "global.h" #include "object.h" @@ -16,7 +15,7 @@ typedef struct { /*0x68*/ u8 unk_68[8]; /*0x70*/ u16 unk_70; /*0x72*/ u8 unk_72; -} Object11Entity; +} BushEntity; typedef struct { u8 unk_0; @@ -24,38 +23,38 @@ typedef struct { u8 unk_2; } struct_08120588; -void Object11_Init(Object11Entity*); -void Object11_Action1(Object11Entity*); -void Object11_Action2(Object11Entity*); -void Object11_Action2SubAction0(Object11Entity*); -void Object11_Action2SubAction1(Object11Entity*); -void Object11_Action2SubAction2(Object11Entity*); -void Object11_Action2SubAction3(Object11Entity*); -void Object11_Action2SubAction4(Object11Entity*); -void Object11_Action2SubAction5(Object11Entity*); +void Bush_Init(BushEntity*); +void Bush_Action1(BushEntity*); +void Bush_Action2(BushEntity*); +void Bush_Action2SubAction0(BushEntity*); +void Bush_Action2SubAction1(BushEntity*); +void Bush_Action2SubAction2(BushEntity*); +void Bush_Action2SubAction3(BushEntity*); +void Bush_Action2SubAction4(BushEntity*); +void Bush_Action2SubAction5(BushEntity*); -void Object11(Object11Entity* this) { - static void (*const Object11_Actions[])(Object11Entity*) = { - Object11_Init, - Object11_Action1, - Object11_Action2, +void Bush(BushEntity* this) { + static void (*const Bush_Actions[])(BushEntity*) = { + Bush_Init, + Bush_Action1, + Bush_Action2, }; if (!EntityIsDeleted(super)) { - Object11_Actions[super->action](this); + Bush_Actions[super->action](this); } } extern const Hitbox gUnk_081205B4; -void Object11_Init(Object11Entity* this) { +void Bush_Init(BushEntity* this) { static const struct_08120588 gUnk_08120588[] = { { 0, 32, 1 }, { 0, 64, 2 }, { 0, 32, 2 }, { 13, 1, 0 }, { 22, 1, 0 }, }; if (super->type == 3) { - Object11_Action2SubAction5(this); + Bush_Action2SubAction5(this); } sub_08004168(super); if (super->type == 4) { - Object11_Action2SubAction5(this); + Bush_Action2SubAction5(this); } super->action = 2; super->flags |= ENT_COLLIDE; @@ -75,57 +74,57 @@ void Object11_Init(Object11Entity* this) { InitializeAnimation(super, gUnk_08120588[super->type].unk_0); } -void Object11_Action1(Object11Entity* this) { +void Bush_Action1(BushEntity* this) { if (((gPlayerState.field_0x1c & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) { RestorePrevTileEntity(COORD_TO_TILE(super), super->collisionLayer); DeleteThisEntity(); } } -void Object11_Action2(Object11Entity* this) { - static void (*const Object11_Action2SubActions[])(Object11Entity*) = { - Object11_Action2SubAction0, Object11_Action2SubAction1, Object11_Action2SubAction2, - Object11_Action2SubAction3, Object11_Action2SubAction4, Object11_Action2SubAction5, +void Bush_Action2(BushEntity* this) { + static void (*const Bush_Action2SubActions[])(BushEntity*) = { + Bush_Action2SubAction0, Bush_Action2SubAction1, Bush_Action2SubAction2, + Bush_Action2SubAction3, Bush_Action2SubAction4, Bush_Action2SubAction5, }; - Object11_Action2SubActions[super->subAction](this); + Bush_Action2SubActions[super->subAction](this); } const Hitbox gUnk_081205B4 = { 0, 0, { 6, 3, 3, 6 }, 6, 6 }; -void Object11_Action2SubAction0(Object11Entity* this) { +void Bush_Action2SubAction0(BushEntity* this) { super->subAction = 1; - Object11_Action2SubAction1(this); + Bush_Action2SubAction1(this); } -void Object11_Action2SubAction1(Object11Entity* this) { - Object11_Action1(this); +void Bush_Action2SubAction1(BushEntity* this) { + Bush_Action1(this); sub_0806F4E8(super); if ((super->gustJarTolerance != 0) && (--super->gustJarTolerance == 0)) { super->subAction = 2; } } -void Object11_Action2SubAction2(Object11Entity* this) { +void Bush_Action2SubAction2(BushEntity* this) { if (this->unk_72 == 0) { this->unk_72 = 1; super->spriteOffsetX = 0; sub_0807B9B8(this->unk_70, COORD_TO_TILE(super), super->collisionLayer); } if (((gPlayerState.field_0x1c & 0xf) != 1) || ((super->contactFlags & 0x7f) != 0x13)) { - Object11_Action2SubAction5(this); + Bush_Action2SubAction5(this); } if (sub_0806F3E4(super) && ((super->gustJarFlags & 0xf) == 1)) { DeleteThisEntity(); } } -void Object11_Action2SubAction3(Object11Entity* this) { +void Bush_Action2SubAction3(BushEntity* this) { } -void Object11_Action2SubAction4(Object11Entity* this) { +void Bush_Action2SubAction4(BushEntity* this) { } -void Object11_Action2SubAction5(Object11Entity* this) { +void Bush_Action2SubAction5(BushEntity* this) { switch (super->type2) { case 0xff: break; diff --git a/src/object/button.c b/src/object/button.c index 9688c31d..b20cc57f 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -1,23 +1,29 @@ +/** + * @file button.c + * @ingroup Objects + * + * @brief Button object + */ #include "object.h" #include "functions.h" -void sub_08081AE0(Entity*); -void sub_08081B84(Entity*); -void sub_08081BAC(Entity*); -void sub_08081BE0(Entity*); -void sub_08081C30(Entity*); -void sub_08081C98(Entity*); +void Button_Init(Entity*); +void Button_Action1(Entity*); +void Button_Action2(Entity*); +void Button_Action3(Entity*); +void Button_Action4(Entity*); +void Button_Action5(Entity*); void Button(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_08081AE0, sub_08081B84, sub_08081BAC, sub_08081BE0, sub_08081C30, sub_08081C98, + static void (*const Button_Actions[])(Entity*) = { + Button_Init, Button_Action1, Button_Action2, Button_Action3, Button_Action4, Button_Action5, }; - actionFuncs[this->action](this); + Button_Actions[this->action](this); } extern u32 sub_08081E3C(Entity*); -void sub_08081AE0(Entity* this) { +void Button_Init(Entity* this) { COLLISION_OFF(this); this->updatePriority = PRIO_NO_BLOCK; this->y.HALF.HI++; @@ -39,7 +45,7 @@ void sub_08081AE0(Entity* this) { } } -void sub_08081B84(Entity* this) { +void Button_Action1(Entity* this) { if (sub_08081E3C(this)) { this->action = 2; this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer); @@ -49,7 +55,7 @@ void sub_08081B84(Entity* this) { u32 sub_08081CB0(Entity*); void sub_08081FF8(Entity*); -void sub_08081BAC(Entity* this) { +void Button_Action2(Entity* this) { if (sub_08081CB0(this)) { this->subAction = 0; this->timer = 10; @@ -67,7 +73,7 @@ u32 sub_08081F7C(Entity*, u32); u32 sub_08081D28(Entity*); void sub_08081E6C(Entity*); -void sub_08081BE0(Entity* this) { +void Button_Action3(Entity* this) { if (!sub_08081F7C(this, 0x78)) return; if (!sub_08081D28(this)) { @@ -83,7 +89,7 @@ void sub_08081BE0(Entity* this) { } } -void sub_08081C30(Entity* this) { +void Button_Action4(Entity* this) { if (this->timer != 0) { this->timer--; if (this->subtimer != 0) { @@ -102,7 +108,7 @@ void sub_08081C30(Entity* this) { } } -void sub_08081C98(Entity* this) { +void Button_Action5(Entity* this) { if (sub_08081F7C(this, 0x7a)) { sub_08081E6C(this); } diff --git a/src/object/cabinFurniture.c b/src/object/cabinFurniture.c index 8fceff87..c2704dcd 100644 --- a/src/object/cabinFurniture.c +++ b/src/object/cabinFurniture.c @@ -1,8 +1,14 @@ +/** + * @file cabinFurniture.c + * @ingroup Objects + * + * @brief Cabin Furniture object + */ #define NENT_DEPRECATED +#include "asm.h" #include "entity.h" -#include "room.h" #include "flags.h" -#include "asm.h" +#include "room.h" typedef struct { Entity base; @@ -11,17 +17,17 @@ typedef struct { } CabinFurnitureEntity; void CabinFurniture_Init(CabinFurnitureEntity* this); -void nullsub_535(CabinFurnitureEntity* this); -void nullsub_2a(CabinFurnitureEntity* this); +void CabinFurniture_Action1(CabinFurnitureEntity* this); +void CabinFurniture_Action2(CabinFurnitureEntity* this); void nullsub_2(CabinFurnitureEntity* this); void CabinFurniture(Entity* this) { - static void (*const actionFuncs[])(CabinFurnitureEntity*) = { + static void (*const CabinFurniture_Actions[])(CabinFurnitureEntity*) = { CabinFurniture_Init, - nullsub_535, - nullsub_2a, + CabinFurniture_Action1, + CabinFurniture_Action2, }; - actionFuncs[this->action]((CabinFurnitureEntity*)this); + CabinFurniture_Actions[this->action]((CabinFurnitureEntity*)this); } void CabinFurniture_Init(CabinFurnitureEntity* this) { @@ -74,10 +80,10 @@ void CabinFurniture_Init(CabinFurnitureEntity* this) { } } -void nullsub_535(CabinFurnitureEntity* this) { +void CabinFurniture_Action1(CabinFurnitureEntity* this) { } -void nullsub_2a(CabinFurnitureEntity* this) { +void CabinFurniture_Action2(CabinFurnitureEntity* this) { nullsub_2(this); } diff --git a/src/object/object9.c b/src/object/cameraTarget.c index b6f7a0a2..1f3dde08 100644 --- a/src/object/object9.c +++ b/src/object/cameraTarget.c @@ -1,22 +1,28 @@ +/** + * @file cameraTarget.c + * @ingroup Objects + * + * @brief Camera Target object + */ #define NENT_DEPRECATED -#include "entity.h" -#include "message.h" -#include "kinstone.h" #include "common.h" +#include "entity.h" #include "functions.h" +#include "kinstone.h" +#include "message.h" // typedef struct { // Entity base; // u8 filler[0x18]; // u16 tilePos; -// } Object81Entity; +// } BenchEntity; extern void sub_080ADDD8(u32, u32); void sub_080838DC(Entity*); void sub_08083A40(Entity*); -void Object9_Init(Entity*); -void Object9_Action1(Entity*); -void Object9_Action2(Entity*); +void CameraTarget_Init(Entity*); +void CameraTarget_Action1(Entity*); +void CameraTarget_Action2(Entity*); #ifdef EU static const s32 gUnk_0811F744[] = { @@ -34,11 +40,11 @@ static const s32 gUnk_0811F744[] = { }; #endif -void Object9(Entity* this) { +void CameraTarget(Entity* this) { static void (*const gUnk_0811F754[])(Entity*) = { - Object9_Init, - Object9_Action1, - Object9_Action2, + CameraTarget_Init, + CameraTarget_Action1, + CameraTarget_Action2, }; u32 uVar2 = gPlayerState.field_0x27[0] > 0; @@ -76,7 +82,7 @@ void sub_080838DC(Entity* this) { this->action = 0; } -void Object9_Init(Entity* this) { +void CameraTarget_Init(Entity* this) { if (this->spriteAnimation[0] != 1) { LoadSwapGFX(this, 1, 1); this->spriteVramOffset -= 0x10; @@ -92,7 +98,7 @@ void Object9_Init(Entity* this) { SetDefaultPriority(this, 6); } -void Object9_Action1(Entity* this) { +void CameraTarget_Action1(Entity* this) { if (this->timer) { this->timer--; } else { @@ -104,7 +110,7 @@ void Object9_Action1(Entity* this) { } } -void Object9_Action2(Entity* this) { +void CameraTarget_Action2(Entity* this) { u32 bVar1; u32 bVar2; u32 bVar3; @@ -152,5 +158,5 @@ void sub_08083A40(Entity* this) { } this->spriteOffsetY = -18; InitializeAnimation(this, bVar1); - Object9_Action2(this); + CameraTarget_Action2(this); } diff --git a/src/object/object35.c b/src/object/carlovObject.c index 75f401f6..f4ffa8a9 100644 --- a/src/object/object35.c +++ b/src/object/carlovObject.c @@ -1,14 +1,13 @@ /** - * @file object35.c + * @file carlovObject.c * @ingroup Objects * - * @brief Object35 object + * @brief Carlov Object object */ - #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; @@ -17,44 +16,44 @@ typedef struct { /*0x72*/ u16 unk_72; /*0x74*/ u16 unk_74; /*0x76*/ u16 unk_76; -} Object35Entity; +} CarlovObjectEntity; extern void sub_080836DC(Entity*, u32, u32); // lockedDoor extern void sub_08083814(Entity*, u32); // lockedDoor -void Object35_Type0(Object35Entity*); -void Object35_Type1(Object35Entity*); -void Object35_Type2(Object35Entity*); -void Object35_Type0Init(Object35Entity*); -void Object35_Type0Action1(Object35Entity*); -void Object35_Type0Action2(Object35Entity*); -void Object35_Type1Init(Object35Entity*); -void Object35_Type1Action1(Object35Entity*); -void Object35_Type1Action2(Object35Entity*); -void Object35_Type1Action3(Object35Entity*); -void Object35_Type1Action4(Object35Entity*); -void Object35_Type1Action5(Object35Entity*); -void Object35_Type2Init(Object35Entity*); -void Object35_Type2Action1(Object35Entity*); - -void Object35(Object35Entity* this) { - static void (*const Object35_Types[])(Object35Entity*) = { - Object35_Type0, - Object35_Type1, - Object35_Type2, +void CarlovObject_Type0(CarlovObjectEntity*); +void CarlovObject_Type1(CarlovObjectEntity*); +void CarlovObject_Type2(CarlovObjectEntity*); +void CarlovObject_Type0Init(CarlovObjectEntity*); +void CarlovObject_Type0Action1(CarlovObjectEntity*); +void CarlovObject_Type0Action2(CarlovObjectEntity*); +void CarlovObject_Type1Init(CarlovObjectEntity*); +void CarlovObject_Type1Action1(CarlovObjectEntity*); +void CarlovObject_Type1Action2(CarlovObjectEntity*); +void CarlovObject_Type1Action3(CarlovObjectEntity*); +void CarlovObject_Type1Action4(CarlovObjectEntity*); +void CarlovObject_Type1Action5(CarlovObjectEntity*); +void CarlovObject_Type2Init(CarlovObjectEntity*); +void CarlovObject_Type2Action1(CarlovObjectEntity*); + +void CarlovObject(CarlovObjectEntity* this) { + static void (*const CarlovObject_Types[])(CarlovObjectEntity*) = { + CarlovObject_Type0, + CarlovObject_Type1, + CarlovObject_Type2, }; - Object35_Types[super->type](this); + CarlovObject_Types[super->type](this); } -void Object35_Type0(Object35Entity* this) { - static void (*const Object35_Type0Actions[])(Object35Entity*) = { - Object35_Type0Init, - Object35_Type0Action1, - Object35_Type0Action2, +void CarlovObject_Type0(CarlovObjectEntity* this) { + static void (*const CarlovObject_Type0Actions[])(CarlovObjectEntity*) = { + CarlovObject_Type0Init, + CarlovObject_Type0Action1, + CarlovObject_Type0Action2, }; - Object35_Type0Actions[super->action](this); + CarlovObject_Type0Actions[super->action](this); } -void Object35_Type0Init(Object35Entity* this) { +void CarlovObject_Type0Init(CarlovObjectEntity* this) { super->action = 2; super->type2 = 2; super->collisionLayer = 2; @@ -64,7 +63,7 @@ void Object35_Type0Init(Object35Entity* this) { InitializeAnimation(super, super->type2); } -void Object35_Type0Action1(Object35Entity* this) { +void CarlovObject_Type0Action1(CarlovObjectEntity* this) { s8 tmp; GetNextFrame(super); if (--super->timer == 0) { @@ -76,20 +75,20 @@ void Object35_Type0Action1(Object35Entity* this) { } } -void Object35_Type0Action2(Object35Entity* this) { +void CarlovObject_Type0Action2(CarlovObjectEntity* this) { GetNextFrame(super); } -void Object35_Type1(Object35Entity* this) { - static void (*const Object35_Type1Actions[])(Object35Entity*) = { - Object35_Type1Init, Object35_Type1Action1, Object35_Type1Action2, - Object35_Type1Action3, Object35_Type1Action4, Object35_Type1Action5, +void CarlovObject_Type1(CarlovObjectEntity* this) { + static void (*const CarlovObject_Type1Actions[])(CarlovObjectEntity*) = { + CarlovObject_Type1Init, CarlovObject_Type1Action1, CarlovObject_Type1Action2, + CarlovObject_Type1Action3, CarlovObject_Type1Action4, CarlovObject_Type1Action5, }; - Object35_Type1Actions[super->action](this); + CarlovObject_Type1Actions[super->action](this); gPlayerState.mobility |= 0x80; } -void Object35_Type1Init(Object35Entity* this) { +void CarlovObject_Type1Init(CarlovObjectEntity* this) { super->speed = 0x300; super->frameIndex = 0; this->unk_70 = super->x.HALF.HI; @@ -109,7 +108,7 @@ void Object35_Type1Init(Object35Entity* this) { } } -void Object35_Type1Action1(Object35Entity* this) { +void CarlovObject_Type1Action1(CarlovObjectEntity* this) { if (CheckRoomFlag(0)) { super->action = 2; super->timer = 7; @@ -119,7 +118,7 @@ void Object35_Type1Action1(Object35Entity* this) { } } -void Object35_Type1Action2(Object35Entity* this) { +void CarlovObject_Type1Action2(CarlovObjectEntity* this) { LinearMoveUpdate(super); if (--super->timer == 0) { super->action = 5; @@ -130,14 +129,14 @@ void Object35_Type1Action2(Object35Entity* this) { } } -void Object35_Type1Action3(Object35Entity* this) { +void CarlovObject_Type1Action3(CarlovObjectEntity* this) { if (sub_08083734(super, 2)) { super->action = 4; sub_080836DC(super, 2, this->unk_76); } } -void Object35_Type1Action4(Object35Entity* this) { +void CarlovObject_Type1Action4(CarlovObjectEntity* this) { LinearMoveUpdate(super); if (--super->timer == 0) { super->action = 5; @@ -147,18 +146,18 @@ void Object35_Type1Action4(Object35Entity* this) { } } -void Object35_Type1Action5(Object35Entity* this) { +void CarlovObject_Type1Action5(CarlovObjectEntity* this) { } -void Object35_Type2(Object35Entity* this) { - static void (*const Object35_Type2Actions[])(Object35Entity*) = { - Object35_Type2Init, - Object35_Type2Action1, +void CarlovObject_Type2(CarlovObjectEntity* this) { + static void (*const CarlovObject_Type2Actions[])(CarlovObjectEntity*) = { + CarlovObject_Type2Init, + CarlovObject_Type2Action1, }; - Object35_Type2Actions[super->action](this); + CarlovObject_Type2Actions[super->action](this); } -void Object35_Type2Init(Object35Entity* this) { +void CarlovObject_Type2Init(CarlovObjectEntity* this) { super->action = 1; super->timer = 16; super->z.HALF.HI -= 0x10; @@ -173,7 +172,7 @@ void Object35_Type2Init(Object35Entity* this) { CreateDust(super); } -void Object35_Type2Action1(Object35Entity* this) { +void CarlovObject_Type2Action1(CarlovObjectEntity* this) { if (--super->timer == 0) { DeleteThisEntity(); } diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index 04ca7420..731e8042 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -6,12 +6,12 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" +#include "item.h" #include "object.h" -#include "functions.h" #include "screen.h" #include "structures.h" -#include "item.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/object4B.c b/src/object/chuchuBossCutscene.c index 8f923a5d..808782e1 100644 --- a/src/object/object4B.c +++ b/src/object/chuchuBossCutscene.c @@ -1,44 +1,44 @@ /** - * @file object4B.c + * @file chuchuBossCutscene.c * @ingroup Objects * - * @brief Object4B object + * @brief Chuchu Boss Cutscene object */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "menu.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; -} Object4BEntity; +} ChuchuBossCutsceneEntity; -void Object4B_Init(Object4BEntity*); -void Object4B_Action1(Object4BEntity*); -void Object4B_Action2(Object4BEntity*); -void Object4B_Action3(Object4BEntity*); -void Object4B_Action4(Object4BEntity*); -void Object4B_Action5(Object4BEntity*); -void Object4B_Action6(Object4BEntity*); -void Object4B_Action7(Object4BEntity*); +void ChuchuBossCutscene_Init(ChuchuBossCutsceneEntity*); +void ChuchuBossCutscene_Action1(ChuchuBossCutsceneEntity*); +void ChuchuBossCutscene_Action2(ChuchuBossCutsceneEntity*); +void ChuchuBossCutscene_Action3(ChuchuBossCutsceneEntity*); +void ChuchuBossCutscene_Action4(ChuchuBossCutsceneEntity*); +void ChuchuBossCutscene_Action5(ChuchuBossCutsceneEntity*); +void ChuchuBossCutscene_Action6(ChuchuBossCutsceneEntity*); +void ChuchuBossCutscene_Action7(ChuchuBossCutsceneEntity*); -void Object4B(Object4BEntity* this) { - static void (*const Object4B_Actions[])(Object4BEntity*) = { - Object4B_Init, Object4B_Action1, Object4B_Action2, Object4B_Action3, - Object4B_Action4, Object4B_Action5, Object4B_Action6, Object4B_Action7, +void ChuchuBossCutscene(ChuchuBossCutsceneEntity* this) { + static void (*const ChuchuBossCutscene_Actions[])(ChuchuBossCutsceneEntity*) = { + ChuchuBossCutscene_Init, ChuchuBossCutscene_Action1, ChuchuBossCutscene_Action2, ChuchuBossCutscene_Action3, + ChuchuBossCutscene_Action4, ChuchuBossCutscene_Action5, ChuchuBossCutscene_Action6, ChuchuBossCutscene_Action7, }; - Object4B_Actions[super->action](this); + ChuchuBossCutscene_Actions[super->action](this); } -void Object4B_Init(Object4BEntity* this) { +void ChuchuBossCutscene_Init(ChuchuBossCutsceneEntity* this) { super->action = 1; super->timer = 60; InitializeAnimation(super, 0); } -void Object4B_Action1(Object4BEntity* this) { +void ChuchuBossCutscene_Action1(ChuchuBossCutsceneEntity* this) { if (--super->timer == 0) { super->timer = 120; super->action++; @@ -46,7 +46,7 @@ void Object4B_Action1(Object4BEntity* this) { } } -void Object4B_Action2(Object4BEntity* this) { +void ChuchuBossCutscene_Action2(ChuchuBossCutsceneEntity* this) { GetNextFrame(super); if ((super->frame & ANIM_DONE) != 0) { super->action++; @@ -55,7 +55,7 @@ void Object4B_Action2(Object4BEntity* this) { } } -void Object4B_Action3(Object4BEntity* this) { +void ChuchuBossCutscene_Action3(ChuchuBossCutsceneEntity* this) { GetNextFrame(super); if (--super->timer == 0) { super->action++; @@ -69,7 +69,7 @@ void Object4B_Action3(Object4BEntity* this) { } } -void Object4B_Action4(Object4BEntity* this) { +void ChuchuBossCutscene_Action4(ChuchuBossCutsceneEntity* this) { if ((super->frame & 0x10) != 0) { LinearMoveUpdate(super); if (GravityUpdate(super, Q_8_8(32.0)) == 0) { @@ -92,7 +92,7 @@ void Object4B_Action4(Object4BEntity* this) { } } -void Object4B_Action5(Object4BEntity* this) { +void ChuchuBossCutscene_Action5(ChuchuBossCutsceneEntity* this) { GetNextFrame(super); if (--super->timer == 0) { super->action++; @@ -100,7 +100,7 @@ void Object4B_Action5(Object4BEntity* this) { } } -void Object4B_Action6(Object4BEntity* this) { +void ChuchuBossCutscene_Action6(ChuchuBossCutsceneEntity* this) { GetNextFrame(super); if ((super->frame & ANIM_DONE) != 0) { super->action++; @@ -109,7 +109,7 @@ void Object4B_Action6(Object4BEntity* this) { } } -void Object4B_Action7(Object4BEntity* this) { +void ChuchuBossCutscene_Action7(ChuchuBossCutsceneEntity* this) { GetNextFrame(super); if (--super->timer == 0) { gMenu.overlayType++; diff --git a/src/object/object15.c b/src/object/chuchuBossParticle.c index 183ff93b..9b73f0d1 100644 --- a/src/object/object15.c +++ b/src/object/chuchuBossParticle.c @@ -1,25 +1,31 @@ #define NENT_DEPRECATED +/** + * @file chuchuBossParticle.c + * @ingroup Objects + * + * @brief Chuchu Boss Particle object + */ #include "entity.h" -void Object15_Init(Entity*); -void Object15_Action1(Entity*); +void ChuchuBossParticle_Init(Entity*); +void ChuchuBossParticle_Action1(Entity*); -void Object15(Entity* this) { +void ChuchuBossParticle(Entity* this) { static void (*const actionFuncs[])(Entity*) = { - Object15_Init, - Object15_Action1, + ChuchuBossParticle_Init, + ChuchuBossParticle_Action1, }; actionFuncs[this->action](this); } -void Object15_Init(Entity* this) { +void ChuchuBossParticle_Init(Entity* this) { this->action = 1; this->spriteSettings.draw = 1; InitializeAnimation(this, this->animIndex); } -void Object15_Action1(Entity* this) { +void ChuchuBossParticle_Action1(Entity* this) { if (this->type == 0) { GetNextFrame(this); } diff --git a/src/object/object49.c b/src/object/chuchuBossStartParticle.c index 7adbcc00..370b8d4b 100644 --- a/src/object/object49.c +++ b/src/object/chuchuBossStartParticle.c @@ -1,5 +1,11 @@ -#include "object.h" +/** + * @file chuchuBossStartParticle.c + * @ingroup Objects + * + * @brief Chuchu Boss Start Particle object + */ #include "functions.h" +#include "object.h" static void sub_0808F2B0(Entity*); void sub_0808F14C(Entity*); @@ -18,7 +24,7 @@ void sub_0808F244(Entity*); void sub_0808F1F8(Entity*); void sub_0808F5EC(Entity*); -void Object49(Entity* this) { +void ChuchuBossStartParticle(Entity* this) { static void (*const typeFuncs[])(Entity*) = { sub_0808F0B8, sub_0808F1E0, sub_0808F2C0, sub_0808F370, sub_0808F0B8, sub_0808F3DC, sub_0808F3DC, sub_0808F3DC, sub_0808F3DC, sub_0808F498, sub_0808F554, @@ -42,7 +48,7 @@ void sub_0808F0D0(Entity* this) { Entity* ent; u32 uVar3; - ent = CreateObjectWithParent(this, OBJECT_49, 2, 0); + ent = CreateObjectWithParent(this, CHUCHU_BOSS_START_PARTICLE, 2, 0); this->child = ent; if (ent == NULL) { DeleteThisEntity(); diff --git a/src/object/cloud.c b/src/object/cloud.c index 162db099..f0aa0d55 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -1,13 +1,19 @@ +/** + * @file cloud.c + * @ingroup Objects + * + * @brief Cloud object + */ +#include "functions.h" #include "object.h" #include "structures.h" -#include "functions.h" void sub_0809F814(u32 r0); void sub_0809F7BC(Entity*); void sub_0809F7F4(Entity*); -void sub_0809F4DC(Entity*); -void sub_0809F700(Entity*); +void Cloud_Type0(Entity*); +void Cloud_Type1(Entity*); void sub_0809F514(Entity*); void sub_0809F548(Entity*); void sub_0809F5B0(Entity*); @@ -20,14 +26,14 @@ void sub_0809F5DC(Entity*); extern void* gUnk_080DD750; void Cloud(Entity* this) { - static void (*const typeFuncs[])(Entity*) = { - sub_0809F4DC, - sub_0809F700, + static void (*const Cloud_Types[])(Entity*) = { + Cloud_Type0, + Cloud_Type1, }; - typeFuncs[this->type](this); + Cloud_Types[this->type](this); } -void sub_0809F4DC(Entity* this) { +void Cloud_Type0(Entity* this) { static void (*const gUnk_081247A0[])(Entity*) = { sub_0809F514, sub_0809F548, @@ -136,7 +142,7 @@ void sub_0809F6CC(Entity* this) { } } -void sub_0809F700(Entity* this) { +void Cloud_Type1(Entity* this) { static const s8 gUnk_081247C0[] = { -1, 1, 2, -2, 0, 1, 0, -1, }; diff --git a/src/object/objectE.c b/src/object/crackingGround.c index 3f8319b8..bf84577b 100644 --- a/src/object/objectE.c +++ b/src/object/crackingGround.c @@ -1,16 +1,15 @@ /** - * @file objectE.c + * @file crackingGround.c * @ingroup Objects * - * @brief ObjectE object + * @brief Cracking Ground object */ - #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" -void ObjectE(Entity* this) { +void CrackingGround(Entity* this) { if (this->action == 0) { this->action = 1; this->timer = 20; diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index f0cf844d..0bf59d92 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -6,10 +6,10 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "hitbox.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; @@ -181,7 +181,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { RestorePrevTileEntity(0xdc, super->collisionLayer); sub_08096A78(this); } - if ((gPlayerState.field_0x92 & 0xc0) == 0) { + if ((gPlayerState.playerInput.field_0x92 & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) { return; } if (gUnk_0200AF00.unk_2f != 3) { diff --git a/src/object/cuccoMinigame.c b/src/object/cuccoMinigame.c index dbf623dd..1d87a6d0 100644 --- a/src/object/cuccoMinigame.c +++ b/src/object/cuccoMinigame.c @@ -1,11 +1,18 @@ + +/** + * @file cuccoMinigame.c + * @ingroup Objects + * + * @brief Cucco Minigame object + */ #define NENT_DEPRECATED +#include "enemy.h" #include "entity.h" -#include "script.h" -#include "npc.h" #include "fileselect.h" #include "functions.h" +#include "npc.h" #include "object.h" -#include "enemy.h" +#include "script.h" typedef struct { Entity base; @@ -14,9 +21,9 @@ typedef struct { s16 unk6c; u16 unk6e; u8 unk70[0x18]; -} ObjectB9Entity; +} CuccoMinigameEntity; -typedef Entity* ObjectB9Heap[10]; +typedef Entity* CuccoMinigameHeap[10]; u32 sub_080A1514(); @@ -24,7 +31,7 @@ const u16 gUnk_08124C20[] = { 25, 0x2, 25, 0x3, 30, 0x4, 45, 0x5, 50, 0x5, 45, 0x5, 50, 0x6, 60, 0x7, 55, 0x2, 55, 0x3, }; -static const u16 pObjectB9_MinigameCuccoDefs[][30] = { +static const u16 pCuccoMinigame_MinigameCuccoDefs[][30] = { { 0x0001, 0x02E9, 0x0318, 0x0001, 0x0280, 0x0380, 0x0002, 0x0277, 0x0314, 0x0001, 0x0332, 0x0248, 0x0001, 0x0257, 0x028C, 0x0001, 0x0199, 0x031B, 0x0001, 0x0321, 0x01B4, 0x0002, 0x02DF, 0x01D8, 0x0001, 0x03AD, 0x02DE, 0x0001, 0x0216, 0x01CC }, @@ -67,7 +74,7 @@ static const u16 CuccoMinigame_Sounds[] = { SFX_VO_CUCCO5, SFX_VO_CUCCO_CALL }; static const u8 CuccoMinigameRupees[] = { 0, 10, 50, 0 }; -void ObjectB9(ObjectB9Entity* this) { +void CuccoMinigame(CuccoMinigameEntity* this) { int index; u32 val; u8* puVar2; @@ -90,7 +97,7 @@ void ObjectB9(ObjectB9Entity* this) { sub_0807DD94(super, 0); } -NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(ObjectB9Entity* this)) { +NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(CuccoMinigameEntity* this)) { s32 iVar1; int iVar2; s32 iVar4; @@ -151,7 +158,7 @@ NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(ObjectB } END_NONMATCH -void CuccoMinigame_Cleanup(ObjectB9Entity* this) { +void CuccoMinigame_Cleanup(CuccoMinigameEntity* this) { Entity** puVar1; s8* pcVar2; int index; @@ -167,7 +174,7 @@ void CuccoMinigame_Cleanup(ObjectB9Entity* this) { } } -void sub_080A13B4(ObjectB9Entity* this, ScriptExecutionContext* context) { +void sub_080A13B4(CuccoMinigameEntity* this, ScriptExecutionContext* context) { if (this->unk6a >= this->unk6c) { MessageFromTarget(TEXT_INDEX(TEXT_ANJU, 0xc)); context->condition = 1; @@ -177,7 +184,7 @@ void sub_080A13B4(ObjectB9Entity* this, ScriptExecutionContext* context) { } } -void sub_080A13E8(ObjectB9Entity* this) { +void sub_080A13E8(CuccoMinigameEntity* this) { bool32 bVar2; const u8* ptr = &gUnk_08124EA0[sub_080A1514() * 4]; @@ -209,7 +216,7 @@ void sub_080A13E8(ObjectB9Entity* this) { } } -void sub_080A1460(ObjectB9Entity* this) { +void sub_080A1460(CuccoMinigameEntity* this) { s8* pcVar1; int iVar2; s32 rupees; @@ -298,13 +305,13 @@ void CuccoMinigame_Init(Entity* this, ScriptExecutionContext* context) { context->condition = 0; pEnt = CreateObject(CUCCO_MINIGAME, 0, 0); if (pEnt != NULL) { - pEnt->myHeap = (u32*)zMalloc(sizeof(ObjectB9Heap)); + pEnt->myHeap = (u32*)zMalloc(sizeof(CuccoMinigameHeap)); if (pEnt->myHeap == NULL) { DeleteEntityAny(pEnt); } else { *(ScriptExecutionContext**)&((GenericEntity*)pEnt)->cutsceneBeh = (ScriptExecutionContext*)StartCutscene(pEnt, (u16*)context->intVariable); - pCuccoMinigameDef = pObjectB9_MinigameCuccoDefs[sub_080A1514()]; + pCuccoMinigameDef = pCuccoMinigame_MinigameCuccoDefs[sub_080A1514()]; ppEVar5 = (Entity**)pEnt->myHeap; room = &gRoomControls; for (index = 9; index >= 0; index--, pCuccoMinigameDef += 3) { diff --git a/src/object/object6A.c b/src/object/cutsceneMiscObject.c index 8fa98e51..a38773fb 100644 --- a/src/object/object6A.c +++ b/src/object/cutsceneMiscObject.c @@ -1,11 +1,17 @@ +/** + * @file cutsceneMiscObject.c + * @ingroup Objects + * + * @brief Cutscene Misc object + */ #define NENT_DEPRECATED -#include "object.h" #include "area.h" -#include "script.h" -#include "message.h" #include "functions.h" -#include "screen.h" #include "item.h" +#include "message.h" +#include "object.h" +#include "screen.h" +#include "script.h" extern u8 gUnk_08114F30[]; extern u8 gUnk_08114F34[]; @@ -17,8 +23,8 @@ extern s16 gUnk_08122B0E[]; extern u16 gUnk_08122B1E[]; extern s8 gUnk_08122B2E[]; -extern u16 script_Object6ATheLittleHat; -extern u16 script_Object6ASwordInChest; +extern u16 script_CutsceneMiscObjectTheLittleHat; +extern u16 script_CutsceneMiscObjectSwordInChest; extern u16 script_08015B14; extern u16 script_ZeldaMagic; extern u16 script_08012C48; @@ -29,7 +35,7 @@ typedef struct { u8 off; u8 fill[0x14]; void* ctx; -} Object6AEntity; +} CutsceneMiscObjectEntity; typedef struct { u16 arr[8]; @@ -42,7 +48,7 @@ typedef struct { typedef struct { Entity base; Type15Vars vars; -} Object6AEntityType15; +} CutsceneMiscObjectEntityType15; typedef struct { Entity base; @@ -57,61 +63,61 @@ typedef struct { } HitboxCfg; extern HitboxCfg gUnk_08122B3C[]; -typedef void(Object6ATypeAction)(Object6AEntity*); - -Object6ATypeAction sub_08094A5C; -Object6ATypeAction sub_08094A90; -Object6ATypeAction sub_08094C30; -Object6ATypeAction sub_08094C88; -Object6ATypeAction sub_08094D94; -Object6ATypeAction sub_08094E30; -Object6ATypeAction sub_08094FA8; -Object6ATypeAction sub_08095088; -Object6ATypeAction sub_08095120; -Object6ATypeAction sub_08095188; -Object6ATypeAction sub_080951C4; -Object6ATypeAction sub_08095288; -Object6ATypeAction sub_080953A4; -Object6ATypeAction sub_080953A4; -Object6ATypeAction sub_080954DC; -Object6ATypeAction sub_080956B4; -Object6ATypeAction sub_0809577C; -Object6ATypeAction sub_080957DC; -Object6ATypeAction sub_0809584C; -Object6ATypeAction sub_080958D8; -Object6ATypeAction sub_08095918; -Object6ATypeAction sub_08094C88; -Object6ATypeAction sub_080959CC; -Object6ATypeAction sub_08095A8C; -Object6ATypeAction sub_08095B48; -Object6ATypeAction sub_08095C00; -Object6ATypeAction sub_080953A4; -Object6ATypeAction sub_08095C68; -Object6ATypeAction sub_08095CE0; -Object6ATypeAction sub_08095CE0; -Object6ATypeAction sub_08095DBC; -Object6ATypeAction sub_08095F38; -Object6ATypeAction sub_08096058; -Object6ATypeAction sub_08096058; -Object6ATypeAction sub_08094A90; -Object6ATypeAction sub_08096084; -Object6ATypeAction sub_08096084; -Object6ATypeAction sub_08096168; -Object6ATypeAction sub_080961F4; -Object6ATypeAction sub_080961F4; -Object6ATypeAction sub_080961F4; -Object6ATypeAction sub_08096284; -Object6ATypeAction sub_08096290; - -void sub_08095754(Object6AEntity*); -void sub_080957B4(Object6AEntity*); -void sub_08095954(Object6AEntity*); -void sub_08095D30(Object6AEntity*, u32); - -static void sub_0809629C(Object6AEntity*, u32); - -void Object6A(Entity* this) { - static Object6ATypeAction* const sTypeTable[] = { +typedef void(CutsceneMiscObjectTypeAction)(CutsceneMiscObjectEntity*); + +CutsceneMiscObjectTypeAction sub_08094A5C; +CutsceneMiscObjectTypeAction sub_08094A90; +CutsceneMiscObjectTypeAction sub_08094C30; +CutsceneMiscObjectTypeAction sub_08094C88; +CutsceneMiscObjectTypeAction sub_08094D94; +CutsceneMiscObjectTypeAction sub_08094E30; +CutsceneMiscObjectTypeAction sub_08094FA8; +CutsceneMiscObjectTypeAction sub_08095088; +CutsceneMiscObjectTypeAction sub_08095120; +CutsceneMiscObjectTypeAction sub_08095188; +CutsceneMiscObjectTypeAction sub_080951C4; +CutsceneMiscObjectTypeAction sub_08095288; +CutsceneMiscObjectTypeAction sub_080953A4; +CutsceneMiscObjectTypeAction sub_080953A4; +CutsceneMiscObjectTypeAction sub_080954DC; +CutsceneMiscObjectTypeAction sub_080956B4; +CutsceneMiscObjectTypeAction sub_0809577C; +CutsceneMiscObjectTypeAction sub_080957DC; +CutsceneMiscObjectTypeAction sub_0809584C; +CutsceneMiscObjectTypeAction sub_080958D8; +CutsceneMiscObjectTypeAction sub_08095918; +CutsceneMiscObjectTypeAction sub_08094C88; +CutsceneMiscObjectTypeAction sub_080959CC; +CutsceneMiscObjectTypeAction sub_08095A8C; +CutsceneMiscObjectTypeAction sub_08095B48; +CutsceneMiscObjectTypeAction sub_08095C00; +CutsceneMiscObjectTypeAction sub_080953A4; +CutsceneMiscObjectTypeAction sub_08095C68; +CutsceneMiscObjectTypeAction sub_08095CE0; +CutsceneMiscObjectTypeAction sub_08095CE0; +CutsceneMiscObjectTypeAction sub_08095DBC; +CutsceneMiscObjectTypeAction sub_08095F38; +CutsceneMiscObjectTypeAction sub_08096058; +CutsceneMiscObjectTypeAction sub_08096058; +CutsceneMiscObjectTypeAction sub_08094A90; +CutsceneMiscObjectTypeAction sub_08096084; +CutsceneMiscObjectTypeAction sub_08096084; +CutsceneMiscObjectTypeAction sub_08096168; +CutsceneMiscObjectTypeAction sub_080961F4; +CutsceneMiscObjectTypeAction sub_080961F4; +CutsceneMiscObjectTypeAction sub_080961F4; +CutsceneMiscObjectTypeAction sub_08096284; +CutsceneMiscObjectTypeAction sub_08096290; + +void sub_08095754(CutsceneMiscObjectEntity*); +void sub_080957B4(CutsceneMiscObjectEntity*); +void sub_08095954(CutsceneMiscObjectEntity*); +void sub_08095D30(CutsceneMiscObjectEntity*, u32); + +static void sub_0809629C(CutsceneMiscObjectEntity*, u32); + +void CutsceneMiscObject(Entity* this) { + static CutsceneMiscObjectTypeAction* const sTypeTable[] = { sub_08094A5C, sub_08094A90, sub_08094C30, sub_08094C88, sub_08094D94, sub_08094E30, sub_08094FA8, sub_08095088, sub_08095120, sub_08095188, sub_080951C4, sub_08095288, sub_080953A4, sub_080953A4, sub_080954DC, sub_080956B4, sub_0809577C, sub_080957DC, sub_0809584C, sub_080958D8, sub_08095918, sub_08094C88, sub_080959CC, sub_08095A8C, @@ -119,10 +125,10 @@ void Object6A(Entity* this) { sub_08096058, sub_08096058, sub_08094A90, sub_08096084, sub_08096084, sub_08096168, sub_080961F4, sub_080961F4, sub_080961F4, sub_08096284, sub_08096290, }; - sTypeTable[this->type]((Object6AEntity*)this); + sTypeTable[this->type]((CutsceneMiscObjectEntity*)this); } -void sub_08094A5C(Object6AEntity* this) { +void sub_08094A5C(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_0807DD64(super); @@ -133,7 +139,7 @@ void sub_08094A5C(Object6AEntity* this) { GetNextFrame(super); } -void sub_08094A90(Object6AEntity* this) { +void sub_08094A90(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->collisionLayer = 2; @@ -148,20 +154,20 @@ void sub_08094A90(Object6AEntity* this) { } void sub_08094AE8(Entity* this, ScriptExecutionContext* ctx) { - Object6AEntity* e = (Object6AEntity*)CreateObject(OBJECT_6A, 1, 0); + CutsceneMiscObjectEntity* e = (CutsceneMiscObjectEntity*)CreateObject(CUTSCENE_MISC_OBJECT, 1, 0); if (e != NULL) { e->ctx = StartCutscene(&e->base, (void*)ctx->intVariable); } } -void sub_08094B0C(Object6AEntity* this) { +void sub_08094B0C(CutsceneMiscObjectEntity* this) { if (--super->z.HALF.HI <= -32) super->z.HALF.HI = -32; else gActiveScriptInfo.commandSize = 0; } -void sub_08094B3C(Object6AEntity* this) { +void sub_08094B3C(CutsceneMiscObjectEntity* this) { super->z.WORD += Q_16_16(0.5); if (super->z.HALF.HI >= -13) super->z.HALF.HI = -13; @@ -169,20 +175,20 @@ void sub_08094B3C(Object6AEntity* this) { gActiveScriptInfo.commandSize = 0; } -void sub_08094B6C(Object6AEntity* this) { +void sub_08094B6C(CutsceneMiscObjectEntity* this) { super->spritePriority.b1 = 0x3; } -void sub_08094B80(Object6AEntity* this) { +void sub_08094B80(CutsceneMiscObjectEntity* this) { super->spritePriority.b1 = 0x2; } -void sub_08094B94(Object6AEntity* this) { - Entity* e = CreateObject(OBJECT_6A, 0x22, 0); +void sub_08094B94(CutsceneMiscObjectEntity* this) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x22, 0); if (e != NULL) { CopyPosition(&gPlayerEntity, e); e->z.HALF.HI = -48; - ((Object6AEntity*)e)->ctx = StartCutscene(e, &script_Object6ATheLittleHat); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, &script_CutsceneMiscObjectTheLittleHat); CreateDust(e); e->z.HALF.HI += 16; e->y.HALF.HI++; @@ -190,7 +196,7 @@ void sub_08094B94(Object6AEntity* this) { } void sub_08094BE0(Entity* this) { - Entity* e = FindEntity(OBJECT, OBJECT_6A, 6, 0x22, 0); + Entity* e = FindEntity(OBJECT, CUTSCENE_MISC_OBJECT, 6, 0x22, 0); if (e != NULL) { CopyPosition(&gPlayerEntity, e); e->z.HALF.HI = -12; @@ -201,7 +207,7 @@ void sub_08094BE0(Entity* this) { } } -void sub_08094C30(Object6AEntity* this) { +void sub_08094C30(CutsceneMiscObjectEntity* this) { Entity* p = super->parent; if (p == NULL || p->next == NULL) DeleteThisEntity(); @@ -215,7 +221,7 @@ void sub_08094C30(Object6AEntity* this) { UpdateAnimationSingleFrame(super); } -void sub_08094C88(Object6AEntity* this) { +void sub_08094C88(CutsceneMiscObjectEntity* this) { u32 tmp; if (super->action != 0) { @@ -242,7 +248,7 @@ void sub_08094C88(Object6AEntity* this) { super->type = tmp; } -void sub_08094CDC(Object6AEntity* this) { +void sub_08094CDC(CutsceneMiscObjectEntity* this) { Entity* e = CreateObject(0x6a, 3, 0x62); if (e != NULL) { e->x.HALF.HI = gRoomControls.origin_x + Q_8_8(7.0 / 8.0); @@ -251,15 +257,15 @@ void sub_08094CDC(Object6AEntity* this) { } } -void sub_08094D10(Object6AEntity* this) { - Entity* e = FindEntity(OBJECT, OBJECT_6A, 6, 3, 98); +void sub_08094D10(CutsceneMiscObjectEntity* this) { + Entity* e = FindEntity(OBJECT, CUTSCENE_MISC_OBJECT, 6, 3, 98); if (e != NULL) { e->action = 0xFF; } } -void sub_08094D34(Object6AEntity* this) { - Entity* e = CreateObject(OBJECT_6A, 0x15, 0xd); +void sub_08094D34(CutsceneMiscObjectEntity* this) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x15, 0xd); if (e != NULL) { e->x.HALF.HI = gRoomControls.origin_x + Q_8_8(1.0); e->y.HALF.HI = gRoomControls.origin_y + Q_8_8(2.345); @@ -267,14 +273,14 @@ void sub_08094D34(Object6AEntity* this) { } } -void sub_08094D70(Object6AEntity* this) { - Entity* e = FindEntity(OBJECT, OBJECT_6A, 6, 0x15, 0xd); +void sub_08094D70(CutsceneMiscObjectEntity* this) { + Entity* e = FindEntity(OBJECT, CUTSCENE_MISC_OBJECT, 6, 0x15, 0xd); if (e != NULL) { e->action = 0xFF; } } -void sub_08094D94(Object6AEntity* this) { +void sub_08094D94(CutsceneMiscObjectEntity* this) { u32 tmp; if (super->action != 0) { @@ -291,7 +297,7 @@ void sub_08094D94(Object6AEntity* this) { UpdateAnimationSingleFrame(super); } -void sub_08094DD8(Object6AEntity* this) { +void sub_08094DD8(CutsceneMiscObjectEntity* this) { Entity* e = CreateObject(0x6a, 0x4, 0); if (e != NULL) { e->x.HALF.HI = gRoomControls.origin_x + Q_8_8(15.0 / 16.0); @@ -300,14 +306,14 @@ void sub_08094DD8(Object6AEntity* this) { } } -void sub_08094E0C(Object6AEntity* this) { - Entity* e = FindEntity(OBJECT, OBJECT_6A, 6, 4, 0); +void sub_08094E0C(CutsceneMiscObjectEntity* this) { + Entity* e = FindEntity(OBJECT, CUTSCENE_MISC_OBJECT, 6, 4, 0); if (e != NULL) { e->action = 0xFF; } } -void sub_08094E30(Object6AEntity* this) { +void sub_08094E30(CutsceneMiscObjectEntity* this) { if (super->type2 == 0) { if ((gRoomTransition.frameCount % 32) == 0) { Entity* e = CreateObject(0x6A, 5, 1); @@ -377,11 +383,11 @@ void sub_08094E30(Object6AEntity* this) { } } -void sub_08094F98(Object6AEntity* this) { - CreateObject(OBJECT_6A, 5, 0); +void sub_08094F98(CutsceneMiscObjectEntity* this) { + CreateObject(CUTSCENE_MISC_OBJECT, 5, 0); } -void sub_08094FA8(Object6AEntity* this) { +void sub_08094FA8(CutsceneMiscObjectEntity* this) { switch (super->action) { case 0: super->action = 1; @@ -432,7 +438,7 @@ void sub_08094FA8(Object6AEntity* this) { } } -void sub_08095088(Object6AEntity* this) { +void sub_08095088(CutsceneMiscObjectEntity* this) { u32 tmp; switch (super->action) { @@ -464,7 +470,7 @@ void sub_08095088(Object6AEntity* this) { super->type = tmp; } -void sub_08095120(Object6AEntity* this) { +void sub_08095120(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action = 1; SetDefaultPriority(super, PRIO_NO_BLOCK); @@ -477,14 +483,14 @@ void sub_08095120(Object6AEntity* this) { UpdateAnimationSingleFrame(super); } -void sub_08095164(Object6AEntity* this) { - Entity* e = FindEntity(OBJECT, OBJECT_6A, 6, 8, 0); +void sub_08095164(CutsceneMiscObjectEntity* this) { + Entity* e = FindEntity(OBJECT, CUTSCENE_MISC_OBJECT, 6, 8, 0); if (e != NULL) { InitAnimationForceUpdate(e, 3); } } -void sub_08095188(Object6AEntity* this) { +void sub_08095188(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action = 1; SetDefaultPriority(super, PRIO_NO_BLOCK); @@ -496,7 +502,7 @@ void sub_08095188(Object6AEntity* this) { HandleEntity0x82Actions(super); } -void sub_080951C4(Object6AEntity* this) { +void sub_080951C4(CutsceneMiscObjectEntity* this) { Entity* p; if (super->action == 0) { @@ -525,18 +531,18 @@ void sub_080951C4(Object6AEntity* this) { } } -void sub_08095244(Object6AEntity* this) { +void sub_08095244(CutsceneMiscObjectEntity* this) { if (super->type == 0) { - Entity* e = CreateObject(OBJECT_6A, 0xA, 0); + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0xA, 0); if (e != NULL) { e->parent = super; PositionRelative(super, e, Q_16_16(16.0), -Q_16_16(16.0)); - ((Object6AEntity*)e)->ctx = StartCutscene(e, &script_Object6ASwordInChest); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, &script_CutsceneMiscObjectSwordInChest); } } } -void sub_08095288(Object6AEntity* this) { +void sub_08095288(CutsceneMiscObjectEntity* this) { Entity* p; if (super->action == 0) { @@ -570,8 +576,8 @@ void sub_08095288(Object6AEntity* this) { } } -void sub_08095330(Object6AEntity* this) { - Entity* e = CreateObject(OBJECT_6A, 0xB, 0); +void sub_08095330(CutsceneMiscObjectEntity* this) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0xB, 0); if (e != NULL) { super->child = e; e->child = super; @@ -582,7 +588,7 @@ void sub_08095330(Object6AEntity* this) { } } -void sub_08095364(Object6AEntity* this) { +void sub_08095364(CutsceneMiscObjectEntity* this) { Entity* e = super->child; if (e != NULL) { e->frameIndex = 2; @@ -598,7 +604,7 @@ void sub_08095364(Object6AEntity* this) { } } -void sub_080953A4(Object6AEntity* this) { +void sub_080953A4(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->z.HALF.HI = -16; @@ -617,24 +623,24 @@ void sub_080953A4(Object6AEntity* this) { } } -void sub_08095420(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(OBJECT_6A, 0xC, 0); +void sub_08095420(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0xC, 0); if (e != NULL) { PositionRelative(super, e, 0, Q_16_16(-16)); - ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); } } -void nullsub_527(Object6AEntity* this) { +void nullsub_527(CutsceneMiscObjectEntity* this) { } -void sub_0809545C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* p = CreateObject(OBJECT_6A, 0xD, 0); +void sub_0809545C(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { + Entity* p = CreateObject(CUTSCENE_MISC_OBJECT, 0xD, 0); Entity* e; if (p != NULL) { PositionRelative(super, p, 0, Q_16_16(-16)); - ((Object6AEntity*)p)->ctx = StartCutscene(p, (u16*)ctx->intVariable); - e = CreateObject(OBJECT_6A, 2, 0); + ((CutsceneMiscObjectEntity*)p)->ctx = StartCutscene(p, (u16*)ctx->intVariable); + e = CreateObject(CUTSCENE_MISC_OBJECT, 2, 0); if (e != NULL) { CopyPosition(p, e); e->parent = p; @@ -642,15 +648,15 @@ void sub_0809545C(Object6AEntity* this, ScriptExecutionContext* ctx) { } } -void sub_080954AC(Object6AEntity* this, u32 arg2) { - Entity* e = CreateObject(OBJECT_6A, 0x1A, 0); +void sub_080954AC(CutsceneMiscObjectEntity* this, u32 arg2) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x1A, 0); if (e != NULL) { CopyPosition(super, e); - ((Object6AEntity*)e)->ctx = StartCutscene(e, &script_08015B14); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, &script_08015B14); } } -void sub_080954DC(Object6AEntity* this) { +void sub_080954DC(CutsceneMiscObjectEntity* this) { switch (super->action) { case 0: if (super->timer != 0) { @@ -702,14 +708,14 @@ void sub_080954DC(Object6AEntity* this) { GetNextFrame(super); } -void sub_0809567C(Object6AEntity* this) { +void sub_0809567C(CutsceneMiscObjectEntity* this) { super->action = 3; super->subAction = 1; super->speed = 0x400; super->direction = sub_080045DA(super->x.WORD - ((s16)this->px << 16), super->y.WORD - ((s16)this->py << 16)); } -void sub_080956B4(Object6AEntity* this) { +void sub_080956B4(CutsceneMiscObjectEntity* this) { Entity* p; u16* p1; u16* p2; @@ -745,7 +751,7 @@ void sub_080956B4(Object6AEntity* this) { } else { DeleteThisEntity(); } - tmp = &((Object6AEntityType15*)this)->vars; + tmp = &((CutsceneMiscObjectEntityType15*)this)->vars; MemCopy(&tmp->arr[2], &tmp->arr[0], 0x1C); super->x.HALF.HI = tmp->my_x; super->y.HALF.HI = tmp->my_y; @@ -754,8 +760,8 @@ void sub_080956B4(Object6AEntity* this) { tmp->parent_y = p->y.HALF.HI; } -void sub_08095754(Object6AEntity* this) { - Entity* e = CreateObject(OBJECT_6A, 0xF, super->type2); +void sub_08095754(CutsceneMiscObjectEntity* this) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0xF, super->type2); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -763,7 +769,7 @@ void sub_08095754(Object6AEntity* this) { } } -void sub_0809577C(Object6AEntity* this) { +void sub_0809577C(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->z.HALF.HI = -16; @@ -774,8 +780,8 @@ void sub_0809577C(Object6AEntity* this) { DeleteThisEntity(); } -void sub_080957B4(Object6AEntity* this) { - Entity* e = CreateObject(OBJECT_6A, 0x10, 0); +void sub_080957B4(CutsceneMiscObjectEntity* this) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x10, 0); if (e != NULL) { e->parent = super; CopyPosition(super, e); @@ -783,7 +789,7 @@ void sub_080957B4(Object6AEntity* this) { } } -void sub_080957DC(Object6AEntity* this) { +void sub_080957DC(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_0807DD64(super); @@ -794,17 +800,17 @@ void sub_080957DC(Object6AEntity* this) { UpdateAnimationSingleFrame(super); } -void sub_08095810(Object6AEntity* this) { - Entity* e = CreateObject(OBJECT_6A, 0x11, 0); +void sub_08095810(CutsceneMiscObjectEntity* this) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x11, 0); if (e != NULL) { e->parent = super; CopyPosition(super, e); SortEntityAbove(super, e); - ((Object6AEntity*)e)->ctx = StartCutscene(e, &script_ZeldaMagic); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, &script_ZeldaMagic); } } -void sub_0809584C(Object6AEntity* this) { +void sub_0809584C(CutsceneMiscObjectEntity* this) { u32 tmp, idx; idx = super->health; @@ -827,7 +833,7 @@ void sub_0809584C(Object6AEntity* this) { super->type = tmp; } -void sub_080958D8(Object6AEntity* this) { +void sub_080958D8(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_0807DD64(super); @@ -839,7 +845,7 @@ void sub_080958D8(Object6AEntity* this) { sub_08095954(this); } -void sub_08095918(Object6AEntity* this) { +void sub_08095918(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; SetDefaultPriority(super, PRIO_PLAYER_EVENT); @@ -851,12 +857,12 @@ void sub_08095918(Object6AEntity* this) { GetNextFrame(super); } -void sub_08095954(Object6AEntity* this) { +void sub_08095954(CutsceneMiscObjectEntity* this) { typedef struct { s8 x, y; } s8XY; - Entity* e = CreateObject(OBJECT_6A, 0x14, 0); + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x14, 0); if (e != NULL) { u32 tmp, x, y; e->parent = super; @@ -865,7 +871,7 @@ void sub_08095954(Object6AEntity* this) { y = ((s8XY*)(&gUnk_08122AF8[tmp]))->y << 16; PositionRelative(super, e, x, y); e->z.HALF.HI = -3; - ((Object6AEntity*)e)->ctx = StartCutscene(e, &script_08012C48); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, &script_08012C48); EnqueueSFX(SFX_124); super->frame &= ~1; } else { @@ -873,7 +879,7 @@ void sub_08095954(Object6AEntity* this) { } } -void sub_080959CC(Object6AEntity* this) { +void sub_080959CC(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->spriteSettings.draw = 0; @@ -886,25 +892,25 @@ void sub_080959CC(Object6AEntity* this) { sub_08095D30(this, super->frame & ~0x80); } -void sub_08095A1C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(OBJECT_6A, 0x16, 0); +void sub_08095A1C(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x16, 0); if (e != NULL) { 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); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); } } -void sub_08095A68(Object6AEntity* this) { - Entity* e = FindEntity(6, OBJECT_6A, 6, 0x16, 0); +void sub_08095A68(CutsceneMiscObjectEntity* this) { + Entity* e = FindEntity(6, CUTSCENE_MISC_OBJECT, 6, 0x16, 0); if (e != NULL) { e->action = 0xFF; } } -void sub_08095A8C(Object6AEntity* this) { +void sub_08095A8C(CutsceneMiscObjectEntity* this) { switch (super->action) { case 0: super->action++; @@ -937,7 +943,7 @@ void sub_08095A8C(Object6AEntity* this) { } } -void sub_08095B48(Object6AEntity* this) { +void sub_08095B48(CutsceneMiscObjectEntity* this) { Entity* p; u32 tmp; @@ -969,15 +975,15 @@ void sub_08095B48(Object6AEntity* this) { super->type = tmp; } -void sub_08095BE0(Object6AEntity* this, u32 val) { - Entity* e = CreateObject(OBJECT_6A, 0x18, val); +void sub_08095BE0(CutsceneMiscObjectEntity* this, u32 val) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x18, val); if (e != NULL) { e->parent = super; CopyPosition(super, e); } } -void sub_08095C00(Object6AEntity* this) { +void sub_08095C00(CutsceneMiscObjectEntity* this) { if (super->action & 0x80) { DeleteThisEntity(); } else { @@ -993,7 +999,7 @@ void sub_08095C00(Object6AEntity* this) { } void sub_08095C48(Entity* this) { - Entity* e = CreateObject(OBJECT_6A, 0x19, 0); + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x19, 0); if (e != NULL) { this->child = e; e->parent = this; @@ -1001,7 +1007,7 @@ void sub_08095C48(Entity* this) { } } -void sub_08095C68(Object6AEntity* this) { +void sub_08095C68(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_080042D0(super, super->frameIndex, (u16)super->spriteIndex); @@ -1017,8 +1023,8 @@ void sub_08095C68(Object6AEntity* this) { DeleteThisEntity(); } -void sub_08095CB0(Object6AEntity* this) { - Entity* e = CreateObject(OBJECT_6A, 0x1B, 0); +void sub_08095CB0(CutsceneMiscObjectEntity* this) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x1B, 0); if (e != NULL) { super->child = e; e->parent = super; @@ -1029,7 +1035,7 @@ void sub_08095CB0(Object6AEntity* this) { } } -void sub_08095CE0(Object6AEntity* this) { +void sub_08095CE0(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->spriteSettings.draw = 0; @@ -1042,29 +1048,29 @@ void sub_08095CE0(Object6AEntity* this) { sub_08095D30(this, super->frame & ~0x80); } -void sub_08095D30(Object6AEntity* this, u32 a2) { +void sub_08095D30(CutsceneMiscObjectEntity* this, u32 a2) { if (a2 != 0) ChangeObjPalette(super, gUnk_08122B00[a2] & ~0x80); } -void sub_08095D54(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(OBJECT_6A, 0x1C, 0); +void sub_08095D54(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x1C, 0); if (e != NULL) { CopyPosition(&gPlayerEntity, e); e->collisionLayer = 2; - ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); } } -void sub_08095D8C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(OBJECT_6A, 0x1D, 0); +void sub_08095D8C(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x1D, 0); if (e != NULL) { CopyPosition(super, e); - ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); } } -void sub_08095DBC(Object6AEntity* this) { +void sub_08095DBC(CutsceneMiscObjectEntity* this) { if (gActiveScriptInfo.syncFlags & 0x10) DeleteThisEntity(); if (super->type2 == 0) { @@ -1093,17 +1099,17 @@ void sub_08095DBC(Object6AEntity* this) { } } -void sub_08095E7C(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(OBJECT_6A, 0x1E, 0); +void sub_08095E7C(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x1E, 0); if (e != NULL) { CopyPosition(super, e); - ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); } } -NONMATCH("asm/non_matching/object6A/sub_08095EAC.inc", - void sub_08095EAC(Object6AEntity* this, ScriptExecutionContext* ctx)) { - Entity* e = CreateObject(OBJECT_6A, 0x1E, 1); +NONMATCH("asm/non_matching/cutsceneMiscObject/sub_08095EAC.inc", + void sub_08095EAC(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx)) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x1E, 1); s32 x, y; if (e != NULL) { @@ -1131,7 +1137,7 @@ NONMATCH("asm/non_matching/object6A/sub_08095EAC.inc", END_NONMATCH #define local ((Type1F*)this) -void sub_08095F38(Object6AEntity* this) { +void sub_08095F38(CutsceneMiscObjectEntity* this) { u32 tmp; if (super->action == 0) { @@ -1176,16 +1182,16 @@ void sub_08095F38(Object6AEntity* this) { } } -void sub_08096028(Object6AEntity* this) { +void sub_08096028(CutsceneMiscObjectEntity* this) { u32 type2 = 6; if (!CheckLocalFlagByBank(FLAG_BANK_3, 123)) type2 = 4; if (!CheckLocalFlagByBank(FLAG_BANK_3, 122)) type2 = 3; - CreateObject(OBJECT_6A, 0x1F, type2); + CreateObject(CUTSCENE_MISC_OBJECT, 0x1F, type2); } -void sub_08096058(Object6AEntity* this) { +void sub_08096058(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_0807DD64(super); @@ -1195,7 +1201,7 @@ void sub_08096058(Object6AEntity* this) { GetNextFrame(super); } -void sub_08096084(Object6AEntity* this) { +void sub_08096084(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; sub_0807DD64(super); @@ -1209,27 +1215,27 @@ void sub_08096084(Object6AEntity* this) { } } -void sub_080960C4(Object6AEntity* this, ScriptExecutionContext* ctx) { - Entity* e = CreateObject(OBJECT_6A, 0x23, 0x49); +void sub_080960C4(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x23, 0x49); if (e != NULL) { e->parent = super; CopyPosition(super, e); e->spriteRendering.b3 = gUnk_08114F34[super->spriteRendering.b3]; SortEntityBelow(super, e); - ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); } - e = CreateObject(OBJECT_6A, 0x24, 0x4A); + e = CreateObject(CUTSCENE_MISC_OBJECT, 0x24, 0x4A); if (e != NULL) { e->parent = super; CopyPosition(super, e); e->spriteRendering.b3 = gUnk_08114F30[super->spriteRendering.b3]; SortEntityAbove(super, e); e->collisionLayer = 2; - ((Object6AEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); + ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); } } -void sub_08096168(Object6AEntity* this) { +void sub_08096168(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->spriteSettings.draw = 1; @@ -1241,10 +1247,10 @@ void sub_08096168(Object6AEntity* this) { DeleteThisEntity(); } -void sub_080961B0(Object6AEntity* this) { +void sub_080961B0(CutsceneMiscObjectEntity* this) { int i; for (i = 0; i < 8; ++i) { - Entity* e = CreateObject(OBJECT_6A, 0x25, 0); + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x25, 0); if (e != NULL) { CopyPosition(super, e); e->direction = 32 * i; @@ -1253,42 +1259,42 @@ void sub_080961B0(Object6AEntity* this) { } } -void sub_080961F4(Object6AEntity* this) { +void sub_080961F4(CutsceneMiscObjectEntity* this) { super->spriteSettings.draw = 1; super->frameIndex = 0; } -void sub_08096208(Object6AEntity* this, u32 x) { +void sub_08096208(CutsceneMiscObjectEntity* this, u32 x) { s8* p = &gUnk_08122B2E[x * 2]; - Entity* e = CreateObject(OBJECT_6A, 0x26, 0); + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x26, 0); if (e != NULL) { PositionRelative(super, e, Q_16_16(p[0]), Q_16_16(p[1])); } } -void sub_0809623C(Object6AEntity* this) { - Entity* e = CreateObject(OBJECT_6A, 0x27, 0); +void sub_0809623C(CutsceneMiscObjectEntity* this) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x27, 0); if (e != NULL) { PositionRelative(super, e, 0, Q_16_16(-16.0)); } } -void sub_08096260(Object6AEntity* this) { - Entity* e = CreateObject(OBJECT_6A, 0x28, 0); +void sub_08096260(CutsceneMiscObjectEntity* this) { + Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x28, 0); if (e != NULL) { PositionRelative(super, e, 0, Q_16_16(-16.0)); } } -void sub_08096284(Object6AEntity* this) { +void sub_08096284(CutsceneMiscObjectEntity* this) { sub_0809629C(this, 0xd); } -void sub_08096290(Object6AEntity* this) { +void sub_08096290(CutsceneMiscObjectEntity* this) { sub_0809629C(this, 0xe); } -void sub_0809629C(Object6AEntity* this, u32 type) { +void sub_0809629C(CutsceneMiscObjectEntity* this, u32 type) { u32 tmp; if (super->action == 0) { @@ -1304,15 +1310,15 @@ void sub_0809629C(Object6AEntity* this, u32 type) { super->type = tmp; } -void sub_080962D8(Object6AEntity* this) { +void sub_080962D8(CutsceneMiscObjectEntity* this) { SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 0x100); } -void sub_080962E8(Object6AEntity* this) { +void sub_080962E8(CutsceneMiscObjectEntity* this) { SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 0x100); } -void sub_080962F8(Object6AEntity* this, ScriptExecutionContext* ctx) { +void sub_080962F8(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { HitboxCfg* cfg = &gUnk_08122B3C[ctx->intVariable]; sub_08078850(super, 1, cfg->_c, cfg->_8); super->hitbox = &cfg->hit; diff --git a/src/object/object69.c b/src/object/cutsceneOrchestrator.c index b02c964c..cdd0a4eb 100644 --- a/src/object/object69.c +++ b/src/object/cutsceneOrchestrator.c @@ -1,14 +1,14 @@ /** - * @file object69.c + * @file cutsceneOrchestrator.c * @ingroup Objects * - * @brief Object69 object + * @brief CutsceneO rchestrator object */ #include "entity.h" -#include "hitbox.h" #include "functions.h" +#include "hitbox.h" -void Object69(Entity* this) { +void CutsceneOrchestrator(Entity* this) { if ((this->flags & ENT_SCRIPTED) != 0) { if (this->action == 0) { this->action = 1; diff --git a/src/object/deathFx.c b/src/object/deathFx.c index 3c305737..cf1d53ed 100644 --- a/src/object/deathFx.c +++ b/src/object/deathFx.c @@ -1,10 +1,16 @@ -#include "global.h" +/** + * @file deathFx.c + * @ingroup Objects + * + * @brief Death Fx object + */ #define NENT_DEPRECATED +#include "enemy.h" #include "entity.h" -#include "sound.h" #include "functions.h" +#include "global.h" #include "object/deathFx.h" -#include "enemy.h" +#include "sound.h" void sub_08081790(DeathFxObject* this); void DeathFx_Delete(DeathFxObject* this); diff --git a/src/object/object21.c b/src/object/dirtParticle.c index 4f085cf2..7e6b594d 100644 --- a/src/object/object21.c +++ b/src/object/dirtParticle.c @@ -1,37 +1,36 @@ /** - * @file object21.c + * @file dirtParticle.c * @ingroup Objects * - * @brief Object21 object + * @brief Dirt Particle object */ - #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; /*0x68*/ u8 unk_68[0x18]; /*0x80*/ u32 unk_80; /*0x84*/ u32 unk_84; -} Object21Entity; +} DirtParticleEntity; -void sub_08087A10(Object21Entity*); -void sub_08087AFC(Object21Entity*); -void sub_08087B58(Object21Entity*); -void sub_08087B88(Object21Entity*); -void sub_08087B9C(Object21Entity*); -void sub_08087B9C(Object21Entity*); +void DirtParticle_Init(DirtParticleEntity*); +void DirtParticle_Action1(DirtParticleEntity*); +void DirtParticle_Action3(DirtParticleEntity*); +void sub_08087B88(DirtParticleEntity*); +void sub_08087B9C(DirtParticleEntity*); +void sub_08087B9C(DirtParticleEntity*); -void Object21(Object21Entity* this) { - static void (*const gUnk_08120A68[])(Object21Entity*) = { - sub_08087A10, - sub_08087AFC, +void DirtParticle(DirtParticleEntity* this) { + static void (*const DirtParticle_Actions[])(DirtParticleEntity*) = { + DirtParticle_Init, + DirtParticle_Action1, NULL, - sub_08087B58, + DirtParticle_Action3, }; - gUnk_08120A68[super->action](this); + DirtParticle_Actions[super->action](this); GetNextFrame(super); if (super->timer != 0) { super->timer--; @@ -54,7 +53,7 @@ void Object21(Object21Entity* this) { extern const Hitbox gUnk_08120A8C; -void sub_08087A10(Object21Entity* this) { +void DirtParticle_Init(DirtParticleEntity* this) { static const u8 gUnk_08120A78[] = { 3, 63, @@ -102,8 +101,8 @@ void sub_08087A10(Object21Entity* this) { InitializeAnimation(super, 0x10); } -void sub_08087AFC(Object21Entity* this) { - Object21Entity* entity; +void DirtParticle_Action1(DirtParticleEntity* this) { + DirtParticleEntity* entity; if ((super->contactFlags & 0x80) == 0) { return; } @@ -118,15 +117,15 @@ void sub_08087AFC(Object21Entity* this) { break; case 0x1b: case 0x1c: - entity = (Object21Entity*)super->contactedEntity; + entity = (DirtParticleEntity*)super->contactedEntity; super->direction = CalculateDirectionTo(entity->unk_84, entity->unk_80, super->x.WORD, super->y.WORD); super->speed = 0x100; break; } } -void sub_08087B58(Object21Entity* this) { - static void (*const gUnk_08120A80[])(Object21Entity*) = { +void DirtParticle_Action3(DirtParticleEntity* this) { + static void (*const gUnk_08120A80[])(DirtParticleEntity*) = { sub_08087B88, sub_08087B9C, sub_08087B9C, @@ -140,13 +139,13 @@ void sub_08087B58(Object21Entity* this) { const Hitbox gUnk_08120A8C = { 0, 0, { 6, 3, 3, 6 }, 3, 3 }; -void sub_08087B88(Object21Entity* this) { +void sub_08087B88(DirtParticleEntity* this) { super->knockbackSpeed = 0x100; super->subAction = 1; super->gustJarTolerance = 1; } -void sub_08087B9C(Object21Entity* this) { +void sub_08087B9C(DirtParticleEntity* this) { if (sub_0806F3E4(super)) { DeleteThisEntity(); } diff --git a/src/object/doubleBookshelf.c b/src/object/doubleBookshelf.c index 65e1b510..877c3014 100644 --- a/src/object/doubleBookshelf.c +++ b/src/object/doubleBookshelf.c @@ -4,11 +4,10 @@ * * @brief Double Bookshelf object */ - #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/objectAD.c b/src/object/elementsBackground.c index f128cb2f..e02bba1b 100644 --- a/src/object/objectAD.c +++ b/src/object/elementsBackground.c @@ -1,22 +1,28 @@ +/** + * @file elementsBackground.c + * @ingroup Objects + * + * @brief Elements Background object + */ #define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "screen.h" -void sub_080A04A4(Entity*); -void sub_080A04E0(Entity*); +void ElementsBackground_Init(Entity*); +void ElementsBackground_Action1(Entity*); void sub_080A04E8(); -void ObjectAD(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_080A04A4, - sub_080A04E0, +void ElementsBackground(Entity* this) { + static void (*const ElementsBackground_Actions[])(Entity*) = { + ElementsBackground_Init, + ElementsBackground_Action1, }; - actionFuncs[this->action]((Entity*)this); + ElementsBackground_Actions[this->action]((Entity*)this); } -void sub_080A04A4(Entity* this) { +void ElementsBackground_Init(Entity* this) { this->action = 1; this->frameIndex = 4; this->timer = 0; @@ -27,7 +33,7 @@ void sub_080A04A4(Entity* this) { sub_080A04E8(); } -void sub_080A04E0(Entity* this) { +void ElementsBackground_Action1(Entity* this) { sub_080A04E8(); } diff --git a/src/object/enemyItem.c b/src/object/enemyItem.c index 81910655..5a238b52 100644 --- a/src/object/enemyItem.c +++ b/src/object/enemyItem.c @@ -6,9 +6,9 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/eyeSwitch.c b/src/object/eyeSwitch.c index 67a5f62d..6a584d68 100644 --- a/src/object/eyeSwitch.c +++ b/src/object/eyeSwitch.c @@ -1,7 +1,13 @@ +/** + * @file eyeSwitch.c + * @ingroup Objects + * + * @brief EyeSwitch object + */ #define NENT_DEPRECATED #include "entity.h" -#include "hitbox.h" #include "flags.h" +#include "hitbox.h" #include "sound.h" typedef struct { diff --git a/src/object/ezloCap.c b/src/object/ezloCap.c index 272e0b3a..256a505c 100644 --- a/src/object/ezloCap.c +++ b/src/object/ezloCap.c @@ -6,10 +6,10 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "message.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; @@ -131,7 +131,7 @@ void EzloCap_Type1Action1(EzloCapEntity* this) { super->timer++; super->subtimer = 10; tmp = super->timer - 1; - obj = CreateObjectWithParent(super, OBJECT_79, tmp, 0); + obj = CreateObjectWithParent(super, SHRINKING_HIEROGLYPHS, tmp, 0); super->child = obj; if (obj != NULL) { if (tmp == 0) { diff --git a/src/object/object61.c b/src/object/ezloCapFlying.c index e9107fc6..f2d40b72 100644 --- a/src/object/object61.c +++ b/src/object/ezloCapFlying.c @@ -1,15 +1,14 @@ /** - * @file object61.c + * @file ezloCapFlying.c * @ingroup Objects * - * @brief Object61 object + * @brief Ezlo Cap Flying object */ - #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "new_player.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; @@ -19,18 +18,18 @@ typedef struct { /*0x72*/ u16 unk_72; /*0x74*/ u16 unk_74; /*0x76*/ u16 unk_76; -} Object61Entity; +} EzloCapFlyingEntity; -void Object61_Init(Object61Entity*); -void Object61_Action1(Object61Entity*); -void Object61_Action1Type0(Object61Entity*); -void Object61_Action1Type1(Object61Entity*); -void sub_080936C8(Object61Entity*); +void EzloCapFlying_Init(EzloCapFlyingEntity*); +void EzloCapFlying_Action1(EzloCapFlyingEntity*); +void EzloCapFlying_Action1Type0(EzloCapFlyingEntity*); +void EzloCapFlying_Action1Type1(EzloCapFlyingEntity*); +void sub_080936C8(EzloCapFlyingEntity*); -void Object61(Object61Entity* this) { - static void (*const Object61_Actions[])(Object61Entity*) = { - Object61_Init, - Object61_Action1, +void EzloCapFlying(EzloCapFlyingEntity* this) { + static void (*const EzloCapFlying_Actions[])(EzloCapFlyingEntity*) = { + EzloCapFlying_Init, + EzloCapFlying_Action1, }; if ((gPlayerState.flags & PL_PARACHUTE) == 0) { if (super->type == 0) { @@ -38,10 +37,10 @@ void Object61(Object61Entity* this) { } DeleteThisEntity(); } - Object61_Actions[super->action](this); + EzloCapFlying_Actions[super->action](this); } -void Object61_Init(Object61Entity* this) { +void EzloCapFlying_Init(EzloCapFlyingEntity* this) { super->action = 1; super->lastFrameIndex = 0xff; super->palette.b.b0 = gPlayerEntity.palette.b.b0; @@ -50,20 +49,20 @@ void Object61_Init(Object61Entity* this) { super->spriteRendering.b0 = 3; this->unk_6e = 0x180; this->unk_72 = 0x180; - CreateObjectWithParent(super, OBJECT_61, 1, 0); + CreateObjectWithParent(super, EZLO_CAP_FLYING, 1, 0); } - Object61_Action1(this); + EzloCapFlying_Action1(this); } -void Object61_Action1(Object61Entity* this) { - static void (*const Object61_Action1Types[])(Object61Entity*) = { - Object61_Action1Type0, - Object61_Action1Type1, +void EzloCapFlying_Action1(EzloCapFlyingEntity* this) { + static void (*const EzloCapFlying_Action1Types[])(EzloCapFlyingEntity*) = { + EzloCapFlying_Action1Type0, + EzloCapFlying_Action1Type1, }; - Object61_Action1Types[super->type](this); + EzloCapFlying_Action1Types[super->type](this); } -void Object61_Action1Type0(Object61Entity* this) { +void EzloCapFlying_Action1Type0(EzloCapFlyingEntity* this) { u32 tmp; if ((s16)this->unk_6e < 0) { this->unk_6e = -this->unk_6e; @@ -77,7 +76,7 @@ void Object61_Action1Type0(Object61Entity* this) { if (this->unk_72 > 0x80) { this->unk_72 -= 0x20; } else { - super->subtimer += 1; + super->subtimer++; SoundReq(SFX_124); } if (this->unk_6e < 0x120) { @@ -128,7 +127,7 @@ void Object61_Action1Type0(Object61Entity* this) { sub_0806FEBC(&gPlayerEntity, 1, super); } -void Object61_Action1Type1(Object61Entity* this) { +void EzloCapFlying_Action1Type1(EzloCapFlyingEntity* this) { super->frameIndex = ((gPlayerEntity.direction + (gPlayerEntity.direction >> 1)) >> 2) + 2; if (super->frameIndex != super->lastFrameIndex) { super->lastFrameIndex = super->frameIndex; @@ -137,12 +136,12 @@ void Object61_Action1Type1(Object61Entity* this) { CopyPosition(&gPlayerEntity, super); super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; - sub_0806FCF4(super, ((Object61Entity*)super->parent)->unk_72, 0x18, 0); + sub_0806FCF4(super, ((EzloCapFlyingEntity*)super->parent)->unk_72, 0x18, 0); super->spriteOffsetY = -super->spriteOffsetY; sub_0806FEBC(&gPlayerEntity, 0, super); } -void sub_080936C8(Object61Entity* this) { +void sub_080936C8(EzloCapFlyingEntity* this) { s32 tmp = gNewPlayerEntity.unk_7c; this->unk_76 = 0x138 - (gNewPlayerEntity.unk_7c >> 2); this->unk_74 = 8 - (tmp / 0x3c); diff --git a/src/object/fairy.c b/src/object/fairy.c index aac60b8b..91cda244 100644 --- a/src/object/fairy.c +++ b/src/object/fairy.c @@ -6,12 +6,12 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" +#include "collision.h" #include "functions.h" -#include "item.h" +#include "global.h" #include "hitbox.h" -#include "collision.h" +#include "item.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/fan.c b/src/object/fan.c index 0a3c3550..f9ee5fc5 100644 --- a/src/object/fan.c +++ b/src/object/fan.c @@ -1,12 +1,18 @@ +/** + * @file fan.c + * @ingroup Objects + * + * @brief Fan object + */ #define NENT_DEPRECATED -#include "global.h" +#include "collision.h" #include "entity.h" #include "flags.h" -#include "player.h" #include "functions.h" -#include "sound.h" +#include "global.h" #include "object.h" -#include "collision.h" +#include "player.h" +#include "sound.h" typedef struct { Entity base; @@ -38,13 +44,13 @@ void Fan_Action3(FanEntity* this); bool32 sub_0809EF78(FanEntity*, Entity*); void Fan(Entity* this) { - static void (*const actionFuncs[])(FanEntity*) = { + static void (*const Fan_Actions[])(FanEntity*) = { Fan_Init, Fan_Action1, Fan_Action2, Fan_Action3, }; - actionFuncs[this->action]((FanEntity*)this); + Fan_Actions[this->action]((FanEntity*)this); } void Fan_Init(FanEntity* this) { @@ -238,7 +244,7 @@ void sub_0809F0E4(FanEntity* this) { const s8* collisionData; EnqueueSFX(SFX_183); - pEVar1 = CreateObject(OBJECT_B2, super->type ^ 2, 0); + pEVar1 = CreateObject(FAN_WIND, super->type ^ 2, 0); if (pEVar1 != NULL) { pEVar1->parent = super; collisionData = typeOffsets + super->type * 2; diff --git a/src/object/objectB2.c b/src/object/fanWind.c index ceefcfac..9b8762f8 100644 --- a/src/object/objectB2.c +++ b/src/object/fanWind.c @@ -1,9 +1,15 @@ -#include "global.h" +/** + * @file fanWind.c + * @ingroup Objects + * + * @brief Fan Wind object + */ +#include "collision.h" #include "entity.h" #include "functions.h" -#include "collision.h" +#include "global.h" -void ObjectB2(Entity* this) { +void FanWind(Entity* this) { u8* collisionData; if (this->action == 0) { diff --git a/src/object/figurineDevice.c b/src/object/figurineDevice.c index 562424c1..33194506 100644 --- a/src/object/figurineDevice.c +++ b/src/object/figurineDevice.c @@ -6,13 +6,13 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" +#include "fileselect.h" #include "functions.h" +#include "global.h" +#include "item.h" #include "message.h" -#include "fileselect.h" +#include "object.h" #include "screen.h" -#include "item.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c index c17fefbd..868902b1 100644 --- a/src/object/fileScreenObjects.c +++ b/src/object/fileScreenObjects.c @@ -1,8 +1,14 @@ -#include "object.h" -#include "main.h" -#include "menu.h" +/** + * @file fileScreenObjects.c + * @ingroup Objects + * + * @brief File Screen Objects object + */ #include "fileselect.h" #include "functions.h" +#include "main.h" +#include "menu.h" +#include "object.h" extern int sub_0807A094(int); extern u32 sub_080041EC(int, int); diff --git a/src/object/fireballChain.c b/src/object/fireballChain.c index ac5322b7..4e5577a5 100644 --- a/src/object/fireballChain.c +++ b/src/object/fireballChain.c @@ -1,7 +1,13 @@ +/** + * @file fireballChain.c + * @ingroup Objects + * + * @brief Fireball Chain object + */ #define NENT_DEPRECATED -#include "global.h" #include "entity.h" #include "functions.h" +#include "global.h" #include "projectile.h" #include "projectile/winder.h" diff --git a/src/object/fireplace.c b/src/object/fireplace.c index e1c0f0d7..57a7cef9 100644 --- a/src/object/fireplace.c +++ b/src/object/fireplace.c @@ -1,20 +1,26 @@ -#include "object.h" +/** + * @file fireplace.c + * @ingroup Objects + * + * @brief Fireplace object + */ #include "functions.h" +#include "object.h" -void sub_0809B7A0(Entity* this); +void Fireplace_Action1(Entity* this); void sub_0809B7DC(Entity* this); void sub_0809B7C0(Entity* this); -void sub_0809B708(Entity* this); +void Fireplace_Init(Entity* this); void Fireplace(Entity* e) { - static void (*const actionFuncs[])(Entity*) = { - sub_0809B708, - sub_0809B7A0, + static void (*const Fireplace_Actions[])(Entity*) = { + Fireplace_Init, + Fireplace_Action1, }; - actionFuncs[e->action](e); + Fireplace_Actions[e->action](e); } -void sub_0809B708(Entity* this) { +void Fireplace_Init(Entity* this) { this->action = 1; this->spriteSettings.draw = 1; this->speed = 0x80; @@ -25,10 +31,10 @@ void sub_0809B708(Entity* this) { sub_0807B7D8(0x30b, TILE(this->x.HALF.HI, this->y.HALF.HI), 2); SetTile(0x4061, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); } - sub_0809B7A0(this); + Fireplace_Action1(this); } -void sub_0809B7A0(Entity* this) { +void Fireplace_Action1(Entity* this) { sub_0809B7C0(this); if (this->timer) { SetFlag(this->field_0x86.HWORD); diff --git a/src/object/object2A.c b/src/object/flame.c index 226c9868..7f2508b5 100644 --- a/src/object/object2A.c +++ b/src/object/flame.c @@ -1,18 +1,24 @@ -#include "global.h" -#include "sound.h" +/** + * @file flame.c + * @ingroup Objects + * + * @brief Flame object + */ #include "entity.h" -#include "functions.h" #include "flags.h" +#include "functions.h" +#include "global.h" +#include "sound.h" extern void sub_0807AB44(Entity*, s32, s32); -void (*const gUnk_08120DD0[])(Entity*); +void (*const Flame_Actions[])(Entity*); -void Object2A(Entity* this) { - gUnk_08120DD0[this->action](this); +void Flame(Entity* this) { + Flame_Actions[this->action](this); } -void Object2A_Init(Entity* this) { +void Flame_Init(Entity* this) { this->action = 1; this->spriteSettings.draw = TRUE; if (this->type2 != 0) { @@ -41,7 +47,7 @@ void Object2A_Init(Entity* this) { EnqueueSFX(SFX_124); } -void sub_08089BA0(Entity* this) { +void Flame_Action1(Entity* this) { u32 val; GetNextFrame(this); @@ -92,7 +98,7 @@ void sub_08089BA0(Entity* this) { } } -void (*const gUnk_08120DD0[])(Entity*) = { - Object2A_Init, - sub_08089BA0, +void (*const Flame_Actions[])(Entity*) = { + Flame_Init, + Flame_Action1, }; diff --git a/src/object/floatingBlock.c b/src/object/floatingBlock.c index c7024c9b..79b784b5 100644 --- a/src/object/floatingBlock.c +++ b/src/object/floatingBlock.c @@ -1,3 +1,9 @@ +/** + * @file floatingBlock.c + * @ingroup Objects + * + * @brief Floating Block object + */ #include "object.h" void FloatingBlock(Entity* this) { diff --git a/src/object/floatingPlatform.c b/src/object/floatingPlatform.c index f762a719..15919a40 100644 --- a/src/object/floatingPlatform.c +++ b/src/object/floatingPlatform.c @@ -1,4 +1,10 @@ #define NENT_DEPRECATED +/** + * @file floatingPlatform.c + * @ingroup Objects + * + * @brief Floating Platform object + */ #include "entity.h" #include "functions.h" #include "object.h" diff --git a/src/object/fourElements.c b/src/object/fourElements.c index 1754134f..1a8f5240 100644 --- a/src/object/fourElements.c +++ b/src/object/fourElements.c @@ -6,13 +6,13 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" +#include "collision.h" #include "functions.h" +#include "global.h" #include "hitbox.h" -#include "screen.h" #include "message.h" -#include "collision.h" +#include "object.h" +#include "screen.h" typedef struct { /*0x00*/ Entity base; @@ -21,7 +21,7 @@ typedef struct { } FourElementsEntity; extern u32 getItemMetaDataGetTextIndex(u32); -extern void sub_0807DF50(void); +extern void EnablePauseMenu(void); extern u16 script_PlayerGetElement[]; @@ -45,7 +45,7 @@ void FourElements(FourElementsEntity* this) { } void FourElements_Init(FourElementsEntity* this) { - Entity* objectAD; + Entity* elementsBackground; super->action = 1; super->spriteSettings.draw = 1; super->spritePriority.b1 = 2; @@ -67,10 +67,10 @@ void FourElements_Init(FourElementsEntity* this) { gScreen.controls.layerFXControl = 0x640; gScreen.controls.alphaBlend = 0x1000; sub_0805BC4C(); - objectAD = CreateObjectWithParent(super, OBJECT_AD, super->type - 0x40, 0); - if (objectAD != NULL) { - objectAD->parent = super; - super->child = objectAD; + elementsBackground = CreateObjectWithParent(super, ELEMENTS_BACKGROUND, super->type - 0x40, 0); + if (elementsBackground != NULL) { + elementsBackground->parent = super; + super->child = elementsBackground; } } @@ -143,7 +143,7 @@ void FourElements_Action6(FourElementsEntity* this) { if ((gMessage.doTextBox & 0x7f) == 0) { SetPriorityTimer(90); gPlayerState.controlMode = 1; - sub_0807DF50(); + EnablePauseMenu(); SetRoomFlag(0); DeleteThisEntity(); } diff --git a/src/object/frozenFlower.c b/src/object/frozenFlower.c index 73a85446..0b93b1de 100644 --- a/src/object/frozenFlower.c +++ b/src/object/frozenFlower.c @@ -1,22 +1,28 @@ +/** + * @file frozenFlower.c + * @ingroup Objects + * + * @brief Frozen Flower object + */ #include "object.h" -void sub_0808A9DC(Entity*); -void nullsub_519(Entity*); +void FrozenFlower_Init(Entity*); +void FrozenFlower_Action1(Entity*); void FrozenFlower(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0808A9DC, - nullsub_519, + static void (*const FrozenFlower_Actions[])(Entity*) = { + FrozenFlower_Init, + FrozenFlower_Action1, }; - actionFuncs[this->action](this); + FrozenFlower_Actions[this->action](this); } -void sub_0808A9DC(Entity* this) { +void FrozenFlower_Init(Entity* this) { this->action = 1; this->frameIndex = this->type; this->spriteRendering.b3 = 3; this->spritePriority.b0 = 7; } -void nullsub_519(Entity* this) { +void FrozenFlower_Action1(Entity* this) { } diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c index 646a1045..4d497b72 100644 --- a/src/object/frozenOctorok.c +++ b/src/object/frozenOctorok.c @@ -4,13 +4,12 @@ * * @brief Frozen Octorok object */ - #define NENT_DEPRECATED #include "enemy/octorokBoss.h" -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "message.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/frozenWaterElement.c b/src/object/frozenWaterElement.c index 223f172c..f23a76a2 100644 --- a/src/object/frozenWaterElement.c +++ b/src/object/frozenWaterElement.c @@ -4,11 +4,10 @@ * * @brief Frozen Water Element object */ - #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; @@ -21,20 +20,20 @@ typedef struct { void sub_0809C0A8(FrozenWaterElementEntity*); void sub_0809C23C(FrozenWaterElementEntity*); -void sub_0809BECC(FrozenWaterElementEntity*); -void sub_0809BF1C(FrozenWaterElementEntity*); -void sub_0809BF74(FrozenWaterElementEntity*); +void FrozenWaterElement_Init(FrozenWaterElementEntity*); +void FrozenWaterElement_Action1(FrozenWaterElementEntity*); +void FrozenWaterElement_Action2(FrozenWaterElementEntity*); void FrozenWaterElement(FrozenWaterElementEntity* this) { - static void (*const gUnk_08123DB4[])(FrozenWaterElementEntity*) = { - sub_0809BECC, - sub_0809BF1C, - sub_0809BF74, + static void (*const FrozenWaterElement_Actions[])(FrozenWaterElementEntity*) = { + FrozenWaterElement_Init, + FrozenWaterElement_Action1, + FrozenWaterElement_Action2, }; - gUnk_08123DB4[super->action](this); + FrozenWaterElement_Actions[super->action](this); } -void sub_0809BECC(FrozenWaterElementEntity* this) { +void FrozenWaterElement_Init(FrozenWaterElementEntity* this) { Entity* obj; if (CheckFlags(0x9b)) { DeleteThisEntity(); @@ -51,10 +50,10 @@ void sub_0809BECC(FrozenWaterElementEntity* this) { } } -void sub_0809BF1C(FrozenWaterElementEntity* this) { +void FrozenWaterElement_Action1(FrozenWaterElementEntity* this) { SetAffineInfo(super, 0xcc, 0xcc, 0); if (CheckFlags(OUGONTEKI_G)) { - Entity* obj = CreateObject(OBJECT_90, 0, 0); + Entity* obj = CreateObject(WATER_ELEMENT, 0, 0); if (obj != NULL) { gRoomControls.camera_target = obj; (super->child)->child = obj; @@ -66,7 +65,7 @@ void sub_0809BF1C(FrozenWaterElementEntity* this) { } } -void sub_0809BF74(FrozenWaterElementEntity* this) { +void FrozenWaterElement_Action2(FrozenWaterElementEntity* this) { static const u8 gUnk_08123DC0[] = { 3, 7, 15, 31, 63, 63, 63, 63, 63, 63, 63, 0, }; diff --git a/src/object/furniture.c b/src/object/furniture.c index 8cd7fcc4..38a111d0 100644 --- a/src/object/furniture.c +++ b/src/object/furniture.c @@ -1,8 +1,14 @@ +/** + * @file furniture.c + * @ingroup Objects + * + * @brief Furniture object + */ #define NENT_DEPRECATED #include "entity.h" -#include "room.h" #include "functions.h" #include "object.h" +#include "room.h" extern void sub_080001D0(u32, u32, u32); @@ -500,7 +506,7 @@ static void sub_08090E4C(FurnitureEntity* this) { } void sub_08090E64(FurnitureEntity* this) { - Entity* e = CreateObject(OBJECT_2A, 0, 0); + Entity* e = CreateObject(FLAME, 0, 0); if (e != NULL) { PositionRelative(super, e, Q_16_16((s16)((u16)-2 + super->type2)), 0); e->z.HALF.HI -= 16; diff --git a/src/object/gentariCurtains.c b/src/object/gentariCurtain.c index e5b1d0eb..14a25cea 100644 --- a/src/object/gentariCurtains.c +++ b/src/object/gentariCurtain.c @@ -1,10 +1,16 @@ +/** + * @file gentariCurtain.c + * @ingroup Objects + * + * @brief Gentari Curtain object + */ #define NENT_DEPRECATED -#include "entity.h" -#include "room.h" #include "asm.h" +#include "entity.h" #include "flags.h" #include "functions.h" #include "object.h" +#include "room.h" typedef struct { Entity base; @@ -17,27 +23,27 @@ typedef struct { u16 flags; } GentariCurtainEntity; -void sub_08092050(GentariCurtainEntity* this); -void sub_0809214C(GentariCurtainEntity* this); -void sub_08092164(GentariCurtainEntity* this); -void nullsub_118(GentariCurtainEntity* this); +void GentariCurtain_Init(GentariCurtainEntity* this); +void GentariCurtain_Action1(GentariCurtainEntity* this); +void GentariCurtain_Action2(GentariCurtainEntity* this); +void GentariCurtain_Action3(GentariCurtainEntity* this); void sub_0809223C(GentariCurtainEntity* this); void sub_080921BC(GentariCurtainEntity* this); void sub_080921F0(GentariCurtainEntity* this); void sub_08092214(GentariCurtainEntity* this); void GentariCurtain(Entity* this) { - static void (*const actionFuncs[])(GentariCurtainEntity*) = { - sub_08092050, - sub_0809214C, - sub_08092164, - nullsub_118, + static void (*const GentariCurtain_Actions[])(GentariCurtainEntity*) = { + GentariCurtain_Init, + GentariCurtain_Action1, + GentariCurtain_Action2, + GentariCurtain_Action3, }; - actionFuncs[this->action]((GentariCurtainEntity*)this); + GentariCurtain_Actions[this->action]((GentariCurtainEntity*)this); } -void sub_08092050(GentariCurtainEntity* this) { +void GentariCurtain_Init(GentariCurtainEntity* this) { if (CheckFlags(this->flags)) { super->action = 3; super->x.HALF.HI += 2; @@ -65,13 +71,13 @@ void sub_08092050(GentariCurtainEntity* this) { } } -void sub_0809214C(GentariCurtainEntity* this) { +void GentariCurtain_Action1(GentariCurtainEntity* this) { if (CheckFlags(this->flags)) { super->action = 2; } } -void sub_08092164(GentariCurtainEntity* this) { +void GentariCurtain_Action2(GentariCurtainEntity* this) { UpdateAnimationSingleFrame(super); if ((super->frame & ANIM_DONE) != 0) { super->action = 3; @@ -83,7 +89,7 @@ void sub_08092164(GentariCurtainEntity* this) { } } -void nullsub_118(GentariCurtainEntity* this) { +void GentariCurtain_Action3(GentariCurtainEntity* this) { } void sub_080921BC(GentariCurtainEntity* this) { diff --git a/src/object/giantBookLadder.c b/src/object/giantBookLadder.c index 5983787b..fd1e2a25 100644 --- a/src/object/giantBookLadder.c +++ b/src/object/giantBookLadder.c @@ -1,3 +1,9 @@ +/** + * @file giantBookLadder.c + * @ingroup Objects + * + * @brief Giant Book Ladder object + */ #define NENT_DEPRECATED #include "object.h" #include "manager.h" diff --git a/src/object/giantLeaf.c b/src/object/giantLeaf.c index 23a998e8..caab128c 100644 --- a/src/object/giantLeaf.c +++ b/src/object/giantLeaf.c @@ -1,3 +1,9 @@ +/** + * @file giantLeaf.c + * @ingroup Objects + * + * @brief Giant Leaf object + */ #include "object.h" void sub_0808D618(Entity* ent); diff --git a/src/object/giantRock.c b/src/object/giantRock.c index d40befca..c8a5747e 100644 --- a/src/object/giantRock.c +++ b/src/object/giantRock.c @@ -1,3 +1,9 @@ +/** + * @file giantRock.c + * @ingroup Objects + * + * @brief Giant Rock object + */ #include "entity.h" void GiantRock(Entity* this) { diff --git a/src/object/giantRock2.c b/src/object/giantRock2.c index c347e04b..923a4dbe 100644 --- a/src/object/giantRock2.c +++ b/src/object/giantRock2.c @@ -1,7 +1,13 @@ +/** + * @file giantRock2.c + * @ingroup Objects + * + * @brief Giant Rock 2 object + */ #define NENT_DEPRECATED +#include "asm.h" #include "entity.h" #include "room.h" -#include "asm.h" typedef struct { Entity base; diff --git a/src/object/giantTwig.c b/src/object/giantTwig.c index 7ea18063..7927c32c 100644 --- a/src/object/giantTwig.c +++ b/src/object/giantTwig.c @@ -6,9 +6,9 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/object67.c b/src/object/gleerokParticle.c index e73c7a0b..93462377 100644 --- a/src/object/object67.c +++ b/src/object/gleerokParticle.c @@ -1,11 +1,17 @@ +/** + * @file gleerokParticle.c + * @ingroup Objects + * + * @brief Gleerok Particle object + */ #define NENT_DEPRECATED -#include "entity.h" -#include "room.h" -#include "player.h" #include "asm.h" +#include "effects.h" +#include "entity.h" #include "functions.h" #include "object.h" -#include "effects.h" +#include "player.h" +#include "room.h" typedef struct { Entity base; @@ -15,24 +21,25 @@ typedef struct { u32 unk7c; union SplitWord unk80; union SplitWord unk84; -} Object67Entity; +} GleerokParticleEntity; extern Hitbox gUnk_080FD2E8; -void sub_08094148(Object67Entity*); -void sub_08094398(Object67Entity*); -void sub_08094424(Object67Entity*); -void sub_08094540(Object67Entity*); -void sub_08094570(Object67Entity*); -void sub_08094660(Object67Entity*); -void sub_08094708(Object67Entity*, u32, u32); +void GleerokParticle_Init(GleerokParticleEntity*); +void GleerokParticle_Action1(GleerokParticleEntity*); +void GleerokParticle_Action2(GleerokParticleEntity*); +void GleerokParticle_Action3(GleerokParticleEntity*); +void GleerokParticle_Action4(GleerokParticleEntity*); +void sub_08094660(GleerokParticleEntity*); +void sub_08094708(GleerokParticleEntity*, u32, u32); -void Object67(Entity* this) { - static void (*const actionFuncs[])(Object67Entity*) = { - sub_08094148, sub_08094398, sub_08094424, sub_08094540, sub_08094570, +void GleerokParticle(Entity* this) { + static void (*const GleerokParticle_Actions[])(GleerokParticleEntity*) = { + GleerokParticle_Init, GleerokParticle_Action1, GleerokParticle_Action2, + GleerokParticle_Action3, GleerokParticle_Action4, }; - actionFuncs[this->action]((Object67Entity*)this); + GleerokParticle_Actions[this->action]((GleerokParticleEntity*)this); } typedef struct { @@ -51,7 +58,7 @@ typedef struct { u8 filler[3]; } gUnk_081229F0_struct; -void sub_08094148(Object67Entity* this) { +void GleerokParticle_Init(GleerokParticleEntity* this) { static const gUnk_081229D0_struct gUnk_081229D0[] = { { 0, 12, 8, 8 }, { 0x40, 0x14, -8, 8 }, { 0x80, 4, 8, -8 }, { 0xC0, 0x1C, -8, -8 }, { 0, 12, 0, 0 }, { 0x40, 0x14, 0, 0 }, { 0x80, 4, 0, 0 }, { 0xC0, 0x1C, -0, 0 }, @@ -101,7 +108,7 @@ void sub_08094148(Object67Entity* this) { break; case 1: if (super->type2 == 0) { - super->child = CreateObjectWithParent(super, OBJECT_67, 1, 0x80); + super->child = CreateObjectWithParent(super, GLEEROK_PARTICLE, 1, 0x80); if (super->child != NULL) { super->child->child = super->parent; } @@ -158,10 +165,10 @@ void sub_08094148(Object67Entity* this) { } super->action = 1; - sub_08094398(this); + GleerokParticle_Action1(this); } -void sub_08094398(Object67Entity* this) { +void GleerokParticle_Action1(GleerokParticleEntity* this) { switch (super->type) { case 0: GetNextFrame(super); @@ -190,7 +197,7 @@ void sub_08094398(Object67Entity* this) { } } -void sub_08094424(Object67Entity* this) { +void GleerokParticle_Action2(GleerokParticleEntity* this) { u32 uVar2; u32 uVar5; @@ -234,7 +241,7 @@ void sub_08094424(Object67Entity* this) { } } -void sub_08094540(Object67Entity* this) { +void GleerokParticle_Action3(GleerokParticleEntity* this) { if (--this->unk7c == -1) { super->action = 4; this->unk7c = 2; @@ -242,7 +249,7 @@ void sub_08094540(Object67Entity* this) { SetAffineInfo(super, this->unk80.HALF_U.HI, this->unk84.HALF_U.HI, 0); } -void sub_08094570(Object67Entity* this) { +void GleerokParticle_Action4(GleerokParticleEntity* this) { u32 uVar2; u32 uVar3; @@ -284,7 +291,7 @@ void sub_08094570(Object67Entity* this) { } } -void sub_08094660(Object67Entity* this) { +void sub_08094660(GleerokParticleEntity* this) { int iVar1; int spriteOffsetX; int iVar3; @@ -325,7 +332,7 @@ void sub_08094660(Object67Entity* this) { } } -void sub_08094708(Object67Entity* this, u32 param_2, u32 param_3) { +void sub_08094708(GleerokParticleEntity* this, u32 param_2, u32 param_3) { int index; for (index = this->unk74 * 2 + 8; index != 0; index--) { diff --git a/src/object/object96.c b/src/object/graveyardKey.c index 0a7f96d7..0a0dfc0b 100644 --- a/src/object/object96.c +++ b/src/object/graveyardKey.c @@ -1,13 +1,19 @@ +/** + * @file graveyardKey.c + * @ingroup Objects + * + * @brief Graveyard Key object + */ #define NENT_DEPRECATED -#include "entity.h" -#include "player.h" #include "asm.h" +#include "collision.h" +#include "effects.h" +#include "entity.h" +#include "flags.h" #include "functions.h" -#include "sound.h" #include "item.h" -#include "flags.h" -#include "effects.h" -#include "collision.h" +#include "player.h" +#include "sound.h" typedef struct _struct_gUnk_08123FB0 { void (*const funcEnt)(Entity*); @@ -33,10 +39,10 @@ static_assert(sizeof(struct_gUnk_08123FB0) == 0x20); void sub_0809D91C(Entity*); bool32 sub_0809D93C(Entity*, const struct_gUnk_08123FB0*); -void Object96_Init(Entity*, const struct_gUnk_08123FB0*); -void Object96_Action1(Entity*, const struct_gUnk_08123FB0*); -void Object96_Action2(Entity*, const struct_gUnk_08123FB0*); -void Object96_Action3(Entity*, const struct_gUnk_08123FB0*); +void GraveyardKey_Init(Entity*, const struct_gUnk_08123FB0*); +void GraveyardKey_Action1(Entity*, const struct_gUnk_08123FB0*); +void GraveyardKey_Action2(Entity*, const struct_gUnk_08123FB0*); +void GraveyardKey_Action3(Entity*, const struct_gUnk_08123FB0*); static const struct_gUnk_08123FB0 gUnk_08123FB0[] = { { sub_0809D91C, sub_0809D93C, 0, 0, 0x30, 0x30, 0x1, 0x3c, 0x3c, 0x13, Q_16_16(1.0), 0x1800, 0x60, 0x40, 0x4021, @@ -56,17 +62,17 @@ static const struct_gUnk_08123FB0 gUnk_08123FB0[] = { { NULL, NULL, 0, 0, 0, 0, 0x0, 0x5c, 0x5c, 0x81, 0, 0x1800, 0x100, 0x20, 0x0, 0x1, 0x0 }, }; -void Object96(Entity* this) { - static void (*const actionFuncs[])(Entity*, const struct_gUnk_08123FB0*) = { - Object96_Init, - Object96_Action1, - Object96_Action2, - Object96_Action3, +void GraveyardKey(Entity* this) { + static void (*const GraveyardKey_Actions[])(Entity*, const struct_gUnk_08123FB0*) = { + GraveyardKey_Init, + GraveyardKey_Action1, + GraveyardKey_Action2, + GraveyardKey_Action3, }; - actionFuncs[this->action](this, &gUnk_08123FB0[this->type]); + GraveyardKey_Actions[this->action](this, &gUnk_08123FB0[this->type]); } -void Object96_Init(Entity* this, const struct_gUnk_08123FB0* param_2) { +void GraveyardKey_Init(Entity* this, const struct_gUnk_08123FB0* param_2) { u32 type; u32 dir; @@ -91,7 +97,7 @@ void Object96_Init(Entity* this, const struct_gUnk_08123FB0* param_2) { this->type = type; } -void Object96_Action1(Entity* this, const struct_gUnk_08123FB0* param_2) { +void GraveyardKey_Action1(Entity* this, const struct_gUnk_08123FB0* param_2) { u32 type; s32 iVar3; @@ -110,7 +116,7 @@ void Object96_Action1(Entity* this, const struct_gUnk_08123FB0* param_2) { this->type = type; } -void Object96_Action2(Entity* this, const struct_gUnk_08123FB0* param_2) { +void GraveyardKey_Action2(Entity* this, const struct_gUnk_08123FB0* param_2) { u8 type; LinearMoveUpdate(this); @@ -134,7 +140,7 @@ void Object96_Action2(Entity* this, const struct_gUnk_08123FB0* param_2) { this->type = type; } -void Object96_Action3(Entity* this, const struct_gUnk_08123FB0* param_2) { +void GraveyardKey_Action3(Entity* this, const struct_gUnk_08123FB0* param_2) { u8 type; if (gPlayerState.flags & PL_MINISH) { diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index fe7b88a8..eca04021 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -1,8 +1,14 @@ +/** + * @file greatFairy.c + * @ingroup Objects + * + * @brief Great Fairy object + */ +#include "functions.h" #include "object.h" #include "save.h" -#include "script.h" -#include "functions.h" #include "screen.h" +#include "script.h" void GreatFairy_InitializeAnimation(Entity*); Entity* GreatFairy_CreateForm(Entity*, u32, u32); @@ -525,7 +531,7 @@ void sub_08087424(Entity* this, ScriptExecutionContext* context) { Entity* ent; ResetPlayerAnimationAndAction(); - ent = CreateObject(OBJECT_64, 0, 0); + ent = CreateObject(THUNDERBOLD, 0, 0); if (ent != NULL) { ent->parent = &gPlayerEntity; CopyPosition(&gPlayerEntity, ent); diff --git a/src/object/object98.c b/src/object/guruguruBar.c index 96626eeb..0de3796d 100644 --- a/src/object/object98.c +++ b/src/object/guruguruBar.c @@ -1,9 +1,15 @@ +/** + * @file guruguruBar.c + * @ingroup Objects + * + * @brief Guruguru Bar object + */ #define NENT_DEPRECATED #include "entity.h" -#include "projectile.h" -#include "room.h" #include "functions.h" #include "object.h" +#include "projectile.h" +#include "room.h" typedef struct { Entity base; @@ -12,21 +18,21 @@ typedef struct { u16 unk76; u8 filler2[0x6]; u8 unk7e; -} Object98Entity; +} GuruguruBarEntity; -void sub_0809E360(Object98Entity*); -void sub_0809E3E4(Object98Entity*); +void GuruguruBar_Init(GuruguruBarEntity*); +void GuruguruBar_Action1(GuruguruBarEntity*); -void Object98(Entity* this) { - static void (*const actionFuncs[])(Object98Entity*) = { - sub_0809E360, - sub_0809E3E4, +void GuruguruBar(Entity* this) { + static void (*const GuruguruBar_Actions[])(GuruguruBarEntity*) = { + GuruguruBar_Init, + GuruguruBar_Action1, }; - actionFuncs[this->action]((Object98Entity*)this); + GuruguruBar_Actions[this->action]((GuruguruBarEntity*)this); } -void sub_0809E360(Object98Entity* this) { +void GuruguruBar_Init(GuruguruBarEntity* this) { u32 bVar1; Entity* projEnt; u32 index; @@ -54,7 +60,7 @@ void sub_0809E360(Object98Entity* this) { } } -void sub_0809E3E4(Object98Entity* this) { +void GuruguruBar_Action1(GuruguruBarEntity* this) { this->unk76 += super->type2; super->animationState = this->unk76 >> 2; if (super->type != 0) { diff --git a/src/object/object17.c b/src/object/gustJarParticle.c index ca83a1c7..4cbcb580 100644 --- a/src/object/object17.c +++ b/src/object/gustJarParticle.c @@ -1,3 +1,9 @@ +/** + * @file gustJarParticle.c + * @ingroup Objects + * + * @brief Gust Jar Particle object + */ #define NENT_DEPRECATED #include "entity.h" #include "player.h" @@ -5,19 +11,19 @@ #include "room.h" #include "physics.h" -void Object17_Init(Entity*); -void Object17_Action1(Entity*); +void GustJarParticle_Init(Entity*); +void GustJarParticle_Action1(Entity*); -void Object17(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - Object17_Init, - Object17_Action1, +void GustJarParticle(Entity* this) { + static void (*const GustJarParticle_Actions[])(Entity*) = { + GustJarParticle_Init, + GustJarParticle_Action1, }; - actionFuncs[this->action](this); + GustJarParticle_Actions[this->action](this); } -void Object17_Init(Entity* this) { +void GustJarParticle_Init(Entity* this) { this->action = 1; this->speed = 0x80; this->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; @@ -28,7 +34,7 @@ void Object17_Init(Entity* this) { InitializeAnimation(this, 0x11); } -void Object17_Action1(Entity* this) { +void GustJarParticle_Action1(Entity* this) { if (this->type != 0) { if ((gRoomTransition.frameCount & 1) == 0) { GetNextFrame(this); diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c index 251b3969..f66fdee7 100644 --- a/src/object/gyorgBossObject.c +++ b/src/object/gyorgBossObject.c @@ -1,12 +1,18 @@ +/** + * @file gyorgBossObject.c + * @ingroup Objects + * + * @brief Gyorg Boss object + */ #define NENT_DEPRECATED -#include "global.h" +#include "area.h" +#include "enemy/gyorg.h" #include "entity.h" +#include "functions.h" +#include "global.h" #include "object.h" -#include "area.h" #include "room.h" #include "screen.h" -#include "functions.h" -#include "enemy/gyorg.h" extern const ScreenTransitionData gUnk_0813ABD0; @@ -39,13 +45,13 @@ void GyorgBossObject_FemalePhase4(GyorgBossObjectEntity* this); void GyorgBossObject_FightEnd(GyorgBossObjectEntity* this); void GyorgBossObject(Entity* this) { - static void (*const gUnk_08124ED0[])(GyorgBossObjectEntity*) = { + static void (*const GyorgBossObject_Actions[])(GyorgBossObjectEntity*) = { GyorgBossObject_SetupStart, GyorgBossObject_Setup, GyorgBossObject_FemalePhase1, GyorgBossObject_MalePhase1, GyorgBossObject_FemalePhase2, GyorgBossObject_MalePhase2, GyorgBossObject_FemalePhase3, GyorgBossObject_MalePhase3, GyorgBossObject_FemalePhase4, GyorgBossObject_FightEnd, }; - gUnk_08124ED0[this->action]((GyorgBossObjectEntity*)this); + GyorgBossObject_Actions[this->action]((GyorgBossObjectEntity*)this); sub_080A1DCC((GyorgBossObjectEntity*)this); sub_080A1C9C((GyorgBossObjectEntity*)this); } diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c index 9d02d53f..f709259b 100644 --- a/src/object/heartContainer.c +++ b/src/object/heartContainer.c @@ -1,29 +1,35 @@ -#include "sound.h" +/** + * @file heartContainer.c + * @ingroup Objects + * + * @brief HeartContainer object + */ +#include "collision.h" #include "entity.h" #include "flags.h" #include "functions.h" #include "item.h" -#include "collision.h" +#include "sound.h" -static void sub_0808E6A0(Entity*); -static void sub_0808E6E4(Entity*); -static void sub_0808E714(Entity*); -static void sub_0808E764(Entity*); +static void HeartContainer_Init(Entity*); +static void HeartContainer_Action1(Entity*); +static void HeartContainer_Action2(Entity*); +static void HeartContainer_Action3(Entity*); -static void (*const gHeartContainerActions[])(Entity*) = { - sub_0808E6A0, - sub_0808E6E4, - sub_0808E714, - sub_0808E764, +static void (*const HeartContainer_Actions[])(Entity*) = { + HeartContainer_Init, + HeartContainer_Action1, + HeartContainer_Action2, + HeartContainer_Action3, }; const Hitbox3D gUnk_08121C58 = { 0, -3, { 5, 3, 3, 5 }, 6, 6, 12, {} }; void HeartContainer(Entity* this) { - gHeartContainerActions[this->action](this); + HeartContainer_Actions[this->action](this); } -static void sub_0808E6A0(Entity* this) { +static void HeartContainer_Init(Entity* this) { if (CheckFlags(this->cutsceneBeh.HWORD)) { DeleteThisEntity(); } @@ -35,16 +41,16 @@ static void sub_0808E6A0(Entity* this) { this->updatePriority = PRIO_NO_BLOCK; } -static void sub_0808E6E4(Entity* this) { +static void HeartContainer_Action1(Entity* this) { if (CheckFlags(this->field_0x86.HWORD)) { this->action = 2; this->spriteSettings.draw = 1; this->spriteRendering.b0 = 3; - sub_0808E714(this); + HeartContainer_Action2(this); } } -static void sub_0808E714(Entity* this) { +static void HeartContainer_Action2(Entity* this) { int var0 = 0x400 - this->subtimer * 8; if (var0 > 0x100) { this->subtimer++; @@ -58,7 +64,7 @@ static void sub_0808E714(Entity* this) { sub_08080CB4(this); } -static void sub_0808E764(Entity* this) { +static void HeartContainer_Action3(Entity* this) { sub_08080CB4(this); if (!(gPlayerState.flags & PL_MINISH) && IsCollidingPlayer(this)) { SetFlag(this->cutsceneBeh.HWORD); diff --git a/src/object/hiddenLadderDown.c b/src/object/hiddenLadderDown.c index a16b06c9..d2369721 100644 --- a/src/object/hiddenLadderDown.c +++ b/src/object/hiddenLadderDown.c @@ -1,23 +1,29 @@ -#include "global.h" +/** + * @file hiddenLadderDown.c + * @ingroup Objects + * + * @brief Hidden Ladder Down object + */ #include "asm.h" #include "entity.h" -#include "functions.h" #include "flags.h" +#include "functions.h" +#include "global.h" -void sub_08091F14(Entity*); -void sub_08092000(Entity*); +void HiddenLadderDown_Init(Entity*); +void HiddenLadderDown_Action1(Entity*); void HiddenLadderDown(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_08091F14, - sub_08092000, + static void (*const HiddenLadderDown_Actions[])(Entity*) = { + HiddenLadderDown_Init, + HiddenLadderDown_Action1, }; if (this->action < 2) { - actionFuncs[this->action](this); + HiddenLadderDown_Actions[this->action](this); } } -void sub_08091F14(Entity* this) { +void HiddenLadderDown_Init(Entity* this) { u16* puVar3; this->action = 1; @@ -40,7 +46,7 @@ void sub_08091F14(Entity* this) { } } -void sub_08092000(Entity* this) { +void HiddenLadderDown_Action1(Entity* this) { if (GetTileType(*(u16*)&this->field_0x70.HALF.LO, this->collisionLayer) == 0x1a6) { this->action = 2; this->spriteSettings.draw = TRUE; diff --git a/src/object/object99.c b/src/object/hitSwitch.c index e333f535..0b32dce4 100644 --- a/src/object/object99.c +++ b/src/object/hitSwitch.c @@ -1,10 +1,14 @@ +/** + * @file hitSwitch.c + * @ingroup Objects + * + * @brief Hit Switch object + */ #include "entity.h" #include "physics.h" -void Object99(Entity* this) { - Entity* parent; - - parent = this->parent; +void HitSwitch(Entity* this) { + Entity* parent = this->parent; if (parent->next == NULL) { DeleteThisEntity(); } diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index 80dcef12..225147a7 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -1,12 +1,18 @@ -#include "global.h" +/** + * @file houseDoorExterior.c + * @ingroup Objects + * + * @brief House Door Exterior object + */ #include "entity.h" #include "flags.h" +#include "functions.h" +#include "global.h" +#include "npc.h" +#include "object.h" #include "room.h" #include "script.h" #include "sound.h" -#include "object.h" -#include "functions.h" -#include "npc.h" typedef struct { /*0x00*/ u16 unk0; @@ -173,7 +179,7 @@ void sub_0808692C(Entity* this) { static u8 sub_08086954(Entity* this) { if (sub_0800445C(this)) { if (GetAnimationStateInRectRadius(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 && - (u16)gPlayerState.field_0x90 == 0x400 && gPlayerState.jump_status == 0) { + (u16)gPlayerState.playerInput.field_0x90 == PLAYER_INPUT_UP && gPlayerState.jump_status == 0) { this->timer--; } } else { diff --git a/src/object/houseDoorInterior.c b/src/object/houseDoorInterior.c index ae0a247e..c8cc5334 100644 --- a/src/object/houseDoorInterior.c +++ b/src/object/houseDoorInterior.c @@ -1,9 +1,15 @@ +/** + * @file houseDoorInterior.c + * @ingroup Objects + * + * @brief House Door Interior object + */ #define NENT_DEPRECATED #include "entity.h" #include "flags.h" -#include "sound.h" #include "functions.h" #include "npc.h" +#include "sound.h" typedef struct { Entity base; @@ -86,7 +92,7 @@ void HouseDoorInterior_Action1(HouseDoorInteriorEntity* this) { if (sub_0800445C(super) && this->unk7d == 0) { ptr = gUnk_081227CC + super->type2; if (GetAnimationStateInRectRadius(super, ptr->x, ptr->y) >= 0 && - ptr->animationState == gPlayerEntity.animationState && gPlayerState.field_0x90 & ptr->unk2) { + ptr->animationState == gPlayerEntity.animationState && gPlayerState.playerInput.field_0x90 & ptr->unk2) { --super->timer; } } else { diff --git a/src/object/object1C.c b/src/object/houseSign.c index 383fa130..7e5413b0 100644 --- a/src/object/object1C.c +++ b/src/object/houseSign.c @@ -1,4 +1,9 @@ -#include "global.h" +/** + * @file houseSign.c + * @ingroup Objects + * + * @brief HouseSign object + */ #include "entity.h" extern u32 CheckRectOnScreen(s16, s16, u32, u32); @@ -6,9 +11,9 @@ extern u32 CheckRectOnScreen(s16, s16, u32, u32); /* This object is created by HouseSignManager. It checks whether the 0x10 x 0x10 rect at field_0x80, field_0x82 is still on the screen. -If not, then it deletes itselfs and unsets the this->type2 bit in the managers field_0x20 bitfield. +If not, then it deletes itself and unsets the this->type2 bit in the managers field_0x20 bitfield. */ -void Object1C(Entity* this) { +void HouseSign(Entity* this) { if (this->action == 0) { this->action = 1; } diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index 2718a209..20664a1c 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -6,13 +6,13 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "hitbox.h" -#include "new_player.h" -#include "message.h" #include "kinstone.h" +#include "message.h" +#include "new_player.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; @@ -119,8 +119,9 @@ void ItemForSale_Action2(ItemForSaleEntity* this) { } else { ptr = sub_080784E4(); if (((*(int*)(ptr + 8) == 0) || - ((*(u8*)(ptr + 1) != 1 || (gUnk_0200AF00.unk_2f = 7, (gPlayerState.field_0x92 & 0x88) == 0)))) && - ((gPlayerState.field_0x92 & 0x98) != 0)) { + ((*(u8*)(ptr + 1) != 1 || (gUnk_0200AF00.unk_2f = 7, (gPlayerState.playerInput.field_0x92 & + (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0)))) && + ((gPlayerState.playerInput.field_0x92 & (PLAYER_INPUT_80 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0)) { sub_080819B4(this); } } diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index 55bc4208..eaf97830 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -1,14 +1,20 @@ -#include "global.h" -#include "sound.h" +/** + * @file itemOnGround.c + * @ingroup Objects + * + * @brief Item On Ground object + */ +#include "collision.h" #include "entity.h" #include "flags.h" -#include "player.h" -#include "object.h" -#include "item.h" -#include "itemMetaData.h" #include "functions.h" +#include "global.h" #include "hitbox.h" -#include "collision.h" +#include "item.h" +#include "itemMetaData.h" +#include "object.h" +#include "player.h" +#include "sound.h" void sub_08081150(Entity*); u8 sub_0808147C(u32); @@ -19,11 +25,11 @@ void sub_0808153C(Entity*); void sub_08081598(Entity*); void sub_080813BC(Entity*); void sub_080810FC(Entity*); -void sub_08080F20(Entity*); -void sub_080811EC(Entity*); -void sub_0808122C(Entity*); -void sub_08081328(Entity*); -void sub_0808136C(Entity*); +void ItemOnGround_Init(Entity*); +void ItemOnGround_Action1(Entity*); +void ItemOnGround_Action2(Entity*); +void ItemOnGround_Action3(Entity*); +void ItemOnGround_Action4(Entity*); void sub_080810A8(Entity*); void sub_080810FC(Entity*); void sub_08081150(Entity*); @@ -53,8 +59,8 @@ typedef struct { } Unk_0811E84C; void ItemOnGround(Entity* this) { - static void (*const gUnk_0811E7D4[])(Entity*) = { - sub_08080F20, sub_080811EC, sub_0808122C, sub_08081328, sub_0808136C, + static void (*const ItemOnGround_Actions[])(Entity*) = { + ItemOnGround_Init, ItemOnGround_Action1, ItemOnGround_Action2, ItemOnGround_Action3, ItemOnGround_Action4, }; if (this->contactFlags & 0x80) { switch (this->contactFlags & 0x7F) { @@ -84,7 +90,7 @@ void ItemOnGround(Entity* this) { if (sub_0806F520(this)) { sub_080813BC(this); } else { - gUnk_0811E7D4[this->action](this); + ItemOnGround_Actions[this->action](this); } if (this->type == 0x5C) { @@ -94,7 +100,7 @@ void ItemOnGround(Entity* this) { sub_08080CB4(this); } -void sub_08080F20(Entity* this) { +void ItemOnGround_Init(Entity* this) { static void (*const gUnk_0811E7E8[])(Entity*) = { sub_080810A8, sub_080810FC, sub_08081150, sub_08081134, sub_08081188, sub_080810A8, sub_080810A8, sub_080811AC, sub_080811C8, sub_080811D8, sub_080810A8, @@ -223,7 +229,7 @@ void sub_080811D8(Entity* this) { SoundReq(SFX_215); } -void sub_080811EC(Entity* this) { +void ItemOnGround_Action1(Entity* this) { if (this->field_0x68.HALF.HI != 6) { ProcessMovement2(this); } else { @@ -238,7 +244,7 @@ void sub_080811EC(Entity* this) { } } -void sub_0808122C(Entity* this) { +void ItemOnGround_Action2(Entity* this) { static void (*const gUnk_0811E814[])(Entity*) = { sub_08081248, sub_08081248, sub_0808126C, sub_0808127C, nullsub_113, sub_080812A0, sub_08081248, sub_080812A8, sub_080812E8, nullsub_510, sub_08081248, @@ -300,7 +306,7 @@ void sub_080812E8(Entity* this) { void nullsub_510(Entity* this) { } -void sub_08081328(Entity* this) { +void ItemOnGround_Action3(Entity* this) { Entity* other = this->child; if (!(other->kind == PLAYER_ITEM && other->id == 3)) { sub_08081404(this, 0); @@ -314,7 +320,7 @@ void sub_08081328(Entity* this) { } } -void sub_0808136C(Entity* this) { +void ItemOnGround_Action4(Entity* this) { if (--this->timer) { Entity* other = this->child; this->x.WORD = other->x.WORD; diff --git a/src/object/jailBars.c b/src/object/jailBars.c index ba563f9e..870ce4a2 100644 --- a/src/object/jailBars.c +++ b/src/object/jailBars.c @@ -1,27 +1,33 @@ -#include "global.h" +/** + * @file jailBars.c + * @ingroup Objects + * + * @brief Jail Bars object + */ #include "entity.h" #include "flags.h" +#include "functions.h" +#include "global.h" #include "room.h" #include "sound.h" -#include "functions.h" static void SetJailBarTiles(Entity*, u32); -void sub_080A08C4(Entity*); -void sub_080A0910(Entity*); -void sub_080A0938(Entity*); -void nullsub_127(Entity*); +void JailBars_Init(Entity*); +void JailBars_Action1(Entity*); +void JailBars_Action2(Entity*); +void JailBars_Action3(Entity*); void JailBars(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_080A08C4, - sub_080A0910, - sub_080A0938, - nullsub_127, + static void (*const JailBars_Actions[])(Entity*) = { + JailBars_Init, + JailBars_Action1, + JailBars_Action2, + JailBars_Action3, }; - actionFuncs[this->action](this); + JailBars_Actions[this->action](this); } -void sub_080A08C4(Entity* this) { +void JailBars_Init(Entity* this) { if (CheckFlags(this->field_0x86.HWORD) == 0) { this->action = 1; SetJailBarTiles(this, 0); @@ -35,7 +41,7 @@ void sub_080A08C4(Entity* this) { UpdateSpriteForCollisionLayer(this); } -void sub_080A0910(Entity* this) { +void JailBars_Action1(Entity* this) { if (CheckFlags(this->field_0x86.HWORD) != 0) { this->action = 2; SetJailBarTiles(this, 1); @@ -43,7 +49,7 @@ void sub_080A0910(Entity* this) { } } -void sub_080A0938(Entity* this) { +void JailBars_Action2(Entity* this) { GetNextFrame(this); if (this->frame & ANIM_DONE) { this->action = 3; @@ -51,7 +57,7 @@ void sub_080A0938(Entity* this) { } } -void nullsub_127(Entity* this) { +void JailBars_Action3(Entity* this) { } static void SetJailBarTiles(Entity* this, u32 arg1) { diff --git a/src/object/objectB4.c b/src/object/japaneseSubtitle.c index 32c9255a..5d66eb04 100644 --- a/src/object/objectB4.c +++ b/src/object/japaneseSubtitle.c @@ -1,31 +1,37 @@ +/** + * @file japaneseSubtitle.c + * @ingroup Objects + * + * @brief Japanese Subtitle object + */ #define NENT_DEPRECATED #include "entity.h" #include "menu.h" -#include "physics.h" #include "object.h" +#include "physics.h" extern void sub_0806FB00(Entity*, u32, u32, u32); extern bool32 sub_0806FB38(Entity*); -void ObjectB4_Type0(Entity*); -void ObjectB4_Type1(Entity*); -void ObjectB4_Type2(Entity*); -void ObjectB4_Type3(Entity*); +void JapaneseSubtitle_Type0(Entity*); +void JapaneseSubtitle_Type1(Entity*); +void JapaneseSubtitle_Type2(Entity*); +void JapaneseSubtitle_Type3(Entity*); const u16 gUnk_08124B10[] = { 0x40, 0x58, 0x68, 0x80, 0x94, 0xA8, 0xB0, 0x0 }; -void ObjectB4(Entity* this) { +void JapaneseSubtitle(Entity* this) { static void (*const typeFuncs[])(Entity*) = { - ObjectB4_Type0, - ObjectB4_Type1, - ObjectB4_Type2, - ObjectB4_Type3, + JapaneseSubtitle_Type0, + JapaneseSubtitle_Type1, + JapaneseSubtitle_Type2, + JapaneseSubtitle_Type3, }; typeFuncs[this->type]((Entity*)this); } -void ObjectB4_Type0(Entity* this) { +void JapaneseSubtitle_Type0(Entity* this) { Entity* pEVar3; switch (this->action) { @@ -43,7 +49,7 @@ void ObjectB4_Type0(Entity* this) { case 1: if ((this->subtimer < 7) && (--this->timer == 0)) { this->timer = 1; - pEVar3 = CreateObject(OBJECT_B4, 1, this->subtimer); + pEVar3 = CreateObject(JAPANESE_SUBTITLE, 1, this->subtimer); if (pEVar3 != NULL) { CopyPosition(this, pEVar3); pEVar3->y.HALF.HI = 0x68; @@ -58,7 +64,7 @@ void ObjectB4_Type0(Entity* this) { this->frameIndex = 10; this->action = 2; while (this->subtimer < 7) { - pEVar3 = CreateObject(OBJECT_B4, 1, this->subtimer); + pEVar3 = CreateObject(JAPANESE_SUBTITLE, 1, this->subtimer); if (pEVar3 != NULL) { CopyPosition(this, pEVar3); pEVar3->y.HALF.HI = 0x68; @@ -67,14 +73,14 @@ void ObjectB4_Type0(Entity* this) { this->subtimer++; } - pEVar3 = CreateObject(OBJECT_B4, 2, 0); + pEVar3 = CreateObject(JAPANESE_SUBTITLE, 2, 0); if (pEVar3 != NULL) { pEVar3->x.HALF.HI = 0xc4; pEVar3->y.HALF.HI = 0x2c; SortEntityAbove(this, pEVar3); } - pEVar3 = CreateObject(OBJECT_B4, 3, 0); + pEVar3 = CreateObject(JAPANESE_SUBTITLE, 3, 0); if (pEVar3 != NULL) { pEVar3->x.HALF.HI = 0xb4; pEVar3->y.HALF.HI = 0x19; @@ -84,7 +90,7 @@ void ObjectB4_Type0(Entity* this) { } } -void ObjectB4_Type1(Entity* this) { +void JapaneseSubtitle_Type1(Entity* this) { switch (this->action) { case 0: this->action = 1; @@ -103,7 +109,7 @@ void ObjectB4_Type1(Entity* this) { } } -void ObjectB4_Type2(Entity* this) { +void JapaneseSubtitle_Type2(Entity* this) { static const u8 gUnk_08124B30[] = { 9, 10, 11, 12, 11, 10, 9, -1 }; if (this->action == 0) { this->action = 1; @@ -126,7 +132,7 @@ void ObjectB4_Type2(Entity* this) { } } -void ObjectB4_Type3(Entity* this) { +void JapaneseSubtitle_Type3(Entity* this) { if (this->action == 0) { this->action = 1; this->spriteSettings.draw = 2; diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index 550cc6c4..04720216 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -1,27 +1,33 @@ -#include "object.h" +/** + * @file jarPortal.c + * @ingroup Objects + * + * @brief Jar Portal object + */ #include "area.h" #include "functions.h" +#include "object.h" extern u32 PortalReadyForMinish(void); u32 sub_0808C128(Entity*); void sub_0808C13C(Entity*); -void sub_0808BE9C(Entity*); -void sub_0808BF14(Entity*); -void sub_0808BF58(Entity*); -void sub_0808BFD8(Entity*); -void sub_0808C0AC(Entity*); +void JarPortal_Init(Entity*); +void JarPortal_Action1(Entity*); +void JarPortal_Action2(Entity*); +void JarPortal_Action3(Entity*); +void JarPortal_Action4(Entity*); void sub_0808C148(Entity*, u32); void sub_0808C01C(Entity*, u32); void JarPortal(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0808BE9C, sub_0808BF14, sub_0808BF58, sub_0808BFD8, sub_0808C0AC, + static void (*const JarPortal_Actions[])(Entity*) = { + JarPortal_Init, JarPortal_Action1, JarPortal_Action2, JarPortal_Action3, JarPortal_Action4, }; - actionFuncs[this->action](this); + JarPortal_Actions[this->action](this); } -void sub_0808BE9C(Entity* this) { +void JarPortal_Init(Entity* this) { COLLISION_ON(this); this->hitType = 1; this->collisionFlags = 0x47; @@ -47,7 +53,7 @@ void sub_0808BE9C(Entity* this) { } } -void sub_0808BF14(Entity* this) { +void JarPortal_Action1(Entity* this) { if (sub_0808C128(this)) { this->action++; sub_0808C13C(this); @@ -61,7 +67,7 @@ void sub_0808BF14(Entity* this) { sub_0808C01C(this, 0); } -void sub_0808BF58(Entity* this) { +void JarPortal_Action2(Entity* this) { GravityUpdate(this, Q_8_8(32.0)); switch (this->subAction) { case 0: @@ -89,7 +95,7 @@ void sub_0808BF58(Entity* this) { } } -void sub_0808BFD8(Entity* this) { +void JarPortal_Action3(Entity* this) { if (sub_0808C128(this)) { ++this->action; sub_0808C13C(this); @@ -129,7 +135,7 @@ void sub_0808C01C(Entity* this, u32 r1) { } } -void sub_0808C0AC(Entity* this) { +void JarPortal_Action4(Entity* this) { GravityUpdate(this, Q_8_8(32.0)); switch (this->subAction) { case 0: diff --git a/src/object/keyStealingTakkuri.c b/src/object/keyStealingTakkuri.c index a7c90a1f..bc4c4dd5 100644 --- a/src/object/keyStealingTakkuri.c +++ b/src/object/keyStealingTakkuri.c @@ -6,9 +6,9 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; @@ -311,7 +311,7 @@ void KeyStealingTakkuri_Type3_Action1(KeyStealingTakkuriEntity* this) { SoundReq(SFX_123); child = super->child; if (child != NULL) { - Entity* obj = CreateObject(OBJECT_96, super->type2 + 2, 0); + Entity* obj = CreateObject(GRAVEYARD_KEY, super->type2 + 2, 0); if (obj != NULL) { CopyPosition(child, obj); } diff --git a/src/object/objectB3.c b/src/object/kinstoneSpark.c index 49d5588c..9feb4c66 100644 --- a/src/object/objectB3.c +++ b/src/object/kinstoneSpark.c @@ -1,15 +1,14 @@ /** - * @file objectB3.c + * @file kinstoneSpark.c * @ingroup Objects * - * @brief ObjectB3 object + * @brief Kinstone Fusion Particle object */ - #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "kinstone.h" +#include "object.h" void sub_080A0ADC(Entity*); void sub_080A0AF0(Entity*); @@ -19,7 +18,7 @@ void sub_080A0B4C(Entity*); void sub_080A0B60(Entity*); void sub_080A0B80(Entity*); -void ObjectB3(Entity* this) { +void KinstoneSpark(Entity* this) { static void (*const gUnk_08124A10[])(Entity*) = { sub_080A0ADC, sub_080A0AF0, diff --git a/src/object/ladderHoleInBookshelf.c b/src/object/ladderHoleInBookshelf.c index 4e3cb3fb..dd55d741 100644 --- a/src/object/ladderHoleInBookshelf.c +++ b/src/object/ladderHoleInBookshelf.c @@ -1,31 +1,37 @@ +/** + * @file ladderHoleInBookshelf.c + * @ingroup Objects + * + * @brief Ladder Hole In Bookshelf object + */ #include "entity.h" #include "player.h" -void sub_08093FCC(Entity* this); -void sub_08093FE0(Entity* this); +void LadderHoleInBookshelf_Init(Entity* this); +void LadderHoleInBookshelf_Action1(Entity* this); bool32 sub_08094064(Entity* this); void LadderHoleInBookshelf(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_08093FCC, - sub_08093FE0, + static void (*const LadderHoleInBookshelf_Actions[])(Entity*) = { + LadderHoleInBookshelf_Init, + LadderHoleInBookshelf_Action1, }; - actionFuncs[this->action](this); + LadderHoleInBookshelf_Actions[this->action](this); } -void sub_08093FCC(Entity* this) { +void LadderHoleInBookshelf_Init(Entity* this) { this->action = 1; this->collisionLayer = 2; UpdateSpriteForCollisionLayer(this); } -void sub_08093FE0(Entity* this) { +void LadderHoleInBookshelf_Action1(Entity* this) { if (sub_08094064(this)) { if (this->collisionLayer == 2) { switch (gPlayerEntity.action) { - case 0x1d: - case 0x1e: + case PLAYER_CLIMB: + case PLAYER_USEENTRANCE: return; } this->collisionLayer = 1; @@ -33,8 +39,8 @@ void sub_08093FE0(Entity* this) { this->spritePriority.b0 = 5; } else { switch (gPlayerEntity.action) { - case 0x1d: - case 0x1e: + case PLAYER_CLIMB: + case PLAYER_USEENTRANCE: this->collisionLayer = 2; UpdateSpriteForCollisionLayer(this); this->spritePriority.b0 = 1; diff --git a/src/object/ladderUp.c b/src/object/ladderUp.c index e068963b..1264763e 100644 --- a/src/object/ladderUp.c +++ b/src/object/ladderUp.c @@ -1,27 +1,33 @@ +/** + * @file ladderUp.c + * @ingroup Objects + * + * @brief Ladder Up object + */ +#include "asm.h" +#include "effects.h" #include "entity.h" -#include "room.h" +#include "functions.h" #include "player.h" -#include "asm.h" +#include "room.h" #include "sound.h" -#include "functions.h" -#include "effects.h" void LadderUp(Entity* this) { Entity* fxEnt; - u32 uVar4; + u32 action; switch (this->action) { case 0: if (this->timer) { - uVar4 = 1; + action = 1; } else { #ifndef EU - uVar4 = 3; + action = 3; #else - uVar4 = 2; + action = 2; #endif } - this->action = uVar4; + this->action = action; this->spriteOffsetY += 8; InitializeAnimation(this, 10); if (this->action == 1) { @@ -74,5 +80,6 @@ void LadderUp(Entity* this) { } } } + break; } } diff --git a/src/object/lamp.c b/src/object/lamp.c index caf458ad..1992f36a 100644 --- a/src/object/lamp.c +++ b/src/object/lamp.c @@ -1,15 +1,21 @@ +/** + * @file lamp.c + * @ingroup Objects + * + * @brief Lamp object + */ #include "entity.h" void Lamp_Init(Entity* this); void Lamp_Action1(Entity* this); void Lamp(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { + static void (*const Lamp_Actions[])(Entity*) = { Lamp_Init, Lamp_Action1, }; - actionFuncs[this->action](this); + Lamp_Actions[this->action](this); } void Lamp_Init(Entity* this) { diff --git a/src/object/object45.c b/src/object/lampParticle.c index ba89d886..38f1ed64 100644 --- a/src/object/object45.c +++ b/src/object/lampParticle.c @@ -1,27 +1,33 @@ +/** + * @file lampParticle.c + * @ingroup Objects + * + * @brief LampParticle object + */ #define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "item.h" +#include "player.h" -void sub_0808E42C(Entity*); -void sub_0808E448(Entity*); +void LampParticle_Init(Entity*); +void LampParticle_Action1(Entity*); -void Object45(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0808E42C, - sub_0808E448, +void LampParticle(Entity* this) { + static void (*const LampParticle_Actions[])(Entity*) = { + LampParticle_Init, + LampParticle_Action1, }; - actionFuncs[this->action]((Entity*)this); + LampParticle_Actions[this->action]((Entity*)this); } -void sub_0808E42C(Entity* this) { +void LampParticle_Init(Entity* this) { this->action = 1; this->updatePriority = 6; InitializeAnimation(this, this->type); } -void sub_0808E448(Entity* this) { +void LampParticle_Action1(Entity* this) { if (1 < IsItemEquipped(ITEM_LANTERN_ON)) { DeleteThisEntity(); } diff --git a/src/object/lavaPlatform.c b/src/object/lavaPlatform.c index acf55a65..e7ff7da6 100644 --- a/src/object/lavaPlatform.c +++ b/src/object/lavaPlatform.c @@ -6,10 +6,10 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "hitbox.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; @@ -32,8 +32,8 @@ typedef struct { /*0x0e*/ u8 unk_e[2]; } LavaPlatformEntry; -void sub_08092278(LavaPlatformEntity*); -void sub_08092344(LavaPlatformEntity*); +void LavaPlatform_Type0(LavaPlatformEntity*); +void LavaPlatform_Type1(LavaPlatformEntity*); void LavaPlatform_SpawnPlatforms(LavaPlatformEntity*); void sub_080926E4(LavaPlatformEntity*); void sub_0809264C(LavaPlatformEntity*); @@ -53,13 +53,13 @@ void LavaPlatform_Type1Action7(LavaPlatformEntity*); void LavaPlatform(LavaPlatformEntity* this) { if (super->type == 0) { - sub_08092278(this); + LavaPlatform_Type0(this); } else { - sub_08092344(this); + LavaPlatform_Type1(this); } } -void sub_08092278(LavaPlatformEntity* this) { +void LavaPlatform_Type0(LavaPlatformEntity* this) { static void (*const LavaPlatform_Type0Actions[])(LavaPlatformEntity*) = { LavaPlatform_Type0Init, LavaPlatform_Type0Action1, @@ -100,7 +100,7 @@ void LavaPlatform_Type0Action2(LavaPlatformEntity* this) { } } -void sub_08092344(LavaPlatformEntity* this) { +void LavaPlatform_Type1(LavaPlatformEntity* this) { static void (*const LavaPlatform_Type1Actions[])(LavaPlatformEntity*) = { LavaPlatform_Type1Init, LavaPlatform_Type1Action1, LavaPlatform_Type1Action2, LavaPlatform_Type1Action3, LavaPlatform_Type1Action4, LavaPlatform_Type1Action5, LavaPlatform_Type1Action6, LavaPlatform_Type1Action7, diff --git a/src/object/object12.c b/src/object/lightDoor.c index 4784011f..5a90de45 100644 --- a/src/object/object12.c +++ b/src/object/lightDoor.c @@ -1,37 +1,37 @@ /** - * @file object12.c + * @file lightDoor.c * @ingroup Objects * - * @brief Object12 object + * @brief Light Door object */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" #include "screen.h" typedef struct { /*0x00*/ Entity base; /*0x68*/ u8 unk_68[30]; /*0x86*/ u16 unk_86; -} Object12Entity; +} LightDoorEntity; -void Object12_Init(Object12Entity*); -void Object12_Action1(Object12Entity*); -void Object12_Action2(Object12Entity*); -void Object12_Action3(Object12Entity*); -void Object12_Action4(Object12Entity*); -void sub_080850FC(Object12Entity*); +void LightDoor_Init(LightDoorEntity*); +void LightDoor_Action1(LightDoorEntity*); +void LightDoor_Action2(LightDoorEntity*); +void LightDoor_Action3(LightDoorEntity*); +void LightDoor_Action4(LightDoorEntity*); +void sub_080850FC(LightDoorEntity*); -void Object12(Object12Entity* this) { - static void (*const Object12_Actions[])(Object12Entity*) = { - Object12_Init, Object12_Action1, Object12_Action2, Object12_Action3, Object12_Action4, +void LightDoor(LightDoorEntity* this) { + static void (*const LightDoor_Actions[])(LightDoorEntity*) = { + LightDoor_Init, LightDoor_Action1, LightDoor_Action2, LightDoor_Action3, LightDoor_Action4, }; - Object12_Actions[super->action](this); + LightDoor_Actions[super->action](this); } -void Object12_Init(Object12Entity* this) { +void LightDoor_Init(LightDoorEntity* this) { if (super->type == 0) { if (CheckFlags(this->unk_86)) { DeleteThisEntity(); @@ -48,10 +48,10 @@ void Object12_Init(Object12Entity* this) { super->frameIndex = 0; } -void Object12_Action1(Object12Entity* this) { +void LightDoor_Action1(LightDoorEntity* this) { } -void Object12_Action2(Object12Entity* this) { +void LightDoor_Action2(LightDoorEntity* this) { u32 tmp; u32 tmp2; if (--super->timer == 0) { @@ -72,14 +72,14 @@ void Object12_Action2(Object12Entity* this) { } } -void Object12_Action3(Object12Entity* this) { +void LightDoor_Action3(LightDoorEntity* this) { if (--super->timer == 0) { super->action = 4; super->timer = 96; } } -void Object12_Action4(Object12Entity* this) { +void LightDoor_Action4(LightDoorEntity* this) { LinearMoveUpdate(super); if (--super->timer == 0) { gScreen.lcd.displayControl &= 0xdfff; @@ -87,7 +87,7 @@ void Object12_Action4(Object12Entity* this) { } } -void sub_080850FC(Object12Entity* this) { +void sub_080850FC(LightDoorEntity* this) { u32 position = COORD_TO_TILE(super); u32 layer = super->collisionLayer; SetTile(0x403d, position - 0x41, layer); diff --git a/src/object/object8E.c b/src/object/lightRay.c index 0a7fc70f..4aae9aac 100644 --- a/src/object/object8E.c +++ b/src/object/lightRay.c @@ -1,40 +1,39 @@ /** - * @file object8E.c + * @file lightRay.c * @ingroup Objects * - * @brief Object8E object + * @brief Light Ray object */ - #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" #include "screen.h" typedef struct { /*0x00*/ Entity base; /*0x68*/ u16 unk_68; /*0x6a*/ u16 unk_6a; -} Object8EEntity; +} LightRayEntity; extern void sub_0805AAF0(u32); -void sub_0809B97C(Object8EEntity*, u32); -bool32 sub_0809BE78(Object8EEntity*); -void Object8E_Type0(Object8EEntity*); -void Object8E_Type1(Object8EEntity*); -void Object8E_Type2(Object8EEntity*); -void Object8E_Type3(Object8EEntity*); -void Object8E_Type4(Object8EEntity*); +void sub_0809B97C(LightRayEntity*, u32); +bool32 sub_0809BE78(LightRayEntity*); +void LightRay_Type0(LightRayEntity*); +void LightRay_Type1(LightRayEntity*); +void LightRay_Type2(LightRayEntity*); +void LightRay_Type3(LightRayEntity*); +void LightRay_Type4(LightRayEntity*); -void Object8E(Object8EEntity* this) { - static void (*const Object8E_Types[])(Object8EEntity*) = { - Object8E_Type0, Object8E_Type1, Object8E_Type2, Object8E_Type3, Object8E_Type4, +void LightRay(LightRayEntity* this) { + static void (*const LightRay_Types[])(LightRayEntity*) = { + LightRay_Type0, LightRay_Type1, LightRay_Type2, LightRay_Type3, LightRay_Type4, }; - Object8E_Types[super->type](this); + LightRay_Types[super->type](this); } -void Object8E_Type0(Object8EEntity* this) { +void LightRay_Type0(LightRayEntity* this) { u32 tmp; RequestPriorityDuration(super, 30); switch (super->action) { @@ -85,7 +84,7 @@ void Object8E_Type0(Object8EEntity* this) { } } -void sub_0809B97C(Object8EEntity* this, u32 param_2) { +void sub_0809B97C(LightRayEntity* this, u32 param_2) { s32 tmp1; s32 tmp2; @@ -107,7 +106,7 @@ void sub_0809B97C(Object8EEntity* this, u32 param_2) { gScreen.controls.window0HorizontalDimensions = (tmp1 << 8) | tmp2; } -void Object8E_Type1(Object8EEntity* this) { +void LightRay_Type1(LightRayEntity* this) { u32 tmp; RequestPriorityDuration(super, 30); @@ -158,7 +157,7 @@ void Object8E_Type1(Object8EEntity* this) { } } -void Object8E_Type2(Object8EEntity* this) { +void LightRay_Type2(LightRayEntity* this) { u32 tmp; RequestPriorityDuration(super, 10); @@ -190,7 +189,7 @@ void Object8E_Type2(Object8EEntity* this) { SoundReq(SFX_133); } if ((gRoomTransition.frameCount & 1U) == 0) { - gScreen.controls.window0HorizontalDimensions += 1; + gScreen.controls.window0HorizontalDimensions++; } } else { super->action = 2; @@ -228,7 +227,7 @@ void Object8E_Type2(Object8EEntity* this) { } } -void Object8E_Type3(Object8EEntity* this) { +void LightRay_Type3(LightRayEntity* this) { u32 tmp; RequestPriorityDuration(super, 30); @@ -285,7 +284,7 @@ void Object8E_Type3(Object8EEntity* this) { } } -void Object8E_Type4(Object8EEntity* this) { +void LightRay_Type4(LightRayEntity* this) { u32 tmp; RequestPriorityDuration(super, 30); switch (super->action) { @@ -327,7 +326,7 @@ void Object8E_Type4(Object8EEntity* this) { } } -bool32 sub_0809BE78(Object8EEntity* this) { +bool32 sub_0809BE78(LightRayEntity* this) { bool32 result = FALSE; if (this->unk_68 == gRoomControls.scroll_x && this->unk_6a == gRoomControls.scroll_y) { result = TRUE; diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c index a49b4b37..ba0ba466 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -1,43 +1,49 @@ -#include "global.h" +/** + * @file lightableSwitch.c + * @ingroup Objects + * + * @brief Lightable Switch object + */ #include "asm.h" -#include "sound.h" #include "entity.h" -#include "room.h" #include "flags.h" #include "functions.h" +#include "global.h" #include "hitbox.h" #include "object.h" +#include "room.h" +#include "sound.h" static void sub_0809EB30(Entity*); static void sub_0809EAD8(Entity*); static void sub_0809EABC(Entity*); -static void sub_0809EA1C(Entity*); -static void sub_0809EB68(Entity*); -static void sub_0809EA34(Entity*); -static void sub_0809EA80(Entity*); -static void nullsub_126(Entity*); -static void sub_0809EC08(Entity*); -static void sub_0809EBD8(Entity*); -static void sub_0809EB80(Entity*); +static void LightableSwitch_Type0(Entity*); +static void LightableSwitch_Type1(Entity*); +static void LightableSwitch_Type0_Init(Entity*); +static void LightableSwitch_Type0_Action1(Entity*); +static void LightableSwitch_Type1_Action3(Entity*); +static void LightableSwitch_Type1_Action2(Entity*); +static void LightableSwitch_Type1_Action1(Entity*); +static void LightableSwitch_Type1_Init(Entity*); void LightableSwitch(Entity* this) { - static void (*const typeFuncs[])(Entity*) = { - sub_0809EA1C, - sub_0809EB68, + static void (*const LightableSwitch_Types[])(Entity*) = { + LightableSwitch_Type0, + LightableSwitch_Type1, }; - typeFuncs[this->type](this); + LightableSwitch_Types[this->type](this); sub_0809EB30(this); } -void sub_0809EA1C(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0809EA34, - sub_0809EA80, +void LightableSwitch_Type0(Entity* this) { + static void (*const LightableSwitch_Type0_Actions[])(Entity*) = { + LightableSwitch_Type0_Init, + LightableSwitch_Type0_Action1, }; - actionFuncs[this->action](this); + LightableSwitch_Type0_Actions[this->action](this); } -void sub_0809EA34(Entity* this) { +void LightableSwitch_Type0_Init(Entity* this) { this->action = 1; COLLISION_ON(this); this->frameIndex = 0; @@ -51,7 +57,7 @@ void sub_0809EA34(Entity* this) { sub_0809EABC(this); } -void sub_0809EA80(Entity* this) { +void LightableSwitch_Type0_Action1(Entity* this) { if ((this->contactFlags & 0x80) != 0) { if (CheckFlags(this->field_0x86.HWORD) != 0) { @@ -104,17 +110,17 @@ static void sub_0809EB30(Entity* this) { } } -void sub_0809EB68(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0809EB80, - sub_0809EBD8, - sub_0809EC08, - nullsub_126, +void LightableSwitch_Type1(Entity* this) { + static void (*const LightableSwitch_Type1_Actions[])(Entity*) = { + LightableSwitch_Type1_Init, + LightableSwitch_Type1_Action1, + LightableSwitch_Type1_Action2, + LightableSwitch_Type1_Action3, }; - actionFuncs[this->action](this); + LightableSwitch_Type1_Actions[this->action](this); } -void sub_0809EB80(Entity* this) { +void LightableSwitch_Type1_Init(Entity* this) { this->action = 1; COLLISION_ON(this); @@ -132,7 +138,7 @@ void sub_0809EB80(Entity* this) { } } -void sub_0809EBD8(Entity* this) { +void LightableSwitch_Type1_Action1(Entity* this) { if ((this->contactFlags & 0x80) != 0) { this->action = 2; this->timer = 16; @@ -142,7 +148,7 @@ void sub_0809EBD8(Entity* this) { } } -void sub_0809EC08(Entity* this) { +void LightableSwitch_Type1_Action2(Entity* this) { if (CheckFlags(this->cutsceneBeh.HWORD) != 0) { this->action = 3; @@ -157,5 +163,5 @@ void sub_0809EC08(Entity* this) { } } -void nullsub_126(Entity* this) { +void LightableSwitch_Type1_Action3(Entity* this) { } diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 866fa2cc..a36f8277 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -1,11 +1,10 @@ +#define NENT_DEPRECATED /** * @file lilypadLarge.c * @ingroup Objects * * @brief Large Lilypad object */ - -#define NENT_DEPRECATED #include "global.h" #include "area.h" #include "functions.h" @@ -381,7 +380,7 @@ void sub_08085A98(LilypadLargeEntity* this) { super->z.HALF.HI = 0xffc0; this->unk_82 = 0xf; } - CreateObjectWithParent(super, OBJECT_2B, 0, 0); + CreateObjectWithParent(super, LILYPAD_LARGE_FALLING, 0, 0); SoundReq(SFX_12D); } } diff --git a/src/object/lilypadLargeFalling.c b/src/object/lilypadLargeFalling.c new file mode 100644 index 00000000..4a918c59 --- /dev/null +++ b/src/object/lilypadLargeFalling.c @@ -0,0 +1,28 @@ +/** + * @file lilypadLargeFalling.c + * @ingroup Objects + * + * @brief LilypadLargeFalling object + */ +#include "entity.h" +#include "functions.h" +#include "global.h" + +void LilypadLargeFalling(Entity* this) { + Entity* parent; + + if (this->action == 0) { + this->action = 1; + this->z.WORD = 0; + this->spriteRendering.b3 = 3; + InitializeAnimation(this, 9); + } + + parent = this->parent; + if (parent->z.WORD == 0) { + DeleteThisEntity(); + } else { + int position = 0x120 - parent->z.HALF.HI; + SetAffineInfo(this, position, position, parent->field_0x7c.HALF_U.HI); + } +} diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c index 55ec8dff..d017b1d9 100644 --- a/src/object/lilypadSmall.c +++ b/src/object/lilypadSmall.c @@ -1,5 +1,11 @@ -#include "object.h" +/** + * @file lilypadSmall.c + * @ingroup Objects + * + * @brief Lilypad Small object + */ #include "functions.h" +#include "object.h" static void sub_08097B24(Entity* this); static bool32 CheckMovePlayer(Entity* this); diff --git a/src/object/objectC1.c b/src/object/linkAnimation.c index 454fd432..fa76b9dc 100644 --- a/src/object/objectC1.c +++ b/src/object/linkAnimation.c @@ -1,15 +1,14 @@ /** - * @file objectC1.c + * @file linkAnimation.c * @ingroup Objects * - * @brief ObjectC1 object + * @brief Link Animation object */ - #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "message.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; @@ -23,36 +22,38 @@ typedef struct { /*0x6f*/ u8 unk_6f; /*0x70*/ u32 unk_70; /*0x74*/ u8 unk_74; -} ObjectC1Entity; +} LinkAnimationEntity; -void ObjectC1_Init(ObjectC1Entity*); -void ObjectC1_Action1(ObjectC1Entity*); -void ObjectC1_Action8(ObjectC1Entity*); +void LinkAnimation_Init(LinkAnimationEntity*); +void LinkAnimation_Action1(LinkAnimationEntity*); +void LinkAnimation_Action8(LinkAnimationEntity*); -void ObjectC1(ObjectC1Entity* this) { - static void (*const ObjectC1_Actions[])(ObjectC1Entity*) = { - ObjectC1_Init, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, - ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action8, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, - ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, - ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, - ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, ObjectC1_Action1, - ObjectC1_Action1, ObjectC1_Action1, +void LinkAnimation(LinkAnimationEntity* this) { + static void (*const LinkAnimation_Actions[])(LinkAnimationEntity*) = { + LinkAnimation_Init, LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, + LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, + LinkAnimation_Action8, LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, + LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, + LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, + LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, + LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, + LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, LinkAnimation_Action1, }; - ObjectC1_Actions[super->action](this); + LinkAnimation_Actions[super->action](this); } -void ObjectC1_Init(ObjectC1Entity* this) { +void LinkAnimation_Init(LinkAnimationEntity* this) { super->action = 8; - ObjectC1_Action8(this); + LinkAnimation_Action8(this); } -void ObjectC1_Action1(ObjectC1Entity* this) { +void LinkAnimation_Action1(LinkAnimationEntity* this) { ResetPlayerEventPriority(); gPauseMenuOptions.disabled = 0; DeleteThisEntity(); } -void ObjectC1_Action8(ObjectC1Entity* this) { +void LinkAnimation_Action8(LinkAnimationEntity* this) { u32 one; u32 tmp; Entity* parent; diff --git a/src/object/object68.c b/src/object/linkEmptyingBottle.c index c0878931..8c8b4ac7 100644 --- a/src/object/object68.c +++ b/src/object/linkEmptyingBottle.c @@ -1,38 +1,38 @@ /** - * @file object68.c + * @file linkEmptyingBottle.c * @ingroup Objects * - * @brief Object68 object + * @brief Link Emptying Bottle object * Handles effects of using water, mineral water or a fairy in a bottle in PlayerItemBottle_UseOther. */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "item.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; /*0x68*/ u8 unk_68; -} Object68Entity; +} LinkEmptyingBottleEntity; extern u32 sub_080B1A0C(Entity*, s32, s32); -void sub_08094774(Object68Entity*); -void sub_080948D0(Object68Entity*); -void sub_080948E8(Object68Entity*); -void sub_08094980(Object68Entity*, u32, u32); +void sub_08094774(LinkEmptyingBottleEntity*); +void sub_080948D0(LinkEmptyingBottleEntity*); +void sub_080948E8(LinkEmptyingBottleEntity*); +void sub_08094980(LinkEmptyingBottleEntity*, u32, u32); -void Object68(Object68Entity* this) { - static void (*const gUnk_08122A10[])(Object68Entity*) = { +void LinkEmptyingBottle(LinkEmptyingBottleEntity* this) { + static void (*const gUnk_08122A10[])(LinkEmptyingBottleEntity*) = { sub_08094774, sub_080948D0, }; gUnk_08122A10[super->action](this); } -void sub_08094774(Object68Entity* this) { +void sub_08094774(LinkEmptyingBottleEntity* this) { static const s8 gUnk_08122A18[] = { 0, -8, 8, 1, 2, 8, -8, 1 }; Entity* effect; Entity* child; @@ -79,15 +79,15 @@ void sub_08094774(Object68Entity* this) { DeleteThisEntity(); } -void sub_080948D0(Object68Entity* this) { - static void (*const gUnk_08122A20[])(Object68Entity*) = { +void sub_080948D0(LinkEmptyingBottleEntity* this) { + static void (*const gUnk_08122A20[])(LinkEmptyingBottleEntity*) = { NULL, sub_080948E8, }; gUnk_08122A20[super->type](this); } -void sub_080948E8(Object68Entity* this) { +void sub_080948E8(LinkEmptyingBottleEntity* this) { if (super->timer < 0x3c) { super->z.WORD -= Q_16_16(0.25); if ((super->timer & 3) == 0) { @@ -108,7 +108,7 @@ void sub_080948E8(Object68Entity* this) { } } -void sub_08094980(Object68Entity* this, u32 searchTileIndex, u32 replaceTileIndex) { +void sub_08094980(LinkEmptyingBottleEntity* this, u32 searchTileIndex, u32 replaceTileIndex) { static const s8 gUnk_08122A28[] = { 0, 0, -8, 0, 8, 0, 0, 8, 0, -8, 0, 0, }; diff --git a/src/object/object42.c b/src/object/linkFire.c index e75d74c9..c67b6c45 100644 --- a/src/object/object42.c +++ b/src/object/linkFire.c @@ -1,31 +1,30 @@ /** - * @file object42.c + * @file linkFire.c * @ingroup Objects * - * @brief Object42 object + * @brief Link Fire object */ - #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; /*0x68*/ u8 unk_68[4]; /*0x6c*/ u16 unk_6c; -} Object42Entity; +} LinkFireEntity; -void sub_0808DDB4(Object42Entity*); -void sub_0808DDE0(Object42Entity*); -void sub_0808DDE8(Object42Entity*); +void sub_0808DDB4(LinkFireEntity*); +void sub_0808DDE0(LinkFireEntity*); +void sub_0808DDE8(LinkFireEntity*); -void Object42(Object42Entity* this) { - static void (*const gUnk_081217A8[])(Object42Entity*) = { +void LinkFire(LinkFireEntity* this) { + static void (*const gUnk_081217A8[])(LinkFireEntity*) = { sub_0808DDB4, sub_0808DDE0, }; - static void (*const gUnk_081217B0[])(Object42Entity*) = { + static void (*const gUnk_081217B0[])(LinkFireEntity*) = { sub_0808DDB4, sub_0808DDE8, }; @@ -36,7 +35,7 @@ void Object42(Object42Entity* this) { } } -void sub_0808DDB4(Object42Entity* this) { +void sub_0808DDB4(LinkFireEntity* this) { super->action = 1; if (super->type != 0) { super->timer = 120; @@ -46,11 +45,11 @@ void sub_0808DDB4(Object42Entity* this) { } } -void sub_0808DDE0(Object42Entity* this) { +void sub_0808DDE0(LinkFireEntity* this) { DeleteThisEntity(); } -void sub_0808DDE8(Object42Entity* this) { +void sub_0808DDE8(LinkFireEntity* this) { static const s8 gUnk_081217B8[] = { 0, -6, 0, 6 }; Entity* player; this->unk_6c--; diff --git a/src/object/objectB.c b/src/object/linkHoldingItem.c index c2681b4a..7f536b5f 100644 --- a/src/object/objectB.c +++ b/src/object/linkHoldingItem.c @@ -1,24 +1,23 @@ /** - * @file objectB.c + * @file linkHoldingItem.c * @ingroup Objects * - * @brief ObjectB object + * @brief Link Holding Item object */ - #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "game.h" +#include "global.h" +#include "item.h" #include "itemMetaData.h" #include "message.h" +#include "object.h" #include "save.h" -#include "game.h" -#include "item.h" typedef struct { /*0x00*/ Entity base; /*0x68*/ u16 unk_68; -} ObjectBEntity; +} LinkHoldingItemEntity; typedef struct { u8 unk_0[6]; @@ -26,16 +25,17 @@ typedef struct { } struct_080FD964; extern const struct_080FD964 gUnk_080FD964[]; -void ObjectB_Init(ObjectBEntity*); -void ObjectB_Action1(ObjectBEntity*); -void ObjectB_Action2(ObjectBEntity*); -void ObjectB_Action3(ObjectBEntity*); +void LinkHoldingItem_Init(LinkHoldingItemEntity*); +void LinkHoldingItem_Action1(LinkHoldingItemEntity*); +void LinkHoldingItem_Action2(LinkHoldingItemEntity*); +void LinkHoldingItem_Action3(LinkHoldingItemEntity*); -void ObjectB(ObjectBEntity* this) { - static void (*const ObjectB_Actions[])(ObjectBEntity*) = { ObjectB_Init, ObjectB_Action1, ObjectB_Action2, - ObjectB_Action3 }; +void LinkHoldingItem(LinkHoldingItemEntity* this) { + static void (*const LinkHoldingItem_Actions[])(LinkHoldingItemEntity*) = { + LinkHoldingItem_Init, LinkHoldingItem_Action1, LinkHoldingItem_Action2, LinkHoldingItem_Action3 + }; u32 tmp; - ObjectB_Actions[super->action](this); + LinkHoldingItem_Actions[super->action](this); tmp = (super->parent->frame >> 6); super->spriteSettings.draw = tmp & 1; sub_08080CB4(super); @@ -44,12 +44,12 @@ void ObjectB(ObjectBEntity* this) { super->spriteRendering.b3 = 0; } -void ObjectB_Init(ObjectBEntity* this) { +void LinkHoldingItem_Init(LinkHoldingItemEntity* this) { SetDefaultPriority(super, 6); super->action = 1; } -void ObjectB_Action1(ObjectBEntity* this) { +void LinkHoldingItem_Action1(LinkHoldingItemEntity* this) { u32 tmp; const ItemMetaData* ptr; @@ -93,7 +93,7 @@ void ObjectB_Action1(ObjectBEntity* this) { } } -void ObjectB_Action2(ObjectBEntity* this) { +void LinkHoldingItem_Action2(LinkHoldingItemEntity* this) { u32 messageIndex; if ((super->parent)->frame == 0x42) { super->action = 3; @@ -129,7 +129,7 @@ void ObjectB_Action2(ObjectBEntity* this) { } } -void ObjectB_Action3(ObjectBEntity* this) { +void LinkHoldingItem_Action3(LinkHoldingItemEntity* this) { u32 tmp; if ((super->parent)->action == 8) { return; diff --git a/src/object/litArea.c b/src/object/litArea.c index 0c915d6a..74c14e5b 100644 --- a/src/object/litArea.c +++ b/src/object/litArea.c @@ -1,8 +1,14 @@ +/** + * @file litArea.c + * @ingroup Objects + * + * @brief Lit Area object + */ #include "entity.h" -#include "room.h" -#include "screen.h" #include "flags.h" #include "functions.h" +#include "room.h" +#include "screen.h" void LitArea(Entity* this) { if (this->action == 0) { diff --git a/src/object/lockedDoor.c b/src/object/lockedDoor.c index 71f87df5..eff9e1c2 100644 --- a/src/object/lockedDoor.c +++ b/src/object/lockedDoor.c @@ -1,23 +1,29 @@ -#include "global.h" +/** + * @file lookedDoor.c + * @ingroup Objects + * + * @brief Looked Door object + */ #include "asm.h" +#include "common.h" +#include "effects.h" #include "entity.h" #include "flags.h" -#include "sound.h" #include "functions.h" -#include "effects.h" #include "game.h" -#include "common.h" +#include "global.h" #include "hitbox.h" +#include "sound.h" -void sub_08083338(Entity*); -void sub_080834B4(Entity*); -void sub_080834EC(Entity*); -void sub_08083518(Entity*); -void sub_08083540(Entity*); -void nullsub_513(Entity*); -void sub_08083598(Entity*); -void sub_080835C8(Entity*); -void sub_080835F8(Entity*); +void LockedDoor_Init(Entity*); +void LockedDoor_Action1(Entity*); +void LockedDoor_Action2(Entity*); +void LockedDoor_Action3(Entity*); +void LockedDoor_Action4(Entity*); +void LockedDoor_Action5(Entity*); +void LockedDoor_Action6(Entity*); +void LockedDoor_Action7(Entity*); +void LockedDoor_Action8(Entity*); void sub_08083638(Entity*); void sub_08083658(Entity*); @@ -27,13 +33,13 @@ u32 sub_08083734(Entity*, u32); u32 sub_080837B0(Entity*); void sub_08083814(Entity*, u32); -void (*const gUnk_0811F65C[])(Entity*) = { - sub_08083338, sub_080834B4, sub_080834EC, sub_08083518, sub_08083540, - nullsub_513, sub_08083598, sub_080835C8, sub_080835F8, +void (*const LockedDoor_Actions[])(Entity*) = { + LockedDoor_Init, LockedDoor_Action1, LockedDoor_Action2, LockedDoor_Action3, LockedDoor_Action4, + LockedDoor_Action5, LockedDoor_Action6, LockedDoor_Action7, LockedDoor_Action8, }; void LockedDoor(Entity* this) { - gUnk_0811F65C[this->action](this); + LockedDoor_Actions[this->action](this); } typedef struct PACKED { @@ -82,7 +88,7 @@ const u8 gUnk_0811F740[] = { 0xD7, }; -void sub_08083338(Entity* this) { +void LockedDoor_Init(Entity* this) { if (this->cutsceneBeh.HWORD != 0xFFFF && CheckFlags(this->cutsceneBeh.HWORD)) { DeleteThisEntity(); } @@ -140,7 +146,7 @@ void sub_08083338(Entity* this) { } } -void sub_080834B4(Entity* this) { +void LockedDoor_Action1(Entity* this) { if (--this->timer == 0) { this->action = 2; this->timer = 7; @@ -149,7 +155,7 @@ void sub_080834B4(Entity* this) { } } -void sub_080834EC(Entity* this) { +void LockedDoor_Action2(Entity* this) { LinearMoveUpdate(this); if (--this->timer == 0) { if (this->type & 0x80) { @@ -160,14 +166,14 @@ void sub_080834EC(Entity* this) { } } -void sub_08083518(Entity* this) { +void LockedDoor_Action3(Entity* this) { if (sub_08083734(this, this->field_0x7c.BYTES.byte2)) { this->action = 4; sub_080836DC(this, this->field_0x7c.BYTES.byte2, this->field_0x76.HWORD); } } -void sub_08083540(Entity* this) { +void LockedDoor_Action4(Entity* this) { LinearMoveUpdate(this); if (!--this->timer) { if (this->type & 0x10) { @@ -185,10 +191,10 @@ void sub_08083540(Entity* this) { } } -void nullsub_513(Entity* this) { +void LockedDoor_Action5(Entity* this) { } -void sub_08083598(Entity* this) { +void LockedDoor_Action6(Entity* this) { if (this->type2 == 0) { if (!CheckFlags(this->field_0x86.HWORD)) return; @@ -199,7 +205,7 @@ void sub_08083598(Entity* this) { sub_08083658(this); } -void sub_080835C8(Entity* this) { +void LockedDoor_Action7(Entity* this) { if (this->type2 == 0) { if (CheckFlags(this->field_0x86.HWORD)) return; @@ -210,7 +216,7 @@ void sub_080835C8(Entity* this) { this->action = 3; } -void sub_080835F8(Entity* this) { +void LockedDoor_Action8(Entity* this) { if (this->interactType == 0 && !CheckFlags(this->field_0x86.HWORD)) return; this->action = 1; diff --git a/src/object/macroAcorn.c b/src/object/macroAcorn.c index 0f34165b..c52f503d 100644 --- a/src/object/macroAcorn.c +++ b/src/object/macroAcorn.c @@ -1,20 +1,26 @@ +/** + * @file macroAcorn.c + * @ingroup Objects + * + * @brief Macro Acorn object + */ #include "entity.h" -#include "physics.h" #include "object.h" +#include "physics.h" -void sub_0809E518(Entity*); -void nullsub_125(Entity*); +void MacroAcorn_Init(Entity*); +void MacroAcorn_Action1(Entity*); void sub_0809E5F0(Entity*); void MacroAcorn(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0809E518, - nullsub_125, + static void (*const MacroAcorn_Actions[])(Entity*) = { + MacroAcorn_Init, + MacroAcorn_Action1, }; - actionFuncs[this->action](this); + MacroAcorn_Actions[this->action](this); } -void sub_0809E518(Entity* this) { +void MacroAcorn_Init(Entity* this) { u32 bVar2; Entity* pEVar3; @@ -54,7 +60,7 @@ void sub_0809E518(Entity* this) { } } -void nullsub_125(Entity* this) { +void MacroAcorn_Action1(Entity* this) { } void sub_0809E5F0(Entity* this) { diff --git a/src/object/macroBook.c b/src/object/macroBook.c index d42f4c6d..59f025a4 100644 --- a/src/object/macroBook.c +++ b/src/object/macroBook.c @@ -1,8 +1,14 @@ +/** + * @file macroBook.c + * @ingroup Objects + * + * @brief Macro Book object + */ #define NENT_DEPRECATED +#include "asm.h" #include "entity.h" -#include "functions.h" #include "flags.h" -#include "asm.h" +#include "functions.h" #include "npc.h" typedef struct { diff --git a/src/object/macroDecorations.c b/src/object/macroDecorations.c index d1e6038b..f68ce765 100644 --- a/src/object/macroDecorations.c +++ b/src/object/macroDecorations.c @@ -1,7 +1,13 @@ +/** + * @file macroDecoration.c + * @ingroup Objects + * + * @brief Macro Decoration object + */ #define NENT_DEPRECATED +#include "asm.h" #include "entity.h" #include "room.h" -#include "asm.h" typedef struct { Entity base; @@ -9,22 +15,22 @@ typedef struct { s16 y2; } MacroDecorationEntity; -void sub_08097DEC(MacroDecorationEntity*); -void sub_08097EA4(MacroDecorationEntity*); +void MacroDecoration_Init(MacroDecorationEntity*); +void MacroDecoration_Action1(MacroDecorationEntity*); void sub_08097EB8(MacroDecorationEntity*); void sub_08097F34(MacroDecorationEntity*); void sub_08097F10(MacroDecorationEntity*); s32 sub_08097F60(MacroDecorationEntity*, s32); void MacroDecoration(Entity* this) { - static void (*const actionFuncs[])(MacroDecorationEntity*) = { - sub_08097DEC, - sub_08097EA4, + static void (*const MacroDecoration_Actions[])(MacroDecorationEntity*) = { + MacroDecoration_Init, + MacroDecoration_Action1, }; - actionFuncs[this->action]((MacroDecorationEntity*)this); + MacroDecoration_Actions[this->action]((MacroDecorationEntity*)this); } -void sub_08097DEC(MacroDecorationEntity* this) { +void MacroDecoration_Init(MacroDecorationEntity* this) { u32 bVar1; u32 uVar2; @@ -68,7 +74,7 @@ void sub_08097DEC(MacroDecorationEntity* this) { sub_08097F34(this); } -void sub_08097EA4(MacroDecorationEntity* this) { +void MacroDecoration_Action1(MacroDecorationEntity* this) { if (super->type) { sub_08097F10(this); } diff --git a/src/object/macroMushroomStalks.c b/src/object/macroMushroomStalk.c index d5a575ec..45eb8fe0 100644 --- a/src/object/macroMushroomStalks.c +++ b/src/object/macroMushroomStalk.c @@ -1,45 +1,51 @@ -#include "entity.h" +/** + * @file macroMushroomStalk.c + * @ingroup Objects + * + * @brief Macro Mushroom Stalk object + */ #include "area.h" +#include "entity.h" #include "main.h" -#include "sound.h" #include "object.h" +#include "sound.h" -void sub_0808C964(Entity*); -void sub_0808CA10(Entity*); +void MacroMushroomStalk_Init(Entity*); +void MacroMushroomStalk_Action1(Entity*); static const s16 gUnk_08121648[] = { 264, 252, 256, 256, 248, 260, 240, 264, 248, 260, 256, 256, 264, 252, 272, 248 }; -void MacroMushroomStalks(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0808C964, - sub_0808CA10, +void MacroMushroomStalk(Entity* this) { + static void (*const MacroMushroomStalk_Actions[])(Entity*) = { + MacroMushroomStalk_Init, + MacroMushroomStalk_Action1, }; - actionFuncs[this->action](this); + MacroMushroomStalk_Actions[this->action](this); } -void Object75(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0808C964, - sub_0808CA10, +void MacroCrystal(Entity* this) { + static void (*const MacroMushroomStalk_Actions[])(Entity*) = { + MacroMushroomStalk_Init, + MacroMushroomStalk_Action1, }; - actionFuncs[this->action](this); + MacroMushroomStalk_Actions[this->action](this); } -void Object76(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0808C964, - sub_0808CA10, +void MacroLeaf(Entity* this) { + static void (*const MacroMushroomStalk_Actions[])(Entity*) = { + MacroMushroomStalk_Init, + MacroMushroomStalk_Action1, }; - actionFuncs[this->action](this); + MacroMushroomStalk_Actions[this->action](this); } -void sub_0808C964(Entity* this) { +void MacroMushroomStalk_Init(Entity* this) { u32 uVar1; this->frameIndex = this->type; - if ((this->id == OBJECT_76) && (gUI.roomControls.area != AREA_HYRULE_TOWN)) { + if ((this->id == MACRO_LEAF) && (gUI.roomControls.area != AREA_HYRULE_TOWN)) { this->type -= 9; } if (4 < this->type) { @@ -52,7 +58,7 @@ void sub_0808C964(Entity* this) { this->spriteOrientation.flipY = 2; this->spriteRendering.b3 = 2; this->spritePriority.b0 = this->type2; - if (this->id != OBJECT_75 && (u8)(this->type - 1) < 3) { + if (this->id != MACRO_CRYSTAL && (u8)(this->type - 1) < 3) { this->spriteRendering.b0 = 3; if (this->type == 1) { uVar1 = 0xe0; @@ -63,7 +69,7 @@ void sub_0808C964(Entity* this) { } } -void sub_0808CA10(Entity* this) { +void MacroMushroomStalk_Action1(Entity* this) { s32 sVar3; s32 sVar5; @@ -91,7 +97,7 @@ void sub_0808CA10(Entity* this) { break; } - if ((this->id != OBJECT_75 && ((u8)(this->type - 1) < 3)) && this->timer != 0) { + if ((this->id != MACRO_CRYSTAL && ((u8)(this->type - 1) < 3)) && this->timer != 0) { this->timer--; this->subtimer++; if (this->timer != 0) { diff --git a/src/object/macroPlayer.c b/src/object/macroPlayer.c index 690196b1..71a2eb9b 100644 --- a/src/object/macroPlayer.c +++ b/src/object/macroPlayer.c @@ -1,9 +1,15 @@ +/** + * @file macroPlayer.c + * @ingroup Objects + * + * @brief Macro Player object + */ #define NENT_DEPRECATED +#include "area.h" #include "entity.h" -#include "physics.h" #include "functions.h" #include "object.h" -#include "area.h" +#include "physics.h" typedef struct { Entity base; @@ -199,7 +205,7 @@ void MacroPlayer_Type0_Action6(MacroPlayerEntity* this) { if (--super->timer == 0) { uVar2 = gArea.portal_exit_dir; - super->action += 1; + super->action++; super->action += uVar2; super->animationState = gUnk_081216B4[uVar2 * 2]; super->direction = gUnk_081216B4[uVar2 * 2 + 1]; diff --git a/src/object/macroShoe.c b/src/object/macroShoe.c new file mode 100644 index 00000000..2d4b5ac2 --- /dev/null +++ b/src/object/macroShoe.c @@ -0,0 +1,49 @@ +/** + * @file macroShoe.c + * @ingroup Objects + * + * @brief Macro Shoe object + */ +#include "asm.h" +#include "entity.h" + +void MacroShoe_Init(Entity*); +void MacroShoe_Idle(Entity*); + +static const Hitbox MacroShoe_Type0Hitbox; +static const Hitbox MacroShoe_Type1Hitbox; + +static const Hitbox* const MacroShoe_TypeHitboxes[] = { + &MacroShoe_Type0Hitbox, + &MacroShoe_Type1Hitbox, +}; + +static const Hitbox MacroShoe_Type0Hitbox = { + 0, 0, { 4, 0, 0, 0 }, 0x34, 0x20, +}; + +static const Hitbox MacroShoe_Type1Hitbox = { + 0, 0, { 4, 0, 0, 0 }, 0x30, 0x10, +}; + +void MacroShoe(Entity* this) { + static void (*const MacroShoe_Actions[])(Entity*) = { + MacroShoe_Init, + MacroShoe_Idle, + }; + MacroShoe_Actions[this->action](this); + sub_0800445C(this); +} + +void MacroShoe_Init(Entity* this) { + this->action = 1; + this->hitbox = (Hitbox*)MacroShoe_TypeHitboxes[this->type]; + if (this->type2 == 1) { + SetTile(0x4024, 0x410, 1); + SetTile(0x4026, 0x411, 1); + SetTile(0x4025, 0x412, 1); + } +} + +void MacroShoe_Idle(Entity* this) { +} diff --git a/src/object/macroShoes.c b/src/object/macroShoes.c deleted file mode 100644 index 1de5ee00..00000000 --- a/src/object/macroShoes.c +++ /dev/null @@ -1,43 +0,0 @@ -#include "entity.h" -#include "asm.h" - -void MacroShoes_Init(Entity*); -void MacroShoes_Idle(Entity*); - -static const Hitbox MacroShoes_Type0Hitbox; -static const Hitbox MacroShoes_Type1Hitbox; - -static const Hitbox* const MacroShoes_TypeHitboxes[] = { - &MacroShoes_Type0Hitbox, - &MacroShoes_Type1Hitbox, -}; - -static const Hitbox MacroShoes_Type0Hitbox = { - 0, 0, { 4, 0, 0, 0 }, 0x34, 0x20, -}; - -static const Hitbox MacroShoes_Type1Hitbox = { - 0, 0, { 4, 0, 0, 0 }, 0x30, 0x10, -}; - -void MacroShoes(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - MacroShoes_Init, - MacroShoes_Idle, - }; - actionFuncs[this->action](this); - sub_0800445C(this); -} - -void MacroShoes_Init(Entity* this) { - this->action = 1; - this->hitbox = (Hitbox*)MacroShoes_TypeHitboxes[this->type]; - if (this->type2 == 1) { - SetTile(0x4024, 0x410, 1); - SetTile(0x4026, 0x411, 1); - SetTile(0x4025, 0x412, 1); - } -} - -void MacroShoes_Idle(Entity* this) { -} diff --git a/src/object/mask.c b/src/object/mask.c index af7361af..886105e9 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -1,22 +1,28 @@ -#include "object.h" +/** + * @file mask.c + * @ingroup Objects + * + * @brief Mask object + */ #include "functions.h" +#include "object.h" -void sub_080929A4(Entity*); -void sub_08092A94(Entity*); -void sub_08092B0C(Entity*); +void Mask_Init(Entity*); +void Mask_Action1(Entity*); +void Mask_Action2(Entity*); void Mask_Delete(Entity*); void Mask(Entity* this) { - static void (*const MaskActionFuncs[])(Entity*) = { - sub_080929A4, - sub_08092A94, - sub_08092B0C, + static void (*const Mask_Actions[])(Entity*) = { + Mask_Init, + Mask_Action1, + Mask_Action2, Mask_Delete, }; - MaskActionFuncs[this->action](this); + Mask_Actions[this->action](this); } -void sub_080929A4(Entity* this) { +void Mask_Init(Entity* this) { if (this->type2 & 0xC0) { if (CheckFlags(this->field_0x86.HWORD)) { s32 field_0x0a; @@ -61,7 +67,7 @@ void sub_080929A4(Entity* this) { } // Probably related to knocking it down -void sub_08092A94(Entity* this) { +void Mask_Action1(Entity* this) { // Check for the first frame of bonking animation if (gPlayerEntity.action != PLAYER_BOUNCE) { return; @@ -95,7 +101,7 @@ void sub_08092A94(Entity* this) { } // Probably falling down -void sub_08092B0C(Entity* this) { +void Mask_Action2(Entity* this) { if (this->timer == 1) { this->action = 3; diff --git a/src/object/mazaalBossObject.c b/src/object/mazaalBossObject.c index b82c1910..75dbc35b 100644 --- a/src/object/mazaalBossObject.c +++ b/src/object/mazaalBossObject.c @@ -1,17 +1,23 @@ +/** + * @file mazaalBossObject.c + * @ingroup Objects + * + * @brief Mazaal Boss object + */ #define NENT_DEPRECATED -#include "global.h" -#include "entity.h" #include "enemy.h" +#include "entity.h" #include "functions.h" +#include "global.h" #include "item.h" +#include "new_player.h" #include "object.h" #include "player.h" -#include "new_player.h" #include "room.h" #include "screen.h" #include "sound.h" -extern u16 script_Object89Mazaal[]; +extern u16 script_MazaalBossObjectMazaal[]; typedef struct { /* 0x00 */ Entity base; @@ -86,7 +92,7 @@ void MazaalBossObject_Action0(MazaalBossObjectEntity* this) { super->spritePriority.b0 = 7; super->spriteOffsetY = 0x20; - this->cutsceneBeh = StartCutscene(super, script_Object89Mazaal); + this->cutsceneBeh = StartCutscene(super, script_MazaalBossObjectMazaal); } } diff --git a/src/object/object7E.c b/src/object/mazaalObject.c index b73ba84f..c9de1bcd 100644 --- a/src/object/object7E.c +++ b/src/object/mazaalObject.c @@ -1,8 +1,14 @@ -#include "global.h" +/** + * @file mazaalObject.c + * @ingroup Objects + * + * @brief Mazaal Object object + */ #include "entity.h" +#include "global.h" #include "physics.h" -void Object7E(Entity* this) { +void MazaalObject(Entity* this) { if (this->parent->next == NULL) { DeleteThisEntity(); diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c index e0e3c0d4..f7236beb 100644 --- a/src/object/metalDoor.c +++ b/src/object/metalDoor.c @@ -1,30 +1,36 @@ -#include "global.h" +/** + * @file metalDoor.c + * @ingroup Objects + * + * @brief Metal Door object + */ #include "asm.h" +#include "effects.h" #include "entity.h" -#include "room.h" #include "flags.h" -#include "sound.h" #include "functions.h" -#include "effects.h" +#include "global.h" #include "hitbox.h" +#include "room.h" +#include "sound.h" extern u32 sub_08083734(Entity*, u32); void sub_080A080C(Entity*); void sub_080A0870(Entity*); -void sub_080A0684(Entity*); -void sub_080A0718(Entity*); -void sub_080A074C(Entity*); -void sub_080A07BC(Entity*); -void sub_080A07F0(Entity*); +void MetalDoor_Init(Entity*); +void MetalDoor_Action1(Entity*); +void MetalDoor_Action2(Entity*); +void MetalDoor_Action3(Entity*); +void MetalDoor_Action4(Entity*); void MetalDoor(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_080A0684, sub_080A0718, sub_080A074C, sub_080A07BC, sub_080A07F0, + static void (*const MetalDoor_Actions[])(Entity*) = { + MetalDoor_Init, MetalDoor_Action1, MetalDoor_Action2, MetalDoor_Action3, MetalDoor_Action4, }; - actionFuncs[this->action](this); + MetalDoor_Actions[this->action](this); } -void sub_080A0684(Entity* this) { +void MetalDoor_Init(Entity* this) { if ((this->cutsceneBeh.HWORD != 0xffff) && CheckFlags(this->cutsceneBeh.HWORD)) { DeleteThisEntity(); } @@ -40,7 +46,7 @@ void sub_080A0684(Entity* this) { this->field_0x74.HWORD = COORD_TO_TILE(this); } -void sub_080A0718(Entity* this) { +void MetalDoor_Action1(Entity* this) { if (sub_08083734(this, 2) != 0) { this->action = 2; this->timer = 12; @@ -51,7 +57,7 @@ void sub_080A0718(Entity* this) { } } -void sub_080A074C(Entity* this) { +void MetalDoor_Action2(Entity* this) { u8 bVar1; Entity* ent; @@ -76,7 +82,7 @@ void sub_080A074C(Entity* this) { } } -void sub_080A07BC(Entity* this) { +void MetalDoor_Action3(Entity* this) { if (CheckFlags(this->field_0x86.HWORD)) { this->action = 4; this->timer = 12; @@ -87,7 +93,7 @@ void sub_080A07BC(Entity* this) { } } -void sub_080A07F0(Entity* this) { +void MetalDoor_Action4(Entity* this) { LinearMoveUpdate(this); diff --git a/src/object/minecart.c b/src/object/minecart.c index c5ef1e98..bb839de4 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -1,7 +1,13 @@ +/** + * @file minecart.c + * @ingroup Objects + * + * @brief Minecart object + */ #define NENT_DEPRECATED -#include "object.h" #include "functions.h" #include "hitbox.h" +#include "object.h" typedef struct { Entity base; @@ -12,26 +18,27 @@ typedef struct { extern void sub_08017744(Entity*); u32 sub_08091DDC(MinecartEntity*); -void sub_080916EC(MinecartEntity*); -void sub_080917DC(MinecartEntity*); -void sub_080918A4(MinecartEntity*); -void sub_080919AC(MinecartEntity*); -void sub_08091C0C(MinecartEntity*); -void sub_08091C98(MinecartEntity*); -void sub_08091CC8(MinecartEntity*); -void sub_08091D90(MinecartEntity*); +void Minecart_Init(MinecartEntity*); +void Minecart_Action1(MinecartEntity*); +void Minecart_Action2(MinecartEntity*); +void Minecart_Action3(MinecartEntity*); +void Minecart_Action4(MinecartEntity*); +void Minecart_Action5(MinecartEntity*); +void Minecart_Action6(MinecartEntity*); +void Minecart_Action7(MinecartEntity*); extern const u16* const gUnk_081223D8[]; void Minecart(Entity* this) { - static void (*const actionFuncs[])(MinecartEntity*) = { - sub_080916EC, sub_080917DC, sub_080918A4, sub_080919AC, sub_08091C0C, sub_08091C98, sub_08091CC8, sub_08091D90, + static void (*const Minecart_Actions[])(MinecartEntity*) = { + Minecart_Init, Minecart_Action1, Minecart_Action2, Minecart_Action3, + Minecart_Action4, Minecart_Action5, Minecart_Action6, Minecart_Action7, }; - actionFuncs[this->action]((MinecartEntity*)this); + Minecart_Actions[this->action]((MinecartEntity*)this); this->contactFlags = 0; } -void sub_080916EC(MinecartEntity* this) { +void Minecart_Init(MinecartEntity* this) { struct_030010EC* unk = &gRoomTransition.minecart_data[super->timer]; this->minecartData = unk; @@ -56,7 +63,7 @@ void sub_080916EC(MinecartEntity* this) { SetTile(0x4022, COORD_TO_TILE(super), super->collisionLayer); } -void sub_080917DC(MinecartEntity* this) { +void Minecart_Action1(MinecartEntity* this) { if ((super->contactFlags & 0x7f) == 0x1d) { super->zVelocity = Q_16_16(2.625); super->action = 7; @@ -91,7 +98,7 @@ void sub_080917DC(MinecartEntity* this) { } } -void sub_080918A4(MinecartEntity* this) { +void Minecart_Action2(MinecartEntity* this) { if (EntityInRectRadius(super, &gPlayerEntity, 2, 2) != 0) { gPlayerEntity.x.HALF.HI = super->x.HALF.HI; gPlayerEntity.y.HALF.HI = super->y.HALF.HI; @@ -121,7 +128,7 @@ void sub_080918A4(MinecartEntity* this) { } } -void sub_080919AC(MinecartEntity* this) { +void Minecart_Action3(MinecartEntity* this) { static const s8 gUnk_081223C8[] = { 0, -7, 7, 0, 0, 7, -7, 0 }; u32 iVar2; @@ -194,7 +201,7 @@ void sub_080919AC(MinecartEntity* this) { case 0x6e: case 0x6f: if (uVar3 == GetTileUnderEntity(super)) { - sub_08091C0C(this); + Minecart_Action4(this); gPlayerEntity.animationState = super->animationState << 1; return; } @@ -212,7 +219,7 @@ void sub_080919AC(MinecartEntity* this) { } } -void sub_08091C0C(MinecartEntity* this) { +void Minecart_Action4(MinecartEntity* this) { sub_08004168(super); CopyPosition(super, &gPlayerEntity); switch (GetTileUnderEntity(super)) { @@ -261,7 +268,7 @@ void sub_08091C0C(MinecartEntity* this) { gPlayerEntity.animationState = super->animationState << 1; } -void sub_08091C98(MinecartEntity* this) { +void Minecart_Action5(MinecartEntity* this) { LinearMoveUpdate(super); CopyPosition(super, &gPlayerEntity); if (gRoomControls.reload_flags == 0) { @@ -271,7 +278,7 @@ void sub_08091C98(MinecartEntity* this) { } } -void sub_08091CC8(MinecartEntity* this) { +void Minecart_Action6(MinecartEntity* this) { struct_030010EC* minecartData; if (gPlayerState.jump_status == 0) { @@ -291,7 +298,7 @@ void sub_08091CC8(MinecartEntity* this) { } } -void sub_08091D90(MinecartEntity* this) { +void Minecart_Action7(MinecartEntity* this) { if (super->zVelocity < 0) { UpdateAnimationSingleFrame(super); } diff --git a/src/object/minecartDoor.c b/src/object/minecartDoor.c index e7f3e52c..edb60f48 100644 --- a/src/object/minecartDoor.c +++ b/src/object/minecartDoor.c @@ -6,9 +6,9 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/mineralWaterSource.c b/src/object/mineralWaterSource.c index 12f066f4..2fca29e6 100644 --- a/src/object/mineralWaterSource.c +++ b/src/object/mineralWaterSource.c @@ -1,7 +1,13 @@ +/** + * @file mineralWaterSource.c + * @ingroup Objects + * + * @brief Mineral Water Source object + */ #include "object.h" void MineralWaterSource_Init(Entity*); -void sub_080973DC(Entity*); +void MineralWaterSource_Action1(Entity*); typedef struct { u8 type2; @@ -13,7 +19,7 @@ typedef struct { void MineralWaterSource(Entity* this) { static void (*const MineralWaterSourceActionFuncs[])(Entity*) = { MineralWaterSource_Init, - sub_080973DC, + MineralWaterSource_Action1, }; MineralWaterSourceActionFuncs[this->action](this); } @@ -45,6 +51,6 @@ void MineralWaterSource_Init(Entity* this) { this->action = 1; } -void sub_080973DC(Entity* this) { +void MineralWaterSource_Action1(Entity* this) { this->contactFlags = 0; } diff --git a/src/object/minishEmoticon.c b/src/object/minishEmoticon.c index fe93538d..a42a9ac8 100644 --- a/src/object/minishEmoticon.c +++ b/src/object/minishEmoticon.c @@ -1,28 +1,34 @@ +/** + * @file minishEmoticon.c + * @ingroup Objects + * + * @brief Minish Emoticon object + */ #include "entity.h" #include "functions.h" -void sub_08082058(Entity*); -void sub_08082098(Entity*); +void MinishEmoticon_Init(Entity*); +void MinishEmoticon_Action1(Entity*); void MinishEmoticon(Entity* this) { - static EntityAction* const actionFuncs[] = { - sub_08082058, - sub_08082098, + static EntityAction* const MinishEmoticon_Actions[] = { + MinishEmoticon_Init, + MinishEmoticon_Action1, }; - actionFuncs[this->action](this); + MinishEmoticon_Actions[this->action](this); } -void sub_08082058(Entity* this) { +void MinishEmoticon_Init(Entity* this) { this->updatePriority = 6; this->flags |= ENT_PERSIST; this->spriteSettings.draw = 1; this->action = 1; LoadSwapGFX(this, 1, 3); - sub_08082098(this); + MinishEmoticon_Action1(this); } -void sub_08082098(Entity* this) { +void MinishEmoticon_Action1(Entity* this) { u32 animIndex; u32 origAnimIndex; u32 animationState; diff --git a/src/object/minishLight.c b/src/object/minishLight.c index c6a81f90..382056ee 100644 --- a/src/object/minishLight.c +++ b/src/object/minishLight.c @@ -1,17 +1,23 @@ +/** + * @file minishLight.c + * @ingroup Objects + * + * @brief Minish Light object + */ #include "entity.h" -void sub_0809F840(Entity*); -void sub_0809F868(Entity*); +void MinishLight_Init(Entity*); +void MinishLight_Action1(Entity*); void MinishLight(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0809F840, - sub_0809F868, + static void (*const MinishLight_Actions[])(Entity*) = { + MinishLight_Init, + MinishLight_Action1, }; - actionFuncs[this->action](this); + MinishLight_Actions[this->action](this); } -void sub_0809F840(Entity* this) { +void MinishLight_Init(Entity* this) { this->action = 1; this->frameIndex = 0; this->timer = 32; @@ -24,7 +30,7 @@ void sub_0809F840(Entity* this) { UpdateSpriteForCollisionLayer(this); } -void sub_0809F868(Entity* this) { +void MinishLight_Action1(Entity* this) { if (--this->timer == 0) { if (this->subtimer == 0) { if (++this->frameIndex == 3) { diff --git a/src/object/object3D.c b/src/object/minishPortalCloseup.c index 542167c4..6b6877b0 100644 --- a/src/object/object3D.c +++ b/src/object/minishPortalCloseup.c @@ -1,39 +1,39 @@ /** - * @file object3D.c + * @file minishPortalCloseup.c * @ingroup Objects * - * @brief Object3D object + * @brief Minish Portal Closeup object */ #define NENT_DEPRECATED +#include "area.h" +#include "functions.h" #include "global.h" +#include "main.h" #include "object.h" -#include "functions.h" -#include "area.h" #include "screen.h" -#include "main.h" #include "structures.h" typedef struct { /*0x00*/ Entity base; /*0x68*/ u16 unk_68; -} Object3DEntity; +} MinishPortalCloseupEntity; -void Object3D_Init(Object3DEntity*); -void Object3D_Action1(Object3DEntity*); -void Object3D_Action2(Object3DEntity*); +void MinishPortalCloseup_Init(MinishPortalCloseupEntity*); +void MinishPortalCloseup_Action1(MinishPortalCloseupEntity*); +void MinishPortalCloseup_Action2(MinishPortalCloseupEntity*); void sub_0808D030(void); -void Object3D(Object3DEntity* this) { - static void (*const Object3D_Actions[])(Object3DEntity*) = { - Object3D_Init, - Object3D_Action1, - Object3D_Action2, +void MinishPortalCloseup(MinishPortalCloseupEntity* this) { + static void (*const MinishPortalCloseup_Actions[])(MinishPortalCloseupEntity*) = { + MinishPortalCloseup_Init, + MinishPortalCloseup_Action1, + MinishPortalCloseup_Action2, }; - Object3D_Actions[super->action](this); + MinishPortalCloseup_Actions[super->action](this); } -void Object3D_Init(Object3DEntity* this) { +void MinishPortalCloseup_Init(MinishPortalCloseupEntity* this) { super->action = 1; super->x.HALF.HI = gArea.portal_x - gRoomControls.scroll_x; super->y.HALF.HI = gArea.portal_y - gRoomControls.scroll_y; @@ -43,7 +43,7 @@ void Object3D_Init(Object3DEntity* this) { sub_0801E1EC(super->x.HALF.HI, super->y.HALF.HI, this->unk_68); } -void Object3D_Action1(Object3DEntity* this) { +void MinishPortalCloseup_Action1(MinishPortalCloseupEntity* this) { #ifdef EU static const u16 gUnk_081216C8[] = { 206, 19, 333, 208, 16, 333, 207, 1, 333, 0 }; #else @@ -96,7 +96,7 @@ void sub_0808D030(void) { gOAMControls.field_0x0 = 1; } -void Object3D_Action2(Object3DEntity* this) { +void MinishPortalCloseup_Action2(MinishPortalCloseupEntity* this) { u32 tmp = super->timer--; if (tmp != 0) { if (this->unk_68 != 0) { diff --git a/src/object/object74.c b/src/object/minishPortalStone.c index 10702c2c..e038c31f 100644 --- a/src/object/object74.c +++ b/src/object/minishPortalStone.c @@ -1,41 +1,41 @@ /** - * @file object74.c + * @file minishPortalStone.c * @ingroup Objects * - * @brief Object74 object + * @brief Minish Portal Stone object */ - #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" #include "screen.h" typedef struct { /*0x00*/ Entity base; /*0x68*/ u8 unk_68[0x1e]; /*0x86*/ u16 unk_86; -} Object74Entity; +} MinishPortalStoneEntity; -void sub_08097B84(Object74Entity*); -void sub_08097BDC(Object74Entity*); -void sub_08097C18(Object74Entity*); -void sub_08097C20(Object74Entity*); -void sub_08097C1C(Object74Entity*); -void sub_08097CFC(Object74Entity*); -bool32 sub_08097CB0(Object74Entity*); -void sub_08097CB4(Object74Entity*); +void MinishPortalStone_Init(MinishPortalStoneEntity*); +void MinishPortalStone_Action1(MinishPortalStoneEntity*); +void MinishPortalStone_Action2(MinishPortalStoneEntity*); +void MinishPortalStone_Action3(MinishPortalStoneEntity*); +void MinishPortalStone_Action4(MinishPortalStoneEntity*); +void sub_08097CFC(MinishPortalStoneEntity*); +bool32 sub_08097CB0(MinishPortalStoneEntity*); +void sub_08097CB4(MinishPortalStoneEntity*); const Hitbox gUnk_08123328 = { 0, 0, { 4, 0, 0, 4 }, 18, 18 }; -void Object74(Object74Entity* this) { - static void (*const gUnk_08123330[])(Object74Entity*) = { - sub_08097B84, sub_08097BDC, sub_08097C18, sub_08097C20, sub_08097C1C, +void MinishPortalStone(MinishPortalStoneEntity* this) { + static void (*const MinishPortalStone_Actions[])(MinishPortalStoneEntity*) = { + MinishPortalStone_Init, MinishPortalStone_Action1, MinishPortalStone_Action2, + MinishPortalStone_Action3, MinishPortalStone_Action4, }; - gUnk_08123330[super->action](this); + MinishPortalStone_Actions[super->action](this); } -void sub_08097B84(Object74Entity* this) { +void MinishPortalStone_Init(MinishPortalStoneEntity* this) { super->action = 1; super->spritePriority.b0 = 7; super->hitbox = (Hitbox*)&gUnk_08123328; @@ -48,7 +48,7 @@ void sub_08097B84(Object74Entity* this) { } } -void sub_08097BDC(Object74Entity* this) { +void MinishPortalStone_Action1(MinishPortalStoneEntity* this) { if (CheckFlags(this->unk_86)) { SetPlayerControl(CONTROL_1); gPauseMenuOptions.disabled = 1; @@ -59,13 +59,13 @@ void sub_08097BDC(Object74Entity* this) { } } -void sub_08097C18(Object74Entity* this) { +void MinishPortalStone_Action2(MinishPortalStoneEntity* this) { } -void sub_08097C1C(Object74Entity* this) { +void MinishPortalStone_Action4(MinishPortalStoneEntity* this) { } -void sub_08097C20(Object74Entity* this) { +void MinishPortalStone_Action3(MinishPortalStoneEntity* this) { u32 tmp; SetPriorityTimer(30); sub_0800445C(super); @@ -87,11 +87,11 @@ void sub_08097C20(Object74Entity* this) { } } -bool32 sub_08097CB0(Object74Entity* this) { +bool32 sub_08097CB0(MinishPortalStoneEntity* this) { return FALSE; } -void sub_08097CB4(Object74Entity* this) { +void sub_08097CB4(MinishPortalStoneEntity* this) { super->action = 3; super->spriteSettings.draw = 1; super->spriteRendering.alphaBlend = 1; @@ -102,7 +102,7 @@ void sub_08097CB4(Object74Entity* this) { SoundReq(SFX_14A); } -void sub_08097CFC(Object74Entity* this) { +void sub_08097CFC(MinishPortalStoneEntity* this) { // TODO recreate as TileData[] static const u16 gUnk_08123344[] = { 16448, 65471, 16449, 65472, 16450, 65473, 16451, 65535, 16452, 0, 16453, 1, 16454, 63, 16455, 64, 16456, 65, 65535 }; diff --git a/src/object/minishSizedArchway.c b/src/object/minishSizedArchway.c index 31162457..01a81cfc 100644 --- a/src/object/minishSizedArchway.c +++ b/src/object/minishSizedArchway.c @@ -1,3 +1,9 @@ +/** + * @file minishSizedArchway.c + * @ingroup Objects + * + * @brief Minish Sized Archway object + */ #include "entity.h" #include "game.h" diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c index debcea2d..f8904c9c 100644 --- a/src/object/minishSizedEntrance.c +++ b/src/object/minishSizedEntrance.c @@ -1,19 +1,25 @@ -#include "object.h" -#include "game.h" +/** + * @file minishSizedEntrance.c + * @ingroup Objects + * + * @brief MinishSizedEntrance object + */ #include "functions.h" +#include "game.h" +#include "object.h" -void sub_08090F00(Entity*); -void sub_08090EC0(Entity*); +void MinishSizedEntrance_Action1(Entity*); +void MinishSizedEntrance_Init(Entity*); void MinishSizedEntrance(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_08090EC0, - sub_08090F00, + static void (*const MinishSizedEntrance_Actions[])(Entity*) = { + MinishSizedEntrance_Init, + MinishSizedEntrance_Action1, }; - actionFuncs[this->action](this); + MinishSizedEntrance_Actions[this->action](this); } -void sub_08090EC0(Entity* this) { +void MinishSizedEntrance_Init(Entity* this) { this->action = 1; this->spriteRendering.b3 = 3; this->spritePriority.b0 = 7; @@ -25,7 +31,7 @@ void sub_08090EC0(Entity* this) { } } -void sub_08090F00(Entity* this) { +void MinishSizedEntrance_Action1(Entity* this) { static const u16 gUnk_0812225C[] = { 0x400, 0x100, @@ -40,7 +46,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) & gUnk_0812225C[this->type2])) { + (gPlayerEntity.z.HALF.HI == 0) && (((u16)gPlayerState.playerInput.field_0x90) & gUnk_0812225C[this->type2])) { DoExitTransition(GetCurrentRoomProperty(this->timer)); } } diff --git a/src/object/object3E.c b/src/object/minishVillageObject.c index 0ca77146..417c3f99 100644 --- a/src/object/object3E.c +++ b/src/object/minishVillageObject.c @@ -1,41 +1,42 @@ /** - * @file object3E.c + * @file minishVillageObject.c * @ingroup Objects * - * @brief Object3E object + * @brief Minish Village Object object */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" #include "screen.h" typedef struct { /*0x00*/ Entity base; -} Object3EEntity; - -void Object3E_Type0(Object3EEntity*); -void Object3E_Type1(Object3EEntity*); -void Object3E_Type3(Object3EEntity*); -void Object3E_Type4(Object3EEntity*); -void Object3E_Type5(Object3EEntity*); -void Object3E_Type6(Object3EEntity*); -void Object3E_Type7(Object3EEntity*); -void Object3E_Type8(Object3EEntity*); -void Object3E_Type8_Init(Object3EEntity*); -void Object3E_Type8_Action1(Object3EEntity*); -void Object3E_Type8_Action2(Object3EEntity*); - -void Object3E(Object3EEntity* this) { - static void (*const Object3E_Types[])(Object3EEntity*) = { - Object3E_Type0, Object3E_Type1, Object3E_Type1, Object3E_Type3, Object3E_Type4, - Object3E_Type5, Object3E_Type6, Object3E_Type7, Object3E_Type8, Object3E_Type1, +} MinishVillageObjectEntity; + +void MinishVillageObject_Type0(MinishVillageObjectEntity*); +void MinishVillageObject_Type1(MinishVillageObjectEntity*); +void MinishVillageObject_Type3(MinishVillageObjectEntity*); +void MinishVillageObject_Type4(MinishVillageObjectEntity*); +void MinishVillageObject_Type5(MinishVillageObjectEntity*); +void MinishVillageObject_Type6(MinishVillageObjectEntity*); +void MinishVillageObject_Type7(MinishVillageObjectEntity*); +void MinishVillageObject_Type8(MinishVillageObjectEntity*); +void MinishVillageObject_Type8_Init(MinishVillageObjectEntity*); +void MinishVillageObject_Type8_Action1(MinishVillageObjectEntity*); +void MinishVillageObject_Type8_Action2(MinishVillageObjectEntity*); + +void MinishVillageObject(MinishVillageObjectEntity* this) { + static void (*const MinishVillageObject_Types[])(MinishVillageObjectEntity*) = { + MinishVillageObject_Type0, MinishVillageObject_Type1, MinishVillageObject_Type1, MinishVillageObject_Type3, + MinishVillageObject_Type4, MinishVillageObject_Type5, MinishVillageObject_Type6, MinishVillageObject_Type7, + MinishVillageObject_Type8, MinishVillageObject_Type1, }; - Object3E_Types[super->type](this); + MinishVillageObject_Types[super->type](this); } -void Object3E_Type0(Object3EEntity* this) { +void MinishVillageObject_Type0(MinishVillageObjectEntity* this) { u32 tmp; u32 tmp2; switch (super->action) { @@ -77,7 +78,7 @@ void Object3E_Type0(Object3EEntity* this) { } } -void Object3E_Type1(Object3EEntity* this) { +void MinishVillageObject_Type1(MinishVillageObjectEntity* this) { static const u16 gUnk_08121704[] = { 0x12d, 0x12e, 0x12f, 0x130, 0x131, 0x132, 0x133, 0x132, 0x131, 0x130, 0x12f, 0x12e, 0x12d, 0, }; @@ -117,7 +118,7 @@ void Object3E_Type1(Object3EEntity* this) { } void sub_0808D280(void) { - Entity* obj = FindEntity(6, OBJECT_3E, 6, 9, 0); + Entity* obj = FindEntity(6, MINISH_VILLAGE_OBJECT, 6, 9, 0); if (obj != NULL) { obj->action = 2; obj->subAction = 0; @@ -129,17 +130,17 @@ void sub_0808D280(void) { } void sub_0808D2CC(void) { - Entity* obj = FindEntity(6, OBJECT_3E, 6, 1, 0); + Entity* obj = FindEntity(6, MINISH_VILLAGE_OBJECT, 6, 1, 0); if (obj != NULL) { obj->type = 9; SetDefaultPriority(obj, 2); } } -void Object3E_Type3(Object3EEntity* this) { +void MinishVillageObject_Type3(MinishVillageObjectEntity* this) { } -void Object3E_Type4(Object3EEntity* this) { +void MinishVillageObject_Type4(MinishVillageObjectEntity* this) { s32 tmp; if (super->action == 0) { super->action = 0; @@ -155,7 +156,7 @@ void Object3E_Type4(Object3EEntity* this) { } } -void Object3E_Type5(Object3EEntity* this) { +void MinishVillageObject_Type5(MinishVillageObjectEntity* this) { if (super->action == 0) { super->action = 0; super->frameIndex = 1; @@ -166,7 +167,7 @@ void Object3E_Type5(Object3EEntity* this) { HandleEntity0x82Actions(super); } -void Object3E_Type6(Object3EEntity* this) { +void MinishVillageObject_Type6(MinishVillageObjectEntity* this) { static const u16 gUnk_08121720[] = { 0x149, 0x14a, 0x14b, 0x14a, 0, 0 }; if (super->action == 0) { super->action = 1; @@ -184,7 +185,7 @@ void Object3E_Type6(Object3EEntity* this) { } } -void Object3E_Type7(Object3EEntity* this) { +void MinishVillageObject_Type7(MinishVillageObjectEntity* this) { if (super->action == 0) { super->action = 1; super->spriteRendering.b3 = 3; @@ -195,17 +196,17 @@ void Object3E_Type7(Object3EEntity* this) { } } -void Object3E_Type8(Object3EEntity* this) { - static void (*const Object3E_Type8_Actions[])(Object3EEntity*) = { - Object3E_Type8_Init, - Object3E_Type8_Action1, - Object3E_Type8_Action2, +void MinishVillageObject_Type8(MinishVillageObjectEntity* this) { + static void (*const MinishVillageObject_Type8_Actions[])(MinishVillageObjectEntity*) = { + MinishVillageObject_Type8_Init, + MinishVillageObject_Type8_Action1, + MinishVillageObject_Type8_Action2, }; - Object3E_Type8_Actions[super->action](this); + MinishVillageObject_Type8_Actions[super->action](this); } -void Object3E_Type8_Init(Object3EEntity* this) { +void MinishVillageObject_Type8_Init(MinishVillageObjectEntity* this) { u32 tilePosition; super->spritePriority.b0 = 7; super->frameIndex = super->type2; @@ -227,7 +228,7 @@ void Object3E_Type8_Init(Object3EEntity* this) { } } -void Object3E_Type8_Action1(Object3EEntity* this) { +void MinishVillageObject_Type8_Action1(MinishVillageObjectEntity* this) { if ((gRoomTransition.frameCount & 3U) == 0) { gScreen.controls.alphaBlend = ((0x10 - super->timer) * 0x100) | super->timer; super->timer++; @@ -241,7 +242,7 @@ void Object3E_Type8_Action1(Object3EEntity* this) { } } -void Object3E_Type8_Action2(Object3EEntity* this) { +void MinishVillageObject_Type8_Action2(MinishVillageObjectEntity* this) { static const u16 gUnk_08121738[] = { 0x14c, 0x14d, 0x14e, 0x14f, 0x150, 0x151, 0x150, 0x14f, 0x14e, 0x14d, 0x14c, 0, }; diff --git a/src/object/object1E.c b/src/object/moleMittsParticle.c index 05d7b271..69dcfcd4 100644 --- a/src/object/object1E.c +++ b/src/object/moleMittsParticle.c @@ -1,31 +1,30 @@ /** - * @file object1E.c + * @file moleMittsParticle.c * @ingroup Objects * - * @brief Object1E object + * @brief Mole Mitts Particle object */ - #define NENT_DEPRECATED +#include "area.h" +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" -#include "area.h" -void sub_08087528(Entity*); -void sub_080875F4(Entity*); +void MoleMittsParticle_Init(Entity*); +void MoleMittsParticle_Action1(Entity*); void sub_08087640(Entity*); -void Object1E(Entity* this) { - static void (*const gUnk_081208B8[])(Entity*) = { - sub_08087528, - sub_080875F4, +void MoleMittsParticle(Entity* this) { + static void (*const MoleMittsParticle_Actions[])(Entity*) = { + MoleMittsParticle_Init, + MoleMittsParticle_Action1, }; if (!EntityIsDeleted(this)) { - gUnk_081208B8[this->action](this); + MoleMittsParticle_Actions[this->action](this); } } -void sub_08087528(Entity* this) { +void MoleMittsParticle_Init(Entity* this) { u32 palette; this->action = 1; @@ -69,7 +68,7 @@ void sub_08087528(Entity* this) { InitializeAnimation(this, this->type2 * 4 + this->animationState); } -void sub_080875F4(Entity* this) { +void MoleMittsParticle_Action1(Entity* this) { GetNextFrame(this); if ((this->frame & ANIM_DONE) != 0) { DeleteThisEntity(); diff --git a/src/object/mulldozerSpawnPoint.c b/src/object/mulldozerSpawnPoint.c new file mode 100644 index 00000000..17a33331 --- /dev/null +++ b/src/object/mulldozerSpawnPoint.c @@ -0,0 +1,43 @@ +/** + * @file mulldozerSpawnPoint.c + * @ingroup Objects + * + * @brief Mulldozer Spawn Point object + */ +#define NENT_DEPRECATED +#include "entity.h" +#include "sound.h" + +void MulldozerSpawnPoint_Init(Entity*); +void MulldozerSpawnPoint_Action1(Entity*); + +void MulldozerSpawnPoint(Entity* this) { + static void (*const MulldozerSpawnPoint_Actions[])(Entity*) = { + MulldozerSpawnPoint_Init, + MulldozerSpawnPoint_Action1, + DeleteEntity, + }; + + MulldozerSpawnPoint_Actions[this->action]((Entity*)this); +} + +void MulldozerSpawnPoint_Init(Entity* this) { + static const u8 typeAnimationStates[] = { 0x2, 0x0, 0x43, 0x0 }; + static const u16 typeSounds[] = { SFX_124, SFX_197, SFX_11D, SFX_NONE }; + this->action = 1; + InitializeAnimation(this, typeAnimationStates[this->type]); + SoundReq(typeSounds[this->type]); +} + +void MulldozerSpawnPoint_Action1(Entity* this) { + Entity* parent; + + GetNextFrame(this); + if (this->frame & 0x80) { + this->action = 2; + parent = this->parent; + parent->flags = this->timer; + parent->spriteSettings.draw = this->subtimer; + ((GenericEntity*)parent)->field_0x6c.HALF.HI &= 0xef; + } +} diff --git a/src/object/object1D.c b/src/object/object1D.c index 7e6db44b..0635d64c 100644 --- a/src/object/object1D.c +++ b/src/object/object1D.c @@ -1,21 +1,27 @@ +/** + * @file object1D.c + * @ingroup Objects + * + * @brief Object1D object + */ #include "entity.h" -void sub_080874F8(Entity*); -void nullsub_117(Entity*); +void Object1D_Init(Entity*); +void Object1D_Action1(Entity*); void Object1D(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_080874F8, - nullsub_117, + static void (*const Object1D_Actions[])(Entity*) = { + Object1D_Init, + Object1D_Action1, }; - actionFuncs[this->action](this); + Object1D_Actions[this->action](this); } -void sub_080874F8(Entity* this) { +void Object1D_Init(Entity* this) { DeleteThisEntity(); } -void nullsub_117(Entity* this) { +void Object1D_Action1(Entity* this) { } static const s16 unused1[] = { diff --git a/src/object/object1F.c b/src/object/object1F.c index efa7f8db..c95b351d 100644 --- a/src/object/object1F.c +++ b/src/object/object1F.c @@ -1,9 +1,15 @@ +/** + * @file object1F.c + * @ingroup Objects + * + * @brief Object1F object + */ #define NENT_DEPRECATED -#include "entity.h" -#include "player.h" -#include "functions.h" #include "asm.h" #include "effects.h" +#include "entity.h" +#include "functions.h" +#include "player.h" typedef struct { Entity base; @@ -16,13 +22,13 @@ void Object1F_Action1(Object1FEntity*); void Object1F_Action2(Object1FEntity*); void Object1F(Entity* this) { - static void (*const actionFuncs[])(Object1FEntity*) = { + static void (*const Object1F_Actions[])(Object1FEntity*) = { Object1F_Init, Object1F_Action1, Object1F_Action2, }; - actionFuncs[this->action]((Object1FEntity*)this); + Object1F_Actions[this->action]((Object1FEntity*)this); } typedef struct { diff --git a/src/object/object2B.c b/src/object/object2B.c deleted file mode 100644 index efd23de9..00000000 --- a/src/object/object2B.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "global.h" -#include "entity.h" -#include "functions.h" - -void Object2B(Entity* object) { - Entity* parent; - - if (object->action == 0) { - object->action = 1; - object->z.WORD = 0; - object->spriteRendering.b3 = 3; - InitializeAnimation(object, 9); - } - - parent = object->parent; - if (parent->z.WORD == 0) { - DeleteThisEntity(); - } else { - int position = 0x120 - parent->z.HALF.HI; - SetAffineInfo(object, position, position, parent->field_0x7c.HALF_U.HI); - } -} diff --git a/src/object/object30.c b/src/object/object30.c index 6a1a3d2c..dc304585 100644 --- a/src/object/object30.c +++ b/src/object/object30.c @@ -6,11 +6,11 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" +#include "collision.h" #include "functions.h" +#include "global.h" #include "item.h" -#include "collision.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/object37.c b/src/object/object37.c index e4cbc8f9..11f54176 100644 --- a/src/object/object37.c +++ b/src/object/object37.c @@ -1,8 +1,14 @@ +/** + * @file object37.c + * @ingroup Objects + * + * @brief Object37 object + */ #define NENT_DEPRECATED #include "entity.h" #include "functions.h" -#include "save.h" #include "item.h" +#include "save.h" typedef struct { Entity base; @@ -18,12 +24,12 @@ void Object37_Init(Object37Entity*); void Object37_Action1(Object37Entity*); void Object37(Entity* this) { - static void (*const actionFuncs[])(Object37Entity*) = { + static void (*const Object37_Actions[])(Object37Entity*) = { Object37_Init, Object37_Action1, }; - actionFuncs[this->action]((Object37Entity*)this); + Object37_Actions[this->action]((Object37Entity*)this); } void Object37_Init(Object37Entity* this) { diff --git a/src/object/object53.c b/src/object/object53.c index 44f567f7..e7716e64 100644 --- a/src/object/object53.c +++ b/src/object/object53.c @@ -1,18 +1,24 @@ +/** + * @file object53.c + * @ingroup Objects + * + * @brief Object53 object + */ #define NENT_DEPRECATED +#include "asm.h" #include "entity.h" #include "functions.h" -#include "asm.h" -void sub_08091120(Entity*); -void sub_08091198(Entity*); +void Object53_Init(Entity*); +void Object53_Action1(Entity*); void Object53(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_08091120, - sub_08091198, + static void (*const Object53_Actions[])(Entity*) = { + Object53_Init, + Object53_Action1, }; - actionFuncs[this->action]((Entity*)this); + Object53_Actions[this->action]((Entity*)this); } typedef struct { @@ -22,7 +28,7 @@ typedef struct { u8 spriteIndex; } gUnk_08122288_struct; -void sub_08091120(Entity* this) { +void Object53_Init(Entity* this) { static const gUnk_08122288_struct gUnk_08122288[] = { { 0x0, 0x2, 0xe8, 0xa7 }, { 0x0, 0x5, 0xe0, 0xa7 }, { 0x0, 0x5, 0xf2, 0xa7 } }; @@ -39,7 +45,7 @@ void sub_08091120(Entity* this) { sub_08004168(this); } -void sub_08091198(Entity* this) { +void Object53_Action1(Entity* this) { if (this->zVelocity < 0) { this->spriteSettings.flipY = 1; } diff --git a/src/object/object63.c b/src/object/object63.c index 1cd03832..b87c79f6 100644 --- a/src/object/object63.c +++ b/src/object/object63.c @@ -1,25 +1,31 @@ +/** + * @file object63.c + * @ingroup Objects + * + * @brief Object63 object + */ #define NENT_DEPRECATED +#include "asm.h" #include "entity.h" #include "functions.h" -#include "asm.h" #include "object.h" -void sub_08093D88(Entity*); -void sub_08093DE0(Entity*); +void Object63_Init(Entity*); +void Object63_Action1(Entity*); void Object63_Delete(Entity*); void sub_08093E10(Entity*, Entity*); void Object63(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_08093D88, - sub_08093DE0, + static void (*const Object63_Actions[])(Entity*) = { + Object63_Init, + Object63_Action1, Object63_Delete, }; - actionFuncs[this->action]((Entity*)this); + Object63_Actions[this->action]((Entity*)this); } -void sub_08093D88(Entity* this) { +void Object63_Init(Entity* this) { Entity* objEnt; this->action = 1; @@ -43,7 +49,7 @@ void sub_08093D88(Entity* this) { } } -void sub_08093DE0(Entity* this) { +void Object63_Action1(Entity* this) { if (--this->timer == 0) { this->action = 2; } diff --git a/src/object/object90.c b/src/object/object90.c deleted file mode 100644 index d975f54c..00000000 --- a/src/object/object90.c +++ /dev/null @@ -1,31 +0,0 @@ -/** - * @file object90.c - * @ingroup Objects - * - * @brief Object90 object - */ - -#define NENT_DEPRECATED -#include "global.h" -#include "object.h" -#include "functions.h" - -void Object90_Init(Entity*); -void Object90_Action1(Entity*); - -void Object90(Entity* this) { - static void (*const Object90_Actions[])(Entity*) = { - Object90_Init, - Object90_Action1, - }; - Object90_Actions[this->action](this); -} - -void Object90_Init(Entity* this) { - this->action = 1; - this->frameIndex = 0; - this->spritePriority.b0 = 5; -} - -void Object90_Action1(Entity* this) { -} diff --git a/src/object/objectA.c b/src/object/objectA.c index 5ec992a9..9ecf5a80 100644 --- a/src/object/objectA.c +++ b/src/object/objectA.c @@ -1,11 +1,17 @@ -#include "global.h" +/** + * @file objectA.c + * @ingroup Objects + * + * @brief ObjectA object + */ #include "entity.h" -#include "room.h" #include "flags.h" -#include "object.h" #include "functions.h" #include "game.h" +#include "global.h" #include "hitbox.h" +#include "object.h" +#include "room.h" extern u8 gUpdateVisibleTiles; diff --git a/src/object/objectA2.c b/src/object/objectA2.c index 1eb2fe12..5618ebd2 100644 --- a/src/object/objectA2.c +++ b/src/object/objectA2.c @@ -1,15 +1,21 @@ -#include "object.h" +/** + * @file objectA2.c + * @ingroup Objects + * + * @brief Object A2 object + */ +#include "functions.h" #include "menu.h" +#include "object.h" #include "structures.h" -#include "functions.h" -void sub_0809F318(Entity*); -void sub_0809F374(Entity*); -void sub_0809F3E8(Entity*); -void sub_0809F408(Entity*); +void ObjectA2_Init(Entity*); +void ObjectA2_Action1(Entity*); +void ObjectA2_Action2(Entity*); +void ObjectA2_Action3(Entity*); void sub_0809F448(Entity*); -void (*const gUnk_081246F4[])(Entity*) = { sub_0809F318, sub_0809F374, sub_0809F3E8, sub_0809F408 }; +void (*const ObjectA2_Actions[])(Entity*) = { ObjectA2_Init, ObjectA2_Action1, ObjectA2_Action2, ObjectA2_Action3 }; const u8 gUnk_08124704[] = { 0, 1, 2, 4 }; @@ -21,13 +27,13 @@ typedef struct { const struct_08124708 gUnk_08124708[5] = { { 0, 0x2F }, { 1, 0x20 }, { 1, 0x16 }, { 2, 0x10 }, { 3, 0x01 } }; void ObjectA2(Entity* this) { - gUnk_081246F4[this->action](this); + ObjectA2_Actions[this->action](this); GetNextFrame(this); } #define fp(n) ((n) << 8) -void sub_0809F318(Entity* this) { +void ObjectA2_Init(Entity* this) { InitializeAnimation(this, 0); if (Random() & 0x10) { this->spriteSettings.flipX = 1; @@ -41,7 +47,7 @@ void sub_0809F318(Entity* this) { SetDefaultPriority(this, PRIO_HIGHEST); } -void sub_0809F374(Entity* this) { +void ObjectA2_Action1(Entity* this) { LinearMoveUpdate(this); #ifndef EU if (gSaveHeader->language < 2) { @@ -73,14 +79,14 @@ void sub_0809F374(Entity* this) { #endif } -void sub_0809F3E8(Entity* this) { +void ObjectA2_Action2(Entity* this) { if (this->frame & ANIM_DONE) { this->action = 3; InitializeAnimation(this, 2); } } -void sub_0809F408(Entity* this) { +void ObjectA2_Action3(Entity* this) { switch (this->frame) { case 9: this->frame = 0; diff --git a/src/object/objectA7.c b/src/object/objectA7.c index bfcd80ab..a711d644 100644 --- a/src/object/objectA7.c +++ b/src/object/objectA7.c @@ -1,3 +1,9 @@ +/** + * @file objectA7.c + * @ingroup Objects + * + * @brief Object A7 object + */ #define NENT_DEPRECATED #include "entity.h" diff --git a/src/object/objectA8.c b/src/object/objectA8.c index 3830a672..05845e66 100644 --- a/src/object/objectA8.c +++ b/src/object/objectA8.c @@ -6,12 +6,12 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" +#include "collision.h" #include "functions.h" -#include "item.h" +#include "global.h" #include "hitbox.h" -#include "collision.h" +#include "item.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/objectA9.c b/src/object/objectA9.c deleted file mode 100644 index 825aac96..00000000 --- a/src/object/objectA9.c +++ /dev/null @@ -1,37 +0,0 @@ -#define NENT_DEPRECATED -#include "entity.h" -#include "sound.h" - -void sub_0809FEF8(Entity*); -void sub_0809FF28(Entity*); - -void ObjectA9(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0809FEF8, - sub_0809FF28, - DeleteEntity, - }; - - actionFuncs[this->action]((Entity*)this); -} - -void sub_0809FEF8(Entity* this) { - static const u8 typeAnimationStates[] = { 0x2, 0x0, 0x43, 0x0 }; - static const u16 typeSounds[] = { SFX_124, SFX_197, SFX_11D, SFX_NONE }; - this->action = 1; - InitializeAnimation(this, typeAnimationStates[this->type]); - SoundReq(typeSounds[this->type]); -} - -void sub_0809FF28(Entity* this) { - Entity* pEVar1; - - GetNextFrame(this); - if (this->frame & 0x80) { - this->action = 2; - pEVar1 = this->parent; - pEVar1->flags = this->timer; - pEVar1->spriteSettings.draw = this->subtimer; - ((GenericEntity*)pEVar1)->field_0x6c.HALF.HI &= 0xef; - } -} diff --git a/src/object/objectBF.c b/src/object/objectBF.c index 38cd26e6..a66a2b61 100644 --- a/src/object/objectBF.c +++ b/src/object/objectBF.c @@ -1,3 +1,9 @@ +/** + * @file objectBF.c + * @ingroup Objects + * + * @brief Object BF object + */ #include "entity.h" void ObjectBF(Entity* this) { diff --git a/src/object/objectBlockingStairs.c b/src/object/objectBlockingStairs.c index 417a3be7..8664a365 100644 --- a/src/object/objectBlockingStairs.c +++ b/src/object/objectBlockingStairs.c @@ -1,11 +1,17 @@ +/** + * @file objectBlockingStairs.c + * @ingroup Objects + * + * @brief Object Blocking Stairs object + */ #define NENT_DEPRECATED +#include "asm.h" +#include "effects.h" #include "entity.h" #include "flags.h" -#include "sound.h" #include "functions.h" -#include "asm.h" #include "object.h" -#include "effects.h" +#include "sound.h" typedef struct { Entity base; diff --git a/src/object/objectOnPillar.c b/src/object/objectOnPillar.c index 5b5e8010..1b82f909 100644 --- a/src/object/objectOnPillar.c +++ b/src/object/objectOnPillar.c @@ -6,10 +6,10 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "hitbox.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/objectOnSpinyBeetle.c b/src/object/objectOnSpinyBeetle.c index e6a96a3c..2bccf348 100644 --- a/src/object/objectOnSpinyBeetle.c +++ b/src/object/objectOnSpinyBeetle.c @@ -6,9 +6,9 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; @@ -144,7 +144,7 @@ void ObjectOnSpinyBeetle_Action2Subaction0(ObjectOnSpinyBeetleEntity* this) { super->flags2 = gPlayerEntity.flags2; super->spriteOffsetY = 0; (super->parent)->child = NULL; - super->subAction += 1; + super->subAction++; } void ObjectOnSpinyBeetle_Action2Subaction1(ObjectOnSpinyBeetleEntity* this) { @@ -270,7 +270,7 @@ void sub_08098918(ObjectOnSpinyBeetleEntity* this) { tmp = parent->flags & 0x80; if ((parent->flags & ENT_COLLIDE) != 0) { if (super->subtimer == 0) { - super->subtimer += 1; + super->subtimer++; super->spritePriority.b0 = 3; SortEntityBelow(super, super->parent); } diff --git a/src/object/octorokBossObject.c b/src/object/octorokBossObject.c index fc90f935..a1f974de 100644 --- a/src/object/octorokBossObject.c +++ b/src/object/octorokBossObject.c @@ -1,6 +1,12 @@ +/** + * @file octorokBossObject.c + * @ingroup Objects + * + * @brief Octorok Boss Object object + */ #include "functions.h" -#include "object.h" #include "game.h" +#include "object.h" extern void (*const OctorokBossObject_Actions[])(Entity*); extern const u16 gUnk_0812384C[]; @@ -242,7 +248,7 @@ NONMATCH("asm/non_matching/octorokBossObject/OctorokBossObject_Action1.inc", SetAffineInfo(this, (u32)this->field_0x76.HWORD, (u32)(u16)this->field_0x74.HWORD, (u32)(u16)this->field_0x7a.HWORD); } else { - *(int*)&this->field_0x78 -= 1; + (*(int*)&this->field_0x78)--; } CopyPosition(this->parent, this); LinearMoveAngle(this, (u32)gUnk_0812388C[(u32)this->type2 * 2 + 1], diff --git a/src/object/palaceArchway.c b/src/object/palaceArchway.c index 73d6218a..4f545bef 100644 --- a/src/object/palaceArchway.c +++ b/src/object/palaceArchway.c @@ -1,17 +1,23 @@ +/** + * @file palaceArchway.c + * @ingroup Objects + * + * @brief Palace Archway object + */ #include "object.h" -void sub_0809F2A0(Entity*); -void nullsub_537(Entity*); +void PalaceArchway_Init(Entity*); +void PalaceArchway_Action1(Entity*); void PalaceArchway(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0809F2A0, - nullsub_537, + static void (*const PalaceArchway_Actions[])(Entity*) = { + PalaceArchway_Init, + PalaceArchway_Action1, }; - actionFuncs[this->action](this); + PalaceArchway_Actions[this->action](this); } -void sub_0809F2A0(Entity* this) { +void PalaceArchway_Init(Entity* this) { this->action = 1; this->frameIndex = this->type2; this->spriteRendering.b3 = 3; @@ -19,5 +25,5 @@ void sub_0809F2A0(Entity* this) { SetTile(0x4069, COORD_TO_TILE(this), this->collisionLayer); } -void nullsub_537(Entity* this) { +void PalaceArchway_Action1(Entity* this) { } diff --git a/src/object/paper.c b/src/object/paper.c index bd81e2b9..ce3b8806 100644 --- a/src/object/paper.c +++ b/src/object/paper.c @@ -6,9 +6,9 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" void Paper_Init(Entity*); void Paper_Action1(Entity*); diff --git a/src/object/object28.c b/src/object/parallaxRoomView.c index 90c2be50..e796d683 100644 --- a/src/object/object28.c +++ b/src/object/parallaxRoomView.c @@ -1,7 +1,13 @@ +/** + * @file parallaxRoomView.c + * @ingroup Objects + * + * @brief Parallax Room View object + */ #include "entity.h" #include "room.h" -void Object28(Entity* this) { +void ParallaxRoomView(Entity* this) { int iVar1; int diffY; int diffX; diff --git a/src/object/picoBloom.c b/src/object/picoBloom.c index 184fac91..085295e4 100644 --- a/src/object/picoBloom.c +++ b/src/object/picoBloom.c @@ -1,6 +1,12 @@ +/** + * @file picoBloom.c + * @ingroup Objects + * + * @brief Pico Bloom object + */ #define NENT_DEPRECATED -#include "entity.h" #include "asm.h" +#include "entity.h" #include "sound.h" void PicoBloom_Init(Entity*); @@ -8,13 +14,13 @@ void PicoBloom_Action1(Entity*); void PicoBloom_Action2(Entity*); void PicoBloom(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { + static void (*const PicoBloom_Actions[])(Entity*) = { PicoBloom_Init, PicoBloom_Action1, PicoBloom_Action2, }; - actionFuncs[this->action](this); + PicoBloom_Actions[this->action](this); } void PicoBloom_Init(Entity* this) { diff --git a/src/object/pinwheel.c b/src/object/pinwheel.c index f3fc9873..34db5113 100644 --- a/src/object/pinwheel.c +++ b/src/object/pinwheel.c @@ -1,6 +1,12 @@ -#include "global.h" +/** + * @file pinwheel.c + * @ingroup Objects + * + * @brief Pinwheel object + */ #include "entity.h" #include "flags.h" +#include "global.h" #include "object.h" static const u16 gUnk_08125050[] = { @@ -8,15 +14,15 @@ static const u16 gUnk_08125050[] = { }; extern u32 gUnk_020342F8; -void sub_080A23DC(Entity*); -void sub_080A2420(Entity*); -void sub_080A243C(Entity*); +void Pinwheel_Init(Entity*); +void Pinwheel_Action1(Entity*); +void Pinwheel_Action2(Entity*); void Pinwheel(Entity* this) { - static void (*const gUnk_0812505C[])(Entity*) = { - sub_080A23DC, - sub_080A2420, - sub_080A243C, + static void (*const Pinwheel_Actions[])(Entity*) = { + Pinwheel_Init, + Pinwheel_Action1, + Pinwheel_Action2, }; u16 x = this->health; if ((x & 0x7f) != 0) { @@ -24,10 +30,10 @@ void Pinwheel(Entity* this) { DeleteThisEntity(); } } - gUnk_0812505C[this->action](this); + Pinwheel_Actions[this->action](this); } -void sub_080A23DC(Entity* this) { +void Pinwheel_Init(Entity* this) { this->field_0x68.HWORD = gUnk_08125050[this->type2]; this->spritePriority.b0 = 7; if (CheckLocalFlag(this->field_0x68.HWORD) != 0) { @@ -38,12 +44,12 @@ void sub_080A23DC(Entity* this) { InitializeAnimation(this, 0); } -void sub_080A2420(Entity* this) { +void Pinwheel_Action1(Entity* this) { if (CheckLocalFlag(this->field_0x68.HWORD) != 0) { this->action = 2; CreateDust(this); } } -void sub_080A243C(Entity* this) { +void Pinwheel_Action2(Entity* this) { GetNextFrame(this); } diff --git a/src/object/playerClone.c b/src/object/playerClone.c index 29ecc16e..485975d9 100644 --- a/src/object/playerClone.c +++ b/src/object/playerClone.c @@ -1,12 +1,18 @@ #define NENT_DEPRECATED -#include "entity.h" +/** + * @file playerClone.c + * @ingroup Objects + * + * @brief Player Clone object + */ +#include "asm.h" #include "collision.h" +#include "effects.h" +#include "entity.h" +#include "functions.h" +#include "player.h" #include "room.h" -#include "asm.h" #include "sound.h" -#include "player.h" -#include "functions.h" -#include "effects.h" typedef struct { Entity base; diff --git a/src/object/pot.c b/src/object/pot.c index a4f2baba..6c62da39 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -1,22 +1,28 @@ -#include "global.h" -#include "sound.h" +/** + * @file pot.c + * @ingroup Objects + * + * @brief Pot object + */ #include "entity.h" #include "flags.h" -#include "player.h" -#include "room.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "hitbox.h" +#include "object.h" +#include "player.h" +#include "room.h" +#include "sound.h" -void sub_08082824(Entity*); +void Pot_Action5(Entity*); static void sub_08082850(Entity*, Entity*); void sub_08082608(Entity*); -void sub_0808222C(Entity*); -void sub_08082310(Entity*); -void sub_080824F8(Entity*); -void sub_080826E4(Entity*); -void sub_08082614(Entity*); -void sub_08082824(Entity*); +void Pot_Init(Entity*); +void Pot_Action1(Entity*); +void Pot_Action2(Entity*); +void Pot_Action3(Entity*); +void Pot_Action4(Entity*); +void Pot_Action5(Entity*); void sub_08082510(Entity*); void nullsub_511(Entity*); void sub_08082588(Entity*); @@ -35,14 +41,14 @@ extern void RegisterCarryEntity(Entity*); extern void sub_08016A6C(Entity*); void Pot(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0808222C, sub_08082310, sub_080824F8, sub_080826E4, sub_08082614, sub_08082824, + static void (*const Pot_Actions[])(Entity*) = { + Pot_Init, Pot_Action1, Pot_Action2, Pot_Action3, Pot_Action4, Pot_Action5, }; - actionFuncs[this->action](this); + Pot_Actions[this->action](this); this->contactFlags = 0; } -void sub_0808222C(Entity* this) { +void Pot_Init(Entity* this) { if (this->type2 == 1 && CheckFlags(this->field_0x86.HWORD)) { DeleteThisEntity(); } @@ -71,7 +77,7 @@ void sub_0808222C(Entity* this) { InitializeAnimation(this, 5); } -void sub_08082310(Entity* this) { +void Pot_Action1(Entity* this) { u32 tileType; u32 var0 = this->contactFlags & 0x7F; switch (var0) { @@ -87,7 +93,7 @@ void sub_08082310(Entity* this) { this->spriteSettings.shadow = 1; this->spritePriority.b1 = 3; COLLISION_OFF(this); - sub_08082824(this); + Pot_Action5(this); break; default: tileType = GetTileTypeByEntity(this); @@ -128,7 +134,7 @@ void sub_08082310(Entity* this) { } } -void sub_080824F8(Entity* this) { +void Pot_Action2(Entity* this) { static void (*const subActionFuncs[])(Entity*) = { sub_08082510, nullsub_511, sub_08082588, sub_0808259C, sub_080825E8, sub_080825F0, sub_08082608, }; @@ -187,7 +193,7 @@ void sub_08082608(Entity* this) { this->subAction = 0; } -void sub_08082614(Entity* this) { +void Pot_Action4(Entity* this) { u32 tileType; sub_0800445C(this); @@ -220,7 +226,7 @@ void sub_08082614(Entity* this) { } } -void sub_080826E4(Entity* this) { +void Pot_Action3(Entity* this) { static void (*const subActionFuncs[])(Entity*) = { sub_080826FC, sub_0808270C, sub_08082778, sub_080827F8, nullsub_512, sub_08082818, }; @@ -271,7 +277,7 @@ void sub_08082818(Entity* this) { sub_08082850(this, NULL); } -void sub_08082824(Entity* this) { +void Pot_Action5(Entity* this) { if (this->zVelocity < 0) { this->spriteSettings.flipY = 1; } diff --git a/src/object/pressurePlate.c b/src/object/pressurePlate.c index bcbe72d1..42d8c172 100644 --- a/src/object/pressurePlate.c +++ b/src/object/pressurePlate.c @@ -1,8 +1,14 @@ +/** + * @file pressurePlate.c + * @ingroup Objects + * + * @brief Pressure Plate object + */ #define NENT_DEPRECATED -#include "object.h" +#include "collision.h" #include "functions.h" #include "hitbox.h" -#include "collision.h" +#include "object.h" typedef struct { Entity base; @@ -18,9 +24,9 @@ typedef struct { typedef void(PressurePlateAction)(PressurePlateEntity*); -PressurePlateAction sub_08088840; -PressurePlateAction sub_0808886C; -PressurePlateAction sub_080888F4; +PressurePlateAction PressurePlate_Init; +PressurePlateAction PressurePlate_Action1; +PressurePlateAction PressurePlate_Action2; static u32 sub_08088938(PressurePlateEntity*); static u32 get_standing_count(PressurePlateEntity*); @@ -28,10 +34,10 @@ static u32 get_standing_count(PressurePlateEntity*); static const u8 sSpriteOffsets[]; void PressurePlate(PressurePlateEntity* this) { - static PressurePlateAction* const sActions[] = { - sub_08088840, - sub_0808886C, - sub_080888F4, + static PressurePlateAction* const PressurePlate_Actions[] = { + PressurePlate_Init, + PressurePlate_Action1, + PressurePlate_Action2, }; if (super->subtimer) { @@ -41,10 +47,10 @@ void PressurePlate(PressurePlateEntity* this) { } } - sActions[super->action](this); + PressurePlate_Actions[super->action](this); } -void sub_08088840(PressurePlateEntity* this) { +void PressurePlate_Init(PressurePlateEntity* this) { super->action = 1; super->spriteSettings.draw = 1; super->spritePriority.b0 = 7; @@ -52,7 +58,7 @@ void sub_08088840(PressurePlateEntity* this) { this->dir = super->animationState; } -void sub_0808886C(PressurePlateEntity* this) { +void PressurePlate_Action1(PressurePlateEntity* this) { u8 weight; weight = sub_08088938(this) + get_standing_count(this); @@ -80,7 +86,7 @@ void sub_0808886C(PressurePlateEntity* this) { } } -void sub_080888F4(PressurePlateEntity* this) { +void PressurePlate_Action2(PressurePlateEntity* this) { u8 weight; if (this->canToggle) { diff --git a/src/object/pullableLever.c b/src/object/pullableLever.c index 59bdfc9a..7c2a738f 100644 --- a/src/object/pullableLever.c +++ b/src/object/pullableLever.c @@ -6,11 +6,11 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" +#include "hitbox.h" #include "object.h" -#include "functions.h" #include "sound.h" -#include "hitbox.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/pullableMushroom.c b/src/object/pullableMushroom.c index 3a4bbb7b..408cff7d 100644 --- a/src/object/pullableMushroom.c +++ b/src/object/pullableMushroom.c @@ -6,11 +6,11 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" #include "game.h" +#include "global.h" #include "hitbox.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; @@ -169,7 +169,7 @@ void sub_0808ACEC(PullableMushroomEntity* this) { void sub_0808ADA0(PullableMushroomEntity* this) { if ((sub_0808B1F0(this, super->child) < 8) || (super->child == NULL)) { - super->subAction += 1; + super->subAction++; super->timer = 2; super->flags |= ENT_COLLIDE; super->animationState ^= 2; @@ -222,7 +222,7 @@ void sub_0808AEB0(PullableMushroomEntity* this) { u32 uVar1; if (super->timer != 0) { uVar1 = sub_0808B1F0(this, super->child); - if ((gPlayerState.field_0x90 & gUnk_081211E4[super->animationState]) != 0) { + if ((gPlayerState.playerInput.field_0x90 & gUnk_081211E4[super->animationState]) != 0) { GetNextFrame(super); if (uVar1 < 0x40) { sub_080044AE(&gPlayerEntity, 0x40, super->direction); diff --git a/src/object/pushableFurniture.c b/src/object/pushableFurniture.c index 00bc0ffb..22efed6f 100644 --- a/src/object/pushableFurniture.c +++ b/src/object/pushableFurniture.c @@ -6,9 +6,9 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/pushableGrave.c b/src/object/pushableGrave.c index c3cf2ba5..da643ccb 100644 --- a/src/object/pushableGrave.c +++ b/src/object/pushableGrave.c @@ -6,10 +6,10 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "hitbox.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; @@ -27,7 +27,7 @@ typedef struct { /*0x86*/ u16 pushedFlag; } PushableGraveEntity; -extern void (*const gUnk_081232AC[])(PushableGraveEntity*); +extern void (*const PushableGrave_Actions[])(PushableGraveEntity*); extern const u8 gUnk_081232C0[]; extern const u16 PushableGrave_Tiles[]; @@ -36,7 +36,7 @@ void sub_080977F4(PushableGraveEntity*); bool32 sub_0809785C(PushableGraveEntity*); void PushableGrave(PushableGraveEntity* this) { - gUnk_081232AC[super->action](this); + PushableGrave_Actions[super->action](this); } void PushableGrave_Init(PushableGraveEntity* this) { @@ -197,7 +197,7 @@ bool32 sub_0809798C(PushableGraveEntity* this) { return result; } -void (*const gUnk_081232AC[])(PushableGraveEntity*) = { +void (*const PushableGrave_Actions[])(PushableGraveEntity*) = { PushableGrave_Init, PushableGrave_Action1, PushableGrave_Action2, PushableGrave_Action3, PushableGrave_Action4, }; diff --git a/src/object/pushableLever.c b/src/object/pushableLever.c index 5eddfe98..3c8ee887 100644 --- a/src/object/pushableLever.c +++ b/src/object/pushableLever.c @@ -6,9 +6,9 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/pushableRock.c b/src/object/pushableRock.c index 20c84f43..56b2e10c 100644 --- a/src/object/pushableRock.c +++ b/src/object/pushableRock.c @@ -6,9 +6,9 @@ */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/pushableStatue.c b/src/object/pushableStatue.c index 7e815deb..099d96e5 100644 --- a/src/object/pushableStatue.c +++ b/src/object/pushableStatue.c @@ -4,7 +4,6 @@ * * @brief Pushable Statue object */ - #define NENT_DEPRECATED #include "global.h" #include "object.h" @@ -251,12 +250,11 @@ u32 sub_0808968C(u32 param_1) { return 0; } -NONMATCH("asm/non_matching/pushableStatue/sub_080896B0.inc", bool32 sub_080896B0(void)) { +bool32 sub_080896B0(void) { s16 uVar1; s16 iVar2; - u8* puVar3; - LayerStruct* puVar5; - u32 uVar4; + LayerStruct* layer; + s32 uVar4; const s16* ptr; u32 tmp1; u32 tmp2; @@ -267,12 +265,11 @@ NONMATCH("asm/non_matching/pushableStatue/sub_080896B0.inc", bool32 sub_080896B0 uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1]; uVar4 = COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]) - uVar1; val = sub_080B1AE0(uVar4, gPlayerEntity.collisionLayer); - if ((1 < val - 0x26) && (val != 0x29)) { - puVar5 = GetLayerByIndex((u32)gPlayerEntity.collisionLayer); - iVar2 = (s32)(uVar4 * 0x10000) >> 0x10; - puVar3 = puVar5->collisionData; - tmp1 = puVar3[iVar2]; - tmp2 = puVar3[(iVar2 - uVar1)]; + if ((val - 0x26 > 1) && (val != 0x29)) { + layer = GetLayerByIndex(gPlayerEntity.collisionLayer); + iVar2 = (uVar4 * 0x10000) >> 0x10; + tmp1 = layer->collisionData[iVar2]; + tmp2 = layer->collisionData[(iVar2 - uVar1)]; if ((tmp1 == 0) && (tmp2 == 0)) { return TRUE; } @@ -280,7 +277,6 @@ NONMATCH("asm/non_matching/pushableStatue/sub_080896B0.inc", bool32 sub_080896B0 } return FALSE; } -END_NONMATCH void (*const PushableStatue_Actions[])(PushableStatueEntity*) = { PushableStatue_Init, PushableStatue_Action1, PushableStatue_Action2, PushableStatue_Action3, PushableStatue_Action4, diff --git a/src/object/railtrack.c b/src/object/railtrack.c index e4ffbce2..5a77c8db 100644 --- a/src/object/railtrack.c +++ b/src/object/railtrack.c @@ -1,32 +1,38 @@ -#include "global.h" +/** + * @file railtrack.c + * @ingroup Objects + * + * @brief Railtrack object + */ #include "asm.h" -#include "sound.h" #include "entity.h" -#include "room.h" #include "flags.h" #include "functions.h" +#include "global.h" +#include "room.h" +#include "sound.h" void sub_08085394(Entity*); void sub_0808543C(Entity*); -void sub_080851AC(Entity*); -void sub_08085264(Entity*); -void sub_080852B4(Entity*); -void sub_08085308(Entity*); +void Railtrack_Init(Entity*); +void Railtrack_Action1(Entity*); +void Railtrack_Action2(Entity*); +void Railtrack_Action3(Entity*); u32 sub_080854A8(Entity*); extern s8 gUnk_080B4488[][2]; void Railtrack(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_080851AC, - sub_08085264, - sub_080852B4, - sub_08085308, + static void (*const Railtrack_Actions[])(Entity*) = { + Railtrack_Init, + Railtrack_Action1, + Railtrack_Action2, + Railtrack_Action3, }; - actionFuncs[this->action](this); + Railtrack_Actions[this->action](this); } -void sub_080851AC(Entity* this) { +void Railtrack_Init(Entity* this) { u32 uVar1; this->action = 1; @@ -51,7 +57,7 @@ void sub_080851AC(Entity* this) { sub_08085394(this); } -void sub_08085264(Entity* this) { +void Railtrack_Action1(Entity* this) { if (CheckFlags(this->field_0x86.HWORD)) { this->action = 2; this->subtimer = 8; @@ -65,7 +71,7 @@ void sub_08085264(Entity* this) { } } -void sub_080852B4(Entity* this) { +void Railtrack_Action2(Entity* this) { if (--this->subtimer == 0) { this->action = 3; this->subtimer = this->timer; @@ -77,7 +83,7 @@ void sub_080852B4(Entity* this) { } } -void sub_08085308(Entity* this) { +void Railtrack_Action3(Entity* this) { if (sub_080854A8(this) == 0) { switch (this->type) { case 0: diff --git a/src/object/object44.c b/src/object/rotatingTrapdoor.c index b73c0bca..9aa0f947 100644 --- a/src/object/object44.c +++ b/src/object/rotatingTrapdoor.c @@ -1,24 +1,30 @@ +/** + * @file rotatingTrapdoor.c + * @ingroup Objects + * + * @brief Rotating Trapdoor object + */ #define NENT_DEPRECATED -#include "entity.h" #include "asm.h" -#include "sound.h" -#include "room.h" +#include "entity.h" #include "functions.h" +#include "room.h" +#include "sound.h" -void sub_0808E298(Entity*); -void sub_0808E318(Entity*); +void RotatingTrapdoor_Init(Entity*); +void RotatingTrapdoor_Action1(Entity*); void sub_0808E354(Entity*, u32); -void Object44(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0808E298, - sub_0808E318, +void RotatingTrapdoor(Entity* this) { + static void (*const RotatingTrapdoor_Actions[])(Entity*) = { + RotatingTrapdoor_Init, + RotatingTrapdoor_Action1, }; - actionFuncs[this->action]((Entity*)this); + RotatingTrapdoor_Actions[this->action]((Entity*)this); } -void sub_0808E298(Entity* this) { +void RotatingTrapdoor_Init(Entity* this) { int x; int y; @@ -46,10 +52,10 @@ void sub_0808E298(Entity* this) { this->y.HALF.HI = (this->y.HALF.HI + y) & 0xfff0; InitializeAnimation(this, 0); sub_0808E354(this, 0x347); - sub_0808E318(this); + RotatingTrapdoor_Action1(this); } -void sub_0808E318(Entity* this) { +void RotatingTrapdoor_Action1(Entity* this) { GetNextFrame(this); if (this->frame & ANIM_DONE) { sub_0808E354(this, 0x343); diff --git a/src/object/rupee.c b/src/object/rupee.c index f511f652..2d0756d8 100644 --- a/src/object/rupee.c +++ b/src/object/rupee.c @@ -1,17 +1,30 @@ -#include "object.h" +/** + * @file rupee.c + * @ingroup Objects + * + * @brief Rupee object + */ #include "functions.h" #include "hitbox.h" +#include "object.h" void sub_08086A6C(Entity*); - -void (*const gUnk_081206C4[])(Entity*); +void Rupee_Init(Entity*); +void Rupee_Action_1(Entity*); +void Rupee_Action_2(Entity*); // Main void Rupee(Entity* ent) { - gUnk_081206C4[ent->action](ent); + static void (*const Rupee_Actions[])(Entity*) = { + Rupee_Init, + Rupee_Action_1, + Rupee_Action_2, + }; + + Rupee_Actions[ent->action](ent); } -void sub_080869DC(Entity* ent) { +void Rupee_Init(Entity* ent) { Entity* itemEntity; ent->action = 1; @@ -28,7 +41,7 @@ void sub_080869DC(Entity* ent) { } } -void sub_08086A28(Entity* ent) { +void Rupee_Action_1(Entity* ent) { if (ent->child->next == NULL) { ent->action = 2; } else { @@ -41,7 +54,7 @@ void sub_08086A28(Entity* ent) { } } -void sub_08086A5C(Entity* ent) { +void Rupee_Action_2(Entity* ent) { ent->child->parent = NULL; DeleteThisEntity(); } @@ -54,9 +67,3 @@ void sub_08086A6C(Entity* ent) { ent->direction = DirectionNormalize(uVar1 >> 16); ent->speed = uVar1 & 480; } - -void (*const gUnk_081206C4[])(Entity*) = { - sub_080869DC, - sub_08086A28, - sub_08086A5C, -}; diff --git a/src/object/objectA6.c b/src/object/sanctuaryStoneTablet.c index bea33868..4a107f5a 100644 --- a/src/object/objectA6.c +++ b/src/object/sanctuaryStoneTablet.c @@ -1,28 +1,34 @@ +/** + * @file sanctuaryStoneTablet.c + * @ingroup Objects + * + * @brief Sanctuary Stone Tablet object + */ #define NENT_DEPRECATED +#include "effects.h" #include "entity.h" #include "flags.h" #include "hitbox.h" -#include "effects.h" typedef struct { Entity base; u8 filler[0x1E]; u16 objFlags; -} ObjectA6Entity; +} SanctuaryStoneTabletEntity; -void sub_0809F920(ObjectA6Entity*); -void sub_0809F964(ObjectA6Entity*); +void SanctuaryStoneTablet_Init(SanctuaryStoneTabletEntity*); +void SanctuaryStoneTablet_Action1(SanctuaryStoneTabletEntity*); -void ObjectA6(Entity* this) { - static void (*const actionFuncs[])(ObjectA6Entity*) = { - sub_0809F920, - sub_0809F964, +void SanctuaryStoneTablet(Entity* this) { + static void (*const SanctuaryStoneTablet_Actions[])(SanctuaryStoneTabletEntity*) = { + SanctuaryStoneTablet_Init, + SanctuaryStoneTablet_Action1, }; - actionFuncs[this->action]((ObjectA6Entity*)this); + SanctuaryStoneTablet_Actions[this->action]((SanctuaryStoneTabletEntity*)this); } -void sub_0809F920(ObjectA6Entity* this) { +void SanctuaryStoneTablet_Init(SanctuaryStoneTabletEntity* this) { if (CheckFlags(this->objFlags)) { DeleteThisEntity(); } @@ -36,7 +42,7 @@ void sub_0809F920(ObjectA6Entity* this) { super->hitbox = (Hitbox*)&gHitbox_0; } -void sub_0809F964(ObjectA6Entity* this) { +void SanctuaryStoneTablet_Action1(SanctuaryStoneTabletEntity* this) { Entity* fxEnt; if (super->contactFlags == 0xa1) { diff --git a/src/object/object79.c b/src/object/shrinkingHieroglyphs.c index 19b4bd0d..be8462b5 100644 --- a/src/object/object79.c +++ b/src/object/shrinkingHieroglyphs.c @@ -1,7 +1,13 @@ +/** + * @file shrinkingHieroglyphs.c + * @ingroup Objects + * + * @brief Shrinking Hieroglyphs object + */ #define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "functions.h" +#include "player.h" #include "sound.h" typedef struct { @@ -14,37 +20,37 @@ typedef struct { u16 unk7a; u16 unk7c; s16 unk7e; -} Object79Entity; +} ShrinkingHieroglyphsEntity; -void Object79_Init(Object79Entity*); -void Object79_Action1(Object79Entity*); -void Object79_Action2(Object79Entity*); -void sub_08098130(Object79Entity*); +void ShrinkingHieroglyphs_Init(ShrinkingHieroglyphsEntity*); +void ShrinkingHieroglyphs_Action1(ShrinkingHieroglyphsEntity*); +void ShrinkingHieroglyphs_Action2(ShrinkingHieroglyphsEntity*); +void sub_08098130(ShrinkingHieroglyphsEntity*); -void Object79(Entity* this) { - static void (*const actionFuncs[])(Object79Entity*) = { - Object79_Init, - Object79_Action1, - Object79_Action2, +void ShrinkingHieroglyphs(Entity* this) { + static void (*const ShrinkingHieroglyphs_Actions[])(ShrinkingHieroglyphsEntity*) = { + ShrinkingHieroglyphs_Init, + ShrinkingHieroglyphs_Action1, + ShrinkingHieroglyphs_Action2, }; if ((gPlayerState.flags & PL_MINISH) != 0) { DeleteThisEntity(); } - actionFuncs[this->action]((Object79Entity*)this); + ShrinkingHieroglyphs_Actions[this->action]((ShrinkingHieroglyphsEntity*)this); } -void Object79_Init(Object79Entity* this) { - static const u8 Object79_Directions[] = { DirectionSouthWest, DirectionWest, DirectionNorthWest, - DirectionNorthEast, DirectionEast, DirectionSouthEast }; +void ShrinkingHieroglyphs_Init(ShrinkingHieroglyphsEntity* this) { + static const u8 ShrinkingHieroglyphs_Directions[] = { DirectionSouthWest, DirectionWest, DirectionNorthWest, + DirectionNorthEast, DirectionEast, DirectionSouthEast }; super->action++; super->speed = 0; this->unk6c = 0; this->unk7a = 0x1200; super->timer = 0; super->subtimer = 30; - this->objDir.HALF.HI = Object79_Directions[super->type]; + this->objDir.HALF.HI = ShrinkingHieroglyphs_Directions[super->type]; this->unk74 = 0x2000; SetDefaultPriority(super, 6); if (super->type == 0) { @@ -60,7 +66,7 @@ void Object79_Init(Object79Entity* this) { sub_08098130(this); } -void Object79_Action1(Object79Entity* this) { +void ShrinkingHieroglyphs_Action1(ShrinkingHieroglyphsEntity* this) { if (super->type == 0) { UpdateAnimationSingleFrame(super); if (super->type2 != 0) { @@ -76,7 +82,7 @@ void Object79_Action1(Object79Entity* this) { } } -void Object79_Action2(Object79Entity* this) { +void ShrinkingHieroglyphs_Action2(ShrinkingHieroglyphsEntity* this) { if (this->unk6c >= 0x140001) { gPlayerState.flags |= PL_MINISH; DeleteThisEntity(); @@ -103,7 +109,7 @@ void Object79_Action2(Object79Entity* this) { } } -void sub_08098130(Object79Entity* this) { +void sub_08098130(ShrinkingHieroglyphsEntity* this) { CopyPosition(&gPlayerEntity, super); super->direction = this->objDir.HALF.HI; super->speed = this->unk7a; diff --git a/src/object/smallIceBlock.c b/src/object/smallIceBlock.c index 1a771c05..54a5bd7e 100644 --- a/src/object/smallIceBlock.c +++ b/src/object/smallIceBlock.c @@ -34,13 +34,13 @@ void SmallIceBlock_Action3(SmallIceBlockEntity*); bool32 sub_0809953C(SmallIceBlockEntity*); void sub_0809969C(SmallIceBlockEntity*); -extern void (*const gUnk_08123734[])(SmallIceBlockEntity*); +extern void (*const SmallIceBlock_Actions[])(SmallIceBlockEntity*); extern const u16 gUnk_08123748[]; extern const u16 gUnk_08123750[]; void SmallIceBlock(SmallIceBlockEntity* this) { if (super->type < 3) { - gUnk_08123734[super->action](this); + SmallIceBlock_Actions[super->action](this); } else { sub_080996AC(this); } @@ -311,14 +311,14 @@ void sub_080996AC(SmallIceBlockEntity* this) { } GetNextFrame(super); CopyPositionAndSpriteOffset(super->parent, super); - super->y.HALF.HI += 1; + super->y.HALF.HI++; super->spriteOffsetY -= 0x11; } else { super->spriteSettings.draw = 0; } } -void (*const gUnk_08123734[])(SmallIceBlockEntity*) = { +void (*const SmallIceBlock_Actions[])(SmallIceBlockEntity*) = { SmallIceBlock_Init, SmallIceBlock_Action1, SmallIceBlock_Action2, SmallIceBlock_Action3, SmallIceBlock_Action4, }; const u16 gUnk_08123748[] = { diff --git a/src/object/smoke.c b/src/object/smoke.c index 64d7d974..afe2f97e 100644 --- a/src/object/smoke.c +++ b/src/object/smoke.c @@ -1,3 +1,9 @@ +/** + * @file smoke.c + * @ingroup Objects + * + * @brief Smoke object + */ #include "object.h" void sub_0808A40C(Entity*); diff --git a/src/object/object20.c b/src/object/smokeParticle.c index 41996212..8cca7eff 100644 --- a/src/object/object20.c +++ b/src/object/smokeParticle.c @@ -1,22 +1,21 @@ /** - * @file object20.c + * @file smokeParticle.c * @ingroup Objects * - * @brief Object20 object + * @brief Smoke Particle object */ - #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" -void sub_08087824(Entity*); -void sub_08087888(Entity*); +void SmokeParticle_Init(Entity*); +void SmokeParticle_Action1(Entity*); void sub_080878CC(Entity*); -void (*const gUnk_08120A28[])(Entity*) = { - sub_08087824, - sub_08087888, +void (*const SmokeParticle_Actions[])(Entity*) = { + SmokeParticle_Init, + SmokeParticle_Action1, }; const Hitbox3D gUnk_08120A30 = { 0, 0, { 0, 0, 0, 0 }, 6, 6, 10, { 0, 0, 0 } }; const Hitbox3D gUnk_08120A3C = { 0, 0, { 0, 0, 0, 0 }, 12, 12, 16, { 0, 0, 0 } }; @@ -24,11 +23,11 @@ const Hitbox3D gUnk_08120A48 = { 0, 0, { 0, 0, 0, 0 }, 16, 16, 20, { 0, 0, 0 } } const Hitbox3D* const gUnk_08120A54[] = { &gUnk_08120A30, &gUnk_08120A30, &gUnk_08120A48, &gUnk_08120A3C, &gUnk_08120A3C }; -void Object20(Entity* this) { - gUnk_08120A28[this->action](this); +void SmokeParticle(Entity* this) { + SmokeParticle_Actions[this->action](this); } -void sub_08087824(Entity* this) { +void SmokeParticle_Init(Entity* this) { if (this->collisionLayer == 0) { ResolveCollisionLayer(this); } @@ -46,7 +45,7 @@ void sub_08087824(Entity* this) { EnqueueSFX(SFX_ITEM_BOMB_EXPLODE); } -void sub_08087888(Entity* this) { +void SmokeParticle_Action1(Entity* this) { GetNextFrame(this); if ((this->frame & ANIM_DONE) != 0) { DeleteThisEntity(); diff --git a/src/object/object52.c b/src/object/specialChest.c index d5905484..2d0264be 100644 --- a/src/object/object52.c +++ b/src/object/specialChest.c @@ -1,12 +1,18 @@ +/** + * @file specialChest.c + * @ingroup Objects + * + * @brief Special Chest object + */ #define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "room.h" extern void sub_08078828(Entity*); -extern void sub_080A7C8C(u32 pos, u32 layer); +extern void OpenSmallChest(u32 pos, u32 layer); -void Object52(Entity* this) { +void SpecialChest(Entity* this) { if (this->action == 0) { if (CheckLocalFlag(this->type)) { DeleteThisEntity(); @@ -16,7 +22,7 @@ void Object52(Entity* this) { sub_08078828(this); } if (this->interactType != 0) { - sub_080A7C8C(COORD_TO_TILE(this), 2); + OpenSmallChest(COORD_TO_TILE(this), 2); DeleteThisEntity(); } } diff --git a/src/object/specialFx.c b/src/object/specialFx.c index f0ec7d46..46436ea8 100644 --- a/src/object/specialFx.c +++ b/src/object/specialFx.c @@ -1,8 +1,14 @@ #define NENT_DEPRECATED -#include "global.h" +/** + * @file specialFx.c + * @ingroup Objects + * + * @brief Special FX object + */ #include "entity.h" -#include "object.h" #include "functions.h" +#include "global.h" +#include "object.h" typedef struct { Entity base; diff --git a/src/object/steam.c b/src/object/steam.c index 393888b5..d3b7a13e 100644 --- a/src/object/steam.c +++ b/src/object/steam.c @@ -1,9 +1,15 @@ +/** + * @file steam.c + * @ingroup Objects + * + * @brief Steam object + */ #define NENT_DEPRECATED +#include "asm.h" #include "entity.h" -#include "screen.h" #include "player.h" #include "room.h" -#include "asm.h" +#include "screen.h" const u8 gUnk_08123484[]; diff --git a/src/object/stoneTablet.c b/src/object/stoneTablet.c index a6888bfd..ad01fcda 100644 --- a/src/object/stoneTablet.c +++ b/src/object/stoneTablet.c @@ -1,20 +1,26 @@ +/** + * @file stoneTablet.c + * @ingroup Objects + * + * @brief Stone Tablet object + */ #include "entity.h" -#include "room.h" #include "functions.h" +#include "room.h" -void sub_080979CC(Entity*); -void nullsub_529(Entity*); +void StoneTablet_Init(Entity*); +void StoneTablet_Action1(Entity*); void StoneTablet(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_080979CC, - nullsub_529, + static void (*const StoneTablet_Actions[])(Entity*) = { + StoneTablet_Init, + StoneTablet_Action1, }; - actionFuncs[this->action](this); + StoneTablet_Actions[this->action](this); } -void sub_080979CC(Entity* this) { +void StoneTablet_Init(Entity* this) { // TODO recreate as TileData[] static const u16 gUnk_081232EC[] = { 0x4022, 0xfffe, 0x4022, 0xffff, 0x4022, 0x0, 0x4022, 0x1, 0xffff }; static const u16 gUnk_081232FE[] = { 0x4065, 0xffbf, 0x4022, 0xffc0, 0x4066, 0xffc1, 0x4029, @@ -30,5 +36,5 @@ void sub_080979CC(Entity* this) { } } -void nullsub_529(Entity* this) { +void StoneTablet_Action1(Entity* this) { } diff --git a/src/object/object43.c b/src/object/swordParticle.c index f284d2a8..fbdb0e52 100644 --- a/src/object/object43.c +++ b/src/object/swordParticle.c @@ -1,15 +1,14 @@ /** - * @file object43.c + * @file swordParticle.c * @ingroup Objects * - * @brief Object43 object + * @brief Sword Particle object */ - #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "item.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; @@ -17,22 +16,22 @@ typedef struct { /*0x6c*/ u16 unk_6c; /*0x6e*/ u8 unk_7e[4]; /*0x72*/ u16 unk_72; -} Object43Entity; +} SwordParticleEntity; -void Object43_Init(Object43Entity*); -void Object43_Action1(Object43Entity*); -void Object43_Action2(Object43Entity*); -void Object43_Action3(Object43Entity*); -void Object43_Action4(Object43Entity*); +void SwordParticle_Init(SwordParticleEntity*); +void SwordParticle_Action1(SwordParticleEntity*); +void SwordParticle_Action2(SwordParticleEntity*); +void SwordParticle_Action3(SwordParticleEntity*); +void SwordParticle_Action4(SwordParticleEntity*); -void Object43(Object43Entity* this) { - static void (*const Object43_Actions[])(Object43Entity*) = { - Object43_Init, Object43_Action1, Object43_Action2, Object43_Action3, Object43_Action4, +void SwordParticle(SwordParticleEntity* this) { + static void (*const SwordParticle_Actions[])(SwordParticleEntity*) = { + SwordParticle_Init, SwordParticle_Action1, SwordParticle_Action2, SwordParticle_Action3, SwordParticle_Action4, }; - Object43_Actions[super->action](this); + SwordParticle_Actions[super->action](this); } -void Object43_Init(Object43Entity* this) { +void SwordParticle_Init(SwordParticleEntity* this) { super->action = 1; super->flags |= ENT_PERSIST; super->spritePriority.b0 = 0; @@ -57,11 +56,11 @@ void Object43_Init(Object43Entity* this) { super->timer = 80; } - Object43_Action1(this); + SwordParticle_Action1(this); } } -void Object43_Action1(Object43Entity* this) { +void SwordParticle_Action1(SwordParticleEntity* this) { static const s8 gUnk_081217D0[] = { -1, -14, 8, -4, 4, 4, -8, -4 }; static const s8 gUnk_081217D8[] = { -1, -14, 4, -4, 4, -1, -4, -4 }; Entity* effect; @@ -167,9 +166,9 @@ void Object43_Action1(Object43Entity* this) { } } -void Object43_Action2(Object43Entity* this) { +void SwordParticle_Action2(SwordParticleEntity* this) { sub_08079BD8(super); - super->action += 1; + super->action++; super->spriteSettings.draw = 1; super->animationState = gPlayerEntity.animationState; super->spriteVramOffset = 0; @@ -178,7 +177,7 @@ void Object43_Action2(Object43Entity* this) { InitializeAnimation(super, super->animationState >> 1); } -void Object43_Action3(Object43Entity* this) { +void SwordParticle_Action3(SwordParticleEntity* this) { sub_08079BD8(super); GetNextFrame(super); if (gPlayerState.sword_state != 0) { @@ -195,7 +194,7 @@ void Object43_Action3(Object43Entity* this) { } } -void Object43_Action4(Object43Entity* this) { +void SwordParticle_Action4(SwordParticleEntity* this) { GetNextFrame(super); if ((super->frame & ANIM_DONE) != 0) { DeleteThisEntity(); diff --git a/src/object/swordsmanNewsletter.c b/src/object/swordsmanNewsletter.c index 4c9fdd8f..f296de5a 100644 --- a/src/object/swordsmanNewsletter.c +++ b/src/object/swordsmanNewsletter.c @@ -1,22 +1,28 @@ -#include "global.h" +/** + * @file swordsmanNewsletter.c + * @ingroup Objects + * + * @brief Swordsman Newsletter object + */ #include "entity.h" +#include "global.h" #include "message.h" extern void sub_080787B4(Entity*); -void sub_080933D8(Entity*); -void sub_080933FC(Entity*); +void SwordsmanNewsletter_Init(Entity*); +void SwordsmanNewsletter_Action1(Entity*); static const Hitbox gUnk_081228A8 = { 0, 0, {}, 6, 8 }; void SwordsmanNewsletter(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_080933D8, - sub_080933FC, + static void (*const SwordsmanNewsletter_Actions[])(Entity*) = { + SwordsmanNewsletter_Init, + SwordsmanNewsletter_Action1, }; - actionFuncs[this->action](this); + SwordsmanNewsletter_Actions[this->action](this); } -void sub_080933D8(Entity* this) { +void SwordsmanNewsletter_Init(Entity* this) { this->action = 1; this->frameIndex = this->type; UpdateSpriteForCollisionLayer(this); @@ -24,7 +30,7 @@ void sub_080933D8(Entity* this) { sub_080787B4(this); } -void sub_080933FC(Entity* this) { +void SwordsmanNewsletter_Action1(Entity* this) { static const u16 messageIndices[] = { TEXT_INDEX(TEXT_NEWSLETTER, 1), TEXT_INDEX(TEXT_NEWSLETTER, 2), TEXT_INDEX(TEXT_NEWSLETTER, 3), TEXT_INDEX(TEXT_NEWSLETTER, 4), TEXT_INDEX(TEXT_NEWSLETTER, 5), TEXT_INDEX(TEXT_NEWSLETTER, 6), diff --git a/src/object/thoughtBubble.c b/src/object/thoughtBubble.c index 14e9a38a..d6f39c27 100644 --- a/src/object/thoughtBubble.c +++ b/src/object/thoughtBubble.c @@ -1,5 +1,11 @@ -#include "global.h" +/** + * @file thoughtBubble.c + * @ingroup Objects + * + * @brief Thought Bubble object + */ #include "entity.h" +#include "global.h" #include "sound.h" void ThoughtBubble_Init(Entity*); diff --git a/src/object/object64.c b/src/object/thunderbold.c index e0f20c1e..6128b74d 100644 --- a/src/object/object64.c +++ b/src/object/thunderbold.c @@ -1,23 +1,23 @@ /** - * @file object64.c + * @file thunderbold.c * @ingroup Objects * - * @brief Object64 object + * @brief Thunderbold object */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" typedef struct { /*0x00*/ Entity base; -} Object64Entity; +} ThunderboldEntity; -void sub_08093E3C(Object64Entity*); -void sub_08093EAC(Object64Entity*); -void sub_08093ED0(Object64Entity*); -void sub_08093EF0(Object64Entity*); +void Thunderbold_Init(ThunderboldEntity*); +void Thunderbold_Action1(ThunderboldEntity*); +void sub_08093ED0(ThunderboldEntity*); +void sub_08093EF0(ThunderboldEntity*); typedef struct { u16 sfx; @@ -31,15 +31,15 @@ const struct_08122950 gUnk_08122950[] = { { 0, 31, 0 }, }; -void Object64(Object64Entity* this) { - static void (*const gUnk_0812295C[])(Object64Entity*) = { - sub_08093E3C, - sub_08093EAC, +void Thunderbold(ThunderboldEntity* this) { + static void (*const Thunderbold_Actions[])(ThunderboldEntity*) = { + Thunderbold_Init, + Thunderbold_Action1, }; - gUnk_0812295C[super->action](this); + Thunderbold_Actions[super->action](this); } -void sub_08093E3C(Object64Entity* this) { +void Thunderbold_Init(ThunderboldEntity* this) { const struct_08122950* ptr; super->action = 1; super->flags &= 0x7f; @@ -57,22 +57,22 @@ void sub_08093E3C(Object64Entity* this) { } } -void sub_08093EAC(Object64Entity* this) { - static void (*const gUnk_08122964[])(Object64Entity*) = { +void Thunderbold_Action1(ThunderboldEntity* this) { + static void (*const gUnk_08122964[])(ThunderboldEntity*) = { sub_08093ED0, sub_08093EF0, }; gUnk_08122964[gUnk_08122950[super->type].unk_2 >> 4](this); } -void sub_08093ED0(Object64Entity* this) { +void sub_08093ED0(ThunderboldEntity* this) { GetNextFrame(super); if ((super->frame & ANIM_DONE) != 0) { DeleteEntity(super); } } -void sub_08093EF0(Object64Entity* this) { +void sub_08093EF0(ThunderboldEntity* this) { Entity* object; switch (super->type) { case 0: @@ -83,7 +83,7 @@ void sub_08093EF0(Object64Entity* this) { if ((super->frame & ANIM_DONE) == 0) { return; } - object = CreateObject(OBJECT_64, 1, 0); + object = CreateObject(THUNDERBOLD, 1, 0); if (object != NULL) { object->parent = super->parent; CopyPosition(super, object); @@ -94,7 +94,7 @@ void sub_08093EF0(Object64Entity* this) { GetNextFrame(super); if ((super->frame & 1) != 0) { super->frame = 0; - object = CreateObject(OBJECT_64, 2, 0); + object = CreateObject(THUNDERBOLD, 2, 0); if (object != NULL) { object->parent = super->parent; CopyPosition(super, object); diff --git a/src/object/objectBD.c b/src/object/titleScreenObject.c index 58405d7d..27f15290 100644 --- a/src/object/objectBD.c +++ b/src/object/titleScreenObject.c @@ -1,18 +1,17 @@ /** - * @file objectBD.c + * @file titleScreenObject.c * @ingroup Objects * - * @brief ObjectBD object + * @brief Title Screen object */ - #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" -void sub_080A2274(Entity*); -void sub_080A22B0(Entity*); -void sub_080A22C4(Entity*); +void TitleScreenObject_Type0(Entity*); +void TitleScreenObject_Type1(Entity*); +void TitleScreenObject_Type4(Entity*); void sub_080A2340(Entity*); typedef struct { @@ -27,38 +26,39 @@ const struct_08125014 gUnk_08125014[] = { { 120, 48, 16, 4, 0 }, { 136, 81, 22, 3, 0 }, { 190, 20, 25, 2, 0 }, { 192, 81, 26, 2, 0 }, { 32, 104, 27, 3, 0 }, }; -void ObjectBD(Entity* this) { - static void (*const gUnk_0812503C[])(Entity*) = { - sub_080A2274, sub_080A22B0, sub_080A22B0, sub_080A22B0, sub_080A22C4, +void TitleScreenObject(Entity* this) { + static void (*const TitleScreenObject_Types[])(Entity*) = { + TitleScreenObject_Type0, TitleScreenObject_Type1, TitleScreenObject_Type1, + TitleScreenObject_Type1, TitleScreenObject_Type4, }; - gUnk_0812503C[this->type](this); + TitleScreenObject_Types[this->type](this); } -void sub_080A2274(Entity* this) { +void TitleScreenObject_Type0(Entity* this) { u32 addr; u32 type; if (this->action == 0) { sub_080A2340(this); - CreateObject(OBJECT_BD, 1, 0); + CreateObject(TITLE_SCREEN_OBJECT, 1, 0); addr = 0x02000000; // TODO write to 0x2000007 if (*(u8*)(addr + 7) == 1) { type = 2; } else { type = 3; } - CreateObject(OBJECT_BD, type, 0); - CreateObject(OBJECT_BD, 4, 0); + CreateObject(TITLE_SCREEN_OBJECT, type, 0); + CreateObject(TITLE_SCREEN_OBJECT, 4, 0); } } -void sub_080A22B0(Entity* this) { +void TitleScreenObject_Type1(Entity* this) { if (this->action == 0) { sub_080A2340(this); } } -void sub_080A22C4(Entity* this) { +void TitleScreenObject_Type4(Entity* this) { u32 tmp1, tmp2, tmp3; switch (this->action) { diff --git a/src/object/object86.c b/src/object/trapdoor.c index 5a2f2ac8..c28517e9 100644 --- a/src/object/object86.c +++ b/src/object/trapdoor.c @@ -1,22 +1,28 @@ -#include "object.h" +/** + * @file trapdoor.c + * @ingroup Objects + * + * @brief Trapdoor object + */ #include "item.h" +#include "object.h" void sub_08099ECC(Entity*); -void sub_08099DD0(Entity*); -void sub_08099E10(Entity*); -void sub_08099E58(Entity*); -void sub_08099E8C(Entity*); -void nullsub_534(Entity*); +void Trapdoor_Init(Entity*); +void Trapdoor_Action1(Entity*); +void Trapdoor_Action2(Entity*); +void Trapdoor_Action3(Entity*); +void Trapdoor_Action4(Entity*); extern void CreateHoleManager(u32); -void Object86(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_08099DD0, sub_08099E10, sub_08099E58, sub_08099E8C, nullsub_534, +void Trapdoor(Entity* this) { + static void (*const Trapdoor_Actions[])(Entity*) = { + Trapdoor_Init, Trapdoor_Action1, Trapdoor_Action2, Trapdoor_Action3, Trapdoor_Action4, }; - actionFuncs[this->action](this); + Trapdoor_Actions[this->action](this); } -void sub_08099DD0(Entity* this) { +void Trapdoor_Init(Entity* this) { this->collisionLayer = 1; this->spriteRendering.b3 = 3; this->spritePriority.b0 = 7; @@ -30,7 +36,7 @@ void sub_08099DD0(Entity* this) { } } -void sub_08099E10(Entity* this) { +void Trapdoor_Action1(Entity* this) { if (CheckLocalFlag(0x74)) { GetNextFrame(this); if ((this->frame == 1) && (this->subAction == 0)) { @@ -44,7 +50,7 @@ void sub_08099E10(Entity* this) { } } -void sub_08099E58(Entity* this) { +void Trapdoor_Action2(Entity* this) { GetNextFrame(this); if (this->frame & ANIM_DONE) { this->frame &= ~0x80; @@ -56,7 +62,7 @@ void sub_08099E58(Entity* this) { } } -void sub_08099E8C(Entity* this) { +void Trapdoor_Action3(Entity* this) { if (EntityInRectRadius(this, &gPlayerEntity, 0xc, 0xc)) { if (this->subAction == 0) { sub_08099ECC(this); @@ -68,7 +74,7 @@ void sub_08099E8C(Entity* this) { } } -void nullsub_534(Entity* this) { +void Trapdoor_Action4(Entity* this) { } void sub_08099ECC(Entity* this) { diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index 8778f3c8..9a5ac61e 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -1,35 +1,41 @@ -#include "global.h" -#include "sound.h" +/** + * @file treeHidingPortal.c + * @ingroup Objects + * + * @brief Tree Hiding Portal object + */ +#include "effects.h" #include "entity.h" #include "flags.h" -#include "player.h" -#include "room.h" #include "functions.h" -#include "effects.h" +#include "global.h" #include "object.h" +#include "player.h" +#include "room.h" +#include "sound.h" extern const s16 gUnk_080B4468[]; -void sub_0809E83C(Entity* this); -void sub_0809E86C(Entity* this); -void sub_0809E8BC(Entity* this); -void sub_0809E8EC(Entity* this); +void TreeHidingPortal_Init(Entity* this); +void TreeHidingPortal_Action1(Entity* this); +void TreeHidingPortal_Action2(Entity* this); +void TreeHidingPortal_Action3(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, - sub_0809E86C, - sub_0809E8BC, - sub_0809E8EC, + static void (*const TreeHidingPortal_Actions[])(Entity*) = { + TreeHidingPortal_Init, + TreeHidingPortal_Action1, + TreeHidingPortal_Action2, + TreeHidingPortal_Action3, }; - actionFuncs[this->action](this); + TreeHidingPortal_Actions[this->action](this); } -void sub_0809E83C(Entity* this) { +void TreeHidingPortal_Init(Entity* this) { if (CheckFlags(this->field_0x86.HWORD)) { sub_0809E96C(this); DeleteThisEntity(); @@ -39,7 +45,7 @@ void sub_0809E83C(Entity* this) { UpdateSpriteForCollisionLayer(this); } -void sub_0809E86C(Entity* this) { +void TreeHidingPortal_Action1(Entity* this) { if (sub_0800419C(this, &gPlayerEntity, 0x30, 0x30)) { if (CheckGlobalFlag(EZERO_1ST)) { @@ -55,7 +61,7 @@ void sub_0809E86C(Entity* this) { } } -void sub_0809E8BC(Entity* this) { +void TreeHidingPortal_Action2(Entity* this) { if (--this->timer == 0) { this->action = 3; this->timer = 60; @@ -65,7 +71,7 @@ void sub_0809E8BC(Entity* this) { } } -void sub_0809E8EC(Entity* this) { +void TreeHidingPortal_Action3(Entity* this) { if (--this->timer == 0) { SetFlag(this->field_0x86.HWORD); SetPlayerControl(0); diff --git a/src/object/treeThorns.c b/src/object/treeThorns.c index 32602e48..e01a832d 100644 --- a/src/object/treeThorns.c +++ b/src/object/treeThorns.c @@ -1,9 +1,15 @@ -#include "global.h" +/** + * @file threeThorns.c + * @ingroup Objects + * + * @brief Three Thorns object + */ #include "entity.h" +#include "global.h" +#include "hitbox.h" +#include "object.h" #include "physics.h" #include "room.h" -#include "object.h" -#include "hitbox.h" void TreeThorns(Entity* this) { Entity* ent; diff --git a/src/object/objectD.c b/src/object/unusedSkull.c index dc164b85..30c6ec1f 100644 --- a/src/object/objectD.c +++ b/src/object/unusedSkull.c @@ -1,38 +1,37 @@ /** - * @file objectD.c + * @file unusedSkull.c * @ingroup Objects * - * @brief ObjectD object + * @brief Unused Skull object */ - #define NENT_DEPRECATED -#include "global.h" -#include "object.h" #include "functions.h" +#include "global.h" #include "hitbox.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; /*0x68*/ u8 unk_68[0x1e]; /*0x86*/ u16 unk_86; -} ObjectDEntity; +} UnusedSkullEntity; -void sub_0808434C(ObjectDEntity*); -void sub_080843F8(ObjectDEntity*); -void sub_08084428(ObjectDEntity*); +void UnusedSkull_Init(UnusedSkullEntity*); +void UnusedSkull_Action1(UnusedSkullEntity*); +void UnusedSkull_Action2(UnusedSkullEntity*); -void (*const gUnk_0811F908[])(ObjectDEntity*) = { - sub_0808434C, - sub_080843F8, - sub_08084428, - (void (*)(ObjectDEntity*))GetNextFrame, +void (*const UnusedSkull_Actions[])(UnusedSkullEntity*) = { + UnusedSkull_Init, + UnusedSkull_Action1, + UnusedSkull_Action2, + (void (*)(UnusedSkullEntity*))GetNextFrame, }; -void ObjectD(ObjectDEntity* this) { - gUnk_0811F908[super->action](this); +void UnusedSkull(UnusedSkullEntity* this) { + UnusedSkull_Actions[super->action](this); } -void sub_0808434C(ObjectDEntity* this) { +void UnusedSkull_Init(UnusedSkullEntity* this) { super->action = 1; super->flags |= 0x80; super->spriteSettings.draw = 1; @@ -51,7 +50,7 @@ void sub_0808434C(ObjectDEntity* this) { } } -void sub_080843F8(ObjectDEntity* this) { +void UnusedSkull_Action1(UnusedSkullEntity* this) { if (super->contactFlags == 0x9c) { super->action = 2; super->flags &= 0x7f; @@ -60,7 +59,7 @@ void sub_080843F8(ObjectDEntity* this) { } } -void sub_08084428(ObjectDEntity* this) { +void UnusedSkull_Action2(UnusedSkullEntity* this) { GetNextFrame(super); if ((super->frame & 1) != 0) { super->action = 3; diff --git a/src/object/objectAB.c b/src/object/vaati1Portal.c index 8f232604..dd60a587 100644 --- a/src/object/objectAB.c +++ b/src/object/vaati1Portal.c @@ -1,28 +1,34 @@ +/** + * @file vaati1Portal.c + * @ingroup Objects + * + * @brief Vaati1 Portal object + */ #define NENT_DEPRECATED +#include "asm.h" #include "entity.h" #include "flags.h" -#include "asm.h" -#include "player.h" #include "physics.h" +#include "player.h" extern void CreateHoleManager(u32); -void ObjectAB_Init(Entity*); -void ObjectAB_Action1(Entity*); -void ObjectAB_Action2(Entity*); +void Vaati1Portal_Init(Entity*); +void Vaati1Portal_Action1(Entity*); +void Vaati1Portal_Action2(Entity*); void sub_080A0190(Entity*); -void ObjectAB(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - ObjectAB_Init, - ObjectAB_Action1, - ObjectAB_Action2, +void Vaati1Portal(Entity* this) { + static void (*const Vaati1Portal_Actions[])(Entity*) = { + Vaati1Portal_Init, + Vaati1Portal_Action1, + Vaati1Portal_Action2, }; - actionFuncs[this->action]((Entity*)this); + Vaati1Portal_Actions[this->action]((Entity*)this); } -void ObjectAB_Init(Entity* this) { +void Vaati1Portal_Init(Entity* this) { this->action++; this->collisionLayer = 1; this->spriteRendering.b3 = 3; @@ -31,7 +37,7 @@ void ObjectAB_Init(Entity* this) { InitializeAnimation(this, 0); } -void ObjectAB_Action1(Entity* this) { +void Vaati1Portal_Action1(Entity* this) { if (CheckRoomFlag(0)) { GetNextFrame(this); if (this->frame & 0x80) { @@ -40,7 +46,7 @@ void ObjectAB_Action1(Entity* this) { } } -void ObjectAB_Action2(Entity* this) { +void Vaati1Portal_Action2(Entity* this) { if (CheckRoomFlag(1)) { sub_080A0190(this); RequestPriorityDuration(this, 30); diff --git a/src/object/object9B.c b/src/object/vaati2Particle.c index 8bb9c2cc..d3ce9d29 100644 --- a/src/object/object9B.c +++ b/src/object/vaati2Particle.c @@ -1,21 +1,27 @@ +/** + * @file vaati2Particle.c + * @ingroup Objects + * + * @brief Vaati2 Particle object + */ #define NENT_DEPRECATED #include "entity.h" #include "physics.h" -void sub_0809E7C0(Entity*); -void sub_0809E7E0(Entity*); +void Vaati2Particle_Init(Entity*); +void Vaati2Particle_Action1(Entity*); void sub_0809E7FC(Entity*); -void Object9B(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0809E7C0, - sub_0809E7E0, +void Vaati2Particle(Entity* this) { + static void (*const Vaati2Particle_Actions[])(Entity*) = { + Vaati2Particle_Init, + Vaati2Particle_Action1, }; - actionFuncs[this->action]((Entity*)this); + Vaati2Particle_Actions[this->action]((Entity*)this); } -void sub_0809E7C0(Entity* this) { +void Vaati2Particle_Init(Entity* this) { this->action = 1; if (this->type2 != 0xff) { sub_0809E7FC(this); @@ -23,7 +29,7 @@ void sub_0809E7C0(Entity* this) { InitializeAnimation(this, this->type); } -void sub_0809E7E0(Entity* this) { +void Vaati2Particle_Action1(Entity* this) { GetNextFrame(this); if (this->frame & ANIM_DONE) { DeleteThisEntity(); diff --git a/src/object/objectAF.c b/src/object/vaati3Arm.c index d2707ab4..50d094a4 100644 --- a/src/object/objectAF.c +++ b/src/object/vaati3Arm.c @@ -1,22 +1,28 @@ -#include "global.h" +/** + * @file vaati3Arm.c + * @ingroup Objects + * + * @brief Vaati3 Arm object + */ #include "entity.h" +#include "global.h" #include "physics.h" void sub_080A0640(Entity*); -void sub_080A05A4(Entity*); -void sub_080A05F4(Entity*); -void sub_080A0624(Entity*); +void Vaati3Arm_Init(Entity*); +void Vaati3Arm_Action1(Entity*); +void Vaati3Arm_Action2(Entity*); -void ObjectAF(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_080A05A4, - sub_080A05F4, - sub_080A0624, +void Vaati3Arm(Entity* this) { + static void (*const Vaati3Arm_Actions[])(Entity*) = { + Vaati3Arm_Init, + Vaati3Arm_Action1, + Vaati3Arm_Action2, }; - actionFuncs[this->action](this); + Vaati3Arm_Actions[this->action](this); } -void sub_080A05A4(Entity* this) { +void Vaati3Arm_Init(Entity* this) { if (this->type != 2) { this->action = 1; this->spritePriority.b0 = 6; @@ -31,7 +37,7 @@ void sub_080A05A4(Entity* this) { } } -void sub_080A05F4(Entity* this) { +void Vaati3Arm_Action1(Entity* this) { if (this->parent == NULL) { this->action = 2; InitializeAnimation(this, 2); @@ -44,7 +50,7 @@ void sub_080A05F4(Entity* this) { } } -void sub_080A0624(Entity* this) { +void Vaati3Arm_Action2(Entity* this) { GetNextFrame(this); if (this->frame & ANIM_DONE) { DeleteThisEntity(); diff --git a/src/object/objectB6.c b/src/object/vaati3Death.c index 0e2828b6..04553f75 100644 --- a/src/object/objectB6.c +++ b/src/object/vaati3Death.c @@ -1,8 +1,14 @@ +/** + * @file vaati3Death.c + * @ingroup Objects + * + * @brief Vaati3 Death object + */ #define NENT_DEPRECATED #include "entity.h" #include "physics.h" -void ObjectB6(Entity* this) { +void Vaati3Death(Entity* this) { if (this->parent->subAction > 3) { DeleteThisEntity(); } diff --git a/src/object/objectB5.c b/src/object/vaati3PlayerObject.c index 74605a68..0cec61c1 100644 --- a/src/object/objectB5.c +++ b/src/object/vaati3PlayerObject.c @@ -1,9 +1,15 @@ +/** + * @file vaati3PlayerObject.c + * @ingroup Objects + * + * @brief Vaati3 Player object + */ #include "entity.h" -#include "room.h" -#include "player.h" #include "physics.h" +#include "player.h" +#include "room.h" -void ObjectB5(Entity* this) { +void Vaati3PlayerObject(Entity* this) { if (this->action == 0) { this->action = 1; } diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index 47d70538..905bf7b8 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -1,37 +1,43 @@ -#include "global.h" -#include "object.h" -#include "game.h" +/** + * @file warpPoint.c + * @ingroup Objects + * + * @brief Warp Point object + */ #include "functions.h" +#include "game.h" +#include "global.h" #include "hitbox.h" +#include "object.h" extern void sub_0807CAC8(u32); extern u32 sub_0807CAEC(u32); -void sub_0808B474(Entity*); -void sub_0808B530(Entity*); -void sub_0808B564(Entity*); -void sub_0808B590(Entity*); -void sub_0808B5E8(Entity*); -void sub_0808B684(Entity*); +void WarpPoint_Init(Entity*); +void WarpPoint_Action1(Entity*); +void WarpPoint_Action2(Entity*); +void WarpPoint_Action3(Entity*); +void WarpPoint_Action4(Entity*); +void WarpPoint_Action5(Entity*); void sub_0808B73C(Entity*); u32 sub_0808B7C8(Entity*); void sub_0808B830(Entity*); -void (*const gUnk_08121368[])(Entity*) = { - sub_0808B474, sub_0808B530, sub_0808B564, sub_0808B590, sub_0808B5E8, sub_0808B684, +void (*const WarpPoint_Actions[])(Entity*) = { + WarpPoint_Init, WarpPoint_Action1, WarpPoint_Action2, WarpPoint_Action3, WarpPoint_Action4, WarpPoint_Action5, }; const u8 gUnk_08121380[3] = { 1, 0, 2 }; void WarpPoint(Entity* this) { if (!this->field_0x70.BYTES.byte0) { - gUnk_08121368[this->action](this); + WarpPoint_Actions[this->action](this); } else { sub_0808B73C(this); } } -void sub_0808B474(Entity* this) { +void WarpPoint_Init(Entity* this) { u32 tmp; this->action = 1; this->subtimer = 0; @@ -59,7 +65,7 @@ void sub_0808B474(Entity* this) { RequestPriorityDuration(this, this->subtimer + 16); } -void sub_0808B530(Entity* this) { +void WarpPoint_Action1(Entity* this) { if (CheckFlags(this->field_0x86.HWORD)) { sub_0808B830(this); if (AreaIsDungeon()) { @@ -71,7 +77,7 @@ void sub_0808B530(Entity* this) { } } -void sub_0808B564(Entity* this) { +void WarpPoint_Action2(Entity* this) { if (!--this->subtimer) { this->action = 3; } else { @@ -79,7 +85,7 @@ void sub_0808B564(Entity* this) { } } -void sub_0808B590(Entity* this) { +void WarpPoint_Action3(Entity* this) { GetNextFrame(this); if (sub_0808B7C8(this)) { if (this->timer) @@ -98,7 +104,7 @@ void sub_0808B590(Entity* this) { } } -void sub_0808B5E8(Entity* this) { +void WarpPoint_Action4(Entity* this) { u32 tmp; if (!--this->subtimer) { this->action = 3; @@ -140,7 +146,7 @@ void sub_0808B5E8(Entity* this) { } } -void sub_0808B684(Entity* this) { +void WarpPoint_Action5(Entity* this) { u32 tmp; if (!--this->subtimer) { gRoomTransition.transitioningOut = 1; diff --git a/src/object/object66.c b/src/object/waterDropObject.c index bd82c084..a32cad00 100644 --- a/src/object/object66.c +++ b/src/object/waterDropObject.c @@ -1,8 +1,14 @@ +/** + * @file waterDropObject.c + * @ingroup Objects + * + * @brief Water Drop object + */ #define NENT_DEPRECATED #include "entity.h" #include "functions.h" -void Object66(Entity* this) { +void WaterDropObject(Entity* this) { int iVar2; int iVar4; Entity* parent; diff --git a/src/object/waterElement.c b/src/object/waterElement.c new file mode 100644 index 00000000..12aa538d --- /dev/null +++ b/src/object/waterElement.c @@ -0,0 +1,30 @@ +/** + * @file waterElement.c + * @ingroup Objects + * + * @brief Water Element object + */ +#define NENT_DEPRECATED +#include "functions.h" +#include "global.h" +#include "object.h" + +void WaterElement_Init(Entity*); +void WaterElement_Action1(Entity*); + +void WaterElement(Entity* this) { + static void (*const WaterElement_Actions[])(Entity*) = { + WaterElement_Init, + WaterElement_Action1, + }; + WaterElement_Actions[this->action](this); +} + +void WaterElement_Init(Entity* this) { + this->action = 1; + this->frameIndex = 0; + this->spritePriority.b0 = 5; +} + +void WaterElement_Action1(Entity* this) { +} diff --git a/src/object/waterfallOpening.c b/src/object/waterfallOpening.c index b8f5d650..72c724d1 100644 --- a/src/object/waterfallOpening.c +++ b/src/object/waterfallOpening.c @@ -1,9 +1,15 @@ +/** + * @file waterfallOpening.c + * @ingroup Objects + * + * @brief Waterfall Opening object + */ #define NENT_DEPRECATED #include "entity.h" -#include "menu.h" -#include "room.h" #include "flags.h" #include "functions.h" +#include "menu.h" +#include "room.h" #include "sound.h" typedef struct { diff --git a/src/object/well.c b/src/object/well.c index 52f79e5c..29a04181 100644 --- a/src/object/well.c +++ b/src/object/well.c @@ -1,38 +1,44 @@ -#include "global.h" +/** + * @file well.c + * @ingroup Objects + * + * @brief Well object + */ #include "asm.h" #include "entity.h" -#include "room.h" -#include "player.h" #include "functions.h" +#include "global.h" +#include "player.h" +#include "room.h" -void sub_080A0EB0(Entity*); -void sub_080A0EF0(Entity*); +void Well_Init(Entity*); +void Well_Action1(Entity*); -void Well(Entity* ent) { - static void (*const actionFuncs[])(Entity*) = { - sub_080A0EB0, - sub_080A0EF0, +void Well(Entity* this) { + static void (*const Well_Actions[])(Entity*) = { + Well_Init, + Well_Action1, }; - actionFuncs[ent->action](ent); + Well_Actions[this->action](this); } -void sub_080A0EB0(Entity* ent) { +void Well_Init(Entity* this) { u32 tilePos; - ent->action = 1; - tilePos = COORD_TO_TILE(ent); - ent->field_0x80.HWORD = tilePos; - SetTile(16509, ent->field_0x80.HWORD, 1); + this->action = 1; + tilePos = COORD_TO_TILE(this); + this->field_0x80.HWORD = tilePos; + SetTile(16509, this->field_0x80.HWORD, 1); } -void sub_080A0EF0(Entity* ent) { +void Well_Action1(Entity* this) { s32 tileIndex; - tileIndex = GetTileType(ent->field_0x80.HWORD, 1); + tileIndex = GetTileType(this->field_0x80.HWORD, 1); if (tileIndex != 0x407D) { sub_08078B48(); - gPlayerEntity.x.WORD = ent->x.WORD; - gPlayerEntity.y.HALF.HI = ent->y.HALF.HI + 4; + gPlayerEntity.x.WORD = this->x.WORD; + gPlayerEntity.y.HALF.HI = this->y.HALF.HI + 4; DeleteThisEntity(); } } diff --git a/src/object/whirlwind.c b/src/object/whirlwind.c index 5659a5a4..25c765d4 100644 --- a/src/object/whirlwind.c +++ b/src/object/whirlwind.c @@ -6,11 +6,11 @@ */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" -#include "functions.h" #include "area.h" +#include "functions.h" +#include "global.h" #include "hitbox.h" +#include "object.h" void Whirlwind_Init(Entity*); void Whirlwind_Action1(Entity*); diff --git a/src/object/object3A.c b/src/object/whiteTriangleEffect.c index 00def745..c6746f80 100644 --- a/src/object/object3A.c +++ b/src/object/whiteTriangleEffect.c @@ -1,14 +1,14 @@ /** - * @file object3A.c + * @file whiteTriangleEffect.c * @ingroup Objects * - * @brief Object3A object + * @brief White Triangle Effect object */ #define NENT_DEPRECATED +#include "functions.h" #include "global.h" #include "object.h" -#include "functions.h" #include "screen.h" typedef struct { @@ -22,7 +22,7 @@ typedef struct { /*0x84*/ u8 unk_84; /*0x85*/ s8 unk_85; /*0x86*/ s16 unk_86; -} Object3AEntity; +} WhiteTriangleEffectEntity; typedef struct { u16 unk_0; @@ -40,11 +40,11 @@ typedef struct { extern void sub_0801E49C(u32, u32, u32, u32); extern bool32 gUnk_02036BB8; -void sub_0808C6D4(Object3AEntity*); -void sub_0808C74C(Object3AEntity*); -void sub_0808C858(Object3AEntity*); -void sub_0808C8B8(Object3AEntity*); -void sub_0808C840(Object3AEntity*); +void sub_0808C6D4(WhiteTriangleEffectEntity*); +void sub_0808C74C(WhiteTriangleEffectEntity*); +void sub_0808C858(WhiteTriangleEffectEntity*); +void sub_0808C8B8(WhiteTriangleEffectEntity*); +void sub_0808C840(WhiteTriangleEffectEntity*); const struct_081215E8 gUnk_081215E8[] = { { 5, 4, 280, -6, 0, 0, -8, 0, 31, 63 }, @@ -53,12 +53,12 @@ const struct_081215E8 gUnk_081215E8[] = { { 6, 2, 0, 16, 0, 0, 16, 0, 63, 31 }, }; -void Object3A(Object3AEntity* this) { - static void (*const gUnk_08121638[])(Object3AEntity*) = { +void WhiteTriangleEffect(WhiteTriangleEffectEntity* this) { + static void (*const gUnk_08121638[])(WhiteTriangleEffectEntity*) = { sub_0808C6D4, sub_0808C74C, }; - static void (*const gUnk_08121640[])(Object3AEntity*) = { + static void (*const gUnk_08121640[])(WhiteTriangleEffectEntity*) = { sub_0808C858, sub_0808C8B8, }; @@ -70,8 +70,8 @@ void Object3A(Object3AEntity* this) { } } -void sub_0808C6D4(Object3AEntity* this) { - Object3AEntity* obj; +void sub_0808C6D4(WhiteTriangleEffectEntity* this) { + WhiteTriangleEffectEntity* obj; const struct_081215E8* ptr = &gUnk_081215E8[super->type2]; this->unk_86 = ptr->unk_2; this->unk_85 = ptr->unk_3; @@ -82,13 +82,13 @@ void sub_0808C6D4(Object3AEntity* this) { sub_0801E1B8((gScreen.controls.windowInsideControl & 0xff00) | ptr->unk_8, ptr->unk_9); super->action = 1; sub_0808C74C(this); - obj = (Object3AEntity*)CreateObject(OBJECT_3A, 1, ptr->unk_0); + obj = (WhiteTriangleEffectEntity*)CreateObject(WHITE_TRIANGLE_EFFECT, 1, ptr->unk_0); if (obj != NULL) { obj->unk_6a = ptr->unk_1; } } -void sub_0808C74C(Object3AEntity* this) { +void sub_0808C74C(WhiteTriangleEffectEntity* this) { if (super->parent != NULL) { super->x.HALF.HI = super->parent->x.HALF.HI - gRoomControls.scroll_x; super->y.HALF.HI = super->parent->y.HALF.HI - gRoomControls.scroll_y; @@ -125,13 +125,13 @@ void sub_0808C74C(Object3AEntity* this) { sub_0801E49C(super->x.HALF.HI, super->y.HALF.HI, this->unk_86, this->unk_83); } -void sub_0808C840(Object3AEntity* this) { +void sub_0808C840(WhiteTriangleEffectEntity* this) { gScreen.controls.layerFXControl = 0; sub_0801E104(); DeleteThisEntity(); } -void sub_0808C858(Object3AEntity* this) { +void sub_0808C858(WhiteTriangleEffectEntity* this) { if ((super->type2 & 2) != 0) { gScreen.controls.layerFXControl = 0x3fbf; } else { @@ -146,7 +146,7 @@ void sub_0808C858(Object3AEntity* this) { this->unk_68 = 0x100; } -void sub_0808C8B8(Object3AEntity* this) { +void sub_0808C8B8(WhiteTriangleEffectEntity* this) { s32 tmp = this->unk_68 -= this->unk_6a; if (tmp * 0x10000 < 0) { this->unk_68 = 0; diff --git a/src/object/windTribeFlag.c b/src/object/windTribeFlag.c index b8943a58..99b8572f 100644 --- a/src/object/windTribeFlag.c +++ b/src/object/windTribeFlag.c @@ -1,3 +1,9 @@ +/** + * @file windTribeFlag.c + * @ingroup Objects + * + * @brief Wind Tribe Flag object + */ #include "object.h" void WindTribeFlag(Entity* this) { diff --git a/src/object/windTribeTeleporter.c b/src/object/windTribeTeleporter.c index f397feec..ebf62870 100644 --- a/src/object/windTribeTeleporter.c +++ b/src/object/windTribeTeleporter.c @@ -2,15 +2,15 @@ * @file windTribeTeleporter.c * @ingroup Objects * - * @brief WindTribeTeleporter object + * @brief Wind Tribe Teleporter object */ #define NENT_DEPRECATED -#include "global.h" -#include "object.h" +#include "collision.h" #include "functions.h" +#include "global.h" #include "hitbox.h" -#include "collision.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/object/windcrest.c b/src/object/windcrest.c index 5fdeb9c0..56bc6459 100644 --- a/src/object/windcrest.c +++ b/src/object/windcrest.c @@ -1,10 +1,16 @@ -#include "global.h" -#include "sound.h" +/** + * @file windcrest.c + * @ingroup Objects + * + * @brief Windcrest object + */ +#include "effects.h" #include "entity.h" +#include "functions.h" +#include "global.h" #include "save.h" #include "script.h" -#include "effects.h" -#include "functions.h" +#include "sound.h" void Windcrest(Entity* this) { if (this->action == 0) { diff --git a/src/player.c b/src/player.c index e509c7de..ac0298bf 100644 --- a/src/player.c +++ b/src/player.c @@ -1628,7 +1628,7 @@ static void sub_08071E04(Entity* this) { if (sub_0807953C()) this->timer -= 2; else - this->timer -= 1; + this->timer--; if ((s8)this->timer < 1) SetPlayerActionNormal(); @@ -1884,7 +1884,7 @@ static void PlayerLavaInit(Entity* this) { if ((gPlayerState.flags & PL_MINISH) == 0) { this->subAction = 1; this->zVelocity = Q_16_16(2.5); - ent = CreateObject(OBJECT_42, 0x80, 0); + ent = CreateObject(LINK_FIRE, 0x80, 0); if (ent != NULL) { ent->child = this; } @@ -2712,7 +2712,7 @@ static void sub_08073468(Entity* this) { this->direction = Direction8FromAnimationState(this->animationState); if ((gPlayerState.flags & PL_PARACHUTE) == 0) { gPlayerState.flags |= PL_PARACHUTE; - CreateObjectWithParent(this, OBJECT_61, 0, 0); + CreateObjectWithParent(this, EZLO_CAP_FLYING, 0, 0); } ResetPlayerItem(); if (this->zVelocity > 0 || gPlayerState.field_0x38 == 1) @@ -2749,7 +2749,7 @@ static void sub_08073504(Entity* this) { static void sub_08073584(Entity* this) { u32 state, dir, idx; - if ((gPlayerState.field_0x92 & 0x80) || this->iframes > 0 || gPlayerState.field_0x3c[0] || + if ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_80) || this->iframes > 0 || gPlayerState.field_0x3c[0] || (gPlayerState.flags & PL_PARACHUTE) == 0) { gPlayerState.jump_status |= 0x40; PlayerSetNormalAndCollide(); @@ -3375,7 +3375,7 @@ void SurfaceAction_6(Entity* this) { void SurfaceAction_7(Entity* this) { if (!sub_080741C4() && (gPlayerState.flags & PL_MINISH) == 0 && gPlayerState.field_0x11 == 15) { - CreateObjectWithParent(this, OBJECT_E, 0, 0); + CreateObjectWithParent(this, CRACKING_GROUND, 0, 0); } } @@ -3519,7 +3519,7 @@ void SurfaceAction_ShallowWater(Entity* this) { this->spritePriority.b0 = 4; gPlayerState.swim_state = 0; } - if ((gPlayerState.field_0x92 & 0xF00) || gPlayerState.field_0x11 == 1) + if ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_ANY_DIRECTION) || gPlayerState.field_0x11 == 1) SoundReq(SFX_WATER_WALK); } } @@ -3562,7 +3562,7 @@ void SurfaceAction_Swamp(Entity* this) { CreateObjectWithParent(this, OBJECT_70, 0, 0); CreateFx(this, FX_GREEN_SPLASH, 0); SoundReq(SFX_161); - } else if ((gPlayerState.field_0x92 & 0xf00) != 0) { + } else if ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_ANY_DIRECTION) != 0) { SoundReq(SFX_161); } else if ((gRoomTransition.frameCount & 0xf) == 0) { SoundReq(SFX_161); @@ -3717,11 +3717,11 @@ void SurfaceAction_22(Entity* this) { void SurfaceAction_Dust(Entity* this) { if (!sub_080741C4()) { gPlayerState.speed_modifier -= 128; - if (gPlayerState.field_0x11 == 1 || (gPlayerState.field_0x92 & 0xF00) != 0) { + if (gPlayerState.field_0x11 == 1 || (gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_ANY_DIRECTION) != 0) { if (gPlayerState.floor_type == SURFACE_DUST) - CreateObjectWithParent(this, OBJECT_21, 1, 0); + CreateObjectWithParent(this, DIRT_PARTICLE, 1, 0); else - CreateObjectWithParent(this, OBJECT_21, 1, 1); + CreateObjectWithParent(this, DIRT_PARTICLE, 1, 1); } } } @@ -4081,7 +4081,7 @@ void sub_080751E8(u32 a1, u32 a2, void* script) { gPlayerState.field_0x39 = 1; script = &script_BedAtSimons; } - e = CreateObject(OBJECT_5B, !gPlayerState.field_0x39 ? 2 : 0, 0); + e = CreateObject(BED_COVER, !gPlayerState.field_0x39 ? 2 : 0, 0); if (e != NULL) { CopyPosition(&gPlayerEntity, e); StartCutscene(e, script); diff --git a/src/playerItem/playerItemBomb.c b/src/playerItem/playerItemBomb.c index af0450a6..25c0f67c 100644 --- a/src/playerItem/playerItemBomb.c +++ b/src/playerItem/playerItemBomb.c @@ -45,7 +45,7 @@ void PlayerItemBomb(PlayerItemBombEntity* this) { if (uVar1 != 0x03) { if (super->timer != 0) { if (*(u8*)&this->unk_68 == 7) { - super->timer -= 1; + super->timer--; } if (super->timer == 0) { super->subtimer = 80; @@ -105,16 +105,16 @@ void sub_0801B2CC(PlayerItemBombEntity* this) { } switch (IsItemEquipped(ITEM_REMOTE_BOMBS)) { case 0: - unaff_r5 = 1; + unaff_r5 = PLAYER_INPUT_1; break; case 1: - unaff_r5 = 2; + unaff_r5 = PLAYER_INPUT_2; break; case 2: unaff_r5 = 0; break; } - if ((unaff_r5 & gPlayerState.field_0x92) != 0) { + if ((gPlayerState.playerInput.field_0x92 & unaff_r5) != 0) { super->timer = 0; super->subtimer = 1; } @@ -125,7 +125,7 @@ void sub_0801B318(PlayerItemBombEntity* this) { } void sub_0801B330(PlayerItemBombEntity* this) { - super->subAction += 1; + super->subAction++; sub_08079BD8(super); } @@ -138,7 +138,7 @@ void sub_0801B354(PlayerItemBombEntity* this) { } void sub_0801B368(PlayerItemBombEntity* this) { - super->action -= 1; + super->action--; super->subAction = 0; if (0x3c < super->timer) { super->timer = 60; diff --git a/src/playerItem/playerItemBoomerang.c b/src/playerItem/playerItemBoomerang.c index 1c9fa0f6..9b40a557 100644 --- a/src/playerItem/playerItemBoomerang.c +++ b/src/playerItem/playerItemBoomerang.c @@ -193,7 +193,7 @@ void sub_0801B680(Entity* this) { void sub_0801B7A8(Entity* this) { sub_0801B804(this); if (this->timer != 0) { - this->timer -= 1; + this->timer--; } else { sub_0801B864(this); if (this->speed < 0x280) { @@ -224,7 +224,7 @@ void sub_0801B804(Entity* this) { break; } - if ((uVar1 & gPlayerState.field_0x90) == 0) { + if ((uVar1 & gPlayerState.playerInput.field_0x90) == 0) { this->field_0x80.HALF.LO = 1; gPlayerState.field_0xa &= 0x7f; gPlayerState.keepFacing &= 0x7f; diff --git a/src/playerItem/playerItemBottle.c b/src/playerItem/playerItemBottle.c index f7767a50..798dc95e 100644 --- a/src/playerItem/playerItemBottle.c +++ b/src/playerItem/playerItemBottle.c @@ -168,13 +168,13 @@ void PlayerItemBottle_UseOther(Entity* this) { } switch (this->field_0x6e.HALF.HI) { case ITEM_BOTTLE_WATER: - CreateObjectWithParent(this, OBJECT_68, 0, 0); + CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0); break; case ITEM_BOTTLE_MINERAL_WATER: - CreateObjectWithParent(this, OBJECT_68, 1, 1); + CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 1); break; case ITEM_BOTTLE_FAIRY: - CreateObjectWithParent(this, OBJECT_68, 2, 2); + CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 2, 2); ModHealth(0x20); break; case BOTTLE_CHARM_NAYRU: @@ -188,20 +188,20 @@ void PlayerItemBottle_UseOther(Entity* this) { if (gPlayerEntity.frame == 2) { switch (this->field_0x6e.HALF.HI) { case ITEM_BOTTLE_WATER: - CreateObjectWithParent(this, OBJECT_68, 0, 0); + CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0); break; case ITEM_BOTTLE_MINERAL_WATER: - CreateObjectWithParent(this, OBJECT_68, 1, 1); + CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 1); break; } } if (gPlayerEntity.frame == 3) { switch (this->field_0x6e.HALF.HI) { case ITEM_BOTTLE_WATER: - CreateObjectWithParent(this, OBJECT_68, 0, 0); + CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0); break; case ITEM_BOTTLE_MINERAL_WATER: - CreateObjectWithParent(this, OBJECT_68, 1, 0); + CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 0); break; } } diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c index 6f9014ef..6526b4e8 100644 --- a/src/playerItem/playerItemBow.c +++ b/src/playerItem/playerItemBow.c @@ -115,7 +115,7 @@ void sub_08018FE4(PlayerItemBowEntity* this) { sub_08079BD8(super); if (this->unk_68 == 0xa) { this->unk_78 = 0x3c; - object = CreateObject(OBJECT_43, super->type, 1); + object = CreateObject(SWORD_PARTICLE, super->type, 1); if (object != NULL) { CopyPosition(super, object); } diff --git a/src/playerItem/playerItemGust.c b/src/playerItem/playerItemGust.c index ccb7c3d4..217e3db5 100644 --- a/src/playerItem/playerItemGust.c +++ b/src/playerItem/playerItemGust.c @@ -96,7 +96,7 @@ static void sub_080ACC78(GustEntity* this) { } o = sub_08008782(super, 0xe, child_offsets[this->offset_iter], child_offsets[this->offset_iter + 1]); if (o != NULL) { - child = CreateObject(OBJECT_11, o->type, o->type2); + child = CreateObject(BUSH, o->type, o->type2); if (child != NULL) { child->timer = o->timer; child->x.HALF.HI = child_offsets[this->offset_iter] + super->x.HALF.HI; @@ -118,7 +118,7 @@ static void sub_080ACC78(GustEntity* this) { } else { this->timer = gUnk_0812AABC[super->type]; } - child = CreateObject(OBJECT_17, 0, 0); + child = CreateObject(GUST_JAR_PARTICLE, 0, 0); if (child == NULL) { return; } diff --git a/src/playerItem/playerItemGustJar.c b/src/playerItem/playerItemGustJar.c index fcd04f00..2f4e574a 100644 --- a/src/playerItem/playerItemGustJar.c +++ b/src/playerItem/playerItemGustJar.c @@ -118,7 +118,7 @@ void PlayerItemGustJar_Action2(Entity* this) { void PlayerItemGustJar_Action3(Entity* this) { switch (gPlayerState.field_0x1c & 0xf) { case 6: - this->action += 1; + this->action++; InitAnimationForceUpdate(this, (gPlayerEntity.animationState >> 1) + 4); break; case 1: diff --git a/src/playerItem/playerItemLantern.c b/src/playerItem/playerItemLantern.c index 84673867..3158f698 100644 --- a/src/playerItem/playerItemLantern.c +++ b/src/playerItem/playerItemLantern.c @@ -59,7 +59,7 @@ void sub_08054AC8(Entity* this) { if (IsItemEquipped(ITEM_LANTERN_ON) < 2) { if (((this->frameIndex != 0xff) && (gPlayerEntity.spriteSettings.draw != 0)) && (this->timer-- == 0)) { this->timer = 4; - object = CreateObject(OBJECT_45, 0, 0x10); + object = CreateObject(LAMP_PARTICLE, 0, 0x10); if (object != NULL) { PositionRelative(this, object, 0, Q_16_16(2.0)); object->spritePriority.b0 = this->spritePriority.b0; diff --git a/src/playerItem/playerItemSwordBeam.c b/src/playerItem/playerItemSwordBeam.c index 9231a294..35f844da 100644 --- a/src/playerItem/playerItemSwordBeam.c +++ b/src/playerItem/playerItemSwordBeam.c @@ -50,11 +50,11 @@ void sub_08019498(Entity* this) { break; case 2: this->spriteSettings.flipX = 1; - this->x.HALF.HI += 1; + this->x.HALF.HI++; this->y.HALF.HI += -4; break; case 6: - this->x.HALF.HI -= 1; + this->x.HALF.HI--; this->y.HALF.HI += -4; break; } @@ -100,7 +100,7 @@ void sub_08019644(Entity* this) { *(int*)&this->field_0x74 = iVar1; if (iVar1 == 0) { *(int*)&this->field_0x74 = 2; - this->field_0x70.WORD += 1; + this->field_0x70.WORD++; if (gUnk_080B4400[this->field_0x70.WORD] == 0xff) { this->field_0x70.WORD = iVar1; } diff --git a/src/playerItemUtils.c b/src/playerItemUtils.c index aa1d15a0..d7464bb0 100644 --- a/src/playerItemUtils.c +++ b/src/playerItemUtils.c @@ -1,12 +1,13 @@ -#include "entity.h" -#include "functions.h" -#include "save.h" #include "common.h" -#include "sound.h" +#include "entity.h" #include "flags.h" +#include "functions.h" +#include "item.h" #include "message.h" #include "object.h" #include "player.h" +#include "save.h" +#include "sound.h" static Entity* GiveItemWithCutscene(u32, u32, u32); static void InitTileMessage(u32, u32); @@ -31,8 +32,8 @@ void InitItemGetSequence(u32 type, u32 type2, u32 delay) { static Entity* GiveItemWithCutscene(u32 type, u32 type2, u32 delay) { Entity* e; - if (type == 63 && gSave.stats.hasAllFigurines) { - type = 87; + if (type == ITEM_SHELLS && gSave.stats.hasAllFigurines) { + type = ITEM_RUPEE50; type2 = 0; } e = CreateItemGetEntity(); @@ -40,7 +41,7 @@ static Entity* GiveItemWithCutscene(u32 type, u32 type2, u32 delay) { e->type = type; e->type2 = type2; e->timer = delay; - e->id = OBJECT_B; + e->id = LINK_HOLDING_ITEM; e->kind = OBJECT; AppendEntityToList(e, 6); } @@ -51,7 +52,7 @@ void ClearSmallChests(void) { MemClear(gSmallChests, sizeof(gSmallChests)); } -void sub_080A7C8C(u32 pos, u32 layer) { +void OpenSmallChest(u32 pos, u32 layer) { TileEntity* t = gSmallChests; u32 found = 0; u32 i; diff --git a/src/playerUtils.c b/src/playerUtils.c index b3734e1c..d31f10c2 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -221,7 +221,7 @@ bool32 sub_08077758(PlayerEntity* this) { } bool32 sub_080777A0(void) { - if ((gPlayerState.field_0x92 & 0x80) != 0) { + if ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_80) != 0) { if ((gPlayerState.flags & PL_CLONING) != 0) { gPlayerState.chargeState.action = 1; DeleteClones(); @@ -230,12 +230,12 @@ bool32 sub_080777A0(void) { switch (gArea.portal_mode) { case 2: if (gArea.unk1A == 0) { - gPlayerEntity.subAction += 1; + gPlayerEntity.subAction++; } break; case 3: if ((gArea.unk1A == 0) && ((gPlayerState.flags & PL_MINISH) != 0)) { - gPlayerEntity.subAction += 1; + gPlayerEntity.subAction++; gPlayerEntity.flags &= ~ENT_COLLIDE; RequestPriorityDuration(&gPlayerEntity, 180); return TRUE; @@ -244,7 +244,7 @@ bool32 sub_080777A0(void) { default: if ((((gUnk_0200AF00.unk_2c == 0xc) && (gPlayerState.field_0x1c == 0)) && (gPlayerState.floor_type != SURFACE_SWAMP)) && - ((((gPlayerState.field_0x90 & 0xf00) != 0 && + ((((gPlayerState.playerInput.field_0x90 & PLAYER_INPUT_ANY_DIRECTION) != 0 && ((gPlayerState.flags & (PL_BURNING | PL_ROLLING)) == 0)) && ((gPlayerState.jump_status == 0 && (gPlayerState.field_0x3[1] == 0)))))) { gPlayerState.queued_action = 0x18; @@ -267,9 +267,9 @@ void sub_08077880(Item itemId, u32 param_2, u32 param_3) { if (itemId - 1 < 0x1f) { struct_0811BE48* ptr = &gUnk_0811BE48[itemId]; - puVar2 = &gPlayerState.field_0x90; + puVar2 = &gPlayerState.playerInput.field_0x90; if (ptr->unk0[0] != 0) { - puVar2 = &gPlayerState.field_0x92; + puVar2 = &gPlayerState.playerInput.field_0x92; } if (((*puVar2 & param_2) != 0) || (param_3 != 0)) { @@ -288,8 +288,9 @@ bool32 sub_080778CC(void) { if (!((((gPlayerState.flags & (PL_USE_PORTAL | PL_MINISH | PL_ROLLING)) == 0) && (((gNewPlayerEntity.unk_79 != 0 || (gPlayerState.heldObject != 0)) || - ((gPlayerState.field_0x92 & 0x8000) != 0)))) && - (((sub_080789A8() != 0 || ((gPlayerState.field_0x90 & 0xf03) == 0)))))) { + ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_8000) != 0)))) && + (((sub_080789A8() != 0 || ((gPlayerState.playerInput.field_0x90 & + (PLAYER_INPUT_ANY_DIRECTION | PLAYER_INPUT_1 | PLAYER_INPUT_2)) == 0)))))) { return FALSE; } item = sub_0807794C(ITEM_TRAP); @@ -373,8 +374,8 @@ ItemBehavior* sub_08077AC8(void) { if (pIVar1->field_0x5[4] != 0) { return NULL; } - pIVar1 += 1; - index += 1; + pIVar1++; + index++; } return gUnk_03000B80 + 3; } @@ -638,11 +639,11 @@ bool32 sub_08077EC8(ItemBehavior* beh) { } bool32 sub_08077EFC(ItemBehavior* arg0) { - return sub_08077F24(arg0, (u16)gPlayerState.field_0x90); + return sub_08077F24(arg0, (u16)gPlayerState.playerInput.field_0x90); } bool32 sub_08077F10(ItemBehavior* arg0) { - return sub_08077F24(arg0, (u16)gPlayerState.field_0x92); + return sub_08077F24(arg0, (u16)gPlayerState.playerInput.field_0x92); } bool32 sub_08077F24(ItemBehavior* beh, u32 arg1) { @@ -688,7 +689,7 @@ void sub_08077F84(void) { if (tile == 0x343 || tile == 0x344 || tile == 0x345 || tile == 0x346) { sub_0807AA80(&gPlayerEntity); gPlayerState.jump_status |= 8; - obj = CreateObject(OBJECT_44, 0, 0); + obj = CreateObject(ROTATING_TRAPDOOR, 0, 0); if (obj != NULL) { obj->x = gPlayerEntity.x; obj->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0xc; @@ -764,7 +765,7 @@ bool32 sub_080780E0(ChargeState* state) { } bool32 sub_08078108(ChargeState* state) { - state->chargeTimer -= 1; + state->chargeTimer--; if (state->chargeTimer < 0) { state->chargeTimer = 0; state->action = 2; @@ -782,7 +783,7 @@ bool32 sub_08078124(ChargeState* state) { } bool32 sub_08078140(ChargeState* info) { - info->preChargeTimer -= 1; + info->preChargeTimer--; if (info->preChargeTimer < 0) { info->preChargeTimer = 0; info->action = 0; @@ -917,7 +918,7 @@ bool32 sub_080782C0(void) { return FALSE; } } - if (((gPlayerState.field_0x92 & 0x1000) != 0) && ((u8)(gUnk_03003DF0.unk_4[3] - 1) < 100)) { + if (((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_1000) != 0) && ((u8)(gUnk_03003DF0.unk_4[3] - 1) < 100)) { sub_0801E738(0); if (gSave.unk12B[0] != 0) { gUnk_03003DF0.unk_2 = gUnk_03003DF0.unk_4[3]; @@ -929,7 +930,7 @@ bool32 sub_080782C0(void) { ForceSetPlayerState(0x13); return TRUE; } - if ((gPlayerState.field_0x92 & 0x88) == 0) { + if ((gPlayerState.playerInput.field_0x92 & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { return FALSE; } switch (gUnk_03003DF0.unk_4[1]) { @@ -1053,9 +1054,9 @@ s32 sub_0807887C(Entity* entity, u32 param_2, u32 param_3) { gUnk_03003DF0.array[index].unk_3 = param_3; } if (param_3 != 0) { - Entity* entity = FindEntityByID(OBJECT, OBJECT_9, 6); + Entity* entity = FindEntityByID(OBJECT, CAMERA_TARGET, 6); if (entity == NULL) { - CreateObject(OBJECT_9, 0, 0); + CreateObject(CAMERA_TARGET, 0, 0); } } return index; @@ -1484,7 +1485,7 @@ bool32 sub_080793E4(u32 param_1) { } else { tmp = gUnk_0811C0F8[gPlayerEntity.direction >> 2]; } - if (sub_08079778() && ((gPlayerState.field_0x90 & tmp) != 0)) { + if (sub_08079778() && ((gPlayerState.playerInput.field_0x90 & tmp) != 0)) { if (param_1 != 0) { if (!sub_080B1BA4(sub_0807A500(), gPlayerEntity.collisionLayer, param_1)) { return FALSE; @@ -1508,8 +1509,8 @@ void sub_08079520(Entity* this) { } u32 sub_0807953C(void) { - u32 tmp = 0xf38; - return gPlayerState.field_0x92 & tmp; + u32 tmp = PLAYER_INPUT_ANY_DIRECTION | PLAYER_INPUT_20 | PLAYER_INPUT_10 | PLAYER_INPUT_8; + return gPlayerState.playerInput.field_0x92 & tmp; } ASM_FUNC("asm/non_matching/playerUtils/sub_08079550.inc", u32 sub_08079550(void)) @@ -1563,7 +1564,118 @@ u32 sub_080797C4(void) { ASM_FUNC("asm/non_matching/playerUtils/sub_080797EC.inc", void sub_080797EC()) -ASM_FUNC("asm/non_matching/playerUtils/ResolvePlayerAnimation.inc", void ResolvePlayerAnimation()) +void ResolvePlayerAnimation(void) { + u32 index; + u32 tmp; + u32 anim; + if ((gPlayerState.flags & PL_NO_CAP) != 0) { + if (gPlayerState.heldObject != 0) { + anim = 0x92c; + } else { + if ((gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) != 0) { + return; + } + if ((gPlayerState.flags & PL_FLAGS2000000) != 0) { + anim = 0x810; + } else if (gPlayerState.field_0x3[0] != 0) { + anim = 0x414; + } else if (gPlayerState.field_0x1f[2] != 0) { + anim = 0x280; + } else if (gPlayerState.swim_state != 0) { + anim = 0x28c; + } else { + if ((gPlayerState.sword_state & 0x48) != 0) { + return; + } + if (gPlayerState.sword_state == 0) { + if (gPlayerState.field_0x3[1] != 0) { + return; + } + if ((gPlayerState.flags & PL_USE_PORTAL) != 0) { + switch (gArea.portal_type) { + case 5: + anim = 0x400; + break; + case 4: + anim = 0x100; + break; + default: + anim = 0x2c2; + break; + } + } else { + anim = 0x400; + } + } else { + anim = 0x168; + } + } + } + } else { + if (gPlayerState.heldObject != 0) { + anim = 0x350; + } else { + if ((gPlayerState.field_0x1c | gPlayerState.field_0x3c[1]) != 0) { + return; + } + if ((gPlayerState.flags & PL_MOLDWORM_CAPTURED) != 0) { + anim = 0x8b0; + } else if ((gPlayerState.flags & PL_FLAGS2000000) != 0) { + anim = 0x810; + } else if (gPlayerState.dash_state != 0) { + anim = 0x298; + } else if ((gPlayerState.flags & PL_IN_MINECART) != 0) { + anim = 0x70c; + } else if (gPlayerState.field_0x3[0] != 0) { + anim = 0x164; + } else if (gPlayerState.field_0x1f[2] != 0) { + anim = 0x280; + } else if (gPlayerState.swim_state != 0) { + anim = 0x28c; + } else { + if ((gPlayerState.sword_state & 0x48) != 0) { + return; + } + if ((gPlayerState.flags & PL_USE_PORTAL) != 0) { + anim = (gArea.portal_type == 4) ? 0x530 : 0x2c2; + } else { + if (gPlayerState.sword_state != 0) { + anim = 0x168; + } else { + if (gPlayerState.field_0x3[1] != 0) { + return; + } + if ((gPlayerState.flags & PL_USE_LANTERN) != 0) { + if (gUnk_03000B80[3].field_0xf != 0) { + return; + } + anim = 0x604; + } else { + anim = 0x100; + } + } + } + } + } + } + + gPlayerState.animation = anim; + if (gPlayerState.heldObject == 0) { + tmp = 0; + for (index = 0; index < 4; index++) { + if (gUnk_03000B80[index].field_0xf > tmp) { + tmp = gUnk_03000B80[index].field_0xf; + } + } + if (gPlayerState.field_0xe < tmp) { + return; + } + if ((u8)anim == gPlayerState.field_0x0[0]) { + UpdateAnimationSingleFrame(&gPlayerEntity); + } + } + gPlayerState.field_0x0[0] = anim; +} bool32 sub_08079B24(void) { if ((gPlayerEntity.action != PLAYER_MINISHDIE) && (gPlayerEntity.health == 0)) { @@ -1897,7 +2009,7 @@ bool32 sub_0807A2B8(void) { return TRUE; } else { if (((gPlayerState.jump_status & 200) == 0) && (gPlayerEntity.collisionLayer != 1)) { - CreateObjectWithParent(&gPlayerEntity, OBJECT_44, 0, 0); + CreateObjectWithParent(&gPlayerEntity, ROTATING_TRAPDOOR, 0, 0); } return FALSE; } @@ -2025,14 +2137,14 @@ void sub_0807AB44(Entity* this, s32 xOffset, s32 yOffset) { sub_0806FC50(GetTileType(COORD_TO_TILE_OFFSET(this, -xOffset, -yOffset), this->collisionLayer), 0xb); if (ptr != NULL) { if (ptr[3] == 0x76) { - object = CreateObject(OBJECT_2A, 1, 0); + object = CreateObject(FLAME, 1, 0); if (object != NULL) { PositionRelative(this, object, xOffset << 0x10, yOffset << 0x10); sub_08004168(object); sub_0807B7D8(ptr[3], COORD_TO_TILE(object), object->collisionLayer); } } else { - object = CreateObject(OBJECT_2A, 2, 0); + object = CreateObject(FLAME, 2, 0); if (object != NULL) { PositionRelative(this, object, xOffset << 0x10, yOffset << 0x10); object->child = (Entity*)ptr; @@ -2112,7 +2224,7 @@ void sub_0807ACCC(Entity* this) { bool32 sub_0807ADB8(Entity* this) { u8 tmp; - if ((gPlayerState.field_0x92 & 0x10) != 0) { + if ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_10) != 0) { gPlayerState.swim_state ^= 0x80; tmp = (gPlayerState.swim_state & 0x80); if (tmp != 0) { @@ -2130,7 +2242,7 @@ bool32 sub_0807ADB8(Entity* this) { void sub_0807AE20(Entity* this) { if ((((this->action != 0x17) || (gPlayerState.field_0xa == 0)) && (gRoomControls.reload_flags == 0)) && - ((gPlayerState.field_0x92 & 8) != 0)) { + ((gPlayerState.playerInput.field_0x92 & PLAYER_INPUT_8) != 0)) { if (GetInventoryValue(ITEM_SWIM_BUTTERFLY) == 1) { this->speed = 0x1c0; } else { @@ -2346,7 +2458,7 @@ void sub_0807B2B8(PlayerEntity* this) { void sub_0807B2F8(PlayerEntity* this) { if (this->unk_6e == 0) { - this->unk_6e += 1; + this->unk_6e++; sub_0809D738(super); } } diff --git a/src/projectile/ballAndChain.c b/src/projectile/ballAndChain.c index 110c80a0..32cfea4c 100644 --- a/src/projectile/ballAndChain.c +++ b/src/projectile/ballAndChain.c @@ -132,7 +132,7 @@ void sub_080AB26C(Entity* this) { if (--this->timer == 0) { DeleteThisEntity(); } else { - this->frameIndex += 1; + this->frameIndex++; } } diff --git a/src/projectile/darkNutSwordSlash.c b/src/projectile/darkNutSwordSlash.c index e0f3d3af..700f9629 100644 --- a/src/projectile/darkNutSwordSlash.c +++ b/src/projectile/darkNutSwordSlash.c @@ -31,7 +31,7 @@ void DarkNutSwordSlash(Entity* this) { CopyPositionAndSpriteOffset(this->parent, this); DarkNutSwordSlash_OnTick(this); if (this->type == 3) { - this->y.HALF.HI += 1; + this->y.HALF.HI++; UpdateAnimationSingleFrame(this); } } diff --git a/src/projectile/dirtBallProjectile.c b/src/projectile/dirtBallProjectile.c index 97d7c34e..5118394c 100644 --- a/src/projectile/dirtBallProjectile.c +++ b/src/projectile/dirtBallProjectile.c @@ -85,7 +85,7 @@ void DirtBallProjectile_Action1(Entity* this) { CopyPosition(this, this->child); if ((0xf < (u8)(this->timer++ + 1)) && (entity = this->child, entity->timer == 0)) { if ((this->timer & 2) != 0) { - entity->subtimer += 1; + entity->subtimer++; } if ((this->child->subtimer < 0x20) && ((this->child->subtimer & 3) == 3)) { parent->field_0x82.HALF.HI = 0xc0; diff --git a/src/projectile/guardLineOfSight.c b/src/projectile/guardLineOfSight.c index a55ded6b..f6ffeaf0 100644 --- a/src/projectile/guardLineOfSight.c +++ b/src/projectile/guardLineOfSight.c @@ -28,7 +28,7 @@ void GuardLineOfSight(Entity* this) { } CopyPosition(this->parent, this); if (this->subtimer != 0) { - this->subtimer -= 1; + this->subtimer--; } else { if (sub_080644C8(this) != 0) { if (((this->timer++) & 3) == 0) { diff --git a/src/projectile/mandiblesProjectile.c b/src/projectile/mandiblesProjectile.c index 976c096b..fd292039 100644 --- a/src/projectile/mandiblesProjectile.c +++ b/src/projectile/mandiblesProjectile.c @@ -82,7 +82,7 @@ void MandiblesProjectile_Init(Entity* this) { void MandiblesProjectile_Action1(Entity* this) { if (this->field_0x80.HWORD != 0) { - this->field_0x80.HWORD -= 1; + this->field_0x80.HWORD--; } else { if (--this->subtimer == 0) { sub_080AA270(this); @@ -128,7 +128,7 @@ void MandiblesProjectile_Action3(Entity* this) { } if (entity->confusedTime == 0) { if (this->subtimer != 0) { - this->subtimer -= 1; + this->subtimer--; } else { UpdateAnimationSingleFrame(this); if ((this->frame & ANIM_DONE) != 0) { @@ -164,7 +164,7 @@ void MandiblesProjectile_Action4(Entity* this) { this->child = NULL; } if (this->subtimer != 0) { - this->subtimer -= 1; + this->subtimer--; } else { if (sub_080AA374(this) != 0) { if (entity->health == 0) { diff --git a/src/projectile/mazaalEnergyBeam.c b/src/projectile/mazaalEnergyBeam.c index 1584348c..21287caa 100644 --- a/src/projectile/mazaalEnergyBeam.c +++ b/src/projectile/mazaalEnergyBeam.c @@ -28,7 +28,7 @@ void MazaalEnergyBeam_Action1(Entity* this) { InitializeAnimation(this, 1); } else { if (this->z.HALF.HI != 0) { - this->z.HALF.HI += 1; + this->z.HALF.HI++; } tmp = &gSineTable[this->direction]; diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c index 6645191b..e25a0db8 100644 --- a/src/projectile/octorokBossProjectile.c +++ b/src/projectile/octorokBossProjectile.c @@ -100,7 +100,7 @@ void OctorokBossProjectile_Action1(Entity* this) { this->direction ^= 0x80; this->speed = 0x400; } else { - this->parent->health -= 1; + this->parent->health--; this->parent->iframes = 0x1e; if (this->parent->field_0x7c.BYTES.byte0 != 0) { this->parent->knockbackDuration = 0x18; diff --git a/src/projectile/removableDust.c b/src/projectile/removableDust.c index aa4054ec..7927339f 100644 --- a/src/projectile/removableDust.c +++ b/src/projectile/removableDust.c @@ -49,7 +49,7 @@ void sub_080AA464(Entity* this) { if (this->type == 0) { sub_080AA544(this); } - entity = CreateObject(OBJECT_21, 3, 0); + entity = CreateObject(DIRT_PARTICLE, 3, 0); if (entity != NULL) { CopyPosition(this, entity); } @@ -68,7 +68,7 @@ void sub_080AA494(Entity* this) { if (*(iterator++) == tileType) { break; } - index += 1; + index++; } if (CheckFlags((u16)this->speed) != 0) { if (index == 4) { @@ -103,9 +103,9 @@ void sub_080AA544(Entity* this) { do { iVar2 = sub_080B1AE0((param - tmp[uVar3]) & 0xffff, this->collisionLayer); if (iVar2 == 0x3e) { - iVar4 += 1; + iVar4++; } - uVar3 += 1; + uVar3++; } while (uVar3 < 9); if (iVar4 == 8) { @@ -113,8 +113,8 @@ void sub_080AA544(Entity* this) { puVar5 = gUnk_08129FD0; do { sub_0807B7D8((u32)*puVar5, param - tmp[uVar3], this->collisionLayer); - puVar5 += 1; - uVar3 += 1; + puVar5++; + uVar3++; } while (uVar3 < 9); sub_080AA654(this, param); SetFlag((u16)this->speed); diff --git a/src/projectile/spiderWeb.c b/src/projectile/spiderWeb.c index 14909320..36d91e19 100644 --- a/src/projectile/spiderWeb.c +++ b/src/projectile/spiderWeb.c @@ -50,7 +50,7 @@ void sub_080AA6C0(Entity* this) { this->timer = 90; COLLISION_OFF(this); InitAnimationForceUpdate(this, this->type + 0x10); - object = CreateObject(OBJECT_2A, 3, 0); + object = CreateObject(FLAME, 3, 0); if (object != NULL) { object->type2 = 0x5a; object->spritePriority.b0 = 3; @@ -58,7 +58,7 @@ void sub_080AA6C0(Entity* this) { object->spriteOffsetY = typeSpritOffsets[this->type * 4 + 1]; object->parent = this; } - object = CreateObject(OBJECT_2A, 3, 0); + object = CreateObject(FLAME, 3, 0); if (object != NULL) { object->type2 = 0x5a; object->spritePriority.b0 = 3; @@ -204,14 +204,14 @@ void sub_080AA9E0(Entity* this) { case 0: case 3: { if (diff > 4) { - ptr += 1; + ptr++; } break; } case 1: case 2: { if (diff < -4) { - ptr += 1; + ptr++; } break; } diff --git a/src/projectile/torchTrapProjectile.c b/src/projectile/torchTrapProjectile.c index b3d86421..a42eee74 100644 --- a/src/projectile/torchTrapProjectile.c +++ b/src/projectile/torchTrapProjectile.c @@ -27,7 +27,7 @@ void TorchTrapProjectile_Init(Entity* this) { void TorchTrapProjectile_Action1(Entity* this) { GetNextFrame(this); if (this->timer != 0) { - this->timer -= 1; + this->timer--; } else { if (ProcessMovement3(this) == 0) { LinearMoveUpdate(this); diff --git a/src/projectile/v1EyeLaser.c b/src/projectile/v1EyeLaser.c index af8ec1bd..a94c71bb 100644 --- a/src/projectile/v1EyeLaser.c +++ b/src/projectile/v1EyeLaser.c @@ -107,7 +107,7 @@ void sub_080AB844(Entity* this, s32 param_1, s32 param_2) { void sub_080AB888(Entity* this) { s32 index; - this->subtimer -= 1; + this->subtimer--; index = 0; switch (this->timer) { @@ -324,7 +324,7 @@ static void LoadSmallChestTile(TileEntity* tile) { if (!t->tilePos) { MemCopy(tile, t, sizeof(TileEntity)); if ((t->_6 & 1) && (gRoomControls.scroll_flags & 2) && !CheckLocalFlag(t->localFlag)) { - Entity* e = CreateObject(OBJECT_52, t->localFlag, 0); + Entity* e = CreateObject(SPECIAL_CHEST, t->localFlag, 0); if (e != NULL) { sub_0806F704(e, t->tilePos); } @@ -83,23 +83,33 @@ static const SaveFileStatus sSaveDescInit = { 0xffff, 0xffff, 'TINI' }; static const SaveFileStatus sSaveDescDeleted = { 0xffff, 0xffff, 'FleD' }; const char sDummyData[8] = "DAMEDAME"; -const SaveFileEEPROMAddresses gSaveFileEEPROMAddresses[] = { { 0x500, 0x30, 0x1030, 0x80, 0x1080 }, - { 0x500, 0x40, 0x1040, 0x580, 0x1580 }, - { 0x500, 0x50, 0x1050, 0xa80, 0x1a80 }, - { 0x10, 0x20, 0x1020, 0x70, 0x1070 }, - { 0x20, 0, 0, 0, 0x1000 }, - { 0x20, 0x60, 0x1060, 0xf80, 0x1f80 }, - { 0x8, 0xfa0, 0x1fa0, 0xfa0, 0x1fa0 } }; +const SaveFileEEPROMAddresses gSaveFileEEPROMAddresses[] = { // + // Save 0 + { 0x500, 0x30, 0x1030, 0x80, 0x1080 }, + // Save 1 + { 0x500, 0x40, 0x1040, 0x580, 0x1580 }, + // Save 2 + { 0x500, 0x50, 0x1050, 0xa80, 0x1a80 }, + // 3: Save Header + { 0x10, 0x20, 0x1020, 0x70, 0x1070 }, + // 4: Signature (sSignatureLong) + { 0x20, 0, 0, 0, 0x1000 }, + // 5: ? sub_0807CF3C, sub_0807CF1C, InitSaveData + { 0x20, 0x60, 0x1060, 0xf80, 0x1f80 }, + // 6: ? unused? + { 0x8, 0xfa0, 0x1fa0, 0xfa0, 0x1fa0 } +}; #endif + void sub_0807CD9C(void) { UpdateGlobalProgress(); } -SaveResult HandleSave(u32 arg0) { - return sSaveHandlers[gMenu.storyPanelIndex](arg0); +SaveResult HandleSave(u32 action) { + return sSaveHandlers[gMenu.storyPanelIndex](action); } -SaveResult HandleSaveInit(u32 arg0) { +SaveResult HandleSaveInit(u32 action) { gSoundPlayingInfo.volumeMasterTarget -= 8; if (gSoundPlayingInfo.volumeMaster <= 0) { gMenu.field_0xa = 8; @@ -108,12 +118,12 @@ SaveResult HandleSaveInit(u32 arg0) { return SAVE_BUSY; } -SaveResult HandleSaveInProgress(u32 arg0) { +SaveResult HandleSaveInProgress(u32 action) { u32 temp; if (gMenu.field_0xa == 0) { InitDMA(); - switch (arg0) { + switch (action) { case 0: temp = WriteSaveFile(gSaveHeader->saveFileId, &gSave); break; @@ -122,19 +132,19 @@ SaveResult HandleSaveInProgress(u32 arg0) { temp = 1; break; case 2: - temp = Write_02000000(gSaveHeader); + temp = WriteSaveHeader(gSaveHeader); break; } gMenu.field_0xa = temp; gMenu.storyPanelIndex = SAVE_DONE; - sub_08056208(); + InitVBlankDMA(); } else { gMenu.field_0xa--; } return SAVE_BUSY; } -SaveResult HandleSaveDone(u32 arg0) { +SaveResult HandleSaveDone(u32 action) { SaveResult result; result = SAVE_BUSY; @@ -164,7 +174,7 @@ u32 InitSaveData(void) { eepromAddresses = GetSaveFileEEPROMAddresses(4); error = 0; if (DataCompare(eepromAddresses->address1, sSignatureLong, eepromAddresses->size) == 0) { - error += 1; + error++; } if (DataCompare(eepromAddresses->address2, sSignatureLong, eepromAddresses->size) == 0) { error += 2; @@ -192,11 +202,11 @@ u32 WriteSaveFile(u32 index, SaveFile* saveFile) { #endif } -u32 Write_02000000(SaveHeader* arg0) { +u32 WriteSaveHeader(SaveHeader* saveHeader) { #if defined(DEMO_USA) || defined(DEMO_JP) return 1; #else - return DataDoubleWriteWithStatus(3, arg0); + return DataDoubleWriteWithStatus(3, saveHeader); #endif } @@ -216,11 +226,11 @@ s32 ReadSaveFile(u32 index, SaveFile* saveFile) { #endif } -u32 Read_02000000(SaveHeader* arg0) { +u32 ReadSaveHeader(SaveHeader* saveHeader) { #if defined(DEMO_USA) || defined(DEMO_JP) return 0; #else - return DataDoubleReadWithStatus(3, arg0); + return DataDoubleReadWithStatus(3, saveHeader); #endif } @@ -253,7 +263,7 @@ void SetFileStatusInit(u32 index) { WriteSaveFileStatus(eepromAddresses->checksum1, fileStatus); } -u32 DataDoubleWriteWithStatus(u32 arg0, const void* data) { +u32 DataDoubleWriteWithStatus(u32 index, const void* data) { SaveFileStatus fileStatus; u32 ret; @@ -261,7 +271,7 @@ u32 DataDoubleWriteWithStatus(u32 arg0, const void* data) { bool32 write1success, write2success; u16 checksum; - eepromAddresses = GetSaveFileEEPROMAddresses(arg0); + eepromAddresses = GetSaveFileEEPROMAddresses(index); fileStatus.status = 'MCZ3'; checksum = CalculateChecksum((u16*)&fileStatus.status, 4); @@ -284,7 +294,7 @@ u32 DataDoubleWriteWithStatus(u32 arg0, const void* data) { return ret; } -u32 DataDoubleReadWithStatus(u32 param_1, void* data) { +u32 DataDoubleReadWithStatus(u32 index, void* data) { vu32 set_0; SaveFileStatus fileStatus; @@ -294,7 +304,7 @@ u32 DataDoubleReadWithStatus(u32 param_1, void* data) { u32 ret; u32 temp; - eepromAddresses = GetSaveFileEEPROMAddresses(param_1); + eepromAddresses = GetSaveFileEEPROMAddresses(index); read1status = ReadSaveFileStatus(eepromAddresses->checksum1, &fileStatus); if (read1status == 2) { if ((DataRead(eepromAddresses->address1, data, eepromAddresses->size) == 0) || @@ -406,8 +416,8 @@ u16 CalculateChecksum(u16* data, u32 size) { return checksum; } -const SaveFileEEPROMAddresses* GetSaveFileEEPROMAddresses(u32 unk_1) { - return &gSaveFileEEPROMAddresses[unk_1]; +const SaveFileEEPROMAddresses* GetSaveFileEEPROMAddresses(u32 index) { + return &gSaveFileEEPROMAddresses[index]; } /** diff --git a/src/script.c b/src/script.c index eb65eae3..ed3d67e4 100644 --- a/src/script.c +++ b/src/script.c @@ -13,7 +13,7 @@ void InitScriptForEntity(Entity*, ScriptExecutionContext*, u16*); void InitScriptExecutionContext(ScriptExecutionContext* context, u16* script); void sub_0807DE80(Entity*); -void sub_0807DF38(void); +void DisablePauseMenu(void); void ScriptCommandNop(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_BeginBlock(Entity* entity, ScriptExecutionContext* context); void ScriptCommand_EndBlock(Entity* entity, ScriptExecutionContext* context); @@ -440,18 +440,18 @@ void sub_0807DEDC(Entity* entity, ScriptExecutionContext* context, u32 x, u32 y) entity->animationState = (entity->animationState & 0x80) | sDirectionTable[(u8)direction >> 4]; } -void sub_0807DF28(void) { - sub_0807DF38(); +void DisablePauseMenuAndPutAwayItems(void) { + DisablePauseMenu(); PlayerDropHeldObject(); PutAwayItems(); } -void sub_0807DF38(void) { +void DisablePauseMenu(void) { gUnk_0200AF00.unk_1 = 0xff; gPauseMenuOptions.disabled = 0xff; } -void sub_0807DF50(void) { +void EnablePauseMenu(void) { gPauseMenuOptions.disabled = 0; gUnk_0200AF00.unk_1 = 0; RecoverUI(0, 0); @@ -1634,12 +1634,12 @@ void EquipItem(Entity* entity, ScriptExecutionContext* context) { ForceEquipItem(item, slot); } -void SetInputMacro(Entity* entity, ScriptExecutionContext* context) { - InitPlayerMacro((void*)context->intVariable); +void SetPlayerMacro(Entity* entity, ScriptExecutionContext* context) { + InitPlayerMacro((PlayerMacroEntry*)context->intVariable); } -void sub_0807F2A8(Entity* entity, ScriptExecutionContext* context) { - if (gPlayerState.field_0x9c == 0) { +void WaitForPlayerMacro(Entity* entity, ScriptExecutionContext* context) { + if (gPlayerState.playerInput.playerMacro == NULL) { gActiveScriptInfo.flags |= 1; } else { gActiveScriptInfo.commandSize = 0; @@ -1714,7 +1714,7 @@ void LoadMenu(Entity* entity, ScriptExecutionContext* context) { MenuFadeIn(context->intVariable & 0xff, (u8)(context->intVariable >> 8)); } -void sub_0807F434(Entity* entity, ScriptExecutionContext* context) { +void CheckInteractType(Entity* entity, ScriptExecutionContext* context) { switch (entity->interactType) { case 1: entity->interactType = 0; @@ -1810,7 +1810,7 @@ void WaitForCameraTouchRoomBorder(Entity* entity, ScriptExecutionContext* contex bottom = gRoomControls.origin_y + gRoomControls.height - DISPLAY_HEIGHT; if (left == gRoomControls.scroll_x && bottom == gRoomControls.scroll_y) - gActiveScriptInfo.flags |= 1u; + gActiveScriptInfo.flags |= 1; else gActiveScriptInfo.commandSize = 0; } @@ -2056,7 +2056,7 @@ void WaitForPlayerNormalOrTalkEzlo(Entity* entity, ScriptExecutionContext* conte gActiveScriptInfo.commandSize = 0; break; default: - gActiveScriptInfo.flags |= 1u; + gActiveScriptInfo.flags |= 1; break; } } diff --git a/src/subtask2.c b/src/subtask2.c index 36030515..31f813a4 100644 --- a/src/subtask2.c +++ b/src/subtask2.c @@ -364,10 +364,10 @@ void sub_080A57F4(void) { gOamCmd.x = puVar10->unk6; gOamCmd.y = puVar10->unk7; frameIndex = puVar10->unk4 + 9; - if ((gMain.ticks.HWORD & 0x10) == 0) { + if ((gMain.ticks & 0x10) == 0) { frameIndex += 2; } else { - frameIndex += 1; + frameIndex++; } DrawDirect(DRAW_DIRECT_SPRITE_INDEX, frameIndex); @@ -609,7 +609,7 @@ void sub_080A5BF0(void) { gUnk_08128D30[gMenu.menuType](); sub_080A5D1C(); - temp = gMain.ticks.HWORD; + temp = gMain.ticks; if ((temp & 7) == 0) { uVar1 = *gUnk_02017830; MemCopy(gUnk_02017830 + 1, gUnk_02017830, 0xe); @@ -687,10 +687,10 @@ void sub_080A5D1C(void) { gOamCmd._8 = 0; gOamCmd.x = 0x34; gOamCmd.y = bVar1 + gMenu.field_0x3 * 0xc; - DrawDirect(DRAW_DIRECT_SPRITE_INDEX, (gMain.ticks.HWORD & 0x10) == 0 ? 0x75 : 0x74); + DrawDirect(DRAW_DIRECT_SPRITE_INDEX, (gMain.ticks & 0x10) == 0 ? 0x75 : 0x74); gOamCmd.x = 0x20; gOamCmd.y = bVar1 + uVar4 * 0xc; - DrawDirect(DRAW_DIRECT_SPRITE_INDEX, (gMain.ticks.HWORD & 0x20) != 0 ? 0x78 : 0x79); + DrawDirect(DRAW_DIRECT_SPRITE_INDEX, (gMain.ticks & 0x20) != 0 ? 0x78 : 0x79); gOamCmd.y = 0x7e; gOamCmd._8 = 0x4380; if (HasDungeonSmallKey()) { @@ -712,7 +712,7 @@ void sub_080A5D1C(void) { gOamCmd._8 = 0; gOamCmd.x = 0x46; gOamCmd.y = bVar1 + (pbVar9[1] - pbVar9[2]) * 0xc; - if ((gMain.ticks.HWORD & 0x20) != 0) { + if ((gMain.ticks & 0x20) != 0) { uVar6 = 0x7a; } else { uVar6 = 0x7b; @@ -790,7 +790,7 @@ void sub_080A5F48(u32 param_1, u32 param_2) { temp1 = param_2 * 0x20 + 0x6010000; temp3 = gSpriteAnimations_322[param_1]->index; temp2 = &gMoreSpritePtrs[1][temp3 * 2]; - DmaSet(3, &gMoreSpritePtrs[2][temp2[1] * 0x10], temp1, 0x84000040); + DmaCopy32(3, &gMoreSpritePtrs[2][temp2[1] * 0x10], temp1, 0x40 * 4); ammoCount = -1; switch (param_1) { @@ -810,8 +810,8 @@ void sub_080A5F48(u32 param_1, u32 param_2) { if ((int)tensDigit >= 10) { tensDigit = 9; } - DmaSet(3, gUnk_085C4620 + tensDigit * 0x8, temp1, 0x84000008); - DmaSet(3, gUnk_085C4620 + (param_1 + 10) * 0x8, temp1 + 0x20, 0x84000008); + DmaCopy32(3, gUnk_085C4620 + tensDigit * 0x8, temp1, 0x8 * 4); + DmaCopy32(3, gUnk_085C4620 + (param_1 + 10) * 0x8, temp1 + 0x20, 0x8 * 4); } } @@ -905,7 +905,7 @@ void sub_080A617C(void) { gOamCmd._8 = 0xc00; gOamCmd.y = 0x2f; gOamCmd.x = gMenu.field_0x3 * 0x1b + 0x1a; - if ((gMain.ticks.HWORD & 0x20) != 0) { + if ((gMain.ticks & 0x20) != 0) { frameIndex = 8; } else { frameIndex = 9; @@ -1258,7 +1258,9 @@ void sub_080A67C4(u32 param_1) { *puVar2 = 0x1e0a; } - sub_0805622C((struct BgAffineDstData*)&gUnk_02017AA0[gUnk_03003DE4[0] * 0x500], REG_ADDR_BG3CNT, 0xa2600001); + SetVBlankDMA((u16*)&gUnk_02017AA0[gUnk_03003DE4[0] * 0x500], (u16*)REG_ADDR_BG3CNT, + ((DMA_ENABLE | DMA_START_HBLANK | DMA_16BIT | DMA_REPEAT | DMA_SRC_INC | DMA_DEST_RELOAD) << 16) + + 0x1); gMenu.field_0xa = ptr->unk2 >> 1; MemClear(&gMapDataBottomSpecial, 0x400); } @@ -479,7 +479,7 @@ u32 sub_0805F46C(u32 param_1, const Font* param_2) { uVar8 = (uVar8 + 0xf) & ~0xf; puVar9 -= (uVar8 >> 4) + 1; } else { - font.dest += 1; + font.dest++; } uVar8 = uVar8 >> 3; param_1 = font.gfx_src; diff --git a/src/title.c b/src/title.c index bc8b30b5..28aae607 100644 --- a/src/title.c +++ b/src/title.c @@ -369,7 +369,7 @@ static void HandleJapaneseTitlescreenAnimationIntro(void) { #else gIntroState.timer = 90; #endif - pEVar2 = CreateObject(OBJECT_B4, 0, 0); + pEVar2 = CreateObject(JAPANESE_SUBTITLE, 0, 0); if (pEVar2 != NULL) { pEVar2->x.HALF.HI = 0; pEVar2->y.HALF.HI = DISPLAY_HEIGHT / 2 - 8; @@ -415,7 +415,7 @@ static void HandleTitlescreenAnimationIntro(void) { gIntroState.timer = 300; #endif gIntroState.subState++; - CreateObject(OBJECT_BD, 0, 0); + CreateObject(TITLE_SCREEN_OBJECT, 0, 0); SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 16); SoundReq(SFX_F8); } @@ -140,7 +140,7 @@ void sub_0801C25C(void) { u8 temp = element->unk_0_2; if (temp == 1) { element->unk_0_2 = 2; - DmaSet(3, element->firstTile, element->unk_1a * 0x20 + 0x6010000, element->numTiles << 3 | 0x84000000); + DmaCopy32(3, element->firstTile, element->unk_1a * 0x20 + 0x6010000, (element->numTiles << 3) * 4); } } } @@ -167,8 +167,8 @@ void sub_0801C2F0(u32 param_1, u32 param_2) { uVar1 = 9; } - DmaSet(3, (gUnk_085C4620 + uVar1 * 8), param_1, 0x84000008); - DmaSet(3, (gUnk_085C4620 + (rem + 10) * 8), param_1 + 0x20, 0x84000008); + DmaCopy32(3, (gUnk_085C4620 + uVar1 * 8), param_1, 0x8 * 4); + DmaCopy32(3, (gUnk_085C4620 + (rem + 10) * 8), param_1 + 0x20, 0x8 * 4); } void DrawUI(void) { @@ -336,16 +336,16 @@ void DrawDigits(u32 iconVramIndex, u32 count, u32 isTextYellow, u32 digits) { case 3: digit = Div(count, 100); count = r1; - DmaSet(3, puVar4 + digit * 0x40, iVar2, 0x84000010); + DmaCopy32(3, puVar4 + digit * 0x40, iVar2, 0x10 * 4); iVar2 = iVar3 + 0x600c040; case 2: digit = Div(count, 10); count = r1; - DmaSet(3, puVar4 + digit * 0x40, iVar2, 0x84000010); + DmaCopy32(3, puVar4 + digit * 0x40, iVar2, 0x10 * 4); iVar2 += 0x40; } - DmaSet(3, puVar4 + count * 0x40, iVar2, 0x84000010); + DmaCopy32(3, puVar4 + count * 0x40, iVar2, 0x10 * 4); } void sub_0801C66C(void) { |
