Skip to content

Commit

Permalink
clean up linkAnimation.c
Browse files Browse the repository at this point in the history
  • Loading branch information
hytopoulos committed Dec 29, 2023
1 parent 7c1c612 commit a030120
Show file tree
Hide file tree
Showing 95 changed files with 245 additions and 216 deletions.
2 changes: 1 addition & 1 deletion include/entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
23 changes: 23 additions & 0 deletions include/object/linkAnimation.h
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion include/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/enemy/businessScrub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/enemy/businessScrubPrologue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/enemy/likeLike.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/enemyUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/entity.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -508,7 +508,7 @@ void AppendEntityToList(Entity* entity, u32 listIndex) {
} else {
gManagerCount++;
}
SetDefaultPriorityForKind(entity);
SetEntityPriorityForKind(entity);
}

void PrependEntityToList(Entity* entity, u32 listIndex) {
Expand Down
2 changes: 1 addition & 1 deletion src/itemUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/manager/cloudOverlayManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/manager/delayedEntityLoadManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/manager/enterRoomTextboxManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down
2 changes: 1 addition & 1 deletion src/manager/ezloHintManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/manager/fightManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/manager/holeManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/manager/hyruleTownTilesetManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/manager/lightManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/manager/minishVillageTilesetManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions src/manager/miscManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/manager/powBackgroundManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/manager/repeatedSoundManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/manager/secretManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/manager/staticBackgroundManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/manager/templeOfDropletsManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/manager/vaati3BackgroundManager.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
14 changes: 7 additions & 7 deletions src/npc/bigGoron.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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);
}
}

Expand Down
Loading

0 comments on commit a030120

Please sign in to comment.