From 2816176661b0262387408411f95b0c02af3a7d41 Mon Sep 17 00:00:00 2001 From: KEKW555 <152369890+KEKW555@users.noreply.github.com> Date: Thu, 28 Dec 2023 09:50:15 +0530 Subject: [PATCH 01/15] Remove sub_0809CBE4 fake match --- src/object/frozenOctorok.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c index 7aaaac94..6f46ac27 100644 --- a/src/object/frozenOctorok.c +++ b/src/object/frozenOctorok.c @@ -421,16 +421,9 @@ void sub_0809CB70(FrozenOctorokEntity* this, s32 angle, s32 radius) { } void sub_0809CBE4(FrozenOctorokEntity* this) { - u16 tmp1; - FORCE_REGISTER(u8 tmp4, r4); - u8* tmp3 = &this->unk_79; - tmp1 = super->subtimer; - tmp4 = *tmp3; - tmp1 += tmp4; - this->unk_79 = tmp1; + this->unk_79 += super->subtimer; if ((s8)super->subtimer < 0) { - u8 tmp_r0 = super->timer; - if (tmp1 << 0x18 < -tmp_r0 << 0x18) { + if ((s8)this->unk_79 < (s8)-super->timer) { super->subtimer = -super->subtimer; SoundReq(SFX_19E); } From acc75c269df3ddcc3eea32bae5725c94a132fa24 Mon Sep 17 00:00:00 2001 From: theo3 Date: Thu, 28 Dec 2023 16:04:32 -0800 Subject: [PATCH 02/15] use correct signedness for char in tools --- tools/src/asset_processor/reader.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/src/asset_processor/reader.h b/tools/src/asset_processor/reader.h index dc2159fc..d31bf0f0 100644 --- a/tools/src/asset_processor/reader.h +++ b/tools/src/asset_processor/reader.h @@ -13,7 +13,7 @@ class Reader { [[nodiscard]] s8 read_s8() { // TODO range check - return data[static_cast(cursor++)]; + return static_cast(data[static_cast(cursor++)]); } [[nodiscard]] u8 read_u8() { @@ -35,4 +35,4 @@ class Reader { // const int size; }; -#endif \ No newline at end of file +#endif From 7c1c612c9ba95b47f33cfd217ab99c4c9102531e Mon Sep 17 00:00:00 2001 From: theo3 Date: Thu, 28 Dec 2023 17:48:05 -0800 Subject: [PATCH 03/15] fix fakematch in LinkHoldingItem_Action3 --- include/player.h | 32 +++++++++++------------ src/beanstalkSubtask.c | 6 ++--- src/code_0805EC04.c | 26 +++++++++---------- src/enemy/likeLike.c | 8 +++--- src/item/itemPegasusBoots.c | 6 ++--- src/item/itemTryPickupObject.c | 4 +-- src/itemUtils.c | 20 +++++++------- src/manager/miscManager.c | 2 +- src/menu/pauseMenu.c | 4 +-- src/npc/bigGoron.c | 2 +- src/npc/bladeBrothers.c | 4 +-- src/npc/npc4E.c | 4 +-- src/object/crenelBeanSprout.c | 2 +- src/object/houseDoorExterior.c | 2 +- src/object/itemForSale.c | 4 +-- src/object/linkHoldingItem.c | 10 +++---- src/player.c | 15 +++++------ src/playerItem/playerItemBomb.c | 4 +-- src/playerUtils.c | 46 ++++++++++++++++----------------- src/title.c | 2 +- src/ui.c | 2 +- 21 files changed, 101 insertions(+), 104 deletions(-) diff --git a/include/player.h b/include/player.h index 49a4bce7..19be9997 100644 --- a/include/player.h +++ b/include/player.h @@ -243,23 +243,21 @@ typedef struct { } PlayerMacroEntry; typedef enum { - PLAYER_INPUT_1 = 0x1, // A - PLAYER_INPUT_2 = 0x2, // B - PLAYER_INPUT_8 = 0x8, // A sub_080782C0, sub_0807953C, PlayerUpdateSwimming, sub_08076518. ItemForSale_Action2 - PLAYER_INPUT_10 = 0x10, // B sub_0807953C, ToggleDiving, sub_08076518, ItemForSale_Action2 - PLAYER_INPUT_20 = 0x20, // R sub_0807953C - PLAYER_INPUT_40 = 0x40, // A CrenelBeanSprout_Action1 - PLAYER_INPUT_80 = + INPUT_USE_ITEM1 = 0x1, // A + INPUT_USE_ITEM2 = 0x2, // B + INPUT_INTERACT = 0x8, // A sub_080782C0, sub_0807953C, PlayerUpdateSwimming, sub_08076518. ItemForSale_Action2 + INPUT_CANCEL = 0x10, // B sub_0807953C, ToggleDiving, sub_08076518, ItemForSale_Action2 + INPUT_CONTEXT = 0x20, // R sub_0807953C + INPUT_40 = 0x40, // A CrenelBeanSprout_Action1 + INPUT_ACTION = 0x80, // R sub_08073584, IsPreventedFromUsingItem, sub_080782C0, CrenelBeanSprout_Action1, ItemForSale_Action2 - PLAYER_INPUT_RIGHT = 0x100, - PLAYER_INPUT_LEFT = 0x200, - PLAYER_INPUT_UP = 0x400, - PLAYER_INPUT_DOWN = 0x800, - PLAYER_INPUT_ANY_DIRECTION = 0xf00, - PLAYER_INPUT_1000 = 0x1000, // L, where is it set? sub_080782C0 - PLAYER_INPUT_8000 = 0x8000, // R, IsTryingToPickupObject, sub_08076518 - - // TODO What is the result of u32 result = (s32) - (keys & 0x200) >> 0x1f & 0x1000;? + INPUT_RIGHT = 0x100, + INPUT_LEFT = 0x200, + INPUT_UP = 0x400, + INPUT_DOWN = 0x800, + INPUT_ANY_DIRECTION = 0xf00, + INPUT_FUSE = 0x1000, // L, where is it set? sub_080782C0 + INPUT_LIFT_THROW = 0x8000, // R, IsTryingToPickupObject, sub_08076518 } PlayerInputState; typedef struct { @@ -535,7 +533,7 @@ typedef struct { /*0x09*/ u8 _hasAllFigurines; /*0x0a*/ u8 charm; /*0x0b*/ u8 picolyteType; - /*0x0c*/ u8 itemButtons[2]; + /*0x0c*/ u8 equipped[2]; /*0x0e*/ u8 bottles[4]; /*0x12*/ u8 effect; /*0x13*/ u8 hasAllFigurines; diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index 3d425817..a115acc1 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -313,7 +313,7 @@ u32 UpdatePlayerCollision(void) { return 0; } gUnk_0200AF00.rActionInteractTile = R_ACTION_READ; - if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) { + if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_40)) == 0) { return 0; } gPlayerState.mobility = 1; @@ -327,7 +327,7 @@ u32 UpdatePlayerCollision(void) { return 0; } gUnk_0200AF00.rActionInteractTile = R_ACTION_OPEN; - if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { + if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_INTERACT)) == 0) { return 0; } gPlayerState.mobility = 1; @@ -338,7 +338,7 @@ u32 UpdatePlayerCollision(void) { return 0; } gUnk_0200AF00.rActionInteractTile = R_ACTION_OPEN; - if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { + if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_INTERACT)) == 0) { return 0; } gPlayerState.mobility = 1; diff --git a/src/code_0805EC04.c b/src/code_0805EC04.c index 1a040933..4d584da9 100644 --- a/src/code_0805EC04.c +++ b/src/code_0805EC04.c @@ -138,40 +138,40 @@ void UpdatePlayerInput(void) { gPlayerState.playerInput.heldInput = state; gPlayerState.playerInput.newInput = state & prevState; // Calculate the direction from the currently held input. - gPlayerState.direction = gUnk_08109202[(state & PLAYER_INPUT_ANY_DIRECTION) >> 8]; + gPlayerState.direction = gUnk_08109202[(state & INPUT_ANY_DIRECTION) >> 8]; } u32 ConvInputToState(u32 keys) { u32 result; if (keys & L_BUTTON) { - result = 0x1000; + result = INPUT_FUSE; } else { result = 0; } if (keys & R_BUTTON) { - result |= PLAYER_INPUT_20; - result |= PLAYER_INPUT_8000; - result |= PLAYER_INPUT_80; + result |= INPUT_CONTEXT; + result |= INPUT_LIFT_THROW; + result |= INPUT_ACTION; } if (keys & A_BUTTON) { - result |= PLAYER_INPUT_8; - result |= PLAYER_INPUT_40 | PLAYER_INPUT_1; + result |= INPUT_INTERACT; + result |= INPUT_40 | INPUT_USE_ITEM1; } if (keys & B_BUTTON) { - result |= PLAYER_INPUT_10; - result |= PLAYER_INPUT_2; + result |= INPUT_CANCEL; + result |= INPUT_USE_ITEM2; } if (keys & DPAD_RIGHT) { - result |= PLAYER_INPUT_RIGHT; + result |= INPUT_RIGHT; } if (keys & DPAD_LEFT) { - result |= PLAYER_INPUT_LEFT; + result |= INPUT_LEFT; } if (keys & DPAD_UP) { - result |= PLAYER_INPUT_UP; + result |= INPUT_UP; } if (keys & DPAD_DOWN) { - result |= PLAYER_INPUT_DOWN; + result |= INPUT_DOWN; } return result; } diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index 886aa8b7..782a51b2 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -260,12 +260,12 @@ void sub_080281A0(LikeLikeEntity* this) { bool32 LikeLike_StealItem(u32 item) { bool32 ret = FALSE; if (GetInventoryValue(item) == 1) { - if (ItemIsShield(gSave.stats.itemButtons[SLOT_A])) { - gSave.stats.itemButtons[SLOT_A] = ITEM_NONE; + if (ItemIsShield(gSave.stats.equipped[SLOT_A])) { + gSave.stats.equipped[SLOT_A] = ITEM_NONE; } - if (ItemIsShield(gSave.stats.itemButtons[SLOT_B])) { - gSave.stats.itemButtons[SLOT_B] = ITEM_NONE; + if (ItemIsShield(gSave.stats.equipped[SLOT_B])) { + gSave.stats.equipped[SLOT_B] = ITEM_NONE; } SetInventoryValue(item, 0); diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index 1f4aa52a..55088984 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -107,10 +107,10 @@ void sub_08076964(ItemBehavior* this, u32 index) { SetItemAnim(this, ANIM_DASH); entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_DASH_SWORD); if (entity != NULL) { - if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != 0) { - uVar3 = gSave.stats.itemButtons[SLOT_A]; + if (ItemIsSword(gSave.stats.equipped[SLOT_A]) != 0) { + uVar3 = gSave.stats.equipped[SLOT_A]; } else { - uVar3 = gSave.stats.itemButtons[SLOT_B]; + uVar3 = gSave.stats.equipped[SLOT_B]; } entity->field_0x68.HALF.LO = uVar3; return; diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index c1fc697e..1eb76da5 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -145,7 +145,7 @@ void sub_080762D8(ItemBehavior* this, u32 index) { if (gPlayerEntity.iframes < 9 && gPlayerEntity.knockbackDuration == 0) { if (this->field_0x18 != NULL) { if (this->field_0x18->action == 2 && this->field_0x18->subAction == 5) { - if (!(gPlayerState.playerInput.heldInput & PLAYER_INPUT_80)) { // Pressing R + if (!(gPlayerState.playerInput.heldInput & INPUT_ACTION)) { // Pressing R this->field_0x18->subAction = 6; PlayerCancelHoldItem(this, index); return; @@ -263,7 +263,7 @@ void sub_08076518(ItemBehavior* this, u32 index) { if (gPlayerEntity.knockbackDuration != 0) { PlayerCancelHoldItem(this, index); } else { - if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_8000 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0) { + if ((gPlayerState.playerInput.newInput & (INPUT_LIFT_THROW | INPUT_CANCEL | INPUT_INTERACT)) != 0) { sub_0806F948(&gPlayerEntity); gPlayerState.heldObject = 5; this->field_0x18->subAction = 2; diff --git a/src/itemUtils.c b/src/itemUtils.c index 1b3cf948..c78c0da3 100644 --- a/src/itemUtils.c +++ b/src/itemUtils.c @@ -255,9 +255,9 @@ void ModArrows(s32 arrows) { EquipSlot IsItemEquipped(u32 itemId) { EquipSlot equipSlot; - if (itemId == gSave.stats.itemButtons[SLOT_A]) { + if (itemId == gSave.stats.equipped[SLOT_A]) { equipSlot = EQUIP_SLOT_A; - } else if (itemId == gSave.stats.itemButtons[SLOT_B]) { + } else if (itemId == gSave.stats.equipped[SLOT_B]) { equipSlot = EQUIP_SLOT_B; } else { equipSlot = EQUIP_SLOT_NONE; @@ -273,17 +273,17 @@ void PutItemOnSlot(u32 itemId) { } if (itemId2 - 1 < 0x1f) { equipSlot = EQUIP_SLOT_NONE; - if (gSave.stats.itemButtons[SLOT_A] == ITEM_NONE) { + if (gSave.stats.equipped[SLOT_A] == ITEM_NONE) { equipSlot = EQUIP_SLOT_A; - } else if (gSave.stats.itemButtons[SLOT_B] == ITEM_NONE) { + } else if (gSave.stats.equipped[SLOT_B] == ITEM_NONE) { equipSlot = EQUIP_SLOT_B; } if (equipSlot == EQUIP_SLOT_NONE) { u32 temp = gItemMetaData[itemId2].menuSlot; - if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_A]].menuSlot) { + if (temp == gItemMetaData[gSave.stats.equipped[SLOT_A]].menuSlot) { equipSlot = EQUIP_SLOT_A; } else { - if (temp == gItemMetaData[gSave.stats.itemButtons[SLOT_B]].menuSlot) { + if (temp == gItemMetaData[gSave.stats.equipped[SLOT_B]].menuSlot) { equipSlot = EQUIP_SLOT_B; } } @@ -302,13 +302,13 @@ void ForceEquipItem(u32 itemId, u32 equipSlot) { if ((itemId - 1 < 0x1f) && (equipSlot < EQUIP_SLOT_NONE)) { otherItemSlot = equipSlot == EQUIP_SLOT_A; - replacedItem = gSave.stats.itemButtons[equipSlot]; - otherItem = gSave.stats.itemButtons[otherItemSlot]; + replacedItem = gSave.stats.equipped[equipSlot]; + otherItem = gSave.stats.equipped[otherItemSlot]; if (gItemMetaData[otherItem].menuSlot == gItemMetaData[itemId].menuSlot) { otherItem = replacedItem; } - gSave.stats.itemButtons[equipSlot] = itemId; - gSave.stats.itemButtons[otherItemSlot] = otherItem; + gSave.stats.equipped[equipSlot] = itemId; + gSave.stats.equipped[otherItemSlot] = otherItem; gUnk_0200AF00.unk_13 = 0x7f; gUnk_0200AF00.unk_14 = 0x7f; } diff --git a/src/manager/miscManager.c b/src/manager/miscManager.c index 5ae26ace..80d4cffc 100644 --- a/src/manager/miscManager.c +++ b/src/manager/miscManager.c @@ -364,7 +364,7 @@ void MiscManager_TypeB(MiscManager* this) { bool32 sub_080593CC(MiscManager* this) { if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.animationState == 0 && - (gPlayerState.playerInput.heldInput & PLAYER_INPUT_ANY_DIRECTION) == PLAYER_INPUT_UP) { + (gPlayerState.playerInput.heldInput & INPUT_ANY_DIRECTION) == INPUT_UP) { return EntityWithinDistance(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6); } return FALSE; diff --git a/src/menu/pauseMenu.c b/src/menu/pauseMenu.c index 2ea79113..6b1d0cef 100644 --- a/src/menu/pauseMenu.c +++ b/src/menu/pauseMenu.c @@ -529,14 +529,14 @@ void PauseMenu_ItemMenu_Draw(void) { gOamCmd._8 = 0x800; DrawDirect(sub_080A5384_draw_constant0, 0x22); } - i = GetMenuSlotForItem(gSave.stats.itemButtons[SLOT_A]); + i = GetMenuSlotForItem(gSave.stats.equipped[SLOT_A]); if (i < MENU_SLOT_COUNT) { entry = &gItemMenuTable[i]; gOamCmd.x = entry->x; gOamCmd.y = entry->y; DrawDirect(sub_080A5384_draw_constant0, 3); } - i = GetMenuSlotForItem(gSave.stats.itemButtons[SLOT_B]); + i = GetMenuSlotForItem(gSave.stats.equipped[SLOT_B]); if (i < MENU_SLOT_COUNT) { entry = &gItemMenuTable[i]; gOamCmd.x = entry->x; diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index 83205c44..059f6163 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -434,7 +434,7 @@ void sub_0806D5D4(void) { InitBiggoronTimer(); equipSlot = IsItemEquipped(ITEM_SHIELD); if (equipSlot != EQUIP_SLOT_NONE) { - gSave.stats.itemButtons[equipSlot] = ITEM_NONE; + gSave.stats.equipped[equipSlot] = ITEM_NONE; } SetInventoryValue(ITEM_SHIELD, 0); } diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index ecb97fe2..598b0523 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -339,10 +339,10 @@ void BladeBrothers_StartPlayerDemonstration(Entity* this, ScriptExecutionContext } void sub_08068BB4(BladeBrothersEntity* this) { - u32 item = gSave.stats.itemButtons[SLOT_A]; + u32 item = gSave.stats.equipped[SLOT_A]; this->itemSlotA = item; - item = gSave.stats.itemButtons[SLOT_B]; + item = gSave.stats.equipped[SLOT_B]; this->itemSlotB = item; } diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c index 910fb485..e60812b2 100644 --- a/src/npc/npc4E.c +++ b/src/npc/npc4E.c @@ -186,8 +186,8 @@ Item NPC4E_GetItemWithSwordUpgraded(Item itemId) { } void NPC4E_SaveEquippedItems(NPC4EEntity* this) { - this->unk_68 = gSave.stats.itemButtons[SLOT_A]; - this->unk_69 = gSave.stats.itemButtons[SLOT_B]; + this->unk_68 = gSave.stats.equipped[SLOT_A]; + this->unk_69 = gSave.stats.equipped[SLOT_B]; } void NPC4E_RestoreEquippedItems(NPC4EEntity* this) { diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index a9d500cd..1e28d988 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -179,7 +179,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { RestorePrevTileEntity(0xdc, super->collisionLayer); sub_08096A78(this); } - if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) { + if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_40)) == 0) { return; } if (gUnk_0200AF00.rActionPlayerState != R_ACTION_THROW) { diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index 5b0a94f6..a921f8ba 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -184,7 +184,7 @@ void sub_0808692C(HouseDoorExteriorEntity* this) { static u8 sub_08086954(HouseDoorExteriorEntity* this) { if (sub_0800445C(super)) { if (GetAnimationStateInRectRadius(super, 6, 20) >= 0 && gPlayerEntity.animationState == 0 && - (u16)gPlayerState.playerInput.heldInput == PLAYER_INPUT_UP && gPlayerState.jump_status == 0) { + (u16)gPlayerState.playerInput.heldInput == INPUT_UP && gPlayerState.jump_status == 0) { super->timer--; } } else { diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index 7dcef6c5..aca8b2fd 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -118,8 +118,8 @@ void ItemForSale_Action2(ItemForSaleEntity* this) { ptr = sub_080784E4(); if (((*(int*)(ptr + 8) == 0) || ((*(u8*)(ptr + 1) != 1 || (gUnk_0200AF00.rActionPlayerState = R_ACTION_SPEAK, (gPlayerState.playerInput.newInput & - (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0)))) && - ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0)) { + (INPUT_ACTION | INPUT_INTERACT)) == 0)))) && + ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_CANCEL | INPUT_INTERACT)) != 0)) { sub_080819B4(this); } } diff --git a/src/object/linkHoldingItem.c b/src/object/linkHoldingItem.c index ae982637..cf14269a 100644 --- a/src/object/linkHoldingItem.c +++ b/src/object/linkHoldingItem.c @@ -123,8 +123,8 @@ void LinkHoldingItem_Action2(LinkHoldingItemEntity* this) { } void LinkHoldingItem_Action3(LinkHoldingItemEntity* this) { - u32 tmp; - if ((super->parent)->action == 8) { + u32 bottle_no; + if (super->parent->action == PLAYER_ITEMGET) { return; } switch (super->timer) { @@ -149,9 +149,9 @@ void LinkHoldingItem_Action3(LinkHoldingItemEntity* this) { ModHealth(160); break; case 3: - tmp = GetBottleContaining(super->type); - if (tmp != 0) { - gSave.stats.itemButtons[tmp + 1] = ITEM_BOTTLE_EMPTY; + bottle_no = GetBottleContaining(super->type); + if (bottle_no != 0) { + gSave.stats.bottles[bottle_no - 1] = ITEM_BOTTLE_EMPTY; } else { SetInventoryValue(super->type, ITEM_GREEN_SWORD); } diff --git a/src/player.c b/src/player.c index 12b1ff45..cc028dba 100644 --- a/src/player.c +++ b/src/player.c @@ -2750,7 +2750,7 @@ static void sub_08073504(Entity* this) { static void sub_08073584(Entity* this) { u32 state, dir, idx; - if ((gPlayerState.playerInput.newInput & PLAYER_INPUT_80) || this->iframes > 0 || gPlayerState.field_0x3c || + if ((gPlayerState.playerInput.newInput & INPUT_ACTION) || this->iframes > 0 || gPlayerState.field_0x3c || (gPlayerState.flags & PL_PARACHUTE) == 0) { gPlayerState.jump_status |= 0x40; PlayerSetNormalAndCollide(); @@ -3447,10 +3447,10 @@ void SurfaceAction_14(Entity* this) { void SurfaceAction_CloneTile(Entity* this) { if (gPlayerState.chargeState.action == 4) { u32 item, n, i; - if (ItemIsSword(gSave.stats.itemButtons[SLOT_A])) { - item = gSave.stats.itemButtons[SLOT_A]; + if (ItemIsSword(gSave.stats.equipped[SLOT_A])) { + item = gSave.stats.equipped[SLOT_A]; } else { - item = gSave.stats.itemButtons[SLOT_B]; + item = gSave.stats.equipped[SLOT_B]; } switch (item) { case 1: @@ -3523,8 +3523,7 @@ void SurfaceAction_ShallowWater(Entity* this) { this->spritePriority.b0 = 4; gPlayerState.swim_state = 0; } - if ((gPlayerState.playerInput.newInput & PLAYER_INPUT_ANY_DIRECTION) || - gPlayerState.surfacePositionSameTimer == 1) + if ((gPlayerState.playerInput.newInput & INPUT_ANY_DIRECTION) || gPlayerState.surfacePositionSameTimer == 1) SoundReq(SFX_WATER_WALK); } } @@ -3567,7 +3566,7 @@ void SurfaceAction_Swamp(Entity* this) { CreateObjectWithParent(this, OBJECT_70, 0, 0); CreateFx(this, FX_GREEN_SPLASH, 0); SoundReq(SFX_161); - } else if ((gPlayerState.playerInput.newInput & PLAYER_INPUT_ANY_DIRECTION) != 0) { + } else if ((gPlayerState.playerInput.newInput & INPUT_ANY_DIRECTION) != 0) { SoundReq(SFX_161); } else if ((gRoomTransition.frameCount & 0xf) == 0) { SoundReq(SFX_161); @@ -3723,7 +3722,7 @@ void SurfaceAction_Dust(Entity* this) { if (!sub_080741C4()) { gPlayerState.speed_modifier -= 128; if (gPlayerState.surfacePositionSameTimer == 1 || - (gPlayerState.playerInput.newInput & PLAYER_INPUT_ANY_DIRECTION) != 0) { + (gPlayerState.playerInput.newInput & INPUT_ANY_DIRECTION) != 0) { if (gPlayerState.floor_type == SURFACE_DUST) CreateObjectWithParent(this, DIRT_PARTICLE, 1, 0); else diff --git a/src/playerItem/playerItemBomb.c b/src/playerItem/playerItemBomb.c index 63647459..af443266 100644 --- a/src/playerItem/playerItemBomb.c +++ b/src/playerItem/playerItemBomb.c @@ -113,10 +113,10 @@ void PlayerItemBomb_Action1(PlayerItemBombEntity* this) { } switch (IsItemEquipped(ITEM_REMOTE_BOMBS)) { case EQUIP_SLOT_A: - input = PLAYER_INPUT_1; + input = INPUT_USE_ITEM1; break; case EQUIP_SLOT_B: - input = PLAYER_INPUT_2; + input = INPUT_USE_ITEM2; break; case EQUIP_SLOT_NONE: input = 0; diff --git a/src/playerUtils.c b/src/playerUtils.c index cddb108a..cff07abb 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -175,8 +175,8 @@ void UpdateActiveItems(PlayerEntity* this) { gPlayerState.attack_status &= 0xf; if (((gPlayerState.field_0x7 | gPlayerState.jump_status) & 0x80) == 0 && (gPlayerState.jump_status & 0x40) == 0 && gPlayerState.swim_state == 0 && IsAbleToUseItem(this) && !IsPreventedFromUsingItem()) { - CreateItemIfInputMatches(gSave.stats.itemButtons[SLOT_A], PLAYER_INPUT_1, FALSE); - CreateItemIfInputMatches(gSave.stats.itemButtons[SLOT_B], PLAYER_INPUT_2, FALSE); + CreateItemIfInputMatches(gSave.stats.equipped[SLOT_A], INPUT_USE_ITEM1, FALSE); + CreateItemIfInputMatches(gSave.stats.equipped[SLOT_B], INPUT_USE_ITEM2, FALSE); IsTryingToPickupObject(); } @@ -189,9 +189,9 @@ void UpdateActiveItems(PlayerEntity* this) { void CreateItemEquippedAtSlot(EquipSlot equipSlot) { if (equipSlot == EQUIP_SLOT_A) { - CreateItemIfInputMatches(gSave.stats.itemButtons[SLOT_A], PLAYER_INPUT_1, TRUE); + CreateItemIfInputMatches(gSave.stats.equipped[SLOT_A], INPUT_USE_ITEM1, TRUE); } else { - CreateItemIfInputMatches(gSave.stats.itemButtons[SLOT_B], PLAYER_INPUT_2, TRUE); + CreateItemIfInputMatches(gSave.stats.equipped[SLOT_B], INPUT_USE_ITEM2, TRUE); } } @@ -210,7 +210,7 @@ bool32 IsAbleToUseItem(PlayerEntity* this) { } bool32 IsPreventedFromUsingItem(void) { - if ((gPlayerState.playerInput.newInput & PLAYER_INPUT_80) != 0) { + if ((gPlayerState.playerInput.newInput & INPUT_ACTION) != 0) { if ((gPlayerState.flags & PL_CLONING) != 0) { gPlayerState.chargeState.action = 1; DeleteClones(); @@ -233,7 +233,7 @@ bool32 IsPreventedFromUsingItem(void) { default: if ((((gUnk_0200AF00.rActionInteractObject == R_ACTION_ROLL) && (gPlayerState.field_0x1c == 0)) && (gPlayerState.floor_type != SURFACE_SWAMP)) && - ((((gPlayerState.playerInput.heldInput & PLAYER_INPUT_ANY_DIRECTION) != 0 && + ((((gPlayerState.playerInput.heldInput & INPUT_ANY_DIRECTION) != 0 && ((gPlayerState.flags & (PL_BURNING | PL_ROLLING)) == 0)) && ((gPlayerState.jump_status == 0 && (gPlayerState.attack_status == 0)))))) { gPlayerState.queued_action = PLAYER_ROLL; @@ -274,9 +274,9 @@ bool32 IsTryingToPickupObject(void) { if (!((((gPlayerState.flags & (PL_USE_PORTAL | PL_MINISH | PL_ROLLING)) == 0) && (((gNewPlayerEntity.unk_79 != 0 || (gPlayerState.heldObject != 0)) || - ((gPlayerState.playerInput.newInput & PLAYER_INPUT_8000) != 0)))) && + ((gPlayerState.playerInput.newInput & INPUT_LIFT_THROW) != 0)))) && (((sub_080789A8() != 0 || ((gPlayerState.playerInput.heldInput & - (PLAYER_INPUT_ANY_DIRECTION | PLAYER_INPUT_1 | PLAYER_INPUT_2)) == 0)))))) { + (INPUT_ANY_DIRECTION | INPUT_USE_ITEM1 | INPUT_USE_ITEM2)) == 0)))))) { return FALSE; } item = CreateItem(ITEM_TRY_PICKUP_OBJECT); @@ -631,10 +631,10 @@ bool32 IsItemActiveByInput(ItemBehavior* this, PlayerInputState input) { u32 val; Stats* stats = &gSave.stats; u32 id = this->behaviorId; - if (stats->itemButtons[SLOT_A] == id) { - val = PLAYER_INPUT_1; - } else if (stats->itemButtons[SLOT_B] == id) { - val = PLAYER_INPUT_2; + if (stats->equipped[SLOT_A] == id) { + val = INPUT_USE_ITEM1; + } else if (stats->equipped[SLOT_B] == id) { + val = INPUT_USE_ITEM2; } else { val = 0; } @@ -901,10 +901,10 @@ bool32 sub_08077FEC(u32 action) { bool32 sub_08078008(ChargeState* state) { Item swordType; - if (ItemIsSword(gSave.stats.itemButtons[SLOT_A]) != ITEM_NONE) { - swordType = gSave.stats.itemButtons[SLOT_A]; - } else if (ItemIsSword(gSave.stats.itemButtons[SLOT_B]) != ITEM_NONE) { - swordType = gSave.stats.itemButtons[SLOT_B]; + if (ItemIsSword(gSave.stats.equipped[SLOT_A]) != ITEM_NONE) { + swordType = gSave.stats.equipped[SLOT_A]; + } else if (ItemIsSword(gSave.stats.equipped[SLOT_B]) != ITEM_NONE) { + swordType = gSave.stats.equipped[SLOT_B]; } else { swordType = ITEM_NONE; } @@ -1110,7 +1110,7 @@ bool32 sub_080782C0(void) { return FALSE; } } - if (((gPlayerState.playerInput.newInput & PLAYER_INPUT_1000) != 0) && + if (((gPlayerState.playerInput.newInput & INPUT_FUSE) != 0) && ((u8)(gPossibleInteraction.currentObject->kinstoneId - 1) < 100)) { AddKinstoneToBag(KINSTONE_NONE); if (gSave.kinstones.amounts[0] != 0) { @@ -1123,7 +1123,7 @@ bool32 sub_080782C0(void) { ForceSetPlayerState(PL_STATE_TALKEZLO); return TRUE; } - if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { + if ((gPlayerState.playerInput.newInput & (INPUT_ACTION | INPUT_INTERACT)) == 0) { return FALSE; } switch (gPossibleInteraction.currentObject->type) { @@ -1973,7 +1973,7 @@ void sub_08079520(Entity* this) { } u32 sub_0807953C(void) { - u32 tmp = PLAYER_INPUT_ANY_DIRECTION | PLAYER_INPUT_20 | PLAYER_INPUT_10 | PLAYER_INPUT_8; + u32 tmp = INPUT_ANY_DIRECTION | INPUT_CONTEXT | INPUT_CANCEL | INPUT_INTERACT; return gPlayerState.playerInput.newInput & tmp; } @@ -2549,10 +2549,10 @@ void DeleteClones(void) { } bool32 HasSwordEquipped(void) { - if (ItemIsSword((u32)gSave.stats.itemButtons[SLOT_A]) != 0) { + if (ItemIsSword((u32)gSave.stats.equipped[SLOT_A]) != 0) { return TRUE; } else { - return ItemIsSword((u32)gSave.stats.itemButtons[SLOT_B]); + return ItemIsSword((u32)gSave.stats.equipped[SLOT_B]); } } @@ -3009,7 +3009,7 @@ void PlayerSwimming(Entity* this) { } bool32 ToggleDiving(Entity* this) { - if (gPlayerState.playerInput.newInput & PLAYER_INPUT_10) { + if (gPlayerState.playerInput.newInput & INPUT_CANCEL) { gPlayerState.swim_state ^= 0x80; if (gPlayerState.swim_state & 0x80) { gPlayerState.remainingDiveTime = 0x78; @@ -3026,7 +3026,7 @@ bool32 ToggleDiving(Entity* this) { void PlayerUpdateSwimming(Entity* this) { if ((((this->action != 0x17) || (gPlayerState.field_0xa == 0)) && (gRoomControls.reload_flags == 0)) && - ((gPlayerState.playerInput.newInput & PLAYER_INPUT_8) != 0)) { + ((gPlayerState.playerInput.newInput & INPUT_INTERACT) != 0)) { if (GetInventoryValue(ITEM_SWIM_BUTTERFLY) == 1) { this->speed = 0x1c0; } else { diff --git a/src/title.c b/src/title.c index 353604e3..238e11d1 100644 --- a/src/title.c +++ b/src/title.c @@ -89,7 +89,7 @@ static const SaveFile gDemoSave = { .stats = { .health = 40, .maxHealth = 40, - .itemButtons = { ITEM_SHIELD, ITEM_SMITH_SWORD }, + .equipped = { ITEM_SHIELD, ITEM_SMITH_SWORD }, .rupees = 5, }, .inventory = { diff --git a/src/ui.c b/src/ui.c index dcc5b573..1bff0dae 100644 --- a/src/ui.c +++ b/src/ui.c @@ -663,7 +663,7 @@ void ButtonUIElement_Action1(UIElement* element) { u32 sub_0801CC80(UIElement* element) { u8 type = element->type; u32 buttonId = (type ^ 3) != 0; - u32 itemId = gSave.stats.itemButtons[buttonId]; + u32 itemId = gSave.stats.equipped[buttonId]; if (ItemIsBottle(itemId)) { itemId = gSave.stats.bottles[itemId - ITEM_BOTTLE1]; } From a030120a0c3b65cd1a35ec83644edca6985e5346 Mon Sep 17 00:00:00 2001 From: theo3 Date: Thu, 28 Dec 2023 19:05:06 -0800 Subject: [PATCH 04/15] clean up linkAnimation.c --- include/entity.h | 2 +- include/functions.h | 2 +- include/object/linkAnimation.h | 23 +++++ include/player.h | 2 +- src/enemy/businessScrub.c | 2 +- src/enemy/businessScrubPrologue.c | 4 +- src/enemy/likeLike.c | 2 +- src/enemyUtils.c | 4 +- src/entity.c | 8 +- src/itemUtils.c | 2 +- src/manager/cloudOverlayManager.c | 2 +- src/manager/delayedEntityLoadManager.c | 2 +- src/manager/enterRoomTextboxManager.c | 2 +- src/manager/ezloHintManager.c | 2 +- src/manager/fightManager.c | 4 +- src/manager/holeManager.c | 2 +- src/manager/hyruleTownTilesetManager.c | 2 +- src/manager/lightManager.c | 2 +- src/manager/minishVillageTilesetManager.c | 2 +- src/manager/miscManager.c | 4 +- src/manager/powBackgroundManager.c | 2 +- src/manager/repeatedSoundManager.c | 2 +- src/manager/secretManager.c | 4 +- src/manager/staticBackgroundManager.c | 2 +- src/manager/templeOfDropletsManager.c | 4 +- src/manager/vaati3BackgroundManager.c | 2 +- src/npc/bigGoron.c | 14 +-- src/npc/carpenter.c | 4 +- src/npc/cat.c | 4 +- src/npc/cucco.c | 2 +- src/npc/cuccoChick.c | 2 +- src/npc/dampe.c | 2 +- src/npc/dog.c | 4 +- src/npc/drLeft.c | 2 +- src/npc/emma.c | 2 +- src/npc/epona.c | 2 +- src/npc/ezlo.c | 2 +- src/npc/farmers.c | 2 +- src/npc/festari.c | 4 +- src/npc/forestMinish.c | 4 +- src/npc/gentari.c | 4 +- src/npc/ghostBrothers.c | 2 +- src/npc/gregal.c | 10 +- src/npc/hurdyGurdyMan.c | 4 +- src/npc/kingGustaf.c | 2 +- src/npc/librari.c | 2 +- src/npc/mama.c | 2 +- src/npc/marcy.c | 2 +- src/npc/mayorHagen.c | 2 +- src/npc/melari.c | 2 +- src/npc/minishEzlo.c | 2 +- src/npc/mountainMinish.c | 2 +- src/npc/mutoh.c | 2 +- src/npc/pita.c | 2 +- src/npc/postman.c | 2 +- src/npc/rem.c | 6 +- src/npc/stockwell.c | 2 +- src/npc/syrup.c | 2 +- src/npc/teachers.c | 2 +- src/npc/vaati.c | 2 +- src/npc/wheaton.c | 2 +- src/npc/zelda.c | 2 +- src/npc/zeldaFollower.c | 2 +- src/object/beanstalk.c | 2 +- src/object/bigBarrel.c | 4 +- src/object/bigVortex.c | 2 +- src/object/bird.c | 8 +- src/object/cameraTarget.c | 2 +- src/object/crenelBeanSprout.c | 2 +- src/object/cutsceneMiscObject.c | 22 ++-- src/object/deathFx.c | 2 +- src/object/fairy.c | 2 +- src/object/figurineDevice.c | 4 +- src/object/fourElements.c | 2 +- src/object/frozenOctorok.c | 2 +- src/object/greatFairy.c | 4 +- src/object/guruguruBar.c | 2 +- src/object/houseDoorExterior.c | 2 +- src/object/itemForSale.c | 2 +- src/object/itemOnGround.c | 4 +- src/object/linkAnimation.c | 118 +++++++++++----------- src/object/linkHoldingItem.c | 2 +- src/object/minishVillageObject.c | 2 +- src/object/moleMittsParticle.c | 2 +- src/object/object30.c | 2 +- src/object/objectA2.c | 2 +- src/object/objectA8.c | 2 +- src/object/parallaxRoomView.c | 2 +- src/object/shrinkingHieroglyphs.c | 2 +- src/object/specialFx.c | 2 +- src/object/windTribeTeleporter.c | 2 +- src/objectUtils.c | 34 ++++--- src/player.c | 6 +- src/playerUtils.c | 6 +- src/script.c | 6 +- 95 files changed, 245 insertions(+), 216 deletions(-) create mode 100644 include/object/linkAnimation.h diff --git a/include/entity.h b/include/entity.h index 78dcde47..cbb54201 100644 --- a/include/entity.h +++ b/include/entity.h @@ -386,7 +386,7 @@ Entity* FindEntity(u32 kind, u32 id, u32 listIndex, u32 type, u32 type2); * @param entity Entity to set the priority of. * @param prio #Priority level. */ -void SetDefaultPriority(Entity* entity, u32 prio); +void SetEntityPriority(Entity* entity, u32 prio); /** * Check if entity will be deleted next frame. diff --git a/include/functions.h b/include/functions.h index a770563b..49fb3f31 100644 --- a/include/functions.h +++ b/include/functions.h @@ -83,7 +83,7 @@ extern void sub_08030118(u32); extern void sub_0803C0AC(Entity*); extern void sub_08049CF4(Entity*); extern u32 sub_0804A024(Entity*, u32, u32); -extern u32 sub_080542AC(u32); +extern u32 IsMinishItem(u32); extern void DisableRandomDrops(); extern void EnableRandomDrops(void); extern s32 sub_08056338(void); diff --git a/include/object/linkAnimation.h b/include/object/linkAnimation.h new file mode 100644 index 00000000..9fb2fad4 --- /dev/null +++ b/include/object/linkAnimation.h @@ -0,0 +1,23 @@ +#ifndef LINKANIMATION_H +#define LINKANIMATION_H + +#ifndef NENT_DEPRECATED +#error "linkAnimtion.h requires new entities" +#endif +#include "entity.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 storeDrawFlags; + /*0x69*/ u8 storeFlags; + /*0x6a*/ u8 storeIFrames; + /*0x6b*/ u8 storeField7; + /*0x6c*/ u8 storeKeepFacing; + /*0x6d*/ u8 storeFieldA; + /*0x6e*/ u8 storeField27; + /*0x6f*/ u8 storeMobility; + /*0x70*/ u32 storeStateFlags; + /*0x74*/ u8 store8A; +} LinkAnimationEntity; + +#endif // LINKANIMATION_H diff --git a/include/player.h b/include/player.h index 19be9997..db8c1f08 100644 --- a/include/player.h +++ b/include/player.h @@ -263,7 +263,7 @@ typedef enum { typedef struct { /*0x0*/ u16 heldInput; /**< Input currently held @see PlayerInputState */ /*0x2*/ u16 newInput; /**< New input this frame @see PlayerInputState */ - /*0x4*/ u32 field_0x94; + /*0x4*/ u32 unused; /*0x8*/ u16 playerMacroWaiting; /*0xa*/ u16 playerMacroHeldKeys; /*0xc*/ PlayerMacroEntry* playerMacro; diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index cd52da10..873ff039 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -211,7 +211,7 @@ void BusinessScrub_Action3(Entity* this) { if (iVar1 != NULL) { iVar1->spritePriority.b0 = 3; iVar1->z.HALF.HI -= 12; - SetDefaultPriority(iVar1, PRIO_MESSAGE); + SetEntityPriority(iVar1, PRIO_MESSAGE); } SetFlag(this->field_0x86.HWORD); sub_0802925C(this); diff --git a/src/enemy/businessScrubPrologue.c b/src/enemy/businessScrubPrologue.c index 657d9d0b..28995f4d 100644 --- a/src/enemy/businessScrubPrologue.c +++ b/src/enemy/businessScrubPrologue.c @@ -54,7 +54,7 @@ void BusinessScrubPrologue_OnCollision(BusinessScrubPrologueEntity* this) { gPlayerState.field_0x27[0] = 0xff; EnqueueSFX(SFX_EM_DEKUSCRUB_HIT); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); } } } @@ -189,7 +189,7 @@ void sub_08045E14(BusinessScrubPrologueEntity* this) { if (ent != NULL) { ent->spritePriority.b0 = 3; ent->z.HALF.HI -= 0xc; - SetDefaultPriority(ent, PRIO_MESSAGE); + SetEntityPriority(ent, PRIO_MESSAGE); } } break; diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index 782a51b2..2c7fa88f 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -73,7 +73,7 @@ void LikeLike_OnCollision(LikeLikeEntity* this) { void LikeLike_OnDeath(LikeLikeEntity* this) { if (super->timer == 2 && this->stolenItem != 0xff) { - SetDefaultPriority(super, PRIO_NO_BLOCK); + SetEntityPriority(super, PRIO_NO_BLOCK); LikeLike_ReturnStolenItem(this->stolenItem); } GenericDeath(super); diff --git a/src/enemyUtils.c b/src/enemyUtils.c index 05d59a98..e030edb1 100644 --- a/src/enemyUtils.c +++ b/src/enemyUtils.c @@ -195,7 +195,7 @@ void CreateDeathFx(GenericEntity* parent, u32 parentId, u32 fixedItem) { gSave.enemies_killed++; parent->base.gustJarState |= 2; parent->base.timer = 255; - SetDefaultPriority(&(parent->base), 3); + SetEntityPriority(&(parent->base), 3); deathFx2 = (DeathFxObject*)CreateObject(DEATH_FX, parent->base.id, 0); if (deathFx2 != NULL) { deathFx2->unk6c = tmp; @@ -232,7 +232,7 @@ void CreateDeathFx(GenericEntity* parent, u32 parentId, u32 fixedItem) { } else { if (--parent->base.timer == 0) { parent->base.spriteSettings.draw = 0; - SetDefaultPriority(&(parent->base), 0); + SetEntityPriority(&(parent->base), 0); } else { if (parent->base.timer < 9) { if (parent->base.spriteSettings.draw) { diff --git a/src/entity.c b/src/entity.c index 2ac2b37f..1a9ac121 100644 --- a/src/entity.c +++ b/src/entity.c @@ -74,17 +74,17 @@ const u8 gUnk_081091F8[] = { 0, 3, 0, 3, 3, 0, 3, 3, 3, 3, }; -void SetDefaultPriorityForKind(Entity* e) { +void SetEntityPriorityForKind(Entity* e) { u8 r3 = gRoomTransition.entity_update_type; const u8* array = gUnk_081091F8; if (r3 != 2) { array = gUnk_081091EE; } - SetDefaultPriority(e, array[e->kind]); + SetEntityPriority(e, array[e->kind]); } -void SetDefaultPriority(Entity* ent, u32 prio) { +void SetEntityPriority(Entity* ent, u32 prio) { ent->updatePriorityPrev = prio; ent->updatePriority = prio; } @@ -508,7 +508,7 @@ void AppendEntityToList(Entity* entity, u32 listIndex) { } else { gManagerCount++; } - SetDefaultPriorityForKind(entity); + SetEntityPriorityForKind(entity); } void PrependEntityToList(Entity* entity, u32 listIndex) { diff --git a/src/itemUtils.c b/src/itemUtils.c index c78c0da3..00cfd5e9 100644 --- a/src/itemUtils.c +++ b/src/itemUtils.c @@ -200,7 +200,7 @@ u32 getItemMetaDataGetTextIndex(s32 itemIndex) { return ptr[2]; } -u32 sub_080542AC(u32 param_1) { +u32 IsMinishItem(u32 param_1) { const ItemMetaData* ptr1 = gItemMetaData; u8* ptr = (u8*)&((ptr1)[param_1]); return ptr[3] & 1; diff --git a/src/manager/cloudOverlayManager.c b/src/manager/cloudOverlayManager.c index 3cc20ca9..b9563b46 100644 --- a/src/manager/cloudOverlayManager.c +++ b/src/manager/cloudOverlayManager.c @@ -27,7 +27,7 @@ void CloudOverlayManager_Main(CloudOverlayManager* this) { super->timer = 0; super->subtimer = 8; this->field_0x20 = gUnk_0810865C[0]; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (gArea.onEnter == NULL) { RegisterTransitionManager(this, sub_0805AEDC, sub_0805AF3C); } else { diff --git a/src/manager/delayedEntityLoadManager.c b/src/manager/delayedEntityLoadManager.c index de9a8390..0a13bf40 100644 --- a/src/manager/delayedEntityLoadManager.c +++ b/src/manager/delayedEntityLoadManager.c @@ -37,7 +37,7 @@ void DelayedEntityLoadManager_Main(DelayedEntityLoadManager* this) { if (super->action == 0) { super->action++; this->unk_20 = gArea.filler[1]; - SetDefaultPriority((Entity*)this, 6); + SetEntityPriority((Entity*)this, 6); npcPtr = gNPCData; npcPtr += (super->type2 + this->unk_20); index1 = 0; diff --git a/src/manager/enterRoomTextboxManager.c b/src/manager/enterRoomTextboxManager.c index 959e90f9..a720a788 100644 --- a/src/manager/enterRoomTextboxManager.c +++ b/src/manager/enterRoomTextboxManager.c @@ -45,7 +45,7 @@ void sub_0805E140(EnterRoomTextboxManager* this) { this->unk_20 = gRoomControls.room; super->timer = 120; super->subtimer = 60; - SetDefaultPriority((Entity*)this, PRIO_HIGHEST); + SetEntityPriority((Entity*)this, PRIO_HIGHEST); sub_0805E1F8(gUnk_08108DE8[gArea.locationIndex], AreaIsDungeon()); } diff --git a/src/manager/ezloHintManager.c b/src/manager/ezloHintManager.c index afe8394a..f98b97f3 100644 --- a/src/manager/ezloHintManager.c +++ b/src/manager/ezloHintManager.c @@ -35,7 +35,7 @@ static void EzloHintManager_Init(EzloHintManager* this) { this->ry = this->ry_raw << 3; this->x = this->rx + (this->x_raw << 4); this->y = this->ry + (this->y_raw << 4); - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (this->flag2 == 0) { super->action = 2; } else { diff --git a/src/manager/fightManager.c b/src/manager/fightManager.c index 1f54b143..3f34f5c4 100644 --- a/src/manager/fightManager.c +++ b/src/manager/fightManager.c @@ -55,7 +55,7 @@ void FightManager_Init(FightManager* this) { if (!this->fightStartFlag) { FightManager_LoadFight(this); } - SetDefaultPriority((Entity*)this, PRIO_NO_BLOCK); + SetEntityPriority((Entity*)this, PRIO_NO_BLOCK); } else { DeleteThisEntity(); } @@ -157,7 +157,7 @@ void FightManagerHelper_Main(FightManagerHelper* this) { if (super->action == 0) { super->action = 1; - SetDefaultPriority((Entity*)this, PRIO_NO_BLOCK); + SetEntityPriority((Entity*)this, PRIO_NO_BLOCK); } // go through and check all monitored enemies. anyRemaining = FALSE; diff --git a/src/manager/holeManager.c b/src/manager/holeManager.c index 3b1d17cf..c220332b 100644 --- a/src/manager/holeManager.c +++ b/src/manager/holeManager.c @@ -57,7 +57,7 @@ void sub_0805B328(HoleManager*); void sub_0805B048(HoleManager* this) { struct_08108764* tmp; Entity* obj; - SetDefaultPriority((Entity*)super, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)super, PRIO_PLAYER_EVENT); MemClear(&this->unk_20, 0x20); super->action = 1; this->unk_3f = gRoomControls.room; diff --git a/src/manager/hyruleTownTilesetManager.c b/src/manager/hyruleTownTilesetManager.c index 308204f0..9797a0c2 100644 --- a/src/manager/hyruleTownTilesetManager.c +++ b/src/manager/hyruleTownTilesetManager.c @@ -66,7 +66,7 @@ void HyruleTownTilesetManager_Main(HyruleTownTilesetManager* this) { this->field_0x21 = 0xff; this->field_0x20 = 0xff; RegisterTransitionManager(this, sub_08059A2C, NULL); - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); } sub_08059A58(this); } diff --git a/src/manager/lightManager.c b/src/manager/lightManager.c index edad0b7d..c8d8241d 100644 --- a/src/manager/lightManager.c +++ b/src/manager/lightManager.c @@ -37,7 +37,7 @@ void LightManager_Main(LightManager* this) { super->flags |= ENT_PERSIST; super->timer = 17; this->unk20 = 0; - SetDefaultPriority((Entity*)this, 6); + SetEntityPriority((Entity*)this, 6); sub_0801E120(); sub_0801E154(super->timer); } diff --git a/src/manager/minishVillageTilesetManager.c b/src/manager/minishVillageTilesetManager.c index f82b9153..225ba477 100644 --- a/src/manager/minishVillageTilesetManager.c +++ b/src/manager/minishVillageTilesetManager.c @@ -111,7 +111,7 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) { super->timer = 8; this->unk_20 = 0xFF; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); RegisterTransitionManager(this, sub_08057E30, 0); } if (sub_08057E40(this)) { diff --git a/src/manager/miscManager.c b/src/manager/miscManager.c index 80d4cffc..2fe982bb 100644 --- a/src/manager/miscManager.c +++ b/src/manager/miscManager.c @@ -212,7 +212,7 @@ void MiscManager_Type3(MiscManager* this) { void MiscManager_Type4(MiscManager* this) { if (super->action == 0) { super->action = 1; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); } if (CheckLocalFlag(0x6c)) { if (CheckLocalFlag(0x4b)) { @@ -430,7 +430,7 @@ void MiscManager_TypeE(MiscManager* this) { #if defined(USA) || defined(DEMO_USA) || defined(DEMO_JP) void MiscManager_TypeF(MiscManager* this) { - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (gPlayerEntity.action == PLAYER_TALKEZLO) { DeleteThisEntity(); } diff --git a/src/manager/powBackgroundManager.c b/src/manager/powBackgroundManager.c index 1aa2a0e1..d7a24f25 100644 --- a/src/manager/powBackgroundManager.c +++ b/src/manager/powBackgroundManager.c @@ -20,7 +20,7 @@ void PowBackgroundManager_Main(PowBackgroundManager* this) { if (super->action == 0) { super->action = 1; super->flags |= ENT_PERSIST; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (gArea.onEnter == NULL) { RegisterTransitionManager(this, sub_0805AFFC, NULL); } else { diff --git a/src/manager/repeatedSoundManager.c b/src/manager/repeatedSoundManager.c index d55677d6..ff2c534b 100644 --- a/src/manager/repeatedSoundManager.c +++ b/src/manager/repeatedSoundManager.c @@ -37,7 +37,7 @@ void CreateRepeatedSoundManager(Entity* entity, ScriptExecutionContext* context) manager->id = REPEATED_SOUND_MANAGER; manager->type = context->intVariable; AppendEntityToList((Entity*)manager, 6); - SetDefaultPriority((Entity*)manager, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)manager, PRIO_PLAYER_EVENT); } } diff --git a/src/manager/secretManager.c b/src/manager/secretManager.c index 4a9ba020..ca2ec125 100644 --- a/src/manager/secretManager.c +++ b/src/manager/secretManager.c @@ -51,7 +51,7 @@ void SecretManager_Type0_Init(SecretManager* this) { if (super->timer == 0) { super->timer = 30; } - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); } void SecretManager_Type0_Action1(SecretManager* this) { @@ -94,7 +94,7 @@ void SecretManager_Type1_Init(SecretManager* this) { super->timer = 30; } super->subtimer = super->timer; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); } void SecretManager_Type1_Action1(SecretManager* this) { diff --git a/src/manager/staticBackgroundManager.c b/src/manager/staticBackgroundManager.c index a8bd1810..2163b280 100644 --- a/src/manager/staticBackgroundManager.c +++ b/src/manager/staticBackgroundManager.c @@ -35,7 +35,7 @@ void StaticBackgroundManager_Main(StaticBackgroundManager* this) { if (super->action == 0) { super->action = 1; super->flags |= ENT_PERSIST; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (super->type != 0) { RegisterTransitionManager(this, sub_0805B4B4, NULL); } diff --git a/src/manager/templeOfDropletsManager.c b/src/manager/templeOfDropletsManager.c index b1b97aba..7472dcbd 100644 --- a/src/manager/templeOfDropletsManager.c +++ b/src/manager/templeOfDropletsManager.c @@ -370,7 +370,7 @@ void TempleOfDropletsManager_Type7(TempleOfDropletsManager* this) { } super->subAction = 1; super->flags |= ENT_PERSIST; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); break; case 1: if (CheckLocalFlag(this->unk_3e)) @@ -402,7 +402,7 @@ void TempleOfDropletsManager_Type7(TempleOfDropletsManager* this) { void sub_0805AAC8(TempleOfDropletsManager*); void sub_0805A89C(TempleOfDropletsManager* this) { - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); super->action = 1; super->flags |= ENT_PERSIST; super->timer = 8; diff --git a/src/manager/vaati3BackgroundManager.c b/src/manager/vaati3BackgroundManager.c index 5b3bcc18..bc8847cf 100644 --- a/src/manager/vaati3BackgroundManager.c +++ b/src/manager/vaati3BackgroundManager.c @@ -22,7 +22,7 @@ void Vaati3BackgroundManager_Main(Vaati3BackgroundManager* this) { if (super->action == 0) { super->action = 1; super->flags |= ENT_PERSIST; - SetDefaultPriority((Entity*)this, PRIO_PLAYER_EVENT); + SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); if (gArea.onEnter == NULL) { RegisterTransitionManager(this, sub_0805D470, NULL); } else { diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index 059f6163..0767433b 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -81,7 +81,7 @@ void sub_0806CF30(BigGoronEntity* this) { super->action = 1; super->subAction = 1; this->originalX = super->x.HALF.HI; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); sub_0806D0B0(super); sub_0807DD64(super); } else { @@ -215,7 +215,7 @@ void sub_0806D1D0(BigGoronEntity* this) { super->spriteSettings.draw = 3; super->frameIndex = 0; super->timer = 30; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); } switch (super->subAction) { @@ -256,7 +256,7 @@ void sub_0806D274(BigGoronEntity* this) { super->spritePriority.b0 = 7; super->frameIndex = 2; super->timer = 8; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); npc = CreateNPC(BIG_GORON, 3, 0); if (npc != NULL) { npc->child = super; @@ -303,7 +303,7 @@ void sub_0806D348(BigGoronEntity* this) { super->spritePriority.b0 = 6; super->spriteSettings.draw = 0; super->frameIndex = 5; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); } if (super->child->frameIndex == 4) { super->spriteSettings.draw = 3; @@ -321,7 +321,7 @@ void sub_0806D3C0(BigGoronEntity* this) { } super->action = 1; super->hitbox = (Hitbox*)&gHitbox_3; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); sub_0807DD64(super); } else { super->x.HALF.HI = super->parent->x.HALF.HI; @@ -344,7 +344,7 @@ void sub_0806D41C(BigGoronEntity* this) { sub_0806D4C0(this, 1); sub_0806D4C0(this, 2); sub_0806D4C0(this, 3); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); } else { ExecuteScriptForEntity(super, NULL); HandleEntity0x82Actions(super); @@ -368,7 +368,7 @@ void sub_0806D4C0(BigGoronEntity* this, u32 type) { npc->parent = super; CopyPosition(super, npc); SortEntityAbove(super, npc); - SetDefaultPriority(npc, PRIO_MESSAGE); + SetEntityPriority(npc, PRIO_MESSAGE); } } diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index 2157168f..3c4dda2a 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -35,7 +35,7 @@ void Carpenter(CarpenterEntity* this) { break; super->action = 1; this->animIndex = 0; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); sub_0807DD64(super); case 1: @@ -115,7 +115,7 @@ void Carpenter_Fusion(Entity* this) { if (LoadExtraSpriteData(this, &gUnk_08110CA8[this->type * 4])) { this->action++; this->spriteSettings.draw = 1; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitializeAnimation(this, (u32)this->type * 8 + 2); } } else { diff --git a/src/npc/cat.c b/src/npc/cat.c index aa2d221e..d2f42aec 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -221,7 +221,7 @@ void sub_0806799C(CatEntity* this) { UpdateAnimationSingleFrame(super); if ((gMessage.doTextBox & 0x7f) == 0) { sub_08067B08(this); - SetDefaultPriority(super, PRIO_PLAYER); + SetEntityPriority(super, PRIO_PLAYER); } } @@ -409,7 +409,7 @@ void sub_08067C44(CatEntity* this) { } else { super->action = 4; sub_08067790(super); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); } super->interactType = INTERACTION_NONE; SoundReq(SFX_VO_CAT); diff --git a/src/npc/cucco.c b/src/npc/cucco.c index f936bc1e..33a7d46a 100644 --- a/src/npc/cucco.c +++ b/src/npc/cucco.c @@ -30,7 +30,7 @@ void Cucco_Init(CuccoEntity* this) { super->action++; this->fusionOffer = GetFusionToOffer(super); AddInteractableAsMinishFuser(super, this->fusionOffer); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); super->subAction = 0; sub_0806E4EC(this); } diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c index fa4da6a6..07b03baf 100644 --- a/src/npc/cuccoChick.c +++ b/src/npc/cuccoChick.c @@ -37,7 +37,7 @@ void CuccoChick_Init(CuccoChickEntity* this) { super->action++; this->fusionOffer = GetFusionToOffer(super); AddInteractableAsMinishFuser(super, this->fusionOffer); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); super->subAction = 0; sub_0806E764(this); } diff --git a/src/npc/dampe.c b/src/npc/dampe.c index 4fd41240..88cc9e0a 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -23,7 +23,7 @@ void Dampe(Entity* this) { case 0: this->action = 1; this->spriteSettings.draw = 1; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitScriptForNPC(this); return; case 1: diff --git a/src/npc/dog.c b/src/npc/dog.c index 1969c89a..82708d84 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -226,7 +226,7 @@ void sub_08069B44(DogEntity* this) { super->animationState = 2; this->unk_6a = 0xff; this->unk_74 = GetFusionToOffer(super); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitAnimationForceUpdate(super, 10); if ((super->flags & ENT_SCRIPTED) != 0) { InitScriptForNPC(super); @@ -525,7 +525,7 @@ void Dog_Fusion(DogEntity* this) { if (sub_08069EF0(this)) { super->action++; super->spriteSettings.draw = 1; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitializeAnimation(super, 0x23); } } else { diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c index f6519407..32b2f062 100644 --- a/src/npc/drLeft.c +++ b/src/npc/drLeft.c @@ -15,7 +15,7 @@ void DrLeft(Entity* this) { if (this->type == 0) { if (this->action == 0) { this->action++; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitScriptForNPC(this); } ExecuteScriptForEntity(this, NULL); diff --git a/src/npc/emma.c b/src/npc/emma.c index 098d61b7..9cd04780 100644 --- a/src/npc/emma.c +++ b/src/npc/emma.c @@ -13,7 +13,7 @@ void Emma(Entity* this) { if (this->action == 0) { this->action++; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitScriptForNPC(this); } else { ExecuteScriptAndHandleAnimation(this, NULL); diff --git a/src/npc/epona.c b/src/npc/epona.c index b467d900..91bfc6de 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -101,7 +101,7 @@ void sub_08065AA4(EponaEntity* this) { InitializeNPCFusion(super); } else { super->action = 3; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); sub_08065A50(this); } InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); diff --git a/src/npc/ezlo.c b/src/npc/ezlo.c index 45368147..c490a29e 100644 --- a/src/npc/ezlo.c +++ b/src/npc/ezlo.c @@ -14,7 +14,7 @@ const u8 gUnk_08114144[]; void Ezlo(Entity* this) { if (this->action == 0) { this->action++; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitScriptForNPC(this); } ExecuteScriptForEntity(this, NULL); diff --git a/src/npc/farmers.c b/src/npc/farmers.c index 7b9e1036..a1f69c55 100644 --- a/src/npc/farmers.c +++ b/src/npc/farmers.c @@ -38,7 +38,7 @@ void Farmers(Entity* this) { } void sub_0806BC58(Entity* this) { - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); } void Farmers_Head(Entity* this) { diff --git a/src/npc/festari.c b/src/npc/festari.c index 9d42eb8c..d32badf2 100644 --- a/src/npc/festari.c +++ b/src/npc/festari.c @@ -35,7 +35,7 @@ void Festari(FestariEntity* this) { void sub_0805FE10(FestariEntity* this) { super->action = 1; super->spriteSettings.draw = TRUE; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); this->fusionOffer = GetFusionToOffer(super); AddInteractableWhenBigFuser(super, this->fusionOffer); InitScriptForNPC(super); @@ -127,7 +127,7 @@ void Festari_Fusion(FestariEntity* this) { if (super->action == 0) { super->action++; super->spriteSettings.draw = 1; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitAnimationForceUpdate(super, 8); } else { UpdateAnimationSingleFrame(super); diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index 7943e305..8d5cf8dc 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -526,7 +526,7 @@ void ForestMinish(ForestMinishEntity* this) { super->spriteSettings.draw = TRUE; this->animIndex = super->animationState = super->timer << 1; super->timer = 0; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); StartCutscene(super, (u16*)gUnk_08109D18[super->type2]); InitScriptForNPC(super); } @@ -755,7 +755,7 @@ void ForestMinish_Fusion(Entity* this) { if (LoadExtraSpriteData(this, gUnk_0810A348)) { this->action++; this->spriteSettings.draw = TRUE; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitializeAnimation(this, 6); } } else { diff --git a/src/npc/gentari.c b/src/npc/gentari.c index e8621c42..a2e02a34 100644 --- a/src/npc/gentari.c +++ b/src/npc/gentari.c @@ -18,7 +18,7 @@ void Gentari(GentariEntity* this) { case 0: super->action = 1; super->spriteSettings.draw = TRUE; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); this->fusionOffer = GetFusionToOffer(super); AddInteractableWhenBigFuser(super, this->fusionOffer); InitScriptForNPC(super); @@ -45,7 +45,7 @@ void Gentari_Fusion(Entity* this) { if (this->action == 0) { this->action++; this->spriteSettings.draw = TRUE; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitAnimationForceUpdate(this, 10); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c index 56597734..9458205b 100644 --- a/src/npc/ghostBrothers.c +++ b/src/npc/ghostBrothers.c @@ -136,7 +136,7 @@ void sub_08065D18(GhostBrothersEntity* this) { super->spriteSettings.draw = 1; super->spriteRendering.alphaBlend = 1; this->unk_6c = gUnk_08110188; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitAnimationForceUpdate(super, 2); gScreen.controls.layerFXControl = 0x3f40; gScreen.controls.alphaBlend = 0x1000; diff --git a/src/npc/gregal.c b/src/npc/gregal.c index 66d89c93..781cfec0 100644 --- a/src/npc/gregal.c +++ b/src/npc/gregal.c @@ -41,7 +41,7 @@ void sub_0806CAF4(GregalEntity* this) { if (super->action == 0) { super->action++; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); npc = CreateNPC(GREGAL, 1, 0); if (npc != NULL) { npc->parent = super; @@ -68,7 +68,7 @@ void sub_0806CB80(GregalEntity* this) { super->action++; super->animationState = 2; super->frameIndex = 0; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); } if (super->parent != NULL) { super->frameIndex = (super->parent->frame & 3) + 0x21; @@ -79,7 +79,7 @@ void sub_0806CBB4(GregalEntity* this) { if (super->action == 0) { super->action++; super->animationState = 2; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitializeAnimation(super, 0x11); } GetNextFrame(super); @@ -96,7 +96,7 @@ void sub_0806CC08(GregalEntity* this) { case 0: super->action = 1; super->spriteSettings.draw = 1; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); sub_0807DD64(super); case 1: if (super->interactType == INTERACTION_FUSE) { @@ -177,7 +177,7 @@ void Gregal_Fusion(Entity* this) { if (this->action == 0) { this->action++; this->spriteSettings.draw = 1; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitAnimationForceUpdate(this, 6); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/hurdyGurdyMan.c b/src/npc/hurdyGurdyMan.c index 93cb3c36..dfb0c4fc 100644 --- a/src/npc/hurdyGurdyMan.c +++ b/src/npc/hurdyGurdyMan.c @@ -29,7 +29,7 @@ void HurdyGurdyMan(HurdyGurdyManEntity* this) { if (LoadExtraSpriteData(super, gUnk_081144F0)) { super->action = 1; this->unk_69 = 0; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitScriptForNPC(super); } break; @@ -123,7 +123,7 @@ void HurdyGurdyMan_Fusion(Entity* this) { if (LoadExtraSpriteData(this, gUnk_081144F0)) { this->action++; this->spriteSettings.draw = 1; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitializeAnimation(this, 10); } } else { diff --git a/src/npc/kingGustaf.c b/src/npc/kingGustaf.c index 880441c8..f71678dc 100644 --- a/src/npc/kingGustaf.c +++ b/src/npc/kingGustaf.c @@ -16,7 +16,7 @@ void KingGustaf(Entity* this) { this->action++; this->spriteRendering.alphaBlend = 1; this->collisionLayer = 2; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitScriptForNPC(this); gScreen.controls.layerFXControl = 0x3f40; gScreen.controls.alphaBlend = 0x1000; diff --git a/src/npc/librari.c b/src/npc/librari.c index f1feaf98..f0778371 100644 --- a/src/npc/librari.c +++ b/src/npc/librari.c @@ -22,7 +22,7 @@ void Librari(LibrariEntity* this) { super->animationState = super->timer; this->fusionOffer = GetFusionToOffer(super); AddInteractableWhenBigFuser(super, this->fusionOffer); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitScriptForNPC(super); break; case 1: diff --git a/src/npc/mama.c b/src/npc/mama.c index 8590e994..43cdd164 100644 --- a/src/npc/mama.c +++ b/src/npc/mama.c @@ -62,7 +62,7 @@ bool32 sub_0806C454(Entity* this) { if (!LoadExtraSpriteData(this, gUnk_08113754)) { return FALSE; } else { - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); return TRUE; } } diff --git a/src/npc/marcy.c b/src/npc/marcy.c index d30ef441..bfef099e 100644 --- a/src/npc/marcy.c +++ b/src/npc/marcy.c @@ -14,7 +14,7 @@ void Marcy(Entity* this) { if (this->action == 0) { this->action++; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); sub_0807DD64(this); } ExecuteScriptAndHandleAnimation(this, NULL); diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index b817987d..161b9f36 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -24,7 +24,7 @@ void MayorHagen(MayorHagenEntity* this) { super->action = 1; this->animIndex = 0; this->fusionOffer = GetFusionToOffer(super); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitScriptForNPC(super); break; case 1: diff --git a/src/npc/melari.c b/src/npc/melari.c index 22f303f4..75ae8ed3 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -78,7 +78,7 @@ void sub_08068780(Entity* this) { this->action = 1; this->spriteSettings.draw = TRUE; this->animationState = this->type; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitScriptForNPC(this); break; case 1: diff --git a/src/npc/minishEzlo.c b/src/npc/minishEzlo.c index 2306f107..b509b1db 100644 --- a/src/npc/minishEzlo.c +++ b/src/npc/minishEzlo.c @@ -33,7 +33,7 @@ void MinishEzlo(Entity* this) { } this->action++; this->animationState = this->timer * 2; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitScriptForNPC(this); } ExecuteScriptForEntity(this, NULL); diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c index 15aa1d06..baf3e231 100644 --- a/src/npc/mountainMinish.c +++ b/src/npc/mountainMinish.c @@ -126,7 +126,7 @@ void sub_08067EF0(MountainMinishEntity* this) { super->spriteSettings.draw = 1; super->animationState = super->type; this->animIndex = 0; - SetDefaultPriority(super, 2); + SetEntityPriority(super, 2); InitScriptForNPC(super); InitializeAnimation(super, gUnk_08111304[super->type2]); break; diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c index afe2d86f..a9adf6e0 100644 --- a/src/npc/mutoh.c +++ b/src/npc/mutoh.c @@ -36,7 +36,7 @@ void Mutoh(MutohEntity* this) { if (LoadExtraSpriteData(super, gUnk_08110C00)) { super->action = 1; super->spriteSettings.draw = TRUE; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitScriptForNPC(super); } break; diff --git a/src/npc/pita.c b/src/npc/pita.c index ccf79c69..673de68b 100644 --- a/src/npc/pita.c +++ b/src/npc/pita.c @@ -28,7 +28,7 @@ void Pita(PitaEntity* this) { }; if (super->action == 0) { super->action++; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); SortEntityAbove(super, super); super->hitbox = (Hitbox*)&gUnk_0810C428; sub_0807DD64(super); diff --git a/src/npc/postman.c b/src/npc/postman.c index f8e9b0fa..12711abc 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -234,7 +234,7 @@ void sub_080604DC(Entity* this) { ent = CreateFx(this, FX_DASH, 0x40); if (ent != NULL) { ent->y.HALF.HI++; - SetDefaultPriority(ent, 3); + SetEntityPriority(ent, 3); } } } diff --git a/src/npc/rem.c b/src/npc/rem.c index 5470b36b..45d66679 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -76,7 +76,7 @@ void sub_0806a370(RemEntity* this) { void sub_0806A3D8(RemEntity* this) { super->action = 1; super->timer = 180; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); sub_0806A8C8(super); this->context = StartCutscene(super, &script_Rem); ExecuteScriptAndHandleAnimation(super, NULL); @@ -297,7 +297,7 @@ void sub_0806A830(RemEntity* this) { if (super->action == 0) { super->action = 1; InitializeAnimation(super, 0x14); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); } if ((gActiveScriptInfo.syncFlags & 0x200) != 0) { DeleteThisEntity(); @@ -316,7 +316,7 @@ void sub_0806A890(RemEntity* this) { if (super->action == 0) { super->action = 1; InitializeAnimation(super, 0x15); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); } GetNextFrame(super); if ((super->frame & ANIM_DONE) != 0) { diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index 3560137b..68d63b46 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -59,7 +59,7 @@ void sub_08065080(StockwellEntity* this) { super->action = 1; super->spriteSettings.draw = 1; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitializeAnimation(super, 4); AddInteractableWhenBigObject(super); #ifndef EU diff --git a/src/npc/syrup.c b/src/npc/syrup.c index ae1f8eb1..c8d5d6c4 100644 --- a/src/npc/syrup.c +++ b/src/npc/syrup.c @@ -48,7 +48,7 @@ void sub_0806A1F8(SyrupEntity* this) { if (LoadExtraSpriteData(super, paVar2)) { super->action = 1; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitScriptForNPC(super); InitializeAnimation(super, 0); } diff --git a/src/npc/teachers.c b/src/npc/teachers.c index 52ea9b4f..527e357a 100644 --- a/src/npc/teachers.c +++ b/src/npc/teachers.c @@ -30,7 +30,7 @@ void Teachers(TeachersEntity* this) { super->spriteSettings.draw = TRUE; super->animationState = super->timer; this->animIndex = 0; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitScriptForNPC(super); } break; diff --git a/src/npc/vaati.c b/src/npc/vaati.c index f55e285f..9f1c9482 100644 --- a/src/npc/vaati.c +++ b/src/npc/vaati.c @@ -42,7 +42,7 @@ void VaatiAction0(VaatiEntity* this) { super->spriteSettings.draw = 1; this->unk_68 = 0; this->unk_69 = 0; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); sub_0807DD64(super); VaatiAction1(this); } diff --git a/src/npc/wheaton.c b/src/npc/wheaton.c index aa24f321..7638a205 100644 --- a/src/npc/wheaton.c +++ b/src/npc/wheaton.c @@ -12,7 +12,7 @@ void Wheaton(Entity* this) { if (this->action == 0) { this->action++; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); SortEntityAbove(this, this); this->hitbox = (Hitbox*)&gUnk_0810C3C0; this->spriteOffsetY = 0xfe; diff --git a/src/npc/zelda.c b/src/npc/zelda.c index a2882348..9fa4612e 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -31,7 +31,7 @@ void sub_08066CCC(Entity* this) { this->action = 1; this->spriteSettings.draw = 1; PrependEntityToList(this, 7); - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitScriptForNPC(this); } diff --git a/src/npc/zeldaFollower.c b/src/npc/zeldaFollower.c index fd9c71d9..349c9338 100644 --- a/src/npc/zeldaFollower.c +++ b/src/npc/zeldaFollower.c @@ -51,7 +51,7 @@ void ZeldaFollower(ZeldaFollowerEntity* this) { super->animationState = 4; this->unk_68 = 0; this->unk_69 = 0; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitAnimationForceUpdate(super, 0); sub_0806854C(this, NULL); } diff --git a/src/object/beanstalk.c b/src/object/beanstalk.c index d265052e..d2f7899c 100644 --- a/src/object/beanstalk.c +++ b/src/object/beanstalk.c @@ -67,7 +67,7 @@ void Beanstalk_Init(BeanstalkEntity* this) { super->spriteRendering.b3 = 2; super->spriteOrientation.flipY = 1; - SetDefaultPriority(super, 4); + SetEntityPriority(super, 4); if (super->type == 7) { #ifndef EU if ((super->flags & ENT_DID_INIT) == 0) { diff --git a/src/object/bigBarrel.c b/src/object/bigBarrel.c index e1515106..07708c40 100644 --- a/src/object/bigBarrel.c +++ b/src/object/bigBarrel.c @@ -208,7 +208,7 @@ void BigBarrel_Type2(BigBarrelEntity* this) { super->spriteSettings.draw = 1; super->frameIndex = super->type2 * 4 + 6; super->collisionLayer = 2; - SetDefaultPriority(super, 3); + SetEntityPriority(super, 3); super->type2 = super->type2 == 0 ? 0x15 : 0x16; UpdateSpriteForCollisionLayer(super); break; @@ -346,7 +346,7 @@ void sub_08089094(BigBarrelEntity* this) { void sub_080890EC(BigBarrelEntity* this, const s16* offsets, s32 yOffset) { Entity* pEVar1 = CreateObject(BIG_BARREL, 3, 0); if (pEVar1) { - SetDefaultPriority(pEVar1, 3); + SetEntityPriority(pEVar1, 3); pEVar1->x.HALF.HI = super->x.HALF.HI; pEVar1->y.HALF.HI = super->y.HALF.HI + yOffset; pEVar1->parent = super; diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index f7bacd3d..7efe0113 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -49,7 +49,7 @@ void BigVortex_Init(BigVortexEntity* this) { super->spriteSettings.draw = TRUE; sub_08098E88(super); } - SetDefaultPriority(super, PRIO_PLAYER_EVENT); + SetEntityPriority(super, PRIO_PLAYER_EVENT); InitAnimationForceUpdate(super, 0); } diff --git a/src/object/bird.c b/src/object/bird.c index 2fc5ed83..2b4b0dac 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -214,7 +214,7 @@ void Bird_Type8(BirdEntity* this) { super->x.HALF.HI = gRoomControls.scroll_x; super->y.HALF.HI = gPlayerEntity.y.HALF.HI; super->child = NULL; - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); InitAnimationForceUpdate(super, 0); SoundReq(0x123); break; @@ -307,7 +307,7 @@ void Bird_Type9(BirdEntity* this) { super->spritePriority.b0 = 0; super->spriteRendering.b3 = 0; super->spriteOrientation.flipY = 1; - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); super->x.HALF.HI = gRoomControls.scroll_x; super->y.HALF.HI = gPlayerEntity.y.HALF.HI; SoundReq(SFX_123); @@ -364,7 +364,7 @@ void Bird_Type10(BirdEntity* this) { super->spritePriority.b0 = 0; super->spriteRendering.b3 = 0; super->spriteOrientation.flipY = 1; - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); InitAnimationForceUpdate(super, 0xe0); case 1: UpdateAnimationSingleFrame(super); @@ -400,7 +400,7 @@ void sub_0809D738(void) { pEVar1 = CreateObject(BIRD, 9, 0); if (pEVar1 != NULL) { gRoomControls.camera_target = NULL; - SetDefaultPriority(pEVar1, 6); + SetEntityPriority(pEVar1, 6); SetPlayerEventPriority(); pEVar2 = CreateObject(BIRD, 10, 0); if (pEVar2 != NULL) { diff --git a/src/object/cameraTarget.c b/src/object/cameraTarget.c index 9c001915..e19d0499 100644 --- a/src/object/cameraTarget.c +++ b/src/object/cameraTarget.c @@ -96,7 +96,7 @@ void CameraTarget_Init(Entity* this) { } this->action = 1; this->flags |= ENT_PERSIST; - SetDefaultPriority(this, 6); + SetEntityPriority(this, 6); } void CameraTarget_Action1(Entity* this) { diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index 1e28d988..74db801c 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -100,7 +100,7 @@ void CrenelBeanSprout_Init(CrenelBeanSproutEntity* this) { break; case 1: super->spriteRendering.b0 = 3; - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); break; case 2: if (CheckLocalFlag((u32)super->type2) == 0) { diff --git a/src/object/cutsceneMiscObject.c b/src/object/cutsceneMiscObject.c index 6cf374ad..00fdc5e7 100644 --- a/src/object/cutsceneMiscObject.c +++ b/src/object/cutsceneMiscObject.c @@ -212,7 +212,7 @@ void CutsceneMiscObject_Type2(CutsceneMiscObjectEntity* this) { DeleteThisEntity(); if (super->action == 0) { super->action++; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); super->spriteRendering.b3 = gUnk_08114F30[p->spriteRendering.b3]; InitAnimationForceUpdate(super, 1); } @@ -231,7 +231,7 @@ void CutsceneMiscObject_Type3(CutsceneMiscObjectEntity* this) { } else { super->action++; super->spriteSettings.draw = 1; - SetDefaultPriority(super, PRIO_NO_BLOCK); + SetEntityPriority(super, PRIO_NO_BLOCK); switch (super->type2) { case 0x40: case 0x41: @@ -290,7 +290,7 @@ void CutsceneMiscObject_Type4(CutsceneMiscObjectEntity* this) { } else { super->action++; super->spriteSettings.draw = 1; - SetDefaultPriority(super, PRIO_NO_BLOCK); + SetEntityPriority(super, PRIO_NO_BLOCK); InitAnimationForceUpdate(super, 0); } UpdateAnimationSingleFrame(super); @@ -330,7 +330,7 @@ void CutsceneMiscObject_Type5(CutsceneMiscObjectEntity* this) { super->action++; super->z.WORD = Q_16_16(-160.0); super->zVelocity = 0; - SetDefaultPriority(super, PRIO_PLAYER_EVENT); + SetEntityPriority(super, PRIO_PLAYER_EVENT); InitializeAnimation(super, 0); if (GetTileUnderEntity(super) == 13) { super->action = 3; @@ -472,7 +472,7 @@ void CutsceneMiscObject_Type7(CutsceneMiscObjectEntity* this) { void CutsceneMiscObject_Type8(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action = 1; - SetDefaultPriority(super, PRIO_NO_BLOCK); + SetEntityPriority(super, PRIO_NO_BLOCK); SortEntityBelow(super, super); sub_0807DD64(super); InitAnimationForceUpdate(super, 2); @@ -492,7 +492,7 @@ void sub_08095164(CutsceneMiscObjectEntity* this) { void CutsceneMiscObject_Type9(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action = 1; - SetDefaultPriority(super, PRIO_NO_BLOCK); + SetEntityPriority(super, PRIO_NO_BLOCK); SortEntityBelow(super, super); sub_0807DD64(super); InitAnimationForceUpdate(super, 0); @@ -547,7 +547,7 @@ void CutsceneMiscObject_Type11(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->subAction = 0; - SetDefaultPriority(super, PRIO_NO_BLOCK); + SetEntityPriority(super, PRIO_NO_BLOCK); InitAnimationForceUpdate(super, 0); } if (super->subAction != 0) { @@ -607,7 +607,7 @@ void CutsceneMiscObject_Type12(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->z.HALF.HI = -16; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); super->spriteRendering.b3 = gUnk_08114F30[super->spriteRendering.b3]; SortEntityAbove(super, super); sub_0807DD64(super); @@ -844,7 +844,7 @@ void CutsceneMiscObject_Type19(CutsceneMiscObjectEntity* this) { void CutsceneMiscObject_Type20(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; - SetDefaultPriority(super, PRIO_PLAYER_EVENT); + SetEntityPriority(super, PRIO_PLAYER_EVENT); sub_0807DD64(super); InitializeAnimation(super, 0); } @@ -879,7 +879,7 @@ void CutsceneMiscObject_Type22(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->spriteSettings.draw = 0; - SetDefaultPriority(super, PRIO_NO_BLOCK); + SetEntityPriority(super, PRIO_NO_BLOCK); sub_0807DD64(super); } ExecuteScriptForEntity(super, 0); @@ -1035,7 +1035,7 @@ void CutsceneMiscObject_Type28(CutsceneMiscObjectEntity* this) { if (super->action == 0) { super->action++; super->spriteSettings.draw = 0; - SetDefaultPriority(super, PRIO_PLAYER_EVENT); + SetEntityPriority(super, PRIO_PLAYER_EVENT); sub_0807DD64(super); } ExecuteScriptForEntity(super, 0); diff --git a/src/object/deathFx.c b/src/object/deathFx.c index e6121ec0..2d4204e4 100644 --- a/src/object/deathFx.c +++ b/src/object/deathFx.c @@ -81,7 +81,7 @@ void DeathFx_Action0(DeathFxObject* this) { super->action = 1; EnqueueSFX(SFX_FF); } - SetDefaultPriority(super, 3); + SetEntityPriority(super, 3); } void DeathFx_Action1(DeathFxObject* this) { diff --git a/src/object/fairy.c b/src/object/fairy.c index ba3b6703..e937288f 100644 --- a/src/object/fairy.c +++ b/src/object/fairy.c @@ -110,7 +110,7 @@ void Fairy_Init(FairyEntity* this) { super->gustJarFlags = 1; this->unk_74 = super->x.HALF.HI; this->unk_76 = super->y.HALF.HI; - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); EnqueueSFX(SFX_136); switch (super->type2) { diff --git a/src/object/figurineDevice.c b/src/object/figurineDevice.c index 624824ae..86c09f1d 100644 --- a/src/object/figurineDevice.c +++ b/src/object/figurineDevice.c @@ -102,7 +102,7 @@ void FigurineDevice_Init(FigurineDeviceEntity* this) { case 2: this->unk_7a = 0; - SetDefaultPriority(super, 7); + SetEntityPriority(super, 7); InitializeAnimation(super, 1); break; case 3: @@ -113,7 +113,7 @@ void FigurineDevice_Init(FigurineDeviceEntity* this) { this->unk_7b = 0; this->unk_80 = 0; sub_0808804C(this); - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); break; } } diff --git a/src/object/fourElements.c b/src/object/fourElements.c index a9e02140..1c3942ea 100644 --- a/src/object/fourElements.c +++ b/src/object/fourElements.c @@ -108,7 +108,7 @@ void FourElements_Action3(FourElementsEntity* this) { if (super->timer != 0) { sub_080A0424(this); if (--super->timer == 0) { - SetDefaultPriority(&gPlayerEntity, 0); + SetEntityPriority(&gPlayerEntity, 0); } } else { RequestPriorityDuration(NULL, 60); diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c index 6f46ac27..540a85dd 100644 --- a/src/object/frozenOctorok.c +++ b/src/object/frozenOctorok.c @@ -64,7 +64,7 @@ void FrozenOctorok_Init(FrozenOctorokEntity* this) { super->action = 1; switch (super->type) { case 0: - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); this->unk_7e = 0; case 6: super->timer = 1; diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index 6820317a..1416d564 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -497,7 +497,7 @@ void GreatFairy_InitializeAnimation(GreatFairyEntity* this) { super->type2 = super->type % temp; super->collisionLayer = 2; InitializeAnimation(super, super->type2); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); } Entity* GreatFairy_CreateForm(GreatFairyEntity* this, u32 curForm, u32 parameter) { @@ -544,7 +544,7 @@ void sub_08087424(GreatFairyEntity* this, ScriptExecutionContext* context) { if (ent != NULL) { ent->parent = &gPlayerEntity; CopyPosition(&gPlayerEntity, ent); - SetDefaultPriority(ent, PRIO_MESSAGE); + SetEntityPriority(ent, PRIO_MESSAGE); } switch (context->intVariable) { diff --git a/src/object/guruguruBar.c b/src/object/guruguruBar.c index 0de3796d..2c1365c1 100644 --- a/src/object/guruguruBar.c +++ b/src/object/guruguruBar.c @@ -52,7 +52,7 @@ void GuruguruBar_Init(GuruguruBarEntity* this) { bVar1 = this->unk7e; this->unk76 = bVar1 << 8; super->animationState = bVar1 << 6; - SetDefaultPriority(super, 0); + SetEntityPriority(super, 0); if (super->type != 0) { super->child = (Entity*)GetCurrentRoomProperty(super->type); UpdateRailMovement(super, (u16**)&super->child, &this->unk74); diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index a921f8ba..2835e202 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -62,7 +62,7 @@ void HouseDoorExterior_Type0(HouseDoorExteriorEntity* this) { super->action = 1; *((u32*)(&this->unk_68)) = 0; this->unk_6c = super->timer; - SetDefaultPriority(super, PRIO_PLAYER_EVENT); + SetEntityPriority(super, PRIO_PLAYER_EVENT); } prop = GetCurrentRoomProperty(this->unk_6c); diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index aca8b2fd..9a87f5c6 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -66,7 +66,7 @@ void ItemForSale_Init(ItemForSaleEntity* this) { super->spritePriority.b1 = 0; super->carryFlags = 0; #ifdef EU - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); #endif super->child = super; ItemForSale_MakeInteractable(this); diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index bf70e601..8aff156f 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -143,7 +143,7 @@ void ItemOnGround_Init(ItemOnGroundEntity* this) { this->unk_6c = 0; this->unk_68 = 0; super->timer = 0; - SetDefaultPriority(super, PRIO_NO_BLOCK); + SetEntityPriority(super, PRIO_NO_BLOCK); super->gustJarFlags = sub_0808147C(super->type); gUnk_0811E7E8[this->unk_69](this); } else { @@ -370,7 +370,7 @@ void sub_08081404(ItemOnGroundEntity* this, u32 arg1) { bool32 sub_08081420(ItemOnGroundEntity* this) { if (CheckShouldPlayItemGetCutscene(this)) { - SetDefaultPriority(super, PRIO_PLAYER_EVENT); + SetEntityPriority(super, PRIO_PLAYER_EVENT); CreateItemEntity(super->type, super->type2, 0); return TRUE; } else { diff --git a/src/object/linkAnimation.c b/src/object/linkAnimation.c index 8a9d361d..c811373c 100644 --- a/src/object/linkAnimation.c +++ b/src/object/linkAnimation.c @@ -2,126 +2,122 @@ * @file linkAnimation.c * @ingroup Objects * - * @brief Link Animation object + * @brief Link Animation object. This is used during "item get" sequences and + * replaces the player entity for the duration. */ #define NENT_DEPRECATED #include "functions.h" #include "message.h" #include "object.h" +#include "object/linkAnimation.h" -typedef struct { - /*0x00*/ Entity base; - /*0x68*/ u8 unk_68; - /*0x69*/ u8 unk_69; - /*0x6a*/ u8 unk_6a; - /*0x6b*/ u8 unk_6b; - /*0x6c*/ u8 unk_6c; - /*0x6d*/ u8 unk_6d; - /*0x6e*/ u8 unk_6e; - /*0x6f*/ u8 unk_6f; - /*0x70*/ u32 unk_70; - /*0x74*/ u8 unk_74; -} LinkAnimationEntity; +typedef enum { + ITEMGET_INIT, + ITEMGET_UPDATE, + ITEMGET_WAIT, +} ItemGetState; void LinkAnimation_Init(LinkAnimationEntity*); -void LinkAnimation_Action1(LinkAnimationEntity*); -void LinkAnimation_Action8(LinkAnimationEntity*); +void LinkAnimation_Default(LinkAnimationEntity*); +void LinkAnimation_ItemGet(LinkAnimationEntity*); 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, + LinkAnimation_Init, LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, + LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, + LinkAnimation_ItemGet, LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, + LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, + LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, + LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, + LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, + LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, LinkAnimation_Default, }; LinkAnimation_Actions[super->action](this); } void LinkAnimation_Init(LinkAnimationEntity* this) { - super->action = 8; - LinkAnimation_Action8(this); + super->action = PLAYER_ITEMGET; + LinkAnimation_ItemGet(this); } -void LinkAnimation_Action1(LinkAnimationEntity* this) { +void LinkAnimation_Default(LinkAnimationEntity* this) { ResetPlayerEventPriority(); gPauseMenuOptions.disabled = 0; DeleteThisEntity(); } -void LinkAnimation_Action8(LinkAnimationEntity* this) { +void LinkAnimation_ItemGet(LinkAnimationEntity* this) { u32 one; - u32 tmp; - Entity* parent; + u32 sprite; + Entity* held_obj; u8* ptr; + // hide player entity gPlayerEntity.flags &= ~ENT_COLLIDE; gPlayerEntity.spriteSettings.draw = 0; + super->palette.b.b0 = gPlayerEntity.palette.b.b0; switch (super->subAction) { - case 0: + case ITEMGET_INIT: one = 1; super->subAction = one; super->spriteSettings.draw = one; super->collisionLayer = gPlayerEntity.collisionLayer; super->spritePriority.b0 = gPlayerEntity.spritePriority.b0; - super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; super->spriteSettings.flipX = 0; super->animationState = 4; - SetDefaultPriority(super, 6); - if ((gPlayerState.flags & PL_NO_CAP) != 0) { - if (sub_080542AC(super->type)) { - tmp = 0x45e; + SetEntityPriority(super, PRIO_PLAYER_EVENT); + if (gPlayerState.flags & PL_NO_CAP) { + if (IsMinishItem(super->type)) { + sprite = ANIM_GET_ITEM_SMALL_NOCAP; } else { - tmp = 0x45b; + sprite = ANIM_GET_ITEM_BIG_NOCAP; } } else { - if (sub_080542AC(super->type)) { - tmp = 0x2e0; + if (IsMinishItem(super->type)) { + sprite = ANIM_GET_ITEM_SMALL; } else { - tmp = 0x1b9; + sprite = ANIM_GET_ITEM_BIG; } } - super->spriteIndex = (tmp >> 8); - InitAnimationForceUpdate(super, tmp & 0xff); + super->spriteIndex = (sprite >> 8); + InitAnimationForceUpdate(super, sprite & 0xff); break; - case 1: + case ITEMGET_UPDATE: UpdateAnimationSingleFrame(super); if (super->frame != 0) { super->subAction++; } break; - case 2: + case ITEMGET_WAIT: UpdateAnimationSingleFrame(super); if ((gMessage.doTextBox & 0x7f) != 0) { return; } - if ((super->frame & ANIM_DONE) != 0) { - super->action = 1; - gPlayerEntity.flags = this->unk_69; - gPlayerEntity.spriteSettings.draw = this->unk_68; - gPlayerEntity.iframes = this->unk_6a; - gPlayerState.field_0x7 = this->unk_6b; - gPlayerState.keepFacing = this->unk_6c; - gPlayerState.field_0xa = this->unk_6d; - gPlayerState.field_0x27[0] = this->unk_6e; - gPlayerState.mobility = this->unk_6f; - gPlayerState.flags = this->unk_70; - gPlayerState.field_0x8a = this->unk_74; + if (super->frame & ANIM_DONE) { + super->action = PLAYER_NORMAL; + // restore player state + gPlayerEntity.flags = this->storeFlags; + gPlayerEntity.spriteSettings.draw = this->storeDrawFlags; + gPlayerEntity.iframes = this->storeIFrames; + gPlayerState.field_0x7 = this->storeField7; + gPlayerState.keepFacing = this->storeKeepFacing; + gPlayerState.field_0xa = this->storeFieldA; + gPlayerState.field_0x27[0] = this->storeField27; + gPlayerState.mobility = this->storeMobility; + gPlayerState.flags = this->storeStateFlags; + gPlayerState.field_0x8a = this->store8A; } break; } - parent = super->parent; - if (parent != NULL) { - PositionEntityOnTop(super, parent); + held_obj = super->parent; + if (held_obj != NULL) { + PositionEntityOnTop(super, held_obj); ptr = GetSpriteSubEntryOffsetDataPointer((u16)super->spriteIndex, super->frameIndex); - parent->spriteOffsetX = *ptr; - parent->spriteOffsetY = ptr[1]; + held_obj->spriteOffsetX = ptr[0]; + held_obj->spriteOffsetY = ptr[1]; } } diff --git a/src/object/linkHoldingItem.c b/src/object/linkHoldingItem.c index cf14269a..009535a7 100644 --- a/src/object/linkHoldingItem.c +++ b/src/object/linkHoldingItem.c @@ -38,7 +38,7 @@ void LinkHoldingItem(LinkHoldingItemEntity* this) { } void LinkHoldingItem_Init(LinkHoldingItemEntity* this) { - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); super->action = 1; } diff --git a/src/object/minishVillageObject.c b/src/object/minishVillageObject.c index 7abd4675..dbefdeb9 100644 --- a/src/object/minishVillageObject.c +++ b/src/object/minishVillageObject.c @@ -127,7 +127,7 @@ void sub_0808D2CC(void) { Entity* obj = FindEntity(6, MINISH_VILLAGE_OBJECT, 6, 1, 0); if (obj != NULL) { obj->type = 9; - SetDefaultPriority(obj, 2); + SetEntityPriority(obj, 2); } } diff --git a/src/object/moleMittsParticle.c b/src/object/moleMittsParticle.c index 15b19439..93a0379c 100644 --- a/src/object/moleMittsParticle.c +++ b/src/object/moleMittsParticle.c @@ -63,7 +63,7 @@ void MoleMittsParticle_Init(Entity* this) { break; } } - SetDefaultPriority(this, 3); + SetEntityPriority(this, 3); InitializeAnimation(this, this->type2 * 4 + this->animationState); } diff --git a/src/object/object30.c b/src/object/object30.c index fdda1933..446d2bf6 100644 --- a/src/object/object30.c +++ b/src/object/object30.c @@ -106,6 +106,6 @@ void sub_0808A968(Object30Entity* this) { super->spriteSettings.shadow = 0; super->collisionFlags |= 0x10; super->hitbox = (Hitbox*)&gUnk_08121C58; - SetDefaultPriority(super, 2); + SetEntityPriority(super, 2); this->gravity = Q_8_8(40.0); } diff --git a/src/object/objectA2.c b/src/object/objectA2.c index 1dedecaf..4f9c55cb 100644 --- a/src/object/objectA2.c +++ b/src/object/objectA2.c @@ -45,7 +45,7 @@ void ObjectA2_Init(Entity* this) { this->spriteOrientation.flipY = 2; this->action = 1; ChangeObjPalette(this, gUnk_08124704[this->type]); - SetDefaultPriority(this, PRIO_HIGHEST); + SetEntityPriority(this, PRIO_HIGHEST); } void ObjectA2_Action1(Entity* this) { diff --git a/src/object/objectA8.c b/src/object/objectA8.c index dca5a903..819495d4 100644 --- a/src/object/objectA8.c +++ b/src/object/objectA8.c @@ -83,7 +83,7 @@ void ObjectA8_Init(ObjectA8Entity* this) { super->gustJarFlags = 1; this->unk_74 = super->x.HALF.HI; this->unk_76 = super->y.HALF.HI; - SetDefaultPriority(super, 3); + SetEntityPriority(super, 3); EnqueueSFX(SFX_136); } diff --git a/src/object/parallaxRoomView.c b/src/object/parallaxRoomView.c index f72cc80b..bd08c984 100644 --- a/src/object/parallaxRoomView.c +++ b/src/object/parallaxRoomView.c @@ -34,7 +34,7 @@ void ParallaxRoomView(ParallaxRoomViewEntity* this) { } this->unk_68 = super->x.HALF.HI; this->unk_6a = super->y.HALF.HI; - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); } if ((super->flags & 0x10) == 0) { iVar4 = super->x.HALF.HI - gRoomControls.scroll_x; diff --git a/src/object/shrinkingHieroglyphs.c b/src/object/shrinkingHieroglyphs.c index be8462b5..daa132f1 100644 --- a/src/object/shrinkingHieroglyphs.c +++ b/src/object/shrinkingHieroglyphs.c @@ -52,7 +52,7 @@ void ShrinkingHieroglyphs_Init(ShrinkingHieroglyphsEntity* this) { super->subtimer = 30; this->objDir.HALF.HI = ShrinkingHieroglyphs_Directions[super->type]; this->unk74 = 0x2000; - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); if (super->type == 0) { this->unk7e = 0x40; LoadSwapGFX(super, 1, 0); diff --git a/src/object/specialFx.c b/src/object/specialFx.c index 3a5ca962..8780cf0c 100644 --- a/src/object/specialFx.c +++ b/src/object/specialFx.c @@ -153,7 +153,7 @@ void SpecialFx_Init(SpecialFxObject* this) { super->action = 1; super->flags &= ~0x80; super->spriteSettings.draw = 1; - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); if (super->collisionLayer == 0) { ResolveCollisionLayer(super); } diff --git a/src/object/windTribeTeleporter.c b/src/object/windTribeTeleporter.c index bd94a171..997a91d0 100644 --- a/src/object/windTribeTeleporter.c +++ b/src/object/windTribeTeleporter.c @@ -39,7 +39,7 @@ void WindTribeTeleporter_Init(WindTribeTeleporterEntity* this) { super->frameDuration = 8; super->spritePriority.b0 = 7; super->hitbox = (Hitbox*)&gHitbox_22; - SetDefaultPriority(super, 6); + SetEntityPriority(super, 6); if (sub_080A11C0(this)) { gPlayerEntity.x.HALF.HI = super->x.HALF.HI; gPlayerEntity.y.HALF.HI = super->y.HALF.HI; diff --git a/src/objectUtils.c b/src/objectUtils.c index a688564d..254be88f 100644 --- a/src/objectUtils.c +++ b/src/objectUtils.c @@ -1,3 +1,5 @@ +#define NENT_DEPRECATED + #include "global.h" #include "entity.h" #include "physics.h" @@ -5,6 +7,8 @@ #include "object.h" #include "functions.h" #include "definitions.h" +#include "object/linkAnimation.h" +#include "object/itemOnGround.h" extern const Hitbox* const gObjectHitboxes[]; @@ -29,6 +33,7 @@ const s8 gUnk_08126EEC[] = { Entity* CreateLinkAnimation(Entity* parent, u32 type, u32 type2) { Entity* e = CreateItemGetEntity(); if (e != NULL) { + LinkAnimationEntity* this = (LinkAnimationEntity*)e; e->id = LINK_ANIMATION; e->kind = OBJECT; e->type = type; @@ -39,16 +44,20 @@ Entity* CreateLinkAnimation(Entity* parent, u32 type, u32 type2) { CopyPosition(&gPlayerEntity, e); gPriorityHandler.sys_priority = 6; gPauseMenuOptions.disabled = 1; - e->field_0x68.HALF.HI = gPlayerEntity.flags; - e->field_0x68.HALF.LO = gPlayerEntity.spriteSettings.draw; - e->field_0x6a.HALF.LO = gPlayerEntity.iframes; - e->field_0x6a.HALF.HI = gPlayerState.field_0x7; - e->field_0x6c.HALF.LO = gPlayerState.keepFacing; - e->field_0x6c.HALF.HI = gPlayerState.field_0xa; - e->field_0x6e.HALF.LO = gPlayerState.field_0x27[0]; - e->field_0x6e.HALF.HI = gPlayerState.mobility; - e->field_0x70.WORD = gPlayerState.flags; - e->field_0x74.HALF.LO = gPlayerState.field_0x8a; + + // store player state + this->storeFlags = gPlayerEntity.flags; + this->storeDrawFlags = gPlayerEntity.spriteSettings.draw; + this->storeIFrames = gPlayerEntity.iframes; + this->storeField7 = gPlayerState.field_0x7; + this->storeKeepFacing = gPlayerState.keepFacing; + this->storeFieldA = gPlayerState.field_0xa; + this->storeField27 = gPlayerState.field_0x27[0]; + this->storeMobility = gPlayerState.mobility; + this->storeStateFlags = gPlayerState.flags; + this->store8A = gPlayerState.field_0x8a; + + // redundant, this is done by the LinkAnimation object gPlayerEntity.flags &= ~ENT_COLLIDE; gPlayerEntity.spriteSettings.draw = 0; } @@ -179,8 +188,9 @@ Entity* CreateGroundItemWithFlags(Entity* parent, u32 form, u32 subtype, u32 fla ent = CreateObjectWithParent(parent, GROUND_ITEM, form, subtype); if (ent != NULL) { + ItemOnGroundEntity* this = (ItemOnGroundEntity*)ent; ent->timer = 5; - ent->field_0x86.HWORD = flags; + this->unk_86 = flags; } return ent; } @@ -352,7 +362,7 @@ static Entity* CreateSpeechBubble(Entity* parent, u32 type2, s32 xOffset, s32 yO obj->parent = parent; obj->spriteOffsetX = xOffset; obj->spriteOffsetY = yOffset; - SetDefaultPriority(obj, parent->updatePriority); + SetEntityPriority(obj, parent->updatePriority); } return obj; } diff --git a/src/player.c b/src/player.c index cc028dba..90a10af1 100644 --- a/src/player.c +++ b/src/player.c @@ -778,13 +778,13 @@ static void PlayerItemGetInit(Entity* this) { if ((gPlayerState.flags & PL_MINISH) == 0) { u32 anim; if (gPlayerState.flags & PL_NO_CAP) { - if (sub_080542AC(gPlayerState.field_0x38)) { + if (IsMinishItem(gPlayerState.field_0x38)) { anim = ANIM_GET_ITEM_SMALL_NOCAP; } else { anim = ANIM_GET_ITEM_BIG_NOCAP; } } else { - if (sub_080542AC(gPlayerState.field_0x38)) { + if (IsMinishItem(gPlayerState.field_0x38)) { anim = ANIM_GET_ITEM_SMALL; } else { anim = ANIM_GET_ITEM_BIG; @@ -4094,7 +4094,7 @@ void sub_080751E8(u32 a1, u32 a2, void* script) { e2 = CreateSpeechBubbleSleep(&gPlayerEntity, -14, -28); *(Entity**)&gPlayerEntity.field_0x6c.HWORD = e2; if (e2 != NULL) { - SetDefaultPriority(e2, PRIO_NO_BLOCK); + SetEntityPriority(e2, PRIO_NO_BLOCK); } } diff --git a/src/playerUtils.c b/src/playerUtils.c index cff07abb..c987c761 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -23,7 +23,7 @@ static void sub_08077E54(ItemBehavior* beh); extern void sub_0800857C(Entity*); -extern void SetDefaultPriorityForKind(Entity*); +extern void SetEntityPriorityForKind(Entity*); extern void sub_0809D738(Entity*); extern s32 Mod(s32, s32); extern u32 sub_08003FDE(Entity*, Entity*, u32, u32); @@ -1853,7 +1853,7 @@ void PlayerSetNormalAndCollide(void) { PL_MOLDWORM_RELEASED | PL_PARACHUTE); ResolvePlayerAnimation(); SetPlayerActionNormal(); - SetDefaultPriorityForKind(&gPlayerEntity); + SetEntityPriorityForKind(&gPlayerEntity); } void PlayerMinishSetNormalAndCollide(void) { @@ -1869,7 +1869,7 @@ void PlayerMinishSetNormalAndCollide(void) { ~(PL_BUSY | PL_DROWNING | PL_DISABLE_ITEMS | PL_IN_HOLE | PL_MOLDWORM_RELEASED | PL_PARACHUTE); gPlayerState.swim_state = 0; gPlayerState.queued_action = PLAYER_INIT; - SetDefaultPriorityForKind(&gPlayerEntity); + SetEntityPriorityForKind(&gPlayerEntity); } void sub_080792BC(s32 speed, u32 direction, u32 field_0x38) { diff --git a/src/script.c b/src/script.c index 33fcbcf2..8216a438 100644 --- a/src/script.c +++ b/src/script.c @@ -1671,15 +1671,15 @@ void DeleteHitbox(Entity* entity, ScriptExecutionContext* context) { } void SetPriorityMessage(Entity* entity, ScriptExecutionContext* context) { - SetDefaultPriority(entity, PRIO_MESSAGE); + SetEntityPriority(entity, PRIO_MESSAGE); } void SetPriorityPlayerEvent(Entity* entity, ScriptExecutionContext* context) { - SetDefaultPriority(entity, PRIO_PLAYER_EVENT); + SetEntityPriority(entity, PRIO_PLAYER_EVENT); } void SetPriorityHighest(Entity* entity, ScriptExecutionContext* context) { - SetDefaultPriority(entity, PRIO_NO_BLOCK); + SetEntityPriority(entity, PRIO_NO_BLOCK); } void sub_0807F36C(Entity* entity, ScriptExecutionContext* context) { From d07c41664190a12c4f56d2e71eae8aa41f40ce21 Mon Sep 17 00:00:00 2001 From: theo3 Date: Thu, 28 Dec 2023 21:58:54 -0800 Subject: [PATCH 05/15] message definitions --- asm/src/enemy.s | 2 +- asm/src/projectileUpdate.s | 2 +- include/entity.h | 9 ++-- include/message.h | 4 +- include/player.h | 2 +- include/structures.h | 2 +- src/collision.c | 4 +- src/common.c | 4 +- src/cutscene.c | 8 ++-- src/enemy/businessScrub.c | 6 +-- src/enemy/chuchuBoss.c | 12 ++--- src/enemy/gleerok.c | 6 +-- src/enemy/octorokBoss.c | 12 ++--- src/enemy/vaatiTransfigured.c | 2 +- src/enemy/vaatiTransfiguredEye.c | 4 +- src/enemy/vaatiWrath.c | 2 +- src/enterPortalSubtask.c | 2 +- src/entity.c | 24 +++++----- src/game.c | 8 ++-- src/interrupts.c | 6 +-- src/manager.c | 2 +- src/manager/enterRoomTextboxManager.c | 4 +- src/manager/entitySpawnManager.c | 2 +- src/manager/ezloHintManager.c | 2 +- src/manager/lightManager.c | 67 +++++++++++---------------- src/manager/vaati3StartManager.c | 4 +- src/menu/kinstoneMenu.c | 2 +- src/message.c | 24 +++++----- src/npc.c | 2 +- src/npc/beedle.c | 2 +- src/npc/bigGoron.c | 2 +- src/npc/brocco.c | 2 +- src/npc/castleMaid.c | 2 +- src/npc/cat.c | 2 +- src/npc/epona.c | 2 +- src/npc/ghostBrothers.c | 4 +- src/npc/goron.c | 2 +- src/npc/goronMerchant.c | 4 +- src/npc/guard.c | 4 +- src/npc/kid.c | 2 +- src/npc/mountainMinish.c | 2 +- src/npc/npc23.c | 2 +- src/npc/npc9.c | 2 +- src/npc/percy.c | 4 +- src/npc/pina.c | 2 +- src/npc/postman.c | 2 +- src/npc/stamp.c | 2 +- src/npc/stockwell.c | 12 ++--- src/npc/sturgeon.c | 2 +- src/npc/talon.c | 2 +- src/npc/townMinish.c | 2 +- src/npc/townsperson.c | 2 +- src/npc/windTribespeople.c | 2 +- src/object.c | 2 +- src/object/bird.c | 12 ++--- src/object/book.c | 6 +-- src/object/bush.c | 2 +- src/object/cameraTarget.c | 2 +- src/object/cloud.c | 2 +- src/object/crenelBeanSprout.c | 2 +- src/object/cutsceneMiscObject.c | 2 +- src/object/ezloCap.c | 4 +- src/object/fourElements.c | 2 +- src/object/frozenOctorok.c | 2 +- src/object/gleerokParticle.c | 2 +- src/object/itemForSale.c | 2 +- src/object/lilypadLarge.c | 4 +- src/object/linkAnimation.c | 2 +- src/object/moleMittsParticle.c | 2 +- src/object/octorokBossObject.c | 2 +- src/object/well.c | 2 +- src/object/windTribeTeleporter.c | 12 ++--- src/objectUtils.c | 2 +- src/player.c | 14 +++--- src/playerItem.c | 2 +- src/playerUtils.c | 6 +-- src/script.c | 6 +-- src/scroll.c | 4 +- src/staffroll.c | 2 +- src/subtask.c | 2 +- src/ui.c | 6 +-- 81 files changed, 200 insertions(+), 206 deletions(-) diff --git a/asm/src/enemy.s b/asm/src/enemy.s index 4bada3c6..a19f232f 100644 --- a/asm/src/enemy.s +++ b/asm/src/enemy.s @@ -18,7 +18,7 @@ EnemyUpdate: @ 0x080011C4 bne _080011EA bl DeleteThisEntity _080011DC: - bl EntityIsDeleted + bl EntityDisabled cmp r0, #0 bne _0800120A adds r0, r4, #0 diff --git a/asm/src/projectileUpdate.s b/asm/src/projectileUpdate.s index 590744ce..2888a5fb 100644 --- a/asm/src/projectileUpdate.s +++ b/asm/src/projectileUpdate.s @@ -18,7 +18,7 @@ ProjectileUpdate: @ 0x08016AE4 bne _08016B0A bl DeleteThisEntity _08016AFC: - bl EntityIsDeleted + bl EntityDisabled cmp r0, #0 bne _08016B22 adds r0, r4, #0 diff --git a/include/entity.h b/include/entity.h index cbb54201..5b5c328d 100644 --- a/include/entity.h +++ b/include/entity.h @@ -389,9 +389,12 @@ Entity* FindEntity(u32 kind, u32 id, u32 listIndex, u32 type, u32 type2); void SetEntityPriority(Entity* entity, u32 prio); /** - * Check if entity will be deleted next frame. + * Check if entity is disabled. Entities are disabled if: + * - They are deleted. + * - There is an event and the entity doesn't have priority + * (n/a if entity is in action 0). */ -bool32 EntityIsDeleted(Entity* entity); +bool32 EntityDisabled(Entity* entity); /** * Check if system or entity is blocking updates. @@ -477,7 +480,7 @@ void SetInitializationPriority(void); /** * Reset the system update priority. */ -void ResetSystemPriority(void); +void ClearEventPriority(void); void sub_0805E958(void); diff --git a/include/message.h b/include/message.h index 344bf4ed..32f9f582 100644 --- a/include/message.h +++ b/include/message.h @@ -5,8 +5,10 @@ #include "entity.h" #include "structures.h" +#define MESSAGE_ACTIVE 0x7f + typedef struct { - u8 doTextBox; + u8 state; u8 unk; u8 textSpeed; u8 unk3; // HI? diff --git a/include/player.h b/include/player.h index db8c1f08..38e186e5 100644 --- a/include/player.h +++ b/include/player.h @@ -720,7 +720,7 @@ s32 AddInteractableObject(Entity*, u32, u32); void RemoveInteractableObject(Entity*); s32 GetInteractableObjectIndex(); void sub_08078AC0(u32, u32, u32); -void sub_08078B48(void); +void PausePlayer(void); void sub_08078E84(Entity*, Entity*); void sub_08078FB0(Entity*); void sub_080792BC(s32, u32, u32); diff --git a/include/structures.h b/include/structures.h index 0cbe9c71..6125cba9 100644 --- a/include/structures.h +++ b/include/structures.h @@ -191,7 +191,7 @@ extern ItemBehavior gActiveItems[MAX_ACTIVE_ITEMS]; static_assert(sizeof(gActiveItems) == 0x70); typedef struct { - u8 sys_priority; // system requested priority + u8 event_priority; // system requested priority u8 ent_priority; // entity requested priority u8 queued_priority; u8 queued_priority_reset; diff --git a/src/collision.c b/src/collision.c index 402c9bfa..7fb08ca4 100644 --- a/src/collision.c +++ b/src/collision.c @@ -63,8 +63,8 @@ void CollisionMain(void) { u32 prio; // pick highest priority - prio = gPriorityHandler.sys_priority; - if (gPriorityHandler.sys_priority <= gPriorityHandler.ent_priority) + prio = gPriorityHandler.event_priority; + if (gPriorityHandler.event_priority <= gPriorityHandler.ent_priority) prio = gPriorityHandler.ent_priority; // if any priority is set, dont do collision diff --git a/src/common.c b/src/common.c index 81cec6d1..10e200c0 100644 --- a/src/common.c +++ b/src/common.c @@ -747,7 +747,7 @@ void Fuse_Action0(void) { } void Fuse_Action1(void) { - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { MenuFadeIn(4, 0); gFuseInfo.fusionState = FUSION_STATE_4; gFuseInfo.action = 2; @@ -773,7 +773,7 @@ void Fuse_Action2(void) { } void Fuse_Action3(void) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { if (gFuseInfo.entity != NULL) { gFuseInfo.entity->updatePriority = gFuseInfo.prevUpdatePriority; } diff --git a/src/cutscene.c b/src/cutscene.c index 93ea6eac..bb1f7187 100644 --- a/src/cutscene.c +++ b/src/cutscene.c @@ -52,7 +52,7 @@ void sub_080535AC(void) { void sub_080535F4(void) { if (gFadeControl.active == 0) { - ResetSystemPriority(); + ClearEventPriority(); gMenu.overlayType = 2; } } @@ -234,7 +234,7 @@ void sub_08053758(void) { gScreen.bg1.control = 0x1c4e; gScreen.bg2.control = 0x1dc1; SoundReq(BGM_STORY); - ResetSystemPriority(); + ClearEventPriority(); SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } @@ -344,7 +344,7 @@ void sub_08053A1C(void) { } void sub_08053A5C(void) { - if (((gMessage.doTextBox & 0x7f) == 0) && --gMenu.transitionTimer == 0) { + if (((gMessage.state & MESSAGE_ACTIVE) == 0) && --gMenu.transitionTimer == 0) { gMenu.overlayType++; SetFade(FADE_IN_OUT | FADE_INSTANT, 8); } @@ -451,7 +451,7 @@ void sub_08053B74(void) { gMenu.overlayType++; gUpdateVisibleTiles = 1; LoadRoomEntityList(gUnk_080FCDE0); - ResetSystemPriority(); + ClearEventPriority(); ResetEntityPriority(); SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index 873ff039..14c52621 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -247,7 +247,7 @@ void BusinessScrub_Action5(Entity* this) { struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; u32 subtype; - if ((gMessage.doTextBox & 0x7f) == 0 && sub_0802915C(this) && !sub_08056338()) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0 && sub_0802915C(this) && !sub_08056338()) { if (offer->price <= gSave.stats.rupees) { if (BusinessScrub_CheckRefillFitsBag(this)) { /* Bag full. */ @@ -316,11 +316,11 @@ void BusinessScrub_Action6(Entity* this) { } void BusinessScrub_Action7(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; this->action = 4; - this->subAction = gMessage.doTextBox & 0x7f; + this->subAction = gMessage.state & MESSAGE_ACTIVE; this->timer = 1; if (!CheckLocalFlag(offer->local_flag)) { SetLocalFlag(offer->local_flag); diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 2ea26212..e0ebdb24 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -270,7 +270,7 @@ void ChuchuBoss_OnDeath(ChuchuBossEntity* this) { Entity* child; Entity* parent; - sub_08078B48(); + PausePlayer(); if (super->type == 0) { if (super->subAction != 12) { super->subAction = 12; @@ -464,7 +464,7 @@ void sub_08026090(ChuchuBossEntity* this) { } CopyPosition(super->child, super); } else { - sub_08078B48(); + PausePlayer(); if (super->timer-- == 0) { gRoomControls.camera_target = &gPlayerEntity; DeleteThisEntity(); @@ -543,7 +543,7 @@ void sub_0802626C(ChuchuBossEntity* this) { gPauseMenuOptions.disabled = 1; gUnk_080CC20C[this->unk_84->unk_03](this); if (gPlayerEntity.action != PLAYER_ROOMTRANSITION && gPlayerEntity.action != PLAYER_ROOM_EXIT) { - sub_08078B48(); + PausePlayer(); } } @@ -1127,7 +1127,7 @@ void sub_08026E1C(ChuchuBossEntity* this) { } if ((sub_08027C54(this)) && this->unk_84->unk_04 == 2) { sub_08027C7C(this, 0x3f); - sub_08078B48(); + PausePlayer(); } } @@ -1156,7 +1156,7 @@ void sub_08026FA4(ChuchuBossEntity* this) { ChuchuBossEntity* pEVar3; ChuchuBossEntity* pEVar4; - sub_08078B48(); + PausePlayer(); COLLISION_OFF(super); pEVar4 = (ChuchuBossEntity*)super->child; pEVar3 = (ChuchuBossEntity*)super->parent; @@ -1362,7 +1362,7 @@ void sub_080272D4(ChuchuBossEntity* this) { if (sub_08027C54(super->child) == 0 || ((ChuchuBossEntity*)super->child)->unk_84->unk_04 != 2) { SoundReq(SFX_BOSS_HIT); } else { - sub_08078B48(); + PausePlayer(); gRoomControls.camera_target = super->child; gPauseMenuOptions.disabled = 1; gRoomControls.camera_target->subAction = 9; diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index b04a0d24..6773d849 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -145,7 +145,7 @@ void Gleerok(GleerokEntity* this) { } void Gleerok_OnDeath(GleerokEntity* this) { - sub_08078B48(); + PausePlayer(); switch (super->type) { case 2: @@ -420,7 +420,7 @@ void sub_0802D3B8(GleerokEntity* this) { void sub_0802D650(GleerokEntity* this) { #ifdef EU - sub_08078B48(); + PausePlayer(); #endif gUnk_080CD7E4[super->subAction](this); @@ -1014,7 +1014,7 @@ void sub_0802E0B8(GleerokEntity* this) { if (this->unk_79 > 1) { super->health = 0; super->action = 0; - sub_08078B48(); + PausePlayer(); SoundReq(SFX_BOSS_DIE); return; } else { diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c index d8931e9c..7a59d4a9 100644 --- a/src/enemy/octorokBoss.c +++ b/src/enemy/octorokBoss.c @@ -113,17 +113,17 @@ void OctorokBoss_Hit(OctorokBossEntity* this) { if (super->subAction != 3) { gRoomControls.camera_target = &this->heap->tailObjects[0]->base; this->heap->field_0x7 = 0x5a; - sub_08078B48(); + PausePlayer(); } } else { if (this->heap->field_0x7 != 0) { this->heap->field_0x7--; - sub_08078B48(); + PausePlayer(); } } OctorokBoss_Hit_SubActions[super->subAction](this); if (super->subAction > 3) { - sub_08078B48(); + PausePlayer(); } sub_0800445C(super); SetAffineInfo(super, this->unk_76, this->unk_74, this->angle.HWORD); @@ -136,7 +136,7 @@ void OctorokBoss_Hit_SubAction0(OctorokBossEntity* this) { if (this->bossPhase == 4) { super->subAction = 4; gPauseMenuOptions.disabled = 1; - sub_08078B48(); + PausePlayer(); SoundReq(SFX_BOSS_DIE); } else { if (IS_FROZEN(this) == FALSE) { @@ -442,7 +442,7 @@ void OctorokBoss_Intro(OctorokBossEntity* this) { OctorokBoss_Intro_SubAction0, OctorokBoss_Intro_SubAction1, OctorokBoss_Intro_SubAction2, OctorokBoss_Intro_SubAction3, OctorokBoss_Intro_SubAction4, OctorokBoss_Intro_SubAction5, }; - sub_08078B48(); + PausePlayer(); gPauseMenuOptions.disabled = 1; sub_08036F60(this); OctorokBoss_Intro_SubActions[super->subAction](this); @@ -796,7 +796,7 @@ void OctorokBoss_Action1_Attack(OctorokBossEntity* this) { gPlayerEntity.spriteSettings.draw = 0; gPlayerEntity.flags &= ~ENT_COLLIDE; gPlayerEntity.collisionLayer = 2; - sub_08078B48(); + PausePlayer(); PutAwayItems(); gPlayerEntity.parent = super; sub_08036914(&gPlayerEntity, (u8) - (this->angle.HALF.HI + 0x80), 0x3800); diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 6b58c2af..57b830d6 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -547,7 +547,7 @@ void VaatiTransfiguredType0Action7(Entity* this) { Entity* pEVar3; u32 uVar4; - sub_08078B48(); + PausePlayer(); if (this->timer) { if (--this->timer == 0) { SetRoomFlag(2); diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c index f56a6eb0..2d180951 100644 --- a/src/enemy/vaatiTransfiguredEye.c +++ b/src/enemy/vaatiTransfiguredEye.c @@ -99,8 +99,8 @@ void VaatiTransfiguredEyeFunction0Action0(Entity* this) { Entity* child; u8 bVar2; - bVar2 = gMessage.doTextBox & 0x7f; - if ((gMessage.doTextBox & 0x7f) == 0) { + bVar2 = gMessage.state & MESSAGE_ACTIVE; + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; this->spriteSettings.draw = 0; this->field_0x80.HALF.LO = bVar2; diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index 1c4e74ac..20bd4a17 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -634,7 +634,7 @@ void sub_08041D14(Entity* this) { Entity* pEVar1; GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { if (this->timer != 0) { this->timer--; } else { diff --git a/src/enterPortalSubtask.c b/src/enterPortalSubtask.c index 3bac0702..3d445fd6 100644 --- a/src/enterPortalSubtask.c +++ b/src/enterPortalSubtask.c @@ -189,7 +189,7 @@ void Subtask_PortalCutscene_0(void) { gUsedPalettes |= 0x200000; EraseAllEntities(); LoadRoomEntityList(gUnk_080D4110[portalId]); - ResetSystemPriority(); + ClearEventPriority(); gArea.filler3[0]++; SetFade(FADE_INSTANT, 8); } diff --git a/src/entity.c b/src/entity.c index 1a9ac121..b93fa3a3 100644 --- a/src/entity.c +++ b/src/entity.c @@ -89,7 +89,7 @@ void SetEntityPriority(Entity* ent, u32 prio) { ent->updatePriority = prio; } -bool32 EntityIsDeleted(Entity* this) { +bool32 EntityDisabled(Entity* this) { u32 value; if (this->flags & ENT_DELETED) @@ -98,19 +98,19 @@ bool32 EntityIsDeleted(Entity* this) { return FALSE; // pick highest - if (gPriorityHandler.sys_priority > gPriorityHandler.ent_priority) - value = gPriorityHandler.sys_priority; + if (gPriorityHandler.event_priority > gPriorityHandler.ent_priority) + value = gPriorityHandler.event_priority; else value = gPriorityHandler.ent_priority; - if (gMessage.doTextBox & 0x7F) + if (gMessage.state & MESSAGE_ACTIVE) value = max(value, PRIO_MESSAGE); return value > this->updatePriority; } bool32 AnyPrioritySet(void) { - u32 prio = gPriorityHandler.sys_priority; - if (gPriorityHandler.sys_priority <= gPriorityHandler.ent_priority) + u32 prio = gPriorityHandler.event_priority; + if (gPriorityHandler.event_priority <= gPriorityHandler.ent_priority) prio = gPriorityHandler.ent_priority; return prio != PRIO_MIN; } @@ -180,12 +180,12 @@ static void UpdatePriorityTimer(void) { } void SetPlayerEventPriority(void) { - gPriorityHandler.sys_priority = PRIO_PLAYER_EVENT; + gPriorityHandler.event_priority = PRIO_PLAYER_EVENT; gPlayerEntity.updatePriority = PRIO_PLAYER_EVENT; } void ResetPlayerEventPriority(void) { - gPriorityHandler.sys_priority = PRIO_MIN; + gPriorityHandler.event_priority = PRIO_MIN; gPlayerEntity.updatePriority = PRIO_PLAYER; } @@ -195,15 +195,15 @@ void RevokePriority(Entity* e) { } void SetRoomReloadPriority(void) { - gPriorityHandler.sys_priority = PRIO_PLAYER_EVENT; + gPriorityHandler.event_priority = PRIO_PLAYER_EVENT; } void SetInitializationPriority(void) { - gPriorityHandler.sys_priority = PRIO_HIGHEST; + gPriorityHandler.event_priority = PRIO_HIGHEST; } -void ResetSystemPriority(void) { - gPriorityHandler.sys_priority = PRIO_MIN; +void ClearEventPriority(void) { + gPriorityHandler.event_priority = PRIO_MIN; } void UpdateEntities(void) { diff --git a/src/game.c b/src/game.c index e1a0822f..84b99bc8 100644 --- a/src/game.c +++ b/src/game.c @@ -208,7 +208,7 @@ static void GameMain_ChangeRoom(void) { return; UpdatePlayerMapCoords(); - ResetSystemPriority(); + ClearEventPriority(); UpdateWindcrests(); sub_080300C4(); gMain.substate = GAMEMAIN_UPDATE; @@ -252,8 +252,8 @@ static void GameMain_Update(void) { return; } - if ((gMessage.doTextBox & 0x7f) || gPriorityHandler.priority_timer != 0) - sub_08078B48(); + if ((gMessage.state & MESSAGE_ACTIVE) || gPriorityHandler.priority_timer != 0) + PausePlayer(); FlushSprites(); UpdateEntities(); @@ -305,7 +305,7 @@ static void GameMain_BarrelUpdate(void) { CheckGameOver(); CopyOAM(); if (!gFadeControl.active) - ResetSystemPriority(); + ClearEventPriority(); } static void GameMain_ChangeArea(void) { diff --git a/src/interrupts.c b/src/interrupts.c index 69a0f137..44b59a73 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -204,7 +204,7 @@ void PlayerUpdate(Entity* this) { else gPlayerState.flags &= ~PL_DRUGGED; - if (!EntityIsDeleted(this)) { + if (!EntityDisabled(this)) { if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) { PutAwayItems(); if (gPlayerState.flags & PL_MOLDWORM_RELEASED) { @@ -258,7 +258,7 @@ static void HandlePlayerLife(Entity* this) { return; } - if ((gPlayerState.controlMode != CONTROL_ENABLED) || (gMessage.doTextBox & 0x7f)) + if ((gPlayerState.controlMode != CONTROL_ENABLED) || (gMessage.state & 0x7f)) return; #ifdef EU @@ -274,7 +274,7 @@ static void HandlePlayerLife(Entity* this) { } } #else - gRoomVars.unk2 = gMessage.doTextBox & 0x7f; + gRoomVars.unk2 = gMessage.state & MESSAGE_ACTIVE; temp = gSave.stats.maxHealth / 4; if (temp > 24) temp = 24; diff --git a/src/manager.c b/src/manager.c index 338d2d7d..6c649a9c 100644 --- a/src/manager.c +++ b/src/manager.c @@ -61,6 +61,6 @@ void (*const gMiscManagerunctions[])() = { NULL, EnterRoomTextboxManager_Main }; void ManagerUpdate(Entity* this) { - if (!EntityIsDeleted(this)) + if (!EntityDisabled(this)) gMiscManagerunctions[this->id](this); } diff --git a/src/manager/enterRoomTextboxManager.c b/src/manager/enterRoomTextboxManager.c index a720a788..61276437 100644 --- a/src/manager/enterRoomTextboxManager.c +++ b/src/manager/enterRoomTextboxManager.c @@ -34,7 +34,7 @@ void sub_0805E1F8(u32, bool32); void EnterRoomTextboxManager_Main(EnterRoomTextboxManager* this) { EnterRoomTextboxManager_Actions[super->action](this); - if ((gRoomControls.room != this->unk_20) || (gMessage.doTextBox & 0x7F)) { + if ((gRoomControls.room != this->unk_20) || (gMessage.state & MESSAGE_ACTIVE)) { sub_0805E1D8(this); } } @@ -56,7 +56,7 @@ void sub_0805E18C(EnterRoomTextboxManager* this) { if (--super->subtimer == 0) { super->type2 = 0; gPlayerState.controlMode = CONTROL_1; - ResetSystemPriority(); + ClearEventPriority(); } } if (--super->timer == 0) { diff --git a/src/manager/entitySpawnManager.c b/src/manager/entitySpawnManager.c index 900b6480..6303d998 100644 --- a/src/manager/entitySpawnManager.c +++ b/src/manager/entitySpawnManager.c @@ -26,7 +26,7 @@ void EntitySpawnManager_Main(EntitySpawnManager* this) { if (super->type2 != 0) { super->type2 = 0; SetPlayerControl(0xff); - sub_08078B48(); + PausePlayer(); } if (this->spawnTimer == 0) { if (this->sound != 0) { diff --git a/src/manager/ezloHintManager.c b/src/manager/ezloHintManager.c index f98b97f3..4f6a2723 100644 --- a/src/manager/ezloHintManager.c +++ b/src/manager/ezloHintManager.c @@ -69,7 +69,7 @@ static void EzloHintManager_Action2(EzloHintManager* this) { if (!PlayerStateValid(this)) return; SetPlayerControl(3); - sub_08078B48(); + PausePlayer(); SetPlayerEventPriority(); super->action = 3; super->subAction = 0; diff --git a/src/manager/lightManager.c b/src/manager/lightManager.c index c8d8241d..c34c4755 100644 --- a/src/manager/lightManager.c +++ b/src/manager/lightManager.c @@ -20,8 +20,8 @@ extern void sub_0801E120(void); extern void sub_0801E154(u32); extern void sub_0801E160(u32, u32, u32); -bool32 sub_0805BA78(); -void sub_0805BAD4(); +bool32 LerpLightLevel(); +void UpdateLightAlpha(); void LightManager_Main(LightManager* this) { s32 sVar1; @@ -43,8 +43,8 @@ void LightManager_Main(LightManager* this) { } if (gMain.substate == GAMEMAIN_UPDATE) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - sub_0805BA78(); - sub_0805BAD4(); + LerpLightLevel(); + UpdateLightAlpha(); } if (gArea.lightType == 2) { gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON; @@ -87,44 +87,33 @@ void LightManager_Main(LightManager* this) { #define ABS(x) ((unsigned)(x < 0 ? -(x) : x)) -bool32 sub_0805BA78() { - u32 uVar1; - s32 iVar1; - s32 iVar2; +bool32 LerpLightLevel() { + s32 tgt; + s32 cur; - iVar2 = (short)gArea.lightLevel; - iVar1 = gRoomVars.lightLevel; + cur = (short)gArea.lightLevel; + tgt = gRoomVars.lightLevel; - if (iVar1 < 0) { - iVar1 = 0; - } + tgt = max(tgt, 0); + tgt = min(tgt, 0x100); - if (0x100 < iVar1) { - iVar1 = 0x100; - } - - if (iVar2 != iVar1) { - if (ABS(iVar1 - iVar2) <= 4) { - iVar2 = iVar1; - } else { - if (iVar1 < iVar2) { - iVar2 = iVar2 - 4; - } else { - if (iVar1 > iVar2) { - iVar2 = iVar2 + 4; - } - } + if (cur != tgt) { + if (ABS(tgt - cur) <= 4) { + cur = tgt; + } else if (tgt < cur) { + cur -= 4; + } else if (tgt > cur) { + cur += 4; } - gArea.lightLevel = iVar2; - } else { - return FALSE; + gArea.lightLevel = cur; + return TRUE; } - return TRUE; + return FALSE; } extern u16 gUnk_08108CA8[]; -void sub_0805BAD4() { +void UpdateLightAlpha() { static const u16 gUnk_08108CA8[] = { 0x10, 0x10f, 0x20e, 0x30d, 0x40c, 0x50b, 0x60a, 0x709, 0x808, 0x907, 0xa06, 0xb05, 0xc04, 0xd03, 0xe02, 0xf01, 0x1000, 0x00 }; if (gArea.lightType != 0) { @@ -164,8 +153,8 @@ void sub_0805BB74(s32 lightLevel) { if (manager) { LightManager_Main(manager); gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - sub_0805BA78(); - sub_0805BAD4(); + LerpLightLevel(); + UpdateLightAlpha(); } } @@ -175,9 +164,9 @@ bool32 UpdateLightLevel() { iVar1 = FALSE; if (gArea.lightType && gRoomVars.lightLevel < (s16)gArea.lightLevel) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - iVar1 = sub_0805BA78(); + iVar1 = LerpLightLevel(); if (iVar1) { - sub_0805BAD4(); + UpdateLightAlpha(); } } return iVar1; @@ -189,9 +178,9 @@ s32 sub_0805BC04(void) { iVar1 = 0; if (gArea.lightType && gRoomVars.lightLevel > (short)gArea.lightLevel) { gScreen.lcd.displayControl |= DISPCNT_BG3_ON; - iVar1 = sub_0805BA78(); + iVar1 = LerpLightLevel(); if (iVar1) { - sub_0805BAD4(); + UpdateLightAlpha(); } } return iVar1; diff --git a/src/manager/vaati3StartManager.c b/src/manager/vaati3StartManager.c index 6d1c666d..c30c1e4b 100644 --- a/src/manager/vaati3StartManager.c +++ b/src/manager/vaati3StartManager.c @@ -70,7 +70,7 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) { super->subAction = 0; super->timer = 120; SetPlayerControl(2); - sub_08078B48(); + PausePlayer(); object = CreateObject(THUNDERBOLT, 0, 0); if (object != NULL) { object->x.HALF.HI = gRoomControls.origin_x + 0x88; @@ -100,7 +100,7 @@ void Vaati3StartManager_Type0_Action2(Vaati3StartManager* this) { } void Vaati3StartManager_Type0_Action3(Vaati3StartManager* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { if (super->timer != 0) { super->timer--; } else { diff --git a/src/menu/kinstoneMenu.c b/src/menu/kinstoneMenu.c index b41d3707..cfc0473a 100644 --- a/src/menu/kinstoneMenu.c +++ b/src/menu/kinstoneMenu.c @@ -331,7 +331,7 @@ void KinstoneMenu_Type5_Overlay0(void) { } void KinstoneMenu_Type5_Overlay1(void) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { gMenu.overlayType = 2; SoundReq(SFX_147); } diff --git a/src/message.c b/src/message.c index 165c58d1..87d6e461 100644 --- a/src/message.c +++ b/src/message.c @@ -49,7 +49,7 @@ static void StatusUpdate(u32 status); static void SwitchChoice(u32 to, u32 from); static void MsgChangeLine(u32 lineNo); -static void SetDoTextBox(u32 doTextbox); +static void SetState(u32 status); static void DeleteWindow(void); static u32 ChangeWindowSize(u32 delta); @@ -122,14 +122,14 @@ s32 sub_08056338(void) { s32 result; result = -1; - if (((gMessage.doTextBox & 0x7f) == 0) && (gUnk_02000040.unk_00 == 3)) + if (((gMessage.state & MESSAGE_ACTIVE) == 0) && (gUnk_02000040.unk_00 == 3)) result = gUnk_02000040.unk_01; return result; } void MessageClose(void) { - if ((gMessage.doTextBox & 0x7f) != 0) { - gMessage.doTextBox = 0x88; + if (gMessage.state & MESSAGE_ACTIVE) { + gMessage.state = 0x88; } } @@ -173,7 +173,7 @@ void MessageRequest(u32 index) { gMessage.textWindowHeight = 4; gMessage.textWindowPosX = 1; gMessage.textWindowPosY = 12; - gMessage.doTextBox = 1; + gMessage.state = 1; } void MessageInitialize(void) { @@ -190,7 +190,7 @@ void MessageMain(void) { [MSG_OPEN] = MsgOpen, [MSG_CLOSE] = MsgClose, [MSG_DIE] = MsgDie, }; - if (gMessage.doTextBox == 1) { + if (gMessage.state == 1) { MemClear((u32*)&gTextRender, sizeof(gTextRender)); StatusUpdate(MSG_INIT); } @@ -258,7 +258,7 @@ u32 MsgInit(void) { gTextRender.curToken._c = &gUnk_08107BE0; gTextRender._50.unk8 = gTextGfxBuffer; gTextRender._50.unk4 = 0xd0; - SetDoTextBox(2); + SetState(2); MsgChangeLine(0); StatusUpdate(MSG_UPDATE); return 1; @@ -295,7 +295,7 @@ static u32 MsgClose(void) { } static u32 MsgDie(void) { - SetDoTextBox(0); + SetState(0); StatusUpdate(MSG_IDLE); return 0; } @@ -306,7 +306,7 @@ static u32 MsgUpdate(void) { [RENDER_WAIT] = TextDispWait, [RENDER_ROLL] = TextDispRoll, [RENDER_ENQUIRY] = TextDispEnquiry, }; - SetDoTextBox(4); + SetState(4); gTextDispFunctions[gTextRender.renderStatus](&gTextRender); ChangeWindowSize(0); return 0; @@ -604,7 +604,7 @@ static void TextDispRoll(TextRender* this) { static void TextDispDie(TextRender* this) { gMessage.unk = 0; - SetDoTextBox(7); + SetState(7); if ((this->_8e != 1) && (this->_8e == 2 || MESSAGE_PRESS_ANY_ADVANCE_KEYS)) { StatusUpdate(MSG_CLOSE); } @@ -628,8 +628,8 @@ static void MsgChangeLine(u32 lineNo) { PaletteChange(&gTextRender, gTextRender._8f | 0x40); } -static void SetDoTextBox(u32 doTextbox) { - gMessage.doTextBox = gTextRender.message.doTextBox = doTextbox; +static void SetState(u32 status) { + gMessage.state = gTextRender.message.state = status; } static void DeleteWindow(void) { diff --git a/src/npc.c b/src/npc.c index 94896d5e..1609e901 100644 --- a/src/npc.c +++ b/src/npc.c @@ -14,7 +14,7 @@ void NPCUpdate(Entity* this) { DeleteThisEntity(); if (this->action == 0 && (this->flags & ENT_DID_INIT) == 0) NPCInit(this); - if (!EntityIsDeleted(this)) + if (!EntityDisabled(this)) gNPCFunctions[this->id][0](this); if (this->next != NULL) { if (gNPCFunctions[this->id][1] != NULL) diff --git a/src/npc/beedle.c b/src/npc/beedle.c index 38bcb381..07a3d0fc 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -94,7 +94,7 @@ void Beedle_Action1(Entity* this) { } void Beedle_Action2(Entity* this) { - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action++; InitializeAnimation(this, 8); } diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index 0767433b..ce6d1bab 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -266,7 +266,7 @@ void sub_0806D274(BigGoronEntity* this) { case 0: case 1: default: - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->frameIndex = 2; break; } diff --git a/src/npc/brocco.c b/src/npc/brocco.c index 9236bb60..ea14ac04 100644 --- a/src/npc/brocco.c +++ b/src/npc/brocco.c @@ -72,7 +72,7 @@ void sub_08063584(Entity* this) { } void sub_08063608(Entity* this) { - u8 tmp = gMessage.doTextBox & 0x7f; + u8 tmp = gMessage.state & MESSAGE_ACTIVE; if (tmp == 0) { this->action = 1; this->subtimer = tmp; diff --git a/src/npc/castleMaid.c b/src/npc/castleMaid.c index 2001f0d2..f5e888e3 100644 --- a/src/npc/castleMaid.c +++ b/src/npc/castleMaid.c @@ -99,7 +99,7 @@ void sub_08064570(CastleMaidEntity* this) { } break; case 2: - if ((gMessage.doTextBox & 0x7f) != 0) { + if ((gMessage.state & MESSAGE_ACTIVE) != 0) { return; } super->action = 1; diff --git a/src/npc/cat.c b/src/npc/cat.c index d2f42aec..eb364e8f 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -219,7 +219,7 @@ void sub_0806797C(CatEntity* this) { void sub_0806799C(CatEntity* this) { UpdateAnimationSingleFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { sub_08067B08(this); SetEntityPriority(super, PRIO_PLAYER); } diff --git a/src/npc/epona.c b/src/npc/epona.c index 91bfc6de..a852af99 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -54,7 +54,7 @@ void sub_08065A00(EponaEntity* this) { } void sub_08065A10(EponaEntity* this) { - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; InitAnimationForceUpdate(super, super->animationState / 2); } diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c index 9458205b..6628b572 100644 --- a/src/npc/ghostBrothers.c +++ b/src/npc/ghostBrothers.c @@ -162,7 +162,7 @@ void sub_08065D74(GhostBrothersEntity* this) { void sub_08065DB8(GhostBrothersEntity* this) { switch (super->subAction) { case 0: { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->subAction++; super->timer = 60; InitAnimationForceUpdate(super, 4); @@ -188,7 +188,7 @@ void sub_08065DB8(GhostBrothersEntity* this) { break; } case 4: { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->subAction++; super->timer = 30; this->unk_6c = gUnk_0811022E; diff --git a/src/npc/goron.c b/src/npc/goron.c index 6ed59d26..422fe6cc 100644 --- a/src/npc/goron.c +++ b/src/npc/goron.c @@ -72,7 +72,7 @@ void sub_08069328(Entity* this) { void sub_08069390(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; this->interactType = INTERACTION_NONE; RevokePriority(this); diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c index 24bb04e7..2f497dff 100644 --- a/src/npc/goronMerchant.c +++ b/src/npc/goronMerchant.c @@ -57,9 +57,9 @@ void sub_080695AC(Entity* this) { void sub_080695E8(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; - this->interactType = gMessage.doTextBox & 0x7f; + this->interactType = gMessage.state & MESSAGE_ACTIVE; RevokePriority(this); InitAnimationForceUpdate(this, this->animationState); } diff --git a/src/npc/guard.c b/src/npc/guard.c index cb1b7060..617d5d13 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -346,7 +346,7 @@ void sub_08063E54(Entity* this) { } void sub_08063E6C(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; InitializeAnimation(this, this->animationState + 4); } @@ -397,7 +397,7 @@ void sub_08063F20(GuardEntity* this) { } void sub_08063F78(GuardEntity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = super->action - 1; InitializeAnimation(super, (super->animationState >> 1) + 4 + this->unk_70); } diff --git a/src/npc/kid.c b/src/npc/kid.c index 957b4426..70e94ee3 100644 --- a/src/npc/kid.c +++ b/src/npc/kid.c @@ -319,7 +319,7 @@ void sub_080621AC(KidEntity* this) { break; case 2: GetNextFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; } break; diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c index baf3e231..6f68a069 100644 --- a/src/npc/mountainMinish.c +++ b/src/npc/mountainMinish.c @@ -150,7 +150,7 @@ void sub_08067EF0(MountainMinishEntity* this) { } break; case 2: - if ((gMessage.doTextBox & 0x7f) != 0) + if ((gMessage.state & MESSAGE_ACTIVE) != 0) break; super->action = 1; InitializeAnimation(super, (super->animationState >> 1) + 4); diff --git a/src/npc/npc23.c b/src/npc/npc23.c index e3dab558..51ef213e 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -101,7 +101,7 @@ void sub_080663D4(NPC23Entity* this) { } ProcessMovement0(super); } - sub_08078B48(); + PausePlayer(); GetNextFrame(super); } diff --git a/src/npc/npc9.c b/src/npc/npc9.c index 6e66716b..71a45f04 100644 --- a/src/npc/npc9.c +++ b/src/npc/npc9.c @@ -51,7 +51,7 @@ void sub_08062B48(Entity* this) { } void sub_08062B70(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { InitializeAnimation(this, 2); this->action = 1; RevokePriority(this); diff --git a/src/npc/percy.c b/src/npc/percy.c index 5c6108cd..c0d0eac2 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -149,13 +149,13 @@ void sub_0806B540(Entity* this) { SetLocalFlag(0x3f); break; case 1: - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { context->unk_18 = 2; MessageNoOverlap(TEXT_INDEX(TEXT_PERCY, 0x15), this); } break; case 2: - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { context->unk_18 = 3; if (gSave.stats.hasAllFigurines != 0) { InitItemGetSequence(ITEM_RUPEE100, 0, 0); diff --git a/src/npc/pina.c b/src/npc/pina.c index cb73eabc..a7a2448d 100644 --- a/src/npc/pina.c +++ b/src/npc/pina.c @@ -74,7 +74,7 @@ void sub_08063AC0(Entity* this) { } void sub_08063B44(Entity* this) { - u8 tmp = gMessage.doTextBox & 0x7f; + u8 tmp = gMessage.state & MESSAGE_ACTIVE; if (tmp == 0) { this->action = 1; this->subtimer = tmp; diff --git a/src/npc/postman.c b/src/npc/postman.c index 12711abc..1ae6aa81 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -273,7 +273,7 @@ void sub_08060528(PostmanEntity* this) { break; case 2: UpdateAnimationSingleFrame(super); - if ((gMessage.doTextBox & 0x7f) != 0) { + if ((gMessage.state & MESSAGE_ACTIVE) != 0) { break; } super->action = 1; diff --git a/src/npc/stamp.c b/src/npc/stamp.c index 380e5be4..59322c18 100644 --- a/src/npc/stamp.c +++ b/src/npc/stamp.c @@ -64,7 +64,7 @@ void sub_08062C24(Entity* this) { } void sub_08062C54(Entity* this) { - if ((gMessage.doTextBox & 127) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; InitializeAnimation(this, 0); RevokePriority(this); diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index 68d63b46..2c9dbe00 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -108,8 +108,8 @@ void sub_080650CC(StockwellEntity* this) { void sub_080651AC(StockwellEntity* this) { GetNextFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { - super->interactType = gMessage.doTextBox & 0x7f; + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { + super->interactType = gMessage.state & MESSAGE_ACTIVE; super->action = 1; InitializeAnimation(super, 4); } @@ -164,7 +164,7 @@ void sub_0806528C(Entity* this) { } void sub_080652B0(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->subAction++; this->timer = 10; gRoomVars.animFlags = this->subtimer; @@ -184,16 +184,16 @@ void sub_080652E4(Entity* this) { } void sub_08065314(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->subAction++; MenuFadeIn(3, 3); } } void sub_08065338(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; - this->subAction = gMessage.doTextBox & 0x7f; + this->subAction = gMessage.state & MESSAGE_ACTIVE; gRoomVars.animFlags = this->subtimer; InitializeAnimation(this, 4); } diff --git a/src/npc/sturgeon.c b/src/npc/sturgeon.c index 6367bf76..4ba1906e 100644 --- a/src/npc/sturgeon.c +++ b/src/npc/sturgeon.c @@ -127,7 +127,7 @@ void sub_08064B88(SturgeonEntity* this) { } void sub_08064C2C(SturgeonEntity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; InitializeAnimation(super, (u32)super->subtimer); } diff --git a/src/npc/talon.c b/src/npc/talon.c index 4b62dd22..7a93007e 100644 --- a/src/npc/talon.c +++ b/src/npc/talon.c @@ -119,7 +119,7 @@ void sub_08065680(TalonEntity* this) { } void sub_080656A4(TalonEntity* this) { - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = this->unk_69; InitAnimationForceUpdate(super, this->unk_6a); } diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index d818f4fa..e8914c76 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -250,7 +250,7 @@ void sub_0806ACC4(TownMinishEntity* this) { } break; case 2: - if (gMessage.doTextBox & 0x7f) + if (gMessage.state & MESSAGE_ACTIVE) break; super->action = 1; diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index 9feb45ea..593c3160 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -153,7 +153,7 @@ void sub_08061D64(TownspersonEntity* this) { void sub_08061E24(TownspersonEntity* this) { GetNextFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; InitializeAnimation(super, this->unk_69); } diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c index 41eb3567..ef37526f 100644 --- a/src/npc/windTribespeople.c +++ b/src/npc/windTribespeople.c @@ -78,7 +78,7 @@ void sub_0806C7D4(Entity* this) { } void sub_0806C834(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { --this->action; InitializeAnimation(this, (this->animationState / 2) + 4); } diff --git a/src/object.c b/src/object.c index 58806614..8f23887e 100644 --- a/src/object.c +++ b/src/object.c @@ -205,7 +205,7 @@ void ObjectUpdate(Entity* this) { ObjectInit(this); if (this->iframes != 0) this->iframes++; - if (!EntityIsDeleted(this)) { + if (!EntityDisabled(this)) { gObjectFunctions[this->id](this); this->contactFlags &= ~0x80; } diff --git a/src/object/bird.c b/src/object/bird.c index 2b4b0dac..485c0695 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -225,7 +225,7 @@ void Bird_Type8(BirdEntity* this) { super->speed = 0x300; } - if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.doTextBox & 0x7f) == 0 && + if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.state & MESSAGE_ACTIVE) == 0 && gPlayerEntity.action != PLAYER_SLEEP && gPlayerEntity.action != PLAYER_BOUNCE && gPlayerEntity.action != PLAYER_MINISH && gPlayerState.framestate != PL_STATE_CLIMB && gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_PARACHUTE && @@ -240,21 +240,21 @@ void Bird_Type8(BirdEntity* this) { super->speed = 0x300; this->gravity = Q_8_8(-32.0); PlayerDropHeldObject(); - sub_08078B48(); + PausePlayer(); ResetPlayerAnimationAndAction(); PutAwayItems(); gPlayerState.swim_state = 0; gPlayerState.jump_status = 0; gPlayerEntity.flags &= ~0x80; gPlayerEntity.spriteSettings.draw = 0; - gPriorityHandler.sys_priority = 6; + gPriorityHandler.event_priority = 6; gPauseMenuOptions.disabled = 1; } } } break; default: - sub_08078B48(); + PausePlayer(); gPlayerEntity.spriteSettings.draw = 0; break; } @@ -313,7 +313,7 @@ void Bird_Type9(BirdEntity* this) { SoundReq(SFX_123); super->spritePriority.b1 = 2; InitAnimationForceUpdate(super, 0); - sub_08078B48(); + PausePlayer(); } else if (super->action == 1) { gPlayerEntity.spriteSettings.draw = 0; child = super->child; @@ -324,7 +324,7 @@ void Bird_Type9(BirdEntity* this) { child->spriteRendering.b3 = super->spriteRendering.b3; child->spriteOrientation.flipY = super->spriteOrientation.flipY; } - sub_08078B48(); + PausePlayer(); if (gRoomControls.scroll_x + 0x78 < super->x.HALF.HI) { super->action++; super->spritePriority.b1 = 1; diff --git a/src/object/book.c b/src/object/book.c index 36f76c6a..4ebd3f7d 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -208,10 +208,10 @@ void Book_Action5(BookEntity* this) { break; } case 1: { - u8 doTextBox = gMessage.doTextBox & 0x7f; - if (!doTextBox) { + u8 status = gMessage.state & MESSAGE_ACTIVE; + if (!status) { super->spriteSettings.draw = 1; - super->subAction = doTextBox; + super->subAction = status; } break; } diff --git a/src/object/bush.c b/src/object/bush.c index e12d3883..857e63f7 100644 --- a/src/object/bush.c +++ b/src/object/bush.c @@ -38,7 +38,7 @@ void Bush(BushEntity* this) { Bush_Action1, Bush_Action2, }; - if (!EntityIsDeleted(super)) { + if (!EntityDisabled(super)) { Bush_Actions[super->action](this); } } diff --git a/src/object/cameraTarget.c b/src/object/cameraTarget.c index e19d0499..e21b2f7d 100644 --- a/src/object/cameraTarget.c +++ b/src/object/cameraTarget.c @@ -53,7 +53,7 @@ void CameraTarget(Entity* this) { case FUSION_STATE_0: case FUSION_STATE_1: case FUSION_STATE_2: - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { break; } default: diff --git a/src/object/cloud.c b/src/object/cloud.c index 1252aca6..9f99213d 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -104,7 +104,7 @@ void sub_0809F5F0(CloudEntity* this) { super->action = 2; super->timer = 120; SetPlayerControl(3); - sub_08078B48(); + PausePlayer(); gRoomControls.camera_target = super; } } diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index 74db801c..7480ba07 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -266,7 +266,7 @@ void CrenelBeanSprout_Action6(CrenelBeanSproutEntity* this) { CrenelBeanSprout_Action6SubAction2, }; if (super->subAction != 2) { - sub_08078B48(); + PausePlayer(); } CrenelBeanSprout_Action6SubActions[super->subAction](this); } diff --git a/src/object/cutsceneMiscObject.c b/src/object/cutsceneMiscObject.c index 00fdc5e7..44fc603f 100644 --- a/src/object/cutsceneMiscObject.c +++ b/src/object/cutsceneMiscObject.c @@ -457,7 +457,7 @@ void CutsceneMiscObject_Type7(CutsceneMiscObjectEntity* this) { } break; case 2: - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { CreateItemEntity(ITEM_JABBERNUT, 0, 0); DeleteThisEntity(); } diff --git a/src/object/ezloCap.c b/src/object/ezloCap.c index 6465dad9..4c7f39bb 100644 --- a/src/object/ezloCap.c +++ b/src/object/ezloCap.c @@ -81,11 +81,11 @@ void EzloCap_Type0Action1(EzloCapEntity* this) { static const u8 gUnk_0811F16C[] = { 4, 0, 2, 6, 10, 8, 9, 5, 1, 0, 0, 0 }; u32 tmp = gPlayerEntity.palette.b.b0; super->palette.b.b0 = tmp; - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { DeleteEntity(super); return; } - if ((gMessage.doTextBox & 0x7f) != 5) { + if ((gMessage.state & MESSAGE_ACTIVE) != 5) { if (((gMessage.unk == 0xa) || (gMessage.unk == 0)) || ((gMessage.unk & 0xf) > 9)) { if (super->animIndex != (super->subtimer | 3)) { InitAnimationForceUpdate(super, super->subtimer | 3); diff --git a/src/object/fourElements.c b/src/object/fourElements.c index 1c3942ea..bb99e701 100644 --- a/src/object/fourElements.c +++ b/src/object/fourElements.c @@ -138,7 +138,7 @@ void FourElements_Action5(FourElementsEntity* this) { void FourElements_Action6(FourElementsEntity* this) { RequestPriorityDuration(NULL, 10); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { SetPriorityTimer(90); gPlayerState.controlMode = 1; EnablePauseMenu(); diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c index 540a85dd..089436dc 100644 --- a/src/object/frozenOctorok.c +++ b/src/object/frozenOctorok.c @@ -267,7 +267,7 @@ void FrozenOctorok_Action1SubAction0(FrozenOctorokEntity* this) { void FrozenOctorok_Action1SubAction1(FrozenOctorokEntity* this) { Entity* obj; - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { if (this->unk_79-- == 0) { obj = CreateObjectWithParent(super, FROZEN_OCTOROK, 7, 0); if (obj != NULL) { diff --git a/src/object/gleerokParticle.c b/src/object/gleerokParticle.c index 5595ccda..67efcb36 100644 --- a/src/object/gleerokParticle.c +++ b/src/object/gleerokParticle.c @@ -82,7 +82,7 @@ void GleerokParticle_Init(GleerokParticleEntity* this) { DeleteThisEntity(); } } - sub_08078B48(); + PausePlayer(); return; case 0: super->direction = gUnk_081229D0[super->type2].direction; diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index 9a87f5c6..0106fb63 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -96,7 +96,7 @@ void ItemForSale_Action1(ItemForSaleEntity* this) { if (super->interactType != INTERACTION_NONE) { super->interactType = INTERACTION_NONE; super->subAction = 1; - sub_08078B48(); + PausePlayer(); ResetActiveItems(); gPlayerState.heldObject = 4; gNewPlayerEntity.unk_74 = super; diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 5c1e9949..5571ca47 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -325,7 +325,7 @@ void LilypadLarge_Action2(LilypadLargeEntity* this) { }; subActionFuncs[super->subAction](this); gPlayerState.flags |= PL_FLAGS2; - sub_08078B48(); + PausePlayer(); } void sub_08085A44(LilypadLargeEntity* this) { @@ -460,7 +460,7 @@ void sub_08085D28(LilypadLargeEntity* this) { (GetRelativeCollisionTile(super, 0, 0x18) == 0x11)) { super->action = 2; super->subAction = 0; - sub_08078B48(); + PausePlayer(); } } diff --git a/src/object/linkAnimation.c b/src/object/linkAnimation.c index c811373c..5f790559 100644 --- a/src/object/linkAnimation.c +++ b/src/object/linkAnimation.c @@ -93,7 +93,7 @@ void LinkAnimation_ItemGet(LinkAnimationEntity* this) { break; case ITEMGET_WAIT: UpdateAnimationSingleFrame(super); - if ((gMessage.doTextBox & 0x7f) != 0) { + if ((gMessage.state & MESSAGE_ACTIVE) != 0) { return; } if (super->frame & ANIM_DONE) { diff --git a/src/object/moleMittsParticle.c b/src/object/moleMittsParticle.c index 93a0379c..02f3e72e 100644 --- a/src/object/moleMittsParticle.c +++ b/src/object/moleMittsParticle.c @@ -18,7 +18,7 @@ void MoleMittsParticle(Entity* this) { MoleMittsParticle_Init, MoleMittsParticle_Action1, }; - if (!EntityIsDeleted(this)) { + if (!EntityDisabled(this)) { MoleMittsParticle_Actions[this->action](this); } } diff --git a/src/object/octorokBossObject.c b/src/object/octorokBossObject.c index 4619d170..1410d0d1 100644 --- a/src/object/octorokBossObject.c +++ b/src/object/octorokBossObject.c @@ -316,7 +316,7 @@ void OctorokBossObject_Action1(OctorokBossObjectEntity* this) { } break; case 9: - sub_08078B48(); + PausePlayer(); if ((this->unk_78.WORD_U)-- == 0) { gRoomControls.camera_target = &gPlayerEntity; DeleteThisEntity(); diff --git a/src/object/well.c b/src/object/well.c index 8b26a476..ed033493 100644 --- a/src/object/well.c +++ b/src/object/well.c @@ -40,7 +40,7 @@ void Well_Init(WellEntity* this) { void Well_Action1(WellEntity* this) { u32 tileIndex = GetTileType(this->unk_80, 1); if (tileIndex != 0x407D) { - sub_08078B48(); + PausePlayer(); gPlayerEntity.x.WORD = super->x.WORD; gPlayerEntity.y.HALF.HI = super->y.HALF.HI + 4; DeleteThisEntity(); diff --git a/src/object/windTribeTeleporter.c b/src/object/windTribeTeleporter.c index 997a91d0..fd785ab9 100644 --- a/src/object/windTribeTeleporter.c +++ b/src/object/windTribeTeleporter.c @@ -21,7 +21,7 @@ void WindTribeTeleporter_Action1(WindTribeTeleporterEntity*); void WindTribeTeleporter_Action2(WindTribeTeleporterEntity*); void WindTribeTeleporter_Action3(WindTribeTeleporterEntity*); void sub_080A11E0(WindTribeTeleporterEntity*); -bool32 sub_080A11C0(WindTribeTeleporterEntity*); +static bool32 PlayerCollidingTeleporter(WindTribeTeleporterEntity*); void WindTribeTeleporter(WindTribeTeleporterEntity* this) { static void (*const WindTribeTeleporter_Actions[])(WindTribeTeleporterEntity*) = { @@ -40,11 +40,11 @@ void WindTribeTeleporter_Init(WindTribeTeleporterEntity* this) { super->spritePriority.b0 = 7; super->hitbox = (Hitbox*)&gHitbox_22; SetEntityPriority(super, 6); - if (sub_080A11C0(this)) { + if (PlayerCollidingTeleporter(this)) { gPlayerEntity.x.HALF.HI = super->x.HALF.HI; gPlayerEntity.y.HALF.HI = super->y.HALF.HI; SetPlayerControl(CONTROL_DISABLED); - sub_08078B48(); + PausePlayer(); SetPlayerEventPriority(); SoundReq(SFX_112); super->action = 3; @@ -54,12 +54,12 @@ void WindTribeTeleporter_Init(WindTribeTeleporterEntity* this) { } void WindTribeTeleporter_Action1(WindTribeTeleporterEntity* this) { - if (sub_080A11C0(this)) { + if (PlayerCollidingTeleporter(this)) { if (this->unk_68 == 0) { gPlayerEntity.x.HALF.HI = super->x.HALF.HI; gPlayerEntity.y.HALF.HI = super->y.HALF.HI; SetPlayerControl(CONTROL_DISABLED); - sub_08078B48(); + PausePlayer(); SetPlayerEventPriority(); SoundReq(SFX_112); super->action = 2; @@ -177,7 +177,7 @@ void WindTribeTeleporter_Action3(WindTribeTeleporterEntity* this) { } } -bool32 sub_080A11C0(WindTribeTeleporterEntity* this) { +static bool32 PlayerCollidingTeleporter(WindTribeTeleporterEntity* this) { if (gPlayerEntity.z.HALF.HI != 0) { return FALSE; } else { diff --git a/src/objectUtils.c b/src/objectUtils.c index 254be88f..e3db7806 100644 --- a/src/objectUtils.c +++ b/src/objectUtils.c @@ -42,7 +42,7 @@ Entity* CreateLinkAnimation(Entity* parent, u32 type, u32 type2) { AppendEntityToList(e, 6); PrependEntityToList(e, 6); CopyPosition(&gPlayerEntity, e); - gPriorityHandler.sys_priority = 6; + gPriorityHandler.event_priority = 6; gPauseMenuOptions.disabled = 1; // store player state diff --git a/src/player.c b/src/player.c index 90a10af1..bb2b14f9 100644 --- a/src/player.c +++ b/src/player.c @@ -280,7 +280,7 @@ extern ScriptExecutionContext gPlayerScriptExecutionContext; bool32 CheckInitPauseMenu(void) { u32 framestate; if (((gInput.newKeys & START_BUTTON) == 0 || gFadeControl.active || gPauseMenuOptions.disabled || - (gMessage.doTextBox & 0x7F) || gSave.stats.health == 0 || !gSave.inventory[0] || + (gMessage.state & MESSAGE_ACTIVE) || gSave.stats.health == 0 || !gSave.inventory[0] || gPlayerState.controlMode != 0 || gPriorityHandler.priority_timer != 0)) { return FALSE; } @@ -728,7 +728,7 @@ static void sub_08070E9C(Entity* this) { static void sub_08070EDC(Entity* this) { this->updatePriority = PRIO_MESSAGE; - if ((gMessage.doTextBox & 0x7f) != 0) + if (gMessage.state & MESSAGE_ACTIVE) this->subAction = 1; if ((gPlayerState.flags & PL_MINISH) == 0) @@ -739,7 +739,7 @@ static void sub_08070EDC(Entity* this) { static void sub_08070f24(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->updatePriority = this->updatePriorityPrev; ResetPlayerAnimationAndAction(); } @@ -808,7 +808,7 @@ static void sub_08071038(Entity* this) { UpdateAnimationSingleFrame(this); // player is still reading message - if (CheckQueuedAction() || (gMessage.doTextBox & 0x7f)) + if (CheckQueuedAction() || (gMessage.state & MESSAGE_ACTIVE)) return; if (this->frame & ANIM_DONE) { @@ -1286,7 +1286,7 @@ static void PlayerTalkEzlo_Init(Entity* this) { ResetActiveItems(); gActiveItems[ACTIVE_ITEM_LANTERN].animPriority = 0; this->iframes = 0; - gPriorityHandler.sys_priority = PRIO_PLAYER_EVENT; + gPriorityHandler.event_priority = PRIO_PLAYER_EVENT; this->updatePriority = PRIO_PLAYER_EVENT; if (gPlayerState.flags & PL_MINISH) { @@ -1335,7 +1335,7 @@ static void PlayerTalkEzlo_CreateMessage(Entity* this) { static void PlayerTalkEzlo_MessageIdle(Entity* this) { u32 rightOrLeft; - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->subAction++; if ((gPlayerState.flags & PL_MINISH) == 0) { if (this->animationState == IdleEast) @@ -1380,7 +1380,7 @@ static void PlayerTalkEzlo_Leave(Entity* this) { } static void reset_priority(void) { - gPriorityHandler.sys_priority = PRIO_MIN; + gPriorityHandler.event_priority = PRIO_MIN; gPlayerEntity.updatePriority = gPlayerEntity.updatePriorityPrev; } diff --git a/src/playerItem.c b/src/playerItem.c index f6fbd5bf..69b1557e 100644 --- a/src/playerItem.c +++ b/src/playerItem.c @@ -72,7 +72,7 @@ void ItemUpdate(Entity* this) { if ((this->flags & ENT_DID_INIT) == 0 && this->action == 0 && this->subAction == 0) ItemInit(this); - if (!EntityIsDeleted(this)) { + if (!EntityDisabled(this)) { gPlayerItemFunctions[this->id](this); this->contactFlags &= ~0x80; if (this->iframes != 0) { diff --git a/src/playerUtils.c b/src/playerUtils.c index c987c761..2cd630f7 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -988,7 +988,7 @@ bool32 sub_08078140(ChargeState* info) { void ForceSetPlayerState(u32 framestate) { gPlayerState.framestate = framestate; gPlayerEntity.flags &= ~ENT_COLLIDE; - sub_08078B48(); + PausePlayer(); } void DetermineRButtonInteraction(void) { @@ -1504,7 +1504,7 @@ void SetPlayerItemGetState(Entity* item, u8 param_2, u8 param_3) { DeleteClones(); } -void sub_08078B48(void) { +void PausePlayer(void) { gPlayerState.field_0x7 |= 0x80; gPlayerState.keepFacing |= 0x80; gPlayerState.field_0xa |= 0x80; @@ -2494,7 +2494,7 @@ u32 sub_08079FD4(Entity* this, u32 param_2) { void UpdatePlayerPalette(void) { u32 palette; - if ((gPlayerState.hurtBlinkSpeed != 0) && ((gMessage.doTextBox & 0x7f) == 0)) { + if ((gPlayerState.hurtBlinkSpeed != 0) && ((gMessage.state & MESSAGE_ACTIVE) == 0)) { gPlayerState.hurtBlinkSpeed--; } palette = GetPlayerPalette(FALSE); diff --git a/src/script.c b/src/script.c index 8216a438..278ad227 100644 --- a/src/script.c +++ b/src/script.c @@ -1054,7 +1054,7 @@ void ScriptCommand_0807E858(Entity* entity, ScriptExecutionContext* context) { void ScriptCommand_SetPlayerIdle(Entity* entity, ScriptExecutionContext* context) { gPlayerState.controlMode = CONTROL_DISABLED; - sub_08078B48(); + PausePlayer(); } void ScriptCommand_EnablePlayerControl(Entity* entity, ScriptExecutionContext* context) { @@ -1129,7 +1129,7 @@ void ScriptCommand_0807E974(Entity* entity, ScriptExecutionContext* context) { MessageFromTarget(context->scriptInstructionPointer[1]); break; case 1: - if (gMessage.doTextBox & 0x7F) + if (gMessage.state & MESSAGE_ACTIVE) break; context->unk_18 = 2; context->unk_19 = 0xF; @@ -1191,7 +1191,7 @@ void ScriptCommand_AddInteractableFuser(Entity* entity, ScriptExecutionContext* } void ScriptCommand_WaitUntilTextboxCloses(Entity* entity, ScriptExecutionContext* context) { - if (gMessage.doTextBox & 0x7F) { + if (gMessage.state & MESSAGE_ACTIVE) { gActiveScriptInfo.commandSize = 0; } } diff --git a/src/scroll.c b/src/scroll.c index abb3c136..25c20cd6 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -268,7 +268,7 @@ void sub_0807FF1C(RoomControls* controls) { gUpdateVisibleTiles = 3; if (++controls->unk_18 > 0x13) { controls->scrollAction = 0; - ResetSystemPriority(); + ClearEventPriority(); } } } @@ -408,7 +408,7 @@ void sub_080801BC(RoomControls* controls) { if (controls->unk_1c == 0) { controls->scrollAction = 0; controls->reload_flags = 0; - ResetSystemPriority(); + ClearEventPriority(); gScreen.lcd.displayControl &= ~DISPCNT_WIN1_ON; gScreen.controls.windowInsideControl &= 0xff; gScreen.controls.windowOutsideControl &= 0xff00; diff --git a/src/staffroll.c b/src/staffroll.c index a2df531f..dcd0fad7 100644 --- a/src/staffroll.c +++ b/src/staffroll.c @@ -93,7 +93,7 @@ void StaffrollTask_State0(void) { gScreen.bg1.control = 0x1e4d; gScreen.bg2.control = 0x1dc3; InitSoundPlayingInfo(); - ResetSystemPriority(); + ClearEventPriority(); SetFade(FADE_IN_OUT | FADE_INSTANT, 0x100); } diff --git a/src/subtask.c b/src/subtask.c index e801bade..ab9a4500 100644 --- a/src/subtask.c +++ b/src/subtask.c @@ -278,7 +278,7 @@ void Subtask_Die(void) { gMain.substate = gUI.pauseFadeIn; gUI.nextToLoad = gFadeControl.active; gUI.lastState = gFadeControl.active; - ResetSystemPriority(); + ClearEventPriority(); } } diff --git a/src/ui.c b/src/ui.c index 1bff0dae..95a10ef4 100644 --- a/src/ui.c +++ b/src/ui.c @@ -626,7 +626,7 @@ void ButtonUIElement_Action1(UIElement* element) { MAX_MOVEMENT = (!element->type2) ? 4 : 8; - if (element->type2 == 0 && (((gUnk_0200AF00.unk_1 >> element->type) & 1) || (gMessage.doTextBox & 0x7f) != 0)) { + if (element->type2 == 0 && (((gUnk_0200AF00.unk_1 >> element->type) & 1) || (gMessage.state & MESSAGE_ACTIVE) != 0)) { y = (s16)gUnk_0200AF00.buttonY[element->type] - 0x28; } else { y = (s16)gUnk_0200AF00.buttonY[element->type]; @@ -792,7 +792,7 @@ void HeartUIElement(UIElement* element) { u32 health; u32 frameIndex; element->unk_0_1 = 0; - if (((gUnk_0200AF00.unk_1 & 0x10) == 0) && ((gMessage.doTextBox & 0x7f) == 0)) { + if (((gUnk_0200AF00.unk_1 & 0x10) == 0) && ((gMessage.state & MESSAGE_ACTIVE) == 0)) { health = gUnk_0200AF00.health; if (health != 0) { element->unk_0_1 = 1; @@ -845,7 +845,7 @@ void EzloNagUIElement_Action1(UIElement* element) { } void EzloNagUIElement_Action2(UIElement* element) { - if (gUnk_0200AF00.ezloNagFuncIndex >= 5 || (gMessage.doTextBox & 0x7f)) { + if (gUnk_0200AF00.ezloNagFuncIndex >= 5 || (gMessage.state & MESSAGE_ACTIVE)) { element->action = 0; element->unk_0_1 = 0; return; From 72509b18a0406f93b6ffc59904cc2c09c0adbf80 Mon Sep 17 00:00:00 2001 From: theo3 Date: Fri, 29 Dec 2023 00:56:36 -0800 Subject: [PATCH 06/15] label some asm functions --- asm/src/code_08000F10.s | 48 +++++++++++++++++++------------------ include/entity.h | 25 +++++++++++-------- include/structures.h | 2 +- linker.ld | 4 ++-- src/enemy/acroBandits.c | 2 +- src/enemy/fireballGuy.c | 2 +- src/enemy/slime.c | 2 +- src/entity.c | 36 ++++++++++++++-------------- src/itemUtils.c | 8 +++---- src/object/gentariCurtain.c | 2 +- src/objectUtils.c | 2 +- src/playerItemUtils.c | 2 +- src/playerUtils.c | 4 ++-- src/ui.c | 3 ++- 14 files changed, 75 insertions(+), 67 deletions(-) diff --git a/asm/src/code_08000F10.s b/asm/src/code_08000F10.s index e7ce35aa..7ecc84d5 100644 --- a/asm/src/code_08000F10.s +++ b/asm/src/code_08000F10.s @@ -10,41 +10,43 @@ CheckBits: @ 0x08000F10 ldr r3, _08000F50 @ =ram_CheckBits bx r3 - thumb_func_start sub_08000F14 -sub_08000F14: @ 0x08000F14 + // sum 3 drop probability vectors + thumb_func_start SumDropProbabilities +SumDropProbabilities: @ 0x08000F14 push {r4, r5, r6} - movs r4, #0x1e + movs r4, #30 // vector addition for 16 shorts in reverse _08000F18: - ldrsh r5, [r1, r4] - ldrsh r6, [r2, r4] - adds r5, r5, r6 - ldrsh r6, [r3, r4] - adds r5, r5, r6 - strh r5, [r0, r4] + ldrsh r5, [r1, r4] // row 1 + ldrsh r6, [r2, r4] // + row 2 + adds r5, r6 + ldrsh r6, [r3, r4] // + row 3 + adds r5, r6 + strh r5, [r0, r4] // store in output subs r4, #2 bpl _08000F18 pop {r4, r5, r6} bx lr - thumb_func_start sub_08000F2C -sub_08000F2C: @ 0x08000F2C + // sum 3 drop probabilities, clamp to 0, return scalar sum + thumb_func_start SumDropProbabilities2 +SumDropProbabilities2: @ 0x08000F2C push {r4, r5, r6, r7} - movs r4, #0x1e - movs r7, #0 + movs r4, #30 + movs r7, #0 // sum _08000F32: - ldrsh r5, [r1, r4] - ldrsh r6, [r2, r4] - adds r5, r5, r6 - ldrsh r6, [r3, r4] - adds r5, r5, r6 - bpl _08000F40 + ldrsh r5, [r1, r4] // row 1 + ldrsh r6, [r2, r4] // + row 2 + adds r5, r6 + ldrsh r6, [r3, r4] // + row 3 + adds r5, r6 + bpl positive_drop_chance // clamp to 0 movs r5, #0 -_08000F40: - strh r5, [r0, r4] - adds r7, r7, r5 +positive_drop_chance: + strh r5, [r0, r4] // store in output + adds r7, r5 subs r4, #2 bpl _08000F32 - adds r0, r7, #0 + adds r0, r7, #0 // return sum pop {r4, r5, r6, r7} bx lr .align 2, 0 diff --git a/include/entity.h b/include/entity.h index 5b5c328d..067e9ff4 100644 --- a/include/entity.h +++ b/include/entity.h @@ -6,7 +6,9 @@ #include "color.h" #include "sprite.h" -#define MAX_ENTITIES 71 +#define MAX_ENTITIES 72 +#define MAX_MANAGERS 32 +#define MAX_AUX_PLAYER_ENTITIES 7 /** Kinds of Entity's supported by the game. */ typedef enum { @@ -38,6 +40,8 @@ typedef enum { typedef enum { ENT_DID_INIT = 0x1, /**< Graphics and other data loaded. */ ENT_SCRIPTED = 0x2, /**< Execute in a scripted environment. */ + ENT_UNUSED1 = 0x4, /**< Unused delete flag. */ + ENT_UNUSED2 = 0x8, /**< Unused delete flag. */ ENT_DELETED = 0x10, /**< Queue deletion next frame. */ ENT_PERSIST = 0x20, /**< Persist between rooms. */ ENT_COLLIDE = 0x80, /**< Collide with other Entity's. */ @@ -238,6 +242,15 @@ typedef struct LinkedList { Entity* first; } LinkedList; +/** + * LinkedList's which point to allocate Entities. + * These work together with Entity.prev and Entity.next fields + * to allow the iteration of all Entity's. + */ +extern LinkedList gEntityLists[9]; +extern Entity gAuxPlayerEntities[MAX_AUX_PLAYER_ENTITIES]; +extern Entity gEntities[MAX_ENTITIES]; + typedef void(EntityAction)(Entity*); typedef void (*EntityActionPtr)(Entity*); typedef void (*const* EntityActionArray)(Entity*); @@ -283,7 +296,7 @@ Entity* CreateEnemy(u32 id, u32 type); Entity* CreateNPC(u32 id, u32 type, u32 type2); Entity* CreateObject(u32 id, u32 type, u32 type2); Entity* CreateObjectWithParent(Entity* parent, u32 id, u32 type, u32 type2); -Entity* CreateItemGetEntity(void); +Entity* CreateAuxPlayerEntity(void); Entity* CreateFx(Entity* parent, u32 type, u32 type2); /// @} @@ -484,14 +497,6 @@ void ClearEventPriority(void); void sub_0805E958(void); -/** - * LinkedList's which point to allocate Entities. - * These work together with Entity.prev and Entity.next fields - * to allow the iteration of all Entity's. - */ -extern LinkedList gEntityLists[9]; -extern Entity gItemGetEntities[7]; - typedef struct { u8 unk_0; u8 unk_1; diff --git a/include/structures.h b/include/structures.h index 6125cba9..f4dc51cd 100644 --- a/include/structures.h +++ b/include/structures.h @@ -192,7 +192,7 @@ static_assert(sizeof(gActiveItems) == 0x70); typedef struct { u8 event_priority; // system requested priority - u8 ent_priority; // entity requested priority + u8 ent_priority; // entity requested priority u8 queued_priority; u8 queued_priority_reset; Entity* requester; diff --git a/linker.ld b/linker.ld index dbfc5c3c..18f9d27d 100644 --- a/linker.ld +++ b/linker.ld @@ -132,8 +132,8 @@ SECTIONS { . = 0x000010A0; gRoomTransition = .; . = 0x00001150; gRand = .; . = 0x00001160; gPlayerEntity = .; - . = 0x000011E8; gItemGetEntities = .; - . = 0x000015A0; gUnk_030015A0 = .; + . = 0x000011E8; gAuxPlayerEntities = .; + . = 0x000015A0; gEntities = .; . = 0x00003BE0; gCarriedEntity = .; . = 0x00003C70; gUnk_03003C70 = .; . = 0x00003D70; gEntityLists = .; diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index aeeed7f6..58457d1d 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -240,7 +240,7 @@ void AcroBandit_Type0Action5(Entity* this) { GetNextFrame(this); if (this->frame & ANIM_DONE) { - if (gEntCount < MAX_ENTITIES - 4) { + if (gEntCount < MAX_ENTITIES - 5) { u32 tmp = Random(); tmp &= 3; diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index 3eb404a1..0aeaf781 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -81,7 +81,7 @@ void FireballGuy_Action2(Entity* this) { /* Can we create enough new entities? */ count = typeEntityCount[this->type]; - if (MAX_ENTITIES + 1 - count <= gEntCount) + if (MAX_ENTITIES - count <= gEntCount) return; /* Create 2-5 new MiniFireballGuy */ diff --git a/src/enemy/slime.c b/src/enemy/slime.c index 494d0459..47bf27b5 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -105,7 +105,7 @@ void sub_080450A8(Entity* this) { /* Can we create enough new entities? */ count = typeEntityCount[this->type]; - if (MAX_ENTITIES + 1 - count <= gEntCount) + if (MAX_ENTITIES - count <= gEntCount) return; /* Create 2-4 new MiniSlime */ diff --git a/src/entity.c b/src/entity.c index b93fa3a3..b13d5261 100644 --- a/src/entity.c +++ b/src/entity.c @@ -6,6 +6,12 @@ #include "npc.h" #include "manager/diggingCaveEntranceManager.h" +typedef struct Temp { + void* prev; + void* next; + u8 _0[0x38]; +} Temp; + extern u8 gUpdateVisibleTiles; extern Manager gUnk_02033290; void UpdatePlayerInput(void); @@ -241,8 +247,6 @@ void EraseAllEntities(void) { gOAMControls.unk[1].unk6 = 1; } -extern Entity gUnk_030015A0[0x48]; - Entity* GetEmptyEntity() { u8 flags_ip; Entity* end; @@ -253,9 +257,9 @@ Entity* GetEmptyEntity() { LinkedList* listPtr; LinkedList* endListPtr; - if (gEntCount <= 0x46) { - currentEnt = gUnk_030015A0; - end = currentEnt + ARRAY_COUNT(gUnk_030015A0); + if (gEntCount < MAX_ENTITIES - 1) { + currentEnt = gEntities; + end = currentEnt + ARRAY_COUNT(gEntities); do { if (currentEnt->prev == 0) { @@ -267,7 +271,8 @@ Entity* GetEmptyEntity() { currentEnt = &gPlayerEntity; do { - if ((s32)currentEnt->prev < 0 && (currentEnt->flags & 0xc) && currentEnt != gUpdateContext.current_entity) { + if ((s32)currentEnt->prev < 0 && (currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2)) && + currentEnt != gUpdateContext.current_entity) { ClearDeletedEntity(currentEnt); return currentEnt; } @@ -282,9 +287,10 @@ Entity* GetEmptyEntity() { currentEnt = listPtr->first; nextList = listPtr + 1; while ((u32)currentEnt != (u32)listPtr) { - if (currentEnt->kind != MANAGER && flags_ip < (currentEnt->flags & 0x1c) && + if (currentEnt->kind != MANAGER && + flags_ip < (currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED)) && gUpdateContext.current_entity != currentEnt) { - flags_ip = currentEnt->flags & 0x1c; + flags_ip = currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED); rv = currentEnt; } currentEnt = currentEnt->next; @@ -301,16 +307,16 @@ Entity* GetEmptyEntity() { return rv; } -extern Entity gItemGetEntities[7]; +extern Entity gAuxPlayerEntities[7]; -Entity* CreateItemGetEntity(void) { - Entity* ent = gItemGetEntities; +Entity* CreateAuxPlayerEntity(void) { + Entity* ent = gAuxPlayerEntities; do { if (ent->prev == NULL) { return ent; } - } while (++ent < &gItemGetEntities[7]); + } while (++ent < &gAuxPlayerEntities[7]); return NULL; } @@ -407,12 +413,6 @@ void DeleteAllEntities(void) { } } -typedef struct Temp { - void* prev; - void* next; - u8 _0[0x38]; -} Temp; - // fix this Manager* GetEmptyManager(void) { Temp* it; diff --git a/src/itemUtils.c b/src/itemUtils.c index 00cfd5e9..832c68ce 100644 --- a/src/itemUtils.c +++ b/src/itemUtils.c @@ -403,8 +403,8 @@ void EnableRandomDrops(void) { gRoomVars.randomDropsDisabled = FALSE; } -extern void sub_08000F14(s16*, const s16*, const s16*, const s16*); -extern u32 sub_08000F2C(s16*, const s16*, const s16*, const s16*); +extern void SumDropProbabilities(s16*, const s16*, const s16*, const s16*); +extern u32 SumDropProbabilities2(s16*, const s16*, const s16*, const s16*); u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter); u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) { extern const u8 gUnk_080FE1B4[] /* = { @@ -459,7 +459,7 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) { #endif } // vector addition, s0 = ptr4 + ptr2 + ptr3 - sub_08000F14(droptable.a, ptr4->a, ptr2->a, ptr3->a); + SumDropProbabilities(droptable.a, ptr4->a, ptr2->a, ptr3->a); if (gSave.stats.health <= 8) { droptable.s.hearts += 5; } @@ -486,7 +486,7 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) { // vector addition, s0 = s0 + ptr2 + ptr3 // resulting values are clamped to be >= 0 // returns sum over s0 - summOdds = sub_08000F2C(droptable.a, droptable.a, ptr2->a, ptr3->a); + summOdds = SumDropProbabilities2(droptable.a, droptable.a, ptr2->a, ptr3->a); rand = Random(); item = (rand >> 0x18); item &= 0xF; diff --git a/src/object/gentariCurtain.c b/src/object/gentariCurtain.c index 14a25cea..bcfce42e 100644 --- a/src/object/gentariCurtain.c +++ b/src/object/gentariCurtain.c @@ -96,7 +96,7 @@ void sub_080921BC(GentariCurtainEntity* this) { GenericEntity* pEVar1; GenericEntity* end; - pEVar1 = (GenericEntity*)gItemGetEntities; + pEVar1 = (GenericEntity*)gAuxPlayerEntities; end = pEVar1 + 0x4f; do { diff --git a/src/objectUtils.c b/src/objectUtils.c index e3db7806..29e4deb8 100644 --- a/src/objectUtils.c +++ b/src/objectUtils.c @@ -31,7 +31,7 @@ const s8 gUnk_08126EEC[] = { }; Entity* CreateLinkAnimation(Entity* parent, u32 type, u32 type2) { - Entity* e = CreateItemGetEntity(); + Entity* e = CreateAuxPlayerEntity(); if (e != NULL) { LinkAnimationEntity* this = (LinkAnimationEntity*)e; e->id = LINK_ANIMATION; diff --git a/src/playerItemUtils.c b/src/playerItemUtils.c index b09ed736..6e7bb5f8 100644 --- a/src/playerItemUtils.c +++ b/src/playerItemUtils.c @@ -36,7 +36,7 @@ static Entity* GiveItemWithCutscene(u32 item, u32 type2, u32 delay) { item = ITEM_RUPEE50; type2 = 0; } - e = CreateItemGetEntity(); + e = CreateAuxPlayerEntity(); if (e != NULL) { e->type = item; e->type2 = type2; diff --git a/src/playerUtils.c b/src/playerUtils.c index 2cd630f7..9ab584e5 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -462,7 +462,7 @@ Entity* CreatePlayerItemWithParent(ItemBehavior* this, u32 id) { } void* CreateItemGetPlayerItemWithParent(ItemBehavior* this) { - GenericEntity* playerItem = (GenericEntity*)CreateItemGetEntity(); + GenericEntity* playerItem = (GenericEntity*)CreateAuxPlayerEntity(); if (playerItem != NULL) { playerItem->base.id = gItemDefinitions[this->behaviorId].playerItemId; playerItem->base.kind = PLAYER_ITEM; @@ -501,7 +501,7 @@ Entity* CreatePlayerItem(u32 id, u32 type, u32 type2, u32 unk) { Entity* sub_08077CF8(u32 id, u32 type, u32 type2, u32 unk) { GenericEntity* ent; - ent = (GenericEntity*)CreateItemGetEntity(); + ent = (GenericEntity*)CreateAuxPlayerEntity(); if (ent != NULL) { ent->base.flags = ENT_COLLIDE; ent->base.kind = PLAYER_ITEM; diff --git a/src/ui.c b/src/ui.c index 95a10ef4..b983b0b3 100644 --- a/src/ui.c +++ b/src/ui.c @@ -626,7 +626,8 @@ void ButtonUIElement_Action1(UIElement* element) { MAX_MOVEMENT = (!element->type2) ? 4 : 8; - if (element->type2 == 0 && (((gUnk_0200AF00.unk_1 >> element->type) & 1) || (gMessage.state & MESSAGE_ACTIVE) != 0)) { + if (element->type2 == 0 && + (((gUnk_0200AF00.unk_1 >> element->type) & 1) || (gMessage.state & MESSAGE_ACTIVE) != 0)) { y = (s16)gUnk_0200AF00.buttonY[element->type] - 0x28; } else { y = (s16)gUnk_0200AF00.buttonY[element->type]; From 44072497eaa1adf0a7141ad8d4c8f09318021bc6 Mon Sep 17 00:00:00 2001 From: Tony Jih Date: Fri, 29 Dec 2023 18:46:46 +0800 Subject: [PATCH 07/15] True match sub_0802C334 --- src/enemy/fallingBoulder.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index 5f9f5ce2..11c6b742 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -65,45 +65,42 @@ void sub_0802C318(Entity* this) { } void sub_0802C334(Entity* this) { - register Entity* ent asm("r2"); - u32 diff; - u16 tmp; + Entity* ent; + u32 roomOriginY, tmp; + s32 y, i; if (this->field_0x7c.HALF_U.LO == 0) { - u32 tmp = gRoomControls.origin_y; + roomOriginY = gRoomControls.origin_y; ent = &gPlayerEntity; if (ent == NULL) return; - if (ent->y.HALF.HI - tmp <= 0x38) { + tmp = ent->y.HALF.HI; + if (0x38 >= tmp - roomOriginY) return; - } this->field_0x7c.HALF_U.LO = 1; this->spriteSettings.draw = 1; } + GetNextFrame(this); this->field_0x7c.HALF.HI = COORD_TO_TILE(this); + if (sub_080044EC(this, *(u32*)&this->cutsceneBeh) == 1) { EnqueueSFX(0x14c); COLLISION_ON(this); - this->field_0x7a.HWORD = 0xc; + this->field_0x7a.HWORD = 12; sub_0802C4B0(this); } else { - s32 y; - if (this->field_0x7a.HWORD) { - tmp = --this->field_0x7a.HWORD; - switch (tmp) { + switch (--this->field_0x7a.HWORD) { case 0: COLLISION_OFF(this); break; case 8: if (this->type2 != 0 && !sub_08049FA0(this)) { - diff = 0; - for (y = 1; y > -1; y--) { + for (i = 0; i < 2; i++) { ent = CreateFx(this, FX_ROCK2, 0); if (ent) { - ent->x.HALF.HI = ent->x.HALF.HI + 12 - diff; + ent->x.HALF.HI += 12 - i * 0x18; } - diff += 0x18; } sub_0802C62C(this); this->field_0x7a.HWORD = (Random() & 0xff) | 0x100; @@ -112,11 +109,9 @@ void sub_0802C334(Entity* this) { break; } } - - { - FORCE_REGISTER(RoomControls * tmp, r0) = &gRoomControls; - y = tmp->origin_y + tmp->height - this->y.HALF.HI; - } + roomOriginY = gRoomControls.origin_y; + tmp = gRoomControls.height; + y = roomOriginY + tmp - this->y.HALF.HI; if (y >= 5) { ProcessMovement1(this); @@ -131,6 +126,7 @@ void sub_0802C334(Entity* this) { } } } + this->collisionLayer = 3; this->spritePriority.b0 = 1; UpdateSpriteForCollisionLayer(this); From b28f865051ab27862d14077a046f2eea6e72191e Mon Sep 17 00:00:00 2001 From: octorock <79596758+octorock@users.noreply.github.com> Date: Sun, 30 Jul 2023 23:51:54 +0200 Subject: [PATCH 08/15] Create new entity structs for Player Items --- include/enemy/octorokBoss.h | 2 +- src/playerItem/playerItemBomb.c | 101 +++---- src/playerItem/playerItemBoomerang.c | 247 ++++++++++-------- src/playerItem/playerItemBottle.c | 170 ++++++------ src/playerItem/playerItemBow.c | 65 ++--- src/playerItem/playerItemCellOverwriteSet.c | 75 +++--- src/playerItem/playerItemDashSword.c | 42 +-- src/playerItem/playerItemFireRodProjectile.c | 54 ++-- src/playerItem/playerItemGust.c | 47 ++-- src/playerItem/playerItemGustBig.c | 199 +++++++------- src/playerItem/playerItemGustJar.c | 13 +- src/playerItem/playerItemHeldObject.c | 57 ++-- src/playerItem/playerItemLantern.c | 28 +- src/playerItem/playerItemPacciCane.c | 13 +- .../playerItemPacciCaneProjectile.c | 183 +++++++------ src/playerItem/playerItemShield.c | 52 ++-- src/playerItem/playerItemSpiralBeam.c | 93 ++++--- src/playerItem/playerItemSword.c | 44 ++-- src/playerItem/playerItemSwordBeam.c | 151 ++++++----- 19 files changed, 895 insertions(+), 741 deletions(-) diff --git a/include/enemy/octorokBoss.h b/include/enemy/octorokBoss.h index d57c8665..afa140e2 100644 --- a/include/enemy/octorokBoss.h +++ b/include/enemy/octorokBoss.h @@ -20,7 +20,7 @@ typedef struct { static_assert(sizeof(OctorokBossHeap) == 0x30); struct OctorokBossEntity { - Entity base; + /*0x00*/ Entity base; /*0x68*/ union SplitHWord field_0x68; /*0x6a*/ union SplitHWord field_0x6a; /*0x6c*/ union SplitHWord field_0x6c; diff --git a/src/playerItem/playerItemBomb.c b/src/playerItem/playerItemBomb.c index a1e5e560..63647459 100644 --- a/src/playerItem/playerItemBomb.c +++ b/src/playerItem/playerItemBomb.c @@ -1,49 +1,56 @@ +/** + * @file playerItemBomb.c + * @ingroup Items + * + * @brief Bomb Player Item + */ #define NENT_DEPRECATED -#include "entity.h" -#include "player.h" -#include "functions.h" #include "asm.h" +#include "entity.h" +#include "functions.h" #include "item.h" #include "object.h" +#include "player.h" typedef struct { - Entity base; - u32 unk_68; + /*0x00*/ Entity base; + /*0x68*/ u32 unk_68; } PlayerItemBombEntity; -void sub_0801B418(Entity*); -void sub_0801B3A4(PlayerItemBombEntity*); -void sub_0801B250(PlayerItemBombEntity*); -void sub_0801B2CC(PlayerItemBombEntity*); -void sub_0801B318(PlayerItemBombEntity*); -void sub_0801B38C(PlayerItemBombEntity*); -void sub_0801B330(PlayerItemBombEntity*); -void sub_0801B340(PlayerItemBombEntity*); -void sub_0801B354(PlayerItemBombEntity*); -void sub_0801B368(PlayerItemBombEntity*); -void sub_0801B384(PlayerItemBombEntity*); +void sub_0801B418(Entity* this); +void sub_0801B3A4(PlayerItemBombEntity* this); +void PlayerItemBomb_Init(PlayerItemBombEntity* this); +void PlayerItemBomb_Action1(PlayerItemBombEntity* this); +void PlayerItemBomb_Action2(PlayerItemBombEntity* this); +void PlayerItemBomb_Action3(PlayerItemBombEntity* this); +void PlayerItemBomb_SubAction0(PlayerItemBombEntity* this); +void PlayerItemBomb_SubAction1(PlayerItemBombEntity* this); +void PlayerItemBomb_SubAction2(PlayerItemBombEntity* this); +void PlayerItemBomb_SubAction3(PlayerItemBombEntity* this); +void PlayerItemBomb_SubAction4(PlayerItemBombEntity* this); -static void (*const actionFuncs[])(PlayerItemBombEntity*) = { - sub_0801B250, - sub_0801B2CC, - sub_0801B318, - sub_0801B38C, +static void (*const PlayerItemBomb_Actions[])(PlayerItemBombEntity*) = { + PlayerItemBomb_Init, + PlayerItemBomb_Action1, + PlayerItemBomb_Action2, + PlayerItemBomb_Action3, }; -static void (*const subActionFuncs[])(PlayerItemBombEntity*) = { - sub_0801B330, sub_0801B340, sub_0801B354, sub_0801B368, sub_0801B384, +static void (*const PlayerItemBomb_SubActions[])(PlayerItemBombEntity*) = { + PlayerItemBomb_SubAction0, PlayerItemBomb_SubAction1, PlayerItemBomb_SubAction2, + PlayerItemBomb_SubAction3, PlayerItemBomb_SubAction4, }; static const Hitbox unusedHitbox = { 0, 0, { 4, 0, 0, 4 }, 22, 22 }; static const Hitbox gUnk_080B77F4 = { 0, 0, 6, 0, 0, 6, 4, 4 }; void PlayerItemBomb(PlayerItemBombEntity* this) { - u8 uVar1, uVar2; + u8 action, uVar2; - actionFuncs[super->action](this); + PlayerItemBomb_Actions[super->action](this); GetNextFrame(super); - uVar2 = uVar1 = super->action; - if (uVar1 != 0x03) { + uVar2 = action = super->action; + if (action != 3) { if (super->timer != 0) { if (*(u8*)&this->unk_68 == 7) { super->timer--; @@ -56,11 +63,11 @@ void PlayerItemBomb(PlayerItemBombEntity* this) { } } else { if (super->subtimer != 0) { - if (super->subtimer-- == 0x01) { - if ((uVar1 == 0x02) && (super->subAction == 1)) { + if (super->subtimer-- == 1) { + if ((action == 2) && (super->subAction == 1)) { gPlayerState.heldObject = 0; } - super->action = 0x03; + super->action = 3; super->spritePriority.b1 = 2; super->timer = 15; super->spriteSettings.draw = 0; @@ -76,7 +83,7 @@ void PlayerItemBomb(PlayerItemBombEntity* this) { } } -void sub_0801B250(PlayerItemBombEntity* this) { +void PlayerItemBomb_Init(PlayerItemBombEntity* this) { super->spriteSettings.draw = 1; super->action = 1; super->spritePriority.b1 = 3; @@ -98,59 +105,59 @@ void sub_0801B250(PlayerItemBombEntity* this) { } } -void sub_0801B2CC(PlayerItemBombEntity* this) { - u16 unaff_r5; +void PlayerItemBomb_Action1(PlayerItemBombEntity* this) { + u16 input; if (!sub_0800442E(super)) { RegisterCarryEntity(super); } switch (IsItemEquipped(ITEM_REMOTE_BOMBS)) { case EQUIP_SLOT_A: - unaff_r5 = PLAYER_INPUT_1; + input = PLAYER_INPUT_1; break; case EQUIP_SLOT_B: - unaff_r5 = PLAYER_INPUT_2; + input = PLAYER_INPUT_2; break; case EQUIP_SLOT_NONE: - unaff_r5 = 0; + input = 0; break; } - if ((gPlayerState.playerInput.newInput & unaff_r5) != 0) { + if ((gPlayerState.playerInput.newInput & input) != 0) { super->timer = 0; super->subtimer = 1; } } -void sub_0801B318(PlayerItemBombEntity* this) { - subActionFuncs[super->subAction](this); +void PlayerItemBomb_Action2(PlayerItemBombEntity* this) { + PlayerItemBomb_SubActions[super->subAction](this); } -void sub_0801B330(PlayerItemBombEntity* this) { +void PlayerItemBomb_SubAction0(PlayerItemBombEntity* this) { super->subAction++; sub_08079BD8(super); } -void sub_0801B340(PlayerItemBombEntity* this) { +void PlayerItemBomb_SubAction1(PlayerItemBombEntity* this) { super->spritePriority.b1 = 2; } -void sub_0801B354(PlayerItemBombEntity* this) { +void PlayerItemBomb_SubAction2(PlayerItemBombEntity* this) { super->spritePriority.b1 = 3; } -void sub_0801B368(PlayerItemBombEntity* this) { +void PlayerItemBomb_SubAction3(PlayerItemBombEntity* this) { super->action--; super->subAction = 0; - if (0x3c < super->timer) { + if (super->timer > 60) { super->timer = 60; } } -void sub_0801B384(PlayerItemBombEntity* this) { +void PlayerItemBomb_SubAction4(PlayerItemBombEntity* this) { DeleteThisEntity(); } -void sub_0801B38C(PlayerItemBombEntity* this) { +void PlayerItemBomb_Action3(PlayerItemBombEntity* this) { if (super->timer-- == 0) { DeleteThisEntity(); } @@ -158,7 +165,7 @@ void sub_0801B38C(PlayerItemBombEntity* this) { void sub_0801B3A4(PlayerItemBombEntity* this) { u32 tmp; - if (super->subtimer >= 0x29) { + if (super->subtimer > 40) { tmp = 8; } else { tmp = 4; diff --git a/src/playerItem/playerItemBoomerang.c b/src/playerItem/playerItemBoomerang.c index 6557a08c..be166131 100644 --- a/src/playerItem/playerItemBoomerang.c +++ b/src/playerItem/playerItemBoomerang.c @@ -1,213 +1,228 @@ -#include "entity.h" -#include "sound.h" -#include "functions.h" +/** + * @file playerItemBoomerang.c + * @ingroup Items + * + * @brief Boomerang Player Item + */ +#define NENT_DEPRECATED #include "asm.h" +#include "entity.h" +#include "functions.h" #include "item.h" +#include "sound.h" -void sub_0801B804(Entity*); -Entity* sub_0801B864(Entity*); -void sub_0801B584(Entity*); -void PlayerItemBoomerang_Init(Entity*); -void sub_0801B680(Entity*); -void sub_0801B7A8(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unused1[23]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unused2[1]; + /*0x83*/ union SplitHWord unk_82; + /*0x84*/ u8 unused3[2]; + /*0x86*/ u16 unk_86; +} PlayerItemBoomerangEntity; + +void sub_0801B804(PlayerItemBoomerangEntity* this); +Entity* sub_0801B864(Entity* this); +void PlayerItemBoomerang_Action1(PlayerItemBoomerangEntity* this); +void PlayerItemBoomerang_Init(PlayerItemBoomerangEntity* this); +void PlayerItemBoomerang_Action2(PlayerItemBoomerangEntity* this); +void PlayerItemBoomerang_Action3(PlayerItemBoomerangEntity* this); extern Entity* sub_08008782(Entity*, u32, s32, s32); extern bool32 sub_080040E2(Entity*, u8*); extern Hitbox gUnk_081271CC; extern u8 gUnk_08003E44; -void PlayerItemBoomerang(Entity* this) { - static void (*const PlayerItemBoomerang_Actions[])(Entity*) = { +void PlayerItemBoomerang(PlayerItemBoomerangEntity* this) { + static void (*const PlayerItemBoomerang_Actions[])(PlayerItemBoomerangEntity*) = { PlayerItemBoomerang_Init, - sub_0801B584, - sub_0801B680, - sub_0801B7A8, + PlayerItemBoomerang_Action1, + PlayerItemBoomerang_Action2, + PlayerItemBoomerang_Action3, }; // Unused static const u16 gUnk_080B780C[] = { 0x75, 0x1, 0x76, 0x1, 0x3ac, 0x1, 0x4050, 0x1, 0x377, 0x1, 0x378, 0x1, 0x0 }; - PlayerItemBoomerang_Actions[this->action](this); - if (this->animIndex != 0xb) { - if (this->animationState == 6) { - this->field_0x86.HWORD += 0x2000; + PlayerItemBoomerang_Actions[super->action](this); + if (super->animIndex != 0xb) { + if (super->animationState == 6) { + this->unk_86 += 0x2000; } else { - this->field_0x86.HWORD -= 0x2000; + this->unk_86 -= 0x2000; } - SetAffineInfo(this, 0x100, 0x100, this->field_0x86.HWORD); + SetAffineInfo(super, 0x100, 0x100, this->unk_86); } - this->subtimer--; - if ((this->subtimer & 0xf) == 0) { + super->subtimer--; + if ((super->subtimer & 0xf) == 0) { EnqueueSFX(SFX_FB); } } -void PlayerItemBoomerang_Init(Entity* this) { - u32 uVar1; - - gPlayerState.item = this; - this->action = 1; - this->hitbox = &gUnk_081271CC; - this->frameIndex = 0xff; - this->field_0x80.HALF.LO = 0; +void PlayerItemBoomerang_Init(PlayerItemBoomerangEntity* this) { + gPlayerState.item = super; + super->action = 1; + super->hitbox = &gUnk_081271CC; + super->frameIndex = 0xff; + this->unk_80 = 0; #ifdef EU - this->spriteVramOffset = gPlayerEntity.spriteVramOffset; + super->spriteVramOffset = gPlayerEntity.spriteVramOffset; #endif - this->animIndex = 11; - this->parent = &gPlayerEntity; - this->field_0x86.HWORD = 0; - if ((this->animationState & 2) != 0) { - this->spriteSettings.flipX = ~gPlayerEntity.spriteSettings.flipX; + super->animIndex = 11; + super->parent = &gPlayerEntity; + this->unk_86 = 0; + if ((super->animationState & 2) != 0) { + super->spriteSettings.flipX = ~gPlayerEntity.spriteSettings.flipX; } - if (this->field_0x68.HALF.LO == 12) { - this->speed = 0x280; - uVar1 = 60; + if (this->unk_68 == 12) { + super->speed = 0x280; + super->timer = 60; } else { - this->speed = 0x200; - uVar1 = 30; + super->speed = 0x200; + super->timer = 30; } - this->timer = uVar1; if (((s8)gPlayerState.direction) >= 0) { - this->direction = gPlayerState.direction; + super->direction = gPlayerState.direction; } else { - this->direction = this->animationState << 2; + super->direction = super->animationState << 2; } - this->field_0x82.HALF.HI = this->direction; - if (this->collisionLayer == 2) { - this->type2 = 1; + this->unk_82.HALF.HI = super->direction; + if (super->collisionLayer == 2) { + super->type2 = 1; } - LoadSwapGFX(this, 1, 3); - sub_0801766C(this); - sub_0801B584(this); + LoadSwapGFX(super, 1, 3); + sub_0801766C(super); + PlayerItemBoomerang_Action1(this); } -void sub_0801B584(Entity* this) { +void PlayerItemBoomerang_Action1(PlayerItemBoomerangEntity* this) { static const s8 gUnk_080B7826[] = { 0, -8, 8, -4, 0, 8, -8, -4 }; u32 frameIndex; int iVar2; u32 cVar3; sub_0801B804(this); - if ((gPlayerState.attack_status == 0) || (gPlayerState.mobility != 0) || gPlayerState.item != this || - (gPlayerState.item == this && gPlayerEntity.action != PLAYER_NORMAL)) { - if (gPlayerState.item == this) { + if ((gPlayerState.attack_status == 0) || (gPlayerState.mobility != 0) || gPlayerState.item != super || + (gPlayerState.item == super && gPlayerEntity.action != PLAYER_NORMAL)) { + if (gPlayerState.item == super) { gPlayerState.item = NULL; } DeleteThisEntity(); } if ((gPlayerEntity.frame & 1) == 0) { - if (this->field_0x68.HALF.LO == 12) { + if (this->unk_68 == 12) { cVar3 = 6; } else { cVar3 = 0; } frameIndex = (gPlayerEntity.frame >> 4) + cVar3; - if (this->frameIndex != frameIndex) { - this->frameIndex = frameIndex; - sub_080042D0(this, this->frameIndex, this->spriteIndex); + if (super->frameIndex != frameIndex) { + super->frameIndex = frameIndex; + sub_080042D0(super, super->frameIndex, super->spriteIndex); } - sub_08078E84(this, &gPlayerEntity); + sub_08078E84(super, &gPlayerEntity); } else { - this->action = 2; - this->spriteVramOffset = 0xd5; - COLLISION_ON(this); - this->collisionFlags |= 1; - this->flags2 = gPlayerEntity.flags2; - this->spriteIndex = 0xa6; - this->spriteSettings.flipX = 0; - this->spriteSettings.draw = 1; + super->action = 2; + super->spriteVramOffset = 0xd5; + COLLISION_ON(super); + super->collisionFlags |= 1; + super->flags2 = gPlayerEntity.flags2; + super->spriteIndex = 0xa6; + super->spriteSettings.flipX = 0; + super->spriteSettings.draw = 1; - iVar2 = (this->animationState >> 1) * 2; - this->x.HALF.HI += gUnk_080B7826[iVar2]; - this->y.HALF.HI += gUnk_080B7826[iVar2 + 1]; - InitializeAnimation(this, 0); + iVar2 = (super->animationState >> 1) * 2; + super->x.HALF.HI += gUnk_080B7826[iVar2]; + super->y.HALF.HI += gUnk_080B7826[iVar2 + 1]; + InitializeAnimation(super, 0); gPlayerState.item = NULL; gPlayerState.attack_status |= 0x80; } } -void sub_0801B680(Entity* this) { - u32 uvar1; - u32 uVar6; +void PlayerItemBoomerang_Action2(PlayerItemBoomerangEntity* this) { + u32 uVar1; + bool32 uVar6; sub_0801B804(this); - if ((this->field_0x68.HALF.LO == 12) && (this->field_0x80.HALF.LO == 0) && ((gPlayerState.direction & 0x80) == 0)) { - if (((this->field_0x82.HALF.HI - gPlayerState.direction) & 0x1f) > 0x10) { - this->field_0x82.HWORD += 0x40; - this->field_0x82.HALF.HI &= 0x1f; - this->direction = this->field_0x82.HALF.HI; + if ((this->unk_68 == 12) && (this->unk_80 == 0) && ((gPlayerState.direction & 0x80) == 0)) { + if (((this->unk_82.HALF.HI - gPlayerState.direction) & 0x1f) > 0x10) { + this->unk_82.HWORD += 0x40; + this->unk_82.HALF.HI &= 0x1f; + super->direction = this->unk_82.HALF.HI; } else { - this->field_0x82.HWORD -= 0x40; - this->field_0x82.HALF.HI &= 0x1f; - this->direction = this->field_0x82.HALF.HI; + this->unk_82.HWORD -= 0x40; + this->unk_82.HALF.HI &= 0x1f; + super->direction = this->unk_82.HALF.HI; } } - LinearMoveUpdate(this); - uVar6 = 0; - if (sub_0801B864(this)) { - uvar1 = this->field_0x68.HALF.LO; - uvar1 ^= 0xc; - if (uvar1) { + LinearMoveUpdate(super); + uVar6 = FALSE; + if (sub_0801B864(super)) { + uVar1 = this->unk_68; + uVar1 ^= 0xc; + if (uVar1) { uVar6 = TRUE; } else { uVar6 = FALSE; } } - if (sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) { - if (uVar6 == 0) { - uVar6 = sub_080040E2(this, &gUnk_08003E44); + if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) { + if (!uVar6) { + uVar6 = sub_080040E2(super, &gUnk_08003E44); } } - if (uVar6 == 0) { - if (--this->timer < 0xc) { - this->speed = this->speed + -0x10; + if (!uVar6) { + if (--super->timer < 0xc) { + super->speed = super->speed + -0x10; } - if (this->timer == 0) { - uVar6 = 1; + if (super->timer == 0) { + uVar6 = TRUE; } - if (this->contactFlags & 0x80) { - uVar6 = 1; + if (super->contactFlags & 0x80) { + uVar6 = TRUE; } - if (uVar6 == 0) { + if (!uVar6) { return; } - if (this->field_0x68.HALF.LO == 12) { - this->timer = 30; + if (this->unk_68 == 12) { + super->timer = 30; } else { - this->timer = 12; + super->timer = 12; } } else { - this->timer = 1; + super->timer = 1; } if (uVar6) { - this->action++; - this->speed = 0x1c0; + super->action++; + super->speed = 0x1c0; } } -void sub_0801B7A8(Entity* this) { +void PlayerItemBoomerang_Action3(PlayerItemBoomerangEntity* this) { sub_0801B804(this); - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } else { - sub_0801B864(this); - if (this->speed < 0x280) { - this->speed += 8; + sub_0801B864(super); + if (super->speed < 0x280) { + super->speed += 8; } - this->direction = GetFacingDirection(this, &gPlayerEntity); - LinearMoveUpdate(this); - if (sub_0800419C(this, &gPlayerEntity, 2, 2) != 0) { + super->direction = GetFacingDirection(super, &gPlayerEntity); + LinearMoveUpdate(super); + if (sub_0800419C(super, &gPlayerEntity, 2, 2) != 0) { DeleteThisEntity(); } } } -void sub_0801B804(Entity* this) { +void sub_0801B804(PlayerItemBoomerangEntity* this) { EquipSlot equipSlot; u32 uVar1; @@ -225,7 +240,7 @@ void sub_0801B804(Entity* this) { } if ((uVar1 & gPlayerState.playerInput.heldInput) == 0) { - this->field_0x80.HALF.LO = 1; + this->unk_80 = 1; gPlayerState.field_0xa &= ~0x80; gPlayerState.keepFacing &= ~0x80; } else { diff --git a/src/playerItem/playerItemBottle.c b/src/playerItem/playerItemBottle.c index 798dc95e..27a266c1 100644 --- a/src/playerItem/playerItemBottle.c +++ b/src/playerItem/playerItemBottle.c @@ -1,53 +1,67 @@ +/** + * @file playerItemBottle.c + * @ingroup Items + * + * @brief Bottle Player Item + */ +#define NENT_DEPRECATED #include "entity.h" +#include "functions.h" +#include "item.h" +#include "object.h" #include "save.h" #include "sound.h" -#include "functions.h" -#include "object.h" -#include "item.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 bottleIndex; /**< @see Item */ + /*0x69*/ u8 unused[6]; + /*0x6f*/ u8 bottleContent; /**< @see Item */ +} PlayerItemBottleEntity; void PlayerItemBottle_UseEmptyBottle(Entity*); -void PlayerItemBottle_Action1(Entity*); +void PlayerItemBottle_Action1(PlayerItemBottleEntity*); void sub_0801BDE8(Entity*, Entity*); void PlayerItemBottle_UseEmptyBottle2(Entity*); -void PlayerItemBottle_UsePotionOrPicolyte(Entity*); -void PlayerItemBottle_UseOther(Entity*); -void PlayerItemBottle_Init(Entity*); +void PlayerItemBottle_UsePotionOrPicolyte(PlayerItemBottleEntity*); +void PlayerItemBottle_UseOther(PlayerItemBottleEntity*); +void PlayerItemBottle_Init(PlayerItemBottleEntity*); extern u32 SetBottleContents(u32 itemID, u32 bottleIndex); extern void sub_0801B9F0(Entity* this); -void PlayerItemBottle(Entity* this) { - static void (*const PlayerItemBottle_Actions[])(Entity*) = { +void PlayerItemBottle(PlayerItemBottleEntity* this) { + static void (*const PlayerItemBottle_Actions[])(PlayerItemBottleEntity*) = { PlayerItemBottle_Init, PlayerItemBottle_Action1, }; - PlayerItemBottle_Actions[this->action](this); + PlayerItemBottle_Actions[super->action](this); } -void PlayerItemBottle_Init(Entity* this) { - u32 bottleType; +void PlayerItemBottle_Init(PlayerItemBottleEntity* this) { + u32 bottleContent; - if (this->field_0x68.HALF.LO == ITEM_QST_DOGFOOD) { - bottleType = ITEM_QST_DOGFOOD; + if (this->bottleIndex == ITEM_QST_DOGFOOD) { + bottleContent = ITEM_QST_DOGFOOD; } else { - u32 tmp = this->field_0x68.HALF.LO; - bottleType = gSave.saved_status.field_0x24[tmp - 6]; + u32 tmp = this->bottleIndex; + bottleContent = gSave.stats.bottles[tmp - ITEM_BOTTLE1]; } - this->field_0x6e.HALF.HI = bottleType; - switch (bottleType) { + this->bottleContent = bottleContent; + switch (bottleContent) { case ITEM_BOTTLE_EMPTY: - if (AllocMutableHitbox(this) == NULL) { + if (AllocMutableHitbox(super) == NULL) { return; } - COLLISION_ON(this); - this->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20; - this->flags2 = gPlayerEntity.flags2; - this->hurtType = 0x1f; - this->type = 1; - this->type2 = ITEM_BOTTLE_EMPTY; - this->timer = 82; - this->subtimer = 27; - sub_0801766C(this); + COLLISION_ON(super); + super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20; + super->flags2 = gPlayerEntity.flags2; + super->hurtType = 0x1f; + super->type = 1; + super->type2 = ITEM_BOTTLE_EMPTY; + super->timer = 82; + super->subtimer = 27; + sub_0801766C(super); SoundReq(SFX_1DC); break; case ITEM_BOTTLE_BUTTER: @@ -61,43 +75,43 @@ void PlayerItemBottle_Init(Entity* this) { case ITEM_BOTTLE_PICOLYTE_GREEN: case ITEM_BOTTLE_PICOLYTE_BLUE: case ITEM_BOTTLE_PICOLYTE_WHITE: - this->timer = 213; - this->subtimer = 60; + super->timer = 213; + super->subtimer = 60; break; case BOTTLE_CHARM_NAYRU: case BOTTLE_CHARM_FARORE: case BOTTLE_CHARM_DIN: default: - this->timer = 55; - this->subtimer = 0; + super->timer = 55; + super->subtimer = 0; } - this->action = 1; - this->frameIndex = 0xff; - gPlayerState.item = this; - LoadSwapGFX(this, 1, 3); + super->action = 1; + super->frameIndex = 0xff; + gPlayerState.item = super; + LoadSwapGFX(super, 1, 3); PlayerItemBottle_Action1(this); } -void PlayerItemBottle_Action1(Entity* this) { - int iVar1; +void PlayerItemBottle_Action1(PlayerItemBottleEntity* this) { + u32 bottleIndex; - if (gPlayerState.item != this) { - if ((this->type == 1) && (this->type2 != ITEM_BOTTLE_EMPTY)) { - iVar1 = this->field_0x68.HALF.LO - 0x1c; - SetBottleContents(this->type2, iVar1); + if (gPlayerState.item != super) { + if ((super->type == 1) && (super->type2 != ITEM_BOTTLE_EMPTY)) { + bottleIndex = this->bottleIndex - ITEM_BOTTLE1; + SetBottleContents(super->type2, bottleIndex); #if defined(EU) || defined(JP) || defined(DEMO_JP) - CreateItemEntity(this->type2, iVar1, 5); + CreateItemEntity(super->type2, bottleIndex, 5); #else - InitItemGetSequence(this->type2, iVar1, 5); + InitItemGetSequence(super->type2, bottleIndex, 5); #endif SoundReq(SFX_ITEM_GET); } DeleteThisEntity(); } - sub_0801BDE8(this, &gPlayerEntity); - switch (this->field_0x6e.HALF.HI) { + sub_0801BDE8(super, &gPlayerEntity); + switch (this->bottleContent) { case ITEM_BOTTLE_EMPTY: - PlayerItemBottle_UseEmptyBottle2(this); + PlayerItemBottle_UseEmptyBottle2(super); break; case ITEM_BOTTLE_BUTTER: case ITEM_BOTTLE_MILK: @@ -127,15 +141,15 @@ void PlayerItemBottle_UseEmptyBottle2(Entity* this) { PlayerItemBottle_UseEmptyBottle(this); } -void PlayerItemBottle_UsePotionOrPicolyte(Entity* this) { +void PlayerItemBottle_UsePotionOrPicolyte(PlayerItemBottleEntity* this) { u32 health; - u32 bottleType; + u32 bottleContent; - bottleType = ITEM_BOTTLE_EMPTY; + bottleContent = ITEM_BOTTLE_EMPTY; health = 0; - switch (this->field_0x6e.HALF.HI) { + switch (this->bottleContent) { case ITEM_BOTTLE_MILK: - bottleType = ITEM_BOTTLE_HALF_MILK; + bottleContent = ITEM_BOTTLE_HALF_MILK; case ITEM_BOTTLE_HALF_MILK: health = 40; break; @@ -152,69 +166,69 @@ void PlayerItemBottle_UsePotionOrPicolyte(Entity* this) { case ITEM_BOTTLE_PICOLYTE_GREEN: case ITEM_BOTTLE_PICOLYTE_BLUE: case ITEM_BOTTLE_PICOLYTE_WHITE: - gSave.stats.picolyteType = this->field_0x6e.HALF.HI; + gSave.stats.picolyteType = this->bottleContent; gSave.stats.picolyteTimer = 900; SoundReq(SFX_PICOLYTE); break; } ModHealth(health); - SetBottleContents(bottleType, this->field_0x68.HALF.LO - 0x1c); + SetBottleContents(bottleContent, this->bottleIndex - 0x1c); } -void PlayerItemBottle_UseOther(Entity* this) { +void PlayerItemBottle_UseOther(PlayerItemBottleEntity* this) { if (gPlayerEntity.frame == 1) { - if (this->field_0x6e.HALF.HI != 0x36) { - SetBottleContents(ITEM_BOTTLE_EMPTY, this->field_0x68.HALF.LO - 0x1c); + if (this->bottleContent != ITEM_QST_DOGFOOD) { + SetBottleContents(ITEM_BOTTLE_EMPTY, this->bottleIndex - 0x1c); } - switch (this->field_0x6e.HALF.HI) { + switch (this->bottleContent) { case ITEM_BOTTLE_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0); break; case ITEM_BOTTLE_MINERAL_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 1); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 1, 1); break; case ITEM_BOTTLE_FAIRY: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 2, 2); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 2, 2); ModHealth(0x20); break; case BOTTLE_CHARM_NAYRU: case BOTTLE_CHARM_FARORE: case BOTTLE_CHARM_DIN: - gSave.stats.charm = this->field_0x6e.HALF.HI; + gSave.stats.charm = this->bottleContent; gSave.stats.charmTimer = 3600; SoundReq(SFX_ELEMENT_CHARGE); } } if (gPlayerEntity.frame == 2) { - switch (this->field_0x6e.HALF.HI) { + switch (this->bottleContent) { case ITEM_BOTTLE_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0); break; case ITEM_BOTTLE_MINERAL_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 1); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 1, 1); break; } } if (gPlayerEntity.frame == 3) { - switch (this->field_0x6e.HALF.HI) { + switch (this->bottleContent) { case ITEM_BOTTLE_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 0, 0); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0); break; case ITEM_BOTTLE_MINERAL_WATER: - CreateObjectWithParent(this, LINK_EMPTYING_BOTTLE, 1, 0); + CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 1, 0); break; } } } void sub_0801BDE8(Entity* this, Entity* ent2) { - u32 uVar1; + u32 frameIndex; u32 flipX; u32 animationState; - uVar1 = (ent2->frameIndex - this->timer) + this->subtimer; - if (uVar1 != this->frameIndex) { - this->frameIndex = uVar1; + frameIndex = (ent2->frameIndex - this->timer) + this->subtimer; + if (frameIndex != this->frameIndex) { + this->frameIndex = frameIndex; sub_080042D0(this, this->frameIndex, (u16)this->spriteIndex); } flipX = ent2->spriteSettings.flipX; @@ -235,8 +249,8 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) { 16, -12, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - int iVar2; - Hitbox* pHVar5; + s32 iVar2; + Hitbox* hitbox; const u8* ptr; const s8* ptr2; @@ -256,11 +270,11 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) { ptr = &bottleHitboxParameters[(this->frameIndex - 0x1b) * 4]; if (this->spriteSettings.flipX != 0) { - pHVar5 = this->hitbox; - pHVar5->offset_x = -ptr[0]; + hitbox = this->hitbox; + hitbox->offset_x = -ptr[0]; } else { - pHVar5 = this->hitbox; - pHVar5->offset_x = ptr[0]; + hitbox = this->hitbox; + hitbox->offset_x = ptr[0]; } this->hitbox->offset_y = ptr[1]; this->hitbox->width = ptr[2]; diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c index acde02b6..dc53f306 100644 --- a/src/playerItem/playerItemBow.c +++ b/src/playerItem/playerItemBow.c @@ -1,22 +1,27 @@ +/** + * @file playerItemBow.c + * @ingroup Items + * + * @brief Bow Player Item + */ #define NENT_DEPRECATED -#include "global.h" #include "asm.h" +#include "effects.h" #include "entity.h" #include "functions.h" -#include "effects.h" #include "object.h" #include "playeritem.h" -#include "sound.h" #include "save.h" +#include "sound.h" typedef struct { - Entity base; - u8 unk_68; - u8 unk_69[3]; - u32 unk_6c; - u32 unk_70; - u32 unk_74; - u32 unk_78; + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unk_69[3]; + /*0x6c*/ u32 unk_6c; + /*0x70*/ u32 unk_70; + /*0x74*/ u32 unk_74; + /*0x78*/ u32 unk_78; } PlayerItemBowEntity; typedef struct { @@ -37,20 +42,20 @@ extern Entity* sub_08008782(Entity*, u32, s32, s32); extern void sub_08017744(Entity*); extern void ModArrows(s32); -void sub_08019468(PlayerItemBowEntity*); -void sub_08018FE4(PlayerItemBowEntity*); -void sub_0801917C(PlayerItemBowEntity*); -void sub_08019410(PlayerItemBowEntity*); -void sub_08019444(PlayerItemBowEntity*); +void sub_08019468(PlayerItemBowEntity* this); +void PlayerItemBow_Init(PlayerItemBowEntity* this); +void PlayerItemBow_Action1(PlayerItemBowEntity* this); +void PlayerItemBow_Action2(PlayerItemBowEntity* this); +void PlayerItemBow_Action3(PlayerItemBowEntity* this); void PlayerItemBow(Entity* this) { - static void (*const gUnk_080B3E30[])(PlayerItemBowEntity*) = { - sub_08018FE4, - sub_0801917C, - sub_08019410, - sub_08019444, + static void (*const PlayerItemBow_Actions[])(PlayerItemBowEntity*) = { + PlayerItemBow_Init, + PlayerItemBow_Action1, + PlayerItemBow_Action2, + PlayerItemBow_Action3, }; - gUnk_080B3E30[this->action]((PlayerItemBowEntity*)this); + PlayerItemBow_Actions[this->action]((PlayerItemBowEntity*)this); } static const Hitbox gUnk_080B3E70; @@ -66,14 +71,14 @@ static const struct_080B3E40 gUnk_080B3E40[] = { static const Hitbox gUnk_080B3E70 = { 0, 0, { 4, 0, 0, 0 }, 6, 4 }; static const Hitbox gUnk_080B3E78 = { 0, 0, { 0, 0, 0, 4 }, 4, 6 }; -void sub_08018FE4(PlayerItemBowEntity* this) { +void PlayerItemBow_Init(PlayerItemBowEntity* this) { Entity* object; const struct_080B3E40* ptr; super->action = 1; if (super->type != 0) { super->spriteSettings.draw = 1; super->flags |= 0x80; - this->unk_74 = 0x6a; + this->unk_74 = 106; super->hurtType = super->type2; super->spriteIndex = 0xa6; if (super->hurtType == 0x0e) { @@ -114,7 +119,7 @@ void sub_08018FE4(PlayerItemBowEntity* this) { LoadSwapGFX(super, 1, 3); sub_08079BD8(super); if (this->unk_68 == 0xa) { - this->unk_78 = 0x3c; + this->unk_78 = 60; object = CreateObject(SWORD_PARTICLE, super->type, 1); if (object != NULL) { CopyPosition(super, object); @@ -122,11 +127,11 @@ void sub_08018FE4(PlayerItemBowEntity* this) { } else { this->unk_78 = 0; } - sub_0801917C(this); + PlayerItemBow_Action1(this); } } -void sub_0801917C(PlayerItemBowEntity* this) { +void PlayerItemBow_Action1(PlayerItemBowEntity* this) { u8 arrowCount; bool32 tmp2; s32 tmp3; @@ -138,7 +143,7 @@ void sub_0801917C(PlayerItemBowEntity* this) { DeleteThisEntity(); } GetNextFrame(super); - if (this->unk_74 < 0x18) { + if (this->unk_74 < 24) { super->spriteSettings.draw ^= 1; } LinearMoveUpdate(super); @@ -238,7 +243,7 @@ void sub_0801917C(PlayerItemBowEntity* this) { } } -void sub_08019410(PlayerItemBowEntity* this) { +void PlayerItemBow_Action2(PlayerItemBowEntity* this) { if (super->timer < 0xf) { InitializeAnimation(super, super->animIndex); } else { @@ -249,7 +254,7 @@ void sub_08019410(PlayerItemBowEntity* this) { } } -void sub_08019444(PlayerItemBowEntity* this) { +void PlayerItemBow_Action3(PlayerItemBowEntity* this) { GetNextFrame(super); LinearMoveUpdate(super); if (GravityUpdate(super, Q_8_8(32.0)) == 0) { @@ -258,7 +263,7 @@ void sub_08019444(PlayerItemBowEntity* this) { } void sub_08019468(PlayerItemBowEntity* this) { - if (super->hurtType == 0x0e) { + if (super->hurtType == 0xe) { CreateFx(super, FX_REFLECT5, 0); } } diff --git a/src/playerItem/playerItemCellOverwriteSet.c b/src/playerItem/playerItemCellOverwriteSet.c index 3c9e766a..7d30cdd6 100644 --- a/src/playerItem/playerItemCellOverwriteSet.c +++ b/src/playerItem/playerItemCellOverwriteSet.c @@ -1,77 +1,84 @@ +/** + * @file playerItemCellOverwriteSet.c + * @ingroup Items + * + * @brief Cell Overwrite Set Player Item + */ +#define NENT_DEPRECATED +#include "asm.h" +#include "common.h" #include "entity.h" #include "player.h" #include "room.h" -#include "common.h" -#include "asm.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[4]; + /*0x6c*/ u16 tileType; +} PlayerItemCellOverwriteSetEntity; extern const u8 gUnk_080B7910[]; extern const u8 gUnk_080B79A7[]; extern const u8 gUnk_080B7A3E[]; // TODO figure out type from arm_sub_080B1B84 and arm_sub_080B1BA4 -void PlayerItemCellOverwriteSet(Entity* this) { +void PlayerItemCellOverwriteSet(PlayerItemCellOverwriteSetEntity* this) { static const s8 gUnk_080B7B6C[] = { 0x0, -0x10, 0x10, 0x0, 0x0, 0x10, -0x10, 0x0 }; u32 tmp; Entity* player = &gPlayerEntity; - if (this->action == 0) { - this->field_0x6c.HWORD = - GetTileType(TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe], - player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]), - this->collisionLayer); - this->action++; + if (super->action == 0) { + this->tileType = GetTileType(TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe], + player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]), + super->collisionLayer); + super->action++; } gPlayerState.mobility |= 0x80; tmp = gInput.heldKeys & R_BUTTON; if ((gInput.heldKeys & A_BUTTON) != 0) { if ((R_BUTTON & gInput.newKeys) != 0) { - this->field_0x6c.HWORD = - GetTileType(TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe], - player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]), - this->collisionLayer); + this->tileType = GetTileType(TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe], + player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]), + super->collisionLayer); } if ((gInput.heldKeys & R_BUTTON) != 0) { player->iframes = 2; } else { if ((gInput.newKeys & DPAD_RIGHT) != 0) { - this->field_0x6c.HWORD--; + this->tileType--; } if ((gInput.newKeys & DPAD_LEFT) != 0) { - this->field_0x6c.HWORD++; + this->tileType++; } if ((gInput.heldKeys & (DPAD_LEFT | DPAD_RIGHT)) != 0) { - if (++this->subtimer > 0x1e) { - this->subtimer = 30; + if (++super->subtimer > 0x1e) { + super->subtimer = 30; if ((gInput.heldKeys & DPAD_RIGHT) != 0) { - this->field_0x6c.HWORD--; + this->tileType--; } if ((gInput.heldKeys & DPAD_LEFT) != 0) { - this->field_0x6c.HWORD++; + this->tileType++; } } } else { - this->subtimer = 0; + super->subtimer = 0; } } } else { - sub_0807B7D8(this->field_0x6c.HWORD, + sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe], player->y.HALF.HI + gUnk_080B7B6C[(player->animationState & 0xe) + 1]), - this->collisionLayer); + super->collisionLayer); gPlayerState.mobility &= ~0x80; DeleteThisEntity(); } if ((gInput.heldKeys & B_BUTTON) != 0) { - sub_0807B7D8(this->field_0x6c.HWORD, - TILE(player->x.HALF.HI + gUnk_080B7B6C[0], player->y.HALF.HI + gUnk_080B7B6C[1]), - this->collisionLayer); - sub_0807B7D8(this->field_0x6c.HWORD, - TILE(player->x.HALF.HI + gUnk_080B7B6C[2], player->y.HALF.HI + gUnk_080B7B6C[3]), - this->collisionLayer); - sub_0807B7D8(this->field_0x6c.HWORD, - TILE(player->x.HALF.HI + gUnk_080B7B6C[4], player->y.HALF.HI + gUnk_080B7B6C[5]), - this->collisionLayer); - sub_0807B7D8(this->field_0x6c.HWORD, - TILE(player->x.HALF.HI + gUnk_080B7B6C[6], player->y.HALF.HI + gUnk_080B7B6C[7]), - this->collisionLayer); + sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + gUnk_080B7B6C[0], player->y.HALF.HI + gUnk_080B7B6C[1]), + super->collisionLayer); + sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + gUnk_080B7B6C[2], player->y.HALF.HI + gUnk_080B7B6C[3]), + super->collisionLayer); + sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + gUnk_080B7B6C[4], player->y.HALF.HI + gUnk_080B7B6C[5]), + super->collisionLayer); + sub_0807B7D8(this->tileType, TILE(player->x.HALF.HI + gUnk_080B7B6C[6], player->y.HALF.HI + gUnk_080B7B6C[7]), + super->collisionLayer); } } diff --git a/src/playerItem/playerItemDashSword.c b/src/playerItem/playerItemDashSword.c index 5b86a216..59ba47ab 100644 --- a/src/playerItem/playerItemDashSword.c +++ b/src/playerItem/playerItemDashSword.c @@ -1,52 +1,56 @@ - +/** + * @file playerItemDashSword.c + * @ingroup Items + * + * @brief Dash Sword Player Item + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "functions.h" +#include "player.h" extern Entity* sub_08008782(Entity*, u32, s32, s32); -void sub_0801B8FC(Entity*); -void sub_0801B8B0(Entity*); -void sub_0801B938(Entity*); +void PlayerItemDashSword_Action1(Entity* this); +void PlayerItemDashSword_Init(Entity* this); +void sub_0801B938(Entity* this); extern void sub_08017744(Entity*); void PlayerItemDashSword(Entity* this) { - static void (*const PlayerItemC_Actions[])(Entity*) = { - sub_0801B8B0, - sub_0801B8FC, + static void (*const PlayerItemDashSword_Actions[])(Entity*) = { + PlayerItemDashSword_Init, + PlayerItemDashSword_Action1, }; - PlayerItemC_Actions[this->action](this); + PlayerItemDashSword_Actions[this->action](this); } -void sub_0801B8B0(Entity* this) { +void PlayerItemDashSword_Init(Entity* this) { if (gPlayerState.dash_state != 0) { gPlayerState.item = this; this->flags |= ENT_PERSIST; - this->action = 0x01; + this->action = 1; this->flags2 = 8; LoadSwapGFX(this, 1, 3); sub_08079BD8(this); sub_0801766C(this); - sub_0801B8FC(this); + PlayerItemDashSword_Action1(this); } else { DeleteThisEntity(); } } -void sub_0801B8FC(Entity* this) { - Entity* pbVar1; - pbVar1 = (Entity*)gPlayerState.item; - if ((Entity*)gPlayerState.item != this) { +void PlayerItemDashSword_Action1(Entity* this) { + if (gPlayerState.item != this) { DeleteThisEntity(); } else { if (gPlayerState.dash_state == 0) { gPlayerState.item = NULL; DeleteThisEntity(); } else { - pbVar1->flags |= ENT_COLLIDE; - pbVar1->collisionFlags = 0x21; - sub_0801B938(pbVar1); + this->flags |= ENT_COLLIDE; + this->collisionFlags = 0x21; + sub_0801B938(this); } } } diff --git a/src/playerItem/playerItemFireRodProjectile.c b/src/playerItem/playerItemFireRodProjectile.c index 3c65c353..9c12f1c2 100644 --- a/src/playerItem/playerItemFireRodProjectile.c +++ b/src/playerItem/playerItemFireRodProjectile.c @@ -1,46 +1,52 @@ +/** + * @file playerItemFireRodProjectile.c + * @ingroup Items + * + * @brief Fire Rod Projectile Player Item + */ #define NENT_DEPRECATED #include "asm.h" -#include "entity.h" -#include "sound.h" -#include "physics.h" -#include "functions.h" #include "effects.h" +#include "entity.h" +#include "functions.h" +#include "physics.h" #include "playeritem.h" +#include "sound.h" typedef struct { - Entity base; - u8 unk68; - u16 unk6a; - u32 unk6c; -} FireRodProjectileEntity; + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x6a*/ u8 unused[2]; + /*0x6c*/ u32 unk_6c; +} PlayerItemFireRodProjectileEntity; extern u8 gUnk_08003E44; -void sub_080A3084(FireRodProjectileEntity*); -void sub_080A310C(FireRodProjectileEntity*); +void PlayerItemFireRodProjectile_Init(PlayerItemFireRodProjectileEntity* this); +void PlayerItemFireRodProjectile_Action1(PlayerItemFireRodProjectileEntity* this); void PlayerItemFireRodProjectile(Entity* this) { - static void (*const actionFuncs[])(FireRodProjectileEntity*) = { - sub_080A3084, - sub_080A310C, + static void (*const PlayerItemFireRodProjectile_Actions[])(PlayerItemFireRodProjectileEntity*) = { + PlayerItemFireRodProjectile_Init, + PlayerItemFireRodProjectile_Action1, }; - actionFuncs[this->action]((FireRodProjectileEntity*)this); + PlayerItemFireRodProjectile_Actions[this->action]((PlayerItemFireRodProjectileEntity*)this); } -void sub_080A3084(FireRodProjectileEntity* this) { +void PlayerItemFireRodProjectile_Init(PlayerItemFireRodProjectileEntity* this) { static const Hitbox gUnk_08127278 = { 0, 0, { 4, 2, 2, 4 }, 6, 6 }; super->spriteSettings.draw = 1; - super->action = 0x01; + super->action = 1; CopyPosition(super->parent, super); if (super->type == 0) { super->collisionFlags = gPlayerEntity.collisionFlags + 1; super->hitbox = (Hitbox*)&gUnk_08127278; super->speed = 0x400; - if (super->collisionLayer == 0x02) { - super->type2 = 0x01; + if (super->collisionLayer == 2) { + super->type2 = 1; } super->direction = Direction8FromAnimationState(super->animationState); - this->unk6c = 60; + this->unk_6c = 60; sub_0801766C(super); LinearMoveUpdate(super); SoundReq(SFX_ITEM_SWORD_BEAM); @@ -48,17 +54,17 @@ void sub_080A3084(FireRodProjectileEntity* this) { super->timer = 6; } InitializeAnimation(super, 0x18); - sub_080A310C(this); + PlayerItemFireRodProjectile_Action1(this); } -void sub_080A310C(FireRodProjectileEntity* this) { +void PlayerItemFireRodProjectile_Action1(PlayerItemFireRodProjectileEntity* this) { if (super->type != 0) { if (super->timer-- == 0) { DeleteThisEntity(); } } else { GetNextFrame(super); - if (this->unk6c-- != 0) { + if (this->unk_6c-- != 0) { GetNextFrame(super); LinearMoveUpdate(super); super->timer++; @@ -77,7 +83,7 @@ void sub_080A310C(FireRodProjectileEntity* this) { if (sub_08008790(super, 0xc)) { DeleteThisEntity(); } - super->child = CreatePlayerItem(PLAYER_ITEM_FIRE_ROD_PROJECTILE, 1, 0, this->unk68); + super->child = CreatePlayerItem(PLAYER_ITEM_FIRE_ROD_PROJECTILE, 1, 0, this->unk_68); if (super->child != NULL) { super->child->parent = super; } diff --git a/src/playerItem/playerItemGust.c b/src/playerItem/playerItemGust.c index 8d62b981..9f098a71 100644 --- a/src/playerItem/playerItemGust.c +++ b/src/playerItem/playerItemGust.c @@ -1,9 +1,15 @@ +/** + * @file playerItemGust.c + * @ingroup Items + * + * @brief Gust Player Item + */ #define NENT_DEPRECATED -#include "entity.h" -#include "player.h" -#include "functions.h" #include "asm.h" +#include "entity.h" +#include "functions.h" #include "object.h" +#include "player.h" #include "playeritem.h" enum { @@ -12,20 +18,21 @@ enum { }; typedef struct { - Entity base; - u32 filler68[2]; - u32 timer; - u32 offset_iter; - u32 unk78; -} GustEntity; -typedef void(GustActionFunc)(GustEntity*); + /*0x00*/ Entity base; + /*0x68*/ u32 filler68[2]; + /*0x70*/ u32 timer; + /*0x74*/ u32 offset_iter; + /*0x78*/ u32 unk78; +} PlayerItemGustEntity; + +typedef void(GustActionFunc)(PlayerItemGustEntity*); static GustActionFunc PlayerItemGust_Init; static GustActionFunc PlayerItemGust_Update; -static void sub_080ACC78(GustEntity*); -/*static*/ bool32 sub_080ACDB0(GustEntity*); -static void sub_080ACECC(GustEntity*); +static void sub_080ACC78(PlayerItemGustEntity*); +/*static*/ bool32 sub_080ACDB0(PlayerItemGustEntity*); +static void sub_080ACECC(PlayerItemGustEntity*); typedef struct { u16 bits; @@ -50,7 +57,7 @@ extern const s8 gUnk_08126EE4[]; // type 2: same as 1? // type 3: horizontal spread void PlayerItemGust(Entity* this) { - static GustActionFunc* const sActions[] = { + static GustActionFunc* const PlayerItemGust_Actions[] = { PlayerItemGust_Init, PlayerItemGust_Update, }; @@ -58,11 +65,11 @@ void PlayerItemGust(Entity* this) { if ((gPlayerState.field_0x1c & 0x7f) != 1) { DeleteThisEntity(); } - sActions[this->action]((GustEntity*)this); + PlayerItemGust_Actions[this->action]((PlayerItemGustEntity*)this); this->iframes = 0; } -static void PlayerItemGust_Init(GustEntity* this) { +static void PlayerItemGust_Init(PlayerItemGustEntity* this) { super->action = GUST_UPDATE; super->flags2 = gPlayerEntity.flags2; super->direction = super->animationState << 2; @@ -75,14 +82,14 @@ static void PlayerItemGust_Init(GustEntity* this) { sub_0801766C(super); } -static void PlayerItemGust_Update(GustEntity* this) { +static void PlayerItemGust_Update(PlayerItemGustEntity* this) { if (sub_080ACDB0(this) == FALSE) { sub_080ACC78(this); sub_080ACECC(this); } } -static void sub_080ACC78(GustEntity* this) { +static void sub_080ACC78(PlayerItemGustEntity* this) { s32 width; Obj11* o; Entity* child; @@ -151,7 +158,7 @@ static void sub_080ACC78(GustEntity* this) { } } -bool32 sub_080ACDB0(GustEntity* this) { +bool32 sub_080ACDB0(PlayerItemGustEntity* this) { s32 sVar2; s32 sVar3; Entity* pEVar4; @@ -217,7 +224,7 @@ bool32 sub_080ACDB0(GustEntity* this) { return 0; } -static void sub_080ACECC(GustEntity* this) { +static void sub_080ACECC(PlayerItemGustEntity* this) { Entity* entity; if (super->type < 3 && super->child == NULL && (s32)this->unk78 >= 0 && gUnk_0812AAE8[super->type] <= this->unk78) { diff --git a/src/playerItem/playerItemGustBig.c b/src/playerItem/playerItemGustBig.c index 7e69b965..550c2e6e 100644 --- a/src/playerItem/playerItemGustBig.c +++ b/src/playerItem/playerItemGustBig.c @@ -1,31 +1,46 @@ -#include "global.h" -#include "entity.h" -#include "player.h" -#include "functions.h" -#include "sound.h" +/** + * @file playerItemGustBig.c + * @ingroup Items + * + * @brief Gust Big Player Item + */ +#define NENT_DEPRECATED #include "asm.h" +#include "entity.h" +#include "functions.h" +#include "global.h" +#include "new_player.h" +#include "player.h" +#include "sound.h" -extern void sub_08078CD0(Entity*); -extern void sub_08018FA0(Entity*); -extern void sub_08018CBC(Entity*); -extern void sub_08018DE8(Entity*); -extern void sub_08018E68(Entity*); -extern void sub_08018F6C(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[24]; + /*0x80*/ u32 unk_80; + /*0x84*/ u32 unk_84; +} PlayerItemGustBigEntity; + +extern void sub_08078CD0(Entity* this); +extern void sub_08018FA0(Entity* this); +extern void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this); +extern void PlayerItemGustBig_Action1(PlayerItemGustBigEntity* this); +extern void PlayerItemGustBig_Action2(PlayerItemGustBigEntity* this); +extern void PlayerItemGustBig_Action3(PlayerItemGustBigEntity* this); extern u32 sub_08007DD6(u32, const u16*); extern const u8 gUnk_08003E44[]; -void PlayerItemGustBig(Entity* this) { - static void (*const gUnk_080B3DD0[])(Entity*) = { - sub_08018CBC, - sub_08018DE8, - sub_08018E68, - sub_08018F6C, +void PlayerItemGustBig(PlayerItemGustBigEntity* this) { + static void (*const PlayerItemGustBig_Actions[])(PlayerItemGustBigEntity*) = { + PlayerItemGustBig_Init, + PlayerItemGustBig_Action1, + PlayerItemGustBig_Action2, + PlayerItemGustBig_Action3, }; - if (this->health) { - this->iframes = 0; - gUnk_080B3DD0[this->action](this); + if (super->health) { + super->iframes = 0; + PlayerItemGustBig_Actions[super->action](this); } else { DeleteThisEntity(); } @@ -48,95 +63,95 @@ static const Hitbox gUnk_080B3E18 = { 0, 0, { 6, 3, 3, 6 }, 6, 6 }; static const Hitbox gUnk_080B3E20 = { 0, 0, { 6, 3, 3, 6 }, 8, 8 }; static const Hitbox gUnk_080B3E28 = { 0, 0, { 6, 3, 3, 6 }, 12, 12 }; -void sub_08018CBC(Entity* this) { +void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this) { u32 PVar1; u8 uVar2; Entity* pEVar3; - *(u32*)&this->cutsceneBeh = this->x.WORD = gPlayerEntity.x.WORD; - *(u32*)&this->field_0x80 = this->y.WORD = gPlayerEntity.y.WORD; - uVar2 = this->animationState = gPlayerEntity.animationState & 0xe; - this->direction = (u8)(uVar2 << 2); - this->speed = 0x400; - this->hitType = 0x96; - this->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x80; - this->flags2 = gPlayerEntity.flags2; - pEVar3 = this->child; + this->unk_84 = super->x.WORD = gPlayerEntity.x.WORD; + this->unk_80 = super->y.WORD = gPlayerEntity.y.WORD; + uVar2 = super->animationState = gPlayerEntity.animationState & 0xe; + super->direction = (u8)(uVar2 << 2); + super->speed = 0x400; + super->hitType = 0x96; + super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x80; + super->flags2 = gPlayerEntity.flags2; + pEVar3 = super->child; if (pEVar3 != NULL) { - this->action = 1; - COLLISION_OFF(this); - this->timer = 86; - this->hurtType = 0x1c; - this->damage = 6; - this->hitbox = (Hitbox*)&gUnk_080B3E18; - this->child->spriteOffsetX = 0; - this->child->spriteSettings.draw = 0; + super->action = 1; + COLLISION_OFF(super); + super->timer = 86; + super->hurtType = 0x1c; + super->damage = 6; + super->hitbox = (Hitbox*)&gUnk_080B3E18; + super->child->spriteOffsetX = 0; + super->child->spriteSettings.draw = 0; } else { if (gPlayerState.field_0x1c == 0) { DeleteThisEntity(); } - this->action = 2; - this->spriteSettings.draw = 1; - this->spriteIndex = 0xa6; - this->palette.raw = 0x33; - this->spriteVramOffset = 0; - this->type = gPlayerState.gustJarSpeed - 1; - this->timer = gUnk_080B3DE0[this->type * 2]; - this->damage = gUnk_080B3DE0[this->type * 2 + 1]; - this->hurtType = 0x1b; - this->hitbox = (Hitbox*)gUnk_080B3DE8[this->type]; - (u32*)gPlayerEntity.field_0x70.WORD = this; + super->action = 2; + super->spriteSettings.draw = 1; + super->spriteIndex = 0xa6; + super->palette.raw = 0x33; + super->spriteVramOffset = 0; + super->type = gPlayerState.gustJarSpeed - 1; + super->timer = gUnk_080B3DE0[super->type * 2]; + super->damage = gUnk_080B3DE0[super->type * 2 + 1]; + super->hurtType = 0x1b; + super->hitbox = (Hitbox*)gUnk_080B3DE8[super->type]; + gNewPlayerEntity.unk_70 = super; sub_08078CD0(&gPlayerEntity); - (u32*)gPlayerEntity.field_0x70.WORD = pEVar3; - InitializeAnimation(this, this->type + 10); - sub_08018FA0(this); + gNewPlayerEntity.unk_70 = pEVar3; + InitializeAnimation(super, super->type + 10); + sub_08018FA0(super); } - sub_0801766C(this); + sub_0801766C(super); } -void sub_08018DE8(Entity* this) { +void PlayerItemGustBig_Action1(PlayerItemGustBigEntity* this) { u8 bVar1; - bVar1 = this->child->gustJarState & 4; + bVar1 = super->child->gustJarState & 4; if (bVar1 == 0) { gPlayerState.field_0x1c = bVar1; DeleteThisEntity(); } switch (gPlayerState.field_0x1c) { case 0: - sub_08018F6C(this); + PlayerItemGustBig_Action3(this); break; case 5: - this->child->subAction = 4; - COLLISION_ON(this); - this->action = 2; - this->spritePriority.b0 = 2; - this->child->spriteSettings.draw = 1; - sub_08018FA0(this); + super->child->subAction = 4; + COLLISION_ON(super); + super->action = 2; + super->spritePriority.b0 = 2; + super->child->spriteSettings.draw = 1; + sub_08018FA0(super); break; } sub_08078CD0(&gPlayerEntity); } -void sub_08018E68(Entity* this) { +void PlayerItemGustBig_Action2(PlayerItemGustBigEntity* this) { s32 y; s32 x; - if (this->child == NULL) { - GetNextFrame(this); - sub_08008790(this, 5); + if (super->child == NULL) { + GetNextFrame(super); + sub_08008790(super, 5); } else { - if ((this->child->gustJarState & 4) == 0) { + if ((super->child->gustJarState & 4) == 0) { DeleteThisEntity(); } - if ((this->contactFlags & 0x80) != 0) { - sub_08018F6C(this); + if ((super->contactFlags & 0x80) != 0) { + PlayerItemGustBig_Action3(this); return; } } - if (this->timer-- != 0) { - LinearMoveUpdate(this); + if (super->timer-- != 0) { + LinearMoveUpdate(super); - switch (this->direction) { + switch (super->direction) { case DirectionNorth: x = 0; y = -4; @@ -154,38 +169,38 @@ void sub_08018E68(Entity* this) { y = 0; break; } - if (this->child != NULL) { - this->child->direction = this->direction; - CopyPosition(this, this->child); + if (super->child != NULL) { + super->child->direction = super->direction; + CopyPosition(super, super->child); } - if (this->type2 == 0) { - sub_0800451C(this); + if (super->type2 == 0) { + sub_0800451C(super); } - if (sub_08007DD6(sub_080B1A0C(this, x, y), gUnk_080B3DF4) != 0) { + if (sub_08007DD6(sub_080B1A0C(super, x, y), gUnk_080B3DF4) != 0) { return; } - if (GetRelativeCollisionTile(this, x, y) == 0x74) { + if (GetRelativeCollisionTile(super, x, y) == 0x74) { return; } - if (sub_080040D8(this, (u8*)gUnk_08003E44, this->x.HALF.HI + x, this->y.HALF.HI + y) == 0) { + if (sub_080040D8(super, (u8*)gUnk_08003E44, super->x.HALF.HI + x, super->y.HALF.HI + y) == 0) { return; } } - if (this->child == NULL) { - InitializeAnimation(this, this->type + 0xd); + if (super->child == NULL) { + InitializeAnimation(super, super->type + 0xd); } - this->action++; - sub_08018F6C(this); + super->action++; + PlayerItemGustBig_Action3(this); } -void sub_08018F6C(Entity* this) { - if (this->child != NULL) { - this->child->subAction = 5; - this->child->spriteSettings.draw = 1; +void PlayerItemGustBig_Action3(PlayerItemGustBigEntity* this) { + if (super->child != NULL) { + super->child->subAction = 5; + super->child->spriteSettings.draw = 1; } else { - GetNextFrame(this); - if (this->frame == 0) { + GetNextFrame(super); + if (super->frame == 0) { return; } } @@ -194,8 +209,8 @@ void sub_08018F6C(Entity* this) { void sub_08018FA0(Entity* this) { this->collisionLayer = gPlayerEntity.collisionLayer; - if (this->collisionLayer == 0x02) { - this->type2 = 0x01; + if (this->collisionLayer == 2) { + this->type2 = 1; } SoundReq(this->type + SFX_EA); } diff --git a/src/playerItem/playerItemGustJar.c b/src/playerItem/playerItemGustJar.c index a63fdf3f..6e572616 100644 --- a/src/playerItem/playerItemGustJar.c +++ b/src/playerItem/playerItemGustJar.c @@ -1,6 +1,13 @@ +/** + * @file playerItemGustJar.c + * @ingroup Items + * + * @brief Gust Jar Player Item + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "functions.h" +#include "player.h" #include "sound.h" extern const u8* gUnk_08132714[]; // Anim index lists? @@ -18,7 +25,7 @@ void sub_080ADCDC(Entity*, u32); void sub_080ADCA0(Entity*, u32); void PlayerItemGustJar(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { + static void (*const PlayerItemGustJar_Actions[])(Entity*) = { PlayerItemGustJar_Init, PlayerItemGustJar_Action1, PlayerItemGustJar_Action2, PlayerItemGustJar_Action3, PlayerItemGustJar_Action4, }; @@ -26,7 +33,7 @@ void PlayerItemGustJar(Entity* this) { if (((Entity*)gPlayerState.item != this) || (gPlayerState.field_0x1c == 0)) { DeleteThisEntity(); } - actionFuncs[this->action](this); + PlayerItemGustJar_Actions[this->action](this); sub_08078E84(this, &gPlayerEntity); } diff --git a/src/playerItem/playerItemHeldObject.c b/src/playerItem/playerItemHeldObject.c index b470c242..5f454d37 100644 --- a/src/playerItem/playerItemHeldObject.c +++ b/src/playerItem/playerItemHeldObject.c @@ -1,24 +1,25 @@ +/** + * @file playerItemHeldObject.c + * @ingroup Items + * + * @brief Held Object Player Item + */ #define NENT_DEPRECATED -#include "entity.h" -#include "functions.h" -#include "player.h" -#include "new_player.h" #include "asm.h" #include "effects.h" +#include "entity.h" #include "functions.h" -#include "player.h" #include "new_player.h" +#include "player.h" #include "sound.h" -#include "functions.h" -#include "new_player.h" -#include "player.h" typedef struct { - Entity base; - u8 unk_68[4]; - u16 unk_6c; - u16 unk_6e; + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68[4]; + /*0x6c*/ u16 unk_6c; + /*0x6e*/ u16 unk_6e; } PlayerItemHeldObjectEntity; + extern bool32 ProcessMovement10(Entity*); typedef struct { @@ -28,26 +29,26 @@ typedef struct { u8 unk3; } struct_gUnk_081320B8; -bool32 sub_080AD32C(PlayerItemHeldObjectEntity*); -void sub_080AD27C(PlayerItemHeldObjectEntity*); -void sub_080ACF2C(PlayerItemHeldObjectEntity*); -void sub_080ACFCC(PlayerItemHeldObjectEntity*); -void sub_080AD040(PlayerItemHeldObjectEntity*); -void sub_080AD274(PlayerItemHeldObjectEntity*); +bool32 sub_080AD32C(PlayerItemHeldObjectEntity* this); +void sub_080AD27C(PlayerItemHeldObjectEntity* this); +void PlayerItemHeldObject_SubAction0(PlayerItemHeldObjectEntity* this); +void PlayerItemHeldObject_SubAction1(PlayerItemHeldObjectEntity* this); +void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this); +void PlayerItemHeldObject_SubAction3(PlayerItemHeldObjectEntity* this); void PlayerItemHeldObject(Entity* this) { - static void (*const subActionFuncs[])(PlayerItemHeldObjectEntity*) = { - sub_080ACF2C, - sub_080ACFCC, - sub_080AD040, - sub_080AD274, + static void (*const PlayerItemHeldObject_SubActions[])(PlayerItemHeldObjectEntity*) = { + PlayerItemHeldObject_SubAction0, + PlayerItemHeldObject_SubAction1, + PlayerItemHeldObject_SubAction2, + PlayerItemHeldObject_SubAction3, }; - subActionFuncs[this->subAction]((PlayerItemHeldObjectEntity*)this); + PlayerItemHeldObject_SubActions[this->subAction]((PlayerItemHeldObjectEntity*)this); } static const Hitbox3D gUnk_081320E4; -void sub_080ACF2C(PlayerItemHeldObjectEntity* this) { +void PlayerItemHeldObject_SubAction0(PlayerItemHeldObjectEntity* this) { static const struct_gUnk_081320B8 gUnk_081320B8[] = { { 0, 2, 0xe8, 0 }, { 0, 5, 0xe0, 0 }, { 0, 5, 0xf2, 0 } }; PlayerItemHeldObjectEntity* child; PlayerItemHeldObjectEntity* child2; @@ -80,7 +81,7 @@ void sub_080ACF2C(PlayerItemHeldObjectEntity* this) { this->unk_6e = (child->base).id; } -void sub_080ACFCC(PlayerItemHeldObjectEntity* this) { +void PlayerItemHeldObject_SubAction1(PlayerItemHeldObjectEntity* this) { Entity* child = super->child; if ((this->unk_6c == child->kind) || (this->unk_6e == child->id)) { if (child->action != 2) { @@ -101,7 +102,7 @@ void sub_080ACFCC(PlayerItemHeldObjectEntity* this) { } } -void sub_080AD040(PlayerItemHeldObjectEntity* this) { +void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this) { static const s8 gUnk_081320C4[] = { 0, -6, 6, 0, 0, 6, -6, 0, }; @@ -222,7 +223,7 @@ void sub_080AD040(PlayerItemHeldObjectEntity* this) { } } -void sub_080AD274(PlayerItemHeldObjectEntity* this) { +void PlayerItemHeldObject_SubAction3(PlayerItemHeldObjectEntity* this) { DeleteThisEntity(); } diff --git a/src/playerItem/playerItemLantern.c b/src/playerItem/playerItemLantern.c index 6d22375e..0883dd78 100644 --- a/src/playerItem/playerItemLantern.c +++ b/src/playerItem/playerItemLantern.c @@ -1,27 +1,33 @@ +/** + * @file playerItemLantern.c + * @ingroup Items + * + * @brief Lantern Player Item + */ +#define NENT_DEPRECATED #include "entity.h" -#include "player.h" #include "functions.h" #include "item.h" #include "object.h" +#include "player.h" -void sub_08054AC8(Entity*); -void sub_08054A60(Entity*); +void PlayerItemLantern_Init(Entity* this); +void PlayerItemLantern_Action1(Entity* this); void PlayerItemLantern(Entity* this) { - static void (*const gUnk_080FEEA8[])(Entity*) = { - sub_08054A60, - sub_08054AC8, + static void (*const PlayerItemLantern_Actions[])(Entity*) = { + PlayerItemLantern_Init, + PlayerItemLantern_Action1, }; - gUnk_080FEEA8[this->action](this); + PlayerItemLantern_Actions[this->action](this); this->contactFlags = 0; } -void sub_08054A60(Entity* this) { +void PlayerItemLantern_Init(Entity* this) { this->flags |= (ENT_PERSIST | ENT_COLLIDE); this->action = 1; this->timer = 4; this->frameIndex = -1; - // TODO regalloc and mov 6 too early this->updatePriority = 6; this->collisionFlags = 7; this->flags2 = -0x80; @@ -31,10 +37,10 @@ void sub_08054A60(Entity* this) { } sub_0801766C(this); LoadSwapGFX(this, 1, 3); - sub_08054AC8(this); + PlayerItemLantern_Action1(this); } -void sub_08054AC8(Entity* this) { +void PlayerItemLantern_Action1(Entity* this) { Entity* object; static const s8 offsets[] = { 6, -6, 7, -3, -5, 2, -7, -3 }; this->animationState = gPlayerEntity.animationState & 0xe; diff --git a/src/playerItem/playerItemPacciCane.c b/src/playerItem/playerItemPacciCane.c index 5a9fbd14..cc11837b 100644 --- a/src/playerItem/playerItemPacciCane.c +++ b/src/playerItem/playerItemPacciCane.c @@ -1,9 +1,16 @@ -#include "entity.h" -#include "sound.h" -#include "functions.h" +/** + * @file playerItemPacciCane.c + * @ingroup Items + * + * @brief Pacci Cane Player Item + */ +#define NENT_DEPRECATED #include "common.h" +#include "entity.h" +#include "functions.h" #include "message.h" #include "save.h" +#include "sound.h" #include "structures.h" void PlayerItemPacciCane_Action1(Entity*); diff --git a/src/playerItem/playerItemPacciCaneProjectile.c b/src/playerItem/playerItemPacciCaneProjectile.c index bdb9e215..0aec528a 100644 --- a/src/playerItem/playerItemPacciCaneProjectile.c +++ b/src/playerItem/playerItemPacciCaneProjectile.c @@ -1,26 +1,45 @@ +/** + * @file playerItemPacciCaneProjectile.c + * @ingroup Items + * + * @brief Pacci Cane Projectile Player Item + */ +#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" -#include "sound.h" #include "object.h" +#include "sound.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[4]; + /*0x6c*/ u32 unk_6c; + /*0x70*/ u32 unk_70; + /*0x74*/ s32 unk_74; + /*0x78*/ s32 unk_78; + /*0x7c*/ u32 unk_7c; +} PlayerItemPacciCaneProjectileEntity; static const Hitbox gUnk_0811B9D0; -void PlayerItemPacciCaneProjectile_Init(Entity* this); -void sub_080701F8(Entity* this); -void sub_0807037C(Entity* this); -void sub_08070398(Entity* this); -void sub_080703BC(Entity* this); -void sub_08070458(Entity* this); +void PlayerItemPacciCaneProjectile_Init(PlayerItemPacciCaneProjectileEntity* this); +void PlayerItemPacciCaneProjectile_Action1(PlayerItemPacciCaneProjectileEntity* this); +void PlayerItemPacciCaneProjectile_Action2(PlayerItemPacciCaneProjectileEntity* this); +void PlayerItemPacciCaneProjectile_Action3(PlayerItemPacciCaneProjectileEntity* this); +void PlayerItemPacciCaneProjectile_Action4(PlayerItemPacciCaneProjectileEntity* this); +void sub_08070458(PlayerItemPacciCaneProjectileEntity* this); extern void sub_08017744(Entity*); extern u8* sub_08008782(Entity*, u32, u32, u32); -void PlayerItemPacciCaneProjectile(Entity* this) { - static void (*const PlayerItemPacciCaneProjectile_Actions[])(Entity*) = { - PlayerItemPacciCaneProjectile_Init, sub_080701F8, sub_0807037C, sub_08070398, sub_080703BC, +void PlayerItemPacciCaneProjectile(PlayerItemPacciCaneProjectileEntity* this) { + static void (*const PlayerItemPacciCaneProjectile_Actions[])(PlayerItemPacciCaneProjectileEntity*) = { + PlayerItemPacciCaneProjectile_Init, PlayerItemPacciCaneProjectile_Action1, + PlayerItemPacciCaneProjectile_Action2, PlayerItemPacciCaneProjectile_Action3, + PlayerItemPacciCaneProjectile_Action4, }; - PlayerItemPacciCaneProjectile_Actions[this->action](this); + PlayerItemPacciCaneProjectile_Actions[super->action](this); } extern u8 gUnk_08003E44; @@ -34,7 +53,7 @@ typedef struct { u8 filler[3]; } gUnk_0811B9A8_struct; -void PlayerItemPacciCaneProjectile_Init(Entity* this) { +void PlayerItemPacciCaneProjectile_Init(PlayerItemPacciCaneProjectileEntity* this) { static const s8 gUnk_0811B9A0[] = { 0, -18, 14, 0, 0, 14, -14, 0, }; @@ -46,36 +65,36 @@ void PlayerItemPacciCaneProjectile_Init(Entity* this) { }; const gUnk_0811B9A8_struct* ptr; - this->action = 1; - this->spriteSettings.draw = 1; - COLLISION_ON(this); - this->direction = this->animationState << 2; - this->speed = 0x200; - *(u32*)&this->field_0x74 = 0x40; - *(u32*)&this->field_0x78 = 0x1e0; - this->x.HALF.HI = gPlayerEntity.x.HALF.HI + gUnk_0811B9A0[this->animationState]; - this->y.HALF.HI = gPlayerEntity.y.HALF.HI + gUnk_0811B9A0[this->animationState + 1]; - this->collisionFlags = 7; - this->flags2 = 0x8a; - this->hitbox = (Hitbox*)&gUnk_0811B9D0; - if (this->collisionLayer == 2) { - this->type = 1; + super->action = 1; + super->spriteSettings.draw = 1; + COLLISION_ON(super); + super->direction = super->animationState << 2; + super->speed = 0x200; + this->unk_74 = 0x40; + this->unk_78 = 0x1e0; + super->x.HALF.HI = gPlayerEntity.x.HALF.HI + gUnk_0811B9A0[super->animationState]; + super->y.HALF.HI = gPlayerEntity.y.HALF.HI + gUnk_0811B9A0[super->animationState + 1]; + super->collisionFlags = 7; + super->flags2 = 0x8a; + super->hitbox = (Hitbox*)&gUnk_0811B9D0; + if (super->collisionLayer == 2) { + super->type = 1; } else { - this->type = 0; + super->type = 0; } - this->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; - ptr = &gUnk_0811B9A8[(this->animationState >> 1)]; - this->spriteSettings.flipX = ptr->flipX; - this->spriteSettings.flipY = ptr->flipY; - this->animIndex = ptr->animIndex; - *(int*)&this->field_0x6c = ptr->unk2; - this->field_0x70.WORD = ptr->unk3; - sub_0801766C(this); - InitializeAnimation(this, this->animIndex); + super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; + ptr = &gUnk_0811B9A8[(super->animationState >> 1)]; + super->spriteSettings.flipX = ptr->flipX; + super->spriteSettings.flipY = ptr->flipY; + super->animIndex = ptr->animIndex; + this->unk_6c = ptr->unk2; + this->unk_70 = ptr->unk3; + sub_0801766C(super); + InitializeAnimation(super, super->animIndex); SoundReq(SFX_1DD); } -void sub_080701F8(Entity* this) { +void PlayerItemPacciCaneProjectile_Action1(PlayerItemPacciCaneProjectileEntity* this) { static const s8 gUnk_0811B9C8[] = { 0, -4, 4, 0, 0, 4, -4, 0, }; @@ -84,87 +103,87 @@ void sub_080701F8(Entity* this) { u8* iVar3; Entity* pEVar4; - cVar1 = gUnk_0811B9C8[this->animationState]; - cVar2 = gUnk_0811B9C8[this->animationState + 1]; - iVar3 = sub_08008782(this, 10, cVar1, cVar2); + cVar1 = gUnk_0811B9C8[super->animationState]; + cVar2 = gUnk_0811B9C8[super->animationState + 1]; + iVar3 = sub_08008782(super, 10, cVar1, cVar2); if (iVar3) { pEVar4 = CreateObject(OBJECT_53, iVar3[5], iVar3[2]); if (pEVar4) { pEVar4->timer = iVar3[3]; - pEVar4->x.HALF.HI = this->x.HALF.HI + cVar1; - pEVar4->y.HALF.HI = this->y.HALF.HI + cVar2; + pEVar4->x.HALF.HI = super->x.HALF.HI + cVar1; + pEVar4->y.HALF.HI = super->y.HALF.HI + cVar2; } sub_08070458(this); return; } - if ((--(*(int*)&this->field_0x74) == -1) || (--(*(int*)&this->field_0x78) == -1)) { + if ((--(this->unk_74) == -1) || (--(this->unk_78) == -1)) { sub_08070458(this); } else { - GetNextFrame(this); - LinearMoveUpdate(this); - if (this->type == 0) { - sub_0800451C(this); + GetNextFrame(super); + LinearMoveUpdate(super); + if (super->type == 0) { + sub_0800451C(super); } - if (sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) { - if (sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI) == 0) { - if (GetTileUnderEntity(this) == 0x19) { - this->action = 4; - COLLISION_OFF(this); - this->x.HALF.HI = (this->x.HALF.HI & 0xfff0) | 8; - this->y.HALF.HI = (this->y.HALF.HI & 0xfff0) | 8; - this->spritePriority.b0 = 7; - this->field_0x7c.WORD = GetTileIndex(COORD_TO_TILE(this), this->collisionLayer); - InitializeAnimation(this, 0x14); - SetTile(0x4020, COORD_TO_TILE(this), this->collisionLayer); + if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) { + if (sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) == 0) { + if (GetTileUnderEntity(super) == 0x19) { + super->action = 4; + COLLISION_OFF(super); + super->x.HALF.HI = (super->x.HALF.HI & 0xfff0) | 8; + super->y.HALF.HI = (super->y.HALF.HI & 0xfff0) | 8; + super->spritePriority.b0 = 7; + this->unk_7c = GetTileIndex(COORD_TO_TILE(super), super->collisionLayer); + InitializeAnimation(super, 0x14); + SetTile(0x4020, COORD_TO_TILE(super), super->collisionLayer); return; } } else { sub_08070458(this); } } - if (this->contactFlags != 0) { + if (super->contactFlags != 0) { sub_08070458(this); } } } -void sub_0807037C(Entity* this) { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { +void PlayerItemPacciCaneProjectile_Action2(PlayerItemPacciCaneProjectileEntity* this) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { DeleteThisEntity(); } } -void sub_08070398(Entity* this) { - GetNextFrame(this); - LinearMoveUpdate(this); - if (GravityUpdate(this, Q_8_8(32.0)) == 0) { +void PlayerItemPacciCaneProjectile_Action3(PlayerItemPacciCaneProjectileEntity* this) { + GetNextFrame(super); + LinearMoveUpdate(super); + if (GravityUpdate(super, Q_8_8(32.0)) == 0) { DeleteThisEntity(); } } -void sub_080703BC(Entity* this) { - GetNextFrame(this); - switch (GetTileIndex(COORD_TO_TILE(this), this->collisionLayer)) { +void PlayerItemPacciCaneProjectile_Action4(PlayerItemPacciCaneProjectileEntity* this) { + GetNextFrame(super); + switch (GetTileIndex(COORD_TO_TILE(super), super->collisionLayer)) { default: - this->field_0x7c.WORD = 0; + this->unk_7c = 0; sub_08070458(this); break; case 0x4021: sub_08070458(this); break; case 0x4070: - *(int*)&this->field_0x78 = 0xff; + this->unk_78 = 0xff; case 0x4020: - if (--(*(int*)&this->field_0x78) == -1) { + if (--(this->unk_78) == -1) { sub_08070458(this); } else { - if (this->contactFlags == 0) { + if (super->contactFlags == 0) { return; } - if (((this->contactFlags & 0x7f) == 0) && (this->action != 0x1a)) { + if (((super->contactFlags & 0x7f) == 0) && (super->action != 0x1a)) { return; } sub_08070458(this); @@ -174,15 +193,15 @@ void sub_080703BC(Entity* this) { } } -void sub_08070458(Entity* this) { - this->action = 2; - COLLISION_OFF(this); - this->speed = 0; - if (this->field_0x7c.WORD != 0) { - SetTile(this->field_0x7c.WORD, TILE(this->x.HALF.HI, this->y.HALF.HI), this->collisionLayer); +void sub_08070458(PlayerItemPacciCaneProjectileEntity* this) { + super->action = 2; + COLLISION_OFF(super); + super->speed = 0; + if (this->unk_7c != 0) { + SetTile(this->unk_7c, TILE(super->x.HALF.HI, super->y.HALF.HI), super->collisionLayer); } - InitializeAnimation(this, 0x13); - sub_08017744(this); + InitializeAnimation(super, 0x13); + sub_08017744(super); SoundReq(SFX_199); } diff --git a/src/playerItem/playerItemShield.c b/src/playerItem/playerItemShield.c index 14f7a2aa..e4fa03b6 100644 --- a/src/playerItem/playerItemShield.c +++ b/src/playerItem/playerItemShield.c @@ -1,29 +1,35 @@ +/** + * @file playerItemShield.c + * @ingroup Items + * + * @brief Shield Player Item + */ #define NENT_DEPRECATED - -#include "entity.h" -#include "player.h" -#include "functions.h" -#include "sound.h" #include "collision.h" +#include "entity.h" +#include "functions.h" +#include "player.h" #include "playeritem.h" +#include "sound.h" const Hitbox gUnk_081271CC = { 0, 0, { 1, 0, 0, 1 }, 8, 8 }; typedef struct { - Entity base; - u8 unk_68; - u8 unk_69[3]; - u32 bounceTimer; - u32 unk_70; - u32 unk_74; - u32 unk_78; - u8* unk_7c; + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; + /*0x69*/ u8 unk_69[3]; + /*0x6c*/ u32 bounceTimer; + /*0x70*/ u32 unk_70; + /*0x74*/ u32 unk_74; + /*0x78*/ u32 unk_78; + /*0x7c*/ u8* unk_7c; } PlayerItemShieldEntity; -void sub_080A2D98(PlayerItemShieldEntity*); -void sub_080A2E00(PlayerItemShieldEntity*); -void (*const gUnk_081271D4[])(PlayerItemShieldEntity*) = { - sub_080A2D98, - sub_080A2E00, + +void PlayerItemShield_Init(PlayerItemShieldEntity* this); +void PlayerItemShield_Action1(PlayerItemShieldEntity* this); +void (*const PlayerItemShield_Actions[])(PlayerItemShieldEntity*) = { + PlayerItemShield_Init, + PlayerItemShield_Action1, }; const u8 gUnk_081271DC[] = { 7, 60, 0, 0, 0, 2, 0, 0, 1, 2, 0, 0, 2, 2, 0, 0, 3, 2, 0, 0, 4, 2, 0, 0, 5, 2, 0, 0, 6, 2, 0, 0, 7, 20, @@ -48,16 +54,16 @@ const Hitbox gUnk_08127258 = { 5, -4, { 0, 0, 0, 0 }, 5, 7 }; const Hitbox gUnk_08127260 = { 0, 0, { 0, 0, 0, 0 }, 6, 7 }; const Hitbox gUnk_08127268 = { -5, -4, { 0, 0, 0, 0 }, 5, 7 }; -void sub_080A2E00(PlayerItemShieldEntity* this); +void PlayerItemShield_Action1(PlayerItemShieldEntity* this); void PlayerItemShield(PlayerItemShieldEntity* this) { if (this->bounceTimer != 0) { this->bounceTimer--; } - gUnk_081271D4[super->action](this); + PlayerItemShield_Actions[super->action](this); } -void sub_080A2D98(PlayerItemShieldEntity* this) { +void PlayerItemShield_Init(PlayerItemShieldEntity* this) { gPlayerState.item = super; super->action = 1; super->updatePriority = 6; @@ -73,10 +79,10 @@ void sub_080A2D98(PlayerItemShieldEntity* this) { super->animationState = gPlayerEntity.animationState & 0xe; sub_08079BD8(super); LoadSwapGFX(super, 1, 3); - sub_080A2E00(this); + PlayerItemShield_Action1(this); } -void sub_080A2E00(PlayerItemShieldEntity* this) { +void PlayerItemShield_Action1(PlayerItemShieldEntity* this) { Entity* playerItem; u8* pbVar3; u32 tmp2; diff --git a/src/playerItem/playerItemSpiralBeam.c b/src/playerItem/playerItemSpiralBeam.c index 153edce5..09f128d6 100644 --- a/src/playerItem/playerItemSpiralBeam.c +++ b/src/playerItem/playerItemSpiralBeam.c @@ -1,60 +1,71 @@ -#include "entity.h" -#include "sound.h" -#include "functions.h" -#include "effects.h" +/** + * @file playerItemSpiral Beam.c + * @ingroup Items + * + * @brief Spiral Beam Player Item + */ +#define NENT_DEPRECATED #include "asm.h" +#include "effects.h" +#include "entity.h" +#include "functions.h" +#include "sound.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[4]; + /*0x6c*/ u32 unk_6c; +} PlayerItemSpiralBeamEntity; extern u8 gUnk_08003E44; -void sub_0805FBE8(Entity*); -void sub_0805FC74(Entity*); +void PlayerItemSpiralBeam_Init(PlayerItemSpiralBeamEntity*); +void PlayerItemSpiralBeam_Action1(PlayerItemSpiralBeamEntity*); -void PlayerItemSpiralBeam(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_0805FBE8, - sub_0805FC74, +void PlayerItemSpiralBeam(PlayerItemSpiralBeamEntity* this) { + static void (*const PlayerItemSpiralBeam_Actions[])(PlayerItemSpiralBeamEntity*) = { + PlayerItemSpiralBeam_Init, + PlayerItemSpiralBeam_Action1, }; - actionFuncs[this->action](this); + PlayerItemSpiralBeam_Actions[super->action](this); } -void sub_0805FBE8(Entity* this) { +void PlayerItemSpiralBeam_Init(PlayerItemSpiralBeamEntity* this) { static const Hitbox gUnk_08109AD0 = { 0, 0, { 4, 0, 0, 0 }, 6, 6 }; - CopyPosition(&gPlayerEntity, this); - this->action++; - this->spriteSettings.draw = TRUE; - this->collisionFlags = gPlayerEntity.collisionFlags + 1; - this->hitbox = (Hitbox*)&gUnk_08109AD0; - this->speed = 0x380; - this->animationState = this->animationState & 0x7f; - if (this->collisionLayer == 2) { - this->type2 = 1; + CopyPosition(&gPlayerEntity, super); + super->action++; + super->spriteSettings.draw = TRUE; + super->collisionFlags = gPlayerEntity.collisionFlags + 1; + super->hitbox = (Hitbox*)&gUnk_08109AD0; + super->speed = 0x380; + super->animationState = super->animationState & 0x7f; + if (super->collisionLayer == 2) { + super->type2 = 1; } - this->direction = this->animationState << 2; - *(u32*)&this->field_0x6c = 0x3c; - InitializeAnimation(this, (this->animationState >> 1) + 0xc); - sub_0801766C(this); - LinearMoveUpdate(this); - sub_0805FC74(this); + super->direction = super->animationState << 2; + this->unk_6c = 60; + InitializeAnimation(super, (super->animationState >> 1) + 0xc); + sub_0801766C(super); + LinearMoveUpdate(super); + PlayerItemSpiralBeam_Action1(this); SoundReq(SFX_ITEM_SWORD_BEAM); } -void sub_0805FC74(Entity* this) { - int iVar1; - - if (--*(int*)&this->field_0x6c != -1) { - GetNextFrame(this); - LinearMoveUpdate(this); - this->timer++; - if (this->type2 == 0) { - sub_0800451C(this); +void PlayerItemSpiralBeam_Action1(PlayerItemSpiralBeamEntity* this) { + if (this->unk_6c-- != 0) { + GetNextFrame(super); + LinearMoveUpdate(super); + super->timer++; + if (super->type2 == 0) { + sub_0800451C(super); } - if (!sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) && - sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI)) { - CreateFx(this, FX_SWORD_MAGIC, 0); + if (!sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) && + sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI)) { + CreateFx(super, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } - if (this->contactFlags != 0) { - CreateFx(this, FX_SWORD_MAGIC, 0); + if (super->contactFlags != 0) { + CreateFx(super, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } } else { diff --git a/src/playerItem/playerItemSword.c b/src/playerItem/playerItemSword.c index 43471e77..71c6eed7 100644 --- a/src/playerItem/playerItemSword.c +++ b/src/playerItem/playerItemSword.c @@ -1,32 +1,38 @@ +/** + * @file playerItemSword.c + * @ingroup Items + * + * @brief Sword Player Item + */ #define NENT_DEPRECATED -#include "entity.h" -#include "functions.h" -#include "sound.h" #include "asm.h" #include "effects.h" +#include "entity.h" +#include "functions.h" #include "object.h" +#include "sound.h" typedef struct { - Entity base; - u8 unk_68; + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; } PlayerItemSwordEntity; void sub_080A78B8(PlayerItemSwordEntity*, Entity*); void sub_080A7B98(PlayerItemSwordEntity*); void sub_080A7A54(PlayerItemSwordEntity*); -void sub_080A7824(PlayerItemSwordEntity*); -void sub_080A76CC(PlayerItemSwordEntity*); -void sub_080A758C(PlayerItemSwordEntity*); +void PlayerItemSword_Action2(PlayerItemSwordEntity*); +void PlayerItemSword_Action1(PlayerItemSwordEntity*); +void PlayerItemSword_Init(PlayerItemSwordEntity*); void sub_080A7A84(PlayerItemSwordEntity*); void PlayerItemSword(Entity* this) { - static void (*const gUnk_0812905C[])(PlayerItemSwordEntity*) = { - sub_080A758C, - sub_080A76CC, - sub_080A7824, + static void (*const PlayerItemSword_Actions[])(PlayerItemSwordEntity*) = { + PlayerItemSword_Init, + PlayerItemSword_Action1, + PlayerItemSword_Action2, }; - gUnk_0812905C[this->action]((PlayerItemSwordEntity*)this); + PlayerItemSword_Actions[this->action]((PlayerItemSwordEntity*)this); if (this->type == 0) { sub_08078E84(this, &gPlayerEntity); this->hitbox->offset_x += this->spriteOffsetX; @@ -34,7 +40,7 @@ void PlayerItemSword(Entity* this) { } } -void sub_080A758C(PlayerItemSwordEntity* this) { +void PlayerItemSword_Init(PlayerItemSwordEntity* this) { static const u8 gUnk_08129068[] = { 0x56, 0x55, @@ -79,16 +85,16 @@ void sub_080A758C(PlayerItemSwordEntity* this) { break; } super->action++; - sub_080A7824(this); + PlayerItemSword_Action2(this); } else { super->damage = gPlayerState.swordDamage * 2 + 4; - sub_080A76CC(this); + PlayerItemSword_Action1(this); } gPlayerState.item = super; sub_08079BD8(super); SoundReq(gUnk_0812906C[GetRandomByWeight(gUnk_08129068)]); } else { - sub_080A76CC(this); + PlayerItemSword_Action1(this); } SoundReq(SFX_10E); } @@ -147,7 +153,7 @@ static const s8 gUnk_081292E2[] = { 0x0, 0x2, -0x8, 0xa, -0x8, 0xa, 0x0 0x0, -0x2, 0x10, -0x12, 0x10, -0x12, 0x0, -0x16, 0x0, -0x16, -0xc, -0x14, -0xc, -0x10, -0xc, -0xc, 0x0, -0x2 }; -void sub_080A76CC(PlayerItemSwordEntity* this) { +void PlayerItemSword_Action1(PlayerItemSwordEntity* this) { Entity* effect; Effect type; const s8* ptr; @@ -221,7 +227,7 @@ void sub_080A76CC(PlayerItemSwordEntity* this) { } } -void sub_080A7824(PlayerItemSwordEntity* this) { +void PlayerItemSword_Action2(PlayerItemSwordEntity* this) { if (gPlayerState.item != super) { DeleteThisEntity(); } diff --git a/src/playerItem/playerItemSwordBeam.c b/src/playerItem/playerItemSwordBeam.c index dfd78d5d..36ad1b73 100644 --- a/src/playerItem/playerItemSwordBeam.c +++ b/src/playerItem/playerItemSwordBeam.c @@ -1,109 +1,120 @@ -#include "entity.h" -#include "player.h" -#include "physics.h" -#include "functions.h" -#include "sound.h" -#include "effects.h" -#include "common.h" +/** + * @file playerItemSwordBeam.c + * @ingroup Items + * + * @brief Sword Beam Player Item + */ +#define NENT_DEPRECATED #include "asm.h" +#include "common.h" +#include "effects.h" +#include "entity.h" +#include "functions.h" +#include "physics.h" +#include "player.h" +#include "sound.h" -void sub_08019498(Entity*); -void sub_08019580(Entity*); -void sub_08019644(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused[4]; + /*0x6c*/ u32 unk_6c; + /*0x70*/ u32 unk_70; + /*0x74*/ u32 unk_74; +} PlayerItemSwordBeamEntity; + +void PlayerItemSwordBeam_Init(PlayerItemSwordBeamEntity* this); +void PlayerItemSwordBeam_Action1(PlayerItemSwordBeamEntity* this); +void PlayerItemSwordBeam_CyclePalettes(PlayerItemSwordBeamEntity* this); extern u8 gUnk_08003E44; -void PlayerItemSwordBeam(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { - sub_08019498, - sub_08019580, +void PlayerItemSwordBeam(PlayerItemSwordBeamEntity* this) { + static void (*const PlayerItemSwordBeam_Actions[])(PlayerItemSwordBeamEntity*) = { + PlayerItemSwordBeam_Init, + PlayerItemSwordBeam_Action1, }; - actionFuncs[this->action](this); + PlayerItemSwordBeam_Actions[super->action](this); } -static const u8 gUnk_080B43FC[] = { 30, 29, 30, 29 }; -static const u8 gUnk_080B4400[] = { 0, 4, 1, 2, -1, 0, 0, 0 }; +static const u8 PlayerItemSwordBeam_AnimIndices[] = { 30, 29, 30, 29 }; +static const u8 PlayerItemSwordBeam_Palettes[] = { 0, 4, 1, 2, 0xff }; -void sub_08019498(Entity* this) { - static const Hitbox gUnk_080B4408 = { 0, 0, { 4, 0, 0, 0 }, 6, 6 }; - CopyPosition(&gPlayerEntity, this); - this->action += 0x01; - this->spriteSettings.draw = 1; - this->collisionFlags = gPlayerEntity.collisionFlags + 1; - this->hitbox = (Hitbox*)&gUnk_080B4408; - this->speed = 0x380; - *(u32*)&this->field_0x74 = 2; - this->field_0x70.WORD = 0; - if (this->collisionLayer == 0x02) { - this->type2 = 0x01; +void PlayerItemSwordBeam_Init(PlayerItemSwordBeamEntity* this) { + static const Hitbox hitbox = { 0, 0, { 4, 0, 0, 0 }, 6, 6 }; + CopyPosition(&gPlayerEntity, super); + super->action++; + super->spriteSettings.draw = 1; + super->collisionFlags = gPlayerEntity.collisionFlags + 1; + super->hitbox = (Hitbox*)&hitbox; + super->speed = 0x380; + this->unk_74 = 2; + this->unk_70 = 0; + if (super->collisionLayer == 2) { + super->type2 = 1; } - this->direction = this->animationState << 2; - *(u32*)&this->field_0x6c = 0x3c; - switch (this->animationState) { + super->direction = super->animationState << 2; + this->unk_6c = 60; + switch (super->animationState) { case 0: - this->x.HALF.HI += -3; - this->y.HALF.HI += -8; - this->spriteSettings.flipY = 1; + super->x.HALF.HI -= 3; + super->y.HALF.HI -= 8; + super->spriteSettings.flipY = 1; break; case 4: - this->x.HALF.HI += 2; + super->x.HALF.HI += 2; break; case 2: - this->spriteSettings.flipX = 1; - this->x.HALF.HI++; - this->y.HALF.HI += -4; + super->spriteSettings.flipX = 1; + super->x.HALF.HI++; + super->y.HALF.HI -= 4; break; case 6: - this->x.HALF.HI--; - this->y.HALF.HI += -4; + super->x.HALF.HI--; + super->y.HALF.HI -= 4; break; } - InitializeAnimation(this, gUnk_080B43FC[this->animationState >> 1]); - sub_0801766C(this); - LinearMoveUpdate(this); - sub_08019580(this); + InitializeAnimation(super, PlayerItemSwordBeam_AnimIndices[super->animationState >> 1]); + sub_0801766C(super); + LinearMoveUpdate(super); + PlayerItemSwordBeam_Action1(this); SoundReq(SFX_ITEM_SWORD_BEAM); } -void sub_08019580(Entity* this) { - if (--*(int*)&this->field_0x6c != -1) { - GetNextFrame(this); - LinearMoveUpdate(this); - this->timer++; - if (this->type2 == 0) { - sub_0800451C(this); +void PlayerItemSwordBeam_Action1(PlayerItemSwordBeamEntity* this) { + if (this->unk_6c-- != 0) { + GetNextFrame(super); + LinearMoveUpdate(super); + super->timer++; + if (super->type2 == 0) { + sub_0800451C(super); } - if ((sub_080B1BA4(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) == 0) && - (sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI) != 0)) { - CreateFx(this, FX_SWORD_MAGIC, 0); + if ((sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) && + (sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) != 0)) { + CreateFx(super, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } - if (this->contactFlags != 0) { - CreateFx(this, FX_SWORD_MAGIC, 0); + if (super->contactFlags != 0) { + CreateFx(super, FX_SWORD_MAGIC, 0); DeleteThisEntity(); } - if (sub_08008790(this, 0xc) != NULL) { + if (sub_08008790(super, 0xc) != NULL) { DeleteThisEntity(); } } else { DeleteThisEntity(); } - sub_08019644(this); + PlayerItemSwordBeam_CyclePalettes(this); } -void sub_08019644(Entity* this) { - s32 iVar1; - - iVar1 = *(int*)&this->field_0x74 + -1; - *(int*)&this->field_0x74 = iVar1; - if (iVar1 == 0) { - *(int*)&this->field_0x74 = 2; - this->field_0x70.WORD++; - if (gUnk_080B4400[this->field_0x70.WORD] == 0xff) { - this->field_0x70.WORD = iVar1; +void PlayerItemSwordBeam_CyclePalettes(PlayerItemSwordBeamEntity* this) { + if (--this->unk_74 == 0) { + this->unk_74 = 2; + this->unk_70++; + if (PlayerItemSwordBeam_Palettes[this->unk_70] == 0xff) { + this->unk_70 = 0; } - ChangeObjPalette(this, (u32)gUnk_080B4400[this->field_0x70.WORD]); + ChangeObjPalette(super, PlayerItemSwordBeam_Palettes[this->unk_70]); } } From c63a86fbcac78c1773b31383a8837a508c649971 Mon Sep 17 00:00:00 2001 From: octorock <79596758+octorock@users.noreply.github.com> Date: Sun, 30 Jul 2023 23:56:42 +0200 Subject: [PATCH 09/15] Create some enemy structs --- include/enemy.h | 164 +++--- src/enemy/acroBandits.c | 666 ++++++++++++------------ src/enemy/armos.c | 8 +- src/enemy/ballChainSoldier.c | 18 +- src/enemy/beetle.c | 367 ++++++------- src/enemy/bladeTrap.c | 32 +- src/enemy/bobomb.c | 355 +++++++------ src/enemy/bombPeahat.c | 815 +++++++++++++++-------------- src/enemy/bombarossa.c | 18 +- src/enemy/bowMoblin.c | 14 +- src/enemy/businessScrub.c | 475 +++++++++-------- src/enemy/businessScrubPrologue.c | 62 ++- src/enemy/chaser.c | 2 +- src/enemy/chuchu.c | 838 +++++++++++++++--------------- src/enemy/chuchuBoss.c | 5 +- src/enemy/cloudPiranha.c | 2 - src/enemy/crow.c | 8 +- src/enemy/cuccoAggr.c | 24 +- src/enemy/cuccoChickAggr.c | 2 +- src/enemy/curtain.c | 7 + src/enemy/darkNut.c | 582 +++++++++++---------- src/enemy/doorMimic.c | 135 ++--- src/enemy/dust.c | 18 +- src/enemy/enemy4D.c | 5 +- src/enemy/enemy50.c | 4 +- src/enemy/enemy64.c | 4 +- src/enemy/enemy66.c | 7 + src/enemy/enemyE.c | 4 +- src/enemy/eyegore.c | 6 +- src/enemy/fallingBoulder.c | 201 +++---- src/enemy/fireballGuy.c | 126 ++--- src/enemy/flyingPot.c | 2 +- src/enemy/flyingSkull.c | 20 +- src/enemy/ghini.c | 4 +- src/enemy/gibdo.c | 28 +- src/enemy/gleerok.c | 34 +- src/enemy/gyorgChild.c | 11 +- src/enemy/gyorgFemale.c | 54 +- src/enemy/gyorgFemaleEye.c | 13 +- src/enemy/gyorgFemaleMouth.c | 9 +- src/enemy/gyorgMale.c | 8 +- src/enemy/gyorgMaleEye.c | 4 +- src/enemy/hangingSeed.c | 4 +- src/enemy/helmasaur.c | 421 +++++++-------- src/enemy/keaton.c | 268 +++++----- src/enemy/keese.c | 1 - src/enemy/lakitu.c | 298 +++++------ src/enemy/lakituCloud.c | 144 ++--- src/enemy/leever.c | 162 +++--- src/enemy/likeLike.c | 7 +- src/enemy/madderpillar.c | 508 +++++++++--------- src/enemy/mazaalBracelet.c | 66 ++- src/enemy/mazaalHand.c | 2 +- src/enemy/mazaalHead.c | 2 +- src/enemy/mazaalMacro.c | 212 ++++---- src/enemy/miniFireballGuy.c | 94 ++-- src/enemy/miniSlime.c | 127 ++--- src/enemy/moldorm.c | 4 +- src/enemy/moldworm.c | 2 +- src/enemy/mulldozer.c | 2 - src/enemy/octorok.c | 20 +- src/enemy/octorokGolden.c | 9 +- src/enemy/peahat.c | 465 +++++++++-------- src/enemy/pesto.c | 76 +-- src/enemy/puffstool.c | 90 ++-- src/enemy/rockChuchu.c | 30 +- src/enemy/rollobite.c | 335 ++++++------ src/enemy/rope.c | 226 ++++---- src/enemy/ropeGolden.c | 173 +++--- src/enemy/rupeeLike.c | 325 ++++++------ src/enemy/scissorsBeetle.c | 22 +- src/enemy/sensorBladeTrap.c | 87 ++-- src/enemy/slime.c | 142 ++--- src/enemy/sluggula.c | 16 +- src/enemy/smallPesto.c | 162 +++--- src/enemy/spark.c | 18 +- src/enemy/spearMoblin.c | 32 +- src/enemy/spikedBeetle.c | 2 +- src/enemy/spinyBeetle.c | 8 +- src/enemy/spinyChuchu.c | 2 +- src/enemy/stalfos.c | 2 - src/enemy/takkuri.c | 26 +- src/enemy/tektite.c | 2 +- src/enemy/tektiteGolden.c | 2 +- src/enemy/torchTrap.c | 10 +- src/enemy/treeItem.c | 5 +- src/enemy/vaatiArm.c | 20 +- src/enemy/vaatiBall.c | 8 +- src/enemy/vaatiEyesMacro.c | 2 +- src/enemy/vaatiProjectile.c | 2 +- src/enemy/vaatiRebornEnemy.c | 4 +- src/enemy/vaatiTransfigured.c | 4 +- src/enemy/vaatiTransfiguredEye.c | 6 +- src/enemy/vaatiWrath.c | 6 +- src/enemy/vaatiWrathEye.c | 2 +- src/enemy/wallMaster.c | 10 +- src/enemy/wallMaster2.c | 2 +- src/enemy/waterDrop.c | 12 +- src/enemy/wisp.c | 16 +- src/enemy/wizzrobeFire.c | 4 +- src/enemy/wizzrobeIce.c | 4 +- src/enemy/wizzrobeWind.c | 4 +- 102 files changed, 5134 insertions(+), 4744 deletions(-) diff --git a/include/enemy.h b/include/enemy.h index ba1b828b..bc9f842b 100644 --- a/include/enemy.h +++ b/include/enemy.h @@ -156,108 +156,108 @@ typedef enum { /*0x66*/ ENEMY_66 } Enemy; -void Octorok(Entity*); -void Chuchu(Entity*); -void Leever(Entity*); -void Peahat(Entity*); -void Rollobite(Entity*); -void DarkNut(Entity*); -void HangingSeed(Entity*); -void Beetle(Entity*); -void Keese(Entity*); -void DoorMimic(Entity*); -void RockChuchu(Entity*); -void SpinyChuchu(Entity*); -void CuccoChickAggr(Entity*); -void Moldorm(Entity*); -void EnemyE(Entity*); -void Moldworm(Entity*); -void Sluggula(Entity*); -void Pesto(Entity*); -void Puffstool(Entity*); -void ChuchuBoss(Entity*); -void LikeLike(Entity*); -void SpearMoblin(Entity*); -void BusinessScrub(Entity*); -void RupeeLike(Entity*); -void Madderpillar(Entity*); -void WaterDrop(Entity*); -void WallMaster(Entity*); -void BombPeahat(Entity*); -void Spark(Entity*); -void Chaser(Entity*); -void SpikedBeetle(Entity*); -void SensorBladeTrap(Entity*); -void Helmasaur(Entity*); -void FallingBoulder(Entity*); -void Bobomb(Entity*); -void WallMaster2(Entity*); +void Octorok(); +void Chuchu(); +void Leever(); +void Peahat(); +void Rollobite(); +void DarkNut(); +void HangingSeed(); +void Beetle(); +void Keese(); +void DoorMimic(); +void RockChuchu(); +void SpinyChuchu(); +void CuccoChickAggr(); +void Moldorm(); +void EnemyE(); +void Moldworm(); +void Sluggula(); +void Pesto(); +void Puffstool(); +void ChuchuBoss(); +void LikeLike(); +void SpearMoblin(); +void BusinessScrub(); +void RupeeLike(); +void Madderpillar(); +void WaterDrop(); +void WallMaster(); +void BombPeahat(); +void Spark(); +void Chaser(); +void SpikedBeetle(); +void SensorBladeTrap(); +void Helmasaur(); +void FallingBoulder(); +void Bobomb(); +void WallMaster2(); void Gleerok(); -void VaatiEyesMacro(Entity*); -void Tektite(Entity*); +void VaatiEyesMacro(); +void Tektite(); void WizzrobeWind(); void WizzrobeFire(); void WizzrobeIce(); void Armos(); void Eyegore(); -void Rope(Entity*); -void SmallPesto(Entity*); -void AcroBandit(Entity*); -void BladeTrap(Entity*); -void Keaton(Entity*); -void Crow(Entity*); +void Rope(); +void SmallPesto(); +void AcroBandit(); +void BladeTrap(); +void Keaton(); +void Crow(); void Mulldozer(); -void Bombarossa(Entity*); -void Wisp(Entity*); -void SpinyBeetle(Entity*); -void MazaalHead(Entity*); -void MazaalMacro(Entity*); -void MazaalHand(Entity*); +void Bombarossa(); +void Wisp(); +void SpinyBeetle(); +void MazaalHead(); +void MazaalMacro(); +void MazaalHand(); void OctorokBoss(); -void FlyingPot(Entity*); -void Gibdo(Entity*); -void OctorokGolden(Entity*); -void TektiteGolden(Entity*); -void RopeGolden(Entity*); +void FlyingPot(); +void Gibdo(); +void OctorokGolden(); +void TektiteGolden(); +void RopeGolden(); void CloudPiranha(); -void ScissorsBeetle(Entity*); -void CuccoAggr(Entity*); +void ScissorsBeetle(); +void CuccoAggr(); void Stalfos(); -void FlyingSkull(Entity*); -void MazaalBracelet(Entity*); -void Takkuri(Entity*); -void BowMoblin(Entity*); -void Lakitu(Entity*); -void LakituCloud(Entity*); -void TorchTrap(Entity*); -void VaatiRebornEnemy(Entity*); -void VaatiProjectile(Entity*); -void BallChainSoldier(Entity*); +void FlyingSkull(); +void MazaalBracelet(); +void Takkuri(); +void BowMoblin(); +void Lakitu(); +void LakituCloud(); +void TorchTrap(); +void VaatiRebornEnemy(); +void VaatiProjectile(); +void BallChainSoldier(); void Enemy4D(); void Ghini(); -void VaatiTransfigured(Entity*); +void VaatiTransfigured(); void Enemy50(); -void VaatiWrath(Entity*); -void VaatiArm(Entity*); -void Dust(Entity*); -void VaatiBall(Entity*); -void Slime(Entity*); -void MiniSlime(Entity*); -void FireballGuy(Entity*); -void MiniFireballGuy(Entity*); -void VaatiTransfiguredEye(Entity*); -void BusinessScrubPrologue(Entity*); +void VaatiWrath(); +void VaatiArm(); +void Dust(); +void VaatiBall(); +void Slime(); +void MiniSlime(); +void FireballGuy(); +void MiniFireballGuy(); +void VaatiTransfiguredEye(); +void BusinessScrubPrologue(); void GyorgFemale(); void GyorgMale(); -void Curtain(Entity*); -void VaatiWrathEye(Entity*); +void Curtain(); +void VaatiWrathEye(); void GyorgChild(); void GyorgFemaleEye(); void GyorgMaleEye(); void GyorgFemaleMouth(); void Enemy64(); -void TreeItem(Entity*); -void Enemy66(Entity*); +void TreeItem(); +void Enemy66(); extern void (*const gUnk_080012C8[])(Entity*); diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 86d5d1db..eb2af238 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -4,85 +4,101 @@ * * @brief Acro Bandits enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[4]; + /*0x6c*/ u8 unk_6c; + /*0x6d*/ u8 unused2[1]; + /*0x6e*/ u8 unk_6e; + /*0x6f*/ u8 unk_6f; + /*0x70*/ u16 unk_70; + /*0x72*/ u16 unk_72; + /*0x74*/ union SplitHWord unk_74; + /*0x76*/ union SplitHWord unk_76; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; + /*0x7a*/ u8 unk_7a; + /*0x7b*/ u8 unused6[1]; + /*0x7c*/ Entity* unk_7c; +} AcroBanditEntity; + extern Entity* gUnk_020000B0; -static void sub_08031E48(Entity* this, Entity* child); -static void sub_08032290(Entity* this); -static bool32 sub_080322A4(Entity* this); -static void sub_08032338(Entity* this); -static void sub_080322E8(Entity* this); -static bool32 sub_08031E04(Entity* this); +static void sub_08031E48(AcroBanditEntity* this, AcroBanditEntity* child); +static void sub_08032290(AcroBanditEntity* this); +static bool32 sub_080322A4(AcroBanditEntity* this); +static void sub_08032338(AcroBanditEntity* this); +static void sub_080322E8(AcroBanditEntity* this); +static bool32 sub_08031E04(AcroBanditEntity* this); -void AcroBandit_OnTick(Entity* this); -void AcroBandit_OnCollision(Entity* this); -void AcroBandit_OnKnockback(Entity* this); -void GenericDeath(Entity* this); -void GenericConfused(Entity* this); -void AcroBandit_OnGrabbed(Entity* this); -void AcroBandit_Type0(Entity* this); -void AcroBandit_Type1(Entity* this); -void AcroBandit_Type0Action0(Entity* this); -void AcroBandit_Type0Action1(Entity* this); -void AcroBandit_Type0Action2(Entity* this); -void AcroBandit_Type0Action3(Entity* this); -void AcroBandit_Type0Action4(Entity* this); -void AcroBandit_Type0Action5(Entity* this); -void AcroBandit_Type0Action6(Entity* this); -void AcroBandit_Type0Action7(Entity* this); -void AcroBandit_Type0Action8(Entity* this); -void AcroBandit_Type1Init(Entity* this); -void AcroBandit_Type1Action1(Entity* this); -void AcroBandit_Type1Action2(Entity* this); -void AcroBandit_Type1Action3(Entity* this); -void AcroBandit_Type1Action4(Entity* this); -void AcroBandit_Type1Action5(Entity* this); -void AcroBandit_Type1Action6(Entity* this); -void AcroBandit_Type1Action7(Entity* this); -void AcroBandit_Type1Action8(Entity* this); -void AcroBandit_Type1Action9(Entity* this); +void AcroBandit_OnTick(AcroBanditEntity* this); +void AcroBandit_OnCollision(AcroBanditEntity* this); +void AcroBandit_OnKnockback(AcroBanditEntity* this); +void AcroBandit_OnGrabbed(AcroBanditEntity* this); +void AcroBandit_Type0(AcroBanditEntity* this); +void AcroBandit_Type1(AcroBanditEntity* this); +void AcroBandit_Type0Action0(AcroBanditEntity* this); +void AcroBandit_Type0Action1(AcroBanditEntity* this); +void AcroBandit_Type0Action2(AcroBanditEntity* this); +void AcroBandit_Type0Action3(AcroBanditEntity* this); +void AcroBandit_Type0Action4(AcroBanditEntity* this); +void AcroBandit_Type0Action5(AcroBanditEntity* this); +void AcroBandit_Type0Action6(AcroBanditEntity* this); +void AcroBandit_Type0Action7(AcroBanditEntity* this); +void AcroBandit_Type0Action8(AcroBanditEntity* this); +void AcroBandit_Type1Init(AcroBanditEntity* this); +void AcroBandit_Type1Action1(AcroBanditEntity* this); +void AcroBandit_Type1Action2(AcroBanditEntity* this); +void AcroBandit_Type1Action3(AcroBanditEntity* this); +void AcroBandit_Type1Action4(AcroBanditEntity* this); +void AcroBandit_Type1Action5(AcroBanditEntity* this); +void AcroBandit_Type1Action6(AcroBanditEntity* this); +void AcroBandit_Type1Action7(AcroBanditEntity* this); +void AcroBandit_Type1Action8(AcroBanditEntity* this); +void AcroBandit_Type1Action9(AcroBanditEntity* this); -static void (*const AcroBandit_Functions[])(Entity*) = { +static void (*const AcroBandit_Functions[])(AcroBanditEntity*) = { AcroBandit_OnTick, AcroBandit_OnCollision, AcroBandit_OnKnockback, - GenericDeath, GenericConfused, AcroBandit_OnGrabbed, + (void (*)(AcroBanditEntity*))GenericDeath, (void (*)(AcroBanditEntity*))GenericConfused, AcroBandit_OnGrabbed, }; -void AcroBandit(Entity* this) { +void AcroBandit(AcroBanditEntity* this) { s32 index; - index = sub_080012DC(this); + index = sub_080012DC(super); if (index) { - if ((this->gustJarState & 1) == 0) + if ((super->gustJarState & 1) == 0) sub_08032338(this); - gUnk_080012C8[index](this); + gUnk_080012C8[index](super); } else { - AcroBandit_Functions[GetNextFunction(this)](this); - SetChildOffset(this, 0, 1, -0x10); + AcroBandit_Functions[GetNextFunction(super)](this); + SetChildOffset(super, 0, 1, -0x10); } } -void AcroBandit_OnTick(Entity* this) { - static void (*const typeFuncs[])(Entity*) = { +void AcroBandit_OnTick(AcroBanditEntity* this) { + static void (*const typeFuncs[])(AcroBanditEntity*) = { AcroBandit_Type0, AcroBandit_Type1, }; - typeFuncs[this->type](this); + typeFuncs[super->type](this); } -void AcroBandit_OnCollision(Entity* this) { +void AcroBandit_OnCollision(AcroBanditEntity* this) { Entity* brother; - if (this->contactFlags != 0x80 && this->contactFlags != 0x81) { - if (this->type == 1) { - if (this->action < 7 && this->knockbackDuration != 0) { - brother = this->child; + if (super->contactFlags != 0x80 && super->contactFlags != 0x81) { + if (super->type == 1) { + if (super->action < 7 && super->knockbackDuration != 0) { + brother = super->child; if (brother != NULL) { - brother->parent = this->parent; + brother->parent = super->parent; do { brother->action = 5; brother->spritePriority.b1 = 1; @@ -90,469 +106,469 @@ void AcroBandit_OnCollision(Entity* this) { brother->iframes = -12; } while (brother = brother->child, brother != NULL); } - if (this->parent != NULL) { - this->parent->child = this->child; + if (super->parent != NULL) { + super->parent->child = super->child; } else { - if (this->child != NULL) - this->parent = this; + if (super->child != NULL) + super->parent = super; } - this->action = 9; - this->spritePriority.b1 = 1; - if (this->knockbackDirection < 0x10) { - this->spriteSettings.flipX = 0; + super->action = 9; + super->spritePriority.b1 = 1; + if (super->knockbackDirection < 0x10) { + super->spriteSettings.flipX = 0; } else { - this->spriteSettings.flipX = 1; + super->spriteSettings.flipX = 1; } - InitializeAnimation(this, 14); + InitializeAnimation(super, 14); } - if (this->health == 0) { - this->knockbackDirection = DirectionNormalize((this->knockbackDirection + (7 & Random())) - 4); - this->knockbackDuration += this->type2 * 3; + if (super->health == 0) { + super->knockbackDirection = DirectionNormalize((super->knockbackDirection + (7 & Random())) - 4); + super->knockbackDuration += super->type2 * 3; sub_08032338(this); } } - if (this->knockbackDuration != 0 && this->frame & 0x10) { - if (this->type == 0) { - this->action = 8; + if (super->knockbackDuration != 0 && super->frame & 0x10) { + if (super->type == 0) { + super->action = 8; } else { - this->action = 9; + super->action = 9; } - if (this->knockbackDirection < 0x10) { - this->spriteSettings.flipX = 0; + if (super->knockbackDirection < 0x10) { + super->spriteSettings.flipX = 0; } else { - this->spriteSettings.flipX = 1; + super->spriteSettings.flipX = 1; } - this->spritePriority.b1 = 1; - InitializeAnimation(this, 14); + super->spritePriority.b1 = 1; + InitializeAnimation(super, 14); } } - if (this->confusedTime) - Create0x68FX(this, FX_STARS); + if (super->confusedTime) + Create0x68FX(super, FX_STARS); - EnemyFunctionHandlerAfterCollision(this, AcroBandit_Functions); + EnemyFunctionHandlerAfterCollision(super, AcroBandit_Functions); } -void AcroBandit_OnKnockback(Entity* this) { - if (this->iframes > 0) - GravityUpdate(this, Q_8_8(24.0)); +void AcroBandit_OnKnockback(AcroBanditEntity* this) { + if (super->iframes > 0) + GravityUpdate(super, Q_8_8(24.0)); - GenericKnockback(this); + GenericKnockback(super); } -void AcroBandit_OnGrabbed(Entity* this) { +void AcroBandit_OnGrabbed(AcroBanditEntity* this) { } -void AcroBandit_Type0(Entity* this) { - static void (*const AcroBandit_Type0_Actions[])(Entity*) = { +void AcroBandit_Type0(AcroBanditEntity* this) { + static void (*const AcroBandit_Type0_Actions[])(AcroBanditEntity*) = { AcroBandit_Type0Action0, AcroBandit_Type0Action1, AcroBandit_Type0Action2, AcroBandit_Type0Action3, AcroBandit_Type0Action4, AcroBandit_Type0Action5, AcroBandit_Type0Action6, AcroBandit_Type0Action7, AcroBandit_Type0Action8, }; - AcroBandit_Type0_Actions[this->action](this); + AcroBandit_Type0_Actions[super->action](this); } -void AcroBandit_Type0Action0(Entity* this) { - sub_0804A720(this); - this->action = 1; - this->field_0x74.HWORD = this->x.HALF.HI; - this->field_0x76.HWORD = this->y.HALF.HI; - this->field_0x78.HALF.HI = Random(); +void AcroBandit_Type0Action0(AcroBanditEntity* this) { + sub_0804A720(super); + super->action = 1; + this->unk_74.HWORD = super->x.HALF.HI; + this->unk_76.HWORD = super->y.HALF.HI; + this->unk_79 = Random(); } -void AcroBandit_Type0Action1(Entity* this) { +void AcroBandit_Type0Action1(AcroBanditEntity* this) { u32 rand; s32 x; s32 y; - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } else { - if (sub_08049FDC(this, 1)) { + if (sub_08049FDC(super, 1)) { rand = Random(); - x = this->field_0x74.HWORD + ((s32)rand % 5) * 0x10 - 0x20; - y = this->field_0x76.HWORD + ((s32)(rand >> 4) % 5) * 0x10 - 0x20; - if (sub_080B1B18(x, y, this->collisionLayer) == 0) { - this->action = 2; - this->spriteSettings.draw = 1; - this->x.HALF.HI = x; - this->y.HALF.HI = y; - InitializeAnimation(this, 0); + x = this->unk_74.HWORD + ((s32)rand % 5) * 0x10 - 0x20; + y = this->unk_76.HWORD + ((s32)(rand >> 4) % 5) * 0x10 - 0x20; + if (sub_080B1B18(x, y, super->collisionLayer) == 0) { + super->action = 2; + super->spriteSettings.draw = 1; + super->x.HALF.HI = x; + super->y.HALF.HI = y; + InitializeAnimation(super, 0); } } } } -void AcroBandit_Type0Action2(Entity* this) { +void AcroBandit_Type0Action2(AcroBanditEntity* this) { static const u8 timers[] = { 2, 2, 2, 3, 3, 3, 3, 4 }; - GetNextFrame(this); - if (this->frame & 1) { - this->frame = 0; - COLLISION_ON(this); + GetNextFrame(super); + if (super->frame & 1) { + super->frame = 0; + COLLISION_ON(super); } else { - if (this->frame & ANIM_DONE) { - this->action = 0x3; - this->timer = timers[Random() & 7]; - InitializeAnimation(this, 1); + if (super->frame & ANIM_DONE) { + super->action = 0x3; + super->timer = timers[Random() & 7]; + InitializeAnimation(super, 1); } } } -void AcroBandit_Type0Action3(Entity* this) { +void AcroBandit_Type0Action3(AcroBanditEntity* this) { if (sub_08031E04(this)) { - this->action = 5; - if (this->x.HALF.HI > gUnk_020000B0->x.HALF.HI) { - this->spriteSettings.flipX = 0; + super->action = 5; + if (super->x.HALF.HI > gUnk_020000B0->x.HALF.HI) { + super->spriteSettings.flipX = 0; } else { - this->spriteSettings.flipX = 1; + super->spriteSettings.flipX = 1; } - InitializeAnimation(this, 3); + InitializeAnimation(super, 3); } else { - if ((this->frame & 1) && this->timer) { - this->frame &= 0xfe; - this->timer--; + if ((super->frame & 1) && super->timer) { + super->frame &= 0xfe; + super->timer--; } - GetNextFrame(this); - if (this->timer == 0) { - this->action = 4; - COLLISION_OFF(this); - InitializeAnimation(this, 2); + GetNextFrame(super); + if (super->timer == 0) { + super->action = 4; + COLLISION_OFF(super); + InitializeAnimation(super, 2); } } } -void AcroBandit_Type0Action4(Entity* this) { +void AcroBandit_Type0Action4(AcroBanditEntity* this) { static const u8 timers[] = { 60, 60, 90, 120, 120, 120, 120, 150 }; - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 1; - this->timer = timers[Random() & 7]; - this->spriteSettings.draw = 0; + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 1; + super->timer = timers[Random() & 7]; + super->spriteSettings.draw = 0; } } -void AcroBandit_Type0Action5(Entity* this) { - Entity *a, *b; +void AcroBandit_Type0Action5(AcroBanditEntity* this) { + AcroBanditEntity *a, *b; - GetNextFrame(this); - if (this->frame & ANIM_DONE) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { if (gEntCount < MAX_ENTITIES - 4) { u32 tmp = Random(); tmp &= 3; - a = CreateEnemy(ACRO_BANDIT, 1); - a->type2 = 0; - a->parent = NULL; - a->field_0x74.HALF.LO = tmp; + a = (AcroBanditEntity*) CreateEnemy(ACRO_BANDIT, 1); + a->base.type2 = 0; + a->base.parent = NULL; + a->unk_74.HALF.LO = tmp; sub_08031E48(this, a); - a->child = CreateEnemy(ACRO_BANDIT, 1); + a->base.child = CreateEnemy(ACRO_BANDIT, 1); - b = a->child; - b->type2 = 1; - b->parent = a; - b->field_0x74.HALF.LO = tmp; + b = (AcroBanditEntity*) a->base.child; + b->base.type2 = 1; + b->base.parent = &a->base; + b->unk_74.HALF.LO = tmp; sub_08031E48(this, b); - b->child = CreateEnemy(ACRO_BANDIT, 1); + b->base.child = CreateEnemy(ACRO_BANDIT, 1); - a = b->child; - a->type2 = 2; - a->parent = b; - a->field_0x74.HALF.LO = tmp; + a = (AcroBanditEntity*) b->base.child; + a->base.type2 = 2; + a->base.parent = &b->base; + a->unk_74.HALF.LO = tmp; sub_08031E48(this, a); - a->child = CreateEnemy(ACRO_BANDIT, 1); + a->base.child = CreateEnemy(ACRO_BANDIT, 1); - b = a->child; - b->type2 = 3; - b->parent = a; - b->field_0x74.HALF.LO = tmp; + b = (AcroBanditEntity*) a->base.child; + b->base.type2 = 3; + b->base.parent = &a->base; + b->unk_74.HALF.LO = tmp; sub_08031E48(this, b); - b->child = CreateEnemy(ACRO_BANDIT, 1); + b->base.child = CreateEnemy(ACRO_BANDIT, 1); - a = b->child; - a->type2 = 4; - a->parent = b; - a->child = NULL; - a->field_0x74.HALF.LO = tmp; + a = (AcroBanditEntity*) b->base.child; + a->base.type2 = 4; + a->base.parent = &b->base; + a->base.child = NULL; + a->unk_74.HALF.LO = tmp; sub_08031E48(this, a); - this->action = 6; - this->timer = 20; - this->spritePriority.b0 = 7; - InitializeAnimation(this, 7); + super->action = 6; + super->timer = 20; + super->spritePriority.b0 = 7; + InitializeAnimation(super, 7); } } else { - if (this->frame & 1) { - this->frame = 0; - COLLISION_OFF(this); + if (super->frame & 1) { + super->frame = 0; + COLLISION_OFF(super); } } } -void AcroBandit_Type0Action6(Entity* this) { - GetNextFrame(this); - if (--this->timer == 0) { - this->action = 7; - COLLISION_OFF(this); - this->timer = 5; - this->spriteSettings.draw = 0; +void AcroBandit_Type0Action6(AcroBanditEntity* this) { + GetNextFrame(super); + if (--super->timer == 0) { + super->action = 7; + COLLISION_OFF(super); + super->timer = 5; + super->spriteSettings.draw = 0; } } -void AcroBandit_Type0Action7(Entity* this) { - if ((this->timer & 0xF) == 0) { - if (this->timer == 80) { - DeleteEntity(this); +void AcroBandit_Type0Action7(AcroBanditEntity* this) { + if ((super->timer & 0xF) == 0) { + if (super->timer == 80) { + DeleteEntity(super); } else { - this->action = 1; - this->timer = 180; + super->action = 1; + super->timer = 180; } } } -void AcroBandit_Type0Action8(Entity* this) { - if (this->frame & ANIM_DONE) { - this->action = 1; - this->timer = 180; - this->spriteSettings.draw = 0; +void AcroBandit_Type0Action8(AcroBanditEntity* this) { + if (super->frame & ANIM_DONE) { + super->action = 1; + super->timer = 180; + super->spriteSettings.draw = 0; } else { - GetNextFrame(this); - if ((this->frame & 0xf) == 2) { - COLLISION_OFF(this); + GetNextFrame(super); + if ((super->frame & 0xf) == 2) { + COLLISION_OFF(super); } } } -static bool32 sub_08031E04(Entity* this) { +static bool32 sub_08031E04(AcroBanditEntity* this) { static const s8 gUnk_080CE5C0[] = { -32, 0, 0, 32, 32, 0, 0, 0 }; - Entity* ent; + Entity* entity; const s8* tmp; - ent = sub_08049DF4(1); - if (ent == NULL) + entity = sub_08049DF4(1); + if (entity == NULL) return FALSE; - tmp = &gUnk_080CE5C0[this->frame & 6]; - return EntityWithinDistance(this, ent->x.HALF.HI + tmp[0], ent->y.HALF.HI + tmp[1], 0x50); + tmp = &gUnk_080CE5C0[super->frame & 6]; + return EntityWithinDistance(super, entity->x.HALF.HI + tmp[0], entity->y.HALF.HI + tmp[1], 0x50); } -static void sub_08031E48(Entity* this, Entity* child) { - CopyPosition(this, child); - child->field_0x6c.HALF.LO = this->field_0x6c.HALF.LO; - child->field_0x70.HALF.LO = this->field_0x70.HALF.LO; - child->field_0x70.HALF.HI = this->field_0x70.HALF.HI; - child->field_0x6e.HALF.LO = this->field_0x6e.HALF.LO; - child->field_0x6e.HALF.HI = this->field_0x6e.HALF.HI; - child->field_0x7c.WORD = (s32)this; +static void sub_08031E48(AcroBanditEntity* this, AcroBanditEntity* child) { + CopyPosition(super, &child->base); + child->unk_6c = this->unk_6c; + child->unk_70 = this->unk_70; + child->unk_72 = this->unk_72; + child->unk_6e = this->unk_6e; + child->unk_6f = this->unk_6f; + child->unk_7c = super; } -void AcroBandit_Type1(Entity* this) { - static void (*const AcroBandit_Type1_Actions[])(Entity*) = { +void AcroBandit_Type1(AcroBanditEntity* this) { + static void (*const AcroBandit_Type1_Actions[])(AcroBanditEntity*) = { AcroBandit_Type1Init, AcroBandit_Type1Action1, AcroBandit_Type1Action2, AcroBandit_Type1Action3, AcroBandit_Type1Action4, AcroBandit_Type1Action5, AcroBandit_Type1Action6, AcroBandit_Type1Action7, AcroBandit_Type1Action8, AcroBandit_Type1Action9, }; - AcroBandit_Type1_Actions[this->action](this); + AcroBandit_Type1_Actions[super->action](this); } -void AcroBandit_Type1Init(Entity* this) { - this->action = 1; - this->spritePriority.b1 = 1; - this->zVelocity = Q_16_16(4.0); - this->z.HALF.HI = (4 - this->type2) * 0xe; - this->field_0x78.HALF.HI = Random(); - InitializeAnimation(this, 4); +void AcroBandit_Type1Init(AcroBanditEntity* this) { + super->action = 1; + super->spritePriority.b1 = 1; + super->zVelocity = Q_16_16(4.0); + super->z.HALF.HI = (4 - super->type2) * 0xe; + this->unk_79 = Random(); + InitializeAnimation(super, 4); } -void AcroBandit_Type1Action1(Entity* this) { +void AcroBandit_Type1Action1(AcroBanditEntity* this) { int draw; - this->z.WORD -= this->zVelocity; - this->zVelocity -= Q_16_16(3.0 / 32.0); + super->z.WORD -= super->zVelocity; + super->zVelocity -= Q_16_16(3.0 / 32.0); - if (this->z.HALF.HI < 1) { - draw = this->spriteSettings.draw; + if (super->z.HALF.HI < 1) { + draw = super->spriteSettings.draw; if (!draw) EnqueueSFX(SFX_12B); - this->spriteSettings.draw = 1; + super->spriteSettings.draw = 1; } - draw = this->spriteSettings.draw; + draw = super->spriteSettings.draw; if (draw == 1) - GetNextFrame(this); + GetNextFrame(super); - if (this->zVelocity <= 0) { - this->action = 2; - COLLISION_ON(this); - InitializeAnimation(this, 5); + if (super->zVelocity <= 0) { + super->action = 2; + COLLISION_ON(super); + InitializeAnimation(super, 5); } } -void AcroBandit_Type1Action2(Entity* this) { +void AcroBandit_Type1Action2(AcroBanditEntity* this) { static const u16 banditGravity[] = { Q_8_8(22.0), Q_8_8(19.0), Q_8_8(16.0), Q_8_8(13.0), Q_8_8(11.0) }; - GravityUpdate(this, banditGravity[this->type2]); - if (this->type2 * -0xe <= this->z.HALF.HI) { - this->action = 3; - this->timer = 20; - this->z.HALF.HI = this->type2 * -0xe; - if (this->parent != NULL) - this->spritePriority.b1 = 0; - InitializeAnimation(this, 6); + GravityUpdate(super, banditGravity[super->type2]); + if (super->type2 * -0xe <= super->z.HALF.HI) { + super->action = 3; + super->timer = 20; + super->z.HALF.HI = super->type2 * -0xe; + if (super->parent != NULL) + super->spritePriority.b1 = 0; + InitializeAnimation(super, 6); } } -void AcroBandit_Type1Action3(Entity* this) { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) && ((this->parent != NULL) || (--this->timer == 0))) { - this->action = 4; - this->direction = sub_08049F84(this, 1); - *(u8*)&this->field_0x76 = 0; - if (this->child != NULL) { - InitializeAnimation(this, 9); +void AcroBandit_Type1Action3(AcroBanditEntity* this) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) && ((super->parent != NULL) || (--super->timer == 0))) { + super->action = 4; + super->direction = sub_08049F84(super, 1); + this->unk_76.HALF.LO = 0; + if (super->child != NULL) { + InitializeAnimation(super, 9); } else { - InitializeAnimation(this, 8); + InitializeAnimation(super, 8); } } } -void AcroBandit_Type1Action4(Entity* this) { +void AcroBandit_Type1Action4(AcroBanditEntity* this) { Entity* parent; if (!sub_080322A4(this)) { - parent = this->parent; + parent = super->parent; if (parent == NULL) { - if (sub_08049FDC(this, 1)) { - if ((++this->field_0x78.HALF.HI & 7) == 0) { - sub_08004596(this, GetFacingDirection(this, gUnk_020000B0)); + if (sub_08049FDC(super, 1)) { + if ((++this->unk_79 & 7) == 0) { + sub_08004596(super, GetFacingDirection(super, gUnk_020000B0)); } - this->field_0x76.HALF.LO = 0; + this->unk_76.HALF.LO = 0; } else { - if (this->field_0x76.HALF.LO) { - (this->field_0x76.HALF.LO)--; - sub_08004596(this, this->field_0x7a.HALF.LO); + if (this->unk_76.HALF.LO) { + (this->unk_76.HALF.LO)--; + sub_08004596(super, this->unk_7a); } else { - this->field_0x76.HALF.LO = 0x10; - if (sub_08049FA0(this) == 0 && (Random() & 1)) { - this->field_0x7a.HALF.LO = sub_08049EE4(this); + this->unk_76.HALF.LO = 0x10; + if (sub_08049FA0(super) == 0 && (Random() & 1)) { + this->unk_7a = sub_08049EE4(super); } else { - this->field_0x7a.HALF.LO = Random() & 30; + this->unk_7a = Random() & 30; } } } - if (this->direction & 0xf) - this->spriteSettings.flipX = (this->direction >> 4 ^ 1); + if (super->direction & 0xf) + super->spriteSettings.flipX = (super->direction >> 4 ^ 1); - ProcessMovement0(this); + ProcessMovement0(super); } else { - if (this->field_0x76.HALF.HI == 0) { - if (EntityWithinDistance(this, parent->x.HALF.HI, parent->y.HALF.HI, 1) == 0) { - this->field_0x76.HALF.HI = 1; - this->direction = GetFacingDirection(this, parent); + if (this->unk_76.HALF.HI == 0) { + if (EntityWithinDistance(super, parent->x.HALF.HI, parent->y.HALF.HI, 1) == 0) { + this->unk_76.HALF.HI = 1; + super->direction = GetFacingDirection(super, parent); sub_080322E8(this); - LinearMoveUpdate(this); + LinearMoveUpdate(super); } } else { - this->direction = GetFacingDirection(this, parent); + super->direction = GetFacingDirection(super, parent); sub_080322E8(this); - LinearMoveUpdate(this); - if (this->x.HALF.HI == parent->x.HALF.HI && this->y.HALF.HI == parent->y.HALF.HI) - this->field_0x76.HALF.HI = 0; + LinearMoveUpdate(super); + if (super->x.HALF.HI == parent->x.HALF.HI && super->y.HALF.HI == parent->y.HALF.HI) + this->unk_76.HALF.HI = 0; } } - GetNextFrame(this); + GetNextFrame(super); } } -void AcroBandit_Type1Action5(Entity* this) { - if (GravityUpdate(this, Q_8_8(32.0))) +void AcroBandit_Type1Action5(AcroBanditEntity* this) { + if (GravityUpdate(super, Q_8_8(32.0))) return; sub_08032290(this); } -void AcroBandit_Type1Action6(Entity* this) { +void AcroBandit_Type1Action6(AcroBanditEntity* this) { static const u8 fallDirections[] = { 0x8, 0x1c, 0x11, 0x2, 0x15, 0xc, 0x0, 0x15, 0x6, 0x19, 0x10, 0x4, 0x19, 0xa, 0x1d, 0x14, 0x8, 0x1d, 0xe, 0x1 }; Entity* tmp; u32 dir; - if (this->timer == 0) { - this->action = 7; - dir = fallDirections[this->field_0x74.HALF.LO * 5 + this->type2]; - this->direction = dir; + if (super->timer == 0) { + super->action = 7; + dir = fallDirections[this->unk_74.HALF.LO * 5 + super->type2]; + super->direction = dir; if (dir >= 0x10) { - this->spriteSettings.flipX = 1; + super->spriteSettings.flipX = 1; } else { - this->spriteSettings.flipX = 0; + super->spriteSettings.flipX = 0; } - this->speed = 0xf0; - this->zVelocity = Q_16_16(1.125); - this->spritePriority.b1 = 1; - InitializeAnimation(this, 12); + super->speed = 0xf0; + super->zVelocity = Q_16_16(1.125); + super->spritePriority.b1 = 1; + InitializeAnimation(super, 12); } - if (this->child == NULL) { - for (tmp = this->parent; tmp != NULL; tmp = tmp->parent) { + if (super->child == NULL) { + for (tmp = super->parent; tmp != NULL; tmp = tmp->parent) { if (tmp->health != 0) tmp->timer = 0; } - this->timer = 0; + super->timer = 0; } } -void AcroBandit_Type1Action7(Entity* this) { - ProcessMovement2(this); +void AcroBandit_Type1Action7(AcroBanditEntity* this) { + ProcessMovement2(super); - if (sub_080044EC(this, 0x2000) == 0) - this->action = 8; + if (sub_080044EC(super, 0x2000) == 0) + super->action = 8; } -void AcroBandit_Type1Action8(Entity* this) { - GetNextFrame(this); - if (this->frame & 1) { - this->frame = 0; - this->frameDuration = (Random() & 0x30) + 30; +void AcroBandit_Type1Action8(AcroBanditEntity* this) { + GetNextFrame(super); + if (super->frame & 1) { + super->frame = 0; + super->frameDuration = (Random() & 0x30) + 30; } else { - if (this->frame & ANIM_DONE) { - this->action = 9; - InitializeAnimation(this, 13); + if (super->frame & ANIM_DONE) { + super->action = 9; + InitializeAnimation(super, 13); } } } -void AcroBandit_Type1Action9(Entity* this) { - if (GravityUpdate(this, Q_8_8(24.0)) == 0) { - if (this->frame & ANIM_DONE) { - ((Entity*)this->field_0x7c.WORD)->timer--; +void AcroBandit_Type1Action9(AcroBanditEntity* this) { + if (GravityUpdate(super, Q_8_8(24.0)) == 0) { + if (super->frame & ANIM_DONE) { + this->unk_7c->timer--; - DeleteEntity(this); + DeleteEntity(super); } else { - GetNextFrame(this); + GetNextFrame(super); - if ((this->frame & 0xf) == 2) - COLLISION_OFF(this); + if ((super->frame & 0xf) == 2) + COLLISION_OFF(super); } } } -static void sub_08032290(Entity* this) { - this->action = 6; - this->timer = 12; - InitializeAnimation(this, 11); +static void sub_08032290(AcroBanditEntity* this) { + super->action = 6; + super->timer = 12; + InitializeAnimation(super, 11); } -static bool32 sub_080322A4(Entity* this) { - if (this->child != NULL && (this->child->z.HALF.HI + 8) >= this->z.HALF.HI) { - if (this->z.HALF.HI) { - this->action = 5; - this->z.HALF.HI = this->child->z.HALF.HI + 8; - InitializeAnimation(this, 11); +static bool32 sub_080322A4(AcroBanditEntity* this) { + if (super->child != NULL && (super->child->z.HALF.HI + 8) >= super->z.HALF.HI) { + if (super->z.HALF.HI) { + super->action = 5; + super->z.HALF.HI = super->child->z.HALF.HI + 8; + InitializeAnimation(super, 11); return TRUE; } else { sub_08032290(this); @@ -562,25 +578,25 @@ static bool32 sub_080322A4(Entity* this) { return FALSE; } -static void sub_080322E8(Entity* this) { - if (this->field_0x78.HALF.LO) { - if (--this->field_0x78.HALF.LO == 0) { - u32 flipX = this->spriteSettings.flipX; - this->spriteSettings.flipX = flipX ^ 1; +static void sub_080322E8(AcroBanditEntity* this) { + if (this->unk_78) { + if (--this->unk_78 == 0) { + u32 flipX = super->spriteSettings.flipX; + super->spriteSettings.flipX = flipX ^ 1; } } else { - u8 tmp = this->direction; + u8 tmp = super->direction; if (tmp & 0xF) { tmp >>= 4; tmp ^= 1; - if (tmp != this->spriteSettings.flipX) { - this->field_0x78.HALF.LO = 6; + if (tmp != super->spriteSettings.flipX) { + this->unk_78 = 6; } } } } -static void sub_08032338(Entity* this) { - if ((((Entity*)this->field_0x7c.WORD)->timer += 15) != 80) - this->field_0x6c.HALF.LO = 0; +static void sub_08032338(AcroBanditEntity* this) { + if ((this->unk_7c->timer += 15) != 80) + this->unk_6c = 0; } diff --git a/src/enemy/armos.c b/src/enemy/armos.c index e4fa4af1..402fa65e 100644 --- a/src/enemy/armos.c +++ b/src/enemy/armos.c @@ -4,15 +4,13 @@ * * @brief Armos enemy */ - #define NENT_DEPRECATED -#include "global.h" +#include "collision.h" +#include "common.h" #include "enemy.h" +#include "flags.h" #include "functions.h" #include "hitbox.h" -#include "common.h" -#include "flags.h" -#include "collision.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/enemy/ballChainSoldier.c b/src/enemy/ballChainSoldier.c index d2227940..3efbe43e 100644 --- a/src/enemy/ballChainSoldier.c +++ b/src/enemy/ballChainSoldier.c @@ -1,6 +1,12 @@ +/** + * @file ballChainSoldier.c + * @ingroup Enemies + * + * @brief Ball Chain Soldier enemy + */ #define NENT_DEPRECATED -#include "entity.h" #include "enemy.h" +#include "entity.h" #include "functions.h" typedef struct { @@ -57,14 +63,14 @@ void BallChainSoldier_OnGrabbed(BallChainSoldierEntity* this) { } void BallChainSoldier_Init(BallChainSoldierEntity* this) { - Entity* ent; + Entity* entity; sub_0804A720(super); - ent = CreateProjectileWithParent(super, BALL_AND_CHAIN, 0); - if (ent == NULL) + entity = CreateProjectileWithParent(super, BALL_AND_CHAIN, 0); + if (entity == NULL) return; - ent->parent = super; - super->child = ent; + entity->parent = super; + super->child = entity; COLLISION_ON(super); super->spriteSettings.draw = 1; super->animationState = Random() & 3; diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index ace73b7f..f6650533 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -4,44 +4,51 @@ * * @brief Beetle enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" -u32 sub_08021D00(Entity*); -void sub_08021D44(Entity* this, u32 direction); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[30]; + /*0x86*/ u8 unk_86; + /*0x87*/ u8 unk_87; +} BeetleEntity; -extern void (*const Beetle_Functions[])(Entity*); -extern void (*const gUnk_080CB5A8[])(Entity*); -extern void (*const gUnk_080CB5C8[])(Entity*); -extern void (*const gUnk_080CB5D4[])(Entity*); +u32 sub_08021D00(BeetleEntity*); +void sub_08021D44(BeetleEntity* this, u32 direction); + +extern void (*const Beetle_Functions[])(BeetleEntity*); +extern void (*const gUnk_080CB5A8[])(BeetleEntity*); +extern void (*const gUnk_080CB5C8[])(BeetleEntity*); +extern void (*const gUnk_080CB5D4[])(BeetleEntity*); extern const s8 gUnk_080CB5DC[]; extern const s8 gUnk_080CB5E4[]; -void Beetle(Entity* this) { - EnemyFunctionHandler(this, Beetle_Functions); +void Beetle(BeetleEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)Beetle_Functions); } -void Beetle_OnTick(Entity* this) { - gUnk_080CB5A8[this->action](this); +void Beetle_OnTick(BeetleEntity* this) { + gUnk_080CB5A8[super->action](this); } -void Beetle_OnCollision(Entity* this) { - switch (this->contactFlags) { +void Beetle_OnCollision(BeetleEntity* this) { + switch (super->contactFlags) { case 0x80: if (gPlayerState.framestate == PL_STATE_CLIMB) { Beetle_OnTick(this); } else { - this->action = 5; - this->timer = 180; - this->subtimer = 0; - COLLISION_OFF(this); - this->spritePriority.b0 = 3; - CopyPositionAndSpriteOffset(&gPlayerEntity, this); - this->z.HALF.HI = -1; - ((u8*)&this->field_0x86)[1] = 1; - InitializeAnimation(this, 6); + super->action = 5; + super->timer = 180; + super->subtimer = 0; + COLLISION_OFF(super); + super->spritePriority.b0 = 3; + CopyPositionAndSpriteOffset(&gPlayerEntity, super); + super->z.HALF.HI = -1; + this->unk_87 = 1; + InitializeAnimation(super, 6); } break; case 0x93: @@ -49,288 +56,288 @@ void Beetle_OnCollision(Entity* this) { break; } - if (this->health == 0) - this->knockbackDuration = 0; + if (super->health == 0) + super->knockbackDuration = 0; - EnemyFunctionHandlerAfterCollision(this, Beetle_Functions); + EnemyFunctionHandlerAfterCollision(super, Beetle_Functions); } -void Beetle_OnDeath(Entity* this) { - if (this->type == 0) { - GenericDeath(this); +void Beetle_OnDeath(BeetleEntity* this) { + if (super->type == 0) { + GenericDeath(super); } else { - Entity* ent = this->parent; - if (ent != NULL) { - ent->subtimer--; - this->parent = NULL; + Entity* entity = super->parent; + if (entity != NULL) { + entity->subtimer--; + super->parent = NULL; } - CreateDeathFx(this, 0xf0, 0); + CreateDeathFx(super, 0xf0, 0); } } -void Beetle_OnGrabbed(Entity* this) { - if (sub_0806F520(this)) { - gUnk_080CB5C8[this->subAction](this); +void Beetle_OnGrabbed(BeetleEntity* this) { + if (sub_0806F520(super)) { + gUnk_080CB5C8[super->subAction](this); } else { - this->action = 3; - this->z.HALF.HI = 0; - InitializeAnimation(this, 2); + super->action = 3; + super->z.HALF.HI = 0; + InitializeAnimation(super, 2); } } -void sub_0802187C(Entity* this) { - this->subAction = 2; +void sub_0802187C(BeetleEntity* this) { + super->subAction = 2; } -void nullsub_130(Entity* this) { +void nullsub_130(BeetleEntity* this) { } -void sub_08021888(Entity* this) { - if (sub_0806F3E4(this)) +void sub_08021888(BeetleEntity* this) { + if (sub_0806F3E4(super)) Beetle_OnDeath(this); } -void Beetle_Initialize(Entity* this) { - sub_0804A720(this); - this->action = 1; - this->gustJarFlags = 1; - InitializeAnimation(this, 3); +void Beetle_Initialize(BeetleEntity* this) { + sub_0804A720(super); + super->action = 1; + super->gustJarFlags = 1; + InitializeAnimation(super, 3); } -void sub_080218B4(Entity* this) { - gUnk_080CB5D4[this->type2](this); +void sub_080218B4(BeetleEntity* this) { + gUnk_080CB5D4[super->type2](this); } -void sub_080218CC(Entity* this) { - if (this->subAction == 0) { - this->subAction = 1; - this->spriteSettings.draw = 1; - this->direction = ((sub_08049F84(this, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f; - this->speed = 0x100; - this->zVelocity = Q_16_16(1.125); +void sub_080218CC(BeetleEntity* this) { + if (super->subAction == 0) { + super->subAction = 1; + super->spriteSettings.draw = 1; + super->direction = ((sub_08049F84(super, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & 0x1f; + super->speed = 0x100; + super->zVelocity = Q_16_16(1.125); } - GetNextFrame(this); - if (this->frame & 1) { - ProcessMovement2(this); - if (sub_080044EC(this, 0x1c00) == 0) - this->frameDuration = 1; + GetNextFrame(super); + if (super->frame & 1) { + ProcessMovement2(super); + if (sub_080044EC(super, 0x1c00) == 0) + super->frameDuration = 1; } - if (this->frame & ANIM_DONE) { - this->action = 2; - this->timer = (Random() & 0x38) + 8; - this->subtimer = 1; - COLLISION_ON(this); - this->speed = 0x180; - InitializeAnimation(this, 0); + if (super->frame & ANIM_DONE) { + super->action = 2; + super->timer = (Random() & 0x38) + 8; + super->subtimer = 1; + COLLISION_ON(super); + super->speed = 0x180; + InitializeAnimation(super, 0); } } -void sub_08021984(Entity* this) { - if (this->subAction == 0) { - this->subAction = 1; - COLLISION_ON(this); - this->spriteSettings.draw = 3; - this->z.HALF.HI = -0x80; - this->spriteRendering.b3 = 1; - this->spriteOrientation.flipY = 1; +void sub_08021984(BeetleEntity* this) { + if (super->subAction == 0) { + super->subAction = 1; + COLLISION_ON(super); + super->spriteSettings.draw = 3; + super->z.HALF.HI = -0x80; + super->spriteRendering.b3 = 1; + super->spriteOrientation.flipY = 1; EnqueueSFX(SFX_12D); } - if (GravityUpdate(this, Q_8_8(24.0)) == 0) { - this->action = 2; - this->timer = 16; - this->subtimer = 1; - this->spriteSettings.draw = 1; - this->speed = 0x180; - ((u8*)&this->field_0x86)[0] = 60; - InitializeAnimation(this, 0); - UpdateSpriteForCollisionLayer(this); + if (GravityUpdate(super, Q_8_8(24.0)) == 0) { + super->action = 2; + super->timer = 16; + super->subtimer = 1; + super->spriteSettings.draw = 1; + super->speed = 0x180; + this->unk_86 = 60; + InitializeAnimation(super, 0); + UpdateSpriteForCollisionLayer(super); } } -void sub_08021A10(Entity* this) { - GetNextFrame(this); - if (EntityInRectRadius(this, &gPlayerEntity, 120, 80) && sub_08021D00(this) == 0) { - if (--this->timer == 0) { - this->action = 3; - this->timer = (Random() & 0x3f) + 30; - sub_08021D44(this, this->direction); - InitializeAnimation(this, 2); +void sub_08021A10(BeetleEntity* this) { + GetNextFrame(super); + if (EntityInRectRadius(super, &gPlayerEntity, 120, 80) && sub_08021D00(this) == 0) { + if (--super->timer == 0) { + super->action = 3; + super->timer = (Random() & 0x3f) + 30; + sub_08021D44(this, super->direction); + InitializeAnimation(super, 2); } } } -void sub_08021A64(Entity* this) { +void sub_08021A64(BeetleEntity* this) { if (!sub_08021D00(this)) { - if (--this->timer == 0) { - this->action = 2; - this->timer = (Random() & 0x1F) + 30; - InitializeAnimation(this, 0); + if (--super->timer == 0) { + super->action = 2; + super->timer = (Random() & 0x1F) + 30; + InitializeAnimation(super, 0); } - if (--this->subtimer == 0) { + if (--super->subtimer == 0) { u32 tmp; - this->subtimer = 8; - tmp = sub_08049F84(this, 1); + super->subtimer = 8; + tmp = sub_08049F84(super, 1); if (tmp == 0xff) { - this->action = 7; - InitializeAnimation(this, 1); + super->action = 7; + InitializeAnimation(super, 1); return; } sub_08021D44(this, tmp); } - ProcessMovement0(this); - GetNextFrame(this); + ProcessMovement0(super); + GetNextFrame(super); } } -void sub_08021AD8(Entity* this) { - GetNextFrame(this); - if (this->frame & 1) { - if (this->timer != 0) { +void sub_08021AD8(BeetleEntity* this) { + GetNextFrame(super); + if (super->frame & 1) { + if (super->timer != 0) { u32 tmp; - this->timer = 0; - tmp = sub_08049F84(this, 1); + super->timer = 0; + tmp = sub_08049F84(super, 1); if (tmp == 0xff) { - this->action = 2; - this->timer = 8; - InitializeAnimation(this, 0); + super->action = 2; + super->timer = 8; + InitializeAnimation(super, 0); return; } - this->direction = (u8)tmp; + super->direction = (u8)tmp; EnqueueSFX(SFX_PLY_JUMP); } - ProcessMovement2(this); - if (!GravityUpdate(this, Q_8_8(24.0))) - this->frameDuration = 1; + ProcessMovement2(super); + if (!GravityUpdate(super, Q_8_8(24.0))) + super->frameDuration = 1; } - if (this->frame & ANIM_DONE) { - this->action = 2; - this->timer = 20; - ((u8*)&this->field_0x86)[0] = 60; - InitializeAnimation(this, 0); + if (super->frame & ANIM_DONE) { + super->action = 2; + super->timer = 20; + this->unk_86 = 60; + InitializeAnimation(super, 0); } } -void sub_08021B64(Entity* this) { +void sub_08021B64(BeetleEntity* this) { if (gPlayerState.flags & PL_DROWNING) { - this->action = 3; - this->z.WORD = 0; - InitializeAnimation(this, 2); + super->action = 3; + super->z.WORD = 0; + InitializeAnimation(super, 2); } else { s32 iVar4 = 1; if (gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_CAPE) { if (sub_0807953C()) - iVar4 = this->type * 3 + 8; + iVar4 = super->type * 3 + 8; - iVar4 = this->timer - iVar4; + iVar4 = super->timer - iVar4; if (iVar4 < 0) iVar4 = 0; - this->timer = (u8)iVar4; + super->timer = (u8)iVar4; } if (gPlayerState.flags & (PL_DISABLE_ITEMS | PL_CAPTURED)) iVar4 = 0; if (iVar4 == 0) { - this->action = 6; - this->zVelocity = Q_16_16(1.0); - ((u8*)&this->field_0x86)[1] = 0; + super->action = 6; + super->zVelocity = Q_16_16(1.0); + this->unk_87 = 0; if (gPlayerEntity.direction != 0xff) { - this->direction = 0x10 ^ gPlayerEntity.direction; + super->direction = 0x10 ^ gPlayerEntity.direction; } else { - this->direction = (gPlayerEntity.animationState << 2) ^ 0x10; + super->direction = (gPlayerEntity.animationState << 2) ^ 0x10; } - InitializeAnimation(this, 5); + InitializeAnimation(super, 5); } else { gPlayerState.mobility |= 0x80; gPlayerState.speed_modifier -= 0x50; gPlayerState.attachedBeetleCount++; - CopyPositionAndSpriteOffset(&gPlayerEntity, this); - this->x.HALF.HI += gUnk_080CB5E4[(this->subtimer++ & 0xe) >> 1]; - this->z.HALF.HI--; - GetNextFrame(this); + CopyPositionAndSpriteOffset(&gPlayerEntity, super); + super->x.HALF.HI += gUnk_080CB5E4[(super->subtimer++ & 0xe) >> 1]; + super->z.HALF.HI--; + GetNextFrame(super); } } } -void sub_08021C58(Entity* this) { - GetNextFrame(this); - if (this->frame & 1) { - ProcessMovement2(this); - if (GravityUpdate(this, Q_8_8(24.0)) == 0) - this->frameDuration = 1; +void sub_08021C58(BeetleEntity* this) { + GetNextFrame(super); + if (super->frame & 1) { + ProcessMovement2(super); + if (GravityUpdate(super, Q_8_8(24.0)) == 0) + super->frameDuration = 1; } - if (this->frame & ANIM_DONE) { - this->action = 2; - this->timer = 60; - this->subtimer = 1; - COLLISION_ON(this); - this->spritePriority.b0 = 4; - ((u8*)&this->field_0x86)[0] = 60; - InitializeAnimation(this, 0); + if (super->frame & ANIM_DONE) { + super->action = 2; + super->timer = 60; + super->subtimer = 1; + COLLISION_ON(super); + super->spritePriority.b0 = 4; + this->unk_86 = 60; + InitializeAnimation(super, 0); } } -void sub_08021CD0(Entity* this) { - if ((this->frame & ANIM_DONE) == 0) - GetNextFrame(this); +void sub_08021CD0(BeetleEntity* this) { + if ((super->frame & ANIM_DONE) == 0) + GetNextFrame(super); - if (sub_08049F84(this, 1) == 0xff) + if (sub_08049F84(super, 1) == 0xff) return; - this->action = 3; - InitializeAnimation(this, 2); + super->action = 3; + InitializeAnimation(super, 2); } -u32 sub_08021D00(Entity* this) { +u32 sub_08021D00(BeetleEntity* this) { u32 ret; - if (((u8*)&this->field_0x86)[0]) { - ((u8*)&this->field_0x86)[0]--; + if (this->unk_86) { + this->unk_86--; ret = 0; - } else if (PlayerInRange(this, 1, 0x10) == 0) { + } else if (PlayerInRange(super, 1, 0x10) == 0) { ret = 0; } else { - this->action = 4; - this->timer = 1; - this->zVelocity = Q_16_16(1.5); - InitializeAnimation(this, 4); + super->action = 4; + super->timer = 1; + super->zVelocity = Q_16_16(1.5); + InitializeAnimation(super, 4); ret = 1; } return ret; } -void sub_08021D44(Entity* this, u32 direction) { +void sub_08021D44(BeetleEntity* this, u32 direction) { direction = DirectionRoundUp(direction); - this->direction = direction; + super->direction = direction; if (DirectionIsHorizontal(direction)) { - this->speed = 0x180; + super->speed = 0x180; } else { - this->speed = 0xc0; + super->speed = 0xc0; } } // clang-format off -void (*const Beetle_Functions[])(Entity*) = { +void (*const Beetle_Functions[])(BeetleEntity*) = { Beetle_OnTick, Beetle_OnCollision, - GenericKnockback, + (void (*)(BeetleEntity*))GenericKnockback, Beetle_OnDeath, - GenericConfused, + (void (*)(BeetleEntity*))GenericConfused, Beetle_OnGrabbed, }; -void (*const gUnk_080CB5A8[])(Entity*) = { +void (*const gUnk_080CB5A8[])(BeetleEntity*) = { Beetle_Initialize, sub_080218B4, sub_08021A10, @@ -341,13 +348,13 @@ void (*const gUnk_080CB5A8[])(Entity*) = { sub_08021CD0, }; -void (*const gUnk_080CB5C8[])(Entity*) = { +void (*const gUnk_080CB5C8[])(BeetleEntity*) = { sub_0802187C, nullsub_130, sub_08021888, }; -void (*const gUnk_080CB5D4[])(Entity*) = { +void (*const gUnk_080CB5D4[])(BeetleEntity*) = { sub_080218CC, sub_08021984, }; diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index 86fe70d0..1f178dfa 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -4,26 +4,32 @@ * * @brief Blade Trap enemy */ - -#include "sound.h" +#define NENT_DEPRECATED #include "entity.h" -#include "room.h" #include "object.h" +#include "room.h" +#include "sound.h" -void BladeTrap(Entity* this) { - if (this->action == 0) { - this->action = 1; - this->child = GetCurrentRoomProperty(this->type); - UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u16 unk_74; +} BladeTrapEntity; + +void BladeTrap(BladeTrapEntity* this) { + if (super->action == 0) { + super->action = 1; + super->child = GetCurrentRoomProperty(super->type); + UpdateRailMovement(super, (u16**)&super->child, &this->unk_74); } - if (!(this->direction & 0x80)) { - LinearMoveUpdate(this); + if (!(super->direction & 0x80)) { + LinearMoveUpdate(super); } - if (!(--this->field_0x74.HWORD)) { - if (!(this->direction & 0x80)) { + if (!(--this->unk_74)) { + if (!(super->direction & 0x80)) { EnqueueSFX(SFX_METAL_CLINK); } - UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); + UpdateRailMovement(super, (u16**)&super->child, &this->unk_74); } } diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index bfc8f092..1a35c1f4 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -4,38 +4,47 @@ * * @brief Bobomb enemy */ - +#define NENT_DEPRECATED #include "asm.h" #include "collision.h" -#include "sound.h" #include "enemy.h" -#include "object.h" #include "functions.h" +#include "object.h" +#include "sound.h" -void sub_0802CB68(Entity*); -void sub_0802CBC4(Entity*); -void sub_0802CC18(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; +} BobombEntity; -extern void (*const Bobomb_Functions[])(Entity*); -extern void (*const gUnk_080CD5EC[])(Entity*); -extern void (*const gUnk_080CD600[])(Entity*); -extern void (*const gUnk_080CD618[])(Entity*); +void sub_0802CB68(BobombEntity* this); +void sub_0802CBC4(BobombEntity* this); +void sub_0802CC18(BobombEntity* this); -void Bobomb(Entity* this) { - EnemyFunctionHandler(this, Bobomb_Functions); +extern void (*const Bobomb_Functions[])(BobombEntity*); +extern void (*const gUnk_080CD5EC[])(BobombEntity*); +extern void (*const gUnk_080CD600[])(BobombEntity*); +extern void (*const gUnk_080CD618[])(BobombEntity*); + +void Bobomb(BobombEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)Bobomb_Functions); } -void Bobomb_OnTick(Entity* this) { - gUnk_080CD5EC[this->action](this); +void Bobomb_OnTick(BobombEntity* this) { + gUnk_080CD5EC[super->action](this); } -void Bobomb_OnCollision(Entity* this) { - if (this->contactFlags & 0x80) { - switch (this->contactFlags & 0x7f) { +void Bobomb_OnCollision(BobombEntity* this) { + if (super->contactFlags & 0x80) { + switch (super->contactFlags & 0x7f) { case 0: case 1: - if (this->field_0x82.HALF.LO) { - this->knockbackDuration = 0; + if (this->unk_82) { + super->knockbackDuration = 0; gPlayerEntity.knockbackDuration = 4; } return; @@ -43,276 +52,276 @@ void Bobomb_OnCollision(Entity* this) { case 0x14: case 0x15: case 0x16: - this->action = 3; - this->knockbackDuration = 0; + super->action = 3; + super->knockbackDuration = 0; sub_0802CBC4(this); return; } - this->field_0x82.HALF.LO++; - this->field_0x80.HALF.LO = 28; - switch (this->field_0x82.HALF.LO) { + this->unk_82++; + this->unk_80 = 28; + switch (this->unk_82) { case 1: sub_0802CB68(this); EnqueueSFX(SFX_14D); break; case 2: - this->action = 3; - this->hitType = 0x6e; - this->subtimer = 1; - this->zVelocity = Q_16_16(1.5); - this->speed = 0; - this->field_0x80.HALF.HI = 1; - InitializeAnimation(this, this->direction >> 4 | 6); + super->action = 3; + super->hitType = 0x6e; + super->subtimer = 1; + super->zVelocity = Q_16_16(1.5); + super->speed = 0; + this->unk_81 = 1; + InitializeAnimation(super, super->direction >> 4 | 6); break; } } - EnemyFunctionHandlerAfterCollision(this, Bobomb_Functions); + EnemyFunctionHandlerAfterCollision(super, Bobomb_Functions); } -void Bobomb_OnGrabbed(Entity* this) { - if (this->subAction < 3 && !sub_0806F520(this)) { - this->subAction = 0; - this->subtimer = 1; - this->z.HALF.HI = 0; - if (this->field_0x82.HALF.LO != 2) { - this->speed = this->field_0x82.HALF.LO ? 0x200 : 0x80; +void Bobomb_OnGrabbed(BobombEntity* this) { + if (super->subAction < 3 && !sub_0806F520(super)) { + super->subAction = 0; + super->subtimer = 1; + super->z.HALF.HI = 0; + if (this->unk_82 != 2) { + super->speed = this->unk_82 ? 0x200 : 0x80; } - this->zVelocity = Q_16_16(1.5); - this->field_0x82.HALF.HI = 0; - this->field_0x80.HALF.HI = 0; + super->zVelocity = Q_16_16(1.5); + this->unk_83 = 0; + this->unk_81 = 0; } else { - this->z.HALF.HI = -1; - gUnk_080CD600[this->subAction](this); - if (this->timer != 0) { - GetNextFrame(this); + super->z.HALF.HI = -1; + gUnk_080CD600[super->subAction](this); + if (super->timer != 0) { + GetNextFrame(super); } } } -void sub_0802C820(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 60; +void sub_0802C820(BobombEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 60; } -void sub_0802C82C(Entity* this) { - sub_0806F4E8(this); +void sub_0802C82C(BobombEntity* this) { + sub_0806F4E8(super); } -void sub_0802C834(Entity* this) { - sub_0806F3E4(this); +void sub_0802C834(BobombEntity* this) { + sub_0806F3E4(super); } -void sub_0802C83C(Entity* this) { - if (this->field_0x82.HALF.LO) { - if (--this->timer == 0) { - this->action = 3; +void sub_0802C83C(BobombEntity* this) { + if (this->unk_82) { + if (--super->timer == 0) { + super->action = 3; switch (gPlayerEntity.animationState & 6) { case 2: - this->x.HALF.HI -= 6; + super->x.HALF.HI -= 6; break; case 6: - this->x.HALF.HI += 6; + super->x.HALF.HI += 6; break; } sub_0802CBC4(this); } else { sub_0802CC18(this); - COLLISION_OFF(this); - this->hitType = 0x6e; + COLLISION_OFF(super); + super->hitType = 0x6e; } } else { - this->field_0x82.HALF.LO = 2; - this->timer = 120; - InitializeAnimation(this, (this->direction >> 4) | 6); - COLLISION_OFF(this); - this->hitType = 0x6e; + this->unk_82 = 2; + super->timer = 120; + InitializeAnimation(super, (super->direction >> 4) | 6); + COLLISION_OFF(super); + super->hitType = 0x6e; } } -void nullsub_149(Entity* this) { +void nullsub_149(BobombEntity* this) { /* ... */ } -void sub_0802C8B8(Entity* this) { - this->action = 3; +void sub_0802C8B8(BobombEntity* this) { + super->action = 3; sub_0802CBC4(this); } -void Bobomb_OnDeath(Entity* this) { - GenericDeath(this); - this->spriteSettings.draw = 0; +void Bobomb_OnDeath(BobombEntity* this) { + GenericDeath(super); + super->spriteSettings.draw = 0; } -void sub_0802C8D8(Entity* this) { - this->action = 1; - this->timer = 60; - this->subtimer = 0; - this->direction = (Random() & 0x18) | 4; - this->carryFlags = 0; - this->gustJarFlags = 0x12; - this->field_0x82.HALF.LO = 0; - this->field_0x82.HALF.HI = 0; - this->field_0x80.HALF.LO = 0; - this->field_0x80.HALF.HI = 0; - InitializeAnimation(this, this->direction >> 4); +void sub_0802C8D8(BobombEntity* this) { + super->action = 1; + super->timer = 60; + super->subtimer = 0; + super->direction = (Random() & 0x18) | 4; + super->carryFlags = 0; + super->gustJarFlags = 0x12; + this->unk_82 = 0; + this->unk_83 = 0; + this->unk_80 = 0; + this->unk_81 = 0; + InitializeAnimation(super, super->direction >> 4); } -void sub_0802C91C(Entity* this) { - GetNextFrame(this); - ProcessMovement0(this); - if (this->field_0x82.HALF.LO) { - if (this->collisions != COL_NONE) { - sub_0800417E(this, this->collisions); - InitializeAnimation(this, (this->direction >> 4) | 2); +void sub_0802C91C(BobombEntity* this) { + GetNextFrame(super); + ProcessMovement0(super); + if (this->unk_82) { + if (super->collisions != COL_NONE) { + sub_0800417E(super, super->collisions); + InitializeAnimation(super, (super->direction >> 4) | 2); } - if (--this->timer == 0) { + if (--super->timer == 0) { sub_0802CBC4(this); } else { - if ((this->timer & 0xf) == 8) { - CreateDustSmall(this); + if ((super->timer & 0xf) == 8) { + CreateDustSmall(super); } sub_0802CC18(this); } } else { - if (this->collisions != COL_NONE) { - sub_0800417E(this, this->collisions); - InitializeAnimation(this, this->direction >> 4); + if (super->collisions != COL_NONE) { + sub_0800417E(super, super->collisions); + InitializeAnimation(super, super->direction >> 4); } - if (--this->timer == 0) { - this->timer = 60; - this->direction = (this->direction + 8) & 0x1c; - InitializeAnimation(this, this->direction >> 4); + if (--super->timer == 0) { + super->timer = 60; + super->direction = (super->direction + 8) & 0x1c; + InitializeAnimation(super, super->direction >> 4); } } } -void sub_0802C9B8(Entity* this) { - gUnk_080CD618[this->subAction](this); +void sub_0802C9B8(BobombEntity* this) { + gUnk_080CD618[super->subAction](this); } -void sub_0802C9D0(Entity* this) { - this->subAction = 1; - COLLISION_OFF(this); - this->spritePriority.b1 = 0; - this->field_0x82.HALF.HI = 1; +void sub_0802C9D0(BobombEntity* this) { + super->subAction = 1; + COLLISION_OFF(super); + super->spritePriority.b1 = 0; + this->unk_83 = 1; sub_0802CC18(this); - InitializeAnimation(this, (this->direction >> 4) | 6); - GetNextFrame(this); + InitializeAnimation(super, (super->direction >> 4) | 6); + GetNextFrame(super); } -void sub_0802CA10(Entity* this) { +void sub_0802CA10(BobombEntity* this) { if (gPlayerState.heldObject != 5) { - if (--this->timer == 0) { + if (--super->timer == 0) { sub_0802CBC4(this); } else { sub_0802CC18(this); - GetNextFrame(this); + GetNextFrame(super); } } else { - this->field_0x82.HALF.HI = 2; - this->direction = (((gPlayerEntity.animationState) << 2) | 4) & 0x1c; + this->unk_83 = 2; + super->direction = (((gPlayerEntity.animationState) << 2) | 4) & 0x1c; sub_0802CC18(this); - GetNextFrame(this); + GetNextFrame(super); } } -void sub_0802CA6C(Entity* this) { - if (--this->timer == 0) { +void sub_0802CA6C(BobombEntity* this) { + if (--super->timer == 0) { sub_0802CBC4(this); } else { sub_0802CC18(this); - GetNextFrame(this); + GetNextFrame(super); } } -void sub_0802CA94(Entity* this) { - this->action = 3; - COLLISION_OFF(this); - this->subtimer = 1; - this->spritePriority.b1 = 1; - this->zVelocity = Q_16_16(1.5); - this->speed = 0; - this->field_0x82.HALF.HI = 0; - this->field_0x80.HALF.HI = 0; - this->direction = ((gPlayerEntity.animationState << 2) | 4) & 0x1c; - InitializeAnimation(this, (this->direction >> 4) | 6); +void sub_0802CA94(BobombEntity* this) { + super->action = 3; + COLLISION_OFF(super); + super->subtimer = 1; + super->spritePriority.b1 = 1; + super->zVelocity = Q_16_16(1.5); + super->speed = 0; + this->unk_83 = 0; + this->unk_81 = 0; + super->direction = ((gPlayerEntity.animationState << 2) | 4) & 0x1c; + InitializeAnimation(super, (super->direction >> 4) | 6); } -void sub_0802CAF8(Entity* this) { - if (--this->timer == 0) { +void sub_0802CAF8(BobombEntity* this) { + if (--super->timer == 0) { sub_0802CBC4(this); } else { - if (this->field_0x80.HALF.HI && sub_080044EC(this, 0x2800) == 1) { + if (this->unk_81 && sub_080044EC(super, 0x2800) == 1) { EnqueueSFX(SFX_PLACE_OBJ); } sub_0802CC18(this); - RegisterCarryEntity(this); - if (this->subtimer && this->z.HALF.HI == 0) { - this->subtimer = 0; - COLLISION_ON(this); - this->hitType = 0x6e; + RegisterCarryEntity(super); + if (super->subtimer && super->z.HALF.HI == 0) { + super->subtimer = 0; + COLLISION_ON(super); + super->hitType = 0x6e; } - GetNextFrame(this); + GetNextFrame(super); } } -void nullsub_150(Entity* this) { +void nullsub_150(BobombEntity* this) { /* ... */ } -void sub_0802CB68(Entity* this) { - this->action = 1; - this->subAction = 0; - this->direction = Random() & 0x18; - this->direction |= 4; - COLLISION_ON(this); - if (this->field_0x82.HALF.LO) { - this->timer = 200; - this->speed = 0x200; - InitializeAnimation(this, (this->direction >> 4) | 2); +void sub_0802CB68(BobombEntity* this) { + super->action = 1; + super->subAction = 0; + super->direction = Random() & 0x18; + super->direction |= 4; + COLLISION_ON(super); + if (this->unk_82) { + super->timer = 200; + super->speed = 0x200; + InitializeAnimation(super, (super->direction >> 4) | 2); } else { - this->timer = 60; - this->speed = 0x80; - InitializeAnimation(this, this->direction >> 4); + super->timer = 60; + super->speed = 0x80; + InitializeAnimation(super, super->direction >> 4); } } -void sub_0802CBC4(Entity* this) { - Entity* ent; +void sub_0802CBC4(BobombEntity* this) { + Entity* entity; - this->action = 4; - this->spriteSettings.draw = 0; - COLLISION_OFF(this); - this->health = 0; - if (this->field_0x82.HALF.HI) { + super->action = 4; + super->spriteSettings.draw = 0; + COLLISION_OFF(super); + super->health = 0; + if (this->unk_83) { PlayerDropHeldObject(); } - FreeCarryEntity(this); + FreeCarryEntity(super); - ent = CreateObjectWithParent(this, SMOKE_PARTICLE, 0, 0); - if (ent != NULL) { - ent->collisionLayer = this->collisionLayer; + entity = CreateObjectWithParent(super, SMOKE_PARTICLE, 0, 0); + if (entity != NULL) { + entity->collisionLayer = super->collisionLayer; } } -void sub_0802CC18(Entity* this) { - if (--this->field_0x80.HALF.LO == 0) { - this->field_0x80.HALF.LO = 28; +void sub_0802CC18(BobombEntity* this) { + if (--this->unk_80 == 0) { + this->unk_80 = 28; EnqueueSFX(SFX_14D); } } // clang-format off -void (*const Bobomb_Functions[])(Entity*) = { +void (*const Bobomb_Functions[])(BobombEntity*) = { Bobomb_OnTick, Bobomb_OnCollision, - GenericKnockback, + (void (*)(BobombEntity*))GenericKnockback, Bobomb_OnDeath, - GenericConfused, + (void (*)(BobombEntity*))GenericConfused, Bobomb_OnGrabbed, }; -void (*const gUnk_080CD5EC[])(Entity*) = { +void (*const gUnk_080CD5EC[])(BobombEntity*) = { sub_0802C8D8, sub_0802C91C, sub_0802C9B8, @@ -320,7 +329,7 @@ void (*const gUnk_080CD5EC[])(Entity*) = { nullsub_150, }; -void (*const gUnk_080CD600[])(Entity*) = { +void (*const gUnk_080CD600[])(BobombEntity*) = { sub_0802C820, sub_0802C82C, sub_0802C834, @@ -329,7 +338,7 @@ void (*const gUnk_080CD600[])(Entity*) = { sub_0802C8B8, }; -void (*const gUnk_080CD618[])(Entity*) = { +void (*const gUnk_080CD618[])(BobombEntity*) = { sub_0802C9D0, sub_0802CA10, sub_0802CA6C, diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 96dbcba4..63a53074 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -4,593 +4,606 @@ * * @brief Bomb Peahat enemy */ - +#define NENT_DEPRECATED #include "asm.h" -#include "entity.h" #include "enemy.h" -#include "player.h" -#include "object.h" +#include "entity.h" #include "functions.h" +#include "object.h" +#include "player.h" -void sub_0802AD1C(Entity*, u32); -void sub_0802AD54(Entity*); -void sub_0802B048(Entity*); -void sub_0802ACDC(Entity*, u32); -void sub_0802ADDC(Entity*); -void sub_0802AC40(Entity*); -bool32 sub_0802B234(Entity*); -Entity* sub_0802B250(Entity*); -void sub_0802B264(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; + /*0x7a*/ u8 unk_7a; + /*0x7b*/ u8 unk_7b; + /*0x7c*/ u8 unused2[4]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u16 unk_82; +} BombPeahatEntity; -extern void (*const BombPeahat_Functions[])(Entity*); -extern void (*const gUnk_080CD108[])(Entity*); -extern void (*const gUnk_080CD120[])(Entity*); -extern void (*const gUnk_080CD134[])(Entity*); -extern void (*const gUnk_080CD140[])(Entity*); -extern void (*const gUnk_080CD158[])(Entity*); +void sub_0802AD1C(BombPeahatEntity*, u32); +void sub_0802AD54(BombPeahatEntity*); +void sub_0802B048(BombPeahatEntity*); +void sub_0802ACDC(BombPeahatEntity*, u32); +void sub_0802ADDC(BombPeahatEntity*); +void sub_0802AC40(BombPeahatEntity*); +bool32 sub_0802B234(BombPeahatEntity*); +BombPeahatEntity* sub_0802B250(BombPeahatEntity*); +void sub_0802B264(BombPeahatEntity*); + +extern void (*const BombPeahat_Functions[])(BombPeahatEntity*); +extern void (*const gUnk_080CD108[])(BombPeahatEntity*); +extern void (*const gUnk_080CD120[])(BombPeahatEntity*); +extern void (*const gUnk_080CD134[])(BombPeahatEntity*); +extern void (*const gUnk_080CD140[])(BombPeahatEntity*); +extern void (*const gUnk_080CD158[])(BombPeahatEntity*); extern const Hitbox gUnk_080CD16C; extern const Hitbox gUnk_080CD174; extern const Hitbox gUnk_080CD17C; -void BombPeahat(Entity* this) { +void BombPeahat(BombPeahatEntity* this) { s32 iVar1; - if ((this->type == 2) && (iVar1 = sub_080012DC(this), iVar1)) { - gUnk_080012C8[iVar1](this); + if ((super->type == 2) && (iVar1 = sub_080012DC(super), iVar1)) { + gUnk_080012C8[iVar1](super); } else { - BombPeahat_Functions[GetNextFunction(this)](this); + BombPeahat_Functions[GetNextFunction(super)](this); } } -void BombPeahat_OnTick(Entity* this) { - switch (this->type) { +void BombPeahat_OnTick(BombPeahatEntity* this) { + switch (super->type) { default: - gUnk_080CD108[this->action](this); + gUnk_080CD108[super->action](this); sub_0802AD54(this); break; case 2: - gUnk_080CD120[this->action](this); + gUnk_080CD120[super->action](this); sub_0802B048(this); break; case 3: - gUnk_080CD134[this->action](this); + gUnk_080CD134[super->action](this); break; } } -void BombPeahat_OnCollision(Entity* this) { - this->field_0x80.HALF.HI = 0; - if (this->type < 2) { - InitializeAnimation(this, 0); +void BombPeahat_OnCollision(BombPeahatEntity* this) { + this->unk_81 = 0; + if (super->type < 2) { + InitializeAnimation(super, 0); } } -void BombPeahat_OnGrabbed(Entity* this) { - gUnk_080CD140[this->subAction](this); +void BombPeahat_OnGrabbed(BombPeahatEntity* this) { + gUnk_080CD140[super->subAction](this); } -void sub_0802A8E0(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 60; +void sub_0802A8E0(BombPeahatEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 60; } -void sub_0802A8EC(Entity* this) { - sub_0806F4E8(this); +void sub_0802A8EC(BombPeahatEntity* this) { + sub_0806F4E8(super); } -void sub_0802A8F4(Entity* this) { - sub_0806F3E4(this); +void sub_0802A8F4(BombPeahatEntity* this) { + sub_0806F3E4(super); } -void sub_0802A8FC(Entity* this) { +void sub_0802A8FC(BombPeahatEntity* this) { if ((gPlayerState.field_0x1c & 0xf) == 0) { - this->health = gPlayerState.field_0x1c & 0xf; + super->health = gPlayerState.field_0x1c & 0xf; } } -void nullsub_143(Entity* this) { +void nullsub_143(BombPeahatEntity* this) { } -void sub_0802A91C(Entity* this) { - this->health = 0; +void sub_0802A91C(BombPeahatEntity* this) { + super->health = 0; } -void sub_0802A924(Entity* this) { - this->action = 1; - this->subAction = 0; - this->timer = 0; - this->subtimer = 0; - this->hitbox = (Hitbox*)&gUnk_080CD16C; +void sub_0802A924(BombPeahatEntity* this) { + super->action = 1; + super->subAction = 0; + super->timer = 0; + super->subtimer = 0; + super->hitbox = (Hitbox*)&gUnk_080CD16C; #ifdef EU - this->collisionFlags |= 0x10; + super->collisionFlags |= 0x10; #endif - this->z.HALF.HI = -0x30; - this->field_0x80.HALF.LO = Random() & 1; - this->field_0x82.HWORD = 0; - this->field_0x7a.HALF.HI = 0; - this->field_0x80.HALF.HI = 0; - this->field_0x7a.HALF.LO = 0; + super->z.HALF.HI = -0x30; + this->unk_80 = Random() & 1; + this->unk_82 = 0; + this->unk_7b = 0; + this->unk_81 = 0; + this->unk_7a = 0; #ifndef EU - this->field_0x78.HALF.LO = 0; - this->field_0x78.HALF.HI = 0; + this->unk_78 = 0; + this->unk_79 = 0; #endif - this->collisionLayer = 3; - this->spriteOrientation.flipY = 1; - this->spriteRendering.b3 = 1; - this->spritePriority.b0 = 1; - InitializeAnimation(this, this->type + 1); + super->collisionLayer = 3; + super->spriteOrientation.flipY = 1; + super->spriteRendering.b3 = 1; + super->spritePriority.b0 = 1; + InitializeAnimation(super, super->type + 1); } -void sub_0802A9A8(Entity* this) { - if (this->subtimer) { - this->subtimer--; +void sub_0802A9A8(BombPeahatEntity* this) { + if (super->subtimer) { + super->subtimer--; } else { - if (this->timer != 0) { - if (--this->timer == 0) { - this->action = 2; - this->subAction = 0; - this->timer = 64; + if (super->timer != 0) { + if (--super->timer == 0) { + super->action = 2; + super->subAction = 0; + super->timer = 64; sub_0802ACDC(this, 8); } } else { if (gRoomControls.reload_flags != 0) { return; } - this->spriteSettings.draw = 1; - this->field_0x82.HWORD = 1; - if (this->field_0x80.HALF.LO) { - this->x.HALF.HI = gRoomControls.scroll_x - 0x10; - this->direction = 8; + super->spriteSettings.draw = 1; + this->unk_82 = 1; + if (this->unk_80) { + super->x.HALF.HI = gRoomControls.scroll_x - 0x10; + super->direction = 8; } else { - this->x.HALF.HI = gRoomControls.scroll_x + 0x100; - this->direction = 0x18; + super->x.HALF.HI = gRoomControls.scroll_x + 0x100; + super->direction = 0x18; } - this->y.HALF.HI = gRoomControls.scroll_y + 0x40; - this->timer = 128; + super->y.HALF.HI = gRoomControls.scroll_y + 0x40; + super->timer = 128; sub_0802ADDC(this); } sub_0802AC40(this); } } -void sub_0802AA40(Entity* this) { +void sub_0802AA40(BombPeahatEntity* this) { sub_0802AC40(this); - if (--this->subtimer == 0) { + if (--super->subtimer == 0) { sub_0802ACDC(this, 8); - this->field_0x7a.HALF.HI++; + this->unk_7b++; } - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } else { - Entity* ent = this->child; - if (ent != NULL) { - if (ent->next == NULL) { - this->child = NULL; + BombPeahatEntity* entity = (BombPeahatEntity*)super->child; + if (entity != NULL) { + if (entity->base.next == NULL) { + super->child = NULL; } else { - u32 direction = DirectionRound(this->field_0x80.HALF.LO * 0x10 + 0x18); + u32 direction = DirectionRound(this->unk_80 * 0x10 + 0x18); - if (0x20 < this->field_0x7a.HALF.HI) { - this->direction = direction; + if (0x20 < this->unk_7b) { + super->direction = direction; } - if (this->direction == direction) { - this->action = 3; - this->speed = 0x180; - this->field_0x7a.HALF.HI = 0; - ent->field_0x80.HALF.LO = 1; - ent->timer = 150; + if (super->direction == direction) { + super->action = 3; + super->speed = 0x180; + this->unk_7b = 0; + entity->unk_80 = 1; + entity->base.timer = 150; } } } } } -void sub_0802AAC0(Entity* this) { +void sub_0802AAC0(BombPeahatEntity* this) { sub_0802AC40(this); - if (--this->subtimer == 0) { + if (--super->subtimer == 0) { sub_0802AD1C(this, 4); } - if (this->field_0x80.HALF.HI) { - Entity* ent = this->child; - if (ent == NULL) { - this->field_0x80.HALF.HI = 0; - } else if (ent->next == NULL) { - this->field_0x80.HALF.HI = 0; - this->child = NULL; + if (this->unk_81) { + Entity* entity = super->child; + if (entity == NULL) { + this->unk_81 = 0; + } else if (entity->next == NULL) { + this->unk_81 = 0; + super->child = NULL; #ifdef EU - } else if (ent->timer == 0) { - if (sub_080B1B44(COORD_TO_TILE(this), 1) == 0) { - if (EntityInRectRadius(this, &gPlayerEntity, 0x10, 0x10) && ent->subtimer <= 0x50) { - this->field_0x80.HALF.HI = 0; + } else if (entity->timer == 0) { + if (sub_080B1B44(COORD_TO_TILE(super), 1) == 0) { + if (EntityInRectRadius(super, &gPlayerEntity, 0x10, 0x10) && entity->subtimer <= 0x50) { + this->unk_81 = 0; } - } else if (ent->subtimer <= 0x13) { - this->field_0x80.HALF.HI = 0; + } else if (entity->subtimer <= 0x13) { + this->unk_81 = 0; } } #else - } else if ((ent->timer == 0) && (ent->subtimer <= 0x50)) { - this->field_0x80.HALF.HI = 0; + } else if ((entity->timer == 0) && (entity->subtimer <= 0x50)) { + this->unk_81 = 0; } #endif } else { - this->action = 4; - this->timer = 192; - this->subtimer = 4; - this->field_0x80.HALF.LO ^= 1; + super->action = 4; + super->timer = 192; + super->subtimer = 4; + this->unk_80 ^= 1; #ifndef EU - this->field_0x78.HALF.LO = 0; - this->field_0x78.HALF.HI = 4; - this->direction = 0xff; + this->unk_78 = 0; + this->unk_79 = 4; + super->direction = 0xff; #endif - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); } } #ifdef EU -void sub_0802AB40(Entity* this) { - sub_0802AC40(this); - if (--this->timer == 0) { - if (this->field_0x7a.HALF.LO <= 4) { - this->action = 5; - this->speed = 0; - InitializeAnimation(this, this->type + 1); +void sub_0802AB40(BombPeahatEntity* this) { + sub_0802AC40(super); + if (--super->timer == 0) { + if (this->unk_7a <= 4) { + super->action = 5; + super->speed = 0; + InitializeAnimation(super, super->type + 1); } else { - this->timer = 192; - this->subtimer = 4; - this->field_0x80.HALF.LO ^= 1; + super->timer = 192; + super->subtimer = 4; + this->unk_80 ^= 1; } - } else if (--this->subtimer == 0) { - sub_0802ACDC(this, 4); + } else if (--super->subtimer == 0) { + sub_0802ACDC(super, 4); } } #else -void sub_0802AB40(Entity* this) { +void sub_0802AB40(BombPeahatEntity* this) { sub_0802AC40(this); - switch (this->field_0x78.HALF.LO) { + switch (this->unk_78) { case 0: - if (this->z.HALF.HI) { - if (--this->field_0x78.HALF.HI == 0) { - this->field_0x78.HALF.HI = 4; - this->z.HALF.HI++; + if (super->z.HALF.HI) { + if (--this->unk_79 == 0) { + this->unk_79 = 4; + super->z.HALF.HI++; } } else { - this->field_0x78.HALF.LO = 1; - this->field_0x78.HALF.HI = 0x30; - this->direction = sub_08049F84(this, 0); + this->unk_78 = 1; + this->unk_79 = 0x30; + super->direction = sub_08049F84(super, 0); } break; case 1: - if (--this->field_0x78.HALF.HI == 0) { - this->field_0x78.HALF.LO = 2; - this->field_0x78.HALF.HI = 4; - } else if ((this->field_0x78.HALF.HI & 7) == 0) { - this->direction = sub_08049F84(this, 0); + if (--this->unk_79 == 0) { + this->unk_78 = 2; + this->unk_79 = 4; + } else if ((this->unk_79 & 7) == 0) { + super->direction = sub_08049F84(super, 0); } break; case 2: - if (-0x30 < this->z.HALF.HI) { - if (--this->field_0x78.HALF.HI == 0) { - this->field_0x78.HALF.HI = 4; - this->z.HALF.HI--; + if (-0x30 < super->z.HALF.HI) { + if (--this->unk_79 == 0) { + this->unk_79 = 4; + super->z.HALF.HI--; sub_0802ACDC(this, 4); } } else { - this->action = 5; - this->speed = 0; - InitializeAnimation(this, this->type + 1); + super->action = 5; + super->speed = 0; + InitializeAnimation(super, super->type + 1); } break; } } #endif -void sub_0802AC08(Entity* this) { - if (this->frame & ANIM_DONE) { - this->action = 2; - this->subAction = 0; - this->timer = 64; - this->speed = 0xc0; +void sub_0802AC08(BombPeahatEntity* this) { + if (super->frame & ANIM_DONE) { + super->action = 2; + super->subAction = 0; + super->timer = 64; + super->speed = 0xc0; sub_0802ACDC(this, 8); sub_0802ADDC(this); } - GetNextFrame(this); + GetNextFrame(super); } -void sub_0802AC40(Entity* this) { - GetNextFrame(this); - LinearMoveUpdate(this); - if (this->field_0x7a.HALF.LO) { +void sub_0802AC40(BombPeahatEntity* this) { + GetNextFrame(super); + LinearMoveUpdate(super); + if (this->unk_7a) { if (!sub_0802B234(this)) { - this->field_0x7a.HALF.LO = 0; - this->spritePriority.b1 = 0; + this->unk_7a = 0; + super->spritePriority.b1 = 0; #ifndef EU } else { - if (this->z.HALF.HI == 0) { - if (this->spritePriority.b1 != 1) { - this->spritePriority.b1 = 1; + if (super->z.HALF.HI == 0) { + if (super->spritePriority.b1 != 1) { + super->spritePriority.b1 = 1; } } else { - if (this->spritePriority.b1 != 3) { - this->spritePriority.b1 = 3; + if (super->spritePriority.b1 != 3) { + super->spritePriority.b1 = 3; } } #endif } } else { if (sub_0802B234(this)) { - this->field_0x7a.HALF.LO = 1; + this->unk_7a = 1; #ifndef EU - if (this->z.HALF.HI == 0) { - this->spritePriority.b1 = 1; + if (super->z.HALF.HI == 0) { + super->spritePriority.b1 = 1; } else { - this->spritePriority.b1 = 3; + super->spritePriority.b1 = 3; } #else - this->spritePriority.b1 = 3; + super->spritePriority.b1 = 3; #endif } } } -void sub_0802ACDC(Entity* this, u32 param_2) { +void sub_0802ACDC(BombPeahatEntity* this, u32 param_2) { u32 x; - if (this->field_0x80.HALF.LO) { - x = sub_080045B4(this, gRoomControls.scroll_x + 0x20, gRoomControls.scroll_y + 0x60); + if (this->unk_80) { + x = sub_080045B4(super, gRoomControls.scroll_x + 0x20, gRoomControls.scroll_y + 0x60); } else { - x = sub_080045B4(this, gRoomControls.scroll_x + 0xd0, gRoomControls.scroll_y + 0x60); + x = sub_080045B4(super, gRoomControls.scroll_x + 0xd0, gRoomControls.scroll_y + 0x60); } - sub_08004596(this, x); - this->subtimer = param_2; + sub_08004596(super, x); + super->subtimer = param_2; } -void sub_0802AD1C(Entity* this, u32 param_2) { - Entity* ent = sub_08049DF4(1); - if (ent != NULL) { - u32 y = ent->y.HALF.HI - 0x18; - u32 x = ent->x.HALF.HI; - sub_08004596(this, sub_080045B4(this, x, y)); - this->subtimer = param_2; +void sub_0802AD1C(BombPeahatEntity* this, u32 param_2) { + Entity* entity = sub_08049DF4(1); + if (entity != NULL) { + u32 y = entity->y.HALF.HI - 0x18; + u32 x = entity->x.HALF.HI; + sub_08004596(super, sub_080045B4(super, x, y)); + super->subtimer = param_2; } else { sub_0802ACDC(this, param_2); } } -void sub_0802AD54(Entity* this) { - if (this->field_0x82.HWORD != 0) { +void sub_0802AD54(BombPeahatEntity* this) { + if (this->unk_82 != 0) { if (gRoomControls.reload_flags != 0) { - this->spriteSettings.draw = 0; - DeleteEntity(this); + super->spriteSettings.draw = 0; + DeleteEntity(super); return; } - if (gRoomControls.origin_y > this->y.HALF.HI || - (gRoomControls.origin_y + gRoomControls.height + 0x20) < this->y.HALF.HI) { - this->spriteSettings.draw = 0; + if (gRoomControls.origin_y > super->y.HALF.HI || + (gRoomControls.origin_y + gRoomControls.height + 0x20) < super->y.HALF.HI) { + super->spriteSettings.draw = 0; } else { - this->spriteSettings.draw = 1; + super->spriteSettings.draw = 1; } } - if (this->field_0x80.HALF.HI) { - if (this->child == NULL || this->child->next == NULL) { - this->action = 4; - this->timer = 192; - this->subtimer = 4; - this->field_0x80.HALF.LO ^= 1; + if (this->unk_81) { + if (super->child == NULL || super->child->next == NULL) { + super->action = 4; + super->timer = 192; + super->subtimer = 4; + this->unk_80 ^= 1; } } } -void sub_0802ADDC(Entity* this) { - Entity* ent = CreateEnemy(BOMB_PEAHAT, this->type + 2); - if (ent != NULL) { - ent->type2 = !!sub_0802B234(this); - ent->parent = this; - this->child = ent; - CopyPosition(this, ent); +void sub_0802ADDC(BombPeahatEntity* this) { + Entity* entity = CreateEnemy(BOMB_PEAHAT, super->type + 2); + if (entity != NULL) { + entity->type2 = !!sub_0802B234(this); + entity->parent = super; + super->child = entity; + CopyPosition(super, entity); #ifdef EU - ent->z.HALF.HI += 8; + entity->z.HALF.HI += 8; #endif - this->field_0x80.HALF.HI = 1; - if (this->type == 0) { - this->field_0x7a.HALF.LO++; + this->unk_81 = 1; + if (super->type == 0) { + this->unk_7a++; } } } -void sub_0802AE24(Entity* this) { - this->action = 1; - this->timer = 240; - this->zVelocity = Q_16_16(0.5); - this->hitbox = (Hitbox*)&gUnk_080CD174; - this->collisionFlags = 3; - this->carryFlags = 0; - this->gustJarFlags = 2; - this->field_0x80.HALF.HI = 0; - this->field_0x7a.HALF.HI = 1; - InitializeAnimation(this, 3); +void sub_0802AE24(BombPeahatEntity* this) { + super->action = 1; + super->timer = 240; + super->zVelocity = Q_16_16(0.5); + super->hitbox = (Hitbox*)&gUnk_080CD174; + super->collisionFlags = 3; + super->carryFlags = 0; + super->gustJarFlags = 2; + this->unk_81 = 0; + this->unk_7b = 1; + InitializeAnimation(super, 3); } #ifdef EU -void sub_0802AE68(Entity* this) { - Entity* ent = this->parent; - if (ent == NULL) { - this->action = 3; - this->spriteSettings.draw = 1; - this->field_0x80.HALF.LO = 1; +void sub_0802AE68(BombPeahatEntity* this) { + Entity* entity = super->parent; + if (entity == NULL) { + super->action = 3; + super->spriteSettings.draw = 1; + this->unk_80 = 1; } - if (ent->field_0x80.HALF.HI) { - CopyPosition(ent, this); - this->z.HALF.HI += 8; - this->spriteSettings.draw = 0; + if (entity->field_0x80.HALF.HI) { + CopyPosition(entity, super); + super->z.HALF.HI += 8; + super->spriteSettings.draw = 0; } else { - this->action = 3; - this->field_0x80.HALF.LO = 1; - this->spriteSettings.draw = 1; - if (sub_0802B234(this)) { - this->spritePriority.b1 = 3; + super->action = 3; + this->unk_80 = 1; + super->spriteSettings.draw = 1; + if (sub_0802B234(super)) { + super->spritePriority.b1 = 3; } else { - this->spritePriority.b1 = 0; + super->spritePriority.b1 = 0; } - GetNextFrame(this); + GetNextFrame(super); } } #else -void sub_0802AE68(Entity* this) { - Entity* ent = sub_0802B250(this); - if (ent == NULL) { - this->action = 3; - this->field_0x80.HALF.LO = 1; +void sub_0802AE68(BombPeahatEntity* this) { + BombPeahatEntity* entity = sub_0802B250(this); + if (entity == NULL) { + super->action = 3; + this->unk_80 = 1; sub_0802B264(this); } else { - if (ent->field_0x80.HALF.HI) { - CopyPosition(ent, this); - this->spriteSettings.draw = 0; + if (entity->unk_81) { + CopyPosition(&entity->base, super); + super->spriteSettings.draw = 0; } else { - this->action = 3; - this->field_0x80.HALF.LO = 1; + super->action = 3; + this->unk_80 = 1; sub_0802B264(this); } } } #endif -void sub_0802AEBC(Entity* this) { - gUnk_080CD158[this->subAction](this); +void sub_0802AEBC(BombPeahatEntity* this) { + gUnk_080CD158[super->subAction](this); } -void sub_0802AED4(Entity* this) { - GetNextFrame(this); - if (this->field_0x80.HALF.HI < 2) { - if (sub_080044EC(this, 0x2800) == 1) { - this->field_0x80.HALF.HI++; +void sub_0802AED4(BombPeahatEntity* this) { + GetNextFrame(super); + if (this->unk_81 < 2) { + if (sub_080044EC(super, 0x2800) == 1) { + this->unk_81++; } } else { - if (!sub_0800442E(this)) { - RegisterCarryEntity(this); + if (!sub_0800442E(super)) { + RegisterCarryEntity(super); } } - if (this->type2 != 0 && this->field_0x80.HALF.HI) { - this->timer = 0; - this->subtimer = 1; + if (super->type2 != 0 && this->unk_81) { + super->timer = 0; + super->subtimer = 1; } } -void sub_0802AF28(Entity* this) { - this->subAction = 1; - sub_08079BD8(this); - this->spritePriority.b1 = 2; - GetNextFrame(this); +void sub_0802AF28(BombPeahatEntity* this) { + super->subAction = 1; + sub_08079BD8(super); + super->spritePriority.b1 = 2; + GetNextFrame(super); } -void sub_0802AF50(Entity* this) { - GetNextFrame(this); +void sub_0802AF50(BombPeahatEntity* this) { + GetNextFrame(super); } -void sub_0802AF58(Entity* this) { - GetNextFrame(this); - this->spritePriority.b1 = 3; +void sub_0802AF58(BombPeahatEntity* this) { + GetNextFrame(super); + super->spritePriority.b1 = 3; } -void sub_0802AF74(Entity* this) { - this->action = 3; - this->subAction = 0; - if (this->timer > 60) { - this->timer = 60; +void sub_0802AF74(BombPeahatEntity* this) { + super->action = 3; + super->subAction = 0; + if (super->timer > 60) { + super->timer = 60; } - GetNextFrame(this); + GetNextFrame(super); } -void sub_0802AF94(Entity* this) { - DeleteEntity(this); +void sub_0802AF94(BombPeahatEntity* this) { + DeleteEntity(super); } -void sub_0802AF9C(Entity* this) { - GetNextFrame(this); - if (--this->timer == 0) { - if (this->parent->field_0x7a.HALF.LO) { - this->parent->field_0x7a.HALF.LO--; +void sub_0802AF9C(BombPeahatEntity* this) { + GetNextFrame(super); + if (--super->timer == 0) { + if (((BombPeahatEntity*)super->parent)->unk_7a) { + ((BombPeahatEntity*)super->parent)->unk_7a--; } - DeleteEntity(this); + DeleteEntity(super); } } -void sub_0802AFC8(Entity* this) { - u32 subtimer = this->subtimer; +void sub_0802AFC8(BombPeahatEntity* this) { + u32 subtimer = super->subtimer; u32 flag = 8; if (subtimer < 0x29) { u32 tmp, tmp2; flag = 4; - if (this->field_0x82.HWORD & 0x8000) { - this->field_0x82.HWORD -= 0x10; + if (this->unk_82 & 0x8000) { + this->unk_82 -= 0x10; } else { - this->field_0x82.HWORD += 0x10; + this->unk_82 += 0x10; } - tmp = this->field_0x82.HWORD & 0xf0; + tmp = this->unk_82 & 0xf0; if (tmp == 0 || tmp > 0x80) { - this->field_0x82.HWORD ^= 0x8000; + this->unk_82 ^= 0x8000; } - tmp = this->field_0x82.HWORD & 0xf0; - SetAffineInfo(this, 0x130 - tmp, 0x130 - tmp, 0); + tmp = this->unk_82 & 0xf0; + SetAffineInfo(super, 0x130 - tmp, 0x130 - tmp, 0); } - if (this->subtimer & flag) { - this->palette.b.b0 = this->palette.b.b4; + if (super->subtimer & flag) { + super->palette.b.b0 = super->palette.b.b4; } else { - this->palette.b.b0 = 0; + super->palette.b.b0 = 0; } } -void sub_0802B048(Entity* this) { - Entity* ent; +void sub_0802B048(BombPeahatEntity* this) { + Entity* entity; u32 action; - if (this->field_0x7a.HALF.HI) { - if (gRoomControls.origin_y > this->y.HALF.HI || - (gRoomControls.origin_y + gRoomControls.height + 0x20) < this->y.HALF.HI) { - COLLISION_OFF(this); + if (this->unk_7b) { + if (gRoomControls.origin_y > super->y.HALF.HI || + (gRoomControls.origin_y + gRoomControls.height + 0x20) < super->y.HALF.HI) { + COLLISION_OFF(super); } else { - COLLISION_ON(this); + COLLISION_ON(super); } } - ent = this->parent; - if ((ent != NULL) && this->action == 1) { - this->spriteRendering.b3 = ent->spriteRendering.b3; - this->spritePriority.b0 = ent->spritePriority.b0; - this->spriteOrientation.flipY = ent->spriteOrientation.flipY; + entity = super->parent; + if ((entity != NULL) && super->action == 1) { + super->spriteRendering.b3 = entity->spriteRendering.b3; + super->spritePriority.b0 = entity->spritePriority.b0; + super->spriteOrientation.flipY = entity->spriteOrientation.flipY; } - action = this->action; - if (action != 4 && this->field_0x80.HALF.LO) { - if (this->timer != 0) { - if (--this->timer == 0) { - this->subtimer = 80; - this->field_0x82.HWORD = 0; - this->spriteRendering.b0 = 3; - SetAffineInfo(this, 0x100, 0x100, 0); + action = super->action; + if (action != 4 && this->unk_80) { + if (super->timer != 0) { + if (--super->timer == 0) { + super->subtimer = 80; + this->unk_82 = 0; + super->spriteRendering.b0 = 3; + SetAffineInfo(super, 0x100, 0x100, 0); } } else { - if (this->subtimer) { - if (--this->subtimer == 0) { - if (action == 2 && this->subAction == 1) { + if (super->subtimer) { + if (--super->subtimer == 0) { + if (action == 2 && super->subAction == 1) { gPlayerState.heldObject = 0; } - sub_0805EC60(this); - this->action = 4; - this->hitbox = (Hitbox*)&gUnk_080CD17C; - this->timer = 15; - this->spriteSettings.draw = 0; - COLLISION_ON(this); - this->field_0x7a.HALF.HI = 0; - FreeCarryEntity(this); - if (this->parent->next != NULL) { - this->parent->field_0x80.HALF.HI = 0; + sub_0805EC60(super); + super->action = 4; + super->hitbox = (Hitbox*)&gUnk_080CD17C; + super->timer = 15; + super->spriteSettings.draw = 0; + COLLISION_ON(super); + this->unk_7b = 0; + FreeCarryEntity(super); + if (super->parent->next != NULL) { + ((BombPeahatEntity*)super->parent)->unk_81 = 0; } - ent = CreateObjectWithParent(this, SMOKE_PARTICLE, 0, 0); - if (ent != NULL) { - this->collisionLayer = 1; + entity = CreateObjectWithParent(super, SMOKE_PARTICLE, 0, 0); + if (entity != NULL) { + super->collisionLayer = 1; } else { - DeleteEntity(this); + DeleteEntity(super); } } else { sub_0802AFC8(this); @@ -600,116 +613,116 @@ void sub_0802B048(Entity* this) { } } -void sub_0802B1A0(Entity* this) { - this->action = 1; - this->timer = 0; - this->subtimer = 79; - this->field_0x80.HALF.HI = 1; - InitializeAnimation(this, 0); +void sub_0802B1A0(BombPeahatEntity* this) { + super->action = 1; + super->timer = 0; + super->subtimer = 79; + this->unk_81 = 1; + InitializeAnimation(super, 0); } #ifdef EU -void sub_0802B1BC(Entity* this) { - Entity* ent; +void sub_0802B1BC(BombPeahatEntity* this) { + Entity* entity; - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } - ent = this->parent; - if (ent == NULL) { - this->action = 2; - this->spriteSettings.draw = 1; + entity = super->parent; + if (entity == NULL) { + super->action = 2; + super->spriteSettings.draw = 1; } - if (ent->field_0x80.HALF.HI) { - CopyPosition(ent, this); - this->z.HALF.HI += 8; + if (entity->field_0x80.HALF.HI) { + CopyPosition(entity, super); + super->z.HALF.HI += 8; } else { - this->action = 2; - this->spriteSettings.draw = 1; - if (sub_0802B234(this)) { - this->spritePriority.b1 = 3; + super->action = 2; + super->spriteSettings.draw = 1; + if (sub_0802B234(super)) { + super->spritePriority.b1 = 3; } else { - this->spritePriority.b1 = 0; + super->spritePriority.b1 = 0; } - GetNextFrame(this); + GetNextFrame(super); } } #else -void sub_0802B1BC(Entity* this) { - Entity* ent; +void sub_0802B1BC(BombPeahatEntity* this) { + BombPeahatEntity* entity; - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } - ent = sub_0802B250(this); - if (ent == NULL) { - this->action = 2; + entity = sub_0802B250(this); + if (entity == NULL) { + super->action = 2; sub_0802B264(this); } else { - if (ent->field_0x80.HALF.HI) { - CopyPosition(ent, this); + if (entity->unk_81) { + CopyPosition(&entity->base, super); } else { - this->action = 2; + super->action = 2; sub_0802B264(this); } } } #endif -void sub_0802B204(Entity* this) { - if (sub_080044EC(this, 0x2800) == 1) { - Entity* ent = CreateEnemy(BOBOMB, 1); - if (ent != NULL) { - CopyPosition(this, ent); - ent->parent = this->parent; +void sub_0802B204(BombPeahatEntity* this) { + if (sub_080044EC(super, 0x2800) == 1) { + Entity* entity = CreateEnemy(BOBOMB, 1); + if (entity != NULL) { + CopyPosition(super, entity); + entity->parent = super->parent; } DeleteThisEntity(); } } -bool32 sub_0802B234(Entity* this) { +bool32 sub_0802B234(BombPeahatEntity* this) { bool32 ret = FALSE; - if (GetTileTypeByEntity(this) - 0x1c4 > 1) + if (GetTileTypeByEntity(super) - 0x1c4 > 1) ret = TRUE; return ret; } #ifndef EU -Entity* sub_0802B250(Entity* this) { - Entity* parent = this->parent; - if ((parent != NULL) && (parent->next == NULL)) { +BombPeahatEntity* sub_0802B250(BombPeahatEntity* this) { + BombPeahatEntity* parent = (BombPeahatEntity*)super->parent; + if ((parent != NULL) && (parent->base.next == NULL)) { parent = NULL; } return parent; } -void sub_0802B264(Entity* this) { - this->spriteSettings.draw = 1; +void sub_0802B264(BombPeahatEntity* this) { + super->spriteSettings.draw = 1; if (sub_0802B234(this)) { - this->spritePriority.b1 = 3; + super->spritePriority.b1 = 3; } else { - this->spritePriority.b1 = 0; + super->spritePriority.b1 = 0; } - GetNextFrame(this); + GetNextFrame(super); } #endif // clang-format off -void (*const BombPeahat_Functions[])(Entity*) = { +void (*const BombPeahat_Functions[])(BombPeahatEntity*) = { BombPeahat_OnTick, BombPeahat_OnCollision, - GenericKnockback, - GenericDeath, - GenericConfused, + (void (*)(BombPeahatEntity*))GenericKnockback, + (void (*)(BombPeahatEntity*))GenericDeath, + (void (*)(BombPeahatEntity*))GenericConfused, BombPeahat_OnGrabbed, }; -void (*const gUnk_080CD108[])(Entity*) = { +void (*const gUnk_080CD108[])(BombPeahatEntity*) = { sub_0802A924, sub_0802A9A8, sub_0802AA40, @@ -718,7 +731,7 @@ void (*const gUnk_080CD108[])(Entity*) = { sub_0802AC08, }; -void (*const gUnk_080CD120[])(Entity*) = { +void (*const gUnk_080CD120[])(BombPeahatEntity*) = { sub_0802AE24, sub_0802AE68, sub_0802AEBC, @@ -726,13 +739,13 @@ void (*const gUnk_080CD120[])(Entity*) = { sub_0802AF9C, }; -void (*const gUnk_080CD134[])(Entity*) = { +void (*const gUnk_080CD134[])(BombPeahatEntity*) = { sub_0802B1A0, sub_0802B1BC, sub_0802B204, }; -void (*const gUnk_080CD140[])(Entity*) = { +void (*const gUnk_080CD140[])(BombPeahatEntity*) = { sub_0802A8E0, sub_0802A8EC, sub_0802A8F4, @@ -741,7 +754,7 @@ void (*const gUnk_080CD140[])(Entity*) = { sub_0802A91C, }; -void (*const gUnk_080CD158[])(Entity*) = { +void (*const gUnk_080CD158[])(BombPeahatEntity*) = { sub_0802AF28, sub_0802AF50, sub_0802AF58, diff --git a/src/enemy/bombarossa.c b/src/enemy/bombarossa.c index 8ef13341..1f9120fe 100644 --- a/src/enemy/bombarossa.c +++ b/src/enemy/bombarossa.c @@ -1,8 +1,14 @@ +/** + * @file bombarossa.c + * @ingroup Enemies + * + * @brief Bombarossa enemy + */ #define NENT_DEPRECATED -#include "entity.h" #include "enemy.h" -#include "room.h" +#include "entity.h" #include "object.h" +#include "room.h" typedef struct { Entity base; @@ -39,12 +45,12 @@ void Bombarossa_OnTick(BombarossaEntity* this) { } void Bombarossa_OnCollision(BombarossaEntity* this) { - Entity* ent; + Entity* entity; switch (super->contactFlags & 0x7f) { default: - ent = CreateObject(SMOKE_PARTICLE, 0, 0); - if (ent != NULL) { - CopyPosition(super, ent); + entity = CreateObject(SMOKE_PARTICLE, 0, 0); + if (entity != NULL) { + CopyPosition(super, entity); } DeleteThisEntity(); case 1: diff --git a/src/enemy/bowMoblin.c b/src/enemy/bowMoblin.c index fd7e73bd..1f6bdbb5 100644 --- a/src/enemy/bowMoblin.c +++ b/src/enemy/bowMoblin.c @@ -4,11 +4,9 @@ * * @brief Bow Moblin enemy */ - #define NENT_DEPRECATED -#include "global.h" -#include "entity.h" #include "enemy.h" +#include "entity.h" #include "functions.h" typedef struct { @@ -270,16 +268,16 @@ void sub_0803C4B0(BowMoblinEntity* this) { bool32 sub_0803C568(BowMoblinEntity* this) { if (this->unk_0x81 == 0) { - Entity* ent = sub_08049DF4(1); - if (ent != NULL) { + Entity* entity = sub_08049DF4(1); + if (entity != NULL) { if (this->unk_0x82 == 2) { - if (sub_0806FC80(super, ent, 0x30)) { + if (sub_0806FC80(super, entity, 0x30)) { return TRUE; } } - if (sub_0806FC80(super, ent, 0x40)) { - u32 direction = (GetFacingDirection(super, ent) + 4) & 0x18; + if (sub_0806FC80(super, entity, 0x40)) { + u32 direction = (GetFacingDirection(super, entity) + 4) & 0x18; direction = direction >> 2; if (direction == super->animationState) { return TRUE; diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index 823a8740..d1dbd054 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -4,35 +4,16 @@ * * @brief Business Scrub enemy */ - +#define NENT_DEPRECATED #include "asm.h" #include "enemy.h" -#include "message.h" -#include "save.h" -#include "npc.h" #include "functions.h" #include "game.h" #include "item.h" #include "kinstone.h" - -void sub_08028E9C(Entity*); -void sub_08028EDC(Entity*); -bool32 sub_08028F98(Entity*, u32); -bool32 sub_08028FDC(Entity*); -void sub_08028FFC(Entity*); -void sub_08029078(Entity*); -void sub_080290E0(Entity*, u32); -void sub_080290FC(Entity*); -bool32 sub_0802915C(Entity*); -bool32 BusinessScrub_CheckRefillFitsBag(Entity*); -void sub_0802922C(Entity*); -void sub_0802925C(Entity*); - -extern const struct SalesOffering gUnk_080CC954[]; -extern const u8 kinstoneTypes[]; -extern void (*const BusinessScrub_Functions[])(Entity*); -extern void (*const BusinessScrub_Actions[])(Entity*); -extern const u8 gUnk_080CCA04[]; +#include "message.h" +#include "npc.h" +#include "save.h" struct SalesOffering { u8 field_0x0; @@ -45,131 +26,165 @@ struct SalesOffering { u16 local_flag; }; -void BusinessScrub(Entity* this) { - EnemyFunctionHandler(this, BusinessScrub_Functions); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u16 unk_74; + /*0x76*/ u16 unk_76; + /*0x78*/ u16 unk_78; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ const struct SalesOffering* unk_7c; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unused2[4]; + /*0x86*/ u16 unk_86; +} BusinessScrubEntity; + +void sub_08028E9C(BusinessScrubEntity*); +void sub_08028EDC(BusinessScrubEntity*); +bool32 sub_08028F98(BusinessScrubEntity*, u32); +bool32 sub_08028FDC(BusinessScrubEntity*); +void sub_08028FFC(BusinessScrubEntity*); +void sub_08029078(BusinessScrubEntity*); +void sub_080290E0(BusinessScrubEntity*, u32); +void sub_080290FC(BusinessScrubEntity*); +bool32 sub_0802915C(BusinessScrubEntity*); +bool32 BusinessScrub_CheckRefillFitsBag(BusinessScrubEntity*); +void sub_0802922C(BusinessScrubEntity*); +void sub_0802925C(BusinessScrubEntity*); + +extern const struct SalesOffering gUnk_080CC954[]; +extern const u8 kinstoneTypes[]; +extern void (*const BusinessScrub_Functions[])(BusinessScrubEntity*); +extern void (*const BusinessScrub_Actions[])(BusinessScrubEntity*); +extern const u8 gUnk_080CCA04[]; + + +void BusinessScrub(BusinessScrubEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)BusinessScrub_Functions); } -void BusinessScrub_OnTick(Entity* this) { - BusinessScrub_Actions[this->action](this); +void BusinessScrub_OnTick(BusinessScrubEntity* this) { + BusinessScrub_Actions[super->action](this); } -void BusinessScrub_OnCollision(Entity* this) { - Entity* pEVar1; +void BusinessScrub_OnCollision(BusinessScrubEntity* this) { + Entity* fx; - if (this->hitType == 1 && (this->contactFlags & 0x7f) == 0x42) { - this->action = 3; - this->subAction = 0; - this->timer = 40; - COLLISION_OFF(this); + if (super->hitType == 1 && (super->contactFlags & 0x7f) == 0x42) { + super->action = 3; + super->subAction = 0; + super->timer = 40; + COLLISION_OFF(super); sub_080290E0(this, 4); - pEVar1 = CreateFx(this, FX_BUSH, 0); - if (pEVar1 != NULL) { - pEVar1->z.HALF.HI -= 8; + fx = CreateFx(super, FX_BUSH, 0); + if (fx != NULL) { + fx->z.HALF.HI -= 8; } EnqueueSFX(SFX_EM_DEKUSCRUB_HIT); } } -void BusinessScrub_OnGrabbed(Entity* this) { +void BusinessScrub_OnGrabbed(BusinessScrubEntity* this) { /* ... */ } -void BusinessScrub_Action0(Entity* this) { - this->subtimer = 0; - this->field_0x78.HWORD = this->x.HALF.HI; - this->field_0x7a.HWORD = this->y.HALF.HI; - this->animationState = 0; - this->direction = 0x10; +void BusinessScrub_Action0(BusinessScrubEntity* this) { + super->subtimer = 0; + this->unk_78 = super->x.HALF.HI; + this->unk_7a = super->y.HALF.HI; + super->animationState = 0; + super->direction = 0x10; sub_08028E9C(this); - if ((*(u8*)this->field_0x7c.WORD & 1) || CheckFlags(this->field_0x86.HWORD)) { - this->action = 4; - this->timer = 120; - this->spritePriority.b1 = 1; + if ((*(u8*)this->unk_7c & 1) || CheckFlags(this->unk_86)) { + super->action = 4; + super->timer = 120; + super->spritePriority.b1 = 1; sub_0802925C(this); sub_080290E0(this, 0); } else { - this->timer = 0; - this->field_0x76.HWORD = COORD_TO_TILE(this); - this->field_0x74.HWORD = GetTileIndex(this->field_0x76.HWORD, this->collisionLayer); - this->hurtType = 0x41; + super->timer = 0; + this->unk_76 = COORD_TO_TILE(super); + this->unk_74 = GetTileIndex(this->unk_76, super->collisionLayer); + super->hurtType = 0x41; sub_08028FFC(this); } } -void BusinessScrub_Action1(Entity* this) { - if (this->timer != 0) { - this->timer--; +void BusinessScrub_Action1(BusinessScrubEntity* this) { + if (super->timer != 0) { + super->timer--; } else if (sub_08028F98(this, 0)) { sub_08029078(this); - this->subAction = 0; - this->subtimer = 1; + super->subAction = 0; + super->subtimer = 1; } } -void BusinessScrub_Action2(Entity* this) { +void BusinessScrub_Action2(BusinessScrubEntity* this) { u32 unk; - GetNextFrame(this); - switch (this->subAction) { + GetNextFrame(super); + switch (super->subAction) { case 0: unk = 1; - if (this->frame & ANIM_DONE) { - this->subAction = 1; - this->timer = 60; - this->subtimer = 16; + if (super->frame & ANIM_DONE) { + super->subAction = 1; + super->timer = 60; + super->subtimer = 16; sub_08028FDC(this); sub_080290E0(this, 1); } break; case 1: unk = 1; - if (--this->timer == 0) { - this->subAction = 2; - this->timer = 32; - this->subtimer = 0; + if (--super->timer == 0) { + super->subAction = 2; + super->timer = 32; + super->subtimer = 0; sub_08028FDC(this); sub_080290E0(this, 2); - } else if (--this->subtimer == 0) { + } else if (--super->subtimer == 0) { if (sub_08028FDC(this)) { sub_080290E0(this, 1); } - this->subtimer = 16; + super->subtimer = 16; } break; case 2: unk = 1; sub_080290FC(this); - if (this->frame & 1) { - Entity* ent = CreateProjectileWithParent(this, DEKU_SEED_PROJECTILE, 0); - if (ent != NULL) { - ent->parent = this; - ent->direction = this->direction; - this->frame &= ~1; - this->subAction = 3; + if (super->frame & 1) { + Entity* entity = CreateProjectileWithParent(super, DEKU_SEED_PROJECTILE, 0); + if (entity != NULL) { + entity->parent = super; + entity->direction = super->direction; + super->frame &= ~1; + super->subAction = 3; } } break; case 3: unk = 2; - if (this->frame & ANIM_DONE) { - this->subAction = 4; - this->timer = 80; + if (super->frame & ANIM_DONE) { + super->subAction = 4; + super->timer = 80; sub_080290E0(this, 1); } break; case 4: unk = 2; - if (--this->timer == 0) { + if (--super->timer == 0) { if (sub_08028F98(this, 0)) { - this->subAction = 1; - this->timer = 60; - this->subtimer = 16; + super->subAction = 1; + super->timer = 60; + super->subtimer = 16; sub_08028FDC(this); } else { sub_08028FFC(this); - this->subAction = 0; - this->timer = 80; - this->subtimer = 0; + super->subAction = 0; + super->timer = 80; + super->subtimer = 0; } return; } @@ -178,73 +193,73 @@ void BusinessScrub_Action2(Entity* this) { if (!sub_08028F98(this, unk)) { sub_08028FFC(this); - this->subAction = 0; - this->timer = 80; - this->subtimer = 0; + super->subAction = 0; + super->timer = 80; + super->subtimer = 0; } } -void BusinessScrub_Action3(Entity* this) { +void BusinessScrub_Action3(BusinessScrubEntity* this) { Entity* iVar1; - switch (this->subAction) { + switch (super->subAction) { case 0: - if (this->timer == 0) { - if (this->frame & ANIM_DONE) { - this->subAction = 1; + if (super->timer == 0) { + if (super->frame & ANIM_DONE) { + super->subAction = 1; sub_08028FDC(this); sub_080290E0(this, 5); - this->spritePriority.b1 = 1; + super->spritePriority.b1 = 1; } } else { - this->timer--; + super->timer--; } break; case 1: - if (this->frame & ANIM_DONE) { - this->action = 4; - this->subAction = 0; - this->timer = 30; - this->subtimer = 5; + if (super->frame & ANIM_DONE) { + super->action = 4; + super->subAction = 0; + super->timer = 30; + super->subtimer = 5; sub_080290E0(this, 0); - iVar1 = Create0x68FX(this, FX_STARS); + iVar1 = Create0x68FX(super, FX_STARS); if (iVar1 != NULL) { iVar1->spritePriority.b0 = 3; iVar1->z.HALF.HI -= 12; SetDefaultPriority(iVar1, PRIO_MESSAGE); } - SetFlag(this->field_0x86.HWORD); + SetFlag(this->unk_86); sub_0802925C(this); } break; } - GetNextFrame(this); - sub_0800445C(this); + GetNextFrame(super); + sub_0800445C(super); } extern void sub_0804AA1C(Entity*); -void sub_08028F0C(Entity*); +void sub_08028F0C(BusinessScrubEntity*); -void BusinessScrub_Action4(Entity* this) { - if (--this->timer == 0) { - this->timer = 48; - if (this->subtimer) { - if (--this->subtimer == 0) { - sub_0804AA1C(this); +void BusinessScrub_Action4(BusinessScrubEntity* this) { + if (--super->timer == 0) { + super->timer = 48; + if (super->subtimer) { + if (--super->subtimer == 0) { + sub_0804AA1C(super); } - } else if (sub_08028FDC(this) || this->field_0x80.HALF.LO) { - this->field_0x80.HALF.LO = 0; + } else if (sub_08028FDC(this) || this->unk_80) { + this->unk_80 = 0; sub_080290E0(this, 0); } } - GetNextFrame(this); - sub_0800445C(this); + GetNextFrame(super); + sub_0800445C(super); sub_08028F0C(this); } -void BusinessScrub_Action5(Entity* this) { - struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; +void BusinessScrub_Action5(BusinessScrubEntity* this) { + struct SalesOffering* offer = (struct SalesOffering*)this->unk_7c; u32 subtype; if ((gMessage.doTextBox & 0x7f) == 0 && sub_0802915C(this) && !sub_08056338()) { @@ -264,9 +279,9 @@ void BusinessScrub_Action5(Entity* this) { CreateItemEntity(offer->offeredItem, subtype, 0); - this->action = 6; - this->timer = 4; - this->field_0x80.HALF.HI = 0; + super->action = 6; + super->timer = 4; + this->unk_81 = 0; sub_080290E0(this, 3); #if defined(USA) || defined(DEMO_USA) SetLocalFlag(KS_B06); @@ -274,12 +289,12 @@ void BusinessScrub_Action5(Entity* this) { return; case 1: // refill, bottle, specific kinstone CreateItemEntity(offer->offeredItem, offer->item_subtype, 0); - this->timer = 4; + super->timer = 4; sub_0802922C(this); return; case 2: // grip ring CreateItemEntity(offer->offeredItem, offer->item_subtype, 0); - this->timer = 8; + super->timer = 8; sub_0802922C(this); return; } @@ -291,95 +306,95 @@ void BusinessScrub_Action5(Entity* this) { } } - sub_0800445C(this); - this->action = 4; - this->timer = 48; + sub_0800445C(super); + super->action = 4; + super->timer = 48; sub_080290E0(this, 0); } -void BusinessScrub_Action6(Entity* this) { +void BusinessScrub_Action6(BusinessScrubEntity* this) { if (gPlayerEntity.action == PLAYER_ITEMGET) { - if (this->field_0x80.HALF.HI == 0) { + if (this->unk_81 == 0) { SetPlayerControl(1); - this->field_0x80.HALF.HI = 1; + this->unk_81 = 1; } } else { MessageFromTarget(TEXT_INDEX(TEXT_BUSINESS_SCRUB, 0x02)); - this->action = 4; - this->field_0x80.HALF.HI = 0; - this->timer = 1; + super->action = 4; + this->unk_81 = 0; + super->timer = 1; sub_08028EDC(this); SetPlayerControl(0); - sub_0800445C(this); - GetNextFrame(this); + sub_0800445C(super); + GetNextFrame(super); } } -void BusinessScrub_Action7(Entity* this) { +void BusinessScrub_Action7(BusinessScrubEntity* this) { if ((gMessage.doTextBox & 0x7f) == 0) { - struct SalesOffering* offer = (struct SalesOffering*)this->field_0x7c.WORD; + struct SalesOffering* offer = (struct SalesOffering*)this->unk_7c; - this->action = 4; - this->subAction = gMessage.doTextBox & 0x7f; - this->timer = 1; + super->action = 4; + super->subAction = gMessage.doTextBox & 0x7f; + super->timer = 1; if (!CheckLocalFlag(offer->local_flag)) { SetLocalFlag(offer->local_flag); } SetPlayerControl(0); } - sub_0800445C(this); - GetNextFrame(this); + sub_0800445C(super); + GetNextFrame(super); } -void BusinessScrub_Action8(Entity* this) { - if (UpdateFuseInteraction(this)) { - this->action = 4; - this->timer = 1; +void BusinessScrub_Action8(BusinessScrubEntity* this) { + if (UpdateFuseInteraction(super)) { + super->action = 4; + super->timer = 1; } } bool32 sub_08029198(const struct SalesOffering*); -void sub_08028E9C(Entity* this) { - const struct SalesOffering* offer = &gUnk_080CC954[this->type]; +void sub_08028E9C(BusinessScrubEntity* this) { + const struct SalesOffering* offer = &gUnk_080CC954[super->type]; if (sub_08029198(offer) && (offer->field_0x0 & 2)) { offer = &gUnk_080CC954[offer->local_flag]; } - this->field_0x7c.WORD = (u32)offer; - this->field_0x80.HALF.LO = 0; + this->unk_7c = offer; + this->unk_80 = 0; } -void sub_08028EDC(Entity* this) { - const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD; +void sub_08028EDC(BusinessScrubEntity* this) { + const struct SalesOffering* offer = this->unk_7c; if (sub_08029198(offer) && (offer->field_0x0 & 2)) { offer = &gUnk_080CC954[offer->local_flag]; - this->field_0x7c.WORD = (u32)offer; + this->unk_7c = offer; } } -void sub_08028F0C(Entity* this) { - if (this->interactType == 2) { - this->action = 8; - this->interactType = 0; - sub_0806F118(this); - } else if (this->interactType != 0) { +void sub_08028F0C(BusinessScrubEntity* this) { + if (super->interactType == 2) { + super->action = 8; + super->interactType = 0; + sub_0806F118(super); + } else if (super->interactType != 0) { u16 dialog; - const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD; + const struct SalesOffering* offer = (const struct SalesOffering*)this->unk_7c; - this->interactType = 0; - sub_0804AA1C(this); - this->direction = (GetAnimationState(this) << 3); + super->interactType = 0; + sub_0804AA1C(super); + super->direction = (GetAnimationState(super) << 3); sub_080290E0(this, 3); - this->field_0x80.HALF.LO = 1; - this->timer = 32; - this->subtimer = 0; + this->unk_80 = 1; + super->timer = 32; + super->subtimer = 0; if (sub_08029198(offer)) { dialog = offer->field_0x6; } else { if ((offer->field_0x0 & 0xfc) != 0xc) { - this->action = 5; + super->action = 5; } else { - this->action = 7; + super->action = 7; } dialog = offer->field_0x4; SetPlayerControl(1); @@ -389,16 +404,16 @@ void sub_08028F0C(Entity* this) { } } -bool32 sub_08028F98(Entity* this, u32 param_2) { - Entity* ent = sub_08049DF4(1); - if (ent == NULL || EntityInRectRadius(this, ent, 0x28, 0x28)) { +bool32 sub_08028F98(BusinessScrubEntity* this, u32 param_2) { + Entity* entity = sub_08049DF4(1); + if (entity == NULL || EntityInRectRadius(super, entity, 0x28, 0x28)) { return FALSE; } if (param_2 != 2) { u32 distance = param_2 ? 0x58 : 0x50; - if (!EntityInRectRadius(this, ent, distance, distance)) { + if (!EntityInRectRadius(super, entity, distance, distance)) { return FALSE; } } @@ -406,67 +421,67 @@ bool32 sub_08028F98(Entity* this, u32 param_2) { return TRUE; } -bool32 sub_08028FDC(Entity* this) { - u32 direction = DirectionRoundUp(sub_08049F84(this, 1)); - if (direction == this->direction) { +bool32 sub_08028FDC(BusinessScrubEntity* this) { + u32 direction = DirectionRoundUp(sub_08049F84(super, 1)); + if (direction == super->direction) { return FALSE; } else { - this->direction = direction; + super->direction = direction; return TRUE; } } -void sub_08028FFC(Entity* this) { - this->action = 1; - COLLISION_OFF(this); - this->spritePriority.b1 = 0; - UnloadGFXSlots(this); - UnloadOBJPalette(this); - this->spriteVramOffset = 0xe8; - this->palette.b.b0 = 2; - this->palette.b.b4 = 2; - this->spriteIndex = 0xa7; - this->x.HALF.HI = this->field_0x78.HWORD; - this->y.HALF.HI = this->field_0x7a.HWORD; - InitializeAnimation(this, 0); - SetTile(0x4022, this->field_0x76.HWORD, this->collisionLayer); +void sub_08028FFC(BusinessScrubEntity* this) { + super->action = 1; + COLLISION_OFF(super); + super->spritePriority.b1 = 0; + UnloadGFXSlots(super); + UnloadOBJPalette(super); + super->spriteVramOffset = 0xe8; + super->palette.b.b0 = 2; + super->palette.b.b4 = 2; + super->spriteIndex = 0xa7; + super->x.HALF.HI = this->unk_78; + super->y.HALF.HI = this->unk_7a; + InitializeAnimation(super, 0); + SetTile(0x4022, this->unk_76, super->collisionLayer); } -void sub_08029078(Entity* this) { - this->action = 2; - COLLISION_ON(this); - this->spritePriority.b1 = 1; - if (LoadFixedGFX(this, 0x72) == 0) { - DeleteEntity(this); +void sub_08029078(BusinessScrubEntity* this) { + super->action = 2; + COLLISION_ON(super); + super->spritePriority.b1 = 1; + if (LoadFixedGFX(super, 0x72) == 0) { + DeleteEntity(super); } else { - LoadObjPalette(this, 0x6e); - this->spriteIndex = 0xd0; + LoadObjPalette(super, 0x6e); + super->spriteIndex = 0xd0; sub_08028FDC(this); sub_080290E0(this, 1); - SetTile(this->field_0x74.HWORD, this->field_0x76.HWORD, this->collisionLayer); + SetTile(this->unk_74, this->unk_76, super->collisionLayer); } } -void sub_080290E0(Entity* this, u32 param_2) { - InitializeAnimation(this, this->direction >> 3 | gUnk_080CCA04[param_2]); +void sub_080290E0(BusinessScrubEntity* this, u32 param_2) { + InitializeAnimation(super, super->direction >> 3 | gUnk_080CCA04[param_2]); } -void sub_080290FC(Entity* this) { - if (this->timer != 0) { - this->timer--; - if ((this->timer < 16) && ((this->timer & 1) == 0)) { - s32 sVar3 = ((this->direction & 0x10) != 0) ? -1 : 1; - if ((this->direction & 8) != 0) { - this->x.HALF.HI += ((this->timer & 8) != 0) ? -sVar3 : sVar3; +void sub_080290FC(BusinessScrubEntity* this) { + if (super->timer != 0) { + super->timer--; + if ((super->timer < 16) && ((super->timer & 1) == 0)) { + s32 sVar3 = ((super->direction & 0x10) != 0) ? -1 : 1; + if ((super->direction & 8) != 0) { + super->x.HALF.HI += ((super->timer & 8) != 0) ? -sVar3 : sVar3; } else { - this->y.HALF.HI += ((this->timer & 8) != 0) ? sVar3 : -sVar3; + super->y.HALF.HI += ((super->timer & 8) != 0) ? sVar3 : -sVar3; } } } } -bool32 sub_0802915C(Entity* this) { - const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD; +bool32 sub_0802915C(BusinessScrubEntity* this) { + const struct SalesOffering* offer = (const struct SalesOffering*)this->unk_7c; switch (offer->offeredItem) { case ITEM_GRIP_RING: @@ -511,8 +526,8 @@ bool32 sub_08029198(const struct SalesOffering* offer) { return TRUE; } -bool32 BusinessScrub_CheckRefillFitsBag(Entity* this) { - const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD; +bool32 BusinessScrub_CheckRefillFitsBag(BusinessScrubEntity* this) { + const struct SalesOffering* offer = (const struct SalesOffering*)this->unk_7c; switch (offer->offeredItem) { case ITEM_BOMBS10: @@ -528,11 +543,11 @@ bool32 BusinessScrub_CheckRefillFitsBag(Entity* this) { return FALSE; } -void sub_0802922C(Entity* this) { +void sub_0802922C(BusinessScrubEntity* this) { const struct SalesOffering* offer; - this->action = 6; - this->field_0x80.HALF.HI = 0; - offer = (const struct SalesOffering*)this->field_0x7c.WORD; + super->action = 6; + this->unk_81 = 0; + offer = (const struct SalesOffering*)this->unk_7c; switch (offer->offeredItem) { case ITEM_BOTTLE1: @@ -547,17 +562,17 @@ void sub_0802922C(Entity* this) { } } -void sub_0802925C(Entity* this) { - AddInteractableWhenBigFuser(this, GetFusionToOffer(this)); +void sub_0802925C(BusinessScrubEntity* this) { + AddInteractableWhenBigFuser(super, GetFusionToOffer(super)); } -void sub_08029270(Entity* this) { - if (this->action == 0) { - this->action++; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 0xe); +void sub_08029270(BusinessScrubEntity* this) { + if (super->action == 0) { + super->action++; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 0xe); } else { - GetNextFrame(this); + GetNextFrame(super); } } @@ -580,16 +595,16 @@ const struct SalesOffering gUnk_080CC954[] = { const u8 kinstoneTypes[] = { 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75 }; -void (*const BusinessScrub_Functions[])(Entity*) = { +void (*const BusinessScrub_Functions[])(BusinessScrubEntity*) = { BusinessScrub_OnTick, BusinessScrub_OnCollision, - GenericKnockback, - GenericDeath, - GenericConfused, + (void (*)(BusinessScrubEntity*))GenericKnockback, + (void (*)(BusinessScrubEntity*))GenericDeath, + (void (*)(BusinessScrubEntity*))GenericConfused, BusinessScrub_OnGrabbed, }; -void (*const BusinessScrub_Actions[])(Entity*) = { +void (*const BusinessScrub_Actions[])(BusinessScrubEntity*) = { BusinessScrub_Action0, BusinessScrub_Action1, BusinessScrub_Action2, diff --git a/src/enemy/businessScrubPrologue.c b/src/enemy/businessScrubPrologue.c index ba7349e9..607f38b4 100644 --- a/src/enemy/businessScrubPrologue.c +++ b/src/enemy/businessScrubPrologue.c @@ -1,6 +1,12 @@ +/** + * @file businessScrubPrologue.c + * @ingroup Enemies + * + * @brief Business Scrub Prologue enemy + */ #define NENT_DEPRECATED -#include "entity.h" #include "enemy.h" +#include "entity.h" #include "functions.h" typedef struct { @@ -39,7 +45,7 @@ void BusinessScrubPrologue_OnTick(BusinessScrubPrologueEntity* this) { } void BusinessScrubPrologue_OnCollision(BusinessScrubPrologueEntity* this) { - Entity* ent; + Entity* entity; if (super->hitType == 1) { if ((super->contactFlags & 0x7f) == 0x42) { super->action = 4; @@ -47,9 +53,9 @@ void BusinessScrubPrologue_OnCollision(BusinessScrubPrologueEntity* this) { super->timer = 40; super->flags &= ~ENT_COLLIDE; sub_08046030(this, 4); - ent = CreateFx(super, FX_BUSH, 0); - if (ent != NULL) { - ent->z.HALF.HI -= 8; + entity = CreateFx(super, FX_BUSH, 0); + if (entity != NULL) { + entity->z.HALF.HI -= 8; } gPlayerState.field_0x27[0] = 0xff; @@ -93,7 +99,7 @@ void nullsub_24(BusinessScrubPrologueEntity* this) { } void sub_08045CE0(BusinessScrubPrologueEntity* this) { - Entity* ent; + Entity* entity; u32 r6; GetNextFrame(super); @@ -122,10 +128,10 @@ void sub_08045CE0(BusinessScrubPrologueEntity* this) { r6 = 1; sub_0804604C(this); if (super->frame & 1) { - ent = CreateProjectileWithParent(super, DEKU_SEED_PROJECTILE, 0); - if (ent != NULL) { - ent->parent = super; - ent->direction = super->direction; + entity = CreateProjectileWithParent(super, DEKU_SEED_PROJECTILE, 0); + if (entity != NULL) { + entity->parent = super; + entity->direction = super->direction; super->frame &= 0xfe; super->subAction = 3; } @@ -165,7 +171,7 @@ void sub_08045CE0(BusinessScrubPrologueEntity* this) { } void sub_08045E14(BusinessScrubPrologueEntity* this) { - Entity* ent; + Entity* entity; gPlayerState.field_0x27[0] = 0xff; switch (super->subAction) { case 0: @@ -185,11 +191,11 @@ void sub_08045E14(BusinessScrubPrologueEntity* this) { super->action = 5; super->subAction = 0; sub_08046030(this, 0); - ent = Create0x68FX(super, FX_STARS); - if (ent != NULL) { - ent->spritePriority.b0 = 3; - ent->z.HALF.HI -= 0xc; - SetDefaultPriority(ent, PRIO_MESSAGE); + entity = Create0x68FX(super, FX_STARS); + if (entity != NULL) { + entity->spritePriority.b0 = 3; + entity->z.HALF.HI -= 0xc; + SetDefaultPriority(entity, PRIO_MESSAGE); } } break; @@ -233,12 +239,12 @@ void nullsub_25(BusinessScrubPrologueEntity* this) { } bool32 sub_08045F54(BusinessScrubPrologueEntity* this, u32 arg2) { - Entity* ent = sub_08049DF4(1); + Entity* entity = sub_08049DF4(1); u32 r3; - if (ent == NULL) + if (entity == NULL) return 0; - if (EntityInRectRadius(super, ent, 0x20, 0x20)) + if (EntityInRectRadius(super, entity, 0x20, 0x20)) return 0; if (arg2 == 2) return 1; @@ -247,7 +253,7 @@ bool32 sub_08045F54(BusinessScrubPrologueEntity* this, u32 arg2) { r3 = 0x58; } - if (EntityInRectRadius(super, ent, r3, r3)) + if (EntityInRectRadius(super, entity, r3, r3)) return 1; return 0; } @@ -292,17 +298,17 @@ void sub_0804604C(BusinessScrubPrologueEntity* this) { void sub_08046078(BusinessScrubPrologueEntity* this) { s32 index; - Entity* ent; + Entity* entity; const u16* ptr; gPlayerState.field_0x27[0] = 0; ptr = gUnk_080D1A4E; for (index = 0; index <= 4; index++) { - ent = CreateFx(super, FX_DEATH, 0x40); + entity = CreateFx(super, FX_DEATH, 0x40); - if (ent != NULL) { - ent->x.HALF.HI = gRoomControls.origin_x + *ptr; + if (entity != NULL) { + entity->x.HALF.HI = gRoomControls.origin_x + *ptr; ptr++; - ent->y.HALF.HI = gRoomControls.origin_y + *ptr; + entity->y.HALF.HI = gRoomControls.origin_y + *ptr; ptr++; } } @@ -314,9 +320,9 @@ void sub_08046078(BusinessScrubPrologueEntity* this) { RestorePrevTileEntity(0x7a6, 1); RestorePrevTileEntity(0x7a7, 1); - ent = CreateFx(super, FX_BIG_EXPLOSION2, 0x40); - if (ent != NULL) { - CopyPosition(super, ent); + entity = CreateFx(super, FX_BIG_EXPLOSION2, 0x40); + if (entity != NULL) { + CopyPosition(super, entity); EnqueueSFX(SFX_184); } diff --git a/src/enemy/chaser.c b/src/enemy/chaser.c index 895c13f1..1f22bac4 100644 --- a/src/enemy/chaser.c +++ b/src/enemy/chaser.c @@ -4,7 +4,7 @@ * * @brief Chaser enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c index 82de5555..c5122f8a 100644 --- a/src/enemy/chuchu.c +++ b/src/enemy/chuchu.c @@ -4,201 +4,213 @@ * * @brief Chuchu enemy */ - +#define NENT_DEPRECATED #include "asm.h" #include "enemy.h" #include "functions.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ Entity* unk_68; + /*0x6c*/ u8 unused1[6]; + /*0x72*/ u8 unk_72; + /*0x73*/ u8 unused2[13]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; +} ChuchuEntity; + extern Entity* gUnk_020000B0; -void sub_0801F328(Entity*); -void sub_0801F340(Entity*); -void sub_0801F360(Entity*); -void sub_0801F3AC(Entity*); -void sub_0801F730(Entity*); -void sub_0801F748(Entity*); -void sub_0801F764(Entity*); -void sub_0801FAE0(Entity*); -void sub_0801FAF8(Entity*); -void sub_0801FB14(Entity*); -void sub_0801FB34(Entity*); -void sub_0801FB68(Entity*); -u32 sub_0801FBD0(Entity*); -void Chuchu_JumpAtPlayer(Entity*); +void sub_0801F328(ChuchuEntity* this); +void sub_0801F340(ChuchuEntity* this); +void sub_0801F360(ChuchuEntity* this); +void sub_0801F3AC(ChuchuEntity* this); +void sub_0801F730(ChuchuEntity* this); +void sub_0801F748(ChuchuEntity* this); +void sub_0801F764(ChuchuEntity* this); +void sub_0801FAE0(ChuchuEntity* this); +void sub_0801FAF8(ChuchuEntity* this); +void sub_0801FB14(ChuchuEntity* this); +void sub_0801FB34(ChuchuEntity* this); +void sub_0801FB68(ChuchuEntity* this); +u32 sub_0801FBD0(ChuchuEntity* this); +void Chuchu_JumpAtPlayer(ChuchuEntity* this); -extern void (*const Chuchu_Functions[])(Entity*); -extern void (*const gUnk_080CA234[])(Entity*); -extern void (*const gUnk_080CA25C[])(Entity*); -extern void (*const gUnk_080CA288[])(Entity*); +extern void (*const Chuchu_Functions[])(ChuchuEntity*); +extern void (*const gUnk_080CA234[])(ChuchuEntity*); +extern void (*const gUnk_080CA25C[])(ChuchuEntity*); +extern void (*const gUnk_080CA288[])(ChuchuEntity*); extern const s8 gUnk_080CA2B4[]; -void Chuchu(Entity* this) { - int index; +void Chuchu(ChuchuEntity* this) { + s32 index; - index = sub_080012DC(this); + index = sub_080012DC(super); switch (index) { default: - gUnk_080012C8[index](this); + gUnk_080012C8[index](super); return; case 0: /* ... */ break; case 2: - this->gustJarState &= 0xfe; - if (index != this->field_0x80.HALF.HI) { - switch (this->type) { + super->gustJarState &= 0xfe; + if (index != this->unk_81) { + switch (super->type) { case 0: - if (this->flags & ENT_COLLIDE) { - this->action = 6; - COLLISION_OFF(this); - this->speed = 0x20; - this->hitType = 0x5c; - InitializeAnimation(this, 5); + if (super->flags & ENT_COLLIDE) { + super->action = 6; + COLLISION_OFF(super); + super->speed = 0x20; + super->hitType = 0x5c; + InitializeAnimation(super, 5); } break; case 1: /* ... */ break; case 2: - sub_080043A8(this); + sub_080043A8(super); return; } } break; } - this->field_0x80.HALF.HI = index; - Chuchu_Functions[GetNextFunction(this)](this); - if (*(char*)(*(int*)&this->field_0x68 + 10) == 0x1c) { - SetChildOffset(this, 0, 1, -0x10); - } else if (this->type == 2) { + this->unk_81 = index; + Chuchu_Functions[GetNextFunction(super)](this); + if (this->unk_68->type == 0x1c) { + SetChildOffset(super, 0, 1, -0x10); + } else if (super->type == 2) { sub_0801FB34(this); } } -void Chuchu_OnTick(Entity* this) { - switch (this->type) { +void Chuchu_OnTick(ChuchuEntity* this) { + switch (super->type) { case 0: sub_0801F3AC(this); - gUnk_080CA234[this->action](this); + gUnk_080CA234[super->action](this); break; case 1: sub_0801F764(this); - gUnk_080CA25C[this->action](this); + gUnk_080CA25C[super->action](this); break; case 2: - gUnk_080CA288[this->action](this); + gUnk_080CA288[super->action](this); break; } } -void Chuchu_OnCollision(Entity* this) { +void Chuchu_OnCollision(ChuchuEntity* this) { u8 health; - if (this->type == 2) { - if (this->contactFlags == 0x8e || this->contactFlags == 0x95) { - COLLISION_OFF(this); - this->health = 0; + if (super->type == 2) { + if (super->contactFlags == 0x8e || super->contactFlags == 0x95) { + COLLISION_OFF(super); + super->health = 0; } } - health = this->health; + health = super->health; if (health) { - if (this->contactFlags == 0x94) { + if (super->contactFlags == 0x94) { sub_0801FB68(this); - Create0x68FX(this, FX_STARS); - InitializeAnimation(this, 6); - } else if (this->field_0x80.HALF.LO != health) { + Create0x68FX(super, FX_STARS); + InitializeAnimation(super, 6); + } else if (this->unk_80 != health) { sub_0801FB68(this); - InitializeAnimation(this, 6); + InitializeAnimation(super, 6); } } else { - sub_0804AA1C(this); - this->zVelocity = 0; - InitializeAnimation(this, 9); + sub_0804AA1C(super); + super->zVelocity = 0; + InitializeAnimation(super, 9); } - this->field_0x80.HALF.LO = this->health; - EnemyFunctionHandlerAfterCollision(this, Chuchu_Functions); + this->unk_80 = super->health; + EnemyFunctionHandlerAfterCollision(super, Chuchu_Functions); } -void Chuchu_OnGrabbed(Entity* this) { - if (!sub_0806F520(this) && this->confusedTime) { - Create0x68FX(this, FX_STARS); - InitializeAnimation(this, 6); +void Chuchu_OnGrabbed(ChuchuEntity* this) { + if (!sub_0806F520(super) && super->confusedTime) { + Create0x68FX(super, FX_STARS); + InitializeAnimation(super, 6); } else { - if (this->animIndex != 8) { + if (super->animIndex != 8) { sub_0801FB68(this); - InitializeAnimation(this, 8); + InitializeAnimation(super, 8); } - GravityUpdate(this, Q_8_8(24.0)); - GetNextFrame(this); + GravityUpdate(super, Q_8_8(24.0)); + GetNextFrame(super); } } -void Chuchu_OnKnockback(Entity* this) { - if (this->animIndex == 6) - GetNextFrame(this); - sub_08001318(this); +void Chuchu_OnKnockback(ChuchuEntity* this) { + if (super->animIndex == 6) + GetNextFrame(super); + sub_08001318(super); } -void Chuchu_OnDeath(Entity* this) { - GravityUpdate(this, Q_8_8(24.0)); - GetNextFrame(this); - if (this->type == 0) { - GenericDeath(this); - } else if (this->type == 1) { - CreateDeathFx(this, 0xf2, 0); +void Chuchu_OnDeath(ChuchuEntity* this) { + GravityUpdate(super, Q_8_8(24.0)); + GetNextFrame(super); + if (super->type == 0) { + GenericDeath(super); + } else if (super->type == 1) { + CreateDeathFx(super, 0xf2, 0); } else { - CreateDeathFx(this, 0xf1, 0); + CreateDeathFx(super, 0xf1, 0); } } -void Chuchu_OnConfused(Entity* this) { - if ((this->frame & ANIM_DONE) == 0) - GetNextFrame(this); - GenericConfused(this); +void Chuchu_OnConfused(ChuchuEntity* this) { + if ((super->frame & ANIM_DONE) == 0) + GetNextFrame(super); + GenericConfused(super); } -void sub_0801F0A4(Entity* this) { - sub_0804A720(this); - this->action = 1; - this->field_0x80.HALF.LO = this->health; - this->field_0x82.HALF.LO = 0; +void sub_0801F0A4(ChuchuEntity* this) { + sub_0804A720(super); + super->action = 1; + this->unk_80 = super->health; + this->unk_82 = 0; } -void nullsub_4(Entity* this) { - (void)this; +void nullsub_4(ChuchuEntity* this) { + (void)super; } -void sub_0801F0C8(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 3; - this->timer = (Random() & 3) + 12; - this->subtimer = Random(); - this->direction = sub_08049F84(this, 1); - COLLISION_ON(this); - this->spritePriority.b0 = 4; - this->spritePriority.b1 = 3; - InitializeAnimation(this, 2); +void sub_0801F0C8(ChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 3; + super->timer = (Random() & 3) + 12; + super->subtimer = Random(); + super->direction = sub_08049F84(super, 1); + COLLISION_ON(super); + super->spritePriority.b0 = 4; + super->spritePriority.b1 = 3; + InitializeAnimation(super, 2); } } -void sub_0801F12C(Entity* this) { +void sub_0801F12C(ChuchuEntity* this) { if (sub_0801FBD0(this)) { sub_0801F328(this); } else { - if ((this->subtimer++ & 7) == 0) { - this->direction = sub_08049F84(this, 1); + if ((super->subtimer++ & 7) == 0) { + super->direction = sub_08049F84(super, 1); } - ProcessMovement0(this); - GetNextFrame(this); - if (--this->timer == 0) { - if (PlayerInRange(this, 1, 0x38)) { - this->action = 4; + ProcessMovement0(super); + GetNextFrame(super); + if (--super->timer == 0) { + if (PlayerInRange(super, 1, 0x38)) { + super->action = 4; Chuchu_JumpAtPlayer(this); - } else if (PlayerInRange(this, 1, 0x48)) { - this->timer = (Random() & 3) + 12; + } else if (PlayerInRange(super, 1, 0x48)) { + super->timer = (Random() & 3) + 12; } else { sub_0801F328(this); } @@ -206,21 +218,21 @@ void sub_0801F12C(Entity* this) { } } -void sub_0801F1B0(Entity* this) { - if (this->frame & 0x10) { - if (this->frame & 1) { - this->frame ^= 1; - this->hitType = 90; +void sub_0801F1B0(ChuchuEntity* this) { + if (super->frame & 0x10) { + if (super->frame & 1) { + super->frame ^= 1; + super->hitType = 90; EnqueueSFX(SFX_12B); } - ProcessMovement2(this); - if (GravityUpdate(this, Q_8_8(64.0)) == 0) - GetNextFrame(this); + ProcessMovement2(super); + if (GravityUpdate(super, Q_8_8(64.0)) == 0) + GetNextFrame(super); } else { - GetNextFrame(this); + GetNextFrame(super); } - if (this->frame & ANIM_DONE) { + if (super->frame & ANIM_DONE) { if (sub_0801FBD0(this)) { sub_0801F328(this); } else { @@ -229,497 +241,497 @@ void sub_0801F1B0(Entity* this) { } } -void sub_0801F228(Entity* this) { - if (--this->timer == 0) { - this->action = 3; - this->direction = sub_08049F84(this, 1); +void sub_0801F228(ChuchuEntity* this) { + if (--super->timer == 0) { + super->action = 3; + super->direction = sub_08049F84(super, 1); } - GetNextFrame(this); + GetNextFrame(super); } -void sub_0801F250(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) +void sub_0801F250(ChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) sub_0801F360(this); } -void sub_0801F270(Entity* this) { - if ((this->subtimer++ & 7) == 0) { - this->direction = sub_08049F84(this, 1); +void sub_0801F270(ChuchuEntity* this) { + if ((super->subtimer++ & 7) == 0) { + super->direction = sub_08049F84(super, 1); } - ProcessMovement5(this); - GetNextFrame(this); + ProcessMovement5(super); + GetNextFrame(super); if (sub_0801FBD0(this)) return; - if (--this->timer != 0) + if (--super->timer != 0) return; - if (this->field_0x80.HALF.HI == 0) { - this->action = 2; - InitializeAnimation(this, 4); + if (this->unk_81 == 0) { + super->action = 2; + InitializeAnimation(super, 4); } else { - this->timer = 8; + super->timer = 8; } } -void sub_0801F2CC(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 1; - this->spriteSettings.draw = 0; - InitializeAnimation(this, 4); +void sub_0801F2CC(ChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 1; + super->spriteSettings.draw = 0; + InitializeAnimation(super, 4); } } -void sub_0801F2F8(Entity* this) { - GravityUpdate(this, Q_8_8(24.0)); - GetNextFrame(this); - if (this->frame & ANIM_DONE) { +void sub_0801F2F8(ChuchuEntity* this) { + GravityUpdate(super, Q_8_8(24.0)); + GetNextFrame(super); + if (super->frame & ANIM_DONE) { sub_0801F340(this); - sub_0804AA1C(this); + sub_0804AA1C(super); } } -void sub_0801F328(Entity* this) { - this->action = 6; - COLLISION_OFF(this); - InitializeAnimation(this, 5); +void sub_0801F328(ChuchuEntity* this) { + super->action = 6; + COLLISION_OFF(super); + InitializeAnimation(super, 5); } -void sub_0801F340(Entity* this) { - this->action = 5; - this->timer = 60; - this->speed = 0x20; - this->hitType = 92; - InitializeAnimation(this, 2); +void sub_0801F340(ChuchuEntity* this) { + super->action = 5; + super->timer = 60; + super->speed = 0x20; + super->hitType = 92; + InitializeAnimation(super, 2); } -void sub_0801F360(Entity* this) { - this->action = 7; - this->timer = (Random() & 0x38) + 180; - this->subtimer = Random(); - this->direction = sub_08049F84(this, 1); - this->spritePriority.b1 = 2; - this->spritePriority.b0 = 6; - InitializeAnimation(this, 1); +void sub_0801F360(ChuchuEntity* this) { + super->action = 7; + super->timer = (Random() & 0x38) + 180; + super->subtimer = Random(); + super->direction = sub_08049F84(super, 1); + super->spritePriority.b1 = 2; + super->spritePriority.b0 = 6; + InitializeAnimation(super, 1); } -void sub_0801F3AC(Entity* this) { - if (this->action == 9 || this->action == 0) +void sub_0801F3AC(ChuchuEntity* this) { + if (super->action == 9 || super->action == 0) return; - if (sub_08049FDC(this, 1)) { - if (this->field_0x82.HALF.LO || PlayerInRange(this, 1, 0x48)) { - if (this->action == 1) { - this->action = 2; - this->spriteSettings.draw = 1; - this->field_0x82.HALF.LO = 1; - InitializeAnimation(this, 0); + if (sub_08049FDC(super, 1)) { + if (this->unk_82 || PlayerInRange(super, 1, 0x48)) { + if (super->action == 1) { + super->action = 2; + super->spriteSettings.draw = 1; + this->unk_82 = 1; + InitializeAnimation(super, 0); } - } else if (this->action == 3) { + } else if (super->action == 3) { sub_0801F328(this); } - } else if (this->action == 3) { + } else if (super->action == 3) { sub_0801F328(this); - } else if (this->action == 7) { - this->action = 8; - InitializeAnimation(this, 7); + } else if (super->action == 7) { + super->action = 8; + InitializeAnimation(super, 7); } } -void sub_0801F428(Entity* this) { - sub_0804A720(this); - this->action = 1; - this->timer = Random(); - this->field_0x80.HALF.LO = this->health; - this->field_0x82.HALF.LO = 0; - if (this->type2 == 0) +void sub_0801F428(ChuchuEntity* this) { + sub_0804A720(super); + super->action = 1; + super->timer = Random(); + this->unk_80 = super->health; + this->unk_82 = 0; + if (super->type2 == 0) return; - this->action = 3; - this->subtimer = 30; + super->action = 3; + super->subtimer = 30; #ifdef EU - this->direction = sub_08049F84(this, 1); + super->direction = sub_08049F84(super, 1); #endif - COLLISION_ON(this); - this->spritePriority.b1 = 3; + COLLISION_ON(super); + super->spritePriority.b1 = 3; #ifndef EU - this->spriteSettings.draw = 1; + super->spriteSettings.draw = 1; #endif - InitializeAnimation(this, 2); + InitializeAnimation(super, 2); } -void sub_0801F48C(Entity* this) { - GetNextFrame(this); +void sub_0801F48C(ChuchuEntity* this) { + GetNextFrame(super); } -void sub_0801F494(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 3; - this->subtimer = 30; - this->direction = sub_08049F84(this, 1); - COLLISION_ON(this); - this->spritePriority.b0 = 4; - this->spritePriority.b1 = 3; - InitializeAnimation(this, 2); +void sub_0801F494(ChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 3; + super->subtimer = 30; + super->direction = sub_08049F84(super, 1); + COLLISION_ON(super); + super->spritePriority.b0 = 4; + super->spritePriority.b1 = 3; + InitializeAnimation(super, 2); } } -void sub_0801F4EC(Entity* this) { - GetNextFrame(this); - if (--this->subtimer == 0) - this->action = 4; +void sub_0801F4EC(ChuchuEntity* this) { + GetNextFrame(super); + if (--super->subtimer == 0) + super->action = 4; } -void sub_0801F508(Entity* this) { +void sub_0801F508(ChuchuEntity* this) { if (sub_0801FBD0(this)) { - this->field_0x82.HALF.HI = 0; + this->unk_83 = 0; sub_0801F730(this); } else { - u8 tmp = ++this->timer & 7; - if (tmp == 0 && PlayerInRange(this, 1, 0x38)) { + u8 tmp = ++super->timer & 7; + if (tmp == 0 && PlayerInRange(super, 1, 0x38)) { if (Random() & 1) { - this->action = 5; + super->action = 5; Chuchu_JumpAtPlayer(this); } else { - this->field_0x82.HALF.HI = 120; + this->unk_83 = 120; sub_0801F730(this); } } else { if (tmp == 4) { - this->direction = sub_08049F84(this, 1); + super->direction = sub_08049F84(super, 1); } - ProcessMovement0(this); - GetNextFrame(this); + ProcessMovement0(super); + GetNextFrame(super); } } } -void sub_0801F584(Entity* this) { - if (this->frame & 0x10) { - if (this->frame & 0x1) { - this->frame ^= 1; - this->hitType = 91; +void sub_0801F584(ChuchuEntity* this) { + if (super->frame & 0x10) { + if (super->frame & 0x1) { + super->frame ^= 1; + super->hitType = 91; EnqueueSFX(SFX_12B); } - ProcessMovement2(this); - if (GravityUpdate(this, Q_8_8(64.0)) == 0) - GetNextFrame(this); + ProcessMovement2(super); + if (GravityUpdate(super, Q_8_8(64.0)) == 0) + GetNextFrame(super); } else { - GetNextFrame(this); + GetNextFrame(super); } - if (this->frame & ANIM_DONE) { + if (super->frame & ANIM_DONE) { if (sub_0801FBD0(this)) { - this->field_0x82.HALF.HI = 0; + this->unk_83 = 0; sub_0801F730(this); } else { - this->action = 6; - this->subtimer = 60; - this->speed = 0x20; - this->hitType = 92; - InitializeAnimation(this, 2); + super->action = 6; + super->subtimer = 60; + super->speed = 0x20; + super->hitType = 92; + InitializeAnimation(super, 2); } } } -void sub_0801F61C(Entity* this) { - if (--this->subtimer == 0) - this->action = 4; - GetNextFrame(this); +void sub_0801F61C(ChuchuEntity* this) { + if (--super->subtimer == 0) + super->action = 4; + GetNextFrame(super); } -void sub_0801F638(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 8; - this->subtimer = 30; - this->direction = sub_08049F84(this, 1); - this->spritePriority.b1 = 2; - this->spritePriority.b0 = 6; - InitializeAnimation(this, 1); +void sub_0801F638(ChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 8; + super->subtimer = 30; + super->direction = sub_08049F84(super, 1); + super->spritePriority.b1 = 2; + super->spritePriority.b0 = 6; + InitializeAnimation(super, 1); } } -void sub_0801F688(Entity* this) { - if (this->field_0x82.HALF.HI) - this->field_0x82.HALF.HI--; +void sub_0801F688(ChuchuEntity* this) { + if (this->unk_83) + this->unk_83--; - if (sub_0801FBD0(this) || this->field_0x82.HALF.HI) { - this->direction = sub_08049F84(this, 1); - ProcessMovement5(this); - GetNextFrame(this); + if (sub_0801FBD0(this) || this->unk_83) { + super->direction = sub_08049F84(super, 1); + ProcessMovement5(super); + GetNextFrame(super); } else { sub_0801F748(this); } } -void sub_0801F6CC(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 1; - this->spriteSettings.draw = 0; - InitializeAnimation(this, 4); +void sub_0801F6CC(ChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 1; + super->spriteSettings.draw = 0; + InitializeAnimation(super, 4); } } -void sub_0801F6F8(Entity* this) { - GravityUpdate(this, Q_8_8(24.0)); - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 4; - this->speed = 0x20; - sub_0804AA1C(this); - InitializeAnimation(this, 2); +void sub_0801F6F8(ChuchuEntity* this) { + GravityUpdate(super, Q_8_8(24.0)); + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 4; + super->speed = 0x20; + sub_0804AA1C(super); + InitializeAnimation(super, 2); } } -void sub_0801F730(Entity* this) { - this->action = 7; - COLLISION_OFF(this); - InitializeAnimation(this, 5); +void sub_0801F730(ChuchuEntity* this) { + super->action = 7; + COLLISION_OFF(super); + InitializeAnimation(super, 5); } -void sub_0801F748(Entity* this) { - this->action = 2; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 4); +void sub_0801F748(ChuchuEntity* this) { + super->action = 2; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 4); } -void sub_0801F764(Entity* this) { - if (this->action == 10 || this->action == 0) +void sub_0801F764(ChuchuEntity* this) { + if (super->action == 10 || super->action == 0) return; - if (sub_08049FDC(this, 1)) { - if (this->action == 1) { - if (this->field_0x82.HALF.LO || PlayerInRange(this, 1, 0x48)) { - this->action = 2; - this->spriteSettings.draw = 1; - this->field_0x82.HALF.LO = 1; - InitializeAnimation(this, 0); + if (sub_08049FDC(super, 1)) { + if (super->action == 1) { + if (this->unk_82 || PlayerInRange(super, 1, 0x48)) { + super->action = 2; + super->spriteSettings.draw = 1; + this->unk_82 = 1; + InitializeAnimation(super, 0); } } - } else if (this->action == 4) { + } else if (super->action == 4) { sub_0801F730(this); - } else if (this->action == 8) { - this->action = 9; - InitializeAnimation(this, 7); + } else if (super->action == 8) { + super->action = 9; + InitializeAnimation(super, 7); } } -void sub_0801F7D8(Entity* this) { - sub_0804A720(this); - this->action = 1; - this->timer = Random(); - this->field_0x80.HALF.LO = this->health; - this->field_0x82.HALF.LO = 0; +void sub_0801F7D8(ChuchuEntity* this) { + sub_0804A720(super); + super->action = 1; + super->timer = Random(); + this->unk_80 = super->health; + this->unk_82 = 0; } -void sub_0801F7FC(Entity* this) { - if (sub_08049FDC(this, 1) == 0) +void sub_0801F7FC(ChuchuEntity* this) { + if (sub_08049FDC(super, 1) == 0) return; - if (this->field_0x82.HALF.LO || PlayerInRange(this, 1, 0x48)) { - this->action = 2; - this->spriteSettings.draw = 1; - this->field_0x82.HALF.LO = 1; - InitializeAnimation(this, 0); + if (this->unk_82 || PlayerInRange(super, 1, 0x48)) { + super->action = 2; + super->spriteSettings.draw = 1; + this->unk_82 = 1; + InitializeAnimation(super, 0); } } -void sub_0801F840(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { +void sub_0801F840(ChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { sub_0801FB14(this); - COLLISION_ON(this); - this->spritePriority.b0 = 4; - this->spritePriority.b1 = 3; + COLLISION_ON(super); + super->spritePriority.b0 = 4; + super->spritePriority.b1 = 3; } } -void sub_0801F884(Entity* this) { - GetNextFrame(this); - if (this->subtimer) { - this->subtimer--; +void sub_0801F884(ChuchuEntity* this) { + GetNextFrame(super); + if (super->subtimer) { + super->subtimer--; } else { - Entity* ent = Create0x68FX(this, FX_LIGHTNING_STRIKE); - if (ent != NULL) { - ent->type2 = 64; - this->action = 4; - this->hitType = 165; + Entity* entity = Create0x68FX(super, FX_LIGHTNING_STRIKE); + if (entity != NULL) { + entity->type2 = 64; + super->action = 4; + super->hitType = 165; EnqueueSFX(SFX_193); } } } -void sub_0801F8C0(Entity* this) { +void sub_0801F8C0(ChuchuEntity* this) { if (sub_0801FBD0(this)) { sub_0801FAE0(this); - } else if (sub_08049FDC(this, 1) == 0) { + } else if (sub_08049FDC(super, 1) == 0) { sub_0801F730(this); } else { - u8 tmp = ++this->timer & 7; - if (tmp == 0 && sub_08049F1C(this, gUnk_020000B0, 0x38)) { - this->action = 5; + u8 tmp = ++super->timer & 7; + if (tmp == 0 && sub_08049F1C(super, gUnk_020000B0, 0x38)) { + super->action = 5; Chuchu_JumpAtPlayer(this); } else { if (tmp == 4) { - this->direction = GetFacingDirection(this, gUnk_020000B0); + super->direction = GetFacingDirection(super, gUnk_020000B0); } - ProcessMovement0(this); - GetNextFrame(this); + ProcessMovement0(super); + GetNextFrame(super); } } } -void sub_0801F940(Entity* this) { - if (this->frame & 0x10) { - if (this->frame & 1) { - this->frame ^= 1; +void sub_0801F940(ChuchuEntity* this) { + if (super->frame & 0x10) { + if (super->frame & 1) { + super->frame ^= 1; EnqueueSFX(SFX_12B); } - ProcessMovement2(this); - if (GravityUpdate(this, Q_8_8(64.0)) == 0) - GetNextFrame(this); + ProcessMovement2(super); + if (GravityUpdate(super, Q_8_8(64.0)) == 0) + GetNextFrame(super); } else { - GetNextFrame(this); + GetNextFrame(super); } - if (this->frame & ANIM_DONE) { + if (super->frame & ANIM_DONE) { if (sub_0801FBD0(this)) { sub_0801FAE0(this); } else { - this->action = 6; - this->subtimer = 60; - this->speed = 0x20; - InitializeAnimation(this, 2); + super->action = 6; + super->subtimer = 60; + super->speed = 0x20; + InitializeAnimation(super, 2); } } } -void sub_0801F9C4(Entity* this) { - if (--this->subtimer == 0) - this->action = 4; - GetNextFrame(this); +void sub_0801F9C4(ChuchuEntity* this) { + if (--super->subtimer == 0) + super->action = 4; + GetNextFrame(super); } -void sub_0801F9E0(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 8; - this->subtimer = 30; - this->direction = sub_08049F84(this, 1); - this->spritePriority.b1 = 2; - this->spritePriority.b0 = 6; - InitializeAnimation(this, 1); +void sub_0801F9E0(ChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 8; + super->subtimer = 30; + super->direction = sub_08049F84(super, 1); + super->spritePriority.b1 = 2; + super->spritePriority.b0 = 6; + InitializeAnimation(super, 1); } } -void sub_0801FA30(Entity* this) { +void sub_0801FA30(ChuchuEntity* this) { if (sub_0801FBD0(this)) { - this->direction = sub_08049F84(this, 1); - ProcessMovement5(this); - GetNextFrame(this); - } else if (sub_08049FDC(this, 1) == 0) { - this->action = 9; - InitializeAnimation(this, 7); + super->direction = sub_08049F84(super, 1); + ProcessMovement5(super); + GetNextFrame(super); + } else if (sub_08049FDC(super, 1) == 0) { + super->action = 9; + InitializeAnimation(super, 7); } else { sub_0801FAF8(this); } } -void sub_0801FA78(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 1; - this->spriteSettings.draw = 0; - InitializeAnimation(this, 4); - sub_0804AA1C(this); +void sub_0801FA78(ChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 1; + super->spriteSettings.draw = 0; + InitializeAnimation(super, 4); + sub_0804AA1C(super); } } -void sub_0801FAAC(Entity* this) { - GravityUpdate(this, Q_8_8(24.0)); - GetNextFrame(this); - if (this->frame & ANIM_DONE) { +void sub_0801FAAC(ChuchuEntity* this) { + GravityUpdate(super, Q_8_8(24.0)); + GetNextFrame(super); + if (super->frame & ANIM_DONE) { sub_0801FB14(this); - this->speed = 0x20; - sub_0804AA1C(this); + super->speed = 0x20; + sub_0804AA1C(super); } } -void sub_0801FAE0(Entity* this) { - this->action = 7; - COLLISION_OFF(this); - InitializeAnimation(this, 5); +void sub_0801FAE0(ChuchuEntity* this) { + super->action = 7; + COLLISION_OFF(super); + InitializeAnimation(super, 5); } -void sub_0801FAF8(Entity* this) { - this->action = 2; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 4); +void sub_0801FAF8(ChuchuEntity* this) { + super->action = 2; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 4); } -void sub_0801FB14(Entity* this) { - this->action = 3; - this->subtimer = 30; - this->direction = sub_08049F84(this, 1); - InitializeAnimation(this, 2); +void sub_0801FB14(ChuchuEntity* this) { + super->action = 3; + super->subtimer = 30; + super->direction = sub_08049F84(super, 1); + InitializeAnimation(super, 2); } -void sub_0801FB34(Entity* this) { - if (*(Entity**)&this->field_0x68) { - sub_0806FA90(this, *(Entity**)&this->field_0x68, gUnk_080CA2B4[this->frame & 0xf], 1); - (*(Entity**)&this->field_0x68)->spriteOffsetY--; +void sub_0801FB34(ChuchuEntity* this) { + if (this->unk_68) { + sub_0806FA90(super, this->unk_68, gUnk_080CA2B4[super->frame & 0xf], 1); + (this->unk_68)->spriteOffsetY--; } } -void sub_0801FB68(Entity* this) { - switch (this->type) { +void sub_0801FB68(ChuchuEntity* this) { + switch (super->type) { case 0: - this->action = 9; + super->action = 9; break; case 1: - this->action = 10; - COLLISION_ON(this); - this->spriteSettings.draw = 1; - this->spritePriority.b1 = 3; + super->action = 10; + COLLISION_ON(super); + super->spriteSettings.draw = 1; + super->spritePriority.b1 = 3; break; case 2: - this->action = 10; - this->hitType = 92; - sub_0804AA1C(this); + super->action = 10; + super->hitType = 92; + sub_0804AA1C(super); break; } - this->zVelocity = 0; + super->zVelocity = 0; } -u32 sub_0801FBD0(Entity* this) { - if (GetTileUnderEntity(this) == 0x10) { +u32 sub_0801FBD0(ChuchuEntity* this) { + if (GetTileUnderEntity(super) == 0x10) { return 1; } else { return 0; } } -void Chuchu_JumpAtPlayer(Entity* this) { - this->speed = 0x180; - this->zVelocity = Q_16_16(2.0); - this->direction = sub_08049F84(this, 1); - InitializeAnimation(this, 3); +void Chuchu_JumpAtPlayer(ChuchuEntity* this) { + super->speed = 0x180; + super->zVelocity = Q_16_16(2.0); + super->direction = sub_08049F84(super, 1); + InitializeAnimation(super, 3); } // clang-format off -void (*const Chuchu_Functions[])(Entity*) = { +void (*const Chuchu_Functions[])(ChuchuEntity*) = { Chuchu_OnTick, Chuchu_OnCollision, Chuchu_OnKnockback, @@ -728,7 +740,7 @@ void (*const Chuchu_Functions[])(Entity*) = { Chuchu_OnGrabbed, }; -void (*const gUnk_080CA234[])(Entity*) = { +void (*const gUnk_080CA234[])(ChuchuEntity*) = { sub_0801F0A4, nullsub_4, sub_0801F0C8, @@ -741,7 +753,7 @@ void (*const gUnk_080CA234[])(Entity*) = { sub_0801F2F8, }; -void (*const gUnk_080CA25C[])(Entity*) = { +void (*const gUnk_080CA25C[])(ChuchuEntity*) = { sub_0801F428, sub_0801F48C, sub_0801F494, @@ -755,7 +767,7 @@ void (*const gUnk_080CA25C[])(Entity*) = { sub_0801F6F8, }; -void (*const gUnk_080CA288[])(Entity*) = { +void (*const gUnk_080CA288[])(ChuchuEntity*) = { sub_0801F7D8, sub_0801F7FC, sub_0801F840, diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index ab565a0d..c91cf858 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -1,14 +1,13 @@ -#define NENT_DEPRECATED /** * @file chuchuBoss.c * @ingroup Enemies * * @brief Chuchu Boss enemy */ -#include "global.h" +#define NENT_DEPRECATED #include "enemy.h" -#include "object.h" #include "functions.h" +#include "object.h" typedef struct { u8 unk_00; diff --git a/src/enemy/cloudPiranha.c b/src/enemy/cloudPiranha.c index d9ae589f..83061808 100644 --- a/src/enemy/cloudPiranha.c +++ b/src/enemy/cloudPiranha.c @@ -4,9 +4,7 @@ * * @brief Cloud Piranha enemy */ - #define NENT_DEPRECATED -#include "global.h" #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/crow.c b/src/enemy/crow.c index bd2fb325..ccbf5026 100644 --- a/src/enemy/crow.c +++ b/src/enemy/crow.c @@ -1,6 +1,12 @@ +/** + * @file crow.c + * @ingroup Enemies + * + * @brief Crow enemy + */ #define NENT_DEPRECATED -#include "entity.h" #include "enemy.h" +#include "entity.h" #include "functions.h" typedef struct { diff --git a/src/enemy/cuccoAggr.c b/src/enemy/cuccoAggr.c index c14a4464..4eae33ed 100644 --- a/src/enemy/cuccoAggr.c +++ b/src/enemy/cuccoAggr.c @@ -1,6 +1,12 @@ +/** + * @file cuccoAggr.c + * @ingroup Enemies + * + * @brief Cucco Aggr enemy + */ #define NENT_DEPRECATED -#include "entity.h" #include "enemy.h" +#include "entity.h" #include "functions.h" typedef struct { @@ -292,13 +298,13 @@ bool32 CuccoAggr_IsOutsideScroll(CuccoAggrEntity* this) { void sub_080391B4(CuccoAggrEntity* this) { if (this->unk_7a) { if ((this->unk_7b++ & 0x1f) == 0) { - Entity* ent = CreateEnemy(CUCCO_AGGR, 2); - if (ent != NULL) { + Entity* entity = CreateEnemy(CUCCO_AGGR, 2); + if (entity != NULL) { u32 rand = (Random() & 0x17); const PosOffset* ptr = &gCuccoAggrSpawnPoints[rand]; - ent->x.HALF.HI = gRoomControls.scroll_x + ptr->x; - ent->y.HALF.HI = gRoomControls.scroll_y + ptr->y; - ent->collisionLayer = super->collisionLayer; + entity->x.HALF.HI = gRoomControls.scroll_x + ptr->x; + entity->y.HALF.HI = gRoomControls.scroll_y + ptr->y; + entity->collisionLayer = super->collisionLayer; } } } @@ -317,10 +323,10 @@ void sub_08039218(CuccoAggrEntity* this) { } void CuccoAggr_CreateFx(CuccoAggrEntity* this) { - Entity* ent = CreateFx(super, gCuccoAggrFx[super->type], 0); + Entity* entity = CreateFx(super, gCuccoAggrFx[super->type], 0); - if (ent != NULL) { - ent->x.HALF.HI += gCuccoAggrFxHorizontalOffsets[super->spriteSettings.flipX]; + if (entity != NULL) { + entity->x.HALF.HI += gCuccoAggrFxHorizontalOffsets[super->spriteSettings.flipX]; } } diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c index ca4f3585..2431398d 100644 --- a/src/enemy/cuccoChickAggr.c +++ b/src/enemy/cuccoChickAggr.c @@ -4,7 +4,7 @@ * * @brief Cucco Chick Aggr enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/curtain.c b/src/enemy/curtain.c index 77af09ea..3450ea7c 100644 --- a/src/enemy/curtain.c +++ b/src/enemy/curtain.c @@ -1,3 +1,10 @@ +/** + * @file curtain.c + * @ingroup Enemies + * + * @brief Curtain enemy + */ +#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c index ae29107c..fa729f59 100644 --- a/src/enemy/darkNut.c +++ b/src/enemy/darkNut.c @@ -4,38 +4,54 @@ * * @brief Dark Nut enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u8 unk_74; + /*0x75*/ u8 unk_75; + /*0x76*/ u16 unk_76; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; + /*0x7a*/ u8 unk_7a; + /*0x7b*/ u8 unk_7b; + /*0x7c*/ u8 unk_7c; + /*0x7d*/ u8 unused2[7]; + /*0x84*/ u8 unk_84; +} DarkNutEntity; + typedef struct { u8 field_0x0; u8 field_0x1; } PACKED stuct_080CAB14; -void sub_08021218(Entity*, u32, u32); -void sub_0802124C(Entity*); +void sub_08021218(DarkNutEntity*, u32, u32); +void sub_0802124C(DarkNutEntity*); u32 sub_08021274(u32, u32); -void sub_08021390(Entity*); -void sub_080213B0(Entity*); -void sub_080213D0(Entity*, u32); -void sub_080213F0(Entity*); -void sub_08021400(Entity*); -void sub_08021414(Entity*); -void sub_08021424(Entity*); -u32 sub_080214FC(Entity*); -void sub_08021540(Entity*); -void sub_08021588(Entity*); -void sub_0802159C(Entity*); -void sub_08021600(Entity*); -void sub_08021644(Entity*); -u32 sub_08021664(Entity*, Entity*); -u32 sub_0802169C(Entity*, Entity*); +void sub_08021390(DarkNutEntity*); +void sub_080213B0(DarkNutEntity*); +void sub_080213D0(DarkNutEntity*, u32); +void sub_080213F0(DarkNutEntity*); +void sub_08021400(DarkNutEntity*); +void sub_08021414(DarkNutEntity*); +void sub_08021424(DarkNutEntity*); +u32 sub_080214FC(DarkNutEntity*); +void sub_08021540(DarkNutEntity*); +void sub_08021588(DarkNutEntity*); +void sub_0802159C(DarkNutEntity*); +void sub_08021600(DarkNutEntity*); +void sub_08021644(DarkNutEntity*); +u32 sub_08021664(DarkNutEntity*, Entity*); +u32 sub_0802169C(DarkNutEntity*, Entity*); extern Entity* gUnk_020000B0; -extern void (*const DarkNut_Functions[])(Entity*); -extern void (*const gUnk_080CAAB0[])(Entity*); +extern void (*const DarkNut_Functions[])(DarkNutEntity*); +extern void (*const gUnk_080CAAB0[])(DarkNutEntity*); extern const s8 gUnk_080CAB00[]; extern const s8 gUnk_080CAB04[]; @@ -49,150 +65,150 @@ extern const u8 gUnk_080CAB4A[]; extern const u8 gUnk_080CAB52[]; extern const u8 gUnk_080CAB68[]; -extern void (*const gUnk_080CAB58[])(Entity*); +extern void (*const gUnk_080CAB58[])(DarkNutEntity*); -void DarkNut(Entity* this) { - EnemyFunctionHandler(this, DarkNut_Functions); - SetChildOffset(this, 0, 1, -22); +void DarkNut(DarkNutEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)DarkNut_Functions); + SetChildOffset(super, 0, 1, -22); } -void DarkNut_OnTick(Entity* this) { - gUnk_080CAAB0[this->action](this); +void DarkNut_OnTick(DarkNutEntity* this) { + gUnk_080CAAB0[super->action](this); } -void DarkNut_OnCollision(Entity* this) { - switch (this->contactFlags & 0x7f) { +void DarkNut_OnCollision(DarkNutEntity* this) { + switch (super->contactFlags & 0x7f) { case 0x1c: - this->action = 11; - this->timer = gUnk_080CAB0C[this->type]; - this->hitType = 81; - sub_08021218(this, 8, DirectionToAnimationState(this->knockbackDirection ^ 0x10)); + super->action = 11; + super->timer = gUnk_080CAB0C[super->type]; + super->hitType = 81; + sub_08021218(this, 8, DirectionToAnimationState(super->knockbackDirection ^ 0x10)); sub_08021588(this); - Create0x68FX(this, FX_STARS); + Create0x68FX(super, FX_STARS); break; case 0x16: - this->action = 11; - this->timer = gUnk_080CAB10[this->type]; - this->hitType = 81; - sub_08021218(this, 8, DirectionToAnimationState(this->knockbackDirection ^ 0x10)); + super->action = 11; + super->timer = gUnk_080CAB10[super->type]; + super->hitType = 81; + sub_08021218(this, 8, DirectionToAnimationState(super->knockbackDirection ^ 0x10)); sub_08021588(this); - Create0x68FX(this, FX_STARS); + Create0x68FX(super, FX_STARS); break; case 0x4b: - if (this->action == 13 || this->action == 15 || this->action == 19 || this->action == 18) + if (super->action == 13 || super->action == 15 || super->action == 19 || super->action == 18) break; - switch (this->field_0x78.HALF.HI) { + switch (this->unk_79) { case 8 ... 12: - this->field_0x7a.HALF.LO = gUnk_080CAB04[this->type]; + this->unk_7a = gUnk_080CAB04[super->type]; break; case 4 ... 6: - this->field_0x7a.HALF.LO = gUnk_080CAB00[this->type]; + this->unk_7a = gUnk_080CAB00[super->type]; break; default: - this->field_0x7a.HALF.LO = 0; + this->unk_7a = 0; break; } - this->action = 10; - sub_08021218(this, 0xb, this->animationState); + super->action = 10; + sub_08021218(this, 0xb, super->animationState); EnqueueSFX(SFX_15D); sub_08021588(this); break; case 0x4c: - if (this->action == 15) { + if (super->action == 15) { u8 bVar3 = 0xff; - if (this->child != NULL) { - bVar3 = this->child->contactFlags & 0x7f; + if (super->child != NULL) { + bVar3 = super->child->contactFlags & 0x7f; } if (bVar3 == 2) { - sub_080213D0(this, gUnk_080CAB08[this->type]); + sub_080213D0(this, gUnk_080CAB08[super->type]); } else { sub_080213D0(this, 0); } } break; default: - if (this->health != this->field_0x78.HALF.LO) { + if (super->health != this->unk_78) { sub_08021588(this); sub_08021390(this); - sub_0804AA1C(this); + sub_0804AA1C(super); } break; } - this->field_0x78.HALF.LO = this->health; - EnemyFunctionHandlerAfterCollision(this, DarkNut_Functions); + this->unk_78 = super->health; + EnemyFunctionHandlerAfterCollision(super, DarkNut_Functions); } -void DarkNut_OnGrabbed(Entity* this) { +void DarkNut_OnGrabbed(DarkNutEntity* this) { } -void sub_08020D70(Entity* this) { - sub_0804A720(this); - this->action = 1; - this->field_0x74.HALF.HI = 0; - this->field_0x78.HALF.LO = this->health; - this->animationState = -1; +void sub_08020D70(DarkNutEntity* this) { + sub_0804A720(super); + super->action = 1; + this->unk_75 = 0; + this->unk_78 = super->health; + super->animationState = -1; sub_08021218(this, 0, 2); } -void sub_08020D9C(Entity* this) { - if (sub_08049FDC(this, 1)) +void sub_08020D9C(DarkNutEntity* this) { + if (sub_08049FDC(super, 1)) sub_080213F0(this); } -void sub_08020DB4(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) +void sub_08020DB4(DarkNutEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) sub_08021390(this); } -void sub_08020DD4(Entity* this) { +void sub_08020DD4(DarkNutEntity* this) { if (sub_080214FC(this)) { sub_080213F0(this); - } else if (--this->field_0x76.HWORD == 0) { - this->action = 5; - sub_08021218(this, 5, this->animationState); + } else if (--this->unk_76 == 0) { + super->action = 5; + sub_08021218(this, 5, super->animationState); } else { - if (--this->timer == 0) + if (--super->timer == 0) sub_08021540(this); - ProcessMovement0(this); - UpdateAnimationSingleFrame(this); + ProcessMovement0(super); + UpdateAnimationSingleFrame(super); } } -void sub_08020E28(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) +void sub_08020E28(DarkNutEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) sub_080213B0(this); } -void sub_08020E48(Entity* this) { +void sub_08020E48(DarkNutEntity* this) { if (sub_080214FC(this)) { sub_080213F0(this); } else { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) sub_080213B0(this); } } -void sub_08020E78(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) +void sub_08020E78(DarkNutEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) sub_08021390(this); } -void sub_08020E98(Entity* this) { - if (PlayerInRange(this, 1, 56)) { +void sub_08020E98(DarkNutEntity* this) { + if (PlayerInRange(super, 1, 56)) { if (sub_0802169C(this, gUnk_020000B0)) { - this->action = 8; - sub_08021218(this, 7, this->animationState); + super->action = 8; + sub_08021218(this, 7, super->animationState); } else { - this->direction = GetFacingDirection(gUnk_020000B0, this); - if (ProcessMovement0(this) == 0) { - this->action = 8; - sub_08021218(this, 7, this->animationState); + super->direction = GetFacingDirection(gUnk_020000B0, super); + if (ProcessMovement0(super) == 0) { + super->action = 8; + sub_08021218(this, 7, super->animationState); } else { - this->direction = DirectionTurnAround(this->direction); + super->direction = DirectionTurnAround(super->direction); sub_0802124C(this); sub_08021644(this); } @@ -201,35 +217,35 @@ void sub_08020E98(Entity* this) { if (gUnk_020000B0 == NULL) { sub_08021414(this); } else { - this->direction = GetFacingDirection(this, gUnk_020000B0); - ProcessMovement0(this); + super->direction = GetFacingDirection(super, gUnk_020000B0); + ProcessMovement0(super); sub_0802124C(this); sub_08021644(this); } } } -void sub_08020F28(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) +void sub_08020F28(DarkNutEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) sub_08021400(this); } -void sub_08020F48(Entity* this) { - if (PlayerInRange(this, 1, 0x48)) { +void sub_08020F48(DarkNutEntity* this) { + if (PlayerInRange(super, 1, 0x48)) { if (sub_08021664(this, gUnk_020000B0)) { - u32 uVar2 = sub_0804A044(this, gUnk_020000B0, 9); + u32 uVar2 = sub_0804A044(super, gUnk_020000B0, 9); if (uVar2 == 0xff) { sub_08021424(this); } else { Entity* pEVar3; - this->action = 14; + super->action = 14; sub_08021218(this, 13, uVar2 >> 3); - pEVar3 = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 1); + pEVar3 = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 1); if (pEVar3) { - pEVar3->parent = this; - this->child = pEVar3; + pEVar3->parent = super; + super->child = pEVar3; } } } else { @@ -240,155 +256,155 @@ void sub_08020F48(Entity* this) { } } -void sub_08020FAC(Entity* this) { - if (this->frame & ANIM_DONE) { - if (this->field_0x7a.HALF.LO) { - this->field_0x7a.HALF.LO--; +void sub_08020FAC(DarkNutEntity* this) { + if (super->frame & ANIM_DONE) { + if (this->unk_7a) { + this->unk_7a--; } else { - this->iframes = -8; + super->iframes = -8; sub_08021390(this); } } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } -void sub_08020FE4(Entity* this) { - UpdateAnimationSingleFrame(this); - if (--this->timer == 0) { - this->action = 12; - sub_08021218(this, 9, this->animationState); - sub_0804AA1C(this); +void sub_08020FE4(DarkNutEntity* this) { + UpdateAnimationSingleFrame(super); + if (--super->timer == 0) { + super->action = 12; + sub_08021218(this, 9, super->animationState); + sub_0804AA1C(super); } } -void sub_08021010(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { - this->hitType = 0x56; +void sub_08021010(DarkNutEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { + super->hitType = 0x56; sub_080213F0(this); } } -void sub_08021038(Entity* this) { - if (this->child == NULL && this->frame) { - Entity* pEVar2 = (Entity*)CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 0); +void sub_08021038(DarkNutEntity* this) { + if (super->child == NULL && super->frame) { + Entity* pEVar2 = (Entity*)CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 0); if (pEVar2) { - pEVar2->parent = this; - this->child = pEVar2; + pEVar2->parent = super; + super->child = pEVar2; } EnqueueSFX(SFX_10E); } - if (this->frame & ANIM_DONE) { + if (super->frame & ANIM_DONE) { sub_08021588(this); - if (this->field_0x7c.BYTES.byte0) { - this->field_0x7c.BYTES.byte0--; + if (this->unk_7c) { + this->unk_7c--; } else { sub_08021390(this); } } else { - UpdateAnimationSingleFrame(this); - if (this->frame == 4) - this->hitType = 81; + UpdateAnimationSingleFrame(super); + if (super->frame == 4) + super->hitType = 81; } } -void sub_080210A8(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & 1) { - this->frame = 0; +void sub_080210A8(DarkNutEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & 1) { + super->frame = 0; sub_08021588(this); EnqueueSFX(SFX_15D); - } else if (this->frame & ANIM_DONE) { + } else if (super->frame & ANIM_DONE) { sub_08021390(this); } } -void sub_080210E4(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & 1) { - Entity* ent; +void sub_080210E4(DarkNutEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & 1) { + Entity* entity; - this->frame &= ~1; - ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 2); - if (ent != NULL) { - ent->parent = this; - this->child = ent; + super->frame &= ~1; + entity = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 2); + if (entity != NULL) { + entity->parent = super; + super->child = entity; } EnqueueSFX(SFX_10E); } sub_08021644(this); - if ((this->frame & 0x10) && (!ProcessMovement0(this) || (this->child && (this->child->contactFlags & 0x80)))) { + if ((super->frame & 0x10) && (!ProcessMovement0(super) || (super->child && (super->child->contactFlags & 0x80)))) { sub_080213D0(this, 0); } else { - if (--this->field_0x76.HWORD == 0) + if (--this->unk_76 == 0) sub_080213D0(this, 0); } } -void sub_08021170(Entity* this) { - if (this->frame & ANIM_DONE) { - if (this->field_0x7a.HALF.HI) { - this->field_0x7a.HALF.HI--; +void sub_08021170(DarkNutEntity* this) { + if (super->frame & ANIM_DONE) { + if (this->unk_7b) { + this->unk_7b--; } else { sub_08021390(this); } } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } -void sub_080211A0(Entity* this) { +void sub_080211A0(DarkNutEntity* this) { if (sub_080214FC(this)) { sub_08021390(this); } else { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) sub_080213B0(this); } } -void sub_080211D0(Entity* this) +void sub_080211D0(DarkNutEntity* this) { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); sub_0802159C(this); - if (this->frame & ANIM_DONE) + if (super->frame & ANIM_DONE) sub_08021390(this); } -void sub_080211F4(Entity* this) { - UpdateAnimationSingleFrame(this); +void sub_080211F4(DarkNutEntity* this) { + UpdateAnimationSingleFrame(super); sub_08021600(this); - if (this->frame & ANIM_DONE) + if (super->frame & ANIM_DONE) sub_08021390(this); } -void sub_08021218(Entity* this, u32 param_2, u32 param_3) { +void sub_08021218(DarkNutEntity* this, u32 param_2, u32 param_3) { const stuct_080CAB14* unk; - if (this->field_0x74.HALF.LO == param_2 && this->animationState == param_3) + if (this->unk_74 == param_2 && super->animationState == param_3) return; - this->animationState = param_3; - this->field_0x74.HALF.LO = param_2; + super->animationState = param_3; + this->unk_74 = param_2; unk = &gUnk_080CAB14[param_2]; - this->spriteIndex = unk->field_0x1; - InitAnimationForceUpdate(this, unk->field_0x0 + param_3); + super->spriteIndex = unk->field_0x1; + InitAnimationForceUpdate(super, unk->field_0x0 + param_3); } -void sub_0802124C(Entity* this) { - u32 iVar1 = sub_08021274(this->animationState, this->direction); +void sub_0802124C(DarkNutEntity* this) { + u32 iVar1 = sub_08021274(super->animationState, super->direction); if (iVar1 != 0xff) { - sub_08021218(this, this->field_0x74.HALF.LO, iVar1); + sub_08021218(this, this->unk_74, iVar1); } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } @@ -404,103 +420,103 @@ u32 sub_08021274(u32 animationState, u32 dir) { return dir; } -void sub_080212B0(Entity* this) { +void sub_080212B0(DarkNutEntity* this) { u8 tmp; - switch (this->field_0x74.HALF.HI) { + switch (this->unk_75) { default: - this->field_0x74.HALF.HI = 1; + this->unk_75 = 1; tmp = gUnk_080CAB3A[Random() & 7]; break; case 1: - this->field_0x74.HALF.HI = 2; + this->unk_75 = 2; tmp = gUnk_080CAB42[Random() & 7]; break; case 2: - this->field_0x74.HALF.HI = 0; + this->unk_75 = 0; tmp = gUnk_080CAB4A[Random() & 7]; break; } - if (this->type < 2 && tmp == 2) + if (super->type < 2 && tmp == 2) tmp = gUnk_080CAB52[Random() & 3]; - this->child = NULL; + super->child = NULL; gUnk_080CAB58[tmp](this); } -void sub_08021328(Entity* this) { - this->action = 13; - this->field_0x7c.BYTES.byte0 = gUnk_080CAB68[this->type]; - sub_08021218(this, 0xc, this->animationState); +void sub_08021328(DarkNutEntity* this) { + super->action = 13; + this->unk_7c = gUnk_080CAB68[super->type]; + sub_08021218(this, 0xc, super->animationState); } -void sub_0802134C(Entity* this) { - this->action = 15; - this->direction = DirectionFromAnimationState(this->animationState); - this->speed = 0x200; - this->field_0x76.HWORD = 0x78; - sub_08021218(this, 0xe, this->animationState); +void sub_0802134C(DarkNutEntity* this) { + super->action = 15; + super->direction = DirectionFromAnimationState(super->animationState); + super->speed = 0x200; + this->unk_76 = 0x78; + sub_08021218(this, 0xe, super->animationState); } -void sub_08021370(Entity* this) { - this->action = 18; - sub_08021218(this, 0x10, this->animationState); +void sub_08021370(DarkNutEntity* this) { + super->action = 18; + sub_08021218(this, 0x10, super->animationState); } -void sub_08021380(Entity* this) { - this->action = 19; - sub_08021218(this, 0x11, this->animationState); +void sub_08021380(DarkNutEntity* this) { + super->action = 19; + sub_08021218(this, 0x11, super->animationState); } -void sub_08021390(Entity* this) { - this->action = 7; - this->speed = 0x200; - this->hitType = 0x56; - sub_08021218(this, 6, this->animationState); +void sub_08021390(DarkNutEntity* this) { + super->action = 7; + super->speed = 0x200; + super->hitType = 0x56; + sub_08021218(this, 6, super->animationState); } -void sub_080213B0(Entity* this) { - this->action = 3; - this->timer = 1; - this->speed = 0xc0; - this->field_0x76.HWORD = 0xf0; - sub_08021218(this, 3, this->animationState); +void sub_080213B0(DarkNutEntity* this) { + super->action = 3; + super->timer = 1; + super->speed = 0xc0; + this->unk_76 = 0xf0; + sub_08021218(this, 3, super->animationState); } -void sub_080213D0(Entity* this, u32 param_2) { - this->action = 16; - this->field_0x7a.HALF.HI = param_2; - sub_08021218(this, 0xf, this->animationState); +void sub_080213D0(DarkNutEntity* this, u32 param_2) { + super->action = 16; + this->unk_7b = param_2; + sub_08021218(this, 0xf, super->animationState); sub_08021588(this); } -void sub_080213F0(Entity* this) { - this->action = 6; - sub_08021218(this, 1, this->animationState); +void sub_080213F0(DarkNutEntity* this) { + super->action = 6; + sub_08021218(this, 1, super->animationState); } -void sub_08021400(Entity* this) { - this->action = 9; - this->speed = 0x60; - sub_08021218(this, 10, this->animationState); +void sub_08021400(DarkNutEntity* this) { + super->action = 9; + super->speed = 0x60; + sub_08021218(this, 10, super->animationState); } -void sub_08021414(Entity* this) { - this->action = 17; - sub_08021218(this, 5, this->animationState); +void sub_08021414(DarkNutEntity* this) { + super->action = 17; + sub_08021218(this, 5, super->animationState); } -void sub_08021424(Entity* this) { +void sub_08021424(DarkNutEntity* this) { s32 x, y; u32 tmp; - u32 dir = GetFacingDirection(this, gUnk_020000B0); - tmp = sub_08021274(this->animationState, dir); + u32 dir = GetFacingDirection(super, gUnk_020000B0); + tmp = sub_08021274(super->animationState, dir); if (tmp != 0xff) { - sub_08021218(this, this->field_0x74.HALF.LO, tmp); + sub_08021218(this, this->unk_74, tmp); } else { - tmp = this->animationState; + tmp = super->animationState; } switch (tmp) { @@ -522,122 +538,122 @@ void sub_08021424(Entity* this) { break; } - if (!(6 < (x - this->x.HALF.HI) + 3U) && !(4 < (y - this->y.HALF.HI) + 2U)) { + if (!(6 < (x - super->x.HALF.HI) + 3U) && !(4 < (y - super->y.HALF.HI) + 2U)) { sub_080212B0(this); } else { - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, x, y); - if (!ProcessMovement0(this)) { + super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, x, y); + if (!ProcessMovement0(super)) { sub_080212B0(this); } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } } -u32 sub_080214FC(Entity* this) { +u32 sub_080214FC(DarkNutEntity* this) { u32 direction; - if (!sub_08049FDC(this, 1)) + if (!sub_08049FDC(super, 1)) return 0; - direction = GetFacingDirection(this, gUnk_020000B0); - if (4 < (direction - (this->frame & 0x1f)) - 2) + direction = GetFacingDirection(super, gUnk_020000B0); + if (4 < (direction - (super->frame & 0x1f)) - 2) return 0; - this->animationState = DirectionToAnimationState(direction); + super->animationState = DirectionToAnimationState(direction); return 1; } -void sub_08021540(Entity* this) { +void sub_08021540(DarkNutEntity* this) { u32 tmp, tmp2; u32 rand; rand = Random(); - if (!sub_08049FA0(this) && (rand & 1)) { - tmp2 = DirectionRoundUp(sub_08049EE4(this)); + if (!sub_08049FA0(super) && (rand & 1)) { + tmp2 = DirectionRoundUp(sub_08049EE4(super)); } else { tmp2 = DirectionRound(rand >> 0x10); } - this->direction = tmp2; + super->direction = tmp2; - tmp = sub_08021274(this->animationState, tmp2); + tmp = sub_08021274(super->animationState, tmp2); if (tmp != 0xff) sub_08021218(this, 3, tmp); - this->timer = 30; + super->timer = 30; } -void sub_08021588(Entity* this) { - if (this->child != NULL) { - this->child->parent = NULL; - this->child = NULL; +void sub_08021588(DarkNutEntity* this) { + if (super->child != NULL) { + super->child->parent = NULL; + super->child = NULL; } } -void sub_0802159C(Entity* this) { - if (this->frame == 1) { - Entity* ent; +void sub_0802159C(DarkNutEntity* this) { + if (super->frame == 1) { + Entity* entity; - this->frame = 0; - this->hitType = 0x51; - ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 3); - if (ent != NULL) { - ent->parent = this; - this->child = ent; + super->frame = 0; + super->hitType = 0x51; + entity = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 3); + if (entity != NULL) { + entity->parent = super; + super->child = entity; } EnqueueSFX(SFX_116); - } else if (this->frame == 2) { - this->frame = 0; + } else if (super->frame == 2) { + super->frame = 0; sub_08021588(this); - } else if (this->frame & 0x20) { - this->frame &= ~0x20; + } else if (super->frame & 0x20) { + super->frame &= ~0x20; EnqueueSFX(SFX_115); } } -void sub_08021600(Entity* this) { - if (this->frame == 1) { - Entity* ent; +void sub_08021600(DarkNutEntity* this) { + if (super->frame == 1) { + Entity* entity; - this->frame = 0; - this->hitType = 0x51; - ent = CreateProjectileWithParent(this, DARK_NUT_SWORD_SLASH, 4); - if (ent != NULL) { - ent->parent = this; - this->child = ent; + super->frame = 0; + super->hitType = 0x51; + entity = CreateProjectileWithParent(super, DARK_NUT_SWORD_SLASH, 4); + if (entity != NULL) { + entity->parent = super; + super->child = entity; } EnqueueSFX(SFX_10E); - } else if (this->frame == 2) { - this->frame = 0; + } else if (super->frame == 2) { + super->frame = 0; sub_08021588(this); } } -void sub_08021644(Entity* this) { - if (this->frame & 0x20) { - this->frame &= ~0x20; +void sub_08021644(DarkNutEntity* this) { + if (super->frame & 0x20) { + super->frame &= ~0x20; EnqueueSFX(SFX_PLY_LAND); } } -u32 sub_08021664(Entity* this, Entity* ent) { - switch (this->animationState) { +u32 sub_08021664(DarkNutEntity* this, Entity* entity) { + switch (super->animationState) { case 0: - return sub_08049F1C(this, ent, 0x22); + return sub_08049F1C(super, entity, 0x22); case 1: - return sub_08049F1C(this, ent, 0x1a); + return sub_08049F1C(super, entity, 0x1a); case 2: - return sub_08049F1C(this, ent, 0x13); + return sub_08049F1C(super, entity, 0x13); case 3: - return sub_08049F1C(this, ent, 0x1a); + return sub_08049F1C(super, entity, 0x1a); } return 0; } -u32 sub_0802169C(Entity* this, Entity* ent) { +u32 sub_0802169C(DarkNutEntity* this, Entity* entity) { u32 ret; - switch (this->animationState) { + switch (super->animationState) { case 0: ret = 0x2c; break; @@ -652,7 +668,7 @@ u32 sub_0802169C(Entity* this, Entity* ent) { return 0; } - if (sub_08049F1C(this, ent, ret)) { + if (sub_08049F1C(super, entity, ret)) { return 0; } else { return 1; @@ -660,15 +676,15 @@ u32 sub_0802169C(Entity* this, Entity* ent) { } // clang-format off -void (*const DarkNut_Functions[])(Entity*) = { +void (*const DarkNut_Functions[])(DarkNutEntity*) = { DarkNut_OnTick, DarkNut_OnCollision, - GenericKnockback, - GenericDeath, - GenericConfused, + (void (*)(DarkNutEntity*))GenericKnockback, + (void (*)(DarkNutEntity*))GenericDeath, + (void (*)(DarkNutEntity*))GenericConfused, DarkNut_OnGrabbed, }; -void (*const gUnk_080CAAB0[])(Entity*) = { +void (*const gUnk_080CAAB0[])(DarkNutEntity*) = { sub_08020D70, sub_08020D9C, sub_08020DB4, @@ -749,7 +765,7 @@ const u8 gUnk_080CAB52[] = { 0, 3, 1, 0, 0, 0 }; -void (*const gUnk_080CAB58[])(Entity*) = { +void (*const gUnk_080CAB58[])(DarkNutEntity*) = { sub_08021328, sub_0802134C, sub_08021370, diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c index b7745c4a..e9719c0f 100644 --- a/src/enemy/doorMimic.c +++ b/src/enemy/doorMimic.c @@ -4,20 +4,29 @@ * * @brief Door Mimic enemy */ - -#include "sound.h" +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" +#include "sound.h" -void sub_080221C0(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u16 unk_78; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ u16 unk_7c; + /*0x7e*/ u16 unk_7e; +} DoorMimicEntity; + +void sub_080221C0(DoorMimicEntity*); typedef struct { s8 h; s8 v; } PACKED PosOffset; -extern void (*const DoorMimic_Functions[])(Entity*); -extern void (*const gUnk_080CB74C[])(Entity*); +extern void (*const DoorMimic_Functions[])(DoorMimicEntity*); +extern void (*const gUnk_080CB74C[])(DoorMimicEntity*); extern const s8 gUnk_080CB764[]; extern const PosOffset gUnk_080CB76C[4][6]; @@ -26,111 +35,111 @@ extern const Hitbox* const* const gUnk_080CB8A4[]; extern s16 gUnk_080B4488[]; -void DoorMimic(Entity* this) { - DoorMimic_Functions[GetNextFunction(this)](this); - this->hitbox = (Hitbox*)gUnk_080CB8A4[this->type2][this->frameIndex]; +void DoorMimic(DoorMimicEntity* this) { + DoorMimic_Functions[GetNextFunction(super)](this); + super->hitbox = (Hitbox*)gUnk_080CB8A4[super->type2][super->frameIndex]; } -void DoorMimic_OnTick(Entity* this) { - gUnk_080CB74C[this->action](this); +void DoorMimic_OnTick(DoorMimicEntity* this) { + gUnk_080CB74C[super->action](this); } -void DoorMimic_OnCollision(Entity* this) { - EnemyFunctionHandlerAfterCollision(this, DoorMimic_Functions); +void DoorMimic_OnCollision(DoorMimicEntity* this) { + EnemyFunctionHandlerAfterCollision(super, DoorMimic_Functions); } -void DoorMimic_OnDeath(Entity* this) { - SetTile((u16)this->field_0x7c.HALF.LO, (u16)this->field_0x7c.HALF.HI, this->collisionLayer); - CreateFx(this, FX_POT_SHATTER, 0); - sub_08049CF4(this); +void DoorMimic_OnDeath(DoorMimicEntity* this) { + SetTile(this->unk_7c, this->unk_7e, super->collisionLayer); + CreateFx(super, FX_POT_SHATTER, 0); + sub_08049CF4(super); DeleteThisEntity(); } -void sub_08022034(Entity* this) { - this->action = 1; - this->type2 = this->type & 3; - this->spritePriority.b0 = 5; - this->field_0x78.HWORD = gUnk_080CB764[this->type2 * 2 + 0] + this->x.HALF.HI; - this->field_0x7a.HWORD = gUnk_080CB764[this->type2 * 2 + 1] + this->y.HALF.HI; - InitializeAnimation(this, this->type2); +void sub_08022034(DoorMimicEntity* this) { + super->action = 1; + super->type2 = super->type & 3; + super->spritePriority.b0 = 5; + this->unk_78 = gUnk_080CB764[super->type2 * 2 + 0] + super->x.HALF.HI; + this->unk_7a = gUnk_080CB764[super->type2 * 2 + 1] + super->y.HALF.HI; + InitializeAnimation(super, super->type2); sub_080221C0(this); } -void sub_0802209C(Entity* this) { - if (this->timer == 0) { - if (CheckPlayerProximity(this->field_0x78.HWORD, this->field_0x7a.HWORD, 0x10, 0x10)) { - this->action = 2; - this->timer = 18; - InitializeAnimation(this, this->type2 + 4); +void sub_0802209C(DoorMimicEntity* this) { + if (super->timer == 0) { + if (CheckPlayerProximity(this->unk_78, this->unk_7a, 0x10, 0x10)) { + super->action = 2; + super->timer = 18; + InitializeAnimation(super, super->type2 + 4); } } else { - this->timer--; + super->timer--; } } -void sub_080220D8(Entity* this) { - if (--this->timer == 0) - this->action = 3; +void sub_080220D8(DoorMimicEntity* this) { + if (--super->timer == 0) + super->action = 3; } -void sub_080220F0(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { +void sub_080220F0(DoorMimicEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { const PosOffset* off; u32 i; - this->action = 4; - this->timer = 120; - this->damage = 0; - off = gUnk_080CB76C[this->type2]; + super->action = 4; + super->timer = 120; + super->damage = 0; + off = gUnk_080CB76C[super->type2]; for (i = 0; i < 6; i++, off++) { - Entity* fx = CreateFx(this, FX_DASH, 0); + Entity* fx = CreateFx(super, FX_DASH, 0); if (fx) { fx->x.HALF.HI += off->h; fx->y.HALF.HI += off->v; } } EnqueueSFX(SFX_PLACE_OBJ); - } else if (this->frame & 1) { - this->damage = 4; + } else if (super->frame & 1) { + super->damage = 4; } } -void sub_08022174(Entity* this) { - sub_0800445C(this); - if (--this->timer == 0) { - this->action = 5; - InitializeAnimation(this, this->type2 + 8); +void sub_08022174(DoorMimicEntity* this) { + sub_0800445C(super); + if (--super->timer == 0) { + super->action = 5; + InitializeAnimation(super, super->type2 + 8); } } -void sub_08022198(Entity* this) { - sub_0800445C(this); - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 1; - this->timer = 90; +void sub_08022198(DoorMimicEntity* this) { + sub_0800445C(super); + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 1; + super->timer = 90; } } -void sub_080221C0(Entity* this) { - u32 tile = COORD_TO_TILE(this) + gUnk_080B4488[this->type2]; - this->field_0x7c.HALF.HI = tile; - this->field_0x7c.HALF.LO = GetTileIndex(tile, this->collisionLayer); - SetTile(gUnk_080CB79C[this->type2], tile, this->collisionLayer); +void sub_080221C0(DoorMimicEntity* this) { + u32 tile = COORD_TO_TILE(super) + gUnk_080B4488[super->type2]; + this->unk_7e = tile; + this->unk_7c = GetTileIndex(tile, super->collisionLayer); + SetTile(gUnk_080CB79C[super->type2], tile, super->collisionLayer); } // clang-format off -void (*const DoorMimic_Functions[])(Entity*) = { +void (*const DoorMimic_Functions[])(DoorMimicEntity*) = { DoorMimic_OnTick, DoorMimic_OnCollision, - GenericKnockback, + (void (*)(DoorMimicEntity*))GenericKnockback, DoorMimic_OnDeath, - GenericConfused, + (void (*)(DoorMimicEntity*))GenericConfused, DoorMimic_OnTick, }; -void (*const gUnk_080CB74C[])(Entity*) = { +void (*const gUnk_080CB74C[])(DoorMimicEntity*) = { sub_08022034, sub_0802209C, sub_080220D8, diff --git a/src/enemy/dust.c b/src/enemy/dust.c index 9b2bec8a..df2073fe 100644 --- a/src/enemy/dust.c +++ b/src/enemy/dust.c @@ -1,12 +1,18 @@ +/** + * @file dust.c + * @ingroup Enemies + * + * @brief Dust enemy + */ #define NENT_DEPRECATED -#include "entity.h" -#include "enemy.h" -#include "hitbox.h" -#include "player.h" -#include "physics.h" -#include "room.h" #include "asm.h" +#include "enemy.h" +#include "entity.h" +#include "hitbox.h" #include "object.h" +#include "physics.h" +#include "player.h" +#include "room.h" typedef struct { Entity base; diff --git a/src/enemy/enemy4D.c b/src/enemy/enemy4D.c index 7e0ee931..f4ebdf70 100644 --- a/src/enemy/enemy4D.c +++ b/src/enemy/enemy4D.c @@ -2,12 +2,11 @@ * @file enemy4D.c * @ingroup Enemies * - * @brief enemy 4D + * @brief Enemy4D enemy */ #define NENT_DEPRECATED -#include "global.h" -#include "entity.h" #include "enemy.h" +#include "entity.h" #include "functions.h" typedef struct { diff --git a/src/enemy/enemy50.c b/src/enemy/enemy50.c index db7bd2c1..cd59db89 100644 --- a/src/enemy/enemy50.c +++ b/src/enemy/enemy50.c @@ -4,12 +4,10 @@ * * @brief Enemy50 enemy */ - #define NENT_DEPRECATED -#include "global.h" +#include "area.h" #include "enemy.h" #include "functions.h" -#include "area.h" #include "player.h" typedef struct { diff --git a/src/enemy/enemy64.c b/src/enemy/enemy64.c index 5cfd1a60..d6da9844 100644 --- a/src/enemy/enemy64.c +++ b/src/enemy/enemy64.c @@ -4,12 +4,10 @@ * * @brief Enemy64 enemy */ - #define NENT_DEPRECATED -#include "global.h" #include "enemy.h" -#include "functions.h" #include "fade.h" +#include "functions.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/enemy/enemy66.c b/src/enemy/enemy66.c index 859bc556..ca5a6423 100644 --- a/src/enemy/enemy66.c +++ b/src/enemy/enemy66.c @@ -1,3 +1,10 @@ +/** + * @file enemy66.c + * @ingroup Enemies + * + * @brief Enemy66 enemy + */ +#define NENT_DEPRECATED #include "entity.h" void (*const gUnk_080D2ABC[])(Entity*); diff --git a/src/enemy/enemyE.c b/src/enemy/enemyE.c index 957c953b..b470d584 100644 --- a/src/enemy/enemyE.c +++ b/src/enemy/enemyE.c @@ -2,9 +2,9 @@ * @file enemyE.c * @ingroup Enemies * - * @brief enemy E + * @brief EnemyE enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/eyegore.c b/src/enemy/eyegore.c index f0c8efd5..516bc646 100644 --- a/src/enemy/eyegore.c +++ b/src/enemy/eyegore.c @@ -4,14 +4,12 @@ * * @brief Eyegore enemy */ - #define NENT_DEPRECATED -#include "global.h" #include "enemy.h" -#include "functions.h" #include "fade.h" -#include "object.h" +#include "functions.h" #include "hitbox.h" +#include "object.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index 5f9f5ce2..d0b82155 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -4,109 +4,120 @@ * * @brief Falling Boulder enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" -void sub_0802C4B0(Entity*); -void sub_0802C62C(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[18]; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ u16 unk_7c; + /*0x7e*/ u16 unk_7e; + /*0x80*/ u16 unk_80; + /*0x82*/ u16 unk_82; + /*0x84*/ u32 unk_84; +} FallingBoulderEntity; -extern void (*const FallingBoulder_Functions[])(Entity*); -extern void (*const gUnk_080CD558[])(Entity*); +void sub_0802C4B0(FallingBoulderEntity* this); +void sub_0802C62C(FallingBoulderEntity* this); + +extern void (*const FallingBoulder_Functions[])(FallingBoulderEntity*); +extern void (*const gUnk_080CD558[])(FallingBoulderEntity*); extern const u16 gUnk_080CD568[]; extern const u8 gUnk_080CD580[]; extern const s16 gUnk_080CD58C[]; -void FallingBoulder(Entity* this) { - EnemyFunctionHandler(this, FallingBoulder_Functions); +void FallingBoulder(FallingBoulderEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)FallingBoulder_Functions); } -void FallingBoulder_OnTick(Entity* this) { - gUnk_080CD558[this->action](this); +void FallingBoulder_OnTick(FallingBoulderEntity* this) { + gUnk_080CD558[super->action](this); } -void FallingBoulder_OnCollision(Entity* this) { +void FallingBoulder_OnCollision(FallingBoulderEntity* this) { /* ... */ } -void FallingBoulder_OnGrabbed(Entity* this) { +void FallingBoulder_OnGrabbed(FallingBoulderEntity* this) { /* ... */ } -void sub_0802C258(Entity* this) { - sub_0804A720(this); - this->zVelocity = Q_16_16(2.0); - this->timer = 2; - this->field_0x7a.HWORD = Random() & 0x70; - switch (this->type) { +void sub_0802C258(FallingBoulderEntity* this) { + sub_0804A720(super); + super->zVelocity = Q_16_16(2.0); + super->timer = 2; + this->unk_7a = Random() & 0x70; + switch (super->type) { case 1: - this->field_0x7a.HWORD |= 0x100; + this->unk_7a |= 0x100; break; case 2: - this->field_0x7a.HWORD |= 0x200; + this->unk_7a |= 0x200; break; } - this->field_0x80.HWORD = this->x.HALF.HI; - this->field_0x82.HWORD = this->y.HALF.HI; - this->z.HALF.HI = -0x10; - this->collisionLayer = 3; - this->spriteRendering.b3 = 1; - this->spritePriority.b0 = 2; - this->field_0x7c.HALF.LO = 0; - this->field_0x7c.HALF.HI = COORD_TO_TILE(this); + this->unk_80 = super->x.HALF.HI; + this->unk_82 = super->y.HALF.HI; + super->z.HALF.HI = -0x10; + super->collisionLayer = 3; + super->spriteRendering.b3 = 1; + super->spritePriority.b0 = 2; + this->unk_7c = 0; + this->unk_7e = COORD_TO_TILE(super); sub_0802C62C(this); sub_0802C4B0(this); } -void sub_0802C318(Entity* this) { - if (--this->field_0x7a.HWORD == 0) { - this->action = 2; +void sub_0802C318(FallingBoulderEntity* this) { + if (--this->unk_7a == 0) { + super->action = 2; } } -void sub_0802C334(Entity* this) { - register Entity* ent asm("r2"); +void sub_0802C334(FallingBoulderEntity* this) { + register Entity* entity asm("r2"); u32 diff; u16 tmp; - if (this->field_0x7c.HALF_U.LO == 0) { + if (this->unk_7c == 0) { u32 tmp = gRoomControls.origin_y; - ent = &gPlayerEntity; - if (ent == NULL) + entity = &gPlayerEntity; + if (entity == NULL) return; - if (ent->y.HALF.HI - tmp <= 0x38) { + if (entity->y.HALF.HI - tmp <= 0x38) { return; } - this->field_0x7c.HALF_U.LO = 1; - this->spriteSettings.draw = 1; + this->unk_7c = 1; + super->spriteSettings.draw = 1; } - GetNextFrame(this); - this->field_0x7c.HALF.HI = COORD_TO_TILE(this); - if (sub_080044EC(this, *(u32*)&this->cutsceneBeh) == 1) { + GetNextFrame(super); + this->unk_7e = COORD_TO_TILE(super); + if (sub_080044EC(super, this->unk_84) == 1) { EnqueueSFX(0x14c); - COLLISION_ON(this); - this->field_0x7a.HWORD = 0xc; + COLLISION_ON(super); + this->unk_7a = 0xc; sub_0802C4B0(this); } else { s32 y; - if (this->field_0x7a.HWORD) { - tmp = --this->field_0x7a.HWORD; + if (this->unk_7a) { + tmp = --this->unk_7a; switch (tmp) { case 0: - COLLISION_OFF(this); + COLLISION_OFF(super); break; case 8: - if (this->type2 != 0 && !sub_08049FA0(this)) { + if (super->type2 != 0 && !sub_08049FA0(super)) { diff = 0; for (y = 1; y > -1; y--) { - ent = CreateFx(this, FX_ROCK2, 0); - if (ent) { - ent->x.HALF.HI = ent->x.HALF.HI + 12 - diff; + entity = CreateFx(super, FX_ROCK2, 0); + if (entity) { + entity->x.HALF.HI = entity->x.HALF.HI + 12 - diff; } diff += 0x18; } sub_0802C62C(this); - this->field_0x7a.HWORD = (Random() & 0xff) | 0x100; + this->unk_7a = (Random() & 0xff) | 0x100; return; } break; @@ -115,37 +126,37 @@ void sub_0802C334(Entity* this) { { FORCE_REGISTER(RoomControls * tmp, r0) = &gRoomControls; - y = tmp->origin_y + tmp->height - this->y.HALF.HI; + y = tmp->origin_y + tmp->height - super->y.HALF.HI; } if (y >= 5) { - ProcessMovement1(this); + ProcessMovement1(super); } else { - LinearMoveUpdate(this); - if (this->z.HALF.HI - y > 0x38) { + LinearMoveUpdate(super); + if (super->z.HALF.HI - y > 0x38) { sub_0802C62C(this); - this->field_0x7a.HWORD = (Random() & 0x7f) | 0x80; - if (this->type == 3) { - this->action = 3; + this->unk_7a = (Random() & 0x7f) | 0x80; + if (super->type == 3) { + super->action = 3; } } } } - this->collisionLayer = 3; - this->spritePriority.b0 = 1; - UpdateSpriteForCollisionLayer(this); + super->collisionLayer = 3; + super->spritePriority.b0 = 1; + UpdateSpriteForCollisionLayer(super); } -void nullsub_148(Entity* this) { +void nullsub_148(FallingBoulderEntity* this) { /* ... */ } -void sub_0802C4B0(Entity* this) { +void sub_0802C4B0(FallingBoulderEntity* this) { u32 offset; u32 index; u32 rand; - switch (GetTileIndex(this->field_0x7c.HALF_U.HI, this->collisionLayer)) { + switch (GetTileIndex(this->unk_7e, super->collisionLayer)) { case 0x1ab ... 0x1af: offset = 8; break; @@ -160,78 +171,78 @@ void sub_0802C4B0(Entity* this) { rand = Random() & 7; if (rand & 4) { if (rand & 3) { - this->speed = gUnk_080CD568[offset | 2]; + super->speed = gUnk_080CD568[offset | 2]; } else { - this->speed = gUnk_080CD568[offset | 0]; + super->speed = gUnk_080CD568[offset | 0]; } } else { if (rand & 3) { - this->speed = gUnk_080CD568[offset | 1]; + super->speed = gUnk_080CD568[offset | 1]; } else { - this->speed = gUnk_080CD568[offset | 3]; + super->speed = gUnk_080CD568[offset | 3]; } } rand = Random() & 7; if (rand & 4) { - if (this->timer != 0) { - this->timer = 0; - InitializeAnimation(this, 0); + if (super->timer != 0) { + super->timer = 0; + InitializeAnimation(super, 0); } if (rand & 3) { - this->direction = gUnk_080CD580[offset | 1]; + super->direction = gUnk_080CD580[offset | 1]; } else { - this->direction = gUnk_080CD580[offset | 0]; + super->direction = gUnk_080CD580[offset | 0]; } } else { - if (this->timer != 1) { - this->timer = 1; - InitializeAnimation(this, 1); + if (super->timer != 1) { + super->timer = 1; + InitializeAnimation(super, 1); } if (rand & 3) { - this->direction = gUnk_080CD580[offset | 2]; + super->direction = gUnk_080CD580[offset | 2]; } else { - this->direction = gUnk_080CD580[offset | 3]; + super->direction = gUnk_080CD580[offset | 3]; } } rand = Random() & 7; - this->zVelocity = Q_16_16(2.0); + super->zVelocity = Q_16_16(2.0); if (rand & 4) { if (rand & 3) { - *(u32*)&this->cutsceneBeh = gUnk_080CD58C[offset | 1]; + this->unk_84 = gUnk_080CD58C[offset | 1]; } else { - *(u32*)&this->cutsceneBeh = gUnk_080CD58C[offset | 3]; + this->unk_84 = gUnk_080CD58C[offset | 3]; } } else { if (rand & 3) { - *(u32*)&this->cutsceneBeh = gUnk_080CD58C[offset | 2]; + this->unk_84 = gUnk_080CD58C[offset | 2]; } else { - *(u32*)&this->cutsceneBeh = gUnk_080CD58C[offset | 0]; + this->unk_84 = gUnk_080CD58C[offset | 0]; } } } -void sub_0802C62C(Entity* this) { - this->action = 1; - this->y.HALF.HI = this->field_0x82.HWORD; - this->x.HALF.HI = this->field_0x80.HWORD; - this->spriteSettings.draw = 0; - COLLISION_OFF(this); - this->field_0x7c.HALF.LO = 0; +void sub_0802C62C(FallingBoulderEntity* this) { + super->action = 1; + super->y.HALF.HI = this->unk_82; + super->x.HALF.HI = this->unk_80; + super->spriteSettings.draw = 0; + COLLISION_OFF(super); + this->unk_7c = 0; } // clang-format off -void (*const FallingBoulder_Functions[])(Entity*) = { +void (*const FallingBoulder_Functions[])(FallingBoulderEntity*) = { FallingBoulder_OnTick, FallingBoulder_OnCollision, - GenericKnockback, - GenericDeath, - GenericConfused, + (void (*)(FallingBoulderEntity*))GenericKnockback, + (void (*)(FallingBoulderEntity*))GenericDeath, + (void (*)(FallingBoulderEntity*))GenericConfused, FallingBoulder_OnGrabbed, }; -void (*const gUnk_080CD558[])(Entity*) = { +void (*const gUnk_080CD558[])(FallingBoulderEntity*) = { sub_0802C258, sub_0802C318, sub_0802C334, diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index db1bf3da..557163d4 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -4,135 +4,141 @@ * * @brief Fireball Guy enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[28]; + /*0x84*/ u8 unk_84; +} FireballGuyEntity; + typedef struct { s8 h, v; } PACKED PosOffset; -extern void sub_08045524(Entity*); +extern void sub_08045524(FireballGuyEntity*); void sub_08045178(Entity*, Entity*, int, int); -void FireballGuy_OnTick(Entity*); -void FireballGuy_OnCollision(Entity*); -void FireballGuy_OnGrabbed(Entity*); -void FireballGuy_Init(Entity*); -void FireballGuy_Action1(Entity*); -void FireballGuy_Action2(Entity*); +void FireballGuy_OnTick(FireballGuyEntity*); +void FireballGuy_OnCollision(FireballGuyEntity*); +void FireballGuy_OnGrabbed(FireballGuyEntity*); +void FireballGuy_Init(FireballGuyEntity*); +void FireballGuy_Action1(FireballGuyEntity*); +void FireballGuy_Action2(FireballGuyEntity*); -static void (*const FireballGuy_Functions[])(Entity*) = { - FireballGuy_OnTick, FireballGuy_OnCollision, GenericKnockback, GenericDeath, GenericConfused, FireballGuy_OnGrabbed, +static void (*const FireballGuy_Functions[])(FireballGuyEntity*) = { + FireballGuy_OnTick, FireballGuy_OnCollision, (void (*)(FireballGuyEntity*))GenericKnockback, (void (*)(FireballGuyEntity*))GenericDeath, (void (*)(FireballGuyEntity*))GenericConfused, FireballGuy_OnGrabbed, }; -void FireballGuy(Entity* this) { - EnemyFunctionHandler(this, FireballGuy_Functions); +void FireballGuy(FireballGuyEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)FireballGuy_Functions); } -void FireballGuy_OnTick(Entity* this) { - static void (*const FireballGuy_Actions[])(Entity*) = { +void FireballGuy_OnTick(FireballGuyEntity* this) { + static void (*const FireballGuy_Actions[])(FireballGuyEntity*) = { FireballGuy_Init, FireballGuy_Action1, FireballGuy_Action2, }; - FireballGuy_Actions[this->action](this); + FireballGuy_Actions[super->action](this); } -void FireballGuy_OnCollision(Entity* this) { - if (this->health && this->cutsceneBeh.HALF.LO != this->health) { - this->action = 2; +void FireballGuy_OnCollision(FireballGuyEntity* this) { + if (super->health && this->unk_84 != super->health) { + super->action = 2; } else { - EnemyFunctionHandlerAfterCollision(this, FireballGuy_Functions); + EnemyFunctionHandlerAfterCollision(super, FireballGuy_Functions); } } -void FireballGuy_OnGrabbed(Entity* this) { +void FireballGuy_OnGrabbed(FireballGuyEntity* this) { } -void FireballGuy_Init(Entity* this) { - this->action = 1; - this->timer = 0; - this->spriteSettings.draw = 1; - this->speed = 0x80; - this->cutsceneBeh.HALF.LO = this->health; - this->collisionFlags |= 0x10; - sub_0804A720(this); - InitializeAnimation(this, 0); +void FireballGuy_Init(FireballGuyEntity* this) { + super->action = 1; + super->timer = 0; + super->spriteSettings.draw = 1; + super->speed = 0x80; + this->unk_84 = super->health; + super->collisionFlags |= 0x10; + sub_0804A720(super); + InitializeAnimation(super, 0); sub_08045524(this); } -void FireballGuy_Action1(Entity* this) { - ProcessMovement2(this); - GetNextFrame(this); - if (GravityUpdate(this, Q_8_8(24.0)) == 0) +void FireballGuy_Action1(FireballGuyEntity* this) { + ProcessMovement2(super); + GetNextFrame(super); + if (GravityUpdate(super, Q_8_8(24.0)) == 0) sub_08045524(this); } /* Split FireballGuy into new ones */ -void FireballGuy_Action2(Entity* this) { +void FireballGuy_Action2(FireballGuyEntity* 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 } }; Entity* entities[4]; - Entity* ent; + Entity* entity; s32 count, i; const PosOffset* off; u32 tmp; /* Can we create enough new entities? */ - count = typeEntityCount[this->type]; + count = typeEntityCount[super->type]; if (MAX_ENTITIES + 1 - count <= gEntCount) return; /* Create 2-5 new MiniFireballGuy */ for (i = 0; i < count; i++) - entities[i] = CreateEnemy(MINI_FIREBALL_GUY, this->type); + entities[i] = CreateEnemy(MINI_FIREBALL_GUY, super->type); off = gUnk_080D1810; for (i = 0; i < count; i++) { - ent = entities[i]; - ent->child = entities[(i + 1) % count]; - ent->parent = entities[(i + count - 1) % count]; + entity = entities[i]; + entity->child = entities[(i + 1) % count]; + entity->parent = entities[(i + count - 1) % count]; tmp = 0; - ent->type2 = 1; - ent->z.HALF.HI = tmp; - ent->iframes = -0x10; + entity->type2 = 1; + entity->z.HALF.HI = tmp; + entity->iframes = -0x10; /* Set MiniFireballGuy offset relative to killed slime. */ - sub_08045178(this, ent, off->h, off->v); + sub_08045178(super, entity, off->h, off->v); off++; } - ent = CreateFx(this, FX_DEATH, 0); - if (ent != NULL) - CopyPosition(this, ent); + entity = CreateFx(super, FX_DEATH, 0); + if (entity != NULL) + CopyPosition(super, entity); - DeleteEntity(this); + DeleteEntity(super); } u32 sub_0804A024(Entity*, u32, u32); -void sub_08045524(Entity* this) { +void sub_08045524(FireballGuyEntity* this) { u32 tmp, tmp1, tmp2; - this->zVelocity = Q_16_16(1.75); - tmp = sub_0804A024(this, 1, 8); + super->zVelocity = Q_16_16(1.75); + tmp = sub_0804A024(super, 1, 8); if (tmp != 0xff && (Random() & 3) == 0) { - this->timer = Random() & 3; - this->direction = DirectionRound(tmp); + super->timer = Random() & 3; + super->direction = DirectionRound(tmp); } else { - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; return; } - this->timer = Random() & 3; - if (sub_08049FA0(this) == 0 && (Random() & 3)) { - tmp1 = sub_08049EE4(this); + super->timer = Random() & 3; + if (sub_08049FA0(super) == 0 && (Random() & 3)) { + tmp1 = sub_08049EE4(super); tmp2 = Random() & 8; tmp2 += 0xfc; - this->direction = DirectionRound(tmp1 + tmp2); + super->direction = DirectionRound(tmp1 + tmp2); } else { - this->direction = DirectionRound(Random()); + super->direction = DirectionRound(Random()); } } } diff --git a/src/enemy/flyingPot.c b/src/enemy/flyingPot.c index 1b628d71..d69ca000 100644 --- a/src/enemy/flyingPot.c +++ b/src/enemy/flyingPot.c @@ -6,8 +6,8 @@ */ #define NENT_DEPRECATED #include "collision.h" -#include "functions.h" #include "enemy.h" +#include "functions.h" #include "player.h" #include "room.h" diff --git a/src/enemy/flyingSkull.c b/src/enemy/flyingSkull.c index 7897de3a..d7d87212 100644 --- a/src/enemy/flyingSkull.c +++ b/src/enemy/flyingSkull.c @@ -1,7 +1,13 @@ +/** + * @file flyingSkull.c + * @ingroup Enemies + * + * @brief Flying Skull enemy + */ #define NENT_DEPRECATED #include "collision.h" -#include "entity.h" #include "enemy.h" +#include "entity.h" #include "functions.h" #include "hitbox.h" @@ -132,16 +138,16 @@ void sub_08039DD8(FlyingSkullEntity* this) { RegisterCarryEntity(super); } else { if ((gPlayerState.flags & PL_MINISH) == 0) { - Entity* ent = &gPlayerEntity; - if (EntityWithinDistance(super, ent->x.HALF.HI, ent->y.HALF.HI, 0x30)) { + Entity* player = &gPlayerEntity; + if (EntityWithinDistance(super, player->x.HALF.HI, player->y.HALF.HI, 0x30)) { if (super->type == 1) { super->action = 3; super->timer = 30; } else { - ent = CreateEnemy(STALFOS, super->type - 2); - if (ent != NULL) { - ent->type2 = 1; - CopyPosition(super, ent); + player = CreateEnemy(STALFOS, super->type - 2); + if (player != NULL) { + player->type2 = 1; + CopyPosition(super, player); SetTile(this->unk_0x74, COORD_TO_TILE(super), super->collisionLayer); DeleteEntity(super); } diff --git a/src/enemy/ghini.c b/src/enemy/ghini.c index d74709c7..f2749f15 100644 --- a/src/enemy/ghini.c +++ b/src/enemy/ghini.c @@ -4,12 +4,10 @@ * * @brief Ghini enemy */ - #define NENT_DEPRECATED -#include "global.h" +#include "area.h" #include "enemy.h" #include "functions.h" -#include "area.h" #include "physics.h" typedef struct { diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index f28fb1e4..a225996a 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -4,12 +4,10 @@ * * @brief Gibdo enemy */ - #define NENT_DEPRECATED -#include "global.h" #include "enemy.h" -#include "object.h" #include "functions.h" +#include "object.h" typedef struct { Entity base; @@ -409,23 +407,23 @@ void Gibdo_CreateObjects(GibdoEntity* this) { } void Gibdo_MoveObjectsToStalfos(GibdoEntity* this, Entity* that) { - Entity* ent = this->field_0x80; + Entity* entity = this->field_0x80; - if (ent != NULL) { - ent->timer = 15; - ent->parent = that; + if (entity != NULL) { + entity->timer = 15; + entity->parent = that; } - ent = this->field_0x84; - if (ent != NULL) { - ent->timer = 15; - ent->parent = that; + entity = this->field_0x84; + if (entity != NULL) { + entity->timer = 15; + entity->parent = that; } - ent = super->child; - if (ent != NULL) { - ent->timer = 15; - ent->parent = that; + entity = super->child; + if (entity != NULL) { + entity->timer = 15; + entity->parent = that; } } diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index c1a569a3..7047f61a 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -1,10 +1,16 @@ +/** + * @file gleerok.c + * @ingroup Enemies + * + * @brief Gleerok enemy + */ #define NENT_DEPRECATED -#include "entity.h" #include "enemy.h" -#include "player.h" -#include "screen.h" +#include "entity.h" #include "functions.h" #include "object.h" +#include "player.h" +#include "screen.h" typedef struct { union SplitHWord unk0; @@ -19,7 +25,7 @@ typedef struct { /*0x2e*/ u16 filler_2e; /*0x30*/ u8 unk_30[6]; /*0x36*/ u8 filler_36[0x2]; - /*0x38*/ Entity* ent; + /*0x38*/ Entity* entity1; /*0x3c*/ Entity* entities[5]; /*0x50*/ Entity* ent2; } Gleerok_HeapStruct; @@ -485,7 +491,7 @@ void sub_0802D714(GleerokEntity* this) { super->child = enemy; if (enemy) { enemy->parent = super; - heap->ent = super->child; + heap->entity1 = super->child; ((GleerokEntity*)(super->child))->unk_84 = heap; } @@ -612,7 +618,7 @@ void sub_0802D86C(GleerokEntity* this) { super->child = enemy; if (enemy) { enemy->parent = super->parent; - this->unk_84->ent = super->child; + this->unk_84->entity1 = super->child; ((GleerokEntity*)super->child)->unk_84 = this->unk_84; } @@ -633,7 +639,7 @@ void sub_0802D86C(GleerokEntity* this) { if (enemy) { enemy->parent = super->parent; super->timer = this->unk_84->filler[0].unk0.HALF.HI; - this->unk_84->ent = super->child; + this->unk_84->entity1 = super->child; ((GleerokEntity*)super->child)->unk_84 = this->unk_84; } @@ -689,7 +695,7 @@ void sub_0802D86C(GleerokEntity* this) { super->child = CreateEnemy(GLEEROK, 4); if (super->child) { super->child->parent = super->parent; - this->unk_84->ent = super->child; + this->unk_84->entity1 = super->child; ((GleerokEntity*)super->child)->unk_84 = this->unk_84; CopyPosition(super, ((volatile Entity*)super)->child); DeleteThisEntity(); @@ -1097,7 +1103,7 @@ void sub_0802E300(GleerokEntity* this) { u32 index; Gleerok_HeapStruct2* ptr; u8* ptr2; - Entity* ent; + Entity* entity; Gleerok_HeapStruct* heap; if ((this->unk_79 & 0x80) == 0) { this->unk_7c.HALF.LO--; @@ -1144,11 +1150,11 @@ void sub_0802E300(GleerokEntity* this) { super->type2 = 0; *ptr2 = 0; InitializeAnimation(super, 0x4d); - ent = CreateEnemy(GLEEROK, 5); - super->child = ent; + entity = CreateEnemy(GLEEROK, 5); + super->child = entity; if (super->child != NULL) { super->child->parent = super; - heap->ent = super->child; + heap->entity1 = super->child; ((GleerokEntity*)super->child)->unk_84 = heap; } @@ -1368,7 +1374,7 @@ void sub_0802E7E4(Gleerok_HeapStruct* this) { this->entities[i + 1]->spritePriority.b0 = bVar6; } } - this->ent->spritePriority.b0 = 0; + this->entity1->spritePriority.b0 = 0; } else { bVar6 = 5; @@ -1388,7 +1394,7 @@ void sub_0802E7E4(Gleerok_HeapStruct* this) { this->entities[i + 1]->spritePriority.b0 = bVar6; } } - this->ent->spritePriority.b0 = 6; + this->entity1->spritePriority.b0 = 6; } } diff --git a/src/enemy/gyorgChild.c b/src/enemy/gyorgChild.c index 54423715..c7306f5d 100644 --- a/src/enemy/gyorgChild.c +++ b/src/enemy/gyorgChild.c @@ -1,9 +1,14 @@ +/** + * @file gyorgChild.c + * @ingroup Enemies + * + * @brief Gyorg Child enemy + */ #define NENT_DEPRECATED -#include "global.h" -#include "room.h" #include "asm.h" -#include "functions.h" #include "enemy/gyorg.h" +#include "functions.h" +#include "room.h" void GyorgChild_OnTick(GyorgChildEntity*); void GyorgChild_OnCollision(GyorgChildEntity*); diff --git a/src/enemy/gyorgFemale.c b/src/enemy/gyorgFemale.c index 6a8e11d8..394ef46b 100644 --- a/src/enemy/gyorgFemale.c +++ b/src/enemy/gyorgFemale.c @@ -1,3 +1,9 @@ +/** + * @file gyorgFemale.c + * @ingroup Enemies + * + * @brief Gyorg Female enemy + */ #define NENT_DEPRECATED #include "asm.h" #include "collision.h" @@ -51,32 +57,32 @@ void GyorgFemale(Entity* this) { } void GyorgFemale_Setup(GyorgFemaleEntity* this) { - Entity* tmp; + Entity* entity; if (gEntCount > 0x3d) return; - tmp = CreateProjectile(GYORG_TAIL); - tmp->type = 0; - tmp->parent = super; - ((GyorgHeap*)super->myHeap)->tail = (GenericEntity*)tmp; - tmp = CreateEnemy(GYORG_FEMALE_MOUTH, 0); - tmp->parent = super; - ((GyorgHeap*)super->myHeap)->mouth = (GyorgFemaleMouthEntity*)tmp; - tmp = CreateEnemy(GYORG_FEMALE_EYE, 0); - tmp->parent = super; - tmp = CreateEnemy(GYORG_FEMALE_EYE, 1); - tmp->parent = super; - tmp = CreateEnemy(GYORG_FEMALE_EYE, 2); - tmp->parent = super; - tmp = CreateEnemy(GYORG_FEMALE_EYE, 3); - tmp->parent = super; - tmp = CreateEnemy(GYORG_FEMALE_EYE, 4); - tmp->parent = super; - tmp = CreateEnemy(GYORG_FEMALE_EYE, 5); - tmp->parent = super; - tmp = CreateEnemy(GYORG_FEMALE_EYE, 6); - tmp->parent = super; - tmp = CreateEnemy(GYORG_FEMALE_EYE, 7); - tmp->parent = super; + entity = CreateProjectile(GYORG_TAIL); + entity->type = 0; + entity->parent = super; + ((GyorgHeap*)super->myHeap)->tail = (GenericEntity*)entity; + entity = CreateEnemy(GYORG_FEMALE_MOUTH, 0); + entity->parent = super; + ((GyorgHeap*)super->myHeap)->mouth = (GyorgFemaleMouthEntity*)entity; + entity = CreateEnemy(GYORG_FEMALE_EYE, 0); + entity->parent = super; + entity = CreateEnemy(GYORG_FEMALE_EYE, 1); + entity->parent = super; + entity = CreateEnemy(GYORG_FEMALE_EYE, 2); + entity->parent = super; + entity = CreateEnemy(GYORG_FEMALE_EYE, 3); + entity->parent = super; + entity = CreateEnemy(GYORG_FEMALE_EYE, 4); + entity->parent = super; + entity = CreateEnemy(GYORG_FEMALE_EYE, 5); + entity->parent = super; + entity = CreateEnemy(GYORG_FEMALE_EYE, 6); + entity->parent = super; + entity = CreateEnemy(GYORG_FEMALE_EYE, 7); + entity->parent = super; super->action = 1; super->spriteOrientation.flipY = 2; super->spriteRendering.b3 = 2; diff --git a/src/enemy/gyorgFemaleEye.c b/src/enemy/gyorgFemaleEye.c index 5033fdff..0be6a03e 100644 --- a/src/enemy/gyorgFemaleEye.c +++ b/src/enemy/gyorgFemaleEye.c @@ -1,10 +1,15 @@ +/** + * @file gyorgFemaleEye.c + * @ingroup Enemies + * + * @brief Gyorg Female Eye enemy + */ #define NENT_DEPRECATED -#include "global.h" -#include "entity.h" #include "enemy.h" -#include "player.h" -#include "functions.h" #include "enemy/gyorg.h" +#include "entity.h" +#include "functions.h" +#include "player.h" void GyorgFemaleEye_OnTick(GyorgFemaleEyeEntity*); void GyorgFemaleEye_OnCollision(GyorgFemaleEyeEntity*); diff --git a/src/enemy/gyorgFemaleMouth.c b/src/enemy/gyorgFemaleMouth.c index 525eb3be..d9c224f9 100644 --- a/src/enemy/gyorgFemaleMouth.c +++ b/src/enemy/gyorgFemaleMouth.c @@ -1,8 +1,13 @@ +/** + * @file gyorgFemaleMouth.c + * @ingroup Enemies + * + * @brief Gyorg Female Mouth enemy + */ #define NENT_DEPRECATED -#include "global.h" +#include "enemy/gyorg.h" #include "player.h" #include "room.h" -#include "enemy/gyorg.h" extern const Hitbox gUnk_080D28DC; extern const Hitbox gUnk_080D28E4; diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 20f09035..7f2192b1 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -4,15 +4,13 @@ * * @brief Gyorg Male enemy */ - #define NENT_DEPRECATED -#include "global.h" +#include "effects.h" #include "enemy.h" -#include "player.h" +#include "enemy/gyorg.h" #include "fileselect.h" #include "functions.h" -#include "effects.h" -#include "enemy/gyorg.h" +#include "player.h" // todo: wrong types extern void sub_080A1D70(Entity*, u32); diff --git a/src/enemy/gyorgMaleEye.c b/src/enemy/gyorgMaleEye.c index 8f257b7c..2bd7f05d 100644 --- a/src/enemy/gyorgMaleEye.c +++ b/src/enemy/gyorgMaleEye.c @@ -4,12 +4,10 @@ * * @brief GyorgMaleEye enemy */ - #define NENT_DEPRECATED -#include "global.h" #include "enemy.h" -#include "functions.h" #include "fade.h" +#include "functions.h" typedef struct { /*0x00*/ Entity base; diff --git a/src/enemy/hangingSeed.c b/src/enemy/hangingSeed.c index 3c6dbdab..2328d5f9 100644 --- a/src/enemy/hangingSeed.c +++ b/src/enemy/hangingSeed.c @@ -4,9 +4,9 @@ * * @brief Hanging Seed enemy */ - -#include "entity.h" +#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" #include "functions.h" extern void (*const HangingSeed_Functions[])(Entity*); diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 18976674..35fb249e 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -4,317 +4,324 @@ * * @brief Helmasaur enemy */ - -#include "enemy.h" -#include "object.h" -#include "functions.h" +#define NENT_DEPRECATED #include "collision.h" +#include "enemy.h" +#include "functions.h" +#include "object.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; +} HelmasaurEntity; extern u32 sub_0804A024(Entity*, u32, u32); -void sub_0802C18C(Entity*); -void sub_0802C218(Entity*); -void sub_0802C1C0(Entity*); -u32 sub_0802C020(Entity*); -void sub_0802C058(Entity*, u32); -bool32 sub_0802C06C(Entity*); -void sub_0802C1CC(Entity*); -bool32 sub_0802C0E8(Entity*); +void sub_0802C18C(HelmasaurEntity*); +void sub_0802C218(HelmasaurEntity*); +void sub_0802C1C0(HelmasaurEntity*); +u32 sub_0802C020(HelmasaurEntity*); +void sub_0802C058(HelmasaurEntity*, u32); +bool32 sub_0802C06C(HelmasaurEntity*); +void sub_0802C1CC(HelmasaurEntity*); +bool32 sub_0802C0E8(HelmasaurEntity*); -extern void (*const Helmasaur_Functions[])(Entity*); -extern void (*const gUnk_080CD3FC[])(Entity*); -extern void (*const gUnk_080CD408[])(Entity*); -extern void (*const gUnk_080CD42C[])(Entity*); -extern void (*const gUnk_080CD438[])(Entity*); -extern void (*const gUnk_080CD450[])(Entity*); +extern void (*const Helmasaur_Functions[])(HelmasaurEntity*); +extern void (*const gUnk_080CD3FC[])(HelmasaurEntity*); +extern void (*const gUnk_080CD408[])(HelmasaurEntity*); +extern void (*const gUnk_080CD42C[])(HelmasaurEntity*); +extern void (*const gUnk_080CD438[])(HelmasaurEntity*); +extern void (*const gUnk_080CD450[])(HelmasaurEntity*); extern const s8 gUnk_080CD45C[]; extern const s8 gUnk_080CD464[]; -void Helmasaur(Entity* this) { - if (this->type == 0) { - EnemyFunctionHandler(this, Helmasaur_Functions); - SetChildOffset(this, 0, 1, -0x10); +void Helmasaur(HelmasaurEntity* this) { + if (super->type == 0) { + EnemyFunctionHandler(super, (EntityActionArray)Helmasaur_Functions); + SetChildOffset(super, 0, 1, -0x10); } else { - gUnk_080CD3FC[this->action](this); + gUnk_080CD3FC[super->action](this); } } -void Helmasaur_OnTick(Entity* this) { - gUnk_080CD408[this->action](this); +void Helmasaur_OnTick(HelmasaurEntity* this) { + gUnk_080CD408[super->action](this); } -void Helmasaur_OnCollision(Entity* this) { - if (this->hitType != 0x19) { - switch (this->contactFlags & 0x7f) { +void Helmasaur_OnCollision(HelmasaurEntity* this) { + if (super->hitType != 0x19) { + switch (super->contactFlags & 0x7f) { case 0: case 2: case 3: - if (this->action == 4) { - this->knockbackDuration = 0; + if (super->action == 4) { + super->knockbackDuration = 0; sub_0802C218(this); } break; } } - if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); + if (super->confusedTime != 0) { + Create0x68FX(super, FX_STARS); } - EnemyFunctionHandlerAfterCollision(this, Helmasaur_Functions); + EnemyFunctionHandlerAfterCollision(super, Helmasaur_Functions); } -void Helmasaur_OnGrabbed(Entity* this) { - if (this->hitType != 0x19) { - if (sub_0806F520(this)) { - gUnk_080CD42C[this->subAction](this); +void Helmasaur_OnGrabbed(HelmasaurEntity* this) { + if (super->hitType != 0x19) { + if (sub_0806F520(super)) { + gUnk_080CD42C[super->subAction](this); } - } else if (2 < this->subAction || sub_0806F520(this)) { - gUnk_080CD438[this->subAction](this); + } else if (2 < super->subAction || sub_0806F520(super)) { + gUnk_080CD438[super->subAction](this); } } -void sub_0802BC74(Entity* this) { +void sub_0802BC74(HelmasaurEntity* this) { sub_0802C1C0(this); - this->subAction = 1; - this->gustJarTolerance = 60; - this->animationState = AnimationStateFlip90(gPlayerEntity.animationState >> 1); - InitializeAnimation(this, this->animationState); + super->subAction = 1; + super->gustJarTolerance = 60; + super->animationState = AnimationStateFlip90(gPlayerEntity.animationState >> 1); + InitializeAnimation(super, super->animationState); } -void sub_0802BCA0(Entity* this) { - sub_0806F4E8(this); +void sub_0802BCA0(HelmasaurEntity* this) { + sub_0806F4E8(super); } -void sub_0802BCA8(Entity* this) { - if (this->hitType != 0x19) { - Entity* ent; +void sub_0802BCA8(HelmasaurEntity* this) { + if (super->hitType != 0x19) { + Entity* entity; - this->action = 7; - this->timer = 90; - this->zVelocity = Q_16_16(1.5); - this->hitType = 0x19; - this->gustJarState = this->gustJarState & 0xfb; - this->gustJarFlags = 0x12; - ent = CreateEnemy(HELMASAUR, 1); - if (ent != NULL) { - ent->animationState = this->animationState; - CopyPosition(this, ent); + super->action = 7; + super->timer = 90; + super->zVelocity = Q_16_16(1.5); + super->hitType = 0x19; + super->gustJarState = super->gustJarState & 0xfb; + super->gustJarFlags = 0x12; + entity = CreateEnemy(HELMASAUR, 1); + if (entity != NULL) { + entity->animationState = super->animationState; + CopyPosition(super, entity); } - InitializeAnimation(this, this->animationState + 4); + InitializeAnimation(super, super->animationState + 4); } } -void sub_0802BCFC(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 60; +void sub_0802BCFC(HelmasaurEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 60; } -void sub_0802BD08(Entity* this) { - sub_0806F3E4(this); +void sub_0802BD08(HelmasaurEntity* this) { + sub_0806F3E4(super); } -void sub_0802BD10(Entity* this) { - COLLISION_OFF(this); - UpdateAnimationVariableFrames(this, 2); +void sub_0802BD10(HelmasaurEntity* this) { + COLLISION_OFF(super); + UpdateAnimationVariableFrames(super, 2); } -void nullsub_145(Entity* this) { +void nullsub_145(HelmasaurEntity* this) { /* ... */ } -void sub_0802BD28(Entity* this) { - if (this->flags & ENT_COLLIDE) { - COLLISION_ON(this); - this->gustJarState &= ~0x4; +void sub_0802BD28(HelmasaurEntity* this) { + if (super->flags & ENT_COLLIDE) { + COLLISION_ON(super); + super->gustJarState &= ~0x4; } else { - this->health = 0; + super->health = 0; } } -void sub_0802BD54(Entity* this) { - sub_0804A720(this); - this->action = 1; - this->field_0x78.HALF.LO = Random(); - this->gustJarTolerance = 60; - this->field_0x78.HALF.HI = 0xff; - this->direction = DirectionRound(Random()); - this->animationState = this->direction >> 3; - InitializeAnimation(this, this->animationState); +void sub_0802BD54(HelmasaurEntity* this) { + sub_0804A720(super); + super->action = 1; + this->unk_78 = Random(); + super->gustJarTolerance = 60; + this->unk_79 = 0xff; + super->direction = DirectionRound(Random()); + super->animationState = super->direction >> 3; + InitializeAnimation(super, super->animationState); } -void sub_0802BD8C(Entity* this) { - if (this->timer) { - this->timer--; +void sub_0802BD8C(HelmasaurEntity* this) { + if (super->timer) { + super->timer--; } else { u32 direction; - if (sub_08049FDC(this, 1)) { - direction = sub_0804A024(this, 1, 0x10); - if (direction != 0xff && direction != this->field_0x78.HALF.HI) { + if (sub_08049FDC(super, 1)) { + direction = sub_0804A024(super, 1, 0x10); + if (direction != 0xff && direction != this->unk_79) { sub_0802C058(this, direction); return; } } direction = sub_0802C020(this); - if (direction != this->direction) { + if (direction != super->direction) { sub_0802C058(this, direction); } } } -void sub_0802BDE0(Entity* this) { +void sub_0802BDE0(HelmasaurEntity* this) { if (sub_0802C06C(this)) { - this->action = 3; - this->timer = 60; - this->field_0x78.HALF.HI = 0xff; + super->action = 3; + super->timer = 60; + this->unk_79 = 0xff; } else { - this->action = 1; - this->timer = (Random() & 0xf) + 15; - this->field_0x78.HALF.HI = this->direction; + super->action = 1; + super->timer = (Random() & 0xf) + 15; + this->unk_79 = super->direction; } } -void sub_0802BE18(Entity* this) { - UpdateAnimationVariableFrames(this, 2); - if (--this->timer == 0) { - this->action = 4; - this->timer = 30; - this->speed = 0x300; +void sub_0802BE18(HelmasaurEntity* this) { + UpdateAnimationVariableFrames(super, 2); + if (--super->timer == 0) { + super->action = 4; + super->timer = 30; + super->speed = 0x300; } else { sub_0802C18C(this); } } -void sub_0802BE48(Entity* this) { - if (!ProcessMovement2(this)) { +void sub_0802BE48(HelmasaurEntity* this) { + if (!ProcessMovement2(super)) { sub_0802C218(this); InitScreenShake(8, 0); } else { - GetNextFrame(this); + GetNextFrame(super); sub_0802C1CC(this); if (sub_0802C0E8(this)) { - this->action = 5; + super->action = 5; } } } -void sub_0802BE80(Entity* this) { - this->speed -= 0x20; - if (0xff < this->speed) { +void sub_0802BE80(HelmasaurEntity* this) { + super->speed -= 0x20; + if (0xff < super->speed) { sub_0802C1CC(this); } - if (this->speed > 0) { - ProcessMovement2(this); + if (super->speed > 0) { + ProcessMovement2(super); sub_0802C18C(this); } else { sub_0802C1C0(this); - this->timer += 30; + super->timer += 30; } } -void sub_0802BEBC(Entity* this) { - this->direction ^= 0x10; - ProcessMovement2(this); - this->direction ^= 0x10; - if (!sub_080044EC(this, Q_16_16(0.125))) { +void sub_0802BEBC(HelmasaurEntity* this) { + super->direction ^= 0x10; + ProcessMovement2(super); + super->direction ^= 0x10; + if (!sub_080044EC(super, Q_16_16(0.125))) { sub_0802C1C0(this); } } -void sub_0802BEEC(Entity* this) { - if (this->timer != 0) { - if ((--this->timer & 0x1F) == 0) { - this->animationState ^= 2; - this->direction = this->animationState << 3; - InitializeAnimation(this, this->animationState + 4); +void sub_0802BEEC(HelmasaurEntity* this) { + if (super->timer != 0) { + if ((--super->timer & 0x1F) == 0) { + super->animationState ^= 2; + super->direction = super->animationState << 3; + InitializeAnimation(super, super->animationState + 4); } - } else if (!GravityUpdate(this, Q_8_8(28.0))) { - this->action = 8; - this->timer = 30; - this->speed = 0x120; + } else if (!GravityUpdate(super, Q_8_8(28.0))) { + super->action = 8; + super->timer = 30; + super->speed = 0x120; } } -void sub_0802BF3C(Entity* this) { - ProcessMovement0(this); - GetNextFrame(this); - if (--this->timer == 0) { +void sub_0802BF3C(HelmasaurEntity* this) { + ProcessMovement0(super); + GetNextFrame(super); + if (--super->timer == 0) { u32 sprite; - this->timer = 30; - this->direction = sub_0802C020(this); - sprite = this->direction >> 3; - if (sprite != this->animationState) { - this->animationState = sprite; - InitializeAnimation(this, sprite + 4); + super->timer = 30; + super->direction = sub_0802C020(this); + sprite = super->direction >> 3; + if (sprite != super->animationState) { + super->animationState = sprite; + InitializeAnimation(super, sprite + 4); } } } -void sub_0802BF78(Entity* this) { - this->action = 1; - this->flags2 = 4; - this->gustJarFlags = 1; - this->direction = this->animationState << 3; - InitializeAnimation(this, this->animationState + 8); +void sub_0802BF78(HelmasaurEntity* this) { + super->action = 1; + super->flags2 = 4; + super->gustJarFlags = 1; + super->direction = super->animationState << 3; + InitializeAnimation(super, super->animationState + 8); } -void sub_0802BF98(Entity* this) { - if (sub_0806F520(this)) { - gUnk_080CD450[this->subAction](this); +void sub_0802BF98(HelmasaurEntity* this) { + if (sub_0806F520(super)) { + gUnk_080CD450[super->subAction](this); } else { - this->action = 2; - this->timer = 30; - COLLISION_OFF(this); + super->action = 2; + super->timer = 30; + COLLISION_OFF(super); } } -void sub_0802BFD0(Entity* this) { - this->subAction = 2; +void sub_0802BFD0(HelmasaurEntity* this) { + super->subAction = 2; } -void sub_0802BFD8(Entity* this) { - sub_0806F4E8(this); +void sub_0802BFD8(HelmasaurEntity* this) { + sub_0806F4E8(super); } -void sub_0802BFE0(Entity* this) { - if (sub_0806F3E4(this)) { - DeleteEntity(this); +void sub_0802BFE0(HelmasaurEntity* this) { + if (sub_0806F3E4(super)) { + DeleteEntity(super); } } -void sub_0802BFF4(Entity* this) { - this->spriteSettings.draw ^= 1; - if (--this->timer == 0) { - DeleteEntity(this); +void sub_0802BFF4(HelmasaurEntity* this) { + super->spriteSettings.draw ^= 1; + if (--super->timer == 0) { + DeleteEntity(super); } } -u32 sub_0802C020(Entity* this) { +u32 sub_0802C020(HelmasaurEntity* this) { u32 uVar1 = Random(); - if (sub_08049FA0(this) || (uVar1 & 1)) + if (sub_08049FA0(super) || (uVar1 & 1)) return DirectionRound(uVar1); - return (sub_08049EE4(this) + (uVar1 >> 0x10 & 1) * 4) & 0x18; + return (sub_08049EE4(super) + (uVar1 >> 0x10 & 1) * 4) & 0x18; } -void sub_0802C058(Entity* this, u32 param_2) { - this->action = 2; - this->direction = param_2; - this->animationState = param_2 >> 3; - InitializeAnimation(this, this->animationState); +void sub_0802C058(HelmasaurEntity* this, u32 param_2) { + super->action = 2; + super->direction = param_2; + super->animationState = param_2 >> 3; + InitializeAnimation(super, super->animationState); } -bool32 sub_0802C06C(Entity* this) { - u32 x = this->x.HALF.HI + this->hitbox->offset_x; - u32 y = this->y.HALF.HI + this->hitbox->offset_y; - u32 xdiff = gUnk_080CD45C[(this->direction >> 2) + 0]; - u32 ydiff = gUnk_080CD45C[(this->direction >> 2) + 1]; +bool32 sub_0802C06C(HelmasaurEntity* this) { + u32 x = super->x.HALF.HI + super->hitbox->offset_x; + u32 y = super->y.HALF.HI + super->hitbox->offset_y; + u32 xdiff = gUnk_080CD45C[(super->direction >> 2) + 0]; + u32 ydiff = gUnk_080CD45C[(super->direction >> 2) + 1]; - u8* layer = this->collisionLayer == 2 ? gMapTop.collisionData : gMapBottom.collisionData; + u8* layer = super->collisionLayer == 2 ? gMapTop.collisionData : gMapBottom.collisionData; u32 i; for (i = 0; i < 8; i++) { @@ -329,15 +336,15 @@ bool32 sub_0802C06C(Entity* this) { bool32 sub_0806FC24(u32, u32); -bool32 sub_0802C0E8(Entity* this) { - if (--this->timer == 0) { +bool32 sub_0802C0E8(HelmasaurEntity* this) { + if (--super->timer == 0) { return TRUE; } else { - const s8* ptr = &gUnk_080CD45C[this->direction >> 2]; - s32 x = this->x.HALF.HI + this->hitbox->offset_x + ptr[0] * 6; - s32 y = this->y.HALF.HI + this->hitbox->offset_y + ptr[1] * 6; + const s8* ptr = &gUnk_080CD45C[super->direction >> 2]; + s32 x = super->x.HALF.HI + super->hitbox->offset_x + ptr[0] * 6; + s32 y = super->y.HALF.HI + super->hitbox->offset_y + ptr[1] * 6; - u8* layer = this->collisionLayer == 2 ? gMapTop.collisionData : gMapBottom.collisionData; + u8* layer = super->collisionLayer == 2 ? gMapTop.collisionData : gMapBottom.collisionData; u32 ret = FALSE; if (!sub_0806FC24(TILE(x, y), 9)) { if (IsTileCollision(layer, x, y, 0)) { @@ -350,50 +357,50 @@ bool32 sub_0802C0E8(Entity* this) { } } -void sub_0802C18C(Entity* this) { - this->field_0x78.HALF.LO--; - if ((this->field_0x78.HALF.LO & 7) == 0) { - Entity* ent = CreateObject(SPECIAL_FX, FX_DASH, 0x40); - if (ent != NULL) { - PositionRelative(this, ent, 0, Q_16_16(1.0)); +void sub_0802C18C(HelmasaurEntity* this) { + this->unk_78--; + if ((this->unk_78 & 7) == 0) { + Entity* entity = CreateObject(SPECIAL_FX, FX_DASH, 0x40); + if (entity != NULL) { + PositionRelative(super, entity, 0, Q_16_16(1.0)); } } } -void sub_0802C1C0(Entity* this) { - this->action = 1; - this->timer = 30; +void sub_0802C1C0(HelmasaurEntity* this) { + super->action = 1; + super->timer = 30; } -void sub_0802C1CC(Entity* this) { - const s8* ptr = &gUnk_080CD464[this->animationState << 2]; - sub_08008796(this, 9, this->x.HALF.HI + ptr[0], this->y.HALF.HI + ptr[1]); - sub_08008796(this, 9, this->x.HALF.HI + ptr[2], this->y.HALF.HI + ptr[3]); +void sub_0802C1CC(HelmasaurEntity* this) { + const s8* ptr = &gUnk_080CD464[super->animationState << 2]; + sub_08008796(super, 9, super->x.HALF.HI + ptr[0], super->y.HALF.HI + ptr[1]); + sub_08008796(super, 9, super->x.HALF.HI + ptr[2], super->y.HALF.HI + ptr[3]); } -void sub_0802C218(Entity* this) { - this->action = 6; - this->speed = Q_8_8(0.875); - this->zVelocity = Q_16_16(1.5); +void sub_0802C218(HelmasaurEntity* this) { + super->action = 6; + super->speed = Q_8_8(0.875); + super->zVelocity = Q_16_16(1.5); } // clang-format off -void (*const Helmasaur_Functions[])(Entity*) = { +void (*const Helmasaur_Functions[])(HelmasaurEntity*) = { Helmasaur_OnTick, Helmasaur_OnCollision, - GenericKnockback, - GenericDeath, - GenericConfused, + (void (*)(HelmasaurEntity*))GenericKnockback, + (void (*)(HelmasaurEntity*))GenericDeath, + (void (*)(HelmasaurEntity*))GenericConfused, Helmasaur_OnGrabbed, }; -void (*const gUnk_080CD3FC[])(Entity*) = { +void (*const gUnk_080CD3FC[])(HelmasaurEntity*) = { sub_0802BF78, sub_0802BF98, sub_0802BFF4, }; -void (*const gUnk_080CD408[])(Entity*) = { +void (*const gUnk_080CD408[])(HelmasaurEntity*) = { sub_0802BD54, sub_0802BD8C, sub_0802BDE0, @@ -405,13 +412,13 @@ void (*const gUnk_080CD408[])(Entity*) = { sub_0802BF3C, }; -void (*const gUnk_080CD42C[])(Entity*) = { +void (*const gUnk_080CD42C[])(HelmasaurEntity*) = { sub_0802BC74, sub_0802BCA0, sub_0802BCA8, }; -void (*const gUnk_080CD438[])(Entity*) = { +void (*const gUnk_080CD438[])(HelmasaurEntity*) = { sub_0802BCFC, sub_0802BCA0, sub_0802BD08, @@ -420,7 +427,7 @@ void (*const gUnk_080CD438[])(Entity*) = { sub_0802BD28, }; -void (*const gUnk_080CD450[])(Entity*) = { +void (*const gUnk_080CD450[])(HelmasaurEntity*) = { sub_0802BFD0, sub_0802BFD8, sub_0802BFE0, diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c index 3ef48b9e..ee1d0b93 100644 --- a/src/enemy/keaton.c +++ b/src/enemy/keaton.c @@ -4,206 +4,216 @@ * * @brief keaton enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" -extern Entity* gUnk_020000B0; -void Keaton_OnTick(Entity*); -void Keaton_OnCollision(Entity*); -void Keaton_OnGrabbed(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*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u16 unk_74; + /*0x76*/ u16 unk_76; + /*0x78*/ u16 unk_78; + /*0x7a*/ u8 unused2[1]; + /*0x7b*/ u8 unk_7b; +} KeatonEntity; -static void (*const Keaton_Functions[])(Entity*) = { - Keaton_OnTick, Keaton_OnCollision, GenericKnockback, GenericDeath, GenericConfused, Keaton_OnGrabbed, +extern Entity* gUnk_020000B0; +void Keaton_OnTick(KeatonEntity*); +void Keaton_OnCollision(KeatonEntity*); +void Keaton_OnGrabbed(KeatonEntity*); +void Keaton_Init(KeatonEntity*); +void Keaton_Action1(KeatonEntity*); +void Keaton_Action2(KeatonEntity*); +void Keaton_Action3(KeatonEntity*); +void Keaton_Action4(KeatonEntity*); +void Keaton_Action5(KeatonEntity*); + +static void (*const Keaton_Functions[])(KeatonEntity*) = { + Keaton_OnTick, Keaton_OnCollision, (void (*)(KeatonEntity*))GenericKnockback, (void (*)(KeatonEntity*))GenericDeath, (void (*)(KeatonEntity*))GenericConfused, Keaton_OnGrabbed, }; -bool32 sub_080325E8(Entity* this); -void sub_08032650(Entity* this); -void sub_0803269C(Entity* this, u32 direction); -void sub_080326FC(Entity* this); -bool32 sub_0803271C(Entity* this); -void sub_08032740(Entity* this); -void sub_0803275C(Entity* this); -void sub_08032784(Entity* this); -void sub_08032794(Entity* this); -void sub_080327C8(Entity* this); -void sub_080327E0(Entity* this); +bool32 sub_080325E8(KeatonEntity* this); +void sub_08032650(KeatonEntity* this); +void sub_0803269C(KeatonEntity* this, u32 direction); +void sub_080326FC(KeatonEntity* this); +bool32 sub_0803271C(KeatonEntity* this); +void sub_08032740(KeatonEntity* this); +void sub_0803275C(KeatonEntity* this); +void sub_08032784(KeatonEntity* this); +void sub_08032794(KeatonEntity* this); +void sub_080327C8(KeatonEntity* this); +void sub_080327E0(KeatonEntity* this); -void Keaton(Entity* this) { - EnemyFunctionHandler(this, Keaton_Functions); - SetChildOffset(this, 0, 1, -18); +void Keaton(KeatonEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)Keaton_Functions); + SetChildOffset(super, 0, 1, -18); } -void Keaton_OnTick(Entity* this) { - static void (*const Keaton_Actions[])(Entity*) = { +void Keaton_OnTick(KeatonEntity* this) { + static void (*const Keaton_Actions[])(KeatonEntity*) = { Keaton_Init, Keaton_Action1, Keaton_Action2, Keaton_Action3, Keaton_Action4, Keaton_Action5, }; - Keaton_Actions[this->action](this); + Keaton_Actions[super->action](this); } -void Keaton_OnCollision(Entity* this) { +void Keaton_OnCollision(KeatonEntity* this) { u32 var; - if (this->action != 3 && this->action != 4) { - this->action = 3; - this->timer = 12; - this->direction = DirectionTurnAround(DirectionRoundUp(this->knockbackDirection)); - InitAnimationForceUpdate(this, this->direction >> 3); - } else if (this->contactFlags == 0xCC) { - if (this->confusedTime == 0) { + if (super->action != 3 && super->action != 4) { + super->action = 3; + super->timer = 12; + super->direction = DirectionTurnAround(DirectionRoundUp(super->knockbackDirection)); + InitAnimationForceUpdate(super, super->direction >> 3); + } else if (super->contactFlags == 0xCC) { + if (super->confusedTime == 0) { sub_0803275C(this); } } - if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); + if (super->confusedTime != 0) { + Create0x68FX(super, FX_STARS); } - EnemyFunctionHandlerAfterCollision(this, Keaton_Functions); + EnemyFunctionHandlerAfterCollision(super, Keaton_Functions); } -void Keaton_OnGrabbed(Entity* this) { +void Keaton_OnGrabbed(KeatonEntity* this) { } -void Keaton_Init(Entity* this) { - sub_0804A720(this); - this->animationState = 0; - InitAnimationForceUpdate(this, 0); +void Keaton_Init(KeatonEntity* this) { + sub_0804A720(super); + super->animationState = 0; + InitAnimationForceUpdate(super, 0); sub_080326FC(this); sub_08032740(this); } -void Keaton_Action1(Entity* this) { +void Keaton_Action1(KeatonEntity* this) { if (!sub_080325E8(this) && !sub_0803271C(this)) { - this->timer--; - if (this->timer == 0) { + super->timer--; + if (super->timer == 0) { sub_08032650(this); } - if (!ProcessMovement0(this)) { - this->timer = 1; + if (!ProcessMovement0(super)) { + super->timer = 1; } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } -void Keaton_Action2(Entity* this) { +void Keaton_Action2(KeatonEntity* this) { if (!sub_080325E8(this)) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { sub_080326FC(this); sub_08032740(this); } } } -void Keaton_Action3(Entity* this) { - if (this->timer != 0) { - this->timer--; - if (this->timer == 0) { - this->subtimer = 30; - this->animationState = this->direction / 8; - InitAnimationForceUpdate(this, this->animationState + 4); +void Keaton_Action3(KeatonEntity* this) { + if (super->timer != 0) { + super->timer--; + if (super->timer == 0) { + super->subtimer = 30; + super->animationState = super->direction / 8; + InitAnimationForceUpdate(super, super->animationState + 4); } else { return; } } - UpdateAnimationSingleFrame(this); - UpdateAnimationSingleFrame(this); - this->subtimer--; - if (this->subtimer == 0) { - this->action = 4; - this->speed = 0x1E0; - this->field_0x76.HWORD = 0x46; - this->field_0x78.HWORD = 0; - *(((u8*)&this->field_0x7a) + 1) = 0; + UpdateAnimationSingleFrame(super); + UpdateAnimationSingleFrame(super); + super->subtimer--; + if (super->subtimer == 0) { + super->action = 4; + super->speed = 0x1E0; + this->unk_76 = 0x46; + this->unk_78 = 0; + this->unk_7b = 0; sub_080327C8(this); } else { - if ((this->subtimer & 0x3) == 0) { + if ((super->subtimer & 0x3) == 0) { sub_08032794(this); } } } -void Keaton_Action4(Entity* this) { - if (this->child && (this->child->contactFlags & 0x80)) { +void Keaton_Action4(KeatonEntity* this) { + if (super->child && (super->child->contactFlags & 0x80)) { sub_0803275C(this); return; } - if (--this->field_0x76.HWORD == 0 || !ProcessMovement2(this)) { + if (--this->unk_76 == 0 || !ProcessMovement2(super)) { sub_0803275C(this); return; } - UpdateAnimationSingleFrame(this); - if ((this->field_0x76.HWORD & 0x7) == 0) { + UpdateAnimationSingleFrame(super); + if ((this->unk_76 & 0x7) == 0) { sub_08032794(this); } } -void Keaton_Action5(Entity* this) { - this->timer--; - if ((this->timer == 0) && !sub_080325E8(this)) { +void Keaton_Action5(KeatonEntity* this) { + super->timer--; + if ((super->timer == 0) && !sub_080325E8(this)) { sub_08032784(this); } } -u32 sub_080325E8(Entity* this) { - if ((sub_08049FA0(this) && sub_08049FDC(this, 1)) && (EntityInRectRadius(this, gUnk_020000B0, 0x68, 0x40) != 0)) { - if (((GetFacingDirection(this, gUnk_020000B0) - (DirectionRound(this->frame)) + 2) & 0x1F) < 5) { - this->action = 3; - this->timer = 12; - this->direction = DirectionRound(this->frame); +u32 sub_080325E8(KeatonEntity* this) { + if ((sub_08049FA0(super) && sub_08049FDC(super, 1)) && (EntityInRectRadius(super, gUnk_020000B0, 0x68, 0x40) != 0)) { + if (((GetFacingDirection(super, gUnk_020000B0) - (DirectionRound(super->frame)) + 2) & 0x1F) < 5) { + super->action = 3; + super->timer = 12; + super->direction = DirectionRound(super->frame); return TRUE; } } return FALSE; } -void sub_08032650(Entity* this) { +void sub_08032650(KeatonEntity* this) { static const u8 gUnk_080CE7E0[] = { 60, 60, 90, 90, 90, 90, 120, 120, 120, 120, 120, 120, 120, 120, 150, 150 }; u32 rand = Random(); - this->timer = gUnk_080CE7E0[rand & 0xF]; - if (!((sub_08049FA0(this) == 0) && ((rand >> 8 & 1) == 0))) { - this->direction = DirectionRound(rand >> 0x10); + super->timer = gUnk_080CE7E0[rand & 0xF]; + if (!((sub_08049FA0(super) == 0) && ((rand >> 8 & 1) == 0))) { + super->direction = DirectionRound(rand >> 0x10); } else { - this->direction = DirectionRoundUp(sub_08049EE4(this)); + super->direction = DirectionRoundUp(sub_08049EE4(super)); } - sub_0803269C(this, this->direction); + sub_0803269C(this, super->direction); } -void sub_0803269C(Entity* this, u32 direction) { +void sub_0803269C(KeatonEntity* this, u32 direction) { u32 uVar1; if (((direction - 3) & 7) < 3) { uVar1 = DirectionToAnimationState(direction); - if (((this->animationState - uVar1) & 3) > 1) { - this->animationState = uVar1; - InitAnimationForceUpdate(this, (this->animIndex & 0xFC) + uVar1); + if (((super->animationState - uVar1) & 3) > 1) { + super->animationState = uVar1; + InitAnimationForceUpdate(super, (super->animIndex & 0xFC) + uVar1); } } else { uVar1 = DirectionToAnimationState(direction); - if (uVar1 != this->animationState) { - this->animationState = uVar1; - InitAnimationForceUpdate(this, (this->animIndex & 0xFC) + uVar1); + if (uVar1 != super->animationState) { + super->animationState = uVar1; + InitAnimationForceUpdate(super, (super->animIndex & 0xFC) + uVar1); } } } -void sub_080326FC(Entity* this) { +void sub_080326FC(KeatonEntity* this) { static const u16 gUnk_080CE7F0[] = { 0xd2, 0xd2, 0xf0, 0xf0, 0x10e, 0x10e, 0x10e, 0x10e, 0x12c, 0x12c, 0x12c, 0x12c, 0x12c, 0x12c, 0x12c, 0x12c }; - this->field_0x74.HWORD = gUnk_080CE7F0[Random() & 0xF]; + this->unk_74 = gUnk_080CE7F0[Random() & 0xF]; } -bool32 sub_0803271C(Entity* this) { - this->field_0x74.HWORD--; - if (this->field_0x74.HWORD == 0) { +bool32 sub_0803271C(KeatonEntity* this) { + this->unk_74--; + if (this->unk_74 == 0) { sub_08032784(this); return TRUE; } else { @@ -211,52 +221,52 @@ bool32 sub_0803271C(Entity* this) { } } -void sub_08032740(Entity* this) { - this->action = 1; - this->speed = 0x80; - InitializeAnimation(this, this->animationState); +void sub_08032740(KeatonEntity* this) { + super->action = 1; + super->speed = 0x80; + InitializeAnimation(super, super->animationState); sub_08032650(this); } -void sub_0803275C(Entity* this) { - this->action = 5; - this->timer = 45; - this->speed = 0x80; - InitAnimationForceUpdate(this, this->animationState); - sub_0803269C(this, this->direction); +void sub_0803275C(KeatonEntity* this) { + super->action = 5; + super->timer = 45; + super->speed = 0x80; + InitAnimationForceUpdate(super, super->animationState); + sub_0803269C(this, super->direction); sub_080327E0(this); } -void sub_08032784(Entity* this) { - this->action = 2; - InitAnimationForceUpdate(this, this->animationState + 8); +void sub_08032784(KeatonEntity* this) { + super->action = 2; + InitAnimationForceUpdate(super, super->animationState + 8); } -void sub_08032794(Entity* this) { +void sub_08032794(KeatonEntity* this) { Entity* target; const s8* temp; static const s8 gUnk_080CE810[] = { 0, 2, -4, 0, 0, -11, 4, 0 }; - target = CreateFx(this, FX_DASH, 0x40); + target = CreateFx(super, FX_DASH, 0x40); if (target != NULL) { - temp = &gUnk_080CE810[this->animationState * 2]; - PositionRelative(this, target, Q_16_16(temp[0]), Q_16_16(temp[1])); + temp = &gUnk_080CE810[super->animationState * 2]; + PositionRelative(super, target, Q_16_16(temp[0]), Q_16_16(temp[1])); } } -void sub_080327C8(Entity* this) { +void sub_080327C8(KeatonEntity* this) { Entity* child; - child = CreateProjectileWithParent(this, KEATON_DAGGER, 0); + child = CreateProjectileWithParent(super, KEATON_DAGGER, 0); if (child != NULL) { - child->parent = this; - this->child = child; + child->parent = super; + super->child = child; } } -void sub_080327E0(Entity* this) { - if (this->child != NULL) { - this->child->parent = NULL; - this->child = NULL; +void sub_080327E0(KeatonEntity* this) { + if (super->child != NULL) { + super->child->parent = NULL; + super->child = NULL; } } diff --git a/src/enemy/keese.c b/src/enemy/keese.c index 0a6b0d1f..467ea0ff 100644 --- a/src/enemy/keese.c +++ b/src/enemy/keese.c @@ -4,7 +4,6 @@ * * @brief Keese enemy */ - #define NENT_DEPRECATED #include "enemy.h" #include "physics.h" diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index e27643cd..6bbc0fee 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -4,23 +4,31 @@ * * @brief Lakitu enemy */ - -#include "global.h" +#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" #include "player.h" -extern void (*const LakituActionFuncs[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u16 unk_74; + /*0x76*/ u16 unk_76; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; +} LakituEntity; + +extern void (*const LakituActionFuncs[])(LakituEntity*); // Forward references to functions in lakitu.c -extern void sub_0803CAD0(Entity*); -extern void sub_0803CBAC(Entity*); -extern void sub_0803CA84(Entity*, u32); -extern bool32 sub_0803CA4C(Entity*); -extern bool32 sub_0803CB04(Entity*); -extern void Lakitu_SpawnLightning(Entity*); -extern void sub_0803CB34(Entity*); -extern void sub_0803CC08(Entity* this); +extern void sub_0803CAD0(LakituEntity* this); +extern void sub_0803CBAC(LakituEntity* this); +extern void sub_0803CA84(LakituEntity* this, u32); +extern bool32 sub_0803CA4C(LakituEntity* this); +extern bool32 sub_0803CB04(LakituEntity* this); +extern void Lakitu_SpawnLightning(LakituEntity* this); +extern void sub_0803CB34(LakituEntity* this); +extern void sub_0803CC08(LakituEntity* this); enum { INIT, @@ -39,36 +47,36 @@ typedef struct { } PACKED OffsetCoords; // Variables -extern void (*const Lakitu_Functions[])(Entity*); -extern void (*const gUnk_080D0128[])(Entity*); -extern void (*const gUnk_080D0148[])(Entity*); +extern void (*const Lakitu_Functions[])(LakituEntity*); +extern void (*const gUnk_080D0128[])(LakituEntity*); +extern void (*const gUnk_080D0148[])(LakituEntity*); extern const OffsetCoords gUnk_080D0154[]; -void Lakitu(Entity* this) { - EnemyFunctionHandler(this, Lakitu_Functions); +void Lakitu(LakituEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)Lakitu_Functions); - SetChildOffset(this, 0, 1, -16); + SetChildOffset(super, 0, 1, -16); } -void Lakitu_OnTick(Entity* this) { - if (this->action != 0 && this->action != 7) { +void Lakitu_OnTick(LakituEntity* this) { + if (super->action != 0 && super->action != 7) { sub_0803CAD0(this); } - LakituActionFuncs[this->action](this); + LakituActionFuncs[super->action](this); } -void Lakitu_OnCollision(Entity* this) { - if ((this->contactFlags & 0x7f) == 0x1d) { - this->zVelocity = Q_16_16(2.0); +void Lakitu_OnCollision(LakituEntity* this) { + if ((super->contactFlags & 0x7f) == 0x1d) { + super->zVelocity = Q_16_16(2.0); sub_0803CBAC(this); } else { - if (this->hitType == 0x43) { - Entity* fx = CreateFx(this, FX_DEATH, 0); + if (super->hitType == 0x43) { + Entity* fx = CreateFx(super, FX_DEATH, 0); if (fx != NULL) { - u32 angle = (this->knockbackDirection ^ 0x10) << 3; + u32 angle = (super->knockbackDirection ^ 0x10) << 3; s32 sine; sine = gSineTable[angle]; @@ -88,163 +96,163 @@ void Lakitu_OnCollision(Entity* this) { } } - if (this->confusedTime) { - Create0x68FX(this, FX_STARS); + if (super->confusedTime) { + Create0x68FX(super, FX_STARS); } - EnemyFunctionHandlerAfterCollision(this, Lakitu_Functions); + EnemyFunctionHandlerAfterCollision(super, Lakitu_Functions); } -void Lakitu_OnGrabbed(Entity* this) { - if (sub_0806F520(this)) { - gUnk_080D0148[this->subAction](this); +void Lakitu_OnGrabbed(LakituEntity* this) { + if (sub_0806F520(super)) { + gUnk_080D0148[super->subAction](this); } } -void sub_0803C844(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 0x3c; +void sub_0803C844(LakituEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 0x3c; } -void sub_0803C850(Entity* this) { - Entity* cloud = this->child; +void sub_0803C850(LakituEntity* this) { + Entity* cloud = super->child; if (cloud != NULL) { - cloud->spriteOffsetX = this->spriteOffsetX; + cloud->spriteOffsetX = super->spriteOffsetX; } - sub_0806F4E8(this); + sub_0806F4E8(super); } -void sub_0803C86C(Entity* this) { +void sub_0803C86C(LakituEntity* this) { sub_0803CBAC(this); - this->child = NULL; + super->child = NULL; } -void Lakitu_Initialize(Entity* this) { - Entity* cloud = CreateProjectileWithParent(this, 17, 0); +void Lakitu_Initialize(LakituEntity* this) { + Entity* cloud = CreateProjectileWithParent(super, 17, 0); if (cloud == NULL) { return; } - cloud->parent = this; - this->child = cloud; + cloud->parent = super; + super->child = cloud; - sub_0804A720(this); + sub_0804A720(super); - this->action = HIDDEN; + super->action = HIDDEN; - this->z.HALF.HI = -2; + super->z.HALF.HI = -2; - this->spriteOffsetY = 0xff; + super->spriteOffsetY = 0xff; - this->field_0x74.HWORD = this->x.HALF.HI; - this->field_0x76.HWORD = this->y.HALF.HI; + this->unk_74 = super->x.HALF.HI; + this->unk_76 = super->y.HALF.HI; } -void Lakitu_Hide(Entity* this) { +void Lakitu_Hide(LakituEntity* this) { sub_0803CA84(this, 0); if (sub_0803CA4C(this)) { - this->action = END_HIDE; - this->spriteSettings.draw = 1; + super->action = END_HIDE; + super->spriteSettings.draw = 1; } } -void Lakitu_EndHide(Entity* this) { - UpdateAnimationSingleFrame(this); +void Lakitu_EndHide(LakituEntity* this) { + UpdateAnimationSingleFrame(super); - if (this->frame & ANIM_DONE) { - this->action = IDLE; - this->timer = 60; + if (super->frame & ANIM_DONE) { + super->action = IDLE; + super->timer = 60; - this->hitType = 0x42; + super->hitType = 0x42; - InitAnimationForceUpdate(this, this->animationState + 4); + InitAnimationForceUpdate(super, super->animationState + 4); } } -void Lakitu_Idle(Entity* this) { +void Lakitu_Idle(LakituEntity* this) { if (sub_0803CB04(this)) { return; } if (!sub_0803CA4C(this)) { - this->action = BEGIN_HIDE; + super->action = BEGIN_HIDE; - this->hitType = 0x43; - InitAnimationForceUpdate(this, this->animationState + 0xc); + super->hitType = 0x43; + InitAnimationForceUpdate(super, super->animationState + 0xc); } else { sub_0803CA84(this, 4); } } -void Lakitu_BeginHide(Entity* this) { - UpdateAnimationSingleFrame(this); +void Lakitu_BeginHide(LakituEntity* this) { + UpdateAnimationSingleFrame(super); - if (this->frame & ANIM_DONE) { - this->action = HIDDEN; - this->spriteSettings.draw = 0; + if (super->frame & ANIM_DONE) { + super->action = HIDDEN; + super->spriteSettings.draw = 0; - InitAnimationForceUpdate(this, this->animationState); + InitAnimationForceUpdate(super, super->animationState); } } -void Lakitu_Lightning(Entity* this) { - UpdateAnimationSingleFrame(this); +void Lakitu_Lightning(LakituEntity* this) { + UpdateAnimationSingleFrame(super); - if (!(this->frame & ANIM_DONE)) { + if (!(super->frame & ANIM_DONE)) { return; } Lakitu_SpawnLightning(this); - this->action = LIGHTNING_DELAY; - this->hitType = 0x42; + super->action = LIGHTNING_DELAY; + super->hitType = 0x42; - if ((Random() & 1) && !this->field_0x78.HALF.HI) { - this->timer = 15; + if ((Random() & 1) && !this->unk_79) { + super->timer = 15; - this->field_0x78.HALF.HI = TRUE; + this->unk_79 = TRUE; } else { - this->timer = 30; + super->timer = 30; - this->field_0x78.HALF.HI = FALSE; + this->unk_79 = FALSE; - InitAnimationForceUpdate(this->child, this->animationState); + InitAnimationForceUpdate(super->child, super->animationState); } } -void Lakitu_LightningDelay(Entity* this) { - this->timer--; +void Lakitu_LightningDelay(LakituEntity* this) { + super->timer--; - if (this->timer != 0) { + if (super->timer != 0) { return; } - if (this->field_0x78.HALF.HI == 1) { + if (this->unk_79 == 1) { sub_0803CB34(this); } else { - this->action = IDLE; - this->timer = 180; + super->action = IDLE; + super->timer = 180; - InitAnimationForceUpdate(this, this->animationState + 4); + InitAnimationForceUpdate(super, super->animationState + 4); } } -void Lakitu_Cloudless(Entity* this) { - if (GravityUpdate(this, Q_8_8(24.0)) == 0 && this->animIndex <= 19) { - InitAnimationForceUpdate(this, this->animationState + 20); +void Lakitu_Cloudless(LakituEntity* this) { + if (GravityUpdate(super, Q_8_8(24.0)) == 0 && super->animIndex <= 19) { + InitAnimationForceUpdate(super, super->animationState + 20); - this->spritePriority.b1 = 0; + super->spritePriority.b1 = 0; } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); sub_0803CC08(this); } -bool32 sub_0803CA4C(Entity* this) { - if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) { - if (EntityInRectRadius(this, &gPlayerEntity, 0x70, 0x50)) { +bool32 sub_0803CA4C(LakituEntity* this) { + if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) { + if (EntityInRectRadius(super, &gPlayerEntity, 0x70, 0x50)) { return TRUE; } } @@ -252,158 +260,158 @@ bool32 sub_0803CA4C(Entity* this) { return FALSE; } -void sub_0803CA84(Entity* this, u32 unkParameter) { - u32 altAnimState = GetFacingDirection(this, &gPlayerEntity); +void sub_0803CA84(LakituEntity* this, u32 unkParameter) { + u32 altAnimState = GetFacingDirection(super, &gPlayerEntity); - if (((altAnimState - 3) & 7) > 2 || ((this->animationState - (altAnimState >> 3)) & 3) > 1) { + if (((altAnimState - 3) & 7) > 2 || ((super->animationState - (altAnimState >> 3)) & 3) > 1) { altAnimState = DirectionRoundUp(altAnimState) >> 3; - if (altAnimState != this->animationState) { - this->animationState = altAnimState; + if (altAnimState != super->animationState) { + super->animationState = altAnimState; - InitAnimationForceUpdate(this, altAnimState + unkParameter); - InitAnimationForceUpdate(this->child, altAnimState); + InitAnimationForceUpdate(super, altAnimState + unkParameter); + InitAnimationForceUpdate(super->child, altAnimState); } } } -void sub_0803CAD0(Entity* this) { - if (!EntityWithinDistance(this, this->field_0x74.HWORD, this->field_0x76.HWORD, 1)) { - this->direction = - CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, this->field_0x74.HWORD, this->field_0x76.HWORD); +void sub_0803CAD0(LakituEntity* this) { + if (!EntityWithinDistance(super, this->unk_74, this->unk_76, 1)) { + super->direction = + CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, this->unk_74, this->unk_76); - ProcessMovement2(this); + ProcessMovement2(super); } } -bool32 sub_0803CB04(Entity* this) { +bool32 sub_0803CB04(LakituEntity* this) { bool32 ret; u8 delay; - delay = --this->timer; + delay = --super->timer; if (delay != 0) { ret = FALSE; } else { sub_0803CB34(this); - this->field_0x78.HALF.HI = delay; + this->unk_79 = delay; - InitAnimationForceUpdate(this->child, this->animationState + 4); + InitAnimationForceUpdate(super->child, super->animationState + 4); ret = TRUE; } return ret; } -void sub_0803CB34(Entity* this) { - this->action = LIGHTNING_THROW; - this->hitType = 0xa6; +void sub_0803CB34(LakituEntity* this) { + super->action = LIGHTNING_THROW; + super->hitType = 0xa6; - this->field_0x78.HALF.LO = GetFacingDirection(this, &gPlayerEntity); + this->unk_78 = GetFacingDirection(super, &gPlayerEntity); - InitAnimationForceUpdate(this, this->animationState + 8); + InitAnimationForceUpdate(super, super->animationState + 8); } -void Lakitu_SpawnLightning(Entity* this) { +void Lakitu_SpawnLightning(LakituEntity* this) { Entity* lightning; const OffsetCoords* offset; - lightning = CreateProjectileWithParent(this, LAKITU_LIGHTNING, 0); + lightning = CreateProjectileWithParent(super, LAKITU_LIGHTNING, 0); if (lightning == NULL) { return; } - offset = &gUnk_080D0154[this->animationState]; + offset = &gUnk_080D0154[super->animationState]; - lightning->direction = this->field_0x78.HALF.LO; + lightning->direction = this->unk_78; - PositionRelative(this, lightning, Q_16_16(offset->x), Q_16_16(offset->y)); + PositionRelative(super, lightning, Q_16_16(offset->x), Q_16_16(offset->y)); EnqueueSFX(SFX_193); } -void sub_0803CBAC(Entity* this) { +void sub_0803CBAC(LakituEntity* this) { Entity* cloud; - cloud = this->child; + cloud = super->child; if (cloud != NULL) { cloud->flags |= ENT_COLLIDE; cloud->hitType = 0x43; } - this->action = CLOUDLESS; - this->spriteSettings.draw = 1; + super->action = CLOUDLESS; + super->spriteSettings.draw = 1; - this->spritePriority.b1 = 1; + super->spritePriority.b1 = 1; - this->flags2 &= 0x7b; + super->flags2 &= 0x7b; - this->hitType = 0x42; + super->hitType = 0x42; - InitAnimationForceUpdate(this, this->animationState + 16); + InitAnimationForceUpdate(super, super->animationState + 16); } -void sub_0803CC08(Entity* this) { +void sub_0803CC08(LakituEntity* this) { Entity* cloud; Entity* fx; const s32 diff = Q_8_8(3.0 / 128.0); - cloud = this->child; + cloud = super->child; if (cloud == NULL) { return; } - if ((u32)(cloud->z.HALF.HI - this->z.HALF.HI) > 2) { + if ((u32)(cloud->z.HALF.HI - super->z.HALF.HI) > 2) { return; } - if (this->zVelocity >= 0) { + if (super->zVelocity >= 0) { return; } - if (!EntityWithinDistance(this, cloud->x.HALF.HI, cloud->y.HALF.HI, 6)) { + if (!EntityWithinDistance(super, cloud->x.HALF.HI, cloud->y.HALF.HI, 6)) { return; } - fx = CreateFx(this, FX_DEATH, 0); + fx = CreateFx(super, FX_DEATH, 0); if (fx != NULL) { fx->x.HALF.HI += diff; fx->y.HALF.HI += diff; } - fx = CreateFx(this, FX_DEATH, 0); + fx = CreateFx(super, FX_DEATH, 0); if (fx != NULL) { fx->x.HALF.HI -= diff; fx->y.HALF.HI += diff; } - fx = CreateFx(this, FX_DEATH, 0); + fx = CreateFx(super, FX_DEATH, 0); if (fx != NULL) { fx->x.HALF.HI += diff; fx->y.HALF.HI -= diff; } - fx = CreateFx(this, FX_DEATH, 0); + fx = CreateFx(super, FX_DEATH, 0); if (fx != NULL) { fx->x.HALF.HI -= diff; fx->y.HALF.HI -= diff; } - this->child = NULL; + super->child = NULL; DeleteEntity(cloud); } -void (*const Lakitu_Functions[])(Entity*) = { - Lakitu_OnTick, Lakitu_OnCollision, GenericKnockback, GenericDeath, GenericConfused, Lakitu_OnGrabbed, +void (*const Lakitu_Functions[])(LakituEntity*) = { + Lakitu_OnTick, Lakitu_OnCollision, (void (*)(LakituEntity*))GenericKnockback, (void (*)(LakituEntity*))GenericDeath, (void (*)(LakituEntity*))GenericConfused, Lakitu_OnGrabbed, }; -void (*const LakituActionFuncs[])(Entity*) = { +void (*const LakituActionFuncs[])(LakituEntity*) = { Lakitu_Initialize, Lakitu_Hide, Lakitu_EndHide, Lakitu_Idle, Lakitu_BeginHide, Lakitu_Lightning, Lakitu_LightningDelay, Lakitu_Cloudless, }; -void (*const gUnk_080D0148[])(Entity*) = { +void (*const gUnk_080D0148[])(LakituEntity*) = { sub_0803C844, sub_0803C850, sub_0803C86C, diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 6e2c7091..f86690d6 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -4,58 +4,66 @@ * * @brief Lakitu Cloud enemy */ - -#include "global.h" +#define NENT_DEPRECATED #include "asm.h" -#include "entity.h" -#include "player.h" #include "effects.h" #include "enemy.h" -#include "physics.h" -#include "room.h" +#include "entity.h" #include "object.h" +#include "physics.h" +#include "player.h" +#include "room.h" -extern void (*const LakituCloud_Functions[6])(Entity*); -extern void (*const gUnk_080D0430[3])(Entity*); -extern void (*const gUnk_080D043C[3])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u16 unk_74; + /*0x76*/ u8 unused2[2]; + /*0x78*/ u16 unk_78; + /*0x7a*/ u16 unk_7a; +} LakituCloudEntity; -void sub_0803CE14(Entity*); -void sub_0803CE3C(Entity*); +extern void (*const LakituCloud_Functions[6])(LakituCloudEntity*); +extern void (*const gUnk_080D0430[3])(LakituCloudEntity*); +extern void (*const gUnk_080D043C[3])(LakituCloudEntity*); -void LakituCloud(Entity* this) { - LakituCloud_Functions[GetNextFunction(this)](this); +void sub_0803CE14(LakituCloudEntity*); +void sub_0803CE3C(LakituCloudEntity*); + +void LakituCloud(LakituCloudEntity* this) { + LakituCloud_Functions[GetNextFunction(super)](this); } -void LakituCloud_OnTick(Entity* this) { - gUnk_080D0430[this->action](this); +void LakituCloud_OnTick(LakituCloudEntity* this) { + gUnk_080D0430[super->action](this); } -void LakituCloud_OnKnockback(Entity* this) { - this->knockbackDuration = 0; +void LakituCloud_OnKnockback(LakituCloudEntity* this) { + super->knockbackDuration = 0; LakituCloud_OnTick(this); } -void LakituCloud_OnGrabbed(Entity* this) { - if (!sub_0806F520(this)) { - if (this->subAction == 2) { +void LakituCloud_OnGrabbed(LakituCloudEntity* this) { + if (!sub_0806F520(super)) { + if (super->subAction == 2) { sub_0803CE3C(this); } } else { - gUnk_080D043C[this->subAction](this); + gUnk_080D043C[super->subAction](this); } } -void sub_0803CD2C(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 0x3c; +void sub_0803CD2C(LakituCloudEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 0x3c; } -void sub_0803CD38(Entity* this) { - sub_0806F4E8(this); +void sub_0803CD38(LakituCloudEntity* this) { + sub_0806F4E8(super); } -void sub_0803CD40(Entity* this) { - if (!sub_0806F3E4(this)) { +void sub_0803CD40(LakituCloudEntity* this) { + if (!sub_0806F3E4(super)) { return; } @@ -67,101 +75,103 @@ void sub_0803CD40(Entity* this) { sub_0803CE3C(this); } -void sub_0803CD6C(Entity* this) { +void sub_0803CD6C(LakituCloudEntity* this) { Entity* lakitu; - this->action = 1; - this->z.HALF.HI = -2; + super->action = 1; + super->z.HALF.HI = -2; // Set parent to lakitu - lakitu = GetCurrentRoomProperty(this->type); - this->child = lakitu; - this->parent = lakitu; + lakitu = GetCurrentRoomProperty(super->type); + super->child = lakitu; + super->parent = lakitu; - this->field_0x78.HWORD = this->x.HALF.HI; - this->field_0x7a.HWORD = this->y.HALF.HI; + this->unk_78 = super->x.HALF.HI; + this->unk_7a = super->y.HALF.HI; - InitAnimationForceUpdate(this, 4); + InitAnimationForceUpdate(super, 4); sub_0803CE14(this); } -void sub_0803CDA8(Entity* this) { - UpdateAnimationSingleFrame(this); +void sub_0803CDA8(LakituCloudEntity* this) { + UpdateAnimationSingleFrame(super); - if ((this->direction & 0x80) == 0) { - LinearMoveUpdate(this); + if ((super->direction & 0x80) == 0) { + LinearMoveUpdate(super); } - if (--this->field_0x74.HWORD << 0x10 == 0) { + if (--this->unk_74 << 0x10 == 0) { sub_0803CE14(this); } } -void sub_0803CDD8(Entity* this) { +void sub_0803CDD8(LakituCloudEntity* this) { u8 one; u8 draw; - draw = this->spriteSettings.draw; + draw = super->spriteSettings.draw; one = 1; - this->spriteSettings.draw = draw ^ one; + super->spriteSettings.draw = draw ^ one; - this->timer--; + super->timer--; - if (this->timer == 0) { - this->action = 1; + if (super->timer == 0) { + super->action = 1; - COLLISION_ON(this); + COLLISION_ON(super); - this->spriteSettings.draw = one; + super->spriteSettings.draw = one; } } -void sub_0803CE14(Entity* this) { +void sub_0803CE14(LakituCloudEntity* this) { u8 direction; - UpdateRailMovement(this, (u16**)&this->child, &this->field_0x74.HWORD); + UpdateRailMovement(super, (u16**)&super->child, &this->unk_74); - direction = this->direction; + direction = super->direction; if (direction & 0x80) { return; } direction = direction / 8 + 4; - InitAnimationForceUpdate(this, direction); + InitAnimationForceUpdate(super, direction); } -void sub_0803CE3C(Entity* this) { - CreateFx(this, FX_DEATH, 0); +void sub_0803CE3C(LakituCloudEntity* this) { + CreateFx(super, FX_DEATH, 0); - this->action = 2; - this->timer = 60; + super->action = 2; + super->timer = 60; - COLLISION_OFF(this); + COLLISION_OFF(super); - this->gustJarState &= 0xfb; + super->gustJarState &= 0xfb; - this->x.HALF.HI = this->field_0x78.HWORD; - this->y.HALF.HI = this->field_0x7a.HWORD; + super->x.HALF.HI = this->unk_78; + super->y.HALF.HI = this->unk_7a; - this->child = this->parent; + super->child = super->parent; sub_0803CE14(this); } -void (*const LakituCloud_Functions[])(Entity*) = { +void (*const LakituCloud_Functions[])(LakituCloudEntity*) = { LakituCloud_OnTick, LakituCloud_OnTick, LakituCloud_OnKnockback, - GenericDeath, GenericConfused, LakituCloud_OnGrabbed, + (void (*)(LakituCloudEntity*)) +GenericDeath, (void (*)(LakituCloudEntity*)) +GenericConfused, LakituCloud_OnGrabbed, }; -void (*const gUnk_080D0430[])(Entity*) = { +void (*const gUnk_080D0430[])(LakituCloudEntity*) = { sub_0803CD6C, sub_0803CDA8, sub_0803CDD8, }; -void (*const gUnk_080D043C[])(Entity*) = { +void (*const gUnk_080D043C[])(LakituCloudEntity*) = { sub_0803CD2C, sub_0803CD38, sub_0803CD40, diff --git a/src/enemy/leever.c b/src/enemy/leever.c index 87f8dc9a..d7c49b23 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -4,20 +4,26 @@ * * @brief Leever enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u16 unk_74; +} LeeverEntity; + extern u32 sub_080B1B18(s32, s32, u32); extern u32 sub_080B1AB4(s32, s32, u32); extern Entity* gUnk_020000B0; bool32 Leever_PlayerInRange(Entity*, s32); -void Leever_Move(Entity*); +void Leever_Move(LeeverEntity*); -extern void (*const Leever_Functions[])(Entity*); -extern void (*const gLeeverActions[])(Entity*); +extern void (*const Leever_Functions[])(LeeverEntity*); +extern void (*const gLeeverActions[])(LeeverEntity*); extern const s8 gLeeverDrift[]; extern const u16 gUnk_080CA4CA[]; @@ -32,95 +38,95 @@ enum { LeeverForm_Blue, }; -void Leever(Entity* this) { - EnemyFunctionHandler(this, Leever_Functions); - SetChildOffset(this, 0, 1, -0x10); +void Leever(LeeverEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)Leever_Functions); + SetChildOffset(super, 0, 1, -0x10); } -void Leever_OnTick(Entity* this) { - gLeeverActions[this->action](this); +void Leever_OnTick(LeeverEntity* this) { + gLeeverActions[super->action](this); } -void Leever_OnCollision(Entity* this) { - if (this->contactFlags == 0x80) { - if (this->action == 3) { - this->field_0x74.HWORD = 1; +void Leever_OnCollision(LeeverEntity* this) { + if (super->contactFlags == 0x80) { + if (super->action == 3) { + this->unk_74 = 1; } } else { - if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); + if (super->confusedTime != 0) { + Create0x68FX(super, FX_STARS); } } - EnemyFunctionHandlerAfterCollision(this, Leever_Functions); + EnemyFunctionHandlerAfterCollision(super, Leever_Functions); } -void Leever_OnDeath(Entity* this) { - if (this->type == LeeverForm_Red) { - GenericDeath(this); +void Leever_OnDeath(LeeverEntity* this) { + if (super->type == LeeverForm_Red) { + GenericDeath(super); } else { - CreateDeathFx(this, 0xf1, 0); + CreateDeathFx(super, 0xf1, 0); } } -void Leever_Initialize(Entity* this) { - sub_0804A720(this); - this->action = 1; - this->timer = Random(); +void Leever_Initialize(LeeverEntity* this) { + sub_0804A720(super); + super->action = 1; + super->timer = Random(); } -void Leever_Idle(Entity* this) { - if (--this->timer == 0) { - if (Leever_PlayerInRange(this, Random() & 0x1f)) { - this->action = 2; - this->spriteSettings.draw = TRUE; - this->direction = (GetFacingDirection(this, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & 0x1f; - InitializeAnimation(this, LeeverAnimation_DigUp); - UpdateSpriteForCollisionLayer(this); +void Leever_Idle(LeeverEntity* this) { + if (--super->timer == 0) { + if (Leever_PlayerInRange(super, Random() & 0x1f)) { + super->action = 2; + super->spriteSettings.draw = TRUE; + super->direction = (GetFacingDirection(super, gUnk_020000B0) + gLeeverDrift[Random() & 1]) & 0x1f; + InitializeAnimation(super, LeeverAnimation_DigUp); + UpdateSpriteForCollisionLayer(super); } else { - this->timer = DirectionRound(Random()) + 8; + super->timer = DirectionRound(Random()) + 8; } } } -void Leever_DigUp(Entity* this) { - GetNextFrame(this); +void Leever_DigUp(LeeverEntity* this) { + GetNextFrame(super); - if (this->frame & ANIM_DONE) { - this->action = 3; - if (this->type == LeeverForm_Red) { - this->field_0x74.HWORD = 180; + if (super->frame & ANIM_DONE) { + super->action = 3; + if (super->type == LeeverForm_Red) { + this->unk_74 = 180; } else { - this->field_0x74.HWORD = 110; + this->unk_74 = 110; } - InitializeAnimation(this, LeeverAnimation_Attack); - } else if ((this->frame & 1) != 0) { - this->frame &= 0xfe; - COLLISION_ON(this); + InitializeAnimation(super, LeeverAnimation_Attack); + } else if ((super->frame & 1) != 0) { + super->frame &= 0xfe; + COLLISION_ON(super); } } -void Leever_Attack(Entity* this) { +void Leever_Attack(LeeverEntity* this) { Leever_Move(this); - GetNextFrame(this); + GetNextFrame(super); - if (--this->field_0x74.HWORD == 0) { - this->action = 4; - COLLISION_OFF(this); - InitializeAnimation(this, LeeverAnimation_DigDown); + if (--this->unk_74 == 0) { + super->action = 4; + COLLISION_OFF(super); + InitializeAnimation(super, LeeverAnimation_DigDown); } } -void Leever_DigDown(Entity* this) { +void Leever_DigDown(LeeverEntity* this) { Leever_Move(this); - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 1; - this->timer = 240; - this->spriteSettings.draw = FALSE; + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 1; + super->timer = 240; + super->spriteSettings.draw = FALSE; } } -u32 sub_0801FDE4(Entity* ent, s32 x, s32 y) { +u32 sub_0801FDE4(Entity* entity, s32 x, s32 y) { u32 uVar3; const u16* puVar4; @@ -130,9 +136,9 @@ u32 sub_0801FDE4(Entity* ent, s32 x, s32 y) { uVar3 = sub_080B1AB4(x, y, gUnk_020000B0->collisionLayer); for (puVar4 = gUnk_080CA4CA; *puVar4 != (u16)-1;) { if (*puVar4++ == uVar3) { - ent->x.HALF.HI = (x & 0xfff0) + 8; - ent->y.HALF.HI = (y & 0xfff0) + 8; - ent->collisionLayer = gUnk_020000B0->collisionLayer; + entity->x.HALF.HI = (x & 0xfff0) + 8; + entity->y.HALF.HI = (y & 0xfff0) + 8; + entity->collisionLayer = gUnk_020000B0->collisionLayer; return 1; } } @@ -140,12 +146,12 @@ u32 sub_0801FDE4(Entity* ent, s32 x, s32 y) { } } -bool32 Leever_PlayerInRange(Entity* ent, s32 arg2) { +bool32 Leever_PlayerInRange(Entity* entity, s32 arg2) { s32 sin, cos; s32 x, y; u32 i; - if (sub_08049FDC(ent, 1) == 0) { + if (sub_08049FDC(entity, 1) == 0) { return 0; } else { x = gUnk_020000B0->x.WORD; @@ -155,7 +161,7 @@ bool32 Leever_PlayerInRange(Entity* ent, s32 arg2) { for (i = 0; i < 8; i++) { x += sin; y += -cos; - if (sub_0801FDE4(ent, x >> 0x10, y >> 0x10) == 0) { + if (sub_0801FDE4(entity, x >> 0x10, y >> 0x10) == 0) { return 0; } } @@ -163,37 +169,37 @@ bool32 Leever_PlayerInRange(Entity* ent, s32 arg2) { } } -void Leever_Move(Entity* this) { - if (sub_08049FDC(this, 1) == 0) { - this->field_0x74.HWORD = 1; +void Leever_Move(LeeverEntity* this) { + if (sub_08049FDC(super, 1) == 0) { + this->unk_74 = 1; } - this->speed = (this->frame & 0xf) * 0x20; - if (this->type == LeeverForm_Red) { - if ((this->subtimer++ & 0xf) == 0) { - sub_08004596(this, sub_0800132C(this, gUnk_020000B0)); + super->speed = (super->frame & 0xf) * 0x20; + if (super->type == LeeverForm_Red) { + if ((super->subtimer++ & 0xf) == 0) { + sub_08004596(super, sub_0800132C(super, gUnk_020000B0)); } } else { - this->speed += 0x40; - if ((this->subtimer++ & 0x7) == 0) { - sub_08004596(this, sub_0800132C(this, gUnk_020000B0)); + super->speed += 0x40; + if ((super->subtimer++ & 0x7) == 0) { + sub_08004596(super, sub_0800132C(super, gUnk_020000B0)); } } - ProcessMovement0(this); + ProcessMovement0(super); } // clang-format off -void (*const Leever_Functions[])(Entity*) = { +void (*const Leever_Functions[])(LeeverEntity*) = { Leever_OnTick, Leever_OnCollision, - GenericKnockback, + (void (*)(LeeverEntity*))GenericKnockback, Leever_OnDeath, - GenericConfused, + (void (*)(LeeverEntity*))GenericConfused, Leever_OnTick, }; -void (*const gLeeverActions[])(Entity*) = { +void (*const gLeeverActions[])(LeeverEntity*) = { Leever_Initialize, Leever_Idle, Leever_DigUp, diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index 886aa8b7..859bbd46 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -4,13 +4,12 @@ * * @brief Like Like enemy */ - #define NENT_DEPRECATED #include "enemy.h" -#include "message.h" -#include "save.h" -#include "object.h" #include "item.h" +#include "message.h" +#include "object.h" +#include "save.h" typedef struct { Entity base; diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index ad81c2d4..4666b7fd 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -4,49 +4,71 @@ * * @brief Madderpillar enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "hitbox.h" -void sub_08029E0C(Entity*); -void sub_08029EEC(Entity*); -void sub_0802A098(Entity*); -void sub_0802A16C(Entity*); -void sub_0802A058(Entity*); -bool32 sub_0802A14C(Entity*); -void sub_0802A18C(Entity*); -bool32 sub_08029FE4(Entity*); -void sub_08029FB4(Entity*, u32, u32); -void sub_0802A0F8(Entity*); -void sub_08029F0C(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u8 unk_74; + /*0x75*/ u8 unk_75; + /*0x76*/ u8 unused2[1]; + /*0x77*/ u8 unk_77; + /*0x78*/ union SplitHWord unk_78; + /*0x7a*/ union SplitHWord unk_7a; + /*0x7c*/ u8 unk_7c; + /*0x7d*/ u8 unk_7d; + /*0x7e*/ u8 unk_7e; + /*0x7f*/ u8 unk_7f; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; + /*0x84*/ u8 unk_84; + /*0x85*/ u8 unk_85; + /*0x86*/ u8 unk_86; +} MadderpillarEntity; + +void sub_08029E0C(MadderpillarEntity* this); +void sub_08029EEC(MadderpillarEntity* this); +void sub_0802A098(MadderpillarEntity* this); +void sub_0802A16C(MadderpillarEntity* this); +void sub_0802A058(MadderpillarEntity* this); +bool32 sub_0802A14C(MadderpillarEntity* this); +void sub_0802A18C(MadderpillarEntity* this); +bool32 sub_08029FE4(MadderpillarEntity* this); +void sub_08029FB4(MadderpillarEntity* this, u32, u32); +void sub_0802A0F8(MadderpillarEntity* this); +void sub_08029F0C(MadderpillarEntity* this); extern s16 gUnk_080B4488[]; -extern void (*const gUnk_080CCD44[])(Entity*); -extern void (*const Madderpillar_Functions[])(Entity*); -extern void (*const gUnk_080CCD78[])(Entity*); -extern void (*const gUnk_080CCD88[])(Entity*); +extern void (*const gUnk_080CCD44[])(MadderpillarEntity*); +extern void (*const Madderpillar_Functions[])(MadderpillarEntity*); +extern void (*const gUnk_080CCD78[])(MadderpillarEntity*); +extern void (*const gUnk_080CCD88[])(MadderpillarEntity*); extern const u8 gUnk_080CCDA0[]; -extern void (*const gUnk_080CCDA8[])(Entity*); +extern void (*const gUnk_080CCDA8[])(MadderpillarEntity*); extern const u8 gUnk_080CCDC8[]; extern const u16 gUnk_080CCDD4[]; -void Madderpillar(Entity* this) { - gUnk_080CCD44[this->type](this); +void Madderpillar(MadderpillarEntity* this) { + gUnk_080CCD44[super->type](this); } -void sub_08029870(Entity* this) { - Madderpillar_Functions[GetNextFunction(this)](this); +void sub_08029870(MadderpillarEntity* this) { + Madderpillar_Functions[GetNextFunction(super)](this); } -void Madderpillar_OnTick(Entity* this) { - gUnk_080CCD78[this->action](this); +void Madderpillar_OnTick(MadderpillarEntity* this) { + gUnk_080CCD78[super->action](this); } -void Madderpillar_OnCollision(Entity* this) { - if (this->action == 1) { - switch (this->contactFlags & 0x7f) { +void Madderpillar_OnCollision(MadderpillarEntity* this) { + if (super->action == 1) { + switch (super->contactFlags & 0x7f) { case 0: case 1: case 2: @@ -57,273 +79,273 @@ void Madderpillar_OnCollision(Entity* this) { case 0x1e: break; default: - this->action = 2; - this->timer = 0; - this->hitType = 0x6b; - this->field_0x76.HALF.HI = 0; - ChangeObjPalette(this, 0x7f); + super->action = 2; + super->timer = 0; + super->hitType = 0x6b; + this->unk_77 = 0; + ChangeObjPalette(super, 0x7f); EnqueueSFX(SFX_HIT); - this->child->action = 2; + super->child->action = 2; break; } } - EnemyFunctionHandlerAfterCollision(this, Madderpillar_Functions); + EnemyFunctionHandlerAfterCollision(super, Madderpillar_Functions); } -void Madderpillar_OnDeath(Entity* this) { - if (this->subtimer) { - this->subtimer--; +void Madderpillar_OnDeath(MadderpillarEntity* this) { + if (super->subtimer) { + super->subtimer--; } else { - GenericDeath(this); + GenericDeath(super); } } -void Madderpillar_OnGrabbed(Entity* this) { +void Madderpillar_OnGrabbed(MadderpillarEntity* this) { /* ... */ } -void sub_0802999C(Entity* this) { +void sub_0802999C(MadderpillarEntity* this) { if (gEntCount < 0x44) { Entity *ent1, *ent2, *ent3, *ent4, *ent5, *ent6; ent1 = CreateEnemy(MADDERPILLAR, 1); - ent1->parent = this; - PositionRelative(this, ent1, 0, 5); - this->child = ent1; + ent1->parent = super; + PositionRelative(super, ent1, 0, 5); + super->child = ent1; ent2 = CreateEnemy(MADDERPILLAR, 2); - ent2->parent = this; - PositionRelative(this, ent2, 0, 4); + ent2->parent = super; + PositionRelative(super, ent2, 0, 4); ent1->child = ent2; ent3 = CreateEnemy(MADDERPILLAR, 3); - ent3->parent = this; - PositionRelative(this, ent3, 0, 3); + ent3->parent = super; + PositionRelative(super, ent3, 0, 3); ent2->child = ent3; ent4 = CreateEnemy(MADDERPILLAR, 4); - ent4->parent = this; - PositionRelative(this, ent4, 0, 2); + ent4->parent = super; + PositionRelative(super, ent4, 0, 2); ent3->child = ent4; ent5 = CreateEnemy(MADDERPILLAR, 5); - ent5->parent = this; - PositionRelative(this, ent5, 0, 1); + ent5->parent = super; + PositionRelative(super, ent5, 0, 1); ent4->child = ent5; ent6 = CreateEnemy(MADDERPILLAR, 6); - ent6->child = this; - ent6->parent = this; - PositionRelative(this, ent6, 0, 0); + ent6->child = super; + ent6->parent = super; + PositionRelative(super, ent6, 0, 0); ent5->child = ent6; - this->action = 1; - COLLISION_ON(this); - this->direction = DirectionRound(Random()); - this->speed = 0xa0; - this->animationState = 0xff; - this->y.WORD += 6; - this->parent = this; - this->field_0x74.HALF.LO = 0xff; - this->field_0x74.HALF.HI = 0; - this->field_0x76.HALF.HI = 1; + super->action = 1; + COLLISION_ON(super); + super->direction = DirectionRound(Random()); + super->speed = 0xa0; + super->animationState = 0xff; + super->y.WORD += 6; + super->parent = super; + this->unk_74 = 0xff; + this->unk_75 = 0; + this->unk_77 = 1; sub_08029E0C(this); sub_08029EEC(this); } } -void sub_08029A94(Entity* this) { - UpdateAnimationSingleFrame(this); +void sub_08029A94(MadderpillarEntity* this) { + UpdateAnimationSingleFrame(super); sub_0802A098(this); } -void sub_08029AA4(Entity* this) { - if (this->field_0x76.HALF.HI != 0) { - this->action = 3; - this->speed = 0x108; - this->hitType = 0x6a; - this->field_0x7a.HWORD = 0x168; - this->field_0x74.HALF.HI = 4; +void sub_08029AA4(MadderpillarEntity* this) { + if (this->unk_77 != 0) { + super->action = 3; + super->speed = 0x108; + super->hitType = 0x6a; + this->unk_7a.HWORD = 0x168; + this->unk_75 = 4; sub_08029EEC(this); EnqueueSFX(SFX_19D); } } -void sub_08029AE0(Entity* this) { - UpdateAnimationSingleFrame(this); +void sub_08029AE0(MadderpillarEntity* this) { + UpdateAnimationSingleFrame(super); sub_0802A16C(this); sub_0802A098(this); - if (--this->field_0x7a.HWORD == 0) { - this->action = 1; - this->speed = 0xa0; - this->field_0x74.HALF.HI = 0; + if (--this->unk_7a.HWORD == 0) { + super->action = 1; + super->speed = 0xa0; + this->unk_75 = 0; sub_08029EEC(this); - ChangeObjPalette(this, 0x77); + ChangeObjPalette(super, 0x77); EnqueueSFX(SFX_182); } } -void sub_08029B2C(Entity* this) { +void sub_08029B2C(MadderpillarEntity* this) { if (sub_0802A14C(this)) { - if (this->field_0x86.HALF.LO) { - if (--this->timer == 0) { - CreateFx(this, FX_GIANT_EXPLOSION3, 0); - DeleteEntity(this); + if (this->unk_86) { + if (--super->timer == 0) { + CreateFx(super, FX_GIANT_EXPLOSION3, 0); + DeleteEntity(super); } } else { - COLLISION_OFF(this); - this->timer = -(this->type * 15 - 90); - this->field_0x86.HALF.LO = 1; + COLLISION_OFF(super); + super->timer = -(super->type * 15 - 90); + this->unk_86 = 1; } } else { - gUnk_080CCD88[this->action](this); + gUnk_080CCD88[super->action](this); } } -void sub_08029B90(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 1; +void sub_08029B90(MadderpillarEntity* this) { + super->action = 1; + super->spriteSettings.draw = 1; sub_0802A058(this); - if (this->type < 2) { - InitializeAnimation(this, 0); + if (super->type < 2) { + InitializeAnimation(super, 0); } else { - InitializeAnimation(this, 4); + InitializeAnimation(super, 4); } } -void sub_08029BC4(Entity* this) { +void sub_08029BC4(MadderpillarEntity* this) { u32 uVar1; u32 uVar2; sub_0802A18C(this); - uVar1 = this->x.HALF.HI; - uVar2 = this->y.HALF.HI; + uVar1 = super->x.HALF.HI; + uVar2 = super->y.HALF.HI; if (sub_08029FE4(this)) { u32 index; - if (this->type < 2) { + if (super->type < 2) { index = 0; } else { index = 4; } - InitializeAnimation(this, this->animationState + index); + InitializeAnimation(super, super->animationState + index); } - sub_08029FB4(this, this->x.HALF.HI - uVar1, this->y.HALF.HI - uVar2); + sub_08029FB4(this, super->x.HALF.HI - uVar1, super->y.HALF.HI - uVar2); } -void sub_08029C08(Entity* this) { - this->action = 3; - this->timer = gUnk_080CCDA0[this->type]; - this->hitType = 0x6b; - this->child->action = 2; +void sub_08029C08(MadderpillarEntity* this) { + super->action = 3; + super->timer = gUnk_080CCDA0[super->type]; + super->hitType = 0x6b; + super->child->action = 2; } -void sub_08029C2C(Entity* this) { - if (--this->timer == 0) { - this->action = 4; - ChangeObjPalette(this, 0x7f); +void sub_08029C2C(MadderpillarEntity* this) { + if (--super->timer == 0) { + super->action = 4; + ChangeObjPalette(super, 0x7f); EnqueueSFX(SFX_MENU_CANCEL); } } -void sub_08029C50(Entity* this) { - if (this->parent->field_0x76.HALF.HI != 0) { - this->action = 5; - this->hitType = 0x6a; +void sub_08029C50(MadderpillarEntity* this) { + if (((MadderpillarEntity*)super->parent)->unk_77 != 0) { + super->action = 5; + super->hitType = 0x6a; } } -void sub_08029C6C(Entity* this) { +void sub_08029C6C(MadderpillarEntity* this) { sub_0802A18C(this); sub_08029BC4(this); - if (this->parent->action != 3) { - this->action = 1; - ChangeObjPalette(this, 0x77); + if (super->parent->action != 3) { + super->action = 1; + ChangeObjPalette(super, 0x77); } else { sub_0802A16C(this); } } -void sub_08029C98(Entity* this) { +void sub_08029C98(MadderpillarEntity* this) { if (sub_0802A14C(this)) { - CreateFx(this, FX_GIANT_EXPLOSION3, 0); - DeleteEntity(this); + CreateFx(super, FX_GIANT_EXPLOSION3, 0); + DeleteEntity(super); } else { - gUnk_080CCDA8[this->action](this); + gUnk_080CCDA8[super->action](this); } } -void sub_08029CCC(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 1; +void sub_08029CCC(MadderpillarEntity* this) { + super->action = 1; + super->spriteSettings.draw = 1; sub_0802A058(this); - InitializeAnimation(this, 8); + InitializeAnimation(super, 8); } -void sub_08029CF0(Entity* this) { +void sub_08029CF0(MadderpillarEntity* this) { if (sub_08029FE4(this)) { - InitializeAnimation(this, this->animationState + 8); + InitializeAnimation(super, super->animationState + 8); } } -void sub_08029D08(Entity* this) { - this->action = 3; - this->timer = 71; +void sub_08029D08(MadderpillarEntity* this) { + super->action = 3; + super->timer = 71; } -void sub_08029D14(Entity* this) { - if (this->timer != 0) { - if (--this->timer == 0) { - InitializeAnimation(this, this->animationState + 0xc); - ChangeObjPalette(this, 0x7f); +void sub_08029D14(MadderpillarEntity* this) { + if (super->timer != 0) { + if (--super->timer == 0) { + InitializeAnimation(super, super->animationState + 0xc); + ChangeObjPalette(super, 0x7f); EnqueueSFX(SFX_MENU_CANCEL); } } else { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 4; - this->timer = 120; - this->hitType = 0x6c; - this->hitbox = (Hitbox*)&gUnk_080FD298; + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 4; + super->timer = 120; + super->hitType = 0x6c; + super->hitbox = (Hitbox*)&gUnk_080FD298; EnqueueSFX(SFX_6B); } } } -void sub_08029D78(Entity* this) { +void sub_08029D78(MadderpillarEntity* this) { sub_0802A0F8(this); - if (--this->timer == 0) { - this->action = 5; - this->hitType = 0x6a; - this->hitbox = (Hitbox*)&gUnk_080FD2A0; - InitializeAnimation(this, this->animationState + 0x10); + if (--super->timer == 0) { + super->action = 5; + super->hitType = 0x6a; + super->hitbox = (Hitbox*)&gUnk_080FD2A0; + InitializeAnimation(super, super->animationState + 0x10); } } -void sub_08029DAC(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 6; - this->parent->field_0x76.HALF.HI = 1; - InitializeAnimation(this, this->animationState + 8); +void sub_08029DAC(MadderpillarEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 6; + ((MadderpillarEntity*)super->parent)->unk_77 = 1; + InitializeAnimation(super, super->animationState + 8); } } -void sub_08029DDC(Entity* this) { - this->action = 7; +void sub_08029DDC(MadderpillarEntity* this) { + super->action = 7; } -void sub_08029DE4(Entity* this) { +void sub_08029DE4(MadderpillarEntity* this) { sub_08029CF0(this); - if (this->parent->action != 3) { - this->action = 1; - ChangeObjPalette(this, 0x77); + if (super->parent->action != 3) { + super->action = 1; + ChangeObjPalette(super, 0x77); } else { sub_0802A16C(this); } } -void sub_08029E0C(Entity* this) { +void sub_08029E0C(MadderpillarEntity* this) { u32 tile; s32 uVar4; s32 iVar3; @@ -333,16 +355,16 @@ void sub_08029E0C(Entity* this) { u32 local_24; u32 dir; - uVar2 = (this->direction >> 3) * 3; + uVar2 = (super->direction >> 3) * 3; ptr = &gUnk_080CCDC8[uVar2]; uVar4 = (Random() & 1) * 2 - 1; iVar3 = ((s32)Random() & 0xf) % 3; - tile = COORD_TO_TILE(this); + tile = COORD_TO_TILE(super); for (i = 0; i < 3; i++) { dir = ptr[iVar3]; - if (sub_080B1B44(gUnk_080B4488[dir >> 3] + tile, this->collisionLayer) == 0) { + if (sub_080B1B44(gUnk_080B4488[dir >> 3] + tile, super->collisionLayer) == 0) { local_24 = dir; - if (this->direction - this->field_0x74.HALF.LO != dir - this->direction) + if (super->direction - this->unk_74 != dir - super->direction) break; } iVar3 = (iVar3 + uVar4 + 3) % 3; @@ -352,61 +374,61 @@ void sub_08029E0C(Entity* this) { dir = local_24; } - if (this->field_0x74.HALF.LO != this->direction) { - this->field_0x74.HALF.LO = this->direction; + if (this->unk_74 != super->direction) { + this->unk_74 = super->direction; } - this->direction = dir; + super->direction = dir; sub_08029F0C(this); } -void sub_08029EEC(Entity* this) { - u32 uVar1 = (this->direction >> 3) + this->field_0x74.HALF.HI; - if (uVar1 != this->animationState) { - this->animationState = uVar1; - InitAnimationForceUpdate(this, uVar1); +void sub_08029EEC(MadderpillarEntity* this) { + u32 uVar1 = (super->direction >> 3) + this->unk_75; + if (uVar1 != super->animationState) { + super->animationState = uVar1; + InitAnimationForceUpdate(super, uVar1); } } -void sub_08029F0C(Entity* this) { - switch (this->direction >> 3) { +void sub_08029F0C(MadderpillarEntity* this) { + switch (super->direction >> 3) { case 0: - this->field_0x78.HWORD = this->y.HALF.HI - 0x10; + this->unk_78.HWORD = super->y.HALF.HI - 0x10; break; case 1: - this->field_0x78.HWORD = this->x.HALF.HI + 0x10; + this->unk_78.HWORD = super->x.HALF.HI + 0x10; break; case 2: - this->field_0x78.HWORD = this->y.HALF.HI + 0x10; + this->unk_78.HWORD = super->y.HALF.HI + 0x10; break; case 3: - this->field_0x78.HWORD = this->x.HALF.HI - 0x10; + this->unk_78.HWORD = super->x.HALF.HI - 0x10; break; } } -bool32 sub_08029F48(Entity* this) { - switch (this->direction >> 3) { +bool32 sub_08029F48(MadderpillarEntity* this) { + switch (super->direction >> 3) { case 0: - if (this->y.HALF.HI <= this->field_0x78.HWORD) { - this->y.HALF.HI = this->field_0x78.HWORD; + if (super->y.HALF.HI <= this->unk_78.HWORD) { + super->y.HALF.HI = this->unk_78.HWORD; return TRUE; } break; case 1: - if (this->x.HALF.HI >= this->field_0x78.HWORD) { - this->x.HALF.HI = this->field_0x78.HWORD; + if (super->x.HALF.HI >= this->unk_78.HWORD) { + super->x.HALF.HI = this->unk_78.HWORD; return TRUE; } break; case 2: - if (this->y.HALF.HI >= this->field_0x78.HWORD) { - this->y.HALF.HI = this->field_0x78.HWORD; + if (super->y.HALF.HI >= this->unk_78.HWORD) { + super->y.HALF.HI = this->unk_78.HWORD; return TRUE; } break; case 3: - if (this->x.HALF.HI <= this->field_0x78.HWORD) { - this->x.HALF.HI = this->field_0x78.HWORD; + if (super->x.HALF.HI <= this->unk_78.HWORD) { + super->x.HALF.HI = this->unk_78.HWORD; return TRUE; } break; @@ -415,23 +437,23 @@ bool32 sub_08029F48(Entity* this) { return FALSE; } -void sub_08029FB4(Entity* this, u32 x, u32 y) { - u8* dst = (u8*)&this->child->field_0x78; - s32 unk = this->parent->field_0x7c.BYTES.byte2; +void sub_08029FB4(MadderpillarEntity* this, u32 x, u32 y) { + u8* dst = (u8*)&((MadderpillarEntity*)super->child)->unk_78; + s32 unk = ((MadderpillarEntity*)super->parent)->unk_7e; u8 idx = unk % 0xe; dst[idx] = ((x + 8) & 0xf) | (((y + 8) & 0xf) << 4); } /* The optimizer is strong within you. */ -bool32 sub_08029FE4(Entity* this) { +bool32 sub_08029FE4(MadderpillarEntity* this) { u8 state; - u8* dst = (u8*)&this->field_0x78; - s32 unk = this->parent->field_0x7c.BYTES.byte2 + 1; + u8* dst = (u8*)&this->unk_78; + s32 unk = ((MadderpillarEntity*)super->parent)->unk_7e + 1; s8 iVar6 = (dst[unk % 0xe] & 0xf) - 8; s8 iVar5 = (dst[unk % 0xe] >> 4) - 8; - this->x.HALF.HI += iVar6; - this->y.HALF.HI += iVar5; - GetNextFrame(this); + super->x.HALF.HI += iVar6; + super->y.HALF.HI += iVar5; + GetNextFrame(super); state = 0xff; if (iVar6 != 0) { @@ -450,72 +472,72 @@ bool32 sub_08029FE4(Entity* this) { } } - if (state != 0xff && state != this->animationState) { - this->animationState = state; + if (state != 0xff && state != super->animationState) { + super->animationState = state; return TRUE; } else { return FALSE; } } -void sub_0802A058(Entity* this) { - this->field_0x78.HALF.LO = 0x88; - this->field_0x78.HALF.HI = 0x88; - this->field_0x7a.HALF.LO = 0x88; - this->field_0x7a.HALF.HI = 0x88; - this->field_0x7c.BYTES.byte0 = 0x88; - this->field_0x7c.BYTES.byte1 = 0x88; - this->field_0x7c.BYTES.byte2 = 0x88; - this->field_0x7c.BYTES.byte3 = 0x88; - this->field_0x80.HALF.LO = 0x88; - this->field_0x80.HALF.HI = 0x88; - this->field_0x82.HALF.LO = 0x88; - this->field_0x82.HALF.HI = 0x88; - this->cutsceneBeh.HALF.LO = 0x88; - this->cutsceneBeh.HALF.HI = 0x88; +void sub_0802A058(MadderpillarEntity* this) { + this->unk_78.HALF.LO = 0x88; + this->unk_78.HALF.HI = 0x88; + this->unk_7a.HALF.LO = 0x88; + this->unk_7a.HALF.HI = 0x88; + this->unk_7c = 0x88; + this->unk_7d = 0x88; + this->unk_7e = 0x88; + this->unk_7f = 0x88; + this->unk_80 = 0x88; + this->unk_81 = 0x88; + this->unk_82 = 0x88; + this->unk_83 = 0x88; + this->unk_84 = 0x88; + this->unk_85 = 0x88; } -void sub_0802A098(Entity* this) { +void sub_0802A098(MadderpillarEntity* this) { u32 uVar1; u32 uVar2; - s32 unk = (++this->field_0x7c.BYTES.byte2, this->field_0x7c.BYTES.byte2); + s32 unk = (++this->unk_7e, this->unk_7e); u8 idx = unk % 0xe; if (idx == 0) { - this->field_0x7c.BYTES.byte2 = 0; + this->unk_7e = 0; } - uVar1 = this->x.HALF.HI; - uVar2 = this->y.HALF.HI; - ProcessMovement0(this); + uVar1 = super->x.HALF.HI; + uVar2 = super->y.HALF.HI; + ProcessMovement0(super); if (sub_08029F48(this)) { sub_08029E0C(this); sub_08029EEC(this); EnqueueSFX(SFX_PLACE_OBJ); } - sub_08029FB4(this, this->x.HALF.HI - uVar1, this->y.HALF.HI - uVar2); + sub_08029FB4(this, super->x.HALF.HI - uVar1, super->y.HALF.HI - uVar2); } -void sub_0802A0F8(Entity* this) { - if (this->health != 0) { - if ((this->contactFlags & 0x80) && this->iframes != 0) { - Entity* ent = this; +void sub_0802A0F8(MadderpillarEntity* this) { + if (super->health != 0) { + if ((super->contactFlags & 0x80) && super->iframes != 0) { + Entity* entity = super; u32 i; for (i = 0; i < 6; i++) { - ent = ent->child; - ent->iframes = this->iframes; + entity = entity->child; + entity->iframes = super->iframes; } } } else { - this->parent->flags &= ~ENT_COLLIDE; - this->parent->health = 0; - this->parent->subtimer = 105; + super->parent->flags &= ~ENT_COLLIDE; + super->parent->health = 0; + super->parent->subtimer = 105; } } -bool32 sub_0802A14C(Entity* this) { +bool32 sub_0802A14C(MadderpillarEntity* this) { u32 ret = FALSE; - if (this->parent->health == 0 || this->field_0x86.HALF.LO) { + if (super->parent->health == 0 || this->unk_86) { ret = TRUE; } else { ret = FALSE; @@ -523,13 +545,13 @@ bool32 sub_0802A14C(Entity* this) { return ret; } -void sub_0802A16C(Entity* this) { - ChangeObjPalette(this, gUnk_080CCDD4[this->parent->field_0x7a.HWORD >> 2 & 3]); +void sub_0802A16C(MadderpillarEntity* this) { + ChangeObjPalette(super, gUnk_080CCDD4[((MadderpillarEntity*)super->parent)->unk_7a.HWORD >> 2 & 3]); } -void sub_0802A18C(Entity* this) { - if (this->contactFlags & 0x80) { - switch (this->contactFlags & 0x7f) { +void sub_0802A18C(MadderpillarEntity* this) { + if (super->contactFlags & 0x80) { + switch (super->contactFlags & 0x7f) { case 0: case 1: case 2: @@ -547,7 +569,7 @@ void sub_0802A18C(Entity* this) { } // clang-format off -void (*const gUnk_080CCD44[])(Entity*) = { +void (*const gUnk_080CCD44[])(MadderpillarEntity*) = { sub_08029870, sub_08029B2C, sub_08029B2C, @@ -557,23 +579,23 @@ void (*const gUnk_080CCD44[])(Entity*) = { sub_08029C98, }; -void (*const Madderpillar_Functions[])(Entity*) = { +void (*const Madderpillar_Functions[])(MadderpillarEntity*) = { Madderpillar_OnTick, Madderpillar_OnCollision, Madderpillar_OnTick, Madderpillar_OnDeath, - GenericConfused, + (void (*)(MadderpillarEntity*))GenericConfused, Madderpillar_OnGrabbed, }; -void (*const gUnk_080CCD78[])(Entity*) = { +void (*const gUnk_080CCD78[])(MadderpillarEntity*) = { sub_0802999C, sub_08029A94, sub_08029AA4, sub_08029AE0, }; -void (*const gUnk_080CCD88[])(Entity*) = { +void (*const gUnk_080CCD88[])(MadderpillarEntity*) = { sub_08029B90, sub_08029BC4, sub_08029C08, @@ -592,7 +614,7 @@ const u8 gUnk_080CCDA0[] = { 0x00, }; -void (*const gUnk_080CCDA8[])(Entity*) = { +void (*const gUnk_080CCDA8[])(MadderpillarEntity*) = { sub_08029CCC, sub_08029CF0, sub_08029D08, diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index d21e8636..6a0228cb 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -4,11 +4,33 @@ * * @brief Mazaal Bracelet enemy */ - +//#define NENT_DEPRECATED #include "enemy.h" -#include "object.h" #include "functions.h" #include "hitbox.h" +#include "object.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u32 unk_74; +// // Overlap of 4 +// /*0x74*/ u8 unk_74; +// /*0x75*/ u8 unk_75; + /*0x76*/ u8 unused2[2]; + /*0x78*/ u32 unk_78; +// // Overlap of 4 +// /*0x78*/ u16 unk_78; + /*0x7a*/ u8 unused3[2]; + /*0x7c*/ u8 unk_7c; + /*0x7d*/ u8 unk_7d; + /*0x7e*/ u16 unk_7e; + /*0x80*/ u8 unk_80; +// // Overlap of 1 +// /*0x80*/ u16 unk_80; + /*0x82*/ u8 unused4[2]; + /*0x84*/ u8 unk_84; +} MazaalBraceletEntity; void sub_0803B538(Entity*); u32 sub_0803B4E4(Entity*); @@ -134,27 +156,27 @@ void MazaalBracelet_OnTick(Entity* this) { } void MazaalBracelet_OnCollision(Entity* this) { - Entity* ent; + Entity* entity; if (this->type < 2) { if (this->action != 0x2b) { if ((0 < this->iframes) && ((this->contactFlags == 0x95 || (this->contactFlags == 0x8e)))) { this->action = 0x28; COLLISION_OFF(this); - ent = this->parent; - ent->field_0x7c.BYTES.byte1 = ent->field_0x7c.BYTES.byte1 | (this->type == 0 ? 1 : 2); - ent->field_0x80.HALF.LO = (this->type == 0 ? 1 : 2) | ent->field_0x80.HALF.LO; - ent = this->child; - ent->iframes = this->iframes; - ent = (*(Entity**)&this->field_0x74); - ent->iframes = this->iframes; + entity = this->parent; + entity->field_0x7c.BYTES.byte1 = entity->field_0x7c.BYTES.byte1 | (this->type == 0 ? 1 : 2); + entity->field_0x80.HALF.LO = (this->type == 0 ? 1 : 2) | entity->field_0x80.HALF.LO; + entity = this->child; + entity->iframes = this->iframes; + entity = (*(Entity**)&this->field_0x74); + entity->iframes = this->iframes; SoundReq(SFX_BOSS_HIT); } } else { - ent = this->child; - ent->iframes = this->iframes; - ent = (*(Entity**)&this->field_0x74); - ent->iframes = this->iframes; + entity = this->child; + entity->iframes = this->iframes; + entity = (*(Entity**)&this->field_0x74); + entity->iframes = this->iframes; InitializeAnimation(this, 0x18); InitAnimationForceUpdate(this->child, 9); SoundReq(SFX_BOSS_HIT); @@ -1357,10 +1379,10 @@ void sub_0803BA80(Entity* this) { } void sub_0803BA8C(Entity* this, u32 unk) { - u32 sVar2; + u32 palette; u32 tmp; - sVar2 = 0; + palette = 0; tmp = this->field_0x74.HALF.LO & 0xe0; if ((this->field_0x74.HALF.LO & 0xe0) == 0) { if (this->field_0x74.HALF.LO == 0) { @@ -1368,9 +1390,9 @@ void sub_0803BA8C(Entity* this, u32 unk) { this->field_0x74.HALF.HI = 0; } if (this->type == 2) { - sVar2 = gUnk_080CFD30[this->field_0x74.HALF.HI]; + palette = gUnk_080CFD30[this->field_0x74.HALF.HI]; } else { - sVar2 = gUnk_080CFD44[this->field_0x74.HALF.HI]; + palette = gUnk_080CFD44[this->field_0x74.HALF.HI]; } } this->field_0x74.HALF.LO++; @@ -1381,14 +1403,14 @@ void sub_0803BA8C(Entity* this, u32 unk) { if ((tmp & 0x80) == 0) { this->field_0x74.HALF.LO |= 0x80; if ((tmp & 0x20) != 0) { - sVar2 = gUnk_080CFD58[this->type - 2]; + palette = gUnk_080CFD58[this->type - 2]; } else { - sVar2 = gUnk_080CFD5C[this->type - 2]; + palette = gUnk_080CFD5C[this->type - 2]; } } } - if (sVar2 != 0) { - ChangeObjPalette(this, sVar2); + if (palette != 0) { + ChangeObjPalette(this, palette); (*(Entity**)&this->parent->field_0x78)->palette.b.b0 = this->palette.raw << 0x1c >> 0x1c; (*(Entity**)&this->parent->field_0x78)->palette.b.b4 = this->palette.b.b0; this->parent->child->palette.b.b0 = this->palette.raw << 0x1c >> 0x1c; diff --git a/src/enemy/mazaalHand.c b/src/enemy/mazaalHand.c index df14d4bd..65b7d10a 100644 --- a/src/enemy/mazaalHand.c +++ b/src/enemy/mazaalHand.c @@ -4,7 +4,7 @@ * * @brief Mazaal Hand enemy */ - +#define NENT_DEPRECATED #include "entity.h" #include "hitbox.h" diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index a6a9ad92..32d00bdd 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -4,7 +4,7 @@ * * @brief Mazaal Head enemy */ - +//#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/mazaalMacro.c b/src/enemy/mazaalMacro.c index 2c8aa172..51e29b6d 100644 --- a/src/enemy/mazaalMacro.c +++ b/src/enemy/mazaalMacro.c @@ -4,46 +4,56 @@ * * @brief Mazaal Macro enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "screenTransitions.h" #include "script.h" #include "structures.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[5]; + /*0x6d*/ u8 unk_6d; + /*0x6e*/ u8 unused2[10]; + /*0x78*/ u16 unk_78; + /*0x7a*/ u8 unused3[10]; + /*0x84*/ ScriptExecutionContext* context; +} MazaalMacroEntity; + extern void sub_0807B600(u32); extern const u16 script_MazaalMacroDefeated[]; -void sub_08034E18(Entity*); -void sub_08034FA0(Entity*); -u32 sub_08035084(Entity*); -void sub_08034F70(Entity*); -void sub_08035120(Entity*); -void sub_08035050(Entity*); +void sub_08034E18(MazaalMacroEntity* this); +void sub_08034FA0(MazaalMacroEntity* this); +u32 sub_08035084(MazaalMacroEntity* this); +void sub_08034F70(MazaalMacroEntity* this); +void sub_08035120(MazaalMacroEntity* this); +void sub_08035050(MazaalMacroEntity* this); -void MazaalMacro_OnTick(Entity* this); -void MazaalMacro_OnCollision(Entity* this); -void MazaalMacro_OnDeath(Entity* this); -void sub_08034CC4(Entity* this); -void sub_08034D4C(Entity* this); -void sub_08034DC8(Entity* this); -void sub_08034E30(Entity* this); -void sub_08034E68(Entity* this); -void sub_08034EC0(Entity* this); -void sub_08034ED8(Entity* this); -void sub_08034EE4(Entity* this); -void sub_08034F58(Entity* this); +void MazaalMacro_OnTick(MazaalMacroEntity* this); +void MazaalMacro_OnCollision(MazaalMacroEntity* this); +void MazaalMacro_OnDeath(MazaalMacroEntity* this); +void sub_08034CC4(MazaalMacroEntity* this); +void sub_08034D4C(MazaalMacroEntity* this); +void sub_08034DC8(MazaalMacroEntity* this); +void sub_08034E30(MazaalMacroEntity* this); +void sub_08034E68(MazaalMacroEntity* this); +void sub_08034EC0(MazaalMacroEntity* this); +void sub_08034ED8(MazaalMacroEntity* this); +void sub_08034EE4(MazaalMacroEntity* this); +void sub_08034F58(MazaalMacroEntity* this); -void (*const MazaalMacro_Functions[])(Entity*) = { - MazaalMacro_OnTick, MazaalMacro_OnCollision, GenericKnockback, MazaalMacro_OnDeath, GenericConfused, +void (*const MazaalMacro_Functions[])(MazaalMacroEntity*) = { + MazaalMacro_OnTick, MazaalMacro_OnCollision, (void (*)(MazaalMacroEntity*))GenericKnockback, MazaalMacro_OnDeath, (void (*)(MazaalMacroEntity*))GenericConfused, }; -void (*const gUnk_080CEEA4[])(Entity*) = { +void (*const gUnk_080CEEA4[])(MazaalMacroEntity*) = { sub_08034CC4, sub_08034D4C, sub_08034DC8, }; -void (*const gUnk_080CEEB0[])(Entity*) = { +void (*const gUnk_080CEEB0[])(MazaalMacroEntity*) = { sub_08034E30, sub_08034E68, sub_08034EC0, sub_08034ED8, sub_08034EE4, sub_08034F58, }; @@ -52,101 +62,101 @@ const u8 gUnk_080CEECC[] = { 0x58, 0x68, 0x88, 0x68, 0xb8, 0x68, 0x58, 0xa8, 0x8 const s16 gUnk_080CEED8[] = { -0x82, -0x81, -0x80, -0x7f, -0x7e, -0x42, -0x41, -0x40, -0x3f, -0x3e, -2, -1, 1, 2, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x7e, 0x7f, 0x80, 0x81, 0x82 }; -void MazaalMacro(Entity* this) { - MazaalMacro_Functions[GetNextFunction(this)](this); +void MazaalMacro(MazaalMacroEntity* this) { + MazaalMacro_Functions[GetNextFunction(super)](this); } -void MazaalMacro_OnTick(Entity* this) { - if (this->type != 2) { - gUnk_080CEEA4[this->action](this); +void MazaalMacro_OnTick(MazaalMacroEntity* this) { + if (super->type != 2) { + gUnk_080CEEA4[super->action](this); } else { sub_08034E18(this); } } -void MazaalMacro_OnCollision(Entity* this) { +void MazaalMacro_OnCollision(MazaalMacroEntity* this) { sub_08034FA0(this); - EnemyFunctionHandlerAfterCollision(this, MazaalMacro_Functions); + EnemyFunctionHandlerAfterCollision(super, MazaalMacro_Functions); } -void MazaalMacro_OnDeath(Entity* this) { - GenericDeath(this); +void MazaalMacro_OnDeath(MazaalMacroEntity* this) { + GenericDeath(super); } -void sub_08034CC4(Entity* this) { +void sub_08034CC4(MazaalMacroEntity* this) { Entity* entity; if (sub_08035084(this) != 0) { - this->action = this->type + 1; - this->subtimer = 0; - this->field_0x6c.HALF.HI |= 1; - this->field_0x78.HWORD = 0x4b0; + super->action = super->type + 1; + super->subtimer = 0; + this->unk_6d |= 1; + this->unk_78 = 0x4b0; sub_08034F70(this); - InitializeAnimation(this, this->type); - SetTile(0x4022, COORD_TO_TILE(this), this->collisionLayer); + InitializeAnimation(super, super->type); + SetTile(0x4022, COORD_TO_TILE(super), super->collisionLayer); entity = CreateEnemy(MAZAAL_MACRO, 2); if (entity != NULL) { - this->child = entity; - entity->parent = this; - CopyPosition(this, entity); + super->child = entity; + entity->parent = super; + CopyPosition(super, entity); } } } -void sub_08034D4C(Entity* this) { +void sub_08034D4C(MazaalMacroEntity* this) { Entity* entity; - GetNextFrame(this); - if (--this->field_0x78.HWORD == 0) { - if ((this->subtimer < 8) && (entity = CreateEnemy(VAATI_PROJECTILE, 0), entity != (Entity*)0x0)) { + GetNextFrame(super); + if (--this->unk_78 == 0) { + if ((super->subtimer < 8) && (entity = CreateEnemy(VAATI_PROJECTILE, 0), entity != (Entity*)0x0)) { entity->direction = (s32)Random() % 5 + 0xc; entity->x.HALF.HI = (gRoomControls.width / 2) + gRoomControls.origin_x; entity->y.HALF.HI = gRoomControls.origin_y + 8; entity->collisionLayer = 3; - entity->parent = this; + entity->parent = super; UpdateSpriteForCollisionLayer(entity); - this->field_0x78.HWORD = 600; - this->subtimer = this->subtimer + 1; + this->unk_78 = 600; + super->subtimer = super->subtimer + 1; } else { - this->field_0x78.HWORD = 0x78; + this->unk_78 = 0x78; } } } -void sub_08034DC8(Entity* this) { +void sub_08034DC8(MazaalMacroEntity* this) { if (gRoomTransition.field_0x39 == 0) { - CreateFx(this, FX_GIANT_EXPLOSION4, 0); - RestorePrevTileEntity(COORD_TO_TILE(this), this->collisionLayer); + CreateFx(super, FX_GIANT_EXPLOSION4, 0); + RestorePrevTileEntity(COORD_TO_TILE(super), super->collisionLayer); DeleteThisEntity(); } } -void sub_08034E18(Entity* this) { - gUnk_080CEEB0[this->action](this); +void sub_08034E18(MazaalMacroEntity* this) { + gUnk_080CEEB0[super->action](this); } -void sub_08034E30(Entity* this) { - this->action = this->parent->type + 1; - this->collisionLayer = 2; - this->spritePriority.b0 = 7; - this->spritePriority.b1 = 0; - UpdateSpriteForCollisionLayer(this); - InitializeAnimation(this, 2); +void sub_08034E30(MazaalMacroEntity* this) { + super->action = super->parent->type + 1; + super->collisionLayer = 2; + super->spritePriority.b0 = 7; + super->spritePriority.b1 = 0; + UpdateSpriteForCollisionLayer(super); + InitializeAnimation(super, 2); } -void sub_08034E68(Entity* this) { +void sub_08034E68(MazaalMacroEntity* this) { ScriptExecutionContext* scriptExecutionContext; - if (this->parent->next == NULL) { - if (this->spriteSettings.draw != 0) { - this->spriteSettings.draw = 0; + if (super->parent->next == NULL) { + if (super->spriteSettings.draw != 0) { + super->spriteSettings.draw = 0; sub_08035120(this); } if (gRoomTransition.field_0x39 == 0) { if (PlayerCanBeMoved()) { - this->action = 3; - scriptExecutionContext = StartCutscene(this, (u16*)script_MazaalMacroDefeated); - *(ScriptExecutionContext**)&this->cutsceneBeh = scriptExecutionContext; + super->action = 3; + scriptExecutionContext = StartCutscene(super, (u16*)script_MazaalMacroDefeated); + this->context = scriptExecutionContext; } } else { DeleteThisEntity(); @@ -154,24 +164,24 @@ void sub_08034E68(Entity* this) { } } -void sub_08034EC0(Entity* this) { - if (this->parent->next == NULL) { +void sub_08034EC0(MazaalMacroEntity* this) { + if (super->parent->next == NULL) { sub_08035120(this); DeleteThisEntity(); } } -void sub_08034ED8(Entity* this) { - ExecuteScriptForEntity(this, NULL); +void sub_08034ED8(MazaalMacroEntity* this) { + ExecuteScriptForEntity(super, NULL); } -void sub_08034EE4(Entity* this) { +void sub_08034EE4(MazaalMacroEntity* this) { u32 randomValue; Entity* entity; - if ((++this->timer & 0xf) == 0) { + if ((++super->timer & 0xf) == 0) { randomValue = Random(); - entity = CreateFx(this, gUnk_080CEEC8[randomValue & 3], 0); + entity = CreateFx(super, gUnk_080CEEC8[randomValue & 3], 0); if (entity != NULL) { entity->x.HALF.HI = (((randomValue >> 2) & 0x77) << 1) + 1 + gRoomControls.scroll_x; entity->y.HALF.HI = ((randomValue >> 9) & 0x7e) + 1 + gRoomControls.scroll_y; @@ -179,59 +189,59 @@ void sub_08034EE4(Entity* this) { UpdateSpriteForCollisionLayer(entity); } } - ExecuteScriptForEntity(this, NULL); + ExecuteScriptForEntity(super, NULL); } -void sub_08034F58(Entity* this) { +void sub_08034F58(MazaalMacroEntity* this) { DoExitTransition(&gUnk_0813ABA8); - DeleteEntity(this); + DeleteEntity(super); } -void sub_08034F70(Entity* this) { - this->health = gRoomTransition.field_0x39; +void sub_08034F70(MazaalMacroEntity* this) { + super->health = gRoomTransition.field_0x39; if (gRoomTransition.field_0x39 >= 0x3d) { - this->type2 = 0; + super->type2 = 0; } else if (gRoomTransition.field_0x39 >= 0x1f) { - this->type2 = 1; + super->type2 = 1; } else { - this->type2 = 2; + super->type2 = 2; } } -void sub_08034FA0(Entity* this) { - if (0 < this->iframes) { - this->child->iframes = this->iframes; +void sub_08034FA0(MazaalMacroEntity* this) { + if (0 < super->iframes) { + super->child->iframes = super->iframes; InitScreenShake(12, 1); } - switch (this->type2) { + switch (super->type2) { case 0: - if (this->health < 0x3c) { + if (super->health < 0x3c) { gRoomTransition.field_0x39 = 0x3c; sub_08035050(this); return; } break; case 1: - if (this->health < 0x1e) { + if (super->health < 0x1e) { gRoomTransition.field_0x39 = 0x1e; sub_08035050(this); return; } break; default: - if (this->health == 0) { - RestorePrevTileEntity(COORD_TO_TILE(this), this->collisionLayer); + if (super->health == 0) { + RestorePrevTileEntity(COORD_TO_TILE(super), super->collisionLayer); } break; } - gRoomTransition.field_0x39 = this->health; + gRoomTransition.field_0x39 = super->health; } -void sub_08035050(Entity* this) { +void sub_08035050(MazaalMacroEntity* this) { Entity* entity; - COLLISION_OFF(this); - this->health = 0; + COLLISION_OFF(super); + super->health = 0; entity = CreateEnemy(VAATI_PROJECTILE, 0); if (entity != NULL) { entity->type2 = 1; @@ -241,13 +251,13 @@ void sub_08035050(Entity* this) { } } -u32 sub_08035084(Entity* this) { +u32 sub_08035084(MazaalMacroEntity* this) { u32 vulnPillar; Entity* entity; u32 i; const u8* coords; - if (this->type == 0) { + if (super->type == 0) { if (0x42 < gEntCount) { return 0; } @@ -257,7 +267,7 @@ u32 sub_08035084(Entity* this) { gRoomTransition.field_0x38 = (gRoomTransition.field_0x38 & 0xf) | (vulnPillar << 4); for (i = 0, coords = gUnk_080CEECC; i < 6; i++, coords += 2) { if (i == vulnPillar) { - entity = this; + entity = super; } else { entity = CreateEnemy(MAZAAL_MACRO, 1); } @@ -270,11 +280,11 @@ u32 sub_08035084(Entity* this) { return 1; } -void sub_08035120(Entity* this) { +void sub_08035120(MazaalMacroEntity* this) { s32 tile; u32 i; - tile = COORD_TO_TILE(this); + tile = COORD_TO_TILE(super); for (i = 0; i < 0x18; i++) { sub_0807B600(tile + gUnk_080CEED8[i]); } diff --git a/src/enemy/miniFireballGuy.c b/src/enemy/miniFireballGuy.c index be66f3da..b72a3350 100644 --- a/src/enemy/miniFireballGuy.c +++ b/src/enemy/miniFireballGuy.c @@ -4,79 +4,85 @@ * * @brief Mini Fireball Guy enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" -extern void sub_08045678(Entity*); -void MiniFireballGuy_OnTick(Entity*); -void MiniFireballGuy_OnCollision(Entity*); -void MiniFireballGuy_OnDeath(Entity*); -void MiniFireballGuy_OnGrabbed(Entity*); -void sub_08045618(Entity*); -void sub_08045654(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[4]; + /*0x6c*/ u8 unk_6c; +} MiniFireballGuyEntity; -static void (*const MiniFireballGuy_Functions[])(Entity*) = { - MiniFireballGuy_OnTick, MiniFireballGuy_OnCollision, GenericKnockback, MiniFireballGuy_OnDeath, - GenericConfused, MiniFireballGuy_OnGrabbed, +extern void sub_08045678(MiniFireballGuyEntity* this); +void MiniFireballGuy_OnTick(MiniFireballGuyEntity* this); +void MiniFireballGuy_OnCollision(MiniFireballGuyEntity* this); +void MiniFireballGuy_OnDeath(MiniFireballGuyEntity* this); +void MiniFireballGuy_OnGrabbed(MiniFireballGuyEntity* this); +void sub_08045618(MiniFireballGuyEntity* this); +void sub_08045654(MiniFireballGuyEntity* this); + +static void (*const MiniFireballGuy_Functions[])(MiniFireballGuyEntity*) = { + MiniFireballGuy_OnTick, MiniFireballGuy_OnCollision, (void (*)(MiniFireballGuyEntity*))GenericKnockback, MiniFireballGuy_OnDeath, + (void (*)(MiniFireballGuyEntity*))GenericConfused, MiniFireballGuy_OnGrabbed, }; -void MiniFireballGuy(Entity* this) { - EnemyFunctionHandler(this, MiniFireballGuy_Functions); +void MiniFireballGuy(MiniFireballGuyEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)MiniFireballGuy_Functions); } -void MiniFireballGuy_OnTick(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void MiniFireballGuy_OnTick(MiniFireballGuyEntity* this) { + static void (*const actionFuncs[])(MiniFireballGuyEntity*) = { sub_08045618, sub_08045654, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } -void MiniFireballGuy_OnCollision(Entity* this) { - EnemyFunctionHandlerAfterCollision(this, MiniFireballGuy_Functions); +void MiniFireballGuy_OnCollision(MiniFireballGuyEntity* this) { + EnemyFunctionHandlerAfterCollision(super, MiniFireballGuy_Functions); } -void MiniFireballGuy_OnDeath(Entity* this) { - if ((this != this->parent) && (this->parent != NULL)) { - this->field_0x6c.HALF.LO &= ~0x80; - this->parent->child = this->child; - this->child->parent = this->parent; +void MiniFireballGuy_OnDeath(MiniFireballGuyEntity* this) { + if ((super != super->parent) && (super->parent != NULL)) { + this->unk_6c &= ~0x80; + super->parent->child = super->child; + super->child->parent = super->parent; } - GenericDeath(this); + GenericDeath(super); } -void MiniFireballGuy_OnGrabbed(Entity* this) { +void MiniFireballGuy_OnGrabbed(MiniFireballGuyEntity* this) { } -void sub_08045618(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 1; - this->speed = 0x80; - this->collisionFlags = this->collisionFlags | 0x10; - sub_0804A720(this); - InitializeAnimation(this, 1); +void sub_08045618(MiniFireballGuyEntity* this) { + super->action = 1; + super->spriteSettings.draw = 1; + super->speed = 0x80; + super->collisionFlags = super->collisionFlags | 0x10; + sub_0804A720(super); + InitializeAnimation(super, 1); sub_08045678(this); } -void sub_08045654(Entity* this) { - ProcessMovement2(this); - GetNextFrame(this); - if (GravityUpdate(this, Q_8_8(24.0)) == 0) { +void sub_08045654(MiniFireballGuyEntity* this) { + ProcessMovement2(super); + GetNextFrame(super); + if (GravityUpdate(super, Q_8_8(24.0)) == 0) { sub_08045678(this); } } -void sub_08045678(Entity* this) { - this->zVelocity = Q_16_16(1.75); - if (this->timer != 0) { - this->timer--; +void sub_08045678(MiniFireballGuyEntity* this) { + super->zVelocity = Q_16_16(1.75); + if (super->timer != 0) { + super->timer--; } else { - this->timer = Random() & 3; - if ((sub_08049FA0(this) == 0) && (Random() & 3)) { - this->direction = DirectionRound(sub_08049EE4(this) - 4 + (Random() & 8)); + super->timer = Random() & 3; + if ((sub_08049FA0(super) == 0) && (Random() & 3)) { + super->direction = DirectionRound(sub_08049EE4(super) - 4 + (Random() & 8)); } else { - this->direction = DirectionRound(Random()); + super->direction = DirectionRound(Random()); } } } diff --git a/src/enemy/miniSlime.c b/src/enemy/miniSlime.c index 67e7675b..45108259 100644 --- a/src/enemy/miniSlime.c +++ b/src/enemy/miniSlime.c @@ -4,107 +4,112 @@ * * @brief Mini Slime enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" -void sub_08045374(Entity*); -void MiniSlime_OnTick(Entity*); -void MiniSlime_OnCollision(Entity*); -void MiniSlime_OnDeath(Entity*); -void MiniSlime_OnGrabbed(Entity*); -void sub_080452A4(Entity*); -void sub_080452E4(Entity*); -void sub_080452FC(Entity*); -void sub_08045374(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[4]; + /*0x6c*/ u8 unk_6c; + /*0x6d*/ u8 unk_6d; +} MiniSlimeEntity; + +void sub_08045374(MiniSlimeEntity* this); +void MiniSlime_OnTick(MiniSlimeEntity* this); +void MiniSlime_OnCollision(MiniSlimeEntity* this); +void MiniSlime_OnDeath(MiniSlimeEntity* this); +void MiniSlime_OnGrabbed(MiniSlimeEntity* this); +void sub_080452A4(MiniSlimeEntity* this); +void sub_080452E4(MiniSlimeEntity* this); +void sub_080452FC(MiniSlimeEntity* this); -extern void sub_080452E4(Entity*); extern void ReplaceMonitoredEntity(Entity*, Entity*); -static void (*const MiniSlime_Functions[])(Entity*) = { - MiniSlime_OnTick, MiniSlime_OnCollision, GenericKnockback, MiniSlime_OnDeath, GenericConfused, MiniSlime_OnGrabbed, +static void (*const MiniSlime_Functions[])(MiniSlimeEntity*) = { + MiniSlime_OnTick, MiniSlime_OnCollision, (void (*)(MiniSlimeEntity*))GenericKnockback, MiniSlime_OnDeath, (void (*)(MiniSlimeEntity*))GenericConfused, MiniSlime_OnGrabbed, }; -void MiniSlime(Entity* this) { - EnemyFunctionHandler(this, MiniSlime_Functions); - SetChildOffset(this, 0, 1, -8); +void MiniSlime(MiniSlimeEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)MiniSlime_Functions); + SetChildOffset(super, 0, 1, -8); } -void MiniSlime_OnTick(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void MiniSlime_OnTick(MiniSlimeEntity* this) { + static void (*const actionFuncs[])(MiniSlimeEntity*) = { sub_080452A4, sub_080452E4, sub_080452FC, sub_08045374, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } -void MiniSlime_OnCollision(Entity* this) { - if (this->confusedTime) - Create0x68FX(this, FX_STARS); +void MiniSlime_OnCollision(MiniSlimeEntity* this) { + if (super->confusedTime) + Create0x68FX(super, FX_STARS); - EnemyFunctionHandlerAfterCollision(this, MiniSlime_Functions); + EnemyFunctionHandlerAfterCollision(super, MiniSlime_Functions); } -void MiniSlime_OnDeath(Entity* this) { - Entity* parent = this->parent; - if ((this != parent) && (parent != NULL)) { - this->field_0x6c.HALF.LO &= ~0x80; - this->parent->child = this->child; - this->child->parent = this->parent; - if (this->field_0x6c.HALF.HI & 0x40) - ReplaceMonitoredEntity(this, parent); +void MiniSlime_OnDeath(MiniSlimeEntity* this) { + Entity* parent = super->parent; + if ((super != parent) && (parent != NULL)) { + this->unk_6c &= ~0x80; + super->parent->child = super->child; + super->child->parent = super->parent; + if (this->unk_6d & 0x40) + ReplaceMonitoredEntity(super, parent); } - GenericDeath(this); + GenericDeath(super); } -void MiniSlime_OnGrabbed(Entity* this) { +void MiniSlime_OnGrabbed(MiniSlimeEntity* this) { } -void sub_080452A4(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 1; - this->speed = 0x100; - sub_0804A720(this); - InitializeAnimation(this, 6); - if (this->type2) { - this->action = 2; - this->timer = 1; +void sub_080452A4(MiniSlimeEntity* this) { + super->action = 1; + super->spriteSettings.draw = 1; + super->speed = 0x100; + sub_0804A720(super); + InitializeAnimation(super, 6); + if (super->type2) { + super->action = 2; + super->timer = 1; } else { sub_080452E4(this); } } -void sub_080452E4(Entity* this) { - this->action = 2; - this->timer = (Random() & 0x1f) + 1; +void sub_080452E4(MiniSlimeEntity* this) { + super->action = 2; + super->timer = (Random() & 0x1f) + 1; } -void sub_080452FC(Entity* this) { +void sub_080452FC(MiniSlimeEntity* this) { u32 cVar2, bVar3; - GetNextFrame(this); - if (--this->timer == 0) { - this->action = 3; - this->timer = 1; - if (0 < this->speed) - this->timer = FixedDiv(0x1000, this->speed) >> 8; + GetNextFrame(super); + if (--super->timer == 0) { + super->action = 3; + super->timer = 1; + if (0 < super->speed) + super->timer = FixedDiv(0x1000, super->speed) >> 8; - if (sub_08049FA0(this) == 0 && (Random() & 3)) { - cVar2 = sub_08049EE4(this); + if (sub_08049FA0(super) == 0 && (Random() & 3)) { + cVar2 = sub_08049EE4(super); bVar3 = Random() & 8; bVar3 += 0xfc; - this->direction = DirectionRound(cVar2 + bVar3); + super->direction = DirectionRound(cVar2 + bVar3); } else { - this->direction = DirectionRound(Random()); + super->direction = DirectionRound(Random()); sub_08045374(this); } } } -void sub_08045374(Entity* this) { - ProcessMovement0(this); - GetNextFrame(this); - if (--this->timer == 0) - this->action = 1; +void sub_08045374(MiniSlimeEntity* this) { + ProcessMovement0(super); + GetNextFrame(super); + if (--super->timer == 0) + super->action = 1; } diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index facad891..8caf1f7a 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -4,9 +4,9 @@ * * @brief Moldorm enemy */ - -#include "enemy.h" +//#define NENT_DEPRECATED #include "collision.h" +#include "enemy.h" #include "functions.h" void sub_08022EAC(Entity*); diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index 04923737..db8410cb 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -4,7 +4,7 @@ * * @brief Moldworm enemy */ - +//#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/mulldozer.c b/src/enemy/mulldozer.c index f8b79c7e..f1f3059a 100644 --- a/src/enemy/mulldozer.c +++ b/src/enemy/mulldozer.c @@ -4,9 +4,7 @@ * * @brief Mulldozer enemy */ - #define NENT_DEPRECATED -#include "global.h" #include "collision.h" #include "enemy.h" diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c index 267b0acf..68ff799c 100644 --- a/src/enemy/octorok.c +++ b/src/enemy/octorok.c @@ -4,7 +4,7 @@ * * @brief Octorok enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" @@ -128,14 +128,14 @@ void Octorok_Move(Entity* this) { void Octorok_ShootNut(Entity* this) { GetNextFrame(this); if (this->frame & 1) { - Entity* ent = CreateProjectileWithParent(this, ROCK_PROJECTILE, 0); - if (ent != NULL) { + Entity* entity = CreateProjectileWithParent(this, ROCK_PROJECTILE, 0); + if (entity != NULL) { const s8* off; - ent->direction = this->direction; + entity->direction = this->direction; off = &gOctorokNutOffset[this->direction / 4]; - ent->x.HALF.HI += off[0]; - ent->y.HALF.HI += off[1]; - ent->z.HALF.HI = -3; + entity->x.HALF.HI += off[0]; + entity->y.HALF.HI += off[1]; + entity->z.HALF.HI = -3; this->frame &= 0xfe; EnqueueSFX(SFX_18D); } @@ -182,12 +182,12 @@ void Octorok_Turn(Entity* this) { } bool32 Octorok_FacesPlayer(Entity* this) { - Entity* ent = sub_08049DF4(1); + Entity* entity = sub_08049DF4(1); - if (ent == NULL) + if (entity == NULL) return FALSE; - if (DirectionRoundUp(GetFacingDirection(this, ent)) != this->direction) + if (DirectionRoundUp(GetFacingDirection(this, entity)) != this->direction) return FALSE; return TRUE; diff --git a/src/enemy/octorokGolden.c b/src/enemy/octorokGolden.c index 12be6a8f..7c0fd384 100644 --- a/src/enemy/octorokGolden.c +++ b/src/enemy/octorokGolden.c @@ -1,6 +1,13 @@ +/** + * @file octorokGolden.c + * @ingroup Enemies + * + * @brief Golden Octorock enemy + */ +#define NENT_DEPRECATED #include "collision.h" -#include "map.h" #include "enemy.h" +#include "map.h" #include "player.h" #include "item.h" diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index 7b5ead2a..d0fe6e28 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -4,21 +4,30 @@ * * @brief Peahat enemy */ - +#define NENT_DEPRECATED #include "enemy.h" -#include "room.h" #include "physics.h" +#include "room.h" -extern void (*const Peahat_Functions[])(Entity*); -extern void (*const gPeahatPropellerFunctions[])(Entity*); -extern void (*const gPeahatActions[])(Entity*); -extern void (*const gUnk_080CA5BC[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; +} PeahatEntity; + +extern void (*const Peahat_Functions[])(PeahatEntity*); +extern void (*const gPeahatPropellerFunctions[])(PeahatEntity*); +extern void (*const gPeahatActions[])(PeahatEntity*); +extern void (*const gUnk_080CA5BC[])(PeahatEntity*); extern const s8 gPeahatFlightHeights[]; extern const s8 gUnk_080CA5D4[]; -void sub_080205F8(Entity*); -void sub_08020604(Entity*); +void sub_080205F8(PeahatEntity* this); +void sub_08020604(PeahatEntity* this); extern Entity* gUnk_020000B0; @@ -36,354 +45,354 @@ enum { PeahatAnimation_RepairPropeller, }; -void Peahat(Entity* this) { - if (this->type == PeahatForm_Torso) { - EnemyFunctionHandler(this, Peahat_Functions); - SetChildOffset(this, 0, 1, -0x10); +void Peahat(PeahatEntity* this) { + if (super->type == PeahatForm_Torso) { + EnemyFunctionHandler(super, (EntityActionArray)Peahat_Functions); + SetChildOffset(super, 0, 1, -0x10); } else { - gPeahatPropellerFunctions[this->action](this); + gPeahatPropellerFunctions[super->action](this); } } -void Peahat_OnTick(Entity* this) { - gPeahatActions[this->action](this); - if (this->field_0x80.HALF.HI) - this->z.HALF.HI = gPeahatFlightHeights[(this->subtimer++ & 0x30) >> 4]; +void Peahat_OnTick(PeahatEntity* this) { + gPeahatActions[super->action](this); + if (this->unk_81) + super->z.HALF.HI = gPeahatFlightHeights[(super->subtimer++ & 0x30) >> 4]; } -void Peahat_OnCollision(Entity* this) { - if (this->field_0x82.HALF.LO) { - if (this->contactFlags == 0x94) { - Entity* ent = CreateEnemy(PEAHAT, PeahatForm_Propeller); - if (ent != NULL) { - CopyPosition(this, ent); - ent->z.HALF.HI -= 8; +void Peahat_OnCollision(PeahatEntity* this) { + if (this->unk_82) { + if (super->contactFlags == 0x94) { + Entity* entity = CreateEnemy(PEAHAT, PeahatForm_Propeller); + if (entity != NULL) { + CopyPosition(super, entity); + entity->z.HALF.HI -= 8; } - this->field_0x82.HALF.LO = 0; - this->animationState = PeahatAnimation_SlicedPropeller; - this->action = 5; - this->speed = 0x80; - this->iframes = -30; - this->field_0x80.HALF.HI = 0; - InitializeAnimation(this, this->animationState); - } else if (this->contactFlags == 0x9b) { - this->animationState = PeahatAnimation_BrokenPropeller; - this->action = 5; - this->speed = 0x80; - this->iframes = -30; - this->field_0x80.HALF.HI = 0; - InitializeAnimation(this, this->animationState); - } else if (this->contactFlags == 0x80) { - if (this->animationState == PeahatAnimation_Flying) { - this->action = 1; - this->timer = 30; - this->speed = 0x80; - this->direction = -1; - this->field_0x82.HALF.HI = 0x78; - GetNextFrame(this); + this->unk_82 = 0; + super->animationState = PeahatAnimation_SlicedPropeller; + super->action = 5; + super->speed = 0x80; + super->iframes = -30; + this->unk_81 = 0; + InitializeAnimation(super, super->animationState); + } else if (super->contactFlags == 0x9b) { + super->animationState = PeahatAnimation_BrokenPropeller; + super->action = 5; + super->speed = 0x80; + super->iframes = -30; + this->unk_81 = 0; + InitializeAnimation(super, super->animationState); + } else if (super->contactFlags == 0x80) { + if (super->animationState == PeahatAnimation_Flying) { + super->action = 1; + super->timer = 30; + super->speed = 0x80; + super->direction = -1; + this->unk_83 = 0x78; + GetNextFrame(super); } } } - if (this->confusedTime) - Create0x68FX(this, FX_STARS); + if (super->confusedTime) + Create0x68FX(super, FX_STARS); - EnemyFunctionHandlerAfterCollision(this, Peahat_Functions); + EnemyFunctionHandlerAfterCollision(super, Peahat_Functions); } -void Peahat_OnGrabbed(Entity* this) { - if (2 >= this->subAction && !sub_0806F520(this)) +void Peahat_OnGrabbed(PeahatEntity* this) { + if (2 >= super->subAction && !sub_0806F520(super)) return; - gUnk_080CA5BC[this->subAction](this); + gUnk_080CA5BC[super->subAction](this); } -void sub_080200B4(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 60; - if (this->animationState == PeahatAnimation_Flying) { - this->animationState = PeahatAnimation_BrokenPropeller; - this->action = 5; - this->hitType = 0x71; - this->field_0x80.HALF.HI = 0; - InitializeAnimation(this, this->animationState); +void sub_080200B4(PeahatEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 60; + if (super->animationState == PeahatAnimation_Flying) { + super->animationState = PeahatAnimation_BrokenPropeller; + super->action = 5; + super->hitType = 0x71; + this->unk_81 = 0; + InitializeAnimation(super, super->animationState); } } -void sub_080200E4(Entity* this) { - sub_0806F4E8(this); +void sub_080200E4(PeahatEntity* this) { + sub_0806F4E8(super); } -void sub_080200EC(Entity* this) { - sub_0806F3E4(this); +void sub_080200EC(PeahatEntity* this) { + sub_0806F3E4(super); } -void sub_080200F4(Entity* this) { - COLLISION_OFF(this); +void sub_080200F4(PeahatEntity* this) { + COLLISION_OFF(super); } -void nullsub_5(Entity* this) { +void nullsub_5(PeahatEntity* this) { } -void sub_08020104(Entity* this) { - if (this->flags & ENT_COLLIDE) { - COLLISION_ON(this); - this->gustJarState &= 0xfb; +void sub_08020104(PeahatEntity* this) { + if (super->flags & ENT_COLLIDE) { + COLLISION_ON(super); + super->gustJarState &= 0xfb; } else { - this->health = 0; + super->health = 0; } } -void Peahat_Initialize(Entity* this) { - sub_0804A720(this); - this->action = 1; - this->timer = 16; - this->subtimer = Random(); - this->direction = Random() & 0x1f; - this->gustJarFlags = 18; - this->field_0x80.HALF.LO = (Random() & 1) ? 2 : -2; - this->field_0x80.HALF.HI = 1; - this->field_0x82.HALF.LO = 1; - this->animationState = PeahatAnimation_Flying; - InitializeAnimation(this, this->animationState); +void Peahat_Initialize(PeahatEntity* this) { + sub_0804A720(super); + super->action = 1; + super->timer = 16; + super->subtimer = Random(); + super->direction = Random() & 0x1f; + super->gustJarFlags = 18; + this->unk_80 = (Random() & 1) ? 2 : -2; + this->unk_81 = 1; + this->unk_82 = 1; + super->animationState = PeahatAnimation_Flying; + InitializeAnimation(super, super->animationState); } -void Peahat_Fly(Entity* this) { - if (this->field_0x82.HALF.HI) - this->field_0x82.HALF.HI--; +void Peahat_Fly(PeahatEntity* this) { + if (this->unk_83) + this->unk_83--; - if (sub_08049FDC(this, 1)) { - if (this->field_0x82.HALF.HI == 0 && (this->subtimer & 0xf) == 0 && sub_08049F1C(this, gUnk_020000B0, 0x30)) { - this->action = 2; - this->subAction = Random() & 3; - this->timer = 60; - this->speed = 160; + if (sub_08049FDC(super, 1)) { + if (this->unk_83 == 0 && (super->subtimer & 0xf) == 0 && sub_08049F1C(super, gUnk_020000B0, 0x30)) { + super->action = 2; + super->subAction = Random() & 3; + super->timer = 60; + super->speed = 160; } } - if (--this->timer == 0) { - this->timer = 16; + if (--super->timer == 0) { + super->timer = 16; sub_08020604(this); if ((Random() & 3) == 0) { - this->field_0x80.HALF.LO = (Random() & 1) ? 2 : -2; + this->unk_80 = (Random() & 1) ? 2 : -2; } } - ProcessMovement2(this); - GetNextFrame(this); + ProcessMovement2(super); + GetNextFrame(super); } -void Peahat_ChargeStart(Entity* this) { - if (sub_08049FDC(this, 1)) { - if (--this->timer) { - UpdateAnimationVariableFrames(this, 4 - ((this->timer >> 4) & 0x3)); +void Peahat_ChargeStart(PeahatEntity* this) { + if (sub_08049FDC(super, 1)) { + if (--super->timer) { + UpdateAnimationVariableFrames(super, 4 - ((super->timer >> 4) & 0x3)); return; } else { - this->action = 3; - this->timer = 120; - this->speed = 192; - this->direction = (GetFacingDirection(this, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & 0x1f; + super->action = 3; + super->timer = 120; + super->speed = 192; + super->direction = (GetFacingDirection(super, gUnk_020000B0) + gUnk_080CA5D4[Random() & 1]) & 0x1f; } } else { sub_080205F8(this); } - UpdateAnimationVariableFrames(this, 4); + UpdateAnimationVariableFrames(super, 4); } -void Peahat_ChargeTarget(Entity* this) { - if (sub_08049FDC(this, 1)) { - if (--this->timer == 0) { +void Peahat_ChargeTarget(PeahatEntity* this) { + if (sub_08049FDC(super, 1)) { + if (--super->timer == 0) { sub_080205F8(this); } - if (this->timer > 60) { - if (this->timer & 1) - this->speed += 4; + if (super->timer > 60) { + if (super->timer & 1) + super->speed += 4; if ((gRoomTransition.frameCount & 3) == 0) - sub_08004596(this, GetFacingDirection(this, gUnk_020000B0)); + sub_08004596(super, GetFacingDirection(super, gUnk_020000B0)); } - ProcessMovement2(this); + ProcessMovement2(super); } else { sub_080205F8(this); } - UpdateAnimationVariableFrames(this, 4); + UpdateAnimationVariableFrames(super, 4); } -void Peahat_ChargeEnd(Entity* this) { - if (--this->timer == 0) { - this->action = 1; - this->timer = 1; - this->speed = 128; - this->field_0x82.HALF.HI = 120; - GetNextFrame(this); +void Peahat_ChargeEnd(PeahatEntity* this) { + if (--super->timer == 0) { + super->action = 1; + super->timer = 1; + super->speed = 128; + this->unk_83 = 120; + GetNextFrame(super); } else { - if (this->timer & 1) - this->speed -= 8; + if (super->timer & 1) + super->speed -= 8; - ProcessMovement2(this); - UpdateAnimationVariableFrames(this, 4); + ProcessMovement2(super); + UpdateAnimationVariableFrames(super, 4); } } -void Peahat_Stunned(Entity* this) { - switch (this->animationState) { +void Peahat_Stunned(PeahatEntity* this) { + switch (super->animationState) { default: - if (sub_080044EC(this, 0x1800) == 0) { - this->action = 6; - this->timer = 240; - this->subtimer = 10; - this->hitType = 0x71; + if (sub_080044EC(super, 0x1800) == 0) { + super->action = 6; + super->timer = 240; + super->subtimer = 10; + super->hitType = 0x71; } - if (this->direction == 0xff) - this->direction = this->knockbackDirection; + if (super->direction == 0xff) + super->direction = super->knockbackDirection; - ProcessMovement0(this); - GetNextFrame(this); + ProcessMovement0(super); + GetNextFrame(super); break; case PeahatAnimation_SlicedPropeller: - GravityUpdate(this, Q_8_8(28.0)); - if (this->z.HALF.HI == 0) { - this->action = 7; - this->timer = 150; - this->subtimer = 10; - this->hitType = 0x71; + GravityUpdate(super, Q_8_8(28.0)); + if (super->z.HALF.HI == 0) { + super->action = 7; + super->timer = 150; + super->subtimer = 10; + super->hitType = 0x71; } break; }; } -void Peahat_RepairPropeller(Entity* this) { - if ((this->subtimer != 0) && (--this->subtimer == 0)) { - Create0x68FX(this, FX_STARS); +void Peahat_RepairPropeller(PeahatEntity* this) { + if ((super->subtimer != 0) && (--super->subtimer == 0)) { + Create0x68FX(super, FX_STARS); } - if (sub_0800442E(this) || (--this->timer == 0)) { - this->action = 9; - this->zVelocity = Q_16_16(1.5); - this->direction = Random() & 0x1f; - sub_0804AA1C(this); - this->animationState = PeahatAnimation_RepairPropeller; - InitializeAnimation(this, this->animationState); + if (sub_0800442E(super) || (--super->timer == 0)) { + super->action = 9; + super->zVelocity = Q_16_16(1.5); + super->direction = Random() & 0x1f; + sub_0804AA1C(super); + super->animationState = PeahatAnimation_RepairPropeller; + InitializeAnimation(super, super->animationState); } } -void Peahat_Recover(Entity* this) { - if ((this->subtimer != 0) && (--this->subtimer == 0)) { - Create0x68FX(this, FX_STARS); +void Peahat_Recover(PeahatEntity* this) { + if ((super->subtimer != 0) && (--super->subtimer == 0)) { + Create0x68FX(super, FX_STARS); } - if (sub_0800442E(this) || (--this->timer == 0)) { - this->action = 8; - this->timer = 240; - this->direction = Random() & 0x1f; - sub_0804AA1C(this); + if (sub_0800442E(super) || (--super->timer == 0)) { + super->action = 8; + super->timer = 240; + super->direction = Random() & 0x1f; + sub_0804AA1C(super); } } -void Peahat_Hop(Entity* this) { - GetNextFrame(this); - if (--this->timer == 0) { - if (this->frame & ANIM_DONE) { - this->action = 9; - this->zVelocity = Q_16_16(1.5); - this->animationState = PeahatAnimation_NewPropeller; - InitializeAnimation(this, this->animationState); +void Peahat_Hop(PeahatEntity* this) { + GetNextFrame(super); + if (--super->timer == 0) { + if (super->frame & ANIM_DONE) { + super->action = 9; + super->zVelocity = Q_16_16(1.5); + super->animationState = PeahatAnimation_NewPropeller; + InitializeAnimation(super, super->animationState); } else { - this->timer = 1; + super->timer = 1; } } - if (this->frame & 2) { - this->frame &= ~2; - this->direction = Random() & 0x1f; + if (super->frame & 2) { + super->frame &= ~2; + super->direction = Random() & 0x1f; } - if (this->frame & 1) { - sub_0800442E(this); + if (super->frame & 1) { + sub_0800442E(super); } else { - ProcessMovement0(this); + ProcessMovement0(super); } } -void Peahat_Takeoff(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 1; - this->hitType = 0x70; - this->field_0x82.HALF.LO = 1; - this->field_0x80.HALF.HI = 1; - this->animationState = PeahatAnimation_Flying; - InitializeAnimation(this, this->animationState); - } else if (this->frame & 1) { - sub_0800442E(this); +void Peahat_Takeoff(PeahatEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 1; + super->hitType = 0x70; + this->unk_82 = 1; + this->unk_81 = 1; + super->animationState = PeahatAnimation_Flying; + InitializeAnimation(super, super->animationState); + } else if (super->frame & 1) { + sub_0800442E(super); } else { - GravityUpdate(this, Q_8_8(28.0)); - ProcessMovement0(this); + GravityUpdate(super, Q_8_8(28.0)); + ProcessMovement0(super); } } -void PeahatPropeller_Initialize(Entity* this) { - this->action = 1; - this->timer = 240; - this->subtimer = 40; - this->spriteSettings.draw = 1; - this->spriteRendering.b3 = 1; - this->spriteOrientation.flipY = 1; - this->spriteSettings.shadow = 0; - this->speed = 0x20; - this->direction = (Random() & 0x10) + 8; - InitializeAnimation(this, PeahatAnimation_Propeller); +void PeahatPropeller_Initialize(PeahatEntity* this) { + super->action = 1; + super->timer = 240; + super->subtimer = 40; + super->spriteSettings.draw = 1; + super->spriteRendering.b3 = 1; + super->spriteOrientation.flipY = 1; + super->spriteSettings.shadow = 0; + super->speed = 0x20; + super->direction = (Random() & 0x10) + 8; + InitializeAnimation(super, PeahatAnimation_Propeller); } -void PeahatPropeller_Fly(Entity* this) { - GetNextFrame(this); - if (--this->timer == 0) { - DeleteEntity(this); +void PeahatPropeller_Fly(PeahatEntity* this) { + GetNextFrame(super); + if (--super->timer == 0) { + DeleteEntity(super); } else { - if (this->timer < 60) - this->spriteSettings.draw ^= 1; + if (super->timer < 60) + super->spriteSettings.draw ^= 1; - this->z.WORD -= Q_16_16(0.75); - LinearMoveUpdate(this); - if (--this->subtimer == 0) { - this->subtimer = 40; - this->direction = (Random() & 0x10) + 8; + super->z.WORD -= Q_16_16(0.75); + LinearMoveUpdate(super); + if (--super->subtimer == 0) { + super->subtimer = 40; + super->direction = (Random() & 0x10) + 8; } } } -void sub_080205F8(Entity* this) { - this->action = 4; - this->timer = 60; +void sub_080205F8(PeahatEntity* this) { + super->action = 4; + super->timer = 60; } -void sub_08020604(Entity* this) { - if (!sub_08049FA0(this) && (Random() & 3)) { - this->direction = sub_08049EE4(this); +void sub_08020604(PeahatEntity* this) { + if (!sub_08049FA0(super) && (Random() & 3)) { + super->direction = sub_08049EE4(super); } else { - this->direction += this->field_0x80.HALF.LO; - this->direction &= 0x1f; + super->direction += this->unk_80; + super->direction &= 0x1f; } } // clang-format off -void (*const Peahat_Functions[])(Entity*) = { +void (*const Peahat_Functions[])(PeahatEntity*) = { Peahat_OnTick, Peahat_OnCollision, - GenericKnockback, - GenericDeath, - GenericConfused, + (void (*)(PeahatEntity*))GenericKnockback, + (void (*)(PeahatEntity*))GenericDeath, + (void (*)(PeahatEntity*))GenericConfused, Peahat_OnGrabbed, }; -void (*const gPeahatPropellerFunctions[])(Entity*) = { +void (*const gPeahatPropellerFunctions[])(PeahatEntity*) = { PeahatPropeller_Initialize, PeahatPropeller_Fly, }; -void (*const gPeahatActions[])(Entity*) = { +void (*const gPeahatActions[])(PeahatEntity*) = { Peahat_Initialize, Peahat_Fly, Peahat_ChargeStart, @@ -400,7 +409,7 @@ const s8 gPeahatFlightHeights[] = { -5, -6, -7, -6, }; -void (*const gUnk_080CA5BC[])(Entity*) = { +void (*const gUnk_080CA5BC[])(PeahatEntity*) = { sub_080200B4, sub_080200E4, sub_080200EC, diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index b395ba9e..5d13addb 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -4,13 +4,13 @@ * * @brief Pesto enemy */ - -#include "enemy.h" +//#define NENT_DEPRECATED #include "collision.h" -#include "object.h" +#include "enemy.h" #include "game.h" -#include "save.h" +#include "object.h" #include "playeritem.h" +#include "save.h" void sub_080249F4(Entity*); void sub_08024940(Entity*); @@ -166,14 +166,14 @@ void sub_080240B8(Entity* this) { sub_080249DC(this); if (this->type == 1) { - Entity* ent; + Entity* entity; this->field_0x82.HALF.HI = 0; - ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); - if (ent != NULL) { - this->child = ent; - ent->parent = this; - ent->y.HALF.HI += 0x10; + entity = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); + if (entity != NULL) { + this->child = entity; + entity->parent = this; + entity->y.HALF.HI += 0x10; } } } @@ -403,7 +403,7 @@ void sub_080244E8(Entity* this) { break; case 1: if (EntityInRectRadius(this, this->child, 6, 6)) { - Entity* ent; + Entity* entity; this->field_0x80.HALF.LO++; this->timer = 12; @@ -412,34 +412,34 @@ void sub_080244E8(Entity* this) { this->z.HALF.HI -= 0xe; this->field_0x78.HWORD -= 0xe; - ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); - if (ent != NULL) { - ent->parent = this; - ent->z.HALF.HI += 0xe; - ent->child = this->child; - CopyPosition(ent, ent->child); - this->child = ent; + entity = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); + if (entity != NULL) { + entity->parent = this; + entity->z.HALF.HI += 0xe; + entity->child = this->child; + CopyPosition(entity, entity->child); + this->child = entity; } } break; case 2: if (EntityInRectRadius(this, this->child, 6, 6)) { - Entity* ent; + Entity* entity; this->field_0x80.HALF.LO++; this->timer = 12; this->field_0x82.HALF.HI &= ~0x80; - ent = this->child; - SetTile((u16)ent->field_0x70.HALF.LO, COORD_TO_TILE(ent), ent->collisionLayer); - DeleteEntity(ent); + entity = this->child; + SetTile((u16)entity->field_0x70.HALF.LO, COORD_TO_TILE(entity), entity->collisionLayer); + DeleteEntity(entity); this->z.HALF.HI -= 0xe; this->field_0x78.HWORD -= 0xe; - ent = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); - if (ent != NULL) { - ent->parent = this; - ent->z.HALF.HI += 0xe; - this->child = ent; + entity = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); + if (entity != NULL) { + entity->parent = this; + entity->z.HALF.HI += 0xe; + this->child = entity; } } break; @@ -635,7 +635,7 @@ bool32 sub_08024AD8(Entity* this) { bool32 sub_08024B38(Entity* this) { int iVar4 = 0; - Entity* ent; + Entity* entity; if (gPlayerState.hurtBlinkSpeed != 0) { if (gPlayerState.swim_state == 1) { @@ -660,34 +660,34 @@ bool32 sub_08024B38(Entity* this) { } } - ent = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2); - if (ent != NULL) { + entity = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2); + if (entity != NULL) { do { - if (ent->action != 2 && ent->z.HALF.HI == 0 && sub_08049F1C(this, ent, 0xa0)) { + if (entity->action != 2 && entity->z.HALF.HI == 0 && sub_08049F1C(this, entity, 0xa0)) { iVar4 = 1; - this->child = ent; + this->child = entity; this->field_0x82.HALF.HI |= 1; this->field_0x82.HALF.HI &= ~0x40; break; } - } while (ent = FindNextDuplicateID(ent, 2), ent != NULL); + } while (entity = FindNextDuplicateID(entity, 2), entity != NULL); } if (iVar4 != 0) { return iVar4; } - ent = FindEntityByID(OBJECT, POT, 6); - if (ent != NULL) { + entity = FindEntityByID(OBJECT, POT, 6); + if (entity != NULL) { do { - if (ent->action == 1 && sub_08049F1C(this, ent, 0xa0)) { + if (entity->action == 1 && sub_08049F1C(this, entity, 0xa0)) { iVar4 = 1; - this->child = ent; + this->child = entity; this->field_0x82.HALF.HI |= 2; this->field_0x82.HALF.HI &= ~0x40; break; } - } while (ent = FindNextDuplicateID(ent, 6), ent != NULL); + } while (entity = FindNextDuplicateID(entity, 6), entity != NULL); } if (iVar4 == 0) { diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index 63ef70b4..03f8f0e8 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -4,11 +4,31 @@ * * @brief Puffstool enemy */ - +//#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "object.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u16 unk_78; + /*0x7a*/ u8 unk_7a; + /*0x7b*/ u8 unk_7b; + /*0x7c*/ u8 unk_7c; +// // Overlap of 1 +// /*0x7c*/ u16 unk_7c; +// Overlap of 1 + /*0x7d*/ u8 unk_7d; + /*0x7e*/ u16 unk_7e; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unused2[1]; + /*0x84*/ u16 unk_84; + /*0x86*/ u16 unk_86; +} PuffstoolEntity; + extern u8 gUnk_080B3E80[]; bool32 sub_080258C4(Entity*); @@ -83,10 +103,10 @@ void Puffstool_OnCollide(Entity* this) { break; default: if (this->hitType == 0x82 && this->iframes < 0) { - Entity* ent = CreateObject(DIRT_PARTICLE, 2, 0); - if (ent != NULL) { - ent->spritePriority.b0 = 3; - CopyPosition(this, ent); + Entity* entity = CreateObject(DIRT_PARTICLE, 2, 0); + if (entity != NULL) { + entity->spritePriority.b0 = 3; + CopyPosition(this, entity); } EnqueueSFX(SFX_186); } @@ -299,12 +319,12 @@ void sub_08025514(Entity* this) { } void sub_08025554(Entity* this) { - Entity* ent = sub_08049DF4(1); - if (ent == NULL) { + Entity* entity = sub_08049DF4(1); + if (entity == NULL) { sub_080256B4(this); } else { if ((this->timer & 3) == 0) { - this->direction = GetFacingDirection(ent, this); + this->direction = GetFacingDirection(entity, this); } sub_08025C44(this); GetNextFrame(this); @@ -319,8 +339,8 @@ void sub_08025554(Entity* this) { } void sub_080255AC(Entity* this) { - Entity* ent = sub_08049DF4(1); - if (ent == NULL) { + Entity* entity = sub_08049DF4(1); + if (entity == NULL) { sub_080256B4(this); } else { if (this->field_0x80.HALF.HI != 0) { @@ -338,7 +358,7 @@ void sub_080255AC(Entity* this) { } tmp -= 7; - this->direction = (GetFacingDirection(ent, this) + tmp) & 0x1f; + this->direction = (GetFacingDirection(entity, this) + tmp) & 0x1f; } if (this->field_0x78.HWORD == 0) { @@ -437,15 +457,15 @@ bool32 sub_080257EC(Entity* this, u32 x, u32 y) { } bool32 sub_080258C4(Entity* this) { - Entity* ent = sub_08049DF4(1); - if (ent == NULL) { + Entity* entity = sub_08049DF4(1); + if (entity == NULL) { return FALSE; } else { s32 iVar4; s32 iVar1; - iVar4 = ent->x.HALF.HI - this->x.HALF.HI; + iVar4 = entity->x.HALF.HI - this->x.HALF.HI; iVar4 = iVar4 * iVar4; - iVar1 = ent->y.HALF.HI - this->y.HALF.HI; + iVar1 = entity->y.HALF.HI - this->y.HALF.HI; iVar1 = iVar1 * iVar1; iVar4 = iVar4 + iVar1; if (this->cutsceneBeh.HWORD == 0 && this->field_0x80.HALF.HI == 0 && 0x400 >= iVar4) { @@ -522,21 +542,21 @@ bool32 sub_08025AB8(u32 tile, u32 layer) { } void sub_08025AE8(Entity* this) { - Entity* ent; + Entity* entity; - ent = CreateFx(this, FX_BROWN_SMOKE, 0); - if (ent != NULL) { - ent->y.WORD--; + entity = CreateFx(this, FX_BROWN_SMOKE, 0); + if (entity != NULL) { + entity->y.WORD--; } - ent = CreateFx(this, FX_BROWN_SMOKE_LARGE, 0); - if (ent != NULL) { - ent->y.WORD++; + entity = CreateFx(this, FX_BROWN_SMOKE_LARGE, 0); + if (entity != NULL) { + entity->y.WORD++; } } void sub_08025B18(Entity* this) { - Entity* ent; + Entity* entity; s32 x = this->x.HALF.HI - gRoomControls.origin_x; s32 y = this->y.HALF.HI - gRoomControls.origin_y; @@ -548,25 +568,25 @@ 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(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; - ent->x.HALF.HI += 8; - ent->y.HALF.HI &= -0x10; - ent->y.HALF.HI += 8; - ent->z.HALF.HI = -1; + entity = CreateObject(DIRT_PARTICLE, 2, 0); + if (entity != NULL) { + PositionRelative(this, entity, Q_16_16(offset[0]), Q_16_16(offset[1])); + entity->x.HALF.HI &= -0x10; + entity->x.HALF.HI += 8; + entity->y.HALF.HI &= -0x10; + entity->y.HALF.HI += 8; + entity->z.HALF.HI = -1; } } } void sub_08025BD4(Entity* this) { if (this->field_0x82.HALF.LO && (this->frame & 1) == 0) { - Entity* ent = CreateObject(DIRT_PARTICLE, 0, 0); - if (ent != NULL) { - PositionRelative(this, ent, Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 0]), + Entity* entity = CreateObject(DIRT_PARTICLE, 0, 0); + if (entity != NULL) { + PositionRelative(this, entity, Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 0]), Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 1])); - ent->z.HALF.HI = -10; + entity->z.HALF.HI = -10; } } } diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c index 893ec8b6..c1d77726 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -4,7 +4,7 @@ * * @brief Rock Chuchu enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "player.h" @@ -20,7 +20,7 @@ void RockChuchu_OnTick(Entity* this) { } void RockChuchu_OnCollision(Entity* this) { - Entity* ent; + Entity* entity; if (this->health) { switch (this->contactFlags & 0x7f) { @@ -44,18 +44,18 @@ void RockChuchu_OnCollision(Entity* this) { case 0x16: case 0x1c: CreateFx(this, FX_ROCK, 0); - ent = CreateEnemy(CHUCHU, 1); - if (ent != NULL) { - ent->type2 = 1; + entity = CreateEnemy(CHUCHU, 1); + if (entity != NULL) { + entity->type2 = 1; #ifndef EU - ent->iframes = -8; + entity->iframes = -8; #endif - sub_0804A4E4(this, ent); + sub_0804A4E4(this, entity); this->action = 2; COLLISION_OFF(this); this->spriteSettings.draw = 0; this->direction = this->knockbackDirection; - this->child = ent; + this->child = entity; } } } else { @@ -97,15 +97,15 @@ void sub_08022390(Entity* this) { } void sub_080223E4(Entity* this) { - Entity* ent; + Entity* entity; - ent = this->child; - if (ent != NULL) { - ent->contactFlags = 0x94; - ent->iframes = 0x10; + entity = this->child; + if (entity != NULL) { + entity->contactFlags = 0x94; + entity->iframes = 0x10; #ifndef EU - ent->knockbackDuration = 0xc; - ent->knockbackDirection = this->direction; + entity->knockbackDuration = 0xc; + entity->knockbackDirection = this->direction; #endif } diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index f55a3c34..2a3a7fbe 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -4,281 +4,288 @@ * * @brief Rollobite enemy */ - +#define NENT_DEPRECATED +#include "collision.h" #include "enemy.h" #include "physics.h" #include "player.h" #include "room.h" -#include "collision.h" -extern void (*const Rollobite_Functions[])(Entity*); -extern void (*const gRollobiteActions[])(Entity*); -extern void (*const gUnk_080CA6A4[])(Entity*); -extern void (*const gUnk_080CA6BC[])(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[28]; + /*0x84*/ u8 unk_84; + /*0x85*/ u8 unk_85; +} RollobiteEntity; + +extern void (*const Rollobite_Functions[])(RollobiteEntity*); +extern void (*const gRollobiteActions[])(RollobiteEntity*); +extern void (*const gUnk_080CA6A4[])(RollobiteEntity*); +extern void (*const gUnk_080CA6BC[])(RollobiteEntity*); extern const u8 gUnk_080CA6CC[]; extern const s8 gUnk_080CA6D4[]; -void sub_08020A30(Entity*); -void sub_08020A7C(Entity*); -bool32 Rollobite_TryToHoleUp(Entity*); -bool32 Rollobite_IsRolledUp(Entity*); +void sub_08020A30(RollobiteEntity* this); +void sub_08020A7C(RollobiteEntity* this); +bool32 Rollobite_TryToHoleUp(RollobiteEntity* this); +bool32 Rollobite_IsRolledUp(RollobiteEntity* this); extern void RegisterCarryEntity(Entity*); -void Rollobite(Entity* this) { - EnemyFunctionHandler(this, Rollobite_Functions); +void Rollobite(RollobiteEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)Rollobite_Functions); } -void Rollobite_OnTick(Entity* this) { +void Rollobite_OnTick(RollobiteEntity* this) { Rollobite_TryToHoleUp(this); - gRollobiteActions[this->action](this); + gRollobiteActions[super->action](this); } -void Rollobite_OnCollision(Entity* this) { - if (this->hitType == 34 && this->health != 0xff) { - this->action = 4; - this->zVelocity = Q_16_16(2.0); - this->direction = 0xff; - this->health = 0xff; - this->hitType = 35; - InitializeAnimation(this, this->animationState + 8); +void Rollobite_OnCollision(RollobiteEntity* this) { + if (super->hitType == 34 && super->health != 0xff) { + super->action = 4; + super->zVelocity = Q_16_16(2.0); + super->direction = 0xff; + super->health = 0xff; + super->hitType = 35; + InitializeAnimation(super, super->animationState + 8); } - if (this->contactFlags != 0x80) { - if (this->action == 4 || this->action == 5) { - this->action = 4; - this->timer = 180; - this->direction = 0xff; - InitializeAnimation(this, this->animationState + 0x10); + if (super->contactFlags != 0x80) { + if (super->action == 4 || super->action == 5) { + super->action = 4; + super->timer = 180; + super->direction = 0xff; + InitializeAnimation(super, super->animationState + 0x10); } } - if (this->contactFlags == 0x93) + if (super->contactFlags == 0x93) Rollobite_OnTick(this); } -void Rollobite_OnKnockback(Entity* this) { +void Rollobite_OnKnockback(RollobiteEntity* this) { if (Rollobite_TryToHoleUp(this)) { - this->knockbackDuration = 0; + super->knockbackDuration = 0; } else if (Rollobite_IsRolledUp(this)) { - this->knockbackDuration--; - CalculateEntityTileCollisions(this, this->knockbackDirection, 10); - ProcessMovementInternal(this, this->knockbackSpeed, this->knockbackDirection, 10); + super->knockbackDuration--; + CalculateEntityTileCollisions(super, super->knockbackDirection, 10); + ProcessMovementInternal(super, super->knockbackSpeed, super->knockbackDirection, 10); } else { - GenericKnockback(this); + GenericKnockback(super); } } -void Rollobite_OnGrabbed(Entity* this) { - if (this->subAction < 3 && !sub_0806F520(this)) { - this->action = 4; - COLLISION_ON(this); - this->direction = 0xff; - InitializeAnimation(this, this->animationState + 0x10); +void Rollobite_OnGrabbed(RollobiteEntity* this) { + if (super->subAction < 3 && !sub_0806F520(super)) { + super->action = 4; + COLLISION_ON(super); + super->direction = 0xff; + InitializeAnimation(super, super->animationState + 0x10); } else { - gUnk_080CA6A4[this->subAction](this); + gUnk_080CA6A4[super->subAction](this); } } -void sub_0802077C(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 60; +void sub_0802077C(RollobiteEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 60; } -void sub_08020788(Entity* this) { - sub_0806F4E8(this); +void sub_08020788(RollobiteEntity* this) { + sub_0806F4E8(super); } -void sub_08020790(Entity* this) { - sub_0806F3E4(this); +void sub_08020790(RollobiteEntity* this) { + sub_0806F3E4(super); } -void sub_08020798(Entity* this) { - COLLISION_OFF(this); +void sub_08020798(RollobiteEntity* this) { + COLLISION_OFF(super); } -void nullsub_6(Entity* this) { +void nullsub_6(RollobiteEntity* this) { /* ... */ } -void sub_080207A8(Entity* this) { - this->action = 4; - COLLISION_ON(this); - this->spritePriority.b0 = 4; - this->gustJarState &= 0xfb; - this->direction ^= 0x10; - this->zVelocity = Q_16_16(1.5); - this->speed = 0x80; - InitializeAnimation(this, this->animationState + 0x10); +void sub_080207A8(RollobiteEntity* this) { + super->action = 4; + COLLISION_ON(super); + super->spritePriority.b0 = 4; + super->gustJarState &= 0xfb; + super->direction ^= 0x10; + super->zVelocity = Q_16_16(1.5); + super->speed = 0x80; + InitializeAnimation(super, super->animationState + 0x10); } -void Rollobite_Initialize(Entity* this) { - sub_0804A720(this); - this->carryFlags = 0x30; - this->gustJarFlags = 18; - this->cutsceneBeh.HALF.LO = 0; - this->direction = DirectionRound(Random()); +void Rollobite_Initialize(RollobiteEntity* this) { + sub_0804A720(super); + super->carryFlags = 0x30; + super->gustJarFlags = 18; + this->unk_84 = 0; + super->direction = DirectionRound(Random()); sub_08020A30(this); } -void Rollobite_Walk(Entity* this) { - GetNextFrame(this); - if (this->frame & 0x1) { - this->frame &= ~0x1; - if (!ProcessMovement0(this)) - this->timer = 1; +void Rollobite_Walk(RollobiteEntity* this) { + GetNextFrame(super); + if (super->frame & 0x1) { + super->frame &= ~0x1; + if (!ProcessMovement0(super)) + super->timer = 1; } - if (this->frame & 0x10) { - this->frame &= ~0x10; - if (--this->timer == 0) { - this->action = 3; - this->timer = 60; + if (super->frame & 0x10) { + super->frame &= ~0x10; + if (--super->timer == 0) { + super->action = 3; + super->timer = 60; } } } -void sub_08020874(Entity* this) { - gUnk_080CA6BC[this->subAction](this); +void sub_08020874(RollobiteEntity* this) { + gUnk_080CA6BC[super->subAction](this); } -void sub_0802088C(Entity* this) { - this->subAction = 1; - COLLISION_OFF(this); - this->cutsceneBeh.HALF.HI = gPlayerEntity.animationState; - this->spritePriority.b1 = 0; +void sub_0802088C(RollobiteEntity* this) { + super->subAction = 1; + COLLISION_OFF(super); + this->unk_85 = gPlayerEntity.animationState; + super->spritePriority.b1 = 0; } -void sub_080208B4(Entity* this) { - s8 uVar1 = (this->cutsceneBeh.HALF.HI - gPlayerEntity.animationState) / 2; +void sub_080208B4(RollobiteEntity* this) { + s8 uVar1 = (this->unk_85 - gPlayerEntity.animationState) / 2; if (uVar1) { - this->animationState = (this->animationState + uVar1) & 3; - InitializeAnimation(this, this->animationState + 0x10); + super->animationState = (super->animationState + uVar1) & 3; + InitializeAnimation(super, super->animationState + 0x10); } - this->cutsceneBeh.HALF.HI = gPlayerEntity.animationState; + this->unk_85 = gPlayerEntity.animationState; } -void sub_080208F0(Entity* this) { - this->spritePriority.b1 = 3; +void sub_080208F0(RollobiteEntity* this) { + super->spritePriority.b1 = 3; } -void sub_08020904(Entity* this) { - this->action = 4; - COLLISION_ON(this); - this->direction = -1; - InitializeAnimation(this, this->animationState + 0x10); +void sub_08020904(RollobiteEntity* this) { + super->action = 4; + COLLISION_ON(super); + super->direction = -1; + InitializeAnimation(super, super->animationState + 0x10); } -void Rollobite_Turn(Entity* this) { - if (--this->timer == 0) +void Rollobite_Turn(RollobiteEntity* this) { + if (--super->timer == 0) sub_08020A30(this); } -void Rollobite_RolledUp(Entity* this) { +void Rollobite_RolledUp(RollobiteEntity* this) { u32 unk; - if ((this->frame & ANIM_DONE) == 0) - GetNextFrame(this); + if ((super->frame & ANIM_DONE) == 0) + GetNextFrame(super); - unk = sub_080044EC(this, 0x2800); + unk = sub_080044EC(super, 0x2800); if (unk == 0) { - if (--this->timer == 0) { - this->action = 5; - InitializeAnimation(this, this->animationState + 12); + if (--super->timer == 0) { + super->action = 5; + InitializeAnimation(super, super->animationState + 12); } - RegisterCarryEntity(this); + RegisterCarryEntity(super); } else { if (unk == 1) EnqueueSFX(SFX_PLACE_OBJ); - if ((this->direction & 0x80) == 0) - ProcessMovement2(this); + if ((super->direction & 0x80) == 0) + ProcessMovement2(super); } } -void Rollobite_Unroll(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - COLLISION_ON(this); - this->speed = 0x100; - this->hitType = 34; +void Rollobite_Unroll(RollobiteEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + COLLISION_ON(super); + super->speed = 0x100; + super->hitType = 34; sub_08020A30(this); - this->direction = DirectionFromAnimationState(this->animationState); - InitializeAnimation(this, this->animationState); + super->direction = DirectionFromAnimationState(super->animationState); + InitializeAnimation(super, super->animationState); } else { - if ((this->frame & 1) == 0) - RegisterCarryEntity(this); + if ((super->frame & 1) == 0) + RegisterCarryEntity(super); } } -void Rollobite_LinedUp(Entity* this) { - if (GravityUpdate(this, Q_8_8(28.0)) == 0) { - this->action = 7; - this->spritePriority.b0 = 7; +void Rollobite_LinedUp(RollobiteEntity* this) { + if (GravityUpdate(super, Q_8_8(28.0)) == 0) { + super->action = 7; + super->spritePriority.b0 = 7; } - if (this->frame == 0) - GetNextFrame(this); + if (super->frame == 0) + GetNextFrame(super); } -void Rollobite_Holed(Entity* this) { - GetNextFrame(this); +void Rollobite_Holed(RollobiteEntity* this) { + GetNextFrame(super); } -void sub_08020A30(Entity* this) { - if (this->cutsceneBeh.HALF.LO < 2) { - this->timer = gUnk_080CA6CC[Random() & 7]; - if (this->timer == 0) { - this->action = 3; - this->timer = 60; - this->cutsceneBeh.HALF.LO++; +void sub_08020A30(RollobiteEntity* this) { + if (this->unk_84 < 2) { + super->timer = gUnk_080CA6CC[Random() & 7]; + if (super->timer == 0) { + super->action = 3; + super->timer = 60; + this->unk_84++; return; } } - this->action = 1; - this->cutsceneBeh.HALF.LO = 0; + super->action = 1; + this->unk_84 = 0; sub_08020A7C(this); } -void sub_08020A7C(Entity* this) { +void sub_08020A7C(RollobiteEntity* this) { int tmp = Random(); - u32 state = DirectionRound(this->direction + gUnk_080CA6D4[tmp % 3]); + u32 state = DirectionRound(super->direction + gUnk_080CA6D4[tmp % 3]); - if (sub_08049FA0(this) == 0) { - int tmp = DirectionRoundUp(sub_08049EE4(this)); + if (sub_08049FA0(super) == 0) { + int tmp = DirectionRoundUp(sub_08049EE4(super)); if ((state ^ 0x10) == tmp) state ^= 0x10; } - this->direction = state; - this->animationState = (u8)(state >> 3); - InitializeAnimation(this, this->animationState); + super->direction = state; + super->animationState = (u8)(state >> 3); + InitializeAnimation(super, super->animationState); } -bool32 Rollobite_TryToHoleUp(Entity* this) { - if (Rollobite_IsRolledUp(this) && this->z.HALF.HI == 0) { - int tile = COORD_TO_TILE(this); - int iVar1 = GetTileType(tile, this->collisionLayer); +bool32 Rollobite_TryToHoleUp(RollobiteEntity* this) { + if (Rollobite_IsRolledUp(this) && super->z.HALF.HI == 0) { + int tile = COORD_TO_TILE(super); + int iVar1 = GetTileType(tile, super->collisionLayer); if ((iVar1 * 0x10000 - 0x710000U) >> 0x10 < 2) { - this->action = 6; - COLLISION_OFF(this); - this->x.HALF.HI &= 0xfff0; - this->x.HALF.HI += 8; - this->y.HALF.HI &= 0xfff0; - this->y.HALF.HI += 13; - this->zVelocity = Q_16_16(2.0); - InitializeAnimation(this, this->animationState + 0x14); - SetTile(0x4034, tile, this->collisionLayer); + super->action = 6; + COLLISION_OFF(super); + super->x.HALF.HI &= 0xfff0; + super->x.HALF.HI += 8; + super->y.HALF.HI &= 0xfff0; + super->y.HALF.HI += 13; + super->zVelocity = Q_16_16(2.0); + InitializeAnimation(super, super->animationState + 0x14); + SetTile(0x4034, tile, super->collisionLayer); return TRUE; } } return FALSE; } -bool32 Rollobite_IsRolledUp(Entity* this) { - u32 tmp = this->animIndex; +bool32 Rollobite_IsRolledUp(RollobiteEntity* this) { + u32 tmp = super->animIndex; if (16 <= tmp && tmp <= 19) { return TRUE; } else { @@ -287,16 +294,16 @@ bool32 Rollobite_IsRolledUp(Entity* this) { } // clang-format off -void (*const Rollobite_Functions[])(Entity*) = { +void (*const Rollobite_Functions[])(RollobiteEntity*) = { Rollobite_OnTick, Rollobite_OnCollision, Rollobite_OnKnockback, - GenericDeath, - GenericConfused, + (void (*)(RollobiteEntity*))GenericDeath, + (void (*)(RollobiteEntity*))GenericConfused, Rollobite_OnGrabbed, }; -void (*const gRollobiteActions[])(Entity*) = { +void (*const gRollobiteActions[])(RollobiteEntity*) = { Rollobite_Initialize, Rollobite_Walk, sub_08020874, @@ -307,7 +314,7 @@ void (*const gRollobiteActions[])(Entity*) = { Rollobite_Holed, }; -void (*const gUnk_080CA6A4[])(Entity*) = { +void (*const gUnk_080CA6A4[])(RollobiteEntity*) = { sub_0802077C, sub_08020788, sub_08020790, @@ -316,7 +323,7 @@ void (*const gUnk_080CA6A4[])(Entity*) = { sub_080207A8, }; -void (*const gUnk_080CA6BC[])(Entity*) = { +void (*const gUnk_080CA6BC[])(RollobiteEntity*) = { sub_0802088C, sub_080208B4, sub_080208F0, diff --git a/src/enemy/rope.c b/src/enemy/rope.c index 098d4b89..72c04f71 100644 --- a/src/enemy/rope.c +++ b/src/enemy/rope.c @@ -4,203 +4,211 @@ * * @brief Rope enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" -void Rope_OnTick(Entity*); -void Rope_OnCollision(Entity*); -void Rope_OnGrabbed(Entity*); -void sub_08031434(Entity*); -void sub_08031480(Entity*); -void sub_080314FC(Entity*); -void sub_080315BC(Entity*); -void sub_0803140C(Entity*); -void sub_08031418(Entity*); -void sub_08031420(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unused2[1]; + /*0x7a*/ u16 unk_7a; +} RopeEntity; -static void (*const Rope_Functions[6])(Entity*) = { - Rope_OnTick, Rope_OnCollision, GenericKnockback, GenericDeath, GenericConfused, Rope_OnGrabbed, +void Rope_OnTick(RopeEntity* this); +void Rope_OnCollision(RopeEntity* this); +void Rope_OnGrabbed(RopeEntity* this); +void sub_08031434(RopeEntity* this); +void sub_08031480(RopeEntity* this); +void sub_080314FC(RopeEntity* this); +void sub_080315BC(RopeEntity* this); +void sub_0803140C(RopeEntity* this); +void sub_08031418(RopeEntity* this); +void sub_08031420(RopeEntity* this); + +static void (*const Rope_Functions[6])(RopeEntity*) = { + Rope_OnTick, Rope_OnCollision, (void (*)(RopeEntity*))GenericKnockback, (void (*)(RopeEntity*))GenericDeath, (void (*)(RopeEntity*))GenericConfused, Rope_OnGrabbed, }; extern Entity* gUnk_020000B0; -void sub_08031600(Entity*); -u32 sub_0803163C(Entity*); +void sub_08031600(RopeEntity* this); +u32 sub_0803163C(RopeEntity* this); -void Rope(Entity* this) { - EnemyFunctionHandler(this, Rope_Functions); - SetChildOffset(this, 0, 1, -16); +void Rope(RopeEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)Rope_Functions); + SetChildOffset(super, 0, 1, -16); } -void Rope_OnTick(Entity* this) { - static void (*const actionFuncs[4])(Entity*) = { +void Rope_OnTick(RopeEntity* this) { + static void (*const actionFuncs[4])(RopeEntity*) = { sub_08031434, sub_08031480, sub_080314FC, sub_080315BC, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } -void Rope_OnCollision(Entity* this) { - if (this->action == 3) { - this->subtimer = 30; - this->field_0x78.HALF.LO = 0x3c; +void Rope_OnCollision(RopeEntity* this) { + if (super->action == 3) { + super->subtimer = 30; + this->unk_78 = 0x3c; sub_08031600(this); } - if (this->confusedTime) { - Create0x68FX(this, FX_STARS); + if (super->confusedTime) { + Create0x68FX(super, FX_STARS); } - EnemyFunctionHandlerAfterCollision(this, Rope_Functions); + EnemyFunctionHandlerAfterCollision(super, Rope_Functions); } -void Rope_OnGrabbed(Entity* this) { - static void (*const subActionFuncs[3])(Entity*) = { +void Rope_OnGrabbed(RopeEntity* this) { + static void (*const subActionFuncs[3])(RopeEntity*) = { sub_0803140C, sub_08031418, sub_08031420, }; - if (sub_0806F520(this)) { - subActionFuncs[this->subAction](this); + if (sub_0806F520(super)) { + subActionFuncs[super->subAction](this); } } -void sub_0803140C(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 0x3c; +void sub_0803140C(RopeEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 0x3c; } -void sub_08031418(Entity* this) { - sub_0806F4E8(this); +void sub_08031418(RopeEntity* this) { + sub_0806F4E8(super); } -void sub_08031420(Entity* this) { - if (sub_0806F3E4(this)) { - GenericDeath(this); +void sub_08031420(RopeEntity* this) { + if (sub_0806F3E4(super)) { + GenericDeath(super); } } -void sub_08031434(Entity* this) { +void sub_08031434(RopeEntity* this) { - sub_0804A720(this); - this->animationState = 0xff; - this->gustJarFlags = 1; - this->field_0x7a.HWORD = this->speed; - if (!(this->type)) { + sub_0804A720(super); + super->animationState = 0xff; + super->gustJarFlags = 1; + this->unk_7a = super->speed; + if (!(super->type)) { sub_08031600(this); } else { - this->action = 1; - this->subAction = 0; - this->spriteSettings.draw = (this->spriteSettings.draw & 0xfc); - this->z.HALF.HI = -0x80; - this->frameIndex = 0xff; + super->action = 1; + super->subAction = 0; + super->spriteSettings.draw = (super->spriteSettings.draw & 0xfc); + super->z.HALF.HI = -0x80; + super->frameIndex = 0xff; } } -void sub_08031480(Entity* this) { - if (this->subAction == 0) { - if (this->timer != 0) { - this->timer--; +void sub_08031480(RopeEntity* this) { + if (super->subAction == 0) { + if (super->timer != 0) { + super->timer--; } else { sub_08031600(this); - this->action = 1; - this->subAction = 1; - this->spriteSettings.draw = 3; - this->spriteRendering.b3 = 1; - this->spriteOrientation.flipY = 1; + super->action = 1; + super->subAction = 1; + super->spriteSettings.draw = 3; + super->spriteRendering.b3 = 1; + super->spriteOrientation.flipY = 1; SoundReq(SFX_12D); } } else { - if (GravityUpdate(this, Q_8_8(24.0)) == 0) { - this->action = 2; - this->subtimer = 15; - this->spriteSettings.draw = 1; - UpdateSpriteForCollisionLayer(this); + if (GravityUpdate(super, Q_8_8(24.0)) == 0) { + super->action = 2; + super->subtimer = 15; + super->spriteSettings.draw = 1; + UpdateSpriteForCollisionLayer(super); EnqueueSFX(SFX_WATER_SPLASH); } } } -void sub_080314FC(Entity* this) { +void sub_080314FC(RopeEntity* this) { u32 u; - GetNextFrame(this); - if (this->subtimer) { - this->subtimer--; + GetNextFrame(super); + if (super->subtimer) { + super->subtimer--; } else { - if (this->field_0x78.HALF.LO) { - this->field_0x78.HALF.LO--; + if (this->unk_78) { + this->unk_78--; } - if (sub_08049FA0(this)) { - if (!(this->field_0x78.HALF.LO)) { - if (sub_08049FDC(this, 1)) { - u = sub_0804A044(this, gUnk_020000B0, 0xc); + if (sub_08049FA0(super)) { + if (!(this->unk_78)) { + if (sub_08049FDC(super, 1)) { + u = sub_0804A044(super, gUnk_020000B0, 0xc); if (u != 0xff) { - this->action = 3; - this->timer = 30; - this->field_0x7a.HWORD = this->speed = 0x1a0; - this->direction = u; - this->animationState = this->direction >> 3; - InitializeAnimation(this, this->animationState + 4); + super->action = 3; + super->timer = 30; + this->unk_7a = super->speed = 0x1a0; + super->direction = u; + super->animationState = super->direction >> 3; + InitializeAnimation(super, super->animationState + 4); return; } } } } else { if ((Random() & 1)) { - this->direction = DirectionRoundUp(sub_08049EE4(this)); - u = this->direction >> 3; - if (u != this->animationState) { - this->animationState = u; - InitializeAnimation(this, u); + super->direction = DirectionRoundUp(sub_08049EE4(super)); + u = super->direction >> 3; + if (u != super->animationState) { + super->animationState = u; + InitializeAnimation(super, u); } } } - if (--this->timer == 0) { + if (--super->timer == 0) { sub_08031600(this); } sub_0803163C(this); } } -void sub_080315BC(Entity* this) { - if (this->timer != 0) { - this->timer--; - UpdateAnimationVariableFrames(this, 2); +void sub_080315BC(RopeEntity* this) { + if (super->timer != 0) { + super->timer--; + UpdateAnimationVariableFrames(super, 2); } else { - if (sub_08049FA0(this)) { - GetNextFrame(this); + if (sub_08049FA0(super)) { + GetNextFrame(super); if (sub_0803163C(this)) { return; } } - this->field_0x78.HALF.LO = 0x1e; + this->unk_78 = 0x1e; sub_08031600(this); } } -void sub_08031600(Entity* this) { +void sub_08031600(RopeEntity* this) { u32 r; - this->action = 2; - this->timer = (Random() & 0x30) + 60; - this->speed = 0x80; - this->field_0x7a.HWORD = 0x80; + super->action = 2; + super->timer = (Random() & 0x30) + 60; + super->speed = 0x80; + this->unk_7a = 0x80; r = Random() & 0x18; - this->direction = r; + super->direction = r; r = r / 8; - if (r != this->animationState) { - this->animationState = r; - InitializeAnimation(this, r); + if (r != super->animationState) { + super->animationState = r; + InitializeAnimation(super, r); } } -u32 sub_0803163C(Entity* this) { +u32 sub_0803163C(RopeEntity* this) { u32 h; - if (GetTileUnderEntity(this) == 0x13) { - h = this->field_0x7a.HWORD / 2; + if (GetTileUnderEntity(super) == 0x13) { + h = this->unk_7a / 2; } else { - h = this->field_0x7a.HWORD; + h = this->unk_7a; } - this->speed = h; - return ProcessMovement0(this); + super->speed = h; + return ProcessMovement0(super); } diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c index b5d0f886..fd9127c7 100644 --- a/src/enemy/ropeGolden.c +++ b/src/enemy/ropeGolden.c @@ -4,166 +4,173 @@ * * @brief Golden Rope enemy */ - -#include "global.h" -#include "entity.h" +#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" #include "physics.h" #include "player.h" #include "item.h" -void RopeGolden_OnTick(Entity*); -void RopeGolden_OnCollision(Entity*); -void RopeGolden_OnDeath(Entity*); -void sub_08038258(Entity*); -void sub_0803827C(Entity*); -void sub_080382EC(Entity*); -void sub_08038304(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; + /*0x7a*/ u8 unk_7a; +} RopeGoldenEntity; -static void (*const RopeGolden_Functions[6])(Entity*) = { - RopeGolden_OnTick, RopeGolden_OnCollision, GenericKnockback, RopeGolden_OnDeath, GenericConfused, RopeGolden_OnTick, +void RopeGolden_OnTick(RopeGoldenEntity* this); +void RopeGolden_OnCollision(RopeGoldenEntity* this); +void RopeGolden_OnDeath(RopeGoldenEntity* this); +void sub_08038258(RopeGoldenEntity* this); +void sub_0803827C(RopeGoldenEntity* this); +void sub_080382EC(RopeGoldenEntity* this); +void sub_08038304(RopeGoldenEntity* this); + +static void (*const RopeGolden_Functions[6])(RopeGoldenEntity*) = { + RopeGolden_OnTick, RopeGolden_OnCollision, (void (*)(RopeGoldenEntity*))GenericKnockback, RopeGolden_OnDeath, (void (*)(RopeGoldenEntity*))GenericConfused, RopeGolden_OnTick, }; -void sub_080383AC(Entity*); -void sub_080383E4(Entity*); +void sub_080383AC(RopeGoldenEntity* this); +void sub_080383E4(RopeGoldenEntity* this); -void RopeGolden(Entity* this) { +void RopeGolden(RopeGoldenEntity* this) { u32 x; - x = sub_080012DC(this); + x = sub_080012DC(super); if (x != 0) { - gUnk_080012C8[x](this); + gUnk_080012C8[x](super); } else { - RopeGolden_Functions[GetNextFunction(this)](this); - SetChildOffset(this, 0, 1, -0x10); + RopeGolden_Functions[GetNextFunction(super)](this); + SetChildOffset(super, 0, 1, -0x10); } } -void RopeGolden_OnTick(Entity* this) { - static void (*const actionFuncs[4])(Entity*) = { +void RopeGolden_OnTick(RopeGoldenEntity* this) { + static void (*const actionFuncs[4])(RopeGoldenEntity*) = { sub_08038258, sub_0803827C, sub_080382EC, sub_08038304, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } -void RopeGolden_OnCollision(Entity* this) { - if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); +void RopeGolden_OnCollision(RopeGoldenEntity* this) { + if (super->confusedTime != 0) { + Create0x68FX(super, FX_STARS); } - EnemyFunctionHandlerAfterCollision(this, RopeGolden_Functions); + EnemyFunctionHandlerAfterCollision(super, RopeGolden_Functions); } -void RopeGolden_OnDeath(Entity* this) { - if ((this->gustJarState & 2) == 0) { - SetGlobalFlag(this->type2); +void RopeGolden_OnDeath(RopeGoldenEntity* this) { + if ((super->gustJarState & 2) == 0) { + SetGlobalFlag(super->type2); } - CreateDeathFx(this, 0xff, ITEM_RUPEE100); + CreateDeathFx(super, 0xff, ITEM_RUPEE100); } -void sub_08038258(Entity* this) { - if (CheckGlobalFlag(this->type2) != 0) { +void sub_08038258(RopeGoldenEntity* this) { + if (CheckGlobalFlag(super->type2) != 0) { DeleteThisEntity(); } - sub_0804A720(this); - this->animationState = 0xff; + sub_0804A720(super); + super->animationState = 0xff; sub_080383AC(this); } -void sub_0803827C(Entity* this) { - if (this->subtimer != 0) { - this->subtimer--; +void sub_0803827C(RopeGoldenEntity* this) { + if (super->subtimer != 0) { + super->subtimer--; } else { - if ((sub_0804A044(this, &gPlayerEntity, 0x8) != 0xff) || - (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x24) != 0)) { + if ((sub_0804A044(super, &gPlayerEntity, 0x8) != 0xff) || + (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x24) != 0)) { sub_080383E4(this); return; } } - UpdateAnimationVariableFrames(this, 0x2); - if (!ProcessMovement0(this)) { + UpdateAnimationVariableFrames(super, 0x2); + if (!ProcessMovement0(super)) { sub_080383AC(this); } else { - if (--this->timer == 0) { + if (--super->timer == 0) { sub_080383AC(this); } } } -void sub_080382EC(Entity* this) { - if (--this->timer == 0) { - this->action = 3; +void sub_080382EC(RopeGoldenEntity* this) { + if (--super->timer == 0) { + super->action = 3; } } -void sub_08038304(Entity* this) { +void sub_08038304(RopeGoldenEntity* this) { u32 cVar2; s32 tmp; u32 tmp3; u32 h; - UpdateAnimationVariableFrames(this, 2); - if (!ProcessMovement0(this)) { - if (this->field_0x78.HALF.LO == this->direction) { + UpdateAnimationVariableFrames(super, 2); + if (!ProcessMovement0(super)) { + if (this->unk_78 == super->direction) { #ifdef EU - this->subtimer = 30; + super->subtimer = 30; #else - this->subtimer = 90; + super->subtimer = 90; #endif sub_080383AC(this); } else { - this->direction = this->field_0x78.HALF.LO; + super->direction = this->unk_78; } } else { tmp = 10; - if ((u8)((++this->timer) % tmp) == 0) { - this->timer = 0; - if (this->field_0x78.HALF.LO == this->direction) { + if ((u8)((++super->timer) % tmp) == 0) { + super->timer = 0; + if (this->unk_78 == super->direction) { cVar2 = ((Random() & 2) - 1) << 27; cVar2 = cVar2 >> 24; - h = this->field_0x78.HALF.HI; + h = this->unk_79; tmp3 = (u8)cVar2 << 24; if (tmp3 >> 24 == h) { - if (h == this->field_0x7a.HALF.LO) { + if (h == this->unk_7a) { cVar2 = -tmp3 >> 24; } } - this->field_0x7a.HALF.LO = this->field_0x78.HALF.HI; - this->field_0x78.HALF.HI = cVar2; - this->direction = (this->direction + cVar2) & 0x18; + this->unk_7a = this->unk_79; + this->unk_79 = cVar2; + super->direction = (super->direction + cVar2) & 0x18; } else { - this->direction = this->field_0x78.HALF.LO; + super->direction = this->unk_78; } - this->animationState = this->direction >> 3; - InitializeAnimation(this, this->animationState + 4); + super->animationState = super->direction >> 3; + InitializeAnimation(super, super->animationState + 4); } } } -void sub_080383AC(Entity* this) { +void sub_080383AC(RopeGoldenEntity* this) { u32 v; - this->action = 1; - this->timer = 8; - this->speed = 0x100; - this->direction = DirectionRoundUp(GetFacingDirection(this, &gPlayerEntity)); - v = this->direction >> 3; - if (v != this->animationState) { - this->animationState = v; - InitializeAnimation(this, v); + super->action = 1; + super->timer = 8; + super->speed = 0x100; + super->direction = DirectionRoundUp(GetFacingDirection(super, &gPlayerEntity)); + v = super->direction >> 3; + if (v != super->animationState) { + super->animationState = v; + InitializeAnimation(super, v); } } -void sub_080383E4(Entity* this) { +void sub_080383E4(RopeGoldenEntity* this) { u32 v; - this->action = 2; - this->timer = 8; - this->speed = 0x280; - v = DirectionRoundUp(GetFacingDirection(this, &gPlayerEntity)); - this->direction = v; - this->field_0x78.HALF.LO = v; - this->animationState = this->direction >> 3; - this->field_0x78.HALF.HI = 0xff; - this->field_0x7a.HALF.LO = -1; - InitializeAnimation(this, this->animationState + 4); + super->action = 2; + super->timer = 8; + super->speed = 0x280; + v = DirectionRoundUp(GetFacingDirection(super, &gPlayerEntity)); + super->direction = v; + this->unk_78 = v; + super->animationState = super->direction >> 3; + this->unk_79 = 0xff; + this->unk_7a = -1; + InitializeAnimation(super, super->animationState + 4); } diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 39a8e586..03a65ffe 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -4,237 +4,246 @@ * * @brief Rupee Like enemy */ - -#include "global.h" -#include "entity.h" +#define NENT_DEPRECATED #include "enemy.h" -#include "object.h" -#include "save.h" +#include "entity.h" #include "hitbox.h" +#include "object.h" #include "room.h" +#include "save.h" -extern void sub_080293DC(Entity*); -extern void sub_080296D8(Entity*); -extern void sub_08029770(Entity*); -extern void sub_080297F0(Entity*); -extern void sub_080296C8(Entity*); -extern void sub_0802969C(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; + /*0x84*/ u8 unk_84; +} RupeeLikeEntity; -extern void (*const RupeeLike_Functions[])(Entity*); -extern void (*const gUnk_080CCC18[])(Entity*); -extern void (*const gUnk_080CCC3C[])(Entity*); +extern void sub_080293DC(RupeeLikeEntity* this); +extern void sub_080296D8(RupeeLikeEntity* this); +extern void sub_08029770(RupeeLikeEntity* this); +extern void sub_080297F0(RupeeLikeEntity* this); +extern void sub_080296C8(RupeeLikeEntity* this); +extern void sub_0802969C(RupeeLikeEntity* this); + +extern void (*const RupeeLike_Functions[])(RupeeLikeEntity*); +extern void (*const gUnk_080CCC18[])(RupeeLikeEntity*); +extern void (*const gUnk_080CCC3C[])(RupeeLikeEntity*); extern const u8 gUnk_080CCC34[]; extern const s8 gUnk_080CCC44[]; extern const u8 gUnk_080CCC47[]; -void RupeeLike(Entity* this) { +void RupeeLike(RupeeLikeEntity* this) { u32 uVar1; - if (this->type2 == 0) { - uVar1 = (u8)sub_080043E8(this); + if (super->type2 == 0) { + uVar1 = (u8)sub_080043E8(super); if (uVar1 != 0) { - if (this->action == 4) { + if (super->action == 4) { sub_080296D8(this); } - sub_08001290(this, uVar1); + sub_08001290(super, uVar1); } else { - RupeeLike_Functions[GetNextFunction(this)](this); - SetChildOffset(this, 0, 1, -0x10); + RupeeLike_Functions[GetNextFunction(super)](this); + SetChildOffset(super, 0, 1, -0x10); } } else { sub_080293DC(this); } } -void RupeeLike_OnTick(Entity* this) { - gUnk_080CCC18[this->action](this); +void RupeeLike_OnTick(RupeeLikeEntity* this) { + gUnk_080CCC18[super->action](this); } -void RupeeLike_OnCollision(Entity* this) { - if (this->hitType == 0x8e) { +void RupeeLike_OnCollision(RupeeLikeEntity* this) { + if (super->hitType == 0x8e) { sub_08029770(this); } else { - if (this->action == 4) { + if (super->action == 4) { sub_080296D8(this); } - if (*(u8*)(*(u32*)&this->contactedEntity + 8) == 1) { - if (this->action == 2) { - InitializeAnimation(this, 0); - InitializeAnimation(this->child, 4); + if (*(u8*)(*(u32*)&super->contactedEntity + 8) == 1) { + if (super->action == 2) { + InitializeAnimation(super, 0); + InitializeAnimation(super->child, 4); } - this->action = 4; - this->timer = 60; - this->subtimer = 0; - this->field_0x82.HALF.HI = 0x41; - this->flags2 &= 0xfc; - this->field_0x80.HALF.LO = gPlayerEntity.spritePriority.b1; + super->action = 4; + super->timer = 60; + super->subtimer = 0; + this->unk_83 = 0x41; + super->flags2 &= 0xfc; + this->unk_80 = gPlayerEntity.spritePriority.b1; EnqueueSFX(SFX_PLACE_OBJ); } else { - if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); + if (super->confusedTime != 0) { + Create0x68FX(super, FX_STARS); } } } - EnemyFunctionHandlerAfterCollision(this, RupeeLike_Functions); + EnemyFunctionHandlerAfterCollision(super, RupeeLike_Functions); } -void RupeeLike_OnDeath(Entity* this) { - CreateDeathFx(this, 0xff, gUnk_080CCC34[this->cutsceneBeh.HALF.LO * 3 + this->type]); +void RupeeLike_OnDeath(RupeeLikeEntity* this) { + CreateDeathFx(super, 0xff, gUnk_080CCC34[this->unk_84 * 3 + super->type]); } -void RupeeLike_OnGrabbed(Entity* this) { +void RupeeLike_OnGrabbed(RupeeLikeEntity* this) { } -void sub_080293DC(Entity* this) { - CopyPositionAndSpriteOffset(this->parent, this); - this->y.HALF.HI++; - this->z.HALF.HI--; - gUnk_080CCC3C[this->action](this); +void sub_080293DC(RupeeLikeEntity* this) { + CopyPositionAndSpriteOffset(super->parent, super); + super->y.HALF.HI++; + super->z.HALF.HI--; + gUnk_080CCC3C[super->action](this); } -void sub_0802940C(Entity* this) { - Entity* ent; +void sub_0802940C(RupeeLikeEntity* this) { + Entity* entity; - ent = CreateEnemy(RUPEE_LIKE, this->type); - if (ent != NULL) { - sub_0804A720(this); - ent->parent = this; - ent->type2 = 1; - this->child = ent; - this->field_0x80.HALF.HI = 0; - this->cutsceneBeh.HALF.LO = 0; - this->field_0x82.HALF.LO = this->palette.b.b0; + entity = CreateEnemy(RUPEE_LIKE, super->type); + if (entity != NULL) { + sub_0804A720(super); + entity->parent = super; + entity->type2 = 1; + super->child = entity; + this->unk_81 = 0; + this->unk_84 = 0; + this->unk_82 = super->palette.b.b0; sub_080297F0(this); } } -void sub_0802944C(Entity* this) { +void sub_0802944C(RupeeLikeEntity* this) { sub_080296C8(this); - if ((this->field_0x80.HALF.HI != 0) && sub_08049FDC(this, 1)) { + if ((this->unk_81 != 0) && sub_08049FDC(super, 1)) { sub_08029770(this); } } -void sub_08029474(Entity* this) { +void sub_08029474(RupeeLikeEntity* this) { u32 bVar1; sub_080296C8(this); - if (this->frame & ANIM_DONE) { - this->action = 3; - this->timer = 8; - bVar1 = GetFacingDirection(this, &gPlayerEntity); - this->direction = bVar1; - this->animationState = (bVar1 << 0x18) >> 0x1c; - InitializeAnimation(this, this->animationState); - InitializeAnimation(this->child, this->animationState + 4); + if (super->frame & ANIM_DONE) { + super->action = 3; + super->timer = 8; + bVar1 = GetFacingDirection(super, &gPlayerEntity); + super->direction = bVar1; + super->animationState = (bVar1 << 0x18) >> 0x1c; + InitializeAnimation(super, super->animationState); + InitializeAnimation(super->child, super->animationState + 4); } else { - if (this->frame == 1) { - this->frame = 0; - COLLISION_ON(this); + if (super->frame == 1) { + super->frame = 0; + COLLISION_ON(super); } } } -void sub_080294D4(Entity* this) { - if (sub_08049FDC(this, 1) != 0) { - if (--this->timer == 0) { - this->timer = 8; - sub_08004596(this, GetFacingDirection(this, &gPlayerEntity)); +void sub_080294D4(RupeeLikeEntity* this) { + if (sub_08049FDC(super, 1) != 0) { + if (--super->timer == 0) { + super->timer = 8; + sub_08004596(super, GetFacingDirection(super, &gPlayerEntity)); sub_0802969C(this); } - ProcessMovement0(this); + ProcessMovement0(super); sub_080296C8(this); } else { - this->action = 6; - COLLISION_OFF(this); - InitializeAnimation(this, 3); - InitializeAnimation(this->child, 7); + super->action = 6; + COLLISION_OFF(super); + InitializeAnimation(super, 3); + InitializeAnimation(super->child, 7); } } -void sub_0802953C(Entity* this) { +void sub_0802953C(RupeeLikeEntity* this) { u8* pbVar3; sub_080296C8(this); sub_080296C8(this); if (sub_0807953C() != 0) { - this->subtimer++; + super->subtimer++; } - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } - if (((this->subtimer > 0x2d) || (gSave.stats.rupees == 0)) && (this->timer == 0)) { + if (((super->subtimer > 0x2d) || (gSave.stats.rupees == 0)) && (super->timer == 0)) { sub_080296D8(this); } else { ResetActiveItems(); gPlayerState.mobility |= 0x80; - PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0)); - pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex); + PositionRelative(super, &gPlayerEntity, 0, Q_16_16(1.0)); + pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)super->spriteIndex, super->frameIndex); gPlayerEntity.spriteOffsetX = pbVar3[0]; gPlayerEntity.spriteOffsetY = pbVar3[1] - 1; gPlayerEntity.spritePriority.b1 = 0; - if (--this->field_0x82.HALF.HI == 0) { - this->field_0x82.HALF.HI = 0x41; + if (--this->unk_83 == 0) { + this->unk_83 = 0x41; if (gSave.stats.rupees != 0) { - ModRupees(gUnk_080CCC44[this->type]); - this->cutsceneBeh.HALF.LO = 1; + ModRupees(gUnk_080CCC44[super->type]); + this->unk_84 = 1; } } } } -void sub_08029610(Entity* this) { - if (--this->subtimer == 0) { - this->action = 3; - this->timer = 1; +void sub_08029610(RupeeLikeEntity* this) { + if (--super->subtimer == 0) { + super->action = 3; + super->timer = 1; } sub_080296C8(this); } -void sub_08029630(Entity* this) { +void sub_08029630(RupeeLikeEntity* this) { sub_080296C8(this); - if (this->frame & ANIM_DONE) { - this->field_0x80.HALF.HI = 1; - this->child->spriteSettings.draw = FALSE; + if (super->frame & ANIM_DONE) { + this->unk_81 = 1; + super->child->spriteSettings.draw = FALSE; sub_080297F0(this); } } -void sub_08029660(Entity* this) { +void sub_08029660(RupeeLikeEntity* this) { u32 temp; - this->action = 1; - this->spriteIndex = 0xd1; - temp = gUnk_080CCC47[this->type]; - this->palette.b.b0 = temp; + super->action = 1; + super->spriteIndex = 0xd1; + temp = gUnk_080CCC47[super->type]; + super->palette.b.b0 = temp; } -void sub_08029688(Entity* this) { - if (this->parent->next == NULL) { - DeleteEntity(this); +void sub_08029688(RupeeLikeEntity* this) { + if (super->parent->next == NULL) { + DeleteEntity(super); } } -void sub_0802969C(Entity* this) { +void sub_0802969C(RupeeLikeEntity* this) { u32 bVar1; - if ((this->direction & 0xf) != 0) { + if ((super->direction & 0xf) != 0) { - bVar1 = this->direction >> 4; - if (bVar1 != this->animationState) { - this->animationState = bVar1; - InitializeAnimation(this, bVar1); - InitializeAnimation(this->child, bVar1 + 4); + bVar1 = super->direction >> 4; + if (bVar1 != super->animationState) { + super->animationState = bVar1; + InitializeAnimation(super, bVar1); + InitializeAnimation(super->child, bVar1 + 4); } } } -void sub_080296C8(Entity* this) { - GetNextFrame(this); - GetNextFrame(this->child); +void sub_080296C8(RupeeLikeEntity* this) { + GetNextFrame(super); + GetNextFrame(super->child); } -void sub_080296D8(Entity* this) { +void sub_080296D8(RupeeLikeEntity* this) { gPlayerState.jump_status = 0x41; gPlayerState.flags &= ~PL_CAPTURED; gPlayerEntity.flags |= ENT_COLLIDE; @@ -242,65 +251,65 @@ void sub_080296D8(Entity* this) { gPlayerEntity.iframes = 0xa6; gPlayerEntity.z.HALF.HI = -2; gPlayerEntity.direction = gPlayerEntity.animationState << 2; - gPlayerEntity.spritePriority.b1 = this->field_0x80.HALF.LO; + gPlayerEntity.spritePriority.b1 = this->unk_80; gPlayerEntity.spriteOffsetY = 0; gPlayerEntity.speed = 0x140; - this->action = 5; - this->subtimer = 60; - this->flags2 |= 3; - if ((s8)this->iframes == 0) { - this->iframes = 0xf4; + super->action = 5; + super->subtimer = 60; + super->flags2 |= 3; + if ((s8)super->iframes == 0) { + super->iframes = 0xf4; } } -void sub_08029770(Entity* this) { +void sub_08029770(RupeeLikeEntity* this) { u32 temp; - if (LoadFixedGFX(this, 0x73) != 0) { - this->action = 2; - COLLISION_OFF(this); - this->spriteIndex = 0xd1; - this->spritePriority.b1 = 3; - temp = this->field_0x82.HALF.LO; - this->palette.b.b0 = temp; - this->hitType = 0x8d; - this->hitbox = (Hitbox*)&gUnk_080FD260; - InitializeAnimation(this, 2); - this->child->spriteSettings.draw = TRUE; - InitializeAnimation(this->child, 6); - CreateDust(this); + if (LoadFixedGFX(super, 0x73) != 0) { + super->action = 2; + COLLISION_OFF(super); + super->spriteIndex = 0xd1; + super->spritePriority.b1 = 3; + temp = this->unk_82; + super->palette.b.b0 = temp; + super->hitType = 0x8d; + super->hitbox = (Hitbox*)&gUnk_080FD260; + InitializeAnimation(super, 2); + super->child->spriteSettings.draw = TRUE; + InitializeAnimation(super->child, 6); + CreateDust(super); } } -void sub_080297F0(Entity* this) { +void sub_080297F0(RupeeLikeEntity* this) { u32 temp; - this->action = 1; - this->timer = 120; - COLLISION_ON(this); - this->spriteSettings.draw = TRUE; - this->hitType = 0x8e; - UnloadGFXSlots(this); + super->action = 1; + super->timer = 120; + COLLISION_ON(super); + super->spriteSettings.draw = TRUE; + super->hitType = 0x8e; + UnloadGFXSlots(super); #ifdef EU - this->spriteIndex = 0x142; + super->spriteIndex = 0x142; #else - this->spriteIndex = 0x143; + super->spriteIndex = 0x143; #endif - temp = gUnk_080CCC47[this->type]; - this->palette.b.b0 = temp; - this->spriteVramOffset = 9; - InitializeAnimation(this, 0x54); + temp = gUnk_080CCC47[super->type]; + super->palette.b.b0 = temp; + super->spriteVramOffset = 9; + InitializeAnimation(super, 0x54); } // clang-format off -void (*const RupeeLike_Functions[])(Entity*) = { +void (*const RupeeLike_Functions[])(RupeeLikeEntity*) = { RupeeLike_OnTick, RupeeLike_OnCollision, - GenericKnockback, + (void (*)(RupeeLikeEntity*))GenericKnockback, RupeeLike_OnDeath, - GenericConfused, + (void (*)(RupeeLikeEntity*))GenericConfused, RupeeLike_OnGrabbed, }; -void (*const gUnk_080CCC18[])(Entity*) = { +void (*const gUnk_080CCC18[])(RupeeLikeEntity*) = { sub_0802940C, sub_0802944C, sub_08029474, @@ -316,7 +325,7 @@ const u8 gUnk_080CCC34[] = { 0x56, 0x57, }; -void (*const gUnk_080CCC3C[])(Entity*) = { +void (*const gUnk_080CCC3C[])(RupeeLikeEntity*) = { sub_08029660, sub_08029688, }; diff --git a/src/enemy/scissorsBeetle.c b/src/enemy/scissorsBeetle.c index 46a39494..35cc21b1 100644 --- a/src/enemy/scissorsBeetle.c +++ b/src/enemy/scissorsBeetle.c @@ -1,7 +1,13 @@ +/** + * @file scissorsBeetle.c + * @ingroup Enemies + * + * @brief Scissors Beetle enemy + */ #define NENT_DEPRECATED #include "collision.h" -#include "entity.h" #include "enemy.h" +#include "entity.h" typedef struct { Entity base; @@ -62,22 +68,22 @@ void ScissorsBeetle_OnGrabbed(ScissorsBeetleEntity* this) { } void ScissorsBeetle_Init(ScissorsBeetleEntity* this) { - Entity* ent = CreateProjectile(MANDIBLES_PROJECTILE); - if (ent == NULL) + Entity* entity = CreateProjectile(MANDIBLES_PROJECTILE); + if (entity == NULL) return; sub_0804A720(super); super->action = 1; super->spriteSettings.draw = 1; COLLISION_ON(super); - super->child = ent; + super->child = entity; super->animationState = Random() & 6; this->unk_80 = 0; this->unk_7a = 0; - ent->parent = super; - ent->type = 0; - ent->animationState = 0xff; - ent->collisionLayer = super->collisionLayer; + entity->parent = super; + entity->type = 0; + entity->animationState = 0xff; + entity->collisionLayer = super->collisionLayer; sub_08038BA8(this); } diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c index 627a75bb..2527a3a2 100644 --- a/src/enemy/sensorBladeTrap.c +++ b/src/enemy/sensorBladeTrap.c @@ -4,105 +4,118 @@ * * @brief Sensor Blade Trap enemy */ +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "map.h" #include "physics.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u16 unk_78; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ u16 unk_7c; + /*0x7e*/ u16 unk_7e; + /*0x80*/ u8 unused2[4]; + /*0x84*/ u16 unk_84; + /*0x86*/ u16 unk_86; +} SensorBladeTrapEntity; + extern u32 sub_0804A024(Entity*, u32, u32); -void sub_0802BB10(Entity*); -bool32 sub_0802BB2C(Entity*, u32); +void sub_0802BB10(SensorBladeTrapEntity* this); +bool32 sub_0802BB2C(SensorBladeTrapEntity* this, u32); -extern void (*const gUnk_080CD3C4[])(Entity*); +extern void (*const gUnk_080CD3C4[])(SensorBladeTrapEntity*); extern const u16 gUnk_080CD3D4[]; extern const s8 gUnk_080CD3DC[]; -void SensorBladeTrap(Entity* this) { - gUnk_080CD3C4[this->action](this); +void SensorBladeTrap(SensorBladeTrapEntity* this) { + gUnk_080CD3C4[super->action](this); } -void sub_0802B9EC(Entity* this) { - this->action = 1; - this->field_0x78.HWORD = gUnk_080CD3D4[this->type]; - this->field_0x7c.HALF.LO = this->cutsceneBeh.HWORD; - this->field_0x7c.HALF.HI = this->field_0x86.HWORD; +void sub_0802B9EC(SensorBladeTrapEntity* this) { + super->action = 1; + this->unk_78 = gUnk_080CD3D4[super->type]; + this->unk_7c = this->unk_84; + this->unk_7e = this->unk_86; } -void sub_0802BA18(Entity* this) { - u32 direction = sub_0804A024(this, 1, 0xe); +void sub_0802BA18(SensorBladeTrapEntity* this) { + u32 direction = sub_0804A024(super, 1, 0xe); if (direction == 0xff) return; if (sub_0802BB2C(this, direction)) return; - this->action = 2; - this->speed = this->field_0x78.HWORD; - this->direction = direction; + super->action = 2; + super->speed = this->unk_78; + super->direction = direction; switch (direction >> 3) { case 0: - this->field_0x7a.HWORD = this->y.HALF.HI - this->field_0x7c.HALF.HI; + this->unk_7a = super->y.HALF.HI - this->unk_7e; break; case 1: - this->field_0x7a.HWORD = this->x.HALF.HI + this->field_0x7c.HALF.LO; + this->unk_7a = super->x.HALF.HI + this->unk_7c; break; case 2: - this->field_0x7a.HWORD = this->y.HALF.HI + this->field_0x7c.HALF.HI; + this->unk_7a = super->y.HALF.HI + this->unk_7e; break; case 3: - this->field_0x7a.HWORD = this->x.HALF.HI - this->field_0x7c.HALF.LO; + this->unk_7a = super->x.HALF.HI - this->unk_7c; break; } } -void sub_0802BA8C(Entity* this) { - if (!ProcessMovement12(this)) { +void sub_0802BA8C(SensorBladeTrapEntity* this) { + if (!ProcessMovement12(super)) { sub_0802BB10(this); } else { - switch (this->direction >> 3) { + switch (super->direction >> 3) { case 0: - if (this->field_0x7a.HWORD >= this->y.HALF.HI) + if (this->unk_7a >= super->y.HALF.HI) sub_0802BB10(this); break; case 1: - if (this->field_0x7a.HWORD <= this->x.HALF.HI) + if (this->unk_7a <= super->x.HALF.HI) sub_0802BB10(this); break; case 2: - if (this->field_0x7a.HWORD <= this->y.HALF.HI) + if (this->unk_7a <= super->y.HALF.HI) sub_0802BB10(this); break; case 3: - if (this->field_0x7a.HWORD >= this->x.HALF.HI) + if (this->unk_7a >= super->x.HALF.HI) sub_0802BB10(this); break; } } } -void sub_0802BAFC(Entity* this) { - if (!ProcessMovement12(this)) { - this->action = 1; +void sub_0802BAFC(SensorBladeTrapEntity* this) { + if (!ProcessMovement12(super)) { + super->action = 1; } } -void sub_0802BB10(Entity* this) { - this->action = 3; - this->speed = 0xc0; - this->direction = this->direction ^ 0x10; +void sub_0802BB10(SensorBladeTrapEntity* this) { + super->action = 3; + super->speed = 0xc0; + super->direction = super->direction ^ 0x10; EnqueueSFX(SFX_METAL_CLINK); } -bool32 sub_0802BB2C(Entity* this, u32 param_2) { - u8* layer = this->collisionLayer == 2 ? gMapTop.collisionData : gMapBottom.collisionData; +bool32 sub_0802BB2C(SensorBladeTrapEntity* this, u32 param_2) { + u8* layer = super->collisionLayer == 2 ? gMapTop.collisionData : gMapBottom.collisionData; const s8* ptr = &gUnk_080CD3DC[param_2 >> 2]; - return IsTileCollision(layer, this->x.HALF.HI + ptr[0], this->y.HALF.HI + ptr[1], 0); + return IsTileCollision(layer, super->x.HALF.HI + ptr[0], super->y.HALF.HI + ptr[1], 0); } // clang-format off -void (*const gUnk_080CD3C4[])(Entity*) = { +void (*const gUnk_080CD3C4[])(SensorBladeTrapEntity*) = { sub_0802B9EC, sub_0802BA18, sub_0802BA8C, diff --git a/src/enemy/slime.c b/src/enemy/slime.c index 494d0459..66d102b7 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -4,142 +4,148 @@ * * @brief Slime enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" #include "room.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[28]; + /*0x84*/ u8 unk_84; +} SlimeEntity; + typedef struct { s8 h, v; } PACKED PosOffset; -void sub_08044FF8(Entity*); -void Slime_OnTick(Entity*); -void Slime_OnCollision(Entity*); -void Slime_OnGrabbed(Entity*); -void sub_08044FC8(Entity*); -void sub_08044FF8(Entity*); -void sub_08045018(Entity*); -void sub_08045088(Entity*); -void sub_080450A8(Entity*); -void sub_08045178(Entity*, Entity*, int, int); +void sub_08044FF8(SlimeEntity* this); +void Slime_OnTick(SlimeEntity* this); +void Slime_OnCollision(SlimeEntity* this); +void Slime_OnGrabbed(SlimeEntity* this); +void sub_08044FC8(SlimeEntity* this); +void sub_08044FF8(SlimeEntity* this); +void sub_08045018(SlimeEntity* this); +void sub_08045088(SlimeEntity* this); +void sub_080450A8(SlimeEntity* this); +void sub_08045178(SlimeEntity* this, Entity*, int, int); -static void (*const Slime_Functions[])(Entity*) = { - Slime_OnTick, Slime_OnCollision, GenericKnockback, GenericDeath, GenericConfused, Slime_OnGrabbed, +static void (*const Slime_Functions[])(SlimeEntity*) = { + Slime_OnTick, Slime_OnCollision, (void (*)(SlimeEntity*))GenericKnockback, (void (*)(SlimeEntity*))GenericDeath, (void (*)(SlimeEntity*))GenericConfused, Slime_OnGrabbed, }; -void Slime(Entity* this) { - EnemyFunctionHandler(this, Slime_Functions); - SetChildOffset(this, 0, 1, -12); +void Slime(SlimeEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)Slime_Functions); + SetChildOffset(super, 0, 1, -12); } -void Slime_OnTick(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void Slime_OnTick(SlimeEntity* this) { + static void (*const actionFuncs[])(SlimeEntity*) = { sub_08044FC8, sub_08044FF8, sub_08045018, sub_08045088, sub_080450A8, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } -void Slime_OnCollision(Entity* this) { - if ((this->health != 0) && (this->cutsceneBeh.HALF.LO != this->health)) { - this->action = 4; +void Slime_OnCollision(SlimeEntity* this) { + if ((super->health != 0) && (this->unk_84 != super->health)) { + super->action = 4; } else { - EnemyFunctionHandlerAfterCollision(this, Slime_Functions); + EnemyFunctionHandlerAfterCollision(super, Slime_Functions); } - if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); + if (super->confusedTime != 0) { + Create0x68FX(super, FX_STARS); } } -void Slime_OnGrabbed(Entity* this) { +void Slime_OnGrabbed(SlimeEntity* this) { } -void sub_08044FC8(Entity* this) { - this->action = 1; - this->spriteSettings.draw = 1; - this->speed = 128; - sub_0804A720(this); - InitializeAnimation(this, 0); +void sub_08044FC8(SlimeEntity* this) { + super->action = 1; + super->spriteSettings.draw = 1; + super->speed = 128; + sub_0804A720(super); + InitializeAnimation(super, 0); sub_08044FF8(this); } -void sub_08044FF8(Entity* this) { - this->action = 2; - this->timer = (Random() & 0x1F) + 30; - this->cutsceneBeh.HALF.LO = this->health; +void sub_08044FF8(SlimeEntity* this) { + super->action = 2; + super->timer = (Random() & 0x1F) + 30; + this->unk_84 = super->health; } -void sub_08045018(Entity* this) { - GetNextFrame(this); - if (--this->timer == 0) { - this->action = 3; - this->timer = 1; - if (0 < this->speed) { - this->timer = FixedDiv(0x1000, this->speed) >> 8; +void sub_08045018(SlimeEntity* this) { + GetNextFrame(super); + if (--super->timer == 0) { + super->action = 3; + super->timer = 1; + if (0 < super->speed) { + super->timer = FixedDiv(0x1000, super->speed) >> 8; } - if (sub_08049FA0(this) == 0 && (Random() & 3)) { - this->direction = (sub_08049EE4(this) + 0xfc + (Random() & 8)) & 24; + if (sub_08049FA0(super) == 0 && (Random() & 3)) { + super->direction = (sub_08049EE4(super) + 0xfc + (Random() & 8)) & 24; return; } - this->direction = Random() & 24; + super->direction = Random() & 24; } } -void sub_08045088(Entity* this) { - ProcessMovement0(this); - GetNextFrame(this); - if (--this->timer == 0) { - this->action = 1; +void sub_08045088(SlimeEntity* this) { + ProcessMovement0(super); + GetNextFrame(super); + if (--super->timer == 0) { + super->action = 1; } } /* Split slime into new ones */ -void sub_080450A8(Entity* this) { +void sub_080450A8(SlimeEntity* this) { Entity* entities[4]; - Entity* ent; + Entity* entity; s32 count, i; const PosOffset* off; static const u8 typeEntityCount[4] = { 2, 2, 4, 2 }; static const PosOffset gUnk_080D16D4[4] = { { 6, 0 }, { -6, 0 }, { 0, 6 }, { 0, -6 } }; /* Can we create enough new entities? */ - count = typeEntityCount[this->type]; + count = typeEntityCount[super->type]; if (MAX_ENTITIES + 1 - count <= gEntCount) return; /* Create 2-4 new MiniSlime */ for (i = 0; i < count; i++) - entities[i] = CreateEnemy(MINI_SLIME, this->type); + entities[i] = CreateEnemy(MINI_SLIME, super->type); off = gUnk_080D16D4; for (i = 0; i < count; i++) { - ent = entities[i]; - ent->child = entities[(i + 1) % count]; - ent->parent = entities[(i + count - 1) % count]; - ent->type2 = 1; - ent->z.HALF.HI = 0; - ent->iframes = -0x10; + entity = entities[i]; + entity->child = entities[(i + 1) % count]; + entity->parent = entities[(i + count - 1) % count]; + entity->type2 = 1; + entity->z.HALF.HI = 0; + entity->iframes = -0x10; /* Set MiniSlime offset relative to killed slime. */ - sub_08045178(this, ent, off->h, off->v); + sub_08045178(this, entity, off->h, off->v); off++; } - ent = CreateFx(this, FX_DEATH, 0); - if (ent != NULL) - CopyPosition(this, ent); + entity = CreateFx(super, FX_DEATH, 0); + if (entity != NULL) + CopyPosition(super, entity); - DeleteEntity(this); + DeleteEntity(super); } -void sub_08045178(Entity* this, Entity* child, int h, int v) { +void sub_08045178(SlimeEntity* this, Entity* child, int h, int v) { int x, y; if (child == NULL) return; - sub_0804A4E4(this, child); + sub_0804A4E4(super, child); if (sub_080B1AF0(child, h, v)) return; diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c index a5bf26bb..c2cf7d5f 100644 --- a/src/enemy/sluggula.c +++ b/src/enemy/sluggula.c @@ -4,7 +4,7 @@ * * @brief Sluggula enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" @@ -129,9 +129,9 @@ void sub_08023CE0(Entity* this) { GetNextFrame(this); if (this->frame) { if (this->frame & ANIM_DONE) { - Entity* ent = CreateEnemy(SLUGGULA, 1); - if (ent != NULL) { - sub_0804A4E4(this, ent); + Entity* entity = CreateEnemy(SLUGGULA, 1); + if (entity != NULL) { + sub_0804A4E4(this, entity); DeleteThisEntity(); } } else { @@ -156,14 +156,14 @@ void sub_08023E10(Entity* this) { } void sub_08023E54(Entity* this) { - Entity* ent; + Entity* entity; if (this->subtimer++ > 27) { this->subtimer = 0; - ent = CreateEnemy(SLUGGULA, 2); - if (ent != NULL) { + entity = CreateEnemy(SLUGGULA, 2); + if (entity != NULL) { const s8* ptr = &gUnk_080CBDF7[this->animationState * 2]; - PositionRelative(this, ent, Q_16_16(ptr[0]), Q_16_16(ptr[1])); + PositionRelative(this, entity, Q_16_16(ptr[0]), Q_16_16(ptr[1])); } } } diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 490da140..74e6254c 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -4,146 +4,152 @@ * * @brief Small Pesto enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" -void sub_080317F8(Entity*); -void SmallPesto_OnTick(Entity*); -void SmallPesto_OnCollision(Entity*); -void SmallPesto_OnGrabbed(Entity*); -void sub_08031704(Entity*); -void sub_08031714(Entity*); -void sub_08031770(Entity*); -void sub_080316DC(Entity*); -void sub_080316E8(Entity*); -void sub_080316F0(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ u16 unk_80; +} SmallPestoEntity; -static void (*const SmallPesto_Functions[])(Entity*) = { - SmallPesto_OnTick, SmallPesto_OnCollision, GenericKnockback, GenericDeath, GenericConfused, SmallPesto_OnGrabbed, +void sub_080317F8(SmallPestoEntity* this); +void SmallPesto_OnTick(SmallPestoEntity* this); +void SmallPesto_OnCollision(SmallPestoEntity* this); +void SmallPesto_OnGrabbed(SmallPestoEntity* this); +void sub_08031704(SmallPestoEntity* this); +void sub_08031714(SmallPestoEntity* this); +void sub_08031770(SmallPestoEntity* this); +void sub_080316DC(SmallPestoEntity* this); +void sub_080316E8(SmallPestoEntity* this); +void sub_080316F0(SmallPestoEntity* this); + +static void (*const SmallPesto_Functions[])(SmallPestoEntity*) = { + SmallPesto_OnTick, SmallPesto_OnCollision, (void (*)(SmallPestoEntity*))GenericKnockback, (void (*)(SmallPestoEntity*))GenericDeath, (void (*)(SmallPestoEntity*))GenericConfused, SmallPesto_OnGrabbed, }; -void sub_080317B4(Entity*); -void sub_080317E0(Entity*); -void sub_08031840(Entity*); +void sub_080317B4(SmallPestoEntity* this); +void sub_080317E0(SmallPestoEntity* this); +void sub_08031840(SmallPestoEntity* this); -void SmallPesto(Entity* this) { - SmallPesto_Functions[GetNextFunction(this)](this); +void SmallPesto(SmallPestoEntity* this) { + SmallPesto_Functions[GetNextFunction(super)](this); } -void SmallPesto_OnTick(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void SmallPesto_OnTick(SmallPestoEntity* this) { + static void (*const actionFuncs[])(SmallPestoEntity*) = { sub_08031704, sub_08031714, sub_08031770, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } -void SmallPesto_OnCollision(Entity* this) { +void SmallPesto_OnCollision(SmallPestoEntity* this) { } -void SmallPesto_OnGrabbed(Entity* this) { +void SmallPesto_OnGrabbed(SmallPestoEntity* this) { s32 iVar1; - static void (*const subActionFuncs[])(Entity*) = { + static void (*const subActionFuncs[])(SmallPestoEntity*) = { sub_080316DC, sub_080316E8, sub_080316F0, }; - GetNextFrame(this); - iVar1 = sub_0806F520(this); + GetNextFrame(super); + iVar1 = sub_0806F520(super); if (iVar1 == 0) { - this->action = 1; - this->subAction = 0; - COLLISION_ON(this); - this->speed = 0x40; - this->subtimer = 1; + super->action = 1; + super->subAction = 0; + COLLISION_ON(super); + super->speed = 0x40; + super->subtimer = 1; } else { - subActionFuncs[this->subAction](this); + subActionFuncs[super->subAction](this); } } -void sub_080316DC(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 0x3c; +void sub_080316DC(SmallPestoEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 0x3c; } -void sub_080316E8(Entity* this) { - sub_0806F4E8(this); +void sub_080316E8(SmallPestoEntity* this) { + sub_0806F4E8(super); } -void sub_080316F0(Entity* this) { - if (sub_0806F3E4(this)) { - GenericDeath(this); +void sub_080316F0(SmallPestoEntity* this) { + if (sub_0806F3E4(super)) { + GenericDeath(super); } } -void sub_08031704(Entity* this) { - sub_0804A720(this); +void sub_08031704(SmallPestoEntity* this) { + sub_0804A720(super); sub_080317F8(this); } -void sub_08031714(Entity* this) { +void sub_08031714(SmallPestoEntity* this) { sub_080317B4(this); - if (--this->subtimer == 0) { - this->subtimer = (Random() & 0xf) + 16; - if (sub_08049FA0(this) == 0 && (this->subtimer & 1) != 0) { - this->direction = sub_08049EE4(this); + if (--super->subtimer == 0) { + super->subtimer = (Random() & 0xf) + 16; + if (sub_08049FA0(super) == 0 && (super->subtimer & 1) != 0) { + super->direction = sub_08049EE4(super); } else { - this->direction += 0x18; - this->direction = ((Random() & 0xe) + this->direction) & 0x1f; + super->direction += 0x18; + super->direction = ((Random() & 0xe) + super->direction) & 0x1f; } sub_080317E0(this); } } -void sub_08031770(Entity* this) { - if (this->field_0x80.HWORD != 0) { - if (--this->field_0x80.HWORD == 0) { +void sub_08031770(SmallPestoEntity* this) { + if (this->unk_80 != 0) { + if (--this->unk_80 == 0) { sub_08031840(this); } - } else if (this->child == NULL) { - this->field_0x80.HWORD = (Random() & 0x7f) | (0x80 << 2); + } else if (super->child == NULL) { + this->unk_80 = (Random() & 0x7f) | (0x80 << 2); } else { - if (this->child->next == NULL) { - this->child = NULL; + if (super->child->next == NULL) { + super->child = NULL; } } } -void sub_080317B4(Entity* this) { - this->z.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd; - LinearMoveUpdate(this); - GetNextFrame(this); +void sub_080317B4(SmallPestoEntity* this) { + super->z.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd; + LinearMoveUpdate(super); + GetNextFrame(super); } -void sub_080317E0(Entity* this) { - this->animationState = ((u8)(this->direction + 2) & 0x1c) >> 2; - InitializeAnimation(this, this->animationState); +void sub_080317E0(SmallPestoEntity* this) { + super->animationState = ((u8)(super->direction + 2) & 0x1c) >> 2; + InitializeAnimation(super, super->animationState); } -void sub_080317F8(Entity* this) { +void sub_080317F8(SmallPestoEntity* this) { static const Hitbox3D gUnk_080CE560 = { 0, -3, { 3, 2, 2, 3 }, 2, 2, 12, { 0, 0, 0 } }; u8 newDirection = Random() & 0x18; - this->action = 1; - this->z.HALF.HI = 0x0000FFF4; - this->collisionLayer = 1; - this->collisionFlags |= 0x10; - this->gustJarFlags = 1; - this->direction = newDirection; - this->hitbox = (Hitbox*)&gUnk_080CE560; + super->action = 1; + super->z.HALF.HI = 0x0000FFF4; + super->collisionLayer = 1; + super->collisionFlags |= 0x10; + super->gustJarFlags = 1; + super->direction = newDirection; + super->hitbox = (Hitbox*)&gUnk_080CE560; sub_080317E0(this); - this->timer = 0; - this->subtimer = 32; + super->timer = 0; + super->subtimer = 32; } -void sub_08031840(Entity* this) { - Entity* enemy = CreateEnemy(SMALL_PESTO, this->type); +void sub_08031840(SmallPestoEntity* this) { + Entity* enemy = CreateEnemy(SMALL_PESTO, super->type); if (enemy != NULL) { - CopyPosition(this, enemy); - enemy->parent = this; - this->child = enemy; + CopyPosition(super, enemy); + enemy->parent = super; + super->child = enemy; enemy->type2 = 1; } } diff --git a/src/enemy/spark.c b/src/enemy/spark.c index 26ea7c79..2ec43e2b 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -4,7 +4,7 @@ * * @brief Spark enemy */ - +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "object.h" @@ -21,7 +21,7 @@ void Spark_OnTick(Entity* this) { } void Spark_OnCollision(Entity* this) { - Entity* ent; + Entity* entity; if (this->contactFlags & 0x80) { if ((this->contactFlags & 0x7f) == 0x14) { @@ -29,11 +29,11 @@ void Spark_OnCollision(Entity* this) { this->iframes = 0; this->spriteSettings.draw = 0; this->action = 2; - ent = CreateFx(this, FX_DEATH, 0); - if (ent != NULL) { - this->child = ent; + entity = CreateFx(this, FX_DEATH, 0); + if (entity != NULL) { + this->child = entity; this->timer = 14; - CopyPosition(this, ent); + CopyPosition(this, entity); } } } @@ -120,9 +120,9 @@ void sub_0802B35C(Entity* this) { void sub_0802B4A8(Entity* this) { if (--this->timer == 0) { - Entity* ent = CreateObjectWithParent(this, GROUND_ITEM, 0x60, 0); - if (ent != NULL) { - ent->y.HALF.HI -= 4; + Entity* entity = CreateObjectWithParent(this, GROUND_ITEM, 0x60, 0); + if (entity != NULL) { + entity->y.HALF.HI -= 4; } DeleteEntity(this); } diff --git a/src/enemy/spearMoblin.c b/src/enemy/spearMoblin.c index 29c2584f..57159b15 100644 --- a/src/enemy/spearMoblin.c +++ b/src/enemy/spearMoblin.c @@ -4,7 +4,7 @@ * * @brief Spear Moblin enemy */ - +//#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" @@ -196,10 +196,10 @@ void sub_08028488(Entity* this) { } void sub_08028528(Entity* this) { - Entity* ent = sub_08049DF4(1); + Entity* entity = sub_08049DF4(1); const Hitbox* box; - if (ent == NULL) { + if (entity == NULL) { this->subtimer = 0; sub_08028728(this); } else { @@ -218,7 +218,7 @@ void sub_08028528(Entity* this) { if (++this->timer == 0x20) { u32 direction; this->timer = 0; - direction = GetFacingDirection(this, ent); + direction = GetFacingDirection(this, entity); if (sub_08028828(this->direction, direction)) { this->direction = direction; } @@ -282,13 +282,13 @@ void sub_08028604(Entity* this) { bool32 sub_080286CC(Entity* this) { if (this->field_0x80.HALF.HI == 0) { - Entity* ent = sub_08049DF4(1); - if (ent != NULL) { - if (this->field_0x82.HALF.LO == 2 && sub_0806FC80(this, ent, 0x30)) + Entity* entity = sub_08049DF4(1); + if (entity != NULL) { + if (this->field_0x82.HALF.LO == 2 && sub_0806FC80(this, entity, 0x30)) return TRUE; - if (sub_0806FC80(this, ent, 0x40) && - DirectionRoundUp(GetFacingDirection(this, ent)) >> 2 == this->animationState) + if (sub_0806FC80(this, entity, 0x40) && + DirectionRoundUp(GetFacingDirection(this, entity)) >> 2 == this->animationState) return TRUE; } } @@ -386,13 +386,13 @@ bool32 sub_080288A4(Entity* this) { } void sub_080288C0(Entity* this) { - Entity* ent = this->child; - if ((ent != NULL) && (ent->contactFlags & 0x80)) { - this->knockbackDirection = ent->knockbackDirection; - this->iframes = -ent->iframes; - this->knockbackSpeed = ent->knockbackSpeed; - this->knockbackDuration = ent->knockbackDuration; - ent->knockbackDuration = 0; + Entity* entity = this->child; + if ((entity != NULL) && (entity->contactFlags & 0x80)) { + this->knockbackDirection = entity->knockbackDirection; + this->iframes = -entity->iframes; + this->knockbackSpeed = entity->knockbackSpeed; + this->knockbackDuration = entity->knockbackDuration; + entity->knockbackDuration = 0; } } diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c index 36deab65..07dccce7 100644 --- a/src/enemy/spikedBeetle.c +++ b/src/enemy/spikedBeetle.c @@ -4,7 +4,7 @@ * * @brief Spiked Beetle enemy */ - +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/spinyBeetle.c b/src/enemy/spinyBeetle.c index fe57c230..0e082d7b 100644 --- a/src/enemy/spinyBeetle.c +++ b/src/enemy/spinyBeetle.c @@ -1,6 +1,12 @@ +/** + * @file spinyBeetle.c + * @ingroup Enemies + * + * @brief Spiny Beetle enemy + */ #define NENT_DEPRECATED -#include "entity.h" #include "enemy.h" +#include "entity.h" #include "functions.h" #include "object.h" diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c index 157a9bef..c93ef05a 100644 --- a/src/enemy/spinyChuchu.c +++ b/src/enemy/spinyChuchu.c @@ -4,7 +4,7 @@ * * @brief Spiny Chuchu enemy */ - +//#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "hitbox.h" diff --git a/src/enemy/stalfos.c b/src/enemy/stalfos.c index bb2db80e..7042dea5 100644 --- a/src/enemy/stalfos.c +++ b/src/enemy/stalfos.c @@ -4,9 +4,7 @@ * * @brief Stalfos enemy */ - #define NENT_DEPRECATED -#include "global.h" #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/takkuri.c b/src/enemy/takkuri.c index 28a75426..b24e2e3e 100644 --- a/src/enemy/takkuri.c +++ b/src/enemy/takkuri.c @@ -1,10 +1,16 @@ +/** + * @file takkuri.c + * @ingroup Enemies + * + * @brief Takkuri enemy + */ #define NENT_DEPRECATED +#include "enemy.h" #include "entity.h" #include "functions.h" -#include "enemy.h" -#include "save.h" -#include "object.h" #include "item.h" +#include "object.h" +#include "save.h" typedef struct { Entity base; @@ -118,7 +124,7 @@ void sub_0803BCA4(TakkuriEntity* this) { } void sub_0803BD08(TakkuriEntity* this) { - Entity* ent; + Entity* entity; if (super->subtimer) { if (CheckOnScreen(super) == 0) { @@ -131,8 +137,8 @@ void sub_0803BD08(TakkuriEntity* this) { sub_0803BEE8(this); GetNextFrame(super); - ent = sub_08049DF4(1); - if (ent != NULL) { + entity = sub_08049DF4(1); + if (entity != NULL) { if (EntityInRectRadius(super, gUnk_020000B0, 0x88, 0x50)) { if (gUnk_020000B0->y.HALF.HI > super->y.HALF.HI + 8) { super->action = 2; @@ -304,9 +310,9 @@ void sub_0803BF70(TakkuriEntity* this) { void sub_0803C0AC(Entity* this) { u32 index, rupeeType, rupees; - Entity* ent; - ent = sub_08049DF4(1); - if (ent == NULL) + Entity* entity; + entity = sub_08049DF4(1); + if (entity == NULL) return; rupees = gSave.stats.rupees; @@ -331,7 +337,7 @@ void sub_0803C0AC(Entity* this) { Entity* obj = CreateObject(RUPEE_OBJECT, rupeeType, 0); if (obj) { - CopyPosition(ent, obj); + CopyPosition(entity, obj); } } } diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index 04b9769c..62ef03a0 100644 --- a/src/enemy/tektite.c +++ b/src/enemy/tektite.c @@ -4,7 +4,7 @@ * * @brief Tektite enemy */ - +//#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index b6ffdca9..48c9d6a5 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -4,7 +4,7 @@ * * @brief Golden Tektite enemy */ - +//#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "item.h" diff --git a/src/enemy/torchTrap.c b/src/enemy/torchTrap.c index dc3c07cf..71b2a2c7 100644 --- a/src/enemy/torchTrap.c +++ b/src/enemy/torchTrap.c @@ -1,9 +1,15 @@ +/** + * @file torchTrap.c + * @ingroup Enemies + * + * @brief Torch Trap enemy + */ #define NENT_DEPRECATED -#include "entity.h" #include "enemy.h" -#include "room.h" +#include "entity.h" #include "physics.h" #include "player.h" +#include "room.h" typedef struct { Entity base; diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c index 3226609d..41dfa9d6 100644 --- a/src/enemy/treeItem.c +++ b/src/enemy/treeItem.c @@ -4,11 +4,10 @@ * * @brief Tree Item enemy */ - -#include "global.h" +//#define NENT_DEPRECATED #include "enemy.h" -#include "object.h" #include "item.h" +#include "object.h" static bool32 ShouldSpawnTreeItem(Entity*); diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index 4ed717de..73ac6db2 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -4,7 +4,7 @@ * * @brief Vaati Arm enemy */ - +//#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" @@ -866,7 +866,7 @@ void sub_080432A8(Entity* this) { s32 iVar3; s32 i; VaatiArm_HeapStruct1* hs; - Entity* ent; + Entity* entity; i = 3; iVar3 = 0; @@ -884,10 +884,10 @@ void sub_080432A8(Entity* this) { hs->unk04.HALF.HI -= 2; for (i = 0; i < 4; i++) { - ent = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; - if (ent->z.HALF.HI < 4) { - COLLISION_ON(ent); - ent->spriteSettings.draw = 1; + entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; + if (entity->z.HALF.HI < 4) { + COLLISION_ON(entity); + entity->spriteSettings.draw = 1; } } @@ -1205,11 +1205,11 @@ void sub_0804393C(Entity* this) { s32 uVar6; s32 iVar7; VaatiArm_HeapStruct1* hs; - Entity* ent; + Entity* entity; - ent = ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]; - if (ent->field_0x7c.BYTES.byte0 != 0 && ent->field_0x7c.BYTES.byte1 <= this->type) { - uVar2 = gUnk_080D1362[this->type * 16 + ((ent->field_0x7c.BYTES.byte0 >> 3) & 0xf)]; + entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]; + if (entity->field_0x7c.BYTES.byte0 != 0 && entity->field_0x7c.BYTES.byte1 <= this->type) { + uVar2 = gUnk_080D1362[this->type * 16 + ((entity->field_0x7c.BYTES.byte0 >> 3) & 0xf)]; } else { uVar2 = 0; } diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index 7095b875..1d52e752 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -4,12 +4,12 @@ * * @brief Vaati Ball enemy */ - -#include "entity.h" +//#define NENT_DEPRECATED #include "enemy.h" -#include "player.h" -#include "object.h" +#include "entity.h" #include "functions.h" +#include "object.h" +#include "player.h" typedef struct { s8 h, v; diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c index 3a99ae35..8370eac3 100644 --- a/src/enemy/vaatiEyesMacro.c +++ b/src/enemy/vaatiEyesMacro.c @@ -4,7 +4,7 @@ * * @brief Vaati Eyes Macro enemy */ - +//#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index 98aff7a5..d97551e6 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -4,7 +4,7 @@ * * @brief Vaati Projectile enemy */ - +//#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "screenTransitions.h" diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c index b6a257eb..adfacb07 100644 --- a/src/enemy/vaatiRebornEnemy.c +++ b/src/enemy/vaatiRebornEnemy.c @@ -4,9 +4,9 @@ * * @brief Vaati Reborn enemy */ - -#include "enemy.h" +//#define NENT_DEPRECATED #include "area.h" +#include "enemy.h" #include "functions.h" void VaatiRebornEnemyType0PreAction(Entity*); diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 5e3ccd6b..8332a9a4 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -4,10 +4,10 @@ * * @brief Vaati Transfigured enemy */ - +//#define NENT_DEPRECATED #include "enemy.h" -#include "object.h" #include "functions.h" +#include "object.h" void sub_080409B0(Entity*); void sub_080408EC(Entity*); diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c index f56a6eb0..01fdf24c 100644 --- a/src/enemy/vaatiTransfiguredEye.c +++ b/src/enemy/vaatiTransfiguredEye.c @@ -4,12 +4,12 @@ * * @brief Vaati Transfigured Eye enemy */ - -#include "entity.h" +//#define NENT_DEPRECATED #include "enemy.h" +#include "entity.h" +#include "functions.h" #include "message.h" #include "physics.h" -#include "functions.h" void sub_08045A00(Entity*); void sub_08045A28(Entity*); diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index b7c9fd3a..ecfaaea7 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -4,11 +4,11 @@ * * @brief Vaati Wrath enemy */ - +//#define NENT_DEPRECATED #include "enemy.h" -#include "object.h" -#include "message.h" #include "functions.h" +#include "message.h" +#include "object.h" #include "save.h" #include "screen.h" diff --git a/src/enemy/vaatiWrathEye.c b/src/enemy/vaatiWrathEye.c index 3bc64342..6dadee24 100644 --- a/src/enemy/vaatiWrathEye.c +++ b/src/enemy/vaatiWrathEye.c @@ -4,7 +4,7 @@ * * @brief Vaati Wrath Eye enemy */ - +//#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/wallMaster.c b/src/enemy/wallMaster.c index cb76d0b6..a41578ca 100644 --- a/src/enemy/wallMaster.c +++ b/src/enemy/wallMaster.c @@ -4,7 +4,7 @@ * * @brief Wall Master enemy */ - +//#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" @@ -70,14 +70,14 @@ void sub_0802A534(Entity* this) { if (this->field_0x78.HWORD) { this->field_0x78.HWORD--; } else if (this->field_0x7a.HWORD == 0) { - Entity* ent = sub_08049DF4(1); - if (ent != NULL) { + Entity* entity = sub_08049DF4(1); + if (entity != NULL) { this->action = 2; this->timer = 90; COLLISION_ON(this); this->spriteSettings.draw = 3; - this->x.HALF.HI = ent->x.HALF.HI; - this->y.HALF.HI = ent->y.HALF.HI; + this->x.HALF.HI = entity->x.HALF.HI; + this->y.HALF.HI = entity->y.HALF.HI; this->z.HALF.HI = -0x80; this->spritePriority.b1 = 1; this->spriteSettings.shadow = 2; diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c index a6866f83..f8475010 100644 --- a/src/enemy/wallMaster2.c +++ b/src/enemy/wallMaster2.c @@ -4,7 +4,7 @@ * * @brief Wall Master 2 enemy */ - +//#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index 2563f82c..7dc2b686 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -4,10 +4,10 @@ * * @brief Water Drop enemy */ - +#define NENT_DEPRECATED #include "enemy.h" -#include "screen.h" #include "object.h" +#include "screen.h" #include "structures.h" void sub_0802A39C(Entity*); @@ -22,7 +22,7 @@ void WaterDrop(Entity* this) { } void sub_0802A250(Entity* this) { - Entity* ent; + Entity* entity; this->action = 1; this->timer = 0; @@ -33,9 +33,9 @@ void sub_0802A250(Entity* this) { InitializeAnimation(this, 0); UpdateSpriteForCollisionLayer(this); - ent = CreateObject(WATER_DROP_OBJECT, 0, 0); - if (ent != NULL) { - ent->parent = this; + entity = CreateObject(WATER_DROP_OBJECT, 0, 0); + if (entity != NULL) { + entity->parent = this; } } diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index e978415e..0c8a8068 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -4,12 +4,12 @@ * * @brief Wisp enemy */ - +//#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" -#include "save.h" -#include "object.h" #include "functions.h" +#include "object.h" +#include "save.h" static void sub_08033744(Entity* this); void Wisp_OnTick(Entity* this); @@ -41,7 +41,7 @@ void Wisp_OnTick(Entity* this) { void Wisp_OnCollision(Entity* this) { u32 bits; - Entity* ent; + Entity* entity; bits = this->contactFlags; if ((bits & 0x80) == 0) { @@ -70,11 +70,11 @@ void Wisp_OnCollision(Entity* this) { COLLISION_OFF(this); this->iframes = 0; this->spriteSettings.draw = FALSE; - ent = CreateFx(this, FX_DEATH, 0); - if (ent != NULL) { - this->child = ent; + entity = CreateFx(this, FX_DEATH, 0); + if (entity != NULL) { + this->child = entity; this->timer = 14; - CopyPosition(this, ent); + CopyPosition(this, entity); } DeleteThisEntity(); break; diff --git a/src/enemy/wizzrobeFire.c b/src/enemy/wizzrobeFire.c index 820bd8ea..dc1aa173 100644 --- a/src/enemy/wizzrobeFire.c +++ b/src/enemy/wizzrobeFire.c @@ -4,11 +4,9 @@ * * @brief Wizzrobe Fire enemy */ - #define NENT_DEPRECATED -#include "global.h" -#include "enemy.h" #include "enemy/wizzrobe.h" +#include "enemy.h" #include "functions.h" extern void (*const WizzrobeFire_Functions[])(WizzrobeEntity*); diff --git a/src/enemy/wizzrobeIce.c b/src/enemy/wizzrobeIce.c index edd48331..9607a275 100644 --- a/src/enemy/wizzrobeIce.c +++ b/src/enemy/wizzrobeIce.c @@ -4,11 +4,9 @@ * * @brief Wizzrobe Ice enemy */ - #define NENT_DEPRECATED -#include "global.h" -#include "enemy.h" #include "enemy/wizzrobe.h" +#include "enemy.h" #include "functions.h" #include "object.h" diff --git a/src/enemy/wizzrobeWind.c b/src/enemy/wizzrobeWind.c index 4d407677..33a9e25f 100644 --- a/src/enemy/wizzrobeWind.c +++ b/src/enemy/wizzrobeWind.c @@ -4,12 +4,10 @@ * * @brief Wizzrobe Wind enemy */ - #define NENT_DEPRECATED -#include "global.h" +#include "enemy/wizzrobe.h" #include "collision.h" #include "enemy.h" -#include "enemy/wizzrobe.h" #include "functions.h" #include "object.h" From 37723f560798698a2a17d0b29ee7baca1a8cb1c7 Mon Sep 17 00:00:00 2001 From: theo3 Date: Fri, 29 Dec 2023 21:42:55 -0800 Subject: [PATCH 10/15] document RoomVars struct --- asm/macros/entity.inc | 36 +- data/const/game_2.s | 2 +- data/map/entity_headers.s | 1234 ++++++++--------- include/kinstone.h | 2 +- include/room.h | 29 +- src/beanstalkSubtask.c | 18 +- src/entity.c | 67 +- src/game.c | 4 +- src/gameData.c | 4 +- src/gameUtils.c | 12 +- src/interrupts.c | 31 +- src/itemUtils.c | 4 +- src/kinstone.c | 5 +- .../horizontalMinishPathBackgroundManager.c | 4 +- src/manager/hyruleTownTilesetManager.c | 12 +- src/manager/minishVillageTilesetManager.c | 10 +- src/manager/miscManager.c | 2 +- .../verticalMinishPathBackgroundManager.c | 4 +- src/manager/weatherChangeManager.c | 8 +- src/npc/rem.c | 14 +- src/object/itemOnGround.c | 2 +- src/object/pressurePlate.c | 2 +- src/object/pushableStatue.c | 8 +- src/player.c | 2 +- src/playerUtils.c | 6 +- src/room.c | 16 +- src/roomInit.c | 86 +- 27 files changed, 816 insertions(+), 808 deletions(-) diff --git a/asm/macros/entity.inc b/asm/macros/entity.inc index 01e15566..394eb9e9 100755 --- a/asm/macros/entity.inc +++ b/asm/macros/entity.inc @@ -1,6 +1,8 @@ .ifndef GUARD_ASM_MACROS_ENTITY_INC .set GUARD_ASM_MACROS_ENTITY_INC, 1 + .set DEFAULT_POOL, 0xF + .set ENTITY_TYPE_ENEMY, 0x3 .set ENTITY_TYPE_SIGN, 0x5 .set ENTITY_TYPE_OBJECT, 0x6 @@ -14,7 +16,7 @@ .macro object_minish_lilypad x, y, room_property, collision=0 .byte ENTITY_TYPE_OBJECT | ((\collision) << 4) - .byte 0x0F + .byte DEFAULT_POOL .byte OBJECT_MINISH_LILYPAD .byte 0x00 .byte \room_property @@ -25,7 +27,7 @@ .macro object_item x, y, item, flag, collision=0 .byte ENTITY_TYPE_OBJECT | ((\collision) << 4) - .byte 0x0F + .byte DEFAULT_POOL .byte OBJECT_ITEM .byte \item .byte 0x00 @@ -37,7 +39,7 @@ .macro enemy_octorok x, y, bound_x, bound_y, bound_tile_width, bound_tile_height, collision=0 .byte ENTITY_TYPE_ENEMY | ((\collision) << 4) - .byte 0x0F + .byte DEFAULT_POOL .byte ENEMY_OCTOROK .byte 0x00, 0x00, 0x00 .byte \bound_tile_width, \bound_tile_height @@ -47,7 +49,7 @@ .macro enemy_chuchu x, y, bound_x, bound_y, bound_tile_width, bound_tile_height, collision=0 .byte ENTITY_TYPE_ENEMY | ((\collision) << 4) - .byte 0x0F + .byte DEFAULT_POOL .byte ENEMY_CHUCHU .byte 0x00, 0x00, 0x00 .byte \bound_tile_width, \bound_tile_height @@ -57,16 +59,16 @@ .macro enemy_tree_item x, y, unknown, collision=0 .byte ENTITY_TYPE_ENEMY | ((\collision) << 4) - .byte 0x0F + .byte DEFAULT_POOL .byte ENEMY_TREE_ITEM .byte \unknown, 0x00, 0x00, 0x00, 0x00 .2byte \x, \y .2byte 0x00, 0x00 .endm - .macro entity_raw type:req, subtype:req, collision=0, unknown:req, paramA=0, paramB=0, x=0, y=0, paramC=0 + .macro entity_raw type:req, subtype:req, collision=0, pool:req, paramA=0, paramB=0, x=0, y=0, paramC=0 .byte \type | ((\collision) << 4) - .byte \unknown + .byte \pool .byte \subtype .byte \paramA .4byte \paramB @@ -91,24 +93,24 @@ .2byte \flag2 .endm - .macro manager subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0 - entity_raw type=9, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC + .macro manager subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0 + entity_raw type=9, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC .endm - .macro object_raw subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0 - entity_raw type=6, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC + .macro object_raw subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0 + entity_raw type=6, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC .endm - .macro enemy_raw subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0 - entity_raw type=3, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC + .macro enemy_raw subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0 + entity_raw type=3, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC .endm - .macro npc_raw subtype:req, collision=0, unknown=0x4f, paramA=0, paramB=0, x=0, y=0, script:req - entity_raw type=7, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\script + .macro npc_raw subtype:req, collision=0, pool=0x4f, paramA=0, paramB=0, x=0, y=0, script:req + entity_raw type=7, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\script .endm - .macro projectile_raw subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0 - entity_raw type=4, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC + .macro projectile_raw subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0 + entity_raw type=4, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC .endm .macro entity_list_end diff --git a/data/const/game_2.s b/data/const/game_2.s index b2567dbf..1a68f696 100644 --- a/data/const/game_2.s +++ b/data/const/game_2.s @@ -59,7 +59,7 @@ gUnk_080FED58:: @ 080FED58 .incbin "data_080FC8A4/gUnk_080FED58.bin" @ kinstone.c -gUnk_080FED98:: @ 080FED98 +gLilypadRails:: @ 080FED98 .4byte gUnk_080FEDA4 .4byte gUnk_080FEDDA .4byte gUnk_080FEDF8 diff --git a/data/map/entity_headers.s b/data/map/entity_headers.s index 030d61c0..4b07ccde 100644 --- a/data/map/entity_headers.s +++ b/data/map/entity_headers.s @@ -1613,7 +1613,7 @@ Entities_CrenelMinishPaths_CrenelBean_1:: @ 080D58A8 object_raw subtype=0x62, x=0x88, y=0x158 object_raw subtype=0x62, x=0x68, y=0x1f8, paramA=0x1, paramB=0x1 object_raw subtype=0x62, x=0x68, y=0x288 - manager subtype=0x2, unknown=0x18 + manager subtype=0x2, pool=0x18 entity_list_end Enemies_CrenelMinishPaths_CrenelBean:: @ 080D5908 @@ -1648,7 +1648,7 @@ Entities_CrenelMinishPaths_CrenelWater_1:: @ 080D5978 object_raw subtype=0x62, x=0x98, y=0x238, paramA=0x2 object_raw subtype=0x62, x=0x58, y=0x2d8, paramA=0x2, paramB=0x1 object_raw subtype=0x6e, x=0x78, y=0x40 - manager subtype=0x2, unknown=0x18 + manager subtype=0x2, pool=0x18 entity_list_end Enemies_CrenelMinishPaths_CrenelWater:: @ 080D5A28 @@ -1685,7 +1685,7 @@ Entities_CrenelMinishPaths_Rainfall_0:: @ 080D5AC8 Entities_CrenelMinishPaths_Rainfall_1:: @ 080D5AE8 manager subtype=0x1c - manager subtype=0x8, unknown=0x18 + manager subtype=0x8, pool=0x18 entity_list_end Enemies_CrenelMinishPaths_Rainfall:: @ 080D5B18 @@ -1710,7 +1710,7 @@ Entities_CrenelMinishPaths_MelarisMine_0:: @ 080D5B58 Entities_CrenelMinishPaths_MelarisMine_1:: @ 080D5B68 object_raw subtype=0x4f, x=0x78, y=0xb8, paramA=0x12, paramB=0xb - manager subtype=0x8, unknown=0x18 + manager subtype=0x8, pool=0x18 entity_list_end Enemies_CrenelMinishPaths_MelarisMine:: @ 080D5B98 @@ -1749,7 +1749,7 @@ Entities_MinishPaths_ToMinishVillage_1:: @ 080D5C68 object_raw subtype=0x3f, x=0x68, y=0x108, collision=1, paramA=0x1 object_raw subtype=0x3f, x=0x78, y=0x1b8, collision=1 object_raw subtype=0x3f, x=0xa8, y=0x2f8, collision=1, paramA=0x1 - manager subtype=0x2, unknown=0x18 + manager subtype=0x2, pool=0x18 entity_list_end Enemies_MinishPaths_ToMinishVillage:: @ 080D5CF8 @@ -1778,7 +1778,7 @@ Entities_MinishPaths_CastorWilds_1:: @ 080D5D68 object_raw subtype=0x78, x=0xa0, y=0x90, collision=1, paramB=0x1 object_raw subtype=0x78, x=0x70, y=0x190, collision=1 object_raw subtype=0x78, x=0xa0, y=0x220, collision=1, paramB=0x2 - manager subtype=0x2, unknown=0x18 + manager subtype=0x2, pool=0x18 entity_list_end Enemies_MinishPaths_CastorWilds:: @ 080D5DB8 @@ -1818,7 +1818,7 @@ Entities_MinishPaths_HyruleTown_1:: @ 080D5E18 object_raw subtype=0x78, x=0x20, y=0x280, collision=2, paramA=0x1, paramB=0x5 object_raw subtype=0x78, x=0xd0, y=0x298, collision=2, paramA=0x1, paramB=0x4 object_raw subtype=0x78, x=0x18, y=0x2d8, collision=2, paramA=0x1, paramB=0x1 - manager subtype=0x2, unknown=0x18 + manager subtype=0x2, pool=0x18 entity_list_end Enemies_MinishPaths_HyruleTown:: @ 080D5F28 @@ -1851,7 +1851,7 @@ Entities_MinishPaths_LonLonRanch_1:: @ 080D5FB0 object_raw subtype=0x78, x=0xe0, y=0x128, collision=2, paramA=0x2, paramB=0x3 object_raw subtype=0x78, x=0x10, y=0x1e8, collision=2, paramA=0x2, paramB=0x1 object_raw subtype=0x78, x=0xe0, y=0x288, collision=2, paramA=0x2, paramB=0x2 - manager subtype=0x2, unknown=0x18 + manager subtype=0x2, pool=0x18 entity_list_end Enemies_MinishPaths_LonLonRanch:: @ 080D6010 @@ -1886,7 +1886,7 @@ Entities_MinishPaths_MayorsCabin_1:: @ 080D60C8 object_raw subtype=0x78, x=0x28, y=0x148, collision=2, paramA=0x3, paramB=0x3 object_raw subtype=0x78, x=0xc8, y=0x188, collision=2, paramA=0x3, paramB=0x1 object_raw subtype=0x78, x=0x28, y=0x298, collision=2, paramA=0x3 - manager subtype=0x2, unknown=0x18 + manager subtype=0x2, pool=0x18 entity_list_end Entities_MinishPaths_MayorsCabin_gUnk_080D6138:: @ 080D6138 @@ -1930,7 +1930,7 @@ Entities_HouseInteriors1_Mayor_1:: @ 080D6260 object_raw subtype=0x4e, x=0x38, y=0x28, collision=1, paramB=0x800 object_raw subtype=0x4d, x=0x88, y=0x68, collision=1, paramA=0x1b object_raw subtype=0x4d, x=0x88, y=0x58, collision=1, paramA=0x1b, paramB=0x1 - object_raw subtype=0x38, x=0x30, y=0x6e, unknown=0x0, paramA=0x1a + object_raw subtype=0x38, x=0x30, y=0x6e, pool=0x0, paramA=0x1a entity_list_end Enemies_HouseInteriors1_Mayor:: @ 080D62D0 @@ -2030,7 +2030,7 @@ Entities_HouseInteriors1_Library2F_0:: @ 080D6538 entity_list_end gUnk_080D6558:: @ 080D6558 - npc_raw subtype=0x1a, x=0xa8, y=0x48, unknown=0xf, script=0x0 + npc_raw subtype=0x1a, x=0xa8, y=0x48, pool=0xf, script=0x0 entity_list_end gUnk_080D6578:: @ 080D6578 @@ -2104,7 +2104,7 @@ gUnk_additional_9_HouseInteriors1_Library1F:: @ 080D6734 entity_list_end gUnk_080D6784:: @ 080D6784 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorAllBooksCollected + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorAllBooksCollected npc_raw subtype=0x1a, x=0x68, y=0x18, paramA=0x1, script=script_SturgeonAllBooksCollected entity_list_end @@ -2374,7 +2374,7 @@ Entities_HouseInteriors1_InnEast2F_1:: @ 080D6E6C object_raw subtype=0x5, x=0xc8, y=0xe8, collision=1, paramA=0x5c, paramB=0x7002, paramC=0x270000 manager subtype=0x23, x=0x28, y=0x198, paramA=0x2, paramB=0x2, paramC=0x9a0000 manager subtype=0x23, x=0xc8, y=0x198, paramA=0x2, paramB=0x2, paramC=0x9b0000 - manager subtype=0x2e, unknown=0x0, paramC=0x49a0000 + manager subtype=0x2e, pool=0x0, paramC=0x49a0000 object_raw subtype=0x5d, x=0x48, y=0x1a8, paramB=0x102, paramC=0x49a0000 entity_list_end @@ -2401,7 +2401,7 @@ Entities_HouseInteriors1_InnMinishHeartPiece_0:: @ 080D6F78 Entities_HouseInteriors1_InnMinishHeartPiece_1:: @ 080D6F98 object_raw subtype=0x4e, x=0x98, y=0x20, collision=1, paramB=0x800 - object_raw subtype=0x38, x=0xc0, y=0x2e, unknown=0x0, paramA=0x28, paramB=0x1 + object_raw subtype=0x38, x=0xc0, y=0x2e, pool=0x0, paramA=0x28, paramB=0x1 entity_list_end Enemies_HouseInteriors1_InnMinishHeartPiece:: @ 080D6FC8 @@ -2460,7 +2460,7 @@ Room_HouseInteriors1_SchoolWest:: @ 080D7100 .4byte sub_StateChange_HouseInteriors1_SchoolWest Entities_HouseInteriors1_SchoolEast_0:: @ 080D7120 - object_raw subtype=0x38, x=0xe0, y=0x2e, unknown=0x0, paramA=0x2a + object_raw subtype=0x38, x=0xe0, y=0x2e, pool=0x0, paramA=0x2a entity_list_end gUnk_080D7140:: @ 080D7140 @@ -2560,8 +2560,8 @@ gUnk_080D73B0:: @ 080D73B0 entity_list_end gUnk_080D73E0:: @ 080D73E0 - npc_raw subtype=0x15, x=0xb8, y=0x58, unknown=0xf, collision=1, paramA=0x4, paramB=0x26, script=0x0 - npc_raw subtype=0x15, x=0xb8, y=0x1b8, unknown=0xf, collision=1, paramA=0x5, paramB=0x27, script=0x0 + npc_raw subtype=0x15, x=0xb8, y=0x58, pool=0xf, collision=1, paramA=0x4, paramB=0x26, script=0x0 + npc_raw subtype=0x15, x=0xb8, y=0x1b8, pool=0xf, collision=1, paramA=0x5, paramB=0x27, script=0x0 entity_list_end gUnk_080D7410:: @ 080D7410 @@ -3145,7 +3145,7 @@ Entities_Dojos_Grimblade_0:: @ 080D824C gUnk_080D827C:: @ 080D827C manager subtype=0x23, x=0x28, y=0x28, paramA=0x2, paramB=0x4002, paramC=0x80000000 manager subtype=0x23, x=0xc8, y=0x28, paramA=0x2, paramB=0x4002, paramC=0x80010000 - manager subtype=0x2e, unknown=0x0, paramB=0x100, paramC=0x84000000 + manager subtype=0x2e, pool=0x0, paramB=0x100, paramC=0x84000000 manager subtype=0x11, paramC=0x84000003 entity_list_end @@ -3557,7 +3557,7 @@ Entities_RoyalValley_Main_0:: @ 080D8FB8 .else manager subtype=0x11, paramC=0x88000056 .endif - object_raw subtype=0x19, x=0x1a0, y=0x1a2, unknown=0x4f, collision=1, paramA=0x1, paramB=0x3, paramC=script_GraveyardHouseDoor + object_raw subtype=0x19, x=0x1a0, y=0x1a2, pool=0x4f, collision=1, paramA=0x1, paramB=0x3, paramC=script_GraveyardHouseDoor npc_raw subtype=0x21, x=0x88, y=0x118, script=script_GhostBrothers .ifdef EU_JP ezlo_hint x=0x38, y=0x4a, rx=0x1, ry=0x4, msg=0xb1d, flag=0x58 @@ -3572,13 +3572,13 @@ gUnk_080D9048:: @ 080D9048 gUnk_080D9098:: @ 080D9098 npc_raw subtype=0x40, x=0xd8, y=0x188, paramA=0x1, script=script_DampeOuside - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorGetKeyBack + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorGetKeyBack entity_list_end gUnk_080D90C8:: @ 080D90C8 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorCrowStealingKey - object_raw subtype=0x97, x=0x1f0, y=0x1a0, unknown=0x4f, paramA=0x4, paramC=script_CameraTarget7FirstCrow - object_raw subtype=0x97, x=0x1f0, y=0x1b0, unknown=0x4f, paramA=0x4, paramC=script_CameraTarget7SecondCrow + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorCrowStealingKey + object_raw subtype=0x97, x=0x1f0, y=0x1a0, pool=0x4f, paramA=0x4, paramC=script_CameraTarget7FirstCrow + object_raw subtype=0x97, x=0x1f0, y=0x1b0, pool=0x4f, paramA=0x4, paramC=script_CameraTarget7SecondCrow entity_list_end gUnk_080D9108:: @ 080D9108 @@ -3730,9 +3730,9 @@ Entities_MinishRafters_Cafe_0:: @ 080D9440 npc_raw subtype=0x38, x=0xd8, y=0x30, paramA=0x1, paramB=0x202, script=script_TownMinish2 npc_raw subtype=0x38, x=0x38, y=0xa8, paramB=0x103, script=script_TownMinish1 npc_raw subtype=0x38, x=0x5c, y=0xdc, paramB=0x104, script=script_TownMinish1 - npc_raw subtype=0x3, x=0x78, y=0xd6, unknown=0xf, paramB=0x324, script=0x0 - npc_raw subtype=0x3, x=0x128, y=0xa8, unknown=0xf, paramB=0x125, script=0x0 - npc_raw subtype=0x3, x=0x158, y=0xb4, unknown=0xf, paramB=0x226, script=0x0 + npc_raw subtype=0x3, x=0x78, y=0xd6, pool=0xf, paramB=0x324, script=0x0 + npc_raw subtype=0x3, x=0x128, y=0xa8, pool=0xf, paramB=0x125, script=0x0 + npc_raw subtype=0x3, x=0x158, y=0xb4, pool=0xf, paramB=0x226, script=0x0 entity_list_end Entities_MinishRafters_Cafe_1:: @ 080D94B0 @@ -3750,7 +3750,7 @@ Entities_MinishRafters_Cafe_1:: @ 080D94B0 object_raw subtype=0xbc, x=0x10, y=0x88 object_raw subtype=0xbc, x=0xb8, y=0x88 object_raw subtype=0xbc, x=0x174, y=0x18 - manager subtype=0x1a, unknown=0x8, paramA=0x38 + manager subtype=0x1a, pool=0x8, paramA=0x38 entity_list_end Enemies_MinishRafters_Cafe:: @ 080D95B0 @@ -3789,7 +3789,7 @@ Entities_MinishRafters_Stockwell_1:: @ 080D9600 manager subtype=0x9, paramA=0x1 object_raw subtype=0xbc, x=0x64, y=0x78 object_raw subtype=0xbc, x=0x104, y=0xd8 - manager subtype=0x1a, unknown=0x8, paramA=0x39 + manager subtype=0x1a, pool=0x8, paramA=0x39 entity_list_end Enemies_MinishRafters_Stockwell:: @ 080D9710 @@ -3843,7 +3843,7 @@ Entities_MinishRafters_DrLeft_1:: @ 080D9830 object_raw subtype=0x4d, x=0x90, y=0xee, collision=1, paramA=0x2a object_raw subtype=0x4d, x=0xa0, y=0xde, collision=1, paramA=0x2a, paramB=0x1 manager subtype=0x9, paramA=0x2 - manager subtype=0x1a, unknown=0x8, paramA=0x3a + manager subtype=0x1a, pool=0x8, paramA=0x3a entity_list_end Enemies_MinishRafters_DrLeft:: @ 080D9930 @@ -3882,7 +3882,7 @@ Entities_MinishRafters_Bakery_1:: @ 080D99B8 object_raw subtype=0x4d, x=0x78, y=0xa8, collision=1, paramA=0x45 object_raw subtype=0x4d, x=0x1b8, y=0xb8, collision=1, paramA=0x45, paramB=0x1 manager subtype=0x9, paramA=0x3 - manager subtype=0x1a, unknown=0x8, paramA=0x3b + manager subtype=0x1a, pool=0x8, paramA=0x3b entity_list_end Enemies_MinishRafters_Bakery:: @ 080D9A98 @@ -3908,7 +3908,7 @@ Entities_CastorWilds_Main_0:: @ 080D9AD8 .ifdef EU_JP manager subtype=0x20, x=0x218, y=0x328, paramB=0x12182e00, paramC=0x161318 manager subtype=0x20, x=0x2b8, y=0x398, paramB=0x12a82e00, paramC=0x171398 - object_raw subtype=0x69, x=0x68, y=0x380, unknown=0x4f, paramC=script_CutsceneOrchestrator + object_raw subtype=0x69, x=0x68, y=0x380, pool=0x4f, paramC=script_CutsceneOrchestrator npc_raw subtype=0x2b, x=0x28, y=0x3a8, paramA=0x1, script=script_CastorWildsStatueRock npc_raw subtype=0x2b, x=0x40, y=0x354, script=script_CastorWildsStatueLeft npc_raw subtype=0x2b, x=0x70, y=0x354, script=script_CastorWildsStatueMiddle @@ -3916,7 +3916,7 @@ Entities_CastorWilds_Main_0:: @ 080D9AD8 object_raw subtype=0x71, x=0x38, y=0x2d8, paramA=0x1, paramB=0x1, paramC=0x200000 manager subtype=0x4 manager subtype=0x20, x=0x2b8, y=0x148, paramB=0x12b82e00, paramC=0x1f1158 - manager subtype=0xe, unknown=0x1f, paramA=0x10, paramC=0xc0000 + manager subtype=0xe, pool=0x1f, paramA=0x10, paramC=0xc0000 ezlo_hint x=0x72, y=0x36, rx=0x2, ry=0xa, msg=0xb2e, flag=0x1b ezlo_hint x=0x74, y=0x2a, rx=0x4, ry=0x5, msg=0xb2f, flag=0x1d ezlo_hint x=0x2a, y=0x54, rx=0x4, ry=0x2, msg=0xb2f, flag=0x1d @@ -3930,7 +3930,7 @@ Entities_CastorWilds_Main_0:: @ 080D9AD8 .else manager subtype=0x20, x=0x218, y=0x328, paramB=0x12182e00, paramC=0x151318 manager subtype=0x20, x=0x2b8, y=0x398, paramB=0x12a82e00, paramC=0x161398 - object_raw subtype=0x69, x=0x68, y=0x380, unknown=0x4f, paramC=script_CutsceneOrchestrator + object_raw subtype=0x69, x=0x68, y=0x380, pool=0x4f, paramC=script_CutsceneOrchestrator npc_raw subtype=0x2b, x=0x28, y=0x3a8, paramA=0x1, script=script_CastorWildsStatueRock npc_raw subtype=0x2b, x=0x40, y=0x354, script=script_CastorWildsStatueLeft npc_raw subtype=0x2b, x=0x70, y=0x354, script=script_CastorWildsStatueMiddle @@ -3938,7 +3938,7 @@ Entities_CastorWilds_Main_0:: @ 080D9AD8 object_raw subtype=0x71, x=0x38, y=0x2d8, paramA=0x1, paramB=0x1, paramC=0x1f0000 manager subtype=0x4 manager subtype=0x20, x=0x2b8, y=0x148, paramB=0x12b82e00, paramC=0x1e1158 - manager subtype=0xe, unknown=0x1f, paramA=0x10, paramC=0x230000 + manager subtype=0xe, pool=0x1f, paramA=0x10, paramC=0x230000 ezlo_hint x=0x72, y=0x36, rx=0x2, ry=0xa, msg=0xb2e, flag=0x1a ezlo_hint x=0x74, y=0x2a, rx=0x4, ry=0x5, msg=0xb2f, flag=0x1c ezlo_hint x=0x2a, y=0x54, rx=0x4, ry=0x2, msg=0xb2f, flag=0x1c @@ -3956,7 +3956,7 @@ gUnk_080D9C38:: @ 080D9C38 manager subtype=0x1e, x=0x380, y=0x1d0, paramB=0x100010, paramC=0x80000000 manager subtype=0x1e, x=0x3c0, y=0x1d0, paramB=0x100010, paramC=0x80000000 manager subtype=0x1e, x=0x330, y=0x1c0, paramB=0xa00050, paramC=0x80000000 - manager subtype=0xe, unknown=0x1f, paramA=0x13, paramC=0x80000000 + manager subtype=0xe, pool=0x1f, paramA=0x13, paramC=0x80000000 entity_list_end gUnk_additional_13_CastorWilds_Main:: @ 080D9CA8 @@ -3972,12 +3972,12 @@ gUnk_080D9CC8:: @ 080D9CC8 entity_list_end gUnk_080D9CE8:: @ 080D9CE8 - object_raw subtype=0xbb, x=0x228, y=0x398, unknown=0x4f, paramB=0x5, paramC=script_Windcrest + object_raw subtype=0xbb, x=0x228, y=0x398, pool=0x4f, paramB=0x5, paramC=script_Windcrest entity_list_end Entities_CastorWilds_Main_1:: @ 080D9D08 manager subtype=0x6, paramA=0x8 - manager subtype=0x3, x=0x98, y=0xc0, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x98, y=0xc0, pool=0x0, paramB=0x102 entity_list_end Enemies_CastorWilds_Main:: @ 080D9D38 @@ -4196,13 +4196,13 @@ Entities_CastorDarknut_Main_0:: @ 080DA210 entity_list_end gUnk_080DA230:: @ 080DA230 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorDarknutFight + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorDarknutFight object_raw subtype=0xc, x=0x88, y=0x68, paramA=0x1, paramC=0x390000 entity_list_end gUnk_080DA260:: @ 080DA260 object_raw subtype=0x8, x=0x88, y=0xb8, paramA=0x12, paramC=0x39ffff - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x398000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x398000 ezlo_hint type=0x3, x=0x0, y=0x0, rx=0x3f, ry=0x3f, msg=0xb10, flag=0x39, flag2=0x8000 entity_list_end @@ -4218,7 +4218,7 @@ TileEntities_CastorDarknut_Main:: @ 080DA2C0 tile_entity_list_end gUnk_additional_8_CastorDarknut_Main:: @ 080DA2D8 - enemy_raw subtype=0x5, x=0x88, y=0x50, unknown=0x2f + enemy_raw subtype=0x5, x=0x88, y=0x50, pool=0x2f entity_list_end Room_CastorDarknut_Main:: @ 080DA2F8 @@ -4258,7 +4258,7 @@ Room_CastorDarknut_Hall:: @ 080DA384 .4byte sub_StateChange_CastorDarknut_Hall Entities_GreatFairies_Graveyard_0:: @ 080DA3A4 - object_raw subtype=0x69, x=0x78, y=0x48, unknown=0x4f, paramC=script_GreatFairyArrows + object_raw subtype=0x69, x=0x78, y=0x48, pool=0x4f, paramC=script_GreatFairyArrows object_raw subtype=0x1b, x=0x78, y=0x48, collision=2, paramA=0x16 entity_list_end @@ -4279,7 +4279,7 @@ Room_GreatFairies_Graveyard:: @ 080DA3EC .4byte sub_StateChange_GreatFairies_Graveyard Entities_GreatFairies_MinishWoods_0:: @ 080DA40C - object_raw subtype=0x69, x=0x78, y=0x48, unknown=0x4f, paramC=script_GreatFairyRupees + object_raw subtype=0x69, x=0x78, y=0x48, pool=0x4f, paramC=script_GreatFairyRupees object_raw subtype=0x1b, x=0x78, y=0x48, collision=2, paramA=0xb entity_list_end @@ -4300,7 +4300,7 @@ Room_GreatFairies_MinishWoods:: @ 080DA454 .4byte sub_StateChange_GreatFairies_MinishWoods Entities_GreatFairies_MtCrenel_0:: @ 080DA474 - object_raw subtype=0x69, x=0x78, y=0x48, unknown=0x4f, paramC=script_GreatFairyBombs + object_raw subtype=0x69, x=0x78, y=0x48, pool=0x4f, paramC=script_GreatFairyBombs object_raw subtype=0x1b, x=0x78, y=0x48, collision=2 entity_list_end @@ -4464,7 +4464,7 @@ Room_MinishHouseInteriors_Festari:: @ 080DA7B8 .4byte gUnk_additional_a_MinishHouseInteriors_Festari Entities_MinishHouseInteriors_Red_0:: @ 080DA7E4 - npc_raw subtype=0x3, x=0x80, y=0x58, unknown=0xf, paramB=0x21c, script=0x0 + npc_raw subtype=0x3, x=0x80, y=0x58, pool=0xf, paramB=0x21c, script=0x0 entity_list_end Entities_MinishHouseInteriors_Red_1:: @ 080DA804 @@ -4488,7 +4488,7 @@ Room_MinishHouseInteriors_Red:: @ 080DA83C .4byte sub_StateChange_MinishHouseInteriors_Red Entities_MinishHouseInteriors_Green_0:: @ 080DA85C - npc_raw subtype=0x3, x=0x80, y=0x58, unknown=0xf, paramB=0x21d, script=0x0 + npc_raw subtype=0x3, x=0x80, y=0x58, pool=0xf, paramB=0x21d, script=0x0 entity_list_end Entities_MinishHouseInteriors_Green_1:: @ 080DA87C @@ -4512,7 +4512,7 @@ Room_MinishHouseInteriors_Green:: @ 080DA8B4 .4byte sub_StateChange_MinishHouseInteriors_Green Entities_MinishHouseInteriors_Blue_0:: @ 080DA8D4 - npc_raw subtype=0x3, x=0x80, y=0x58, unknown=0xf, paramB=0x21e, script=0x0 + npc_raw subtype=0x3, x=0x80, y=0x58, pool=0xf, paramB=0x21e, script=0x0 entity_list_end Entities_MinishHouseInteriors_Blue_1:: @ 080DA8F4 @@ -4536,7 +4536,7 @@ Room_MinishHouseInteriors_Blue:: @ 080DA92C .4byte sub_StateChange_MinishHouseInteriors_Blue Entities_MinishHouseInteriors_SideArea_0:: @ 080DA94C - npc_raw subtype=0x3, x=0x80, y=0x58, unknown=0xf, paramB=0x218, script=0x0 + npc_raw subtype=0x3, x=0x80, y=0x58, pool=0xf, paramB=0x218, script=0x0 entity_list_end Entities_MinishHouseInteriors_SideArea_1:: @ 080DA96C @@ -4560,7 +4560,7 @@ Room_MinishHouseInteriors_SideArea:: @ 080DA9A4 .4byte sub_StateChange_MinishHouseInteriors_SideArea Entities_MinishHouseInteriors_ShoeMinish_0:: @ 080DA9C4 - npc_raw subtype=0x3, x=0x78, y=0x48, unknown=0xf, paramB=0x21a, script=0x0 + npc_raw subtype=0x3, x=0x78, y=0x48, pool=0xf, paramB=0x21a, script=0x0 entity_list_end Entities_MinishHouseInteriors_ShoeMinish_1:: @ 080DA9E4 @@ -4584,7 +4584,7 @@ Room_MinishHouseInteriors_ShoeMinish:: @ 080DAA1C .4byte sub_StateChange_MinishHouseInteriors_ShoeMinish Entities_MinishHouseInteriors_PotMinish_0:: @ 080DAA3C - npc_raw subtype=0x3, x=0x78, y=0x38, unknown=0xf, paramB=0x21b, script=0x0 + npc_raw subtype=0x3, x=0x78, y=0x38, pool=0xf, paramB=0x21b, script=0x0 entity_list_end Entities_MinishHouseInteriors_PotMinish_1:: @ 080DAA5C @@ -4610,7 +4610,7 @@ Room_MinishHouseInteriors_PotMinish:: @ 080DAAB4 .4byte sub_StateChange_MinishHouseInteriors_PotMinish Entities_MinishHouseInteriors_BarrelMinish_0:: @ 080DAAD4 - npc_raw subtype=0x3, x=0x38, y=0xf8, unknown=0xf, paramB=0x217, script=0x0 + npc_raw subtype=0x3, x=0x38, y=0xf8, pool=0xf, paramB=0x217, script=0x0 object_raw subtype=0x4c, x=0x68, y=0x58, collision=1, paramA=0x1 object_raw subtype=0x4c, x=0x68, y=0x68, collision=1, paramA=0x1 object_raw subtype=0x4c, x=0x78, y=0x78, collision=1, paramA=0x1 @@ -4623,7 +4623,7 @@ gUnk_080DAB44:: @ 080DAB44 entity_list_end gUnk_080DAB64:: @ 080DAB64 - npc_raw subtype=0x3, x=0xc0, y=0x48, unknown=0xf, paramB=0x216, script=0x0 + npc_raw subtype=0x3, x=0xc0, y=0x48, pool=0xf, paramB=0x216, script=0x0 entity_list_end gUnk_080DAB84:: @ 080DAB84 @@ -4692,7 +4692,7 @@ Entities_MinishHouseInteriors_BarrelMinish_1:: @ 080DADF4 object_raw subtype=0x7f, x=0x50, y=0x58 object_raw subtype=0x7f, x=0x50, y=0x78, paramA=0x3 object_raw subtype=0x7f, x=0x50, y=0x98, paramA=0x2 - manager subtype=0x1, unknown=0x18, paramA=0x8 + manager subtype=0x1, pool=0x18, paramA=0x8 entity_list_end Enemies_MinishHouseInteriors_BarrelMinish:: @ 080DAE94 @@ -4802,7 +4802,7 @@ Room_MinishHouseInteriors_MelariMinesEast:: @ 080DB0A0 .4byte sub_StateChange_MinishHouseInteriors_MelariMinesEast Entities_MinishHouseInteriors_HyruleFieldSouthwest_0:: @ 080DB0C0 - npc_raw subtype=0x3, x=0x78, y=0x48, unknown=0xf, paramB=0x20c, script=0x0 + npc_raw subtype=0x3, x=0x78, y=0x48, pool=0xf, paramB=0x20c, script=0x0 entity_list_end Entities_MinishHouseInteriors_HyruleFieldSouthwest_1:: @ 080DB0E0 @@ -4826,7 +4826,7 @@ Room_MinishHouseInteriors_HyruleFieldSouthwest:: @ 080DB118 .4byte sub_StateChange_MinishHouseInteriors_HyruleFieldSouthwest Entities_MinishHouseInteriors_SouthHyruleField_0:: @ 080DB138 - npc_raw subtype=0x3, x=0x78, y=0x48, unknown=0xf, paramB=0x20d, script=0x0 + npc_raw subtype=0x3, x=0x78, y=0x48, pool=0xf, paramB=0x20d, script=0x0 entity_list_end Entities_MinishHouseInteriors_SouthHyruleField_1:: @ 080DB158 @@ -4850,7 +4850,7 @@ Room_MinishHouseInteriors_SouthHyruleField:: @ 080DB190 .4byte sub_StateChange_MinishHouseInteriors_SouthHyruleField Entities_MinishHouseInteriors_NextToKnuckle_0:: @ 080DB1B0 - npc_raw subtype=0x3, x=0x78, y=0x48, unknown=0xf, paramB=0x20e, script=0x0 + npc_raw subtype=0x3, x=0x78, y=0x48, pool=0xf, paramB=0x20e, script=0x0 entity_list_end Entities_MinishHouseInteriors_NextToKnuckle_1:: @ 080DB1D0 @@ -4901,7 +4901,7 @@ Room_MinishHouseInteriors_Librari:: @ 080DB290 .4byte sub_StateChange_MinishHouseInteriors_Librari Entities_MinishHouseInteriors_HyruleFieldExit_0:: @ 080DB2B0 - npc_raw subtype=0x3, x=0x78, y=0x48, unknown=0xf, paramB=0x20f, script=0x0 + npc_raw subtype=0x3, x=0x78, y=0x48, pool=0xf, paramB=0x20f, script=0x0 entity_list_end Entities_MinishHouseInteriors_HyruleFieldExit_1:: @ 080DB2D0 @@ -4949,7 +4949,7 @@ Room_MinishHouseInteriors_HyruleTown:: @ 080DB380 .4byte sub_StateChange_MinishHouseInteriors_HyruleTown Entities_MinishHouseInteriors_MinishWoodsBomb_0:: @ 080DB3A0 - npc_raw subtype=0x3, x=0x78, y=0x48, unknown=0xf, paramB=0x200, script=0x0 + npc_raw subtype=0x3, x=0x78, y=0x48, pool=0xf, paramB=0x200, script=0x0 entity_list_end Entities_MinishHouseInteriors_MinishWoodsBomb_1:: @ 080DB3C0 @@ -4973,7 +4973,7 @@ Room_MinishHouseInteriors_MinishWoodsBomb:: @ 080DB3F8 .4byte sub_StateChange_MinishHouseInteriors_MinishWoodsBomb Entities_MinishHouseInteriors_LakeHyliaOcarina_0:: @ 080DB418 - npc_raw subtype=0x3, x=0x78, y=0x40, unknown=0xf, paramB=0x210, script=0x0 + npc_raw subtype=0x3, x=0x78, y=0x40, pool=0xf, paramB=0x210, script=0x0 entity_list_end Entities_MinishHouseInteriors_LakeHyliaOcarina_1:: @ 080DB438 @@ -5264,7 +5264,7 @@ gUnk_080DBB70:: @ 080DBB70 entity_list_end gUnk_080DBB90:: @ 080DBB90 - object_raw subtype=0x69, unknown=0x48, paramC=script_CutsceneOrchestratorRem + object_raw subtype=0x69, pool=0x48, paramC=script_CutsceneOrchestratorRem entity_list_end Enemies_TownMinishHoles_RemShoeShop:: @ 080DBBB0 @@ -5333,7 +5333,7 @@ Entities_MinishCaves_SoutheastWater2_0:: @ 080DBCB8 Enemies_MinishCaves_SoutheastWater2:: @ 080DBCD8 enemy_raw subtype=0x40, x=0xb8, y=0xd8 enemy_raw subtype=0x40, x=0x48, y=0xd8 - manager subtype=0x28, unknown=0x3, paramB=0x2 + manager subtype=0x28, pool=0x3, paramB=0x2 enemy_raw subtype=0x32, x=0x50, y=0x70, paramA=0x1 enemy_raw subtype=0x32, x=0xa0, y=0x70, paramA=0x1 enemy_raw subtype=0x32, x=0x50, y=0xa0, paramA=0x1 @@ -5489,8 +5489,8 @@ Entities_MinishCaves_LakeHyliaLibrari_1:: @ 080DC0D8 entity_list_end Enemies_MinishCaves_LakeHyliaLibrari:: @ 080DC108 - projectile_raw subtype=0x1e, x=0x1d0, y=0x18, unknown=0x3, paramA=0x6, paramC=0x100fea0 - projectile_raw subtype=0x1e, x=0x1e0, y=0x18, unknown=0x3, paramA=0x6, paramC=0x1000160 + projectile_raw subtype=0x1e, x=0x1d0, y=0x18, pool=0x3, paramA=0x6, paramC=0x100fea0 + projectile_raw subtype=0x1e, x=0x1e0, y=0x18, pool=0x3, paramA=0x6, paramC=0x1000160 enemy_raw subtype=0x11, x=0x1f8, y=0x58, paramB=0xc120000, paramC=0x2001b0 enemy_raw subtype=0x11, x=0x278, y=0x58, paramB=0xc120000, paramC=0x200230 entity_list_end @@ -5541,7 +5541,7 @@ Room_MinishCaves_MinishWoodsSouthwest:: @ 080DC260 .4byte sub_StateChange_MinishCaves_MinishWoodsSouthwest Entities_MinishVillage_Main_0:: @ 080DC280 - manager subtype=0x7, unknown=0x18, paramA=0x8 + manager subtype=0x7, pool=0x18, paramA=0x8 enemy_raw subtype=0x6, x=0x118, y=0x268, collision=1 enemy_raw subtype=0x6, x=0x268, y=0x118, collision=1 enemy_raw subtype=0x6, x=0x178, y=0x108, collision=1, paramA=0x1 @@ -5560,43 +5560,43 @@ Entities_MinishVillage_Main_0:: @ 080DC280 entity_list_end gUnk_080DC390:: @ 080DC390 - npc_raw subtype=0x3, x=0x1e8, y=0x2e8, unknown=0xf, collision=1, paramB=0x21a, script=0x0 - npc_raw subtype=0x3, x=0x48, y=0x258, unknown=0xf, collision=1, paramB=0x21b, script=0x0 - npc_raw subtype=0x3, x=0x128, y=0x238, unknown=0xf, collision=1, paramB=0x21c, script=0x0 - npc_raw subtype=0x3, x=0x168, y=0x1e8, unknown=0xf, collision=1, paramB=0x21d, script=0x0 - npc_raw subtype=0x3, x=0x1a8, y=0x21a, unknown=0xf, collision=1, paramB=0x21e, script=0x0 + npc_raw subtype=0x3, x=0x1e8, y=0x2e8, pool=0xf, collision=1, paramB=0x21a, script=0x0 + npc_raw subtype=0x3, x=0x48, y=0x258, pool=0xf, collision=1, paramB=0x21b, script=0x0 + npc_raw subtype=0x3, x=0x128, y=0x238, pool=0xf, collision=1, paramB=0x21c, script=0x0 + npc_raw subtype=0x3, x=0x168, y=0x1e8, pool=0xf, collision=1, paramB=0x21d, script=0x0 + npc_raw subtype=0x3, x=0x1a8, y=0x21a, pool=0xf, collision=1, paramB=0x21e, script=0x0 entity_list_end gUnk_080DC3F0:: @ 080DC3F0 - npc_raw subtype=0x3, x=0x340, y=0x1e8, unknown=0xf, collision=1, paramB=0x316, script=0x0 - npc_raw subtype=0x3, x=0x340, y=0x1f8, unknown=0xf, collision=1, paramB=0x317, script=0x0 - npc_raw subtype=0x3, x=0x378, y=0x298, unknown=0xf, collision=1, paramB=0x221, script=0x0 + npc_raw subtype=0x3, x=0x340, y=0x1e8, pool=0xf, collision=1, paramB=0x316, script=0x0 + npc_raw subtype=0x3, x=0x340, y=0x1f8, pool=0xf, collision=1, paramB=0x317, script=0x0 + npc_raw subtype=0x3, x=0x378, y=0x298, pool=0xf, collision=1, paramB=0x221, script=0x0 entity_list_end gUnk_080DC430:: @ 080DC430 - npc_raw subtype=0x3, x=0x378, y=0x1f8, unknown=0xf, collision=1, paramB=0x219, script=0x0 - npc_raw subtype=0x3, x=0x238, y=0xf8, unknown=0xf, collision=1, paramB=0x11f, script=0x0 - npc_raw subtype=0x3, x=0x258, y=0xf8, unknown=0xf, collision=1, paramB=0x320, script=0x0 + npc_raw subtype=0x3, x=0x378, y=0x1f8, pool=0xf, collision=1, paramB=0x219, script=0x0 + npc_raw subtype=0x3, x=0x238, y=0xf8, pool=0xf, collision=1, paramB=0x11f, script=0x0 + npc_raw subtype=0x3, x=0x258, y=0xf8, pool=0xf, collision=1, paramB=0x320, script=0x0 entity_list_end gUnk_080DC470:: @ 080DC470 - npc_raw subtype=0x3, x=0x218, y=0x348, unknown=0xf, collision=1, paramB=0x222, script=0x0 + npc_raw subtype=0x3, x=0x218, y=0x348, pool=0xf, collision=1, paramB=0x222, script=0x0 object_raw subtype=0x4d, x=0x1fc, y=0x338, collision=1, paramA=0x18 object_raw subtype=0x4d, x=0x1f4, y=0x368, collision=1, paramA=0x18 object_raw subtype=0x4d, x=0x21c, y=0x368, collision=1, paramA=0x18 entity_list_end gUnk_080DC4C0:: @ 080DC4C0 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorVillageIntro - npc_raw subtype=0x3, x=0x208, y=0x2f0, unknown=0xf, collision=1, paramB=0x227, script=0x0 - npc_raw subtype=0x3, x=0x198, y=0x330, unknown=0xf, collision=1, paramB=0x128, script=0x0 - npc_raw subtype=0x3, x=0x278, y=0x330, unknown=0xf, collision=1, paramB=0x329, script=0x0 - npc_raw subtype=0x3, x=0x198, y=0x330, unknown=0xf, collision=1, paramB=0x12a, script=0x0 - npc_raw subtype=0x3, x=0x278, y=0x330, unknown=0xf, collision=1, paramB=0x32b, script=0x0 + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorVillageIntro + npc_raw subtype=0x3, x=0x208, y=0x2f0, pool=0xf, collision=1, paramB=0x227, script=0x0 + npc_raw subtype=0x3, x=0x198, y=0x330, pool=0xf, collision=1, paramB=0x128, script=0x0 + npc_raw subtype=0x3, x=0x278, y=0x330, pool=0xf, collision=1, paramB=0x329, script=0x0 + npc_raw subtype=0x3, x=0x198, y=0x330, pool=0xf, collision=1, paramB=0x12a, script=0x0 + npc_raw subtype=0x3, x=0x278, y=0x330, pool=0xf, collision=1, paramB=0x32b, script=0x0 entity_list_end gUnk_080DC530:: @ 080DC530 - npc_raw subtype=0x3, x=0x278, y=0xd8, unknown=0xf, collision=1, paramB=0x223, script=0x0 + npc_raw subtype=0x3, x=0x278, y=0xd8, pool=0xf, collision=1, paramB=0x223, script=0x0 entity_list_end Enemies_MinishVillage_Main:: @ 080DC550 @@ -5742,7 +5742,7 @@ Room_MinishCracks_LonLonRanchNorth:: @ 080DC790 .4byte sub_StateChange_MinishCracks_LonLonRanchNorth Entities_MinishCracks_LakeHyliaEast_0:: @ 080DC7B0 - npc_raw subtype=0x3, x=0x48, y=0x58, unknown=0xf, paramB=0x212, script=0x0 + npc_raw subtype=0x3, x=0x48, y=0x58, pool=0xf, paramB=0x212, script=0x0 entity_list_end Entities_MinishCracks_LakeHyliaEast_1:: @ 080DC7D0 @@ -5770,7 +5770,7 @@ Room_MinishCracks_LakeHyliaEast:: @ 080DC848 .4byte sub_StateChange_MinishCracks_LakeHyliaEast Entities_MinishCracks_HyruleCastleGarden_0:: @ 080DC868 - npc_raw subtype=0x3, x=0xa8, y=0x58, unknown=0xf, paramB=0x214, script=0x0 + npc_raw subtype=0x3, x=0xa8, y=0x58, pool=0xf, paramB=0x214, script=0x0 entity_list_end Entities_MinishCracks_HyruleCastleGarden_1:: @ 080DC888 @@ -5797,7 +5797,7 @@ Room_MinishCracks_HyruleCastleGarden:: @ 080DC8F0 .4byte sub_StateChange_MinishCracks_HyruleCastleGarden Entities_MinishCracks_MtCrenel_0:: @ 080DC910 - npc_raw subtype=0x3, x=0x38, y=0x38, unknown=0xf, paramB=0x211, script=0x0 + npc_raw subtype=0x3, x=0x38, y=0x38, pool=0xf, paramB=0x211, script=0x0 entity_list_end Entities_MinishCracks_MtCrenel_1:: @ 080DC930 @@ -5825,7 +5825,7 @@ Room_MinishCracks_MtCrenel:: @ 080DC9A0 .4byte sub_StateChange_MinishCracks_MtCrenel Entities_MinishCracks_EastHyruleCastle_0:: @ 080DC9C0 - npc_raw subtype=0x3, x=0x78, y=0x48, unknown=0xf, paramB=0x213, script=0x0 + npc_raw subtype=0x3, x=0x78, y=0x48, pool=0xf, paramB=0x213, script=0x0 entity_list_end Entities_MinishCracks_EastHyruleCastle_1:: @ 080DC9E0 @@ -5882,7 +5882,7 @@ Entities_MinishCracks_CastorWildsBow_0:: @ 080DCAF0 gUnk_080DCB10:: @ 080DCB10 manager subtype=0x1e, paramB=0xa000f0, paramC=0x80010000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x80008001 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x80008001 entity_list_end Entities_MinishCracks_CastorWildsBow_1:: @ 080DCB40 @@ -5914,7 +5914,7 @@ Room_MinishCracks_CastorWildsBow:: @ 080DCBD8 .4byte gUnk_additional_8_MinishCracks_CastorWildsBow Entities_MinishCracks_RuinsEntrance_0:: @ 080DCBFC - npc_raw subtype=0x3, x=0xa8, y=0x48, unknown=0xf, paramB=0x215, script=0x0 + npc_raw subtype=0x3, x=0xa8, y=0x48, pool=0xf, paramB=0x215, script=0x0 entity_list_end Entities_MinishCracks_RuinsEntrance_1:: @ 080DCC1C @@ -6204,8 +6204,8 @@ gUnk_additional_8_MelarisMine_Main:: @ 080DD214 npc_raw subtype=0x2d, x=0x1ba, y=0x138, paramA=0x6, paramB=0x5, script=script_MountainMinish3 npc_raw subtype=0x2d, x=0x1ba, y=0x148, paramA=0x6, paramB=0x6, script=script_MountainMinish3 npc_raw subtype=0x2f, x=0x190, y=0x140, script=script_Melari - object_raw subtype=0x6a, x=0x1a8, y=0x138, unknown=0x4f, paramA=0x8, paramC=script_CutsceneMiscObjectBrokenSword - object_raw subtype=0x6a, x=0x1a8, y=0x138, unknown=0x4f, paramA=0x9, paramC=script_CutsceneMiscObjectRepairedSword + object_raw subtype=0x6a, x=0x1a8, y=0x138, pool=0x4f, paramA=0x8, paramC=script_CutsceneMiscObjectBrokenSword + object_raw subtype=0x6a, x=0x1a8, y=0x138, pool=0x4f, paramA=0x9, paramC=script_CutsceneMiscObjectRepairedSword entity_list_end gUnk_additional_9_MelarisMine_Main:: @ 080DD274 @@ -6250,12 +6250,12 @@ Entities_CloudTops_House_0:: @ 080DD344 entity_list_end gUnk_080DD364:: @ 080DD364 - object_raw subtype=0xbb, x=0x1e8, y=0x1a8, unknown=0x4f, paramB=0x2, paramC=script_Windcrest + object_raw subtype=0xbb, x=0x1e8, y=0x1a8, pool=0x4f, paramB=0x2, paramC=script_Windcrest entity_list_end Entities_CloudTops_House_1:: @ 080DD384 - manager subtype=0x1d, unknown=0x8, paramA=0x1 - manager subtype=0x1a, unknown=0x8, paramA=0xe + manager subtype=0x1d, pool=0x8, paramA=0x1 + manager subtype=0x1a, pool=0x8, paramA=0xe object_raw subtype=0x94, x=0x1b0, y=0x141 object_raw subtype=0x94, x=0x220, y=0x141, paramA=0x1 entity_list_end @@ -6299,24 +6299,24 @@ Entities_CloudTops_Middle_0:: @ 080DD40C entity_list_end Entities_CloudTops_Middle_1:: @ 080DD49C - manager subtype=0x1d, unknown=0x8, paramA=0x1 + manager subtype=0x1d, pool=0x8, paramA=0x1 manager subtype=0x16, paramA=0x8, paramB=0x100 - manager subtype=0x1a, unknown=0x8, paramA=0xf - manager subtype=0x1a, unknown=0x8, paramA=0x10 - manager subtype=0x1a, unknown=0x8, paramA=0x11 - manager subtype=0x1a, unknown=0x8, paramA=0x12 - manager subtype=0x1a, unknown=0x8, paramA=0x13 - manager subtype=0x1a, unknown=0x8, paramA=0x14 - manager subtype=0x1a, unknown=0x8, paramA=0x15 - manager subtype=0x1a, unknown=0x8, paramA=0x16 - manager subtype=0x1a, unknown=0x8, paramA=0x17 - manager subtype=0x1a, unknown=0x8, paramA=0x18 - manager subtype=0x1a, unknown=0x8, paramA=0x19 - manager subtype=0x1a, unknown=0x8, paramA=0x1a - manager subtype=0x1a, unknown=0x8, paramA=0x1b - manager subtype=0x1a, unknown=0x8, paramA=0x1c - manager subtype=0x1a, unknown=0x8, paramA=0x1d - manager subtype=0x1a, unknown=0x8, paramA=0x1e + manager subtype=0x1a, pool=0x8, paramA=0xf + manager subtype=0x1a, pool=0x8, paramA=0x10 + manager subtype=0x1a, pool=0x8, paramA=0x11 + manager subtype=0x1a, pool=0x8, paramA=0x12 + manager subtype=0x1a, pool=0x8, paramA=0x13 + manager subtype=0x1a, pool=0x8, paramA=0x14 + manager subtype=0x1a, pool=0x8, paramA=0x15 + manager subtype=0x1a, pool=0x8, paramA=0x16 + manager subtype=0x1a, pool=0x8, paramA=0x17 + manager subtype=0x1a, pool=0x8, paramA=0x18 + manager subtype=0x1a, pool=0x8, paramA=0x19 + manager subtype=0x1a, pool=0x8, paramA=0x1a + manager subtype=0x1a, pool=0x8, paramA=0x1b + manager subtype=0x1a, pool=0x8, paramA=0x1c + manager subtype=0x1a, pool=0x8, paramA=0x1d + manager subtype=0x1a, pool=0x8, paramA=0x1e entity_list_end gUnk_additional_8_CloudTops_Middle:: @ 080DD5CC @@ -6375,7 +6375,7 @@ gUnk_080DD730:: @ 080DD730 entity_list_end gUnk_080DD750:: @ 080DD750 - object_raw subtype=0x69, x=0x1e8, y=0x1b8, unknown=0x4f, paramC=script_CutsceneOrchestratorGreatWhirlwindRevealed + object_raw subtype=0x69, x=0x1e8, y=0x1b8, pool=0x4f, paramC=script_CutsceneOrchestratorGreatWhirlwindRevealed npc_raw subtype=0x49, x=0x268, y=0x1d8, paramA=0x1, paramB=0x60b, script=script_WindTribespeopleGreatWhirlwindRevealed2 npc_raw subtype=0x49, x=0x1a8, y=0x1f8, paramA=0x3, paramB=0x40a, script=script_WindTribespeopleGreatWhirlwindRevealed1 entity_list_end @@ -6394,13 +6394,13 @@ Entities_CloudTops_Bottom_0:: @ 080DD790 entity_list_end gUnk_080DD7E0:: @ 080DD7E0 - manager subtype=0xb, unknown=0x0, paramB=0xa, paramC=0x80000000 + manager subtype=0xb, pool=0x0, paramB=0xa, paramC=0x80000000 .ifdef EU_JP object_raw subtype=0xa3, x=0x208, y=0x38, paramB=0xf0 - manager subtype=0xe, unknown=0x1f, paramA=0xc, paramC=0xf00000 + manager subtype=0xe, pool=0x1f, paramA=0xc, paramC=0xf00000 .else object_raw subtype=0xa3, x=0x208, y=0x38, paramB=0xf3 - manager subtype=0xe, unknown=0x1f, paramA=0xc, paramC=0xf30000 + manager subtype=0xe, pool=0x1f, paramA=0xc, paramC=0xf30000 .endif entity_list_end @@ -6410,14 +6410,14 @@ gUnk_additional_c_CloudTops_Bottom:: @ 080DD820 gUnk_080DD840:: @ 080DD840 .ifdef EU_JP - manager subtype=0xb, unknown=0x0, paramB=0xb, paramC=0x80080000 + manager subtype=0xb, pool=0x0, paramB=0xb, paramC=0x80080000 object_raw subtype=0xa3, x=0x238, y=0x2e8, paramB=0x8f2 - manager subtype=0xe, unknown=0x1f, paramA=0xd, paramC=0xf00000 + manager subtype=0xe, pool=0x1f, paramA=0xd, paramC=0xf00000 entity_list_end .else - manager subtype=0xb, unknown=0x0, paramB=0xb, paramC=0x80080000 + manager subtype=0xb, pool=0x0, paramB=0xb, paramC=0x80080000 object_raw subtype=0xa3, x=0x238, y=0x2e8, paramB=0x8f5 - manager subtype=0xe, unknown=0x1f, paramA=0xd, paramC=0xf30000 + manager subtype=0xe, pool=0x1f, paramA=0xd, paramC=0xf30000 entity_list_end .endif @@ -6426,9 +6426,9 @@ gUnk_additional_d_CloudTops_Bottom:: @ 080DD880 entity_list_end Entities_CloudTops_Bottom_1:: @ 080DD8A0 - manager subtype=0x1d, unknown=0x8, paramA=0x1 + manager subtype=0x1d, pool=0x8, paramA=0x1 manager subtype=0x16, paramA=0x8, paramB=0x100 - manager subtype=0x1a, unknown=0x8, paramA=0x1f + manager subtype=0x1a, pool=0x8, paramA=0x1f object_raw subtype=0x82, x=0x1e8, y=0x1b8, paramB=0x2, paramC=0x40240000 entity_list_end @@ -6543,7 +6543,7 @@ Entities_Ruins_Entrance_0:: @ 080DDC00 Entities_Ruins_Entrance_1:: @ 080DDC20 manager subtype=0x6, paramA=0x8 - manager subtype=0x3, x=0x38, y=0x1e0, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x38, y=0x1e0, pool=0x0, paramB=0x102 entity_list_end Enemies_Ruins_Entrance:: @ 080DDC50 @@ -6637,12 +6637,12 @@ Room_Ruins_Beanstalk:: @ 080DDE20 Entities_Ruins_TripleTektites_0:: @ 080DDE48 .ifdef EU_JP - manager subtype=0xb, unknown=0x0, paramB=0xa, paramC=0x280000 - manager subtype=0x2e, unknown=0x0, paramC=0x280000 + manager subtype=0xb, pool=0x0, paramB=0xa, paramC=0x280000 + manager subtype=0x2e, pool=0x0, paramC=0x280000 manager subtype=0xf, x=0x58, y=0x28, paramA=0x9, paramC=0x280000 .else - manager subtype=0xb, unknown=0x0, paramB=0xa, paramC=0x270000 - manager subtype=0x2e, unknown=0x0, paramC=0x270000 + manager subtype=0xb, pool=0x0, paramB=0xa, paramC=0x270000 + manager subtype=0x2e, pool=0x0, paramC=0x270000 manager subtype=0xf, x=0x58, y=0x28, paramA=0x9, paramC=0x270000 .endif entity_list_end @@ -6720,11 +6720,11 @@ Entities_Ruins_FortressEntrance_0:: @ 080DDFE8 entity_list_end gUnk_080DE008:: @ 080DE008 - object_raw subtype=0x69, unknown=0x4f, paramC=script_EzloTalkFoW + object_raw subtype=0x69, pool=0x4f, paramC=script_EzloTalkFoW entity_list_end Entities_Ruins_FortressEntrance_1:: @ 080DE028 - manager subtype=0x3, x=0x48, y=0x40, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x48, y=0x40, pool=0x0, paramB=0x102 entity_list_end Enemies_Ruins_FortressEntrance:: @ 080DE048 @@ -6771,20 +6771,20 @@ Room_Ruins_FortressEntrance:: @ 080DE12C Entities_Ruins_Armos_0:: @ 080DE150 .ifdef EU_JP - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x800000f9 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x800000f9 manager subtype=0x35, x=0x160, y=0x48, paramB=0x781400, paramC=0xf90031 manager subtype=0xf, x=0x158, y=0x48, paramA=0x9, paramC=0x310000 manager subtype=0xf, x=0x168, y=0x48, paramA=0x9, paramC=0x310000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x800100fa + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x800100fa manager subtype=0x35, x=0x1c0, y=0x18, paramB=0x781400, paramC=0xfa0032 manager subtype=0xf, x=0x1b8, y=0x18, paramA=0x9, paramC=0x320000 manager subtype=0xf, x=0x1c8, y=0x18, paramA=0x9, paramC=0x320000 .else - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x80000032 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x80000032 manager subtype=0x35, x=0x160, y=0x48, paramB=0x781400, paramC=0x320030 manager subtype=0xf, x=0x158, y=0x48, paramA=0x9, paramC=0x300000 manager subtype=0xf, x=0x168, y=0x48, paramA=0x9, paramC=0x300000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x80010033 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x80010033 manager subtype=0x35, x=0x1c0, y=0x18, paramB=0x781400, paramC=0x330031 manager subtype=0xf, x=0x1b8, y=0x18, paramA=0x9, paramC=0x310000 manager subtype=0xf, x=0x1c8, y=0x18, paramA=0x9, paramC=0x310000 @@ -6792,15 +6792,15 @@ Entities_Ruins_Armos_0:: @ 080DE150 entity_list_end gUnk_080DE1E0:: @ 080DE1E0 - manager subtype=0xb, unknown=0x0, paramB=0xd, paramC=0x80000000 + manager subtype=0xb, pool=0x0, paramB=0xd, paramC=0x80000000 entity_list_end gUnk_080DE200:: @ 080DE200 - manager subtype=0xb, unknown=0x0, paramB=0xe, paramC=0x80010000 + manager subtype=0xb, pool=0x0, paramB=0xe, paramC=0x80010000 entity_list_end Entities_Ruins_Armos_1:: @ 080DE220 - manager subtype=0x3, x=0xa8, y=0x30, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0xa8, y=0x30, pool=0x0, paramB=0x102 entity_list_end Enemies_Ruins_Armos:: @ 080DE240 @@ -6811,13 +6811,13 @@ gUnk_additional_d_Ruins_Armos:: @ 080DE260 enemy_raw subtype=0x2a, x=0x88, y=0x58, paramB=0x122c0309, paramC=0x100010 enemy_raw subtype=0x2a, x=0xc8, y=0x58, paramB=0x122c040a, paramC=0x100010 enemy_raw subtype=0x2a, x=0x108, y=0x58, paramB=0x122c050b, paramC=0x100010 - manager subtype=0x28, unknown=0x3, paramB=0xd + manager subtype=0x28, pool=0x3, paramB=0xd entity_list_end gUnk_additional_e_Ruins_Armos:: @ 080DE2B0 enemy_raw subtype=0x35, x=0x1c8, y=0x58, paramA=0x1 enemy_raw subtype=0x35, x=0x1b8, y=0x98, paramA=0x1 - manager subtype=0x28, unknown=0x3, paramB=0xe + manager subtype=0x28, pool=0x3, paramB=0xe enemy_raw subtype=0x2c, x=0x58, y=0xc8, paramB=0x83c0000, paramC=0xb00010 enemy_raw subtype=0x2c, x=0x1c8, y=0x78, paramB=0x1c0c0000, paramC=0x100190 enemy_raw subtype=0x2c, x=0x1c8, y=0xd8, paramB=0x1c0c0000, paramC=0x100190 @@ -6871,28 +6871,28 @@ Room_Ruins_Armos:: @ 080DE39C Entities_DeepwoodShrine_Madderpillar_0:: @ 080DE3D8 manager subtype=0x1e, x=0x40, y=0x40, paramB=0x70009d, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x170000 - manager subtype=0x2e, x=0x25, unknown=0x0, paramB=0x100, paramC=0x170000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x170000 + manager subtype=0x2e, x=0x25, pool=0x0, paramB=0x100, paramC=0x170000 object_raw subtype=0xc, x=0x90, y=0x78, paramA=0x2, paramB=0x1b, paramC=0x170000 object_raw subtype=0x8, x=0xe8, y=0x58, paramA=0x1, paramC=0x1effff - projectile_raw subtype=0x15, x=0xe8, y=0x98, unknown=0xf, paramA=0x1, paramC=0x190000 - projectile_raw subtype=0x15, x=0xc8, y=0xb8, unknown=0xf, paramA=0x2, paramC=0x1a0000 - projectile_raw subtype=0x15, x=0x58, y=0x38, unknown=0xf - projectile_raw subtype=0x15, x=0x78, y=0x38, unknown=0xf - projectile_raw subtype=0x15, x=0xa8, y=0x38, unknown=0xf - projectile_raw subtype=0x15, x=0x68, y=0xb8, unknown=0xf, paramA=0x2 - projectile_raw subtype=0x15, x=0x88, y=0xb8, unknown=0xf, paramA=0x2 - projectile_raw subtype=0x15, x=0x38, y=0x78, unknown=0xf, paramA=0x3 - projectile_raw subtype=0x15, x=0x38, y=0x98, unknown=0xf, paramA=0x3 + projectile_raw subtype=0x15, x=0xe8, y=0x98, pool=0xf, paramA=0x1, paramC=0x190000 + projectile_raw subtype=0x15, x=0xc8, y=0xb8, pool=0xf, paramA=0x2, paramC=0x1a0000 + projectile_raw subtype=0x15, x=0x58, y=0x38, pool=0xf + projectile_raw subtype=0x15, x=0x78, y=0x38, pool=0xf + projectile_raw subtype=0x15, x=0xa8, y=0x38, pool=0xf + projectile_raw subtype=0x15, x=0x68, y=0xb8, pool=0xf, paramA=0x2 + projectile_raw subtype=0x15, x=0x88, y=0xb8, pool=0xf, paramA=0x2 + projectile_raw subtype=0x15, x=0x38, y=0x78, pool=0xf, paramA=0x3 + projectile_raw subtype=0x15, x=0x38, y=0x98, pool=0xf, paramA=0x3 entity_list_end gUnk_080DE4C8:: @ 080DE4C8 - manager subtype=0xf, unknown=0x0, paramA=0xd, paramC=0x170000 + manager subtype=0xf, pool=0x0, paramA=0xd, paramC=0x170000 entity_list_end gUnk_additional_8_DeepwoodShrine_Madderpillar:: @ 080DE4E8 enemy_raw subtype=0x18, x=0x98, y=0x88 - manager subtype=0x2e, x=0x2d, unknown=0x0, paramB=0x100, paramC=0x80000000 + manager subtype=0x2e, x=0x2d, pool=0x0, paramB=0x100, paramC=0x80000000 object_raw subtype=0x8, x=0xe8, y=0x58, paramA=0x5, paramC=0x8000ffff ezlo_hint type=0x3, x=0x8, y=0x8, rx=0xa, ry=0x7, msg=0xb00, flag=0x17, flag2=0x8000 entity_list_end @@ -6917,7 +6917,7 @@ Entities_DeepwoodShrine_BluePortal_0:: @ 080DE574 object_raw subtype=0x3, x=0x108, y=0x98, paramC=0x1c0000 object_raw subtype=0x8, x=0xe8, y=0xc8, paramA=0x2, paramC=0x1cffff object_raw subtype=0x3, x=0xc8, y=0x98, paramC=0x1d0000 - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x1d0054 + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x1d0054 object_raw subtype=0x34, x=0xe8, y=0x58, paramB=0xb48, paramC=0x540209 object_raw subtype=0x3, x=0x58, y=0x68, paramC=0x1f0000 object_raw subtype=0xc, x=0x68, y=0x38, paramA=0x1, paramC=0x1f0000 @@ -7171,17 +7171,17 @@ Room_DeepwoodShrine_Button:: @ 080DED6C Entities_DeepwoodShrine_Mulldozer_0:: @ 080DED8C manager subtype=0x1e, x=0x30, y=0x60, paramB=0x2000b0, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x2f8000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x2f8000 object_raw subtype=0x8, x=0x88, y=0x98, paramA=0x12, paramC=0xffff object_raw subtype=0x8, x=0x28, y=0x48, paramA=0x83, paramC=0x53ffff - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x2f0053 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x2f0053 manager subtype=0x17, x=0x88, y=0x58, paramA=0x53, paramB=0x10200, paramC=0x530030 entity_list_end gUnk_additional_8_DeepwoodShrine_Mulldozer:: @ 080DEDFC - enemy_raw subtype=0x32, x=0x58, y=0x78, unknown=0x2f - enemy_raw subtype=0x32, x=0xb8, y=0x78, unknown=0x2f - enemy_raw subtype=0x32, x=0x88, y=0x38, unknown=0x2f + enemy_raw subtype=0x32, x=0x58, y=0x78, pool=0x2f + enemy_raw subtype=0x32, x=0xb8, y=0x78, pool=0x2f + enemy_raw subtype=0x32, x=0x88, y=0x38, pool=0x2f entity_list_end Enemies_DeepwoodShrine_Mulldozer:: @ 080DEE3C @@ -7205,7 +7205,7 @@ Room_DeepwoodShrine_Mulldozer:: @ 080DEE5C Entities_DeepwoodShrine_Pillars_0:: @ 080DEE80 object_raw subtype=0x3, x=0x98, y=0x48, paramA=0x1, paramC=0x80000000 object_raw subtype=0x8, x=0x88, y=0x18, paramA=0x80, paramC=0x8000002f - manager subtype=0x2e, unknown=0x0, paramA=0x1, paramB=0xa00, paramC=0x80000000 + manager subtype=0x2e, pool=0x0, paramA=0x1, paramB=0xa00, paramC=0x80000000 object_raw subtype=0x27, x=0x48, y=0x48 object_raw subtype=0x27, x=0x78, y=0x48 entity_list_end @@ -7269,8 +7269,8 @@ Room_DeepwoodShrine_Lever:: @ 080DF090 Entities_DeepwoodShrine_Entrance_0:: @ 080DF0B0 ezlo_hint x=0x6, y=0x16, rx=0xf, ry=0x3, msg=0xb12, flag=0x37 - projectile_raw subtype=0x15, x=0x48, y=0x68, unknown=0xf, paramC=0x340000 - projectile_raw subtype=0x15, x=0x108, y=0x68, unknown=0xf, paramC=0x350000 + projectile_raw subtype=0x15, x=0x48, y=0x68, pool=0xf, paramC=0x340000 + projectile_raw subtype=0x15, x=0x108, y=0x68, pool=0xf, paramC=0x350000 object_raw subtype=0x34, x=0x98, y=0x88, paramB=0x148, paramC=0x36014e object_raw subtype=0x34, x=0xb8, y=0x88, paramA=0x1, paramB=0x1148, paramC=0x3602d4 object_raw subtype=0x27, x=0x98, y=0x38 @@ -7494,7 +7494,7 @@ Entities_DeepwoodShrine_LilyPadEast_0:: @ 080DF72C object_raw subtype=0x33, x=0xc8, y=0x48, paramC=0x80000000 object_raw subtype=0x33, x=0xd8, y=0x48, paramC=0x80000000 object_raw subtype=0x33, x=0xe8, y=0x48, paramC=0x80000000 - manager subtype=0x2e, unknown=0x0, paramA=0x1, paramB=0xa00, paramC=0x80000000 + manager subtype=0x2e, pool=0x0, paramA=0x1, paramB=0xa00, paramC=0x80000000 object_raw subtype=0x5, x=0x18, y=0x18, paramA=0x5f object_raw subtype=0x5, x=0x18, y=0x28, paramA=0x5f object_raw subtype=0x5, x=0x18, y=0x38 @@ -7513,7 +7513,7 @@ Entities_DeepwoodShrine_LilyPadEast_0:: @ 080DF72C object_raw subtype=0x33, x=0xc8, y=0x48, paramC=0x80000000 object_raw subtype=0x33, x=0xd8, y=0x48, paramC=0x80000000 object_raw subtype=0x33, x=0xe8, y=0x48, paramC=0x80000000 - manager subtype=0x2e, unknown=0x0, paramA=0x1, paramB=0xa00, paramC=0x80000000 + manager subtype=0x2e, pool=0x0, paramA=0x1, paramB=0xa00, paramC=0x80000000 object_raw subtype=0x5, x=0x18, y=0x18, paramA=0x5f object_raw subtype=0x5, x=0x18, y=0x28, paramA=0x5f object_raw subtype=0x5, x=0x18, y=0x38 @@ -7546,7 +7546,7 @@ Room_DeepwoodShrine_LilyPadEast:: @ 080DF86C Entities_DeepwoodShrineBoss_Main_0:: @ 080DF88C object_raw subtype=0x39, x=0x88, y=0xc8, paramA=0x6, paramC=0xffff - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x40020000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x40020000 manager subtype=0xe, y=0x3c, paramA=0x9, paramB=0x1, paramC=0x40020000 ezlo_hint type=0x3, x=0x0, y=0x0, rx=0x3f, ry=0x3f, msg=0xb01, flag=0x4002 object_raw subtype=0x5, x=0x38, y=0x38, paramA=0x5f @@ -7557,7 +7557,7 @@ Entities_DeepwoodShrineBoss_Main_0:: @ 080DF88C gUnk_additional_9_DeepwoodShrineBoss_Main:: @ 080DF91C object_raw subtype=0xac, x=0x88, y=0x68, paramA=0x40 - manager subtype=0xe, y=0x3c, unknown=0x1f, paramA=0xa, paramC=0x80000000 + manager subtype=0xe, y=0x3c, pool=0x1f, paramA=0xa, paramC=0x80000000 entity_list_end gUnk_additional_a_DeepwoodShrineBoss_Main:: @ 080DF94C @@ -7621,7 +7621,7 @@ Entities_DeepwoodShrine_InsideBarrel_0:: @ 080DFA90 object_raw subtype=0x26, x=0x50, y=0x50, paramA=0x3 object_raw subtype=0x26, x=0x78, y=0x50, paramA=0x4 object_raw subtype=0x26, x=0xa0, y=0x50, paramA=0x5 - manager subtype=0x1a, unknown=0x8 + manager subtype=0x1a, pool=0x8 ezlo_hint x=0x4, y=0xa, rx=0xc, ry=0x1, msg=0xb35, flag=0x4e, flag2=0x415 entity_list_end @@ -7645,7 +7645,7 @@ Entities_DeepwoodShrineEntry_Main_0:: @ 080DFB68 entity_list_end gUnk_080DFB78:: @ 080DFB78 - object_raw subtype=0x69, unknown=0x4f, paramC=script_EzloTalkDWS + object_raw subtype=0x69, pool=0x4f, paramC=script_EzloTalkDWS entity_list_end Enemies_DeepwoodShrineEntry_Main:: @ 080DFB98 @@ -7677,7 +7677,7 @@ Entities_CaveOfFlames_AfterCane_0:: @ 080DFBD0 entity_list_end Entities_CaveOfFlames_AfterCane_1:: @ 080DFC70 - manager subtype=0x14, unknown=0x8 + manager subtype=0x14, pool=0x8 object_raw subtype=0x4f, x=0x88, y=0x100, paramA=0xd, paramB=0x2 entity_list_end @@ -7707,7 +7707,7 @@ Entities_CaveOfFlames_SpinyChus_0:: @ 080DFD14 object_raw subtype=0x6c, x=0x128, y=0xe8, paramA=0x2 object_raw subtype=0x6d, x=0x118, y=0x98, paramA=0x1, paramB=0x20382108, paramC=0x170017 manager subtype=0x1e, x=0x70, y=0x60, paramB=0x300020, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x168000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x168000 object_raw subtype=0xc, x=0x80, y=0x78, paramA=0x2, paramB=0x19, paramC=0x160000 ezlo_hint type=0x3, x=0x0, y=0x0, rx=0x3f, ry=0x3f, msg=0xb02, flag=0x16, flag2=0x8000 object_raw subtype=0x8, x=0x38, y=0x78, paramA=0x3, paramC=0x160000 @@ -7981,9 +7981,9 @@ Room_CaveOfFlames_CartWest:: @ 080E0770 .4byte sub_StateChange_CaveOfFlames_CartWest Entities_CaveOfFlames_Helmasaur_0:: @ 080E0790 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x220000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x220000 object_raw subtype=0x74, x=0x78, y=0x88, collision=2, paramC=0x220000 - manager subtype=0x3, x=0x78, y=0x88, unknown=0x0, paramA=0x3, paramB=0x200 + manager subtype=0x3, x=0x78, y=0x88, pool=0x0, paramA=0x3, paramB=0x200 ezlo_hint x=0x6, y=0x6, rx=0x9, ry=0xb, msg=0xb3b, flag=0x23, flag2=0x4063 entity_list_end @@ -8030,7 +8030,7 @@ Entities_CaveOfFlames_Rollobite_0:: @ 080E089C entity_list_end Entities_CaveOfFlames_Rollobite_1:: @ 080E093C - manager subtype=0x14, unknown=0x8 + manager subtype=0x14, pool=0x8 object_raw subtype=0x4f, x=0xb8, y=0x10, paramA=0xd entity_list_end @@ -8068,7 +8068,7 @@ Room_CaveOfFlames_Rollobite:: @ 080E0A20 Entities_CaveOfFlames_MinishLava_0:: @ 080E0A44 object_raw subtype=0xc, x=0x120, y=0x38, paramA=0x4, paramB=0x2a object_raw subtype=0x74, x=0xf8, y=0xa8, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0xf8, y=0xa8, unknown=0x0, paramA=0x3, paramB=0x103 + manager subtype=0x3, x=0xf8, y=0xa8, pool=0x0, paramA=0x3, paramB=0x103 object_raw subtype=0x3, x=0x58, y=0x138, paramC=0x280000 object_raw subtype=0x8, x=0x48, y=0x178, paramA=0x3, paramC=0x280000 object_raw subtype=0x59, paramB=0x8 @@ -8080,7 +8080,7 @@ Entities_CaveOfFlames_MinishLava_0:: @ 080E0A44 entity_list_end Entities_CaveOfFlames_MinishLava_1:: @ 080E0B04 - manager subtype=0x14, unknown=0x8 + manager subtype=0x14, pool=0x8 entity_list_end Enemies_CaveOfFlames_MinishLava:: @ 080E0B24 @@ -8112,9 +8112,9 @@ Room_CaveOfFlames_MinishLava:: @ 080E0C14 Entities_CaveOfFlames_MinishSpikes_0:: @ 080E0C38 object_raw subtype=0x55, x=0xf8, y=0x78, paramB=0x201 object_raw subtype=0x74, x=0x248, y=0x98, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0x248, y=0x98, unknown=0x0, paramA=0x3, paramB=0x100 + manager subtype=0x3, x=0x248, y=0x98, pool=0x0, paramA=0x3, paramB=0x100 object_raw subtype=0x74, x=0x48, y=0x48, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0x48, y=0x48, unknown=0x0, paramA=0x3, paramB=0x102 + manager subtype=0x3, x=0x48, y=0x48, pool=0x0, paramA=0x3, paramB=0x102 object_raw subtype=0x2f, x=0x238, y=0x68, paramC=0x2b0000 object_raw subtype=0x13, x=0x218, y=0x68, paramA=0x3, paramB=0xff02, paramC=0x2b0000 manager subtype=0x1f, x=0x218, y=0x48, paramA=0x1, paramB=0x10000, paramC=0x2b0000 @@ -8169,7 +8169,7 @@ Entities_CaveOfFlames_RollobiteSwitch_0:: @ 080E0E5C object_raw subtype=0x55, x=0x248, y=0x68, paramB=0x200 object_raw subtype=0x6c, x=0x248, y=0x28 object_raw subtype=0x6d, x=0x268, y=0xa8, paramA=0x2, paramB=0x104811d8, paramC=0x2f002e - manager subtype=0x2e, unknown=0x0, paramB=0xa00, paramC=0x2e003d + manager subtype=0x2e, pool=0x0, paramB=0xa00, paramC=0x2e003d object_raw subtype=0x33, x=0x1c8, y=0x98, paramA=0x1, paramC=0x3d0000 object_raw subtype=0x33, x=0x1d8, y=0x98, paramA=0x1, paramC=0x3d0000 object_raw subtype=0x33, x=0x1e8, y=0x98, paramA=0x1, paramC=0x3d0000 @@ -8213,7 +8213,7 @@ Entities_CaveOfFlames_BeforeGleerok_0:: @ 080E0F6C entity_list_end Entities_CaveOfFlames_BeforeGleerok_1:: @ 080E101C - manager subtype=0x1a, unknown=0x8, paramA=0x1 + manager subtype=0x1a, pool=0x8, paramA=0x1 entity_list_end gUnk_080E103C:: @ 080E103C @@ -8299,7 +8299,7 @@ Room_CaveOfFlames_PathBossKey2:: @ 080E11F0 .4byte gUnk_additional_9_CaveOfFlames_PathBossKey2 Entities_CaveOfFlames_Compass_0:: @ 080E1218 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x310000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x310000 ezlo_hint x=0x6, y=0xa, rx=0x9, ry=0x2, msg=0xb27, flag=0x33 object_raw subtype=0xc, x=0x78, y=0x68, paramA=0x2, paramB=0x32, paramC=0x310000 object_raw subtype=0x8, x=0x28, y=0x58, paramA=0x3, paramC=0x31ffff @@ -8392,7 +8392,7 @@ Entities_CaveOfFlames_BossDoor_0:: @ 080E143C entity_list_end Entities_CaveOfFlames_BossDoor_1:: @ 080E156C - manager subtype=0x14, unknown=0x8 + manager subtype=0x14, pool=0x8 entity_list_end Enemies_CaveOfFlames_BossDoor:: @ 080E158C @@ -8473,14 +8473,14 @@ Room_CaveOfFlames_18:: @ 080E1784 .4byte sub_StateChange_CaveOfFlames_18 Entities_CaveOfFlamesBoss_Main_0:: @ 080E17A4 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x40030000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x40030000 manager subtype=0xe, y=0x168, paramA=0x9, paramB=0x1, paramC=0x40030000 ezlo_hint type=0x3, x=0x0, y=0x0, rx=0x3f, ry=0x3f, msg=0xb03, flag=0x4003 entity_list_end gUnk_additional_9_CaveOfFlamesBoss_Main:: @ 080E17E4 object_raw subtype=0xac, x=0xc0, y=0x90, paramA=0x41 - manager subtype=0xe, y=0x3c, unknown=0x1f, paramA=0xa, paramC=0x80000000 + manager subtype=0xe, y=0x3c, pool=0x1f, paramA=0xa, paramC=0x80000000 entity_list_end gUnk_additional_a_CaveOfFlamesBoss_Main:: @ 080E1814 @@ -8512,7 +8512,7 @@ Room_CaveOfFlamesBoss_Main:: @ 080E1874 Entities_FortressOfWinds_Eyegore_0:: @ 080E18A0 object_raw subtype=0x3, x=0x58, y=0x88, paramA=0x1, paramC=0x80000000 object_raw subtype=0x3, x=0x98, y=0x88, paramA=0x1, paramC=0x80010000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x1b0000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x1b0000 object_raw subtype=0xc, x=0x80, y=0x68, paramA=0x2, paramB=0x1c, paramC=0x1b0000 enemy_raw subtype=0x43, x=0xd8, y=0x38 enemy_raw subtype=0x43, x=0x28, y=0x98 @@ -8531,7 +8531,7 @@ TileEntities_FortressOfWinds_Eyegore:: @ 080E1940 gUnk_additional_8_FortressOfWinds_Eyegore:: @ 080E1958 enemy_raw subtype=0x2b, x=0x60, y=0x50, paramB=0xe188400, paramC=0x300020 enemy_raw subtype=0x2b, x=0xa0, y=0x50, paramB=0xe188400, paramC=0x300020 - manager subtype=0x28, unknown=0x3, paramB=0x8 + manager subtype=0x28, pool=0x3, paramB=0x8 entity_list_end Room_FortressOfWinds_Eyegore:: @ 080E1998 @@ -8586,15 +8586,15 @@ Entities_FortressOfWinds_EastKeyLever_0:: @ 080E1AEC object_raw subtype=0x8, x=0x188, y=0xb8, paramA=0x2, paramC=0x1effff object_raw subtype=0x8, x=0x188, y=0xf8, paramC=0x1effff object_raw subtype=0x74, x=0x188, y=0x68, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0x188, y=0x68, unknown=0x0, paramA=0x3, paramB=0x102 + manager subtype=0x3, x=0x188, y=0x68, pool=0x0, paramA=0x3, paramB=0x102 object_raw subtype=0x74, x=0x38, y=0x118, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0x38, y=0x118, unknown=0x0, paramA=0x3, paramB=0x102 + manager subtype=0x3, x=0x38, y=0x118, pool=0x0, paramA=0x3, paramB=0x102 object_raw subtype=0x8, x=0x1f8, y=0xf8, paramA=0x8, paramC=0x1dffff object_raw subtype=0x8, x=0x1f8, y=0xb8, paramA=0xa, paramC=0x1dffff object_raw subtype=0x54, x=0x88, y=0xf4, paramB=0x200000, paramC=0x80020000 manager subtype=0x11, paramC=0x80020020 manager subtype=0xf, x=0xa8, y=0x148, paramA=0x2, paramC=0x200000 - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x20001f + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x20001f ezlo_hint x=0xc, y=0x20, rx=0x4, ry=0x7, msg=0xb3d, flag=0x46, flag2=0x1f enemy_raw subtype=0x43, x=0x1d8, y=0x108 enemy_raw subtype=0x43, x=0x1d8, y=0x118 @@ -8614,8 +8614,8 @@ Entities_FortressOfWinds_EastKeyLever_0:: @ 080E1AEC entity_list_end Entities_FortressOfWinds_EastKeyLever_1:: @ 080E1CEC - manager subtype=0x1a, unknown=0x8, paramA=0x2 - manager subtype=0x1a, unknown=0x8, paramA=0x3 + manager subtype=0x1a, pool=0x8, paramA=0x2 + manager subtype=0x1a, pool=0x8, paramA=0x3 entity_list_end Enemies_FortressOfWinds_EastKeyLever:: @ 080E1D1C @@ -8695,11 +8695,11 @@ Room_FortressOfWinds_PitPlatforms:: @ 080E1F48 .4byte gUnk_additional_a_FortressOfWinds_PitPlatforms Entities_FortressOfWinds_WestKeyLever_0:: @ 080E1F74 - manager subtype=0x1a, unknown=0x8, paramA=0x4 + manager subtype=0x1a, pool=0x8, paramA=0x4 object_raw subtype=0x54, x=0xd8, y=0x24, paramB=0x200000, paramC=0x80000000 manager subtype=0x11, paramC=0x80000024 manager subtype=0xf, x=0x98, y=0x68, paramA=0x1, paramC=0x240000 - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x240023 + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x240023 ezlo_hint x=0x18, y=0x6, rx=0x3, ry=0x5, msg=0xb3d, flag=0x46, flag2=0x23 enemy_raw subtype=0x43, x=0x48, y=0x48 enemy_raw subtype=0x43, x=0x38, y=0x88 @@ -8748,8 +8748,8 @@ Room_FortressOfWinds_WestKeyLever:: @ 080E212C Entities_FortressOfWinds_Darknut_0:: @ 080E2158 manager subtype=0x1e, x=0x70, y=0x80, paramB=0x200030, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x278000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x270048 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x278000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x270048 object_raw subtype=0x34, x=0x88, y=0x68, paramB=0x2158, paramC=0x480186 ezlo_hint type=0x3, x=0x0, y=0x0, rx=0x3f, ry=0x3f, msg=0xb04, flag=0x27, flag2=0x8000 enemy_raw subtype=0x43, x=0x48, y=0x28 @@ -8780,7 +8780,7 @@ TileEntities_FortressOfWinds_Darknut:: @ 080E22B8 tile_entity_list_end gUnk_additional_8_FortressOfWinds_Darknut:: @ 080E22D0 - enemy_raw subtype=0x5, x=0x88, y=0x58, unknown=0x2f, paramA=0x1, paramB=0x10160000, paramC=0x200030 + enemy_raw subtype=0x5, x=0x88, y=0x58, pool=0x2f, paramA=0x1, paramB=0x10160000, paramC=0x200030 object_raw subtype=0x8, x=0x88, y=0xa8, paramA=0x2, paramC=0x48ffff object_raw subtype=0x8, x=0xe8, y=0x78, paramA=0x1, paramC=0x48ffff entity_list_end @@ -8868,9 +8868,9 @@ Room_FortressOfWinds_Pit:: @ 080E2564 .4byte gUnk_additional_8_FortressOfWinds_Pit Entities_FortressOfWinds_Wallmaster_0:: @ 080E2588 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x2a0000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x2a0000 object_raw subtype=0x74, x=0x88, y=0x68, collision=2, paramC=0x2a0000 - manager subtype=0x3, x=0x88, y=0x68, unknown=0x0, paramA=0x3, paramB=0x201 + manager subtype=0x3, x=0x88, y=0x68, pool=0x0, paramA=0x3, paramB=0x201 enemy_raw subtype=0x43, x=0x38, y=0x28 enemy_raw subtype=0x43, x=0xc8, y=0x28 enemy_raw subtype=0x43, x=0xd8, y=0x28 @@ -8919,7 +8919,7 @@ Entities_FortressOfWinds_Clone_0:: @ 080E271C object_raw subtype=0x3, x=0xc8, y=0x108, paramA=0x1, paramC=0x80030002 manager subtype=0x11, paramC=0x8c00002b manager subtype=0x17, x=0xb8, y=0xe8, paramA=0x53, paramB=0x20200, paramC=0x2d002e - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x2b002d + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x2b002d object_raw subtype=0x27, x=0x98, y=0xe8 object_raw subtype=0x27, x=0xd8, y=0xe8 object_raw subtype=0x8, x=0x38, y=0x178, paramA=0xa, paramC=0x2cffff @@ -8940,8 +8940,8 @@ Entities_FortressOfWinds_Clone_1:: @ 080E282C Enemies_FortressOfWinds_Clone:: @ 080E286C enemy_raw subtype=0x2c, x=0xa8, y=0x48, paramB=0xc0a0000, paramC=0x2000a0 enemy_raw subtype=0x2c, x=0xc8, y=0x68, paramB=0xc0a0000, paramC=0x2000a0 - projectile_raw subtype=0x1e, x=0xa8, y=0x130, unknown=0x3, paramA=0x3, paramC=0x80ff7f - projectile_raw subtype=0x1e, x=0xd0, y=0x130, unknown=0x3, paramA=0x3, paramC=0x80ff7f + projectile_raw subtype=0x1e, x=0xa8, y=0x130, pool=0x3, paramA=0x3, paramC=0x80ff7f + projectile_raw subtype=0x1e, x=0xd0, y=0x130, pool=0x3, paramA=0x3, paramC=0x80ff7f entity_list_end TileEntities_FortressOfWinds_Clone:: @ 080E28BC @@ -9016,9 +9016,9 @@ Entities_FortressOfWinds_Mazaal_0:: @ 080E2AD8 object_raw subtype=0x5, x=0x138, y=0xa8, paramA=0x5e object_raw subtype=0x5, x=0x148, y=0xa8, paramA=0x5e object_raw subtype=0x74, x=0x38, y=0x38, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0x38, y=0x38, unknown=0x0, paramA=0x3, paramB=0x102 + manager subtype=0x3, x=0x38, y=0x38, pool=0x0, paramA=0x3, paramB=0x102 object_raw subtype=0x74, x=0x138, y=0x38, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0x138, y=0x38, unknown=0x0, paramA=0x3, paramB=0x102 + manager subtype=0x3, x=0x138, y=0x38, pool=0x0, paramA=0x3, paramB=0x102 object_raw subtype=0x8, x=0xb8, y=0xb8, paramA=0x12, paramC=0x8000ffff object_raw subtype=0x8, x=0xb8, y=0x18, paramC=0x31ffff ezlo_hint type=0x3, x=0x0, y=0x0, rx=0x3f, ry=0x3f, msg=0xb05, flag=0x31 @@ -9054,8 +9054,8 @@ Entities_FortressOfWinds_Stalfos_0:: @ 080E2C30 object_raw subtype=0x8, x=0x88, y=0xb8, paramA=0x2, paramC=0x490000 object_raw subtype=0x8, x=0x98, y=0x18, paramC=0x2f manager subtype=0x1e, x=0x70, y=0x60, paramB=0x500030, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x308000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x300049 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x308000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x300049 enemy_raw subtype=0x43, x=0x68, y=0x28, paramB=0x5f enemy_raw subtype=0x43, x=0x78, y=0x28, paramB=0x5d entity_list_end @@ -9072,11 +9072,11 @@ TileEntities_FortressOfWinds_Stalfos:: @ 080E2CF0 tile_entity_list_end gUnk_additional_8_FortressOfWinds_Stalfos:: @ 080E2D00 - enemy_raw subtype=0x42, x=0x68, y=0x68, unknown=0x2f, paramB=0xa120000, paramC=0x600040 - enemy_raw subtype=0x42, x=0xa8, y=0x68, unknown=0x2f, paramB=0xa120000, paramC=0x600040 - enemy_raw subtype=0x42, x=0x68, y=0xa8, unknown=0x2f, paramB=0xa120000, paramC=0x600040 - enemy_raw subtype=0x42, x=0xa8, y=0xa8, unknown=0x2f, paramB=0xa120000, paramC=0x600040 - manager subtype=0x28, unknown=0x3, paramB=0x8 + enemy_raw subtype=0x42, x=0x68, y=0x68, pool=0x2f, paramB=0xa120000, paramC=0x600040 + enemy_raw subtype=0x42, x=0xa8, y=0x68, pool=0x2f, paramB=0xa120000, paramC=0x600040 + enemy_raw subtype=0x42, x=0x68, y=0xa8, pool=0x2f, paramB=0xa120000, paramC=0x600040 + enemy_raw subtype=0x42, x=0xa8, y=0xa8, pool=0x2f, paramB=0xa120000, paramC=0x600040 + manager subtype=0x28, pool=0x3, paramB=0x8 entity_list_end Room_FortressOfWinds_Stalfos:: @ 080E2D60 @@ -9137,8 +9137,8 @@ Entities_FortressOfWinds_Main2F_0:: @ 080E2E7C enemy_raw subtype=0x43, x=0x28, y=0x38 enemy_raw subtype=0x43, x=0xe8, y=0x28 enemy_raw subtype=0x43, x=0xe8, y=0x38 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x350000 - manager subtype=0xb, unknown=0x0, paramB=0x9, paramC=0x380000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x350000 + manager subtype=0xb, pool=0x0, paramB=0x9, paramC=0x380000 entity_list_end Enemies_FortressOfWinds_Main2F:: @ 080E2F7C @@ -9146,7 +9146,7 @@ Enemies_FortressOfWinds_Main2F:: @ 080E2F7C enemy_raw subtype=0x42, x=0x38, y=0x148, paramB=0xe1a0000, paramC=0x1000020 enemy_raw subtype=0x42, x=0xd8, y=0x118, paramB=0xe1a0000, paramC=0x1000020 enemy_raw subtype=0x42, x=0xd8, y=0x148, paramB=0xe1a0000, paramC=0x1000020 - manager subtype=0x28, unknown=0x3, paramB=0x2 + manager subtype=0x28, pool=0x3, paramB=0x2 enemy_raw subtype=0x1f, x=0x28, y=0x68, paramA=0x2, paramC=0x100058 enemy_raw subtype=0x1f, x=0xe8, y=0x68, paramA=0x2, paramC=0x100058 entity_list_end @@ -9179,7 +9179,7 @@ Room_FortressOfWinds_Main2F:: @ 080E3054 Entities_FortressOfWinds_MinishHole_0:: @ 080E307C object_raw subtype=0x4e, x=0x78, y=0x20, collision=2, paramB=0x800 object_raw subtype=0x74, x=0x48, y=0x78, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0x48, y=0x78, unknown=0x0, paramA=0x3, paramB=0x101 + manager subtype=0x3, x=0x48, y=0x78, pool=0x0, paramA=0x3, paramB=0x101 enemy_raw subtype=0x43, x=0xc8, y=0x98 enemy_raw subtype=0x43, x=0xc8, y=0xa8 entity_list_end @@ -9237,7 +9237,7 @@ Entities_FortressOfWinds_WestStairs2F_0:: @ 080E31DC entity_list_end Entities_FortressOfWinds_WestStairs2F_1:: @ 080E31EC - manager subtype=0x1a, unknown=0x8, paramA=0x5 + manager subtype=0x1a, pool=0x8, paramA=0x5 entity_list_end Enemies_FortressOfWinds_WestStairs2F:: @ 080E320C @@ -9271,7 +9271,7 @@ Entities_FortressOfWinds_EastStairs2F_1:: @ 080E32BC object_raw subtype=0x8, x=0x88, y=0xa8, paramA=0x2, paramC=0x3b0000 object_raw subtype=0x54, x=0xd0, y=0xac, paramB=0x200002, paramC=0x80010000 object_raw subtype=0xc, x=0xc8, y=0x38, paramA=0x1, paramC=0x3c0000 - manager subtype=0x1a, unknown=0x8, paramA=0x6 + manager subtype=0x1a, pool=0x8, paramA=0x6 enemy_raw subtype=0x43, x=0x58, y=0x58 enemy_raw subtype=0x43, x=0x58, y=0x68 enemy_raw subtype=0x43, x=0x58, y=0x78 @@ -9379,7 +9379,7 @@ Room_FortressOfWinds_EastStairs1F:: @ 080E358C Entities_FortressOfWinds_Wizzrobe_0:: @ 080E35AC object_raw subtype=0x8, x=0x78, y=0xb8, paramA=0x12, paramC=0x42ffff manager subtype=0x1e, x=0x30, y=0x70, paramB=0x200090, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x428000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x428000 object_raw subtype=0xc, x=0x78, y=0x68, paramA=0x1, paramC=0x420000 entity_list_end @@ -9413,7 +9413,7 @@ Room_FortressOfWinds_Wizzrobe:: @ 080E3694 Entities_FortressOfWinds_HeartPiece_0:: @ 080E36B8 object_raw subtype=0x74, x=0xb8, y=0x48, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0xb8, y=0x48, unknown=0x0, paramA=0x3, paramB=0x103 + manager subtype=0x3, x=0xb8, y=0x48, pool=0x0, paramA=0x3, paramB=0x103 object_raw subtype=0x0, x=0x58, y=0x44, collision=1, paramA=0x63, paramB=0x400, paramC=0x470000 entity_list_end @@ -9475,7 +9475,7 @@ gUnk_080E3850:: @ 080E3850 Entities_FortressOfWindsTop_Main_1:: @ 080E3870 object_raw subtype=0x72, x=0xa0, y=0x58 - manager subtype=0x1b, unknown=0x8, paramA=0x3 + manager subtype=0x1b, pool=0x8, paramA=0x3 entity_list_end Enemies_FortressOfWindsTop_Main:: @ 080E38A0 @@ -9497,8 +9497,8 @@ Room_FortressOfWindsTop_Main:: @ 080E38C0 Entities_TempleOfDroplets_WestHole_0:: @ 080E38E0 object_raw subtype=0x12, x=0x88, y=0x68, paramC=0x4e0000 - manager subtype=0x15, x=0x88, y=0x68, unknown=0x8, paramB=0xfff8, paramC=0x4e0000 - manager subtype=0x1a, unknown=0x8, paramA=0x8 + manager subtype=0x15, x=0x88, y=0x68, pool=0x8, paramB=0xfff8, paramC=0x4e0000 + manager subtype=0x1a, pool=0x8, paramA=0x8 entity_list_end Enemies_TempleOfDroplets_WestHole:: @ 080E3920 @@ -9556,8 +9556,8 @@ Room_TempleOfDroplets_NorthSplit:: @ 080E3A90 Entities_TempleOfDroplets_EastHole_0:: @ 080E3AB0 object_raw subtype=0x12, x=0x88, y=0x68, paramC=0x510000 - manager subtype=0x15, x=0x88, y=0x68, unknown=0x8, paramB=0xfff8, paramC=0x510000 - manager subtype=0x1a, unknown=0x8, paramA=0x9 + manager subtype=0x15, x=0x88, y=0x68, pool=0x8, paramB=0xfff8, paramC=0x510000 + manager subtype=0x1a, pool=0x8, paramA=0x9 entity_list_end Enemies_TempleOfDroplets_EastHole:: @ 080E3AF0 @@ -9596,7 +9596,7 @@ Entities_TempleOfDroplets_Entrance_0:: @ 080E3B60 object_raw subtype=0x39, x=0x108, y=0x178, paramA=0x2, paramC=0x2cffff object_raw subtype=0x34, x=0xd8, y=0xe8, paramB=0x560, paramC=0x9c0148 object_raw subtype=0x34, x=0x138, y=0xe8, paramA=0x1, paramB=0x3060, paramC=0x7001c7 - manager subtype=0x15, x=0x108, y=0xc8, unknown=0x8, paramA=0x6, paramB=0x10ff78 + manager subtype=0x15, x=0x108, y=0xc8, pool=0x8, paramA=0x6, paramB=0x10ff78 entity_list_end Enemies_TempleOfDroplets_Entrance:: @ 080E3C70 @@ -9644,8 +9644,8 @@ Room_TempleOfDroplets_NorthwestStairs:: @ 080E3D20 Entities_TempleOfDroplets_ScissorsMiniboss_0:: @ 080E3D40 manager subtype=0x1e, x=0xb0, y=0x20, paramB=0x200030, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x2e8000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x2e009c + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x2e8000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x2e009c object_raw subtype=0x8, x=0xc8, y=0x18, paramA=0x10, paramC=0x9cffff object_raw subtype=0x8, x=0x58, y=0x98, paramA=0x2, paramC=0x9cffff object_raw subtype=0x34, x=0x88, y=0x58, paramB=0x360, paramC=0x9c038d @@ -9665,10 +9665,10 @@ TileEntities_TempleOfDroplets_ScissorsMiniboss:: @ 080E3E00 tile_entity_list_end gUnk_additional_8_TempleOfDroplets_ScissorsMiniboss:: @ 080E3E10 - enemy_raw subtype=0x40, x=0x58, y=0x58, unknown=0x2f - enemy_raw subtype=0x40, x=0xb8, y=0x58, unknown=0x2f - enemy_raw subtype=0x40, x=0x88, y=0x88, unknown=0x2f - manager subtype=0x28, unknown=0x3, paramB=0x8 + enemy_raw subtype=0x40, x=0x58, y=0x58, pool=0x2f + enemy_raw subtype=0x40, x=0xb8, y=0x58, pool=0x2f + enemy_raw subtype=0x40, x=0x88, y=0x88, pool=0x2f + manager subtype=0x28, pool=0x3, paramB=0x8 entity_list_end Room_TempleOfDroplets_ScissorsMiniboss:: @ 080E3E60 @@ -9730,7 +9730,7 @@ Entities_TempleOfDroplets_WaterfallNortheast_1:: @ 080E3FC4 Enemies_TempleOfDroplets_WaterfallNortheast:: @ 080E4004 enemy_raw subtype=0x11, x=0x58, y=0x128, paramB=0x12080000, paramC=0x1000020 enemy_raw subtype=0x11, x=0x38, y=0x138, paramB=0x12080000, paramC=0x1000020 - projectile_raw subtype=0x1e, x=0xa0, y=0x108, unknown=0x3, paramA=0x8, paramC=0x64ff90 + projectile_raw subtype=0x1e, x=0xa0, y=0x108, pool=0x3, paramA=0x8, paramC=0x64ff90 entity_list_end TileEntities_TempleOfDroplets_WaterfallNortheast:: @ 080E4044 @@ -9749,7 +9749,7 @@ Room_TempleOfDroplets_WaterfallNortheast:: @ 080E4054 Entities_TempleOfDroplets_Element_0:: @ 080E4074 ezlo_hint x=0x14, y=0x14, rx=0xd, ry=0x2, msg=0xb41, flag=0x80 - manager subtype=0x15, x=0x108, y=0x118, unknown=0x8, paramA=0x4, paramB=0xff78, paramC=0x340000 + manager subtype=0x15, x=0x108, y=0x118, pool=0x8, paramA=0x4, paramB=0xff78, paramC=0x340000 object_raw subtype=0x8f, x=0x108, y=0xd8 object_raw subtype=0x83, x=0x58, y=0x58, paramC=0x360000 object_raw subtype=0x83, x=0x1b8, y=0x58, paramC=0x340000 @@ -9933,8 +9933,8 @@ Room_TempleOfDroplets_IcePitMaze:: @ 080E4668 Entities_TempleOfDroplets_HoleToBlueChuchu_0:: @ 080E46BC object_raw subtype=0x12, x=0xb8, y=0x68, paramC=0x6c0000 - manager subtype=0x15, x=0xb8, y=0x68, unknown=0x8, paramB=0xffc8, paramC=0x6c0000 - manager subtype=0x1a, unknown=0x8, paramA=0xa + manager subtype=0x15, x=0xb8, y=0x68, pool=0x8, paramB=0xffc8, paramC=0x6c0000 + manager subtype=0x1a, pool=0x8, paramA=0xa entity_list_end Enemies_TempleOfDroplets_HoleToBlueChuchu:: @ 080E46FC @@ -9984,12 +9984,12 @@ Room_TempleOfDroplets_WaterfallSoutheast:: @ 080E47EC Entities_TempleOfDroplets_WaterfallSouthwest_0:: @ 080E480C object_raw subtype=0x3, x=0xc8, y=0x78, paramC=0x3c0002 - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x3c003d + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x3c003d object_raw subtype=0x33, x=0x68, y=0xb8, paramA=0x3, paramC=0x3d0000 object_raw subtype=0x33, x=0x78, y=0xb8, paramA=0x3, paramC=0x3d0000 object_raw subtype=0x33, x=0x88, y=0xb8, paramA=0x3, paramC=0x3d0000 object_raw subtype=0x32, x=0xa8, y=0x98 - manager subtype=0x1a, unknown=0x8, paramA=0xc + manager subtype=0x1a, pool=0x8, paramA=0xc object_raw subtype=0xc, x=0xe8, y=0xe8, paramA=0x4, paramB=0x3f object_raw subtype=0x0, x=0xb8, y=0x38, collision=1, paramA=0x54, paramB=0x400, paramC=0x850000 object_raw subtype=0x0, x=0xb8, y=0x58, collision=1, paramA=0x54, paramB=0x400, paramC=0x860000 @@ -10018,7 +10018,7 @@ Room_TempleOfDroplets_WaterfallSouthwest:: @ 080E4924 .4byte sub_StateChange_TempleOfDroplets_WaterfallSouthwest Entities_TempleOfDroplets_BigOcto_0:: @ 080E4944 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x40050000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x40050000 manager subtype=0x1e, x=0xd0, y=0x20, paramB=0x200070, paramC=0x80010000 object_raw subtype=0x33, x=0xf8, y=0x18, paramA=0x4, paramB=0x1, paramC=0x80010000 object_raw subtype=0x33, x=0x108, y=0x18, paramA=0x4, paramB=0x1, paramC=0x80010000 @@ -10029,7 +10029,7 @@ Entities_TempleOfDroplets_BigOcto_0:: @ 080E4944 gUnk_additional_9_TempleOfDroplets_BigOcto:: @ 080E49C4 object_raw subtype=0xac, x=0x108, y=0x78, collision=1, paramA=0x42 - manager subtype=0xe, y=0x3c, unknown=0x1f, paramA=0xa, paramC=0x80000000 + manager subtype=0xe, y=0x3c, pool=0x1f, paramA=0xa, paramC=0x80000000 entity_list_end gUnk_additional_a_TempleOfDroplets_BigOcto:: @ 080E49F4 @@ -10090,7 +10090,7 @@ Room_TempleOfDroplets_ToBigBlueChuchu:: @ 080E4B48 Entities_TempleOfDroplets_BigBlueChuchu_0:: @ 080E4B68 object_raw subtype=0xc, x=0x88, y=0x70, paramA=0x2, paramB=0x47, paramC=0x480000 - manager subtype=0x15, x=0x88, y=0x68, unknown=0x8, paramA=0x1, paramB=0xfff8, paramC=0x460000 + manager subtype=0x15, x=0x88, y=0x68, pool=0x8, paramA=0x1, paramB=0xfff8, paramC=0x460000 object_raw subtype=0x7b, x=0x98, y=0xb8, paramC=0x460000 object_raw subtype=0x33, x=0xb8, y=0x18, paramA=0x4, paramB=0x1, paramC=0x80000000 object_raw subtype=0x33, x=0xc8, y=0x18, paramA=0x4, paramB=0x1, paramC=0x80000000 @@ -10128,17 +10128,17 @@ Room_TempleOfDroplets_BigBlueChuchu:: @ 080E4C68 Entities_TempleOfDroplets_BigBlueChuchuKey_0:: @ 080E4C88 object_raw subtype=0x7b, x=0x78, y=0x98, paramC=0x4b0000 - manager subtype=0x2e, unknown=0x0, paramB=0x1400, paramC=0x4a0049 - manager subtype=0xf, unknown=0x8, paramA=0x4 + manager subtype=0x2e, pool=0x0, paramB=0x1400, paramC=0x4a0049 + manager subtype=0xf, pool=0x8, paramA=0x4 object_raw subtype=0x85, x=0x78, y=0x68, paramA=0x1, paramB=0x8, paramC=0x4c0000 entity_list_end gUnk_080E4CD8:: @ 080E4CD8 - manager subtype=0x15, x=0x78, y=0x68, unknown=0x8, paramA=0x2, paramB=0x80008, paramC=0x4b0000 + manager subtype=0x15, x=0x78, y=0x68, pool=0x8, paramA=0x2, paramB=0x80008, paramC=0x4b0000 entity_list_end gUnk_080E4CF8:: @ 080E4CF8 - manager subtype=0x15, x=0x78, y=0x68, unknown=0x8, paramA=0x7, paramB=0x80008, paramC=0x4b0000 + manager subtype=0x15, x=0x78, y=0x68, pool=0x8, paramA=0x7, paramB=0x80008, paramC=0x4b0000 entity_list_end Enemies_TempleOfDroplets_BigBlueChuchuKey:: @ 080E4D18 @@ -10164,7 +10164,7 @@ Room_TempleOfDroplets_BigBlueChuchuKey:: @ 080E4D4C .4byte gUnk_additional_8_TempleOfDroplets_BigBlueChuchuKey Entities_TempleOfDroplets_BossKey_0:: @ 080E4D70 - manager subtype=0x15, x=0x88, y=0x68, unknown=0x8, paramA=0x2, paramB=0xfff8, paramC=0x4e00a2 + manager subtype=0x15, x=0x88, y=0x68, pool=0x8, paramA=0x2, paramB=0xfff8, paramC=0x4e00a2 object_raw subtype=0x7b, x=0x58, y=0x58, paramC=0x4e0000 object_raw subtype=0x84, x=0x118, y=0x48, paramB=0x8 object_raw subtype=0x84, x=0x128, y=0x68, paramA=0x2, paramB=0x8, paramC=0x4f0000 @@ -10195,8 +10195,8 @@ Room_TempleOfDroplets_BossKey:: @ 080E4E0C Entities_TempleOfDroplets_NorthSmallKey_0:: @ 080E4E30 object_raw subtype=0x7b, x=0xd8, y=0x68, paramC=0x510000 - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x510050 - manager subtype=0x15, x=0x88, y=0x68, unknown=0x8, paramA=0x2, paramB=0xfff8, paramC=0x5100a3 + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x510050 + manager subtype=0x15, x=0x88, y=0x68, pool=0x8, paramA=0x2, paramB=0xfff8, paramC=0x5100a3 object_raw subtype=0x84, x=0x48, y=0x48, paramA=0x1, paramB=0x8, paramC=0x520000 ezlo_hint x=0x16, y=0x6, rx=0x3, ry=0x5, msg=0xb40, flag=0x53, flag2=0x50 ezlo_hint x=0x6, y=0x6, rx=0x4, ry=0x5, msg=0xb3f, flag=0x84 @@ -10369,11 +10369,11 @@ Enemies_TempleOfDroplets_SpikeBar:: @ 080E5280 enemy_raw subtype=0x40, x=0x28, y=0x1a8, paramB=0x10100000, paramC=0x1700020 enemy_raw subtype=0x40, x=0x88, y=0x1b8, paramB=0x10100000, paramC=0x1700020 enemy_raw subtype=0x40, x=0x78, y=0x1e8, paramB=0x10100000, paramC=0x1700020 - manager subtype=0x28, unknown=0x3, paramB=0x2 - projectile_raw subtype=0x1e, x=0x98, y=0x48, unknown=0x3, paramA=0x2, paramC=0x100ffa0 - projectile_raw subtype=0x1e, x=0x28, y=0x88, unknown=0x3, paramA=0x2, paramC=0x1000060 - projectile_raw subtype=0x1e, x=0x98, y=0xc8, unknown=0x3, paramA=0x2, paramC=0x100ffa0 - projectile_raw subtype=0x1e, x=0x28, y=0x108, unknown=0x3, paramA=0x2, paramC=0x1000060 + manager subtype=0x28, pool=0x3, paramB=0x2 + projectile_raw subtype=0x1e, x=0x98, y=0x48, pool=0x3, paramA=0x2, paramC=0x100ffa0 + projectile_raw subtype=0x1e, x=0x28, y=0x88, pool=0x3, paramA=0x2, paramC=0x1000060 + projectile_raw subtype=0x1e, x=0x98, y=0xc8, pool=0x3, paramA=0x2, paramC=0x100ffa0 + projectile_raw subtype=0x1e, x=0x28, y=0x108, pool=0x3, paramA=0x2, paramC=0x1000060 entity_list_end TileEntities_TempleOfDroplets_SpikeBar:: @ 080E5320 @@ -10401,7 +10401,7 @@ Entities_TempleOfDroplets_Lanterns_0:: @ 080E5350 manager subtype=0x23, x=0xa8, y=0x68, paramA=0x3, paramB=0xc0002, paramC=0x80070057 manager subtype=0x23, x=0xa8, y=0x98, paramA=0x3, paramB=0xc0002, paramC=0x80080057 manager subtype=0x11, paramC=0xa0000057 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0xa0000057 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0xa0000057 object_raw subtype=0x8, x=0x28, y=0x78, paramA=0x3, paramC=0x57ffff entity_list_end @@ -10429,9 +10429,9 @@ Room_TempleOfDroplets_Lanterns:: @ 080E5460 Entities_TempleOfDroplets_LilypadIceBlocks_0:: @ 080E5480 object_raw subtype=0x14, x=0x1a8, y=0x68 object_raw subtype=0x3, x=0x1c8, y=0x1b8, paramC=0x580001 - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x58009d + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x58009d object_raw subtype=0x3, x=0x98, y=0x188, paramA=0x1, paramC=0x80000001 - manager subtype=0x2e, unknown=0x0, paramA=0x1, paramB=0xa00, paramC=0x80000000 + manager subtype=0x2e, pool=0x0, paramA=0x1, paramB=0xa00, paramC=0x80000000 object_raw subtype=0x33, x=0x178, y=0x1c8, paramA=0x3, paramC=0x9d0000 object_raw subtype=0x33, x=0x188, y=0x1c8, paramA=0x3, paramC=0x9d0000 object_raw subtype=0x33, x=0x198, y=0x1c8, paramA=0x3, paramC=0x9d0000 @@ -10526,8 +10526,8 @@ Entities_TempleOfDroplets_FireBars_0:: @ 080E5848 entity_list_end Enemies_TempleOfDroplets_FireBars:: @ 080E5858 - projectile_raw subtype=0x1d, x=0x38, y=0x38, unknown=0x3 - projectile_raw subtype=0x1d, x=0x88, y=0x98, unknown=0x3 + projectile_raw subtype=0x1d, x=0x38, y=0x38, pool=0x3 + projectile_raw subtype=0x1d, x=0x88, y=0x98, pool=0x3 enemy_raw subtype=0x32, x=0x68, y=0x58 enemy_raw subtype=0x32, x=0x98, y=0x78 entity_list_end @@ -10605,20 +10605,20 @@ Room_TempleOfDroplets_LanternMaze:: @ 080E5B38 .4byte sub_StateChange_Dojos_83 Entities_TempleOfDroplets_Madderpillars_0:: @ 080E5B58 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x660000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x66009e + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x660000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x66009e object_raw subtype=0x8, x=0xd8, y=0x68, paramA=0x1, paramC=0x9effff - projectile_raw subtype=0x15, x=0x78, y=0xa8, unknown=0xf, paramA=0x2, paramC=0x670000 - projectile_raw subtype=0x15, x=0x38, y=0xa8, unknown=0xf, paramA=0x2 - projectile_raw subtype=0x15, x=0xa8, y=0xa8, unknown=0xf, paramA=0x2 - projectile_raw subtype=0x15, x=0x38, y=0x28, unknown=0xf - projectile_raw subtype=0x15, x=0x58, y=0x28, unknown=0xf - projectile_raw subtype=0x15, x=0x78, y=0x28, unknown=0xf - projectile_raw subtype=0x15, x=0xa8, y=0x28, unknown=0xf - projectile_raw subtype=0x15, x=0x28, y=0x58, unknown=0xf, paramA=0x3 - projectile_raw subtype=0x15, x=0x28, y=0x88, unknown=0xf, paramA=0x3 - projectile_raw subtype=0x15, x=0xd8, y=0x48, unknown=0xf, paramA=0x1 - projectile_raw subtype=0x15, x=0xd8, y=0x88, unknown=0xf, paramA=0x1 + projectile_raw subtype=0x15, x=0x78, y=0xa8, pool=0xf, paramA=0x2, paramC=0x670000 + projectile_raw subtype=0x15, x=0x38, y=0xa8, pool=0xf, paramA=0x2 + projectile_raw subtype=0x15, x=0xa8, y=0xa8, pool=0xf, paramA=0x2 + projectile_raw subtype=0x15, x=0x38, y=0x28, pool=0xf + projectile_raw subtype=0x15, x=0x58, y=0x28, pool=0xf + projectile_raw subtype=0x15, x=0x78, y=0x28, pool=0xf + projectile_raw subtype=0x15, x=0xa8, y=0x28, pool=0xf + projectile_raw subtype=0x15, x=0x28, y=0x58, pool=0xf, paramA=0x3 + projectile_raw subtype=0x15, x=0x28, y=0x88, pool=0xf, paramA=0x3 + projectile_raw subtype=0x15, x=0xd8, y=0x48, pool=0xf, paramA=0x1 + projectile_raw subtype=0x15, x=0xd8, y=0x88, pool=0xf, paramA=0x1 object_raw subtype=0xbc, x=0xbc, y=0x58 object_raw subtype=0xbc, x=0xbc, y=0x78 entity_list_end @@ -10684,18 +10684,18 @@ Room_TempleOfDroplets_AfterMadderpillars:: @ 080E5DAC Entities_TempleOfDroplets_BlueChuchuKeyLever_0:: @ 080E5DCC object_raw subtype=0x12, x=0xb8, y=0x68, paramC=0x4b0000 object_raw subtype=0x7b, x=0xb8, y=0x98, paramC=0x6c0000 - manager subtype=0x1a, unknown=0x8, paramA=0xb + manager subtype=0x1a, pool=0x8, paramA=0xb object_raw subtype=0x5, x=0x58, y=0x28 object_raw subtype=0x5, x=0x58, y=0x38 object_raw subtype=0x5, x=0x58, y=0x48 entity_list_end gUnk_080E5E3C:: @ 080E5E3C - manager subtype=0x15, x=0xb8, y=0x68, unknown=0x8, paramA=0x2, paramB=0xffc8, paramC=0x6c0000 + manager subtype=0x15, x=0xb8, y=0x68, pool=0x8, paramA=0x2, paramB=0xffc8, paramC=0x6c0000 entity_list_end gUnk_080E5E5C:: @ 080E5E5C - manager subtype=0x15, x=0xb8, y=0x68, unknown=0x8, paramA=0x3, paramB=0xffc8, paramC=0x6c0000 + manager subtype=0x15, x=0xb8, y=0x68, pool=0x8, paramA=0x3, paramB=0xffc8, paramC=0x6c0000 entity_list_end Enemies_TempleOfDroplets_BlueChuchuKeyLever:: @ 080E5E7C @@ -10716,9 +10716,9 @@ Room_TempleOfDroplets_BlueChuchuKeyLever:: @ 080E5E9C .4byte sub_StateChange_TempleOfDroplets_BlueChuchuKeyLever Entities_TempleOfDroplets_MulldozerKey_0:: @ 080E5EBC - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x6d0000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x6d0000 manager subtype=0x17, x=0x78, y=0x68, paramA=0x53, paramB=0x10200, paramC=0x6e006f - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x6d006e + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x6d006e object_raw subtype=0xbc, x=0x68, y=0x68 object_raw subtype=0xbc, x=0x88, y=0x68 entity_list_end @@ -10793,9 +10793,9 @@ Room_TempleOfDroplets_BombWall:: @ 080E6130 .4byte sub_StateChange_Dojos_87 Entities_TempleOfDroplets_LilypadWestB2_0:: @ 080E6150 - entity_raw type=0x5, subtype=0x0, x=0x600, unknown=0x0, paramB=0x543 + entity_raw type=0x5, subtype=0x0, x=0x600, pool=0x0, paramB=0x543 object_raw subtype=0x3, x=0x38, y=0x188, paramC=0x720001 - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x7200a0 + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x7200a0 object_raw subtype=0x33, x=0xb8, y=0x148, paramA=0x3, paramC=0xa00000 object_raw subtype=0x33, x=0xb8, y=0x158, paramA=0x3, paramC=0xa00000 object_raw subtype=0x33, x=0xb8, y=0x168, paramA=0x3, paramC=0xa00000 @@ -10811,7 +10811,7 @@ Entities_TempleOfDroplets_LilypadWestB2_0:: @ 080E6150 entity_list_end Enemies_TempleOfDroplets_LilypadWestB2:: @ 080E6250 - projectile_raw subtype=0x1e, x=0x78, y=0xe0, unknown=0x3, paramA=0x8, paramC=0xc000a8 + projectile_raw subtype=0x1e, x=0x78, y=0xe0, pool=0x3, paramA=0x8, paramC=0xc000a8 entity_list_end TileEntities_TempleOfDroplets_LilypadWestB2:: @ 080E6270 @@ -10868,8 +10868,8 @@ Entities_TempleOfDroplets_LanternScissors_0:: @ 080E639C manager subtype=0x23, x=0xa8, y=0x68, paramA=0x3, paramB=0x54001, paramC=0x80020000 manager subtype=0x23, x=0x78, y=0x98, paramA=0x3, paramB=0x54001, paramC=0x80030000 manager subtype=0x1e, x=0x36, y=0x20, paramB=0x900020, paramC=0x80050000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x788005 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x78009f + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x788005 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x78009f object_raw subtype=0x8, x=0x28, y=0x38, paramA=0x13, paramC=0x9fffff object_raw subtype=0x8, x=0xc8, y=0x78, paramA=0x1, paramC=0x9fffff @@ -10883,10 +10883,10 @@ TileEntities_TempleOfDroplets_LanternScissors:: @ 080E643C tile_entity_list_end gUnk_additional_8_TempleOfDroplets_LanternScissors:: @ 080E6454 - enemy_raw subtype=0x40, x=0x68, y=0x58, unknown=0x2f - enemy_raw subtype=0x40, x=0x78, y=0x88, unknown=0x2f - enemy_raw subtype=0x40, x=0x88, y=0x68, unknown=0x2f - manager subtype=0x28, unknown=0x3, paramB=0x8 + enemy_raw subtype=0x40, x=0x68, y=0x58, pool=0x2f + enemy_raw subtype=0x40, x=0x78, y=0x88, pool=0x2f + enemy_raw subtype=0x40, x=0x88, y=0x68, pool=0x2f + manager subtype=0x28, pool=0x3, paramB=0x8 entity_list_end Room_TempleOfDroplets_LanternScissors:: @ 080E64A4 @@ -10903,7 +10903,7 @@ Room_TempleOfDroplets_LanternScissors:: @ 080E64A4 Entities_TempleOfDroplets_LilypadMiddleB2_0:: @ 080E64C8 object_raw subtype=0x0, x=0x98, y=0x98, collision=1, paramA=0x53, paramB=0x800, paramC=0x7a0000 object_raw subtype=0x3, x=0x128, y=0x68, paramC=0x790001 - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x7900a1 + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x7900a1 object_raw subtype=0x33, x=0x138, y=0x28, paramA=0x3, paramC=0xa10000 object_raw subtype=0x33, x=0x138, y=0x38, paramA=0x3, paramC=0xa10000 object_raw subtype=0x33, x=0x138, y=0x48, paramA=0x3, paramC=0xa10000 @@ -10933,17 +10933,17 @@ Room_TempleOfDroplets_LilypadMiddleB2:: @ 080E65B8 .4byte sub_StateChange_Dojos_91 Entities_TempleOfDroplets_LilypadEastB2_0:: @ 080E65D8 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x7b0000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x7b007c + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x7b0000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x7b007c object_raw subtype=0x8, x=0xa8, y=0x28, paramC=0x7cffff - projectile_raw subtype=0x15, x=0x80, y=0x28, unknown=0xf - projectile_raw subtype=0x15, x=0xd0, y=0x28, unknown=0xf - projectile_raw subtype=0x15, x=0xf8, y=0x58, unknown=0xf, paramA=0x1 - projectile_raw subtype=0x15, x=0xf8, y=0x78, unknown=0xf, paramA=0x1 - projectile_raw subtype=0x15, x=0xf8, y=0x98, unknown=0xf, paramA=0x1 - projectile_raw subtype=0x15, x=0x78, y=0xc8, unknown=0xf, paramA=0x2 - projectile_raw subtype=0x15, x=0x98, y=0xc8, unknown=0xf, paramA=0x2 - projectile_raw subtype=0x15, x=0xc8, y=0xc8, unknown=0xf, paramA=0x2 + projectile_raw subtype=0x15, x=0x80, y=0x28, pool=0xf + projectile_raw subtype=0x15, x=0xd0, y=0x28, pool=0xf + projectile_raw subtype=0x15, x=0xf8, y=0x58, pool=0xf, paramA=0x1 + projectile_raw subtype=0x15, x=0xf8, y=0x78, pool=0xf, paramA=0x1 + projectile_raw subtype=0x15, x=0xf8, y=0x98, pool=0xf, paramA=0x1 + projectile_raw subtype=0x15, x=0x78, y=0xc8, pool=0xf, paramA=0x2 + projectile_raw subtype=0x15, x=0x98, y=0xc8, pool=0xf, paramA=0x2 + projectile_raw subtype=0x15, x=0xc8, y=0xc8, pool=0xf, paramA=0x2 entity_list_end Enemies_TempleOfDroplets_LilypadEastB2:: @ 080E6698 @@ -10975,8 +10975,8 @@ Entities_TempleOfDroplets_FlameBarBlockPuzzle_0:: @ 080E66FC entity_list_end Enemies_TempleOfDroplets_FlameBarBlockPuzzle:: @ 080E673C - projectile_raw subtype=0x1d, x=0x58, y=0x38, unknown=0x3 - projectile_raw subtype=0x1d, x=0x98, y=0x88, unknown=0x3 + projectile_raw subtype=0x1d, x=0x58, y=0x38, pool=0x3 + projectile_raw subtype=0x1d, x=0x98, y=0x88, pool=0x3 entity_list_end TileEntities_TempleOfDroplets_FlameBarBlockPuzzle:: @ 080E676C @@ -11024,7 +11024,7 @@ Entities_RoyalCrypt_KingGustaf_0:: @ 080E67AC gUnk_080E693C:: @ 080E693C npc_raw subtype=0x42, x=0x118, y=0x48, script=script_KingGustav - object_raw subtype=0x6a, x=0x118, y=0x28, unknown=0x4f, paramA=0x12, paramB=0x9, paramC=script_CutsceneMiscObjectKingsGravestone + object_raw subtype=0x6a, x=0x118, y=0x28, pool=0x4f, paramA=0x12, paramB=0x9, paramC=script_CutsceneMiscObjectKingsGravestone entity_list_end Enemies_RoyalCrypt_KingGustaf:: @ 080E696C @@ -11053,7 +11053,7 @@ Entities_RoyalCrypt_WaterRope_0:: @ 080E69AC enemy_raw subtype=0x49, x=0x19, y=0xf10e, collision=1, paramA=0x64, paramB=0x101a8c00, paramC=0x403020 enemy_raw subtype=0x49, x=0x19, y=0xf2c2, collision=1, paramA=0x6e, paramB=0x101a8c00, paramC=0x403020 enemy_raw subtype=0x49, x=0x19, y=0xf2ce, collision=1, paramA=0x78, paramB=0x101a8c00, paramC=0x403020 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x198c00 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x198c00 manager subtype=0xf, x=0x58, y=0x78, paramA=0xc, paramC=0x198c00 manager subtype=0xf, x=0xb8, y=0x78, paramA=0xc, paramC=0x198c00 object_raw subtype=0x39, x=0x88, y=0x38, paramA=0x4, paramC=0x19ffff @@ -11067,8 +11067,8 @@ TileEntities_RoyalCrypt_WaterRope:: @ 080E6A8C gUnk_additional_8_RoyalCrypt_WaterRope:: @ 080E6A94 object_raw subtype=0x8, x=0x88, y=0xc8, paramA=0x12, paramC=0x19ffff - enemy_raw subtype=0x3b, x=0x58, y=0x78, unknown=0x2f - enemy_raw subtype=0x3b, x=0xb8, y=0x78, unknown=0x2f + enemy_raw subtype=0x3b, x=0x58, y=0x78, pool=0x2f + enemy_raw subtype=0x3b, x=0xb8, y=0x78, pool=0x2f entity_list_end Room_RoyalCrypt_WaterRope:: @ 080E6AD4 @@ -11289,8 +11289,8 @@ gUnk_080E71AC:: @ 080E71AC entity_list_end Enemies_RoyalCrypt_Entrance:: @ 080E71CC - enemy_raw subtype=0x3b, x=0x58, y=0x48, unknown=0x2f, paramA=0x1 - enemy_raw subtype=0x3b, x=0xb8, y=0x48, unknown=0x2f, paramA=0x1 + enemy_raw subtype=0x3b, x=0x58, y=0x48, pool=0x2f, paramA=0x1 + enemy_raw subtype=0x3b, x=0xb8, y=0x48, pool=0x2f, paramA=0x1 entity_list_end TileEntities_RoyalCrypt_Entrance:: @ 080E71FC @@ -11307,7 +11307,7 @@ Room_RoyalCrypt_Entrance:: @ 080E7204 .4byte sub_StateChange_RoyalCrypt_Entrance Entities_PalaceOfWinds_GyorgTornado_0:: @ 080E7224 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 enemy_raw subtype=0x43, x=0x198, y=0x108 enemy_raw subtype=0x43, x=0x218, y=0x108 enemy_raw subtype=0x43, x=0x1a8, y=0x178 @@ -11324,7 +11324,7 @@ gUnk_080E72C4:: @ 080E72C4 gUnk_additional_8_PalaceOfWinds_GyorgTornado:: @ 080E72E4 object_raw subtype=0xac, x=0x1d8, y=0xc8, paramA=0x43 - manager subtype=0xe, y=0x3c, unknown=0x1f, paramA=0x9, paramC=0x80000000 + manager subtype=0xe, y=0x3c, pool=0x1f, paramA=0x9, paramC=0x80000000 entity_list_end gUnk_additional_9_PalaceOfWinds_GyorgTornado:: @ 080E7314 @@ -11352,7 +11352,7 @@ Room_PalaceOfWinds_GyorgTornado:: @ 080E7364 .4byte gUnk_additional_9_PalaceOfWinds_GyorgTornado Entities_PalaceOfWinds_BossKey_0:: @ 080E738C - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 entity_list_end Enemies_PalaceOfWinds_BossKey:: @ 080E73AC @@ -11375,8 +11375,8 @@ Room_PalaceOfWinds_BossKey:: @ 080E73E4 .4byte sub_StateChange_PalaceOfWinds_BossKey Entities_PalaceOfWinds_BeforeBallAndChainSoldiers_0:: @ 080E7404 - manager subtype=0x19, unknown=0x8 - manager subtype=0x1a, unknown=0x8, paramA=0x20 + manager subtype=0x19, pool=0x8 + manager subtype=0x1a, pool=0x8, paramA=0x20 object_raw subtype=0x29, x=0xa0, y=0x50, paramA=0x80 enemy_raw subtype=0x43, x=0x38, y=0xa8 enemy_raw subtype=0x43, x=0x38, y=0xb8 @@ -11404,9 +11404,9 @@ Room_PalaceOfWinds_BeforeBallAndChainSoldiers:: @ 080E74C4 .4byte sub_StateChange_PalaceOfWinds_BeforeBallAndChainSoldiers Entities_PalaceOfWinds_GyorgBossDoor_0:: @ 080E74E4 - manager subtype=0x19, unknown=0x8 - manager subtype=0x1a, unknown=0x8, paramA=0x21 - manager subtype=0x1a, unknown=0x8, paramA=0x22 + manager subtype=0x19, pool=0x8 + manager subtype=0x1a, pool=0x8, paramA=0x21 + manager subtype=0x1a, pool=0x8, paramA=0x22 object_raw subtype=0x29, x=0x168, y=0x70, paramA=0x80 object_raw subtype=0x29, x=0x230, y=0x70, paramA=0x80 object_raw subtype=0x39, x=0x168, y=0x28, paramC=0x36ffff @@ -11443,7 +11443,7 @@ Room_PalaceOfWinds_GyorgBossDoor:: @ 080E763C .4byte sub_StateChange_PalaceOfWinds_GyorgBossDoor Entities_PalaceOfWinds_EastChestFromGyorgBossDoor_0:: @ 080E765C - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 entity_list_end Enemies_PalaceOfWinds_EastChestFromGyorgBossDoor:: @ 080E767C @@ -11465,14 +11465,14 @@ Room_PalaceOfWinds_EastChestFromGyorgBossDoor:: @ 080E76A4 .4byte sub_StateChange_PalaceOfWinds_EastChestFromGyorgBossDoor Entities_PalaceOfWinds_MoblinAndWizzrobeFight_0:: @ 080E76C4 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x3, x=0x48, y=0x38, paramC=0x380001 object_raw subtype=0x9f, x=0x80, y=0x68, paramB=0xc0000, paramC=0x38 object_raw subtype=0x5, x=0xc8, y=0x38 object_raw subtype=0x5, x=0xb8, y=0x38, paramA=0x5f manager subtype=0x1e, x=0xb0, y=0x150, paramB=0x700020, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x3a8000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x3a0081 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x3a8000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x3a0081 entity_list_end Enemies_PalaceOfWinds_MoblinAndWizzrobeFight:: @ 080E7754 @@ -11485,8 +11485,8 @@ TileEntities_PalaceOfWinds_MoblinAndWizzrobeFight:: @ 080E7764 gUnk_additional_8_PalaceOfWinds_MoblinAndWizzrobeFight:: @ 080E7774 enemy_raw subtype=0x29, x=0x78, y=0x158, paramB=0xe140000, paramC=0x1500030 enemy_raw subtype=0x29, x=0x78, y=0x1b8, paramB=0xe140000, paramC=0x1500030 - enemy_raw subtype=0x15, x=0x48, y=0x188, unknown=0x2f, paramB=0xe140000, paramC=0x1500030 - enemy_raw subtype=0x15, x=0x78, y=0x188, unknown=0x2f, paramB=0xe140000, paramC=0x1500030 + enemy_raw subtype=0x15, x=0x48, y=0x188, pool=0x2f, paramB=0xe140000, paramC=0x1500030 + enemy_raw subtype=0x15, x=0x78, y=0x188, pool=0x2f, paramB=0xe140000, paramC=0x1500030 object_raw subtype=0x8, x=0xd8, y=0x198, paramA=0x11, paramC=0x810000 entity_list_end @@ -11502,7 +11502,7 @@ Room_PalaceOfWinds_MoblinAndWizzrobeFight:: @ 080E77D4 .4byte gUnk_additional_8_PalaceOfWinds_MoblinAndWizzrobeFight Entities_PalaceOfWinds_FourButtonStalfos_0:: @ 080E77F8 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x3, x=0x48, y=0x48, paramA=0x1, paramC=0x80000001 object_raw subtype=0x3, x=0x68, y=0x48, paramA=0x1, paramC=0x80010001 object_raw subtype=0x3, x=0x48, y=0x68, paramA=0x1, paramC=0x80020001 @@ -11540,7 +11540,7 @@ Room_PalaceOfWinds_FourButtonStalfos:: @ 080E7948 .4byte sub_StateChange_PalaceOfWinds_FourButtonStalfos Entities_PalaceOfWinds_FanAndKeyToBossKey_0:: @ 080E7968 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x8, x=0x78, y=0x28, paramA=0x8, paramC=0x3cffff object_raw subtype=0x3, x=0xb8, y=0x1b8, paramC=0x3d0001 object_raw subtype=0x9f, x=0x80, y=0x188, paramA=0x2, paramB=0xc0000, paramC=0x3d @@ -11570,11 +11570,11 @@ Room_PalaceOfWinds_FanAndKeyToBossKey:: @ 080E7A30 .4byte sub_StateChange_PalaceOfWinds_FanAndKeyToBossKey Entities_PalaceOfWinds_BallAndChainSoldiers_0:: @ 080E7A50 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x39, x=0x78, y=0x118, paramA=0x2, paramC=0x42ffff object_raw subtype=0x8, x=0x28, y=0x58, paramA=0xb, paramC=0x3fffff - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x400000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x400082 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x400000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x400082 manager subtype=0x17, x=0x78, y=0xa8, paramA=0x53, paramB=0x10200, paramC=0x820041 entity_list_end @@ -11602,7 +11602,7 @@ Room_PalaceOfWinds_BallAndChainSoldiers:: @ 080E7B10 .4byte gUnk_additional_8_PalaceOfWinds_BallAndChainSoldiers Entities_PalaceOfWinds_BombarossaPath_0:: @ 080E7B34 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x9d, x=0x78, y=0x58, paramA=0x1, paramC=0x80008000 object_raw subtype=0x8, x=0x38, y=0x18, paramA=0x4, paramC=0x8000ffff entity_list_end @@ -11640,8 +11640,8 @@ Room_PalaceOfWinds_BombarossaPath:: @ 080E7C84 .4byte sub_StateChange_PalaceOfWinds_BombarossaPath Entities_PalaceOfWinds_HoleToDarknut_0:: @ 080E7CA4 - manager subtype=0x19, unknown=0x8 - manager subtype=0x1a, unknown=0x8, paramA=0x23 + manager subtype=0x19, pool=0x8 + manager subtype=0x1a, pool=0x8, paramA=0x23 enemy_raw subtype=0x43, x=0x48, y=0x38, paramB=0x5f enemy_raw subtype=0x43, x=0xa8, y=0x38, paramB=0x5f enemy_raw subtype=0x43, x=0x58, y=0x38, paramB=0x5f @@ -11667,8 +11667,8 @@ Room_PalaceOfWinds_HoleToDarknut:: @ 080E7D44 .4byte sub_StateChange_PalaceOfWinds_HoleToDarknut Entities_PalaceOfWinds_ToBombarossaPath_0:: @ 080E7D64 - manager subtype=0x19, unknown=0x8 - manager subtype=0x1a, unknown=0x8, paramA=0x24 + manager subtype=0x19, pool=0x8 + manager subtype=0x1a, pool=0x8, paramA=0x24 enemy_raw subtype=0x43, x=0x98, y=0x78 enemy_raw subtype=0x43, x=0xa8, y=0x78, paramB=0x5d entity_list_end @@ -11695,11 +11695,11 @@ Room_PalaceOfWinds_ToBombarossaPath:: @ 080E7DEC Entities_PalaceOfWinds_DarknutMiniboss_0:: @ 080E7E0C manager subtype=0x1e, x=0x20, y=0x60, paramB=0x2000b0, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x7e8000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x7e8000 manager subtype=0x35, x=0x78, y=0x48, paramB=0x781e00, paramC=0x7e0084 manager subtype=0x5, x=0x7, y=0x4, paramB=0x8c, paramC=0x840001 object_raw subtype=0x34, x=0x78, y=0x88, paramB=0x3170, paramC=0x840160 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 entity_list_end Enemies_PalaceOfWinds_DarknutMiniboss:: @ 080E7E7C @@ -11711,7 +11711,7 @@ TileEntities_PalaceOfWinds_DarknutMiniboss:: @ 080E7E8C tile_entity_list_end gUnk_additional_8_PalaceOfWinds_DarknutMiniboss:: @ 080E7EA4 - enemy_raw subtype=0x5, x=0x78, y=0x58, unknown=0x2f, paramA=0x2 + enemy_raw subtype=0x5, x=0x78, y=0x58, pool=0x2f, paramA=0x2 entity_list_end Room_PalaceOfWinds_DarknutMiniboss:: @ 080E7EC4 @@ -11726,7 +11726,7 @@ Room_PalaceOfWinds_DarknutMiniboss:: @ 080E7EC4 .4byte gUnk_additional_8_PalaceOfWinds_DarknutMiniboss Entities_PalaceOfWinds_BombWallInside_0:: @ 080E7EE8 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 entity_list_end Enemies_PalaceOfWinds_BombWallInside:: @ 080E7F08 @@ -11750,7 +11750,7 @@ Room_PalaceOfWinds_BombWallInside:: @ 080E7F50 .4byte sub_StateChange_PalaceOfWinds_BombWallInside Entities_PalaceOfWinds_BombWallOutside_0:: @ 080E7F70 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 enemy_raw subtype=0x43, x=0x28, y=0x58, paramA=0x2 enemy_raw subtype=0x43, x=0x68, y=0x78, paramA=0x2 enemy_raw subtype=0x43, x=0x88, y=0xa8, paramA=0x2 @@ -11780,7 +11780,7 @@ Room_PalaceOfWinds_BombWallOutside:: @ 080E8038 .4byte sub_StateChange_PalaceOfWinds_BombWallOutside Entities_PalaceOfWinds_CloudJumps_0:: @ 080E8058 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x29, x=0x30, y=0x90, paramA=0x3 object_raw subtype=0x29, x=0x190, y=0xc0, paramA=0x4 object_raw subtype=0x29, x=0x280, y=0xc0, paramA=0x8 @@ -11809,7 +11809,7 @@ Room_PalaceOfWinds_CloudJumps:: @ 080E8110 .4byte sub_StateChange_PalaceOfWinds_CloudJumps Entities_PalaceOfWinds_BlockMazeToBossDoor_0:: @ 080E8130 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x29, x=0x168, y=0x100, paramA=0x8 object_raw subtype=0x29, x=0x228, y=0x100, paramA=0x8 manager subtype=0x2c, x=0x168, paramB=0x4010370, paramC=0x700168 @@ -11860,7 +11860,7 @@ Room_PalaceOfWinds_BlockMazeToBossDoor:: @ 080E8348 .4byte sub_StateChange_PalaceOfWinds_BlockMazeToBossDoor Entities_PalaceOfWinds_CrackedFloorLakitu_0:: @ 080E8368 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 entity_list_end Enemies_PalaceOfWinds_CrackedFloorLakitu:: @ 080E8388 @@ -11884,7 +11884,7 @@ Room_PalaceOfWinds_CrackedFloorLakitu:: @ 080E83D8 .4byte sub_StateChange_PalaceOfWinds_CrackedFloorLakitu Entities_PalaceOfWinds_HeartPieceBridge_0:: @ 080E83F8 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 entity_list_end Enemies_PalaceOfWinds_HeartPieceBridge:: @ 080E8418 @@ -11905,7 +11905,7 @@ Room_PalaceOfWinds_HeartPieceBridge:: @ 080E8438 .4byte sub_StateChange_PalaceOfWinds_HeartPieceBridge Entities_PalaceOfWinds_FanBridge_0:: @ 080E8458 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x9f, x=0x100, y=0x18, paramB=0x1e101e01 object_raw subtype=0x9f, x=0x120, y=0x78, paramA=0x2, paramB=0x1e100f01 object_raw subtype=0x9f, x=0x180, y=0x18, paramB=0x1e101e01 @@ -11933,8 +11933,8 @@ Room_PalaceOfWinds_FanBridge:: @ 080E8508 .4byte sub_StateChange_PalaceOfWinds_FanBridge Entities_PalaceOfWinds_ToFanBridge_0:: @ 080E8528 - manager subtype=0x19, unknown=0x8 - manager subtype=0x1a, unknown=0x8, paramA=0x25 + manager subtype=0x19, pool=0x8 + manager subtype=0x1a, pool=0x8, paramA=0x25 object_raw subtype=0x29, x=0x70, y=0xa0, paramA=0x80 enemy_raw subtype=0x43, x=0x58, y=0x58 enemy_raw subtype=0x43, x=0x68, y=0x68 @@ -11964,9 +11964,9 @@ Room_PalaceOfWinds_ToFanBridge:: @ 080E8608 .4byte sub_StateChange_PalaceOfWinds_ToFanBridge Entities_PalaceOfWinds_RedWarpHall_0:: @ 080E8628 - manager subtype=0x1a, unknown=0x8, paramA=0x26 - manager subtype=0x1a, unknown=0x8, paramA=0x27 - manager subtype=0x1a, unknown=0x8, paramA=0x28 + manager subtype=0x1a, pool=0x8, paramA=0x26 + manager subtype=0x1a, pool=0x8, paramA=0x27 + manager subtype=0x1a, pool=0x8, paramA=0x28 object_raw subtype=0x8, x=0x218, y=0x18, paramA=0x8, paramC=0x4affff object_raw subtype=0x8, x=0x218, y=0xd8, paramA=0x8, paramC=0x4bffff object_raw subtype=0x9d, x=0x1b8, y=0x38, paramA=0x1, paramC=0x8000004c @@ -11975,7 +11975,7 @@ Entities_PalaceOfWinds_RedWarpHall_0:: @ 080E8628 object_raw subtype=0x8, x=0x198, y=0x48, paramA=0x3, paramC=0x4cffff manager subtype=0x23, x=0x268, y=0x48, paramA=0x2, paramB=0x1, paramC=0x4d0000 manager subtype=0x23, x=0x2a8, y=0x48, paramA=0x2, paramB=0x1, paramC=0x4e0000 - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x44d0086 + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x44d0086 object_raw subtype=0x34, x=0x288, y=0x48, paramA=0x1, paramB=0x3170, paramC=0x86015d enemy_raw subtype=0x43, x=0x88, y=0xe8, paramA=0x2 enemy_raw subtype=0x43, x=0xf8, y=0xe8, paramA=0x2 @@ -12016,8 +12016,8 @@ Room_PalaceOfWinds_RedWarpHall:: @ 080E8824 .4byte gUnk_additional_8_PalaceOfWinds_RedWarpHall Entities_PalaceOfWinds_PlatformCloneRide_0:: @ 080E8848 - manager subtype=0x19, unknown=0x8 - manager subtype=0x1a, unknown=0x8, paramA=0x29 + manager subtype=0x19, pool=0x8 + manager subtype=0x1a, pool=0x8, paramA=0x29 object_raw subtype=0x29, x=0x80, y=0x50, paramA=0x80 object_raw subtype=0x16, x=0xf8, y=0x58, paramA=0x3, paramB=0x8 object_raw subtype=0xae, x=0x198, y=0xa8, paramA=0x4 @@ -12052,7 +12052,7 @@ Room_PalaceOfWinds_PlatformCloneRide:: @ 080E8988 .4byte gUnk_additional_8_PalaceOfWinds_PlatformCloneRide Entities_PalaceOfWinds_PitCornerAfterKey_0:: @ 080E89AC - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x8, x=0x18, y=0xd8, paramA=0x3, paramC=0x58ffff entity_list_end @@ -12074,7 +12074,7 @@ Room_PalaceOfWinds_PitCornerAfterKey:: @ 080E89FC .4byte sub_StateChange_PalaceOfWinds_PitCornerAfterKey Entities_PalaceOfWinds_CrowRide_0:: @ 080E8A1C - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0xae, x=0x88, y=0xc8, paramA=0x3 object_raw subtype=0xae, x=0xb8, y=0xc8, paramA=0x3 object_raw subtype=0xae, x=0x58, y=0x128, paramA=0x3 @@ -12125,7 +12125,7 @@ Room_PalaceOfWinds_CrowRide:: @ 080E8BC0 .4byte gUnk_additional_a_PalaceOfWinds_CrowRide Entities_PalaceOfWinds_GratePlatformRide_0:: @ 080E8BEC - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x29, x=0x160, y=0x98, paramA=0x7 manager subtype=0x2c, x=0x160, paramB=0x4011470, paramC=0xa00070 object_raw subtype=0x8, x=0x1b8, y=0x48, paramA=0x9, paramC=0x53ffff @@ -12156,14 +12156,14 @@ Room_PalaceOfWinds_GratePlatformRide:: @ 080E8CB0 .4byte gUnk_additional_8_PalaceOfWinds_GratePlatformRide Entities_PalaceOfWinds_PotPush_0:: @ 080E8CD4 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x8, x=0x18, y=0x48, paramA=0xb, paramC=0x53ffff object_raw subtype=0x9d, x=0x118, y=0x28, paramA=0x1, paramC=0x80000052 object_raw subtype=0x9d, x=0x118, y=0x68, paramA=0x1, paramC=0x80010052 object_raw subtype=0x9d, x=0x158, y=0x68, paramA=0x1, paramC=0x80020052 manager subtype=0x11, paramC=0x88000052 object_raw subtype=0x74, x=0x188, y=0x48, collision=1, paramC=0x520000 - manager subtype=0x3, x=0x188, y=0x48, unknown=0x0, paramA=0x3, paramB=0x102 + manager subtype=0x3, x=0x188, y=0x48, pool=0x0, paramA=0x3, paramB=0x102 object_raw subtype=0x5, x=0x118, y=0xd8 object_raw subtype=0x5, x=0x118, y=0xf8 object_raw subtype=0x5, x=0x128, y=0xc8 @@ -12188,7 +12188,7 @@ Entities_PalaceOfWinds_PotPush_0:: @ 080E8CD4 entity_list_end Enemies_PalaceOfWinds_PotPush:: @ 080E8EB4 - projectile_raw subtype=0x1e, x=0x88, y=0x20, unknown=0x3, paramA=0x4, paramC=0x80ff9f + projectile_raw subtype=0x1e, x=0x88, y=0x20, pool=0x3, paramA=0x4, paramC=0x80ff9f entity_list_end TileEntities_PalaceOfWinds_PotPush:: @ 080E8ED4 @@ -12231,8 +12231,8 @@ Room_PalaceOfWinds_FloormasterLever:: @ 080E8F84 .4byte sub_StateChange_PalaceOfWinds_FloormasterLever Entities_PalaceOfWinds_Map_0:: @ 080E8FA4 - manager subtype=0x1a, unknown=0x8, paramA=0x2a - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x560000 + manager subtype=0x1a, pool=0x8, paramA=0x2a + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x560000 object_raw subtype=0xc, x=0x78, y=0x28, paramA=0x2, paramB=0x57, paramC=0x560000 entity_list_end @@ -12263,7 +12263,7 @@ Room_PalaceOfWinds_Map:: @ 080E904C Entities_PalaceOfWinds_CornerToMap_0:: @ 080E9070 object_raw subtype=0x74, x=0xb8, y=0x78, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0xb8, y=0x78, unknown=0x0, paramA=0x3, paramB=0x103 + manager subtype=0x3, x=0xb8, y=0x78, pool=0x0, paramA=0x3, paramB=0x103 entity_list_end Enemies_PalaceOfWinds_CornerToMap:: @ 080E90A0 @@ -12291,7 +12291,7 @@ Entities_PalaceOfWinds_StairsAfterFloormaster_0:: @ 080E9100 entity_list_end Enemies_PalaceOfWinds_StairsAfterFloormaster:: @ 080E9130 - projectile_raw subtype=0x1d, x=0x28, y=0x58, unknown=0x3 + projectile_raw subtype=0x1d, x=0x28, y=0x58, pool=0x3 enemy_raw subtype=0x42, x=0x58, y=0x48, paramB=0xc160000, paramC=0x200020 enemy_raw subtype=0x42, x=0x78, y=0x68, paramB=0xc160000, paramC=0x200020 entity_list_end @@ -12311,7 +12311,7 @@ Room_PalaceOfWinds_StairsAfterFloormaster:: @ 080E9180 .4byte sub_StateChange_PalaceOfWinds_StairsAfterFloormaster Entities_PalaceOfWinds_HoleToKinstoneWizzrobe_0:: @ 080E91A0 - manager subtype=0x1a, unknown=0x8, paramA=0x2b + manager subtype=0x1a, pool=0x8, paramA=0x2b object_raw subtype=0x5, x=0x48, y=0x48 object_raw subtype=0x5, x=0x58, y=0x48 object_raw subtype=0x5, x=0x98, y=0x48 @@ -12337,7 +12337,7 @@ Room_PalaceOfWinds_HoleToKinstoneWizzrobe:: @ 080E9220 Entities_PalaceOfWinds_KeyArrowButton_0:: @ 080E9240 object_raw subtype=0x9d, x=0x68, y=0x48, paramA=0x1, paramC=0x580058 - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x580087 + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x580087 object_raw subtype=0x8, x=0xd8, y=0x38, paramA=0x1, paramC=0x87ffff manager subtype=0x17, x=0xc8, y=0x38, paramA=0x53, paramB=0x10200, paramC=0x870059 enemy_raw subtype=0x43, x=0xc8, y=0x28 @@ -12366,8 +12366,8 @@ Room_PalaceOfWinds_KeyArrowButton:: @ 080E9310 .4byte sub_StateChange_PalaceOfWinds_KeyArrowButton Entities_PalaceOfWinds_GratesTo3F_0:: @ 080E9330 - manager subtype=0x19, unknown=0x8 - manager subtype=0x1a, unknown=0x8, paramA=0x2c + manager subtype=0x19, pool=0x8 + manager subtype=0x1a, pool=0x8, paramA=0x2c object_raw subtype=0x29, x=0x80, y=0xe0, paramA=0x8 object_raw subtype=0x29, x=0x140, y=0xe0, paramA=0x80 manager subtype=0x2c, x=0x80, paramB=0x4011670, paramC=0x500080 @@ -12421,14 +12421,14 @@ Room_PalaceOfWinds_GratesTo3F:: @ 080E9518 .4byte gUnk_additional_a_PalaceOfWinds_GratesTo3F Entities_PalaceOfWinds_SpinyFight_0:: @ 080E9544 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x9d, x=0x38, y=0x158, paramA=0x1, paramC=0x80008004 object_raw subtype=0x9d, x=0x58, y=0x158, paramA=0x1, paramC=0x80018004 object_raw subtype=0x9d, x=0x78, y=0x158, paramA=0x1, paramC=0x80028004 object_raw subtype=0x9d, x=0x98, y=0x158, paramA=0x1, paramC=0x80038004 manager subtype=0x11, paramC=0x8c008004 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x678004 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x670085 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x678004 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x670085 object_raw subtype=0x33, x=0x58, y=0xf8, paramA=0x5, paramB=0x1, paramC=0x80040000 object_raw subtype=0x33, x=0x78, y=0xf8, paramA=0x5, paramB=0x1, paramC=0x80040000 object_raw subtype=0x33, x=0x98, y=0xf8, paramA=0x5, paramB=0x1, paramC=0x80040000 @@ -12450,8 +12450,8 @@ TileEntities_PalaceOfWinds_SpinyFight:: @ 080E9694 tile_entity_list_end gUnk_additional_8_PalaceOfWinds_SpinyFight:: @ 080E96A4 - enemy_raw subtype=0x1e, x=0x38, y=0x118, unknown=0x2f - enemy_raw subtype=0x1e, x=0xb8, y=0x118, unknown=0x2f + enemy_raw subtype=0x1e, x=0x38, y=0x118, pool=0x2f + enemy_raw subtype=0x1e, x=0xb8, y=0x118, pool=0x2f entity_list_end Room_PalaceOfWinds_SpinyFight:: @ 080E96D4 @@ -12466,7 +12466,7 @@ Room_PalaceOfWinds_SpinyFight:: @ 080E96D4 .4byte gUnk_additional_8_PalaceOfWinds_SpinyFight Entities_PalaceOfWinds_PeahatSwitch_0:: @ 080E96F8 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x8, x=0xd8, y=0x48, paramA=0x9, paramC=0x6affff object_raw subtype=0x9d, x=0x38, y=0xd8, paramA=0x1, paramC=0x80000069 object_raw subtype=0x9d, x=0x58, y=0xd8, paramA=0x1, paramC=0x80010069 @@ -12502,7 +12502,7 @@ Room_PalaceOfWinds_PeahatSwitch:: @ 080E9828 .4byte sub_StateChange_PalaceOfWinds_PeahatSwitch Entities_PalaceOfWinds_WhirlwindBombarossa_0:: @ 080E9848 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x8, x=0x28, y=0x48, paramA=0xb, paramC=0x6affff object_raw subtype=0x5e, x=0x58, y=0xd0 object_raw subtype=0x5e, x=0x88, y=0xf8 @@ -12550,7 +12550,7 @@ Room_PalaceOfWinds_WhirlwindBombarossa:: @ 080E9A10 .4byte gUnk_additional_b_PalaceOfWinds_WhirlwindBombarossa Entities_PalaceOfWinds_DoorToStalfosFirebar_0:: @ 080E9A40 - manager subtype=0x1a, unknown=0x8, paramA=0x2d + manager subtype=0x1a, pool=0x8, paramA=0x2d entity_list_end Enemies_PalaceOfWinds_DoorToStalfosFirebar:: @ 080E9A60 @@ -12576,15 +12576,15 @@ Room_PalaceOfWinds_DoorToStalfosFirebar:: @ 080E9AD0 .4byte sub_StateChange_PalaceOfWinds_DoorToStalfosFirebar Entities_PalaceOfWinds_StalfosFireborHole_0:: @ 080E9AF0 - manager subtype=0x1a, unknown=0x8, paramA=0x2f - manager subtype=0x1a, unknown=0x8, paramA=0x2e + manager subtype=0x1a, pool=0x8, paramA=0x2f + manager subtype=0x1a, pool=0x8, paramA=0x2e object_raw subtype=0x8, x=0xd8, y=0x48, paramA=0x1, paramC=0x6bffff entity_list_end Enemies_PalaceOfWinds_StalfosFireborHole:: @ 080E9B30 enemy_raw subtype=0x42, x=0x58, y=0x48, paramA=0x1, paramB=0xc160000, paramC=0x200020 enemy_raw subtype=0x42, x=0xa8, y=0x48, paramA=0x1, paramB=0xc160000, paramC=0x200020 - projectile_raw subtype=0x1d, x=0x68, y=0x28, unknown=0x3 + projectile_raw subtype=0x1d, x=0x68, y=0x28, pool=0x3 entity_list_end TileEntities_PalaceOfWinds_StalfosFireborHole:: @ 080E9B70 @@ -12602,7 +12602,7 @@ Room_PalaceOfWinds_StalfosFireborHole:: @ 080E9B80 .4byte sub_StateChange_PalaceOfWinds_StalfosFireborHole Entities_PalaceOfWinds_ShortcutDoorButtons_0:: @ 080E9BA0 - manager subtype=0x1a, unknown=0x8, paramA=0x30 + manager subtype=0x1a, pool=0x8, paramA=0x30 object_raw subtype=0x9d, x=0x48, y=0x28, paramA=0x1, paramC=0x8000006b object_raw subtype=0x9d, x=0x78, y=0x28, paramA=0x1, paramC=0x8001006b manager subtype=0x11, paramC=0x8400006b @@ -12629,7 +12629,7 @@ Room_PalaceOfWinds_ShortcutDoorButtons:: @ 080E9C40 .4byte sub_StateChange_PalaceOfWinds_ShortcutDoorButtons Entities_PalaceOfWinds_ToPeahatSwitch_0:: @ 080E9C60 - manager subtype=0x1a, unknown=0x8, paramA=0x31 + manager subtype=0x1a, pool=0x8, paramA=0x31 object_raw subtype=0x8, x=0xd8, y=0x68, paramA=0x1, paramC=0x6dffff entity_list_end @@ -12654,7 +12654,7 @@ Room_PalaceOfWinds_ToPeahatSwitch:: @ 080E9CD0 Entities_PalaceOfWinds_KinstoneWizzrobeFight_0:: @ 080E9CF0 manager subtype=0x1e, x=0x60, y=0x30, paramB=0x300030, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x6d8000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x6d8000 object_raw subtype=0xc, x=0x78, y=0x38, paramA=0x1, paramC=0x6d0000 object_raw subtype=0x8, x=0x28, y=0x68, paramA=0x3, paramC=0x6dffff object_raw subtype=0x8, x=0xc8, y=0x68, paramA=0x1, paramC=0x6dffff @@ -12708,13 +12708,13 @@ Room_PalaceOfWinds_GibdoStairs:: @ 080E9E2C .4byte sub_StateChange_PalaceOfWinds_GibdoStairs Entities_PalaceOfWinds_SpikeBarSmallKey_0:: @ 080E9E4C - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 entity_list_end Enemies_PalaceOfWinds_SpikeBarSmallKey:: @ 080E9E6C - projectile_raw subtype=0x1e, x=0x38, y=0xa0, unknown=0x3, paramA=0x2, paramC=0x800090 - projectile_raw subtype=0x1e, x=0x78, y=0x60, unknown=0x3, paramA=0x2, paramC=0x80ffc0 - projectile_raw subtype=0x1e, x=0x88, y=0x60, unknown=0x3, paramA=0x2, paramC=0x800040 + projectile_raw subtype=0x1e, x=0x38, y=0xa0, pool=0x3, paramA=0x2, paramC=0x800090 + projectile_raw subtype=0x1e, x=0x78, y=0x60, pool=0x3, paramA=0x2, paramC=0x80ffc0 + projectile_raw subtype=0x1e, x=0x88, y=0x60, pool=0x3, paramA=0x2, paramC=0x800040 entity_list_end TileEntities_PalaceOfWinds_SpikeBarSmallKey:: @ 080E9EAC @@ -12746,7 +12746,7 @@ Room_PalaceOfWinds_SpikeBarSmallKey:: @ 080E9F20 Entities_PalaceOfWinds_RocCape_0:: @ 080E9F4C .ifdef EU - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x9d, x=0x128, y=0x168, paramC=0x800a0000 manager subtype=0x5, x=0x7, y=0x15, paramB=0x8, paramC=0x800a0001 manager subtype=0x5, x=0x17, y=0x12, paramB=0xe, paramC=0x800a0001 @@ -12761,7 +12761,7 @@ Entities_PalaceOfWinds_RocCape_0:: @ 080E9F4C .else object_raw subtype=0x29, x=0x140, y=0xe0, paramA=0x8 manager subtype=0x2c, x=0x140, paramB=0x4012170, paramC=0xe00140 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x9d, x=0x128, y=0x168, paramC=0x800a0000 manager subtype=0x5, x=0x7, y=0x15, paramB=0x8, paramC=0x800a0001 manager subtype=0x5, x=0x17, y=0x12, paramB=0xe, paramC=0x800a0001 @@ -12784,13 +12784,13 @@ Entities_PalaceOfWinds_RocCape_0:: @ 080E9F4C gUnk_080EA09C:: @ 080EA09C manager subtype=0x1e, x=0x28, y=0xd8, paramB=0x2000c0, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x80018000 - manager subtype=0xb, unknown=0x0, paramB=0x9, paramC=0x80028001 - manager subtype=0xb, unknown=0x0, paramB=0xa, paramC=0x708002 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x80018000 + manager subtype=0xb, pool=0x0, paramB=0x9, paramC=0x80028001 + manager subtype=0xb, pool=0x0, paramB=0xa, paramC=0x708002 entity_list_end Enemies_PalaceOfWinds_RocCape:: @ 080EA0EC - projectile_raw subtype=0x1e, x=0x118, y=0x180, unknown=0x3, paramA=0x2, paramC=0x800080 + projectile_raw subtype=0x1e, x=0x118, y=0x180, pool=0x3, paramA=0x2, paramC=0x800080 entity_list_end TileEntities_PalaceOfWinds_RocCape:: @ 080EA10C @@ -12833,7 +12833,7 @@ Room_PalaceOfWinds_RocCape:: @ 080EA214 .4byte gUnk_additional_a_PalaceOfWinds_RocCape Entities_PalaceOfWinds_FireBarGrates_0:: @ 080EA240 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 entity_list_end Enemies_PalaceOfWinds_FireBarGrates:: @ 080EA260 @@ -12842,8 +12842,8 @@ Enemies_PalaceOfWinds_FireBarGrates:: @ 080EA260 enemy_raw subtype=0x22, x=0x68, y=0x148 enemy_raw subtype=0x22, x=0xd8, y=0x128 enemy_raw subtype=0x22, x=0xc8, y=0x178 - projectile_raw subtype=0x1d, x=0x58, y=0x178, unknown=0x3 - projectile_raw subtype=0x1d, x=0xb8, y=0xd8, unknown=0x3 + projectile_raw subtype=0x1d, x=0x58, y=0x178, pool=0x3 + projectile_raw subtype=0x1d, x=0xb8, y=0xd8, pool=0x3 entity_list_end TileEntities_PalaceOfWinds_FireBarGrates:: @ 080EA2E0 @@ -12862,7 +12862,7 @@ Room_PalaceOfWinds_FireBarGrates:: @ 080EA2F8 .4byte sub_StateChange_PalaceOfWinds_FireBarGrates Entities_PalaceOfWinds_PlatformRideBombarossas_0:: @ 080EA318 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 manager subtype=0x38, paramA=0x8 object_raw subtype=0xae, x=0x68, y=0xc8, paramA=0x3 object_raw subtype=0xae, x=0x78, y=0xd8 @@ -12912,7 +12912,7 @@ Room_PalaceOfWinds_PlatformRideBombarossas:: @ 080EA4BC .4byte gUnk_additional_a_PalaceOfWinds_PlatformRideBombarossas Entities_PalaceOfWinds_BridgeAfterDarknut_0:: @ 080EA4E8 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0xa1, x=0x78, y=0x18 entity_list_end @@ -12934,7 +12934,7 @@ Room_PalaceOfWinds_BridgeAfterDarknut:: @ 080EA538 .4byte sub_StateChange_PalaceOfWinds_BridgeAfterDarknut Entities_PalaceOfWinds_BridgeSwitchesCloneBlock_0:: @ 080EA558 - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 object_raw subtype=0x9d, x=0x48, y=0xa8, paramC=0x80000000 object_raw subtype=0x9d, x=0xf8, y=0x118, paramC=0x80000000 object_raw subtype=0x9d, x=0x118, y=0x98, paramC=0x80000000 @@ -12977,14 +12977,14 @@ Room_PalaceOfWinds_BridgeSwitchesCloneBlock:: @ 080EA6E8 Entities_PalaceOfWinds_EntranceRoom_0:: @ 080EA708 ezlo_hint x=0x44, y=0x4, rx=0x3, ry=0x7, msg=0xb19, flag=0x77 - manager subtype=0x1a, unknown=0x8, paramA=0x32 + manager subtype=0x1a, pool=0x8, paramA=0x32 object_raw subtype=0x34, x=0x208, y=0x58, paramB=0xc70, paramC=0x840207 object_raw subtype=0x34, x=0x1d8, y=0x58, paramA=0x1, paramB=0x1570, paramC=0x860128 object_raw subtype=0x5, x=0x218, y=0x28 object_raw subtype=0x5, x=0x218, y=0x88 object_raw subtype=0x5, x=0x228, y=0x28, paramA=0x5f object_raw subtype=0x5, x=0x228, y=0x88, paramA=0x5f - manager subtype=0x19, unknown=0x8 + manager subtype=0x19, pool=0x8 entity_list_end Enemies_PalaceOfWinds_EntranceRoom:: @ 080EA7A8 @@ -13079,13 +13079,13 @@ Room_PalaceOfWindsBoss_Main:: @ 080EAA58 .4byte sub_StateChange_PalaceOfWindsBoss_Main Entities_Vaati2_Main_0:: @ 080EAA78 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorV2Intro - npc_raw subtype=0x3b, x=0xb0, y=0x88, unknown=0xf, script=0x0 + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorV2Intro + npc_raw subtype=0x3b, x=0xb0, y=0x88, pool=0xf, script=0x0 ezlo_hint type=0x3, x=0x0, y=0x0, rx=0x3f, ry=0x3f, msg=0xb0c, flag=0x7b entity_list_end Entities_Vaati2_Main_1:: @ 080EAAB8 - manager subtype=0x1d, unknown=0x8, paramA=0x1 + manager subtype=0x1d, pool=0x8, paramA=0x1 entity_list_end Enemies_Vaati2_Main:: @ 080EAAD8 @@ -13106,11 +13106,11 @@ Room_Vaati2_Main:: @ 080EAB00 .4byte sub_StateChange_Vaati2_Main Entities_Vaati3_Main_0:: @ 080EAB20 - manager subtype=0x2f, unknown=0x8 + manager subtype=0x2f, pool=0x8 manager subtype=0x37, paramA=0x1 npc_raw subtype=0x4e, script=script_Npc4EV3Defeated object_raw subtype=0x74, x=0xb0, y=0x28, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0xb0, y=0x28, unknown=0x0, paramA=0x3, paramB=0x102 + manager subtype=0x3, x=0xb0, y=0x28, pool=0x0, paramA=0x3, paramB=0x102 ezlo_hint type=0x3, x=0x0, y=0x0, rx=0x3f, ry=0x3f, msg=0xb0d, flag=0x4051 entity_list_end @@ -13131,12 +13131,12 @@ Room_Vaati3_Main:: @ 080EABA8 .4byte sub_StateChange_Vaati3_Main Entities_DarkHyruleCastleBridge_Main_0:: @ 080EABC8 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorBallAndChainSoldierRoom + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorBallAndChainSoldierRoom object_raw subtype=0x39, x=0x88, y=0x118, paramA=0x6, paramC=0xffff entity_list_end Entities_DarkHyruleCastleBridge_Main_1:: @ 080EABF8 - manager subtype=0x1b, unknown=0x8, paramA=0x6 + manager subtype=0x1b, pool=0x8, paramA=0x6 entity_list_end Enemies_DarkHyruleCastleBridge_Main:: @ 080EAC18 @@ -13207,11 +13207,11 @@ Entities_DarkHyruleCastleOutside_ZeldaStatuePlatform_0:: @ 080EAD38 entity_list_end Entities_DarkHyruleCastleOutside_ZeldaStatuePlatform_1:: @ 080EAD48 - manager subtype=0x1b, unknown=0x8, paramA=0x4 + manager subtype=0x1b, pool=0x8, paramA=0x4 entity_list_end gUnk_080EAD68:: @ 080EAD68 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorVaatiWithZelda + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorVaatiWithZelda npc_raw subtype=0x28, x=0x78, y=0x68, script=script_ZeldaStoneInDHC npc_raw subtype=0x27, x=0x78, y=0x96, paramA=0x1, script=script_VaatiWithZelda object_raw subtype=0xab, x=0x78, y=0x138 @@ -13260,7 +13260,7 @@ gUnk_080EAEC0:: @ 080EAEC0 npc_raw subtype=0xf, x=0x88, y=0x68, script=script_MinishEzloOutro npc_raw subtype=0x28, x=0x58, y=0x88, script=script_ZeldaOutro npc_raw subtype=0x4d, x=0x88, y=0x88, script=script_EzloCapOutro - object_raw subtype=0x6a, x=0x88, y=0xa8, unknown=0x4f, paramA=0x1, paramC=script_CutsceneMiscObjectMinishCapOutro + object_raw subtype=0x6a, x=0x88, y=0xa8, pool=0x4f, paramA=0x1, paramC=script_CutsceneMiscObjectMinishCapOutro entity_list_end gUnk_080EAF20:: @ 080EAF20 @@ -13503,7 +13503,7 @@ Entities_DarkHyruleCastle_1FEntrance_0:: @ 080EB594 entity_list_end gUnk_080EB5D4:: @ 080EB5D4 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorCastleEscape + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorCastleEscape npc_raw subtype=0x28, x=0xd8, y=0x178, script=script_ZeldaCastleEscape entity_list_end @@ -13627,7 +13627,7 @@ Room_DarkHyruleCastle_3FBottomRightTower:: @ 080EB864 .4byte sub_StateChange_Dojos_ToSplitblade0 Entities_DarkHyruleCastle_3FKeatonHallToVaati_0:: @ 080EB884 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorKeatonsRoom + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorKeatonsRoom object_raw subtype=0x3, x=0x78, y=0x48, paramA=0x1, paramC=0x80000001 object_raw subtype=0x3, x=0x98, y=0x48, paramA=0x1, paramC=0x80010001 object_raw subtype=0x3, x=0xb8, y=0x48, paramA=0x1, paramC=0x80020001 @@ -13667,10 +13667,10 @@ Entities_DarkHyruleCastle_3FTripleDarknut_0:: @ 080EB9E4 entity_list_end gUnk_080EB9F4:: @ 080EB9F4 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorDarkNutsRoom + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorDarkNutsRoom manager subtype=0x1e, x=0x30, y=0xa0, paramB=0x2000f0, paramC=0x80000000 manager subtype=0x35, x=0xa8, y=0x58, paramB=0x3c1e00, paramC=0x80008001 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x80028001 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x80028001 manager subtype=0x35, x=0xa8, y=0x28, paramB=0x3c1e00, paramC=0x80028003 object_raw subtype=0x8, x=0xa8, y=0x28, paramC=0x8003ffff .ifndef EU @@ -13683,13 +13683,13 @@ gUnk_080EB9F4:: @ 080EB9F4 gUnk_080EBAA4:: @ 080EBAA4 npc_raw subtype=0x27, x=0xa8, y=0x58, paramA=0x1, script=script_Vaati1Intro - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorV1Defeated + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorV1Defeated object_raw subtype=0x8, x=0xa8, y=0x28, paramC=0xffff object_raw subtype=0x39, x=0xa8, y=0xd8, paramA=0x6, paramC=0xffff entity_list_end gUnk_080EBAF4:: @ 080EBAF4 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorV2Defeated + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorV2Defeated object_raw subtype=0x8, x=0xa8, y=0x28, paramC=0x80000000 object_raw subtype=0x39, x=0xa8, y=0xd8, paramA=0x6, paramC=0x80000000 entity_list_end @@ -13710,10 +13710,10 @@ TileEntities_DarkHyruleCastle_3FTripleDarknut:: @ 080EBBA4 tile_entity_list_end gUnk_additional_8_DarkHyruleCastle_3FTripleDarknut:: @ 080EBBB4 - enemy_raw subtype=0x5, x=0x88, y=0x58, unknown=0x2f, paramA=0x2 - enemy_raw subtype=0x5, x=0xa8, y=0x58, unknown=0x2f, paramA=0x3 - enemy_raw subtype=0x5, x=0xc8, y=0x58, unknown=0x2f, paramA=0x2 - manager subtype=0x28, unknown=0x3, paramB=0x8 + enemy_raw subtype=0x5, x=0x88, y=0x58, pool=0x2f, paramA=0x2 + enemy_raw subtype=0x5, x=0xa8, y=0x58, pool=0x2f, paramA=0x3 + enemy_raw subtype=0x5, x=0xc8, y=0x58, pool=0x2f, paramA=0x2 + manager subtype=0x28, pool=0x3, paramB=0x8 object_raw subtype=0x39, x=0xa8, y=0xd8, paramA=0x6, paramC=0xffff entity_list_end @@ -13729,7 +13729,7 @@ Room_DarkHyruleCastle_3FTripleDarknut:: @ 080EBC14 .4byte gUnk_additional_8_DarkHyruleCastle_3FTripleDarknut Entities_DarkHyruleCastle_2FTopLeftTower_0:: @ 080EBC38 - manager subtype=0x1a, unknown=0x8, paramA=0x34 + manager subtype=0x1a, pool=0x8, paramA=0x34 object_raw subtype=0x3, x=0x58, y=0x78, paramC=0x420001 object_raw subtype=0x8, x=0x88, y=0xb8, paramA=0x2, paramC=0x42ffff entity_list_end @@ -13757,10 +13757,10 @@ Entities_DarkHyruleCastle_2FTopLeftCorner_0:: @ 080EBCB8 object_raw subtype=0x23, x=0x98, y=0x28, paramB=0xaa00, paramC=0x80020080 object_raw subtype=0x23, x=0xb8, y=0x28, paramB=0xaa00, paramC=0x80030080 manager subtype=0x11, paramC=0x8c000080 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x800092 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x800092 object_raw subtype=0x8, x=0x28, y=0x58, paramA=0x3, paramC=0x92ffff - object_raw subtype=0x98, x=0x88, y=0xa8, unknown=0x3, paramB=0x10702 - object_raw subtype=0x98, x=0x88, y=0xa8, unknown=0x3, paramB=0x30702 + object_raw subtype=0x98, x=0x88, y=0xa8, pool=0x3, paramB=0x10702 + object_raw subtype=0x98, x=0x88, y=0xa8, pool=0x3, paramB=0x30702 object_raw subtype=0x5, x=0x38, y=0xf8, paramA=0x5e object_raw subtype=0x5, x=0x38, y=0x128, paramA=0x5e object_raw subtype=0x5, x=0x38, y=0x158, paramA=0x5e @@ -13828,8 +13828,8 @@ Room_DarkHyruleCastle_2FBossKey:: @ 080EBF40 Entities_DarkHyruleCastle_2FBlueWarp_0:: @ 080EBF60 manager subtype=0x1e, x=0x30, y=0x50, paramB=0x2000b0, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x488000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x480086 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x488000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x480086 object_raw subtype=0x34, x=0x88, y=0x68, paramB=0x88, paramC=0x480716 entity_list_end @@ -13842,10 +13842,10 @@ TileEntities_DarkHyruleCastle_2FBlueWarp:: @ 080EBFC0 tile_entity_list_end gUnk_additional_8_DarkHyruleCastle_2FBlueWarp:: @ 080EBFD8 - enemy_raw subtype=0x5, x=0x88, y=0x38, unknown=0x2f, paramA=0x3, paramB=0xe160000, paramC=0x300030 + enemy_raw subtype=0x5, x=0x88, y=0x38, pool=0x2f, paramA=0x3, paramB=0xe160000, paramC=0x300030 object_raw subtype=0x8, x=0x88, y=0xa8, paramA=0x12, paramC=0x86ffff object_raw subtype=0x39, x=0x88, y=0x28, paramA=0x4, paramC=0x86ffff - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorDHC + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorDHC ezlo_hint type=0x3, x=0x0, y=0x0, rx=0x3f, ry=0x3f, msg=0xb0a, flag=0x86 entity_list_end @@ -13861,8 +13861,8 @@ Room_DarkHyruleCastle_2FBlueWarp:: @ 080EC038 .4byte gUnk_additional_8_DarkHyruleCastle_2FBlueWarp Entities_DarkHyruleCastle_2FTopRightCornerGhini_0:: @ 080EC05C - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x490000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x490087 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x490000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x490087 object_raw subtype=0x8, x=0xe8, y=0x58, paramA=0x1, paramC=0x87ffff entity_list_end @@ -13903,9 +13903,9 @@ Entities_DarkHyruleCastle_2FTopRightCornerTorches_0:: @ 080EC114 manager subtype=0x23, x=0xc8, y=0x78, paramA=0x3, paramB=0x71001, paramC=0x8006004a manager subtype=0x23, x=0xb8, y=0x98, paramA=0x3, paramB=0x71001, paramC=0x8007004a manager subtype=0x11, paramC=0x9c00004a - manager subtype=0x2e, unknown=0x0, paramB=0xa00, paramC=0x4a004b - object_raw subtype=0x98, x=0x88, y=0x68, unknown=0x3, paramB=0x10402 - object_raw subtype=0x98, x=0x88, y=0x68, unknown=0x3, paramB=0x30402 + manager subtype=0x2e, pool=0x0, paramB=0xa00, paramC=0x4a004b + object_raw subtype=0x98, x=0x88, y=0x68, pool=0x3, paramB=0x10402 + object_raw subtype=0x98, x=0x88, y=0x68, pool=0x3, paramB=0x30402 entity_list_end Enemies_DarkHyruleCastle_2FTopRightCornerTorches:: @ 080EC1F4 @@ -13953,12 +13953,12 @@ Entities_DarkHyruleCastle_2FTopLeftDarknut_0:: @ 080EC2AC entity_list_end gUnk_080EC2CC:: @ 080EC2CC - manager subtype=0xf, unknown=0x0, paramA=0xd - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x80010000 + manager subtype=0xf, pool=0x0, paramA=0xd + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x80010000 manager subtype=0x1e, x=0x30, y=0x30, paramB=0x7000a8, paramC=0x80000000 - manager subtype=0x2e, x=0x2d, unknown=0x0, paramB=0x100, paramC=0x80000000 - manager subtype=0x2e, x=0x23, unknown=0x0, paramB=0x100, paramC=0x80010000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x8001004c + manager subtype=0x2e, x=0x2d, pool=0x0, paramB=0x100, paramC=0x80000000 + manager subtype=0x2e, x=0x23, pool=0x0, paramB=0x100, paramC=0x80010000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x8001004c manager subtype=0x35, x=0x88, y=0x28, paramB=0x3c1e00, paramC=0x4c0088 entity_list_end @@ -14022,12 +14022,12 @@ Entities_DarkHyruleCastle_2FTopRightDarknuts_0:: @ 080EC4C8 entity_list_end gUnk_080EC4E8:: @ 080EC4E8 - manager subtype=0xf, unknown=0x0, paramA=0xd - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x80010000 + manager subtype=0xf, pool=0x0, paramA=0xd + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x80010000 manager subtype=0x1e, x=0x38, y=0x30, paramB=0x7000a8, paramC=0x80000000 - manager subtype=0x2e, x=0x2d, unknown=0x0, paramB=0x100, paramC=0x80000000 - manager subtype=0x2e, x=0x23, unknown=0x0, paramB=0x100, paramC=0x80010000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x8001004d + manager subtype=0x2e, x=0x2d, pool=0x0, paramB=0x100, paramC=0x80000000 + manager subtype=0x2e, x=0x23, pool=0x0, paramB=0x100, paramC=0x80010000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x8001004d manager subtype=0x35, x=0x88, y=0x28, paramB=0x3c1e00, paramC=0x4d0089 entity_list_end @@ -14042,7 +14042,7 @@ TileEntities_DarkHyruleCastle_2FTopRightDarknuts:: @ 080EC578 gUnk_additional_8_DarkHyruleCastle_2FTopRightDarknuts:: @ 080EC590 enemy_raw subtype=0x5, x=0x70, y=0x68, paramA=0x1 enemy_raw subtype=0x5, x=0xa0, y=0x68 - manager subtype=0x28, unknown=0x3, paramB=0x8 + manager subtype=0x28, pool=0x3, paramB=0x8 object_raw subtype=0x8, x=0x88, y=0xa8, paramA=0x12, paramC=0x4dffff object_raw subtype=0x8, x=0x28, y=0x68, paramA=0x13, paramC=0x4dffff ezlo_hint type=0x3, x=0x0, y=0x0, rx=0x3f, ry=0x3f, msg=0xb0f, flag=0x4d @@ -14099,7 +14099,7 @@ Room_DarkHyruleCastle_2FLeft:: @ 080EC77C .4byte gUnk_additional_8_DarkHyruleCastle_2FLeft Entities_DarkHyruleCastle_2FRight_0:: @ 080EC7A0 - object_raw subtype=0x98, x=0x78, y=0x88, unknown=0x3, paramB=0x10302 + object_raw subtype=0x98, x=0x78, y=0x88, pool=0x3, paramB=0x10302 entity_list_end Enemies_DarkHyruleCastle_2FRight:: @ 080EC7C0 @@ -14124,12 +14124,12 @@ Entities_DarkHyruleCastle_2FBottomLeftDarknuts_0:: @ 080EC800 entity_list_end gUnk_080EC820:: @ 080EC820 - manager subtype=0xf, unknown=0x0, paramA=0xd - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x80010000 + manager subtype=0xf, pool=0x0, paramA=0xd + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x80010000 manager subtype=0x1e, x=0x38, y=0x30, paramB=0x7000a8, paramC=0x80000000 - manager subtype=0x2e, x=0x2d, unknown=0x0, paramB=0x100, paramC=0x80000000 - manager subtype=0x2e, x=0x23, unknown=0x0, paramB=0x100, paramC=0x80010000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x80010053 + manager subtype=0x2e, x=0x2d, pool=0x0, paramB=0x100, paramC=0x80000000 + manager subtype=0x2e, x=0x23, pool=0x0, paramB=0x100, paramC=0x80010000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x80010053 manager subtype=0x35, x=0x88, y=0xa8, paramB=0x3c1e00, paramC=0x53008a entity_list_end @@ -14144,7 +14144,7 @@ TileEntities_DarkHyruleCastle_2FBottomLeftDarknuts:: @ 080EC8B0 gUnk_additional_8_DarkHyruleCastle_2FBottomLeftDarknuts:: @ 080EC8C8 enemy_raw subtype=0x5, x=0x70, y=0x68 enemy_raw subtype=0x5, x=0xa0, y=0x68, paramA=0x1 - manager subtype=0x28, unknown=0x3, paramB=0x8 + manager subtype=0x28, pool=0x3, paramB=0x8 object_raw subtype=0x8, x=0x88, y=0x28, paramA=0x10, paramC=0x53ffff object_raw subtype=0x8, x=0xe8, y=0x68, paramA=0x11, paramC=0x53ffff ezlo_hint type=0x3, x=0x0, y=0x0, rx=0x3f, ry=0x3f, msg=0xb0f, flag=0x53 @@ -14163,8 +14163,8 @@ Room_DarkHyruleCastle_2FBottomLeftDarknuts:: @ 080EC938 Entities_DarkHyruleCastle_2FBossDoor_0:: @ 080EC95C object_raw subtype=0x39, x=0x88, y=0x28, paramC=0x55ffff - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x540000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x54008b + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x540000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x54008b object_raw subtype=0x8, x=0x28, y=0x68, paramA=0x3, paramC=0x8bffff object_raw subtype=0x8, x=0xe8, y=0x68, paramA=0x1, paramC=0x8bffff object_raw subtype=0x34, x=0x88, y=0x68, paramA=0x1, paramB=0x88, paramC=0x8b071c @@ -14198,12 +14198,12 @@ Entities_DarkHyruleCastle_2FBottomRightDarknut_0:: @ 080ECA40 entity_list_end gUnk_080ECA60:: @ 080ECA60 - manager subtype=0xf, unknown=0x0, paramA=0xd - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x80010000 + manager subtype=0xf, pool=0x0, paramA=0xd + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x80010000 manager subtype=0x1e, x=0x38, y=0x30, paramB=0x7000a8, paramC=0x80000000 - manager subtype=0x2e, x=0x2d, unknown=0x0, paramB=0x100, paramC=0x80000000 - manager subtype=0x2e, x=0x23, unknown=0x0, paramB=0x100, paramC=0x80010000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x80010056 + manager subtype=0x2e, x=0x2d, pool=0x0, paramB=0x100, paramC=0x80000000 + manager subtype=0x2e, x=0x23, pool=0x0, paramB=0x100, paramC=0x80010000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x80010056 manager subtype=0x35, x=0x88, y=0xa8, paramB=0x3c1e00, paramC=0x56008c entity_list_end @@ -14268,7 +14268,7 @@ Entities_DarkHyruleCastle_2FEntrance_0:: @ 080ECC64 object_raw subtype=0x9d, x=0x68, y=0x88, paramA=0x1, paramC=0x80020058 object_raw subtype=0x9d, x=0xa8, y=0x88, paramA=0x1, paramC=0x80030058 manager subtype=0x11, paramC=0x8c000058 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x580090 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x580090 manager subtype=0x35, x=0x88, y=0x38, paramB=0x5a1e00, paramC=0x900059 object_raw subtype=0x39, x=0x88, y=0x38, paramA=0x4, paramC=0x59ffff entity_list_end @@ -14296,12 +14296,12 @@ Entities_DarkHyruleCastle_2FBottomLeftCorner_0:: @ 080ECD34 object_raw subtype=0x9d, x=0x88, y=0x148, paramA=0x1, paramC=0x8002005a object_raw subtype=0x9d, x=0xa8, y=0x128, paramA=0x1, paramC=0x8003005a manager subtype=0x11, paramC=0x8c00005a - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x5a0091 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x5a0091 object_raw subtype=0x8, x=0xe8, y=0x128, paramA=0x1, paramC=0x91ffff - object_raw subtype=0x98, x=0x58, y=0xa8, unknown=0x3, paramB=0x30302 - object_raw subtype=0x98, x=0x58, y=0xa8, unknown=0x3, paramB=0x10302 - object_raw subtype=0x98, x=0xb8, y=0xa8, unknown=0x3, paramB=0x30302 - object_raw subtype=0x98, x=0xb8, y=0xa8, unknown=0x3, paramB=0x10302 + object_raw subtype=0x98, x=0x58, y=0xa8, pool=0x3, paramB=0x30302 + object_raw subtype=0x98, x=0x58, y=0xa8, pool=0x3, paramB=0x10302 + object_raw subtype=0x98, x=0xb8, y=0xa8, pool=0x3, paramB=0x30302 + object_raw subtype=0x98, x=0xb8, y=0xa8, pool=0x3, paramB=0x10302 entity_list_end Enemies_DarkHyruleCastle_2FBottomLeftCorner:: @ 080ECDF4 @@ -14342,8 +14342,8 @@ Room_DarkHyruleCastle_2FBottomLeftTower:: @ 080ECE64 .4byte sub_StateChange_Dojos_ToGreatblade6 Entities_DarkHyruleCastle_2FBottomLeftGhini_0:: @ 080ECE84 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x5b0000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x5b008d + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x5b0000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x5b008d object_raw subtype=0x8, x=0x88, y=0xa8, paramA=0x2, paramC=0x8dffff entity_list_end @@ -14427,7 +14427,7 @@ Entities_DarkHyruleCastle_2FBottomRightTower_0:: @ 080ED02C object_raw subtype=0x5, x=0x68, y=0x168, paramA=0x5e object_raw subtype=0x5, x=0xa8, y=0x168 object_raw subtype=0x5, x=0xb8, y=0x168 - manager subtype=0x1a, unknown=0x8, paramA=0x35 + manager subtype=0x1a, pool=0x8, paramA=0x35 entity_list_end Enemies_DarkHyruleCastle_2FBottomRightTower:: @ 080ED0AC @@ -14491,8 +14491,8 @@ Room_DarkHyruleCastle_1FTopLeftTower:: @ 080ED174 Entities_DarkHyruleCastle_1FThroneRoom_0:: @ 080ED194 manager subtype=0x1e, x=0x20, y=0x70, paramB=0x2000d0, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x5e8000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x5e008e + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x5e8000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x5e008e object_raw subtype=0x8, x=0xe8, y=0x88, paramA=0x1, paramC=0x8effff entity_list_end @@ -14516,7 +14516,7 @@ TileEntities_DarkHyruleCastle_1FThroneRoom:: @ 080ED264 tile_entity_list_end gUnk_additional_8_DarkHyruleCastle_1FThroneRoom:: @ 080ED27C - enemy_raw subtype=0x5, x=0x88, y=0x68, unknown=0x2f, paramA=0x2 + enemy_raw subtype=0x5, x=0x88, y=0x68, pool=0x2f, paramA=0x2 object_raw subtype=0x39, x=0x88, y=0xa8, paramA=0x6, paramC=0x8effff entity_list_end @@ -14980,7 +14980,7 @@ Room_DarkHyruleCastle_B1ToPrison:: @ 080EDE60 Entities_DarkHyruleCastle_B1BombWall_0:: @ 080EDE80 object_raw subtype=0x74, x=0x48, y=0x48, collision=2, paramC=0xffff0000 - manager subtype=0x3, x=0x48, y=0x48, unknown=0x0, paramA=0x3, paramB=0x202 + manager subtype=0x3, x=0x48, y=0x48, pool=0x0, paramA=0x3, paramB=0x202 entity_list_end Entities_DarkHyruleCastle_B1BombWall_1:: @ 080EDEB0 @@ -14990,8 +14990,8 @@ Entities_DarkHyruleCastle_B1BombWall_1:: @ 080EDEB0 entity_list_end Enemies_DarkHyruleCastle_B1BombWall:: @ 080EDEF0 - projectile_raw subtype=0x1d, x=0x78, y=0x88, unknown=0x3 - projectile_raw subtype=0x1d, x=0xd8, y=0x48, unknown=0x3 + projectile_raw subtype=0x1d, x=0x78, y=0x88, pool=0x3 + projectile_raw subtype=0x1d, x=0xd8, y=0x48, pool=0x3 entity_list_end TileEntities_DarkHyruleCastle_B1BombWall:: @ 080EDF20 @@ -15048,15 +15048,15 @@ Room_DarkHyruleCastle_B1Keatons:: @ 080EE078 .4byte sub_StateChange_GoronCave_Stairs9 Entities_DarkHyruleCastle_B1ToPrisonFirebar_0:: @ 080EE098 - object_raw subtype=0x98, x=0xa8, y=0x78, unknown=0x3, paramB=0x602 - object_raw subtype=0x98, x=0xa8, y=0x78, unknown=0x3, paramB=0x20602 - object_raw subtype=0x98, x=0xa8, y=0x78, unknown=0x3, paramB=0x10602 - object_raw subtype=0x98, x=0xa8, y=0x78, unknown=0x3, paramB=0x30602 - object_raw subtype=0x98, x=0x88, y=0xf8, unknown=0x3, paramB=0x302 - object_raw subtype=0x98, x=0x88, y=0xf8, unknown=0x3, paramB=0x20302 - object_raw subtype=0x98, x=0xc8, y=0xf8, unknown=0x3, paramB=0x10302 - object_raw subtype=0x98, x=0xc8, y=0xf8, unknown=0x3, paramB=0x30302 - manager subtype=0x1a, unknown=0x8, paramA=0x36 + object_raw subtype=0x98, x=0xa8, y=0x78, pool=0x3, paramB=0x602 + object_raw subtype=0x98, x=0xa8, y=0x78, pool=0x3, paramB=0x20602 + object_raw subtype=0x98, x=0xa8, y=0x78, pool=0x3, paramB=0x10602 + object_raw subtype=0x98, x=0xa8, y=0x78, pool=0x3, paramB=0x30602 + object_raw subtype=0x98, x=0x88, y=0xf8, pool=0x3, paramB=0x302 + object_raw subtype=0x98, x=0x88, y=0xf8, pool=0x3, paramB=0x20302 + object_raw subtype=0x98, x=0xc8, y=0xf8, pool=0x3, paramB=0x10302 + object_raw subtype=0x98, x=0xc8, y=0xf8, pool=0x3, paramB=0x30302 + manager subtype=0x1a, pool=0x8, paramA=0x36 entity_list_end Enemies_DarkHyruleCastle_B1ToPrisonFirebar:: @ 080EE138 @@ -15247,9 +15247,9 @@ Room_DarkHyruleCastle_B2ToPrison:: @ 080EE66C Entities_DarkHyruleCastle_B2Prison_0:: @ 080EE68C object_raw subtype=0x74, x=0x88, y=0x38, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0x88, y=0x38, unknown=0x0, paramA=0x3, paramB=0x103 + manager subtype=0x3, x=0x88, y=0x38, pool=0x0, paramA=0x3, paramB=0x103 object_raw subtype=0x3, x=0xa8, y=0x28, paramC=0x6d0001 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x6d008f + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x6d008f manager subtype=0x35, x=0xe0, y=0x68, paramB=0x3c1e00, paramC=0x8f0081 object_raw subtype=0xb1, x=0x80, y=0x78, paramC=0x810000 object_raw subtype=0xb1, x=0x140, y=0x78, paramC=0x810000 @@ -15326,7 +15326,7 @@ Entities_HyruleTown_0_0:: @ 080EE80C .endif enemy_raw subtype=0x41, x=0x388, y=0x3a8 object_raw subtype=0xb7, x=0x2f8, y=0x278 - manager subtype=0x1a, unknown=0x8, paramA=0x3c + manager subtype=0x1a, pool=0x8, paramA=0x3c manager subtype=0x16, paramA=0xf npc_raw subtype=0x4, x=0x1f8, y=0x1d8, script=script_Postman entity_list_end @@ -15410,11 +15410,11 @@ Entities_HyruleTown_0_1:: @ 080EEADC manager subtype=0x21, paramA=0xe object_raw subtype=0x19, paramB=0xc00 .ifdef EU_JP - object_raw subtype=0x38, x=0x170, y=0x3e, unknown=0x0, paramA=0xc5 - object_raw subtype=0x38, x=0x2b0, y=0x3e, unknown=0x0, paramA=0xc6, paramB=0x1 + object_raw subtype=0x38, x=0x170, y=0x3e, pool=0x0, paramA=0xc5 + object_raw subtype=0x38, x=0x2b0, y=0x3e, pool=0x0, paramA=0xc6, paramB=0x1 .else - object_raw subtype=0x38, x=0x170, y=0x3e, unknown=0x0, paramA=0xc8 - object_raw subtype=0x38, x=0x2b0, y=0x3e, unknown=0x0, paramA=0xc9, paramB=0x1 + object_raw subtype=0x38, x=0x170, y=0x3e, pool=0x0, paramA=0xc8 + object_raw subtype=0x38, x=0x2b0, y=0x3e, pool=0x0, paramA=0xc9, paramB=0x1 .endif entity_list_end @@ -15427,17 +15427,17 @@ gUnk_080EEB8C:: @ 080EEB8C entity_list_end gUnk_080EEBAC:: @ 080EEBAC - object_raw subtype=0xbb, x=0x278, y=0x58, unknown=0x4f, paramB=0x3, paramC=script_Windcrest + object_raw subtype=0xbb, x=0x278, y=0x58, pool=0x4f, paramB=0x3, paramC=script_Windcrest entity_list_end Entities_HyruleTown_1_0:: @ 080EEBCC manager subtype=0x16, paramA=0x9 npc_raw subtype=0x4e, script=script_Npc4EIntroTown npc_raw subtype=0x28, x=0xc8, y=0x3c8, script=script_ZeldaIntroTown - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorIntroTown + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorIntroTown object_raw subtype=0x95, x=0x144, y=0x4c, collision=2, paramA=0x4 object_raw subtype=0x95, x=0x178, y=0xa8, collision=2, paramA=0x7 - object_raw subtype=0xbb, x=0x148, y=0x58, unknown=0x4f, paramB=0x3, paramC=script_Windcrest + object_raw subtype=0xbb, x=0x148, y=0x58, pool=0x4f, paramB=0x3, paramC=script_Windcrest entity_list_end Entities_HyruleTown_1_1:: @ 080EEC4C @@ -15446,11 +15446,11 @@ Entities_HyruleTown_1_1:: @ 080EEC4C object_raw subtype=0x19, paramB=0x800 object_raw subtype=0x77, x=0xc8, y=0x128 .ifdef EU_JP - object_raw subtype=0x38, x=0x40, y=0x3e, unknown=0x0, paramA=0xc5 - object_raw subtype=0x38, x=0x180, y=0x3e, unknown=0x0, paramA=0xc6, paramB=0x1 + object_raw subtype=0x38, x=0x40, y=0x3e, pool=0x0, paramA=0xc5 + object_raw subtype=0x38, x=0x180, y=0x3e, pool=0x0, paramA=0xc6, paramB=0x1 .else - object_raw subtype=0x38, x=0x40, y=0x3e, unknown=0x0, paramA=0xc8 - object_raw subtype=0x38, x=0x180, y=0x3e, unknown=0x0, paramA=0xc9, paramB=0x1 + object_raw subtype=0x38, x=0x40, y=0x3e, pool=0x0, paramA=0xc8 + object_raw subtype=0x38, x=0x180, y=0x3e, pool=0x0, paramA=0xc9, paramB=0x1 .endif entity_list_end gUnk_080EECBC:: @ 080EECBC @@ -16034,7 +16034,7 @@ Entities_HyruleTownMinishCaves_MulldozerFight_0:: @ 080EFFA0 object_raw subtype=0x8, x=0x28, y=0x88, paramA=0x3, paramC=0xeffff object_raw subtype=0x8, x=0x88, y=0xc8, paramA=0x12, paramC=0xeffff manager subtype=0x1e, x=0x60, y=0x50, paramB=0x400050, paramC=0x80000000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0xe8000 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0xe8000 object_raw subtype=0xc, x=0x88, y=0x68, paramA=0x2, paramB=0xf, paramC=0xe0000 entity_list_end @@ -16095,7 +16095,7 @@ Room_HyruleTownMinishCaves_WestChest:: @ 080F00F4 Entities_HyruleTownMinishCaves_Flippers_0:: @ 080F0114 object_raw subtype=0x8, x=0xd8, y=0xb8, paramA=0x12, paramC=0xffff manager subtype=0x1e, x=0x90, y=0x70, paramB=0x400090, paramC=0x110000 - manager subtype=0xb, unknown=0x0, paramB=0x8, paramC=0x120011 + manager subtype=0xb, pool=0x0, paramB=0x8, paramC=0x120011 object_raw subtype=0xc, x=0xd8, y=0x28, paramA=0x2, paramB=0x14, paramC=0x120000 .ifndef EU ezlo_hint x=0x12, y=0xa, rx=0x9, ry=0x4, msg=0xb6d, flag=0xc7, flag2=0x14 @@ -16111,8 +16111,8 @@ TileEntities_HyruleTownMinishCaves_Flippers:: @ 080F0194 tile_entity_list_end gUnk_additional_8_HyruleTownMinishCaves_Flippers:: @ 080F01A4 - enemy_raw subtype=0x40, x=0xc8, y=0x48, unknown=0x2f, paramB=0xe0e0000, paramC=0x3000a0 - enemy_raw subtype=0x40, x=0xe8, y=0x48, unknown=0x2f, paramB=0xe0e0000, paramC=0x3000a0 + enemy_raw subtype=0x40, x=0xc8, y=0x48, pool=0x2f, paramB=0xe0e0000, paramC=0x3000a0 + enemy_raw subtype=0x40, x=0xe8, y=0x48, pool=0x2f, paramB=0xe0e0000, paramC=0x3000a0 entity_list_end Room_HyruleTownMinishCaves_Flippers:: @ 080F01D4 @@ -16331,14 +16331,14 @@ gUnk_080F06E0:: @ 080F06E0 entity_list_end gUnk_080F0770:: @ 080F0770 - object_raw subtype=0x6a, x=0x1f8, y=0x78, unknown=0x4f, paramA=0xe, paramC=script_CutsceneMiscObjectMonsterFromChest - object_raw subtype=0x6a, x=0x1f8, y=0x78, unknown=0x4f, paramA=0xe, paramB=0x1001, paramC=script_CutsceneMiscObjectMonsterFromChest - object_raw subtype=0x6a, x=0x1f8, y=0x78, unknown=0x4f, paramA=0xe, paramB=0x2002, paramC=script_CutsceneMiscObjectMonsterFromChest - object_raw subtype=0x6a, x=0x1f8, y=0x78, unknown=0x4f, paramA=0xe, paramB=0x3003, paramC=script_CutsceneMiscObjectMonsterFromChest - object_raw subtype=0x6a, x=0x1f8, y=0x78, unknown=0x4f, paramA=0xe, paramB=0x4004, paramC=script_CutsceneMiscObjectMonsterFromChest - object_raw subtype=0x6a, x=0x1f8, y=0x78, unknown=0x4f, paramA=0xe, paramB=0x5005, paramC=script_CutsceneMiscObjectMonsterFromChest - object_raw subtype=0x6a, x=0x1f8, y=0x78, unknown=0x4f, paramA=0xe, paramB=0x6006, paramC=script_CutsceneMiscObjectMonsterFromChest - object_raw subtype=0x6a, x=0x1f8, y=0x78, unknown=0x4f, paramA=0xe, paramB=0x7007, paramC=script_CutsceneMiscObjectMonsterFromChest + object_raw subtype=0x6a, x=0x1f8, y=0x78, pool=0x4f, paramA=0xe, paramC=script_CutsceneMiscObjectMonsterFromChest + object_raw subtype=0x6a, x=0x1f8, y=0x78, pool=0x4f, paramA=0xe, paramB=0x1001, paramC=script_CutsceneMiscObjectMonsterFromChest + object_raw subtype=0x6a, x=0x1f8, y=0x78, pool=0x4f, paramA=0xe, paramB=0x2002, paramC=script_CutsceneMiscObjectMonsterFromChest + object_raw subtype=0x6a, x=0x1f8, y=0x78, pool=0x4f, paramA=0xe, paramB=0x3003, paramC=script_CutsceneMiscObjectMonsterFromChest + object_raw subtype=0x6a, x=0x1f8, y=0x78, pool=0x4f, paramA=0xe, paramB=0x4004, paramC=script_CutsceneMiscObjectMonsterFromChest + object_raw subtype=0x6a, x=0x1f8, y=0x78, pool=0x4f, paramA=0xe, paramB=0x5005, paramC=script_CutsceneMiscObjectMonsterFromChest + object_raw subtype=0x6a, x=0x1f8, y=0x78, pool=0x4f, paramA=0xe, paramB=0x6006, paramC=script_CutsceneMiscObjectMonsterFromChest + object_raw subtype=0x6a, x=0x1f8, y=0x78, pool=0x4f, paramA=0xe, paramB=0x7007, paramC=script_CutsceneMiscObjectMonsterFromChest entity_list_end gUnk_080F0800:: @ 080F0800 @@ -16357,10 +16357,10 @@ gUnk_080F0870:: @ 080F0870 entity_list_end gUnk_080F0890:: @ 080F0890 - npc_raw subtype=0x15, x=0x128, y=0x198, unknown=0xf, collision=1, paramB=0x1e, script=0x0 - npc_raw subtype=0x15, x=0x98, y=0xc8, unknown=0xf, collision=1, paramA=0x1, paramB=0x1f, script=0x0 - npc_raw subtype=0x15, x=0x68, y=0x168, unknown=0xf, collision=1, paramA=0x2, paramB=0x20, script=0x0 - npc_raw subtype=0x15, x=0x48, y=0x168, unknown=0xf, collision=1, paramA=0x3, paramB=0x21, script=0x0 + npc_raw subtype=0x15, x=0x128, y=0x198, pool=0xf, collision=1, paramB=0x1e, script=0x0 + npc_raw subtype=0x15, x=0x98, y=0xc8, pool=0xf, collision=1, paramA=0x1, paramB=0x1f, script=0x0 + npc_raw subtype=0x15, x=0x68, y=0x168, pool=0xf, collision=1, paramA=0x2, paramB=0x20, script=0x0 + npc_raw subtype=0x15, x=0x48, y=0x168, pool=0xf, collision=1, paramA=0x3, paramB=0x21, script=0x0 npc_raw subtype=0x4e, script=script_GuardGarden7 entity_list_end @@ -16384,7 +16384,7 @@ Entities_CastleGarden_Main_1:: @ 080F0940 object_raw subtype=0x57, x=0x3a8, y=0x178, paramC=0xe0000 object_raw subtype=0x9c, x=0x348, y=0xe0, paramC=0xf0000 .endif - manager subtype=0x3, x=0x348, y=0xf0, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x348, y=0xf0, pool=0x0, paramB=0x102 entity_list_end gUnk_080F09A0:: @ 080F09A0 @@ -16465,7 +16465,7 @@ Room_CastleGarden_Main:: @ 080F0AE8 .4byte gUnk_additional_f_CastleGarden_Main Entities_SimonsSimulation_Main_0:: @ 080F0B28 - object_raw subtype=0x69, x=0x98, y=0x88, unknown=0x4f, paramC=script_CutsceneOrchestratorSimonsSimulation + object_raw subtype=0x69, x=0x98, y=0x88, pool=0x4f, paramC=script_CutsceneOrchestratorSimonsSimulation entity_list_end gUnk_080F0B48:: @ 080F0B48 @@ -16804,7 +16804,7 @@ Entities_HouseInteriors2_DrLeft_0:: @ 080F2134 entity_list_end gUnk_080F2174:: @ 080F2174 - npc_raw subtype=0x41, x=0x78, y=0x6c, unknown=0xf, paramA=0x1, script=0x0 + npc_raw subtype=0x41, x=0x78, y=0x6c, pool=0xf, paramA=0x1, script=0x0 entity_list_end gUnk_080F2194:: @ 080F2194 @@ -16868,7 +16868,7 @@ Room_HouseInteriors2_DrLeft:: @ 080F22F4 .4byte gUnk_additional_d_HouseInteriors2_DrLeft Entities_HouseInteriors2_Romio_0:: @ 080F232C - npc_raw subtype=0x35, x=0x48, y=0x68, unknown=0xf, paramA=0x3, paramB=0x3, script=0x0 + npc_raw subtype=0x35, x=0x48, y=0x68, pool=0xf, paramA=0x3, paramB=0x3, script=0x0 object_raw subtype=0x8d, x=0x98, y=0x28, paramC=0x850000 ezlo_hint type=0x2, x=0x16, y=0xa, rx=0x2, ry=0x2, msg=0xb24, flag=0xc3 entity_list_end @@ -16893,7 +16893,7 @@ Entities_HouseInteriors2_Romio_1:: @ 080F23DC object_raw subtype=0x5, x=0x68, y=0x28 object_raw subtype=0x5, x=0x78, y=0x28 manager subtype=0x6, paramA=0x9 - object_raw subtype=0x38, x=0xc0, y=0x4e, unknown=0x0, paramA=0x3c + object_raw subtype=0x38, x=0xc0, y=0x4e, pool=0x0, paramA=0x3c entity_list_end Enemies_HouseInteriors2_Romio:: @ 080F245C @@ -16936,7 +16936,7 @@ Room_HouseInteriors2_Romio:: @ 080F24D8 .4byte gUnk_additional_d_HouseInteriors2_Romio Entities_HouseInteriors2_Julietta_0:: @ 080F2510 - npc_raw subtype=0x2c, x=0x38, y=0x78, unknown=0xf, collision=1, paramA=0x4, paramB=0x4000, script=0x0 + npc_raw subtype=0x2c, x=0x38, y=0x78, pool=0xf, collision=1, paramA=0x4, paramB=0x4000, script=0x0 manager subtype=0x26, paramA=0xa, paramB=0x28ff object_raw subtype=0x8b, x=0x68, y=0x48, collision=1, paramB=0x1, paramC=0x3e0000 ezlo_hint type=0x2, x=0x10, y=0xc, rx=0x5, ry=0x1, msg=0xb5a, flag=0xc6 @@ -17040,7 +17040,7 @@ TileEntities_HouseInteriors2_Percy:: @ 080F2858 tile_entity_list_end gUnk_080F2860:: @ 080F2860 - manager subtype=0x0, unknown=0x0, paramA=0x80 + manager subtype=0x0, pool=0x0, paramA=0x80 gUnk_additional_8_HouseInteriors2_Percy:: @ 080F2870 @@ -17348,7 +17348,7 @@ Entities_HouseInteriors2_StockwellLakeHouse_1:: @ 080F30EC object_raw subtype=0x4d, x=0x4c, y=0x28, collision=1, paramA=0x3 object_raw subtype=0x4d, x=0x78, y=0x28, collision=1, paramA=0x1 object_raw subtype=0x4d, x=0x88, y=0x28, collision=1, paramA=0x1 - object_raw subtype=0x38, x=0xc0, y=0x3e, unknown=0x0, paramA=0x45 + object_raw subtype=0x38, x=0xc0, y=0x3e, pool=0x0, paramA=0x45 entity_list_end Enemies_HouseInteriors2_StockwellLakeHouse:: @ 080F314C @@ -17378,7 +17378,7 @@ Entities_HouseInteriors2_LinksHouseBedroom_0:: @ 080F3198 entity_list_end gUnk_080F31D8:: @ 080F31D8 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorLinksHouseBed + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorLinksHouseBed entity_list_end Entities_HouseInteriors2_LinksHouseBedroom_1:: @ 080F31F8 @@ -17419,7 +17419,7 @@ Entities_HouseInteriors4_Carpenter_1:: @ 080F32D0 object_raw subtype=0x4d, x=0xa0, y=0x48, collision=1, paramA=0x17 object_raw subtype=0x4e, x=0x8, y=0x68, collision=1, paramB=0x803 object_raw subtype=0x4e, x=0x68, y=0x40, collision=1, paramB=0x900 - object_raw subtype=0x38, x=0xc0, y=0x6e, unknown=0x0, paramA=0x49, paramB=0x1 + object_raw subtype=0x38, x=0xc0, y=0x6e, pool=0x0, paramA=0x49, paramB=0x1 object_raw subtype=0x5, x=0xb8, y=0x98 object_raw subtype=0x5, x=0xc8, y=0x98 entity_list_end @@ -17499,7 +17499,7 @@ Entities_HouseInteriors4_RanchHouseWest_1:: @ 080F3624 object_raw subtype=0x4f, x=0xc8, y=0x58, paramA=0x11, paramB=0x1 object_raw subtype=0x4f, x=0xe0, y=0x58, paramA=0xf object_raw subtype=0x4e, x=0x38, y=0x80, collision=1, paramB=0x802 - object_raw subtype=0x38, x=0x30, y=0x5e, unknown=0x0, paramA=0x4c, paramB=0x1 + object_raw subtype=0x38, x=0x30, y=0x5e, pool=0x0, paramA=0x4c, paramB=0x1 object_raw subtype=0x5, x=0xa8, y=0x38, paramA=0x37, paramB=0x2, paramC=0x4d0000 object_raw subtype=0x5, x=0xa8, y=0x38 object_raw subtype=0x5, x=0xa8, y=0x28 @@ -17538,7 +17538,7 @@ Room_HouseInteriors4_RanchHouseWest:: @ 080F3758 .4byte gUnk_additional_9_HouseInteriors4_RanchHouseWest Entities_HouseInteriors4_RanchHouseEast_0:: @ 080F3780 - npc_raw subtype=0x31, x=0xb0, y=0x48, unknown=0xf, paramB=0x101, script=0x0 + npc_raw subtype=0x31, x=0xb0, y=0x48, pool=0xf, paramB=0x101, script=0x0 manager subtype=0x26, paramA=0x9, paramB=0xff entity_list_end npc_raw subtype=0x1d, x=0x48, y=0x38, script=script_TalonInside @@ -17691,7 +17691,7 @@ gUnk_080F3C44:: @ 080F3C44 entity_list_end gUnk_080F3C64:: @ 080F3C64 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorAfterToD + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorAfterToD npc_raw subtype=0x42, x=0x128, y=0x180, script=script_KingGustafHologram entity_list_end @@ -17701,10 +17701,10 @@ gUnk_080F3C94:: @ 080F3C94 Entities_LakeHylia_Main_1:: @ 080F3CB4 manager subtype=0x6, paramA=0x8 - manager subtype=0x3, x=0xb8, y=0x1f0, unknown=0x0, paramB=0x102 - manager subtype=0x3, x=0x128, y=0x188, unknown=0x0, paramA=0x6, paramB=0x102 + manager subtype=0x3, x=0xb8, y=0x1f0, pool=0x0, paramB=0x102 + manager subtype=0x3, x=0x128, y=0x188, pool=0x0, paramA=0x6, paramB=0x102 object_raw subtype=0x9c, x=0x2a8, y=0x2d0, paramC=0x60000 - manager subtype=0x3, x=0x2a8, y=0x2e0, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x2a8, y=0x2e0, pool=0x0, paramB=0x102 object_raw subtype=0x19, x=0x120, y=0x44, collision=1, paramA=0x6, paramB=0x2 object_raw subtype=0x19, x=0x2a0, y=0x384, collision=1, paramA=0x7, paramB=0x2 manager subtype=0x20, x=0x28, y=0x218, paramB=0x10282e00, paramC=0x71208 @@ -18197,9 +18197,9 @@ Entities_OuterFortressOfWinds_SmallKey_0:: @ 080F4BF8 object_raw subtype=0x4e, x=0x58, y=0xd0, collision=1, paramB=0x800 object_raw subtype=0x3, x=0x28, y=0x78, paramC=0x630000 manager subtype=0x17, x=0xb8, y=0x5a, paramA=0x53, paramB=0x10200, paramC=0x650064 - manager subtype=0x2e, unknown=0x0, paramB=0x1e00, paramC=0x630065 + manager subtype=0x2e, pool=0x0, paramB=0x1e00, paramC=0x630065 object_raw subtype=0x74, x=0x28, y=0x48, collision=1, paramC=0xffff0000 - manager subtype=0x3, x=0x28, y=0x48, unknown=0x0, paramA=0x3, paramB=0x102 + manager subtype=0x3, x=0x28, y=0x48, pool=0x0, paramA=0x3, paramB=0x102 entity_list_end Enemies_OuterFortressOfWinds_SmallKey:: @ 080F4C78 @@ -18256,31 +18256,31 @@ gUnk_080F4D50:: @ 080F4D50 gUnk_080F4D70:: @080F4D70 npc_raw subtype=0x4d, x=0x388, y=0x168, script=script_EzloCap - object_raw subtype=0x6a, x=0x358, y=0x168, unknown=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectLeftBullyingOctorok - object_raw subtype=0x6a, x=0x3b8, y=0x168, unknown=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectRightBullyingOctorok + object_raw subtype=0x6a, x=0x358, y=0x168, pool=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectLeftBullyingOctorok + object_raw subtype=0x6a, x=0x3b8, y=0x168, pool=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectRightBullyingOctorok entity_list_end gUnk_080F4DB0:: @ 080F4DB0 - object_raw subtype=0x69, unknown=0x4f, paramC=script_08012C98 + object_raw subtype=0x69, pool=0x4f, paramC=script_08012C98 entity_list_end gUnk_080F4DD0:: @ 080F4DD0 - object_raw subtype=0x69, unknown=0x4f, paramC=script_EzloTalkMinishPortal + object_raw subtype=0x69, pool=0x4f, paramC=script_EzloTalkMinishPortal entity_list_end gUnk_080F4DF0:: @ 080F4DF0 - object_raw subtype=0x69, unknown=0x4f, paramC=script_08012D18 + object_raw subtype=0x69, pool=0x4f, paramC=script_08012D18 entity_list_end gUnk_080F4E10:: @ 080F4E10 - object_raw subtype=0xbb, x=0x128, y=0x2a8, unknown=0x4f, paramB=0x7, paramC=script_Windcrest + object_raw subtype=0xbb, x=0x128, y=0x2a8, pool=0x4f, paramB=0x7, paramC=script_Windcrest entity_list_end Entities_MinishWoods_Main_1:: @ 080F4E30 - manager subtype=0x1, unknown=0x18, paramA=0x11 + manager subtype=0x1, pool=0x18, paramA=0x11 manager subtype=0x4 - manager subtype=0x3, x=0x128, y=0x370, unknown=0x0, paramB=0x103 - manager subtype=0x3, x=0x398, y=0x3b0, unknown=0x0, paramB=0x103 + manager subtype=0x3, x=0x128, y=0x370, pool=0x0, paramB=0x103 + manager subtype=0x3, x=0x398, y=0x3b0, pool=0x0, paramB=0x103 manager subtype=0x6, paramA=0x8 object_raw subtype=0x3e, x=0x1d8, y=0x35a, collision=1 object_raw subtype=0x19, x=0x2c0, y=0x50, collision=1, paramA=0x8, paramB=0x2 @@ -18288,10 +18288,10 @@ Entities_MinishWoods_Main_1:: @ 080F4E30 gUnk_080F4EB0:: @ 080F4EB0 npc_raw subtype=0x4e, script=script_Npc4EMinishWoods - object_raw subtype=0x6a, x=0x398, y=0x148, unknown=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectOctorok1 - object_raw subtype=0x6a, x=0x378, y=0x158, unknown=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectOctorok2 - object_raw subtype=0x6a, x=0x3a8, y=0x168, unknown=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectOctorok3 - object_raw subtype=0x6a, x=0x388, y=0x188, unknown=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectOctorok4 + object_raw subtype=0x6a, x=0x398, y=0x148, pool=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectOctorok1 + object_raw subtype=0x6a, x=0x378, y=0x158, pool=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectOctorok2 + object_raw subtype=0x6a, x=0x3a8, y=0x168, pool=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectOctorok3 + object_raw subtype=0x6a, x=0x388, y=0x188, pool=0x4f, paramA=0x13, paramC=script_CutsceneMiscObjectOctorok4 entity_list_end gUnk_080F4F10:: @ 080F4F10 @@ -18434,7 +18434,7 @@ Entities_SanctuaryEntrance_Main_0:: @ 080F52F8 entity_list_end gUnk_080F5308:: @ 080F5308 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorSanctuaryEntrance + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorSanctuaryEntrance entity_list_end gUnk_080F5328:: @ 080F5328 @@ -18491,7 +18491,7 @@ Room_Sanctuary_Hall:: @ 080F5428 .4byte sub_StateChange_Sanctuary_Hall Entities_Sanctuary_Main_0:: @ 080F5448 - object_raw subtype=0x6a, x=0xe8, y=0x90, unknown=0x4f, paramA=0x17, paramC=script_CutsceneMiscObjectTextBoard + object_raw subtype=0x6a, x=0xe8, y=0x90, pool=0x4f, paramA=0x17, paramC=script_CutsceneMiscObjectTextBoard npc_raw subtype=0x4e, script=script_08013F94 npc_raw subtype=0x4e, script=script_NPC4EPreventPlayerLeave npc_raw subtype=0x4e, script=script_Npc4EPreventPlayerLeaving @@ -18513,8 +18513,8 @@ gUnk_080F5508:: @ 080F5508 entity_list_end gUnk_080F5528:: @ 080F5528 - object_raw subtype=0x6a, x=0xb0, y=0xf8, unknown=0x4f, paramA=0x1c, paramC=script_CutsceneMiscObjectEarthElement - object_raw subtype=0x6a, x=0x120, y=0xf8, unknown=0x4f, paramA=0x1c, paramC=script_CutsceneMiscObjectFireElement + object_raw subtype=0x6a, x=0xb0, y=0xf8, pool=0x4f, paramA=0x1c, paramC=script_CutsceneMiscObjectEarthElement + object_raw subtype=0x6a, x=0x120, y=0xf8, pool=0x4f, paramA=0x1c, paramC=script_CutsceneMiscObjectFireElement entity_list_end gUnk_080F5558:: @ 080F5558 @@ -18522,7 +18522,7 @@ gUnk_080F5558:: @ 080F5558 entity_list_end gUnk_080F5578:: @ 080F5578 - object_raw subtype=0x6a, x=0x120, y=0x168, unknown=0x4f, paramA=0x1c, paramC=script_CutsceneMiscObjectWaterElement + object_raw subtype=0x6a, x=0x120, y=0x168, pool=0x4f, paramA=0x1c, paramC=script_CutsceneMiscObjectWaterElement entity_list_end gUnk_080F5598:: @ 080F5598 @@ -18530,7 +18530,7 @@ gUnk_080F5598:: @ 080F5598 entity_list_end gUnk_080F55B8:: @ 080F55B8 - object_raw subtype=0x6a, x=0xb0, y=0x168, unknown=0x4f, paramA=0x1c, paramC=script_CutsceneMiscObjectWindElement + object_raw subtype=0x6a, x=0xb0, y=0x168, pool=0x4f, paramA=0x1c, paramC=script_CutsceneMiscObjectWindElement entity_list_end gUnk_080F55D8:: @ 080F55D8 @@ -18561,7 +18561,7 @@ Entities_Sanctuary_StainedGlass_0:: @ 080F5630 entity_list_end gUnk_080F5660:: @ 080F5660 - object_raw subtype=0x69, unknown=0x4f, paramC=script_MinishVillageObjectPictureBackRoom + object_raw subtype=0x69, pool=0x4f, paramC=script_MinishVillageObjectPictureBackRoom entity_list_end gUnk_080F5680:: @ 080F5680 @@ -18593,7 +18593,7 @@ Room_Sanctuary_StainedGlass:: @ 080F5718 .4byte sub_StateChange_Sanctuary_StainedGlass Entities_HouseInteriors3_StockwellShop_0:: @ 080F5738 - npc_raw subtype=0x1c, x=0x98, y=0x78, unknown=0xf, script=0x0 + npc_raw subtype=0x1c, x=0x98, y=0x78, pool=0xf, script=0x0 entity_list_end gUnk_080F5758:: @ 080F5758 @@ -18644,7 +18644,7 @@ gUnk_080F58A8:: @ 080F58A8 Entities_HouseInteriors3_StockwellShop_1:: @ 080F58C8 object_raw subtype=0x4f, x=0x78, y=0xc8, paramA=0x2, paramB=0x2 object_raw subtype=0x4e, x=0xac, y=0x28, collision=1, paramB=0x800 - object_raw subtype=0x38, x=0xc0, y=0x4e, unknown=0x0, paramA=0x51, paramB=0x1 + object_raw subtype=0x38, x=0xc0, y=0x4e, pool=0x0, paramA=0x51, paramB=0x1 entity_list_end Enemies_HouseInteriors3_StockwellShop:: @ 080F5908 @@ -18686,7 +18686,7 @@ Entities_HouseInteriors3_Cafe_1:: @ 080F59E8 object_raw subtype=0x4e, x=0x48, y=0x28, collision=1, paramB=0x800 object_raw subtype=0x4e, x=0x38, y=0xb0, collision=1, paramB=0x902 object_raw subtype=0x4e, x=0xd0, y=0x48, collision=1, paramB=0xa01 - object_raw subtype=0x38, x=0xc0, y=0x8e, unknown=0x0, paramA=0x58 + object_raw subtype=0x38, x=0xc0, y=0x8e, pool=0x0, paramA=0x58 entity_list_end Enemies_HouseInteriors3_Cafe:: @ 080F5A78 @@ -18722,7 +18722,7 @@ Room_HouseInteriors3_Cafe:: @ 080F5ADC .4byte gUnk_additional_b_HouseInteriors3_Cafe Entities_HouseInteriors3_RemShoeShop_0:: @ 080F5B0C - npc_raw subtype=0x37, x=0x68, y=0x41, unknown=0xf, script=0x0 + npc_raw subtype=0x37, x=0x68, y=0x41, pool=0xf, script=0x0 ezlo_hint type=0x2, x=0x4, y=0x8, rx=0x2, ry=0x2, msg=0xb24, flag=0xc3 entity_list_end @@ -18735,7 +18735,7 @@ gUnk_080F5B3C:: @ 080F5B3C Entities_HouseInteriors3_RemShoeShop_1:: @ 080F5B5C object_raw subtype=0x4f, x=0xe8, y=0x58, paramA=0x2, paramB=0x1 object_raw subtype=0x4d, x=0x68, y=0x48, collision=1, paramA=0x1e - object_raw subtype=0x38, x=0x30, y=0x2e, unknown=0x0, paramA=0x4b, paramB=0x1 + object_raw subtype=0x38, x=0x30, y=0x2e, pool=0x0, paramA=0x4b, paramB=0x1 manager subtype=0x6, paramA=0x8 entity_list_end @@ -18884,7 +18884,7 @@ Room_HouseInteriors3_FigurineHouse:: @ 080F5EF8 .4byte sub_StateChange_HouseInteriors3_FigurineHouse Entities_HouseInteriors3_BorlovEntrance_0:: @ 080F5F18 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneMiscObjectPreventPlayerLeaveCarlov + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneMiscObjectPreventPlayerLeaveCarlov entity_list_end gUnk_additional_8_HouseInteriors3_BorlovEntrance:: @ 080F5F38 @@ -18926,8 +18926,8 @@ Room_HouseInteriors3_BorlovEntrance:: @ 080F5FF0 Entities_HouseInteriors3_Carlov_0:: @ 080F601C npc_raw subtype=0x3f, x=0x78, y=0x39, script=script_Carlov2 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneMiscObjectCarlov - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneMiscObjectCarlov2 + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneMiscObjectCarlov + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneMiscObjectCarlov2 object_raw subtype=0x54, x=0xa8, y=0x3e, paramA=0x1, paramB=0x80000, paramC=0x80000000 entity_list_end @@ -19145,11 +19145,11 @@ Entities_WindTribeTowerRoof_Main_0:: @ 080F664C entity_list_end gUnk_080F66AC:: @ 080F66AC - object_raw subtype=0x69, unknown=0x4f, paramC=script_EzloTalkPoW + object_raw subtype=0x69, pool=0x4f, paramC=script_EzloTalkPoW entity_list_end Entities_WindTribeTowerRoof_Main_1:: @ 080F66CC - manager subtype=0x1b, unknown=0x8, paramA=0x5 + manager subtype=0x1b, pool=0x8, paramA=0x5 object_raw subtype=0x4f, x=0xb8, y=0x128, paramA=0x17 object_raw subtype=0x4d, x=0x28, y=0x78, collision=1, paramA=0x20 object_raw subtype=0x4d, x=0xc8, y=0x78, collision=1, paramA=0x20 @@ -19489,7 +19489,7 @@ Entities_HyruleField_WesternWoodSouth_1:: @ 080F6F2C object_raw subtype=0x2c, x=0x38, y=0x38, paramA=0x7, paramB=0xb300 .endif manager subtype=0x18 - manager subtype=0x3, x=0x78, y=0x80, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x78, y=0x80, pool=0x0, paramB=0x102 manager subtype=0x6, paramA=0x8 entity_list_end @@ -19545,7 +19545,7 @@ gUnk_080F70A8:: @ 080F70A8 entity_list_end gUnk_080F70D8:: @ 080F70D8 - object_raw subtype=0xbb, x=0x2c8, y=0x128, unknown=0x4f, paramB=0x6, paramC=script_Windcrest + object_raw subtype=0xbb, x=0x2c8, y=0x128, pool=0x4f, paramB=0x6, paramC=script_Windcrest entity_list_end Entities_HyruleField_SouthHyruleField_1:: @ 080F70F8 @@ -19555,7 +19555,7 @@ Entities_HyruleField_SouthHyruleField_1:: @ 080F70F8 .else object_raw subtype=0x9c, x=0x58, y=0x210, paramC=0x6c0000 .endif - manager subtype=0x3, x=0x58, y=0x220, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x58, y=0x220, pool=0x0, paramB=0x102 manager subtype=0x18 object_raw subtype=0x2d, x=0x2d0, y=0x148 entity_list_end @@ -19634,14 +19634,14 @@ Entities_HyruleField_EasternHillsSouth_0:: @ 080F72EC entity_list_end Entities_HyruleField_EasternHillsSouth_1:: @ 080F731C - manager subtype=0x3, x=0x48, y=0x80, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x48, y=0x80, pool=0x0, paramB=0x102 manager subtype=0x18 entity_list_end Enemies_HyruleField_EasternHillsSouth:: @ 080F734C enemy_raw subtype=0x35, x=0x188, y=0x58, paramB=0xb0d0000, paramC=0x480148 enemy_raw subtype=0x35, x=0x128, y=0x28, paramB=0x70f0000, paramC=0x180128 - manager subtype=0x28, unknown=0x3, paramB=0x2 + manager subtype=0x28, pool=0x3, paramB=0x2 entity_list_end TileEntities_HyruleField_EasternHillsSouth:: @ 080F738C @@ -19682,7 +19682,7 @@ Enemies_HyruleField_EasternHillsCenter:: @ 080F741C enemy_raw subtype=0x35, x=0x28, y=0xb8, paramB=0x4140000, paramC=0xa00020 enemy_raw subtype=0x35, x=0x198, y=0xb8, paramB=0x6100000, paramC=0xa00130 enemy_raw subtype=0x35, x=0x178, y=0x58, paramB=0xa160000, paramC=0x2000d0 - manager subtype=0x28, unknown=0x3, paramB=0x2 + manager subtype=0x28, pool=0x3, paramB=0x2 enemy_raw subtype=0x3, x=0x88, y=0x38, paramB=0xa260000, paramC=0x200060 enemy_raw subtype=0x3, x=0x128, y=0x58, paramB=0xa260000, paramC=0x200060 entity_list_end @@ -19852,8 +19852,8 @@ Entities_HyruleField_LonLonRanch_1:: @ 080F78E0 manager subtype=0x6, paramA=0x8 object_raw subtype=0x4e, x=0x13c, y=0x278, collision=1, paramB=0xa00 object_raw subtype=0x4e, x=0x1b4, y=0x278, collision=1, paramB=0x1000 - manager subtype=0x3, x=0x158, y=0x220, unknown=0x0, paramB=0x103 - manager subtype=0x3, x=0x118, y=0x30, unknown=0x0, paramB=0x101 + manager subtype=0x3, x=0x158, y=0x220, pool=0x0, paramB=0x103 + manager subtype=0x3, x=0x118, y=0x30, pool=0x0, paramB=0x101 object_raw subtype=0x9c, x=0x138, y=0x160, paramC=0x7b0000 .else manager subtype=0x20, x=0xb8, y=0xc8, paramB=0x10a82e00, paramC=0x7a10c8 @@ -19862,11 +19862,11 @@ Entities_HyruleField_LonLonRanch_1:: @ 080F78E0 manager subtype=0x6, paramA=0x8 object_raw subtype=0x4e, x=0x13c, y=0x278, collision=1, paramB=0xa00 object_raw subtype=0x4e, x=0x1b4, y=0x278, collision=1, paramB=0x1000 - manager subtype=0x3, x=0x158, y=0x220, unknown=0x0, paramB=0x103 - manager subtype=0x3, x=0x118, y=0x30, unknown=0x0, paramB=0x101 + manager subtype=0x3, x=0x158, y=0x220, pool=0x0, paramB=0x103 + manager subtype=0x3, x=0x118, y=0x30, pool=0x0, paramB=0x101 object_raw subtype=0x9c, x=0x138, y=0x160, paramC=0x7d0000 .endif - manager subtype=0x3, x=0x138, y=0x170, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x138, y=0x170, pool=0x0, paramB=0x102 object_raw subtype=0x19, paramB=0x1100 manager subtype=0x4 manager subtype=0x18 @@ -19964,13 +19964,13 @@ Entities_HyruleField_OutsideCastle_1:: @ 080F7C00 object_raw subtype=0x2f, x=0x38, y=0x1c8, paramC=0x80640000 .ifdef EU_JP object_raw subtype=0x9c, x=0x328, y=0x200, paramC=0x8b0000 - manager subtype=0x3, x=0x328, y=0x210, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x328, y=0x210, pool=0x0, paramB=0x102 manager subtype=0x18 object_raw subtype=0x57, x=0x1f8, y=0x148, paramC=0x40570000 object_raw subtype=0x0, x=0x178, y=0x1d8, collision=1, paramA=0x57, paramB=0x700, paramC=0x8d0000 .else object_raw subtype=0x9c, x=0x328, y=0x200, paramC=0x8d0000 - manager subtype=0x3, x=0x328, y=0x210, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x328, y=0x210, pool=0x0, paramB=0x102 manager subtype=0x18 object_raw subtype=0x57, x=0x1f8, y=0x148, paramC=0x40570000 object_raw subtype=0x0, x=0x178, y=0x1d8, collision=1, paramA=0x57, paramB=0x700, paramC=0x8f0000 @@ -19978,7 +19978,7 @@ Entities_HyruleField_OutsideCastle_1:: @ 080F7C00 entity_list_end gUnk_080F7C80:: @ 080F7C80 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorVaatiAppears + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorVaatiAppears npc_raw subtype=0x27, x=0x1f8, y=0x108, paramA=0x1, script=script_VaatiAppearsAgain entity_list_end @@ -20001,18 +20001,18 @@ gUnk_additional_e_HyruleField_OutsideCastle:: @ 080F7CF0 entity_list_end gUnk_080F7D70:: @ 080F7D70 - object_raw subtype=0x69, unknown=0x4f, paramC=script_080157AC - object_raw subtype=0x69, unknown=0x4f, paramC=script_08015B34 + object_raw subtype=0x69, pool=0x4f, paramC=script_080157AC + object_raw subtype=0x69, pool=0x4f, paramC=script_08015B34 npc_raw subtype=0x28, x=0x1e8, y=0x168, script=script_ZeldaIntroBusinessScrub enemy_raw subtype=0x5b, x=0x248, y=0x1eb entity_list_end gUnk_080F7DC0:: @ 080F7DC0 - manager subtype=0xe, unknown=0x1f, paramA=0xd, paramC=0x80640000 + manager subtype=0xe, pool=0x1f, paramA=0xd, paramC=0x80640000 entity_list_end gUnk_additional_d_HyruleField_OutsideCastle:: @ 080F7DE0 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorFixBridge + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorFixBridge manager subtype=0x5, x=0x9, y=0x25, paramB=0x89, paramC=0x80650001 manager subtype=0x5, x=0x9, y=0x26, paramB=0x89, paramC=0x80650001 entity_list_end @@ -20113,14 +20113,14 @@ Entities_HyruleField_OutsideCastle_1West:: @ 080F808C manager subtype=0x18 manager subtype=0x4 manager subtype=0x6, paramA=0x8 - manager subtype=0x3, x=0x38, y=0xa0, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x38, y=0xa0, pool=0x0, paramB=0x102 manager subtype=0x20, x=0x158, y=0x298, paramB=0x11582e00, paramC=0x901288 entity_list_end .else manager subtype=0x18 manager subtype=0x4 manager subtype=0x6, paramA=0x8 - manager subtype=0x3, x=0x38, y=0xa0, unknown=0x0, paramB=0x102 + manager subtype=0x3, x=0x38, y=0xa0, pool=0x0, paramB=0x102 manager subtype=0x20, x=0x158, y=0x298, paramB=0x11582e00, paramC=0x921288 entity_list_end .endif @@ -20202,7 +20202,7 @@ Entities_HyruleField_WesternWoodsNorth_0:: @ 080F8210 .endif gUnk_080F82E0:: @ 080F82E0 - object_raw subtype=0x69, unknown=0x4f, paramC=script_CutsceneOrchestratorTakeover + object_raw subtype=0x69, pool=0x4f, paramC=script_CutsceneOrchestratorTakeover entity_list_end Entities_HyruleField_WesternWoodsNorth_1:: @ 080F8300 @@ -20307,7 +20307,7 @@ gUnk_080F85D8:: @ 080F85D8 gUnk_080F85F8:: @ 080F85F8 manager subtype=0x35, x=0xa8, y=0xc8, paramB=0xf01e00, paramC=0xc098000 - manager subtype=0xe, unknown=0x1f, paramA=0x8, paramC=0x80000000 + manager subtype=0xe, pool=0x1f, paramA=0x8, paramC=0x80000000 entity_list_end gUnk_additional_8_Caves_Boomerang:: @ 080F8628 @@ -20943,7 +20943,7 @@ Entities_VeilFalls_Main_0:: @ 080F9264 .endif gUnk_080F9304:: @ 080F9304 - object_raw subtype=0xbb, x=0xf8, y=0xf8, unknown=0x4f, paramB=0x1, paramC=script_Windcrest + object_raw subtype=0xbb, x=0xf8, y=0xf8, pool=0x4f, paramB=0x1, paramC=script_Windcrest entity_list_end Entities_VeilFalls_Main_1:: @ 080F9324 @@ -20957,7 +20957,7 @@ Enemies_VeilFalls_Main:: @ 080F9354 enemy_raw subtype=0x35, x=0x198, y=0x98, paramA=0x1 enemy_raw subtype=0x35, x=0x158, y=0x1f8, paramA=0x1 enemy_raw subtype=0x35, x=0x168, y=0x1f8, paramA=0x1 - manager subtype=0x28, unknown=0x3, paramB=0x2 + manager subtype=0x28, pool=0x3, paramB=0x2 enemy_raw subtype=0x2, x=0xb8, y=0x378, paramA=0x1, paramB=0xa280000, paramC=0x3700060 enemy_raw subtype=0x2, x=0xf8, y=0x3a8, paramA=0x1, paramB=0xa280000, paramC=0x3700060 enemy_raw subtype=0x0, x=0x48, y=0x3a8, paramB=0xa2e0000, paramC=0x3700030 @@ -21260,8 +21260,8 @@ Entities_VeilFallsTop_Main_0:: @ 080F9B78 npc_raw subtype=0x4c, x=0xd0, y=0x68, paramA=0x5, script=script_BigGoron2 npc_raw subtype=0x4c, x=0x1b0, y=0x68, paramA=0xa, script=script_BigGoron2 npc_raw subtype=0x4c, y=0x78, paramA=0x4, script=script_BigGoron3 - npc_raw subtype=0x4c, x=0x108, y=0x88, unknown=0xf, paramA=0x1, script=0x0 - npc_raw subtype=0x4c, x=0x108, y=0x88, unknown=0xf, paramA=0x2, script=0x0 + npc_raw subtype=0x4c, x=0x108, y=0x88, pool=0xf, paramA=0x1, script=0x0 + npc_raw subtype=0x4c, x=0x108, y=0x88, pool=0xf, paramA=0x2, script=0x0 entity_list_end gUnk_080F9BF8:: @ 080F9BF8 @@ -21278,15 +21278,15 @@ gUnk_080F9BF8:: @ 080F9BF8 .endif gUnk_080F9C38:: @ 080F9C38 - object_raw subtype=0x6a, x=0x108, y=0x88, unknown=0x4f, paramA=0x29, paramC=script_CutsceneMiscObjectVeilFallsTop + object_raw subtype=0x6a, x=0x108, y=0x88, pool=0x4f, paramA=0x29, paramC=script_CutsceneMiscObjectVeilFallsTop entity_list_end gUnk_080F9C58:: @ 080F9C58 - object_raw subtype=0x6a, x=0x118, y=0x88, unknown=0x4f, paramA=0x2a, paramC=script_CutsceneMiscObjectMirrorShield + object_raw subtype=0x6a, x=0x118, y=0x88, pool=0x4f, paramA=0x2a, paramC=script_CutsceneMiscObjectMirrorShield entity_list_end Entities_VeilFallsTop_Main_1:: @ 080F9C78 - manager subtype=0x1b, unknown=0x8, paramA=0x2 + manager subtype=0x1b, pool=0x8, paramA=0x2 entity_list_end Enemies_VeilFallsTop_Main:: @ 080F9C98 @@ -21417,7 +21417,7 @@ Room_47_4:: @ 080F9F08 Entities_TreeInteriors_WitchHut_0:: @ 080F9F28 npc_raw subtype=0x36, x=0x78, y=0x30, script=script_Syrup - object_raw subtype=0x69, x=0x58, y=0x48, unknown=0x4f, paramC=script_CutsceneOrchestratorPotionBlue + object_raw subtype=0x69, x=0x58, y=0x48, pool=0x4f, paramC=script_CutsceneOrchestratorPotionBlue entity_list_end Entities_TreeInteriors_WitchHut_1:: @ 080F9F58 @@ -21431,7 +21431,7 @@ gUnk_080F9F88:: @ 080F9F88 gUnk_080F9FA8:: @ 080F9FA8 object_raw subtype=0x4d, x=0x98, y=0x48, collision=1, paramA=0x8 - object_raw subtype=0x69, x=0x98, y=0x48, unknown=0x4f, paramC=script_CutsceneOrchestratorPotionRed + object_raw subtype=0x69, x=0x98, y=0x48, pool=0x4f, paramC=script_CutsceneOrchestratorPotionRed entity_list_end Enemies_TreeInteriors_WitchHut:: @ 080F9FD8 @@ -22113,19 +22113,19 @@ Entities_MtCrenel_MountainTop_0:: @ 080FAC28 Entities_MtCrenel_MountainTop_1:: @ 080FAC88 .ifdef EU_JP object_raw subtype=0x2c, x=0x98, y=0x28, paramA=0x7, paramB=0xad00 - manager subtype=0x1b, unknown=0x8 + manager subtype=0x1b, pool=0x8 entity_list_end .else object_raw subtype=0x2c, x=0x98, y=0x28, paramA=0x7, paramB=0xaf00 - manager subtype=0x1b, unknown=0x8 + manager subtype=0x1b, pool=0x8 entity_list_end .endif gUnk_080FACB8:: @ 080FACB8 manager subtype=0x10 manager subtype=0x6, paramA=0x8 - manager subtype=0x3, x=0x288, y=0x28, unknown=0x0, paramA=0x1, paramB=0x102 - manager subtype=0x3, x=0x388, y=0x28, unknown=0x0, paramA=0x1, paramB=0x102 + manager subtype=0x3, x=0x288, y=0x28, pool=0x0, paramA=0x1, paramB=0x102 + manager subtype=0x3, x=0x388, y=0x28, pool=0x0, paramA=0x1, paramB=0x102 object_raw subtype=0x7a, x=0x1d8, y=0xb8, paramA=0x1 object_raw subtype=0x7a, x=0x1e8, y=0xa8, paramA=0x1 object_raw subtype=0x7a, x=0x1f8, y=0xa0, paramA=0x1 @@ -22134,10 +22134,10 @@ gUnk_080FACB8:: @ 080FACB8 gUnk_080FAD48:: @ 080FAD48 npc_raw subtype=0x4e, script=script_Npc4EMtCrenel - object_raw subtype=0x6a, x=0xf8, y=0x38, unknown=0x4f, paramA=0x20, paramC=script_CutsceneMiscObjectTektite1 - object_raw subtype=0x6a, x=0x168, y=0x48, unknown=0x4f, paramA=0x20, paramC=script_CutsceneMiscObjectTektite2 - object_raw subtype=0x6a, x=0x138, y=0x68, unknown=0x4f, paramA=0x21, paramC=script_CutsceneMiscObjectTektite3 - object_raw subtype=0x6a, x=0xe8, y=0x88, unknown=0x4f, paramA=0x21, paramC=script_CutsceneMiscObjectTektite4 + object_raw subtype=0x6a, x=0xf8, y=0x38, pool=0x4f, paramA=0x20, paramC=script_CutsceneMiscObjectTektite1 + object_raw subtype=0x6a, x=0x168, y=0x48, pool=0x4f, paramA=0x20, paramC=script_CutsceneMiscObjectTektite2 + object_raw subtype=0x6a, x=0x138, y=0x68, pool=0x4f, paramA=0x21, paramC=script_CutsceneMiscObjectTektite3 + object_raw subtype=0x6a, x=0xe8, y=0x88, pool=0x4f, paramA=0x21, paramC=script_CutsceneMiscObjectTektite4 entity_list_end Enemies_MtCrenel_MountainTop:: @ 080FADA8 @@ -22187,7 +22187,7 @@ Entities_MtCrenel_WallClimb_0:: @ 080FAE9C Enemies_MtCrenel_WallClimb:: @ 080FAEBC enemy_raw subtype=0x35, x=0x58, y=0xa8, paramA=0x1 enemy_raw subtype=0x35, x=0x78, y=0xa8, paramA=0x1 - manager subtype=0x28, unknown=0x3, paramB=0x2 + manager subtype=0x28, pool=0x3, paramB=0x2 enemy_raw subtype=0x21, x=0x28, y=0x8, paramB=0x4a2e0000 enemy_raw subtype=0x21, x=0xa8, y=0x8, paramA=0x1, paramB=0x4a2e0000 enemy_raw subtype=0x21, x=0x148, y=0x8, paramB=0x4a2e0000 @@ -22225,18 +22225,18 @@ Entities_MtCrenel_CaveOfFlamesEntrance_0:: @ 080FAFD4 entity_list_end gUnk_080FAFE4:: @ 080FAFE4 - object_raw subtype=0x69, unknown=0x4f, paramC=script_EzloTalkCoF + object_raw subtype=0x69, pool=0x4f, paramC=script_EzloTalkCoF entity_list_end gUnk_080FB004:: @ 080FB004 - object_raw subtype=0xbb, x=0x98, y=0xf8, unknown=0x4f, paramC=script_Windcrest + object_raw subtype=0xbb, x=0x98, y=0xf8, pool=0x4f, paramC=script_Windcrest entity_list_end Entities_MtCrenel_CaveOfFlamesEntrance_1:: @ 080FB024 - manager subtype=0x1b, unknown=0x8, paramA=0x1 + manager subtype=0x1b, pool=0x8, paramA=0x1 manager subtype=0x6, paramA=0x8 - manager subtype=0x3, x=0x38, y=0x108, unknown=0x0, paramA=0x1, paramB=0x102 - manager subtype=0x3, x=0x138, y=0x128, unknown=0x0, paramA=0x1, paramB=0x102 + manager subtype=0x3, x=0x38, y=0x108, pool=0x0, paramA=0x1, paramB=0x102 + manager subtype=0x3, x=0x138, y=0x128, pool=0x0, paramA=0x1, paramB=0x102 object_raw subtype=0x7a, x=0x48, y=0x38, collision=2 object_raw subtype=0x7a, x=0x50, y=0x30, collision=2 object_raw subtype=0x7a, x=0x58, y=0x3c, collision=2 @@ -22253,7 +22253,7 @@ Enemies_MtCrenel_CaveOfFlamesEntrance:: @ 080FB104 enemy_raw subtype=0x35, x=0x1c8, y=0x28, paramA=0x1 enemy_raw subtype=0x35, x=0x118, y=0x198, paramA=0x1 enemy_raw subtype=0x35, x=0x128, y=0x198, paramA=0x1 - manager subtype=0x28, unknown=0x3, paramB=0x2 + manager subtype=0x28, pool=0x3, paramB=0x2 enemy_raw subtype=0x3, x=0x158, y=0x58, paramB=0x8240000, paramC=0x300110 enemy_raw subtype=0x3, x=0x1f8, y=0x58, paramB=0x8240000, paramC=0x300110 enemy_raw subtype=0x3, x=0x1f8, y=0xe8, paramB=0x6120000, paramC=0xd001c0 @@ -22316,7 +22316,7 @@ Entities_MtCrenel_GustJarShortcut_0:: @ 080FB2A0 Enemies_MtCrenel_GustJarShortcut:: @ 080FB2E0 enemy_raw subtype=0x35, x=0x1b8, y=0xe8, paramA=0x1 enemy_raw subtype=0x35, x=0x1c8, y=0xe8, paramA=0x1 - manager subtype=0x28, unknown=0x3, paramB=0x2 + manager subtype=0x28, pool=0x3, paramB=0x2 enemy_raw subtype=0x21, x=0x38, y=0x1, paramB=0x112e0001 enemy_raw subtype=0x21, x=0x88, y=0x1, paramA=0x2, paramB=0x112e0001 enemy_raw subtype=0x26, x=0x48, y=0x78 @@ -22373,18 +22373,18 @@ Entities_MtCrenel_Entrance_0:: @ 080FB480 .ifdef EU_JP object_raw subtype=0x6b, x=0x118, y=0x28, paramB=0x4c object_raw subtype=0x6b, x=0x388, y=0x178, paramA=0x2, paramB=0x4d - projectile_raw subtype=0x14, x=0x108, y=0xb8, unknown=0xf, paramC=0x510000 - projectile_raw subtype=0x14, x=0x118, y=0xb8, unknown=0xf, paramC=0x510000 - projectile_raw subtype=0x14, x=0x128, y=0xb8, unknown=0xf, paramC=0x510000 - projectile_raw subtype=0x14, x=0x108, y=0xc8, unknown=0xf, paramC=0x510000 - projectile_raw subtype=0x14, x=0x118, y=0xc8, unknown=0xf, paramC=0x510000 - projectile_raw subtype=0x14, x=0x128, y=0xc8, unknown=0xf, paramC=0x510000 - projectile_raw subtype=0x14, x=0x108, y=0xd8, unknown=0xf, paramC=0x510000 - projectile_raw subtype=0x14, x=0x118, y=0xd8, unknown=0xf, paramC=0x510000 - projectile_raw subtype=0x14, x=0x128, y=0xd8, unknown=0xf, paramC=0x510000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x510051 - projectile_raw subtype=0x14, x=0x158, y=0x58, unknown=0xf, paramC=0x520000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x520052 + projectile_raw subtype=0x14, x=0x108, y=0xb8, pool=0xf, paramC=0x510000 + projectile_raw subtype=0x14, x=0x118, y=0xb8, pool=0xf, paramC=0x510000 + projectile_raw subtype=0x14, x=0x128, y=0xb8, pool=0xf, paramC=0x510000 + projectile_raw subtype=0x14, x=0x108, y=0xc8, pool=0xf, paramC=0x510000 + projectile_raw subtype=0x14, x=0x118, y=0xc8, pool=0xf, paramC=0x510000 + projectile_raw subtype=0x14, x=0x128, y=0xc8, pool=0xf, paramC=0x510000 + projectile_raw subtype=0x14, x=0x108, y=0xd8, pool=0xf, paramC=0x510000 + projectile_raw subtype=0x14, x=0x118, y=0xd8, pool=0xf, paramC=0x510000 + projectile_raw subtype=0x14, x=0x128, y=0xd8, pool=0xf, paramC=0x510000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x510051 + projectile_raw subtype=0x14, x=0x158, y=0x58, pool=0xf, paramC=0x520000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x520052 object_raw subtype=0x5e, x=0x178, y=0x178 object_raw subtype=0x5e, x=0x128, y=0x160 object_raw subtype=0x0, x=0x318, y=0x164, collision=1, paramA=0x56, paramB=0x400, paramC=0x490000 @@ -22395,18 +22395,18 @@ Entities_MtCrenel_Entrance_0:: @ 080FB480 .else object_raw subtype=0x6b, x=0x118, y=0x28, paramB=0x4e object_raw subtype=0x6b, x=0x388, y=0x178, paramA=0x2, paramB=0x4f - projectile_raw subtype=0x14, x=0x108, y=0xb8, unknown=0xf, paramC=0x530000 - projectile_raw subtype=0x14, x=0x118, y=0xb8, unknown=0xf, paramC=0x530000 - projectile_raw subtype=0x14, x=0x128, y=0xb8, unknown=0xf, paramC=0x530000 - projectile_raw subtype=0x14, x=0x108, y=0xc8, unknown=0xf, paramC=0x530000 - projectile_raw subtype=0x14, x=0x118, y=0xc8, unknown=0xf, paramC=0x530000 - projectile_raw subtype=0x14, x=0x128, y=0xc8, unknown=0xf, paramC=0x530000 - projectile_raw subtype=0x14, x=0x108, y=0xd8, unknown=0xf, paramC=0x530000 - projectile_raw subtype=0x14, x=0x118, y=0xd8, unknown=0xf, paramC=0x530000 - projectile_raw subtype=0x14, x=0x128, y=0xd8, unknown=0xf, paramC=0x530000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x530053 - projectile_raw subtype=0x14, x=0x158, y=0x58, unknown=0xf, paramC=0x540000 - manager subtype=0x2e, unknown=0x0, paramB=0x3c00, paramC=0x540054 + projectile_raw subtype=0x14, x=0x108, y=0xb8, pool=0xf, paramC=0x530000 + projectile_raw subtype=0x14, x=0x118, y=0xb8, pool=0xf, paramC=0x530000 + projectile_raw subtype=0x14, x=0x128, y=0xb8, pool=0xf, paramC=0x530000 + projectile_raw subtype=0x14, x=0x108, y=0xc8, pool=0xf, paramC=0x530000 + projectile_raw subtype=0x14, x=0x118, y=0xc8, pool=0xf, paramC=0x530000 + projectile_raw subtype=0x14, x=0x128, y=0xc8, pool=0xf, paramC=0x530000 + projectile_raw subtype=0x14, x=0x108, y=0xd8, pool=0xf, paramC=0x530000 + projectile_raw subtype=0x14, x=0x118, y=0xd8, pool=0xf, paramC=0x530000 + projectile_raw subtype=0x14, x=0x128, y=0xd8, pool=0xf, paramC=0x530000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x530053 + projectile_raw subtype=0x14, x=0x158, y=0x58, pool=0xf, paramC=0x540000 + manager subtype=0x2e, pool=0x0, paramB=0x3c00, paramC=0x540054 object_raw subtype=0x5e, x=0x178, y=0x178 object_raw subtype=0x5e, x=0x128, y=0x160 object_raw subtype=0x0, x=0x318, y=0x164, collision=1, paramA=0x56, paramB=0x400, paramC=0x4b0000 @@ -22418,7 +22418,7 @@ Entities_MtCrenel_Entrance_0:: @ 080FB480 Entities_MtCrenel_Entrance_1:: @ 080FB5D0 manager subtype=0x6, paramA=0x8 - manager subtype=0x3, x=0x2f8, y=0xd8, unknown=0x0, paramA=0x1, paramB=0x102 + manager subtype=0x3, x=0x2f8, y=0xd8, pool=0x0, paramA=0x1, paramB=0x102 entity_list_end Enemies_MtCrenel_Entrance:: @ 080FB600 diff --git a/include/kinstone.h b/include/kinstone.h index c5b63874..18910ee3 100644 --- a/include/kinstone.h +++ b/include/kinstone.h @@ -197,7 +197,7 @@ typedef enum { WORLD_EVENT_TYPE_8, // set a tile type WORLD_EVENT_TYPE_9, // LoadRoomEntity and set some tile type WORLD_EVENT_TYPE_BEANSTALK, - WORLD_EVENT_TYPE_11, // LoadRoomEntity and set gRoomVars.field_0x8c + WORLD_EVENT_TYPE_11, // LoadRoomEntity and set gRoomVars.entityRails WORLD_EVENT_TYPE_12, WORLD_EVENT_TYPE_13, WORLD_EVENT_TYPE_14, diff --git a/include/room.h b/include/room.h index a23dff14..3b0ff0d2 100644 --- a/include/room.h +++ b/include/room.h @@ -60,29 +60,26 @@ typedef struct { extern RoomControls gRoomControls; typedef struct { - /* 0x00 */ u8 field_0x0; - /* 0x01 */ u8 filler_0x1; + /* 0x00 */ bool8 didEnterScrolling; + /* 0x01 */ bool8 destructableManagerLoaded; /* 0x02 */ bool8 randomDropsDisabled; - /* 0x03 */ u8 field_0x3; - /* 0x04 */ u8 field_0x4; - /* 0x05 */ u8 filler1[1]; + /* 0x03 */ bool8 remFlagUnused; + /* 0x04 */ u8 numKinstoneDrops; + /* 0x05 */ u8 numKinstoneDropsPrevFrame; /* 0x06 */ u8 shopItemType; /* 0x07 */ u8 shopItemType2; - /* 0x08 */ u8 field_0x8; + /* 0x08 */ u8 unused; /* 0x09 */ u8 fight_bgm; - /* 0x0a */ u8 unk2; - /* 0x0b */ u8 filler2; + /* 0x0a */ u8 needHealthDrop; /* 0x0c */ s16 lightLevel; - /* 0x0e */ u16 unk_0e; - /* 0x10 */ u8 unk_10[4]; - /* 0x14 */ u32 flags; - /* 0x18 */ u32 unk3; - /* 0x1c */ u8 filler4[44]; + /* 0x0e */ u16 tileEntityCount; + /* 0x10 */ u8 graphicsGroups[4]; + /* 0x14 */ u8 flags[52]; /* 0x48 */ Droptable currentAreaDroptable; /* 0x68 */ u32 animFlags; - /* 0x6c */ void* field_0x6c[8]; - /* 0x8c */ void* field_0x8c[8]; - /* 0xac */ Entity* entities[8]; + /* 0x6c */ void* properties[8]; + /* 0x8c */ void* entityRails[8]; + /* 0xac */ Entity* puzzleEntities[8]; } RoomVars; static_assert(sizeof(RoomVars) == 0xCC); extern RoomVars gRoomVars; diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index a115acc1..333286ff 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -27,7 +27,7 @@ extern u8 gUpdateVisibleTiles; extern u16 gMapDataTopSpecial[]; extern u16 gMapDataBottomSpecial[]; extern const u8 gGlobalGfxAndPalettes[]; -extern const u8 gUnk_081091E4[]; +extern const u8 gEntityListLUT[]; typedef struct { u16 tileType; @@ -1083,7 +1083,7 @@ u32 sub_0801AC68(u32 position, u32 data) { u32 end; ptr = gUnk_0200B240; - end = gRoomVars.unk_0e; + end = gRoomVars.tileEntityCount; for (index = 0; index < end; ptr++, index++) { if (position == ptr->position) { return ptr->data << 2; @@ -1149,7 +1149,7 @@ void sub_0801AD6C(const Data* param_1, u32 tilePosition) { entity->y.HALF.HI = tmpY1 + gRoomControls.origin_y; entity->collisionLayer = 0; ResolveCollisionLayer(entity); - AppendEntityToList(entity, gUnk_081091E4[entity->kind]); + AppendEntityToList(entity, gEntityListLUT[entity->kind]); } } else { manager = GetEmptyManager(); @@ -1163,7 +1163,7 @@ void sub_0801AD6C(const Data* param_1, u32 tilePosition) { *(u16*)(&manager[1].timer + 10) = tmpX2 + gRoomControls.origin_x; tmpY2 = (s16)((tilePosition & 0xfc0) >> 2) + 8; *(u16*)(&manager[1].timer + 12) = tmpY2 + gRoomControls.origin_y; - AppendEntityToList((Entity*)manager, gUnk_081091E4[manager->kind]); + AppendEntityToList((Entity*)manager, gEntityListLUT[manager->kind]); } } } @@ -1223,11 +1223,11 @@ void SetMultipleTiles(const TileData* tileData, u32 basePosition, u32 layer) { void sub_0801AF48(u32 data, u32 position, u32 layer) { u32 index; if ((data < 0x4000) && (gRoomTransition.field30 == 0)) { - index = gRoomVars.unk_0e; + index = gRoomVars.tileEntityCount; if (index < 0x100) { gUnk_0200B240[index].data = data; gUnk_0200B240[index].position = (layer << 0xc) | position; - gRoomVars.unk_0e = index + 1; + gRoomVars.tileEntityCount = index + 1; } } } @@ -1241,7 +1241,7 @@ void DeleteLoadedTileEntity(u32 position, s32 layer) { layer = layer << 12; positionLayer = position | layer; ptr = gUnk_0200B240; - count = gRoomVars.unk_0e; + count = gRoomVars.tileEntityCount; t = 0; if (t >= count) { @@ -1250,7 +1250,7 @@ void DeleteLoadedTileEntity(u32 position, s32 layer) { if (positionLayer == ptr->position) { count--; - gRoomVars.unk_0e = count; + gRoomVars.tileEntityCount = count; ptr[0] = ptr[count]; return; } @@ -1262,7 +1262,7 @@ void DeleteLoadedTileEntity(u32 position, s32 layer) { } } count--; - gRoomVars.unk_0e = count; + gRoomVars.tileEntityCount = count; ptr = gUnk_0200B240; ptr[t] = ptr[count]; } diff --git a/src/entity.c b/src/entity.c index b13d5261..42977a95 100644 --- a/src/entity.c +++ b/src/entity.c @@ -41,51 +41,54 @@ typedef struct { extern UpdateContext gUpdateContext; // List by entity kind. -const u8 gUnk_081091E4[] = { +const u8 gEntityListLUT[] = { 8, 1, 8, 4, 5, 8, 6, 7, 2, 6, }; +// TODO: wrong file, maybe an "enter.c" according to lexicographical order void sub_0805E248(void) { - s32 v0; + s32 idx; - v0 = gDiggingCaveEntranceTransition.entrance->targetTilePosition; + idx = gDiggingCaveEntranceTransition.entrance->targetTilePosition; if (gRoomControls.area == AREA_VEIL_FALLS || gRoomControls.area == AREA_VEIL_FALLS_DIG_CAVE) { - SetTileType(0x27c, v0 + TILE_POS(-1, -1), 1); - SetTileType(0x283, v0 + TILE_POS(-1, -1), 2); - SetTileType(0x27d, v0 + TILE_POS(0, -1), 1); - SetTileType(0x284, v0 + TILE_POS(0, -1), 2); - SetTileType(0x27e, v0 + TILE_POS(1, -1), 1); - SetTileType(0x285, v0 + TILE_POS(1, -1), 2); - SetTileType(0x27f, v0 + TILE_POS(-1, 0), 1); - SetTileType(0x280, v0 + TILE_POS(0, 0), 1); - SetTileType(0x282, v0 + TILE_POS(1, 0), 1); + SetTileType(0x27c, idx + TILE_POS(-1, -1), 1); + SetTileType(0x283, idx + TILE_POS(-1, -1), 2); + SetTileType(0x27d, idx + TILE_POS(0, -1), 1); + SetTileType(0x284, idx + TILE_POS(0, -1), 2); + SetTileType(0x27e, idx + TILE_POS(1, -1), 1); + SetTileType(0x285, idx + TILE_POS(1, -1), 2); + SetTileType(0x27f, idx + TILE_POS(-1, 0), 1); + SetTileType(0x280, idx + TILE_POS(0, 0), 1); + SetTileType(0x282, idx + TILE_POS(1, 0), 1); } else { - SetTileType(0x26c, v0 + TILE_POS(-1, -1), 1); - SetTileType(0x273, v0 + TILE_POS(-1, -1), 2); - SetTileType(0x26d, v0 + TILE_POS(0, -1), 1); - SetTileType(0x274, v0 + TILE_POS(0, -1), 2); - SetTileType(0x26e, v0 + TILE_POS(1, -1), 1); - SetTileType(0x275, v0 + TILE_POS(1, -1), 2); - SetTileType(0x26f, v0 + TILE_POS(-1, 0), 1); - SetTileType(0x270, v0 + TILE_POS(0, 0), 1); - SetTileType(0x272, v0 + TILE_POS(1, 0), 1); + SetTileType(0x26c, idx + TILE_POS(-1, -1), 1); + SetTileType(0x273, idx + TILE_POS(-1, -1), 2); + SetTileType(0x26d, idx + TILE_POS(0, -1), 1); + SetTileType(0x274, idx + TILE_POS(0, -1), 2); + SetTileType(0x26e, idx + TILE_POS(1, -1), 1); + SetTileType(0x275, idx + TILE_POS(1, -1), 2); + SetTileType(0x26f, idx + TILE_POS(-1, 0), 1); + SetTileType(0x270, idx + TILE_POS(0, 0), 1); + SetTileType(0x272, idx + TILE_POS(1, 0), 1); } gUpdateVisibleTiles = 0; } -const u8 gUnk_081091EE[] = { - 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, +const u8 gPrioritiesDefault[] = { + [0] = 0, [PLAYER] = 1, [2] = 0, [ENEMY] = 0, [PROJECTILE] = 0, + [5] = 0, [OBJECT] = 1, [NPC] = 1, [PLAYER_ITEM] = 1, [MANAGER] = 1, }; -const u8 gUnk_081091F8[] = { - 0, 3, 0, 3, 3, 0, 3, 3, 3, 3, +const u8 gPrioritiesKinstoneMenu[] = { + [0] = 0, [PLAYER] = 3, [2] = 0, [ENEMY] = 3, [PROJECTILE] = 3, + [5] = 0, [OBJECT] = 3, [NPC] = 3, [PLAYER_ITEM] = 3, [MANAGER] = 3, }; -void SetEntityPriorityForKind(Entity* e) { +void InitDefaultPriority(Entity* e) { u8 r3 = gRoomTransition.entity_update_type; - const u8* array = gUnk_081091F8; + const u8* array = gPrioritiesKinstoneMenu; if (r3 != 2) { - array = gUnk_081091EE; + array = gPrioritiesDefault; } SetEntityPriority(e, array[e->kind]); } @@ -215,8 +218,10 @@ void ClearEventPriority(void) { void UpdateEntities(void) { void (*f)(u32); - gRoomVars.filler1[0] = gRoomVars.field_0x4; - gRoomVars.field_0x4 = 0; + // TODO: why is this needed? Does this avoid a bug? + gRoomVars.numKinstoneDropsPrevFrame = gRoomVars.numKinstoneDrops; + gRoomVars.numKinstoneDrops = 0; + UpdatePlayerInput(); UpdatePriority(); ClearHitboxList(); @@ -508,7 +513,7 @@ void AppendEntityToList(Entity* entity, u32 listIndex) { } else { gManagerCount++; } - SetEntityPriorityForKind(entity); + InitDefaultPriority(entity); } void PrependEntityToList(Entity* entity, u32 listIndex) { diff --git a/src/game.c b/src/game.c index 84b99bc8..50ffa7fa 100644 --- a/src/game.c +++ b/src/game.c @@ -236,7 +236,7 @@ static void GameMain_ChangeRoom(void) { } CreateMiscManager(); #endif - if (!gRoomVars.field_0x0) { + if (!gRoomVars.didEnterScrolling) { RequestPriorityDuration(NULL, 1); } } @@ -355,7 +355,7 @@ static void InitializeEntities(void) { static void sub_08051D98(void) { sub_08052EA0(); - gRoomVars.field_0x0 = 1; + gRoomVars.didEnterScrolling = TRUE; // remove old entities, unless persistent RecycleEntities(); diff --git a/src/gameData.c b/src/gameData.c index 152dfbcb..581e7eff 100644 --- a/src/gameData.c +++ b/src/gameData.c @@ -495,8 +495,8 @@ extern EntityData gUnk_080FECC8[]; extern EntityData gUnk_080FEC28[]; extern const EntityData gUnk_080FED18[]; extern EntityData gUnk_080FED58[]; -// TODO need to find out what gRoomVars.field_0x8c[ptr->entity_idx] is. -extern const void* gUnk_080FED98[]; +// TODO need to find out what gRoomVars.entityRails[ptr->entity_idx] is. +extern const void* gLilypadRails[]; // gUnk_080FEDA4 // gUnk_080FEDDA // gUnk_080FEDF8 diff --git a/src/gameUtils.c b/src/gameUtils.c index d4543147..286dc173 100644 --- a/src/gameUtils.c +++ b/src/gameUtils.c @@ -571,10 +571,10 @@ RoomResInfo* GetCurrentRoomInfo(void) { void sub_08052EA0(void) { MemClear(&gRoomVars, sizeof gRoomVars); - gRoomVars.unk_10[0] = -1; - gRoomVars.unk_10[1] = gRoomVars.unk_10[0]; - gRoomVars.unk_10[2] = gRoomVars.unk_10[0]; - gRoomVars.unk_10[3] = gRoomVars.unk_10[0]; + gRoomVars.graphicsGroups[0] = -1; + gRoomVars.graphicsGroups[1] = gRoomVars.graphicsGroups[0]; + gRoomVars.graphicsGroups[2] = gRoomVars.graphicsGroups[0]; + gRoomVars.graphicsGroups[3] = gRoomVars.graphicsGroups[0]; gRoomVars.lightLevel = 256; gArea.locationIndex = gAreaMetadata[gRoomControls.area].location; UpdateRoomTracker(); @@ -601,7 +601,7 @@ void UpdateFakeScroll(void) { LinkedList* ll; Entity* e; - if (gArea.unk_0c_0 == 0 || !gRoomVars.field_0x0) + if (gArea.unk_0c_0 == 0 || !gRoomVars.didEnterScrolling) return; y = 0; @@ -727,7 +727,7 @@ void CheckAreaDiscovery(void) { e->kind = MANAGER; e->id = ENTER_ROOM_TEXTBOX_MANAGER; AppendEntityToList(e, 8); - if (!gRoomVars.field_0x0 && !ReadBit(gSave.areaVisitFlags, gArea.locationIndex)) { + if (!gRoomVars.didEnterScrolling && !ReadBit(gSave.areaVisitFlags, gArea.locationIndex)) { e->type2 = 1; SetPlayerControl(3); SetInitializationPriority(); diff --git a/src/interrupts.c b/src/interrupts.c index 44b59a73..b3ccc507 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -230,7 +230,7 @@ void PlayerUpdate(Entity* this) { // Responsible for some life things like low health beep and initiating the death sequence static void HandlePlayerLife(Entity* this) { - u32 temp; + u32 threshold; gUnk_0200AF00.rActionPlayerState = R_ACTION_NONE; gUnk_0200AF00.rActionInteractTile = R_ACTION_NONE; @@ -263,26 +263,27 @@ static void HandlePlayerLife(Entity* this) { #ifdef EU if ((gUnk_0200AF00.unk_1 == 0) && gRoomTransition.frameCount % 90 == 0) { - temp = gSave.stats.maxHealth / 4; - if (temp > 24) - temp = 24; - if (temp < 8) - temp = 8; + threshold = gSave.stats.maxHealth / 4; + if (threshold > 24) + threshold = 24; + if (threshold < 8) + threshold = 8; - if (gSave.stats.health <= temp) { + if (gSave.stats.health <= threshold) { EnqueueSFX(SFX_LOW_HEALTH); } } #else - gRoomVars.unk2 = gMessage.state & MESSAGE_ACTIVE; - temp = gSave.stats.maxHealth / 4; - if (temp > 24) - temp = 24; - if (temp < 8) - temp = 8; + // TODO: why does message state affect health drops in US/JP? + gRoomVars.needHealthDrop = gMessage.state & MESSAGE_ACTIVE; + threshold = gSave.stats.maxHealth / 4; + if (threshold > 24) + threshold = 24; + if (threshold < 8) + threshold = 8; - if (gSave.stats.health <= temp) { - gRoomVars.unk2 = 1; + if (gSave.stats.health <= threshold) { + gRoomVars.needHealthDrop = TRUE; if ((gUnk_0200AF00.unk_1 == 0) && gRoomTransition.frameCount % 90 == 0) { EnqueueSFX(SFX_LOW_HEALTH); } diff --git a/src/itemUtils.c b/src/itemUtils.c index 832c68ce..d265e938 100644 --- a/src/itemUtils.c +++ b/src/itemUtils.c @@ -428,7 +428,7 @@ u32 CreateRandomItemDrop(Entity* arg0, u32 arg1) { #ifndef EU case 24: case 25: - r0 = gRoomVars.unk2; + r0 = gRoomVars.needHealthDrop; ptr4 = &gUnk_0800191C[0]; if (r0) { ptr4++; @@ -545,7 +545,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) { if (GetInventoryValue(ITEM_KINSTONE_BAG) == 0) { return ITEM_NONE; } - if (3 < gRoomVars.filler1[0]) { + if (3 < gRoomVars.numKinstoneDropsPrevFrame) { return ITEM_NONE; } diff --git a/src/kinstone.c b/src/kinstone.c index 71a93a7b..08d10e67 100644 --- a/src/kinstone.c +++ b/src/kinstone.c @@ -22,7 +22,7 @@ extern const EntityData gUnk_080FEE38[]; extern const EntityData gUnk_080FEE18[]; extern const EntityData gUnk_080FEE48[]; extern const EntityData gUnk_080FEE58[]; -extern const void* gUnk_080FED98[]; +extern const void* gLilypadRails[]; void sub_08018AB4(int); void sub_08018BB4(u32 worldEventId); @@ -339,8 +339,9 @@ void sub_0801876C(u32 worldEventId, bool32 isKinstoneFused) { break; case WORLD_EVENT_TYPE_11: if (isKinstoneFused != 0) { + // lilypad rails LoadRoomEntity(&gUnk_080FED58[ptr->entity_idx]); - gRoomVars.field_0x8c[ptr->entity_idx] = (void*)gUnk_080FED98[ptr->entity_idx]; + gRoomVars.entityRails[ptr->entity_idx] = (void*)gLilypadRails[ptr->entity_idx]; } break; case WORLD_EVENT_TYPE_9: diff --git a/src/manager/horizontalMinishPathBackgroundManager.c b/src/manager/horizontalMinishPathBackgroundManager.c index f2a8b1fb..a407e50e 100644 --- a/src/manager/horizontalMinishPathBackgroundManager.c +++ b/src/manager/horizontalMinishPathBackgroundManager.c @@ -29,7 +29,7 @@ void HorizontalMinishPathBackgroundManager_Main(HorizontalMinishPathBackgroundMa } void sub_08057EFC(void* this) { - LoadGfxGroup((u32)gRoomVars.unk_10[0]); + LoadGfxGroup((u32)gRoomVars.graphicsGroups[0]); sub_08058034(); ((HorizontalMinishPathBackgroundManager*)this)->unk_3c = 0; ((HorizontalMinishPathBackgroundManager*)this)->unk_38 = 0; @@ -103,7 +103,7 @@ void sub_080580B0(u32 unk1) { gMapTop.bgSettings = 0; REG_DISPCNT = 0; LoadGfxGroup(unk1); - gRoomVars.unk_10[0] = unk1; + gRoomVars.graphicsGroups[0] = unk1; sub_08058034(); tmp = gRoomControls.scroll_x - gRoomControls.origin_x; tmp = tmp + (tmp >> 3) + (0x400 - gRoomControls.width) / 2; diff --git a/src/manager/hyruleTownTilesetManager.c b/src/manager/hyruleTownTilesetManager.c index 9797a0c2..b3ce85a5 100644 --- a/src/manager/hyruleTownTilesetManager.c +++ b/src/manager/hyruleTownTilesetManager.c @@ -72,9 +72,9 @@ void HyruleTownTilesetManager_Main(HyruleTownTilesetManager* this) { } void sub_08059A2C(HyruleTownTilesetManager* this) { - gRoomVars.unk_10[2] = 0xff; - gRoomVars.unk_10[1] = 0xff; - gRoomVars.unk_10[0] = 0xff; + gRoomVars.graphicsGroups[2] = 0xff; + gRoomVars.graphicsGroups[1] = 0xff; + gRoomVars.graphicsGroups[0] = 0xff; this->field_0x22 = 0xff; this->field_0x21 = 0xff; this->field_0x20 = 0xff; @@ -147,8 +147,8 @@ bool32 sub_08059C8C(HyruleTownTilesetManager* this, u32 param_2, u8* param_3, co bool32 bVar2; *param_3 = CheckRegionsOnScreen(param_4); - if ((*param_3 != 0xff) && (gRoomVars.unk_10[param_2] != *param_3)) { - gRoomVars.unk_10[param_2] = *param_3; + if ((*param_3 != 0xff) && (gRoomVars.graphicsGroups[param_2] != *param_3)) { + gRoomVars.graphicsGroups[param_2] = *param_3; return TRUE; } else { return FALSE; @@ -158,7 +158,7 @@ bool32 sub_08059C8C(HyruleTownTilesetManager* this, u32 param_2, u8* param_3, co void sub_08059CC0(u32 param_1, u32 param_2) { const Unknown* unknown; - gRoomVars.unk_10[param_1] = param_2; + gRoomVars.graphicsGroups[param_1] = param_2; if (gRoomControls.area != AREA_FESTIVAL_TOWN) { unknown = &gUnk_08108408[param_2]; } else { diff --git a/src/manager/minishVillageTilesetManager.c b/src/manager/minishVillageTilesetManager.c index 225ba477..055e78b0 100644 --- a/src/manager/minishVillageTilesetManager.c +++ b/src/manager/minishVillageTilesetManager.c @@ -69,7 +69,7 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) { return; if (sub_08057E40(this)) { - tmp = (u32)gRoomVars.unk_10[0]; + tmp = (u32)gRoomVars.graphicsGroups[0]; if (this->unk_20 != tmp) { this->unk_20 = tmp; super->timer = 0; @@ -115,7 +115,7 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) { RegisterTransitionManager(this, sub_08057E30, 0); } if (sub_08057E40(this)) { - tmp = (u32)gRoomVars.unk_10[0]; + tmp = (u32)gRoomVars.graphicsGroups[0]; if (this->unk_20 != tmp) { this->unk_20 = tmp; super->timer = 0; @@ -153,13 +153,13 @@ void MinishVillageTilesetManager_Main(MinishVillageTilesetManager* this) { #endif void sub_08057E30(void* this) { - sub_08057E7C(gRoomVars.unk_10[0]); + sub_08057E7C(gRoomVars.graphicsGroups[0]); } bool32 sub_08057E40(MinishVillageTilesetManager* this) { u32 tmp = CheckRegionsOnScreen(gUnk_08108050); if (tmp != 0xFF) { - gRoomVars.unk_10[0] = tmp; + gRoomVars.graphicsGroups[0] = tmp; return TRUE; } else { return FALSE; @@ -187,5 +187,5 @@ void sub_08057E7C(u32 unk1) { for (tmp = 0; tmp < 8; tmp++, tmp2 += 2) { DmaCopy32(3, &gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x400 * 4); } - gRoomVars.unk_10[0] = unk1; + gRoomVars.graphicsGroups[0] = unk1; } diff --git a/src/manager/miscManager.c b/src/manager/miscManager.c index 2fe982bb..a9c3de2b 100644 --- a/src/manager/miscManager.c +++ b/src/manager/miscManager.c @@ -392,7 +392,7 @@ void MiscManager_TypeD(MiscManager* this) { SetPlayerControl(3); if (gRoomControls.reload_flags) return; - if (gRoomVars.field_0x0) { + if (gRoomVars.didEnterScrolling) { StartPlayerScript(gUnk_08108380[gRoomControls.scroll_direction]); } else { StartPlayerScript(gUnk_08108380[gPlayerEntity.animationState >> 1]); diff --git a/src/manager/verticalMinishPathBackgroundManager.c b/src/manager/verticalMinishPathBackgroundManager.c index d2978bb7..e67cde8d 100644 --- a/src/manager/verticalMinishPathBackgroundManager.c +++ b/src/manager/verticalMinishPathBackgroundManager.c @@ -51,7 +51,7 @@ void sub_080575C8(u32 param) { gMapTop.bgSettings = 0; REG_DISPCNT = 0; LoadGfxGroup(param); - gRoomVars.unk_10[0] = param; + gRoomVars.graphicsGroups[0] = param; bgOffset = (gRoomControls.scroll_y - gRoomControls.origin_y); bgOffset += bgOffset >> 3; @@ -80,7 +80,7 @@ void sub_08057688(void) { } void sub_080576A0(void* this) { - LoadGfxGroup(gRoomVars.unk_10[0]); + LoadGfxGroup(gRoomVars.graphicsGroups[0]); ((VerticalMinishPathBackgroundManager*)this)->field_0x38 = NULL; ((VerticalMinishPathBackgroundManager*)this)->field_0x3c = NULL; sub_0805754C((VerticalMinishPathBackgroundManager*)this); diff --git a/src/manager/weatherChangeManager.c b/src/manager/weatherChangeManager.c index f1988de4..be8bcdb6 100644 --- a/src/manager/weatherChangeManager.c +++ b/src/manager/weatherChangeManager.c @@ -46,7 +46,7 @@ void WeatherChangeManager_Main(WeatherChangeManager* this) { this->unk_20 = 0x1F; this->unk_22 = 5; } - gRoomVars.unk_10[0] = 0xFF; + gRoomVars.graphicsGroups[0] = 0xFF; RegisterTransitionManager(this, sub_080595E4, 0); } sub_08059608(this); @@ -55,7 +55,7 @@ void WeatherChangeManager_Main(WeatherChangeManager* this) { } void sub_080595E4(WeatherChangeManager* this) { - gRoomVars.unk_10[0] = 0xFF; + gRoomVars.graphicsGroups[0] = 0xFF; sub_08059690(this); sub_080596E0(this); LoadStaticBackground(0); @@ -134,8 +134,8 @@ void sub_080596E0(WeatherChangeManager* this) { } break; } - if (gRoomVars.unk_10[0] != this->unk_22) { - gRoomVars.unk_10[0] = this->unk_22; + if (gRoomVars.graphicsGroups[0] != this->unk_22) { + gRoomVars.graphicsGroups[0] = this->unk_22; switch (this->unk_22) { case 0 ... 3: LoadGfxGroup(this->unk_22 + 0x2B); diff --git a/src/npc/rem.c b/src/npc/rem.c index 45d66679..01b3717b 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -435,18 +435,18 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) { MessageNoOverlap(messageIndex, this); switch (context->intVariable) { case 0: - gRoomVars.entities[0] = this; + gRoomVars.puzzleEntities[0] = this; PrependEntityToList(this, NPC); this->zVelocity = Q_16_16(1.5); break; case 1: - pEnt = FindNextDuplicateID(gRoomVars.entities[0], NPC); - gRoomVars.entities[1] = pEnt; + pEnt = FindNextDuplicateID(gRoomVars.puzzleEntities[0], NPC); + gRoomVars.puzzleEntities[1] = pEnt; pEnt->zVelocity = Q_16_16(1.5); break; case 2: - pEnt = FindNextDuplicateID(gRoomVars.entities[1], NPC); - gRoomVars.entities[2] = pEnt; + pEnt = FindNextDuplicateID(gRoomVars.puzzleEntities[1], NPC); + gRoomVars.puzzleEntities[2] = pEnt; pEnt->zVelocity = Q_16_16(1.5); break; } @@ -457,7 +457,7 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) { context->unk_18 = 1; break; case 1: - pEnt = gRoomVars.entities[context->intVariable]; + pEnt = gRoomVars.puzzleEntities[context->intVariable]; if (pEnt->z.HALF.HI < 0) { break; } @@ -475,7 +475,7 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) { } void sub_0806AB74(Entity* this) { - gRoomVars.field_0x3 = 1; + gRoomVars.remFlagUnused = TRUE; if ((s32)(this->y.HALF.HI - (u32)gRoomControls.origin_y) < 0xa8) { this->y.HALF.HI = gRoomControls.origin_y + 0xa8; } diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index 8aff156f..5c46e2dd 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -96,7 +96,7 @@ void ItemOnGround(ItemOnGroundEntity* this) { } if (super->type == 0x5C) { - gRoomVars.field_0x4++; + gRoomVars.numKinstoneDrops++; } sub_08080CB4(super); diff --git a/src/object/pressurePlate.c b/src/object/pressurePlate.c index a10818eb..ebb5d3a2 100644 --- a/src/object/pressurePlate.c +++ b/src/object/pressurePlate.c @@ -105,7 +105,7 @@ static u32 sub_08088938(PressurePlateEntity* this) { x = super->x.HALF.HI - 8; y = super->y.HALF.HI - 8; for (i = 0; i < 8; ++i) { - Entity* e = gRoomVars.entities[i]; + Entity* e = gRoomVars.puzzleEntities[i]; if (e != NULL) { if ((u16)(e->x.HALF.HI - x) < 0x11 && ((u16)(e->y.HALF_U.HI - y) < 0x11)) { e->spriteOffsetY = sSpriteOffsets[this->dir]; diff --git a/src/object/pushableStatue.c b/src/object/pushableStatue.c index ed3de97f..c5c57579 100644 --- a/src/object/pushableStatue.c +++ b/src/object/pushableStatue.c @@ -173,8 +173,8 @@ void sub_08089454(PushableStatueEntity* this) { void sub_080894C8(PushableStatueEntity* this) { u32 index; for (index = 0; index < 8; index++) { - if (gRoomVars.entities[index] == NULL) { - gRoomVars.entities[index] = super; + if (gRoomVars.puzzleEntities[index] == NULL) { + gRoomVars.puzzleEntities[index] = super; break; } } @@ -183,8 +183,8 @@ void sub_080894C8(PushableStatueEntity* this) { void sub_080894FC(PushableStatueEntity* this) { u32 index; for (index = 0; index <= 7; index++) { - if (super == gRoomVars.entities[index]) { - gRoomVars.entities[index] = NULL; + if (super == gRoomVars.puzzleEntities[index]) { + gRoomVars.puzzleEntities[index] = NULL; break; } } diff --git a/src/player.c b/src/player.c index bb2b14f9..c50cfcf2 100644 --- a/src/player.c +++ b/src/player.c @@ -1987,7 +1987,7 @@ static void sub_080724DC(Entity* this) { } else { this->spriteSettings.draw = 3; this->subAction = 1; - if (gRoomVars.field_0x0 == 0) { + if (!gRoomVars.didEnterScrolling) { if (gPlayerState.flags & PL_MINISH) { gPlayerState.animation = ANIM_BOUNCE_MINISH; } else { diff --git a/src/playerUtils.c b/src/playerUtils.c index 9ab584e5..412d7142 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -23,7 +23,7 @@ static void sub_08077E54(ItemBehavior* beh); extern void sub_0800857C(Entity*); -extern void SetEntityPriorityForKind(Entity*); +extern void InitDefaultPriority(Entity*); extern void sub_0809D738(Entity*); extern s32 Mod(s32, s32); extern u32 sub_08003FDE(Entity*, Entity*, u32, u32); @@ -1853,7 +1853,7 @@ void PlayerSetNormalAndCollide(void) { PL_MOLDWORM_RELEASED | PL_PARACHUTE); ResolvePlayerAnimation(); SetPlayerActionNormal(); - SetEntityPriorityForKind(&gPlayerEntity); + InitDefaultPriority(&gPlayerEntity); } void PlayerMinishSetNormalAndCollide(void) { @@ -1869,7 +1869,7 @@ void PlayerMinishSetNormalAndCollide(void) { ~(PL_BUSY | PL_DROWNING | PL_DISABLE_ITEMS | PL_IN_HOLE | PL_MOLDWORM_RELEASED | PL_PARACHUTE); gPlayerState.swim_state = 0; gPlayerState.queued_action = PLAYER_INIT; - SetEntityPriorityForKind(&gPlayerEntity); + InitDefaultPriority(&gPlayerEntity); } void sub_080792BC(s32 speed, u32 direction, u32 field_0x38) { diff --git a/src/room.c b/src/room.c index 57cfab46..a7a82b6b 100644 --- a/src/room.c +++ b/src/room.c @@ -14,7 +14,7 @@ extern u32 sub_08049D1C(u32); extern void** gCurrentRoomProperties; extern void*** gAreaTable[]; -extern u8 gUnk_081091E4[]; +extern u8 gEntityListLUT[]; extern void sub_080186EC(void); extern void sub_0804B16C(void); @@ -102,7 +102,7 @@ void RegisterRoomEntity(Entity* ent, const EntityData* dat) { kind = dat->kind & 0xF; if (ent->prev == NULL) { if (list == 0xF) { - AppendEntityToList(ent, gUnk_081091E4[kind]); + AppendEntityToList(ent, gEntityListLUT[kind]); } else if (list == 8) { AppendEntityToList(ent, 8); } else { @@ -122,6 +122,8 @@ void sub_0804AF0C(Entity* ent, const EntityData* dat) { ent->y.HALF.HI = dat->yPos + gRoomControls.origin_y; break; case 0x20: + // TODO: for enemies, I think this is for delayed spawn + // see mulldozerSpawnPoint.c ent->field_0x6c.HALF.HI |= 0x20; ent->x.HALF.HI = dat->xPos + gRoomControls.origin_x; ent->y.HALF.HI = dat->yPos + gRoomControls.origin_y; @@ -145,7 +147,7 @@ void sub_0804AFB0(void** properties) { gCurrentRoomProperties = properties; for (i = 0; i < 8; ++i) { - gRoomVars.field_0x6c[i] = gCurrentRoomProperties[i]; + gRoomVars.properties[i] = gCurrentRoomProperties[i]; } } @@ -247,9 +249,9 @@ void* GetCurrentRoomProperty(u32 idx) { return NULL; if (idx >= 0x80) { - return gRoomVars.field_0x8c[idx & 7]; + return gRoomVars.entityRails[idx & 7]; } else if (idx <= 7) { - return gRoomVars.field_0x6c[idx]; + return gRoomVars.properties[idx]; } else { return gCurrentRoomProperties[idx]; } @@ -353,9 +355,9 @@ static void LoadDarknessTile(TileEntity* tile) { static void LoadDestructibleTile(TileEntity* tile) { if (CheckLocalFlag(*(u16*)&tile->_2)) { SetTileType(*(u16*)&tile->_6, tile->tilePos, tile->localFlag); - } else if (!gRoomVars.filler_0x1) { + } else if (!gRoomVars.destructableManagerLoaded) { Manager* mgr; - gRoomVars.filler_0x1 = 1; + gRoomVars.destructableManagerLoaded = TRUE; mgr = GetEmptyManager(); if (mgr != NULL) { mgr->kind = MANAGER; diff --git a/src/roomInit.c b/src/roomInit.c index bbe55eae..8d1d4897 100644 --- a/src/roomInit.c +++ b/src/roomInit.c @@ -399,7 +399,7 @@ u32 sub_unk3_HouseInteriors1_InnWestRoom(void) { index = 0; SetLocalFlag(BILL05_YADO1F_MATSU_T0); } - gRoomVars.field_0x6c[3] = gUnk_080D6A74[index]; + gRoomVars.properties[3] = gUnk_080D6A74[index]; return 1; } @@ -427,7 +427,7 @@ u32 sub_unk3_HouseInteriors1_InnMiddleRoom(void) { index = 0; SetLocalFlag(BILL06_YADO1F_TAKE_T0); } - gRoomVars.field_0x6c[3] = gUnk_080D6B18[index]; + gRoomVars.properties[3] = gUnk_080D6B18[index]; return 1; } @@ -453,7 +453,7 @@ u32 sub_unk3_HouseInteriors1_InnEastRoom(void) { index = 0; SetLocalFlag(BILL07_YADO1F_UME_T0); } - gRoomVars.field_0x6c[3] = gUnk_080D6BB8[index]; + gRoomVars.properties[3] = gUnk_080D6BB8[index]; return 1; } @@ -533,7 +533,7 @@ void sub_StateChange_HouseInteriors1_SchoolWest(void) { if (gSave.global_progress < 8) { LoadRoomEntityList(&gUnk_080D7038); } - if (gRoomVars.field_0x0 == 0) { + if (!gRoomVars.didEnterScrolling) { SetWorldMapPos(2, 0, 0x2c8, 0xa8); } } @@ -566,8 +566,8 @@ extern u32 gUnk_080D7348; u32 sub_unk3_HyruleCastle_0(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c[0] = &gUnk_080D7348; - gRoomVars.field_0x6c[2] = 0; + gRoomVars.properties[0] = &gUnk_080D7348; + gRoomVars.properties[2] = 0; } return 1; } @@ -600,8 +600,8 @@ extern u32 gUnk_080D7410; u32 sub_unk3_HyruleCastle_1(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c[0] = &gUnk_080D7410; - gRoomVars.field_0x6c[2] = 0; + gRoomVars.properties[0] = &gUnk_080D7410; + gRoomVars.properties[2] = 0; } return 1; } @@ -1077,7 +1077,7 @@ extern TileEntity gUnk_080D9328[]; static void sub_0804C128(void) { sub_080AF250(0); - if (gRoomVars.field_0x0 != 0) { + if (gRoomVars.didEnterScrolling) { if ((gArea.unk_0c_1) == 0) { if ((gArea.unk_0c_4) == 0) { gArea.unk_0c_1 = 1; @@ -1271,7 +1271,7 @@ extern u32 gUnk_080DA230; u32 sub_unk3_CastorDarknut_Main(void) { if (!CheckLocalFlag(LV4_0a_TSUBO)) - gRoomVars.field_0x6c[0] = &gUnk_080DA230; + gRoomVars.properties[0] = &gUnk_080DA230; return 1; } @@ -1633,7 +1633,7 @@ extern u32 gUnk_080DB910; u32 sub_unk3_TownMinishHoles_LibraryBookshelf(void) { if (CheckGlobalFlag(MIZUKAKI_START) && !CheckLocalFlag(MIZUKAKI_BOOK_ALLBACK)) { - gRoomVars.field_0x6c[1] = &gUnk_080DB910; + gRoomVars.properties[1] = &gUnk_080DB910; } return 1; } @@ -2456,7 +2456,7 @@ extern u32 gUnk_080E103C; u32 sub_unk3_CaveOfFlames_BeforeGleerok(void) { if (CheckGlobalFlag(LV2_CLEAR)) { - gRoomVars.field_0x6c[1] = &gUnk_080E103C; + gRoomVars.properties[1] = &gUnk_080E103C; } return 1; } @@ -3758,16 +3758,16 @@ extern u32 gUnk_080EB5D4; u32 sub_unk3_DarkHyruleCastle_1FEntrance(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c[0] = &gUnk_080EB604; - gRoomVars.field_0x6c[2] = 0; + gRoomVars.properties[0] = &gUnk_080EB604; + gRoomVars.properties[2] = 0; gArea.bgm = gArea.queued_bgm = BGM_BEAT_VAATI; } else if (CheckLocalFlag(0x79)) { - gRoomVars.field_0x6c[0] = NULL; + gRoomVars.properties[0] = NULL; if (!CheckLocalFlag(0x7a)) { SetGlobalFlag(ZELDA_CHASE); - gRoomVars.field_0x6c[0] = &gUnk_080EB5D4; - gRoomVars.field_0x6c[7] = sub_0804D9B0; - gRoomVars.field_0x6c[2] = 0; + gRoomVars.properties[0] = &gUnk_080EB5D4; + gRoomVars.properties[7] = sub_0804D9B0; + gRoomVars.properties[2] = 0; } } return 1; @@ -3830,8 +3830,8 @@ void sub_StateChange_Dojos_ToSplitblade1(void) { u32 sub_unk3_DarkHyruleCastle_3FTripleDarknut(void) { if (!CheckLocalFlag(0x77)) { - gRoomVars.field_0x6c[0] = 0; - gRoomVars.field_0x6c[2] = 0; + gRoomVars.properties[0] = 0; + gRoomVars.properties[2] = 0; } return 1; } @@ -4023,7 +4023,7 @@ void sub_StateChange_Dojos_ToGreatblade8(void) { u32 sub_unk3_DarkHyruleCastle_B1Entrance(void) { if (CheckLocalFlag(0x79)) { - gRoomVars.field_0x6c[2] = 0; + gRoomVars.properties[2] = 0; } return 1; } @@ -4056,8 +4056,8 @@ extern u32 gUnk_080ED1E4; u32 sub_unk3_DarkHyruleCastle_1FThroneRoom(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c[0] = &gUnk_080ED1E4; - gRoomVars.field_0x6c[2] = 0; + gRoomVars.properties[0] = &gUnk_080ED1E4; + gRoomVars.properties[2] = 0; } return 1; } @@ -4217,8 +4217,8 @@ void sub_StateChange_Ruins_Beanstalk1(void) { u32 sub_unk3_DarkHyruleCastle_B1Left(void) { if (CheckLocalFlag(0x79)) { - gRoomVars.field_0x6c[2] = 0; - gRoomVars.field_0x6c[0] = 0; + gRoomVars.properties[2] = 0; + gRoomVars.properties[0] = 0; } return 1; } @@ -4242,7 +4242,7 @@ void sub_StateChange_Ruins_Beanstalk2(void) { u32 sub_unk3_DarkHyruleCastle_B1Map(void) { if (CheckLocalFlag(0x79)) { - gRoomVars.field_0x6c[2] = 0; + gRoomVars.properties[2] = 0; } return 1; } @@ -4564,7 +4564,7 @@ extern u32 gUnk_080F09A0; u32 sub_unk3_CastleGarden_Main(void) { if (GetInventoryValue(ITEM_FOURSWORD)) { - gRoomVars.field_0x6c[1] = &gUnk_080F09A0; + gRoomVars.properties[1] = &gUnk_080F09A0; } return 1; } @@ -5022,9 +5022,9 @@ extern u32 gUnk_080F3EA4; u32 sub_unk3_LakeHylia_Main(void) { if (CheckGlobalFlag(LV4_CLEAR) && !CheckLocalFlag(4)) { - gRoomVars.field_0x6c[2] = &gUnk_080F3EA4; + gRoomVars.properties[2] = &gUnk_080F3EA4; } else { - gRoomVars.field_0x6c[2] = &Enemies_LakeHylia_Main; + gRoomVars.properties[2] = &Enemies_LakeHylia_Main; } return 1; } @@ -5177,8 +5177,8 @@ extern u32 gUnk_080F4EB0; u32 sub_unk3_MinishWoods_Main(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c[0] = &gUnk_080F4EB0; - gRoomVars.field_0x6c[2] = NULL; + gRoomVars.properties[0] = &gUnk_080F4EB0; + gRoomVars.properties[2] = NULL; } return 1; } @@ -5234,9 +5234,9 @@ extern u32 gUnk_080F5348; u32 sub_unk3_SanctuaryEntrance_Main(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c[0] = &gUnk_080F5348; - gRoomVars.field_0x6c[7] = sub_0804ED18; - gRoomVars.field_0x6c[2] = NULL; + gRoomVars.properties[0] = &gUnk_080F5348; + gRoomVars.properties[7] = sub_0804ED18; + gRoomVars.properties[2] = NULL; } return 1; } @@ -5687,7 +5687,7 @@ extern u32 gUnk_080F7680; u32 sub_unk3_HyruleField_EasternHillsNorth(void) { if (GetInventoryValue(ITEM_GUST_JAR) && !GetInventoryValue(ITEM_PACCI_CANE)) { - gRoomVars.field_0x6c[2] = &gUnk_080F7680; + gRoomVars.properties[2] = &gUnk_080F7680; } return 1; } @@ -5748,13 +5748,13 @@ extern void sub_0804F4E4(void); u32 sub_unk3_HyruleField_OutsideCastle(void) { if (CheckGlobalFlag(TABIDACHI) && !GetInventoryValue(ITEM_GUST_JAR)) { - gRoomVars.field_0x6c[0] = &gUnk_080F7CD0; - gRoomVars.field_0x6c[7] = sub_0804F5E8; + gRoomVars.properties[0] = &gUnk_080F7CD0; + gRoomVars.properties[7] = sub_0804F5E8; } if (CheckGlobalFlag(LV2_CLEAR) && GetInventoryValue(ITEM_RED_SWORD) && !CheckLocalFlag(SOUGEN_06_SAIKAI)) { - gRoomVars.field_0x6c[0] = &gUnk_080F7C80; - gRoomVars.field_0x6c[7] = sub_0804F4E4; - gRoomVars.field_0x6c[2] = NULL; + gRoomVars.properties[0] = &gUnk_080F7C80; + gRoomVars.properties[7] = sub_0804F4E4; + gRoomVars.properties[2] = NULL; } #ifndef EU if (CheckGlobalFlag(TABIDACHI)) { @@ -6255,7 +6255,7 @@ extern u32 gUnk_080F9BF8; u32 sub_unk3_VeilFallsTop_Main(void) { if (!CheckKinstoneFused(KINSTONE_E)) { - gRoomVars.field_0x6c[0] = &gUnk_080F9BF8; + gRoomVars.properties[0] = &gUnk_080F9BF8; } return 1; } @@ -6541,8 +6541,8 @@ extern u32 gUnk_080FAD48; u32 sub_unk3_MtCrenel_MountainTop(void) { if (CheckGlobalFlag(ENDING)) { - gRoomVars.field_0x6c[0] = &gUnk_080FAD48; - gRoomVars.field_0x6c[2] = NULL; + gRoomVars.properties[0] = &gUnk_080FAD48; + gRoomVars.properties[2] = NULL; } return 1; } From 33473d1d5bc818d47526f6a95c470e682b1b1530 Mon Sep 17 00:00:00 2001 From: octorock <79596758+octorock@users.noreply.github.com> Date: Sat, 30 Dec 2023 18:12:05 +0100 Subject: [PATCH 11/15] Create new entity structs for enemies --- include/enemy/vaatiWrath.h | 20 + src/enemy/acroBandits.c | 18 +- src/enemy/beetle.c | 2 +- src/enemy/bombPeahat.c | 12 +- src/enemy/businessScrub.c | 1 - src/enemy/darkNut.c | 1 - src/enemy/fireballGuy.c | 7 +- src/enemy/keaton.c | 10 +- src/enemy/lakitu.c | 10 +- src/enemy/lakituCloud.c | 10 +- src/enemy/mazaalBracelet.c | 1498 +++++++++++++------------ src/enemy/mazaalHead.c | 787 ++++++------- src/enemy/mazaalMacro.c | 6 +- src/enemy/miniFireballGuy.c | 8 +- src/enemy/miniSlime.c | 7 +- src/enemy/moldorm.c | 281 ++--- src/enemy/moldworm.c | 624 +++++----- src/enemy/pesto.c | 773 ++++++------- src/enemy/puffstool.c | 515 +++++---- src/enemy/rope.c | 7 +- src/enemy/ropeGolden.c | 7 +- src/enemy/slime.c | 7 +- src/enemy/smallPesto.c | 7 +- src/enemy/spearMoblin.c | 392 +++---- src/enemy/spinyChuchu.c | 291 ++--- src/enemy/tektite.c | 250 +++-- src/enemy/tektiteGolden.c | 221 ++-- src/enemy/treeItem.c | 45 +- src/enemy/vaatiArm.c | 1107 +++++++++--------- src/enemy/vaatiBall.c | 553 ++++----- src/enemy/vaatiEyesMacro.c | 269 ++--- src/enemy/vaatiProjectile.c | 275 ++--- src/enemy/vaatiRebornEnemy.c | 852 +++++++------- src/enemy/vaatiTransfigured.c | 960 ++++++++-------- src/enemy/vaatiTransfiguredEye.c | 300 ++--- src/enemy/vaatiWrath.c | 912 +++++++-------- src/enemy/vaatiWrathEye.c | 15 +- src/enemy/wallMaster.c | 230 ++-- src/enemy/wallMaster2.c | 201 ++-- src/enemy/wisp.c | 158 +-- src/item/itemPegasusBoots.c | 2 +- src/manager/holeManager.c | 4 +- src/manager/templeOfDropletsManager.c | 4 +- src/npc/malon.c | 4 +- src/npc/zelda.c | 2 +- 45 files changed, 6013 insertions(+), 5652 deletions(-) create mode 100644 include/enemy/vaatiWrath.h diff --git a/include/enemy/vaatiWrath.h b/include/enemy/vaatiWrath.h new file mode 100644 index 00000000..83ba4bcc --- /dev/null +++ b/include/enemy/vaatiWrath.h @@ -0,0 +1,20 @@ +#ifndef VAATIWRATH_H +#define VAATIWRATH_H +#include "enemy.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[5]; + /*0x6d*/ u8 unk_6d; + /*0x6e*/ u8 unused2[10]; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; + /*0x7a*/ u8 unused3[1]; + /*0x7b*/ u8 unk_7b; + /*0x7c*/ u16 unk_7c; + /*0x7e*/ u16 unk_7e; + /*0x80*/ u8 unused4[4]; + /*0x84*/ u8 unk_84; +} VaatiWrathEntity; + +#endif // VAATIWRATH_H diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index 1f384ab2..c87277ab 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -62,8 +62,12 @@ void AcroBandit_Type1Action8(AcroBanditEntity* this); void AcroBandit_Type1Action9(AcroBanditEntity* this); static void (*const AcroBandit_Functions[])(AcroBanditEntity*) = { - AcroBandit_OnTick, AcroBandit_OnCollision, AcroBandit_OnKnockback, - (void (*)(AcroBanditEntity*))GenericDeath, (void (*)(AcroBanditEntity*))GenericConfused, AcroBandit_OnGrabbed, + AcroBandit_OnTick, + AcroBandit_OnCollision, + AcroBandit_OnKnockback, + (void (*)(AcroBanditEntity*))GenericDeath, + (void (*)(AcroBanditEntity*))GenericConfused, + AcroBandit_OnGrabbed, }; void AcroBandit(AcroBanditEntity* this) { @@ -260,35 +264,35 @@ void AcroBandit_Type0Action5(AcroBanditEntity* this) { u32 tmp = Random(); tmp &= 3; - a = (AcroBanditEntity*) CreateEnemy(ACRO_BANDIT, 1); + a = (AcroBanditEntity*)CreateEnemy(ACRO_BANDIT, 1); a->base.type2 = 0; a->base.parent = NULL; a->unk_74.HALF.LO = tmp; sub_08031E48(this, a); a->base.child = CreateEnemy(ACRO_BANDIT, 1); - b = (AcroBanditEntity*) a->base.child; + b = (AcroBanditEntity*)a->base.child; b->base.type2 = 1; b->base.parent = &a->base; b->unk_74.HALF.LO = tmp; sub_08031E48(this, b); b->base.child = CreateEnemy(ACRO_BANDIT, 1); - a = (AcroBanditEntity*) b->base.child; + a = (AcroBanditEntity*)b->base.child; a->base.type2 = 2; a->base.parent = &b->base; a->unk_74.HALF.LO = tmp; sub_08031E48(this, a); a->base.child = CreateEnemy(ACRO_BANDIT, 1); - b = (AcroBanditEntity*) a->base.child; + b = (AcroBanditEntity*)a->base.child; b->base.type2 = 3; b->base.parent = &a->base; b->unk_74.HALF.LO = tmp; sub_08031E48(this, b); b->base.child = CreateEnemy(ACRO_BANDIT, 1); - a = (AcroBanditEntity*) b->base.child; + a = (AcroBanditEntity*)b->base.child; a->base.type2 = 4; a->base.parent = &b->base; a->base.child = NULL; diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index c567978f..8541a580 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -113,7 +113,7 @@ void sub_080218CC(BeetleEntity* this) { super->subAction = 1; super->spriteSettings.draw = 1; super->direction = ((sub_08049F84(super, 1) ^ 0x10) + gUnk_080CB5DC[Random() & 7]) & - (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); super->speed = 0x100; super->zVelocity = Q_16_16(1.125); } diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 0aebfaec..3d8c3194 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -242,7 +242,7 @@ void sub_0802AAC0(BombPeahatEntity* this) { #ifdef EU void sub_0802AB40(BombPeahatEntity* this) { - sub_0802AC40(super); + sub_0802AC40(this); if (--super->timer == 0) { if (this->unk_7a <= 4) { super->action = 5; @@ -254,7 +254,7 @@ void sub_0802AB40(BombPeahatEntity* this) { this->unk_80 ^= 1; } } else if (--super->subtimer == 0) { - sub_0802ACDC(super, 4); + sub_0802ACDC(this, 4); } } #else @@ -432,7 +432,7 @@ void sub_0802AE68(BombPeahatEntity* this) { this->unk_80 = 1; } - if (entity->field_0x80.HALF.HI) { + if (((BombPeahatEntity*)entity)->unk_81) { CopyPosition(entity, super); super->z.HALF.HI += 8; super->spriteSettings.draw = 0; @@ -440,7 +440,7 @@ void sub_0802AE68(BombPeahatEntity* this) { super->action = 3; this->unk_80 = 1; super->spriteSettings.draw = 1; - if (sub_0802B234(super)) { + if (sub_0802B234(this)) { super->spritePriority.b1 = 3; } else { super->spritePriority.b1 = 0; @@ -635,13 +635,13 @@ void sub_0802B1BC(BombPeahatEntity* this) { super->spriteSettings.draw = 1; } - if (entity->field_0x80.HALF.HI) { + if (((BombPeahatEntity*)entity)->unk_81) { CopyPosition(entity, super); super->z.HALF.HI += 8; } else { super->action = 2; super->spriteSettings.draw = 1; - if (sub_0802B234(super)) { + if (sub_0802B234(this)) { super->spritePriority.b1 = 3; } else { super->spritePriority.b1 = 0; diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index 676ccab8..d7cea1d9 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -59,7 +59,6 @@ extern void (*const BusinessScrub_Functions[])(BusinessScrubEntity*); extern void (*const BusinessScrub_Actions[])(BusinessScrubEntity*); extern const u8 gUnk_080CCA04[]; - void BusinessScrub(BusinessScrubEntity* this) { EnemyFunctionHandler(super, (EntityActionArray)BusinessScrub_Functions); } diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c index fa729f59..863d49d3 100644 --- a/src/enemy/darkNut.c +++ b/src/enemy/darkNut.c @@ -8,7 +8,6 @@ #include "enemy.h" #include "functions.h" - typedef struct { /*0x00*/ Entity base; /*0x68*/ u8 unused1[12]; diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index 7dafe67e..57dabe31 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -28,7 +28,12 @@ void FireballGuy_Action1(FireballGuyEntity*); void FireballGuy_Action2(FireballGuyEntity*); static void (*const FireballGuy_Functions[])(FireballGuyEntity*) = { - FireballGuy_OnTick, FireballGuy_OnCollision, (void (*)(FireballGuyEntity*))GenericKnockback, (void (*)(FireballGuyEntity*))GenericDeath, (void (*)(FireballGuyEntity*))GenericConfused, FireballGuy_OnGrabbed, + FireballGuy_OnTick, + FireballGuy_OnCollision, + (void (*)(FireballGuyEntity*))GenericKnockback, + (void (*)(FireballGuyEntity*))GenericDeath, + (void (*)(FireballGuyEntity*))GenericConfused, + FireballGuy_OnGrabbed, }; void FireballGuy(FireballGuyEntity* this) { diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c index ee1d0b93..dc66bc63 100644 --- a/src/enemy/keaton.c +++ b/src/enemy/keaton.c @@ -30,7 +30,12 @@ void Keaton_Action4(KeatonEntity*); void Keaton_Action5(KeatonEntity*); static void (*const Keaton_Functions[])(KeatonEntity*) = { - Keaton_OnTick, Keaton_OnCollision, (void (*)(KeatonEntity*))GenericKnockback, (void (*)(KeatonEntity*))GenericDeath, (void (*)(KeatonEntity*))GenericConfused, Keaton_OnGrabbed, + Keaton_OnTick, + Keaton_OnCollision, + (void (*)(KeatonEntity*))GenericKnockback, + (void (*)(KeatonEntity*))GenericDeath, + (void (*)(KeatonEntity*))GenericConfused, + Keaton_OnGrabbed, }; bool32 sub_080325E8(KeatonEntity* this); @@ -163,7 +168,8 @@ void Keaton_Action5(KeatonEntity* this) { } u32 sub_080325E8(KeatonEntity* this) { - if ((sub_08049FA0(super) && sub_08049FDC(super, 1)) && (EntityInRectRadius(super, gUnk_020000B0, 0x68, 0x40) != 0)) { + if ((sub_08049FA0(super) && sub_08049FDC(super, 1)) && + (EntityInRectRadius(super, gUnk_020000B0, 0x68, 0x40) != 0)) { if (((GetFacingDirection(super, gUnk_020000B0) - (DirectionRound(super->frame)) + 2) & 0x1F) < 5) { super->action = 3; super->timer = 12; diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index 6bbc0fee..d5b5a8cc 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -277,8 +277,7 @@ void sub_0803CA84(LakituEntity* this, u32 unkParameter) { void sub_0803CAD0(LakituEntity* this) { if (!EntityWithinDistance(super, this->unk_74, this->unk_76, 1)) { - super->direction = - CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, this->unk_74, this->unk_76); + super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, this->unk_74, this->unk_76); ProcessMovement2(super); } @@ -403,7 +402,12 @@ void sub_0803CC08(LakituEntity* this) { } void (*const Lakitu_Functions[])(LakituEntity*) = { - Lakitu_OnTick, Lakitu_OnCollision, (void (*)(LakituEntity*))GenericKnockback, (void (*)(LakituEntity*))GenericDeath, (void (*)(LakituEntity*))GenericConfused, Lakitu_OnGrabbed, + Lakitu_OnTick, + Lakitu_OnCollision, + (void (*)(LakituEntity*))GenericKnockback, + (void (*)(LakituEntity*))GenericDeath, + (void (*)(LakituEntity*))GenericConfused, + Lakitu_OnGrabbed, }; void (*const LakituActionFuncs[])(LakituEntity*) = { diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 89f991a3..75c9d18d 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -159,10 +159,12 @@ void sub_0803CE3C(LakituCloudEntity* this) { } void (*const LakituCloud_Functions[])(LakituCloudEntity*) = { - LakituCloud_OnTick, LakituCloud_OnTick, LakituCloud_OnKnockback, - (void (*)(LakituCloudEntity*)) -GenericDeath, (void (*)(LakituCloudEntity*)) -GenericConfused, LakituCloud_OnGrabbed, + LakituCloud_OnTick, + LakituCloud_OnTick, + LakituCloud_OnKnockback, + (void (*)(LakituCloudEntity*))GenericDeath, + (void (*)(LakituCloudEntity*))GenericConfused, + LakituCloud_OnGrabbed, }; void (*const gUnk_080D0430[])(LakituCloudEntity*) = { diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index 64025e93..208d7f9f 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -4,124 +4,132 @@ * * @brief Mazaal Bracelet enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "hitbox.h" #include "object.h" -typedef struct { +typedef struct MazaalBraceletEntity_ { /*0x00*/ Entity base; /*0x68*/ u8 unused1[12]; - /*0x74*/ u32 unk_74; -// // Overlap of 4 -// /*0x74*/ u8 unk_74; -// /*0x75*/ u8 unk_75; - /*0x76*/ u8 unused2[2]; - /*0x78*/ u32 unk_78; -// // Overlap of 4 -// /*0x78*/ u16 unk_78; - /*0x7a*/ u8 unused3[2]; - /*0x7c*/ u8 unk_7c; - /*0x7d*/ u8 unk_7d; + union { + /*0x74*/ struct MazaalBraceletEntity_* entity; + /*0x74*/ u16 u16; + struct { + /*0x74*/ u8 unk_74; + /*0x75*/ u8 unk_75; + } split; + } unk_74; + union { + /*0x78*/ struct MazaalBraceletEntity_* entity; + struct { + /*0x78*/ u16 unk_78; + } split; + } unk_78; + /*0x7c*/ union SplitHWord unk_7c; /*0x7e*/ u16 unk_7e; - /*0x80*/ u8 unk_80; -// // Overlap of 1 -// /*0x80*/ u16 unk_80; + /*0x80*/ union SplitHWord unk_80; /*0x82*/ u8 unused4[2]; /*0x84*/ u8 unk_84; } MazaalBraceletEntity; -void sub_0803B538(Entity*); -u32 sub_0803B4E4(Entity*); -void sub_0803B55C(Entity*); -void sub_0803B4D4(Entity*); -void sub_0803B59C(Entity*); -void sub_0803B5C0(Entity*); -u32 sub_0803B610(Entity*); -void sub_0803B63C(Entity*); -void sub_0803B6A4(Entity*); -u32 sub_0803B6F4(Entity*); -void sub_0803B8E8(Entity*, u32); -u32 sub_0803B870(Entity*); -void sub_0803B824(Entity*); -void sub_0803B804(Entity*); -void sub_0803B798(void); -void sub_0803BA8C(Entity*, u32); - -void sub_0803B724(Entity*); extern void SoundReqClipped(Entity*, u32); -void MazaalBracelet_OnTick(Entity*); -void MazaalBracelet_OnCollision(Entity*); -void MazaalBracelet_OnGrabbed(Entity*); -void sub_0803A254(Entity*); -void sub_0803B8F8(Entity*); +void sub_0803B538(MazaalBraceletEntity*); +bool32 sub_0803B4E4(MazaalBraceletEntity*); +void sub_0803B55C(MazaalBraceletEntity*); +void sub_0803B4D4(MazaalBraceletEntity*); +void sub_0803B59C(MazaalBraceletEntity*); +void sub_0803B5C0(MazaalBraceletEntity*); +u32 sub_0803B610(MazaalBraceletEntity*); +void sub_0803B63C(MazaalBraceletEntity*); +void sub_0803B6A4(MazaalBraceletEntity*); +bool32 sub_0803B6F4(MazaalBraceletEntity*); +void sub_0803B8E8(MazaalBraceletEntity*, u32); +u32 sub_0803B870(MazaalBraceletEntity*); +void sub_0803B824(MazaalBraceletEntity*); +void sub_0803B804(MazaalBraceletEntity*); +void sub_0803B798(void); +void sub_0803BA8C(MazaalBraceletEntity*, u32); -void sub_0803A274(Entity*); -void sub_0803A364(Entity*); -void sub_0803A548(Entity*); -void sub_0803A58C(Entity*); -void sub_0803A5D0(Entity*); -void sub_0803A60C(Entity*); -void sub_0803A660(Entity*); -void sub_0803A6E8(Entity*); -void sub_0803A720(Entity*); -void sub_0803A740(Entity*); -void sub_0803A780(Entity*); -void sub_0803A7AC(Entity*); -void sub_0803A7CC(Entity*); -void sub_0803A814(Entity*); -void sub_0803A86C(Entity*); -void sub_0803A8B8(Entity*); -void sub_0803A90C(Entity*); -void sub_0803A978(Entity*); -void sub_0803AA00(Entity*); -void sub_0803AA98(Entity*); -void sub_0803AB10(Entity*); -void sub_0803AB5C(Entity*); -void sub_0803ABB4(Entity*); -void sub_0803AC1C(Entity*); -void sub_0803AC60(Entity*); -void sub_0803ACC0(Entity*); -void sub_0803ADAC(Entity*); -void sub_0803ADF4(Entity*); -void sub_0803AE48(Entity*); -void sub_0803AEC4(Entity*); -void sub_0803AF18(Entity*); -void sub_0803AF50(Entity*); -void sub_0803AF7C(Entity*); -void sub_0803AF9C(Entity*); -void sub_0803AFC8(Entity*); -void sub_0803AFE0(Entity*); -void sub_0803B01C(Entity*); -void sub_0803B04C(Entity*); -void sub_0803B074(Entity*); -void sub_0803B0D4(Entity*); -void sub_0803B100(Entity*); -void sub_0803B144(Entity*); -void sub_0803B17C(Entity*); -void sub_0803B1B8(Entity*); -void sub_0803B2D0(Entity*); -void sub_0803B30C(Entity*); -void sub_0803B338(Entity*); -void sub_0803B35C(Entity*); -void sub_0803B398(Entity*); -void sub_0803B3F4(Entity*); -void sub_0803B480(Entity*); +void sub_0803B724(MazaalBraceletEntity*); -void sub_0803B910(Entity*); -void sub_0803B978(Entity*); -void sub_0803BA6C(Entity*); -void sub_0803BA80(Entity*); +void MazaalBracelet_OnTick(MazaalBraceletEntity*); +void MazaalBracelet_OnCollision(MazaalBraceletEntity*); +void MazaalBracelet_OnGrabbed(MazaalBraceletEntity*); +void sub_0803A254(MazaalBraceletEntity*); +void sub_0803B8F8(MazaalBraceletEntity*); -void (*const MazaalBracelet_Functions[])(Entity*) = { MazaalBracelet_OnTick, MazaalBracelet_OnCollision, - GenericKnockback, GenericDeath, - GenericConfused, MazaalBracelet_OnGrabbed }; +void sub_0803A274(MazaalBraceletEntity*); +void sub_0803A364(MazaalBraceletEntity*); +void sub_0803A548(MazaalBraceletEntity*); +void sub_0803A58C(MazaalBraceletEntity*); +void sub_0803A5D0(MazaalBraceletEntity*); +void sub_0803A60C(MazaalBraceletEntity*); +void sub_0803A660(MazaalBraceletEntity*); +void sub_0803A6E8(MazaalBraceletEntity*); +void sub_0803A720(MazaalBraceletEntity*); +void sub_0803A740(MazaalBraceletEntity*); +void sub_0803A780(MazaalBraceletEntity*); +void sub_0803A7AC(MazaalBraceletEntity*); +void sub_0803A7CC(MazaalBraceletEntity*); +void sub_0803A814(MazaalBraceletEntity*); +void sub_0803A86C(MazaalBraceletEntity*); +void sub_0803A8B8(MazaalBraceletEntity*); +void sub_0803A90C(MazaalBraceletEntity*); +void sub_0803A978(MazaalBraceletEntity*); +void sub_0803AA00(MazaalBraceletEntity*); +void sub_0803AA98(MazaalBraceletEntity*); +void sub_0803AB10(MazaalBraceletEntity*); +void sub_0803AB5C(MazaalBraceletEntity*); +void sub_0803ABB4(MazaalBraceletEntity*); +void sub_0803AC1C(MazaalBraceletEntity*); +void sub_0803AC60(MazaalBraceletEntity*); +void sub_0803ACC0(MazaalBraceletEntity*); +void sub_0803ADAC(MazaalBraceletEntity*); +void sub_0803ADF4(MazaalBraceletEntity*); +void sub_0803AE48(MazaalBraceletEntity*); +void sub_0803AEC4(MazaalBraceletEntity*); +void sub_0803AF18(MazaalBraceletEntity*); +void sub_0803AF50(MazaalBraceletEntity*); +void sub_0803AF7C(MazaalBraceletEntity*); +void sub_0803AF9C(MazaalBraceletEntity*); +void sub_0803AFC8(MazaalBraceletEntity*); +void sub_0803AFE0(MazaalBraceletEntity*); +void sub_0803B01C(MazaalBraceletEntity*); +void sub_0803B04C(MazaalBraceletEntity*); +void sub_0803B074(MazaalBraceletEntity*); +void sub_0803B0D4(MazaalBraceletEntity*); +void sub_0803B100(MazaalBraceletEntity*); +void sub_0803B144(MazaalBraceletEntity*); +void sub_0803B17C(MazaalBraceletEntity*); +void sub_0803B1B8(MazaalBraceletEntity*); +void sub_0803B2D0(MazaalBraceletEntity*); +void sub_0803B30C(MazaalBraceletEntity*); +void sub_0803B338(MazaalBraceletEntity*); +void sub_0803B35C(MazaalBraceletEntity*); +void sub_0803B398(MazaalBraceletEntity*); +void sub_0803B3F4(MazaalBraceletEntity*); +void sub_0803B480(MazaalBraceletEntity*); -void (*const gUnk_080CFC2C[])(Entity*) = { sub_0803A254, sub_0803A254, sub_0803B8F8, sub_0803B8F8 }; +void sub_0803B910(MazaalBraceletEntity*); +void sub_0803B978(MazaalBraceletEntity*); +void sub_0803BA6C(MazaalBraceletEntity*); +void sub_0803BA80(MazaalBraceletEntity*); -void (*const gUnk_080CFC3C[])(Entity*) = { +void (*const MazaalBracelet_Functions[])(MazaalBraceletEntity*) = { + MazaalBracelet_OnTick, + MazaalBracelet_OnCollision, + (void (*)(MazaalBraceletEntity*))GenericKnockback, + (void (*)(MazaalBraceletEntity*))GenericDeath, + (void (*)(MazaalBraceletEntity*))GenericConfused, + MazaalBracelet_OnGrabbed, +}; + +void (*const gUnk_080CFC2C[])(MazaalBraceletEntity*) = { sub_0803A254, sub_0803A254, sub_0803B8F8, sub_0803B8F8 }; + +void (*const gUnk_080CFC3C[])(MazaalBraceletEntity*) = { sub_0803A274, sub_0803A364, sub_0803A548, sub_0803A58C, sub_0803A5D0, sub_0803A60C, sub_0803A660, sub_0803A6E8, sub_0803A720, sub_0803A740, sub_0803A780, sub_0803A7AC, sub_0803A7CC, sub_0803A814, sub_0803A86C, sub_0803A8B8, sub_0803A90C, sub_0803A978, sub_0803AA00, sub_0803AA98, sub_0803AB10, sub_0803AB5C, sub_0803ABB4, sub_0803AC1C, @@ -138,7 +146,7 @@ const s8 gUnk_080CFD19[] = { 0x10, -0x10 }; const s8 gUnk_080CFD1B[] = { -0x38, 0x38 }; const s8 gUnk_080CFD1D[] = { -0x11, 0x11 }; -void (*const gUnk_080CFD20[])(Entity*) = { sub_0803B910, sub_0803B978, sub_0803BA6C, sub_0803BA80 }; +void (*const gUnk_080CFD20[])(MazaalBraceletEntity*) = { sub_0803B910, sub_0803B978, sub_0803BA6C, sub_0803BA80 }; const u16 gUnk_080CFD30[] = { 0xdb, 0xdd, 0xdf, 0xe1, 0xdf, 0xdd, 0xdb, 0xe3, 0xe5, 0xe3 }; const u16 gUnk_080CFD44[] = { 0xdc, 0xde, 0xe0, 0xe2, 0xe0, 0xde, 0xdc, 0xe4, 0xe6, 0xe4 }; @@ -147,270 +155,279 @@ const u16 gUnk_080CFD5C[] = { 0xe7, 0xe8 }; extern s8 gUnk_080CED6C[8]; -void MazaalBracelet(Entity* this) { - MazaalBracelet_Functions[GetNextFunction(this)](this); +void MazaalBracelet(MazaalBraceletEntity* this) { + MazaalBracelet_Functions[GetNextFunction(super)](this); } -void MazaalBracelet_OnTick(Entity* this) { - gUnk_080CFC2C[this->type](this); +void MazaalBracelet_OnTick(MazaalBraceletEntity* this) { + gUnk_080CFC2C[super->type](this); } -void MazaalBracelet_OnCollision(Entity* this) { - Entity* entity; +void MazaalBracelet_OnCollision(MazaalBraceletEntity* this) { + MazaalBraceletEntity* entity; - if (this->type < 2) { - if (this->action != 0x2b) { - if ((0 < this->iframes) && ((this->contactFlags == 0x95 || (this->contactFlags == 0x8e)))) { - this->action = 0x28; - COLLISION_OFF(this); - entity = this->parent; - entity->field_0x7c.BYTES.byte1 = entity->field_0x7c.BYTES.byte1 | (this->type == 0 ? 1 : 2); - entity->field_0x80.HALF.LO = (this->type == 0 ? 1 : 2) | entity->field_0x80.HALF.LO; - entity = this->child; - entity->iframes = this->iframes; - entity = (*(Entity**)&this->field_0x74); - entity->iframes = this->iframes; + if (super->type < 2) { + if (super->action != 0x2b) { + if ((0 < super->iframes) && ((super->contactFlags == 0x95 || (super->contactFlags == 0x8e)))) { + super->action = 0x28; + COLLISION_OFF(super); + entity = (MazaalBraceletEntity*)super->parent; + entity->unk_7c.HALF.HI = entity->unk_7c.HALF.HI | (super->type == 0 ? 1 : 2); + entity->unk_80.HALF.LO = (super->type == 0 ? 1 : 2) | entity->unk_80.HALF.LO; + + entity = (MazaalBraceletEntity*)super->child; + entity->base.iframes = super->iframes; + + entity = this->unk_74.entity; + entity->base.iframes = super->iframes; SoundReq(SFX_BOSS_HIT); } } else { - entity = this->child; - entity->iframes = this->iframes; - entity = (*(Entity**)&this->field_0x74); - entity->iframes = this->iframes; - InitializeAnimation(this, 0x18); - InitAnimationForceUpdate(this->child, 9); + entity = (MazaalBraceletEntity*)super->child; + entity->base.iframes = super->iframes; + + entity = this->unk_74.entity; + entity->base.iframes = super->iframes; + InitializeAnimation(super, 0x18); + InitAnimationForceUpdate(super->child, 9); SoundReq(SFX_BOSS_HIT); } } - EnemyFunctionHandlerAfterCollision(this, MazaalBracelet_Functions); + EnemyFunctionHandlerAfterCollision(super, MazaalBracelet_Functions); } -void MazaalBracelet_OnGrabbed(Entity* this) { +void MazaalBracelet_OnGrabbed(MazaalBraceletEntity* this) { } -void sub_0803A254(Entity* this) { - gUnk_080CFC3C[this->action](this); +void sub_0803A254(MazaalBraceletEntity* this) { + gUnk_080CFC3C[super->action](this); sub_0803B538(this); } -void sub_0803A274(Entity* this) { - Entity* pEVar1; +void sub_0803A274(MazaalBraceletEntity* this) { + Entity* entity; if (gEntCount < 0x45) { - if (this->type == 0) { - pEVar1 = CreateEnemy(MAZAAL_HAND, 0); - pEVar1->parent = this; - this->child = pEVar1; - pEVar1 = CreateEnemy(MAZAAL_BRACELET, 2); - pEVar1->parent = this; - *(Entity**)&this->field_0x74 = pEVar1; - 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)); + if (super->type == 0) { + entity = CreateEnemy(MAZAAL_HAND, 0); + entity->parent = super; + super->child = entity; + + entity = CreateEnemy(MAZAAL_BRACELET, 2); + entity->parent = super; + this->unk_74.entity = (MazaalBraceletEntity*)entity; + + entity = CreateObject(MAZAAL_OBJECT, 1, 0); + entity->parent = super; + entity->child = super->child; + + PositionRelative(super->parent, super, Q_16_16(16.0), Q_16_16(32.0)); } else { - pEVar1 = CreateEnemy(MAZAAL_HAND, 1); - pEVar1->parent = this; - this->child = pEVar1; - pEVar1 = CreateEnemy(MAZAAL_BRACELET, 3); - pEVar1->parent = this; - *(Entity**)&this->field_0x74 = pEVar1; - pEVar1 = CreateObject(MAZAAL_OBJECT, 2, 0); - pEVar1->parent = this; - pEVar1->child = this->child; - this->spriteSettings.flipX = 1; - PositionRelative(this->parent, this, Q_16_16(-16.0), Q_16_16(32.0)); + entity = CreateEnemy(MAZAAL_HAND, 1); + entity->parent = super; + super->child = entity; + + entity = CreateEnemy(MAZAAL_BRACELET, 3); + entity->parent = super; + this->unk_74.entity = (MazaalBraceletEntity*)entity; + + entity = CreateObject(MAZAAL_OBJECT, 2, 0); + entity->parent = super; + entity->child = super->child; + + super->spriteSettings.flipX = 1; + PositionRelative(super->parent, super, Q_16_16(-16.0), Q_16_16(32.0)); } if (gRoomTransition.field_0x38 != 0) { - this->action = 3; - COLLISION_ON(this); - this->spriteSettings.draw = 1; - this->child->spriteSettings.draw = 1; - InitializeAnimation(this, 0x10); + super->action = 3; + COLLISION_ON(super); + super->spriteSettings.draw = 1; + super->child->spriteSettings.draw = 1; + InitializeAnimation(super, 0x10); } else { - this->action = 1; - InitializeAnimation(this, 4); + super->action = 1; + InitializeAnimation(super, 4); } } } -void sub_0803A364(Entity* this) { +void sub_0803A364(MazaalBraceletEntity* this) { u8 uVar1; - Entity* pEVar3; + Entity* entity; u32 index; s8* ptr; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - switch (this->subAction & 0x7f) { + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + switch (super->subAction & 0x7f) { case 0: case 2: break; case 1: - this->subAction = 2; - pEVar3 = this->child; - pEVar3->spriteSettings.draw = 1; - pEVar3->spriteRendering.alphaBlend = 1; + super->subAction = 2; + entity = super->child; + entity->spriteSettings.draw = 1; + entity->spriteRendering.alphaBlend = 1; break; case 3: - this->subAction = 4; - this->spriteSettings.draw = 1; - this->child->spriteRendering.alphaBlend = 0; + super->subAction = 4; + super->spriteSettings.draw = 1; + super->child->spriteRendering.alphaBlend = 0; break; case 4: - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->subAction = 5; + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->subAction = 5; } break; case 5: - if (sub_0803B4E4(this) == 0) { - LinearMoveUpdate(this); + if (!sub_0803B4E4(this)) { + LinearMoveUpdate(super); return; } - this->type2 = 0; + super->type2 = 0; uVar1 = 6; - this->subAction = uVar1; - this->timer = 30; + super->subAction = uVar1; + super->timer = 30; break; case 6: - this->timer--; - if (this->timer == 0) { - this->subAction = 7; - InitializeAnimation(this, 5); + super->timer--; + if (super->timer == 0) { + super->subAction = 7; + InitializeAnimation(super, 5); } break; case 7: - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->subAction = 8; - this->spriteSettings.draw = 0; - InitAnimationForceUpdate(this->child, 8); + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->subAction = 8; + super->spriteSettings.draw = 0; + InitAnimationForceUpdate(super->child, 8); SoundReq(SFX_16E); } break; case 8: sub_0803B55C(this); - if ((this->child->frame & ANIM_DONE) == 0) { + if ((super->child->frame & ANIM_DONE) == 0) { return; } uVar1 = 9; - this->subAction = uVar1; - this->timer = 30; + super->subAction = uVar1; + super->timer = 30; break; case 9: - this->timer--; - if (this->timer == 0) { - this->subAction = 10; - InitAnimationForceUpdate(this->child, 6); + super->timer--; + if (super->timer == 0) { + super->subAction = 10; + InitAnimationForceUpdate(super->child, 6); } break; case 10: sub_0803B55C(this); - if ((this->child->frame & ANIM_DONE) != 0) { - this->subAction = 0xb; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 4); + if ((super->child->frame & ANIM_DONE) != 0) { + super->subAction = 0xb; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 4); } break; case 0xb: - GetNextFrame(this); - if ((this->frame & ANIM_DONE) == 0) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) == 0) { return; } - if (this->type2 != 0) { + if (super->type2 != 0) { uVar1 = 0xc; - this->subAction = uVar1; - this->timer = 30; + super->subAction = uVar1; + super->timer = 30; } else { - this->type2 = 1; - this->subAction = 6; - this->timer = 10; + super->type2 = 1; + super->subAction = 6; + super->timer = 10; } break; default: - this->timer--; - if (this->timer == 0) { - COLLISION_ON(this); + super->timer--; + if (super->timer == 0) { + COLLISION_ON(super); sub_0803B4D4(this); } break; } } -void sub_0803A548(Entity* this) { +void sub_0803A548(MazaalBraceletEntity* this) { u32 index; s8* ptr; sub_0803B5C0(this); - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - if (sub_0803B4E4(this) == 0) { - LinearMoveUpdate(this); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + if (!sub_0803B4E4(this)) { + LinearMoveUpdate(super); } } -void sub_0803A58C(Entity* this) { +void sub_0803A58C(MazaalBraceletEntity* this) { u32 index; s8* ptr; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - if (sub_0803B4E4(this) != 0) { + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + if (sub_0803B4E4(this)) { sub_0803B59C(this); } else { - LinearMoveUpdate(this); + LinearMoveUpdate(super); } } -void sub_0803A5D0(Entity* this) { +void sub_0803A5D0(MazaalBraceletEntity* this) { u32 index; s8* ptr; - this->action = 5; - COLLISION_OFF(this); + super->action = 5; + COLLISION_OFF(super); ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - InitializeAnimation(this, 5); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + InitializeAnimation(super, 5); } -void sub_0803A60C(Entity* this) { +void sub_0803A60C(MazaalBraceletEntity* this) { u32 index; s8* ptr; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->action = 6; - this->spriteSettings.draw = 0; - InitAnimationForceUpdate(this->child, 8); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 6; + super->spriteSettings.draw = 0; + InitAnimationForceUpdate(super->child, 8); } } -void sub_0803A660(Entity* this) { +void sub_0803A660(MazaalBraceletEntity* this) { u32 uVar2; u8* pbVar3; s8* ptr; u32 index; - pbVar3 = &this->child->frame; + pbVar3 = &super->child->frame; if ((*pbVar3 & 0x80) != 0) { - if (this->z.HALF.HI > -0x50) { - this->z.HALF.HI = this->z.HALF.HI - 2; + if (super->z.HALF.HI > -0x50) { + super->z.HALF.HI = super->z.HALF.HI - 2; } else { - this->action = 7; - this->timer = 0; - uVar2 = GetFacingDirection(this, &gPlayerEntity); - this->direction = (u8)uVar2; - this->speed = 0x280; + super->action = 7; + super->timer = 0; + uVar2 = GetFacingDirection(super, &gPlayerEntity); + super->direction = (u8)uVar2; + super->speed = 0x280; return; } } else { @@ -419,345 +436,345 @@ void sub_0803A660(Entity* this) { SoundReq(SFX_157); } ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; } } -void sub_0803A6E8(Entity* this) { +void sub_0803A6E8(MazaalBraceletEntity* this) { s32 y; if (sub_0803B610(this)) { - this->action = 8; - this->timer = 10; + super->action = 8; + super->timer = 10; } else { sub_0803B63C(this); - LinearMoveUpdate(this); - y = this->parent->y.HALF.HI + 8; - if (y > this->y.HALF.HI) { - this->y.HALF.HI = y; + LinearMoveUpdate(super); + y = super->parent->y.HALF.HI + 8; + if (y > super->y.HALF.HI) { + super->y.HALF.HI = y; } } } -void sub_0803A720(Entity* this) { - if (--this->timer == 0) { - this->action = 9; +void sub_0803A720(MazaalBraceletEntity* this) { + if (--super->timer == 0) { + super->action = 9; sub_0803B8E8(this, 0x16); } } -void sub_0803A740(Entity* this) { +void sub_0803A740(MazaalBraceletEntity* this) { u16 height; - height = this->z.HALF.HI + 4; - this->z.HALF.HI += 4; + height = super->z.HALF.HI + 4; + super->z.HALF.HI += 4; if (-1 < height * 0x10000) { - this->z.HALF.HI = 0; - this->action = 10; - this->timer = 10; - this->parent->field_0x7c.BYTES.byte1 |= 0x40; + super->z.HALF.HI = 0; + super->action = 10; + super->timer = 10; + ((MazaalBraceletEntity*)super->parent)->unk_7c.HALF.HI |= 0x40; sub_0803B8E8(this, 0x13); InitScreenShake(10, 0); SoundReq(SFX_158); } } -void sub_0803A780(Entity* this) { - if (--this->timer == 0) { - if (--this->field_0x7c.BYTES.byte0) { - this->action = 6; +void sub_0803A780(MazaalBraceletEntity* this) { + if (--super->timer == 0) { + if (--this->unk_7c.HALF.LO) { + super->action = 6; } else { - this->action = 0xb; + super->action = 0xb; } } } -void sub_0803A7AC(Entity* this) { - if (this->z.HALF.HI > -6) { - this->z.HALF.HI--; +void sub_0803A7AC(MazaalBraceletEntity* this) { + if (super->z.HALF.HI > -6) { + super->z.HALF.HI--; } else { - this->action = 0xc; + super->action = 0xc; } } -void sub_0803A7CC(Entity* this) { +void sub_0803A7CC(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; if (sub_0803B4E4(this)) { - this->action = 0xd; - InitAnimationForceUpdate(this->child, 6); + super->action = 0xd; + InitAnimationForceUpdate(super->child, 6); } else { - LinearMoveUpdate(this); + LinearMoveUpdate(super); } } -void sub_0803A814(Entity* this) { +void sub_0803A814(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; sub_0803B55C(this); - if ((this->child->frame & ANIM_DONE) != 0) { - this->action = 0xe; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 4); + if ((super->child->frame & ANIM_DONE) != 0) { + super->action = 0xe; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 4); } } -void sub_0803A86C(Entity* this) { +void sub_0803A86C(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - COLLISION_ON(this); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + COLLISION_ON(super); sub_0803B59C(this); } } -void sub_0803A8B8(Entity* this) { +void sub_0803A8B8(MazaalBraceletEntity* this) { s8* ptr; u32 index; - this->action = 0x10; - this->timer = 30; - this->direction = DirectionNorth; - this->speed = 0x80; + super->action = 0x10; + super->timer = 30; + super->direction = DirectionNorth; + super->speed = 0x80; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - InitializeAnimation(this, 6); - InitAnimationForceUpdate(this->child, 1); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + InitializeAnimation(super, 6); + InitAnimationForceUpdate(super->child, 1); SoundReq(SFX_153); } -void sub_0803A90C(Entity* this) { +void sub_0803A90C(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - GetNextFrame(this); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + GetNextFrame(super); sub_0803B55C(this); - LinearMoveUpdate(this); - this->timer--; - if (this->timer == 0) { - this->action = 0x11; - this->direction = this->type * 0x10 + 8; - this->speed = 0x200; - InitializeAnimation(this, 7); - InitAnimationForceUpdate(this->child, 2); + LinearMoveUpdate(super); + super->timer--; + if (super->timer == 0) { + super->action = 0x11; + super->direction = super->type * 0x10 + 8; + super->speed = 0x200; + InitializeAnimation(super, 7); + InitAnimationForceUpdate(super->child, 2); } } -void sub_0803A978(Entity* this) { +void sub_0803A978(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - GetNextFrame(this); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + GetNextFrame(super); sub_0803B55C(this); - if ((++this->timer & 3) == 0) { - sub_08004596(this, 0x10); + if ((++super->timer & 3) == 0) { + sub_08004596(super, 0x10); } - LinearMoveUpdate(this); - if (this->direction == DirectionSouth) { - this->action = 0x12; - this->timer = 3; - COLLISION_OFF(this); - *(u8*)(*(int*)&this->field_0x74 + 0x10) &= ~0x80; - InitializeAnimation(this, 8); - InitAnimationForceUpdate(this->child, 3); + LinearMoveUpdate(super); + if (super->direction == DirectionSouth) { + super->action = 0x12; + super->timer = 3; + COLLISION_OFF(super); + COLLISION_OFF(&this->unk_74.entity->base); + InitializeAnimation(super, 8); + InitAnimationForceUpdate(super->child, 3); } } -void sub_0803AA00(Entity* this) { +void sub_0803AA00(MazaalBraceletEntity* this) { u32 direction; s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; if (sub_0803B870(this) == 0) { - direction = (this->type ^ 1) * 0x10 + 8; - if ((++this->timer & 3) == 0) { - sub_08004596(this, direction); + direction = (super->type ^ 1) * 0x10 + 8; + if ((++super->timer & 3) == 0) { + sub_08004596(super, direction); } - LinearMoveUpdate(this); - if ((this->direction == direction) || (this->y.HALF.HI >= gPlayerEntity.y.HALF.HI)) { - this->action = 0x13; - this->spriteSettings.draw = 0; - this->direction = direction; - this->field_0x80.HWORD = gPlayerEntity.x.HALF.HI; - InitAnimationForceUpdate(this->child, 4); + LinearMoveUpdate(super); + if ((super->direction == direction) || (super->y.HALF.HI >= gPlayerEntity.y.HALF.HI)) { + super->action = 0x13; + super->spriteSettings.draw = 0; + super->direction = direction; + this->unk_80.HWORD = gPlayerEntity.x.HALF.HI; + InitAnimationForceUpdate(super->child, 4); } } } -void sub_0803AA98(Entity* this) { - Entity* temp; +void sub_0803AA98(MazaalBraceletEntity* this) { + MazaalBraceletEntity* entity; s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; if (sub_0803B870(this) == 0) { - LinearMoveUpdate(this); - if (sub_0803B6F4(this) != 0) { - this->action = 0x14; - this->speed = 0x40; - InitializeAnimation(this, 10); - temp = (*(Entity**)&this->field_0x74); - temp->flags |= ENT_COLLIDE; - temp = this->child; - temp->hitType = 0x13; - InitAnimationForceUpdate(temp, 5); + LinearMoveUpdate(super); + if (sub_0803B6F4(this)) { + super->action = 0x14; + super->speed = 0x40; + InitializeAnimation(super, 10); + entity = this->unk_74.entity; + entity->base.flags |= ENT_COLLIDE; + entity = (MazaalBraceletEntity*)super->child; + entity->base.hitType = 0x13; + InitAnimationForceUpdate(&entity->base, 5); SoundReq(SFX_16E); } } } -void sub_0803AB10(Entity* this) { +void sub_0803AB10(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - LinearMoveUpdate(this); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + LinearMoveUpdate(super); sub_0803B55C(this); - if ((this->child->frame & ANIM_DONE) != 0) { - this->action = 0x15; - this->timer = 15; + if ((super->child->frame & ANIM_DONE) != 0) { + super->action = 0x15; + super->timer = 15; } } -void sub_0803AB5C(Entity* this) { +void sub_0803AB5C(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - if (--this->timer == 0) { - this->action = 0x16; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 0xb); - InitAnimationForceUpdate(this->child, 6); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + if (--super->timer == 0) { + super->action = 0x16; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 0xb); + InitAnimationForceUpdate(super->child, 6); } } -void sub_0803ABB4(Entity* this) { +void sub_0803ABB4(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - GetNextFrame(this); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + GetNextFrame(super); sub_0803B55C(this); - if ((this->child->frame & ANIM_DONE) != 0) { - this->action = 0x17; - COLLISION_ON(this); - this->speed = 0x180; - InitializeAnimation(this, 0x10); - InitAnimationForceUpdate(this->child, 0); + if ((super->child->frame & ANIM_DONE) != 0) { + super->action = 0x17; + COLLISION_ON(super); + super->speed = 0x180; + InitializeAnimation(super, 0x10); + InitAnimationForceUpdate(super->child, 0); } } -void sub_0803AC1C(Entity* this) { +void sub_0803AC1C(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; if (sub_0803B4E4(this)) { sub_0803B59C(this); } else { - LinearMoveUpdate(this); + LinearMoveUpdate(super); } } -void sub_0803AC60(Entity* this) { +void sub_0803AC60(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - GetNextFrame(this); - if (!this->timer) { - if (sub_0803B4E4(this) != 0) { - this->action = 0x19; - this->subAction = 0; - this->timer = 30; + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + GetNextFrame(super); + if (!super->timer) { + if (sub_0803B4E4(this)) { + super->action = 0x19; + super->subAction = 0; + super->timer = 30; } else { - LinearMoveUpdate(this); + LinearMoveUpdate(super); } } else { - this->timer--; + super->timer--; } sub_0803B824(this); } -void sub_0803ACC0(Entity* this) { +void sub_0803ACC0(MazaalBraceletEntity* this) { u16 uVar2; - switch (this->subAction) { + switch (super->subAction) { default: - if (--this->timer == 0) { - this->subAction = 1; + if (--super->timer == 0) { + super->subAction = 1; } break; case 1: - if (--this->z.HALF.HI * 0x10000 >> 0x10 < -0x20) { - this->subAction = 2; + if (--super->z.HALF.HI * 0x10000 >> 0x10 < -0x20) { + super->subAction = 2; } break; case 2: - uVar2 = this->z.HALF.HI += 4; + uVar2 = super->z.HALF.HI += 4; if (-1 < (uVar2 * 0x10000)) { - this->z.HALF.HI = 0; - this->timer = 12; - this->subAction = 3; + super->z.HALF.HI = 0; + super->timer = 12; + super->subAction = 3; InitScreenShake(8, 0); SoundReq(SFX_158); sub_0803B804(this); } break; case 3: - if (--this->timer == 0) { - this->subAction = 4; + if (--super->timer == 0) { + super->subAction = 4; } break; case 4: - uVar2 = this->z.HALF.HI -= 2; + uVar2 = super->z.HALF.HI -= 2; if (uVar2 * 0x10000 >> 0x10 < -0x28) { - this->subAction = 5; + super->subAction = 5; } break; case 5: - uVar2 = this->z.HALF.HI += 4; + uVar2 = super->z.HALF.HI += 4; if (-1 < (uVar2 * 0x10000)) { - this->z.HALF.HI = 0; - this->action = 0x1a; - this->timer = 60; + super->z.HALF.HI = 0; + super->action = 0x1a; + super->timer = 60; InitScreenShake(30, 0); SoundReq(SFX_158); sub_0803B804(this); @@ -768,479 +785,482 @@ void sub_0803ACC0(Entity* this) { sub_0803B824(this); } -void sub_0803ADAC(Entity* this) { - if (--this->timer == 0) { - this->action = 0x16; - this->spriteSettings.draw = 1; - (*(Entity**)&this->field_0x74)->flags |= ENT_COLLIDE; - InitializeAnimation(this, 0xb); - InitAnimationForceUpdate(this->child, 6); +void sub_0803ADAC(MazaalBraceletEntity* this) { + if (--super->timer == 0) { + super->action = 0x16; + super->spriteSettings.draw = 1; + COLLISION_ON(&this->unk_74.entity->base); + InitializeAnimation(super, 0xb); + InitAnimationForceUpdate(super->child, 6); sub_0803B798(); } else { sub_0803B824(this); } } -void sub_0803ADF4(Entity* this) { +void sub_0803ADF4(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - UpdateAnimationSingleFrame(this); - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->action = 0x1c; - this->timer = 30; - this->spriteSettings.draw = 0; + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + UpdateAnimationSingleFrame(super); + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 0x1c; + super->timer = 30; + super->spriteSettings.draw = 0; } } -void sub_0803AE48(Entity* this) { +void sub_0803AE48(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - UpdateAnimationSingleFrame(this); - if (((this->timer == 0) || (--this->timer == 0)) && ((this->parent->field_0x7c.BYTES.byte1 & 3) != 0)) { - this->action = 0x1d; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 4); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + UpdateAnimationSingleFrame(super); + if (((super->timer == 0) || (--super->timer == 0)) && + ((((MazaalBraceletEntity*)super->parent)->unk_7c.HALF.HI & 3) != 0)) { + super->action = 0x1d; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 4); } else { - if (sub_0803B4E4(this) == 0) { - LinearMoveUpdate(this); + if (!sub_0803B4E4(this)) { + LinearMoveUpdate(super); } } } -void sub_0803AEC4(Entity* this) { +void sub_0803AEC4(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - UpdateAnimationSingleFrame(this); - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - COLLISION_ON(this); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + UpdateAnimationSingleFrame(super); + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + COLLISION_ON(super); sub_0803B59C(this); } } -void sub_0803AF18(Entity* this) { - this->action = 0x1f; - COLLISION_OFF(this); - InitializeAnimation(this, 5); - this->z.HALF.HI = gUnk_080CED6C[(this->parent->subtimer >> 4) & 7] + 4; +void sub_0803AF18(MazaalBraceletEntity* this) { + super->action = 0x1f; + COLLISION_OFF(super); + InitializeAnimation(super, 5); + super->z.HALF.HI = gUnk_080CED6C[(super->parent->subtimer >> 4) & 7] + 4; } -void sub_0803AF50(Entity* this) { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->action = 0x20; - this->spriteSettings.draw = 0; - InitAnimationForceUpdate(this->child, 8); +void sub_0803AF50(MazaalBraceletEntity* this) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 0x20; + super->spriteSettings.draw = 0; + InitAnimationForceUpdate(super->child, 8); } } -void sub_0803AF7C(Entity* this) { +void sub_0803AF7C(MazaalBraceletEntity* this) { sub_0803B55C(this); - if ((this->child->frame & ANIM_DONE) != 0) { - this->action = 0x21; - this->timer = 15; + if ((super->child->frame & ANIM_DONE) != 0) { + super->action = 0x21; + super->timer = 15; } } -void sub_0803AF9C(Entity* this) { - if (this->timer != 0) { - this->timer--; +void sub_0803AF9C(MazaalBraceletEntity* this) { + if (super->timer != 0) { + super->timer--; } else { - if (-0x20 < this->z.HALF.HI) { - this->z.HALF.HI -= 2; + if (-0x20 < super->z.HALF.HI) { + super->z.HALF.HI -= 2; } else { - this->action = 0x22; - this->timer = 10; + super->action = 0x22; + super->timer = 10; } } } -void sub_0803AFC8(Entity* this) { - if (--this->timer == 0) { - this->action = 0x23; +void sub_0803AFC8(MazaalBraceletEntity* this) { + if (--super->timer == 0) { + super->action = 0x23; } } -void sub_0803AFE0(Entity* this) { - if (this->z.HALF.HI < 0) { - this->z.HALF.HI += 4; +void sub_0803AFE0(MazaalBraceletEntity* this) { + if (super->z.HALF.HI < 0) { + super->z.HALF.HI += 4; } else { - this->action = 0x24; - this->timer = 240; - *(u8*)&this->cutsceneBeh = 3; - this->z.HALF.HI = 0; + super->action = 0x24; + super->timer = 240; + this->unk_84 = 3; + super->z.HALF.HI = 0; InitScreenShake(160, 0); SoundReq(SFX_158); } } -void sub_0803B01C(Entity* this) { - if (--this->timer == 0) { - this->action = 0x25; +void sub_0803B01C(MazaalBraceletEntity* this) { + if (--super->timer == 0) { + super->action = 0x25; } else { - if ((this->timer > 70) && ((this->timer & 0xF) == 0)) { + if ((super->timer > 70) && ((super->timer & 0xF) == 0)) { sub_0803B724(this); } } } -void sub_0803B04C(Entity* this) { - if (this->z.HALF.HI > -6) { - this->z.HALF.HI--; +void sub_0803B04C(MazaalBraceletEntity* this) { + if (super->z.HALF.HI > -6) { + super->z.HALF.HI--; } else { - this->action = 0x26; - InitAnimationForceUpdate(this->child, 6); + super->action = 0x26; + InitAnimationForceUpdate(super->child, 6); } } -void sub_0803B074(Entity* this) { +void sub_0803B074(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; sub_0803B55C(this); - if ((this->child->frame & ANIM_DONE) != 0) { - this->action = 0x27; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 4); - InitAnimationForceUpdate(this->child, 0); + if ((super->child->frame & ANIM_DONE) != 0) { + super->action = 0x27; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 4); + InitAnimationForceUpdate(super->child, 0); } } -void sub_0803B0D4(Entity* this) { - UpdateAnimationSingleFrame(this); - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - COLLISION_ON(this); +void sub_0803B0D4(MazaalBraceletEntity* this) { + UpdateAnimationSingleFrame(super); + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + COLLISION_ON(super); sub_0803B59C(this); } } -void sub_0803B100(Entity* this) { - Entity* temp; +void sub_0803B100(MazaalBraceletEntity* this) { + MazaalBraceletEntity* entity; - this->action = 0x29; - this->zVelocity = Q_16_16(1.25); - if (this->type == 0) { - this->hitbox = (Hitbox*)&gUnk_080FD364; + super->action = 0x29; + super->zVelocity = Q_16_16(1.25); + if (super->type == 0) { + super->hitbox = (Hitbox*)&gUnk_080FD364; } else { - this->hitbox = (Hitbox*)&gUnk_080FD374; + super->hitbox = (Hitbox*)&gUnk_080FD374; } - temp = *(Entity**)&this->field_0x74; - temp->action = 3; - temp->field_0x74.HALF.LO = 0x20; - InitAnimationForceUpdate(this->child, 9); + entity = this->unk_74.entity; + entity->base.action = 3; + entity->unk_74.split.unk_74 = 0x20; + InitAnimationForceUpdate(super->child, 9); SoundReq(SFX_14F); } -void sub_0803B144(Entity* this) { - UpdateAnimationSingleFrame(this->child); - if (GravityUpdate(this, Q_8_8(32.0)) == 0) { - this->action = 0x2a; - InitializeAnimation(this, 0x16); +void sub_0803B144(MazaalBraceletEntity* this) { + UpdateAnimationSingleFrame(super->child); + if (GravityUpdate(super, Q_8_8(32.0)) == 0) { + super->action = 0x2a; + InitializeAnimation(super, 0x16); sub_0803B8E8(this, 0x14); InitScreenShake(8, 0); } } -void sub_0803B17C(Entity* this) { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->action = 0x2b; - COLLISION_ON(this); - this->hitType = 0x18; - this->health = 0xff; - this->field_0x7c.HALF.HI = 600; +void sub_0803B17C(MazaalBraceletEntity* this) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 0x2b; + COLLISION_ON(super); + super->hitType = 0x18; + super->health = 0xff; + this->unk_7e = 600; } } -void sub_0803B1B8(Entity* this) { - Entity* temp; +void sub_0803B1B8(MazaalBraceletEntity* this) { + Entity* entity; u16 val; - if ((this->frame & ANIM_DONE) == 0) { - GetNextFrame(this); - UpdateAnimationSingleFrame(this->child); + if ((super->frame & ANIM_DONE) == 0) { + GetNextFrame(super); + UpdateAnimationSingleFrame(super->child); } - if (this->health < 0xf5) { - this->action = 0x32; - this->field_0x7c.HALF.HI = 0x5dc; - this->spriteSettings.draw = 0; - this->hitType = 0x14; - temp = CreateFx(this, FX_GIANT_EXPLOSION4, 0); - if (temp != (Entity*)0x0) { - temp->x.HALF.HI += this->hitbox->offset_x; - temp->y.HALF.HI += this->hitbox->offset_y; - temp->spritePriority.b0 = 3; + if (super->health < 0xf5) { + super->action = 0x32; + this->unk_7e = 0x5dc; + super->spriteSettings.draw = 0; + super->hitType = 0x14; + entity = CreateFx(super, FX_GIANT_EXPLOSION4, 0); + if (entity != NULL) { + entity->x.HALF.HI += super->hitbox->offset_x; + entity->y.HALF.HI += super->hitbox->offset_y; + entity->spritePriority.b0 = 3; } - temp = CreateObject(GROUND_ITEM, 0x5e, 0); - if (temp != (Entity*)0x0) { - temp->timer = 0; - temp->direction = 0x90; - PositionRelative(this, temp, Q_16_16(this->hitbox->offset_x), Q_16_16(this->hitbox->offset_y)); + + entity = CreateObject(GROUND_ITEM, 0x5e, 0); + if (entity != NULL) { + entity->timer = 0; + entity->direction = 0x90; + PositionRelative(super, entity, Q_16_16(super->hitbox->offset_x), Q_16_16(super->hitbox->offset_y)); } - temp = *(Entity**)&this->field_0x74; - temp->field_0x74.HALF.LO = 0x40; - temp = this->parent; - temp->field_0x80.HALF.LO |= (this->type == 0) ? 4 : 8; - if ((temp->field_0x80.HALF.LO & 0xc) == 0xc) { - temp->action = 0xb; - temp->timer = 120; - temp->zVelocity = 0; - (*(Entity**)&temp->field_0x74)->field_0x7c.HALF_U.HI = 0x708; - (*(Entity**)&temp->field_0x78)->field_0x7c.HALF_U.HI = 0x708; + + entity = &this->unk_74.entity->base; + ((MazaalBraceletEntity*)entity)->unk_74.split.unk_74 = 0x40; + + entity = super->parent; + ((MazaalBraceletEntity*)entity)->unk_80.HALF.LO |= (super->type == 0) ? 4 : 8; + if ((((MazaalBraceletEntity*)entity)->unk_80.HALF.LO & 0xc) == 0xc) { + entity->action = 0xb; + entity->timer = 120; + entity->zVelocity = 0; + ((MazaalBraceletEntity*)entity)->unk_74.entity->unk_7e = 0x708; + ((MazaalBraceletEntity*)entity)->unk_78.entity->unk_7e = 0x708; } } else { - if (--this->field_0x7c.HALF.HI == 0) { + if (--this->unk_7e == 0) { sub_0803B6A4(this); } } } -void sub_0803B2D0(Entity* this) { - Entity* entity; +void sub_0803B2D0(MazaalBraceletEntity* this) { + MazaalBraceletEntity* entity; - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->action = 0x2d; - this->spriteSettings.draw = 0; - entity = *(Entity**)&this->field_0x74; - entity->action = 2; - entity->field_0x74.HALF.LO = 0; - entity->field_0x78.HWORD = 0; - InitializeAnimation(entity, 3); + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->action = 0x2d; + super->spriteSettings.draw = 0; + entity = this->unk_74.entity; + entity->base.action = 2; + entity->unk_74.split.unk_74 = 0; + entity->unk_78.split.unk_78 = 0; + InitializeAnimation(&entity->base, 3); } } -void sub_0803B30C(Entity* this) { +void sub_0803B30C(MazaalBraceletEntity* this) { Entity* entity; - entity = *(Entity**)&this->field_0x74; + entity = &this->unk_74.entity->base; if ((entity->frame & ANIM_DONE) != 0) { - this->action = 0x2e; + super->action = 0x2e; sub_0803B8E8(this, 0x13); InitializeAnimation(entity, 0); } } -void sub_0803B338(Entity* this) { - if (this->z.HALF.HI > -10) { - this->z.HALF.HI--; +void sub_0803B338(MazaalBraceletEntity* this) { + if (super->z.HALF.HI > -10) { + super->z.HALF.HI--; } else { - this->action = 0x2f; - this->timer = 15; + super->action = 0x2f; + super->timer = 15; } } -void sub_0803B35C(Entity* this) { +void sub_0803B35C(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - if (--this->timer == 0) { - this->action = 0x30; + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + if (--super->timer == 0) { + super->action = 0x30; } } -void sub_0803B398(Entity* this) { +void sub_0803B398(MazaalBraceletEntity* this) { s8* ptr; u32 index; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - if (sub_0803B4E4(this) != 0) { - this->action = 0x31; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 4); - InitAnimationForceUpdate(this->child, 0); + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + if (sub_0803B4E4(this)) { + super->action = 0x31; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 4); + InitAnimationForceUpdate(super->child, 0); } else { - LinearMoveUpdate(this); + LinearMoveUpdate(super); } } -void sub_0803B3F4(Entity* this) { +void sub_0803B3F4(MazaalBraceletEntity* this) { u8 value; s8* ptr; u32 index; - Entity* temp; + MazaalBraceletEntity* entity; ptr = gUnk_080CED6C; - index = ((this->parent->subtimer >> 4) + 3); - this->z.HALF.HI = ptr[(index + (u32)this->type * 2) & 7] + 4; - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->hitType = 0x17; - if (this->type == 0) { - this->hitbox = (Hitbox*)&gUnk_080FD35C; + index = ((super->parent->subtimer >> 4) + 3); + super->z.HALF.HI = ptr[(index + (u32)super->type * 2) & 7] + 4; + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + super->hitType = 0x17; + if (super->type == 0) { + super->hitbox = (Hitbox*)&gUnk_080FD35C; } else { - this->hitbox = (Hitbox*)&gUnk_080FD36C; + super->hitbox = (Hitbox*)&gUnk_080FD36C; } - temp = this->parent; - value = (this->type == 0) ? 1 : 2; - temp->field_0x80.HALF.LO &= ~(((this->type == 0) ? 0x10 : 0x20) | value); + entity = (MazaalBraceletEntity*)super->parent; + value = (super->type == 0) ? 1 : 2; + entity->unk_80.HALF.LO &= ~(((super->type == 0) ? 0x10 : 0x20) | value); sub_0803B59C(this); } } -void sub_0803B480(Entity* this) { +void sub_0803B480(MazaalBraceletEntity* this) { Entity* target; - if (((this->field_0x7c.HALF.HI & 0x1f) == 0) && (target = CreateObject(SMOKE, 1, 0), target != (Entity*)0x0)) { - PositionRelative(this, target, Q_16_16(gUnk_080CFD08[this->type]), 0); + if (((this->unk_7e & 0x1f) == 0) && (target = CreateObject(SMOKE, 1, 0), target != NULL)) { + PositionRelative(super, target, Q_16_16(gUnk_080CFD08[super->type]), 0); } - if (--this->field_0x7c.HALF.HI == 0) { + if (--this->unk_7e == 0) { sub_0803B6A4(this); } } -void sub_0803B4D4(Entity* this) { - this->action = 3; - InitializeAnimation(this, 0x10); +void sub_0803B4D4(MazaalBraceletEntity* this) { + super->action = 3; + InitializeAnimation(super, 0x10); } -u32 sub_0803B4E4(Entity* this) { +bool32 sub_0803B4E4(MazaalBraceletEntity* this) { u32 xoff; u32 yoff; - xoff = this->parent->x.HALF.HI + gUnk_080CFD0A[this->type]; - yoff = this->parent->y.HALF.HI + 0x10; - if (EntityWithinDistance(this, xoff, yoff, 2)) { - this->x.HALF.HI = xoff; - this->y.HALF.HI = yoff; - return 1; + xoff = super->parent->x.HALF.HI + gUnk_080CFD0A[super->type]; + yoff = super->parent->y.HALF.HI + 0x10; + if (EntityWithinDistance(super, xoff, yoff, 2)) { + super->x.HALF.HI = xoff; + super->y.HALF.HI = yoff; + return TRUE; } else { - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, xoff, yoff); - return 0; + super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, xoff, yoff); + return FALSE; } } -void sub_0803B538(Entity* this) { - PositionRelative(this, this->child, 0, Q_16_16(-1.0)); - PositionRelative(this, *(Entity**)&this->field_0x74, 0, Q_16_16(-2.0)); +void sub_0803B538(MazaalBraceletEntity* this) { + PositionRelative(super, super->child, 0, Q_16_16(-1.0)); + PositionRelative(super, &this->unk_74.entity->base, 0, Q_16_16(-2.0)); } -void sub_0803B55C(Entity* this) { - Entity* entity; - Entity* pEVar1; +void sub_0803B55C(MazaalBraceletEntity* this) { + Entity* entity1; + Entity* entity2; - pEVar1 = *(Entity**)&this->field_0x74; - entity = this->child; - UpdateAnimationSingleFrame(entity); - if ((entity->frame & 0x10) != 0) { - if (pEVar1->animIndex != 1) { - InitializeAnimation(pEVar1, 1); + entity2 = &this->unk_74.entity->base; + entity1 = super->child; + UpdateAnimationSingleFrame(entity1); + if ((entity1->frame & 0x10) != 0) { + if (entity2->animIndex != 1) { + InitializeAnimation(entity2, 1); } } else { - if (pEVar1->animIndex != 0) { - InitializeAnimation(pEVar1, 0); + if (entity2->animIndex != 0) { + InitializeAnimation(entity2, 0); } } } -void sub_0803B59C(Entity* this) { - this->action = 2; - this->parent->field_0x7c.BYTES.byte1 |= (this->type == 0) ? 1 : 2; +void sub_0803B59C(MazaalBraceletEntity* this) { + super->action = 2; + ((MazaalBraceletEntity*)super->parent)->unk_7c.HALF.HI |= (super->type == 0) ? 1 : 2; } -void sub_0803B5C0(Entity* this) { +void sub_0803B5C0(MazaalBraceletEntity* this) { u32 direction; u32 temp; - direction = GetFacingDirection(this, &gPlayerEntity); + direction = GetFacingDirection(super, &gPlayerEntity); if (direction < 10) { direction = 10; } if (direction > 0x16) { direction = 0x16; } - if (this->type == 0) { + if (super->type == 0) { temp = gUnk_080CFD0C[direction - 10]; } else { temp = gUnk_080CFD0C[0x16 - direction]; } - if (this->frame != temp) { - InitializeAnimation(this, temp); + if (super->frame != temp) { + InitializeAnimation(super, temp); } } -u32 sub_0803B610(Entity* this) { - return EntityWithinDistance(this, gPlayerEntity.x.HALF.HI + gUnk_080CFD19[this->type], +u32 sub_0803B610(MazaalBraceletEntity* this) { + return EntityWithinDistance(super, gPlayerEntity.x.HALF.HI + gUnk_080CFD19[super->type], gPlayerEntity.y.HALF.HI - 0xc, 8); } -// sub_0803B698 was the tail of this function -void sub_0803B63C(Entity* this) { +// sub_0803B698 was the tail of super function +void sub_0803B63C(MazaalBraceletEntity* this) { int y; int x; x = gPlayerEntity.x.HALF.HI; - x += gUnk_080CFD19[this->type]; + x += gUnk_080CFD19[super->type]; y = gPlayerEntity.y.HALF.HI - 0xc; - if (this->timer++ > 180) { - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, x, y); + if (super->timer++ > 180) { + super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, x, y); } else { - sub_08004596(this, CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, x, y)); + sub_08004596(super, CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, x, y)); } } -void sub_0803B6A4(Entity* this) { - Entity* temp; +void sub_0803B6A4(MazaalBraceletEntity* this) { + MazaalBraceletEntity* entity; - this->action = 0x2c; - this->hitType = 0x14; - temp = this->parent; - temp->field_0x80.HALF.LO |= (this->type == 0) ? 0x10 : 0x20; - temp->field_0x80.HALF.LO &= (this->type == 0) ? -5 : -9; - InitializeAnimation(this, 0x17); + super->action = 0x2c; + super->hitType = 0x14; + entity = (MazaalBraceletEntity*)super->parent; + entity->unk_80.HALF.LO |= (super->type == 0) ? 0x10 : 0x20; + entity->unk_80.HALF.LO &= (super->type == 0) ? -5 : -9; + InitializeAnimation(super, 0x17); } -u32 sub_0803B6F4(Entity* this) { - if (this->type == 0) { - if (this->field_0x80.HWORD > this->x.HALF.HI) { - return 1; +bool32 sub_0803B6F4(MazaalBraceletEntity* this) { + if (super->type == 0) { + if (this->unk_80.HWORD > super->x.HALF.HI) { + return TRUE; } } else { - if (this->field_0x80.HWORD < this->x.HALF.HI) { - return 1; + if (this->unk_80.HWORD < super->x.HALF.HI) { + return TRUE; } } - return 0; + return FALSE; } -void sub_0803B724(Entity* param_1) { - Entity* pEVar1; +void sub_0803B724(MazaalBraceletEntity* this) { + Entity* beetle; u32 random_value; u8 temp; - if (((param_1->subtimer < 3) && (param_1->cutsceneBeh.HALF.LO != 0)) && - (pEVar1 = CreateEnemy(BEETLE, 1), pEVar1 != (Entity*)0x0)) { - pEVar1->type2 = 1; + if (((super->subtimer < 3) && (this->unk_84 != 0)) && (beetle = CreateEnemy(BEETLE, 1), beetle != NULL)) { + beetle->type2 = 1; random_value = Random(); - temp = gUnk_080CFD1B[param_1->type]; - pEVar1->x.HALF.HI = (random_value & 0x70) + temp + gRoomControls.origin_x; - pEVar1->y.HALF.HI = ((random_value >> 0x10) & 7) * 10 + 0x5c + gRoomControls.origin_y; - pEVar1->parent = param_1; - ResolveCollisionLayer(pEVar1); - param_1->subtimer++; - param_1->cutsceneBeh.HALF.LO--; + temp = gUnk_080CFD1B[super->type]; + beetle->x.HALF.HI = (random_value & 0x70) + temp + gRoomControls.origin_x; + beetle->y.HALF.HI = ((random_value >> 0x10) & 7) * 10 + 0x5c + gRoomControls.origin_y; + beetle->parent = super; + ResolveCollisionLayer(beetle); + super->subtimer++; + this->unk_84--; } } @@ -1262,28 +1282,28 @@ void sub_0803B798(void) { gPlayerEntity.iframes = -0x1e; } -void sub_0803B804(Entity* this) { +void sub_0803B804(MazaalBraceletEntity* this) { gPlayerEntity.iframes = 30; ModHealth(-4); SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); } -void sub_0803B824(Entity* this) { +void sub_0803B824(MazaalBraceletEntity* this) { ResetActiveItems(); gPlayerState.mobility |= 0x80; - sub_0806FA90(this, &gPlayerEntity, gUnk_080CFD1D[this->type], 1); + sub_0806FA90(super, &gPlayerEntity, gUnk_080CFD1D[super->type], 1); gPlayerEntity.spriteOffsetY = -6; gPlayerEntity.spritePriority.b1 = 0; } -u32 sub_0803B870(Entity* this) { +u32 sub_0803B870(MazaalBraceletEntity* this) { Entity* entity; - entity = this->child; + entity = super->child; if ((entity->contactFlags & 0x80) != 0 && (gPlayerState.flags & PL_CAPTURED)) { - this->action = 0x18; - this->timer = 68; - this->spriteSettings.draw = 0; + super->action = 0x18; + super->timer = 68; + super->spriteSettings.draw = 0; gPlayerEntity.flags &= ~ENT_COLLIDE; gPlayerEntity.iframes = -0x10; sub_0803B824(this); @@ -1297,126 +1317,126 @@ u32 sub_0803B870(Entity* this) { } } -void sub_0803B8E8(Entity* this, u32 unk) { +void sub_0803B8E8(MazaalBraceletEntity* this, u32 unk) { Entity* entity; - entity = this->child; + entity = super->child; entity->hitType = unk; - entity = (*(Entity**)&this->field_0x74); + entity = &this->unk_74.entity->base; entity->hitType = unk; } -void sub_0803B8F8(Entity* this) { - gUnk_080CFD20[this->action](this); +void sub_0803B8F8(MazaalBraceletEntity* this) { + gUnk_080CFD20[super->action](this); } -void sub_0803B910(Entity* this) { +void sub_0803B910(MazaalBraceletEntity* this) { if (gRoomTransition.field_0x38 != 0) { - this->action = 2; - this->spriteSettings.draw = 1; - *(u8*)&this->field_0x74 = 0; + super->action = 2; + super->spriteSettings.draw = 1; + this->unk_74.split.unk_74 = 0; sub_0803BA8C(this, 10); } else { - this->action = 1; - *(u8*)&this->field_0x74 = 0x80; + super->action = 1; + this->unk_74.split.unk_74 = 0x80; } - this->spriteSettings.flipX = (this->type - 2); - InitializeAnimation(this, 0); - CopyPositionAndSpriteOffset(this->parent, this); + super->spriteSettings.flipX = (super->type - 2); + InitializeAnimation(super, 0); + CopyPositionAndSpriteOffset(super->parent, super); } -void sub_0803B978(Entity* this) { - switch (this->subAction) { +void sub_0803B978(MazaalBraceletEntity* this) { + switch (super->subAction) { case 0: return; case 1: - this->subAction = 2; - this->timer = 2; - this->subtimer = 30; - this->field_0x74.HALF.LO = 0; + super->subAction = 2; + super->timer = 2; + super->subtimer = 30; + this->unk_74.split.unk_74 = 0; SoundReq(SFX_1A9); case 2: - sub_0803BA8C(this, this->subtimer); - if ((this->field_0x74.HALF.HI | this->field_0x74.HALF.LO) == 0) { + sub_0803BA8C(this, super->subtimer); + if ((this->unk_74.split.unk_75 | this->unk_74.split.unk_74) == 0) { SoundReq(SFX_1A9); } - if (this->field_0x74.HALF.LO != 0) { + if (this->unk_74.split.unk_74 != 0) { return; } - if (--this->timer != 0) { + if (--super->timer != 0) { return; } - this->timer = 2; - this->subtimer -= 4; - if (this->subtimer != 10) { + super->timer = 2; + super->subtimer -= 4; + if (super->subtimer != 10) { return; } - this->parent->parent->subAction = 3; - this->subAction = 3; + super->parent->parent->subAction = 3; + super->subAction = 3; return; case 3: break; case 4: - this->subAction = 5; - this->spriteSettings.draw = 1; - this->spriteRendering.alphaBlend = 1; + super->subAction = 5; + super->spriteSettings.draw = 1; + super->spriteRendering.alphaBlend = 1; break; default: - this->action = 2; - this->spriteRendering.alphaBlend = 0; + super->action = 2; + super->spriteRendering.alphaBlend = 0; case 5: - GetNextFrame(this); + GetNextFrame(super); } sub_0803BA8C(this, 0x10); - if ((this->field_0x74.HALF.HI | this->field_0x74.HALF.LO) == 0) { + if ((this->unk_74.split.unk_75 | this->unk_74.split.unk_74) == 0) { SoundReq(SFX_1A9); } } -void sub_0803BA6C(Entity* this) { +void sub_0803BA6C(MazaalBraceletEntity* this) { sub_0803BA8C(this, 10); - GetNextFrame(this); + GetNextFrame(super); } -void sub_0803BA80(Entity* this) { +void sub_0803BA80(MazaalBraceletEntity* this) { sub_0803BA8C(this, 10); } -void sub_0803BA8C(Entity* this, u32 unk) { +void sub_0803BA8C(MazaalBraceletEntity* this, u32 unk) { u32 palette; u32 tmp; palette = 0; - tmp = this->field_0x74.HALF.LO & 0xe0; - if ((this->field_0x74.HALF.LO & 0xe0) == 0) { - if (this->field_0x74.HALF.LO == 0) { - if (9 < ++this->field_0x74.HALF.HI) { - this->field_0x74.HALF.HI = 0; + tmp = this->unk_74.split.unk_74 & 0xe0; + if ((this->unk_74.split.unk_74 & 0xe0) == 0) { + if (this->unk_74.split.unk_74 == 0) { + if (9 < ++this->unk_74.split.unk_75) { + this->unk_74.split.unk_75 = 0; } - if (this->type == 2) { - palette = gUnk_080CFD30[this->field_0x74.HALF.HI]; + if (super->type == 2) { + palette = gUnk_080CFD30[this->unk_74.split.unk_75]; } else { - palette = gUnk_080CFD44[this->field_0x74.HALF.HI]; + palette = gUnk_080CFD44[this->unk_74.split.unk_75]; } } - this->field_0x74.HALF.LO++; - if (unk <= this->field_0x74.HALF.LO) { - this->field_0x74.HALF.LO = 0; + this->unk_74.split.unk_74++; + if (unk <= this->unk_74.split.unk_74) { + this->unk_74.split.unk_74 = 0; } } else { if ((tmp & 0x80) == 0) { - this->field_0x74.HALF.LO |= 0x80; + this->unk_74.split.unk_74 |= 0x80; if ((tmp & 0x20) != 0) { - palette = gUnk_080CFD58[this->type - 2]; + palette = gUnk_080CFD58[super->type - 2]; } else { - palette = gUnk_080CFD5C[this->type - 2]; + palette = gUnk_080CFD5C[super->type - 2]; } } } if (palette != 0) { - ChangeObjPalette(this, palette); - (*(Entity**)&this->parent->field_0x78)->palette.b.b0 = this->palette.raw << 0x1c >> 0x1c; - (*(Entity**)&this->parent->field_0x78)->palette.b.b4 = this->palette.b.b0; - this->parent->child->palette.b.b0 = this->palette.raw << 0x1c >> 0x1c; - this->parent->child->palette.b.b4 = this->palette.b.b0; + ChangeObjPalette(super, palette); + ((MazaalBraceletEntity*)super->parent)->unk_78.entity->base.palette.b.b0 = super->palette.raw << 0x1c >> 0x1c; + ((MazaalBraceletEntity*)super->parent)->unk_78.entity->base.palette.b.b4 = super->palette.b.b0; + super->parent->child->palette.b.b0 = super->palette.raw << 0x1c >> 0x1c; + super->parent->child->palette.b.b4 = super->palette.b.b0; } } diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index 12fae4c5..696431ca 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -4,7 +4,7 @@ * * @brief Mazaal Head enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" @@ -12,70 +12,89 @@ #include "roomid.h" #include "screen.h" +typedef struct MazaalHeadEntity_ { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[5]; + /*0x6d*/ u8 unk_6d; + /*0x6e*/ u8 unused2[6]; + /*0x74*/ struct MazaalHeadEntity_* unk_74; + /*0x78*/ struct MazaalHeadEntity_* unk_78; + /*0x7c*/ u8 unk_7c; + /*0x7d*/ u8 unk_7d; + /*0x7e*/ u16 unk_7e; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; +} MazaalHeadEntity; + extern void UnloadOBJPalette(Entity*); -void sub_0803499C(Entity*); -void sub_08034420(Entity*); -void sub_08034830(Entity*); -u32 sub_080349D8(Entity*); -void sub_0803442C(Entity*, u32); -void sub_0803443C(Entity*); -void sub_080347B4(Entity*); -void sub_0803473C(Entity*); -u32 sub_08034A10(Entity*); -void sub_080347FC(Entity*); -void sub_080344BC(Entity*); -void sub_08034498(Entity*); -void sub_08034474(Entity*); -void sub_080345A0(Entity*); -void sub_080345B8(Entity*); -void sub_08034638(Entity*); -void sub_08034618(Entity*); -void sub_08034658(Entity*); -void sub_0803467C(Entity*); -u32 sub_080348A4(Entity*, Entity*, u32); -void sub_08034C00(Entity*); +void sub_0803499C(MazaalHeadEntity*); +void sub_08034420(MazaalHeadEntity*); +void sub_08034830(MazaalHeadEntity*); +bool32 sub_080349D8(MazaalHeadEntity*); +void sub_0803442C(MazaalHeadEntity*, u32); +void sub_0803443C(MazaalHeadEntity*); +void sub_080347B4(MazaalHeadEntity*); +void sub_0803473C(MazaalHeadEntity*); +u32 sub_08034A10(MazaalHeadEntity*); +void sub_080347FC(MazaalHeadEntity*); +void sub_080344BC(MazaalHeadEntity*); +void sub_08034498(MazaalHeadEntity*); +void sub_08034474(MazaalHeadEntity*); +void sub_080345A0(MazaalHeadEntity*); +void sub_080345B8(MazaalHeadEntity*); +void sub_08034638(MazaalHeadEntity*); +void sub_08034618(MazaalHeadEntity*); +void sub_08034658(MazaalHeadEntity*); +void sub_0803467C(MazaalHeadEntity*); +u32 sub_080348A4(MazaalHeadEntity*, MazaalHeadEntity*, u32); +void sub_08034C00(MazaalHeadEntity*); -void MazaalHead_OnTick(Entity* this); -void MazaalHead_OnCollision(Entity* this); -void MazaalHead_OnGrabbed(Entity* this); -void sub_08033F1C(Entity* this); -void sub_08034A84(Entity* this); -void sub_08034AC4(Entity* this); -void sub_08034BC8(Entity* this); -void sub_08033F3C(Entity* this); -void sub_08033FFC(Entity* this); -void sub_0803414C(Entity* this); -void sub_080341B8(Entity* this); -void sub_080341D0(Entity* this); -void sub_080341F4(Entity* this); -void sub_08034210(Entity* this); -void sub_08034240(Entity* this); -void sub_08034274(Entity* this); -void sub_080342A0(Entity* this); -void sub_080342B4(Entity* this); -void sub_080342C8(Entity* this); -void sub_08034348(Entity* this); -void sub_0803438C(Entity* this); -void sub_08034578(Entity* this); -void sub_080344E0(Entity* this); -void sub_0803451C(Entity* this); -void sub_08034558(Entity* this); -void sub_080346A0(Entity* this); -void sub_080345D0(Entity* this); -void sub_080346C8(Entity* this); -void sub_08034AEC(Entity* this); -void sub_08034B0C(Entity* this); -void sub_08034B38(Entity* this); -void sub_08034BA0(Entity* this); +void MazaalHead_OnTick(MazaalHeadEntity* this); +void MazaalHead_OnCollision(MazaalHeadEntity* this); +void MazaalHead_OnGrabbed(MazaalHeadEntity* this); +void sub_08033F1C(MazaalHeadEntity* this); +void sub_08034A84(MazaalHeadEntity* this); +void sub_08034AC4(MazaalHeadEntity* this); +void sub_08034BC8(MazaalHeadEntity* this); +void sub_08033F3C(MazaalHeadEntity* this); +void sub_08033FFC(MazaalHeadEntity* this); +void sub_0803414C(MazaalHeadEntity* this); +void sub_080341B8(MazaalHeadEntity* this); +void sub_080341D0(MazaalHeadEntity* this); +void sub_080341F4(MazaalHeadEntity* this); +void sub_08034210(MazaalHeadEntity* this); +void sub_08034240(MazaalHeadEntity* this); +void sub_08034274(MazaalHeadEntity* this); +void sub_080342A0(MazaalHeadEntity* this); +void sub_080342B4(MazaalHeadEntity* this); +void sub_080342C8(MazaalHeadEntity* this); +void sub_08034348(MazaalHeadEntity* this); +void sub_0803438C(MazaalHeadEntity* this); +void sub_08034578(MazaalHeadEntity* this); +void sub_080344E0(MazaalHeadEntity* this); +void sub_0803451C(MazaalHeadEntity* this); +void sub_08034558(MazaalHeadEntity* this); +void sub_080346A0(MazaalHeadEntity* this); +void sub_080345D0(MazaalHeadEntity* this); +void sub_080346C8(MazaalHeadEntity* this); +void sub_08034AEC(MazaalHeadEntity* this); +void sub_08034B0C(MazaalHeadEntity* this); +void sub_08034B38(MazaalHeadEntity* this); +void sub_08034BA0(MazaalHeadEntity* this); -void (*const MazaalHead_Functions[])(Entity*) = { - MazaalHead_OnTick, MazaalHead_OnCollision, GenericKnockback, GenericDeath, GenericConfused, MazaalHead_OnGrabbed, +void (*const MazaalHead_Functions[])(MazaalHeadEntity*) = { + MazaalHead_OnTick, + MazaalHead_OnCollision, + (void (*)(MazaalHeadEntity*))GenericKnockback, + (void (*)(MazaalHeadEntity*))GenericDeath, + (void (*)(MazaalHeadEntity*))GenericConfused, + MazaalHead_OnGrabbed, }; -void (*const gUnk_080CECA0[])(Entity*) = { +void (*const gUnk_080CECA0[])(MazaalHeadEntity*) = { sub_08033F1C, sub_08034A84, sub_08034AC4, sub_08034AC4, sub_08034BC8, }; -void (*const gUnk_080CECB4[])(Entity*) = { +void (*const gUnk_080CECB4[])(MazaalHeadEntity*) = { sub_08033F3C, sub_08033FFC, sub_0803414C, sub_080341B8, sub_080341D0, sub_080341F4, sub_08034210, sub_08034240, sub_08034274, sub_080342A0, sub_080342B4, sub_080342C8, sub_08034348, sub_0803438C, }; @@ -83,17 +102,17 @@ const u8 gUnk_080CECEC[] = { 0xff, 0xfe, 0xff, 0x00, 0x01, 0x02, 0x01, 0x00 }; const s8 gUnk_080CECF4[] = { -2, 0x01, -8, -4, -0x14, 0x08, 0x0e, -0x10, -6, 0x0c, 0x12, -2, 0x00, 0x00 }; const u8 gUnk_080CED02[] = { FX_GIANT_EXPLOSION, FX_GIANT_EXPLOSION, FX_GIANT_EXPLOSION2, FX_GIANT_EXPLOSION3 }; const u8 gUnk_080CED06[] = { 0xff, 0x00, 0x01, 0x00, 0x00, 0x00 }; -void (*const gUnk_080CED0C[])(Entity*) = { +void (*const gUnk_080CED0C[])(MazaalHeadEntity*) = { sub_08034578, sub_080344E0, sub_0803451C, sub_080344E0, sub_08034558, sub_080344E0, sub_0803451C, sub_080346A0, }; -void (*const gUnk_080CED2C[])(Entity*) = { +void (*const gUnk_080CED2C[])(MazaalHeadEntity*) = { sub_08034578, sub_080345D0, sub_0803451C, sub_080346A0, sub_08034558, sub_080345D0, sub_08034558, sub_080346A0, }; -void (*const gUnk_080CED4C[])(Entity*) = { +void (*const gUnk_080CED4C[])(MazaalHeadEntity*) = { sub_08034578, sub_080345D0, sub_080346C8, sub_080346A0, sub_08034558, sub_080346C8, sub_080346A0, sub_080346C8, }; const s8 gUnk_080CED6C[] = { -0xa, -0xb, -0xc, -0xb, -0xa, -0x9, -0x8, -0x9 }; -void (*const gUnk_080CED74[])(Entity*) = { +void (*const gUnk_080CED74[])(MazaalHeadEntity*) = { sub_08034AEC, sub_08034B0C, sub_08034B38, @@ -107,127 +126,127 @@ const ScreenTransitionData gUnk_080CED9C = { 1, { 0, 0, 0, 0 }, 0x88, 0xf8, 0, AREA_INNER_MAZAAL, ROOM_INNER_MAZAAL_MAIN, 1, 0, 0, 0 }; -void MazaalHead(Entity* this) { - MazaalHead_Functions[GetNextFunction(this)](this); +void MazaalHead(MazaalHeadEntity* this) { + MazaalHead_Functions[GetNextFunction(super)](this); } -void MazaalHead_OnTick(Entity* this) { - gUnk_080CECA0[this->type](this); +void MazaalHead_OnTick(MazaalHeadEntity* this) { + gUnk_080CECA0[super->type](this); } -void MazaalHead_OnCollision(Entity* this) { - EnemyFunctionHandlerAfterCollision(this, MazaalHead_Functions); +void MazaalHead_OnCollision(MazaalHeadEntity* this) { + EnemyFunctionHandlerAfterCollision(super, MazaalHead_Functions); } -void MazaalHead_OnGrabbed(Entity* this) { +void MazaalHead_OnGrabbed(MazaalHeadEntity* this) { } -void sub_08033F1C(Entity* this) { - gUnk_080CECB4[this->action](this); +void sub_08033F1C(MazaalHeadEntity* this) { + gUnk_080CECB4[super->action](this); sub_0803499C(this); } -void sub_08033F3C(Entity* this) { +void sub_08033F3C(MazaalHeadEntity* this) { Entity* pEVar1; Entity* pEVar2; if (gEntCount < 0x43) { if (gRoomTransition.field_0x38 != 0) { sub_08034420(this); - this->field_0x80.HALF.HI = 1; + this->unk_81 = 1; } else { - this->action = 1; + super->action = 1; } - this->spriteSettings.draw = 1; - this->field_0x6c.HALF.HI |= 1; - this->field_0x80.HALF.LO = 0; - InitializeAnimation(this, 0); + super->spriteSettings.draw = 1; + this->unk_6d |= 1; + this->unk_80 = 0; + InitializeAnimation(super, 0); pEVar1 = CreateEnemy(MAZAAL_HEAD, 1); - pEVar1->parent = this; + pEVar1->parent = super; pEVar2 = CreateObject(MAZAAL_OBJECT, 0, 0); - pEVar2->parent = this; + pEVar2->parent = super; if (gRoomTransition.field_0x39 == 0) { - this->action = 0xd; - this->subAction = 0; - this->timer = 252; - COLLISION_OFF(this); + super->action = 0xd; + super->subAction = 0; + super->timer = 252; + COLLISION_OFF(super); } else { pEVar2 = CreateEnemy(MAZAAL_BRACELET, 0); - pEVar2->parent = this; - *(Entity**)&pEVar2->field_0x78 = this; - *(Entity**)&this->field_0x74 = pEVar2; + pEVar2->parent = super; + ((MazaalHeadEntity*)pEVar2)->unk_78 = this; + this->unk_74 = (MazaalHeadEntity*)pEVar2; pEVar2 = CreateEnemy(MAZAAL_BRACELET, 1); - pEVar2->parent = this; - *(Entity**)&pEVar2->field_0x78 = pEVar1; - *(Entity**)&this->field_0x78 = pEVar2; - CreateEnemy(MAZAAL_HEAD, 4)->parent = this; + pEVar2->parent = super; + ((MazaalHeadEntity*)pEVar2)->unk_78 = (MazaalHeadEntity*)pEVar1; + this->unk_78 = (MazaalHeadEntity*)pEVar2; + CreateEnemy(MAZAAL_HEAD, 4)->parent = super; } } } -void sub_08033FFC(Entity* this) { +void sub_08033FFC(MazaalHeadEntity* this) { u16 temp; - Entity* entity; + MazaalHeadEntity* entity; - switch (this->subAction) { + switch (super->subAction) { case 0: case 2: case 5: break; case 1: - this->subAction = 2; - this->timer = 30; - entity = *(Entity**)&(*(Entity**)&this->field_0x74)->field_0x74; - entity->subAction = 1; - entity = *(Entity**)&(*(Entity**)&this->field_0x78)->field_0x74; - entity->subAction = 1; - UnloadOBJPalette(this); + super->subAction = 2; + super->timer = 30; + entity = this->unk_74->unk_74; + entity->base.subAction = 1; + entity = this->unk_78->unk_74; + entity->base.subAction = 1; + UnloadOBJPalette(super); break; case 3: - if (--this->timer == 0) { - this->subAction = 4; + if (--super->timer == 0) { + super->subAction = 4; } break; case 4: - this->z.WORD -= Q_16_16(0.5); - if (this->z.HALF.HI == -10) { - this->subAction = 5; - this->field_0x80.HALF.HI = 1; + super->z.WORD -= Q_16_16(0.5); + if (super->z.HALF.HI == -10) { + super->subAction = 5; + this->unk_81 = 1; } break; case 6: - this->subAction = 7; - this->timer = 0; - entity = *(Entity**)&this->field_0x74; - entity->subAction = 1; - entity = *(Entity**)&entity->field_0x74; - entity->subAction = 4; - entity = *(Entity**)&this->field_0x78; - entity->subAction = 1; - entity = *(Entity**)&entity->field_0x74; - entity->subAction = 4; + super->subAction = 7; + super->timer = 0; + entity = this->unk_74; + entity->base.subAction = 1; + entity = entity->unk_74; + entity->base.subAction = 4; + entity = this->unk_78; + entity->base.subAction = 1; + entity = entity->unk_74; + entity->base.subAction = 4; gScreen.controls.layerFXControl = 0xf40; gScreen.controls.alphaBlend = 0x1000; break; case 7: - temp = ++this->timer >> 1; + temp = ++super->timer >> 1; gScreen.controls.alphaBlend = (temp) | (0x10 - (temp)) * 0x100; - if (this->timer > 31) { - this->subAction = 8; - entity = *(Entity**)&this->field_0x74; - entity->subAction = 3; - entity = *(Entity**)&entity->field_0x74; - entity->subAction = 6; - entity = *(Entity**)&this->field_0x78; - entity->subAction = 3; - entity = *(Entity**)&entity->field_0x74; - entity->subAction = 6; - this->spriteRendering.alphaBlend = 0; + if (super->timer > 31) { + super->subAction = 8; + entity = this->unk_74; + entity->base.subAction = 3; + entity = entity->unk_74; + entity->base.subAction = 6; + entity = this->unk_78; + entity->base.subAction = 3; + entity = entity->unk_74; + entity->base.subAction = 6; + super->spriteRendering.alphaBlend = 0; gScreen.controls.layerFXControl = 0; } break; default: - if (((*(Entity**)&this->field_0x74)->flags & ENT_COLLIDE) != 0) { + if (((this->unk_74)->base.flags & ENT_COLLIDE) != 0) { gRoomControls.camera_target = &gPlayerEntity; sub_08034420(this); gPlayerState.controlMode = CONTROL_1; @@ -237,66 +256,66 @@ void sub_08033FFC(Entity* this) { } } -void sub_0803414C(Entity* this) { +void sub_0803414C(MazaalHeadEntity* this) { u32 x, y; x = gRoomControls.origin_x + 0xb8; y = gRoomControls.origin_y + 0x48; - if (this->x.HALF.HI - x + 1 < 3 && this->y.HALF.HI - y + 1 < 3) { + if (super->x.HALF.HI - x + 1 < 3 && super->y.HALF.HI - y + 1 < 3) { if (sub_080349D8(this)) { - if (this->subAction != 0) { - this->subAction = 0; + if (super->subAction != 0) { + super->subAction = 0; sub_0803442C(this, 0x1e); } else { sub_0803442C(this, 0x5a); } } } else { - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, x, y); - LinearMoveUpdate(this); + super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, x, y); + LinearMoveUpdate(super); } } -void sub_080341B8(Entity* this) { - if (sub_080349D8(this) != 0) { +void sub_080341B8(MazaalHeadEntity* this) { + if (sub_080349D8(this)) { sub_0803442C(this, 0x2d); } } -void sub_080341D0(Entity* this) { - if (((this->field_0x80.HALF.LO & 3) != 3) && (--this->timer == 0)) { +void sub_080341D0(MazaalHeadEntity* this) { + if (((this->unk_80 & 3) != 3) && (--super->timer == 0)) { sub_0803443C(this); } } -void sub_080341F4(Entity* this) { +void sub_080341F4(MazaalHeadEntity* this) { sub_080347B4(this); - if (sub_080349D8(this) != 0) { + if (sub_080349D8(this)) { sub_08034420(this); } } -void sub_08034210(Entity* this) { +void sub_08034210(MazaalHeadEntity* this) { sub_080347B4(this); - if ((this->field_0x7c.BYTES.byte1 & 0x80) != 0 && sub_080349D8(this) != 0) { + if ((this->unk_7d & 0x80) != 0 && sub_080349D8(this)) { sub_08034420(this); } else { sub_08034830(this); } } -void sub_08034240(Entity* this) { - if ((this->field_0x7c.HALF_U.HI != 0) && (--this->field_0x7c.HALF_U.HI < 0x96)) { +void sub_08034240(MazaalHeadEntity* this) { + if ((this->unk_7e != 0) && (--this->unk_7e < 0x96)) { sub_0803473C(this); } - if (sub_080349D8(this) != 0) { + if (sub_080349D8(this)) { sub_08034420(this); } } -void sub_08034274(Entity* this) { - if (sub_080349D8(this) != 0) { +void sub_08034274(MazaalHeadEntity* this) { + if (sub_080349D8(this)) { sub_08034420(this); } else { sub_0803473C(this); @@ -306,67 +325,67 @@ void sub_08034274(Entity* this) { } } -void sub_080342A0(Entity* this) { - if (sub_080349D8(this) != 0) { +void sub_080342A0(MazaalHeadEntity* this) { + if (sub_080349D8(this)) { sub_08034420(this); } } -void sub_080342B4(Entity* this) { - if (this->field_0x7c.HALF_U.HI == 0xff) { +void sub_080342B4(MazaalHeadEntity* this) { + if (this->unk_7e == 0xff) { sub_08034420(this); } } -void sub_080342C8(Entity* this) { - if (this->timer != 0) { - if (--this->timer == 0) { +void sub_080342C8(MazaalHeadEntity* this) { + if (super->timer != 0) { + if (--super->timer == 0) { SoundReq(SFX_115); } - this->spriteOffsetX = gUnk_080CECEC[this->timer >> 1 & 7]; + super->spriteOffsetX = gUnk_080CECEC[super->timer >> 1 & 7]; } else { - this->spriteOffsetX = 0; - if (GravityUpdate(this, Q_8_8(32.0)) == 0) { - this->action = 0xc; - this->field_0x7c.HALF.HI = 0x708; - this->field_0x7c.BYTES.byte1 = 0; - this->field_0x80.HALF.HI = 0; + super->spriteOffsetX = 0; + if (GravityUpdate(super, Q_8_8(32.0)) == 0) { + super->action = 0xc; + this->unk_7e = 0x708; + this->unk_7d = 0; + this->unk_81 = 0; InitScreenShake(30, 0); SoundReq(SFX_1A1); } } } -void sub_08034348(Entity* this) { - if (this->field_0x7c.HALF_U.HI != 0) { - this->field_0x7c.HALF.HI--; +void sub_08034348(MazaalHeadEntity* this) { + if (this->unk_7e != 0) { + this->unk_7e--; } else { - if (this->z.HALF.HI > -10) { - this->z.HALF.HI--; + if (super->z.HALF.HI > -10) { + super->z.HALF.HI--; } else { - if (sub_080349D8(this) != 0) { - this->field_0x80.HALF.HI = 1; + if (sub_080349D8(this)) { + this->unk_81 = 1; sub_08034420(this); } } } } -void sub_0803438C(Entity* this) { +void sub_0803438C(MazaalHeadEntity* this) { Entity* pEVar3; const s8* pVar; - if (this->timer == 0) { - this->health = 0; + if (super->timer == 0) { + super->health = 0; } else { - this->timer--; - if (this->timer > 192) { - this->spriteOffsetX = gUnk_080CED06[this->timer & 3]; + super->timer--; + if (super->timer > 192) { + super->spriteOffsetX = gUnk_080CED06[super->timer & 3]; } else { - if ((this->timer & 0x1f) == 0) { - pEVar3 = CreateFx(this, gUnk_080CED02[Random() & 3], 0); + if ((super->timer & 0x1f) == 0) { + pEVar3 = CreateFx(super, gUnk_080CED02[Random() & 3], 0); if (pEVar3 != NULL) { - pVar = &gUnk_080CECF4[this->timer >> 4]; + pVar = &gUnk_080CECF4[super->timer >> 4]; pEVar3->x.HALF.HI = *pVar + pEVar3->x.HALF.HI; pVar++; pEVar3->y.HALF.HI = *pVar + pEVar3->y.HALF.HI; @@ -377,19 +396,19 @@ void sub_0803438C(Entity* this) { } } -void sub_08034420(Entity* this) { - this->action = 2; - this->field_0x7c.BYTES.byte1 = 3; +void sub_08034420(MazaalHeadEntity* this) { + super->action = 2; + this->unk_7d = 3; } -void sub_0803442C(Entity* this, u32 unk) { - this->action = 4; - this->timer = unk; - this->field_0x7c.BYTES.byte1 = 3; +void sub_0803442C(MazaalHeadEntity* this, u32 unk) { + super->action = 4; + super->timer = unk; + this->unk_7d = 3; } -void sub_0803443C(Entity* this) { - this->field_0x7c.BYTES.byte1 = 0; +void sub_0803443C(MazaalHeadEntity* this) { + this->unk_7d = 0; if (gRoomTransition.field_0x39 < 0x1f) { sub_080344BC(this); } else { @@ -401,26 +420,26 @@ void sub_0803443C(Entity* this) { } } -void sub_08034474(Entity* this) { - gUnk_080CED0C[this->field_0x7c.BYTES.byte0](this); - this->field_0x7c.BYTES.byte0 = (this->field_0x7c.BYTES.byte0 + 1) & 7; +void sub_08034474(MazaalHeadEntity* this) { + gUnk_080CED0C[this->unk_7c](this); + this->unk_7c = (this->unk_7c + 1) & 7; } -void sub_08034498(Entity* this) { - gUnk_080CED2C[this->field_0x7c.BYTES.byte0](this); - this->field_0x7c.BYTES.byte0 = (this->field_0x7c.BYTES.byte0 + 1) & 7; +void sub_08034498(MazaalHeadEntity* this) { + gUnk_080CED2C[this->unk_7c](this); + this->unk_7c = (this->unk_7c + 1) & 7; } -void sub_080344BC(Entity* this) { - gUnk_080CED4C[this->field_0x7c.BYTES.byte0](this); - this->field_0x7c.BYTES.byte0 = (this->field_0x7c.BYTES.byte0 + 1) & 7; +void sub_080344BC(MazaalHeadEntity* this) { + gUnk_080CED4C[this->unk_7c](this); + this->unk_7c = (this->unk_7c + 1) & 7; } -void sub_080344E0(Entity* this) { - if ((this->field_0x80.HALF.LO & 5) != 0) { +void sub_080344E0(MazaalHeadEntity* this) { + if ((this->unk_80 & 5) != 0) { sub_080345A0(this); } else { - if ((this->field_0x80.HALF.LO & 10) != 0 || (Random() & 1) != 0) { + if ((this->unk_80 & 10) != 0 || (Random() & 1) != 0) { sub_080345B8(this); } else { sub_080345A0(this); @@ -428,10 +447,10 @@ void sub_080344E0(Entity* this) { } } -void sub_0803451C(Entity* this) { - if ((this->field_0x80.HALF.LO & 5) != 0) { +void sub_0803451C(MazaalHeadEntity* this) { + if ((this->unk_80 & 5) != 0) { sub_08034618(this); - } else if ((this->field_0x80.HALF.LO & 10) != 0) { + } else if ((this->unk_80 & 10) != 0) { sub_08034638(this); } else if ((Random() & 1) != 0) { sub_08034618(this); @@ -440,7 +459,7 @@ void sub_0803451C(Entity* this) { } } -void sub_08034558(Entity* this) { +void sub_08034558(MazaalHeadEntity* this) { if ((Random() & 1) != 0) { sub_08034658(this); } else { @@ -448,231 +467,231 @@ void sub_08034558(Entity* this) { } } -void sub_08034578(Entity* this) { - this->action = 3; - this->field_0x7c.BYTES.byte1 = 0; - sub_080348A4(this, *(Entity**)&this->field_0x74, 0); - sub_080348A4(this, *(Entity**)&this->field_0x78, 0); +void sub_08034578(MazaalHeadEntity* this) { + super->action = 3; + this->unk_7d = 0; + sub_080348A4(this, this->unk_74, 0); + sub_080348A4(this, this->unk_78, 0); } -void sub_080345A0(Entity* this) { - this->action = 5; - this->field_0x7c.BYTES.byte1 = 1; - sub_080348A4(this, *(Entity**)&this->field_0x78, 1); +void sub_080345A0(MazaalHeadEntity* this) { + super->action = 5; + this->unk_7d = 1; + sub_080348A4(this, this->unk_78, 1); } -void sub_080345B8(Entity* this) { - this->action = 5; - this->field_0x7c.BYTES.byte1 = 2; - sub_080348A4(this, *(Entity**)&this->field_0x74, 1); +void sub_080345B8(MazaalHeadEntity* this) { + super->action = 5; + this->unk_7d = 2; + sub_080348A4(this, this->unk_74, 1); } -void sub_080345D0(Entity* this) { - this->action = 6; +void sub_080345D0(MazaalHeadEntity* this) { + super->action = 6; if ((Random() & 1) != 0) { - if (sub_080348A4(this, *(Entity**)&this->field_0x74, 2) == 0) { - sub_080348A4(this, *(Entity**)&this->field_0x78, 2); + if (sub_080348A4(this, this->unk_74, 2) == 0) { + sub_080348A4(this, this->unk_78, 2); } } else { - if (sub_080348A4(this, *(Entity**)&this->field_0x78, 2) == 0) { - sub_080348A4(this, *(Entity**)&this->field_0x74, 2); + if (sub_080348A4(this, this->unk_78, 2) == 0) { + sub_080348A4(this, this->unk_74, 2); } } } -void sub_08034618(Entity* this) { - this->action = 7; - this->field_0x7c.BYTES.byte1 = 1; - this->field_0x7c.HALF.HI = 0xb4; - sub_080348A4(this, *(Entity**)&this->field_0x78, 3); +void sub_08034618(MazaalHeadEntity* this) { + super->action = 7; + this->unk_7d = 1; + this->unk_7e = 0xb4; + sub_080348A4(this, this->unk_78, 3); } -void sub_08034638(Entity* this) { - this->action = 7; - this->field_0x7c.BYTES.byte1 = 2; - this->field_0x7c.HALF.HI = 0xb4; - sub_080348A4(this, *(Entity**)&this->field_0x74, 3); +void sub_08034638(MazaalHeadEntity* this) { + super->action = 7; + this->unk_7d = 2; + this->unk_7e = 0xb4; + sub_080348A4(this, this->unk_74, 3); } -void sub_08034658(Entity* this) { - this->action = 8; - this->field_0x7c.BYTES.byte1 = 0; - if (sub_080348A4(this, *(Entity**)&this->field_0x78, 4) == 0) { - this->field_0x7c.BYTES.byte1 |= 0x40; +void sub_08034658(MazaalHeadEntity* this) { + super->action = 8; + this->unk_7d = 0; + if (sub_080348A4(this, this->unk_78, 4) == 0) { + this->unk_7d |= 0x40; } } -void sub_0803467C(Entity* this) { - this->action = 8; - this->field_0x7c.BYTES.byte1 = 0; - if (sub_080348A4(this, *(Entity**)&this->field_0x74, 4) == 0) { - this->field_0x7c.BYTES.byte1 |= 0x40; +void sub_0803467C(MazaalHeadEntity* this) { + super->action = 8; + this->unk_7d = 0; + if (sub_080348A4(this, this->unk_74, 4) == 0) { + this->unk_7d |= 0x40; } } -void sub_080346A0(Entity* this) { - this->action = 9; - this->field_0x7c.BYTES.byte1 = 0; - sub_080348A4(this, *(Entity**)&this->field_0x74, 6); - sub_080348A4(this, *(Entity**)&this->field_0x78, 6); +void sub_080346A0(MazaalHeadEntity* this) { + super->action = 9; + this->unk_7d = 0; + sub_080348A4(this, this->unk_74, 6); + sub_080348A4(this, this->unk_78, 6); } -void sub_080346C8(Entity* this) { - Entity* hand; +void sub_080346C8(MazaalHeadEntity* this) { + MazaalHeadEntity* hand; - this->action = 10; - this->field_0x7c.HALF.HI = 0; + super->action = 10; + this->unk_7e = 0; if ((Random() & 1) != 0) { - if (sub_080348A4(this, *(Entity**)&this->field_0x74, 8) != 0) { - hand = *(Entity**)&this->field_0x78; + if (sub_080348A4(this, this->unk_74, 8) != 0) { + hand = this->unk_78; sub_080348A4(this, hand, 7); } else { - sub_080348A4(this, *(Entity**)&this->field_0x74, 7); - sub_080348A4(this, *(Entity**)&this->field_0x78, 8); + sub_080348A4(this, this->unk_74, 7); + sub_080348A4(this, this->unk_78, 8); } } else { - if (sub_080348A4(this, *(Entity**)&this->field_0x78, 8) != 0) { - hand = *(Entity**)&this->field_0x74; + if (sub_080348A4(this, this->unk_78, 8) != 0) { + hand = this->unk_74; sub_080348A4(this, hand, 7); } else { - sub_080348A4(this, *(Entity**)&this->field_0x74, 8); - sub_080348A4(this, *(Entity**)&this->field_0x78, 7); + sub_080348A4(this, this->unk_74, 8); + sub_080348A4(this, this->unk_78, 7); } } } -void sub_0803473C(Entity* this) { +void sub_0803473C(MazaalHeadEntity* this) { u32 playerX; u32 roomX; - if ((this->field_0x7c.BYTES.byte1 & 0x10) != 0) { - if (0x28 < (*(Entity**)&this->field_0x74)->action) { + if ((this->unk_7d & 0x10) != 0) { + if (0x28 < (this->unk_74)->base.action) { return; } playerX = gPlayerEntity.x.HALF.HI - 0x60; } else { - if (0x28 < (*(Entity**)&this->field_0x78)->action) { + if (0x28 < (this->unk_78)->base.action) { return; } playerX = gPlayerEntity.x.HALF.HI + 0x60; } roomX = gRoomControls.origin_x; - if (playerX - 4 > this->x.HALF.HI) { - if (roomX + 0xe0 < this->x.HALF.HI) { + if (playerX - 4 > super->x.HALF.HI) { + if (roomX + 0xe0 < super->x.HALF.HI) { return; } - this->direction = DirectionEast; + super->direction = DirectionEast; } else { - if (playerX + 4 >= this->x.HALF.HI) { + if (playerX + 4 >= super->x.HALF.HI) { return; } - if (roomX + 0x90 > this->x.HALF.HI) { + if (roomX + 0x90 > super->x.HALF.HI) { return; } - this->direction = DirectionWest; + super->direction = DirectionWest; } - LinearMoveUpdate(this); + LinearMoveUpdate(super); } -void sub_080347B4(Entity* this) { +void sub_080347B4(MazaalHeadEntity* this) { u32 playerX = gPlayerEntity.x.HALF.HI; u32 roomX = gRoomControls.origin_x; - if (playerX - 4 > this->x.HALF.HI) { - if (roomX + 0xe0 < this->x.HALF.HI) { + if (playerX - 4 > super->x.HALF.HI) { + if (roomX + 0xe0 < super->x.HALF.HI) { return; } - this->direction = DirectionEast; + super->direction = DirectionEast; } else { - if (playerX + 4 >= this->x.HALF.HI) { + if (playerX + 4 >= super->x.HALF.HI) { return; } - if (roomX + 0x90 > this->x.HALF.HI) { + if (roomX + 0x90 > super->x.HALF.HI) { return; } - this->direction = DirectionWest; + super->direction = DirectionWest; } - LinearMoveUpdate(this); + LinearMoveUpdate(super); } -void sub_080347FC(Entity* this) { - if ((this->field_0x7c.BYTES.byte1 & 0x10) != 0) { - sub_080348A4(this, *(Entity**)&this->field_0x78, 5); +void sub_080347FC(MazaalHeadEntity* this) { + if ((this->unk_7d & 0x10) != 0) { + sub_080348A4(this, this->unk_78, 5); } else { - sub_080348A4(this, *(Entity**)&this->field_0x74, 5); + sub_080348A4(this, this->unk_74, 5); } - this->field_0x7c.BYTES.byte1 |= 0x20; + this->unk_7d |= 0x20; } -void sub_08034830(Entity* this) { - if (sub_080349D8(this) != 0) { - this->field_0x7c.BYTES.byte1 = 0x80; +void sub_08034830(MazaalHeadEntity* this) { + if (sub_080349D8(this)) { + this->unk_7d = 0x80; sub_080345D0(this); } else { if (sub_08034A10(this) != 0) { - if ((this->field_0x80.HALF.LO & 0xf) != 0) { - if (sub_080349D8(this) != 0) { + if ((this->unk_80 & 0xf) != 0) { + if (sub_080349D8(this)) { sub_08034420(this); } } else { - this->field_0x7c.BYTES.byte1 |= 0x20; - if ((this->field_0x7c.BYTES.byte1 & 0x10) != 0) { - sub_080348A4(this, *(Entity**)&this->field_0x78, 2); + this->unk_7d |= 0x20; + if ((this->unk_7d & 0x10) != 0) { + sub_080348A4(this, this->unk_78, 2); } else { - sub_080348A4(this, *(Entity**)&this->field_0x74, 2); + sub_080348A4(this, this->unk_74, 2); } } } } } -u32 sub_080348A4(Entity* this, Entity* hand_, u32 unk) { +u32 sub_080348A4(MazaalHeadEntity* this, MazaalHeadEntity* hand_, u32 unk) { u32 bVar1; - if (hand_->type == 0) { + if (hand_->base.type == 0) { bVar1 = 5; - this->field_0x7c.BYTES.byte1 |= 0x10; + this->unk_7d |= 0x10; } else { bVar1 = 10; } - if (this->field_0x80.HALF.LO & bVar1) { - this->field_0x7c.BYTES.byte1 |= (hand_->type == 0) ? 1 : 2; + if (this->unk_80 & bVar1) { + this->unk_7d |= (hand_->base.type == 0) ? 1 : 2; return 0; } else { switch (unk) { case 0: - hand_->action = 3; + hand_->base.action = 3; break; case 1: - hand_->action = 4; - hand_->field_0x7c.BYTES.byte0 = 3; + hand_->base.action = 4; + hand_->unk_7c = 3; break; case 2: case 4: - hand_->action = 4; - hand_->field_0x7c.BYTES.byte0 = 1; + hand_->base.action = 4; + hand_->unk_7c = 1; break; case 3: - hand_->action = 0xf; - hand_->field_0x7c.HALF.HI = 0xb4; + hand_->base.action = 0xf; + hand_->unk_7e = 0xb4; break; case 5: - hand_->action = 0xf; - hand_->field_0x7c.HALF.HI = 1; + hand_->base.action = 0xf; + hand_->unk_7e = 1; break; case 6: - hand_->action = 0x1e; + hand_->base.action = 0x1e; break; case 7: - hand_->action = 0x1b; - hand_->flags = hand_->flags & ~ENT_COLLIDE; - InitializeAnimation(hand_, 5); + hand_->base.action = 0x1b; + hand_->base.flags = hand_->base.flags & ~ENT_COLLIDE; + InitializeAnimation(&hand_->base, 5); break; case 8: - bVar1 = hand_->type + 2; - hand_ = CreateEnemy(MAZAAL_HEAD, bVar1); + bVar1 = hand_->base.type + 2; + hand_ = (MazaalHeadEntity*)CreateEnemy(MAZAAL_HEAD, bVar1); if (hand_ != NULL) { - hand_->parent = this; + hand_->base.parent = super; } break; default: @@ -682,47 +701,47 @@ u32 sub_080348A4(Entity* this, Entity* hand_, u32 unk) { } } -void sub_0803499C(Entity* this) { - if (((this->field_0x80.HALF.LO & 0xc) != 0xc) && (this->field_0x80.HALF.HI != 0)) { - this->z.HALF.HI = gUnk_080CED6C[(++this->subtimer >> 4) & 7]; +void sub_0803499C(MazaalHeadEntity* this) { + if (((this->unk_80 & 0xc) != 0xc) && (this->unk_81 != 0)) { + super->z.HALF.HI = gUnk_080CED6C[(++super->subtimer >> 4) & 7]; } } -u32 sub_080349D8(Entity* this) { - // this feels like a switch, but I couldn't get it to match as one - if ((this->field_0x7c.BYTES.byte1 & 3) == 3) { - return 1; +bool32 sub_080349D8(MazaalHeadEntity* this) { + // super feels like a switch, but I couldn't get it to match as one + if ((this->unk_7d & 3) == 3) { + return TRUE; } else { - if ((this->field_0x7c.BYTES.byte1 & 3) == 1) { - if (this->field_0x80.HALF.LO & 10) - return 1; + if ((this->unk_7d & 3) == 1) { + if (this->unk_80 & 10) + return TRUE; } else { - if ((this->field_0x7c.BYTES.byte1 & 3) == 2) { - if (this->field_0x80.HALF.LO & 5) - return 1; + if ((this->unk_7d & 3) == 2) { + if (this->unk_80 & 5) + return TRUE; } } - return 0; + return FALSE; } } -u32 sub_08034A10(Entity* this) { - if ((this->field_0x7c.BYTES.byte1 & 0x60) != 0x40) { - if ((this->field_0x7c.BYTES.byte1 & 0x10) != 0) { - if ((this->field_0x80.HALF.LO & 5) != 0) { - this->field_0x7c.BYTES.byte1 |= 0x40; +u32 sub_08034A10(MazaalHeadEntity* this) { + if ((this->unk_7d & 0x60) != 0x40) { + if ((this->unk_7d & 0x10) != 0) { + if ((this->unk_80 & 5) != 0) { + this->unk_7d |= 0x40; } - if (((this->field_0x80.HALF.LO & 10) != 0) && ((this->field_0x7c.BYTES.byte1 & 3) == 1)) { + if (((this->unk_80 & 10) != 0) && ((this->unk_7d & 3) == 1)) { return 1; } } else { - if ((this->field_0x80.HALF.LO & 10) != 0) { - this->field_0x7c.BYTES.byte1 |= 0x40; + if ((this->unk_80 & 10) != 0) { + this->unk_7d |= 0x40; } - if ((this->field_0x80.HALF.LO & 5) == 0) { + if ((this->unk_80 & 5) == 0) { return 0; } - if ((this->field_0x7c.BYTES.byte1 & 3) == 2) { + if ((this->unk_7d & 3) == 2) { return 1; } } @@ -732,91 +751,91 @@ u32 sub_08034A10(Entity* this) { return 0; } -void sub_08034A84(Entity* this) { - if (this->parent->next == NULL) { - DeleteEntity(this); +void sub_08034A84(MazaalHeadEntity* this) { + if (super->parent->next == NULL) { + DeleteEntity(super); } else { - if (this->action == 0) { - this->action = 1; - this->spriteSettings.draw = 1; - this->spriteSettings.flipX = 1; - InitializeAnimation(this, 0); + if (super->action == 0) { + super->action = 1; + super->spriteSettings.draw = 1; + super->spriteSettings.flipX = 1; + InitializeAnimation(super, 0); } - CopyPositionAndSpriteOffset(this->parent, this); + CopyPositionAndSpriteOffset(super->parent, super); } } -void sub_08034AC4(Entity* this) { - PositionRelative(this->parent, this, 0, Q_16_16(1.0)); - gUnk_080CED74[this->action](this); +void sub_08034AC4(MazaalHeadEntity* this) { + PositionRelative(super->parent, super, 0, Q_16_16(1.0)); + gUnk_080CED74[super->action](this); } -void sub_08034AEC(Entity* this) { - this->action = 1; - this->timer = 30; - InitializeAnimation(this, this->type + 1); +void sub_08034AEC(MazaalHeadEntity* this) { + super->action = 1; + super->timer = 30; + InitializeAnimation(super, super->type + 1); SoundReq(SFX_151); } -void sub_08034B0C(Entity* this) { - if (this->timer != 0) { - this->timer--; +void sub_08034B0C(MazaalHeadEntity* this) { + if (super->timer != 0) { + super->timer--; } else { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) == 0) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) == 0) { return; } - this->action = 2; - this->timer = 80; + super->action = 2; + super->timer = 80; } } -void sub_08034B38(Entity* this) { +void sub_08034B38(MazaalHeadEntity* this) { Entity* target; const s8* ptr; - if (--this->timer == 0) { - this->action = 3; - InitializeAnimation(this, this->type + 3); + if (--super->timer == 0) { + super->action = 3; + InitializeAnimation(super, super->type + 3); } else { target = CreateProjectile(MAZAAL_ENERGY_BEAM); if (target != NULL) { - target->type = this->type - 2; + target->type = super->type - 2; if (target->type == 0) { - target->direction = 0xa8 - this->timer; + target->direction = 0xa8 - super->timer; } else { - target->direction = this->timer + 0x58; + target->direction = super->timer + 0x58; } ptr = &gUnk_080CED84[target->type * 2]; - PositionRelative(this, target, Q_16_16(*(ptr++)), Q_16_16(*ptr)); + PositionRelative(super, target, Q_16_16(*(ptr++)), Q_16_16(*ptr)); } } } -void sub_08034BA0(Entity* this) { - GetNextFrame(this); - if ((this->frame & ANIM_DONE) != 0) { - this->parent->field_0x7c.HALF.HI = 0xff; - DeleteEntity(this); +void sub_08034BA0(MazaalHeadEntity* this) { + GetNextFrame(super); + if ((super->frame & ANIM_DONE) != 0) { + ((MazaalHeadEntity*)super->parent)->unk_7e = 0xff; + DeleteEntity(super); } } -void sub_08034BC8(Entity* this) { - if (this->action == 0) { - this->action = 1; - InitializeAnimation(this, 1); +void sub_08034BC8(MazaalHeadEntity* this) { + if (super->action == 0) { + super->action = 1; + InitializeAnimation(super, 1); } - sub_0806FA90(this->parent, this, 0, 1); - sub_0800445C(this); - if (this->z.HALF.HI == 0) { + sub_0806FA90(super->parent, super, 0, 1); + sub_0800445C(super); + if (super->z.HALF.HI == 0) { sub_08034C00(this); } } -void sub_08034C00(Entity* this) { +void sub_08034C00(MazaalHeadEntity* this) { if (((gPlayerState.flags & PL_MINISH) != 0) && - CheckPlayerInRegion(this->x.HALF.HI - gRoomControls.origin_x, this->y.HALF.HI - gRoomControls.origin_y + 0xd, 3, - 3) != 0) { + CheckPlayerInRegion(super->x.HALF.HI - gRoomControls.origin_x, super->y.HALF.HI - gRoomControls.origin_y + 0xd, + 3, 3) != 0) { if (gRoomTransition.field_0x39 >= 0x3d) { DoExitTransition(&gUnk_080CED88); } else { diff --git a/src/enemy/mazaalMacro.c b/src/enemy/mazaalMacro.c index 51e29b6d..7eb086e3 100644 --- a/src/enemy/mazaalMacro.c +++ b/src/enemy/mazaalMacro.c @@ -46,7 +46,11 @@ void sub_08034EE4(MazaalMacroEntity* this); void sub_08034F58(MazaalMacroEntity* this); void (*const MazaalMacro_Functions[])(MazaalMacroEntity*) = { - MazaalMacro_OnTick, MazaalMacro_OnCollision, (void (*)(MazaalMacroEntity*))GenericKnockback, MazaalMacro_OnDeath, (void (*)(MazaalMacroEntity*))GenericConfused, + MazaalMacro_OnTick, + MazaalMacro_OnCollision, + (void (*)(MazaalMacroEntity*))GenericKnockback, + MazaalMacro_OnDeath, + (void (*)(MazaalMacroEntity*))GenericConfused, }; void (*const gUnk_080CEEA4[])(MazaalMacroEntity*) = { sub_08034CC4, diff --git a/src/enemy/miniFireballGuy.c b/src/enemy/miniFireballGuy.c index b72a3350..3899733e 100644 --- a/src/enemy/miniFireballGuy.c +++ b/src/enemy/miniFireballGuy.c @@ -23,8 +23,12 @@ void sub_08045618(MiniFireballGuyEntity* this); void sub_08045654(MiniFireballGuyEntity* this); static void (*const MiniFireballGuy_Functions[])(MiniFireballGuyEntity*) = { - MiniFireballGuy_OnTick, MiniFireballGuy_OnCollision, (void (*)(MiniFireballGuyEntity*))GenericKnockback, MiniFireballGuy_OnDeath, - (void (*)(MiniFireballGuyEntity*))GenericConfused, MiniFireballGuy_OnGrabbed, + MiniFireballGuy_OnTick, + MiniFireballGuy_OnCollision, + (void (*)(MiniFireballGuyEntity*))GenericKnockback, + MiniFireballGuy_OnDeath, + (void (*)(MiniFireballGuyEntity*))GenericConfused, + MiniFireballGuy_OnGrabbed, }; void MiniFireballGuy(MiniFireballGuyEntity* this) { diff --git a/src/enemy/miniSlime.c b/src/enemy/miniSlime.c index 45108259..2fb18dec 100644 --- a/src/enemy/miniSlime.c +++ b/src/enemy/miniSlime.c @@ -27,7 +27,12 @@ void sub_080452FC(MiniSlimeEntity* this); extern void ReplaceMonitoredEntity(Entity*, Entity*); static void (*const MiniSlime_Functions[])(MiniSlimeEntity*) = { - MiniSlime_OnTick, MiniSlime_OnCollision, (void (*)(MiniSlimeEntity*))GenericKnockback, MiniSlime_OnDeath, (void (*)(MiniSlimeEntity*))GenericConfused, MiniSlime_OnGrabbed, + MiniSlime_OnTick, + MiniSlime_OnCollision, + (void (*)(MiniSlimeEntity*))GenericKnockback, + MiniSlime_OnDeath, + (void (*)(MiniSlimeEntity*))GenericConfused, + MiniSlime_OnGrabbed, }; void MiniSlime(MiniSlimeEntity* this) { diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index ebf72095..da9d17a2 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -4,240 +4,271 @@ * * @brief Moldorm enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" -void sub_08022EAC(Entity*); -void sub_08022F14(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u16 unk_74; + /*0x76*/ u16 unk_76; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; + /*0x7a*/ u8 unk_7a; + /*0x7b*/ u8 unk_7b; + union { + /*0x7c*/ Entity* entity; + struct { + /*0x7c*/ u8 unk_7c; + /*0x7d*/ u8 unk_7d; + /*0x7e*/ u8 unk_7e; + /*0x7f*/ u8 unk_7f; + } split; + } unk_7c; + union { + /*0x80*/ Entity* entity; + struct { + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; + } split; + } unk_80; + /*0x84*/ u32 unk_84; +} MoldormEntity; -extern void (*const gUnk_080CBB90[])(Entity*); -extern void (*const Moldorm_Functions[])(Entity*); -extern void (*const gUnk_080CBBB4[])(Entity*); -extern void (*const gUnk_080CBBBC[])(Entity*); +void sub_08022EAC(MoldormEntity*); +void sub_08022F14(MoldormEntity*); + +extern void (*const gUnk_080CBB90[])(MoldormEntity*); +extern void (*const Moldorm_Functions[])(MoldormEntity*); +extern void (*const gUnk_080CBBB4[])(MoldormEntity*); +extern void (*const gUnk_080CBBBC[])(MoldormEntity*); extern const s8 gUnk_080CBBC4[]; -void Moldorm(Entity* this) { - gUnk_080CBB90[this->type](this); +void Moldorm(MoldormEntity* this) { + gUnk_080CBB90[super->type](this); } -void sub_08022BA0(Entity* this) { - this->field_0x78.HALF.HI++; - this->field_0x74.HWORD = this->x.HALF.HI; - this->field_0x76.HWORD = this->y.HALF.HI; - EnemyFunctionHandler(this, Moldorm_Functions); +void sub_08022BA0(MoldormEntity* this) { + this->unk_79++; + this->unk_74 = super->x.HALF.HI; + this->unk_76 = super->y.HALF.HI; + EnemyFunctionHandler(super, (EntityActionArray)Moldorm_Functions); sub_08022EAC(this); } -void Moldorm_OnTick(Entity* this) { - gUnk_080CBBB4[this->action](this); +void Moldorm_OnTick(MoldormEntity* this) { + gUnk_080CBBB4[super->action](this); } -void Moldorm_OnCollision(Entity* this) { - if (this->field_0x7a.HALF.LO != this->health) - this->field_0x7a.HALF.HI = 30; +void Moldorm_OnCollision(MoldormEntity* this) { + if (this->unk_7a != super->health) + this->unk_7b = 30; - this->field_0x7a.HALF.LO = this->health; - this->timer = 1; - this->direction = this->knockbackDirection; + this->unk_7a = super->health; + super->timer = 1; + super->direction = super->knockbackDirection; - this->animationState = ((this->direction + 2) & 0x1c) >> 2; - this->frameIndex = this->animationState; + super->animationState = ((super->direction + 2) & 0x1c) >> 2; + super->frameIndex = super->animationState; - this->child->iframes = this->iframes; - (*(Entity**)&this->field_0x7c)->iframes = this->iframes; - (*(Entity**)&this->field_0x80)->iframes = this->iframes; - EnemyFunctionHandlerAfterCollision(this, Moldorm_Functions); + super->child->iframes = super->iframes; + this->unk_7c.entity->iframes = super->iframes; + this->unk_80.entity->iframes = super->iframes; + EnemyFunctionHandlerAfterCollision(super, Moldorm_Functions); } -void sub_08022C58(Entity* this) { +void sub_08022C58(MoldormEntity* this) { Entity *tail0, *tail1, *tail2; - COLLISION_OFF(this); + COLLISION_OFF(super); if (gEntCount >= 0x45) return; tail0 = CreateEnemy(MOLDORM, 1); - this->child = tail0; + super->child = tail0; tail0->spritePriority.b0 = 5; - tail0->parent = this; - CopyPosition(this, tail0); + tail0->parent = super; + CopyPosition(super, tail0); tail1 = CreateEnemy(MOLDORM, 2); tail0->child = tail1; tail1->spritePriority.b0 = 5; - tail1->parent = this; - CopyPosition(this, tail1); + tail1->parent = super; + CopyPosition(super, tail1); tail2 = CreateEnemy(MOLDORM, 3); tail1->child = tail2; tail2->spritePriority.b0 = 5; - tail2->parent = this; - CopyPosition(this, tail2); + tail2->parent = super; + CopyPosition(super, tail2); - sub_0804A720(this); - this->action = 1; - this->timer = 1; - this->subtimer = 1; - COLLISION_ON(this); - this->parent = this; - this->child = tail0; - *(Entity**)&this->field_0x7c = tail1; - *(Entity**)&this->field_0x80 = tail2; + sub_0804A720(super); + super->action = 1; + super->timer = 1; + super->subtimer = 1; + COLLISION_ON(super); + super->parent = super; + super->child = tail0; + this->unk_7c.entity = tail1; + this->unk_80.entity = tail2; - this->direction = Random() & 0x1f; - this->animationState = ((this->direction + 2) & 0x1c) >> 2; - this->frameIndex = this->animationState; - this->field_0x7a.HALF.LO = this->health; + super->direction = Random() & 0x1f; + super->animationState = ((super->direction + 2) & 0x1c) >> 2; + super->frameIndex = super->animationState; + this->unk_7a = super->health; } -void sub_08022D40(Entity* this) { - if (this->field_0x7a.HALF.HI) { - if (this->field_0x7a.HALF.HI-- & 1) { - this->animationState = (this->animationState + 1) & 7; - this->frameIndex = this->animationState; +void sub_08022D40(MoldormEntity* this) { + if (this->unk_7b) { + if (this->unk_7b-- & 1) { + super->animationState = (super->animationState + 1) & 7; + super->frameIndex = super->animationState; } } else { sub_08022F14(this); - ProcessMovement0(this); + ProcessMovement0(super); - if (this->collisions != COL_NONE) { - sub_0800417E(this, this->collisions); - this->animationState = ((this->direction + 2) & 0x1c) >> 2; - this->frameIndex = this->animationState; + if (super->collisions != COL_NONE) { + sub_0800417E(super, super->collisions); + super->animationState = ((super->direction + 2) & 0x1c) >> 2; + super->frameIndex = super->animationState; } } } -void sub_08022D90(Entity* this) { - if (this->parent->next != NULL) { +void sub_08022D90(MoldormEntity* this) { + if (super->parent->next != NULL) { Entity* parent; - gUnk_080CBBBC[this->action](this); - parent = this->parent; - this->spriteOrientation.flipY = parent->spriteOrientation.flipY; - this->spriteRendering.b3 = parent->spriteRendering.b3; - this->collisionLayer = parent->collisionLayer; + gUnk_080CBBBC[super->action](this); + parent = super->parent; + super->spriteOrientation.flipY = parent->spriteOrientation.flipY; + super->spriteRendering.b3 = parent->spriteRendering.b3; + super->collisionLayer = parent->collisionLayer; } else { - DeleteEntity(this); + DeleteEntity(super); } } -void sub_08022DE8(Entity* this) { - this->action = 1; - this->field_0x7c.BYTES.byte0 = 0x88; - this->field_0x7c.BYTES.byte1 = 0x88; - this->field_0x7c.BYTES.byte2 = 0x88; - this->field_0x7c.BYTES.byte3 = 0x88; - this->field_0x80.HALF.LO = 0x88; - this->field_0x80.HALF.HI = 0x88; - this->field_0x82.HALF.LO = 0x88; - this->field_0x82.HALF.HI = 0x88; - this->animationState = this->parent->animationState; - *(u32*)&this->cutsceneBeh = this->animationState * 0x11111111; +void sub_08022DE8(MoldormEntity* this) { + super->action = 1; + this->unk_7c.split.unk_7c = 0x88; + this->unk_7c.split.unk_7d = 0x88; + this->unk_7c.split.unk_7e = 0x88; + this->unk_7c.split.unk_7f = 0x88; + this->unk_80.split.unk_80 = 0x88; + this->unk_80.split.unk_81 = 0x88; + this->unk_80.split.unk_82 = 0x88; + this->unk_80.split.unk_83 = 0x88; + super->animationState = super->parent->animationState; + this->unk_84 = super->animationState * 0x11111111; - if (this->type != 3) { - this->frameIndex = this->type + 7; + if (super->type != 3) { + super->frameIndex = super->type + 7; } else { - this->frameIndex = this->animationState + 10; + super->frameIndex = super->animationState + 10; } } -void sub_08022E40(Entity* this) { +void sub_08022E40(MoldormEntity* this) { u32 bVar1; u32 animationState; u32 tmp; u32 tmp2; u8* ptr; - this->field_0x74.HWORD = this->x.HALF.HI; - this->field_0x76.HWORD = this->y.HALF.HI; - tmp2 = (this->parent->field_0x78.HALF.HI + 1) & 7; - ptr = (u8*)&this->field_0x7c + tmp2; + this->unk_74 = super->x.HALF.HI; + this->unk_76 = super->y.HALF.HI; + tmp2 = (((MoldormEntity*)super->parent)->unk_79 + 1) & 7; + ptr = (u8*)&this->unk_7c.split.unk_7c + tmp2; bVar1 = *ptr; tmp = (bVar1 & 0xf) - 8; bVar1 >>= 4; - this->x.HALF.HI = ((short)((tmp * 0x100)) >> 8) + this->x.HALF.HI; + super->x.HALF.HI = ((short)((tmp * 0x100)) >> 8) + super->x.HALF.HI; bVar1 -= 8; - this->y.HALF.HI = bVar1 + this->y.HALF.HI; - animationState = (u8)(*(u32*)&this->cutsceneBeh >> (((this->parent->field_0x78.HALF.HI + 1) & 7) << 2)) & 7; - this->animationState = animationState; - if (this->type == 3) { - this->frameIndex = animationState + 10; + super->y.HALF.HI = bVar1 + super->y.HALF.HI; + animationState = (u8)(this->unk_84 >> (((((MoldormEntity*)super->parent)->unk_79 + 1) & 7) << 2)) & 7; + super->animationState = animationState; + if (super->type == 3) { + super->frameIndex = animationState + 10; } else { sub_08022EAC(this); } } -void sub_08022EAC(Entity* this) { +void sub_08022EAC(MoldormEntity* this) { int iVar1; u32 tmp; u32 tmp2; - if (this->child != NULL) { - tmp2 = ((this->parent->field_0x78.HALF.HI) & 7); - ((u8*)&this->child->field_0x7c)[tmp2] = ((this->x.HALF_U.HI - this->field_0x74.HALF.LO + 8) & 0xf) + - ((u32)((this->y.HALF_U.HI - this->field_0x76.HALF.LO + 8) & 0xf) << 4); - iVar1 = ((this->parent->field_0x78.HALF.HI) & 7) << 2; - tmp = (this->animationState & 7) << iVar1; - tmp |= ~(0xf << iVar1) & (*(u32*)&this->child->cutsceneBeh); - *(u32*)&this->child->cutsceneBeh = tmp; + if (super->child != NULL) { + tmp2 = ((((MoldormEntity*)super->parent)->unk_79) & 7); + ((u8*)&((MoldormEntity*)super->child)->unk_7c.split.unk_7c)[tmp2] = + ((super->x.HALF_U.HI - this->unk_74 + 8) & 0xf) + + ((u32)((super->y.HALF_U.HI - this->unk_76 + 8) & 0xf) << 4); + iVar1 = ((((MoldormEntity*)super->parent)->unk_79) & 7) << 2; + tmp = (super->animationState & 7) << iVar1; + tmp |= ~(0xf << iVar1) & (((MoldormEntity*)super->child)->unk_84); + ((MoldormEntity*)super->child)->unk_84 = tmp; } } -void sub_08022F14(Entity* this) { - if (sub_08049FA0(this) == 0) { - u32 bVar6 = (sub_08049EE4(this) - this->direction) & 0x1f; +void sub_08022F14(MoldormEntity* this) { + if (sub_08049FA0(super) == 0) { + u32 bVar6 = (sub_08049EE4(super) - super->direction) & 0x1f; if (8 < ((bVar6 + 4) & 0x1f)) { - this->subtimer = 8; + super->subtimer = 8; if (bVar6 < 0x10) { - this->field_0x78.HALF.LO = 1; + this->unk_78 = 1; } else { - this->field_0x78.HALF.LO = -1; + this->unk_78 = -1; } } } - if (--this->timer == 0) { - this->timer = 4; + if (--super->timer == 0) { + super->timer = 4; - if (--this->subtimer == 0) { - this->subtimer = 8; - this->field_0x78.HALF.LO = gUnk_080CBBC4[Random() & 1]; + if (--super->subtimer == 0) { + super->subtimer = 8; + this->unk_78 = gUnk_080CBBC4[Random() & 1]; } - this->direction += this->field_0x78.HALF.LO; - this->direction &= DirectionNorthWest | 0x3; + super->direction += this->unk_78; + super->direction &= DirectionNorthWest | 0x3; - this->animationState = ((this->direction + 2) & 0x1c) >> 2; - this->frameIndex = this->animationState; + super->animationState = ((super->direction + 2) & 0x1c) >> 2; + super->frameIndex = super->animationState; } } // clang-format off -void (*const gUnk_080CBB90[])(Entity*) = { +void (*const gUnk_080CBB90[])(MoldormEntity*) = { sub_08022BA0, sub_08022D90, sub_08022D90, sub_08022D90, }; -void (*const Moldorm_Functions[])(Entity*) = { +void (*const Moldorm_Functions[])(MoldormEntity*) = { Moldorm_OnTick, Moldorm_OnCollision, - GenericKnockback, - GenericDeath, - GenericConfused, + (void (*)(MoldormEntity*))GenericKnockback, + (void (*)(MoldormEntity*))GenericDeath, + (void (*)(MoldormEntity*))GenericConfused, }; -void (*const gUnk_080CBBB4[])(Entity*) = { +void (*const gUnk_080CBBB4[])(MoldormEntity*) = { sub_08022C58, sub_08022D40, }; -void (*const gUnk_080CBBBC[])(Entity*) = { +void (*const gUnk_080CBBBC[])(MoldormEntity*) = { sub_08022DE8, sub_08022E40, }; diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index db8410cb..c856da19 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -4,86 +4,115 @@ * * @brief Moldworm enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ Entity* unk_74; + union { + /*0x78*/ u16 HWORD; + struct { + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; + } PACKED split; + } PACKED unk_78; + /*0x7a*/ u8 unk_7a; + /*0x7b*/ u8 unk_7b; + /*0x7c*/ u8 unk_7c; + /*0x7d*/ u8 unk_7d; + /*0x7e*/ u8 unk_7e; + /*0x7f*/ u8 unk_7f; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; + /*0x84*/ u8 unk_84; + /*0x85*/ u8 unk_85; + /*0x86*/ u8 unk_86; + /*0x87*/ u8 unk_87; +} MoldwormEntity; + extern void SoundReqClipped(Entity*, u32); extern bool32 sub_08023A38(u32); -extern void sub_08023990(Entity*, u32, u32); -extern void sub_08023A88(Entity*, u32); -void sub_080235BC(Entity*); -void sub_08023644(Entity*); -void sub_08023730(Entity*); -void sub_080237D8(Entity*); -void sub_0802390C(Entity*); -void sub_080239F0(Entity*); -bool32 sub_08023B38(Entity*); +void sub_08023990(MoldwormEntity*, u32, u32); +void sub_08023A88(MoldwormEntity*, u32); +void sub_080235BC(MoldwormEntity*); +void sub_08023644(MoldwormEntity*); +void sub_08023730(MoldwormEntity*); +void sub_080237D8(MoldwormEntity*); +void sub_0802390C(MoldwormEntity*); +void sub_080239F0(MoldwormEntity*); +bool32 sub_08023B38(MoldwormEntity*); +void sub_08023A68(MoldwormEntity*); +void sub_08023AB0(MoldwormEntity*); -extern void (*const Moldworm_Functions[])(Entity*); -extern void (*const gUnk_080CBC50[])(Entity*); +extern void (*const Moldworm_Functions[])(MoldwormEntity*); +extern void (*const gUnk_080CBC50[])(MoldwormEntity*); extern const s8 gUnk_080CBC70[]; extern const s8 gUnk_080CBC90[]; -extern void (*const gUnk_080CBC98[])(Entity*); -extern void (*const gUnk_080CBCA8[])(Entity*); +extern void (*const gUnk_080CBC98[])(MoldwormEntity*); +extern void (*const gUnk_080CBCA8[])(MoldwormEntity*); extern const s8 gUnk_080CBCB8[]; -void Moldworm(Entity* this) { - u16 prevX = this->x.HALF.HI; - u16 prevY = this->y.HALF.HI; +void Moldworm(MoldwormEntity* this) { + u16 prevX = super->x.HALF.HI; + u16 prevY = super->y.HALF.HI; - if (this->type == 0) { - if (this->action != 0) { + if (super->type == 0) { + if (super->action != 0) { sub_0802390C(this); } - this->field_0x7c.BYTES.byte1 = this->field_0x7c.BYTES.byte0; - EnemyFunctionHandler(this, Moldworm_Functions); + this->unk_7d = this->unk_7c; + EnemyFunctionHandler(super, (EntityActionArray)Moldworm_Functions); } else { - if (this->parent->next != NULL) { - if (this->type != 8) { + if (super->parent->next != NULL) { + if (super->type != 8) { sub_080235BC(this); } else { sub_08023730(this); } } else { - DeleteEntity(this); + DeleteEntity(super); return; } } - if (this->parent->field_0x7c.BYTES.byte0 != this->parent->field_0x7c.BYTES.byte1 && this->child) { - u32 temp = (this->parent->field_0x7c.BYTES.byte0 - 1) & 0xf; - u8* ptr = (u8*)&this->child->field_0x78 + temp; - *ptr = (((this->x.HALF.HI - prevX + 8) & 0xf) << 4) | ((this->y.HALF.HI - prevY + 8U) & 0xf); + if (((MoldwormEntity*)super->parent)->unk_7c != ((MoldwormEntity*)super->parent)->unk_7d && super->child) { + u32 temp = (((MoldwormEntity*)super->parent)->unk_7c - 1) & 0xf; + u8* ptr = (u8*)&((MoldwormEntity*)super->child)->unk_78.split.unk_78 + temp; + *ptr = (((super->x.HALF.HI - prevX + 8) & 0xf) << 4) | ((super->y.HALF.HI - prevY + 8U) & 0xf); } } -void Moldworm_OnTick(Entity* this) { - gUnk_080CBC50[this->action](this); +void Moldworm_OnTick(MoldwormEntity* this) { + gUnk_080CBC50[super->action](this); } -void Moldworm_OnCollision(Entity* this) { - if (this->subAction == 0xff) { - this->action = 7; - this->timer = 1; - this->subAction = 0; - this->hitType = 0x85; - this->iframes = -8; - this->field_0x7c.BYTES.byte3 = 0; - this->field_0x7a.HALF.HI = 0; - if (this->contactFlags == 0x80 || this->contactFlags == 0x9e) { - this->type2 = 0; - this->field_0x80.HALF.LO = 0x14; +void Moldworm_OnCollision(MoldwormEntity* this) { + if (super->subAction == 0xff) { + super->action = 7; + super->timer = 1; + super->subAction = 0; + super->hitType = 0x85; + super->iframes = -8; + this->unk_7f = 0; + this->unk_7b = 0; + if (super->contactFlags == 0x80 || super->contactFlags == 0x9e) { + super->type2 = 0; + this->unk_80 = 0x14; } else { - this->type2 = 1; - this->field_0x80.HALF.LO = 8; + super->type2 = 1; + this->unk_80 = 8; } } - if (this->health == 0 && this->field_0x7c.BYTES.byte3 == 0 && this->action == 7) { - CopyPosition(this, &gPlayerEntity); + if (super->health == 0 && this->unk_7f == 0 && super->action == 7) { + CopyPosition(super, &gPlayerEntity); gPlayerEntity.flags |= ENT_COLLIDE; gPlayerEntity.spriteSettings.draw = 1; gPlayerEntity.zVelocity = Q_16_16(1.5); @@ -93,64 +122,64 @@ void Moldworm_OnCollision(Entity* this) { gPlayerState.flags &= ~PL_MOLDWORM_CAPTURED; } - EnemyFunctionHandlerAfterCollision(this, Moldworm_Functions); + EnemyFunctionHandlerAfterCollision(super, Moldworm_Functions); } -void Moldworm_OnKnockback(Entity* this) { - this->field_0x7c.BYTES.byte0++; - GenericKnockback(this); +void Moldworm_OnKnockback(MoldwormEntity* this) { + this->unk_7c++; + GenericKnockback(super); } -void Moldworm_OnGrabbed(Entity* this) { +void Moldworm_OnGrabbed(MoldwormEntity* this) { } -void sub_080231BC(Entity* this) { +void sub_080231BC(MoldwormEntity* this) { if (gEntCount < 0x40) { Entity* ent; - ent = this->child = CreateEnemy(MOLDWORM, 1); - ent->parent = this; + ent = super->child = CreateEnemy(MOLDWORM, 1); + ent->parent = super; ent = ent->child = CreateEnemy(MOLDWORM, 2); - ent->parent = this; + ent->parent = super; ent = ent->child = CreateEnemy(MOLDWORM, 3); - ent->parent = this; + ent->parent = super; ent = ent->child = CreateEnemy(MOLDWORM, 4); - ent->parent = this; + ent->parent = super; ent = ent->child = CreateEnemy(MOLDWORM, 5); - ent->parent = this; + ent->parent = super; ent = ent->child = CreateEnemy(MOLDWORM, 6); - ent->parent = this; + ent->parent = super; ent = ent->child = CreateEnemy(MOLDWORM, 7); - ent->parent = this; + ent->parent = super; ent->child = CreateEnemy(MOLDWORM, 8); - *(Entity**)&ent->child->field_0x74 = ent; + ((MoldwormEntity*)ent->child)->unk_74 = ent; ent = ent->child; - ent->parent = this; + ent->parent = super; ent->child = NULL; - sub_0804A720(this); - this->action = 6; - this->timer = 30; - this->parent = this; - this->field_0x78.HWORD = 0x1e; - this->palette.b.b0 = 5; - this->direction = Random() & 0x1f; - this->animationState = Direction8ToAnimationState(Direction8RoundUp(this->direction)); - InitializeAnimation(this, this->animationState); + sub_0804A720(super); + super->action = 6; + super->timer = 30; + super->parent = super; + this->unk_78.HWORD = 0x1e; + super->palette.b.b0 = 5; + super->direction = Random() & 0x1f; + super->animationState = Direction8ToAnimationState(Direction8RoundUp(super->direction)); + InitializeAnimation(super, super->animationState); } } -void nullsub_136(Entity* this) { +void nullsub_136(MoldwormEntity* this) { } -void sub_08023288(Entity* this) { - if (sub_08049FDC(this, 1) && (this->timer++ & 0xf) == 0) { +void sub_08023288(MoldwormEntity* this) { + if (sub_08049FDC(super, 1) && (super->timer++ & 0xf) == 0) { u32 idx = Random() & 0x1e; u32 i; @@ -167,246 +196,243 @@ void sub_08023288(Entity* this) { } } -void sub_08023330(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 4; - this->timer = 25; - COLLISION_ON(this); - this->field_0x78.HWORD = 600; - this->direction = Random() & 0x1c; - this->animationState = this->direction >> 2; - this->field_0x7a.HALF.HI = 0; - this->field_0x7c.BYTES.byte3 = 0; - sub_08023A88(this, this->animationState); - CopyPosition(this, this->child); - CreateFx(this, FX_ROCK, 0); +void sub_08023330(MoldwormEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 4; + super->timer = 25; + COLLISION_ON(super); + this->unk_78.HWORD = 600; + super->direction = Random() & 0x1c; + super->animationState = super->direction >> 2; + this->unk_7b = 0; + this->unk_7f = 0; + sub_08023A88(this, super->animationState); + CopyPosition(super, super->child); + CreateFx(super, FX_ROCK, 0); } } -void sub_08023A68(Entity*); -void sub_08023AB0(Entity*); +void sub_08023398(MoldwormEntity* this) { + this->unk_7c++; -void sub_08023398(Entity* this) { - this->field_0x7c.BYTES.byte0++; - - if (this->field_0x7c.BYTES.byte3 && !sub_08049FDC(this, 1)) { - this->field_0x78.HWORD = 1; + if (this->unk_7f && !sub_08049FDC(super, 1)) { + this->unk_78.HWORD = 1; } - if (--this->field_0x78.HWORD == 0) { - if (sub_08023A38(GetTileTypeByEntity(this))) { - this->action = 5; - this->field_0x7c.BYTES.byte3 = 0; - COLLISION_OFF(this); - this->hitType = 0x85; - this->child->timer = 1; + if (--this->unk_78.HWORD == 0) { + if (sub_08023A38(GetTileTypeByEntity(super))) { + super->action = 5; + this->unk_7f = 0; + COLLISION_OFF(super); + super->hitType = 0x85; + super->child->timer = 1; sub_08023A68(this); - CreateFx(this, FX_ROCK, 0); + CreateFx(super, FX_ROCK, 0); return; } - this->field_0x78.HWORD = 0x28; + this->unk_78.HWORD = 0x28; } - if (this->field_0x7c.BYTES.byte3) { + if (this->unk_7f) { sub_08023AB0(this); } - if (--this->timer < 3) { - if (this->timer == 0) - this->timer = 25; + if (--super->timer < 3) { + if (super->timer == 0) + super->timer = 25; } else { - int prevX = this->x.WORD; - int prevY = this->y.WORD; - ProcessMovement0(this); - if (this->x.WORD == prevX && this->y.WORD == prevY) { - this->field_0x7c.BYTES.byte0--; + int prevX = super->x.WORD; + int prevY = super->y.WORD; + ProcessMovement0(super); + if (super->x.WORD == prevX && super->y.WORD == prevY) { + this->unk_7c--; } if ((gRoomTransition.frameCount & 7) == 0) { u32 uVar4; - sub_08004596(this, sub_08049F84(this, 1)); - uVar4 = Direction8ToAnimationState(Direction8RoundUp(this->direction)); - if (uVar4 != this->animationState) { - this->animationState = uVar4; - InitializeAnimation(this, uVar4 + this->field_0x7a.HALF.HI); + sub_08004596(super, sub_08049F84(super, 1)); + uVar4 = Direction8ToAnimationState(Direction8RoundUp(super->direction)); + if (uVar4 != super->animationState) { + super->animationState = uVar4; + InitializeAnimation(super, uVar4 + this->unk_7b); } } } } -void sub_080234A4(Entity* this) { - this->field_0x7c.BYTES.byte0++; - GetNextFrame(this); - if (this->field_0x7c.BYTES.byte3) { - this->action = 6; - this->spriteSettings.draw = 0; - this->field_0x78.HWORD = 300; +void sub_080234A4(MoldwormEntity* this) { + this->unk_7c++; + GetNextFrame(super); + if (this->unk_7f) { + super->action = 6; + super->spriteSettings.draw = 0; + this->unk_78.HWORD = 300; } } -void sub_080234D8(Entity* this) { - if (--this->field_0x78.HWORD == 0) { - this->action = 2; - this->palette.b.b0 = 5; - this->direction = Random() & 0x1f; - this->animationState = Direction8ToAnimationState(Direction8RoundUp(this->direction)); - sub_08023A88(this, this->animationState); +void sub_080234D8(MoldwormEntity* this) { + if (--this->unk_78.HWORD == 0) { + super->action = 2; + super->palette.b.b0 = 5; + super->direction = Random() & 0x1f; + super->animationState = Direction8ToAnimationState(Direction8RoundUp(super->direction)); + sub_08023A88(this, super->animationState); } } -void sub_0802351C(Entity* this) { - if ((this->timer != 0) && ((this->type2 == 1) || (gPlayerEntity.frameIndex == 0xff))) { - this->timer = 0; - this->child->action = 3; - this->child->subtimer = this->field_0x80.HALF.LO; - InitializeAnimation(this->child, this->child->animationState + 1); - InitializeAnimation(this, this->animationState); +void sub_0802351C(MoldwormEntity* this) { + if ((super->timer != 0) && ((super->type2 == 1) || (gPlayerEntity.frameIndex == 0xff))) { + super->timer = 0; + super->child->action = 3; + super->child->subtimer = this->unk_80; + InitializeAnimation(super->child, super->child->animationState + 1); + InitializeAnimation(super, super->animationState); } - if (this->field_0x7c.BYTES.byte3 == 0) { - if (this->type2 == 0) { - gPlayerEntity.animationState = this->animationState & 7; + if (this->unk_7f == 0) { + if (super->type2 == 0) { + gPlayerEntity.animationState = super->animationState & 7; gPlayerState.flags |= PL_MOLDWORM_CAPTURED; - PositionRelative(this, &gPlayerEntity, 0, Q_16_16(gUnk_080CBC90[this->animationState & 7])); - gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[this->animationState & 7]; + PositionRelative(super, &gPlayerEntity, 0, Q_16_16(gUnk_080CBC90[super->animationState & 7])); + gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[super->animationState & 7]; } } else { - this->action = 4; + super->action = 4; } } -void sub_080235BC(Entity* this) { - gUnk_080CBC98[this->action](this); +void sub_080235BC(MoldwormEntity* this) { + gUnk_080CBC98[super->action](this); } -void sub_080235D4(Entity* this) { +void sub_080235D4(MoldwormEntity* this) { Entity* parent; - this->action = 1; - parent = this->parent; - this->x.HALF.HI = parent->x.HALF.HI; - this->y.HALF.HI = parent->y.HALF.HI; + super->action = 1; + parent = super->parent; + super->x.HALF.HI = parent->x.HALF.HI; + super->y.HALF.HI = parent->y.HALF.HI; sub_080239F0(this); - if (this->type == 1) { - this->animationState = 0x10; + if (super->type == 1) { + super->animationState = 0x10; } else { - this->animationState = 0x12; + super->animationState = 0x12; } - InitializeAnimation(this, this->animationState); + InitializeAnimation(super, super->animationState); } -void sub_08023604(Entity* this) { - if (((u8*)&this->field_0x78)[this->parent->field_0x7c.BYTES.byte0 & 0xf] != 0x88) { - this->action = 2; - this->timer = 0; - COLLISION_ON(this); - this->spriteSettings.draw = 1; +void sub_08023604(MoldwormEntity* this) { + if (((u8*)&this->unk_78.split.unk_78)[((MoldwormEntity*)super->parent)->unk_7c & 0xf] != 0x88) { + super->action = 2; + super->timer = 0; + COLLISION_ON(super); + super->spriteSettings.draw = 1; sub_08023644(this); } } -void sub_08023644(Entity* this) { - Entity* parent = this->parent; +void sub_08023644(MoldwormEntity* this) { + Entity* parent = super->parent; - if (parent->animIndex == 0x17 && this->timer != 0 && this->x.HALF.HI == parent->x.HALF.HI && - this->y.HALF.HI == parent->y.HALF.HI) { - this->action = 1; - COLLISION_OFF(this); - this->spriteSettings.draw = 0; - this->child->timer = 1; + if (parent->animIndex == 0x17 && super->timer != 0 && super->x.HALF.HI == parent->x.HALF.HI && + super->y.HALF.HI == parent->y.HALF.HI) { + super->action = 1; + COLLISION_OFF(super); + super->spriteSettings.draw = 0; + super->child->timer = 1; sub_080239F0(this); } - if (parent->field_0x7c.BYTES.byte0 != parent->field_0x7c.BYTES.byte1) { - u8* tmp = &((u8*)&this->field_0x78)[parent->field_0x7c.BYTES.byte0 & 0xf]; - this->x.HALF.HI += (*tmp >> 4) - 8; - this->y.HALF.HI += (*tmp & 0xf) - 8; - this->spriteOrientation.flipY = parent->spriteOrientation.flipY; - this->spriteRendering.b3 = parent->spriteRendering.b3; - this->collisionLayer = parent->collisionLayer; + if (((MoldwormEntity*)parent)->unk_7c != ((MoldwormEntity*)parent)->unk_7d) { + u8* tmp = &((u8*)&this->unk_78.split.unk_78)[((MoldwormEntity*)parent)->unk_7c & 0xf]; + super->x.HALF.HI += (*tmp >> 4) - 8; + super->y.HALF.HI += (*tmp & 0xf) - 8; + super->spriteOrientation.flipY = parent->spriteOrientation.flipY; + super->spriteRendering.b3 = parent->spriteRendering.b3; + super->collisionLayer = parent->collisionLayer; } } -void sub_080236F8(Entity* parent) { - if (--parent->subtimer == 0) { - parent->action = 2; - parent->child->action = 3; - parent->child->subtimer = parent->parent->field_0x80.HALF.LO; - InitializeAnimation(parent->child, parent->child->animationState + 1); - InitializeAnimation(parent, parent->animationState); +void sub_080236F8(MoldwormEntity* this) { + if (--super->subtimer == 0) { + super->action = 2; + super->child->action = 3; + super->child->subtimer = ((MoldwormEntity*)super->parent)->unk_80; + InitializeAnimation(super->child, super->child->animationState + 1); + InitializeAnimation(super, super->animationState); } } -void sub_08023730(Entity* this) { - gUnk_080CBCA8[this->action](this); +void sub_08023730(MoldwormEntity* this) { + gUnk_080CBCA8[super->action](this); } -void sub_08023748(Entity* this) { +void sub_08023748(MoldwormEntity* this) { Entity* parent; - this->action = 1; - this->animationState = 20; - parent = this->parent; - this->x.HALF.HI = parent->x.HALF.HI; - this->y.HALF.HI = parent->y.HALF.HI; + super->action = 1; + super->animationState = 20; + parent = super->parent; + super->x.HALF.HI = parent->x.HALF.HI; + super->y.HALF.HI = parent->y.HALF.HI; sub_080239F0(this); sub_08023A68(this); } -void sub_0802376C(Entity* this) { - Entity* parent = this->parent; +void sub_0802376C(MoldwormEntity* this) { + Entity* parent = super->parent; if (parent->spriteSettings.draw == 1 && parent->animIndex < 0x10) { - this->spriteSettings.draw = 1; - GetNextFrame(this); + super->spriteSettings.draw = 1; + GetNextFrame(super); } - if (((u8*)&this->field_0x78)[parent->field_0x7c.BYTES.byte0 & 0xf] != 0x88) { - this->action = 2; - this->timer = 0; - COLLISION_ON(this); - this->parent->field_0x7c.BYTES.byte3 = 1; + if (((u8*)&this->unk_78.split.unk_78)[((MoldwormEntity*)parent)->unk_7c & 0xf] != 0x88) { + super->action = 2; + super->timer = 0; + COLLISION_ON(super); + ((MoldwormEntity*)super->parent)->unk_7f = 1; sub_08023A88(this, 20); sub_080237D8(this); } } -void sub_080237D8(Entity* this) { - Entity* parent = this->parent; +void sub_080237D8(MoldwormEntity* this) { + Entity* parent = super->parent; - if ((parent->animIndex == 0x17) && (this->timer != 0) && (this->x.HALF.HI == parent->x.HALF.HI) && - (this->y.HALF.HI == parent->y.HALF.HI)) { - this->action = 1; - COLLISION_OFF(this); - this->spriteSettings.draw = 0; - parent->field_0x7c.BYTES.byte3 = 1; + if ((parent->animIndex == 0x17) && (super->timer != 0) && (super->x.HALF.HI == parent->x.HALF.HI) && + (super->y.HALF.HI == parent->y.HALF.HI)) { + super->action = 1; + COLLISION_OFF(super); + super->spriteSettings.draw = 0; + ((MoldwormEntity*)parent)->unk_7f = 1; sub_080239F0(this); sub_08023A68(this); } - if (parent->field_0x7c.BYTES.byte0 != parent->field_0x7c.BYTES.byte1) { - u8* tmp = &((u8*)&this->field_0x78)[parent->field_0x7c.BYTES.byte0 & 0xf]; - this->x.HALF.HI += (*tmp >> 4) - 8; - this->y.HALF.HI += (*tmp & 0xf) - 8; + if (((MoldwormEntity*)parent)->unk_7c != ((MoldwormEntity*)parent)->unk_7d) { + u8* tmp = &((u8*)&this->unk_78.split.unk_78)[((MoldwormEntity*)parent)->unk_7c & 0xf]; + super->x.HALF.HI += (*tmp >> 4) - 8; + super->y.HALF.HI += (*tmp & 0xf) - 8; - this->spriteOrientation.flipY = parent->spriteOrientation.flipY; - this->spriteRendering.b3 = parent->spriteRendering.b3; - this->collisionLayer = parent->collisionLayer; + super->spriteOrientation.flipY = parent->spriteOrientation.flipY; + super->spriteRendering.b3 = parent->spriteRendering.b3; + super->collisionLayer = parent->collisionLayer; } } -void sub_08023894(Entity* this) { - if (--this->subtimer == 0) { - this->action = 2; - this->parent->field_0x7c.BYTES.byte3 = 1; - InitializeAnimation(this, this->animationState); - if (this->parent->type2 == 0) { +void sub_08023894(MoldwormEntity* this) { + if (--super->subtimer == 0) { + super->action = 2; + ((MoldwormEntity*)super->parent)->unk_7f = 1; + InitializeAnimation(super, super->animationState); + if (super->parent->type2 == 0) { gPlayerState.flags |= PL_MOLDWORM_RELEASED; - gPlayerEntity.x.HALF.HI = this->x.HALF.HI; - gPlayerEntity.y.HALF.HI = this->y.HALF.HI; - gPlayerEntity.direction = DirectionRoundUp(GetFacingDirection(*(Entity**)&this->field_0x74, this)); + gPlayerEntity.x.HALF.HI = super->x.HALF.HI; + gPlayerEntity.y.HALF.HI = super->y.HALF.HI; + gPlayerEntity.direction = DirectionRoundUp(GetFacingDirection(this->unk_74, super)); gPlayerEntity.animationState = gPlayerEntity.direction >> 2; gPlayerEntity.iframes = 12; ModHealth(-0x10); @@ -415,14 +441,14 @@ void sub_08023894(Entity* this) { } } -void sub_0802390C(Entity* this) { - if (this->contactFlags & 0x80) { - Entity* ent = this->child; +void sub_0802390C(MoldwormEntity* this) { + if (super->contactFlags & 0x80) { + Entity* ent = super->child; do { - ent->iframes = this->iframes; + ent->iframes = super->iframes; } while (ent = ent->child, ent != NULL); } else { - Entity* ent = this->child; + Entity* ent = super->child; do { if (ent->contactFlags & 0x80) { u8 bVar2 = 0xff - ent->health; @@ -430,13 +456,13 @@ void sub_0802390C(Entity* this) { u32 tmp; ent->health = 0xff; tmp = (u8)ent->iframes; - if (this->health >= bVar2) { - this->health -= bVar2; + if (super->health >= bVar2) { + super->health -= bVar2; } else { - this->health = 0; + super->health = 0; } - ent = this; + ent = super; do { ent->iframes = tmp; } while (ent = ent->child, ent != NULL); @@ -447,44 +473,44 @@ void sub_0802390C(Entity* this) { } } -void sub_08023990(Entity* this, u32 param_2, u32 param_3) { +void sub_08023990(MoldwormEntity* this, u32 param_2, u32 param_3) { Entity* ent; - this->action = 3; - this->spriteSettings.draw = 1; - this->palette.b.b0 = 0x5; - this->palette.b.b4 = 0x5; - this->spritePriority.b0 = 7; - this->x.HALF.HI = param_2; - this->y.HALF.HI = param_3; - this->collisionLayer = gPlayerEntity.collisionLayer; - UpdateSpriteForCollisionLayer(this); - InitializeAnimation(this, 0x16); + super->action = 3; + super->spriteSettings.draw = 1; + super->palette.b.b0 = 0x5; + super->palette.b.b4 = 0x5; + super->spritePriority.b0 = 7; + super->x.HALF.HI = param_2; + super->y.HALF.HI = param_3; + super->collisionLayer = gPlayerEntity.collisionLayer; + UpdateSpriteForCollisionLayer(super); + InitializeAnimation(super, 0x16); - ent = this->child; + ent = super->child; do { - sub_080239F0(ent); - CopyPosition(this, ent); + sub_080239F0((MoldwormEntity*)ent); + CopyPosition(super, ent); } while (ent = ent->child, ent != NULL); } -void sub_080239F0(Entity* this) { - *(u8*)&this->field_0x78 = 0x88; - *(u8*)((int)&this->field_0x78 + 1) = 0x88; - *(u8*)&this->field_0x7a = 0x88; - *(u8*)((int)&this->field_0x7a + 1) = 0x88; - *(u8*)&this->field_0x7c = 0x88; - *(u8*)((int)&this->field_0x7c + 1) = 0x88; - *(u8*)((int)&this->field_0x7c + 2) = 0x88; - *(u8*)((int)&this->field_0x7c + 3) = 0x88; - *(u8*)&this->field_0x80 = 0x88; - *(u8*)((int)&this->field_0x80 + 1) = 0x88; - *(u8*)&this->field_0x82 = 0x88; - *(u8*)((int)&this->field_0x82 + 1) = 0x88; - *(u8*)&this->cutsceneBeh = 0x88; - *(u8*)((int)&this->cutsceneBeh + 1) = 0x88; - *(u8*)&this->field_0x86 = 0x88; - *(u8*)((int)&this->field_0x86 + 1) = 0x88; +void sub_080239F0(MoldwormEntity* this) { + this->unk_78.split.unk_78 = 0x88; + this->unk_78.split.unk_79 = 0x88; + this->unk_7a = 0x88; + this->unk_7b = 0x88; + this->unk_7c = 0x88; + this->unk_7d = 0x88; + this->unk_7e = 0x88; + this->unk_7f = 0x88; + this->unk_80 = 0x88; + this->unk_81 = 0x88; + this->unk_82 = 0x88; + this->unk_83 = 0x88; + this->unk_84 = 0x88; + this->unk_85 = 0x88; + this->unk_86 = 0x88; + this->unk_87 = 0x88; } bool32 sub_08023A38(u32 tileType) { @@ -500,39 +526,39 @@ bool32 sub_08023A38(u32 tileType) { } } -void sub_08023A68(Entity* this) { - ChangeObjPalette(this, 5); - this->spritePriority.b0 = 7; - InitializeAnimation(this, 0x17); +void sub_08023A68(MoldwormEntity* this) { + ChangeObjPalette(super, 5); + super->spritePriority.b0 = 7; + InitializeAnimation(super, 0x17); } -void sub_08023A88(Entity* this, u32 unk) { - ChangeObjPalette(this, 0x22); - this->spritePriority.b0 = 4; - InitializeAnimation(this, unk); +void sub_08023A88(MoldwormEntity* this, u32 unk) { + ChangeObjPalette(super, 0x22); + super->spritePriority.b0 = 4; + InitializeAnimation(super, unk); } -void sub_08023AB0(Entity* this) { - if (this->field_0x7a.HALF.HI == 8) { - if (this->field_0x7c.BYTES.byte2) { - this->field_0x7c.BYTES.byte2--; - } else if (!sub_08023B38(this) || (this->field_0x78.HWORD <= 0x1D)) { - this->hitType = 0x85; - this->field_0x7a.HALF.HI = 0; - this->field_0x7c.BYTES.byte2 = 30; - InitializeAnimation(this, this->animationState); +void sub_08023AB0(MoldwormEntity* this) { + if (this->unk_7b == 8) { + if (this->unk_7e) { + this->unk_7e--; + } else if (!sub_08023B38(this) || (this->unk_78.HWORD <= 0x1d)) { + super->hitType = 0x85; + this->unk_7b = 0; + this->unk_7e = 30; + InitializeAnimation(super, super->animationState); } - } else if (this->field_0x7c.BYTES.byte2) { - this->field_0x7c.BYTES.byte2--; - } else if (this->field_0x78.HWORD >= 90 && sub_08023B38(this)) { - this->hitType = 0x87; - this->field_0x7a.HALF.HI = 8; - this->field_0x7c.BYTES.byte2 = 10; - InitializeAnimation(this, this->animationState + 8); + } else if (this->unk_7e) { + this->unk_7e--; + } else if (this->unk_78.HWORD >= 90 && sub_08023B38(this)) { + super->hitType = 0x87; + this->unk_7b = 8; + this->unk_7e = 10; + InitializeAnimation(super, super->animationState + 8); } } -bool32 sub_08023B38(Entity* this) { +bool32 sub_08023B38(MoldwormEntity* this) { Entity* entity; bool32 result; s32 iVar2; @@ -544,8 +570,8 @@ bool32 sub_08023B38(Entity* this) { if (entity == NULL) { return FALSE; } else { - tmp1 = (this->x.HALF.HI + (gUnk_080CBCB8[this->animationState * 2 + 0])); - tmp2 = (this->y.HALF.HI + (gUnk_080CBCB8[this->animationState * 2 + 1])); + tmp1 = (super->x.HALF.HI + (gUnk_080CBCB8[super->animationState * 2 + 0])); + tmp2 = (super->y.HALF.HI + (gUnk_080CBCB8[super->animationState * 2 + 1])); result = FALSE; if ((entity->x.HALF.HI - tmp1 + 0x14U < 0x29) && (entity->y.HALF.HI - tmp2 + 0x14U < 0x29)) { result = TRUE; @@ -555,16 +581,16 @@ bool32 sub_08023B38(Entity* this) { } // clang-format off -void (*const Moldworm_Functions[])(Entity*) = { +void (*const Moldworm_Functions[])(MoldwormEntity*) = { Moldworm_OnTick, Moldworm_OnCollision, Moldworm_OnKnockback, - GenericDeath, - GenericConfused, + (void (*)(MoldwormEntity*))GenericDeath, + (void (*)(MoldwormEntity*))GenericConfused, Moldworm_OnGrabbed, }; -void (*const gUnk_080CBC50[])(Entity*) = { +void (*const gUnk_080CBC50[])(MoldwormEntity*) = { sub_080231BC, nullsub_136, sub_08023288, @@ -587,17 +613,17 @@ const s8 gUnk_080CBC70[] = { }; const s8 gUnk_080CBC90[] = { - 0xff, 0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0xff, + 0xff, 0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0xff, }; -void (*const gUnk_080CBC98[])(Entity*) = { +void (*const gUnk_080CBC98[])(MoldwormEntity*) = { sub_080235D4, sub_08023604, sub_08023644, sub_080236F8, }; -void (*const gUnk_080CBCA8[])(Entity*) = { +void (*const gUnk_080CBCA8[])(MoldwormEntity*) = { sub_08023748, sub_0802376C, sub_080237D8, diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index e2746415..bc05635b 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -4,7 +4,7 @@ * * @brief Pesto enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "game.h" @@ -12,199 +12,216 @@ #include "playeritem.h" #include "save.h" -void sub_080249F4(Entity*); -void sub_08024940(Entity*); -void sub_080249DC(Entity*); -void sub_08024A14(Entity*, u32, u32); -bool32 sub_08024AD8(Entity*); -bool32 sub_08024B38(Entity*); -bool32 sub_08024C48(Entity*, bool32); -void sub_08024C7C(Entity*); -void sub_08024C94(Entity*); -bool32 sub_08024CC0(Entity*); -void sub_08024D00(Entity*); -void sub_08024E00(Entity*, u32); -void sub_08024E1C(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[8]; + /*0x70*/ u16 unk_70; + /*0x72*/ u8 unused2[6]; + /*0x78*/ u16 unk_78; + /*0x7a*/ u8 unused3[6]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; + /*0x84*/ u8 unk_84; + /*0x85*/ u8 unk_85; + /*0x86*/ u8 unk_86; + /*0x87*/ u8 unk_87; +} PestoEntity; + +void sub_080249F4(PestoEntity*); +void sub_08024940(PestoEntity*); +void sub_080249DC(PestoEntity*); +void sub_08024A14(PestoEntity*, u32, u32); +bool32 sub_08024AD8(PestoEntity*); +bool32 sub_08024B38(PestoEntity*); +bool32 sub_08024C48(PestoEntity*, bool32); +void sub_08024C7C(PestoEntity*); +void sub_08024C94(PestoEntity*); +bool32 sub_08024CC0(PestoEntity*); +void sub_08024D00(PestoEntity*); +void sub_08024E00(PestoEntity*, u32); +void sub_08024E1C(PestoEntity*); u32 sub_08024E34(void); -void sub_08024E4C(Entity*); -void sub_08024F50(Entity*); +void sub_08024E4C(PestoEntity*); +void sub_08024F50(PestoEntity*); extern Entity* gUnk_020000B0; -extern void (*const Pesto_Functions[])(Entity*); -extern void (*const gUnk_080CBEDC[])(Entity*); -extern void (*const gUnk_080CBEF8[])(Entity*); +extern void (*const Pesto_Functions[])(PestoEntity*); +extern void (*const gUnk_080CBEDC[])(PestoEntity*); +extern void (*const gUnk_080CBEF8[])(PestoEntity*); extern const u8 gUnk_080CBF10[]; extern const u16 gUnk_080CBF18[]; extern const u8 gUnk_080CBF20[]; -void Pesto(Entity* this) { - Pesto_Functions[GetNextFunction(this)](this); +void Pesto(PestoEntity* this) { + Pesto_Functions[GetNextFunction(super)](this); } -void Pesto_OnTick(Entity* this) { - gUnk_080CBEDC[this->action](this); +void Pesto_OnTick(PestoEntity* this) { + gUnk_080CBEDC[super->action](this); } -void Pesto_OnCollision(Entity* this) { - if (this->hitType != 0x6e) { - if (this->contactFlags == 0x80) { - this->field_0x86.HALF.LO = 0x30; +void Pesto_OnCollision(PestoEntity* this) { + if (super->hitType != 0x6e) { + if (super->contactFlags == 0x80) { + this->unk_86 = 0x30; - if ((this->field_0x82.HALF.HI & 0xf) == 3 && this->action == 6) { - switch (this->field_0x80.HALF.LO) { + if ((this->unk_83 & 0xf) == 3 && super->action == 6) { + switch (this->unk_80) { case 1: - this->z.HALF.HI = -0x10; - this->field_0x82.HALF.LO = 0; - this->field_0x78.HWORD = -0x10; - this->field_0x80.HALF.LO++; + super->z.HALF.HI = -0x10; + this->unk_82 = 0; + this->unk_78 = -0x10; + this->unk_80++; /* fallthrough */ case 2: - this->field_0x82.HALF.HI &= ~0x80; + this->unk_83 &= ~0x80; break; } } } } else { - this->health = 0; + super->health = 0; } - EnemyFunctionHandlerAfterCollision(this, Pesto_Functions); + EnemyFunctionHandlerAfterCollision(super, Pesto_Functions); } -void Pesto_OnKnockback(Entity* this) { - GenericKnockback(this); - GetNextFrame(this); +void Pesto_OnKnockback(PestoEntity* this) { + GenericKnockback(super); + GetNextFrame(super); } -void Pesto_OnGrabbed(Entity* this) { - if (this->subAction < 3 && !sub_0806F520(this)) { - this->action = 1; - this->subAction = 0; - COLLISION_ON(this); - this->hitType = 0x77; - this->timer = 1; - this->speed = 0x40; +void Pesto_OnGrabbed(PestoEntity* this) { + if (super->subAction < 3 && !sub_0806F520(super)) { + super->action = 1; + super->subAction = 0; + COLLISION_ON(super); + super->hitType = 0x77; + super->timer = 1; + super->speed = 0x40; } else { - gUnk_080CBEF8[this->subAction](this); + gUnk_080CBEF8[super->subAction](this); } } -void sub_08024038(Entity* this) { - this->subAction = 1; - this->gustJarTolerance = 60; - GetNextFrame(this); +void sub_08024038(PestoEntity* this) { + super->subAction = 1; + super->gustJarTolerance = 60; + GetNextFrame(super); } -void sub_08024048(Entity* this) { - sub_0806F4E8(this); - GetNextFrame(this); +void sub_08024048(PestoEntity* this) { + sub_0806F4E8(super); + GetNextFrame(super); } -void sub_08024058(Entity* this) { - sub_0806F3E4(this); +void sub_08024058(PestoEntity* this) { + sub_0806F3E4(super); } -void sub_08024060(Entity* this) { - if (this->hitType != 0x6e) { - COLLISION_OFF(this); - this->hitType = 0x6e; - this->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; +void sub_08024060(PestoEntity* this) { + if (super->hitType != 0x6e) { + COLLISION_OFF(super); + super->hitType = 0x6e; + super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; } - GetNextFrame(this); + GetNextFrame(super); } -void nullsub_138(Entity* this) { +void nullsub_138(PestoEntity* this) { /* ... */ } -void sub_0802409C(Entity* this) { - this->health = 0; - InitializeAnimation(this, this->animationState); - CreateDust(this); +void sub_0802409C(PestoEntity* this) { + super->health = 0; + InitializeAnimation(super, super->animationState); + CreateDust(super); } -void sub_080240B8(Entity* this) { +void sub_080240B8(PestoEntity* this) { u32 direction = (Random() & 0xc0) >> 3; - sub_0804A720(this); - this->action = 1; - this->subAction = 0; - this->field_0x80.HALF.LO = 0; + sub_0804A720(super); + super->action = 1; + super->subAction = 0; + this->unk_80 = 0; if (direction & 8) { - this->y.HALF.HI += (direction & 0x10) ? -0x20 : 0x20; + super->y.HALF.HI += (direction & 0x10) ? -0x20 : 0x20; } else { - this->x.HALF.HI += (direction & 0x10) ? -0x20 : 0x20; + super->x.HALF.HI += (direction & 0x10) ? -0x20 : 0x20; } - switch (this->type) { + switch (super->type) { case 0: - this->field_0x78.HWORD = -0x10; - this->z.HALF.HI = -0x10; + this->unk_78 = -0x10; + super->z.HALF.HI = -0x10; break; case 1: - this->field_0x78.HWORD = -0x30; - this->z.HALF.HI = -0x30; + this->unk_78 = -0x30; + super->z.HALF.HI = -0x30; break; } - UpdateSpriteForCollisionLayer(this); + UpdateSpriteForCollisionLayer(super); if (AreaIsDungeon()) - this->spriteOrientation.flipY = 1; + super->spriteOrientation.flipY = 1; - this->field_0x80.HALF.HI = Random() & 0x40; - this->field_0x82.HALF.LO = 0; - this->field_0x82.HALF.HI = 0x80; - this->field_0x86.HALF.LO = 0; - this->field_0x86.HALF.HI = 0; - this->timer = 0; - this->subtimer = 32; - this->collisionFlags |= 0x10; - this->gustJarFlags = 2; - this->direction = direction; + this->unk_81 = Random() & 0x40; + this->unk_82 = 0; + this->unk_83 = 0x80; + this->unk_86 = 0; + this->unk_87 = 0; + super->timer = 0; + super->subtimer = 32; + super->collisionFlags |= 0x10; + super->gustJarFlags = 2; + super->direction = direction; sub_080249DC(this); - if (this->type == 1) { + if (super->type == 1) { Entity* entity; - this->field_0x82.HALF.HI = 0; - entity = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); + this->unk_83 = 0; + entity = CreateProjectileWithParent(super, DIRT_BALL_PROJECTILE, this->unk_83); if (entity != NULL) { - this->child = entity; - entity->parent = this; + super->child = entity; + entity->parent = super; entity->y.HALF.HI += 0x10; } } } -void sub_080241C0(Entity* this) { +void sub_080241C0(PestoEntity* this) { sub_08024940(this); - switch (this->field_0x80.HALF.LO) { + switch (this->unk_80) { case 0: - if (PlayerInRange(this, 3, (gPlayerState.hurtBlinkSpeed != 0) ? 0xa0 : 0x40) && sub_08049FDC(this, 3) && + if (PlayerInRange(super, 3, (gPlayerState.hurtBlinkSpeed != 0) ? 0xa0 : 0x40) && sub_08049FDC(super, 3) && gPlayerEntity.action != PLAYER_USEENTRANCE) { - this->field_0x80.HALF.LO++; - this->speed = 0; + this->unk_80++; + super->speed = 0; sub_08024A14(this, 3, 10); - } else if (--this->subtimer == 0) { + } else if (--super->subtimer == 0) { sub_08024A14(this, 0, 0x20); } break; case 1: - if (--this->subtimer == 0) { - if (this->type != 0) { - u8 tmp = this->field_0x82.HALF.HI & 0x80; + if (--super->subtimer == 0) { + if (super->type != 0) { + u8 tmp = this->unk_83 & 0x80; if (tmp) { sub_08024C94(this); - this->field_0x82.HALF.HI |= 0x40; + this->unk_83 |= 0x40; } else { - this->action = 3; - this->field_0x80.HALF.LO = tmp; - this->subtimer = 10; + super->action = 3; + this->unk_80 = tmp; + super->subtimer = 10; sub_08024E00(this, 0); sub_08024E1C(this); - sub_08024A14(this, 3, this->subtimer); + sub_08024A14(this, 3, super->subtimer); } } else { sub_08024C94(this); @@ -214,79 +231,79 @@ void sub_080241C0(Entity* this) { } } -void sub_08024298(Entity* this) { +void sub_08024298(PestoEntity* this) { sub_08024D00(this); } -void sub_080242A0(Entity* this) { +void sub_080242A0(PestoEntity* this) { sub_08024940(this); if (sub_08024CC0(this)) { - if (--this->timer == 0) { - this->direction = GetFacingDirection(this, gUnk_020000B0); + if (--super->timer == 0) { + super->direction = GetFacingDirection(super, gUnk_020000B0); sub_08024E00(this, 1); - if (this->speed != 0) { - this->speed = 0; + if (super->speed != 0) { + super->speed = 0; } else { sub_08024E1C(this); } - } else if (--this->subtimer == 0) { + } else if (--super->subtimer == 0) { sub_08024A14(this, 3, 10); } - if (sub_08049F1C(this, gUnk_020000B0, 0x20) && sub_08049FDC(this, 3)) { - this->action = 4; - this->field_0x80.HALF.LO = 0; - this->timer = 16; - this->speed = 0; + if (sub_08049F1C(super, gUnk_020000B0, 0x20) && sub_08049FDC(super, 3)) { + super->action = 4; + this->unk_80 = 0; + super->timer = 16; + super->speed = 0; } } } -void sub_0802433C(Entity* this) { +void sub_0802433C(PestoEntity* this) { sub_08024940(this); - switch (this->field_0x80.HALF.LO) { + switch (this->unk_80) { case 0: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->speed = 0x100; - this->subtimer = 8; + if (--super->timer == 0) { + this->unk_80++; + super->speed = 0x100; + super->subtimer = 8; sub_08024E00(this, 1); } break; case 1: - if (--this->timer == 0) { - this->action = 5; - this->field_0x80.HALF.LO = 0; - this->speed = 0x140; - this->timer = 192; - this->subtimer = 8; + if (--super->timer == 0) { + super->action = 5; + this->unk_80 = 0; + super->speed = 0x140; + super->timer = 192; + super->subtimer = 8; } else { - if (--this->subtimer == 0) + if (--super->subtimer == 0) sub_08024A14(this, 2, 4); } break; } } -void sub_080243B8(Entity* this) { +void sub_080243B8(PestoEntity* this) { sub_08024940(this); - switch (this->field_0x80.HALF.LO) { + switch (this->unk_80) { case 0: if (sub_08024C48(this, TRUE)) { - if (this->child == NULL || this->child->next == NULL) { - this->field_0x80.HALF.LO = 2; - this->timer = 32; - this->speed = 0x80; - this->field_0x82.HALF.HI = 0x80; - } else if (sub_08049F1C(this, gUnk_020000B0, 0xe)) { - this->field_0x80.HALF.LO++; - this->timer = 30; - this->speed = 0x100; - this->field_0x82.HALF.HI = 0x80; - this->child->action = 2; - } else if (--this->timer != 0) { - if (--this->subtimer == 0) { - sub_08024A14(this, 2, (this->timer >> 6) + 1); + if (super->child == NULL || super->child->next == NULL) { + this->unk_80 = 2; + super->timer = 32; + super->speed = 0x80; + this->unk_83 = 0x80; + } else if (sub_08049F1C(super, gUnk_020000B0, 0xe)) { + this->unk_80++; + super->timer = 30; + super->speed = 0x100; + this->unk_83 = 0x80; + super->child->action = 2; + } else if (--super->timer != 0) { + if (--super->subtimer == 0) { + sub_08024A14(this, 2, (super->timer >> 6) + 1); } } else { sub_08024C7C(this); @@ -296,34 +313,34 @@ void sub_080243B8(Entity* this) { } break; case 1: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->timer = 32; - this->speed = 0x80; + if (--super->timer == 0) { + this->unk_80++; + super->timer = 32; + super->speed = 0x80; } break; case 2: - if (--this->timer == 0) { - this->action = 6; - this->field_0x80.HALF.LO = 0; - this->speed = 0x80; + if (--super->timer == 0) { + super->action = 6; + this->unk_80 = 0; + super->speed = 0x80; sub_08024B38(this); - if ((this->field_0x82.HALF.HI & 0x40) == 0) { - switch (this->field_0x82.HALF.HI & 0x3f) { + if ((this->unk_83 & 0x40) == 0) { + switch (this->unk_83 & 0x3f) { case 3: - this->timer = 4; + super->timer = 4; break; case 1: - this->timer = 20; + super->timer = 20; break; default: - this->timer = 48; + super->timer = 48; break; } sub_08024A14(this, 2, 8); } else { - this->timer = 64; + super->timer = 64; sub_08024A14(this, 0, 8); } } @@ -331,36 +348,36 @@ void sub_080243B8(Entity* this) { } } -void sub_080244E8(Entity* this) { +void sub_080244E8(PestoEntity* this) { sub_08024940(this); - switch (this->field_0x80.HALF.LO) { + switch (this->unk_80) { case 0: - if (--this->timer == 0) { - if (sub_080B1B44(COORD_TO_TILE(this), 1) == 0) { - this->field_0x80.HALF.LO++; - this->field_0x82.HALF.LO++; - this->subtimer = 0; - this->speed = 0; + if (--super->timer == 0) { + if (sub_080B1B44(COORD_TO_TILE(super), 1) == 0) { + this->unk_80++; + this->unk_82++; + super->subtimer = 0; + super->speed = 0; } else { - this->timer = 48; - this->subtimer = 4; + super->timer = 48; + super->subtimer = 4; } break; } else { - if (--this->subtimer == 0) { + if (--super->subtimer == 0) { sub_08024A14(this, 1, 8); } } break; case 1: - if (++this->z.HALF.HI >= -0x10) { - this->field_0x82.HALF.LO = 0; - this->field_0x78.HWORD = -16; + if (++super->z.HALF.HI >= -0x10) { + this->unk_82 = 0; + this->unk_78 = -16; if (sub_08024AD8(this)) { - this->field_0x80.HALF.LO++; + this->unk_80++; } else { sub_08024C94(this); - this->field_0x82.HALF.HI |= 0x40; + this->unk_83 |= 0x40; } } break; @@ -368,31 +385,31 @@ void sub_080244E8(Entity* this) { if (sub_08024AD8(this)) { u32 tmp; - if (--this->timer == 0) { - if (this->speed) { - this->speed = 0; + if (--super->timer == 0) { + if (super->speed) { + super->speed = 0; } else { sub_08024E1C(this); } - this->direction = GetFacingDirection(this, this->child); + super->direction = GetFacingDirection(super, super->child); sub_08024E00(this, 0); sub_080249DC(this); - } else if (--this->subtimer == 0) { + } else if (--super->subtimer == 0) { sub_08024A14(this, 1, 8); } - switch (this->field_0x82.HALF.HI & 0x3f) { + switch (this->unk_83 & 0x3f) { case 3: - tmp = this->field_0x82.HALF.HI & 0x80; + tmp = this->unk_83 & 0x80; if (tmp == 0) { - this->field_0x80.HALF.LO++; - this->timer = 12; - this->direction = DirectionSouth; - this->speed = tmp; - this->cutsceneBeh.HALF.LO = 0; - this->flags2 &= 0xfc; + this->unk_80++; + super->timer = 12; + super->direction = DirectionSouth; + super->speed = tmp; + this->unk_84 = 0; + super->flags2 &= 0xfc; sub_080249DC(this); - this->cutsceneBeh.HALF.HI = gPlayerEntity.spritePriority.b1; + this->unk_85 = gPlayerEntity.spritePriority.b1; gPlayerEntity.flags &= ~ENT_COLLIDE; gPlayerState.flags |= PL_DISABLE_ITEMS; gPlayerState.field_0xa |= 0x80; @@ -402,44 +419,44 @@ void sub_080244E8(Entity* this) { } break; case 1: - if (EntityInRectRadius(this, this->child, 6, 6)) { + if (EntityInRectRadius(super, super->child, 6, 6)) { Entity* entity; - this->field_0x80.HALF.LO++; - this->timer = 12; - this->field_0x82.HALF.HI &= ~0x80; - CopyPosition(this->child, this); - this->z.HALF.HI -= 0xe; - this->field_0x78.HWORD -= 0xe; + this->unk_80++; + super->timer = 12; + this->unk_83 &= ~0x80; + CopyPosition(super->child, super); + super->z.HALF.HI -= 0xe; + this->unk_78 -= 0xe; - entity = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); + entity = CreateProjectileWithParent(super, DIRT_BALL_PROJECTILE, this->unk_83); if (entity != NULL) { - entity->parent = this; + entity->parent = super; entity->z.HALF.HI += 0xe; - entity->child = this->child; + entity->child = super->child; CopyPosition(entity, entity->child); - this->child = entity; + super->child = entity; } } break; case 2: - if (EntityInRectRadius(this, this->child, 6, 6)) { + if (EntityInRectRadius(super, super->child, 6, 6)) { Entity* entity; - this->field_0x80.HALF.LO++; - this->timer = 12; - this->field_0x82.HALF.HI &= ~0x80; - entity = this->child; - SetTile((u16)entity->field_0x70.HALF.LO, COORD_TO_TILE(entity), entity->collisionLayer); + this->unk_80++; + super->timer = 12; + this->unk_83 &= ~0x80; + entity = super->child; + SetTile(((PestoEntity*)entity)->unk_70, COORD_TO_TILE(entity), entity->collisionLayer); DeleteEntity(entity); - this->z.HALF.HI -= 0xe; - this->field_0x78.HWORD -= 0xe; + super->z.HALF.HI -= 0xe; + this->unk_78 -= 0xe; - entity = CreateProjectileWithParent(this, DIRT_BALL_PROJECTILE, this->field_0x82.HALF.HI); + entity = CreateProjectileWithParent(super, DIRT_BALL_PROJECTILE, this->unk_83); if (entity != NULL) { - entity->parent = this; + entity->parent = super; entity->z.HALF.HI += 0xe; - this->child = entity; + super->child = entity; } } break; @@ -447,43 +464,43 @@ void sub_080244E8(Entity* this) { break; } else { sub_08024C94(this); - this->field_0x82.HALF.HI |= 0x40; + this->unk_83 |= 0x40; } break; case 3: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->subtimer = 0; - this->speed = 0; - this->field_0x82.HALF.LO++; + if (--super->timer == 0) { + this->unk_80++; + super->subtimer = 0; + super->speed = 0; + this->unk_82++; } break; case 4: - this->z.HALF.HI -= 2; - if (-60 > this->z.HALF.HI) { - this->field_0x80.HALF.LO++; + super->z.HALF.HI -= 2; + if (-60 > super->z.HALF.HI) { + this->unk_80++; } break; case 5: - if (this->z.HALF.HI < -0x30) { - this->z.HALF.HI++; + if (super->z.HALF.HI < -0x30) { + super->z.HALF.HI++; } else { - if (this->field_0x82.HALF.LO != 0) { - this->field_0x82.HALF.LO = 0; - this->field_0x78.HWORD = -0x30; + if (this->unk_82 != 0) { + this->unk_82 = 0; + this->unk_78 = -0x30; } - switch (this->field_0x82.HALF.HI) { + switch (this->unk_83) { case 3: - if (0x2f < this->cutsceneBeh.HALF.LO) { + if (0x2f < this->unk_84) { sub_08024F50(this); } break; case 1 ... 2: - this->field_0x80.HALF.LO++; - this->timer = 192; - this->subtimer = 8; - this->speed = 0x80; + this->unk_80++; + super->timer = 192; + super->subtimer = 8; + super->speed = 0x80; sub_080249DC(this); break; default: @@ -493,110 +510,110 @@ void sub_080244E8(Entity* this) { } break; case 6: - if (--this->timer == 0) { - if (this->field_0x82.HALF.HI & 0x80) { - this->field_0x82.HALF.HI = 0xc0; - this->field_0x80.HALF.LO = 0; - this->speed = 0x40; - this->timer = 64; - this->subtimer = 8; + if (--super->timer == 0) { + if (this->unk_83 & 0x80) { + this->unk_83 = 0xc0; + this->unk_80 = 0; + super->speed = 0x40; + super->timer = 64; + super->subtimer = 8; sub_08024A14(this, 0, 8); } else { - this->timer = 64; - this->subtimer = 8; + super->timer = 64; + super->subtimer = 8; } - } else if (--this->subtimer == 0) { + } else if (--super->subtimer == 0) { sub_08024A14(this, 2, 8); } break; case 7: if (gPlayerEntity.z.HALF.HI == 0) { - this->field_0x80.HALF.LO = 0; - this->speed = 0x80; + this->unk_80 = 0; + super->speed = 0x80; sub_08024B38(this); } } - if (this->field_0x82.HALF.HI == 3) { + if (this->unk_83 == 3) { sub_08024E4C(this); } } -void sub_08024940(Entity* this) { +void sub_08024940(PestoEntity* this) { u32 random = Random() & 0x70; - if (this->collisions != COL_NONE) { - sub_0800417E(this, this->collisions); + if (super->collisions != COL_NONE) { + sub_0800417E(super, super->collisions); sub_080249F4(this); } - if (this->field_0x82.HALF.LO == 0) { - this->z.HALF.HI = this->field_0x78.HWORD; + if (this->unk_82 == 0) { + super->z.HALF.HI = this->unk_78; if (random) - this->z.HALF.HI += 2; + super->z.HALF.HI += 2; } - if (this->type2 != 0 || AreaIsDungeon()) { - if (!sub_08049FA0(this)) { - this->direction = sub_08049EE4(this); + if (super->type2 != 0 || AreaIsDungeon()) { + if (!sub_08049FA0(super)) { + super->direction = sub_08049EE4(super); sub_080249F4(this); } - if (this->z.HALF.HI < -0x20) { - this->spritePriority.b0 = 0; + if (super->z.HALF.HI < -0x20) { + super->spritePriority.b0 = 0; } else { - this->spritePriority.b0 = 1; + super->spritePriority.b0 = 1; } } - ProcessMovement1(this); - GetNextFrame(this); + ProcessMovement1(super); + GetNextFrame(super); } -void sub_080249DC(Entity* this) { - u8 direction = ((this->direction + 2) & DirectionNorthWest) >> 2; - this->animationState = direction; - InitializeAnimation(this, this->animationState); +void sub_080249DC(PestoEntity* this) { + u8 direction = ((super->direction + 2) & DirectionNorthWest) >> 2; + super->animationState = direction; + InitializeAnimation(super, super->animationState); } -void sub_080249F4(Entity* this) { - u32 direction = ((this->direction + 2) & (0x3 | DirectionNorthWest)); +void sub_080249F4(PestoEntity* this) { + u32 direction = ((super->direction + 2) & (0x3 | DirectionNorthWest)); direction >>= 2; - if (direction != this->animationState) { - this->animationState = direction; - InitializeAnimation(this, this->animationState); + if (direction != super->animationState) { + super->animationState = direction; + InitializeAnimation(super, super->animationState); } } -void sub_08024A14(Entity* this, u32 param_2, u32 param_3) { +void sub_08024A14(PestoEntity* this, u32 param_2, u32 param_3) { u8 unk = FALSE; switch (param_2) { case 0: - sub_08004596(this, sub_08049EE4(this)); + sub_08004596(super, sub_08049EE4(super)); unk = TRUE; break; case 1: if (sub_08024C48(this, FALSE)) { - sub_08004596(this, GetFacingDirection(this, this->child)); + sub_08004596(super, GetFacingDirection(super, super->child)); unk = TRUE; } break; case 2: if (sub_08024C48(this, TRUE)) { - sub_08004596(this, GetFacingDirection(this, gUnk_020000B0)); + sub_08004596(super, GetFacingDirection(super, gUnk_020000B0)); unk = TRUE; } break; case 3: if (sub_08024C48(this, TRUE)) { - this->direction = GetFacingDirection(this, gUnk_020000B0); + super->direction = GetFacingDirection(super, gUnk_020000B0); unk = TRUE; } break; } - if (param_2 != 0 && !sub_08049FA0(this) && (Random() & 3)) { + if (param_2 != 0 && !sub_08049FA0(super) && (Random() & 3)) { unk = FALSE; } @@ -605,25 +622,25 @@ void sub_08024A14(Entity* this, u32 param_2, u32 param_3) { } sub_080249DC(this); - this->subtimer = param_3; + super->subtimer = param_3; } -bool32 sub_08024AD8(Entity* this) { - if ((this->field_0x82.HALF.HI & 0x40) == 0) { +bool32 sub_08024AD8(PestoEntity* this) { + if ((this->unk_83 & 0x40) == 0) { u8 unk = FALSE; - if ((this->field_0x82.HALF.HI & 0x3f) == 3) { + if ((this->unk_83 & 0x3f) == 3) { if (gPlayerState.hurtBlinkSpeed == 0) { - this->child->parent = NULL; - this->child = NULL; - this->field_0x82.HALF.HI = 0xc0; + super->child->parent = NULL; + super->child = NULL; + this->unk_83 = 0xc0; return FALSE; } unk = TRUE; } if (sub_08024C48(this, unk) == 0) { - this->child = NULL; - this->field_0x82.HALF.HI = 0xc0; + super->child = NULL; + this->unk_83 = 0xc0; return FALSE; } } else { @@ -633,7 +650,7 @@ bool32 sub_08024AD8(Entity* this) { return TRUE; } -bool32 sub_08024B38(Entity* this) { +bool32 sub_08024B38(PestoEntity* this) { int iVar4 = 0; Entity* entity; @@ -646,15 +663,15 @@ bool32 sub_08024B38(Entity* this) { } } if (gPlayerState.hurtBlinkSpeed != 0) { - if (sub_08024C48(this, 1) && sub_08049F1C(this, gUnk_020000B0, 0xa0)) { + if (sub_08024C48(this, 1) && sub_08049F1C(super, gUnk_020000B0, 0xa0)) { iVar4 = 1; - this->child = gUnk_020000B0; - this->field_0x82.HALF.HI |= 3; - this->field_0x82.HALF.HI &= ~0x40; + super->child = gUnk_020000B0; + this->unk_83 |= 3; + this->unk_83 &= ~0x40; } if (iVar4 == 0) { - this->child = NULL; + super->child = NULL; } return iVar4; } @@ -663,11 +680,11 @@ bool32 sub_08024B38(Entity* this) { entity = FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_BOMB, 2); if (entity != NULL) { do { - if (entity->action != 2 && entity->z.HALF.HI == 0 && sub_08049F1C(this, entity, 0xa0)) { + if (entity->action != 2 && entity->z.HALF.HI == 0 && sub_08049F1C(super, entity, 0xa0)) { iVar4 = 1; - this->child = entity; - this->field_0x82.HALF.HI |= 1; - this->field_0x82.HALF.HI &= ~0x40; + super->child = entity; + this->unk_83 |= 1; + this->unk_83 &= ~0x40; break; } } while (entity = FindNextDuplicateID(entity, 2), entity != NULL); @@ -680,24 +697,24 @@ bool32 sub_08024B38(Entity* this) { entity = FindEntityByID(OBJECT, POT, 6); if (entity != NULL) { do { - if (entity->action == 1 && sub_08049F1C(this, entity, 0xa0)) { + if (entity->action == 1 && sub_08049F1C(super, entity, 0xa0)) { iVar4 = 1; - this->child = entity; - this->field_0x82.HALF.HI |= 2; - this->field_0x82.HALF.HI &= ~0x40; + super->child = entity; + this->unk_83 |= 2; + this->unk_83 &= ~0x40; break; } } while (entity = FindNextDuplicateID(entity, 6), entity != NULL); } if (iVar4 == 0) { - this->child = NULL; + super->child = NULL; } return iVar4; } -bool32 sub_08024C48(Entity* this, bool32 unk) { +bool32 sub_08024C48(PestoEntity* this, bool32 unk) { bool32 rv = TRUE; u32 val; @@ -708,85 +725,85 @@ bool32 sub_08024C48(Entity* this, bool32 unk) { rv = FALSE; } } else { - if (this->child == NULL) { - this->child = NULL; + if (super->child == NULL) { + super->child = NULL; rv = FALSE; - } else if (this->child->next == NULL) { - this->child = NULL; + } else if (super->child->next == NULL) { + super->child = NULL; rv = FALSE; - } else if (this->child->z.HALF.HI < 0) { - this->child = NULL; + } else if (super->child->z.HALF.HI < 0) { + super->child = NULL; rv = FALSE; } } return rv; } -void sub_08024C7C(Entity* this) { - this->action = 1; - this->speed = 0x40; - this->timer = 0; +void sub_08024C7C(PestoEntity* this) { + super->action = 1; + super->speed = 0x40; + super->timer = 0; sub_08024A14(this, 0, 0x20); } -void sub_08024C94(Entity* this) { - this->action = 2; - this->field_0x80.HALF.LO = 0; - this->timer = 64; - this->subtimer = 0; - this->speed = 0xc0; - this->field_0x82.HALF.HI = 0x80; - sub_08024A14(this, 3, this->subtimer); +void sub_08024C94(PestoEntity* this) { + super->action = 2; + this->unk_80 = 0; + super->timer = 64; + super->subtimer = 0; + super->speed = 0xc0; + this->unk_83 = 0x80; + sub_08024A14(this, 3, super->subtimer); } -bool32 sub_08024CC0(Entity* this) { +bool32 sub_08024CC0(PestoEntity* this) { bool32 uVar2; uVar2 = TRUE; if (!sub_08024C48(this, 1)) { uVar2 = FALSE; - } else if (!sub_08049F1C(this, gUnk_020000B0, 0x50) || !sub_08049FDC(this, 3)) { + } else if (!sub_08049F1C(super, gUnk_020000B0, 0x50) || !sub_08049FDC(super, 3)) { uVar2 = FALSE; sub_08024C7C(this); } return uVar2; } -void sub_08024D00(Entity* this) { - if (this->field_0x86.HALF.LO) { - this->field_0x86.HALF.LO--; - GetNextFrame(this); +void sub_08024D00(PestoEntity* this) { + if (this->unk_86) { + this->unk_86--; + GetNextFrame(super); } else { sub_08024940(this); } - if ((this->field_0x82.HALF.HI & 0x40) && sub_08024B38(this)) { - this->action = 6; - this->field_0x80.HALF.LO = 2; + if ((this->unk_83 & 0x40) && sub_08024B38(this)) { + super->action = 6; + this->unk_80 = 2; } else if (sub_08024CC0(this)) { - switch (this->field_0x80.HALF.LO) { + switch (this->unk_80) { case 0: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->timer = (Random() & 0xf) + 32; + if (--super->timer == 0) { + this->unk_80++; + super->timer = (Random() & 0xf) + 32; - this->direction += this->field_0x80.HALF.HI ? DirectionNorthEast : DirectionNorthWest; - this->direction &= 0x3 | DirectionNorthWest; + super->direction += this->unk_81 ? DirectionNorthEast : DirectionNorthWest; + super->direction &= 0x3 | DirectionNorthWest; - this->field_0x80.HALF.HI ^= 0x40; + this->unk_81 ^= 0x40; sub_08024A14(this, 3, 0x10); } break; case 1: - if (--this->timer == 0) { - this->field_0x80.HALF.LO = 0; - this->timer = (Random() & 0x1f) + 32; + if (--super->timer == 0) { + this->unk_80 = 0; + super->timer = (Random() & 0x1f) + 32; } else { - if (--this->subtimer == 0) { - this->direction += this->field_0x80.HALF.HI ? 1 : (0x3 | DirectionNorthWest); - this->direction &= 0x3 | DirectionNorthWest; + if (--super->subtimer == 0) { + super->direction += this->unk_81 ? 1 : (0x3 | DirectionNorthWest); + super->direction &= 0x3 | DirectionNorthWest; - this->subtimer = 16; + super->subtimer = 16; sub_080249DC(this); } } @@ -795,12 +812,12 @@ void sub_08024D00(Entity* this) { } } -void sub_08024E00(Entity* this, u32 unk) { - this->timer = gUnk_080CBF10[sub_08024E34() * 2 | unk]; +void sub_08024E00(PestoEntity* this, u32 unk) { + super->timer = gUnk_080CBF10[sub_08024E34() * 2 | unk]; } -void sub_08024E1C(Entity* this) { - this->speed = gUnk_080CBF18[sub_08024E34()]; +void sub_08024E1C(PestoEntity* this) { + super->speed = gUnk_080CBF18[sub_08024E34()]; } u32 sub_08024E34(void) { @@ -808,23 +825,23 @@ u32 sub_08024E34(void) { return gUnk_080CBF20[idx]; } -void sub_08024E4C(Entity* this) { - if (this->field_0x82.HALF.HI == 3) { - this->subtimer = ++this->subtimer & 0x1f; +void sub_08024E4C(PestoEntity* this) { + if (this->unk_83 == 3) { + super->subtimer = ++super->subtimer & 0x1f; if (sub_0807953C()) { u32 r = Random(); - this->cutsceneBeh.HALF.LO++; + this->unk_84++; r &= 1; - this->cutsceneBeh.HALF.LO += r; + this->unk_84 += r; } - if (gSave.stats.health == 0 || this->field_0x86.HALF.HI == 4) { - this->cutsceneBeh.HALF.LO = 0x30; - this->field_0x86.HALF.HI = 0; + if (gSave.stats.health == 0 || this->unk_87 == 4) { + this->unk_84 = 0x30; + this->unk_87 = 0; sub_08024F50(this); - this->field_0x80.HALF.LO = 0; - this->speed = 0x40; - this->timer = 64; - this->subtimer = 8; + this->unk_80 = 0; + super->speed = 0x40; + super->timer = 64; + super->subtimer = 8; sub_08024A14(this, 0, 8); } else { Entity* player = &gPlayerEntity; @@ -835,12 +852,12 @@ void sub_08024E4C(Entity* this) { gPlayerState.field_0x38 = 0x14; gPlayerState.field_0x39 = 1; *(u8*)&gPlayerState.field_0x3a = 0; - PositionRelative(this, player, 0, Q_16_16(1.0)); + PositionRelative(super, player, 0, Q_16_16(1.0)); player->spriteOffsetY = 0x1a; player->animationState = 4; player->spritePriority.b1 = 0; - if (this->subtimer == 0) { - this->field_0x86.HALF.HI++; + if (super->subtimer == 0) { + this->unk_87++; player->iframes = 8; ModHealth(-2); SoundReqClipped(player, SFX_PLY_VO6); @@ -849,36 +866,36 @@ void sub_08024E4C(Entity* this) { } } -void sub_08024F50(Entity* this) { +void sub_08024F50(PestoEntity* this) { gPlayerState.field_0xa = 0; gPlayerState.flags &= ~PL_DISABLE_ITEMS; - CopyPosition(this, &gPlayerEntity); + CopyPosition(super, &gPlayerEntity); gPlayerEntity.action = PLAYER_NORMAL; COLLISION_ON(&gPlayerEntity); gPlayerEntity.iframes = -0x3c; gPlayerEntity.direction = gPlayerEntity.animationState << 2; gPlayerEntity.speed = 0; - gPlayerEntity.spritePriority.b1 = this->cutsceneBeh.HALF.HI; + gPlayerEntity.spritePriority.b1 = this->unk_85; gPlayerEntity.z.HALF.HI = gPlayerEntity.spriteOffsetY; gPlayerEntity.spriteOffsetY = 0; - this->flags2 |= 3; - this->field_0x82.HALF.HI = 0xc0; - this->field_0x80.HALF.LO += 2; - this->cutsceneBeh.HALF.LO = 0; - this->speed = 0x80; + super->flags2 |= 3; + this->unk_83 = 0xc0; + this->unk_80 += 2; + this->unk_84 = 0; + super->speed = 0x80; } // clang-format off -void (*const Pesto_Functions[])(Entity*) = { +void (*const Pesto_Functions[])(PestoEntity*) = { Pesto_OnTick, Pesto_OnCollision, Pesto_OnKnockback, - GenericDeath, - GenericConfused, + (void (*)(PestoEntity*))GenericDeath, + (void (*)(PestoEntity*))GenericConfused, Pesto_OnGrabbed, }; -void (*const gUnk_080CBEDC[])(Entity*) = { +void (*const gUnk_080CBEDC[])(PestoEntity*) = { sub_080240B8, sub_080241C0, sub_08024298, @@ -888,7 +905,7 @@ void (*const gUnk_080CBEDC[])(Entity*) = { sub_080244E8, }; -void (*const gUnk_080CBEF8[])(Entity*) = { +void (*const gUnk_080CBEF8[])(PestoEntity*) = { sub_08024038, sub_08024048, sub_08024058, diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index 9d085722..1b1a93f6 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -4,7 +4,7 @@ * * @brief Puffstool enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "object.h" @@ -15,11 +15,7 @@ typedef struct { /*0x78*/ u16 unk_78; /*0x7a*/ u8 unk_7a; /*0x7b*/ u8 unk_7b; - /*0x7c*/ u8 unk_7c; -// // Overlap of 1 -// /*0x7c*/ u16 unk_7c; -// Overlap of 1 - /*0x7d*/ u8 unk_7d; + /*0x7c*/ u16 unk_7c; /*0x7e*/ u16 unk_7e; /*0x80*/ u8 unk_80; /*0x81*/ u8 unk_81; @@ -31,24 +27,24 @@ typedef struct { extern u8 gUnk_080B3E80[]; -bool32 sub_080258C4(Entity*); -void sub_08025B18(Entity*); -void sub_08025C2C(Entity*); -void sub_08025BD4(Entity*); -void sub_080256B4(Entity*); -bool32 sub_08025C44(Entity*); -u32 sub_08025C60(Entity*); -bool32 sub_0802571C(Entity*); -void sub_08025A54(Entity*); -void sub_08025AE8(Entity*); -bool32 sub_0802594C(Entity*, u32); -bool32 sub_080257EC(Entity*, u32, u32); +bool32 sub_080258C4(PuffstoolEntity*); +void sub_08025B18(PuffstoolEntity*); +void sub_08025C2C(PuffstoolEntity*); +void sub_08025BD4(PuffstoolEntity*); +void sub_080256B4(PuffstoolEntity*); +bool32 sub_08025C44(PuffstoolEntity*); +u32 sub_08025C60(PuffstoolEntity*); +bool32 sub_0802571C(PuffstoolEntity*); +void sub_08025A54(PuffstoolEntity*); +void sub_08025AE8(PuffstoolEntity*); +bool32 sub_0802594C(PuffstoolEntity*, u32); +bool32 sub_080257EC(PuffstoolEntity*, u32, u32); bool32 sub_08025AB8(u32, u32); -extern void (*const Puffstool_Functions[])(Entity*); -extern void (*const gUnk_080CBFB4[])(Entity*); +extern void (*const Puffstool_Functions[])(PuffstoolEntity*); +extern void (*const gUnk_080CBFB4[])(PuffstoolEntity*); extern const u8 gUnk_080CBFE8[]; -extern void (*const gUnk_080CBFEC[])(Entity*); +extern void (*const gUnk_080CBFEC[])(PuffstoolEntity*); extern const u8 gUnk_080CBFF8[]; extern const u16 gUnk_080CC000[]; extern const s8 gUnk_080CC020[]; @@ -59,277 +55,276 @@ extern const s8 gUnk_080CC0A8[]; extern const s8 gUnk_080CC0BA[]; extern const s8 gUnk_080CC0C2[]; -void Puffstool(Entity* this) { - EnemyFunctionHandler(this, Puffstool_Functions); - SetChildOffset(this, 0, 1, -0x10); +void Puffstool(PuffstoolEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)Puffstool_Functions); + SetChildOffset(super, 0, 1, -0x10); } -void Puffstool_OnTick(Entity* this) { - gUnk_080CBFB4[this->action](this); +void Puffstool_OnTick(PuffstoolEntity* this) { + gUnk_080CBFB4[super->action](this); } -void Puffstool_OnCollide(Entity* this) { +void Puffstool_OnCollide(PuffstoolEntity* this) { u8 tmp; - switch (this->contactFlags & 0x7f) { + switch (super->contactFlags & 0x7f) { case 0 ... 3: /* ... */ break; case 0x1b: - sub_0804AA1C(this); + sub_0804AA1C(super); - tmp = gUnk_080CBFE8[(*(Entity**)&this->contactedEntity)->type]; - if (tmp < this->field_0x82.HALF.LO) { - this->field_0x82.HALF.LO -= gUnk_080CBFE8[(*(Entity**)&this->contactedEntity)->type]; + tmp = gUnk_080CBFE8[(*(Entity**)&super->contactedEntity)->type]; + if (tmp < this->unk_82) { + this->unk_82 -= gUnk_080CBFE8[(*(Entity**)&super->contactedEntity)->type]; } else { - this->cutsceneBeh.HWORD = 0x294; - this->hitType = 0x83; - this->field_0x82.HALF.LO = 0; - ChangeObjPalette(this, 0x7c); + this->unk_84 = 0x294; + super->hitType = 0x83; + this->unk_82 = 0; + ChangeObjPalette(super, 0x7c); } - this->action = 7; - this->timer = 60; - if (0 < this->zVelocity) { - this->zVelocity = 0; + super->action = 7; + super->timer = 60; + if (0 < super->zVelocity) { + super->zVelocity = 0; } - this->iframes = -0xc; - this->knockbackDuration = 0; - if (this->field_0x80.HALF.LO == 0) { - this->animationState = (*(Entity**)&this->contactedEntity)->direction >> 3; - InitializeAnimation(this, this->animationState + 4); - this->frameDuration = 6; - this->field_0x80.HALF.LO = 1; + super->iframes = -0xc; + super->knockbackDuration = 0; + if (this->unk_80 == 0) { + super->animationState = (*(Entity**)&super->contactedEntity)->direction >> 3; + InitializeAnimation(super, super->animationState + 4); + super->frameDuration = 6; + this->unk_80 = 1; } break; default: - if (this->hitType == 0x82 && this->iframes < 0) { + if (super->hitType == 0x82 && super->iframes < 0) { Entity* entity = CreateObject(DIRT_PARTICLE, 2, 0); if (entity != NULL) { entity->spritePriority.b0 = 3; - CopyPosition(this, entity); + CopyPosition(super, entity); } EnqueueSFX(SFX_186); } break; } - EnemyFunctionHandlerAfterCollision(this, Puffstool_Functions); + EnemyFunctionHandlerAfterCollision(super, Puffstool_Functions); } -void Puffstool_OnDeath(Entity* this) { - if ((this->gustJarState & 2) && this->timer == 1 && this->field_0x82.HALF.LO) { +void Puffstool_OnDeath(PuffstoolEntity* this) { + if ((super->gustJarState & 2) && super->timer == 1 && this->unk_82) { sub_08025B18(this); } - GenericDeath(this); + GenericDeath(super); } -void Puffstool_OnGrabbed(Entity* this) { - GravityUpdate(this, Q_8_8(32.0)); - if (sub_0806F520(this)) { - gUnk_080CBFEC[this->subAction](this); +void Puffstool_OnGrabbed(PuffstoolEntity* this) { + GravityUpdate(super, Q_8_8(32.0)); + if (sub_0806F520(super)) { + gUnk_080CBFEC[super->subAction](this); } else { sub_08025C2C(this); } } -void sub_08025180(Entity* this) { - this->subAction = 1; - this->timer = Random(); - this->animationState = (((*(Entity**)&this->contactedEntity)->direction ^ 0x10) >> 3); - InitializeAnimation(this, this->animationState + 4); - sub_0804AA1C(this); +void sub_08025180(PuffstoolEntity* this) { + super->subAction = 1; + super->timer = Random(); + super->animationState = (((*(Entity**)&super->contactedEntity)->direction ^ 0x10) >> 3); + InitializeAnimation(super, super->animationState + 4); + sub_0804AA1C(super); } -void sub_080251AC(Entity* this) { - if (this->field_0x82.HALF.LO >= 4) { - this->field_0x82.HALF.LO -= 3; - if ((--this->timer & 3) == 0) { +void sub_080251AC(PuffstoolEntity* this) { + if (this->unk_82 >= 4) { + this->unk_82 -= 3; + if ((--super->timer & 3) == 0) { sub_08025BD4(this); } } else { - this->cutsceneBeh.HWORD = 0x294; - this->hitType = 0x83; - this->field_0x82.HALF.LO = 0; - ChangeObjPalette(this, 0x7c); + this->unk_84 = 0x294; + super->hitType = 0x83; + this->unk_82 = 0; + ChangeObjPalette(super, 0x7c); } - GetNextFrame(this); + GetNextFrame(super); } -void sub_080251FC(Entity* this) { - sub_0804A720(this); - this->field_0x82.HALF.LO = 240; - this->direction = Random() & 0x1c; - this->field_0x80.HALF.LO = 0; +void sub_080251FC(PuffstoolEntity* this) { + sub_0804A720(super); + this->unk_82 = 240; + super->direction = Random() & 0x1c; + this->unk_80 = 0; sub_080256B4(this); - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); } -void sub_08025230(Entity* this) { - if (this->field_0x80.HALF.HI) - this->field_0x80.HALF.HI--; +void sub_08025230(PuffstoolEntity* this) { + if (this->unk_81) + this->unk_81--; sub_08025C44(this); - GetNextFrame(this); - if (--this->timer == 0) { - this->timer = (Random() & 3) + 4; - this->direction = sub_08025C60(this); + GetNextFrame(super); + if (--super->timer == 0) { + super->timer = (Random() & 3) + 4; + super->direction = sub_08025C60(this); } - if (this->collisions != COL_NONE) { - if (--this->subtimer == 0) { - sub_0800417E(this, this->collisions); + if (super->collisions != COL_NONE) { + if (--super->subtimer == 0) { + sub_0800417E(super, super->collisions); } } else { - this->subtimer = 30; + super->subtimer = 30; } - if (this->field_0x78.HWORD == 0) { + if (this->unk_78 == 0) { if (sub_0802571C(this)) { - this->action = 2; - this->timer = 240; - this->field_0x86.HWORD = COORD_TO_TILE(this); + super->action = 2; + super->timer = 240; + this->unk_86 = COORD_TO_TILE(super); } } else { - this->field_0x78.HWORD--; + this->unk_78--; } } -void sub_080252E0(Entity* this) { +void sub_080252E0(PuffstoolEntity* this) { u32 tile; - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, (u16)this->field_0x7c.HALF.LO, - (u16)this->field_0x7c.HALF.HI); + super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, this->unk_7c, this->unk_7e); sub_08025C44(this); - GetNextFrame(this); + GetNextFrame(super); - tile = COORD_TO_TILE(this); - if (tile == this->field_0x86.HWORD) { - if (--this->timer == 0) { + tile = COORD_TO_TILE(super); + if (tile == this->unk_86) { + if (--super->timer == 0) { sub_080256B4(this); } } else { - this->field_0x86.HWORD = tile; - this->timer = 240; + this->unk_86 = tile; + super->timer = 240; } - if (this->x.HALF.HI == (u16)this->field_0x7c.HALF.LO && this->y.HALF.HI == (u16)this->field_0x7c.HALF.HI) { - this->action = 3; - this->timer = 30; - this->subtimer = 0; - this->zVelocity = Q_16_16(1.5); - InitializeAnimation(this, 1); + if (super->x.HALF.HI == this->unk_7c && super->y.HALF.HI == this->unk_7e) { + super->action = 3; + super->timer = 30; + super->subtimer = 0; + super->zVelocity = Q_16_16(1.5); + InitializeAnimation(super, 1); } } -void sub_0802538C(Entity* this) { - if (this->timer) { - this->timer--; +void sub_0802538C(PuffstoolEntity* this) { + if (super->timer) { + super->timer--; } else { - if (this->frame == 0) { - GetNextFrame(this); + if (super->frame == 0) { + GetNextFrame(super); } else { - GravityUpdate(this, Q_8_8(32.0)); - if (this->zVelocity < Q_16_16(0.125)) { - this->action = 4; - InitializeAnimation(this, 2); + GravityUpdate(super, Q_8_8(32.0)); + if (super->zVelocity < Q_16_16(0.125)) { + super->action = 4; + InitializeAnimation(super, 2); } } } } -void sub_080253D4(Entity* this) { - GetNextFrame(this); - if (!GravityUpdate(this, Q_8_8(32.0))) { - if (this->subtimer == 0) { - this->action = 5; - InitializeAnimation(this, 3); +void sub_080253D4(PuffstoolEntity* this) { + GetNextFrame(super); + if (!GravityUpdate(super, Q_8_8(32.0))) { + if (super->subtimer == 0) { + super->action = 5; + InitializeAnimation(super, 3); } else { - this->action = 6; - this->timer = 30; - InitializeAnimation(this, 3); + super->action = 6; + super->timer = 30; + InitializeAnimation(super, 3); sub_08025A54(this); sub_08025AE8(this); } } } -void sub_0802541C(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 3; - this->subtimer = 1; - this->zVelocity = Q_16_16(2.0); - InitializeAnimation(this, 1); +void sub_0802541C(PuffstoolEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 3; + super->subtimer = 1; + super->zVelocity = Q_16_16(2.0); + InitializeAnimation(super, 1); } } -void sub_0802544C(Entity* this) { - if (this->frame == 0) { - GetNextFrame(this); +void sub_0802544C(PuffstoolEntity* this) { + if (super->frame == 0) { + GetNextFrame(super); } else { - if (--this->timer == 0) { + if (--super->timer == 0) { sub_080256B4(this); - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); } } } -void sub_0802547C(Entity* this) { - GravityUpdate(this, Q_8_8(32.0)); - GetNextFrame(this); - if ((this->timer & 7) == 0) { +void sub_0802547C(PuffstoolEntity* this) { + GravityUpdate(super, Q_8_8(32.0)); + GetNextFrame(super); + if ((super->timer & 7) == 0) { sub_08025BD4(this); } - if (--this->timer == 0) { + if (--super->timer == 0) { sub_08025C2C(this); } } -void sub_080254B4(Entity* this) { - GravityUpdate(this, Q_8_8(32.0)); - if (this->frame & ANIM_DONE) { - if (this->z.HALF.HI == 0) { - if (this->cutsceneBeh.HWORD == 0) { - this->hitType = 0x82; - this->field_0x82.HALF.LO = -0x10; +void sub_080254B4(PuffstoolEntity* this) { + GravityUpdate(super, Q_8_8(32.0)); + if (super->frame & ANIM_DONE) { + if (super->z.HALF.HI == 0) { + if (this->unk_84 == 0) { + super->hitType = 0x82; + this->unk_82 = -0x10; sub_080256B4(this); } else { - this->action = 0xc; - Create0x68FX(this, FX_STARS); + super->action = 0xc; + Create0x68FX(super, FX_STARS); } - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); } } else { - GetNextFrame(this); + GetNextFrame(super); } } -void sub_08025514(Entity* this) { - GetNextFrame(this); - if (sub_0802594C(this, this->timer++)) { - this->action = 2; - this->timer = 240; - this->field_0x80.HALF.HI = 120; - } else if (3 < this->timer) { - this->action = 10; - this->timer = 32; +void sub_08025514(PuffstoolEntity* this) { + GetNextFrame(super); + if (sub_0802594C(this, super->timer++)) { + super->action = 2; + super->timer = 240; + this->unk_81 = 120; + } else if (3 < super->timer) { + super->action = 10; + super->timer = 32; } } -void sub_08025554(Entity* this) { +void sub_08025554(PuffstoolEntity* this) { Entity* entity = sub_08049DF4(1); if (entity == NULL) { sub_080256B4(this); } else { - if ((this->timer & 3) == 0) { - this->direction = GetFacingDirection(entity, this); + if ((super->timer & 3) == 0) { + super->direction = GetFacingDirection(entity, super); } sub_08025C44(this); - GetNextFrame(this); - if (this->timer != 0) { - this->timer--; + GetNextFrame(super); + if (super->timer != 0) { + super->timer--; } else { if (!sub_080258C4(this)) { sub_080256B4(this); @@ -338,19 +333,19 @@ void sub_08025554(Entity* this) { } } -void sub_080255AC(Entity* this) { +void sub_080255AC(PuffstoolEntity* this) { Entity* entity = sub_08049DF4(1); if (entity == NULL) { sub_080256B4(this); } else { - if (this->field_0x80.HALF.HI != 0) { - this->field_0x80.HALF.HI--; + if (this->unk_81 != 0) { + this->unk_81--; } - if (--this->timer == 0) { + if (--super->timer == 0) { s32 tmp; - this->timer = (Random() & 3) + 4; + super->timer = (Random() & 3) + 4; tmp = Random() & 0xf; if (tmp < 8) { @@ -358,57 +353,57 @@ void sub_080255AC(Entity* this) { } tmp -= 7; - this->direction = (GetFacingDirection(entity, this) + tmp) & (0x3 | DirectionNorthWest); + super->direction = (GetFacingDirection(entity, super) + tmp) & (0x3 | DirectionNorthWest); } - if (this->field_0x78.HWORD == 0) { + if (this->unk_78 == 0) { if (sub_080258C4(this) == 0) { sub_080256B4(this); } } else { - this->field_0x78.HWORD--; + this->unk_78--; } sub_08025C44(this); - GetNextFrame(this); + GetNextFrame(super); } } -void sub_0802563C(Entity* this) { - GetNextFrame(this); +void sub_0802563C(PuffstoolEntity* this) { + GetNextFrame(super); - if (--this->cutsceneBeh.HWORD == 0) { - ChangeObjPalette(this, 0x28); - this->hitType = 0x82; - this->field_0x82.HALF.LO = 240; + if (--this->unk_84 == 0) { + ChangeObjPalette(super, 0x28); + super->hitType = 0x82; + this->unk_82 = 240; sub_080256B4(this); - sub_0804AA1C(this); - } else if (this->cutsceneBeh.HWORD < 120) { - u32 tmp3 = gUnk_080CBFF8[this->cutsceneBeh.HWORD >> 4]; - if ((this->cutsceneBeh.HWORD & tmp3) == 0) { - if (this->cutsceneBeh.HWORD & (tmp3 + 1)) { - ChangeObjPalette(this, 124); + sub_0804AA1C(super); + } else if (this->unk_84 < 120) { + u32 tmp3 = gUnk_080CBFF8[this->unk_84 >> 4]; + if ((this->unk_84 & tmp3) == 0) { + if (this->unk_84 & (tmp3 + 1)) { + ChangeObjPalette(super, 124); } else { - ChangeObjPalette(this, 40); + ChangeObjPalette(super, 40); } } } } -void sub_080256B4(Entity* this) { - this->action = 1; - this->timer = (Random() & 3) + 4; - this->subtimer = 30; - this->direction = (this->direction + 7 + ((s32)Random() % 7) * 4) & DirectionNorthWest; - this->field_0x78.HWORD = gUnk_080CC000[Random() & 0xf]; - this->field_0x7a.HALF.LO = ((s32)Random() % 0x18) << 1; - this->field_0x7a.HALF.HI = 0; +void sub_080256B4(PuffstoolEntity* this) { + super->action = 1; + super->timer = (Random() & 3) + 4; + super->subtimer = 30; + super->direction = (super->direction + 7 + ((s32)Random() % 7) * 4) & DirectionNorthWest; + this->unk_78 = gUnk_080CC000[Random() & 0xf]; + this->unk_7a = ((s32)Random() % 0x18) << 1; + this->unk_7b = 0; } -bool32 sub_0802571C(Entity* this) { +bool32 sub_0802571C(PuffstoolEntity* this) { RoomControls* ctrl = &gRoomControls; - u16 xDiff = (this->x.HALF.HI - ctrl->origin_x + 8) & -0x10; - u16 yDiff = (this->y.HALF.HI - ctrl->origin_y + 8) & -0x10; - u16 unk = this->field_0x7a.HALF.LO; + u16 xDiff = (super->x.HALF.HI - ctrl->origin_x + 8) & -0x10; + u16 yDiff = (super->y.HALF.HI - ctrl->origin_y + 8) & -0x10; + u16 unk = this->unk_7a; u16 i; for (i = 0; i < 4; i++) { @@ -416,8 +411,8 @@ bool32 sub_0802571C(Entity* this) { u16 sVar4 = yDiff + gUnk_080CC020[unk + 1]; if (sub_080257EC(this, sVar3, sVar4)) { - this->field_0x7c.HALF.LO = sVar3 + ctrl->origin_x; - this->field_0x7c.HALF.HI = sVar4 + ctrl->origin_y; + this->unk_7c = sVar3 + ctrl->origin_x; + this->unk_7e = sVar4 + ctrl->origin_y; return TRUE; } @@ -427,28 +422,28 @@ bool32 sub_0802571C(Entity* this) { } } - this->field_0x7a.HALF.LO = unk; - this->field_0x7a.HALF.HI++; + this->unk_7a = unk; + this->unk_7b++; return FALSE; } -bool32 sub_080257EC(Entity* this, u32 x, u32 y) { - u16 tileType = sub_080B1A48(x - 0x00, y - 0x00, this->collisionLayer); +bool32 sub_080257EC(PuffstoolEntity* this, u32 x, u32 y) { + u16 tileType = sub_080B1A48(x - 0x00, y - 0x00, super->collisionLayer); if (tileType != 0x312 && gUnk_080B37A0[tileType] != 0x16 && gUnk_080B3E80[tileType] == 0) { return TRUE; } - tileType = sub_080B1A48(x - 0x10, y - 0x00, this->collisionLayer); + tileType = sub_080B1A48(x - 0x10, y - 0x00, super->collisionLayer); if (tileType != 0x312 && gUnk_080B37A0[tileType] != 0x16 && gUnk_080B3E80[tileType] == 0) { return TRUE; } - tileType = sub_080B1A48(x - 0x00, y - 0x10, this->collisionLayer); + tileType = sub_080B1A48(x - 0x00, y - 0x10, super->collisionLayer); if (tileType != 0x312 && gUnk_080B37A0[tileType] != 0x16 && gUnk_080B3E80[tileType] == 0) { return TRUE; } - tileType = sub_080B1A48(x - 0x10, y - 0x10, this->collisionLayer); + tileType = sub_080B1A48(x - 0x10, y - 0x10, super->collisionLayer); if (tileType != 0x312 && gUnk_080B37A0[tileType] != 0x16 && gUnk_080B3E80[tileType] == 0) { return TRUE; } @@ -456,26 +451,26 @@ bool32 sub_080257EC(Entity* this, u32 x, u32 y) { return FALSE; } -bool32 sub_080258C4(Entity* this) { +bool32 sub_080258C4(PuffstoolEntity* this) { Entity* entity = sub_08049DF4(1); if (entity == NULL) { return FALSE; } else { s32 iVar4; s32 iVar1; - iVar4 = entity->x.HALF.HI - this->x.HALF.HI; + iVar4 = entity->x.HALF.HI - super->x.HALF.HI; iVar4 = iVar4 * iVar4; - iVar1 = entity->y.HALF.HI - this->y.HALF.HI; + iVar1 = entity->y.HALF.HI - super->y.HALF.HI; iVar1 = iVar1 * iVar1; iVar4 = iVar4 + iVar1; - if (this->cutsceneBeh.HWORD == 0 && this->field_0x80.HALF.HI == 0 && 0x400 >= iVar4) { - this->action = 9; - this->timer = 0; + if (this->unk_84 == 0 && this->unk_81 == 0 && 0x400 >= iVar4) { + super->action = 9; + super->timer = 0; return TRUE; } else if (0x900 >= iVar4) { - this->action = 11; - this->timer = 1; - this->field_0x78.HWORD = gUnk_080CC050[Random() & 0xf]; + super->action = 11; + super->timer = 1; + this->unk_78 = gUnk_080CC050[Random() & 0xf]; return TRUE; } else { return FALSE; @@ -484,15 +479,15 @@ bool32 sub_080258C4(Entity* this) { } // regalloc -bool32 sub_0802594C(Entity* this, u32 param_2) { +bool32 sub_0802594C(PuffstoolEntity* this, u32 param_2) { s16 xDiff; s16 yDiff; s16 iVar9; u32 uVar1; const s8* unk = gUnk_080CC090[param_2]; - uVar1 = this->collisionLayer; - xDiff = (this->x.HALF.HI - gRoomControls.origin_x + 8) & -0x10; - yDiff = (this->y.HALF.HI - gRoomControls.origin_y + 8) & -0x10; + uVar1 = super->collisionLayer; + xDiff = (super->x.HALF.HI - gRoomControls.origin_x + 8) & -0x10; + yDiff = (super->y.HALF.HI - gRoomControls.origin_y + 8) & -0x10; do { u8 bVar7; u8 bVar4; @@ -506,8 +501,8 @@ bool32 sub_0802594C(Entity* this, u32 param_2) { bVar6 = sub_080B1B18(iVar9 - 0x00, iVar11 - 0x10, uVar1); bVar7 = sub_080B1B18(iVar9 - 0x10, iVar11 - 0x10, uVar1); if ((bVar4 | bVar5 | bVar6 | bVar7) == 0) { - this->field_0x7c.HALF.LO = gRoomControls.origin_x + iVar9; - this->field_0x7c.HALF.HI = gRoomControls.origin_y + iVar11; + this->unk_7c = gRoomControls.origin_x + iVar9; + this->unk_7e = gRoomControls.origin_y + iVar11; return TRUE; } unk += 2; @@ -516,10 +511,10 @@ bool32 sub_0802594C(Entity* this, u32 param_2) { return 0; } -void sub_08025A54(Entity* this) { - u32 layer = this->collisionLayer; - s16 x = this->x.HALF.HI - gRoomControls.origin_x; - s16 y = this->y.HALF.HI - gRoomControls.origin_y; +void sub_08025A54(PuffstoolEntity* this) { + u32 layer = super->collisionLayer; + s16 x = super->x.HALF.HI - gRoomControls.origin_x; + s16 y = super->y.HALF.HI - gRoomControls.origin_y; const s8* offset = gUnk_080CC0A0; u32 i = 0; @@ -541,26 +536,26 @@ bool32 sub_08025AB8(u32 tile, u32 layer) { return FALSE; } -void sub_08025AE8(Entity* this) { +void sub_08025AE8(PuffstoolEntity* this) { Entity* entity; - entity = CreateFx(this, FX_BROWN_SMOKE, 0); + entity = CreateFx(super, FX_BROWN_SMOKE, 0); if (entity != NULL) { entity->y.WORD--; } - entity = CreateFx(this, FX_BROWN_SMOKE_LARGE, 0); + entity = CreateFx(super, FX_BROWN_SMOKE_LARGE, 0); if (entity != NULL) { entity->y.WORD++; } } -void sub_08025B18(Entity* this) { +void sub_08025B18(PuffstoolEntity* this) { Entity* entity; - s32 x = this->x.HALF.HI - gRoomControls.origin_x; - s32 y = this->y.HALF.HI - gRoomControls.origin_y; - u32 layer = this->collisionLayer; + s32 x = super->x.HALF.HI - gRoomControls.origin_x; + s32 y = super->y.HALF.HI - gRoomControls.origin_y; + u32 layer = super->collisionLayer; const s8* offset = gUnk_080CC0A8; u32 i = 0; @@ -570,7 +565,7 @@ void sub_08025B18(Entity* this) { entity = CreateObject(DIRT_PARTICLE, 2, 0); if (entity != NULL) { - PositionRelative(this, entity, Q_16_16(offset[0]), Q_16_16(offset[1])); + PositionRelative(super, entity, Q_16_16(offset[0]), Q_16_16(offset[1])); entity->x.HALF.HI &= -0x10; entity->x.HALF.HI += 8; entity->y.HALF.HI &= -0x10; @@ -580,50 +575,50 @@ void sub_08025B18(Entity* this) { } } -void sub_08025BD4(Entity* this) { - if (this->field_0x82.HALF.LO && (this->frame & 1) == 0) { +void sub_08025BD4(PuffstoolEntity* this) { + if (this->unk_82 && (super->frame & 1) == 0) { Entity* entity = CreateObject(DIRT_PARTICLE, 0, 0); if (entity != NULL) { - PositionRelative(this, entity, Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 0]), - Q_16_16(gUnk_080CC0BA[this->animationState * 2 + 1])); + PositionRelative(super, entity, Q_16_16(gUnk_080CC0BA[super->animationState * 2 + 0]), + Q_16_16(gUnk_080CC0BA[super->animationState * 2 + 1])); entity->z.HALF.HI = -10; } } } -void sub_08025C2C(Entity* this) { - this->action = 8; - this->field_0x80.HALF.LO = 0; - InitializeAnimation(this, 8); +void sub_08025C2C(PuffstoolEntity* this) { + super->action = 8; + this->unk_80 = 0; + InitializeAnimation(super, 8); } -bool32 sub_08025C44(Entity* this) { - if ((this->frame & 1) == 0) { - return ProcessMovement0(this); +bool32 sub_08025C44(PuffstoolEntity* this) { + if ((super->frame & 1) == 0) { + return ProcessMovement0(super); } else { return FALSE; } } -u32 sub_08025C60(Entity* this) { - if (!sub_08049FA0(this) && (Random() & 1)) { - return sub_08049EE4(this); +u32 sub_08025C60(PuffstoolEntity* this) { + if (!sub_08049FA0(super) && (Random() & 1)) { + return sub_08049EE4(super); } - return (gUnk_080CC0C2[Random() & 7] + this->direction) & 0x1f; + return (gUnk_080CC0C2[Random() & 7] + super->direction) & 0x1f; } // clang-format off -void (*const Puffstool_Functions[])(Entity*) = { +void (*const Puffstool_Functions[])(PuffstoolEntity*) = { Puffstool_OnTick, Puffstool_OnCollide, - GenericKnockback, + (void (*)(PuffstoolEntity*))GenericKnockback, Puffstool_OnDeath, - GenericConfused, + (void (*)(PuffstoolEntity*))GenericConfused, Puffstool_OnGrabbed, }; -void (*const gUnk_080CBFB4[])(Entity*) = { +void (*const gUnk_080CBFB4[])(PuffstoolEntity*) = { sub_080251FC, sub_08025230, sub_080252E0, @@ -643,7 +638,7 @@ const u8 gUnk_080CBFE8[] = { 40, 120, 240, 0x0 }; -void (*const gUnk_080CBFEC[])(Entity*) = { +void (*const gUnk_080CBFEC[])(PuffstoolEntity*) = { sub_08025180, sub_080251AC, sub_080251AC, diff --git a/src/enemy/rope.c b/src/enemy/rope.c index 72c04f71..851d3c9a 100644 --- a/src/enemy/rope.c +++ b/src/enemy/rope.c @@ -28,7 +28,12 @@ void sub_08031418(RopeEntity* this); void sub_08031420(RopeEntity* this); static void (*const Rope_Functions[6])(RopeEntity*) = { - Rope_OnTick, Rope_OnCollision, (void (*)(RopeEntity*))GenericKnockback, (void (*)(RopeEntity*))GenericDeath, (void (*)(RopeEntity*))GenericConfused, Rope_OnGrabbed, + Rope_OnTick, + Rope_OnCollision, + (void (*)(RopeEntity*))GenericKnockback, + (void (*)(RopeEntity*))GenericDeath, + (void (*)(RopeEntity*))GenericConfused, + Rope_OnGrabbed, }; extern Entity* gUnk_020000B0; diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c index 03f6c159..39acbc52 100644 --- a/src/enemy/ropeGolden.c +++ b/src/enemy/ropeGolden.c @@ -28,7 +28,12 @@ void sub_080382EC(RopeGoldenEntity* this); void sub_08038304(RopeGoldenEntity* this); static void (*const RopeGolden_Functions[6])(RopeGoldenEntity*) = { - RopeGolden_OnTick, RopeGolden_OnCollision, (void (*)(RopeGoldenEntity*))GenericKnockback, RopeGolden_OnDeath, (void (*)(RopeGoldenEntity*))GenericConfused, RopeGolden_OnTick, + RopeGolden_OnTick, + RopeGolden_OnCollision, + (void (*)(RopeGoldenEntity*))GenericKnockback, + RopeGolden_OnDeath, + (void (*)(RopeGoldenEntity*))GenericConfused, + RopeGolden_OnTick, }; void sub_080383AC(RopeGoldenEntity* this); diff --git a/src/enemy/slime.c b/src/enemy/slime.c index 7d64989b..937091d6 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -31,7 +31,12 @@ void sub_080450A8(SlimeEntity* this); void sub_08045178(SlimeEntity* this, Entity*, int, int); static void (*const Slime_Functions[])(SlimeEntity*) = { - Slime_OnTick, Slime_OnCollision, (void (*)(SlimeEntity*))GenericKnockback, (void (*)(SlimeEntity*))GenericDeath, (void (*)(SlimeEntity*))GenericConfused, Slime_OnGrabbed, + Slime_OnTick, + Slime_OnCollision, + (void (*)(SlimeEntity*))GenericKnockback, + (void (*)(SlimeEntity*))GenericDeath, + (void (*)(SlimeEntity*))GenericConfused, + Slime_OnGrabbed, }; void Slime(SlimeEntity* this) { diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index bb17ead0..05fa2bdf 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -26,7 +26,12 @@ void sub_080316E8(SmallPestoEntity* this); void sub_080316F0(SmallPestoEntity* this); static void (*const SmallPesto_Functions[])(SmallPestoEntity*) = { - SmallPesto_OnTick, SmallPesto_OnCollision, (void (*)(SmallPestoEntity*))GenericKnockback, (void (*)(SmallPestoEntity*))GenericDeath, (void (*)(SmallPestoEntity*))GenericConfused, SmallPesto_OnGrabbed, + SmallPesto_OnTick, + SmallPesto_OnCollision, + (void (*)(SmallPestoEntity*))GenericKnockback, + (void (*)(SmallPestoEntity*))GenericDeath, + (void (*)(SmallPestoEntity*))GenericConfused, + SmallPesto_OnGrabbed, }; void sub_080317B4(SmallPestoEntity* this); diff --git a/src/enemy/spearMoblin.c b/src/enemy/spearMoblin.c index 7919a6ba..675de896 100644 --- a/src/enemy/spearMoblin.c +++ b/src/enemy/spearMoblin.c @@ -4,24 +4,36 @@ * * @brief Spear Moblin enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" -void sub_08028604(Entity*); -void sub_08028754(Entity*); -void sub_08028784(Entity*); -void sub_080287E0(Entity*); -void sub_08028728(Entity*); -bool32 sub_080286CC(Entity*); -bool32 sub_080288A4(Entity*); -void sub_08028858(Entity*); -void sub_080288C0(Entity*); -bool32 sub_08028828(u32, u32); -void sub_080287B4(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[18]; + /*0x7a*/ u8 unk_7a; + /*0x7b*/ u8 unk_7b; + /*0x7c*/ u8 unused2[4]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; +} SpearMoblinEntity; -extern void (*const SpearMoblin_Functions[])(Entity*); -extern void (*const gUnk_080CC7A8[])(Entity*); +void sub_08028604(SpearMoblinEntity*); +void sub_08028754(SpearMoblinEntity*); +void sub_08028784(SpearMoblinEntity*); +void sub_080287E0(SpearMoblinEntity*); +void sub_08028728(SpearMoblinEntity*); +bool32 sub_080286CC(SpearMoblinEntity*); +bool32 sub_080288A4(SpearMoblinEntity*); +void sub_08028858(SpearMoblinEntity*); +void sub_080288C0(SpearMoblinEntity*); +bool32 sub_08028828(u32, u32); +void sub_080287B4(SpearMoblinEntity*); + +extern void (*const SpearMoblin_Functions[])(SpearMoblinEntity*); +extern void (*const gUnk_080CC7A8[])(SpearMoblinEntity*); extern const u8 gUnk_080CC7BC[]; extern const s8 gUnk_080CC7C0[]; extern const s8 gUnk_080CC7D0[]; @@ -29,266 +41,266 @@ extern const u16 gUnk_080CC7D8[]; extern const Hitbox* const gUnk_080CC944[]; -void SpearMoblin(Entity* this) { - EnemyFunctionHandler(this, SpearMoblin_Functions); - SetChildOffset(this, 0, 1, -0x20); - if (this->child && this->child->next) { - CopyPosition(this, this->child); +void SpearMoblin(SpearMoblinEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)SpearMoblin_Functions); + SetChildOffset(super, 0, 1, -0x20); + if (super->child && super->child->next) { + CopyPosition(super, super->child); } } -void SpearMoblin_OnTick(Entity* this) { - gUnk_080CC7A8[this->action](this); +void SpearMoblin_OnTick(SpearMoblinEntity* this) { + gUnk_080CC7A8[super->action](this); } -void SpearMoblin_OnCollision(Entity* this) { - if (this->confusedTime != 0) - Create0x68FX(this, FX_STARS); +void SpearMoblin_OnCollision(SpearMoblinEntity* this) { + if (super->confusedTime != 0) + Create0x68FX(super, FX_STARS); - EnemyFunctionHandlerAfterCollision(this, SpearMoblin_Functions); - if (this->contactFlags & 0x80) { - if (this->action != 4) { + EnemyFunctionHandlerAfterCollision(super, SpearMoblin_Functions); + if (super->contactFlags & 0x80) { + if (super->action != 4) { sub_08028754(this); } else { - if ((this->contactFlags & 0x3f) == 0) { - this->field_0x7a.HALF.LO++; - this->field_0x80.HALF.HI = 0x16; + if ((super->contactFlags & 0x3f) == 0) { + this->unk_7a++; + this->unk_81 = 0x16; sub_08028784(this); } } } - this->child->iframes = this->iframes; - if (this->health == 0) { - this->speed = 0; - this->field_0x82.HALF.LO = 0; + super->child->iframes = super->iframes; + if (super->health == 0) { + super->speed = 0; + this->unk_82 = 0; sub_080287E0(this); - DeleteEntity(this->child); - this->child = NULL; + DeleteEntity(super->child); + super->child = NULL; } } -void SpearMoblin_OnGrabbed(Entity* this) { +void SpearMoblin_OnGrabbed(SpearMoblinEntity* this) { /* ... */ } -void sub_08028314(Entity* this) { +void sub_08028314(SpearMoblinEntity* this) { Entity* pEVar2; - sub_0804A720(this); - this->action = 1; - this->animationState = 0; - this->field_0x7a.HALF.HI = 0; - this->field_0x80.HALF.LO = 0; - this->field_0x82.HALF.HI = 0; - this->field_0x80.HALF.HI = 0; - this->field_0x7a.HALF.LO = 0; - this->field_0x82.HALF.LO = 1; + sub_0804A720(super); + super->action = 1; + super->animationState = 0; + this->unk_7b = 0; + this->unk_80 = 0; + this->unk_83 = 0; + this->unk_81 = 0; + this->unk_7a = 0; + this->unk_82 = 1; - if (this->timer) { - this->animationState = this->type2 << 1; - this->timer = 30; - this->speed = 0x80; - this->direction = this->animationState << 2; + if (super->timer) { + super->animationState = super->type2 << 1; + super->timer = 30; + super->speed = 0x80; + super->direction = super->animationState << 2; sub_080287E0(this); } else { - this->animationState = 0x10; + super->animationState = 0x10; sub_08028604(this); } pEVar2 = CreateProjectile(MOBLIN_SPEAR); if (pEVar2 != NULL) { - pEVar2->parent = this; - this->child = pEVar2; + pEVar2->parent = super; + super->child = pEVar2; } } -void sub_08028378(Entity* this) { - if (this->field_0x80.HALF.HI != 0) { - this->field_0x80.HALF.HI--; +void sub_08028378(SpearMoblinEntity* this) { + if (this->unk_81 != 0) { + this->unk_81--; } - if (--this->timer == 0) { - if (++this->field_0x80.HALF.LO >= 0x10) { + if (--super->timer == 0) { + if (++this->unk_80 >= 0x10) { sub_08028728(this); } else { sub_08028604(this); } } else { if (sub_080286CC(this)) { - this->field_0x7a.HALF.HI |= 1; + this->unk_7b |= 1; } if (sub_080288A4(this)) { - sub_0800417E(this, this->collisions); - this->animationState = DirectionRoundUp(this->direction) >> 2; - this->field_0x82.HALF.HI++; + sub_0800417E(super, super->collisions); + super->animationState = DirectionRoundUp(super->direction) >> 2; + this->unk_83++; sub_080287E0(this); } } - if (this->subtimer >= 0xc) { - if (this->field_0x7a.HALF.HI != 0) { + if (super->subtimer >= 0xc) { + if (this->unk_7b != 0) { sub_08028754(this); } } else { - this->subtimer++; + super->subtimer++; } sub_08028858(this); } -void sub_08028420(Entity* this) { - if (--this->timer == 0) { - this->action = 3; - this->field_0x82.HALF.LO = 0; - this->field_0x80.HALF.LO = 0; - this->animationState = 0x10; +void sub_08028420(SpearMoblinEntity* this) { + if (--super->timer == 0) { + super->action = 3; + this->unk_82 = 0; + this->unk_80 = 0; + super->animationState = 0x10; sub_08028604(this); } else { if (sub_080286CC(this)) { - this->field_0x7a.HALF.HI |= 1; + this->unk_7b |= 1; } } - if (this->subtimer >= 0xc) { - if (this->field_0x7a.HALF.HI != 0) { + if (super->subtimer >= 0xc) { + if (this->unk_7b != 0) { sub_08028754(this); } } else { - this->subtimer++; + super->subtimer++; } sub_08028858(this); } -void sub_08028488(Entity* this) { - if (--this->timer == 0) { - switch (this->field_0x82.HALF.LO) { +void sub_08028488(SpearMoblinEntity* this) { + if (--super->timer == 0) { + switch (this->unk_82) { case 3: - this->action = 4; - this->speed = 0x180; - this->direction = sub_08049F84(this, 1); + super->action = 4; + super->speed = 0x180; + super->direction = sub_08049F84(super, 1); EnqueueSFX(SFX_EM_MOBLIN_SPEAR); break; case 2: - this->action = 2; - this->speed = 0; - this->timer = (Random() & 7) * 3 + 64; + super->action = 2; + super->speed = 0; + super->timer = (Random() & 7) * 3 + 64; break; case 4: - this->direction = (this->direction + 0x10) & DirectionWest; + super->direction = (super->direction + 0x10) & DirectionWest; /* fallthrough */ case 1: default: - this->action = 1; - this->field_0x82.HALF.LO = 1; - this->speed = 0x80; - this->timer = (Random() & 7) * 3 + 0x22; + super->action = 1; + this->unk_82 = 1; + super->speed = 0x80; + super->timer = (Random() & 7) * 3 + 0x22; break; } - this->subtimer = 0; - this->animationState = DirectionRoundUp(this->direction) >> 2; + super->subtimer = 0; + super->animationState = DirectionRoundUp(super->direction) >> 2; sub_080287E0(this); } sub_08028858(this); } -void sub_08028528(Entity* this) { +void sub_08028528(SpearMoblinEntity* this) { Entity* entity = sub_08049DF4(1); const Hitbox* box; if (entity == NULL) { - this->subtimer = 0; + super->subtimer = 0; sub_08028728(this); } else { sub_080288C0(this); - box = gUnk_080CC944[this->animationState >> 1]; - this->hitbox->offset_x = box->offset_x; - this->hitbox->offset_y = box->offset_y; - this->hitbox->width = box->width; - this->hitbox->height = box->height; + box = gUnk_080CC944[super->animationState >> 1]; + super->hitbox->offset_x = box->offset_x; + super->hitbox->offset_y = box->offset_y; + super->hitbox->width = box->width; + super->hitbox->height = box->height; - if (this->field_0x7a.HALF.LO != 0) { - this->field_0x7a.HALF.LO = 0; - this->field_0x80.HALF.HI = 0x16; + if (this->unk_7a != 0) { + this->unk_7a = 0; + this->unk_81 = 0x16; sub_08028784(this); } else { - if (++this->timer == 0x20) { + if (++super->timer == 0x20) { u32 direction; - this->timer = 0; - direction = GetFacingDirection(this, entity); - if (sub_08028828(this->direction, direction)) { - this->direction = direction; + super->timer = 0; + direction = GetFacingDirection(super, entity); + if (sub_08028828(super->direction, direction)) { + super->direction = direction; } } - if ((this->timer & 7) == 0) { + if ((super->timer & 7) == 0) { EnqueueSFX(SFX_F0); - CreateFx(this, FX_DEATH, 0x40); + CreateFx(super, FX_DEATH, 0x40); } - if (++this->field_0x7a.HALF.HI == 0x80) { - this->field_0x7a.HALF.LO++; + if (++this->unk_7b == 0x80) { + this->unk_7a++; } } - if (0x20 < this->field_0x7a.HALF.HI) { - ProcessMovement0(this); + if (0x20 < this->unk_7b) { + ProcessMovement0(super); } - GetNextFrame(this); + GetNextFrame(super); } } -void sub_08028604(Entity* this) { +void sub_08028604(SpearMoblinEntity* this) { u32 iVar3; - this->subtimer = 0; - if (this->field_0x82.HALF.LO == 1) { - this->timer = gUnk_080CC7BC[Random() & 3]; - this->speed = 0x80; - if (sub_08049FA0(this) != 0) { + super->subtimer = 0; + if (this->unk_82 == 1) { + super->timer = gUnk_080CC7BC[Random() & 3]; + super->speed = 0x80; + if (sub_08049FA0(super) != 0) { u32 rand = Random(); u32 tmp; tmp = gUnk_080CC7D0[rand & 7] + 0x18; - this->direction = DirectionRound(tmp + this->direction); - iVar3 = Direction8ToAnimationState(this->direction); + super->direction = DirectionRound(tmp + super->direction); + iVar3 = Direction8ToAnimationState(super->direction); } else { - iVar3 = sub_08049EE4(this); - if (this->field_0x82.HALF.HI == 0) { + iVar3 = sub_08049EE4(super); + if (this->unk_83 == 0) { u32 rand = Random(); iVar3 += gUnk_080CC7C0[rand & 0xf]; } else { u32 rand = Random(); iVar3 += gUnk_080CC7C0[rand & 7]; - this->timer = this->timer + 0x10; - this->field_0x82.HALF.HI--; + super->timer = super->timer + 0x10; + this->unk_83--; } - this->direction = (iVar3 + 4U) & DirectionWest; - iVar3 = Direction8ToAnimationState(this->direction); + super->direction = (iVar3 + 4U) & DirectionWest; + iVar3 = Direction8ToAnimationState(super->direction); } } else { - this->timer = 12; - this->speed = 0; - iVar3 = Direction8ToAnimationState(this->direction); + super->timer = 12; + super->speed = 0; + iVar3 = Direction8ToAnimationState(super->direction); } - if (iVar3 != this->animationState) { - this->animationState = iVar3; + if (iVar3 != super->animationState) { + super->animationState = iVar3; sub_080287E0(this); } } -bool32 sub_080286CC(Entity* this) { - if (this->field_0x80.HALF.HI == 0) { +bool32 sub_080286CC(SpearMoblinEntity* this) { + if (this->unk_81 == 0) { Entity* entity = sub_08049DF4(1); if (entity != NULL) { - if (this->field_0x82.HALF.LO == 2 && sub_0806FC80(this, entity, 0x30)) + if (this->unk_82 == 2 && sub_0806FC80(super, entity, 0x30)) return TRUE; - if (sub_0806FC80(this, entity, 0x40) && - DirectionRoundUp(GetFacingDirection(this, entity)) >> 2 == this->animationState) + if (sub_0806FC80(super, entity, 0x40) && + DirectionRoundUp(GetFacingDirection(super, entity)) >> 2 == super->animationState) return TRUE; } } @@ -296,45 +308,45 @@ bool32 sub_080286CC(Entity* this) { return FALSE; } -void sub_08028728(Entity* this) { - this->animationState = DirectionRoundUp(this->direction) >> 2; - this->direction = this->animationState << 2; - this->field_0x82.HALF.HI >>= 1; +void sub_08028728(SpearMoblinEntity* this) { + super->animationState = DirectionRoundUp(super->direction) >> 2; + super->direction = super->animationState << 2; + this->unk_83 >>= 1; sub_080287B4(this); - this->field_0x82.HALF.LO = 2; + this->unk_82 = 2; } -void sub_08028754(Entity* this) { - this->direction = sub_08049F84(this, 1); - this->animationState = DirectionRoundUp(this->direction) >> 2; - this->field_0x82.HALF.HI = 0; +void sub_08028754(SpearMoblinEntity* this) { + super->direction = sub_08049F84(super, 1); + super->animationState = DirectionRoundUp(super->direction) >> 2; + this->unk_83 = 0; sub_080287B4(this); - this->field_0x82.HALF.LO = 3; + this->unk_82 = 3; } -void sub_08028784(Entity* this) { - this->animationState = DirectionRoundUp(this->direction) >> 2; - this->direction = this->animationState << 2; - this->field_0x82.HALF.HI = 0; +void sub_08028784(SpearMoblinEntity* this) { + super->animationState = DirectionRoundUp(super->direction) >> 2; + super->direction = super->animationState << 2; + this->unk_83 = 0; sub_080287B4(this); - this->timer <<= 1; - this->field_0x82.HALF.LO = 4; + super->timer <<= 1; + this->unk_82 = 4; } -void sub_080287B4(Entity* this) { - this->action = 3; - this->timer = 32; - this->subtimer = 0; - this->field_0x80.HALF.LO = 0; - this->field_0x7a.HALF.HI = 0; - this->speed = 0; - this->field_0x82.HALF.LO = 0; +void sub_080287B4(SpearMoblinEntity* this) { + super->action = 3; + super->timer = 32; + super->subtimer = 0; + this->unk_80 = 0; + this->unk_7b = 0; + super->speed = 0; + this->unk_82 = 0; sub_080287E0(this); } -void sub_080287E0(Entity* this) { - u32 sprite = this->animationState >> 1; - switch (this->field_0x82.HALF.LO) { +void sub_080287E0(SpearMoblinEntity* this) { + u32 sprite = super->animationState >> 1; + switch (this->unk_82) { case 0: /* ... */ break; @@ -349,7 +361,7 @@ void sub_080287E0(Entity* this) { sprite += 0xc; break; } - InitializeAnimation(this, sprite); + InitializeAnimation(super, sprite); } bool32 sub_08028828(u32 arg0, u32 arg1) { @@ -363,50 +375,50 @@ bool32 sub_08028828(u32 arg0, u32 arg1) { return FALSE; } -void sub_08028858(Entity* this) { +void sub_08028858(SpearMoblinEntity* this) { const Hitbox* box; sub_080288C0(this); - box = gUnk_080CC944[this->animationState >> 1]; - this->hitbox->offset_x = box->offset_x; - this->hitbox->offset_y = box->offset_y; - this->hitbox->width = box->width; - this->hitbox->height = box->height; + box = gUnk_080CC944[super->animationState >> 1]; + super->hitbox->offset_x = box->offset_x; + super->hitbox->offset_y = box->offset_y; + super->hitbox->width = box->width; + super->hitbox->height = box->height; - if (this->field_0x82.HALF.LO == 0) { - this->speed = 0; + if (this->unk_82 == 0) { + super->speed = 0; } - ProcessMovement0(this); - GetNextFrame(this); + ProcessMovement0(super); + GetNextFrame(super); } -bool32 sub_080288A4(Entity* this) { - return (this->collisions & gUnk_080CC7D8[this->animationState >> 1]) != 0; +bool32 sub_080288A4(SpearMoblinEntity* this) { + return (super->collisions & gUnk_080CC7D8[super->animationState >> 1]) != 0; } -void sub_080288C0(Entity* this) { - Entity* entity = this->child; +void sub_080288C0(SpearMoblinEntity* this) { + Entity* entity = super->child; if ((entity != NULL) && (entity->contactFlags & 0x80)) { - this->knockbackDirection = entity->knockbackDirection; - this->iframes = -entity->iframes; - this->knockbackSpeed = entity->knockbackSpeed; - this->knockbackDuration = entity->knockbackDuration; + super->knockbackDirection = entity->knockbackDirection; + super->iframes = -entity->iframes; + super->knockbackSpeed = entity->knockbackSpeed; + super->knockbackDuration = entity->knockbackDuration; entity->knockbackDuration = 0; } } // clang-format off -void (*const SpearMoblin_Functions[])(Entity*) = { +void (*const SpearMoblin_Functions[])(SpearMoblinEntity*) = { SpearMoblin_OnTick, SpearMoblin_OnCollision, - GenericKnockback, - GenericDeath, - GenericConfused, + (void (*)(SpearMoblinEntity*))GenericKnockback, + (void (*)(SpearMoblinEntity*))GenericDeath, + (void (*)(SpearMoblinEntity*))GenericConfused, SpearMoblin_OnGrabbed, }; -void (*const gUnk_080CC7A8[])(Entity*) = { +void (*const gUnk_080CC7A8[])(SpearMoblinEntity*) = { sub_08028314, sub_08028378, sub_08028420, diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c index c93ef05a..0bd03e83 100644 --- a/src/enemy/spinyChuchu.c +++ b/src/enemy/spinyChuchu.c @@ -4,41 +4,48 @@ * * @brief Spiny Chuchu enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "hitbox.h" -u32 sub_080228CC(Entity*); -u32 sub_080228F0(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; +} SpinyChuchuEntity; -extern void (*const SpinyChuchu_Functions[])(Entity*); -extern void (*const gUnk_080CBA40[])(Entity*); +u32 sub_080228CC(SpinyChuchuEntity*); +u32 sub_080228F0(SpinyChuchuEntity*); + +extern void (*const SpinyChuchu_Functions[])(SpinyChuchuEntity*); +extern void (*const gUnk_080CBA40[])(SpinyChuchuEntity*); extern const u8 gUnk_080CBA60[]; extern Entity* gUnk_020000B0; -void SpinyChuchu(Entity* this) { - EnemyFunctionHandler(this, SpinyChuchu_Functions); - SetChildOffset(this, 0, 1, -0x10); +void SpinyChuchu(SpinyChuchuEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)SpinyChuchu_Functions); + SetChildOffset(super, 0, 1, -0x10); } -void SpinyChuchu_OnTick(Entity* this) { - gUnk_080CBA40[this->action](this); +void SpinyChuchu_OnTick(SpinyChuchuEntity* this) { + gUnk_080CBA40[super->action](this); } -void SpinyChuchu_OnCollision(Entity* this) { - if (this->health) { - if (this->hitType == 0x65) { - switch (this->contactFlags & 0x7f) { +void SpinyChuchu_OnCollision(SpinyChuchuEntity* this) { + if (super->health) { + if (super->hitType == 0x65) { + switch (super->contactFlags & 0x7f) { case 2: case 3: - this->action = 2; - this->subtimer = 60; - this->hitType = 0x5c; - this->hitbox = (Hitbox*)&gHitbox_23; - InitializeAnimation(this, 0); + super->action = 2; + super->subtimer = 60; + super->hitType = 0x5c; + super->hitbox = (Hitbox*)&gHitbox_23; + InitializeAnimation(super, 0); break; case 8: case 9: @@ -49,225 +56,225 @@ void SpinyChuchu_OnCollision(Entity* this) { case 0x18: case 0x19: case 0x1a: - Create0x68FX(this, FX_STARS); - this->action = 5; - this->hitType = 0x5c; - InitializeAnimation(this, 1); + Create0x68FX(super, FX_STARS); + super->action = 5; + super->hitType = 0x5c; + InitializeAnimation(super, 1); } - } else if (this->contactFlags == 0x94) { - Create0x68FX(this, FX_STARS); - this->action = 5; - InitializeAnimation(this, 1); + } else if (super->contactFlags == 0x94) { + Create0x68FX(super, FX_STARS); + super->action = 5; + InitializeAnimation(super, 1); } - if (this->field_0x80.HALF.LO != this->health) { - this->action = 5; - this->hitType = 0x5c; - InitializeAnimation(this, 1); + if (this->unk_80 != super->health) { + super->action = 5; + super->hitType = 0x5c; + InitializeAnimation(super, 1); } else { - if (this->action == 3) { - this->action = 4; - InitializeAnimation(this, 3); + if (super->action == 3) { + super->action = 4; + InitializeAnimation(super, 3); EnqueueSFX(SFX_194); } } } else { - InitializeAnimation(this, 1); + InitializeAnimation(super, 1); } - this->field_0x80.HALF.LO = this->health; - EnemyFunctionHandlerAfterCollision(this, SpinyChuchu_Functions); + this->unk_80 = super->health; + EnemyFunctionHandlerAfterCollision(super, SpinyChuchu_Functions); } -void SpinyChuchu_OnKnockback(Entity* this) { - if (this->animIndex == 1) - GetNextFrame(this); - sub_08001318(this); +void SpinyChuchu_OnKnockback(SpinyChuchuEntity* this) { + if (super->animIndex == 1) + GetNextFrame(super); + sub_08001318(super); } -void SpinyChuchu_OnDeath(Entity* this) { - GravityUpdate(this, Q_8_8(24.0)); - if (this->frame & 1) { - GenericDeath(this); +void SpinyChuchu_OnDeath(SpinyChuchuEntity* this) { + GravityUpdate(super, Q_8_8(24.0)); + if (super->frame & 1) { + GenericDeath(super); } else { - GetNextFrame(this); + GetNextFrame(super); } } -void SpinyChuchu_OnGrabbed(Entity* this) { +void SpinyChuchu_OnGrabbed(SpinyChuchuEntity* this) { } -void sub_080225EC(Entity* this) { - sub_0804A720(this); - this->field_0x80.HALF.LO = this->health; - this->field_0x80.HALF.HI = 0x5a; - if (this->timer == 0) { - this->action = 2; - InitializeAnimation(this, 0); +void sub_080225EC(SpinyChuchuEntity* this) { + sub_0804A720(super); + this->unk_80 = super->health; + this->unk_81 = 0x5a; + if (super->timer == 0) { + super->action = 2; + InitializeAnimation(super, 0); } else { - this->action = 1; - this->subtimer = 60; - this->spriteSettings.draw = 3; - this->spriteRendering.b3 = 1; - this->spriteOrientation.flipY = 1; - this->z.HALF.HI = -0x80; - InitializeAnimation(this, 6); + super->action = 1; + super->subtimer = 60; + super->spriteSettings.draw = 3; + super->spriteRendering.b3 = 1; + super->spriteOrientation.flipY = 1; + super->z.HALF.HI = -0x80; + InitializeAnimation(super, 6); } } -void sub_08022654(Entity* this) { - switch (this->subAction) { +void sub_08022654(SpinyChuchuEntity* this) { + switch (super->subAction) { case 0: - if (--this->subtimer) + if (--super->subtimer) return; - this->subAction = 1; + super->subAction = 1; SoundReq(SFX_12D); - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); /* fallthrough */ case 1: - if (GravityUpdate(this, Q_8_8(24.0))) + if (GravityUpdate(super, Q_8_8(24.0))) return; - this->subAction = 2; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 5); + super->subAction = 2; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 5); EnqueueSFX(SFX_PLY_LAND); - UpdateSpriteForCollisionLayer(this); + UpdateSpriteForCollisionLayer(super); /* fallthrough */ case 2: - GetNextFrame(this); - if (--this->timer == 0) { - this->action = 3; - this->hitType = 0x65; - InitializeAnimation(this, 2); + GetNextFrame(super); + if (--super->timer == 0) { + super->action = 3; + super->hitType = 0x65; + InitializeAnimation(super, 2); } break; } } -void sub_080226EC(Entity* this) { - if (sub_08049FDC(this, 1)) { +void sub_080226EC(SpinyChuchuEntity* this) { + if (sub_08049FDC(super, 1)) { if (sub_080228CC(this)) { - this->action = 3; - this->hitType = 0x65; - InitializeAnimation(this, 2); + super->action = 3; + super->hitType = 0x65; + InitializeAnimation(super, 2); return; } if (sub_080228F0(this)) { - this->action = 6; - this->zVelocity = Q_16_16(1.125); - this->speed = 0x140; - this->direction = GetFacingDirection(this, gUnk_020000B0); - this->hitType = 0x5a; - InitializeAnimation(this, 4); + super->action = 6; + super->zVelocity = Q_16_16(1.125); + super->speed = 0x140; + super->direction = GetFacingDirection(super, gUnk_020000B0); + super->hitType = 0x5a; + InitializeAnimation(super, 4); return; } - if ((this->timer++ & 7) == 0) { - this->direction = sub_08049F84(this, 1); + if ((super->timer++ & 7) == 0) { + super->direction = sub_08049F84(super, 1); } - ProcessMovement0(this); + ProcessMovement0(super); } - GetNextFrame(this); + GetNextFrame(super); } -void sub_08022780(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 4; - InitializeAnimation(this, 3); +void sub_08022780(SpinyChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 4; + InitializeAnimation(super, 3); EnqueueSFX(SFX_194); } } -void sub_080227AC(Entity* this) { - GetNextFrame(this); - if (this->frame & 1) { - this->hitbox = (Hitbox*)&gHitbox_32; +void sub_080227AC(SpinyChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & 1) { + super->hitbox = (Hitbox*)&gHitbox_32; } else { - this->hitbox = (Hitbox*)&gHitbox_23; + super->hitbox = (Hitbox*)&gHitbox_23; } - if (this->frame & 2) { - this->frame &= ~2; - this->hitType = 0x5c; + if (super->frame & 2) { + super->frame &= ~2; + super->hitType = 0x5c; } - if (this->frame & ANIM_DONE) { - this->action = 2; - this->subtimer = gUnk_080CBA60[Random() & 3]; - InitializeAnimation(this, 0); + if (super->frame & ANIM_DONE) { + super->action = 2; + super->subtimer = gUnk_080CBA60[Random() & 3]; + InitializeAnimation(super, 0); } } -void sub_0802281C(Entity* this) { - GravityUpdate(this, Q_8_8(24.0)); - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 2; - this->speed = 0x20; - InitializeAnimation(this, 0); - sub_0804AA1C(this); +void sub_0802281C(SpinyChuchuEntity* this) { + GravityUpdate(super, Q_8_8(24.0)); + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 2; + super->speed = 0x20; + InitializeAnimation(super, 0); + sub_0804AA1C(super); } } -void sub_08022854(Entity* this) { - GetNextFrame(this); - if (this->frame & 1) { - ProcessMovement2(this); - if (GravityUpdate(this, Q_8_8(24.0)) == 0) { - this->action = 7; - this->hitType = 0x5c; - InitializeAnimation(this, 5); +void sub_08022854(SpinyChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & 1) { + ProcessMovement2(super); + if (GravityUpdate(super, Q_8_8(24.0)) == 0) { + super->action = 7; + super->hitType = 0x5c; + InitializeAnimation(super, 5); EnqueueSFX(SFX_PLY_LAND); } } } -void sub_0802289C(Entity* this) { - GetNextFrame(this); - if (this->frame & ANIM_DONE) { - this->action = 2; - this->speed = 0x20; - this->field_0x80.HALF.HI = 0x78; - InitializeAnimation(this, 0); +void sub_0802289C(SpinyChuchuEntity* this) { + GetNextFrame(super); + if (super->frame & ANIM_DONE) { + super->action = 2; + super->speed = 0x20; + this->unk_81 = 0x78; + InitializeAnimation(super, 0); } } -u32 sub_080228CC(Entity* this) { - if (this->subtimer == 0) { - if (PlayerInRange(this, 1, 0x28)) +u32 sub_080228CC(SpinyChuchuEntity* this) { + if (super->subtimer == 0) { + if (PlayerInRange(super, 1, 0x28)) return 1; } else { - this->subtimer--; + super->subtimer--; } return 0; } -u32 sub_080228F0(Entity* this) { - if (this->field_0x80.HALF.HI == 0) { - if (PlayerInRange(this, 1, 0x40)) +u32 sub_080228F0(SpinyChuchuEntity* this) { + if (this->unk_81 == 0) { + if (PlayerInRange(super, 1, 0x40)) return 1; } else { - this->field_0x80.HALF.HI--; + this->unk_81--; } return 0; } // clang-format off -void (*const SpinyChuchu_Functions[])(Entity*) = { +void (*const SpinyChuchu_Functions[])(SpinyChuchuEntity*) = { SpinyChuchu_OnTick, SpinyChuchu_OnCollision, SpinyChuchu_OnKnockback, SpinyChuchu_OnDeath, - GenericConfused, + (void (*)(SpinyChuchuEntity*))GenericConfused, SpinyChuchu_OnGrabbed, }; -void (*const gUnk_080CBA40[])(Entity*) = { +void (*const gUnk_080CBA40[])(SpinyChuchuEntity*) = { sub_080225EC, sub_08022654, sub_080226EC, diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index 16c8c787..ea1169fe 100644 --- a/src/enemy/tektite.c +++ b/src/enemy/tektite.c @@ -4,38 +4,52 @@ * * @brief Tektite enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" -static void sub_0802F45C(Entity* this); -static void Tektite_OnTick(Entity*); -static void Tektite_OnCollision(Entity*); -static void Tektite_OnConfused(Entity*); -static void Tektite_OnGrabbed(Entity*); -static void sub_0802F210(Entity*); -static void sub_0802F284(Entity*); -static void sub_0802F300(Entity*); -static void sub_0802F3F4(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[20]; + /*0x7c*/ u8 unk_7c; + /*0x7d*/ u8 unused2[3]; + /*0x80*/ u16 unk_80; + /*0x82*/ u16 unk_82; +} TektiteEntity; -static void (*const Tektite_Functions[])(Entity*) = { - Tektite_OnTick, Tektite_OnCollision, GenericKnockback, GenericDeath, Tektite_OnConfused, Tektite_OnGrabbed, +static void sub_0802F45C(TektiteEntity* this); +static void Tektite_OnTick(TektiteEntity*); +static void Tektite_OnCollision(TektiteEntity*); +static void Tektite_OnConfused(TektiteEntity*); +static void Tektite_OnGrabbed(TektiteEntity*); +static void sub_0802F210(TektiteEntity*); +static void sub_0802F284(TektiteEntity*); +static void sub_0802F300(TektiteEntity*); +static void sub_0802F3F4(TektiteEntity*); + +static void (*const Tektite_Functions[])(TektiteEntity*) = { + Tektite_OnTick, + Tektite_OnCollision, + (void (*)(TektiteEntity*))GenericKnockback, + (void (*)(TektiteEntity*))GenericDeath, + Tektite_OnConfused, + Tektite_OnGrabbed, }; -void Tektite(Entity* this) { - EnemyFunctionHandler(this, Tektite_Functions); - SetChildOffset(this, 0, 1, -0x10); +void Tektite(TektiteEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)Tektite_Functions); + SetChildOffset(super, 0, 1, -0x10); } -void Tektite_OnTick(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void Tektite_OnTick(TektiteEntity* this) { + static void (*const actionFuncs[])(TektiteEntity*) = { sub_0802F210, sub_0802F284, sub_0802F300, sub_0802F3F4, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } static const u8 gUnk_080CDEF8[] = { @@ -45,175 +59,167 @@ static const u8 gUnk_080CDEF8[] = { 0x48, }; -void Tektite_OnCollision(Entity* this) { - u32 bVar1; - u32 uVar2; - - if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); +void Tektite_OnCollision(TektiteEntity* this) { + if (super->confusedTime != 0) { + Create0x68FX(super, FX_STARS); } - EnemyFunctionHandlerAfterCollision(this, Tektite_Functions); - if ((this->contactFlags & 0x80) != 0) { - switch (this->contactFlags & 0x3f) { + EnemyFunctionHandlerAfterCollision(super, Tektite_Functions); + if ((super->contactFlags & 0x80) != 0) { + switch (super->contactFlags & 0x3f) { case 0x14: - this->action = 1; - this->subAction = 0; - if (this->type != 0) { - this->timer = 192; + super->action = 1; + super->subAction = 0; + if (super->type != 0) { + super->timer = 192; } else { - this->timer = gUnk_080CDEF8[Random() & 3]; + super->timer = gUnk_080CDEF8[Random() & 3]; } - this->subtimer = 0; - *(u8*)&this->field_0x7c = 0; - if (this->z.HALF.HI != 0) { - this->zVelocity >>= 2; + super->subtimer = 0; + this->unk_7c = 0; + if (super->z.HALF.HI != 0) { + super->zVelocity >>= 2; } else { - this->zVelocity = 0; + super->zVelocity = 0; } - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); break; case 0xe: case 0x15: - this->health = 0; + super->health = 0; break; } } } -void Tektite_OnGrabbed(Entity* this) { +void Tektite_OnGrabbed(TektiteEntity* this) { } -void Tektite_OnConfused(Entity* this) { - GenericConfused(this); - if (this->z.HALF.HI != 0) { - GravityUpdate(this, this->field_0x80.HWORD); +void Tektite_OnConfused(TektiteEntity* this) { + GenericConfused(super); + if (super->z.HALF.HI != 0) { + GravityUpdate(super, this->unk_80); } } -void sub_0802F210(Entity* this) { - u32 temp; - u32 temp2; +void sub_0802F210(TektiteEntity* this) { + sub_0804A720(super); + super->action = 1; + super->subAction = 0; + super->timer = gUnk_080CDEF8[Random() & 3]; + super->timer += (Random() & 0x1f); + super->subtimer = 0; + this->unk_7c = 0; - sub_0804A720(this); - this->action = 1; - this->subAction = 0; - this->timer = gUnk_080CDEF8[Random() & 3]; - this->timer += (Random() & 0x1f); - this->subtimer = 0; - *(u8*)&this->field_0x7c = 0; + this->unk_80 = super->type == 0 ? Q_8_8(24.0) : Q_8_8(40.0); + this->unk_82 = super->type == 0 ? (Q_16_16(2.5) >> 4) : (Q_16_16(3.0) >> 4); - this->field_0x80.HWORD = this->type == 0 ? Q_8_8(24.0) : Q_8_8(40.0); - - this->field_0x82.HWORD = this->type == 0 ? (Q_16_16(2.5) >> 4) : (Q_16_16(3.0) >> 4); - - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); } -void sub_0802F284(Entity* this) { - if (this->timer > 0x60) { - UpdateAnimationVariableFrames(this, 2); +void sub_0802F284(TektiteEntity* this) { + if (super->timer > 0x60) { + UpdateAnimationVariableFrames(super, 2); } else { - GetNextFrame(this); + GetNextFrame(super); } - if (this->timer != 0) { - this->timer--; - } else if (this->subtimer != 0) { - if (this->frame & ANIM_DONE) { - this->action = 2; - this->timer = 16; - this->subtimer = this->type; - this->zVelocity = this->field_0x82.HWORD << 4; + if (super->timer != 0) { + super->timer--; + } else if (super->subtimer != 0) { + if (super->frame & ANIM_DONE) { + super->action = 2; + super->timer = 16; + super->subtimer = super->type; + super->zVelocity = this->unk_82 << 4; sub_0802F45C(this); - InitializeAnimation(this, 2); + InitializeAnimation(super, 2); } - } else if (this->frame & ANIM_DONE) { - this->subtimer = 64; - InitializeAnimation(this, 1); + } else if (super->frame & ANIM_DONE) { + super->subtimer = 64; + InitializeAnimation(super, 1); } } -void sub_0802F300(Entity* this) { +void sub_0802F300(TektiteEntity* this) { s32 temp; u32 rand; - GetNextFrame(this); - ProcessMovement0(this); - temp = this->z.HALF.HI; + GetNextFrame(super); + ProcessMovement0(super); + temp = super->z.HALF.HI; rand = Random() & 0xf; - if (sub_080044EC(this, this->field_0x80.HWORD) == 1) { - this->action = 3; - this->subAction = 0; - if (this->type != 0) { + if (sub_080044EC(super, this->unk_80) == 1) { + super->action = 3; + super->subAction = 0; + if (super->type != 0) { rand = 0; } if (rand == 0) { - this->timer = 192; + super->timer = 192; } else { - this->timer = gUnk_080CDEF8[rand & 3] + rand; + super->timer = gUnk_080CDEF8[rand & 3] + rand; } - this->subtimer = 0; - InitializeAnimation(this, 3); + super->subtimer = 0; + InitializeAnimation(super, 3); return; - } else if (this->collisions != COL_NONE) { - sub_0800417E(this, this->collisions); - } else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) { - this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); + } else if (super->collisions != COL_NONE) { + sub_0800417E(super, super->collisions); + } else if ((GetTileUnderEntity(super) & 0xf0) == 0x50) { + super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest); } - if (--this->timer == 0) { - this->timer = 16; - if (this->subtimer != 0) { - this->subtimer--; + if (--super->timer == 0) { + super->timer = 16; + if (super->subtimer != 0) { + super->subtimer--; sub_0802F45C(this); } } - if ((this->subAction == 0) && (temp < this->z.HALF.HI)) { - InitializeAnimation(this, 4); - this->subAction = 1; + if ((super->subAction == 0) && (temp < super->z.HALF.HI)) { + InitializeAnimation(super, 4); + super->subAction = 1; } if (temp < -0xc) { - this->spriteRendering.b3 = 1; - this->spriteOrientation.flipY = 1; + super->spriteRendering.b3 = 1; + super->spriteOrientation.flipY = 1; } else { - this->spriteRendering.b3 = 2; - this->spriteOrientation.flipY = 2; + super->spriteRendering.b3 = 2; + super->spriteOrientation.flipY = 2; } } -void sub_0802F3F4(Entity* this) { +void sub_0802F3F4(TektiteEntity* this) { + GetNextFrame(super); - GetNextFrame(this); - - if (this->frame & ANIM_DONE) { - if ((*(u8*)&this->field_0x7c.HALF.LO < 2) && ((this->type % 2) != 0)) { - this->action = 2; - this->timer = 16; - this->subtimer = this->type; - this->zVelocity = this->field_0x82.HWORD << 4; - (*(u8*)&this->field_0x7c.HALF.LO)++; + if (super->frame & ANIM_DONE) { + if ((this->unk_7c < 2) && ((super->type % 2) != 0)) { + super->action = 2; + super->timer = 16; + super->subtimer = super->type; + super->zVelocity = this->unk_82 << 4; + this->unk_7c++; sub_0802F45C(this); - InitializeAnimation(this, 2); + InitializeAnimation(super, 2); } else { - this->action = 1; - *(u8*)&this->field_0x7c.HALF.LO = 0; - InitializeAnimation(this, 0); + super->action = 1; + this->unk_7c = 0; + InitializeAnimation(super, 0); } } } -static void sub_0802F45C(Entity* this) { +static void sub_0802F45C(TektiteEntity* this) { u32 temp; - if (sub_08049FA0(this) == 0) { - this->direction = sub_08049EE4(this); - } else if (sub_08049FDC(this, 1) != 0) { - this->direction = sub_08049F84(this, 1); + if (sub_08049FA0(super) == 0) { + super->direction = sub_08049EE4(super); + } else if (sub_08049FDC(super, 1) != 0) { + super->direction = sub_08049F84(super, 1); } else { temp = (Random() & 0xf) + 0x18; - this->direction = (temp + this->direction) & (0x3 | DirectionNorthWest); + super->direction = (temp + super->direction) & (0x3 | DirectionNorthWest); } } diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index b5c024b2..49ad340c 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -4,187 +4,190 @@ * * @brief Golden Tektite enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" -#include "item.h" #include "functions.h" +#include "item.h" -void sub_08038168(Entity*); -void TektiteGolden_OnTick(Entity*); -void TektiteGolden_OnCollision(Entity*); -void TektiteGolden_OnDeath(Entity*); -void TektiteGolden_OnConfused(Entity*); -void TektiteGolden_OnTick(Entity*); -void sub_08037FA0(Entity*); -void sub_08037Fe0(Entity*); -void sub_08038048(Entity*); -void sub_08038110(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ u8 unk_80; +} TektiteGoldenEntity; -static void (*const TektiteGolden_Functions[])(Entity*) = { - TektiteGolden_OnTick, TektiteGolden_OnCollision, GenericKnockback, +void sub_08038168(TektiteGoldenEntity*); +void TektiteGolden_OnTick(TektiteGoldenEntity*); +void TektiteGolden_OnCollision(TektiteGoldenEntity*); +void TektiteGolden_OnDeath(TektiteGoldenEntity*); +void TektiteGolden_OnConfused(TektiteGoldenEntity*); +void TektiteGolden_OnTick(TektiteGoldenEntity*); +void sub_08037FA0(TektiteGoldenEntity*); +void sub_08037Fe0(TektiteGoldenEntity*); +void sub_08038048(TektiteGoldenEntity*); +void sub_08038110(TektiteGoldenEntity*); + +static void (*const TektiteGolden_Functions[])(TektiteGoldenEntity*) = { + TektiteGolden_OnTick, TektiteGolden_OnCollision, (void (*)(TektiteGoldenEntity*))GenericKnockback, TektiteGolden_OnDeath, TektiteGolden_OnConfused, TektiteGolden_OnTick, }; -void TektiteGolden(Entity* this) { - EnemyFunctionHandler(this, TektiteGolden_Functions); - SetChildOffset(this, 0, 1, -0x10); +void TektiteGolden(TektiteGoldenEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)TektiteGolden_Functions); + SetChildOffset(super, 0, 1, -0x10); } -void TektiteGolden_OnTick(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void TektiteGolden_OnTick(TektiteGoldenEntity* this) { + static void (*const actionFuncs[])(TektiteGoldenEntity*) = { sub_08037FA0, sub_08037Fe0, sub_08038048, sub_08038110, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } -void TektiteGolden_OnCollision(Entity* this) { - u32 uVar1; - - if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); +void TektiteGolden_OnCollision(TektiteGoldenEntity* this) { + if (super->confusedTime != 0) { + Create0x68FX(super, FX_STARS); } - EnemyFunctionHandlerAfterCollision(this, TektiteGolden_Functions); - if (this->contactFlags == 0x94) { - this->action = 1; - this->subAction = 0; - this->timer = 20; - this->subtimer = 0; - this->field_0x80.HALF.LO = 0; - if (this->z.HALF.HI != 0) { - this->zVelocity >>= 2; + EnemyFunctionHandlerAfterCollision(super, TektiteGolden_Functions); + if (super->contactFlags == 0x94) { + super->action = 1; + super->subAction = 0; + super->timer = 20; + super->subtimer = 0; + this->unk_80 = 0; + if (super->z.HALF.HI != 0) { + super->zVelocity >>= 2; } else { - this->zVelocity = 0; + super->zVelocity = 0; } - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); } } -void TektiteGolden_OnDeath(Entity* this) { +void TektiteGolden_OnDeath(TektiteGoldenEntity* this) { u32 uVar1; - if ((this->gustJarState & 2) == 0) { - SetGlobalFlag(this->type2); + if ((super->gustJarState & 2) == 0) { + SetGlobalFlag(super->type2); } - if (this->type != 0) { + if (super->type != 0) { uVar1 = ITEM_RUPEE200; } else { uVar1 = ITEM_RUPEE100; } - CreateDeathFx(this, 0xff, uVar1); + CreateDeathFx(super, 0xff, uVar1); } -void TektiteGolden_OnConfused(Entity* this) { - GenericConfused(this); - if (this->z.HALF.HI != 0) { - GravityUpdate(this, Q_8_8(48.0)); +void TektiteGolden_OnConfused(TektiteGoldenEntity* this) { + GenericConfused(super); + if (super->z.HALF.HI != 0) { + GravityUpdate(super, Q_8_8(48.0)); } } -void sub_08037FA0(Entity* this) { - - if (CheckGlobalFlag(this->type2)) { +void sub_08037FA0(TektiteGoldenEntity* this) { + if (CheckGlobalFlag(super->type2)) { DeleteThisEntity(); } - sub_0804A720(this); - this->action = 1; - this->subAction = 0; - this->timer = (Random() & 0x1f) + 32; - this->subtimer = 0; - this->field_0x80.HALF.LO = 0; - InitializeAnimation(this, 0); + sub_0804A720(super); + super->action = 1; + super->subAction = 0; + super->timer = (Random() & 0x1f) + 32; + super->subtimer = 0; + this->unk_80 = 0; + InitializeAnimation(super, 0); } -void sub_08037Fe0(Entity* this) { - UpdateAnimationVariableFrames(this, 2); - if (this->timer != 0) { - this->timer--; - } else if (this->subtimer != 0) { - if (this->frame & ANIM_DONE) { - this->action = 2; - this->timer = 6; - this->subtimer = 0; - this->zVelocity = Q_16_16(3.5); +void sub_08037Fe0(TektiteGoldenEntity* this) { + UpdateAnimationVariableFrames(super, 2); + if (super->timer != 0) { + super->timer--; + } else if (super->subtimer != 0) { + if (super->frame & ANIM_DONE) { + super->action = 2; + super->timer = 6; + super->subtimer = 0; + super->zVelocity = Q_16_16(3.5); sub_08038168(this); - InitializeAnimation(this, 2); + InitializeAnimation(super, 2); } - } else if (this->frame & ANIM_DONE) { - this->subtimer = 64; - InitializeAnimation(this, 1); + } else if (super->frame & ANIM_DONE) { + super->subtimer = 64; + InitializeAnimation(super, 1); } } -void sub_08038048(Entity* this) { +void sub_08038048(TektiteGoldenEntity* this) { s32 temp; u32 rand; - UpdateAnimationVariableFrames(this, 2); - ProcessMovement0(this); - temp = this->z.HALF.HI; + UpdateAnimationVariableFrames(super, 2); + ProcessMovement0(super); + temp = super->z.HALF.HI; rand = Random() & 0xf; - if (sub_080044EC(this, 0x3000) == 1) { - this->action = 3; - this->subAction = 0; - this->timer = 20; - InitializeAnimation(this, 3); + if (sub_080044EC(super, 0x3000) == 1) { + super->action = 3; + super->subAction = 0; + super->timer = 20; + InitializeAnimation(super, 3); return; - } else if (this->collisions != COL_NONE) { - sub_0800417E(this, this->collisions); - } else if ((GetTileUnderEntity(this) & 0xf0) == 0x50) { - this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); + } else if (super->collisions != COL_NONE) { + sub_0800417E(super, super->collisions); + } else if ((GetTileUnderEntity(super) & 0xf0) == 0x50) { + super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest); } - if (--this->timer == 0) { - this->timer = rand + 16; + if (--super->timer == 0) { + super->timer = rand + 16; sub_08038168(this); } - if ((this->subAction == 0) && (temp < this->z.HALF.HI)) { - InitializeAnimation(this, 4); - this->subAction = 1; + if ((super->subAction == 0) && (temp < super->z.HALF.HI)) { + InitializeAnimation(super, 4); + super->subAction = 1; } if (temp < -0xc) { - this->spriteRendering.b3 = 1; - this->spriteOrientation.flipY = 1; + super->spriteRendering.b3 = 1; + super->spriteOrientation.flipY = 1; } else { - this->spriteRendering.b3 = 2; - this->spriteOrientation.flipY = 2; + super->spriteRendering.b3 = 2; + super->spriteOrientation.flipY = 2; } } -void sub_08038110(Entity* this) { - UpdateAnimationVariableFrames(this, 2); - if (this->frame & ANIM_DONE) { - if (this->field_0x80.HALF.LO < 5) { - this->action = 2; - this->timer = 8; - this->zVelocity = Q_16_16(3.5); +void sub_08038110(TektiteGoldenEntity* this) { + UpdateAnimationVariableFrames(super, 2); + if (super->frame & ANIM_DONE) { + if (this->unk_80 < 5) { + super->action = 2; + super->timer = 8; + super->zVelocity = Q_16_16(3.5); sub_08038168(this); - InitializeAnimation(this, 2); + InitializeAnimation(super, 2); } else { - this->action = 1; - this->field_0x80.HALF.LO = 0; - this->timer = 192; - InitializeAnimation(this, 0); + super->action = 1; + this->unk_80 = 0; + super->timer = 192; + InitializeAnimation(super, 0); } } } -void sub_08038168(Entity* this) { +void sub_08038168(TektiteGoldenEntity* this) { u32 temp; - if (sub_08049FA0(this) == 0) { - this->direction = sub_08049EE4(this); - } else if (sub_08049FDC(this, 1) != 0) { - this->direction = sub_08049F84(this, 1); + if (sub_08049FA0(super) == 0) { + super->direction = sub_08049EE4(super); + } else if (sub_08049FDC(super, 1) != 0) { + super->direction = sub_08049F84(super, 1); } else { temp = (Random() & 0xf) + 0x18; - this->direction = (temp + this->direction) & (0x3 | DirectionNorthWest); + super->direction = (temp + super->direction) & (0x3 | DirectionNorthWest); } } diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c index 41dfa9d6..c0a09411 100644 --- a/src/enemy/treeItem.c +++ b/src/enemy/treeItem.c @@ -4,12 +4,17 @@ * * @brief Tree Item enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "enemy.h" #include "item.h" #include "object.h" -static bool32 ShouldSpawnTreeItem(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68; +} TreeItemEntity; + +static bool32 ShouldSpawnTreeItem(TreeItemEntity*); extern void sub_08049CF4(Entity*); @@ -32,17 +37,17 @@ const u8 gTreeItemDrops[] = { 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x #define FAIRY_INDEX 8 -void TreeItem(Entity* this) { +void TreeItem(TreeItemEntity* this) { Entity* itemEntity; - if (this->action == 0) { - this->action++; - this->field_0x68.HALF.LO = GetRandomByWeight(gTreeItemDropTables[this->type]); - if (this->field_0x68.HALF.LO > FAIRY_INDEX) { + if (super->action == 0) { + super->action++; + this->unk_68 = GetRandomByWeight(gTreeItemDropTables[super->type]); + if (this->unk_68 > FAIRY_INDEX) { DeleteThisEntity(); } - if (this->field_0x68.HALF.LO < FAIRY_INDEX && GetInventoryValue(ITEM_KINSTONE_BAG) == 0) { - this->field_0x68.HALF.LO = FAIRY_INDEX; + if (this->unk_68 < FAIRY_INDEX && GetInventoryValue(ITEM_KINSTONE_BAG) == 0) { + this->unk_68 = FAIRY_INDEX; } } @@ -50,18 +55,18 @@ void TreeItem(Entity* this) { return; } - switch (this->field_0x68.HALF.LO) { + switch (this->unk_68) { case FAIRY_INDEX: itemEntity = CreateObject(FAIRY, 0x60, 0); if (itemEntity) { itemEntity->timer = 0; - CopyPosition(this, itemEntity); + CopyPosition(super, itemEntity); } break; case 0 ...(FAIRY_INDEX - 1): - itemEntity = CreateObject(GRAVEYARD_KEY, 0x7, gTreeItemDrops[this->field_0x68.HALF.LO]); + itemEntity = CreateObject(GRAVEYARD_KEY, 0x7, gTreeItemDrops[this->unk_68]); if (itemEntity) { - CopyPosition(this, itemEntity); + CopyPosition(super, itemEntity); itemEntity->y.HALF.HI += 16; itemEntity->z.HALF.HI = -32; } @@ -70,20 +75,20 @@ void TreeItem(Entity* this) { break; } - sub_08049CF4(this); + sub_08049CF4(super); DeleteThisEntity(); } -static bool32 ShouldSpawnTreeItem(Entity* this) { - int diff; - int expectedStateX, expectedStateY; - int playerState; +static bool32 ShouldSpawnTreeItem(TreeItemEntity* this) { + s32 diff; + s32 expectedStateX, expectedStateY; + s32 playerState; if (gPlayerEntity.action != PLAYER_BOUNCE) { return FALSE; } - diff = gPlayerEntity.x.HALF.HI - this->x.HALF.HI; + diff = gPlayerEntity.x.HALF.HI - super->x.HALF.HI; expectedStateX = 6; if (diff & 0x8000) { expectedStateX = 2; @@ -94,7 +99,7 @@ static bool32 ShouldSpawnTreeItem(Entity* this) { return FALSE; } - diff = gPlayerEntity.y.HALF.HI - this->y.HALF.HI; + diff = gPlayerEntity.y.HALF.HI - super->y.HALF.HI; expectedStateY = 0; if (diff & 0x8000) { expectedStateY = 4; diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index 73ac6db2..f0b48b2c 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -4,7 +4,7 @@ * * @brief Vaati Arm enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" @@ -12,6 +12,19 @@ #include "object.h" #include "roomid.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ Entity* unk_68; + /*0x6c*/ u8 unused1[12]; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ u8 unk_7c; + /*0x7d*/ u8 unk_7d; + /*0x7e*/ u8 unk_7e; + /*0x7f*/ u8 unk_7f; +} VaatiArmEntity; + typedef struct VaatiArm_HeapStruct1 { union SplitHWord unk00; u16 unk02; @@ -26,85 +39,90 @@ typedef struct VaatiArm_HeapStruct1 { } VaatiArm_HeapStruct1; typedef struct VaatiArm_HeapStruct { - Entity* entities[5]; + VaatiArmEntity* entities[5]; Entity* parent; VaatiArm_HeapStruct1 s1[5]; } VaatiArm_HeapStruct; -static u32 sub_080437DC(Entity*); -static u32 sub_08043C98(Entity*); -static void VaatiArm_OnTick(Entity*); -static void VaatiArm_OnCollision(Entity*); -static void sub_080425B4(Entity*); -static void sub_08042818(Entity*); -static void sub_08042870(Entity*); -static void sub_08042A3C(Entity*); -static void sub_08042C14(Entity*); -static void sub_0804325C(Entity*); -static void sub_08043420(Entity*); -static void sub_08043680(Entity*); -static void VaatiArm_OnGrabbed(Entity*); -static void sub_08042654(Entity*); -static void sub_0804259C(Entity*); -static void sub_08043A10(Entity*); -static void sub_08043ABC(Entity*); -static void sub_08043BC8(Entity*); -static void sub_08043EB8(Entity*); -static void sub_08044000(Entity*); -static void sub_08044078(Entity*); -static void sub_080440CC(Entity*); -static void sub_08043CD4(Entity*); -static void sub_08042894(Entity*); -static void sub_080428AC(Entity*); -static void sub_080428FC(Entity*); -static void sub_08042944(Entity*); -static void sub_08042970(Entity*); -static void sub_080429D4(Entity*); -static void sub_080429FC(Entity*); -static void sub_08043BF0(Entity*); -static void sub_08042A6C(Entity*); -static void sub_08042A88(Entity*); -static void sub_08042AEC(Entity*); -static void sub_08042B20(Entity*); -static void sub_08043C40(Entity*, VaatiArm_HeapStruct1*); -static void sub_08043A78(Entity*); -static void sub_08042C34(Entity*); -static void sub_08042D24(Entity*); -static void sub_08042D6C(Entity*); -static void sub_08042E30(Entity*); -static void sub_08042EF4(Entity*); -static void sub_08042FD8(Entity*); -static void sub_08043048(Entity*); -static void sub_080430D0(Entity*); -static void sub_08043130(Entity*); -static void sub_080431E8(Entity*); -static void sub_08043B9C(Entity*); -static void sub_08043DB0(Entity*); -static void sub_08043B7C(Entity*); -static void sub_08043D08(Entity*); -static void sub_080432A8(Entity*); -static void sub_0804334C(Entity*); -static void sub_08043440(Entity*); -static void sub_08043490(Entity*); -static void sub_08043520(Entity*); -static void sub_0804355C(Entity*); -static void sub_08043580(Entity*); -static void sub_080435F4(Entity*); -static void sub_08043698(Entity*); -static void sub_080436C0(Entity*); -static void sub_08043700(Entity*); -static void sub_08043738(Entity*); -static void sub_08043770(Entity*); +extern void sub_0804AA1C(Entity*); -void sub_0804AA1C(Entity*); +static u32 sub_080437DC(VaatiArmEntity*); +static bool32 sub_08043C98(VaatiArmEntity*); +static void VaatiArm_OnTick(VaatiArmEntity*); +static void VaatiArm_OnCollision(VaatiArmEntity*); +static void sub_080425B4(VaatiArmEntity*); +static void sub_08042818(VaatiArmEntity*); +static void sub_08042870(VaatiArmEntity*); +static void sub_08042A3C(VaatiArmEntity*); +static void sub_08042C14(VaatiArmEntity*); +static void sub_0804325C(VaatiArmEntity*); +static void sub_08043420(VaatiArmEntity*); +static void sub_08043680(VaatiArmEntity*); +static void VaatiArm_OnGrabbed(VaatiArmEntity*); +static void sub_08042654(VaatiArmEntity*); +static void sub_0804259C(VaatiArmEntity*); +static void sub_08043A10(VaatiArmEntity*); +static void sub_08043ABC(VaatiArmEntity*); +static void sub_08043BC8(VaatiArmEntity*); +static void sub_08043EB8(VaatiArmEntity*); +static void sub_08044000(VaatiArmEntity*); +static void sub_08044078(VaatiArmEntity*); +static void sub_080440CC(VaatiArmEntity*); +static void sub_08043CD4(VaatiArmEntity*); +static void sub_08042894(VaatiArmEntity*); +static void sub_080428AC(VaatiArmEntity*); +static void sub_080428FC(VaatiArmEntity*); +static void sub_08042944(VaatiArmEntity*); +static void sub_08042970(VaatiArmEntity*); +static void sub_080429D4(VaatiArmEntity*); +static void sub_080429FC(VaatiArmEntity*); +static void sub_08043BF0(VaatiArmEntity*); +static void sub_08042A6C(VaatiArmEntity*); +static void sub_08042A88(VaatiArmEntity*); +static void sub_08042AEC(VaatiArmEntity*); +static void sub_08042B20(VaatiArmEntity*); +static void sub_08043C40(VaatiArmEntity*, VaatiArm_HeapStruct1*); +static void sub_08043A78(VaatiArmEntity*); +static void sub_08042C34(VaatiArmEntity*); +static void sub_08042D24(VaatiArmEntity*); +static void sub_08042D6C(VaatiArmEntity*); +static void sub_08042E30(VaatiArmEntity*); +static void sub_08042EF4(VaatiArmEntity*); +static void sub_08042FD8(VaatiArmEntity*); +static void sub_08043048(VaatiArmEntity*); +static void sub_080430D0(VaatiArmEntity*); +static void sub_08043130(VaatiArmEntity*); +static void sub_080431E8(VaatiArmEntity*); +static void sub_08043B9C(VaatiArmEntity*); +static void sub_08043DB0(VaatiArmEntity*); +static void sub_08043B7C(VaatiArmEntity*); +static void sub_08043D08(VaatiArmEntity*); +static void sub_080432A8(VaatiArmEntity*); +static void sub_0804334C(VaatiArmEntity*); +static void sub_08043440(VaatiArmEntity*); +static void sub_08043490(VaatiArmEntity*); +static void sub_08043520(VaatiArmEntity*); +static void sub_0804355C(VaatiArmEntity*); +static void sub_08043580(VaatiArmEntity*); +static void sub_080435F4(VaatiArmEntity*); +static void sub_08043698(VaatiArmEntity*); +static void sub_080436C0(VaatiArmEntity*); +static void sub_08043700(VaatiArmEntity*); +static void sub_08043738(VaatiArmEntity*); +static void sub_08043770(VaatiArmEntity*); -void (*const VaatiArm_Functions[])(Entity*) = { - VaatiArm_OnTick, VaatiArm_OnCollision, GenericKnockback, GenericDeath, GenericConfused, VaatiArm_OnGrabbed, +void (*const VaatiArm_Functions[])(VaatiArmEntity*) = { + VaatiArm_OnTick, + VaatiArm_OnCollision, + (void (*)(VaatiArmEntity*))GenericKnockback, + (void (*)(VaatiArmEntity*))GenericDeath, + (void (*)(VaatiArmEntity*))GenericConfused, + VaatiArm_OnGrabbed, }; -void (*const gUnk_080D1248[])(Entity*) = { +void (*const gUnk_080D1248[])(VaatiArmEntity*) = { sub_0804259C, sub_08044078, sub_08044078, sub_08044078, sub_080440CC, }; -void (*const gUnk_080D125C[])(Entity*) = { +void (*const gUnk_080D125C[])(VaatiArmEntity*) = { sub_080425B4, sub_08042654, sub_08042818, sub_08042870, sub_08042A3C, sub_08042C14, sub_0804325C, sub_08043420, sub_08043680, }; @@ -113,7 +131,7 @@ const s16 gUnk_080D1280[] = { 0x140, -0x140 }; const s8 gUnk_080D1284[] = { 0x40, -0x40 }; const u8 gUnk_080D1286[] = { 2, 3, 5, 6, 0xc, 0xb, 9, 8, 0, 0 }; -void (*const gUnk_080D1290[])(Entity*) = { +void (*const gUnk_080D1290[])(VaatiArmEntity*) = { sub_08042894, sub_080428AC, sub_080428FC, sub_08042944, sub_08042970, sub_080429D4, sub_080429FC, }; @@ -123,7 +141,7 @@ const u8 gUnk_080D12B2[] = { -0x50, 0x50 }; const s8 gUnk_080D12B4[] = { -0x20, 0x20 }; const u8 gUnk_080D12B6[] = { 0x70, -0x70 }; -void (*const gUnk_080D12B8[])(Entity*) = { +void (*const gUnk_080D12B8[])(VaatiArmEntity*) = { sub_08042A6C, sub_08042A88, sub_08042AEC, @@ -133,7 +151,7 @@ void (*const gUnk_080D12B8[])(Entity*) = { const u8 gUnk_080D12C8[] = { 0x60, -0x60 }; const u16 gUnk_080D12CA[] = { 0x280, -0x280 }; -void (*const gUnk_080D12D0[])(Entity*) = { +void (*const gUnk_080D12D0[])(VaatiArmEntity*) = { sub_08042C34, sub_08042D24, sub_08042D6C, sub_08042E30, sub_08042EF4, sub_08042FD8, sub_08043048, sub_080430D0, sub_08043130, sub_080431E8, }; @@ -143,15 +161,15 @@ const s16 gUnk_080D1300[] = { 0xC0, -0xC0 }; const u8 gUnk_080D1304[] = { 0, -1, -2, -3, 0, 1, 2, 3 }; const s16 gUnk_080D130C[] = { 0x5000, -0x5000 }; const s16 gUnk_080D1310[] = { 0xA0, -0xA0 }; -void (*const gUnk_080D1314[])(Entity*) = { sub_080432A8, sub_0804334C }; +void (*const gUnk_080D1314[])(VaatiArmEntity*) = { sub_080432A8, sub_0804334C }; const u8 gUnk_080D131C[] = { 0x70, -0x70 }; -void (*const gUnk_080D1320[])(Entity*) = { +void (*const gUnk_080D1320[])(VaatiArmEntity*) = { sub_08043440, sub_08043490, sub_08043520, sub_0804355C, sub_08043580, sub_080435F4, }; const s16 gUnk_080D1338[] = { 0x4000, -0x4000 }; const s16 gUnk_080D133C[] = { 0xA0, -0xA0 }; const u8 gUnk_080D1340[] = { 0, 0x12, 0x12, 0x11, 0x11, 0, 0, 0 }; -void (*const gUnk_080D1348[])(Entity*) = { +void (*const gUnk_080D1348[])(VaatiArmEntity*) = { sub_08043698, sub_080436C0, sub_08043700, sub_08043738, sub_08043770, }; const u16 gUnk_080D135C[] = { 0x4000, -0x4000, 0x8000 }; @@ -178,39 +196,39 @@ const u16 gUnk_080D1400[][5] = { const u8 gUnk_080D1414[] = { 0, 0xc, 0xe, 0x10, 0x1c }; const u8 gUnk_080D1419[] = { 0, 0xa, 0xa, 0xa, 0x1c }; -void VaatiArm(Entity* this) { - VaatiArm_Functions[GetNextFunction(this)](this); +void VaatiArm(VaatiArmEntity* this) { + VaatiArm_Functions[GetNextFunction(super)](this); } -static void VaatiArm_OnTick(Entity* this) { - gUnk_080D1248[this->type](this); +static void VaatiArm_OnTick(VaatiArmEntity* this) { + gUnk_080D1248[super->type](this); } -static void VaatiArm_OnCollision(Entity* this) { - EnemyFunctionHandlerAfterCollision(this, VaatiArm_Functions); +static void VaatiArm_OnCollision(VaatiArmEntity* this) { + EnemyFunctionHandlerAfterCollision(super, VaatiArm_Functions); } -static void VaatiArm_OnGrabbed(Entity* this) { +static void VaatiArm_OnGrabbed(VaatiArmEntity* this) { } -static void sub_0804259C(Entity* this) { - gUnk_080D125C[this->action](this); +static void sub_0804259C(VaatiArmEntity* this) { + gUnk_080D125C[super->action](this); } -static void sub_080425B4(Entity* this) { +static void sub_080425B4(VaatiArmEntity* this) { if (sub_080437DC(this)) { - this->field_0x7c.BYTES.byte0 = 0; - this->field_0x7c.BYTES.byte1 = 0; + this->unk_7c = 0; + this->unk_7d = 0; if ((gRoomTransition.field_0x38 & 1) != 0) { - if (gRoomTransition.field_0x3c == this->type2) { + if (gRoomTransition.field_0x3c == super->type2) { sub_08043EB8(this); sub_08043ABC(this); - if ((gRoomTransition.field_0x39 >> (this->type2 + 2) & 1U) != 0) { - this->action = 7; - this->subAction = 4; + if ((gRoomTransition.field_0x39 >> (super->type2 + 2) & 1U) != 0) { + super->action = 7; + super->subAction = 4; } else { - this->action = 8; - this->subAction = 0; + super->action = 8; + super->subAction = 0; } } else { sub_08044000(this); @@ -218,77 +236,77 @@ static void sub_080425B4(Entity* this) { sub_08043A10(this); } } else { - this->action = 1; - this->subAction = gRoomTransition.field_0x38 & 1; - ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk08 = gUnk_080D1280[this->type2]; + super->action = 1; + super->subAction = gRoomTransition.field_0x38 & 1; + ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk08 = gUnk_080D1280[super->type2]; sub_08042654(this); } } } -static void sub_08042654(Entity* this) { +static void sub_08042654(VaatiArmEntity* this) { u32 uVar8; int index; VaatiArm_HeapStruct1* ptr; - index = this->type2 * 4; - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; - switch (this->subAction) { + index = super->type2 * 4; + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; + switch (super->subAction) { case 0: - this->subAction = 1; - ptr->unk00.HALF.HI = gUnk_080D1284[this->type2]; - uVar8 = gUnk_080D1286[this->type2 * 4]; - InitAnimationForceUpdate(this, uVar8); + super->subAction = 1; + ptr->unk00.HALF.HI = gUnk_080D1284[super->type2]; + uVar8 = gUnk_080D1286[super->type2 * 4]; + InitAnimationForceUpdate(super, uVar8); SoundReq(SFX_15E); break; case 1: ptr->unk00.HWORD += ptr->unk08; - if ((((VaatiArm_HeapStruct*)this->myHeap)->s1[1].unk0c += 2) < 0xc) + if ((((VaatiArm_HeapStruct*)super->myHeap)->s1[1].unk0c += 2) < 0xc) break; - this->subAction = 2; + super->subAction = 2; uVar8 = gUnk_080D1286[index + 1]; - InitAnimationForceUpdate(this, uVar8); + InitAnimationForceUpdate(super, uVar8); SoundReq(SFX_15E); break; case 2: ptr->unk00.HWORD += ptr->unk08; - if ((((VaatiArm_HeapStruct*)this->myHeap)->s1[2].unk0c += 2) < 0xe) + if ((((VaatiArm_HeapStruct*)super->myHeap)->s1[2].unk0c += 2) < 0xe) break; - this->subAction = 3; + super->subAction = 3; uVar8 = gUnk_080D1286[index + 2]; - InitAnimationForceUpdate(this, uVar8); + InitAnimationForceUpdate(super, uVar8); SoundReq(SFX_15E); break; case 3: ptr->unk00.HWORD += ptr->unk08; - if ((((VaatiArm_HeapStruct*)this->myHeap)->s1[3].unk0c += 2) < 0x10) + if ((((VaatiArm_HeapStruct*)super->myHeap)->s1[3].unk0c += 2) < 0x10) break; - this->subAction = 4; + super->subAction = 4; uVar8 = gUnk_080D1286[index + 3]; - InitAnimationForceUpdate(this, uVar8); + InitAnimationForceUpdate(super, uVar8); SoundReq(SFX_15E); break; case 4: ptr->unk00.HWORD += ptr->unk08; - if ((((VaatiArm_HeapStruct*)this->myHeap)->s1[4].unk0c += 2) < 0x1c) + if ((((VaatiArm_HeapStruct*)super->myHeap)->s1[4].unk0c += 2) < 0x1c) break; - this->subAction = 5; - this->timer = 90; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->flags |= ENT_COLLIDE; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spritePriority.b0 = 4; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->flags |= ENT_COLLIDE; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->spritePriority.b0 = 4; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[2]->flags |= ENT_COLLIDE; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[2]->spritePriority.b0 = 4; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->flags |= ENT_COLLIDE; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->spritePriority.b0 = 4; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->flags |= ENT_COLLIDE; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->spritePriority.b0 = 4; - InitAnimationForceUpdate(this, 7); + super->subAction = 5; + super->timer = 90; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.flags |= ENT_COLLIDE; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.spritePriority.b0 = 4; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.flags |= ENT_COLLIDE; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.spritePriority.b0 = 4; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base.flags |= ENT_COLLIDE; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base.spritePriority.b0 = 4; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base.flags |= ENT_COLLIDE; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base.spritePriority.b0 = 4; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.flags |= ENT_COLLIDE; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.spritePriority.b0 = 4; + InitAnimationForceUpdate(super, 7); SoundReq(SFX_15E); break; default: - if (--this->timer == 0) { + if (--super->timer == 0) { sub_08043BC8(this); } break; @@ -296,11 +314,11 @@ static void sub_08042654(Entity* this) { sub_08043A10(this); } -static void sub_08042818(Entity* this) { +static void sub_08042818(VaatiArmEntity* this) { VaatiArm_HeapStruct1* ptr; sub_08043CD4(this); - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; ptr->unk00.HWORD += ptr->unk08; if (--ptr->unk0d == 0) { ptr->unk0d = 0x78; @@ -314,22 +332,22 @@ static void sub_08042818(Entity* this) { sub_08043A10(this); } -static void sub_08042870(Entity* this) { +static void sub_08042870(VaatiArmEntity* this) { sub_08043CD4(this); - gUnk_080D1290[this->subAction](this); + gUnk_080D1290[super->subAction](this); sub_08043A10(this); } -static void sub_08042894(Entity* this) { - this->subAction = 1; - ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk08 = gUnk_080D12AC[this->type2]; +static void sub_08042894(VaatiArmEntity* this) { + super->subAction = 1; + ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk08 = gUnk_080D12AC[super->type2]; } -static void sub_080428AC(Entity* this) { +static void sub_080428AC(VaatiArmEntity* this) { u8 bVar1; VaatiArm_HeapStruct1* pVVar3; - pVVar3 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; + pVVar3 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; bVar1 = pVVar3->unk04.HALF.HI; if (bVar1 != 0x40) { if (bVar1 >= 0x41) { @@ -338,112 +356,112 @@ static void sub_080428AC(Entity* this) { pVVar3->unk04.HWORD += 0x80; } } - if ((u32)(pVVar3->unk00.HALF.HI - gUnk_080D12B0[this->type2] + 1) > 2) { + if ((u32)(pVVar3->unk00.HALF.HI - gUnk_080D12B0[super->type2] + 1) > 2) { pVVar3->unk00.HWORD += pVVar3->unk08; } else { - this->subAction = 2; - this->timer = 30; + super->subAction = 2; + super->timer = 30; } sub_08043BF0(this); } -static void sub_080428FC(Entity* this) { +static void sub_080428FC(VaatiArmEntity* this) { u32 uVar2; VaatiArm_HeapStruct1* ptr; - if (--this->timer == 0) { - this->subAction = 3; - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; + if (--super->timer == 0) { + super->subAction = 3; + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; ptr->unk08 *= -3; SoundReq(SFX_153); uVar2 = 0; do { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[uVar2]->hitType = 0x3b; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[uVar2]->base.hitType = 0x3b; uVar2 = uVar2 + 1; } while (uVar2 < 5); } } -static void sub_08042944(Entity* this) { +static void sub_08042944(VaatiArmEntity* this) { VaatiArm_HeapStruct1* pVVar1; - pVVar1 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; + pVVar1 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; if ((u32)(pVVar1->unk00.HALF.HI - 0x7c) >= 9) { pVVar1->unk00.HWORD += pVVar1->unk08; } else { - this->subAction = 4; - this->speed = pVVar1->unk08; + super->subAction = 4; + super->speed = pVVar1->unk08; } sub_08043BF0(this); } -static void sub_08042970(Entity* this) { +static void sub_08042970(VaatiArmEntity* this) { u32 uVar2; VaatiArm_HeapStruct1* pVVar3; - pVVar3 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; - if ((u32)(pVVar3->unk00.HALF.HI - gUnk_080D12B2[this->type2] + 2) >= 5) { - pVVar3->unk08 += gUnk_080D12B4[this->type2]; + pVVar3 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; + if ((u32)(pVVar3->unk00.HALF.HI - gUnk_080D12B2[super->type2] + 2) >= 5) { + pVVar3->unk08 += gUnk_080D12B4[super->type2]; pVVar3->unk00.HWORD += pVVar3->unk08; } else { - this->subAction = 5; - this->timer = 60; + super->subAction = 5; + super->timer = 60; uVar2 = 0; do { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[uVar2]->hitType = 0x39; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[uVar2]->base.hitType = 0x39; uVar2 = uVar2 + 1; } while (uVar2 < 5); } sub_08043BF0(this); } -static void sub_080429D4(Entity* this) { +static void sub_080429D4(VaatiArmEntity* this) { s16 sVar2; VaatiArm_HeapStruct1* pVVar3; - if (--this->timer == 0) { - this->subAction = 6; - pVVar3 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; - sVar2 = -this->speed / 6; + if (--super->timer == 0) { + super->subAction = 6; + pVVar3 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; + sVar2 = -super->speed / 6; pVVar3->unk08 = sVar2; } } -static void sub_080429FC(Entity* this) { +static void sub_080429FC(VaatiArmEntity* this) { VaatiArm_HeapStruct1* pVVar1; - pVVar1 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; - if ((u32)(pVVar1->unk00.HALF.HI - gUnk_080D12B6[this->type2]) + 1 >= 3) { + pVVar1 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; + if ((u32)(pVVar1->unk00.HALF.HI - gUnk_080D12B6[super->type2]) + 1 >= 3) { pVVar1->unk00.HWORD += pVVar1->unk08; sub_08043BF0(this); } else { sub_08043BC8(this); - InitAnimationForceUpdate(this, 7); + InitAnimationForceUpdate(super, 7); } } -static void sub_08042A3C(Entity* this) { +static void sub_08042A3C(VaatiArmEntity* this) { Entity* entity; - gUnk_080D12B8[this->subAction](this); + gUnk_080D12B8[super->subAction](this); sub_08043A10(this); - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; - entity->z.HALF.HI += this->field_0x78.HALF.LO; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base; + entity->z.HALF.HI += this->unk_78; } -static void sub_08042A6C(Entity* this) { - this->subAction = 1; - this->field_0x78.HALF.LO = 0; - this->field_0x7c.BYTES.byte2 = 1; - ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk0a = 0x200; +static void sub_08042A6C(VaatiArmEntity* this) { + super->subAction = 1; + this->unk_78 = 0; + this->unk_7e = 1; + ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk0a = 0x200; } -static void sub_08042A88(Entity* this) { +static void sub_08042A88(VaatiArmEntity* this) { VaatiArm_HeapStruct1* pVVar4; - pVVar4 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; - if (gUnk_080D12C8[this->type2] != pVVar4->unk00.HALF.HI) { - if (gUnk_080D12C8[this->type2] < pVVar4->unk00.HALF.HI) { + pVVar4 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; + if (gUnk_080D12C8[super->type2] != pVVar4->unk00.HALF.HI) { + if (gUnk_080D12C8[super->type2] < pVVar4->unk00.HALF.HI) { pVVar4->unk00.HWORD -= 0x100; } else { pVVar4->unk00.HWORD += 0x100; @@ -453,29 +471,29 @@ static void sub_08042A88(Entity* this) { pVVar4->unk04.HWORD -= pVVar4->unk0a; } else { pVVar4->unk04.HWORD = 0; - pVVar4->unk08 = gUnk_080D12CA[this->type2]; - this->subAction = 2; - this->timer = 30; + pVVar4->unk08 = gUnk_080D12CA[super->type2]; + super->subAction = 2; + super->timer = 30; } } -static void sub_08042AEC(Entity* this) { - if (--this->timer == 0) { - this->subAction = 3; - this->timer = 4; - this->hitType = 0x3d; - InitAnimationForceUpdate(this, 0xe); - ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->hitType = 0x3d; +static void sub_08042AEC(VaatiArmEntity* this) { + if (--super->timer == 0) { + super->subAction = 3; + super->timer = 4; + super->hitType = 0x3d; + InitAnimationForceUpdate(super, 0xe); + ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.hitType = 0x3d; } } -static void sub_08042B20(Entity* this) { +static void sub_08042B20(VaatiArmEntity* this) { VaatiArm_HeapStruct1* ptr; Entity* object; Entity* entity; u32 i; - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; if (ptr->unk04.HALF.HI < 0x7b) { ptr->unk04.HWORD += 0x500; } else { @@ -484,20 +502,20 @@ static void sub_08042B20(Entity* this) { if (0x30 < ptr->unk04.HALF.HI) { ptr->unk00.HWORD += ptr->unk08; } - if (((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->spriteSettings.draw) { + if (((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base.spriteSettings.draw) { sub_08043C40(this, ptr); for (i = 0; i < 4; i++) { - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base; if ((-0xa <= entity->z.HALF.HI) && ((entity->spriteSettings.draw) == 1)) { if (i == 0) { object = CreateObject(VAATI3_ARM, 0, 0); if (object != NULL) { - object->parent = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; + object->parent = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base; } - *(Entity**)&((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->field_0x68 = object; + *(Entity**)&((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->unk_68 = object; object = CreateObject(VAATI3_ARM, 2, 0); if (object != NULL) { - CopyPosition(((VaatiArm_HeapStruct*)this->myHeap)->entities[4], object); + CopyPosition(&((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base, object); } } entity->flags &= ~ENT_COLLIDE; @@ -506,23 +524,23 @@ static void sub_08042B20(Entity* this) { } } } else { - this->field_0x78.HALF.LO += 2; - if (--this->timer == 0) { - this->action = 5; - this->subAction = 0; - this->timer = 30; - this->hitType = 0x39; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->hitType = 0x39; + this->unk_78 += 2; + if (--super->timer == 0) { + super->action = 5; + super->subAction = 0; + super->timer = 30; + super->hitType = 0x39; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.hitType = 0x39; } } } -static void sub_08042C14(Entity* this) { - gUnk_080D12D0[this->subAction](this); +static void sub_08042C14(VaatiArmEntity* this) { + gUnk_080D12D0[super->subAction](this); sub_08043A78(this); } -static void sub_08042C34(Entity* this) { +static void sub_08042C34(VaatiArmEntity* this) { u32 random; int y; u32 i; @@ -532,10 +550,10 @@ static void sub_08042C34(Entity* this) { VaatiArm_HeapStruct1* ptr; - if (--this->timer == 0) { - this->timer = 60; - this->subtimer = 3; - this->subAction = 1; + if (--super->timer == 0) { + super->timer = 60; + super->subtimer = 3; + super->subAction = 1; random = Random() & 6; temp = &gUnk_080D12F8[random]; x = gPlayerEntity.x.HALF.HI + *temp; @@ -563,12 +581,12 @@ static void sub_08042C34(Entity* this) { y = gRoomControls.origin_y + 0x40; } for (i = 0; i < 4; i++) { - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base; entity->x.HALF.HI = x; entity->y.HALF.HI = y; entity->z.HALF.HI = 0x32; entity->hitType = 0x39; - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i]; + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i]; ptr->unk00.HWORD = 0x80; ptr->unk04.HWORD = 0; ptr->unk0c = gUnk_080D1419[i]; @@ -579,29 +597,29 @@ static void sub_08042C34(Entity* this) { } } -static void sub_08042D24(Entity* this) { +static void sub_08042D24(VaatiArmEntity* this) { Entity* entity; - if (--this->timer == 0) { - this->subAction = 2; - this->hitType = 0x3d; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->hitType = 0x3d; + if (--super->timer == 0) { + super->subAction = 2; + super->hitType = 0x3d; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.hitType = 0x3d; entity = CreateObject(VAATI3_ARM, 1, 0); if (entity != NULL) { - entity->parent = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; + entity->parent = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base; } - *(Entity**)&this->field_0x68 = entity; - InitAnimationForceUpdate(this, 0xd); + *(Entity**)&this->unk_68 = entity; + InitAnimationForceUpdate(super, 0xd); } } -static void sub_08042D6C(Entity* this) { +static void sub_08042D6C(VaatiArmEntity* this) { Entity* object; Entity* entity; u32 i; for (i = 0; i < 4; i++) { - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base; if (entity->z.HALF.HI < 4) { if (i != 2) { entity->flags = entity->flags | ENT_COLLIDE; @@ -613,43 +631,43 @@ static void sub_08042D6C(Entity* this) { entity->spriteSettings.draw = 1; } } - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base; if (entity->z.HALF.HI <= -3) { entity->z.HALF.HI = -5; - ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk08 = gUnk_080D1300[this->type2]; - ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk0a = 0xc0; - this->subAction = 3; - this->timer = 30; - this->hitType = 0x39; - this->field_0x7c.BYTES.byte3 = 0x2d; - InitAnimationForceUpdate(this, 0); - ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]->hitType = 0x39; + ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk08 = gUnk_080D1300[super->type2]; + ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk0a = 0xc0; + super->subAction = 3; + super->timer = 30; + super->hitType = 0x39; + this->unk_7f = 0x2d; + InitAnimationForceUpdate(super, 0); + ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.hitType = 0x39; } else { entity->z.HALF.HI -= 2; } } -static void sub_08042E30(Entity* this) { +static void sub_08042E30(VaatiArmEntity* this) { short sVar3; u32 uVar6; VaatiArm_HeapStruct1* pVVar9; - if (this->field_0x7c.BYTES.byte3 == 0) { - if (sub_08043C98(this) != 0) { + if (this->unk_7f == 0) { + if (sub_08043C98(this)) { return; } } else { - this->field_0x7c.BYTES.byte3--; + this->unk_7f--; } - pVVar9 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; - if (--this->timer == 0) { - this->subAction = 4; - this->timer = (Random() & 0x38) + 40; - this->speed = 0x200; - this->direction = pVVar9->unk00.HALF.HI >> 3; - uVar6 = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gRoomControls.origin_x + 0x110, + pVVar9 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; + if (--super->timer == 0) { + super->subAction = 4; + super->timer = (Random() & 0x38) + 40; + super->speed = 0x200; + super->direction = pVVar9->unk00.HALF.HI >> 3; + uVar6 = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gRoomControls.origin_x + 0x110, gRoomControls.origin_y + 0x60); - this->field_0x78.HALF.HI = (gUnk_080D1304[Random() & 7] + uVar6) & 0x1f; + this->unk_79 = (gUnk_080D1304[Random() & 7] + uVar6) & 0x1f; } pVVar9->unk00.HWORD += pVVar9->unk08; pVVar9->unk04.HWORD += pVVar9->unk0a; @@ -664,96 +682,96 @@ static void sub_08042E30(Entity* this) { pVVar9->unk0a = -sVar3; } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -static void sub_08042EF4(Entity* this) { +static void sub_08042EF4(VaatiArmEntity* this) { VaatiArm_HeapStruct1* ptr; Entity* entity; u32 temp; u32 x, y; - UpdateAnimationSingleFrame(this); - if (sub_08043C98(this) == 0) { - if (--this->timer == 0) { - if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x50)) { - this->subAction = 6; - this->timer = 40; + UpdateAnimationSingleFrame(super); + if (!sub_08043C98(this)) { + if (--super->timer == 0) { + if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x50)) { + super->subAction = 6; + super->timer = 40; } else { - this->subAction = 5; - InitAnimationForceUpdate(this, 0xf); + super->subAction = 5; + InitAnimationForceUpdate(super, 0xf); SoundReq(SFX_19B); } } - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; if (ptr->unk04.HALF.HI < 0x20) { ptr->unk04.HWORD += 0x100; } - x = this->parent->x.HALF.HI; - y = this->parent->y.HALF.HI - 0x10; - if (EntityWithinDistance(this, x, y, 0x30)) { - temp = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, x, y); - if ((this->field_0x78.HALF.HI - temp) + 4 < 9) { - this->field_0x78.HALF.HI = temp ^ 0x10; + x = super->parent->x.HALF.HI; + y = super->parent->y.HALF.HI - 0x10; + if (EntityWithinDistance(super, x, y, 0x30)) { + temp = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, x, y); + if ((this->unk_79 - temp) + 4 < 9) { + this->unk_79 = temp ^ 0x10; } } - if (this->field_0x78.HALF.HI != this->direction) { - sub_08004596(this, this->field_0x78.HALF.HI); - ptr->unk00.HALF.HI = this->direction << 3; + if (this->unk_79 != super->direction) { + sub_08004596(super, this->unk_79); + ptr->unk00.HALF.HI = super->direction << 3; } - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; - entity->direction = this->direction; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base; + entity->direction = super->direction; ProcessMovement0(entity); } } -static void sub_08042FD8(Entity* this) { +static void sub_08042FD8(VaatiArmEntity* this) { Entity* entity; - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); if (!sub_08043C98(this)) { - if ((this->frame & 1) != 0) { + if ((super->frame & 1) != 0) { entity = CreateProjectile(V3_HAND_PROJECTILE); if (entity != NULL) { - CopyPosition(this, entity); + CopyPosition(super, entity); entity->z.HALF.HI -= 0x18; - this->frame = 0; + super->frame = 0; } } else { - if (this->frame & ANIM_DONE) { - if (--this->subtimer == 0) { - this->subAction = 8; - this->timer = 60; + if (super->frame & ANIM_DONE) { + if (--super->subtimer == 0) { + super->subAction = 8; + super->timer = 60; } else { - this->subAction = 3; - this->timer = 60; - InitAnimationForceUpdate(this, 0); + super->subAction = 3; + super->timer = 60; + InitAnimationForceUpdate(super, 0); } } } } } -static void sub_08043048(Entity* this) { +static void sub_08043048(VaatiArmEntity* this) { VaatiArm_HeapStruct1* ptr; u32 i; - if (sub_08043C98(this) == 0) { - ptr = ((VaatiArm_HeapStruct*)this->myHeap)->s1; + if (!sub_08043C98(this)) { + ptr = ((VaatiArm_HeapStruct*)super->myHeap)->s1; if (ptr[0].unk04.HALF.HI < 0x50) { ptr[0].unk04.HWORD += 0x200; if (0x4f < ptr[0].unk04.HALF.HI) { for (i = 0; i < 5; i++) { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->hitType = 0x3b; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.hitType = 0x3b; } SoundReq(SFX_153); } } else { ptr[0].unk00.HWORD += ptr[0].unk08 * 8; - if (--this->timer == 0) { - this->subAction = 7; + if (--super->timer == 0) { + super->subAction = 7; for (i = 0; i < 5; i++) { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->hitType = 0x39; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.hitType = 0x39; } } } @@ -761,52 +779,52 @@ static void sub_08043048(Entity* this) { } } -static void sub_080430D0(Entity* this) { +static void sub_080430D0(VaatiArmEntity* this) { VaatiArm_HeapStruct1* ptr; - if (sub_08043C98(this) == 0) { - ptr = ((VaatiArm_HeapStruct*)this->myHeap)->s1; + if (!sub_08043C98(this)) { + ptr = ((VaatiArm_HeapStruct*)super->myHeap)->s1; ptr[0].unk00.HWORD += ptr[0].unk08; ptr[0].unk04.HWORD -= 0x100; if (ptr[0].unk04.HALF.HI < 0x18) { - if (--this->subtimer == 0) { - this->subAction = 8; - this->timer = 60; + if (--super->subtimer == 0) { + super->subAction = 8; + super->timer = 60; } else { - this->subAction = 3; - this->timer = 60; + super->subAction = 3; + super->timer = 60; ptr[0].unk0a = -0xc0; - InitAnimationForceUpdate(this, 0); + InitAnimationForceUpdate(super, 0); } } } } -static void sub_08043130(Entity* this) { +static void sub_08043130(VaatiArmEntity* this) { VaatiArm_HeapStruct1* ptr; Entity* entity; u32 i; - ptr = ((VaatiArm_HeapStruct*)this->myHeap)->s1; + ptr = ((VaatiArm_HeapStruct*)super->myHeap)->s1; if (ptr[0].unk04.HALF.HI != 0) { - if (sub_08043C98(this) == 0) { + if (!sub_08043C98(this)) { if (--ptr[0].unk04.HALF.HI == 0) { - InitAnimationForceUpdate(this, 0xd); + InitAnimationForceUpdate(super, 0xd); } } } else { - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; for (i = 1; i < 4; i++) { - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i]; + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i]; if (ptr->unk04.HALF.HI != 0) { ptr->unk04.HALF.HI--; } } } else { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]->z.HALF.HI += 3; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base.z.HALF.HI += 3; for (i = 0; i < 4; i++) { - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base; if (entity->z.HALF.HI > -4) { entity->flags = entity->flags & ~ENT_COLLIDE; if (entity->spriteSettings.draw == 1) { @@ -815,54 +833,54 @@ static void sub_08043130(Entity* this) { entity->spriteSettings.draw = 0; } } - if (this->spriteSettings.draw == 0) { - this->subAction = 9; - this->timer = 60; - sub_0804AA1C(this); + if (super->spriteSettings.draw == 0) { + super->subAction = 9; + super->timer = 60; + sub_0804AA1C(super); } } } } -static void sub_080431E8(Entity* this) { +static void sub_080431E8(VaatiArmEntity* this) { u32 i; VaatiArm_HeapStruct1* ptr; - if (--this->timer == 0) { - this->action = 6; - this->subAction = 0; + if (--super->timer == 0) { + super->action = 6; + super->subAction = 0; for (i = 0; i < 4; i++) { - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i]; - ptr->unk00.HWORD = gUnk_080D130C[this->type2]; + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i]; + ptr->unk00.HWORD = gUnk_080D130C[super->type2]; ptr->unk04.HWORD = 0x8000; ptr->unk0c = gUnk_080D1414[i]; if (i == 3) { - InitializeAnimation(((VaatiArm_HeapStruct*)this->myHeap)->entities[3], 0x11); + InitializeAnimation(&((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base, 0x11); } } - ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk08 = gUnk_080D1310[this->type2]; - InitAnimationForceUpdate(this, 0xe); + ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk08 = gUnk_080D1310[super->type2]; + InitAnimationForceUpdate(super, 0xe); } } -static void sub_0804325C(Entity* this) { +static void sub_0804325C(VaatiArmEntity* this) { Entity* entity; sub_08043CD4(this); - gUnk_080D1314[this->subAction](this); + gUnk_080D1314[super->subAction](this); sub_08043A10(this); - if (this->field_0x78.HALF.LO != 0) { - if (this->field_0x78.HALF.LO >= 3) { - this->field_0x78.HALF.LO -= 2; - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; - entity->z.HALF.HI += this->field_0x78.HALF.LO; + if (this->unk_78 != 0) { + if (this->unk_78 >= 3) { + this->unk_78 -= 2; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base; + entity->z.HALF.HI += this->unk_78; } else { - this->field_0x78.HALF.LO = 0; + this->unk_78 = 0; } } } -void sub_080432A8(Entity* this) { +void sub_080432A8(VaatiArmEntity* this) { s32 iVar3; s32 i; VaatiArm_HeapStruct1* hs; @@ -871,7 +889,7 @@ void sub_080432A8(Entity* this) { iVar3 = 0; for (; i >= 0; i--) { - hs = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i]; + hs = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i]; if (hs->unk0c > 2) { hs->unk0c--; if (++iVar3 > 1) { @@ -880,44 +898,44 @@ void sub_080432A8(Entity* this) { } } - hs = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; + hs = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; hs->unk04.HALF.HI -= 2; for (i = 0; i < 4; i++) { - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base; if (entity->z.HALF.HI < 4) { COLLISION_ON(entity); entity->spriteSettings.draw = 1; } } - if ((((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spriteSettings.draw == 1) && - (((VaatiArm_HeapStruct*)this->myHeap)->s1[1].unk0c < 3)) { - this->subAction = 1; - this->timer = 0x1e; - ((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk04.HWORD = 0x4000; - sub_0804AA1C(((VaatiArm_HeapStruct*)this->myHeap)->entities[4]); + if ((((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.spriteSettings.draw == 1) && + (((VaatiArm_HeapStruct*)super->myHeap)->s1[1].unk0c < 3)) { + super->subAction = 1; + super->timer = 0x1e; + ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk04.HWORD = 0x4000; + sub_0804AA1C(&((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base); } } -void sub_0804334C(Entity* this) { +void sub_0804334C(VaatiArmEntity* this) { u32 bVar1; Entity* entity; u32 i; VaatiArm_HeapStruct1* ptr; - if (this->timer != 0) { - if (--this->timer != 0) { + if (super->timer != 0) { + if (--super->timer != 0) { return; } for (i = 0; i < 5; i++) { - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base; COLLISION_ON(entity); entity->spriteSettings.draw = 1; } } - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; - if (gUnk_080D131C[this->type2] - ptr->unk00.HALF.HI + 1 > 2u) { + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; + if (gUnk_080D131C[super->type2] - ptr->unk00.HALF.HI + 1 > 2u) { ptr->unk00.HWORD += ptr->unk08; bVar1 = 0; } else { @@ -925,7 +943,7 @@ void sub_0804334C(Entity* this) { } sub_08043B9C(this); for (i = 0; i < 5; i++) { - ptr = &(((VaatiArm_HeapStruct*)this->myHeap)->s1)[i]; + ptr = &(((VaatiArm_HeapStruct*)super->myHeap)->s1)[i]; if (gUnk_080D1414[i] > ptr->unk0c) { if (gUnk_080D1414[i] == ++ptr->unk0c) { @@ -935,21 +953,21 @@ void sub_0804334C(Entity* this) { } if ((bVar1) && (i == 4)) { sub_08043BC8(this); - InitAnimationForceUpdate(this, 7); - if (this->field_0x7c.BYTES.byte2 != 0) { - this->field_0x7c.BYTES.byte2 = 0; - ((VaatiArm_HeapStruct*)this->myHeap)->parent->subAction = 2; + InitAnimationForceUpdate(super, 7); + if (this->unk_7e != 0) { + this->unk_7e = 0; + ((VaatiArm_HeapStruct*)super->myHeap)->parent->subAction = 2; } } } } -static void sub_08043420(Entity* this) { - gUnk_080D1320[this->subAction](this); +static void sub_08043420(VaatiArmEntity* this) { + gUnk_080D1320[super->subAction](this); sub_08043ABC(this); } -static void sub_08043440(Entity* this) { +static void sub_08043440(VaatiArmEntity* this) { u32 i; int iVar4; u8* ptr; @@ -961,7 +979,7 @@ static void sub_08043440(Entity* this) { zero = 0; offset = 0x18; do { - ptr = ((u8*)this->myHeap) + offset; + ptr = ((u8*)super->myHeap) + offset; if (ptr[5] >= 0x11) { ptr[5] -= 0x10; iVar4++; @@ -974,25 +992,25 @@ static void sub_08043440(Entity* this) { if (iVar4 == 0) { i = 0; do { - ((VaatiArm_HeapStruct*)this->myHeap)->s1[i].unk00.HWORD = 0x8000; + ((VaatiArm_HeapStruct*)super->myHeap)->s1[i].unk00.HWORD = 0x8000; i++; } while (i < 5); - this->subAction = 1; - InitAnimationForceUpdate(this, 0x10); + super->subAction = 1; + InitAnimationForceUpdate(super, 0x10); } } -static void sub_08043490(Entity* this) { +static void sub_08043490(VaatiArmEntity* this) { Entity* entity; Entity* entity2; Entity* entity3; - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base; if (entity->z.HALF.HI < -4) { entity->zVelocity = Q_16_16(1.5); - this->subAction = 2; - this->field_0x7c.BYTES.byte2 = 0; - ((VaatiArm_HeapStruct*)this->myHeap)->parent->subAction = 2; + super->subAction = 2; + this->unk_7e = 0; + ((VaatiArm_HeapStruct*)super->myHeap)->parent->subAction = 2; } else { entity->z.HALF.HI -= 2; if (entity->z.HALF.HI < 0) { @@ -1001,76 +1019,76 @@ static void sub_08043490(Entity* this) { entity->collisionFlags = entity->collisionFlags & 0xef; entity->hitType = 0x3a; entity->hitbox = (Hitbox*)&gUnk_080FD450; - entity2 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2]; + entity2 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base; entity2->flags = entity2->flags | ENT_COLLIDE; - entity3 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; + entity3 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base; entity3->flags = entity3->flags & ~ENT_COLLIDE; } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -static void sub_08043520(Entity* this) { +static void sub_08043520(VaatiArmEntity* this) { Entity* entity; - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base; GravityUpdate(entity, Q_8_8(26.0)); if ((entity->zVelocity < 0) && (-6 < entity->z.HALF.HI)) { entity->z.HALF.HI = -6; - this->subAction = 3; - this->field_0x7a.HWORD = 900; + super->subAction = 3; + this->unk_7a = 900; } } -static void sub_0804355C(Entity* this) { +static void sub_0804355C(VaatiArmEntity* this) { sub_08043DB0(this); - if (--this->field_0x7a.HWORD == 0) { - this->subAction = 4; + if (--this->unk_7a == 0) { + super->subAction = 4; } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -static void sub_08043580(Entity* this) { +static void sub_08043580(VaatiArmEntity* this) { Entity* entity; u32 i; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->z.HALF.HI += 3; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.z.HALF.HI += 3; for (i = 0; i < 5; i++) { - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base; if (-4 < entity->z.HALF.HI) { entity->flags = entity->flags & ~ENT_COLLIDE; entity->spriteSettings.draw = 0; } } - if ((this->spriteSettings.draw & 3) == 0) { - this->subAction = 5; - this->timer = 60; - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; + if ((super->spriteSettings.draw & 3) == 0) { + super->subAction = 5; + super->timer = 60; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base; entity->collisionFlags = entity->collisionFlags | 0x10; entity->hitType = 0x39; entity->hitbox = (Hitbox*)&gUnk_080FD538; - sub_0804AA1C(this); + sub_0804AA1C(super); } } -static void sub_080435F4(Entity* this) { +static void sub_080435F4(VaatiArmEntity* this) { Entity* entity; u32 i; VaatiArm_HeapStruct1* ptr; - if (--this->timer == 0) { - this->action = 6; - this->subAction = 1; - this->timer = 1; + if (--super->timer == 0) { + super->action = 6; + super->subAction = 1; + super->timer = 1; for (i = 0; i < 5; i++) { - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i]; - ptr->unk00.HWORD = gUnk_080D1338[this->type2]; + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i]; + ptr->unk00.HWORD = gUnk_080D1338[super->type2]; ptr->unk04.HWORD = 0x4000; ptr->unk0c = 0; - ptr->unk08 = gUnk_080D133C[this->type2]; - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; + ptr->unk08 = gUnk_080D133C[super->type2]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base; if (i == 0) { - sub_08043B9C(entity); + sub_08043B9C((VaatiArmEntity*)entity); } else { InitializeAnimation(entity, gUnk_080D1340[i]); } @@ -1078,70 +1096,70 @@ static void sub_080435F4(Entity* this) { } } -static void sub_08043680(Entity* this) { - gUnk_080D1348[this->subAction](this); +static void sub_08043680(VaatiArmEntity* this) { + gUnk_080D1348[super->subAction](this); } -static void sub_08043698(Entity* this) { +static void sub_08043698(VaatiArmEntity* this) { Entity* entity; u32 i; - this->subAction = 1; - this->timer = 60; + super->subAction = 1; + super->timer = 60; for (i = 0; i < 5; i++) { - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base; entity->flags = entity->flags & ~ENT_COLLIDE; } } -static inline void deleteThing(Entity* this, const u32 index) { - if (--this->timer == 0) { - this->timer = 20; - this->subAction = index + 1; +static inline void deleteThing(VaatiArmEntity* this, const u32 index) { + if (--super->timer == 0) { + super->timer = 20; + super->subAction = index + 1; if (index == 1) { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } - CreateFx(((VaatiArm_HeapStruct*)this->myHeap)->entities[index], FX_GIANT_EXPLOSION4, 0); - ((VaatiArm_HeapStruct*)this->myHeap)->entities[index]->myHeap = NULL; - DeleteEntity(((VaatiArm_HeapStruct*)this->myHeap)->entities[index]); + CreateFx(&((VaatiArm_HeapStruct*)super->myHeap)->entities[index]->base, FX_GIANT_EXPLOSION4, 0); + ((VaatiArm_HeapStruct*)super->myHeap)->entities[index]->base.myHeap = NULL; + DeleteEntity(&((VaatiArm_HeapStruct*)super->myHeap)->entities[index]->base); } } -static void sub_080436C0(Entity* this) { +static void sub_080436C0(VaatiArmEntity* this) { deleteThing(this, 1); } -static void sub_08043700(Entity* this) { +static void sub_08043700(VaatiArmEntity* this) { deleteThing(this, 2); } -static void sub_08043738(Entity* this) { +static void sub_08043738(VaatiArmEntity* this) { deleteThing(this, 3); } -static void sub_08043770(Entity* this) { +static void sub_08043770(VaatiArmEntity* this) { Entity* entity; - if (--this->timer == 0) { - entity = ((VaatiArm_HeapStruct*)this->myHeap)->parent; + if (--super->timer == 0) { + entity = ((VaatiArm_HeapStruct*)super->myHeap)->parent; if ((gRoomTransition.field_0x39 & 0xc) == 0) { entity->subAction = 2; } - if (this->type2 == 0) { + if (super->type2 == 0) { ((VaatiArm_HeapStruct*)entity->myHeap)->parent = NULL; gRoomTransition.field_0x39 &= 0xfe; } else { *(u32*)((VaatiArm_HeapStruct*)entity->myHeap)->s1 = 0; gRoomTransition.field_0x39 &= 0xfd; } - ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->myHeap = NULL; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->health = 0; - (*(Entity**)&this->field_0x68)->parent = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.myHeap = NULL; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.health = 0; + (*(Entity**)&this->unk_68)->parent = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base; DeleteThisEntity(); } } -static u32 sub_080437DC(Entity* this) { +static u32 sub_080437DC(VaatiArmEntity* this) { u16 temp; VaatiArm_HeapStruct* heapStruct; Entity* entity; @@ -1151,36 +1169,36 @@ static u32 sub_080437DC(Entity* this) { heapStruct = zMalloc(sizeof(VaatiArm_HeapStruct)); if (heapStruct == NULL) return 0; - this->spritePriority.b0 = 5; - this->collisionFlags = this->collisionFlags | 0x10; - this->myHeap = (u32*)heapStruct; + super->spritePriority.b0 = 5; + super->collisionFlags = super->collisionFlags | 0x10; + super->myHeap = (u32*)heapStruct; heapStruct->entities[0] = this; entity = CreateEnemy(VAATI_ARM, 1); entity->spritePriority.b0 = 5; entity->collisionFlags = entity->collisionFlags | 0x10; entity->myHeap = (u32*)heapStruct; - heapStruct->entities[1] = entity; - CopyPosition(this, entity); + heapStruct->entities[1] = (VaatiArmEntity*)entity; + CopyPosition(super, entity); entity = CreateEnemy(VAATI_ARM, 2); entity->spritePriority.b0 = 5; entity->collisionFlags = entity->collisionFlags | 0x10; entity->myHeap = (u32*)heapStruct; - heapStruct->entities[2] = entity; - CopyPosition(this, entity); + heapStruct->entities[2] = (VaatiArmEntity*)entity; + CopyPosition(super, entity); entity = CreateEnemy(VAATI_ARM, 3); entity->spritePriority.b0 = 5; entity->collisionFlags = entity->collisionFlags | 0x10; entity->myHeap = (u32*)heapStruct; - heapStruct->entities[3] = entity; - CopyPosition(this, entity); + heapStruct->entities[3] = (VaatiArmEntity*)entity; + CopyPosition(super, entity); entity = CreateEnemy(VAATI_ARM, 4); entity->spritePriority.b0 = 5; entity->collisionFlags = entity->collisionFlags | 0x10; entity->myHeap = (u32*)heapStruct; - heapStruct->entities[4] = entity; - CopyPosition(this, entity); - heapStruct->parent = this->parent; - temp = gUnk_080D135C[this->type2]; + heapStruct->entities[4] = (VaatiArmEntity*)entity; + CopyPosition(super, entity); + heapStruct->parent = super->parent; + temp = gUnk_080D135C[super->type2]; heapStruct->s1[0].unk00.HWORD = temp; heapStruct->s1[0].unk04.HWORD = 0x4000; heapStruct->s1[0].unk0c = 0; @@ -1199,78 +1217,78 @@ static u32 sub_080437DC(Entity* this) { return 1; } -void sub_0804393C(Entity* this) { +void sub_0804393C(VaatiArmEntity* this) { s32 uVar1; s32 uVar2; s32 uVar6; s32 iVar7; VaatiArm_HeapStruct1* hs; - Entity* entity; + VaatiArmEntity* entity; - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]; - if (entity->field_0x7c.BYTES.byte0 != 0 && entity->field_0x7c.BYTES.byte1 <= this->type) { - uVar2 = gUnk_080D1362[this->type * 16 + ((entity->field_0x7c.BYTES.byte0 >> 3) & 0xf)]; + entity = (VaatiArmEntity*)((VaatiArm_HeapStruct*)super->myHeap)->entities[0]; + if (entity->unk_7c != 0 && entity->unk_7d <= super->type) { + uVar2 = gUnk_080D1362[super->type * 16 + ((entity->unk_7c >> 3) & 0xf)]; } else { uVar2 = 0; } - hs = &((VaatiArm_HeapStruct*)this->myHeap)->s1[this->type]; + hs = &((VaatiArm_HeapStruct*)super->myHeap)->s1[super->type]; uVar2 = (uVar2 + hs->unk0c) << 8; uVar1 = -gSineTable[hs->unk04.HALF.HI + 0x40] * uVar2; uVar2 = (gSineTable[hs->unk04.HALF.HI & 0x7f] * uVar2) / 0x100; uVar6 = gSineTable[hs->unk00.HALF.HI] * uVar2; iVar7 = -gSineTable[hs->unk00.HALF.HI + 0x40] * uVar2; - PositionRelative(((VaatiArm_HeapStruct*)this->myHeap)->entities[this->type + 1], this, uVar6, iVar7); - this->z.WORD += uVar1; - this->spriteOffsetY = ((VaatiArm_HeapStruct*)this->myHeap)->entities[this->type + 1]->spriteOffsetY; + PositionRelative(&((VaatiArm_HeapStruct*)super->myHeap)->entities[super->type + 1]->base, super, uVar6, iVar7); + super->z.WORD += uVar1; + super->spriteOffsetY = ((VaatiArm_HeapStruct*)super->myHeap)->entities[super->type + 1]->base.spriteOffsetY; } -static void sub_08043A10(Entity* this) { +static void sub_08043A10(VaatiArmEntity* this) { sub_08043B7C(this); - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[4]); - ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->y.HALF.HI -= 8; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]->z.HALF.HI -= 8; - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[3]); - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[2]); - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[1]); - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[0]); - ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->y.HALF.HI++; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spriteOffsetY--; - if (this->field_0x7c.BYTES.byte0 != 0) { - this->field_0x7c.BYTES.byte0--; + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[4]); + ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.y.HALF.HI -= 8; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.z.HALF.HI -= 8; + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[3]); + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[2]); + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[1]); + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[0]); + ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.y.HALF.HI++; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.spriteOffsetY--; + if (this->unk_7c != 0) { + this->unk_7c--; } } -static void sub_08043A78(Entity* this) { - this->field_0x7c.BYTES.byte0 = 0; +static void sub_08043A78(VaatiArmEntity* this) { + this->unk_7c = 0; sub_08043B7C(this); - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[2]); - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[1]); - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[0]); - ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->y.HALF.HI++; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spriteOffsetY--; + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[2]); + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[1]); + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[0]); + ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.y.HALF.HI++; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.spriteOffsetY--; } -static void sub_08043ABC(Entity* this) { - this->field_0x7c.BYTES.byte0 = 0; +static void sub_08043ABC(VaatiArmEntity* this) { + this->unk_7c = 0; sub_08043B7C(this); - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[3]); - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[2]); - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[1]); - sub_0804393C(((VaatiArm_HeapStruct*)this->myHeap)->entities[0]); - ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->y.HALF.HI++; - ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->spriteOffsetY--; + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[3]); + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[2]); + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[1]); + sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[0]); + ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.y.HALF.HI++; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.spriteOffsetY--; } -void sub_08043B08(Entity* this) { +void sub_08043B08(VaatiArmEntity* this) { VaatiArm_HeapStruct1* hs1; VaatiArm_HeapStruct1* hs2; u32 bVar1; s32 uVar6; - hs1 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[this->type - 1]; - hs2 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[this->type]; - bVar1 = gUnk_080D13B2[this->type]; - if (((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 == 0) { + hs1 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[super->type - 1]; + hs2 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[super->type]; + bVar1 = gUnk_080D13B2[super->type]; + if (((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.type2 == 0) { uVar6 = (s8)((hs1->unk00.HALF.HI - hs2->unk00.HALF.HI)); if (bVar1 < uVar6) { if (uVar6 <= 0) { @@ -1300,39 +1318,39 @@ void sub_08043B08(Entity* this) { } } -static void sub_08043B7C(Entity* this) { - sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[1]); - sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[2]); - sub_08043B08(((VaatiArm_HeapStruct*)this->myHeap)->entities[3]); +static void sub_08043B7C(VaatiArmEntity* this) { + sub_08043B08(((VaatiArm_HeapStruct*)super->myHeap)->entities[1]); + sub_08043B08(((VaatiArm_HeapStruct*)super->myHeap)->entities[2]); + sub_08043B08(((VaatiArm_HeapStruct*)super->myHeap)->entities[3]); } -static void sub_08043B9C(Entity* this) { - u32 index = ((((VaatiArm_HeapStruct*)this->myHeap)->s1[0].unk00.HALF.HI + 4) & 0xff) >> 3; - if (gUnk_080D13B7[index] != this->frameIndex - 1) { - InitAnimationForceUpdate(this, gUnk_080D13B7[index]); +static void sub_08043B9C(VaatiArmEntity* this) { + u32 index = ((((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk00.HALF.HI + 4) & 0xff) >> 3; + if (gUnk_080D13B7[index] != super->frameIndex - 1) { + InitAnimationForceUpdate(super, gUnk_080D13B7[index]); } } -static void sub_08043BC8(Entity* this) { +static void sub_08043BC8(VaatiArmEntity* this) { VaatiArm_HeapStruct1* pVVar2; const Coords* ptr; - this->action = 2; - ptr = &gUnk_080D13D8[this->type2]; - pVVar2 = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; + super->action = 2; + ptr = &gUnk_080D13D8[super->type2]; + pVVar2 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; pVVar2->unk08 = ptr->HALF.x; pVVar2->unk0a = ptr->HALF.y; pVVar2->unk0d = 0x5a; pVVar2->unk0e = 0x28; } -static void sub_08043BF0(Entity* this) { +static void sub_08043BF0(VaatiArmEntity* this) { u8 bVar1; u32 uVar2; VaatiArm_HeapStruct1* ptr; - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[0]; - if (this->type2 == 0) { + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0]; + if (super->type2 == 0) { bVar1 = ptr->unk00.HALF.HI; uVar2 = 6; if (((0x2f < bVar1) && (uVar2 = 7, 0x5f < bVar1)) && (uVar2 = 9, bVar1 < 0x90)) { @@ -1345,12 +1363,12 @@ static void sub_08043BF0(Entity* this) { uVar2 = 6; } } - if (this->animIndex != uVar2) { - InitAnimationForceUpdate(this, uVar2); + if (super->animIndex != uVar2) { + InitAnimationForceUpdate(super, uVar2); } } -static void sub_08043C40(Entity* this, VaatiArm_HeapStruct1* heapStruct) { +static void sub_08043C40(VaatiArmEntity* this, VaatiArm_HeapStruct1* heapStruct) { u8* iVar3; int offset; const u8* puVar6; @@ -1370,7 +1388,7 @@ static void sub_08043C40(Entity* this, VaatiArm_HeapStruct1* heapStruct) { } } for (i = 0, offset = 0x28; i < 3; offset += 0x10, i++) { - iVar3 = (u8*)(int)((VaatiArm_HeapStruct*)this->myHeap) + offset; + iVar3 = (u8*)(int)((VaatiArm_HeapStruct*)super->myHeap) + offset; if (puVar6[i] != iVar3[0xc]) { if (puVar6[i] < iVar3[0xc]) { iVar3[0xc]--; @@ -1381,84 +1399,84 @@ static void sub_08043C40(Entity* this, VaatiArm_HeapStruct1* heapStruct) { } } -static u32 sub_08043C98(Entity* this) { +static bool32 sub_08043C98(VaatiArmEntity* this) { #if defined EU || defined JP - Entity* e1 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; + Entity* e1 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base; if ((e1->contactFlags == 0x9d)) { sub_08043D08(this); - return 1; + return TRUE; } else { - return 0; + return FALSE; } #else - Entity* e1 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2]; - Entity* e2 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; + Entity* e1 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base; + Entity* e2 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base; if ((e1->contactFlags == 0x9d) || (e2->contactFlags == 0x9d)) { sub_08043D08(this); gRoomTransition.field_0x38 |= 2; - return 1; + return TRUE; } else { - return 0; + return FALSE; } #endif } -static void sub_08043CD4(Entity* this) { +static void sub_08043CD4(VaatiArmEntity* this) { u32 i; for (i = 0; i < 5; i++) { - if (((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->contactFlags == 0x9d) { - this->field_0x7c.BYTES.byte0 = 0x78; - this->field_0x7c.BYTES.byte1 = i; + if (((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.contactFlags == 0x9d) { + this->unk_7c = 0x78; + this->unk_7d = i; return; } } } -static void sub_08043D08(Entity* this) { +static void sub_08043D08(VaatiArmEntity* this) { Entity* entity; Entity* fx; u32 i; - this->action = 7; - this->subAction = 0; - InitAnimationForceUpdate(this, 0xd); - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; + super->action = 7; + super->subAction = 0; + InitAnimationForceUpdate(super, 0xd); + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base; entity->flags &= ~ENT_COLLIDE; entity->spriteSettings.draw = 0; InitializeAnimation(entity, 0x13); sub_0804AA1C(entity); fx = CreateFx(entity, FX_GIANT_EXPLOSION4, 0); if (fx != NULL) { - fx->x.HALF.HI += gUnk_080D13E9[this->type2]; + fx->x.HALF.HI += gUnk_080D13E9[super->type2]; fx->y.HALF.HI -= 6; fx->spritePriority.b0 = 3; } - CopyPosition(((VaatiArm_HeapStruct*)this->myHeap)->entities[3], entity); - entity->z.HALF.HI += ((VaatiArm_HeapStruct*)this->myHeap)->s1[3].unk0c; + CopyPosition(&((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base, entity); + entity->z.HALF.HI += ((VaatiArm_HeapStruct*)super->myHeap)->s1[3].unk0c; for (i = 0; i < 5; i++) { - ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]->hitType = 0x39; + ((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.hitType = 0x39; } EnqueueSFX(SFX_HIT); } -static void sub_08043DB0(Entity* this) { +static void sub_08043DB0(VaatiArmEntity* this) { s32 cVar1; Entity* pEVar2; Entity* pEVar3; Entity* pEVar4; if (((gPlayerState.flags & PL_MINISH) != 0)) { - pEVar3 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; + pEVar3 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base; if (CheckPlayerInRegion(pEVar3->x.HALF.HI - gRoomControls.origin_x, pEVar3->y.HALF.HI - gRoomControls.origin_y + 2, 3, 3)) { DoExitTransition(&gUnk_080D13EC); if ((gRoomTransition.field_0x39 & 3) != 3) { gRoomTransition.player_status.room_next = 1; } - cVar1 = this->field_0x7a.HWORD; + cVar1 = this->unk_7a; gRoomTransition.field_0x3d = 0x1e - (cVar1 / 0x3c); - gRoomTransition.field_0x3c = this->type2; - pEVar2 = ((VaatiArm_HeapStruct*)this->myHeap)->parent; + gRoomTransition.field_0x3c = super->type2; + pEVar2 = ((VaatiArm_HeapStruct*)super->myHeap)->parent; gRoomTransition.field_0x40 = pEVar2->x.HALF.HI; gRoomTransition.field_0x42 = pEVar2->y.HALF.HI; pEVar4 = ((VaatiArm_HeapStruct*)pEVar2->myHeap)->parent; @@ -1481,90 +1499,91 @@ static void sub_08043DB0(Entity* this) { } } -static void sub_08043EB8(Entity* this) { +static void sub_08043EB8(VaatiArmEntity* this) { u32 i; Entity* pEVar4; VaatiArm_HeapStruct1* ptr; - COLLISION_ON(this); - this->spritePriority.b0 = 4; - InitAnimationForceUpdate(this, 0xd); - pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[1]; + COLLISION_ON(super); + super->spritePriority.b0 = 4; + InitAnimationForceUpdate(super, 0xd); + pEVar4 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base; pEVar4->flags = pEVar4->flags | ENT_COLLIDE; pEVar4->spritePriority.b0 = 4; - pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[2]; + pEVar4 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base; pEVar4->flags = pEVar4->flags | ENT_COLLIDE; pEVar4->spritePriority.b0 = 4; - pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; + pEVar4 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base; pEVar4->flags = pEVar4->flags & ~ENT_COLLIDE; pEVar4->spriteSettings.draw = 1; pEVar4->spritePriority.b0 = 4; - pEVar4 = ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]; + pEVar4 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base; pEVar4->flags = pEVar4->flags | ENT_COLLIDE; pEVar4->spriteSettings.draw = 1; pEVar4->spritePriority.b0 = 4; - pEVar4->x.HALF.HI = (this->type2 == 0) ? gRoomTransition.field_0x44 : gRoomTransition.field_0x48; - pEVar4->y.HALF.HI = (this->type2 == 0) ? gRoomTransition.field_0x46 : gRoomTransition.field_0x4a; + pEVar4->x.HALF.HI = (super->type2 == 0) ? gRoomTransition.field_0x44 : gRoomTransition.field_0x48; + pEVar4->y.HALF.HI = (super->type2 == 0) ? gRoomTransition.field_0x46 : gRoomTransition.field_0x4a; pEVar4->z.HALF.HI = 0; pEVar4->collisionFlags = pEVar4->collisionFlags & 0xef; pEVar4->hitType = 0x3a; pEVar4->hitbox = (Hitbox*)&gUnk_080FD450; pEVar4 = CreateObject(VAATI3_ARM, 0, 0); if (pEVar4 != NULL) { - pEVar4->parent = ((VaatiArm_HeapStruct*)this->myHeap)->entities[3]; + pEVar4->parent = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base; } - *(Entity**)&((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->field_0x68 = pEVar4; + *(Entity**)&((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->unk_68 = pEVar4; for (i = 0; i < 5; i++) { - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i]; + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i]; ptr->unk00.HWORD = 0x8000; ptr->unk04.HWORD = 0; ptr->unk0c = gUnk_080D1419[i]; } } -void sub_08044000(Entity* this) { +void sub_08044000(VaatiArmEntity* this) { Entity* entity; u32 i; VaatiArm_HeapStruct1* ptr; const u16* ptr2; - ptr2 = gUnk_080D1400[this->type2]; + ptr2 = gUnk_080D1400[super->type2]; for (i = 0; i < 5; i++) { - entity = ((VaatiArm_HeapStruct*)this->myHeap)->entities[i]; + entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base; entity->flags = entity->flags | 0x80; entity->spritePriority.b0 = 4; - ptr = &((VaatiArm_HeapStruct*)this->myHeap)->s1[i]; + ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i]; ptr->unk00.HWORD = ptr2[i]; ptr->unk04.HWORD = 0x4000; ptr->unk0c = gUnk_080D1414[i]; } - InitAnimationForceUpdate(this, 7); - CopyPosition(((VaatiArm_HeapStruct*)this->myHeap)->parent, ((VaatiArm_HeapStruct*)this->myHeap)->entities[4]); + InitAnimationForceUpdate(super, 7); + CopyPosition(((VaatiArm_HeapStruct*)super->myHeap)->parent, + &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base); } -static void sub_08044078(Entity* this) { - if (this->action == 0) { - this->action = 1; - if (this->type != 3 || +static void sub_08044078(VaatiArmEntity* this) { + if (super->action == 0) { + super->action = 1; + if (super->type != 3 || !(((gRoomTransition.field_0x38 & 1) == 0 || - (((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 != gRoomTransition.field_0x3c)))) { - InitializeAnimation(this, 0x12); + (((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.type2 != gRoomTransition.field_0x3c)))) { + InitializeAnimation(super, 0x12); } else { - InitializeAnimation(this, 0x11); + InitializeAnimation(super, 0x11); } } - GetNextFrame(this); + GetNextFrame(super); } -static void sub_080440CC(Entity* this) { - if (this->action == 0) { - this->action = 1; +static void sub_080440CC(VaatiArmEntity* this) { + if (super->action == 0) { + super->action = 1; if ((gRoomTransition.field_0x38 & 1) != 0 && - ((VaatiArm_HeapStruct*)this->myHeap)->entities[0]->type2 == gRoomTransition.field_0x3c) { - InitializeAnimation(this, 0x13); + ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.type2 == gRoomTransition.field_0x3c) { + InitializeAnimation(super, 0x13); } else { - InitializeAnimation(this, 0x11); + InitializeAnimation(super, 0x11); } } - GetNextFrame(this); + GetNextFrame(super); } diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index 7b174bc6..0378c546 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -4,416 +4,431 @@ * * @brief Vaati Ball enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" #include "object.h" #include "player.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u8 unk_74; + /*0x75*/ u8 unused2[2]; + /*0x77*/ u8 unk_77; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; + /*0x7a*/ u8 unused3[2]; + /*0x7c*/ u32 unk_7c; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unused4[2]; + /*0x83*/ u8 unk_83; + /*0x84*/ u8 unk_84; + /*0x85*/ u8 unused5[1]; + /*0x86*/ u8 unk_86; +} VaatiBallEntity; + typedef struct { s8 h, v; } PACKED PosOffset; -void sub_0804468C(Entity*); -void sub_080447E0(Entity*); -void sub_08044868(Entity*); -void sub_0804474C(Entity*); -void sub_080449F8(Entity*); -void sub_08044B04(Entity*); +void sub_0804468C(VaatiBallEntity*); +void sub_080447E0(VaatiBallEntity*); +void sub_08044868(VaatiBallEntity*); +void sub_0804474C(VaatiBallEntity*); +void sub_080449F8(VaatiBallEntity*); +void sub_08044B04(VaatiBallEntity*); +void sub_08044DEC(VaatiBallEntity*); -extern void sub_08044E74(Entity*, u32); +extern void sub_08044E74(VaatiBallEntity*, u32); -void VaatiBall(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void VaatiBall(VaatiBallEntity* this) { + static void (*const actionFuncs[])(VaatiBallEntity*) = { sub_0804468C, sub_0804474C, sub_080447E0, sub_08044868, sub_0804474C, sub_080449F8, sub_08044B04, }; - Entity* parent; - - parent = this->parent; - if (this->action && this->action != 3) { - this->x.WORD += parent->x.WORD - *(int*)&parent->field_0x78; - this->y.WORD += parent->y.WORD - parent->field_0x7c.WORD; + Entity* parent = super->parent; + if (super->action && super->action != 3) { + super->x.WORD += parent->x.WORD - *(int*)&((VaatiBallEntity*)parent)->unk_78; + super->y.WORD += parent->y.WORD - ((VaatiBallEntity*)parent)->unk_7c; } - actionFuncs[this->action](this); + actionFuncs[super->action](this); - if (this->cutsceneBeh.HALF.LO) { - this->health = -1; + if (this->unk_84) { + super->health = -1; } - if (this->contactFlags & 0x80) { - if ((this->contactFlags & 0x3f) == 0 && this->action == 6) { + if (super->contactFlags & 0x80) { + if ((super->contactFlags & 0x3f) == 0 && super->action == 6) { ModHealth(-2); } #ifdef EU - if (this->health < 0xfa) { + if (super->health < 0xfa) { #else - if (this->health < 0xfd) { + if (super->health < 0xfd) { #endif - this->spriteSettings.draw = 0; - COLLISION_OFF(this); - this->health = -1; - parent->field_0x80.HALF.LO--; - CreateDust(this); + super->spriteSettings.draw = 0; + COLLISION_OFF(super); + super->health = -1; + ((VaatiBallEntity*)parent)->unk_80--; + CreateDust(super); SoundReq(SFX_1C3); } } } -void sub_0804468C(Entity* this) { +void sub_0804468C(VaatiBallEntity* this) { const PosOffset* off; static const PosOffset gUnk_080D1620[4] = { { -48, 0 }, { 0, -48 }, { 48, 0 }, { 0, 48 } }; - this->collisionLayer = 3; - this->spriteRendering.b3 = 2; - this->spritePriority.b0 = 5; - this->cutsceneBeh.HALF.LO = 0; - switch (this->type) { + super->collisionLayer = 3; + super->spriteRendering.b3 = 2; + super->spritePriority.b0 = 5; + this->unk_84 = 0; + switch (super->type) { case 0: - this->action = 1; - this->timer = 1; - this->direction = (this->field_0x78.HALF.HI * 8) & (0x3 | DirectionNorthWest); - this->field_0x78.HALF.LO = 0; - this->field_0x82.HALF.HI = 0; - this->spriteSettings.draw = 0; - off = &gUnk_080D1620[this->field_0x78.HALF.HI & 3]; - PositionRelative(this->parent, this, Q_16_16(off->h), Q_16_16(off->v - 0x10)); - this->z.HALF.HI = this->parent->z.HALF.HI; - InitAnimationForceUpdate(this, 0); + super->action = 1; + super->timer = 1; + super->direction = (this->unk_79 * 8) & (0x3 | DirectionNorthWest); + this->unk_78 = 0; + this->unk_83 = 0; + super->spriteSettings.draw = 0; + off = &gUnk_080D1620[this->unk_79 & 3]; + PositionRelative(super->parent, super, Q_16_16(off->h), Q_16_16(off->v - 0x10)); + super->z.HALF.HI = super->parent->z.HALF.HI; + InitAnimationForceUpdate(super, 0); break; case 1: - this->action = 3; - this->field_0x74.HALF.LO = 0; - this->field_0x82.HALF.HI = 1; - this->spriteSettings.draw = 1; - InitAnimationForceUpdate(this, 1); + super->action = 3; + this->unk_74 = 0; + this->unk_83 = 1; + super->spriteSettings.draw = 1; + InitAnimationForceUpdate(super, 1); break; } } -void sub_0804474C(Entity* this) { - switch (this->parent->action) { +void sub_0804474C(VaatiBallEntity* this) { + switch (super->parent->action) { case 3: - this->action = 3; - this->field_0x74.HALF.LO = 0; - this->timer = 0; + super->action = 3; + this->unk_74 = 0; + super->timer = 0; break; case 5: - this->action = 5; - this->field_0x74.HALF.LO = 0; - this->subtimer = 1; + super->action = 5; + this->unk_74 = 0; + super->subtimer = 1; break; case 6: - this->action = 6; - this->field_0x74.HALF.LO = 0; - this->subtimer = 32; + super->action = 6; + this->unk_74 = 0; + super->subtimer = 32; break; case 2: - this->action = 2; - this->field_0x74.HALF.LO = 0; - this->hitType = 0; + super->action = 2; + this->unk_74 = 0; + super->hitType = 0; break; } - if (this->action != 1) { - UpdateAnimationSingleFrame(this); + if (super->action != 1) { + UpdateAnimationSingleFrame(super); } else { - if (--this->timer == 0) { - this->timer = 2; - this->direction++; - this->direction &= 0x3 | DirectionNorthWest; + if (--super->timer == 0) { + super->timer = 2; + super->direction++; + super->direction &= 0x3 | DirectionNorthWest; } - LinearMoveUpdate(this); - UpdateAnimationSingleFrame(this); + LinearMoveUpdate(super); + UpdateAnimationSingleFrame(super); } } -void sub_080447E0(Entity* this) { - Entity* vaati = this->parent; +void sub_080447E0(VaatiBallEntity* this) { + VaatiBallEntity* vaati = (VaatiBallEntity*)super->parent; - if (vaati->action == 1) { - this->action = 1; - this->hitType = 43; + if (vaati->base.action == 1) { + super->action = 1; + super->hitType = 43; sub_08044E74(this, 0); - if (this->flags & ENT_COLLIDE) - this->spriteSettings.draw = 1; + if (super->flags & ENT_COLLIDE) + super->spriteSettings.draw = 1; } else { - this->field_0x76.HALF.HI++; - this->field_0x76.HALF.HI &= 7; - if (this->flags & ENT_COLLIDE) { - if (this->field_0x76.HALF.HI & 1) { - this->spriteSettings.draw = 1; + this->unk_77++; + this->unk_77 &= 7; + if (super->flags & ENT_COLLIDE) { + if (this->unk_77 & 1) { + super->spriteSettings.draw = 1; } else { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } } - if (vaati->field_0x74.HALF.LO == 2) { + if (vaati->unk_74 == 2) { sub_08044E74(this, 2); } } } -extern void sub_08044DEC(Entity*); +void sub_08044868(VaatiBallEntity* this) { + VaatiBallEntity* vaati = (VaatiBallEntity*)super->parent; -void sub_08044868(Entity* this) { - Entity* vaati = this->parent; - - switch (vaati->field_0x74.HALF.LO) { + switch (vaati->unk_74) { case 0xfe: - if (this->field_0x82.HALF.HI && this->field_0x74.HALF.LO == 2) + if (this->unk_83 && this->unk_74 == 2) DeleteThisEntity(); break; case 0xff: - if (this->field_0x82.HALF.HI) { - switch (this->field_0x74.HALF.LO) { + if (this->unk_83) { + switch (this->unk_74) { case 0: - if (this->frame & ANIM_DONE) { - this->field_0x74.HALF.LO = 1; - this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10); - this->speed = 0x180; + if (super->frame & ANIM_DONE) { + this->unk_74 = 1; + super->direction = sub_080045B4(super, vaati->base.x.HALF.HI, vaati->base.y.HALF.HI - 0x10); + super->speed = 0x180; } break; case 1: - LinearMoveUpdate(this); - if (EntityWithinDistance(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) { - this->field_0x74.HALF.LO++; - this->x.HALF.HI = vaati->x.HALF.HI; - this->y.HALF.HI = vaati->y.HALF.HI - 0x10; - vaati->timer++; + LinearMoveUpdate(super); + if (EntityWithinDistance(super, vaati->base.x.HALF.HI, vaati->base.y.HALF.HI - 0x10, 0xc)) { + this->unk_74++; + super->x.HALF.HI = vaati->base.x.HALF.HI; + super->y.HALF.HI = vaati->base.y.HALF.HI - 0x10; + vaati->base.timer++; } else { - this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10); + super->direction = sub_080045B4(super, vaati->base.x.HALF.HI, vaati->base.y.HALF.HI - 0x10); } break; } } break; case 1: - if (this->field_0x82.HALF.HI == 0) { - this->field_0x82.HALF.HI++; - this->spriteSettings.draw = 1; + if (this->unk_83 == 0) { + this->unk_83++; + super->spriteSettings.draw = 1; } sub_08044DEC(this); - if (*(u8*)&vaati->field_0x86 > 1) { - u8 draw = this->spriteSettings.draw; - if (draw == 1 && this->cutsceneBeh.HALF.LO == 0) { - vaati = CreateProjectileWithParent(this, V1_DARK_MAGIC_PROJECTILE, 0); + if (vaati->unk_86 > 1) { + u8 draw = super->spriteSettings.draw; + if (draw == 1 && this->unk_84 == 0) { + vaati = (VaatiBallEntity*)CreateProjectileWithParent(super, V1_DARK_MAGIC_PROJECTILE, 0); if (vaati) { - vaati->type2 = 1; - vaati->parent = this; - this->cutsceneBeh.HALF.LO = 1; - this->hitType = 0; + vaati->base.type2 = 1; + vaati->base.parent = super; + this->unk_84 = 1; + super->hitType = 0; } } } - this->timer = 32; + super->timer = 32; break; case 2: - if (this->timer) - if (--this->timer < 0x11) - LinearMoveUpdate(this); + if (super->timer) + if (--super->timer < 0x11) + LinearMoveUpdate(super); break; case 3: { u8 draw; sub_08044E74(this, 1); - draw = this->spriteSettings.draw; + draw = super->spriteSettings.draw; if (draw == 1) { - COLLISION_ON(this); + COLLISION_ON(super); } else { - COLLISION_OFF(this); + COLLISION_OFF(super); } break; } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void sub_080449F8(Entity* this) { - Entity* vaati = this->parent; +void sub_080449F8(VaatiBallEntity* this) { + VaatiBallEntity* vaati = (VaatiBallEntity*)super->parent; - UpdateAnimationSingleFrame(this); - if (vaati->action == 1) { + UpdateAnimationSingleFrame(super); + if (vaati->base.action == 1) { sub_08044E74(this, 0); return; } - switch (vaati->field_0x74.HALF.LO) { + switch (vaati->unk_74) { case 0: - LinearMoveUpdate(this); - if (--this->timer) + LinearMoveUpdate(super); + if (--super->timer) break; - if (this->field_0x78.HALF.LO == 0) { - this->field_0x78.HALF.LO++; - this->speed = 640; + if (this->unk_78 == 0) { + this->unk_78++; + super->speed = 640; } - this->timer = 4; - this->direction++; - this->direction &= 0x3 | DirectionNorthWest; - if (vaati->field_0x80.HALF.LO == 0) - vaati->field_0x74.HALF.LO = 1; + super->timer = 4; + super->direction++; + super->direction &= 0x3 | DirectionNorthWest; + if (vaati->unk_80 == 0) + vaati->unk_74 = 1; break; case 1: - switch (this->timer) { + switch (super->timer) { case 2: - if (vaati->field_0x80.HALF.LO == 0) { - this->subtimer = 0; + if (vaati->unk_80 == 0) { + super->subtimer = 0; sub_08044E74(this, 0); } break; case 1: - this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); - LinearMoveUpdate(this); - this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); - this->timer = 2; + super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest); + LinearMoveUpdate(super); + super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest); + super->timer = 2; break; case 3: - LinearMoveUpdate(this); - this->timer = 2; + LinearMoveUpdate(super); + super->timer = 2; break; case 4: - LinearMoveUpdate(this); - LinearMoveUpdate(this); - this->timer = 2; + LinearMoveUpdate(super); + LinearMoveUpdate(super); + super->timer = 2; break; } break; case 2: - if (this->field_0x74.HALF.LO == 0) { + if (this->unk_74 == 0) { u8 draw; - this->field_0x74.HALF.LO++; - draw = this->spriteSettings.draw; + this->unk_74++; + draw = super->spriteSettings.draw; if (draw) { - vaati = CreateProjectileWithParent(this, V1_EYE_LASER, 0); + vaati = (VaatiBallEntity*)CreateProjectileWithParent(super, V1_EYE_LASER, 0); if (vaati) { - vaati->y.HALF.HI += 4; - vaati->parent = this; - this->child = vaati; + vaati->base.y.HALF.HI += 4; + vaati->base.parent = super; + super->child = &vaati->base; } } } break; case 3: - if (this->subtimer) { - this->subtimer = 0; + if (super->subtimer) { + super->subtimer = 0; } break; } } -void sub_08044B04(Entity* this) { - Entity* vaati = this->parent; +void sub_08044B04(VaatiBallEntity* this) { + Entity* vaati = super->parent; - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); if (vaati->action == 1) { sub_08044E74(this, 0); - this->timer = 32; + super->timer = 32; return; } - switch (vaati->field_0x74.HALF.LO) { + switch (((VaatiBallEntity*)vaati)->unk_74) { case 0: - LinearMoveUpdate(this); - switch (this->field_0x74.HALF.LO) { + LinearMoveUpdate(super); + switch (this->unk_74) { case 0: - if (--this->timer == 0) { - this->timer = this->field_0x78.HALF.LO ? 4 : 2; - this->direction++; - this->direction &= 0x3 | DirectionNorthWest; + if (--super->timer == 0) { + super->timer = this->unk_78 ? 4 : 2; + super->direction++; + super->direction &= 0x3 | DirectionNorthWest; } - if (--this->subtimer == 0) { - if (this->timer != 2) { - this->subtimer = 1; + if (--super->subtimer == 0) { + if (super->timer != 2) { + super->subtimer = 1; } else { - if (++this->field_0x78.HALF.LO > 2) { - this->field_0x74.HALF.LO++; - this->field_0x78.HALF.LO = 1; - this->timer = 4; - this->subtimer = 0; + if (++this->unk_78 > 2) { + this->unk_74++; + this->unk_78 = 1; + super->timer = 4; + super->subtimer = 0; } else { - this->subtimer = 32; + super->subtimer = 32; } - this->speed = this->field_0x78.HALF.LO ? 640 : 1280; + super->speed = this->unk_78 ? 640 : 1280; } } break; case 1: - if (--this->timer == 0) { - this->timer = 6; - this->direction = (this->direction + 1) & (0x3 | DirectionNorthWest); - if (++this->subtimer == 0x30) { - u32 direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10); - this->speed = 0; - this->direction = (direction + 16) & (0x3 | DirectionNorthWest); - this->timer = 16; - this->subtimer = 16; - this->field_0x74.HALF.LO++; + if (--super->timer == 0) { + super->timer = 6; + super->direction = (super->direction + 1) & (0x3 | DirectionNorthWest); + if (++super->subtimer == 0x30) { + u32 direction = sub_080045B4(super, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10); + super->speed = 0; + super->direction = (direction + 16) & (0x3 | DirectionNorthWest); + super->timer = 16; + super->subtimer = 16; + this->unk_74++; } } break; case 2: - if (this->subtimer == 0) { - switch (--this->timer) { + if (super->subtimer == 0) { + switch (--super->timer) { case 12: - this->speed = 1280; + super->speed = 1280; break; case 0: - this->field_0x74.HALF.LO++; - this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10); - this->speed = 0; - this->timer = 4; - this->subtimer = 16; + this->unk_74++; + super->direction = sub_080045B4(super, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10); + super->speed = 0; + super->timer = 4; + super->subtimer = 16; break; case 4: - this->speed = 640; + super->speed = 640; break; } } else { - if (--this->subtimer == 0) - this->speed = 640; + if (--super->subtimer == 0) + super->speed = 640; } break; case 3: - if (this->subtimer) { - if (--this->subtimer == 0) - this->speed = 640; + if (super->subtimer) { + if (--super->subtimer == 0) + super->speed = 640; } else { - if (this->timer) { - if (--this->timer == 0) { - this->speed = 1280; + if (super->timer) { + if (--super->timer == 0) { + super->speed = 1280; SoundReq(SFX_14F); } } - if (this->field_0x78.HALF.HI == 3) - if (EntityWithinDistance(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) + if (this->unk_79 == 3) + if (EntityWithinDistance(super, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10, 0xc)) vaati->timer++; - this->direction = sub_080045B4(this, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10); + super->direction = sub_080045B4(super, vaati->x.HALF.HI, vaati->y.HALF.HI - 0x10); return; } break; } break; case 1: - switch (this->field_0x74.HALF.LO) { + switch (this->unk_74) { case 3: - this->field_0x74.HALF.LO = 1; - this->timer = 80; - COLLISION_OFF(this); - PositionRelative(vaati, this, 0, Q_16_16(-16.0)); - if (this->subtimer) - this->spriteSettings.draw = 0; + this->unk_74 = 1; + super->timer = 80; + COLLISION_OFF(super); + PositionRelative(vaati, super, 0, Q_16_16(-16.0)); + if (super->subtimer) + super->spriteSettings.draw = 0; break; case 1: - if (--this->timer == 0) { - this->field_0x74.HALF.LO = 0; - this->timer = 32; - this->subtimer = 4; + if (--super->timer == 0) { + this->unk_74 = 0; + super->timer = 32; + super->subtimer = 4; } break; } @@ -422,30 +437,30 @@ void sub_08044B04(Entity* this) { /* ... */ break; case 3: - switch (this->field_0x74.HALF.LO) { + switch (this->unk_74) { case 0: - if (this->subtimer) { - if (--this->subtimer == 0) { + if (super->subtimer) { + if (--super->subtimer == 0) { sub_08044DEC(this); - this->field_0x74.HALF.LO = 1; - this->timer = 16; + this->unk_74 = 1; + super->timer = 16; } } break; case 1: - LinearMoveUpdate(this); - if (--this->timer == 0) - this->field_0x74.HALF.LO++; + LinearMoveUpdate(super); + if (--super->timer == 0) + this->unk_74++; break; case 2: { u8 draw; sub_08044E74(this, 1); - draw = this->spriteSettings.draw; + draw = super->spriteSettings.draw; if (draw == 1) { - COLLISION_ON(this); + COLLISION_ON(super); } else { - COLLISION_OFF(this); + COLLISION_OFF(super); } vaati->timer++; break; @@ -455,7 +470,7 @@ void sub_08044B04(Entity* this) { } } -void sub_08044DEC(Entity* this) { +void sub_08044DEC(VaatiBallEntity* this) { u32 off; static const u8 gUnk_080D1628[4][4] = { { 16, 24, 0, 8 }, @@ -464,62 +479,62 @@ void sub_08044DEC(Entity* this) { { 16, 24, 0, 8 }, }; - if (this->parent->field_0x80.HALF.LO > this->field_0x78.HALF.HI) { - this->spriteSettings.draw = 1; - this->health = -1; + if (((VaatiBallEntity*)super->parent)->unk_80 > this->unk_79) { + super->spriteSettings.draw = 1; + super->health = -1; } else { - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } - COLLISION_OFF(this); - this->field_0x78.HALF.LO = 0; - this->speed = 0x300; - off = this->parent->field_0x80.HALF.LO - 1; - this->direction = gUnk_080D1628[off][this->field_0x78.HALF.HI]; - PositionRelative(this->parent, this, 0, Q_16_16(-16.0)); + COLLISION_OFF(super); + this->unk_78 = 0; + super->speed = 0x300; + off = ((VaatiBallEntity*)super->parent)->unk_80 - 1; + super->direction = gUnk_080D1628[off][this->unk_79]; + PositionRelative(super->parent, super, 0, Q_16_16(-16.0)); } -void sub_08044E74(Entity* this, u32 state) { - this->action = 1; - this->field_0x74.HALF.LO = 0; +void sub_08044E74(VaatiBallEntity* this, u32 state) { + super->action = 1; + this->unk_74 = 0; switch (state) { case 2: - this->action = 2; - this->direction += DirectionWest; - this->direction &= 0x3 | DirectionNorthWest; - PositionRelative(this->parent, this, 0, Q_16_16(-16.0)); - this->speed = 12288; - LinearMoveUpdate(this); - this->direction += DirectionEast; - this->direction &= 0x3 | DirectionNorthWest; - this->speed = 1280; - LinearMoveUpdate(this); + super->action = 2; + super->direction += DirectionWest; + super->direction &= 0x3 | DirectionNorthWest; + PositionRelative(super->parent, super, 0, Q_16_16(-16.0)); + super->speed = 12288; + LinearMoveUpdate(super); + super->direction += DirectionEast; + super->direction &= 0x3 | DirectionNorthWest; + super->speed = 1280; + LinearMoveUpdate(super); break; case 1: - this->direction = (this->direction + 8) & (0x3 | DirectionNorthWest); + super->direction = (super->direction + 8) & (0x3 | DirectionNorthWest); break; case 0: - if (this->field_0x78.HALF.LO) { - switch (this->timer) { + if (this->unk_78) { + switch (super->timer) { case 3 ... 4: do { - LinearMoveUpdate(this); - } while (this->timer-- != 3); + LinearMoveUpdate(super); + } while (super->timer-- != 3); break; case 1: - this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); - LinearMoveUpdate(this); - this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); + super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest); + LinearMoveUpdate(super); + super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest); break; } } else { - if (this->timer == 2) { - LinearMoveUpdate(this); + if (super->timer == 2) { + LinearMoveUpdate(super); } } break; } - this->timer = 1; - this->field_0x78.HALF.LO = 0; - this->speed = Q_8_8(5.0); + super->timer = 1; + this->unk_78 = 0; + super->speed = Q_8_8(5.0); } diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c index ab831be3..26f3e6b5 100644 --- a/src/enemy/vaatiEyesMacro.c +++ b/src/enemy/vaatiEyesMacro.c @@ -4,42 +4,53 @@ * * @brief Vaati Eyes Macro enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; +} VaatiEyesMacroEntity; + extern s16 gUnk_080B4488[]; -void VaatiEyesMacro_OnTick(Entity*); -void VaatiEyesMacro_OnCollision(Entity*); -void VaatiEyesMacroFunction0Type0(Entity*); -void VaatiEyesMacroFunction0Type1(Entity*); -void VaatiEyesMacroFunction0Type2(Entity*); -void VaatiEyesMacroFunction0Type3(Entity*); -void VaatiEyesMacroFunction0Type0Action0(Entity*); -void VaatiEyesMacroFunction0Type0Action1(Entity*); -void VaatiEyesMacroFunction0Type1Action0(Entity*); -void VaatiEyesMacroFunction0Type1Action1(Entity*); -void sub_0802EF90(Entity*); -void sub_0802EFB8(Entity*); -void sub_0802EF58(Entity*); -void sub_0802F04C(Entity*); +void VaatiEyesMacro_OnTick(VaatiEyesMacroEntity*); +void VaatiEyesMacro_OnCollision(VaatiEyesMacroEntity*); +void VaatiEyesMacroFunction0Type0(VaatiEyesMacroEntity*); +void VaatiEyesMacroFunction0Type1(VaatiEyesMacroEntity*); +void VaatiEyesMacroFunction0Type2(VaatiEyesMacroEntity*); +void VaatiEyesMacroFunction0Type3(VaatiEyesMacroEntity*); +void VaatiEyesMacroFunction0Type0Action0(VaatiEyesMacroEntity*); +void VaatiEyesMacroFunction0Type0Action1(VaatiEyesMacroEntity*); +void VaatiEyesMacroFunction0Type1Action0(VaatiEyesMacroEntity*); +void VaatiEyesMacroFunction0Type1Action1(VaatiEyesMacroEntity*); +void sub_0802EF90(VaatiEyesMacroEntity*); +void sub_0802EFB8(VaatiEyesMacroEntity*); +void sub_0802EF58(VaatiEyesMacroEntity*); +void sub_0802F04C(VaatiEyesMacroEntity*); -void (*const VaatiEyesMacro_Functions[])(Entity*) = { - VaatiEyesMacro_OnTick, VaatiEyesMacro_OnCollision, GenericKnockback, GenericDeath, - GenericConfused, VaatiEyesMacro_OnTick, +void (*const VaatiEyesMacro_Functions[])(VaatiEyesMacroEntity*) = { + VaatiEyesMacro_OnTick, + VaatiEyesMacro_OnCollision, + (void (*)(VaatiEyesMacroEntity*))GenericKnockback, + (void (*)(VaatiEyesMacroEntity*))GenericDeath, + (void (*)(VaatiEyesMacroEntity*))GenericConfused, + VaatiEyesMacro_OnTick, }; -void (*const vaatiEyesMacroFunction0Types[])(Entity*) = { +void (*const vaatiEyesMacroFunction0Types[])(VaatiEyesMacroEntity*) = { VaatiEyesMacroFunction0Type0, VaatiEyesMacroFunction0Type1, VaatiEyesMacroFunction0Type2, VaatiEyesMacroFunction0Type3, }; -void (*const vaatiEyesMacroFunction0Type0Actions[])(Entity*) = { +void (*const vaatiEyesMacroFunction0Type0Actions[])(VaatiEyesMacroEntity*) = { VaatiEyesMacroFunction0Type0Action0, VaatiEyesMacroFunction0Type0Action1, }; -void (*const vaatiEyesMacroFunction0Type1Actions[])(Entity*) = { +void (*const vaatiEyesMacroFunction0Type1Actions[])(VaatiEyesMacroEntity*) = { VaatiEyesMacroFunction0Type1Action0, VaatiEyesMacroFunction0Type1Action1, }; @@ -50,109 +61,109 @@ const u8 gUnk_080CDE70[] = { const s8 gUnk_080CDE90[] = { -2, -3, -4, -5, -6, -5, -4, -3 }; const u16 gUnk_080CDE98[] = { 0xc0, 0x100, 0x140, 0x180 }; -void VaatiEyesMacro(Entity* this) { - VaatiEyesMacro_Functions[GetNextFunction(this)](this); - SetChildOffset(this, 0, 1, -0x10); +void VaatiEyesMacro(VaatiEyesMacroEntity* this) { + VaatiEyesMacro_Functions[GetNextFunction(super)](this); + SetChildOffset(super, 0, 1, -0x10); } -void VaatiEyesMacro_OnTick(Entity* this) { - vaatiEyesMacroFunction0Types[this->type](this); - if (this->type < 2) { +void VaatiEyesMacro_OnTick(VaatiEyesMacroEntity* this) { + vaatiEyesMacroFunction0Types[super->type](this); + if (super->type < 2) { sub_0802EF90(this); } } -void VaatiEyesMacro_OnCollision(Entity* this) { - if (this->type == 0) { - if (this->health == 0) { +void VaatiEyesMacro_OnCollision(VaatiEyesMacroEntity* this) { + if (super->type == 0) { + if (super->health == 0) { gRoomTransition.field_0x39 &= ~(1 << (gRoomTransition.field_0x3c + 2)); } if (gRoomControls.room == 0) { - gRoomTransition.field_0x3a = this->health; + gRoomTransition.field_0x3a = super->health; } else { - gRoomTransition.field_0x3b = this->health; + gRoomTransition.field_0x3b = super->health; } - if (this->field_0x78.HALF.HI != this->health) { + if (this->unk_79 != super->health) { EnqueueSFX(SFX_17A); } - this->field_0x78.HALF.HI = this->health; + this->unk_79 = super->health; } else { - if (this->type == 1) { - if (0 < this->iframes) { - this->iframes *= -1; + if (super->type == 1) { + if (0 < super->iframes) { + super->iframes *= -1; } - if (this->health != 0xff) { + if (super->health != 0xff) { EnqueueSFX(SFX_BUTTON_DEPRESS); } - this->health = 0xff; + super->health = 0xff; } } - if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); + if (super->confusedTime != 0) { + Create0x68FX(super, FX_STARS); } - EnemyFunctionHandlerAfterCollision(this, VaatiEyesMacro_Functions); + EnemyFunctionHandlerAfterCollision(super, (EntityActionArray)VaatiEyesMacro_Functions); } -void VaatiEyesMacroFunction0Type0(Entity* this) { - vaatiEyesMacroFunction0Type0Actions[this->action](this); +void VaatiEyesMacroFunction0Type0(VaatiEyesMacroEntity* this) { + vaatiEyesMacroFunction0Type0Actions[super->action](this); } -void VaatiEyesMacroFunction0Type0Action0(Entity* this) { +void VaatiEyesMacroFunction0Type0Action0(VaatiEyesMacroEntity* this) { Manager* manager; Entity* enemy; if ((gEntCount < 0x47) && (manager = GetEmptyManager(), manager != NULL)) { manager->kind = MANAGER; manager->id = VAATI3_INSIDE_ARM_MANAGER; - manager->parent = (Entity*)this; + manager->parent = (Entity*)super; AppendEntityToList((Entity*)manager, 8); enemy = CreateEnemy(VAATI_EYES_MACRO, 2); - enemy->parent = this; - this->action = 1; + enemy->parent = super; + super->action = 1; if (gRoomControls.room == 0) { - this->field_0x78.HALF.HI = this->health = gRoomTransition.field_0x3a; + this->unk_79 = super->health = gRoomTransition.field_0x3a; } else { - this->field_0x78.HALF.HI = this->health = gRoomTransition.field_0x3b; + this->unk_79 = super->health = gRoomTransition.field_0x3b; } - this->field_0x78.HALF.LO = Random(); + this->unk_78 = Random(); sub_0802EFB8(this); - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); sub_0802EF58(this); } } -void VaatiEyesMacroFunction0Type0Action1(Entity* this) { +void VaatiEyesMacroFunction0Type0Action1(VaatiEyesMacroEntity* this) { sub_0802F04C(this); - GetNextFrame(this); + GetNextFrame(super); } -void VaatiEyesMacroFunction0Type1(Entity* this) { - vaatiEyesMacroFunction0Type1Actions[this->action](this); +void VaatiEyesMacroFunction0Type1(VaatiEyesMacroEntity* this) { + vaatiEyesMacroFunction0Type1Actions[super->action](this); } -void VaatiEyesMacroFunction0Type1Action0(Entity* this) { +void VaatiEyesMacroFunction0Type1Action0(VaatiEyesMacroEntity* this) { Entity* entity; u32 rand; if (gEntCount < 0x47) { entity = CreateEnemy(VAATI_EYES_MACRO, 3); - entity->parent = this; - this->action = 1; + entity->parent = super; + super->action = 1; rand = Random(); - this->timer = (rand & 3) + 1; - this->field_0x78.HALF.LO = Random() >> 8; - this->direction = gUnk_080CDE6C[rand >> 0x10 & 3]; - InitializeAnimation(this, 1); + super->timer = (rand & 3) + 1; + this->unk_78 = Random() >> 8; + super->direction = gUnk_080CDE6C[rand >> 0x10 & 3]; + InitializeAnimation(super, 1); } } -void VaatiEyesMacroFunction0Type1Action1(Entity* this) { - if (this->parent->next == NULL) { - COLLISION_OFF(this); - this->health = 0; +void VaatiEyesMacroFunction0Type1Action1(VaatiEyesMacroEntity* this) { + if (super->parent->next == NULL) { + COLLISION_OFF(super); + super->health = 0; } else { sub_0802F04C(this); - GetNextFrame(this); + GetNextFrame(super); } } @@ -161,43 +172,43 @@ typedef struct xy { u8 y; } xy; -void VaatiEyesMacroFunction0Type2(Entity* this) { +void VaatiEyesMacroFunction0Type2(VaatiEyesMacroEntity* this) { u32 uVar2; xy* temp; - if (this->parent->next == NULL) { + if (super->parent->next == NULL) { DeleteThisEntity(); } - if (this->action == 0) { - this->action = 1; - this->animationState = 0xff; + if (super->action == 0) { + super->action = 1; + super->animationState = 0xff; } - CopyPositionAndSpriteOffset(this->parent, this); - uVar2 = (GetFacingDirection(this, &gPlayerEntity) + 1) & 0x1e; + CopyPositionAndSpriteOffset(super->parent, super); + uVar2 = (GetFacingDirection(super, &gPlayerEntity) + 1) & 0x1e; temp = (xy*)&gUnk_080CDE70[uVar2]; - if (temp->x != this->frameIndex) { - if (temp->y != this->frameIndex) { - this->frameIndex = temp->x; + if (temp->x != super->frameIndex) { + if (temp->y != super->frameIndex) { + super->frameIndex = temp->x; } } - this->y.HALF.HI++; - this->spriteOffsetY--; + super->y.HALF.HI++; + super->spriteOffsetY--; } -void VaatiEyesMacroFunction0Type3(Entity* this) { - if (this->parent->next == NULL) { +void VaatiEyesMacroFunction0Type3(VaatiEyesMacroEntity* this) { + if (super->parent->next == NULL) { DeleteThisEntity(); } - if (this->action == 0) { - this->action = 1; - this->frameIndex = 0x11; - this->spritePriority.b0 = 6; + if (super->action == 0) { + super->action = 1; + super->frameIndex = 0x11; + super->spritePriority.b0 = 6; } - CopyPositionAndSpriteOffset(this->parent, this); - this->z.HALF.HI = 0; + CopyPositionAndSpriteOffset(super->parent, super); + super->z.HALF.HI = 0; } -void sub_0802EF58(Entity* this) { +void sub_0802EF58(VaatiEyesMacroEntity* this) { Entity* entity; u32 i; @@ -206,18 +217,18 @@ void sub_0802EF58(Entity* this) { if (entity != NULL) { entity->type2 = i; entity->collisionLayer = 1; - entity->parent = this; + entity->parent = super; UpdateSpriteForCollisionLayer(entity); - CopyPosition(this, entity); + CopyPosition(super, entity); } } } -void sub_0802EF90(Entity* this) { - this->z.HALF.HI = gUnk_080CDE90[this->field_0x78.HALF.LO++ >> 3 & 7]; +void sub_0802EF90(VaatiEyesMacroEntity* this) { + super->z.HALF.HI = gUnk_080CDE90[this->unk_78++ >> 3 & 7]; } -void sub_0802EFB8(Entity* this) { +void sub_0802EFB8(VaatiEyesMacroEntity* this) { u32 uVar1; u32 rand; u32 uVar3; @@ -227,74 +238,74 @@ void sub_0802EFB8(Entity* this) { if ((rand >> 0x10 & 3) != 0) { uVar1 = rand & 0x18; } else { - uVar3 = GetFacingDirection(&gPlayerEntity, this); + uVar3 = GetFacingDirection(&gPlayerEntity, super); uVar1 = (uVar3 + 4) & 0x18; } - iVar4 = sub_080B1B44(TILE(this->x.HALF.HI, this->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1); + iVar4 = sub_080B1B44(TILE(super->x.HALF.HI, super->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1); if (iVar4 != 0) { - this->direction = DIR_NONE; + super->direction = DIR_NONE; } else { - this->timer = (rand & 3) + 1; - this->direction = (uVar1 & 0x18); - this->speed = gUnk_080CDE98[rand >> 0x18 & 3]; + super->timer = (rand & 3) + 1; + super->direction = (uVar1 & 0x18); + super->speed = gUnk_080CDE98[rand >> 0x18 & 3]; } } -void sub_0802F04C(Entity* this) { +void sub_0802F04C(VaatiEyesMacroEntity* this) { s32 oldX; s32 oldY; - oldX = this->x.HALF.HI; - oldY = this->y.HALF.HI; - if (ProcessMovement0(this) == 0) { + oldX = super->x.HALF.HI; + oldY = super->y.HALF.HI; + if (ProcessMovement0(super) == 0) { sub_0802EFB8(this); return; } - switch (this->direction >> 3) { + switch (super->direction >> 3) { case 0: // UP - if (((oldY & 0xf) > 8) && ((this->y.HALF.HI & 0xf) < 9)) { - this->timer--; - oldY = (this->y.HALF.HI & 0xfff0) + 8; + if (((oldY & 0xf) > 8) && ((super->y.HALF.HI & 0xf) < 9)) { + super->timer--; + oldY = (super->y.HALF.HI & 0xfff0) + 8; } - if (this->timer == 0) { - this->x.HALF.HI = oldX; - this->y.HALF.HI = oldY; + if (super->timer == 0) { + super->x.HALF.HI = oldX; + super->y.HALF.HI = oldY; } else { return; } break; case 1: // RIGHT - if (((oldX & 0xf) < 8) && ((this->x.HALF.HI & 0xf) >= 8)) { - this->timer--; - oldX = (this->x.HALF.HI & 0xfff0) + 8; + if (((oldX & 0xf) < 8) && ((super->x.HALF.HI & 0xf) >= 8)) { + super->timer--; + oldX = (super->x.HALF.HI & 0xfff0) + 8; } - if (this->timer == 0) { - this->x.HALF.HI = oldX; - this->y.HALF.HI = oldY; + if (super->timer == 0) { + super->x.HALF.HI = oldX; + super->y.HALF.HI = oldY; } else { return; } break; case 2: // DOWN - if (((oldY & 0xf) < 8) && ((this->y.HALF.HI & 0xf) >= 8)) { - this->timer--; - oldY = (this->y.HALF.HI & 0xfff0) + 8; + if (((oldY & 0xf) < 8) && ((super->y.HALF.HI & 0xf) >= 8)) { + super->timer--; + oldY = (super->y.HALF.HI & 0xfff0) + 8; } - if (this->timer == 0) { - this->x.HALF.HI = oldX; - this->y.HALF.HI = oldY; + if (super->timer == 0) { + super->x.HALF.HI = oldX; + super->y.HALF.HI = oldY; } else { return; } break; default: // LEFT - if (((oldX & 0xf) >= 9) && ((this->x.HALF.HI & 0xf) < 9)) { - this->timer--; - oldX = (this->x.HALF.HI & 0xfff0) + 8; + if (((oldX & 0xf) >= 9) && ((super->x.HALF.HI & 0xf) < 9)) { + super->timer--; + oldX = (super->x.HALF.HI & 0xfff0) + 8; } - if (this->timer == 0) { - this->x.HALF.HI = oldX; - this->y.HALF.HI = oldY; + if (super->timer == 0) { + super->x.HALF.HI = oldX; + super->y.HALF.HI = oldY; } else { return; } diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index b2873a67..e80675e4 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -4,74 +4,83 @@ * * @brief Vaati Projectile enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "screenTransitions.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u16 unk_78; +} VaatiProjectileEntity; + extern Entity* gUnk_020000B0; -bool32 sub_0803E4A0(Entity*); -void VaatiProjectile_OnTick(Entity*); -void VaatiProjectile_OnCollision(Entity*); -void GenericKnockback2(Entity*); -void VaatiProjectile_OnDeath(Entity*); -void VaatiProjectile_OnGrabbed(Entity*); -void VaatiProjectileFunction0Action0(Entity*); -void VaatiProjectileFunction0Action1(Entity*); -void VaatiProjectileFunction0Action2(Entity*); -void VaatiProjectileFunction0Action3(Entity*); -void VaatiProjectileFunction0Action4(Entity*); -void VaatiProjectileFunction0Action5(Entity*); -void VaatiProjectileFunction0Action6(Entity*); -void VaatiProjectileFunction0Action7(Entity*); -void VaatiProjectileFunction0Action8(Entity*); -void VaatiProjectileFunction0Action9(Entity*); -void sub_0803E444(Entity*); -void sub_0803E480(Entity*); -void sub_0803E4D8(Entity*); +bool32 sub_0803E4A0(VaatiProjectileEntity*); +void VaatiProjectile_OnTick(VaatiProjectileEntity*); +void VaatiProjectile_OnCollision(VaatiProjectileEntity*); +void VaatiProjectile_OnDeath(VaatiProjectileEntity*); +void VaatiProjectile_OnGrabbed(VaatiProjectileEntity*); +void VaatiProjectileFunction0Action0(VaatiProjectileEntity*); +void VaatiProjectileFunction0Action1(VaatiProjectileEntity*); +void VaatiProjectileFunction0Action2(VaatiProjectileEntity*); +void VaatiProjectileFunction0Action3(VaatiProjectileEntity*); +void VaatiProjectileFunction0Action4(VaatiProjectileEntity*); +void VaatiProjectileFunction0Action5(VaatiProjectileEntity*); +void VaatiProjectileFunction0Action6(VaatiProjectileEntity*); +void VaatiProjectileFunction0Action7(VaatiProjectileEntity*); +void VaatiProjectileFunction0Action8(VaatiProjectileEntity*); +void VaatiProjectileFunction0Action9(VaatiProjectileEntity*); +void sub_0803E444(VaatiProjectileEntity*); +void sub_0803E480(VaatiProjectileEntity*); +void sub_0803E4D8(VaatiProjectileEntity*); -void (*const VaatiProjectile_Functions[])(Entity*) = { - VaatiProjectile_OnTick, VaatiProjectile_OnCollision, GenericKnockback2, VaatiProjectile_OnDeath, - GenericConfused, VaatiProjectile_OnGrabbed, +void (*const VaatiProjectile_Functions[])(VaatiProjectileEntity*) = { + VaatiProjectile_OnTick, + VaatiProjectile_OnCollision, + (void (*)(VaatiProjectileEntity*))GenericKnockback2, + VaatiProjectile_OnDeath, + (void (*)(VaatiProjectileEntity*))GenericConfused, + VaatiProjectile_OnGrabbed, }; -void (*const vaatiProjectileFunction0Actions[])(Entity*) = { +void (*const vaatiProjectileFunction0Actions[])(VaatiProjectileEntity*) = { VaatiProjectileFunction0Action0, VaatiProjectileFunction0Action1, VaatiProjectileFunction0Action2, VaatiProjectileFunction0Action3, VaatiProjectileFunction0Action4, VaatiProjectileFunction0Action5, VaatiProjectileFunction0Action6, VaatiProjectileFunction0Action7, VaatiProjectileFunction0Action8, VaatiProjectileFunction0Action9, }; -void VaatiProjectile(Entity* this) { +void VaatiProjectile(VaatiProjectileEntity* this) { if (sub_0803E4A0(this)) { - COLLISION_OFF(this); - this->health = 0; - this->parent = NULL; + COLLISION_OFF(super); + super->health = 0; + super->parent = NULL; } - VaatiProjectile_Functions[GetNextFunction(this)](this); + VaatiProjectile_Functions[GetNextFunction(super)](this); } -void VaatiProjectile_OnTick(Entity* this) { - vaatiProjectileFunction0Actions[this->action](this); +void VaatiProjectile_OnTick(VaatiProjectileEntity* this) { + vaatiProjectileFunction0Actions[super->action](this); } -void VaatiProjectile_OnCollision(Entity* this) { +void VaatiProjectile_OnCollision(VaatiProjectileEntity* this) { Entity* entity; - if (this->contactFlags == 0x80) { + if (super->contactFlags == 0x80) { #ifndef EU - if (this->health != 0) { + if (super->health != 0) { #endif - this->action = 5; - COLLISION_OFF(this); - this->spritePriority.b1 = 0; + super->action = 5; + COLLISION_OFF(super); + super->spritePriority.b1 = 0; gPlayerEntity.flags &= ~ENT_COLLIDE; - gPlayerEntity.spriteOrientation.flipY = this->spriteOrientation.flipY; - gPlayerEntity.spriteRendering.b3 = this->spriteRendering.b3; + gPlayerEntity.spriteOrientation.flipY = super->spriteOrientation.flipY; + gPlayerEntity.spriteRendering.b3 = super->spriteRendering.b3; sub_0803E444(this); #ifndef EU SetPlayerControl(2); - entity = this->parent; + entity = super->parent; if (entity != NULL) { entity->flags = entity->flags & ~ENT_COLLIDE; } @@ -82,188 +91,188 @@ void VaatiProjectile_OnCollision(Entity* this) { } #endif } - EnemyFunctionHandlerAfterCollision(this, VaatiProjectile_Functions); + EnemyFunctionHandlerAfterCollision(super, (EntityActionArray)VaatiProjectile_Functions); } -void VaatiProjectile_OnDeath(Entity* this) { - if (this->parent != NULL) { - this->parent->subtimer--; - this->parent = NULL; +void VaatiProjectile_OnDeath(VaatiProjectileEntity* this) { + if (super->parent != NULL) { + super->parent->subtimer--; + super->parent = NULL; } - GenericDeath(this); + GenericDeath(super); } -void VaatiProjectile_OnGrabbed(Entity* this) { +void VaatiProjectile_OnGrabbed(VaatiProjectileEntity* this) { } -void VaatiProjectileFunction0Action0(Entity* this) { +void VaatiProjectileFunction0Action0(VaatiProjectileEntity* this) { Entity* entity; - if (this->type == 0) { + if (super->type == 0) { entity = CreateEnemy(VAATI_PROJECTILE, 1); if (entity != NULL) { - entity->parent = this; - this->child = entity; - if (this->type2 == 0) { - this->action = 1; - this->z.HALF.HI = -0x18; + entity->parent = super; + super->child = entity; + if (super->type2 == 0) { + super->action = 1; + super->z.HALF.HI = -0x18; } else { - this->action = 9; - this->z.HALF.HI = -0x80; - this->flags2 = 1; + super->action = 9; + super->z.HALF.HI = -0x80; + super->flags2 = 1; } - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); } } else { - this->action = 8; - COLLISION_OFF(this); - this->spriteOffsetY = 1; - this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY; - this->spriteRendering.b3 = this->parent->spriteRendering.b3; - this->spritePriority.b1 = 0; - PositionRelative(this->parent, this, 0, Q_16_16(-1.0)); - InitializeAnimation(this, 1); + super->action = 8; + COLLISION_OFF(super); + super->spriteOffsetY = 1; + super->spriteOrientation.flipY = super->parent->spriteOrientation.flipY; + super->spriteRendering.b3 = super->parent->spriteRendering.b3; + super->spritePriority.b1 = 0; + PositionRelative(super->parent, super, 0, Q_16_16(-1.0)); + InitializeAnimation(super, 1); } } -void VaatiProjectileFunction0Action1(Entity* this) { +void VaatiProjectileFunction0Action1(VaatiProjectileEntity* this) { sub_0803E480(this); - if (PlayerInRange(this, 0, 8) != 0) { - this->action = 2; - this->timer = 10; - InitializeAnimation(this->child, 2); + if (PlayerInRange(super, 0, 8) != 0) { + super->action = 2; + super->timer = 10; + InitializeAnimation(super->child, 2); } else { if (gUnk_020000B0 != NULL) { - sub_08004596(this, GetFacingDirection(this, gUnk_020000B0)); - LinearMoveUpdate(this); + sub_08004596(super, GetFacingDirection(super, gUnk_020000B0)); + LinearMoveUpdate(super); } } - GetNextFrame(this); + GetNextFrame(super); } -void VaatiProjectileFunction0Action2(Entity* this) { - if (this->timer != 0) { - this->timer--; +void VaatiProjectileFunction0Action2(VaatiProjectileEntity* this) { + if (super->timer != 0) { + super->timer--; } else { - if (++this->z.HALF.HI == 0) { - this->action = 3; + if (++super->z.HALF.HI == 0) { + super->action = 3; } } - GetNextFrame(this); + GetNextFrame(super); } -void VaatiProjectileFunction0Action3(Entity* this) { - if (this->child->frame & ANIM_DONE) { - if (--this->z.HALF.HI <= -0x18) { - this->action = 4; - this->timer = (Random() & 0xf) + 15; - InitializeAnimation(this->child, 1); +void VaatiProjectileFunction0Action3(VaatiProjectileEntity* this) { + if (super->child->frame & ANIM_DONE) { + if (--super->z.HALF.HI <= -0x18) { + super->action = 4; + super->timer = (Random() & 0xf) + 15; + InitializeAnimation(super->child, 1); } - GetNextFrame(this); + GetNextFrame(super); } } -void VaatiProjectileFunction0Action4(Entity* this) { - if (--this->timer == 0) { - this->action = 1; - this->direction = GetFacingDirection(this, &gPlayerEntity); +void VaatiProjectileFunction0Action4(VaatiProjectileEntity* this) { + if (--super->timer == 0) { + super->action = 1; + super->direction = GetFacingDirection(super, &gPlayerEntity); } - GetNextFrame(this); + GetNextFrame(super); } -void VaatiProjectileFunction0Action5(Entity* this) { +void VaatiProjectileFunction0Action5(VaatiProjectileEntity* this) { sub_0803E444(this); - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } else { - if (-0x18 < --this->z.HALF.HI) { + if (-0x18 < --super->z.HALF.HI) { return; } - this->action = 6; - this->timer = 20; + super->action = 6; + super->timer = 20; } } -void VaatiProjectileFunction0Action6(Entity* this) { - if (--this->timer == 0) { - this->action = 7; - this->direction = DirectionSouth; - this->speed = 0x300; +void VaatiProjectileFunction0Action6(VaatiProjectileEntity* this) { + if (--super->timer == 0) { + super->action = 7; + super->direction = DirectionSouth; + super->speed = 0x300; } sub_0803E444(this); } -void VaatiProjectileFunction0Action7(Entity* this) { +void VaatiProjectileFunction0Action7(VaatiProjectileEntity* this) { sub_0803E444(this); - LinearMoveUpdate(this); + LinearMoveUpdate(super); sub_0803E4D8(this); - if ((gRoomControls.origin_y + gRoomControls.height + -0x10) <= this->y.HALF.HI) { + if ((gRoomControls.origin_y + gRoomControls.height + -0x10) <= super->y.HALF.HI) { SetInitializationPriority(); - // TODO this screen transition is to mazaal. Is this also the projectile for Mazaals shrink ray? + // TODO super screen transition is to mazaal. Is super also the projectile for Mazaals shrink ray? DoExitTransition(&gUnk_0813AB94); } } -void VaatiProjectileFunction0Action8(Entity* this) { - if (this->parent->next == NULL) { +void VaatiProjectileFunction0Action8(VaatiProjectileEntity* this) { + if (super->parent->next == NULL) { DeleteThisEntity(); } - PositionRelative(this->parent, this, 0, Q_16_16(-1.0)); - GetNextFrame(this); + PositionRelative(super->parent, super, 0, Q_16_16(-1.0)); + GetNextFrame(super); } -void VaatiProjectileFunction0Action9(Entity* this) { - this->x.HALF.HI = gPlayerEntity.x.HALF.HI; - this->y.HALF.HI = gPlayerEntity.y.HALF.HI; - if (this->z.HALF.HI < -8) { - if (this->animIndex != 2) { - this->timer = 0; - InitializeAnimation(this->child, 2); +void VaatiProjectileFunction0Action9(VaatiProjectileEntity* this) { + super->x.HALF.HI = gPlayerEntity.x.HALF.HI; + super->y.HALF.HI = gPlayerEntity.y.HALF.HI; + if (super->z.HALF.HI < -8) { + if (super->animIndex != 2) { + super->timer = 0; + InitializeAnimation(super->child, 2); } VaatiProjectileFunction0Action2(this); } else { - this->z.HALF.HI += 8; + super->z.HALF.HI += 8; } } -void sub_0803E444(Entity* this) { +void sub_0803E444(VaatiProjectileEntity* this) { ResetActiveItems(); gPlayerState.mobility |= 0x80; gPlayerState.field_0xa |= 0x80; - sub_0806FA90(this, this->contactedEntity, 0, -2); + sub_0806FA90(super, super->contactedEntity, 0, -2); gPlayerEntity.spriteOffsetY += 0xe; } -void sub_0803E480(Entity* this) { - if (this->field_0x78.HWORD >= 0x4b1) { - this->speed = 0x180; +void sub_0803E480(VaatiProjectileEntity* this) { + if (this->unk_78 >= 0x4b1) { + super->speed = 0x180; } else { - this->field_0x78.HWORD++; + this->unk_78++; } } -bool32 sub_0803E4A0(Entity* this) { +bool32 sub_0803E4A0(VaatiProjectileEntity* this) { #ifdef EU bool32 ret; if (gRoomTransition.field_0x39 == 0) { return TRUE; } else { - if (this->parent == NULL) { + if (super->parent == NULL) { return FALSE; } - ret = this->parent->next == NULL; + ret = super->parent->next == NULL; } return ret; #else bool32 ret; if (gRoomTransition.field_0x39 != 0) { - if (this->parent == NULL) { + if (super->parent == NULL) { return FALSE; } - if (this->parent->health == 0) { + if (super->parent->health == 0) { return TRUE; } else { - ret = this->parent->next == NULL; + ret = super->parent->next == NULL; } } else { return TRUE; @@ -272,10 +281,10 @@ bool32 sub_0803E4A0(Entity* this) { #endif } -void sub_0803E4D8(Entity* this) { +void sub_0803E4D8(VaatiProjectileEntity* this) { u32 tile; - tile = TILE(this->x.HALF.HI, this->y.HALF.HI + 8); + tile = TILE(super->x.HALF.HI, super->y.HALF.HI + 8); if (sub_080B1B44(tile, gPlayerEntity.collisionLayer) != 0xff) { SetTile(0x4074, tile, gPlayerEntity.collisionLayer); } diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c index 9dacb397..135b4f4c 100644 --- a/src/enemy/vaatiRebornEnemy.c +++ b/src/enemy/vaatiRebornEnemy.c @@ -4,51 +4,70 @@ * * @brief Vaati Reborn enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" -void VaatiRebornEnemyType0PreAction(Entity*); -void VaatiRebornEnemyType1PreAction(Entity*); -void VaatiRebornEnemyType0Action0(Entity*); -void VaatiRebornEnemyType0Action1(Entity*); -void VaatiRebornEnemyType0Action2(Entity*); -void VaatiRebornEnemyType0Action3(Entity*); -void VaatiRebornEnemyType0Action4(Entity*); -void VaatiRebornEnemyType0Action5(Entity*); -void VaatiRebornEnemyType0Action6(Entity*); -void VaatiRebornEnemyType0Action7(Entity*); -void VaatiRebornEnemyType1Action0(Entity*); -void VaatiRebornEnemyType1Action1(Entity*); -void VaatiRebornEnemyType2Action0(Entity*); -void VaatiRebornEnemyType2Action1(Entity*); -void VaatiRebornEnemyType3Action0(Entity*); -void VaatiRebornEnemyType3Action1(Entity*); -void sub_0803DD78(Entity*); -u32 sub_0803DEE0(Entity*); -u32 sub_0803E028(Entity*); -void sub_0803DC0C(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u8 unk_74; + /*0x75*/ u8 unk_75; + /*0x76*/ u8 unk_76; + /*0x77*/ u8 unk_77; + /*0x78*/ union SplitWord unk_78; + /*0x7c*/ union SplitWord unk_7c; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; + /*0x84*/ u8 unk_84; + /*0x85*/ u8 unk_85; + /*0x86*/ u8 unk_86; + /*0x87*/ u8 unk_87; +} VaatiRebornEnemyEntity; + +void VaatiRebornEnemyType0PreAction(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType1PreAction(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType0Action0(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType0Action1(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType0Action2(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType0Action3(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType0Action4(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType0Action5(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType0Action6(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType0Action7(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType1Action0(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType1Action1(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType2Action0(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType2Action1(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType3Action0(VaatiRebornEnemyEntity*); +void VaatiRebornEnemyType3Action1(VaatiRebornEnemyEntity*); +void sub_0803DD78(VaatiRebornEnemyEntity*); +u32 sub_0803DEE0(VaatiRebornEnemyEntity*); +u32 sub_0803E028(VaatiRebornEnemyEntity*); +void sub_0803DC0C(VaatiRebornEnemyEntity*); typedef struct xy { s8 x; s8 y; } PACKED xy; -void (*const vaatiRebornEnemyType0Actions[])(Entity*) = { +void (*const vaatiRebornEnemyType0Actions[])(VaatiRebornEnemyEntity*) = { VaatiRebornEnemyType0Action0, VaatiRebornEnemyType0Action1, VaatiRebornEnemyType0Action2, VaatiRebornEnemyType0Action3, VaatiRebornEnemyType0Action4, VaatiRebornEnemyType0Action5, VaatiRebornEnemyType0Action6, VaatiRebornEnemyType0Action7, }; -void (*const vaatiRebornEnemyType1Actions[])(Entity*) = { +void (*const vaatiRebornEnemyType1Actions[])(VaatiRebornEnemyEntity*) = { VaatiRebornEnemyType1Action0, VaatiRebornEnemyType1Action1, }; -void (*const vaatiRebornEnemyType2Actions[])(Entity*) = { +void (*const vaatiRebornEnemyType2Actions[])(VaatiRebornEnemyEntity*) = { VaatiRebornEnemyType2Action0, VaatiRebornEnemyType2Action1, }; -void (*const vaatiRebornEnemyType3Actions[])(Entity*) = { +void (*const vaatiRebornEnemyType3Actions[])(VaatiRebornEnemyEntity*) = { VaatiRebornEnemyType3Action0, VaatiRebornEnemyType3Action1, }; @@ -68,26 +87,26 @@ const u8 gUnk_080D04D0[] = { -24, -40, -48 }; #endif const u8 gUnk_080D04D3[] = { 0, 1, 0, -1 }; -void VaatiRebornEnemy(Entity* this) { - switch (this->type) { +void VaatiRebornEnemy(VaatiRebornEnemyEntity* this) { + switch (super->type) { case 0: VaatiRebornEnemyType0PreAction(this); - vaatiRebornEnemyType0Actions[this->action](this); + vaatiRebornEnemyType0Actions[super->action](this); break; case 1: VaatiRebornEnemyType1PreAction(this); - vaatiRebornEnemyType1Actions[this->action](this); + vaatiRebornEnemyType1Actions[super->action](this); break; case 2: - vaatiRebornEnemyType2Actions[this->action](this); + vaatiRebornEnemyType2Actions[super->action](this); break; case 3: - vaatiRebornEnemyType3Actions[this->action](this); + vaatiRebornEnemyType3Actions[super->action](this); break; } } -void VaatiRebornEnemyType0Action0(Entity* this) { +void VaatiRebornEnemyType0Action0(VaatiRebornEnemyEntity* this) { s32 i; Entity* entity; const xy* ptr; @@ -95,389 +114,388 @@ void VaatiRebornEnemyType0Action0(Entity* this) { if (CheckLocalFlag(0x7b) != 0) { DeleteThisEntity(); } - sub_0804A720(this); + sub_0804A720(super); if (CheckRoomFlag(0) && (gEntCount < 0x42)) { ClearRoomFlag(0); - this->action = 3; - this->field_0x74.HALF.LO = -1; - this->timer = 0; - this->field_0x76.HALF.LO = 0; - this->spriteSettings.draw = 1; - this->direction = DIR_NONE; - this->spritePriority.b0 = 4; - this->z.WORD = 0; - this->field_0x80.HALF.LO = 2; - this->field_0x86.HALF.LO = 0; - this->cutsceneBeh.HALF.HI = 0x30; - this->cutsceneBeh.HALF.LO = -1; - this->field_0x86.HALF.HI = 0; - this->field_0x82.HALF.LO = 0; - this->field_0x82.HALF.HI = 0; - *(u32*)(&this->field_0x78) = this->x.WORD; - this->field_0x7c = this->y; + super->action = 3; + this->unk_74 = -1; + super->timer = 0; + this->unk_76 = 0; + super->spriteSettings.draw = 1; + super->direction = DIR_NONE; + super->spritePriority.b0 = 4; + super->z.WORD = 0; + this->unk_80 = 2; + this->unk_86 = 0; + this->unk_85 = 0x30; + this->unk_84 = -1; + this->unk_87 = 0; + this->unk_82 = 0; + this->unk_83 = 0; + this->unk_78 = super->x; + this->unk_7c = super->y; entity = CreateEnemy(VAATI_REBORN_ENEMY, 1); - entity->parent = this; - this->child = entity; + entity->parent = super; + super->child = entity; for (i = 0; i < 6; i++) { entity = CreateEnemy(VAATI_BALL, 0); - entity->parent = this; - entity->field_0x78.HALF.HI = i; + entity->parent = super; + ((VaatiRebornEnemyEntity*)entity)->unk_78.BYTES.byte1 = i; } for (i = 0; i < 4; i++) { entity = CreateEnemy(VAATI_REBORN_ENEMY, 3); - entity->parent = this; + entity->parent = super; entity->timer = i; } for (i = 0; i < 2; i++) { entity = CreateEnemy(VAATI_BALL, 1); - entity->parent = this; + entity->parent = super; entity->spriteSettings.flipX = i; ptr = &gUnk_080D04A8[i]; - PositionRelative(this, entity, Q_16_16(ptr->x), Q_16_16(ptr->y)); + PositionRelative(super, entity, Q_16_16(ptr->x), Q_16_16(ptr->y)); } - InitAnimationForceUpdate(this, 0); + InitAnimationForceUpdate(super, 0); } } -void VaatiRebornEnemyType0Action1(Entity* this) { - if (this->timer != 0) { - if (--this->timer == 0) { - if ((this->field_0x74.HALF.LO & 0x70) == 0) { - if (this->child->timer == 0) { +void VaatiRebornEnemyType0Action1(VaatiRebornEnemyEntity* this) { + if (super->timer != 0) { + if (--super->timer == 0) { + if ((this->unk_74 & 0x70) == 0) { + if (super->child->timer == 0) { sub_0803DD78(this); - if (this->field_0x74.HALF.HI != 0) { - this->action = 2; - this->field_0x74.HALF.LO = 0; - this->timer = 16; - this->direction = DIR_NONE; + if (this->unk_75 != 0) { + super->action = 2; + this->unk_74 = 0; + super->timer = 16; + super->direction = DIR_NONE; } else { - if ((this->field_0x86.HALF.LO != 0) || (this->field_0x80.HALF.LO != 0)) { - this->direction = ((Random() & 0x80) >> 3) | DirectionEast; + if ((this->unk_86 != 0) || (this->unk_80 != 0)) { + super->direction = ((Random() & 0x80) >> 3) | DirectionEast; } else { - this->direction = DIR_NONE; + super->direction = DIR_NONE; } } } else { - this->timer = 2; + super->timer = 2; } } else { - this->action = 3; - this->field_0x74.HALF.HI = this->field_0x74.HALF.LO & 0x80; - this->field_0x74.HALF.LO = 0; - this->timer = 192; - this->direction = DIR_NONE; - this->spriteSettings.draw = 1; - InitAnimationForceUpdate(this, 0); + super->action = 3; + this->unk_75 = this->unk_74 & 0x80; + this->unk_74 = 0; + super->timer = 192; + super->direction = DIR_NONE; + super->spriteSettings.draw = 1; + InitAnimationForceUpdate(super, 0); } } } else { - if (--this->field_0x76.HALF.HI == 0) { + if (--this->unk_77 == 0) { switch (sub_0803DEE0(this)) { case 0: - this->action = 4; - this->timer = 160; - this->direction = DIR_NONE; - this->cutsceneBeh.HALF.LO = 0xff; - InitAnimationForceUpdate(this, 1); + super->action = 4; + super->timer = 160; + super->direction = DIR_NONE; + this->unk_84 = 0xff; + InitAnimationForceUpdate(super, 1); break; case 1: - this->action = 6; - this->field_0x74.HALF.LO = 0; - this->timer = 0; - this->direction = DIR_NONE; + super->action = 6; + this->unk_74 = 0; + super->timer = 0; + super->direction = DIR_NONE; break; case 3: - this->action = 5; - this->field_0x74.HALF.LO = 0; - this->subtimer = 32; - this->direction = DIR_NONE; + super->action = 5; + this->unk_74 = 0; + super->subtimer = 32; + super->direction = DIR_NONE; break; case 2: - this->field_0x74.HALF.LO = 0; - this->timer = 32; - if ((this->field_0x86.HALF.LO != 0) || (this->field_0x80.HALF.LO != 0)) { - this->direction = ((Random() & 0x80) >> 3) | DirectionEast; + this->unk_74 = 0; + super->timer = 32; + if ((this->unk_86 != 0) || (this->unk_80 != 0)) { + super->direction = ((Random() & 0x80) >> 3) | DirectionEast; } else { - this->direction = DIR_NONE; + super->direction = DIR_NONE; } break; } } - if (this->child->timer == 0) { - this->cutsceneBeh.HALF.HI++; - if ((this->cutsceneBeh.HALF.HI & 3) == 0) { - switch (this->cutsceneBeh.HALF.HI & 0x30) { + if (super->child->timer == 0) { + this->unk_85++; + if ((this->unk_85 & 3) == 0) { + switch (this->unk_85 & 0x30) { case 0: case 0x30: - this->y.HALF.HI++; + super->y.HALF.HI++; break; case 0x10: case 0x20: - this->y.HALF.HI--; + super->y.HALF.HI--; } } - ProcessMovement1(this); + ProcessMovement1(super); } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiRebornEnemyType0Action2(Entity* this) { +void VaatiRebornEnemyType0Action2(VaatiRebornEnemyEntity* this) { const Coords* ptr; - switch (this->field_0x74.HALF.LO) { + switch (this->unk_74) { case 0: - if (--this->timer == 0) { - this->field_0x74.HALF.LO++; - this->timer = 32; - InitAnimationForceUpdate(this, 3); + if (--super->timer == 0) { + this->unk_74++; + super->timer = 32; + InitAnimationForceUpdate(super, 3); SoundReq(SFX_19B); } break; case 1: - if ((this->frame & ANIM_DONE) != 0) { - this->field_0x74.HALF.LO = 2; - this->spriteSettings.draw = 0; - this->timer = 16; + if ((super->frame & ANIM_DONE) != 0) { + this->unk_74 = 2; + super->spriteSettings.draw = 0; + super->timer = 16; } break; case 2: - if (--this->timer == 0) { - this->field_0x74.HALF.LO++; + if (--super->timer == 0) { + this->unk_74++; if (sub_0803E028(this) == 0) { s32 tmp; - this->field_0x80.HALF.HI += 1 + (Random() & 3); - tmp = this->field_0x80.HALF.HI; - this->field_0x80.HALF.HI = tmp % 5; - ptr = &gUnk_080D04AC[this->field_0x80.HALF.HI]; - this->x.HALF.HI = gRoomControls.origin_x + ptr->HALF.x + 0x10; - this->y.HALF.HI = gRoomControls.origin_y + ptr->HALF.y + 0x10; + this->unk_81 += 1 + (Random() & 3); + tmp = this->unk_81; + this->unk_81 = tmp % 5; + ptr = &gUnk_080D04AC[this->unk_81]; + super->x.HALF.HI = gRoomControls.origin_x + ptr->HALF.x + 0x10; + super->y.HALF.HI = gRoomControls.origin_y + ptr->HALF.y + 0x10; } - this->spriteSettings.draw = 1; - this->timer = 32; - InitAnimationForceUpdate(this, 4); + super->spriteSettings.draw = 1; + super->timer = 32; + InitAnimationForceUpdate(super, 4); SoundReq(SFX_F5); } break; case 3: - if ((this->frame & ANIM_DONE) != 0) { - this->spriteSettings.draw = 1; - if (4 < this->field_0x80.HALF.HI) { - this->x.HALF.HI = gPlayerEntity.x.HALF.HI; - this->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0x18; + if ((super->frame & ANIM_DONE) != 0) { + super->spriteSettings.draw = 1; + if (4 < this->unk_81) { + super->x.HALF.HI = gPlayerEntity.x.HALF.HI; + super->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0x18; } - if (--this->field_0x76.HALF.HI == 0) { - this->action = 1; - this->timer = 1; + if (--this->unk_77 == 0) { + super->action = 1; + super->timer = 1; } else { - this->field_0x74.HALF.LO = 0; - this->timer = 16; + this->unk_74 = 0; + super->timer = 16; } - InitAnimationForceUpdate(this, 0); + InitAnimationForceUpdate(super, 0); } break; } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiRebornEnemyType0Action3(Entity* this) { +void VaatiRebornEnemyType0Action3(VaatiRebornEnemyEntity* this) { u8 temp; - switch (this->field_0x74.HALF.LO) { + switch (this->unk_74) { case 0xfe: - this->field_0x74.HALF.LO = 0; - this->timer = 1; + this->unk_74 = 0; + super->timer = 1; break; case 0xff: - if (this->z.HALF.HI != -4) { - this->z.WORD -= Q_16_16(0.125); + if (super->z.HALF.HI != -4) { + super->z.WORD -= Q_16_16(0.125); } - if (this->timer == 2) { - this->field_0x74.HALF.LO = 0xfe; + if (super->timer == 2) { + this->unk_74 = 0xfe; } break; case 0: - if (--this->timer == 0) { - this->field_0x74.HALF.LO++; - if ((this->field_0x74.HALF.HI & 0x80) != 0) { + if (--super->timer == 0) { + this->unk_74++; + if ((this->unk_75 & 0x80) != 0) { temp = 0x14; } else { temp = 0x20; } - this->timer = temp; - this->field_0x80.HALF.LO = ((this->field_0x86.HALF.LO + 1) >> 1) * 2 + 2; + super->timer = temp; + this->unk_80 = ((this->unk_86 + 1) >> 1) * 2 + 2; } break; case 1: - if (--this->timer == 0) { - this->field_0x74.HALF.LO++; - if ((this->field_0x74.HALF.HI & 0x80) == 0) { + if (--super->timer == 0) { + this->unk_74++; + if ((this->unk_75 & 0x80) == 0) { SoundReq(SFX_1B0); } - InitAnimationForceUpdate(this, 1); + InitAnimationForceUpdate(super, 1); } break; case 2: - if ((this->frame & ANIM_DONE) != 0) { - this->field_0x74.HALF.LO = 3; - InitAnimationForceUpdate(this, 0); + if ((super->frame & ANIM_DONE) != 0) { + this->unk_74 = 3; + InitAnimationForceUpdate(super, 0); } break; case 3: - this->action = 1; - this->field_0x74.HALF.LO = 0; - this->timer = 1; + super->action = 1; + this->unk_74 = 0; + super->timer = 1; break; } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiRebornEnemyType0Action4(Entity* this) { +void VaatiRebornEnemyType0Action4(VaatiRebornEnemyEntity* this) { u32 index; Entity* entity; - if (--this->timer == 0) { - this->action = 1; - this->cutsceneBeh.HALF.LO = 0xff; - this->timer = 1; - this->direction = (this->direction + 0x10) & (0x3 | DirectionNorthWest); - InitAnimationForceUpdate(this, 0); + if (--super->timer == 0) { + super->action = 1; + this->unk_84 = 0xff; + super->timer = 1; + super->direction = (super->direction + 0x10) & (0x3 | DirectionNorthWest); + InitAnimationForceUpdate(super, 0); } else { - if ((this->frame & 0x10) != 0) { - this->frame &= 0xef; - if (this->cutsceneBeh.HALF.LO == 0xff) { - index = Direction8RoundUp(GetFacingDirection(this, &gPlayerEntity)); - this->cutsceneBeh.HALF.LO = gUnk_080D04C0[index >> 2]; - this->subtimer = 0; + if ((super->frame & 0x10) != 0) { + super->frame &= 0xef; + if (this->unk_84 == 0xff) { + index = Direction8RoundUp(GetFacingDirection(super, &gPlayerEntity)); + this->unk_84 = gUnk_080D04C0[index >> 2]; + super->subtimer = 0; } - if ((this->subtimer < 0x10) && - (entity = CreateProjectileWithParent(this, V1_FIRE_PROJECTILE, this->cutsceneBeh.HALF.LO), - entity != NULL)) { - entity->subtimer = this->subtimer; - entity->parent = this; - entity->z.HALF.HI = this->z.HALF.HI; - this->subtimer = this->subtimer + 1; + if ((super->subtimer < 0x10) && + (entity = CreateProjectileWithParent(super, V1_FIRE_PROJECTILE, this->unk_84), entity != NULL)) { + entity->subtimer = super->subtimer; + entity->parent = super; + entity->z.HALF.HI = super->z.HALF.HI; + super->subtimer = super->subtimer + 1; } } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiRebornEnemyType0Action5(Entity* this) { +void VaatiRebornEnemyType0Action5(VaatiRebornEnemyEntity* this) { u32 uVar3; - if (this->field_0x80.HALF.LO == 0) { - this->action = 1; - this->timer = 1; - this->direction = DIR_NONE; - InitAnimationForceUpdate(this, 0); + if (this->unk_80 == 0) { + super->action = 1; + super->timer = 1; + super->direction = DIR_NONE; + InitAnimationForceUpdate(super, 0); return; } - switch (this->field_0x74.HALF.LO) { + switch (this->unk_74) { case 0: - if (--this->subtimer == 0) { - this->field_0x74.HALF.LO++; - InitAnimationForceUpdate(this, 1); + if (--super->subtimer == 0) { + this->unk_74++; + InitAnimationForceUpdate(super, 1); } break; case 1: - if ((this->frame & 0x10) != 0) { - this->field_0x74.HALF.LO = 2; - this->subtimer = (Random() & 0x3f) + 64; + if ((super->frame & 0x10) != 0) { + this->unk_74 = 2; + super->subtimer = (Random() & 0x3f) + 64; SoundReq(SFX_SUMMON); } break; case 2: - if (--this->subtimer == 0) { - if (!((this->field_0x86.HALF.LO < 2) || (3 < this->field_0x86.HALF.HI)) && (Random() & 0x10) != 0) { - this->field_0x86.HALF.HI++; - this->subtimer = (Random() & 0x3f) + 64; - uVar3 = GetFacingDirection(this, &gPlayerEntity); - this->direction = (uVar3 & 0x10) | DirectionEast; + if (--super->subtimer == 0) { + if (!((this->unk_86 < 2) || (3 < this->unk_87)) && (Random() & 0x10) != 0) { + this->unk_87++; + super->subtimer = (Random() & 0x3f) + 64; + uVar3 = GetFacingDirection(super, &gPlayerEntity); + super->direction = (uVar3 & 0x10) | DirectionEast; } else { - this->field_0x74.HALF.LO++; - this->field_0x86.HALF.HI = 0; - this->subtimer = 48; - InitAnimationForceUpdate(this, 0); + this->unk_74++; + this->unk_87 = 0; + super->subtimer = 48; + InitAnimationForceUpdate(super, 0); } } break; case 3: - if (--this->subtimer == 0) { - this->action = 1; - this->field_0x74.HALF.LO = 0; - this->timer = 1; - this->direction = DIR_NONE; + if (--super->subtimer == 0) { + super->action = 1; + this->unk_74 = 0; + super->timer = 1; + super->direction = DIR_NONE; } break; } - if (this->field_0x86.HALF.HI != 0) { - ProcessMovement1(this); + if (this->unk_87 != 0) { + ProcessMovement1(super); } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiRebornEnemyType0Action6(Entity* this) { +void VaatiRebornEnemyType0Action6(VaatiRebornEnemyEntity* this) { Entity* target; - if (this->field_0x80.HALF.LO == 0) { - this->action = 1; - this->timer = 1; + if (this->unk_80 == 0) { + super->action = 1; + super->timer = 1; return; } - switch (this->field_0x74.HALF.LO) { + switch (this->unk_74) { case 0: - if (this->timer != 0) { - this->field_0x74.HALF.LO = 1; - this->timer = 112; + if (super->timer != 0) { + this->unk_74 = 1; + super->timer = 112; } break; case 1: - if (--this->timer == 0) { - this->field_0x74.HALF.LO++; + if (--super->timer == 0) { + this->unk_74++; SoundReq(SFX_150); - target = CreateProjectileWithParent(this, V1_DARK_MAGIC_PROJECTILE, 0); + target = CreateProjectileWithParent(super, V1_DARK_MAGIC_PROJECTILE, 0); if (target != NULL) { - PositionRelative(this, target, 0, Q_16_16(-16.0)); - target->parent = this; + PositionRelative(super, target, 0, Q_16_16(-16.0)); + target->parent = super; } - } else if (this->timer == 0x40) { + } else if (super->timer == 0x40) { SoundReq(SFX_196); } break; case 2: - if (this->subtimer != 0) { - this->subtimer = 0; + if (super->subtimer != 0) { + super->subtimer = 0; } break; case 3: - if (this->subtimer == 0) { - this->subtimer = 1; + if (super->subtimer == 0) { + super->subtimer = 1; SoundReq(SFX_14F); } - if (this->timer) { - this->action = 1; - this->field_0x74.HALF.LO = 0; - this->timer = 1; + if (super->timer) { + super->action = 1; + this->unk_74 = 0; + super->timer = 1; } break; } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiRebornEnemyType0Action7(Entity* this) { +void VaatiRebornEnemyType0Action7(VaatiRebornEnemyEntity* this) { Entity* fx; u32 tmp; - if (this->timer != 0) { - if (--this->timer == 0) { + if (super->timer != 0) { + if (--super->timer == 0) { SetRoomFlag(1); } else { - if ((this->timer & 7) == 0) { - fx = CreateFx(this, FX_DEATH, 0); + if ((super->timer & 7) == 0) { + fx = CreateFx(super, FX_DEATH, 0); if (fx != NULL) { tmp = Random() & 0x3f3f; fx->x.HALF.HI = ((tmp & 0xff) - 0x20) + fx->x.HALF.HI; @@ -491,313 +509,313 @@ void VaatiRebornEnemyType0Action7(Entity* this) { } } -void VaatiRebornEnemyType1Action0(Entity* this) { +void VaatiRebornEnemyType1Action0(VaatiRebornEnemyEntity* this) { Entity* enemy; - this->action = 1; - this->field_0x74.HALF.LO = 0; - this->field_0x74.HALF.HI = 1; - this->timer = 0; - this->spriteOffsetY = -1; - PositionRelative(this->parent, this, 0, Q_16_16(1.0)); + super->action = 1; + this->unk_74 = 0; + this->unk_75 = 1; + super->timer = 0; + super->spriteOffsetY = -1; + PositionRelative(super->parent, super, 0, Q_16_16(1.0)); enemy = CreateEnemy(VAATI_REBORN_ENEMY, 2); - enemy->parent = this; - enemy->child = this->parent; - InitAnimationForceUpdate(this, this->field_0x74.HALF.LO); + enemy->parent = super; + enemy->child = super->parent; + InitAnimationForceUpdate(super, this->unk_74); } -void VaatiRebornEnemyType1Action1(Entity* this) { +void VaatiRebornEnemyType1Action1(VaatiRebornEnemyEntity* this) { Entity* parent; - parent = this->parent; - if (this->field_0x74.HALF.LO == 0) { - if (parent->field_0x80.HALF.LO == 0) { - this->field_0x74.HALF.LO = 1; - this->hitType = 0x30; - InitAnimationForceUpdate(this, this->field_0x74.HALF.LO); + parent = super->parent; + if (this->unk_74 == 0) { + if (((VaatiRebornEnemyEntity*)parent)->unk_80 == 0) { + this->unk_74 = 1; + super->hitType = 0x30; + InitAnimationForceUpdate(super, this->unk_74); } } else { - if (parent->field_0x80.HALF.LO != 0) { - this->field_0x74.HALF.LO = 0; - this->hitType = 0x2f; - InitAnimationForceUpdate(this, this->field_0x74.HALF.LO); + if (((VaatiRebornEnemyEntity*)parent)->unk_80 != 0) { + this->unk_74 = 0; + super->hitType = 0x2f; + InitAnimationForceUpdate(super, this->unk_74); } else { - if (((this->contactFlags & 0x80) != 0) && (0 < this->iframes)) { - parent->iframes = this->iframes; - parent->contactFlags = this->contactFlags; + if (((super->contactFlags & 0x80) != 0) && (0 < super->iframes)) { + parent->iframes = super->iframes; + parent->contactFlags = super->contactFlags; } - if ((this->frame & 0x40) != 0) { - InitAnimationForceUpdate(this, 2); + if ((super->frame & 0x40) != 0) { + InitAnimationForceUpdate(super, 2); } } } - if (this->field_0x74.HALF.HI == 0) { + if (this->unk_75 == 0) { if (parent->action != 2) { - this->field_0x74.HALF.HI = 1; - COLLISION_ON(this); + this->unk_75 = 1; + COLLISION_ON(super); } } else { if (parent->action == 2) { - this->field_0x74.HALF.HI = 0; - COLLISION_OFF(this); + this->unk_75 = 0; + COLLISION_OFF(super); } } - this->spriteSettings.draw = parent->spriteSettings.draw; - this->spriteOffsetX = parent->spriteOffsetX; - PositionRelative(this->parent, this, 0, Q_16_16(1.0)); - UpdateAnimationSingleFrame(this); + super->spriteSettings.draw = parent->spriteSettings.draw; + super->spriteOffsetX = parent->spriteOffsetX; + PositionRelative(super->parent, super, 0, Q_16_16(1.0)); + UpdateAnimationSingleFrame(super); } -void VaatiRebornEnemyType2Action0(Entity* this) { +void VaatiRebornEnemyType2Action0(VaatiRebornEnemyEntity* this) { Entity* source; - source = this->parent->parent; - this->action = 1; - this->field_0x74.HALF.LO = 1; - this->field_0x74.HALF.HI = 0; - this->spriteOffsetY = -2; - this->direction = DIR_NONE; - PositionRelative(source, this, 0, Q_16_16(2.0)); - InitAnimationForceUpdate(this, 2); + source = super->parent->parent; + super->action = 1; + this->unk_74 = 1; + this->unk_75 = 0; + super->spriteOffsetY = -2; + super->direction = DIR_NONE; + PositionRelative(source, super, 0, Q_16_16(2.0)); + InitAnimationForceUpdate(super, 2); } -void VaatiRebornEnemyType2Action1(Entity* this) { +void VaatiRebornEnemyType2Action1(VaatiRebornEnemyEntity* this) { u8 parentDirection; Entity* parent; - parent = this->parent; - if (parent->field_0x74.HALF.LO == 0) { - if (this->field_0x74.HALF.LO != 0) { - this->field_0x74.HALF.LO = 0; + parent = super->parent; + if (((VaatiRebornEnemyEntity*)parent)->unk_74 == 0) { + if (this->unk_74 != 0) { + this->unk_74 = 0; } parentDirection = parent->parent->direction; if (parentDirection != 0xff) { - if (this->field_0x74.HALF.HI == 0) { - this->field_0x74.HALF.HI = 1; + if (this->unk_75 == 0) { + this->unk_75 = 1; } - if (parentDirection != this->direction) { - this->direction = parentDirection; - InitAnimationForceUpdate(this, parentDirection >> 3); + if (parentDirection != super->direction) { + super->direction = parentDirection; + InitAnimationForceUpdate(super, parentDirection >> 3); } } else { - if (this->field_0x74.HALF.HI != 0) { - this->field_0x74.HALF.HI = 0; - InitAnimationForceUpdate(this, 0); + if (this->unk_75 != 0) { + this->unk_75 = 0; + InitAnimationForceUpdate(super, 0); } } } else { - if (this->field_0x74.HALF.LO == 0) { - this->field_0x74.HALF.LO = 1; - InitAnimationForceUpdate(this, 2); + if (this->unk_74 == 0) { + this->unk_74 = 1; + InitAnimationForceUpdate(super, 2); } } - this->spriteSettings.draw = parent->spriteSettings.draw; - this->spriteOffsetX = parent->spriteOffsetX; - PositionRelative(parent->parent, this, 0, Q_16_16(2.0)); - UpdateAnimationSingleFrame(this); + super->spriteSettings.draw = parent->spriteSettings.draw; + super->spriteOffsetX = parent->spriteOffsetX; + PositionRelative(parent->parent, super, 0, Q_16_16(2.0)); + UpdateAnimationSingleFrame(super); } -void VaatiRebornEnemyType3Action0(Entity* this) { - this->action = 1; - this->field_0x74.HALF.LO = 0; - this->direction = DIR_NONE; - this->spriteOffsetY = -1; - InitAnimationForceUpdate(this, this->field_0x74.HALF.LO); +void VaatiRebornEnemyType3Action0(VaatiRebornEnemyEntity* this) { + super->action = 1; + this->unk_74 = 0; + super->direction = DIR_NONE; + super->spriteOffsetY = -1; + InitAnimationForceUpdate(super, this->unk_74); sub_0803DC0C(this); } -void VaatiRebornEnemyType3Action1(Entity* this) { - Entity* parent = this->parent; +void VaatiRebornEnemyType3Action1(VaatiRebornEnemyEntity* this) { + Entity* parent = super->parent; - if (this->parent->direction != 0xff) { - if (this->field_0x74.HALF.LO == 0) { - this->field_0x74.HALF.LO = 1; + if (super->parent->direction != 0xff) { + if (this->unk_74 == 0) { + this->unk_74 = 1; } - if (parent->direction != this->direction) { - this->direction = parent->direction; - InitAnimationForceUpdate(this, this->direction >> 3); + if (parent->direction != super->direction) { + super->direction = parent->direction; + InitAnimationForceUpdate(super, super->direction >> 3); } } else { - if (this->field_0x74.HALF.LO != 0) { - this->field_0x74.HALF.LO = 0; - this->direction = DIR_NONE; - InitAnimationForceUpdate(this, 2); + if (this->unk_74 != 0) { + this->unk_74 = 0; + super->direction = DIR_NONE; + InitAnimationForceUpdate(super, 2); } } sub_0803DC0C(this); } -void sub_0803DC0C(Entity* this) { +void sub_0803DC0C(VaatiRebornEnemyEntity* this) { Entity* parent; const xy* tmp; - parent = this->parent; - tmp = &gUnk_080D04C8[this->timer]; - this->spriteSettings.draw = parent->spriteSettings.draw; - this->spriteOffsetX = parent->spriteOffsetX; - PositionRelative(parent, this, Q_16_16(tmp->x), Q_16_16(tmp->y + 1)); - UpdateAnimationSingleFrame(this); + parent = super->parent; + tmp = &gUnk_080D04C8[super->timer]; + super->spriteSettings.draw = parent->spriteSettings.draw; + super->spriteOffsetX = parent->spriteOffsetX; + PositionRelative(parent, super, Q_16_16(tmp->x), Q_16_16(tmp->y + 1)); + UpdateAnimationSingleFrame(super); } -void VaatiRebornEnemyType1PreAction(Entity* this) { +void VaatiRebornEnemyType1PreAction(VaatiRebornEnemyEntity* this) { Entity* parent; - if (this->hitType != 0x30) { + if (super->hitType != 0x30) { return; } - parent = this->parent; - this->field_0x76.HALF.HI = 0; - if ((this->contactFlags & 0x80) != 0) { - if (gUnk_080D04D0[parent->field_0x86.HALF.LO] > this->health) { - if (2 < ++parent->field_0x86.HALF.LO) { - COLLISION_OFF(this); + parent = super->parent; + this->unk_77 = 0; + if ((super->contactFlags & 0x80) != 0) { + if (gUnk_080D04D0[((VaatiRebornEnemyEntity*)parent)->unk_86] > super->health) { + if (2 < ++((VaatiRebornEnemyEntity*)parent)->unk_86) { + COLLISION_OFF(super); parent->action = 7; parent->flags &= ~ENT_COLLIDE; parent->timer = 128; parent->spriteOffsetX = 0; parent->direction = -1; - this->timer = 0; + super->timer = 0; SoundReq(SONG_STOP_BGM); gArea.bgm = gArea.queued_bgm; return; } - this->timer = 1; - this->field_0x76.HALF.HI = 0xff; + super->timer = 1; + this->unk_77 = 0xff; } - if (0 < this->iframes) { + if (0 < super->iframes) { SoundReq(SFX_BOSS_HIT); InitScreenShake(12, 1); - if (this->timer == 0) - this->timer = 72; + if (super->timer == 0) + super->timer = 72; } } - if (this->timer != 0) { - if (--this->timer == 0) { - this->hitType = 0x2f; - this->field_0x74.HALF.LO = 1; - if (this->field_0x76.HALF.HI == 0) { - parent->field_0x74.HALF.LO = 0xf0; + if (super->timer != 0) { + if (--super->timer == 0) { + super->hitType = 0x2f; + this->unk_74 = 1; + if (this->unk_77 == 0) { + ((VaatiRebornEnemyEntity*)parent)->unk_74 = 0xf0; } else { - parent->field_0x74.HALF.LO = 0x70; - this->health = 0xff; + ((VaatiRebornEnemyEntity*)parent)->unk_74 = 0x70; + super->health = 0xff; } parent->action = 1; parent->timer = 1; - InitAnimationForceUpdate(this, 0); + InitAnimationForceUpdate(super, 0); } } } -void sub_0803DD78(Entity* this) { +void sub_0803DD78(VaatiRebornEnemyEntity* this) { u32 random_number; random_number = ((u32)Random() & 0x7c) >> 2; - switch (this->field_0x86.HALF.LO) { + switch (this->unk_86) { case 0: - if (this->field_0x80.HALF.LO == 0) { - this->field_0x74.HALF.HI = 0; - this->field_0x76.HALF.HI = 0x50; + if (this->unk_80 == 0) { + this->unk_75 = 0; + this->unk_77 = 0x50; break; } - switch (this->field_0x82.HALF.HI) { + switch (this->unk_83) { case 0: case 2: case 4: - this->field_0x74.HALF.HI = 0; - this->field_0x76.HALF.HI = 0x50; + this->unk_75 = 0; + this->unk_77 = 0x50; break; case 1: case 3: case 5: - this->field_0x74.HALF.HI = 0; - this->field_0x76.HALF.HI = 1; + this->unk_75 = 0; + this->unk_77 = 1; break; default: break; } break; case 1: - switch (this->field_0x82.HALF.HI) { + switch (this->unk_83) { case 1: case 3: case 5: - this->field_0x74.HALF.HI = 0; - this->field_0x76.HALF.HI = 1; + this->unk_75 = 0; + this->unk_77 = 1; break; case 2: if ((random_number & 8) != 0) { - this->field_0x74.HALF.HI = 0; - this->field_0x76.HALF.HI = 1; + this->unk_75 = 0; + this->unk_77 = 1; } else { - this->field_0x74.HALF.HI = 0; - this->field_0x76.HALF.HI = 0x50; + this->unk_75 = 0; + this->unk_77 = 0x50; } break; case 4: if ((random_number & 8) != 0) { - this->field_0x74.HALF.HI = 0; - this->field_0x76.HALF.HI = 0x50; + this->unk_75 = 0; + this->unk_77 = 0x50; break; } case 0: - this->field_0x74.HALF.HI = 1; - this->field_0x76.HALF.HI = 1; + this->unk_75 = 1; + this->unk_77 = 1; break; default: break; } break; case 2: - switch (this->field_0x82.HALF.HI) { + switch (this->unk_83) { case 2: if ((random_number & 0xf) < 3) { - this->field_0x74.HALF.HI = 0; - this->field_0x76.HALF.HI = 1; + this->unk_75 = 0; + this->unk_77 = 1; } else { - this->field_0x74.HALF.HI = 1; - this->field_0x76.HALF.HI = 1; + this->unk_75 = 1; + this->unk_77 = 1; } break; case 0: - this->field_0x74.HALF.HI = 1; - this->field_0x76.HALF.HI = 1; + this->unk_75 = 1; + this->unk_77 = 1; break; case 4: if (9 < random_number) { - this->field_0x74.HALF.HI = 2; - this->field_0x76.HALF.HI = (Random() & 1) + 2; + this->unk_75 = 2; + this->unk_77 = (Random() & 1) + 2; break; } case 1: case 3: case 5: - this->field_0x74.HALF.HI = 0; - this->field_0x76.HALF.HI = 1; + this->unk_75 = 0; + this->unk_77 = 1; break; default: break; } } - this->field_0x82.HALF.HI = (this->field_0x82.HALF.HI + 1) % 6; + this->unk_83 = (this->unk_83 + 1) % 6; } -u32 sub_0803DEE0(Entity* this) { +u32 sub_0803DEE0(VaatiRebornEnemyEntity* this) { u32 randomValue; u32 ret; ret = 2; randomValue = (Random() & 0xf8) >> 3; - if (this->field_0x80.HALF.LO) { - switch (this->field_0x86.HALF.LO) { + if (this->unk_80) { + switch (this->unk_86) { case 0: - ret = this->field_0x82.HALF.LO & 1; - this->field_0x82.HALF.LO = (this->field_0x82.HALF.LO + 1) & 3; + ret = this->unk_82 & 1; + this->unk_82 = (this->unk_82 + 1) & 3; break; case 1: - switch (this->field_0x82.HALF.LO) { + switch (this->unk_82) { case 0: case 2: ret = 3; @@ -814,10 +832,10 @@ u32 sub_0803DEE0(Entity* this) { } break; } - this->field_0x82.HALF.LO = (this->field_0x82.HALF.LO + 1) % 5; + this->unk_82 = (this->unk_82 + 1) % 5; break; case 2: - switch (this->field_0x82.HALF.LO) { + switch (this->unk_82) { case 0: case 3: ret = 3; @@ -840,49 +858,49 @@ u32 sub_0803DEE0(Entity* this) { default: ret = 2; } - this->field_0x82.HALF.LO = (this->field_0x82.HALF.LO + 1) % 5; + this->unk_82 = (this->unk_82 + 1) % 5; break; } } return ret; } -void VaatiRebornEnemyType0PreAction(Entity* this) { +void VaatiRebornEnemyType0PreAction(VaatiRebornEnemyEntity* this) { u32 bVar1; - if (this->action != 0) { - *(u32*)&this->field_0x78 = this->x.WORD; - this->field_0x7c = this->y; + if (super->action != 0) { + this->unk_78 = super->x; + this->unk_7c = super->y; } - if (this->field_0x76.HALF.LO == 0) { - if ((this->direction == DIR_NONE) || sub_08049FA0(this)) { - if (this->field_0x80.HALF.LO == 0) { - this->animationState = (this->animationState + 1) & 3; - this->spriteOffsetX = gUnk_080D04D3[this->animationState]; + if (this->unk_76 == 0) { + if ((super->direction == DIR_NONE) || sub_08049FA0(super)) { + if (this->unk_80 == 0) { + super->animationState = (super->animationState + 1) & 3; + super->spriteOffsetX = gUnk_080D04D3[super->animationState]; } return; } - bVar1 = sub_08049EE4(this); - this->direction = (bVar1 & 0x10) | DirectionEast; - this->field_0x76.HALF.LO = 0x10; + bVar1 = sub_08049EE4(super); + super->direction = (bVar1 & 0x10) | DirectionEast; + this->unk_76 = 0x10; } else { - this->field_0x76.HALF.LO--; + this->unk_76--; } - if (this->field_0x80.HALF.LO == 0) { - this->animationState = (this->animationState + 1) & 3; - this->spriteOffsetX = gUnk_080D04D3[this->animationState]; + if (this->unk_80 == 0) { + super->animationState = (super->animationState + 1) & 3; + super->spriteOffsetX = gUnk_080D04D3[super->animationState]; } } -u32 sub_0803E028(Entity* this) { +u32 sub_0803E028(VaatiRebornEnemyEntity* this) { u32 ret; s32 tmp; ret = 0; - if ((this->field_0x74.HALF.HI != 2) && ((Random() & 1) != 0)) { + if ((this->unk_75 != 2) && ((Random() & 1) != 0)) { return 0; } - if (this->field_0x76.HALF.HI != 1) { + if (this->unk_77 != 1) { return ret; } tmp = gRoomControls.origin_x + 0x58; @@ -895,7 +913,7 @@ u32 sub_0803E028(Entity* this) { } tmp = gRoomControls.origin_y + 0xf8; if (tmp >= gPlayerEntity.x.HALF.HI) { - this->field_0x80.HALF.HI += 5; + this->unk_81 += 5; ret = 1; } return ret; diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 3a6040d4..60912eae 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -4,41 +4,65 @@ * * @brief Vaati Transfigured enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "object.h" -void sub_080409B0(Entity*); -void sub_080408EC(Entity*); -void sub_08040AD4(Entity*); -void sub_08040670(Entity*); -void sub_080406A0(Entity*); -void sub_08040770(Entity*); -extern void Knockback1(Entity*); -u32 sub_08040934(Entity*); -void sub_08040648(Entity*, u32, u32); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[5]; + /*0x6d*/ u8 unk_6d; + /*0x6e*/ u8 unused2[6]; + /*0x74*/ u8 unk_74; + /*0x75*/ u8 unk_75; + /*0x76*/ u8 unk_76; + /*0x77*/ u8 unk_77; + /*0x78*/ u16 unk_78; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ u16 unk_7c; + /*0x7e*/ u16 unk_7e; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unused3[1]; + /*0x84*/ u8 unk_84; + /*0x85*/ u8 unused4[1]; + /*0x86*/ u8 unk_86; + /*0x87*/ u8 unk_87; +} VaatiTransfiguredEntity; -void VaatiTransfiguredType0Action0(Entity*); -void VaatiTransfiguredType0Action1(Entity*); -void VaatiTransfiguredType0Action2(Entity*); -void VaatiTransfiguredType0Action3(Entity*); -void VaatiTransfiguredType0Action4(Entity*); -void VaatiTransfiguredType0Action5(Entity*); -void VaatiTransfiguredType0Action6(Entity*); -void VaatiTransfiguredType0Action7(Entity*); -void VaatiTransfiguredType1Action0(Entity*); -void VaatiTransfiguredType1Action1(Entity*); -void VaatiTransfiguredType2Action0(Entity*); -void VaatiTransfiguredType2Action1(Entity*); -void VaatiTransfiguredType2Action2(Entity*); -void VaatiTransfiguredType3Action0(Entity*); -void VaatiTransfiguredType3Action1(Entity*); -void VaatiTransfiguredType4Action0(Entity*); -void VaatiTransfiguredType4Action1(Entity*); -void VaatiTransfiguredType5Action0(Entity*); -void VaatiTransfiguredType5Action1(Entity*); -void VaatiTransfiguredType5Action2(Entity*); +extern void Knockback1(Entity*); + +void sub_080409B0(VaatiTransfiguredEntity*); +void sub_080408EC(VaatiTransfiguredEntity*); +void sub_08040AD4(VaatiTransfiguredEntity*); +void sub_08040670(VaatiTransfiguredEntity*); +void sub_080406A0(VaatiTransfiguredEntity*); +void sub_08040770(VaatiTransfiguredEntity*); +u32 sub_08040934(VaatiTransfiguredEntity*); +void sub_08040648(VaatiTransfiguredEntity*, u32, u32); + +void VaatiTransfiguredType0Action0(VaatiTransfiguredEntity*); +void VaatiTransfiguredType0Action1(VaatiTransfiguredEntity*); +void VaatiTransfiguredType0Action2(VaatiTransfiguredEntity*); +void VaatiTransfiguredType0Action3(VaatiTransfiguredEntity*); +void VaatiTransfiguredType0Action4(VaatiTransfiguredEntity*); +void VaatiTransfiguredType0Action5(VaatiTransfiguredEntity*); +void VaatiTransfiguredType0Action6(VaatiTransfiguredEntity*); +void VaatiTransfiguredType0Action7(VaatiTransfiguredEntity*); +void VaatiTransfiguredType1Action0(VaatiTransfiguredEntity*); +void VaatiTransfiguredType1Action1(VaatiTransfiguredEntity*); +void VaatiTransfiguredType2Action0(VaatiTransfiguredEntity*); +void VaatiTransfiguredType2Action1(VaatiTransfiguredEntity*); +void VaatiTransfiguredType2Action2(VaatiTransfiguredEntity*); +void VaatiTransfiguredType3Action0(VaatiTransfiguredEntity*); +void VaatiTransfiguredType3Action1(VaatiTransfiguredEntity*); +void VaatiTransfiguredType4Action0(VaatiTransfiguredEntity*); +void VaatiTransfiguredType4Action1(VaatiTransfiguredEntity*); +void VaatiTransfiguredType5Action0(VaatiTransfiguredEntity*); +void VaatiTransfiguredType5Action1(VaatiTransfiguredEntity*); +void VaatiTransfiguredType5Action2(VaatiTransfiguredEntity*); typedef struct { s8 x; @@ -51,29 +75,29 @@ const u8 gUnk_080D0ABC[] = { 0xf0, 0xd0, 0xb0 }; const u8 gUnk_080D0ABC[] = { 0xf0, 0xd0, 0xc0 }; #endif const u8 gUnk_080D0ABF[] = { 0x3c, 0x3c, 0x1e, 0x14, 0x14, 0x14, 0, 0, 0 }; -void (*const vaatiTransfiguredType0Actions[])(Entity*) = { +void (*const vaatiTransfiguredType0Actions[])(VaatiTransfiguredEntity*) = { VaatiTransfiguredType0Action0, VaatiTransfiguredType0Action1, VaatiTransfiguredType0Action2, VaatiTransfiguredType0Action3, VaatiTransfiguredType0Action4, VaatiTransfiguredType0Action5, VaatiTransfiguredType0Action6, VaatiTransfiguredType0Action7, }; -void (*const vaatiTransfiguredType1Actions[])(Entity*) = { +void (*const vaatiTransfiguredType1Actions[])(VaatiTransfiguredEntity*) = { VaatiTransfiguredType1Action0, VaatiTransfiguredType1Action1, }; -void (*const vaatiTransfiguredType2Actions[])(Entity*) = { +void (*const vaatiTransfiguredType2Actions[])(VaatiTransfiguredEntity*) = { VaatiTransfiguredType2Action0, VaatiTransfiguredType2Action1, VaatiTransfiguredType2Action2, }; -void (*const vaatiTransfiguredType3Actions[])(Entity*) = { +void (*const vaatiTransfiguredType3Actions[])(VaatiTransfiguredEntity*) = { VaatiTransfiguredType3Action0, VaatiTransfiguredType3Action1, }; -void (*const vaatiTransfiguredType4Actions[])(Entity*) = { +void (*const vaatiTransfiguredType4Actions[])(VaatiTransfiguredEntity*) = { VaatiTransfiguredType4Action0, VaatiTransfiguredType4Action1, }; -void (*const vaatiTransfiguredType5Actions[])(Entity*) = { +void (*const vaatiTransfiguredType5Actions[])(VaatiTransfiguredEntity*) = { VaatiTransfiguredType5Action0, VaatiTransfiguredType5Action1, VaatiTransfiguredType5Action2, @@ -98,63 +122,63 @@ const u8 gUnk_080D0B84[] = { 0x01, 0x00, 0x01, 0x02, 0x00, 0x01, 0x02, 0x00, 0x0 0x01, 0x02, 0x01, 0x00, 0x02, 0x01, 0x02, 0x00, 0x01, 0x02, 0x01, 0x02, 0x00, 0x02, 0x01, 0x00, 0x01, 0x01, 0x00, 0x02, 0x00 }; -void VaatiTransfigured(Entity* this) { - switch (this->type) { +void VaatiTransfigured(VaatiTransfiguredEntity* this) { + switch (super->type) { case 0: - if (this->action != 0) { - this->field_0x7a.HWORD = this->field_0x78.HWORD; - this->field_0x78.HWORD = this->x.HALF.HI; - this->field_0x7c.HALF.HI = this->field_0x7c.HALF.LO; - this->field_0x7c.HALF.LO = this->y.HALF.HI; + if (super->action != 0) { + this->unk_7a = this->unk_78; + this->unk_78 = super->x.HALF.HI; + this->unk_7e = this->unk_7c; + this->unk_7c = super->y.HALF.HI; sub_080409B0(this); } - vaatiTransfiguredType0Actions[this->action](this); + vaatiTransfiguredType0Actions[super->action](this); break; case 1: - vaatiTransfiguredType1Actions[this->action](this); + vaatiTransfiguredType1Actions[super->action](this); break; case 2: - vaatiTransfiguredType2Actions[this->action](this); + vaatiTransfiguredType2Actions[super->action](this); break; case 3: - vaatiTransfiguredType3Actions[this->action](this); + vaatiTransfiguredType3Actions[super->action](this); break; case 4: - vaatiTransfiguredType4Actions[this->action](this); + vaatiTransfiguredType4Actions[super->action](this); break; case 5: - vaatiTransfiguredType5Actions[this->action](this); + vaatiTransfiguredType5Actions[super->action](this); return; default: break; } } -void VaatiTransfiguredType0Action0(Entity* this) { +void VaatiTransfiguredType0Action0(VaatiTransfiguredEntity* this) { Entity* enemy; u32 i; - sub_0804A720(this); + sub_0804A720(super); if ((CheckRoomFlag(0) != 0) && (gEntCount < 0x51)) { - this->action = 1; - this->spriteSettings.draw = 1; - this->spritePriority.b0 = 5; - this->field_0x6c.HALF.HI |= 1; - this->direction = (Random() & 0x17) + 4; - this->timer = 48; - this->subtimer = 12; - this->field_0x82.HALF.LO = 4; - this->field_0x80.HALF.LO = 0xff; - this->field_0x74.HALF.LO = 0; - this->field_0x76.HALF.HI = 0; - this->cutsceneBeh.HALF.LO = 9; - this->animationState = 0; - this->field_0x86.HALF.LO = 0; - this->field_0x86.HALF.HI = 0; - this->field_0x78.HWORD = this->x.HALF.HI; - this->field_0x7a.HWORD = this->x.HALF.HI; - this->field_0x7c.HALF.LO = this->y.HALF.HI; - this->field_0x7c.HALF.HI = this->y.HALF.HI; + super->action = 1; + super->spriteSettings.draw = 1; + super->spritePriority.b0 = 5; + this->unk_6d |= 1; + super->direction = (Random() & 0x17) + 4; + super->timer = 48; + super->subtimer = 12; + this->unk_82 = 4; + this->unk_80 = 0xff; + this->unk_74 = 0; + this->unk_77 = 0; + this->unk_84 = 9; + super->animationState = 0; + this->unk_86 = 0; + this->unk_87 = 0; + this->unk_78 = super->x.HALF.HI; + this->unk_7a = super->x.HALF.HI; + this->unk_7c = super->y.HALF.HI; + this->unk_7e = super->y.HALF.HI; for (i = 1; i < 6; i++) { sub_08040648(this, i, 0); } @@ -162,71 +186,71 @@ void VaatiTransfiguredType0Action0(Entity* this) { sub_080408EC(this); for (i = 0; i < 8; ++i) { enemy = CreateEnemy(VAATI_TRANSFIGURED_EYE, 0); - enemy->parent = this; + enemy->parent = super; enemy->type2 = i; - if ((this->field_0x74.HALF.HI >> (i)&1) != 0) { + if ((this->unk_75 >> (i)&1) != 0) { enemy->timer = 1; } else { enemy->timer = 0; } } - InitAnimationForceUpdate(this, 0); + InitAnimationForceUpdate(super, 0); } } -void VaatiTransfiguredType0Action1(Entity* this) { +void VaatiTransfiguredType0Action1(VaatiTransfiguredEntity* this) { Entity* object; - switch (this->field_0x80.HALF.LO) { + switch (this->unk_80) { case 0xff: - if (--this->timer == 0) { - this->field_0x80.HALF.LO = 0; - this->timer = 11; + if (--super->timer == 0) { + this->unk_80 = 0; + super->timer = 11; } break; case 0: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->speed = 0x180; - this->timer = 20; + if (--super->timer == 0) { + this->unk_80++; + super->speed = 0x180; + super->timer = 20; } break; case 1: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->speed = 0xc0; - this->timer = 12; + if (--super->timer == 0) { + this->unk_80++; + super->speed = 0xc0; + super->timer = 12; } break; case 2: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->speed = 0; - if (this->animationState < 2) { - this->timer = (Random() & 0x7f) + 64; + if (--super->timer == 0) { + this->unk_80++; + super->speed = 0; + if (super->animationState < 2) { + super->timer = (Random() & 0x7f) + 64; } else { - this->timer = 8; + super->timer = 8; } } break; case 3: - if (--this->timer == 0) { - this->z.HALF.HI = 0; - this->field_0x80.HALF.LO = 0; - this->timer = gUnk_080D0ABF[(u32)this->animationState * 2]; + if (--super->timer == 0) { + super->z.HALF.HI = 0; + this->unk_80 = 0; + super->timer = gUnk_080D0ABF[(u32)super->animationState * 2]; switch (sub_08040934(this)) { case 1: - this->action = 4; - this->field_0x74.HALF.LO = 1; + super->action = 4; + this->unk_74 = 1; break; case 2: - this->action = 5; + super->action = 5; break; case 3: - this->action = 6; + super->action = 6; break; default: - this->field_0x80.HALF.LO = 4; + this->unk_80 = 4; break; } } else { @@ -238,62 +262,62 @@ void VaatiTransfiguredType0Action1(Entity* this) { break; } - if (--this->field_0x82.HALF.LO == 0) { - this->field_0x82.HALF.LO = 4; - object = CreateObject(VAATI2_PARTICLE, 0, ((this->direction + 0x12) & 0x1c) >> 2); + if (--this->unk_82 == 0) { + this->unk_82 = 4; + object = CreateObject(VAATI2_PARTICLE, 0, ((super->direction + 0x12) & 0x1c) >> 2); if (object != NULL) { - object->parent = this; + object->parent = super; object->x.HALF.HI += (Random() & 0xf) - 7; object->y.HALF.HI += (Random() & 0xf) - 7; object->spritePriority.b0 = 6; } } - if (this->field_0x80.HALF.LO != 0xff) { - ProcessMovement0(this); + if (this->unk_80 != 0xff) { + ProcessMovement0(super); } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiTransfiguredType0Action2(Entity* this) { - UpdateAnimationSingleFrame(this); +void VaatiTransfiguredType0Action2(VaatiTransfiguredEntity* this) { + UpdateAnimationSingleFrame(super); } -void VaatiTransfiguredType0Action3(Entity* this) { +void VaatiTransfiguredType0Action3(VaatiTransfiguredEntity* this) { Entity* pEVar3; u32 uVar4; u32 tmp; - switch (this->field_0x80.HALF.LO) { + switch (this->unk_80) { case 0: - uVar4 = sub_080044EC(this, 0x2800); + uVar4 = sub_080044EC(super, 0x2800); if (uVar4 != 1) break; - this->field_0x80.HALF.LO = 1; - this->timer = 192; - COLLISION_ON(this); + this->unk_80 = 1; + super->timer = 192; + COLLISION_ON(super); SoundReq(SFX_14C); InitScreenShake(20, 4); break; case 1: - if (--this->timer == 0) { - this->field_0x80.HALF.LO = 2; - this->hitType = 0x35; - this->spriteOffsetX = 0; + if (--super->timer == 0) { + this->unk_80 = 2; + super->hitType = 0x35; + super->spriteOffsetX = 0; } - if (this->health < gUnk_080D0ABC[this->animationState]) { + if (super->health < gUnk_080D0ABC[super->animationState]) { tmp = 1; - this->timer = 1; + super->timer = 1; } else { tmp = 0; } if (tmp) { - this->field_0x80.HALF.LO = 2; - this->hitType = 0x35; - this->spriteOffsetX = 0; - this->animationState++; - if (this->animationState > 2) { - this->action = 7; - this->timer = 224; + this->unk_80 = 2; + super->hitType = 0x35; + super->spriteOffsetX = 0; + super->animationState++; + if (super->animationState > 2) { + super->action = 7; + super->timer = 224; DeleteClones(); SoundReq(SFX_BOSS_HIT); return; @@ -301,39 +325,39 @@ void VaatiTransfiguredType0Action3(Entity* this) { } break; case 2: - this->child->field_0x74.HALF.LO = 0x10; - if (this->timer) { - this->field_0x80.HALF.LO = 3; - this->timer = 64; + ((VaatiTransfiguredEntity*)super->child)->unk_74 = 0x10; + if (super->timer) { + this->unk_80 = 3; + super->timer = 64; } else { - this->field_0x80.HALF.LO = 4; - this->timer = 80; + this->unk_80 = 4; + super->timer = 80; } break; case 3: - if (this->timer != 0) { - if (--this->timer == 0) { - COLLISION_OFF(this); - this->zVelocity = Q_16_16(3.5); - this->subtimer = 16; + if (super->timer != 0) { + if (--super->timer == 0) { + COLLISION_OFF(super); + super->zVelocity = Q_16_16(3.5); + super->subtimer = 16; } break; } - if (GravityUpdate(this, Q_8_8(40.0)) == 0) { - this->field_0x80.HALF.LO = 5; - this->timer = 16; - COLLISION_ON(this); - this->health = 0xff; - this->field_0x86.HALF.LO = 0; + if (GravityUpdate(super, Q_8_8(40.0)) == 0) { + this->unk_80 = 5; + super->timer = 16; + COLLISION_ON(super); + super->health = 0xff; + this->unk_86 = 0; sub_080408EC(this); SoundReq(SFX_14C); InitScreenShake(30, 4); } else { - if (this->subtimer != 0) { - if (--this->subtimer == 0) { + if (super->subtimer != 0) { + if (--super->subtimer == 0) { SoundReq(SFX_1B0); } else { - if ((this->subtimer & 7) == 0) { + if ((super->subtimer & 7) == 0) { SoundReq(SFX_149); } } @@ -341,15 +365,15 @@ void VaatiTransfiguredType0Action3(Entity* this) { } break; case 4: - if (--this->timer == 0) { - this->field_0x80.HALF.LO = 5; - this->timer = 16; - this->field_0x86.HALF.LO = 0; + if (--super->timer == 0) { + this->unk_80 = 5; + super->timer = 16; + this->unk_86 = 0; sub_080408EC(this); } else { - if (((this->timer & 1) != 0) && (pEVar3 = CreateObject(VAATI2_PARTICLE, 1, 0xff), pEVar3 != NULL)) { - pEVar3->parent = this; - CopyPosition(this, pEVar3); + if (((super->timer & 1) != 0) && (pEVar3 = CreateObject(VAATI2_PARTICLE, 1, 0xff), pEVar3 != NULL)) { + pEVar3->parent = super; + CopyPosition(super, pEVar3); pEVar3->x.HALF.HI += (Random() & 0xf) - 7; pEVar3->y.HALF.HI += (Random() & 0xf) - 7; pEVar3->spritePriority.b0 = 4; @@ -358,74 +382,74 @@ void VaatiTransfiguredType0Action3(Entity* this) { } break; case 5: - if (--this->timer == 0) { - this->action = 1; - this->field_0x80.HALF.LO = 0; - this->field_0x80.HALF.HI = 0; - this->field_0x76.HALF.LO = 0; + if (--super->timer == 0) { + super->action = 1; + this->unk_80 = 0; + this->unk_81 = 0; + this->unk_76 = 0; sub_08040670(this); } } - if (this->field_0x80.HALF.LO > 2) { - this->spriteOffsetX = this->timer & 1; + if (this->unk_80 > 2) { + super->spriteOffsetX = super->timer & 1; } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiTransfiguredType0Action4(Entity* this) { - switch (this->field_0x80.HALF.LO) { +void VaatiTransfiguredType0Action4(VaatiTransfiguredEntity* this) { + switch (this->unk_80) { case 0: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->field_0x74.HALF.LO = 0; - this->timer = 128; - this->subtimer = 0; - this->zVelocity = Q_16_16(2.25); + if (--super->timer == 0) { + this->unk_80++; + this->unk_74 = 0; + super->timer = 128; + super->subtimer = 0; + super->zVelocity = Q_16_16(2.25); SoundReq(SFX_12B); } break; case 1: - if (GravityUpdate(this, Q_8_8(40)) != 0) + if (GravityUpdate(super, Q_8_8(40)) != 0) break; - this->field_0x80.HALF.LO++; - switch (this->cutsceneBeh.HALF.LO) { + this->unk_80++; + switch (this->unk_84) { case 1: case 3: - this->subtimer = 1; + super->subtimer = 1; break; case 0: case 2: - this->subtimer = 0; + super->subtimer = 0; break; default: - this->subtimer = (Random() & 0x20) >> 5; + super->subtimer = (Random() & 0x20) >> 5; break; } - if (1 < this->animationState) { - this->subtimer = 1; + if (1 < super->animationState) { + super->subtimer = 1; } SoundReq(SFX_14C); InitScreenShake(30, 4); break; case 2: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->timer = gUnk_080D0ABF[((u32)this->animationState << 1 | 1)]; + if (--super->timer == 0) { + this->unk_80++; + super->timer = gUnk_080D0ABF[((u32)super->animationState << 1 | 1)]; } else { - if ((this->timer & 7) == 0) { - CreateProjectileWithParent(this, V2_PROJECTILE, this->subtimer); + if ((super->timer & 7) == 0) { + CreateProjectileWithParent(super, V2_PROJECTILE, super->subtimer); } - if (((this->subtimer != 0) && (1 < this->animationState)) && (this->timer < 6)) { - this->timer = 128; - this->subtimer = 0; + if (((super->subtimer != 0) && (1 < super->animationState)) && (super->timer < 6)) { + super->timer = 128; + super->subtimer = 0; } } break; case 3: - if (--this->timer == 0) { - this->action = 1; - this->field_0x80.HALF.LO = 0; - this->z.HALF.HI = 0; + if (--super->timer == 0) { + super->action = 1; + this->unk_80 = 0; + super->z.HALF.HI = 0; sub_08040670(this); } else { sub_08040AD4(this); @@ -435,42 +459,42 @@ void VaatiTransfiguredType0Action4(Entity* this) { break; } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiTransfiguredType0Action5(Entity* this) { +void VaatiTransfiguredType0Action5(VaatiTransfiguredEntity* this) { Entity* entity; - switch (this->field_0x80.HALF.LO) { + switch (this->unk_80) { case 0: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->timer = 64; - if (1 < this->animationState) { - this->timer = 128; - this->subtimer = 1; + if (--super->timer == 0) { + this->unk_80++; + super->timer = 64; + if (1 < super->animationState) { + super->timer = 128; + super->subtimer = 1; } } break; case 1: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->timer = gUnk_080D0ABF[(this->animationState << 1 | 1)]; + if (--super->timer == 0) { + this->unk_80++; + super->timer = gUnk_080D0ABF[(super->animationState << 1 | 1)]; } else { - if (this->subtimer) { - if ((this->timer & 7) == 0) { - CreateProjectileWithParent(this, V2_PROJECTILE, this->subtimer); + if (super->subtimer) { + if ((super->timer & 7) == 0) { + CreateProjectileWithParent(super, V2_PROJECTILE, super->subtimer); } - if (this->timer < 6) { - this->timer = 64; - this->subtimer = 0; + if (super->timer < 6) { + super->timer = 64; + super->subtimer = 0; } } else { - if ((this->timer & 0xf) == 0) { - entity = CreateProjectileWithParent(this, V2_PROJECTILE, 2); + if ((super->timer & 0xf) == 0) { + entity = CreateProjectileWithParent(super, V2_PROJECTILE, 2); if (entity != NULL) { entity->type2 = 0; - if (this->field_0x80.HALF.HI != 0) { + if (this->unk_81 != 0) { entity->speed = entity->speed >> 1; } } @@ -479,51 +503,51 @@ void VaatiTransfiguredType0Action5(Entity* this) { } break; case 2: - if (--this->timer == 0) { - this->action = 1; - this->field_0x80.HALF.LO = 0; + if (--super->timer == 0) { + super->action = 1; + this->unk_80 = 0; sub_08040670(this); } else { sub_08040AD4(this); } break; } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiTransfiguredType0Action6(Entity* this) { +void VaatiTransfiguredType0Action6(VaatiTransfiguredEntity* this) { Entity* pEVar2; - switch (this->field_0x80.HALF.LO) { + switch (this->unk_80) { case 0: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->timer = 128; - if (1 < this->animationState) { - this->subtimer = 1; + if (--super->timer == 0) { + this->unk_80++; + super->timer = 128; + if (1 < super->animationState) { + super->subtimer = 1; } } break; case 1: - if (--this->timer == 0) { - this->field_0x80.HALF.LO++; - this->timer = gUnk_080D0ABF[(this->animationState << 1) | 1]; + if (--super->timer == 0) { + this->unk_80++; + super->timer = gUnk_080D0ABF[(super->animationState << 1) | 1]; } else { - if (this->subtimer) { - if ((this->timer & 7) == 0) { - CreateProjectileWithParent(this, V2_PROJECTILE, this->subtimer); + if (super->subtimer) { + if ((super->timer & 7) == 0) { + CreateProjectileWithParent(super, V2_PROJECTILE, super->subtimer); } - if (this->timer < 6) { - this->timer = 128; - this->subtimer = 0; + if (super->timer < 6) { + super->timer = 128; + super->subtimer = 0; } } else { - if ((this->timer & 0x1f) == 0) { - pEVar2 = CreateProjectileWithParent(this, V2_PROJECTILE, 2); + if ((super->timer & 0x1f) == 0) { + pEVar2 = CreateProjectileWithParent(super, V2_PROJECTILE, 2); if (pEVar2 != NULL) { pEVar2->type2 = 1; pEVar2->y.HALF.HI += -0x20; - if (this->field_0x80.HALF.HI != 0) { + if (this->unk_81 != 0) { pEVar2->speed = pEVar2->speed >> 1; } } @@ -532,44 +556,44 @@ void VaatiTransfiguredType0Action6(Entity* this) { } break; case 2: - if (--this->timer == 0) { - this->action = 1; - this->field_0x80.HALF.LO = 0; + if (--super->timer == 0) { + super->action = 1; + this->unk_80 = 0; sub_08040670(this); } else { sub_08040AD4(this); } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiTransfiguredType0Action7(Entity* this) { +void VaatiTransfiguredType0Action7(VaatiTransfiguredEntity* this) { Entity* pEVar3; u32 uVar4; PausePlayer(); - if (this->timer) { - if (--this->timer == 0) { + if (super->timer) { + if (--super->timer == 0) { SetRoomFlag(2); - this->subtimer = 8; - UpdateAnimationSingleFrame(this); + super->subtimer = 8; + UpdateAnimationSingleFrame(super); return; } } else { - if (this->subtimer != 0) { - if (--this->subtimer == 0) { - this->health = 0; - this->spriteSettings.draw = 0; + if (super->subtimer != 0) { + if (--super->subtimer == 0) { + super->health = 0; + super->spriteSettings.draw = 0; } } else { - GenericDeath(this); + GenericDeath(super); } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); return; } - this->subtimer = (this->subtimer + 1) & 7; - if (this->subtimer == 0) { - pEVar3 = CreateFx(this, FX_AURA_BASE, 0); + super->subtimer = (super->subtimer + 1) & 7; + if (super->subtimer == 0) { + pEVar3 = CreateFx(super, FX_AURA_BASE, 0); if (pEVar3 != NULL) { uVar4 = Random() & 0x3f3f; pEVar3->x.HALF.HI += (uVar4 & 0xff) - 0x20; @@ -580,279 +604,279 @@ void VaatiTransfiguredType0Action7(Entity* this) { SoundReq(SFX_16E); } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiTransfiguredType1Action0(Entity* this) { - this->action = 1; - this->timer = 0; - this->field_0x80.HALF.LO = 0; - this->spritePriority.b0 = 6; - InitAnimationForceUpdate(this, (u32)this->timer); +void VaatiTransfiguredType1Action0(VaatiTransfiguredEntity* this) { + super->action = 1; + super->timer = 0; + this->unk_80 = 0; + super->spritePriority.b0 = 6; + InitAnimationForceUpdate(super, (u32)super->timer); } -void VaatiTransfiguredType1Action1(Entity* this) { +void VaatiTransfiguredType1Action1(VaatiTransfiguredEntity* this) { Entity* parent; - parent = this->parent; + parent = super->parent; if (parent->health == 0) { - this->field_0x6c.HALF.HI |= 2; + this->unk_6d |= 2; DeleteThisEntity(); } - this->x.HALF.HI = parent->field_0x7a.HWORD; - this->y.HALF.HI = parent->field_0x7c.HALF.HI; - if (parent->field_0x74.HALF.LO == 0) { - UpdateAnimationSingleFrame(this); + super->x.HALF.HI = ((VaatiTransfiguredEntity*)parent)->unk_7a; + super->y.HALF.HI = ((VaatiTransfiguredEntity*)parent)->unk_7e; + if (((VaatiTransfiguredEntity*)parent)->unk_74 == 0) { + UpdateAnimationSingleFrame(super); } else { - sub_080042BA(this, 2); + sub_080042BA(super, 2); } if (parent->action >= 5) { - if (this->timer == 0) { - this->timer = 1; - InitAnimationForceUpdate(this, 1); + if (super->timer == 0) { + super->timer = 1; + InitAnimationForceUpdate(super, 1); } } else { - if (this->timer != 0) { - this->timer = 0; - InitAnimationForceUpdate(this, 0); + if (super->timer != 0) { + super->timer = 0; + InitAnimationForceUpdate(super, 0); } } if (parent->action != 3) { - this->z.HALF.HI = parent->z.HALF.HI; + super->z.HALF.HI = parent->z.HALF.HI; } } -void VaatiTransfiguredType2Action0(Entity* this) { - if (this->type2 != 0) { - this->action = 1; - this->spritePriority.b0 = this->type2 + 1; - InitAnimationForceUpdate(this, this->type2 + 4); +void VaatiTransfiguredType2Action0(VaatiTransfiguredEntity* this) { + if (super->type2 != 0) { + super->action = 1; + super->spritePriority.b0 = super->type2 + 1; + InitAnimationForceUpdate(super, super->type2 + 4); } else { - this->spritePriority.b0 = 4; + super->spritePriority.b0 = 4; if (gEntCount < 0x46) { sub_08040648(this, 2, 1); sub_08040648(this, 2, 2); - this->action = 1; - this->timer = 0; - this->subtimer = (Random() & 0x7f) + 23; - this->field_0x74.HALF.LO = 0; - InitAnimationForceUpdate(this, 0); + super->action = 1; + super->timer = 0; + super->subtimer = (Random() & 0x7f) + 23; + this->unk_74 = 0; + InitAnimationForceUpdate(super, 0); } } } -void VaatiTransfiguredType2Action1(Entity* this) { +void VaatiTransfiguredType2Action1(VaatiTransfiguredEntity* this) { u32 uVar3; const xy* t; - if (this->parent->health == 0) { - this->field_0x6c.HALF.HI |= 2; + if (super->parent->health == 0) { + this->unk_6d |= 2; DeleteThisEntity(); } - CopyPosition(this->parent, this); - switch (this->type2) { + CopyPosition(super->parent, super); + switch (super->type2) { case 2: - uVar3 = GetFacingDirection(this, &gPlayerEntity); + uVar3 = GetFacingDirection(super, &gPlayerEntity); t = &gUnk_080D0B18[uVar3]; - this->x.HALF.HI += t->x; - this->y.HALF.HI += t->y; + super->x.HALF.HI += t->x; + super->y.HALF.HI += t->y; case 1: - if (this->parent->frameIndex != 2) { - this->action = 2; - this->spriteSettings.draw = 0; + if (super->parent->frameIndex != 2) { + super->action = 2; + super->spriteSettings.draw = 0; } break; case 0: - switch (this->field_0x74.HALF.LO) { + switch (this->unk_74) { case 0: - if (--this->subtimer == 0) { - this->subtimer = (Random() & 0x7f) + 39; - if ((this->subtimer & 1) != 0) { - this->field_0x74.HALF.LO = 1; - InitAnimationForceUpdate(this, 8); + if (--super->subtimer == 0) { + super->subtimer = (Random() & 0x7f) + 39; + if ((super->subtimer & 1) != 0) { + this->unk_74 = 1; + InitAnimationForceUpdate(super, 8); } } break; case 1: - if ((this->frame & ANIM_DONE) != 0) { - this->field_0x74.HALF.LO = 0; - this->subtimer = (Random() & 0x7f) + 23; - InitAnimationForceUpdate(this, 0); + if ((super->frame & ANIM_DONE) != 0) { + this->unk_74 = 0; + super->subtimer = (Random() & 0x7f) + 23; + InitAnimationForceUpdate(super, 0); } break; case 0x10: - InitAnimationForceUpdate(this, 7); - this->field_0x74.HALF.LO = 0x11; - this->subtimer = 80; + InitAnimationForceUpdate(super, 7); + this->unk_74 = 0x11; + super->subtimer = 80; break; case 0x11: - if (--this->subtimer == 0) { - this->field_0x74.HALF.LO = 1; - this->subtimer = 48; - InitAnimationForceUpdate(this, 8); + if (--super->subtimer == 0) { + this->unk_74 = 1; + super->subtimer = 48; + InitAnimationForceUpdate(super, 8); } } break; } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiTransfiguredType2Action2(Entity* this) { - if (this->parent->health == 0) { - this->field_0x6c.HALF.HI |= 2; +void VaatiTransfiguredType2Action2(VaatiTransfiguredEntity* this) { + if (super->parent->health == 0) { + this->unk_6d |= 2; DeleteThisEntity(); } - CopyPosition(this->parent, this); - if (this->parent->frameIndex == 2) { - this->action = 1; - this->spriteSettings.draw = 1; + CopyPosition(super->parent, super); + if (super->parent->frameIndex == 2) { + super->action = 1; + super->spriteSettings.draw = 1; } } -void VaatiTransfiguredType3Action0(Entity* this) { - this->action = 1; - this->spritePriority.b0 = 4; - InitAnimationForceUpdate(this, 0); +void VaatiTransfiguredType3Action0(VaatiTransfiguredEntity* this) { + super->action = 1; + super->spritePriority.b0 = 4; + InitAnimationForceUpdate(super, 0); } -void VaatiTransfiguredType3Action1(Entity* this) { - if (this->parent->health == 0) { - this->field_0x6c.HALF.HI |= 2; +void VaatiTransfiguredType3Action1(VaatiTransfiguredEntity* this) { + if (super->parent->health == 0) { + this->unk_6d |= 2; DeleteThisEntity(); } - CopyPosition(this->parent, this); - UpdateAnimationSingleFrame(this); + CopyPosition(super->parent, super); + UpdateAnimationSingleFrame(super); } -void VaatiTransfiguredType4Action0(Entity* this) { - this->action = 1; - this->field_0x80.HALF.LO = 0; - this->timer = 10; - this->spriteSettings.draw = 0; - this->spritePriority.b0 = 7; - InitializeAnimation(this, 0); +void VaatiTransfiguredType4Action0(VaatiTransfiguredEntity* this) { + super->action = 1; + this->unk_80 = 0; + super->timer = 10; + super->spriteSettings.draw = 0; + super->spritePriority.b0 = 7; + InitializeAnimation(super, 0); } -void VaatiTransfiguredType4Action1(Entity* this) { - if (this->parent->health == 0) { - this->field_0x6c.HALF.HI |= 2; +void VaatiTransfiguredType4Action1(VaatiTransfiguredEntity* this) { + if (super->parent->health == 0) { + this->unk_6d |= 2; DeleteThisEntity(); } - if (this->parent->action != 5) { - if (this->field_0x80.HALF.LO != 0) { - this->field_0x80.HALF.LO = 0; - this->spriteSettings.draw = 0; + if (super->parent->action != 5) { + if (this->unk_80 != 0) { + this->unk_80 = 0; + super->spriteSettings.draw = 0; } } else { - if (this->field_0x80.HALF.LO == 0) { - this->field_0x80.HALF.LO++; - this->spriteSettings.draw = 1; + if (this->unk_80 == 0) { + this->unk_80++; + super->spriteSettings.draw = 1; } - if (--this->timer == 0) { - this->timer = 10; + if (--super->timer == 0) { + super->timer = 10; SoundReq(SFX_149); } } - CopyPosition(this->parent, this); - GetNextFrame(this); + CopyPosition(super->parent, super); + GetNextFrame(super); } -void VaatiTransfiguredType5Action0(Entity* this) { - if (this->type2 != 0) { - this->action = 2; - this->timer = 10; - this->spritePriority.b0 = 3; - InitializeAnimation(this, 2); +void VaatiTransfiguredType5Action0(VaatiTransfiguredEntity* this) { + if (super->type2 != 0) { + super->action = 2; + super->timer = 10; + super->spritePriority.b0 = 3; + InitializeAnimation(super, 2); } else { - this->action = 1; - this->spriteSettings.draw = 0; - this->spritePriority.b0 = 4; + super->action = 1; + super->spriteSettings.draw = 0; + super->spritePriority.b0 = 4; } } -void VaatiTransfiguredType5Action1(Entity* this) { - if (this->parent->health == 0) { - this->field_0x6c.HALF.HI |= 2; +void VaatiTransfiguredType5Action1(VaatiTransfiguredEntity* this) { + if (super->parent->health == 0) { + this->unk_6d |= 2; DeleteThisEntity(); } - switch (this->field_0x80.HALF.LO) { + switch (this->unk_80) { case 0: - if (this->parent->action != 6) { + if (super->parent->action != 6) { return; } - this->field_0x80.HALF.LO++; - this->spriteSettings.draw = 1; - InitializeAnimation(this, 1); + this->unk_80++; + super->spriteSettings.draw = 1; + InitializeAnimation(super, 1); break; case 1: - if (this->parent->action != 6) { - this->field_0x80.HALF.LO = 0; - this->spriteSettings.draw = 0; + if (super->parent->action != 6) { + this->unk_80 = 0; + super->spriteSettings.draw = 0; } else { - if (this->frame & ANIM_DONE) { - this->frame &= ~0x80; + if (super->frame & ANIM_DONE) { + super->frame &= ~0x80; if (gEntCount < 0x47) { - sub_08040648(this, this->type, 1); + sub_08040648(this, super->type, 1); } } - if (--this->timer == 0) { - this->timer = 10; + if (--super->timer == 0) { + super->timer = 10; SoundReq(SFX_149); } - GetNextFrame(this); + GetNextFrame(super); } break; } - CopyPosition(this->parent, this); + CopyPosition(super->parent, super); } -void VaatiTransfiguredType5Action2(Entity* this) { - if (this->parent->health == 0) { - this->field_0x6c.HALF.HI |= 2; +void VaatiTransfiguredType5Action2(VaatiTransfiguredEntity* this) { + if (super->parent->health == 0) { + this->unk_6d |= 2; DeleteThisEntity(); } - if (this->field_0x80.HALF.LO == 0) { - if (this->parent->parent->action != 6) { - if ((this->frame & ANIM_DONE) != 0) { - this->field_0x80.HALF.LO++; - InitializeAnimation(this, 3); + if (this->unk_80 == 0) { + if (super->parent->parent->action != 6) { + if ((super->frame & ANIM_DONE) != 0) { + this->unk_80++; + InitializeAnimation(super, 3); } } } else { - if ((this->frame & ANIM_DONE) != 0) { + if ((super->frame & ANIM_DONE) != 0) { DeleteThisEntity(); } } - CopyPosition(this->parent, this); - GetNextFrame(this); + CopyPosition(super->parent, super); + GetNextFrame(super); } -void sub_08040648(Entity* this, u32 type, u32 type2) { +void sub_08040648(VaatiTransfiguredEntity* this, u32 type, u32 type2) { Entity* enemy; enemy = CreateEnemy(VAATI_TRANSFIGURED, type); enemy->type2 = type2; - enemy->parent = this; - CopyPosition(this, enemy); + enemy->parent = super; + CopyPosition(super, enemy); if ((type == 2) && (type2 == 0)) { - this->child = enemy; + super->child = enemy; } } -void sub_08040670(Entity* this) { - this->action = 1; - this->field_0x80.HALF.LO = 0; - this->speed = 0x100; - this->timer = 12; - if (this->animationState == 0) { +void sub_08040670(VaatiTransfiguredEntity* this) { + super->action = 1; + this->unk_80 = 0; + super->speed = 0x100; + super->timer = 12; + if (super->animationState == 0) { sub_080406A0(this); } else { sub_08040770(this); } } -void sub_080406A0(Entity* this) { +void sub_080406A0(VaatiTransfiguredEntity* this) { u32 uVar2; u32 uVar3; u32 uVar4; @@ -860,13 +884,13 @@ void sub_080406A0(Entity* this) { u32 uVar6; uVar2 = Random() & 0x30; - uVar5 = this->field_0x86.HALF.LO; + uVar5 = this->unk_86; { u32 tmp; uVar6 = gRoomControls.origin_x + gUnk_080D0B58[tmp = uVar5 * 2]; uVar4 = gRoomControls.origin_y + gUnk_080D0B58[tmp + 1]; } - if (EntityWithinDistance(this, uVar6, uVar4, 0x1c)) { + if (EntityWithinDistance(super, uVar6, uVar4, 0x1c)) { if (uVar5 != 0) { uVar5 = 0; } else { @@ -878,39 +902,39 @@ void sub_080406A0(Entity* this) { uVar4 = gRoomControls.origin_y + gUnk_080D0B58[tmp + 1]; } } - uVar3 = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, uVar6, uVar4); - this->direction = uVar3; + uVar3 = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, uVar6, uVar4); + super->direction = uVar3; if (uVar2 & 0x20) { - u32 tmp = this->direction; + u32 tmp = super->direction; if (uVar2 & 0x10) { - this->direction = tmp + 1; + super->direction = tmp + 1; } else { - this->direction = tmp + 0x1f; + super->direction = tmp + 0x1f; } } - this->direction &= 0x3 | DirectionNorthWest; - this->field_0x86.HALF.LO = uVar5; + super->direction &= 0x3 | DirectionNorthWest; + this->unk_86 = uVar5; } -void sub_08040770(Entity* this) { +void sub_08040770(VaatiTransfiguredEntity* this) { u32 tmp = Random() & 0x38; - u32 tmp2 = this->field_0x86.HALF.LO; + u32 tmp2 = this->unk_86; u32 tmp5, tmp6; { u32 index; tmp5 = gRoomControls.origin_x + gUnk_080D0B64[index = tmp2 * 2]; tmp6 = gRoomControls.origin_y + gUnk_080D0B64[index + 1]; } - if (EntityWithinDistance(this, tmp5, tmp6, 0x1c)) { - if (this->animationState != 2) { + if (EntityWithinDistance(super, tmp5, tmp6, 0x1c)) { + if (super->animationState != 2) { if (tmp & 8) { tmp2++; } else { tmp2 += 3; } tmp2 &= 3; - if (this->field_0x80.HALF.HI) { - switch (this->field_0x74.HALF.HI) { + if (this->unk_81) { + switch (this->unk_75) { case 0xf: if (tmp2 == 0) { tmp2 = 2; @@ -934,23 +958,23 @@ void sub_08040770(Entity* this) { } } } else { - if (this->field_0x86.HALF.HI & 0x7f) { - if (this->field_0x86.HALF.HI & 0x80) { + if (this->unk_87 & 0x7f) { + if (this->unk_87 & 0x80) { tmp2++; } else { tmp2 += 3; } - this->field_0x86.HALF.HI--; + this->unk_87--; } else { u32 tmp3; - this->field_0x86.HALF.HI = (Random() & 7) + 4; - tmp5 = this->field_0x86.HALF.HI; + this->unk_87 = (Random() & 7) + 4; + tmp5 = this->unk_87; if (!(Random() & 0x20)) { tmp3 = tmp5 | 0x80; } else { tmp3 = tmp5; } - this->field_0x86.HALF.HI = tmp3; + this->unk_87 = tmp3; if (tmp3 & 0x80) { tmp2++; } else { @@ -965,37 +989,37 @@ void sub_08040770(Entity* this) { tmp6 = gRoomControls.origin_y + gUnk_080D0B64[tmp3 + 1]; } } - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, tmp5, tmp6); + super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, tmp5, tmp6); if (tmp & 0x20) { - u32 tmp3 = this->direction; + u32 tmp3 = super->direction; if (tmp & 0x10) { - this->direction = tmp3 + 1; + super->direction = tmp3 + 1; } else { - this->direction = tmp3 + 0x1F; + super->direction = tmp3 + 0x1F; } } - this->direction &= 0x3 | DirectionNorthWest; - this->field_0x86.HALF.LO = tmp2; + super->direction &= 0x3 | DirectionNorthWest; + this->unk_86 = tmp2; } -void sub_080408EC(Entity* this) { +void sub_080408EC(VaatiTransfiguredEntity* this) { u32 tmp; - if (this->animationState == 0) { + if (super->animationState == 0) { tmp = 0xf0; } else { do { tmp = gUnk_080D0B74[(Random() & 0x3c) >> 2]; - if (tmp == this->field_0x74.HALF.HI) { + if (tmp == this->unk_75) { tmp = 0xff; } } while (tmp == 0xff); } - this->field_0x74.HALF.HI = tmp; - this->field_0x76.HALF.LO = 0; + this->unk_75 = tmp; + this->unk_76 = 0; } -u32 sub_08040934(Entity* this) { +u32 sub_08040934(VaatiTransfiguredEntity* this) { u32 t; u32 r2; @@ -1005,15 +1029,15 @@ u32 sub_08040934(Entity* this) { } else { r2 = 0; } - if ((this->field_0x86.HALF.HI & 0x7f) != 0) { + if ((this->unk_87 & 0x7f) != 0) { r2 = 0; } - if (this->cutsceneBeh.HALF.LO != 9) { + if (this->unk_84 != 9) { if (r2 != 0) { - this->cutsceneBeh.HALF.LO = (this->cutsceneBeh.HALF.LO + 1) % 5; + this->unk_84 = (this->unk_84 + 1) % 5; t = (Random() & 0xf8) >> 3; r2 = gUnk_080D0B84[t]; - switch (this->cutsceneBeh.HALF.LO) { + switch (this->unk_84) { case 3: case 4: if (r2 == 0) { @@ -1030,70 +1054,70 @@ u32 sub_08040934(Entity* this) { } } } else { - this->cutsceneBeh.HALF.LO = 0; + this->unk_84 = 0; r2 = 1; } return r2; } -void sub_080409B0(Entity* this) { - switch (this->field_0x80.HALF.HI) { +void sub_080409B0(VaatiTransfiguredEntity* this) { + switch (this->unk_81) { case 0: - if (this->field_0x74.HALF.HI == this->field_0x76.HALF.LO) { - this->field_0x80.HALF.HI = 1; - this->field_0x76.HALF.LO = 0; + if (this->unk_75 == this->unk_76) { + this->unk_81 = 1; + this->unk_76 = 0; } break; case 1: - if (this->field_0x76.HALF.LO != 0) { - this->field_0x80.HALF.HI = 2; - this->field_0x76.HALF.HI = 0x10; + if (this->unk_76 != 0) { + this->unk_81 = 2; + this->unk_77 = 0x10; } break; case 2: - if (--this->field_0x76.HALF.HI == 0) { - if (this->field_0x74.HALF.HI != (this->field_0x74.HALF.HI & this->field_0x76.HALF.LO)) { - this->field_0x80.HALF.HI = 1; - this->field_0x76.HALF.LO = 0; + if (--this->unk_77 == 0) { + if (this->unk_75 != (this->unk_75 & this->unk_76)) { + this->unk_81 = 1; + this->unk_76 = 0; SoundReq(SFX_155); } else { - this->action = 3; - this->field_0x80.HALF.LO = 0; - this->field_0x80.HALF.HI = 3; - COLLISION_OFF(this); - this->hitType = 0x36; - this->zVelocity = Q_16_16(1.5); + super->action = 3; + this->unk_80 = 0; + this->unk_81 = 3; + COLLISION_OFF(super); + super->hitType = 0x36; + super->zVelocity = Q_16_16(1.5); SoundReq(SFX_164); } } break; } - if (this->field_0x80.HALF.HI < 3) { - if (this->knockbackDuration != 0) { - Knockback1(this); + if (this->unk_81 < 3) { + if (super->knockbackDuration != 0) { + Knockback1(super); } } else { - if (((this->contactFlags & 0x80) != 0) && (0 < this->iframes)) { + if (((super->contactFlags & 0x80) != 0) && (0 < super->iframes)) { InitScreenShake(12, 1); SoundReq(SFX_BOSS_HIT); } - if ((this->contactFlags == 0x8a) && (gPlayerState.chargeState.action == 5)) { - this->health = 0xc0; + if ((super->contactFlags == 0x8a) && (gPlayerState.chargeState.action == 5)) { + super->health = 0xc0; } } } -void sub_08040AD4(Entity* this) { +void sub_08040AD4(VaatiTransfiguredEntity* this) { u32 timer; - timer = this->timer & 0x3f; + timer = super->timer & 0x3f; if ((timer & 0x1f) == 0) { SoundReq(SFX_1A9); } if ((timer & 3) == 0) { timer >>= 2; - this->x.HALF.HI += ((timer + 4) & 8) ? -1 : 1; - this->y.HALF.HI += ((timer + 2) & 4) ? -1 : 1; + super->x.HALF.HI += ((timer + 4) & 8) ? -1 : 1; + super->y.HALF.HI += ((timer + 2) & 4) ? -1 : 1; } } diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c index 07c31e43..2ee0d76a 100644 --- a/src/enemy/vaatiTransfiguredEye.c +++ b/src/enemy/vaatiTransfiguredEye.c @@ -4,35 +4,49 @@ * * @brief Vaati Transfigured Eye enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" #include "message.h" #include "physics.h" -void sub_08045A00(Entity*); -void sub_08045A28(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[13]; + /*0x75*/ u8 unk_75; + /*0x76*/ u8 unk_76; + /*0x77*/ u8 unused2[9]; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; + /*0x84*/ u8 unused3[1]; + /*0x85*/ u8 unk_85; +} VaatiTransfiguredEyeEntity; -void VaatiTransfiguredEye_OnTick(Entity*); -void VaatiTransfiguredEye_OnCollision(Entity*); -void VaatiTransfiguredEye_OnDragged(Entity*); -void VaatiTransfiguredEyeFunction0Action0(Entity*); -void VaatiTransfiguredEyeFunction0Action1(Entity*); -void VaatiTransfiguredEyeFunction0Action2(Entity*); -void VaatiTransfiguredEyeFunction0Action3(Entity*); -void VaatiTransfiguredEyeFunction0Action4(Entity*); +void sub_08045A00(VaatiTransfiguredEyeEntity*); +void sub_08045A28(VaatiTransfiguredEyeEntity*); -void (*const VaatiTransfiguredEye_Functions[])(Entity*) = { +void VaatiTransfiguredEye_OnTick(VaatiTransfiguredEyeEntity*); +void VaatiTransfiguredEye_OnCollision(VaatiTransfiguredEyeEntity*); +void VaatiTransfiguredEye_OnDragged(VaatiTransfiguredEyeEntity*); +void VaatiTransfiguredEyeFunction0Action0(VaatiTransfiguredEyeEntity*); +void VaatiTransfiguredEyeFunction0Action1(VaatiTransfiguredEyeEntity*); +void VaatiTransfiguredEyeFunction0Action2(VaatiTransfiguredEyeEntity*); +void VaatiTransfiguredEyeFunction0Action3(VaatiTransfiguredEyeEntity*); +void VaatiTransfiguredEyeFunction0Action4(VaatiTransfiguredEyeEntity*); + +void (*const VaatiTransfiguredEye_Functions[])(VaatiTransfiguredEyeEntity*) = { VaatiTransfiguredEye_OnTick, VaatiTransfiguredEye_OnCollision, VaatiTransfiguredEye_OnTick, - GenericDeath, - GenericConfused, + (void (*)(VaatiTransfiguredEyeEntity*))GenericDeath, + (void (*)(VaatiTransfiguredEyeEntity*))GenericConfused, VaatiTransfiguredEye_OnDragged, }; -void (*const vaatiTransfiguredEyeFunction0Actions[])(Entity*) = { +void (*const vaatiTransfiguredEyeFunction0Actions[])(VaatiTransfiguredEyeEntity*) = { VaatiTransfiguredEyeFunction0Action0, VaatiTransfiguredEyeFunction0Action1, VaatiTransfiguredEyeFunction0Action2, VaatiTransfiguredEyeFunction0Action3, VaatiTransfiguredEyeFunction0Action4, }; @@ -45,201 +59,201 @@ struct xy { const struct xy gUnk_080D18B4[] = { { 0xe8, 0xf6 }, { 0xf6, 0xe8 }, { 0x0a, 0xe8 }, { 0x18, 0xf6 }, { 0x18, 0x0a }, { 0x0a, 0x18 }, { 0xf6, 0x18 }, { 0xe8, 0x0a } }; -void VaatiTransfiguredEye(Entity* this) { - EnemyFunctionHandler(this, VaatiTransfiguredEye_Functions); +void VaatiTransfiguredEye(VaatiTransfiguredEyeEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)VaatiTransfiguredEye_Functions); } -void VaatiTransfiguredEye_OnTick(Entity* this) { - vaatiTransfiguredEyeFunction0Actions[this->action](this); +void VaatiTransfiguredEye_OnTick(VaatiTransfiguredEyeEntity* this) { + vaatiTransfiguredEyeFunction0Actions[super->action](this); } -void VaatiTransfiguredEye_OnCollision(Entity* this) { +void VaatiTransfiguredEye_OnCollision(VaatiTransfiguredEyeEntity* this) { u8 bVar1; Entity* pEVar4; - if (this->type != 0) { - pEVar4 = this->parent->parent; - if ((this->contactFlags & 0x80) != 0) { - bVar1 = this->contactFlags & 0x3f; + if (super->type != 0) { + pEVar4 = super->parent->parent; + if ((super->contactFlags & 0x80) != 0) { + bVar1 = super->contactFlags & 0x3f; if ((bVar1 == 0xe) || (bVar1 == 0x15)) { - if (this->field_0x80.HALF.HI == 0) { - this->action = 3; - this->field_0x80.HALF.HI++; - InitializeAnimation(this, (this->type << 3) | (this->timer + 2)); - InitializeAnimation(this->parent, (this->parent->type << 3) | (this->timer + 2)); + if (this->unk_81 == 0) { + super->action = 3; + this->unk_81++; + InitializeAnimation(super, (super->type << 3) | (super->timer + 2)); + InitializeAnimation(super->parent, (super->parent->type << 3) | (super->timer + 2)); } - if (this->timer != 0) { + if (super->timer != 0) { SoundReq(SFX_17A); } else { SoundReq(SFX_ITEM_GLOVES_KNOCKBACK); } } else { - if (this->health != 0xff) { - this->health = 0xff; - 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++; - InitializeAnimation(this, this->type << 3 | 6); - InitializeAnimation(this->parent, this->parent->type << 3 | 6); + if (super->health != 0xff) { + super->health = 0xff; + if (super->timer != 0 && (((VaatiTransfiguredEyeEntity*)pEVar4)->unk_81 != 0)) { + ((VaatiTransfiguredEyeEntity*)pEVar4)->unk_76 |= (1 << super->type2); + if (this->unk_85 == 0) { + this->unk_85++; + InitializeAnimation(super, super->type << 3 | 6); + InitializeAnimation(super->parent, super->parent->type << 3 | 6); } } } } } } - EnemyFunctionHandlerAfterCollision(this, VaatiTransfiguredEye_Functions); + EnemyFunctionHandlerAfterCollision(super, (EntityActionArray)VaatiTransfiguredEye_Functions); } -void VaatiTransfiguredEye_OnDragged(Entity* this) { +void VaatiTransfiguredEye_OnDragged(VaatiTransfiguredEyeEntity* this) { } -void VaatiTransfiguredEyeFunction0Action0(Entity* this) { +void VaatiTransfiguredEyeFunction0Action0(VaatiTransfiguredEyeEntity* this) { Entity* child; u8 bVar2; bVar2 = gMessage.state & MESSAGE_ACTIVE; if ((gMessage.state & MESSAGE_ACTIVE) == 0) { - this->action = 1; - this->spriteSettings.draw = 0; - this->field_0x80.HALF.LO = bVar2; - this->field_0x80.HALF.HI = bVar2; - this->cutsceneBeh.HALF.HI = bVar2; - this->subtimer = bVar2; - this->field_0x82.HALF.LO = 0x30; - this->field_0x82.HALF.HI = bVar2; - if (this->type == 0) { + super->action = 1; + super->spriteSettings.draw = 0; + this->unk_80 = bVar2; + this->unk_81 = bVar2; + this->unk_85 = bVar2; + super->subtimer = bVar2; + this->unk_82 = 0x30; + this->unk_83 = bVar2; + if (super->type == 0) { sub_08045A00(this); child = CreateEnemy(VAATI_TRANSFIGURED_EYE, 1); if (child != NULL) { - child->parent = this; - this->child = child; - child->timer = this->timer; - child->type2 = this->type2; - CopyPosition(this, child); + child->parent = super; + super->child = child; + child->timer = super->timer; + child->type2 = super->type2; + CopyPosition(super, child); } } else { - this->spriteOffsetY = 1; + super->spriteOffsetY = 1; } - InitializeAnimation(this, (u32)this->type << 3 | 1); + InitializeAnimation(super, (u32)super->type << 3 | 1); } } -void VaatiTransfiguredEyeFunction0Action1(Entity* this) { +void VaatiTransfiguredEyeFunction0Action1(VaatiTransfiguredEyeEntity* this) { sub_08045A28(this); - if (this->field_0x82.HALF.LO == 0) { - if ((this->frame & ANIM_DONE) != 0) { - if (this->type != 0) { - COLLISION_ON(this); + if (this->unk_82 == 0) { + if ((super->frame & ANIM_DONE) != 0) { + if (super->type != 0) { + COLLISION_ON(super); } - this->action = 2; - InitializeAnimation(this, this->type << 3); + super->action = 2; + InitializeAnimation(super, super->type << 3); } } else { - if (--this->field_0x82.HALF.LO == 0) { - this->spriteSettings.draw = 1; + if (--this->unk_82 == 0) { + super->spriteSettings.draw = 1; } } } -void VaatiTransfiguredEyeFunction0Action2(Entity* this) { +void VaatiTransfiguredEyeFunction0Action2(VaatiTransfiguredEyeEntity* this) { Entity* parent; sub_08045A28(this); - parent = this->parent; - if (this->type != 0) { + parent = super->parent; + if (super->type != 0) { parent = parent->parent; } - if ((parent->action == 3) && (parent->field_0x80.HALF.LO == 1)) { - this->action = 4; - this->subtimer = 0; - if (this->type != 0) { - COLLISION_OFF(this); - if (this->timer != 0) { - InitializeAnimation(this, this->type << 3 | 5); - InitializeAnimation(this->parent, this->parent->type << 3 | 5); + if ((parent->action == 3) && (((VaatiTransfiguredEyeEntity*)parent)->unk_80 == 1)) { + super->action = 4; + super->subtimer = 0; + if (super->type != 0) { + COLLISION_OFF(super); + if (super->timer != 0) { + InitializeAnimation(super, super->type << 3 | 5); + InitializeAnimation(super->parent, super->parent->type << 3 | 5); } else { - InitializeAnimation(this, this->type << 3 | 4); - InitializeAnimation(this->parent, this->parent->type << 3 | 4); + InitializeAnimation(super, super->type << 3 | 4); + InitializeAnimation(super->parent, super->parent->type << 3 | 4); } } } } -void VaatiTransfiguredEyeFunction0Action3(Entity* this) { +void VaatiTransfiguredEyeFunction0Action3(VaatiTransfiguredEyeEntity* this) { sub_08045A28(this); - if ((this->frame & ANIM_DONE) != 0) { - this->action = 2; - if (this->type != 0) { - if (this->timer == 0) { - this->hitType = 0x32; + if ((super->frame & ANIM_DONE) != 0) { + super->action = 2; + if (super->type != 0) { + if (super->timer == 0) { + super->hitType = 0x32; } else { - this->parent->parent->field_0x76.HALF.LO |= (1 << this->type2); - this->hitType = 0x31; + ((VaatiTransfiguredEyeEntity*)super->parent->parent)->unk_76 |= (1 << super->type2); + super->hitType = 0x31; } } } } -void VaatiTransfiguredEyeFunction0Action4(Entity* this) { +void VaatiTransfiguredEyeFunction0Action4(VaatiTransfiguredEyeEntity* this) { Entity* parent; sub_08045A28(this); - if (this->subtimer == 0) { - if ((this->frame & ANIM_DONE) != 0) { - this->subtimer = 32; + if (super->subtimer == 0) { + if ((super->frame & ANIM_DONE) != 0) { + super->subtimer = 32; } } else { - parent = this->parent; - if (this->type != 0) { + parent = super->parent; + if (super->type != 0) { parent = parent->parent; } if ((parent->animationState < 3) && (parent->action != 3)) { - this->action = 1; - this->subtimer = 0; - this->field_0x80.HALF.HI = 0; - this->cutsceneBeh.HALF.HI = 0; - if (this->type != 0) { - this->hitType = 0x33; + super->action = 1; + super->subtimer = 0; + this->unk_81 = 0; + this->unk_85 = 0; + if (super->type != 0) { + super->hitType = 0x33; } - if ((parent->field_0x74.HALF.HI >> this->type2 & 1U) != 0) { - this->timer = 1; + if ((((VaatiTransfiguredEyeEntity*)parent)->unk_75 >> super->type2 & 1U) != 0) { + super->timer = 1; } else { - this->timer = 0; + super->timer = 0; } - InitializeAnimation(this, this->type << 3 | 1); + InitializeAnimation(super, super->type << 3 | 1); } } } -void sub_08045A00(Entity* this) { - const struct xy* t = &gUnk_080D18B4[this->type2]; - PositionRelative(this->parent, this, Q_16_16(t->x), Q_16_16(t->y + 3)); +void sub_08045A00(VaatiTransfiguredEyeEntity* this) { + const struct xy* t = &gUnk_080D18B4[super->type2]; + PositionRelative(super->parent, super, Q_16_16(t->x), Q_16_16(t->y + 3)); } -void sub_08045A28(Entity* this) { +void sub_08045A28(VaatiTransfiguredEyeEntity* this) { u32 frames; u32 type; - if (this->field_0x82.HALF.LO == 0) { - GetNextFrame(this); + if (this->unk_82 == 0) { + GetNextFrame(super); } - frames = this->frame & 0x70; - type = this->type; + frames = super->frame & 0x70; + type = super->type; if (type == 0) { sub_08045A00(this); - switch (this->field_0x82.HALF.HI) { + switch (this->unk_83) { case 0: switch (frames) { case 0x20: - this->field_0x82.HALF.HI = 1; - ChangeObjPalette(this, 0x13e); + this->unk_83 = 1; + ChangeObjPalette(super, 0x13e); break; case 0x00: case 0x40: - this->field_0x82.HALF.HI = 2; - ChangeObjPalette(this, 0x13f); + this->unk_83 = 2; + ChangeObjPalette(super, 0x13f); break; default: break; @@ -248,12 +262,12 @@ void sub_08045A28(Entity* this) { case 1: switch (frames) { case 0x10: - this->field_0x82.HALF.HI = type; - ChangeObjPalette(this, 0x13b); + this->unk_83 = type; + ChangeObjPalette(super, 0x13b); break; case 0: - this->field_0x82.HALF.HI = 2; - ChangeObjPalette(this, 0x13f); + this->unk_83 = 2; + ChangeObjPalette(super, 0x13f); break; default: break; @@ -262,16 +276,16 @@ void sub_08045A28(Entity* this) { case 2: switch (frames) { case 0x20: - this->field_0x82.HALF.HI = 1; - ChangeObjPalette(this, 0x13e); + this->unk_83 = 1; + ChangeObjPalette(super, 0x13e); break; case 0x10: - this->field_0x82.HALF.HI = 0; - ChangeObjPalette(this, 0x13b); + this->unk_83 = 0; + ChangeObjPalette(super, 0x13b); break; case 0x40: - this->field_0x82.HALF.HI = 2; - ChangeObjPalette(this, 0x13f); + this->unk_83 = 2; + ChangeObjPalette(super, 0x13f); break; default: break; @@ -280,8 +294,8 @@ void sub_08045A28(Entity* this) { case 3: switch (frames) { case 0: - this->field_0x82.HALF.HI = 2; - ChangeObjPalette(this, 0x13f); + this->unk_83 = 2; + ChangeObjPalette(super, 0x13f); break; default: break; @@ -291,42 +305,42 @@ void sub_08045A28(Entity* this) { break; } } else { - PositionRelative(this->parent, this, 0, Q_16_16(-1.0)); - switch (this->field_0x82.HALF.HI) { + PositionRelative(super->parent, super, 0, Q_16_16(-1.0)); + switch (this->unk_83) { case 0: - switch (this->frame & 0x70) { + switch (super->frame & 0x70) { case 0x10: - this->field_0x82.HALF.HI = 2; - ChangeObjPalette(this, 0x13b); + this->unk_83 = 2; + ChangeObjPalette(super, 0x13b); break; case 0x20: - this->field_0x82.HALF.HI = 1; - ChangeObjPalette(this, 0x13e); + this->unk_83 = 1; + ChangeObjPalette(super, 0x13e); break; default: break; } break; case 1: { - u32 temp = this->frame & 0x70; + u32 temp = super->frame & 0x70; switch (temp) { case 0: - this->field_0x82.HALF.HI = temp; - ChangeObjPalette(this, 0x13f); + this->unk_83 = temp; + ChangeObjPalette(super, 0x13f); break; case 0x10: - this->field_0x82.HALF.HI = 2; - ChangeObjPalette(this, 0x13b); + this->unk_83 = 2; + ChangeObjPalette(super, 0x13b); break; default: break; } } break; case 2: - switch (this->frame & 0x70) { + switch (super->frame & 0x70) { case 0: - this->field_0x82.HALF.HI = this->frame & 0x70; - ChangeObjPalette(this, 0x13f); + this->unk_83 = super->frame & 0x70; + ChangeObjPalette(super, 0x13f); break; default: break; diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index d3d07c84..2aa2b549 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -4,57 +4,58 @@ * * @brief Vaati Wrath enemy */ -//#define NENT_DEPRECATED -#include "enemy.h" +#define NENT_DEPRECATED +#include "enemy/vaatiWrath.h" #include "functions.h" #include "message.h" +#include "new_player.h" #include "object.h" #include "save.h" #include "screen.h" -void VaatiWrathType0PreAction(Entity*); -u32 sub_08041FCC(Entity*); -void sub_08042004(Entity*); -u32 sub_08041ED4(Entity*); -u32 sub_08041F74(Entity*, u32); -u32 sub_08041F1C(Entity*); -void sub_08042028(Entity*); -u32 sub_0804207C(Entity*); -void sub_0804212C(Entity*); -void sub_080421AC(Entity*); -void sub_08042120(Entity*); -void sub_0804235C(Entity*); -void sub_08042214(Entity*); -void sub_08042050(Entity*); -void sub_08041E78(Entity*); -void sub_08042264(Entity*); -u32 sub_080422C0(Entity*, u32); -void sub_0804228C(Entity*); +void VaatiWrathType0PreAction(VaatiWrathEntity*); +u32 sub_08041FCC(VaatiWrathEntity*); +void sub_08042004(VaatiWrathEntity*); +u32 sub_08041ED4(VaatiWrathEntity*); +u32 sub_08041F74(VaatiWrathEntity*, u32); +u32 sub_08041F1C(VaatiWrathEntity*); +void sub_08042028(VaatiWrathEntity*); +u32 sub_0804207C(VaatiWrathEntity*); +void sub_0804212C(VaatiWrathEntity*); +void sub_080421AC(VaatiWrathEntity*); +void sub_08042120(VaatiWrathEntity*); +void sub_0804235C(VaatiWrathEntity*); +void sub_08042214(VaatiWrathEntity*); +void sub_08042050(VaatiWrathEntity*); +void sub_08041E78(VaatiWrathEntity*); +void sub_08042264(VaatiWrathEntity*); +u32 sub_080422C0(VaatiWrathEntity*, u32); +void sub_0804228C(VaatiWrathEntity*); -void VaatiWrathType0(Entity*); -void VaatiWrathType1(Entity*); -void VaatiWrathType2(Entity*); -void VaatiWrathType3(Entity*); -void VaatiWrathType0Action0(Entity*); -void VaatiWrathType0Action1(Entity*); -void VaatiWrathType0Action2(Entity*); -void VaatiWrathType0Action3(Entity*); -void VaatiWrathType0Action4(Entity*); -void VaatiWrathType0Action5(Entity*); -void VaatiWrathType0Action6(Entity*); -void VaatiWrathType0Action7(Entity*); -void VaatiWrathType0Action8(Entity*); -void VaatiWrathType0Action9(Entity*); -void VaatiWrathType0ActionA(Entity*); -void VaatiWrathType0ActionB(Entity*); -void VaatiWrathType0ActionC(Entity*); -void VaatiWrathType0ActionD(Entity*); -void sub_08041BE8(Entity*); -void sub_08041CD0(Entity*); -void sub_08041D14(Entity*); -void sub_08041D84(Entity*); -void sub_08041E20(Entity*); -void sub_08041E50(Entity*); +void VaatiWrathType0(VaatiWrathEntity*); +void VaatiWrathType1(VaatiWrathEntity*); +void VaatiWrathType2(VaatiWrathEntity*); +void VaatiWrathType3(VaatiWrathEntity*); +void VaatiWrathType0Action0(VaatiWrathEntity*); +void VaatiWrathType0Action1(VaatiWrathEntity*); +void VaatiWrathType0Action2(VaatiWrathEntity*); +void VaatiWrathType0Action3(VaatiWrathEntity*); +void VaatiWrathType0Action4(VaatiWrathEntity*); +void VaatiWrathType0Action5(VaatiWrathEntity*); +void VaatiWrathType0Action6(VaatiWrathEntity*); +void VaatiWrathType0Action7(VaatiWrathEntity*); +void VaatiWrathType0Action8(VaatiWrathEntity*); +void VaatiWrathType0Action9(VaatiWrathEntity*); +void VaatiWrathType0ActionA(VaatiWrathEntity*); +void VaatiWrathType0ActionB(VaatiWrathEntity*); +void VaatiWrathType0ActionC(VaatiWrathEntity*); +void VaatiWrathType0ActionD(VaatiWrathEntity*); +void sub_08041BE8(VaatiWrathEntity*); +void sub_08041CD0(VaatiWrathEntity*); +void sub_08041D14(VaatiWrathEntity*); +void sub_08041D84(VaatiWrathEntity*); +void sub_08041E20(VaatiWrathEntity*); +void sub_08041E50(VaatiWrathEntity*); typedef struct { Entity* type0; @@ -66,13 +67,13 @@ typedef struct { Entity* eyes[4]; } VaatiWrathHeapStruct; -void (*const vaatiWrathTypes[])(Entity*) = { +void (*const vaatiWrathTypes[])(VaatiWrathEntity*) = { VaatiWrathType0, VaatiWrathType1, VaatiWrathType2, VaatiWrathType3, }; -void (*const vaatiWrathType0Actions[])(Entity*) = { +void (*const vaatiWrathType0Actions[])(VaatiWrathEntity*) = { VaatiWrathType0Action0, VaatiWrathType0Action1, VaatiWrathType0Action2, VaatiWrathType0Action3, VaatiWrathType0Action4, VaatiWrathType0Action5, VaatiWrathType0Action6, VaatiWrathType0Action7, VaatiWrathType0Action8, VaatiWrathType0Action9, VaatiWrathType0ActionA, VaatiWrathType0ActionB, @@ -81,7 +82,7 @@ void (*const vaatiWrathType0Actions[])(Entity*) = { const u8 gUnk_080D0E64[] = { 0, -1, 0, 1 }; -void (*const gUnk_080D0E68[])(Entity*) = { +void (*const gUnk_080D0E68[])(VaatiWrathEntity*) = { sub_08041BE8, sub_08041CD0, sub_08041D14, sub_08041D84, sub_08041E20, sub_08041E50, }; @@ -100,28 +101,28 @@ const s8 gUnk_080D0EB0[] = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0 0x02, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfe, 0xfe, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd, 0xfd }; -void VaatiWrath(Entity* this) { - if (((this->type == 0) && ((this->contactFlags & 0x80) != 0)) && (this->health == 0)) { - COLLISION_ON(this); - this->health = 0xff; - if (--this->cutsceneBeh.HALF.LO == 0) { - this->action = 0xd; - this->subAction = 0; +void VaatiWrath(VaatiWrathEntity* this) { + if (((super->type == 0) && ((super->contactFlags & 0x80) != 0)) && (super->health == 0)) { + COLLISION_ON(super); + super->health = 0xff; + if (--this->unk_84 == 0) { + super->action = 0xd; + super->subAction = 0; SoundReq(SONG_STOP_ALL); SoundReq(SFX_BOSS_DIE); } } - vaatiWrathTypes[this->type](this); + vaatiWrathTypes[super->type](this); } -void VaatiWrathType0(Entity* this) { +void VaatiWrathType0(VaatiWrathEntity* this) { #if !(defined EU || defined JP) VaatiWrathType0PreAction(this); #endif - vaatiWrathType0Actions[this->action](this); + vaatiWrathType0Actions[super->action](this); } -void VaatiWrathType0Action0(Entity* this) { +void VaatiWrathType0Action0(VaatiWrathEntity* this) { u32 bVar1; bVar1 = gRoomTransition.field_0x38 & 1; @@ -130,162 +131,161 @@ void VaatiWrathType0Action0(Entity* this) { return; } if ((gRoomTransition.field_0x39 & 0xc) == 0) { - this->action = 5; - this->subAction = 1; + super->action = 5; + super->subAction = 1; } else { - this->action = 2; - this->timer = 60; + super->action = 2; + super->timer = 60; } - this->x.HALF.HI = gRoomTransition.field_0x40; - this->y.HALF.HI = gRoomTransition.field_0x42; + super->x.HALF.HI = gRoomTransition.field_0x40; + super->y.HALF.HI = gRoomTransition.field_0x42; sub_08042004(this); } else { if (sub_08041ED4(this) == 0) { return; } - this->action = 1; - this->subAction = bVar1; - this->timer = 120; - this->spritePriority.b1 = 0; - this->z.HALF.HI = -80; - gRoomControls.camera_target = this; + super->action = 1; + super->subAction = bVar1; + super->timer = 120; + super->spritePriority.b1 = 0; + super->z.HALF.HI = -80; + gRoomControls.camera_target = super; sub_080809D4(); } - this->spriteSettings.draw = 1; - this->field_0x6c.HALF.HI |= 1; - this->field_0x78.HALF.HI = 0; - this->field_0x7c.HALF.LO = 0x3c; - this->field_0x7c.HALF.HI = 0x78; - this->cutsceneBeh.HALF.LO = 3; - InitAnimationForceUpdate(this, 0); + super->spriteSettings.draw = 1; + this->unk_6d |= 1; + this->unk_79 = 0; + this->unk_7c = 0x3c; + this->unk_7e = 0x78; + this->unk_84 = 3; + InitAnimationForceUpdate(super, 0); } -void VaatiWrathType0Action1(Entity* this) { - UpdateAnimationSingleFrame(this); - switch (this->subAction) { +void VaatiWrathType0Action1(VaatiWrathEntity* this) { + UpdateAnimationSingleFrame(super); + switch (super->subAction) { case 0: break; case 1: - this->spritePriority.b1 = 1; - this->z.WORD += Q_16_16(0.5); - if ((this->z.HALF.HI & 0x3f) == 0) { + super->spritePriority.b1 = 1; + super->z.WORD += Q_16_16(0.5); + if ((super->z.HALF.HI & 0x3f) == 0) { SoundReq(SFX_1A9); } - if (-6 < this->z.HALF.HI) { - this->subAction = 2; + if (-6 < super->z.HALF.HI) { + super->subAction = 2; SoundReq(SFX_1A9); } break; case 2: sub_08042004(this); - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } else { if (sub_08041F74(this, 0) == 0) { return; } - this->subAction = 3; - this->timer = 60; + super->subAction = 3; + super->timer = 60; } break; case 3: sub_08042004(this); - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } else { if (sub_08041F74(this, 1) != 0) { - this->subAction = 4; - this->timer = 120; - this->subtimer = 0; + super->subAction = 4; + super->timer = 120; + super->subtimer = 0; } } break; case 4: sub_08042004(this); - if (--this->timer == 0) { - this->subAction = 5; + if (--super->timer == 0) { + super->subAction = 5; } else { - if ((this->timer < 0x3d) && (this->subtimer == 0)) { + if ((super->timer < 0x3d) && (super->subtimer == 0)) { if (sub_08041F1C(this) != 0) { - this->subtimer = 1; + super->subtimer = 1; } } } break; case 5: sub_08042004(this); - this->subAction = 6; - this->timer = 30; + super->subAction = 6; + super->timer = 30; gRoomTransition.field_0x38 |= 1; gRoomControls.camera_target = &gPlayerEntity; gPlayerState.controlMode = CONTROL_1; break; default: sub_08042004(this); - if (--this->timer != 0) { + if (--super->timer != 0) { return; } - this->action = 2; - this->timer = 60; + super->action = 2; + super->timer = 60; break; } } -void VaatiWrathType0Action2(Entity* this) { +void VaatiWrathType0Action2(VaatiWrathEntity* this) { sub_08042004(this); - UpdateAnimationSingleFrame(this); - if (--this->timer == 0) { - this->subtimer = (Random() & 1) + 1; + UpdateAnimationSingleFrame(super); + if (--super->timer == 0) { + super->subtimer = (Random() & 1) + 1; sub_08042028(this); } } -void VaatiWrathType0Action3(Entity* this) { +void VaatiWrathType0Action3(VaatiWrathEntity* this) { s32 bound; - s32 thisY; - + s32 superY; u32 roomY; sub_08042004(this); - UpdateAnimationSingleFrame(this); - ProcessMovement0(this); + UpdateAnimationSingleFrame(super); + ProcessMovement0(super); roomY = gRoomControls.origin_y; bound = roomY + 0x90; - thisY = this->y.HALF.HI; - if ((bound < thisY)) { - this->y.HALF.HI = bound; + superY = super->y.HALF.HI; + if ((bound < superY)) { + super->y.HALF.HI = bound; } else { bound = roomY + 0x40; - if ((bound > thisY)) { - this->y.HALF.HI = bound; + if ((bound > superY)) { + super->y.HALF.HI = bound; } } - if (--this->timer == 0) { - this->action = 4; - this->timer = 8; + if (--super->timer == 0) { + super->action = 4; + super->timer = 8; } else { - if (this->timer < 0x1e) { - this->speed -= 8; + if (super->timer < 0x1e) { + super->speed -= 8; } else { - if (this->speed < 0x100) { - this->speed += 6; + if (super->speed < 0x100) { + super->speed += 6; } } - if ((this->timer & 3) == 0) { - sub_08004596(this, sub_0804207C(this)); + if ((super->timer & 3) == 0) { + sub_08004596(super, sub_0804207C(this)); } } sub_0804212C(this); sub_080421AC(this); } -void VaatiWrathType0Action4(Entity* this) { +void VaatiWrathType0Action4(VaatiWrathEntity* this) { sub_08042004(this); - UpdateAnimationSingleFrame(this); - if (--this->timer == 0) { - if (--this->subtimer == 0) { + UpdateAnimationSingleFrame(super); + if (--super->timer == 0) { + if (--super->subtimer == 0) { sub_08042120(this); } else { sub_08042028(this); @@ -293,75 +293,75 @@ void VaatiWrathType0Action4(Entity* this) { } } -void VaatiWrathType0Action5(Entity* this) { +void VaatiWrathType0Action5(VaatiWrathEntity* this) { Entity* object; u32 subAction; Entity* arm; sub_08042004(this); - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); sub_0804212C(this); sub_080421AC(this); - subAction = this->subAction; + subAction = super->subAction; if (subAction == 0) { - this->subAction = 1; + super->subAction = 1; if ((Random() & 1) != 0) { - arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[0]; + arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[0]; if (arm == NULL) { - arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[1]; + arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[1]; } } else { - arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[1]; + arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[1]; if (arm == NULL) { - arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[0]; + arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[0]; } } if (arm != NULL && arm->action == 2) { arm->action = 4; arm->subAction = 0; } else { - this->subtimer = (Random() & 1) + 1; + super->subtimer = (Random() & 1) + 1; sub_08042028(this); } } else { - if (this->field_0x78.HALF.HI == 0) { - if (this->subAction == 2) { + if (this->unk_79 == 0) { + if (super->subAction == 2) { if ((gRoomTransition.field_0x39 & 3) == 0) { object = CreateObject(VAATI3_PLAYER_OBJECT, 0, 0); if (object != NULL) { - object->parent = this; - ((VaatiWrathHeapStruct*)this->myHeap)->object5b = object; + object->parent = super; + ((VaatiWrathHeapStruct*)super->myHeap)->object5b = object; gRoomControls.camera_target = object; - this->action = 6; - this->timer = 30; - ((VaatiWrathHeapStruct*)this->myHeap)->type1->subAction = 1; - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type1, 0xe); + super->action = 6; + super->timer = 30; + ((VaatiWrathHeapStruct*)super->myHeap)->type1->subAction = 1; + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type1, 0xe); } } else { - this->action = 2; - this->timer = 60; + super->action = 2; + super->timer = 60; } } } } } -void VaatiWrathType0Action6(Entity* this) { +void VaatiWrathType0Action6(VaatiWrathEntity* this) { Entity* type1; - if (this->timer == 0) { - type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1; + if (super->timer == 0) { + type1 = ((VaatiWrathHeapStruct*)super->myHeap)->type1; GetNextFrame(type1); if (type1->frame == 1) { type1->frame &= 0xfe; - InitAnimationForceUpdate(this, 4); + InitAnimationForceUpdate(super, 4); } else { if (type1->frame == 2) { Entity* type3 = CreateEnemy(VAATI_WRATH, 3); if (type3 != NULL) { - type3->myHeap = this->myHeap; - ((VaatiWrathHeapStruct*)this->myHeap)->type3 = type3; - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x14); + type3->myHeap = super->myHeap; + ((VaatiWrathHeapStruct*)super->myHeap)->type3 = type3; + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type2, 0x14); type1->frame &= 0xfd; } } else { @@ -371,180 +371,180 @@ void VaatiWrathType0Action6(Entity* this) { } } } else { - this->timer--; + super->timer--; } sub_08042004(this); - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void VaatiWrathType0Action7(Entity* this) { +void VaatiWrathType0Action7(VaatiWrathEntity* this) { sub_08042214(this); sub_08042004(this); - UpdateAnimationSingleFrame(this); - if (gRoomControls.origin_y + 0x48 != this->y.HALF.HI) { - this->speed = 0x100; - this->direction = ((gRoomControls.origin_y + 0x48) >= this->y.HALF.HI) ? DirectionSouth : DirectionNorth; - LinearMoveUpdate(this); + UpdateAnimationSingleFrame(super); + if (gRoomControls.origin_y + 0x48 != super->y.HALF.HI) { + super->speed = 0x100; + super->direction = ((gRoomControls.origin_y + 0x48) >= super->y.HALF.HI) ? DirectionSouth : DirectionNorth; + LinearMoveUpdate(super); } else { - if (--this->timer == 0) { + if (--super->timer == 0) { sub_08042050(this); } } } -void VaatiWrathType0Action8(Entity* this) { +void VaatiWrathType0Action8(VaatiWrathEntity* this) { sub_08042004(this); - UpdateAnimationSingleFrame(this); - LinearMoveUpdate(this); - if (((gRoomControls.origin_x + 0x20) > this->x.HALF.HI) || ((gRoomControls.origin_x + 0x140) < this->x.HALF.HI)) { - if (0x3f < this->speed) { - this->direction ^= DirectionSouth; + UpdateAnimationSingleFrame(super); + LinearMoveUpdate(super); + if (((gRoomControls.origin_x + 0x20) > super->x.HALF.HI) || ((gRoomControls.origin_x + 0x140) < super->x.HALF.HI)) { + if (0x3f < super->speed) { + super->direction ^= DirectionSouth; } } - if (--this->timer == 0) { - this->action = 9; - this->timer = 60; + if (--super->timer == 0) { + super->action = 9; + super->timer = 60; } else { - if (this->timer < 0x1e) { - this->speed -= 0xc; + if (super->timer < 0x1e) { + super->speed -= 0xc; } else { - if (0x1ff >= this->speed) - this->speed += 0x10; + if (0x1ff >= super->speed) + super->speed += 0x10; } } sub_08042214(this); } -void VaatiWrathType0Action9(Entity* this) { +void VaatiWrathType0Action9(VaatiWrathEntity* this) { sub_08042004(this); - UpdateAnimationSingleFrame(this); - if (this->field_0x78.HALF.HI != 0) { + UpdateAnimationSingleFrame(super); + if (this->unk_79 != 0) { sub_08042214(this); } else { - if (--this->timer == 0) { - if ((gPlayerEntity.x.HALF.HI - this->x.HALF.HI) + 0x40u < 0x81) { - this->action = 10; - this->field_0x7a.HALF.HI = 0; - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[0]->timer = 1; - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[1]->timer = 1; - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[2]->timer = 1; - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[3]->timer = 1; + if (--super->timer == 0) { + if ((gPlayerEntity.x.HALF.HI - super->x.HALF.HI) + 0x40u < 0x81) { + super->action = 10; + this->unk_7b = 0; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[0]->timer = 1; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[1]->timer = 1; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[2]->timer = 1; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[3]->timer = 1; } else { - this->action = 7; - this->timer = 30; - this->field_0x78.HALF.HI = 0; + super->action = 7; + super->timer = 30; + this->unk_79 = 0; } } } } -void VaatiWrathType0ActionA(Entity* this) { +void VaatiWrathType0ActionA(VaatiWrathEntity* this) { Entity* type1; sub_08042004(this); - UpdateAnimationSingleFrame(this); - if (this->field_0x7a.HALF.HI == 0x0f) { - this->action = 7; - this->timer = 120; - this->field_0x78.HALF.HI = 0; + UpdateAnimationSingleFrame(super); + if (this->unk_7b == 0x0f) { + super->action = 7; + super->timer = 120; + this->unk_79 = 0; } else { - if (this->field_0x7a.HALF.HI == 0xf0) { - this->action = 0xb; - this->subAction = 0; - this->direction = DirectionNorth; - this->speed = 0x100; - this->zVelocity = Q_16_16(1.125); - ChangeObjPalette(this, 0x16b); - InitAnimationForceUpdate(this, 5); - type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1; + if (this->unk_7b == 0xf0) { + super->action = 0xb; + super->subAction = 0; + super->direction = DirectionNorth; + super->speed = 0x100; + super->zVelocity = Q_16_16(1.125); + ChangeObjPalette(super, 0x16b); + InitAnimationForceUpdate(super, 5); + type1 = ((VaatiWrathHeapStruct*)super->myHeap)->type1; type1->subAction = 1; InitializeAnimation(type1, 0xf); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x15); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type3, 0x1e); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type2, 0x15); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type3, 0x1e); SoundReq(SFX_BOSS_HIT); } } } -void VaatiWrathType0ActionB(Entity* this) { - switch (this->subAction) { +void VaatiWrathType0ActionB(VaatiWrathEntity* this) { + switch (super->subAction) { case 0: - LinearMoveUpdate(this); - UpdateAnimationSingleFrame(this); - GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type1); - GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); - if (GravityUpdate(this, Q_8_8(32.0)) == 0) { - this->subAction = 1; - this->timer = 240; - this->health = 8; - this->hitType = 0x38; + LinearMoveUpdate(super); + UpdateAnimationSingleFrame(super); + GetNextFrame(((VaatiWrathHeapStruct*)super->myHeap)->type1); + GetNextFrame(((VaatiWrathHeapStruct*)super->myHeap)->type2); + if (GravityUpdate(super, Q_8_8(32.0)) == 0) { + super->subAction = 1; + super->timer = 240; + super->health = 8; + super->hitType = 0x38; InitScreenShake(20, 0); - InitAnimationForceUpdate(this, 6); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x16); + InitAnimationForceUpdate(super, 6); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type2, 0x16); } break; case 1: - UpdateAnimationSingleFrame(this); - GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); - if (--this->timer == 0) { - this->subAction = 2; - this->timer = 60; - this->hitType = 0x39; - this->health = 0xff; + UpdateAnimationSingleFrame(super); + GetNextFrame(((VaatiWrathHeapStruct*)super->myHeap)->type2); + if (--super->timer == 0) { + super->subAction = 2; + super->timer = 60; + super->hitType = 0x39; + super->health = 0xff; } break; default: - this->spriteOffsetX = gUnk_080D0E64[--this->timer & 3]; - if (this->timer == 0) { - this->action = 0xc; - this->subAction = 0; - ChangeObjPalette(this, 0x140); - InitAnimationForceUpdate(this, 8); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type1, 0x10); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x18); + super->spriteOffsetX = gUnk_080D0E64[--super->timer & 3]; + if (super->timer == 0) { + super->action = 0xc; + super->subAction = 0; + ChangeObjPalette(super, 0x140); + InitAnimationForceUpdate(super, 8); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type1, 0x10); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type2, 0x18); } break; } } -void VaatiWrathType0ActionC(Entity* this) { +void VaatiWrathType0ActionC(VaatiWrathEntity* this) { Entity* entity; - UpdateAnimationSingleFrame(this); - GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); - if (this->subAction != 0) { - GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type1); + UpdateAnimationSingleFrame(super); + GetNextFrame(((VaatiWrathHeapStruct*)super->myHeap)->type2); + if (super->subAction != 0) { + GetNextFrame(((VaatiWrathHeapStruct*)super->myHeap)->type1); } - switch (this->subAction) { + switch (super->subAction) { case 0: - this->z.WORD -= Q_16_16(0.5); - if (this->z.HALF.HI < -4) { - this->subAction = 1; - this->timer = 120; - this->direction = DirectionSouth; - this->speed = 0x80; + super->z.WORD -= Q_16_16(0.5); + if (super->z.HALF.HI < -4) { + super->subAction = 1; + super->timer = 120; + super->direction = DirectionSouth; + super->speed = 0x80; } break; case 1: sub_08042004(this); - if (this->timer) { - this->timer--; + if (super->timer) { + super->timer--; } else { - LinearMoveUpdate(this); - if (gRoomControls.origin_y + 0x48 == this->y.HALF.HI) { - this->subAction = 2; - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type1, 0x11); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x19); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type3, 0x1f); + LinearMoveUpdate(super); + if (gRoomControls.origin_y + 0x48 == super->y.HALF.HI) { + super->subAction = 2; + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type1, 0x11); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type2, 0x19); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type3, 0x1f); } } break; default: sub_08042004(this); - entity = ((VaatiWrathHeapStruct*)this->myHeap)->type1; + entity = ((VaatiWrathHeapStruct*)super->myHeap)->type1; if (entity->frame & 1) { entity->frame &= 0xfe; - InitAnimationForceUpdate(this, 9); + InitAnimationForceUpdate(super, 9); } else { if (entity->frame & ANIM_DONE) { sub_0804235C(this); @@ -554,161 +554,161 @@ void VaatiWrathType0ActionC(Entity* this) { } } -void VaatiWrathType0ActionD(Entity* this) { - gUnk_080D0E68[this->subAction](this); +void VaatiWrathType0ActionD(VaatiWrathEntity* this) { + gUnk_080D0E68[super->subAction](this); } -void sub_08041BE8(Entity* this) { +void sub_08041BE8(VaatiWrathEntity* this) { Entity* entity; if (PlayerCanBeMoved()) { - this->subAction = 1; - this->timer = 120; - this->updatePriority = PRIO_NO_BLOCK; - InitAnimationForceUpdate(this, 10); + super->subAction = 1; + super->timer = 120; + super->updatePriority = PRIO_NO_BLOCK; + InitAnimationForceUpdate(super, 10); - entity = ((VaatiWrathHeapStruct*)this->myHeap)->type1; + entity = ((VaatiWrathHeapStruct*)super->myHeap)->type1; entity->myHeap = NULL; DeleteEntity(entity); - ((VaatiWrathHeapStruct*)this->myHeap)->type1 = NULL; + ((VaatiWrathHeapStruct*)super->myHeap)->type1 = NULL; - entity = ((VaatiWrathHeapStruct*)this->myHeap)->type2; + entity = ((VaatiWrathHeapStruct*)super->myHeap)->type2; entity->updatePriority = PRIO_NO_BLOCK; UnloadGFXSlots(entity); LoadFixedGFX(entity, 0x1f5); ChangeObjPalette(entity, 0x16b); InitializeAnimation(entity, 0x1a); - entity = ((VaatiWrathHeapStruct*)this->myHeap)->type3; + entity = ((VaatiWrathHeapStruct*)super->myHeap)->type3; entity->myHeap = NULL; DeleteEntity(entity); - ((VaatiWrathHeapStruct*)this->myHeap)->type3 = NULL; + ((VaatiWrathHeapStruct*)super->myHeap)->type3 = NULL; #ifndef EU - entity = ((VaatiWrathHeapStruct*)this->myHeap)->object5b; + entity = ((VaatiWrathHeapStruct*)super->myHeap)->object5b; entity->myHeap = NULL; DeleteEntity(entity); - ((VaatiWrathHeapStruct*)this->myHeap)->object5b = NULL; + ((VaatiWrathHeapStruct*)super->myHeap)->object5b = NULL; gRoomControls.camera_target = &gPlayerEntity; #endif - entity = ((VaatiWrathHeapStruct*)this->myHeap)->eyes[0]; + entity = ((VaatiWrathHeapStruct*)super->myHeap)->eyes[0]; entity->myHeap = NULL; DeleteEntity(entity); - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[0] = NULL; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[0] = NULL; - entity = ((VaatiWrathHeapStruct*)this->myHeap)->eyes[1]; + entity = ((VaatiWrathHeapStruct*)super->myHeap)->eyes[1]; entity->myHeap = NULL; DeleteEntity(entity); - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[1] = NULL; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[1] = NULL; - entity = ((VaatiWrathHeapStruct*)this->myHeap)->eyes[2]; + entity = ((VaatiWrathHeapStruct*)super->myHeap)->eyes[2]; entity->myHeap = NULL; DeleteEntity(entity); - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[2] = NULL; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[2] = NULL; - entity = ((VaatiWrathHeapStruct*)this->myHeap)->eyes[3]; + entity = ((VaatiWrathHeapStruct*)super->myHeap)->eyes[3]; entity->myHeap = NULL; DeleteEntity(entity); - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[3] = NULL; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[3] = NULL; SetPlayerControl(2); } } -void sub_08041CD0(Entity* this) { - GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); - if (this->frame & ANIM_DONE) { - if (this->timer != 0) { - this->timer--; +void sub_08041CD0(VaatiWrathEntity* this) { + GetNextFrame(((VaatiWrathHeapStruct*)super->myHeap)->type2); + if (super->frame & ANIM_DONE) { + if (super->timer != 0) { + super->timer--; } else { - this->subAction = 2; - this->timer = 60; + super->subAction = 2; + super->timer = 60; MessageFromTarget(TEXT_INDEX(TEXT_VAATI2, 0x51)); } } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } -void sub_08041D14(Entity* this) { +void sub_08041D14(VaatiWrathEntity* this) { Entity* pEVar1; - GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); + GetNextFrame(((VaatiWrathHeapStruct*)super->myHeap)->type2); if ((gMessage.state & MESSAGE_ACTIVE) == 0) { - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; } else { if (gEntCount < 0x46) { pEVar1 = CreateObject(VAATI3_DEATH, 0, 0); - pEVar1->parent = this; - this->child = pEVar1; + pEVar1->parent = super; + super->child = pEVar1; pEVar1 = CreateObject(VAATI3_DEATH, 1, 0); - pEVar1->parent = this; - this->subAction = 3; - this->timer = 150; - this->subtimer = 0; - this->spriteSettings.draw = 0; + pEVar1->parent = super; + super->subAction = 3; + super->timer = 150; + super->subtimer = 0; + super->spriteSettings.draw = 0; SoundReq(SFX_1C4); } } } } -void sub_08041D84(Entity* this) { - GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); - if (this->timer != 0) { - this->timer--; +void sub_08041D84(VaatiWrathEntity* this) { + GetNextFrame(((VaatiWrathHeapStruct*)super->myHeap)->type2); + if (super->timer != 0) { + super->timer--; } else { - if (this->subtimer < 0xf0) { - if ((0xb7 < this->subtimer) && ((this->subtimer & 7) == 0)) { - ChangeObjPalette(((VaatiWrathHeapStruct*)this->myHeap)->type2, - gUnk_080D0E80[(this->subtimer - 0xb8) >> 3]); - ChangeObjPalette(this->child, gUnk_080D0E80[(this->subtimer - 0xb8) >> 3]); + if (super->subtimer < 0xf0) { + if ((0xb7 < super->subtimer) && ((super->subtimer & 7) == 0)) { + ChangeObjPalette(((VaatiWrathHeapStruct*)super->myHeap)->type2, + gUnk_080D0E80[(super->subtimer - 0xb8) >> 3]); + ChangeObjPalette(super->child, gUnk_080D0E80[(super->subtimer - 0xb8) >> 3]); } - if (this->subtimer == 0xe6) { + if (super->subtimer == 0xe6) { SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 4); } } else { - this->subAction = 4; - this->spriteSettings.draw = 1; - ChangeObjPalette(this, 0x173); - InitAnimationForceUpdate(this, 0xb); + super->subAction = 4; + super->spriteSettings.draw = 1; + ChangeObjPalette(super, 0x173); + InitAnimationForceUpdate(super, 0xb); } - this->subtimer++; + super->subtimer++; sub_08041E78(this); } } -void sub_08041E20(Entity* this) { - this->subtimer++; +void sub_08041E20(VaatiWrathEntity* this) { + super->subtimer++; sub_08041E78(this); - GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); + GetNextFrame(((VaatiWrathHeapStruct*)super->myHeap)->type2); if (gFadeControl.active == 0) { - this->subAction = 5; - this->timer = 90; + super->subAction = 5; + super->timer = 90; } } -void sub_08041E50(Entity* this) { +void sub_08041E50(VaatiWrathEntity* this) { Entity* type2; - if (--this->timer == 0) { + if (--super->timer == 0) { SetGlobalFlag(ENDING); - type2 = ((VaatiWrathHeapStruct*)this->myHeap)->type2; + type2 = ((VaatiWrathHeapStruct*)super->myHeap)->type2; type2->myHeap = NULL; DeleteEntity(type2); DeleteThisEntity(); } } -void sub_08041E78(Entity* this) { +void sub_08041E78(VaatiWrathEntity* this) { Entity* fx; const s8* temp; - if ((this->subtimer & 0xf) == 0) { - fx = CreateFx(this, FX_GIANT_EXPLOSION4, 0); + if ((super->subtimer & 0xf) == 0) { + fx = CreateFx(super, FX_GIANT_EXPLOSION4, 0); if (fx != NULL) { - temp = &gUnk_080D0E90[this->subtimer >> 3 & 0xe]; + temp = &gUnk_080D0E90[super->subtimer >> 3 & 0xe]; fx->x.HALF.HI += *temp++; fx->y.HALF.HI += *temp; fx->spritePriority.b0 = 3; @@ -717,15 +717,15 @@ void sub_08041E78(Entity* this) { } } -u32 sub_08041ED4(Entity* this) { +u32 sub_08041ED4(VaatiWrathEntity* this) { VaatiWrathHeapStruct* heap; Entity* entity; if (gEntCount < 0x46) { heap = zMalloc(sizeof(VaatiWrathHeapStruct)); if (heap != NULL) { - this->myHeap = (void*)heap; - heap->type0 = this; + super->myHeap = (void*)heap; + heap->type0 = super; heap->type3 = NULL; heap->arms[0] = NULL; heap->arms[1] = NULL; @@ -741,7 +741,7 @@ u32 sub_08041ED4(Entity* this) { return 0; } -u32 sub_08041F1C(Entity* this) { +u32 sub_08041F1C(VaatiWrathEntity* this) { Entity* eye; if (!(gEntCount < 0x44)) { @@ -749,34 +749,34 @@ u32 sub_08041F1C(Entity* this) { } eye = CreateEnemy(VAATI_WRATH_EYE, 0); - eye->parent = this; - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[0] = eye; + eye->parent = super; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[0] = eye; eye = CreateEnemy(VAATI_WRATH_EYE, 1); - eye->parent = this; - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[1] = eye; + eye->parent = super; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[1] = eye; eye = CreateEnemy(VAATI_WRATH_EYE, 2); - eye->parent = this; - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[2] = eye; + eye->parent = super; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[2] = eye; eye = CreateEnemy(VAATI_WRATH_EYE, 3); - eye->parent = this; - ((VaatiWrathHeapStruct*)this->myHeap)->eyes[3] = eye; + eye->parent = super; + ((VaatiWrathHeapStruct*)super->myHeap)->eyes[3] = eye; return 1; } -u32 sub_08041F74(Entity* this, u32 unk1) { +u32 sub_08041F74(VaatiWrathEntity* this, u32 unk1) { Entity* arm; VaatiWrathHeapStruct* heap; if (!(gEntCount < 0x47)) { return 0; } - heap = ((VaatiWrathHeapStruct*)this->myHeap); + heap = ((VaatiWrathHeapStruct*)super->myHeap); arm = NULL; if ((gRoomTransition.field_0x39 >> unk1 & 1U) != 0) { arm = CreateEnemy(VAATI_ARM, 0); arm->type2 = unk1; - arm->parent = this; - CopyPosition(this, arm); + arm->parent = super; + CopyPosition(super, arm); } if (unk1 == 0) { heap->arms[0] = arm; @@ -786,7 +786,7 @@ u32 sub_08041F74(Entity* this, u32 unk1) { return 1; } -u32 sub_08041FCC(Entity* this) { +u32 sub_08041FCC(VaatiWrathEntity* this) { if (gEntCount < 0x4d) { if (sub_08041ED4(this)) { sub_08041F74(this, 0); @@ -798,40 +798,40 @@ u32 sub_08041FCC(Entity* this) { return 0; } -void sub_08042004(Entity* this) { - this->z.HALF.HI = gUnk_080D0EA0[(++this->field_0x78.HALF.LO >> 4) & 7]; +void sub_08042004(VaatiWrathEntity* this) { + super->z.HALF.HI = gUnk_080D0EA0[(++this->unk_78 >> 4) & 7]; } -void sub_08042028(Entity* this) { - this->action = 3; - this->timer = gUnk_080D0EA8[Random() & 3]; - this->speed = 0x40; - this->direction = sub_0804207C(this); +void sub_08042028(VaatiWrathEntity* this) { + super->action = 3; + super->timer = gUnk_080D0EA8[Random() & 3]; + super->speed = 0x40; + super->direction = sub_0804207C(this); } -void sub_08042050(Entity* this) { +void sub_08042050(VaatiWrathEntity* this) { u32 uVar1; - this->action = 8; + super->action = 8; uVar1 = Random(); - this->timer = gUnk_080D0EAC[uVar1 & 3]; - this->speed = 0x20; - this->direction = ((uVar1 >> 8) & 0x10) + 8; + super->timer = gUnk_080D0EAC[uVar1 & 3]; + super->speed = 0x20; + super->direction = ((uVar1 >> 8) & 0x10) + 8; } -u32 sub_0804207C(Entity* this) { +u32 sub_0804207C(VaatiWrathEntity* this) { Entity* arm; u32 x; u32 y; u32 tmp; - x = this->x.HALF.HI; - y = this->y.HALF.HI - 0x10; - arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[0]; + x = super->x.HALF.HI; + y = super->y.HALF.HI - 0x10; + arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[0]; if ((arm != NULL) && (arm->action >= 5) && EntityWithinDistance(arm, x, y, 0x30)) { return CalculateDirectionTo(arm->x.HALF.HI, arm->y.HALF.HI, x, y); } else { - arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[1]; + arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[1]; if (((arm != NULL) && (arm->action >= 5)) && EntityWithinDistance(arm, x, y, 0x30)) { return CalculateDirectionTo(arm->x.HALF.HI, arm->y.HALF.HI, x, y); } else { @@ -841,33 +841,33 @@ u32 sub_0804207C(Entity* this) { } else { tmp = gPlayerEntity.y.HALF.HI - 0x28; } - return CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gPlayerEntity.x.HALF.HI, tmp); + return CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gPlayerEntity.x.HALF.HI, tmp); } } } -void sub_08042120(Entity* this) { - this->action = 5; - this->subAction = 0; +void sub_08042120(VaatiWrathEntity* this) { + super->action = 5; + super->subAction = 0; } -void sub_0804212C(Entity* this) { +void sub_0804212C(VaatiWrathEntity* this) { Entity* arm; u32 y, x; - if (this->field_0x7c.HALF.LO != 0u) { - this->field_0x7c.HALF.LO--; + if (this->unk_7c != 0u) { + this->unk_7c--; return; } arm = NULL; - y = this->y.HALF.HI - 0x44; + y = super->y.HALF.HI - 0x44; if (gPlayerEntity.y.HALF.HI - y < 0x61u) { - x = this->x.HALF.HI - 0x38; + x = super->x.HALF.HI - 0x38; if (gPlayerEntity.x.HALF.HI - x < 0x39u) { - arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[1]; + arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[1]; } else { - if ((gPlayerEntity.x.HALF.HI - this->x.HALF.HI) < 0x39u) { - arm = ((VaatiWrathHeapStruct*)this->myHeap)->arms[0]; + if ((gPlayerEntity.x.HALF.HI - super->x.HALF.HI) < 0x39u) { + arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[0]; } } } @@ -880,97 +880,97 @@ void sub_0804212C(Entity* this) { } arm->action = 3; arm->subAction = 0; - this->field_0x7c.HALF.LO = 0x2d0; + this->unk_7c = 0x2d0; } else { - this->field_0x7c.HALF.LO = 0x3c; + this->unk_7c = 0x3c; } } -void sub_080421AC(Entity* this) { - if (this->field_0x7c.HALF_U.HI != 0) { - this->field_0x7c.HALF_U.HI--; +void sub_080421AC(VaatiWrathEntity* this) { + if (this->unk_7e != 0) { + this->unk_7e--; } else { - if (this->field_0x78.HALF.HI == 0) { + if (this->unk_79 == 0) { if (((Random() & 1) != 0) && ((gRoomTransition.field_0x39 & 0xc) != 0)) { sub_08042264(this); - this->field_0x78.HALF.HI = 1; + this->unk_79 = 1; return; } - this->field_0x7c.HALF_U.HI = 0x1e; + this->unk_7e = 0x1e; return; } if (sub_080422C0(this, 0) == 0) { return; } - this->field_0x78.HALF.HI = 0; - this->field_0x7c.HALF_U.HI = 0x168; + this->unk_79 = 0; + this->unk_7e = 0x168; } } -void sub_08042214(Entity* this) { - if (this->field_0x7c.HALF_U.HI != 0) { - this->field_0x7c.HALF_U.HI--; +void sub_08042214(VaatiWrathEntity* this) { + if (this->unk_7e != 0) { + this->unk_7e--; } else { - if (this->field_0x78.HALF.HI == 0) { + if (this->unk_79 == 0) { if ((Random() & 3) != 0) { sub_0804228C(this); - this->field_0x78.HALF.HI = 1; + this->unk_79 = 1; return; } - this->field_0x7c.HALF_U.HI = 0x1e; + this->unk_7e = 0x1e; } else { if (sub_080422C0(this, 1) == 0) { return; } - this->field_0x78.HALF.HI = 0; - this->field_0x7c.HALF_U.HI = 0xb4; + this->unk_79 = 0; + this->unk_7e = 0xb4; } } } -void sub_08042264(Entity* this) { - InitAnimationForceUpdate(this, 1); - ((VaatiWrathHeapStruct*)this->myHeap)->type1->subAction = 1; - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type1, 0xd); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x13); +void sub_08042264(VaatiWrathEntity* this) { + InitAnimationForceUpdate(super, 1); + ((VaatiWrathHeapStruct*)super->myHeap)->type1->subAction = 1; + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type1, 0xd); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type2, 0x13); } -void sub_0804228C(Entity* this) { - InitAnimationForceUpdate(this, 2); - ((VaatiWrathHeapStruct*)this->myHeap)->type1->subAction = 1; - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type1, 0xd); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x13); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type3, 0x1d); +void sub_0804228C(VaatiWrathEntity* this) { + InitAnimationForceUpdate(super, 2); + ((VaatiWrathHeapStruct*)super->myHeap)->type1->subAction = 1; + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type1, 0xd); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type2, 0x13); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type3, 0x1d); } -u32 sub_080422C0(Entity* this, u32 unk1) { +u32 sub_080422C0(VaatiWrathEntity* this, u32 unk1) { Entity* type1; Entity* child; u32 tmp; - UpdateAnimationSingleFrame(this); - GetNextFrame(((VaatiWrathHeapStruct*)this->myHeap)->type2); - type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1; + UpdateAnimationSingleFrame(super); + GetNextFrame(((VaatiWrathHeapStruct*)super->myHeap)->type2); + type1 = ((VaatiWrathHeapStruct*)super->myHeap)->type1; GetNextFrame(type1); if (unk1 + 1 == (tmp = type1->frame)) { child = CreateProjectile(V3_ELECTRIC_PROJECTILE); if (child != NULL) { child->type = unk1; - child->parent = this; + child->parent = super; type1->frame &= ~tmp; } } else { if (type1->frame == 4) { type1->frame &= 0xfb; - InitAnimationForceUpdate(this, 3); + InitAnimationForceUpdate(super, 3); } else { if (type1->frame & ANIM_DONE) { - InitAnimationForceUpdate(this, 0); + InitAnimationForceUpdate(super, 0); type1->subAction = 0; InitializeAnimation(type1, 0xc); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x12); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type2, 0x12); if (unk1 == 1) { - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type3, 0x1b); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type3, 0x1b); } return 1; } @@ -979,23 +979,23 @@ u32 sub_080422C0(Entity* this, u32 unk1) { return 0; } -void sub_0804235C(Entity* this) { +void sub_0804235C(VaatiWrathEntity* this) { Entity* type1; - this->action = 7; - this->timer = 120; - this->field_0x78.HALF.HI = 0; - this->field_0x7c.HALF.HI = 0xf0; - InitAnimationForceUpdate(this, 0); - type1 = ((VaatiWrathHeapStruct*)this->myHeap)->type1; + super->action = 7; + super->timer = 120; + this->unk_79 = 0; + this->unk_7e = 0xf0; + InitAnimationForceUpdate(super, 0); + type1 = ((VaatiWrathHeapStruct*)super->myHeap)->type1; type1->subAction = 0; InitializeAnimation(type1, 0xc); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type2, 0x12); - InitializeAnimation(((VaatiWrathHeapStruct*)this->myHeap)->type3, 0x1b); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type2, 0x12); + InitializeAnimation(((VaatiWrathHeapStruct*)super->myHeap)->type3, 0x1b); } #if defined USA || defined DEMO_USA || defined DEMO_JP -void VaatiWrathType0PreAction(Entity* this) { +void VaatiWrathType0PreAction(VaatiWrathEntity* this) { int temp; if ((gRoomTransition.field_0x38 & 2) == 0) { if (gSave.vaati_timer != 0) { @@ -1006,7 +1006,7 @@ void VaatiWrathType0PreAction(Entity* this) { case PL_STATE_IDLE: case PL_STATE_WALK: if (gPlayerState.item == NULL) { - if (gPlayerEntity.field_0x7a.HWORD == 0) { + if (gNewPlayerEntity.unk_7a == 0) { if ((gPlayerEntity.z.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) { CreateEzloHint(TEXT_INDEX(TEXT_EZLO, 0x70), 0); gRoomTransition.field_0x38 |= 2; @@ -1020,56 +1020,56 @@ void VaatiWrathType0PreAction(Entity* this) { } #endif -void VaatiWrathType1(Entity* this) { - if (((VaatiWrathHeapStruct*)this->myHeap)->type0->next == NULL) { - this->myHeap = NULL; +void VaatiWrathType1(VaatiWrathEntity* this) { + if (((VaatiWrathHeapStruct*)super->myHeap)->type0->next == NULL) { + super->myHeap = NULL; DeleteThisEntity(); } - if (this->action == 0) { - this->action = 1; - this->subAction = 0; - InitializeAnimation(this, 0xc); + if (super->action == 0) { + super->action = 1; + super->subAction = 0; + InitializeAnimation(super, 0xc); } - if (this->subAction == 0) { - GetNextFrame(this); + if (super->subAction == 0) { + GetNextFrame(super); } - if ((*(u32*)&this->animIndex & 0x8000ff) == 0x80000c) { - InitializeAnimation(this, 0xc); - this->frameDuration = (Random() & 0x78) + 0x78; + if ((*(u32*)&super->animIndex & 0x8000ff) == 0x80000c) { + InitializeAnimation(super, 0xc); + super->frameDuration = (Random() & 0x78) + 0x78; } - sub_0806FA90(((VaatiWrathHeapStruct*)this->myHeap)->type0, this, 0, 1); - this->spriteOffsetY--; + sub_0806FA90(((VaatiWrathHeapStruct*)super->myHeap)->type0, super, 0, 1); + super->spriteOffsetY--; } -void VaatiWrathType2(Entity* this) { +void VaatiWrathType2(VaatiWrathEntity* this) { u32 uVar1; - if (((VaatiWrathHeapStruct*)this->myHeap)->type0->next == NULL) { - this->myHeap = NULL; + if (((VaatiWrathHeapStruct*)super->myHeap)->type0->next == NULL) { + super->myHeap = NULL; DeleteThisEntity(); } - if (this->action == 0) { - this->action = 1; - InitializeAnimation(this, 0x12); + if (super->action == 0) { + super->action = 1; + InitializeAnimation(super, 0x12); } - sub_0806FA90(((VaatiWrathHeapStruct*)this->myHeap)->type0, this, 0, -1); - this->spriteOffsetY++; - if (this->animIndex == 0x12) { - uVar1 = GetFacingDirection(this, &gPlayerEntity); - this->x.HALF.HI = gUnk_080D0EB0[uVar1] + this->x.HALF.HI; + sub_0806FA90(((VaatiWrathHeapStruct*)super->myHeap)->type0, super, 0, -1); + super->spriteOffsetY++; + if (super->animIndex == 0x12) { + uVar1 = GetFacingDirection(super, &gPlayerEntity); + super->x.HALF.HI = gUnk_080D0EB0[uVar1] + super->x.HALF.HI; } } -void VaatiWrathType3(Entity* this) { - if (((VaatiWrathHeapStruct*)this->myHeap)->type0->next == NULL) { - this->myHeap = NULL; +void VaatiWrathType3(VaatiWrathEntity* this) { + if (((VaatiWrathHeapStruct*)super->myHeap)->type0->next == NULL) { + super->myHeap = NULL; DeleteThisEntity(); } - if (this->action == 0) { - this->action = 1; - InitializeAnimation(this, 0x1c); + if (super->action == 0) { + super->action = 1; + InitializeAnimation(super, 0x1c); } - sub_0806FA90(((VaatiWrathHeapStruct*)this->myHeap)->type0, this, 0, -1); - this->spriteOffsetY++; - GetNextFrame(this); + sub_0806FA90(((VaatiWrathHeapStruct*)super->myHeap)->type0, super, 0, -1); + super->spriteOffsetY++; + GetNextFrame(super); } diff --git a/src/enemy/vaatiWrathEye.c b/src/enemy/vaatiWrathEye.c index 6dadee24..42da5f1e 100644 --- a/src/enemy/vaatiWrathEye.c +++ b/src/enemy/vaatiWrathEye.c @@ -4,8 +4,8 @@ * * @brief Vaati Wrath Eye enemy */ -//#define NENT_DEPRECATED -#include "enemy.h" +#define NENT_DEPRECATED +#include "enemy/vaatiWrath.h" #include "functions.h" void sub_080485D8(Entity*); @@ -80,7 +80,7 @@ void VaatiWrathEyeAction3(Entity* this) { const s8* ptr; parent = this->parent; - if (parent->field_0x78.HALF.HI != 0) { + if (((VaatiWrathEntity*)parent)->unk_79 != 0) { sub_080485D8(this); } else { ptr = &gUnk_080D1D98[this->type * 2]; @@ -164,14 +164,14 @@ void VaatiWrathEyeAction7(Entity* this) { COLLISION_OFF(this); this->spriteSettings.draw = 0; CreateFx(this, FX_REFLECT2, 0x40); - this->parent->field_0x7a.HALF.HI |= 0x10 << this->type; + ((VaatiWrathEntity*)this->parent)->unk_7b |= 0x10 << this->type; } else { if (--this->timer != 0) { return; } this->action = 5; this->timer = 0; - this->parent->field_0x7a.HALF.HI |= 1 << this->type; + ((VaatiWrathEntity*)this->parent)->unk_7b |= 1 << this->type; } } @@ -196,7 +196,8 @@ void VaatiWrathEyeAction9(Entity* this) { if ((this->frame & ANIM_DONE) != 0) { this->action = 4; this->timer = 1; - this->parent->field_0x7a.HALF.HI = (this->parent->field_0x7a.HALF.HI & 0xf) | (1 << this->type); + ((VaatiWrathEntity*)this->parent)->unk_7b = + (((VaatiWrathEntity*)this->parent)->unk_7b & 0xf) | (1 << this->type); } } @@ -212,5 +213,5 @@ void sub_080485FC(Entity* this) { ptr = &gUnk_080D1D98[this->type * 2]; sub_0806FA90(this->parent, this, ptr[0], ptr[1]); - this->z.HALF.HI = gUnk_080D1D78[this->type * 8 + (this->parent->field_0x78.HALF.LO >> 4 & 7)]; + this->z.HALF.HI = gUnk_080D1D78[this->type * 8 + (((VaatiWrathEntity*)this->parent)->unk_78 >> 4 & 7)]; } diff --git a/src/enemy/wallMaster.c b/src/enemy/wallMaster.c index a41578ca..07f63fec 100644 --- a/src/enemy/wallMaster.c +++ b/src/enemy/wallMaster.c @@ -4,207 +4,219 @@ * * @brief Wall Master enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" #include "screenTransitions.h" -void sub_0802A78C(Entity*); -void sub_0802A7D0(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[16]; + /*0x78*/ u16 unk_78; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ u8 unk_7c; + /*0x7d*/ u8 unk_7d; + /*0x7e*/ u16 unk_7e; + /*0x80*/ u16 unk_80; + /*0x82*/ u16 unk_82; +} WallMasterEntity; -extern void (*const WallMaster_Functions[])(Entity*); -extern void (*const gUnk_080CD094[])(Entity*); +void sub_0802A78C(WallMasterEntity*); +void sub_0802A7D0(WallMasterEntity*); + +extern void (*const WallMaster_Functions[])(WallMasterEntity*); +extern void (*const gUnk_080CD094[])(WallMasterEntity*); extern const s8 gUnk_080CD0B0[]; -void WallMaster(Entity* this) { - WallMaster_Functions[GetNextFunction(this)](this); - SetChildOffset(this, 0, 1, -0x10); +void WallMaster(WallMasterEntity* this) { + WallMaster_Functions[GetNextFunction(super)](this); + SetChildOffset(super, 0, 1, -0x10); } -void WallMaster_OnTick(Entity* this) { +void WallMaster_OnTick(WallMasterEntity* this) { sub_0802A78C(this); - gUnk_080CD094[this->action](this); + gUnk_080CD094[super->action](this); } -void WallMaster_OnCollision(Entity* this) { - if (this->hitType != 0x75 && ((this->contactFlags & 0x7f) == 0 || (this->contactFlags & 0x7f) == 0x1e)) { - this->action = 5; - COLLISION_OFF(this); - this->field_0x7c.HALF.HI = gPlayerEntity.x.HALF.HI; - this->field_0x80.HWORD = gPlayerEntity.y.HALF.HI; - this->field_0x82.HWORD = gPlayerEntity.z.HALF.HI; - if (this->action != 3) { - InitializeAnimation(this, 1); +void WallMaster_OnCollision(WallMasterEntity* this) { + if (super->hitType != 0x75 && ((super->contactFlags & 0x7f) == 0 || (super->contactFlags & 0x7f) == 0x1e)) { + super->action = 5; + COLLISION_OFF(super); + this->unk_7e = gPlayerEntity.x.HALF.HI; + this->unk_80 = gPlayerEntity.y.HALF.HI; + this->unk_82 = gPlayerEntity.z.HALF.HI; + if (super->action != 3) { + InitializeAnimation(super, 1); } } - if (this->knockbackDuration != 0) - if (this->knockbackDuration > 4) - this->knockbackDuration -= 4; + if (super->knockbackDuration != 0) + if (super->knockbackDuration > 4) + super->knockbackDuration -= 4; - if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); + if (super->confusedTime != 0) { + Create0x68FX(super, FX_STARS); } - EnemyFunctionHandlerAfterCollision(this, WallMaster_Functions); + EnemyFunctionHandlerAfterCollision(super, (EntityActionArray)WallMaster_Functions); } -void WallMaster_OnGrabbed(Entity* this) { +void WallMaster_OnGrabbed(WallMasterEntity* this) { /* ... */ } -void sub_0802A4E4(Entity* this) { - sub_0804A720(this); - this->action = 1; - this->collisionLayer = 3; - this->field_0x7c.BYTES.byte1 = Random(); - this->field_0x7a.HWORD = this->type2 * 0x3c; - this->field_0x7c.BYTES.byte0 = this->timer; - this->field_0x78.HWORD = this->timer * 0x3c; - UpdateSpriteForCollisionLayer(this); +void sub_0802A4E4(WallMasterEntity* this) { + sub_0804A720(super); + super->action = 1; + super->collisionLayer = 3; + this->unk_7d = Random(); + this->unk_7a = super->type2 * 0x3c; + this->unk_7c = super->timer; + this->unk_78 = super->timer * 0x3c; + UpdateSpriteForCollisionLayer(super); sub_0802A7D0(this); } -void sub_0802A534(Entity* this) { - if (this->field_0x78.HWORD) { - this->field_0x78.HWORD--; - } else if (this->field_0x7a.HWORD == 0) { +void sub_0802A534(WallMasterEntity* this) { + if (this->unk_78) { + this->unk_78--; + } else if (this->unk_7a == 0) { Entity* entity = sub_08049DF4(1); if (entity != NULL) { - this->action = 2; - this->timer = 90; - COLLISION_ON(this); - this->spriteSettings.draw = 3; - this->x.HALF.HI = entity->x.HALF.HI; - this->y.HALF.HI = entity->y.HALF.HI; - this->z.HALF.HI = -0x80; - this->spritePriority.b1 = 1; - this->spriteSettings.shadow = 2; - InitializeAnimation(this, 2); + super->action = 2; + super->timer = 90; + COLLISION_ON(super); + super->spriteSettings.draw = 3; + super->x.HALF.HI = entity->x.HALF.HI; + super->y.HALF.HI = entity->y.HALF.HI; + super->z.HALF.HI = -0x80; + super->spritePriority.b1 = 1; + super->spriteSettings.shadow = 2; + InitializeAnimation(super, 2); sub_0802A7D0(this); } } } -void sub_0802A5B8(Entity* this) { +void sub_0802A5B8(WallMasterEntity* this) { sub_0802A7D0(this); - if (this->timer) { - if (--this->timer == 0) { + if (super->timer) { + if (--super->timer == 0) { EnqueueSFX(SFX_12D); - InitializeAnimation(this, 0); + InitializeAnimation(super, 0); } } else { - this->z.HALF.HI += 3; - if (-1 < this->z.HALF.HI) { - this->action = 3; - this->spriteSettings.draw = 1; - this->z.HALF.HI = 0; - InitializeAnimation(this, 1); + super->z.HALF.HI += 3; + if (-1 < super->z.HALF.HI) { + super->action = 3; + super->spriteSettings.draw = 1; + super->z.HALF.HI = 0; + InitializeAnimation(super, 1); } } } -/* Kids... don't try to optimize code like this... */ -void sub_0802A610(Entity* this) { +/* Kids... don't try to optimize code like super... */ +void sub_0802A610(WallMasterEntity* this) { u32 flags; - GetNextFrame(this); + GetNextFrame(super); sub_0802A7D0(this); - flags = this->frame & ANIM_DONE; + flags = super->frame & ANIM_DONE; if (flags) { - this->action = 4; - this->timer = 30; - } else if (this->frame & 1) { - this->frame = flags; - this->hitType = 0x75; + super->action = 4; + super->timer = 30; + } else if (super->frame & 1) { + super->frame = flags; + super->hitType = 0x75; } } -void sub_0802A650(Entity* this) { +void sub_0802A650(WallMasterEntity* this) { sub_0802A7D0(this); - this->z.HALF.HI -= 2; - if (-0xa0 > this->z.HALF.HI) { - this->action = 1; - COLLISION_OFF(this); - this->spriteSettings.draw = 0; - this->hitType = 0x74; - this->field_0x78.HWORD = this->field_0x7c.BYTES.byte0 * 0x3c; + super->z.HALF.HI -= 2; + if (-0xa0 > super->z.HALF.HI) { + super->action = 1; + COLLISION_OFF(super); + super->spriteSettings.draw = 0; + super->hitType = 0x74; + this->unk_78 = this->unk_7c * 0x3c; } } -void sub_0802A69C(Entity* this) { +void sub_0802A69C(WallMasterEntity* this) { u32 flags; sub_0802A7D0(this); gPlayerState.field_0xa |= 0x80; gPlayerState.mobility |= 0x80; - gPlayerEntity.x.HALF.HI = this->field_0x7c.HALF.HI; - gPlayerEntity.y.HALF.HI = this->field_0x80.HWORD; - gPlayerEntity.z.HALF.HI = this->field_0x82.HWORD; + gPlayerEntity.x.HALF.HI = this->unk_7e; + gPlayerEntity.y.HALF.HI = this->unk_80; + gPlayerEntity.z.HALF.HI = this->unk_82; - if (gPlayerEntity.z.HALF.HI != this->z.HALF.HI) { - if (gPlayerEntity.z.HALF.HI < this->z.HALF.HI) { - this->z.HALF.HI--; + if (gPlayerEntity.z.HALF.HI != super->z.HALF.HI) { + if (gPlayerEntity.z.HALF.HI < super->z.HALF.HI) { + super->z.HALF.HI--; } else { - this->z.HALF.HI++; + super->z.HALF.HI++; } } /* sigh... */ - GetNextFrame(this); - flags = this->frame & ANIM_DONE; + GetNextFrame(super); + flags = super->frame & ANIM_DONE; if (flags) { - this->action = 6; - this->timer = 30; - } else if (this->frame & 0x1) { - this->frame = flags; - this->spriteOffsetY = 3; + super->action = 6; + super->timer = 30; + } else if (super->frame & 0x1) { + super->frame = flags; + super->spriteOffsetY = 3; gPlayerEntity.spriteSettings.draw = 0; } } -void sub_0802A734(Entity* this) { +void sub_0802A734(WallMasterEntity* this) { sub_0802A7D0(this); - if (--this->timer == 0) { + if (--super->timer == 0) { SetInitializationPriority(); DoExitTransition(gWallMasterScreenTransitions[gArea.dungeon_idx]); } else { - this->z.WORD -= Q_16_16(2); + super->z.WORD -= Q_16_16(2); gPlayerState.field_0xa |= 0x80; gPlayerState.mobility |= 0x80; } } -void sub_0802A78C(Entity* this) { - if (this->action != 0) { - if (sub_08049FDC(this, 1)) { - if (this->field_0x78.HWORD == 0) { - if (this->field_0x7a.HWORD) { - this->field_0x7a.HWORD--; +void sub_0802A78C(WallMasterEntity* this) { + if (super->action != 0) { + if (sub_08049FDC(super, 1)) { + if (this->unk_78 == 0) { + if (this->unk_7a) { + this->unk_7a--; } } } else { - this->field_0x7a.HWORD = this->type2 * 0x3c + 1; + this->unk_7a = super->type2 * 0x3c + 1; } } } -void sub_0802A7D0(Entity* this) { - u32 unk = gUnk_080CD0B0[(this->field_0x7c.BYTES.byte1++ >> 3) & 7] + 0x100; - SetAffineInfo(this, unk, unk, 0); +void sub_0802A7D0(WallMasterEntity* this) { + u32 unk = gUnk_080CD0B0[(this->unk_7d++ >> 3) & 7] + 0x100; + SetAffineInfo(super, unk, unk, 0); } // clang-format off -void (*const WallMaster_Functions[])(Entity*) = { +void (*const WallMaster_Functions[])(WallMasterEntity*) = { WallMaster_OnTick, WallMaster_OnCollision, - GenericKnockback2, - GenericDeath, - GenericConfused, + (void (*)(WallMasterEntity*))GenericKnockback2, + (void (*)(WallMasterEntity*))GenericDeath, + (void (*)(WallMasterEntity*))GenericConfused, WallMaster_OnGrabbed, }; -void (*const gUnk_080CD094[])(Entity*) = { +void (*const gUnk_080CD094[])(WallMasterEntity*) = { sub_0802A4E4, sub_0802A534, sub_0802A5B8, diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c index f8475010..f7ebe0ff 100644 --- a/src/enemy/wallMaster2.c +++ b/src/enemy/wallMaster2.c @@ -4,204 +4,213 @@ * * @brief Wall Master 2 enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" #include "screenTransitions.h" -extern void GenericKnockback2(Entity*); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[12]; + /*0x74*/ u16 unk_74; + /*0x76*/ u16 unk_76; + /*0x78*/ u16 unk_78; + /*0x7a*/ u8 unk_7a; + /*0x7b*/ u8 unk_7b; + /*0x7c*/ u16 unk_7c; +} WallMaster2Entity; extern Entity* gUnk_020000B0; -void sub_0802CF64(Entity*); -void sub_0802CF8C(Entity*); -void sub_0802CFD8(Entity*); +void sub_0802CF64(WallMaster2Entity*); +void sub_0802CF8C(WallMaster2Entity*); +void sub_0802CFD8(WallMaster2Entity*); -extern void (*const WallMaster2_Functions[])(Entity*); -extern void (*const gUnk_080CD714[])(Entity*); +extern void (*const WallMaster2_Functions[])(WallMaster2Entity*); +extern void (*const gUnk_080CD714[])(WallMaster2Entity*); extern const u16 gUnk_080CD728[]; extern const u16 gUnk_080CD730[]; extern const s8 gUnk_080CD740[]; -void WallMaster2(Entity* this) { - WallMaster2_Functions[GetNextFunction(this)](this); - SetChildOffset(this, 0, 1, -0x10); +void WallMaster2(WallMaster2Entity* this) { + WallMaster2_Functions[GetNextFunction(super)](this); + SetChildOffset(super, 0, 1, -0x10); } -void WallMaster2_OnTick(Entity* this) { - gUnk_080CD714[this->action](this); +void WallMaster2_OnTick(WallMaster2Entity* this) { + gUnk_080CD714[super->action](this); } -void WallMaster2_OnCollision(Entity* this) { - u8 bVar1 = this->contactFlags & 0x7f; - switch (this->contactFlags & 0x7f) { +void WallMaster2_OnCollision(WallMaster2Entity* this) { + u8 bVar1 = super->contactFlags & 0x7f; + switch (super->contactFlags & 0x7f) { case 0 ... 1: case 0x1e: - this->action = 3; - COLLISION_OFF(this); - InitializeAnimation(this, 1); + super->action = 3; + COLLISION_OFF(super); + InitializeAnimation(super, 1); gPlayerEntity.flags &= ~ENT_COLLIDE; break; } - if (this->confusedTime != 0) { - Create0x68FX(this, FX_STARS); + if (super->confusedTime != 0) { + Create0x68FX(super, FX_STARS); } - EnemyFunctionHandlerAfterCollision(this, WallMaster2_Functions); + EnemyFunctionHandlerAfterCollision(super, (EntityActionArray)WallMaster2_Functions); } -void WallMaster2_OnGrabbed(Entity* this) { +void WallMaster2_OnGrabbed(WallMaster2Entity* this) { /* ... */ } -void sub_0802CCE0(Entity* this) { +void sub_0802CCE0(WallMaster2Entity* this) { u32 tmp; - sub_0804A720(this); - this->action = 1; - this->timer = 60; - this->subtimer = Random(); - this->spriteSettings.shadow = 2; - this->animationState = 0xff; - this->z.HALF.HI = -2; - this->collisionLayer = 3; + sub_0804A720(super); + super->action = 1; + super->timer = 60; + super->subtimer = Random(); + super->spriteSettings.shadow = 2; + super->animationState = 0xff; + super->z.HALF.HI = -2; + super->collisionLayer = 3; tmp = Random(); - this->field_0x7a.HALF.LO = tmp; - this->field_0x7a.HALF.HI = (tmp >> 8) & 0x60; - this->field_0x7c.HALF.LO = 0; - UpdateSpriteForCollisionLayer(this); - InitializeAnimation(this, 0); + this->unk_7a = tmp; + this->unk_7b = (tmp >> 8) & 0x60; + this->unk_7c = 0; + UpdateSpriteForCollisionLayer(super); + InitializeAnimation(super, 0); sub_0802CF64(this); sub_0802CFD8(this); } -void sub_0802CD54(Entity* this) { - GetNextFrame(this); +void sub_0802CD54(WallMaster2Entity* this) { + GetNextFrame(super); sub_0802CFD8(this); - if ((this->field_0x7c.HALF_U.LO == 0 || --this->field_0x7c.HALF_U.LO == 0) && sub_08049FDC(this, 1)) { - if (this->field_0x7a.HALF.HI) { - --this->field_0x7a.HALF.HI; + if ((this->unk_7c == 0 || --this->unk_7c == 0) && sub_08049FDC(super, 1)) { + if (this->unk_7b) { + --this->unk_7b; } else { u32 tmp; - this->action = 2; + super->action = 2; tmp = Random() >> 0x10; - this->timer = tmp; - this->speed = 0xc0; - this->field_0x78.HWORD = gUnk_080CD728[Random() & 3]; - this->field_0x7a.HALF.HI = (tmp >> 8) & 0x60; + super->timer = tmp; + super->speed = 0xc0; + this->unk_78 = gUnk_080CD728[Random() & 3]; + this->unk_7b = (tmp >> 8) & 0x60; return; } } - if (--this->timer == 0) { - this->timer = 60; + if (--super->timer == 0) { + super->timer = 60; sub_0802CF64(this); } - LinearMoveUpdate(this); + LinearMoveUpdate(super); } -void sub_0802CDE8(Entity* this) { - if (--this->field_0x78.HWORD && sub_08049FDC(this, 1)) { - if ((this->timer++ & 3) == 0) { - sub_08004596(this, GetFacingDirection(this, gUnk_020000B0)); +void sub_0802CDE8(WallMaster2Entity* this) { + if (--this->unk_78 && sub_08049FDC(super, 1)) { + if ((super->timer++ & 3) == 0) { + sub_08004596(super, GetFacingDirection(super, gUnk_020000B0)); sub_0802CF8C(this); } - LinearMoveUpdate(this); + LinearMoveUpdate(super); } else { - this->action = 1; - this->timer = 60; - this->speed = 0x60; - this->field_0x7c.HALF.LO = (Random() & 0x38) + 0x96; + super->action = 1; + super->timer = 60; + super->speed = 0x60; + this->unk_7c = (Random() & 0x38) + 0x96; } - GetNextFrame(this); + GetNextFrame(super); sub_0802CFD8(this); } -void sub_0802CE68(Entity* this) { +void sub_0802CE68(WallMaster2Entity* this) { u8 frames; gPlayerState.field_0xa |= 0x80; gPlayerState.mobility |= 0x80; gPlayerState.flags |= PL_DISABLE_ITEMS; - if (!EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) { - this->direction = GetFacingDirection(this, &gPlayerEntity); - LinearMoveUpdate(this); + if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) { + super->direction = GetFacingDirection(super, &gPlayerEntity); + LinearMoveUpdate(super); } sub_0802CFD8(this); - GetNextFrame(this); - frames = this->frame & ANIM_DONE; + GetNextFrame(super); + frames = super->frame & ANIM_DONE; if (frames) { - this->action = 4; - this->timer = 30; - } else if (this->frame & 1) { - this->frame = frames; + super->action = 4; + super->timer = 30; + } else if (super->frame & 1) { + super->frame = frames; gPlayerEntity.spriteSettings.draw = 0; } } -void sub_0802CEF4(Entity* this) { +void sub_0802CEF4(WallMaster2Entity* this) { sub_0802CFD8(this); - if (--this->timer == 0) { + if (--super->timer == 0) { SetInitializationPriority(); DoExitTransition(gWallMasterScreenTransitions[gArea.dungeon_idx]); } else { - this->z.WORD -= Q_16_16(2); - if (this->z.HALF.HI < -0x30) { - this->spriteSettings.shadow = 1; + super->z.WORD -= Q_16_16(2); + if (super->z.HALF.HI < -0x30) { + super->spriteSettings.shadow = 1; } gPlayerState.field_0xa |= 0x80; gPlayerState.mobility |= 0x80; } } -void sub_0802CF64(Entity* this) { - if (sub_08049FA0(this)) { - this->direction = Direction8Round(Random()); +void sub_0802CF64(WallMaster2Entity* this) { + if (sub_08049FA0(super)) { + super->direction = Direction8Round(Random()); } else { - this->direction = Direction8RoundUp(sub_08049EE4(this)); + super->direction = Direction8RoundUp(sub_08049EE4(super)); } sub_0802CF8C(this); } -void sub_0802CF8C(Entity* this) { +void sub_0802CF8C(WallMaster2Entity* this) { int iVar1; u32 dir; const u16* ptr; - dir = Direction8RoundUp(this->direction); - if (dir - Direction8FromAnimationState(this->animationState) + 6 > 12) { - this->animationState = Direction8ToAnimationState(dir); + dir = Direction8RoundUp(super->direction); + if (dir - Direction8FromAnimationState(super->animationState) + 6 > 12) { + super->animationState = Direction8ToAnimationState(dir); iVar1 = (dir >> 3) * 2; ptr = &gUnk_080CD730[iVar1]; - this->field_0x74.HWORD = ptr[0]; - this->field_0x76.HWORD = ptr[1]; - } else if (((this->direction + 1) & 7) > 2 && (Direction8ToAnimationState(dir) != this->animationState)) { - this->animationState = Direction8ToAnimationState(dir); + this->unk_74 = ptr[0]; + this->unk_76 = ptr[1]; + } else if (((super->direction + 1) & 7) > 2 && (Direction8ToAnimationState(dir) != super->animationState)) { + super->animationState = Direction8ToAnimationState(dir); iVar1 = (dir >> 3) * 2; ptr = &gUnk_080CD730[iVar1]; - this->field_0x74.HWORD = ptr[0]; - this->field_0x76.HWORD = ptr[1]; + this->unk_74 = ptr[0]; + this->unk_76 = ptr[1]; } } -void sub_0802CFD8(Entity* this) { - u32 unk = gUnk_080CD740[(this->field_0x7a.HALF.LO++ >> 3) & 7]; - SetAffineInfo(this, (s16)this->field_0x74.HWORD + unk, 0x100 + unk, this->field_0x76.HWORD); +void sub_0802CFD8(WallMaster2Entity* this) { + u32 unk = gUnk_080CD740[(this->unk_7a++ >> 3) & 7]; + SetAffineInfo(super, (s16)this->unk_74 + unk, 0x100 + unk, this->unk_76); } // clang-format off -void (*const WallMaster2_Functions[])(Entity*) = { +void (*const WallMaster2_Functions[])(WallMaster2Entity*) = { WallMaster2_OnTick, WallMaster2_OnCollision, - GenericKnockback2, - GenericDeath, - GenericConfused, + (void (*)(WallMaster2Entity*)) GenericKnockback2, + (void (*)(WallMaster2Entity*)) GenericDeath, + (void (*)(WallMaster2Entity*)) GenericConfused, WallMaster2_OnGrabbed, }; -void (*const gUnk_080CD714[])(Entity*) = { +void (*const gUnk_080CD714[])(WallMaster2Entity*) = { sub_0802CCE0, sub_0802CD54, sub_0802CDE8, diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index 0c8a8068..df73cb4a 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -4,163 +4,177 @@ * * @brief Wisp enemy */ -//#define NENT_DEPRECATED +#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" #include "object.h" #include "save.h" -static void sub_08033744(Entity* this); -void Wisp_OnTick(Entity* this); -void Wisp_OnCollision(Entity* this); -void Wisp_OnGrabbed(Entity* this); -void sub_08033674(Entity* this); -void sub_080336A8(Entity* this); -void sub_080336DC(Entity* this); -void sub_08033650(Entity* this); -void sub_08033658(Entity* this); -void sub_08033660(Entity* this); +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[20]; + /*0x7c*/ u16 unk_7c; + /*0x7e*/ u8 unused2[2]; + /*0x80*/ u16 unk_80; + /*0x82*/ u16 unk_82; +} WispEntity; -static void (*const Wisp_Functions[])(Entity*) = { - Wisp_OnTick, Wisp_OnCollision, GenericKnockback, GenericDeath, GenericConfused, Wisp_OnGrabbed, +static void sub_08033744(WispEntity* this); +void Wisp_OnTick(WispEntity* this); +void Wisp_OnCollision(WispEntity* this); +void Wisp_OnGrabbed(WispEntity* this); +void sub_08033674(WispEntity* this); +void sub_080336A8(WispEntity* this); +void sub_080336DC(WispEntity* this); +void sub_08033650(WispEntity* this); +void sub_08033658(WispEntity* this); +void sub_08033660(WispEntity* this); + +static void (*const Wisp_Functions[])(WispEntity*) = { + Wisp_OnTick, + Wisp_OnCollision, + (void (*)(WispEntity*))GenericKnockback, + (void (*)(WispEntity*))GenericDeath, + (void (*)(WispEntity*))GenericConfused, + Wisp_OnGrabbed, }; -void Wisp(Entity* this) { - EnemyFunctionHandler(this, Wisp_Functions); +void Wisp(WispEntity* this) { + EnemyFunctionHandler(super, (EntityActionArray)Wisp_Functions); } -void Wisp_OnTick(Entity* this) { - static void (*const actionFuncs[])(Entity*) = { +void Wisp_OnTick(WispEntity* this) { + static void (*const actionFuncs[])(WispEntity*) = { sub_08033674, sub_080336A8, sub_080336DC, }; - actionFuncs[this->action](this); + actionFuncs[super->action](this); } -void Wisp_OnCollision(Entity* this) { +void Wisp_OnCollision(WispEntity* this) { u32 bits; Entity* entity; - bits = this->contactFlags; + bits = super->contactFlags; if ((bits & 0x80) == 0) { return; } switch ((s32)bits & 0x3f) { case 0: - this->action = 2; - this->spriteSettings.draw = FALSE; - COLLISION_OFF(this); - this->field_0x7c.HALF.LO = 0x27c; + super->action = 2; + super->spriteSettings.draw = FALSE; + COLLISION_OFF(super); + this->unk_7c = 0x27c; gPlayerState.flags |= PL_DRUGGED; - gSave.stats.effect = this->type + 1; + gSave.stats.effect = super->type + 1; gSave.stats.effectTimer = 600; - if (this->type == 0) { + if (super->type == 0) { break; } DeleteThisEntity(); break; case 0xe: case 0x15: - this->health = 0; + super->health = 0; break; case 0x14: - COLLISION_OFF(this); - this->iframes = 0; - this->spriteSettings.draw = FALSE; - entity = CreateFx(this, FX_DEATH, 0); + COLLISION_OFF(super); + super->iframes = 0; + super->spriteSettings.draw = FALSE; + entity = CreateFx(super, FX_DEATH, 0); if (entity != NULL) { - this->child = entity; - this->timer = 14; - CopyPosition(this, entity); + super->child = entity; + super->timer = 14; + CopyPosition(super, entity); } DeleteThisEntity(); break; } } -void Wisp_OnGrabbed(Entity* this) { - static void (*const subActionFuncs[])(Entity*) = { +void Wisp_OnGrabbed(WispEntity* this) { + static void (*const subActionFuncs[])(WispEntity*) = { sub_08033650, sub_08033658, sub_08033660, }; - if (sub_0806F520(this)) { - subActionFuncs[this->subAction](this); + if (sub_0806F520(super)) { + subActionFuncs[super->subAction](this); } } -void sub_08033650(Entity* this) { - this->subAction = 2; +void sub_08033650(WispEntity* this) { + super->subAction = 2; } -void sub_08033658(Entity* this) { - sub_0806F4E8(this); +void sub_08033658(WispEntity* this) { + sub_0806F4E8(super); } -void sub_08033660(Entity* this) { - if (sub_0806F3E4(this)) { - GenericDeath(this); +void sub_08033660(WispEntity* this) { + if (sub_0806F3E4(super)) { + GenericDeath(super); } } -void sub_08033674(Entity* this) { - sub_0804A720(this); - this->timer = 0; - this->action = 1; - this->gustJarFlags = 1; - this->field_0x80.HWORD = this->x.HALF.HI; - this->field_0x82.HWORD = this->y.HALF.HI; +void sub_08033674(WispEntity* this) { + sub_0804A720(super); + super->timer = 0; + super->action = 1; + super->gustJarFlags = 1; + this->unk_80 = super->x.HALF.HI; + this->unk_82 = super->y.HALF.HI; sub_08033744(this); - InitializeAnimation(this, this->type2); + InitializeAnimation(super, super->type2); } -void sub_080336A8(Entity* this) { - if (--this->timer == 0) { +void sub_080336A8(WispEntity* this) { + if (--super->timer == 0) { sub_08033744(this); - } else if (this->collisions != COL_NONE) { - sub_0800417E(this, this->collisions); + } else if (super->collisions != COL_NONE) { + sub_0800417E(super, super->collisions); } - ProcessMovement0(this); - GetNextFrame(this); + ProcessMovement0(super); + GetNextFrame(super); } -void sub_080336DC(Entity* this) { - switch ((u16)-- this->field_0x7c.HALF.LO) { +void sub_080336DC(WispEntity* this) { + switch ((u16)-- this->unk_7c) { case 0x24: - this->x.HALF.HI = this->field_0x80.HWORD; - this->y.HALF.HI = this->field_0x82.HWORD; + super->x.HALF.HI = this->unk_80; + super->y.HALF.HI = this->unk_82; break; case 0x18: - CreateDust(this); + CreateDust(super); break; case 0xc: - this->spriteSettings.draw = TRUE; + super->spriteSettings.draw = TRUE; break; case 0x0: - this->action = 1; - COLLISION_ON(this); + super->action = 1; + COLLISION_ON(super); sub_08033744(this); break; } } -static void sub_08033744(Entity* this) { +static void sub_08033744(WispEntity* this) { u32 temp; u32 rand = (u32)Random() % 256; static const u8 gUnk_080CEBA4[] = { 30, 45, 60, 75, 1, 90, 105, 120 }; // 8 potential options - this->timer = gUnk_080CEBA4[(rand & 0x70) >> 4]; + super->timer = gUnk_080CEBA4[(rand & 0x70) >> 4]; // 4 potential options temp = ((rand & 0xc) * 2); // 75% chance to pass - if ((sub_08049FA0(this) == 0) && ((rand % 4) != 0)) { - temp = sub_08049EE4(this); + if ((sub_08049FA0(super) == 0) && ((rand % 4) != 0)) { + temp = sub_08049EE4(super); // 50% chance to pass if ((rand & 0x80) != 0) { @@ -171,5 +185,5 @@ static void sub_08033744(Entity* this) { temp &= 0x18; } } - this->direction = temp; + super->direction = temp; } diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index 55088984..1e24a4e2 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -15,7 +15,7 @@ extern u16 gUnk_0800275C[]; extern u8 gUnk_0811BE38[]; void ItemPegasusBoots(ItemBehavior* this, u32 index) { - static void (*const ItemPegasusBoots_StateFunctions[])(ItemBehavior * beh, u32) = { + static void (*const ItemPegasusBoots_StateFunctions[])(ItemBehavior* beh, u32) = { sub_080768F8, sub_08076964, sub_08076A88, diff --git a/src/manager/holeManager.c b/src/manager/holeManager.c index c220332b..341e9485 100644 --- a/src/manager/holeManager.c +++ b/src/manager/holeManager.c @@ -37,14 +37,14 @@ typedef struct struct_08108764 { u16 unk_06; u16 unk_08; u16 unk_0a; - } * unk_0c; + }* unk_0c; struct { u8 unk_00; u8 unk_01; u8 unk_02[2]; u16 unk_04; u16 unk_06; - } * unk_10; + }* unk_10; } struct_08108764; extern struct_08108764 gUnk_08108764[]; diff --git a/src/manager/templeOfDropletsManager.c b/src/manager/templeOfDropletsManager.c index 7472dcbd..62ea646a 100644 --- a/src/manager/templeOfDropletsManager.c +++ b/src/manager/templeOfDropletsManager.c @@ -488,7 +488,9 @@ void sub_0805A9CC(TempleOfDropletsManager* this) { gScreen.bg3.updated = 1; } -extern struct { u8 unk_00[0x20]; } gUnk_085A97A0[]; +extern struct { + u8 unk_00[0x20]; +} gUnk_085A97A0[]; void sub_0805AA58(TempleOfDropletsManager* this) { if (--super->timer == 0) { diff --git a/src/npc/malon.c b/src/npc/malon.c index 6e75d865..9766732a 100644 --- a/src/npc/malon.c +++ b/src/npc/malon.c @@ -21,11 +21,11 @@ void sub_080658BC(MalonEntity* this); void sub_08065900(MalonEntity* this); void Malon(MalonEntity* this) { - static void (*const actionFuncs[])(Entity * this) = { + static void (*const actionFuncs[])(Entity* this) = { sub_08065864, sub_08065880, }; - static void (*const scriptedActionFuncs[])(MalonEntity * this) = { + static void (*const scriptedActionFuncs[])(MalonEntity* this) = { sub_08065888, sub_080658BC, sub_08065900, diff --git a/src/npc/zelda.c b/src/npc/zelda.c index 9fa4612e..8d90f91a 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -20,7 +20,7 @@ void sub_08066CCC(Entity*); void sub_08066CF8(Entity*); void Zelda(Entity* this) { - static void (*const gUnk_08110BD8[])(Entity * ent) = { + static void (*const gUnk_08110BD8[])(Entity* ent) = { sub_08066CCC, sub_08066CF8, }; From 3b87c0416294e830ad256226f315c6b416160493 Mon Sep 17 00:00:00 2001 From: octorock <79596758+octorock@users.noreply.github.com> Date: Sat, 30 Dec 2023 18:26:19 +0100 Subject: [PATCH 12/15] Invert NENT_DEPRECATED define To define ENT_DEPRECATED in files that still need the old entity structs. --- include/entity.h | 2 +- include/object/deathFx.h | 2 +- include/object/linkAnimation.h | 2 +- src/beanstalkSubtask.c | 1 + src/code_08049CD4.c | 1 - src/code_08049DF4.c | 1 - src/collision.c | 1 + src/enemy/acroBandits.c | 1 - src/enemy/armos.c | 1 - src/enemy/ballChainSoldier.c | 1 - src/enemy/beetle.c | 1 - src/enemy/bladeTrap.c | 1 - src/enemy/bobomb.c | 1 - src/enemy/bombPeahat.c | 1 - src/enemy/bombarossa.c | 1 - src/enemy/bowMoblin.c | 1 - src/enemy/businessScrub.c | 1 - src/enemy/businessScrubPrologue.c | 1 - src/enemy/chaser.c | 1 - src/enemy/chuchu.c | 1 - src/enemy/chuchuBoss.c | 1 - src/enemy/cloudPiranha.c | 1 - src/enemy/crow.c | 1 - src/enemy/cuccoAggr.c | 1 - src/enemy/cuccoChickAggr.c | 1 - src/enemy/curtain.c | 1 - src/enemy/darkNut.c | 1 - src/enemy/doorMimic.c | 1 - src/enemy/dust.c | 1 - src/enemy/enemy4D.c | 1 - src/enemy/enemy50.c | 1 - src/enemy/enemy64.c | 1 - src/enemy/enemy66.c | 1 - src/enemy/enemyE.c | 1 - src/enemy/eyegore.c | 1 - src/enemy/fallingBoulder.c | 1 - src/enemy/fireballGuy.c | 1 - src/enemy/flyingPot.c | 1 - src/enemy/flyingSkull.c | 1 - src/enemy/ghini.c | 1 - src/enemy/gibdo.c | 1 - src/enemy/gleerok.c | 1 - src/enemy/gyorgChild.c | 1 - src/enemy/gyorgFemale.c | 1 - src/enemy/gyorgFemaleEye.c | 1 - src/enemy/gyorgFemaleMouth.c | 1 - src/enemy/gyorgMale.c | 1 - src/enemy/gyorgMaleEye.c | 1 - src/enemy/hangingSeed.c | 1 - src/enemy/helmasaur.c | 1 - src/enemy/keaton.c | 1 - src/enemy/keese.c | 1 - src/enemy/lakitu.c | 1 - src/enemy/lakituCloud.c | 1 - src/enemy/leever.c | 1 - src/enemy/likeLike.c | 1 - src/enemy/madderpillar.c | 1 - src/enemy/mazaalBracelet.c | 1 - src/enemy/mazaalHand.c | 1 - src/enemy/mazaalHead.c | 1 - src/enemy/mazaalMacro.c | 1 - src/enemy/miniFireballGuy.c | 1 - src/enemy/miniSlime.c | 1 - src/enemy/moldorm.c | 1 - src/enemy/moldworm.c | 1 - src/enemy/mulldozer.c | 1 - src/enemy/octorok.c | 1 - src/enemy/octorokBoss.c | 1 - src/enemy/octorokGolden.c | 1 - src/enemy/peahat.c | 1 - src/enemy/pesto.c | 1 - src/enemy/puffstool.c | 1 - src/enemy/rockChuchu.c | 1 - src/enemy/rollobite.c | 1 - src/enemy/rope.c | 1 - src/enemy/ropeGolden.c | 1 - src/enemy/rupeeLike.c | 1 - src/enemy/scissorsBeetle.c | 1 - src/enemy/sensorBladeTrap.c | 1 - src/enemy/slime.c | 1 - src/enemy/sluggula.c | 1 - src/enemy/smallPesto.c | 1 - src/enemy/spark.c | 1 - src/enemy/spearMoblin.c | 1 - src/enemy/spikedBeetle.c | 1 - src/enemy/spinyBeetle.c | 1 - src/enemy/spinyChuchu.c | 1 - src/enemy/stalfos.c | 1 - src/enemy/sub_080451CC.c | 1 + src/enemy/takkuri.c | 1 - src/enemy/tektite.c | 1 - src/enemy/tektiteGolden.c | 1 - src/enemy/torchTrap.c | 1 - src/enemy/treeItem.c | 1 - src/enemy/vaatiArm.c | 1 - src/enemy/vaatiBall.c | 1 - src/enemy/vaatiEyesMacro.c | 1 - src/enemy/vaatiProjectile.c | 1 - src/enemy/vaatiRebornEnemy.c | 1 - src/enemy/vaatiTransfigured.c | 1 - src/enemy/vaatiTransfiguredEye.c | 1 - src/enemy/vaatiWrath.c | 1 - src/enemy/vaatiWrathEye.c | 1 - src/enemy/wallMaster.c | 1 - src/enemy/wallMaster2.c | 1 - src/enemy/waterDrop.c | 1 - src/enemy/wisp.c | 1 - src/enemy/wizzrobeFire.c | 1 - src/enemy/wizzrobeIce.c | 1 - src/enemy/wizzrobeWind.c | 1 - src/enemyUtils.c | 1 - src/entity.c | 6 +++--- src/gameUtils.c | 1 + src/interrupts.c | 1 + src/item/itemGustJar.c | 4 ++-- src/item/itemLantern.c | 1 + src/item/itemOcarina.c | 3 ++- src/item/itemPegasusBoots.c | 9 +++++---- src/item/itemRocsCape.c | 1 + src/item/itemTryPickupObject.c | 5 +++-- src/manager/fallingItemManager.c | 1 + src/manager/fightManager.c | 1 + src/manager/goronMerchantShopManager.c | 1 + src/manager/houseSignManager.c | 1 + src/manager/moveableObjectManager.c | 1 + src/manager/pushableFurnitureManager.c | 1 + src/npc/anju.c | 1 - src/npc/beedle.c | 1 - src/npc/bigGoron.c | 1 - src/npc/bladeBrothers.c | 1 - src/npc/brocco.c | 1 - src/npc/carlov.c | 1 - src/npc/carpenter.c | 1 - src/npc/castleMaid.c | 1 - src/npc/castorWildsStatue.c | 1 - src/npc/cat.c | 1 - src/npc/clothesRack.c | 1 - src/npc/cow.c | 1 - src/npc/cucco.c | 1 - src/npc/cuccoChick.c | 1 - src/npc/dampe.c | 1 - src/npc/din.c | 1 - src/npc/dog.c | 1 - src/npc/drLeft.c | 1 - src/npc/emma.c | 1 - src/npc/epona.c | 1 - src/npc/ezlo.c | 1 - src/npc/farmers.c | 1 - src/npc/farore.c | 1 - src/npc/festari.c | 1 - src/npc/forestMinish.c | 1 - src/npc/fusionMenuNPC.c | 1 - src/npc/gentari.c | 1 - src/npc/ghostBrothers.c | 1 - src/npc/gina.c | 1 - src/npc/gorman.c | 1 - src/npc/goron.c | 1 - src/npc/goronMerchant.c | 1 - src/npc/gregal.c | 1 - src/npc/guard.c | 1 - src/npc/guardWithSpear.c | 1 - src/npc/hurdyGurdyMan.c | 1 - src/npc/kid.c | 1 - src/npc/kingDaltus.c | 1 - src/npc/kingGustaf.c | 1 - src/npc/librari.c | 1 - src/npc/librarians.c | 1 - src/npc/mailbox.c | 1 - src/npc/malon.c | 1 - src/npc/mama.c | 1 - src/npc/marcy.c | 1 - src/npc/mayorHagen.c | 1 - src/npc/melari.c | 1 - src/npc/milkCart.c | 1 - src/npc/minishEzlo.c | 1 - src/npc/ministerPotho.c | 1 - src/npc/moblinLady.c | 1 - src/npc/mountainMinish.c | 1 - src/npc/mutoh.c | 1 - src/npc/nayru.c | 1 - src/npc/npc23.c | 1 - src/npc/npc26.c | 1 - src/npc/npc4E.c | 1 - src/npc/npc4F.c | 1 - src/npc/npc5.c | 1 - src/npc/npc58.c | 1 - src/npc/npc9.c | 1 - src/npc/percy.c | 1 - src/npc/phonograph.c | 1 - src/npc/picolyteBottle.c | 1 - src/npc/pina.c | 1 - src/npc/pita.c | 1 - src/npc/postman.c | 1 - src/npc/rem.c | 1 - src/npc/simon.c | 1 - src/npc/sittingPerson.c | 1 - src/npc/smallTownMinish.c | 1 - src/npc/smith.c | 1 - src/npc/stamp.c | 1 - src/npc/stockwell.c | 1 - src/npc/sturgeon.c | 1 - src/npc/syrup.c | 1 - src/npc/talon.c | 1 - src/npc/teachers.c | 1 - src/npc/tingleSiblings.c | 1 - src/npc/townMinish.c | 1 - src/npc/townsperson.c | 1 - src/npc/vaati.c | 1 - src/npc/vaatiReborn.c | 1 - src/npc/wheaton.c | 1 - src/npc/windTribespeople.c | 1 - src/npc/zelda.c | 1 - src/npc/zeldaFollower.c | 1 - src/object/ambientClouds.c | 1 - src/object/angryStatue.c | 1 - src/object/archway.c | 1 - src/object/backgroundCloud.c | 1 - src/object/bakerOven.c | 1 - src/object/barrelInside.c | 1 - src/object/barrelSpiderweb.c | 1 - src/object/beanstalk.c | 1 - src/object/bedCover.c | 1 - src/object/bell.c | 1 - src/object/bench.c | 1 - src/object/bigBarrel.c | 1 - src/object/bigIceBlock.c | 1 - src/object/bigPushableLever.c | 1 - src/object/bigVortex.c | 1 - src/object/bird.c | 1 - src/object/blockPushed.c | 1 - src/object/board.c | 1 - src/object/bollard.c | 1 - src/object/book.c | 1 - src/object/bossDoor.c | 1 - src/object/bush.c | 1 - src/object/button.c | 1 - src/object/cabinFurniture.c | 1 - src/object/cameraTarget.c | 1 - src/object/carlovObject.c | 1 - src/object/chestSpawner.c | 1 - src/object/chuchuBossCutscene.c | 1 - src/object/chuchuBossParticle.c | 1 - src/object/chuchuBossStartParticle.c | 1 - src/object/cloud.c | 1 - src/object/crackingGround.c | 1 - src/object/crenelBeanSprout.c | 1 - src/object/cuccoMinigame.c | 1 - src/object/cutsceneMiscObject.c | 1 - src/object/cutsceneOrchestrator.c | 1 - src/object/deathFx.c | 1 - src/object/dirtParticle.c | 1 - src/object/doubleBookshelf.c | 1 - src/object/elementsBackground.c | 1 - src/object/enemyItem.c | 1 - src/object/evilSpirit.c | 1 - src/object/eyeSwitch.c | 1 - src/object/ezloCap.c | 1 - src/object/ezloCapFlying.c | 1 - src/object/fairy.c | 1 - src/object/fan.c | 1 - src/object/fanWind.c | 1 - src/object/figurineDevice.c | 1 - src/object/fileScreenObjects.c | 1 - src/object/fireballChain.c | 1 - src/object/fireplace.c | 1 - src/object/flame.c | 1 - src/object/floatingBlock.c | 1 - src/object/floatingPlatform.c | 1 - src/object/fourElements.c | 1 - src/object/frozenFlower.c | 1 - src/object/frozenOctorok.c | 1 - src/object/frozenWaterElement.c | 1 - src/object/furniture.c | 1 - src/object/gentariCurtain.c | 1 - src/object/giantBookLadder.c | 1 - src/object/giantLeaf.c | 1 - src/object/giantRock.c | 1 - src/object/giantRock2.c | 1 - src/object/giantTwig.c | 1 - src/object/gleerokParticle.c | 1 - src/object/graveyardKey.c | 1 - src/object/greatFairy.c | 1 - src/object/guruguruBar.c | 1 - src/object/gustJarParticle.c | 1 - src/object/gyorgBossObject.c | 1 - src/object/heartContainer.c | 1 - src/object/hiddenLadderDown.c | 1 - src/object/hitSwitch.c | 1 - src/object/hittableLever.c | 1 - src/object/houseDoorExterior.c | 1 - src/object/houseDoorInterior.c | 1 - src/object/houseSign.c | 1 - src/object/itemForSale.c | 1 - src/object/itemOnGround.c | 1 - src/object/jailBars.c | 1 - src/object/japaneseSubtitle.c | 1 - src/object/jarPortal.c | 1 - src/object/keyStealingTakkuri.c | 1 - src/object/kinstoneSpark.c | 1 - src/object/ladderHoleInBookshelf.c | 1 - src/object/ladderUp.c | 1 - src/object/lamp.c | 1 - src/object/lampParticle.c | 1 - src/object/lavaPlatform.c | 1 - src/object/lightDoor.c | 1 - src/object/lightRay.c | 1 - src/object/lightableSwitch.c | 1 - src/object/lilypadLarge.c | 1 - src/object/lilypadLargeFalling.c | 1 - src/object/lilypadSmall.c | 1 - src/object/linkAnimation.c | 1 - src/object/linkEmptyingBottle.c | 1 - src/object/linkFire.c | 1 - src/object/linkHoldingItem.c | 1 - src/object/litArea.c | 1 - src/object/lockedDoor.c | 1 - src/object/macroAcorn.c | 1 - src/object/macroBook.c | 1 - src/object/macroDecorations.c | 1 - src/object/macroMushroomStalk.c | 1 - src/object/macroPlayer.c | 1 - src/object/macroShoe.c | 1 - src/object/mask.c | 1 - src/object/mazaalBossObject.c | 1 - src/object/mazaalObject.c | 1 - src/object/metalDoor.c | 1 - src/object/minecart.c | 1 - src/object/minecartDoor.c | 1 - src/object/mineralWaterSource.c | 1 - src/object/minishEmoticon.c | 1 - src/object/minishLight.c | 1 - src/object/minishPortalCloseup.c | 1 - src/object/minishPortalStone.c | 1 - src/object/minishSizedArchway.c | 1 - src/object/minishSizedEntrance.c | 1 - src/object/minishVillageObject.c | 1 - src/object/moleMittsParticle.c | 1 - src/object/mulldozerSpawnPoint.c | 1 - src/object/object1D.c | 1 - src/object/object1F.c | 1 - src/object/object30.c | 1 - src/object/object37.c | 1 - src/object/object53.c | 1 - src/object/object63.c | 1 - src/object/object70.c | 1 - src/object/objectA.c | 1 - src/object/objectA2.c | 1 - src/object/objectA7.c | 1 - src/object/objectA8.c | 1 - src/object/objectBF.c | 1 - src/object/objectBlockingStairs.c | 1 - src/object/objectOnPillar.c | 1 - src/object/objectOnSpinyBeetle.c | 1 - src/object/octorokBossObject.c | 1 - src/object/palaceArchway.c | 1 - src/object/paper.c | 1 - src/object/parallaxRoomView.c | 1 - src/object/picoBloom.c | 1 - src/object/pinwheel.c | 1 - src/object/playerClone.c | 1 - src/object/pot.c | 1 - src/object/pressurePlate.c | 1 - src/object/pullableLever.c | 1 - src/object/pullableMushroom.c | 1 - src/object/pushableFurniture.c | 1 - src/object/pushableGrave.c | 1 - src/object/pushableLever.c | 1 - src/object/pushableRock.c | 1 - src/object/pushableStatue.c | 1 - src/object/railtrack.c | 1 - src/object/rotatingTrapdoor.c | 1 - src/object/rupee.c | 1 - src/object/sanctuaryStoneTablet.c | 1 - src/object/shrinkingHieroglyphs.c | 1 - src/object/smallIceBlock.c | 1 - src/object/smoke.c | 1 - src/object/smokeParticle.c | 1 - src/object/specialChest.c | 1 - src/object/specialFx.c | 1 - src/object/steam.c | 1 - src/object/stoneTablet.c | 1 - src/object/swordParticle.c | 1 - src/object/swordsmanNewsletter.c | 1 - src/object/thoughtBubble.c | 1 - src/object/thunderbolt.c | 1 - src/object/titleScreenObject.c | 1 - src/object/trapdoor.c | 1 - src/object/treeHidingPortal.c | 1 - src/object/treeThorns.c | 1 - src/object/unusedSkull.c | 1 - src/object/vaati1Portal.c | 1 - src/object/vaati2Particle.c | 1 - src/object/vaati3Arm.c | 1 - src/object/vaati3Death.c | 1 - src/object/vaati3PlayerObject.c | 1 - src/object/warpPoint.c | 1 - src/object/waterDropObject.c | 1 - src/object/waterElement.c | 1 - src/object/waterfallOpening.c | 1 - src/object/well.c | 1 - src/object/whirlwind.c | 1 - src/object/whiteTriangleEffect.c | 1 - src/object/windTribeFlag.c | 1 - src/object/windTribeTeleporter.c | 1 - src/object/windcrest.c | 1 - src/objectUtils.c | 1 - src/physics.c | 1 - src/player.c | 2 +- src/playerItem.c | 1 + src/playerItem/playerItemBomb.c | 1 - src/playerItem/playerItemBoomerang.c | 1 - src/playerItem/playerItemBottle.c | 1 - src/playerItem/playerItemBow.c | 1 - src/playerItem/playerItemCellOverwriteSet.c | 1 - src/playerItem/playerItemDashSword.c | 1 - src/playerItem/playerItemFireRodProjectile.c | 1 - src/playerItem/playerItemGust.c | 1 - src/playerItem/playerItemGustBig.c | 1 - src/playerItem/playerItemGustJar.c | 1 - src/playerItem/playerItemHeldObject.c | 1 - src/playerItem/playerItemLantern.c | 1 - src/playerItem/playerItemPacciCane.c | 1 - src/playerItem/playerItemPacciCaneProjectile.c | 1 - src/playerItem/playerItemShield.c | 1 - src/playerItem/playerItemSpiralBeam.c | 1 - src/playerItem/playerItemSword.c | 1 - src/playerItem/playerItemSwordBeam.c | 1 - src/playerUtils.c | 1 - src/projectile/arrowProjectile.c | 1 - src/projectile/ballAndChain.c | 1 - src/projectile/boneProjectile.c | 1 - src/projectile/cannonballProjectile.c | 1 - src/projectile/darkNutSwordSlash.c | 1 - src/projectile/dekuSeedProjectile.c | 1 - src/projectile/dirtBallProjectile.c | 1 - src/projectile/fireProjectile.c | 1 - src/projectile/gleerokProjectile.c | 1 - src/projectile/guardLineOfSight.c | 1 - src/projectile/guruguruBarProjectile.c | 1 - src/projectile/gyorgMaleEnergyProjectile.c | 1 - src/projectile/gyorgTail.c | 1 - src/projectile/iceProjectile.c | 1 - src/projectile/keatonDagger.c | 1 - src/projectile/lakituCloudProjectile.c | 1 - src/projectile/lakituLightning.c | 1 - src/projectile/mandiblesProjectile.c | 1 - src/projectile/mazaalEnergyBeam.c | 1 - src/projectile/moblinSpear.c | 1 - src/projectile/octorokBossProjectile.c | 1 - src/projectile/projectile5.c | 1 - src/projectile/removableDust.c | 1 - src/projectile/rockProjectile.c | 1 - src/projectile/spiderWeb.c | 1 - src/projectile/spikedRollers.c | 1 - src/projectile/stalfosProjectile.c | 1 - src/projectile/torchTrapProjectile.c | 1 - src/projectile/v1DarkMagicProjectile.c | 1 - src/projectile/v1EyeLaser.c | 1 - src/projectile/v1FireProjectile.c | 1 - src/projectile/v2Projectile.c | 1 - src/projectile/v3ElectricProjectile.c | 1 - src/projectile/v3HandProjectile.c | 1 - src/projectile/v3TennisBallProjectile.c | 1 - src/projectile/windProjectile.c | 1 - src/projectile/winder.c | 1 - src/room.c | 1 + src/script.c | 15 ++++++++------- src/scroll.c | 1 + src/vram.c | 1 + src/worldEvent/worldEvent15.c | 1 + 470 files changed, 45 insertions(+), 465 deletions(-) diff --git a/include/entity.h b/include/entity.h index 067e9ff4..42d77030 100644 --- a/include/entity.h +++ b/include/entity.h @@ -220,7 +220,7 @@ typedef struct Entity_ { /*0x62*/ u8 spriteOffsetX; /*0x63*/ s8 spriteOffsetY; /*0x64*/ void* myHeap; /**< Heap data allocated with #zMalloc. */ -#ifndef NENT_DEPRECATED +#ifdef ENT_DEPRECATED GENERIC_ENTITY_FIELDS #endif } Entity; diff --git a/include/object/deathFx.h b/include/object/deathFx.h index ba8c69dc..f8317f8c 100644 --- a/include/object/deathFx.h +++ b/include/object/deathFx.h @@ -1,7 +1,7 @@ #ifndef DEATHFX_H #define DEATHFX_H -#ifndef NENT_DEPRECATED +#ifdef ENT_DEPRECATED #error "deathFx.h requires new entities" #endif #include "entity.h" diff --git a/include/object/linkAnimation.h b/include/object/linkAnimation.h index 9fb2fad4..00e0ba94 100644 --- a/include/object/linkAnimation.h +++ b/include/object/linkAnimation.h @@ -1,7 +1,7 @@ #ifndef LINKANIMATION_H #define LINKANIMATION_H -#ifndef NENT_DEPRECATED +#ifdef ENT_DEPRECATED #error "linkAnimtion.h requires new entities" #endif #include "entity.h" diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index a115acc1..6568047b 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -1,3 +1,4 @@ +#define ENT_DEPRECATED #include "beanstalkSubtask.h" #include "backgroundAnimations.h" diff --git a/src/code_08049CD4.c b/src/code_08049CD4.c index c98323d1..3755f9d6 100644 --- a/src/code_08049CD4.c +++ b/src/code_08049CD4.c @@ -1,4 +1,3 @@ -#define NENT_DEPRECATED #include "global.h" #include "room.h" diff --git a/src/code_08049DF4.c b/src/code_08049DF4.c index a4af4474..723626eb 100644 --- a/src/code_08049DF4.c +++ b/src/code_08049DF4.c @@ -1,4 +1,3 @@ -#define NENT_DEPRECATED #include "asm.h" #include "global.h" #include "entity.h" diff --git a/src/collision.c b/src/collision.c index 7fb08ca4..c3630276 100644 --- a/src/collision.c +++ b/src/collision.c @@ -1,3 +1,4 @@ +#define ENT_DEPRECATED #include "asm.h" #include "collision.h" #include "common.h" diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index c87277ab..1e5d3057 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -4,7 +4,6 @@ * * @brief Acro Bandits enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/armos.c b/src/enemy/armos.c index 402fa65e..d03a3089 100644 --- a/src/enemy/armos.c +++ b/src/enemy/armos.c @@ -4,7 +4,6 @@ * * @brief Armos enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "common.h" #include "enemy.h" diff --git a/src/enemy/ballChainSoldier.c b/src/enemy/ballChainSoldier.c index 3efbe43e..b2a34518 100644 --- a/src/enemy/ballChainSoldier.c +++ b/src/enemy/ballChainSoldier.c @@ -4,7 +4,6 @@ * * @brief Ball Chain Soldier enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index 8541a580..b1dbd739 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -4,7 +4,6 @@ * * @brief Beetle enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/bladeTrap.c b/src/enemy/bladeTrap.c index 4d89bc1b..68d229ed 100644 --- a/src/enemy/bladeTrap.c +++ b/src/enemy/bladeTrap.c @@ -4,7 +4,6 @@ * * @brief Blade Trap enemy */ -#define NENT_DEPRECATED #include "entity.h" #include "object.h" #include "room.h" diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index e1c9b43b..b232c780 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -4,7 +4,6 @@ * * @brief Bobomb enemy */ -#define NENT_DEPRECATED #include "asm.h" #include "collision.h" #include "enemy.h" diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 3d8c3194..02871212 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -4,7 +4,6 @@ * * @brief Bomb Peahat enemy */ -#define NENT_DEPRECATED #include "asm.h" #include "enemy.h" #include "entity.h" diff --git a/src/enemy/bombarossa.c b/src/enemy/bombarossa.c index 1f9120fe..1190d281 100644 --- a/src/enemy/bombarossa.c +++ b/src/enemy/bombarossa.c @@ -4,7 +4,6 @@ * * @brief Bombarossa enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "object.h" diff --git a/src/enemy/bowMoblin.c b/src/enemy/bowMoblin.c index 1f6bdbb5..93358b37 100644 --- a/src/enemy/bowMoblin.c +++ b/src/enemy/bowMoblin.c @@ -4,7 +4,6 @@ * * @brief Bow Moblin enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index d7cea1d9..3a9ac5f5 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -4,7 +4,6 @@ * * @brief Business Scrub enemy */ -#define NENT_DEPRECATED #include "asm.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/businessScrubPrologue.c b/src/enemy/businessScrubPrologue.c index f09bcbdd..b7b7bc16 100644 --- a/src/enemy/businessScrubPrologue.c +++ b/src/enemy/businessScrubPrologue.c @@ -4,7 +4,6 @@ * * @brief Business Scrub Prologue enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/chaser.c b/src/enemy/chaser.c index 8dcd8f80..9255b1f1 100644 --- a/src/enemy/chaser.c +++ b/src/enemy/chaser.c @@ -4,7 +4,6 @@ * * @brief Chaser enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/chuchu.c b/src/enemy/chuchu.c index c5122f8a..c7ca7b94 100644 --- a/src/enemy/chuchu.c +++ b/src/enemy/chuchu.c @@ -4,7 +4,6 @@ * * @brief Chuchu enemy */ -#define NENT_DEPRECATED #include "asm.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 1cd12466..73850077 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -4,7 +4,6 @@ * * @brief Chuchu Boss enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "object.h" diff --git a/src/enemy/cloudPiranha.c b/src/enemy/cloudPiranha.c index 83061808..7f8f85c4 100644 --- a/src/enemy/cloudPiranha.c +++ b/src/enemy/cloudPiranha.c @@ -4,7 +4,6 @@ * * @brief Cloud Piranha enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/crow.c b/src/enemy/crow.c index ccbf5026..4f0c587b 100644 --- a/src/enemy/crow.c +++ b/src/enemy/crow.c @@ -4,7 +4,6 @@ * * @brief Crow enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/cuccoAggr.c b/src/enemy/cuccoAggr.c index 4eae33ed..9a07ea9e 100644 --- a/src/enemy/cuccoAggr.c +++ b/src/enemy/cuccoAggr.c @@ -4,7 +4,6 @@ * * @brief Cucco Aggr enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c index 133aca85..da26009c 100644 --- a/src/enemy/cuccoChickAggr.c +++ b/src/enemy/cuccoChickAggr.c @@ -4,7 +4,6 @@ * * @brief Cucco Chick Aggr enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/curtain.c b/src/enemy/curtain.c index 3450ea7c..e5256714 100644 --- a/src/enemy/curtain.c +++ b/src/enemy/curtain.c @@ -4,7 +4,6 @@ * * @brief Curtain enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c index 863d49d3..9192857d 100644 --- a/src/enemy/darkNut.c +++ b/src/enemy/darkNut.c @@ -4,7 +4,6 @@ * * @brief Dark Nut enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/doorMimic.c b/src/enemy/doorMimic.c index e9719c0f..5885ef40 100644 --- a/src/enemy/doorMimic.c +++ b/src/enemy/doorMimic.c @@ -4,7 +4,6 @@ * * @brief Door Mimic enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "sound.h" diff --git a/src/enemy/dust.c b/src/enemy/dust.c index df2073fe..68d3336d 100644 --- a/src/enemy/dust.c +++ b/src/enemy/dust.c @@ -4,7 +4,6 @@ * * @brief Dust enemy */ -#define NENT_DEPRECATED #include "asm.h" #include "enemy.h" #include "entity.h" diff --git a/src/enemy/enemy4D.c b/src/enemy/enemy4D.c index edda3b77..f333f9cb 100644 --- a/src/enemy/enemy4D.c +++ b/src/enemy/enemy4D.c @@ -4,7 +4,6 @@ * * @brief Enemy4D enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/enemy50.c b/src/enemy/enemy50.c index 6cddbdc8..0a33c592 100644 --- a/src/enemy/enemy50.c +++ b/src/enemy/enemy50.c @@ -4,7 +4,6 @@ * * @brief Enemy50 enemy */ -#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/enemy64.c b/src/enemy/enemy64.c index d6da9844..b226528f 100644 --- a/src/enemy/enemy64.c +++ b/src/enemy/enemy64.c @@ -4,7 +4,6 @@ * * @brief Enemy64 enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "fade.h" #include "functions.h" diff --git a/src/enemy/enemy66.c b/src/enemy/enemy66.c index ca5a6423..b2010d03 100644 --- a/src/enemy/enemy66.c +++ b/src/enemy/enemy66.c @@ -4,7 +4,6 @@ * * @brief Enemy66 enemy */ -#define NENT_DEPRECATED #include "entity.h" void (*const gUnk_080D2ABC[])(Entity*); diff --git a/src/enemy/enemyE.c b/src/enemy/enemyE.c index b470d584..56a9fe04 100644 --- a/src/enemy/enemyE.c +++ b/src/enemy/enemyE.c @@ -4,7 +4,6 @@ * * @brief EnemyE enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/eyegore.c b/src/enemy/eyegore.c index 04a1600f..9c8eb9e1 100644 --- a/src/enemy/eyegore.c +++ b/src/enemy/eyegore.c @@ -4,7 +4,6 @@ * * @brief Eyegore enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "fade.h" #include "functions.h" diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index d0b82155..81169608 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -4,7 +4,6 @@ * * @brief Falling Boulder enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/fireballGuy.c b/src/enemy/fireballGuy.c index 57dabe31..b35b8117 100644 --- a/src/enemy/fireballGuy.c +++ b/src/enemy/fireballGuy.c @@ -4,7 +4,6 @@ * * @brief Fireball Guy enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/flyingPot.c b/src/enemy/flyingPot.c index d69ca000..10e6136d 100644 --- a/src/enemy/flyingPot.c +++ b/src/enemy/flyingPot.c @@ -4,7 +4,6 @@ * * @brief Flying pot enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/flyingSkull.c b/src/enemy/flyingSkull.c index d7d87212..525d40d9 100644 --- a/src/enemy/flyingSkull.c +++ b/src/enemy/flyingSkull.c @@ -4,7 +4,6 @@ * * @brief Flying Skull enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/enemy/ghini.c b/src/enemy/ghini.c index f2749f15..683828de 100644 --- a/src/enemy/ghini.c +++ b/src/enemy/ghini.c @@ -4,7 +4,6 @@ * * @brief Ghini enemy */ -#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index a225996a..1471e807 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -4,7 +4,6 @@ * * @brief Gibdo enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "object.h" diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index ea108eb8..ef144203 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -4,7 +4,6 @@ * * @brief Gleerok enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/gyorgChild.c b/src/enemy/gyorgChild.c index c7306f5d..c72b4619 100644 --- a/src/enemy/gyorgChild.c +++ b/src/enemy/gyorgChild.c @@ -4,7 +4,6 @@ * * @brief Gyorg Child enemy */ -#define NENT_DEPRECATED #include "asm.h" #include "enemy/gyorg.h" #include "functions.h" diff --git a/src/enemy/gyorgFemale.c b/src/enemy/gyorgFemale.c index 394ef46b..4270139c 100644 --- a/src/enemy/gyorgFemale.c +++ b/src/enemy/gyorgFemale.c @@ -4,7 +4,6 @@ * * @brief Gyorg Female enemy */ -#define NENT_DEPRECATED #include "asm.h" #include "collision.h" #include "enemy.h" diff --git a/src/enemy/gyorgFemaleEye.c b/src/enemy/gyorgFemaleEye.c index 0be6a03e..234d88ed 100644 --- a/src/enemy/gyorgFemaleEye.c +++ b/src/enemy/gyorgFemaleEye.c @@ -4,7 +4,6 @@ * * @brief Gyorg Female Eye enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "enemy/gyorg.h" #include "entity.h" diff --git a/src/enemy/gyorgFemaleMouth.c b/src/enemy/gyorgFemaleMouth.c index d9c224f9..0500b001 100644 --- a/src/enemy/gyorgFemaleMouth.c +++ b/src/enemy/gyorgFemaleMouth.c @@ -4,7 +4,6 @@ * * @brief Gyorg Female Mouth enemy */ -#define NENT_DEPRECATED #include "enemy/gyorg.h" #include "player.h" #include "room.h" diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 8d2407f1..1521b85c 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -4,7 +4,6 @@ * * @brief Gyorg Male enemy */ -#define NENT_DEPRECATED #include "effects.h" #include "enemy.h" #include "enemy/gyorg.h" diff --git a/src/enemy/gyorgMaleEye.c b/src/enemy/gyorgMaleEye.c index 2bd7f05d..03202469 100644 --- a/src/enemy/gyorgMaleEye.c +++ b/src/enemy/gyorgMaleEye.c @@ -4,7 +4,6 @@ * * @brief GyorgMaleEye enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "fade.h" #include "functions.h" diff --git a/src/enemy/hangingSeed.c b/src/enemy/hangingSeed.c index 2328d5f9..1a383efb 100644 --- a/src/enemy/hangingSeed.c +++ b/src/enemy/hangingSeed.c @@ -4,7 +4,6 @@ * * @brief Hanging Seed enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 51e88ab7..6ac69120 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -4,7 +4,6 @@ * * @brief Helmasaur enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/keaton.c b/src/enemy/keaton.c index dc66bc63..c92b2ade 100644 --- a/src/enemy/keaton.c +++ b/src/enemy/keaton.c @@ -4,7 +4,6 @@ * * @brief keaton enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/keese.c b/src/enemy/keese.c index 467ea0ff..96f3bd08 100644 --- a/src/enemy/keese.c +++ b/src/enemy/keese.c @@ -4,7 +4,6 @@ * * @brief Keese enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" #include "player.h" diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index d5b5a8cc..5798f410 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -4,7 +4,6 @@ * * @brief Lakitu enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" #include "player.h" diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 75c9d18d..3d0c000d 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -4,7 +4,6 @@ * * @brief Lakitu Cloud enemy */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "enemy.h" diff --git a/src/enemy/leever.c b/src/enemy/leever.c index 66e263c8..647c9a86 100644 --- a/src/enemy/leever.c +++ b/src/enemy/leever.c @@ -4,7 +4,6 @@ * * @brief Leever enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index e4b0faab..52f37306 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -4,7 +4,6 @@ * * @brief Like Like enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "item.h" #include "message.h" diff --git a/src/enemy/madderpillar.c b/src/enemy/madderpillar.c index 85068daf..4dda2643 100644 --- a/src/enemy/madderpillar.c +++ b/src/enemy/madderpillar.c @@ -4,7 +4,6 @@ * * @brief Madderpillar enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "hitbox.h" diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index 208d7f9f..a896d130 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -4,7 +4,6 @@ * * @brief Mazaal Bracelet enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "hitbox.h" diff --git a/src/enemy/mazaalHand.c b/src/enemy/mazaalHand.c index 65b7d10a..ab6326fb 100644 --- a/src/enemy/mazaalHand.c +++ b/src/enemy/mazaalHand.c @@ -4,7 +4,6 @@ * * @brief Mazaal Hand enemy */ -#define NENT_DEPRECATED #include "entity.h" #include "hitbox.h" diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index 696431ca..03c5c4de 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -4,7 +4,6 @@ * * @brief Mazaal Head enemy */ -#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/mazaalMacro.c b/src/enemy/mazaalMacro.c index 7eb086e3..a404cbdc 100644 --- a/src/enemy/mazaalMacro.c +++ b/src/enemy/mazaalMacro.c @@ -4,7 +4,6 @@ * * @brief Mazaal Macro enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "screenTransitions.h" diff --git a/src/enemy/miniFireballGuy.c b/src/enemy/miniFireballGuy.c index 3899733e..97365958 100644 --- a/src/enemy/miniFireballGuy.c +++ b/src/enemy/miniFireballGuy.c @@ -4,7 +4,6 @@ * * @brief Mini Fireball Guy enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/miniSlime.c b/src/enemy/miniSlime.c index 2fb18dec..bef76f86 100644 --- a/src/enemy/miniSlime.c +++ b/src/enemy/miniSlime.c @@ -4,7 +4,6 @@ * * @brief Mini Slime enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" diff --git a/src/enemy/moldorm.c b/src/enemy/moldorm.c index da9d17a2..96d6a9cd 100644 --- a/src/enemy/moldorm.c +++ b/src/enemy/moldorm.c @@ -4,7 +4,6 @@ * * @brief Moldorm enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index c856da19..a6469c11 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -4,7 +4,6 @@ * * @brief Moldworm enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/mulldozer.c b/src/enemy/mulldozer.c index f1f3059a..fbc3f09c 100644 --- a/src/enemy/mulldozer.c +++ b/src/enemy/mulldozer.c @@ -4,7 +4,6 @@ * * @brief Mulldozer enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c index 68ff799c..d33a9a54 100644 --- a/src/enemy/octorok.c +++ b/src/enemy/octorok.c @@ -4,7 +4,6 @@ * * @brief Octorok enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c index 7a59d4a9..00f5d79f 100644 --- a/src/enemy/octorokBoss.c +++ b/src/enemy/octorokBoss.c @@ -4,7 +4,6 @@ * * @brief Octorok boss enemy */ -#define NENT_DEPRECATED #include "enemy/octorokBoss.h" #include "collision.h" #include "functions.h" diff --git a/src/enemy/octorokGolden.c b/src/enemy/octorokGolden.c index 7c0fd384..a3295b7c 100644 --- a/src/enemy/octorokGolden.c +++ b/src/enemy/octorokGolden.c @@ -4,7 +4,6 @@ * * @brief Golden Octorock enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "map.h" diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index 353ad0d5..fee43028 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -4,7 +4,6 @@ * * @brief Peahat enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" #include "room.h" diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index bc05635b..612df286 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -4,7 +4,6 @@ * * @brief Pesto enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "game.h" diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c index 1b1a93f6..dca8086a 100644 --- a/src/enemy/puffstool.c +++ b/src/enemy/puffstool.c @@ -4,7 +4,6 @@ * * @brief Puffstool enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "object.h" diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c index c1d77726..dc3af233 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -4,7 +4,6 @@ * * @brief Rock Chuchu enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "player.h" diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index e2a19240..db273ef7 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -4,7 +4,6 @@ * * @brief Rollobite enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "physics.h" diff --git a/src/enemy/rope.c b/src/enemy/rope.c index 851d3c9a..e8bcbc41 100644 --- a/src/enemy/rope.c +++ b/src/enemy/rope.c @@ -4,7 +4,6 @@ * * @brief Rope enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c index 39acbc52..77a76670 100644 --- a/src/enemy/ropeGolden.c +++ b/src/enemy/ropeGolden.c @@ -4,7 +4,6 @@ * * @brief Golden Rope enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "physics.h" diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 1834d7d3..bea1fe2e 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -4,7 +4,6 @@ * * @brief Rupee Like enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "hitbox.h" diff --git a/src/enemy/scissorsBeetle.c b/src/enemy/scissorsBeetle.c index 35cc21b1..7b76a9fd 100644 --- a/src/enemy/scissorsBeetle.c +++ b/src/enemy/scissorsBeetle.c @@ -4,7 +4,6 @@ * * @brief Scissors Beetle enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/enemy/sensorBladeTrap.c b/src/enemy/sensorBladeTrap.c index db136a3c..31d2bc10 100644 --- a/src/enemy/sensorBladeTrap.c +++ b/src/enemy/sensorBladeTrap.c @@ -4,7 +4,6 @@ * * @brief Sensor Blade Trap enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "map.h" diff --git a/src/enemy/slime.c b/src/enemy/slime.c index 937091d6..81565493 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -4,7 +4,6 @@ * * @brief Slime enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" #include "room.h" diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c index c2cf7d5f..2397c3aa 100644 --- a/src/enemy/sluggula.c +++ b/src/enemy/sluggula.c @@ -4,7 +4,6 @@ * * @brief Sluggula enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" diff --git a/src/enemy/smallPesto.c b/src/enemy/smallPesto.c index 05fa2bdf..0c287bbc 100644 --- a/src/enemy/smallPesto.c +++ b/src/enemy/smallPesto.c @@ -4,7 +4,6 @@ * * @brief Small Pesto enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "physics.h" diff --git a/src/enemy/spark.c b/src/enemy/spark.c index cc6d1f15..e135424b 100644 --- a/src/enemy/spark.c +++ b/src/enemy/spark.c @@ -4,7 +4,6 @@ * * @brief Spark enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "object.h" diff --git a/src/enemy/spearMoblin.c b/src/enemy/spearMoblin.c index 675de896..089f0ba8 100644 --- a/src/enemy/spearMoblin.c +++ b/src/enemy/spearMoblin.c @@ -4,7 +4,6 @@ * * @brief Spear Moblin enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/spikedBeetle.c b/src/enemy/spikedBeetle.c index d009eab2..92406dda 100644 --- a/src/enemy/spikedBeetle.c +++ b/src/enemy/spikedBeetle.c @@ -4,7 +4,6 @@ * * @brief Spiked Beetle enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/spinyBeetle.c b/src/enemy/spinyBeetle.c index 0e082d7b..8f5dd46f 100644 --- a/src/enemy/spinyBeetle.c +++ b/src/enemy/spinyBeetle.c @@ -4,7 +4,6 @@ * * @brief Spiny Beetle enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c index 0bd03e83..03b7f09c 100644 --- a/src/enemy/spinyChuchu.c +++ b/src/enemy/spinyChuchu.c @@ -4,7 +4,6 @@ * * @brief Spiny Chuchu enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "hitbox.h" diff --git a/src/enemy/stalfos.c b/src/enemy/stalfos.c index 98b2214e..1cbdc67a 100644 --- a/src/enemy/stalfos.c +++ b/src/enemy/stalfos.c @@ -4,7 +4,6 @@ * * @brief Stalfos enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/sub_080451CC.c b/src/enemy/sub_080451CC.c index c7a82990..05425c9c 100644 --- a/src/enemy/sub_080451CC.c +++ b/src/enemy/sub_080451CC.c @@ -1,3 +1,4 @@ +#define ENT_DEPRECATED #include "entity.h" void sub_080451CC(Entity* this, Entity* other) { diff --git a/src/enemy/takkuri.c b/src/enemy/takkuri.c index b24e2e3e..20dd168a 100644 --- a/src/enemy/takkuri.c +++ b/src/enemy/takkuri.c @@ -4,7 +4,6 @@ * * @brief Takkuri enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/tektite.c b/src/enemy/tektite.c index ea1169fe..81573437 100644 --- a/src/enemy/tektite.c +++ b/src/enemy/tektite.c @@ -4,7 +4,6 @@ * * @brief Tektite enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/tektiteGolden.c b/src/enemy/tektiteGolden.c index 49ad340c..d92dfdee 100644 --- a/src/enemy/tektiteGolden.c +++ b/src/enemy/tektiteGolden.c @@ -4,7 +4,6 @@ * * @brief Golden Tektite enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/torchTrap.c b/src/enemy/torchTrap.c index 71b2a2c7..de2e12eb 100644 --- a/src/enemy/torchTrap.c +++ b/src/enemy/torchTrap.c @@ -4,7 +4,6 @@ * * @brief Torch Trap enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "physics.h" diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c index c0a09411..b953432d 100644 --- a/src/enemy/treeItem.c +++ b/src/enemy/treeItem.c @@ -4,7 +4,6 @@ * * @brief Tree Item enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "item.h" #include "object.h" diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index f0b48b2c..2558f5f0 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -4,7 +4,6 @@ * * @brief Vaati Arm enemy */ -#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/vaatiBall.c b/src/enemy/vaatiBall.c index 0378c546..7e0d04a6 100644 --- a/src/enemy/vaatiBall.c +++ b/src/enemy/vaatiBall.c @@ -4,7 +4,6 @@ * * @brief Vaati Ball enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c index 26f3e6b5..3c0d04e5 100644 --- a/src/enemy/vaatiEyesMacro.c +++ b/src/enemy/vaatiEyesMacro.c @@ -4,7 +4,6 @@ * * @brief Vaati Eyes Macro enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index e80675e4..666d5fa5 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -4,7 +4,6 @@ * * @brief Vaati Projectile enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "screenTransitions.h" diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c index 135b4f4c..64ec55b0 100644 --- a/src/enemy/vaatiRebornEnemy.c +++ b/src/enemy/vaatiRebornEnemy.c @@ -4,7 +4,6 @@ * * @brief Vaati Reborn enemy */ -#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index 60912eae..e84b14f8 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -4,7 +4,6 @@ * * @brief Vaati Transfigured enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "functions.h" #include "object.h" diff --git a/src/enemy/vaatiTransfiguredEye.c b/src/enemy/vaatiTransfiguredEye.c index 2ee0d76a..e417c2fd 100644 --- a/src/enemy/vaatiTransfiguredEye.c +++ b/src/enemy/vaatiTransfiguredEye.c @@ -4,7 +4,6 @@ * * @brief Vaati Transfigured Eye enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index 2aa2b549..8ad668b8 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -4,7 +4,6 @@ * * @brief Vaati Wrath enemy */ -#define NENT_DEPRECATED #include "enemy/vaatiWrath.h" #include "functions.h" #include "message.h" diff --git a/src/enemy/vaatiWrathEye.c b/src/enemy/vaatiWrathEye.c index 42da5f1e..f7782fd2 100644 --- a/src/enemy/vaatiWrathEye.c +++ b/src/enemy/vaatiWrathEye.c @@ -4,7 +4,6 @@ * * @brief Vaati Wrath Eye enemy */ -#define NENT_DEPRECATED #include "enemy/vaatiWrath.h" #include "functions.h" diff --git a/src/enemy/wallMaster.c b/src/enemy/wallMaster.c index 07f63fec..1c72f15d 100644 --- a/src/enemy/wallMaster.c +++ b/src/enemy/wallMaster.c @@ -4,7 +4,6 @@ * * @brief Wall Master enemy */ -#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c index f7ebe0ff..34d7cb6a 100644 --- a/src/enemy/wallMaster2.c +++ b/src/enemy/wallMaster2.c @@ -4,7 +4,6 @@ * * @brief Wall Master 2 enemy */ -#define NENT_DEPRECATED #include "area.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index 7dc2b686..6214d93e 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -4,7 +4,6 @@ * * @brief Water Drop enemy */ -#define NENT_DEPRECATED #include "enemy.h" #include "object.h" #include "screen.h" diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c index df73cb4a..1ed368b6 100644 --- a/src/enemy/wisp.c +++ b/src/enemy/wisp.c @@ -4,7 +4,6 @@ * * @brief Wisp enemy */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/wizzrobeFire.c b/src/enemy/wizzrobeFire.c index dc1aa173..f81af162 100644 --- a/src/enemy/wizzrobeFire.c +++ b/src/enemy/wizzrobeFire.c @@ -4,7 +4,6 @@ * * @brief Wizzrobe Fire enemy */ -#define NENT_DEPRECATED #include "enemy/wizzrobe.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/wizzrobeIce.c b/src/enemy/wizzrobeIce.c index 9607a275..0d07a305 100644 --- a/src/enemy/wizzrobeIce.c +++ b/src/enemy/wizzrobeIce.c @@ -4,7 +4,6 @@ * * @brief Wizzrobe Ice enemy */ -#define NENT_DEPRECATED #include "enemy/wizzrobe.h" #include "enemy.h" #include "functions.h" diff --git a/src/enemy/wizzrobeWind.c b/src/enemy/wizzrobeWind.c index 33a9e25f..57381154 100644 --- a/src/enemy/wizzrobeWind.c +++ b/src/enemy/wizzrobeWind.c @@ -4,7 +4,6 @@ * * @brief Wizzrobe Wind enemy */ -#define NENT_DEPRECATED #include "enemy/wizzrobe.h" #include "collision.h" #include "enemy.h" diff --git a/src/enemyUtils.c b/src/enemyUtils.c index e030edb1..fa6b4bc0 100644 --- a/src/enemyUtils.c +++ b/src/enemyUtils.c @@ -1,4 +1,3 @@ -#define NENT_DEPRECATED #include "enemyUtils.h" #include "definitions.h" diff --git a/src/entity.c b/src/entity.c index b13d5261..fd4cb707 100644 --- a/src/entity.c +++ b/src/entity.c @@ -1,10 +1,10 @@ -#include "global.h" +#define ENT_DEPRECATED +#include "area.h" #include "common.h" #include "functions.h" -#include "area.h" +#include "manager/diggingCaveEntranceManager.h" #include "message.h" #include "npc.h" -#include "manager/diggingCaveEntranceManager.h" typedef struct Temp { void* prev; diff --git a/src/gameUtils.c b/src/gameUtils.c index d4543147..ef1db81a 100644 --- a/src/gameUtils.c +++ b/src/gameUtils.c @@ -3,6 +3,7 @@ * * @brief Game Utils */ +#define ENT_DEPRECATED #include "backgroundAnimations.h" #include "enemy.h" #include "entity.h" diff --git a/src/interrupts.c b/src/interrupts.c index 44b59a73..3ef7235d 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -1,3 +1,4 @@ +#define ENT_DEPRECATED #include "functions.h" #include "gba/m4a.h" #include "global.h" diff --git a/src/item/itemGustJar.c b/src/item/itemGustJar.c index 3ac37366..8a040ec9 100644 --- a/src/item/itemGustJar.c +++ b/src/item/itemGustJar.c @@ -1,7 +1,7 @@ -#include "global.h" +#define ENT_DEPRECATED #include "entity.h" -#include "item.h" #include "functions.h" +#include "item.h" #include "playeritem.h" void (*const ItemGustJar_StateFunctions[])(ItemBehavior* this, u32); diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c index 070d9a89..e5b7c91e 100644 --- a/src/item/itemLantern.c +++ b/src/item/itemLantern.c @@ -1,3 +1,4 @@ +#define ENT_DEPRECATED #include "item.h" #include "functions.h" #include "sound.h" diff --git a/src/item/itemOcarina.c b/src/item/itemOcarina.c index e4b2ad0e..196ea132 100644 --- a/src/item/itemOcarina.c +++ b/src/item/itemOcarina.c @@ -1,6 +1,7 @@ +#define ENT_DEPRECATED +#include "functions.h" #include "item.h" #include "sound.h" -#include "functions.h" extern void ResetPlayerVelocity(void); extern void CreateBird(Entity*); diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index 1e24a4e2..21fa559a 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -1,11 +1,12 @@ +#define ENT_DEPRECATED #include "asm.h" -#include "item.h" -#include "sound.h" -#include "functions.h" #include "effects.h" +#include "functions.h" #include "game.h" -#include "save.h" +#include "item.h" #include "playeritem.h" +#include "save.h" +#include "sound.h" void sub_08076964(ItemBehavior*, u32); void sub_080768F8(ItemBehavior*, u32); diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c index cfb165a3..6ece003d 100644 --- a/src/item/itemRocsCape.c +++ b/src/item/itemRocsCape.c @@ -1,3 +1,4 @@ +#define ENT_DEPRECATED #include "item.h" #include "sound.h" #include "functions.h" diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index 1eb76da5..774ab613 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -1,7 +1,8 @@ -#include "item.h" +#define ENT_DEPRECATED #include "functions.h" -#include "sound.h" +#include "item.h" #include "playeritem.h" +#include "sound.h" u32 sub_08077F64(ItemBehavior* arg0, u32 index); u32 sub_080789A8(void); diff --git a/src/manager/fallingItemManager.c b/src/manager/fallingItemManager.c index 966a5702..49ba18e0 100644 --- a/src/manager/fallingItemManager.c +++ b/src/manager/fallingItemManager.c @@ -6,6 +6,7 @@ * * If you leave the room without picking the item up and enter again, the item falls from the sky again. */ +#define ENT_DEPRECATED #include "manager/fallingItemManager.h" #include "flags.h" #include "object.h" diff --git a/src/manager/fightManager.c b/src/manager/fightManager.c index 3f34f5c4..dfef3d50 100644 --- a/src/manager/fightManager.c +++ b/src/manager/fightManager.c @@ -9,6 +9,7 @@ * (There is also a part about changing the music and setting it back when the fight is done, which is song 0x33 (a * fight theme) by default but can be overridden through room data) */ +#define ENT_DEPRECATED #include "manager/fightManager.h" #include "area.h" #include "common.h" diff --git a/src/manager/goronMerchantShopManager.c b/src/manager/goronMerchantShopManager.c index feb2f7c0..b68ceb88 100644 --- a/src/manager/goronMerchantShopManager.c +++ b/src/manager/goronMerchantShopManager.c @@ -4,6 +4,7 @@ * * @brief Spawns the shop items for the kinstones for the goron merchant. */ +#define ENT_DEPRECATED #include "manager/goronMerchantShopManager.h" #include "asm.h" #include "flags.h" diff --git a/src/manager/houseSignManager.c b/src/manager/houseSignManager.c index 8722de83..48784225 100644 --- a/src/manager/houseSignManager.c +++ b/src/manager/houseSignManager.c @@ -7,6 +7,7 @@ * Spawns HOUSE_SIGN objects that check this and unsets the value in the bitfield. * Creates the signs on the houses in hyrule town. */ +#define ENT_DEPRECATED #include "manager/houseSignManager.h" #include "area.h" #include "object.h" diff --git a/src/manager/moveableObjectManager.c b/src/manager/moveableObjectManager.c index 6c697777..bc9a05c2 100644 --- a/src/manager/moveableObjectManager.c +++ b/src/manager/moveableObjectManager.c @@ -6,6 +6,7 @@ * * E.g. for pushable rock. */ +#define ENT_DEPRECATED #include "manager/moveableObjectManager.h" #include "flags.h" #include "room.h" diff --git a/src/manager/pushableFurnitureManager.c b/src/manager/pushableFurnitureManager.c index d8cb00d9..687203a0 100644 --- a/src/manager/pushableFurnitureManager.c +++ b/src/manager/pushableFurnitureManager.c @@ -4,6 +4,7 @@ * * @brief Creates pushable furniture based on a room property list. */ +#define ENT_DEPRECATED #include "manager/pushableFurnitureManager.h" #include "flags.h" #include "object.h" diff --git a/src/npc/anju.c b/src/npc/anju.c index 0c0df5a9..199629d4 100644 --- a/src/npc/anju.c +++ b/src/npc/anju.c @@ -4,7 +4,6 @@ * * @brief Anju NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "player.h" diff --git a/src/npc/beedle.c b/src/npc/beedle.c index 07a3d0fc..a77d7390 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -4,7 +4,6 @@ * * @brief Beedle NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "game.h" diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index ce6d1bab..aded3196 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -4,7 +4,6 @@ * * @brief BigGoron NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "item.h" diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index 598b0523..002c5d0a 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -4,7 +4,6 @@ * * @brief Blade Brothers NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/npc/brocco.c b/src/npc/brocco.c index ea14ac04..d4bfa44d 100644 --- a/src/npc/brocco.c +++ b/src/npc/brocco.c @@ -4,7 +4,6 @@ * * @brief Brocco NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "message.h" #include "npc.h" diff --git a/src/npc/carlov.c b/src/npc/carlov.c index 0cc92008..07a9abb5 100644 --- a/src/npc/carlov.c +++ b/src/npc/carlov.c @@ -4,7 +4,6 @@ * * @brief Carlov NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "room.h" diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index 3c4dda2a..28123e37 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -4,7 +4,6 @@ * * @brief Carpenter NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "item.h" #include "npc.h" diff --git a/src/npc/castleMaid.c b/src/npc/castleMaid.c index f5e888e3..448f0a30 100644 --- a/src/npc/castleMaid.c +++ b/src/npc/castleMaid.c @@ -4,7 +4,6 @@ * * @brief Castle Maid NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/npc/castorWildsStatue.c b/src/npc/castorWildsStatue.c index b4b61ccd..86365860 100644 --- a/src/npc/castorWildsStatue.c +++ b/src/npc/castorWildsStatue.c @@ -4,7 +4,6 @@ * * @brief Castor Wilds Statue NPC */ -#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "flags.h" diff --git a/src/npc/cat.c b/src/npc/cat.c index eb364e8f..9096a5a4 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -4,7 +4,6 @@ * * @brief Cat NPC */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/npc/clothesRack.c b/src/npc/clothesRack.c index 1d63c376..28de3bed 100644 --- a/src/npc/clothesRack.c +++ b/src/npc/clothesRack.c @@ -5,7 +5,6 @@ * @brief Clothes Rack NPC */ #include "npc.h" -#define NENT_DEPRECATED void sub_0806DD90(Entity*); void sub_0806DEC8(Entity*); diff --git a/src/npc/cow.c b/src/npc/cow.c index 8d4f1d4b..944d26b3 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -4,7 +4,6 @@ * * @brief Cow NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" diff --git a/src/npc/cucco.c b/src/npc/cucco.c index 33a7d46a..54042add 100644 --- a/src/npc/cucco.c +++ b/src/npc/cucco.c @@ -4,7 +4,6 @@ * * @brief Cucco NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "kinstone.h" #include "npc.h" diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c index 07b03baf..adf6eaf4 100644 --- a/src/npc/cuccoChick.c +++ b/src/npc/cuccoChick.c @@ -4,7 +4,6 @@ * * @brief Cucco Chick NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "npc.h" diff --git a/src/npc/dampe.c b/src/npc/dampe.c index 88cc9e0a..8652612e 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -4,7 +4,6 @@ * * @brief Dampe NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "item.h" diff --git a/src/npc/din.c b/src/npc/din.c index cfbef459..b125cc95 100644 --- a/src/npc/din.c +++ b/src/npc/din.c @@ -4,7 +4,6 @@ * * @brief Din NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "kinstone.h" #include "npc.h" diff --git a/src/npc/dog.c b/src/npc/dog.c index 82708d84..f5512406 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -4,7 +4,6 @@ * * @brief Dog NPC */ -#define NENT_DEPRECATED #include "collision.h" #include "entity.h" #include "functions.h" diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c index 32b2f062..c89760c5 100644 --- a/src/npc/drLeft.c +++ b/src/npc/drLeft.c @@ -4,7 +4,6 @@ * * @brief Dr Left NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "npc.h" diff --git a/src/npc/emma.c b/src/npc/emma.c index 9cd04780..7ff05e23 100644 --- a/src/npc/emma.c +++ b/src/npc/emma.c @@ -4,7 +4,6 @@ * * @brief Emma NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "screenTransitions.h" diff --git a/src/npc/epona.c b/src/npc/epona.c index a852af99..1421262b 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -4,7 +4,6 @@ * * @brief Epona NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "message.h" diff --git a/src/npc/ezlo.c b/src/npc/ezlo.c index c490a29e..15d4a715 100644 --- a/src/npc/ezlo.c +++ b/src/npc/ezlo.c @@ -4,7 +4,6 @@ * * @brief Ezlo NPC */ -#define NENT_DEPRECATED #include "npc.h" const u8 gUnk_08114134[]; diff --git a/src/npc/farmers.c b/src/npc/farmers.c index a1f69c55..f98b8ef2 100644 --- a/src/npc/farmers.c +++ b/src/npc/farmers.c @@ -4,7 +4,6 @@ * * @brief Farmers NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" diff --git a/src/npc/farore.c b/src/npc/farore.c index 9624b3bc..5a553f07 100644 --- a/src/npc/farore.c +++ b/src/npc/farore.c @@ -4,7 +4,6 @@ * * @brief Farore NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "kinstone.h" diff --git a/src/npc/festari.c b/src/npc/festari.c index d32badf2..fb4d15f9 100644 --- a/src/npc/festari.c +++ b/src/npc/festari.c @@ -4,7 +4,6 @@ * * @brief Festari NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index 8d5cf8dc..7c602e2a 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -4,7 +4,6 @@ * * @brief Forest Minish NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "kinstone.h" diff --git a/src/npc/fusionMenuNPC.c b/src/npc/fusionMenuNPC.c index 01d970e3..63fd2143 100644 --- a/src/npc/fusionMenuNPC.c +++ b/src/npc/fusionMenuNPC.c @@ -6,7 +6,6 @@ * * Representation for the NPCs in the fusion menu. */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/gentari.c b/src/npc/gentari.c index a2e02a34..c7ed252b 100644 --- a/src/npc/gentari.c +++ b/src/npc/gentari.c @@ -4,7 +4,6 @@ * * @brief Gentari NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c index 6628b572..7bf07ad6 100644 --- a/src/npc/ghostBrothers.c +++ b/src/npc/ghostBrothers.c @@ -4,7 +4,6 @@ * * @brief Ghost Brothers NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "message.h" diff --git a/src/npc/gina.c b/src/npc/gina.c index 8933653f..46b13bcd 100644 --- a/src/npc/gina.c +++ b/src/npc/gina.c @@ -4,7 +4,6 @@ * * @brief Gina NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "player.h" diff --git a/src/npc/gorman.c b/src/npc/gorman.c index 1b78bc0b..d4a8683a 100644 --- a/src/npc/gorman.c +++ b/src/npc/gorman.c @@ -4,7 +4,6 @@ * * @brief Gorman NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "npc.h" diff --git a/src/npc/goron.c b/src/npc/goron.c index 422fe6cc..a67b0e5f 100644 --- a/src/npc/goron.c +++ b/src/npc/goron.c @@ -4,7 +4,6 @@ * * @brief Goron NPC */ -#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "functions.h" diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c index 2f497dff..c9bd4d73 100644 --- a/src/npc/goronMerchant.c +++ b/src/npc/goronMerchant.c @@ -4,7 +4,6 @@ * * @brief Goron Merchant NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/npc/gregal.c b/src/npc/gregal.c index 781cfec0..4a2e3fb5 100644 --- a/src/npc/gregal.c +++ b/src/npc/gregal.c @@ -4,7 +4,6 @@ * * @brief Gregal NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" diff --git a/src/npc/guard.c b/src/npc/guard.c index 617d5d13..7a18d62d 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -4,7 +4,6 @@ * * @brief Guard NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/npc/guardWithSpear.c b/src/npc/guardWithSpear.c index 52f03587..8d9bf404 100644 --- a/src/npc/guardWithSpear.c +++ b/src/npc/guardWithSpear.c @@ -4,7 +4,6 @@ * * @brief Guard with Spear NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" diff --git a/src/npc/hurdyGurdyMan.c b/src/npc/hurdyGurdyMan.c index dfb0c4fc..90580f2d 100644 --- a/src/npc/hurdyGurdyMan.c +++ b/src/npc/hurdyGurdyMan.c @@ -4,7 +4,6 @@ * * @brief Hurdy Gurdy Man NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" diff --git a/src/npc/kid.c b/src/npc/kid.c index 70e94ee3..281bbc93 100644 --- a/src/npc/kid.c +++ b/src/npc/kid.c @@ -4,7 +4,6 @@ * * @brief Kid NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "message.h" #include "npc.h" diff --git a/src/npc/kingDaltus.c b/src/npc/kingDaltus.c index d6496e15..cc901f18 100644 --- a/src/npc/kingDaltus.c +++ b/src/npc/kingDaltus.c @@ -4,7 +4,6 @@ * * @brief King Daltus NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" diff --git a/src/npc/kingGustaf.c b/src/npc/kingGustaf.c index f71678dc..48db93af 100644 --- a/src/npc/kingGustaf.c +++ b/src/npc/kingGustaf.c @@ -4,7 +4,6 @@ * * @brief King Gustaf NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "screen.h" diff --git a/src/npc/librari.c b/src/npc/librari.c index f0778371..7e2a69ba 100644 --- a/src/npc/librari.c +++ b/src/npc/librari.c @@ -4,7 +4,6 @@ * * @brief Librari NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "item.h" #include "npc.h" diff --git a/src/npc/librarians.c b/src/npc/librarians.c index 86558d16..e19c3cc4 100644 --- a/src/npc/librarians.c +++ b/src/npc/librarians.c @@ -4,7 +4,6 @@ * * @brief Librarians NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/npc/mailbox.c b/src/npc/mailbox.c index cde3c646..5eb4ea9d 100644 --- a/src/npc/mailbox.c +++ b/src/npc/mailbox.c @@ -4,7 +4,6 @@ * * @brief Mailbox NPC */ -#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "message.h" diff --git a/src/npc/malon.c b/src/npc/malon.c index 9766732a..65e1ab77 100644 --- a/src/npc/malon.c +++ b/src/npc/malon.c @@ -4,7 +4,6 @@ * * @brief Malon NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "script.h" diff --git a/src/npc/mama.c b/src/npc/mama.c index 43cdd164..cdcb3cb3 100644 --- a/src/npc/mama.c +++ b/src/npc/mama.c @@ -4,7 +4,6 @@ * * @brief Mama NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "save.h" diff --git a/src/npc/marcy.c b/src/npc/marcy.c index bfef099e..f7c56f54 100644 --- a/src/npc/marcy.c +++ b/src/npc/marcy.c @@ -4,7 +4,6 @@ * * @brief Marcy NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index 161b9f36..25887beb 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -4,7 +4,6 @@ * * @brief Mayor Hagen NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "item.h" diff --git a/src/npc/melari.c b/src/npc/melari.c index 75ae8ed3..30c08445 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -4,7 +4,6 @@ * * @brief Melari NPC */ -#define NENT_DEPRECATED #include "item.h" #include "npc.h" diff --git a/src/npc/milkCart.c b/src/npc/milkCart.c index 37b7f54d..4c581a1e 100644 --- a/src/npc/milkCart.c +++ b/src/npc/milkCart.c @@ -4,7 +4,6 @@ * * @brief Milk Cart NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/minishEzlo.c b/src/npc/minishEzlo.c index b509b1db..54068afc 100644 --- a/src/npc/minishEzlo.c +++ b/src/npc/minishEzlo.c @@ -4,7 +4,6 @@ * * @brief Minish Ezlo NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "script.h" diff --git a/src/npc/ministerPotho.c b/src/npc/ministerPotho.c index 9c0454a5..3004e7ce 100644 --- a/src/npc/ministerPotho.c +++ b/src/npc/ministerPotho.c @@ -4,7 +4,6 @@ * * @brief Minister Potho NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "item.h" diff --git a/src/npc/moblinLady.c b/src/npc/moblinLady.c index 2aa0e0b3..1fa8d109 100644 --- a/src/npc/moblinLady.c +++ b/src/npc/moblinLady.c @@ -4,7 +4,6 @@ * * @brief Moblin Lady NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c index 6f68a069..24e3be4d 100644 --- a/src/npc/mountainMinish.c +++ b/src/npc/mountainMinish.c @@ -4,7 +4,6 @@ * * @brief Mountain Minish NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c index a9adf6e0..0390ac03 100644 --- a/src/npc/mutoh.c +++ b/src/npc/mutoh.c @@ -5,7 +5,6 @@ * * @brief Mutoh NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "item.h" diff --git a/src/npc/nayru.c b/src/npc/nayru.c index 4b8bd979..cdf79cc5 100644 --- a/src/npc/nayru.c +++ b/src/npc/nayru.c @@ -4,7 +4,6 @@ * * @brief Nayru NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "kinstone.h" #include "npc.h" diff --git a/src/npc/npc23.c b/src/npc/npc23.c index 51ef213e..4c43992a 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -4,7 +4,6 @@ * * @brief NPC 23 */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "message.h" diff --git a/src/npc/npc26.c b/src/npc/npc26.c index 6d5a3221..b3b5860b 100644 --- a/src/npc/npc26.c +++ b/src/npc/npc26.c @@ -4,7 +4,6 @@ * * @brief NPC 26 */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c index e60812b2..fa1f823f 100644 --- a/src/npc/npc4E.c +++ b/src/npc/npc4E.c @@ -4,7 +4,6 @@ * * @brief NPC 4E */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/npc/npc4F.c b/src/npc/npc4F.c index baaf9e4e..3f9450a3 100644 --- a/src/npc/npc4F.c +++ b/src/npc/npc4F.c @@ -4,7 +4,6 @@ * * @brief NPC 4F */ -#define NENT_DEPRECATED #include "npc.h" void NPC4F(Entity* this) { diff --git a/src/npc/npc5.c b/src/npc/npc5.c index 7cc930e6..da120bee 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -4,7 +4,6 @@ * * @brief NPC 5 */ -#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "hitbox.h" diff --git a/src/npc/npc58.c b/src/npc/npc58.c index 53f841f7..0d599f91 100644 --- a/src/npc/npc58.c +++ b/src/npc/npc58.c @@ -4,7 +4,6 @@ * * @brief NPC 58 */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/npc9.c b/src/npc/npc9.c index 71a45f04..99fcccb9 100644 --- a/src/npc/npc9.c +++ b/src/npc/npc9.c @@ -4,7 +4,6 @@ * * @brief NPC 9 */ -#define NENT_DEPRECATED #include "entity.h" #include "message.h" #include "npc.h" diff --git a/src/npc/percy.c b/src/npc/percy.c index c0d0eac2..c6dd0b36 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -4,7 +4,6 @@ * * @brief Percy NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c index 469dddb5..ca74c820 100644 --- a/src/npc/phonograph.c +++ b/src/npc/phonograph.c @@ -4,7 +4,6 @@ * * @brief Phonograph NPC */ -#define NENT_DEPRECATED #include "common.h" #include "entity.h" #include "fileselect.h" diff --git a/src/npc/picolyteBottle.c b/src/npc/picolyteBottle.c index 0bb4742b..c384b53b 100644 --- a/src/npc/picolyteBottle.c +++ b/src/npc/picolyteBottle.c @@ -4,7 +4,6 @@ * * @brief Picolyte Bottle NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "hitbox.h" diff --git a/src/npc/pina.c b/src/npc/pina.c index a7a2448d..f4cdc048 100644 --- a/src/npc/pina.c +++ b/src/npc/pina.c @@ -4,7 +4,6 @@ * * @brief Pina NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "message.h" diff --git a/src/npc/pita.c b/src/npc/pita.c index 673de68b..804a0e38 100644 --- a/src/npc/pita.c +++ b/src/npc/pita.c @@ -4,7 +4,6 @@ * * @brief Pita NPC */ -#define NENT_DEPRECATED #include "item.h" #include "npc.h" diff --git a/src/npc/postman.c b/src/npc/postman.c index 1ae6aa81..3e2f5745 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -4,7 +4,6 @@ * * @brief Postman NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" diff --git a/src/npc/rem.c b/src/npc/rem.c index 45d66679..dba2b8dd 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -4,7 +4,6 @@ * * @brief Rem NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "npc.h" diff --git a/src/npc/simon.c b/src/npc/simon.c index 1e599c5f..7551d73d 100644 --- a/src/npc/simon.c +++ b/src/npc/simon.c @@ -4,7 +4,6 @@ * * @brief Simon NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/npc/sittingPerson.c b/src/npc/sittingPerson.c index f16d0ea0..649239e0 100644 --- a/src/npc/sittingPerson.c +++ b/src/npc/sittingPerson.c @@ -4,7 +4,6 @@ * * @brief Sitting Person NPC */ -#define NENT_DEPRECATED #include "npc.h" #include "functions.h" diff --git a/src/npc/smallTownMinish.c b/src/npc/smallTownMinish.c index 99566202..bada8800 100644 --- a/src/npc/smallTownMinish.c +++ b/src/npc/smallTownMinish.c @@ -4,7 +4,6 @@ * * @brief Small Town Minish NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" diff --git a/src/npc/smith.c b/src/npc/smith.c index 61303812..940bd75a 100644 --- a/src/npc/smith.c +++ b/src/npc/smith.c @@ -4,7 +4,6 @@ * * @brief Smith NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "npc.h" diff --git a/src/npc/stamp.c b/src/npc/stamp.c index 59322c18..8051fe44 100644 --- a/src/npc/stamp.c +++ b/src/npc/stamp.c @@ -4,7 +4,6 @@ * * @brief Stamp NPC */ -#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "functions.h" diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index 2c9dbe00..dc930fd9 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -4,7 +4,6 @@ * * @brief Stockwell NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "game.h" diff --git a/src/npc/sturgeon.c b/src/npc/sturgeon.c index 4ba1906e..9bc3bd84 100644 --- a/src/npc/sturgeon.c +++ b/src/npc/sturgeon.c @@ -4,7 +4,6 @@ * * @brief Sturgeon NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" diff --git a/src/npc/syrup.c b/src/npc/syrup.c index c8d5d6c4..60083964 100644 --- a/src/npc/syrup.c +++ b/src/npc/syrup.c @@ -4,7 +4,6 @@ * * @brief Syrup NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "npc.h" #include "object.h" diff --git a/src/npc/talon.c b/src/npc/talon.c index 7a93007e..9e2cdfc9 100644 --- a/src/npc/talon.c +++ b/src/npc/talon.c @@ -4,7 +4,6 @@ * * @brief Talon NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "npc.h" diff --git a/src/npc/teachers.c b/src/npc/teachers.c index 527e357a..609c7bc4 100644 --- a/src/npc/teachers.c +++ b/src/npc/teachers.c @@ -4,7 +4,6 @@ * * @brief Teachers NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "player.h" diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c index cd113f45..3d4b26e8 100644 --- a/src/npc/tingleSiblings.c +++ b/src/npc/tingleSiblings.c @@ -4,7 +4,6 @@ * * @brief Tingle Siblings NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index e8914c76..f29f6e4e 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -4,7 +4,6 @@ * * @brief Town Minish NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index 593c3160..967a6645 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -4,7 +4,6 @@ * * @brief Townsperson NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "npc.h" diff --git a/src/npc/vaati.c b/src/npc/vaati.c index 9f1c9482..d272f3d8 100644 --- a/src/npc/vaati.c +++ b/src/npc/vaati.c @@ -4,7 +4,6 @@ * * @brief Vaati NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "script.h" diff --git a/src/npc/vaatiReborn.c b/src/npc/vaatiReborn.c index 5e80be89..82c349be 100644 --- a/src/npc/vaatiReborn.c +++ b/src/npc/vaatiReborn.c @@ -4,7 +4,6 @@ * * @brief Vaati Reborn NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "npc.h" diff --git a/src/npc/wheaton.c b/src/npc/wheaton.c index 7638a205..41eb8ac9 100644 --- a/src/npc/wheaton.c +++ b/src/npc/wheaton.c @@ -4,7 +4,6 @@ * * @brief Wheaton NPC */ -#define NENT_DEPRECATED #include "npc.h" void Wheaton(Entity* this) { diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c index ef37526f..521e850b 100644 --- a/src/npc/windTribespeople.c +++ b/src/npc/windTribespeople.c @@ -4,7 +4,6 @@ * * @brief Wind Tribespeople NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "sound.h" diff --git a/src/npc/zelda.c b/src/npc/zelda.c index 8d90f91a..c1f80998 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -4,7 +4,6 @@ * * @brief Zelda NPC */ -#define NENT_DEPRECATED #include "npc/zelda.h" #include "entity.h" #include "flags.h" diff --git a/src/npc/zeldaFollower.c b/src/npc/zeldaFollower.c index 349c9338..45315961 100644 --- a/src/npc/zeldaFollower.c +++ b/src/npc/zeldaFollower.c @@ -4,7 +4,6 @@ * * @brief Zelda Follower NPC */ -#define NENT_DEPRECATED #include "npc/zelda.h" #include "common.h" #include "entity.h" diff --git a/src/object/ambientClouds.c b/src/object/ambientClouds.c index c24b16f4..d7470d7d 100644 --- a/src/object/ambientClouds.c +++ b/src/object/ambientClouds.c @@ -4,7 +4,6 @@ * * @brief Ambient Clouds object */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/object/angryStatue.c b/src/object/angryStatue.c index 75e705e3..0204c90e 100644 --- a/src/object/angryStatue.c +++ b/src/object/angryStatue.c @@ -4,7 +4,6 @@ * * @brief Angry Statue object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "hitbox.h" diff --git a/src/object/archway.c b/src/object/archway.c index 2feceae8..76a9df16 100644 --- a/src/object/archway.c +++ b/src/object/archway.c @@ -4,7 +4,6 @@ * * @brief Archway object */ -#define NENT_DEPRECATED #include "entity.h" #include "game.h" diff --git a/src/object/backgroundCloud.c b/src/object/backgroundCloud.c index 691ff2cb..0c150823 100644 --- a/src/object/backgroundCloud.c +++ b/src/object/backgroundCloud.c @@ -4,7 +4,6 @@ * * @brief BackgroundCloud object */ -#define NENT_DEPRECATED #include "object.h" typedef struct { diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c index a84472db..65683a8c 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -4,7 +4,6 @@ * * @brief Baker Oven object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/barrelInside.c b/src/object/barrelInside.c index 1bd43f7e..3ef99da4 100644 --- a/src/object/barrelInside.c +++ b/src/object/barrelInside.c @@ -4,7 +4,6 @@ * * @brief Barrel Inside object */ -#define NENT_DEPRECATED #include "entity.h" typedef struct { diff --git a/src/object/barrelSpiderweb.c b/src/object/barrelSpiderweb.c index a3dcc448..4e5ca85d 100644 --- a/src/object/barrelSpiderweb.c +++ b/src/object/barrelSpiderweb.c @@ -4,7 +4,6 @@ * * @brief Barrel Spiderweb object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/beanstalk.c b/src/object/beanstalk.c index d2f7899c..f1749ccd 100644 --- a/src/object/beanstalk.c +++ b/src/object/beanstalk.c @@ -4,7 +4,6 @@ * * @brief Beanstalk object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/bedCover.c b/src/object/bedCover.c index 7e9f62a3..a24189f5 100644 --- a/src/object/bedCover.c +++ b/src/object/bedCover.c @@ -4,7 +4,6 @@ * * @brief Bed Cover object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/bell.c b/src/object/bell.c index 59d9baf5..5898b204 100644 --- a/src/object/bell.c +++ b/src/object/bell.c @@ -4,7 +4,6 @@ * * @brief Bell object */ -#define NENT_DEPRECATED #include "object.h" void Bell_Init(Entity* this); diff --git a/src/object/bench.c b/src/object/bench.c index 5c196409..ead81b3b 100644 --- a/src/object/bench.c +++ b/src/object/bench.c @@ -4,7 +4,6 @@ * * @brief Bench object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "player.h" diff --git a/src/object/bigBarrel.c b/src/object/bigBarrel.c index 07708c40..0dd13f8f 100644 --- a/src/object/bigBarrel.c +++ b/src/object/bigBarrel.c @@ -4,7 +4,6 @@ * * @brief Big Barrel object */ -#define NENT_DEPRECATED #include "asm.h" #include "common.h" #include "entity.h" diff --git a/src/object/bigIceBlock.c b/src/object/bigIceBlock.c index 6ad61e85..e52d4323 100644 --- a/src/object/bigIceBlock.c +++ b/src/object/bigIceBlock.c @@ -4,7 +4,6 @@ * * @brief Big Ice Block object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "item.h" diff --git a/src/object/bigPushableLever.c b/src/object/bigPushableLever.c index be0c1a32..41b7a21c 100644 --- a/src/object/bigPushableLever.c +++ b/src/object/bigPushableLever.c @@ -4,7 +4,6 @@ * * @brief Big Pushable Lever object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index 7efe0113..9a5b3c51 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -4,7 +4,6 @@ * * @brief Big Vortex object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/object/bird.c b/src/object/bird.c index 485c0695..a4fa24dc 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -4,7 +4,6 @@ * * @brief Bird object */ -#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "game.h" diff --git a/src/object/blockPushed.c b/src/object/blockPushed.c index d871f4ac..b7173736 100644 --- a/src/object/blockPushed.c +++ b/src/object/blockPushed.c @@ -4,7 +4,6 @@ * * @brief Block Pushed object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/board.c b/src/object/board.c index 6bb75f1c..d7bf16d0 100644 --- a/src/object/board.c +++ b/src/object/board.c @@ -4,7 +4,6 @@ * * @brief Board object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" diff --git a/src/object/bollard.c b/src/object/bollard.c index 2f73e5be..6a5d45cc 100644 --- a/src/object/bollard.c +++ b/src/object/bollard.c @@ -4,7 +4,6 @@ * * @brief Bollard object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" diff --git a/src/object/book.c b/src/object/book.c index 4ebd3f7d..50bf896e 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -4,7 +4,6 @@ * * @brief Book object */ -#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "item.h" diff --git a/src/object/bossDoor.c b/src/object/bossDoor.c index cf18f937..8eb3497e 100644 --- a/src/object/bossDoor.c +++ b/src/object/bossDoor.c @@ -4,7 +4,6 @@ * * @brief Boss Door object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/bush.c b/src/object/bush.c index 857e63f7..4cad7205 100644 --- a/src/object/bush.c +++ b/src/object/bush.c @@ -4,7 +4,6 @@ * * @brief Bush object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/button.c b/src/object/button.c index 0bf4bb7e..2a025542 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -4,7 +4,6 @@ * * @brief Button object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/cabinFurniture.c b/src/object/cabinFurniture.c index c2704dcd..e23df88c 100644 --- a/src/object/cabinFurniture.c +++ b/src/object/cabinFurniture.c @@ -4,7 +4,6 @@ * * @brief Cabin Furniture object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" diff --git a/src/object/cameraTarget.c b/src/object/cameraTarget.c index e21b2f7d..0eaa13ea 100644 --- a/src/object/cameraTarget.c +++ b/src/object/cameraTarget.c @@ -4,7 +4,6 @@ * * @brief Camera Target object */ -#define NENT_DEPRECATED #include "common.h" #include "entity.h" #include "functions.h" diff --git a/src/object/carlovObject.c b/src/object/carlovObject.c index 003b61f0..2a093491 100644 --- a/src/object/carlovObject.c +++ b/src/object/carlovObject.c @@ -4,7 +4,6 @@ * * @brief Carlov Object object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index dd9038db..3b964436 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -4,7 +4,6 @@ * * @brief Chest Spawner object */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "object.h" diff --git a/src/object/chuchuBossCutscene.c b/src/object/chuchuBossCutscene.c index 235a1f91..9c1287f2 100644 --- a/src/object/chuchuBossCutscene.c +++ b/src/object/chuchuBossCutscene.c @@ -4,7 +4,6 @@ * * @brief Chuchu Boss Cutscene object */ -#define NENT_DEPRECATED #include "functions.h" #include "menu.h" #include "object.h" diff --git a/src/object/chuchuBossParticle.c b/src/object/chuchuBossParticle.c index b0b0da51..355405c4 100644 --- a/src/object/chuchuBossParticle.c +++ b/src/object/chuchuBossParticle.c @@ -4,7 +4,6 @@ * * @brief Chuchu Boss Particle object */ -#define NENT_DEPRECATED #include "entity.h" void ChuchuBossParticle_Init(Entity*); diff --git a/src/object/chuchuBossStartParticle.c b/src/object/chuchuBossStartParticle.c index 25763c0f..ddd7032a 100644 --- a/src/object/chuchuBossStartParticle.c +++ b/src/object/chuchuBossStartParticle.c @@ -4,7 +4,6 @@ * * @brief Chuchu Boss Start Particle object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/cloud.c b/src/object/cloud.c index 9f99213d..d1ec3e74 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -4,7 +4,6 @@ * * @brief Cloud object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "structures.h" diff --git a/src/object/crackingGround.c b/src/object/crackingGround.c index 21845417..3c8c9e85 100644 --- a/src/object/crackingGround.c +++ b/src/object/crackingGround.c @@ -4,7 +4,6 @@ * * @brief Cracking Ground object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index 7480ba07..3b2efb83 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -4,7 +4,6 @@ * * @brief Crenel Bean Sprout object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/cuccoMinigame.c b/src/object/cuccoMinigame.c index 75b9dc59..d1da7c44 100644 --- a/src/object/cuccoMinigame.c +++ b/src/object/cuccoMinigame.c @@ -5,7 +5,6 @@ * * @brief Cucco Minigame object */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "fileselect.h" diff --git a/src/object/cutsceneMiscObject.c b/src/object/cutsceneMiscObject.c index 44fc603f..c1d5cc1e 100644 --- a/src/object/cutsceneMiscObject.c +++ b/src/object/cutsceneMiscObject.c @@ -4,7 +4,6 @@ * * @brief Cutscene Misc object */ -#define NENT_DEPRECATED #include "area.h" #include "functions.h" #include "item.h" diff --git a/src/object/cutsceneOrchestrator.c b/src/object/cutsceneOrchestrator.c index e844b93d..efc726a3 100644 --- a/src/object/cutsceneOrchestrator.c +++ b/src/object/cutsceneOrchestrator.c @@ -4,7 +4,6 @@ * * @brief Cutscene Orchestrator object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "hitbox.h" diff --git a/src/object/deathFx.c b/src/object/deathFx.c index 2d4204e4..2f51e110 100644 --- a/src/object/deathFx.c +++ b/src/object/deathFx.c @@ -4,7 +4,6 @@ * * @brief Death Fx object */ -#define NENT_DEPRECATED #include "object/deathFx.h" #include "enemy.h" #include "entity.h" diff --git a/src/object/dirtParticle.c b/src/object/dirtParticle.c index 8bf6bd31..f6bdf51c 100644 --- a/src/object/dirtParticle.c +++ b/src/object/dirtParticle.c @@ -4,7 +4,6 @@ * * @brief Dirt Particle object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/doubleBookshelf.c b/src/object/doubleBookshelf.c index 3003c776..d96a80cb 100644 --- a/src/object/doubleBookshelf.c +++ b/src/object/doubleBookshelf.c @@ -4,7 +4,6 @@ * * @brief Double Bookshelf object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/elementsBackground.c b/src/object/elementsBackground.c index e02bba1b..f046d3b7 100644 --- a/src/object/elementsBackground.c +++ b/src/object/elementsBackground.c @@ -4,7 +4,6 @@ * * @brief Elements Background object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "screen.h" diff --git a/src/object/enemyItem.c b/src/object/enemyItem.c index 3f199ff8..16cae432 100644 --- a/src/object/enemyItem.c +++ b/src/object/enemyItem.c @@ -4,7 +4,6 @@ * * @brief Enemy Item object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/evilSpirit.c b/src/object/evilSpirit.c index 0208d997..cb42b88b 100644 --- a/src/object/evilSpirit.c +++ b/src/object/evilSpirit.c @@ -1,4 +1,3 @@ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "flags.h" diff --git a/src/object/eyeSwitch.c b/src/object/eyeSwitch.c index 8769fd4f..152d511a 100644 --- a/src/object/eyeSwitch.c +++ b/src/object/eyeSwitch.c @@ -4,7 +4,6 @@ * * @brief EyeSwitch object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "hitbox.h" diff --git a/src/object/ezloCap.c b/src/object/ezloCap.c index 4c7f39bb..8cb07487 100644 --- a/src/object/ezloCap.c +++ b/src/object/ezloCap.c @@ -4,7 +4,6 @@ * * @brief Ezlo Cap object */ -#define NENT_DEPRECATED #include "functions.h" #include "message.h" #include "object.h" diff --git a/src/object/ezloCapFlying.c b/src/object/ezloCapFlying.c index d05ada5f..21a7faff 100644 --- a/src/object/ezloCapFlying.c +++ b/src/object/ezloCapFlying.c @@ -4,7 +4,6 @@ * * @brief Ezlo Cap Flying object */ -#define NENT_DEPRECATED #include "functions.h" #include "new_player.h" #include "object.h" diff --git a/src/object/fairy.c b/src/object/fairy.c index e937288f..1389f1fa 100644 --- a/src/object/fairy.c +++ b/src/object/fairy.c @@ -4,7 +4,6 @@ * * @brief Fairy object */ -#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "hitbox.h" diff --git a/src/object/fan.c b/src/object/fan.c index b1197147..bf9e5d27 100644 --- a/src/object/fan.c +++ b/src/object/fan.c @@ -4,7 +4,6 @@ * * @brief Fan object */ -#define NENT_DEPRECATED #include "collision.h" #include "entity.h" #include "flags.h" diff --git a/src/object/fanWind.c b/src/object/fanWind.c index 3f6d74b3..a33a58d7 100644 --- a/src/object/fanWind.c +++ b/src/object/fanWind.c @@ -4,7 +4,6 @@ * * @brief Fan Wind object */ -#define NENT_DEPRECATED #include "collision.h" #include "entity.h" #include "functions.h" diff --git a/src/object/figurineDevice.c b/src/object/figurineDevice.c index 86c09f1d..b3aadfaf 100644 --- a/src/object/figurineDevice.c +++ b/src/object/figurineDevice.c @@ -4,7 +4,6 @@ * * @brief Figurine Device object */ -#define NENT_DEPRECATED #include "figurineMenu.h" #include "fileselect.h" #include "functions.h" diff --git a/src/object/fileScreenObjects.c b/src/object/fileScreenObjects.c index 42afe6f5..b474fdd6 100644 --- a/src/object/fileScreenObjects.c +++ b/src/object/fileScreenObjects.c @@ -4,7 +4,6 @@ * * @brief File Screen Objects object */ -#define NENT_DEPRECATED #include "fileselect.h" #include "functions.h" #include "main.h" diff --git a/src/object/fireballChain.c b/src/object/fireballChain.c index 3e9905a7..af1aa68e 100644 --- a/src/object/fireballChain.c +++ b/src/object/fireballChain.c @@ -4,7 +4,6 @@ * * @brief Fireball Chain object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "global.h" diff --git a/src/object/fireplace.c b/src/object/fireplace.c index 50b959c3..98cfa2a6 100644 --- a/src/object/fireplace.c +++ b/src/object/fireplace.c @@ -4,7 +4,6 @@ * * @brief Fireplace object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/flame.c b/src/object/flame.c index b31ae8a2..34013762 100644 --- a/src/object/flame.c +++ b/src/object/flame.c @@ -4,7 +4,6 @@ * * @brief Flame object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/object/floatingBlock.c b/src/object/floatingBlock.c index 7457797f..79b784b5 100644 --- a/src/object/floatingBlock.c +++ b/src/object/floatingBlock.c @@ -4,7 +4,6 @@ * * @brief Floating Block object */ -#define NENT_DEPRECATED #include "object.h" void FloatingBlock(Entity* this) { diff --git a/src/object/floatingPlatform.c b/src/object/floatingPlatform.c index 76f00964..5da525f0 100644 --- a/src/object/floatingPlatform.c +++ b/src/object/floatingPlatform.c @@ -4,7 +4,6 @@ * * @brief Floating Platform object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "object.h" diff --git a/src/object/fourElements.c b/src/object/fourElements.c index bb99e701..0968a61c 100644 --- a/src/object/fourElements.c +++ b/src/object/fourElements.c @@ -4,7 +4,6 @@ * * @brief Four Elements object */ -#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "hitbox.h" diff --git a/src/object/frozenFlower.c b/src/object/frozenFlower.c index d046715c..0b93b1de 100644 --- a/src/object/frozenFlower.c +++ b/src/object/frozenFlower.c @@ -4,7 +4,6 @@ * * @brief Frozen Flower object */ -#define NENT_DEPRECATED #include "object.h" void FrozenFlower_Init(Entity*); diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c index 089436dc..800f77fc 100644 --- a/src/object/frozenOctorok.c +++ b/src/object/frozenOctorok.c @@ -4,7 +4,6 @@ * * @brief Frozen Octorok object */ -#define NENT_DEPRECATED #include "enemy/octorokBoss.h" #include "functions.h" #include "message.h" diff --git a/src/object/frozenWaterElement.c b/src/object/frozenWaterElement.c index eb91890c..dd40d3ab 100644 --- a/src/object/frozenWaterElement.c +++ b/src/object/frozenWaterElement.c @@ -4,7 +4,6 @@ * * @brief Frozen Water Element object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/furniture.c b/src/object/furniture.c index 0e88178c..7a816166 100644 --- a/src/object/furniture.c +++ b/src/object/furniture.c @@ -4,7 +4,6 @@ * * @brief Furniture object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "object.h" diff --git a/src/object/gentariCurtain.c b/src/object/gentariCurtain.c index bcfce42e..d980d400 100644 --- a/src/object/gentariCurtain.c +++ b/src/object/gentariCurtain.c @@ -4,7 +4,6 @@ * * @brief Gentari Curtain object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" diff --git a/src/object/giantBookLadder.c b/src/object/giantBookLadder.c index fd1e2a25..1553723b 100644 --- a/src/object/giantBookLadder.c +++ b/src/object/giantBookLadder.c @@ -4,7 +4,6 @@ * * @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 15923716..5c6b1d3c 100644 --- a/src/object/giantLeaf.c +++ b/src/object/giantLeaf.c @@ -4,7 +4,6 @@ * * @brief Giant Leaf object */ -#define NENT_DEPRECATED #include "object.h" void sub_0808D618(Entity* this); diff --git a/src/object/giantRock.c b/src/object/giantRock.c index 9c7cf68f..c8a5747e 100644 --- a/src/object/giantRock.c +++ b/src/object/giantRock.c @@ -4,7 +4,6 @@ * * @brief Giant Rock object */ -#define NENT_DEPRECATED #include "entity.h" void GiantRock(Entity* this) { diff --git a/src/object/giantRock2.c b/src/object/giantRock2.c index 09080f29..2f5765da 100644 --- a/src/object/giantRock2.c +++ b/src/object/giantRock2.c @@ -4,7 +4,6 @@ * * @brief Giant Rock 2 object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "room.h" diff --git a/src/object/giantTwig.c b/src/object/giantTwig.c index 6bb928ce..bc936e18 100644 --- a/src/object/giantTwig.c +++ b/src/object/giantTwig.c @@ -4,7 +4,6 @@ * * @brief Giant Twig object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/gleerokParticle.c b/src/object/gleerokParticle.c index 67efcb36..03ed1d2f 100644 --- a/src/object/gleerokParticle.c +++ b/src/object/gleerokParticle.c @@ -4,7 +4,6 @@ * * @brief Gleerok Particle object */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/object/graveyardKey.c b/src/object/graveyardKey.c index bef307ed..84f618df 100644 --- a/src/object/graveyardKey.c +++ b/src/object/graveyardKey.c @@ -4,7 +4,6 @@ * * @brief Graveyard Key object */ -#define NENT_DEPRECATED #include "asm.h" #include "collision.h" #include "effects.h" diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index 1416d564..376f931e 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -4,7 +4,6 @@ * * @brief Great Fairy object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "save.h" diff --git a/src/object/guruguruBar.c b/src/object/guruguruBar.c index 2c1365c1..40fa7d41 100644 --- a/src/object/guruguruBar.c +++ b/src/object/guruguruBar.c @@ -4,7 +4,6 @@ * * @brief Guruguru Bar object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "object.h" diff --git a/src/object/gustJarParticle.c b/src/object/gustJarParticle.c index 4c03551f..b55e2d16 100644 --- a/src/object/gustJarParticle.c +++ b/src/object/gustJarParticle.c @@ -4,7 +4,6 @@ * * @brief Gust Jar Particle object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "physics.h" diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c index a5c34d89..0197a246 100644 --- a/src/object/gyorgBossObject.c +++ b/src/object/gyorgBossObject.c @@ -4,7 +4,6 @@ * * @brief Gyorg Boss object */ -#define NENT_DEPRECATED #include "area.h" #include "enemy/gyorg.h" #include "entity.h" diff --git a/src/object/heartContainer.c b/src/object/heartContainer.c index 95d1b074..1817b8c3 100644 --- a/src/object/heartContainer.c +++ b/src/object/heartContainer.c @@ -4,7 +4,6 @@ * * @brief HeartContainer object */ -#define NENT_DEPRECATED #include "collision.h" #include "entity.h" #include "flags.h" diff --git a/src/object/hiddenLadderDown.c b/src/object/hiddenLadderDown.c index b17d9717..5b12f8a6 100644 --- a/src/object/hiddenLadderDown.c +++ b/src/object/hiddenLadderDown.c @@ -4,7 +4,6 @@ * * @brief Hidden Ladder Down object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" diff --git a/src/object/hitSwitch.c b/src/object/hitSwitch.c index a0931519..4763a4ac 100644 --- a/src/object/hitSwitch.c +++ b/src/object/hitSwitch.c @@ -4,7 +4,6 @@ * * @brief Hit Switch object */ -#define NENT_DEPRECATED #include "entity.h" #include "physics.h" diff --git a/src/object/hittableLever.c b/src/object/hittableLever.c index d92fbfa3..8e6b63be 100644 --- a/src/object/hittableLever.c +++ b/src/object/hittableLever.c @@ -4,7 +4,6 @@ * * @brief Hittable Lever object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index 2835e202..676ad461 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -4,7 +4,6 @@ * * @brief House Door Exterior object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/object/houseDoorInterior.c b/src/object/houseDoorInterior.c index 8e69feef..75b2dd27 100644 --- a/src/object/houseDoorInterior.c +++ b/src/object/houseDoorInterior.c @@ -4,7 +4,6 @@ * * @brief House Door Interior object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/object/houseSign.c b/src/object/houseSign.c index 4353e3ad..29a7dc5c 100644 --- a/src/object/houseSign.c +++ b/src/object/houseSign.c @@ -4,7 +4,6 @@ * * @brief HouseSign object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index 0106fb63..dda0c547 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -4,7 +4,6 @@ * * @brief Item for Sale object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "kinstone.h" diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index 8aff156f..f3f6a62f 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -4,7 +4,6 @@ * * @brief Item On Ground object */ -#define NENT_DEPRECATED #include "object/itemOnGround.h" #include "collision.h" #include "entity.h" diff --git a/src/object/jailBars.c b/src/object/jailBars.c index fb81b2b8..814a7bff 100644 --- a/src/object/jailBars.c +++ b/src/object/jailBars.c @@ -4,7 +4,6 @@ * * @brief Jail Bars object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/object/japaneseSubtitle.c b/src/object/japaneseSubtitle.c index 745b7b1a..11e7f85f 100644 --- a/src/object/japaneseSubtitle.c +++ b/src/object/japaneseSubtitle.c @@ -4,7 +4,6 @@ * * @brief Japanese Subtitle object */ -#define NENT_DEPRECATED #include "entity.h" #include "menu.h" #include "object.h" diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index 90aaf6a0..aa94b26f 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -4,7 +4,6 @@ * * @brief Jar Portal object */ -#define NENT_DEPRECATED #include "area.h" #include "functions.h" #include "object.h" diff --git a/src/object/keyStealingTakkuri.c b/src/object/keyStealingTakkuri.c index 8a5a40b1..de25fd6a 100644 --- a/src/object/keyStealingTakkuri.c +++ b/src/object/keyStealingTakkuri.c @@ -4,7 +4,6 @@ * * @brief Key Stealing Takkuri object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/kinstoneSpark.c b/src/object/kinstoneSpark.c index 56da199c..ad596c89 100644 --- a/src/object/kinstoneSpark.c +++ b/src/object/kinstoneSpark.c @@ -4,7 +4,6 @@ * * @brief Kinstone Fusion Particle object */ -#define NENT_DEPRECATED #include "functions.h" #include "kinstone.h" #include "object.h" diff --git a/src/object/ladderHoleInBookshelf.c b/src/object/ladderHoleInBookshelf.c index 9c856fe8..dd55d741 100644 --- a/src/object/ladderHoleInBookshelf.c +++ b/src/object/ladderHoleInBookshelf.c @@ -4,7 +4,6 @@ * * @brief Ladder Hole In Bookshelf object */ -#define NENT_DEPRECATED #include "entity.h" #include "player.h" diff --git a/src/object/ladderUp.c b/src/object/ladderUp.c index 8722022a..8743fadc 100644 --- a/src/object/ladderUp.c +++ b/src/object/ladderUp.c @@ -4,7 +4,6 @@ * * @brief Ladder Up object */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/object/lamp.c b/src/object/lamp.c index 705d43e5..1992f36a 100644 --- a/src/object/lamp.c +++ b/src/object/lamp.c @@ -4,7 +4,6 @@ * * @brief Lamp object */ -#define NENT_DEPRECATED #include "entity.h" void Lamp_Init(Entity* this); diff --git a/src/object/lampParticle.c b/src/object/lampParticle.c index 85c73532..fbdd3abb 100644 --- a/src/object/lampParticle.c +++ b/src/object/lampParticle.c @@ -4,7 +4,6 @@ * * @brief LampParticle object */ -#define NENT_DEPRECATED #include "entity.h" #include "item.h" #include "player.h" diff --git a/src/object/lavaPlatform.c b/src/object/lavaPlatform.c index be968d08..a98cd00b 100644 --- a/src/object/lavaPlatform.c +++ b/src/object/lavaPlatform.c @@ -4,7 +4,6 @@ * * @brief Lava Platform object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/lightDoor.c b/src/object/lightDoor.c index b8c30d7b..e128c65c 100644 --- a/src/object/lightDoor.c +++ b/src/object/lightDoor.c @@ -4,7 +4,6 @@ * * @brief Light Door object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "screen.h" diff --git a/src/object/lightRay.c b/src/object/lightRay.c index bd437bc6..9d0b6548 100644 --- a/src/object/lightRay.c +++ b/src/object/lightRay.c @@ -4,7 +4,6 @@ * * @brief Light Ray object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "screen.h" diff --git a/src/object/lightableSwitch.c b/src/object/lightableSwitch.c index 4484c9c4..927a4c9d 100644 --- a/src/object/lightableSwitch.c +++ b/src/object/lightableSwitch.c @@ -4,7 +4,6 @@ * * @brief Lightable Switch object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 5571ca47..3f47f21c 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -4,7 +4,6 @@ * * @brief Large Lilypad object */ -#define NENT_DEPRECATED #include "object/lilypadLarge.h" #include "area.h" #include "functions.h" diff --git a/src/object/lilypadLargeFalling.c b/src/object/lilypadLargeFalling.c index e32b0f88..d0b19b12 100644 --- a/src/object/lilypadLargeFalling.c +++ b/src/object/lilypadLargeFalling.c @@ -4,7 +4,6 @@ * * @brief LilypadLargeFalling object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "object/lilypadLarge.h" diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c index 1d84c392..78e91a99 100644 --- a/src/object/lilypadSmall.c +++ b/src/object/lilypadSmall.c @@ -4,7 +4,6 @@ * * @brief Lilypad Small object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/linkAnimation.c b/src/object/linkAnimation.c index 5f790559..123d6e77 100644 --- a/src/object/linkAnimation.c +++ b/src/object/linkAnimation.c @@ -5,7 +5,6 @@ * @brief Link Animation object. This is used during "item get" sequences and * replaces the player entity for the duration. */ -#define NENT_DEPRECATED #include "functions.h" #include "message.h" #include "object.h" diff --git a/src/object/linkEmptyingBottle.c b/src/object/linkEmptyingBottle.c index f9787ac4..8f029f69 100644 --- a/src/object/linkEmptyingBottle.c +++ b/src/object/linkEmptyingBottle.c @@ -5,7 +5,6 @@ * @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 "functions.h" #include "item.h" #include "object.h" diff --git a/src/object/linkFire.c b/src/object/linkFire.c index 7a5b4292..8d7223f7 100644 --- a/src/object/linkFire.c +++ b/src/object/linkFire.c @@ -4,7 +4,6 @@ * * @brief Link Fire object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/linkHoldingItem.c b/src/object/linkHoldingItem.c index 009535a7..6e5bedd2 100644 --- a/src/object/linkHoldingItem.c +++ b/src/object/linkHoldingItem.c @@ -4,7 +4,6 @@ * * @brief Link Holding Item object */ -#define NENT_DEPRECATED #include "functions.h" #include "game.h" #include "item.h" diff --git a/src/object/litArea.c b/src/object/litArea.c index 8d39ddf1..53b34d1f 100644 --- a/src/object/litArea.c +++ b/src/object/litArea.c @@ -4,7 +4,6 @@ * * @brief Lit Area object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/object/lockedDoor.c b/src/object/lockedDoor.c index ae3ae896..6395744c 100644 --- a/src/object/lockedDoor.c +++ b/src/object/lockedDoor.c @@ -4,7 +4,6 @@ * * @brief Looked Door object */ -#define NENT_DEPRECATED #include "asm.h" #include "common.h" #include "effects.h" diff --git a/src/object/macroAcorn.c b/src/object/macroAcorn.c index 044ab9f1..a7f32871 100644 --- a/src/object/macroAcorn.c +++ b/src/object/macroAcorn.c @@ -4,7 +4,6 @@ * * @brief Macro Acorn object */ -#define NENT_DEPRECATED #include "entity.h" #include "object.h" #include "physics.h" diff --git a/src/object/macroBook.c b/src/object/macroBook.c index 0c116b44..5e289acb 100644 --- a/src/object/macroBook.c +++ b/src/object/macroBook.c @@ -4,7 +4,6 @@ * * @brief Macro Book object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" diff --git a/src/object/macroDecorations.c b/src/object/macroDecorations.c index 5227ec46..4e886ae0 100644 --- a/src/object/macroDecorations.c +++ b/src/object/macroDecorations.c @@ -4,7 +4,6 @@ * * @brief Macro Decoration object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "room.h" diff --git a/src/object/macroMushroomStalk.c b/src/object/macroMushroomStalk.c index 92f70fa0..45eb8fe0 100644 --- a/src/object/macroMushroomStalk.c +++ b/src/object/macroMushroomStalk.c @@ -4,7 +4,6 @@ * * @brief Macro Mushroom Stalk object */ -#define NENT_DEPRECATED #include "area.h" #include "entity.h" #include "main.h" diff --git a/src/object/macroPlayer.c b/src/object/macroPlayer.c index deb5a7c8..a313729b 100644 --- a/src/object/macroPlayer.c +++ b/src/object/macroPlayer.c @@ -4,7 +4,6 @@ * * @brief Macro Player object */ -#define NENT_DEPRECATED #include "area.h" #include "entity.h" #include "functions.h" diff --git a/src/object/macroShoe.c b/src/object/macroShoe.c index e9b12000..2d4b5ac2 100644 --- a/src/object/macroShoe.c +++ b/src/object/macroShoe.c @@ -4,7 +4,6 @@ * * @brief Macro Shoe object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" diff --git a/src/object/mask.c b/src/object/mask.c index e6934e5a..dc289996 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -4,7 +4,6 @@ * * @brief Mask object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/mazaalBossObject.c b/src/object/mazaalBossObject.c index c65e7c02..4e05b012 100644 --- a/src/object/mazaalBossObject.c +++ b/src/object/mazaalBossObject.c @@ -4,7 +4,6 @@ * * @brief Mazaal Boss object */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/object/mazaalObject.c b/src/object/mazaalObject.c index 68c76041..949e3897 100644 --- a/src/object/mazaalObject.c +++ b/src/object/mazaalObject.c @@ -4,7 +4,6 @@ * * @brief Mazaal Object object */ -#define NENT_DEPRECATED #include "entity.h" #include "physics.h" diff --git a/src/object/metalDoor.c b/src/object/metalDoor.c index 0703a301..0c7fbfd0 100644 --- a/src/object/metalDoor.c +++ b/src/object/metalDoor.c @@ -4,7 +4,6 @@ * * @brief Metal Door object */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/object/minecart.c b/src/object/minecart.c index 73cf2e51..6f0e0b18 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -4,7 +4,6 @@ * * @brief Minecart object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/minecartDoor.c b/src/object/minecartDoor.c index a6746467..0ce907e3 100644 --- a/src/object/minecartDoor.c +++ b/src/object/minecartDoor.c @@ -4,7 +4,6 @@ * * @brief Minecart Door object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/mineralWaterSource.c b/src/object/mineralWaterSource.c index 56667b11..e60006d8 100644 --- a/src/object/mineralWaterSource.c +++ b/src/object/mineralWaterSource.c @@ -4,7 +4,6 @@ * * @brief Mineral Water Source object */ -#define NENT_DEPRECATED #include "object.h" void MineralWaterSource_Init(Entity*); diff --git a/src/object/minishEmoticon.c b/src/object/minishEmoticon.c index 279c66e4..0904b1cb 100644 --- a/src/object/minishEmoticon.c +++ b/src/object/minishEmoticon.c @@ -4,7 +4,6 @@ * * @brief Minish Emoticon object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" diff --git a/src/object/minishLight.c b/src/object/minishLight.c index 36569b66..382056ee 100644 --- a/src/object/minishLight.c +++ b/src/object/minishLight.c @@ -4,7 +4,6 @@ * * @brief Minish Light object */ -#define NENT_DEPRECATED #include "entity.h" void MinishLight_Init(Entity*); diff --git a/src/object/minishPortalCloseup.c b/src/object/minishPortalCloseup.c index e683e3bc..e9ded723 100644 --- a/src/object/minishPortalCloseup.c +++ b/src/object/minishPortalCloseup.c @@ -4,7 +4,6 @@ * * @brief Minish Portal Closeup object */ -#define NENT_DEPRECATED #include "area.h" #include "functions.h" #include "main.h" diff --git a/src/object/minishPortalStone.c b/src/object/minishPortalStone.c index 5dc4bfcf..929f65ac 100644 --- a/src/object/minishPortalStone.c +++ b/src/object/minishPortalStone.c @@ -4,7 +4,6 @@ * * @brief Minish Portal Stone object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "screen.h" diff --git a/src/object/minishSizedArchway.c b/src/object/minishSizedArchway.c index e92e6fef..01a81cfc 100644 --- a/src/object/minishSizedArchway.c +++ b/src/object/minishSizedArchway.c @@ -4,7 +4,6 @@ * * @brief Minish Sized Archway object */ -#define NENT_DEPRECATED #include "entity.h" #include "game.h" diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c index d63eba55..c12192c2 100644 --- a/src/object/minishSizedEntrance.c +++ b/src/object/minishSizedEntrance.c @@ -4,7 +4,6 @@ * * @brief MinishSizedEntrance object */ -#define NENT_DEPRECATED #include "functions.h" #include "game.h" #include "object.h" diff --git a/src/object/minishVillageObject.c b/src/object/minishVillageObject.c index dbefdeb9..ef5c9780 100644 --- a/src/object/minishVillageObject.c +++ b/src/object/minishVillageObject.c @@ -4,7 +4,6 @@ * * @brief Minish Village Object object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "screen.h" diff --git a/src/object/moleMittsParticle.c b/src/object/moleMittsParticle.c index 02f3e72e..29e2a971 100644 --- a/src/object/moleMittsParticle.c +++ b/src/object/moleMittsParticle.c @@ -4,7 +4,6 @@ * * @brief Mole Mitts Particle object */ -#define NENT_DEPRECATED #include "area.h" #include "functions.h" #include "object.h" diff --git a/src/object/mulldozerSpawnPoint.c b/src/object/mulldozerSpawnPoint.c index 17a33331..8ba4d3b0 100644 --- a/src/object/mulldozerSpawnPoint.c +++ b/src/object/mulldozerSpawnPoint.c @@ -4,7 +4,6 @@ * * @brief Mulldozer Spawn Point object */ -#define NENT_DEPRECATED #include "entity.h" #include "sound.h" diff --git a/src/object/object1D.c b/src/object/object1D.c index 4252f9b0..0635d64c 100644 --- a/src/object/object1D.c +++ b/src/object/object1D.c @@ -4,7 +4,6 @@ * * @brief Object1D object */ -#define NENT_DEPRECATED #include "entity.h" void Object1D_Init(Entity*); diff --git a/src/object/object1F.c b/src/object/object1F.c index bff26637..292ee2cd 100644 --- a/src/object/object1F.c +++ b/src/object/object1F.c @@ -4,7 +4,6 @@ * * @brief Object1F object */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/object/object30.c b/src/object/object30.c index 446d2bf6..61b3448f 100644 --- a/src/object/object30.c +++ b/src/object/object30.c @@ -4,7 +4,6 @@ * * @brief Object30 object */ -#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "item.h" diff --git a/src/object/object37.c b/src/object/object37.c index 619f8482..1ec12de2 100644 --- a/src/object/object37.c +++ b/src/object/object37.c @@ -4,7 +4,6 @@ * * @brief Object37 object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" diff --git a/src/object/object53.c b/src/object/object53.c index e7716e64..e00e9ef2 100644 --- a/src/object/object53.c +++ b/src/object/object53.c @@ -4,7 +4,6 @@ * * @brief Object53 object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" diff --git a/src/object/object63.c b/src/object/object63.c index b87c79f6..bbf74160 100644 --- a/src/object/object63.c +++ b/src/object/object63.c @@ -4,7 +4,6 @@ * * @brief Object63 object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" diff --git a/src/object/object70.c b/src/object/object70.c index efe82743..082289c8 100644 --- a/src/object/object70.c +++ b/src/object/object70.c @@ -4,7 +4,6 @@ * * @brief Object70 object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/objectA.c b/src/object/objectA.c index aad2385c..2d4eb4c3 100644 --- a/src/object/objectA.c +++ b/src/object/objectA.c @@ -4,7 +4,6 @@ * * @brief ObjectA object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/object/objectA2.c b/src/object/objectA2.c index 4f9c55cb..5aca031b 100644 --- a/src/object/objectA2.c +++ b/src/object/objectA2.c @@ -4,7 +4,6 @@ * * @brief Object A2 object */ -#define NENT_DEPRECATED #include "functions.h" #include "menu.h" #include "object.h" diff --git a/src/object/objectA7.c b/src/object/objectA7.c index a711d644..bf8cc69e 100644 --- a/src/object/objectA7.c +++ b/src/object/objectA7.c @@ -4,7 +4,6 @@ * * @brief Object A7 object */ -#define NENT_DEPRECATED #include "entity.h" void ObjectA7(Entity* this) { diff --git a/src/object/objectA8.c b/src/object/objectA8.c index 819495d4..f44abf38 100644 --- a/src/object/objectA8.c +++ b/src/object/objectA8.c @@ -4,7 +4,6 @@ * * @brief ObjectA8 object */ -#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "hitbox.h" diff --git a/src/object/objectBF.c b/src/object/objectBF.c index 0c884d18..a66a2b61 100644 --- a/src/object/objectBF.c +++ b/src/object/objectBF.c @@ -4,7 +4,6 @@ * * @brief Object BF object */ -#define NENT_DEPRECATED #include "entity.h" void ObjectBF(Entity* this) { diff --git a/src/object/objectBlockingStairs.c b/src/object/objectBlockingStairs.c index 18234b59..ecb5ceaf 100644 --- a/src/object/objectBlockingStairs.c +++ b/src/object/objectBlockingStairs.c @@ -4,7 +4,6 @@ * * @brief Object Blocking Stairs object */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/object/objectOnPillar.c b/src/object/objectOnPillar.c index 6f3381dc..a4aa5860 100644 --- a/src/object/objectOnPillar.c +++ b/src/object/objectOnPillar.c @@ -4,7 +4,6 @@ * * @brief Object on Pillar object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/objectOnSpinyBeetle.c b/src/object/objectOnSpinyBeetle.c index 8c6beccf..064e987c 100644 --- a/src/object/objectOnSpinyBeetle.c +++ b/src/object/objectOnSpinyBeetle.c @@ -4,7 +4,6 @@ * * @brief Object on Spiny Beetle object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/octorokBossObject.c b/src/object/octorokBossObject.c index 1410d0d1..51143b43 100644 --- a/src/object/octorokBossObject.c +++ b/src/object/octorokBossObject.c @@ -4,7 +4,6 @@ * * @brief Octorok Boss Object object */ -#define NENT_DEPRECATED #include "functions.h" #include "game.h" #include "object.h" diff --git a/src/object/palaceArchway.c b/src/object/palaceArchway.c index b7240a49..4f545bef 100644 --- a/src/object/palaceArchway.c +++ b/src/object/palaceArchway.c @@ -4,7 +4,6 @@ * * @brief Palace Archway object */ -#define NENT_DEPRECATED #include "object.h" void PalaceArchway_Init(Entity*); diff --git a/src/object/paper.c b/src/object/paper.c index a3b515ee..f45f0c6d 100644 --- a/src/object/paper.c +++ b/src/object/paper.c @@ -4,7 +4,6 @@ * * @brief Paper object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/parallaxRoomView.c b/src/object/parallaxRoomView.c index bd08c984..49be0837 100644 --- a/src/object/parallaxRoomView.c +++ b/src/object/parallaxRoomView.c @@ -4,7 +4,6 @@ * * @brief Parallax Room View object */ -#define NENT_DEPRECATED #include "entity.h" #include "room.h" diff --git a/src/object/picoBloom.c b/src/object/picoBloom.c index 085295e4..157e344c 100644 --- a/src/object/picoBloom.c +++ b/src/object/picoBloom.c @@ -4,7 +4,6 @@ * * @brief Pico Bloom object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "sound.h" diff --git a/src/object/pinwheel.c b/src/object/pinwheel.c index e98c5144..35d161a8 100644 --- a/src/object/pinwheel.c +++ b/src/object/pinwheel.c @@ -4,7 +4,6 @@ * * @brief Pinwheel object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "object.h" diff --git a/src/object/playerClone.c b/src/object/playerClone.c index 56a3c8bf..b4281f78 100644 --- a/src/object/playerClone.c +++ b/src/object/playerClone.c @@ -4,7 +4,6 @@ * * @brief Player Clone object */ -#define NENT_DEPRECATED #include "asm.h" #include "collision.h" #include "effects.h" diff --git a/src/object/pot.c b/src/object/pot.c index 93bc1995..4f8cd84e 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -4,7 +4,6 @@ * * @brief Pot object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/object/pressurePlate.c b/src/object/pressurePlate.c index a10818eb..407ba680 100644 --- a/src/object/pressurePlate.c +++ b/src/object/pressurePlate.c @@ -4,7 +4,6 @@ * * @brief Pressure Plate object */ -#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "hitbox.h" diff --git a/src/object/pullableLever.c b/src/object/pullableLever.c index 4b99f202..0aaaa1ac 100644 --- a/src/object/pullableLever.c +++ b/src/object/pullableLever.c @@ -4,7 +4,6 @@ * * @brief Pullable Lever object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/pullableMushroom.c b/src/object/pullableMushroom.c index 0fd58dcf..8c786450 100644 --- a/src/object/pullableMushroom.c +++ b/src/object/pullableMushroom.c @@ -4,7 +4,6 @@ * * @brief Pullable Mushroom object */ -#define NENT_DEPRECATED #include "functions.h" #include "game.h" #include "hitbox.h" diff --git a/src/object/pushableFurniture.c b/src/object/pushableFurniture.c index 58b1c1aa..da7d04d5 100644 --- a/src/object/pushableFurniture.c +++ b/src/object/pushableFurniture.c @@ -4,7 +4,6 @@ * * @brief Pushable Furniture object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/pushableGrave.c b/src/object/pushableGrave.c index 245763e3..7c7a3cbe 100644 --- a/src/object/pushableGrave.c +++ b/src/object/pushableGrave.c @@ -4,7 +4,6 @@ * * @brief Pushable Grave object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/pushableLever.c b/src/object/pushableLever.c index 493bf92c..2a16033b 100644 --- a/src/object/pushableLever.c +++ b/src/object/pushableLever.c @@ -4,7 +4,6 @@ * * @brief Pushable Lever object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/pushableRock.c b/src/object/pushableRock.c index ca862173..00d8739a 100644 --- a/src/object/pushableRock.c +++ b/src/object/pushableRock.c @@ -4,7 +4,6 @@ * * @brief Pushable Rock object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/pushableStatue.c b/src/object/pushableStatue.c index ed3de97f..f9910b31 100644 --- a/src/object/pushableStatue.c +++ b/src/object/pushableStatue.c @@ -4,7 +4,6 @@ * * @brief Pushable Statue object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/railtrack.c b/src/object/railtrack.c index 9fe52d41..5582202f 100644 --- a/src/object/railtrack.c +++ b/src/object/railtrack.c @@ -4,7 +4,6 @@ * * @brief Railtrack object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" diff --git a/src/object/rotatingTrapdoor.c b/src/object/rotatingTrapdoor.c index 9aa0f947..f8e05f49 100644 --- a/src/object/rotatingTrapdoor.c +++ b/src/object/rotatingTrapdoor.c @@ -4,7 +4,6 @@ * * @brief Rotating Trapdoor object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" diff --git a/src/object/rupee.c b/src/object/rupee.c index fe38b3ad..b729c071 100644 --- a/src/object/rupee.c +++ b/src/object/rupee.c @@ -4,7 +4,6 @@ * * @brief Rupee object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/sanctuaryStoneTablet.c b/src/object/sanctuaryStoneTablet.c index 4a107f5a..31201381 100644 --- a/src/object/sanctuaryStoneTablet.c +++ b/src/object/sanctuaryStoneTablet.c @@ -4,7 +4,6 @@ * * @brief Sanctuary Stone Tablet object */ -#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "flags.h" diff --git a/src/object/shrinkingHieroglyphs.c b/src/object/shrinkingHieroglyphs.c index daa132f1..1fcaa801 100644 --- a/src/object/shrinkingHieroglyphs.c +++ b/src/object/shrinkingHieroglyphs.c @@ -4,7 +4,6 @@ * * @brief Shrinking Hieroglyphs object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "player.h" diff --git a/src/object/smallIceBlock.c b/src/object/smallIceBlock.c index 255dbb40..ed2cdea1 100644 --- a/src/object/smallIceBlock.c +++ b/src/object/smallIceBlock.c @@ -4,7 +4,6 @@ * * @brief Small Ice Block object */ -#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "hitbox.h" diff --git a/src/object/smoke.c b/src/object/smoke.c index bffaa8b8..62b4d1ac 100644 --- a/src/object/smoke.c +++ b/src/object/smoke.c @@ -4,7 +4,6 @@ * * @brief Smoke object */ -#define NENT_DEPRECATED #include "object.h" void Smoke_Type0(Entity*); diff --git a/src/object/smokeParticle.c b/src/object/smokeParticle.c index 4e871bfc..ab50e2b8 100644 --- a/src/object/smokeParticle.c +++ b/src/object/smokeParticle.c @@ -4,7 +4,6 @@ * * @brief Smoke Particle object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/specialChest.c b/src/object/specialChest.c index fd57c7fc..f2fbc8ae 100644 --- a/src/object/specialChest.c +++ b/src/object/specialChest.c @@ -4,7 +4,6 @@ * * @brief Special Chest object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "player.h" diff --git a/src/object/specialFx.c b/src/object/specialFx.c index 8780cf0c..5de442a3 100644 --- a/src/object/specialFx.c +++ b/src/object/specialFx.c @@ -4,7 +4,6 @@ * * @brief Special FX object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "object.h" diff --git a/src/object/steam.c b/src/object/steam.c index d3b7a13e..451afadb 100644 --- a/src/object/steam.c +++ b/src/object/steam.c @@ -4,7 +4,6 @@ * * @brief Steam object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "player.h" diff --git a/src/object/stoneTablet.c b/src/object/stoneTablet.c index 15605a4b..06049ca9 100644 --- a/src/object/stoneTablet.c +++ b/src/object/stoneTablet.c @@ -4,7 +4,6 @@ * * @brief Stone Tablet object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "room.h" diff --git a/src/object/swordParticle.c b/src/object/swordParticle.c index 63415fb6..9721e52f 100644 --- a/src/object/swordParticle.c +++ b/src/object/swordParticle.c @@ -4,7 +4,6 @@ * * @brief Sword Particle object */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "object.h" diff --git a/src/object/swordsmanNewsletter.c b/src/object/swordsmanNewsletter.c index 732927c9..bc17266a 100644 --- a/src/object/swordsmanNewsletter.c +++ b/src/object/swordsmanNewsletter.c @@ -4,7 +4,6 @@ * * @brief Swordsman Newsletter object */ -#define NENT_DEPRECATED #include "entity.h" #include "message.h" diff --git a/src/object/thoughtBubble.c b/src/object/thoughtBubble.c index 7ab561c5..10b9de5e 100644 --- a/src/object/thoughtBubble.c +++ b/src/object/thoughtBubble.c @@ -4,7 +4,6 @@ * * @brief Thought Bubble object */ -#define NENT_DEPRECATED #include "entity.h" #include "sound.h" diff --git a/src/object/thunderbolt.c b/src/object/thunderbolt.c index 697a32e3..b1984fa2 100644 --- a/src/object/thunderbolt.c +++ b/src/object/thunderbolt.c @@ -4,7 +4,6 @@ * * @brief Thunderbolt object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/titleScreenObject.c b/src/object/titleScreenObject.c index 9144d0e3..dc94e9fc 100644 --- a/src/object/titleScreenObject.c +++ b/src/object/titleScreenObject.c @@ -4,7 +4,6 @@ * * @brief Title Screen object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/trapdoor.c b/src/object/trapdoor.c index 2bf94151..34622516 100644 --- a/src/object/trapdoor.c +++ b/src/object/trapdoor.c @@ -4,7 +4,6 @@ * * @brief Trapdoor object */ -#define NENT_DEPRECATED #include "item.h" #include "object.h" diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index 4acf1d76..fbd447e4 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -4,7 +4,6 @@ * * @brief Tree Hiding Portal object */ -#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "flags.h" diff --git a/src/object/treeThorns.c b/src/object/treeThorns.c index 15aac684..a51bf700 100644 --- a/src/object/treeThorns.c +++ b/src/object/treeThorns.c @@ -4,7 +4,6 @@ * * @brief Three Thorns object */ -#define NENT_DEPRECATED #include "entity.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/unusedSkull.c b/src/object/unusedSkull.c index 68a22cef..204fc9b6 100644 --- a/src/object/unusedSkull.c +++ b/src/object/unusedSkull.c @@ -4,7 +4,6 @@ * * @brief Unused Skull object */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "object.h" diff --git a/src/object/vaati1Portal.c b/src/object/vaati1Portal.c index dfbc8487..e757f9c1 100644 --- a/src/object/vaati1Portal.c +++ b/src/object/vaati1Portal.c @@ -4,7 +4,6 @@ * * @brief Vaati1 Portal object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "flags.h" diff --git a/src/object/vaati2Particle.c b/src/object/vaati2Particle.c index a9d42284..d39afa96 100644 --- a/src/object/vaati2Particle.c +++ b/src/object/vaati2Particle.c @@ -4,7 +4,6 @@ * * @brief Vaati2 Particle object */ -#define NENT_DEPRECATED #include "entity.h" #include "physics.h" diff --git a/src/object/vaati3Arm.c b/src/object/vaati3Arm.c index 6ba31113..f18f0851 100644 --- a/src/object/vaati3Arm.c +++ b/src/object/vaati3Arm.c @@ -4,7 +4,6 @@ * * @brief Vaati3 Arm object */ -#define NENT_DEPRECATED #include "entity.h" #include "physics.h" diff --git a/src/object/vaati3Death.c b/src/object/vaati3Death.c index 04553f75..fd9db473 100644 --- a/src/object/vaati3Death.c +++ b/src/object/vaati3Death.c @@ -4,7 +4,6 @@ * * @brief Vaati3 Death object */ -#define NENT_DEPRECATED #include "entity.h" #include "physics.h" diff --git a/src/object/vaati3PlayerObject.c b/src/object/vaati3PlayerObject.c index b491cb2a..0cec61c1 100644 --- a/src/object/vaati3PlayerObject.c +++ b/src/object/vaati3PlayerObject.c @@ -4,7 +4,6 @@ * * @brief Vaati3 Player object */ -#define NENT_DEPRECATED #include "entity.h" #include "physics.h" #include "player.h" diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index d83bc106..166b17e2 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -4,7 +4,6 @@ * * @brief Warp Point object */ -#define NENT_DEPRECATED #include "functions.h" #include "game.h" #include "hitbox.h" diff --git a/src/object/waterDropObject.c b/src/object/waterDropObject.c index d1236267..056afa57 100644 --- a/src/object/waterDropObject.c +++ b/src/object/waterDropObject.c @@ -4,7 +4,6 @@ * * @brief Water Drop object */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" diff --git a/src/object/waterElement.c b/src/object/waterElement.c index 9b4d9902..6f55a27c 100644 --- a/src/object/waterElement.c +++ b/src/object/waterElement.c @@ -4,7 +4,6 @@ * * @brief Water Element object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" diff --git a/src/object/waterfallOpening.c b/src/object/waterfallOpening.c index 72c724d1..47baad61 100644 --- a/src/object/waterfallOpening.c +++ b/src/object/waterfallOpening.c @@ -4,7 +4,6 @@ * * @brief Waterfall Opening object */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/object/well.c b/src/object/well.c index ed033493..83c3f324 100644 --- a/src/object/well.c +++ b/src/object/well.c @@ -4,7 +4,6 @@ * * @brief Well object */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" diff --git a/src/object/whirlwind.c b/src/object/whirlwind.c index 5febac8c..fff6ed52 100644 --- a/src/object/whirlwind.c +++ b/src/object/whirlwind.c @@ -4,7 +4,6 @@ * * @brief Whirlwind object */ -#define NENT_DEPRECATED #include "area.h" #include "functions.h" #include "hitbox.h" diff --git a/src/object/whiteTriangleEffect.c b/src/object/whiteTriangleEffect.c index ec70dab3..2d7f24e3 100644 --- a/src/object/whiteTriangleEffect.c +++ b/src/object/whiteTriangleEffect.c @@ -4,7 +4,6 @@ * * @brief White Triangle Effect object */ -#define NENT_DEPRECATED #include "functions.h" #include "object.h" #include "screen.h" diff --git a/src/object/windTribeFlag.c b/src/object/windTribeFlag.c index 19aa7f63..99b8572f 100644 --- a/src/object/windTribeFlag.c +++ b/src/object/windTribeFlag.c @@ -4,7 +4,6 @@ * * @brief Wind Tribe Flag object */ -#define NENT_DEPRECATED #include "object.h" void WindTribeFlag(Entity* this) { diff --git a/src/object/windTribeTeleporter.c b/src/object/windTribeTeleporter.c index fd785ab9..8de92ec3 100644 --- a/src/object/windTribeTeleporter.c +++ b/src/object/windTribeTeleporter.c @@ -4,7 +4,6 @@ * * @brief Wind Tribe Teleporter object */ -#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "hitbox.h" diff --git a/src/object/windcrest.c b/src/object/windcrest.c index 2ce20d42..ad1b63a3 100644 --- a/src/object/windcrest.c +++ b/src/object/windcrest.c @@ -4,7 +4,6 @@ * * @brief Windcrest object */ -#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "functions.h" diff --git a/src/objectUtils.c b/src/objectUtils.c index 29e4deb8..c424e5a3 100644 --- a/src/objectUtils.c +++ b/src/objectUtils.c @@ -1,4 +1,3 @@ -#define NENT_DEPRECATED #include "global.h" #include "entity.h" diff --git a/src/physics.c b/src/physics.c index b0cc10b0..497dc793 100644 --- a/src/physics.c +++ b/src/physics.c @@ -1,4 +1,3 @@ -#define NENT_DEPRECATED #include "asm.h" #include "area.h" #include "player.h" diff --git a/src/player.c b/src/player.c index bb2b14f9..26d12f8a 100644 --- a/src/player.c +++ b/src/player.c @@ -4,7 +4,7 @@ * * @brief Player entity */ - +#define ENT_DEPRECATED #include "area.h" #include "asm.h" #include "collision.h" diff --git a/src/playerItem.c b/src/playerItem.c index 69b1557e..10e8ac0c 100644 --- a/src/playerItem.c +++ b/src/playerItem.c @@ -1,3 +1,4 @@ +#define ENT_DEPRECATED #include "global.h" #include "functions.h" #include "player.h" diff --git a/src/playerItem/playerItemBomb.c b/src/playerItem/playerItemBomb.c index af443266..5535277f 100644 --- a/src/playerItem/playerItemBomb.c +++ b/src/playerItem/playerItemBomb.c @@ -4,7 +4,6 @@ * * @brief Bomb Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" diff --git a/src/playerItem/playerItemBoomerang.c b/src/playerItem/playerItemBoomerang.c index b8b9229d..498843e4 100644 --- a/src/playerItem/playerItemBoomerang.c +++ b/src/playerItem/playerItemBoomerang.c @@ -4,7 +4,6 @@ * * @brief Boomerang Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" diff --git a/src/playerItem/playerItemBottle.c b/src/playerItem/playerItemBottle.c index 27a266c1..5cb0217d 100644 --- a/src/playerItem/playerItemBottle.c +++ b/src/playerItem/playerItemBottle.c @@ -4,7 +4,6 @@ * * @brief Bottle Player Item */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c index 061e0a69..e3aba91b 100644 --- a/src/playerItem/playerItemBow.c +++ b/src/playerItem/playerItemBow.c @@ -4,7 +4,6 @@ * * @brief Bow Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/playerItem/playerItemCellOverwriteSet.c b/src/playerItem/playerItemCellOverwriteSet.c index 94445140..22c3f8da 100644 --- a/src/playerItem/playerItemCellOverwriteSet.c +++ b/src/playerItem/playerItemCellOverwriteSet.c @@ -4,7 +4,6 @@ * * @brief Cell Overwrite Set Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "common.h" #include "entity.h" diff --git a/src/playerItem/playerItemDashSword.c b/src/playerItem/playerItemDashSword.c index 59ba47ab..497e128e 100644 --- a/src/playerItem/playerItemDashSword.c +++ b/src/playerItem/playerItemDashSword.c @@ -4,7 +4,6 @@ * * @brief Dash Sword Player Item */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "player.h" diff --git a/src/playerItem/playerItemFireRodProjectile.c b/src/playerItem/playerItemFireRodProjectile.c index 9c12f1c2..04612e50 100644 --- a/src/playerItem/playerItemFireRodProjectile.c +++ b/src/playerItem/playerItemFireRodProjectile.c @@ -4,7 +4,6 @@ * * @brief Fire Rod Projectile Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/playerItem/playerItemGust.c b/src/playerItem/playerItemGust.c index 9f098a71..cea176c4 100644 --- a/src/playerItem/playerItemGust.c +++ b/src/playerItem/playerItemGust.c @@ -4,7 +4,6 @@ * * @brief Gust Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" diff --git a/src/playerItem/playerItemGustBig.c b/src/playerItem/playerItemGustBig.c index 550c2e6e..913be2b1 100644 --- a/src/playerItem/playerItemGustBig.c +++ b/src/playerItem/playerItemGustBig.c @@ -4,7 +4,6 @@ * * @brief Gust Big Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" diff --git a/src/playerItem/playerItemGustJar.c b/src/playerItem/playerItemGustJar.c index 6e572616..4afa8857 100644 --- a/src/playerItem/playerItemGustJar.c +++ b/src/playerItem/playerItemGustJar.c @@ -4,7 +4,6 @@ * * @brief Gust Jar Player Item */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "player.h" diff --git a/src/playerItem/playerItemHeldObject.c b/src/playerItem/playerItemHeldObject.c index 5f454d37..60ad9ecb 100644 --- a/src/playerItem/playerItemHeldObject.c +++ b/src/playerItem/playerItemHeldObject.c @@ -4,7 +4,6 @@ * * @brief Held Object Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/playerItem/playerItemLantern.c b/src/playerItem/playerItemLantern.c index 0883dd78..3e66b86f 100644 --- a/src/playerItem/playerItemLantern.c +++ b/src/playerItem/playerItemLantern.c @@ -4,7 +4,6 @@ * * @brief Lantern Player Item */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" diff --git a/src/playerItem/playerItemPacciCane.c b/src/playerItem/playerItemPacciCane.c index cc11837b..65c665ad 100644 --- a/src/playerItem/playerItemPacciCane.c +++ b/src/playerItem/playerItemPacciCane.c @@ -4,7 +4,6 @@ * * @brief Pacci Cane Player Item */ -#define NENT_DEPRECATED #include "common.h" #include "entity.h" #include "functions.h" diff --git a/src/playerItem/playerItemPacciCaneProjectile.c b/src/playerItem/playerItemPacciCaneProjectile.c index 0aec528a..9bc25f27 100644 --- a/src/playerItem/playerItemPacciCaneProjectile.c +++ b/src/playerItem/playerItemPacciCaneProjectile.c @@ -4,7 +4,6 @@ * * @brief Pacci Cane Projectile Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" diff --git a/src/playerItem/playerItemShield.c b/src/playerItem/playerItemShield.c index e4fa03b6..a1b38a61 100644 --- a/src/playerItem/playerItemShield.c +++ b/src/playerItem/playerItemShield.c @@ -4,7 +4,6 @@ * * @brief Shield Player Item */ -#define NENT_DEPRECATED #include "collision.h" #include "entity.h" #include "functions.h" diff --git a/src/playerItem/playerItemSpiralBeam.c b/src/playerItem/playerItemSpiralBeam.c index 09f128d6..76901cab 100644 --- a/src/playerItem/playerItemSpiralBeam.c +++ b/src/playerItem/playerItemSpiralBeam.c @@ -4,7 +4,6 @@ * * @brief Spiral Beam Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/playerItem/playerItemSword.c b/src/playerItem/playerItemSword.c index 71c6eed7..647ea097 100644 --- a/src/playerItem/playerItemSword.c +++ b/src/playerItem/playerItemSword.c @@ -4,7 +4,6 @@ * * @brief Sword Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "effects.h" #include "entity.h" diff --git a/src/playerItem/playerItemSwordBeam.c b/src/playerItem/playerItemSwordBeam.c index 36ad1b73..dfe78825 100644 --- a/src/playerItem/playerItemSwordBeam.c +++ b/src/playerItem/playerItemSwordBeam.c @@ -4,7 +4,6 @@ * * @brief Sword Beam Player Item */ -#define NENT_DEPRECATED #include "asm.h" #include "common.h" #include "effects.h" diff --git a/src/playerUtils.c b/src/playerUtils.c index 9ab584e5..4625029f 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -1,4 +1,3 @@ -#define NENT_DEPRECATED #include "area.h" #include "asm.h" #include "common.h" diff --git a/src/projectile/arrowProjectile.c b/src/projectile/arrowProjectile.c index 0320b883..0eda80eb 100644 --- a/src/projectile/arrowProjectile.c +++ b/src/projectile/arrowProjectile.c @@ -4,7 +4,6 @@ * * @brief Arrow Projectile */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/projectile/ballAndChain.c b/src/projectile/ballAndChain.c index 62140803..a727240a 100644 --- a/src/projectile/ballAndChain.c +++ b/src/projectile/ballAndChain.c @@ -4,7 +4,6 @@ * * @brief Ball and Chain Projectile */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "hitbox.h" diff --git a/src/projectile/boneProjectile.c b/src/projectile/boneProjectile.c index 5593b602..711070a7 100644 --- a/src/projectile/boneProjectile.c +++ b/src/projectile/boneProjectile.c @@ -4,7 +4,6 @@ * * @brief Bone Projectile */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/projectile/cannonballProjectile.c b/src/projectile/cannonballProjectile.c index b8929f6e..5f2e7e04 100644 --- a/src/projectile/cannonballProjectile.c +++ b/src/projectile/cannonballProjectile.c @@ -4,7 +4,6 @@ * * @brief Cannonball Projectile */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/projectile/darkNutSwordSlash.c b/src/projectile/darkNutSwordSlash.c index 5bf0dcf9..ac30135b 100644 --- a/src/projectile/darkNutSwordSlash.c +++ b/src/projectile/darkNutSwordSlash.c @@ -4,7 +4,6 @@ * * @brief Dark Nut Sword Slash Projectile */ -#define NENT_DEPRECATED #include "entity.h" #include "physics.h" #include "player.h" diff --git a/src/projectile/dekuSeedProjectile.c b/src/projectile/dekuSeedProjectile.c index 59189ac3..bc76acc4 100644 --- a/src/projectile/dekuSeedProjectile.c +++ b/src/projectile/dekuSeedProjectile.c @@ -4,7 +4,6 @@ * * @brief Deku Seed Projectile */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/projectile/dirtBallProjectile.c b/src/projectile/dirtBallProjectile.c index d1205188..e1cfe8f1 100644 --- a/src/projectile/dirtBallProjectile.c +++ b/src/projectile/dirtBallProjectile.c @@ -4,7 +4,6 @@ * * @brief Dirt Ball Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/fireProjectile.c b/src/projectile/fireProjectile.c index 833930f0..fa5e2d5c 100644 --- a/src/projectile/fireProjectile.c +++ b/src/projectile/fireProjectile.c @@ -4,7 +4,6 @@ * * @brief Fire Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c index 51b374e5..f42d8e17 100644 --- a/src/projectile/gleerokProjectile.c +++ b/src/projectile/gleerokProjectile.c @@ -4,7 +4,6 @@ * * @brief Gleerok Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/guardLineOfSight.c b/src/projectile/guardLineOfSight.c index fcbe71bf..f76f4360 100644 --- a/src/projectile/guardLineOfSight.c +++ b/src/projectile/guardLineOfSight.c @@ -4,7 +4,6 @@ * * @brief Guard Line of Sight Projectile */ -#define NENT_DEPRECATED #include "asm.h" #include "collision.h" #include "entity.h" diff --git a/src/projectile/guruguruBarProjectile.c b/src/projectile/guruguruBarProjectile.c index 6554e43e..c1ab80cf 100644 --- a/src/projectile/guruguruBarProjectile.c +++ b/src/projectile/guruguruBarProjectile.c @@ -4,7 +4,6 @@ * * @brief Guruguru Bar Projectile */ -#define NENT_DEPRECATED #include "entity.h" #include "physics.h" diff --git a/src/projectile/gyorgMaleEnergyProjectile.c b/src/projectile/gyorgMaleEnergyProjectile.c index 45bbff69..e243cec9 100644 --- a/src/projectile/gyorgMaleEnergyProjectile.c +++ b/src/projectile/gyorgMaleEnergyProjectile.c @@ -4,7 +4,6 @@ * * @brief Gyorg Male Energy Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/gyorgTail.c b/src/projectile/gyorgTail.c index 0ed9e396..a6f30104 100644 --- a/src/projectile/gyorgTail.c +++ b/src/projectile/gyorgTail.c @@ -4,7 +4,6 @@ * * @brief Gyorg Tail Projectile */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/iceProjectile.c b/src/projectile/iceProjectile.c index 1ad42525..1fa2ea7a 100644 --- a/src/projectile/iceProjectile.c +++ b/src/projectile/iceProjectile.c @@ -4,7 +4,6 @@ * * @brief Ice Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/keatonDagger.c b/src/projectile/keatonDagger.c index baf5044b..bccb2b96 100644 --- a/src/projectile/keatonDagger.c +++ b/src/projectile/keatonDagger.c @@ -4,7 +4,6 @@ * * @brief Keaton Dagger Projectile */ -#define NENT_DEPRECATED #include "entity.h" #include "player.h" #include "physics.h" diff --git a/src/projectile/lakituCloudProjectile.c b/src/projectile/lakituCloudProjectile.c index 26331589..fe4faed2 100644 --- a/src/projectile/lakituCloudProjectile.c +++ b/src/projectile/lakituCloudProjectile.c @@ -4,7 +4,6 @@ * * @brief Lakitu Cloud Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/lakituLightning.c b/src/projectile/lakituLightning.c index 92edbc5e..866c5b20 100644 --- a/src/projectile/lakituLightning.c +++ b/src/projectile/lakituLightning.c @@ -4,7 +4,6 @@ * * @brief Lakitu Lightning Projectile */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/projectile/mandiblesProjectile.c b/src/projectile/mandiblesProjectile.c index 99658d8e..6e797140 100644 --- a/src/projectile/mandiblesProjectile.c +++ b/src/projectile/mandiblesProjectile.c @@ -4,7 +4,6 @@ * * @brief Mandibles Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/mazaalEnergyBeam.c b/src/projectile/mazaalEnergyBeam.c index 0493b76f..843a0396 100644 --- a/src/projectile/mazaalEnergyBeam.c +++ b/src/projectile/mazaalEnergyBeam.c @@ -4,7 +4,6 @@ * * @brief Mazaal Energy Beam Projectile */ -#define NENT_DEPRECATED #include "entity.h" #include "physics.h" #include "sound.h" diff --git a/src/projectile/moblinSpear.c b/src/projectile/moblinSpear.c index 22220438..ea1ac374 100644 --- a/src/projectile/moblinSpear.c +++ b/src/projectile/moblinSpear.c @@ -4,7 +4,6 @@ * * @brief Moblin Spear Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "physics.h" diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c index 132bf8a5..e4dcdb93 100644 --- a/src/projectile/octorokBossProjectile.c +++ b/src/projectile/octorokBossProjectile.c @@ -4,7 +4,6 @@ * * @brief Octorock Boss Projectile */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/projectile/projectile5.c b/src/projectile/projectile5.c index f25a30c2..f1817057 100644 --- a/src/projectile/projectile5.c +++ b/src/projectile/projectile5.c @@ -4,7 +4,6 @@ * * @brief Projectile 5 */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "physics.h" diff --git a/src/projectile/removableDust.c b/src/projectile/removableDust.c index 8056b8b1..c3138d16 100644 --- a/src/projectile/removableDust.c +++ b/src/projectile/removableDust.c @@ -4,7 +4,6 @@ * * @brief Removable Dust Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/rockProjectile.c b/src/projectile/rockProjectile.c index 786fe69a..d5d4578e 100644 --- a/src/projectile/rockProjectile.c +++ b/src/projectile/rockProjectile.c @@ -4,7 +4,6 @@ * * @brief Rock Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/spiderWeb.c b/src/projectile/spiderWeb.c index 85978f0a..a5075b2c 100644 --- a/src/projectile/spiderWeb.c +++ b/src/projectile/spiderWeb.c @@ -4,7 +4,6 @@ * * @brief Spider Web Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/spikedRollers.c b/src/projectile/spikedRollers.c index 51ea296a..bc641510 100644 --- a/src/projectile/spikedRollers.c +++ b/src/projectile/spikedRollers.c @@ -4,7 +4,6 @@ * * @brief Spiked Rollers Projectile */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" diff --git a/src/projectile/stalfosProjectile.c b/src/projectile/stalfosProjectile.c index a87f3eca..ff776f2e 100644 --- a/src/projectile/stalfosProjectile.c +++ b/src/projectile/stalfosProjectile.c @@ -4,7 +4,6 @@ * * @brief Stalfos Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/torchTrapProjectile.c b/src/projectile/torchTrapProjectile.c index a1c95101..5176b451 100644 --- a/src/projectile/torchTrapProjectile.c +++ b/src/projectile/torchTrapProjectile.c @@ -4,7 +4,6 @@ * * @brief Torch Trap Projectile */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/projectile/v1DarkMagicProjectile.c b/src/projectile/v1DarkMagicProjectile.c index eabc0260..9a1ad6f7 100644 --- a/src/projectile/v1DarkMagicProjectile.c +++ b/src/projectile/v1DarkMagicProjectile.c @@ -4,7 +4,6 @@ * * @brief V1 Dark Magic Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/v1EyeLaser.c b/src/projectile/v1EyeLaser.c index 0dacce08..a79f5c94 100644 --- a/src/projectile/v1EyeLaser.c +++ b/src/projectile/v1EyeLaser.c @@ -4,7 +4,6 @@ * * @brief V1 Eye Laser Projectile */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "projectile.h" diff --git a/src/projectile/v1FireProjectile.c b/src/projectile/v1FireProjectile.c index 952e4a7d..a0f89b5b 100644 --- a/src/projectile/v1FireProjectile.c +++ b/src/projectile/v1FireProjectile.c @@ -4,7 +4,6 @@ * * @brief V1 Fire Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/v2Projectile.c b/src/projectile/v2Projectile.c index 7223fd6b..cd42ab11 100644 --- a/src/projectile/v2Projectile.c +++ b/src/projectile/v2Projectile.c @@ -4,7 +4,6 @@ * * @brief V2 Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/v3ElectricProjectile.c b/src/projectile/v3ElectricProjectile.c index ccb207fb..fdd1b670 100644 --- a/src/projectile/v3ElectricProjectile.c +++ b/src/projectile/v3ElectricProjectile.c @@ -4,7 +4,6 @@ * * @brief V3 Electric Projectile */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/projectile/v3HandProjectile.c b/src/projectile/v3HandProjectile.c index e95e05f5..9f9b984d 100644 --- a/src/projectile/v3HandProjectile.c +++ b/src/projectile/v3HandProjectile.c @@ -4,7 +4,6 @@ * * @brief V3 Hand Projectile */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/projectile/v3TennisBallProjectile.c b/src/projectile/v3TennisBallProjectile.c index f731832b..abc6d35c 100644 --- a/src/projectile/v3TennisBallProjectile.c +++ b/src/projectile/v3TennisBallProjectile.c @@ -4,7 +4,6 @@ * * @brief V3 Tennis Ball Projectile */ -#define NENT_DEPRECATED #include "collision.h" #include "enemy.h" #include "entity.h" diff --git a/src/projectile/windProjectile.c b/src/projectile/windProjectile.c index e3ce3d57..499409f2 100644 --- a/src/projectile/windProjectile.c +++ b/src/projectile/windProjectile.c @@ -4,7 +4,6 @@ * * @brief Wind Projectile */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" diff --git a/src/projectile/winder.c b/src/projectile/winder.c index 79144c7c..5cbea569 100644 --- a/src/projectile/winder.c +++ b/src/projectile/winder.c @@ -4,7 +4,6 @@ * * @brief Winder Projectile */ -#define NENT_DEPRECATED #include "projectile/winder.h" #include "asm.h" #include "collision.h" diff --git a/src/room.c b/src/room.c index 57cfab46..c0c868f4 100644 --- a/src/room.c +++ b/src/room.c @@ -1,3 +1,4 @@ +#define ENT_DEPRECATED #include "area.h" #include "common.h" #include "flags.h" diff --git a/src/script.c b/src/script.c index 278ad227..2f50621e 100644 --- a/src/script.c +++ b/src/script.c @@ -1,13 +1,14 @@ -#include "script.h" -#include "main.h" -#include "screen.h" +#define ENT_DEPRECATED #include "area.h" -#include "game.h" -#include "object.h" -#include "npc.h" -#include "kinstone.h" #include "functions.h" +#include "game.h" #include "item.h" +#include "kinstone.h" +#include "main.h" +#include "npc.h" +#include "object.h" +#include "screen.h" +#include "script.h" #include "ui.h" void InitScriptExecutionContext(ScriptExecutionContext* context, Script* script); diff --git a/src/scroll.c b/src/scroll.c index 25c20cd6..815c2be2 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -1,5 +1,6 @@ #include "scroll.h" +#define ENT_DEPRECATED #include "asm.h" #include "collision.h" #include "common.h" diff --git a/src/vram.c b/src/vram.c index ef9f4fba..9c57a8f3 100644 --- a/src/vram.c +++ b/src/vram.c @@ -1,3 +1,4 @@ +#define ENT_DEPRECATED // Due to sub_080AE218 indexing with gPlayerEntity #include "global.h" #include "common.h" #include "structures.h" diff --git a/src/worldEvent/worldEvent15.c b/src/worldEvent/worldEvent15.c index f79420b9..e30a5c39 100644 --- a/src/worldEvent/worldEvent15.c +++ b/src/worldEvent/worldEvent15.c @@ -4,6 +4,7 @@ * * @brief World Event 15 */ +#define ENT_DEPRECATED #include "fade.h" #include "flags.h" #include "menu.h" From 5676cb7890facded77c5cf32c6017fbf12a4d386 Mon Sep 17 00:00:00 2001 From: octorock <79596758+octorock@users.noreply.github.com> Date: Sat, 30 Dec 2023 18:42:30 +0100 Subject: [PATCH 13/15] Use new entity structs in a few more files --- include/object/houseSign.h | 13 +++++++++++++ include/object/itemForSale.h | 13 +++++++++++++ src/item/itemGustJar.c | 16 ++++++++-------- src/item/itemLantern.c | 12 ++++++------ src/item/itemOcarina.c | 6 +++--- src/item/itemRocsCape.c | 12 ++++++------ src/item/itemTryPickupObject.c | 14 +++++++------- src/manager/fallingItemManager.c | 15 ++++++++------- src/manager/goronMerchantShopManager.c | 25 +++++++++++++------------ src/manager/houseSignManager.c | 23 ++++++++++++----------- src/object/houseSign.c | 10 ++-------- src/object/itemForSale.c | 10 ++-------- 12 files changed, 93 insertions(+), 76 deletions(-) create mode 100644 include/object/houseSign.h create mode 100644 include/object/itemForSale.h diff --git a/include/object/houseSign.h b/include/object/houseSign.h new file mode 100644 index 00000000..c437adee --- /dev/null +++ b/include/object/houseSign.h @@ -0,0 +1,13 @@ +#ifndef HOUSESIGN_H +#define HOUSESIGN_H + +#include "entity.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unused1[24]; + /*0x80*/ s16 unk_80; + /*0x82*/ s16 unk_82; +} HouseSignEntity; + +#endif // HOUSESIGN_H diff --git a/include/object/itemForSale.h b/include/object/itemForSale.h new file mode 100644 index 00000000..6f22e5e0 --- /dev/null +++ b/include/object/itemForSale.h @@ -0,0 +1,13 @@ +#ifndef ITEMFORSALE_H +#define ITEMFORSALE_H + +#include "object.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68[0x18]; + /*0x80*/ u16 unk_80; + /*0x82*/ u16 unk_82; +} ItemForSaleEntity; + +#endif // ITEMFORSALE_H diff --git a/src/item/itemGustJar.c b/src/item/itemGustJar.c index 8a040ec9..54dae3b2 100644 --- a/src/item/itemGustJar.c +++ b/src/item/itemGustJar.c @@ -1,7 +1,7 @@ -#define ENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" +#include "new_player.h" #include "playeritem.h" void (*const ItemGustJar_StateFunctions[])(ItemBehavior* this, u32); @@ -20,7 +20,7 @@ void sub_08076DF4(ItemBehavior* this, u32 index) { this->priority |= 0x80; this->priority++; gPlayerState.gustJarSpeed = 1; - *(u32*)&gPlayerEntity.field_0x74 = 0; + gNewPlayerEntity.unk_74 = NULL; gPlayerState.field_0x1c = 1; sub_08077BB8(this); } else { @@ -87,7 +87,7 @@ void sub_08076EC8(ItemBehavior* this, u32 index) { void sub_08076F64(ItemBehavior* this, u32 index) { Entity* item; - Entity* player; + PlayerEntity* player; switch (gPlayerState.field_0x1c & 0xf) { case 5: if (this->playerFrame & 0x80) { @@ -95,15 +95,15 @@ void sub_08076F64(ItemBehavior* this, u32 index) { this->subtimer = 0; this->timer = 0; gPlayerState.gustJarSpeed = 1; - player = &gPlayerEntity; - *(u32*)&player->field_0x74 = 0; + player = &gNewPlayerEntity; + player->unk_74 = NULL; gPlayerState.field_0x1c = 1; gPlayerState.field_0xa &= ~(8 >> index); this->stateID = 2; SetItemAnim(this, ANIM_GUSTJAR_SUCK); item = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0); if (item) { - item->parent = player; + item->parent = &player->base; } return; } else { @@ -137,7 +137,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { UpdateItemAnim(this); if (this->playerFrame & 1) { gPlayerState.field_0x1c = 5; - gPlayerEntity.field_0x70.WORD = 0; + gNewPlayerEntity.unk_70 = NULL; if (gPlayerState.gustJarSpeed) { CreatePlayerItem(PLAYER_ITEM_GUST_BIG, 0, 0, 0); } @@ -169,7 +169,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { break; } gPlayerState.field_0x1c = 0; - gPlayerEntity.field_0x70.WORD = 0; + gNewPlayerEntity.unk_70 = NULL; DeleteItemBehavior(this, index); } diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c index e5b7c91e..f7806bd0 100644 --- a/src/item/itemLantern.c +++ b/src/item/itemLantern.c @@ -1,9 +1,9 @@ -#define ENT_DEPRECATED -#include "item.h" #include "functions.h" -#include "sound.h" -#include "object.h" #include "game.h" +#include "item.h" +#include "new_player.h" +#include "object.h" +#include "sound.h" extern s8 gUnk_08126EEC[]; extern Entity* CreatePlayerItemForItemIfNotExists(ItemBehavior*); @@ -98,7 +98,7 @@ void sub_08075B54(ItemBehavior* this, u32 index) { gPlayerEntity.collisionLayer, 0x40) != 0)) { this->animPriority = 0xf; this->stateID++; - gPlayerEntity.field_0x7a.HWORD = 2; + gNewPlayerEntity.unk_7a = 2; object = CreateObjectWithParent(&gPlayerEntity, LAMP_PARTICLE, 1, 0); if (object != NULL) { object->spriteVramOffset = gPlayerEntity.spriteVramOffset; @@ -129,6 +129,6 @@ void sub_08075C9C(ItemBehavior* this, u32 index) { gPlayerState.field_0xa = (~(8 >> index)) & gPlayerState.field_0xa; gPlayerState.keepFacing = (~(8 >> index)) & gPlayerState.keepFacing; } else { - gPlayerEntity.field_0x7a.HWORD++; + gNewPlayerEntity.unk_7a++; } } diff --git a/src/item/itemOcarina.c b/src/item/itemOcarina.c index 196ea132..4b88138c 100644 --- a/src/item/itemOcarina.c +++ b/src/item/itemOcarina.c @@ -1,6 +1,6 @@ -#define ENT_DEPRECATED #include "functions.h" #include "item.h" +#include "new_player.h" #include "sound.h" extern void ResetPlayerVelocity(void); @@ -14,7 +14,7 @@ void ItemOcarina(ItemBehavior* this, u32 index) { OcarinaUpdate, }; gOcarinaStates[this->stateID](this, index); - gPlayerEntity.field_0x7a.HWORD++; + gNewPlayerEntity.unk_7a++; } void OcarinaUse(ItemBehavior* this, u32 index) { @@ -25,7 +25,7 @@ void OcarinaUse(ItemBehavior* this, u32 index) { gPlayerEntity.animationState = 0x04; gPlayerEntity.spriteSettings.flipX = 0; gPlayerEntity.flags &= ~ENT_COLLIDE; - gPlayerEntity.field_0x7a.HWORD = 2; + gNewPlayerEntity.unk_7a = 2; gPlayerState.flags |= PL_USE_OCARINA; gPlayerState.field_0x27[0] = -1; gPauseMenuOptions.disabled = 1; diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c index 6ece003d..d284ba28 100644 --- a/src/item/itemRocsCape.c +++ b/src/item/itemRocsCape.c @@ -1,7 +1,7 @@ -#define ENT_DEPRECATED -#include "item.h" -#include "sound.h" #include "functions.h" +#include "item.h" +#include "new_player.h" +#include "sound.h" void sub_08076758(ItemBehavior*, u32); extern void sub_08077F84(void); @@ -67,18 +67,18 @@ void sub_08076758(ItemBehavior* this, u32 index) { if (this->stateID < 2) { if ((gPlayerEntity.zVelocity <= 0) && ((gPlayerState.jump_status & 0x10) == 0)) { this->stateID = 2; - gPlayerEntity.field_0x7a.HWORD = 2; + gNewPlayerEntity.unk_7a = 2; gPlayerEntity.zVelocity = Q_16_16(2.0); gPlayerState.jump_status |= 0x10; gPlayerState.animation = ANIM_ROCS_CAPE; SoundReq(SFX_172); } } else { - gPlayerEntity.field_0x7a.HWORD++; + gNewPlayerEntity.unk_7a++; } } else { if (this->stateID > 1) { - gPlayerEntity.field_0x7a.HWORD++; + gNewPlayerEntity.unk_7a++; gPlayerState.jump_status &= 0xef; } } diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index 774ab613..b3aa25a1 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -1,6 +1,6 @@ -#define ENT_DEPRECATED #include "functions.h" #include "item.h" +#include "new_player.h" #include "playeritem.h" #include "sound.h" @@ -39,8 +39,8 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) { gPlayerState.framestate = 4; this->stateID = 2; this->animPriority = 0xf; - if ((gPlayerEntity.field_0x78.HALF.HI & 0x80)) { - gPlayerEntity.field_0x78.HALF.HI = 0; + if ((gNewPlayerEntity.unk_79 & 0x80)) { + gNewPlayerEntity.unk_79 = 0; COLLISION_ON(&gPlayerEntity); gPlayerState.heldObject = 4; gPlayerState.keepFacing = ~(8 >> param_3) & gPlayerState.keepFacing; @@ -56,11 +56,11 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) { if (param_2 == NULL) { PlayerCancelHoldItem(this, param_3); } else { - Entity* playerEnt = &gPlayerEntity; - *(Entity**)&playerEnt->field_0x74 = param_2; - playerEnt->subtimer = 0; + PlayerEntity* playerEnt = &gNewPlayerEntity; + playerEnt->unk_74 = param_2; + playerEnt->base.subtimer = 0; param_2->child = this->field_0x18; - param_2->carryFlags = playerEnt->carryFlags; + param_2->carryFlags = playerEnt->base.carryFlags; param_2->parent = (Entity*)this; this->field_0x18 = param_2; param_2->type2 = this->field_0x2[1]; diff --git a/src/manager/fallingItemManager.c b/src/manager/fallingItemManager.c index 49ba18e0..740c91a3 100644 --- a/src/manager/fallingItemManager.c +++ b/src/manager/fallingItemManager.c @@ -6,10 +6,11 @@ * * If you leave the room without picking the item up and enter again, the item falls from the sky again. */ -#define ENT_DEPRECATED #include "manager/fallingItemManager.h" + #include "flags.h" #include "object.h" +#include "object/itemOnGround.h" #include "room.h" void FallingItemManager_Init(FallingItemManager*); @@ -33,13 +34,13 @@ void FallingItemManager_Init(FallingItemManager* this) { void FallingItemManager_Action1(FallingItemManager* this) { if (CheckFlags(this->field_0x3e)) { - Entity* object = CreateObject(GROUND_ITEM, super->type, super->type2); + ItemOnGroundEntity* object = (ItemOnGroundEntity*)CreateObject(GROUND_ITEM, super->type, super->type2); if (object != NULL) { - object->timer = this->field_0x35; - object->collisionLayer = this->field_0x36; - object->x.HALF.HI = this->field_0x38 + gRoomControls.origin_x; - object->y.HALF.HI = this->field_0x3a + gRoomControls.origin_y; - object->field_0x86.HWORD = this->field_0x3c; + object->base.timer = this->field_0x35; + object->base.collisionLayer = this->field_0x36; + object->base.x.HALF.HI = this->field_0x38 + gRoomControls.origin_x; + object->base.y.HALF.HI = this->field_0x3a + gRoomControls.origin_y; + object->unk_86 = this->field_0x3c; } DeleteThisEntity(); } diff --git a/src/manager/goronMerchantShopManager.c b/src/manager/goronMerchantShopManager.c index b68ceb88..c2493c99 100644 --- a/src/manager/goronMerchantShopManager.c +++ b/src/manager/goronMerchantShopManager.c @@ -4,12 +4,13 @@ * * @brief Spawns the shop items for the kinstones for the goron merchant. */ -#define ENT_DEPRECATED #include "manager/goronMerchantShopManager.h" + #include "asm.h" #include "flags.h" -#include "object.h" #include "item.h" +#include "object.h" +#include "object/itemForSale.h" typedef struct { u16 minType; @@ -60,17 +61,17 @@ void GoronMerchantShopManager_Main(GoronMerchantShopManager* this) { count = 0; for (count = 0; count < 3;) { if (CheckGlobalFlag(GORON_KAKERA_L + count) == 0) { - Entity* object = - CreateObject(SHOP_ITEM, ITEM_KINSTONE, ((s32)Random() % spawnData->numTypes) + spawnData->minType); + ItemForSaleEntity* object = (ItemForSaleEntity*)CreateObject( + SHOP_ITEM, ITEM_KINSTONE, ((s32)Random() % spawnData->numTypes) + spawnData->minType); if (object != NULL) { - object->timer = 1; - object->subtimer = count; - object->x.HALF.HI = spawnData->x + gRoomControls.origin_x; - object->y.HALF.HI = spawnData->y + gRoomControls.origin_y; - object->field_0x80.HWORD = spawnData->x; - object->field_0x82.HWORD = spawnData->y; - object->collisionLayer = 1; - object->parent = (Entity*)this; + object->base.timer = 1; + object->base.subtimer = count; + object->base.x.HALF.HI = spawnData->x + gRoomControls.origin_x; + object->base.y.HALF.HI = spawnData->y + gRoomControls.origin_y; + object->unk_80 = spawnData->x; + object->unk_82 = spawnData->y; + object->base.collisionLayer = 1; + object->base.parent = (Entity*)this; this->itemActive[count] = 1; } } diff --git a/src/manager/houseSignManager.c b/src/manager/houseSignManager.c index 48784225..c33bd50a 100644 --- a/src/manager/houseSignManager.c +++ b/src/manager/houseSignManager.c @@ -7,12 +7,13 @@ * Spawns HOUSE_SIGN objects that check this and unsets the value in the bitfield. * Creates the signs on the houses in hyrule town. */ -#define ENT_DEPRECATED #include "manager/houseSignManager.h" + #include "area.h" -#include "object.h" -#include "room.h" #include "asm.h" +#include "object.h" +#include "object/houseSign.h" +#include "room.h" typedef struct { u16 x; @@ -57,15 +58,15 @@ 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(HOUSE_SIGN, spawnData->type, type2); + HouseSignEntity* object = (HouseSignEntity*)CreateObject(HOUSE_SIGN, spawnData->type, type2); if (object != NULL) { - object->frameIndex = spawnData->frameIndex; - object->x.HALF.HI = gRoomControls.origin_x + spawnData->x; - object->y.HALF.HI = gRoomControls.origin_y + spawnData->y; - object->parent = (Entity*)this; - object->field_0x80.HWORD = spawnData->x; - object->field_0x82.HWORD = spawnData->y; - object->collisionLayer = spawnData->collisionLayer; + object->base.frameIndex = spawnData->frameIndex; + object->base.x.HALF.HI = gRoomControls.origin_x + spawnData->x; + object->base.y.HALF.HI = gRoomControls.origin_y + spawnData->y; + object->base.parent = (Entity*)this; + object->unk_80 = spawnData->x; + object->unk_82 = spawnData->y; + object->base.collisionLayer = spawnData->collisionLayer; this->bitfield |= bitfieldFlag; } } diff --git a/src/object/houseSign.c b/src/object/houseSign.c index 29a7dc5c..149d3cc6 100644 --- a/src/object/houseSign.c +++ b/src/object/houseSign.c @@ -4,15 +4,9 @@ * * @brief HouseSign object */ -#include "asm.h" -#include "entity.h" +#include "object/houseSign.h" -typedef struct { - /*0x00*/ Entity base; - /*0x68*/ u8 unused1[24]; - /*0x80*/ s16 unk_80; - /*0x82*/ s16 unk_82; -} HouseSignEntity; +#include "asm.h" /* This object is created by HouseSignManager. diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index dda0c547..fc67ff26 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -4,19 +4,13 @@ * * @brief Item for Sale object */ +#include "object/itemForSale.h" + #include "functions.h" #include "hitbox.h" #include "kinstone.h" #include "message.h" #include "new_player.h" -#include "object.h" - -typedef struct { - /*0x00*/ Entity base; - /*0x68*/ u8 unk_68[0x18]; - /*0x80*/ u16 unk_80; - /*0x82*/ u16 unk_82; -} ItemForSaleEntity; typedef struct { u8 before[0x20]; From a818f1b7041898d7eee28b5c1c455ba3225e063f Mon Sep 17 00:00:00 2001 From: octorock <79596758+octorock@users.noreply.github.com> Date: Sat, 30 Dec 2023 22:08:56 +0100 Subject: [PATCH 14/15] Use new entity struct for player --- include/entity.h | 7 +- include/new_player.h | 26 - include/object/deathFx.h | 3 - include/object/linkAnimation.h | 3 - include/object/pushableFurniture.h | 25 + include/player.h | 21 +- include/playerItem/playerItemBottle.h | 13 + src/beanstalkSubtask.c | 222 +- src/code_08049DF4.c | 16 +- src/collision.c | 75 +- src/enemy/armos.c | 8 +- src/enemy/beetle.c | 12 +- src/enemy/bobomb.c | 8 +- src/enemy/bombPeahat.c | 2 +- src/enemy/businessScrub.c | 2 +- src/enemy/chuchuBoss.c | 34 +- src/enemy/cuccoAggr.c | 6 +- src/enemy/cuccoChickAggr.c | 4 +- src/enemy/dust.c | 17 +- src/enemy/enemy50.c | 6 +- src/enemy/enemy64.c | 30 +- src/enemy/fallingBoulder.c | 2 +- src/enemy/flyingPot.c | 2 +- src/enemy/flyingSkull.c | 14 +- src/enemy/ghini.c | 24 +- src/enemy/gibdo.c | 16 +- src/enemy/gleerok.c | 42 +- src/enemy/gyorgChild.c | 4 +- src/enemy/gyorgFemale.c | 10 +- src/enemy/gyorgFemaleEye.c | 4 +- src/enemy/gyorgFemaleMouth.c | 4 +- src/enemy/gyorgMale.c | 51 +- src/enemy/helmasaur.c | 2 +- src/enemy/keese.c | 4 +- src/enemy/lakitu.c | 8 +- src/enemy/lakituCloud.c | 2 +- src/enemy/likeLike.c | 24 +- src/enemy/mazaalBracelet.c | 48 +- src/enemy/mazaalHead.c | 8 +- src/enemy/moldworm.c | 40 +- src/enemy/octorokBoss.c | 63 +- src/enemy/octorokGolden.c | 6 +- src/enemy/pesto.c | 30 +- src/enemy/rollobite.c | 6 +- src/enemy/ropeGolden.c | 8 +- src/enemy/rupeeLike.c | 30 +- src/enemy/spinyBeetle.c | 8 +- src/enemy/stalfos.c | 4 +- src/enemy/sub_080451CC.c | 11 +- src/enemy/treeItem.c | 8 +- src/enemy/vaatiArm.c | 6 +- src/enemy/vaatiEyesMacro.c | 4 +- src/enemy/vaatiProjectile.c | 22 +- src/enemy/vaatiRebornEnemy.c | 14 +- src/enemy/vaatiTransfigured.c | 2 +- src/enemy/vaatiWrath.c | 26 +- src/enemy/wallMaster.c | 18 +- src/enemy/wallMaster2.c | 8 +- src/enemy/waterDrop.c | 4 +- src/enemy/wizzrobeFire.c | 2 +- src/enemy/wizzrobeIce.c | 2 +- src/enemy/wizzrobeWind.c | 2 +- src/entity.c | 65 +- src/game.c | 4 +- src/gameUtils.c | 41 +- src/interrupts.c | 25 +- src/item/itemBomb.c | 4 +- src/item/itemBoomerang.c | 2 +- src/item/itemBow.c | 2 +- src/item/itemGustJar.c | 28 +- src/item/itemJarEmpty.c | 12 +- src/item/itemLantern.c | 31 +- src/item/itemMoleMitts.c | 56 +- src/item/itemOcarina.c | 15 +- src/item/itemPacciCane.c | 2 +- src/item/itemPegasusBoots.c | 29 +- src/item/itemRocsCape.c | 23 +- src/item/itemShield.c | 2 +- src/item/itemSword.c | 32 +- src/item/itemTryPickupObject.c | 33 +- src/itemUtils.c | 2 +- src/manager/cloudStaircaseTransitionManager.c | 2 +- src/manager/diggingCaveEntranceManager.c | 16 +- src/manager/ezloHintManager.c | 4 +- src/manager/fightManager.c | 3 +- src/manager/holeManager.c | 6 +- src/manager/hyruleTownBellManager.c | 6 +- src/manager/lightManager.c | 8 +- src/manager/lightRayManager.c | 4 +- src/manager/miscManager.c | 12 +- src/manager/moveableObjectManager.c | 3 +- src/manager/pushableFurnitureManager.c | 27 +- src/manager/rollingBarrelManager.c | 26 +- src/manager/specialWarpManager.c | 4 +- src/manager/templeOfDropletsManager.c | 6 +- src/manager/tilePuzzleManager.c | 4 +- src/manager/vaati3StartManager.c | 14 +- src/manager/waterfallBottomManager.c | 8 +- src/manager/weatherChangeManager.c | 4 +- src/npc/anju.c | 4 +- src/npc/beedle.c | 6 +- src/npc/bigGoron.c | 10 +- src/npc/bladeBrothers.c | 2 +- src/npc/brocco.c | 4 +- src/npc/carpenter.c | 5 +- src/npc/castleMaid.c | 3 +- src/npc/cat.c | 10 +- src/npc/dampe.c | 4 +- src/npc/din.c | 4 +- src/npc/dog.c | 4 +- src/npc/epona.c | 3 +- src/npc/ezlo.c | 18 +- src/npc/farore.c | 4 +- src/npc/festari.c | 2 +- src/npc/gentari.c | 4 +- src/npc/ghostBrothers.c | 4 +- src/npc/gina.c | 4 +- src/npc/gregal.c | 4 +- src/npc/guard.c | 8 +- src/npc/guardWithSpear.c | 20 +- src/npc/hurdyGurdyMan.c | 3 +- src/npc/kid.c | 32 +- src/npc/kingDaltus.c | 3 +- src/npc/malon.c | 2 +- src/npc/mama.c | 3 +- src/npc/mayorHagen.c | 4 +- src/npc/ministerPotho.c | 4 +- src/npc/mountainMinish.c | 5 +- src/npc/mutoh.c | 4 +- src/npc/nayru.c | 4 +- src/npc/npc23.c | 26 +- src/npc/npc5.c | 34 +- src/npc/percy.c | 4 +- src/npc/pina.c | 4 +- src/npc/postman.c | 18 +- src/npc/sittingPerson.c | 2 +- src/npc/smith.c | 2 +- src/npc/stockwell.c | 2 +- src/npc/sturgeon.c | 4 +- src/npc/talon.c | 2 +- src/npc/teachers.c | 4 +- src/npc/tingleSiblings.c | 2 +- src/npc/townMinish.c | 8 +- src/npc/townsperson.c | 6 +- src/npc/zelda.c | 2 +- src/npc/zeldaFollower.c | 46 +- src/npcUtils.c | 10 +- src/object/ambientClouds.c | 28 +- src/object/bakerOven.c | 14 +- src/object/barrelSpiderweb.c | 6 +- src/object/beanstalk.c | 6 +- src/object/bigPushableLever.c | 6 +- src/object/bigVortex.c | 10 +- src/object/bird.c | 36 +- src/object/board.c | 6 +- src/object/book.c | 8 +- src/object/bossDoor.c | 2 +- src/object/bush.c | 2 +- src/object/button.c | 6 +- src/object/cameraTarget.c | 2 +- src/object/chestSpawner.c | 6 +- src/object/cloud.c | 2 +- src/object/crenelBeanSprout.c | 12 +- src/object/cutsceneMiscObject.c | 20 +- src/object/dirtParticle.c | 2 +- src/object/doubleBookshelf.c | 2 +- src/object/evilSpirit.c | 9 +- src/object/ezloCap.c | 18 +- src/object/ezloCapFlying.c | 33 +- src/object/fairy.c | 8 +- src/object/fan.c | 6 +- src/object/figurineDevice.c | 8 +- src/object/floatingPlatform.c | 4 +- src/object/fourElements.c | 2 +- src/object/frozenOctorok.c | 2 +- src/object/furniture.c | 11 +- src/object/giantTwig.c | 2 +- src/object/gleerokParticle.c | 2 +- src/object/graveyardKey.c | 11 +- src/object/greatFairy.c | 8 +- src/object/gustJarParticle.c | 8 +- src/object/gyorgBossObject.c | 8 +- src/object/houseDoorExterior.c | 2 +- src/object/houseDoorInterior.c | 3 +- src/object/itemForSale.c | 11 +- src/object/itemOnGround.c | 10 +- src/object/keyStealingTakkuri.c | 15 +- src/object/ladderHoleInBookshelf.c | 10 +- src/object/ladderUp.c | 2 +- src/object/lavaPlatform.c | 4 +- src/object/lightRay.c | 28 +- src/object/lilypadLarge.c | 64 +- src/object/lilypadSmall.c | 4 +- src/object/linkAnimation.c | 20 +- src/object/linkEmptyingBottle.c | 12 +- src/object/linkFire.c | 20 +- src/object/lockedDoor.c | 8 +- src/object/macroBook.c | 4 +- src/object/mask.c | 10 +- src/object/mazaalBossObject.c | 3 +- src/object/minecart.c | 68 +- src/object/minecartDoor.c | 16 +- src/object/minishEmoticon.c | 2 +- src/object/minishSizedEntrance.c | 5 +- src/object/moleMittsParticle.c | 4 +- src/object/object1F.c | 2 +- src/object/object37.c | 2 +- src/object/object70.c | 34 +- src/object/objectA8.c | 8 +- src/object/objectBlockingStairs.c | 14 +- src/object/objectOnPillar.c | 10 +- src/object/objectOnSpinyBeetle.c | 2 +- src/object/octorokBossObject.c | 2 +- src/object/paper.c | 3 +- src/object/playerClone.c | 42 +- src/object/pot.c | 4 +- src/object/pressurePlate.c | 2 +- src/object/pullableLever.c | 16 +- src/object/pullableMushroom.c | 33 +- src/object/pushableFurniture.c | 29 +- src/object/pushableGrave.c | 2 +- src/object/pushableLever.c | 6 +- src/object/pushableStatue.c | 22 +- src/object/shrinkingHieroglyphs.c | 4 +- src/object/specialFx.c | 4 +- src/object/steam.c | 2 +- src/object/swordParticle.c | 16 +- src/object/thunderbolt.c | 2 +- src/object/trapdoor.c | 4 +- src/object/treeHidingPortal.c | 8 +- src/object/vaati1Portal.c | 4 +- src/object/vaati3PlayerObject.c | 2 +- src/object/warpPoint.c | 41 +- src/object/well.c | 4 +- src/object/whirlwind.c | 23 +- src/object/windTribeTeleporter.c | 26 +- src/objectUtils.c | 20 +- src/physics.c | 37 +- src/player.c | 2828 +++++++++-------- src/playerItem.c | 15 +- src/playerItem/playerItemBoomerang.c | 22 +- src/playerItem/playerItemBottle.c | 34 +- src/playerItem/playerItemBow.c | 20 +- src/playerItem/playerItemCellOverwriteSet.c | 2 +- src/playerItem/playerItemDashSword.c | 10 +- src/playerItem/playerItemFireRodProjectile.c | 4 +- src/playerItem/playerItemGust.c | 8 +- src/playerItem/playerItemGustBig.c | 21 +- src/playerItem/playerItemGustJar.c | 14 +- src/playerItem/playerItemHeldObject.c | 15 +- src/playerItem/playerItemLantern.c | 22 +- src/playerItem/playerItemPacciCane.c | 14 +- .../playerItemPacciCaneProjectile.c | 8 +- src/playerItem/playerItemShield.c | 38 +- src/playerItem/playerItemSpiralBeam.c | 6 +- src/playerItem/playerItemSword.c | 34 +- src/playerItem/playerItemSwordBeam.c | 6 +- src/playerItemUtils.c | 2 +- src/playerUtils.c | 441 +-- src/projectile/darkNutSwordSlash.c | 2 +- src/projectile/dirtBallProjectile.c | 2 +- src/projectile/gleerokProjectile.c | 4 +- src/projectile/gyorgMaleEnergyProjectile.c | 2 +- src/projectile/keatonDagger.c | 2 +- src/projectile/lakituCloudProjectile.c | 2 +- src/projectile/octorokBossProjectile.c | 2 +- src/projectile/projectile5.c | 2 +- src/projectile/spiderWeb.c | 11 +- src/projectile/v1DarkMagicProjectile.c | 20 +- src/projectile/v2Projectile.c | 2 +- src/projectile/v3ElectricProjectile.c | 6 +- src/projectile/v3HandProjectile.c | 2 +- src/room.c | 7 +- src/roomInit.c | 34 +- src/script.c | 116 +- src/scroll.c | 29 +- src/subtask/subtaskFastTravel.c | 2 +- src/vram.c | 7 +- src/worldEvent/worldEvent15.c | 3 +- 279 files changed, 3482 insertions(+), 3475 deletions(-) delete mode 100644 include/new_player.h create mode 100644 include/object/pushableFurniture.h create mode 100644 include/playerItem/playerItemBottle.h diff --git a/include/entity.h b/include/entity.h index 42d77030..315e94db 100644 --- a/include/entity.h +++ b/include/entity.h @@ -220,9 +220,6 @@ typedef struct Entity_ { /*0x62*/ u8 spriteOffsetX; /*0x63*/ s8 spriteOffsetY; /*0x64*/ void* myHeap; /**< Heap data allocated with #zMalloc. */ -#ifdef ENT_DEPRECATED - GENERIC_ENTITY_FIELDS -#endif } Entity; typedef struct { @@ -248,8 +245,8 @@ typedef struct LinkedList { * to allow the iteration of all Entity's. */ extern LinkedList gEntityLists[9]; -extern Entity gAuxPlayerEntities[MAX_AUX_PLAYER_ENTITIES]; -extern Entity gEntities[MAX_ENTITIES]; +extern GenericEntity gAuxPlayerEntities[MAX_AUX_PLAYER_ENTITIES]; +extern GenericEntity gEntities[MAX_ENTITIES]; typedef void(EntityAction)(Entity*); typedef void (*EntityActionPtr)(Entity*); diff --git a/include/new_player.h b/include/new_player.h deleted file mode 100644 index bae1ed2f..00000000 --- a/include/new_player.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef NEW_PLAYER_H -#define NEW_PLAYER_H - -#include "entity.h" - -// TODO Use new player entity struct everywhere once it is fully discovered. - -typedef struct { - /*0x00*/ Entity base; - /*0x68*/ u32 unk_68; - /*0x6c*/ u8 unk_6c; - /*0x6d*/ u8 unk_6d; - /*0x6e*/ u8 unk_6e; - /*0x6f*/ u8 unk_6f; - /*0x70*/ Entity* unk_70; - /*0x74*/ Entity* unk_74; - /*0x78*/ u8 unk_78; - /*0x79*/ u8 unk_79; - /*0x7a*/ u16 unk_7a; - /*0x7c*/ u32 unk_7c; - /*0x80*/ u8 unk_80[8]; -} PlayerEntity; - -#define gNewPlayerEntity (*(PlayerEntity*)&gPlayerEntity) - -#endif // NEW_PLAYER_H diff --git a/include/object/deathFx.h b/include/object/deathFx.h index f8317f8c..4f14ea86 100644 --- a/include/object/deathFx.h +++ b/include/object/deathFx.h @@ -1,9 +1,6 @@ #ifndef DEATHFX_H #define DEATHFX_H -#ifdef ENT_DEPRECATED -#error "deathFx.h requires new entities" -#endif #include "entity.h" typedef struct { diff --git a/include/object/linkAnimation.h b/include/object/linkAnimation.h index 00e0ba94..781df520 100644 --- a/include/object/linkAnimation.h +++ b/include/object/linkAnimation.h @@ -1,9 +1,6 @@ #ifndef LINKANIMATION_H #define LINKANIMATION_H -#ifdef ENT_DEPRECATED -#error "linkAnimtion.h requires new entities" -#endif #include "entity.h" typedef struct { diff --git a/include/object/pushableFurniture.h b/include/object/pushableFurniture.h new file mode 100644 index 00000000..db693183 --- /dev/null +++ b/include/object/pushableFurniture.h @@ -0,0 +1,25 @@ +#ifndef PUSHABLEFURNITURE_H +#define PUSHABLEFURNITURE_H + +#include "object.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 unk_68[0x8]; + /*0x70*/ u16 unk_70; + /*0x72*/ u16 unk_72; + /*0x74*/ u16 unk_74; + /*0x76*/ u16 unk_76; + /*0x78*/ u8 unk_78[0x2]; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ u16 unk_7c; + /*0x7e*/ u16 unk_7e; + /*0x80*/ u8 unk_80; + /*0x81*/ u8 unk_81; + /*0x82*/ u8 unk_82; + /*0x83*/ u8 unk_83; + /*0x84*/ u8 unk_84[0x2]; + /*0x86*/ u16 unk_86; +} PushableFurnitureEntity; + +#endif // PUSHABLEFURNITURE_H diff --git a/include/player.h b/include/player.h index 38e186e5..d22b8968 100644 --- a/include/player.h +++ b/include/player.h @@ -4,6 +4,23 @@ #include "global.h" #include "entity.h" +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ union SplitWord unk_68; + /*0x6c*/ u8 unk_6c; + /*0x6d*/ u8 unk_6d; + /*0x6e*/ u8 unk_6e; + /*0x6f*/ u8 unk_6f; + /*0x70*/ Entity* unk_70; + /*0x74*/ Entity* unk_74; + /*0x78*/ u8 unk_78; + /*0x79*/ u8 unk_79; + /*0x7a*/ u16 unk_7a; + /*0x7c*/ union SplitWord unk_7c; + /*0x80*/ union SplitWord unk_80; + /*0x84*/ union SplitWord unk_84; +} PlayerEntity; + enum PlayerActions { PLAYER_INIT, PLAYER_NORMAL, @@ -585,9 +602,9 @@ extern const u8 gQuiverSizes[]; extern Entity* gPlayerClones[]; extern PlayerState gPlayerState; -extern Entity gPlayerEntity; +extern PlayerEntity gPlayerEntity; -void DoPlayerAction(Entity*); +void DoPlayerAction(PlayerEntity*); bool32 CheckInitPauseMenu(void); void SetPlayerControl(PlayerControlMode mode); void ResetActiveItems(void); diff --git a/include/playerItem/playerItemBottle.h b/include/playerItem/playerItemBottle.h new file mode 100644 index 00000000..9055ee2f --- /dev/null +++ b/include/playerItem/playerItemBottle.h @@ -0,0 +1,13 @@ +#ifndef PLAYERITEMBOTTLE_H +#define PLAYERITEMBOTTLE_H + +#include "entity.h" + +typedef struct { + /*0x00*/ Entity base; + /*0x68*/ u8 bottleIndex; /**< @see Item */ + /*0x69*/ u8 unused[6]; + /*0x6f*/ u8 bottleContent; /**< @see Item */ +} PlayerItemBottleEntity; + +#endif // PLAYERITEMBOTTLE_H diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index 6568047b..869294c5 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -1,4 +1,3 @@ -#define ENT_DEPRECATED #include "beanstalkSubtask.h" #include "backgroundAnimations.h" @@ -174,7 +173,7 @@ u32 UpdatePlayerCollision(void) { s32 framestate; u32 tmp2; u32 tmp3; - // There are some weird assignment necessary to access gPlayerEntity.animationState correctly. + // There are some weird assignment necessary to access gPlayerEntity.base.animationState correctly. u32 animationState1; u32 animationState2; u32 animationState3; @@ -194,40 +193,40 @@ u32 UpdatePlayerCollision(void) { return 0; } - if (gPlayerState.dash_state != 0 || gPlayerEntity.action == PLAYER_CLIMB) { - direction = gPlayerEntity.direction; + if (gPlayerState.dash_state != 0 || gPlayerEntity.base.action == PLAYER_CLIMB) { + direction = gPlayerEntity.base.direction; } else { direction = gPlayerState.direction; } if (((direction & (DIR_NOT_MOVING_CHECK | 0x3)) == 0) && (gPlayerState.field_0xa == 0)) { - index = sub_0807BDB8(&gPlayerEntity, direction >> 2); + index = sub_0807BDB8(&gPlayerEntity.base, direction >> 2); if (index != 0xff && (gRoomControls.scroll_flags & 4) == 0) { ptr1 = &gUnk_080B4490[index * 2]; - if (sub_080B1B44(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr1[0], -ptr1[1]), gPlayerEntity.collisionLayer) == - 0xff) { + if (sub_080B1B44(COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr1[0], -ptr1[1]), + gPlayerEntity.base.collisionLayer) == 0xff) { if ((((gPlayerState.flags & (PL_FLAGS10000 | PL_FLAGS2)) != 0) || ((gPlayerState.sword_state & 0x10) != 0)) || - ((sub_080806BC(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x, - gPlayerEntity.y.HALF.HI - gRoomControls.origin_y, index, 5) == 0 && + ((sub_080806BC(gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x, + gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y, index, 5) == 0 && (((gPlayerState.heldObject != 0 || ((gPlayerState.field_0x1c & 0xf) != 0)) || - (sub_0807BD14(&gPlayerEntity, index) == 0)))))) { + (sub_0807BD14(&gPlayerEntity.base, index) == 0)))))) { return 3; } - gPlayerEntity.direction = (index << 3); + gPlayerEntity.base.direction = (index << 3); return 0xf; } } } - layer = GetLayerByIndex(gPlayerEntity.collisionLayer); - ptr1 = &gUnk_080B4468[gPlayerEntity.animationState & 6]; - position = COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr1[0], -ptr1[1]); - tileType = GetTileType(position, gPlayerEntity.collisionLayer); + layer = GetLayerByIndex(gPlayerEntity.base.collisionLayer); + ptr1 = &gUnk_080B4468[gPlayerEntity.base.animationState & 6]; + position = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr1[0], -ptr1[1]); + tileType = GetTileType(position, gPlayerEntity.base.collisionLayer); if (tileType < 0x4000) { direction = sub_080B1B54(tileType); } else { direction = tileType; } - animationState1 = gPlayerEntity.animationState; + animationState1 = gPlayerEntity.base.animationState; animationState2 = animationState1 & 0xff; switch (direction) { @@ -235,7 +234,7 @@ u32 UpdatePlayerCollision(void) { if (sub_0801A458(layer, position, 2) == 0) { return 0; } - layer->mapData[position] = 0x4001 + (gPlayerEntity.animationState >> 1); + layer->mapData[position] = 0x4001 + (gPlayerEntity.base.animationState >> 1); if ((gPlayerState.flags & PL_MINISH) != 0) { gPlayerState.pushedObject = 0xc0; } else { @@ -243,42 +242,42 @@ u32 UpdatePlayerCollision(void) { } gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); return 1; case 0x28: if ((gPlayerState.flags & PL_MINISH) != 0) { return 0; } - gPlayerEntity.action = gPlayerEntity.action; + gPlayerEntity.base.action = gPlayerEntity.base.action; if (gPlayerState.field_0xa != 0) { return 0; } - if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != + if ((Direction8FromAnimationState(gPlayerEntity.base.animationState)) - gPlayerState.direction != DirectionNorth) { return 0; } - if ((gPlayerEntity.direction & DIR_NOT_MOVING_CHECK) != 0) { + if ((gPlayerEntity.base.direction & DIR_NOT_MOVING_CHECK) != 0) { return 0; } - if (sub_080B1B44(position, gPlayerEntity.collisionLayer) != 0xf) { + if (sub_080B1B44(position, gPlayerEntity.base.collisionLayer) != 0xf) { return 0; } if (sub_08079778() == 0) { return 0; } - ptr1 = &gUnk_080B4478[gPlayerEntity.animationState & 6]; - transition = sub_08080734((gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) + ptr1[0], - (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) + ptr1[1]); + ptr1 = &gUnk_080B4478[gPlayerEntity.base.animationState & 6]; + transition = sub_08080734((gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x) + ptr1[0], + (gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) + ptr1[1]); if (transition == NULL) { return 0; } - if ((gPlayerEntity.animationState & 2) != 0) { - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + transition->startY + 6; + if ((gPlayerEntity.base.animationState & 2) != 0) { + gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + transition->startY + 6; } else { - gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + transition->startX; + gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + transition->startX; } sub_08078AC0(4, 0, 1); return 0; @@ -286,18 +285,18 @@ u32 UpdatePlayerCollision(void) { if (sub_0801A2B0(layer, position, 0xb) == 0) { return 0; } - layer->mapData[position] = 0x401c + (gPlayerEntity.animationState >> 1); + layer->mapData[position] = 0x401c + (gPlayerEntity.base.animationState >> 1); gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); - gPlayerEntity.type = 1; + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); + gPlayerEntity.base.type = 1; return 1; case 0x70: if ((gPlayerState.field_0x35 & 0x80) == 0) { - if ((gPlayerEntity.frame & 1) != 0) { + if ((gPlayerEntity.base.frame & 1) != 0) { if (sub_0801A9F0(gPlayerState.field_0x35 << 2, tileType, position) != 0) { return 1; } @@ -310,7 +309,7 @@ u32 UpdatePlayerCollision(void) { if (gPlayerState.flags & PL_MINISH) { return 0; } - if (gPlayerEntity.animationState != IdleNorth) { + if (gPlayerEntity.base.animationState != IdleNorth) { return 0; } gUnk_0200AF00.rActionInteractTile = R_ACTION_READ; @@ -318,7 +317,7 @@ u32 UpdatePlayerCollision(void) { return 0; } gPlayerState.mobility = 1; - sub_080A7CFC(position, gPlayerEntity.collisionLayer); + sub_080A7CFC(position, gPlayerEntity.base.collisionLayer); return 1; case 0x1a: if ((animationState1 & 0xff) != 0) { @@ -332,7 +331,7 @@ u32 UpdatePlayerCollision(void) { return 0; } gPlayerState.mobility = 1; - OpenSmallChest(position, gPlayerEntity.collisionLayer); + OpenSmallChest(position, gPlayerEntity.base.collisionLayer); return 2; case 0x71: if (HasDungeonSmallKey() == 0) { @@ -343,7 +342,7 @@ u32 UpdatePlayerCollision(void) { return 0; } gPlayerState.mobility = 1; - sub_0804B388(position, gPlayerEntity.collisionLayer); + sub_0804B388(position, gPlayerEntity.base.collisionLayer); return 2; case 0x3d: case 0x4040 ... 0x4048: @@ -358,61 +357,61 @@ u32 UpdatePlayerCollision(void) { return 0; } #endif - if ((Direction8FromAnimationState(gPlayerEntity.animationState)) - gPlayerState.direction != + if ((Direction8FromAnimationState(gPlayerEntity.base.animationState)) - gPlayerState.direction != DirectionNorth) { return 0; } - if ((gPlayerEntity.direction & 0x80) != 0) { + if ((gPlayerEntity.base.direction & 0x80) != 0) { return 0; } - if (gPlayerEntity.subtimer < 6) { + if (gPlayerEntity.base.subtimer < 6) { return 0; } gPlayerState.jump_status = 0x81; gPlayerState.flags |= PL_USE_PORTAL; gPlayerState.queued_action = PLAYER_USEPORTAL; - gPlayerEntity.zVelocity = 0x20000; - COLLISION_OFF(&gPlayerEntity); + gPlayerEntity.base.zVelocity = 0x20000; + COLLISION_OFF(&gPlayerEntity.base); return 1; case 0x400b: if (sub_0801A2B0(layer, position, 8) == 0) { return 0; } - if ((gPlayerEntity.collisionLayer == 3) && (gMapTop.mapData[position] == 0x400b)) { - gMapTop.mapData[position] = 0x400c + (gPlayerEntity.animationState >> 1); + if ((gPlayerEntity.base.collisionLayer == 3) && (gMapTop.mapData[position] == 0x400b)) { + gMapTop.mapData[position] = 0x400c + (gPlayerEntity.base.animationState >> 1); } else { - layer->mapData[position] = 0x400c + (gPlayerEntity.animationState >> 1); + layer->mapData[position] = 0x400c + (gPlayerEntity.base.animationState >> 1); } gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); return 1; case 0x405a: if (sub_0801A2B0(layer, position, 2) == 0) { return 0; } - layer->mapData[position] = 0x405b + (gPlayerEntity.animationState >> 1); + layer->mapData[position] = 0x405b + (gPlayerEntity.base.animationState >> 1); gPlayerState.pushedObject = 0x98; gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); return 1; case 0x4036: if (sub_0801A2B0(layer, position, 0xb) == 0) { return 0; } - layer->mapData[position] = 0x4037 + (gPlayerEntity.animationState >> 1); + layer->mapData[position] = 0x4037 + (gPlayerEntity.base.animationState >> 1); gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); return 1; case 0x403e: if ((animationState1 & 0xff) != 0) { @@ -421,25 +420,25 @@ u32 UpdatePlayerCollision(void) { if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return 0; } - if ((gPlayerEntity.frame & 2) == 0) { + if ((gPlayerEntity.base.frame & 2) == 0) { return 0; } layer->mapData[position] = 0x403f; gPlayerState.pushedObject = 0x82; gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); return 1; case 0x72: if ((gPlayerState.field_0x35 & 0x80) != 0) { return 0; } - if ((gPlayerEntity.frame & 1) == 0) { + if ((gPlayerEntity.base.frame & 1) == 0) { return 0; } - position = sub_0801A570(&gPlayerEntity, 1); + position = sub_0801A570(&gPlayerEntity.base, 1); if (position == 0xffff) { return 0; } @@ -449,7 +448,7 @@ u32 UpdatePlayerCollision(void) { index = 0; tmp3 = 0; while (index < 3) { - if ((((*(u32*)(&(gPlayerClones[0])->field_0x6c)) & (1 << index)) != 0) && + if ((((*(u32*)(&(((GenericEntity*)gPlayerClones[0]))->field_0x6c)) & (1 << index)) != 0) && (sub_0801A570(gPlayerClones[index], 0) == position)) { tmp3++; } @@ -462,20 +461,20 @@ u32 UpdatePlayerCollision(void) { if (pushedBlock == NULL) { return 0; } - pushedBlock->direction = Direction8FromAnimationState(gPlayerEntity.animationState); + pushedBlock->direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); pushedBlock->x.HALF.HI = ((position & 0xfff & 0x3f) << 4) + 8 + gRoomControls.origin_x; pushedBlock->y.HALF.HI = ((position & 0xfc0) >> 2) + 8 + gRoomControls.origin_y; - pushedBlock->collisionLayer = gPlayerEntity.collisionLayer; + pushedBlock->collisionLayer = gPlayerEntity.base.collisionLayer; gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = pushedBlock->direction; + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = pushedBlock->direction; return 1; case 0x402b ... 0x402d: if (sub_0801A370(layer, position) != 0) { - layer->mapData[position] = 0x4030 + ((gPlayerEntity.animationState & 4) >> 2); + layer->mapData[position] = 0x4030 + ((gPlayerEntity.base.animationState & 4) >> 2); if ((gPlayerState.flags & PL_MINISH) != 0) { gPlayerState.pushedObject = 0xa0; } else { @@ -483,9 +482,9 @@ u32 UpdatePlayerCollision(void) { } gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); return 1; } else { return 0; @@ -494,7 +493,7 @@ u32 UpdatePlayerCollision(void) { if (sub_0801A458(layer, position, 8) == 0) { return 0; } - layer->mapData[position] = 0x404b + (gPlayerEntity.animationState >> 1); + layer->mapData[position] = 0x404b + (gPlayerEntity.base.animationState >> 1); if ((gPlayerState.flags & PL_MINISH) != 0) { gPlayerState.pushedObject = 0xc0; } else { @@ -502,21 +501,21 @@ u32 UpdatePlayerCollision(void) { } gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); return 1; case 0x4052: if (gPlayerState.field_0x35 != 0) { return 0; } - SetTile(0x4054, position, gPlayerEntity.collisionLayer); + SetTile(0x4054, position, gPlayerEntity.base.collisionLayer); return 4; case 0x4053: if (gPlayerState.field_0x35 != 6) { return 0; } - SetTile(0x4054, position, gPlayerEntity.collisionLayer); + SetTile(0x4054, position, gPlayerEntity.base.collisionLayer); return 4; case 0x4055: position--; @@ -525,12 +524,12 @@ u32 UpdatePlayerCollision(void) { if (gPlayerState.field_0x35 != 0) { return 0; } - if ((gPlayerEntity.y.HALF.HI & 0xf) < 10) { + if ((gPlayerEntity.base.y.HALF.HI & 0xf) < 10) { return 0; } for (index = 0; index < 3; index++) { if (sub_0801A8D0(gPlayerClones[index], 0) == position) { - SetTile(0x4059, position, gPlayerEntity.collisionLayer); + SetTile(0x4059, position, gPlayerEntity.base.collisionLayer); return 4; } } @@ -542,12 +541,12 @@ u32 UpdatePlayerCollision(void) { if (gPlayerState.field_0x35 != 6) { return 0; } - if ((gPlayerEntity.x.HALF.HI & 0xf) < 10) { + if ((gPlayerEntity.base.x.HALF.HI & 0xf) < 10) { return 0; } for (index = 0; index < 3; index++) { if (sub_0801A8D0(gPlayerClones[index], 6) == position) { - SetTile(0x4059, position, gPlayerEntity.collisionLayer); + SetTile(0x4059, position, gPlayerEntity.base.collisionLayer); return 4; } } @@ -561,30 +560,30 @@ u32 UpdatePlayerCollision(void) { if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return 0; } - if ((gPlayerEntity.frame & 1) == 0) { + if ((gPlayerEntity.base.frame & 1) == 0) { return 0; } - SetTile(0x4074, position, gPlayerEntity.collisionLayer); + SetTile(0x4074, position, gPlayerEntity.base.collisionLayer); gPlayerState.pushedObject = 0xa0; gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); return 1; case 0x407d: - animationState3 = gPlayerEntity.animationState; + animationState3 = gPlayerEntity.base.animationState; if ((animationState2) != 4) { return 0; } if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return 0; } - if ((gPlayerEntity.frame & 1) == 0) { + if ((gPlayerEntity.base.frame & 1) == 0) { return 0; } - SetTile(0x4074, position, gPlayerEntity.collisionLayer); - sub_080001D0(0xd, position, gPlayerEntity.collisionLayer); + SetTile(0x4074, position, gPlayerEntity.base.collisionLayer); + sub_080001D0(0xd, position, gPlayerEntity.base.collisionLayer); return 1; default: return 0; @@ -597,11 +596,11 @@ bool32 sub_0801A2B0(LayerStruct* layer, u32 position, u32 collisionType) { s16 y; u16 temp4; - uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1]; + uVar1 = gUnk_080B4488[gPlayerEntity.base.animationState >> 1]; if ((((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) == 0) && - ((gPlayerEntity.frame & 1) != 0)) { + ((gPlayerEntity.base.frame & 1) != 0)) { position = (u16)(position - (-uVar1)); // necessary for match - temp4 = sub_080B1B54(GetTileType(position, gPlayerEntity.collisionLayer)); + temp4 = sub_080B1B54(GetTileType(position, gPlayerEntity.base.collisionLayer)); switch (temp4) { case 0x52: break; @@ -633,16 +632,16 @@ bool32 sub_0801A370(LayerStruct* layer, u32 position) { s32 offset; s32 temp; - if ((gPlayerEntity.animationState & 2) == 0) { + if ((gPlayerEntity.base.animationState & 2) == 0) { return FALSE; } if (!sub_0801A4F8()) { return FALSE; } topLayer = GetLayerByIndex(2); - offset = gUnk_080B4488[gPlayerEntity.animationState >> 1]; + offset = gUnk_080B4488[gPlayerEntity.base.animationState >> 1]; pos = position + offset; - tileType = GetTileType(pos, gPlayerEntity.collisionLayer); + tileType = GetTileType(pos, gPlayerEntity.base.collisionLayer); switch (tileType) { case 0x402b: pos += offset; @@ -653,7 +652,7 @@ bool32 sub_0801A370(LayerStruct* layer, u32 position) { if (topLayer->collisionData[pos - 0x80] == 0x46) { return FALSE; } - switch ((u16)sub_080B1B54(GetTileType(pos, gPlayerEntity.collisionLayer))) { + switch ((u16)sub_080B1B54(GetTileType(pos, gPlayerEntity.base.collisionLayer))) { case 0x52: return FALSE; case 0x26: @@ -686,10 +685,10 @@ bool32 sub_0801A370(LayerStruct* layer, u32 position) { bool32 sub_0801A458(LayerStruct* layer, u32 position, u32 collisionType) { u32 tileType; u32 pos; - s32 offset = gUnk_080B4488[gPlayerEntity.animationState >> 1]; + s32 offset = gUnk_080B4488[gPlayerEntity.base.animationState >> 1]; if (sub_0801A4F8()) { pos = position + offset; - tileType = GetTileType(pos, gPlayerEntity.collisionLayer); + tileType = GetTileType(pos, gPlayerEntity.base.collisionLayer); switch (sub_080B1B54(tileType)) { case 0x52: case 0x26: @@ -719,18 +718,18 @@ bool32 sub_0801A4F8(void) { if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) { return FALSE; } - if (gPlayerState.direction != gPlayerEntity.direction) { + if (gPlayerState.direction != gPlayerEntity.base.direction) { return FALSE; } - tmp = (((gPlayerEntity.direction + 4) & DirectionWest) >> 3); - if ((gUnk_080B44A0[tmp] & gPlayerEntity.collisions) == 0) { + tmp = (((gPlayerEntity.base.direction + 4) & DirectionWest) >> 3); + if ((gUnk_080B44A0[tmp] & gPlayerEntity.base.collisions) == 0) { return FALSE; } } else { if (((gPlayerState.field_0x35 | gPlayerState.direction) & DIR_NOT_MOVING_CHECK) != 0) { return FALSE; } - if ((gPlayerEntity.frame & 1) == 0) { + if ((gPlayerEntity.base.frame & 1) == 0) { return FALSE; } } @@ -931,9 +930,10 @@ u32 sub_0801A8D0(Entity* this, u32 param_2) { bool32 sub_0801A980(void) { u16 tileType; const s16* ptr; - GetLayerByIndex(gPlayerEntity.collisionLayer); - ptr = &gUnk_080B44A8[gPlayerEntity.animationState & 6]; - tileType = GetTileType(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]), gPlayerEntity.collisionLayer); + GetLayerByIndex(gPlayerEntity.base.collisionLayer); + ptr = &gUnk_080B44A8[gPlayerEntity.base.animationState & 6]; + tileType = + GetTileType(COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], -ptr[1]), gPlayerEntity.base.collisionLayer); if (tileType < 0x4000) { sub_080B1B54(tileType); } @@ -971,7 +971,7 @@ bool32 sub_0801A9F0(u32 param_1, u32 param_2, u32 param_3) { } if (cond) { - return sub_0801AA58(&gPlayerEntity, param_3, param_1); + return sub_0801AA58(&gPlayerEntity.base, param_3, param_1); } return FALSE; diff --git a/src/code_08049DF4.c b/src/code_08049DF4.c index 723626eb..e9794e59 100644 --- a/src/code_08049DF4.c +++ b/src/code_08049DF4.c @@ -24,8 +24,8 @@ Entity* sub_08049E18(void) { !(gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN | PL_IN_MINECART | PL_PIT_IS_EXIT | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_CONVEYOR_PUSHED | PL_CLIMBING))) { - gUnk_020000B0 = &gPlayerEntity; - return &gPlayerEntity; + gUnk_020000B0 = &gPlayerEntity.base; + return &gPlayerEntity.base; } return NULL; } @@ -35,8 +35,8 @@ Entity* sub_08049E4C(void) { !(gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_MINISH | PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN | PL_IN_MINECART | PL_PIT_IS_EXIT | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_CONVEYOR_PUSHED | PL_CLIMBING))) { - gUnk_020000B0 = &gPlayerEntity; - return &gPlayerEntity; + gUnk_020000B0 = &gPlayerEntity.base; + return &gPlayerEntity.base; } return NULL; } @@ -45,15 +45,15 @@ Entity* sub_08049E80(void) { if ((gPlayerState.field_0x3c != 0) || !(gPlayerState.flags & PL_MINISH)) { return NULL; } - gUnk_020000B0 = &gPlayerEntity; - return &gPlayerEntity; + gUnk_020000B0 = &gPlayerEntity.base; + return &gPlayerEntity.base; } Entity* sub_08049EB0(void) { if ((gPlayerState.field_0x3c == 0) && !(gPlayerState.flags & (PL_MOLDWORM_CAPTURED | PL_DISABLE_ITEMS | PL_MINISH | PL_CAPTURED))) { - gUnk_020000B0 = &gPlayerEntity; - return &gPlayerEntity; + gUnk_020000B0 = &gPlayerEntity.base; + return &gPlayerEntity.base; } return NULL; } diff --git a/src/collision.c b/src/collision.c index c3630276..ea0d5db9 100644 --- a/src/collision.c +++ b/src/collision.c @@ -1,4 +1,3 @@ -#define ENT_DEPRECATED #include "asm.h" #include "collision.h" #include "common.h" @@ -75,10 +74,10 @@ void CollisionMain(void) { doCollision = &ram_CollideAll; // Check to see if we should disable collision this frame if (gPlayerState.controlMode != CONTROL_ENABLED) { - u32 flags = gPlayerEntity.flags; - COLLISION_OFF(&gPlayerEntity); + u32 flags = gPlayerEntity.base.flags; + COLLISION_OFF(&gPlayerEntity.base); doCollision(); - gPlayerEntity.flags = flags; // reset collision to before + gPlayerEntity.base.flags = flags; // reset collision to before } else { doCollision(); } @@ -89,7 +88,7 @@ void RegisterPlayerHitbox(void) { gUnk_02018EA0 = (LinkedList2*)&gUnk_03003C70[0].last; gUnk_03003C70[0].last = &gUnk_03003C70[0].last; gUnk_03003C70[0].first = &gUnk_03003C70[0].last; - gUnk_03003C70[0].node = &gPlayerEntity; + gUnk_03003C70[0].node = &gPlayerEntity.base; } u32 sub_0801766C(Entity* this) { @@ -212,7 +211,7 @@ bool32 IsColliding(Entity* this, Entity* that) { bool32 IsCollidingPlayer(Entity* this) { if (PlayerCanBeMoved()) - return IsColliding(this, &gPlayerEntity); + return IsColliding(this, &gPlayerEntity.base); return FALSE; } @@ -248,7 +247,7 @@ s32 CalculateDamage(Entity* org, Entity* tgt) { } health = org->health - damage; if (org->kind == ENEMY) { - if ((org->field_0x6c.HALF.HI & 1) != 0) + if ((((GenericEntity*)org)->field_0x6c.HALF.HI & 1) != 0) SoundReqClipped(org, SFX_BOSS_HIT); else SoundReqClipped(org, SFX_HIT); @@ -277,8 +276,8 @@ void sub_08017940(Entity* org, Entity* tgt) { r1 = 0; - r1 = (u32)(org == &gPlayerEntity ? gPlayerEntity.knockbackDuration - : (tgt == &gPlayerEntity ? tgt->knockbackDuration : 0)) >> + r1 = (u32)(org == &gPlayerEntity.base ? gPlayerEntity.base.knockbackDuration + : (tgt == &gPlayerEntity.base ? tgt->knockbackDuration : 0)) >> 3; // Anything requiring the evaluation of r1 could be written here. @@ -464,7 +463,7 @@ CollisionResult sub_08017CBC(Entity* org, Entity* tgt, u32 direction, ColSetting CollisionResult sub_08017D28(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { gPlayerState.mobility = 1; - org->field_0x7a.HWORD = 600; + ((GenericEntity*)org)->field_0x7a.HWORD = 600; org->knockbackDuration = 12; org->iframes = 16; org->knockbackSpeed = 640; @@ -484,7 +483,7 @@ CollisionResult sub_08017D6C(Entity* org, Entity* tgt, u32 direction, ColSetting y = 0xac2; } else { tgt->contactFlags = 0xcb; - tgt->field_0x78.HALF.HI = org->hurtType; + ((GenericEntity*)tgt)->field_0x78.HALF.HI = org->hurtType; x = org->hurtType; y = 0xae4; } @@ -498,17 +497,17 @@ CollisionResult sub_08017DD4(Entity* org, Entity* tgt, u32 direction, ColSetting tgt->damage &= ~0x80; else tgt->damage = 4; - gPlayerEntity.health = CalculateDamage(&gPlayerEntity, tgt); + gPlayerEntity.base.health = CalculateDamage(&gPlayerEntity.base, tgt); tgt->iframes = -12; if ((gPlayerState.flags & PL_MINISH) == 0) { sub_08079D84(); org->iframes = 90; } else { - gPlayerEntity.contactFlags = tgt->hurtType | 0x80; - gPlayerEntity.iframes = 12; - gPlayerEntity.knockbackDuration = 16; - gPlayerEntity.knockbackDirection = DirectionTurnAround(direction); - gPlayerEntity.knockbackSpeed = 640; + gPlayerEntity.base.contactFlags = tgt->hurtType | 0x80; + gPlayerEntity.base.iframes = 12; + gPlayerEntity.base.knockbackDuration = 16; + gPlayerEntity.base.knockbackDirection = DirectionTurnAround(direction); + gPlayerEntity.base.knockbackSpeed = 640; } if (tgt->iframes == 0) tgt->iframes = -1; @@ -526,19 +525,19 @@ CollisionResult sub_08017E88(Entity* org, Entity* tgt, u32 direction, ColSetting CollisionResult sub_08017EB0(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if (tgt->damage == 0) return RESULT_NO_COLLISION; - if (org == &gPlayerEntity) { + if (org == &gPlayerEntity.base) { u32 prevDamage = tgt->damage; tgt->damage = 8; - gPlayerEntity.health = CalculateDamage(&gPlayerEntity, tgt); + gPlayerEntity.base.health = CalculateDamage(&gPlayerEntity.base, tgt); tgt->damage = prevDamage; - gPlayerEntity.knockbackDuration = 12; - gPlayerEntity.iframes = 16; - gPlayerEntity.knockbackSpeed = 384; + gPlayerEntity.base.knockbackDuration = 12; + gPlayerEntity.base.iframes = 16; + gPlayerEntity.base.knockbackSpeed = 384; } else if (org->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) { org->knockbackDuration = 8; org->iframes = -6; org->knockbackSpeed = 384; - gPlayerEntity.iframes = 0x80; + gPlayerEntity.base.iframes = 0x80; } if (tgt->iframes == 0) tgt->iframes = -1; @@ -551,7 +550,7 @@ CollisionResult sub_08017F3C(Entity* org, Entity* tgt, u32 direction, ColSetting CollisionResult sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if (tgt->confusedTime == 0) { - if (org == &gPlayerEntity) { + if (org == &gPlayerEntity.base) { if (PlayerCanBeMoved() && #ifdef EU (gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 && @@ -580,7 +579,7 @@ CollisionResult sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSetting } else { org->health = 0; } - } else if (tgt->kind == ENEMY && org == &gPlayerEntity) { + } else if (tgt->kind == ENEMY && org == &gPlayerEntity.base) { sub_08004484(tgt, org); } return RESULT_NO_COLLISION; @@ -647,7 +646,7 @@ CollisionResult sub_080180E8(Entity* org, Entity* tgt, u32 direction, ColSetting CollisionResult sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { if (tgt->confusedTime == 0) { - if (org == &gPlayerEntity) { + if (org == &gPlayerEntity.base) { if (PlayerCanBeMoved() && #ifdef EU (gPlayerState.flags & (PL_MINISH | PL_BUSY)) == 0 && @@ -659,10 +658,10 @@ CollisionResult sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSetting gPlayerState.field_0xa |= 0x80; gPlayerState.flags |= PL_DISABLE_ITEMS; gPlayerState.jump_status = 0; - COLLISION_OFF(&gPlayerEntity); - gPlayerEntity.spriteRendering.b3 = tgt->spriteRendering.b3; - gPlayerEntity.spriteOrientation.flipY = tgt->spriteOrientation.flipY; - gPlayerEntity.iframes = 0xff; + COLLISION_OFF(&gPlayerEntity.base); + gPlayerEntity.base.spriteRendering.b3 = tgt->spriteRendering.b3; + gPlayerEntity.base.spriteOrientation.flipY = tgt->spriteOrientation.flipY; + gPlayerEntity.base.iframes = 0xff; tgt->iframes = -8; PutAwayItems(); return RESULT_COLLISION; @@ -670,14 +669,14 @@ CollisionResult sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSetting } else { org->health = 0; } - } else if ((tgt->kind == ENEMY) && (org == &gPlayerEntity)) { - sub_08004484(tgt, &gPlayerEntity); + } else if ((tgt->kind == ENEMY) && (org == &gPlayerEntity.base)) { + sub_08004484(tgt, &gPlayerEntity.base); } return RESULT_NO_COLLISION; } CollisionResult sub_08018228(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { - if (org == &gPlayerEntity && PlayerCanBeMoved()) + if (org == &gPlayerEntity.base && PlayerCanBeMoved()) sub_08004484(tgt, org); return RESULT_NO_COLLISION; } @@ -694,7 +693,7 @@ CollisionResult sub_08018250(Entity* org, Entity* tgt, u32 direction, ColSetting } CollisionResult CollisionMazaalShrinkRay(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { - if (org == &gPlayerEntity) + if (org == &gPlayerEntity.base) PlayerShrinkByRay(); else org->health = 0; @@ -716,12 +715,12 @@ CollisionResult sub_080182A8(Entity* org, Entity* tgt, u32 direction, ColSetting CollisionResult CollisionDefault(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) { u32 confused = 0; - if (tgt->confusedTime && tgt->kind == ENEMY && org == &gPlayerEntity) { + if (tgt->confusedTime && tgt->kind == ENEMY && org == &gPlayerEntity.base) { sub_08004484(tgt, org); confused = 1; } if ((org->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) && - gPlayerEntity.animationState == + gPlayerEntity.base.animationState == AnimationStateFlip180(Direction8ToAnimationState(DirectionRoundUp(direction)))) { return RESULT_NO_COLLISION; } @@ -780,11 +779,11 @@ CollisionResult CollisionDefault(Entity* org, Entity* tgt, u32 direction, ColSet SoundReqClipped(tgt, SFX_HIT); } } else if (org->id == PL_ITEM_SHIELD) { - gPlayerEntity.iframes = 0x80; + gPlayerEntity.base.iframes = 0x80; } } if (tgt->kind == PLAYER_ITEM && org->id == PL_ITEM_SHIELD) { - gPlayerEntity.iframes = 0x80; + gPlayerEntity.base.iframes = 0x80; } return RESULT_COLLISION; } diff --git a/src/enemy/armos.c b/src/enemy/armos.c index d03a3089..b0a28dbb 100644 --- a/src/enemy/armos.c +++ b/src/enemy/armos.c @@ -60,8 +60,8 @@ void sub_080300C4(void) { void sub_080300E8(void) { if (gRoomTransition.armos_data.field_0xae != 0xff) { const u16* ptr = &gRoomTransition.armos_data.data[gRoomTransition.armos_data.field_0xae * 2]; - gPlayerEntity.x.HALF.HI = ptr[0]; - gPlayerEntity.y.HALF.HI = ptr[1] + 0xc; + gPlayerEntity.base.x.HALF.HI = ptr[0]; + gPlayerEntity.base.y.HALF.HI = ptr[1] + 0xc; gRoomTransition.armos_data.field_0xae = 0xff; } } @@ -92,7 +92,7 @@ void sub_080301BC(ArmosEntity* this) { } void sub_080301D4(ArmosEntity* this) { - if ((super->action == 1) && (super->contactedEntity == &gPlayerEntity)) { + if ((super->action == 1) && (super->contactedEntity == &gPlayerEntity.base)) { super->iframes = -0x1e; } if ((super->health != 0) && (super->health != this->unk_81)) { @@ -429,7 +429,7 @@ bool32 sub_0803086C(ArmosEntity* this) { if (GetTileType(pos, super->collisionLayer) == 0x4049) { if (CheckPlayerInRegion(centerX, centerY, 2, 0xc) != 0) { if (CheckPlayerInRegion(centerX, centerY - 4, 2, 4) != 0) { - gPlayerEntity.spritePriority.b0 = 3; + gPlayerEntity.base.spritePriority.b0 = 3; DoExitTransition(this->unk_7c); gRoomTransition.armos_data.field_0xae = this->unk_80; return TRUE; diff --git a/src/enemy/beetle.c b/src/enemy/beetle.c index b1dbd739..6b83d6dc 100644 --- a/src/enemy/beetle.c +++ b/src/enemy/beetle.c @@ -44,7 +44,7 @@ void Beetle_OnCollision(BeetleEntity* this) { super->subtimer = 0; COLLISION_OFF(super); super->spritePriority.b0 = 3; - CopyPositionAndSpriteOffset(&gPlayerEntity, super); + CopyPositionAndSpriteOffset(&gPlayerEntity.base, super); super->z.HALF.HI = -1; this->unk_87 = 1; InitializeAnimation(super, 6); @@ -159,7 +159,7 @@ void sub_08021984(BeetleEntity* this) { void sub_08021A10(BeetleEntity* this) { GetNextFrame(super); - if (EntityInRectRadius(super, &gPlayerEntity, 120, 80) && sub_08021D00(this) == 0) { + if (EntityInRectRadius(super, &gPlayerEntity.base, 120, 80) && sub_08021D00(this) == 0) { if (--super->timer == 0) { super->action = 3; super->timer = (Random() & 0x3f) + 30; @@ -250,17 +250,17 @@ void sub_08021B64(BeetleEntity* this) { super->action = 6; super->zVelocity = Q_16_16(1.0); this->unk_87 = 0; - if (gPlayerEntity.direction != 0xff) { - super->direction = DirectionSouth ^ gPlayerEntity.direction; + if (gPlayerEntity.base.direction != 0xff) { + super->direction = DirectionSouth ^ gPlayerEntity.base.direction; } else { - super->direction = (gPlayerEntity.animationState << 2) ^ DirectionSouth; + super->direction = (gPlayerEntity.base.animationState << 2) ^ DirectionSouth; } InitializeAnimation(super, 5); } else { gPlayerState.mobility |= 0x80; gPlayerState.speed_modifier -= 0x50; gPlayerState.attachedBeetleCount++; - CopyPositionAndSpriteOffset(&gPlayerEntity, super); + CopyPositionAndSpriteOffset(&gPlayerEntity.base, super); super->x.HALF.HI += gUnk_080CB5E4[(super->subtimer++ & 0xe) >> 1]; super->z.HALF.HI--; GetNextFrame(super); diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index b232c780..5c15c015 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -44,7 +44,7 @@ void Bobomb_OnCollision(BobombEntity* this) { case 1: if (this->unk_82) { super->knockbackDuration = 0; - gPlayerEntity.knockbackDuration = 4; + gPlayerEntity.base.knockbackDuration = 4; } return; case 0xe: @@ -114,7 +114,7 @@ void sub_0802C83C(BobombEntity* this) { if (this->unk_82) { if (--super->timer == 0) { super->action = 3; - switch (gPlayerEntity.animationState & 6) { + switch (gPlayerEntity.base.animationState & 6) { case 2: super->x.HALF.HI -= 6; break; @@ -218,7 +218,7 @@ void sub_0802CA10(BobombEntity* this) { } } else { this->unk_83 = 2; - super->direction = (((gPlayerEntity.animationState) << 2) | IdleSouth) & (DIR_DIAGONAL | DirectionWest); + super->direction = (((gPlayerEntity.base.animationState) << 2) | IdleSouth) & (DIR_DIAGONAL | DirectionWest); sub_0802CC18(this); GetNextFrame(super); } @@ -242,7 +242,7 @@ void sub_0802CA94(BobombEntity* this) { super->speed = 0; this->unk_83 = 0; this->unk_81 = 0; - super->direction = ((gPlayerEntity.animationState << 2) | IdleSouth) & (DirectionWest | DIR_DIAGONAL); + super->direction = ((gPlayerEntity.base.animationState << 2) | IdleSouth) & (DirectionWest | DIR_DIAGONAL); InitializeAnimation(super, (super->direction >> 4) | IdleWest); } diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index 02871212..d0fd3a22 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -213,7 +213,7 @@ void sub_0802AAC0(BombPeahatEntity* this) { #ifdef EU } else if (entity->timer == 0) { if (sub_080B1B44(COORD_TO_TILE(super), 1) == 0) { - if (EntityInRectRadius(super, &gPlayerEntity, 0x10, 0x10) && entity->subtimer <= 0x50) { + if (EntityInRectRadius(super, &gPlayerEntity.base, 0x10, 0x10) && entity->subtimer <= 0x50) { this->unk_81 = 0; } } else if (entity->subtimer <= 0x13) { diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c index 3a9ac5f5..dde81993 100644 --- a/src/enemy/businessScrub.c +++ b/src/enemy/businessScrub.c @@ -311,7 +311,7 @@ void BusinessScrub_Action5(BusinessScrubEntity* this) { } void BusinessScrub_Action6(BusinessScrubEntity* this) { - if (gPlayerEntity.action == PLAYER_ITEMGET) { + if (gPlayerEntity.base.action == PLAYER_ITEMGET) { if (this->unk_81 == 0) { SetPlayerControl(1); this->unk_81 = 1; diff --git a/src/enemy/chuchuBoss.c b/src/enemy/chuchuBoss.c index 73850077..00488c3c 100644 --- a/src/enemy/chuchuBoss.c +++ b/src/enemy/chuchuBoss.c @@ -464,7 +464,7 @@ void sub_08026090(ChuchuBossEntity* this) { } else { PausePlayer(); if (super->timer-- == 0) { - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; DeleteThisEntity(); } } @@ -540,7 +540,7 @@ void sub_08026110(ChuchuBossEntity* this) { void sub_0802626C(ChuchuBossEntity* this) { gPauseMenuOptions.disabled = 1; gUnk_080CC20C[this->unk_84->unk_03](this); - if (gPlayerEntity.action != PLAYER_ROOMTRANSITION && gPlayerEntity.action != PLAYER_ROOM_EXIT) { + if (gPlayerEntity.base.action != PLAYER_ROOMTRANSITION && gPlayerEntity.base.action != PLAYER_ROOM_EXIT) { PausePlayer(); } } @@ -558,7 +558,7 @@ void sub_080262A8(ChuchuBossEntity* this) { this->unk_7c = 0; this->unk_7d = 0x1e; this->unk_84->unk_03 = 3; - gPlayerEntity.animationState = 0; + gPlayerEntity.base.animationState = 0; gRoomControls.camera_target = super; gRoomControls.scrollSpeed = 1; SetTile(0x4022, 0x2c8, 1); @@ -566,7 +566,7 @@ void sub_080262A8(ChuchuBossEntity* this) { } void sub_08026328(ChuchuBossEntity* this) { - if (gPlayerEntity.action != PLAYER_ROOMTRANSITION) { + if (gPlayerEntity.base.action != PLAYER_ROOMTRANSITION) { this->unk_7d = 0x78; this->unk_84->unk_03++; sub_08078AC0(10, 0, 0); @@ -576,20 +576,20 @@ void sub_08026328(ChuchuBossEntity* this) { void sub_08026358(ChuchuBossEntity* this) { u32 bVar1; - if (gPlayerEntity.action != PLAYER_ROOM_EXIT) { + if (gPlayerEntity.base.action != PLAYER_ROOM_EXIT) { bVar1 = --this->unk_7d; if (bVar1 == 0) { this->unk_7c = 0; this->unk_7d = 0x1e; this->unk_84->unk_03++; - gPlayerEntity.animationState = 0; + gPlayerEntity.base.animationState = 0; gRoomControls.camera_target = super; gRoomControls.scrollSpeed = 1; } else if (bVar1 < 0x61) { if (bVar1 < 0x5c) { - gPlayerEntity.animationState = 4; + gPlayerEntity.base.animationState = 4; } else { - gPlayerEntity.animationState = 2; + gPlayerEntity.base.animationState = 2; } } } @@ -655,7 +655,7 @@ void sub_080264D4(ChuchuBossEntity* this) { void sub_0802650C(ChuchuBossEntity* this) { if (((ChuchuBossEntity*)super->child)->unk_81 == 0) { this->unk_84->unk_03++; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; } sub_08027870(this); } @@ -681,7 +681,7 @@ void sub_08026580(ChuchuBossEntity* this) { super->speed = 0; super->subAction = 2; this->unk_7c = 0x3c; - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); if (this->unk_84->unk_04 == 2) { this->unk_80 = 0x48; this->unk_81 += 16; @@ -731,7 +731,7 @@ void sub_08026634(ChuchuBossEntity* this) { super->speed = 0x180; } else { if ((gRoomTransition.frameCount & 0x7f) == 0) { - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); } if (this->unk_84->unk_04 == 2) { super->speed = 0x100; @@ -793,7 +793,7 @@ void sub_08026808(ChuchuBossEntity* this) { if (pEVar4->unk_78.HALF_U.HI > 0xb0) { pEVar4->unk_78.HALF_U.HI -= 8; } else { - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); super->subAction = 4; pEVar4->unk_78.HALF_U.HI = 0xa0; pEVar5->unk_78.HALF_U.HI = 0xa0; @@ -1201,9 +1201,9 @@ void sub_08027064(ChuchuBossEntity* this) { SoundReq(SFX_PLY_JUMP); } if (this->unk_84->unk_03 != 0) { - if (super->y.HALF.HI != gPlayerEntity.y.HALF.HI) { + if (super->y.HALF.HI != gPlayerEntity.base.y.HALF.HI) { if ((gRoomTransition.frameCount & 0xf) == 0) { - if (super->y.HALF.HI > gPlayerEntity.y.HALF.HI) { + if (super->y.HALF.HI > gPlayerEntity.base.y.HALF.HI) { this->unk_84->unk_0c = 0; } else { this->unk_84->unk_0c = 0x10; @@ -1243,7 +1243,7 @@ void sub_08027064(ChuchuBossEntity* this) { *(char*)((int)pEVar10 + 0x84) = 1; uVar2 = 0; if (this->unk_84->unk_03 > 1) { - if (super->x.HALF.HI > gPlayerEntity.x.HALF.HI) { + if (super->x.HALF.HI > gPlayerEntity.base.x.HALF.HI) { uVar2 = 24; } else { uVar2 = 8; @@ -1785,8 +1785,8 @@ void sub_08027BBC(ChuchuBossEntity* this) { *(u8*)((int)pEVar6 + 0x85) = 1; } super->animationState = super->direction >> 2; - if (super->y.HALF.HI != gPlayerEntity.y.HALF.HI) { - if (super->y.HALF.HI > gPlayerEntity.y.HALF.HI) { + if (super->y.HALF.HI != gPlayerEntity.base.y.HALF.HI) { + if (super->y.HALF.HI > gPlayerEntity.base.y.HALF.HI) { this->unk_84->unk_0c = 0; } else { this->unk_84->unk_0c = 0x10; diff --git a/src/enemy/cuccoAggr.c b/src/enemy/cuccoAggr.c index 9a07ea9e..03a158ea 100644 --- a/src/enemy/cuccoAggr.c +++ b/src/enemy/cuccoAggr.c @@ -173,7 +173,7 @@ void sub_08038F20(CuccoAggrEntity* this) { } void sub_08038F44(CuccoAggrEntity* this) { - super->direction = GetFacingDirection(&gPlayerEntity, super); + super->direction = GetFacingDirection(&gPlayerEntity.base, super); sub_080390F8(this); ProcessMovement0(super); sub_080044EC(super, 0x1800); @@ -193,7 +193,7 @@ void sub_08038FA0(CuccoAggrEntity* this) { if (this->unk_78) { if ((this->unk_78-- & 0x7) == 0) { - sub_08004596(super, GetFacingDirection(super, &gPlayerEntity)); + sub_08004596(super, GetFacingDirection(super, &gPlayerEntity.base)); } sub_080390F8(this); @@ -278,7 +278,7 @@ void sub_08039120(CuccoAggrEntity* this) { void sub_08039140(CuccoAggrEntity* this) { super->action = 6; super->timer = Random(); - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); super->z.HALF.HI = -4; this->unk_78 = 0xb4; sub_080390F8(this); diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c index da26009c..03eb697f 100644 --- a/src/enemy/cuccoChickAggr.c +++ b/src/enemy/cuccoChickAggr.c @@ -137,12 +137,12 @@ u32 sub_08022B20(Entity* this) { if (!sub_08049DF4(2)) return 0; - return EntityInRectRadius(this, &gPlayerEntity, 36, 36); + return EntityInRectRadius(this, &gPlayerEntity.base, 36, 36); } void sub_08022B44(Entity* this) { this->zVelocity = Q_16_16(0.75); - this->direction = GetFacingDirection(this, &gPlayerEntity); + this->direction = GetFacingDirection(this, &gPlayerEntity.base); if (this->direction & (0x3 | DIR_DIAGONAL | DirectionEast)) this->spriteSettings.flipX = (this->direction >> 4) ^ 1; diff --git a/src/enemy/dust.c b/src/enemy/dust.c index 68d3336d..e6d3ca7a 100644 --- a/src/enemy/dust.c +++ b/src/enemy/dust.c @@ -202,7 +202,7 @@ void sub_08044310(DustEntity* this) { uVar7 = 0xff; tmp = 0xff; - switch (gPlayerEntity.animationState / 2 & 3) { + switch (gPlayerEntity.base.animationState / 2 & 3) { case 0: for (i = 0; i < this->unk_74; i++) { if ((((Hitbox3D*)&super->hitbox[i])[1].unknown[2] == 0) && @@ -276,15 +276,15 @@ void sub_08044498(DustEntity* this) { u32 tmp; u32 xdiff, ydiff; - uVar4 = COORD_TO_TILE(&gPlayerEntity); + uVar4 = COORD_TO_TILE(&gPlayerEntity.base); tmp = (gPlayerState.playerInput.newInput & 0xf00); if (tmp != this->unk_75 || uVar4 != this->unk_76) { this->unk_75 = tmp; this->unk_76 = uVar4; pbVar2 = HEAP->items; uVar4 = HEAP->unk_0; - xdiff = gPlayerEntity.x.HALF.HI - super->x.HALF.HI; - ydiff = gPlayerEntity.y.HALF.HI - super->y.HALF.HI; + xdiff = gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI; + ydiff = gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI; for (i = 0; i < uVar4; i++) { if (xdiff - pbVar2[i].unk_0 < 0x10 && ydiff - pbVar2[i].unk_1 < 0x10) { @@ -292,7 +292,7 @@ void sub_08044498(DustEntity* this) { if (pEVar1 == NULL) { return; } - CopyPosition(&gPlayerEntity, pEVar1); + CopyPosition(&gPlayerEntity.base, pEVar1); return; } } @@ -307,9 +307,10 @@ void sub_08044550(DustEntity* this) { if (super->speed < 0x100) { super->speed += 0x10; } - ptr = &gUnk_08126EE4[gPlayerEntity.animationState & 0xe]; - super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gPlayerEntity.x.HALF.HI + ptr[0], - gPlayerEntity.y.HALF.HI + ptr[1]); + ptr = &gUnk_08126EE4[gPlayerEntity.base.animationState & 0xe]; + super->direction = + CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gPlayerEntity.base.x.HALF.HI + ptr[0], + gPlayerEntity.base.y.HALF.HI + ptr[1]); LinearMoveUpdate(super); } else { sub_080445C0(this); diff --git a/src/enemy/enemy50.c b/src/enemy/enemy50.c index 0a33c592..bb18b5bd 100644 --- a/src/enemy/enemy50.c +++ b/src/enemy/enemy50.c @@ -160,7 +160,7 @@ void Enemy50_OnGrabbed(Enemy50Entity* this) { void Enemy50_SubAction0(Enemy50Entity* this) { super->subAction = 1; super->gustJarTolerance = 0x3c; - InitializeAnimation(super, (gPlayerEntity.animationState >> 2) + 5); + InitializeAnimation(super, (gPlayerEntity.base.animationState >> 2) + 5); } void Enemy50_SubAction1(Enemy50Entity* this) { @@ -302,7 +302,7 @@ void Enemy50_Action9(Enemy50Entity* this) { if (sub_0807953C()) { this->unk_78 += 8; } - if (gPlayerEntity.health == 0) { + if (gPlayerEntity.base.health == 0) { this->unk_78 = 0xe0; } this->unk_78++; @@ -312,7 +312,7 @@ void Enemy50_Action9(Enemy50Entity* this) { super->iframes = -0xc; super->knockbackDuration = 0x14; super->knockbackSpeed = 0x180; - super->knockbackDirection = gPlayerEntity.animationState << 2 ^ 0x10; + super->knockbackDirection = gPlayerEntity.base.animationState << 2 ^ 0x10; sub_08041128(this); sub_0803F6EC(this); } else { diff --git a/src/enemy/enemy64.c b/src/enemy/enemy64.c index b226528f..62bd707b 100644 --- a/src/enemy/enemy64.c +++ b/src/enemy/enemy64.c @@ -348,7 +348,7 @@ void Enemy64_Action4(Enemy64Entity* this) { void Enemy64_Action4_SubAction0(Enemy64Entity* this) { SoundReq(SFX_BOSS_DIE); - if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) { + if (PlayerCanBeMoved() && gPlayerEntity.base.z.HALF.HI == 0) { SetPlayerControl(CONTROL_2); super->subAction = 2; super->timer = 30; @@ -359,7 +359,7 @@ void Enemy64_Action4_SubAction0(Enemy64Entity* this) { } void Enemy64_Action4_SubAction1(Enemy64Entity* this) { - if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) { + if (PlayerCanBeMoved() && gPlayerEntity.base.z.HALF.HI == 0) { SetPlayerControl(CONTROL_2); super->subAction = 2; super->timer = 1; @@ -416,7 +416,7 @@ void Enemy64_Action4_SubAction5(Enemy64Entity* this) { entity = entity->child; entity->flags &= ~0x80; entity->spriteSettings.draw = 0; - entity = &gPlayerEntity; + entity = &gPlayerEntity.base; entity->x.HALF.HI = gRoomControls.origin_x + 0xa8; entity->y.HALF.HI = gRoomControls.origin_y + 0x80; entity->animationState = 0; @@ -459,9 +459,9 @@ void Enemy64_Action4_SubAction7(Enemy64Entity* this) { void sub_08049944(Enemy64Entity* this) { this->unk_7c = (this->unk_7c << 1 & 0x7f) | (this->unk_7c & 0x80); - if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20)) { + if (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x20)) { gPlayerState.field_0x14 = 1; - if (gPlayerEntity.z.HALF.HI == 0) { + if (gPlayerEntity.base.z.HALF.HI == 0) { gPlayerState.flags |= PL_FLAGS2; this->unk_7c |= 1; } @@ -478,22 +478,22 @@ void sub_08049998(Enemy64Entity* this, u32 param_2) { tmpY = super->y.HALF.HI; LinearMoveAngle(super, super->speed, super->direction); if (((this->unk_7c & 1) != 0) && PlayerCanBeMoved()) { - gPlayerEntity.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.x.HALF.HI; - gPlayerEntity.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.y.HALF.HI; + gPlayerEntity.base.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.base.x.HALF.HI; + gPlayerEntity.base.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.base.y.HALF.HI; } } void sub_080499F0(Enemy64Entity* this) { u32 tmp; - if ((((super->action != 0) && (gPlayerEntity.z.HALF.HI == 0)) && (PlayerCanBeMoved())) && + if ((((super->action != 0) && (gPlayerEntity.base.z.HALF.HI == 0)) && (PlayerCanBeMoved())) && ((this->unk_7c & 1) == 0)) { - if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24) && + if (EntityWithinDistance(&gPlayerEntity.base, super->x.HALF.HI, super->y.HALF.HI, 0x24) && ((this->unk_7c & 2) == 0)) { - tmp = sub_080045DA((s32)gPlayerEntity.x.HALF.HI - super->x.HALF.HI, - (s32)gPlayerEntity.y.HALF.HI - super->y.HALF.HI); - gPlayerEntity.x.WORD = super->x.WORD + gSineTable[tmp] * 0x2400; - gPlayerEntity.y.WORD = super->y.WORD + gSineTable[tmp + 0x40] * -0x2400; + tmp = sub_080045DA((s32)gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI, + (s32)gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI); + gPlayerEntity.base.x.WORD = super->x.WORD + gSineTable[tmp] * 0x2400; + gPlayerEntity.base.y.WORD = super->y.WORD + gSineTable[tmp + 0x40] * -0x2400; } this->unk_7c = 0; } @@ -532,7 +532,7 @@ void sub_08049B20(Enemy64Entity* this) { tmpY = super->y.HALF.HI; LinearMoveAngle(super, super->speed, super->direction); if (((this->unk_7c & 1) != 0) && PlayerCanBeMoved()) { - gPlayerEntity.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.x.HALF.HI; - gPlayerEntity.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.y.HALF.HI; + gPlayerEntity.base.x.HALF.HI = (super->x.HALF.HI - tmpX) + gPlayerEntity.base.x.HALF.HI; + gPlayerEntity.base.y.HALF.HI = (super->y.HALF.HI - tmpY) + gPlayerEntity.base.y.HALF.HI; } } diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index 81169608..aee943f0 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -80,7 +80,7 @@ void sub_0802C334(FallingBoulderEntity* this) { u16 tmp; if (this->unk_7c == 0) { u32 tmp = gRoomControls.origin_y; - entity = &gPlayerEntity; + entity = &gPlayerEntity.base; if (entity == NULL) return; if (entity->y.HALF.HI - tmp <= 0x38) { diff --git a/src/enemy/flyingPot.c b/src/enemy/flyingPot.c index 10e6136d..8c4159d4 100644 --- a/src/enemy/flyingPot.c +++ b/src/enemy/flyingPot.c @@ -220,7 +220,7 @@ void FlyingPot_Action3(FlyingPotEntity* this) { if (super->z.HALF.HI <= -6) { super->action = FLYING_POT_ACTION_4; super->timer = 10; - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); } } diff --git a/src/enemy/flyingSkull.c b/src/enemy/flyingSkull.c index 525d40d9..17c46040 100644 --- a/src/enemy/flyingSkull.c +++ b/src/enemy/flyingSkull.c @@ -137,7 +137,7 @@ void sub_08039DD8(FlyingSkullEntity* this) { RegisterCarryEntity(super); } else { if ((gPlayerState.flags & PL_MINISH) == 0) { - Entity* player = &gPlayerEntity; + Entity* player = &gPlayerEntity.base; if (EntityWithinDistance(super, player->x.HALF.HI, player->y.HALF.HI, 0x30)) { if (super->type == 1) { super->action = 3; @@ -165,15 +165,15 @@ void sub_08039EE4(FlyingSkullEntity* this) { COLLISION_OFF(super); super->collisions = COL_NONE; super->hitbox = (Hitbox*)&gUnk_080FD340; - gPlayerEntity.animationState; - this->unk_0x76 = gPlayerEntity.animationState; + gPlayerEntity.base.animationState; + this->unk_0x76 = gPlayerEntity.base.animationState; SetTile(this->unk_0x74, COORD_TO_TILE(super), super->collisionLayer); } void sub_08039F4C(FlyingSkullEntity* this) { - if (gPlayerEntity.animationState != this->unk_0x76) { - super->frameIndex = AnimationStateIdle(gPlayerEntity.animationState - this->unk_0x76 + super->frameIndex); - this->unk_0x76 = gPlayerEntity.animationState; + if (gPlayerEntity.base.animationState != this->unk_0x76) { + super->frameIndex = AnimationStateIdle(gPlayerEntity.base.animationState - this->unk_0x76 + super->frameIndex); + this->unk_0x76 = gPlayerEntity.base.animationState; } } @@ -210,7 +210,7 @@ void sub_0803A048(FlyingSkullEntity* this) { if (super->z.HALF.HI <= -6) { super->action = 5; super->timer = 10; - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); } } diff --git a/src/enemy/ghini.c b/src/enemy/ghini.c index 683828de..5b408126 100644 --- a/src/enemy/ghini.c +++ b/src/enemy/ghini.c @@ -121,7 +121,7 @@ void Ghini_OnGrabbed(GhiniEntity* this) { void Ghini_SubAction0(GhiniEntity* this) { super->subAction = 1; super->gustJarTolerance = 0x3c; - InitializeAnimation(super, (gPlayerEntity.animationState >> 2) + 5); + InitializeAnimation(super, (gPlayerEntity.base.animationState >> 2) + 5); } void Ghini_SubAction1(GhiniEntity* this) { @@ -259,7 +259,7 @@ void Ghini_Action9(GhiniEntity* this) { if (sub_0807953C() != 0) { this->unk_78 += 0xc; } - if (gPlayerEntity.health == 0) { + if (gPlayerEntity.base.health == 0) { this->unk_78 = 0xe0; } if (++this->unk_78 >= 0xe0) { @@ -268,7 +268,7 @@ void Ghini_Action9(GhiniEntity* this) { super->iframes = -0xc; super->knockbackDuration = 0x14; super->knockbackSpeed = 0x180; - super->knockbackDirection = gPlayerEntity.animationState << 2 ^ 0x10; + super->knockbackDirection = gPlayerEntity.base.animationState << 2 ^ 0x10; sub_0803F51C(this); sub_0803F6EC(this); } else { @@ -363,18 +363,18 @@ void sub_0803F694(GhiniEntity* this) { void sub_0803F6C0(GhiniEntity* this) { super->frame &= ~1; - gPlayerEntity.iframes = 0xc; + gPlayerEntity.base.iframes = 0xc; ModHealth(-4); - SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); + SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6); } void sub_0803F6EC(GhiniEntity* this) { - if (gPlayerEntity.health != 0) { - gPlayerEntity.flags |= ENT_COLLIDE; - gPlayerEntity.zVelocity = Q_16_16(1.5); - gPlayerEntity.z.HALF.HI = -2; - gPlayerEntity.direction = gPlayerEntity.animationState << 2; - gPlayerEntity.iframes = -0x3c; + if (gPlayerEntity.base.health != 0) { + gPlayerEntity.base.flags |= ENT_COLLIDE; + gPlayerEntity.base.zVelocity = Q_16_16(1.5); + gPlayerEntity.base.z.HALF.HI = -2; + gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2; + gPlayerEntity.base.iframes = -0x3c; gPlayerState.jump_status = 0x41; } gPlayerState.flags &= ~PL_CAPTURED; @@ -384,7 +384,7 @@ void sub_0803F738(GhiniEntity* this) { ResetActiveItems(); gPlayerState.mobility |= 0x80; gPlayerState.field_0xa |= 0x80; - sub_0806FA90(&gPlayerEntity, super, 0, 1); + sub_0806FA90(&gPlayerEntity.base, super, 0, 1); super->spriteOffsetY -= 2; } diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index 1471e807..0732a282 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -166,7 +166,7 @@ void sub_080376D0(GibdoEntity* this) { ResetActiveItems(); gPlayerState.mobility |= 0x80; gPlayerState.field_0xa |= 0x80; - CopyPositionAndSpriteOffset(&gPlayerEntity, super); + CopyPositionAndSpriteOffset(&gPlayerEntity.base, super); UpdateAnimationSingleFrame(super); if ((super->frame & 1) != 0) { if (--this->field_0x7c == 0) { @@ -352,19 +352,19 @@ void sub_08037A58(GibdoEntity* this) { void sub_08037ACC(GibdoEntity* this) { gPlayerState.flags &= ~PL_DISABLE_ITEMS; - COLLISION_ON(&gPlayerEntity); - gPlayerEntity.iframes = 30; - gPlayerEntity.knockbackDirection = DirectionFromAnimationState(super->animationState); - gPlayerEntity.knockbackDuration = 4; - gPlayerEntity.knockbackSpeed = 0x180; + COLLISION_ON(&gPlayerEntity.base); + gPlayerEntity.base.iframes = 30; + gPlayerEntity.base.knockbackDirection = DirectionFromAnimationState(super->animationState); + gPlayerEntity.base.knockbackDuration = 4; + gPlayerEntity.base.knockbackSpeed = 0x180; } // Damage player maybe? void sub_08037B10(GibdoEntity* this) { u32 health; - gPlayerEntity.iframes = 0xc; + gPlayerEntity.base.iframes = 0xc; health = ModHealth(-8); - SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); + SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6); if (health == 0) { sub_08037A58(this); this->field_0x76 = 240; diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index ef144203..19399037 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -170,7 +170,7 @@ void Gleerok_OnDeath(GleerokEntity* this) { this->unk_74--; gScreen.controls.alphaBlend = this->unk_74 | (this->unk_75 << 8); if (gScreen.controls.alphaBlend == 0x1000) { - sub_0807AABC(&gPlayerEntity); + sub_0807AABC(&gPlayerEntity.base); DeleteThisEntity(); } } @@ -189,7 +189,7 @@ void Gleerok_OnDeath(GleerokEntity* this) { case 0: gPlayerState.field_0x14 = 1; - if (sub_0806FC80(super, &gPlayerEntity, super->frame & 0x3f)) { + if (sub_0806FC80(super, &gPlayerEntity.base, super->frame & 0x3f)) { gPlayerState.spriteOffsetY = -6; } @@ -215,10 +215,10 @@ void sub_0802D170(GleerokEntity* this) { this->unk_84->filler2[0].unk0.HALF.HI = 0x10; if (sub_0802EB08(this->unk_84, 0x40, 2) == 0 && sub_0802EA88(this->unk_84) == 0) { super->action = 2; - gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x98; - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0xd8; - gPlayerEntity.animationState = 0; - RestorePrevTileEntity(COORD_TO_TILE(&gPlayerEntity), 2); + gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + 0x98; + gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0xd8; + gPlayerEntity.base.animationState = 0; + RestorePrevTileEntity(COORD_TO_TILE(&gPlayerEntity.base), 2); gRoomControls.camera_target = super; SetFade(FADE_BLACK_WHITE | FADE_INSTANT, 8); } @@ -318,7 +318,7 @@ void sub_0802D3B8(GleerokEntity* this) { if (CheckGlobalFlag(LV2_CLEAR)) { gScreen.lcd.displayControl &= 0xfdff; - sub_0807AABC(&gPlayerEntity); + sub_0807AABC(&gPlayerEntity.base); DeleteThisEntity(); } @@ -436,7 +436,7 @@ void sub_0802D674(GleerokEntity* this) { u32 val; gPauseMenuOptions.disabled = 1; - if (gPlayerEntity.z.WORD != 0) + if (gPlayerEntity.base.z.WORD != 0) return; if (this->unk_7c.WORD == 0x96) { SoundReq(SFX_BOSS_HIT); @@ -450,13 +450,13 @@ void sub_0802D674(GleerokEntity* this) { SoundReq(SFX_BOSS_HIT); } else if (val <= 0x3c) { if (val == 0x3c) { - CreateSpeechBubbleExclamationMark(&gPlayerEntity, 0xc, -0x18); + CreateSpeechBubbleExclamationMark(&gPlayerEntity.base, 0xc, -0x18); } - gPlayerEntity.animationState = 0; + gPlayerEntity.base.animationState = 0; } else if (val <= 0x59) { - gPlayerEntity.animationState = 2; + gPlayerEntity.base.animationState = 2; } else if (val <= 0x77) { - gPlayerEntity.animationState = 6; + gPlayerEntity.base.animationState = 6; } } @@ -520,7 +520,7 @@ void sub_0802D7B4(GleerokEntity* this) { super->action = 1; super->subAction = 0; this->unk_84->ent2->timer = 24; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; #ifndef EU gPlayerState.controlMode = CONTROL_1; #endif @@ -577,7 +577,7 @@ void sub_0802D86C(GleerokEntity* this) { if (((GleerokEntity*)(super->parent))->unk_80 == 0) return; - if (!EntityInRectRadius(super, &gPlayerEntity, 8, 8)) + if (!EntityInRectRadius(super, &gPlayerEntity.base, 8, 8)) return; gPlayerState.field_0x14 = 1; @@ -710,7 +710,7 @@ void sub_0802D86C(GleerokEntity* this) { void sub_0802DB84(GleerokEntity* this) { u32 timer; - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); if (this->unk_84->filler[0].unk0.HALF.HI == super->direction) { super->subAction = 1; this->unk_78 = 0; @@ -744,7 +744,7 @@ void sub_0802DB84(GleerokEntity* this) { } void sub_0802DC1C(GleerokEntity* this) { - u32 diff = GetFacingDirection(super, &gPlayerEntity); + u32 diff = GetFacingDirection(super, &gPlayerEntity.base); diff = (this->unk_84->filler[0].unk0.HALF.HI - diff) & 0x1f; if (diff > 0x10) { @@ -788,7 +788,7 @@ void sub_0802DC1C(GleerokEntity* this) { void sub_0802DCE0(GleerokEntity* this) { if (this->unk_84->ent2->timer != 12) { - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); if (this->unk_84->filler[5].unk0.HALF.HI == super->direction) { this->unk_84->ent2->timer = 12; this->unk_82 = 4; @@ -1009,7 +1009,7 @@ void sub_0802E0B8(GleerokEntity* this) { val = super->frame & 0x3f; if (val) { - if (sub_0806FC80(super, &gPlayerEntity, val)) { + if (sub_0806FC80(super, &gPlayerEntity.base, val)) { gPlayerState.field_0x14 = 1; gPlayerState.spriteOffsetY = -6; } @@ -1059,7 +1059,7 @@ void sub_0802E1D0(GleerokEntity* this) { GetNextFrame(super); } if (super->frame & 0x3f) { - if (sub_0806FC80(super, &gPlayerEntity, super->frame & 0x3f)) { + if (sub_0806FC80(super, &gPlayerEntity.base, super->frame & 0x3f)) { gPlayerState.field_0x14 = 1; gPlayerState.spriteOffsetY = -6; } @@ -1133,7 +1133,7 @@ void sub_0802E300(GleerokEntity* this) { this->unk_79 &= ~0x80; heap = this->unk_84; - dir = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) << 3; + dir = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) << 3; index = 0; ptr2 = &this->unk_80; tmp = 0; @@ -1403,7 +1403,7 @@ void sub_0802E9B0(GleerokEntity* this) { s32 uVar4; Gleerok_HeapStruct* heap; - iVar2 = sub_080041DC(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI) >> 4; + iVar2 = sub_080041DC(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI) >> 4; if (iVar2 < 0x60) { iVar2 = 10; } else { diff --git a/src/enemy/gyorgChild.c b/src/enemy/gyorgChild.c index c72b4619..ea6a5db6 100644 --- a/src/enemy/gyorgChild.c +++ b/src/enemy/gyorgChild.c @@ -159,13 +159,13 @@ void GyorgChild_Action2(GyorgChildEntity* this) { switch (super->animationState >> 1) { case 0: case 2: - super->x.HALF.HI = gPlayerEntity.x.HALF.HI + this->attackOffsetX; + super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + this->attackOffsetX; super->y.HALF.HI = gRoomControls.scroll_y + this->attackOffsetY; break; case 1: default: super->x.HALF.HI = gRoomControls.scroll_x + this->attackOffsetX; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI + this->attackOffsetY; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + this->attackOffsetY; break; } if (super->type2 == 0) { diff --git a/src/enemy/gyorgFemale.c b/src/enemy/gyorgFemale.c index 4270139c..fbc0a222 100644 --- a/src/enemy/gyorgFemale.c +++ b/src/enemy/gyorgFemale.c @@ -93,8 +93,8 @@ void GyorgFemale_Setup(GyorgFemaleEntity* this) { MemClear(&gMapDataTopSpecial, 0x8000); sub_0804660C(this, 0); sub_080464C0(this); - gPlayerEntity.collisionLayer = 2; - UpdateSpriteForCollisionLayer(&gPlayerEntity); + gPlayerEntity.base.collisionLayer = 2; + UpdateSpriteForCollisionLayer(&gPlayerEntity.base); #ifndef EU RegisterTransitionManager(this, sub_08046498, 0); #else @@ -272,8 +272,8 @@ void sub_08046518(void) { void sub_080465C8(void) { s32 x, y; - x = (gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) >> 3; - y = (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) >> 3; + x = (gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x) >> 3; + y = (gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) >> 3; if (gMapDataBottomSpecial[(y << 7) + x]) { gPlayerState.field_0x14 = 1; } @@ -435,7 +435,7 @@ void GyorgFemale_ProcessEyeHit(GyorgFemaleEntity* this) { #ifndef EU if (((GyorgHeap*)super->myHeap)->unk_3c != 0xFF) { #endif - tmp = &gPlayerEntity; + tmp = &gPlayerEntity.base; tmp->knockbackDirection = ((GyorgHeap*)super->myHeap)->unk_3c; tmp->iframes = 0xF4; tmp->knockbackDuration = 0xA; diff --git a/src/enemy/gyorgFemaleEye.c b/src/enemy/gyorgFemaleEye.c index 234d88ed..b9ff2671 100644 --- a/src/enemy/gyorgFemaleEye.c +++ b/src/enemy/gyorgFemaleEye.c @@ -83,9 +83,9 @@ void GyorgFemaleEye_OnCollision(GyorgFemaleEyeEntity* this) { #endif (*(((GyorgHeap**)&parent->base.myHeap)))->unk_18[super->type] = super->contactedEntity; (*(((GyorgHeap**)&parent->base.myHeap)))->reflectFxPos.HALF.x = - (gPlayerEntity.x.HALF.HI + super->x.HALF.HI) / 2; + (gPlayerEntity.base.x.HALF.HI + super->x.HALF.HI) / 2; (*(((GyorgHeap**)&parent->base.myHeap)))->reflectFxPos.HALF.y = - (gPlayerEntity.y.HALF.HI + super->y.HALF.HI) / 2; + (gPlayerEntity.base.y.HALF.HI + super->y.HALF.HI) / 2; (*(((GyorgHeap**)&parent->base.myHeap)))->unk_3c = (super->knockbackDirection ^= 0x10); #ifndef EU break; diff --git a/src/enemy/gyorgFemaleMouth.c b/src/enemy/gyorgFemaleMouth.c index 0500b001..e696f7c8 100644 --- a/src/enemy/gyorgFemaleMouth.c +++ b/src/enemy/gyorgFemaleMouth.c @@ -58,11 +58,11 @@ void GyorgFemaleMouth(Entity* this) { GetNextFrame(this); } if (tmp & 2) { - if (this->y.HALF.HI < gPlayerEntity.y.HALF.HI) { + if (this->y.HALF.HI < gPlayerEntity.base.y.HALF.HI) { tmp++; } } else { - if (this->x.HALF.HI < gPlayerEntity.x.HALF.HI) { + if (this->x.HALF.HI < gPlayerEntity.base.x.HALF.HI) { tmp++; } } diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 1521b85c..40c43de4 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -111,8 +111,8 @@ void GyorgMale(GyorgMaleEntity* this) { if (super->spriteSettings.draw == 1 && (super->y.HALF.HI - gRoomControls.scroll_y + 0x30) > 0x100u) { super->spriteSettings.draw = 0; } - this->unk_84 = gPlayerEntity.x.HALF.HI; - this->unk_86 = gPlayerEntity.y.HALF.HI; + this->unk_84 = gPlayerEntity.base.x.HALF.HI; + this->unk_86 = gPlayerEntity.base.y.HALF.HI; } void sub_08046898(GyorgMaleEntity* this) { @@ -793,7 +793,7 @@ void sub_080477F0(GyorgMaleEntity* this) { } super->direction = sub_080045DA(this->unk_80 - super->x.HALF.HI, this->unk_82 - super->y.HALF.HI); sub_08047E48(this); - if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) { + if (!EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x80)) { super->action = 2; super->subAction = 0; super->spriteOrientation.flipY = 2; @@ -858,7 +858,7 @@ void sub_08047978(GyorgMaleEntity* this) { tmp->parent = super; } } - if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x80)) { + if (!EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x80)) { super->action = 2; super->subAction = 0; super->spriteOrientation.flipY = 2; @@ -1016,10 +1016,10 @@ void sub_08047D88(GyorgMaleEntity* this) { return; if (super->animIndex == 1) return; - if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20)) + if (!EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x20)) return; gPlayerState.field_0x14 = 1; - if (gPlayerEntity.z.HALF.HI != 0) + if (gPlayerEntity.base.z.HALF.HI != 0) return; this->unk_7c |= 1; } @@ -1033,8 +1033,8 @@ void sub_08047DF0(GyorgMaleEntity* this, u32 unk1) { LinearMoveAngle(super, super->speed, super->direction); if (this->unk_7c & 1) { if (PlayerCanBeMoved()) { - gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX; - gPlayerEntity.y.HALF.HI += super->y.HALF.HI - oldY; + gPlayerEntity.base.x.HALF.HI += super->x.HALF.HI - oldX; + gPlayerEntity.base.y.HALF.HI += super->y.HALF.HI - oldY; } } } @@ -1051,8 +1051,8 @@ void sub_08047E58(GyorgMaleEntity* this) { LinearMoveAngle(super, super->speed, super->direction); if (this->unk_7c & 1) { if (PlayerCanBeMoved()) { - gPlayerEntity.x.HALF.HI += super->x.HALF.HI - oldX; - gPlayerEntity.y.HALF.HI += super->y.HALF.HI - oldY; + gPlayerEntity.base.x.HALF.HI += super->x.HALF.HI - oldX; + gPlayerEntity.base.y.HALF.HI += super->y.HALF.HI - oldY; } } } @@ -1066,11 +1066,12 @@ void sub_08047EA4(GyorgMaleEntity* this, u32 unk1) { return; if (this->unk_7c & 1) { tmp2 = sub_08047F68(this) << 8; - dir = sub_080045DA(gPlayerEntity.x.HALF.HI - super->x.HALF.HI, gPlayerEntity.y.HALF.HI - super->y.HALF.HI); + dir = sub_080045DA(gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI, + gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI); tmp = dir - (tmp / 256); tmp &= 0xFF; - gPlayerEntity.x.WORD += (gSineTable[tmp] - gSineTable[dir]) * tmp2; - gPlayerEntity.y.WORD -= (gSineTable[tmp + 0x40] - gSineTable[dir + 0x40]) * tmp2; + gPlayerEntity.base.x.WORD += (gSineTable[tmp] - gSineTable[dir]) * tmp2; + gPlayerEntity.base.y.WORD -= (gSineTable[tmp + 0x40] - gSineTable[dir + 0x40]) * tmp2; } this->unk_7a = this->unk_78; } @@ -1081,8 +1082,8 @@ const u16 gUnk_080D1C04[0x20] = { 0, 1, 4, 9, 16, 25, 36, 49, 64, 8 u32 sub_08047F68(GyorgMaleEntity* this) { s32 diffX, diffY; s32 distSquared, approx; - diffX = gPlayerEntity.x.HALF.HI - super->x.HALF.HI; - diffY = gPlayerEntity.y.HALF.HI - super->y.HALF.HI; + diffX = gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI; + diffY = gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI; distSquared = (diffX * diffX) + (diffY * diffY); if (distSquared == 0x400) return 0x20; @@ -1121,15 +1122,15 @@ void sub_08048004(GyorgMaleEntity* this) { return; if (super->animIndex == 0) { COLLISION_OFF(super); - if (gPlayerEntity.z.HALF.HI != 0) + if (gPlayerEntity.base.z.HALF.HI != 0) return; if (!PlayerCanBeMoved()) return; if (this->unk_7c & 1) { u32 b = super->spriteRendering.b3; if (b == 3) { - s32 posX = ((gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) >> 3); - s32 posY = ((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) >> 3); + s32 posX = ((gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x) >> 3); + s32 posY = ((gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) >> 3); u16* tmp = (u16*)&gMapDataBottomSpecial; if (tmp[(posY << 7) + posX]) { if (!(this->unk_7c & 2)) { @@ -1137,8 +1138,8 @@ void sub_08048004(GyorgMaleEntity* this) { } if ((this->unk_7c & 0x80)) return; - gPlayerEntity.x.HALF.HI = this->unk_84; - gPlayerEntity.y.HALF.HI = this->unk_86; + gPlayerEntity.base.x.HALF.HI = this->unk_84; + gPlayerEntity.base.y.HALF.HI = this->unk_86; return; } } @@ -1146,12 +1147,12 @@ void sub_08048004(GyorgMaleEntity* this) { } else { u32 b = super->spriteRendering.b3; if (b != 3) { - if (EntityWithinDistance(&gPlayerEntity, super->x.HALF.HI, super->y.HALF.HI, 0x24)) { + if (EntityWithinDistance(&gPlayerEntity.base, super->x.HALF.HI, super->y.HALF.HI, 0x24)) { if (!(this->unk_7c & 2)) { - u32 tmp = sub_080045DA(gPlayerEntity.x.HALF.HI - super->x.HALF.HI, - gPlayerEntity.y.HALF.HI - super->y.HALF.HI); - gPlayerEntity.x.WORD = super->x.WORD + (gSineTable[tmp] * 9216); - gPlayerEntity.y.WORD = super->y.WORD - (gSineTable[tmp + 0x40] * 9216); + u32 tmp = sub_080045DA(gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI, + gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI); + gPlayerEntity.base.x.WORD = super->x.WORD + (gSineTable[tmp] * 9216); + gPlayerEntity.base.y.WORD = super->y.WORD - (gSineTable[tmp + 0x40] * 9216); } } } diff --git a/src/enemy/helmasaur.c b/src/enemy/helmasaur.c index 6ac69120..9f970a08 100644 --- a/src/enemy/helmasaur.c +++ b/src/enemy/helmasaur.c @@ -83,7 +83,7 @@ void sub_0802BC74(HelmasaurEntity* this) { sub_0802C1C0(this); super->subAction = 1; super->gustJarTolerance = 60; - super->animationState = AnimationStateFlip90(gPlayerEntity.animationState >> 1); + super->animationState = AnimationStateFlip90(gPlayerEntity.base.animationState >> 1); InitializeAnimation(super, super->animationState); } diff --git a/src/enemy/keese.c b/src/enemy/keese.c index 96f3bd08..922ad17d 100644 --- a/src/enemy/keese.c +++ b/src/enemy/keese.c @@ -139,7 +139,7 @@ void Keese_Sleep(KeeseEntity* this) { if (super->timer != 0) { super->timer--; } else { - if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70)) + if (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x70)) Keese_StartFly(this); } } @@ -165,7 +165,7 @@ void sub_08021F24(KeeseEntity* this) { super->timer = gKeeseRestDurations[Random() & 0xF]; InitializeAnimation(super, KeeseAnimation_Rest); } else if ((this->sleepTimer == 0) && - !(EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x70))) { + !(EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x70))) { super->action = KEESE_ACTION_SLEEP; super->timer = 30; InitializeAnimation(super, KeeseAnimation_Rest); diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c index 5798f410..107afd16 100644 --- a/src/enemy/lakitu.c +++ b/src/enemy/lakitu.c @@ -250,8 +250,8 @@ void Lakitu_Cloudless(LakituEntity* this) { } bool32 sub_0803CA4C(LakituEntity* this) { - if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) { - if (EntityInRectRadius(super, &gPlayerEntity, 0x70, 0x50)) { + if (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x28) == 0) { + if (EntityInRectRadius(super, &gPlayerEntity.base, 0x70, 0x50)) { return TRUE; } } @@ -260,7 +260,7 @@ bool32 sub_0803CA4C(LakituEntity* this) { } void sub_0803CA84(LakituEntity* this, u32 unkParameter) { - u32 altAnimState = GetFacingDirection(super, &gPlayerEntity); + u32 altAnimState = GetFacingDirection(super, &gPlayerEntity.base); if (((altAnimState - 3) & 7) > 2 || ((super->animationState - (altAnimState >> 3)) & 3) > 1) { altAnimState = DirectionRoundUp(altAnimState) >> 3; @@ -304,7 +304,7 @@ void sub_0803CB34(LakituEntity* this) { super->action = LIGHTNING_THROW; super->hitType = 0xa6; - this->unk_78 = GetFacingDirection(super, &gPlayerEntity); + this->unk_78 = GetFacingDirection(super, &gPlayerEntity.base); InitAnimationForceUpdate(super, super->animationState + 8); } diff --git a/src/enemy/lakituCloud.c b/src/enemy/lakituCloud.c index 3d0c000d..ac2549fc 100644 --- a/src/enemy/lakituCloud.c +++ b/src/enemy/lakituCloud.c @@ -68,7 +68,7 @@ void sub_0803CD40(LakituCloudEntity* this) { ModHealth(-2); - SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); + SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6); sub_08079D84(); sub_0803CE3C(this); diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index 52f37306..fef316b6 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -53,7 +53,7 @@ void LikeLike_OnCollision(LikeLikeEntity* this) { super->timer = 95; super->subtimer = tmp; super->flags2 &= 0xfc; - this->prevSpritePriority = gPlayerEntity.spritePriority.b1; + this->prevSpritePriority = gPlayerEntity.base.spritePriority.b1; } } } @@ -198,12 +198,12 @@ void sub_0802805C(LikeLikeEntity* this) { } else { ResetActiveItems(); gPlayerState.mobility |= 0x80; - PositionRelative(super, &gPlayerEntity, 0, Q_16_16(1.0)); + PositionRelative(super, &gPlayerEntity.base, 0, Q_16_16(1.0)); tmp = GetSpriteSubEntryOffsetDataPointer((u16)super->spriteIndex, super->frameIndex); - gPlayerEntity.spriteOffsetX = tmp[0]; - gPlayerEntity.spriteOffsetY = tmp[1]; - gPlayerEntity.spritePriority.b1 = 0; + gPlayerEntity.base.spriteOffsetX = tmp[0]; + gPlayerEntity.base.spriteOffsetY = tmp[1]; + gPlayerEntity.base.spritePriority.b1 = 0; if (--super->timer == 0) { sub_080281A0(this); @@ -225,14 +225,14 @@ void LikeLike_ReleasePlayer(LikeLikeEntity* this) { gPlayerState.jump_status = 0x41; gPlayerState.field_0xa = 0; gPlayerState.flags &= ~PL_CAPTURED; - gPlayerEntity.flags |= ENT_COLLIDE; - gPlayerEntity.zVelocity = Q_16_16(1.5); - gPlayerEntity.iframes = -60; + gPlayerEntity.base.flags |= ENT_COLLIDE; + gPlayerEntity.base.zVelocity = Q_16_16(1.5); + gPlayerEntity.base.iframes = -60; tmp = 0; - gPlayerEntity.direction = Direction8FromAnimationState(gPlayerEntity.animationState); - gPlayerEntity.spritePriority.b1 = this->prevSpritePriority; - gPlayerEntity.z.HALF.HI = gPlayerEntity.spriteOffsetY; - gPlayerEntity.spriteOffsetY = tmp; + gPlayerEntity.base.direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); + gPlayerEntity.base.spritePriority.b1 = this->prevSpritePriority; + gPlayerEntity.base.z.HALF.HI = gPlayerEntity.base.spriteOffsetY; + gPlayerEntity.base.spriteOffsetY = tmp; super->action = 4; super->timer = 80; super->subtimer = tmp; diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index a896d130..c2afcae9 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -424,7 +424,7 @@ void sub_0803A660(MazaalBraceletEntity* this) { } else { super->action = 7; super->timer = 0; - uVar2 = GetFacingDirection(super, &gPlayerEntity); + uVar2 = GetFacingDirection(super, &gPlayerEntity.base); super->direction = (u8)uVar2; super->speed = 0x280; return; @@ -615,11 +615,11 @@ void sub_0803AA00(MazaalBraceletEntity* this) { sub_08004596(super, direction); } LinearMoveUpdate(super); - if ((super->direction == direction) || (super->y.HALF.HI >= gPlayerEntity.y.HALF.HI)) { + if ((super->direction == direction) || (super->y.HALF.HI >= gPlayerEntity.base.y.HALF.HI)) { super->action = 0x13; super->spriteSettings.draw = 0; super->direction = direction; - this->unk_80.HWORD = gPlayerEntity.x.HALF.HI; + this->unk_80.HWORD = gPlayerEntity.base.x.HALF.HI; InitAnimationForceUpdate(super->child, 4); } } @@ -1184,7 +1184,7 @@ void sub_0803B5C0(MazaalBraceletEntity* this) { u32 direction; u32 temp; - direction = GetFacingDirection(super, &gPlayerEntity); + direction = GetFacingDirection(super, &gPlayerEntity.base); if (direction < 10) { direction = 10; } @@ -1202,8 +1202,8 @@ void sub_0803B5C0(MazaalBraceletEntity* this) { } u32 sub_0803B610(MazaalBraceletEntity* this) { - return EntityWithinDistance(super, gPlayerEntity.x.HALF.HI + gUnk_080CFD19[super->type], - gPlayerEntity.y.HALF.HI - 0xc, 8); + return EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI + gUnk_080CFD19[super->type], + gPlayerEntity.base.y.HALF.HI - 0xc, 8); } // sub_0803B698 was the tail of super function @@ -1211,9 +1211,9 @@ void sub_0803B63C(MazaalBraceletEntity* this) { int y; int x; - x = gPlayerEntity.x.HALF.HI; + x = gPlayerEntity.base.x.HALF.HI; x += gUnk_080CFD19[super->type]; - y = gPlayerEntity.y.HALF.HI - 0xc; + y = gPlayerEntity.base.y.HALF.HI - 0xc; if (super->timer++ > 180) { super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, x, y); } else { @@ -1270,29 +1270,29 @@ void sub_0803B798(void) { ~(PL_CAPTURED | PL_FLAGS10000 | PL_GYORG_FIGHT | PL_ROLLING | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_MOLDWORM_RELEASED | PL_CLONING | PL_USE_LANTERN | PL_PARACHUTE | PL_CONVEYOR_PUSHED | PL_ENTER_MINECART | PL_SWORD_THRUST | PL_USE_OCARINA | PL_CLIMBING | PL_FLAGS40000000 | PL_FLAGS80000000); - gPlayerEntity.flags |= ENT_COLLIDE; - gPlayerEntity.zVelocity = Q_16_16(1.5); - gPlayerEntity.z.HALF.HI = -10; - gPlayerEntity.direction = 0x10; - gPlayerEntity.animationState = 4; - gPlayerEntity.spritePriority.b1 = 1; - gPlayerEntity.spriteOffsetY = 0; - gPlayerEntity.speed = 0x140; - gPlayerEntity.iframes = -0x1e; + gPlayerEntity.base.flags |= ENT_COLLIDE; + gPlayerEntity.base.zVelocity = Q_16_16(1.5); + gPlayerEntity.base.z.HALF.HI = -10; + gPlayerEntity.base.direction = 0x10; + gPlayerEntity.base.animationState = 4; + gPlayerEntity.base.spritePriority.b1 = 1; + gPlayerEntity.base.spriteOffsetY = 0; + gPlayerEntity.base.speed = 0x140; + gPlayerEntity.base.iframes = -0x1e; } void sub_0803B804(MazaalBraceletEntity* this) { - gPlayerEntity.iframes = 30; + gPlayerEntity.base.iframes = 30; ModHealth(-4); - SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); + SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6); } void sub_0803B824(MazaalBraceletEntity* this) { ResetActiveItems(); gPlayerState.mobility |= 0x80; - sub_0806FA90(super, &gPlayerEntity, gUnk_080CFD1D[super->type], 1); - gPlayerEntity.spriteOffsetY = -6; - gPlayerEntity.spritePriority.b1 = 0; + sub_0806FA90(super, &gPlayerEntity.base, gUnk_080CFD1D[super->type], 1); + gPlayerEntity.base.spriteOffsetY = -6; + gPlayerEntity.base.spritePriority.b1 = 0; } u32 sub_0803B870(MazaalBraceletEntity* this) { @@ -1303,8 +1303,8 @@ u32 sub_0803B870(MazaalBraceletEntity* this) { super->action = 0x18; super->timer = 68; super->spriteSettings.draw = 0; - gPlayerEntity.flags &= ~ENT_COLLIDE; - gPlayerEntity.iframes = -0x10; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.iframes = -0x10; sub_0803B824(this); entity->hitType = 0x13; InitAnimationForceUpdate(entity, 7); diff --git a/src/enemy/mazaalHead.c b/src/enemy/mazaalHead.c index 03c5c4de..049b32d1 100644 --- a/src/enemy/mazaalHead.c +++ b/src/enemy/mazaalHead.c @@ -246,7 +246,7 @@ void sub_08033FFC(MazaalHeadEntity* this) { break; default: if (((this->unk_74)->base.flags & ENT_COLLIDE) != 0) { - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; sub_08034420(this); gPlayerState.controlMode = CONTROL_1; ResetPlayerAnimationAndAction(); @@ -567,12 +567,12 @@ void sub_0803473C(MazaalHeadEntity* this) { if (0x28 < (this->unk_74)->base.action) { return; } - playerX = gPlayerEntity.x.HALF.HI - 0x60; + playerX = gPlayerEntity.base.x.HALF.HI - 0x60; } else { if (0x28 < (this->unk_78)->base.action) { return; } - playerX = gPlayerEntity.x.HALF.HI + 0x60; + playerX = gPlayerEntity.base.x.HALF.HI + 0x60; } roomX = gRoomControls.origin_x; if (playerX - 4 > super->x.HALF.HI) { @@ -593,7 +593,7 @@ void sub_0803473C(MazaalHeadEntity* this) { } void sub_080347B4(MazaalHeadEntity* this) { - u32 playerX = gPlayerEntity.x.HALF.HI; + u32 playerX = gPlayerEntity.base.x.HALF.HI; u32 roomX = gRoomControls.origin_x; if (playerX - 4 > super->x.HALF.HI) { if (roomX + 0xe0 < super->x.HALF.HI) { diff --git a/src/enemy/moldworm.c b/src/enemy/moldworm.c index a6469c11..acb85509 100644 --- a/src/enemy/moldworm.c +++ b/src/enemy/moldworm.c @@ -111,12 +111,12 @@ void Moldworm_OnCollision(MoldwormEntity* this) { } if (super->health == 0 && this->unk_7f == 0 && super->action == 7) { - CopyPosition(super, &gPlayerEntity); - gPlayerEntity.flags |= ENT_COLLIDE; - gPlayerEntity.spriteSettings.draw = 1; - gPlayerEntity.zVelocity = Q_16_16(1.5); - gPlayerEntity.direction = 0xff; - gPlayerEntity.iframes = -0x14; + CopyPosition(super, &gPlayerEntity.base); + gPlayerEntity.base.flags |= ENT_COLLIDE; + gPlayerEntity.base.spriteSettings.draw = 1; + gPlayerEntity.base.zVelocity = Q_16_16(1.5); + gPlayerEntity.base.direction = 0xff; + gPlayerEntity.base.iframes = -0x14; gPlayerState.jump_status = 0x41; gPlayerState.flags &= ~PL_MOLDWORM_CAPTURED; } @@ -183,9 +183,9 @@ void sub_08023288(MoldwormEntity* this) { u32 i; for (i = 0; i < 0x10; i++) { - u32 x = gPlayerEntity.x.HALF.HI + gUnk_080CBC70[idx + 0]; - u32 y = gPlayerEntity.y.HALF.HI + gUnk_080CBC70[idx + 1]; - if (sub_08023A38(GetTileTypeByPos(x, y, gPlayerEntity.collisionLayer))) { + u32 x = gPlayerEntity.base.x.HALF.HI + gUnk_080CBC70[idx + 0]; + u32 y = gPlayerEntity.base.y.HALF.HI + gUnk_080CBC70[idx + 1]; + if (sub_08023A38(GetTileTypeByPos(x, y, gPlayerEntity.base.collisionLayer))) { sub_08023990(this, x, y); return; } @@ -282,7 +282,7 @@ void sub_080234D8(MoldwormEntity* this) { } void sub_0802351C(MoldwormEntity* this) { - if ((super->timer != 0) && ((super->type2 == 1) || (gPlayerEntity.frameIndex == 0xff))) { + if ((super->timer != 0) && ((super->type2 == 1) || (gPlayerEntity.base.frameIndex == 0xff))) { super->timer = 0; super->child->action = 3; super->child->subtimer = this->unk_80; @@ -292,10 +292,10 @@ void sub_0802351C(MoldwormEntity* this) { if (this->unk_7f == 0) { if (super->type2 == 0) { - gPlayerEntity.animationState = super->animationState & 7; + gPlayerEntity.base.animationState = super->animationState & 7; gPlayerState.flags |= PL_MOLDWORM_CAPTURED; - PositionRelative(super, &gPlayerEntity, 0, Q_16_16(gUnk_080CBC90[super->animationState & 7])); - gPlayerEntity.spriteOffsetY = -gUnk_080CBC90[super->animationState & 7]; + PositionRelative(super, &gPlayerEntity.base, 0, Q_16_16(gUnk_080CBC90[super->animationState & 7])); + gPlayerEntity.base.spriteOffsetY = -gUnk_080CBC90[super->animationState & 7]; } } else { super->action = 4; @@ -429,13 +429,13 @@ void sub_08023894(MoldwormEntity* this) { InitializeAnimation(super, super->animationState); if (super->parent->type2 == 0) { gPlayerState.flags |= PL_MOLDWORM_RELEASED; - gPlayerEntity.x.HALF.HI = super->x.HALF.HI; - gPlayerEntity.y.HALF.HI = super->y.HALF.HI; - gPlayerEntity.direction = DirectionRoundUp(GetFacingDirection(this->unk_74, super)); - gPlayerEntity.animationState = gPlayerEntity.direction >> 2; - gPlayerEntity.iframes = 12; + gPlayerEntity.base.x.HALF.HI = super->x.HALF.HI; + gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI; + gPlayerEntity.base.direction = DirectionRoundUp(GetFacingDirection(this->unk_74, super)); + gPlayerEntity.base.animationState = gPlayerEntity.base.direction >> 2; + gPlayerEntity.base.iframes = 12; ModHealth(-0x10); - SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); + SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6); } } } @@ -482,7 +482,7 @@ void sub_08023990(MoldwormEntity* this, u32 param_2, u32 param_3) { super->spritePriority.b0 = 7; super->x.HALF.HI = param_2; super->y.HALF.HI = param_3; - super->collisionLayer = gPlayerEntity.collisionLayer; + super->collisionLayer = gPlayerEntity.base.collisionLayer; UpdateSpriteForCollisionLayer(super); InitializeAnimation(super, 0x16); diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c index 00f5d79f..4b3531f8 100644 --- a/src/enemy/octorokBoss.c +++ b/src/enemy/octorokBoss.c @@ -228,7 +228,7 @@ void OctorokBoss_Hit_SubAction2(OctorokBossEntity* this) { } else { super->subAction = 3; this->timer = 150; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; } } @@ -389,9 +389,9 @@ void OctorokBoss_Init(OctorokBossEntity* this) { super->action = INTRO; super->subAction = 0; this->timer = 0x3c; - gPlayerEntity.spriteSettings.draw = 0; - gPlayerEntity.x.HALF.HI = super->x.HALF.HI; - gPlayerEntity.y.HALF.HI = super->y.HALF.HI - 0xa0; + gPlayerEntity.base.spriteSettings.draw = 0; + gPlayerEntity.base.x.HALF.HI = super->x.HALF.HI; + gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI - 0xa0; gRoomControls.camera_target = super; break; case LEG_BR: @@ -476,8 +476,8 @@ void OctorokBoss_Intro_SubAction2(OctorokBossEntity* this) { if (this->timer-- == 0) { super->subAction = 3; this->timer = 60; - gPlayerEntity.spriteSettings.draw |= 1; - gRoomControls.camera_target = &gPlayerEntity; + gPlayerEntity.base.spriteSettings.draw |= 1; + gRoomControls.camera_target = &gPlayerEntity.base; gRoomControls.scrollSpeed = 1; } } @@ -486,8 +486,8 @@ void OctorokBoss_Intro_SubAction3(OctorokBossEntity* this) { // Move the camera to the player if (this->timer-- == 0) { // Move the player inside the arena - gPlayerEntity.direction = 0x10; - gPlayerEntity.animationState = 4; + gPlayerEntity.base.direction = 0x10; + gPlayerEntity.base.animationState = 4; sub_08078AC0(0x1e, 0, 0); this->timer = 60; super->subAction = 4; @@ -499,22 +499,22 @@ void OctorokBoss_Intro_SubAction4(OctorokBossEntity* this) { super->subAction = 5; this->timer = 45; // Make the player look towards the exit - gPlayerEntity.animationState = 0; + gPlayerEntity.base.animationState = 0; } else { // Spawn exclamation bubble at a certain time if (this->timer == 0x1e) { - CreateSpeechBubbleExclamationMark(&gPlayerEntity, 0xc, -0x18); + CreateSpeechBubbleExclamationMark(&gPlayerEntity.base, 0xc, -0x18); } } } void OctorokBoss_Intro_SubAction5(OctorokBossEntity* this) { - if (gPlayerEntity.animationState == 4) { + if (gPlayerEntity.base.animationState == 4) { if (this->timer++ > 0x1e) { // Play boss theme, enable control and switch to main action super->action = ACTION1; super->subAction = 0; - gRoomControls.scrollSpeed = gPlayerEntity.animationState; + gRoomControls.scrollSpeed = gPlayerEntity.base.animationState; OctorokBoss_SetAttackTimer(this); gPauseMenuOptions.disabled = 0; SoundReq(BGM_BOSS_THEME); @@ -522,7 +522,7 @@ void OctorokBoss_Intro_SubAction5(OctorokBossEntity* this) { } else { if (this->timer-- == 0) { // Player looks back towards Octorok - gPlayerEntity.animationState = 4; + gPlayerEntity.base.animationState = 4; } } } @@ -689,7 +689,7 @@ void OctorokBoss_Action1_AimTowardsPlayer(OctorokBossEntity* this) { s32 tmp1; s32 tmp2; - tmp1 = (u8)(sub_080045DA(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD) - + tmp1 = (u8)(sub_080045DA(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD) - (((u8)(-this->angle.HALF.HI) ^ 0x80))); if (IS_FROZEN(this) == FALSE) { tmp2 = 8; @@ -792,13 +792,13 @@ void OctorokBoss_Action1_Attack(OctorokBossEntity* this) { sub_08036FE4(this); if (this->unk_80 != 0) { - gPlayerEntity.spriteSettings.draw = 0; - gPlayerEntity.flags &= ~ENT_COLLIDE; - gPlayerEntity.collisionLayer = 2; + gPlayerEntity.base.spriteSettings.draw = 0; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.collisionLayer = 2; PausePlayer(); PutAwayItems(); - gPlayerEntity.parent = super; - sub_08036914(&gPlayerEntity, (u8) - (this->angle.HALF.HI + 0x80), 0x3800); + gPlayerEntity.base.parent = super; + sub_08036914(&gPlayerEntity.base, (u8) - (this->angle.HALF.HI + 0x80), 0x3800); } } @@ -897,17 +897,18 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) { s32 tmp; if (this->unk_80 == 0) { - super->direction = sub_080045DA(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD); + super->direction = + sub_080045DA(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD); tmp = ((u8) - (this->angle.HALF.HI + 0x80)) - super->direction; if (tmp < 0) { tmp = -tmp; } if (tmp < 0x10) { - if (sub_0806FC80(super, &gPlayerEntity, 0xf0) != 0) { + if (sub_0806FC80(super, &gPlayerEntity.base, 0xf0) != 0) { if ((gPlayerState.flags & PL_FROZEN) == 0) { - if ((gPlayerEntity.flags & PL_MINISH) != 0) { - LinearMoveAngle(&gPlayerEntity, 0x280, -this->angle.HALF.HI); - if (sub_0806FC80(super, &gPlayerEntity, 0x48) != 0) { + if ((gPlayerEntity.base.flags & PL_MINISH) != 0) { + LinearMoveAngle(&gPlayerEntity.base, 0x280, -this->angle.HALF.HI); + if (sub_0806FC80(super, &gPlayerEntity.base, 0x48) != 0) { this->unk_80 = 1; this->timer = 2; this->heap->targetAngle = @@ -938,9 +939,9 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) { this->unk_80 = 0; this->angularSpeed.HWORD = 0x100; this->heap->mouthObject->timer++; - gPlayerEntity.spriteSettings.draw = 1; - gPlayerEntity.flags &= ~ENT_COLLIDE; - gPlayerEntity.collisionLayer = 1; + gPlayerEntity.base.spriteSettings.draw = 1; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.collisionLayer = 1; sub_080792BC(0x400, (u32)(-(this->angle.HALF.HI + 0x80) * 0x1000000) >> 0x1b, 0x30); OctorokBoss_SetAttackTimer(this); SoundReq(SFX_EF); @@ -955,7 +956,7 @@ void OctorokBoss_ExecuteAttackVacuum(OctorokBossEntity* this) { } else { this->timer--; if ((gPlayerState.flags == PL_FROZEN) && (this->timer == 0x3c)) { - tmp = sub_080045DA(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD); + tmp = sub_080045DA(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD); if ((u8)((tmp - ((u8) - this->angle.HALF.HI ^ 0x80))) > 0x80) { this->heap->targetAngle = this->angle.HALF.HI + 0x30; } else { @@ -1083,9 +1084,9 @@ void OctorokBoss_Burning_SubAction2(OctorokBossEntity* this) { void sub_080368D8(OctorokBossEntity* this) { if (this->unk_80 != 0) { - gPlayerEntity.spriteSettings.draw = 1; - gPlayerEntity.flags |= ENT_COLLIDE; - gPlayerEntity.collisionLayer = 1; + gPlayerEntity.base.spriteSettings.draw = 1; + gPlayerEntity.base.flags |= ENT_COLLIDE; + gPlayerEntity.base.collisionLayer = 1; } this->unk_76 = 0xa0; this->unk_74 = 0xa0; diff --git a/src/enemy/octorokGolden.c b/src/enemy/octorokGolden.c index a3295b7c..80342aa7 100644 --- a/src/enemy/octorokGolden.c +++ b/src/enemy/octorokGolden.c @@ -102,7 +102,7 @@ static void sub_08037D54(Entity* this) { this->animationState |= 0xff; sub_08037E14(this); } else { - u32 dir = GetFacingDirection(this, &gPlayerEntity); + u32 dir = GetFacingDirection(this, &gPlayerEntity.base); this->direction = (dir + 4) & 0x18; this->animationState = this->direction >> 3; InitializeAnimation(this, this->animationState + 4); @@ -116,7 +116,7 @@ void sub_08037E14(Entity* this) { const s8* ptr; s32 x, y; this->timer = 8; - dir = (GetFacingDirection(this, &gPlayerEntity) + 4) & 0x18; + dir = (GetFacingDirection(this, &gPlayerEntity.base) + 4) & 0x18; layer = (u8*)GetLayerByIndex(this->collisionLayer)->collisionData; ptr = gUnk_080CF498 + (dir >> 2); x = this->x.HALF.HI + *ptr; @@ -135,7 +135,7 @@ void sub_08037E14(Entity* this) { } bool32 sub_08037E90(Entity* this) { - u32 dir = sub_0804A044(this, &gPlayerEntity, 8); + u32 dir = sub_0804A044(this, &gPlayerEntity.base, 8); if (dir != 0xff) { this->action = 2; this->timer = 3; diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 612df286..037bd7db 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -126,7 +126,7 @@ void sub_08024060(PestoEntity* this) { if (super->hitType != 0x6e) { COLLISION_OFF(super); super->hitType = 0x6e; - super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; + super->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; } GetNextFrame(super); @@ -199,7 +199,7 @@ void sub_080241C0(PestoEntity* this) { switch (this->unk_80) { case 0: if (PlayerInRange(super, 3, (gPlayerState.hurtBlinkSpeed != 0) ? 0xa0 : 0x40) && sub_08049FDC(super, 3) && - gPlayerEntity.action != PLAYER_USEENTRANCE) { + gPlayerEntity.base.action != PLAYER_USEENTRANCE) { this->unk_80++; super->speed = 0; sub_08024A14(this, 3, 10); @@ -408,8 +408,8 @@ void sub_080244E8(PestoEntity* this) { this->unk_84 = 0; super->flags2 &= 0xfc; sub_080249DC(this); - this->unk_85 = gPlayerEntity.spritePriority.b1; - gPlayerEntity.flags &= ~ENT_COLLIDE; + this->unk_85 = gPlayerEntity.base.spritePriority.b1; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; gPlayerState.flags |= PL_DISABLE_ITEMS; gPlayerState.field_0xa |= 0x80; if (gPlayerState.swim_state != 0) { @@ -526,7 +526,7 @@ void sub_080244E8(PestoEntity* this) { } break; case 7: - if (gPlayerEntity.z.HALF.HI == 0) { + if (gPlayerEntity.base.z.HALF.HI == 0) { this->unk_80 = 0; super->speed = 0x80; sub_08024B38(this); @@ -843,7 +843,7 @@ void sub_08024E4C(PestoEntity* this) { super->subtimer = 8; sub_08024A14(this, 0, 8); } else { - Entity* player = &gPlayerEntity; + Entity* player = &gPlayerEntity.base; ResetActiveItems(); gPlayerState.flags |= PL_DISABLE_ITEMS; gPlayerState.field_0xa |= 0x80; @@ -868,15 +868,15 @@ void sub_08024E4C(PestoEntity* this) { void sub_08024F50(PestoEntity* this) { gPlayerState.field_0xa = 0; gPlayerState.flags &= ~PL_DISABLE_ITEMS; - CopyPosition(super, &gPlayerEntity); - gPlayerEntity.action = PLAYER_NORMAL; - COLLISION_ON(&gPlayerEntity); - gPlayerEntity.iframes = -0x3c; - gPlayerEntity.direction = gPlayerEntity.animationState << 2; - gPlayerEntity.speed = 0; - gPlayerEntity.spritePriority.b1 = this->unk_85; - gPlayerEntity.z.HALF.HI = gPlayerEntity.spriteOffsetY; - gPlayerEntity.spriteOffsetY = 0; + CopyPosition(super, &gPlayerEntity.base); + gPlayerEntity.base.action = PLAYER_NORMAL; + COLLISION_ON(&gPlayerEntity.base); + gPlayerEntity.base.iframes = -0x3c; + gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2; + gPlayerEntity.base.speed = 0; + gPlayerEntity.base.spritePriority.b1 = this->unk_85; + gPlayerEntity.base.z.HALF.HI = gPlayerEntity.base.spriteOffsetY; + gPlayerEntity.base.spriteOffsetY = 0; super->flags2 |= 3; this->unk_83 = 0xc0; this->unk_80 += 2; diff --git a/src/enemy/rollobite.c b/src/enemy/rollobite.c index db273ef7..62f6e2d6 100644 --- a/src/enemy/rollobite.c +++ b/src/enemy/rollobite.c @@ -152,17 +152,17 @@ void sub_08020874(RollobiteEntity* this) { void sub_0802088C(RollobiteEntity* this) { super->subAction = 1; COLLISION_OFF(super); - this->unk_85 = gPlayerEntity.animationState; + this->unk_85 = gPlayerEntity.base.animationState; super->spritePriority.b1 = 0; } void sub_080208B4(RollobiteEntity* this) { - s8 uVar1 = (this->unk_85 - gPlayerEntity.animationState) / 2; + s8 uVar1 = (this->unk_85 - gPlayerEntity.base.animationState) / 2; if (uVar1) { super->animationState = (super->animationState + uVar1) & 3; InitializeAnimation(super, super->animationState + 0x10); } - this->unk_85 = gPlayerEntity.animationState; + this->unk_85 = gPlayerEntity.base.animationState; } void sub_080208F0(RollobiteEntity* this) { diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c index 77a76670..fd83dc53 100644 --- a/src/enemy/ropeGolden.c +++ b/src/enemy/ropeGolden.c @@ -86,8 +86,8 @@ void sub_0803827C(RopeGoldenEntity* this) { if (super->subtimer != 0) { super->subtimer--; } else { - if ((sub_0804A044(super, &gPlayerEntity, 0x8) != 0xff) || - (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x24) != 0)) { + if ((sub_0804A044(super, &gPlayerEntity.base, 0x8) != 0xff) || + (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x24) != 0)) { sub_080383E4(this); return; } @@ -157,7 +157,7 @@ void sub_080383AC(RopeGoldenEntity* this) { super->action = 1; super->timer = 8; super->speed = 0x100; - super->direction = DirectionRoundUp(GetFacingDirection(super, &gPlayerEntity)); + super->direction = DirectionRoundUp(GetFacingDirection(super, &gPlayerEntity.base)); v = super->direction >> 3; if (v != super->animationState) { super->animationState = v; @@ -170,7 +170,7 @@ void sub_080383E4(RopeGoldenEntity* this) { super->action = 2; super->timer = 8; super->speed = 0x280; - v = DirectionRoundUp(GetFacingDirection(super, &gPlayerEntity)); + v = DirectionRoundUp(GetFacingDirection(super, &gPlayerEntity.base)); super->direction = v; this->unk_78 = v; super->animationState = super->direction >> 3; diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index bea1fe2e..b749e900 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -76,7 +76,7 @@ void RupeeLike_OnCollision(RupeeLikeEntity* this) { super->subtimer = 0; this->unk_83 = 0x41; super->flags2 &= 0xfc; - this->unk_80 = gPlayerEntity.spritePriority.b1; + this->unk_80 = gPlayerEntity.base.spritePriority.b1; EnqueueSFX(SFX_PLACE_OBJ); } else { if (super->confusedTime != 0) { @@ -131,7 +131,7 @@ void sub_08029474(RupeeLikeEntity* this) { if (super->frame & ANIM_DONE) { super->action = 3; super->timer = 8; - bVar1 = GetFacingDirection(super, &gPlayerEntity); + bVar1 = GetFacingDirection(super, &gPlayerEntity.base); super->direction = bVar1; super->animationState = (bVar1 << 0x18) >> 0x1c; InitializeAnimation(super, super->animationState); @@ -148,7 +148,7 @@ void sub_080294D4(RupeeLikeEntity* this) { if (sub_08049FDC(super, 1) != 0) { if (--super->timer == 0) { super->timer = 8; - sub_08004596(super, GetFacingDirection(super, &gPlayerEntity)); + sub_08004596(super, GetFacingDirection(super, &gPlayerEntity.base)); sub_0802969C(this); } ProcessMovement0(super); @@ -177,11 +177,11 @@ void sub_0802953C(RupeeLikeEntity* this) { } else { ResetActiveItems(); gPlayerState.mobility |= 0x80; - PositionRelative(super, &gPlayerEntity, 0, Q_16_16(1.0)); + PositionRelative(super, &gPlayerEntity.base, 0, Q_16_16(1.0)); pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)super->spriteIndex, super->frameIndex); - gPlayerEntity.spriteOffsetX = pbVar3[0]; - gPlayerEntity.spriteOffsetY = pbVar3[1] - 1; - gPlayerEntity.spritePriority.b1 = 0; + gPlayerEntity.base.spriteOffsetX = pbVar3[0]; + gPlayerEntity.base.spriteOffsetY = pbVar3[1] - 1; + gPlayerEntity.base.spritePriority.b1 = 0; if (--this->unk_83 == 0) { this->unk_83 = 0x41; if (gSave.stats.rupees != 0) { @@ -245,14 +245,14 @@ void sub_080296C8(RupeeLikeEntity* this) { void sub_080296D8(RupeeLikeEntity* this) { gPlayerState.jump_status = 0x41; gPlayerState.flags &= ~PL_CAPTURED; - gPlayerEntity.flags |= ENT_COLLIDE; - gPlayerEntity.zVelocity = Q_16_16(1.5); - gPlayerEntity.iframes = 0xa6; - gPlayerEntity.z.HALF.HI = -2; - gPlayerEntity.direction = gPlayerEntity.animationState << 2; - gPlayerEntity.spritePriority.b1 = this->unk_80; - gPlayerEntity.spriteOffsetY = 0; - gPlayerEntity.speed = 0x140; + gPlayerEntity.base.flags |= ENT_COLLIDE; + gPlayerEntity.base.zVelocity = Q_16_16(1.5); + gPlayerEntity.base.iframes = 0xa6; + gPlayerEntity.base.z.HALF.HI = -2; + gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2; + gPlayerEntity.base.spritePriority.b1 = this->unk_80; + gPlayerEntity.base.spriteOffsetY = 0; + gPlayerEntity.base.speed = 0x140; super->action = 5; super->subtimer = 60; super->flags2 |= 3; diff --git a/src/enemy/spinyBeetle.c b/src/enemy/spinyBeetle.c index 8f5dd46f..67cb1ebd 100644 --- a/src/enemy/spinyBeetle.c +++ b/src/enemy/spinyBeetle.c @@ -134,19 +134,19 @@ void sub_08033958(SpinyBeetleEntity* this) { case 0: if (this->unk_78 == 0) return; - if (super->y.HALF.HI - gPlayerEntity.y.HALF.HI > 0x30) + if (super->y.HALF.HI - gPlayerEntity.base.y.HALF.HI > 0x30) return; break; case 0x10: - if (gPlayerEntity.y.HALF.HI - super->y.HALF.HI > 0x30) + if (gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI > 0x30) return; break; case 8: - if (gPlayerEntity.x.HALF.HI - super->x.HALF.HI > 0x30) + if (gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI > 0x30) return; break; case 0x18: - if (super->x.HALF.HI - gPlayerEntity.x.HALF.HI > 0x30) + if (super->x.HALF.HI - gPlayerEntity.base.x.HALF.HI > 0x30) return; break; } diff --git a/src/enemy/stalfos.c b/src/enemy/stalfos.c index 1cbdc67a..98e75b9c 100644 --- a/src/enemy/stalfos.c +++ b/src/enemy/stalfos.c @@ -170,7 +170,7 @@ void Stalfos_Init(StalfosEntity* this) { } else { super->action = 4; super->direction = 0xff; - super->animationState = (((GetFacingDirection(super, &gPlayerEntity) + 4) & 0x18) >> 3); + super->animationState = (((GetFacingDirection(super, &gPlayerEntity.base) + 4) & 0x18) >> 3); sub_0803981C(this); } } @@ -347,7 +347,7 @@ u32 sub_080398C0(StalfosEntity* this) { u32 rand = Random(); if ((super->type == 0) && sub_08049FDC(super, 1) && (EntityWithinDistance(super, gUnk_020000B0->x.HALF.HI, gUnk_020000B0->y.HALF.HI, 0x58) != 0)) { - return GetFacingDirection(super, &gPlayerEntity); + return GetFacingDirection(super, &gPlayerEntity.base); } else { if ((sub_08049FA0(super) == 0) && ((rand & 7) != 0)) { return sub_08049EE4(super); diff --git a/src/enemy/sub_080451CC.c b/src/enemy/sub_080451CC.c index 05425c9c..85379354 100644 --- a/src/enemy/sub_080451CC.c +++ b/src/enemy/sub_080451CC.c @@ -1,13 +1,12 @@ -#define ENT_DEPRECATED #include "entity.h" -void sub_080451CC(Entity* this, Entity* other) { +void sub_080451CC(GenericEntity* this, GenericEntity* other) { u8* pThis; u8* pOther; - other->flags = this->flags & ~ENT_DID_INIT; - other->x.WORD = this->x.WORD; - other->y.WORD = this->y.WORD; - other->z.WORD = this->z.WORD; + other->base.flags = this->base.flags & ~ENT_DID_INIT; + other->base.x.WORD = this->base.x.WORD; + other->base.y.WORD = this->base.y.WORD; + other->base.z.WORD = this->base.z.WORD; pThis = (u8*)&this->field_0x68; pOther = (u8*)&other->field_0x68; diff --git a/src/enemy/treeItem.c b/src/enemy/treeItem.c index b953432d..7ce1dc35 100644 --- a/src/enemy/treeItem.c +++ b/src/enemy/treeItem.c @@ -83,11 +83,11 @@ static bool32 ShouldSpawnTreeItem(TreeItemEntity* this) { s32 expectedStateX, expectedStateY; s32 playerState; - if (gPlayerEntity.action != PLAYER_BOUNCE) { + if (gPlayerEntity.base.action != PLAYER_BOUNCE) { return FALSE; } - diff = gPlayerEntity.x.HALF.HI - super->x.HALF.HI; + diff = gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI; expectedStateX = 6; if (diff & 0x8000) { expectedStateX = 2; @@ -98,7 +98,7 @@ static bool32 ShouldSpawnTreeItem(TreeItemEntity* this) { return FALSE; } - diff = gPlayerEntity.y.HALF.HI - super->y.HALF.HI; + diff = gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI; expectedStateY = 0; if (diff & 0x8000) { expectedStateY = 4; @@ -109,7 +109,7 @@ static bool32 ShouldSpawnTreeItem(TreeItemEntity* this) { return FALSE; } - playerState = gPlayerEntity.animationState; + playerState = gPlayerEntity.base.animationState; if ((playerState == 0 && expectedStateY == 0) || (playerState == 4 && expectedStateY == 4) || (playerState == 6 && expectedStateX == 6) || (playerState == 2 && expectedStateX == 2)) { return TRUE; diff --git a/src/enemy/vaatiArm.c b/src/enemy/vaatiArm.c index 2558f5f0..476730df 100644 --- a/src/enemy/vaatiArm.c +++ b/src/enemy/vaatiArm.c @@ -555,8 +555,8 @@ static void sub_08042C34(VaatiArmEntity* this) { super->subAction = 1; random = Random() & 6; temp = &gUnk_080D12F8[random]; - x = gPlayerEntity.x.HALF.HI + *temp; - y = gPlayerEntity.y.HALF.HI + *(temp + 1); + x = gPlayerEntity.base.x.HALF.HI + *temp; + y = gPlayerEntity.base.y.HALF.HI + *(temp + 1); if ((gRoomControls.origin_x + 0x20) > x) { x = gRoomControls.origin_x + 0x20; } @@ -693,7 +693,7 @@ static void sub_08042EF4(VaatiArmEntity* this) { UpdateAnimationSingleFrame(super); if (!sub_08043C98(this)) { if (--super->timer == 0) { - if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x50)) { + if (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x50)) { super->subAction = 6; super->timer = 40; } else { diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c index 3c0d04e5..714e7ec9 100644 --- a/src/enemy/vaatiEyesMacro.c +++ b/src/enemy/vaatiEyesMacro.c @@ -183,7 +183,7 @@ void VaatiEyesMacroFunction0Type2(VaatiEyesMacroEntity* this) { super->animationState = 0xff; } CopyPositionAndSpriteOffset(super->parent, super); - uVar2 = (GetFacingDirection(super, &gPlayerEntity) + 1) & 0x1e; + uVar2 = (GetFacingDirection(super, &gPlayerEntity.base) + 1) & 0x1e; temp = (xy*)&gUnk_080CDE70[uVar2]; if (temp->x != super->frameIndex) { if (temp->y != super->frameIndex) { @@ -237,7 +237,7 @@ void sub_0802EFB8(VaatiEyesMacroEntity* this) { if ((rand >> 0x10 & 3) != 0) { uVar1 = rand & 0x18; } else { - uVar3 = GetFacingDirection(&gPlayerEntity, super); + uVar3 = GetFacingDirection(&gPlayerEntity.base, super); uVar1 = (uVar3 + 4) & 0x18; } iVar4 = sub_080B1B44(TILE(super->x.HALF.HI, super->y.HALF.HI) + gUnk_080B4488[((uVar1) >> 3)], 1); diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index 666d5fa5..a202f9a3 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -73,9 +73,9 @@ void VaatiProjectile_OnCollision(VaatiProjectileEntity* this) { super->action = 5; COLLISION_OFF(super); super->spritePriority.b1 = 0; - gPlayerEntity.flags &= ~ENT_COLLIDE; - gPlayerEntity.spriteOrientation.flipY = super->spriteOrientation.flipY; - gPlayerEntity.spriteRendering.b3 = super->spriteRendering.b3; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.spriteOrientation.flipY = super->spriteOrientation.flipY; + gPlayerEntity.base.spriteRendering.b3 = super->spriteRendering.b3; sub_0803E444(this); #ifndef EU SetPlayerControl(2); @@ -85,8 +85,8 @@ void VaatiProjectile_OnCollision(VaatiProjectileEntity* this) { } } else { gPlayerState.flags &= ~PL_DISABLE_ITEMS; - entity = &gPlayerEntity; - entity->flags = gPlayerEntity.flags | ENT_COLLIDE; + entity = &gPlayerEntity.base; + entity->flags = gPlayerEntity.base.flags | ENT_COLLIDE; } #endif } @@ -174,7 +174,7 @@ void VaatiProjectileFunction0Action3(VaatiProjectileEntity* this) { void VaatiProjectileFunction0Action4(VaatiProjectileEntity* this) { if (--super->timer == 0) { super->action = 1; - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); } GetNextFrame(super); } @@ -221,8 +221,8 @@ void VaatiProjectileFunction0Action8(VaatiProjectileEntity* this) { } void VaatiProjectileFunction0Action9(VaatiProjectileEntity* this) { - super->x.HALF.HI = gPlayerEntity.x.HALF.HI; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI; + super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI; if (super->z.HALF.HI < -8) { if (super->animIndex != 2) { super->timer = 0; @@ -239,7 +239,7 @@ void sub_0803E444(VaatiProjectileEntity* this) { gPlayerState.mobility |= 0x80; gPlayerState.field_0xa |= 0x80; sub_0806FA90(super, super->contactedEntity, 0, -2); - gPlayerEntity.spriteOffsetY += 0xe; + gPlayerEntity.base.spriteOffsetY += 0xe; } void sub_0803E480(VaatiProjectileEntity* this) { @@ -284,7 +284,7 @@ void sub_0803E4D8(VaatiProjectileEntity* this) { u32 tile; tile = TILE(super->x.HALF.HI, super->y.HALF.HI + 8); - if (sub_080B1B44(tile, gPlayerEntity.collisionLayer) != 0xff) { - SetTile(0x4074, tile, gPlayerEntity.collisionLayer); + if (sub_080B1B44(tile, gPlayerEntity.base.collisionLayer) != 0xff) { + SetTile(0x4074, tile, gPlayerEntity.base.collisionLayer); } } diff --git a/src/enemy/vaatiRebornEnemy.c b/src/enemy/vaatiRebornEnemy.c index 64ec55b0..7ff9174e 100644 --- a/src/enemy/vaatiRebornEnemy.c +++ b/src/enemy/vaatiRebornEnemy.c @@ -281,8 +281,8 @@ void VaatiRebornEnemyType0Action2(VaatiRebornEnemyEntity* this) { if ((super->frame & ANIM_DONE) != 0) { super->spriteSettings.draw = 1; if (4 < this->unk_81) { - super->x.HALF.HI = gPlayerEntity.x.HALF.HI; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0x18; + super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI - 0x18; } if (--this->unk_77 == 0) { super->action = 1; @@ -364,7 +364,7 @@ void VaatiRebornEnemyType0Action4(VaatiRebornEnemyEntity* this) { if ((super->frame & 0x10) != 0) { super->frame &= 0xef; if (this->unk_84 == 0xff) { - index = Direction8RoundUp(GetFacingDirection(super, &gPlayerEntity)); + index = Direction8RoundUp(GetFacingDirection(super, &gPlayerEntity.base)); this->unk_84 = gUnk_080D04C0[index >> 2]; super->subtimer = 0; } @@ -410,7 +410,7 @@ void VaatiRebornEnemyType0Action5(VaatiRebornEnemyEntity* this) { if (!((this->unk_86 < 2) || (3 < this->unk_87)) && (Random() & 0x10) != 0) { this->unk_87++; super->subtimer = (Random() & 0x3f) + 64; - uVar3 = GetFacingDirection(super, &gPlayerEntity); + uVar3 = GetFacingDirection(super, &gPlayerEntity.base); super->direction = (uVar3 & 0x10) | DirectionEast; } else { this->unk_74++; @@ -903,15 +903,15 @@ u32 sub_0803E028(VaatiRebornEnemyEntity* this) { return ret; } tmp = gRoomControls.origin_x + 0x58; - if (tmp > gPlayerEntity.x.HALF.HI) { + if (tmp > gPlayerEntity.base.x.HALF.HI) { return ret; } tmp = gRoomControls.origin_y + 0x58; - if (tmp > gPlayerEntity.x.HALF.HI) { + if (tmp > gPlayerEntity.base.x.HALF.HI) { return ret; } tmp = gRoomControls.origin_y + 0xf8; - if (tmp >= gPlayerEntity.x.HALF.HI) { + if (tmp >= gPlayerEntity.base.x.HALF.HI) { this->unk_81 += 5; ret = 1; } diff --git a/src/enemy/vaatiTransfigured.c b/src/enemy/vaatiTransfigured.c index e84b14f8..265b5a98 100644 --- a/src/enemy/vaatiTransfigured.c +++ b/src/enemy/vaatiTransfigured.c @@ -676,7 +676,7 @@ void VaatiTransfiguredType2Action1(VaatiTransfiguredEntity* this) { CopyPosition(super->parent, super); switch (super->type2) { case 2: - uVar3 = GetFacingDirection(super, &gPlayerEntity); + uVar3 = GetFacingDirection(super, &gPlayerEntity.base); t = &gUnk_080D0B18[uVar3]; super->x.HALF.HI += t->x; super->y.HALF.HI += t->y; diff --git a/src/enemy/vaatiWrath.c b/src/enemy/vaatiWrath.c index 8ad668b8..b8bd9b20 100644 --- a/src/enemy/vaatiWrath.c +++ b/src/enemy/vaatiWrath.c @@ -5,9 +5,9 @@ * @brief Vaati Wrath enemy */ #include "enemy/vaatiWrath.h" + #include "functions.h" #include "message.h" -#include "new_player.h" #include "object.h" #include "save.h" #include "screen.h" @@ -217,7 +217,7 @@ void VaatiWrathType0Action1(VaatiWrathEntity* this) { super->subAction = 6; super->timer = 30; gRoomTransition.field_0x38 |= 1; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; gPlayerState.controlMode = CONTROL_1; break; default: @@ -421,7 +421,7 @@ void VaatiWrathType0Action9(VaatiWrathEntity* this) { sub_08042214(this); } else { if (--super->timer == 0) { - if ((gPlayerEntity.x.HALF.HI - super->x.HALF.HI) + 0x40u < 0x81) { + if ((gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI) + 0x40u < 0x81) { super->action = 10; this->unk_7b = 0; ((VaatiWrathHeapStruct*)super->myHeap)->eyes[0]->timer = 1; @@ -588,7 +588,7 @@ void sub_08041BE8(VaatiWrathEntity* this) { DeleteEntity(entity); ((VaatiWrathHeapStruct*)super->myHeap)->object5b = NULL; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; #endif entity = ((VaatiWrathHeapStruct*)super->myHeap)->eyes[0]; entity->myHeap = NULL; @@ -834,13 +834,13 @@ u32 sub_0804207C(VaatiWrathEntity* this) { if (((arm != NULL) && (arm->action >= 5)) && EntityWithinDistance(arm, x, y, 0x30)) { return CalculateDirectionTo(arm->x.HALF.HI, arm->y.HALF.HI, x, y); } else { - if (gPlayerEntity.y.HALF.HI < 0x40) { + if (gPlayerEntity.base.y.HALF.HI < 0x40) { tmp = gRoomControls.origin_y + 0x18; } else { - tmp = gPlayerEntity.y.HALF.HI - 0x28; + tmp = gPlayerEntity.base.y.HALF.HI - 0x28; } - return CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gPlayerEntity.x.HALF.HI, tmp); + return CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gPlayerEntity.base.x.HALF.HI, tmp); } } } @@ -860,12 +860,12 @@ void sub_0804212C(VaatiWrathEntity* this) { } arm = NULL; y = super->y.HALF.HI - 0x44; - if (gPlayerEntity.y.HALF.HI - y < 0x61u) { + if (gPlayerEntity.base.y.HALF.HI - y < 0x61u) { x = super->x.HALF.HI - 0x38; - if (gPlayerEntity.x.HALF.HI - x < 0x39u) { + if (gPlayerEntity.base.x.HALF.HI - x < 0x39u) { arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[1]; } else { - if ((gPlayerEntity.x.HALF.HI - super->x.HALF.HI) < 0x39u) { + if ((gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI) < 0x39u) { arm = ((VaatiWrathHeapStruct*)super->myHeap)->arms[0]; } } @@ -1005,8 +1005,8 @@ void VaatiWrathType0PreAction(VaatiWrathEntity* this) { case PL_STATE_IDLE: case PL_STATE_WALK: if (gPlayerState.item == NULL) { - if (gNewPlayerEntity.unk_7a == 0) { - if ((gPlayerEntity.z.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) { + if (gPlayerEntity.unk_7a == 0) { + if ((gPlayerEntity.base.z.HALF.HI & 0x8000U) == 0 || (gPlayerState.field_0xa != 0)) { CreateEzloHint(TEXT_INDEX(TEXT_EZLO, 0x70), 0); gRoomTransition.field_0x38 |= 2; } @@ -1054,7 +1054,7 @@ void VaatiWrathType2(VaatiWrathEntity* this) { sub_0806FA90(((VaatiWrathHeapStruct*)super->myHeap)->type0, super, 0, -1); super->spriteOffsetY++; if (super->animIndex == 0x12) { - uVar1 = GetFacingDirection(super, &gPlayerEntity); + uVar1 = GetFacingDirection(super, &gPlayerEntity.base); super->x.HALF.HI = gUnk_080D0EB0[uVar1] + super->x.HALF.HI; } } diff --git a/src/enemy/wallMaster.c b/src/enemy/wallMaster.c index 1c72f15d..8f37a64f 100644 --- a/src/enemy/wallMaster.c +++ b/src/enemy/wallMaster.c @@ -42,9 +42,9 @@ void WallMaster_OnCollision(WallMasterEntity* this) { if (super->hitType != 0x75 && ((super->contactFlags & 0x7f) == 0 || (super->contactFlags & 0x7f) == 0x1e)) { super->action = 5; COLLISION_OFF(super); - this->unk_7e = gPlayerEntity.x.HALF.HI; - this->unk_80 = gPlayerEntity.y.HALF.HI; - this->unk_82 = gPlayerEntity.z.HALF.HI; + this->unk_7e = gPlayerEntity.base.x.HALF.HI; + this->unk_80 = gPlayerEntity.base.y.HALF.HI; + this->unk_82 = gPlayerEntity.base.z.HALF.HI; if (super->action != 3) { InitializeAnimation(super, 1); } @@ -150,12 +150,12 @@ void sub_0802A69C(WallMasterEntity* this) { sub_0802A7D0(this); gPlayerState.field_0xa |= 0x80; gPlayerState.mobility |= 0x80; - gPlayerEntity.x.HALF.HI = this->unk_7e; - gPlayerEntity.y.HALF.HI = this->unk_80; - gPlayerEntity.z.HALF.HI = this->unk_82; + gPlayerEntity.base.x.HALF.HI = this->unk_7e; + gPlayerEntity.base.y.HALF.HI = this->unk_80; + gPlayerEntity.base.z.HALF.HI = this->unk_82; - if (gPlayerEntity.z.HALF.HI != super->z.HALF.HI) { - if (gPlayerEntity.z.HALF.HI < super->z.HALF.HI) { + if (gPlayerEntity.base.z.HALF.HI != super->z.HALF.HI) { + if (gPlayerEntity.base.z.HALF.HI < super->z.HALF.HI) { super->z.HALF.HI--; } else { super->z.HALF.HI++; @@ -171,7 +171,7 @@ void sub_0802A69C(WallMasterEntity* this) { } else if (super->frame & 0x1) { super->frame = flags; super->spriteOffsetY = 3; - gPlayerEntity.spriteSettings.draw = 0; + gPlayerEntity.base.spriteSettings.draw = 0; } } diff --git a/src/enemy/wallMaster2.c b/src/enemy/wallMaster2.c index 34d7cb6a..e5a20d2c 100644 --- a/src/enemy/wallMaster2.c +++ b/src/enemy/wallMaster2.c @@ -49,7 +49,7 @@ void WallMaster2_OnCollision(WallMaster2Entity* this) { super->action = 3; COLLISION_OFF(super); InitializeAnimation(super, 1); - gPlayerEntity.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; break; } if (super->confusedTime != 0) { @@ -133,8 +133,8 @@ void sub_0802CE68(WallMaster2Entity* this) { gPlayerState.field_0xa |= 0x80; gPlayerState.mobility |= 0x80; gPlayerState.flags |= PL_DISABLE_ITEMS; - if (!EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 4)) { - super->direction = GetFacingDirection(super, &gPlayerEntity); + if (!EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 4)) { + super->direction = GetFacingDirection(super, &gPlayerEntity.base); LinearMoveUpdate(super); } sub_0802CFD8(this); @@ -145,7 +145,7 @@ void sub_0802CE68(WallMaster2Entity* this) { super->timer = 30; } else if (super->frame & 1) { super->frame = frames; - gPlayerEntity.spriteSettings.draw = 0; + gPlayerEntity.base.spriteSettings.draw = 0; } } diff --git a/src/enemy/waterDrop.c b/src/enemy/waterDrop.c index 6214d93e..fb2d13e2 100644 --- a/src/enemy/waterDrop.c +++ b/src/enemy/waterDrop.c @@ -76,8 +76,8 @@ void sub_0802A334(Entity* this) { } void sub_0802A39C(Entity* this) { - u32 x = (gPlayerEntity.x.HALF.HI - gRoomControls.scroll_x + gScreen.bg1.xOffset) >> 3; - u32 y = (gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y + gScreen.bg1.yOffset - 10) >> 3; + u32 x = (gPlayerEntity.base.x.HALF.HI - gRoomControls.scroll_x + gScreen.bg1.xOffset) >> 3; + u32 y = (gPlayerEntity.base.y.HALF.HI - gRoomControls.scroll_y + gScreen.bg1.yOffset - 10) >> 3; if (gBG3Buffer[(x & 0x1fU) + (y & 0x1fU) * 0x20 + 0x400]) { COLLISION_OFF(this); } else { diff --git a/src/enemy/wizzrobeFire.c b/src/enemy/wizzrobeFire.c index f81af162..356a8b1b 100644 --- a/src/enemy/wizzrobeFire.c +++ b/src/enemy/wizzrobeFire.c @@ -95,7 +95,7 @@ void WizzrobeFire_Action2(WizzrobeEntity* this) { super->child->spriteSettings.draw = 0; break; case 6: - if (EntityInRectRadius(super, &gPlayerEntity, 0xa0, 0xa0) && CheckOnScreen(super)) { + if (EntityInRectRadius(super, &gPlayerEntity.base, 0xa0, 0xa0) && CheckOnScreen(super)) { Entity* projectile = CreateProjectileWithParent(super, FIRE_PROJECTILE, 1); if (projectile != NULL) { projectile->direction = super->direction & 0x18; diff --git a/src/enemy/wizzrobeIce.c b/src/enemy/wizzrobeIce.c index 0d07a305..4df8891c 100644 --- a/src/enemy/wizzrobeIce.c +++ b/src/enemy/wizzrobeIce.c @@ -102,7 +102,7 @@ void WizzrobeIce_Action2(WizzrobeEntity* this) { super->child->spriteSettings.draw = 0; break; case 0xa: - if (EntityInRectRadius(super, &gPlayerEntity, 0xa0, 0xa0) && CheckOnScreen(super)) { + if (EntityInRectRadius(super, &gPlayerEntity.base, 0xa0, 0xa0) && CheckOnScreen(super)) { Entity* projectile = CreateProjectileWithParent(super, ICE_PROJECTILE, 1); if (projectile != NULL) { projectile->direction = super->direction & 0x18; diff --git a/src/enemy/wizzrobeWind.c b/src/enemy/wizzrobeWind.c index 57381154..ac1c3396 100644 --- a/src/enemy/wizzrobeWind.c +++ b/src/enemy/wizzrobeWind.c @@ -118,7 +118,7 @@ void WizzrobeWind_Action2(WizzrobeEntity* this) { super->parent->spriteSettings.draw = 0; break; case 8: - if (EntityInRectRadius(super, &gPlayerEntity, 0xa0, 0xa0) && CheckOnScreen(super)) { + if (EntityInRectRadius(super, &gPlayerEntity.base, 0xa0, 0xa0) && CheckOnScreen(super)) { Entity* projectile = CreateProjectileWithParent(super, WIND_PROJECTILE, 1); if (projectile != NULL) { projectile->direction = super->direction & 0x18; diff --git a/src/entity.c b/src/entity.c index fd4cb707..34be309d 100644 --- a/src/entity.c +++ b/src/entity.c @@ -1,4 +1,3 @@ -#define ENT_DEPRECATED #include "area.h" #include "common.h" #include "functions.h" @@ -187,12 +186,12 @@ static void UpdatePriorityTimer(void) { void SetPlayerEventPriority(void) { gPriorityHandler.event_priority = PRIO_PLAYER_EVENT; - gPlayerEntity.updatePriority = PRIO_PLAYER_EVENT; + gPlayerEntity.base.updatePriority = PRIO_PLAYER_EVENT; } void ResetPlayerEventPriority(void) { gPriorityHandler.event_priority = PRIO_MIN; - gPlayerEntity.updatePriority = PRIO_PLAYER; + gPlayerEntity.base.updatePriority = PRIO_PLAYER; } void RevokePriority(Entity* e) { @@ -237,7 +236,7 @@ void UpdateManagers(void) { void EraseAllEntities(void) { DeleteAllEntities(); MemClear(&gPriorityHandler, sizeof(PriorityHandler)); - MemClear(&gPlayerEntity, 10880); + MemClear(&gPlayerEntity.base, 10880); MemClear(&gUnk_02033290, 2048); sub_0805E98C(); gEntCount = 0; @@ -249,9 +248,9 @@ void EraseAllEntities(void) { Entity* GetEmptyEntity() { u8 flags_ip; - Entity* end; - Entity* rv; - Entity* currentEnt; + GenericEntity* end; + GenericEntity* rv; + GenericEntity* currentEnt; LinkedList* nextList; LinkedList* listPtr; @@ -262,21 +261,21 @@ Entity* GetEmptyEntity() { end = currentEnt + ARRAY_COUNT(gEntities); do { - if (currentEnt->prev == 0) { - return currentEnt; + if (currentEnt->base.prev == 0) { + return ¤tEnt->base; } } while (++currentEnt < end); } - currentEnt = &gPlayerEntity; + currentEnt = (GenericEntity*)&gPlayerEntity.base; do { - if ((s32)currentEnt->prev < 0 && (currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2)) && - currentEnt != gUpdateContext.current_entity) { - ClearDeletedEntity(currentEnt); - return currentEnt; + if ((s32)currentEnt->base.prev < 0 && (currentEnt->base.flags & (ENT_UNUSED1 | ENT_UNUSED2)) && + (Entity*)currentEnt != gUpdateContext.current_entity) { + ClearDeletedEntity(¤tEnt->base); + return ¤tEnt->base; } - } while (++currentEnt < (Entity*)&gCarriedEntity); + } while (++currentEnt < (GenericEntity*)&gCarriedEntity); flags_ip = 0; rv = NULL; @@ -284,37 +283,35 @@ Entity* GetEmptyEntity() { endListPtr = listPtr + ARRAY_COUNT(gEntityLists); do { - currentEnt = listPtr->first; + currentEnt = (GenericEntity*)listPtr->first; nextList = listPtr + 1; while ((u32)currentEnt != (u32)listPtr) { - if (currentEnt->kind != MANAGER && - flags_ip < (currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED)) && - gUpdateContext.current_entity != currentEnt) { - flags_ip = currentEnt->flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED); + if (currentEnt->base.kind != MANAGER && + flags_ip < (currentEnt->base.flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED)) && + gUpdateContext.current_entity != ¤tEnt->base) { + flags_ip = currentEnt->base.flags & (ENT_UNUSED1 | ENT_UNUSED2 | ENT_DELETED); rv = currentEnt; } - currentEnt = currentEnt->next; + currentEnt = (GenericEntity*)currentEnt->base.next; } listPtr = nextList; } while (listPtr < endListPtr); if (rv) { - DeleteEntity(rv); - ClearDeletedEntity(rv); + DeleteEntity(&rv->base); + ClearDeletedEntity(&rv->base); } - return rv; + return &rv->base; } -extern Entity gAuxPlayerEntities[7]; - Entity* CreateAuxPlayerEntity(void) { - Entity* ent = gAuxPlayerEntities; + GenericEntity* ent = gAuxPlayerEntities; do { - if (ent->prev == NULL) { - return ent; + if (ent->base.prev == NULL) { + return &ent->base; } } while (++ent < &gAuxPlayerEntities[7]); @@ -382,17 +379,17 @@ void DeleteEntity(Entity* ent) { } void ClearAllDeletedEntities(void) { - Entity* ent = &gPlayerEntity; + GenericEntity* ent = (GenericEntity*)&gPlayerEntity.base; do { //! @bug if prev pointed to a VALID location higher than a signed int, would still be deleted - if ((int)ent->prev < 0) { - ClearDeletedEntity(ent); + if ((int)ent->base.prev < 0) { + ClearDeletedEntity(&ent->base); } - } while (ent++, ent < (&gPlayerEntity + 80)); + } while (ent++, ent < (((GenericEntity*)&gPlayerEntity.base) + 80)); } void ClearDeletedEntity(Entity* ent) { - DmaClear32(3, ent, sizeof(Entity)); + DmaClear32(3, ent, sizeof(GenericEntity)); gEntCount--; } diff --git a/src/game.c b/src/game.c index 84b99bc8..9f193935 100644 --- a/src/game.c +++ b/src/game.c @@ -388,12 +388,12 @@ static void UpdateWindcrests(void) { u32 hi_x, hi_y; s32 x, y; - x = gPlayerEntity.x.HALF.HI; + x = gPlayerEntity.base.x.HALF.HI; if (x < 0) x += 0xf; hi_x = x >> 4; - y = gPlayerEntity.y.HALF.HI; + y = gPlayerEntity.base.y.HALF.HI; if (y < 0) y += 0xf; hi_y = y >> 4; diff --git a/src/gameUtils.c b/src/gameUtils.c index ef1db81a..56a8aed7 100644 --- a/src/gameUtils.c +++ b/src/gameUtils.c @@ -3,7 +3,6 @@ * * @brief Game Utils */ -#define ENT_DEPRECATED #include "backgroundAnimations.h" #include "enemy.h" #include "entity.h" @@ -113,9 +112,9 @@ void InitializePlayer(void) { MemClear(&gActiveItems, sizeof(gActiveItems)); MemClear(&gPlayerState, sizeof(gPlayerState)); MemFill32(0xffffffff, &gPlayerState.path_memory, sizeof(gPlayerState.path_memory)); - MemClear(&gPlayerEntity, sizeof(gPlayerEntity)); + MemClear(&gPlayerEntity.base, sizeof(gPlayerEntity)); - pl = &gPlayerEntity; + pl = &gPlayerEntity.base; gRoomControls.camera_target = pl; gPlayerState.queued_action = sPlayerSpawnStates[gRoomTransition.player_status.spawn_type]; @@ -211,7 +210,7 @@ s32 ModHealth(s32 delta) { newHealth = stats->maxHealth; } stats->health = newHealth; - gPlayerEntity.health = newHealth; + gPlayerEntity.base.health = newHealth; return newHealth; } @@ -387,8 +386,8 @@ u32 StairsAreValid(void) { void InitParachuteRoom(void) { gRoomTransition.transitioningOut = 1; - gRoomTransition.player_status.start_pos_x = (gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) & 0x3F8; - gRoomTransition.player_status.start_pos_y = (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) & 0x3F8; + gRoomTransition.player_status.start_pos_x = (gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x) & 0x3F8; + gRoomTransition.player_status.start_pos_y = (gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) & 0x3F8; gRoomTransition.player_status.start_anim = 4; gRoomTransition.player_status.spawn_type = PL_SPAWN_PARACHUTE_FORWARD; gRoomTransition.player_status.area_next = gRoomControls.area; @@ -434,10 +433,10 @@ bool32 CanDispEzloMessage(void) { return FALSE; if ((gPlayerState.flags & (PL_NO_CAP | PL_CAPTURED | PL_DISABLE_ITEMS)) || (gPlayerState.framestate_last > tmp) || - gPlayerState.item || gPlayerEntity.field_0x7a.HWORD) + gPlayerState.item || gPlayerEntity.unk_7a) return FALSE; - if ((gPlayerEntity.z.HALF.HI & 0x8000) && !gPlayerState.field_0xa) + if ((gPlayerEntity.base.z.HALF.HI & 0x8000) && !gPlayerState.field_0xa) return FALSE; GenerateAreaHint(); @@ -450,7 +449,7 @@ void DisplayEzloMessage(void) { u32 height; u32 idx; if (gRoomTransition.hint_height == 0) { - height = gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y > 96 ? 1 : 13; + height = gPlayerEntity.base.y.HALF.HI - gRoomControls.scroll_y > 96 ? 1 : 13; } else { height = gRoomTransition.hint_height; } @@ -489,11 +488,11 @@ void DecreasePortalTimer(void) { void UpdatePlayerMapCoords(void) { if (!AreaHasNoEnemies()) { if (AreaIsOverworld()) { - gRoomTransition.player_status.overworld_map_x = gPlayerEntity.x.HALF_U.HI; - gRoomTransition.player_status.overworld_map_y = gPlayerEntity.y.HALF_U.HI; + gRoomTransition.player_status.overworld_map_x = gPlayerEntity.base.x.HALF_U.HI; + gRoomTransition.player_status.overworld_map_y = gPlayerEntity.base.y.HALF_U.HI; } else if (AreaIsDungeon()) { - gRoomTransition.player_status.dungeon_map_x = gPlayerEntity.x.HALF.HI; - gRoomTransition.player_status.dungeon_map_y = gPlayerEntity.y.HALF.HI; + gRoomTransition.player_status.dungeon_map_x = gPlayerEntity.base.x.HALF.HI; + gRoomTransition.player_status.dungeon_map_y = gPlayerEntity.base.y.HALF.HI; } } } @@ -739,25 +738,25 @@ void CheckAreaDiscovery(void) { } void UpdatePlayerRoomStatus(void) { - gPlayerState.startPosX = gPlayerEntity.x.HALF.HI; - gPlayerState.startPosY = gPlayerEntity.y.HALF.HI; + gPlayerState.startPosX = gPlayerEntity.base.x.HALF.HI; + gPlayerState.startPosY = gPlayerEntity.base.y.HALF.HI; if (sub_08053144()) { MemCopy(&gRoomTransition.player_status, &gSave.saved_status, sizeof gRoomTransition.player_status); if (AreaIsDungeon()) { gRoomTransition.player_status.dungeon_area = gRoomControls.area; gRoomTransition.player_status.dungeon_room = gRoomControls.room; - gRoomTransition.player_status.dungeon_x = gPlayerEntity.x.HALF.HI; - gRoomTransition.player_status.dungeon_y = gPlayerEntity.y.HALF.HI; + gRoomTransition.player_status.dungeon_x = gPlayerEntity.base.x.HALF.HI; + gRoomTransition.player_status.dungeon_y = gPlayerEntity.base.y.HALF.HI; } } } void sub_08053250(void) { gRoomTransition.player_status.spawn_type = PL_SPAWN_DEFAULT; - gRoomTransition.player_status.start_pos_x = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x; - gRoomTransition.player_status.start_pos_y = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y; - gRoomTransition.player_status.start_anim = gPlayerEntity.animationState; - gRoomTransition.player_status.layer = gPlayerEntity.collisionLayer; + gRoomTransition.player_status.start_pos_x = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x; + gRoomTransition.player_status.start_pos_y = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y; + gRoomTransition.player_status.start_anim = gPlayerEntity.base.animationState; + gRoomTransition.player_status.layer = gPlayerEntity.base.collisionLayer; gRoomTransition.player_status.area_next = gRoomControls.area; gRoomTransition.player_status.room_next = gRoomControls.room; MemCopy(&gRoomTransition.player_status, &gSave.saved_status, sizeof gRoomTransition.player_status); diff --git a/src/interrupts.c b/src/interrupts.c index 3ef7235d..5469b5b1 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -1,4 +1,3 @@ -#define ENT_DEPRECATED #include "functions.h" #include "gba/m4a.h" #include "global.h" @@ -237,7 +236,7 @@ static void HandlePlayerLife(Entity* this) { gUnk_0200AF00.rActionInteractTile = R_ACTION_NONE; gUnk_0200AF00.rActionGrabbing = R_ACTION_NONE; - if ((gPlayerEntity.contactFlags & 0x80) && (gPlayerEntity.iframes > 0)) + if ((gPlayerEntity.base.contactFlags & 0x80) && (gPlayerEntity.base.iframes > 0)) SoundReq(SFX_86); gPlayerState.flags &= ~(PL_FALLING | PL_CONVEYOR_PUSHED); @@ -320,15 +319,15 @@ static void sub_080171F0(void) { ResetActiveItems(); if (gPlayerState.field_0x14 != 0) gPlayerState.field_0x14--; - if (gPlayerEntity.field_0x7a.HWORD != 0) - gPlayerEntity.field_0x7a.HWORD--; + if (gPlayerEntity.unk_7a != 0) + gPlayerEntity.unk_7a--; - gPlayerEntity.contactFlags &= ~0x80; - if (gPlayerEntity.action != PLAYER_DROWN) + gPlayerEntity.base.contactFlags &= ~0x80; + if (gPlayerEntity.base.action != PLAYER_DROWN) COPY_FLAG_FROM_TO(gPlayerState.flags, 0x2, 0x10000); gPlayerState.flags &= ~PL_FLAGS2; - sub_080028E0(&gPlayerEntity); + sub_080028E0(&gPlayerEntity.base); if (gPlayerState.flags & PL_CLONING) gUnk_0200AF00.rActionPlayerState = R_ACTION_CANCEL; @@ -341,23 +340,23 @@ static void sub_080171F0(void) { gPlayerState.speed_modifier = 0; gPlayerState.attachedBeetleCount = 0; MemClear(&gCarriedEntity, sizeof(gCarriedEntity)); - gPlayerEntity.spriteOffsetY = gPlayerState.spriteOffsetY; + gPlayerEntity.base.spriteOffsetY = gPlayerState.spriteOffsetY; gPlayerState.spriteOffsetY = 0; sub_0807B0C8(); if (gPlayerState.flags & PL_CLONING) gPlayerClones[0]->spriteOffsetY = gPlayerClones[1]->spriteOffsetY = gPlayerClones[2]->spriteOffsetY = 0; - if (gPlayerEntity.action == PLAYER_CLIMB) + if (gPlayerEntity.base.action == PLAYER_CLIMB) gPlayerState.flags |= PL_CLIMBING; else gPlayerState.flags &= ~PL_CLIMBING; - sub_0807A8D8(&gPlayerEntity); + sub_0807A8D8(&gPlayerEntity.base); if (gPlayerState.jump_status & 0xc0) - gPlayerEntity.iframes = 0xfe; + gPlayerEntity.base.iframes = 0xfe; - if (gPlayerEntity.action != PLAYER_ROOMTRANSITION) { - sub_08077FEC(gPlayerEntity.action); + if (gPlayerEntity.base.action != PLAYER_ROOMTRANSITION) { + sub_08077FEC(gPlayerEntity.base.action); } } diff --git a/src/item/itemBomb.c b/src/item/itemBomb.c index 74264e17..90c66539 100644 --- a/src/item/itemBomb.c +++ b/src/item/itemBomb.c @@ -38,8 +38,8 @@ void sub_08075FF8(ItemBehavior* this, u32 index) { if (maxBombs > bombCount) { entity = CreatePlayerItemWithParent(this, PLAYER_ITEM_BOMB); if (entity != NULL) { - pos = &gUnk_0811BDAC[gPlayerEntity.animationState & 6]; - PositionRelative(&gPlayerEntity, entity, Q_16_16(pos[0]), Q_16_16(pos[1])); + pos = &gUnk_0811BDAC[gPlayerEntity.base.animationState & 6]; + PositionRelative(&gPlayerEntity.base, entity, Q_16_16(pos[0]), Q_16_16(pos[1])); ModBombs(-1); SoundReq(SFX_PLACE_OBJ); } diff --git a/src/item/itemBoomerang.c b/src/item/itemBoomerang.c index 64c78d87..a9c6aaab 100644 --- a/src/item/itemBoomerang.c +++ b/src/item/itemBoomerang.c @@ -15,7 +15,7 @@ void ItemBoomerang(ItemBehavior* this, u32 index) { void sub_08075D2C(ItemBehavior* this, u32 index) { if (((gPlayerState.attack_status & 8) == 0) && (FindPlayerItemForItem(this, this->behaviorId) == NULL)) { this->priority |= 0xf; - sub_0806F948(&gPlayerEntity); + sub_0806F948(&gPlayerEntity.base); CreatePlayerItemIfNotExists(this, ITEM_BOOMERANG); sub_08077D38(this, index); gPlayerState.attack_status |= 8; diff --git a/src/item/itemBow.c b/src/item/itemBow.c index ca2cc809..9b57e9c1 100644 --- a/src/item/itemBow.c +++ b/src/item/itemBow.c @@ -19,7 +19,7 @@ void ItemBow(ItemBehavior* this, u32 index) { void sub_08075DF4(ItemBehavior* this, u32 index) { if ((gPlayerState.attack_status & 8) == 0) { this->priority |= 0x80; - sub_0806F948(&gPlayerEntity); + sub_0806F948(&gPlayerEntity.base); sub_08077BB8(this); sub_08077D38(this, index); gPlayerState.bow_state = 1; diff --git a/src/item/itemGustJar.c b/src/item/itemGustJar.c index 54dae3b2..a1c8b4f0 100644 --- a/src/item/itemGustJar.c +++ b/src/item/itemGustJar.c @@ -1,7 +1,6 @@ #include "entity.h" #include "functions.h" #include "item.h" -#include "new_player.h" #include "playeritem.h" void (*const ItemGustJar_StateFunctions[])(ItemBehavior* this, u32); @@ -12,15 +11,15 @@ void ItemGustJar(ItemBehavior* this, u32 index) { } void sub_08076DF4(ItemBehavior* this, u32 index) { - if (GetCollisionTileInFront(&gPlayerEntity) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR && + if (GetCollisionTileInFront(&gPlayerEntity.base) != 0x29 && gPlayerState.floor_type != SURFACE_DOOR && gPlayerState.floor_type != SURFACE_DOOR_13 && gPlayerState.jump_status == 0) { sub_08077D38(this, index); this->timer = 0; - this->playerAnimationState = gPlayerEntity.animationState; + this->playerAnimationState = gPlayerEntity.base.animationState; this->priority |= 0x80; this->priority++; gPlayerState.gustJarSpeed = 1; - gNewPlayerEntity.unk_74 = NULL; + gPlayerEntity.unk_74 = NULL; gPlayerState.field_0x1c = 1; sub_08077BB8(this); } else { @@ -40,7 +39,7 @@ void sub_08076E60(ItemBehavior* this, u32 index) { gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index); playerItem = CreatePlayerItem(PLAYER_ITEM_GUST, 0, 0, 0); if (playerItem != NULL) { - playerItem->parent = &gPlayerEntity; + playerItem->parent = &gPlayerEntity.base; } } else { UpdateItemAnim(this); @@ -63,7 +62,7 @@ void sub_08076EC8(ItemBehavior* this, u32 index) { gPlayerState.gustJarSpeed = 1; } - if (gPlayerEntity.subAction == 0x1b) { + if (gPlayerEntity.base.subAction == 0x1b) { animIndex = ANIM_GUSTJAR_524; } else { if (gPlayerState.direction & DIR_NOT_MOVING_CHECK) { @@ -95,7 +94,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { this->subtimer = 0; this->timer = 0; gPlayerState.gustJarSpeed = 1; - player = &gNewPlayerEntity; + player = &gPlayerEntity; player->unk_74 = NULL; gPlayerState.field_0x1c = 1; gPlayerState.field_0xa &= ~(8 >> index); @@ -119,9 +118,9 @@ void sub_08076F64(ItemBehavior* this, u32 index) { UpdateItemAnim(this); if ((gPlayerState.flags & PL_FLAGS2)) return; - gPlayerEntity.direction = - DirectionTurnAround(Direction8FromAnimationState(gPlayerEntity.animationState)); - gPlayerEntity.speed = 0x80; + gPlayerEntity.base.direction = + DirectionTurnAround(Direction8FromAnimationState(gPlayerEntity.base.animationState)); + gPlayerEntity.base.speed = 0x80; UpdatePlayerMovement(); return; @@ -137,7 +136,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { UpdateItemAnim(this); if (this->playerFrame & 1) { gPlayerState.field_0x1c = 5; - gNewPlayerEntity.unk_70 = NULL; + gPlayerEntity.unk_70 = NULL; if (gPlayerState.gustJarSpeed) { CreatePlayerItem(PLAYER_ITEM_GUST_BIG, 0, 0, 0); } @@ -145,8 +144,9 @@ void sub_08076F64(ItemBehavior* this, u32 index) { if (gPlayerState.flags & PL_FLAGS2) return; - gPlayerEntity.direction = DirectionTurnAround(Direction8FromAnimationState(gPlayerEntity.animationState)); - gPlayerEntity.speed = 0x80; + gPlayerEntity.base.direction = + DirectionTurnAround(Direction8FromAnimationState(gPlayerEntity.base.animationState)); + gPlayerEntity.base.speed = 0x80; UpdatePlayerMovement(); return; case 6: @@ -169,7 +169,7 @@ void sub_08076F64(ItemBehavior* this, u32 index) { break; } gPlayerState.field_0x1c = 0; - gNewPlayerEntity.unk_70 = NULL; + gPlayerEntity.unk_70 = NULL; DeleteItemBehavior(this, index); } diff --git a/src/item/itemJarEmpty.c b/src/item/itemJarEmpty.c index 6296dc67..90ec65ed 100644 --- a/src/item/itemJarEmpty.c +++ b/src/item/itemJarEmpty.c @@ -20,7 +20,7 @@ void ItemJarEmpty(ItemBehavior* this, u32 index) { void sub_08077534(ItemBehavior* this, u32 index) { u32 tmp; sub_08077D38(this, index); - sub_0806F948(&gPlayerEntity); + sub_0806F948(&gPlayerEntity.base); sub_08077BB8(this); this->priority |= 0xf; tmp = this->behaviorId; @@ -41,8 +41,8 @@ void sub_08077534(ItemBehavior* this, u32 index) { case ITEM_BOTTLE_PICOLYTE_BLUE: case ITEM_BOTTLE_PICOLYTE_WHITE: this->stateID = 3; - gPlayerEntity.animationState = 4; - gPlayerEntity.spriteSettings.flipX = 0; + gPlayerEntity.base.animationState = 4; + gPlayerEntity.base.spriteSettings.flipX = 0; SetItemAnim(this, ANIM_BOTTLE_DRINK); break; case BOTTLE_CHARM_NAYRU: @@ -53,7 +53,7 @@ void sub_08077534(ItemBehavior* this, u32 index) { SetItemAnim(this, ANIM_BOTTLE_POUR); break; } - gPlayerEntity.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; } void sub_08077618(ItemBehavior* this, u32 index) { @@ -68,7 +68,7 @@ void sub_08077618(ItemBehavior* this, u32 index) { void sub_08077640(ItemBehavior* this, u32 index) { UpdateItemAnim(this); if ((this->playerFrame & 0x80) != 0) { - gPlayerEntity.flags |= ENT_COLLIDE; + gPlayerEntity.base.flags |= ENT_COLLIDE; DeleteItemBehavior(this, index); } } @@ -76,7 +76,7 @@ void sub_08077640(ItemBehavior* this, u32 index) { void sub_0807766C(ItemBehavior* this, u32 index) { UpdateItemAnim(this); if ((this->playerFrame & 0x80) != 0) { - gPlayerEntity.flags |= ENT_COLLIDE; + gPlayerEntity.base.flags |= ENT_COLLIDE; DeleteItemBehavior(this, index); } } diff --git a/src/item/itemLantern.c b/src/item/itemLantern.c index f7806bd0..af488bd1 100644 --- a/src/item/itemLantern.c +++ b/src/item/itemLantern.c @@ -1,7 +1,6 @@ #include "functions.h" #include "game.h" #include "item.h" -#include "new_player.h" #include "object.h" #include "sound.h" @@ -38,13 +37,13 @@ void sub_08075A0C(ItemBehavior* this, u32 index) { this->priority |= 0x80; sub_08077D38(this, index); CreatePlayerItemForItemIfNotExists(this); - sub_0806F948(&gPlayerEntity); + sub_0806F948(&gPlayerEntity.base); this->behaviorId = 0x10; ForceEquipItem(ITEM_LANTERN_ON, equipSlot); - tmp = &gUnk_08126EEC[gPlayerEntity.animationState & 6]; - object = CreateObjectWithParent(&gPlayerEntity, LAMP_PARTICLE, 1, 0); + tmp = &gUnk_08126EEC[gPlayerEntity.base.animationState & 6]; + object = CreateObjectWithParent(&gPlayerEntity.base, LAMP_PARTICLE, 1, 0); if (object != NULL) { - object->spriteVramOffset = gPlayerEntity.spriteVramOffset; + object->spriteVramOffset = gPlayerEntity.base.spriteVramOffset; object->x.HALF.HI = tmp[0] + object->x.HALF.HI; object->y.HALF.HI = tmp[1] + object->y.HALF.HI; } @@ -89,19 +88,19 @@ void sub_08075B54(ItemBehavior* this, u32 index) { DeleteItemBehavior(this, index); SoundReq(SFX_ITEM_LANTERN_OFF); } else { - if (((gPlayerState.queued_action != PLAYER_ROLL) && (gPlayerEntity.frameIndex < 0x37)) && - ((u16)gPlayerEntity.spriteIndex == 6)) { - tmp = &gUnk_08126EEC[gPlayerEntity.animationState & 6]; + if (((gPlayerState.queued_action != PLAYER_ROLL) && (gPlayerEntity.base.frameIndex < 0x37)) && + ((u16)gPlayerEntity.base.spriteIndex == 6)) { + tmp = &gUnk_08126EEC[gPlayerEntity.base.animationState & 6]; if ((gPlayerState.jump_status == 0) && - (sub_080B1BA4(TILE(gPlayerEntity.x.HALF.HI + tmp[0], gPlayerEntity.y.HALF.HI + tmp[1]), - gPlayerEntity.collisionLayer, 0x40) != 0)) { + (sub_080B1BA4(TILE(gPlayerEntity.base.x.HALF.HI + tmp[0], gPlayerEntity.base.y.HALF.HI + tmp[1]), + gPlayerEntity.base.collisionLayer, 0x40) != 0)) { this->animPriority = 0xf; this->stateID++; - gNewPlayerEntity.unk_7a = 2; - object = CreateObjectWithParent(&gPlayerEntity, LAMP_PARTICLE, 1, 0); + gPlayerEntity.unk_7a = 2; + object = CreateObjectWithParent(&gPlayerEntity.base, LAMP_PARTICLE, 1, 0); if (object != NULL) { - object->spriteVramOffset = gPlayerEntity.spriteVramOffset; + object->spriteVramOffset = gPlayerEntity.base.spriteVramOffset; object->x.HALF.HI = tmp[0] + object->x.HALF.HI; object->y.HALF.HI = tmp[1] + object->y.HALF.HI; } @@ -120,8 +119,8 @@ void sub_08075C9C(ItemBehavior* this, u32 index) { UpdateItemAnim(this); if ((this->playerFrame & 0x10) != 0) { - tmp = &gUnk_08126EEC[gPlayerEntity.animationState & 6]; - sub_0807AB44(&gPlayerEntity, tmp[0], tmp[1]); + tmp = &gUnk_08126EEC[gPlayerEntity.base.animationState & 6]; + sub_0807AB44(&gPlayerEntity.base, tmp[0], tmp[1]); } if ((this->playerFrame & 0x80) != 0) { this->animPriority = 0; @@ -129,6 +128,6 @@ void sub_08075C9C(ItemBehavior* this, u32 index) { gPlayerState.field_0xa = (~(8 >> index)) & gPlayerState.field_0xa; gPlayerState.keepFacing = (~(8 >> index)) & gPlayerState.keepFacing; } else { - gNewPlayerEntity.unk_7a++; + gPlayerEntity.unk_7a++; } } diff --git a/src/item/itemMoleMitts.c b/src/item/itemMoleMitts.c index aa063eff..7dfc8d27 100644 --- a/src/item/itemMoleMitts.c +++ b/src/item/itemMoleMitts.c @@ -37,10 +37,10 @@ void sub_08077130(ItemBehavior* this, u32 index) { SetItemAnim(this, ANIM_MOLEMITTS_DIG); this->stateID = 2; if (iVar1 == 0x56) { - if ((gPlayerEntity.animationState & 2) != 0) { - gPlayerEntity.y.HALF.HI = (gPlayerEntity.y.HALF.HI & 0xfff0) | 6; + if ((gPlayerEntity.base.animationState & 2) != 0) { + gPlayerEntity.base.y.HALF.HI = (gPlayerEntity.base.y.HALF.HI & 0xfff0) | 6; } else { - gPlayerEntity.x.HALF.HI = (gPlayerEntity.x.HALF.HI & 0xfff0) | 8; + gPlayerEntity.base.x.HALF.HI = (gPlayerEntity.base.x.HALF.HI & 0xfff0) | 8; } } } @@ -67,22 +67,22 @@ void sub_080771C8(ItemBehavior* this, u32 index) { gPlayerState.moleMittsState = 0; } else { if (((this->playerFrame & 0x20) != 0) && (this->subtimer == 0xff)) { - CreateObjectWithParent(&gPlayerEntity, MOLE_MITTS_PARTICLE, this->playerFrame, 1); + CreateObjectWithParent(&gPlayerEntity.base, MOLE_MITTS_PARTICLE, this->playerFrame, 1); } if ((this->playerFrame & 0x10) != 0) { - if (sub_0800875A(&gPlayerEntity, 0xd, this) == 0) { + if (sub_0800875A(&gPlayerEntity.base, 0xd, this) == 0) { SetItemAnim(this, ANIM_MOLEMITTS_MISS); this->stateID = 3; SoundReq(SFX_ITEM_GLOVES_AIR); } else { if (this->subtimer != 0xff) { - object = CreateObjectWithParent(&gPlayerEntity, OBJECT_1F, 0, this->field_0x2[1]); + object = CreateObjectWithParent(&gPlayerEntity.base, OBJECT_1F, 0, this->field_0x2[1]); if (object != NULL) { object->timer = this->timer; object->subtimer = this->subtimer; - object->animationState = gPlayerEntity.animationState & 6; - gPlayerEntity.frame = 0; - gPlayerEntity.frameDuration = gUnk_0811BE14[this->subtimer]; + object->animationState = gPlayerEntity.base.animationState & 6; + gPlayerEntity.base.frame = 0; + gPlayerEntity.base.frameDuration = gUnk_0811BE14[this->subtimer]; } } else { if ((this->field_0x2[1] == 0x0f) && (this->timer == 0x17)) { @@ -110,22 +110,22 @@ void sub_080772A8(ItemBehavior* this, u32 index) { if (GetInventoryValue(ITEM_DIG_BUTTERFLY) == 1) { if ((this->playerFrame & 7) != 3) { sub_08077E3C(this, 2); - gPlayerEntity.speed = gUnk_0811BE16[this->playerFrame & 7] << 1; + gPlayerEntity.base.speed = gUnk_0811BE16[this->playerFrame & 7] << 1; } else { UpdateItemAnim(this); - gPlayerEntity.speed = gUnk_0811BE16[this->playerFrame & 7]; + gPlayerEntity.base.speed = gUnk_0811BE16[this->playerFrame & 7]; } } else { UpdateItemAnim(this); - gPlayerEntity.speed = gUnk_0811BE16[this->playerFrame & 7]; + gPlayerEntity.base.speed = gUnk_0811BE16[this->playerFrame & 7]; } - gPlayerEntity.direction = gPlayerEntity.animationState << 2; - if (gPlayerEntity.speed != 0) { + gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2; + if (gPlayerEntity.base.speed != 0) { UpdatePlayerMovement(); } if ((this->playerFrame & 0x10) != 0) { if (this->timer != 0) { - gPlayerEntity.frameDuration = 1; + gPlayerEntity.base.frameDuration = 1; if (sub_080774A0()) { this->timer = 0; return; @@ -135,21 +135,21 @@ void sub_080772A8(ItemBehavior* this, u32 index) { gPlayerState.moleMittsState = 0; } else { if ((this->playerFrame & 0x60) != 0) { - gPlayerEntity.frameDuration = 1; - if (sub_0807B5B0(&gPlayerEntity)) { + gPlayerEntity.base.frameDuration = 1; + if (sub_0807B5B0(&gPlayerEntity.base)) { SoundReq(SFX_108); - CreateObjectWithParent(&gPlayerEntity, MOLE_MITTS_PARTICLE, this->playerFrame, 0); + CreateObjectWithParent(&gPlayerEntity.base, MOLE_MITTS_PARTICLE, this->playerFrame, 0); } else { SetItemAnim(this, ANIM_MOLEMITTS_CLANG); - effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0); + effect = CreateFx(&gPlayerEntity.base, FX_STARS_STRIKE, 0); if (effect != NULL) { effect->animationState = this->playerAnimationState; - effect->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1; + effect->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 - 1; } - effect = CreateFx(&gPlayerEntity, FX_STARS_STRIKE, 0); + effect = CreateFx(&gPlayerEntity.base, FX_STARS_STRIKE, 0); if (effect != NULL) { effect->animationState = this->playerAnimationState; - effect->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1; + effect->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 - 1; effect->subtimer = 1; } this->stateID = 3; @@ -161,8 +161,8 @@ void sub_080772A8(ItemBehavior* this, u32 index) { } void sub_08077448(ItemBehavior* this, u32 index) { - gPlayerEntity.direction = gPlayerEntity.animationState << 2 ^ 0x10; - gPlayerEntity.speed = 0x100; + gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2 ^ 0x10; + gPlayerEntity.base.speed = 0x100; if (((this->playerFrame & 1) != 0) && (this->field_0x5 != 0)) { UpdatePlayerMovement(); } @@ -178,16 +178,16 @@ s32 sub_080774A0(void) { u32 iVar2; u32 uVar3; - uVar3 = COORD_TO_TILE_OFFSET((&gPlayerEntity), -gUnk_0811BE1E[gPlayerEntity.animationState & 6], - -gUnk_0811BE1E[(gPlayerEntity.animationState & 6) + 1]); + uVar3 = COORD_TO_TILE_OFFSET((&gPlayerEntity.base), -gUnk_0811BE1E[gPlayerEntity.base.animationState & 6], + -gUnk_0811BE1E[(gPlayerEntity.base.animationState & 6) + 1]); - iVar2 = sub_080B1B44(uVar3, gPlayerEntity.collisionLayer); + iVar2 = sub_080B1B44(uVar3, gPlayerEntity.base.collisionLayer); if (iVar2 > 0x16) return 0; if (iVar2 < 0xf) return 0; - if (sub_080B1AE0(uVar3, gPlayerEntity.collisionLayer) != 0x56) { + if (sub_080B1AE0(uVar3, gPlayerEntity.base.collisionLayer) != 0x56) { return 1; } else { return 0x56; diff --git a/src/item/itemOcarina.c b/src/item/itemOcarina.c index 4b88138c..e5cea164 100644 --- a/src/item/itemOcarina.c +++ b/src/item/itemOcarina.c @@ -1,6 +1,5 @@ #include "functions.h" #include "item.h" -#include "new_player.h" #include "sound.h" extern void ResetPlayerVelocity(void); @@ -14,7 +13,7 @@ void ItemOcarina(ItemBehavior* this, u32 index) { OcarinaUpdate, }; gOcarinaStates[this->stateID](this, index); - gNewPlayerEntity.unk_7a++; + gPlayerEntity.unk_7a++; } void OcarinaUse(ItemBehavior* this, u32 index) { @@ -22,10 +21,10 @@ void OcarinaUse(ItemBehavior* this, u32 index) { DeleteItemBehavior(this, index); } else { this->priority |= 0xf; - gPlayerEntity.animationState = 0x04; - gPlayerEntity.spriteSettings.flipX = 0; - gPlayerEntity.flags &= ~ENT_COLLIDE; - gNewPlayerEntity.unk_7a = 2; + gPlayerEntity.base.animationState = 0x04; + gPlayerEntity.base.spriteSettings.flipX = 0; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; + gPlayerEntity.unk_7a = 2; gPlayerState.flags |= PL_USE_OCARINA; gPlayerState.field_0x27[0] = -1; gPauseMenuOptions.disabled = 1; @@ -41,11 +40,11 @@ void OcarinaUse(ItemBehavior* this, u32 index) { void OcarinaUpdate(ItemBehavior* this, u32 index) { UpdateItemAnim(this); if ((this->playerFrame & 0x80) != 0) { - gPlayerEntity.flags |= ENT_COLLIDE; + gPlayerEntity.base.flags |= ENT_COLLIDE; gPlayerState.flags &= ~PL_USE_OCARINA; gPlayerState.field_0x27[0] = 0; gPauseMenuOptions.disabled = 0; - CreateBird(&gPlayerEntity); + CreateBird(&gPlayerEntity.base); ResetPlayerEventPriority(); DeleteItemBehavior(this, index); } diff --git a/src/item/itemPacciCane.c b/src/item/itemPacciCane.c index 879f2051..56d2592c 100644 --- a/src/item/itemPacciCane.c +++ b/src/item/itemPacciCane.c @@ -18,7 +18,7 @@ void ItemPacciCane(ItemBehavior* this, u32 index) { void sub_08076C98(ItemBehavior* this, u32 index) { this->priority |= 0xf; sub_08077D38(this, index); - sub_0806F948(&gPlayerEntity); + sub_0806F948(&gPlayerEntity.base); sub_08077BB8(this); } diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index 21fa559a..0b4af5ea 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -1,4 +1,3 @@ -#define ENT_DEPRECATED #include "asm.h" #include "effects.h" #include "functions.h" @@ -25,7 +24,7 @@ void ItemPegasusBoots(ItemBehavior* this, u32 index) { Entity* fx; u32 uVar4; - if (gPlayerEntity.field_0x7a.HWORD != 0) { + if (gPlayerEntity.unk_7a != 0) { gPlayerState.dash_state = 0; gPlayerState.itemAnimPriority = 0; DeleteItemBehavior(this, index); @@ -36,11 +35,11 @@ void ItemPegasusBoots(ItemBehavior* this, u32 index) { } if (((gPlayerState.flags & PL_MINISH) == 0) && ((this->timer & 7) == 0)) { if (gPlayerState.floor_type == SURFACE_SWAMP) { - if (gPlayerEntity.spriteOffsetY == 0) { - CreateFx(&gPlayerEntity, FX_GREEN_SPLASH, 0); + if (gPlayerEntity.base.spriteOffsetY == 0) { + CreateFx(&gPlayerEntity.base, FX_GREEN_SPLASH, 0); } } else { - fx = CreateFx(&gPlayerEntity, FX_DASH, 0x40); + fx = CreateFx(&gPlayerEntity.base, FX_DASH, 0x40); if ((fx != NULL) && (fx->y.HALF.HI = fx->y.HALF.HI + 2, this->stateID != 2)) { uVar4 = Random() & 3; if ((Random() & 1) != 0) { @@ -86,7 +85,7 @@ void sub_080768F8(ItemBehavior* this, u32 index) { void sub_08076964(ItemBehavior* this, u32 index) { Entity* entity; u32 uVar3; - if (IsItemActive(this) && gPlayerEntity.z.WORD == 0 && gPlayerState.dash_state) { + if (IsItemActive(this) && gPlayerEntity.base.z.WORD == 0 && gPlayerState.dash_state) { UpdateItemAnim(this); if ((gPlayerState.flags & PL_MINISH) == 0) { @@ -113,7 +112,7 @@ void sub_08076964(ItemBehavior* this, u32 index) { } else { uVar3 = gSave.stats.equipped[SLOT_B]; } - entity->field_0x68.HALF.LO = uVar3; + ((GenericEntity*)entity)->field_0x68.HALF.LO = uVar3; return; } } else if (!(gPlayerState.flags & PL_MINISH)) { @@ -138,16 +137,16 @@ void sub_08076A88(ItemBehavior* this, u32 index) { if ((IsItemActive(this) != 0) && (gPlayerState.dash_state != 0)) { if (!(gPlayerState.flags & PL_MINISH)) { - gPlayerEntity.speed = 0x300; + gPlayerEntity.base.speed = 0x300; } else { - gPlayerEntity.speed = 0x280; + gPlayerEntity.base.speed = 0x280; } - uVar2 = gUnk_0800275C[(gPlayerEntity.animationState & 0xe) * 4]; - if (uVar2 == (gPlayerEntity.collisions & uVar2)) { + uVar2 = gUnk_0800275C[(gPlayerEntity.base.animationState & 0xe) * 4]; + if (uVar2 == (gPlayerEntity.base.collisions & uVar2)) { if (this->subtimer != 0) { - gPlayerEntity.action = PLAYER_BOUNCE; - gPlayerEntity.subAction = 0; - COLLISION_OFF(&gPlayerEntity); + gPlayerEntity.base.action = PLAYER_BOUNCE; + gPlayerEntity.base.subAction = 0; + COLLISION_OFF(&gPlayerEntity.base); gPlayerState.field_0x38 = 0; gPlayerState.direction = DIR_NONE; return; @@ -156,7 +155,7 @@ void sub_08076A88(ItemBehavior* this, u32 index) { return; } ptr = gUnk_0811BE38; - if ((*(u16*)&ptr[(gPlayerEntity.animationState & 0xfe)] & gPlayerState.playerInput.heldInput) == 0) { + if ((*(u16*)&ptr[(gPlayerEntity.base.animationState & 0xfe)] & gPlayerState.playerInput.heldInput) == 0) { this->direction = (this->playerAnimationState & 0xe) * 4; if ((gPlayerState.direction != DIR_NONE) && (gPlayerState.direction != this->direction)) { if (((gPlayerState.direction - this->direction) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | diff --git a/src/item/itemRocsCape.c b/src/item/itemRocsCape.c index d284ba28..ed7f6526 100644 --- a/src/item/itemRocsCape.c +++ b/src/item/itemRocsCape.c @@ -1,6 +1,5 @@ #include "functions.h" #include "item.h" -#include "new_player.h" #include "sound.h" void sub_08076758(ItemBehavior*, u32); @@ -15,16 +14,16 @@ void ItemRocsCape(ItemBehavior* this, u32 index) { if (gPlayerState.grab_status) { if (((gPlayerState.attack_status | gPlayerState.heldObject) == 0) && (((gPlayerState.floor_type != SURFACE_DOOR && (gPlayerState.floor_type != SURFACE_PIT)) || - ((gPlayerEntity.z.WORD != 0 || (gPlayerState.field_0x14 != 0)))))) { + ((gPlayerEntity.base.z.WORD != 0 || (gPlayerState.field_0x14 != 0)))))) { if ((gPlayerState.jump_status == 0) || ((gPlayerState.jump_status & 7) == 3)) { - if (-1 < gPlayerEntity.z.WORD) { + if (-1 < gPlayerEntity.base.z.WORD) { gPlayerState.grab_status = 0; this->stateID++; gPlayerState.keepFacing = 0; gPlayerState.jump_status = 1; gPlayerState.itemAnimPriority = -1; gPlayerState.item = NULL; - gPlayerEntity.zVelocity = Q_16_16(2.0); + gPlayerEntity.base.zVelocity = Q_16_16(2.0); sub_08077F84(); SoundReq(SFX_PLY_VO4); return; @@ -39,13 +38,13 @@ void ItemRocsCape(ItemBehavior* this, u32 index) { gPlayerState.heldObject | gPlayerState.field_0x1c | gPlayerState.moleMittsState) == 0) && ((((gPlayerState.floor_type != SURFACE_DOOR && gPlayerState.floor_type != SURFACE_DOOR_13 && gPlayerState.floor_type != SURFACE_PIT) || - (gPlayerEntity.z.WORD != 0)) || + (gPlayerEntity.base.z.WORD != 0)) || (gPlayerState.field_0x14 != 0)))) { if ((gPlayerState.jump_status != 0) && ((gPlayerState.jump_status & 7) != 3)) { sub_08076758(this, index); return; - } else if (gPlayerEntity.z.WORD >= 0) { - gPlayerEntity.zVelocity = Q_16_16(2.0); + } else if (gPlayerEntity.base.z.WORD >= 0) { + gPlayerEntity.base.zVelocity = Q_16_16(2.0); gPlayerState.jump_status = 1; gPlayerState.item = NULL; this->stateID++; @@ -65,20 +64,20 @@ void sub_08076758(ItemBehavior* this, u32 index) { ((gPlayerState.jump_status & 7) != 3)) { if (IsItemActive(this)) { if (this->stateID < 2) { - if ((gPlayerEntity.zVelocity <= 0) && ((gPlayerState.jump_status & 0x10) == 0)) { + if ((gPlayerEntity.base.zVelocity <= 0) && ((gPlayerState.jump_status & 0x10) == 0)) { this->stateID = 2; - gNewPlayerEntity.unk_7a = 2; - gPlayerEntity.zVelocity = Q_16_16(2.0); + gPlayerEntity.unk_7a = 2; + gPlayerEntity.base.zVelocity = Q_16_16(2.0); gPlayerState.jump_status |= 0x10; gPlayerState.animation = ANIM_ROCS_CAPE; SoundReq(SFX_172); } } else { - gNewPlayerEntity.unk_7a++; + gPlayerEntity.unk_7a++; } } else { if (this->stateID > 1) { - gNewPlayerEntity.unk_7a++; + gPlayerEntity.unk_7a++; gPlayerState.jump_status &= 0xef; } } diff --git a/src/item/itemShield.c b/src/item/itemShield.c index f9320d79..2fa8f07c 100644 --- a/src/item/itemShield.c +++ b/src/item/itemShield.c @@ -20,7 +20,7 @@ void ItemShield(ItemBehavior* this, u32 index) { void sub_08076D04(ItemBehavior* this, u32 index) { gPlayerState.shield_status = 0x81; this->priority = 2; - sub_0806F948(&gPlayerEntity); + sub_0806F948(&gPlayerEntity.base); sub_08077D38(this, index); sub_08077BB8(this); } diff --git a/src/item/itemSword.c b/src/item/itemSword.c index f27e0f2b..95110349 100644 --- a/src/item/itemSword.c +++ b/src/item/itemSword.c @@ -38,8 +38,8 @@ void sub_08075338(ItemBehavior* this, u32 index) { if (gPlayerState.jump_status) { if ((gPlayerState.jump_status & 7) != 3) { - if ((gPlayerState.jump_status & 0x78) == 0 && (u32)gPlayerEntity.zVelocity < Q_16_16(1.5) && - (gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.z.WORD != 0) { + if ((gPlayerState.jump_status & 0x78) == 0 && (u32)gPlayerEntity.base.zVelocity < Q_16_16(1.5) && + (gPlayerState.skills & SKILL_DOWN_THRUST) && gPlayerEntity.base.z.WORD != 0) { gPlayerState.jump_status |= 0x20; gPlayerState.lastSwordMove = SWORD_MOVE_DOWN_THRUST; gPlayerState.attack_status |= (8 >> index) | ((8 >> index) << 4); @@ -52,7 +52,7 @@ void sub_08075338(ItemBehavior* this, u32 index) { #ifndef EU sub_080759B8(this, index); return; - } else if (gPlayerEntity.z.WORD) { + } else if (gPlayerEntity.base.z.WORD) { #endif sub_080759B8(this, index); return; @@ -87,7 +87,7 @@ void sub_08075338(ItemBehavior* this, u32 index) { if ((gPlayerState.sword_state & 0x80) == 0) { gPlayerState.sword_state = 0; - sub_0806F948(&gPlayerEntity); + sub_0806F948(&gPlayerEntity.base); } if (gPlayerState.item) { @@ -112,7 +112,7 @@ void sub_080754B8(ItemBehavior* this, u32 index) { this->priority &= ~0x80; } - if (gPlayerEntity.frameSpriteSettings & 1) { + if (gPlayerEntity.base.frameSpriteSettings & 1) { swordBeam = GetSwordBeam(); if (swordBeam && FindEntityByID(PLAYER_ITEM, PLAYER_ITEM_SWORD_BEAM1, 2) == 0) { CreatePlayerItemWithParent(this, PLAYER_ITEM_SWORD_BEAM1); @@ -198,7 +198,7 @@ void sub_08075694(ItemBehavior* this, u32 index) { gPlayerState.field_0xa = (8 >> index) | gPlayerState.field_0xa; this->stateID = 4; this->animPriority = 6; - gPlayerEntity.hurtType = 0x1e; + gPlayerEntity.base.hurtType = 0x1e; gPlayerState.sword_state |= 0x40; gPlayerState.sword_state &= 0xdf; if ((gPlayerState.chargeState.action == 4) && ((gPlayerState.flags & PL_CLONING) == 0)) { @@ -223,8 +223,8 @@ void sub_08075738(ItemBehavior* this, u32 index) { if (!(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) { this->direction = gPlayerState.direction; } - gPlayerEntity.direction = this->direction; - gPlayerEntity.speed = 0x180; + gPlayerEntity.base.direction = this->direction; + gPlayerEntity.base.speed = 0x180; if ((this->playerFrame & 0x80) != 0) { bVar6 = 10; if ((gPlayerState.skills & SKILL_LONG_SPIN) != 0) { @@ -236,19 +236,19 @@ void sub_08075738(ItemBehavior* this, u32 index) { } } } else { - if (((((gPlayerEntity.frameSpriteSettings & 1) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) && + if (((((gPlayerEntity.base.frameSpriteSettings & 1) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) && ((gPlayerState.skills & SKILL_FOURSWORD) != 0))) { Entity* bombEnt = CreatePlayerItemWithParent(this, PLAYER_ITEM_SPIRAL_BEAM); if (bombEnt) { - bombEnt->animationState = (gPlayerEntity.animationState & 6) | 0x80; + bombEnt->animationState = (gPlayerEntity.base.animationState & 6) | 0x80; } } - if ((((gPlayerEntity.frameSpriteSettings & 2) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) && + if ((((gPlayerEntity.base.frameSpriteSettings & 2) != 0) && ((gPlayerState.sword_state & 0x80) == 0)) && (((gPlayerState.skills & SKILL_GREAT_SPIN) != 0 && (--this->timer != 0)))) { gPlayerState.sword_state |= 0x10; gPlayerState.lastSwordMove = SWORD_MOVE_GREAT_SPIN; - this->direction = gPlayerEntity.animationState << 2; + this->direction = gPlayerEntity.base.animationState << 2; this->timer = 1; this->subtimer = 1; gPlayerState.field_0xa = gPlayerState.field_0xa & ~(8 >> index); @@ -300,11 +300,11 @@ void sub_08075900(ItemBehavior* this, u32 index) { if (--this->timer == 0) { SetItemAnim(this, ANIM_ROLLATTACK_END); } - gPlayerEntity.direction = (gPlayerEntity.animationState >> 1) << 3; - gPlayerEntity.speed = 0x300; + gPlayerEntity.base.direction = (gPlayerEntity.base.animationState >> 1) << 3; + gPlayerEntity.base.speed = 0x300; UpdatePlayerMovement(); if ((gRoomTransition.frameCount & 3) == 0) { - CreateFx(&gPlayerEntity, FX_DASH, 0x40); + CreateFx(&gPlayerEntity.base, FX_DASH, 0x40); } } else { if ((this->playerFrame & 0x80) != 0) { @@ -318,7 +318,7 @@ void sub_08075900(ItemBehavior* this, u32 index) { void sub_080759B8(ItemBehavior* this, u32 index) { if ((gPlayerState.flags & PL_MINISH) == 0) { - gPlayerEntity.hurtType = 0; + gPlayerEntity.base.hurtType = 0; } gPlayerState.flags &= ~PL_SWORD_THRUST; gPlayerState.sword_state = 0; diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index b3aa25a1..e721bb51 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -1,6 +1,5 @@ #include "functions.h" #include "item.h" -#include "new_player.h" #include "playeritem.h" #include "sound.h" @@ -39,9 +38,9 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) { gPlayerState.framestate = 4; this->stateID = 2; this->animPriority = 0xf; - if ((gNewPlayerEntity.unk_79 & 0x80)) { - gNewPlayerEntity.unk_79 = 0; - COLLISION_ON(&gPlayerEntity); + if ((gPlayerEntity.unk_79 & 0x80)) { + gPlayerEntity.unk_79 = 0; + COLLISION_ON(&gPlayerEntity.base); gPlayerState.heldObject = 4; gPlayerState.keepFacing = ~(8 >> param_3) & gPlayerState.keepFacing; gPlayerState.field_0xa = ~(8 >> param_3) & gPlayerState.field_0xa; @@ -56,7 +55,7 @@ void sub_08076088(ItemBehavior* this, Entity* param_2, u32 param_3) { if (param_2 == NULL) { PlayerCancelHoldItem(this, param_3); } else { - PlayerEntity* playerEnt = &gNewPlayerEntity; + PlayerEntity* playerEnt = &gPlayerEntity; playerEnt->unk_74 = param_2; playerEnt->base.subtimer = 0; param_2->child = this->field_0x18; @@ -87,7 +86,7 @@ void ItemPickupCheck(ItemBehavior* this, u32 index) { if (gPlayerState.attack_status == 0 && (gPlayerState.jump_status == 0 || (gPlayerState.flags & (PL_BUSY | PL_FALLING | PL_IN_MINECART)) != 0) && - (gPlayerState.grab_status = gPlayerEntity.animationState | 0x80, gPlayerEntity.iframes <= 8)) { + (gPlayerState.grab_status = gPlayerEntity.base.animationState | 0x80, gPlayerEntity.base.iframes <= 8)) { switch (sub_080789A8()) { case 2: @@ -143,7 +142,7 @@ void sub_080762D8(ItemBehavior* this, u32 index) { return; } - if (gPlayerEntity.iframes < 9 && gPlayerEntity.knockbackDuration == 0) { + if (gPlayerEntity.base.iframes < 9 && gPlayerEntity.base.knockbackDuration == 0) { if (this->field_0x18 != NULL) { if (this->field_0x18->action == 2 && this->field_0x18->subAction == 5) { if (!(gPlayerState.playerInput.heldInput & INPUT_ACTION)) { // Pressing R @@ -169,10 +168,10 @@ void sub_080762D8(ItemBehavior* this, u32 index) { if (!gPlayerState.jump_status) { - if (gPlayerState.heldObject == 1 && sub_0800875A(&gPlayerEntity, 6, this) != 0) { + if (gPlayerState.heldObject == 1 && sub_0800875A(&gPlayerEntity.base, 6, this) != 0) { sub_08076088(this, NULL, index); return; - } else if (gUnk_0811BE38[gPlayerEntity.animationState >> 1] & gPlayerState.playerInput.heldInput) { + } else if (gUnk_0811BE38[gPlayerEntity.base.animationState >> 1] & gPlayerState.playerInput.heldInput) { UpdateItemAnim(this); if (!(gPlayerState.flags & PL_NO_CAP)) { @@ -194,9 +193,9 @@ void sub_080762D8(ItemBehavior* this, u32 index) { sub_08076088(this, this->field_0x18, index); } else { - if (gPlayerState.playerInput.heldInput & gUnk_0811BE40[gPlayerEntity.animationState >> 1]) { - if (gPlayerEntity.subtimer < 6) { - gPlayerEntity.subtimer++; + if (gPlayerState.playerInput.heldInput & gUnk_0811BE40[gPlayerEntity.base.animationState >> 1]) { + if (gPlayerEntity.base.subtimer < 6) { + gPlayerEntity.base.subtimer++; return; } @@ -217,7 +216,7 @@ void sub_080762D8(ItemBehavior* this, u32 index) { SetItemAnim(this, animIndex); } } else { - gPlayerEntity.subtimer = 0; + gPlayerEntity.base.subtimer = 0; if (!(gPlayerState.flags & PL_NO_CAP)) { SetItemAnim(this, ANIM_PULL); @@ -242,7 +241,7 @@ void sub_08076488(ItemBehavior* this, u32 index) { } UpdateItemAnim(this); if ((this->playerFrame & 0x80) != 0) { - gPlayerEntity.flags |= ENT_COLLIDE; + gPlayerEntity.base.flags |= ENT_COLLIDE; gPlayerState.heldObject = 4; bVar1 = ~(8 >> index); gPlayerState.keepFacing = bVar1 & gPlayerState.keepFacing; @@ -261,14 +260,14 @@ void sub_08076518(ItemBehavior* this, u32 index) { if (PlayerTryDropObject(this, index)) { gPlayerState.framestate = PL_STATE_HOLD; if ((gPlayerState.jump_status & 0x80) == 0 && gPlayerState.field_0x1f[0] == 0) { - if (gPlayerEntity.knockbackDuration != 0) { + if (gPlayerEntity.base.knockbackDuration != 0) { PlayerCancelHoldItem(this, index); } else { if ((gPlayerState.playerInput.newInput & (INPUT_LIFT_THROW | INPUT_CANCEL | INPUT_INTERACT)) != 0) { - sub_0806F948(&gPlayerEntity); + sub_0806F948(&gPlayerEntity.base); gPlayerState.heldObject = 5; this->field_0x18->subAction = 2; - this->field_0x18->direction = (gPlayerEntity.animationState & 0xe) << 2; + this->field_0x18->direction = (gPlayerEntity.base.animationState & 0xe) << 2; this->field_0x18 = NULL; this->stateID++; this->animPriority = 0x0f; diff --git a/src/itemUtils.c b/src/itemUtils.c index 832c68ce..a774778f 100644 --- a/src/itemUtils.c +++ b/src/itemUtils.c @@ -566,7 +566,7 @@ u32 CreateItemDrop(Entity* arg0, u32 itemId, u32 itemParameter) { if (itemId != ITEM_ENEMY_BEETLE) { itemEntity = CreateObject(GROUND_ITEM, itemId, adjustedParam); if (itemEntity != NULL) { - if (arg0 == &gPlayerEntity) { + if (arg0 == &gPlayerEntity.base) { itemEntity->timer = 1; } else { itemEntity->timer = 0; diff --git a/src/manager/cloudStaircaseTransitionManager.c b/src/manager/cloudStaircaseTransitionManager.c index 73dc764d..d8a47d63 100644 --- a/src/manager/cloudStaircaseTransitionManager.c +++ b/src/manager/cloudStaircaseTransitionManager.c @@ -15,7 +15,7 @@ void CloudStaircaseTransitionManager_Main(CloudStaircaseTransitionManager* this) this->y = 0; } if (((CheckPlayerInRegion(this->x, this->y, 0x14, 0x40) != 0) && - (((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) + gPlayerEntity.z.HALF.HI) < 0)) && + (((gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) + gPlayerEntity.base.z.HALF.HI) < 0)) && (gRoomControls.scroll_y == gRoomControls.origin_y)) { MemClear(&gRoomTransition.player_status, sizeof(PlayerRoomStatus)); gRoomTransition.transitioningOut = 1; diff --git a/src/manager/diggingCaveEntranceManager.c b/src/manager/diggingCaveEntranceManager.c index d020dd5f..7491eea4 100644 --- a/src/manager/diggingCaveEntranceManager.c +++ b/src/manager/diggingCaveEntranceManager.c @@ -77,8 +77,8 @@ bool32 DiggingCaveEntranceManager_CheckEnterEntrance(DiggingCaveEntranceManager* u16 offsetX, offsetY, offsetX2, offsetY2; u32 tmp, tmp2; if (gDiggingCaveEntranceTransition.isDiggingCave) { - offsetX = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x; - offsetY = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y; + offsetX = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x; + offsetY = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y; offsetX2 = (entr->sourceTilePosition & TILE_POS_X_COMPONENT) * 16 + 8; offsetY2 = ((entr->sourceTilePosition & TILE_POS_Y_COMPONENT) >> 6) * 16 + 0x18; tmp = offsetX - offsetX2; @@ -89,10 +89,10 @@ bool32 DiggingCaveEntranceManager_CheckEnterEntrance(DiggingCaveEntranceManager* DiggingCaveEntranceManager_EnterEntrance(this, entr); return TRUE; } else { - if (COORD_TO_TILE(&gPlayerEntity) != entr->sourceTilePosition) + if (COORD_TO_TILE(&gPlayerEntity.base) != entr->sourceTilePosition) return FALSE; offsetY2 = gRoomControls.origin_y + ((entr->sourceTilePosition >> 6) << 4) + 6; - if (gPlayerEntity.y.HALF.HI >= offsetY2) + if (gPlayerEntity.base.y.HALF.HI >= offsetY2) return FALSE; DiggingCaveEntranceManager_EnterEntrance(this, entr); return TRUE; @@ -109,10 +109,10 @@ void DiggingCaveEntranceManager_EnterEntrance(DiggingCaveEntranceManager* this, gRoomControls.area = entr->targetArea; gRoomControls.room = entr->targetRoom; gDiggingCaveEntranceTransition.entrance = entr; - gDiggingCaveEntranceTransition.offsetX = - gPlayerEntity.x.HALF.HI - gRoomControls.origin_x - ((entr->sourceTilePosition & TILE_POS_X_COMPONENT) * 16); - gDiggingCaveEntranceTransition.offsetY = - gPlayerEntity.y.HALF.HI - gRoomControls.origin_y - ((entr->sourceTilePosition & TILE_POS_Y_COMPONENT) >> 2); + gDiggingCaveEntranceTransition.offsetX = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x - + ((entr->sourceTilePosition & TILE_POS_X_COMPONENT) * 16); + gDiggingCaveEntranceTransition.offsetY = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y - + ((entr->sourceTilePosition & TILE_POS_Y_COMPONENT) >> 2); #ifndef EU isDiggingCave = gDiggingCaveEntranceTransition.isDiggingCave; diff --git a/src/manager/ezloHintManager.c b/src/manager/ezloHintManager.c index 4f6a2723..eb2a666a 100644 --- a/src/manager/ezloHintManager.c +++ b/src/manager/ezloHintManager.c @@ -121,7 +121,7 @@ static void EzloHintManager_Action3(EzloHintManager* this) { if (gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_USE_PORTAL | PL_FALLING | PL_IN_MINECART | PL_CAPTURED)) return; - if (gPlayerEntity.z.HALF.HI != 0) + if (gPlayerEntity.base.z.HALF.HI != 0) return; gPlayerState.jump_status = 0; CreateEzloHint(this->msg_idx, this->msg_height); @@ -136,7 +136,7 @@ static void EzloHintManager_Action3(EzloHintManager* this) { return; case 3: /* wait for player to finish talking */ - if (gPlayerEntity.action == PLAYER_NORMAL || gPlayerEntity.action == PLAYER_MINISH) { + if (gPlayerEntity.base.action == PLAYER_NORMAL || gPlayerEntity.base.action == PLAYER_MINISH) { gPlayerState.controlMode = CONTROL_1; ResetPlayerEventPriority(); SetFlag(this->flag1); diff --git a/src/manager/fightManager.c b/src/manager/fightManager.c index dfef3d50..9d743f07 100644 --- a/src/manager/fightManager.c +++ b/src/manager/fightManager.c @@ -9,7 +9,6 @@ * (There is also a part about changing the music and setting it back when the fight is done, which is song 0x33 (a * fight theme) by default but can be overridden through room data) */ -#define ENT_DEPRECATED #include "manager/fightManager.h" #include "area.h" #include "common.h" @@ -113,7 +112,7 @@ void FightManager_LoadFight(FightManager* this) { while (prop->kind != 0xFF) { ent = LoadRoomEntity(prop++); if ((ent != NULL) && (ent->kind == ENEMY)) { - ent->field_0x6c.HALF.HI |= 0x40; + ((GenericEntity*)ent)->field_0x6c.HALF.HI |= 0x40; FightManagerHelper_Monitor(monitor, ent, counter++); } if (counter >= 7) { diff --git a/src/manager/holeManager.c b/src/manager/holeManager.c index 341e9485..a4d0d2d8 100644 --- a/src/manager/holeManager.c +++ b/src/manager/holeManager.c @@ -155,8 +155,10 @@ void sub_0805B210(HoleManager* this) { gRoomTransition.player_status.start_pos_y = tmp->unk_06; break; case 1: - gRoomTransition.player_status.start_pos_x = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x + tmp->unk_04; - gRoomTransition.player_status.start_pos_y = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y + tmp->unk_06; + gRoomTransition.player_status.start_pos_x = + gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x + tmp->unk_04; + gRoomTransition.player_status.start_pos_y = + gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y + tmp->unk_06; break; case 2: gRoomTransition.player_status.start_pos_x = tmp->unk_04; diff --git a/src/manager/hyruleTownBellManager.c b/src/manager/hyruleTownBellManager.c index c22442dc..4dc2ebed 100644 --- a/src/manager/hyruleTownBellManager.c +++ b/src/manager/hyruleTownBellManager.c @@ -13,11 +13,11 @@ void HyruleTownBellManager_Main(HyruleTownBellManager* this) { RoomControls* roomControls = &gRoomControls; u32 a = roomControls->origin_x + 0x1f8; - u32 x = (a - gPlayerEntity.x.HALF.HI) + 0x10; + u32 x = (a - gPlayerEntity.base.x.HALF.HI) + 0x10; u32 b = roomControls->origin_y + 0x140; - u32 y = (b - gPlayerEntity.y.HALF.HI) + 0x10; + u32 y = (b - gPlayerEntity.base.y.HALF.HI) + 0x10; if (super->action == 0) { - if (x < 0x20 && y < 0x20 && gPlayerEntity.z.HALF.HI < -0x18 && gPlayerState.framestate == PL_STATE_CAPE) { + if (x < 0x20 && y < 0x20 && gPlayerEntity.base.z.HALF.HI < -0x18 && gPlayerState.framestate == PL_STATE_CAPE) { super->action++; super->timer = 90; SoundReq(SFX_10A); diff --git a/src/manager/lightManager.c b/src/manager/lightManager.c index c34c4755..7a0cca5f 100644 --- a/src/manager/lightManager.c +++ b/src/manager/lightManager.c @@ -49,8 +49,8 @@ void LightManager_Main(LightManager* this) { if (gArea.lightType == 2) { gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON; } else { - if (CheckRectOnScreen(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x, - gPlayerEntity.y.HALF.HI - gRoomControls.origin_y, 0, 0)) { + if (CheckRectOnScreen(gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x, + gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y, 0, 0)) { gScreen.lcd.displayControl |= DISPCNT_WIN0_ON; } else { gScreen.lcd.displayControl &= ~DISPCNT_WIN0_ON; @@ -79,8 +79,8 @@ void LightManager_Main(LightManager* this) { } super->timer = uVar3; - sub_0801E160(gPlayerEntity.x.HALF.HI - gRoomControls.scroll_x, - gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y - 9 + gPlayerEntity.z.HALF.HI, + sub_0801E160(gPlayerEntity.base.x.HALF.HI - gRoomControls.scroll_x, + gPlayerEntity.base.y.HALF.HI - gRoomControls.scroll_y - 9 + gPlayerEntity.base.z.HALF.HI, uVar3 + this->unk20); } } diff --git a/src/manager/lightRayManager.c b/src/manager/lightRayManager.c index 48c48a6f..8a6a75b9 100644 --- a/src/manager/lightRayManager.c +++ b/src/manager/lightRayManager.c @@ -88,8 +88,8 @@ void LightRayManager_Action1(LightRayManager* this) { if (prop->unk0 == 0xff) return; - x = gPlayerEntity.x.HALF.HI / 16; - y = gPlayerEntity.y.HALF.HI / 16; + x = gPlayerEntity.base.x.HALF.HI / 16; + y = gPlayerEntity.base.y.HALF.HI / 16; for (; prop->unk0 != 0xff; prop++) { if (prop->unk0 != this->unk_21) { diff --git a/src/manager/miscManager.c b/src/manager/miscManager.c index 2fe982bb..c250e517 100644 --- a/src/manager/miscManager.c +++ b/src/manager/miscManager.c @@ -164,7 +164,7 @@ void MiscManager_Type1(MiscManager* this) { PutAwayItems(); } if (super->timer == 60) { - gPlayerEntity.animationState = super->subtimer; + gPlayerEntity.base.animationState = super->subtimer; } if (!--super->timer) { super->action = 3; @@ -298,7 +298,7 @@ void sub_08059278(void) { void MiscManager_Type8(MiscManager* this) { super->action = 1; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; } void MiscManager_Type9(MiscManager* this) { @@ -363,9 +363,9 @@ void MiscManager_TypeB(MiscManager* this) { } bool32 sub_080593CC(MiscManager* this) { - if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.animationState == 0 && + if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.swim_state != 0 && gPlayerEntity.base.animationState == 0 && (gPlayerState.playerInput.heldInput & INPUT_ANY_DIRECTION) == INPUT_UP) { - return EntityWithinDistance(&gPlayerEntity, this->unk_38, this->unk_3a + 0xC, 6); + return EntityWithinDistance(&gPlayerEntity.base, this->unk_38, this->unk_3a + 0xC, 6); } return FALSE; } @@ -395,7 +395,7 @@ void MiscManager_TypeD(MiscManager* this) { if (gRoomVars.field_0x0) { StartPlayerScript(gUnk_08108380[gRoomControls.scroll_direction]); } else { - StartPlayerScript(gUnk_08108380[gPlayerEntity.animationState >> 1]); + StartPlayerScript(gUnk_08108380[gPlayerEntity.base.animationState >> 1]); } } DeleteThisEntity(); @@ -431,7 +431,7 @@ void MiscManager_TypeE(MiscManager* this) { #if defined(USA) || defined(DEMO_USA) || defined(DEMO_JP) void MiscManager_TypeF(MiscManager* this) { SetEntityPriority((Entity*)this, PRIO_PLAYER_EVENT); - if (gPlayerEntity.action == PLAYER_TALKEZLO) { + if (gPlayerEntity.base.action == PLAYER_TALKEZLO) { DeleteThisEntity(); } gInput.heldKeys |= SELECT_BUTTON; diff --git a/src/manager/moveableObjectManager.c b/src/manager/moveableObjectManager.c index bc9a05c2..21756299 100644 --- a/src/manager/moveableObjectManager.c +++ b/src/manager/moveableObjectManager.c @@ -6,7 +6,6 @@ * * E.g. for pushable rock. */ -#define ENT_DEPRECATED #include "manager/moveableObjectManager.h" #include "flags.h" #include "room.h" @@ -15,7 +14,7 @@ void MoveableObjectManager_Main(MoveableObjectManager* this) { Entity* object = CreateObject(super->timer, super->type, super->type2); if (!object) return; - object->field_0x86.HWORD = this->flags; + ((GenericEntity*)object)->field_0x86.HWORD = this->flags; if (CheckFlags(this->flags)) { object->x.HALF.HI = this->unk_36 | (this->unk_37 & 0xF) << 8; // r1 object->y.HALF.HI = this->unk_3c & 0xFFF; diff --git a/src/manager/pushableFurnitureManager.c b/src/manager/pushableFurnitureManager.c index 687203a0..f701bc42 100644 --- a/src/manager/pushableFurnitureManager.c +++ b/src/manager/pushableFurnitureManager.c @@ -4,10 +4,11 @@ * * @brief Creates pushable furniture based on a room property list. */ -#define ENT_DEPRECATED #include "manager/pushableFurnitureManager.h" + #include "flags.h" #include "object.h" +#include "object/pushableFurniture.h" #include "room.h" void PushableFurnitureManager_Init(PushableFurnitureManager*); @@ -36,16 +37,16 @@ void PushableFurnitureManager_Init(PushableFurnitureManager* this) { this->unk_28 = 0; this->unk_29 = 0; while (tmp->unk_00 != 0xFF && super->timer < 0x20) { - Entity* obj; - obj = CreateObject(PUSHABLE_FURNITURE, tmp->unk_01, tmp->unk_02); - if (obj) { - obj->timer = tmp->unk_03; - obj->x.HALF.HI = gRoomControls.origin_x + tmp->unk_04; - obj->y.HALF.HI = gRoomControls.origin_y + tmp->unk_06; - obj->parent = (Entity*)this; - obj->collisionLayer = 1; - obj->field_0x82.HALF.HI = super->timer; - obj->field_0x82.HALF.LO = tmp->unk_00; + PushableFurnitureEntity* furniture = + (PushableFurnitureEntity*)CreateObject(PUSHABLE_FURNITURE, tmp->unk_01, tmp->unk_02); + if (furniture) { + furniture->base.timer = tmp->unk_03; + furniture->base.x.HALF.HI = gRoomControls.origin_x + tmp->unk_04; + furniture->base.y.HALF.HI = gRoomControls.origin_y + tmp->unk_06; + furniture->base.parent = (Entity*)this; + furniture->base.collisionLayer = 1; + furniture->unk_83 = super->timer; + furniture->unk_82 = tmp->unk_00; this->unk_29 |= 1 << super->timer; } tmp++; @@ -76,13 +77,13 @@ void PushableFurnitureManager_Action2(PushableFurnitureManager* this) { void sub_0805C7CC(PushableFurnitureManager* this) { if (gPlayerState.flags & PL_MINISH) { - if (gPlayerEntity.y.HALF.HI < this->unk_2a + 0x10) { + if (gPlayerEntity.base.y.HALF.HI < this->unk_2a + 0x10) { super->subAction = 1; } else { super->subAction = 0; } } else { - if (gPlayerEntity.y.HALF.HI < this->unk_2a + 0x28) { + if (gPlayerEntity.base.y.HALF.HI < this->unk_2a + 0x28) { super->subAction = 3; } else { super->subAction = 2; diff --git a/src/manager/rollingBarrelManager.c b/src/manager/rollingBarrelManager.c index 20c8b3f1..e309f017 100644 --- a/src/manager/rollingBarrelManager.c +++ b/src/manager/rollingBarrelManager.c @@ -93,7 +93,7 @@ void sub_080588F8(RollingBarrelManager* this) { } } if (super->timer) { - s32 tmp = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y; + s32 tmp = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y; u32 tmp2; tmp2 = (((unsigned)(tmp - 0x50 < 0 ? 0x50 - tmp : tmp - 0x50) >> 3) * 0x3000) + 0x4000; if (super->subtimer == 0) { @@ -134,14 +134,14 @@ void sub_08058A04(RollingBarrelManager* this) { { 0x9C, 0x78, 0x1A, 0x16 }, { 0x9A, 0x70, 0x1A, 0x18 }, { 0x98, 0x64, 0x1E, 0x1E }, { 0x98, 0x6A, 0x1C, 0x10 } }; - s32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x; - s32 tmp2 = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y; + s32 tmp = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x; + s32 tmp2 = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y; if ((this->unk_20 - 0x118 < 0xDu) && CheckGlobalFlag(LV1TARU_OPEN) && (tmp - 0x6d < 0x17u) && - (tmp2 - 0x45 < 0x17u) && (gPlayerEntity.z.HALF.HI == 0)) { + (tmp2 - 0x45 < 0x17u) && (gPlayerEntity.base.z.HALF.HI == 0)) { gPlayerState.queued_action = PLAYER_FALL; gPlayerState.field_0x38 = 0; - gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x78; - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x50; + gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + 0x78; + gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0x50; return; } if (tmp < 0x78) { @@ -176,8 +176,8 @@ u32 sub_08058B08(RollingBarrelManager* this, u32 unk1, u32 unk2, const struct_08 tmp -= unk1; tmp >>= 3; unk3 += tmp; - tmp2 = (gPlayerEntity.x.HALF.HI - gRoomControls.origin_x - unk3->unk_0); - tmp3 = (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y - unk3->unk_2); + tmp2 = (gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x - unk3->unk_0); + tmp3 = (gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y - unk3->unk_2); return ((tmp2 < unk3->unk_4) && (tmp3 < unk3->unk_6)); } } @@ -230,8 +230,8 @@ void sub_08058BC8(RollingBarrelManager* this) { void sub_08058CB0(RollingBarrelManager* this) { static const u16 gUnk_08108300[4] = { 0xA4, 0x4C, 0xF4, 0x9C }; - u32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x; - u32 tmp2 = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y; + u32 tmp = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x; + u32 tmp2 = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y; u32 tmp3; if (tmp < 0x78) { tmp3 = 1; @@ -248,12 +248,12 @@ void sub_08058CB0(RollingBarrelManager* this) { } void sub_08058CFC(void) { - u32 tmp = gPlayerEntity.y.HALF.HI - gRoomControls.scroll_y; + u32 tmp = gPlayerEntity.base.y.HALF.HI - gRoomControls.scroll_y; if (tmp < 0x4C) { - sub_080044AE(&gPlayerEntity, 0xC0, 0x10); + sub_080044AE(&gPlayerEntity.base, 0xC0, 0x10); } if (tmp > 0x54) { - sub_080044AE(&gPlayerEntity, 0xC0, 0); + sub_080044AE(&gPlayerEntity.base, 0xC0, 0); } } diff --git a/src/manager/specialWarpManager.c b/src/manager/specialWarpManager.c index f387761e..f62ac451 100644 --- a/src/manager/specialWarpManager.c +++ b/src/manager/specialWarpManager.c @@ -22,10 +22,10 @@ void SpecialWarpManager_Main(SpecialWarpManager* this) { if (super->timer == 0 || gPlayerState.floor_type == SURFACE_LADDER) { for (data = this->warpList; data->posX != 0xffff; data++) { collisionLayer = (data->unk_07.all & 0x3); - if ((collisionLayer & gPlayerEntity.collisionLayer) != 0) { + if ((collisionLayer & gPlayerEntity.base.collisionLayer) != 0) { if ((gPlayerState.flags & PL_MINISH) != 0 || data->unk_07.b.unk2 != 0) { if (CheckPlayerInRegion(data->posX, data->posY, data->width, data->height) && - gPlayerEntity.z.HALF.HI == 0) { + gPlayerEntity.base.z.HALF.HI == 0) { DoExitTransition(GetCurrentRoomProperty(data->roomProperty)); } } diff --git a/src/manager/templeOfDropletsManager.c b/src/manager/templeOfDropletsManager.c index 62ea646a..14fc1d75 100644 --- a/src/manager/templeOfDropletsManager.c +++ b/src/manager/templeOfDropletsManager.c @@ -334,14 +334,14 @@ void TempleOfDropletsManager_Type6_Action1(TempleOfDropletsManager* this) { } void TempleOfDropletsManager_Type6_Action2(TempleOfDropletsManager* this) { - if ((gPlayerEntity.health != 0) && (gPlayerEntity.z.HALF.HI == 0) && (!gPlayerState.item)) { + if ((gPlayerEntity.base.health != 0) && (gPlayerEntity.base.z.HALF.HI == 0) && (!gPlayerState.item)) { switch (gPlayerState.framestate_last) { case PL_STATE_IDLE: case PL_STATE_WALK: if (sub_0805A73C(this)) { super->action++; - sub_08004168(&gPlayerEntity); - gPlayerEntity.animationState = 4; + sub_08004168(&gPlayerEntity.base); + gPlayerEntity.base.animationState = 4; RequestPriorityDuration((Entity*)this, 600); SetPlayerControl(0xFF); gPauseMenuOptions.disabled = 1; diff --git a/src/manager/tilePuzzleManager.c b/src/manager/tilePuzzleManager.c index a229878f..d85b92bd 100644 --- a/src/manager/tilePuzzleManager.c +++ b/src/manager/tilePuzzleManager.c @@ -24,10 +24,10 @@ void TilePuzzleManager_Main(TilePuzzleManager* this) { super->action = IN_PROGRESS; super->subtimer = super->timer; this->own_tile = (((this->x >> 4) & 0x3fU) | ((this->y >> 4) & 0x3fU) << 6); - this->player_previous_tile = this->player_current_tile = COORD_TO_TILE((&gPlayerEntity)); + this->player_previous_tile = this->player_current_tile = COORD_TO_TILE((&gPlayerEntity.base)); break; case 1: - this->player_current_tile = COORD_TO_TILE((&gPlayerEntity)); + this->player_current_tile = COORD_TO_TILE((&gPlayerEntity.base)); if (this->player_current_tile != this->player_previous_tile) { this->player_previous_tile = this->player_current_tile; switch (GetTileType(this->player_current_tile, super->type2)) { diff --git a/src/manager/vaati3StartManager.c b/src/manager/vaati3StartManager.c index c30c1e4b..1fa0c618 100644 --- a/src/manager/vaati3StartManager.c +++ b/src/manager/vaati3StartManager.c @@ -63,8 +63,8 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) { s32 distY; Entity* object; - distX = gPlayerEntity.x.HALF.HI - (gRoomControls.origin_x + 0x88); - distY = gPlayerEntity.y.HALF.HI - (gRoomControls.origin_y + 0x40); + distX = gPlayerEntity.base.x.HALF.HI - (gRoomControls.origin_x + 0x88); + distY = gPlayerEntity.base.y.HALF.HI - (gRoomControls.origin_y + 0x40); if (distX * distX + distY * distY < 0x901) { super->action = 2; super->subAction = 0; @@ -76,7 +76,7 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) { object->x.HALF.HI = gRoomControls.origin_x + 0x88; object->y.HALF.HI = gRoomControls.origin_y + 0x48; } - object = CreateSpeechBubbleExclamationMark(&gPlayerEntity, 8, 0xfffffff0); + object = CreateSpeechBubbleExclamationMark(&gPlayerEntity.base, 8, 0xfffffff0); if (object != NULL) { object->spritePriority.b0 = 3; } @@ -85,10 +85,10 @@ void Vaati3StartManager_Type0_Action1(Vaati3StartManager* this) { } void Vaati3StartManager_Type0_Action2(Vaati3StartManager* this) { - gPlayerEntity.animationState = 0; - if (gPlayerEntity.z.HALF.HI != 0) { - if (gPlayerEntity.y.HALF.HI < (gRoomControls.origin_y + 0x48)) { - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x48; + gPlayerEntity.base.animationState = 0; + if (gPlayerEntity.base.z.HALF.HI != 0) { + if (gPlayerEntity.base.y.HALF.HI < (gRoomControls.origin_y + 0x48)) { + gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0x48; } } else { if (--super->timer == 0) { diff --git a/src/manager/waterfallBottomManager.c b/src/manager/waterfallBottomManager.c index d449a3ae..a8e3f4c4 100644 --- a/src/manager/waterfallBottomManager.c +++ b/src/manager/waterfallBottomManager.c @@ -11,10 +11,10 @@ void WaterfallBottomManager_Main(WaterfallBottomManager* this) { SetTile(0x4014, 0x5c3, 1); - if ((gRoomControls.origin_y + 200 < gPlayerEntity.y.HALF.HI) && - ((u32)(gPlayerEntity.x.HALF.HI - gRoomControls.origin_x) - 0x30 < 0x11)) { - gPlayerEntity.collisionLayer = 3; - UpdateSpriteForCollisionLayer(&gPlayerEntity); + if ((gRoomControls.origin_y + 200 < gPlayerEntity.base.y.HALF.HI) && + ((u32)(gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x) - 0x30 < 0x11)) { + gPlayerEntity.base.collisionLayer = 3; + UpdateSpriteForCollisionLayer(&gPlayerEntity.base); } DeleteManager(super); } diff --git a/src/manager/weatherChangeManager.c b/src/manager/weatherChangeManager.c index f1988de4..83fa2d16 100644 --- a/src/manager/weatherChangeManager.c +++ b/src/manager/weatherChangeManager.c @@ -153,11 +153,11 @@ void sub_080596E0(WeatherChangeManager* this) { } u32 sub_08059844(void) { - return gPlayerEntity.x.HALF.HI - gRoomControls.origin_x > gRoomControls.width >> 1; + return gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x > gRoomControls.width >> 1; } u32 sub_0805986C(void) { - return gPlayerEntity.x.HALF.HI - gRoomControls.origin_x > 0x200; + return gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x > 0x200; } void sub_08059894(const u16* unk1, const u16* unk2, u32 unk3) { diff --git a/src/npc/anju.c b/src/npc/anju.c index 199629d4..2e1b02bd 100644 --- a/src/npc/anju.c +++ b/src/npc/anju.c @@ -25,8 +25,8 @@ void Anju(AnjuEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4( - GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4(GetFacingDirection( + super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/beedle.c b/src/npc/beedle.c index a77d7390..0729e1cc 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -195,8 +195,8 @@ void sub_0806346C(Entity* this) { s32 iVar2; s32 iVar3; - iVar3 = (gPlayerEntity.x.HALF.HI - this->x.HALF.HI); - iVar2 = (gPlayerEntity.y.HALF.HI - this->y.HALF.HI); + iVar3 = (gPlayerEntity.base.x.HALF.HI - this->x.HALF.HI); + iVar2 = (gPlayerEntity.base.y.HALF.HI - this->y.HALF.HI); iVar3 += 0x30; iVar2 += 0x18; @@ -216,7 +216,7 @@ void sub_0806346C(Entity* this) { iVar3 >>= 4; iVar2 >>= 4; - bVar1 = gUnk_0810C8F0[iVar2][iVar3][gPlayerEntity.animationState >> 1]; + bVar1 = gUnk_0810C8F0[iVar2][iVar3][gPlayerEntity.base.animationState >> 1]; if (bVar1 != this->type2) { const InteractCollisionData* data = &gBeedleCollisionData[bVar1]; SetInteractableObjectCollision(this, 1, data->interactDirections, data); diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index aded3196..87b4884b 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -92,10 +92,10 @@ void sub_0806CF30(BigGoronEntity* this) { case 0: case 1: if (gRoomTransition.frameCount % 4 == 0) { - if (gPlayerEntity.x.HALF.HI < super->x.HALF.HI && this->originalX - 32 < super->x.HALF.HI) { + if (gPlayerEntity.base.x.HALF.HI < super->x.HALF.HI && this->originalX - 32 < super->x.HALF.HI) { super->x.HALF.HI--; } - if (gPlayerEntity.x.HALF.HI > super->x.HALF.HI && this->originalX + 32 > super->x.HALF.HI) { + if (gPlayerEntity.base.x.HALF.HI > super->x.HALF.HI && this->originalX + 32 > super->x.HALF.HI) { super->x.HALF.HI++; } } @@ -542,8 +542,8 @@ void sub_0806D788(void) { void sub_0806D7C4(Entity* this, ScriptExecutionContext* context) { Entity* entity; - this->x.HALF.HI = gPlayerEntity.x.HALF.HI; - this->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0x18; + this->x.HALF.HI = gPlayerEntity.base.x.HALF.HI; + this->y.HALF.HI = gPlayerEntity.base.y.HALF.HI - 0x18; entity = FindEntity(NPC, BIG_GORON, 7, 2, 0); if (entity != NULL) { sub_0807DEDC(this, context, entity->x.HALF.HI, entity->y.HALF.HI); @@ -557,7 +557,7 @@ void sub_0806D804(Entity* this, ScriptExecutionContext* context) { this->y.HALF.HI = entity->y.HALF.HI - 0x10; this->spritePriority.b1 = 0; } - sub_0807DEDC(this, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0x10); + sub_0807DEDC(this, context, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI - 0x10); } void sub_0806D858(Entity* this) { diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index 002c5d0a..6926a87a 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -313,7 +313,7 @@ void sub_08068b2c(BladeBrothersEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - animationState = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + animationState = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)); InitAnimationForceUpdate(super, animationState); InitializeNPCFusion(super); } else { diff --git a/src/npc/brocco.c b/src/npc/brocco.c index d4bfa44d..b4ab49e7 100644 --- a/src/npc/brocco.c +++ b/src/npc/brocco.c @@ -91,8 +91,8 @@ void sub_0806362C(BroccoEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 4); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, NULL); diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index 28123e37..690f6c67 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -42,8 +42,9 @@ void Carpenter(CarpenterEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + - 4 + (super->type * 8)); + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 4 + + (super->type * 8)); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, 0); diff --git a/src/npc/castleMaid.c b/src/npc/castleMaid.c index 448f0a30..2a47701a 100644 --- a/src/npc/castleMaid.c +++ b/src/npc/castleMaid.c @@ -91,7 +91,8 @@ void sub_08064570(CastleMaidEntity* this) { if (super->interactType != INTERACTION_NONE) { super->action++; super->interactType = INTERACTION_NONE; - InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); if (this->dialogFunc != NULL) { this->dialogFunc(); } diff --git a/src/npc/cat.c b/src/npc/cat.c index 9096a5a4..a3228998 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -142,7 +142,7 @@ void sub_080677EC(CatEntity* this) { super->hitType = -0x58; super->flags2 = 1; this->unk_69 = 0xff; - if (super->x.HALF.HI < gPlayerEntity.x.HALF.HI) { + if (super->x.HALF.HI < gPlayerEntity.base.x.HALF.HI) { super->spriteSettings.flipX = 1; } else { super->spriteSettings.flipX = 0; @@ -321,7 +321,7 @@ void sub_08067B80(CatEntity* this, u32 animIndex) { this->unk_74 = (Random() & 0x7f) + 0x1e; InitAnimationForceUpdate(super, animIndex); sub_08067DDC(super); - if (super->x.HALF.HI < gPlayerEntity.x.HALF.HI) { + if (super->x.HALF.HI < gPlayerEntity.base.x.HALF.HI) { super->spriteSettings.flipX = 1; } else { super->spriteSettings.flipX = 0; @@ -330,11 +330,11 @@ void sub_08067B80(CatEntity* this, u32 animIndex) { void sub_08067BD4(Entity* this) { if (this->spriteSettings.flipX > 0) { - if (this->x.HALF.HI - 4 > gPlayerEntity.x.HALF.HI) { + if (this->x.HALF.HI - 4 > gPlayerEntity.base.x.HALF.HI) { this->spriteSettings.flipX = 0; } } else { - if (this->x.HALF.HI + 4 < gPlayerEntity.x.HALF.HI) { + if (this->x.HALF.HI + 4 < gPlayerEntity.base.x.HALF.HI) { this->spriteSettings.flipX = 1; } } @@ -376,7 +376,7 @@ void sub_08067C44(CatEntity* this) { return; } - iVar4 = sub_0806FCA0(super, &gPlayerEntity); + iVar4 = sub_0806FCA0(super, &gPlayerEntity.base); switch (super->animIndex) { case 0: default: diff --git a/src/npc/dampe.c b/src/npc/dampe.c index 8652612e..31866c7e 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -29,8 +29,8 @@ void Dampe(Entity* this) { if (this->interactType == INTERACTION_FUSE) { this->action = 2; this->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(this, - GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity)) + 4); + InitAnimationForceUpdate( + this, GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity.base)) + 4); InitializeNPCFusion(this); } else { ExecuteScriptAndHandleAnimation(this, NULL); diff --git a/src/npc/din.c b/src/npc/din.c index b125cc95..604c03bb 100644 --- a/src/npc/din.c +++ b/src/npc/din.c @@ -26,8 +26,8 @@ void Din(DinEntity* this) { super->interactType = INTERACTION_NONE; InitializeNPCFusion(super); this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { ExecuteScriptAndHandleAnimation(super, NULL); } diff --git a/src/npc/dog.c b/src/npc/dog.c index f5512406..3ca53e97 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -265,7 +265,7 @@ void sub_08069CB8(DogEntity* this) { u32 direction; u32 animState; - direction = GetFacingDirection(super, &gPlayerEntity); + direction = GetFacingDirection(super, &gPlayerEntity.base); animState = gUnk_08111DB0[direction + super->animationState * 0x20]; super->animationState = animState >> 6; this->unk_6b = animState & 0x3f; @@ -429,7 +429,7 @@ bool32 sub_08069F90(DogEntity* this) { if ((super->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) { return TRUE; } else { - return EntityInRectRadius(super, &gPlayerEntity, 0x14, 0x14); + return EntityInRectRadius(super, &gPlayerEntity.base, 0x14, 0x14); } } diff --git a/src/npc/epona.c b/src/npc/epona.c index 1421262b..bec976fd 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -103,7 +103,8 @@ void sub_08065AA4(EponaEntity* this) { SetEntityPriority(super, PRIO_MESSAGE); sub_08065A50(this); } - InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { sub_08065A50(this); ResetPlayerAnimationAndAction(); diff --git a/src/npc/ezlo.c b/src/npc/ezlo.c index 15d4a715..b80078cb 100644 --- a/src/npc/ezlo.c +++ b/src/npc/ezlo.c @@ -32,8 +32,8 @@ void sub_0806D8A0(Entity* this, ScriptExecutionContext* context) { if (this->spriteSettings.flipX) { xOffset = -xOffset; } - xOffset += gPlayerEntity.x.HALF.HI; - yOffset = gPlayerEntity.y.HALF.HI + 2; + xOffset += gPlayerEntity.base.x.HALF.HI; + yOffset = gPlayerEntity.base.y.HALF.HI + 2; context->x.HALF.HI = xOffset; context->y.HALF.HI = yOffset; @@ -43,15 +43,15 @@ void sub_0806D8A0(Entity* this, ScriptExecutionContext* context) { } void sub_0806D908(Entity* this) { - this->direction = - CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); + this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gPlayerEntity.base.x.HALF.HI, + gPlayerEntity.base.y.HALF.HI); this->animationState = (this->animationState & 0x80) | gUnk_08114144[this->direction >> 0x1]; } // called when talk to ezlo, also when ezlo moves after you void sub_0806D944(Entity* this) { this->spriteSettings.flipX = 0; - if (this->x.WORD <= gPlayerEntity.x.WORD) { + if (this->x.WORD <= gPlayerEntity.base.x.WORD) { this->spriteSettings.flipX = 1; } } @@ -66,12 +66,12 @@ void sub_0806D96C(Entity* this) { } void sub_0806D9A4(Entity* this) { - if (this->x.WORD <= gPlayerEntity.x.WORD) { - gPlayerEntity.spriteSettings.flipX = 0; + if (this->x.WORD <= gPlayerEntity.base.x.WORD) { + gPlayerEntity.base.spriteSettings.flipX = 0; } else { - gPlayerEntity.spriteSettings.flipX = 1; + gPlayerEntity.base.spriteSettings.flipX = 1; } - gPlayerEntity.animationState = 4; + gPlayerEntity.base.animationState = 4; } // animation states diff --git a/src/npc/farore.c b/src/npc/farore.c index 5a553f07..ae08c094 100644 --- a/src/npc/farore.c +++ b/src/npc/farore.c @@ -26,8 +26,8 @@ void Farore(FaroreEntity* this) { super->interactType = INTERACTION_NONE; InitializeNPCFusion(super); this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { ExecuteScriptAndHandleAnimation(super, NULL); } diff --git a/src/npc/festari.c b/src/npc/festari.c index fb4d15f9..8a13f80a 100644 --- a/src/npc/festari.c +++ b/src/npc/festari.c @@ -46,7 +46,7 @@ void sub_0805FE48(FestariEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScript(super, this->context); diff --git a/src/npc/gentari.c b/src/npc/gentari.c index c7ed252b..968f71fc 100644 --- a/src/npc/gentari.c +++ b/src/npc/gentari.c @@ -26,8 +26,8 @@ void Gentari(GentariEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c index 7bf07ad6..9282b35f 100644 --- a/src/npc/ghostBrothers.c +++ b/src/npc/ghostBrothers.c @@ -80,8 +80,8 @@ void sub_08065C0C(GhostBrothersEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/gina.c b/src/npc/gina.c index 46b13bcd..0124c37e 100644 --- a/src/npc/gina.c +++ b/src/npc/gina.c @@ -27,8 +27,8 @@ void Gina(GinaEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/gregal.c b/src/npc/gregal.c index 4a2e3fb5..f081280a 100644 --- a/src/npc/gregal.c +++ b/src/npc/gregal.c @@ -102,8 +102,8 @@ void sub_0806CC08(GregalEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 8); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 8); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, NULL); diff --git a/src/npc/guard.c b/src/npc/guard.c index 7a18d62d..760bb6b0 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -319,7 +319,7 @@ void sub_08063DC8(Entity* this) { if (this->type == 0xff) { this->action = 2; this->timer = 30; - this->animationState = GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity)); + this->animationState = GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity.base)); InitAnimationForceUpdate(this, this->animationState + 4); } else { sub_0806EE20(this); @@ -332,7 +332,7 @@ void sub_08063DC8(Entity* this) { if (this->interactType != INTERACTION_NONE) { this->action = 3; this->interactType = INTERACTION_NONE; - InitializeAnimation(this, GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity))); + InitializeAnimation(this, GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity.base))); sub_08064428(this); } } @@ -389,8 +389,8 @@ void sub_08063F20(GuardEntity* this) { if (super->interactType != INTERACTION_NONE) { super->action++; super->interactType = INTERACTION_NONE; - InitializeAnimation(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + this->unk_70); + InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + + this->unk_70); sub_08064428(super); } } diff --git a/src/npc/guardWithSpear.c b/src/npc/guardWithSpear.c index 8d9bf404..e4821138 100644 --- a/src/npc/guardWithSpear.c +++ b/src/npc/guardWithSpear.c @@ -111,7 +111,7 @@ void sub_08064198(GuardWithSpearEntity* this) { this->unk_71--; } - yDiff = gPlayerEntity.y.HALF.HI - super->y.HALF.HI; + yDiff = gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI; if (2 < yDiff) { yDiff = 2; } @@ -131,7 +131,7 @@ void sub_08064198(GuardWithSpearEntity* this) { sVar1 = super->y.HALF.HI; ProcessMovement0(super); if (sVar1 != super->y.HALF.HI) { - if (0x140 < gPlayerEntity.speed && gRoomTransition.frameCount % 6 == 0) { + if (0x140 < gPlayerEntity.base.speed && gRoomTransition.frameCount % 6 == 0) { CreateDustSmall(super); } this->unk_71 = 10; @@ -144,7 +144,7 @@ void sub_08064198(GuardWithSpearEntity* this) { } if (this->unk_71 == 0) { animationState = super->animationState = - GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity)); + GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity.base)); animIndex = (animationState >> 1) + this->unk_70; if (animIndex != super->animIndex) { InitializeAnimation(super, animIndex); @@ -152,8 +152,8 @@ void sub_08064198(GuardWithSpearEntity* this) { } sub_0806ED78(super); sVar1 = super->z.HALF.HI; - super->z.HALF.HI = gPlayerEntity.z.HALF.HI; - if (sVar1 < 0 && gPlayerEntity.z.HALF.HI == 0) { + super->z.HALF.HI = gPlayerEntity.base.z.HALF.HI; + if (sVar1 < 0 && gPlayerEntity.base.z.HALF.HI == 0) { CreateDustSmall(super); } } @@ -168,7 +168,7 @@ void sub_080642B8(GuardWithSpearEntity* this) { this->unk_71--; } - yDiff = gPlayerEntity.x.HALF.HI - super->x.HALF.HI; + yDiff = gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI; if (2 < yDiff) { yDiff = 2; } @@ -188,7 +188,7 @@ void sub_080642B8(GuardWithSpearEntity* this) { sVar1 = super->x.HALF.HI; ProcessMovement0(super); if (sVar1 != super->x.HALF.HI) { - if (0x140 < gPlayerEntity.speed && gRoomTransition.frameCount % 6 == 0) { + if (0x140 < gPlayerEntity.base.speed && gRoomTransition.frameCount % 6 == 0) { CreateDustSmall(super); } this->unk_71 = 10; @@ -201,7 +201,7 @@ void sub_080642B8(GuardWithSpearEntity* this) { } if (this->unk_71 == 0) { animationState = super->animationState = - GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity)); + GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity.base)); animIndex = (animationState >> 1) + this->unk_70; if (animIndex != super->animIndex) { InitializeAnimation(super, animIndex); @@ -209,8 +209,8 @@ void sub_080642B8(GuardWithSpearEntity* this) { } sub_0806ED78(super); sVar1 = super->z.HALF.HI; - super->z.HALF.HI = gPlayerEntity.z.HALF.HI; - if (sVar1 < 0 && gPlayerEntity.z.HALF.HI == 0) { + super->z.HALF.HI = gPlayerEntity.base.z.HALF.HI; + if (sVar1 < 0 && gPlayerEntity.base.z.HALF.HI == 0) { CreateDustSmall(super); } } diff --git a/src/npc/hurdyGurdyMan.c b/src/npc/hurdyGurdyMan.c index 90580f2d..eb271392 100644 --- a/src/npc/hurdyGurdyMan.c +++ b/src/npc/hurdyGurdyMan.c @@ -37,7 +37,8 @@ void HurdyGurdyMan(HurdyGurdyManEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->unk_69 = super->animIndex; - InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); index = GetFuserId(super); pointerToArray = gUnk_08001A7C[index]; if (this->fusionOffer == 0x32) { diff --git a/src/npc/kid.c b/src/npc/kid.c index 281bbc93..aa4bcbea 100644 --- a/src/npc/kid.c +++ b/src/npc/kid.c @@ -313,7 +313,7 @@ void sub_080621AC(KidEntity* this) { if (super->animIndex < 8) { InitializeAnimation(super, (super->animIndex & 0xfffffffc) + - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } break; case 2: @@ -353,17 +353,17 @@ void sub_080622F4(KidEntity* this) { KidHeapItem item; // Prepended heap item is initialized from player's current state. - item.FIELDS.x = gPlayerEntity.x.HALF_U.HI; - item.FIELDS.y = gPlayerEntity.y.HALF_U.HI; - item.FIELDS.z = gPlayerEntity.z.HALF_U.HI; + item.FIELDS.x = gPlayerEntity.base.x.HALF_U.HI; + item.FIELDS.y = gPlayerEntity.base.y.HALF_U.HI; + item.FIELDS.z = gPlayerEntity.base.z.HALF_U.HI; item.FIELDS.framestate = gPlayerState.framestate; - item.FIELDS.animationState = gPlayerEntity.animationState; - item.FIELDS.collisionLayer = gPlayerEntity.collisionLayer; + item.FIELDS.animationState = gPlayerEntity.base.animationState; + item.FIELDS.collisionLayer = gPlayerEntity.base.collisionLayer; heapPtr = super->myHeap; if (heapPtr->FIELDS.framestate == 0x16 && item.FIELDS.framestate != 0x16) { - dx = super->x.HALF.HI - gPlayerEntity.x.HALF.HI; - dy = super->y.HALF.HI - gPlayerEntity.y.HALF.HI; + dx = super->x.HALF.HI - gPlayerEntity.base.x.HALF.HI; + dy = super->y.HALF.HI - gPlayerEntity.base.y.HALF.HI; if (dx < 0) dx = -dx; @@ -395,7 +395,7 @@ void sub_080622F4(KidEntity* this) { KID_HEAP_SHIFT_RIGHT; animIndex = 0x4; } else { - dist = sub_080041E8(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, (u16)heapPtr->FIELDS.x, + dist = sub_080041E8(gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, (u16)heapPtr->FIELDS.x, (u16)heapPtr->FIELDS.y); dist = ((u32)dist) >> 0x4; if (dist > 0x18) { @@ -465,20 +465,20 @@ void sub_0806252C(Entity* this) { s32 r10; FORCE_REGISTER(s32 x, r12); - r1 = gPlayerEntity.x.HALF_U.HI; + r1 = gPlayerEntity.base.x.HALF_U.HI; r3 = 0xffff0000; r0 = r3; r0 &= r5; r0 |= r1; - r1 = gPlayerEntity.y.HALF_U.HI; + r1 = gPlayerEntity.base.y.HALF_U.HI; r1 <<= 0x10; r2 = 0x0000ffff; r0 &= r2; r0 |= r1; r5 = r0; - r0 = gPlayerEntity.z.HALF_U.HI; + r0 = gPlayerEntity.base.z.HALF_U.HI; r3 &= r6; r3 |= r0; @@ -488,7 +488,7 @@ void sub_0806252C(Entity* this) { r2 &= r3; r2 |= r0; - r1 = gPlayerEntity.animationState; + r1 = gPlayerEntity.base.animationState; r0 = 0x3f; r1 &= r0; r1 <<= 0x18; @@ -496,15 +496,15 @@ void sub_0806252C(Entity* this) { r0 &= r2; r0 |= r1; - r1 = gPlayerEntity.collisionLayer; + r1 = gPlayerEntity.base.collisionLayer; r1 <<= 0x1e; r2 = 0x3fffffff; r0 &= r2; r0 |= r1; r6 = r0; - r10 = r0 = gPlayerEntity.x.HALF.HI - this->x.HALF.HI; - r8 = r0 = gPlayerEntity.y.HALF.HI - this->y.HALF.HI; + r10 = r0 = gPlayerEntity.base.x.HALF.HI - this->x.HALF.HI; + r8 = r0 = gPlayerEntity.base.y.HALF.HI - this->y.HALF.HI; r10 = FixedDiv(r10, KID_HEAP_COUNT); r8 = FixedDiv(r8, KID_HEAP_COUNT); diff --git a/src/npc/kingDaltus.c b/src/npc/kingDaltus.c index cc901f18..1840e24e 100644 --- a/src/npc/kingDaltus.c +++ b/src/npc/kingDaltus.c @@ -37,7 +37,8 @@ void KingDaltus(KingDaltusEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->interactType = INTERACTION_NONE; super->action = 2; - InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } scriptedActionFuncs[super->action](this); diff --git a/src/npc/malon.c b/src/npc/malon.c index 65e1ab77..9584078f 100644 --- a/src/npc/malon.c +++ b/src/npc/malon.c @@ -62,7 +62,7 @@ void sub_080658BC(MalonEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/mama.c b/src/npc/mama.c index cdcb3cb3..fa20f7a2 100644 --- a/src/npc/mama.c +++ b/src/npc/mama.c @@ -39,7 +39,8 @@ void Mama(MamaEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, NULL); diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index 25887beb..9f4aeb4c 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -32,8 +32,8 @@ void MayorHagen(MayorHagenEntity* this) { super->action = v; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - 4 + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, 4 + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); break; } diff --git a/src/npc/ministerPotho.c b/src/npc/ministerPotho.c index 3004e7ce..1532a424 100644 --- a/src/npc/ministerPotho.c +++ b/src/npc/ministerPotho.c @@ -78,8 +78,8 @@ void sub_08066864(MinisterPothoEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c index 24e3be4d..4bbf89b9 100644 --- a/src/npc/mountainMinish.c +++ b/src/npc/mountainMinish.c @@ -134,7 +134,8 @@ void sub_08067EF0(MountainMinishEntity* this) { super->action = 3; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, 0); @@ -143,7 +144,7 @@ void sub_08067EF0(MountainMinishEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; InitializeAnimation(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); sub_08068190(super); } } diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c index 0390ac03..5e09a1d0 100644 --- a/src/npc/mutoh.c +++ b/src/npc/mutoh.c @@ -43,8 +43,8 @@ void Mutoh(MutohEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 4); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/nayru.c b/src/npc/nayru.c index cdf79cc5..5130dbf5 100644 --- a/src/npc/nayru.c +++ b/src/npc/nayru.c @@ -26,8 +26,8 @@ void Nayru(NayruEntity* this) { super->interactType = INTERACTION_NONE; InitializeNPCFusion(super); this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { ExecuteScriptAndHandleAnimation(super, NULL); } diff --git a/src/npc/npc23.c b/src/npc/npc23.c index 4c43992a..acda02d4 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -51,7 +51,7 @@ void sub_080662F8(NPC23Entity* this) { this->unk_80 = super->y.HALF.HI; this->unk_86 = 0; this->unk_82 = super->timer; - super->parent = &gPlayerEntity; + super->parent = &gPlayerEntity.base; this->unk_84 = 0; sub_08066490(this, super->parent); AddInteractableWhenBigObject(super); @@ -86,7 +86,7 @@ void nullsub_110(NPC23Entity* this) { void sub_080663D4(NPC23Entity* this) { if (super->x.HALF.HI == this->unk_7e - 8) { - if (gPlayerEntity.action != PLAYER_ROOM_EXIT) { + if (gPlayerEntity.base.action != PLAYER_ROOM_EXIT) { super->action = 4; super->direction = 0; super->speed = 0; @@ -109,14 +109,14 @@ void sub_0806643C(NPC23Entity* this) { super->action = 5; gRoomControls.camera_target = NULL; sub_08078AC0(0x40, 0, 0); - gPlayerEntity.animationState = 0; - gPlayerEntity.direction = 0; + gPlayerEntity.base.animationState = 0; + gPlayerEntity.base.direction = 0; } GetNextFrame(super); } void sub_08066474(NPC23Entity* this) { - if (gPlayerEntity.action != PLAYER_ROOM_EXIT) { + if (gPlayerEntity.base.action != PLAYER_ROOM_EXIT) { gPauseMenuOptions.disabled = 0; } } @@ -159,9 +159,9 @@ void sub_08066490(NPC23Entity* this, Entity* entity) { bool32 sub_0806650C(NPC23Entity* this) { u32 dir = 0; - s32 px = gPlayerEntity.x.HALF_U.HI; + s32 px = gPlayerEntity.base.x.HALF_U.HI; s32 px2 = px; - s32 py = gPlayerEntity.y.HALF_U.HI; + s32 py = gPlayerEntity.base.y.HALF_U.HI; if (py < this->unk_80 + 16) { dir = 4; @@ -173,17 +173,17 @@ bool32 sub_0806650C(NPC23Entity* this) { dir = 6; } if (dir == 0) { - gPlayerEntity.speed = 0; + gPlayerEntity.base.speed = 0; } } - if (gPlayerEntity.action != PLAYER_ROOM_EXIT) { + if (gPlayerEntity.base.action != PLAYER_ROOM_EXIT) { if (dir == 0) { return 0; } sub_08078AC0(8, 0, 0); - gPlayerEntity.animationState = dir; - gPlayerEntity.direction = Direction8FromAnimationState(dir); + gPlayerEntity.base.animationState = dir; + gPlayerEntity.base.direction = Direction8FromAnimationState(dir); } return 1; } @@ -197,11 +197,11 @@ void sub_08066570(Entity* this) { return; } - if (this->action == 3 || !sub_0806FC80(this, &gPlayerEntity, 0x50)) { + if (this->action == 3 || !sub_0806FC80(this, &gPlayerEntity.base, 0x50)) { return; } - direction = GetFacingDirection(this, &gPlayerEntity); + direction = GetFacingDirection(this, &gPlayerEntity.base); cond = TRUE; dir2 = (direction & DirectionWest); diff --git a/src/npc/npc5.c b/src/npc/npc5.c index da120bee..d4a78753 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -96,7 +96,7 @@ void CreateZeldaFollower(void) { if (CheckGlobalFlag(ZELDA_CHASE) != 0) { npc = CreateNPC(ZELDA_FOLLOWER, 0, 0); if (npc != NULL) { - CopyPosition(&gPlayerEntity, npc); + CopyPosition(&gPlayerEntity.base, npc); npc->flags |= ENT_PERSIST; npc->animationState = GetAnimationState(npc); } @@ -124,8 +124,8 @@ void sub_08060A00(NPC5Entity* this) { if (super->action != 0) { if (((((UnkHeap*)super->myHeap)->unk_0) & 4) == 0) { ((UnkHeap*)super->myHeap)->unk_0 |= 4; - ((UnkHeap*)super->myHeap)->unk_5 = (gPlayerEntity.x.HALF.HI & 0xfff0) + 8; - ((UnkHeap*)super->myHeap)->unk_6 = (gPlayerEntity.y.HALF.HI & 0xfff0) + 8; + ((UnkHeap*)super->myHeap)->unk_5 = (gPlayerEntity.base.x.HALF.HI & 0xfff0) + 8; + ((UnkHeap*)super->myHeap)->unk_6 = (gPlayerEntity.base.y.HALF.HI & 0xfff0) + 8; } } } @@ -135,12 +135,12 @@ void sub_08060A00(NPC5Entity* this) { } if (super->action != 0) { - ((UnkHeap*)super->myHeap)->unk_1 = gPlayerEntity.x.HALF.HI; - ((UnkHeap*)super->myHeap)->unk_2 = gPlayerEntity.y.HALF.HI; + ((UnkHeap*)super->myHeap)->unk_1 = gPlayerEntity.base.x.HALF.HI; + ((UnkHeap*)super->myHeap)->unk_2 = gPlayerEntity.base.y.HALF.HI; } if (this->unk_74 != gRoomControls.room) { this->unk_74 = gRoomControls.room; - CopyPosition(&gPlayerEntity, super); + CopyPosition(&gPlayerEntity.base, super); super->action = 1; super->spriteSettings.draw = 1; super->speed = 0x120; @@ -182,7 +182,7 @@ void sub_08060AE0(NPC5Entity* this) { void sub_08060B5C(NPC5Entity* this) { if (sub_08061230(this) == 0) { if ((sub_08060F80(super) == 0) && - (((GetFacingDirection(super, &gPlayerEntity) + (super->animationState * -4) + 4) & 0x1f)) < 9) { + (((GetFacingDirection(super, &gPlayerEntity.base) + (super->animationState * -4) + 4) & 0x1f)) < 9) { super->action = 2; super->subtimer = 0; return; @@ -227,8 +227,8 @@ void sub_08060BA0(NPC5Entity* this) { } } else { - if (sub_08060FD0(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI) != 0) { - sub_08061090(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); + if (sub_08060FD0(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI) != 0) { + sub_08061090(this, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI); sub_08061170(this); ((UnkHeap*)super->myHeap)->unk_0 &= 0xf5; } else { @@ -257,7 +257,7 @@ void sub_08060BA0(NPC5Entity* this) { } } else { ((UnkHeap*)super->myHeap)->unk_0 &= 0xfd; - sub_08061464(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); + sub_08061464(this, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI); } } } @@ -315,7 +315,7 @@ void sub_08060E34(NPC5Entity* this) { UpdateAnimationSingleFrame(super); if ((super->frame & ANIM_DONE) != 0) { super->action = 2; - super->animationState = DirectionToAnimationState(GetFacingDirection(super, &gPlayerEntity)) * 2; + super->animationState = DirectionToAnimationState(GetFacingDirection(super, &gPlayerEntity.base)) * 2; sub_08060E70(this, 8); } } @@ -343,7 +343,7 @@ void sub_08060EDC(NPC5Entity* this) { if (((u32)super->animIndex - 0x20 < 0x10) && ((super->frame & ANIM_DONE) == 0)) { UpdateAnimationSingleFrame(super); } else { - tmp = GetFacingDirection(super, &gPlayerEntity) + super->animationState * -4; + tmp = GetFacingDirection(super, &gPlayerEntity.base) + super->animationState * -4; if (((tmp + 3) & 0x1f) >= 7) { if ((tmp & 0x1f) < 0x10) { InitAnimationForceUpdate(super, super->animationState + 0x20); @@ -364,12 +364,12 @@ void sub_08060EDC(NPC5Entity* this) { } } u32 sub_08060F80(Entity* this) { - if (sub_08060FD0(this, (s32)gPlayerEntity.x.HALF.HI, (s32)gPlayerEntity.y.HALF.HI) == 0) { + if (sub_08060FD0(this, (s32)gPlayerEntity.base.x.HALF.HI, (s32)gPlayerEntity.base.y.HALF.HI) == 0) { return 0; } ((UnkHeap*)this->myHeap)->unk_0 &= 0xfb; - if (PointInsideRadius(gPlayerEntity.x.HALF.HI - this->x.HALF.HI, gPlayerEntity.y.HALF.HI - this->y.HALF.HI, - ((UnkHeap*)this->myHeap)->unk_0b) != 0) { + if (PointInsideRadius(gPlayerEntity.base.x.HALF.HI - this->x.HALF.HI, + gPlayerEntity.base.y.HALF.HI - this->y.HALF.HI, ((UnkHeap*)this->myHeap)->unk_0b) != 0) { return 1; } return 0; @@ -416,8 +416,8 @@ void sub_08061090(NPC5Entity* this, u32 a, u32 b) { s32 sqrDist; u32 tmp; - xDist = gPlayerEntity.x.HALF.HI - super->x.HALF.HI; - yDist = gPlayerEntity.y.HALF.HI - super->y.HALF.HI; + xDist = gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI; + yDist = gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI; sqrDist = (xDist * xDist) + (yDist * yDist); if (sqrDist < 0x900) { super->speed = 0x120; diff --git a/src/npc/percy.c b/src/npc/percy.c index c6dd0b36..a3a04a44 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -84,7 +84,7 @@ void sub_0806B41C(PercyEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; InitializeAnimation(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 4); idx = GetFuserId(super); tmp = gUnk_08001A7C[idx]; if (this->fusionOffer == 33) @@ -165,7 +165,7 @@ void sub_0806B540(Entity* this) { } break; case 3: - if ((gPlayerEntity.action != PLAYER_ITEMGET)) { + if ((gPlayerEntity.base.action != PLAYER_ITEMGET)) { context->wait = 0x2d; return; } diff --git a/src/npc/pina.c b/src/npc/pina.c index f4cdc048..26692def 100644 --- a/src/npc/pina.c +++ b/src/npc/pina.c @@ -93,8 +93,8 @@ void sub_08063B68(PinaEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 4); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, NULL); diff --git a/src/npc/postman.c b/src/npc/postman.c index 3e2f5745..3d434f77 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -256,15 +256,15 @@ void sub_08060528(PostmanEntity* this) { super->action = 3; super->interactType = INTERACTION_NONE; InitializeNPCFusion(super); - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { if (super->interactType != INTERACTION_NONE) { super->action = 2; super->interactType = INTERACTION_NONE; sub_080606D8(super); - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { ExecuteScriptAndHandleAnimation(super, NULL); } @@ -302,7 +302,7 @@ void sub_08060528(PostmanEntity* this) { Postman_MakeInteractable(this); } if (super->z.WORD >= 0 && - ((gPlayerEntity.collisionLayer == 0 || (super->collisionLayer == gPlayerEntity.collisionLayer)))) { + ((gPlayerEntity.base.collisionLayer == 0 || (super->collisionLayer == gPlayerEntity.base.collisionLayer)))) { sub_0806ED78(super); } sub_0800451C(super); @@ -406,13 +406,13 @@ void sub_0806076C(PostmanEntity* this, ScriptExecutionContext* context) { void sub_080608E4(PostmanEntity* this, ScriptExecutionContext* context) { context->condition = 0; if (super->z.WORD >= 0) { - if ((super->collisionLayer != 1 || gPlayerEntity.collisionLayer != 2) && - (super->collisionLayer != 2 || gPlayerEntity.collisionLayer != 1)) { + if ((super->collisionLayer != 1 || gPlayerEntity.base.collisionLayer != 2) && + (super->collisionLayer != 2 || gPlayerEntity.base.collisionLayer != 1)) { const Rect* ptr = &gUnk_0810AA70[context->intVariable][super->animationState >> 1]; u32 x = super->x.HALF.HI + ptr->x; u32 y = super->y.HALF.HI + ptr->y; - x = gPlayerEntity.x.HALF.HI - x; - y = gPlayerEntity.y.HALF.HI - y; + x = gPlayerEntity.base.x.HALF.HI - x; + y = gPlayerEntity.base.y.HALF.HI - y; x += ptr->width; y += ptr->height; if (ptr->width * 2 > x && ptr->height * 2 > y) { diff --git a/src/npc/sittingPerson.c b/src/npc/sittingPerson.c index 649239e0..c3da1060 100644 --- a/src/npc/sittingPerson.c +++ b/src/npc/sittingPerson.c @@ -151,7 +151,7 @@ void sub_080637B8(SittingPersonEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - tmp = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + tmp = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)); tmp += super->spriteSettings.flipX ? 4 : 0; InitializeAnimation(super, tmp); InitializeNPCFusion(super); diff --git a/src/npc/smith.c b/src/npc/smith.c index 940bd75a..2210dede 100644 --- a/src/npc/smith.c +++ b/src/npc/smith.c @@ -48,7 +48,7 @@ void Smith(SmithEntity* this) { super->action = 4; super->interactType = INTERACTION_NONE; index = (super->animIndex == 0xc) ? 8 : 0; - index += GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + index += GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)); InitAnimationForceUpdate(super, index); InitializeNPCFusion(super); } diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index dc930fd9..d1971904 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -175,7 +175,7 @@ void sub_080652E4(Entity* this) { if (this->timer != 0) { this->timer--; } else { - if (gPlayerEntity.action != PLAYER_ITEMGET) { + if (gPlayerEntity.base.action != PLAYER_ITEMGET) { this->subAction++; MessageNoOverlap(TEXT_INDEX(TEXT_STOCKWELL, 0x19), this); } diff --git a/src/npc/sturgeon.c b/src/npc/sturgeon.c index 9bc3bd84..b48d2ec6 100644 --- a/src/npc/sturgeon.c +++ b/src/npc/sturgeon.c @@ -64,8 +64,8 @@ void Sturgeon(SturgeonEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = super->action | 0xff; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/talon.c b/src/npc/talon.c index 9e2cdfc9..ddcd1977 100644 --- a/src/npc/talon.c +++ b/src/npc/talon.c @@ -152,7 +152,7 @@ void sub_080656D4(TalonEntity* this) { void sub_0806574C(TalonEntity* this) { u32 j; - j = (super->animIndex & ~3) + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + j = (super->animIndex & ~3) + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)); if (super->animIndex != j) { InitAnimationForceUpdate(super, j); } diff --git a/src/npc/teachers.c b/src/npc/teachers.c index 609c7bc4..89953855 100644 --- a/src/npc/teachers.c +++ b/src/npc/teachers.c @@ -38,8 +38,8 @@ void Teachers(TeachersEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4( - GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4(GetFacingDirection( + super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c index 3d4b26e8..75abc4db 100644 --- a/src/npc/tingleSiblings.c +++ b/src/npc/tingleSiblings.c @@ -70,7 +70,7 @@ void sub_08064DE4(Entity* this) { this->action = 2; this->interactType = INTERACTION_NONE; InitAnimationForceUpdate(this, - GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity))); + GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity.base))); InitializeNPCFusion(this); } else { ExecuteScriptAndHandleAnimation(this, NULL); diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index f29f6e4e..273da662 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -184,7 +184,7 @@ void sub_0806ABFC(TownMinishEntity* this) { void sub_0806AC3C(TownMinishEntity* this) { if (super->animIndex <= 3) { s32 unk; - Entity* link = &gPlayerEntity; + Entity* link = &gPlayerEntity.base; if (EntityInRectRadius(super, link, 0x18, 0x18)) { unk = GetFacingDirection(super, link) & 0x1e; } else { @@ -238,12 +238,12 @@ void sub_0806ACC4(TownMinishEntity* this) { if (super->type2 == 10 && super->interactType) { super->action = 2; super->interactType = INTERACTION_NONE; - InitializeAnimation(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 8); + InitializeAnimation( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 8); sub_0806AFE8(super, this->context); } if (super->type == 1) { - u8 idx = gPlayerEntity.animationState >> 1; + u8 idx = gPlayerEntity.base.animationState >> 1; SetInteractableObjectCollision(super, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]); } } diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index 967a6645..8f8b34f1 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -131,7 +131,7 @@ void sub_08061D64(TownspersonEntity* this) { InitializeNPCFusion(super); this->unk_69 = super->animIndex; InitializeAnimation(super, (super->animIndex & -4) + - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { ExecuteScriptForEntity(super, NULL); HandleEntity0x82Actions(super); @@ -144,8 +144,8 @@ void sub_08061D64(TownspersonEntity* this) { super->interactType = INTERACTION_NONE; sub_08062048(super); this->unk_69 = super->animIndex; - InitializeAnimation(super, (super->animIndex & -4) + - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4( + GetFacingDirection(super, &gPlayerEntity.base))); } } } diff --git a/src/npc/zelda.c b/src/npc/zelda.c index c1f80998..d8e77ffd 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -79,7 +79,7 @@ void sub_08066D94(Entity* this) { SetGlobalFlag(ZELDA_CHASE); npc = (ZeldaFollowerEntity*)CreateNPC(ZELDA_FOLLOWER, 0, 0); if (npc != NULL) { - npc->base.animationState = gPlayerEntity.animationState; + npc->base.animationState = gPlayerEntity.base.animationState; npc->base.flags |= ENT_PERSIST; npc->base.animationState = GetAnimationState(this); room = gRoomControls.room; diff --git a/src/npc/zeldaFollower.c b/src/npc/zeldaFollower.c index 45315961..1fe5f067 100644 --- a/src/npc/zeldaFollower.c +++ b/src/npc/zeldaFollower.c @@ -71,19 +71,19 @@ void sub_08068318(ZeldaFollowerEntity* this) { ZeldaFollowerItem* heapPtr; ZeldaFollowerItem item; - item.FIELDS.x = gPlayerEntity.x.HALF_U.HI; - item.FIELDS.y = gPlayerEntity.y.HALF_U.HI; - item.FIELDS.z = gPlayerEntity.z.HALF_U.HI; + item.FIELDS.x = gPlayerEntity.base.x.HALF_U.HI; + item.FIELDS.y = gPlayerEntity.base.y.HALF_U.HI; + item.FIELDS.z = gPlayerEntity.base.z.HALF_U.HI; item.FIELDS.framestate = gPlayerState.framestate; - item.FIELDS.animationState = gPlayerEntity.animationState; - item.FIELDS.collisionLayer = gPlayerEntity.collisionLayer; + item.FIELDS.animationState = gPlayerEntity.base.animationState; + item.FIELDS.collisionLayer = gPlayerEntity.base.collisionLayer; heapPtr = super->myHeap; if ((heapPtr->FIELDS.framestate == 0xa && item.FIELDS.framestate != 0xa) || (heapPtr->FIELDS.framestate == 0x16 && item.FIELDS.framestate != 0x16)) { - super->x.HALF.HI = gPlayerEntity.x.HALF.HI; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI; + super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI; super->spriteSettings.draw = 1; sub_08068578(super); } @@ -106,7 +106,7 @@ void sub_08068318(ZeldaFollowerEntity* this) { ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(super, heapPtr); animIndex = 0x4; } else { - dist = sub_080041E8(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, (u16)heapPtr->FIELDS.x, + dist = sub_080041E8(gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, (u16)heapPtr->FIELDS.x, (u16)heapPtr->FIELDS.y); dist = ((u32)dist) >> 0x4; if (dist > 0x18) { @@ -187,17 +187,17 @@ void sub_08068578(Entity* this) { // first u32 (r5) #ifdef REWRITE_CODE - r0 = gPlayerEntity.x.HALF_U.HI | (r5 & 0xffff0000); - r5 = (gPlayerEntity.y.HALF_U.HI << 0x10) | (r0 & 0x0000ffff); + r0 = gPlayerEntity.base.x.HALF_U.HI | (r5 & 0xffff0000); + r5 = (gPlayerEntity.base.y.HALF_U.HI << 0x10) | (r0 & 0x0000ffff); #else - r1 = gPlayerEntity.x.HALF_U.HI; + r1 = gPlayerEntity.base.x.HALF_U.HI; r3 = 0xffff0000; r0 = r3; r0 &= r5; r0 |= r1; - r1 = gPlayerEntity.y.HALF_U.HI; + r1 = gPlayerEntity.base.y.HALF_U.HI; r1 <<= 0x10; r2 = 0xffff; r0 &= r2; @@ -207,12 +207,12 @@ void sub_08068578(Entity* this) { // second u32 (r6) #ifdef REWRITE_CODE - r3 = gPlayerEntity.z.HALF_U.HI | (r6 & 0xffff0000); + r3 = gPlayerEntity.base.z.HALF_U.HI | (r6 & 0xffff0000); r2 = (gPlayerState.framestate << 0x10) | (r3 & 0xff00ffff); - r0 = ((gPlayerEntity.animationState & 0x3f) << 0x18) | (r2 & 0xc0ffffff); - r6 = (gPlayerEntity.collisionLayer << 0x1e) | (r0 & 0x3fffffff); + r0 = ((gPlayerEntity.base.animationState & 0x3f) << 0x18) | (r2 & 0xc0ffffff); + r6 = (gPlayerEntity.base.collisionLayer << 0x1e) | (r0 & 0x3fffffff); #else - r0 = gPlayerEntity.z.HALF_U.HI; + r0 = gPlayerEntity.base.z.HALF_U.HI; r3 &= r6; r3 |= r0; @@ -222,7 +222,7 @@ void sub_08068578(Entity* this) { r2 &= r3; r2 |= r0; - r1 = gPlayerEntity.animationState; + r1 = gPlayerEntity.base.animationState; r0 = 0x3f; r1 &= r0; r1 <<= 0x18; @@ -230,8 +230,8 @@ void sub_08068578(Entity* this) { r0 &= r2; r0 |= r1; - // gPlayerEntity is now at r1 - r1 = gPlayerEntity.collisionLayer; + // gPlayerEntity.base.is now at r1 + r1 = gPlayerEntity.base.collisionLayer; r1 <<= 0x1e; r2 = 0x3fffffff; r0 &= r2; @@ -240,18 +240,18 @@ void sub_08068578(Entity* this) { #endif #ifdef REWRITE_CODE - r10 = gPlayerEntity.x.HALF.HI - this->x.HALF.HI; + r10 = gPlayerEntity.base.x.HALF.HI - this->x.HALF.HI; #else - r1 = gPlayerEntity.x.HALF.HI; + r1 = gPlayerEntity.base.x.HALF.HI; r0 = this->x.HALF.HI; r0 = r1 - r0; r10 = r0; #endif #ifdef REWRITE_CODE - r8 = gPlayerEntity.y.HALF.HI - this->y.HALF.HI; + r8 = gPlayerEntity.base.y.HALF.HI - this->y.HALF.HI; #else - r1 = gPlayerEntity.y.HALF.HI; + r1 = gPlayerEntity.base.y.HALF.HI; r0 = this->y.HALF.HI; r0 = r1 - r0; r8 = r0; diff --git a/src/npcUtils.c b/src/npcUtils.c index b0c111fe..3d0323c3 100644 --- a/src/npcUtils.c +++ b/src/npcUtils.c @@ -121,20 +121,20 @@ u32 sub_0806ED78(Entity* ent) { s32 GetAnimationStateInRectRadius(Entity* ent, u32 x, u32 y) { s32 anim = -1; - if (EntityInRectRadius(ent, &gPlayerEntity, x, y)) + if (EntityInRectRadius(ent, &gPlayerEntity.base, x, y)) anim = GetAnimationState(ent); return anim; } u32 GetAnimationState(Entity* ent) { - u32 direction = GetFacingDirection(ent, &gPlayerEntity); + u32 direction = GetFacingDirection(ent, &gPlayerEntity.base); return GetAnimationStateForDirection4(direction); } s32 GetFacingDirectionInRectRadius(Entity* ent, u32 x, u32 y) { s32 dir = -1; - if (EntityInRectRadius(ent, &gPlayerEntity, x, y)) - dir = GetFacingDirection(ent, &gPlayerEntity); + if (EntityInRectRadius(ent, &gPlayerEntity.base, x, y)) + dir = GetFacingDirection(ent, &gPlayerEntity.base); return dir; } @@ -160,7 +160,7 @@ u32 sub_0806EE20(Entity* ent) { return gUnk_08114EFC[ent->carryFlags](ent); } else { ent->knockbackSpeed = 8; - v3 = GetFacingDirection(ent, &gPlayerEntity); + v3 = GetFacingDirection(ent, &gPlayerEntity.base); ent->knockbackDirection = GetAnimationStateForDirection4(v3); } return 0; diff --git a/src/object/ambientClouds.c b/src/object/ambientClouds.c index d7470d7d..7e885373 100644 --- a/src/object/ambientClouds.c +++ b/src/object/ambientClouds.c @@ -82,12 +82,12 @@ void AmbientClouds_Action1(Entity* this) { this->spriteOrientation.flipY = 1; this->spriteRendering.b3 = 0; if ((this->type2 == 1) || (this->child->action == 2)) { - if (gPlayerEntity.z.HALF.HI < -0x24) + if (gPlayerEntity.base.z.HALF.HI < -0x24) this->timer = 1; else this->timer = 0; this->y.HALF.HI += (this->type2 - 1) * -0x24; - if (EntityInRectRadius(this, &gPlayerEntity, 15, 15) && (this->timer != 0)) { + if (EntityInRectRadius(this, &gPlayerEntity.base, 15, 15) && (this->timer != 0)) { this->action = 2; this->spriteOrientation.flipY = 2; this->spriteRendering.b3 = 3; @@ -95,23 +95,23 @@ void AmbientClouds_Action1(Entity* this) { this->child->action = 1; } gPlayerState.field_0x14 = 1; - gPlayerEntity.y.HALF.HI -= 0x24; - gPlayerEntity.z.HALF.HI += 0x24; - sub_0807AA80(&gPlayerEntity); + gPlayerEntity.base.y.HALF.HI -= 0x24; + gPlayerEntity.base.z.HALF.HI += 0x24; + sub_0807AA80(&gPlayerEntity.base); if (this->subtimer == 0) { - Entity* fx = CreateFx(&gPlayerEntity, FX_DEATH, 0); + Entity* fx = CreateFx(&gPlayerEntity.base, FX_DEATH, 0); if (fx != NULL) { fx->x.HALF.HI += 8; } - fx = CreateFx(&gPlayerEntity, FX_DEATH, 0); + fx = CreateFx(&gPlayerEntity.base, FX_DEATH, 0); if (fx != NULL) { fx->x.HALF.HI -= 8; } - fx = CreateFx(&gPlayerEntity, FX_DEATH, 0); + fx = CreateFx(&gPlayerEntity.base, FX_DEATH, 0); if (fx != NULL) { fx->y.HALF.HI += 8; } - fx = CreateFx(&gPlayerEntity, FX_DEATH, 0); + fx = CreateFx(&gPlayerEntity.base, FX_DEATH, 0); if (fx != NULL) { fx->y.HALF.HI -= 8; } @@ -125,20 +125,20 @@ void AmbientClouds_Action1(Entity* this) { void AmbientClouds_Action2(Entity* this) { this->y.HALF.HI += this->type2 * -0x24; - if (EntityInRectRadius(this, &gPlayerEntity, 15, 15)) { + if (EntityInRectRadius(this, &gPlayerEntity.base, 15, 15)) { gPlayerState.field_0x14 = 1; gPlayerState.flags |= PL_FLAGS2; } else { this->action = 1; - gPlayerEntity.z.HALF_U.HI += this->z.HALF_U.HI; - gPlayerEntity.y.HALF_U.HI -= this->z.HALF_U.HI; - gPlayerEntity.collisionLayer = 1; + gPlayerEntity.base.z.HALF_U.HI += this->z.HALF_U.HI; + gPlayerEntity.base.y.HALF_U.HI -= this->z.HALF_U.HI; + gPlayerEntity.base.collisionLayer = 1; } this->y.HALF.HI += this->type2 * 0x24; } void AmbientClouds_Action3(Entity* this) { - if (EntityInRectRadius(this, &gPlayerEntity, 15, 15)) { + if (EntityInRectRadius(this, &gPlayerEntity.base, 15, 15)) { gPlayerState.field_0x14 = 1; } } diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c index 65683a8c..22b5fbbb 100644 --- a/src/object/bakerOven.c +++ b/src/object/bakerOven.c @@ -75,15 +75,15 @@ void BakerOven_Action1(BakerOvenEntity* this) { } /* Damage minish link if he touches a steam cloud */ - if (super->subtimer == 0 && gPlayerEntity.iframes == 0 && super->frameIndex && - sub_0806FC80(super, &gPlayerEntity, 4)) { + if (super->subtimer == 0 && gPlayerEntity.base.iframes == 0 && super->frameIndex && + sub_0806FC80(super, &gPlayerEntity.base, 4)) { super->subtimer++; ModHealth(-2); - SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); - gPlayerEntity.iframes = 16; - gPlayerEntity.knockbackDirection = 16; - gPlayerEntity.knockbackDuration = 12; - gPlayerEntity.knockbackSpeed = 16; + SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6); + gPlayerEntity.base.iframes = 16; + gPlayerEntity.base.knockbackDirection = 16; + gPlayerEntity.base.knockbackDuration = 12; + gPlayerEntity.base.knockbackSpeed = 16; } } } diff --git a/src/object/barrelSpiderweb.c b/src/object/barrelSpiderweb.c index 4e5ca85d..386f2c74 100644 --- a/src/object/barrelSpiderweb.c +++ b/src/object/barrelSpiderweb.c @@ -43,7 +43,7 @@ void BarrelSpiderweb_Init(Entity* this) { this->flags2 = 4; this->hitbox = (Hitbox*)&gHitbox_0; this->frameIndex = 2; - this->collisionLayer = gPlayerEntity.collisionLayer; + this->collisionLayer = gPlayerEntity.base.collisionLayer; sub_0808BDB0(this); this->y.HALF.HI = 0x170 - (this->parent)->zVelocity; sub_0808BBE0(this); @@ -115,9 +115,9 @@ void BarrelSpiderweb_Action2(Entity* this) { SetAffineInfo(this, 0x200 - this->subtimer, 0x200 - this->subtimer, 0); } if (this->contactFlags == 0x93) { - this->direction = GetFacingDirection(this, &gPlayerEntity); + this->direction = GetFacingDirection(this, &gPlayerEntity.base); LinearMoveUpdate(this); - if (EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 6, 0x1c)) { + if (EntityWithinDistance(this, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI - 6, 0x1c)) { sub_0808BD00(this); } } else { diff --git a/src/object/beanstalk.c b/src/object/beanstalk.c index f1749ccd..fb6abf4e 100644 --- a/src/object/beanstalk.c +++ b/src/object/beanstalk.c @@ -275,7 +275,7 @@ void Beanstalk_Action1Type7(BeanstalkEntity* this) { case 3: case 4: if (gPlayerState.floor_type == SURFACE_LADDER) { - if (EntityInRectRadius(super, &gPlayerEntity, 0, 8)) { + if (EntityInRectRadius(super, &gPlayerEntity.base, 0, 8)) { if ((super->animIndex == (super->type2 - 1) * 3 + 1) && (super->timer == 0)) { super->timer = 1; InitializeAnimation(super, super->animIndex + 1); @@ -334,8 +334,8 @@ void Beanstalk_Action1Type9(BeanstalkEntity* this) { super->y.HALF.HI += 0x28; this->unk_72 = sub_080B1A0C(super, 0, -0x18); } - super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; - super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; + super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; + super->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; if (gPlayerState.floor_type == SURFACE_LADDER) { super->spritePriority.b0 = 0; if (sub_080B1A0C(super, 0, -0x18) != 0x4014) { diff --git a/src/object/bigPushableLever.c b/src/object/bigPushableLever.c index 41b7a21c..e4110703 100644 --- a/src/object/bigPushableLever.c +++ b/src/object/bigPushableLever.c @@ -58,9 +58,9 @@ void BigPushableLever_Idle(BigPushableLeverEntity* this) { gPlayerState.pushedObject = 0x98; gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = gPlayerEntity.animationState << 2; + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2; } } } diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index 9a5b3c51..91b510b9 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -75,12 +75,12 @@ void BigVortex_Action2(BigVortexEntity* this) { void BigVortex_Action3(BigVortexEntity* this) { - if (sub_0800419C(super, &gPlayerEntity, 8, 8) != 0) { - CopyPosition(super, &gPlayerEntity); + if (sub_0800419C(super, &gPlayerEntity.base, 8, 8) != 0) { + CopyPosition(super, &gPlayerEntity.base); sub_08004542(super); - sub_08004542(&gPlayerEntity); - gPlayerEntity.collisionLayer = 1; - SortEntityAbove(super, &gPlayerEntity); + sub_08004542(&gPlayerEntity.base); + gPlayerEntity.base.collisionLayer = 1; + SortEntityAbove(super, &gPlayerEntity.base); gPlayerState.queued_action = PLAYER_PARACHUTE; gPlayerState.field_0x38 = 1; gPlayerState.field_0x39 = super->type2; diff --git a/src/object/bird.c b/src/object/bird.c index a4fa24dc..bbd382ff 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -211,26 +211,26 @@ void Bird_Type8(BirdEntity* this) { super->spriteRendering.b3 = 0; super->spriteOrientation.flipY = 1; super->x.HALF.HI = gRoomControls.scroll_x; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI; super->child = NULL; SetEntityPriority(super, 6); InitAnimationForceUpdate(super, 0); SoundReq(0x123); break; case 1: - super->collisionLayer = gPlayerEntity.collisionLayer; + super->collisionLayer = gPlayerEntity.base.collisionLayer; super->speed += 8; if (super->speed > 0x300) { super->speed = 0x300; } - if ((gPlayerEntity.flags & ENT_COLLIDE) && (gMessage.state & MESSAGE_ACTIVE) == 0 && - gPlayerEntity.action != PLAYER_SLEEP && gPlayerEntity.action != PLAYER_BOUNCE && - gPlayerEntity.action != PLAYER_MINISH && gPlayerState.framestate != PL_STATE_CLIMB && + if ((gPlayerEntity.base.flags & ENT_COLLIDE) && (gMessage.state & MESSAGE_ACTIVE) == 0 && + gPlayerEntity.base.action != PLAYER_SLEEP && gPlayerEntity.base.action != PLAYER_BOUNCE && + gPlayerEntity.base.action != PLAYER_MINISH && gPlayerState.framestate != PL_STATE_CLIMB && gPlayerState.framestate != PL_STATE_JUMP && gPlayerState.framestate != PL_STATE_PARACHUTE && - PlayerCanBeMoved() && (EntityInRectRadius(super, &gPlayerEntity, 0xe, 0xe))) { - s32 z = gPlayerEntity.z.HALF.HI - super->z.HALF.HI - 8; - if ((u16)z < 0x20 && gPlayerEntity.health != 0) { + PlayerCanBeMoved() && (EntityInRectRadius(super, &gPlayerEntity.base, 0xe, 0xe))) { + s32 z = gPlayerEntity.base.z.HALF.HI - super->z.HALF.HI - 8; + if ((u16)z < 0x20 && gPlayerEntity.base.health != 0) { pEVar5 = CreateObject(BIRD, 10, 0); if (pEVar5 != NULL) { super->child = pEVar5; @@ -244,8 +244,8 @@ void Bird_Type8(BirdEntity* this) { PutAwayItems(); gPlayerState.swim_state = 0; gPlayerState.jump_status = 0; - gPlayerEntity.flags &= ~0x80; - gPlayerEntity.spriteSettings.draw = 0; + gPlayerEntity.base.flags &= ~0x80; + gPlayerEntity.base.spriteSettings.draw = 0; gPriorityHandler.event_priority = 6; gPauseMenuOptions.disabled = 1; } @@ -254,7 +254,7 @@ void Bird_Type8(BirdEntity* this) { break; default: PausePlayer(); - gPlayerEntity.spriteSettings.draw = 0; + gPlayerEntity.base.spriteSettings.draw = 0; break; } LinearMoveUpdate(super); @@ -262,7 +262,7 @@ void Bird_Type8(BirdEntity* this) { UpdateAnimationSingleFrame(super); pEVar5 = super->child; if (pEVar5 != NULL) { - if (gPlayerEntity.x.HALF.HI < super->x.HALF.HI - 8) { + if (gPlayerEntity.base.x.HALF.HI < super->x.HALF.HI - 8) { super->timer = 0; } @@ -274,7 +274,7 @@ void Bird_Type8(BirdEntity* this) { pEVar5->spriteOrientation.flipY = super->spriteOrientation.flipY; } else { super->timer--; - CopyPosition(&gPlayerEntity, pEVar5); + CopyPosition(&gPlayerEntity.base, pEVar5); } } @@ -308,13 +308,13 @@ void Bird_Type9(BirdEntity* this) { super->spriteOrientation.flipY = 1; SetEntityPriority(super, 6); super->x.HALF.HI = gRoomControls.scroll_x; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI; SoundReq(SFX_123); super->spritePriority.b1 = 2; InitAnimationForceUpdate(super, 0); PausePlayer(); } else if (super->action == 1) { - gPlayerEntity.spriteSettings.draw = 0; + gPlayerEntity.base.spriteSettings.draw = 0; child = super->child; if (child != NULL) { PositionRelative(super, child, Q_16_16(-8), 0); @@ -330,8 +330,8 @@ void Bird_Type9(BirdEntity* this) { if (child != NULL) { child->action++; } - gRoomControls.camera_target = &gPlayerEntity; - gPlayerEntity.spriteSettings.draw = 1; + gRoomControls.camera_target = &gPlayerEntity.base; + gPlayerEntity.base.spriteSettings.draw = 1; ResetPlayerAnimationAndAction(); ResetPlayerEventPriority(); gPauseMenuOptions.disabled = 0; @@ -354,7 +354,7 @@ void Bird_Type9(BirdEntity* this) { } void Bird_Type10(BirdEntity* this) { - super->palette.b.b0 = gPlayerEntity.palette.b.b0; + super->palette.b.b0 = gPlayerEntity.base.palette.b.b0; switch (super->action) { case 0: super->action = 1; diff --git a/src/object/board.c b/src/object/board.c index d7bf16d0..dbdcabea 100644 --- a/src/object/board.c +++ b/src/object/board.c @@ -63,10 +63,10 @@ void Board_Action1(BoardEntity* this) { } void sub_08098BE8(BoardEntity* this) { - if ((gPlayerState.flags & PL_MINISH) && sub_08098C30(this, &gPlayerEntity) && PlayerCanBeMoved() && - gPlayerEntity.z.HALF.HI == 0) { + if ((gPlayerState.flags & PL_MINISH) && sub_08098C30(this, &gPlayerEntity.base) && PlayerCanBeMoved() && + gPlayerEntity.base.z.HALF.HI == 0) { gPlayerState.field_0x14 = 1; - sub_0807AAF8(&gPlayerEntity, this->tile); + sub_0807AAF8(&gPlayerEntity.base, this->tile); } } diff --git a/src/object/book.c b/src/object/book.c index 50bf896e..6a516500 100644 --- a/src/object/book.c +++ b/src/object/book.c @@ -110,9 +110,9 @@ void Book_Action1(BookEntity* this) { gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = gPlayerEntity.animationState << 2; + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2; EnqueueSFX(SFX_10F); } else { super->timer = 22; @@ -219,7 +219,7 @@ void Book_Action5(BookEntity* this) { } u32 sub_0809B688(Entity* this) { - u32 ret = EntityInRectRadius(this, &gPlayerEntity, 6, 12); + u32 ret = EntityInRectRadius(this, &gPlayerEntity.base, 6, 12); if (ret == 1 && gPlayerState.direction != DirectionSouth) { ret = 0; diff --git a/src/object/bossDoor.c b/src/object/bossDoor.c index 8eb3497e..8502dd14 100644 --- a/src/object/bossDoor.c +++ b/src/object/bossDoor.c @@ -105,7 +105,7 @@ void BossDoor_Action3(BossDoorEntity* this) { if (--super->timer == 0) { if (super->type < 4) { sub_08078AC0(0x40, 0, 1); - gPlayerEntity.direction = super->type << 3; + gPlayerEntity.base.direction = super->type << 3; } DeleteThisEntity(); } diff --git a/src/object/bush.c b/src/object/bush.c index 4cad7205..6e7a08af 100644 --- a/src/object/bush.c +++ b/src/object/bush.c @@ -60,7 +60,7 @@ void Bush_Init(BushEntity* this) { super->gustJarTolerance = gUnk_08120588[super->type].unk_1; super->gustJarFlags = gUnk_08120588[super->type].unk_2; super->speed = 0x80; - super->collisionLayer = gPlayerEntity.collisionLayer; + super->collisionLayer = gPlayerEntity.base.collisionLayer; super->health = 1; super->collisionFlags = 7; super->hitType = 0x6e; diff --git a/src/object/button.c b/src/object/button.c index 2a025542..ad621bc7 100644 --- a/src/object/button.c +++ b/src/object/button.c @@ -171,7 +171,7 @@ Entity* sub_08081D74(ButtonEntity* this) { ent = 0; if (sub_08081E0C(super)) { if ((gPlayerState.flags & PL_CAPTURED) == 0 && (gPlayerState.flags & PL_MINISH) == 0) { - ent = &gPlayerEntity; + ent = &gPlayerEntity.base; } } else { if (gPlayerState.flags & PL_CLONING) { @@ -189,7 +189,7 @@ Entity* sub_08081D74(ButtonEntity* this) { } u32 sub_08081E0C(Entity* this) { - Entity* tmp = &gPlayerEntity; + Entity* tmp = &gPlayerEntity.base; if (tmp->z.HALF.HI != 0 || !PlayerCanBeMoved()) { return 0; } else { @@ -289,7 +289,7 @@ bool32 sub_08081F7C(ButtonEntity* this, u32 r7) { void sub_08081FF8(Entity* this) { u32 direction; u32 i; - if (this->child != &gPlayerEntity) + if (this->child != &gPlayerEntity.base) return; direction = GetFacingDirection(this->child, this); sub_080044AE(this->child, 0x200, direction); diff --git a/src/object/cameraTarget.c b/src/object/cameraTarget.c index 0eaa13ea..f327c414 100644 --- a/src/object/cameraTarget.c +++ b/src/object/cameraTarget.c @@ -150,7 +150,7 @@ void sub_08083A40(Entity* this) { this->spriteSettings.draw = 1; this->action = 2; - if (this->child->x.HALF.HI > gPlayerEntity.x.HALF.HI) { + if (this->child->x.HALF.HI > gPlayerEntity.base.x.HALF.HI) { bVar1 = 0; this->spriteOffsetX = 8; } else { diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index 3b964436..f40a7b1a 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -113,14 +113,14 @@ void ChestSpawner_Type2Action2(ChestSpawnerEntity* this) { SetPriorityTimer(30); switch (super->subAction) { case 0: - if (EntityInRectRadius(super, &gPlayerEntity, 0x10, 8)) { + if (EntityInRectRadius(super, &gPlayerEntity.base, 0x10, 8)) { sub_08078AC0(0x10, 0, 0); - gPlayerEntity.direction = 0x10; + gPlayerEntity.base.direction = 0x10; } super->subAction = 1; break; case 1: - if ((super->type == 5) || (gPlayerEntity.action == PLAYER_NORMAL)) { + if ((super->type == 5) || (gPlayerEntity.base.action == PLAYER_NORMAL)) { super->subAction = 2; super->timer = 8; super->subtimer = 0; diff --git a/src/object/cloud.c b/src/object/cloud.c index d1ec3e74..58d34f12 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -134,7 +134,7 @@ void sub_0809F69C(CloudEntity* this) { if (--super->timer == 0) { super->timer = 30; super->action = 4; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; SoundReq(SFX_SECRET_BIG); } } diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index 3b2efb83..384722b2 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -53,7 +53,7 @@ void CrenelBeanSprout_Init(CrenelBeanSproutEntity* this) { case 0: if (CheckGlobalFlag(WATERBEAN_OUT)) { if (CheckGlobalFlag(WATERBEAN_PUT) == 0) { - PositionRelative(&gPlayerEntity, super, 0, 0x10000); + PositionRelative(&gPlayerEntity.base, super, 0, 0x10000); SetTile(0x4022, 0xdc, super->collisionLayer); } else { if (CheckLocalFlag(super->type2) == 0) { @@ -79,9 +79,9 @@ void CrenelBeanSprout_Init(CrenelBeanSproutEntity* this) { case 3: if (CheckGlobalFlag(WATERBEAN_OUT)) { if (CheckGlobalFlag(WATERBEAN_PUT) == 0) { - super->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1; - *(((u8*)&gPlayerEntity) + 0x79) = tmp; - PositionRelative(&gPlayerEntity, super, 0, -0x180000); + super->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 - 1; + *(((u8*)&gPlayerEntity.base) + 0x79) = tmp; + PositionRelative(&gPlayerEntity.base, super, 0, -0x180000); } else { DeleteThisEntity(); } @@ -165,7 +165,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { } else { GetNextFrame(super); } - tmp = gPlayerEntity.animationState & 6; + tmp = gPlayerEntity.base.animationState & 6; this->unk_70 = ((super->x.HALF.HI + (s8)gUnk_08123184[tmp]) & -0x10) | 8; this->unk_72 = ((super->y.HALF.HI + (s8)gUnk_08123184[(tmp) + 1]) & -0x10) | 8; if (sub_080B1AB4(this->unk_70, this->unk_72, super->collisionLayer) == 0x19) { @@ -173,7 +173,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { } else { gUnk_0200AF00.rActionPlayerState = R_ACTION_NONE; } - PositionRelative(&gPlayerEntity, super, 0, 0x10000); + PositionRelative(&gPlayerEntity.base, super, 0, 0x10000); if (GetTileUnderEntity(super) == 0x19) { RestorePrevTileEntity(0xdc, super->collisionLayer); sub_08096A78(this); diff --git a/src/object/cutsceneMiscObject.c b/src/object/cutsceneMiscObject.c index c1d5cc1e..68f86a77 100644 --- a/src/object/cutsceneMiscObject.c +++ b/src/object/cutsceneMiscObject.c @@ -184,7 +184,7 @@ void sub_08094B80(CutsceneMiscObjectEntity* this) { void sub_08094B94(CutsceneMiscObjectEntity* this) { Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x22, 0); if (e != NULL) { - CopyPosition(&gPlayerEntity, e); + CopyPosition(&gPlayerEntity.base, e); e->z.HALF.HI = -48; ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, &script_CutsceneMiscObjectTheLittleHat); CreateDust(e); @@ -196,7 +196,7 @@ void sub_08094B94(CutsceneMiscObjectEntity* this) { void sub_08094BE0(Entity* this) { Entity* e = FindEntity(OBJECT, CUTSCENE_MISC_OBJECT, 6, 0x22, 0); if (e != NULL) { - CopyPosition(&gPlayerEntity, e); + CopyPosition(&gPlayerEntity.base, e); e->z.HALF.HI = -12; e->y.HALF.HI++; e->collisionLayer = 2; @@ -412,7 +412,7 @@ void CutsceneMiscObject_Type6(CutsceneMiscObjectEntity* this) { } break; case 3: - if (gPlayerEntity.action != PLAYER_EMPTYBOTTLE) { + if (gPlayerEntity.base.action != PLAYER_EMPTYBOTTLE) { super->action = 4; #ifndef EU if (!CheckGlobalFlag(BIN_DOGFOOD)) { @@ -1051,7 +1051,7 @@ void sub_08095D30(CutsceneMiscObjectEntity* this, u32 a2) { void sub_08095D54(CutsceneMiscObjectEntity* this, ScriptExecutionContext* ctx) { Entity* e = CreateObject(CUTSCENE_MISC_OBJECT, 0x1C, 0); if (e != NULL) { - CopyPosition(&gPlayerEntity, e); + CopyPosition(&gPlayerEntity.base, e); e->collisionLayer = 2; ((CutsceneMiscObjectEntity*)e)->ctx = StartCutscene(e, (u16*)ctx->intVariable); } @@ -1152,7 +1152,7 @@ void CutsceneMiscObject_Type31(CutsceneMiscObjectEntity* this) { break; } ChangeObjPalette(super, pal); - if ((gPlayerEntity.frame & 1) == 0) { + if ((gPlayerEntity.base.frame & 1) == 0) { local->anim = 0x8BF; super->timer = 52; super->subtimer = -75; @@ -1161,16 +1161,16 @@ void CutsceneMiscObject_Type31(CutsceneMiscObjectEntity* this) { super->timer = 85; super->subtimer = -42; } - CopyPosition(&gPlayerEntity, super); + CopyPosition(&gPlayerEntity.base, super); super->spritePriority.b0 = 3; } - if (gPlayerEntity.frame & 0x10) { - gPlayerEntity.frame &= ~0x10; + if (gPlayerEntity.base.frame & 0x10) { + gPlayerEntity.base.frame &= ~0x10; SoundReq(468); } - if ((u16)gPlayerEntity.spriteIndex != local->anim >> 8 || gPlayerEntity.animIndex != (u8)local->anim) + if ((u16)gPlayerEntity.base.spriteIndex != local->anim >> 8 || gPlayerEntity.base.animIndex != (u8)local->anim) DeleteThisEntity(); - tmp = gPlayerEntity.frameIndex - super->timer + super->subtimer; + tmp = gPlayerEntity.base.frameIndex - super->timer + super->subtimer; if (tmp != super->frameIndex) { super->frameIndex = tmp; sub_080042D0(super, super->frameIndex, (u16)super->spriteIndex); diff --git a/src/object/dirtParticle.c b/src/object/dirtParticle.c index f6bdf51c..827456c2 100644 --- a/src/object/dirtParticle.c +++ b/src/object/dirtParticle.c @@ -90,7 +90,7 @@ void DirtParticle_Init(DirtParticleEntity* this) { } super->x.HALF.HI += tmp; super->y.HALF.HI += tmp; - super->collisionLayer = gPlayerEntity.collisionLayer; + super->collisionLayer = gPlayerEntity.base.collisionLayer; InitializeAnimation(super, 10); return; case 1: diff --git a/src/object/doubleBookshelf.c b/src/object/doubleBookshelf.c index d96a80cb..cbc27c93 100644 --- a/src/object/doubleBookshelf.c +++ b/src/object/doubleBookshelf.c @@ -145,7 +145,7 @@ void sub_0809B234(DoubleBookshelfEntity* this) { } void sub_0809B274(DoubleBookshelfEntity* this) { - Entity* player = &gPlayerEntity; + Entity* player = &gPlayerEntity.base; switch (this->unk_84) { case 0: if (player->y.HALF.HI + 0x14 >= super->y.HALF.HI) { diff --git a/src/object/evilSpirit.c b/src/object/evilSpirit.c index cb42b88b..a09392a4 100644 --- a/src/object/evilSpirit.c +++ b/src/object/evilSpirit.c @@ -86,7 +86,8 @@ void EvilSpirit_Action1(EvilSpiritEntity* this) { sub_080045DA(super->parent->x.WORD - super->x.WORD, super->parent->y.WORD - super->y.WORD) ^ 0x80; } else { super->speed = 0x600; - dir = sub_080045DA(gPlayerEntity.x.WORD - super->x.WORD, gPlayerEntity.y.WORD - super->y.WORD) ^ 0x80; + dir = sub_080045DA(gPlayerEntity.base.x.WORD - super->x.WORD, gPlayerEntity.base.y.WORD - super->y.WORD) ^ + 0x80; if (dir != super->direction) { if ((u8)(dir - super->direction) > 0x80) { super->direction += 3; @@ -94,7 +95,7 @@ void EvilSpirit_Action1(EvilSpiritEntity* this) { super->direction -= 3; } } - if ((gPlayerEntity.animationState & 2) == 0) { + if ((gPlayerEntity.base.animationState & 2) == 0) { this->unk76 = this->unk7c + 0x40; } else { this->unk76 = this->unk7c - 0x20; @@ -112,7 +113,7 @@ void EvilSpirit_Action1(EvilSpiritEntity* this) { super->direction++; super->gustJarTolerance--; this->unk7f = 1; - if ((gPlayerEntity.animationState & 2) == 0) { + if ((gPlayerEntity.base.animationState & 2) == 0) { this->unk76 = this->unk7c + 0x10; } else { this->unk76 = this->unk7c - 0x20; @@ -183,7 +184,7 @@ void EvilSpirit_Action3(EvilSpiritEntity* this) { super->gustJarTolerance--; this->unk7f = 1; - if ((gPlayerEntity.animationState & 2) == 0) { + if ((gPlayerEntity.base.animationState & 2) == 0) { this->unk76 = this->unk7c + 0x10; } else { this->unk76 = this->unk7c - 0x20; diff --git a/src/object/ezloCap.c b/src/object/ezloCap.c index 8cb07487..de1beb00 100644 --- a/src/object/ezloCap.c +++ b/src/object/ezloCap.c @@ -55,12 +55,12 @@ void EzloCap(EzloCapEntity* this) { void EzloCap_Type0Init(EzloCapEntity* this) { super->updatePriority = 6; - super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; - super->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1; - super->palette.b.b0 = gPlayerEntity.palette.b.b0; - super->collisionLayer = gPlayerEntity.collisionLayer; + super->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; + super->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 - 1; + super->palette.b.b0 = gPlayerEntity.base.palette.b.b0; + super->collisionLayer = gPlayerEntity.base.collisionLayer; super->action = 1; - if (gPlayerEntity.animationState == 2) { + if (gPlayerEntity.base.animationState == 2) { super->spriteSettings.flipX = 1; } LoadSwapGFX(super, 1, 3); @@ -78,7 +78,7 @@ void EzloCap_Type0Init(EzloCapEntity* this) { void EzloCap_Type0Action1(EzloCapEntity* this) { static const u8 gUnk_0811F16C[] = { 4, 0, 2, 6, 10, 8, 9, 5, 1, 0, 0, 0 }; - u32 tmp = gPlayerEntity.palette.b.b0; + u32 tmp = gPlayerEntity.base.palette.b.b0; super->palette.b.b0 = tmp; if ((gMessage.state & MESSAGE_ACTIVE) == 0) { DeleteEntity(super); @@ -160,8 +160,8 @@ void EzloCap_Type1Action1(EzloCapEntity* this) { void EzloCap_ScriptedInit(EzloCapEntity* this) { super->updatePriority = 2; - super->palette.b.b0 = gPlayerEntity.palette.b.b0; - super->collisionLayer = gPlayerEntity.collisionLayer; + super->palette.b.b0 = gPlayerEntity.base.palette.b.b0; + super->collisionLayer = gPlayerEntity.base.collisionLayer; super->spritePriority.b1 = 3; super->spriteSettings.shadow = 1; super->action = 1; @@ -170,7 +170,7 @@ void EzloCap_ScriptedInit(EzloCapEntity* this) { this->unk_82 = 0; ExecuteScript(super, this->unk_84); sub_08082D20(this, this->unk_84); - if (gPlayerEntity.animationState == 2) { + if (gPlayerEntity.base.animationState == 2) { super->spriteSettings.flipX = 1; } sub_08082C5C(this); diff --git a/src/object/ezloCapFlying.c b/src/object/ezloCapFlying.c index 21a7faff..91c197a0 100644 --- a/src/object/ezloCapFlying.c +++ b/src/object/ezloCapFlying.c @@ -5,7 +5,6 @@ * @brief Ezlo Cap Flying object */ #include "functions.h" -#include "new_player.h" #include "object.h" typedef struct { @@ -31,7 +30,7 @@ void EzloCapFlying(EzloCapFlyingEntity* this) { }; if ((gPlayerState.flags & PL_PARACHUTE) == 0) { if (super->type == 0) { - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; } DeleteThisEntity(); } @@ -41,7 +40,7 @@ void EzloCapFlying(EzloCapFlyingEntity* this) { void EzloCapFlying_Init(EzloCapFlyingEntity* this) { super->action = 1; super->lastFrameIndex = 0xff; - super->palette.b.b0 = gPlayerEntity.palette.b.b0; + super->palette.b.b0 = gPlayerEntity.base.palette.b.b0; if (super->type == 0) { gRoomControls.camera_target = super; super->spriteRendering.b0 = 3; @@ -65,7 +64,7 @@ void EzloCapFlying_Action1Type0(EzloCapFlyingEntity* this) { if ((s16)this->unk_6e < 0) { this->unk_6e = -this->unk_6e; } - switch (gPlayerEntity.subAction) { + switch (gPlayerEntity.base.subAction) { case 1: this->unk_72 -= 4; break; @@ -103,10 +102,10 @@ void EzloCapFlying_Action1Type0(EzloCapFlyingEntity* this) { sub_080936C8(this); break; } - tmp = gPlayerEntity.animationState & 2; + tmp = gPlayerEntity.base.animationState & 2; if (tmp != 0) { super->frameIndex = 1; - if (gPlayerEntity.animationState == 2) { + if (gPlayerEntity.base.animationState == 2) { this->unk_6e = -this->unk_6e; } } else { @@ -116,32 +115,32 @@ void EzloCapFlying_Action1Type0(EzloCapFlyingEntity* this) { super->lastFrameIndex = super->frameIndex; sub_080042D0(super, super->frameIndex, super->spriteIndex); } - CopyPosition(&gPlayerEntity, super); + CopyPosition(&gPlayerEntity.base, super); - super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; - super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; + super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; + super->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; sub_0806FCF4(super, this->unk_72, 10, 2); SetAffineInfo(super, this->unk_6e, this->unk_72, 0); - sub_0806FEBC(&gPlayerEntity, 1, super); + sub_0806FEBC(&gPlayerEntity.base, 1, super); } void EzloCapFlying_Action1Type1(EzloCapFlyingEntity* this) { - super->frameIndex = ((gPlayerEntity.direction + (gPlayerEntity.direction >> 1)) >> 2) + 2; + super->frameIndex = ((gPlayerEntity.base.direction + (gPlayerEntity.base.direction >> 1)) >> 2) + 2; if (super->frameIndex != super->lastFrameIndex) { super->lastFrameIndex = super->frameIndex; sub_080042D0(super, super->frameIndex, super->spriteIndex); } - CopyPosition(&gPlayerEntity, super); - super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; - super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; + CopyPosition(&gPlayerEntity.base, super); + super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; + super->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; sub_0806FCF4(super, ((EzloCapFlyingEntity*)super->parent)->unk_72, 0x18, 0); super->spriteOffsetY = -super->spriteOffsetY; - sub_0806FEBC(&gPlayerEntity, 0, super); + sub_0806FEBC(&gPlayerEntity.base, 0, super); } void sub_080936C8(EzloCapFlyingEntity* this) { - s32 tmp = gNewPlayerEntity.unk_7c; - this->unk_76 = 0x138 - (gNewPlayerEntity.unk_7c >> 2); + s32 tmp = gPlayerEntity.unk_7c.WORD_U; + this->unk_76 = 0x138 - (gPlayerEntity.unk_7c.WORD_U >> 2); this->unk_74 = 8 - (tmp / 0x3c); if (super->timer == 0) { if (this->unk_76 < this->unk_6e) { diff --git a/src/object/fairy.c b/src/object/fairy.c index 1389f1fa..871da3dd 100644 --- a/src/object/fairy.c +++ b/src/object/fairy.c @@ -181,7 +181,7 @@ void Fairy_Action3(FairyEntity* this) { } else { CopyPosition(super->child, super); super->z.HALF.HI--; - if (IsColliding(super, &gPlayerEntity)) { + if (IsColliding(super, &gPlayerEntity.base)) { sub_0808DB2C(this); } } @@ -245,8 +245,8 @@ void sub_0808DAD0(FairyEntity* this) { super->spriteSettings.draw = 1; super->spritePriority.b1 = 2; super->spriteOffsetY = -5; - super->child = &gPlayerEntity; - CopyPosition(&gPlayerEntity, super); + super->child = &gPlayerEntity.base; + CopyPosition(&gPlayerEntity.base, super); } void sub_0808DB2C(FairyEntity* this) { @@ -254,5 +254,5 @@ void sub_0808DB2C(FairyEntity* this) { super->subAction = 0; super->flags |= ENT_COLLIDE; super->flags2 = 1; - CopyPosition(&gPlayerEntity, super); + CopyPosition(&gPlayerEntity.base, super); } diff --git a/src/object/fan.c b/src/object/fan.c index bf9e5d27..f786981a 100644 --- a/src/object/fan.c +++ b/src/object/fan.c @@ -114,7 +114,7 @@ void sub_0809EE44(FanEntity* this) { uVar4 = (super->frame & 7); super->speed = this->unk7e << uVar4; if (uVar4 != 0) { - pEVar1 = &gPlayerEntity; + pEVar1 = &gPlayerEntity.base; if (sub_0809EF78(this, pEVar1)) { if (PlayerCanBeMoved()) { sub_08079E58(super->speed, super->direction); @@ -135,8 +135,8 @@ void sub_0809EE44(FanEntity* this) { bVar3 = 1; break; case 0x3: - if (pEVar1->x.HALF.HI != gPlayerEntity.x.HALF.HI || - pEVar1->y.HALF.HI != gPlayerEntity.y.HALF.HI) + if (pEVar1->x.HALF.HI != gPlayerEntity.base.x.HALF.HI || + pEVar1->y.HALF.HI != gPlayerEntity.base.y.HALF.HI) bVar3 = 1; break; break; diff --git a/src/object/figurineDevice.c b/src/object/figurineDevice.c index b3aadfaf..8572dc38 100644 --- a/src/object/figurineDevice.c +++ b/src/object/figurineDevice.c @@ -717,7 +717,7 @@ void FigurineDevice_NoFigurinesLeftMessage(void) { gMessage.rupees = 5; } #ifndef EU - gPlayerEntity.animationState = 6; + gPlayerEntity.base.animationState = 6; #endif } @@ -794,9 +794,9 @@ void sub_0808861C(FigurineDeviceEntity* this, ScriptExecutionContext* context) { // If I understand this correctly then it checks if the player is at the lever context->condition = CheckPlayerInRegion(168, 84, 12, 8); #ifdef JP - if ((gPlayerEntity.animationState != 0)) { + if ((gPlayerEntity.base.animationState != 0)) { #else - if ((gPlayerEntity.animationState != 0) || (gPlayerEntity.z.HALF.HI != 0)) { + if ((gPlayerEntity.base.animationState != 0) || (gPlayerEntity.base.z.HALF.HI != 0)) { #endif context->condition = 0; } @@ -806,7 +806,7 @@ void sub_0808861C(FigurineDeviceEntity* this, ScriptExecutionContext* context) { #if !defined(JP) void sub_08088658(FigurineDeviceEntity* this, ScriptExecutionContext* context) { context->condition = CheckPlayerInRegion(120, 120, 16, 8); // And this is if the player is at the door - if (gPlayerEntity.z.HALF.HI != 0) { + if (gPlayerEntity.base.z.HALF.HI != 0) { context->condition = 0; } gActiveScriptInfo.flags |= 1; diff --git a/src/object/floatingPlatform.c b/src/object/floatingPlatform.c index 5da525f0..3a260350 100644 --- a/src/object/floatingPlatform.c +++ b/src/object/floatingPlatform.c @@ -63,9 +63,9 @@ bool32 sub_08086168(FloatingPlatformEntity* this) { const u8* ptr; ptr = gUnk_08120658 + super->type * 2; - if (((EntityInRectRadius(super, &gPlayerEntity, ptr[0], ptr[1])) && PlayerCanBeMoved())) { + if (((EntityInRectRadius(super, &gPlayerEntity.base, ptr[0], ptr[1])) && PlayerCanBeMoved())) { gPlayerState.field_0x14 = 1; - if (gPlayerEntity.z.HALF.HI == 0) { + if (gPlayerEntity.base.z.HALF.HI == 0) { return TRUE; } else { return FALSE; diff --git a/src/object/fourElements.c b/src/object/fourElements.c index 0968a61c..b8d9ea50 100644 --- a/src/object/fourElements.c +++ b/src/object/fourElements.c @@ -107,7 +107,7 @@ void FourElements_Action3(FourElementsEntity* this) { if (super->timer != 0) { sub_080A0424(this); if (--super->timer == 0) { - SetEntityPriority(&gPlayerEntity, 0); + SetEntityPriority(&gPlayerEntity.base, 0); } } else { RequestPriorityDuration(NULL, 60); diff --git a/src/object/frozenOctorok.c b/src/object/frozenOctorok.c index 800f77fc..be88eb5f 100644 --- a/src/object/frozenOctorok.c +++ b/src/object/frozenOctorok.c @@ -386,7 +386,7 @@ void FrozenOctorok_Action1SubAction6(FrozenOctorokEntity* this) { LinearMoveUpdate(super); if ((gRoomControls.origin_y + 0x1c8) < super->y.HALF.HI) { gRoomControls.scrollSpeed = 4; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; SetLocalFlag(0x9b); DeleteEntity(super->parent); DeleteEntity(&this->heap->mouthObject->base); diff --git a/src/object/furniture.c b/src/object/furniture.c index 7a816166..31d06f14 100644 --- a/src/object/furniture.c +++ b/src/object/furniture.c @@ -309,7 +309,8 @@ static void FurnitureInit(FurnitureEntity* this) { static void FurnitureUpdate(FurnitureEntity* this) { switch (this->flags & 0x7FFF) { case 0x1: - if (gPlayerEntity.y.HALF.HI < super->y.HALF.HI || gPlayerEntity.y.HALF.HI > super->y.HALF.HI + 24) { + if (gPlayerEntity.base.y.HALF.HI < super->y.HALF.HI || + gPlayerEntity.base.y.HALF.HI > super->y.HALF.HI + 24) { super->spriteRendering.b3 = 2; } else { super->spriteRendering.b3 = 3; @@ -337,16 +338,16 @@ static void FurnitureUpdate(FurnitureEntity* this) { } break; case 0x80: - if (gPlayerEntity.y.HALF.HI < super->y.HALF.HI + 8) { + if (gPlayerEntity.base.y.HALF.HI < super->y.HALF.HI + 8) { if (gPlayerState.floor_type != SURFACE_LADDER && GetTileTypeByEntity(super) == 0x4017) { SetTile(0x4026, this->tile, super->collisionLayer); SetTile(0x403D, this->tile - 64, super->collisionLayer); SetTile(0x403D, this->tile - 128, super->collisionLayer); } } else { - if (gPlayerEntity.collisionLayer & 2) { - gPlayerEntity.collisionLayer = 1; - UpdateSpriteForCollisionLayer(&gPlayerEntity); + if (gPlayerEntity.base.collisionLayer & 2) { + gPlayerEntity.base.collisionLayer = 1; + UpdateSpriteForCollisionLayer(&gPlayerEntity.base); } if (GetTileTypeByEntity(super) != 0x4017) { SetTile(0x4017, this->tile, super->collisionLayer); diff --git a/src/object/giantTwig.c b/src/object/giantTwig.c index bc936e18..62deab7a 100644 --- a/src/object/giantTwig.c +++ b/src/object/giantTwig.c @@ -102,7 +102,7 @@ void GiantTwig_Type0Init(GiantTwigEntity* this) { void GiantTwig_Type0Idle(GiantTwigEntity* this) { if (super->type == 0) { - if (gPlayerEntity.y.HALF.HI < super->y.HALF.HI + 0x20) { + if (gPlayerEntity.base.y.HALF.HI < super->y.HALF.HI + 0x20) { super->spriteRendering.b3 = 1; } else { super->spriteRendering.b3 = 2; diff --git a/src/object/gleerokParticle.c b/src/object/gleerokParticle.c index 03ed1d2f..23bd5d17 100644 --- a/src/object/gleerokParticle.c +++ b/src/object/gleerokParticle.c @@ -77,7 +77,7 @@ void GleerokParticle_Init(GleerokParticleEntity* this) { gRoomControls.camera_target = super; } else { if (--this->unk78 == -1) { - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; DeleteThisEntity(); } } diff --git a/src/object/graveyardKey.c b/src/object/graveyardKey.c index 84f618df..699bb95a 100644 --- a/src/object/graveyardKey.c +++ b/src/object/graveyardKey.c @@ -92,7 +92,7 @@ void GraveyardKey_Init(Entity* this, const struct_gUnk_08123FB0* param_2) { if ((this->direction & DIR_NOT_MOVING_CHECK)) { dir = this->direction; if (dir == (DIR_NOT_MOVING_CHECK | 0x1)) { - this->direction = (((gPlayerEntity.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ DirectionSouth; + this->direction = (((gPlayerEntity.base.animationState * 4 + (Random() & 3)) - 2) & 0x1f) ^ DirectionSouth; } } UpdateSpriteForCollisionLayer(this); @@ -130,7 +130,7 @@ void GraveyardKey_Action2(Entity* this, const struct_gUnk_08123FB0* param_2) { this->zVelocity = param_2->unk14 << 3; } else { this->action++; - this->collisionLayer = gPlayerEntity.collisionLayer; + this->collisionLayer = gPlayerEntity.base.collisionLayer; UpdateSpriteForCollisionLayer(this); if (param_2->funcEnt != NULL) { param_2->funcEnt(this); @@ -177,13 +177,14 @@ void sub_0809D91C(Entity* this) { bool32 sub_0809D93C(Entity* this, const struct_gUnk_08123FB0* param_2) { u32 uVar1; - if (gPlayerEntity.action == PLAYER_BOUNCE && ((param_2->unk0c >> gPlayerEntity.animationState & 1) != 0)) { - uVar1 = (gPlayerEntity.x.HALF.HI - this->x.HALF.HI) + param_2->unk08 + param_2->unk0a; + if (gPlayerEntity.base.action == PLAYER_BOUNCE && + ((param_2->unk0c >> gPlayerEntity.base.animationState & 1) != 0)) { + uVar1 = (gPlayerEntity.base.x.HALF.HI - this->x.HALF.HI) + param_2->unk08 + param_2->unk0a; if (param_2->unk0a * 2 <= (u16)uVar1) { return 0; } - uVar1 = (gPlayerEntity.y.HALF.HI - (this->y.HALF.HI + param_2->y)) + param_2->unk09 + param_2->unk0b; + uVar1 = (gPlayerEntity.base.y.HALF.HI - (this->y.HALF.HI + param_2->y)) + param_2->unk09 + param_2->unk0b; if (param_2->unk0b * 2 > (u16)uVar1) { return 1; } diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index 376f931e..3099571c 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -65,12 +65,12 @@ void GreatFairy(GreatFairyEntity* this) { void GreatFairy_CallBehavior(GreatFairyEntity* this) { GreatFairy_Behaviors[super->action](this); - if ((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) < 168) { + if ((gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) < 168) { gRoomControls.camera_target = super; gRoomControls.scrollSpeed = 2; } else { - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; gRoomControls.scrollSpeed = 2; } } @@ -541,8 +541,8 @@ void sub_08087424(GreatFairyEntity* this, ScriptExecutionContext* context) { ResetPlayerAnimationAndAction(); ent = CreateObject(THUNDERBOLT, 0, 0); if (ent != NULL) { - ent->parent = &gPlayerEntity; - CopyPosition(&gPlayerEntity, ent); + ent->parent = &gPlayerEntity.base; + CopyPosition(&gPlayerEntity.base, ent); SetEntityPriority(ent, PRIO_MESSAGE); } diff --git a/src/object/gustJarParticle.c b/src/object/gustJarParticle.c index b55e2d16..afbc0aa1 100644 --- a/src/object/gustJarParticle.c +++ b/src/object/gustJarParticle.c @@ -25,10 +25,10 @@ void GustJarParticle(Entity* this) { void GustJarParticle_Init(Entity* this) { this->action = 1; this->speed = 0x80; - this->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; - this->spritePriority.b0 = gPlayerEntity.spritePriority.b0; - this->collisionLayer = gPlayerEntity.collisionLayer; - this->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; + this->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; + this->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0; + this->collisionLayer = gPlayerEntity.base.collisionLayer; + this->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; this->type = Random() & 1; InitializeAnimation(this, 0x11); } diff --git a/src/object/gyorgBossObject.c b/src/object/gyorgBossObject.c index 0197a246..2de64ed0 100644 --- a/src/object/gyorgBossObject.c +++ b/src/object/gyorgBossObject.c @@ -228,7 +228,7 @@ void GyorgBossObject_FemalePhase4(GyorgBossObjectEntity* this) { } this->unk_6c = 0; gRoomTransition.field_0x39 = 0; - if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) { + if (PlayerCanBeMoved() && gPlayerEntity.base.z.HALF.HI == 0) { super->action = 9; super->timer = 0; super->subtimer = 240; @@ -236,7 +236,7 @@ void GyorgBossObject_FemalePhase4(GyorgBossObjectEntity* this) { super->direction = 0; super->speed = 0x60; gPlayerState.flags &= ~PL_GYORG_FIGHT; - CopyPosition(&gPlayerEntity, super); + CopyPosition(&gPlayerEntity.base, super); gRoomControls.camera_target = super; SetPlayerControl(2); } @@ -463,7 +463,7 @@ void sub_080A1FF0(GyorgBossObjectEntity* this) { } } if (this->unk_7b) { - if (EntityWithinDistance(&gPlayerEntity, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, + if (EntityWithinDistance(&gPlayerEntity.base, gRoomControls.origin_x + 0x200, gRoomControls.origin_y + 0x210, 0x100)) { if (super->timer == 0) { super->timer = 120; @@ -482,7 +482,7 @@ u32 sub_080A20B8(GyorgBossObjectEntity* this, GyorgMaleEntity* other) { if (other == NULL) { return 1; } - if (PlayerCanBeMoved() && gPlayerEntity.z.HALF.HI == 0) { + if (PlayerCanBeMoved() && gPlayerEntity.base.z.HALF.HI == 0) { return other->unk_7c == 0 && gPlayerState.field_0x14 != 0; } return 0; diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index 676ad461..79ecf0d8 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -182,7 +182,7 @@ void sub_0808692C(HouseDoorExteriorEntity* this) { static u8 sub_08086954(HouseDoorExteriorEntity* this) { if (sub_0800445C(super)) { - if (GetAnimationStateInRectRadius(super, 6, 20) >= 0 && gPlayerEntity.animationState == 0 && + if (GetAnimationStateInRectRadius(super, 6, 20) >= 0 && gPlayerEntity.base.animationState == 0 && (u16)gPlayerState.playerInput.heldInput == INPUT_UP && gPlayerState.jump_status == 0) { super->timer--; } diff --git a/src/object/houseDoorInterior.c b/src/object/houseDoorInterior.c index 75b2dd27..f2a51b32 100644 --- a/src/object/houseDoorInterior.c +++ b/src/object/houseDoorInterior.c @@ -91,7 +91,8 @@ 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.playerInput.heldInput & ptr->unk2) { + ptr->animationState == gPlayerEntity.base.animationState && + gPlayerState.playerInput.heldInput & ptr->unk2) { --super->timer; } } else { diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index fc67ff26..0b99381d 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -10,7 +10,6 @@ #include "hitbox.h" #include "kinstone.h" #include "message.h" -#include "new_player.h" typedef struct { u8 before[0x20]; @@ -92,7 +91,7 @@ void ItemForSale_Action1(ItemForSaleEntity* this) { PausePlayer(); ResetActiveItems(); gPlayerState.heldObject = 4; - gNewPlayerEntity.unk_74 = super; + gPlayerEntity.unk_74 = super; gUnk_0200AF00.rActionPlayerState = R_ACTION_DROP; MessageClose(); } @@ -104,8 +103,8 @@ void ItemForSale_Action2(ItemForSaleEntity* this) { void* ptr; gUnk_0200AF00.rActionPlayerState = R_ACTION_DROP; - super->spriteSettings.draw = gPlayerEntity.spriteSettings.draw; - if ((gPlayerState.heldObject == 0) || (super != gNewPlayerEntity.unk_74)) { + super->spriteSettings.draw = gPlayerEntity.base.spriteSettings.draw; + if ((gPlayerState.heldObject == 0) || (super != gPlayerEntity.unk_74)) { sub_080819B4(this); } else { ptr = sub_080784E4(); @@ -130,7 +129,7 @@ void sub_080819B4(ItemForSaleEntity* this) { DeleteThisEntity(); } gPlayerState.heldObject = 0; - gNewPlayerEntity.unk_74 = 0; + gPlayerEntity.unk_74 = 0; ptr = &gUnk_0200AF00; gRoomVars.shopItemType = 0; ptr->rActionInteractObject = R_ACTION_NONE; @@ -141,7 +140,7 @@ void sub_080819B4(ItemForSaleEntity* this) { super->z.WORD = 0; super->action = 1; super->subAction = 0; - super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; + super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; super->collisionLayer = 1; super->spritePriority.b0 = 4; UpdateSpriteForCollisionLayer(super); diff --git a/src/object/itemOnGround.c b/src/object/itemOnGround.c index f3f6a62f..edb631a2 100644 --- a/src/object/itemOnGround.c +++ b/src/object/itemOnGround.c @@ -187,7 +187,7 @@ void sub_080810FC(ItemOnGroundEntity* this) { super->subAction = 0; COLLISION_ON(super); super->flags2 = 0x11; - CopyPosition(&gPlayerEntity, super); + CopyPosition(&gPlayerEntity.base, super); } } @@ -295,10 +295,10 @@ void sub_080812A8(ItemOnGroundEntity* this) { void sub_080812E8(ItemOnGroundEntity* this) { PlayerState* playerState = &gPlayerState; #ifdef EU - if ((playerState->swim_state & 0x80) && IsColliding(super, &gPlayerEntity)) { + if ((playerState->swim_state & 0x80) && IsColliding(super, &gPlayerEntity.base)) { #else if ((playerState->swim_state & 0x80) && (playerState->flags & PL_MINISH) == 0 && - IsColliding(super, &gPlayerEntity)) { + IsColliding(super, &gPlayerEntity.base)) { #endif sub_080810FC(this); } @@ -314,7 +314,7 @@ void ItemOnGround_Action3(ItemOnGroundEntity* this) { } else { CopyPosition(other, super); super->z.HALF.HI--; - other = &gPlayerEntity; + other = &gPlayerEntity.base; if (IsColliding(super, other)) { sub_080810FC(this); } @@ -481,7 +481,7 @@ void sub_08081598(ItemOnGroundEntity* this) { super->spriteSettings.draw = 1; super->spritePriority.b1 = 2; super->spritePriority.b0 = 3; - super->child = &gPlayerEntity; + super->child = &gPlayerEntity.base; CopyPosition(super->child, super); super->z.HALF.HI -= 4; if (super->type != 0x5F && sub_08081420(this)) { diff --git a/src/object/keyStealingTakkuri.c b/src/object/keyStealingTakkuri.c index de25fd6a..c5a8bdf3 100644 --- a/src/object/keyStealingTakkuri.c +++ b/src/object/keyStealingTakkuri.c @@ -169,7 +169,7 @@ void KeyStealingTakkuri_Type5_Action1(KeyStealingTakkuriEntity* this) { super->zVelocity = Q_16_16(1.0); } else { super->action++; - super->collisionLayer = gPlayerEntity.collisionLayer; + super->collisionLayer = gPlayerEntity.base.collisionLayer; UpdateSpriteForCollisionLayer(super); } SoundReq(SFX_RUPEE_BOUNCE); @@ -392,7 +392,7 @@ void sub_0809E0A0(KeyStealingTakkuriEntity* this) { obj->parent = super; super->child = obj; super->subtimer = 0; - CopyPosition(&gPlayerEntity, obj); + CopyPosition(&gPlayerEntity.base, obj); obj->z.HALF.HI = -8; } } @@ -414,7 +414,7 @@ void sub_0809E0D4(KeyStealingTakkuriEntity* this, ScriptExecutionContext* contex return; } } else { - entity = &gPlayerEntity; + entity = &gPlayerEntity.base; } context->unk_18++; sub_0807DEDC(super, context, entity->x.HALF.HI, entity->y.HALF.HI); @@ -475,7 +475,8 @@ void sub_0809E1F0(KeyStealingTakkuriEntity* this) { } void sub_0809E210(KeyStealingTakkuriEntity* this) { - gPlayerEntity.animationState = GetAnimationStateForDirection8(GetFacingDirection(&gPlayerEntity, super)) & 0xfe; + gPlayerEntity.base.animationState = + GetAnimationStateForDirection8(GetFacingDirection(&gPlayerEntity.base, super)) & 0xfe; gPlayerState.animation = ANIM_DEFAULT; } @@ -504,8 +505,8 @@ u32 sub_0809E2C4(KeyStealingTakkuriEntity* this, u32 param_2) { s32 roomY; ptr = &gUnk_08124178[param_2 * 2]; - roomX = gPlayerEntity.x.HALF.HI - (gRoomControls.origin_x + ptr[0]); - roomY = gPlayerEntity.y.HALF.HI - (gRoomControls.origin_y + ptr[1]); + roomX = gPlayerEntity.base.x.HALF.HI - (gRoomControls.origin_x + ptr[0]); + roomY = gPlayerEntity.base.y.HALF.HI - (gRoomControls.origin_y + ptr[1]); tmp = gUnk_08124158; counter = 0; while (counter < 4) { @@ -515,7 +516,7 @@ u32 sub_0809E2C4(KeyStealingTakkuriEntity* this, u32 param_2) { uVar1 = roomY - tmp->unk_2 + tmp->unk_5; uVar2 = tmp->unk_5 * 2; if (uVar2 > (u16)uVar1) { - if (tmp->unk_6 == gPlayerEntity.animationState && gPlayerEntity.action == PLAYER_BOUNCE) { + if (tmp->unk_6 == gPlayerEntity.base.animationState && gPlayerEntity.base.action == PLAYER_BOUNCE) { return 1; } return 2; diff --git a/src/object/ladderHoleInBookshelf.c b/src/object/ladderHoleInBookshelf.c index dd55d741..0082e9d3 100644 --- a/src/object/ladderHoleInBookshelf.c +++ b/src/object/ladderHoleInBookshelf.c @@ -29,7 +29,7 @@ void LadderHoleInBookshelf_Init(Entity* this) { void LadderHoleInBookshelf_Action1(Entity* this) { if (sub_08094064(this)) { if (this->collisionLayer == 2) { - switch (gPlayerEntity.action) { + switch (gPlayerEntity.base.action) { case PLAYER_CLIMB: case PLAYER_USEENTRANCE: return; @@ -38,7 +38,7 @@ void LadderHoleInBookshelf_Action1(Entity* this) { UpdateSpriteForCollisionLayer(this); this->spritePriority.b0 = 5; } else { - switch (gPlayerEntity.action) { + switch (gPlayerEntity.base.action) { case PLAYER_CLIMB: case PLAYER_USEENTRANCE: this->collisionLayer = 2; @@ -46,10 +46,10 @@ void LadderHoleInBookshelf_Action1(Entity* this) { this->spritePriority.b0 = 1; break; default: - if ((gPlayerEntity.collisionLayer & 2) == 0) { + if ((gPlayerEntity.base.collisionLayer & 2) == 0) { break; } - gPlayerEntity.collisionLayer = 1; + gPlayerEntity.base.collisionLayer = 1; break; } } @@ -58,7 +58,7 @@ void LadderHoleInBookshelf_Action1(Entity* this) { bool32 sub_08094064(Entity* this) { bool32 rv = 1; - if (gPlayerEntity.x.HALF.HI - this->x.HALF.HI + 0x1cU >= 0x39) { + if (gPlayerEntity.base.x.HALF.HI - this->x.HALF.HI + 0x1cU >= 0x39) { rv = 0; } diff --git a/src/object/ladderUp.c b/src/object/ladderUp.c index 8743fadc..cfdadfb9 100644 --- a/src/object/ladderUp.c +++ b/src/object/ladderUp.c @@ -64,7 +64,7 @@ void LadderUp(Entity* this) { #endif default: if (this->type2 == 0) { - if (gPlayerEntity.y.HALF.HI < this->y.HALF.HI) { + if (gPlayerEntity.base.y.HALF.HI < this->y.HALF.HI) { if (gPlayerState.floor_type != SURFACE_LADDER && (GetTileTypeByEntity(this) == 0x4017)) { SetTile(0x4023, COORD_TO_TILE(this), this->collisionLayer); RestorePrevTileEntity(COORD_TO_TILE_OFFSET(this, 0, 0x10), this->collisionLayer); diff --git a/src/object/lavaPlatform.c b/src/object/lavaPlatform.c index a98cd00b..5db1f0b9 100644 --- a/src/object/lavaPlatform.c +++ b/src/object/lavaPlatform.c @@ -278,10 +278,10 @@ void sub_0809264C(LavaPlatformEntity* this) { } bool32 LavaPlatform_IsPlayerOnPlatform(LavaPlatformEntity* this) { - if ((gPlayerState.flags & PL_MINISH) == 0 && EntityInRectRadius(super, &gPlayerEntity, 0x10, 0x10) && + if ((gPlayerState.flags & PL_MINISH) == 0 && EntityInRectRadius(super, &gPlayerEntity.base, 0x10, 0x10) && PlayerCanBeMoved()) { gPlayerState.field_0x14 = 1; - if (gPlayerEntity.z.HALF.HI == 0) { + if (gPlayerEntity.base.z.HALF.HI == 0) { super->subtimer = 1; return TRUE; } diff --git a/src/object/lightRay.c b/src/object/lightRay.c index 9d0b6548..a48ffa53 100644 --- a/src/object/lightRay.c +++ b/src/object/lightRay.c @@ -41,12 +41,12 @@ void LightRay_Type0(LightRayEntity* this) { super->subtimer = 0; gRoomControls.camera_target = super; gRoomControls.scrollSpeed = 1; - if (super->x.HALF.HI > gPlayerEntity.x.HALF.HI) { + if (super->x.HALF.HI > gPlayerEntity.base.x.HALF.HI) { tmp = 2; } else { tmp = 6; } - gPlayerEntity.animationState = tmp; + gPlayerEntity.base.animationState = tmp; gScreen.lcd.displayControl = (gScreen.lcd.displayControl & 0xbfff) | 0x2800; gScreen.controls.window0HorizontalDimensions = 0; gScreen.controls.window0VerticalDimensions = 0xa0; @@ -66,7 +66,7 @@ void LightRay_Type0(LightRayEntity* this) { super->action = 2; super->timer = 60; gScreen.lcd.displayControl &= 0xdfff; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; SoundReq(SFX_134); } } @@ -115,12 +115,12 @@ void LightRay_Type1(LightRayEntity* this) { super->subtimer = 32; gRoomControls.camera_target = super; gRoomControls.scrollSpeed = 1; - if (super->x.HALF.HI > gPlayerEntity.x.HALF.HI) { + if (super->x.HALF.HI > gPlayerEntity.base.x.HALF.HI) { tmp = 2; } else { tmp = 6; } - gPlayerEntity.animationState = tmp; + gPlayerEntity.base.animationState = tmp; gScreen.lcd.displayControl = (gScreen.lcd.displayControl & 0xbfff) | 0x2000; gScreen.controls.window0HorizontalDimensions = DISPLAY_WIDTH; gScreen.controls.window0VerticalDimensions = DISPLAY_HEIGHT; @@ -139,7 +139,7 @@ void LightRay_Type1(LightRayEntity* this) { } else { super->action = 2; super->timer = 60; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; SoundReq(SFX_134); } } @@ -166,12 +166,12 @@ void LightRay_Type2(LightRayEntity* this) { super->subtimer = 0; gRoomControls.camera_target = super; gRoomControls.scrollSpeed = 1; - if (super->x.HALF.HI > gPlayerEntity.x.HALF.HI) { + if (super->x.HALF.HI > gPlayerEntity.base.x.HALF.HI) { tmp = 2; } else { tmp = 6; } - gPlayerEntity.animationState = tmp; + gPlayerEntity.base.animationState = tmp; gScreen.controls.window0HorizontalDimensions = 0x60; gScreen.controls.window0VerticalDimensions = 0xa0; break; @@ -211,7 +211,7 @@ void LightRay_Type2(LightRayEntity* this) { case 3: if (--super->timer == 0) { super->action = 4; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; gRoomControls.scrollSpeed = 2; } break; @@ -236,12 +236,12 @@ void LightRay_Type3(LightRayEntity* this) { super->subtimer = 0; gRoomControls.camera_target = super; gRoomControls.scrollSpeed = 1; - if (super->x.HALF.HI > gPlayerEntity.x.HALF.HI) { + if (super->x.HALF.HI > gPlayerEntity.base.x.HALF.HI) { tmp = 2; } else { tmp = 6; } - gPlayerEntity.animationState = tmp; + gPlayerEntity.base.animationState = tmp; gScreen.controls.window0HorizontalDimensions = 0x80f0; gScreen.controls.window0VerticalDimensions = 0xa0; super->subAction = 0x80; @@ -292,12 +292,12 @@ void LightRay_Type4(LightRayEntity* this) { super->subtimer = 128; gRoomControls.camera_target = super; gRoomControls.scrollSpeed = 1; - if (super->x.HALF.HI > gPlayerEntity.x.HALF.HI) { + if (super->x.HALF.HI > gPlayerEntity.base.x.HALF.HI) { tmp = 2; } else { tmp = 6; } - gPlayerEntity.animationState = tmp; + gPlayerEntity.base.animationState = tmp; break; case 1: if (super->timer != 0) { @@ -310,7 +310,7 @@ void LightRay_Type4(LightRayEntity* this) { } else { super->action = 2; super->timer = 60; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; SoundReq(SFX_134); } } diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 3f47f21c..7a09ee3a 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -100,19 +100,19 @@ void LilypadLarge_Action1(LilypadLargeEntity* this) { u32 uVar4; super->flags |= 0x20; - if (sub_0806FC80(super, &gPlayerEntity, 0x18) != 0) { + if (sub_0806FC80(super, &gPlayerEntity.base, 0x18) != 0) { gPlayerState.flags |= PL_FLAGS2; - if (gPlayerEntity.z.WORD == 0) { + if (gPlayerEntity.base.z.WORD == 0) { if (gPlayerState.swim_state != 0) { - gPlayerEntity.collisionFlags &= 0xfb; + gPlayerEntity.base.collisionFlags &= 0xfb; gPlayerState.swim_state = 0; } gPlayerState.lilypad = super; if (super->collisionLayer == 1) { - ResetCollisionLayer(&gPlayerEntity); + ResetCollisionLayer(&gPlayerEntity.base); } else { - sub_08004542(&gPlayerEntity); + sub_08004542(&gPlayerEntity.base); } if (super->subtimer == 0) { super->subtimer = 4; @@ -127,7 +127,7 @@ void LilypadLarge_Action1(LilypadLargeEntity* this) { } if (gPlayerState.field_0x1c == 3) { tmp = gUnk_08120620[gPlayerState.gustJarSpeed - 1]; - switch (gPlayerEntity.animationState & 6) { + switch (gPlayerEntity.base.animationState & 6) { case 4: this->unk_70 -= tmp; break; @@ -150,8 +150,8 @@ void LilypadLarge_Action1(LilypadLargeEntity* this) { SoundReq(SFX_WATER_WALK); } if ((super->contactFlags & 0x7f) == 0x13) { - sVar10 = gPlayerEntity.x.HALF.HI + gUnk_08126EE4[gPlayerEntity.animationState & 0xe]; - uVar4 = gPlayerEntity.y.HALF.HI + gUnk_08126EE4[gPlayerEntity.animationState | 1]; + sVar10 = gPlayerEntity.base.x.HALF.HI + gUnk_08126EE4[gPlayerEntity.base.animationState & 0xe]; + uVar4 = gPlayerEntity.base.y.HALF.HI + gUnk_08126EE4[gPlayerEntity.base.animationState | 1]; super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, sVar10, uVar4); switch (gPlayerState.gustJarSpeed) { @@ -377,26 +377,26 @@ void sub_08085B40(LilypadLargeEntity* this) { this->unk_78.WORD += 0x100000; SetAffineInfo(super, this->unk_78.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7c.HALF_U.HI); } - gPlayerEntity.y.HALF.HI = (super->y.HALF.HI + super->z.HALF.HI) - this->unk_74; + gPlayerEntity.base.y.HALF.HI = (super->y.HALF.HI + super->z.HALF.HI) - this->unk_74; if (gArea.locationIndex == 0x1b) { - gPlayerEntity.z.HALF.HI = super->y.HALF.HI - this->unk_74 - 0xd0 - gPlayerEntity.y.HALF.HI; + gPlayerEntity.base.z.HALF.HI = super->y.HALF.HI - this->unk_74 - 0xd0 - gPlayerEntity.base.y.HALF.HI; } else { - gPlayerEntity.z.HALF.HI = super->y.HALF.HI - this->unk_74 - 0x40 - gPlayerEntity.y.HALF.HI; + gPlayerEntity.base.z.HALF.HI = super->y.HALF.HI - this->unk_74 - 0x40 - gPlayerEntity.base.y.HALF.HI; } } } else { ResetCollisionLayer(super); if (GetTileUnderEntity(super) == 0xd) { - ResetCollisionLayer(&gPlayerEntity); + ResetCollisionLayer(&gPlayerEntity.base); LilypadLarge_Action4(this); - super->direction = GetFacingDirection(&gPlayerEntity, super); - LinearMoveDirection(&gPlayerEntity, 0x100, super->direction); + super->direction = GetFacingDirection(&gPlayerEntity.base, super); + LinearMoveDirection(&gPlayerEntity.base, 0x100, super->direction); } } if (this->unk_82 == 0) { - if (GravityUpdate(&gPlayerEntity, Q_8_8(32.0)) == 0) { - ResetCollisionLayer(&gPlayerEntity); + if (GravityUpdate(&gPlayerEntity.base, Q_8_8(32.0)) == 0) { + ResetCollisionLayer(&gPlayerEntity.base); sub_08085F1C(this); super->action = 1; super->subtimer = 4; @@ -418,23 +418,23 @@ void sub_08085B40(LilypadLargeEntity* this) { } void LilypadLarge_Action3(LilypadLargeEntity* this) { - if (sub_0806FC80(super, &gPlayerEntity, 0x18) != 0) { + if (sub_0806FC80(super, &gPlayerEntity.base, 0x18) != 0) { LinearMoveUpdate(super); - gPlayerEntity.speed = super->speed; - gPlayerEntity.direction = super->direction; - LinearMoveUpdate(&gPlayerEntity); + gPlayerEntity.base.speed = super->speed; + gPlayerEntity.base.direction = super->direction; + LinearMoveUpdate(&gPlayerEntity.base); gPlayerState.flags |= PL_FLAGS2; if (super->collisionLayer == 1) { - ResetCollisionLayer(&gPlayerEntity); + ResetCollisionLayer(&gPlayerEntity.base); } else { - sub_08004542(&gPlayerEntity); + sub_08004542(&gPlayerEntity.base); } } if (gRoomControls.reload_flags == 0) { super->flags &= ~ENT_PERSIST; super->action = 1; super->updatePriority = super->updatePriorityPrev; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; } } @@ -498,7 +498,7 @@ void sub_08085D60(LilypadLargeEntity* this) { if (sub_080806BC((super->x.HALF.HI - gRoomControls.origin_x) + tmpX, (super->y.HALF.HI - gRoomControls.origin_y) + tmpY, r4, 5) == 0) { - if (sub_0807BD14(&gPlayerEntity, r4 >> 3) != 0) { + if (sub_0807BD14(&gPlayerEntity.base, r4 >> 3) != 0) { super->direction = r4; sub_08085E74(this); return; @@ -514,7 +514,7 @@ void sub_08085D60(LilypadLargeEntity* this) { tmpX2 = gUnk_08120638[tmp]; tmpY2 = gUnk_08120638[tmp + 1]; if (sub_080B1AF0(super, tmpX2, tmpY2) == 0xff) { - if (sub_0807BD14(&gPlayerEntity, r6 >> 3) != 0) { + if (sub_0807BD14(&gPlayerEntity.base, r6 >> 3) != 0) { super->direction = (u8)r6; sub_08085E74(this); } @@ -547,9 +547,9 @@ void sub_08085E74(LilypadLargeEntity* this) { this->unk_6c = 0; super->x.HALF.LO = 0; super->y.HALF.LO = 0; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = super->direction; + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = super->direction; gPlayerState.animation = ANIM_DEFAULT; gRoomControls.camera_target = super; if (gPlayerState.item != NULL) { @@ -559,13 +559,13 @@ void sub_08085E74(LilypadLargeEntity* this) { } void sub_08085EFC(LilypadLargeEntity* this) { - this->unk_76 = super->x.HALF.HI - gPlayerEntity.x.HALF.HI; - this->unk_74 = super->y.HALF.HI - gPlayerEntity.y.HALF.HI; + this->unk_76 = super->x.HALF.HI - gPlayerEntity.base.x.HALF.HI; + this->unk_74 = super->y.HALF.HI - gPlayerEntity.base.y.HALF.HI; } void sub_08085F1C(LilypadLargeEntity* this) { - gPlayerEntity.x.HALF.HI = super->x.HALF.HI - this->unk_76; - gPlayerEntity.y.HALF.HI = super->y.HALF.HI - this->unk_74; + gPlayerEntity.base.x.HALF.HI = super->x.HALF.HI - this->unk_76; + gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI - this->unk_74; sub_0807A5B8(super->direction); } diff --git a/src/object/lilypadSmall.c b/src/object/lilypadSmall.c index 78e91a99..2d92e4f0 100644 --- a/src/object/lilypadSmall.c +++ b/src/object/lilypadSmall.c @@ -42,13 +42,13 @@ void LilypadSmall(LilypadSmallEntity* this) { static bool32 CheckMovePlayer(LilypadSmallEntity* this) { if (!(gPlayerState.flags & PL_MINISH)) { return FALSE; - } else if (EntityInRectRadius(super, &gPlayerEntity, 8, 8) == 0) { + } else if (EntityInRectRadius(super, &gPlayerEntity.base, 8, 8) == 0) { return FALSE; } else if (!PlayerCanBeMoved()) { return FALSE; } else { gPlayerState.field_0x14 = 1; - if (gPlayerEntity.z.HALF.HI != 0) { + if (gPlayerEntity.base.z.HALF.HI != 0) { return FALSE; } else { return TRUE; diff --git a/src/object/linkAnimation.c b/src/object/linkAnimation.c index 123d6e77..71e1a494 100644 --- a/src/object/linkAnimation.c +++ b/src/object/linkAnimation.c @@ -52,19 +52,19 @@ void LinkAnimation_ItemGet(LinkAnimationEntity* this) { u8* ptr; // hide player entity - gPlayerEntity.flags &= ~ENT_COLLIDE; - gPlayerEntity.spriteSettings.draw = 0; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.spriteSettings.draw = 0; - super->palette.b.b0 = gPlayerEntity.palette.b.b0; + super->palette.b.b0 = gPlayerEntity.base.palette.b.b0; switch (super->subAction) { case ITEMGET_INIT: one = 1; super->subAction = one; super->spriteSettings.draw = one; - super->collisionLayer = gPlayerEntity.collisionLayer; - super->spritePriority.b0 = gPlayerEntity.spritePriority.b0; - super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; - super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; + super->collisionLayer = gPlayerEntity.base.collisionLayer; + super->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0; + super->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; + super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; super->spriteSettings.flipX = 0; super->animationState = 4; SetEntityPriority(super, PRIO_PLAYER_EVENT); @@ -98,9 +98,9 @@ void LinkAnimation_ItemGet(LinkAnimationEntity* this) { if (super->frame & ANIM_DONE) { super->action = PLAYER_NORMAL; // restore player state - gPlayerEntity.flags = this->storeFlags; - gPlayerEntity.spriteSettings.draw = this->storeDrawFlags; - gPlayerEntity.iframes = this->storeIFrames; + gPlayerEntity.base.flags = this->storeFlags; + gPlayerEntity.base.spriteSettings.draw = this->storeDrawFlags; + gPlayerEntity.base.iframes = this->storeIFrames; gPlayerState.field_0x7 = this->storeField7; gPlayerState.keepFacing = this->storeKeepFacing; gPlayerState.field_0xa = this->storeFieldA; diff --git a/src/object/linkEmptyingBottle.c b/src/object/linkEmptyingBottle.c index 8f029f69..e3b77637 100644 --- a/src/object/linkEmptyingBottle.c +++ b/src/object/linkEmptyingBottle.c @@ -39,8 +39,9 @@ void LinkEmptyingBottle_Init(LinkEmptyingBottleEntity* this) { effect = CreateFx(super, FX_WATER_SPLASH, 0); super->child = effect; if (effect != NULL) { - PositionRelative(&gPlayerEntity, effect, gUnk_08122A18[gPlayerEntity.animationState & 6] << 0x10, - gUnk_08122A18[gPlayerEntity.animationState | 1] << 0x10); + PositionRelative(&gPlayerEntity.base, effect, + gUnk_08122A18[gPlayerEntity.base.animationState & 6] << 0x10, + gUnk_08122A18[gPlayerEntity.base.animationState | 1] << 0x10); } CopyPosition(super->child, super); sub_08094980(this, 0x4032, 0x4033); @@ -50,8 +51,9 @@ void LinkEmptyingBottle_Init(LinkEmptyingBottleEntity* this) { effect = CreateFx(super, FX_GREEN_SPLASH2, 0); super->child = effect; if (effect != NULL) { - PositionRelative(&gPlayerEntity, effect, gUnk_08122A18[gPlayerEntity.animationState & 6] << 0x10, - gUnk_08122A18[gPlayerEntity.animationState | 1] << 0x10); + PositionRelative(&gPlayerEntity.base, effect, + gUnk_08122A18[gPlayerEntity.base.animationState & 6] << 0x10, + gUnk_08122A18[gPlayerEntity.base.animationState | 1] << 0x10); } if (super->type2 == 0) { CopyPosition(super->child, super); @@ -64,7 +66,7 @@ void LinkEmptyingBottle_Init(LinkEmptyingBottleEntity* this) { } break; case 2: - child = CreateGroundItem(&gPlayerEntity, ITEM_FAIRY, 0); + child = CreateGroundItem(&gPlayerEntity.base, ITEM_FAIRY, 0); super->child = child; if (child != NULL) { child->timer = 1; diff --git a/src/object/linkFire.c b/src/object/linkFire.c index 8d7223f7..1a12c93f 100644 --- a/src/object/linkFire.c +++ b/src/object/linkFire.c @@ -59,22 +59,22 @@ void sub_0808DDE8(LinkFireEntity* this) { gPlayerState.flags &= ~PL_BURNING; DeleteThisEntity(); } - player = &gPlayerEntity; - super->x.HALF.HI = (s8)gUnk_081217B8[gPlayerEntity.animationState >> 1] + player->x.HALF.HI; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI + -6; - super->z = gPlayerEntity.z; - super->collisionLayer = gPlayerEntity.collisionLayer; - super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; - super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; + player = &gPlayerEntity.base; + super->x.HALF.HI = (s8)gUnk_081217B8[gPlayerEntity.base.animationState >> 1] + player->x.HALF.HI; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + -6; + super->z = gPlayerEntity.base.z; + super->collisionLayer = gPlayerEntity.base.collisionLayer; + super->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; + super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; if ((gPlayerState.flags & PL_BURNING) != 0) { GetNextFrame(super); } else { DeleteThisEntity(); } - if (gPlayerEntity.animationState >> 1 == 2) { - sub_0806FEBC(&gPlayerEntity, 3, super); + if (gPlayerEntity.base.animationState >> 1 == 2) { + sub_0806FEBC(&gPlayerEntity.base, 3, super); super->y.HALF.HI -= 5; } else { - sub_0806FEBC(&gPlayerEntity, 0, super); + sub_0806FEBC(&gPlayerEntity.base, 0, super); } } diff --git a/src/object/lockedDoor.c b/src/object/lockedDoor.c index 6395744c..d7f089a2 100644 --- a/src/object/lockedDoor.c +++ b/src/object/lockedDoor.c @@ -283,19 +283,19 @@ u32 sub_08083734(Entity* this, u32 unk0) { // struct? switch (unk0) { case 0: - if (((LockedDoorEntity*)this)->unk_72 + 0xd - gPlayerEntity.y.HALF.HI < 0) + if (((LockedDoorEntity*)this)->unk_72 + 0xd - gPlayerEntity.base.y.HALF.HI < 0) return 1; break; case 1: - if (gPlayerEntity.x.HALF.HI - (((LockedDoorEntity*)this)->unk_70 - 0xb) < 0) + if (gPlayerEntity.base.x.HALF.HI - (((LockedDoorEntity*)this)->unk_70 - 0xb) < 0) return 1; break; case 2: - if (gPlayerEntity.y.HALF.HI - (((LockedDoorEntity*)this)->unk_72 - 0x8) < 0) + if (gPlayerEntity.base.y.HALF.HI - (((LockedDoorEntity*)this)->unk_72 - 0x8) < 0) return 1; break; case 3: - if (((LockedDoorEntity*)this)->unk_70 + 0xa - gPlayerEntity.x.HALF.HI < 0) + if (((LockedDoorEntity*)this)->unk_70 + 0xa - gPlayerEntity.base.x.HALF.HI < 0) return 1; break; } diff --git a/src/object/macroBook.c b/src/object/macroBook.c index 5e289acb..c0cb253e 100644 --- a/src/object/macroBook.c +++ b/src/object/macroBook.c @@ -125,7 +125,7 @@ void MacroBook_Action3(MacroBookEntity* this) { SetAffineInfo(super, this->unk80, this->unk80, 0); } else { sub_0809AA9C(this, super->child, 0); - sub_0809AA9C(this, &gPlayerEntity, 1); + sub_0809AA9C(this, &gPlayerEntity.base, 1); if (gPlayerClones[0] != NULL) { sub_0809AA9C(this, gPlayerClones[0], 1); } @@ -182,7 +182,7 @@ void sub_0809AA00(MacroBookEntity* this) { } else { sub_0809AA9C(this, super->child, 0); } - ent = &gPlayerEntity; + ent = &gPlayerEntity.base; this->playerWithinRect = EntityInRectRadius(super, ent, 0x20, 0x22); if (this->playerWithinRect != 0) { sub_0809AA9C(this, ent, 1); diff --git a/src/object/mask.c b/src/object/mask.c index dc289996..5fd949ef 100644 --- a/src/object/mask.c +++ b/src/object/mask.c @@ -80,21 +80,21 @@ void Mask_Init(MaskEntity* this) { // Probably related to knocking it down void Mask_Action1(MaskEntity* this) { // Check for the first frame of bonking animation - if (gPlayerEntity.action != PLAYER_BOUNCE) { + if (gPlayerEntity.base.action != PLAYER_BOUNCE) { return; } - if (gPlayerEntity.animationState != 0) { + if (gPlayerEntity.base.animationState != 0) { return; } // Check if link is close enough to the mask - if (super->y.HALF.HI + 40 < gPlayerEntity.y.HALF.HI) { + if (super->y.HALF.HI + 40 < gPlayerEntity.base.y.HALF.HI) { return; } - if (super->x.HALF.HI - gPlayerEntity.x.HALF.HI >= super->subtimer || - super->x.HALF.HI - gPlayerEntity.x.HALF.HI <= -super->subtimer) { + if (super->x.HALF.HI - gPlayerEntity.base.x.HALF.HI >= super->subtimer || + super->x.HALF.HI - gPlayerEntity.base.x.HALF.HI <= -super->subtimer) { return; } diff --git a/src/object/mazaalBossObject.c b/src/object/mazaalBossObject.c index 4e05b012..9fc03361 100644 --- a/src/object/mazaalBossObject.c +++ b/src/object/mazaalBossObject.c @@ -8,7 +8,6 @@ #include "entity.h" #include "functions.h" #include "item.h" -#include "new_player.h" #include "object.h" #include "player.h" #include "room.h" @@ -186,7 +185,7 @@ void MazaalBossObject_Action8(MazaalBossObjectEntity* this) { break; case 2: if (--super->timer == 0) { - gRoomControls.camera_target = &gNewPlayerEntity.base; + gRoomControls.camera_target = &gPlayerEntity.base; gPlayerState.controlMode = CONTROL_1; DeleteThisEntity(); } diff --git a/src/object/minecart.c b/src/object/minecart.c index 6f0e0b18..67d52465 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -84,9 +84,9 @@ void Minecart_Action1(MinecartEntity* this) { super->action++; gPlayerState.jump_status = 0x81; gPlayerState.flags |= PL_ENTER_MINECART; - gPlayerEntity.zVelocity = Q_16_16(2.0); - gPlayerEntity.speed = 0x100; - gPlayerEntity.flags &= ~PL_MINISH; + gPlayerEntity.base.zVelocity = Q_16_16(2.0); + gPlayerEntity.base.speed = 0x100; + gPlayerEntity.base.flags &= ~PL_MINISH; ResetActiveItems(); DeleteClones(); SoundReq(SFX_PLY_JUMP); @@ -98,21 +98,21 @@ void Minecart_Action1(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; - if (gPlayerEntity.z.HALF.HI > -0x10) { - if (gPlayerEntity.zVelocity >= 0) { + if (EntityInRectRadius(super, &gPlayerEntity.base, 2, 2) != 0) { + gPlayerEntity.base.x.HALF.HI = super->x.HALF.HI; + gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI; + if (gPlayerEntity.base.z.HALF.HI > -0x10) { + if (gPlayerEntity.base.zVelocity >= 0) { return; } - gPlayerEntity.animationState = super->animationState << 1; + gPlayerEntity.base.animationState = super->animationState << 1; gPlayerState.flags = (gPlayerState.flags ^ PL_ENTER_MINECART) | PL_IN_MINECART; super->action++; super->subtimer = 1; super->flags |= ENT_PERSIST; super->hitType = 0x97; - super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20; - super->flags2 = gPlayerEntity.flags2; + super->collisionFlags = (gPlayerEntity.base.collisionFlags + 1) | 0x20; + super->flags2 = gPlayerEntity.base.flags2; super->hurtType = 0x18; super->damage = 8; sub_0801766C(super); @@ -120,10 +120,10 @@ void Minecart_Action2(MinecartEntity* this) { SoundReq(SFX_137); } } else { - gPlayerEntity.direction = GetFacingDirection(&gPlayerEntity, super); + gPlayerEntity.base.direction = GetFacingDirection(&gPlayerEntity.base, super); } - if (gPlayerEntity.zVelocity < 0) { - gPlayerEntity.spritePriority.b0 = super->spritePriority.b0 - 1; + if (gPlayerEntity.base.zVelocity < 0) { + gPlayerEntity.base.spritePriority.b0 = super->spritePriority.b0 - 1; } } @@ -139,20 +139,20 @@ void Minecart_Action3(MinecartEntity* this) { return; } - if ((gPlayerEntity.frame & 0xf) == 0) { + if ((gPlayerEntity.base.frame & 0xf) == 0) { COLLISION_OFF(super); - CopyPosition(super, &gPlayerEntity); - if ((gPlayerEntity.frame & 0xf0) == 0x10) { + CopyPosition(super, &gPlayerEntity.base); + if ((gPlayerEntity.base.frame & 0xf0) == 0x10) { super->spriteOffsetY = 1; } else { super->spriteOffsetY = 0; } } else { COLLISION_ON(super); - gPlayerEntity.speed = 0; + gPlayerEntity.base.speed = 0; LinearMoveUpdate(super); - CopyPosition(super, &gPlayerEntity); - gPlayerEntity.spritePriority.b0 = super->spritePriority.b0 - 1; + CopyPosition(super, &gPlayerEntity.base); + gPlayerEntity.base.spritePriority.b0 = super->spritePriority.b0 - 1; if (!sub_08091DDC(this)) { if ((gRoomTransition.frameCount & 0xf) == 0) { SoundReq(SFX_138); @@ -181,11 +181,11 @@ void Minecart_Action3(MinecartEntity* this) { sub_08017744(super); gPlayerState.jump_status = 0x41; gPlayerState.flags = (gPlayerState.flags ^ PL_IN_MINECART) | PL_ENTER_MINECART; - gPlayerEntity.zVelocity = Q_16_16(2.0); - gPlayerEntity.speed = 0x200; - gPlayerEntity.animationState = super->animationState << 1; - gPlayerEntity.direction = super->direction; - gPlayerEntity.flags |= PL_MINISH; + gPlayerEntity.base.zVelocity = Q_16_16(2.0); + gPlayerEntity.base.speed = 0x200; + gPlayerEntity.base.animationState = super->animationState << 1; + gPlayerEntity.base.direction = super->direction; + gPlayerEntity.base.flags |= PL_MINISH; sub_08004168(super); InitAnimationForceUpdate(super, super->animationState + 0xc); SoundReq(SFX_PLY_VO4); @@ -201,14 +201,14 @@ void Minecart_Action3(MinecartEntity* this) { case 0x6f: if (uVar3 == GetTileUnderEntity(super)) { Minecart_Action4(this); - gPlayerEntity.animationState = super->animationState << 1; + gPlayerEntity.base.animationState = super->animationState << 1; return; } break; } } - gPlayerEntity.animationState = super->animationState << 1; + gPlayerEntity.base.animationState = super->animationState << 1; if (super->animIndex == super->animationState) { UpdateAnimationSingleFrame(super); } else { @@ -220,7 +220,7 @@ void Minecart_Action3(MinecartEntity* this) { void Minecart_Action4(MinecartEntity* this) { sub_08004168(super); - CopyPosition(super, &gPlayerEntity); + CopyPosition(super, &gPlayerEntity.base); switch (GetTileUnderEntity(super)) { case 0x67: if (super->direction == DirectionWest) { @@ -264,16 +264,16 @@ void Minecart_Action4(MinecartEntity* this) { } super->action = 3; - gPlayerEntity.animationState = super->animationState << 1; + gPlayerEntity.base.animationState = super->animationState << 1; } void Minecart_Action5(MinecartEntity* this) { LinearMoveUpdate(super); - CopyPosition(super, &gPlayerEntity); + CopyPosition(super, &gPlayerEntity.base); if (gRoomControls.reload_flags == 0) { super->action = 3; super->speed = 0x700; - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; } } @@ -293,7 +293,7 @@ void Minecart_Action6(MinecartEntity* this) { SetTile(0x4022, COORD_TO_TILE(super), super->collisionLayer); } else { UpdateAnimationSingleFrame(super); - gPlayerEntity.spritePriority.b0 = super->spritePriority.b0 - 1; + gPlayerEntity.base.spritePriority.b0 = super->spritePriority.b0 - 1; } } @@ -313,7 +313,7 @@ bool32 sub_08091DDC(MinecartEntity* this) { static const s8 gUnk_081223D0[] = { 0, -8, 8, 0, 0, 8, -8, 0 }; if ((sub_080B1AF0(super, gUnk_081223D0[super->animationState * 2], gUnk_081223D0[super->animationState * 2 + 1]) == 0xff) && - (sub_0807BD14(&gPlayerEntity, super->animationState))) { + (sub_0807BD14(&gPlayerEntity.base, super->animationState))) { super->updatePriority = 6; super->action = 5; switch (super->direction) { @@ -324,7 +324,7 @@ bool32 sub_08091DDC(MinecartEntity* this) { super->speed = 0xa0; break; } - gPlayerEntity.direction = super->direction; + gPlayerEntity.base.direction = super->direction; gRoomControls.camera_target = super; return 1; } else { diff --git a/src/object/minecartDoor.c b/src/object/minecartDoor.c index 0ce907e3..6c70abd8 100644 --- a/src/object/minecartDoor.c +++ b/src/object/minecartDoor.c @@ -98,7 +98,7 @@ void MinecartDoor_Action3(MinecartDoorEntity* this) { return; } if ((gPlayerState.flags & PL_IN_MINECART) != 0) { - if (super->type * 2 - (u32)gPlayerEntity.animationState == 0) { + if (super->type * 2 - (u32)gPlayerEntity.base.animationState == 0) { if (sub_08083734(super, super->type) == 0) { return; } @@ -131,15 +131,15 @@ bool32 sub_08096CEC(MinecartDoorEntity* this) { return TRUE; } else { if ((gPlayerState.flags & PL_IN_MINECART) != 0) { - Entity* player = &gPlayerEntity; + Entity* player = &gPlayerEntity.base; if ((((super->type << 1) ^ player->animationState) & 2) == 0) { if ((super->type & 1) != 0) { - if (sub_08096D68(gPlayerEntity.y.HALF.HI, super->y.HALF.HI, gPlayerEntity.x.HALF.HI, + if (sub_08096D68(gPlayerEntity.base.y.HALF.HI, super->y.HALF.HI, gPlayerEntity.base.x.HALF.HI, super->x.HALF.HI)) { return TRUE; } } else { - if (sub_08096D68(gPlayerEntity.x.HALF.HI, super->x.HALF.HI, gPlayerEntity.y.HALF.HI, + if (sub_08096D68(gPlayerEntity.base.x.HALF.HI, super->x.HALF.HI, gPlayerEntity.base.y.HALF.HI, super->y.HALF.HI)) { return TRUE; } @@ -161,22 +161,22 @@ bool32 sub_08096D68(s32 param_1, s32 param_2, s32 param_3, s32 param_4) { bool32 sub_08096D84(MinecartDoorEntity* this) { switch (super->type) { case 0: - if (((super->y.HALF.HI + 10) - (gPlayerEntity.y.HALF.HI)) < 0x65U) { + if (((super->y.HALF.HI + 10) - (gPlayerEntity.base.y.HALF.HI)) < 0x65U) { return TRUE; } break; case 1: - if (((gPlayerEntity.x.HALF.HI) - (super->x.HALF.HI - 10)) < 0x65U) { + if (((gPlayerEntity.base.x.HALF.HI) - (super->x.HALF.HI - 10)) < 0x65U) { return TRUE; } break; case 2: - if (((gPlayerEntity.y.HALF.HI) - (super->y.HALF.HI - 10)) < 0x65U) { + if (((gPlayerEntity.base.y.HALF.HI) - (super->y.HALF.HI - 10)) < 0x65U) { return TRUE; } break; case 3: - if (((super->x.HALF.HI + 10) - (gPlayerEntity.x.HALF.HI)) < 0x65U) { + if (((super->x.HALF.HI + 10) - (gPlayerEntity.base.x.HALF.HI)) < 0x65U) { return TRUE; } break; diff --git a/src/object/minishEmoticon.c b/src/object/minishEmoticon.c index 0904b1cb..147ca51d 100644 --- a/src/object/minishEmoticon.c +++ b/src/object/minishEmoticon.c @@ -37,7 +37,7 @@ void MinishEmoticon_Action1(Entity* this) { if ((gPlayerState.flags & PL_MINISH) == 0) { DeleteThisEntity(); } - playerEnt = &gPlayerEntity; + playerEnt = &gPlayerEntity.base; sub_08079BD8(this); this->spriteOrientation.flipY = 1; this->palette.b.b0 = playerEnt->palette.b.b0; diff --git a/src/object/minishSizedEntrance.c b/src/object/minishSizedEntrance.c index c12192c2..cbe61fc8 100644 --- a/src/object/minishSizedEntrance.c +++ b/src/object/minishSizedEntrance.c @@ -45,8 +45,9 @@ void MinishSizedEntrance_Action1(Entity* this) { DeleteThisEntity(); } } - if ((gPlayerState.flags & PL_MINISH) && EntityInRectRadius(this, &gPlayerEntity, 4, 4) && - (gPlayerEntity.z.HALF.HI == 0) && (((u16)gPlayerState.playerInput.heldInput) & gUnk_0812225C[this->type2])) { + if ((gPlayerState.flags & PL_MINISH) && EntityInRectRadius(this, &gPlayerEntity.base, 4, 4) && + (gPlayerEntity.base.z.HALF.HI == 0) && + (((u16)gPlayerState.playerInput.heldInput) & gUnk_0812225C[this->type2])) { DoExitTransition(GetCurrentRoomProperty(this->timer)); } } diff --git a/src/object/moleMittsParticle.c b/src/object/moleMittsParticle.c index 29e2a971..125a679d 100644 --- a/src/object/moleMittsParticle.c +++ b/src/object/moleMittsParticle.c @@ -26,7 +26,7 @@ void MoleMittsParticle_Init(Entity* this) { u32 palette; this->action = 1; - this->animationState = gPlayerEntity.animationState >> 1; + this->animationState = gPlayerEntity.base.animationState >> 1; this->spriteRendering.b3 = 2; this->spritePriority.b0 = 3; this->spriteOrientation.flipY--; @@ -72,7 +72,7 @@ void MoleMittsParticle_Action1(Entity* this) { DeleteThisEntity(); } if (this->type2 != 0) { - this->spritePriority.b0 = gPlayerEntity.spritePriority.b0 + 1 - this->frame; + this->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 + 1 - this->frame; } } diff --git a/src/object/object1F.c b/src/object/object1F.c index 292ee2cd..1843e02e 100644 --- a/src/object/object1F.c +++ b/src/object/object1F.c @@ -58,7 +58,7 @@ void Object1F_Init(Object1FEntity* this) { temp = gUnk_08120A18[super->subtimer].unk1; super->palette.b.b0 = temp; this->unk6c = gUnk_08120A18[super->subtimer].unk2; - super->collisionLayer = gPlayerEntity.collisionLayer; + super->collisionLayer = gPlayerEntity.base.collisionLayer; super->speed = 0x100; InitializeAnimation(super, gUnk_08120A18[super->subtimer].animationState); } diff --git a/src/object/object37.c b/src/object/object37.c index 1ec12de2..35f32e93 100644 --- a/src/object/object37.c +++ b/src/object/object37.c @@ -46,7 +46,7 @@ void Object37_Action1(Object37Entity* this) { if ((gSave.kinstones.fusionUnmarked[0] != 0) && (this->unk70 != *this->unk78)) { item = CreateGroundItem(super, ITEM_RUPEE100, 0); if (item != 0) { - item->direction = gPlayerEntity.animationState << 2; + item->direction = gPlayerEntity.base.animationState << 2; item->speed = 0x80; item->zVelocity = Q_16_16(2.0); } diff --git a/src/object/object70.c b/src/object/object70.c index 082289c8..f9017446 100644 --- a/src/object/object70.c +++ b/src/object/object70.c @@ -24,9 +24,9 @@ void Object70_Init(Entity* this) { this->frameIndex = this->type + 0xb; if (this->type != 0) { sub_08004168(this); - gPlayerEntity.spriteOrientation.flipY = 3; - if ((gPlayerEntity.spritePriority.b0) != 7) { - this->spritePriority.b0 = gPlayerEntity.spritePriority.b0 + 1; + gPlayerEntity.base.spriteOrientation.flipY = 3; + if ((gPlayerEntity.base.spritePriority.b0) != 7) { + this->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 + 1; } else { this->spritePriority.b0 = 7; } @@ -36,23 +36,23 @@ void Object70_Init(Entity* this) { void Object70_Action1(Entity* this) { if (this->type == 0) { - if (gPlayerEntity.z.WORD != 0 || (gPlayerState.dash_state & 0x40) != 0 || + if (gPlayerEntity.base.z.WORD != 0 || (gPlayerState.dash_state & 0x40) != 0 || gPlayerState.floor_type != SURFACE_SWAMP || - (gPlayerEntity.action != PLAYER_NORMAL && gPlayerEntity.action != PLAYER_ROLL && - gPlayerEntity.action != PLAYER_JUMP)) { - if (gPlayerEntity.z.WORD == 0) { - CreateFx(&gPlayerEntity, FX_GREEN_SPLASH, 0); + (gPlayerEntity.base.action != PLAYER_NORMAL && gPlayerEntity.base.action != PLAYER_ROLL && + gPlayerEntity.base.action != PLAYER_JUMP)) { + if (gPlayerEntity.base.z.WORD == 0) { + CreateFx(&gPlayerEntity.base, FX_GREEN_SPLASH, 0); } - gPlayerEntity.spriteOrientation.flipY = 2; + gPlayerEntity.base.spriteOrientation.flipY = 2; DeleteThisEntity(); } - this->x = gPlayerEntity.x; - this->y = gPlayerEntity.y; + this->x = gPlayerEntity.base.x; + this->y = gPlayerEntity.base.y; if (gPlayerState.jump_status == 0) { - gPlayerEntity.spriteOrientation.flipY = 3; - if (gPlayerEntity.spritePriority.b0 != 7) { - this->spritePriority.b0 = gPlayerEntity.spritePriority.b0 + 1; + gPlayerEntity.base.spriteOrientation.flipY = 3; + if (gPlayerEntity.base.spritePriority.b0 != 7) { + this->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 + 1; } else { this->spritePriority.b0 = 7; } @@ -60,11 +60,11 @@ void Object70_Action1(Entity* this) { return; } - if (gPlayerEntity.action != PLAYER_USEENTRANCE) { + if (gPlayerEntity.base.action != PLAYER_USEENTRANCE) { if (this->collisionLayer == 1) { - gPlayerEntity.spriteOrientation.flipY = 2; + gPlayerEntity.base.spriteOrientation.flipY = 2; } else { - gPlayerEntity.spriteOrientation.flipY = 1; + gPlayerEntity.base.spriteOrientation.flipY = 1; } DeleteThisEntity(); } diff --git a/src/object/objectA8.c b/src/object/objectA8.c index f44abf38..4de9ccae 100644 --- a/src/object/objectA8.c +++ b/src/object/objectA8.c @@ -54,7 +54,7 @@ void ObjectA8(ObjectA8Entity* this) { case 0x1e: case 0x1f: super->action = 5; - super->child = &gPlayerEntity; + super->child = &gPlayerEntity.base; CreateItemEntity(super->type, 0, 0); DeleteThisEntity(); } @@ -130,7 +130,7 @@ void ObjectA8_Action2Subaction2(ObjectA8Entity* this) { if (sub_0806F3E4(super)) { super->flags &= ~ENT_COLLIDE; super->action = 5; - super->child = &gPlayerEntity; + super->child = &gPlayerEntity.base; GiveItem(super->type, 0); } } @@ -174,7 +174,7 @@ void ObjectA8_Action4(ObjectA8Entity* this) { } else { CopyPosition(super->child, super); super->z.HALF.HI--; - if (IsColliding(super, &gPlayerEntity)) { + if (IsColliding(super, &gPlayerEntity.base)) { sub_0809FECC(this); GiveItem(super->type, 0); } @@ -238,7 +238,7 @@ bool32 sub_0809FE9C(ObjectA8Entity* this) { } void sub_0809FECC(ObjectA8Entity* this) { - super->child = &gPlayerEntity; + super->child = &gPlayerEntity.base; super->action = 5; super->subAction = 0; } diff --git a/src/object/objectBlockingStairs.c b/src/object/objectBlockingStairs.c index ecb5ceaf..b35f6777 100644 --- a/src/object/objectBlockingStairs.c +++ b/src/object/objectBlockingStairs.c @@ -86,7 +86,7 @@ void ObjectBlockingStairs_Action1(ObjectBlockingStairsEntity* this) { int xDist; Entity* ent; - xDist = (int)gPlayerEntity.x.HALF.HI - super->x.HALF.HI; + xDist = (int)gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI; if (this->objFlags) { if (!CheckFlags(this->objFlags)) { @@ -116,7 +116,7 @@ void ObjectBlockingStairs_Action1(ObjectBlockingStairsEntity* this) { case 0x4030: case 0x4031: super->action = 3; - super->direction = Direction8FromAnimationState(gPlayerEntity.animationState); + super->direction = Direction8FromAnimationState(gPlayerEntity.base.animationState); super->speed = 0x80; super->timer = 64; RequestPriorityDuration(super, 80); @@ -125,7 +125,7 @@ void ObjectBlockingStairs_Action1(ObjectBlockingStairsEntity* this) { return; } - if ((gPlayerEntity.animationState & 2) == 0) { + if ((gPlayerEntity.base.animationState & 2) == 0) { return; } RegisterCarryEntity(super); @@ -159,13 +159,13 @@ void ObjectBlockingStairs_Action2(ObjectBlockingStairsEntity* this) { sub_08093280(this); } else { if (gPlayerState.heldObject == 0x12) { - if ((gPlayerEntity.frame & 2) != 0 && ++super->subtimer > 8) { + if ((gPlayerEntity.base.frame & 2) != 0 && ++super->subtimer > 8) { gPlayerState.queued_action = PLAYER_PULL; gPlayerState.field_0x38 = 0x40; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - super->direction = (gPlayerEntity.animationState ^ 4) << 2; + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + super->direction = (gPlayerEntity.base.animationState ^ 4) << 2; super->timer = 64; EnqueueSFX(SFX_10F); sub_08093248(this); diff --git a/src/object/objectOnPillar.c b/src/object/objectOnPillar.c index a4aa5860..7815dd74 100644 --- a/src/object/objectOnPillar.c +++ b/src/object/objectOnPillar.c @@ -121,17 +121,17 @@ void ObjectOnPillar_SubAction0(ObjectOnPillarEntity* this) { const s8* ptr; if (this->unk_72 == 0) { this->unk_72 = 1; - ptr = &gUnk_08123274[gPlayerEntity.animationState]; - PositionRelative(super, &gPlayerEntity, ptr[0] << 0x10, ptr[1] << 0x10); + ptr = &gUnk_08123274[gPlayerEntity.base.animationState]; + PositionRelative(super, &gPlayerEntity.base, ptr[0] << 0x10, ptr[1] << 0x10); } sub_08097008(this); if (sub_080896B0()) { gPlayerState.queued_action = PLAYER_PULL; gPlayerState.field_0x38 = 0x20; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - super->direction = ((gPlayerEntity.animationState ^ 4) << 2); + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + super->direction = ((gPlayerEntity.base.animationState ^ 4) << 2); sub_08097098(this); } } diff --git a/src/object/objectOnSpinyBeetle.c b/src/object/objectOnSpinyBeetle.c index 064e987c..17597f8f 100644 --- a/src/object/objectOnSpinyBeetle.c +++ b/src/object/objectOnSpinyBeetle.c @@ -138,7 +138,7 @@ void ObjectOnSpinyBeetle_Action2Subaction0(ObjectOnSpinyBeetleEntity* this) { super->flags |= ENT_COLLIDE; super->collisionFlags = 7; super->hitType = 1; - super->flags2 = gPlayerEntity.flags2; + super->flags2 = gPlayerEntity.base.flags2; super->spriteOffsetY = 0; (super->parent)->child = NULL; super->subAction++; diff --git a/src/object/octorokBossObject.c b/src/object/octorokBossObject.c index 51143b43..ddab7bce 100644 --- a/src/object/octorokBossObject.c +++ b/src/object/octorokBossObject.c @@ -317,7 +317,7 @@ void OctorokBossObject_Action1(OctorokBossObjectEntity* this) { case 9: PausePlayer(); if ((this->unk_78.WORD_U)-- == 0) { - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; DeleteThisEntity(); } break; diff --git a/src/object/paper.c b/src/object/paper.c index f45f0c6d..62e49ff7 100644 --- a/src/object/paper.c +++ b/src/object/paper.c @@ -66,7 +66,8 @@ void Paper_Type2(Entity* this) { void Paper_Action1(Entity* this) { if (this->type == 0) { - if ((gPlayerEntity.y.HALF.HI < this->y.HALF.HI) || (gPlayerEntity.y.HALF.HI) > this->y.HALF.HI + 0x18) { + if ((gPlayerEntity.base.y.HALF.HI < this->y.HALF.HI) || + (gPlayerEntity.base.y.HALF.HI) > this->y.HALF.HI + 0x18) { this->spriteRendering.b3 = 1; } else { this->spriteRendering.b3 = 2; diff --git a/src/object/playerClone.c b/src/object/playerClone.c index b4281f78..36c4dd8b 100644 --- a/src/object/playerClone.c +++ b/src/object/playerClone.c @@ -72,8 +72,8 @@ void PlayerClone_Action1(PlayerCloneEntity* this) { super->updatePriority = 6; super->hitbox = (Hitbox*)&PlayerCloneHitbox; super->subtimer = (super->type + 1) * 15; - this->unk78 = super->x.HALF.HI - gPlayerEntity.x.HALF.HI; - this->unk7a = super->y.HALF.HI - gPlayerEntity.y.HALF.HI; + this->unk78 = super->x.HALF.HI - gPlayerEntity.base.x.HALF.HI; + this->unk7a = super->y.HALF.HI - gPlayerEntity.base.y.HALF.HI; if ((this->unk78 != 0) && (this->unk7a != 0)) { ((PlayerCloneEntity*)gPlayerClones[super->type])->unk70 = 1; } @@ -106,13 +106,13 @@ void PlayerClone_Action2(PlayerCloneEntity* this) { if (gPlayerState.chargeState.action == 5 && gPlayerClones[super->type] != NULL && gPlayerState.framestate != PL_STATE_TALKEZLO && super->health != 0) { - if (gPlayerEntity.iframes >= 1) { + if (gPlayerEntity.base.iframes >= 1) { gPlayerState.chargeState.action = 1; } else { GetTileUnderEntity(super); sub_08084B1C(this); - super->x.HALF.HI = gPlayerEntity.x.HALF.HI + this->unk78; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI + this->unk7a; + super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + this->unk78; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + this->unk7a; sub_08084CAC(this); sub_080085B0(super); if ((super->collisions & (COL_NORTH_FULL | COL_SOUTH_FULL | COL_EAST_FULL | COL_WEST_FULL)) != @@ -151,22 +151,22 @@ void PlayerClone_Action2(PlayerCloneEntity* this) { } void sub_08084B1C(PlayerCloneEntity* this) { - super->flags = gPlayerEntity.flags; - super->spriteVramOffset = gPlayerEntity.spriteVramOffset; - super->frameIndex = gPlayerEntity.frameIndex; - super->frameSpriteSettings = gPlayerEntity.frameSpriteSettings; - super->spriteIndex = gPlayerEntity.spriteIndex; - super->direction = gPlayerEntity.direction; - super->animationState = gPlayerEntity.animationState; - super->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX; - super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; - super->spritePriority.b0 = gPlayerEntity.spritePriority.b0; - super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; - super->collisionLayer = gPlayerEntity.collisionLayer; - super->flags2 = gPlayerEntity.flags2; - super->hitType = gPlayerEntity.hitType; - super->collisionFlags = gPlayerEntity.collisionFlags; - super->hurtType = gPlayerEntity.hurtType; + super->flags = gPlayerEntity.base.flags; + super->spriteVramOffset = gPlayerEntity.base.spriteVramOffset; + super->frameIndex = gPlayerEntity.base.frameIndex; + super->frameSpriteSettings = gPlayerEntity.base.frameSpriteSettings; + super->spriteIndex = gPlayerEntity.base.spriteIndex; + super->direction = gPlayerEntity.base.direction; + super->animationState = gPlayerEntity.base.animationState; + super->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX; + super->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; + super->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0; + super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; + super->collisionLayer = gPlayerEntity.base.collisionLayer; + super->flags2 = gPlayerEntity.base.flags2; + super->hitType = gPlayerEntity.base.hitType; + super->collisionFlags = gPlayerEntity.base.collisionFlags; + super->hurtType = gPlayerEntity.base.hurtType; CopyPosition(super, super->child); if (gPlayerState.attack_status != 0) { super->child->damage = gPlayerState.item->damage; diff --git a/src/object/pot.c b/src/object/pot.c index 4f8cd84e..388b35cc 100644 --- a/src/object/pot.c +++ b/src/object/pot.c @@ -156,7 +156,7 @@ void sub_08082510(PotEntity* this) { super->hitbox = (Hitbox*)&gUnk_080FD340; super->collisionFlags = 7; super->hitType = 1; - super->flags2 = gPlayerEntity.flags2; + super->flags2 = gPlayerEntity.base.flags2; super->spriteOffsetY = 0; SetTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer); super->subAction++; @@ -181,7 +181,7 @@ void sub_0808259C(PotEntity* this) { CreateFx(super, FX_LAVA_SPLASH, 0); break; default: - sub_08082850(this, &gPlayerEntity); + sub_08082850(this, &gPlayerEntity.base); return; } diff --git a/src/object/pressurePlate.c b/src/object/pressurePlate.c index 407ba680..be8a7ff6 100644 --- a/src/object/pressurePlate.c +++ b/src/object/pressurePlate.c @@ -120,7 +120,7 @@ static u32 get_standing_count(PressurePlateEntity* this) { num = 0; if (IsCollidingPlayer(super) != 0) { - gPlayerEntity.spriteOffsetY = sSpriteOffsets[this->dir]; + gPlayerEntity.base.spriteOffsetY = sSpriteOffsets[this->dir]; num = 1; } if ((gPlayerState.flags & PL_CLONING) != 0) { diff --git a/src/object/pullableLever.c b/src/object/pullableLever.c index 0aaaa1ac..991f7c2e 100644 --- a/src/object/pullableLever.c +++ b/src/object/pullableLever.c @@ -105,7 +105,7 @@ void PullableLever_HandleAction2(PullableLeverEntity* this) { void PullableLever_HandleSubAction0(PullableLeverEntity* this) { u16 y; u16 x; - Entity* player = &gPlayerEntity; + Entity* player = &gPlayerEntity.base; if (this->unk_75 == 0) { if (-player->animationState + super->type2 * 2 == 0) { @@ -122,7 +122,7 @@ void PullableLever_HandleSubAction0(PullableLeverEntity* this) { if (player->animationState >> 1 == super->type2) { if (gPlayerState.framestate == PL_STATE_PULL) { if (gPlayerState.heldObject & 2) { - if (gPlayerEntity.frame & 2) { + if (gPlayerEntity.base.frame & 2) { sub_0809153C(this); if (this->unk_75 == 1) { this->unk_75 = 2; @@ -191,15 +191,15 @@ void sub_0809153C(PullableLeverEntity* this) { s16 diff; s32 radius; - Entity* player = &gPlayerEntity; + Entity* player = &gPlayerEntity.base; dir = gUnk_081222C0[super->type2]; if (this->necessaryPullLength <= this->pullLength) { return; } prevX = player->x.HALF.HI; prevY = player->y.HALF.HI; - sub_080044AE(&gPlayerEntity, super->speed, dir); - if ((prevX == gPlayerEntity.x.HALF.HI) && (prevY == gPlayerEntity.y.HALF.HI)) { + sub_080044AE(&gPlayerEntity.base, super->speed, dir); + if ((prevX == gPlayerEntity.base.x.HALF.HI) && (prevY == gPlayerEntity.base.y.HALF.HI)) { return; } @@ -208,13 +208,13 @@ void sub_0809153C(PullableLeverEntity* this) { diff = player->y.HALF.HI - prevY; break; case 1: - diff = prevX - gPlayerEntity.x.HALF.HI; + diff = prevX - gPlayerEntity.base.x.HALF.HI; break; case 2: - diff = prevY - gPlayerEntity.y.HALF.HI; + diff = prevY - gPlayerEntity.base.y.HALF.HI; break; case 3: - diff = gPlayerEntity.x.HALF.HI - prevX; + diff = gPlayerEntity.base.x.HALF.HI - prevX; break; } radius = (diff << 0x18); diff --git a/src/object/pullableMushroom.c b/src/object/pullableMushroom.c index 8c786450..63fcdfbb 100644 --- a/src/object/pullableMushroom.c +++ b/src/object/pullableMushroom.c @@ -269,7 +269,7 @@ void sub_0808AEB0(PullableMushroomEntity* this) { if ((gPlayerState.playerInput.heldInput & gUnk_081211E4[super->animationState]) != 0) { GetNextFrame(super); if (uVar1 < 0x40) { - sub_080044AE(&gPlayerEntity, 0x40, super->direction); + sub_080044AE(&gPlayerEntity.base, 0x40, super->direction); if (this->unk_7c-- == 0) { this->unk_7c = 4; SoundReq(SFX_12F); @@ -278,29 +278,30 @@ void sub_0808AEB0(PullableMushroomEntity* this) { super->subtimer = 1; } else { - if (((super->subtimer != 0) && (gPlayerEntity.action == PLAYER_NORMAL)) && (gPlayerState.swim_state == 0)) { + if (((super->subtimer != 0) && (gPlayerEntity.base.action == PLAYER_NORMAL)) && + (gPlayerState.swim_state == 0)) { gPlayerState.queued_action = PLAYER_08072C9C; gPlayerState.field_0x38 = uVar1; gPlayerState.field_0x39 = super->direction ^ 0x10; - gPlayerState.field_0x3a = sub_0808B1F0(this, &gPlayerEntity); + gPlayerState.field_0x3a = sub_0808B1F0(this, &gPlayerEntity.base); super->subAction++; } } } else { super->timer = 1; this->unk_7c = 1; - super->animationState = AnimationStateFlip90(gPlayerEntity.animationState >> 1); + super->animationState = AnimationStateFlip90(gPlayerEntity.base.animationState >> 1); super->direction = (super->animationState << 3); super->flags &= ~0x80; - super->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX; + super->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX; InitializeAnimation(super, super->animationState + 5); if (sub_0808B21C(this, 0)) { sub_0808B168((PullableMushroomEntity*)super->child, 0); } if ((super->animationState & 1) != 0) { - gPlayerEntity.y.HALF.HI = super->y.HALF.HI; + gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI; } else { - gPlayerEntity.x.HALF.HI = super->x.HALF.HI; + gPlayerEntity.base.x.HALF.HI = super->x.HALF.HI; } } } @@ -332,9 +333,9 @@ void PullableMushroom_Action3(PullableMushroomEntity* this) { void sub_0808B05C(PullableMushroomEntity* this) { if (super->type == 0) { - super->animationState = AnimationStateFlip90(gPlayerEntity.animationState >> 1); + super->animationState = AnimationStateFlip90(gPlayerEntity.base.animationState >> 1); super->direction = super->animationState << 3; - super->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX; + super->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX; super->flags &= ~0x80; InitializeAnimation(super, super->animationState + 5); if (sub_0808B21C(this, 1)) { @@ -355,16 +356,16 @@ void sub_0808B0BC(PullableMushroomEntity* this) { GetNextFrame(super); break; case 1: - ptr = &gUnk_08126EE4[gPlayerEntity.animationState & 0xe]; - ent.base.x.HALF.HI = ptr[0] + gPlayerEntity.x.HALF.HI; - ent.base.y.HALF.HI = ptr[1] + gPlayerEntity.y.HALF.HI; + ptr = &gUnk_08126EE4[gPlayerEntity.base.animationState & 0xe]; + ent.base.x.HALF.HI = ptr[0] + gPlayerEntity.base.x.HALF.HI; + ent.base.y.HALF.HI = ptr[1] + gPlayerEntity.base.y.HALF.HI; if (sub_0800419C(&ent.base, super, 7, 7)) { - if ((gPlayerEntity.action != PLAYER_NORMAL) || (gPlayerState.swim_state != 0)) + if ((gPlayerEntity.base.action != PLAYER_NORMAL) || (gPlayerState.swim_state != 0)) return; gPlayerState.queued_action = PLAYER_08072C9C; gPlayerState.field_0x38 = uVar2; gPlayerState.field_0x39 = super->direction ^ 0x10; - gPlayerState.field_0x3a = sub_0808B1F0((PullableMushroomEntity*)super->parent, &gPlayerEntity); + gPlayerState.field_0x3a = sub_0808B1F0((PullableMushroomEntity*)super->parent, &gPlayerEntity.base); } else { super->speed = 0x40; if (uVar2 < 0x40) { @@ -397,13 +398,13 @@ void sub_0808B168(PullableMushroomEntity* this, u32 param_2) { pEVar6 = pEVar5; } else { if ((super->animationState & 1) != 0) { - pEVar6 = &gPlayerEntity; + pEVar6 = &gPlayerEntity.base; pEVar5 = super->parent; pcVar5 = (gUnk_081211FC + super->animationState * 2); pcVar3 = (gUnk_081211F4 + 1 + AnimationStateFlip90(super->animationState) * 2); } else { pEVar6 = super->parent; - pEVar5 = &gPlayerEntity; + pEVar5 = &gPlayerEntity.base; pcVar5 = (gUnk_081211F4 + AnimationStateFlip90(super->animationState) * 2); pcVar3 = (gUnk_081211FC + 1 + super->animationState * 2); } diff --git a/src/object/pushableFurniture.c b/src/object/pushableFurniture.c index da7d04d5..327dfbe6 100644 --- a/src/object/pushableFurniture.c +++ b/src/object/pushableFurniture.c @@ -4,27 +4,9 @@ * * @brief Pushable Furniture object */ -#include "functions.h" -#include "object.h" +#include "object/pushableFurniture.h" -typedef struct { - /*0x00*/ Entity base; - /*0x68*/ u8 unk_68[0x8]; - /*0x70*/ u16 unk_70; - /*0x72*/ u16 unk_72; - /*0x74*/ u16 unk_74; - /*0x76*/ u16 unk_76; - /*0x78*/ u8 unk_78[0x2]; - /*0x7a*/ u16 unk_7a; - /*0x7c*/ u16 unk_7c; - /*0x7e*/ u16 unk_7e; - /*0x80*/ u8 unk_80; - /*0x81*/ u8 unk_81; - /*0x82*/ u8 unk_82; - /*0x83*/ u8 unk_83; - /*0x84*/ u8 unk_84[0x2]; - /*0x86*/ u16 unk_86; -} PushableFurnitureEntity; +#include "functions.h" extern const s16 gUnk_080B4488[]; @@ -339,9 +321,10 @@ void sub_0808FDE8(PushableFurnitureEntity* this) { bool32 sub_0808FECC(PushableFurnitureEntity* this) { bool32 result = TRUE; - if (!((gPlayerState.flags & PL_MINISH) == 0 && (gPlayerEntity.action == PLAYER_BOUNCE) && - (gPlayerEntity.animationState == 0) && (gPlayerEntity.y.HALF.HI - super->y.HALF.HI < 0x14) && - (super->x.HALF.HI + 0xc > gPlayerEntity.x.HALF.HI) && (super->x.HALF.HI - 12 < gPlayerEntity.x.HALF.HI))) { + if (!((gPlayerState.flags & PL_MINISH) == 0 && (gPlayerEntity.base.action == PLAYER_BOUNCE) && + (gPlayerEntity.base.animationState == 0) && (gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI < 0x14) && + (super->x.HALF.HI + 0xc > gPlayerEntity.base.x.HALF.HI) && + (super->x.HALF.HI - 12 < gPlayerEntity.base.x.HALF.HI))) { result = FALSE; } return result; diff --git a/src/object/pushableGrave.c b/src/object/pushableGrave.c index 7c7a3cbe..eb343f09 100644 --- a/src/object/pushableGrave.c +++ b/src/object/pushableGrave.c @@ -118,7 +118,7 @@ void PushableGrave_Action3(PushableGraveEntity* this) { EnqueueSFX(SFX_SECRET); sub_080977F4(this); if (super->type == 0) { - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; gRoomControls.scrollSpeed = 4; } } diff --git a/src/object/pushableLever.c b/src/object/pushableLever.c index 2a16033b..bfdc1a46 100644 --- a/src/object/pushableLever.c +++ b/src/object/pushableLever.c @@ -57,9 +57,9 @@ void PushableLever_Idle(PushableLeverEntity* this) { gPlayerState.pushedObject = 0x90; gPlayerState.queued_action = PLAYER_PUSH; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - gPlayerEntity.direction = gPlayerEntity.animationState << 2; + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + gPlayerEntity.base.direction = gPlayerEntity.base.animationState << 2; } } } diff --git a/src/object/pushableStatue.c b/src/object/pushableStatue.c index f9910b31..386cb3e0 100644 --- a/src/object/pushableStatue.c +++ b/src/object/pushableStatue.c @@ -104,9 +104,9 @@ void PushableStatue_SubAction0(PushableStatueEntity* this) { if (this->unk_83 == 0) { this->unk_83 = 1; - index = gPlayerEntity.animationState; + index = gPlayerEntity.base.animationState; ptr = &gUnk_08120CB4[index]; - PositionRelative(super, &gPlayerEntity, *(ptr) << 0x10, *(ptr + 1) << 0x10); + PositionRelative(super, &gPlayerEntity.base, *(ptr) << 0x10, *(ptr + 1) << 0x10); } tileType = GetTileType(this->unk_84, super->collisionLayer); if (tileType != 0x400b) { @@ -131,9 +131,9 @@ void PushableStatue_SubAction0(PushableStatueEntity* this) { gPlayerState.queued_action = PLAYER_PULL; gPlayerState.field_0x38 = 0x20; gPlayerState.flags |= PL_BUSY; - gPlayerEntity.x.HALF.LO = 0; - gPlayerEntity.y.HALF.LO = 0; - super->direction = (gPlayerEntity.animationState ^ 4) << 2; + gPlayerEntity.base.x.HALF.LO = 0; + gPlayerEntity.base.y.HALF.LO = 0; + super->direction = (gPlayerEntity.base.animationState ^ 4) << 2; sub_08089538(this); } } @@ -258,13 +258,13 @@ bool32 sub_080896B0(void) { u32 tmp2; u32 val; - if (((gPlayerState.heldObject & 0x1f) == 0x12) && ((gPlayerEntity.frame & 1) != 0)) { - ptr = &gUnk_080B4468[gPlayerEntity.animationState & 6]; - uVar1 = gUnk_080B4488[gPlayerEntity.animationState >> 1]; - uVar4 = COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]) - uVar1; - val = sub_080B1AE0(uVar4, gPlayerEntity.collisionLayer); + if (((gPlayerState.heldObject & 0x1f) == 0x12) && ((gPlayerEntity.base.frame & 1) != 0)) { + ptr = &gUnk_080B4468[gPlayerEntity.base.animationState & 6]; + uVar1 = gUnk_080B4488[gPlayerEntity.base.animationState >> 1]; + uVar4 = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], -ptr[1]) - uVar1; + val = sub_080B1AE0(uVar4, gPlayerEntity.base.collisionLayer); if ((val - 0x26 > 1) && (val != 0x29)) { - layer = GetLayerByIndex(gPlayerEntity.collisionLayer); + layer = GetLayerByIndex(gPlayerEntity.base.collisionLayer); iVar2 = (uVar4 * 0x10000) >> 0x10; tmp1 = layer->collisionData[iVar2]; tmp2 = layer->collisionData[(iVar2 - uVar1)]; diff --git a/src/object/shrinkingHieroglyphs.c b/src/object/shrinkingHieroglyphs.c index 1fcaa801..c490b834 100644 --- a/src/object/shrinkingHieroglyphs.c +++ b/src/object/shrinkingHieroglyphs.c @@ -69,7 +69,7 @@ void ShrinkingHieroglyphs_Action1(ShrinkingHieroglyphsEntity* this) { if (super->type == 0) { UpdateAnimationSingleFrame(super); if (super->type2 != 0) { - gPlayerEntity.subtimer = 0; + gPlayerEntity.base.subtimer = 0; super->action++; InitAnimationForceUpdate(super, 1); SoundReq(SFX_178); @@ -109,7 +109,7 @@ void ShrinkingHieroglyphs_Action2(ShrinkingHieroglyphsEntity* this) { } void sub_08098130(ShrinkingHieroglyphsEntity* this) { - CopyPosition(&gPlayerEntity, super); + CopyPosition(&gPlayerEntity.base, super); super->direction = this->objDir.HALF.HI; super->speed = this->unk7a; LinearMoveUpdate(super); diff --git a/src/object/specialFx.c b/src/object/specialFx.c index 5de442a3..bfe1a5e5 100644 --- a/src/object/specialFx.c +++ b/src/object/specialFx.c @@ -307,8 +307,8 @@ void sub_080847E0(SpecialFxObject* this) { if (gRoomControls.reload_flags == 1) { DeleteThisEntity(); } - PositionRelative(&gPlayerEntity, super, 0, -0x30000); + PositionRelative(&gPlayerEntity.base, super, 0, -0x30000); super->z.HALF.HI = -3; - SortEntityAbove(&gPlayerEntity, super); + SortEntityAbove(&gPlayerEntity.base, super); sub_080845DC(this); } diff --git a/src/object/steam.c b/src/object/steam.c index 451afadb..7cef37d1 100644 --- a/src/object/steam.c +++ b/src/object/steam.c @@ -43,7 +43,7 @@ void Steam(Entity* _this) { type = super->type; ptr = &this->unk_0x68; if (type != 0) { - if (gPlayerEntity.x.HALF.HI - gRoomControls.origin_x > (0xf8 << 1)) { + if (gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x > (0xf8 << 1)) { if (*ptr < 0x40) { (*ptr)++; } diff --git a/src/object/swordParticle.c b/src/object/swordParticle.c index 9721e52f..f86879a0 100644 --- a/src/object/swordParticle.c +++ b/src/object/swordParticle.c @@ -33,8 +33,8 @@ void SwordParticle_Init(SwordParticleEntity* this) { super->action = 1; super->flags |= ENT_PERSIST; super->spritePriority.b0 = 0; - super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; - super->animationState = gPlayerEntity.animationState >> 1; + super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; + super->animationState = gPlayerEntity.base.animationState >> 1; super->direction = (((super->animationState + 1) & 3) << 3); super->subtimer = 6; super->speed = 0x140; @@ -121,12 +121,12 @@ void SwordParticle_Action1(SwordParticleEntity* this) { } } - super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; + super->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; ptr2 = &ptr[super->animationState * 2]; - super->x.HALF.HI = ptr2[0] + gPlayerEntity.x.HALF.HI; - super->y.HALF.HI = ptr[super->animationState * 2 + 1] + gPlayerEntity.y.HALF.HI; - super->z.HALF.HI = gPlayerEntity.z.HALF.HI; - super->collisionLayer = gPlayerEntity.collisionLayer; + super->x.HALF.HI = ptr2[0] + gPlayerEntity.base.x.HALF.HI; + super->y.HALF.HI = ptr[super->animationState * 2 + 1] + gPlayerEntity.base.y.HALF.HI; + super->z.HALF.HI = gPlayerEntity.base.z.HALF.HI; + super->collisionLayer = gPlayerEntity.base.collisionLayer; switch (super->animationState) { default: super->y.HALF.HI -= this->unk_6c; @@ -168,7 +168,7 @@ void SwordParticle_Action2(SwordParticleEntity* this) { sub_08079BD8(super); super->action++; super->spriteSettings.draw = 1; - super->animationState = gPlayerEntity.animationState; + super->animationState = gPlayerEntity.base.animationState; super->spriteVramOffset = 0; super->palette.b.b0 = 4; super->spriteIndex = 0xaf; diff --git a/src/object/thunderbolt.c b/src/object/thunderbolt.c index b1984fa2..543c08c4 100644 --- a/src/object/thunderbolt.c +++ b/src/object/thunderbolt.c @@ -100,7 +100,7 @@ void sub_08093EF0(ThunderboltEntity* this) { if ((super->frame & ANIM_DONE) == 0) { return; } - if (super->parent == &gPlayerEntity) { + if (super->parent == &gPlayerEntity.base) { SoundReq(SFX_PLY_VO6); sub_08079D84(); } diff --git a/src/object/trapdoor.c b/src/object/trapdoor.c index 34622516..809643dd 100644 --- a/src/object/trapdoor.c +++ b/src/object/trapdoor.c @@ -63,7 +63,7 @@ void Trapdoor_Action2(Entity* this) { } void Trapdoor_Action3(Entity* this) { - if (EntityInRectRadius(this, &gPlayerEntity, 0xc, 0xc)) { + if (EntityInRectRadius(this, &gPlayerEntity.base, 0xc, 0xc)) { if (this->subAction == 0) { sub_08099ECC(this); RequestPriorityDuration(this, 30); @@ -79,7 +79,7 @@ void Trapdoor_Action4(Entity* this) { void sub_08099ECC(Entity* this) { this->subAction = 1; - CopyPosition(this, &gPlayerEntity); + CopyPosition(this, &gPlayerEntity.base); gPlayerState.queued_action = PLAYER_FALL; gPlayerState.field_0x38 = 0; gPlayerState.flags |= PL_PIT_IS_EXIT; diff --git a/src/object/treeHidingPortal.c b/src/object/treeHidingPortal.c index fbd447e4..dc1792c3 100644 --- a/src/object/treeHidingPortal.c +++ b/src/object/treeHidingPortal.c @@ -52,7 +52,7 @@ void TreeHidingPortal_Init(TreeHidingPortalEntity* this) { void TreeHidingPortal_Action1(TreeHidingPortalEntity* this) { - if (sub_0800419C(super, &gPlayerEntity, 0x30, 0x30)) { + if (sub_0800419C(super, &gPlayerEntity.base, 0x30, 0x30)) { if (CheckGlobalFlag(EZERO_1ST)) { if (((gRoomTransition.frameCount & 3) == 0)) { CreateSparkle(super); @@ -112,11 +112,11 @@ static u32 sub_0809E9A0(void) { u32 rv; const s16* ptr; - if (gPlayerEntity.action != PLAYER_BOUNCE) { + if (gPlayerEntity.base.action != PLAYER_BOUNCE) { rv = 0; } else { - ptr = &gUnk_080B4468[gPlayerEntity.animationState & 6]; - rv = sub_080B1AE0(COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -ptr[1]), 1); + ptr = &gUnk_080B4468[gPlayerEntity.base.animationState & 6]; + rv = sub_080B1AE0(COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], -ptr[1]), 1); } return rv; diff --git a/src/object/vaati1Portal.c b/src/object/vaati1Portal.c index e757f9c1..78924aff 100644 --- a/src/object/vaati1Portal.c +++ b/src/object/vaati1Portal.c @@ -49,7 +49,7 @@ void Vaati1Portal_Action2(Entity* this) { if (CheckRoomFlag(1)) { sub_080A0190(this); RequestPriorityDuration(this, 30); - if (EntityInRectRadius(this, &gPlayerEntity, 0x10, 0x10)) { + if (EntityInRectRadius(this, &gPlayerEntity.base, 0x10, 0x10)) { CreateHoleManager(0x37); } } @@ -57,7 +57,7 @@ void Vaati1Portal_Action2(Entity* this) { void sub_080A0190(Entity* this) { this->subAction = 1; - CopyPosition(this, &gPlayerEntity); + CopyPosition(this, &gPlayerEntity.base); gPlayerState.queued_action = PLAYER_FALL; gPlayerState.field_0x38 = 0; gPlayerState.flags |= PL_PIT_IS_EXIT; diff --git a/src/object/vaati3PlayerObject.c b/src/object/vaati3PlayerObject.c index 0cec61c1..6420cbab 100644 --- a/src/object/vaati3PlayerObject.c +++ b/src/object/vaati3PlayerObject.c @@ -16,5 +16,5 @@ void Vaati3PlayerObject(Entity* this) { #ifndef EU gRoomControls.camera_target = this; #endif - PositionRelative(&gPlayerEntity, this, 0, Q_16_16(-40.0)); + PositionRelative(&gPlayerEntity.base, this, 0, Q_16_16(-40.0)); } diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index 166b17e2..67798907 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -69,9 +69,9 @@ void WarpPoint_Init(WarpPointEntity* this) { return; super->action = 4; super->subtimer = 96; - gPlayerEntity.x.HALF.HI = super->x.HALF.HI; - gPlayerEntity.y.HALF.HI = super->y.HALF.HI; - gPlayerEntity.animationState = 4; + gPlayerEntity.base.x.HALF.HI = super->x.HALF.HI; + gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI; + gPlayerEntity.base.animationState = 4; EnqueueSFX(SFX_112); RequestPriorityDuration(super, super->subtimer + 16); } @@ -104,10 +104,10 @@ void WarpPoint_Action3(WarpPointEntity* this) { super->action = 5; super->subtimer = 96; PutAwayItems(); - gPlayerEntity.x.HALF.HI = super->x.HALF.HI; - gPlayerEntity.y.HALF.HI = super->y.HALF.HI; - gPlayerEntity.animationState = 4; - gPlayerEntity.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.x.HALF.HI = super->x.HALF.HI; + gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI; + gPlayerEntity.base.animationState = 4; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; RequestPriorityDuration(super, super->subtimer + 16); SoundReq(SFX_113); } else { @@ -120,8 +120,8 @@ void WarpPoint_Action4(WarpPointEntity* this) { if (!--super->subtimer) { super->action = 3; super->timer = 1; - gPlayerEntity.animationState = 4; - gPlayerEntity.direction = DirectionSouth; + gPlayerEntity.base.animationState = 4; + gPlayerEntity.base.direction = DirectionSouth; return; } tmp = 0; @@ -141,7 +141,7 @@ void WarpPoint_Action4(WarpPointEntity* this) { break; case 0: if (!(super->subtimer & 7)) { - if (gPlayerEntity.animationState == 4) { + if (gPlayerEntity.base.animationState == 4) { if (super->subtimer > 0x18) { tmp = 1; } @@ -152,8 +152,8 @@ void WarpPoint_Action4(WarpPointEntity* this) { break; } if (tmp) { - gPlayerEntity.animationState += 2; - gPlayerEntity.animationState &= 6; + gPlayerEntity.base.animationState += 2; + gPlayerEntity.base.animationState &= 6; } } @@ -192,13 +192,13 @@ void WarpPoint_Action5(WarpPointEntity* this) { tmp = 1; } } else { - gPlayerEntity.spriteSettings.draw = 0; + gPlayerEntity.base.spriteSettings.draw = 0; } break; } if (tmp) { - gPlayerEntity.animationState += 2; - gPlayerEntity.animationState &= 6; + gPlayerEntity.base.animationState += 2; + gPlayerEntity.base.animationState &= 6; } } @@ -208,10 +208,10 @@ void sub_0808B73C(WarpPointEntity* this) { super->palette.b.b0 = super->parent->palette.b.b0; InitializeAnimation(super, 1); } - if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28)) { + if (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x28)) { super->spriteSettings.draw = 1; } else { - if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x2e)) { + if (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x2e)) { super->spriteSettings.draw ^= 1; } else { super->spriteSettings.draw = 0; @@ -221,9 +221,10 @@ void sub_0808B73C(WarpPointEntity* this) { } u32 sub_0808B7C8(WarpPointEntity* this) { - if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.framestate != PL_STATE_DIE && gPlayerEntity.health != 0 && - PlayerCanBeMoved() && EntityInRectRadius(super, &gPlayerEntity, 5, 5) && gPlayerEntity.z.HALF.HI == 0) { - if (super->timer == 0 && gPlayerEntity.action == PLAYER_08072C9C) { + if (!(gPlayerState.flags & PL_MINISH) && gPlayerState.framestate != PL_STATE_DIE && + gPlayerEntity.base.health != 0 && PlayerCanBeMoved() && EntityInRectRadius(super, &gPlayerEntity.base, 5, 5) && + gPlayerEntity.base.z.HALF.HI == 0) { + if (super->timer == 0 && gPlayerEntity.base.action == PLAYER_08072C9C) { ResetPlayerAnimationAndAction(); } return 1; diff --git a/src/object/well.c b/src/object/well.c index 83c3f324..c48948b1 100644 --- a/src/object/well.c +++ b/src/object/well.c @@ -40,8 +40,8 @@ void Well_Action1(WellEntity* this) { u32 tileIndex = GetTileType(this->unk_80, 1); if (tileIndex != 0x407D) { PausePlayer(); - gPlayerEntity.x.WORD = super->x.WORD; - gPlayerEntity.y.HALF.HI = super->y.HALF.HI + 4; + gPlayerEntity.base.x.WORD = super->x.WORD; + gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI + 4; DeleteThisEntity(); } } diff --git a/src/object/whirlwind.c b/src/object/whirlwind.c index fff6ed52..979a62a3 100644 --- a/src/object/whirlwind.c +++ b/src/object/whirlwind.c @@ -59,24 +59,25 @@ void Whirlwind_Action1(Entity* this) { if (this->spriteSettings.draw != 0) { GetNextFrame(this); if ((((((gPlayerState.flags & PL_MINISH) == 0)) && (gPlayerState.field_0x3c == 0)) && - ((gPlayerEntity.action == PLAYER_JUMP || ((gPlayerEntity.flags & ENT_COLLIDE) != 0)))) && - ((gPlayerEntity.action != PLAYER_BOUNCE && (sub_0800419C(this, &gPlayerEntity, 0xc, 0xc) != 0)))) { - if (((gPlayerState.flags & PL_PARACHUTE) == 0) && (gPlayerEntity.action != PLAYER_JUMP)) { - if ((this->type2 != 1) && (-0x10 < gPlayerEntity.z.HALF.HI)) { + ((gPlayerEntity.base.action == PLAYER_JUMP || ((gPlayerEntity.base.flags & ENT_COLLIDE) != 0)))) && + ((gPlayerEntity.base.action != PLAYER_BOUNCE && + (sub_0800419C(this, &gPlayerEntity.base, 0xc, 0xc) != 0)))) { + if (((gPlayerState.flags & PL_PARACHUTE) == 0) && (gPlayerEntity.base.action != PLAYER_JUMP)) { + if ((this->type2 != 1) && (-0x10 < gPlayerEntity.base.z.HALF.HI)) { return; } - } else if (gPlayerEntity.z.HALF.HI == 0) { + } else if (gPlayerEntity.base.z.HALF.HI == 0) { return; } - CopyPosition(this, &gPlayerEntity); + CopyPosition(this, &gPlayerEntity.base); sub_08004542(this); - sub_08004542(&gPlayerEntity); - gPlayerEntity.collisionLayer = 1; - gPlayerEntity.flags |= ENT_COLLIDE; + sub_08004542(&gPlayerEntity.base); + gPlayerEntity.base.collisionLayer = 1; + gPlayerEntity.base.flags |= ENT_COLLIDE; gPlayerState.queued_action = PLAYER_PARACHUTE; gPlayerState.field_0x38 = this->type2; gPlayerState.field_0x39 = 0xff; - this->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1; + this->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 - 1; this->action++; PutAwayItems(); SoundReq(SFX_153); @@ -87,7 +88,7 @@ void Whirlwind_Action1(Entity* this) { void Whirlwind_Action2(Entity* this) { UpdateAnimationSingleFrame(this); - if (sub_0800419C(this, &gPlayerEntity, 0xc, 0xc) == 0) { + if (sub_0800419C(this, &gPlayerEntity.base, 0xc, 0xc) == 0) { ResetCollisionLayer(this); this->spriteOrientation.flipY = 1; this->spriteRendering.b3 = 1; diff --git a/src/object/windTribeTeleporter.c b/src/object/windTribeTeleporter.c index 8de92ec3..5a238478 100644 --- a/src/object/windTribeTeleporter.c +++ b/src/object/windTribeTeleporter.c @@ -40,8 +40,8 @@ void WindTribeTeleporter_Init(WindTribeTeleporterEntity* this) { super->hitbox = (Hitbox*)&gHitbox_22; SetEntityPriority(super, 6); if (PlayerCollidingTeleporter(this)) { - gPlayerEntity.x.HALF.HI = super->x.HALF.HI; - gPlayerEntity.y.HALF.HI = super->y.HALF.HI; + gPlayerEntity.base.x.HALF.HI = super->x.HALF.HI; + gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI; SetPlayerControl(CONTROL_DISABLED); PausePlayer(); SetPlayerEventPriority(); @@ -55,8 +55,8 @@ void WindTribeTeleporter_Init(WindTribeTeleporterEntity* this) { void WindTribeTeleporter_Action1(WindTribeTeleporterEntity* this) { if (PlayerCollidingTeleporter(this)) { if (this->unk_68 == 0) { - gPlayerEntity.x.HALF.HI = super->x.HALF.HI; - gPlayerEntity.y.HALF.HI = super->y.HALF.HI; + gPlayerEntity.base.x.HALF.HI = super->x.HALF.HI; + gPlayerEntity.base.y.HALF.HI = super->y.HALF.HI; SetPlayerControl(CONTROL_DISABLED); PausePlayer(); SetPlayerEventPriority(); @@ -88,7 +88,7 @@ void WindTribeTeleporter_Action2(WindTribeTeleporterEntity* this) { SoundReq(SFX_113); } else { if ((gRoomTransition.frameCount & 7) == 0) { - gPlayerEntity.animationState = (gPlayerEntity.animationState + 2) & 6; + gPlayerEntity.base.animationState = (gPlayerEntity.base.animationState + 2) & 6; } } break; @@ -98,7 +98,7 @@ void WindTribeTeleporter_Action2(WindTribeTeleporterEntity* this) { super->timer = 30; } else { if ((gRoomTransition.frameCount & 3) == 0) { - gPlayerEntity.animationState = (gPlayerEntity.animationState + 2) & 6; + gPlayerEntity.base.animationState = (gPlayerEntity.base.animationState + 2) & 6; } } break; @@ -117,7 +117,7 @@ void WindTribeTeleporter_Action2(WindTribeTeleporterEntity* this) { #endif } else { if ((gRoomTransition.frameCount & 1) == 0) { - gPlayerEntity.animationState = (gPlayerEntity.animationState + 2) & 6; + gPlayerEntity.base.animationState = (gPlayerEntity.base.animationState + 2) & 6; } } break; @@ -134,7 +134,7 @@ void WindTribeTeleporter_Action3(WindTribeTeleporterEntity* this) { case 1: if (--super->timer != 0) { if ((gRoomTransition.frameCount & 1) == 0) { - gPlayerEntity.animationState = (gPlayerEntity.animationState + 2) & 6; + gPlayerEntity.base.animationState = (gPlayerEntity.base.animationState + 2) & 6; } } else { super->subAction++; @@ -147,7 +147,7 @@ void WindTribeTeleporter_Action3(WindTribeTeleporterEntity* this) { super->timer = 30; } else { if ((gRoomTransition.frameCount & 3) == 0) { - gPlayerEntity.animationState = (gPlayerEntity.animationState + 2) & 6; + gPlayerEntity.base.animationState = (gPlayerEntity.base.animationState + 2) & 6; } } break; @@ -156,16 +156,16 @@ void WindTribeTeleporter_Action3(WindTribeTeleporterEntity* this) { super->subAction++; } else { if ((gRoomTransition.frameCount & 7) == 0) { - gPlayerEntity.animationState = (gPlayerEntity.animationState + 2) & 6; + gPlayerEntity.base.animationState = (gPlayerEntity.base.animationState + 2) & 6; } } break; default: - if (gPlayerEntity.animationState != 4) { + if (gPlayerEntity.base.animationState != 4) { if ((gRoomTransition.frameCount & 7U) != 0) { return; } - gPlayerEntity.animationState = (gPlayerEntity.animationState + 2) & 6; + gPlayerEntity.base.animationState = (gPlayerEntity.base.animationState + 2) & 6; } else { super->action = 1; super->subAction = 0; @@ -177,7 +177,7 @@ void WindTribeTeleporter_Action3(WindTribeTeleporterEntity* this) { } static bool32 PlayerCollidingTeleporter(WindTribeTeleporterEntity* this) { - if (gPlayerEntity.z.HALF.HI != 0) { + if (gPlayerEntity.base.z.HALF.HI != 0) { return FALSE; } else { return IsCollidingPlayer(super); diff --git a/src/objectUtils.c b/src/objectUtils.c index c424e5a3..21ec9568 100644 --- a/src/objectUtils.c +++ b/src/objectUtils.c @@ -40,14 +40,14 @@ Entity* CreateLinkAnimation(Entity* parent, u32 type, u32 type2) { e->parent = parent; AppendEntityToList(e, 6); PrependEntityToList(e, 6); - CopyPosition(&gPlayerEntity, e); + CopyPosition(&gPlayerEntity.base, e); gPriorityHandler.event_priority = 6; gPauseMenuOptions.disabled = 1; // store player state - this->storeFlags = gPlayerEntity.flags; - this->storeDrawFlags = gPlayerEntity.spriteSettings.draw; - this->storeIFrames = gPlayerEntity.iframes; + this->storeFlags = gPlayerEntity.base.flags; + this->storeDrawFlags = gPlayerEntity.base.spriteSettings.draw; + this->storeIFrames = gPlayerEntity.base.iframes; this->storeField7 = gPlayerState.field_0x7; this->storeKeepFacing = gPlayerState.keepFacing; this->storeFieldA = gPlayerState.field_0xa; @@ -57,8 +57,8 @@ Entity* CreateLinkAnimation(Entity* parent, u32 type, u32 type2) { this->store8A = gPlayerState.field_0x8a; // redundant, this is done by the LinkAnimation object - gPlayerEntity.flags &= ~ENT_COLLIDE; - gPlayerEntity.spriteSettings.draw = 0; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.spriteSettings.draw = 0; } return e; } @@ -290,7 +290,7 @@ void SyncPlayerToPlatform(Entity* this, bool32 param_2) { newValue1 = this->y.HALF_U.HI; diff = ((oldValue1 - newValue1)); if ((diff != 0) && (param_2 != 0)) { - sub_080044AE(&gPlayerEntity, diff << 8, 0); + sub_080044AE(&gPlayerEntity.base, diff << 8, 0); } break; case 1: @@ -299,7 +299,7 @@ void SyncPlayerToPlatform(Entity* this, bool32 param_2) { newValue2 = this->x.HALF_U.HI; diff = (newValue2 - oldValue2); if ((diff != 0) && (param_2 != 0)) { - sub_080044AE(&gPlayerEntity, diff << 8, 8); + sub_080044AE(&gPlayerEntity.base, diff << 8, 8); } break; case 2: @@ -308,7 +308,7 @@ void SyncPlayerToPlatform(Entity* this, bool32 param_2) { newValue3 = this->y.HALF_U.HI; diff = (newValue3 - oldValue2); if ((diff != 0) && (param_2 != 0)) { - sub_080044AE(&gPlayerEntity, diff << 8, 0x10); + sub_080044AE(&gPlayerEntity.base, diff << 8, 0x10); } break; case 3: @@ -317,7 +317,7 @@ void SyncPlayerToPlatform(Entity* this, bool32 param_2) { newValue4 = this->x.HALF_U.HI; diff = ((oldValue1 - newValue4)); if ((diff != 0) && (param_2 != 0)) { - sub_080044AE(&gPlayerEntity, diff << 8, 0x18); + sub_080044AE(&gPlayerEntity.base, diff << 8, 0x18); } break; } diff --git a/src/physics.c b/src/physics.c index 497dc793..206b33c3 100644 --- a/src/physics.c +++ b/src/physics.c @@ -1,14 +1,13 @@ -#include "asm.h" #include "area.h" -#include "player.h" -#include "new_player.h" -#include "physics.h" -#include "common.h" -#include "sound.h" -#include "room.h" -#include "functions.h" +#include "asm.h" #include "color.h" +#include "common.h" +#include "functions.h" +#include "physics.h" +#include "player.h" #include "playeritem.h" +#include "room.h" +#include "sound.h" const u8 gSpriteSortAboveTable[]; const u8 gSpriteSortBelowTable[]; @@ -36,17 +35,17 @@ void sub_0806F38C(void) { u32 sub_0806F39C(Entity* ent) { s32 dist; - if (gNewPlayerEntity.base.animationState & 2) { - dist = ent->x.HALF.HI - gPlayerEntity.x.HALF.HI; + if (gPlayerEntity.base.animationState & 2) { + dist = ent->x.HALF.HI - gPlayerEntity.base.x.HALF.HI; } else { - dist = ent->y.HALF.HI - gPlayerEntity.y.HALF.HI; + dist = ent->y.HALF.HI - gPlayerEntity.base.y.HALF.HI; } if (dist < 0) { dist = -dist; } if (dist > 64) { - sub_080027EA(&gPlayerEntity, ent->speed, ent->direction); + sub_080027EA(&gPlayerEntity.base, ent->speed, ent->direction); return 1; } return 0; @@ -71,16 +70,16 @@ bool32 sub_0806F3E4(Entity* ent) { } if (ent->knockbackSpeed > 0x500) ent->knockbackSpeed = 0x500; - p = &gUnk_08126EE4[gPlayerEntity.animationState & 0xE]; - tmp_ent.base.x.HALF.HI = p[0] + gPlayerEntity.x.HALF.HI; - tmp_ent.base.y.HALF.HI = p[1] + gPlayerEntity.y.HALF.HI; + p = &gUnk_08126EE4[gPlayerEntity.base.animationState & 0xE]; + tmp_ent.base.x.HALF.HI = p[0] + gPlayerEntity.base.x.HALF.HI; + tmp_ent.base.y.HALF.HI = p[1] + gPlayerEntity.base.y.HALF.HI; LinearMoveDirection(ent, ent->knockbackSpeed, GetFacingDirection(ent, &tmp_ent.base)); if (sub_0800419C(&tmp_ent.base, ent, 4, 4)) { u32 state = ent->gustJarFlags & 0xF; if (state == 2) { Entity* item; ent->subAction = 3; - gNewPlayerEntity.unk_70 = ent; + gPlayerEntity.unk_70 = ent; gPlayerState.field_0x1c = 7; item = CreatePlayerItem(PLAYER_ITEM_GUST_BIG, 0, 0, 0); if (item != NULL) { @@ -393,8 +392,8 @@ void UnloadHitbox(Entity* ent) { } bool32 CheckPlayerProximity(u32 x, u32 y, u32 distX, u32 DistY) { - s32 diffx = gPlayerEntity.x.HALF.HI - x; - s32 diffy = gPlayerEntity.y.HALF.HI - y; + s32 diffx = gPlayerEntity.base.x.HALF.HI - x; + s32 diffy = gPlayerEntity.base.y.HALF.HI - y; u32 rv = 0; if (diffx < distX && diffy < DistY) { rv = 1; @@ -482,7 +481,7 @@ bool32 sub_0806FD54(Entity* this) { if ((gPlayerState.flags & PL_USE_LANTERN) == 0) { rv = 0; } else { - rv = EntityWithinDistance(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 9, 0x48); + rv = EntityWithinDistance(this, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI - 9, 0x48); } return rv; diff --git a/src/player.c b/src/player.c index 26d12f8a..6c89f022 100644 --- a/src/player.c +++ b/src/player.c @@ -4,7 +4,6 @@ * * @brief Player entity */ -#define ENT_DEPRECATED #include "area.h" #include "asm.h" #include "collision.h" @@ -20,6 +19,7 @@ #include "object.h" #include "player.h" #include "playeritem.h" +#include "playerItem/playerItemBottle.h" #include "save.h" #include "screen.h" #include "screenTransitions.h" @@ -48,224 +48,226 @@ #define FALL_DAMAGE 2 -static EntityAction PlayerInit; -static EntityAction PlayerNormal; -// static EntityAction PlayerInit; -static EntityAction PlayerFall; -static EntityAction PlayerJump; -static EntityAction PlayerPush; -static EntityAction PlayerBounce; -static EntityAction sub_08070E9C; -static EntityAction PlayerItemGet; -static EntityAction PlayerMinish; -static EntityAction PlayerMinishDie; -static EntityAction sub_08071DB8; -static EntityAction PlayerEmptyBottle; -static EntityAction PlayerFrozen; -static EntityAction sub_0807204C; -static EntityAction PlayerRoomExit; -static EntityAction PlayerPull; -static EntityAction PlayerLava; -EntityAction PlayerWarp; // why is this defined in playerUtils.c? We may never know : ( -static EntityAction sub_08072454; -static EntityAction PlayerDrown; -static EntityAction PlayerUsePortal; -static EntityAction PlayerTalkEzlo; -static EntityAction PlayerRoomTransition; -static EntityAction PlayerRoll; -static EntityAction PlayerWaitForScroll; -static EntityAction PlayerInHole; -static EntityAction sub_08072C9C; -static EntityAction PlayerSleep; -static EntityAction PlayerClimb; -static EntityAction PlayerUseEntrance; -static EntityAction PlayerParachute; +typedef void(PlayerEntityAction)(PlayerEntity*); + +static PlayerEntityAction PlayerInit; +static PlayerEntityAction PlayerNormal; +// static PlayerEntityAction PlayerInit; +static PlayerEntityAction PlayerFall; +static PlayerEntityAction PlayerJump; +static PlayerEntityAction PlayerPush; +static PlayerEntityAction PlayerBounce; +static PlayerEntityAction sub_08070E9C; +static PlayerEntityAction PlayerItemGet; +static PlayerEntityAction PlayerMinish; +static PlayerEntityAction PlayerMinishDie; +static PlayerEntityAction sub_08071DB8; +static PlayerEntityAction PlayerEmptyBottle; +static PlayerEntityAction PlayerFrozen; +static PlayerEntityAction sub_0807204C; +static PlayerEntityAction PlayerRoomExit; +static PlayerEntityAction PlayerPull; +static PlayerEntityAction PlayerLava; +PlayerEntityAction PlayerWarp; // why is super defined in playerUtils.c? We may never know : ( +static PlayerEntityAction sub_08072454; +static PlayerEntityAction PlayerDrown; +static PlayerEntityAction PlayerUsePortal; +static PlayerEntityAction PlayerTalkEzlo; +static PlayerEntityAction PlayerRoomTransition; +static PlayerEntityAction PlayerRoll; +static PlayerEntityAction PlayerWaitForScroll; +static PlayerEntityAction PlayerInHole; +static PlayerEntityAction sub_08072C9C; +static PlayerEntityAction PlayerSleep; +static PlayerEntityAction PlayerClimb; +static PlayerEntityAction PlayerUseEntrance; +static PlayerEntityAction PlayerParachute; // PLAYER_FALL -static EntityAction PlayerFallInit; -static EntityAction PlayerFallUpdate; +static PlayerEntityAction PlayerFallInit; +static PlayerEntityAction PlayerFallUpdate; // PLAYER_BOUNCE -static EntityAction PlayerBounceInit; -static EntityAction PlayerBounceUpdate; -static EntityAction sub_08070E7C; +static PlayerEntityAction PlayerBounceInit; +static PlayerEntityAction PlayerBounceUpdate; +static PlayerEntityAction sub_08070E7C; // PLAYER_08070E9C -static EntityAction sub_08070EDC; -static EntityAction sub_08070f24; +static PlayerEntityAction sub_08070EDC; +static PlayerEntityAction sub_08070f24; // PLAYER_ITEMGET -static EntityAction PlayerItemGetInit; -static EntityAction PlayerItemGetUpdate; -static EntityAction sub_08071038; +static PlayerEntityAction PlayerItemGetInit; +static PlayerEntityAction PlayerItemGetUpdate; +static PlayerEntityAction sub_08071038; // PLAYER_JUMP -static EntityAction PlayerJumpInit; -static EntityAction sub_08071130; -static EntityAction sub_08071208; +static PlayerEntityAction PlayerJumpInit; +static PlayerEntityAction sub_08071130; +static PlayerEntityAction sub_08071208; // PLAYER_DROWN -static EntityAction PlayerDrownInit; -static EntityAction sub_080712F0; +static PlayerEntityAction PlayerDrownInit; +static PlayerEntityAction sub_080712F0; // PLAYER_USEPORTAL -static EntityAction PortalJumpOnUpdate; -static EntityAction PortalStandUpdate; -static EntityAction PortalActivateInit; -static EntityAction PortalActivateUpdate; -static EntityAction PortalShrinkInit; -static EntityAction PortalShrinkUpdate; -static EntityAction PortalEnterUpdate; -static EntityAction PortalUnknownUpdate; +static PlayerEntityAction PortalJumpOnUpdate; +static PlayerEntityAction PortalStandUpdate; +static PlayerEntityAction PortalActivateInit; +static PlayerEntityAction PortalActivateUpdate; +static PlayerEntityAction PortalShrinkInit; +static PlayerEntityAction PortalShrinkUpdate; +static PlayerEntityAction PortalEnterUpdate; +static PlayerEntityAction PortalUnknownUpdate; // PLAYER_TALKEZLO -static EntityAction PlayerTalkEzlo_Init; -static EntityAction PlayerTalkEzlo_CreateMessage; -static EntityAction PlayerTalkEzlo_MessageIdle; -static EntityAction PlayerTalkEzlo_Leave; +static PlayerEntityAction PlayerTalkEzlo_Init; +static PlayerEntityAction PlayerTalkEzlo_CreateMessage; +static PlayerEntityAction PlayerTalkEzlo_MessageIdle; +static PlayerEntityAction PlayerTalkEzlo_Leave; // PLAYER_PUSH -static EntityAction PlayerPushInit; -static EntityAction PlayerPushUpdate; -static EntityAction PlayerPushEnd; +static PlayerEntityAction PlayerPushInit; +static PlayerEntityAction PlayerPushUpdate; +static PlayerEntityAction PlayerPushEnd; // PLAYER_MINISHDIE -static EntityAction PlayerMinishDieInit; -static EntityAction sub_08071CAC; -static EntityAction sub_08071D04; -static EntityAction sub_08071D80; +static PlayerEntityAction PlayerMinishDieInit; +static PlayerEntityAction sub_08071CAC; +static PlayerEntityAction sub_08071D04; +static PlayerEntityAction sub_08071D80; // PLAYER_08071DB8 -static EntityAction sub_08071DD0; -static EntityAction sub_08071E04; -static EntityAction sub_08071E74; +static PlayerEntityAction sub_08071DD0; +static PlayerEntityAction sub_08071E04; +static PlayerEntityAction sub_08071E74; // PLAYER_EMPTYBOTTLE -static EntityAction PlayerEmptyBottleInit; -static EntityAction PlayerEmptyBottleUpdate; +static PlayerEntityAction PlayerEmptyBottleInit; +static PlayerEntityAction PlayerEmptyBottleUpdate; // PLAYER_FROZEN -static EntityAction PlayerFrozenInit; -static EntityAction PlayerFrozenUpdate; +static PlayerEntityAction PlayerFrozenInit; +static PlayerEntityAction PlayerFrozenUpdate; // PLAYER_0807204C -static EntityAction sub_08072064; -static EntityAction sub_08072098; +static PlayerEntityAction sub_08072064; +static PlayerEntityAction sub_08072098; // PLAYER_ROOM_EXIT -static EntityAction sub_08072100; -static EntityAction sub_08072168; +static PlayerEntityAction sub_08072100; +static PlayerEntityAction sub_08072168; // PLAYER_PULL -static EntityAction sub_08072214; -static EntityAction sub_08072260; +static PlayerEntityAction sub_08072214; +static PlayerEntityAction sub_08072260; // PLAYER_LAVA -static EntityAction PlayerLavaInit; -static EntityAction sub_08072354; -static EntityAction sub_080723D0; -static EntityAction sub_0807240C; +static PlayerEntityAction PlayerLavaInit; +static PlayerEntityAction sub_08072354; +static PlayerEntityAction sub_080723D0; +static PlayerEntityAction sub_0807240C; // PLAYER_08072454 -static EntityAction sub_0807246C; -static EntityAction sub_08072490; +static PlayerEntityAction sub_0807246C; +static PlayerEntityAction sub_08072490; // PLAYER_ROOMTRANSITION -static EntityAction sub_080724DC; -static EntityAction sub_0807258C; +static PlayerEntityAction sub_080724DC; +static PlayerEntityAction sub_0807258C; // PLAYER_ROLL -static EntityAction PlayerRollInit; -static EntityAction PlayerRollUpdate; +static PlayerEntityAction PlayerRollInit; +static PlayerEntityAction PlayerRollUpdate; // PLAYER_INHOLE -static EntityAction PlayerInHoleInit; -static EntityAction PlayerInHoleUpdate; -static EntityAction sub_08072ACC; -static EntityAction sub_08072B5C; -static EntityAction sub_08072C48; +static PlayerEntityAction PlayerInHoleInit; +static PlayerEntityAction PlayerInHoleUpdate; +static PlayerEntityAction sub_08072ACC; +static PlayerEntityAction sub_08072B5C; +static PlayerEntityAction sub_08072C48; // PLAYER_08072C9C -static EntityAction sub_08072CC0; -static EntityAction sub_08072CFC; -static EntityAction sub_08072D54; -static EntityAction sub_08072F14; +static PlayerEntityAction sub_08072CC0; +static PlayerEntityAction sub_08072CFC; +static PlayerEntityAction sub_08072D54; +static PlayerEntityAction sub_08072F14; // PLAYER_CLIMB -static EntityAction sub_08072F94; -static EntityAction sub_08073094; +static PlayerEntityAction sub_08072F94; +static PlayerEntityAction sub_08073094; // PLAYER_USEENTRANCE -static EntityAction PlayerUseStairs; -static EntityAction sub_080732D0; -static EntityAction sub_0807332C; -static EntityAction sub_080733BC; +static PlayerEntityAction PlayerUseStairs; +static PlayerEntityAction sub_080732D0; +static PlayerEntityAction sub_0807332C; +static PlayerEntityAction sub_080733BC; // PLAYER_PARACHUTE -static EntityAction sub_08073468; -static EntityAction sub_080734D4; -static EntityAction sub_08073504; -static EntityAction sub_08073584; -static EntityAction sub_0807379C; -static EntityAction sub_080737BC; -static EntityAction sub_0807380C; -static EntityAction sub_08073884; +static PlayerEntityAction sub_08073468; +static PlayerEntityAction sub_080734D4; +static PlayerEntityAction sub_08073504; +static PlayerEntityAction sub_08073584; +static PlayerEntityAction sub_0807379C; +static PlayerEntityAction sub_080737BC; +static PlayerEntityAction sub_0807380C; +static PlayerEntityAction sub_08073884; // DoJump... ? -static EntityAction sub_08073924; -static EntityAction sub_08073968; -static EntityAction sub_080739EC; -static EntityAction sub_08073A94; -static EntityAction sub_08073B8C; -static EntityAction sub_08073C30; +static PlayerEntityAction sub_08073924; +static PlayerEntityAction sub_08073968; +static PlayerEntityAction sub_080739EC; +static PlayerEntityAction sub_08073A94; +static PlayerEntityAction sub_08073B8C; +static PlayerEntityAction sub_08073C30; // PLAYER_MINISH -static EntityAction sub_08073C80; -static EntityAction sub_08073D20; -static EntityAction sub_08073F04; -static EntityAction sub_08073F4C; -static EntityAction sub_08073FD0; -static EntityAction sub_08074018; -static EntityAction sub_08074060; -static EntityAction sub_080740D8; +static PlayerEntityAction sub_08073C80; +static PlayerEntityAction sub_08073D20; +static PlayerEntityAction sub_08073F04; +static PlayerEntityAction sub_08073F4C; +static PlayerEntityAction sub_08073FD0; +static PlayerEntityAction sub_08074018; +static PlayerEntityAction sub_08074060; +static PlayerEntityAction sub_080740D8; // PLAYER_SLEEP -static EntityAction sub_08074C68; -static EntityAction sub_08074CF8; -static EntityAction sub_08074F00; -static EntityAction sub_080750F4; +static PlayerEntityAction sub_08074C68; +static PlayerEntityAction sub_08074CF8; +static PlayerEntityAction sub_08074F00; +static PlayerEntityAction sub_080750F4; // ... -static EntityAction sub_08074F1C; -static EntityAction sub_08074F2C; -static EntityAction sub_08074F44; -static EntityAction sub_08074F8C; -static EntityAction sub_08074FEC; -static EntityAction sub_0807501C; -static EntityAction sub_0807508C; +static PlayerEntityAction sub_08074F1C; +static PlayerEntityAction sub_08074F2C; +static PlayerEntityAction sub_08074F44; +static PlayerEntityAction sub_08074F8C; +static PlayerEntityAction sub_08074FEC; +static PlayerEntityAction sub_0807501C; +static PlayerEntityAction sub_0807508C; // ... -static EntityAction sub_08075110; -static EntityAction sub_0807513C; -static EntityAction sub_0807518C; -static EntityAction sub_080751B4; +static PlayerEntityAction sub_08075110; +static PlayerEntityAction sub_0807513C; +static PlayerEntityAction sub_0807518C; +static PlayerEntityAction sub_080751B4; // static helper functions -static void DoJump(Entity*); -static void sub_080717F8(Entity*); +static void DoJump(PlayerEntity*); +static void sub_080717F8(PlayerEntity*); static void reset_priority(void); -static void break_out(Entity* this); -static void sub_08073AD4(Entity* this); -static void sub_08073B60(Entity*); -static void sub_08074244(Entity*, u32, u32); -static void hide(Entity*); -static void conveyer_push(Entity*); -static void sub_08074D34(Entity*, ScriptExecutionContext*); -static void sub_08070BEC(Entity*, u32); -static void sub_08074808(Entity* this); +static void break_out(PlayerEntity* this); +static void sub_08073AD4(PlayerEntity* this); +static void sub_08073B60(PlayerEntity*); +static void sub_08074244(PlayerEntity*, u32, u32); +static void hide(PlayerEntity*); +static void conveyer_push(PlayerEntity*); +static void sub_08074D34(PlayerEntity*, ScriptExecutionContext*); +static void sub_08070BEC(PlayerEntity*, u32); +static void sub_08074808(PlayerEntity* this); // exports -void SurfaceAction_Water(Entity*); -void SurfaceAction_Ladder(Entity*); -void SurfaceAction_AutoLadder(Entity*); +void SurfaceAction_Water(PlayerEntity*); +void SurfaceAction_Ladder(PlayerEntity*); +void SurfaceAction_AutoLadder(PlayerEntity*); extern void InitPauseMenu(void); extern u32 UpdatePlayerCollision(void); @@ -298,8 +300,8 @@ bool32 CheckInitPauseMenu(void) { return TRUE; } -void DoPlayerAction(Entity* this) { - static void (*const sPlayerActions[])(Entity*) = { +void DoPlayerAction(PlayerEntity* this) { + static void (*const sPlayerActions[])(PlayerEntity*) = { [PLAYER_INIT] = PlayerInit, [PLAYER_NORMAL] = PlayerNormal, [PLAYER_DUMMY] = PlayerInit, @@ -333,32 +335,32 @@ void DoPlayerAction(Entity* this) { [PLAYER_USEENTRANCE] = PlayerUseEntrance, [PLAYER_PARACHUTE] = PlayerParachute, }; - sPlayerActions[this->action](this); + sPlayerActions[super->action](this); } -static void PlayerInit(Entity* this) { +static void PlayerInit(PlayerEntity* this) { u32 equipSlot; gPlayerState.prevAnim = 0xff; - gPlayerState.startPosX = gPlayerEntity.x.HALF.HI; - gPlayerState.startPosY = gPlayerEntity.y.HALF.HI; - COLLISION_ON(this); - this->spritePriority.b0 = 0xc; - this->spritePriority.b1 = 1; - this->spriteSettings.shadow = 1; - this->carryFlags = 0x20; - this->flags2 = 8; - this->hitType = 0x79; - this->hitbox = (Hitbox*)&gPlayerHitbox; - this->spriteIndex = 1; + gPlayerState.startPosX = gPlayerEntity.base.x.HALF.HI; + gPlayerState.startPosY = gPlayerEntity.base.y.HALF.HI; + COLLISION_ON(super); + super->spritePriority.b0 = 0xc; + super->spritePriority.b1 = 1; + super->spriteSettings.shadow = 1; + super->carryFlags = 0x20; + super->flags2 = 8; + super->hitType = 0x79; + super->hitbox = (Hitbox*)&gPlayerHitbox; + super->spriteIndex = 1; #ifndef EU gPlayerState.animation = ANIM_DEFAULT; #endif - sub_0806FDA0(this); - LoadSwapGFX(this, 1, 2); - InitAnimationForceUpdate(this, 2); - if (this->collisionLayer == 0) { - ResolveCollisionLayer(this); + sub_0806FDA0(super); + LoadSwapGFX(super, 1, 2); + InitAnimationForceUpdate(super, 2); + if (super->collisionLayer == 0) { + ResolveCollisionLayer(super); } equipSlot = IsItemEquipped(ITEM_LANTERN_ON); @@ -376,7 +378,7 @@ static void PlayerInit(Entity* this) { gPlayerState.swim_state = 1; ResolvePlayerAnimation(); gPlayerState.framestate = PL_STATE_SWIM; - PlayerSwimming(this); + PlayerSwimming(super); ent = FindEntity(OBJECT, SPECIAL_FX, 0x6, FX_WATER_SPLASH, 0x0); if (ent != NULL) { DeleteEntity(ent); @@ -385,48 +387,48 @@ static void PlayerInit(Entity* this) { } } -static void PlayerNormal(Entity* this) { +static void PlayerNormal(PlayerEntity* this) { gPlayerState.framestate = PL_STATE_IDLE; if (gPlayerState.flags & PL_CAPTURED) { - this->spritePriority.b1 = 0; - this->knockbackDuration = 0; - this->speed = WALK_SPEED; + super->spritePriority.b1 = 0; + super->knockbackDuration = 0; + super->speed = WALK_SPEED; gPlayerState.pushedObject = 0x80; gPlayerState.framestate = PL_STATE_TRAPPED; - if ((this->animationState >> 1) + 92 == this->animIndex && (u16)this->spriteIndex == 2) - UpdateAnimationSingleFrame(&gPlayerEntity); + if ((super->animationState >> 1) + 92 == super->animIndex && (u16)super->spriteIndex == 2) + UpdateAnimationSingleFrame(&gPlayerEntity.base); else gPlayerState.animation = ANIM_TRAPPED; - sub_0806F948(&gPlayerEntity); + sub_0806F948(&gPlayerEntity.base); ResetActiveItems(); - UpdateActiveItems(this); + UpdateActiveItems(super); return; } if (gPlayerState.flags & PL_IN_MINECART) { - this->hurtType = 30; + super->hurtType = 30; gPlayerState.framestate = PL_STATE_C; - sub_08070BEC(this, this->speed == 0 ? 1 : 0); + sub_08070BEC(this, super->speed == 0 ? 1 : 0); return; } if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) { ResolvePlayerAnimation(); return; } - sub_080085B0(this); - this->hurtType = 0; + sub_080085B0(super); + super->hurtType = 0; if (CheckQueuedAction()) { return; } if (!gPlayerState.swim_state && (gPlayerState.jump_status & 0xC0) == 0) { if (gPlayerState.shield_status || gPlayerState.bow_state) { - this->speed = SHIELDING_SPEED; + super->speed = SHIELDING_SPEED; } else { if (gPlayerState.sword_state) { - this->speed = SWORD_CHARGE_SPEED; + super->speed = SWORD_CHARGE_SPEED; } else if (gPlayerState.field_0x1c) { - this->speed = GUST_JAR_SPEED; + super->speed = GUST_JAR_SPEED; } else { - this->speed = WALK_SPEED; + super->speed = WALK_SPEED; } } } @@ -440,7 +442,7 @@ static void PlayerNormal(Entity* this) { } if (gPlayerState.jump_status == 0 && (gPlayerState.flags & PL_BURNING) == 0) { - if (this->knockbackDuration == 0 && sub_080782C0()) { + if (super->knockbackDuration == 0 && sub_080782C0()) { if (gRoomVars.shopItemType == 0) { ResetActiveItems(); } @@ -461,7 +463,7 @@ static void PlayerNormal(Entity* this) { gPlayerState.pushedObject = 0x80; break; case 15: - this->flags &= ~ENT_COLLIDE; + super->flags &= ~ENT_COLLIDE; sub_080797EC(); return; case 4: @@ -477,18 +479,18 @@ static void PlayerNormal(Entity* this) { } } - this->collisionFlags = 0; - this->spritePriority.b0 = 4; - if (sub_0807AC54(this)) { + super->collisionFlags = 0; + super->spritePriority.b0 = 4; + if (sub_0807AC54(super)) { return; } - UpdateActiveItems(this); + UpdateActiveItems(super); if (CheckQueuedAction()) return; sub_080792D8(); - if ((gPlayerState.jump_status | gPlayerState.field_0xa) == 0 && (sub_08079550() || sub_08078F74(this))) { + if ((gPlayerState.jump_status | gPlayerState.field_0xa) == 0 && (sub_08079550() || sub_08078F74(super))) { return; } DoJump(this); @@ -500,69 +502,69 @@ static void PlayerNormal(Entity* this) { gPlayerState.framestate = PL_STATE_CAPE; if ((gPlayerState.jump_status & 0xC0) == 0) { if ((gPlayerState.jump_status & 7) != 3 && (gPlayerState.jump_status & 0x20) == 0) { - this->speed = gPlayerState.jump_status & 0x20; - sub_08008926(this); + super->speed = gPlayerState.jump_status & 0x20; + sub_08008926(super); } else { - this->direction = DIR_NONE; + super->direction = DIR_NONE; } } UpdatePlayerMovement(); - if ((this->frame & 2) == 0 && !gPlayerState.attack_status) - UpdateAnimationSingleFrame(this); + if ((super->frame & 2) == 0 && !gPlayerState.attack_status) + UpdateAnimationSingleFrame(super); return; } - if (this->knockbackDuration == 0) { + if (super->knockbackDuration == 0) { u32 v13; if (gPlayerState.swim_state) { gPlayerState.framestate = PL_STATE_SWIM; - PlayerSwimming(this); + PlayerSwimming(super); } else { if ((gPlayerState.flags & PL_CONVEYOR_PUSHED) == 0) - this->spritePriority.b1 = 1; + super->spritePriority.b1 = 1; if (gPlayerState.dash_state & 0x40) { - sub_08008AA0(this); + sub_08008AA0(super); } else { if (gPlayerState.floor_type == SURFACE_ICE) { - sub_08008926(this); + sub_08008926(super); } else if (gPlayerState.floor_type == SURFACE_PIT) { ResetPlayerVelocity(); } else { - sub_08008AA0(this); + sub_08008AA0(super); } } if ((gPlayerState.sword_state & 0x10) == 0) { - this->direction = gPlayerState.direction; + super->direction = gPlayerState.direction; if (gPlayerState.flags & PL_BURNING) { - this->speed = BURNING_SPEED; + super->speed = BURNING_SPEED; if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) != 0) - this->direction = 4 * (this->animationState & 0xE); + super->direction = 4 * (super->animationState & 0xE); DeleteClones(); } } } v13 = 0; - if ((((gPlayerState.field_0x7 | this->direction) & DIR_NOT_MOVING_CHECK) | gPlayerState.field_0xa) == 0 && + if ((((gPlayerState.field_0x7 | super->direction) & DIR_NOT_MOVING_CHECK) | gPlayerState.field_0xa) == 0 && (gPlayerState.field_0x7 & 0x10) == 0) { v13 = 1; - if (this->knockbackDuration == 0 && + if (super->knockbackDuration == 0 && ((gPlayerState.dash_state & 0x40) || gPlayerState.floor_type != SURFACE_ICE)) v13 = 3; } sub_08070BEC(this, v13); - sub_08008AC6(this); - if (this->knockbackDuration == 0 && gPlayerState.keepFacing == 0 && gPlayerState.floor_type != SURFACE_LADDER) - sub_0806F948(this); + sub_08008AC6(super); + if (super->knockbackDuration == 0 && gPlayerState.keepFacing == 0 && gPlayerState.floor_type != SURFACE_LADDER) + sub_0806F948(super); } else { if (gPlayerState.item == NULL) - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); if (gPlayerState.swim_state != 0 && (gRoomTransition.frameCount & 7) == 0) - CreateWaterTrace(this); + CreateWaterTrace(super); return; } } -static void sub_08070BEC(Entity* this, u32 r0) { +static void sub_08070BEC(PlayerEntity* this, u32 r0) { if (r0 & 1) sub_080797EC(); else @@ -572,8 +574,8 @@ static void sub_08070BEC(Entity* this, u32 r0) { UpdatePlayerMovement(); } -static void PlayerFall(Entity* this) { - static EntityAction* const sPlayerFallStates[] = { +static void PlayerFall(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerFallStates[] = { PlayerFallInit, PlayerFallUpdate, }; @@ -582,11 +584,11 @@ static void PlayerFall(Entity* this) { gPlayerState.pushedObject = 0x80; gPlayerState.framestate = PL_STATE_FALL; - sPlayerFallStates[this->subAction](this); + sPlayerFallStates[super->subAction](this); } -static void PlayerFallInit(Entity* this) { - sub_08004168(this); +static void PlayerFallInit(PlayerEntity* this) { + sub_08004168(super); gPlayerState.flags |= PL_BUSY | PL_DROWNING; gPlayerState.flags &= ~PL_BURNING; @@ -600,58 +602,58 @@ static void PlayerFallInit(Entity* this) { else gPlayerState.animation = ANIM_FALL; - this->subAction++; - COLLISION_OFF(this); - this->spritePriority.b1 = 0; + super->subAction++; + COLLISION_OFF(super); + super->spritePriority.b1 = 0; ResetActiveItems(); DeleteClones(); SoundReq(SFX_PLY_VO7); SoundReq(SFX_FALL_HOLE); } -static void PlayerFallUpdate(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { +static void PlayerFallUpdate(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { if ((gSave.stats.health != 0) && (gPlayerState.flags & PL_PIT_IS_EXIT)) { // pit leads to another room gPlayerState.flags &= ~(PL_BUSY | PL_DROWNING); - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; } else { - // stay in this room + // stay in super room gPlayerState.flags &= ~(PL_DROWNING | PL_PIT_IS_EXIT); RespawnPlayer(); gPlayerState.field_0xa = 0; - this->iframes = 32; + super->iframes = 32; ModHealth(-FALL_DAMAGE); } } } -static void PlayerBounce(Entity* this) { - static EntityAction* const sPlayerBounceStates[] = { +static void PlayerBounce(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerBounceStates[] = { PlayerBounceInit, PlayerBounceUpdate, sub_08070E7C, }; - sPlayerBounceStates[this->subAction](this); + sPlayerBounceStates[super->subAction](this); } -static void PlayerBounceInit(Entity* this) { - COLLISION_OFF(this); - this->direction = DirectionTurnAround(Direction8FromAnimationState(AnimationStateWalk(this->animationState))); - this->speed = BOUNCE_SPEED_FWD; - this->knockbackDuration = 0; - this->subAction++; - this->timer = gPlayerState.field_0x38; - this->spriteIndex = 1; +static void PlayerBounceInit(PlayerEntity* this) { + COLLISION_OFF(super); + super->direction = DirectionTurnAround(Direction8FromAnimationState(AnimationStateWalk(super->animationState))); + super->speed = BOUNCE_SPEED_FWD; + super->knockbackDuration = 0; + super->subAction++; + super->timer = gPlayerState.field_0x38; + super->spriteIndex = 1; if (!(gPlayerState.flags & PL_MINISH)) { - this->zVelocity = BOUNCE_SPEED_Z; + super->zVelocity = BOUNCE_SPEED_Z; gPlayerState.animation = ANIM_BOUNCE; InitScreenShake(16, 0); } else { gPlayerState.animation = ANIM_BOUNCE_MINISH; - this->zVelocity = (BOUNCE_SPEED_Z * 3) / 4; + super->zVelocity = (BOUNCE_SPEED_Z * 3) / 4; } gPlayerState.jump_status = 0x80; @@ -660,13 +662,13 @@ static void PlayerBounceInit(Entity* this) { ResetPlayerVelocity(); } -static void PlayerBounceUpdate(Entity* this) { - UpdateAnimationSingleFrame(this); - sub_080085B0(this); +static void PlayerBounceUpdate(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + sub_080085B0(super); UpdatePlayerMovement(); UpdateFloorType(); - if (CheckQueuedAction() || GravityUpdate(this, GRAVITY_RATE)) + if (CheckQueuedAction() || GravityUpdate(super, GRAVITY_RATE)) return; gPlayerState.jump_status = 0; @@ -680,12 +682,12 @@ static void PlayerBounceUpdate(Entity* this) { return; } - if (this->timer-- != 0) { - this->zVelocity = Q_16_16(1.0); + if (super->timer-- != 0) { + super->zVelocity = Q_16_16(1.0); return; } - COLLISION_ON(this); + COLLISION_ON(super); if ((gPlayerState.field_0x14 == 0) && PlayerCheckNEastTile()) { gPlayerState.surfacePositionSameTimer = 7; @@ -694,23 +696,23 @@ static void PlayerBounceUpdate(Entity* this) { return; } - this->spriteIndex = 1; - this->timer = 8; - this->subAction++; + super->spriteIndex = 1; + super->timer = 8; + super->subAction++; if (!(gPlayerState.flags & PL_MINISH)) gPlayerState.animation = ANIM_DEFAULT; } -static void sub_08070E7C(Entity* this) { - if (--this->timer == 0) { +static void sub_08070E7C(PlayerEntity* this) { + if (--super->timer == 0) { gPlayerState.jump_status = 0; ResetPlayerAnimationAndAction(); } } -static void sub_08070E9C(Entity* this) { - static EntityAction* const gUnk_0811BA74[] = { +static void sub_08070E9C(PlayerEntity* this) { + static PlayerEntityAction* const gUnk_0811BA74[] = { sub_08070EDC, sub_08070f24, }; @@ -721,15 +723,15 @@ static void sub_08070E9C(Entity* this) { gPlayerState.field_0x27[0] = 4; gPlayerState.framestate = PL_STATE_TALKEZLO; UpdateFloorType(); - gUnk_0811BA74[this->subAction](this); + gUnk_0811BA74[super->subAction](this); } } -static void sub_08070EDC(Entity* this) { - this->updatePriority = PRIO_MESSAGE; +static void sub_08070EDC(PlayerEntity* this) { + super->updatePriority = PRIO_MESSAGE; if (gMessage.state & MESSAGE_ACTIVE) - this->subAction = 1; + super->subAction = 1; if ((gPlayerState.flags & PL_MINISH) == 0) ResolvePlayerAnimation(); @@ -737,16 +739,16 @@ static void sub_08070EDC(Entity* this) { gPlayerState.animation = ANIM_BOUNCE_MINISH; } -static void sub_08070f24(Entity* this) { - UpdateAnimationSingleFrame(this); +static void sub_08070f24(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); if ((gMessage.state & MESSAGE_ACTIVE) == 0) { - this->updatePriority = this->updatePriorityPrev; + super->updatePriority = super->updatePriorityPrev; ResetPlayerAnimationAndAction(); } } -static void PlayerItemGet(Entity* this) { - static EntityAction* const sPlayerItemGetStates[] = { +static void PlayerItemGet(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerItemGetStates[] = { PlayerItemGetInit, PlayerItemGetUpdate, sub_08071038, @@ -756,21 +758,21 @@ static void PlayerItemGet(Entity* this) { u8* temp; gPlayerState.framestate = PL_STATE_ITEMGET; - COLLISION_OFF(this); - sPlayerItemGetStates[this->subAction](this); + COLLISION_OFF(super); + sPlayerItemGetStates[super->subAction](this); - child = this->child; + child = super->child; if (child != NULL) { - PositionEntityOnTop(this, child); - temp = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex); + PositionEntityOnTop(super, child); + temp = GetSpriteSubEntryOffsetDataPointer((u16)super->spriteIndex, super->frameIndex); child->spriteOffsetX = temp[0]; child->spriteOffsetY = temp[1]; } } -static void PlayerItemGetInit(Entity* this) { - this->spriteSettings.flipX = FALSE; - this->animationState = IdleSouth; +static void PlayerItemGetInit(PlayerEntity* this) { + super->spriteSettings.flipX = FALSE; + super->animationState = IdleSouth; gPlayerState.flags |= PL_BUSY; gPlayerState.jump_status = 0; @@ -793,50 +795,50 @@ static void PlayerItemGetInit(Entity* this) { gPlayerState.animation = anim; } - this->subAction = 1; + super->subAction = 1; ResetActiveItems(); ResetPlayerVelocity(); } -static void PlayerItemGetUpdate(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame != 0) /* entire animation is a static frame, wait for advance */ - this->subAction = 2; +static void PlayerItemGetUpdate(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame != 0) /* entire animation is a static frame, wait for advance */ + super->subAction = 2; } -static void sub_08071038(Entity* this) { - UpdateAnimationSingleFrame(this); +static void sub_08071038(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); // player is still reading message if (CheckQueuedAction() || (gMessage.state & MESSAGE_ACTIVE)) return; - if (this->frame & ANIM_DONE) { + if (super->frame & ANIM_DONE) { // remove the item - // is this actually deleted? - this->child = NULL; - this->knockbackDuration = 0; - this->iframes = 248; + // is super actually deleted? + super->child = NULL; + super->knockbackDuration = 0; + super->iframes = 248; gPlayerState.jump_status = 0; ResetPlayerAnimationAndAction(); } } -static void PlayerJump(Entity* this) { - static EntityAction* const sPlayerJumpStates[] = { +static void PlayerJump(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerJumpStates[] = { PlayerJumpInit, sub_08071130, sub_08071208, }; gPlayerState.framestate = PL_STATE_JUMP; - sPlayerJumpStates[this->subAction](this); + sPlayerJumpStates[super->subAction](this); } -static void PlayerJumpInit(Entity* this) { +static void PlayerJumpInit(PlayerEntity* this) { s32 temp; - this->subAction++; + super->subAction++; gPlayerState.flags |= PL_BUSY; gPlayerState.flags &= ~(PL_BURNING | PL_FROZEN); @@ -855,44 +857,44 @@ static void PlayerJumpInit(Entity* this) { } gPlayerState.dash_state = 0; - this->direction = Direction8FromAnimationState(AnimationStateWalk(this->animationState)); + super->direction = Direction8FromAnimationState(AnimationStateWalk(super->animationState)); temp = sub_08079FC4(1); temp <<= 4; temp -= 4; temp <<= 12; - this->zVelocity = temp; + super->zVelocity = temp; - this->speed = JUMP_SPEED_FWD; + super->speed = JUMP_SPEED_FWD; DeleteClones(); SoundReq(SFX_PLY_JUMP); SoundReq(SFX_PLY_VO4); } -static void sub_08071130(Entity* this) { +static void sub_08071130(PlayerEntity* this) { if (CheckQueuedAction()) return; if (gPlayerState.sword_state == 0) { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); - if (this->frame & 1) + if (super->frame & 1) return; } - LinearMoveUpdate(this); + LinearMoveUpdate(super); - if (GravityUpdate(this, GRAVITY_RATE)) + if (GravityUpdate(super, GRAVITY_RATE)) return; gPlayerState.jump_status = 0; - ResetCollisionLayer(this); + ResetCollisionLayer(super); - if (*(Entity**)&this->field_0x74 != NULL) - ResetCollisionLayer(*(Entity**)&this->field_0x74); + if (this->unk_74 != NULL) + ResetCollisionLayer(this->unk_74); - sub_08008790(this, 7); + sub_08008790(super, 7); if (gPlayerState.field_0x14) return; @@ -908,7 +910,7 @@ static void sub_08071130(Entity* this) { return; } - this->timer = 6; + super->timer = 6; if (((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) { if (gPlayerState.flags & PL_NO_CAP) { @@ -916,53 +918,53 @@ static void sub_08071130(Entity* this) { } else { gPlayerState.animation = ANIM_LAND; } - this->animIndex = 0xff; + super->animIndex = 0xff; } - this->subAction++; + super->subAction++; ResetPlayerVelocity(); - this->knockbackDuration = 0; + super->knockbackDuration = 0; SoundReq(SFX_PLY_LAND); } -static void sub_08071208(Entity* this) { +static void sub_08071208(PlayerEntity* this) { if ((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) { if ((gPlayerState.flags & PL_MINISH) == 0) { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } - if (this->timer-- == 0) { + if (super->timer-- == 0) { gPlayerState.jump_status = 0; ResetPlayerAnimationAndAction(); } } -static void PlayerDrown(Entity* this) { - static EntityAction* const sPlayerDrownStates[] = { +static void PlayerDrown(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerDrownStates[] = { PlayerDrownInit, sub_080712F0, }; gPlayerState.framestate = PL_STATE_DROWN; gPlayerState.flags |= PL_DROWNING; - COLLISION_OFF(this); - sPlayerDrownStates[this->subAction](this); + COLLISION_OFF(super); + sPlayerDrownStates[super->subAction](this); } -static void PlayerDrownInit(Entity* this) { - this->subAction = 1; - this->spritePriority.b1 = 0; +static void PlayerDrownInit(PlayerEntity* this) { + super->subAction = 1; + super->spritePriority.b1 = 0; if (gPlayerState.flags & PL_MINISH) { - this->timer = 60; + super->timer = 60; gPlayerState.animation = ANIM_DROWN_MINISH; SoundReq(SFX_WATER_SPLASH); } else { if (!(gPlayerState.flags & PL_FLAGS10000)) - sub_08004168(this); + sub_08004168(super); - CreateFx(this, FX_WATER_SPLASH, 0); + CreateFx(super, FX_WATER_SPLASH, 0); if (!(gPlayerState.flags & PL_NO_CAP)) gPlayerState.animation = ANIM_DROWN; @@ -972,44 +974,44 @@ static void PlayerDrownInit(Entity* this) { ResetActiveItems(); } -static void sub_080712F0(Entity* this) { +static void sub_080712F0(PlayerEntity* this) { u32 temp; - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); temp = FALSE; if (gPlayerState.flags & PL_MINISH) { - if (--this->timer == 0) + if (--super->timer == 0) temp = TRUE; - } else if ((this->frame & ANIM_DONE) != 0) { - if (this->animIndex != 0xce) + } else if ((super->frame & ANIM_DONE) != 0) { + if (super->animIndex != 0xce) gPlayerState.animation = ANIM_DROWN_RESPAWN; else temp = TRUE; } if (temp) { - this->knockbackDuration = 0; - this->iframes = 32; - this->spritePriority.b1 = 1; - this->spriteSettings.draw = FALSE; + super->knockbackDuration = 0; + super->iframes = 32; + super->spritePriority.b1 = 1; + super->spriteSettings.draw = FALSE; gPlayerState.flags &= ~PL_DROWNING; RespawnPlayer(); } } -static void PlayerUsePortal(Entity* this) { - static EntityAction* const sPlayerUsePortalStates[] = { +static void PlayerUsePortal(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerUsePortalStates[] = { PortalJumpOnUpdate, PortalStandUpdate, PortalActivateInit, PortalActivateUpdate, PortalShrinkInit, PortalShrinkUpdate, PortalEnterUpdate, PortalUnknownUpdate, }; gPlayerState.framestate = PL_STATE_USEPORTAL; - sPlayerUsePortalStates[this->subAction](this); + sPlayerUsePortalStates[super->subAction](this); // probably a switch - if ((this->subAction == 7) || (this->subAction < 3)) + if ((super->subAction == 7) || (super->subAction < 3)) return; if (!(gPlayerState.flags & PL_USE_PORTAL)) @@ -1019,8 +1021,8 @@ static void PlayerUsePortal(Entity* this) { return; if (AreaIsDungeon() || gArea.portal_type == PT_DUNGEON) { - this->subAction = 7; - this->timer = 30; + super->subAction = 7; + super->timer = 30; SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 16); SoundReq(SFX_F8); } else { @@ -1028,116 +1030,116 @@ static void PlayerUsePortal(Entity* this) { } } -static void PortalJumpOnUpdate(Entity* this) { +static void PortalJumpOnUpdate(PlayerEntity* this) { u16 x; u16 y; - COLLISION_OFF(this); - this->knockbackDuration = 0; + COLLISION_OFF(super); + super->knockbackDuration = 0; x = gArea.portal_x; y = gArea.portal_y; - if ((this->x.HALF.HI != x) || (this->y.HALF.HI != y)) { - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gArea.portal_x, gArea.portal_y); - this->speed = JUMP_SPEED_FWD; + if ((super->x.HALF.HI != x) || (super->y.HALF.HI != y)) { + super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gArea.portal_x, gArea.portal_y); + super->speed = JUMP_SPEED_FWD; UpdatePlayerMovement(); } DoJump(this); - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); if (gPlayerState.jump_status == 0) { gPlayerState.flags |= PL_USE_PORTAL; - this->subAction = 1; - this->animationState = IdleSouth; - this->spriteSettings.flipX = FALSE; + super->subAction = 1; + super->animationState = IdleSouth; + super->spriteSettings.flipX = FALSE; if (gArea.portal_type == PT_JAR) { gPlayerState.animation = ANIM_ENTER_POT; } } - this->timer = 8; + super->timer = 8; if (gArea.portal_type != PT_DUNGEON) { - this->spritePriority.b0 = 3; + super->spritePriority.b0 = 3; } } -static void PortalStandUpdate(Entity* this) { +static void PortalStandUpdate(PlayerEntity* this) { switch (gArea.portal_type) { case PT_JAR: case PT_5: - sub_0806F948(&gPlayerEntity); + sub_0806F948(&gPlayerEntity.base); break; } if ((gPlayerState.direction & (DIR_NOT_MOVING_CHECK | DIR_DIAGONAL)) == 0) { - if (this->direction != gPlayerState.direction) { - this->timer = 8; + if (super->direction != gPlayerState.direction) { + super->timer = 8; } - if (this->timer-- == 0) { - this->direction = gPlayerState.direction; - this->animationState = Direction8ToAnimationState(this->direction); - this->zVelocity = Q_16_16(2.0); - this->speed = JUMP_SPEED_FWD; - this->action = PLAYER_MINISH; - this->subAction = 7; - this->subtimer = 0; + if (super->timer-- == 0) { + super->direction = gPlayerState.direction; + super->animationState = Direction8ToAnimationState(super->direction); + super->zVelocity = Q_16_16(2.0); + super->speed = JUMP_SPEED_FWD; + super->action = PLAYER_MINISH; + super->subAction = 7; + super->subtimer = 0; gPlayerState.animation = (gPlayerState.flags & PL_NO_CAP) ? ANIM_HOP_NOCAP : ANIM_HOP; gPlayerState.flags &= ~PL_USE_PORTAL; return; } - this->direction = gPlayerState.direction; + super->direction = gPlayerState.direction; } else { - this->timer = 8; + super->timer = 8; } if (gArea.portal_type == PT_JAR) { - if (this->frame == 0) { - UpdateAnimationSingleFrame(this); + if (super->frame == 0) { + UpdateAnimationSingleFrame(super); return; } } else { - UpdateActiveItems(this); + UpdateActiveItems(super); } ResolvePlayerAnimation(); } -static void PortalActivateInit(Entity* this) { +static void PortalActivateInit(PlayerEntity* this) { gRoomControls.camera_target = NULL; gPauseMenuOptions.disabled = 1; - this->subAction = 3; - this->subtimer = 30; + super->subAction = 3; + super->subtimer = 30; gPlayerState.animation = ANIM_PORTAL_ACTIVATE; - CreateObjectWithParent(this, EZLO_CAP, 1, 0); + CreateObjectWithParent(super, EZLO_CAP, 1, 0); PutAwayItems(); SetPlayerEventPriority(); } -static void PortalActivateUpdate(Entity* this) { - if (this->subtimer) +static void PortalActivateUpdate(PlayerEntity* this) { + if (super->subtimer) return; - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); if (gPlayerState.flags & PL_MINISH) - this->subAction = 4; + super->subAction = 4; } -static void PortalShrinkInit(Entity* this) { - this->subAction = 5; - this->spritePriority.b1 = 0; - this->subtimer = 0; - this->spriteRendering.b0 = 3; - *(u32*)&this->field_0x80.HWORD = 0x100; - *(u32*)&this->cutsceneBeh = 0x100; - SetAffineInfo(this, 0x100, 0x100, 0); +static void PortalShrinkInit(PlayerEntity* this) { + super->subAction = 5; + super->spritePriority.b1 = 0; + super->subtimer = 0; + super->spriteRendering.b0 = 3; + this->unk_80.WORD = 0x100; + this->unk_84.WORD = 0x100; + SetAffineInfo(super, 0x100, 0x100, 0); gPlayerState.animation = ANIM_PORTAL_SHRINK; gPlayerState.flags |= PL_MINISH; SoundReq(SFX_PLY_SHRINKING); } -static void PortalShrinkUpdate(Entity* this) { +static void PortalShrinkUpdate(PlayerEntity* this) { static const u8 gUnk_0811BABC[] = { 1, 1, 1, 1, 2, 4, 8, 16, }; @@ -1146,12 +1148,12 @@ static void PortalShrinkUpdate(Entity* this) { u32 uVar7; u32 uVar8; - if (this->field_0x80.HALF.HI) { - uVar7 = (u32)((*(int*)&this->field_0x80 + 0x80) * 0x100000) >> 0x17; + if (this->unk_80.BYTES.byte1) { + uVar7 = (u32)((this->unk_80.WORD + 0x80) * 0x100000) >> 0x17; } else { - uVar7 = (0x10 / (((this->field_0x80.HALF.LO >> 6) ^ 3) + 1)) >> 1; + uVar7 = (0x10 / (((this->unk_80.BYTES.byte0 >> 6) ^ 3) + 1)) >> 1; } - uVar5 = *(u32*)&this->cutsceneBeh; + uVar5 = this->unk_84.WORD; if (uVar5 >= 0x101) { uVar5 = (uVar5 + 0x80) * 0x100000 >> 0x17; } else { @@ -1163,64 +1165,64 @@ static void PortalShrinkUpdate(Entity* this) { } iVar3 = Q_16_16(1); - switch (this->frame) { + switch (super->frame) { case 1: - this->spritePriority.b1 = 0; - if (0x80 < *(u32*)&this->field_0x80) { - *(u32*)&this->field_0x80 -= uVar7; + super->spritePriority.b1 = 0; + if (0x80 < this->unk_80.WORD_U) { + this->unk_80.WORD_U -= uVar7; } - *(u32*)&this->cutsceneBeh += uVar5 * 2; - this->y.WORD += iVar3 * 2; + this->unk_84.WORD_U += uVar5 * 2; + super->y.WORD_U += iVar3 * 2; break; case 2: - *(u32*)&this->field_0x80 += uVar7; - uVar8 = *(u32*)&this->cutsceneBeh; + this->unk_80.WORD_U += uVar7; + uVar8 = this->unk_84.WORD_U; if (uVar8 >= 0x101) { if (uVar8 < 0x180) { uVar5 = uVar5 >> 1; } if (uVar8 - uVar5 < 0x100) { - *(u32*)&this->cutsceneBeh = 0x100; + this->unk_84.WORD_U = 0x100; } else { - *(u32*)&this->cutsceneBeh = uVar8 - uVar5; + this->unk_84.WORD_U = uVar8 - uVar5; } } else { if (0x80 < uVar8) { - *(u32*)&this->cutsceneBeh = uVar8 - uVar5; + this->unk_84.WORD_U = uVar8 - uVar5; } } - this->z.WORD = this->z.WORD - iVar3; + super->z.WORD = super->z.WORD - iVar3; break; case 3: - if (*(u32*)&this->field_0x80 < 0x340) { - *(u32*)&this->field_0x80 += uVar7; + if (this->unk_80.WORD_U < 0x340) { + this->unk_80.WORD_U += uVar7; } - if (*(u32*)&this->cutsceneBeh >= 0x340) { - this->timer = 8; - this->subtimer = 30; - this->subAction = 6; + if (this->unk_84.WORD_U >= 0x340) { + super->timer = 8; + super->subtimer = 30; + super->subAction = 6; } else { - *(u32*)&this->cutsceneBeh += uVar5 * 2; + this->unk_84.WORD_U += uVar5 * 2; } - this->z.WORD = this->z.WORD - iVar3 * 2; + super->z.WORD = super->z.WORD - iVar3 * 2; break; } - SetAffineInfo(this, *(u32*)&this->field_0x80, *(u32*)&this->cutsceneBeh, 0); - UpdateAnimationSingleFrame(this); + SetAffineInfo(super, this->unk_80.WORD, this->unk_84.WORD, 0); + UpdateAnimationSingleFrame(super); } -static void PortalEnterUpdate(Entity* this) { - if (this->timer == 0) { - if (GravityUpdate(this, GRAVITY_RATE)) +static void PortalEnterUpdate(PlayerEntity* this) { + if (super->timer == 0) { + if (GravityUpdate(super, GRAVITY_RATE)) return; - this->spriteSettings.draw = FALSE; + super->spriteSettings.draw = FALSE; if (gArea.portal_type == PT_DUNGEON) { - if (--this->subtimer == 0) + if (--super->subtimer == 0) sub_080717F8(this); return; } @@ -1231,15 +1233,15 @@ static void PortalEnterUpdate(Entity* this) { return; } - this->timer--; + super->timer--; } -static void PortalUnknownUpdate(Entity* this) { +static void PortalUnknownUpdate(PlayerEntity* this) { if (gFadeControl.active) return; - if (this->timer != 0) { - this->timer--; + if (super->timer != 0) { + super->timer--; return; } @@ -1247,25 +1249,25 @@ static void PortalUnknownUpdate(Entity* this) { SetFadeInverted(0x10); } -static void sub_080717F8(Entity* this) { +static void sub_080717F8(PlayerEntity* this) { static const s16 sOffsets[] = { 0, -22, 22, 0, 0, 22, -22, 0, }; - this->animationState = gArea.portal_exit_dir << 1; - this->x.HALF.HI = gArea.portal_x + sOffsets[gArea.portal_exit_dir * 2]; - this->y.HALF.HI = gArea.portal_y + sOffsets[gArea.portal_exit_dir * 2 + 1]; + super->animationState = gArea.portal_exit_dir << 1; + super->x.HALF.HI = gArea.portal_x + sOffsets[gArea.portal_exit_dir * 2]; + super->y.HALF.HI = gArea.portal_y + sOffsets[gArea.portal_exit_dir * 2 + 1]; gArea.portal_timer = 180; gPauseMenuOptions.disabled = 0; - this->action = PLAYER_MINISH; - this->subAction = 0; + super->action = PLAYER_MINISH; + super->subAction = 0; gPlayerState.flags = (gPlayerState.flags & ~PL_USE_PORTAL) | PL_MINISH; - sub_0805EC60(this); + sub_0805EC60(super); ResetPlayerEventPriority(); } -static void PlayerTalkEzlo(Entity* this) { - static EntityAction* const sPlayerTalkEzloStates[] = { +static void PlayerTalkEzlo(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerTalkEzloStates[] = { PlayerTalkEzlo_Init, PlayerTalkEzlo_CreateMessage, PlayerTalkEzlo_MessageIdle, @@ -1277,52 +1279,52 @@ static void PlayerTalkEzlo(Entity* this) { reset_priority(); } else { gPlayerState.framestate = PL_STATE_TALKEZLO; - COLLISION_OFF(this); - sPlayerTalkEzloStates[this->subAction](this); + COLLISION_OFF(super); + sPlayerTalkEzloStates[super->subAction](this); } } -static void PlayerTalkEzlo_Init(Entity* this) { +static void PlayerTalkEzlo_Init(PlayerEntity* this) { ResetActiveItems(); gActiveItems[ACTIVE_ITEM_LANTERN].animPriority = 0; - this->iframes = 0; + super->iframes = 0; gPriorityHandler.event_priority = PRIO_PLAYER_EVENT; - this->updatePriority = PRIO_PLAYER_EVENT; + super->updatePriority = PRIO_PLAYER_EVENT; if (gPlayerState.flags & PL_MINISH) { - this->subAction = 2; - this->spritePriority.b1 = 0; + super->subAction = 2; + super->spritePriority.b1 = 0; DisplayEzloMessage(); return; } if (gPlayerState.jump_status == 0) { - this->subAction++; + super->subAction++; - if (this->animationState == IdleEast) { + if (super->animationState == IdleEast) { gPlayerState.animation = ANIM_EZLO_APPEAR_RIGHT; } else { gPlayerState.animation = ANIM_EZLO_APPEAR_LEFT; } - this->spriteSettings.flipX = 0; + super->spriteSettings.flipX = 0; return; } - if (!GravityUpdate(this, GRAVITY_RATE)) { + if (!GravityUpdate(super, GRAVITY_RATE)) { gPlayerState.jump_status = 0; } } -static void PlayerTalkEzlo_CreateMessage(Entity* this) { +static void PlayerTalkEzlo_CreateMessage(PlayerEntity* this) { Entity* child; - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { - this->subAction++; - this->child = CreateObjectWithParent(this, EZLO_CAP, 0, 0); - if (this->child != NULL) { - if (this->animationState == IdleEast) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { + super->subAction++; + super->child = CreateObjectWithParent(super, EZLO_CAP, 0, 0); + if (super->child != NULL) { + if (super->animationState == IdleEast) { gPlayerState.animation = ANIM_EZLO_EYES_MIDDLE; } else { gPlayerState.animation = ANIM_EZLO_EYES_UP; @@ -1332,13 +1334,13 @@ static void PlayerTalkEzlo_CreateMessage(Entity* this) { } } -static void PlayerTalkEzlo_MessageIdle(Entity* this) { +static void PlayerTalkEzlo_MessageIdle(PlayerEntity* this) { u32 rightOrLeft; if ((gMessage.state & MESSAGE_ACTIVE) == 0) { - this->subAction++; + super->subAction++; if ((gPlayerState.flags & PL_MINISH) == 0) { - if (this->animationState == IdleEast) + if (super->animationState == IdleEast) gPlayerState.animation = ANIM_EZLO_LEAVE_RIGHT; else gPlayerState.animation = ANIM_EZLO_LEAVE_LEFT; @@ -1352,28 +1354,28 @@ static void PlayerTalkEzlo_MessageIdle(Entity* this) { if (gPlayerState.flags & PL_MINISH) return; - if (this->animationState == IdleEast) + if (super->animationState == IdleEast) rightOrLeft = 4; else rightOrLeft = 0; - if (this->child->timer != 0) { - if ((u8)(rightOrLeft + 200) != this->animIndex) { + if (super->child->timer != 0) { + if ((u8)(rightOrLeft + 200) != super->animIndex) { gPlayerState.animation = rightOrLeft + ANIM_EZLO_HEAD_DOWN; return; } } else { - if ((u8)(rightOrLeft + 199) != this->animIndex) { + if ((u8)(rightOrLeft + 199) != super->animIndex) { gPlayerState.animation = rightOrLeft + ANIM_EZLO_EYES_UP; return; } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -static void PlayerTalkEzlo_Leave(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { +static void PlayerTalkEzlo_Leave(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { reset_priority(); PlayerSetNormalAndCollide(); } @@ -1381,35 +1383,35 @@ static void PlayerTalkEzlo_Leave(Entity* this) { static void reset_priority(void) { gPriorityHandler.event_priority = PRIO_MIN; - gPlayerEntity.updatePriority = gPlayerEntity.updatePriorityPrev; + gPlayerEntity.base.updatePriority = gPlayerEntity.base.updatePriorityPrev; } -static void PlayerPush(Entity* this) { - static EntityAction* const sPlayerPushStates[] = { +static void PlayerPush(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerPushStates[] = { PlayerPushInit, PlayerPushUpdate, PlayerPushEnd, }; gPlayerState.framestate = PL_STATE_PUSH; - sPlayerPushStates[this->subAction](this); + sPlayerPushStates[super->subAction](this); } -static void PlayerPushInit(Entity* this) { - this->subAction++; +static void PlayerPushInit(PlayerEntity* this) { + super->subAction++; gPlayerState.flags |= PL_BUSY; - if (this->type == 1) { + if (super->type == 1) { // scripted push? - this->speed = 0; - this->timer = 0; - this->subtimer = 1; + super->speed = 0; + super->timer = 0; + super->subtimer = 1; } else { - this->speed = (gPlayerState.flags & PL_MINISH) ? PUSH_SPEED / 2 : PUSH_SPEED; + super->speed = (gPlayerState.flags & PL_MINISH) ? PUSH_SPEED / 2 : PUSH_SPEED; } PlayerPushUpdate(this); } -static void PlayerPushUpdate(Entity* this) { +static void PlayerPushUpdate(PlayerEntity* this) { typedef struct { u8 frame; u16 speed; @@ -1434,62 +1436,62 @@ static void PlayerPushUpdate(Entity* this) { }; gPlayerState.speed_modifier = 0; - UpdateAnimationSingleFrame(this); - if (this->type == 1) { - if (--this->subtimer == 0) { - if (sPushFrames[this->timer].frame != 0xff) { - this->subtimer = sPushFrames[this->timer].frame; - this->speed = sPushFrames[this->timer].speed; - this->timer++; + UpdateAnimationSingleFrame(super); + if (super->type == 1) { + if (--super->subtimer == 0) { + if (sPushFrames[super->timer].frame != 0xff) { + super->subtimer = sPushFrames[super->timer].frame; + super->speed = sPushFrames[super->timer].speed; + super->timer++; } else { - this->subAction++; + super->subAction++; return; } } } else { gPlayerState.pushedObject--; if ((gPlayerState.pushedObject & 0x7f) == 0) { - this->subAction++; + super->subAction++; } } UpdatePlayerMovement(); } -static void PlayerPushEnd(Entity* this) { +static void PlayerPushEnd(PlayerEntity* this) { gPlayerState.pushedObject = 2; gPlayerState.flags &= ~PL_BUSY; - this->type = 0; - this->knockbackDuration = 0; + super->type = 0; + super->knockbackDuration = 0; PlayerWaitForScroll(this); // Final push? - this->subtimer = 6; + super->subtimer = 6; if (!(gPlayerState.flags & PL_MINISH)) { gPlayerState.animation = ANIM_WALK; - this->spriteIndex = 3; - InitAnimationForceUpdate(this, (this->animationState >> 1) + 0x3c); + super->spriteIndex = 3; + InitAnimationForceUpdate(super, (super->animationState >> 1) + 0x3c); } } -static void PlayerMinishDie(Entity* this) { - static EntityAction* const sPlayerMinishDieStates[] = { +static void PlayerMinishDie(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerMinishDieStates[] = { PlayerMinishDieInit, sub_08071CAC, sub_08071D04, sub_08071D80, }; - COLLISION_OFF(this); - sPlayerMinishDieStates[this->subAction](this); + COLLISION_OFF(super); + sPlayerMinishDieStates[super->subAction](this); gPlayerState.framestate = PL_STATE_DIE; } -static void PlayerMinishDieInit(Entity* this) { +static void PlayerMinishDieInit(PlayerEntity* this) { u32 deathAnim; if (gPlayerState.flags & (PL_CAPTURED | PL_DISABLE_ITEMS)) return; - if (GravityUpdate(this, GRAVITY_RATE)) { + if (GravityUpdate(super, GRAVITY_RATE)) { if (gPlayerState.flags & PL_NO_CAP) gPlayerState.animation = ANIM_JUMP_NOCAP; else @@ -1501,9 +1503,9 @@ static void PlayerMinishDieInit(Entity* this) { if (gPlayerState.flags & PL_MINISH) { if (gPlayerState.floor_type == SURFACE_MINISH_DOOR_FRONT || gPlayerState.floor_type == SURFACE_MINISH_DOOR_BACK || gPlayerState.floor_type == SURFACE_A) { - EnablePlayerDraw(this); + EnablePlayerDraw(super); RespawnPlayer(); - this->action = PLAYER_MINISHDIE; + super->action = PLAYER_MINISHDIE; } deathAnim = ANIM_DIE1_MINISH; } else { @@ -1513,20 +1515,20 @@ static void PlayerMinishDieInit(Entity* this) { gPlayerState.flags &= ~(PL_PARACHUTE | PL_MOLDWORM_RELEASED | PL_ROLLING | PL_FROZEN | PL_BURNING | PL_DISABLE_ITEMS | PL_BUSY); - this->subAction = 1; - this->animationState = IdleSouth; - this->spritePriority.b1 = 1; - this->spriteSettings.draw = 3; + super->subAction = 1; + super->animationState = IdleSouth; + super->spritePriority.b1 = 1; + super->spriteSettings.draw = 3; gPlayerState.jump_status = 0; gPlayerState.pushedObject = 0; - sub_0800451C(this); + sub_0800451C(super); ResetActiveItems(); SoundReq(SFX_PLY_DIE); } -static void sub_08071CAC(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { +static void sub_08071CAC(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { u32 deathAnim; if ((gPlayerState.flags & PL_MINISH) == 0) deathAnim = (gPlayerState.flags & PL_NO_CAP) ? ANIM_DIE2_NOCAP : ANIM_DIE2; @@ -1534,18 +1536,18 @@ static void sub_08071CAC(Entity* this) { deathAnim = ANIM_DIE2_MINISH; gPlayerState.animation = deathAnim; - this->subAction = 2; - this->timer = 240; + super->subAction = 2; + super->timer = 240; SoundReq(SFX_PLY_VO7); } } -static void sub_08071D04(Entity* this) { +static void sub_08071D04(PlayerEntity* this) { int idx; int deltaHealth; - UpdateAnimationSingleFrame(this); - if (this->frame == 0) + UpdateAnimationSingleFrame(super); + if (super->frame == 0) return; deltaHealth = 0; @@ -1558,11 +1560,11 @@ static void sub_08071D04(Entity* this) { if (deltaHealth != 0) { ModHealth(deltaHealth); - this->subAction = 3; + super->subAction = 3; gPlayerState.field_0x3c = 0; - this->direction = DIR_NONE; - this->speed = 0; - this->zVelocity = Q_16_16(1.5); + super->direction = DIR_NONE; + super->speed = 0; + super->zVelocity = Q_16_16(1.5); gPlayerState.jump_status = 1; gPlayerState.swim_state = 0; return; @@ -1571,42 +1573,42 @@ static void sub_08071D04(Entity* this) { gRoomTransition.field_0x4[1] = 1; } -static void sub_08071D80(Entity* this) { - UpdateAnimationSingleFrame(this); +static void sub_08071D80(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); gPlayerState.field_0x14 = 1; DoJump(this); if ((gPlayerState.jump_status & 7) == 3) { gPlayerState.jump_status = 0; - this->iframes = 226; + super->iframes = 226; ResetPlayerEventPriority(); ResetPlayerAnimationAndAction(); } } -static void sub_08071DB8(Entity* this) { - static EntityAction* const gUnk_0811BB3C[] = { +static void sub_08071DB8(PlayerEntity* this) { + static PlayerEntityAction* const gUnk_0811BB3C[] = { sub_08071DD0, sub_08071E04, sub_08071E74, }; - gUnk_0811BB3C[this->subAction](this); + gUnk_0811BB3C[super->subAction](this); } -static void sub_08071DD0(Entity* this) { - this->timer = gPlayerState.field_0x38; +static void sub_08071DD0(PlayerEntity* this) { + super->timer = gPlayerState.field_0x38; if (gPlayerState.field_0x39 != 0) { gPlayerState.field_0x39 = 0; - this->subAction = 2; + super->subAction = 2; gPlayerState.animation = ANIM_DEFAULT; } else { - this->subAction = 1; + super->subAction = 1; gPlayerState.animation = ANIM_BOUNCE; } } -static void sub_08071E04(Entity* this) { - if ((this->z.WORD != 0) && (gPlayerState.field_0x14 == 0)) { +static void sub_08071E04(PlayerEntity* this) { + if ((super->z.WORD != 0) && (gPlayerState.field_0x14 == 0)) { UpdateFloorType(); if (gPlayerState.floor_type == SURFACE_PIT) { gPlayerState.surfacePositionSameTimer = 7; @@ -1616,49 +1618,49 @@ static void sub_08071E04(Entity* this) { } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); if (sub_08079B24() == 0) { - sub_08079708(this); + sub_08079708(super); return; } sub_080792D8(); if (sub_0807953C()) - this->timer -= 2; + super->timer -= 2; else - this->timer--; + super->timer--; - if ((s8)this->timer < 1) + if ((s8)super->timer < 1) SetPlayerActionNormal(); } -static void sub_08071E74(Entity* this) { +static void sub_08071E74(PlayerEntity* this) { u32 temp; - GravityUpdate(this, GRAVITY_RATE); + GravityUpdate(super, GRAVITY_RATE); UpdatePlayerMovement(); - temp = this->timer--; + temp = super->timer--; if (temp == 0) SetPlayerActionNormal(); } -static void PlayerEmptyBottle(Entity* this) { - static EntityAction* const sPlayerEmptyBottleStates[] = { +static void PlayerEmptyBottle(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerEmptyBottleStates[] = { PlayerEmptyBottleInit, PlayerEmptyBottleUpdate, }; - sPlayerEmptyBottleStates[this->subAction](this); + sPlayerEmptyBottleStates[super->subAction](this); } -static void PlayerEmptyBottleInit(Entity* this) { - Entity* ent; +static void PlayerEmptyBottleInit(PlayerEntity* this) { + PlayerItemBottleEntity* entity; ResetActiveItems(); - ent = CreatePlayerItemWithParent((ItemBehavior*)this, PLAYER_ITEM_BOTTLE); - if (ent != NULL) { - ent->field_0x68.HALF.LO = gPlayerState.field_0x38; - this->subAction++; + entity = (PlayerItemBottleEntity*)CreatePlayerItemWithParent((ItemBehavior*)super, PLAYER_ITEM_BOTTLE); + if (entity != NULL) { + entity->bottleIndex = gPlayerState.field_0x38; + super->subAction++; switch (gPlayerState.field_0x38) { case 0x20: gPlayerState.animation = ANIM_BOTTLE_SWING; @@ -1674,35 +1676,35 @@ static void PlayerEmptyBottleInit(Entity* this) { } } -static void PlayerEmptyBottleUpdate(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { +static void PlayerEmptyBottleUpdate(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { gPlayerState.item = NULL; PlayerSetNormalAndCollide(); } } -static void PlayerFrozen(Entity* this) { - static EntityAction* const sPlayerFrozenStates[] = { +static void PlayerFrozen(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerFrozenStates[] = { PlayerFrozenInit, PlayerFrozenUpdate, }; - sPlayerFrozenStates[this->subAction](this); + sPlayerFrozenStates[super->subAction](this); } -static void PlayerFrozenInit(Entity* this) { - COLLISION_OFF(this); - this->timer = 120; - this->subAction++; +static void PlayerFrozenInit(PlayerEntity* this) { + COLLISION_OFF(super); + super->timer = 120; + super->subAction++; gPlayerState.animation = ANIM_FROZEN; PutAwayItems(); SoundReq(SFX_195); } -static void PlayerFrozenUpdate(Entity* this) { - if (GravityUpdate(this, GRAVITY_RATE) == 0) { - UpdateSpriteForCollisionLayer(this); +static void PlayerFrozenUpdate(PlayerEntity* this) { + if (GravityUpdate(super, GRAVITY_RATE) == 0) { + UpdateSpriteForCollisionLayer(super); gPlayerState.jump_status = 0; if (gPlayerState.field_0x14 == 0) { if (sub_08079D48() == 0) { @@ -1712,16 +1714,16 @@ static void PlayerFrozenUpdate(Entity* this) { } } if (sub_08079B24() == 0) { - sub_08079708(this); + sub_08079708(super); } else { if (gPlayerState.flags & PL_FROZEN) { if (sub_0807953C() != 0) { - this->timer -= 3; - this->spriteOffsetX = 2; + super->timer -= 3; + super->spriteOffsetX = 2; } else { - this->spriteOffsetX = 0; + super->spriteOffsetX = 0; } - if ((s8)this->timer > 0) { + if ((s8)super->timer > 0) { return; } } @@ -1729,68 +1731,68 @@ static void PlayerFrozenUpdate(Entity* this) { break_out(this); } -static void break_out(Entity* this) { - this->iframes = 160; - this->knockbackDuration = 0; - COLLISION_ON(this); - this->spriteOffsetX = 0; +static void break_out(PlayerEntity* this) { + super->iframes = 160; + super->knockbackDuration = 0; + COLLISION_ON(super); + super->spriteOffsetX = 0; gPlayerState.flags &= ~(PL_FROZEN | PL_BUSY); - CreateFx(this, FX_ICE, 0); + CreateFx(super, FX_ICE, 0); SetPlayerActionNormal(); } -static void sub_0807204C(Entity* this) { - static EntityAction* const gUnk_0811BB58[] = { +static void sub_0807204C(PlayerEntity* this) { + static PlayerEntityAction* const gUnk_0811BB58[] = { sub_08072064, sub_08072098, }; - gUnk_0811BB58[this->subAction](this); + gUnk_0811BB58[super->subAction](this); } -static void sub_08072064(Entity* this) { - this->subAction = 1; - COLLISION_OFF(this); - this->timer = gPlayerState.field_0x3a; +static void sub_08072064(PlayerEntity* this) { + super->subAction = 1; + COLLISION_OFF(super); + super->timer = gPlayerState.field_0x3a; gPlayerState.animation = gPlayerState.field_0x38 | (gPlayerState.field_0x39 << 8); ResetActiveItems(); } -static void sub_08072098(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->timer != 0) { - if (this->timer-- != 0) { +static void sub_08072098(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->timer != 0) { + if (super->timer-- != 0) { return; } - } else if ((this->frame & ANIM_DONE) == 0) { + } else if ((super->frame & ANIM_DONE) == 0) { return; } - if (this->health != 0) { - COLLISION_ON(this); + if (super->health != 0) { + COLLISION_ON(super); } SetPlayerActionNormal(); } -static void PlayerRoomExit(Entity* this) { - static EntityAction* const gUnk_0811BB60[] = { +static void PlayerRoomExit(PlayerEntity* this) { + static PlayerEntityAction* const gUnk_0811BB60[] = { sub_08072100, sub_08072168, }; if (CheckQueuedAction() == 0) - gUnk_0811BB60[this->subAction](this); + gUnk_0811BB60[super->subAction](this); } -static void sub_08072100(Entity* this) { - this->spriteSettings.draw = 3; - this->speed = 0x140; - this->hitbox = (Hitbox*)&gPlayerHitbox; - this->timer = gPlayerState.field_0x38; - this->subAction = 1; - COLLISION_OFF(this); +static void sub_08072100(PlayerEntity* this) { + super->spriteSettings.draw = 3; + super->speed = 0x140; + super->hitbox = (Hitbox*)&gPlayerHitbox; + super->timer = gPlayerState.field_0x38; + super->subAction = 1; + COLLISION_OFF(super); if (gPlayerState.field_0x39) - this->direction = DIR_NONE; + super->direction = DIR_NONE; if (gPlayerState.flags & PL_NO_CAP) { gPlayerState.animation = ANIM_WALK_NOCAP; @@ -1801,43 +1803,43 @@ static void sub_08072100(Entity* this) { sub_08072168(this); } -static void sub_08072168(Entity* this) { +static void sub_08072168(PlayerEntity* this) { u32 i; - UpdateAnimationSingleFrame(this); - i = (u16)sub_0806F854(this, 0, -12) ? GRAVITY_RATE * 2 : GRAVITY_RATE; - GravityUpdate(this, i); + UpdateAnimationSingleFrame(super); + i = (u16)sub_0806F854(super, 0, -12) ? GRAVITY_RATE * 2 : GRAVITY_RATE; + GravityUpdate(super, i); if (gPlayerState.field_0x3a) { - LinearMoveUpdate(this); + LinearMoveUpdate(super); } else { UpdatePlayerMovement(); } - gPlayerState.direction = this->direction; + gPlayerState.direction = super->direction; UpdatePlayerCollision(); - if (this->timer-- == 0) { - this->knockbackDuration = 0; - COLLISION_ON(this); - UpdateSpriteForCollisionLayer(this); + if (super->timer-- == 0) { + super->knockbackDuration = 0; + COLLISION_ON(super); + UpdateSpriteForCollisionLayer(super); SetPlayerActionNormal(); } } -static void PlayerPull(Entity* this) { - static EntityAction* const sPlayerPullStates[] = { +static void PlayerPull(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerPullStates[] = { sub_08072214, sub_08072260, }; gPlayerState.framestate = PL_STATE_PULL; - sPlayerPullStates[this->subAction](this); + sPlayerPullStates[super->subAction](this); gUnk_0200AF00.rActionGrabbing = R_ACTION_GRAB; } -static void sub_08072214(Entity* this) { - this->subAction = 1; - this->speed = PULL_SPEED; - this->timer = gPlayerState.field_0x38; - this->direction = Direction8FromAnimationState(AnimationStateFlip180(this->animationState)); +static void sub_08072214(PlayerEntity* this) { + super->subAction = 1; + super->speed = PULL_SPEED; + super->timer = gPlayerState.field_0x38; + super->direction = Direction8FromAnimationState(AnimationStateFlip180(super->animationState)); if ((gPlayerState.flags & PL_NO_CAP) == 0) { gPlayerState.animation = ANIM_PULL2; } else { @@ -1847,24 +1849,24 @@ static void sub_08072214(Entity* this) { sub_08072260(this); } -static void sub_08072260(Entity* this) { +static void sub_08072260(PlayerEntity* this) { gPlayerState.speed_modifier = 0; UpdatePlayerMovement(); - UpdateAnimationSingleFrame(this); - if (--this->timer == 0) { + UpdateAnimationSingleFrame(super); + if (--super->timer == 0) { gPlayerState.flags &= ~PL_BUSY; if ((gPlayerState.flags & PL_NO_CAP) == 0) { gPlayerState.animation = ANIM_PULL2; } else { gPlayerState.animation = ANIM_PULL_NOCAP; } - this->knockbackDuration = 0; + super->knockbackDuration = 0; SetPlayerActionNormal(); } } -static void PlayerLava(Entity* this) { - static EntityAction* const sPlayerLavaStates[] = { +static void PlayerLava(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerLavaStates[] = { PlayerLavaInit, sub_08072354, sub_080723D0, @@ -1872,25 +1874,25 @@ static void PlayerLava(Entity* this) { }; gPlayerState.framestate = PL_STATE_FALL; - sPlayerLavaStates[this->subAction](this); + sPlayerLavaStates[super->subAction](this); } -static void PlayerLavaInit(Entity* this) { +static void PlayerLavaInit(PlayerEntity* this) { Entity* ent; - COLLISION_OFF(this); + COLLISION_OFF(super); if ((gPlayerState.flags & PL_MINISH) == 0) { - this->subAction = 1; - this->zVelocity = Q_16_16(2.5); + super->subAction = 1; + super->zVelocity = Q_16_16(2.5); ent = CreateObject(LINK_FIRE, 0x80, 0); if (ent != NULL) { - ent->child = this; + ent->child = super; } gPlayerState.animation = ANIM_BOUNCE; } else { - this->spriteSettings.draw = 0; - this->subAction = 3; - this->knockbackDuration = 10; + super->spriteSettings.draw = 0; + super->subAction = 3; + super->knockbackDuration = 10; } gPlayerState.flags |= (PL_BURNING | PL_BUSY); ResetActiveItems(); @@ -1898,156 +1900,156 @@ static void PlayerLavaInit(Entity* this) { SoundReq(SFX_PLY_VO6); } -static void sub_08072354(Entity* this) { - sub_0806F854(this, 0, -12); - UpdateAnimationSingleFrame(this); - sub_08079744(this); - if (GravityUpdate(this, GRAVITY_RATE)) +static void sub_08072354(PlayerEntity* this) { + sub_0806F854(super, 0, -12); + UpdateAnimationSingleFrame(super); + sub_08079744(super); + if (GravityUpdate(super, GRAVITY_RATE)) return; - this->spritePriority.b1 = 0; - this->knockbackDuration = 0; - this->subAction = 2; - this->timer = 60; + super->spritePriority.b1 = 0; + super->knockbackDuration = 0; + super->subAction = 2; + super->timer = 60; gPlayerState.animation = ANIM_IN_LAVA; gPlayerState.flags &= ~PL_BURNING; - UpdateSpriteForCollisionLayer(this); - CreateFx(this, FX_LAVA_SPLASH, 0); + UpdateSpriteForCollisionLayer(super); + CreateFx(super, FX_LAVA_SPLASH, 0); SoundReq(SFX_1A6); } -static void sub_080723D0(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->timer-- == 0) { - this->spritePriority.b1 = 1; - this->iframes = 20; +static void sub_080723D0(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->timer-- == 0) { + super->spritePriority.b1 = 1; + super->iframes = 20; ModHealth(-2); RespawnPlayer(); } } -static void sub_0807240C(Entity* this) { - if (this->knockbackDuration-- == 0) { - this->spriteSettings.draw = 3; - this->iframes = 20; +static void sub_0807240C(PlayerEntity* this) { + if (super->knockbackDuration-- == 0) { + super->spriteSettings.draw = 3; + super->iframes = 20; gPlayerState.flags &= ~PL_BURNING; ModHealth(-2); RespawnPlayer(); } } -static void sub_08072454(Entity* this) { - static EntityAction* const gUnk_0811BB80[] = { +static void sub_08072454(PlayerEntity* this) { + static PlayerEntityAction* const gUnk_0811BB80[] = { sub_0807246C, sub_08072490, }; - gUnk_0811BB80[this->subAction](this); + gUnk_0811BB80[super->subAction](this); } -static void sub_0807246C(Entity* this) { - this->subAction = 1; - this->timer = gPlayerState.field_0x38; +static void sub_0807246C(PlayerEntity* this) { + super->subAction = 1; + super->timer = gPlayerState.field_0x38; gPlayerState.animation = ANIM_LAUNCHED; SoundReq(SFX_PLY_VO7); } -static void sub_08072490(Entity* this) { - if (this->timer-- != 0) { - UpdateAnimationSingleFrame(this); +static void sub_08072490(PlayerEntity* this) { + if (super->timer-- != 0) { + UpdateAnimationSingleFrame(super); UpdatePlayerMovement(); } else { - this->iframes = 60; + super->iframes = 60; ModHealth(-8); ResetPlayerAnimationAndAction(); } } -static void PlayerRoomTransition(Entity* this) { - static EntityAction* const sPlayerRoomTransitionStates[] = { +static void PlayerRoomTransition(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerRoomTransitionStates[] = { sub_080724DC, sub_0807258C, }; - sPlayerRoomTransitionStates[this->subAction](this); + sPlayerRoomTransitionStates[super->subAction](this); } -static void sub_080724DC(Entity* this) { - this->knockbackDuration = 0; +static void sub_080724DC(PlayerEntity* this) { + super->knockbackDuration = 0; DeleteClones(); - if (GetTileUnderEntity(this) != 0x29) { + if (GetTileUnderEntity(super) != 0x29) { if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) { - PlayerUpdateSwimming(this); + PlayerUpdateSwimming(super); } if (gRoomControls.reload_flags == 0) { - this->updatePriority = this->updatePriorityPrev; + super->updatePriority = super->updatePriorityPrev; PlayerWaitForScroll(this); } else if (gPlayerState.field_0x1c == 0) { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } else { - this->spriteSettings.draw = 3; - this->subAction = 1; + super->spriteSettings.draw = 3; + super->subAction = 1; if (gRoomVars.field_0x0 == 0) { if (gPlayerState.flags & PL_MINISH) { gPlayerState.animation = ANIM_BOUNCE_MINISH; } else { gPlayerState.animation = ANIM_WALK; } - this->direction = Direction8FromAnimationState(this->animationState); + super->direction = Direction8FromAnimationState(super->animationState); } } } -static void sub_0807258C(Entity* this) { +static void sub_0807258C(PlayerEntity* this) { if (gRoomControls.reload_flags == 0) { - if (GetCollisionTileInFront(this) == 0x29) { + if (GetCollisionTileInFront(super) == 0x29) { UpdatePlayerMovement(); if (sub_080797C4() != 0) { - gPlayerState.startPosX = gPlayerEntity.x.HALF.HI; - gPlayerState.startPosY = gPlayerEntity.y.HALF.HI; - this->updatePriority = this->updatePriorityPrev; + gPlayerState.startPosX = gPlayerEntity.base.x.HALF.HI; + gPlayerState.startPosY = gPlayerEntity.base.y.HALF.HI; + super->updatePriority = super->updatePriorityPrev; PlayerWaitForScroll(this); } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } else { - gPlayerState.startPosX = gPlayerEntity.x.HALF.HI; - gPlayerState.startPosY = gPlayerEntity.y.HALF.HI; - this->updatePriority = this->updatePriorityPrev; + gPlayerState.startPosX = gPlayerEntity.base.x.HALF.HI; + gPlayerState.startPosY = gPlayerEntity.base.y.HALF.HI; + super->updatePriority = super->updatePriorityPrev; PlayerWaitForScroll(this); } } if ((gPlayerState.remainingDiveTime == 0) && (gPlayerState.swim_state != 0)) { - PlayerUpdateSwimming(this); + PlayerUpdateSwimming(super); } } -static void PlayerRoll(Entity* this) { - static EntityAction* const sPlayerRollStates[] = { +static void PlayerRoll(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerRollStates[] = { PlayerRollInit, PlayerRollUpdate, }; gPlayerState.framestate = PL_STATE_ROLL; - sPlayerRollStates[this->subAction](this); + sPlayerRollStates[super->subAction](this); } -static void PlayerRollInit(Entity* this) { +static void PlayerRollInit(PlayerEntity* this) { u32 playerFlags; if ((gPlayerState.flags & PL_MOLDWORM_RELEASED) == 0) { - sub_0806F948(&gPlayerEntity); - this->direction = Direction8FromAnimationState(this->animationState); + sub_0806F948(&gPlayerEntity.base); + super->direction = Direction8FromAnimationState(super->animationState); } - this->subAction = 1; - this->timer = 0; + super->subAction = 1; + super->timer = 0; ResetActiveItems(); playerFlags = gPlayerState.flags; if (gPlayerState.flags & PL_MINISH) { - this->spritePriority.b1 = 0; + super->spritePriority.b1 = 0; gPlayerState.animation = ANIM_ROLL_MINISH; } else { - this->hurtType = 0x1e; + super->hurtType = 0x1e; if (playerFlags & PL_NO_CAP) { gPlayerState.animation = ANIM_ROLL_NOCAP; } else { @@ -2063,9 +2065,9 @@ static void PlayerRollInit(Entity* this) { SoundReq(SFX_7E); } -static void PlayerRollUpdate(Entity* this) { +static void PlayerRollUpdate(PlayerEntity* this) { if (((gPlayerState.flags & (PL_ROLLING | PL_MOLDWORM_CAPTURED)) != PL_ROLLING) || - (!(gPlayerState.flags & PL_MOLDWORM_RELEASED) && (this->iframes != 0) && (this->contactFlags & 0x80))) { + (!(gPlayerState.flags & PL_MOLDWORM_RELEASED) && (super->iframes != 0) && (super->contactFlags & 0x80))) { gPlayerState.flags &= ~PL_ROLLING; if (CheckQueuedAction()) return; @@ -2074,10 +2076,10 @@ static void PlayerRollUpdate(Entity* this) { return; } - this->direction = Direction8FromAnimationState(AnimationStateIdle(this->animationState)); - if (!(gPlayerState.flags & PL_MINISH) && (this->timer-- == 0)) { - CreateFx(&gPlayerEntity, FX_DASH, 0x40); - this->timer = 4; + super->direction = Direction8FromAnimationState(AnimationStateIdle(super->animationState)); + if (!(gPlayerState.flags & PL_MINISH) && (super->timer-- == 0)) { + CreateFx(&gPlayerEntity.base, FX_DASH, 0x40); + super->timer = 4; } if (!(gPlayerState.flags & PL_FLAGS2)) { UpdateFloorType(); @@ -2092,7 +2094,7 @@ static void PlayerRollUpdate(Entity* this) { return; } - if (sub_0807AC54(this)) { + if (sub_0807AC54(super)) { return; } @@ -2104,60 +2106,60 @@ static void PlayerRollUpdate(Entity* this) { if (gPlayerState.floor_type == SURFACE_ICE) { // roll in place when on ice - UpdateIcePlayerVelocity(this); + UpdateIcePlayerVelocity(super); } else { - switch (this->frame & 0xf) { + switch (super->frame & 0xf) { case 0: - if ((this->frame & 0xf) == 0) { - this->speed = ROLL_SPEED; + if ((super->frame & 0xf) == 0) { + super->speed = ROLL_SPEED; } break; case 1: - this->speed += ROLL_SPEED / 16; + super->speed += ROLL_SPEED / 16; break; case 2: - this->speed = (ROLL_SPEED * 3 / 2); + super->speed = (ROLL_SPEED * 3 / 2); break; case 3: - this->speed = 0; + super->speed = 0; break; } CheckPlayerVelocity(); UpdatePlayerMovement(); } - if (((this->frame & 0x10) == 0) && !(gPlayerState.flags & PL_MINISH)) { + if (((super->frame & 0x10) == 0) && !(gPlayerState.flags & PL_MINISH)) { // dont take damage - this->hurtType = 0; + super->hurtType = 0; } - if (this->frame & 0x40) { + if (super->frame & 0x40) { UpdateActiveItems(this); } - if ((this->frame & ANIM_DONE) || (gPlayerState.attack_status != 0)) { + if ((super->frame & ANIM_DONE) || (gPlayerState.attack_status != 0)) { ResetPlayerAnimationAndAction(); } - if (this->frame & ANIM_DONE) { + if (super->frame & ANIM_DONE) { gPlayerState.flags &= ~(PL_MOLDWORM_RELEASED | PL_ROLLING); } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -static void PlayerWaitForScroll(Entity* this) { +static void PlayerWaitForScroll(PlayerEntity* this) { ResolvePlayerAnimation(); if (gPlayerState.flags & PL_MINISH) - sub_0807B068(this); + sub_0807B068(super); else ResetPlayerVelocity(); if (gPlayerState.swim_state != 0) - this->speed = 0; + super->speed = 0; if (!(gPlayerState.flags & PL_HIDDEN)) - gPlayerEntity.spriteSettings.draw = 3; + gPlayerEntity.base.spriteSettings.draw = 3; if (!(gPlayerState.flags & PL_MINISH)) - gPlayerEntity.spritePriority.b1 = 1; + gPlayerEntity.base.spritePriority.b1 = 1; if (!(gRoomControls.scroll_flags & 4)) { if (gPlayerState.flags & PL_HIDDEN) - COLLISION_ON(this); + COLLISION_ON(super); ResetPlayerAnimationAndAction(); } if ((gPlayerState.flags & PL_FLAGS2) == 0) { @@ -2165,127 +2167,127 @@ static void PlayerWaitForScroll(Entity* this) { } } -static void PlayerInHole(Entity* this) { - static EntityAction* const sPlayerInHoleStates[] = { +static void PlayerInHole(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerInHoleStates[] = { PlayerInHoleInit, PlayerInHoleUpdate, sub_08072ACC, sub_08072B5C, sub_08072C48, }; gPlayerState.framestate = PL_STATE_HOLE; - sPlayerInHoleStates[this->subAction](this); + sPlayerInHoleStates[super->subAction](this); } -static void PlayerInHoleInit(Entity* this) { - if (this->health != 0) { - this->subAction = 1; - this->x.HALF.HI = (this->x.HALF.HI & ~0xF) | 8; - this->y.HALF.HI = (this->y.HALF.HI & ~0XF) | 10; - COLLISION_OFF(this); - this->spritePriority.b0 = 7; - this->spritePriority.b1 = 0; - this->timer = 0; +static void PlayerInHoleInit(PlayerEntity* this) { + if (super->health != 0) { + super->subAction = 1; + super->x.HALF.HI = (super->x.HALF.HI & ~0xF) | 8; + super->y.HALF.HI = (super->y.HALF.HI & ~0XF) | 10; + COLLISION_OFF(super); + super->spritePriority.b0 = 7; + super->spritePriority.b1 = 0; + super->timer = 0; gPlayerState.flags |= PL_IN_HOLE; if (gPlayerState.flags & PL_NO_CAP) { gPlayerState.animation = ANIM_FALL_IN_HOLE_NOCAP; } else { gPlayerState.animation = ANIM_FALL_IN_HOLE; - if (GetTileIndex(COORD_TO_TILE(this), this->collisionLayer) == 0x4020) { - this->timer = 1; + if (GetTileIndex(COORD_TO_TILE(super), super->collisionLayer) == 0x4020) { + super->timer = 1; } } - SetTile(0x4070, COORD_TO_TILE(this), this->collisionLayer); + SetTile(0x4070, COORD_TO_TILE(super), super->collisionLayer); ResetActiveItems(); PlayerInHoleUpdate(this); SoundReq(SFX_81); } } -static void PlayerInHoleUpdate(Entity* this) { - if (this->frame & ANIM_DONE) { - if (this->timer == 1) { - this->subAction = 3; - this->timer = 40; - this->spritePriority.b1 = 1; +static void PlayerInHoleUpdate(PlayerEntity* this) { + if (super->frame & ANIM_DONE) { + if (super->timer == 1) { + super->subAction = 3; + super->timer = 40; + super->spritePriority.b1 = 1; gPlayerState.animation = ANIM_SPRING_JUMP; return; } - this->subAction = 2; + super->subAction = 2; if (gPlayerState.flags & PL_NO_CAP) { gPlayerState.animation = ANIM_IN_HOLE_NOCAP; } else { gPlayerState.animation = ANIM_IN_HOLE; } } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } -static void sub_08072ACC(Entity* this) { +static void sub_08072ACC(PlayerEntity* this) { if (gPlayerState.direction == DIR_NONE) { - this->subtimer = 0; - } else if (this->subtimer > 7) { - COLLISION_ON(this); - this->direction = gPlayerState.direction; - this->zVelocity = JUMP_SPEED_HOLE_Z; - this->speed = JUMP_SPEED_HOLE_FWD; - this->spritePriority.b0 = 4; - this->spritePriority.b1 = 1; + super->subtimer = 0; + } else if (super->subtimer > 7) { + COLLISION_ON(super); + super->direction = gPlayerState.direction; + super->zVelocity = JUMP_SPEED_HOLE_Z; + super->speed = JUMP_SPEED_HOLE_FWD; + super->spritePriority.b0 = 4; + super->spritePriority.b1 = 1; gPlayerState.jump_status = 0x41; PlayerSetNormalAndCollide(); - RestorePrevTileEntity(COORD_TO_TILE(this), this->collisionLayer); + RestorePrevTileEntity(COORD_TO_TILE(super), super->collisionLayer); } else { - this->animationState = Direction8ToAnimationState(gPlayerState.direction); - this->subtimer++; + super->animationState = Direction8ToAnimationState(gPlayerState.direction); + super->subtimer++; } } -static void sub_08072B5C(Entity* this) { +static void sub_08072B5C(PlayerEntity* this) { u32 temp; - sub_080042BA(this, ((40 - this->timer) >> 4) + 1); - sub_0806F948(this); - if (this->timer != 0) { - this->timer--; + sub_080042BA(super, ((40 - super->timer) >> 4) + 1); + sub_0806F948(super); + if (super->timer != 0) { + super->timer--; return; } - SetTile(0x4021, COORD_TO_TILE(this), this->collisionLayer); - this->direction = Direction8FromAnimationState(this->animationState); + SetTile(0x4021, COORD_TO_TILE(super), super->collisionLayer); + super->direction = Direction8FromAnimationState(super->animationState); temp = sub_0807A2F8(1); if (!temp) { - COLLISION_ON(this); - this->spritePriority.b0 = 4; - this->speed = 0x40; - this->zVelocity = Q_16_16(3.5625); - this->z.WORD--; + COLLISION_ON(super); + super->spritePriority.b0 = 4; + super->speed = 0x40; + super->zVelocity = Q_16_16(3.5625); + super->z.WORD--; gPlayerState.jump_status = 0x41; - sub_0806F854(this, 0, -12); + sub_0806F854(super, 0, -12); PlayerSetNormalAndCollide(); return; } if (!AreaIsOverworld()) { - sub_08004542(this); + sub_08004542(super); } - this->subAction++; + super->subAction++; temp <<= 4; temp -= 4; temp <<= 12; - this->zVelocity = temp; + super->zVelocity = temp; - this->speed = JUMP_SPEED_FWD; + super->speed = JUMP_SPEED_FWD; gPlayerState.animation = ANIM_JUMP; SoundReq(SFX_PLY_JUMP); } -static void sub_08072C48(Entity* this) { - UpdateAnimationSingleFrame(this); - LinearMoveUpdate(this); - if (GravityUpdate(this, GRAVITY_RATE)) +static void sub_08072C48(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + LinearMoveUpdate(super); + if (GravityUpdate(super, GRAVITY_RATE)) return; - sub_08008790(this, 7); + sub_08008790(super, 7); if (gPlayerState.field_0x14) { if (PlayerCheckNEastTile()) { gPlayerState.surfacePositionSameTimer = 7; @@ -2298,43 +2300,43 @@ static void sub_08072C48(Entity* this) { } } -static void sub_08072C9C(Entity* this) { - static EntityAction* const gUnk_0811BBAC[] = { +static void sub_08072C9C(PlayerEntity* this) { + static PlayerEntityAction* const gUnk_0811BBAC[] = { sub_08072CC0, sub_08072CFC, sub_08072D54, sub_08072F14, }; gPlayerState.framestate = PL_STATE_11; - gUnk_0811BBAC[this->subAction](this); + gUnk_0811BBAC[super->subAction](this); } -static void sub_08072CC0(Entity* this) { - this->subAction = 1; - COLLISION_OFF(this); - this->subtimer = (gPlayerState.field_0x3a >> 2) + 1; - this->direction = gPlayerState.field_0x39; - this->speed = 0x400; +static void sub_08072CC0(PlayerEntity* this) { + super->subAction = 1; + COLLISION_OFF(super); + super->subtimer = (gPlayerState.field_0x3a >> 2) + 1; + super->direction = gPlayerState.field_0x39; + super->speed = 0x400; gPlayerState.animation = ANIM_GUSTJAR_524; gPlayerState.heldObject = 0; } -static void sub_08072CFC(Entity* this) { - sub_080042BA(this, 2); - if (this->subtimer-- != 0) { - LinearMoveUpdate(this); +static void sub_08072CFC(PlayerEntity* this) { + sub_080042BA(super, 2); + if (super->subtimer-- != 0) { + LinearMoveUpdate(super); return; } - this->subAction = 2; + super->subAction = 2; if (gPlayerState.field_0x38 < 8) { gPlayerState.field_0x38 = 8; } - this->zVelocity = gPlayerState.field_0x38 << 0xc; - this->speed = 0x200; + super->zVelocity = gPlayerState.field_0x38 << 0xc; + super->speed = 0x200; gPlayerState.animation = ANIM_JUMP; - this->timer = 5; - this->subtimer = 0; + super->timer = 5; + super->subtimer = 0; ResetActiveItems(); } @@ -2349,65 +2351,65 @@ static const u16* const sTileTable[] = { sTiles + 9, }; -static void sub_08072D54(Entity* this) { +static void sub_08072D54(PlayerEntity* this) { u32 uVar2; - UpdateAnimationSingleFrame(this); - sub_0806F854(this, 0, -12); - if (this->timer != 0) { - LinearMoveUpdate(this); - this->timer--; + UpdateAnimationSingleFrame(super); + sub_0806F854(super, 0, -12); + if (super->timer != 0) { + LinearMoveUpdate(super); + super->timer--; } else { - uVar2 = GetTileType(sub_0806F730(this), this->collisionLayer); - switch (this->subtimer) { + uVar2 = GetTileType(sub_0806F730(super), super->collisionLayer); + switch (super->subtimer) { case 0: - if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) { - this->timer = 1; - this->subtimer = 1; + if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.base.animationState >> 1])) { + super->timer = 1; + super->subtimer = 1; } break; case 1: - if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) { - this->timer = 1; + if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.base.animationState >> 1])) { + super->timer = 1; } else { - this->subtimer = 2; + super->subtimer = 2; } break; case 2: - this->animationState ^= 4; - if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1]) != 0) { - this->timer = 1; - this->subtimer = 3; + super->animationState ^= 4; + if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.base.animationState >> 1]) != 0) { + super->timer = 1; + super->subtimer = 3; } - this->animationState ^= 4; + super->animationState ^= 4; break; case 3: - this->animationState ^= 4; - if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.animationState >> 1])) { - this->timer = 1; + super->animationState ^= 4; + if (sub_08007DD6(uVar2, sTileTable[gPlayerEntity.base.animationState >> 1])) { + super->timer = 1; } else { - this->subtimer = 4; + super->subtimer = 4; } - this->animationState ^= 4; + super->animationState ^= 4; break; } - if (this->timer != 0) { - LinearMoveUpdate(this); + if (super->timer != 0) { + LinearMoveUpdate(super); } else { UpdatePlayerMovement(); } - this->timer = 0; + super->timer = 0; } - if (!GravityUpdate(this, GRAVITY_RATE)) { - COLLISION_ON(this); - if (this->collisionLayer == 1) { - ResetCollisionLayer(this); + if (!GravityUpdate(super, GRAVITY_RATE)) { + COLLISION_ON(super); + if (super->collisionLayer == 1) { + ResetCollisionLayer(super); } else { - sub_08004542(this); + sub_08004542(super); } - sub_08008790(this, 7); + sub_08008790(super, 7); if (gPlayerState.field_0x14 != 0) { if (PlayerCheckNEastTile()) { gPlayerState.surfacePositionSameTimer = 7; @@ -2421,45 +2423,45 @@ static void sub_08072D54(Entity* this) { } else { gPlayerState.animation = ANIM_LAND; } - this->timer = 6; - this->subAction = 3; - this->knockbackDuration = 0; + super->timer = 6; + super->subAction = 3; + super->knockbackDuration = 0; SoundReq(SFX_PLY_LAND); } } } -static void sub_08072F14(Entity* this) { - if (this->timer-- != 0) { +static void sub_08072F14(PlayerEntity* this) { + if (super->timer-- != 0) { PlayerSetNormalAndCollide(); } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } -static void PlayerClimb(Entity* this) { - static EntityAction* const sPlayerClimbStates[] = { +static void PlayerClimb(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerClimbStates[] = { sub_08072F94, sub_08073094, }; if (!CheckQueuedAction()) { gPlayerState.framestate = PL_STATE_CLIMB; - gPlayerState.floor_type = GetSurfaceCalcType(this, 0, 0); - sPlayerClimbStates[this->subAction](this); - if (this->knockbackDuration != 0) { + gPlayerState.floor_type = GetSurfaceCalcType(super, 0, 0); + sPlayerClimbStates[super->subAction](this); + if (super->knockbackDuration != 0) { sub_080792D8(); - if (this->knockbackDuration == 0) { - this->action = PLAYER_CLIMB; - this->subAction = 0; - this->y.HALF.LO = 0; + if (super->knockbackDuration == 0) { + super->action = PLAYER_CLIMB; + super->subAction = 0; + super->y.HALF.LO = 0; gPlayerState.animation = ANIM_CLIMB1_UP; } } } } -static void sub_08072F94(Entity* this) { +static void sub_08072F94(PlayerEntity* this) { u32 direction; switch (gPlayerState.floor_type) { @@ -2470,15 +2472,15 @@ static void sub_08072F94(Entity* this) { case SURFACE_AUTO_LADDER: case SURFACE_CLIMB_WALL: case SURFACE_2C: - this->spritePriority.b1 = 0; + super->spritePriority.b1 = 0; direction = gPlayerState.direction; if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) == 0) { - this->direction = gPlayerState.direction; + super->direction = gPlayerState.direction; if ((gPlayerState.direction == DirectionEast) || (gPlayerState.direction == DirectionWest)) { if (gPlayerState.floor_type == SURFACE_LADDER) { return; } - if ((this->frame & 0x10)) { + if ((super->frame & 0x10)) { gPlayerState.animation = ANIM_CLIMB_LEFT; } else { gPlayerState.animation = ANIM_CLIMB_RIGHT; @@ -2486,25 +2488,25 @@ static void sub_08072F94(Entity* this) { sub_08073094(this); } else { if ((gPlayerState.floor_type == SURFACE_LADDER) && ((direction & (DIR_DIAGONAL | 0x3)) != 0)) { - this->direction = (direction + 8) & DirectionSouth; + super->direction = (direction + 8) & DirectionSouth; } - if (this->direction & DirectionSouth) { - if (this->frame & 0x10) { + if (super->direction & DirectionSouth) { + if (super->frame & 0x10) { gPlayerState.animation = ANIM_CLIMB1_DOWN; } else { gPlayerState.animation = ANIM_CLIMB2_DOWN; } } else { - if (this->frame & 0x10) { + if (super->frame & 0x10) { gPlayerState.animation = ANIM_CLIMB1_UP; } else { gPlayerState.animation = ANIM_CLIMB2_UP; } } } - this->subAction++; + super->subAction++; } else { - if (this->frame & 0x10) { + if (super->frame & 0x10) { gPlayerState.animation = ANIM_CLIMB_LEFT; } else { gPlayerState.animation = ANIM_CLIMB_RIGHT; @@ -2514,13 +2516,13 @@ static void sub_08072F94(Entity* this) { } } -static void sub_08073094(Entity* this) { +static void sub_08073094(PlayerEntity* this) { static const u16 sSpeeds[] = { 0x0, 0x40, 0x60, 0x80, 0x100, 0xC0, }; - this->spritePriority.b1 = 0; - this->speed = sSpeeds[this->frame & 0xf]; + super->spritePriority.b1 = 0; + super->speed = sSpeeds[super->frame & 0xf]; UpdatePlayerMovement(); if (!UpdatePlayerCollision()) { gPlayerState.pushedObject ^= 0x80; @@ -2532,13 +2534,13 @@ static void sub_08073094(Entity* this) { switch (gPlayerState.floor_type) { case SURFACE_AUTO_LADDER: case SURFACE_2C: - this->knockbackDuration = 0; + super->knockbackDuration = 0; gPlayerState.flags |= PL_CLIMBING; - UpdateAnimationSingleFrame(this); - if (this->frame & 0x40) { + UpdateAnimationSingleFrame(super); + if (super->frame & 0x40) { UpdateFloorType(); if (!CheckQueuedAction()) { - this->subAction--; + super->subAction--; } } break; @@ -2551,11 +2553,11 @@ static void sub_08073094(Entity* this) { break; case SURFACE_LADDER: case SURFACE_CLIMB_WALL: - UpdateAnimationSingleFrame(this); - if (this->frame & 0x40) { + UpdateAnimationSingleFrame(super); + if (super->frame & 0x40) { UpdateFloorType(); if (!CheckQueuedAction()) { - this->subAction--; + super->subAction--; } } break; @@ -2564,8 +2566,8 @@ static void sub_08073094(Entity* this) { } } -static void PlayerUseEntrance(Entity* this) { - static EntityAction* const sPlayerUseEntranceStates[] = { +static void PlayerUseEntrance(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerUseEntranceStates[] = { PlayerUseStairs, sub_080732D0, sub_0807332C, @@ -2574,37 +2576,37 @@ static void PlayerUseEntrance(Entity* this) { gPlayerState.framestate = PL_STATE_STAIRS; RequestPriorityDuration(NULL, 8); - sPlayerUseEntranceStates[this->subAction](this); + sPlayerUseEntranceStates[super->subAction](this); } -static void PlayerUseStairs(Entity* this) { - COLLISION_OFF(this); - this->speed = 0x40; - this->animationState = IdleNorth; - this->x.HALF.HI = (this->x.HALF.HI & ~0xF) | 8; - this->x.HALF.LO = 0; +static void PlayerUseStairs(PlayerEntity* this) { + COLLISION_OFF(super); + super->speed = 0x40; + super->animationState = IdleNorth; + super->x.HALF.HI = (super->x.HALF.HI & ~0xF) | 8; + super->x.HALF.LO = 0; if (gPlayerState.field_0x38 == 0) { - this->subAction = 1; + super->subAction = 1; } else { - this->spriteSettings.draw = 3; - this->subAction = 3; - this->field_0x7c.HALF.HI = this->y.HALF.HI; - this->y.HALF.HI -= 16; - this->child = CreateObjectWithParent(this, OBJECT_70, 1, 0); + super->spriteSettings.draw = 3; + super->subAction = 3; + this->unk_7c.HALF.HI = super->y.HALF.HI; + super->y.HALF.HI -= 16; + super->child = CreateObjectWithParent(super, OBJECT_70, 1, 0); if (gPlayerState.field_0x39 == 7) { - this->y.HALF.HI = (this->y.HALF.HI & ~0xF) + 8; - this->x.HALF.HI &= ~0xF; - this->direction = DirectionEast; - this->animationState = IdleEast; + super->y.HALF.HI = (super->y.HALF.HI & ~0xF) + 8; + super->x.HALF.HI &= ~0xF; + super->direction = DirectionEast; + super->animationState = IdleEast; SoundReq(SFX_STAIRS_ASCEND); } else { - this->y.HALF.HI = (this->y.HALF.HI & ~0xF) + 2; - this->x.HALF.HI = (this->x.HALF.HI & ~0xF) + 15; - this->direction = DirectionWest; - this->animationState = IdleWest; + super->y.HALF.HI = (super->y.HALF.HI & ~0xF) + 2; + super->x.HALF.HI = (super->x.HALF.HI & ~0xF) + 15; + super->direction = DirectionWest; + super->animationState = IdleWest; SoundReq(SFX_STAIRS_DESCEND); } - SetZeldaFollowTarget(this); + SetZeldaFollowTarget(super); } if (gPlayerState.flags & PL_NO_CAP) { gPlayerState.animation = ANIM_WALK_NOCAP; @@ -2616,15 +2618,15 @@ static void PlayerUseStairs(Entity* this) { ResetActiveItems(); } -static void sub_080732D0(Entity* this) { - UpdateAnimationSingleFrame(this); - if (GetTileUnderEntity(this) != 40) { - this->direction = DirectionNorth; - LinearMoveUpdate(this); +static void sub_080732D0(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (GetTileUnderEntity(super) != 40) { + super->direction = DirectionNorth; + LinearMoveUpdate(super); } else { - this->subAction++; - this->y.HALF.LO = 0; - CreateObjectWithParent(this, OBJECT_70, 1, 0); + super->subAction++; + super->y.HALF.LO = 0; + CreateObjectWithParent(super, OBJECT_70, 1, 0); if (gPlayerState.field_0x39 == 7) { SoundReq(SFX_STAIRS_ASCEND); } else { @@ -2633,31 +2635,31 @@ static void sub_080732D0(Entity* this) { } } -static void sub_0807332C(Entity* this) { - UpdateAnimationSingleFrame(this); +static void sub_0807332C(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); if (gPlayerState.field_0x39 == 7) { - this->direction = IdleNorth; + super->direction = IdleNorth; } else { - this->direction = DirectionNorthWest; + super->direction = DirectionNorthWest; } - if ((this->x.HALF.HI & 0xF) != 0xF) { + if ((super->x.HALF.HI & 0xF) != 0xF) { if (gPlayerState.field_0x39 == 7) { - this->animationState = IdleEast; - this->direction = DIR_DIAGONAL; + super->animationState = IdleEast; + super->direction = DIR_DIAGONAL; } else { - this->animationState = IdleWest; - if (this->direction <= DirectionWest) { - LinearMoveUpdate(this); + super->animationState = IdleWest; + if (super->direction <= DirectionWest) { + LinearMoveUpdate(super); return; } - this->direction = (this->direction - 1) & - (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); + super->direction = (super->direction - 1) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); } - LinearMoveUpdate(this); + LinearMoveUpdate(super); return; } if (gPlayerState.field_0x38 != 0) { - gRoomControls.camera_target = this; + gRoomControls.camera_target = super; SetPlayerActionNormal(); } else { gMain.substate = GAMEMAIN_CHANGEAREA; @@ -2666,91 +2668,91 @@ static void sub_0807332C(Entity* this) { } } -static void sub_080733BC(Entity* this) { - UpdateAnimationSingleFrame(this); - if ((this->x.HALF.HI & 0xF) == 8) { +static void sub_080733BC(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if ((super->x.HALF.HI & 0xF) == 8) { Entity* c; - this->direction = DirectionSouth; - this->animationState = IdleSouth; - c = this->child; + super->direction = DirectionSouth; + super->animationState = IdleSouth; + c = super->child; if (c != NULL) { DeleteEntity(c); - this->child = NULL; - if (this->collisionLayer == 1) { - sub_0807AABC(this); + super->child = NULL; + if (super->collisionLayer == 1) { + sub_0807AABC(super); } else { - sub_0807AA80(this); + sub_0807AA80(super); } } } - LinearMoveUpdate(this); - if (this->field_0x7c.HALF_U.HI == this->y.HALF.HI) { - gRoomControls.camera_target = this; + LinearMoveUpdate(super); + if (this->unk_7c.HALF_U.HI == super->y.HALF.HI) { + gRoomControls.camera_target = super; PlayerSetNormalAndCollide(); } } -static void PlayerParachute(Entity* this) { - static EntityAction* const sPlayerParachuteStates[] = { +static void PlayerParachute(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerParachuteStates[] = { sub_08073468, sub_080734D4, sub_08073504, sub_08073584, sub_0807379C, sub_080737BC, sub_0807380C, sub_08073884, }; if (!CheckQueuedAction()) { UpdateFloorType(); - this->spriteOrientation.flipY = 1; - this->spriteRendering.b3 = 1; + super->spriteOrientation.flipY = 1; + super->spriteRendering.b3 = 1; gPlayerState.framestate = PL_STATE_PARACHUTE; - sPlayerParachuteStates[this->subAction](this); + sPlayerParachuteStates[super->subAction](this); } } -static void sub_08073468(Entity* this) { +static void sub_08073468(PlayerEntity* this) { gPlayerState.animation = ANIM_PARACHUTE_ACTIVATE; gPlayerState.jump_status = 0; - this->zVelocity = Q_16_16(-1.0); - this->subAction++; - this->field_0x7c.WORD = 480; - this->direction = Direction8FromAnimationState(this->animationState); + super->zVelocity = Q_16_16(-1.0); + super->subAction++; + this->unk_7c.WORD = 480; + super->direction = Direction8FromAnimationState(super->animationState); if ((gPlayerState.flags & PL_PARACHUTE) == 0) { gPlayerState.flags |= PL_PARACHUTE; - CreateObjectWithParent(this, EZLO_CAP_FLYING, 0, 0); + CreateObjectWithParent(super, EZLO_CAP_FLYING, 0, 0); } ResetActiveItems(); - if (this->zVelocity > 0 || gPlayerState.field_0x38 == 1) - COLLISION_OFF(this); + if (super->zVelocity > 0 || gPlayerState.field_0x38 == 1) + COLLISION_OFF(super); } -static void sub_080734D4(Entity* this) { - GravityUpdate(this, -(GRAVITY_RATE / 2)); - if (this->zVelocity > 0 || gPlayerState.field_0x38 == 1) { - this->zVelocity = Q_16_16(4.5625); - this->subAction++; +static void sub_080734D4(PlayerEntity* this) { + GravityUpdate(super, -(GRAVITY_RATE / 2)); + if (super->zVelocity > 0 || gPlayerState.field_0x38 == 1) { + super->zVelocity = Q_16_16(4.5625); + super->subAction++; } } -static void sub_08073504(Entity* this) { - GravityUpdate(this, this->zVelocity < 0 ? GRAVITY_RATE / 4 : GRAVITY_RATE * 2); - if (this->zVelocity < 0 && this->z.HALF.HI > -32) { - this->subAction++; - *((u32*)&this->field_0x80.HWORD) = this->direction << 8; - this->field_0x86.HALF.HI = 0; - this->field_0x86.HALF.LO = 0; +static void sub_08073504(PlayerEntity* this) { + GravityUpdate(super, super->zVelocity < 0 ? GRAVITY_RATE / 4 : GRAVITY_RATE * 2); + if (super->zVelocity < 0 && super->z.HALF.HI > -32) { + super->subAction++; + this->unk_80.WORD = super->direction << 8; + this->unk_84.BYTES.byte3 = 0; + this->unk_84.BYTES.byte2 = 0; gPlayerState.animation = ANIM_PARACHUTE; if (gPlayerState.field_0x38 == 1) { - COLLISION_OFF(this); - this->subAction = 6; - this->speed = 16; - this->timer = 30; + COLLISION_OFF(super); + super->subAction = 6; + super->speed = 16; + super->timer = 30; SoundReq(SFX_NEAR_PORTAL); } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -static void sub_08073584(Entity* this) { +static void sub_08073584(PlayerEntity* this) { u32 state, dir, idx; - if ((gPlayerState.playerInput.newInput & INPUT_ACTION) || this->iframes > 0 || gPlayerState.field_0x3c || + if ((gPlayerState.playerInput.newInput & INPUT_ACTION) || super->iframes > 0 || gPlayerState.field_0x3c || (gPlayerState.flags & PL_PARACHUTE) == 0) { gPlayerState.jump_status |= 0x40; PlayerSetNormalAndCollide(); @@ -2761,53 +2763,53 @@ static void sub_08073584(Entity* this) { gUnk_0200AF00.rActionPlayerState = R_ACTION_CANCEL; if (sub_0807A2F8(0)) { - this->subAction++; - this->direction = 4 * (this->animationState & IdleWest); - COLLISION_OFF(this); + super->subAction++; + super->direction = 4 * (super->animationState & IdleWest); + COLLISION_OFF(super); return; } if (gArea.locationIndex == 16) - this->speed = 0x100; + super->speed = 0x100; else - this->speed = 0x80; + super->speed = 0x80; if ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) == 0) { - if (this->direction != gPlayerState.direction) { - if (((this->direction - gPlayerState.direction) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | - DirectionSouth | DirectionWest)) < DirectionSouth) - *(u32*)&this->field_0x80 -= 0x20; + if (super->direction != gPlayerState.direction) { + if (((super->direction - gPlayerState.direction) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | + DirectionSouth | DirectionWest)) < DirectionSouth) + this->unk_80.WORD_U -= 0x20; else - *(u32*)&this->field_0x80 += 0x20; + this->unk_80.WORD_U += 0x20; } } - this->direction = (*(u32*)&this->field_0x80 >> 8) & - (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); + super->direction = (this->unk_80.WORD_U >> 8) & + (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); UpdatePlayerMovement(); - state = 4 * this->animationState; - dir = this->direction; - if (this->animationState == IdleNorth) { + state = 4 * super->animationState; + dir = super->direction; + if (super->animationState == IdleNorth) { state = (state + 8) & 0x1F; dir = (dir + 8) & (0x3 | DIR_DIAGONAL | DirectionNorth | DirectionEast | DirectionSouth | DirectionWest); } if (state - 7 > dir) { - state = (this->animationState - 2) & 7; + state = (super->animationState - 2) & 7; } else if (state + 7 < dir) { - state = (this->animationState + 2) & 7; + state = (super->animationState + 2) & 7; } else { - state = this->animationState; + state = super->animationState; } - if (state != this->animationState) { - this->field_0x86.HALF.HI = 20; + if (state != super->animationState) { + this->unk_84.BYTES.byte3 = 20; } - this->animationState = state; + super->animationState = state; idx = 0; state = gPlayerState.direction >> 2; - if (!this->field_0x86.HALF.HI || - ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) == 0 && this->animationState != state)) { + if (!this->unk_84.BYTES.byte3 || + ((gPlayerState.direction & DIR_NOT_MOVING_CHECK) == 0 && super->animationState != state)) { static const u16 sAnims1[] = { ANIM_PARACHUTE, ANIM_PARACHUTE_TURN_LEFT, @@ -2816,12 +2818,12 @@ static void sub_08073584(Entity* this) { }; if (!(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) { - if (this->animationState != state) { - if (this->animationState == (state ^ 4)) { + if (super->animationState != state) { + if (super->animationState == (state ^ 4)) { idx = 2; } else { - if (this->animationState == (((state & 6) + 2) & 7)) { + if (super->animationState == (((state & 6) + 2) & 7)) { idx = 1; } else { idx = 3; @@ -2832,13 +2834,13 @@ static void sub_08073584(Entity* this) { if (sAnims1[idx] == gPlayerState.animation) { if (gArea.locationIndex == 16) - sub_080042BA(this, 2); + sub_080042BA(super, 2); else - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } else { gPlayerState.animation = sAnims1[idx]; } - this->field_0x86.HALF.LO = idx; + this->unk_84.BYTES.byte2 = idx; } else { static const u16 sAnims2[] = { ANIM_PARACHUTE, @@ -2847,50 +2849,50 @@ static void sub_08073584(Entity* this) { ANIM_PARACHUTE_TURN2_RIGHT, }; - this->field_0x86.HALF.HI--; - if (sAnims2[this->field_0x86.HALF.LO] == gPlayerState.animation) - UpdateAnimationSingleFrame(this); + this->unk_84.BYTES.byte3--; + if (sAnims2[this->unk_84.BYTES.byte2] == gPlayerState.animation) + UpdateAnimationSingleFrame(super); else - gPlayerState.animation = sAnims2[this->field_0x86.HALF.LO]; + gPlayerState.animation = sAnims2[this->unk_84.BYTES.byte2]; } - if (--this->field_0x7c.WORD == -1) { + if (--this->unk_7c.WORD_U == -1) { gPlayerState.jump_status |= 0x40; PlayerSetNormalAndCollide(); } else { - u32 di = (this->field_0x7c.WORD / 20); - this->z.HALF.HI = -8 - di; + u32 di = (this->unk_7c.WORD / 20); + super->z.HALF.HI = -8 - di; } } -static void sub_0807379C(Entity* this) { - if (this->z.HALF.HI > -32) { - this->z.HALF.HI--; +static void sub_0807379C(PlayerEntity* this) { + if (super->z.HALF.HI > -32) { + super->z.HALF.HI--; } else { - this->subAction++; + super->subAction++; } } -static void sub_080737BC(Entity* this) { +static void sub_080737BC(PlayerEntity* this) { u16 pos; u32 tmp; - UpdateAnimationSingleFrame(this); - LinearMoveUpdate(this); - this->z.WORD += Q_16_16(0.296875); - if (DirectionIsHorizontal(this->direction)) - pos = this->x.HALF.HI; + UpdateAnimationSingleFrame(super); + LinearMoveUpdate(super); + super->z.WORD += Q_16_16(0.296875); + if (DirectionIsHorizontal(super->direction)) + pos = super->x.HALF.HI; else - pos = this->y.HALF.HI; + pos = super->y.HALF.HI; tmp = 0xf; tmp &= pos; - if (tmp == 8 && !sub_080B1B0C(this)) { + if (tmp == 8 && !sub_080B1B0C(super)) { gPlayerState.jump_status |= 0x40; PlayerSetNormalAndCollide(); } } -static void sub_0807380C(Entity* this) { +static void sub_0807380C(PlayerEntity* this) { static const u16 sAnims[] = { ANIM_PARACHUTE, ANIM_PARACHUTE_TURN_LEFT, @@ -2899,24 +2901,24 @@ static void sub_0807380C(Entity* this) { }; if ((gRoomTransition.frameCount & 3) == 0) { - u32 tmp = (this->animationState + 2) & IdleWest; - this->animationState = tmp; - this->direction = 4 * tmp; + u32 tmp = (super->animationState + 2) & IdleWest; + super->animationState = tmp; + super->direction = 4 * tmp; } - gPlayerState.animation = sAnims[this->animationState >> 1]; - if (this->z.HALF.HI < -16) { - GravityUpdate(this, GRAVITY_RATE / 16); + gPlayerState.animation = sAnims[super->animationState >> 1]; + if (super->z.HALF.HI < -16) { + GravityUpdate(super, GRAVITY_RATE / 16); } else { - if (--this->timer == 0) { - this->subAction = 7; - this->timer = 60; - this->zVelocity = Q_16_16(2.0); + if (--super->timer == 0) { + super->subAction = 7; + super->timer = 60; + super->zVelocity = Q_16_16(2.0); } } - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } -void sub_08073884(Entity* this) { +void sub_08073884(PlayerEntity* this) { static const u16 sAnims[] = { ANIM_PARACHUTE, ANIM_PARACHUTE_TURN_LEFT, @@ -2925,42 +2927,42 @@ void sub_08073884(Entity* this) { }; if ((gRoomTransition.frameCount & 1) == 0) { - u32 tmp = (this->animationState + 2) & IdleWest; - this->animationState = tmp; - this->direction = 4 * tmp; + u32 tmp = (super->animationState + 2) & IdleWest; + super->animationState = tmp; + super->direction = 4 * tmp; } - gPlayerState.animation = sAnims[this->animationState >> 1]; - if (--this->timer == 0) { + gPlayerState.animation = sAnims[super->animationState >> 1]; + if (--super->timer == 0) { if (gPlayerState.field_0x39 != 0xff) DoExitTransition(&gUnk_0813AD88[gPlayerState.field_0x39]); else InitParachuteRoom(); } - GravityUpdate(this, -((GRAVITY_RATE * 3) / 4)); - UpdateAnimationSingleFrame(this); + GravityUpdate(super, -((GRAVITY_RATE * 3) / 4)); + UpdateAnimationSingleFrame(super); } -static void DoJump(Entity* this) { - static EntityAction* const sStates[] = { +static void DoJump(PlayerEntity* this) { + static PlayerEntityAction* const sStates[] = { sub_08073924, sub_08073968, sub_080739EC, sub_08073A94, sub_08073B8C, sub_08073C30, }; sStates[gPlayerState.jump_status & 7](this); } -static void sub_08073924(Entity* this) { - if (!(gPlayerState.flags & PL_ROLLING) && (this->z.HALF.HI & 0x8000) && !gPlayerState.field_0xa) { +static void sub_08073924(PlayerEntity* this) { + if (!(gPlayerState.flags & PL_ROLLING) && (super->z.HALF.HI & 0x8000) && !gPlayerState.field_0xa) { gPlayerState.jump_status = 0x40; gPlayerState.direction = DIR_NONE; - this->direction = DIR_NONE; + super->direction = DIR_NONE; PutAwayItems(); sub_08073968(this); } } -static void sub_08073968(Entity* this) { +static void sub_08073968(PlayerEntity* this) { if ((gPlayerState.jump_status & 0xC0) == 0) { - this->direction = gPlayerState.direction; + super->direction = gPlayerState.direction; } CheckPlayerVelocity(); if ((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) { @@ -2976,23 +2978,23 @@ static void sub_08073968(Entity* this) { } } if ((gPlayerState.jump_status & 0xC0) == 0) { - sub_0806F948(this); + sub_0806F948(super); } SoundReq(SFX_PLY_JUMP); } gPlayerState.jump_status = (gPlayerState.jump_status & ~7) | 2; } -static void sub_080739EC(Entity* this) { +static void sub_080739EC(PlayerEntity* this) { u32 v; if ((gPlayerState.jump_status & 0xC0) != 0) { - gPlayerState.direction = this->direction; + gPlayerState.direction = super->direction; if (gPlayerState.jump_status & 0x80) - this->collisions = COL_NONE; + super->collisions = COL_NONE; v = GRAVITY_RATE; } else { - if ((u16)sub_0806F854(this, 0, -12)) { + if ((u16)sub_0806F854(super, 0, -12)) { gPlayerState.jump_status |= 8; v = GRAVITY_RATE * 2; } else { @@ -3002,39 +3004,39 @@ static void sub_080739EC(Entity* this) { } } if ((gPlayerState.jump_status & 0xC0) == 0) { - if ((gPlayerState.jump_status & 0x20) && this->zVelocity == 0) { - this->zVelocity = Q_16_16(2.5); - this->timer = 10; - this->direction = DIR_NONE; + if ((gPlayerState.jump_status & 0x20) && super->zVelocity == 0) { + super->zVelocity = Q_16_16(2.5); + super->timer = 10; + super->direction = DIR_NONE; gPlayerState.jump_status += 2; gPlayerState.animation = ANIM_DOWN_THRUST; ResetPlayerVelocity(); return; } } - if (!GravityUpdate(this, v)) + if (!GravityUpdate(super, v)) sub_08073AD4(this); } -void sub_08073A94(Entity* this) { - if ((this->frame & ANIM_DONE) || this->knockbackDuration != 0) { +void sub_08073A94(PlayerEntity* this) { + if ((super->frame & ANIM_DONE) || super->knockbackDuration != 0) { sub_08073B60(this); } - if (gPlayerEntity.z.WORD != 0) { + if (gPlayerEntity.base.z.WORD != 0) { gPlayerState.jump_status = 0; sub_08073924(this); } } -static void sub_08073AD4(Entity* this) { +static void sub_08073AD4(PlayerEntity* this) { u32 tmp; - if ((this->collisionLayer & 2) == 0) { - this->spriteOrientation.flipY = 2; - this->spriteRendering.b3 = 2; + if ((super->collisionLayer & 2) == 0) { + super->spriteOrientation.flipY = 2; + super->spriteRendering.b3 = 2; } tmp = (gPlayerState.jump_status & ~0xC0); - if (this->action != PLAYER_MINISHDIE) { + if (super->action != PLAYER_MINISHDIE) { sub_0807A2B8(); gPlayerState.jump_status = 0; UpdateFloorType(); @@ -3052,95 +3054,95 @@ static void sub_08073AD4(Entity* this) { SoundReq(SFX_PLY_LAND); } -static void sub_08073B60(Entity* this) { +static void sub_08073B60(PlayerEntity* this) { gPlayerState.sword_state = 0; gPlayerState.attack_status = 0; gPlayerState.jump_status = 0; ResolvePlayerAnimation(); - sub_080085B0(this); + sub_080085B0(super); if ((gPlayerState.flags & PL_USE_PORTAL) == 0) { SetPlayerActionNormal(); } } -void sub_08073B8C(Entity* this) { +void sub_08073B8C(PlayerEntity* this) { if (!gPlayerState.attack_status) { sub_08073B60(this); return; } - sub_0806F854(this, 0, -12); - if ((this->frame & 1) == 0) - UpdateAnimationSingleFrame(this); - COLLISION_OFF(this); - if (this->timer != 0) { - --this->timer; + sub_0806F854(super, 0, -12); + if ((super->frame & 1) == 0) + UpdateAnimationSingleFrame(super); + COLLISION_OFF(super); + if (super->timer != 0) { + --super->timer; return; } - GravityUpdate(this, GRAVITY_RATE * 2); - if (this->z.HALF.HI >= -8) { + GravityUpdate(super, GRAVITY_RATE * 2); + if (super->z.HALF.HI >= -8) { if (!gPlayerState.field_0x14 && (sub_0807A2B8() || !sub_08079D48())) { - COLLISION_ON(this); + COLLISION_ON(super); sub_08073B60(this); return; } gPlayerState.jump_status++; - this->timer = 15; + super->timer = 15; InitScreenShake(16, 0); SoundReq(SFX_14C); } } -void sub_08073C30(Entity* this) { - if (!gPlayerState.attack_status || this->timer-- == 0) { +void sub_08073C30(PlayerEntity* this) { + if (!gPlayerState.attack_status || super->timer-- == 0) { sub_08073B60(this); } else { - COLLISION_ON(this); - UpdateAnimationSingleFrame(this); + COLLISION_ON(super); + UpdateAnimationSingleFrame(super); } } -static void PlayerMinish(Entity* this) { - static EntityAction* const sPlayerMinishStates[] = { +static void PlayerMinish(PlayerEntity* this) { + static PlayerEntityAction* const sPlayerMinishStates[] = { sub_08073C80, sub_08073D20, sub_08073F04, sub_08073F4C, sub_08073FD0, sub_08074018, sub_08074060, sub_080740D8, }; - sPlayerMinishStates[this->subAction](this); + sPlayerMinishStates[super->subAction](this); } -static void sub_08073C80(Entity* this) { +static void sub_08073C80(PlayerEntity* this) { static const Hitbox sMinishHitbox = { 0, -1, { 3, 2, 2, 3 }, 2, 2 }; gPlayerState.flags |= PL_MINISH; gPlayerState.animation = ANIM_BOUNCE_MINISH; - this->spriteSettings.draw = 3; - this->spritePriority.b1 = 3; - this->spriteSettings.shadow = 0; - this->spriteRendering.b0 = 0; - this->hitbox = (Hitbox*)&sMinishHitbox; - this->timer = 0; - this->subtimer = 2; - this->knockbackDuration = 0; - this->subAction = 1; - LoadSwapGFX(this, 1, 2); - gRoomControls.camera_target = this; + super->spriteSettings.draw = 3; + super->spritePriority.b1 = 3; + super->spriteSettings.shadow = 0; + super->spriteRendering.b0 = 0; + super->hitbox = (Hitbox*)&sMinishHitbox; + super->timer = 0; + super->subtimer = 2; + super->knockbackDuration = 0; + super->subAction = 1; + LoadSwapGFX(super, 1, 2); + gRoomControls.camera_target = super; sub_080809D4(); if (gRoomTransition.player_status.spawn_type == PL_SPAWN_9) { gRoomTransition.player_status.spawn_type = PL_SPAWN_DEFAULT; - this->spriteSettings.draw = 0; - this->subAction = 2; + super->spriteSettings.draw = 0; + super->subAction = 2; } else { CreateObject(MINISH_EMOTICON, 0, 0); } } -static void sub_08073D20(Entity* this) { +static void sub_08073D20(PlayerEntity* this) { gPlayerState.framestate = PL_STATE_IDLE; - this->spritePriority.b1 = 3; - this->hurtType = 1; + super->spritePriority.b1 = 3; + super->hurtType = 1; ResetPlayerVelocity(); if (!gPlayerState.swim_state) - this->speed = 0xC0; /* todo: shielding speed? */ + super->speed = 0xC0; /* todo: shielding speed? */ if (!sub_08079B24()) { - sub_08079708(this); + sub_08079708(super); return; } if (!CheckQueuedAction()) { @@ -3150,36 +3152,36 @@ static void sub_08073D20(Entity* this) { gPlayerState.framestate = PL_STATE_CAPE; if (gPlayerState.floor_type != SURFACE_SHALLOW_WATER && gPlayerState.floor_type != SURFACE_WATER) { gPlayerState.swim_state = 0; - this->collisionFlags &= ~4; + super->collisionFlags &= ~4; } - if (!CheckQueuedAction() && this->subAction != 2) { + if (!CheckQueuedAction() && super->subAction != 2) { if ((gPlayerState.flags & PL_HIDDEN) == 0) { - sub_080085B0(this); + sub_080085B0(super); sub_080792D8(); if (!gPlayerState.field_0xa && sub_08079550()) return; - if (this->knockbackDuration) { - this->direction = this->knockbackDirection; + if (super->knockbackDuration) { + super->direction = super->knockbackDirection; return; } if (sub_080782C0()) { CheckQueuedAction(); return; } - COLLISION_ON(this); + COLLISION_ON(super); } if (!UpdatePlayerCollision()) { - UpdateActiveItems(this); - if (!GravityUpdate(this, GRAVITY_RATE)) + UpdateActiveItems(super); + if (!GravityUpdate(super, GRAVITY_RATE)) gPlayerState.jump_status = 0; if ((gPlayerState.field_0x7 & 0x80) == 0 && !gPlayerState.field_0xa) { - if (this->iframes <= 8) { + if (super->iframes <= 8) { if (gPlayerState.swim_state) { gPlayerState.framestate = PL_STATE_SWIM; - PlayerSwimming(this); + PlayerSwimming(super); UpdatePlayerMovement(); } else { - this->direction = gPlayerState.direction; + super->direction = gPlayerState.direction; if (!(gPlayerState.direction & DIR_NOT_MOVING_CHECK)) { gPlayerState.framestate = PL_STATE_WALK; UpdatePlayerMovement(); @@ -3187,19 +3189,19 @@ static void sub_08073D20(Entity* this) { } } if (!gPlayerState.keepFacing) - sub_0806F948(this); - UpdateAnimationSingleFrame(this); - sub_0807B068(this); + sub_0806F948(super); + UpdateAnimationSingleFrame(super); + sub_0807B068(super); if (sub_080793E4(16)) { - this->iframes = 20; - this->knockbackDuration = 4; - this->knockbackDirection = - DirectionTurnAround(Direction8FromAnimationState(this->animationState)); + super->iframes = 20; + super->knockbackDuration = 4; + super->knockbackDirection = + DirectionTurnAround(Direction8FromAnimationState(super->animationState)); ModHealth(-2); SoundReq(SFX_PLY_VO6); } if ((gPlayerState.flags & PL_HIDDEN) == 0) - sub_08008AC6(this); + sub_08008AC6(super); else gPlayerState.framestate = PL_STATE_D; } @@ -3208,121 +3210,121 @@ static void sub_08073D20(Entity* this) { } } -static void sub_08073F04(Entity* this) { - this->spritePriority.b1 = 2; - this->spriteSettings.draw = 0; - this->subAction++; - this->zVelocity = Q_16_16(2.5); - this->speed = 0x100; +static void sub_08073F04(PlayerEntity* this) { + super->spritePriority.b1 = 2; + super->spriteSettings.draw = 0; + super->subAction++; + super->zVelocity = Q_16_16(2.5); + super->speed = 0x100; gPlayerState.flags &= ~PL_MINISH; ResetActiveItems(); } -static void sub_08073F4C(Entity* this) { +static void sub_08073F4C(PlayerEntity* this) { u32 x = gArea.portal_x; u32 y = gArea.portal_y; - if (this->x.HALF.HI != x || this->y.HALF.HI != y) { - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gArea.portal_x, gArea.portal_y); - this->speed = 0x100; - LinearMoveUpdate(this); + if (super->x.HALF.HI != x || super->y.HALF.HI != y) { + super->direction = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gArea.portal_x, gArea.portal_y); + super->speed = 0x100; + LinearMoveUpdate(super); } else { - COLLISION_OFF(this); - this->timer = 30; - this->subAction++; - this->spriteSettings.flipX = 0; - *(u32*)&this->field_0x80.HWORD = 1152; - *(u32*)&this->cutsceneBeh.HWORD = 1152; - this->spriteRendering.b0 = 3; + COLLISION_OFF(super); + super->timer = 30; + super->subAction++; + super->spriteSettings.flipX = 0; + this->unk_80.WORD_U = 1152; + this->unk_84.WORD_U = 1152; + super->spriteRendering.b0 = 3; sub_08074018(this); gPlayerState.animation = ANIM_GROW; } } -static void sub_08073FD0(Entity* this) { - if (this->timer != 0) { - if (--this->timer != 0) { +static void sub_08073FD0(PlayerEntity* this) { + if (super->timer != 0) { + if (--super->timer != 0) { return; } - if (this->spriteSettings.draw == 0) { - this->spriteSettings.draw = 3; + if (super->spriteSettings.draw == 0) { + super->spriteSettings.draw = 3; SoundReq(SFX_PLY_JUMP); } } - GravityUpdate(this, GRAVITY_RATE); - if (this->zVelocity == 0) { - this->subAction++; + GravityUpdate(super, GRAVITY_RATE); + if (super->zVelocity == 0) { + super->subAction++; SoundReq(SFX_PLY_GROW); } } -static void sub_08074018(Entity* this) { - if (*(u32*)&this->field_0x80 > 0x100) - *(u32*)&this->field_0x80 -= 32; - if (*(u32*)&this->cutsceneBeh > 0x100) - *(u32*)&this->cutsceneBeh -= 32; +static void sub_08074018(PlayerEntity* this) { + if (this->unk_80.WORD_U > 0x100) + this->unk_80.WORD_U -= 32; + if (this->unk_84.WORD_U > 0x100) + this->unk_84.WORD_U -= 32; else - this->subAction++; - SetAffineInfo(this, *(u32*)&this->field_0x80, *(u32*)&this->cutsceneBeh, 0); - UpdateAnimationSingleFrame(this); + super->subAction++; + SetAffineInfo(super, this->unk_80.WORD_U, this->unk_84.WORD_U, 0); + UpdateAnimationSingleFrame(super); } -static void sub_08074060(Entity* this) { - if (!GravityUpdate(this, GRAVITY_RATE)) { - this->hitbox = (Hitbox*)&gPlayerHitbox; - this->direction = DirectionSouth; - this->animationState = IdleSouth; - this->speed = 0x100; - this->spritePriority.b1 = 1; - this->spriteSettings.shadow = 1; - this->subtimer = 0; - this->subAction++; - this->zVelocity = Q_16_16(2.0); +static void sub_08074060(PlayerEntity* this) { + if (!GravityUpdate(super, GRAVITY_RATE)) { + super->hitbox = (Hitbox*)&gPlayerHitbox; + super->direction = DirectionSouth; + super->animationState = IdleSouth; + super->speed = 0x100; + super->spritePriority.b1 = 1; + super->spriteSettings.shadow = 1; + super->subtimer = 0; + super->subAction++; + super->zVelocity = Q_16_16(2.0); gPlayerState.animation = ANIM_HOP; - sub_0805EC60(this); + sub_0805EC60(super); } else { - UpdateAnimationSingleFrame(this); + UpdateAnimationSingleFrame(super); } } -void sub_080740D8(Entity* this) { +void sub_080740D8(PlayerEntity* this) { int y; int x; u32 dir; - UpdateAnimationSingleFrame(this); - if (!this->subtimer) - dir = this->direction; + UpdateAnimationSingleFrame(super); + if (!super->subtimer) + dir = super->direction; else - dir = DirectionTurnAround(this->direction); + dir = DirectionTurnAround(super->direction); switch (dir) { case 24: - x = this->x.HALF.HI - this->hitbox->unk2[0] + this->hitbox->offset_x - gRoomControls.origin_x; - y = this->y.HALF.HI + this->hitbox->offset_y - gRoomControls.origin_y; + x = super->x.HALF.HI - super->hitbox->unk2[0] + super->hitbox->offset_x - gRoomControls.origin_x; + y = super->y.HALF.HI + super->hitbox->offset_y - gRoomControls.origin_y; break; case 8: - x = this->x.HALF.HI + this->hitbox->unk2[0] + this->hitbox->offset_x - gRoomControls.origin_x; - y = this->y.HALF.HI + this->hitbox->offset_y - gRoomControls.origin_y; + x = super->x.HALF.HI + super->hitbox->unk2[0] + super->hitbox->offset_x - gRoomControls.origin_x; + y = super->y.HALF.HI + super->hitbox->offset_y - gRoomControls.origin_y; break; case 16: - x = this->x.HALF.HI + this->hitbox->offset_x - gRoomControls.origin_x; - y = this->y.HALF.HI + this->hitbox->unk2[3] + this->hitbox->offset_y - gRoomControls.origin_y; + x = super->x.HALF.HI + super->hitbox->offset_x - gRoomControls.origin_x; + y = super->y.HALF.HI + super->hitbox->unk2[3] + super->hitbox->offset_y - gRoomControls.origin_y; break; case 0: - x = this->x.HALF.HI + this->hitbox->offset_x - gRoomControls.origin_x; - y = this->y.HALF.HI - this->hitbox->unk2[3] + this->hitbox->offset_y - gRoomControls.origin_y; + x = super->x.HALF.HI + super->hitbox->offset_x - gRoomControls.origin_x; + y = super->y.HALF.HI - super->hitbox->unk2[3] + super->hitbox->offset_y - gRoomControls.origin_y; break; } if (sub_080086B4(x, y, gUnk_080082DC)) - LinearMoveUpdate(this); + LinearMoveUpdate(super); else - this->subtimer = 1; - if (!GravityUpdate(this, GRAVITY_RATE)) + super->subtimer = 1; + if (!GravityUpdate(super, GRAVITY_RATE)) PlayerSetNormalAndCollide(); } u32 sub_080741C4(void) { - if ((gPlayerState.jump_status && (gPlayerState.jump_status & 7) != 3) || gPlayerEntity.z.WORD != 0) { + if ((gPlayerState.jump_status && (gPlayerState.jump_status & 7) != 3) || gPlayerEntity.base.z.WORD != 0) { gPlayerState.surfacePositionSameTimer = 0; gPlayerState.surfaceTimer = 0; return 1; @@ -3330,38 +3332,38 @@ u32 sub_080741C4(void) { return 0; } -void SurfaceAction_DoNothing(Entity* this) { +void SurfaceAction_DoNothing(PlayerEntity* this) { } -void SurfaceAction_Pit(Entity* this) { - if (!sub_080741C4() && sub_08079C30(this)) { - if (this->action != PLAYER_FALL) { +void SurfaceAction_Pit(PlayerEntity* this) { + if (!sub_080741C4() && sub_08079C30(super)) { + if (super->action != PLAYER_FALL) { ResetActiveItems(); gPlayerState.queued_action = PLAYER_FALL; } } } -void SurfaceAction_SlopeGndGndVertical(Entity* this) { +void SurfaceAction_SlopeGndGndVertical(PlayerEntity* this) { sub_08074244(this, DirectionEast, DirectionWest); } -void SurfaceAction_SlopeGndGndHorizontal(Entity* this) { +void SurfaceAction_SlopeGndGndHorizontal(PlayerEntity* this) { sub_08074244(this, DirectionNorth, DirectionSouth); } -static void sub_08074244(Entity* this, u32 a1, u32 a2) { +static void sub_08074244(PlayerEntity* this, u32 a1, u32 a2) { if (gPlayerState.floor_type != SURFACE_LIGHT_GRADE && gPlayerState.floor_type != SURFACE_29) { - this->collisionLayer = 3; - this->spriteOrientation.flipY = 1; - this->spriteRendering.b3 = 1; + super->collisionLayer = 3; + super->spriteOrientation.flipY = 1; + super->spriteRendering.b3 = 1; } if (!sub_080741C4()) { u32 tmp; if (gPlayerState.dash_state == 0) { tmp = gPlayerState.direction; } else { - tmp = 4 * this->animationState; + tmp = 4 * super->animationState; } if (a1 != tmp || a2 != tmp) { gPlayerState.speed_modifier -= SLOPE_SPEED_MODIFIER; @@ -3369,82 +3371,82 @@ static void sub_08074244(Entity* this, u32 a1, u32 a2) { } } -void SurfaceAction_6(Entity* this) { +void SurfaceAction_6(PlayerEntity* this) { if (gPlayerState.swim_state != 0) { gPlayerState.swim_state = 0; } - this->spritePriority.b0 = 4; - this->collisionFlags &= ~4; + super->spritePriority.b0 = 4; + super->collisionFlags &= ~4; } -void SurfaceAction_7(Entity* this) { +void SurfaceAction_7(PlayerEntity* this) { if (!sub_080741C4() && (gPlayerState.flags & PL_MINISH) == 0 && gPlayerState.surfacePositionSameTimer == 15) { - CreateObjectWithParent(this, CRACKING_GROUND, 0, 0); + CreateObjectWithParent(super, CRACKING_GROUND, 0, 0); } } -void SurfaceAction_MinishDoorFront(Entity* this) { - if ((this->y.HALF.HI & 0xF) <= 0xD) { - this->collisions = COL_EAST_FULL | COL_WEST_FULL; +void SurfaceAction_MinishDoorFront(PlayerEntity* this) { + if ((super->y.HALF.HI & 0xF) <= 0xD) { + super->collisions = COL_EAST_FULL | COL_WEST_FULL; hide(this); } else { - EnablePlayerDraw(this); + EnablePlayerDraw(super); } } -void SurfaceAction_MinishDoorBack(Entity* this) { - if ((this->y.HALF.HI & 0xF) > 1) { - this->collisions = COL_EAST_FULL | COL_WEST_FULL; +void SurfaceAction_MinishDoorBack(PlayerEntity* this) { + if ((super->y.HALF.HI & 0xF) > 1) { + super->collisions = COL_EAST_FULL | COL_WEST_FULL; hide(this); } else { - EnablePlayerDraw(this); + EnablePlayerDraw(super); } } -void SurfaceAction_A(Entity* this) { - if ((this->x.HALF.HI & 0xF) < 12) { - this->collisions = COL_NORTH_FULL | COL_SOUTH_FULL; +void SurfaceAction_A(PlayerEntity* this) { + if ((super->x.HALF.HI & 0xF) < 12) { + super->collisions = COL_NORTH_FULL | COL_SOUTH_FULL; hide(this); } else { - EnablePlayerDraw(this); + EnablePlayerDraw(super); } } -void SurfaceAction_B(Entity* this) { - if ((this->x.HALF.HI & 0xF) > 4) { - this->collisions = COL_NORTH_FULL | COL_SOUTH_FULL; +void SurfaceAction_B(PlayerEntity* this) { + if ((super->x.HALF.HI & 0xF) > 4) { + super->collisions = COL_NORTH_FULL | COL_SOUTH_FULL; hide(this); } else { - EnablePlayerDraw(this); + EnablePlayerDraw(super); } } -static void hide(Entity* this) { +static void hide(PlayerEntity* this) { gPlayerState.flags |= PL_HIDDEN; - this->type2 = 0x80; - this->spriteSettings.draw = 0; - COLLISION_OFF(this); - this->knockbackDuration = 0; + super->type2 = 0x80; + super->spriteSettings.draw = 0; + COLLISION_OFF(super); + super->knockbackDuration = 0; ResetActiveItems(); } -void SurfaceAction_14(Entity* this) { +void SurfaceAction_14(PlayerEntity* this) { if (!sub_080741C4()) { - if (sub_08079C30(this)) { + if (sub_08079C30(super)) { u32 spd; - sub_0807AABC(this); + sub_0807AABC(super); sub_08074808(this); - spd = this->speed; - this->speed = 0x300; - this->direction = DirectionSouth; + spd = super->speed; + super->speed = 0x300; + super->direction = DirectionSouth; gPlayerState.field_0xa |= 0x80; - LinearMoveUpdate(this); - this->speed = spd; + LinearMoveUpdate(super); + super->speed = spd; } } } -void SurfaceAction_CloneTile(Entity* this) { +void SurfaceAction_CloneTile(PlayerEntity* this) { if (gPlayerState.chargeState.action == 4) { u32 item, n, i; if (ItemIsSword(gSave.stats.equipped[SLOT_A])) { @@ -3475,52 +3477,52 @@ void SurfaceAction_CloneTile(Entity* this) { break; } if (n > i) { - Entity* e = CreateObjectWithParent(this, PLAYER_CLONE, i, 0); + Entity* e = CreateObjectWithParent(super, PLAYER_CLONE, i, 0); gPlayerClones[i] = e; if (e != NULL) { - CopyPosition(this, e); + CopyPosition(super, e); } } else { gPlayerState.sword_state |= 0x80; gPlayerState.flags |= PL_CLONING; - this->x.WORD = (this->x.WORD & ~0xFFFFF) | 0x80000; - this->y.WORD = (this->y.WORD & ~0xFFFFF) | 0x80000; + super->x.WORD = (super->x.WORD & ~0xFFFFF) | 0x80000; + super->y.WORD = (super->y.WORD & ~0xFFFFF) | 0x80000; ResetLantern(); } } } -void SurfaceAction_16(Entity* this) { +void SurfaceAction_16(PlayerEntity* this) { if (!sub_080741C4() && !gPlayerState.field_0x14) { - if (this->iframes == 0) { + if (super->iframes == 0) { ModHealth(-2); SoundReq(SFX_PLY_VO6); - this->iframes = 24; - this->knockbackDuration = 4; - this->knockbackDirection = CalculateDirectionTo( - (this->x.HALF.HI & 0xFFF0) | 8, (this->y.HALF.HI & 0xFFF0) | 8, this->x.HALF.HI, this->y.HALF.HI); + super->iframes = 24; + super->knockbackDuration = 4; + super->knockbackDirection = CalculateDirectionTo( + (super->x.HALF.HI & 0xFFF0) | 8, (super->y.HALF.HI & 0xFFF0) | 8, super->x.HALF.HI, super->y.HALF.HI); } if ((gPlayerState.flags & PL_MINISH) == 0) - sub_08008790(this, 7); + sub_08008790(super, 7); } } -void SurfaceAction_Ice(Entity* this) { - if (!sub_080741C4() && ((gPlayerState.field_0x35 & 0x80) == 0 || this->knockbackDuration != 0)) { +void SurfaceAction_Ice(PlayerEntity* this) { + if (!sub_080741C4() && ((gPlayerState.field_0x35 & 0x80) == 0 || super->knockbackDuration != 0)) { ResetPlayerVelocity(); } } -void SurfaceAction_ShallowWater(Entity* this) { +void SurfaceAction_ShallowWater(PlayerEntity* this) { if (!sub_080741C4()) { if (gPlayerState.flags & PL_MINISH) { - this->spritePriority.b1 = 0; + super->spritePriority.b1 = 0; SurfaceAction_Water(this); } else { if (gPlayerState.swim_state) { - COLLISION_ON(this); - this->collisionFlags &= ~4; - this->spritePriority.b0 = 4; + COLLISION_ON(super); + super->collisionFlags &= ~4; + super->spritePriority.b0 = 4; gPlayerState.swim_state = 0; } if ((gPlayerState.playerInput.newInput & INPUT_ANY_DIRECTION) || gPlayerState.surfacePositionSameTimer == 1) @@ -3529,24 +3531,24 @@ void SurfaceAction_ShallowWater(Entity* this) { } } -void SurfaceAction_SlopeGndWater(Entity* this) { +void SurfaceAction_SlopeGndWater(PlayerEntity* this) { if (gPlayerState.swim_state) { - COLLISION_ON(this); - this->collisionFlags &= ~4; - this->spritePriority.b0 = 4; + COLLISION_ON(super); + super->collisionFlags &= ~4; + super->spritePriority.b0 = 4; gPlayerState.swim_state = 0; } } -void SurfaceAction_Swamp(Entity* this) { +void SurfaceAction_Swamp(PlayerEntity* this) { if (sub_080741C4()) { gPlayerState.surfacePositionSameTimer = 0; gPlayerState.surfaceTimer = 0; return; } - if (this->health) { - if (sub_08079C30(this) == 0) { + if (super->health) { + if (sub_08079C30(super) == 0) { gPlayerState.surfacePositionSameTimer = 0; gPlayerState.surfaceTimer = 0; return; @@ -3563,8 +3565,8 @@ void SurfaceAction_Swamp(Entity* this) { } if (gPlayerState.surfaceTimer == 1) { - CreateObjectWithParent(this, OBJECT_70, 0, 0); - CreateFx(this, FX_GREEN_SPLASH, 0); + CreateObjectWithParent(super, OBJECT_70, 0, 0); + CreateFx(super, FX_GREEN_SPLASH, 0); SoundReq(SFX_161); } else if ((gPlayerState.playerInput.newInput & INPUT_ANY_DIRECTION) != 0) { SoundReq(SFX_161); @@ -3580,28 +3582,28 @@ void SurfaceAction_Swamp(Entity* this) { } } gPlayerState.flags &= ~PL_ROLLING; - CreateFx(this, FX_GREEN_SPLASH, 0); - this->iframes = 0x20; + CreateFx(super, FX_GREEN_SPLASH, 0); + super->iframes = 0x20; ModHealth(-4); RespawnPlayer(); } -void SurfaceAction_Water(Entity* this) { +void SurfaceAction_Water(PlayerEntity* this) { if (!sub_080741C4()) { if (gPlayerState.field_0x14 == 0) { gPlayerState.spriteOffsetY += 2; } else { gPlayerState.swim_state = 0; - this->spritePriority.b0 = 4; - this->collisionFlags &= ~4; + super->spritePriority.b0 = 4; + super->collisionFlags &= ~4; } - if ((gPlayerState.swim_state & 0xF) || sub_08079C30(this)) { + if ((gPlayerState.swim_state & 0xF) || sub_08079C30(super)) { sub_08074808(this); } } } -static void sub_08074808(Entity* this) { +static void sub_08074808(PlayerEntity* this) { ResetLantern(); if (GetInventoryValue(ITEM_FLIPPERS) == 1) { if (!gPlayerState.swim_state) { @@ -3609,26 +3611,26 @@ static void sub_08074808(Entity* this) { gPlayerState.swim_state = 1; else gPlayerState.swim_state = 8; - this->speed = 0; + super->speed = 0; gPlayerState.remainingDiveTime = 0; if ((gPlayerState.flags & PL_MINISH) == 0) - CreateFx(this, FX_WATER_SPLASH, 0); + CreateFx(super, FX_WATER_SPLASH, 0); SoundReq(SFX_1A5); ResetActiveItems(); } if ((gPlayerState.swim_state & 0xF) != 1) { - sub_08079744(this); + sub_08079744(super); gPlayerState.swim_state--; } gPlayerState.flags &= ~(PL_BURNING | PL_FROZEN); - if ((gPlayerState.flags & PL_DRUGGED) != 0 && this->field_0x7a.HWORD <= 0xEu) - this->field_0x7a.HWORD = 15; + if ((gPlayerState.flags & PL_DRUGGED) != 0 && this->unk_7a <= 0xEu) + this->unk_7a = 15; } else { gPlayerState.queued_action = PLAYER_DROWN; } } -void SurfaceAction_Button(Entity* this) { +void SurfaceAction_Button(PlayerEntity* this) { gPlayerState.spriteOffsetY -= 2; } @@ -3636,112 +3638,112 @@ void sub_080748D4(void) { sub_080741C4(); } -void SurfaceAction_1B(Entity* this) { +void SurfaceAction_1B(PlayerEntity* this) { if (!sub_080741C4()) { - if (this->collisionLayer != 1) { - this->y.HALF.HI += 12; + if (super->collisionLayer != 1) { + super->y.HALF.HI += 12; if ((gPlayerState.flags & PL_MINISH) == 0) - this->z.HALF.HI -= 12; + super->z.HALF.HI -= 12; } - sub_0807AABC(this); + sub_0807AABC(super); } } -void SurfaceAction_1C(Entity* this) { +void SurfaceAction_1C(PlayerEntity* this) { if (!sub_080741C4()) { - if (sub_08079C30(this)) { + if (sub_08079C30(super)) { gPlayerState.queued_action = PLAYER_LAVA; } } } -void SurfaceAction_ClimbWall(Entity* this) { +void SurfaceAction_ClimbWall(PlayerEntity* this) { if (GetInventoryValue(ITEM_GRIP_RING) == 1) { SurfaceAction_Ladder(this); } else { - this->y.HALF.HI = (this->y.HALF.HI & 0xFFF0) | 0xF; + super->y.HALF.HI = (super->y.HALF.HI & 0xFFF0) | 0xF; gPlayerState.floor_type = SURFACE_NORMAL; } } -void SurfaceAction_Ladder(Entity* this) { +void SurfaceAction_Ladder(PlayerEntity* this) { if (!sub_080741C4()) { gPlayerState.jump_status = 0; - this->spriteRendering.b3 = 1; - this->spriteOrientation.flipY = 1; - this->animationState = IdleNorth; - this->collisionLayer = 3; + super->spriteRendering.b3 = 1; + super->spriteOrientation.flipY = 1; + super->animationState = IdleNorth; + super->collisionLayer = 3; ResetActiveItems(); } } -void SurfaceAction_2C(Entity* this) { +void SurfaceAction_2C(PlayerEntity* this) { if (GetInventoryValue(ITEM_GRIP_RING) == 1) { SurfaceAction_AutoLadder(this); } else { - this->y.HALF.HI &= 0xFFF0; + super->y.HALF.HI &= 0xFFF0; gPlayerState.floor_type = SURFACE_NORMAL; } } -void SurfaceAction_AutoLadder(Entity* this) { +void SurfaceAction_AutoLadder(PlayerEntity* this) { if (!sub_080741C4()) { - this->spriteRendering.b3 = 1; - this->spriteOrientation.flipY = 1; - this->animationState = IdleNorth; - this->collisionLayer = 3; + super->spriteRendering.b3 = 1; + super->spriteOrientation.flipY = 1; + super->animationState = IdleNorth; + super->collisionLayer = 3; gPlayerState.swim_state = 0; - this->collisionFlags &= ~4; - if ((this->y.HALF.HI & 0xF) <= 7) { + super->collisionFlags &= ~4; + if ((super->y.HALF.HI & 0xF) <= 7) { gPlayerState.animation = ANIM_CLIMB_FROM_TOP; - this->direction = DirectionSouth; + super->direction = DirectionSouth; } else { gPlayerState.animation = ANIM_CLIMB_TO_TOP; - this->direction = DirectionNorth; + super->direction = DirectionNorth; } ResetActiveItems(); } } -void SurfaceAction_20(Entity* this) { +void SurfaceAction_20(PlayerEntity* this) { if (gPlayerState.swim_state & 0x80) { - Entity* e = CreateObjectWithParent(&gPlayerEntity, GROUND_ITEM, ITEM_RUPEE1, 0); + Entity* e = CreateObjectWithParent(&gPlayerEntity.base, GROUND_ITEM, ITEM_RUPEE1, 0); if (e != NULL) { e->timer = 1; UpdateSpriteForCollisionLayer(e); - CloneTile(57, gPlayerState.tilePosition, this->collisionLayer); + CloneTile(57, gPlayerState.tilePosition, super->collisionLayer); } } SurfaceAction_Water(this); } -void SurfaceAction_22(Entity* this) { +void SurfaceAction_22(PlayerEntity* this) { } -void SurfaceAction_Dust(Entity* this) { +void SurfaceAction_Dust(PlayerEntity* this) { if (!sub_080741C4()) { gPlayerState.speed_modifier -= 128; if (gPlayerState.surfacePositionSameTimer == 1 || (gPlayerState.playerInput.newInput & INPUT_ANY_DIRECTION) != 0) { if (gPlayerState.floor_type == SURFACE_DUST) - CreateObjectWithParent(this, DIRT_PARTICLE, 1, 0); + CreateObjectWithParent(super, DIRT_PARTICLE, 1, 0); else - CreateObjectWithParent(this, DIRT_PARTICLE, 1, 1); + CreateObjectWithParent(super, DIRT_PARTICLE, 1, 1); } } } -void SurfaceAction_26(Entity* this) { +void SurfaceAction_26(PlayerEntity* this) { u32 v1; if (gPlayerState.dash_state == 0) v1 = gPlayerState.direction; else - v1 = 4 * this->animationState; + v1 = 4 * super->animationState; sub_08074244(this, v1, v1); } -void SurfaceAction_Hole(Entity* this) { +void SurfaceAction_Hole(PlayerEntity* this) { if (!gPlayerState.field_0x14 && !sub_080741C4()) { if (gPlayerState.flags & PL_MINISH) SurfaceAction_Pit(this); @@ -3750,51 +3752,51 @@ void SurfaceAction_Hole(Entity* this) { } } -void SurfaceAction_ConveyerNorth(Entity* this) { +void SurfaceAction_ConveyerNorth(PlayerEntity* this) { if (!sub_080741C4() && (gPlayerState.flags & PL_MINISH) == 0) { - this->animationState = IdleNorth; - this->direction = DirectionNorth; + super->animationState = IdleNorth; + super->direction = DirectionNorth; conveyer_push(this); } } -void SurfaceAction_ConveyerSouth(Entity* this) { +void SurfaceAction_ConveyerSouth(PlayerEntity* this) { if (!sub_080741C4() && (gPlayerState.flags & PL_MINISH) == 0) { - this->animationState = IdleSouth; - this->direction = DirectionSouth; + super->animationState = IdleSouth; + super->direction = DirectionSouth; conveyer_push(this); } } -void SurfaceAction_ConveyerWest(Entity* this) { +void SurfaceAction_ConveyerWest(PlayerEntity* this) { if (!sub_080741C4() && (gPlayerState.flags & PL_MINISH) == 0) { - this->animationState = IdleWest; - this->direction = DirectionWest; + super->animationState = IdleWest; + super->direction = DirectionWest; conveyer_push(this); } } -void SurfaceAction_ConveyerEast(Entity* this) { +void SurfaceAction_ConveyerEast(PlayerEntity* this) { if (!sub_080741C4() && (gPlayerState.flags & PL_MINISH) == 0) { - this->animationState = IdleEast; - this->direction = DirectionEast; + super->animationState = IdleEast; + super->direction = DirectionEast; conveyer_push(this); } } -static void conveyer_push(Entity* this) { +static void conveyer_push(PlayerEntity* this) { ResetActiveItems(); - this->spritePriority.b1 = 0; - this->speed = WALK_SPEED; + super->spritePriority.b1 = 0; + super->speed = WALK_SPEED; gPlayerState.flags |= PL_CONVEYOR_PUSHED; gPlayerState.field_0xa |= 0x80; gPlayerState.mobility |= 0x80; gPlayerState.field_0x27[0]++; - LinearMoveUpdate(this); + LinearMoveUpdate(super); } -static void PlayerSleep(Entity* this) { - static EntityAction* const gUnk_0811BC88[] = { +static void PlayerSleep(PlayerEntity* this) { + static PlayerEntityAction* const gUnk_0811BC88[] = { sub_08074C68, sub_08074CF8, sub_08074F00, @@ -3802,24 +3804,24 @@ static void PlayerSleep(Entity* this) { }; if (!CheckQueuedAction()) - gUnk_0811BC88[this->subAction](this); + gUnk_0811BC88[super->subAction](this); } -static void sub_08074C68(Entity* this) { - this->field_0x68.HALF.LO = 0; +static void sub_08074C68(PlayerEntity* this) { + this->unk_68.BYTES.byte0 = 0; if (gPlayerState.field_0x38 != 1) { - if (*(ScriptExecutionContext**)&this->cutsceneBeh.HWORD == &gPlayerScriptExecutionContext) { - this->subAction = 1; - sub_0807DD64(this); + if (*(ScriptExecutionContext**)&this->unk_84.WORD == &gPlayerScriptExecutionContext) { + super->subAction = 1; + sub_0807DD64(super); sub_08074CF8(this); } } else { - this->spriteSettings.draw = 1; - this->animationState = IdleNorth; - this->spritePriority.b1 = 0; - this->subAction = 2; - this->field_0x68.HALF.LO = 1; - sub_0807DD64(this); + super->spriteSettings.draw = 1; + super->animationState = IdleNorth; + super->spritePriority.b1 = 0; + super->subAction = 2; + this->unk_68.BYTES.byte0 = 1; + sub_0807DD64(super); if (!gPlayerState.field_0x39) gPlayerState.animation = ANIM_SLEEP_NOCAP; else @@ -3828,19 +3830,19 @@ static void sub_08074C68(Entity* this) { } } -static void sub_08074CF8(Entity* this) { +static void sub_08074CF8(PlayerEntity* this) { u32 v3; - v3 = this->animationState; - ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh.HWORD); - sub_08074D34(this, *(ScriptExecutionContext**)&this->cutsceneBeh.HWORD); - if ((this->field_0x82.HWORD & 1) != 0) - this->animationState = v3; - GravityUpdate(this, GRAVITY_RATE); - UpdateAnimationSingleFrame(this); + v3 = super->animationState; + ExecuteScript(super, *(ScriptExecutionContext**)&this->unk_84.WORD); + sub_08074D34(this, *(ScriptExecutionContext**)&this->unk_84.WORD); + if ((this->unk_80.HALF.HI & 1) != 0) + super->animationState = v3; + GravityUpdate(super, GRAVITY_RATE); + UpdateAnimationSingleFrame(super); } -void sub_08074D34(Entity* this, ScriptExecutionContext* ctx) { +void sub_08074D34(PlayerEntity* this, ScriptExecutionContext* ctx) { while (ctx->postScriptActions) { u32 bit = (~ctx->postScriptActions + 1) & ctx->postScriptActions; ctx->postScriptActions ^= bit; @@ -3866,77 +3868,77 @@ void sub_08074D34(Entity* this, ScriptExecutionContext* ctx) { gPlayerState.animation = ANIM_HOP_NOCAP; else gPlayerState.animation = ANIM_HOP; - this->zVelocity = Q_16_16(1.5); + super->zVelocity = Q_16_16(1.5); break; case 0x10: - CreateSpeechBubbleExclamationMark(this, 8, -24); + CreateSpeechBubbleExclamationMark(super, 8, -24); break; case 0x20: - CreateSpeechBubbleQuestionMark(this, 8, -24); + CreateSpeechBubbleQuestionMark(super, 8, -24); break; case 0x80: - this->spriteSettings.draw = 1; + super->spriteSettings.draw = 1; break; case 0x100: - this->spriteSettings.draw = 0; + super->spriteSettings.draw = 0; break; case 0x200: - this->field_0x82.HWORD = 0; + this->unk_80.HALF_U.HI = 0; break; case 0x1000: - this->field_0x82.HWORD &= ~1; + this->unk_80.HALF_U.HI &= ~1; break; case 0x2000: - this->field_0x82.HWORD |= 1; + this->unk_80.HALF_U.HI |= 1; break; case 0x4000: - this->field_0x82.HWORD |= 8; + this->unk_80.HALF_U.HI |= 8; break; case 0x8000: - this->field_0x82.HWORD |= 4; + this->unk_80.HALF_U.HI |= 4; break; case 0x20000: - this->spriteSettings.flipX ^= 1; + super->spriteSettings.flipX ^= 1; break; case 0x100000: - this->subAction = 2; - this->field_0x68.HALF.LO = 2; + super->subAction = 2; + this->unk_68.BYTES.byte0 = 2; break; case 0x200000: - this->subAction = 3; - this->field_0x68.HALF.LO = 0; + super->subAction = 3; + this->unk_68.BYTES.byte0 = 0; break; } } } -static void sub_08074F00(Entity* this) { - static EntityAction* const gUnk_0811BC98[] = { +static void sub_08074F00(PlayerEntity* this) { + static PlayerEntityAction* const gUnk_0811BC98[] = { sub_08074F1C, sub_08074F2C, sub_08074F44, sub_08074F8C, sub_08074FEC, sub_0807501C, sub_0807508C, }; - gUnk_0811BC98[this->field_0x68.HALF.LO](this); + gUnk_0811BC98[this->unk_68.BYTES.byte0](this); } -void sub_08074F1C(Entity* this) { - this->field_0x68.HALF.LO = 1; - this->animationState = IdleNorth; +void sub_08074F1C(PlayerEntity* this) { + this->unk_68.BYTES.byte0 = 1; + super->animationState = IdleNorth; } -void sub_08074F2C(Entity* this) { - ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh.HWORD); - sub_08074D34(this, *(ScriptExecutionContext**)&this->cutsceneBeh.HWORD); +void sub_08074F2C(PlayerEntity* this) { + ExecuteScript(super, *(ScriptExecutionContext**)&this->unk_84.WORD); + sub_08074D34(this, *(ScriptExecutionContext**)&this->unk_84.WORD); } -void sub_08074F44(Entity* this) { +void sub_08074F44(PlayerEntity* this) { typedef struct { u8 fill[0x6c]; Entity* e; } fixme; - this->field_0x68.HALF.LO++; - if (((fixme*)&gPlayerEntity)->e) - DeleteEntity(((fixme*)&gPlayerEntity)->e); + this->unk_68.BYTES.byte0++; + if (((fixme*)&gPlayerEntity.base)->e) + DeleteEntity(((fixme*)&gPlayerEntity.base)->e); if (!gPlayerState.field_0x39) { gPlayerState.animation = ANIM_WAKEUP_NOCAP; gPlayerState.flags |= PL_NO_CAP; @@ -3945,16 +3947,16 @@ void sub_08074F44(Entity* this) { } } -void sub_08074F8C(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame == 1) { - this->frame = 0; +void sub_08074F8C(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame == 1) { + super->frame = 0; gActiveScriptInfo.syncFlags |= 4; } - if (this->frame & ANIM_DONE) { - this->field_0x68.HALF.LO++; - this->timer = 8; - this->animationState = IdleSouth; + if (super->frame & ANIM_DONE) { + this->unk_68.BYTES.byte0++; + super->timer = 8; + super->animationState = IdleSouth; if (!gPlayerState.field_0x39) { gPlayerState.animation = ANIM_DEFAULT_NOCAP; } else { @@ -3963,37 +3965,37 @@ void sub_08074F8C(Entity* this) { } } -void sub_08074FEC(Entity* this) { - UpdateAnimationSingleFrame(this); - if (--this->timer == 0) { - this->field_0x68.HALF.LO++; - this->timer = 4; - this->animationState = gPlayerState.field_0x3a; +void sub_08074FEC(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (--super->timer == 0) { + this->unk_68.BYTES.byte0++; + super->timer = 4; + super->animationState = gPlayerState.field_0x3a; } } -void sub_0807501C(Entity* this) { - if (--this->timer == 0) { - this->animationState = gPlayerState.field_0x3a; +void sub_0807501C(PlayerEntity* this) { + if (--super->timer == 0) { + super->animationState = gPlayerState.field_0x3a; if (!gPlayerState.field_0x39) { gPlayerState.animation = ANIM_HOP_NOCAP; } else { gPlayerState.animation = ANIM_HOP; } - this->spritePriority.b1 = 1; - this->direction = Direction8FromAnimationState(this->animationState); - this->speed = 200; - this->zVelocity = Q_16_16(2.0); - this->timer = 8; - this->field_0x68.HALF.LO++; + super->spritePriority.b1 = 1; + super->direction = Direction8FromAnimationState(super->animationState); + super->speed = 200; + super->zVelocity = Q_16_16(2.0); + super->timer = 8; + this->unk_68.BYTES.byte0++; SoundReq(SFX_PLY_JUMP); } } -void sub_0807508C(Entity* this) { - UpdateAnimationSingleFrame(this); - if (GravityUpdate(this, GRAVITY_RATE)) { - LinearMoveUpdate(this); +void sub_0807508C(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (GravityUpdate(super, GRAVITY_RATE)) { + LinearMoveUpdate(super); } else { if (!gPlayerState.field_0x39) { gPlayerState.animation = ANIM_DEFAULT_NOCAP; @@ -4001,63 +4003,63 @@ void sub_0807508C(Entity* this) { gPlayerState.flags &= ~PL_NO_CAP; gPlayerState.animation = ANIM_DEFAULT; } - if (--this->timer == 0) { - this->animationState = IdleSouth; - this->subAction = 1; - this->field_0x68.HALF.LO = 0; + if (--super->timer == 0) { + super->animationState = IdleSouth; + super->subAction = 1; + this->unk_68.BYTES.byte0 = 0; SoundReq(SFX_PLY_LAND); } } } -void sub_080750F4(Entity* this) { - static EntityAction* const gUnk_0811BCB4[] = { +void sub_080750F4(PlayerEntity* this) { + static PlayerEntityAction* const gUnk_0811BCB4[] = { sub_08075110, sub_0807513C, sub_0807518C, sub_080751B4, }; - gUnk_0811BCB4[this->field_0x68.HALF.LO](this); + gUnk_0811BCB4[this->unk_68.BYTES.byte0](this); } -void sub_08075110(Entity* this) { - this->field_0x68.HALF.LO++; - this->subtimer = this->animationState; - this->animationState = IdleNorth; +void sub_08075110(PlayerEntity* this) { + this->unk_68.BYTES.byte0++; + super->subtimer = super->animationState; + super->animationState = IdleNorth; gPlayerState.animation = ANIM_PUT_ON_EZLO; gPlayerState.flags &= ~PL_NO_CAP; } -void sub_0807513C(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame == 1) { - this->frame = 0; +void sub_0807513C(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame == 1) { + super->frame = 0; SoundReq(SFX_PLY_JUMP); } - if (this->frame == 2) { - this->frame = 0; + if (super->frame == 2) { + super->frame = 0; SoundReq(SFX_14B); SoundReq(SFX_PLY_VO6); } - if (this->frame & ANIM_DONE) { - this->field_0x68.HALF.LO++; - this->timer = 60; + if (super->frame & ANIM_DONE) { + this->unk_68.BYTES.byte0++; + super->timer = 60; } } -void sub_0807518C(Entity* this) { - if (--this->timer == 0) { - this->field_0x68.HALF.LO++; +void sub_0807518C(PlayerEntity* this) { + if (--super->timer == 0) { + this->unk_68.BYTES.byte0++; gPlayerState.animation = ANIM_EZLO_LEAVE_LEFT; } } -void sub_080751B4(Entity* this) { - UpdateAnimationSingleFrame(this); - if (this->frame & ANIM_DONE) { - this->animationState = IdleSouth; - this->subAction = 1; - this->field_0x68.HALF.LO = 0; +void sub_080751B4(PlayerEntity* this) { + UpdateAnimationSingleFrame(super); + if (super->frame & ANIM_DONE) { + super->animationState = IdleSouth; + super->subAction = 1; + this->unk_68.BYTES.byte0 = 0; gPlayerState.animation = ANIM_DEFAULT; } } @@ -4073,7 +4075,7 @@ void sub_080751E8(u32 a1, u32 a2, void* script) { MemClear(&gPlayerScriptExecutionContext, sizeof(ScriptExecutionContext)); gPlayerScriptExecutionContext.scriptInstructionPointer = script; - ((fixme*)&gPlayerEntity)->ctx = &gPlayerScriptExecutionContext; + ((fixme*)&gPlayerEntity.base)->ctx = &gPlayerScriptExecutionContext; gPlayerState.queued_action = PLAYER_SLEEP; gPlayerState.field_0x38 = 1; gPlayerState.field_0x39 = 0; @@ -4088,24 +4090,24 @@ void sub_080751E8(u32 a1, u32 a2, void* script) { } e = CreateObject(BED_COVER, !gPlayerState.field_0x39 ? 2 : 0, 0); if (e != NULL) { - CopyPosition(&gPlayerEntity, e); + CopyPosition(&gPlayerEntity.base, e); StartCutscene(e, script); } - e2 = CreateSpeechBubbleSleep(&gPlayerEntity, -14, -28); - *(Entity**)&gPlayerEntity.field_0x6c.HWORD = e2; + e2 = CreateSpeechBubbleSleep(&gPlayerEntity.base, -14, -28); + *(Entity**)&gPlayerEntity.unk_6c = e2; if (e2 != NULL) { SetEntityPriority(e2, PRIO_NO_BLOCK); } } -void sub_0807529C(Entity* this) { - CreateSpeechBubbleQuestionMark(this, 8, -32); +void sub_0807529C(PlayerEntity* this) { + CreateSpeechBubbleQuestionMark(super, 8, -32); } -void sub_080752AC(Entity* this, ScriptExecutionContext* ctx) { - LinearMoveUpdate(this); +void sub_080752AC(PlayerEntity* this, ScriptExecutionContext* ctx) { + LinearMoveUpdate(super); if (!ctx->unk_18) { - if (GetTileUnderEntity(this) != 41) { + if (GetTileUnderEntity(super) != 41) { ctx->unk_18 = 1; ctx->unk_19 = 6; } diff --git a/src/playerItem.c b/src/playerItem.c index 10e8ac0c..dcf2532b 100644 --- a/src/playerItem.c +++ b/src/playerItem.c @@ -1,4 +1,3 @@ -#define ENT_DEPRECATED #include "global.h" #include "functions.h" #include "player.h" @@ -92,7 +91,7 @@ void ItemInit(Entity* this) { if (definition->bitfield == 0xff) { u32 tmp = definition->firstItemIndex; definition = gAdditionalPlayerItemDefinitions[definition->index]; - definition = &definition[this->field_0x68.HALF.LO - tmp]; + definition = &definition[((GenericEntity*)this)->field_0x68.HALF.LO - tmp]; } tmp3 = definition->bitfield; tmp2 = tmp3 & 0xf; @@ -102,18 +101,18 @@ void ItemInit(Entity* this) { this->hitType = definition->hitType; this->spriteIndex = definition->spriteIndex; if (definition->gfx == 0) { - this->spriteVramOffset = gPlayerEntity.spriteVramOffset; + this->spriteVramOffset = gPlayerEntity.base.spriteVramOffset; } else { this->spriteVramOffset = definition->gfx & 0x3ff; } if (this->animationState == IdleNorth) { - this->animationState = gPlayerEntity.animationState & 6; + this->animationState = gPlayerEntity.base.animationState & 6; } - this->collisionLayer = gPlayerEntity.collisionLayer; - this->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; - this->spritePriority.b0 = gPlayerEntity.spritePriority.b0; - this->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; + this->collisionLayer = gPlayerEntity.base.collisionLayer; + this->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; + this->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0; + this->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; this->health = 1; this->flags |= ENT_DID_INIT; } diff --git a/src/playerItem/playerItemBoomerang.c b/src/playerItem/playerItemBoomerang.c index 498843e4..0f7a8662 100644 --- a/src/playerItem/playerItemBoomerang.c +++ b/src/playerItem/playerItemBoomerang.c @@ -67,13 +67,13 @@ void PlayerItemBoomerang_Init(PlayerItemBoomerangEntity* this) { super->frameIndex = 0xff; this->unk_80 = 0; #ifdef EU - super->spriteVramOffset = gPlayerEntity.spriteVramOffset; + super->spriteVramOffset = gPlayerEntity.base.spriteVramOffset; #endif super->animIndex = 11; - super->parent = &gPlayerEntity; + super->parent = &gPlayerEntity.base; this->unk_86 = 0; if ((super->animationState & 2) != 0) { - super->spriteSettings.flipX = ~gPlayerEntity.spriteSettings.flipX; + super->spriteSettings.flipX = ~gPlayerEntity.base.spriteSettings.flipX; } if (this->unk_68 == 12) { super->speed = 0x280; @@ -104,31 +104,31 @@ void PlayerItemBoomerang_Action1(PlayerItemBoomerangEntity* this) { sub_0801B804(this); if ((gPlayerState.attack_status == 0) || (gPlayerState.mobility != 0) || gPlayerState.item != super || - (gPlayerState.item == super && gPlayerEntity.action != PLAYER_NORMAL)) { + (gPlayerState.item == super && gPlayerEntity.base.action != PLAYER_NORMAL)) { if (gPlayerState.item == super) { gPlayerState.item = NULL; } DeleteThisEntity(); } - if ((gPlayerEntity.frame & 1) == 0) { + if ((gPlayerEntity.base.frame & 1) == 0) { if (this->unk_68 == 12) { cVar3 = 6; } else { cVar3 = 0; } - frameIndex = (gPlayerEntity.frame >> 4) + cVar3; + frameIndex = (gPlayerEntity.base.frame >> 4) + cVar3; if (super->frameIndex != frameIndex) { super->frameIndex = frameIndex; sub_080042D0(super, super->frameIndex, super->spriteIndex); } - sub_08078E84(super, &gPlayerEntity); + sub_08078E84(super, &gPlayerEntity.base); } else { super->action = 2; super->spriteVramOffset = 0xd5; COLLISION_ON(super); super->collisionFlags |= 1; - super->flags2 = gPlayerEntity.flags2; + super->flags2 = gPlayerEntity.base.flags2; super->spriteIndex = 0xa6; super->spriteSettings.flipX = 0; super->spriteSettings.draw = 1; @@ -171,7 +171,7 @@ void PlayerItemBoomerang_Action2(PlayerItemBoomerangEntity* this) { } } - if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) { + if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0) { if (!uVar6) { uVar6 = sub_080040E2(super, &gUnk_08003E44); } @@ -214,9 +214,9 @@ void PlayerItemBoomerang_Action3(PlayerItemBoomerangEntity* this) { if (super->speed < 0x280) { super->speed += 8; } - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); LinearMoveUpdate(super); - if (sub_0800419C(super, &gPlayerEntity, 2, 2) != 0) { + if (sub_0800419C(super, &gPlayerEntity.base, 2, 2) != 0) { DeleteThisEntity(); } } diff --git a/src/playerItem/playerItemBottle.c b/src/playerItem/playerItemBottle.c index 5cb0217d..8196ba8b 100644 --- a/src/playerItem/playerItemBottle.c +++ b/src/playerItem/playerItemBottle.c @@ -4,20 +4,14 @@ * * @brief Bottle Player Item */ -#include "entity.h" +#include "playerItem/playerItemBottle.h" + #include "functions.h" #include "item.h" #include "object.h" #include "save.h" #include "sound.h" -typedef struct { - /*0x00*/ Entity base; - /*0x68*/ u8 bottleIndex; /**< @see Item */ - /*0x69*/ u8 unused[6]; - /*0x6f*/ u8 bottleContent; /**< @see Item */ -} PlayerItemBottleEntity; - void PlayerItemBottle_UseEmptyBottle(Entity*); void PlayerItemBottle_Action1(PlayerItemBottleEntity*); void sub_0801BDE8(Entity*, Entity*); @@ -53,8 +47,8 @@ void PlayerItemBottle_Init(PlayerItemBottleEntity* this) { return; } COLLISION_ON(super); - super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20; - super->flags2 = gPlayerEntity.flags2; + super->collisionFlags = (gPlayerEntity.base.collisionFlags + 1) | 0x20; + super->flags2 = gPlayerEntity.base.flags2; super->hurtType = 0x1f; super->type = 1; super->type2 = ITEM_BOTTLE_EMPTY; @@ -107,7 +101,7 @@ void PlayerItemBottle_Action1(PlayerItemBottleEntity* this) { } DeleteThisEntity(); } - sub_0801BDE8(super, &gPlayerEntity); + sub_0801BDE8(super, &gPlayerEntity.base); switch (this->bottleContent) { case ITEM_BOTTLE_EMPTY: PlayerItemBottle_UseEmptyBottle2(super); @@ -123,8 +117,8 @@ void PlayerItemBottle_Action1(PlayerItemBottleEntity* this) { case ITEM_BOTTLE_PICOLYTE_GREEN: case ITEM_BOTTLE_PICOLYTE_BLUE: case ITEM_BOTTLE_PICOLYTE_WHITE: - if (gPlayerEntity.frame == 1) { - gPlayerEntity.frame = 0; + if (gPlayerEntity.base.frame == 1) { + gPlayerEntity.base.frame = 0; PlayerItemBottle_UsePotionOrPicolyte(this); } break; @@ -175,7 +169,7 @@ void PlayerItemBottle_UsePotionOrPicolyte(PlayerItemBottleEntity* this) { } void PlayerItemBottle_UseOther(PlayerItemBottleEntity* this) { - if (gPlayerEntity.frame == 1) { + if (gPlayerEntity.base.frame == 1) { if (this->bottleContent != ITEM_QST_DOGFOOD) { SetBottleContents(ITEM_BOTTLE_EMPTY, this->bottleIndex - 0x1c); } @@ -198,7 +192,7 @@ void PlayerItemBottle_UseOther(PlayerItemBottleEntity* this) { SoundReq(SFX_ELEMENT_CHARGE); } } - if (gPlayerEntity.frame == 2) { + if (gPlayerEntity.base.frame == 2) { switch (this->bottleContent) { case ITEM_BOTTLE_WATER: CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0); @@ -208,7 +202,7 @@ void PlayerItemBottle_UseOther(PlayerItemBottleEntity* this) { break; } } - if (gPlayerEntity.frame == 3) { + if (gPlayerEntity.base.frame == 3) { switch (this->bottleContent) { case ITEM_BOTTLE_WATER: CreateObjectWithParent(super, LINK_EMPTYING_BOTTLE, 0, 0); @@ -233,7 +227,7 @@ void sub_0801BDE8(Entity* this, Entity* ent2) { flipX = ent2->spriteSettings.flipX; animationState = (ent2->animationState >> 1); this->spriteSettings.flipX = flipX ^ (animationState & 1); - sub_08078E84(this, &gPlayerEntity); + sub_08078E84(this, &gPlayerEntity.base); } void PlayerItemBottle_UseEmptyBottle(Entity* this) { @@ -278,9 +272,9 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) { this->hitbox->offset_y = ptr[1]; this->hitbox->width = ptr[2]; this->hitbox->height = ptr[3]; - if ((gPlayerEntity.frame & 0xf) != 0) { + if ((gPlayerEntity.base.frame & 0xf) != 0) { if (this->type2 == ITEM_BOTTLE_EMPTY) { - ptr2 = &gUnk_080B7878[((gPlayerEntity.frame & 0xf) - 1) * 2]; + ptr2 = &gUnk_080B7878[((gPlayerEntity.base.frame & 0xf) - 1) * 2]; iVar2 = ptr2[0]; if (this->spriteSettings.flipX != 0) { iVar2 = -iVar2; @@ -292,6 +286,6 @@ void PlayerItemBottle_UseEmptyBottle(Entity* this) { } if (this->type2 != ITEM_BOTTLE_EMPTY) { - COLLISION_OFF(&gPlayerEntity); + COLLISION_OFF(&gPlayerEntity.base); } } diff --git a/src/playerItem/playerItemBow.c b/src/playerItem/playerItemBow.c index e3aba91b..ecedd873 100644 --- a/src/playerItem/playerItemBow.c +++ b/src/playerItem/playerItemBow.c @@ -86,17 +86,17 @@ void PlayerItemBow_Init(PlayerItemBowEntity* this) { super->speed = 0x300; } super->direction = super->animationState << 2; - super->collisionFlags = gPlayerEntity.collisionFlags + 1; - super->flags2 = gPlayerEntity.flags2; + super->collisionFlags = gPlayerEntity.base.collisionFlags + 1; + super->flags2 = gPlayerEntity.base.flags2; if (super->collisionLayer == 2) { super->type2 = 1; } else { super->type2 = 0; } - super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; + super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; ptr = &gUnk_080B3E40[super->animationState >> 1]; - super->x.HALF.HI = gPlayerEntity.x.HALF.HI + ptr->x; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI + ptr->y; + super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + ptr->x; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + ptr->y; super->spriteSettings.flipX = ptr->spriteSettings; super->spriteSettings.flipY = ptr->unk_3; super->animIndex = ptr->animIndex; @@ -163,7 +163,7 @@ void PlayerItemBow_Action1(PlayerItemBowEntity* this) { if (super->type2 == 0) { sub_0800451C(super); } - if ((sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) && (!tmp2) && + if ((sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0) && (!tmp2) && sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) != 0) { super->timer = 30; super->action++; @@ -224,21 +224,21 @@ void PlayerItemBow_Action1(PlayerItemBowEntity* this) { } } arrowCount = gSave.stats.arrowCount; - if (super->frameIndex - this->unk_78 != gPlayerEntity.frameIndex) { - super->frameIndex = gPlayerEntity.frameIndex + this->unk_78; + if (super->frameIndex - this->unk_78 != gPlayerEntity.base.frameIndex) { + super->frameIndex = gPlayerEntity.base.frameIndex + this->unk_78; if (arrowCount == 0) { super->frameIndex += 0x2a; } sub_080042D0(super, super->frameIndex, super->spriteIndex); } - if ((gPlayerEntity.frame & 1) != 0 && arrowCount != 0) { + if ((gPlayerEntity.base.frame & 1) != 0 && arrowCount != 0) { entity = CreatePlayerItem(PLAYER_ITEM_BOW, 1, super->hurtType, 9); if (entity != NULL) { gPlayerState.attack_status |= 0x80; ModArrows(-1); } } - sub_08078E84(super, &gPlayerEntity); + sub_08078E84(super, &gPlayerEntity.base); } } diff --git a/src/playerItem/playerItemCellOverwriteSet.c b/src/playerItem/playerItemCellOverwriteSet.c index 22c3f8da..cf841e9f 100644 --- a/src/playerItem/playerItemCellOverwriteSet.c +++ b/src/playerItem/playerItemCellOverwriteSet.c @@ -23,7 +23,7 @@ extern const u8 gUnk_080B7A3E[]; // TODO figure out type from arm_sub_080B1B84 a void PlayerItemCellOverwriteSet(PlayerItemCellOverwriteSetEntity* this) { static const s8 gUnk_080B7B6C[] = { 0x0, -0x10, 0x10, 0x0, 0x0, 0x10, -0x10, 0x0 }; u32 tmp; - Entity* player = &gPlayerEntity; + Entity* player = &gPlayerEntity.base; if (super->action == 0) { this->tileType = GetTileType(TILE(player->x.HALF.HI + gUnk_080B7B6C[player->animationState & 0xe], diff --git a/src/playerItem/playerItemDashSword.c b/src/playerItem/playerItemDashSword.c index 497e128e..ef127535 100644 --- a/src/playerItem/playerItemDashSword.c +++ b/src/playerItem/playerItemDashSword.c @@ -67,13 +67,13 @@ void sub_0801B938(Entity* this) { const s8* ptr; if ((this->animationState & 2)) { - this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX ^ 1; + this->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX ^ 1; } else { - this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX; + this->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX; } - if ((u8)(gPlayerEntity.animIndex + 0x68) < 4) { - this->frameIndex = gPlayerEntity.frameIndex + 0x2e; + if ((u8)(gPlayerEntity.base.animIndex + 0x68) < 4) { + this->frameIndex = gPlayerEntity.base.frameIndex + 0x2e; sub_080042D0(this, this->frameIndex, this->spriteIndex); } else { this->frameIndex = 0xff; @@ -82,7 +82,7 @@ void sub_0801B938(Entity* this) { this->hitbox = (Hitbox*)&gUnk_080B7850[this->animationState >> 1]; ptr = &gUnk_080B7848[(this->animationState >> 1) * 2]; sub_08008782(this, -(gPlayerState.skills & SKILL_ROCK_BREAKER) != 0, ptr[0], ptr[1]); - sub_08078E84(this, &gPlayerEntity); + sub_08078E84(this, &gPlayerEntity.base); } void sub_0801B9F0(Entity* this) { diff --git a/src/playerItem/playerItemFireRodProjectile.c b/src/playerItem/playerItemFireRodProjectile.c index 04612e50..eb5c4005 100644 --- a/src/playerItem/playerItemFireRodProjectile.c +++ b/src/playerItem/playerItemFireRodProjectile.c @@ -38,7 +38,7 @@ void PlayerItemFireRodProjectile_Init(PlayerItemFireRodProjectileEntity* this) { super->action = 1; CopyPosition(super->parent, super); if (super->type == 0) { - super->collisionFlags = gPlayerEntity.collisionFlags + 1; + super->collisionFlags = gPlayerEntity.base.collisionFlags + 1; super->hitbox = (Hitbox*)&gUnk_08127278; super->speed = 0x400; if (super->collisionLayer == 2) { @@ -70,7 +70,7 @@ void PlayerItemFireRodProjectile_Action1(PlayerItemFireRodProjectileEntity* this if (super->type2 == 0) { sub_0800451C(super); } - if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0 && + if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0 && sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI)) { CreateFx(super, FX_SWORD_MAGIC, 0); DeleteThisEntity(); diff --git a/src/playerItem/playerItemGust.c b/src/playerItem/playerItemGust.c index cea176c4..40e2a1be 100644 --- a/src/playerItem/playerItemGust.c +++ b/src/playerItem/playerItemGust.c @@ -70,7 +70,7 @@ void PlayerItemGust(Entity* this) { static void PlayerItemGust_Init(PlayerItemGustEntity* this) { super->action = GUST_UPDATE; - super->flags2 = gPlayerEntity.flags2; + super->flags2 = gPlayerEntity.base.flags2; super->direction = super->animationState << 2; super->speed = 0x200; super->flags |= ENT_COLLIDE | ENT_PERSIST; @@ -166,8 +166,8 @@ bool32 sub_080ACDB0(PlayerItemGustEntity* this) { u32 tmp; if (super->type == 0) { - super->x.HALF.HI = gPlayerEntity.x.HALF.HI + gUnk_08126EE4[super->animationState]; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI + gUnk_08126EE4[super->animationState + 1]; + super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + gUnk_08126EE4[super->animationState]; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + gUnk_08126EE4[super->animationState + 1]; } else { if ((super->animationState & 2) != 0) { super->y.HALF.HI = super->parent->y.HALF.HI - 3; @@ -219,7 +219,7 @@ bool32 sub_080ACDB0(PlayerItemGustEntity* this) { } } } - super->collisionLayer = gPlayerEntity.collisionLayer; + super->collisionLayer = gPlayerEntity.base.collisionLayer; return 0; } diff --git a/src/playerItem/playerItemGustBig.c b/src/playerItem/playerItemGustBig.c index 913be2b1..15e95c2d 100644 --- a/src/playerItem/playerItemGustBig.c +++ b/src/playerItem/playerItemGustBig.c @@ -8,7 +8,6 @@ #include "entity.h" #include "functions.h" #include "global.h" -#include "new_player.h" #include "player.h" #include "sound.h" @@ -67,14 +66,14 @@ void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this) { u8 uVar2; Entity* pEVar3; - this->unk_84 = super->x.WORD = gPlayerEntity.x.WORD; - this->unk_80 = super->y.WORD = gPlayerEntity.y.WORD; - uVar2 = super->animationState = gPlayerEntity.animationState & 0xe; + this->unk_84 = super->x.WORD = gPlayerEntity.base.x.WORD; + this->unk_80 = super->y.WORD = gPlayerEntity.base.y.WORD; + uVar2 = super->animationState = gPlayerEntity.base.animationState & 0xe; super->direction = (u8)(uVar2 << 2); super->speed = 0x400; super->hitType = 0x96; - super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x80; - super->flags2 = gPlayerEntity.flags2; + super->collisionFlags = (gPlayerEntity.base.collisionFlags + 1) | 0x80; + super->flags2 = gPlayerEntity.base.flags2; pEVar3 = super->child; if (pEVar3 != NULL) { super->action = 1; @@ -99,9 +98,9 @@ void PlayerItemGustBig_Init(PlayerItemGustBigEntity* this) { super->damage = gUnk_080B3DE0[super->type * 2 + 1]; super->hurtType = 0x1b; super->hitbox = (Hitbox*)gUnk_080B3DE8[super->type]; - gNewPlayerEntity.unk_70 = super; - sub_08078CD0(&gPlayerEntity); - gNewPlayerEntity.unk_70 = pEVar3; + gPlayerEntity.unk_70 = super; + sub_08078CD0(&gPlayerEntity.base); + gPlayerEntity.unk_70 = pEVar3; InitializeAnimation(super, super->type + 10); sub_08018FA0(super); } @@ -129,7 +128,7 @@ void PlayerItemGustBig_Action1(PlayerItemGustBigEntity* this) { sub_08018FA0(super); break; } - sub_08078CD0(&gPlayerEntity); + sub_08078CD0(&gPlayerEntity.base); } void PlayerItemGustBig_Action2(PlayerItemGustBigEntity* this) { @@ -207,7 +206,7 @@ void PlayerItemGustBig_Action3(PlayerItemGustBigEntity* this) { } void sub_08018FA0(Entity* this) { - this->collisionLayer = gPlayerEntity.collisionLayer; + this->collisionLayer = gPlayerEntity.base.collisionLayer; if (this->collisionLayer == 2) { this->type2 = 1; } diff --git a/src/playerItem/playerItemGustJar.c b/src/playerItem/playerItemGustJar.c index 4afa8857..b3ebcb29 100644 --- a/src/playerItem/playerItemGustJar.c +++ b/src/playerItem/playerItemGustJar.c @@ -33,7 +33,7 @@ void PlayerItemGustJar(Entity* this) { DeleteThisEntity(); } PlayerItemGustJar_Actions[this->action](this); - sub_08078E84(this, &gPlayerEntity); + sub_08078E84(this, &gPlayerEntity.base); } void PlayerItemGustJar_Init(Entity* this) { @@ -65,10 +65,10 @@ void PlayerItemGustJar_Action2(Entity* this) { if (gPlayerState.field_0x1c == 3) { this->action++; - InitAnimationForceUpdate(this, (gPlayerEntity.animationState >> 1) + 8); + InitAnimationForceUpdate(this, (gPlayerEntity.base.animationState >> 1) + 8); } else if (gPlayerState.field_0x1c == 6) { this->action = 4; - InitAnimationForceUpdate(this, (gPlayerEntity.animationState >> 1) + 4); + InitAnimationForceUpdate(this, (gPlayerEntity.base.animationState >> 1) + 4); } else { windSound = 0; if (this->type != 0) { @@ -121,7 +121,7 @@ void PlayerItemGustJar_Action2(Entity* this) { } this->subtimer = 15; } - this->frameIndex = gPlayerEntity.frameIndex - (gPlayerEntity.frame & 0x7f); + this->frameIndex = gPlayerEntity.base.frameIndex - (gPlayerEntity.base.frame & 0x7f); } } @@ -129,7 +129,7 @@ void PlayerItemGustJar_Action3(Entity* this) { switch (gPlayerState.field_0x1c & 0xf) { case 6: this->action++; - InitAnimationForceUpdate(this, (gPlayerEntity.animationState >> 1) + 4); + InitAnimationForceUpdate(this, (gPlayerEntity.base.animationState >> 1) + 4); break; case 1: sub_080ADCA0(this, 0); @@ -150,11 +150,11 @@ void PlayerItemGustJar_Action4(Entity* this) { } void sub_080ADC84(Entity* this) { - this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX; + this->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX; } void sub_080ADCA0(Entity* this, u32 param_2) { - const u8* pFVar1 = gUnk_08132714[(param_2 + (gPlayerEntity.animationState >> 1))]; + const u8* pFVar1 = gUnk_08132714[(param_2 + (gPlayerEntity.base.animationState >> 1))]; const u8* pFVar2; this->animPtr = (void*)pFVar1; diff --git a/src/playerItem/playerItemHeldObject.c b/src/playerItem/playerItemHeldObject.c index 60ad9ecb..e7fb4643 100644 --- a/src/playerItem/playerItemHeldObject.c +++ b/src/playerItem/playerItemHeldObject.c @@ -8,7 +8,6 @@ #include "effects.h" #include "entity.h" #include "functions.h" -#include "new_player.h" #include "player.h" #include "sound.h" @@ -87,7 +86,7 @@ void PlayerItemHeldObject_SubAction1(PlayerItemHeldObjectEntity* this) { PlayerDropHeldObject(); DeleteThisEntity(); } else { - if ((gPlayerState.heldObject == 0) || ((gNewPlayerEntity.unk_79 & 0x7f) != 0)) { + if ((gPlayerState.heldObject == 0) || ((gPlayerEntity.unk_79 & 0x7f) != 0)) { sub_080AD27C(this); super->subAction++; super->flags &= ~0x80; @@ -205,13 +204,13 @@ void PlayerItemHeldObject_SubAction2(PlayerItemHeldObjectEntity* this) { } } else { - tmp = gPlayerEntity.frame & 1; + tmp = gPlayerEntity.base.frame & 1; if (tmp != 0) { SoundReq(SFX_PLY_VO5); sub_080AD27C(this); return; } - if ((gPlayerState.heldObject != 0) && ((gNewPlayerEntity.unk_79 & 0x80) == 0)) { + if ((gPlayerState.heldObject != 0) && ((gPlayerEntity.unk_79 & 0x80) == 0)) { return; } sub_080AD27C(this); @@ -236,7 +235,7 @@ void sub_080AD27C(PlayerItemHeldObjectEntity* this) { static const u32 gUnk_081320D4[] = { Q_16_16(0), Q_16_16(0.5), Q_16_16(1.25), Q_16_16(1.25) }; u32 tmp; PlayerItemHeldObjectEntity* child = (PlayerItemHeldObjectEntity*)super->child; - gNewPlayerEntity.unk_74 = NULL; + gPlayerEntity.unk_74 = NULL; if ((this->unk_6c == (u16)(child->base).kind) && (this->unk_6e == (u16)(child->base).id)) { if (child != this) { (child->base).subAction = 2; @@ -250,9 +249,9 @@ void sub_080AD27C(PlayerItemHeldObjectEntity* this) { (child->base).z.HALF.HI += 8; super->z.HALF.HI = (child->base).z.HALF.HI; super->collisionLayer = (child->base).collisionLayer; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI; - super->x.HALF.HI = gPlayerEntity.x.HALF.HI; - super->collisionFlags = gPlayerEntity.collisionFlags; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI; + super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI; + super->collisionFlags = gPlayerEntity.base.collisionFlags; super->flags |= 0x80; sub_0801766C(super); } else { diff --git a/src/playerItem/playerItemLantern.c b/src/playerItem/playerItemLantern.c index 3e66b86f..04664464 100644 --- a/src/playerItem/playerItemLantern.c +++ b/src/playerItem/playerItemLantern.c @@ -30,7 +30,7 @@ void PlayerItemLantern_Init(Entity* this) { this->updatePriority = 6; this->collisionFlags = 7; this->flags2 = -0x80; - this->animationState = gPlayerEntity.animationState & 0xe; + this->animationState = gPlayerEntity.base.animationState & 0xe; if (AllocMutableHitbox(this) == NULL) { DeleteThisEntity(); } @@ -42,27 +42,27 @@ void PlayerItemLantern_Init(Entity* this) { void PlayerItemLantern_Action1(Entity* this) { Entity* object; static const s8 offsets[] = { 6, -6, 7, -3, -5, 2, -7, -3 }; - this->animationState = gPlayerEntity.animationState & 0xe; + this->animationState = gPlayerEntity.base.animationState & 0xe; this->hitbox->offset_x = offsets[this->animationState]; this->hitbox->offset_y = offsets[this->animationState + 1]; this->hitbox->width = 4; this->hitbox->height = 4; - if (!((gPlayerEntity.frameIndex < 0x37) && ((u32)gPlayerEntity.spriteIndex == 6))) { + if (!((gPlayerEntity.base.frameIndex < 0x37) && ((u32)gPlayerEntity.base.spriteIndex == 6))) { this->frameIndex = 0xff; this->flags &= ~ENT_COLLIDE; } else { this->flags |= ENT_COLLIDE; - this->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX; - this->spriteSettings.flipY = gPlayerEntity.spriteSettings.flipY; - if (gPlayerEntity.frameIndex != this->frameIndex) { - this->frameIndex = gPlayerEntity.frameIndex; + this->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX; + this->spriteSettings.flipY = gPlayerEntity.base.spriteSettings.flipY; + if (gPlayerEntity.base.frameIndex != this->frameIndex) { + this->frameIndex = gPlayerEntity.base.frameIndex; sub_080042D0(this, this->frameIndex, this->spriteIndex); } - this->frame = gPlayerEntity.frame; - this->frameSpriteSettings = gPlayerEntity.frameSpriteSettings; + this->frame = gPlayerEntity.base.frame; + this->frameSpriteSettings = gPlayerEntity.base.frameSpriteSettings; } if (IsItemEquipped(ITEM_LANTERN_ON) < EQUIP_SLOT_NONE) { - if (((this->frameIndex != 0xff) && (gPlayerEntity.spriteSettings.draw != 0)) && (this->timer-- == 0)) { + if (((this->frameIndex != 0xff) && (gPlayerEntity.base.spriteSettings.draw != 0)) && (this->timer-- == 0)) { this->timer = 4; object = CreateObject(LAMP_PARTICLE, 0, 0x10); if (object != NULL) { @@ -72,7 +72,7 @@ void PlayerItemLantern_Action1(Entity* this) { object->spriteOffsetY = offsets[this->animationState + 1]; } } - sub_08078E84(this, &gPlayerEntity); + sub_08078E84(this, &gPlayerEntity.base); } else { DeleteThisEntity(); } diff --git a/src/playerItem/playerItemPacciCane.c b/src/playerItem/playerItemPacciCane.c index 65c665ad..a6ef2553 100644 --- a/src/playerItem/playerItemPacciCane.c +++ b/src/playerItem/playerItemPacciCane.c @@ -35,30 +35,30 @@ void PlayerItemPacciCane_Action1(Entity* this) { u32 playerFrame; u32 frameIndex; u32 flipX; - if (((gPlayerEntity.frame & ANIM_DONE) != 0) || (this != gPlayerState.item)) { + if (((gPlayerEntity.base.frame & ANIM_DONE) != 0) || (this != gPlayerState.item)) { if (this == gPlayerState.item) { gPlayerState.item = NULL; } DeleteEntity(this); } else { - playerFrame = gPlayerEntity.frame & 0xf; + playerFrame = gPlayerEntity.base.frame & 0xf; if (playerFrame != 0xf) { - frameIndex = gPlayerEntity.frameIndex; + frameIndex = gPlayerEntity.base.frameIndex; playerFrame += 0x91; if (frameIndex - playerFrame != this->frameIndex) { this->frameIndex = frameIndex + 0x6f; sub_080042D0(this, this->frameIndex, this->spriteIndex); } - sub_08078E84(this, &gPlayerEntity); + sub_08078E84(this, &gPlayerEntity.base); } else { this->frameIndex = -1; } } - if ((gPlayerEntity.animationState & 2)) { - flipX = gPlayerEntity.spriteSettings.flipX ^ 1; + if ((gPlayerEntity.base.animationState & 2)) { + flipX = gPlayerEntity.base.spriteSettings.flipX ^ 1; } else { - flipX = gPlayerEntity.spriteSettings.flipX; + flipX = gPlayerEntity.base.spriteSettings.flipX; } this->spriteSettings.flipX = flipX; } diff --git a/src/playerItem/playerItemPacciCaneProjectile.c b/src/playerItem/playerItemPacciCaneProjectile.c index 9bc25f27..ef2bee36 100644 --- a/src/playerItem/playerItemPacciCaneProjectile.c +++ b/src/playerItem/playerItemPacciCaneProjectile.c @@ -71,8 +71,8 @@ void PlayerItemPacciCaneProjectile_Init(PlayerItemPacciCaneProjectileEntity* thi super->speed = 0x200; this->unk_74 = 0x40; this->unk_78 = 0x1e0; - super->x.HALF.HI = gPlayerEntity.x.HALF.HI + gUnk_0811B9A0[super->animationState]; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI + gUnk_0811B9A0[super->animationState + 1]; + super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + gUnk_0811B9A0[super->animationState]; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI + gUnk_0811B9A0[super->animationState + 1]; super->collisionFlags = 7; super->flags2 = 0x8a; super->hitbox = (Hitbox*)&gUnk_0811B9D0; @@ -81,7 +81,7 @@ void PlayerItemPacciCaneProjectile_Init(PlayerItemPacciCaneProjectileEntity* thi } else { super->type = 0; } - super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; + super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; ptr = &gUnk_0811B9A8[(super->animationState >> 1)]; super->spriteSettings.flipX = ptr->flipX; super->spriteSettings.flipY = ptr->flipY; @@ -125,7 +125,7 @@ void PlayerItemPacciCaneProjectile_Action1(PlayerItemPacciCaneProjectileEntity* if (super->type == 0) { sub_0800451C(super); } - if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) { + if (sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0) { if (sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) == 0) { if (GetTileUnderEntity(super) == 0x19) { super->action = 4; diff --git a/src/playerItem/playerItemShield.c b/src/playerItem/playerItemShield.c index a1b38a61..bb592f74 100644 --- a/src/playerItem/playerItemShield.c +++ b/src/playerItem/playerItemShield.c @@ -75,7 +75,7 @@ void PlayerItemShield_Init(PlayerItemShieldEntity* this) { } else { this->unk_70 = 0; } - super->animationState = gPlayerEntity.animationState & 0xe; + super->animationState = gPlayerEntity.base.animationState & 0xe; sub_08079BD8(super); LoadSwapGFX(super, 1, 3); PlayerItemShield_Action1(this); @@ -86,10 +86,10 @@ void PlayerItemShield_Action1(PlayerItemShieldEntity* this) { u8* pbVar3; u32 tmp2; - if ((gPlayerEntity.iframes == 0) || ((u8)gPlayerEntity.iframes == 0x81)) { - gPlayerEntity.iframes = super->iframes; - gPlayerEntity.knockbackDirection = super->knockbackDirection; - gPlayerEntity.knockbackDuration = super->knockbackDuration; + if ((gPlayerEntity.base.iframes == 0) || ((u8)gPlayerEntity.base.iframes == 0x81)) { + gPlayerEntity.base.iframes = super->iframes; + gPlayerEntity.base.knockbackDirection = super->knockbackDirection; + gPlayerEntity.base.knockbackDuration = super->knockbackDuration; super->knockbackDuration = 0; super->iframes = 0; } @@ -97,7 +97,7 @@ void PlayerItemShield_Action1(PlayerItemShieldEntity* this) { if ((gPlayerState.shield_status != 0) && (super == gPlayerState.item)) { if ((gPlayerState.shield_status & 0x80) != 0) { super->hitbox = (Hitbox*)gUnk_08127240[super->animationState >> 1]; - super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20; + super->collisionFlags = (gPlayerEntity.base.collisionFlags + 1) | 0x20; COLLISION_ON(super); gPlayerState.shield_status &= ~0x80; sub_080176E4(super); @@ -131,16 +131,16 @@ void PlayerItemShield_Action1(PlayerItemShieldEntity* this) { DeleteThisEntity(); } - if (((gPlayerEntity.spriteIndex == 1u) || (gPlayerEntity.spriteIndex == 4u)) && - ((u8)(gPlayerEntity.frameIndex - 0x25) < 0x3f)) { - super->spriteSettings.flipX = gPlayerEntity.spriteSettings.flipX; - super->spriteSettings.flipY = gPlayerEntity.spriteSettings.flipY; - if ((gPlayerEntity.frameIndex - 0x25 + this->unk_70 != super->frameIndex) && - ((super->frameIndex = gPlayerEntity.frameIndex - 0x25 + this->unk_70, - this->unk_68 != 0xe || ((gPlayerEntity.frame & 0x7f) == 0)))) { + if (((gPlayerEntity.base.spriteIndex == 1u) || (gPlayerEntity.base.spriteIndex == 4u)) && + ((u8)(gPlayerEntity.base.frameIndex - 0x25) < 0x3f)) { + super->spriteSettings.flipX = gPlayerEntity.base.spriteSettings.flipX; + super->spriteSettings.flipY = gPlayerEntity.base.spriteSettings.flipY; + if ((gPlayerEntity.base.frameIndex - 0x25 + this->unk_70 != super->frameIndex) && + ((super->frameIndex = gPlayerEntity.base.frameIndex - 0x25 + this->unk_70, + this->unk_68 != 0xe || ((gPlayerEntity.base.frame & 0x7f) == 0)))) { sub_080042D0(super, super->frameIndex, super->spriteIndex); } - if (((this->unk_68 == 0xe) && ((gPlayerEntity.frame & 0x7f) != 0))) { + if (((this->unk_68 == 0xe) && ((gPlayerEntity.base.frame & 0x7f) != 0))) { if (--this->unk_78 == 0) { this->unk_74++; tmp2 = this->unk_74 * 4; @@ -155,16 +155,16 @@ void PlayerItemShield_Action1(PlayerItemShieldEntity* this) { pbVar3 = &this->unk_7c[this->unk_74 * 4]; this->unk_78 = pbVar3[1]; if ((gPlayerState.shield_status & 0x40) != 0) { - u32 temp = (gPlayerEntity.frame & 0x7f) + 8; + u32 temp = (gPlayerEntity.base.frame & 0x7f) + 8; sub_080042D0(super, temp + pbVar3[0], super->spriteIndex); } else { - sub_080042D0(super, (gPlayerEntity.frame & 0x7f) + pbVar3[0], super->spriteIndex); + sub_080042D0(super, (gPlayerEntity.base.frame & 0x7f) + pbVar3[0], super->spriteIndex); } } } - super->frame = gPlayerEntity.frame; - super->frameSpriteSettings = gPlayerEntity.frameSpriteSettings; - sub_08078E84(super, &gPlayerEntity); + super->frame = gPlayerEntity.base.frame; + super->frameSpriteSettings = gPlayerEntity.base.frameSpriteSettings; + sub_08078E84(super, &gPlayerEntity.base); } else { super->frameIndex = 0xff; } diff --git a/src/playerItem/playerItemSpiralBeam.c b/src/playerItem/playerItemSpiralBeam.c index 76901cab..e381d594 100644 --- a/src/playerItem/playerItemSpiralBeam.c +++ b/src/playerItem/playerItemSpiralBeam.c @@ -31,10 +31,10 @@ void PlayerItemSpiralBeam(PlayerItemSpiralBeamEntity* this) { void PlayerItemSpiralBeam_Init(PlayerItemSpiralBeamEntity* this) { static const Hitbox gUnk_08109AD0 = { 0, 0, { 4, 0, 0, 0 }, 6, 6 }; - CopyPosition(&gPlayerEntity, super); + CopyPosition(&gPlayerEntity.base, super); super->action++; super->spriteSettings.draw = TRUE; - super->collisionFlags = gPlayerEntity.collisionFlags + 1; + super->collisionFlags = gPlayerEntity.base.collisionFlags + 1; super->hitbox = (Hitbox*)&gUnk_08109AD0; super->speed = 0x380; super->animationState = super->animationState & 0x7f; @@ -58,7 +58,7 @@ void PlayerItemSpiralBeam_Action1(PlayerItemSpiralBeamEntity* this) { if (super->type2 == 0) { sub_0800451C(super); } - if (!sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) && + if (!sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) && sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI)) { CreateFx(super, FX_SWORD_MAGIC, 0); DeleteThisEntity(); diff --git a/src/playerItem/playerItemSword.c b/src/playerItem/playerItemSword.c index 647ea097..6df61709 100644 --- a/src/playerItem/playerItemSword.c +++ b/src/playerItem/playerItemSword.c @@ -33,7 +33,7 @@ void PlayerItemSword(Entity* this) { }; PlayerItemSword_Actions[this->action]((PlayerItemSwordEntity*)this); if (this->type == 0) { - sub_08078E84(this, &gPlayerEntity); + sub_08078E84(this, &gPlayerEntity.base); this->hitbox->offset_x += this->spriteOffsetX; this->hitbox->offset_y += this->spriteOffsetY; } @@ -58,8 +58,8 @@ void PlayerItemSword_Init(PlayerItemSwordEntity* this) { DeleteThisEntity(); } LoadSwapGFX(super, 1, 3); - super->collisionFlags = (gPlayerEntity.collisionFlags + 1) | 0x20; - super->flags2 = gPlayerEntity.flags2; + super->collisionFlags = (gPlayerEntity.base.collisionFlags + 1) | 0x20; + super->flags2 = gPlayerEntity.base.flags2; super->updatePriority = 6; super->contactFlags = 0; super->iframes = 0; @@ -182,7 +182,7 @@ void PlayerItemSword_Action1(PlayerItemSwordEntity* this) { break; } } - if ((gPlayerEntity.frame & 0x20) != 0) { + if ((gPlayerEntity.base.frame & 0x20) != 0) { SoundReq(SFX_116); } } else { @@ -194,7 +194,7 @@ void PlayerItemSword_Action1(PlayerItemSwordEntity* this) { super->hurtType = 0xb; } } - if (((gPlayerState.swordDamage) != 0) && ((gPlayerEntity.frame & 0x40) != 0)) { + if (((gPlayerState.swordDamage) != 0) && ((gPlayerEntity.base.frame & 0x40) != 0)) { type = FX_BLUE_SPARKLE; if ((gPlayerState.swordDamage) == 1) { type = FX_SPARKLE2; @@ -211,7 +211,7 @@ void PlayerItemSword_Action1(PlayerItemSwordEntity* this) { } } } - sub_080A78B8(this, &gPlayerEntity); + sub_080A78B8(this, &gPlayerEntity.base); sub_080A7A84(this); } else { if (!((gPlayerState.attack_status == 0) || (gPlayerState.item->hurtType == 0))) { @@ -235,18 +235,18 @@ void PlayerItemSword_Action2(PlayerItemSwordEntity* this) { gPlayerState.item = NULL; DeleteThisEntity(); } - if ((gPlayerEntity.frame & 0x80) != 0) { + if ((gPlayerEntity.base.frame & 0x80) != 0) { gPlayerState.item = NULL; DeleteThisEntity(); } else { - sub_080A78B8(this, &gPlayerEntity); - if ((gPlayerEntity.frame & 0x20) != 0) { + sub_080A78B8(this, &gPlayerEntity.base); + if ((gPlayerEntity.base.frame & 0x20) != 0) { SoundReq(SFX_PLY_VO3); } if (super->frameIndex > 0x8a) { super->frameIndex = 0xff; } - if ((gPlayerEntity.frame & 8) != 0) { + if ((gPlayerEntity.base.frame & 8) != 0) { super->flags |= ENT_COLLIDE; sub_080A7B98(this); } else { @@ -335,7 +335,7 @@ void sub_080A78B8(PlayerItemSwordEntity* this, Entity* param_2) { void sub_080A7A54(PlayerItemSwordEntity* this) { const u8* tmp; - tmp = &gUnk_08129096[(gPlayerEntity.frameIndex - 0x6a) * 4]; + tmp = &gUnk_08129096[(gPlayerEntity.base.frameIndex - 0x6a) * 4]; super->hitbox->offset_x = tmp[0]; super->hitbox->offset_y = tmp[1]; super->hitbox->width = tmp[2]; @@ -353,11 +353,11 @@ void sub_080A7A84(PlayerItemSwordEntity* this) { u32 tmp2; u32 r5; - if ((gPlayerEntity.frame & 0xf) != 0) { - uVar3 = gUnk_08129072[((gPlayerEntity.frame & 0xf) - 1)][0]; + if ((gPlayerEntity.base.frame & 0xf) != 0) { + uVar3 = gUnk_08129072[((gPlayerEntity.base.frame & 0xf) - 1)][0]; one = 1; - r5 = gUnk_08129072[(gPlayerEntity.frame & 0xf) - 1][one]; - if (((gPlayerState.sword_state & 0xc0) == 0) && (gPlayerEntity.spriteSettings.flipX == 1)) { + r5 = gUnk_08129072[(gPlayerEntity.base.frame & 0xf) - 1][one]; + if (((gPlayerState.sword_state & 0xc0) == 0) && (gPlayerEntity.base.spriteSettings.flipX == 1)) { uVar3 = -uVar3; } if (super->type != 0) { @@ -374,9 +374,9 @@ void sub_080A7A84(PlayerItemSwordEntity* this) { ((gPlayerState.sword_state & 0xc0) == 0)) { new_var2 = super; if (GetRelativeCollisionTile(new_var2, new_var, r5) == 0x2e) { - SoundReqClipped(&gPlayerEntity, SFX_ITEM_GLOVES_KNOCKBACK); + SoundReqClipped(&gPlayerEntity.base, SFX_ITEM_GLOVES_KNOCKBACK); } else { - SoundReqClipped(&gPlayerEntity, SFX_METAL_CLINK); + SoundReqClipped(&gPlayerEntity.base, SFX_METAL_CLINK); } effect = CreateObject(SPECIAL_FX, FX_LIGHTNING, 0); if (effect != NULL) { diff --git a/src/playerItem/playerItemSwordBeam.c b/src/playerItem/playerItemSwordBeam.c index dfe78825..0d572c09 100644 --- a/src/playerItem/playerItemSwordBeam.c +++ b/src/playerItem/playerItemSwordBeam.c @@ -40,10 +40,10 @@ static const u8 PlayerItemSwordBeam_Palettes[] = { 0, 4, 1, 2, 0xff }; void PlayerItemSwordBeam_Init(PlayerItemSwordBeamEntity* this) { static const Hitbox hitbox = { 0, 0, { 4, 0, 0, 0 }, 6, 6 }; - CopyPosition(&gPlayerEntity, super); + CopyPosition(&gPlayerEntity.base, super); super->action++; super->spriteSettings.draw = 1; - super->collisionFlags = gPlayerEntity.collisionFlags + 1; + super->collisionFlags = gPlayerEntity.base.collisionFlags + 1; super->hitbox = (Hitbox*)&hitbox; super->speed = 0x380; this->unk_74 = 2; @@ -88,7 +88,7 @@ void PlayerItemSwordBeam_Action1(PlayerItemSwordBeamEntity* this) { if (super->type2 == 0) { sub_0800451C(super); } - if ((sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.collisionLayer, 0x80) == 0) && + if ((sub_080B1BA4(COORD_TO_TILE(super), gPlayerEntity.base.collisionLayer, 0x80) == 0) && (sub_080040D8(super, &gUnk_08003E44, super->x.HALF.HI, super->y.HALF.HI) != 0)) { CreateFx(super, FX_SWORD_MAGIC, 0); DeleteThisEntity(); diff --git a/src/playerItemUtils.c b/src/playerItemUtils.c index 6e7bb5f8..446bbdc7 100644 --- a/src/playerItemUtils.c +++ b/src/playerItemUtils.c @@ -25,7 +25,7 @@ void CreateItemEntity(u32 type, u32 type2, u32 delay) { void InitItemGetSequence(u32 type, u32 type2, u32 delay) { Entity* e = GiveItemWithCutscene(type, type2, delay); if (e != NULL) { - e->parent = &gPlayerEntity; + e->parent = &gPlayerEntity.base; SetPlayerItemGetState(e, e->type, 0); } } diff --git a/src/playerUtils.c b/src/playerUtils.c index 4625029f..16eb6033 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -1,23 +1,22 @@ #include "area.h" #include "asm.h" -#include "common.h" #include "collision.h" +#include "common.h" #include "entity.h" #include "functions.h" #include "game.h" #include "global.h" #include "item.h" #include "kinstone.h" +#include "main.h" #include "manager/diggingCaveEntranceManager.h" #include "message.h" -#include "new_player.h" #include "object.h" #include "player.h" #include "room.h" #include "save.h" #include "screen.h" #include "screenTransitions.h" -#include "main.h" static void sub_08077E54(ItemBehavior* beh); @@ -218,14 +217,14 @@ bool32 IsPreventedFromUsingItem(void) { switch (gArea.portal_mode) { case 2: if (gArea.portal_timer == 0) { - gPlayerEntity.subAction++; + gPlayerEntity.base.subAction++; } break; case 3: if ((gArea.portal_timer == 0) && ((gPlayerState.flags & PL_MINISH) != 0)) { - gPlayerEntity.subAction++; - gPlayerEntity.flags &= ~ENT_COLLIDE; - RequestPriorityDuration(&gPlayerEntity, 180); + gPlayerEntity.base.subAction++; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; + RequestPriorityDuration(&gPlayerEntity.base, 180); return TRUE; } return FALSE; @@ -272,7 +271,7 @@ bool32 IsTryingToPickupObject(void) { ItemBehavior* item; if (!((((gPlayerState.flags & (PL_USE_PORTAL | PL_MINISH | PL_ROLLING)) == 0) && - (((gNewPlayerEntity.unk_79 != 0 || (gPlayerState.heldObject != 0)) || + (((gPlayerEntity.unk_79 != 0 || (gPlayerState.heldObject != 0)) || ((gPlayerState.playerInput.newInput & INPUT_LIFT_THROW) != 0)))) && (((sub_080789A8() != 0 || ((gPlayerState.playerInput.heldInput & (INPUT_ANY_DIRECTION | INPUT_USE_ITEM1 | INPUT_USE_ITEM2)) == 0)))))) { @@ -301,7 +300,7 @@ ItemBehavior* (*const gCreateItemsFuncs[])(Item) = { ItemBehavior* CreateItem(Item itemId) { if (((((gPlayerState.queued_action == PLAYER_ROLL) && (itemId != ITEM_TRY_PICKUP_OBJECT)) || (((gPlayerState.flags & (PL_ROLLING | PL_CLONING)) != 0 && (ITEM_FOURSWORD < itemId)))) || - ((((gPlayerState.jump_status != 0 || (gPlayerEntity.z.WORD != 0)) && (ITEM_FOURSWORD < itemId)) || + ((((gPlayerState.jump_status != 0 || (gPlayerEntity.base.z.WORD != 0)) && (ITEM_FOURSWORD < itemId)) || (((gPlayerState.flags & PL_MINISH) && !gItemDefinitions[itemId].isUseableAsMinish))))) || ((gPlayerState.floor_type == SURFACE_SWAMP && ((gPlayerState.surfaceTimer != 0 && (1 < itemId - 0x14)))))) { return NULL; @@ -406,7 +405,7 @@ void ResetActiveItems() { gPlayerState.heldObject = 0; gPlayerState.flags &= ~(PL_ROLLING | PL_SWORD_THRUST); - gNewPlayerEntity.unk_70 = NULL; + gPlayerEntity.unk_70 = NULL; if ((gPlayerState.jump_status & 0xc0) == 0) { gPlayerState.jump_status = 0; @@ -519,7 +518,7 @@ void sub_08077D38(ItemBehavior* this, u32 index) { gPlayerState.field_0xa |= 8 >> index; gPlayerState.keepFacing |= 8 >> index; - this->playerAnimationState = gPlayerEntity.animationState; + this->playerAnimationState = gPlayerEntity.base.animationState; if (this->stateID == 0) { this->stateID++; } @@ -564,26 +563,26 @@ void SetItemAnim(ItemBehavior* this, u32 animIndex) { if ((animIndex & 0xff) > 0xb8) { animIndex += this->playerAnimationState >> 1; } - gPlayerEntity.spriteIndex = (s16)(animIndex >> 8); - InitAnimationForceUpdate(&gPlayerEntity, (u8)animIndex); + gPlayerEntity.base.spriteIndex = (s16)(animIndex >> 8); + InitAnimationForceUpdate(&gPlayerEntity.base, (u8)animIndex); sub_08077E54(this); } void UpdateItemAnim(ItemBehavior* this) { - UpdateAnimationSingleFrame(&gPlayerEntity); + UpdateAnimationSingleFrame(&gPlayerEntity.base); sub_08077E54(this); } void sub_08077E3C(ItemBehavior* this, u32 index) { - sub_080042BA(&gPlayerEntity, index); + sub_080042BA(&gPlayerEntity.base, index); sub_08077E54(this); } static void sub_08077E54(ItemBehavior* this) { - this->playerAnimIndex = gPlayerEntity.animIndex; - this->playerFrameIndex = gPlayerEntity.frameIndex; - this->playerFrameDuration = gPlayerEntity.frameDuration; - this->playerFrame = gPlayerEntity.frame; + this->playerAnimIndex = gPlayerEntity.base.animIndex; + this->playerFrameIndex = gPlayerEntity.base.frameIndex; + this->playerFrameDuration = gPlayerEntity.base.frameDuration; + this->playerFrame = gPlayerEntity.base.frame; } void DeleteItemBehavior(ItemBehavior* this, u32 index) { @@ -878,16 +877,16 @@ const u16 gUnk_0811C466[] = { 803, 819, 822, 825, 820, 828, 826, 829, 821, 823, void sub_08077F84(void) { Entity* obj; - if ((gPlayerEntity.collisionLayer & 2) == 0) { - u32 tile = GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 12, 2); + if ((gPlayerEntity.base.collisionLayer & 2) == 0) { + u32 tile = GetTileTypeByPos(gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI - 12, 2); if (tile == 0x343 || tile == 0x344 || tile == 0x345 || tile == 0x346) { - sub_0807AA80(&gPlayerEntity); + sub_0807AA80(&gPlayerEntity.base); gPlayerState.jump_status |= 8; obj = CreateObject(ROTATING_TRAPDOOR, 0, 0); if (obj != NULL) { - obj->x = gPlayerEntity.x; - obj->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0xc; - gPlayerEntity.y.HALF.HI -= 0xc; + obj->x = gPlayerEntity.base.x; + obj->y.HALF.HI = gPlayerEntity.base.y.HALF.HI - 0xc; + gPlayerEntity.base.y.HALF.HI -= 0xc; } } } @@ -986,7 +985,7 @@ bool32 sub_08078140(ChargeState* info) { void ForceSetPlayerState(u32 framestate) { gPlayerState.framestate = framestate; - gPlayerEntity.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; PausePlayer(); } @@ -1105,7 +1104,7 @@ bool32 sub_080782C0(void) { if (gPlayerState.heldObject != 4) { return FALSE; } - if ((gNewPlayerEntity.unk_74)->child->kind != OBJECT || (gNewPlayerEntity.unk_74)->child->id != SHOP_ITEM) { + if ((gPlayerEntity.unk_74)->child->kind != OBJECT || (gPlayerEntity.unk_74)->child->id != SHOP_ITEM) { return FALSE; } } @@ -1204,14 +1203,14 @@ InteractableObject* sub_080784E4(void) { if (HasDungeonBigKey()) { r7 |= PL_FLAGS2; } - interactOffsets = (s8*)gPlayerInteractHitboxOffsetNormal + (gPlayerEntity.animationState & 6); + interactOffsets = (s8*)gPlayerInteractHitboxOffsetNormal + (gPlayerEntity.base.animationState & 6); } else { - interactOffsets = (s8*)gPlayerInteractHitboxOffsetMinish + (gPlayerEntity.animationState & 6); + interactOffsets = (s8*)gPlayerInteractHitboxOffsetMinish + (gPlayerEntity.base.animationState & 6); r7 = 0; } - interactX = gPlayerEntity.x.HALF.HI + interactOffsets[0]; - interactY = gPlayerEntity.y.HALF.HI + interactOffsets[1]; + interactX = gPlayerEntity.base.x.HALF.HI + interactOffsets[0]; + interactY = gPlayerEntity.base.y.HALF.HI + interactOffsets[1]; for (index = 0; index < 0x20; index++) { iObject = gInteractableObjects + index; @@ -1220,8 +1219,8 @@ InteractableObject* sub_080784E4(void) { continue; if (entity->interactType < 0) break; - if (((iObject->ignoreLayer & 1) == 0 && (gPlayerEntity.collisionLayer & entity->collisionLayer) == 0) || - (iObject->interactDirections >> (gPlayerEntity.animationState >> 1) & 1) != 0) + if (((iObject->ignoreLayer & 1) == 0 && (gPlayerEntity.base.collisionLayer & entity->collisionLayer) == 0) || + (iObject->interactDirections >> (gPlayerEntity.base.animationState >> 1) & 1) != 0) continue; switch (iObject->type) { case INTERACTION_NONE: @@ -1433,7 +1432,7 @@ u32 sub_080789A8(void) { return (u32)gCarriedEntity.unk_1; if (!(gPlayerState.flags & PL_MINISH)) { - uVar4 = sub_080B1B0C(&gPlayerEntity); + uVar4 = sub_080B1B0C(&gPlayerEntity.base); if (uVar4 >= 0x10 && (gUnk_080084BC[uVar4 - 0x10] == 0xf)) return 0; if (gPlayerState.floor_type == 0x12) @@ -1443,11 +1442,11 @@ u32 sub_080789A8(void) { uVar4 = (u32)gCarriedEntity.count; if (uVar4 > 0) { - ptr2 = &gUnk_0811BFE0[gPlayerEntity.animationState & 6]; + ptr2 = &gUnk_0811BFE0[gPlayerEntity.base.animationState & 6]; while (uVar4 > 0) { tmp1 = &gCarriedEntity.unk_8 + uVar4; entity = *tmp1; - if ((entity != NULL) && (sub_0807A180(&gPlayerEntity, entity, ptr2[0], ptr2[1]) != 0)) { + if ((entity != NULL) && (sub_0807A180(&gPlayerEntity.base, entity, ptr2[0], ptr2[1]) != 0)) { gCarriedEntity.unk_8 = *tmp1; gCarriedEntity.unk_1 = 2; return 2; @@ -1456,8 +1455,8 @@ u32 sub_080789A8(void) { } } - ptr = &gUnk_08007DF4[gPlayerEntity.animationState & 6]; - gCarriedEntity.unk_4 = uVar2 = sub_080B1A0C(&gPlayerEntity, (s8)ptr[0], (s8)ptr[1]); + ptr = &gUnk_08007DF4[gPlayerEntity.base.animationState & 6]; + gCarriedEntity.unk_4 = uVar2 = sub_080B1A0C(&gPlayerEntity.base, (s8)ptr[0], (s8)ptr[1]); if (!sub_0806FC24(uVar2, 6)) return 0; @@ -1497,9 +1496,9 @@ void SetPlayerItemGetState(Entity* item, u8 param_2, u8 param_3) { gPlayerState.framestate = PL_STATE_ITEMGET; gPlayerState.swim_state = 0; gPlayerState.field_0x14 = 1; - gPlayerEntity.child = item; - gPlayerEntity.flags &= ~ENT_COLLIDE; - gPlayerEntity.updatePriority = 2; + gPlayerEntity.base.child = item; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.updatePriority = 2; DeleteClones(); } @@ -1524,7 +1523,7 @@ void PausePlayer(void) { } break; } - gPlayerEntity.iframes = -2; + gPlayerEntity.base.iframes = -2; gPlayerState.field_0x8a = 2; } @@ -1605,26 +1604,26 @@ void sub_08078D60(void) { Entity* iVar4; Entity* player; - player = &gPlayerEntity; + player = &gPlayerEntity.base; iVar4 = (*(Entity**)&((GenericEntity*)player)->field_0x74)->child; if (iVar4->action != 2) return; - iVar4->z.HALF.HI = gPlayerEntity.spriteOffsetY + gPlayerEntity.z.HALF.HI; - iVar4->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; - iVar4->collisionLayer = gPlayerEntity.collisionLayer; - uVar3 = gPlayerEntity.frame & 0x7f; + iVar4->z.HALF.HI = gPlayerEntity.base.spriteOffsetY + gPlayerEntity.base.z.HALF.HI; + iVar4->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; + iVar4->collisionLayer = gPlayerEntity.base.collisionLayer; + uVar3 = gPlayerEntity.base.frame & 0x7f; puVar2 = gUnk_0811C0E8[iVar4->carryFlags >> 4]; - if (gPlayerEntity.spriteSettings.flipX) { - iVar4->x.HALF.HI = gPlayerEntity.x.HALF.HI - puVar2[uVar3]; + if (gPlayerEntity.base.spriteSettings.flipX) { + iVar4->x.HALF.HI = gPlayerEntity.base.x.HALF.HI - puVar2[uVar3]; } else { - iVar4->x.HALF.HI = gPlayerEntity.x.HALF.HI + puVar2[uVar3]; + iVar4->x.HALF.HI = gPlayerEntity.base.x.HALF.HI + puVar2[uVar3]; } iVar4->z.HALF.HI = puVar2[uVar3 + 1] + iVar4->z.HALF.HI; - iVar4->y.HALF.HI = gPlayerEntity.y.HALF.HI; - SortEntityAbove(&gPlayerEntity, iVar4); + iVar4->y.HALF.HI = gPlayerEntity.base.y.HALF.HI; + SortEntityAbove(&gPlayerEntity.base, iVar4); if (gPlayerState.heldObject == 4) { - iVar4->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; + iVar4->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; sub_0806F8DC(iVar4); if ((iVar4->carryFlags & 0xf) == 2) { switch (gRoomTransition.frameCount & 3) { @@ -1637,20 +1636,20 @@ void sub_08078D60(void) { } } } else { - if (gPlayerEntity.animationState >> 1 != 0) { - iVar4->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1; + if (gPlayerEntity.base.animationState >> 1 != 0) { + iVar4->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 - 1; } else { - iVar4->spritePriority.b0 = gPlayerEntity.spritePriority.b0 + 1; + iVar4->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0 + 1; } } } void sub_08078E84(Entity* param_1, Entity* param_2) { SpriteFrame* frame; - if (param_2 == &gPlayerEntity) { + if (param_2 == &gPlayerEntity.base) { sub_08079BD8(param_1); - param_1->spriteOffsetX = gPlayerEntity.spriteOffsetX; - param_1->spriteOffsetY = gPlayerEntity.spriteOffsetY; + param_1->spriteOffsetX = gPlayerEntity.base.spriteOffsetX; + param_1->spriteOffsetY = gPlayerEntity.base.spriteOffsetY; } frame = &gSpritePtrs[(u16)param_2->spriteIndex].frames[param_2->frameIndex]; if (frame->unk_1 != 0) { @@ -1661,18 +1660,18 @@ void sub_08078E84(Entity* param_1, Entity* param_2) { } void ResetPlayerPosition(void) { - gPlayerEntity.x.HALF.HI = gPlayerState.startPosX; - gPlayerEntity.y.HALF.HI = gPlayerState.startPosY; + gPlayerEntity.base.x.HALF.HI = gPlayerState.startPosX; + gPlayerEntity.base.y.HALF.HI = gPlayerState.startPosY; } bool32 CheckQueuedAction(void) { if (gPlayerState.queued_action == PLAYER_INIT) { return FALSE; } else { - gPlayerEntity.action = gPlayerState.queued_action; - gPlayerEntity.subAction = 0; + gPlayerEntity.base.action = gPlayerState.queued_action; + gPlayerEntity.base.subAction = 0; gPlayerState.queued_action = PLAYER_INIT; - DoPlayerAction(&gPlayerEntity); + DoPlayerAction(&gPlayerEntity.base); return TRUE; } } @@ -1816,7 +1815,7 @@ void sub_080790E4(Entity* this) { void PlayerDropHeldObject(void) { gPlayerState.heldObject = 0; gPlayerState.grab_status = 0; - gNewPlayerEntity.unk_74 = NULL; + gPlayerEntity.unk_74 = NULL; } void PlayerResetStateFromFusion(void) { @@ -1828,17 +1827,17 @@ void PlayerResetStateFromFusion(void) { } void SetPlayerActionNormal(void) { - gPlayerEntity.action = PLAYER_NORMAL; - gPlayerEntity.subAction = 0; - gPlayerEntity.subtimer = 0; + gPlayerEntity.base.action = PLAYER_NORMAL; + gPlayerEntity.base.subAction = 0; + gPlayerEntity.base.subtimer = 0; } void ResetPlayerAnimationAndAction(void) { if (!(gPlayerState.flags & PL_HIDDEN)) { - gPlayerEntity.spriteSettings.draw = 3; + gPlayerEntity.base.spriteSettings.draw = 3; } if (!(gPlayerState.flags & PL_MINISH)) { - gPlayerEntity.spritePriority.b1 = 1; + gPlayerEntity.base.spritePriority.b1 = 1; PlayerSetNormalAndCollide(); } else { PlayerMinishSetNormalAndCollide(); @@ -1846,40 +1845,40 @@ void ResetPlayerAnimationAndAction(void) { } void PlayerSetNormalAndCollide(void) { - gPlayerEntity.flags |= ENT_COLLIDE; - gPlayerEntity.spriteSettings.draw = 3; + gPlayerEntity.base.flags |= ENT_COLLIDE; + gPlayerEntity.base.spriteSettings.draw = 3; gPlayerState.flags &= ~(PL_BUSY | PL_DROWNING | PL_DISABLE_ITEMS | PL_FROZEN | PL_ROLLING | PL_IN_HOLE | PL_MOLDWORM_RELEASED | PL_PARACHUTE); ResolvePlayerAnimation(); SetPlayerActionNormal(); - SetEntityPriorityForKind(&gPlayerEntity); + SetEntityPriorityForKind(&gPlayerEntity.base); } void PlayerMinishSetNormalAndCollide(void) { if (!(gPlayerState.flags & PL_HIDDEN)) { - gPlayerEntity.flags |= ENT_COLLIDE; - gPlayerEntity.spriteSettings.draw = 3; + gPlayerEntity.base.flags |= ENT_COLLIDE; + gPlayerEntity.base.spriteSettings.draw = 3; } - gPlayerEntity.action = PLAYER_MINISH; - gPlayerEntity.subAction = 1; - gPlayerEntity.collisionFlags &= 0xfb; + gPlayerEntity.base.action = PLAYER_MINISH; + gPlayerEntity.base.subAction = 1; + gPlayerEntity.base.collisionFlags &= 0xfb; gPlayerState.animation = ANIM_BOUNCE_MINISH; gPlayerState.flags &= ~(PL_BUSY | PL_DROWNING | PL_DISABLE_ITEMS | PL_IN_HOLE | PL_MOLDWORM_RELEASED | PL_PARACHUTE); gPlayerState.swim_state = 0; gPlayerState.queued_action = PLAYER_INIT; - SetEntityPriorityForKind(&gPlayerEntity); + SetEntityPriorityForKind(&gPlayerEntity.base); } void sub_080792BC(s32 speed, u32 direction, u32 field_0x38) { gPlayerState.queued_action = PLAYER_08072454; gPlayerState.field_0x38 = field_0x38; - gPlayerEntity.speed = speed; - gPlayerEntity.direction = direction; + gPlayerEntity.base.speed = speed; + gPlayerEntity.base.direction = direction; } void sub_080792D8(void) { - Entity* playerEntity = &gPlayerEntity; + Entity* playerEntity = &gPlayerEntity.base; if (playerEntity->knockbackDuration == 0) return; @@ -1919,13 +1918,13 @@ void sub_080792D8(void) { bool32 sub_080793E4(u32 param_1) { u32 tmp; if (!gPlayerState.swim_state) { - tmp = gUnk_0811C0F8[gPlayerEntity.animationState >> 1]; + tmp = gUnk_0811C0F8[gPlayerEntity.base.animationState >> 1]; } else { - tmp = gUnk_0811C0F8[gPlayerEntity.direction >> 2]; + tmp = gUnk_0811C0F8[gPlayerEntity.base.direction >> 2]; } if (sub_08079778() && (gPlayerState.playerInput.heldInput & tmp)) { if (param_1 != 0) { - if (!sub_080B1BA4(GetPlayerTilePos(), gPlayerEntity.collisionLayer, param_1)) { + if (!sub_080B1BA4(GetPlayerTilePos(), gPlayerEntity.base.collisionLayer, param_1)) { return FALSE; } } @@ -1936,7 +1935,7 @@ bool32 sub_080793E4(u32 param_1) { } void RespawnPlayer(void) { - Entity* player = &gPlayerEntity; + Entity* player = &gPlayerEntity.base; player->action = PLAYER_080728AC; player->z.WORD = 0; player->zVelocity = 0; @@ -1950,16 +1949,18 @@ void RespawnPlayer(void) { u32 i; for (i = 0; i <= 0xf && gPlayerState.path_memory[i] != -1; i++) { if (sub_080B1B44((u16)gPlayerState.path_memory[i], gPlayerState.path_memory[i] >> 0x1e) != 0xf) { - gPlayerEntity.collisionLayer = gPlayerState.path_memory[i] >> 0x1e; - gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + (gPlayerState.path_memory[i] & 0x3f) * 16 + 8; - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + (gPlayerState.path_memory[i] & 0xfc0) / 4 + 8; - COLLISION_ON(&gPlayerEntity); + gPlayerEntity.base.collisionLayer = gPlayerState.path_memory[i] >> 0x1e; + gPlayerEntity.base.x.HALF.HI = + gRoomControls.origin_x + (gPlayerState.path_memory[i] & 0x3f) * 16 + 8; + gPlayerEntity.base.y.HALF.HI = + gRoomControls.origin_y + (gPlayerState.path_memory[i] & 0xfc0) / 4 + 8; + COLLISION_ON(&gPlayerEntity.base); break; } } } } - UpdateSpriteForCollisionLayer(&gPlayerEntity); + UpdateSpriteForCollisionLayer(&gPlayerEntity.base); } void sub_08079520(Entity* this) { @@ -1985,38 +1986,39 @@ bool32 sub_08079550(void) { if (!gDiggingCaveEntranceTransition.isDiggingCave) { if ((!gPlayerState.dash_state || (gPlayerState.flags & PL_BURNING)) && (gPlayerState.swim_state || (gPlayerState.sword_state & 0x40) || - gPlayerEntity.direction != gPlayerState.direction || (gPlayerEntity.direction & DIR_NOT_MOVING_CHECK))) { - gPlayerEntity.subtimer = 0; + gPlayerEntity.base.direction != gPlayerState.direction || + (gPlayerEntity.base.direction & DIR_NOT_MOVING_CHECK))) { + gPlayerEntity.base.subtimer = 0; return FALSE; } if (sub_08079778()) { - ptr = &gUnk_0811C100[gPlayerEntity.animationState & 6]; - if ((gPlayerEntity.animationState & 2) != 0) { - tilePos1 = COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], -(gPlayerEntity.hitbox)->unk2[1]); - tilePos2 = COORD_TO_TILE_OFFSET(&gPlayerEntity, -ptr[0], +(gPlayerEntity.hitbox)->unk2[1]); + ptr = &gUnk_0811C100[gPlayerEntity.base.animationState & 6]; + if ((gPlayerEntity.base.animationState & 2) != 0) { + tilePos1 = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], -(gPlayerEntity.base.hitbox)->unk2[1]); + tilePos2 = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -ptr[0], +(gPlayerEntity.base.hitbox)->unk2[1]); } else { - tilePos1 = COORD_TO_TILE_OFFSET(&gPlayerEntity, -(gPlayerEntity.hitbox)->unk2[2], -ptr[1]); - tilePos2 = COORD_TO_TILE_OFFSET(&gPlayerEntity, (gPlayerEntity.hitbox)->unk2[2], -ptr[1]); + tilePos1 = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -(gPlayerEntity.base.hitbox)->unk2[2], -ptr[1]); + tilePos2 = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, (gPlayerEntity.base.hitbox)->unk2[2], -ptr[1]); } - uVar3 = sub_080B1AE0(tilePos1, gPlayerEntity.collisionLayer); - uVar3 = sub_08007DD6(uVar3, gUnk_0811C1E8[gPlayerEntity.animationState >> 1]); + uVar3 = sub_080B1AE0(tilePos1, gPlayerEntity.base.collisionLayer); + uVar3 = sub_08007DD6(uVar3, gUnk_0811C1E8[gPlayerEntity.base.animationState >> 1]); if (uVar3 != 0) { - uVar3 = sub_080B1AE0(tilePos2, gPlayerEntity.collisionLayer); - uVar3 = sub_08007DD6(uVar3, gUnk_0811C1E8[gPlayerEntity.animationState >> 1]); + uVar3 = sub_080B1AE0(tilePos2, gPlayerEntity.base.collisionLayer); + uVar3 = sub_08007DD6(uVar3, gUnk_0811C1E8[gPlayerEntity.base.animationState >> 1]); if (uVar3 != 0) { gPlayerState.pushedObject |= 0x80; - if (gPlayerState.dash_state == 0 && (++gPlayerEntity.subtimer <= 5)) { + if (gPlayerState.dash_state == 0 && (++gPlayerEntity.base.subtimer <= 5)) { return FALSE; } - gPlayerEntity.animationState = uVar3 - 1; - gPlayerEntity.action = 4; - gPlayerEntity.subAction = 0; - COLLISION_OFF(&gPlayerEntity); + gPlayerEntity.base.animationState = uVar3 - 1; + gPlayerEntity.base.action = 4; + gPlayerEntity.base.subAction = 0; + COLLISION_OFF(&gPlayerEntity.base); gPlayerState.jump_status = 0x81; - DoPlayerAction(&gPlayerEntity); + DoPlayerAction(&gPlayerEntity.base); return TRUE; } } @@ -2060,16 +2062,16 @@ void sub_08079744(Entity* this) { bool32 sub_08079778(void) { u32 tmp; if (!gPlayerState.swim_state) { - tmp = gUnk_0811C108[gPlayerEntity.animationState >> 1]; + tmp = gUnk_0811C108[gPlayerEntity.base.animationState >> 1]; } else { - tmp = gUnk_0811C108[gPlayerEntity.direction >> 2]; + tmp = gUnk_0811C108[gPlayerEntity.base.direction >> 2]; } - return tmp == (gPlayerEntity.collisions & tmp); + return tmp == (gPlayerEntity.base.collisions & tmp); } u32 sub_080797C4(void) { - u32 tmp = gUnk_0811C110[gPlayerEntity.direction >> 3]; - return tmp == (gPlayerEntity.collisions & tmp); + u32 tmp = gUnk_0811C110[gPlayerEntity.base.direction >> 3]; + return tmp == (gPlayerEntity.base.collisions & tmp); } void sub_080797EC(void) { @@ -2096,7 +2098,7 @@ void sub_080797EC(void) { } else { animation = ANIM_SWORD_CHARGE_WALK; if (sub_080793E4(0)) { - if (sub_080B1B44(GetPlayerTilePos(), gPlayerEntity.collisionLayer) != 0xff) { + if (sub_080B1B44(GetPlayerTilePos(), gPlayerEntity.base.collisionLayer) != 0xff) { gPlayerState.sword_state &= ~8; animation = ANIM_SWORD_CHARGE_BUMP; } @@ -2130,7 +2132,7 @@ void sub_080797EC(void) { } else if (gPlayerState.sword_state) { animation = ANIM_SWORD_CHARGE_WALK; if (sub_080793E4(0)) { - if (sub_080B1B44(GetPlayerTilePos(), (u32)gPlayerEntity.collisionLayer) != 0xff) { + if (sub_080B1B44(GetPlayerTilePos(), (u32)gPlayerEntity.base.collisionLayer) != 0xff) { gPlayerState.sword_state &= ~8; animation = ANIM_SWORD_CHARGE_BUMP; } @@ -2152,7 +2154,7 @@ void sub_080797EC(void) { gPlayerState.animation = animation; if (!gPlayerState.shield_status) { - UpdateAnimationSingleFrame(&gPlayerEntity); + UpdateAnimationSingleFrame(&gPlayerEntity.base); } } @@ -2263,28 +2265,28 @@ void ResolvePlayerAnimation(void) { return; } if ((u8)anim == gPlayerState.prevAnim) { - UpdateAnimationSingleFrame(&gPlayerEntity); + UpdateAnimationSingleFrame(&gPlayerEntity.base); } } gPlayerState.prevAnim = anim; } bool32 sub_08079B24(void) { - if ((gPlayerEntity.action != PLAYER_MINISHDIE) && (gPlayerEntity.health == 0)) { + if ((gPlayerEntity.base.action != PLAYER_MINISHDIE) && (gPlayerEntity.base.health == 0)) { gPlayerState.flags &= ~PL_PARACHUTE; - gPlayerEntity.knockbackDuration = gPlayerEntity.health; + gPlayerEntity.base.knockbackDuration = gPlayerEntity.base.health; if (gPlayerState.field_0x7 == 0) { if (gPlayerState.swim_state != 0) { RespawnPlayer(); } else { if ((gPlayerState.field_0x14 == 0) && ((gPlayerState.flags & PL_IN_MINECART) == 0)) { - if (gPlayerEntity.z.HALF.HI < 0) { - if (gPlayerEntity.zVelocity > 0) { - gPlayerEntity.zVelocity = 0; + if (gPlayerEntity.base.z.HALF.HI < 0) { + if (gPlayerEntity.base.zVelocity > 0) { + gPlayerEntity.base.zVelocity = 0; } if ((gPlayerState.jump_status & 0x41) == 0) { gPlayerState.jump_status = 0x41; - gPlayerEntity.direction = DIR_NONE; + gPlayerEntity.base.direction = DIR_NONE; gPlayerState.direction = DIR_NONE; return TRUE; } else { @@ -2297,7 +2299,7 @@ bool32 sub_08079B24(void) { } } } - gPlayerEntity.flags &= ~ENT_COLLIDE; + gPlayerEntity.base.flags &= ~ENT_COLLIDE; return FALSE; } } @@ -2305,13 +2307,13 @@ bool32 sub_08079B24(void) { } void sub_08079BD8(Entity* this) { - this->x = gPlayerEntity.x; - this->y = gPlayerEntity.y; - this->z = gPlayerEntity.z; - this->collisionLayer = gPlayerEntity.collisionLayer; - this->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3; - this->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY; - this->spritePriority.b0 = gPlayerEntity.spritePriority.b0; + this->x = gPlayerEntity.base.x; + this->y = gPlayerEntity.base.y; + this->z = gPlayerEntity.base.z; + this->collisionLayer = gPlayerEntity.base.collisionLayer; + this->spriteRendering.b3 = gPlayerEntity.base.spriteRendering.b3; + this->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY; + this->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0; } bool32 sub_08079C30(Entity* param_1) { @@ -2344,11 +2346,11 @@ bool32 sub_08079C30(Entity* param_1) { } bool32 sub_08079D48(void) { - if (!sub_08079C30(&gPlayerEntity)) { + if (!sub_08079C30(&gPlayerEntity.base)) { return TRUE; } else { if (!PlayerCheckNEastTile()) { - if (!sub_08007DD6((u16)GetTileUnderEntity(&gPlayerEntity), gUnk_0811C268)) { + if (!sub_08007DD6((u16)GetTileUnderEntity(&gPlayerEntity.base), gUnk_0811C268)) { return TRUE; } } @@ -2357,19 +2359,19 @@ bool32 sub_08079D48(void) { } void sub_08079D84(void) { - if ((gPlayerEntity.action == PLAYER_NORMAL) || (gPlayerEntity.action == PLAYER_ROLL)) { + if ((gPlayerEntity.base.action == PLAYER_NORMAL) || (gPlayerEntity.base.action == PLAYER_ROLL)) { gPlayerState.field_0x38 = 0x9c; gPlayerState.field_0x39 = 2; gPlayerState.field_0x3a = 0x3c; gPlayerState.queued_action = PLAYER_0807204C; - gPlayerEntity.iframes = 0x7c; + gPlayerEntity.base.iframes = 0x7c; PutAwayItems(); SoundReq(SFX_193); } } void sub_08079DCC(void) { - if (gPlayerEntity.action == PLAYER_NORMAL) { + if (gPlayerEntity.base.action == PLAYER_NORMAL) { gPlayerState.field_0x38 = 0xa0; gPlayerState.field_0x39 = 3; gPlayerState.field_0x3a = 0; @@ -2379,23 +2381,23 @@ void sub_08079DCC(void) { } void UpdatePlayerMovement(void) { - if ((gPlayerEntity.speed != 0) && - (gPlayerEntity.speed += gPlayerState.speed_modifier, gPlayerEntity.speed < 0x20)) { - gPlayerEntity.speed = 0x20; + if ((gPlayerEntity.base.speed != 0) && + (gPlayerEntity.base.speed += gPlayerState.speed_modifier, gPlayerEntity.base.speed < 0x20)) { + gPlayerEntity.base.speed = 0x20; } - if ((gPlayerEntity.direction & 4) == 0) { - sub_08079E90(gPlayerEntity.direction); + if ((gPlayerEntity.base.direction & 4) == 0) { + sub_08079E90(gPlayerEntity.base.direction); } - sub_0800857C(&gPlayerEntity); - sub_0807A5B8(gPlayerEntity.direction); + sub_0800857C(&gPlayerEntity.base); + sub_0807A5B8(gPlayerEntity.base.direction); } void sub_08079E58(s32 speed, u32 direction) { - if ((gPlayerEntity.direction & 4) == 0) { + if ((gPlayerEntity.base.direction & 4) == 0) { sub_08079E90(direction); } - sub_080085B0(&gPlayerEntity); - sub_080027EA(&gPlayerEntity, (s16)speed, (u8)direction); + sub_080085B0(&gPlayerEntity.base); + sub_080027EA(&gPlayerEntity.base, (s16)speed, (u8)direction); sub_0807A5B8(direction); } @@ -2403,28 +2405,28 @@ bool32 sub_08079E90(u32 param_1) { s16 tmp1; s16 tmp2; - if (gPlayerEntity.direction & DirectionEast) { - if (gPlayerEntity.direction & DirectionSouth) { - tmp2 = -gPlayerEntity.hitbox->unk2[0]; + if (gPlayerEntity.base.direction & DirectionEast) { + if (gPlayerEntity.base.direction & DirectionSouth) { + tmp2 = -gPlayerEntity.base.hitbox->unk2[0]; } else { - tmp2 = gPlayerEntity.hitbox->unk2[0]; + tmp2 = gPlayerEntity.base.hitbox->unk2[0]; } - tmp1 = gPlayerEntity.hitbox->unk2[1]; + tmp1 = gPlayerEntity.base.hitbox->unk2[1]; } else { - tmp2 = gPlayerEntity.hitbox->unk2[2]; - if (gPlayerEntity.direction != DirectionNorth) { - tmp1 = gPlayerEntity.hitbox->unk2[3]; + tmp2 = gPlayerEntity.base.hitbox->unk2[2]; + if (gPlayerEntity.base.direction != DirectionNorth) { + tmp1 = gPlayerEntity.base.hitbox->unk2[3]; } else { - tmp1 = -gPlayerEntity.hitbox->unk2[3]; + tmp1 = -gPlayerEntity.base.hitbox->unk2[3]; } } - if (!sub_08079F48(param_1, sub_080B1AF0(&gPlayerEntity, tmp2, tmp1))) { - if ((gPlayerEntity.direction & DirectionSouth) != 0) { + if (!sub_08079F48(param_1, sub_080B1AF0(&gPlayerEntity.base, tmp2, tmp1))) { + if ((gPlayerEntity.base.direction & DirectionSouth) != 0) { tmp1 = -tmp1; } else { tmp2 = -tmp2; } - if (!sub_08079F48(param_1, sub_080B1AF0(&gPlayerEntity, tmp2, tmp1))) { + if (!sub_08079F48(param_1, sub_080B1AF0(&gPlayerEntity.base, tmp2, tmp1))) { return FALSE; } } @@ -2433,12 +2435,12 @@ bool32 sub_08079E90(u32 param_1) { bool32 sub_08079F48(u32 param_1, u32 param_2) { if (gUnk_0811C118[param_1 >> 2] == param_2) { - gPlayerEntity.direction = (gPlayerEntity.direction + 4) & 0x1f; + gPlayerEntity.base.direction = (gPlayerEntity.base.direction + 4) & 0x1f; } else { if (gUnk_0811C118[(param_1 >> 2) + 1] != param_2) { return FALSE; } - gPlayerEntity.direction = (gPlayerEntity.direction - 4) & 0x1f; + gPlayerEntity.base.direction = (gPlayerEntity.base.direction - 4) & 0x1f; } return TRUE; @@ -2448,8 +2450,8 @@ bool32 PlayerCanBeMoved(void) { if ((gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_FROZEN | PL_FALLING | PL_DISABLE_ITEMS | PL_PIT_IS_EXIT | PL_IN_MINECART | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_CONVEYOR_PUSHED | PL_CLIMBING)) != 0 || - gPlayerState.field_0x3c != 0 || gPlayerEntity.action == PLAYER_FALL || - gPlayerEntity.action == PLAYER_08071DB8) { + gPlayerState.field_0x3c != 0 || gPlayerEntity.base.action == PLAYER_FALL || + gPlayerEntity.base.action == PLAYER_08071DB8) { return FALSE; } else { return TRUE; @@ -2457,7 +2459,7 @@ bool32 PlayerCanBeMoved(void) { } u32 sub_08079FC4(u32 param_1) { - return sub_08079FD4(&gPlayerEntity, param_1); + return sub_08079FD4(&gPlayerEntity.base, param_1); } u32 sub_08079FD4(Entity* this, u32 param_2) { @@ -2499,7 +2501,7 @@ void UpdatePlayerPalette(void) { palette = GetPlayerPalette(FALSE); if (palette != gPlayerState.playerPalette) { gPlayerState.playerPalette = palette; - ChangeObjPalette(&gPlayerEntity, palette); + ChangeObjPalette(&gPlayerEntity.base, palette); } } @@ -2541,7 +2543,7 @@ void DeleteClones(void) { gPlayerClones[1] = NULL; gPlayerClones[2] = NULL; gPlayerState.flags &= ~PL_CLONING; - if (((gPlayerEntity.action != PLAYER_ROOMTRANSITION) || (gPlayerState.chargeState.action != 4)) && + if (((gPlayerEntity.base.action != PLAYER_ROOMTRANSITION) || (gPlayerState.chargeState.action != 4)) && (gPlayerState.chargeState.action == 4 || gPlayerState.chargeState.action == 5)) { gPlayerState.chargeState.action = 1; } @@ -2563,13 +2565,13 @@ u32 sub_0807A180(Entity* param_1, Entity* param_2, u32 param_3, u32 param_4) { } void UpdateFloorType(void) { - gPlayerState.floor_type = GetSurfaceCalcType(&gPlayerEntity, 0, 0); - gUnk_0811C120[gPlayerState.floor_type](&gPlayerEntity); + gPlayerState.floor_type = GetSurfaceCalcType(&gPlayerEntity.base, 0, 0); + gUnk_0811C120[gPlayerState.floor_type](&gPlayerEntity.base); } SurfaceType GetSurfaceCalcType(Entity* param_1, s32 x, s32 y) { u32 position = TILE(param_1->x.HALF.HI + (u32)x, param_1->y.HALF.HI + y); - u32 tileType = GetTileTypeByPos(param_1->x.HALF.HI + x, param_1->y.HALF.HI + y, gPlayerEntity.collisionLayer); + u32 tileType = GetTileTypeByPos(param_1->x.HALF.HI + x, param_1->y.HALF.HI + y, gPlayerEntity.base.collisionLayer); if (tileType != gPlayerState.tileType) { gPlayerState.surfaceTimer = 0; } @@ -2600,8 +2602,8 @@ bool32 sub_0807A2B8(void) { if (PlayerCheckNEastTile()) { return TRUE; } else { - if (((gPlayerState.jump_status & 200) == 0) && (gPlayerEntity.collisionLayer != 1)) { - CreateObjectWithParent(&gPlayerEntity, ROTATING_TRAPDOOR, 0, 0); + if (((gPlayerState.jump_status & 200) == 0) && (gPlayerEntity.base.collisionLayer != 1)) { + CreateObjectWithParent(&gPlayerEntity.base, ROTATING_TRAPDOOR, 0, 0); } return FALSE; } @@ -2617,32 +2619,32 @@ u32 sub_0807A2F8(u32 param_1) { if ((gRoomControls.area == 8) || (sub_08079778() | param_1) == 0) return 0; - if ((gPlayerEntity.animationState & 2) != 0) { + if ((gPlayerEntity.base.animationState & 2) != 0) { - uVar2 = COORD_TO_TILE_OFFSET(&gPlayerEntity, 0, -gPlayerEntity.hitbox->unk2[3]) << 1; - uVar1 = COORD_TO_TILE_OFFSET(&gPlayerEntity, 0, gPlayerEntity.hitbox->unk2[3]) << 1; + uVar2 = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, 0, -gPlayerEntity.base.hitbox->unk2[3]) << 1; + uVar1 = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, 0, gPlayerEntity.base.hitbox->unk2[3]) << 1; } else { - uVar2 = COORD_TO_TILE_OFFSET(&gPlayerEntity, -gPlayerEntity.hitbox->unk2[0], 0) << 1; - uVar1 = COORD_TO_TILE_OFFSET(&gPlayerEntity, gPlayerEntity.hitbox->unk2[0], 0) << 1; + uVar2 = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -gPlayerEntity.base.hitbox->unk2[0], 0) << 1; + uVar1 = COORD_TO_TILE_OFFSET(&gPlayerEntity.base, gPlayerEntity.base.hitbox->unk2[0], 0) << 1; } for (uVar5 = 0; uVar5 < 2; uVar5++) { iVar4 = 0; - uVar2 = sub_08004202(&gPlayerEntity, auStack36, uVar2); + uVar2 = sub_08004202(&gPlayerEntity.base, auStack36, uVar2); if (sub_080B1B44(uVar2 >> 1, 1)) { - if (!sub_08007DD6((u16)sub_080B1AE0((u16)(uVar2 >> 1), gPlayerEntity.collisionLayer), - gUnk_0811C1D8[gPlayerEntity.animationState >> 1])) { + if (!sub_08007DD6((u16)sub_080B1AE0((u16)(uVar2 >> 1), gPlayerEntity.base.collisionLayer), + gUnk_0811C1D8[gPlayerEntity.base.animationState >> 1])) { break; } } else { iVar4 = 1; } - uVar1 = sub_08004202(&gPlayerEntity, auStack36, uVar1); + uVar1 = sub_08004202(&gPlayerEntity.base, auStack36, uVar1); if (sub_080B1B44(uVar1 >> 1, 1)) { - if (!sub_08007DD6((u16)sub_080B1AE0((uVar1 >> 1), gPlayerEntity.collisionLayer), - gUnk_0811C1D8[gPlayerEntity.animationState >> 1])) { + if (!sub_08007DD6((u16)sub_080B1AE0((uVar1 >> 1), gPlayerEntity.base.collisionLayer), + gUnk_0811C1D8[gPlayerEntity.base.animationState >> 1])) { break; } } else { @@ -2658,9 +2660,9 @@ u32 sub_0807A2F8(u32 param_1) { } if (uVar5 != 0) { if (AreaIsDungeon()) { - uVar2 = sub_08004202(&gPlayerEntity, auStack36, uVar2); + uVar2 = sub_08004202(&gPlayerEntity.base, auStack36, uVar2); if (!sub_080B1B44(uVar2 >> 1, 2)) { - uVar1 = sub_08004202(&gPlayerEntity, auStack36, uVar1); + uVar1 = sub_08004202(&gPlayerEntity.base, auStack36, uVar1); if (sub_080B1B44(uVar1 >> 1, 2)) { return 0; } @@ -2669,11 +2671,11 @@ u32 sub_0807A2F8(u32 param_1) { } } else { if (uVar5 == 2) { - uVar2 = sub_08004202(&gPlayerEntity, auStack36, uVar2); + uVar2 = sub_08004202(&gPlayerEntity.base, auStack36, uVar2); } if (sub_080B1B44(uVar2 >> 1, 1) == 0) { if (uVar5 == 2) { - uVar1 = sub_08004202(&gPlayerEntity, auStack36, uVar1); + uVar1 = sub_08004202(&gPlayerEntity.base, auStack36, uVar1); } if (sub_080B1B44(uVar1 >> 1, 1)) { return 0; @@ -2689,18 +2691,21 @@ u32 sub_0807A2F8(u32 param_1) { } u32 GetPlayerTilePos(void) { - switch (gPlayerEntity.animationState >> 1) { + switch (gPlayerEntity.base.animationState >> 1) { case 0: - return TILE(gPlayerEntity.x.HALF.HI, - gPlayerEntity.y.HALF.HI - gPlayerEntity.hitbox->unk2[3] + gPlayerEntity.hitbox->offset_y); + return TILE(gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI - + gPlayerEntity.base.hitbox->unk2[3] + + gPlayerEntity.base.hitbox->offset_y); case 2: - return TILE(gPlayerEntity.x.HALF.HI, - gPlayerEntity.y.HALF.HI + gPlayerEntity.hitbox->unk2[3] + gPlayerEntity.hitbox->offset_y); + return TILE(gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI + + gPlayerEntity.base.hitbox->unk2[3] + + gPlayerEntity.base.hitbox->offset_y); case 1: - return COORD_TO_TILE_OFFSET(&gPlayerEntity, -gPlayerEntity.hitbox->unk2[0], - -gPlayerEntity.hitbox->offset_y); + return COORD_TO_TILE_OFFSET(&gPlayerEntity.base, -gPlayerEntity.base.hitbox->unk2[0], + -gPlayerEntity.base.hitbox->offset_y); case 3: - return COORD_TO_TILE_OFFSET(&gPlayerEntity, gPlayerEntity.hitbox->unk2[0], -gPlayerEntity.hitbox->offset_y); + return COORD_TO_TILE_OFFSET(&gPlayerEntity.base, gPlayerEntity.base.hitbox->unk2[0], + -gPlayerEntity.base.hitbox->offset_y); default: return 0; } @@ -2726,26 +2731,30 @@ void sub_0807A5B8(u32 direction) { } if (direction != DirectionNorth && direction != DirectionSouth) { - uVar3 = (gPlayerEntity.x.HALF.HI + (gPlayerEntity.hitbox)->unk2[0] + (gPlayerEntity.hitbox)->offset_x) - + uVar3 = (gPlayerEntity.base.x.HALF.HI + (gPlayerEntity.base.hitbox)->unk2[0] + + (gPlayerEntity.base.hitbox)->offset_x) - gRoomControls.origin_x; - uVar2 = (gPlayerEntity.y.HALF.HI + (gPlayerEntity.hitbox)->offset_y) - gRoomControls.origin_y; + uVar2 = (gPlayerEntity.base.y.HALF.HI + (gPlayerEntity.base.hitbox)->offset_y) - gRoomControls.origin_y; if (sub_080086B4(uVar3, uVar2, pbVar4) != 0) { sub_0807A750(uVar3, uVar2, pbVar4, 1); } - uVar3 = ((gPlayerEntity.x.HALF.HI - (gPlayerEntity.hitbox)->unk2[0]) + (gPlayerEntity.hitbox)->offset_x) - + uVar3 = ((gPlayerEntity.base.x.HALF.HI - (gPlayerEntity.base.hitbox)->unk2[0]) + + (gPlayerEntity.base.hitbox)->offset_x) - gRoomControls.origin_x; if (sub_080086B4(uVar3, uVar2, pbVar4) != 0) { sub_0807A750(uVar3, uVar2, pbVar4, 3); } } if (direction != DirectionEast && direction != DirectionWest) { - uVar3 = (gPlayerEntity.x.HALF.HI + (gPlayerEntity.hitbox)->offset_x) - gRoomControls.origin_x; - uVar2 = (gPlayerEntity.y.HALF.HI + (gPlayerEntity.hitbox)->unk2[3] + (gPlayerEntity.hitbox)->offset_y) - + uVar3 = (gPlayerEntity.base.x.HALF.HI + (gPlayerEntity.base.hitbox)->offset_x) - gRoomControls.origin_x; + uVar2 = (gPlayerEntity.base.y.HALF.HI + (gPlayerEntity.base.hitbox)->unk2[3] + + (gPlayerEntity.base.hitbox)->offset_y) - gRoomControls.origin_y; if (sub_080086B4(uVar3, uVar2, pbVar4) != 0) { sub_0807A750(uVar3, uVar2, pbVar4, 2); } - uVar2 = ((gPlayerEntity.y.HALF.HI - (gPlayerEntity.hitbox)->unk2[3]) + (gPlayerEntity.hitbox)->offset_y) - + uVar2 = ((gPlayerEntity.base.y.HALF.HI - (gPlayerEntity.base.hitbox)->unk2[3]) + + (gPlayerEntity.base.hitbox)->offset_y) - gRoomControls.origin_y; if (sub_080086B4(uVar3, uVar2, pbVar4) != 0) { sub_0807A750(uVar3, uVar2, pbVar4, 0); @@ -2766,7 +2775,7 @@ void sub_0807A750(u32 param_1, u32 param_2, const u8* param_3, u32 param_4) { index = param_1 % 16; } if ((index != 0) && (index != 0xf)) { - uVar2 = sub_080B1B44((param_1 >> 4 & 0x3f) | (param_2 >> 4 & 0x3f) << 6, gPlayerEntity.collisionLayer); + uVar2 = sub_080B1B44((param_1 >> 4 & 0x3f) | (param_2 >> 4 & 0x3f) << 6, gPlayerEntity.base.collisionLayer); if (uVar2 > 0xf) { if (uVar2 != 0xff) { uVar2 = param_3[uVar2 - 0x10]; @@ -2794,7 +2803,7 @@ void sub_0807A750(u32 param_1, u32 param_2, const u8* param_3, u32 param_4) { } index++; } - gPlayerEntity.y.HALF.HI += index - (param_2 % 16); + gPlayerEntity.base.y.HALF.HI += index - (param_2 % 16); } else { uVar5 = ptr[param_2 % 16]; if (param_4 == 1) { @@ -2818,7 +2827,7 @@ void sub_0807A750(u32 param_1, u32 param_2, const u8* param_3, u32 param_4) { } index--; } - gPlayerEntity.x.HALF.HI += (index - (param_1 % 16)); + gPlayerEntity.base.x.HALF.HI += (index - (param_1 % 16)); } } } @@ -2858,20 +2867,20 @@ void sub_0807A8D8(Entity* this) { u32 tmp; if ((gPlayerState.flags & PL_MINISH) == 0) { - tmp = sub_080B1B84(COORD_TO_TILE_OFFSET(this, 0, 1), gPlayerEntity.collisionLayer); + tmp = sub_080B1B84(COORD_TO_TILE_OFFSET(this, 0, 1), gPlayerEntity.base.collisionLayer); if ((tmp & 0x20) != 0) { sub_0807AAF8(this, COORD_TO_TILE_OFFSET(this, 0, 1)); } - tmp = sub_080B1B84(COORD_TO_TILE_OFFSET(this, -2, 0), gPlayerEntity.collisionLayer); + tmp = sub_080B1B84(COORD_TO_TILE_OFFSET(this, -2, 0), gPlayerEntity.base.collisionLayer); if ((tmp & 0x20) != 0) { sub_0807AAF8(this, COORD_TO_TILE_OFFSET(this, -2, 0)); } - tmp = sub_080B1B84(COORD_TO_TILE_OFFSET(this, 2, 0), gPlayerEntity.collisionLayer); + tmp = sub_080B1B84(COORD_TO_TILE_OFFSET(this, 2, 0), gPlayerEntity.base.collisionLayer); if ((tmp & 0x20) != 0) { sub_0807AAF8(this, COORD_TO_TILE_OFFSET(this, 2, 0)); } } - tmp = sub_080B1B84(COORD_TO_TILE(this), gPlayerEntity.collisionLayer); + tmp = sub_080B1B84(COORD_TO_TILE(this), gPlayerEntity.base.collisionLayer); if ((tmp & 0x20) != 0) { sub_0807AAF8(this, COORD_TO_TILE(this)); } @@ -3095,7 +3104,7 @@ void UpdatePlayerSkills(void) { void PlayerShrinkByRay(void) { Entity* effect; PutAwayItems(); - effect = CreateFx(&gPlayerEntity, FX_BIG_EXPLOSION2, 0); + effect = CreateFx(&gPlayerEntity.base, FX_BIG_EXPLOSION2, 0); if (effect != NULL) { effect->y.HALF.HI++; } @@ -3138,10 +3147,10 @@ void sub_0807B068(Entity* entity) { } void sub_0807B0C8(void) { - sub_0806FEBC(&gPlayerEntity, 0, 0); - sub_0806FEBC(&gPlayerEntity, 1, 0); - sub_0806FEBC(&gPlayerEntity, 2, &gPlayerEntity); - sub_0806FEBC(&gPlayerEntity, 3, 0); + sub_0806FEBC(&gPlayerEntity.base, 0, 0); + sub_0806FEBC(&gPlayerEntity.base, 1, 0); + sub_0806FEBC(&gPlayerEntity.base, 2, &gPlayerEntity.base); + sub_0806FEBC(&gPlayerEntity.base, 3, 0); } void PlayerWarp(PlayerEntity* this) { @@ -3209,7 +3218,7 @@ void sub_0807B21C(PlayerEntity* this) { super->timer = 120; super->subtimer = 0; this->unk_6e++; - this->unk_68 = super->z.WORD; + this->unk_68.WORD = super->z.WORD; } } @@ -3220,7 +3229,7 @@ void sub_0807B264(PlayerEntity* this) { tmp = gSineTable[super->subtimer]; tmp >>= 7; tmp <<= 0x10; - super->z.WORD = this->unk_68 + tmp; + super->z.WORD = this->unk_68.WORD + tmp; if (--super->timer == 0) { super->timer = 80; super->zVelocity = Q_16_16(0.5); @@ -3657,7 +3666,7 @@ bool32 sub_0807BD14(Entity* this, u32 scrollDirection) { break; } } - gPlayerEntity.updatePriority = 6; + gPlayerEntity.base.updatePriority = 6; SetInitializationPriority(); return TRUE; } else { @@ -4166,7 +4175,7 @@ void sub_0807C810(void) { RoomControls* ctrls; sub_0807BFD0(); ptr = &gDiggingCaveEntranceTransition; - player = &gPlayerEntity; + player = &gPlayerEntity.base; ctrls = &gRoomControls; player->x.HALF.HI = ((ptr->entrance)->targetTilePosition & 0x3f) * 0x10 + ctrls->origin_x + ptr->offsetX; player->y.HALF.HI = (((ptr->entrance)->targetTilePosition & 0xfc0) >> 2) + ctrls->origin_y + ptr->offsetY; diff --git a/src/projectile/darkNutSwordSlash.c b/src/projectile/darkNutSwordSlash.c index ac30135b..e95ab908 100644 --- a/src/projectile/darkNutSwordSlash.c +++ b/src/projectile/darkNutSwordSlash.c @@ -30,7 +30,7 @@ void DarkNutSwordSlash(Entity* this) { if ((this->parent == NULL) || (this->parent->health == 0)) { DeleteThisEntity(); } - if (((this->contactFlags & 0x80) != 0) && (this->contactedEntity == &gPlayerEntity)) { + if (((this->contactFlags & 0x80) != 0) && (this->contactedEntity == &gPlayerEntity.base)) { this->iframes = -0x2d; } this->contactFlags = 0; diff --git a/src/projectile/dirtBallProjectile.c b/src/projectile/dirtBallProjectile.c index e1cfe8f1..5a56b0d3 100644 --- a/src/projectile/dirtBallProjectile.c +++ b/src/projectile/dirtBallProjectile.c @@ -107,7 +107,7 @@ void DirtBallProjectile_Action1(Entity* this) { break; case 2: this->z.HALF.HI += Q_8_8(1.0 / 16.0 - 1.0 / 128.0); - if (EntityInRectRadius(this, &gPlayerEntity, 0xe, 0xe) != 0) { + if (EntityInRectRadius(this, &gPlayerEntity.base, 0xe, 0xe) != 0) { this->action = 2; ((DirtBallProjectileEntity*)parent)->unk_83 = 0xc0; } diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c index f42d8e17..ed957966 100644 --- a/src/projectile/gleerokProjectile.c +++ b/src/projectile/gleerokProjectile.c @@ -54,7 +54,7 @@ void GleerokProjectile_Init(GleerokProjectileEntity* this) { switch (super->type) { case 0: case 1: - iVar2 = sub_080041DC(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); + iVar2 = sub_080041DC(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI); if (super->type == 1) { uVar1 = Random() & 0x1ff; if ((gRoomTransition.frameCount & 1U) == 0) { @@ -104,7 +104,7 @@ void GleerokProjectile_Action1(GleerokProjectileEntity* this) { LinearMoveUpdate(super); if ((super->type != 2) && (super->subtimer-- == 0)) { super->subtimer = 30; - sub_08004596(super, GetFacingDirection(super, &gPlayerEntity)); + sub_08004596(super, GetFacingDirection(super, &gPlayerEntity.base)); } if (GravityUpdate(super, 0) == 0) { super->action = 2; diff --git a/src/projectile/gyorgMaleEnergyProjectile.c b/src/projectile/gyorgMaleEnergyProjectile.c index e243cec9..b3ee446d 100644 --- a/src/projectile/gyorgMaleEnergyProjectile.c +++ b/src/projectile/gyorgMaleEnergyProjectile.c @@ -70,7 +70,7 @@ void GyorgMaleEnergyProjectile_Action1(Entity* this) { if (--this->timer == 0) { this->action = 2; COLLISION_ON(this); - this->direction = GetFacingDirection(this, &gPlayerEntity); + this->direction = GetFacingDirection(this, &gPlayerEntity.base); SoundReq(SFX_12E); } } diff --git a/src/projectile/keatonDagger.c b/src/projectile/keatonDagger.c index bccb2b96..4f5b95af 100644 --- a/src/projectile/keatonDagger.c +++ b/src/projectile/keatonDagger.c @@ -20,7 +20,7 @@ void KeatonDagger(Entity* this) { } parent = this->parent; if (((parent == NULL) || (parent->health == 0)) || (parent->next == NULL)) { - if (((this->contactFlags & 0x80) != 0) && (this->contactedEntity == &gPlayerEntity)) { + if (((this->contactFlags & 0x80) != 0) && (this->contactedEntity == &gPlayerEntity.base)) { sub_0803C0AC(this); } DeleteEntity(this); diff --git a/src/projectile/lakituCloudProjectile.c b/src/projectile/lakituCloudProjectile.c index fe4faed2..8c0a11f2 100644 --- a/src/projectile/lakituCloudProjectile.c +++ b/src/projectile/lakituCloudProjectile.c @@ -48,7 +48,7 @@ void LakituCloudProjectile_SubAction2(Entity* this) { if (sub_0806F3E4(this) != 0) { if (this->hitType == 0xa6) { ModHealth(-2); - SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); + SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6); sub_08079D84(); } CreateFx(this, FX_DEATH, 0); diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c index e4dcdb93..3786d872 100644 --- a/src/projectile/octorokBossProjectile.c +++ b/src/projectile/octorokBossProjectile.c @@ -77,7 +77,7 @@ void OctorokBossProjectile_Init(OctorokBossProjectileEntity* this) { InitializeAnimation(super, 5); break; case 3: - CopyPosition(&gPlayerEntity, super); + CopyPosition(&gPlayerEntity.base, super); super->z.WORD = Q_16_16(-160.0); super->x.HALF.HI += 0x60; super->y.HALF.HI += 0x40; diff --git a/src/projectile/projectile5.c b/src/projectile/projectile5.c index f1817057..31471e10 100644 --- a/src/projectile/projectile5.c +++ b/src/projectile/projectile5.c @@ -40,7 +40,7 @@ void Projectile5_OnCollision(Entity* this) { pbVar2 = &((Projectile5Entity*)this->parent)->unk_83; if ((((Projectile5Entity*)this->parent)->unk_83 & 0x3f) == 3) { if (gPlayerState.hurtBlinkSpeed != 0) { - if (sub_080B1B44(TILE(this->x.HALF.HI, this->y.HALF.HI), gPlayerEntity.collisionLayer) == 0) { + if (sub_080B1B44(TILE(this->x.HALF.HI, this->y.HALF.HI), gPlayerEntity.base.collisionLayer) == 0) { if (this->contactFlags == 0x80) { *pbVar2 = *pbVar2 & 0x7f; DeleteThisEntity(); diff --git a/src/projectile/spiderWeb.c b/src/projectile/spiderWeb.c index a5075b2c..dca0bc9a 100644 --- a/src/projectile/spiderWeb.c +++ b/src/projectile/spiderWeb.c @@ -95,7 +95,7 @@ void SpiderWeb_OnGrabbed(SpiderWebEntity* this) { u32 animationState; if (super->subAction == 0) { - animationState = (gPlayerEntity.animationState >> 1); + animationState = (gPlayerEntity.base.animationState >> 1); if (animationState != super->type) { super->gustJarState &= ~4; if (AnimationStateFlip90(animationState) != super->type) { @@ -170,7 +170,7 @@ void SpiderWeb_SubAction0(SpiderWebEntity* this) { u16 y; Entity* entity; - entity = &gPlayerEntity; + entity = &gPlayerEntity.base; if (this->unk_84 == 0) { tmp = super->type; @@ -187,7 +187,8 @@ void SpiderWeb_SubAction0(SpiderWebEntity* this) { InitAnimationForceUpdate(super, super->type + 4); } if ((entity->animationState >> 1 == super->type) && (gPlayerState.framestate == PL_STATE_PULL) && - ((gPlayerState.heldObject & 2) != 0) && ((gPlayerEntity.frame & 2) != 0) && ((super->frame & ANIM_DONE) == 0)) { + ((gPlayerState.heldObject & 2) != 0) && ((gPlayerEntity.base.frame & 2) != 0) && + ((super->frame & ANIM_DONE) == 0)) { UpdateAnimationSingleFrame(super); if ((super->frame & 1) != 0) { entity->x.HALF.HI = gUnk_0812A06C[entity->animationState] + entity->x.HALF.HI; @@ -216,8 +217,8 @@ void sub_080AA9E0(Entity* this) { s32 diff; const Struct_0812A074* ptr; - diff = - (this->type & 0x1) ? (gPlayerEntity.x.HALF.HI - this->x.HALF.HI) : (gPlayerEntity.y.HALF.HI - this->y.HALF.HI); + diff = (this->type & 0x1) ? (gPlayerEntity.base.x.HALF.HI - this->x.HALF.HI) + : (gPlayerEntity.base.y.HALF.HI - this->y.HALF.HI); ptr = gUnk_0812A074 + (this->type << 1); switch (this->type) { case 0: diff --git a/src/projectile/v1DarkMagicProjectile.c b/src/projectile/v1DarkMagicProjectile.c index 9a1ad6f7..248612e4 100644 --- a/src/projectile/v1DarkMagicProjectile.c +++ b/src/projectile/v1DarkMagicProjectile.c @@ -49,7 +49,7 @@ void V1DarkMagicProjectile_OnCollision(V1DarkMagicProjectileEntity* this) { super->action = 2; COLLISION_OFF(super); if (super->type == 0) { - SortEntityAbove(&gPlayerEntity, super); + SortEntityAbove(&gPlayerEntity.base, super); } else { SortEntityAbove(super->parent, super); } @@ -57,7 +57,7 @@ void V1DarkMagicProjectile_OnCollision(V1DarkMagicProjectileEntity* this) { gPlayerState.mobility |= 0x80; gPlayerState.field_0xa |= 0x80; } - if (gPlayerEntity.health == 0) { + if (gPlayerEntity.base.health == 0) { super->health = 0; } } else { @@ -144,7 +144,7 @@ void V1DarkMagicProjectile_Init(V1DarkMagicProjectileEntity* this) { super->spriteOrientation.flipY = 1; super->spriteRendering.b3 = 1; super->spritePriority.b0 = 4; - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); this->unk_86 = 0; this->unk_84 = 300; entity = CreateProjectile(V1_DARK_MAGIC_PROJECTILE); @@ -169,7 +169,7 @@ void V1DarkMagicProjectile_Action1(V1DarkMagicProjectileEntity* this) { case 0: if (--super->subtimer == 0) { super->subtimer = 4; - uVar2 = GetFacingDirection(super, &gPlayerEntity); + uVar2 = GetFacingDirection(super, &gPlayerEntity.base); sub_08004596(super, uVar2); } LinearMoveUpdate(super); @@ -219,25 +219,25 @@ void sub_080AAF74(V1DarkMagicProjectileEntity* this) { } if (++super->timer == 0x3c) { super->timer = 30; - gPlayerEntity.iframes = 8; + gPlayerEntity.base.iframes = 8; ModHealth(-4); - SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); - if (gPlayerEntity.health == 0) { + SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6); + if (gPlayerEntity.base.health == 0) { super->health = 0; } } if (!((this->unk_80 < 0x31) && (this->unk_81 != 0x10))) { super->action = 1; this->unk_80 = 0; - gPlayerEntity.iframes = 0xf0; + gPlayerEntity.base.iframes = 0xf0; gPlayerState.mobility = 0; super->health = 0; } else { ResetActiveItems(); gPlayerState.mobility |= 0x80; gPlayerState.field_0xa |= 0x80; - CopyPosition(&gPlayerEntity, super); - super->z.HALF.HI = gPlayerEntity.z.HALF.HI - 4; + CopyPosition(&gPlayerEntity.base, super); + super->z.HALF.HI = gPlayerEntity.base.z.HALF.HI - 4; } } diff --git a/src/projectile/v2Projectile.c b/src/projectile/v2Projectile.c index cd42ab11..cb59c16a 100644 --- a/src/projectile/v2Projectile.c +++ b/src/projectile/v2Projectile.c @@ -91,7 +91,7 @@ void nullsub_542(Entity* this) { void sub_080ABC90(Entity* this) { if (sub_0806F3E4(this) != 0) { ModHealth(-2); - SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6); + SoundReqClipped(&gPlayerEntity.base, SFX_PLY_VO6); sub_08079D84(); CreateFx(this, FX_DEATH, 0); DeleteThisEntity(); diff --git a/src/projectile/v3ElectricProjectile.c b/src/projectile/v3ElectricProjectile.c index fdd1b670..2fe12fb2 100644 --- a/src/projectile/v3ElectricProjectile.c +++ b/src/projectile/v3ElectricProjectile.c @@ -90,7 +90,7 @@ void V3ElectricProjectile_Action1(V3ElectricProjectileEntity* this) { if ((super->frame & 1) != 0) { if (super->type == 0) { super->action = 2; - super->direction = GetFacingDirection(super, &gPlayerEntity); + super->direction = GetFacingDirection(super, &gPlayerEntity.base); super->speed = 0x180; SoundReq(SFX_193); } else { @@ -119,7 +119,7 @@ void V3ElectricProjectile_Action2(V3ElectricProjectileEntity* this) { } if (super->timer < 0x1e) { if (((++super->timer) & super->subtimer) == 0) { - sub_08004596(super, GetFacingDirection(super, &gPlayerEntity)); + sub_08004596(super, GetFacingDirection(super, &gPlayerEntity.base)); } } } @@ -136,7 +136,7 @@ void V3ElectricProjectile_Action3(V3ElectricProjectileEntity* this) { super->timer = 4; rand = Random() & 0x7; super->subtimer = gUnk_0812A982[rand]; - dir = GetFacingDirection(super, &gPlayerEntity); + dir = GetFacingDirection(super, &gPlayerEntity.base); if (((V3ElectricProjectileEntity*)super->parent)->unk_84 == 3) { dir -= projectileDirections[rand]; super->type2 = 0; diff --git a/src/projectile/v3HandProjectile.c b/src/projectile/v3HandProjectile.c index 9f9b984d..ff594836 100644 --- a/src/projectile/v3HandProjectile.c +++ b/src/projectile/v3HandProjectile.c @@ -19,7 +19,7 @@ void V3HandProjectile(Entity* this) { void V3HandProjectile_OnTick(Entity* this) { if (this->action == 0) { this->action = 1; - this->direction = GetFacingDirection(this, &gPlayerEntity); + this->direction = GetFacingDirection(this, &gPlayerEntity.base); InitializeAnimation(this, 0); SoundReq(SFX_199); } diff --git a/src/room.c b/src/room.c index c0c868f4..b999efce 100644 --- a/src/room.c +++ b/src/room.c @@ -1,4 +1,3 @@ -#define ENT_DEPRECATED #include "area.h" #include "common.h" #include "flags.h" @@ -110,7 +109,7 @@ void RegisterRoomEntity(Entity* ent, const EntityData* dat) { AppendEntityToList(ent, list); } } - offset = &ent->field_0x78; + offset = &((GenericEntity*)ent)->field_0x78; if (kind == MANAGER) offset = &ent->y; MemCopy(dat, offset, sizeof(EntityData)); @@ -123,7 +122,7 @@ void sub_0804AF0C(Entity* ent, const EntityData* dat) { ent->y.HALF.HI = dat->yPos + gRoomControls.origin_y; break; case 0x20: - ent->field_0x6c.HALF.HI |= 0x20; + ((GenericEntity*)ent)->field_0x6c.HALF.HI |= 0x20; ent->x.HALF.HI = dat->xPos + gRoomControls.origin_x; ent->y.HALF.HI = dat->yPos + gRoomControls.origin_y; break; @@ -198,7 +197,7 @@ static void sub_0804B058(EntityData* dat) { if (sub_08049D1C(uVar2) != 0) { ent = LoadRoomEntity(dat); if ((ent != NULL) && (ent->kind == ENEMY)) { - ent->field_0x6c.HALF.LO = uVar2 | 0x80; + ((GenericEntity*)ent)->field_0x6c.HALF.LO = uVar2 | 0x80; } } } else { diff --git a/src/roomInit.c b/src/roomInit.c index bbe55eae..58d70bc1 100644 --- a/src/roomInit.c +++ b/src/roomInit.c @@ -238,7 +238,7 @@ void sub_StateChange_MinishPaths_MayorsCabin(void) { sub_080575C8(0x20); - if (gPlayerEntity.y.HALF.HI - gRoomControls.origin_y > 0x40) + if (gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y > 0x40) LoadRoomEntityList(&Entities_MinishPaths_MayorsCabin_gUnk_080D6138); } @@ -409,8 +409,8 @@ void sub_StateChange_HouseInteriors1_InnWestRoom(void) { if (CheckLocalFlag(YADO_CHECKIN)) { ClearLocalFlag(YADO_CHECKIN); SetFade(FADE_IN_OUT | FADE_INSTANT, 256); - gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x50; - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x38; + gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + 0x50; + gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0x38; sub_080751E8(1, 2, &script_PlayerSleepingInn); } } @@ -435,8 +435,8 @@ void sub_StateChange_HouseInteriors1_InnMiddleRoom(void) { if (CheckLocalFlag(YADO_CHECKIN) != 0) { ClearLocalFlag(YADO_CHECKIN); SetFade(FADE_IN_OUT | FADE_INSTANT, 256); - gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x50; - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x38; + gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + 0x50; + gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0x38; sub_080751E8(1, 2, &script_PlayerSleepingInn); } } @@ -461,8 +461,8 @@ void sub_StateChange_HouseInteriors1_InnEastRoom(void) { if (CheckLocalFlag(YADO_CHECKIN)) { ClearLocalFlag(YADO_CHECKIN); SetFade(FADE_IN_OUT | FADE_INSTANT, 256); - gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x60; - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x38; + gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + 0x60; + gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0x38; sub_080751E8(1, 2, &script_PlayerSleepingInn); } } @@ -681,8 +681,8 @@ extern u32 script_PlayerWakingUpInHyruleCastle; void sub_StateChange_HyruleCastle_4(void) { if (!CheckLocalFlag(CASTLE_04_MEZAME)) { SetFade(FADE_IN_OUT | FADE_INSTANT, 256); - gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0xb0; - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x40; + gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + 0xb0; + gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0x40; sub_080751E8(0, 6, &script_PlayerWakingUpInHyruleCastle); #ifdef EU SoundReq(SONG_STOP_ALL); @@ -2125,7 +2125,7 @@ u32 sub_unk3_DeepwoodShrine_Madderpillar(void) { extern EntityData gUnk_080DE4C8; void sub_StateChange_DeepwoodShrine_Madderpillar(void) { - if ((gPlayerEntity.y.HALF.HI - gRoomControls.origin_y) < (gRoomControls.height >> 1)) { + if ((gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y) < (gRoomControls.height >> 1)) { if (!CheckLocalFlag(0x17)) { LoadRoomEntityList(&gUnk_080DE4C8); } @@ -2517,7 +2517,7 @@ void sub_StateChange_CaveOfFlamesBoss_Main(void) { if (CheckGlobalFlag(LV2_CLEAR)) { gMapTop.bgSettings = 0; gScreen.lcd.displayControl &= ~DISPCNT_BG1_ON; - sub_0807AABC(&gPlayerEntity); + sub_0807AABC(&gPlayerEntity.base); LoadRoomEntityList(&gUnk_additional_a_CaveOfFlamesBoss_Main); } else { SoundReq(SONG_STOP_BGM); @@ -3593,14 +3593,14 @@ void sub_StateChange_Vaati3_Main(void) { if ((gRoomTransition.field_0x38 & 1) && gRoomTransition.field_0x39) { if (gRoomTransition.field_0x3c == 1) { - gPlayerEntity.x.HALF.HI = gRoomTransition.field_0x48; - gPlayerEntity.y.HALF.HI = gRoomTransition.field_0x4a + 8; + gPlayerEntity.base.x.HALF.HI = gRoomTransition.field_0x48; + gPlayerEntity.base.y.HALF.HI = gRoomTransition.field_0x4a + 8; } else { if (gRoomTransition.field_0x3c) { return; } - gPlayerEntity.x.HALF.HI = gRoomTransition.field_0x44; - gPlayerEntity.y.HALF.HI = gRoomTransition.field_0x46 + 8; + gPlayerEntity.base.x.HALF.HI = gRoomTransition.field_0x44; + gPlayerEntity.base.y.HALF.HI = gRoomTransition.field_0x46 + 8; } } } @@ -4939,8 +4939,8 @@ void sub_StateChange_HouseInteriors2_LinksHouseBedroom(void) { extern u32 script_PlayerWakeAfterRest; void sub_0804E864(void) { - gPlayerEntity.x.HALF.HI = gRoomControls.origin_x + 0x90; - gPlayerEntity.y.HALF.HI = gRoomControls.origin_y + 0x38; + gPlayerEntity.base.x.HALF.HI = gRoomControls.origin_x + 0x90; + gPlayerEntity.base.y.HALF.HI = gRoomControls.origin_y + 0x38; sub_080751E8(1, 6, &script_PlayerWakeAfterRest); ModHealth(0xa0); } diff --git a/src/script.c b/src/script.c index 2f50621e..6a10ec96 100644 --- a/src/script.c +++ b/src/script.c @@ -1,4 +1,3 @@ -#define ENT_DEPRECATED #include "area.h" #include "functions.h" #include "game.h" @@ -198,15 +197,15 @@ ScriptExecutionContext* StartCutscene(Entity* entity, Script* script) { void InitScriptForEntity(Entity* entity, ScriptExecutionContext* context, Script* script) { entity->flags |= ENT_SCRIPTED; - *(ScriptExecutionContext**)&entity->cutsceneBeh = context; + *(ScriptExecutionContext**)&((GenericEntity*)entity)->cutsceneBeh = context; InitScriptExecutionContext(context, script); } void UnloadCutsceneData(Entity* entity) { if (entity->flags & ENT_SCRIPTED) { entity->flags &= ~ENT_SCRIPTED; - DestroyScriptExecutionContext(*(ScriptExecutionContext**)&entity->cutsceneBeh); - *(ScriptExecutionContext**)&entity->cutsceneBeh = NULL; + DestroyScriptExecutionContext(*(ScriptExecutionContext**)&((GenericEntity*)entity)->cutsceneBeh); + *(ScriptExecutionContext**)&((GenericEntity*)entity)->cutsceneBeh = NULL; } } @@ -215,8 +214,8 @@ void StartPlayerScript(Script* script) { MemClear(&gPlayerScriptExecutionContext, sizeof(gPlayerScriptExecutionContext)); gPlayerScriptExecutionContext.scriptInstructionPointer = script; - player = &gPlayerEntity; - *(ScriptExecutionContext**)&player->cutsceneBeh = &gPlayerScriptExecutionContext; + player = &gPlayerEntity.base; + *(ScriptExecutionContext**)&((GenericEntity*)player)->cutsceneBeh = &gPlayerScriptExecutionContext; gPlayerState.queued_action = PLAYER_SLEEP; gPlayerState.field_0x3a = 0; gPlayerState.field_0x39 = 0; @@ -248,10 +247,10 @@ void HandlePostScriptActions(Entity* entity, ScriptExecutionContext* context) { context->postScriptActions ^= bit; switch (bit) { case 1 << 0x00: - entity->field_0x80.HWORD = 0; + ((GenericEntity*)entity)->field_0x80.HWORD = 0; break; case 1 << 0x01: - entity->field_0x80.HWORD = 4; + ((GenericEntity*)entity)->field_0x80.HWORD = 4; break; case 1 << 0x02: break; @@ -276,37 +275,37 @@ void HandlePostScriptActions(Entity* entity, ScriptExecutionContext* context) { case 1 << 0x09: entity->spriteOffsetY = 0; entity->spriteOffsetX = 0; - entity->field_0x82.HWORD = 0; + ((GenericEntity*)entity)->field_0x82.HWORD = 0; break; case 1 << 0x0a: - entity->field_0x82.HWORD |= 2; + ((GenericEntity*)entity)->field_0x82.HWORD |= 2; break; case 1 << 0x0b: - entity->field_0x82.HWORD &= ~2; + ((GenericEntity*)entity)->field_0x82.HWORD &= ~2; break; case 1 << 0x0c: - entity->field_0x82.HWORD &= ~1; + ((GenericEntity*)entity)->field_0x82.HWORD &= ~1; break; case 1 << 0x0d: - entity->field_0x82.HWORD |= 1; + ((GenericEntity*)entity)->field_0x82.HWORD |= 1; break; case 1 << 0x0e: - entity->field_0x82.HWORD |= 8; + ((GenericEntity*)entity)->field_0x82.HWORD |= 8; break; case 1 << 0x0f: - entity->field_0x82.HWORD ^= 4; + ((GenericEntity*)entity)->field_0x82.HWORD ^= 4; break; case 1 << 0x10: - entity->field_0x82.HWORD ^= 0x10; + ((GenericEntity*)entity)->field_0x82.HWORD ^= 0x10; break; case 1 << 0x11: entity->spriteSettings.flipX ^= 1; break; case 1 << 0x12: - entity->field_0x82.HWORD |= 0x20; + ((GenericEntity*)entity)->field_0x82.HWORD |= 0x20; break; case 1 << 0x13: - entity->field_0x82.HWORD &= ~0x20; + ((GenericEntity*)entity)->field_0x82.HWORD &= ~0x20; break; default: break; @@ -323,12 +322,12 @@ void InitScriptForNPC(Entity* entity) { void sub_0807DD64(Entity* entity) { entity->subtimer = entity->animationState; entity->animIndex = 0xff; - entity->field_0x80.HWORD = 0; - entity->field_0x82.HWORD = 0; + ((GenericEntity*)entity)->field_0x80.HWORD = 0; + ((GenericEntity*)entity)->field_0x82.HWORD = 0; } void sub_0807DD80(Entity* entity, Script* script) { - InitScriptExecutionContext(*(ScriptExecutionContext**)&entity->cutsceneBeh, script); + InitScriptExecutionContext(*(ScriptExecutionContext**)&((GenericEntity*)entity)->cutsceneBeh, script); sub_0807DD64(entity); } @@ -341,7 +340,7 @@ void ExecuteScriptAndHandleAnimation(Entity* entity, void (*postScriptCallback)( void ExecuteScriptForEntity(Entity* entity, void (*postScriptCallback)(Entity*, ScriptExecutionContext*)) { ScriptExecutionContext** piVar1; - piVar1 = (ScriptExecutionContext**)&entity->cutsceneBeh; + piVar1 = (ScriptExecutionContext**)&((GenericEntity*)entity)->cutsceneBeh; if (*piVar1) { ExecuteScript(entity, *piVar1); if (postScriptCallback) { @@ -360,7 +359,7 @@ void HandleEntity0x82Actions(Entity* entity) { u32 bit; u32 loopVar; - loopVar = entity->field_0x82.HWORD; + loopVar = ((GenericEntity*)entity)->field_0x82.HWORD; while (loopVar) { bit = (~loopVar + 1) & loopVar; loopVar = loopVar ^ bit; @@ -399,9 +398,9 @@ void sub_0807DE80(Entity* entity) { u32 temp; - local2 = entity->field_0x80.HWORD; + local2 = ((GenericEntity*)entity)->field_0x80.HWORD; if (local2 < 8) { - if (entity->field_0x82.HWORD & 1) { + if (((GenericEntity*)entity)->field_0x82.HWORD & 1) { u32 t1, t2; t1 = local2 & 0xfc; t2 = entity->subtimer >> 1; @@ -417,7 +416,7 @@ void sub_0807DE80(Entity* entity) { if (local2 != entity->animIndex) { InitAnimationForceUpdate(entity, local2); } - temp = entity->field_0x82.HWORD & 4; + temp = ((GenericEntity*)entity)->field_0x82.HWORD & 4; local1 = 1; if (temp) { local1 = 2; @@ -803,14 +802,14 @@ void ScriptCommand_CheckEntityInteractType(Entity* entity, ScriptExecutionContex void ScriptCommand_FacePlayerAndCheckDist(Entity* entity, ScriptExecutionContext* context) { if ((context->unk_1A & 0xF) == 0 && (gPlayerState.flags & PL_MINISH) == 0 && - EntityInRectRadius(entity, &gPlayerEntity, 40, 40)) { - entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity)); + EntityInRectRadius(entity, &gPlayerEntity.base, 40, 40)) { + entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity.base)); } context->unk_1A++; if (entity->interactType) { entity->interactType = INTERACTION_NONE; context->condition = 1; - entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity)); + entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity.base)); } else { context->condition = 0; } @@ -901,12 +900,12 @@ void ScriptCommand_EntityHasHeight(Entity* entity, ScriptExecutionContext* conte } void ScriptCommand_ComparePlayerAction(Entity* entity, ScriptExecutionContext* context) { - context->condition = context->scriptInstructionPointer[1] == gPlayerEntity.action; + context->condition = context->scriptInstructionPointer[1] == gPlayerEntity.base.action; gActiveScriptInfo.flags |= 1; } void ScriptCommand_ComparePlayerAnimationState(Entity* entity, ScriptExecutionContext* context) { - context->condition = context->scriptInstructionPointer[1] == gPlayerEntity.animationState; + context->condition = context->scriptInstructionPointer[1] == gPlayerEntity.base.animationState; gActiveScriptInfo.flags |= 1; } @@ -968,7 +967,7 @@ void ScriptCommand_WaitForSyncFlagAndClear(Entity* entity, ScriptExecutionContex } void ScriptCommand_WaitPlayerGetItem(Entity* entity, ScriptExecutionContext* context) { - if (gPlayerEntity.action == PLAYER_ITEMGET) { + if (gPlayerEntity.base.action == PLAYER_ITEMGET) { gActiveScriptInfo.commandSize = 0; } else { context->wait = 45; @@ -976,7 +975,7 @@ void ScriptCommand_WaitPlayerGetItem(Entity* entity, ScriptExecutionContext* con } void ScriptCommand_WaitForPlayerEnterRoom(Entity* entity, ScriptExecutionContext* context) { - if (gPlayerEntity.action != PLAYER_ROOMTRANSITION) { + if (gPlayerEntity.base.action != PLAYER_ROOMTRANSITION) { gActiveScriptInfo.flags |= 1; } else { gActiveScriptInfo.commandSize = 0; @@ -1085,7 +1084,7 @@ void ScriptCommand_SetPlayerAnimation(Entity* entity, ScriptExecutionContext* co void ScriptCommand_0807E8E4(Entity* entity, ScriptExecutionContext* context) { u32 tmp = (gUnk_08016984 & 0x3FF); u32 tmp2; - gPlayerEntity.animationState = tmp2 = (context->scriptInstructionPointer[0] - tmp) << 1; + gPlayerEntity.base.animationState = tmp2 = (context->scriptInstructionPointer[0] - tmp) << 1; } void ScriptCommand_SetAction(Entity* entity, ScriptExecutionContext* context) { @@ -1103,7 +1102,7 @@ void ScriptCommand_SetVariableToFrame(Entity* entity, ScriptExecutionContext* co } void ScriptCommand_SetAnimation(Entity* entity, ScriptExecutionContext* context) { - entity->field_0x80.HWORD = context->scriptInstructionPointer[1]; + ((GenericEntity*)entity)->field_0x80.HWORD = context->scriptInstructionPointer[1]; InitAnimationForceUpdate(entity, context->scriptInstructionPointer[1]); } @@ -1243,11 +1242,12 @@ void ScriptCommand_0807EB4C(Entity* entity, ScriptExecutionContext* context) { } void ScriptCommand_FacePlayer(Entity* entity, ScriptExecutionContext* context) { - entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity)); + entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity.base)); } void ScriptCommand_FaceAwayFromPlayer(Entity* entity, ScriptExecutionContext* context) { - gPlayerEntity.animationState = GetAnimationStateForDirection8(GetFacingDirection(&gPlayerEntity, entity)) & ~1; + gPlayerEntity.base.animationState = + GetAnimationStateForDirection8(GetFacingDirection(&gPlayerEntity.base, entity)) & ~1; } void ScriptCommand_SetEntityDirection(Entity* entity, ScriptExecutionContext* context) { @@ -1278,7 +1278,7 @@ void ScriptCommand_OffsetEntityPosition(Entity* entity, ScriptExecutionContext* } void ScriptCommand_MoveEntityToPlayer(Entity* entity, ScriptExecutionContext* context) { - CopyPosition(&gPlayerEntity, entity); + CopyPosition(&gPlayerEntity.base, entity); } void ScriptCommandNop3(Entity* entity, ScriptExecutionContext* context) { @@ -1413,7 +1413,7 @@ void ScriptCommand_0807EE30(Entity* entity, ScriptExecutionContext* context) { void ScriptCommand_0807EEB4(Entity* entity, ScriptExecutionContext* context) { if (!context->unk_18) { context->unk_18 = 1; - sub_0807DEDC(entity, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); + sub_0807DEDC(entity, context, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI); } ScriptCommand_0807EE30(entity, context); if (!context->condition) { @@ -1517,7 +1517,7 @@ void ScriptCommand_CameraTargetEntity(Entity* entity, ScriptExecutionContext* co } void ScriptCommand_CameraTargetPlayer(Entity* entity, ScriptExecutionContext* context) { - gRoomControls.camera_target = &gPlayerEntity; + gRoomControls.camera_target = &gPlayerEntity.base; } void ScriptCommand_SetScrollSpeed(Entity* entity, ScriptExecutionContext* context) { @@ -1564,8 +1564,8 @@ void SetCollisionLayer1(Entity* entity, ScriptExecutionContext* context) { } void SetPlayerCollisionLayer1(Entity* entity, ScriptExecutionContext* context) { - gPlayerEntity.collisionLayer = 1; - UpdateSpriteForCollisionLayer(&gPlayerEntity); + gPlayerEntity.base.collisionLayer = 1; + UpdateSpriteForCollisionLayer(&gPlayerEntity.base); } void SetCollisionLayer2(Entity* entity, ScriptExecutionContext* context) { @@ -1578,7 +1578,7 @@ void sub_0807F190(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F1A0(Entity* entity, ScriptExecutionContext* context) { - sub_0807DEDC(entity, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); + sub_0807DEDC(entity, context, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI); gActiveScriptInfo.flags |= 1; } @@ -1659,7 +1659,7 @@ void WaitForAnimDone(Entity* entity, ScriptExecutionContext* context) { } void WaitForPlayerAnim(Entity* entity, ScriptExecutionContext* context) { - if ((gPlayerEntity.frame & ANIM_DONE) != 0) { + if ((gPlayerEntity.base.frame & ANIM_DONE) != 0) { gActiveScriptInfo.flags |= 1; } else { gActiveScriptInfo.commandSize = 0; @@ -1703,15 +1703,15 @@ void sub_0807F3C8(Entity* entity, ScriptExecutionContext* context) { void sub_0807F3D8(Entity* entity, ScriptExecutionContext* context) { InitAnimationForceUpdate(entity, context->intVariable + (entity->animationState >> 1)); - entity->field_0x80.HWORD = entity->animIndex; + ((GenericEntity*)entity)->field_0x80.HWORD = entity->animIndex; } void CreatePlayerExclamationMark(Entity* entity, ScriptExecutionContext* context) { - CreateSpeechBubbleExclamationMark(&gPlayerEntity, 8, -24); + CreateSpeechBubbleExclamationMark(&gPlayerEntity.base, 8, -24); } void CreatePlayerQuestionMark(Entity* entity, ScriptExecutionContext* context) { - CreateSpeechBubbleQuestionMark(&gPlayerEntity, 8, -24); + CreateSpeechBubbleQuestionMark(&gPlayerEntity.base, 8, -24); } void LoadMenu(Entity* entity, ScriptExecutionContext* context) { @@ -1784,7 +1784,7 @@ void sub_0807F4F8(Entity* entity, ScriptExecutionContext* context) { } void ReadPlayerAnimationState(Entity* entity, ScriptExecutionContext* context) { - context->intVariable = gPlayerEntity.animationState >> 1; + context->intVariable = gPlayerEntity.base.animationState >> 1; } void WaitForPlayerIdle(Entity* entity, ScriptExecutionContext* context) { @@ -1833,12 +1833,12 @@ void sub_0807F650(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F680(Entity* entity, ScriptExecutionContext* context) { - context->condition = gPlayerEntity.x.HALF.HI - gRoomControls.origin_x > (s32)(context->intVariable & 0xffff); + context->condition = gPlayerEntity.base.x.HALF.HI - gRoomControls.origin_x > (s32)(context->intVariable & 0xffff); gActiveScriptInfo.flags |= 1; } void sub_0807F6B4(Entity* entity, ScriptExecutionContext* context) { - context->condition = gPlayerEntity.y.HALF.HI - gRoomControls.origin_y > (s32)(context->intVariable & 0xffff); + context->condition = gPlayerEntity.base.y.HALF.HI - gRoomControls.origin_y > (s32)(context->intVariable & 0xffff); gActiveScriptInfo.flags |= 1; } @@ -1866,8 +1866,8 @@ void sub_0807F738(Entity* entity, ScriptExecutionContext* context) { void SetPlayerPos(Entity* entity, ScriptExecutionContext* context) { s32 s32Var = context->intVariable; - gPlayerEntity.x.HALF.HI = (s32Var >> 16) + gRoomControls.origin_x; - gPlayerEntity.y.HALF.HI = (s32Var & 0xffff) + gRoomControls.origin_y; + gPlayerEntity.base.x.HALF.HI = (s32Var >> 16) + gRoomControls.origin_x; + gPlayerEntity.base.y.HALF.HI = (s32Var & 0xffff) + gRoomControls.origin_y; } void GetConditionSet(Entity* entity, ScriptExecutionContext* context) { @@ -1960,10 +1960,10 @@ void DoGravity(Entity* entity, ScriptExecutionContext* context) { } void sub_0807F8E8(Entity* entity, ScriptExecutionContext* context) { - Entity* c = CreateObjectWithParent(entity, SANCTUARY_STONE_TABLET, 0, 0); - if (c != NULL) { - c->parent = entity; - c->field_0x86.HWORD = (context->intVariable & 0x3ff) | 0x8000; + Entity* stoneTablet = CreateObjectWithParent(entity, SANCTUARY_STONE_TABLET, 0, 0); + if (stoneTablet != NULL) { + stoneTablet->parent = entity; + ((GenericEntity*)stoneTablet)->field_0x86.HWORD = (context->intVariable & 0x3ff) | 0x8000; } } @@ -2094,12 +2094,12 @@ void sub_0807FB28(Entity* entity, ScriptExecutionContext* context) { } void SetPlayerIFrames(Entity* entity, ScriptExecutionContext* context) { - gPlayerEntity.iframes = context->intVariable; + gPlayerEntity.base.iframes = context->intVariable; } void DisablePlayerSwimState(Entity* entity, ScriptExecutionContext* context) { gPlayerState.swim_state = 0; - gPlayerEntity.collisionFlags &= ~4; + gPlayerEntity.base.collisionFlags &= ~4; } void sub_0807FB94(Entity* entity, ScriptExecutionContext* context) { diff --git a/src/scroll.c b/src/scroll.c index 815c2be2..7c30e701 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -1,6 +1,5 @@ #include "scroll.h" -#define ENT_DEPRECATED #include "asm.h" #include "collision.h" #include "common.h" @@ -202,8 +201,8 @@ void sub_0807FDF8(RoomControls* controls) { case 0: controls->scroll_y -= 4; pEVar2 = controls->camera_target; - if (pEVar2 == &gPlayerEntity) { - pEVar2->y.WORD = gPlayerEntity.y.WORD - Q_16_16(0.375); + if (pEVar2 == &gPlayerEntity.base) { + pEVar2->y.WORD = gPlayerEntity.base.y.WORD - Q_16_16(0.375); } if (controls->unk_18 == 0x28) { sub_0807FEC8(controls); @@ -211,8 +210,8 @@ void sub_0807FDF8(RoomControls* controls) { break; case 1: controls->scroll_x = controls->scroll_x + 4; - if (controls->camera_target == &gPlayerEntity) { - gPlayerEntity.x.WORD += Q_16_16(0.25); + if (controls->camera_target == &gPlayerEntity.base) { + gPlayerEntity.base.x.WORD += Q_16_16(0.25); } if (controls->unk_18 == 0x3c) { sub_0807FEC8(controls); @@ -221,8 +220,8 @@ void sub_0807FDF8(RoomControls* controls) { case 2: controls->scroll_y = controls->scroll_y + 4; pEVar2 = controls->camera_target; - if (pEVar2 == &gPlayerEntity) { - pEVar2->y.WORD = gPlayerEntity.y.WORD + Q_16_16(0.375); + if (pEVar2 == &gPlayerEntity.base) { + pEVar2->y.WORD = gPlayerEntity.base.y.WORD + Q_16_16(0.375); } if (controls->unk_18 == 0x28) { sub_0807FEC8(controls); @@ -230,8 +229,8 @@ void sub_0807FDF8(RoomControls* controls) { break; case 3: controls->scroll_x -= 4; - if (controls->camera_target == &gPlayerEntity) { - gPlayerEntity.x.WORD -= Q_16_16(0.25); + if (controls->camera_target == &gPlayerEntity.base) { + gPlayerEntity.base.x.WORD -= Q_16_16(0.25); } if (controls->unk_18 == 0x3c) { sub_0807FEC8(controls); @@ -291,9 +290,9 @@ void sub_0807FF6C(RoomControls* controls) { ResetActiveItems(); ResetPlayerAnimationAndAction(); if (gDiggingCaveEntranceTransition.isDiggingCave) { - gPlayerEntity.animationState = 4; + gPlayerEntity.base.animationState = 4; } else { - gPlayerEntity.animationState = 0; + gPlayerEntity.base.animationState = 0; } sub_080809D4(); } @@ -848,7 +847,7 @@ void UpdateDoorTransition() { u32 uVar3; u32 uVar4; RoomControls* controls = &gRoomControls; - if (gRoomControls.camera_target != &gPlayerEntity) { + if (gRoomControls.camera_target != &gPlayerEntity.base) { return; } if (gPlayerState.jump_status != 0) { @@ -956,10 +955,10 @@ void sub_08080CB4(Entity* this) { if (this->spriteSettings.draw != 0) { switch (this->type) { case 0x60: - if (this->field_0x6a.HALF.LO != 0) { - this->field_0x6a.HALF.LO--; + if (((GenericEntity*)this)->field_0x6a.HALF.LO != 0) { + ((GenericEntity*)this)->field_0x6a.HALF.LO--; } else { - this->field_0x6a.HALF.LO = (Random() & 0x1f) + 10; + ((GenericEntity*)this)->field_0x6a.HALF.LO = (Random() & 0x1f) + 10; effect = CreateFx(this, FX_SPARKLE, 0); if (effect != NULL) { effect->spriteOffsetX = this->spriteOffsetX; diff --git a/src/subtask/subtaskFastTravel.c b/src/subtask/subtaskFastTravel.c index 6e4749e6..b457a10c 100644 --- a/src/subtask/subtaskFastTravel.c +++ b/src/subtask/subtaskFastTravel.c @@ -138,7 +138,7 @@ void Subtask_FastTravel_3(void) { SetFade(FADE_IN_OUT | FADE_INSTANT, 8); } else { ResetPlayerAnimationAndAction(); - sub_080042D0(&gPlayerEntity, (u32)gPlayerEntity.animIndex, gPlayerEntity.spriteIndex); + sub_080042D0(&gPlayerEntity.base, (u32)gPlayerEntity.base.animIndex, gPlayerEntity.base.spriteIndex); Subtask_Exit(); gPauseMenuOptions.disabled = 0; SoundReq(SFX_MENU_CANCEL); diff --git a/src/vram.c b/src/vram.c index 9c57a8f3..73a2b0e8 100644 --- a/src/vram.c +++ b/src/vram.c @@ -1,9 +1,6 @@ -#define ENT_DEPRECATED // Due to sub_080AE218 indexing with gPlayerEntity -#include "global.h" #include "common.h" -#include "structures.h" #include "fileselect.h" -#include "new_player.h" +#include "structures.h" extern u32 gFixedTypeGfxData[]; @@ -364,7 +361,7 @@ void sub_080AE218(u32 param1, u32 param2) { r7 = r3 + ((u32)gGFXSlots.slots[param1].slotCount << 4); for (index1 = 0; index1 < 0x50; index1++) { - Entity* ent = &(&gPlayerEntity)[index1]; + Entity* ent = (Entity*)&(&gPlayerEntity)[index1]; if (ent->next != NULL) { if (param1 == ent->spriteAnimation[0]) { ent->spriteAnimation[0] = param2; diff --git a/src/worldEvent/worldEvent15.c b/src/worldEvent/worldEvent15.c index e30a5c39..2d1bbf39 100644 --- a/src/worldEvent/worldEvent15.c +++ b/src/worldEvent/worldEvent15.c @@ -4,7 +4,6 @@ * * @brief World Event 15 */ -#define ENT_DEPRECATED #include "fade.h" #include "flags.h" #include "menu.h" @@ -34,7 +33,7 @@ void WorldEvent_15_0(void) { entity = LoadRoomEntity((EntityData*)gUnk_080FEE48); if (entity != NULL) { entity->type2 = 2; - entity->field_0x86.HWORD = 0x80ff; + ((GenericEntity*)entity)->field_0x86.HWORD = 0x80ff; } sub_08054A14(gMenu.field_0x4); sub_08055B70(gMenu.field_0x4, 0, 0, 0); From 8b69eadaef0e0d9f1a4071d1cfad00e93183590b Mon Sep 17 00:00:00 2001 From: octorock <79596758+octorock@users.noreply.github.com> Date: Sat, 30 Dec 2023 22:48:48 +0100 Subject: [PATCH 15/15] Fix format --- src/item/itemPegasusBoots.c | 2 +- src/manager/holeManager.c | 4 ++-- src/manager/templeOfDropletsManager.c | 4 +--- src/npc/malon.c | 4 ++-- src/npc/zelda.c | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/item/itemPegasusBoots.c b/src/item/itemPegasusBoots.c index 0b4af5ea..a79c4788 100644 --- a/src/item/itemPegasusBoots.c +++ b/src/item/itemPegasusBoots.c @@ -15,7 +15,7 @@ extern u16 gUnk_0800275C[]; extern u8 gUnk_0811BE38[]; void ItemPegasusBoots(ItemBehavior* this, u32 index) { - static void (*const ItemPegasusBoots_StateFunctions[])(ItemBehavior* beh, u32) = { + static void (*const ItemPegasusBoots_StateFunctions[])(ItemBehavior * beh, u32) = { sub_080768F8, sub_08076964, sub_08076A88, diff --git a/src/manager/holeManager.c b/src/manager/holeManager.c index a4d0d2d8..ea7ce0ad 100644 --- a/src/manager/holeManager.c +++ b/src/manager/holeManager.c @@ -37,14 +37,14 @@ typedef struct struct_08108764 { u16 unk_06; u16 unk_08; u16 unk_0a; - }* unk_0c; + } * unk_0c; struct { u8 unk_00; u8 unk_01; u8 unk_02[2]; u16 unk_04; u16 unk_06; - }* unk_10; + } * unk_10; } struct_08108764; extern struct_08108764 gUnk_08108764[]; diff --git a/src/manager/templeOfDropletsManager.c b/src/manager/templeOfDropletsManager.c index 14fc1d75..bdec6a4a 100644 --- a/src/manager/templeOfDropletsManager.c +++ b/src/manager/templeOfDropletsManager.c @@ -488,9 +488,7 @@ void sub_0805A9CC(TempleOfDropletsManager* this) { gScreen.bg3.updated = 1; } -extern struct { - u8 unk_00[0x20]; -} gUnk_085A97A0[]; +extern struct { u8 unk_00[0x20]; } gUnk_085A97A0[]; void sub_0805AA58(TempleOfDropletsManager* this) { if (--super->timer == 0) { diff --git a/src/npc/malon.c b/src/npc/malon.c index 9584078f..add79ace 100644 --- a/src/npc/malon.c +++ b/src/npc/malon.c @@ -20,11 +20,11 @@ void sub_080658BC(MalonEntity* this); void sub_08065900(MalonEntity* this); void Malon(MalonEntity* this) { - static void (*const actionFuncs[])(Entity* this) = { + static void (*const actionFuncs[])(Entity * this) = { sub_08065864, sub_08065880, }; - static void (*const scriptedActionFuncs[])(MalonEntity* this) = { + static void (*const scriptedActionFuncs[])(MalonEntity * this) = { sub_08065888, sub_080658BC, sub_08065900, diff --git a/src/npc/zelda.c b/src/npc/zelda.c index d8e77ffd..eee18150 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -19,7 +19,7 @@ void sub_08066CCC(Entity*); void sub_08066CF8(Entity*); void Zelda(Entity* this) { - static void (*const gUnk_08110BD8[])(Entity* ent) = { + static void (*const gUnk_08110BD8[])(Entity * ent) = { sub_08066CCC, sub_08066CF8, };