summaryrefslogtreecommitdiff
path: root/src/object
diff options
context:
space:
mode:
authortheo3 <arisstephenson2@gmail.com>2023-12-28 19:05:06 -0800
committertheo3 <arisstephenson2@gmail.com>2023-12-28 19:05:06 -0800
commita030120a0c3b65cd1a35ec83644edca6985e5346 (patch)
treee62d4aa047ff662b6e41ce0744f1e39fab9291e1 /src/object
parent7c1c612c9ba95b47f33cfd217ab99c4c9102531e (diff)
clean up linkAnimation.c
Diffstat (limited to 'src/object')
-rw-r--r--src/object/beanstalk.c2
-rw-r--r--src/object/bigBarrel.c4
-rw-r--r--src/object/bigVortex.c2
-rw-r--r--src/object/bird.c8
-rw-r--r--src/object/cameraTarget.c2
-rw-r--r--src/object/crenelBeanSprout.c2
-rw-r--r--src/object/cutsceneMiscObject.c22
-rw-r--r--src/object/deathFx.c2
-rw-r--r--src/object/fairy.c2
-rw-r--r--src/object/figurineDevice.c4
-rw-r--r--src/object/fourElements.c2
-rw-r--r--src/object/frozenOctorok.c2
-rw-r--r--src/object/greatFairy.c4
-rw-r--r--src/object/guruguruBar.c2
-rw-r--r--src/object/houseDoorExterior.c2
-rw-r--r--src/object/itemForSale.c2
-rw-r--r--src/object/itemOnGround.c4
-rw-r--r--src/object/linkAnimation.c118
-rw-r--r--src/object/linkHoldingItem.c2
-rw-r--r--src/object/minishVillageObject.c2
-rw-r--r--src/object/moleMittsParticle.c2
-rw-r--r--src/object/object30.c2
-rw-r--r--src/object/objectA2.c2
-rw-r--r--src/object/objectA8.c2
-rw-r--r--src/object/parallaxRoomView.c2
-rw-r--r--src/object/shrinkingHieroglyphs.c2
-rw-r--r--src/object/specialFx.c2
-rw-r--r--src/object/windTribeTeleporter.c2
28 files changed, 101 insertions, 105 deletions
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;