diff --git a/include/entity.h b/include/entity.h index 78dcde475..cbb54201b 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 a770563be..49fb3f311 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 000000000..9fb2fad44 --- /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 19be9997d..db8c1f086 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 cd52da105..873ff039f 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 657d9d0bb..28995f4d2 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 782a51b21..2c7fa88f3 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 05d59a989..e030edb14 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 2ac2b37f1..1a9ac121f 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 c78c0da36..00cfd5e96 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 3cc20ca97..b9563b462 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 de9a83908..0a13bf40d 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 959e90f9d..a720a7887 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 afe8394af..f98b97f3b 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 1f54b1438..3f34f5c45 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 3b1d17cfe..c220332b3 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 308204f06..9797a0c23 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 edad0b7db..c8d8241de 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 f82b91535..225ba477b 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 80d4cffc7..2fe982bbf 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 1aa2a0e15..d7a24f258 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 d55677d6d..ff2c534b1 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 4a9ba0206..ca2ec1256 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 a8bd18100..2163b2809 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 b1b97aba3..7472dcbdf 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 5b3bcc18d..bc8847cf9 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 059f61638..0767433bf 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 2157168fa..3c4dda2af 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 aa2d221e4..d2f42aec6 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 f936bc1ea..33a7d46aa 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 fa4da6a62..07b03bafd 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 4fd41240f..88cc9e0a1 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 1969c89ae..82708d845 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 f65194078..32b2f0625 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 098d61b7d..9cd047804 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 b467d9009..91bfc6de2 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 453681475..c490a29e7 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 7b9e10366..a1f69c55f 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 9d42eb8c0..d32badf24 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 7943e305f..8d5cf8dcb 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 e8621c424..a2e02a34f 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 56597734a..9458205bf 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 66d89c938..781cfec02 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 93cb3c369..dfb0c4fc6 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 880441c8a..f71678dcb 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 f1feaf984..f07783718 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 8590e9943..43cdd1647 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 d30ef4419..bfef099e9 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 b817987d5..161b9f36b 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 22f303f4d..75ae8ed32 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 2306f1076..b509b1db3 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 15aa1d067..baf3e231e 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 afe2d86f8..a9adf6e06 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 ccf79c69f..673de68bc 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 f8e9b0fab..12711abca 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 5470b36b7..45d666794 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 3560137bf..68d63b46a 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 ae1f8eb1a..c8d5d6c44 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 52ea9b4f7..527e357a9 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 f55e285f8..9f1c94822 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 aa24f3211..7638a205a 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 a2882348f..9fa4612e3 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 fd9c71d96..349c93383 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 d265052e2..d2f7899c2 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 e1515106e..07708c409 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 f7bacd3d9..7efe01131 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 2fc5ed83b..2b4b0daca 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 9c0019157..e19d04995 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 1e28d988c..74db801c1 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 6cf374ad1..00fdc5e76 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 e6121ec0d..2d4204e43 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 ba3b67037..e937288f7 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 624824ae1..86c09f1df 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 a9e021404..1c3942ea8 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 6f46ac273..540a85ddf 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 6820317a2..1416d5642 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 0de3796d8..2c1365c14 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 a921f8ba3..2835e202a 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 aca8b2fd8..9a87f5c6a 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 bf70e6017..8aff156f8 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 8a9d361d5..c811373c4 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 cf14269a9..009535a72 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 7abd4675a..dbefdeb9d 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 15b19439d..93a0379c5 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 fdda19331..446d2bf6f 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 1dedecaff..4f9c55cb7 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 dca5a9039..819495d42 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 f72cc80bf..bd08c9849 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 be8462b57..daa132f1a 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 3a5ca962b..8780cf0ca 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 bd94a1716..997a91d0f 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 a688564d8..254be88f5 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 cc028dbab..90a10af11 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 cff07abb7..c987c7611 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 33fcbcf25..8216a438c 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) {