diff options
| author | octorock <79596758+octorock@users.noreply.github.com> | 2023-12-31 02:12:41 +0100 |
|---|---|---|
| committer | octorock <79596758+octorock@users.noreply.github.com> | 2023-12-31 02:12:41 +0100 |
| commit | 109b1020dcbfa17e80d28c522b5d792f7b3c6d46 (patch) | |
| tree | cf23c1134de2891d0eed3b55549e70b29eb1997f /src/npc | |
| parent | 957da774e4c34100e0bd352b1570af02bb7f7521 (diff) | |
| parent | 9c87bcca8ea4b52199ed908c0ea28ab08b1d0747 (diff) | |
Merge branch 'master' into tilemap-docs
Diffstat (limited to 'src/npc')
87 files changed, 283 insertions, 363 deletions
diff --git a/src/npc/anju.c b/src/npc/anju.c index 0c0df5a9..2e1b02bd 100644 --- a/src/npc/anju.c +++ b/src/npc/anju.c @@ -4,7 +4,6 @@ * * @brief Anju NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "player.h" @@ -26,8 +25,8 @@ void Anju(AnjuEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4( - GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4(GetFacingDirection( + super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/beedle.c b/src/npc/beedle.c index 38bcb381..0729e1cc 100644 --- a/src/npc/beedle.c +++ b/src/npc/beedle.c @@ -4,7 +4,6 @@ * * @brief Beedle NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "game.h" @@ -94,7 +93,7 @@ void Beedle_Action1(Entity* this) { } void Beedle_Action2(Entity* this) { - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action++; InitializeAnimation(this, 8); } @@ -196,8 +195,8 @@ void sub_0806346C(Entity* this) { s32 iVar2; s32 iVar3; - iVar3 = (gPlayerEntity.x.HALF.HI - this->x.HALF.HI); - iVar2 = (gPlayerEntity.y.HALF.HI - this->y.HALF.HI); + iVar3 = (gPlayerEntity.base.x.HALF.HI - this->x.HALF.HI); + iVar2 = (gPlayerEntity.base.y.HALF.HI - this->y.HALF.HI); iVar3 += 0x30; iVar2 += 0x18; @@ -217,7 +216,7 @@ void sub_0806346C(Entity* this) { iVar3 >>= 4; iVar2 >>= 4; - bVar1 = gUnk_0810C8F0[iVar2][iVar3][gPlayerEntity.animationState >> 1]; + bVar1 = gUnk_0810C8F0[iVar2][iVar3][gPlayerEntity.base.animationState >> 1]; if (bVar1 != this->type2) { const InteractCollisionData* data = &gBeedleCollisionData[bVar1]; SetInteractableObjectCollision(this, 1, data->interactDirections, data); diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index ee370eee..23fb4d1d 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -4,7 +4,6 @@ * * @brief BigGoron NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "hitbox.h" #include "item.h" @@ -81,7 +80,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 { @@ -93,10 +92,10 @@ void sub_0806CF30(BigGoronEntity* this) { case 0: case 1: if (gRoomTransition.frameCount % 4 == 0) { - if (gPlayerEntity.x.HALF.HI < super->x.HALF.HI && this->originalX - 32 < super->x.HALF.HI) { + if (gPlayerEntity.base.x.HALF.HI < super->x.HALF.HI && this->originalX - 32 < super->x.HALF.HI) { super->x.HALF.HI--; } - if (gPlayerEntity.x.HALF.HI > super->x.HALF.HI && this->originalX + 32 > super->x.HALF.HI) { + if (gPlayerEntity.base.x.HALF.HI > super->x.HALF.HI && this->originalX + 32 > super->x.HALF.HI) { super->x.HALF.HI++; } } @@ -215,7 +214,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 +255,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; @@ -266,7 +265,7 @@ void sub_0806D274(BigGoronEntity* this) { case 0: case 1: default: - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->frameIndex = 2; break; } @@ -303,7 +302,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 +320,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 +343,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 +367,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); } } @@ -434,7 +433,7 @@ void sub_0806D5D4(void) { InitBiggoronTimer(); equipSlot = IsItemEquipped(ITEM_SHIELD); if (equipSlot != EQUIP_SLOT_NONE) { - gSave.stats.itemButtons[equipSlot] = ITEM_NONE; + gSave.stats.equipped[equipSlot] = ITEM_NONE; } SetInventoryValue(ITEM_SHIELD, 0); } @@ -543,8 +542,8 @@ void sub_0806D788(void) { void sub_0806D7C4(Entity* this, ScriptExecutionContext* context) { Entity* entity; - this->x.HALF.HI = gPlayerEntity.x.HALF.HI; - this->y.HALF.HI = gPlayerEntity.y.HALF.HI - 0x18; + this->x.HALF.HI = gPlayerEntity.base.x.HALF.HI; + this->y.HALF.HI = gPlayerEntity.base.y.HALF.HI - 0x18; entity = FindEntity(NPC, BIG_GORON, 7, 2, 0); if (entity != NULL) { LookAt(this, context, entity->x.HALF.HI, entity->y.HALF.HI); @@ -558,7 +557,7 @@ void sub_0806D804(Entity* this, ScriptExecutionContext* context) { this->y.HALF.HI = entity->y.HALF.HI - 0x10; this->spritePriority.b1 = 0; } - LookAt(this, context, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0x10); + LookAt(this, context, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI - 0x10); } void sub_0806D858(Entity* this) { diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index c5589933..58a0ed2c 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -4,7 +4,6 @@ * * @brief Blade Brothers NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -322,7 +321,7 @@ void sub_08068b2c(BladeBrothersEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - animationState = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + animationState = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)); InitAnimationForceUpdate(super, animationState); InitializeNPCFusion(super); } else { @@ -347,10 +346,10 @@ void BladeBrothers_StartPlayerDemonstration(Entity* this, ScriptExecutionContext } void sub_08068BB4(BladeBrothersEntity* this) { - u32 item = gSave.stats.itemButtons[SLOT_A]; + u32 item = gSave.stats.equipped[SLOT_A]; this->itemSlotA = item; - item = gSave.stats.itemButtons[SLOT_B]; + item = gSave.stats.equipped[SLOT_B]; this->itemSlotB = item; } diff --git a/src/npc/brocco.c b/src/npc/brocco.c index 9236bb60..b4ab49e7 100644 --- a/src/npc/brocco.c +++ b/src/npc/brocco.c @@ -4,7 +4,6 @@ * * @brief Brocco NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "message.h" #include "npc.h" @@ -72,7 +71,7 @@ void sub_08063584(Entity* this) { } void sub_08063608(Entity* this) { - u8 tmp = gMessage.doTextBox & 0x7f; + u8 tmp = gMessage.state & MESSAGE_ACTIVE; if (tmp == 0) { this->action = 1; this->subtimer = tmp; @@ -92,8 +91,8 @@ void sub_0806362C(BroccoEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 4); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, NULL); diff --git a/src/npc/carlov.c b/src/npc/carlov.c index 0cc92008..07a9abb5 100644 --- a/src/npc/carlov.c +++ b/src/npc/carlov.c @@ -4,7 +4,6 @@ * * @brief Carlov NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "room.h" diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index 2157168f..690f6c67 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -4,7 +4,6 @@ * * @brief Carpenter NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "item.h" #include "npc.h" @@ -35,7 +34,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: @@ -43,8 +42,9 @@ void Carpenter(CarpenterEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + - 4 + (super->type * 8)); + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 4 + + (super->type * 8)); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, 0); @@ -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/castleMaid.c b/src/npc/castleMaid.c index 2001f0d2..2a47701a 100644 --- a/src/npc/castleMaid.c +++ b/src/npc/castleMaid.c @@ -4,7 +4,6 @@ * * @brief Castle Maid NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -92,14 +91,15 @@ void sub_08064570(CastleMaidEntity* this) { if (super->interactType != INTERACTION_NONE) { super->action++; super->interactType = INTERACTION_NONE; - InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); if (this->dialogFunc != NULL) { this->dialogFunc(); } } break; case 2: - if ((gMessage.doTextBox & 0x7f) != 0) { + if ((gMessage.state & MESSAGE_ACTIVE) != 0) { return; } super->action = 1; diff --git a/src/npc/castorWildsStatue.c b/src/npc/castorWildsStatue.c index 1a7c926f..448476bb 100644 --- a/src/npc/castorWildsStatue.c +++ b/src/npc/castorWildsStatue.c @@ -4,7 +4,6 @@ * * @brief Castor Wilds Statue NPC */ -#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "flags.h" diff --git a/src/npc/cat.c b/src/npc/cat.c index aa2d221e..a3228998 100644 --- a/src/npc/cat.c +++ b/src/npc/cat.c @@ -4,7 +4,6 @@ * * @brief Cat NPC */ -#define NENT_DEPRECATED #include "enemy.h" #include "entity.h" #include "functions.h" @@ -143,7 +142,7 @@ void sub_080677EC(CatEntity* this) { super->hitType = -0x58; super->flags2 = 1; this->unk_69 = 0xff; - if (super->x.HALF.HI < gPlayerEntity.x.HALF.HI) { + if (super->x.HALF.HI < gPlayerEntity.base.x.HALF.HI) { super->spriteSettings.flipX = 1; } else { super->spriteSettings.flipX = 0; @@ -219,9 +218,9 @@ void sub_0806797C(CatEntity* this) { void sub_0806799C(CatEntity* this) { UpdateAnimationSingleFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { sub_08067B08(this); - SetDefaultPriority(super, PRIO_PLAYER); + SetEntityPriority(super, PRIO_PLAYER); } } @@ -322,7 +321,7 @@ void sub_08067B80(CatEntity* this, u32 animIndex) { this->unk_74 = (Random() & 0x7f) + 0x1e; InitAnimationForceUpdate(super, animIndex); sub_08067DDC(super); - if (super->x.HALF.HI < gPlayerEntity.x.HALF.HI) { + if (super->x.HALF.HI < gPlayerEntity.base.x.HALF.HI) { super->spriteSettings.flipX = 1; } else { super->spriteSettings.flipX = 0; @@ -331,11 +330,11 @@ void sub_08067B80(CatEntity* this, u32 animIndex) { void sub_08067BD4(Entity* this) { if (this->spriteSettings.flipX > 0) { - if (this->x.HALF.HI - 4 > gPlayerEntity.x.HALF.HI) { + if (this->x.HALF.HI - 4 > gPlayerEntity.base.x.HALF.HI) { this->spriteSettings.flipX = 0; } } else { - if (this->x.HALF.HI + 4 < gPlayerEntity.x.HALF.HI) { + if (this->x.HALF.HI + 4 < gPlayerEntity.base.x.HALF.HI) { this->spriteSettings.flipX = 1; } } @@ -377,7 +376,7 @@ void sub_08067C44(CatEntity* this) { return; } - iVar4 = sub_0806FCA0(super, &gPlayerEntity); + iVar4 = sub_0806FCA0(super, &gPlayerEntity.base); switch (super->animIndex) { case 0: default: @@ -409,7 +408,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/clothesRack.c b/src/npc/clothesRack.c index db711388..cea8bcdd 100644 --- a/src/npc/clothesRack.c +++ b/src/npc/clothesRack.c @@ -4,7 +4,6 @@ * * @brief Clothes Rack NPC */ -#define NENT_DEPRECATED #include "npc.h" #include "tiles.h" diff --git a/src/npc/cow.c b/src/npc/cow.c index 8d4f1d4b..944d26b3 100644 --- a/src/npc/cow.c +++ b/src/npc/cow.c @@ -4,7 +4,6 @@ * * @brief Cow NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" diff --git a/src/npc/cucco.c b/src/npc/cucco.c index f936bc1e..54042add 100644 --- a/src/npc/cucco.c +++ b/src/npc/cucco.c @@ -4,7 +4,6 @@ * * @brief Cucco NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "kinstone.h" #include "npc.h" @@ -30,7 +29,7 @@ void Cucco_Init(CuccoEntity* this) { super->action++; this->fusionOffer = GetFusionToOffer(super); AddInteractableAsMinishFuser(super, this->fusionOffer); - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); super->subAction = 0; sub_0806E4EC(this); } diff --git a/src/npc/cuccoChick.c b/src/npc/cuccoChick.c index fa4da6a6..adf6eaf4 100644 --- a/src/npc/cuccoChick.c +++ b/src/npc/cuccoChick.c @@ -4,7 +4,6 @@ * * @brief Cucco Chick NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "npc.h" @@ -37,7 +36,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 86795600..8fad6649 100644 --- a/src/npc/dampe.c +++ b/src/npc/dampe.c @@ -4,7 +4,6 @@ * * @brief Dampe NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "item.h" @@ -25,15 +24,15 @@ 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: if (this->interactType == INTERACTION_FUSE) { this->action = 2; this->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(this, - GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity)) + 4); + InitAnimationForceUpdate( + this, GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity.base)) + 4); InitializeNPCFusion(this); } else { ExecuteScriptAndHandleAnimation(this, NULL); diff --git a/src/npc/din.c b/src/npc/din.c index cfbef459..604c03bb 100644 --- a/src/npc/din.c +++ b/src/npc/din.c @@ -4,7 +4,6 @@ * * @brief Din NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "kinstone.h" #include "npc.h" @@ -27,8 +26,8 @@ void Din(DinEntity* this) { super->interactType = INTERACTION_NONE; InitializeNPCFusion(super); this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { ExecuteScriptAndHandleAnimation(super, NULL); } diff --git a/src/npc/dog.c b/src/npc/dog.c index 9deab06d..3156eec1 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -4,7 +4,6 @@ * * @brief Dog NPC */ -#define NENT_DEPRECATED #include "collision.h" #include "entity.h" #include "functions.h" @@ -227,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); @@ -267,7 +266,7 @@ void sub_08069CB8(DogEntity* this) { u32 direction; u32 animState; - direction = GetFacingDirection(super, &gPlayerEntity); + direction = GetFacingDirection(super, &gPlayerEntity.base); animState = gUnk_08111DB0[direction + super->animationState * 0x20]; super->animationState = animState >> 6; this->unk_6b = animState & 0x3f; @@ -431,7 +430,7 @@ bool32 sub_08069F90(DogEntity* this) { if ((super->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) { return TRUE; } else { - return EntityInRectRadius(super, &gPlayerEntity, 0x14, 0x14); + return EntityInRectRadius(super, &gPlayerEntity.base, 0x14, 0x14); } } @@ -526,7 +525,7 @@ void Dog_Fusion(DogEntity* this) { if (sub_08069EF0(this)) { super->action++; super->spriteSettings.draw = 1; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitializeAnimation(super, 0x23); } } else { diff --git a/src/npc/drLeft.c b/src/npc/drLeft.c index f6519407..c89760c5 100644 --- a/src/npc/drLeft.c +++ b/src/npc/drLeft.c @@ -4,7 +4,6 @@ * * @brief Dr Left NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "npc.h" @@ -15,7 +14,7 @@ void DrLeft(Entity* this) { if (this->type == 0) { if (this->action == 0) { this->action++; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitScriptForNPC(this); } ExecuteScriptForEntity(this, NULL); diff --git a/src/npc/emma.c b/src/npc/emma.c index 098d61b7..7ff05e23 100644 --- a/src/npc/emma.c +++ b/src/npc/emma.c @@ -4,7 +4,6 @@ * * @brief Emma NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "screenTransitions.h" @@ -13,7 +12,7 @@ void Emma(Entity* this) { if (this->action == 0) { this->action++; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitScriptForNPC(this); } else { ExecuteScriptAndHandleAnimation(this, NULL); diff --git a/src/npc/epona.c b/src/npc/epona.c index b467d900..bec976fd 100644 --- a/src/npc/epona.c +++ b/src/npc/epona.c @@ -4,7 +4,6 @@ * * @brief Epona NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "message.h" @@ -54,7 +53,7 @@ void sub_08065A00(EponaEntity* this) { } void sub_08065A10(EponaEntity* this) { - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; InitAnimationForceUpdate(super, super->animationState / 2); } @@ -101,10 +100,11 @@ 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))); + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { sub_08065A50(this); ResetPlayerAnimationAndAction(); diff --git a/src/npc/ezlo.c b/src/npc/ezlo.c index 5ac0328c..c8012395 100644 --- a/src/npc/ezlo.c +++ b/src/npc/ezlo.c @@ -4,7 +4,6 @@ * * @brief Ezlo NPC */ -#define NENT_DEPRECATED #include "npc.h" const u8 gUnk_08114134[]; @@ -14,7 +13,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); @@ -33,8 +32,8 @@ void sub_0806D8A0(Entity* this, ScriptExecutionContext* context) { if (this->spriteSettings.flipX) { xOffset = -xOffset; } - xOffset += gPlayerEntity.x.HALF.HI; - yOffset = gPlayerEntity.y.HALF.HI + 2; + xOffset += gPlayerEntity.base.x.HALF.HI; + yOffset = gPlayerEntity.base.y.HALF.HI + 2; context->x.HALF.HI = xOffset; context->y.HALF.HI = yOffset; @@ -44,15 +43,15 @@ void sub_0806D8A0(Entity* this, ScriptExecutionContext* context) { } void sub_0806D908(Entity* this) { - this->direction = - CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); + this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gPlayerEntity.base.x.HALF.HI, + gPlayerEntity.base.y.HALF.HI); this->animationState = (this->animationState & 0x80) | gUnk_08114144[this->direction >> 0x1]; } // called when talk to ezlo, also when ezlo moves after you void sub_0806D944(Entity* this) { this->spriteSettings.flipX = 0; - if (this->x.WORD <= gPlayerEntity.x.WORD) { + if (this->x.WORD <= gPlayerEntity.base.x.WORD) { this->spriteSettings.flipX = 1; } } @@ -67,12 +66,12 @@ void sub_0806D96C(Entity* this) { } void sub_0806D9A4(Entity* this) { - if (this->x.WORD <= gPlayerEntity.x.WORD) { - gPlayerEntity.spriteSettings.flipX = 0; + if (this->x.WORD <= gPlayerEntity.base.x.WORD) { + gPlayerEntity.base.spriteSettings.flipX = 0; } else { - gPlayerEntity.spriteSettings.flipX = 1; + gPlayerEntity.base.spriteSettings.flipX = 1; } - gPlayerEntity.animationState = 4; + gPlayerEntity.base.animationState = 4; } // animation states diff --git a/src/npc/farmers.c b/src/npc/farmers.c index 7b9e1036..f98b8ef2 100644 --- a/src/npc/farmers.c +++ b/src/npc/farmers.c @@ -4,7 +4,6 @@ * * @brief Farmers NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" @@ -38,7 +37,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/farore.c b/src/npc/farore.c index 9624b3bc..ae08c094 100644 --- a/src/npc/farore.c +++ b/src/npc/farore.c @@ -4,7 +4,6 @@ * * @brief Farore NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "kinstone.h" @@ -27,8 +26,8 @@ void Farore(FaroreEntity* this) { super->interactType = INTERACTION_NONE; InitializeNPCFusion(super); this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { ExecuteScriptAndHandleAnimation(super, NULL); } diff --git a/src/npc/festari.c b/src/npc/festari.c index 9d42eb8c..8a13f80a 100644 --- a/src/npc/festari.c +++ b/src/npc/festari.c @@ -4,7 +4,6 @@ * * @brief Festari NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" @@ -35,7 +34,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); @@ -47,7 +46,7 @@ void sub_0805FE48(FestariEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScript(super, this->context); @@ -127,7 +126,7 @@ void Festari_Fusion(FestariEntity* this) { if (super->action == 0) { super->action++; super->spriteSettings.draw = 1; - SetDefaultPriority(super, PRIO_MESSAGE); + SetEntityPriority(super, PRIO_MESSAGE); InitAnimationForceUpdate(super, 8); } else { UpdateAnimationSingleFrame(super); diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index 7943e305..7c602e2a 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -4,7 +4,6 @@ * * @brief Forest Minish NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "kinstone.h" @@ -526,7 +525,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 +754,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/fusionMenuNPC.c b/src/npc/fusionMenuNPC.c index 01d970e3..63fd2143 100644 --- a/src/npc/fusionMenuNPC.c +++ b/src/npc/fusionMenuNPC.c @@ -6,7 +6,6 @@ * * Representation for the NPCs in the fusion menu. */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/gentari.c b/src/npc/gentari.c index e8621c42..968f71fc 100644 --- a/src/npc/gentari.c +++ b/src/npc/gentari.c @@ -4,7 +4,6 @@ * * @brief Gentari NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" @@ -18,7 +17,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); @@ -27,8 +26,8 @@ void Gentari(GentariEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); @@ -45,7 +44,7 @@ void Gentari_Fusion(Entity* this) { if (this->action == 0) { this->action++; this->spriteSettings.draw = TRUE; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitAnimationForceUpdate(this, 10); } else { UpdateAnimationSingleFrame(this); diff --git a/src/npc/ghostBrothers.c b/src/npc/ghostBrothers.c index 56597734..9282b35f 100644 --- a/src/npc/ghostBrothers.c +++ b/src/npc/ghostBrothers.c @@ -4,7 +4,6 @@ * * @brief Ghost Brothers NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "message.h" @@ -81,8 +80,8 @@ void sub_08065C0C(GhostBrothersEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); @@ -136,7 +135,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; @@ -162,7 +161,7 @@ void sub_08065D74(GhostBrothersEntity* this) { void sub_08065DB8(GhostBrothersEntity* this) { switch (super->subAction) { case 0: { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->subAction++; super->timer = 60; InitAnimationForceUpdate(super, 4); @@ -188,7 +187,7 @@ void sub_08065DB8(GhostBrothersEntity* this) { break; } case 4: { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->subAction++; super->timer = 30; this->unk_6c = gUnk_0811022E; diff --git a/src/npc/gina.c b/src/npc/gina.c index 8933653f..0124c37e 100644 --- a/src/npc/gina.c +++ b/src/npc/gina.c @@ -4,7 +4,6 @@ * * @brief Gina NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "player.h" @@ -28,8 +27,8 @@ void Gina(GinaEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/gorman.c b/src/npc/gorman.c index 4f46912c..576ef99b 100644 --- a/src/npc/gorman.c +++ b/src/npc/gorman.c @@ -4,7 +4,6 @@ * * @brief Gorman NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "npc.h" diff --git a/src/npc/goron.c b/src/npc/goron.c index 6ed59d26..a67b0e5f 100644 --- a/src/npc/goron.c +++ b/src/npc/goron.c @@ -4,7 +4,6 @@ * * @brief Goron NPC */ -#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "functions.h" @@ -72,7 +71,7 @@ void sub_08069328(Entity* this) { void sub_08069390(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; this->interactType = INTERACTION_NONE; RevokePriority(this); diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c index 24bb04e7..c9bd4d73 100644 --- a/src/npc/goronMerchant.c +++ b/src/npc/goronMerchant.c @@ -4,7 +4,6 @@ * * @brief Goron Merchant NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -57,9 +56,9 @@ void sub_080695AC(Entity* this) { void sub_080695E8(Entity* this) { UpdateAnimationSingleFrame(this); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; - this->interactType = gMessage.doTextBox & 0x7f; + this->interactType = gMessage.state & MESSAGE_ACTIVE; RevokePriority(this); InitAnimationForceUpdate(this, this->animationState); } diff --git a/src/npc/gregal.c b/src/npc/gregal.c index 66d89c93..f081280a 100644 --- a/src/npc/gregal.c +++ b/src/npc/gregal.c @@ -4,7 +4,6 @@ * * @brief Gregal NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" @@ -41,7 +40,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 +67,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 +78,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,15 +95,15 @@ 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) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 8); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 8); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, NULL); @@ -177,7 +176,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/guard.c b/src/npc/guard.c index cb1b7060..760bb6b0 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -4,7 +4,6 @@ * * @brief Guard NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -320,7 +319,7 @@ void sub_08063DC8(Entity* this) { if (this->type == 0xff) { this->action = 2; this->timer = 30; - this->animationState = GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity)); + this->animationState = GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity.base)); InitAnimationForceUpdate(this, this->animationState + 4); } else { sub_0806EE20(this); @@ -333,7 +332,7 @@ void sub_08063DC8(Entity* this) { if (this->interactType != INTERACTION_NONE) { this->action = 3; this->interactType = INTERACTION_NONE; - InitializeAnimation(this, GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity))); + InitializeAnimation(this, GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity.base))); sub_08064428(this); } } @@ -346,7 +345,7 @@ void sub_08063E54(Entity* this) { } void sub_08063E6C(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; InitializeAnimation(this, this->animationState + 4); } @@ -390,14 +389,14 @@ void sub_08063F20(GuardEntity* this) { if (super->interactType != INTERACTION_NONE) { super->action++; super->interactType = INTERACTION_NONE; - InitializeAnimation(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + this->unk_70); + InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + + this->unk_70); sub_08064428(super); } } void sub_08063F78(GuardEntity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = super->action - 1; InitializeAnimation(super, (super->animationState >> 1) + 4 + this->unk_70); } diff --git a/src/npc/guardWithSpear.c b/src/npc/guardWithSpear.c index 52f03587..e4821138 100644 --- a/src/npc/guardWithSpear.c +++ b/src/npc/guardWithSpear.c @@ -4,7 +4,6 @@ * * @brief Guard with Spear NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" @@ -112,7 +111,7 @@ void sub_08064198(GuardWithSpearEntity* this) { this->unk_71--; } - yDiff = gPlayerEntity.y.HALF.HI - super->y.HALF.HI; + yDiff = gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI; if (2 < yDiff) { yDiff = 2; } @@ -132,7 +131,7 @@ void sub_08064198(GuardWithSpearEntity* this) { sVar1 = super->y.HALF.HI; ProcessMovement0(super); if (sVar1 != super->y.HALF.HI) { - if (0x140 < gPlayerEntity.speed && gRoomTransition.frameCount % 6 == 0) { + if (0x140 < gPlayerEntity.base.speed && gRoomTransition.frameCount % 6 == 0) { CreateDustSmall(super); } this->unk_71 = 10; @@ -145,7 +144,7 @@ void sub_08064198(GuardWithSpearEntity* this) { } if (this->unk_71 == 0) { animationState = super->animationState = - GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity)); + GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity.base)); animIndex = (animationState >> 1) + this->unk_70; if (animIndex != super->animIndex) { InitializeAnimation(super, animIndex); @@ -153,8 +152,8 @@ void sub_08064198(GuardWithSpearEntity* this) { } sub_0806ED78(super); sVar1 = super->z.HALF.HI; - super->z.HALF.HI = gPlayerEntity.z.HALF.HI; - if (sVar1 < 0 && gPlayerEntity.z.HALF.HI == 0) { + super->z.HALF.HI = gPlayerEntity.base.z.HALF.HI; + if (sVar1 < 0 && gPlayerEntity.base.z.HALF.HI == 0) { CreateDustSmall(super); } } @@ -169,7 +168,7 @@ void sub_080642B8(GuardWithSpearEntity* this) { this->unk_71--; } - yDiff = gPlayerEntity.x.HALF.HI - super->x.HALF.HI; + yDiff = gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI; if (2 < yDiff) { yDiff = 2; } @@ -189,7 +188,7 @@ void sub_080642B8(GuardWithSpearEntity* this) { sVar1 = super->x.HALF.HI; ProcessMovement0(super); if (sVar1 != super->x.HALF.HI) { - if (0x140 < gPlayerEntity.speed && gRoomTransition.frameCount % 6 == 0) { + if (0x140 < gPlayerEntity.base.speed && gRoomTransition.frameCount % 6 == 0) { CreateDustSmall(super); } this->unk_71 = 10; @@ -202,7 +201,7 @@ void sub_080642B8(GuardWithSpearEntity* this) { } if (this->unk_71 == 0) { animationState = super->animationState = - GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity)); + GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity.base)); animIndex = (animationState >> 1) + this->unk_70; if (animIndex != super->animIndex) { InitializeAnimation(super, animIndex); @@ -210,8 +209,8 @@ void sub_080642B8(GuardWithSpearEntity* this) { } sub_0806ED78(super); sVar1 = super->z.HALF.HI; - super->z.HALF.HI = gPlayerEntity.z.HALF.HI; - if (sVar1 < 0 && gPlayerEntity.z.HALF.HI == 0) { + super->z.HALF.HI = gPlayerEntity.base.z.HALF.HI; + if (sVar1 < 0 && gPlayerEntity.base.z.HALF.HI == 0) { CreateDustSmall(super); } } diff --git a/src/npc/hurdyGurdyMan.c b/src/npc/hurdyGurdyMan.c index 93cb3c36..eb271392 100644 --- a/src/npc/hurdyGurdyMan.c +++ b/src/npc/hurdyGurdyMan.c @@ -4,7 +4,6 @@ * * @brief Hurdy Gurdy Man NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" @@ -29,7 +28,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; @@ -38,7 +37,8 @@ void HurdyGurdyMan(HurdyGurdyManEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->unk_69 = super->animIndex; - InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); index = GetFuserId(super); pointerToArray = gUnk_08001A7C[index]; if (this->fusionOffer == 0x32) { @@ -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/kid.c b/src/npc/kid.c index 7576c8a9..adbbfc57 100644 --- a/src/npc/kid.c +++ b/src/npc/kid.c @@ -4,7 +4,6 @@ * * @brief Kid NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "message.h" #include "npc.h" @@ -315,12 +314,12 @@ void sub_080621AC(KidEntity* this) { if (super->animIndex < 8) { InitializeAnimation(super, (super->animIndex & 0xfffffffc) + - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } break; case 2: GetNextFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; } break; @@ -355,17 +354,17 @@ void sub_080622F4(KidEntity* this) { KidHeapItem item; // Prepended heap item is initialized from player's current state. - item.FIELDS.x = gPlayerEntity.x.HALF_U.HI; - item.FIELDS.y = gPlayerEntity.y.HALF_U.HI; - item.FIELDS.z = gPlayerEntity.z.HALF_U.HI; + item.FIELDS.x = gPlayerEntity.base.x.HALF_U.HI; + item.FIELDS.y = gPlayerEntity.base.y.HALF_U.HI; + item.FIELDS.z = gPlayerEntity.base.z.HALF_U.HI; item.FIELDS.framestate = gPlayerState.framestate; - item.FIELDS.animationState = gPlayerEntity.animationState; - item.FIELDS.collisionLayer = gPlayerEntity.collisionLayer; + item.FIELDS.animationState = gPlayerEntity.base.animationState; + item.FIELDS.collisionLayer = gPlayerEntity.base.collisionLayer; heapPtr = super->myHeap; if (heapPtr->FIELDS.framestate == 0x16 && item.FIELDS.framestate != 0x16) { - dx = super->x.HALF.HI - gPlayerEntity.x.HALF.HI; - dy = super->y.HALF.HI - gPlayerEntity.y.HALF.HI; + dx = super->x.HALF.HI - gPlayerEntity.base.x.HALF.HI; + dy = super->y.HALF.HI - gPlayerEntity.base.y.HALF.HI; if (dx < 0) dx = -dx; @@ -397,7 +396,7 @@ void sub_080622F4(KidEntity* this) { KID_HEAP_SHIFT_RIGHT; animIndex = 0x4; } else { - dist = sub_080041E8(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, (u16)heapPtr->FIELDS.x, + dist = sub_080041E8(gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, (u16)heapPtr->FIELDS.x, (u16)heapPtr->FIELDS.y); dist = ((u32)dist) >> 0x4; if (dist > 0x18) { @@ -467,20 +466,20 @@ void sub_0806252C(Entity* this) { s32 r10; FORCE_REGISTER(s32 x, r12); - r1 = gPlayerEntity.x.HALF_U.HI; + r1 = gPlayerEntity.base.x.HALF_U.HI; r3 = 0xffff0000; r0 = r3; r0 &= r5; r0 |= r1; - r1 = gPlayerEntity.y.HALF_U.HI; + r1 = gPlayerEntity.base.y.HALF_U.HI; r1 <<= 0x10; r2 = 0x0000ffff; r0 &= r2; r0 |= r1; r5 = r0; - r0 = gPlayerEntity.z.HALF_U.HI; + r0 = gPlayerEntity.base.z.HALF_U.HI; r3 &= r6; r3 |= r0; @@ -490,7 +489,7 @@ void sub_0806252C(Entity* this) { r2 &= r3; r2 |= r0; - r1 = gPlayerEntity.animationState; + r1 = gPlayerEntity.base.animationState; r0 = 0x3f; r1 &= r0; r1 <<= 0x18; @@ -498,15 +497,15 @@ void sub_0806252C(Entity* this) { r0 &= r2; r0 |= r1; - r1 = gPlayerEntity.collisionLayer; + r1 = gPlayerEntity.base.collisionLayer; r1 <<= 0x1e; r2 = 0x3fffffff; r0 &= r2; r0 |= r1; r6 = r0; - r10 = r0 = gPlayerEntity.x.HALF.HI - this->x.HALF.HI; - r8 = r0 = gPlayerEntity.y.HALF.HI - this->y.HALF.HI; + r10 = r0 = gPlayerEntity.base.x.HALF.HI - this->x.HALF.HI; + r8 = r0 = gPlayerEntity.base.y.HALF.HI - this->y.HALF.HI; r10 = FixedDiv(r10, KID_HEAP_COUNT); r8 = FixedDiv(r8, KID_HEAP_COUNT); diff --git a/src/npc/kingDaltus.c b/src/npc/kingDaltus.c index d6496e15..1840e24e 100644 --- a/src/npc/kingDaltus.c +++ b/src/npc/kingDaltus.c @@ -4,7 +4,6 @@ * * @brief King Daltus NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" @@ -38,7 +37,8 @@ void KingDaltus(KingDaltusEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->interactType = INTERACTION_NONE; super->action = 2; - InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } scriptedActionFuncs[super->action](this); diff --git a/src/npc/kingGustaf.c b/src/npc/kingGustaf.c index 880441c8..48db93af 100644 --- a/src/npc/kingGustaf.c +++ b/src/npc/kingGustaf.c @@ -4,7 +4,6 @@ * * @brief King Gustaf NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "screen.h" @@ -16,7 +15,7 @@ void KingGustaf(Entity* this) { this->action++; this->spriteRendering.alphaBlend = 1; this->collisionLayer = 2; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); InitScriptForNPC(this); gScreen.controls.layerFXControl = 0x3f40; gScreen.controls.alphaBlend = 0x1000; diff --git a/src/npc/librari.c b/src/npc/librari.c index f1feaf98..7e2a69ba 100644 --- a/src/npc/librari.c +++ b/src/npc/librari.c @@ -4,7 +4,6 @@ * * @brief Librari NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "item.h" #include "npc.h" @@ -22,7 +21,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/librarians.c b/src/npc/librarians.c index 86558d16..e19c3cc4 100644 --- a/src/npc/librarians.c +++ b/src/npc/librarians.c @@ -4,7 +4,6 @@ * * @brief Librarians NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/npc/mailbox.c b/src/npc/mailbox.c index cde3c646..5eb4ea9d 100644 --- a/src/npc/mailbox.c +++ b/src/npc/mailbox.c @@ -4,7 +4,6 @@ * * @brief Mailbox NPC */ -#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "message.h" diff --git a/src/npc/malon.c b/src/npc/malon.c index 6e75d865..add79ace 100644 --- a/src/npc/malon.c +++ b/src/npc/malon.c @@ -4,7 +4,6 @@ * * @brief Malon NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "script.h" @@ -63,7 +62,7 @@ void sub_080658BC(MalonEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/mama.c b/src/npc/mama.c index 8590e994..fa20f7a2 100644 --- a/src/npc/mama.c +++ b/src/npc/mama.c @@ -4,7 +4,6 @@ * * @brief Mama NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "save.h" @@ -40,7 +39,8 @@ void Mama(MamaEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, NULL); @@ -62,7 +62,7 @@ bool32 sub_0806C454(Entity* this) { if (!LoadExtraSpriteData(this, gUnk_08113754)) { return FALSE; } else { - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); return TRUE; } } diff --git a/src/npc/marcy.c b/src/npc/marcy.c index d30ef441..f7c56f54 100644 --- a/src/npc/marcy.c +++ b/src/npc/marcy.c @@ -4,7 +4,6 @@ * * @brief Marcy NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -14,7 +13,7 @@ void Marcy(Entity* this) { if (this->action == 0) { this->action++; - SetDefaultPriority(this, PRIO_MESSAGE); + SetEntityPriority(this, PRIO_MESSAGE); sub_0807DD64(this); } ExecuteScriptAndHandleAnimation(this, NULL); diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c index b817987d..9f4aeb4c 100644 --- a/src/npc/mayorHagen.c +++ b/src/npc/mayorHagen.c @@ -4,7 +4,6 @@ * * @brief Mayor Hagen NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "item.h" @@ -24,7 +23,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: @@ -33,8 +32,8 @@ void MayorHagen(MayorHagenEntity* this) { super->action = v; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - 4 + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, 4 + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); break; } diff --git a/src/npc/melari.c b/src/npc/melari.c index 22f303f4..30c08445 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -4,7 +4,6 @@ * * @brief Melari NPC */ -#define NENT_DEPRECATED #include "item.h" #include "npc.h" @@ -78,7 +77,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/milkCart.c b/src/npc/milkCart.c index 37b7f54d..4c581a1e 100644 --- a/src/npc/milkCart.c +++ b/src/npc/milkCart.c @@ -4,7 +4,6 @@ * * @brief Milk Cart NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/minishEzlo.c b/src/npc/minishEzlo.c index 2306f107..54068afc 100644 --- a/src/npc/minishEzlo.c +++ b/src/npc/minishEzlo.c @@ -4,7 +4,6 @@ * * @brief Minish Ezlo NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "script.h" @@ -33,7 +32,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/ministerPotho.c b/src/npc/ministerPotho.c index 9c0454a5..1532a424 100644 --- a/src/npc/ministerPotho.c +++ b/src/npc/ministerPotho.c @@ -4,7 +4,6 @@ * * @brief Minister Potho NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "item.h" @@ -79,8 +78,8 @@ void sub_08066864(MinisterPothoEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/moblinLady.c b/src/npc/moblinLady.c index 2aa0e0b3..1fa8d109 100644 --- a/src/npc/moblinLady.c +++ b/src/npc/moblinLady.c @@ -4,7 +4,6 @@ * * @brief Moblin Lady NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/mountainMinish.c b/src/npc/mountainMinish.c index 15aa1d06..4bbf89b9 100644 --- a/src/npc/mountainMinish.c +++ b/src/npc/mountainMinish.c @@ -4,7 +4,6 @@ * * @brief Mountain Minish NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -126,7 +125,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; @@ -135,7 +134,8 @@ void sub_08067EF0(MountainMinishEntity* this) { super->action = 3; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, 0); @@ -144,13 +144,13 @@ void sub_08067EF0(MountainMinishEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; InitializeAnimation(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); sub_08068190(super); } } break; case 2: - if ((gMessage.doTextBox & 0x7f) != 0) + if ((gMessage.state & MESSAGE_ACTIVE) != 0) break; super->action = 1; InitializeAnimation(super, (super->animationState >> 1) + 4); diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c index afe2d86f..5e09a1d0 100644 --- a/src/npc/mutoh.c +++ b/src/npc/mutoh.c @@ -5,7 +5,6 @@ * * @brief Mutoh NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "item.h" @@ -36,7 +35,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; @@ -44,8 +43,8 @@ void Mutoh(MutohEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = 2; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 4); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/nayru.c b/src/npc/nayru.c index 4b8bd979..5130dbf5 100644 --- a/src/npc/nayru.c +++ b/src/npc/nayru.c @@ -4,7 +4,6 @@ * * @brief Nayru NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "kinstone.h" #include "npc.h" @@ -27,8 +26,8 @@ void Nayru(NayruEntity* this) { super->interactType = INTERACTION_NONE; InitializeNPCFusion(super); this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { ExecuteScriptAndHandleAnimation(super, NULL); } diff --git a/src/npc/npc23.c b/src/npc/npc23.c index e3dab558..acda02d4 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -4,7 +4,6 @@ * * @brief NPC 23 */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "message.h" @@ -52,7 +51,7 @@ void sub_080662F8(NPC23Entity* this) { this->unk_80 = super->y.HALF.HI; this->unk_86 = 0; this->unk_82 = super->timer; - super->parent = &gPlayerEntity; + super->parent = &gPlayerEntity.base; this->unk_84 = 0; sub_08066490(this, super->parent); AddInteractableWhenBigObject(super); @@ -87,7 +86,7 @@ void nullsub_110(NPC23Entity* this) { void sub_080663D4(NPC23Entity* this) { if (super->x.HALF.HI == this->unk_7e - 8) { - if (gPlayerEntity.action != PLAYER_ROOM_EXIT) { + if (gPlayerEntity.base.action != PLAYER_ROOM_EXIT) { super->action = 4; super->direction = 0; super->speed = 0; @@ -101,7 +100,7 @@ void sub_080663D4(NPC23Entity* this) { } ProcessMovement0(super); } - sub_08078B48(); + PausePlayer(); GetNextFrame(super); } @@ -110,14 +109,14 @@ void sub_0806643C(NPC23Entity* this) { super->action = 5; gRoomControls.camera_target = NULL; sub_08078AC0(0x40, 0, 0); - gPlayerEntity.animationState = 0; - gPlayerEntity.direction = 0; + gPlayerEntity.base.animationState = 0; + gPlayerEntity.base.direction = 0; } GetNextFrame(super); } void sub_08066474(NPC23Entity* this) { - if (gPlayerEntity.action != PLAYER_ROOM_EXIT) { + if (gPlayerEntity.base.action != PLAYER_ROOM_EXIT) { gPauseMenuOptions.disabled = 0; } } @@ -160,9 +159,9 @@ void sub_08066490(NPC23Entity* this, Entity* entity) { bool32 sub_0806650C(NPC23Entity* this) { u32 dir = 0; - s32 px = gPlayerEntity.x.HALF_U.HI; + s32 px = gPlayerEntity.base.x.HALF_U.HI; s32 px2 = px; - s32 py = gPlayerEntity.y.HALF_U.HI; + s32 py = gPlayerEntity.base.y.HALF_U.HI; if (py < this->unk_80 + 16) { dir = 4; @@ -174,17 +173,17 @@ bool32 sub_0806650C(NPC23Entity* this) { dir = 6; } if (dir == 0) { - gPlayerEntity.speed = 0; + gPlayerEntity.base.speed = 0; } } - if (gPlayerEntity.action != PLAYER_ROOM_EXIT) { + if (gPlayerEntity.base.action != PLAYER_ROOM_EXIT) { if (dir == 0) { return 0; } sub_08078AC0(8, 0, 0); - gPlayerEntity.animationState = dir; - gPlayerEntity.direction = Direction8FromAnimationState(dir); + gPlayerEntity.base.animationState = dir; + gPlayerEntity.base.direction = Direction8FromAnimationState(dir); } return 1; } @@ -198,11 +197,11 @@ void sub_08066570(Entity* this) { return; } - if (this->action == 3 || !sub_0806FC80(this, &gPlayerEntity, 0x50)) { + if (this->action == 3 || !sub_0806FC80(this, &gPlayerEntity.base, 0x50)) { return; } - direction = GetFacingDirection(this, &gPlayerEntity); + direction = GetFacingDirection(this, &gPlayerEntity.base); cond = TRUE; dir2 = (direction & DirectionWest); diff --git a/src/npc/npc26.c b/src/npc/npc26.c index 6d5a3221..b3b5860b 100644 --- a/src/npc/npc26.c +++ b/src/npc/npc26.c @@ -4,7 +4,6 @@ * * @brief NPC 26 */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/npc4E.c b/src/npc/npc4E.c index 766c9810..dcaabee6 100644 --- a/src/npc/npc4E.c +++ b/src/npc/npc4E.c @@ -4,7 +4,6 @@ * * @brief NPC 4E */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" @@ -187,8 +186,8 @@ Item NPC4E_GetItemWithSwordUpgraded(Item itemId) { } void NPC4E_SaveEquippedItems(NPC4EEntity* this) { - this->unk_68 = gSave.stats.itemButtons[SLOT_A]; - this->unk_69 = gSave.stats.itemButtons[SLOT_B]; + this->unk_68 = gSave.stats.equipped[SLOT_A]; + this->unk_69 = gSave.stats.equipped[SLOT_B]; } void NPC4E_RestoreEquippedItems(NPC4EEntity* this) { diff --git a/src/npc/npc4F.c b/src/npc/npc4F.c index baaf9e4e..3f9450a3 100644 --- a/src/npc/npc4F.c +++ b/src/npc/npc4F.c @@ -4,7 +4,6 @@ * * @brief NPC 4F */ -#define NENT_DEPRECATED #include "npc.h" void NPC4F(Entity* this) { diff --git a/src/npc/npc5.c b/src/npc/npc5.c index 0f9535d0..b8608817 100644 --- a/src/npc/npc5.c +++ b/src/npc/npc5.c @@ -4,7 +4,6 @@ * * @brief NPC 5 */ -#define NENT_DEPRECATED #include "collision.h" #include "functions.h" #include "hitbox.h" @@ -98,7 +97,7 @@ void CreateZeldaFollower(void) { if (CheckGlobalFlag(ZELDA_CHASE) != 0) { npc = CreateNPC(ZELDA_FOLLOWER, 0, 0); if (npc != NULL) { - CopyPosition(&gPlayerEntity, npc); + CopyPosition(&gPlayerEntity.base, npc); npc->flags |= ENT_PERSIST; npc->animationState = GetAnimationState(npc); } @@ -126,8 +125,8 @@ void sub_08060A00(NPC5Entity* this) { if (super->action != 0) { if (((((UnkHeap*)super->myHeap)->unk_0) & 4) == 0) { ((UnkHeap*)super->myHeap)->unk_0 |= 4; - ((UnkHeap*)super->myHeap)->unk_5 = (gPlayerEntity.x.HALF.HI & 0xfff0) + 8; - ((UnkHeap*)super->myHeap)->unk_6 = (gPlayerEntity.y.HALF.HI & 0xfff0) + 8; + ((UnkHeap*)super->myHeap)->unk_5 = (gPlayerEntity.base.x.HALF.HI & 0xfff0) + 8; + ((UnkHeap*)super->myHeap)->unk_6 = (gPlayerEntity.base.y.HALF.HI & 0xfff0) + 8; } } } @@ -137,12 +136,12 @@ void sub_08060A00(NPC5Entity* this) { } if (super->action != 0) { - ((UnkHeap*)super->myHeap)->unk_1 = gPlayerEntity.x.HALF.HI; - ((UnkHeap*)super->myHeap)->unk_2 = gPlayerEntity.y.HALF.HI; + ((UnkHeap*)super->myHeap)->unk_1 = gPlayerEntity.base.x.HALF.HI; + ((UnkHeap*)super->myHeap)->unk_2 = gPlayerEntity.base.y.HALF.HI; } if (this->unk_74 != gRoomControls.room) { this->unk_74 = gRoomControls.room; - CopyPosition(&gPlayerEntity, super); + CopyPosition(&gPlayerEntity.base, super); super->action = 1; super->spriteSettings.draw = 1; super->speed = 0x120; @@ -184,7 +183,7 @@ void sub_08060AE0(NPC5Entity* this) { void sub_08060B5C(NPC5Entity* this) { if (sub_08061230(this) == 0) { if ((sub_08060F80(super) == 0) && - (((GetFacingDirection(super, &gPlayerEntity) + (super->animationState * -4) + 4) & 0x1f)) < 9) { + (((GetFacingDirection(super, &gPlayerEntity.base) + (super->animationState * -4) + 4) & 0x1f)) < 9) { super->action = 2; super->subtimer = 0; return; @@ -229,8 +228,8 @@ void sub_08060BA0(NPC5Entity* this) { } } else { - if (sub_08060FD0(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI) != 0) { - sub_08061090(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); + if (sub_08060FD0(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI) != 0) { + sub_08061090(this, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI); sub_08061170(this); ((UnkHeap*)super->myHeap)->unk_0 &= 0xf5; } else { @@ -259,7 +258,7 @@ void sub_08060BA0(NPC5Entity* this) { } } else { ((UnkHeap*)super->myHeap)->unk_0 &= 0xfd; - sub_08061464(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI); + sub_08061464(this, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI); } } } @@ -317,7 +316,7 @@ void sub_08060E34(NPC5Entity* this) { UpdateAnimationSingleFrame(super); if ((super->frame & ANIM_DONE) != 0) { super->action = 2; - super->animationState = DirectionToAnimationState(GetFacingDirection(super, &gPlayerEntity)) * 2; + super->animationState = DirectionToAnimationState(GetFacingDirection(super, &gPlayerEntity.base)) * 2; sub_08060E70(this, 8); } } @@ -345,7 +344,7 @@ void sub_08060EDC(NPC5Entity* this) { if (((u32)super->animIndex - 0x20 < 0x10) && ((super->frame & ANIM_DONE) == 0)) { UpdateAnimationSingleFrame(super); } else { - tmp = GetFacingDirection(super, &gPlayerEntity) + super->animationState * -4; + tmp = GetFacingDirection(super, &gPlayerEntity.base) + super->animationState * -4; if (((tmp + 3) & 0x1f) >= 7) { if ((tmp & 0x1f) < 0x10) { InitAnimationForceUpdate(super, super->animationState + 0x20); @@ -366,12 +365,12 @@ void sub_08060EDC(NPC5Entity* this) { } } u32 sub_08060F80(Entity* this) { - if (sub_08060FD0(this, (s32)gPlayerEntity.x.HALF.HI, (s32)gPlayerEntity.y.HALF.HI) == 0) { + if (sub_08060FD0(this, (s32)gPlayerEntity.base.x.HALF.HI, (s32)gPlayerEntity.base.y.HALF.HI) == 0) { return 0; } ((UnkHeap*)this->myHeap)->unk_0 &= 0xfb; - if (PointInsideRadius(gPlayerEntity.x.HALF.HI - this->x.HALF.HI, gPlayerEntity.y.HALF.HI - this->y.HALF.HI, - ((UnkHeap*)this->myHeap)->unk_0b) != 0) { + if (PointInsideRadius(gPlayerEntity.base.x.HALF.HI - this->x.HALF.HI, + gPlayerEntity.base.y.HALF.HI - this->y.HALF.HI, ((UnkHeap*)this->myHeap)->unk_0b) != 0) { return 1; } return 0; @@ -418,8 +417,8 @@ void sub_08061090(NPC5Entity* this, u32 a, u32 b) { s32 sqrDist; u32 tmp; - xDist = gPlayerEntity.x.HALF.HI - super->x.HALF.HI; - yDist = gPlayerEntity.y.HALF.HI - super->y.HALF.HI; + xDist = gPlayerEntity.base.x.HALF.HI - super->x.HALF.HI; + yDist = gPlayerEntity.base.y.HALF.HI - super->y.HALF.HI; sqrDist = (xDist * xDist) + (yDist * yDist); if (sqrDist < 0x900) { super->speed = 0x120; diff --git a/src/npc/npc58.c b/src/npc/npc58.c index 53f841f7..0d599f91 100644 --- a/src/npc/npc58.c +++ b/src/npc/npc58.c @@ -4,7 +4,6 @@ * * @brief NPC 58 */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" diff --git a/src/npc/npc9.c b/src/npc/npc9.c index 6e66716b..99fcccb9 100644 --- a/src/npc/npc9.c +++ b/src/npc/npc9.c @@ -4,7 +4,6 @@ * * @brief NPC 9 */ -#define NENT_DEPRECATED #include "entity.h" #include "message.h" #include "npc.h" @@ -51,7 +50,7 @@ void sub_08062B48(Entity* this) { } void sub_08062B70(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { InitializeAnimation(this, 2); this->action = 1; RevokePriority(this); diff --git a/src/npc/percy.c b/src/npc/percy.c index 5c6108cd..a3a04a44 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -4,7 +4,6 @@ * * @brief Percy NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" @@ -85,7 +84,7 @@ void sub_0806B41C(PercyEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; InitializeAnimation(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 4); idx = GetFuserId(super); tmp = gUnk_08001A7C[idx]; if (this->fusionOffer == 33) @@ -149,13 +148,13 @@ void sub_0806B540(Entity* this) { SetLocalFlag(0x3f); break; case 1: - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { context->unk_18 = 2; MessageNoOverlap(TEXT_INDEX(TEXT_PERCY, 0x15), this); } break; case 2: - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { context->unk_18 = 3; if (gSave.stats.hasAllFigurines != 0) { InitItemGetSequence(ITEM_RUPEE100, 0, 0); @@ -166,7 +165,7 @@ void sub_0806B540(Entity* this) { } break; case 3: - if ((gPlayerEntity.action != PLAYER_ITEMGET)) { + if ((gPlayerEntity.base.action != PLAYER_ITEMGET)) { context->wait = 0x2d; return; } diff --git a/src/npc/phonograph.c b/src/npc/phonograph.c index 469dddb5..ca74c820 100644 --- a/src/npc/phonograph.c +++ b/src/npc/phonograph.c @@ -4,7 +4,6 @@ * * @brief Phonograph NPC */ -#define NENT_DEPRECATED #include "common.h" #include "entity.h" #include "fileselect.h" diff --git a/src/npc/picolyteBottle.c b/src/npc/picolyteBottle.c index 0bb4742b..c384b53b 100644 --- a/src/npc/picolyteBottle.c +++ b/src/npc/picolyteBottle.c @@ -4,7 +4,6 @@ * * @brief Picolyte Bottle NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "hitbox.h" diff --git a/src/npc/pina.c b/src/npc/pina.c index cb73eabc..26692def 100644 --- a/src/npc/pina.c +++ b/src/npc/pina.c @@ -4,7 +4,6 @@ * * @brief Pina NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "message.h" @@ -74,7 +73,7 @@ void sub_08063AC0(Entity* this) { } void sub_08063B44(Entity* this) { - u8 tmp = gMessage.doTextBox & 0x7f; + u8 tmp = gMessage.state & MESSAGE_ACTIVE; if (tmp == 0) { this->action = 1; this->subtimer = tmp; @@ -94,8 +93,8 @@ void sub_08063B68(PinaEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 4); InitializeNPCFusion(super); } else { ExecuteScriptForEntity(super, NULL); diff --git a/src/npc/pita.c b/src/npc/pita.c index ccf79c69..804a0e38 100644 --- a/src/npc/pita.c +++ b/src/npc/pita.c @@ -4,7 +4,6 @@ * * @brief Pita NPC */ -#define NENT_DEPRECATED #include "item.h" #include "npc.h" @@ -28,7 +27,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 a81c901e..05f0d906 100644 --- a/src/npc/postman.c +++ b/src/npc/postman.c @@ -4,7 +4,6 @@ * * @brief Postman NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "npc.h" @@ -234,7 +233,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); } } } @@ -257,15 +256,15 @@ void sub_08060528(PostmanEntity* this) { super->action = 3; super->interactType = INTERACTION_NONE; InitializeNPCFusion(super); - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { if (super->interactType != INTERACTION_NONE) { super->action = 2; super->interactType = INTERACTION_NONE; sub_080606D8(super); - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { ExecuteScriptAndHandleAnimation(super, NULL); } @@ -273,7 +272,7 @@ void sub_08060528(PostmanEntity* this) { break; case 2: UpdateAnimationSingleFrame(super); - if ((gMessage.doTextBox & 0x7f) != 0) { + if ((gMessage.state & MESSAGE_ACTIVE) != 0) { break; } super->action = 1; @@ -303,7 +302,7 @@ void sub_08060528(PostmanEntity* this) { Postman_MakeInteractable(this); } if (super->z.WORD >= 0 && - ((gPlayerEntity.collisionLayer == 0 || (super->collisionLayer == gPlayerEntity.collisionLayer)))) { + ((gPlayerEntity.base.collisionLayer == 0 || (super->collisionLayer == gPlayerEntity.base.collisionLayer)))) { sub_0806ED78(super); } sub_0800451C(super); @@ -407,13 +406,13 @@ void sub_0806076C(PostmanEntity* this, ScriptExecutionContext* context) { void sub_080608E4(PostmanEntity* this, ScriptExecutionContext* context) { context->condition = 0; if (super->z.WORD >= 0) { - if ((super->collisionLayer != 1 || gPlayerEntity.collisionLayer != 2) && - (super->collisionLayer != 2 || gPlayerEntity.collisionLayer != 1)) { + if ((super->collisionLayer != 1 || gPlayerEntity.base.collisionLayer != 2) && + (super->collisionLayer != 2 || gPlayerEntity.base.collisionLayer != 1)) { const Rect* ptr = &gUnk_0810AA70[context->intVariable][super->animationState >> 1]; u32 x = super->x.HALF.HI + ptr->x; u32 y = super->y.HALF.HI + ptr->y; - x = gPlayerEntity.x.HALF.HI - x; - y = gPlayerEntity.y.HALF.HI - y; + x = gPlayerEntity.base.x.HALF.HI - x; + y = gPlayerEntity.base.y.HALF.HI - y; x += ptr->width; y += ptr->height; if (ptr->width * 2 > x && ptr->height * 2 > y) { diff --git a/src/npc/rem.c b/src/npc/rem.c index 5470b36b..d921f196 100644 --- a/src/npc/rem.c +++ b/src/npc/rem.c @@ -4,7 +4,6 @@ * * @brief Rem NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "npc.h" @@ -76,7 +75,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 +296,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 +315,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) { @@ -435,18 +434,18 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) { MessageNoOverlap(messageIndex, this); switch (context->intVariable) { case 0: - gRoomVars.entities[0] = this; + gRoomVars.puzzleEntities[0] = this; PrependEntityToList(this, NPC); this->zVelocity = Q_16_16(1.5); break; case 1: - pEnt = FindNextDuplicateID(gRoomVars.entities[0], NPC); - gRoomVars.entities[1] = pEnt; + pEnt = FindNextDuplicateID(gRoomVars.puzzleEntities[0], NPC); + gRoomVars.puzzleEntities[1] = pEnt; pEnt->zVelocity = Q_16_16(1.5); break; case 2: - pEnt = FindNextDuplicateID(gRoomVars.entities[1], NPC); - gRoomVars.entities[2] = pEnt; + pEnt = FindNextDuplicateID(gRoomVars.puzzleEntities[1], NPC); + gRoomVars.puzzleEntities[2] = pEnt; pEnt->zVelocity = Q_16_16(1.5); break; } @@ -457,7 +456,7 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) { context->unk_18 = 1; break; case 1: - pEnt = gRoomVars.entities[context->intVariable]; + pEnt = gRoomVars.puzzleEntities[context->intVariable]; if (pEnt->z.HALF.HI < 0) { break; } @@ -475,7 +474,7 @@ void sub_0806AA50(Entity* this, ScriptExecutionContext* context) { } void sub_0806AB74(Entity* this) { - gRoomVars.field_0x3 = 1; + gRoomVars.remFlagUnused = TRUE; if ((s32)(this->y.HALF.HI - (u32)gRoomControls.origin_y) < 0xa8) { this->y.HALF.HI = gRoomControls.origin_y + 0xa8; } diff --git a/src/npc/simon.c b/src/npc/simon.c index 163b12c1..24812a94 100644 --- a/src/npc/simon.c +++ b/src/npc/simon.c @@ -4,7 +4,6 @@ * * @brief Simon NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "flags.h" #include "functions.h" diff --git a/src/npc/sittingPerson.c b/src/npc/sittingPerson.c index f16d0ea0..c3da1060 100644 --- a/src/npc/sittingPerson.c +++ b/src/npc/sittingPerson.c @@ -4,7 +4,6 @@ * * @brief Sitting Person NPC */ -#define NENT_DEPRECATED #include "npc.h" #include "functions.h" @@ -152,7 +151,7 @@ void sub_080637B8(SittingPersonEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - tmp = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + tmp = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)); tmp += super->spriteSettings.flipX ? 4 : 0; InitializeAnimation(super, tmp); InitializeNPCFusion(super); diff --git a/src/npc/smallTownMinish.c b/src/npc/smallTownMinish.c index 99566202..bada8800 100644 --- a/src/npc/smallTownMinish.c +++ b/src/npc/smallTownMinish.c @@ -4,7 +4,6 @@ * * @brief Small Town Minish NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" diff --git a/src/npc/smith.c b/src/npc/smith.c index 61303812..2210dede 100644 --- a/src/npc/smith.c +++ b/src/npc/smith.c @@ -4,7 +4,6 @@ * * @brief Smith NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "npc.h" @@ -49,7 +48,7 @@ void Smith(SmithEntity* this) { super->action = 4; super->interactType = INTERACTION_NONE; index = (super->animIndex == 0xc) ? 8 : 0; - index += GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + index += GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)); InitAnimationForceUpdate(super, index); InitializeNPCFusion(super); } diff --git a/src/npc/stamp.c b/src/npc/stamp.c index 380e5be4..8051fe44 100644 --- a/src/npc/stamp.c +++ b/src/npc/stamp.c @@ -4,7 +4,6 @@ * * @brief Stamp NPC */ -#define NENT_DEPRECATED #include "effects.h" #include "entity.h" #include "functions.h" @@ -64,7 +63,7 @@ void sub_08062C24(Entity* this) { } void sub_08062C54(Entity* this) { - if ((gMessage.doTextBox & 127) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; InitializeAnimation(this, 0); RevokePriority(this); diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index 3560137b..d1971904 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -4,7 +4,6 @@ * * @brief Stockwell NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "game.h" @@ -59,7 +58,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 @@ -108,8 +107,8 @@ void sub_080650CC(StockwellEntity* this) { void sub_080651AC(StockwellEntity* this) { GetNextFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { - super->interactType = gMessage.doTextBox & 0x7f; + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { + super->interactType = gMessage.state & MESSAGE_ACTIVE; super->action = 1; InitializeAnimation(super, 4); } @@ -164,7 +163,7 @@ void sub_0806528C(Entity* this) { } void sub_080652B0(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->subAction++; this->timer = 10; gRoomVars.animFlags = this->subtimer; @@ -176,7 +175,7 @@ void sub_080652E4(Entity* this) { if (this->timer != 0) { this->timer--; } else { - if (gPlayerEntity.action != PLAYER_ITEMGET) { + if (gPlayerEntity.base.action != PLAYER_ITEMGET) { this->subAction++; MessageNoOverlap(TEXT_INDEX(TEXT_STOCKWELL, 0x19), this); } @@ -184,16 +183,16 @@ void sub_080652E4(Entity* this) { } void sub_08065314(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->subAction++; MenuFadeIn(3, 3); } } void sub_08065338(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { this->action = 1; - this->subAction = gMessage.doTextBox & 0x7f; + this->subAction = gMessage.state & MESSAGE_ACTIVE; gRoomVars.animFlags = this->subtimer; InitializeAnimation(this, 4); } diff --git a/src/npc/sturgeon.c b/src/npc/sturgeon.c index 6367bf76..b48d2ec6 100644 --- a/src/npc/sturgeon.c +++ b/src/npc/sturgeon.c @@ -4,7 +4,6 @@ * * @brief Sturgeon NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" @@ -65,8 +64,8 @@ void Sturgeon(SturgeonEntity* this) { if (super->interactType == INTERACTION_FUSE) { super->action = super->action | 0xff; super->interactType = INTERACTION_NONE; - InitAnimationForceUpdate(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitAnimationForceUpdate( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); @@ -127,7 +126,7 @@ void sub_08064B88(SturgeonEntity* this) { } void sub_08064C2C(SturgeonEntity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; InitializeAnimation(super, (u32)super->subtimer); } diff --git a/src/npc/syrup.c b/src/npc/syrup.c index ae1f8eb1..60083964 100644 --- a/src/npc/syrup.c +++ b/src/npc/syrup.c @@ -4,7 +4,6 @@ * * @brief Syrup NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "npc.h" #include "object.h" @@ -48,7 +47,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/talon.c b/src/npc/talon.c index 4b62dd22..ddcd1977 100644 --- a/src/npc/talon.c +++ b/src/npc/talon.c @@ -4,7 +4,6 @@ * * @brief Talon NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "npc.h" @@ -119,7 +118,7 @@ void sub_08065680(TalonEntity* this) { } void sub_080656A4(TalonEntity* this) { - if ((gMessage.doTextBox & 0x7F) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = this->unk_69; InitAnimationForceUpdate(super, this->unk_6a); } @@ -153,7 +152,7 @@ void sub_080656D4(TalonEntity* this) { void sub_0806574C(TalonEntity* this) { u32 j; - j = (super->animIndex & ~3) + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)); + j = (super->animIndex & ~3) + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)); if (super->animIndex != j) { InitAnimationForceUpdate(super, j); } diff --git a/src/npc/teachers.c b/src/npc/teachers.c index 52ea9b4f..89953855 100644 --- a/src/npc/teachers.c +++ b/src/npc/teachers.c @@ -4,7 +4,6 @@ * * @brief Teachers NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "player.h" @@ -30,7 +29,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; @@ -39,8 +38,8 @@ void Teachers(TeachersEntity* this) { super->action = 2; super->interactType = INTERACTION_NONE; this->animIndex = super->animIndex; - InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4( - GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4(GetFacingDirection( + super, &gPlayerEntity.base))); InitializeNPCFusion(super); } else { ExecuteScriptAndHandleAnimation(super, NULL); diff --git a/src/npc/tingleSiblings.c b/src/npc/tingleSiblings.c index cd113f45..75abc4db 100644 --- a/src/npc/tingleSiblings.c +++ b/src/npc/tingleSiblings.c @@ -4,7 +4,6 @@ * * @brief Tingle Siblings NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "item.h" @@ -71,7 +70,7 @@ void sub_08064DE4(Entity* this) { this->action = 2; this->interactType = INTERACTION_NONE; InitAnimationForceUpdate(this, - GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity))); + GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity.base))); InitializeNPCFusion(this); } else { ExecuteScriptAndHandleAnimation(this, NULL); diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c index a55e609c..d2ea2da9 100644 --- a/src/npc/townMinish.c +++ b/src/npc/townMinish.c @@ -4,7 +4,6 @@ * * @brief Town Minish NPC */ -#define NENT_DEPRECATED #include "asm.h" #include "entity.h" #include "functions.h" @@ -187,7 +186,7 @@ void sub_0806ABFC(TownMinishEntity* this) { void sub_0806AC3C(TownMinishEntity* this) { if (super->animIndex <= 3) { s32 unk; - Entity* link = &gPlayerEntity; + Entity* link = &gPlayerEntity.base; if (EntityInRectRadius(super, link, 0x18, 0x18)) { unk = GetFacingDirection(super, link) & 0x1e; } else { @@ -241,18 +240,18 @@ void sub_0806ACC4(TownMinishEntity* this) { if (super->type2 == 10 && super->interactType) { super->action = 2; super->interactType = INTERACTION_NONE; - InitializeAnimation(super, - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 8); + InitializeAnimation( + super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base)) + 8); sub_0806AFE8(super, this->context); } if (super->type == 1) { - u8 idx = gPlayerEntity.animationState >> 1; + u8 idx = gPlayerEntity.base.animationState >> 1; SetInteractableObjectCollision(super, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]); } } break; case 2: - if (gMessage.doTextBox & 0x7f) + if (gMessage.state & MESSAGE_ACTIVE) break; super->action = 1; diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c index 9feb45ea..8f8b34f1 100644 --- a/src/npc/townsperson.c +++ b/src/npc/townsperson.c @@ -4,7 +4,6 @@ * * @brief Townsperson NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "item.h" #include "npc.h" @@ -132,7 +131,7 @@ void sub_08061D64(TownspersonEntity* this) { InitializeNPCFusion(super); this->unk_69 = super->animIndex; InitializeAnimation(super, (super->animIndex & -4) + - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity.base))); } else { ExecuteScriptForEntity(super, NULL); HandleEntity0x82Actions(super); @@ -145,15 +144,15 @@ void sub_08061D64(TownspersonEntity* this) { super->interactType = INTERACTION_NONE; sub_08062048(super); this->unk_69 = super->animIndex; - InitializeAnimation(super, (super->animIndex & -4) + - GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity))); + InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4( + GetFacingDirection(super, &gPlayerEntity.base))); } } } void sub_08061E24(TownspersonEntity* this) { GetNextFrame(super); - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { super->action = 1; InitializeAnimation(super, this->unk_69); } diff --git a/src/npc/vaati.c b/src/npc/vaati.c index f55e285f..d272f3d8 100644 --- a/src/npc/vaati.c +++ b/src/npc/vaati.c @@ -4,7 +4,6 @@ * * @brief Vaati NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "functions.h" #include "script.h" @@ -42,7 +41,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/vaatiReborn.c b/src/npc/vaatiReborn.c index 5e80be89..82c349be 100644 --- a/src/npc/vaatiReborn.c +++ b/src/npc/vaatiReborn.c @@ -4,7 +4,6 @@ * * @brief Vaati Reborn NPC */ -#define NENT_DEPRECATED #include "functions.h" #include "npc.h" diff --git a/src/npc/wheaton.c b/src/npc/wheaton.c index aa24f321..41eb8ac9 100644 --- a/src/npc/wheaton.c +++ b/src/npc/wheaton.c @@ -4,7 +4,6 @@ * * @brief Wheaton NPC */ -#define NENT_DEPRECATED #include "npc.h" void Wheaton(Entity* this) { @@ -12,7 +11,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/windTribespeople.c b/src/npc/windTribespeople.c index 41eb3567..521e850b 100644 --- a/src/npc/windTribespeople.c +++ b/src/npc/windTribespeople.c @@ -4,7 +4,6 @@ * * @brief Wind Tribespeople NPC */ -#define NENT_DEPRECATED #include "entity.h" #include "npc.h" #include "sound.h" @@ -78,7 +77,7 @@ void sub_0806C7D4(Entity* this) { } void sub_0806C834(Entity* this) { - if ((gMessage.doTextBox & 0x7f) == 0) { + if ((gMessage.state & MESSAGE_ACTIVE) == 0) { --this->action; InitializeAnimation(this, (this->animationState / 2) + 4); } diff --git a/src/npc/zelda.c b/src/npc/zelda.c index 629d8ab2..3ac84635 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -4,7 +4,6 @@ * * @brief Zelda NPC */ -#define NENT_DEPRECATED #include "npc/zelda.h" #include "entity.h" #include "flags.h" @@ -32,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); } @@ -81,7 +80,7 @@ void sub_08066D94(Entity* this) { SetGlobalFlag(ZELDA_CHASE); npc = (ZeldaFollowerEntity*)CreateNPC(ZELDA_FOLLOWER, 0, 0); if (npc != NULL) { - npc->base.animationState = gPlayerEntity.animationState; + npc->base.animationState = gPlayerEntity.base.animationState; npc->base.flags |= ENT_PERSIST; npc->base.animationState = GetAnimationState(this); room = gRoomControls.room; diff --git a/src/npc/zeldaFollower.c b/src/npc/zeldaFollower.c index fd9c71d9..1fe5f067 100644 --- a/src/npc/zeldaFollower.c +++ b/src/npc/zeldaFollower.c @@ -4,7 +4,6 @@ * * @brief Zelda Follower NPC */ -#define NENT_DEPRECATED #include "npc/zelda.h" #include "common.h" #include "entity.h" @@ -51,7 +50,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); } @@ -72,19 +71,19 @@ void sub_08068318(ZeldaFollowerEntity* this) { ZeldaFollowerItem* heapPtr; ZeldaFollowerItem item; - item.FIELDS.x = gPlayerEntity.x.HALF_U.HI; - item.FIELDS.y = gPlayerEntity.y.HALF_U.HI; - item.FIELDS.z = gPlayerEntity.z.HALF_U.HI; + item.FIELDS.x = gPlayerEntity.base.x.HALF_U.HI; + item.FIELDS.y = gPlayerEntity.base.y.HALF_U.HI; + item.FIELDS.z = gPlayerEntity.base.z.HALF_U.HI; item.FIELDS.framestate = gPlayerState.framestate; - item.FIELDS.animationState = gPlayerEntity.animationState; - item.FIELDS.collisionLayer = gPlayerEntity.collisionLayer; + item.FIELDS.animationState = gPlayerEntity.base.animationState; + item.FIELDS.collisionLayer = gPlayerEntity.base.collisionLayer; heapPtr = super->myHeap; if ((heapPtr->FIELDS.framestate == 0xa && item.FIELDS.framestate != 0xa) || (heapPtr->FIELDS.framestate == 0x16 && item.FIELDS.framestate != 0x16)) { - super->x.HALF.HI = gPlayerEntity.x.HALF.HI; - super->y.HALF.HI = gPlayerEntity.y.HALF.HI; + super->x.HALF.HI = gPlayerEntity.base.x.HALF.HI; + super->y.HALF.HI = gPlayerEntity.base.y.HALF.HI; super->spriteSettings.draw = 1; sub_08068578(super); } @@ -107,7 +106,7 @@ void sub_08068318(ZeldaFollowerEntity* this) { ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(super, heapPtr); animIndex = 0x4; } else { - dist = sub_080041E8(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, (u16)heapPtr->FIELDS.x, + dist = sub_080041E8(gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, (u16)heapPtr->FIELDS.x, (u16)heapPtr->FIELDS.y); dist = ((u32)dist) >> 0x4; if (dist > 0x18) { @@ -188,17 +187,17 @@ void sub_08068578(Entity* this) { // first u32 (r5) #ifdef REWRITE_CODE - r0 = gPlayerEntity.x.HALF_U.HI | (r5 & 0xffff0000); - r5 = (gPlayerEntity.y.HALF_U.HI << 0x10) | (r0 & 0x0000ffff); + r0 = gPlayerEntity.base.x.HALF_U.HI | (r5 & 0xffff0000); + r5 = (gPlayerEntity.base.y.HALF_U.HI << 0x10) | (r0 & 0x0000ffff); #else - r1 = gPlayerEntity.x.HALF_U.HI; + r1 = gPlayerEntity.base.x.HALF_U.HI; r3 = 0xffff0000; r0 = r3; r0 &= r5; r0 |= r1; - r1 = gPlayerEntity.y.HALF_U.HI; + r1 = gPlayerEntity.base.y.HALF_U.HI; r1 <<= 0x10; r2 = 0xffff; r0 &= r2; @@ -208,12 +207,12 @@ void sub_08068578(Entity* this) { // second u32 (r6) #ifdef REWRITE_CODE - r3 = gPlayerEntity.z.HALF_U.HI | (r6 & 0xffff0000); + r3 = gPlayerEntity.base.z.HALF_U.HI | (r6 & 0xffff0000); r2 = (gPlayerState.framestate << 0x10) | (r3 & 0xff00ffff); - r0 = ((gPlayerEntity.animationState & 0x3f) << 0x18) | (r2 & 0xc0ffffff); - r6 = (gPlayerEntity.collisionLayer << 0x1e) | (r0 & 0x3fffffff); + r0 = ((gPlayerEntity.base.animationState & 0x3f) << 0x18) | (r2 & 0xc0ffffff); + r6 = (gPlayerEntity.base.collisionLayer << 0x1e) | (r0 & 0x3fffffff); #else - r0 = gPlayerEntity.z.HALF_U.HI; + r0 = gPlayerEntity.base.z.HALF_U.HI; r3 &= r6; r3 |= r0; @@ -223,7 +222,7 @@ void sub_08068578(Entity* this) { r2 &= r3; r2 |= r0; - r1 = gPlayerEntity.animationState; + r1 = gPlayerEntity.base.animationState; r0 = 0x3f; r1 &= r0; r1 <<= 0x18; @@ -231,8 +230,8 @@ void sub_08068578(Entity* this) { r0 &= r2; r0 |= r1; - // gPlayerEntity is now at r1 - r1 = gPlayerEntity.collisionLayer; + // gPlayerEntity.base.is now at r1 + r1 = gPlayerEntity.base.collisionLayer; r1 <<= 0x1e; r2 = 0x3fffffff; r0 &= r2; @@ -241,18 +240,18 @@ void sub_08068578(Entity* this) { #endif #ifdef REWRITE_CODE - r10 = gPlayerEntity.x.HALF.HI - this->x.HALF.HI; + r10 = gPlayerEntity.base.x.HALF.HI - this->x.HALF.HI; #else - r1 = gPlayerEntity.x.HALF.HI; + r1 = gPlayerEntity.base.x.HALF.HI; r0 = this->x.HALF.HI; r0 = r1 - r0; r10 = r0; #endif #ifdef REWRITE_CODE - r8 = gPlayerEntity.y.HALF.HI - this->y.HALF.HI; + r8 = gPlayerEntity.base.y.HALF.HI - this->y.HALF.HI; #else - r1 = gPlayerEntity.y.HALF.HI; + r1 = gPlayerEntity.base.y.HALF.HI; r0 = this->y.HALF.HI; r0 = r1 - r0; r8 = r0; |
