mirror of
https://github.com/zeldaret/tmc
synced 2026-06-21 08:31:55 -04:00
Create new entity structs for NPCs
This commit is contained in:
+35
-33
@@ -28,7 +28,7 @@ extern u8 gzHeap[0x1000];
|
||||
extern u32 gUnk_0201AEE0[0x800];
|
||||
extern s16 gUnk_02018EE0[];
|
||||
|
||||
extern void (*const gUnk_080C9CAC[])(void);
|
||||
extern void (*const gFuseActions[])(void);
|
||||
|
||||
static void StoreKeyInput(Input* input, u32 keyInput);
|
||||
void ClearOAM(void);
|
||||
@@ -619,69 +619,71 @@ bool32 IsRoomVisited(TileEntity* tileEntity, u32 bank) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_0801DFB4(Entity* entity, u32 textIndex, u32 a3, u32 a4) {
|
||||
void InitializeFuseInfo(Entity* entity, u32 textIndex, u32 cancelledTextIndex, u32 fusingTextIndex) {
|
||||
MemClear(&gFuseInfo, sizeof(gFuseInfo));
|
||||
gFuseInfo.textIndex = textIndex;
|
||||
gFuseInfo._8 = a3;
|
||||
gFuseInfo._a = a4;
|
||||
gFuseInfo.ent = entity;
|
||||
gFuseInfo.cancelledTextIndex = cancelledTextIndex;
|
||||
gFuseInfo.fusingTextIndex = fusingTextIndex;
|
||||
gFuseInfo.entity = entity;
|
||||
gFuseInfo.kinstoneId = gPossibleInteraction.kinstoneId;
|
||||
if (entity != NULL) {
|
||||
gFuseInfo.prevUpdatePriority = entity->updatePriority;
|
||||
entity->updatePriority = 2;
|
||||
}
|
||||
gFuseInfo._0 = 0;
|
||||
gFuseInfo.fusionState = FUSION_STATE_0;
|
||||
}
|
||||
|
||||
u32 sub_0801E00C(void) {
|
||||
gUnk_080C9CAC[gFuseInfo.action]();
|
||||
return gFuseInfo._0;
|
||||
// returns the fusion state
|
||||
u32 PerformFuseAction(void) {
|
||||
gFuseActions[gFuseInfo.action]();
|
||||
return gFuseInfo.fusionState;
|
||||
}
|
||||
|
||||
void sub_0801E02C(void) {
|
||||
void Fuse_Action0(void) {
|
||||
MessageFromFusionTarget(gFuseInfo.textIndex);
|
||||
gFuseInfo._0 = 3;
|
||||
gFuseInfo.fusionState = FUSION_STATE_3;
|
||||
gFuseInfo.action = 1;
|
||||
}
|
||||
|
||||
void sub_0801E044(void) {
|
||||
void Fuse_Action1(void) {
|
||||
if ((gMessage.doTextBox & 0x7F) == 0) {
|
||||
MenuFadeIn(4, 0);
|
||||
gFuseInfo._0 = 4;
|
||||
gFuseInfo.fusionState = FUSION_STATE_4;
|
||||
gFuseInfo.action = 2;
|
||||
SoundReq(SFX_6B);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0801E074(void) {
|
||||
u32 tmp;
|
||||
switch (gFuseInfo._0) {
|
||||
case 5:
|
||||
tmp = gFuseInfo._8;
|
||||
// Waits until FUSION_STATE_5 or FUSION_STATE_6 is reached and displays the corresponding message.
|
||||
void Fuse_Action2(void) {
|
||||
u32 textIndex;
|
||||
switch (gFuseInfo.fusionState) {
|
||||
case FUSION_STATE_5:
|
||||
textIndex = gFuseInfo.cancelledTextIndex;
|
||||
break;
|
||||
case 6:
|
||||
tmp = gFuseInfo._a;
|
||||
case FUSION_STATE_6:
|
||||
textIndex = gFuseInfo.fusingTextIndex;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
MessageFromFusionTarget(tmp);
|
||||
MessageFromFusionTarget(textIndex);
|
||||
gFuseInfo.action = 3;
|
||||
}
|
||||
|
||||
void sub_0801E0A0(void) {
|
||||
void Fuse_Action3(void) {
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
if (gFuseInfo.ent != NULL) {
|
||||
gFuseInfo.ent->updatePriority = gFuseInfo.prevUpdatePriority;
|
||||
if (gFuseInfo.entity != NULL) {
|
||||
gFuseInfo.entity->updatePriority = gFuseInfo.prevUpdatePriority;
|
||||
}
|
||||
gFuseInfo._0 = gFuseInfo._0 == 6 ? 2 : 1;
|
||||
gFuseInfo.fusionState = gFuseInfo.fusionState == FUSION_STATE_6 ? FUSION_STATE_2 : FUSION_STATE_1;
|
||||
}
|
||||
}
|
||||
|
||||
void MessageFromFusionTarget(u32 textIndex) {
|
||||
if (textIndex != 0) {
|
||||
if (gFuseInfo.ent != NULL) {
|
||||
MessageNoOverlap(textIndex, gFuseInfo.ent);
|
||||
if (gFuseInfo.entity != NULL) {
|
||||
MessageNoOverlap(textIndex, gFuseInfo.entity);
|
||||
} else {
|
||||
MessageFromTarget(textIndex);
|
||||
}
|
||||
@@ -841,7 +843,7 @@ void NotifyFusersOnFusionDone(KinstoneId kinstoneId) {
|
||||
gSave.fuserOffers[index] = KINSTONE_NEEDS_REPLACEMENT;
|
||||
}
|
||||
}
|
||||
tmp = GetFuserId(gFuseInfo.ent);
|
||||
tmp = GetFuserId(gFuseInfo.entity);
|
||||
if ((tmp - 1 < 0x7f) && (gSave.fuserOffers[tmp] == KINSTONE_NEEDS_REPLACEMENT)) {
|
||||
gSave.fuserOffers[tmp] = KINSTONE_JUST_FUSED;
|
||||
}
|
||||
@@ -1118,11 +1120,11 @@ const struct_080C9C6C gUnk_080C9C6C[] = {
|
||||
{ 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 }, { 1, 3, 3 },
|
||||
};
|
||||
|
||||
void (*const gUnk_080C9CAC[])(void) = {
|
||||
sub_0801E02C,
|
||||
sub_0801E044,
|
||||
sub_0801E074,
|
||||
sub_0801E0A0,
|
||||
void (*const gFuseActions[])(void) = {
|
||||
Fuse_Action0,
|
||||
Fuse_Action1,
|
||||
Fuse_Action2,
|
||||
Fuse_Action3,
|
||||
};
|
||||
|
||||
// TODO merge
|
||||
|
||||
@@ -361,7 +361,7 @@ void sub_08028F0C(Entity* this) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 8;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
InitializeNPCFusion(this);
|
||||
} else if (this->interactType != 0) {
|
||||
u16 dialog;
|
||||
const struct SalesOffering* offer = (const struct SalesOffering*)this->field_0x7c.WORD;
|
||||
|
||||
@@ -75,7 +75,7 @@ void sub_08045C3C(BusinessScrubPrologueEntity* this) {
|
||||
sub_08046030(this, 0);
|
||||
sub_08095C48(super);
|
||||
StartCutscene(super, script_BusinessScrubIntro);
|
||||
sub_0807DD50(super);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
|
||||
void sub_08045CA4(BusinessScrubPrologueEntity* this) {
|
||||
@@ -200,7 +200,7 @@ void sub_08045E14(BusinessScrubPrologueEntity* this) {
|
||||
}
|
||||
|
||||
void sub_08045EC8(BusinessScrubPrologueEntity* this) {
|
||||
sub_0807DD94(super, 0);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
|
||||
void sub_08045ED4(BusinessScrubPrologueEntity* this) {
|
||||
|
||||
+1
-1
@@ -1128,7 +1128,7 @@ void sub_0802E300(GleerokEntity* this) {
|
||||
|
||||
this->unk_79 &= ~0x80;
|
||||
heap = this->unk_84;
|
||||
dir = sub_0806F5A4(GetFacingDirection(super, &gPlayerEntity)) << 3;
|
||||
dir = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) << 3;
|
||||
index = 0;
|
||||
ptr2 = &this->unk_80;
|
||||
tmp = 0;
|
||||
|
||||
@@ -229,7 +229,7 @@ void KinstoneMenu_Type1(void) {
|
||||
void KinstoneMenu_Type2(void) {
|
||||
const KinstoneWorldEvent* ptr;
|
||||
if (gMenu.column_idx == 6) {
|
||||
gFuseInfo._0 = 6;
|
||||
gFuseInfo.fusionState = FUSION_STATE_6;
|
||||
ptr = &gKinstoneWorldEvents[gFuseInfo.kinstoneId];
|
||||
if (ptr->subtask != 0) {
|
||||
MenuFadeIn(ptr->subtask, ptr->worldEventId);
|
||||
@@ -237,7 +237,7 @@ void KinstoneMenu_Type2(void) {
|
||||
Subtask_Exit();
|
||||
}
|
||||
} else {
|
||||
gFuseInfo._0 = 5;
|
||||
gFuseInfo.fusionState = FUSION_STATE_5;
|
||||
Subtask_Exit();
|
||||
}
|
||||
}
|
||||
@@ -625,9 +625,9 @@ u32 KinstoneMenu_080A4494(void) {
|
||||
psVar1->unk1 = 0;
|
||||
sub_080A44E0(psVar1, gSave.name, 0x80);
|
||||
#if NON_MATCHING
|
||||
ret = sub_080A44E0(psVar1, GetFuserId(gFuseInfo.ent) >> 0x20, 0xa0);
|
||||
ret = sub_080A44E0(psVar1, GetFuserId(gFuseInfo.entity) >> 0x20, 0xa0);
|
||||
#else
|
||||
GetFuserId(gFuseInfo.ent);
|
||||
GetFuserId(gFuseInfo.entity);
|
||||
asm("" : "=r"(r1));
|
||||
ret = sub_080A44E0(psVar1, r1, 0xa0);
|
||||
#endif
|
||||
@@ -652,13 +652,13 @@ u32 sub_080A44E0(WStruct* param_1, u8* param_2, u32 param_3) {
|
||||
void KinstoneMenu_080A4528(void) {
|
||||
Entity* entity;
|
||||
|
||||
if (gFuseInfo.ent->kind == NPC) {
|
||||
entity = CreateNPC(gFuseInfo.ent->id, gFuseInfo.ent->type, gFuseInfo.ent->type2);
|
||||
if (gFuseInfo.entity->kind == NPC) {
|
||||
entity = CreateNPC(gFuseInfo.entity->id, gFuseInfo.entity->type, gFuseInfo.entity->type2);
|
||||
} else {
|
||||
if (gFuseInfo.ent->kind != ENEMY) {
|
||||
if (gFuseInfo.entity->kind != ENEMY) {
|
||||
return;
|
||||
}
|
||||
entity = CreateEnemy(gFuseInfo.ent->id, gFuseInfo.ent->type);
|
||||
entity = CreateEnemy(gFuseInfo.entity->id, gFuseInfo.entity->type);
|
||||
}
|
||||
if (entity != NULL) {
|
||||
if (entity->kind == NPC) {
|
||||
|
||||
+30
-24
@@ -4,47 +4,53 @@
|
||||
*
|
||||
* @brief Anju NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "player.h"
|
||||
|
||||
void Anju(Entity* this) {
|
||||
switch (this->action) {
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} AnjuEntity;
|
||||
|
||||
void Anju(AnjuEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->animationState = this->timer;
|
||||
sub_0807DD50(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->animationState = super->timer;
|
||||
InitScriptForNPC(super);
|
||||
return;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitializeAnimation(this,
|
||||
(this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4(
|
||||
GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
return;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
if (UpdateFuseInteraction(super)) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Anju_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Anju_MakeInteractable(AnjuEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Anju_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.draw = 1;
|
||||
InitAnimationForceUpdate(this, 6);
|
||||
void Anju_Fusion(AnjuEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
super->spriteSettings.draw = 1;
|
||||
InitAnimationForceUpdate(super, 6);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
}
|
||||
|
||||
+29
-28
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Beedle NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "game.h"
|
||||
@@ -19,10 +20,10 @@ typedef struct {
|
||||
u8 unused[3];
|
||||
} InteractCollisionData;
|
||||
|
||||
void sub_080632E0(Entity* this);
|
||||
void sub_08063314(Entity* this);
|
||||
void sub_0806336C(Entity* this);
|
||||
void sub_08063390(Entity* this);
|
||||
void Beedle_Init(Entity* this);
|
||||
void Beedle_Action1(Entity* this);
|
||||
void Beedle_Action2(Entity* this);
|
||||
void Beedle_Action3(Entity* this);
|
||||
|
||||
static const u8 gBeedleItems[] = {
|
||||
ITEM_NONE,
|
||||
@@ -46,30 +47,30 @@ static const SpriteLoadData gUnk_0810C8D4[] = {
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
|
||||
void sub_080632C8(Entity* this);
|
||||
void Beedle_Update(Entity* this);
|
||||
void sub_08063410(Entity* this);
|
||||
s32 sub_080633C8(Entity* this);
|
||||
s32 Beedle_GetAnimIndexFacingPlayer(Entity* this);
|
||||
void sub_0806346C(Entity* this);
|
||||
|
||||
void Beedle(Entity* this) {
|
||||
if (this->flags & ENT_SCRIPTED) {
|
||||
sub_08063410(this);
|
||||
} else {
|
||||
sub_080632C8(this);
|
||||
Beedle_Update(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080632C8(Entity* this) {
|
||||
static void (*const gUnk_0810C8E0[])(Entity*) = {
|
||||
sub_080632E0,
|
||||
sub_08063314,
|
||||
sub_0806336C,
|
||||
sub_08063390,
|
||||
void Beedle_Update(Entity* this) {
|
||||
static void (*const beedleActions[])(Entity*) = {
|
||||
Beedle_Init,
|
||||
Beedle_Action1,
|
||||
Beedle_Action2,
|
||||
Beedle_Action3,
|
||||
};
|
||||
gUnk_0810C8E0[this->action](this);
|
||||
beedleActions[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080632E0(Entity* this) {
|
||||
void Beedle_Init(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, gUnk_0810C8D4)) {
|
||||
InitializeAnimation(this, 0);
|
||||
AddInteractableWhenBigObject(this);
|
||||
@@ -78,11 +79,12 @@ void sub_080632E0(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063314(Entity* this) {
|
||||
u32 offset;
|
||||
void Beedle_Action1(Entity* this) {
|
||||
u32 animIndex;
|
||||
|
||||
if (((++this->subtimer & 0xF) == 0) && (offset = sub_080633C8(this), this->animIndex != offset)) {
|
||||
InitializeAnimation(this, offset);
|
||||
if (((++this->subtimer & 0xF) == 0) &&
|
||||
(animIndex = Beedle_GetAnimIndexFacingPlayer(this), this->animIndex != animIndex)) {
|
||||
InitializeAnimation(this, animIndex);
|
||||
}
|
||||
if (this->interactType != 0) {
|
||||
MessageFromTarget(this->timer + TEXT_INDEX(TEXT_EMPTY, 0x01));
|
||||
@@ -91,14 +93,14 @@ void sub_08063314(Entity* this) {
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
void sub_0806336C(Entity* this) {
|
||||
void Beedle_Action2(Entity* this) {
|
||||
if ((gMessage.doTextBox & 0x7F) == 0) {
|
||||
this->action++;
|
||||
InitializeAnimation(this, 8);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063390(Entity* this) {
|
||||
void Beedle_Action3(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frame & ANIM_DONE) {
|
||||
this->action = 1;
|
||||
@@ -108,14 +110,13 @@ void sub_08063390(Entity* this) {
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
s32 sub_080633C8(Entity* this) {
|
||||
s32 uVar1;
|
||||
|
||||
uVar1 = GetAnimationStateInRectRadius(this, 0x20, 0x20);
|
||||
if (uVar1 < 0) {
|
||||
uVar1 = this->animIndex;
|
||||
// If the player is inside a 32x32 rect, face the player. Otherwise keep facing the same direction.
|
||||
s32 Beedle_GetAnimIndexFacingPlayer(Entity* this) {
|
||||
s32 animationState = GetAnimationStateInRectRadius(this, 32, 32);
|
||||
if (animationState < 0) {
|
||||
animationState = this->animIndex;
|
||||
}
|
||||
return uVar1;
|
||||
return animationState;
|
||||
}
|
||||
|
||||
void Beedle_Head(Entity* this) {
|
||||
|
||||
+157
-152
@@ -4,12 +4,18 @@
|
||||
*
|
||||
* @brief BigGoron NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "hitbox.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
#include "screen.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u16 originalX;
|
||||
} BigGoronEntity;
|
||||
|
||||
static const u16 goronSounds[] = {
|
||||
SFX_VO_GORON1,
|
||||
SFX_VO_GORON2,
|
||||
@@ -20,19 +26,18 @@ static const u16 goronSounds[] = {
|
||||
extern u8 gMapDataTopSpecial[];
|
||||
extern u8 gUnk_02006F00[];
|
||||
|
||||
void sub_0806D520(Entity*, u32);
|
||||
void sub_0806D41C(Entity*);
|
||||
void sub_0806CF30(Entity*);
|
||||
void sub_0806D1D0(Entity*);
|
||||
void sub_0806D274(Entity*);
|
||||
void sub_0806D348(Entity*);
|
||||
void sub_0806D3C0(Entity*);
|
||||
void sub_0806D41C(Entity*);
|
||||
void sub_0806D4F0(Entity*);
|
||||
void sub_0806D4FC(Entity*);
|
||||
void sub_0806D508(Entity*);
|
||||
void sub_0806D514(Entity*);
|
||||
void sub_0806D40C(Entity*);
|
||||
void sub_0806D520(BigGoronEntity* this, u32);
|
||||
void sub_0806CF30(BigGoronEntity* this);
|
||||
void sub_0806D1D0(BigGoronEntity* this);
|
||||
void sub_0806D274(BigGoronEntity* this);
|
||||
void sub_0806D348(BigGoronEntity* this);
|
||||
void sub_0806D3C0(BigGoronEntity* this);
|
||||
void sub_0806D41C(BigGoronEntity* this);
|
||||
void sub_0806D4F0(BigGoronEntity* this);
|
||||
void sub_0806D4FC(BigGoronEntity* this);
|
||||
void sub_0806D508(BigGoronEntity* this);
|
||||
void sub_0806D514(BigGoronEntity* this);
|
||||
void sub_0806D40C(BigGoronEntity* this);
|
||||
|
||||
static void sub_0806D02C(Entity* this);
|
||||
|
||||
@@ -54,7 +59,7 @@ void sub_0806D164(Entity* this);
|
||||
|
||||
Entity* sub_0806D00C(Entity* this);
|
||||
|
||||
void sub_0806D4C0(Entity*, u32);
|
||||
void sub_0806D4C0(BigGoronEntity* this, u32 type);
|
||||
|
||||
typedef struct {
|
||||
s8 type;
|
||||
@@ -63,51 +68,51 @@ typedef struct {
|
||||
u8 direction;
|
||||
} struct_08114104;
|
||||
|
||||
void BigGoron(Entity* this) {
|
||||
static void (*const typeFunctions[])(Entity*) = {
|
||||
void BigGoron(BigGoronEntity* this) {
|
||||
static void (*const typeFunctions[])(BigGoronEntity*) = {
|
||||
sub_0806CF30, sub_0806D1D0, sub_0806D274, sub_0806D348, sub_0806D3C0, sub_0806D41C,
|
||||
sub_0806D4F0, sub_0806D4FC, sub_0806D508, sub_0806D514, sub_0806D40C,
|
||||
};
|
||||
typeFunctions[this->type](this);
|
||||
typeFunctions[super->type](this);
|
||||
}
|
||||
|
||||
void sub_0806CF30(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->subAction = 1;
|
||||
this->field_0x68.HWORD = this->x.HALF.HI;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0806D0B0(this);
|
||||
sub_0807DD64(this);
|
||||
void sub_0806CF30(BigGoronEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
super->subAction = 1;
|
||||
this->originalX = super->x.HALF.HI;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
sub_0806D0B0(super);
|
||||
sub_0807DD64(super);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
}
|
||||
|
||||
switch (this->subAction) {
|
||||
switch (super->subAction) {
|
||||
case 0:
|
||||
case 1:
|
||||
if (gRoomTransition.frameCount % 4 == 0) {
|
||||
if (gPlayerEntity.x.HALF.HI < this->x.HALF.HI && this->field_0x68.HWORD - 32 < this->x.HALF.HI) {
|
||||
this->x.HALF.HI--;
|
||||
if (gPlayerEntity.x.HALF.HI < super->x.HALF.HI && this->originalX - 32 < super->x.HALF.HI) {
|
||||
super->x.HALF.HI--;
|
||||
}
|
||||
if (gPlayerEntity.x.HALF.HI > this->x.HALF.HI && this->field_0x68.HWORD + 32 > this->x.HALF.HI) {
|
||||
this->x.HALF.HI++;
|
||||
if (gPlayerEntity.x.HALF.HI > super->x.HALF.HI && this->originalX + 32 > super->x.HALF.HI) {
|
||||
super->x.HALF.HI++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (--this->timer == 0) {
|
||||
if (--super->timer == 0) {
|
||||
u32 uVar2 = Random();
|
||||
SoundReq(goronSounds[uVar2 % 4]);
|
||||
this->timer = ((u8)uVar2 & 7) * 16;
|
||||
this->timer += 128;
|
||||
super->timer = ((u8)uVar2 & 7) * 16;
|
||||
super->timer += 128;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
}
|
||||
sub_0806D02C(this);
|
||||
sub_0806D02C(super);
|
||||
}
|
||||
|
||||
Entity* sub_0806D00C(Entity* this) {
|
||||
@@ -198,228 +203,228 @@ void sub_0806D164(Entity* this) {
|
||||
gScreen.bg1.updated = 1;
|
||||
}
|
||||
|
||||
void sub_0806D1D0(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
if (sub_0806D00C(this) == NULL) {
|
||||
void sub_0806D1D0(BigGoronEntity* this) {
|
||||
if (super->action == 0) {
|
||||
if (sub_0806D00C(super) == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->action = 1;
|
||||
this->spriteOrientation.flipY = 3;
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = 7;
|
||||
this->spriteSettings.draw = 3;
|
||||
this->frameIndex = 0;
|
||||
this->timer = 30;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
super->action = 1;
|
||||
super->spriteOrientation.flipY = 3;
|
||||
super->spriteRendering.b3 = 3;
|
||||
super->spritePriority.b0 = 7;
|
||||
super->spriteSettings.draw = 3;
|
||||
super->frameIndex = 0;
|
||||
super->timer = 30;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
}
|
||||
|
||||
switch (this->subAction) {
|
||||
switch (super->subAction) {
|
||||
case 0:
|
||||
default:
|
||||
if (--this->timer == 0) {
|
||||
this->timer = (Random() & 0x7f) + 48;
|
||||
this->subtimer = 8;
|
||||
this->frameIndex = 1;
|
||||
if (--super->timer == 0) {
|
||||
super->timer = (Random() & 0x7f) + 48;
|
||||
super->subtimer = 8;
|
||||
super->frameIndex = 1;
|
||||
}
|
||||
if (this->subtimer != 0) {
|
||||
if (--this->subtimer == 0) {
|
||||
this->frameIndex = 0;
|
||||
if (super->subtimer != 0) {
|
||||
if (--super->subtimer == 0) {
|
||||
super->frameIndex = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
this->frameIndex = this->subAction;
|
||||
super->frameIndex = super->subAction;
|
||||
break;
|
||||
case 2:
|
||||
this->spriteSettings.draw = 0;
|
||||
super->spriteSettings.draw = 0;
|
||||
break;
|
||||
}
|
||||
this->x.HALF.HI = this->parent->x.HALF.HI;
|
||||
this->y.HALF.HI = this->parent->y.HALF.HI;
|
||||
super->x.HALF.HI = super->parent->x.HALF.HI;
|
||||
super->y.HALF.HI = super->parent->y.HALF.HI;
|
||||
}
|
||||
|
||||
void sub_0806D274(Entity* this) {
|
||||
void sub_0806D274(BigGoronEntity* this) {
|
||||
Entity* npc;
|
||||
|
||||
if (this->action == 0) {
|
||||
if (sub_0806D00C(this) == NULL) {
|
||||
if (super->action == 0) {
|
||||
if (sub_0806D00C(super) == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->action = 1;
|
||||
this->spriteOrientation.flipY = 3;
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = 7;
|
||||
this->frameIndex = 2;
|
||||
this->timer = 8;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
super->action = 1;
|
||||
super->spriteOrientation.flipY = 3;
|
||||
super->spriteRendering.b3 = 3;
|
||||
super->spritePriority.b0 = 7;
|
||||
super->frameIndex = 2;
|
||||
super->timer = 8;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
npc = CreateNPC(BIG_GORON, 3, 0);
|
||||
if (npc != NULL) {
|
||||
npc->child = this;
|
||||
npc->child = super;
|
||||
}
|
||||
}
|
||||
switch (this->subAction) {
|
||||
switch (super->subAction) {
|
||||
case 0:
|
||||
case 1:
|
||||
default:
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
this->frameIndex = 2;
|
||||
super->frameIndex = 2;
|
||||
break;
|
||||
}
|
||||
if (--this->timer == 0) {
|
||||
this->timer = 8;
|
||||
this->frameIndex ^= 1;
|
||||
if (--super->timer == 0) {
|
||||
super->timer = 8;
|
||||
super->frameIndex ^= 1;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (--this->timer == 0) {
|
||||
this->timer = 8;
|
||||
this->frameIndex ^= 1;
|
||||
if (--super->timer == 0) {
|
||||
super->timer = 8;
|
||||
super->frameIndex ^= 1;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
this->frameIndex = 4;
|
||||
super->frameIndex = 4;
|
||||
break;
|
||||
case 4:
|
||||
this->frameIndex = 2;
|
||||
super->frameIndex = 2;
|
||||
break;
|
||||
}
|
||||
this->x.HALF.HI = this->parent->x.HALF.HI;
|
||||
this->y.HALF.HI = this->parent->y.HALF.HI;
|
||||
super->x.HALF.HI = super->parent->x.HALF.HI;
|
||||
super->y.HALF.HI = super->parent->y.HALF.HI;
|
||||
}
|
||||
|
||||
void sub_0806D348(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
if (sub_0806D00C(this) == NULL) {
|
||||
void sub_0806D348(BigGoronEntity* this) {
|
||||
if (super->action == 0) {
|
||||
if (sub_0806D00C(super) == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->action = 1;
|
||||
this->spriteOrientation.flipY = 3;
|
||||
this->spriteRendering.b3 = 3;
|
||||
this->spritePriority.b0 = 6;
|
||||
this->spriteSettings.draw = 0;
|
||||
this->frameIndex = 5;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
super->action = 1;
|
||||
super->spriteOrientation.flipY = 3;
|
||||
super->spriteRendering.b3 = 3;
|
||||
super->spritePriority.b0 = 6;
|
||||
super->spriteSettings.draw = 0;
|
||||
super->frameIndex = 5;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
}
|
||||
if (this->child->frameIndex == 4) {
|
||||
this->spriteSettings.draw = 3;
|
||||
if (super->child->frameIndex == 4) {
|
||||
super->spriteSettings.draw = 3;
|
||||
} else {
|
||||
this->spriteSettings.draw = 0;
|
||||
super->spriteSettings.draw = 0;
|
||||
}
|
||||
this->x.HALF.HI = this->parent->x.HALF.HI;
|
||||
this->y.HALF.HI = this->parent->y.HALF.HI;
|
||||
super->x.HALF.HI = super->parent->x.HALF.HI;
|
||||
super->y.HALF.HI = super->parent->y.HALF.HI;
|
||||
}
|
||||
|
||||
void sub_0806D3C0(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
if (sub_0806D00C(this) == NULL) {
|
||||
void sub_0806D3C0(BigGoronEntity* this) {
|
||||
if (super->action == 0) {
|
||||
if (sub_0806D00C(super) == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
this->action = 1;
|
||||
this->hitbox = (Hitbox*)&gHitbox_3;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD64(this);
|
||||
super->action = 1;
|
||||
super->hitbox = (Hitbox*)&gHitbox_3;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
sub_0807DD64(super);
|
||||
} else {
|
||||
this->x.HALF.HI = this->parent->x.HALF.HI;
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
super->x.HALF.HI = super->parent->x.HALF.HI;
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806D40C(Entity* this) {
|
||||
this->spriteSettings.flipX = 1;
|
||||
void sub_0806D40C(BigGoronEntity* this) {
|
||||
super->spriteSettings.flipX = 1;
|
||||
sub_0806D41C(this);
|
||||
}
|
||||
|
||||
void sub_0806D41C(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->frameIndex = 6;
|
||||
sub_0807DD64(this);
|
||||
void sub_0806D41C(BigGoronEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
super->frameIndex = 6;
|
||||
sub_0807DD64(super);
|
||||
sub_0806D4C0(this, 0);
|
||||
sub_0806D4C0(this, 1);
|
||||
sub_0806D4C0(this, 2);
|
||||
sub_0806D4C0(this, 3);
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
}
|
||||
if ((gRoomTransition.frameCount & 1) == 0) {
|
||||
if (CheckPlayerProximity(this->x.HALF.HI - 0x20, this->y.HALF.HI, 0x40, 0x40) != 0) {
|
||||
if (this->spriteOffsetY > -8) {
|
||||
this->spriteOffsetY--;
|
||||
if (CheckPlayerProximity(super->x.HALF.HI - 0x20, super->y.HALF.HI, 0x40, 0x40) != 0) {
|
||||
if (super->spriteOffsetY > -8) {
|
||||
super->spriteOffsetY--;
|
||||
}
|
||||
} else {
|
||||
if (this->spriteOffsetY < 0) {
|
||||
this->spriteOffsetY++;
|
||||
if (super->spriteOffsetY < 0) {
|
||||
super->spriteOffsetY++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806D4C0(Entity* this, u32 param) {
|
||||
Entity* npc = CreateNPC(BIG_GORON, param + 6, 0);
|
||||
void sub_0806D4C0(BigGoronEntity* this, u32 type) {
|
||||
Entity* npc = CreateNPC(BIG_GORON, type + 6, 0);
|
||||
if (npc != NULL) {
|
||||
npc->parent = this;
|
||||
CopyPosition(this, npc);
|
||||
SortEntityAbove(this, npc);
|
||||
npc->parent = super;
|
||||
CopyPosition(super, npc);
|
||||
SortEntityAbove(super, npc);
|
||||
SetDefaultPriority(npc, PRIO_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806D4F0(Entity* this) {
|
||||
void sub_0806D4F0(BigGoronEntity* this) {
|
||||
sub_0806D520(this, 0);
|
||||
}
|
||||
|
||||
void sub_0806D4FC(Entity* this) {
|
||||
void sub_0806D4FC(BigGoronEntity* this) {
|
||||
sub_0806D520(this, 1);
|
||||
}
|
||||
|
||||
void sub_0806D508(Entity* this) {
|
||||
void sub_0806D508(BigGoronEntity* this) {
|
||||
sub_0806D520(this, 2);
|
||||
}
|
||||
|
||||
void sub_0806D514(Entity* this) {
|
||||
void sub_0806D514(BigGoronEntity* this) {
|
||||
sub_0806D520(this, 3);
|
||||
}
|
||||
|
||||
void sub_0806D520(Entity* this, u32 param_2) {
|
||||
void sub_0806D520(BigGoronEntity* this, u32 param_2) {
|
||||
static const u8 gUnk_08114100[] = {
|
||||
10,
|
||||
7,
|
||||
4,
|
||||
1,
|
||||
};
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->subtimer = gUnk_08114100[param_2] + 6;
|
||||
this->frameIndex = this->subtimer;
|
||||
this->timer = 8;
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
super->subtimer = gUnk_08114100[param_2] + 6;
|
||||
super->frameIndex = super->subtimer;
|
||||
super->timer = 8;
|
||||
}
|
||||
this->x.HALF.HI = this->parent->x.HALF.HI;
|
||||
this->y.HALF.HI = this->parent->y.HALF.HI;
|
||||
this->spriteOffsetX = this->parent->spriteOffsetX;
|
||||
this->spriteOffsetY = this->parent->spriteOffsetY;
|
||||
this->spriteOrientation.flipY = this->parent->spriteOrientation.flipY;
|
||||
if (this->subAction != 0 ||
|
||||
CheckPlayerProximity(this->x.HALF.HI + param_2 * -0x10 + 0xc, this->y.HALF.HI, 0x18, 0x40)) {
|
||||
if (this->frameIndex >= this->subtimer + 2) {
|
||||
super->x.HALF.HI = super->parent->x.HALF.HI;
|
||||
super->y.HALF.HI = super->parent->y.HALF.HI;
|
||||
super->spriteOffsetX = super->parent->spriteOffsetX;
|
||||
super->spriteOffsetY = super->parent->spriteOffsetY;
|
||||
super->spriteOrientation.flipY = super->parent->spriteOrientation.flipY;
|
||||
if (super->subAction != 0 ||
|
||||
CheckPlayerProximity(super->x.HALF.HI + param_2 * -0x10 + 0xc, super->y.HALF.HI, 0x18, 0x40)) {
|
||||
if (super->frameIndex >= super->subtimer + 2) {
|
||||
return;
|
||||
}
|
||||
if (--this->timer != 0) {
|
||||
if (--super->timer != 0) {
|
||||
return;
|
||||
}
|
||||
this->timer = 8;
|
||||
this->frameIndex++;
|
||||
super->timer = 8;
|
||||
super->frameIndex++;
|
||||
} else {
|
||||
if (this->frameIndex <= this->subtimer) {
|
||||
if (super->frameIndex <= super->subtimer) {
|
||||
return;
|
||||
}
|
||||
if (--this->timer != 0) {
|
||||
if (--super->timer != 0) {
|
||||
return;
|
||||
}
|
||||
this->timer = 8;
|
||||
this->frameIndex--;
|
||||
super->timer = 8;
|
||||
super->frameIndex--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+44
-37
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Blade Brothers NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
@@ -16,6 +17,13 @@
|
||||
#include "save.h"
|
||||
#include "script.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 itemSlotA;
|
||||
/*0x6a*/ u8 itemSlotB;
|
||||
} BladeBrothersEntity;
|
||||
|
||||
void sub_08068A1C(Entity*);
|
||||
void sub_08068A4C(Entity*);
|
||||
void sub_08068AA4(Entity*);
|
||||
@@ -26,10 +34,10 @@ void (*const gUnk_081115C0[])(Entity*) = {
|
||||
sub_08068AA4,
|
||||
sub_08068ADC,
|
||||
};
|
||||
void sub_08068AFC(Entity*);
|
||||
void sub_08068b2c(Entity*);
|
||||
void sub_08068B70(Entity*);
|
||||
void (*const gUnk_081115D0[])(Entity*) = {
|
||||
void sub_08068AFC(BladeBrothersEntity*);
|
||||
void sub_08068b2c(BladeBrothersEntity*);
|
||||
void sub_08068B70(BladeBrothersEntity*);
|
||||
void (*const gUnk_081115D0[])(BladeBrothersEntity*) = {
|
||||
sub_08068AFC,
|
||||
sub_08068b2c,
|
||||
sub_08068B70,
|
||||
@@ -217,16 +225,16 @@ extern EntityData gUnk_080F3494;
|
||||
|
||||
static void sub_08068BEC(Entity* this, u32 unused);
|
||||
|
||||
void BladeBrothers(Entity* this) {
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
gUnk_081115D0[this->action](this);
|
||||
void BladeBrothers(BladeBrothersEntity* this) {
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
gUnk_081115D0[super->action](this);
|
||||
} else {
|
||||
gUnk_081115C0[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
gUnk_081115C0[super->action](super);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
if ((this->frame & 1) != 0) {
|
||||
this->frame &= 0xfe;
|
||||
sub_08068BEC(this, 0);
|
||||
if ((super->frame & 1) != 0) {
|
||||
super->frame &= 0xfe;
|
||||
sub_08068BEC(super, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,31 +301,30 @@ void sub_08068ADC(Entity* this) {
|
||||
sub_0806FD3C(this);
|
||||
}
|
||||
|
||||
void sub_08068AFC(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
sub_0807DD50(this);
|
||||
void sub_08068AFC(BladeBrothersEntity* this) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
|
||||
void sub_08068b2c(Entity* this) {
|
||||
u32 uVar1;
|
||||
|
||||
if (this->interactType == '\x02') {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
uVar1 = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
|
||||
InitAnimationForceUpdate(this, uVar1);
|
||||
sub_0806F118(this);
|
||||
void sub_08068b2c(BladeBrothersEntity* this) {
|
||||
u32 animationState;
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
animationState = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity));
|
||||
InitAnimationForceUpdate(super, animationState);
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08068B70(Entity* this) {
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
void sub_08068B70(BladeBrothersEntity* this) {
|
||||
if (UpdateFuseInteraction(super)) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,18 +338,18 @@ void BladeBrothers_StartPlayerDemonstration(Entity* this, ScriptExecutionContext
|
||||
InitPlayerMacro((PlayerMacroEntry*)BladeBrothers_PlayerMacros[this->timer]);
|
||||
}
|
||||
|
||||
void sub_08068BB4(Entity* this) {
|
||||
void sub_08068BB4(BladeBrothersEntity* this) {
|
||||
u32 item = gSave.stats.itemButtons[SLOT_A];
|
||||
|
||||
this->field_0x68.HALF.HI = item;
|
||||
this->itemSlotA = item;
|
||||
item = gSave.stats.itemButtons[SLOT_B];
|
||||
*(&this->field_0x68.HALF.HI + 1) = item;
|
||||
this->itemSlotB = item;
|
||||
}
|
||||
|
||||
// Restore previous equipped items.
|
||||
void sub_08068BD0(Entity* this) {
|
||||
ForceEquipItem(this->field_0x68.HALF.HI, EQUIP_SLOT_A);
|
||||
ForceEquipItem(*(u8*)(&this->field_0x68.HALF.HI + 1), EQUIP_SLOT_B);
|
||||
void sub_08068BD0(BladeBrothersEntity* this) {
|
||||
ForceEquipItem(this->itemSlotA, EQUIP_SLOT_A);
|
||||
ForceEquipItem(this->itemSlotB, EQUIP_SLOT_B);
|
||||
}
|
||||
|
||||
static void sub_08068BEC(Entity* this, u32 unused) {
|
||||
|
||||
+33
-25
@@ -4,22 +4,29 @@
|
||||
*
|
||||
* @brief Brocco NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "message.h"
|
||||
#include "npc.h"
|
||||
#include "save.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 animIndex;
|
||||
} BroccoEntity;
|
||||
|
||||
void sub_08063544(Entity*);
|
||||
void sub_0806362C(Entity*);
|
||||
void sub_0806362C(BroccoEntity*);
|
||||
void sub_0806355C(Entity*);
|
||||
void sub_08063584(Entity*);
|
||||
void sub_08063608(Entity*);
|
||||
|
||||
void Brocco(Entity* this) {
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
void Brocco(BroccoEntity* this) {
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
sub_0806362C(this);
|
||||
} else {
|
||||
sub_08063544(this);
|
||||
sub_08063544(super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,32 +80,33 @@ void sub_08063608(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806362C(Entity* this) {
|
||||
switch (this->action) {
|
||||
void sub_0806362C(BroccoEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
sub_0807DD64(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
this->animIndex = 0;
|
||||
sub_0807DD64(super);
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
this->animIndex = super->animIndex;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4);
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this) == 0) {
|
||||
if (UpdateFuseInteraction(super) == 0) {
|
||||
return;
|
||||
}
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, this->field_0x68.HALF.HI);
|
||||
super->action = 1;
|
||||
InitAnimationForceUpdate(super, this->animIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -120,9 +128,9 @@ void sub_080636D8(Entity* this) {
|
||||
ShowNPCDialogue(this, &gUnk_0810CAAC[gSave.global_progress]);
|
||||
}
|
||||
|
||||
void Brocco_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Brocco_MakeInteractable(BroccoEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Brocco_Fusion(Entity* this) {
|
||||
|
||||
+3
-2
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Carlov NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "room.h"
|
||||
@@ -12,9 +13,9 @@
|
||||
void Carlov(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
if ((this->frame & 0x10) != 0) {
|
||||
this->frame &= ~0x10;
|
||||
|
||||
+34
-25
@@ -4,11 +4,20 @@
|
||||
*
|
||||
* @brief Carpenter NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
#include "player.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 animIndex;
|
||||
/*0x6a*/ u8 unused[26];
|
||||
/*0x84*/ ScriptExecutionContext* context;
|
||||
} CarpenterEntity;
|
||||
|
||||
static const SpriteLoadData gUnk_08110CA8[] = {
|
||||
{ 0x51, 0x3f, 0x4 }, { 0x1451, 0x3f, 0x4 }, { 0x4001, 0x3f, 0x4 }, { 0, 0, 0 },
|
||||
{ 0x51, 0x3f, 0x4 }, { 0x1451, 0x3f, 0x4 }, { 0x4001, 0x3f, 0x4 }, { 0, 0, 0 },
|
||||
@@ -16,38 +25,38 @@ static const SpriteLoadData gUnk_08110CA8[] = {
|
||||
{ 0x51, 0x3f, 0x4 }, { 0x1451, 0x3f, 0x4 }, { 0, 0, 0 }, { 0, 0, 0 },
|
||||
};
|
||||
|
||||
void Carpenter(Entity* this) {
|
||||
if (*(u32*)&this->cutsceneBeh == 0) {
|
||||
void Carpenter(CarpenterEntity* this) {
|
||||
if (this->context == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
switch (this->action) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
if (!LoadExtraSpriteData(this, gUnk_08110CA8 + this->type * 4))
|
||||
if (!LoadExtraSpriteData(super, gUnk_08110CA8 + super->type * 4))
|
||||
break;
|
||||
this->action = 1;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD64(this);
|
||||
super->action = 1;
|
||||
this->animIndex = 0;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
sub_0807DD64(super);
|
||||
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitializeAnimation(this,
|
||||
sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4 + (this->type * 8));
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
this->animIndex = super->animIndex;
|
||||
InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) +
|
||||
4 + (super->type * 8));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, 0);
|
||||
HandleEntity0x82Actions(this);
|
||||
GetNextFrame(this);
|
||||
ExecuteScriptForEntity(super, 0);
|
||||
HandleEntity0x82Actions(super);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!UpdateFuseInteraction(this))
|
||||
if (!UpdateFuseInteraction(super))
|
||||
break;
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->field_0x68.HALF.HI);
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, this->animIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -96,15 +105,15 @@ void sub_08067304(Entity* this) {
|
||||
ShowNPCDialogue(this, &dialog);
|
||||
}
|
||||
|
||||
void Carpenter_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Carpenter_MakeInteractable(CarpenterEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Carpenter_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_08110CA8[this->type * 4])) {
|
||||
this->action = this->action + 1;
|
||||
this->action++;
|
||||
this->spriteSettings.draw = 1;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
InitializeAnimation(this, (u32)this->type * 8 + 2);
|
||||
|
||||
@@ -86,13 +86,13 @@ void sub_08064570(CastleMaidEntity* this) {
|
||||
this->field_0x6e = tmp2;
|
||||
}
|
||||
this->dialogFunc = NULL;
|
||||
sub_0807DD50(super);
|
||||
InitScriptForNPC(super);
|
||||
case 1:
|
||||
sub_0807DD94(super, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
if (super->interactType != 0) {
|
||||
super->action++;
|
||||
super->interactType = 0;
|
||||
InitializeAnimation(super, sub_0806F5A4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
if (this->dialogFunc != NULL) {
|
||||
this->dialogFunc();
|
||||
}
|
||||
@@ -178,7 +178,7 @@ void sub_080646A4(CastleMaidEntity* this, ScriptExecutionContext* context) {
|
||||
break;
|
||||
}
|
||||
super->direction = dir;
|
||||
super->animationState = sub_0806F5B0(dir);
|
||||
super->animationState = GetAnimationStateForDirection8(dir);
|
||||
super->speed = 0x80;
|
||||
}
|
||||
|
||||
|
||||
+32
-26
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Castor Wilds Statue NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "effects.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
@@ -11,6 +12,11 @@
|
||||
#include "npc.h"
|
||||
#include "script.h"
|
||||
#include "sound.h"
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[12];
|
||||
/*0x74*/ u16 tilePos;
|
||||
} CastorWildsStatueEntity;
|
||||
|
||||
static const Hitbox gUnk_08110E94;
|
||||
|
||||
@@ -23,25 +29,25 @@ void sub_080673C0(Entity*);
|
||||
void sub_080673F4(Entity*);
|
||||
void sub_08067410(Entity*);
|
||||
void sub_0806752C(Entity*);
|
||||
void sub_08067418(Entity*);
|
||||
void sub_08067514(Entity*);
|
||||
void sub_08067418(CastorWildsStatueEntity*);
|
||||
void sub_08067514(CastorWildsStatueEntity*);
|
||||
|
||||
void CastorWildsStatue(Entity* this) {
|
||||
void CastorWildsStatue(CastorWildsStatueEntity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
sub_080673C0,
|
||||
sub_080673F4,
|
||||
sub_08067410,
|
||||
sub_0806752C,
|
||||
};
|
||||
static void (*const scriptedActionFuncs[])(Entity*) = {
|
||||
static void (*const scriptedActionFuncs[])(CastorWildsStatueEntity*) = {
|
||||
sub_08067418,
|
||||
sub_08067514,
|
||||
};
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
scriptedActionFuncs[this->action](this);
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
scriptedActionFuncs[super->action](this);
|
||||
} else {
|
||||
actionFuncs[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
actionFuncs[super->action](super);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,20 +74,20 @@ void sub_08067410(Entity* this) {
|
||||
this->action = 1;
|
||||
}
|
||||
|
||||
void sub_08067418(Entity* this) {
|
||||
this->action = 1;
|
||||
this->field_0x74.HWORD = COORD_TO_TILE(this);
|
||||
if (this->type == 0) {
|
||||
this->hitbox = (Hitbox*)&gUnk_08110E94;
|
||||
SetTile(0x4022, this->field_0x74.HWORD - 1, this->collisionLayer);
|
||||
SetTile(0x4022, this->field_0x74.HWORD, this->collisionLayer);
|
||||
SetTile(0x4022, this->field_0x74.HWORD + 0x3f, this->collisionLayer);
|
||||
SetTile(0x4022, this->field_0x74.HWORD + 0x40, this->collisionLayer);
|
||||
void sub_08067418(CastorWildsStatueEntity* this) {
|
||||
super->action = 1;
|
||||
this->tilePos = COORD_TO_TILE(super);
|
||||
if (super->type == 0) {
|
||||
super->hitbox = (Hitbox*)&gUnk_08110E94;
|
||||
SetTile(0x4022, this->tilePos - 1, super->collisionLayer);
|
||||
SetTile(0x4022, this->tilePos, super->collisionLayer);
|
||||
SetTile(0x4022, this->tilePos + 0x3f, super->collisionLayer);
|
||||
SetTile(0x4022, this->tilePos + 0x40, super->collisionLayer);
|
||||
} else {
|
||||
this->collisionLayer = 3;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
this->spriteRendering.b3 = 1;
|
||||
this->spritePriority.b0 = 2;
|
||||
super->collisionLayer = 3;
|
||||
super->spriteOrientation.flipY = 1;
|
||||
super->spriteRendering.b3 = 1;
|
||||
super->spritePriority.b0 = 2;
|
||||
if (CheckLocalFlag(HIKYOU_00_SEKIZOU) == 0) {
|
||||
SetTile(0x4022, 0xe81, 1);
|
||||
SetTile(0x4022, 0xe82, 1);
|
||||
@@ -89,13 +95,13 @@ void sub_08067418(Entity* this) {
|
||||
SetTile(0x4022, 0xec3, 1);
|
||||
}
|
||||
}
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
|
||||
void sub_08067514(Entity* this) {
|
||||
sub_0807DD94(this, NULL);
|
||||
if (this->type == 0) {
|
||||
sub_0806ED78(this);
|
||||
void sub_08067514(CastorWildsStatueEntity* this) {
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
if (super->type == 0) {
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+170
-160
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Cat NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "enemy.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
@@ -11,30 +12,44 @@
|
||||
#include "npc.h"
|
||||
#include "save.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 unk_69;
|
||||
/*0x6a*/ u8 unused[2];
|
||||
/*0x6c*/ u16 unk_6c;
|
||||
/*0x6e*/ u16 unk_6e;
|
||||
/*0x70*/ u8 unk_70;
|
||||
/*0x71*/ u8 unk_71;
|
||||
/*0x72*/ u16 unk_72;
|
||||
/*0x74*/ u8 unk_74;
|
||||
/*0x75*/ u8 unk_75;
|
||||
} CatEntity;
|
||||
|
||||
static const Hitbox gUnk_08110EF0 = { 0, -1, { 5, 3, 3, 5 }, 5, 4 };
|
||||
|
||||
void sub_08067C44(Entity*);
|
||||
void sub_08067B08(Entity*);
|
||||
u32 sub_08067D20(Entity*);
|
||||
void sub_08067AAC(Entity*);
|
||||
void sub_08067B34(Entity*);
|
||||
void sub_08067B80(Entity*, u32);
|
||||
void sub_08067B70(Entity*);
|
||||
void sub_08067C24(Entity*);
|
||||
void sub_08067C44(CatEntity*);
|
||||
void sub_08067B08(CatEntity*);
|
||||
bool32 sub_08067D20(CatEntity*);
|
||||
void sub_08067AAC(CatEntity*);
|
||||
void sub_08067B34(CatEntity*);
|
||||
void sub_08067B80(CatEntity*, u32);
|
||||
void sub_08067B70(CatEntity*);
|
||||
void sub_08067C24(CatEntity*);
|
||||
void sub_08067BD4(Entity*);
|
||||
u32 sub_08067D74(Entity*);
|
||||
bool32 sub_08067D74(Entity*);
|
||||
void sub_08067C18(Entity*);
|
||||
void sub_08067DCC(Entity*, u32);
|
||||
void sub_08067DCC(CatEntity*, u32);
|
||||
void sub_08067DDC(Entity*);
|
||||
void sub_080677EC(Entity*);
|
||||
void sub_080678AC(Entity*);
|
||||
void sub_08067904(Entity*);
|
||||
void sub_0806797C(Entity*);
|
||||
void sub_0806799C(Entity*);
|
||||
void sub_080679C4(Entity*);
|
||||
void sub_08067A0C(Entity*);
|
||||
void sub_08067A78(Entity*);
|
||||
void sub_08067A98(Entity*);
|
||||
void sub_080677EC(CatEntity*);
|
||||
void sub_080678AC(CatEntity*);
|
||||
void sub_08067904(CatEntity*);
|
||||
void sub_0806797C(CatEntity*);
|
||||
void sub_0806799C(CatEntity*);
|
||||
void sub_080679C4(CatEntity*);
|
||||
void sub_08067A0C(CatEntity*);
|
||||
void sub_08067A78(CatEntity*);
|
||||
void sub_08067A98(CatEntity*);
|
||||
|
||||
extern Hitbox* gUnk_08111154[8];
|
||||
|
||||
@@ -105,159 +120,154 @@ void sub_08067790(Entity* this) {
|
||||
}
|
||||
|
||||
// Main
|
||||
void Cat(Entity* ent) {
|
||||
static void (*const actionFuncs[9])(Entity*) = {
|
||||
void Cat(CatEntity* this) {
|
||||
static void (*const actionFuncs[9])(CatEntity*) = {
|
||||
sub_080677EC, sub_080678AC, sub_08067904, sub_0806797C, sub_0806799C,
|
||||
sub_080679C4, sub_08067A0C, sub_08067A78, sub_08067A98,
|
||||
};
|
||||
actionFuncs[ent->action](ent);
|
||||
sub_08067C44(ent);
|
||||
if (((ent->flags & ENT_COLLIDE) == 0) && (ent->type != 5)) {
|
||||
sub_0806ED78(ent);
|
||||
actionFuncs[super->action](this);
|
||||
sub_08067C44(this);
|
||||
if (((super->flags & ENT_COLLIDE) == 0) && (super->type != 5)) {
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080677EC(Entity* this) {
|
||||
void sub_080677EC(CatEntity* this) {
|
||||
u32 uVar2;
|
||||
|
||||
this->spriteSettings.draw = 1;
|
||||
this->direction = 8;
|
||||
this->speed = 0x80;
|
||||
this->collisionFlags = 7;
|
||||
this->hurtType = 0x48;
|
||||
this->hitType = -0x58;
|
||||
this->flags2 = 1;
|
||||
this->field_0x68.HALF.HI = 0xff;
|
||||
if (this->x.HALF.HI < gPlayerEntity.x.HALF.HI) {
|
||||
this->spriteSettings.flipX = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->direction = 8;
|
||||
super->speed = 0x80;
|
||||
super->collisionFlags = 7;
|
||||
super->hurtType = 0x48;
|
||||
super->hitType = -0x58;
|
||||
super->flags2 = 1;
|
||||
this->unk_69 = 0xff;
|
||||
if (super->x.HALF.HI < gPlayerEntity.x.HALF.HI) {
|
||||
super->spriteSettings.flipX = 1;
|
||||
} else {
|
||||
this->spriteSettings.flipX = 0;
|
||||
super->spriteSettings.flipX = 0;
|
||||
}
|
||||
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
this->hitbox = (Hitbox*)&gUnk_08110EF0;
|
||||
uVar2 = sub_0805ACC0(this);
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
super->hitbox = (Hitbox*)&gUnk_08110EF0;
|
||||
uVar2 = sub_0805ACC0(super);
|
||||
if (uVar2 == 0) {
|
||||
uVar2 = this->x.HALF.HI;
|
||||
uVar2 = super->x.HALF.HI;
|
||||
} else {
|
||||
uVar2 >>= 0x10;
|
||||
}
|
||||
this->field_0x6c.HWORD = uVar2;
|
||||
this->field_0x6e.HWORD = this->timer + uVar2;
|
||||
this->timer = 0;
|
||||
this->field_0x74.HALF.HI = 0;
|
||||
this->field_0x74.HALF.LO = (Random() & 0x7f) + 0x1e;
|
||||
this->field_0x68.HALF.HI = 0xff;
|
||||
this->unk_6c = uVar2;
|
||||
this->unk_6e = super->timer + uVar2;
|
||||
super->timer = 0;
|
||||
this->unk_75 = 0;
|
||||
this->unk_74 = (Random() & 0x7f) + 0x1e;
|
||||
this->unk_69 = 0xff;
|
||||
sub_08067B08(this);
|
||||
}
|
||||
|
||||
void sub_080678AC(Entity* this) {
|
||||
u32 iVar1;
|
||||
u16* psVar2;
|
||||
|
||||
iVar1 = sub_08067D20(this);
|
||||
if (iVar1 != 0) {
|
||||
void sub_080678AC(CatEntity* this) {
|
||||
if (sub_08067D20(this)) {
|
||||
sub_08067B80(this, 5);
|
||||
} else {
|
||||
psVar2 = (u16*)&this->field_0x70.HALF.HI;
|
||||
if (*psVar2 != 0) {
|
||||
*psVar2 = *psVar2 - 1;
|
||||
if (this->unk_72 != 0) {
|
||||
this->unk_72--;
|
||||
}
|
||||
if ((this->frame == 1) && (*psVar2 == 0)) {
|
||||
if ((super->frame == 1) && (this->unk_72 == 0)) {
|
||||
sub_08067AAC(this);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
sub_08067B34(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08067904(Entity* this) {
|
||||
void sub_08067904(CatEntity* this) {
|
||||
if (sub_08067D20(this) != 0) {
|
||||
sub_08067B80(this, 8);
|
||||
return;
|
||||
}
|
||||
|
||||
this->field_0x70.HALF.HI--;
|
||||
if (this->field_0x70.HALF.HI == 0) {
|
||||
this->unk_72--;
|
||||
if (this->unk_72 == 0) {
|
||||
sub_08067B70(this);
|
||||
return;
|
||||
}
|
||||
if (this->direction == 8) {
|
||||
if (this->x.HALF.HI > this->field_0x6e.HWORD) {
|
||||
this->direction = 0x18;
|
||||
this->spriteSettings.flipX = 0;
|
||||
if (super->direction == 8) {
|
||||
if (super->x.HALF.HI > this->unk_6e) {
|
||||
super->direction = 0x18;
|
||||
super->spriteSettings.flipX = 0;
|
||||
}
|
||||
} else {
|
||||
if (this->x.HALF.HI < this->field_0x6c.HWORD) {
|
||||
this->direction = 8;
|
||||
this->spriteSettings.flipX = 1;
|
||||
if (super->x.HALF.HI < this->unk_6c) {
|
||||
super->direction = 8;
|
||||
super->spriteSettings.flipX = 1;
|
||||
}
|
||||
}
|
||||
LinearMoveUpdate(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
LinearMoveUpdate(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
void sub_0806797C(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frame & ANIM_DONE) {
|
||||
void sub_0806797C(CatEntity* this) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if (super->frame & ANIM_DONE) {
|
||||
sub_08067B08(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806799C(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
void sub_0806799C(CatEntity* this) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
sub_08067B08(this);
|
||||
SetDefaultPriority(this, PRIO_PLAYER);
|
||||
SetDefaultPriority(super, PRIO_PLAYER);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080679C4(Entity* this) {
|
||||
if (this->field_0x74.HALF.LO == 0 || --this->field_0x74.HALF.LO == 0 || sub_08067D20(this) == 0) {
|
||||
void sub_080679C4(CatEntity* this) {
|
||||
if (this->unk_74 == 0 || --this->unk_74 == 0 || sub_08067D20(this) == 0) {
|
||||
sub_08067C24(this);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
sub_08067BD4(this);
|
||||
if (sub_08067D74(this) != 0) {
|
||||
sub_08067C18(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
sub_08067BD4(super);
|
||||
if (sub_08067D74(super) != 0) {
|
||||
sub_08067C18(super);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08067A0C(Entity* this) {
|
||||
void sub_08067A0C(CatEntity* this) {
|
||||
u8 tmp;
|
||||
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frame & ANIM_DONE) {
|
||||
if (sub_08067D20(this) != 0) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if (super->frame & ANIM_DONE) {
|
||||
if (sub_08067D20(this)) {
|
||||
sub_08067B80(this, 5);
|
||||
this->timer += 20;
|
||||
super->timer += 20;
|
||||
} else {
|
||||
sub_08067C24(this);
|
||||
}
|
||||
} else {
|
||||
tmp = (this->frame & 7);
|
||||
tmp = (super->frame & 7);
|
||||
if (tmp != 0) {
|
||||
COLLISION_ON(this);
|
||||
this->hitbox = gUnk_08111154[tmp - 1 + ((this->spriteSettings.flipX << 2))];
|
||||
COLLISION_ON(super);
|
||||
super->hitbox = gUnk_08111154[tmp - 1 + ((super->spriteSettings.flipX << 2))];
|
||||
} else {
|
||||
sub_08067DDC(this);
|
||||
sub_08067DDC(super);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08067A78(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frame & ANIM_DONE) {
|
||||
void sub_08067A78(CatEntity* this) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if (super->frame & ANIM_DONE) {
|
||||
sub_08067AAC(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08067A98(Entity* this) {
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
void sub_08067A98(CatEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
sub_08067B08(this);
|
||||
}
|
||||
}
|
||||
@@ -279,43 +289,43 @@ static const u16 gUnk_08111104[] = {
|
||||
static const u8 gUnk_0811110C[] = { 0x3c, 0x96, 0x14 };
|
||||
static const u8 gUnk_0811110F[] = { 0, -4, 8, 8, 0 };
|
||||
|
||||
void sub_08067AAC(Entity* this) {
|
||||
this->action = 2;
|
||||
this->field_0x70.HALF.HI = gUnk_081110FC[(Random() & 3)];
|
||||
void sub_08067AAC(CatEntity* this) {
|
||||
super->action = 2;
|
||||
this->unk_72 = gUnk_081110FC[(Random() & 3)];
|
||||
|
||||
this->spriteSettings.flipX = this->direction >> 4 ^ 1;
|
||||
super->spriteSettings.flipX = super->direction >> 4 ^ 1;
|
||||
|
||||
sub_08067DCC(this, 3);
|
||||
SetInteractableObjectCollision(this, 0, gUnk_0811110C[2], gUnk_0811110F);
|
||||
SetInteractableObjectCollision(super, 0, gUnk_0811110C[2], gUnk_0811110F);
|
||||
}
|
||||
|
||||
void sub_08067B08(Entity* this) {
|
||||
this->action = 1;
|
||||
this->field_0x70.HALF.HI = gUnk_08111104[Random() & 3];
|
||||
void sub_08067B08(CatEntity* this) {
|
||||
super->action = 1;
|
||||
this->unk_72 = gUnk_08111104[Random() & 3];
|
||||
sub_08067B34(this);
|
||||
}
|
||||
|
||||
void sub_08067B34(Entity* this) {
|
||||
void sub_08067B34(CatEntity* this) {
|
||||
sub_08067DCC(this, 0);
|
||||
this->frameDuration = (Random() & 0x30) + 0xb4;
|
||||
SetInteractableObjectCollision(this, 0, gUnk_0811110C[this->spriteSettings.flipX], gUnk_0811110F);
|
||||
super->frameDuration = (Random() & 0x30) + 0xb4;
|
||||
SetInteractableObjectCollision(super, 0, gUnk_0811110C[super->spriteSettings.flipX], gUnk_0811110F);
|
||||
}
|
||||
|
||||
void sub_08067B70(Entity* this) {
|
||||
this->action = 3;
|
||||
void sub_08067B70(CatEntity* this) {
|
||||
super->action = 3;
|
||||
sub_08067DCC(this, 4);
|
||||
}
|
||||
|
||||
void sub_08067B80(Entity* this, u32 param) {
|
||||
this->action = 5;
|
||||
this->timer = 20;
|
||||
this->field_0x74.HALF.LO = (Random() & 0x7f) + 0x1e;
|
||||
InitAnimationForceUpdate(this, param);
|
||||
sub_08067DDC(this);
|
||||
if (this->x.HALF.HI < gPlayerEntity.x.HALF.HI) {
|
||||
this->spriteSettings.flipX = 1;
|
||||
void sub_08067B80(CatEntity* this, u32 animIndex) {
|
||||
super->action = 5;
|
||||
super->timer = 20;
|
||||
this->unk_74 = (Random() & 0x7f) + 0x1e;
|
||||
InitAnimationForceUpdate(super, animIndex);
|
||||
sub_08067DDC(super);
|
||||
if (super->x.HALF.HI < gPlayerEntity.x.HALF.HI) {
|
||||
super->spriteSettings.flipX = 1;
|
||||
} else {
|
||||
this->spriteSettings.flipX = 0;
|
||||
super->spriteSettings.flipX = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,14 +346,14 @@ void sub_08067C18(Entity* this) {
|
||||
InitAnimationForceUpdate(this, 6);
|
||||
}
|
||||
|
||||
void sub_08067C24(Entity* this) {
|
||||
this->action = 7;
|
||||
this->field_0x74.HALF.HI = 0x14;
|
||||
sub_08067DDC(this);
|
||||
InitAnimationForceUpdate(this, 7);
|
||||
void sub_08067C24(CatEntity* this) {
|
||||
super->action = 7;
|
||||
this->unk_75 = 0x14;
|
||||
sub_08067DDC(super);
|
||||
InitAnimationForceUpdate(super, 7);
|
||||
}
|
||||
|
||||
void sub_08067C44(Entity* this) {
|
||||
void sub_08067C44(CatEntity* this) {
|
||||
s32 iVar4;
|
||||
u32 uVar5;
|
||||
|
||||
@@ -353,78 +363,78 @@ void sub_08067C44(Entity* this) {
|
||||
uVar5 = FALSE;
|
||||
}
|
||||
|
||||
if (uVar5 != this->field_0x68.HALF.HI) {
|
||||
if (uVar5 != this->unk_69) {
|
||||
if (uVar5 == 0) {
|
||||
AddInteractableWhenBigObject(this);
|
||||
AddInteractableWhenBigObject(super);
|
||||
} else {
|
||||
AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO);
|
||||
AddInteractableAsMinishFuser(super, this->fusionOffer);
|
||||
}
|
||||
}
|
||||
|
||||
this->field_0x68.HALF.HI = uVar5;
|
||||
this->unk_69 = uVar5;
|
||||
|
||||
if (this->interactType == 0) {
|
||||
if (super->interactType == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
iVar4 = sub_0806FCA0(this, &gPlayerEntity);
|
||||
switch (this->animIndex) {
|
||||
iVar4 = sub_0806FCA0(super, &gPlayerEntity);
|
||||
switch (super->animIndex) {
|
||||
case 0:
|
||||
default:
|
||||
if (iVar4 == 2) {
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
InitAnimationForceUpdate(super, 2);
|
||||
} else {
|
||||
InitAnimationForceUpdate(this, 1);
|
||||
InitAnimationForceUpdate(super, 1);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (iVar4 == 1) {
|
||||
this->spriteSettings.flipX = 1;
|
||||
super->spriteSettings.flipX = 1;
|
||||
} else {
|
||||
if (this->spriteSettings.flipX == 3) { // TODO 3 ???
|
||||
this->spriteSettings.flipX = 0;
|
||||
if (super->spriteSettings.flipX == 3) { // TODO 3 ???
|
||||
super->spriteSettings.flipX = 0;
|
||||
}
|
||||
}
|
||||
if (iVar4 != 2) {
|
||||
InitAnimationForceUpdate(this, 1);
|
||||
InitAnimationForceUpdate(super, 1);
|
||||
} else {
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
InitAnimationForceUpdate(super, 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->interactType == 2) {
|
||||
this->action = 8;
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 8;
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
this->action = 4;
|
||||
sub_08067790(this);
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
super->action = 4;
|
||||
sub_08067790(super);
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
}
|
||||
this->interactType = 0;
|
||||
super->interactType = 0;
|
||||
SoundReq(SFX_VO_CAT);
|
||||
}
|
||||
|
||||
u32 sub_08067D20(Entity* this) {
|
||||
bool32 sub_08067D20(CatEntity* this) {
|
||||
s32 tmp;
|
||||
Entity* entity;
|
||||
int iVar4;
|
||||
if (this->field_0x74.HALF.HI != 0) {
|
||||
this->field_0x74.HALF.HI--;
|
||||
if (this->unk_75 != 0) {
|
||||
this->unk_75--;
|
||||
} else {
|
||||
entity = sub_08049DF4(2);
|
||||
if (entity != NULL) {
|
||||
iVar4 = this->spriteSettings.flipX ? 0x10 : 0x28;
|
||||
if (((u32)(entity->x.HALF.HI - (this->x.HALF.HI - iVar4)) < 0x31) &&
|
||||
((((u32)entity->y.HALF.HI) - (this->y.HALF.HI - 4)) < 0x39)) {
|
||||
return 1;
|
||||
iVar4 = super->spriteSettings.flipX ? 0x10 : 0x28;
|
||||
if (((u32)(entity->x.HALF.HI - (super->x.HALF.HI - iVar4)) < 0x31) &&
|
||||
((((u32)entity->y.HALF.HI) - (super->y.HALF.HI - 4)) < 0x39)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u32 sub_08067D74(Entity* this) {
|
||||
bool32 sub_08067D74(Entity* this) {
|
||||
Entity* entity;
|
||||
int iVar2;
|
||||
|
||||
@@ -438,16 +448,16 @@ u32 sub_08067D74(Entity* this) {
|
||||
if ((((u32)(entity->x.HALF.HI - (this->x.HALF.HI - iVar2)) < 0x1f) &&
|
||||
((u32)(entity->y.HALF.HI - this->y.HALF.HI) < 0x17)) &&
|
||||
(this->timer == 0)) {
|
||||
return 1;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_08067DCC(Entity* this, u32 param) {
|
||||
this->field_0x70.BYTES.byte1 = param;
|
||||
InitAnimationForceUpdate(this, param);
|
||||
void sub_08067DCC(CatEntity* this, u32 animIndex) {
|
||||
this->unk_71 = animIndex;
|
||||
InitAnimationForceUpdate(super, animIndex);
|
||||
}
|
||||
|
||||
void sub_08067DDC(Entity* this) {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* @brief Clothes Rack NPC
|
||||
*/
|
||||
#include "npc.h"
|
||||
#define NENT_DEPRECATED
|
||||
|
||||
void sub_0806DD90(Entity*);
|
||||
void sub_0806DEC8(Entity*);
|
||||
@@ -18,23 +19,22 @@ void ClothesRack(Entity* this) {
|
||||
}
|
||||
|
||||
void sub_0806DD90(Entity* this) {
|
||||
u32 uVar1;
|
||||
u32 uVar2;
|
||||
u32 animIndex;
|
||||
u32 x;
|
||||
u32 y;
|
||||
|
||||
this->action = 1;
|
||||
uVar2 = 0;
|
||||
animIndex = 0;
|
||||
if (CheckGlobalFlag(DRUG_1)) {
|
||||
uVar2 = 1;
|
||||
animIndex = 1;
|
||||
}
|
||||
if (CheckGlobalFlag(DRUG_2) != 0) {
|
||||
uVar2 = 2;
|
||||
if (CheckGlobalFlag(DRUG_2)) {
|
||||
animIndex = 2;
|
||||
}
|
||||
if (CheckGlobalFlag(DRUG_3) != 0) {
|
||||
uVar2 = 3;
|
||||
if (CheckGlobalFlag(DRUG_3)) {
|
||||
animIndex = 3;
|
||||
}
|
||||
InitializeAnimation(this, uVar2);
|
||||
InitializeAnimation(this, animIndex);
|
||||
x = this->x.HALF.HI;
|
||||
y = this->y.HALF.HI;
|
||||
SetTile(0x4072, TILE(x - 0x18, y - 0x10), this->collisionLayer);
|
||||
|
||||
+125
-116
@@ -4,196 +4,205 @@
|
||||
*
|
||||
* @brief Cow NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
#include "player.h"
|
||||
#include "sound.h"
|
||||
|
||||
void sub_0806920C(Entity* ent);
|
||||
void sub_0806924C(Entity* ent);
|
||||
void sub_08068FC0(Entity* ent);
|
||||
void sub_08069018(Entity* ent);
|
||||
void sub_08069068(Entity* ent);
|
||||
void sub_08069124(Entity* ent);
|
||||
void sub_080691E0(Entity* ent);
|
||||
void sub_08069148(Entity* ent);
|
||||
void sub_08069168(Entity* ent);
|
||||
void sub_08069188(Entity* ent);
|
||||
void sub_080691BC(Entity* ent);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u16 unk_68;
|
||||
/*0x6a*/ u16 unk_6a;
|
||||
/*0x6c*/ u8 fusionOffer;
|
||||
/*0x6d*/ u8 unk_6d;
|
||||
} CowEntity;
|
||||
|
||||
void Cow(Entity* ent) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void sub_0806920C(CowEntity* this);
|
||||
void sub_0806924C(CowEntity* this);
|
||||
void sub_08068FC0(CowEntity* this);
|
||||
void sub_08069018(CowEntity* this);
|
||||
void sub_08069068(CowEntity* this);
|
||||
void sub_08069124(CowEntity* this);
|
||||
void sub_080691E0(CowEntity* this);
|
||||
void sub_08069148(CowEntity* this);
|
||||
void sub_08069168(CowEntity* this);
|
||||
void sub_08069188(CowEntity* this);
|
||||
void sub_080691BC(CowEntity* this);
|
||||
|
||||
void Cow(CowEntity* this) {
|
||||
static void (*const actionFuncs[])(CowEntity*) = {
|
||||
sub_08068FC0, sub_08069018, sub_08069068, sub_08069124, sub_080691E0,
|
||||
};
|
||||
actionFuncs[ent->action](ent);
|
||||
sub_0806ED78(ent);
|
||||
sub_0806920C(ent);
|
||||
actionFuncs[super->action](this);
|
||||
sub_0806ED78(super);
|
||||
sub_0806920C(this);
|
||||
}
|
||||
|
||||
void sub_08068FC0(Entity* ent) {
|
||||
void sub_08068FC0(CowEntity* this) {
|
||||
u32 r2;
|
||||
|
||||
ent->action = 1;
|
||||
ent->animationState = ent->type2;
|
||||
ent->speed = 0x40;
|
||||
super->action = 1;
|
||||
super->animationState = super->type2;
|
||||
super->speed = 0x40;
|
||||
|
||||
ent->field_0x6c.HALF.HI = 0xFF;
|
||||
this->unk_6d = 0xff;
|
||||
|
||||
r2 = sub_0805ACC0(ent);
|
||||
r2 = sub_0805ACC0(super);
|
||||
if (r2 == 0) {
|
||||
u16 x, y;
|
||||
|
||||
x = ent->x.HALF.HI;
|
||||
*(u16*)&ent->field_0x68 = x;
|
||||
x = super->x.HALF.HI;
|
||||
this->unk_68 = x;
|
||||
|
||||
y = ent->y.HALF.HI;
|
||||
ent->field_0x6a.HWORD = y;
|
||||
y = super->y.HALF.HI;
|
||||
this->unk_6a = y;
|
||||
} else {
|
||||
u32 var1 = r2 >> 16;
|
||||
// 0x68+0x69 probably a SplitWord
|
||||
*(u16*)&ent->field_0x68 = var1;
|
||||
ent->field_0x6a.HWORD = r2;
|
||||
this->unk_68 = var1;
|
||||
this->unk_6a = r2;
|
||||
}
|
||||
ent->field_0x6c.HALF.LO = GetFusionToOffer(ent);
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
|
||||
InitAnimationForceUpdate(ent, ent->animationState + 4);
|
||||
InitAnimationForceUpdate(super, super->animationState + 4);
|
||||
}
|
||||
|
||||
void sub_08069018(Entity* ent) {
|
||||
void sub_08069018(CowEntity* this) {
|
||||
s32 var0;
|
||||
|
||||
if (ent->subAction == 0) {
|
||||
ent->subAction++;
|
||||
ent->subtimer = (Random() & 0x3F) + 0x3C;
|
||||
InitAnimationForceUpdate(ent, ent->animationState);
|
||||
if (super->subAction == 0) {
|
||||
super->subAction++;
|
||||
super->subtimer = (Random() & 0x3F) + 0x3C;
|
||||
InitAnimationForceUpdate(super, super->animationState);
|
||||
}
|
||||
|
||||
UpdateAnimationSingleFrame(ent);
|
||||
var0 = --ent->subtimer;
|
||||
UpdateAnimationSingleFrame(super);
|
||||
var0 = --super->subtimer;
|
||||
if (var0 == 0) {
|
||||
if (ent->timer == 0) {
|
||||
ent->action = 2;
|
||||
if (super->timer == 0) {
|
||||
super->action = 2;
|
||||
} else {
|
||||
ent->action = 3;
|
||||
super->action = 3;
|
||||
}
|
||||
ent->subAction = var0;
|
||||
super->subAction = var0;
|
||||
}
|
||||
|
||||
sub_0806924C(ent);
|
||||
sub_0806924C(this);
|
||||
}
|
||||
|
||||
void sub_08069068(Entity* ent) {
|
||||
void sub_08069068(CowEntity* this) {
|
||||
s32 var0;
|
||||
|
||||
if (ent->subAction == 0) {
|
||||
if (super->subAction == 0) {
|
||||
u32 anim;
|
||||
|
||||
ent->subAction++;
|
||||
super->subAction++;
|
||||
|
||||
anim = (Random() & 2) - 1;
|
||||
anim = (anim + ent->animationState) & 3;
|
||||
ent->animationState = anim;
|
||||
ent->direction = anim <<= 3;
|
||||
anim = (anim + super->animationState) & 3;
|
||||
super->animationState = anim;
|
||||
super->direction = anim <<= 3;
|
||||
|
||||
ent->subtimer = (Random() & 0x3F) + 60;
|
||||
InitAnimationForceUpdate(ent, ent->animationState + 4);
|
||||
super->subtimer = (Random() & 0x3F) + 60;
|
||||
InitAnimationForceUpdate(super, super->animationState + 4);
|
||||
}
|
||||
|
||||
ProcessMovement0(ent);
|
||||
UpdateAnimationSingleFrame(ent);
|
||||
ProcessMovement0(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
|
||||
{
|
||||
s32 x = ent->x.HALF.HI;
|
||||
s16* x2 = (s16*)&ent->field_0x68;
|
||||
s32 x = super->x.HALF.HI;
|
||||
s16* x2 = (s16*)&this->unk_68;
|
||||
x -= *x2;
|
||||
if (x > 16) {
|
||||
ent->x.HALF.HI = *x2 + 16;
|
||||
ent->subtimer = 1;
|
||||
super->x.HALF.HI = *x2 + 16;
|
||||
super->subtimer = 1;
|
||||
}
|
||||
if (x < -16) {
|
||||
ent->x.HALF.HI = *x2 - 16;
|
||||
ent->subtimer = 1;
|
||||
super->x.HALF.HI = *x2 - 16;
|
||||
super->subtimer = 1;
|
||||
}
|
||||
}
|
||||
{
|
||||
s32 y = ent->y.HALF.HI;
|
||||
s16* y2 = &ent->field_0x6a.HWORD;
|
||||
s32 y = super->y.HALF.HI;
|
||||
s16* y2 = &this->unk_6a;
|
||||
y -= *y2;
|
||||
if (y > 16) {
|
||||
ent->y.HALF.HI = *y2 + 16;
|
||||
ent->subtimer = 1;
|
||||
super->y.HALF.HI = *y2 + 16;
|
||||
super->subtimer = 1;
|
||||
}
|
||||
if (y < -16) {
|
||||
ent->y.HALF.HI = *y2 - 16;
|
||||
ent->subtimer = 1;
|
||||
super->y.HALF.HI = *y2 - 16;
|
||||
super->subtimer = 1;
|
||||
}
|
||||
}
|
||||
|
||||
var0 = --ent->subtimer;
|
||||
var0 = --super->subtimer;
|
||||
if (var0 == 0) {
|
||||
ent->action = 3;
|
||||
ent->subAction = var0;
|
||||
super->action = 3;
|
||||
super->subAction = var0;
|
||||
}
|
||||
|
||||
sub_0806924C(ent);
|
||||
sub_0806924C(this);
|
||||
}
|
||||
|
||||
void sub_08069124(Entity* ent) {
|
||||
static void (*const subActionFuncs[])(Entity*) = {
|
||||
void sub_08069124(CowEntity* this) {
|
||||
static void (*const subActionFuncs[])(CowEntity*) = {
|
||||
sub_08069148,
|
||||
sub_08069168,
|
||||
sub_08069188,
|
||||
sub_080691BC,
|
||||
};
|
||||
UpdateAnimationSingleFrame(ent);
|
||||
subActionFuncs[ent->subAction](ent);
|
||||
sub_0806924C(ent);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
subActionFuncs[super->subAction](this);
|
||||
sub_0806924C(this);
|
||||
}
|
||||
|
||||
void sub_08069148(Entity* ent) {
|
||||
void sub_08069148(CowEntity* this) {
|
||||
u32 var0 = Random() & 3;
|
||||
var0 += 3;
|
||||
ent->subtimer = var0;
|
||||
ent->subAction = 1;
|
||||
InitAnimationForceUpdate(ent, ent->animationState + 8);
|
||||
super->subtimer = var0;
|
||||
super->subAction = 1;
|
||||
InitAnimationForceUpdate(super, super->animationState + 8);
|
||||
}
|
||||
|
||||
void sub_08069168(Entity* ent) {
|
||||
if ((s8)ent->frame < 0) {
|
||||
ent->subAction = 2;
|
||||
InitAnimationForceUpdate(ent, ent->animationState + 12);
|
||||
void sub_08069168(CowEntity* this) {
|
||||
if ((s8)super->frame < 0) {
|
||||
super->subAction = 2;
|
||||
InitAnimationForceUpdate(super, super->animationState + 12);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069188(Entity* ent) {
|
||||
if ((ent->frame & 1) == 0)
|
||||
void sub_08069188(CowEntity* this) {
|
||||
if ((super->frame & 1) == 0)
|
||||
return;
|
||||
ent->frame = 0;
|
||||
super->frame = 0;
|
||||
|
||||
if (--ent->subtimer != 0)
|
||||
if (--super->subtimer != 0)
|
||||
return;
|
||||
ent->subAction = 3;
|
||||
InitAnimationForceUpdate(ent, ent->animationState + 16);
|
||||
super->subAction = 3;
|
||||
InitAnimationForceUpdate(super, super->animationState + 16);
|
||||
}
|
||||
|
||||
void sub_080691BC(Entity* ent) {
|
||||
if ((s8)ent->frame < 0) {
|
||||
ent->action = 1;
|
||||
ent->subAction = 0;
|
||||
InitAnimationForceUpdate(ent, ent->animationState + 4);
|
||||
void sub_080691BC(CowEntity* this) {
|
||||
if ((s8)super->frame < 0) {
|
||||
super->action = 1;
|
||||
super->subAction = 0;
|
||||
InitAnimationForceUpdate(super, super->animationState + 4);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080691E0(Entity* ent) {
|
||||
if (UpdateFuseInteraction(ent) != 0) {
|
||||
ent->action = 1;
|
||||
ent->subAction = 0;
|
||||
void sub_080691E0(CowEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
super->subAction = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Show dialogue
|
||||
void Cow_ShowDialogue(Entity* ent) {
|
||||
void Cow_ShowDialogue(CowEntity* this) {
|
||||
static const Dialog gUnk_08111938[] = {
|
||||
{ 0x0, 0x0, DIALOG_MINISH, 1, { TEXT_INDEX(TEXT_LON_LON, 0X18), TEXT_INDEX(TEXT_TINGLE, 0x34) } },
|
||||
{ 0x0, 0x0, DIALOG_MINISH, 1, { TEXT_INDEX(TEXT_LON_LON, 0X18), TEXT_INDEX(TEXT_TINGLE, 0x35) } },
|
||||
@@ -201,10 +210,10 @@ void Cow_ShowDialogue(Entity* ent) {
|
||||
{ 0x0, 0x0, DIALOG_MINISH, 1, { TEXT_INDEX(TEXT_LON_LON, 0X18), TEXT_INDEX(TEXT_TINGLE, 0x37) } },
|
||||
{ 0x0, 0x0, DIALOG_MINISH, 1, { TEXT_INDEX(TEXT_LON_LON, 0X18), TEXT_INDEX(TEXT_TINGLE, 0x38) } }
|
||||
};
|
||||
ShowNPCDialogue(ent, &gUnk_08111938[ent->type]);
|
||||
ShowNPCDialogue(super, &gUnk_08111938[super->type]);
|
||||
}
|
||||
|
||||
void sub_0806920C(Entity* ent) {
|
||||
void sub_0806920C(CowEntity* this) {
|
||||
u32 var1;
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
var1 = TRUE;
|
||||
@@ -212,43 +221,43 @@ void sub_0806920C(Entity* ent) {
|
||||
var1 = FALSE;
|
||||
}
|
||||
|
||||
if (var1 != ent->field_0x6c.HALF.HI) {
|
||||
if (var1 != this->unk_6d) {
|
||||
if (var1 == 0) {
|
||||
AddInteractableWhenBigObject(ent);
|
||||
AddInteractableWhenBigObject(super);
|
||||
} else {
|
||||
AddInteractableAsMinishFuser(ent, ent->field_0x6c.HALF.LO);
|
||||
AddInteractableAsMinishFuser(super, this->fusionOffer);
|
||||
}
|
||||
}
|
||||
|
||||
ent->field_0x6c.HALF.HI = var1;
|
||||
this->unk_6d = var1;
|
||||
}
|
||||
|
||||
// Check if player interacting
|
||||
void sub_0806924C(Entity* ent) {
|
||||
s8 itype = ent->interactType;
|
||||
void sub_0806924C(CowEntity* this) {
|
||||
s8 itype = super->interactType;
|
||||
if (itype != 0) {
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
if (itype == 2) {
|
||||
ent->action = 4;
|
||||
sub_0806F118(ent);
|
||||
super->action = 4;
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
Cow_ShowDialogue(ent);
|
||||
Cow_ShowDialogue(this);
|
||||
}
|
||||
} else {
|
||||
Cow_ShowDialogue(ent);
|
||||
Cow_ShowDialogue(this);
|
||||
ResetPlayerAnimationAndAction();
|
||||
}
|
||||
SoundReq(SFX_VO_COW);
|
||||
ent->interactType = 0;
|
||||
super->interactType = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Cow_Fusion(Entity* ent) {
|
||||
if (ent->action == 0) {
|
||||
ent->action++;
|
||||
ent->spriteSettings.draw = 1;
|
||||
InitAnimationForceUpdate(ent, 15);
|
||||
void Cow_Fusion(CowEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
super->spriteSettings.draw = 1;
|
||||
InitAnimationForceUpdate(super, 15);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(ent);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
}
|
||||
|
||||
+56
-50
@@ -4,99 +4,105 @@
|
||||
*
|
||||
* @brief Cucco NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "kinstone.h"
|
||||
#include "npc.h"
|
||||
|
||||
void (*const Cucco_Actions[])(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} CuccoEntity;
|
||||
|
||||
void (*const Cucco_Actions[])(CuccoEntity*);
|
||||
const u16 Cucco_Sounds[];
|
||||
const u16 Cucco_Messages[];
|
||||
|
||||
void sub_0806E4EC(Entity*);
|
||||
void sub_0806E4EC(CuccoEntity*);
|
||||
void Cucco_ShowMessage(Entity*);
|
||||
void sub_0806E65C(Entity* this);
|
||||
|
||||
void Cucco(Entity* this) {
|
||||
Cucco_Actions[this->action](this);
|
||||
void Cucco(CuccoEntity* this) {
|
||||
Cucco_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void Cucco_Init(Entity* this) {
|
||||
this->action++;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO);
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
this->subAction = 0;
|
||||
void Cucco_Init(CuccoEntity* this) {
|
||||
super->action++;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableAsMinishFuser(super, this->fusionOffer);
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
super->subAction = 0;
|
||||
sub_0806E4EC(this);
|
||||
}
|
||||
|
||||
void sub_0806E4EC(Entity* this) {
|
||||
if (this->subAction == 0) {
|
||||
this->subAction++;
|
||||
this->timer = (Random() & 0x1f) + 60;
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
void sub_0806E4EC(CuccoEntity* this) {
|
||||
if (super->subAction == 0) {
|
||||
super->subAction++;
|
||||
super->timer = (Random() & 0x1f) + 60;
|
||||
InitAnimationForceUpdate(super, 0);
|
||||
}
|
||||
if (--this->timer == 0) {
|
||||
if (--super->timer == 0) {
|
||||
if ((Random() & 1) != 0) {
|
||||
this->action = 3;
|
||||
super->action = 3;
|
||||
} else {
|
||||
this->action = 2;
|
||||
super->action = 2;
|
||||
}
|
||||
this->subAction = 0;
|
||||
super->subAction = 0;
|
||||
if ((Random() & 1) != 0) {
|
||||
EnqueueSFX(Cucco_Sounds[Random() & 3]);
|
||||
}
|
||||
}
|
||||
sub_0806E65C(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
sub_0806E65C(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
void Cucco_Fly(Entity* this) {
|
||||
if (this->subAction == 0) {
|
||||
this->subAction++;
|
||||
void Cucco_Fly(CuccoEntity* this) {
|
||||
if (super->subAction == 0) {
|
||||
super->subAction++;
|
||||
if (Random() & 1) {
|
||||
this->spriteSettings.flipX ^= 1;
|
||||
super->spriteSettings.flipX ^= 1;
|
||||
}
|
||||
|
||||
this->timer = (Random() & 1) + 1;
|
||||
this->zVelocity = Q_16_16(1.5);
|
||||
InitAnimationForceUpdate(this, 1);
|
||||
super->timer = (Random() & 1) + 1;
|
||||
super->zVelocity = Q_16_16(1.5);
|
||||
InitAnimationForceUpdate(super, 1);
|
||||
}
|
||||
|
||||
if (GravityUpdate(this, Q_8_8(40.0)) == 0) {
|
||||
if (--this->timer == 0) {
|
||||
this->action = 1;
|
||||
this->subAction = 0;
|
||||
if (GravityUpdate(super, Q_8_8(40.0)) == 0) {
|
||||
if (--super->timer == 0) {
|
||||
super->action = 1;
|
||||
super->subAction = 0;
|
||||
} else {
|
||||
this->zVelocity = Q_16_16(1.5);
|
||||
super->zVelocity = Q_16_16(1.5);
|
||||
}
|
||||
}
|
||||
|
||||
sub_0806E65C(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
sub_0806E65C(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
void Cucco_Idle(Entity* this) {
|
||||
if (this->subAction == 0) {
|
||||
this->subAction++;
|
||||
void Cucco_Idle(CuccoEntity* this) {
|
||||
if (super->subAction == 0) {
|
||||
super->subAction++;
|
||||
if (Random() & 1) {
|
||||
this->spriteSettings.flipX ^= 1;
|
||||
super->spriteSettings.flipX ^= 1;
|
||||
}
|
||||
|
||||
InitAnimationForceUpdate(this, (Random() & 1) + 2);
|
||||
InitAnimationForceUpdate(super, (Random() & 1) + 2);
|
||||
}
|
||||
|
||||
if (this->frame & ANIM_DONE) {
|
||||
this->action = 1;
|
||||
this->subAction = 0;
|
||||
if (super->frame & ANIM_DONE) {
|
||||
super->action = 1;
|
||||
super->subAction = 0;
|
||||
}
|
||||
|
||||
sub_0806E65C(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
sub_0806E65C(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
void sub_0806E648(Entity* this) {
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
void sub_0806E648(CuccoEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +111,7 @@ void sub_0806E65C(Entity* this) {
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 4;
|
||||
sub_0806F118(this);
|
||||
InitializeNPCFusion(this);
|
||||
} else {
|
||||
Cucco_ShowMessage(this);
|
||||
}
|
||||
@@ -137,7 +143,7 @@ void Cucco_Fusion(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void (*const Cucco_Actions[])(Entity*) = {
|
||||
void (*const Cucco_Actions[])(CuccoEntity*) = {
|
||||
Cucco_Init, sub_0806E4EC, Cucco_Fly, Cucco_Idle, sub_0806E648,
|
||||
};
|
||||
|
||||
|
||||
+60
-54
@@ -4,47 +4,53 @@
|
||||
*
|
||||
* @brief Cucco Chick NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
|
||||
void CuccoChick_Init(Entity*);
|
||||
void sub_0806E764(Entity*);
|
||||
void CuccoChick_Fly(Entity*);
|
||||
void sub_0806E824(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} CuccoChickEntity;
|
||||
|
||||
void sub_0806E838(Entity* this);
|
||||
void CuccoChick_Init(CuccoChickEntity*);
|
||||
void sub_0806E764(CuccoChickEntity*);
|
||||
void CuccoChick_Fly(CuccoChickEntity*);
|
||||
void sub_0806E824(CuccoChickEntity*);
|
||||
|
||||
void sub_0806E884(Entity* this);
|
||||
void sub_0806E838(CuccoChickEntity* this);
|
||||
|
||||
void CuccoChick(Entity* this) {
|
||||
static void (*const CuccoChick_Actions[])(Entity*) = {
|
||||
void sub_0806E884(CuccoChickEntity* this);
|
||||
|
||||
void CuccoChick(CuccoChickEntity* this) {
|
||||
static void (*const CuccoChick_Actions[])(CuccoChickEntity*) = {
|
||||
CuccoChick_Init,
|
||||
sub_0806E764,
|
||||
CuccoChick_Fly,
|
||||
sub_0806E824,
|
||||
};
|
||||
CuccoChick_Actions[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
CuccoChick_Actions[super->action](this);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
|
||||
void CuccoChick_Init(Entity* this) {
|
||||
this->action++;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO);
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
this->subAction = 0;
|
||||
void CuccoChick_Init(CuccoChickEntity* this) {
|
||||
super->action++;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableAsMinishFuser(super, this->fusionOffer);
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
super->subAction = 0;
|
||||
sub_0806E764(this);
|
||||
}
|
||||
|
||||
void sub_0806E764(Entity* this) {
|
||||
if (this->subAction == 0) {
|
||||
this->subAction++;
|
||||
this->timer = (Random() & 0x1f) + 30;
|
||||
this->frameIndex = 0;
|
||||
void sub_0806E764(CuccoChickEntity* this) {
|
||||
if (super->subAction == 0) {
|
||||
super->subAction++;
|
||||
super->timer = (Random() & 0x1f) + 30;
|
||||
super->frameIndex = 0;
|
||||
}
|
||||
if (--this->timer == 0) {
|
||||
this->action = 2;
|
||||
this->subAction = 0;
|
||||
if (--super->timer == 0) {
|
||||
super->action = 2;
|
||||
super->subAction = 0;
|
||||
if ((Random() & 1) != 0) {
|
||||
EnqueueSFX(SFX_VO_CHEEP);
|
||||
}
|
||||
@@ -52,39 +58,39 @@ void sub_0806E764(Entity* this) {
|
||||
sub_0806E838(this);
|
||||
}
|
||||
|
||||
void CuccoChick_Fly(Entity* this) {
|
||||
if (this->subAction == 0) {
|
||||
this->subAction++;
|
||||
void CuccoChick_Fly(CuccoChickEntity* this) {
|
||||
if (super->subAction == 0) {
|
||||
super->subAction++;
|
||||
if ((Random() & 1) != 0) {
|
||||
this->spriteSettings.flipX ^= 1;
|
||||
super->spriteSettings.flipX ^= 1;
|
||||
}
|
||||
this->timer = (Random() & 3) + 1;
|
||||
this->zVelocity = Q_16_16(1.0);
|
||||
this->frameIndex = 1;
|
||||
super->timer = (Random() & 3) + 1;
|
||||
super->zVelocity = Q_16_16(1.0);
|
||||
super->frameIndex = 1;
|
||||
}
|
||||
if (GravityUpdate(this, Q_8_8(48.0)) == 0) {
|
||||
if (--this->timer == 0) {
|
||||
this->action = 1;
|
||||
this->subAction = 0;
|
||||
if (GravityUpdate(super, Q_8_8(48.0)) == 0) {
|
||||
if (--super->timer == 0) {
|
||||
super->action = 1;
|
||||
super->subAction = 0;
|
||||
} else {
|
||||
this->zVelocity = Q_16_16(1.0);
|
||||
super->zVelocity = Q_16_16(1.0);
|
||||
}
|
||||
}
|
||||
sub_0806E838(this);
|
||||
}
|
||||
|
||||
void sub_0806E824(Entity* this) {
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
void sub_0806E824(CuccoChickEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806E838(Entity* this) {
|
||||
if (this->interactType != 0) {
|
||||
void sub_0806E838(CuccoChickEntity* this) {
|
||||
if (super->interactType != 0) {
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 3;
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 3;
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0806E884(this);
|
||||
}
|
||||
@@ -92,22 +98,22 @@ void sub_0806E838(Entity* this) {
|
||||
ResetPlayerAnimationAndAction();
|
||||
}
|
||||
SoundReq(SFX_VO_CHEEP);
|
||||
this->interactType = 0;
|
||||
super->interactType = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806E884(Entity* this) {
|
||||
MessageNoOverlap(TEXT_INDEX(TEXT_MINISH, 0xB6), this);
|
||||
void sub_0806E884(CuccoChickEntity* this) {
|
||||
MessageNoOverlap(TEXT_INDEX(TEXT_MINISH, 0xB6), super);
|
||||
}
|
||||
|
||||
void CuccoChick_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->frameIndex = 1;
|
||||
void CuccoChick_Fusion(CuccoChickEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->frameIndex = 1;
|
||||
} else {
|
||||
if (GravityUpdate(this, Q_8_8(48.0)) == 0) {
|
||||
this->zVelocity = Q_16_16(1.0);
|
||||
if (GravityUpdate(super, Q_8_8(48.0)) == 0) {
|
||||
super->zVelocity = Q_16_16(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
-7
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Dampe NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "item.h"
|
||||
@@ -12,22 +13,28 @@
|
||||
#include "player.h"
|
||||
#include "room.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} DampeEntity;
|
||||
|
||||
void Dampe(Entity* this) {
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
return;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
|
||||
sub_0806F118(this);
|
||||
InitAnimationForceUpdate(this,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity)) + 4);
|
||||
InitializeNPCFusion(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
return;
|
||||
case 2:
|
||||
@@ -38,9 +45,9 @@ void Dampe(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void Dampe_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Dampe_MakeInteractable(DampeEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Dampe_Fusion(Entity* this) {
|
||||
|
||||
+22
-15
@@ -4,32 +4,39 @@
|
||||
*
|
||||
* @brief Din NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "kinstone.h"
|
||||
#include "npc.h"
|
||||
|
||||
void Din(Entity* this) {
|
||||
switch (this->action) {
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 animIndex;
|
||||
} DinEntity;
|
||||
|
||||
void Din(DinEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
sub_0807DD50(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
InitScriptForNPC(super);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
this->field_0x68.HALF.LO = this->animIndex;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
this->animIndex = super->animIndex;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, this->field_0x68.HALF.LO);
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
InitAnimationForceUpdate(super, this->animIndex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+169
-156
@@ -4,21 +4,34 @@
|
||||
*
|
||||
* @brief Dog NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "collision.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
|
||||
void sub_08069FE8(Entity*);
|
||||
bool32 sub_08069EF0(Entity*);
|
||||
bool32 sub_08069F90(Entity*);
|
||||
void sub_08069F6C(Entity*);
|
||||
void sub_08069D00(Entity*);
|
||||
void sub_08069CB8(Entity*);
|
||||
void sub_0806A028(Entity*);
|
||||
void sub_08069FBC(Entity*);
|
||||
void sub_0806A080(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u16 unk_68;
|
||||
/*0x6a*/ u8 unk_6a;
|
||||
/*0x6b*/ u8 unk_6b;
|
||||
/*0x6c*/ u16 unk_6c;
|
||||
/*0x6e*/ u16 unk_6e;
|
||||
/*0x70*/ u16 unk_70;
|
||||
/*0x72*/ u16 unk_72;
|
||||
/*0x74*/ u8 unk_74;
|
||||
} DogEntity;
|
||||
|
||||
void sub_08069FE8(DogEntity*);
|
||||
bool32 sub_08069EF0(DogEntity*);
|
||||
bool32 sub_08069F90(DogEntity*);
|
||||
void sub_08069F6C(DogEntity*);
|
||||
void sub_08069D00(DogEntity*);
|
||||
void sub_08069CB8(DogEntity*);
|
||||
void sub_0806A028(DogEntity*);
|
||||
void sub_08069FBC(DogEntity*);
|
||||
void sub_0806A080(DogEntity*);
|
||||
|
||||
const SpriteLoadData gUnk_08111D58[] = {
|
||||
#ifdef EU
|
||||
@@ -29,15 +42,15 @@ const SpriteLoadData gUnk_08111D58[] = {
|
||||
{ 4, 68, 4 }, { 7172, 68, 4 }, { 0, 0, 0 }, { 83, 69, 4 }, { 7251, 69, 4 }, { 0, 0, 0 },
|
||||
};
|
||||
|
||||
void sub_08069B44(Entity*);
|
||||
void sub_08069C40(Entity*);
|
||||
void sub_08069D54(Entity*);
|
||||
void sub_08069DF8(Entity*);
|
||||
void sub_08069E44(Entity*);
|
||||
void sub_08069E50(Entity*);
|
||||
void sub_08069ECC(Entity*);
|
||||
void sub_08069EE0(Entity*);
|
||||
void (*const gUnk_08111D88[])(Entity*) = {
|
||||
void sub_08069B44(DogEntity*);
|
||||
void sub_08069C40(DogEntity*);
|
||||
void sub_08069D54(DogEntity*);
|
||||
void sub_08069DF8(DogEntity*);
|
||||
void sub_08069E44(DogEntity*);
|
||||
void sub_08069E50(DogEntity*);
|
||||
void sub_08069ECC(DogEntity*);
|
||||
void sub_08069EE0(DogEntity*);
|
||||
void (*const gUnk_08111D88[])(DogEntity*) = {
|
||||
sub_08069B44, sub_08069C40, sub_08069D54, sub_08069DF8, sub_08069E44, sub_08069E50, sub_08069ECC, sub_08069EE0,
|
||||
};
|
||||
|
||||
@@ -181,254 +194,254 @@ const u16 gUnk_08111FD8[] = {
|
||||
TEXT_INDEX(TEXT_TOWN8, 0x7), TEXT_INDEX(TEXT_TOWN8, 0x8), TEXT_INDEX(TEXT_TOWN8, 0x9),
|
||||
TEXT_INDEX(TEXT_TOWN8, 0x11), TEXT_INDEX(TEXT_TOWN8, 0x3),
|
||||
};
|
||||
void Dog(Entity* this) {
|
||||
gUnk_08111D88[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
void Dog(DogEntity* this) {
|
||||
gUnk_08111D88[super->action](this);
|
||||
sub_0806ED78(super);
|
||||
sub_08069FE8(this);
|
||||
}
|
||||
|
||||
void sub_08069B44(Entity* this) {
|
||||
void sub_08069B44(DogEntity* this) {
|
||||
u32 uVar2;
|
||||
u32 sVar3;
|
||||
u32 uVar4;
|
||||
u32 uVar5;
|
||||
if (sub_08069EF0(this)) {
|
||||
uVar5 = sub_0805ACC0(this);
|
||||
uVar5 = sub_0805ACC0(super);
|
||||
if (uVar5 == 0) {
|
||||
sVar3 = this->x.HALF.HI;
|
||||
uVar2 = this->y.HALF.HI;
|
||||
sVar3 = super->x.HALF.HI;
|
||||
uVar2 = super->y.HALF.HI;
|
||||
} else {
|
||||
sVar3 = uVar5 >> 0x10;
|
||||
uVar2 = uVar5;
|
||||
}
|
||||
|
||||
uVar4 = this->timer == 0 ? 0x20 : this->timer;
|
||||
uVar4 = super->timer == 0 ? 0x20 : super->timer;
|
||||
|
||||
this->field_0x6e.HWORD = sVar3 - uVar4;
|
||||
this->field_0x6c.HWORD = sVar3 + uVar4;
|
||||
this->field_0x70.HALF.LO = uVar2 - 8;
|
||||
this->field_0x70.HALF.HI = uVar2 + 8;
|
||||
this->speed = 0x100;
|
||||
this->timer = 30;
|
||||
this->animationState = 2;
|
||||
this->field_0x6a.HALF.LO = 0xff;
|
||||
this->field_0x74.HALF.LO = GetFusionToOffer(this);
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
InitAnimationForceUpdate(this, 10);
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
sub_0807DD50(this);
|
||||
this->unk_6e = sVar3 - uVar4;
|
||||
this->unk_6c = sVar3 + uVar4;
|
||||
this->unk_70 = uVar2 - 8;
|
||||
this->unk_72 = uVar2 + 8;
|
||||
super->speed = 0x100;
|
||||
super->timer = 30;
|
||||
super->animationState = 2;
|
||||
this->unk_6a = 0xff;
|
||||
this->unk_74 = GetFusionToOffer(super);
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitAnimationForceUpdate(super, 10);
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
if (((this->type == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) &&
|
||||
if (((super->type == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) &&
|
||||
(GetInventoryValue(ITEM_QST_DOGFOOD) != 2)) {
|
||||
this->action = 4;
|
||||
super->action = 4;
|
||||
}
|
||||
if ((this->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) {
|
||||
SetTile(0x4072, TILE(this->x.HALF.HI, this->y.HALF.HI - 8), this->collisionLayer);
|
||||
if ((super->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) {
|
||||
SetTile(0x4072, TILE(super->x.HALF.HI, super->y.HALF.HI - 8), super->collisionLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069C40(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
void sub_08069C40(DogEntity* this) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if (sub_08069F90(this)) {
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
sub_08069CB8(this);
|
||||
} else {
|
||||
this->animationState = GetAnimationState(this);
|
||||
super->animationState = GetAnimationState(super);
|
||||
sub_08069D00(this);
|
||||
}
|
||||
this->timer = 30;
|
||||
super->timer = 30;
|
||||
} else {
|
||||
this->timer--;
|
||||
if (this->timer == 0) {
|
||||
this->action = 2;
|
||||
this->timer = (Random() & 0x1f) + 30;
|
||||
this->direction = gUnk_08111DA8[Random() & 7];
|
||||
super->timer--;
|
||||
if (super->timer == 0) {
|
||||
super->action = 2;
|
||||
super->timer = (Random() & 0x1f) + 30;
|
||||
super->direction = gUnk_08111DA8[Random() & 7];
|
||||
sub_08069F6C(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069CB8(Entity* this) {
|
||||
void sub_08069CB8(DogEntity* this) {
|
||||
u32 direction;
|
||||
u32 animState;
|
||||
|
||||
direction = GetFacingDirection(this, &gPlayerEntity);
|
||||
animState = gUnk_08111DB0[direction + this->animationState * 0x20];
|
||||
this->animationState = animState >> 6;
|
||||
this->field_0x6a.HALF.HI = animState & 0x3f;
|
||||
direction = GetFacingDirection(super, &gPlayerEntity);
|
||||
animState = gUnk_08111DB0[direction + super->animationState * 0x20];
|
||||
super->animationState = animState >> 6;
|
||||
this->unk_6b = animState & 0x3f;
|
||||
sub_0806A028(this);
|
||||
if (this->animIndex != this->field_0x6a.HALF.HI) {
|
||||
InitAnimationForceUpdate(this, this->field_0x6a.HALF.HI);
|
||||
if (super->animIndex != this->unk_6b) {
|
||||
InitAnimationForceUpdate(super, this->unk_6b);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069D00(Entity* this) {
|
||||
this->field_0x6a.HALF.HI = 8;
|
||||
void sub_08069D00(DogEntity* this) {
|
||||
this->unk_6b = 8;
|
||||
sub_0806A028(this);
|
||||
if (0x1f < this->animIndex) {
|
||||
if ((this->frame & ANIM_DONE) == 0) {
|
||||
if (0x1f < super->animIndex) {
|
||||
if ((super->frame & ANIM_DONE) == 0) {
|
||||
return;
|
||||
}
|
||||
this->field_0x6a.HALF.HI = 8;
|
||||
this->unk_6b = 8;
|
||||
}
|
||||
if ((Random() & 0x1ff) < 3) {
|
||||
sub_08069FBC(this);
|
||||
}
|
||||
if (this->animIndex != this->field_0x6a.HALF.HI + this->animationState) {
|
||||
InitAnimationForceUpdate(this, this->field_0x6a.HALF.HI + this->animationState);
|
||||
if (super->animIndex != this->unk_6b + super->animationState) {
|
||||
InitAnimationForceUpdate(super, this->unk_6b + super->animationState);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069D54(Entity* this) {
|
||||
void sub_08069D54(DogEntity* this) {
|
||||
u16 collisions;
|
||||
if (!sub_08069F90(this)) {
|
||||
this->timer--;
|
||||
if (this->timer != 0) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
ProcessMovement0(this);
|
||||
collisions = this->collisions;
|
||||
super->timer--;
|
||||
if (super->timer != 0) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
ProcessMovement0(super);
|
||||
collisions = super->collisions;
|
||||
|
||||
if (this->x.HALF.HI < this->field_0x6e.HWORD) {
|
||||
this->x.HALF.HI = this->field_0x6e.HWORD + 1;
|
||||
if (super->x.HALF.HI < this->unk_6e) {
|
||||
super->x.HALF.HI = this->unk_6e + 1;
|
||||
collisions = COL_WEST_ANY;
|
||||
} else if (this->x.HALF.HI > this->field_0x6c.HWORD) {
|
||||
this->x.HALF.HI = this->field_0x6c.HWORD - 1;
|
||||
} else if (super->x.HALF.HI > this->unk_6c) {
|
||||
super->x.HALF.HI = this->unk_6c - 1;
|
||||
collisions = COL_EAST_ANY;
|
||||
}
|
||||
if (this->y.HALF.HI < this->field_0x70.HALF_U.LO) {
|
||||
this->y.HALF.HI = this->field_0x70.HALF_U.LO + 1;
|
||||
if (super->y.HALF.HI < this->unk_70) {
|
||||
super->y.HALF.HI = this->unk_70 + 1;
|
||||
collisions = COL_NORTH_ANY;
|
||||
} else if (this->y.HALF.HI > this->field_0x70.HALF_U.HI) {
|
||||
this->y.HALF.HI = this->field_0x70.HALF_U.HI - 1;
|
||||
} else if (super->y.HALF.HI > this->unk_72) {
|
||||
super->y.HALF.HI = this->unk_72 - 1;
|
||||
collisions = COL_SOUTH_ANY;
|
||||
}
|
||||
sub_0800417E(this, collisions);
|
||||
sub_0800417E(super, collisions);
|
||||
sub_08069F6C(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (sub_08069F90(this)) {
|
||||
this->action = 1;
|
||||
super->action = 1;
|
||||
} else {
|
||||
this->action = 3;
|
||||
super->action = 3;
|
||||
}
|
||||
this->timer = (Random() & 0x1f) + 30;
|
||||
super->timer = (Random() & 0x1f) + 30;
|
||||
}
|
||||
|
||||
void sub_08069DF8(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
void sub_08069DF8(DogEntity* this) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if (sub_08069F90(this)) {
|
||||
this->action = 1;
|
||||
super->action = 1;
|
||||
} else {
|
||||
this->timer--;
|
||||
if (this->timer != 0) {
|
||||
super->timer--;
|
||||
if (super->timer != 0) {
|
||||
sub_08069D00(this);
|
||||
return;
|
||||
}
|
||||
if ((Random() & 0xff) < 0x30) {
|
||||
this->action = 2;
|
||||
super->action = 2;
|
||||
} else {
|
||||
this->action = 3;
|
||||
super->action = 3;
|
||||
}
|
||||
}
|
||||
this->timer = (Random() & 0x1f) + 30;
|
||||
super->timer = (Random() & 0x1f) + 30;
|
||||
}
|
||||
|
||||
void sub_08069E44(Entity* this) {
|
||||
sub_0807DD94(this, NULL);
|
||||
void sub_08069E44(DogEntity* this) {
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
|
||||
void sub_08069E50(Entity* this) {
|
||||
this->animationState = GetAnimationState(this);
|
||||
this->field_0x6a.HALF.HI = 8;
|
||||
void sub_08069E50(DogEntity* this) {
|
||||
super->animationState = GetAnimationState(super);
|
||||
this->unk_6b = 8;
|
||||
sub_0806A028(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->animIndex > 0x1f) {
|
||||
if ((this->frame & ANIM_DONE) == 0) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if (super->animIndex > 0x1f) {
|
||||
if ((super->frame & ANIM_DONE) == 0) {
|
||||
return;
|
||||
}
|
||||
this->field_0x6a.HALF.HI = 8;
|
||||
this->unk_6b = 8;
|
||||
}
|
||||
sub_08069FBC(this);
|
||||
if (this->animIndex != this->field_0x6a.HALF.HI + this->animationState) {
|
||||
InitAnimationForceUpdate(this, this->field_0x6a.HALF.HI + this->animationState);
|
||||
if (super->animIndex != this->unk_6b + super->animationState) {
|
||||
InitAnimationForceUpdate(super, this->unk_6b + super->animationState);
|
||||
}
|
||||
if (GetInventoryValue(ITEM_QST_DOGFOOD) == 2) {
|
||||
this->action = 7;
|
||||
InitAnimationForceUpdate(this, 0x29);
|
||||
RemoveInteractableObject(this);
|
||||
super->action = 7;
|
||||
InitAnimationForceUpdate(super, 0x29);
|
||||
RemoveInteractableObject(super);
|
||||
EnqueueSFX(SFX_VO_DOG);
|
||||
EnqueueSFX(SFX_TASK_COMPLETE);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069ECC(Entity* this) {
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
void sub_08069ECC(DogEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
#ifdef EU
|
||||
if (GetInventoryValue(ITEM_QST_DOGFOOD) != 2) {
|
||||
this->action = 5;
|
||||
super->action = 5;
|
||||
} else {
|
||||
this->action = 1;
|
||||
super->action = 1;
|
||||
}
|
||||
#else
|
||||
this->action = 1;
|
||||
super->action = 1;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069EE0(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
void sub_08069EE0(DogEntity* this) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
void sub_08069EE8(Entity* this) {
|
||||
this->action = 5;
|
||||
void sub_08069EE8(DogEntity* this) {
|
||||
super->action = 5;
|
||||
}
|
||||
|
||||
bool32 sub_08069EF0(Entity* this) {
|
||||
if (!LoadExtraSpriteData(this, &gUnk_08111D58[this->type * 3])) {
|
||||
bool32 sub_08069EF0(DogEntity* this) {
|
||||
if (!LoadExtraSpriteData(super, &gUnk_08111D58[super->type * 3])) {
|
||||
return FALSE;
|
||||
}
|
||||
this->action = 1;
|
||||
this->field_0x68.HWORD = gUnk_08111E30[this->type];
|
||||
super->action = 1;
|
||||
this->unk_68 = gUnk_08111E30[super->type];
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Dog_Head(Entity* this) {
|
||||
void Dog_Head(DogEntity* this) {
|
||||
u32 frame;
|
||||
frame = this->frame & ~ANIM_DONE;
|
||||
frame = super->frame & ~ANIM_DONE;
|
||||
if (frame != 0) {
|
||||
frame += this->field_0x68.HWORD;
|
||||
frame += this->unk_68;
|
||||
}
|
||||
SetExtraSpriteFrame(this, 0, frame - 1);
|
||||
SetExtraSpriteFrame(this, 1, this->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
sub_0807000C(this);
|
||||
SetExtraSpriteFrame(super, 0, frame - 1);
|
||||
SetExtraSpriteFrame(super, 1, super->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(super, 1, 0);
|
||||
sub_0807000C(super);
|
||||
}
|
||||
|
||||
void sub_08069F6C(Entity* this) {
|
||||
this->animationState = sub_0806F5A4(this->direction);
|
||||
if (this->animationState + 4 != this->animIndex) {
|
||||
InitAnimationForceUpdate(this, this->animationState + 4);
|
||||
void sub_08069F6C(DogEntity* this) {
|
||||
super->animationState = GetAnimationStateForDirection4(super->direction);
|
||||
if (super->animationState + 4 != super->animIndex) {
|
||||
InitAnimationForceUpdate(super, super->animationState + 4);
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_08069F90(Entity* this) {
|
||||
if ((this->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) {
|
||||
bool32 sub_08069F90(DogEntity* this) {
|
||||
if ((super->type == 2) && (CheckLocalFlag(MACHI_02_DOG) == 0)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
return EntityInRectRadius(this, &gPlayerEntity, 0x14, 0x14);
|
||||
return EntityInRectRadius(super, &gPlayerEntity, 0x14, 0x14);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069FBC(Entity* this) {
|
||||
void sub_08069FBC(DogEntity* this) {
|
||||
u32 tmp = (gPlayerState.flags & PL_MINISH) != 0 ? 0x24 : 0x20;
|
||||
if ((this->animationState == 1) || (this->animationState == 3)) {
|
||||
this->field_0x6a.HALF.HI = tmp;
|
||||
if ((super->animationState == 1) || (super->animationState == 3)) {
|
||||
this->unk_6b = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069FE8(Entity* this) {
|
||||
void sub_08069FE8(DogEntity* this) {
|
||||
u32 tmp;
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
tmp = TRUE;
|
||||
@@ -436,22 +449,22 @@ void sub_08069FE8(Entity* this) {
|
||||
tmp = FALSE;
|
||||
}
|
||||
|
||||
if (tmp != this->field_0x6a.HALF.LO) {
|
||||
if (tmp != this->unk_6a) {
|
||||
if (tmp == 0) {
|
||||
AddInteractableWhenBigObject(this);
|
||||
AddInteractableWhenBigObject(super);
|
||||
} else {
|
||||
AddInteractableAsMinishFuser(this, this->field_0x74.HALF.LO);
|
||||
AddInteractableAsMinishFuser(super, this->unk_74);
|
||||
}
|
||||
}
|
||||
this->field_0x6a.HALF.LO = tmp;
|
||||
this->unk_6a = tmp;
|
||||
}
|
||||
|
||||
void sub_0806A028(Entity* this) {
|
||||
if (this->interactType != 0) {
|
||||
void sub_0806A028(DogEntity* this) {
|
||||
if (super->interactType != 0) {
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 6;
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 6;
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0806A080(this);
|
||||
}
|
||||
@@ -461,12 +474,12 @@ void sub_0806A028(Entity* this) {
|
||||
SoundReq(SFX_VO_DOG);
|
||||
ResetPlayerAnimationAndAction();
|
||||
}
|
||||
this->interactType = 0;
|
||||
super->interactType = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806A080(Entity* this) {
|
||||
ShowNPCDialogue(this, &(gUnk_08111E34[this->type2][gSave.global_progress]));
|
||||
void sub_0806A080(DogEntity* this) {
|
||||
ShowNPCDialogue(super, &(gUnk_08111E34[super->type2][gSave.global_progress]));
|
||||
}
|
||||
|
||||
void sub_0806A0A4(Entity* this) {
|
||||
@@ -507,15 +520,15 @@ void sub_0806A144(Entity* this) {
|
||||
MessageNoOverlap(gUnk_08111FD8[dialog], this);
|
||||
}
|
||||
|
||||
void Dog_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
void Dog_Fusion(DogEntity* this) {
|
||||
if (super->action == 0) {
|
||||
if (sub_08069EF0(this)) {
|
||||
this->action++;
|
||||
this->spriteSettings.draw = 1;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
InitializeAnimation(this, 0x23);
|
||||
super->action++;
|
||||
super->spriteSettings.draw = 1;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitializeAnimation(super, 0x23);
|
||||
}
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Dr Left NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
@@ -15,7 +16,7 @@ void DrLeft(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
}
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
|
||||
+3
-2
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Emma NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "screenTransitions.h"
|
||||
@@ -13,9 +14,9 @@ void Emma(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+58
-51
@@ -4,70 +4,77 @@
|
||||
*
|
||||
* @brief Epona NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "message.h"
|
||||
#include "npc.h"
|
||||
#include "sound.h"
|
||||
|
||||
void sub_08065A64(Entity* this);
|
||||
void sub_08065AA4(Entity*);
|
||||
void sub_080659B8(Entity*);
|
||||
void sub_080659F0(Entity*);
|
||||
void sub_08065A00(Entity*);
|
||||
void sub_08065A10(Entity*);
|
||||
void sub_08065A34(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 unk_69;
|
||||
} EponaEntity;
|
||||
|
||||
void Epona(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void sub_08065A64(EponaEntity* this);
|
||||
void sub_08065AA4(EponaEntity* this);
|
||||
void sub_080659B8(EponaEntity* this);
|
||||
void sub_080659F0(EponaEntity* this);
|
||||
void sub_08065A00(EponaEntity* this);
|
||||
void sub_08065A10(EponaEntity* this);
|
||||
void sub_08065A34(EponaEntity* this);
|
||||
|
||||
void Epona(EponaEntity* this) {
|
||||
static void (*const actionFuncs[])(EponaEntity*) = {
|
||||
sub_080659B8, sub_080659F0, sub_08065A00, sub_08065A10, sub_08065A34,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
actionFuncs[super->action](this);
|
||||
sub_08065A64(this);
|
||||
sub_0806ED78(this);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
|
||||
void sub_080659B8(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->animationState = 6;
|
||||
this->field_0x68.HALF.HI = -1;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
InitAnimationForceUpdate(this, this->animationState / 2);
|
||||
void sub_080659B8(EponaEntity* this) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->animationState = 6;
|
||||
this->unk_69 = -1;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
InitAnimationForceUpdate(super, super->animationState / 2);
|
||||
}
|
||||
|
||||
void sub_080659F0(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
void sub_080659F0(EponaEntity* this) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
sub_08065AA4(this);
|
||||
}
|
||||
|
||||
void sub_08065A00(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
void sub_08065A00(EponaEntity* this) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
sub_08065AA4(this);
|
||||
}
|
||||
|
||||
void sub_08065A10(Entity* this) {
|
||||
void sub_08065A10(EponaEntity* this) {
|
||||
if ((gMessage.doTextBox & 0x7F) == 0) {
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, this->animationState / 2);
|
||||
super->action = 1;
|
||||
InitAnimationForceUpdate(super, super->animationState / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065A34(Entity* this) {
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, this->animationState / 2);
|
||||
void sub_08065A34(EponaEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
InitAnimationForceUpdate(super, super->animationState / 2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065A50(Entity* this) {
|
||||
void sub_08065A50(EponaEntity* this) {
|
||||
static const Dialog typeDialogs[] = {
|
||||
{ 0, 0, DIALOG_MINISH, 1, { TEXT_INDEX(TEXT_LON_LON, 0X17), TEXT_INDEX(TEXT_TINGLE, 0x3c) } },
|
||||
};
|
||||
ShowNPCDialogue(this, &typeDialogs[this->type]);
|
||||
ShowNPCDialogue(super, &typeDialogs[super->type]);
|
||||
}
|
||||
|
||||
void sub_08065A64(Entity* this) {
|
||||
void sub_08065A64(EponaEntity* this) {
|
||||
u32 uVar2;
|
||||
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
@@ -76,43 +83,43 @@ void sub_08065A64(Entity* this) {
|
||||
uVar2 = FALSE;
|
||||
}
|
||||
|
||||
if (uVar2 != this->field_0x68.HALF.HI) {
|
||||
if (uVar2 != this->unk_69) {
|
||||
if (uVar2 == 0) {
|
||||
AddInteractableWhenBigObject(this);
|
||||
AddInteractableWhenBigObject(super);
|
||||
} else {
|
||||
AddInteractableAsMinishFuser(this, this->field_0x68.HALF.LO);
|
||||
AddInteractableAsMinishFuser(super, this->fusionOffer);
|
||||
}
|
||||
}
|
||||
this->field_0x68.HALF.HI = uVar2;
|
||||
this->unk_69 = uVar2;
|
||||
}
|
||||
|
||||
void sub_08065AA4(Entity* this) {
|
||||
if (this->interactType != 0) {
|
||||
void sub_08065AA4(EponaEntity* this) {
|
||||
if (super->interactType != 0) {
|
||||
if (gPlayerState.flags & PL_MINISH) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 4;
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 4;
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
this->action = 3;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
super->action = 3;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
sub_08065A50(this);
|
||||
}
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
} else {
|
||||
sub_08065A50(this);
|
||||
ResetPlayerAnimationAndAction();
|
||||
}
|
||||
SoundReq(SFX_VO_EPONA);
|
||||
this->interactType = 0;
|
||||
super->interactType = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Epona_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.draw = 1;
|
||||
InitAnimationForceUpdate(this, 7);
|
||||
void Epona_Fusion(EponaEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
super->spriteSettings.draw = 1;
|
||||
InitAnimationForceUpdate(super, 7);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Ezlo NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "npc.h"
|
||||
|
||||
const u8 gUnk_08114134[];
|
||||
@@ -14,7 +15,7 @@ void Ezlo(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
}
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Farmers NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
|
||||
+22
-15
@@ -4,32 +4,39 @@
|
||||
*
|
||||
* @brief Farore NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "kinstone.h"
|
||||
|
||||
void Farore(Entity* this) {
|
||||
switch (this->action) {
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 animIndex;
|
||||
} FaroreEntity;
|
||||
|
||||
void Farore(FaroreEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
sub_0807DD50(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
InitScriptForNPC(super);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
this->field_0x68.HALF.LO = this->animIndex;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
this->animIndex = super->animIndex;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, this->field_0x68.HALF.LO);
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
InitAnimationForceUpdate(super, this->animIndex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+63
-53
@@ -4,81 +4,91 @@
|
||||
*
|
||||
* @brief Festari NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
|
||||
void sub_0805FF2C(Entity*, ScriptExecutionContext*);
|
||||
void sub_0805FE10(Entity* this);
|
||||
void sub_0805FE48(Entity* this);
|
||||
void sub_0805FF18(Entity* this);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 unused[23];
|
||||
/*0x80*/ u16 unk_80;
|
||||
/*0x82*/ u16 unk_82;
|
||||
/*0x84*/ ScriptExecutionContext* context;
|
||||
} FestariEntity;
|
||||
|
||||
void Festari(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void sub_0805FF2C(FestariEntity* this, ScriptExecutionContext* context);
|
||||
void sub_0805FE10(FestariEntity* this);
|
||||
void sub_0805FE48(FestariEntity* this);
|
||||
void sub_0805FF18(FestariEntity* this);
|
||||
|
||||
void Festari(FestariEntity* this) {
|
||||
static void (*const actionFuncs[])(FestariEntity*) = {
|
||||
sub_0805FE10,
|
||||
sub_0805FE48,
|
||||
sub_0805FF18,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
actionFuncs[super->action](this);
|
||||
}
|
||||
|
||||
void sub_0805FE10(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = TRUE;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
sub_0807DD50(this);
|
||||
void sub_0805FE10(FestariEntity* this) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = TRUE;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
|
||||
void sub_0805FE48(Entity* this) {
|
||||
void sub_0805FE48(FestariEntity* this) {
|
||||
u32 uVar4;
|
||||
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
|
||||
sub_0805FF2C(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
|
||||
uVar4 = this->field_0x80.HWORD;
|
||||
ExecuteScript(super, this->context);
|
||||
sub_0805FF2C(this, this->context);
|
||||
uVar4 = this->unk_80;
|
||||
if (uVar4 < 8) {
|
||||
if ((this->field_0x82.HWORD & 1) != 0) {
|
||||
uVar4 = (uVar4 & 0xfc) + (this->subtimer >> 1);
|
||||
if ((this->unk_82 & 1) != 0) {
|
||||
uVar4 = (uVar4 & 0xfc) + (super->subtimer >> 1);
|
||||
} else {
|
||||
uVar4 = (uVar4 & 0xfc) + (this->animationState >> 1);
|
||||
this->subtimer = this->animationState;
|
||||
uVar4 = (uVar4 & 0xfc) + (super->animationState >> 1);
|
||||
super->subtimer = super->animationState;
|
||||
}
|
||||
}
|
||||
if (uVar4 != this->animIndex) {
|
||||
InitAnimationForceUpdate(this, uVar4);
|
||||
if (uVar4 != super->animIndex) {
|
||||
InitAnimationForceUpdate(super, uVar4);
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
|
||||
if (this->frame & ANIM_DONE) {
|
||||
switch (this->animIndex) {
|
||||
if (super->frame & ANIM_DONE) {
|
||||
switch (super->animIndex) {
|
||||
case 8:
|
||||
case 10:
|
||||
case 11:
|
||||
case 12:
|
||||
this->field_0x80.HWORD = 0;
|
||||
this->unk_80 = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((this->field_0x82.HWORD & (~this->field_0x82.HWORD + 1)) == 2) {
|
||||
sub_0806ED78(this);
|
||||
if ((this->unk_82 & (~this->unk_82 + 1)) == 2) {
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805FF18(Entity* this) {
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
void sub_0805FF18(FestariEntity* this) {
|
||||
if (UpdateFuseInteraction(super)) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0805FF2C(Entity* this, ScriptExecutionContext* context) {
|
||||
void sub_0805FF2C(FestariEntity* this, ScriptExecutionContext* context) {
|
||||
u32 actions;
|
||||
u32 bit;
|
||||
|
||||
@@ -91,35 +101,35 @@ void sub_0805FF2C(Entity* this, ScriptExecutionContext* context) {
|
||||
actions ^= bit;
|
||||
switch (bit) {
|
||||
case 4:
|
||||
this->field_0x80.HWORD = 9;
|
||||
this->unk_80 = 9;
|
||||
break;
|
||||
|
||||
case 0x200000:
|
||||
this->field_0x80.HWORD = 10;
|
||||
this->unk_80 = 10;
|
||||
break;
|
||||
case 0x400000:
|
||||
if (this->animationState == 2) {
|
||||
this->field_0x80.HWORD = 0xb;
|
||||
if (super->animationState == 2) {
|
||||
this->unk_80 = 0xb;
|
||||
} else {
|
||||
this->field_0x80.HWORD = 0xc;
|
||||
this->unk_80 = 0xc;
|
||||
}
|
||||
break;
|
||||
case 0x100000:
|
||||
this->field_0x80.HWORD = 8;
|
||||
this->unk_80 = 8;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
HandlePostScriptActions(this, context);
|
||||
HandlePostScriptActions(super, context);
|
||||
}
|
||||
|
||||
void Festari_Fusion(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.draw = 1;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
InitAnimationForceUpdate(this, 8);
|
||||
void Festari_Fusion(FestariEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
super->spriteSettings.draw = 1;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitAnimationForceUpdate(super, 8);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
}
|
||||
|
||||
+61
-50
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Forest Minish NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "kinstone.h"
|
||||
@@ -11,6 +12,15 @@
|
||||
#include "object.h"
|
||||
#include "playeritem.h"
|
||||
#include "structures.h"
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 animIndex;
|
||||
/*0x6a*/ u8 unused[22];
|
||||
/*0x80*/ u16 unk_80;
|
||||
/*0x82*/ u16 unk_82;
|
||||
/*0x84*/ ScriptExecutionContext* context;
|
||||
} ForestMinishEntity;
|
||||
|
||||
const FrameStruct gUnk_08109C98[] = {
|
||||
{ 36, 26 }, { 37, 26 }, { 38, 26 }, { 39, 155 }, { 40, 155 }, { 41, 155 }, { 42, 155 }, { 43, 152 },
|
||||
@@ -505,44 +515,45 @@ const u16 gUnk_0810A362[] = {
|
||||
TEXT_INDEX(TEXT_BELARI, 0x8),
|
||||
};
|
||||
|
||||
static void sub_080600F0(Entity* this);
|
||||
static void sub_080600F0(ForestMinishEntity* this);
|
||||
extern void sub_08060158(ForestMinishEntity* this);
|
||||
|
||||
void ForestMinish(Entity* this) {
|
||||
switch (this->action) {
|
||||
void ForestMinish(ForestMinishEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
if (LoadExtraSpriteData(this, gUnk_0810A348)) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = TRUE;
|
||||
this->field_0x68.HALF.HI = this->animationState = this->timer << 1;
|
||||
this->timer = 0;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
StartCutscene(this, (u16*)gUnk_08109D18[this->type2]);
|
||||
sub_0807DD50(this);
|
||||
if (LoadExtraSpriteData(super, gUnk_0810A348)) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = TRUE;
|
||||
this->animIndex = super->animationState = super->timer << 1;
|
||||
super->timer = 0;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
StartCutscene(super, (u16*)gUnk_08109D18[super->type2]);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
if (this->frameDuration != 0xf0) {
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
if (super->frameDuration != 0xf0) {
|
||||
sub_080600F0(this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
if (UpdateFuseInteraction(super)) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ForestMinish_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void ForestMinish_MakeInteractable(ForestMinishEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void ForestMinish_Head(Entity* this) {
|
||||
@@ -561,64 +572,64 @@ void ForestMinish_Head(Entity* this) {
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
static void sub_080600F0(Entity* this) {
|
||||
static void sub_080600F0(ForestMinishEntity* this) {
|
||||
u32 uVar1;
|
||||
u32 uVar2;
|
||||
|
||||
uVar2 = this->field_0x80.HWORD;
|
||||
if (this->field_0x80.HWORD < 8) {
|
||||
if ((this->field_0x82.HWORD & 1) != 0) {
|
||||
uVar2 = (uVar2 & 0xfc) + (this->subtimer >> 1);
|
||||
uVar2 = this->unk_80;
|
||||
if (this->unk_80 < 8) {
|
||||
if ((this->unk_82 & 1) != 0) {
|
||||
uVar2 = (uVar2 & 0xfc) + (super->subtimer >> 1);
|
||||
} else {
|
||||
uVar2 = (uVar2 & 0xfc) + (this->animationState >> 1);
|
||||
this->subtimer = this->animationState;
|
||||
uVar2 = (uVar2 & 0xfc) + (super->animationState >> 1);
|
||||
super->subtimer = super->animationState;
|
||||
}
|
||||
}
|
||||
if (uVar2 != this->animIndex) {
|
||||
InitAnimationForceUpdate(this, uVar2);
|
||||
if (uVar2 != super->animIndex) {
|
||||
InitAnimationForceUpdate(super, uVar2);
|
||||
}
|
||||
if ((this->field_0x82.HWORD & 4) != 0) {
|
||||
if ((this->unk_82 & 4) != 0) {
|
||||
uVar1 = 2;
|
||||
} else {
|
||||
uVar1 = 1;
|
||||
}
|
||||
sub_080042BA(this, uVar1);
|
||||
sub_080042BA(super, uVar1);
|
||||
}
|
||||
|
||||
void sub_0806014C(Entity* this) {
|
||||
this->timer = 0;
|
||||
void sub_0806014C(ForestMinishEntity* this) {
|
||||
super->timer = 0;
|
||||
sub_08060158(this);
|
||||
}
|
||||
|
||||
void sub_08060158(Entity* this) {
|
||||
void sub_08060158(ForestMinishEntity* this) {
|
||||
int index;
|
||||
const FrameStruct* idx3;
|
||||
u8 tmp1, tmp2;
|
||||
|
||||
if (this->timer) {
|
||||
this->timer--;
|
||||
if (super->timer) {
|
||||
super->timer--;
|
||||
} else {
|
||||
this->timer = 2;
|
||||
index = GetFacingDirectionInRectRadius(this, 0x20, 0x20);
|
||||
super->timer = 2;
|
||||
index = GetFacingDirectionInRectRadius(super, 0x20, 0x20);
|
||||
if (index < 0) {
|
||||
int state = this->field_0x68.HALF.HI;
|
||||
this->animationState = state;
|
||||
int state = this->animIndex;
|
||||
super->animationState = state;
|
||||
index = state * 4;
|
||||
}
|
||||
|
||||
idx3 = gUnk_08109C98 + (this->animationState / 2) * 0x10 + (index >> 1);
|
||||
idx3 = gUnk_08109C98 + (super->animationState / 2) * 0x10 + (index >> 1);
|
||||
tmp1 = idx3->frame;
|
||||
tmp2 = idx3->frameIndex;
|
||||
|
||||
if (tmp2 & 0x80) {
|
||||
this->animationState = sub_0806F5B0(index);
|
||||
super->animationState = GetAnimationStateForDirection8(index);
|
||||
}
|
||||
tmp2 &= ~0x80;
|
||||
this->frame = tmp1;
|
||||
this->frameIndex = tmp2;
|
||||
this->frameSpriteSettings = 1;
|
||||
this->animIndex = 0;
|
||||
this->frameDuration = 0xf0;
|
||||
super->frame = tmp1;
|
||||
super->frameIndex = tmp2;
|
||||
super->frameSpriteSettings = 1;
|
||||
super->animIndex = 0;
|
||||
super->frameDuration = 0xf0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
*
|
||||
* Representation for the NPCs in the fusion menu.
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
|
||||
|
||||
+23
-16
@@ -4,32 +4,39 @@
|
||||
*
|
||||
* @brief Gentari NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
|
||||
void Gentari(Entity* this) {
|
||||
switch (this->action) {
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} GentariEntity;
|
||||
|
||||
void Gentari(GentariEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = TRUE;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
sub_0807DD50(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = TRUE;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
InitScriptForNPC(super);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
if (UpdateFuseInteraction(super)) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+109
-101
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Ghost Brothers NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "message.h"
|
||||
@@ -11,43 +12,49 @@
|
||||
#include "save.h"
|
||||
#include "screen.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 unused[3];
|
||||
/*0x6c*/ const u16* unk_6c;
|
||||
} GhostBrothersEntity;
|
||||
|
||||
extern u32 gSpriteAnimations_GhostBrothers[];
|
||||
|
||||
void sub_08065C0C(Entity* this);
|
||||
void sub_08065BF4(Entity* this);
|
||||
void sub_08065EBC(Entity* this);
|
||||
void sub_08065D18(Entity* this);
|
||||
void sub_08065D74(Entity* this);
|
||||
void sub_08065DB8(Entity* this);
|
||||
void sub_08065D18(Entity* this);
|
||||
void sub_08065EDC(Entity* this);
|
||||
void sub_08065F20(Entity* this);
|
||||
void sub_08065C0C(GhostBrothersEntity* this);
|
||||
void sub_08065BF4(GhostBrothersEntity* this);
|
||||
void sub_08065EBC(GhostBrothersEntity* this);
|
||||
void sub_08065D18(GhostBrothersEntity* this);
|
||||
void sub_08065D74(GhostBrothersEntity* this);
|
||||
void sub_08065DB8(GhostBrothersEntity* this);
|
||||
void sub_08065EDC(GhostBrothersEntity* this);
|
||||
void sub_08065F20(GhostBrothersEntity* this);
|
||||
|
||||
void GhostBrothers(Entity* this) {
|
||||
void GhostBrothers(GhostBrothersEntity* this) {
|
||||
static const s8 gUnk_0811015C[8] = { -14, -16, -18, -20, -22, -20, -18, -16 };
|
||||
static EntityAction* const actionFuncs[] = {
|
||||
static void (*const actionFuncs[])(GhostBrothersEntity*) = {
|
||||
sub_08065BF4, sub_08065BF4, sub_08065BF4, sub_08065BF4, sub_08065EBC, sub_08065EBC,
|
||||
};
|
||||
if (this->flags & ENT_SCRIPTED) {
|
||||
if (super->flags & ENT_SCRIPTED) {
|
||||
sub_08065C0C(this);
|
||||
} else {
|
||||
actionFuncs[this->type](this);
|
||||
actionFuncs[super->type](this);
|
||||
|
||||
if (this->type < 3) {
|
||||
if (super->type < 3) {
|
||||
const s8* ptr = gUnk_0811015C;
|
||||
u32 subtimer = this->subtimer++;
|
||||
this->z.HALF_U.HI = *(ptr + (((subtimer << 0x18) >> 0x1b) & 0x7));
|
||||
u32 subtimer = super->subtimer++;
|
||||
super->z.HALF_U.HI = *(ptr + (((subtimer << 0x18) >> 0x1b) & 0x7));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065BF4(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void sub_08065BF4(GhostBrothersEntity* this) {
|
||||
static void (*const actionFuncs[])(GhostBrothersEntity*) = {
|
||||
sub_08065D18,
|
||||
sub_08065D74,
|
||||
sub_08065DB8,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
actionFuncs[super->action](this);
|
||||
}
|
||||
|
||||
static const u16 gUnk_08110188[] = { 0x1000, 0x4, 0xf01, 0x4, 0xe02, 0x4, 0xd03, 0x4, 0xc04, 0x8, 0xd03, 0x4,
|
||||
@@ -61,139 +68,140 @@ static const u16 gUnk_0811022E[] = { 0x10, 0x2, 0x10f, 0x2, 0x20e, 0x2, 0x30d,
|
||||
0x60a, 0x2, 0x709, 0x2, 0x808, 0x2, 0x907, 0x2, 0xa06, 0x2, 0xb05, 0x2,
|
||||
0xc04, 0x2, 0xd03, 0x2, 0xe02, 0x2, 0xf01, 0x2, 0x1000, 0x2, 0xffff };
|
||||
|
||||
void sub_08065C0C(Entity* this) {
|
||||
u16* puVar3;
|
||||
void sub_08065C0C(GhostBrothersEntity* this) {
|
||||
const u16* puVar3;
|
||||
|
||||
switch (this->action) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
sub_0807DD50(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
InitScriptForNPC(super);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this) == 0) {
|
||||
if (UpdateFuseInteraction(super) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->action = 1;
|
||||
super->action = 1;
|
||||
break;
|
||||
case 3:
|
||||
if (--this->timer != 0) {
|
||||
if (--super->timer != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
puVar3 = *(u16**)&this->field_0x6c.HWORD;
|
||||
puVar3 = this->unk_6c;
|
||||
if (*puVar3 != 0xffff) {
|
||||
gScreen.controls.alphaBlend = *puVar3;
|
||||
this->timer = (u8) * (++puVar3);
|
||||
*(u16**)&this->field_0x6c = ++puVar3;
|
||||
super->timer = (u8) * (++puVar3);
|
||||
this->unk_6c = ++puVar3;
|
||||
return;
|
||||
}
|
||||
|
||||
this->spriteSettings.draw = 0;
|
||||
super->spriteSettings.draw = 0;
|
||||
|
||||
this->action = 1;
|
||||
super->action = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065CCC(Entity* this) {
|
||||
this->action = 3;
|
||||
this->timer = 30;
|
||||
this->spriteRendering.alphaBlend = 1;
|
||||
*(const u16**)&this->field_0x6c = gUnk_0811022E;
|
||||
void sub_08065CCC(GhostBrothersEntity* this) {
|
||||
super->action = 3;
|
||||
super->timer = 30;
|
||||
super->spriteRendering.alphaBlend = 1;
|
||||
this->unk_6c = gUnk_0811022E;
|
||||
gScreen.controls.layerFXControl = 0x3f40;
|
||||
gScreen.controls.alphaBlend = 0x10;
|
||||
}
|
||||
|
||||
void GhostBrothers_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void GhostBrothers_MakeInteractable(GhostBrothersEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void sub_08065D18(Entity* this) {
|
||||
this->action = 1;
|
||||
this->timer = 30;
|
||||
this->subtimer = 0;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->spriteRendering.alphaBlend = 1;
|
||||
*(const u16**)&this->field_0x6c = gUnk_08110188;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
void sub_08065D18(GhostBrothersEntity* this) {
|
||||
super->action = 1;
|
||||
super->timer = 30;
|
||||
super->subtimer = 0;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->spriteRendering.alphaBlend = 1;
|
||||
this->unk_6c = gUnk_08110188;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitAnimationForceUpdate(super, 2);
|
||||
gScreen.controls.layerFXControl = 0x3f40;
|
||||
gScreen.controls.alphaBlend = 0x1000;
|
||||
}
|
||||
|
||||
void sub_08065D74(Entity* this) {
|
||||
u16* ptr;
|
||||
if (--this->timer) {
|
||||
void sub_08065D74(GhostBrothersEntity* this) {
|
||||
const u16* ptr;
|
||||
if (--super->timer) {
|
||||
return;
|
||||
}
|
||||
|
||||
ptr = *(u16**)&this->field_0x6c;
|
||||
ptr = this->unk_6c;
|
||||
if (*ptr != 0xffff) {
|
||||
gScreen.controls.alphaBlend = *ptr;
|
||||
this->timer = *(ptr + 1);
|
||||
*(u32*)&this->field_0x6c = (u32)(ptr + 2);
|
||||
super->timer = *(ptr + 1);
|
||||
this->unk_6c = (ptr + 2);
|
||||
} else {
|
||||
this->action++;
|
||||
super->action++;
|
||||
MessageFromTarget(0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065DB8(Entity* this) {
|
||||
switch (this->subAction) {
|
||||
void sub_08065DB8(GhostBrothersEntity* this) {
|
||||
switch (super->subAction) {
|
||||
case 0: {
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
this->subAction++;
|
||||
this->timer = 60;
|
||||
InitAnimationForceUpdate(this, 4);
|
||||
super->subAction++;
|
||||
super->timer = 60;
|
||||
InitAnimationForceUpdate(super, 4);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
if (--this->timer == 0) {
|
||||
this->subAction++;
|
||||
this->timer = 180;
|
||||
if (--super->timer == 0) {
|
||||
super->subAction++;
|
||||
super->timer = 180;
|
||||
gUnk_02018EB0.unk_1++;
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
InitAnimationForceUpdate(super, 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
break;
|
||||
case 3: {
|
||||
if (--this->timer == 0) {
|
||||
if (--super->timer == 0) {
|
||||
MessageFromTarget(0);
|
||||
this->subAction++;
|
||||
super->subAction++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
this->subAction++;
|
||||
this->timer = 30;
|
||||
*(const u16**)&this->field_0x6c = gUnk_0811022E;
|
||||
super->subAction++;
|
||||
super->timer = 30;
|
||||
this->unk_6c = gUnk_0811022E;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (--this->timer == 0) {
|
||||
u16* puVar3 = *(u16**)&this->field_0x6c.HWORD;
|
||||
if (--super->timer == 0) {
|
||||
const u16* puVar3 = this->unk_6c;
|
||||
if (*puVar3 != 0xffff) {
|
||||
gScreen.controls.alphaBlend = *puVar3;
|
||||
this->timer = (u8) * (puVar3 + 1);
|
||||
*(u16**)&this->field_0x6c = (puVar3 + 2);
|
||||
super->timer = (u8) * (puVar3 + 1);
|
||||
this->unk_6c = (puVar3 + 2);
|
||||
} else {
|
||||
gUnk_02018EB0.unk_0++;
|
||||
DeleteThisEntity();
|
||||
@@ -203,43 +211,43 @@ void sub_08065DB8(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
void sub_08065EBC(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void sub_08065EBC(GhostBrothersEntity* this) {
|
||||
static void (*const actionFuncs[])(GhostBrothersEntity*) = {
|
||||
sub_08065D18,
|
||||
sub_08065EDC,
|
||||
sub_08065F20,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
actionFuncs[super->action](this);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
|
||||
void sub_08065EDC(Entity* this) {
|
||||
if (--this->timer == 0) {
|
||||
u16* puVar3 = *(u16**)&this->field_0x6c.HWORD;
|
||||
void sub_08065EDC(GhostBrothersEntity* this) {
|
||||
if (--super->timer == 0) {
|
||||
const u16* puVar3 = this->unk_6c;
|
||||
if (*puVar3 != 0xffff) {
|
||||
gScreen.controls.alphaBlend = *puVar3;
|
||||
this->timer = (u8) * (++puVar3);
|
||||
*(u16**)&this->field_0x6c = (++puVar3);
|
||||
super->timer = (u8) * (++puVar3);
|
||||
this->unk_6c = (++puVar3);
|
||||
} else {
|
||||
this->action++;
|
||||
AddInteractableWhenBigObject(this);
|
||||
super->action++;
|
||||
AddInteractableWhenBigObject(super);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065F20(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->interactType != 0) {
|
||||
this->interactType = 0;
|
||||
void sub_08065F20(GhostBrothersEntity* this) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if (super->interactType != 0) {
|
||||
super->interactType = 0;
|
||||
MessageFromTarget(0);
|
||||
this->animIndex++;
|
||||
if (gSpriteAnimations_GhostBrothers[this->animIndex] == 0) {
|
||||
this->animIndex = 0;
|
||||
super->animIndex++;
|
||||
if (gSpriteAnimations_GhostBrothers[super->animIndex] == 0) {
|
||||
super->animIndex = 0;
|
||||
}
|
||||
InitAnimationForceUpdate(this, this->animIndex);
|
||||
InitAnimationForceUpdate(super, super->animIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+23
-16
@@ -4,33 +4,40 @@
|
||||
*
|
||||
* @brief Gina NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "player.h"
|
||||
|
||||
void Gina(Entity* this) {
|
||||
switch (this->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} GinaEntity;
|
||||
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
sub_0807DD50(this);
|
||||
void Gina(GinaEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
InitScriptForNPC(super);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
#if defined(USA) || defined(DEMO_USA)
|
||||
SetLocalFlag(KS_B15);
|
||||
#endif
|
||||
|
||||
+44
-37
@@ -4,11 +4,18 @@
|
||||
*
|
||||
* @brief Gorman NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68;
|
||||
/*0x69*/ s8 unk_69;
|
||||
} GormanEntity;
|
||||
|
||||
void sub_080697A4(Entity* this);
|
||||
void sub_08069838(Entity* this);
|
||||
void sub_08069838(GormanEntity* this);
|
||||
void sub_08069888(Entity* this);
|
||||
|
||||
const SpriteLoadData gUnk_08111C3C[] = {
|
||||
@@ -59,11 +66,11 @@ const u8 gUnk_08111CB8[] = {
|
||||
0,
|
||||
};
|
||||
|
||||
void Gorman(Entity* this) {
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
void Gorman(GormanEntity* this) {
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
sub_08069838(this);
|
||||
} else {
|
||||
sub_080697A4(this);
|
||||
sub_080697A4(super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,20 +107,20 @@ void sub_080697EC(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08069838(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
if (!LoadExtraSpriteData(this, gUnk_08111C3C)) {
|
||||
void sub_08069838(GormanEntity* this) {
|
||||
if (super->action == 0) {
|
||||
if (!LoadExtraSpriteData(super, gUnk_08111C3C)) {
|
||||
return;
|
||||
}
|
||||
this->action++;
|
||||
this->field_0x68.HALF.LO = 0;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
sub_0807DD64(this);
|
||||
super->action++;
|
||||
this->unk_68 = 0;
|
||||
this->unk_69 = 0;
|
||||
sub_0807DD64(super);
|
||||
}
|
||||
sub_0807DD94(this, NULL);
|
||||
if (this->interactType != 0) {
|
||||
this->interactType = 0;
|
||||
sub_08069888(this);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
if (super->interactType != 0) {
|
||||
super->interactType = 0;
|
||||
sub_08069888(super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,56 +145,56 @@ void sub_08069888(Entity* this) {
|
||||
MessageNoOverlap(gUnk_08111C50[index], this);
|
||||
}
|
||||
|
||||
void sub_0806991C(Entity* this, ScriptExecutionContext* context) {
|
||||
void sub_0806991C(GormanEntity* this, ScriptExecutionContext* context) {
|
||||
u32 tmp;
|
||||
const Coords* ptr;
|
||||
this->field_0x68.HALF.LO = (Random() & 0x1f) + 0x3c;
|
||||
ptr = &gUnk_08111C5C[*(s8*)&this->field_0x68.HALF.HI];
|
||||
this->unk_68 = (Random() & 0x1f) + 0x3c;
|
||||
ptr = &gUnk_08111C5C[this->unk_69];
|
||||
context->x.HALF.HI = gRoomControls.origin_x + ptr->HALF.x;
|
||||
context->y.HALF.HI = gRoomControls.origin_y + ptr->HALF.y;
|
||||
context->unk_19 = 8;
|
||||
context->postScriptActions |= 2;
|
||||
context->condition = 0;
|
||||
tmp = sub_080045DA(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
|
||||
this->direction = tmp;
|
||||
this->animationState = (this->animationState & 0x80) | gUnk_08111C74[(tmp << 0x18) >> 0x1c];
|
||||
tmp = sub_080045DA(context->x.HALF.HI - super->x.HALF.HI, context->y.HALF.HI - super->y.HALF.HI);
|
||||
super->direction = tmp;
|
||||
super->animationState = (super->animationState & 0x80) | gUnk_08111C74[(tmp << 0x18) >> 0x1c];
|
||||
gActiveScriptInfo.flags |= 1;
|
||||
}
|
||||
|
||||
void sub_080699AC(Entity* this, ScriptExecutionContext* context) {
|
||||
void sub_080699AC(GormanEntity* this, ScriptExecutionContext* context) {
|
||||
u32 tmp;
|
||||
const Coords* ptr;
|
||||
this->field_0x68.HALF.LO = (Random() & 0x1f) + 0x3c;
|
||||
ptr = &gUnk_08111C84[*(s8*)&this->field_0x68.HALF.HI];
|
||||
this->unk_68 = (Random() & 0x1f) + 0x3c;
|
||||
ptr = &gUnk_08111C84[this->unk_69];
|
||||
context->x.HALF.HI = gRoomControls.origin_x + ptr->HALF.x;
|
||||
context->y.HALF.HI = gRoomControls.origin_y + ptr->HALF.y;
|
||||
context->unk_19 = 8;
|
||||
context->postScriptActions |= 2;
|
||||
context->condition = 0;
|
||||
tmp = sub_080045DA(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
|
||||
this->direction = tmp;
|
||||
this->animationState = (this->animationState & 0x80) | gUnk_08111C8C[(tmp << 0x18) >> 0x1c];
|
||||
tmp = sub_080045DA(context->x.HALF.HI - super->x.HALF.HI, context->y.HALF.HI - super->y.HALF.HI);
|
||||
super->direction = tmp;
|
||||
super->animationState = (super->animationState & 0x80) | gUnk_08111C8C[(tmp << 0x18) >> 0x1c];
|
||||
gActiveScriptInfo.flags |= 1;
|
||||
}
|
||||
|
||||
void sub_08069A3C(Entity* this) {
|
||||
this->field_0x68.HALF.HI = gUnk_08111C9C[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2];
|
||||
void sub_08069A3C(GormanEntity* this) {
|
||||
this->unk_69 = gUnk_08111C9C[(Random() & 1) + this->unk_69 * 2];
|
||||
}
|
||||
|
||||
void sub_08069A60(Entity* this) {
|
||||
this->field_0x68.HALF.HI = gUnk_08111CA8[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2];
|
||||
void sub_08069A60(GormanEntity* this) {
|
||||
this->unk_69 = gUnk_08111CA8[(Random() & 1) + this->unk_69 * 2];
|
||||
}
|
||||
|
||||
void sub_08069A84(Entity* this) {
|
||||
this->field_0x68.HALF.HI = gUnk_08111CB4[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2];
|
||||
void sub_08069A84(GormanEntity* this) {
|
||||
this->unk_69 = gUnk_08111CB4[(Random() & 1) + this->unk_69 * 2];
|
||||
}
|
||||
|
||||
void sub_08069AA8(Entity* this) {
|
||||
this->field_0x68.HALF.HI = gUnk_08111CB8[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2];
|
||||
void sub_08069AA8(GormanEntity* this) {
|
||||
this->unk_69 = gUnk_08111CB8[(Random() & 1) + this->unk_69 * 2];
|
||||
}
|
||||
|
||||
void sub_08069ACC(Entity* this, ScriptExecutionContext* context) {
|
||||
if (--this->field_0x68.HALF.LO * 0x1000000 < 1) {
|
||||
void sub_08069ACC(GormanEntity* this, ScriptExecutionContext* context) {
|
||||
if (--this->unk_68 * 0x1000000 < 1) {
|
||||
context->condition = 1;
|
||||
} else {
|
||||
context->condition = 0;
|
||||
|
||||
+33
-25
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Goron NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "effects.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
@@ -11,27 +12,34 @@
|
||||
#include "message.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[24];
|
||||
/*0x80*/ u16 unk_80;
|
||||
/*0x82*/ u16 unk_82;
|
||||
} GoronEntity;
|
||||
|
||||
void sub_08069310(Entity*);
|
||||
void sub_08069328(Entity*);
|
||||
void sub_08069390(Entity*);
|
||||
void sub_080693C4(Entity*);
|
||||
void sub_080693D0(Entity*);
|
||||
void sub_080693C4(GoronEntity*);
|
||||
void sub_080693D0(GoronEntity*);
|
||||
|
||||
void Goron(Entity* this) {
|
||||
void Goron(GoronEntity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
sub_08069310,
|
||||
sub_08069328,
|
||||
sub_08069390,
|
||||
};
|
||||
static void (*const scriptedActionFuncs[])(Entity*) = {
|
||||
static void (*const scriptedActionFuncs[])(GoronEntity*) = {
|
||||
sub_080693C4,
|
||||
sub_080693D0,
|
||||
};
|
||||
if (this->flags & ENT_SCRIPTED) {
|
||||
scriptedActionFuncs[this->action](this);
|
||||
if (super->flags & ENT_SCRIPTED) {
|
||||
scriptedActionFuncs[super->action](this);
|
||||
} else {
|
||||
actionFuncs[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
actionFuncs[super->action](super);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,25 +80,25 @@ void sub_08069390(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080693C4(Entity* this) {
|
||||
this->action = 1;
|
||||
sub_0807DD50(this);
|
||||
void sub_080693C4(GoronEntity* this) {
|
||||
super->action = 1;
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
|
||||
void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65);
|
||||
|
||||
void sub_080693D0(Entity* this) {
|
||||
sub_0807DD94(this, NULL);
|
||||
if (this->animIndex == 8) {
|
||||
bool32 createFx65 = (this->field_0x82.HWORD & 0xF) != 0;
|
||||
void sub_080693D0(GoronEntity* this) {
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
if (super->animIndex == 8) {
|
||||
bool32 createFx65 = (this->unk_82 & 0xF) != 0;
|
||||
|
||||
if (this->frame == 1) {
|
||||
this->frame = 0;
|
||||
sub_08069428(this, Q_16_16(-8.0), createFx65);
|
||||
if (super->frame == 1) {
|
||||
super->frame = 0;
|
||||
sub_08069428(super, Q_16_16(-8.0), createFx65);
|
||||
}
|
||||
if (this->frame == 2) {
|
||||
this->frame = 0;
|
||||
sub_08069428(this, Q_16_16(8.0), createFx65);
|
||||
if (super->frame == 2) {
|
||||
super->frame = 0;
|
||||
sub_08069428(super, Q_16_16(8.0), createFx65);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,14 +168,14 @@ void sub_080694D8(Entity* this) {
|
||||
ShowNPCDialogue(this, &gUnk_08111A94[this->type]);
|
||||
}
|
||||
|
||||
void sub_080694EC(Entity* this) {
|
||||
void sub_080694EC(GoronEntity* this) {
|
||||
u32 anim;
|
||||
this->animationState = 4;
|
||||
super->animationState = 4;
|
||||
anim = 2;
|
||||
if (!CheckKinstoneFused(KINSTONE_2F))
|
||||
anim = 8;
|
||||
InitAnimationForceUpdate(this, anim);
|
||||
this->field_0x80.HWORD = anim;
|
||||
InitAnimationForceUpdate(super, anim);
|
||||
this->unk_80 = anim;
|
||||
}
|
||||
|
||||
void Goron_Fusion(Entity* this) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Goron Merchant NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
@@ -74,11 +75,11 @@ void sub_0806961C(Entity* this) {
|
||||
void sub_0806963C(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = TRUE;
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
}
|
||||
|
||||
void sub_08069654(Entity* this) {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
|
||||
void sub_08069660(Entity* this) {
|
||||
|
||||
+71
-63
@@ -4,112 +4,120 @@
|
||||
*
|
||||
* @brief Gregal NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
#include "script.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 animIndex;
|
||||
} GregalEntity;
|
||||
|
||||
static const u32 gUnk_08113D84[] = {
|
||||
0x100c0200,
|
||||
0x4,
|
||||
};
|
||||
|
||||
void sub_0806CAF4(Entity*);
|
||||
void sub_0806CB80(Entity*);
|
||||
void sub_0806CBB4(Entity*);
|
||||
void sub_0806CC08(Entity*);
|
||||
void sub_0806CAF4(GregalEntity*);
|
||||
void sub_0806CB80(GregalEntity*);
|
||||
void sub_0806CBB4(GregalEntity*);
|
||||
void sub_0806CC08(GregalEntity*);
|
||||
|
||||
void Gregal(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void Gregal(GregalEntity* this) {
|
||||
static void (*const actionFuncs[])(GregalEntity*) = {
|
||||
sub_0806CAF4,
|
||||
sub_0806CB80,
|
||||
sub_0806CBB4,
|
||||
sub_0806CC08,
|
||||
};
|
||||
actionFuncs[this->type](this);
|
||||
actionFuncs[super->type](this);
|
||||
}
|
||||
|
||||
void sub_0806CAF4(Entity* this) {
|
||||
void sub_0806CAF4(GregalEntity* this) {
|
||||
Entity* npc;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
npc = CreateNPC(GREGAL, 1, 0);
|
||||
if (npc != NULL) {
|
||||
npc->parent = this;
|
||||
CopyPosition(this, npc);
|
||||
SortEntityBelow(this, npc);
|
||||
npc->parent = super;
|
||||
CopyPosition(super, npc);
|
||||
SortEntityBelow(super, npc);
|
||||
}
|
||||
npc = CreateNPC(GREGAL, 2, 0);
|
||||
if (npc != NULL) {
|
||||
npc->parent = this;
|
||||
CopyPosition(this, npc);
|
||||
SortEntityAbove(this, npc);
|
||||
npc->parent = super;
|
||||
CopyPosition(super, npc);
|
||||
SortEntityAbove(super, npc);
|
||||
}
|
||||
sub_0807DD64(this);
|
||||
AddInteractableWhenBigObject(this);
|
||||
SetInteractableObjectCollision(this, 1, (u8)gUnk_08113D84[1], gUnk_08113D84);
|
||||
sub_0807DD64(super);
|
||||
AddInteractableWhenBigObject(super);
|
||||
SetInteractableObjectCollision(super, 1, (u8)gUnk_08113D84[1], gUnk_08113D84);
|
||||
}
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
GetNextFrame(this);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
|
||||
void sub_0806CB80(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->animationState = 2;
|
||||
this->frameIndex = 0;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
void sub_0806CB80(GregalEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
super->animationState = 2;
|
||||
super->frameIndex = 0;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
}
|
||||
if (this->parent != NULL) {
|
||||
this->frameIndex = (this->parent->frame & 3) + 0x21;
|
||||
if (super->parent != NULL) {
|
||||
super->frameIndex = (super->parent->frame & 3) + 0x21;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806CBB4(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->animationState = 2;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
InitializeAnimation(this, 0x11);
|
||||
void sub_0806CBB4(GregalEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
super->animationState = 2;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitializeAnimation(super, 0x11);
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if (this->parent != NULL) {
|
||||
this->spriteSettings.draw = 0;
|
||||
if ((this->parent->frame & 4) != 0) {
|
||||
this->spriteSettings.draw = 1;
|
||||
GetNextFrame(super);
|
||||
if (super->parent != NULL) {
|
||||
super->spriteSettings.draw = 0;
|
||||
if ((super->parent->frame & 4) != 0) {
|
||||
super->spriteSettings.draw = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806CC08(Entity* this) {
|
||||
switch (this->action) {
|
||||
void sub_0806CC08(GregalEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD64(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
sub_0807DD64(super);
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 8);
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
this->animIndex = super->animIndex;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 8);
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
GetNextFrame(this);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this) == 0) {
|
||||
if (UpdateFuseInteraction(super) == 0) {
|
||||
return;
|
||||
}
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, this->field_0x68.HALF.HI);
|
||||
super->action = 1;
|
||||
InitAnimationForceUpdate(super, this->animIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -160,9 +168,9 @@ void sub_0806CD4C(Entity* this) {
|
||||
ChangeObjPalette(this, 0x110);
|
||||
}
|
||||
|
||||
void Gregal_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Gregal_MakeInteractable(GregalEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Gregal_Fusion(Entity* this) {
|
||||
|
||||
+50
-40
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Guard NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
@@ -14,6 +15,15 @@
|
||||
#include "room.h"
|
||||
#include "script.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u16 unk_68;
|
||||
/*0x6a*/ u16 unk_6a;
|
||||
/*0x6c*/ u8 unused[4];
|
||||
/*0x70*/ s8 unk_70;
|
||||
/*0x71*/ u8 unk_71;
|
||||
} GuardEntity;
|
||||
|
||||
typedef struct {
|
||||
u32 unk;
|
||||
u32 entityCount;
|
||||
@@ -27,7 +37,6 @@ typedef struct {
|
||||
extern void sub_08063D24(Entity*);
|
||||
extern void sub_08064428(Entity*);
|
||||
void sub_08063DC8(Entity*);
|
||||
void sub_08063F20(Entity*);
|
||||
|
||||
// TODO guardWithSpear rodata before this
|
||||
const Dialog gUnk_0810CF4C[] = {
|
||||
@@ -245,10 +254,10 @@ const SpriteLoadData gUnk_0810F524[] = {
|
||||
{ 55, 43, 4 }, { 6199, 43, 4 }, { 22583, 43, 4 }, { 0, 0, 0 },
|
||||
{ 4, 43, 4 }, { 16388, 43, 4 }, { 8196, 43, 4 }, { 0, 0, 0 },
|
||||
};
|
||||
void sub_08063E90(Entity*);
|
||||
void sub_08063F20(Entity*);
|
||||
void sub_08063F78(Entity*);
|
||||
void (*const gUnk_0810F544[])(Entity*) = {
|
||||
void sub_08063E90(GuardEntity*);
|
||||
void sub_08063F20(GuardEntity*);
|
||||
void sub_08063F78(GuardEntity*);
|
||||
void (*const gUnk_0810F544[])(GuardEntity*) = {
|
||||
sub_08063E90,
|
||||
sub_08063F20,
|
||||
sub_08063F78,
|
||||
@@ -266,11 +275,11 @@ void (*const gUnk_0810F550[])(Entity*) = {
|
||||
|
||||
extern void* gUnk_0810F6BC[]; // TODO find out type of second param for sub_0806EE04
|
||||
|
||||
void Guard(Entity* this) {
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
gUnk_0810F544[this->action](this);
|
||||
void Guard(GuardEntity* this) {
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
gUnk_0810F544[super->action](this);
|
||||
} else {
|
||||
sub_08063D24(this);
|
||||
sub_08063D24(super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +320,7 @@ void sub_08063DC8(Entity* this) {
|
||||
if (this->type == 0xff) {
|
||||
this->action = 2;
|
||||
this->timer = 30;
|
||||
this->animationState = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
|
||||
this->animationState = GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity));
|
||||
InitAnimationForceUpdate(this, this->animationState + 4);
|
||||
} else {
|
||||
sub_0806EE20(this);
|
||||
@@ -324,7 +333,7 @@ void sub_08063DC8(Entity* this) {
|
||||
if (this->interactType != 0) {
|
||||
this->action = 3;
|
||||
this->interactType = 0;
|
||||
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
InitializeAnimation(this, GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_08064428(this);
|
||||
}
|
||||
}
|
||||
@@ -343,53 +352,54 @@ void sub_08063E6C(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063E90(Entity* this) {
|
||||
void sub_08063E90(GuardEntity* this) {
|
||||
u32 idx;
|
||||
u32 unk;
|
||||
|
||||
idx = (this->id ^ 0x15) ? 1 : 0;
|
||||
if (!LoadExtraSpriteData(this, &gUnk_0810F524[idx * 4]))
|
||||
idx = (super->id ^ 0x15) ? 1 : 0;
|
||||
if (!LoadExtraSpriteData(super, &gUnk_0810F524[idx * 4]))
|
||||
return;
|
||||
|
||||
this->action++;
|
||||
if (this->timer) {
|
||||
this->field_0x70.BYTES.byte0 = 8;
|
||||
super->action++;
|
||||
if (super->timer) {
|
||||
this->unk_70 = 8;
|
||||
} else {
|
||||
this->field_0x70.BYTES.byte0 = 0;
|
||||
this->unk_70 = 0;
|
||||
}
|
||||
this->timer = 0;
|
||||
super->timer = 0;
|
||||
|
||||
unk = sub_0805ACC0(this);
|
||||
unk = sub_0805ACC0(super);
|
||||
if (unk == 0) {
|
||||
this->field_0x68.HWORD = this->x.HALF.HI;
|
||||
this->field_0x6a.HWORD = this->y.HALF.HI;
|
||||
this->unk_68 = super->x.HALF.HI;
|
||||
this->unk_6a = super->y.HALF.HI;
|
||||
} else {
|
||||
this->field_0x68.HWORD = unk >> 0x10;
|
||||
this->field_0x6a.HWORD = unk;
|
||||
this->unk_68 = unk >> 0x10;
|
||||
this->unk_6a = unk;
|
||||
}
|
||||
this->field_0x70.BYTES.byte1 = 0;
|
||||
this->collisionLayer = 1;
|
||||
UpdateSpriteForCollisionLayer(this);
|
||||
sub_0807DD64(this);
|
||||
this->unk_71 = 0;
|
||||
super->collisionLayer = 1;
|
||||
UpdateSpriteForCollisionLayer(super);
|
||||
sub_0807DD64(super);
|
||||
sub_08063F20(this);
|
||||
}
|
||||
|
||||
void sub_08063F20(Entity* this) {
|
||||
ExecuteScriptForEntity(this, 0);
|
||||
HandleEntity0x82Actions(this);
|
||||
GetNextFrame(this);
|
||||
if (this->interactType != 0) {
|
||||
this->action++;
|
||||
this->interactType = 0;
|
||||
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + *(s8*)&this->field_0x70);
|
||||
sub_08064428(this);
|
||||
void sub_08063F20(GuardEntity* this) {
|
||||
ExecuteScriptForEntity(super, 0);
|
||||
HandleEntity0x82Actions(super);
|
||||
GetNextFrame(super);
|
||||
if (super->interactType != 0) {
|
||||
super->action++;
|
||||
super->interactType = 0;
|
||||
InitializeAnimation(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + this->unk_70);
|
||||
sub_08064428(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063F78(Entity* this) {
|
||||
void sub_08063F78(GuardEntity* this) {
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
this->action = this->action - 1;
|
||||
InitializeAnimation(this, (this->animationState >> 1) + 4 + *(s8*)&this->field_0x70);
|
||||
super->action = super->action - 1;
|
||||
InitializeAnimation(super, (super->animationState >> 1) + 4 + this->unk_70);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+33
-31
@@ -14,13 +14,13 @@
|
||||
#include "script.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
s16 unk68;
|
||||
s16 unk6a;
|
||||
s16 unk6c;
|
||||
s16 unk6e;
|
||||
s8 unk70;
|
||||
s8 unk71;
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ s16 unk_68;
|
||||
/*0x6a*/ s16 unk_6a;
|
||||
/*0x6c*/ s16 unk_6c;
|
||||
/*0x6e*/ s16 unk_6e;
|
||||
/*0x70*/ s8 unk_70;
|
||||
/*0x71*/ s8 unk_71;
|
||||
} GuardWithSpearEntity;
|
||||
|
||||
extern Dialog gUnk_0810CF4C[];
|
||||
@@ -59,34 +59,34 @@ void sub_0806407C(GuardWithSpearEntity* this, ScriptExecutionContext* context) {
|
||||
}
|
||||
|
||||
super->direction = dir;
|
||||
super->animationState = sub_0806F5B0(dir);
|
||||
super->animationState = GetAnimationStateForDirection8(dir);
|
||||
super->speed = 0x80;
|
||||
}
|
||||
|
||||
uVar7 = super->animationState >> 1;
|
||||
if (uVar7 + 4 != super->animIndex) {
|
||||
InitializeAnimation(super, uVar7 + 4 + this->unk70);
|
||||
InitializeAnimation(super, uVar7 + 4 + this->unk_70);
|
||||
}
|
||||
ProcessMovement0(super);
|
||||
|
||||
x = super->x.HALF.HI - this->unk68;
|
||||
x = super->x.HALF.HI - this->unk_68;
|
||||
if (0x10 < x) {
|
||||
super->x.HALF.HI = this->unk68 + 0x10;
|
||||
super->x.HALF.HI = this->unk_68 + 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
if (x < -0x10) {
|
||||
super->x.HALF.HI = this->unk68 + -0x10;
|
||||
super->x.HALF.HI = this->unk_68 + -0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
|
||||
y = super->y.HALF.HI - this->unk6a;
|
||||
y = super->y.HALF.HI - this->unk_6a;
|
||||
if (0x10 < y) {
|
||||
super->y.HALF.HI = this->unk6a + 0x10;
|
||||
super->y.HALF.HI = this->unk_6a + 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
|
||||
if (y < -0x10) {
|
||||
super->y.HALF.HI = this->unk6a + -0x10;
|
||||
super->y.HALF.HI = this->unk_6a + -0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
|
||||
@@ -108,8 +108,8 @@ void sub_08064198(GuardWithSpearEntity* this) {
|
||||
u32 animIndex;
|
||||
u32 animationState;
|
||||
|
||||
if (this->unk71 > 0) {
|
||||
this->unk71--;
|
||||
if (this->unk_71 > 0) {
|
||||
this->unk_71--;
|
||||
}
|
||||
|
||||
yDiff = gPlayerEntity.y.HALF.HI - super->y.HALF.HI;
|
||||
@@ -135,17 +135,18 @@ void sub_08064198(GuardWithSpearEntity* this) {
|
||||
if (0x140 < gPlayerEntity.speed && gRoomTransition.frameCount % 6 == 0) {
|
||||
CreateDustSmall(super);
|
||||
}
|
||||
this->unk71 = 10;
|
||||
animationState = super->animationState = sub_0806F5B0(super->direction);
|
||||
animIndex = (animationState >> 1) + 4 + this->unk70;
|
||||
this->unk_71 = 10;
|
||||
animationState = super->animationState = GetAnimationStateForDirection8(super->direction);
|
||||
animIndex = (animationState >> 1) + 4 + this->unk_70;
|
||||
if (animIndex != super->animIndex) {
|
||||
InitializeAnimation(super, animIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->unk71 == 0) {
|
||||
animationState = super->animationState = sub_0806F5B0(GetFacingDirection(super, &gPlayerEntity));
|
||||
animIndex = (animationState >> 1) + this->unk70;
|
||||
if (this->unk_71 == 0) {
|
||||
animationState = super->animationState =
|
||||
GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity));
|
||||
animIndex = (animationState >> 1) + this->unk_70;
|
||||
if (animIndex != super->animIndex) {
|
||||
InitializeAnimation(super, animIndex);
|
||||
}
|
||||
@@ -164,8 +165,8 @@ void sub_080642B8(GuardWithSpearEntity* this) {
|
||||
u32 animIndex;
|
||||
u32 animationState;
|
||||
|
||||
if (this->unk71 > 0) {
|
||||
this->unk71--;
|
||||
if (this->unk_71 > 0) {
|
||||
this->unk_71--;
|
||||
}
|
||||
|
||||
yDiff = gPlayerEntity.x.HALF.HI - super->x.HALF.HI;
|
||||
@@ -191,17 +192,18 @@ void sub_080642B8(GuardWithSpearEntity* this) {
|
||||
if (0x140 < gPlayerEntity.speed && gRoomTransition.frameCount % 6 == 0) {
|
||||
CreateDustSmall(super);
|
||||
}
|
||||
this->unk71 = 10;
|
||||
animationState = super->animationState = sub_0806F5B0(super->direction);
|
||||
animIndex = (animationState >> 1) + 4 + this->unk70;
|
||||
this->unk_71 = 10;
|
||||
animationState = super->animationState = GetAnimationStateForDirection8(super->direction);
|
||||
animIndex = (animationState >> 1) + 4 + this->unk_70;
|
||||
if (animIndex != super->animIndex) {
|
||||
InitializeAnimation(super, animIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->unk71 == 0) {
|
||||
animationState = super->animationState = sub_0806F5B0(GetFacingDirection(super, &gPlayerEntity));
|
||||
animIndex = (animationState >> 1) + this->unk70;
|
||||
if (this->unk_71 == 0) {
|
||||
animationState = super->animationState =
|
||||
GetAnimationStateForDirection8(GetFacingDirection(super, &gPlayerEntity));
|
||||
animIndex = (animationState >> 1) + this->unk_70;
|
||||
if (animIndex != super->animIndex) {
|
||||
InitializeAnimation(super, animIndex);
|
||||
}
|
||||
|
||||
+29
-22
@@ -4,50 +4,57 @@
|
||||
*
|
||||
* @brief Hurdy Gurdy Man NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
#include "save.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 unk_69;
|
||||
} HurdyGurdyManEntity;
|
||||
|
||||
static const SpriteLoadData gUnk_081144F0[] = { { 0x163, 0x59, 0x4 }, { 0x4163, 0x59, 0x4 }, { 0, 0, 0 } };
|
||||
|
||||
extern u16* gUnk_08001A7C[];
|
||||
|
||||
void HurdyGurdyMan(Entity* this) {
|
||||
void HurdyGurdyMan(HurdyGurdyManEntity* this) {
|
||||
u32 index;
|
||||
u16* pointerToArray;
|
||||
|
||||
switch (this->action) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
if (LoadExtraSpriteData(this, gUnk_081144F0)) {
|
||||
this->action = 1;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
if (LoadExtraSpriteData(super, gUnk_081144F0)) {
|
||||
super->action = 1;
|
||||
this->unk_69 = 0;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
index = GetFuserId(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
this->unk_69 = super->animIndex;
|
||||
InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
index = GetFuserId(super);
|
||||
pointerToArray = gUnk_08001A7C[index];
|
||||
if (this->field_0x68.HALF.LO == 0x32) {
|
||||
if (this->fusionOffer == 0x32) {
|
||||
pointerToArray = pointerToArray + 3;
|
||||
}
|
||||
sub_0801DFB4(this, *pointerToArray, pointerToArray[1], (u32)pointerToArray[2]);
|
||||
InitializeFuseInfo(super, *pointerToArray, pointerToArray[1], (u32)pointerToArray[2]);
|
||||
gPlayerState.controlMode = CONTROL_DISABLED;
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2:
|
||||
if ((UpdateFuseInteraction(this) != 0)) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->field_0x68.HALF.HI);
|
||||
if ((UpdateFuseInteraction(super) != 0)) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, this->unk_69);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -106,9 +113,9 @@ void sub_0806E418(Entity* this) {
|
||||
ShowNPCDialogue(this, &dialogs[tmp]);
|
||||
}
|
||||
|
||||
void HurdyGurdyMan_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void HurdyGurdyMan_MakeInteractable(HurdyGurdyManEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void HurdyGurdyMan_Fusion(Entity* this) {
|
||||
|
||||
+135
-120
@@ -4,10 +4,25 @@
|
||||
*
|
||||
* @brief Kid NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "message.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68;
|
||||
/*0x69*/ u8 unk_69;
|
||||
/*0x6a*/ u8 fusionOffer;
|
||||
/*0x6b*/ u8 unk_6b;
|
||||
/*0x6c*/ u16 unk_6c;
|
||||
/*0x6e*/ u16 unk_6e;
|
||||
/*0x70*/ u8 unused1[16];
|
||||
/*0x80*/ u16 unk_80;
|
||||
/*0x82*/ u8 unused2[2];
|
||||
/*0x84*/ ScriptExecutionContext* context;
|
||||
} KidEntity;
|
||||
|
||||
const SpriteLoadData gUnk_0810BD7C[] = {
|
||||
{ 58, 59, 4 },
|
||||
{ 10298, 59, 4 },
|
||||
@@ -78,13 +93,12 @@ const u16 gUnk_0810BDE8[][2] = { {
|
||||
TEXT_INDEX(TEXT_EMPTY, 0x1),
|
||||
TEXT_INDEX(TEXT_EMPTY, 0x1),
|
||||
} };
|
||||
void sub_080620F4(Entity*);
|
||||
void sub_08062130(Entity*);
|
||||
void sub_08062194(Entity*);
|
||||
void (*const gUnk_0810BE0C[])(Entity*) = { sub_080620F4, sub_08062130, sub_08062194 };
|
||||
void sub_080620F4(KidEntity*);
|
||||
void sub_08062130(KidEntity*);
|
||||
void sub_08062194(KidEntity*);
|
||||
void (*const gUnk_0810BE0C[])(KidEntity*) = { sub_080620F4, sub_08062130, sub_08062194 };
|
||||
extern s32 sub_080041E8(s32 x1, s32 y1, s32 x2, s32 y2);
|
||||
|
||||
void sub_08062194(Entity*);
|
||||
const Dialog gUnk_0810BE10[] = {
|
||||
{ 0, 0, DIALOG_NORMAL, 1, { 0, TEXT_INDEX(TEXT_FESTIVAL, 0xf) } },
|
||||
{ 0, 0, DIALOG_NORMAL, 1, { 0, TEXT_INDEX(TEXT_TOWN4, 0x33) } },
|
||||
@@ -184,10 +198,10 @@ const FrameStruct gUnk_0810C0A0[] = {
|
||||
{ 120, 83 }, { 128, 15 }, { 131, 102 }, { 128, 15 }, { 139, 111 }, { 128, 15 },
|
||||
};
|
||||
|
||||
void sub_080621AC(Entity*);
|
||||
void sub_080622F4(Entity*);
|
||||
void sub_0806265C(Entity*, ScriptExecutionContext*);
|
||||
void sub_0806252C(Entity*);
|
||||
void sub_080621AC(KidEntity* this);
|
||||
void sub_080622F4(KidEntity* this);
|
||||
void sub_0806265C(Entity* this, ScriptExecutionContext* context);
|
||||
void sub_0806252C(Entity* this);
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
@@ -203,114 +217,115 @@ typedef union {
|
||||
|
||||
#define KID_HEAP_COUNT 0x14
|
||||
typedef KidHeapItem KidHeap[KID_HEAP_COUNT];
|
||||
#define KID_HEAP ((KidHeapItem*)this->myHeap)
|
||||
#define KID_HEAP ((KidHeapItem*)super->myHeap)
|
||||
|
||||
void Kid(Entity* this) {
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
void Kid(KidEntity* this) {
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
sub_080621AC(this);
|
||||
} else {
|
||||
gUnk_0810BE0C[this->action](this);
|
||||
gUnk_0810BE0C[super->action](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080620F4(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, gUnk_0810BDC4[this->type])) {
|
||||
this->animationState = 4;
|
||||
this->field_0x68.HALF.LO = 0;
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
AddInteractableWhenBigObject(this);
|
||||
void sub_080620F4(KidEntity* this) {
|
||||
if (LoadExtraSpriteData(super, gUnk_0810BDC4[super->type])) {
|
||||
super->animationState = 4;
|
||||
this->unk_68 = 0;
|
||||
super->action = 1;
|
||||
InitAnimationForceUpdate(super, 2);
|
||||
AddInteractableWhenBigObject(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08062130(Entity* this) {
|
||||
if (this->interactType != 0) {
|
||||
this->action = 2;
|
||||
InitAnimationForceUpdate(this, GetAnimationState(this));
|
||||
void sub_08062130(KidEntity* this) {
|
||||
if (super->interactType != 0) {
|
||||
super->action = 2;
|
||||
InitAnimationForceUpdate(super, GetAnimationState(super));
|
||||
}
|
||||
if (this->subtimer++ >= 0x79) {
|
||||
this->subtimer = 0;
|
||||
this->timer = (this->timer + 1) & 7;
|
||||
if (this->type == 6) {
|
||||
this->timer = this->timer + 16;
|
||||
if (super->subtimer++ >= 0x79) {
|
||||
super->subtimer = 0;
|
||||
super->timer = (super->timer + 1) & 7;
|
||||
if (super->type == 6) {
|
||||
super->timer = super->timer + 16;
|
||||
}
|
||||
InitAnimationForceUpdate(this, this->timer);
|
||||
InitAnimationForceUpdate(super, super->timer);
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
sub_0806ED78(this);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
|
||||
void sub_08062194(Entity* this) {
|
||||
void sub_08062194(KidEntity* this) {
|
||||
MessageFromTarget(0);
|
||||
this->action = 1;
|
||||
this->interactType = 0;
|
||||
super->action = 1;
|
||||
super->interactType = 0;
|
||||
}
|
||||
|
||||
void sub_080621AC(Entity* this) {
|
||||
void sub_080621AC(KidEntity* this) {
|
||||
u32 tmp;
|
||||
|
||||
switch (this->action) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
if (LoadExtraSpriteData(this, gUnk_0810BDC4[this->type])) {
|
||||
this->action = 1;
|
||||
this->animationState = this->timer;
|
||||
this->timer = 0;
|
||||
this->field_0x68.HALF.LO = 0;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
this->field_0x6a.HALF.HI = 0xff;
|
||||
tmp = sub_0805ACC0(this);
|
||||
if (LoadExtraSpriteData(super, gUnk_0810BDC4[super->type])) {
|
||||
super->action = 1;
|
||||
super->animationState = super->timer;
|
||||
super->timer = 0;
|
||||
this->unk_68 = 0;
|
||||
this->unk_69 = 0;
|
||||
this->unk_6b = 0xff;
|
||||
tmp = sub_0805ACC0(super);
|
||||
if (tmp == 0) {
|
||||
this->field_0x6c.HWORD = this->x.HALF.HI;
|
||||
this->field_0x6e.HWORD = this->y.HALF.HI;
|
||||
this->unk_6c = super->x.HALF.HI;
|
||||
this->unk_6e = super->y.HALF.HI;
|
||||
} else {
|
||||
this->field_0x6c.HWORD = tmp >> 0x10;
|
||||
this->field_0x6e.HWORD = tmp;
|
||||
this->unk_6c = tmp >> 0x10;
|
||||
this->unk_6e = tmp;
|
||||
}
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 3;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 3;
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
if ((s8)this->field_0x68.HALF.LO != 0) {
|
||||
if (this->interactType != 0) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
if ((s8)this->unk_68 != 0) {
|
||||
if (super->interactType != 0) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
} else {
|
||||
sub_080622F4(this);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
if (this->interactType != 0) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
if (super->interactType != 0) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
sub_0806265C(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
|
||||
tmp = this->animIndex;
|
||||
sub_0806265C(super, this->context);
|
||||
tmp = super->animIndex;
|
||||
}
|
||||
this->field_0x6a.HALF.HI = this->animIndex;
|
||||
if (this->animIndex < 8) {
|
||||
InitializeAnimation(this, (this->animIndex & 0xfffffffc) +
|
||||
sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
this->unk_6b = super->animIndex;
|
||||
if (super->animIndex < 8) {
|
||||
InitializeAnimation(super,
|
||||
(super->animIndex & 0xfffffffc) +
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(super);
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
this->action = 1;
|
||||
super->action = 1;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -326,7 +341,7 @@ void sub_080621AC(Entity* this) {
|
||||
heapPtr--; \
|
||||
}
|
||||
|
||||
void sub_080622F4(Entity* this) {
|
||||
void sub_080622F4(KidEntity* this) {
|
||||
s32 dx;
|
||||
s32 dy;
|
||||
s32 dist;
|
||||
@@ -346,10 +361,10 @@ void sub_080622F4(Entity* this) {
|
||||
item.FIELDS.animationState = gPlayerEntity.animationState;
|
||||
item.FIELDS.collisionLayer = gPlayerEntity.collisionLayer;
|
||||
|
||||
heapPtr = this->myHeap;
|
||||
heapPtr = super->myHeap;
|
||||
if (heapPtr->FIELDS.framestate == 0x16 && item.FIELDS.framestate != 0x16) {
|
||||
dx = this->x.HALF.HI - gPlayerEntity.x.HALF.HI;
|
||||
dy = this->y.HALF.HI - gPlayerEntity.y.HALF.HI;
|
||||
dx = super->x.HALF.HI - gPlayerEntity.x.HALF.HI;
|
||||
dy = super->y.HALF.HI - gPlayerEntity.y.HALF.HI;
|
||||
|
||||
if (dx < 0)
|
||||
dx = -dx;
|
||||
@@ -357,11 +372,11 @@ void sub_080622F4(Entity* this) {
|
||||
dy = -dy;
|
||||
|
||||
if (dx > 120 || dy > 80) {
|
||||
this->field_0x68.HALF.LO = 0;
|
||||
this->unk_68 = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
sub_0806252C(this);
|
||||
sub_0806252C(super);
|
||||
}
|
||||
|
||||
animIndex = 0;
|
||||
@@ -372,8 +387,8 @@ void sub_080622F4(Entity* this) {
|
||||
heapPtr[0] = item;
|
||||
|
||||
animIndex = 0x4;
|
||||
if ((s8)this->field_0x68.HALF.HI > 0) {
|
||||
this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1;
|
||||
if ((s8)this->unk_69 > 0) {
|
||||
this->unk_69 = this->unk_69 - 1;
|
||||
}
|
||||
} else {
|
||||
heapPtr += KID_HEAP_COUNT - 1;
|
||||
@@ -393,40 +408,40 @@ void sub_080622F4(Entity* this) {
|
||||
}
|
||||
heapPtr = KID_HEAP;
|
||||
heapPtr += +KID_HEAP_COUNT - 1;
|
||||
this->x.HALF.HI = heapPtr->FIELDS.x;
|
||||
this->y.HALF.HI = heapPtr->FIELDS.y;
|
||||
this->z.HALF.HI = heapPtr->FIELDS.z;
|
||||
this->animationState = heapPtr->FIELDS.animationState;
|
||||
this->collisionLayer = heapPtr->FIELDS.collisionLayer;
|
||||
super->x.HALF.HI = heapPtr->FIELDS.x;
|
||||
super->y.HALF.HI = heapPtr->FIELDS.y;
|
||||
super->z.HALF.HI = heapPtr->FIELDS.z;
|
||||
super->animationState = heapPtr->FIELDS.animationState;
|
||||
super->collisionLayer = heapPtr->FIELDS.collisionLayer;
|
||||
|
||||
if (((s8)this->field_0x68.HALF.HI) > 0) {
|
||||
this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1;
|
||||
if (((s8)this->unk_69) > 0) {
|
||||
this->unk_69 = this->unk_69 - 1;
|
||||
}
|
||||
|
||||
animIndexTmp = animIndex;
|
||||
animIndex += this->animationState >> 1;
|
||||
if (this->type == OBJECT) {
|
||||
animIndex += super->animationState >> 1;
|
||||
if (super->type == OBJECT) {
|
||||
animIndex += 0x10;
|
||||
}
|
||||
|
||||
if (!(animIndex == this->animIndex || (animIndexTmp == 0 && ((s8)this->field_0x68.HALF.HI) > 0))) {
|
||||
InitAnimationForceUpdate(this, animIndex);
|
||||
this->field_0x68.HALF.HI = 0x1e;
|
||||
if (!(animIndex == super->animIndex || (animIndexTmp == 0 && ((s8)this->unk_69) > 0))) {
|
||||
InitAnimationForceUpdate(super, animIndex);
|
||||
this->unk_69 = 0x1e;
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
sub_0800451C(this);
|
||||
sub_0800451C(super);
|
||||
return;
|
||||
}
|
||||
|
||||
void sub_08062500(Entity* this) {
|
||||
this->myHeap = zMalloc(sizeof(KidHeap));
|
||||
if (this->myHeap != NULL) {
|
||||
this->field_0x68.HALF.LO = 1;
|
||||
RemoveInteractableObject(this);
|
||||
this->hitbox = NULL;
|
||||
sub_0806252C(this);
|
||||
void sub_08062500(KidEntity* this) {
|
||||
super->myHeap = zMalloc(sizeof(KidHeap));
|
||||
if (super->myHeap != NULL) {
|
||||
this->unk_68 = 1;
|
||||
RemoveInteractableObject(super);
|
||||
super->hitbox = NULL;
|
||||
sub_0806252C(super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,7 +657,7 @@ void Kid_Head(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08062948(Entity* this, ScriptExecutionContext* context) {
|
||||
void sub_08062948(KidEntity* this, ScriptExecutionContext* context) {
|
||||
s32 bVar1;
|
||||
u16 uVar2;
|
||||
u32 uVar3;
|
||||
@@ -652,7 +667,7 @@ void sub_08062948(Entity* this, ScriptExecutionContext* context) {
|
||||
context->unk_18++;
|
||||
context->unk_12 = (Random() & 0x3f) + 0x20;
|
||||
uVar3 = Random() & 0x18;
|
||||
switch (this->direction) {
|
||||
switch (super->direction) {
|
||||
case 0:
|
||||
if (uVar3 == 0x10) {
|
||||
uVar3 = 8;
|
||||
@@ -674,32 +689,32 @@ void sub_08062948(Entity* this, ScriptExecutionContext* context) {
|
||||
}
|
||||
}
|
||||
|
||||
this->direction = (u8)uVar3;
|
||||
this->animationState = sub_0806F5B0(uVar3);
|
||||
this->speed = 0x80;
|
||||
super->direction = (u8)uVar3;
|
||||
super->animationState = GetAnimationStateForDirection8(uVar3);
|
||||
super->speed = 0x80;
|
||||
}
|
||||
uVar3 = (this->animationState >> 1) + 4;
|
||||
if (uVar3 != this->animIndex) {
|
||||
InitializeAnimation(this, uVar3);
|
||||
this->field_0x80.HWORD = (u16)this->animIndex;
|
||||
uVar3 = (super->animationState >> 1) + 4;
|
||||
if (uVar3 != super->animIndex) {
|
||||
InitializeAnimation(super, uVar3);
|
||||
this->unk_80 = (u16)super->animIndex;
|
||||
}
|
||||
ProcessMovement0(this);
|
||||
iVar4 = this->x.HALF.HI - (s16)this->field_0x6c.HWORD;
|
||||
ProcessMovement0(super);
|
||||
iVar4 = super->x.HALF.HI - (s16)this->unk_6c;
|
||||
if (0x10 < iVar4) {
|
||||
this->x.HALF.HI = this->field_0x6c.HWORD + 0x10;
|
||||
super->x.HALF.HI = this->unk_6c + 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
if (iVar4 < -0x10) {
|
||||
this->x.HALF.HI = this->field_0x6c.HWORD - 0x10;
|
||||
super->x.HALF.HI = this->unk_6c - 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
iVar4 = this->y.HALF.HI - (s16)this->field_0x6e.HWORD;
|
||||
iVar4 = super->y.HALF.HI - (s16)this->unk_6e;
|
||||
if (0x10 < iVar4) {
|
||||
this->y.HALF.HI = this->field_0x6e.HWORD + 0x10;
|
||||
super->y.HALF.HI = this->unk_6e + 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
if (iVar4 < -0x10) {
|
||||
this->y.HALF.HI = this->field_0x6e.HWORD - 0x10;
|
||||
super->y.HALF.HI = this->unk_6e - 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
if (--context->unk_12 != 0) {
|
||||
@@ -707,9 +722,9 @@ void sub_08062948(Entity* this, ScriptExecutionContext* context) {
|
||||
}
|
||||
}
|
||||
|
||||
void Kid_MakeInteractable(Entity* this, ScriptExecutionContext* context) {
|
||||
this->field_0x6a.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x6a.HALF.LO);
|
||||
void Kid_MakeInteractable(KidEntity* this, ScriptExecutionContext* context) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Kid_Fusion(Entity* this) {
|
||||
|
||||
+55
-49
@@ -4,96 +4,102 @@
|
||||
*
|
||||
* @brief King Daltus NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
#include "script.h"
|
||||
|
||||
void sub_08066654(Entity*);
|
||||
void sub_08066688(Entity*);
|
||||
void sub_080666DC(Entity*);
|
||||
void sub_080666E4(Entity*);
|
||||
void sub_0806670C(Entity*);
|
||||
void sub_08066718(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} KingDaltusEntity;
|
||||
|
||||
void KingDaltus(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void sub_08066654(KingDaltusEntity*);
|
||||
void sub_08066688(KingDaltusEntity*);
|
||||
void sub_080666DC(KingDaltusEntity*);
|
||||
void sub_080666E4(KingDaltusEntity*);
|
||||
void sub_0806670C(KingDaltusEntity*);
|
||||
void sub_08066718(KingDaltusEntity*);
|
||||
|
||||
void KingDaltus(KingDaltusEntity* this) {
|
||||
static void (*const actionFuncs[])(KingDaltusEntity*) = {
|
||||
sub_08066654,
|
||||
sub_08066688,
|
||||
sub_080666DC,
|
||||
};
|
||||
static void (*const scriptedActionFuncs[])(Entity*) = {
|
||||
static void (*const scriptedActionFuncs[])(KingDaltusEntity*) = {
|
||||
sub_080666E4,
|
||||
sub_0806670C,
|
||||
sub_08066718,
|
||||
};
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
if (this->interactType == 2) {
|
||||
this->interactType = 0;
|
||||
this->action = 2;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
if (super->interactType == 2) {
|
||||
super->interactType = 0;
|
||||
super->action = 2;
|
||||
InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
}
|
||||
scriptedActionFuncs[this->action](this);
|
||||
scriptedActionFuncs[super->action](this);
|
||||
} else {
|
||||
actionFuncs[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
actionFuncs[super->action](this);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066654(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
void sub_08066654(KingDaltusEntity* this) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
InitAnimationForceUpdate(super, 2);
|
||||
}
|
||||
|
||||
void sub_08066688(Entity* this) {
|
||||
s32 tmp = GetAnimationStateInRectRadius(this, 0x28, 0x28);
|
||||
void sub_08066688(KingDaltusEntity* this) {
|
||||
s32 tmp = GetAnimationStateInRectRadius(super, 0x28, 0x28);
|
||||
if (tmp < 0) {
|
||||
tmp = 2;
|
||||
} else {
|
||||
if (this->subtimer == 0) {
|
||||
this->subtimer = 16;
|
||||
if (super->subtimer == 0) {
|
||||
super->subtimer = 16;
|
||||
} else {
|
||||
this->subtimer--;
|
||||
tmp = this->animIndex;
|
||||
super->subtimer--;
|
||||
tmp = super->animIndex;
|
||||
}
|
||||
}
|
||||
if (sub_0806F078(this, tmp) == 0) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (sub_0806F078(super, tmp) == 0) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
if (this->interactType != 0) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
if (super->interactType != 0) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080666DC(Entity* this) {
|
||||
this->action = 1;
|
||||
void sub_080666DC(KingDaltusEntity* this) {
|
||||
super->action = 1;
|
||||
}
|
||||
|
||||
void sub_080666E4(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
sub_0807DD50(this);
|
||||
void sub_080666E4(KingDaltusEntity* this) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
|
||||
void sub_0806670C(Entity* this) {
|
||||
sub_0807DD94(this, NULL);
|
||||
void sub_0806670C(KingDaltusEntity* this) {
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
|
||||
void sub_08066718(Entity* this) {
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
void sub_08066718(KingDaltusEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void KingDaltus_MakeInteractable(Entity* this) {
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void KingDaltus_MakeInteractable(KingDaltusEntity* this) {
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void sub_0806673C(Entity* this) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief King Gustaf NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "screen.h"
|
||||
@@ -16,13 +17,13 @@ void KingGustaf(Entity* this) {
|
||||
this->spriteRendering.alphaBlend = 1;
|
||||
this->collisionLayer = 2;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
gScreen.controls.layerFXControl = 0x3f40;
|
||||
gScreen.controls.alphaBlend = 0x1000;
|
||||
this->speed = 0x1000;
|
||||
this->zVelocity = 0;
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
speed = 0x100;
|
||||
speed *= this->speed;
|
||||
speed += this->zVelocity;
|
||||
|
||||
+24
-18
@@ -4,35 +4,41 @@
|
||||
*
|
||||
* @brief Librari NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
|
||||
void Librari(Entity* this) {
|
||||
switch (this->action) {
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} LibrariEntity;
|
||||
|
||||
void Librari(LibrariEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = TRUE;
|
||||
this->animationState = this->timer;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = TRUE;
|
||||
super->animationState = super->timer;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitScriptForNPC(super);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
if (UpdateFuseInteraction(super)) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Librarians NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
@@ -19,7 +20,7 @@ extern const u8 gUnk_08114F30[];
|
||||
void Librarians(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
this->spriteRendering.b3 = gUnk_08114F30[this->spriteRendering.b3];
|
||||
}
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Mailbox NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "effects.h"
|
||||
#include "entity.h"
|
||||
#include "message.h"
|
||||
|
||||
+33
-27
@@ -4,32 +4,38 @@
|
||||
*
|
||||
* @brief Malon NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "script.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} MalonEntity;
|
||||
|
||||
void sub_08065864(Entity* this);
|
||||
void sub_08065880(Entity* this);
|
||||
void sub_08065888(Entity* this);
|
||||
void sub_080658BC(Entity* this);
|
||||
void sub_08065900(Entity* this);
|
||||
void sub_08065888(MalonEntity* this);
|
||||
void sub_080658BC(MalonEntity* this);
|
||||
void sub_08065900(MalonEntity* this);
|
||||
|
||||
void Malon(Entity* this) {
|
||||
void Malon(MalonEntity* this) {
|
||||
static void (*const actionFuncs[])(Entity * this) = {
|
||||
sub_08065864,
|
||||
sub_08065880,
|
||||
};
|
||||
static void (*const scriptedActionFuncs[])(Entity * this) = {
|
||||
static void (*const scriptedActionFuncs[])(MalonEntity * this) = {
|
||||
sub_08065888,
|
||||
sub_080658BC,
|
||||
sub_08065900,
|
||||
};
|
||||
if (this->flags & ENT_SCRIPTED) {
|
||||
scriptedActionFuncs[this->action](this);
|
||||
if (super->flags & ENT_SCRIPTED) {
|
||||
scriptedActionFuncs[super->action](this);
|
||||
} else {
|
||||
actionFuncs[this->action](this);
|
||||
if (this->action != 0) {
|
||||
sub_0806ED78(this);
|
||||
actionFuncs[super->action](super);
|
||||
if (super->action != 0) {
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,29 +50,29 @@ void sub_08065880(Entity* this) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
|
||||
void sub_08065888(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->animationState = 4;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
sub_0807DD50(this);
|
||||
void sub_08065888(MalonEntity* this) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->animationState = 4;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
|
||||
void sub_080658BC(Entity* this) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
void sub_080658BC(MalonEntity* this) {
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitAnimationForceUpdate(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065900(Entity* this) {
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
void sub_08065900(MalonEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+30
-23
@@ -4,11 +4,18 @@
|
||||
*
|
||||
* @brief Mama NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "save.h"
|
||||
#include "script.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 animIndex;
|
||||
} MamaEntity;
|
||||
|
||||
static const SpriteLoadData gUnk_08113754[] = {
|
||||
{ 0x101, 0x4e, 0x4 },
|
||||
{ 0x2101, 0x4e, 0x4 },
|
||||
@@ -17,35 +24,35 @@ static const SpriteLoadData gUnk_08113754[] = {
|
||||
|
||||
bool32 sub_0806C454(Entity* this);
|
||||
|
||||
void Mama(Entity* this) {
|
||||
switch (this->action) {
|
||||
void Mama(MamaEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
if (sub_0806C454(this) != 0) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->animationState = this->timer;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
sub_0807DD50(this);
|
||||
if (sub_0806C454(super) != 0) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->animationState = super->timer;
|
||||
this->animIndex = 0;
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
this->animIndex = super->animIndex;
|
||||
InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
GetNextFrame(this);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->field_0x68.HALF.HI);
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, this->animIndex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -98,9 +105,9 @@ void sub_0806C4DC(Entity* this) {
|
||||
ShowNPCDialogue(this, &dialogs[gSave.global_progress]);
|
||||
}
|
||||
|
||||
void Mama_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Mama_MakeInteractable(MamaEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Mama_Fusion(Entity* this) {
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Marcy NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
@@ -16,7 +17,7 @@ void Marcy(Entity* this) {
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD64(this);
|
||||
}
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
|
||||
void sub_08062D18(Entity* this, ScriptExecutionContext* context) {
|
||||
|
||||
+27
-19
@@ -4,40 +4,48 @@
|
||||
*
|
||||
* @brief Mayor Hagen NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
#include "player.h"
|
||||
|
||||
void MayorHagen(Entity* this) {
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 animIndex;
|
||||
} MayorHagenEntity;
|
||||
|
||||
void MayorHagen(MayorHagenEntity* this) {
|
||||
u32 v;
|
||||
switch (this->action) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
super->action = 1;
|
||||
this->animIndex = 0;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitScriptForNPC(super);
|
||||
break;
|
||||
case 1:
|
||||
v = this->interactType;
|
||||
v = super->interactType;
|
||||
if (v == 2) {
|
||||
this->action = v;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitAnimationForceUpdate(this, 4 + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
super->action = v;
|
||||
super->interactType = 0;
|
||||
this->animIndex = super->animIndex;
|
||||
InitAnimationForceUpdate(super,
|
||||
4 + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
break;
|
||||
}
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, this->field_0x68.HALF.HI);
|
||||
if (UpdateFuseInteraction(super)) {
|
||||
super->action = 1;
|
||||
InitAnimationForceUpdate(super, this->animIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-6
@@ -4,9 +4,15 @@
|
||||
*
|
||||
* @brief Melari NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} MelariEntity;
|
||||
|
||||
void sub_08068780(Entity*);
|
||||
void sub_08068708(Entity*);
|
||||
void sub_08068730(Entity*);
|
||||
@@ -73,13 +79,13 @@ void sub_08068780(Entity* this) {
|
||||
this->spriteSettings.draw = TRUE;
|
||||
this->animationState = this->type;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
InitializeNPCFusion(this);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
@@ -106,9 +112,9 @@ void sub_08068780(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void Melari_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Melari_MakeInteractable(MelariEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Melari_Head(Entity* this) {
|
||||
@@ -142,7 +148,7 @@ void sub_08068910(Entity* this) {
|
||||
iVar1 = 0x10;
|
||||
} else {
|
||||
}
|
||||
iVar1 = sub_0806F5A4(iVar1);
|
||||
iVar1 = GetAnimationStateForDirection4(iVar1);
|
||||
InitializeAnimation(this, (this->animIndex & -0x4) + iVar1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Milk Cart NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
u32 filler;
|
||||
union SplitWord field_0x6c;
|
||||
u32 field_0x70;
|
||||
u8 filler2[0xC];
|
||||
s16 field_0x80;
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u32 filler;
|
||||
/*0x6c*/ union SplitWord field_0x6c;
|
||||
/*0x70*/ u32 field_0x70;
|
||||
/*0x74*/ u8 filler2[0xC];
|
||||
/*0x80*/ s16 field_0x80;
|
||||
} MinishEzloEntity;
|
||||
|
||||
extern void sub_0806FF10(Entity* this, u32 param_2, u32 param_3);
|
||||
@@ -34,7 +34,7 @@ void MinishEzlo(Entity* this) {
|
||||
this->action++;
|
||||
this->animationState = this->timer * 2;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
}
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
|
||||
+26
-19
@@ -4,28 +4,34 @@
|
||||
*
|
||||
* @brief Minister Potho NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "item.h"
|
||||
#include "message.h"
|
||||
#include "npc.h"
|
||||
|
||||
void sub_08066864(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} MinisterPothoEntity;
|
||||
|
||||
void sub_08066864(MinisterPothoEntity*);
|
||||
void sub_080667E4(Entity*);
|
||||
void sub_08066808(Entity*);
|
||||
void sub_0806685C(Entity*);
|
||||
|
||||
void MinisterPotho(Entity* this) {
|
||||
void MinisterPotho(MinisterPothoEntity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
sub_080667E4,
|
||||
sub_08066808,
|
||||
sub_0806685C,
|
||||
};
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
sub_08066864(this);
|
||||
} else {
|
||||
actionFuncs[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
actionFuncs[super->action](super);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,27 +67,28 @@ void sub_0806685C(Entity* this) {
|
||||
this->action = 1;
|
||||
}
|
||||
|
||||
void sub_08066864(Entity* this) {
|
||||
switch (this->action) {
|
||||
void sub_08066864(MinisterPothoEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
sub_0807DD50(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
InitScriptForNPC(super);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
*
|
||||
* @brief Moblin Lady NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
|
||||
void MoblinLady(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
+61
-53
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Mountain Minish NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
@@ -12,6 +13,12 @@
|
||||
#include "npc.h"
|
||||
#include "script.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 animIndex;
|
||||
} MountainMinishEntity;
|
||||
|
||||
const u8 gUnk_08111284[][0x20] = {
|
||||
{ 0x8, 0x1, 0x9, 0x1, 0xa, 0x1, 0xb, 0x83, 0xc, 0x83, 0xd, 0x83, 0xe, 0x83, 0xf, 0x80,
|
||||
0, 0x80, 0x1, 0x80, 0x2, 0x82, 0x3, 0x82, 0x4, 0x82, 0x5, 0x82, 0x6, 0x1, 0x7, 0x1 },
|
||||
@@ -40,21 +47,21 @@ const SpriteLoadData gUnk_08111358[] = {
|
||||
{ 0x0, 0x0, 0x0 },
|
||||
};
|
||||
|
||||
void sub_08067EF0(Entity*);
|
||||
void sub_08067EF0(MountainMinishEntity*);
|
||||
void sub_08068190(Entity*);
|
||||
void sub_08067E60(Entity*);
|
||||
void sub_08067E88(Entity*);
|
||||
void sub_08067EE8(Entity*);
|
||||
|
||||
void MountainMinish(Entity* this) {
|
||||
void MountainMinish(MountainMinishEntity* this) {
|
||||
static void (*const MountainMinish_Actions[])(Entity*) = {
|
||||
sub_08067E60,
|
||||
sub_08067E88,
|
||||
sub_08067EE8,
|
||||
};
|
||||
if ((this->flags & ENT_SCRIPTED) == 0) {
|
||||
MountainMinish_Actions[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
if ((super->flags & ENT_SCRIPTED) == 0) {
|
||||
MountainMinish_Actions[super->action](super);
|
||||
sub_0806ED78(super);
|
||||
} else {
|
||||
sub_08067EF0(this);
|
||||
}
|
||||
@@ -96,7 +103,7 @@ void sub_08067EE8(Entity* this) {
|
||||
this->action = 1;
|
||||
}
|
||||
|
||||
void sub_08067EF0(Entity* this) {
|
||||
void sub_08067EF0(MountainMinishEntity* this) {
|
||||
static const u16 gUnk_08111374[] = {
|
||||
SFX_HAMMER1,
|
||||
SFX_HAMMER2,
|
||||
@@ -110,84 +117,85 @@ void sub_08067EF0(Entity* this) {
|
||||
};
|
||||
Entity* fxEnt;
|
||||
|
||||
switch (this->action) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
if (!LoadExtraSpriteData(this, gUnk_08111358)) {
|
||||
if (!LoadExtraSpriteData(super, gUnk_08111358)) {
|
||||
return;
|
||||
}
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->animationState = this->type;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
SetDefaultPriority(this, 2);
|
||||
sub_0807DD50(this);
|
||||
InitializeAnimation(this, gUnk_08111304[this->type2]);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->animationState = super->type;
|
||||
this->animIndex = 0;
|
||||
SetDefaultPriority(super, 2);
|
||||
InitScriptForNPC(super);
|
||||
InitializeAnimation(super, gUnk_08111304[super->type2]);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 3;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 3;
|
||||
super->interactType = 0;
|
||||
this->animIndex = super->animIndex;
|
||||
InitializeAnimation(super, GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, 0);
|
||||
HandleEntity0x82Actions(this);
|
||||
if ((this->type2 == 3) && (this->interactType != 0)) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_08068190(this);
|
||||
ExecuteScriptForEntity(super, 0);
|
||||
HandleEntity0x82Actions(super);
|
||||
if ((super->type2 == 3) && (super->interactType != 0)) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitializeAnimation(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
sub_08068190(super);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if ((gMessage.doTextBox & 0x7f) != 0)
|
||||
break;
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, (this->animationState >> 1) + 4);
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, (super->animationState >> 1) + 4);
|
||||
break;
|
||||
case 3:
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->field_0x68.HALF.HI);
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, this->animIndex);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->frameDuration != 0xff) {
|
||||
GetNextFrame(this);
|
||||
if (super->frameDuration != 0xff) {
|
||||
GetNextFrame(super);
|
||||
}
|
||||
if ((this->frameSpriteSettings & 1) != 0) {
|
||||
this->frameSpriteSettings &= 0xfe;
|
||||
if (CheckOnScreen(this) == 0) {
|
||||
if ((super->frameSpriteSettings & 1) != 0) {
|
||||
super->frameSpriteSettings &= 0xfe;
|
||||
if (CheckOnScreen(super) == 0) {
|
||||
SoundReq(gUnk_0811137A[((s32)Random()) % 3]);
|
||||
} else {
|
||||
EnqueueSFX(gUnk_08111374[((s32)Random()) % 3]);
|
||||
}
|
||||
}
|
||||
if ((this->frameSpriteSettings & 2) != 0) {
|
||||
this->frameSpriteSettings &= ~2;
|
||||
fxEnt = CreateFx(this, FX_ROCK, 0);
|
||||
if ((super->frameSpriteSettings & 2) != 0) {
|
||||
super->frameSpriteSettings &= ~2;
|
||||
fxEnt = CreateFx(super, FX_ROCK, 0);
|
||||
if (fxEnt != NULL) {
|
||||
PositionRelative(this, fxEnt, 0, Q_16_16(-24));
|
||||
PositionRelative(super, fxEnt, 0, Q_16_16(-24));
|
||||
}
|
||||
}
|
||||
if ((this->frameSpriteSettings & 4) != 0) {
|
||||
this->frameSpriteSettings &= 0xfb;
|
||||
fxEnt = CreateFx(this, FX_STARS2, 0x20);
|
||||
if ((super->frameSpriteSettings & 4) != 0) {
|
||||
super->frameSpriteSettings &= 0xfb;
|
||||
fxEnt = CreateFx(super, FX_STARS2, 0x20);
|
||||
if (fxEnt != NULL) {
|
||||
PositionRelative(this, fxEnt, Q_16_16(-20), Q_16_16(-10));
|
||||
PositionRelative(super, fxEnt, Q_16_16(-20), Q_16_16(-10));
|
||||
}
|
||||
}
|
||||
if ((this->frameSpriteSettings & 8) != 0) {
|
||||
this->frameSpriteSettings &= 0xf7;
|
||||
this->frameDuration += Random() & 0x1f;
|
||||
if ((super->frameSpriteSettings & 8) != 0) {
|
||||
super->frameSpriteSettings &= 0xf7;
|
||||
super->frameDuration += Random() & 0x1f;
|
||||
}
|
||||
}
|
||||
|
||||
void MountainMinish_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void MountainMinish_MakeInteractable(MountainMinishEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void sub_0806811C(Entity* this) {
|
||||
@@ -211,7 +219,7 @@ void sub_0806811C(Entity* this) {
|
||||
bVar1 = ptr[0];
|
||||
bVar2 = ptr[1];
|
||||
if ((bVar2 & 0x80) != 0) {
|
||||
this->animationState = sub_0806F5B0(iVar4);
|
||||
this->animationState = GetAnimationStateForDirection8(iVar4);
|
||||
}
|
||||
this->frame = bVar1 | 0x40;
|
||||
this->frameIndex = bVar2 & 0x7f;
|
||||
|
||||
+28
-19
@@ -5,6 +5,7 @@
|
||||
*
|
||||
* @brief Mutoh NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "item.h"
|
||||
@@ -12,39 +13,47 @@
|
||||
#include "npc.h"
|
||||
#include "player.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 unused[27];
|
||||
/*0x84*/ ScriptExecutionContext* context;
|
||||
} MutohEntity;
|
||||
|
||||
static const SpriteLoadData gUnk_08110C00[] = {
|
||||
{ 0x51, 0x3e, 0x4 },
|
||||
{ 0x1051, 0x3e, 0x4 },
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
|
||||
void Mutoh(Entity* this) {
|
||||
if (*(u32*)&this->cutsceneBeh == 0) {
|
||||
void Mutoh(MutohEntity* this) {
|
||||
if (this->context == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
|
||||
switch (this->action) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
if (LoadExtraSpriteData(this, gUnk_08110C00)) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = TRUE;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
if (LoadExtraSpriteData(super, gUnk_08110C00)) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = TRUE;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4);
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
if (UpdateFuseInteraction(super)) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,9 +97,9 @@ void sub_080670E4(Entity* this) {
|
||||
ShowNPCDialogue(this, &dialogs[gSave.global_progress]);
|
||||
}
|
||||
|
||||
void Mutoh_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Mutoh_MakeInteractable(MutohEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Mutoh_Fusion(Entity* this) {
|
||||
|
||||
+22
-15
@@ -4,32 +4,39 @@
|
||||
*
|
||||
* @brief Nayru NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "kinstone.h"
|
||||
#include "npc.h"
|
||||
|
||||
void Nayru(Entity* this) {
|
||||
switch (this->action) {
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 animIndex;
|
||||
} NayruEntity;
|
||||
|
||||
void Nayru(NayruEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
sub_0807DD50(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
InitScriptForNPC(super);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
this->field_0x68.HALF.LO = this->animIndex;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
this->animIndex = super->animIndex;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, this->field_0x68.HALF.LO);
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
InitAnimationForceUpdate(super, this->animIndex);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+88
-78
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief NPC 23
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "message.h"
|
||||
@@ -11,118 +12,127 @@
|
||||
#include "player.h"
|
||||
#include "structures.h"
|
||||
|
||||
bool32 sub_0806650C(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[22];
|
||||
/*0x7e*/ u16 unk_7e;
|
||||
/*0x80*/ u16 unk_80;
|
||||
/*0x82*/ u16 unk_82;
|
||||
/*0x84*/ u16 unk_84;
|
||||
/*0x86*/ u16 unk_86;
|
||||
} NPC23Entity;
|
||||
|
||||
void sub_08066490(Entity*, Entity*);
|
||||
bool32 sub_0806650C(NPC23Entity*);
|
||||
|
||||
void sub_08066490(NPC23Entity*, Entity*);
|
||||
|
||||
void sub_08066570(Entity* this);
|
||||
void sub_080662F8(Entity* this);
|
||||
void sub_08066358(Entity* this);
|
||||
void nullsub_110(Entity* this);
|
||||
void sub_080663D4(Entity* this);
|
||||
void sub_0806643C(Entity* this);
|
||||
void sub_08066474(Entity* this);
|
||||
void sub_080662F8(NPC23Entity* this);
|
||||
void sub_08066358(NPC23Entity* this);
|
||||
void nullsub_110(NPC23Entity* this);
|
||||
void sub_080663D4(NPC23Entity* this);
|
||||
void sub_0806643C(NPC23Entity* this);
|
||||
void sub_08066474(NPC23Entity* this);
|
||||
|
||||
void NPC23(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void NPC23(NPC23Entity* this) {
|
||||
static void (*const actionFuncs[])(NPC23Entity*) = {
|
||||
sub_080662F8, sub_08066358, nullsub_110, sub_080663D4, sub_0806643C, sub_08066474,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
actionFuncs[super->action](this);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
|
||||
void sub_080662F8(Entity* this) {
|
||||
this->action = 1;
|
||||
this->subAction = 0;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->animationState = this->type << 1;
|
||||
InitializeAnimation(this, this->type);
|
||||
this->field_0x7c.HALF.HI = this->x.HALF.HI;
|
||||
this->field_0x80.HWORD = this->y.HALF.HI;
|
||||
this->field_0x86.HWORD = 0;
|
||||
this->field_0x82.HWORD = this->timer;
|
||||
this->parent = &gPlayerEntity;
|
||||
this->cutsceneBeh.HWORD = 0;
|
||||
sub_08066490(this, this->parent);
|
||||
AddInteractableWhenBigObject(this);
|
||||
void sub_080662F8(NPC23Entity* this) {
|
||||
super->action = 1;
|
||||
super->subAction = 0;
|
||||
super->spriteSettings.draw = 1;
|
||||
super->animationState = super->type << 1;
|
||||
InitializeAnimation(super, super->type);
|
||||
this->unk_7e = super->x.HALF.HI;
|
||||
this->unk_80 = super->y.HALF.HI;
|
||||
this->unk_86 = 0;
|
||||
this->unk_82 = super->timer;
|
||||
super->parent = &gPlayerEntity;
|
||||
this->unk_84 = 0;
|
||||
sub_08066490(this, super->parent);
|
||||
AddInteractableWhenBigObject(super);
|
||||
}
|
||||
|
||||
void sub_08066358(Entity* this) {
|
||||
if (this->interactType != 0) {
|
||||
this->interactType = 0;
|
||||
void sub_08066358(NPC23Entity* this) {
|
||||
if (super->interactType != 0) {
|
||||
super->interactType = 0;
|
||||
MessageFromTarget(0);
|
||||
if ((this->type2 & 0x10) != 0) {
|
||||
this->action = 3;
|
||||
this->subAction = 0;
|
||||
if ((this->field_0x7c.HALF_U.HI - this->x.HALF.HI) > 8) {
|
||||
this->direction = 8;
|
||||
if ((super->type2 & 0x10) != 0) {
|
||||
super->action = 3;
|
||||
super->subAction = 0;
|
||||
if ((this->unk_7e - super->x.HALF.HI) > 8) {
|
||||
super->direction = 8;
|
||||
} else {
|
||||
this->direction = 0x18;
|
||||
super->direction = 0x18;
|
||||
}
|
||||
this->speed = 0x80;
|
||||
this->cutsceneBeh.HWORD = 1;
|
||||
super->speed = 0x80;
|
||||
this->unk_84 = 1;
|
||||
gPauseMenuOptions.disabled = 1;
|
||||
RemoveInteractableObject(this);
|
||||
RemoveInteractableObject(super);
|
||||
}
|
||||
} else {
|
||||
sub_08066490(this, this->parent);
|
||||
sub_08066490(this, super->parent);
|
||||
}
|
||||
GetNextFrame(this);
|
||||
sub_08066570(this);
|
||||
GetNextFrame(super);
|
||||
sub_08066570(super);
|
||||
}
|
||||
|
||||
void nullsub_110(Entity* this) {
|
||||
void nullsub_110(NPC23Entity* this) {
|
||||
}
|
||||
|
||||
void sub_080663D4(Entity* this) {
|
||||
if (this->x.HALF.HI == this->field_0x7c.HALF_U.HI - 8) {
|
||||
void sub_080663D4(NPC23Entity* this) {
|
||||
if (super->x.HALF.HI == this->unk_7e - 8) {
|
||||
if (gPlayerEntity.action != PLAYER_ROOM_EXIT) {
|
||||
this->action = 4;
|
||||
this->direction = 0;
|
||||
this->speed = 0;
|
||||
this->cutsceneBeh.HWORD = 0;
|
||||
InitializeAnimation(this, 2);
|
||||
super->action = 4;
|
||||
super->direction = 0;
|
||||
super->speed = 0;
|
||||
this->unk_84 = 0;
|
||||
InitializeAnimation(super, 2);
|
||||
}
|
||||
} else {
|
||||
if (this->subAction == 0) {
|
||||
InitializeAnimation(this, (this->direction >> 3) + 4);
|
||||
this->subAction = this->subAction + 1;
|
||||
if (super->subAction == 0) {
|
||||
InitializeAnimation(super, (super->direction >> 3) + 4);
|
||||
super->subAction = super->subAction + 1;
|
||||
}
|
||||
ProcessMovement0(this);
|
||||
ProcessMovement0(super);
|
||||
}
|
||||
sub_08078B48();
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
|
||||
void sub_0806643C(Entity* this) {
|
||||
bool32 tmp = sub_0806650C(this);
|
||||
if (tmp == FALSE) {
|
||||
this->action = 5;
|
||||
void sub_0806643C(NPC23Entity* this) {
|
||||
if (!sub_0806650C(this)) {
|
||||
super->action = 5;
|
||||
gRoomControls.camera_target = NULL;
|
||||
sub_08078AC0(0x40, 0, 0);
|
||||
gPlayerEntity.animationState = 0;
|
||||
gPlayerEntity.direction = 0;
|
||||
}
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
|
||||
void sub_08066474(Entity* this) {
|
||||
void sub_08066474(NPC23Entity* this) {
|
||||
if (gPlayerEntity.action != PLAYER_ROOM_EXIT) {
|
||||
gPauseMenuOptions.disabled = 0;
|
||||
}
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/npc23/sub_08066490.inc", void sub_08066490(Entity* this, Entity* entity)) {
|
||||
NONMATCH("asm/non_matching/npc23/sub_08066490.inc", void sub_08066490(NPC23Entity* this, Entity* entity)) {
|
||||
u32 uVar1;
|
||||
u32 uVar2;
|
||||
u32 uVar3;
|
||||
u32 uVar4;
|
||||
|
||||
if ((this->type2 & 0x10) != 0) {
|
||||
this->field_0x86.HWORD = this->x.HALF.HI;
|
||||
uVar2 = this->field_0x7c.HALF_U.HI;
|
||||
uVar3 = uVar2 + this->field_0x82.HWORD;
|
||||
uVar4 = uVar2 - this->field_0x82.HWORD;
|
||||
if ((super->type2 & 0x10) != 0) {
|
||||
this->unk_86 = super->x.HALF.HI;
|
||||
uVar2 = this->unk_7e;
|
||||
uVar3 = uVar2 + this->unk_82;
|
||||
uVar4 = uVar2 - this->unk_82;
|
||||
if (((entity->x.HALF.HI < (int)uVar3) && (entity->x.HALF.HI > (int)uVar4))) {
|
||||
uVar2 = entity->x.HALF.HI;
|
||||
} else {
|
||||
@@ -133,35 +143,35 @@ NONMATCH("asm/non_matching/npc23/sub_08066490.inc", void sub_08066490(Entity* th
|
||||
}
|
||||
}
|
||||
|
||||
if (this->field_0x86.HWORD == uVar2) {
|
||||
if (this->cutsceneBeh.HWORD == 1) {
|
||||
this->cutsceneBeh.HWORD = 0;
|
||||
InitializeAnimation(this, 2);
|
||||
if (this->unk_86 == uVar2) {
|
||||
if (this->unk_84 == 1) {
|
||||
this->unk_84 = 0;
|
||||
InitializeAnimation(super, 2);
|
||||
}
|
||||
} else {
|
||||
this->x.HALF.HI = (short)uVar2;
|
||||
if (this->cutsceneBeh.HWORD == 0) {
|
||||
this->cutsceneBeh.HWORD = 1;
|
||||
InitializeAnimation(this, 6);
|
||||
super->x.HALF.HI = (short)uVar2;
|
||||
if (this->unk_84 == 0) {
|
||||
this->unk_84 = 1;
|
||||
InitializeAnimation(super, 6);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
bool32 sub_0806650C(Entity* this) {
|
||||
bool32 sub_0806650C(NPC23Entity* this) {
|
||||
u32 dir = 0;
|
||||
s32 px = gPlayerEntity.x.HALF_U.HI;
|
||||
s32 px2 = px;
|
||||
s32 py = gPlayerEntity.y.HALF_U.HI;
|
||||
|
||||
if (py < this->field_0x80.HWORD + 16) {
|
||||
if (py < this->unk_80 + 16) {
|
||||
dir = 4;
|
||||
} else {
|
||||
if (px < this->field_0x7c.HALF_U.HI + 2) {
|
||||
if (px < this->unk_7e + 2) {
|
||||
dir = 2;
|
||||
}
|
||||
if (px2 > this->field_0x7c.HALF_U.HI + 6) {
|
||||
if (px2 > this->unk_7e + 6) {
|
||||
dir = 6;
|
||||
}
|
||||
if (dir == 0) {
|
||||
|
||||
+3
-2
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief NPC 26
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
|
||||
@@ -58,11 +59,11 @@ static void sub_08066A30(Entity* this) {
|
||||
static void sub_08066A38(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
}
|
||||
|
||||
static void sub_08066A50(Entity* this) {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
|
||||
static void (*const gUnk_081106D4[])(Entity*) = { sub_080669B8, sub_080669DC, sub_08066A30 };
|
||||
|
||||
+24
-15
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief NPC 4E
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
@@ -17,6 +18,12 @@
|
||||
#include "screenTransitions.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68;
|
||||
/*0x69*/ u8 unk_69;
|
||||
} NPC4EEntity;
|
||||
|
||||
typedef struct {
|
||||
Rect customHitbox;
|
||||
u8 interactDirections;
|
||||
@@ -43,9 +50,9 @@ void NPC4E(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 4;
|
||||
this->hitbox = (Hitbox*)&gHitbox_2;
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,17 +144,19 @@ void NPC4E_IsEveryPinwheelActivated(Entity* this, ScriptExecutionContext* contex
|
||||
}
|
||||
|
||||
void sub_0806DB84(Entity* this, ScriptExecutionContext* context) {
|
||||
Entity* ent;
|
||||
GenericEntity* ent;
|
||||
this->hitbox = (Hitbox*)&gUnk_08114154;
|
||||
ent = CreateObject(MINISH_VILLAGE_OBJECT, 4, 0);
|
||||
ent = (GenericEntity*)CreateObject(MINISH_VILLAGE_OBJECT, 4, 0);
|
||||
if (ent != NULL) {
|
||||
PositionRelative(this, ent, Q_16_16(-8.0), 0);
|
||||
*(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_MinishVillageObjectLeftStoneOpening);
|
||||
PositionRelative(this, &ent->base, Q_16_16(-8.0), 0);
|
||||
*(ScriptExecutionContext**)&ent->cutsceneBeh =
|
||||
StartCutscene(&ent->base, &script_MinishVillageObjectLeftStoneOpening);
|
||||
}
|
||||
ent = CreateObject(MINISH_VILLAGE_OBJECT, 5, 0);
|
||||
ent = (GenericEntity*)CreateObject(MINISH_VILLAGE_OBJECT, 5, 0);
|
||||
if (ent != NULL) {
|
||||
PositionRelative(this, ent, Q_16_16(8.0), 0);
|
||||
*(ScriptExecutionContext**)&ent->cutsceneBeh = StartCutscene(ent, &script_MinishVillageObjectRightStoneOpening);
|
||||
PositionRelative(this, &ent->base, Q_16_16(8.0), 0);
|
||||
*(ScriptExecutionContext**)&ent->cutsceneBeh =
|
||||
StartCutscene(&ent->base, &script_MinishVillageObjectRightStoneOpening);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,14 +185,14 @@ Item NPC4E_GetItemWithSwordUpgraded(Item itemId) {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
void NPC4E_SaveEquippedItems(Entity* this) {
|
||||
this->field_0x68.HALF.LO = gSave.stats.itemButtons[SLOT_A];
|
||||
this->field_0x68.HALF.HI = gSave.stats.itemButtons[SLOT_B];
|
||||
void NPC4E_SaveEquippedItems(NPC4EEntity* this) {
|
||||
this->unk_68 = gSave.stats.itemButtons[SLOT_A];
|
||||
this->unk_69 = gSave.stats.itemButtons[SLOT_B];
|
||||
}
|
||||
|
||||
void NPC4E_RestoreEquippedItems(Entity* this) {
|
||||
ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->field_0x68.HALF.LO), EQUIP_SLOT_A);
|
||||
ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->field_0x68.HALF.HI), EQUIP_SLOT_B);
|
||||
void NPC4E_RestoreEquippedItems(NPC4EEntity* this) {
|
||||
ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->unk_68), EQUIP_SLOT_A);
|
||||
ForceEquipItem(NPC4E_GetItemWithSwordUpgraded(this->unk_69), EQUIP_SLOT_B);
|
||||
}
|
||||
|
||||
void sub_0806DC7C(void) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief NPC 4F
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "npc.h"
|
||||
|
||||
void NPC4F(Entity* this) {
|
||||
|
||||
+328
-314
File diff suppressed because it is too large
Load Diff
+34
-26
@@ -4,44 +4,52 @@
|
||||
*
|
||||
* @brief NPC 58
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ s16 unk_68;
|
||||
/*0x6a*/ s16 unk_6a;
|
||||
/*0x6c*/ s16 unk_6c;
|
||||
} NPC58Entity;
|
||||
|
||||
extern void sub_0806FFBC(Entity*, u32, u32, u32);
|
||||
|
||||
static const SpriteLoadData gUnk_081146D0[] = {
|
||||
{ 0, 0x61, 0x4 }, { 0x800, 0x61, 0x4 }, { 0x1000, 0x61, 0x4 }, { 0x1800, 0x61, 0x4 }, { 0, 0, 0 },
|
||||
};
|
||||
|
||||
void NPC58(Entity* this) {
|
||||
void NPC58(NPC58Entity* this) {
|
||||
s32 sVar1;
|
||||
s32 uVar2;
|
||||
s32 uVar4;
|
||||
Entity* entity;
|
||||
GenericEntity* entity;
|
||||
|
||||
if (this->action == 0) {
|
||||
if (!LoadExtraSpriteData(this, gUnk_081146D0)) {
|
||||
if (super->action == 0) {
|
||||
if (!LoadExtraSpriteData(super, gUnk_081146D0)) {
|
||||
return;
|
||||
}
|
||||
this->action++;
|
||||
this->spriteSettings.draw = 2;
|
||||
this->spriteRendering.b3 = 0;
|
||||
this->spritePriority.b0 = 0;
|
||||
this->spriteOrientation.flipY = 1;
|
||||
this->x.HALF.HI = 0x78;
|
||||
this->y.HALF.HI = 0x10;
|
||||
super->action++;
|
||||
super->spriteSettings.draw = 2;
|
||||
super->spriteRendering.b3 = 0;
|
||||
super->spritePriority.b0 = 0;
|
||||
super->spriteOrientation.flipY = 1;
|
||||
super->x.HALF.HI = 0x78;
|
||||
super->y.HALF.HI = 0x10;
|
||||
}
|
||||
entity = this->parent;
|
||||
entity = (GenericEntity*)super->parent;
|
||||
if (entity != NULL) {
|
||||
sVar1 = *(s16*)&entity->field_0x68.HWORD;
|
||||
uVar2 = (s32)sVar1 / 600;
|
||||
this->field_0x68.HWORD = uVar2;
|
||||
this->unk_68 = uVar2;
|
||||
uVar4 = (s32)sVar1 % 600;
|
||||
this->field_0x6a.HWORD = uVar4 / 0x3c;
|
||||
this->unk_6a = uVar4 / 0x3c;
|
||||
uVar4 = uVar4 % 0x3c;
|
||||
uVar2 = uVar4 / 6;
|
||||
this->field_0x6c.HWORD = uVar2;
|
||||
if (entity->next == NULL) {
|
||||
this->unk_6c = uVar2;
|
||||
if (entity->base.next == NULL) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
} else {
|
||||
@@ -49,14 +57,14 @@ void NPC58(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void NPC58_Head(Entity* this) {
|
||||
this->frameIndex = 0xff;
|
||||
SetExtraSpriteFrame(this, 0, (s16)this->field_0x68.HWORD);
|
||||
SetExtraSpriteFrame(this, 1, (s16)this->field_0x6a.HWORD);
|
||||
SetExtraSpriteFrame(this, 2, (s16)this->field_0x6c.HWORD);
|
||||
SetExtraSpriteFrame(this, 3, 10);
|
||||
sub_0806FFBC(this, 0, -12, 0);
|
||||
sub_0806FFBC(this, 1, -4, 0);
|
||||
sub_0806FFBC(this, 2, 0xc, 0);
|
||||
sub_0807000C(this);
|
||||
void NPC58_Head(NPC58Entity* this) {
|
||||
super->frameIndex = 0xff;
|
||||
SetExtraSpriteFrame(super, 0, this->unk_68);
|
||||
SetExtraSpriteFrame(super, 1, this->unk_6a);
|
||||
SetExtraSpriteFrame(super, 2, this->unk_6c);
|
||||
SetExtraSpriteFrame(super, 3, 10);
|
||||
sub_0806FFBC(super, 0, -12, 0);
|
||||
sub_0806FFBC(super, 1, -4, 0);
|
||||
sub_0806FFBC(super, 2, 0xc, 0);
|
||||
sub_0807000C(super);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief NPC 9
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "message.h"
|
||||
#include "npc.h"
|
||||
|
||||
+35
-26
@@ -4,19 +4,27 @@
|
||||
*
|
||||
* @brief Percy NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "kinstone.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 unused[27];
|
||||
/*0x84*/ ScriptExecutionContext* context;
|
||||
} PercyEntity;
|
||||
|
||||
static const SpriteLoadData gUnk_08112E1C[] = {
|
||||
{ 0x30f6, 0x47, 0x4 },
|
||||
{ 0xf6, 0x47, 0x4 },
|
||||
{ 0x1cf6, 0x47, 0x4 },
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
void sub_0806B41C(Entity*);
|
||||
void sub_0806B41C(PercyEntity*);
|
||||
void sub_0806B3CC(Entity*);
|
||||
void sub_0806B504(Entity*);
|
||||
void sub_0806B540(Entity*);
|
||||
@@ -32,11 +40,11 @@ void Percy_Head(Entity* this) {
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
void Percy(Entity* this) {
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
void Percy(PercyEntity* this) {
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
sub_0806B41C(this);
|
||||
} else {
|
||||
sub_0806B3CC(this);
|
||||
sub_0806B3CC(super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,39 +65,40 @@ void sub_0806B3CC(Entity* this) {
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
void sub_0806B41C(Entity* this) {
|
||||
void sub_0806B41C(PercyEntity* this) {
|
||||
u16* tmp;
|
||||
u32 idx;
|
||||
|
||||
switch (this->action) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
if (LoadExtraSpriteData(this, gUnk_08112E1C)) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
if (this->type2 == 2) {
|
||||
CreateFx(this, FX_SWEAT, 0);
|
||||
if (LoadExtraSpriteData(super, gUnk_08112E1C)) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
if (super->type2 == 2) {
|
||||
CreateFx(super, FX_SWEAT, 0);
|
||||
}
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
|
||||
idx = GetFuserId(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitializeAnimation(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4);
|
||||
idx = GetFuserId(super);
|
||||
tmp = gUnk_08001A7C[idx];
|
||||
if (this->field_0x68.HALF.LO == 33)
|
||||
if (this->fusionOffer == 33)
|
||||
tmp += 3;
|
||||
sub_0801DFB4(this, tmp[0], tmp[1], tmp[2]);
|
||||
InitializeFuseInfo(super, tmp[0], tmp[1], tmp[2]);
|
||||
gPlayerState.controlMode = CONTROL_DISABLED;
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
if (UpdateFuseInteraction(super)) {
|
||||
super->action = 1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -129,7 +138,7 @@ void sub_0806B504(Entity* this) {
|
||||
void sub_0806B540(Entity* this) {
|
||||
ScriptExecutionContext* context;
|
||||
|
||||
context = *(ScriptExecutionContext**)&this->cutsceneBeh;
|
||||
context = ((PercyEntity*)this)->context;
|
||||
switch (context->unk_18) {
|
||||
case 0:
|
||||
MessageNoOverlap(TEXT_INDEX(TEXT_PERCY, 0x12), this);
|
||||
@@ -167,9 +176,9 @@ void sub_0806B540(Entity* this) {
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
}
|
||||
|
||||
void Percy_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Percy_MakeInteractable(PercyEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Percy_Fusion(Entity* this) {
|
||||
|
||||
+56
-48
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Phonograph NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "common.h"
|
||||
#include "entity.h"
|
||||
#include "fileselect.h"
|
||||
@@ -13,23 +14,30 @@
|
||||
#include "screen.h"
|
||||
#include "script.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ s16 unk_68;
|
||||
/*0x6a*/ s16 unk_6a;
|
||||
/*0x6c*/ s16 unk_6c;
|
||||
} PhonographEntity;
|
||||
|
||||
#ifdef EU
|
||||
void sub_0806EABC(Entity* this);
|
||||
void sub_0806EABC(PhonographEntity* this);
|
||||
#else
|
||||
void sub_0806EABC(Entity* this, u32 param);
|
||||
#endif
|
||||
|
||||
void Phonograph(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x68.HWORD = 1;
|
||||
this->field_0x6a.HWORD = -1;
|
||||
sub_0807DD64(this);
|
||||
this->frameIndex = 0;
|
||||
void Phonograph(PhonographEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
super->spriteSettings.draw = 1;
|
||||
this->unk_68 = 1;
|
||||
this->unk_6a = -1;
|
||||
sub_0807DD64(super);
|
||||
super->frameIndex = 0;
|
||||
}
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
}
|
||||
|
||||
static const s16 gUnk_081145E4[] = {
|
||||
@@ -42,7 +50,7 @@ static const s16 gUnk_081145E4[] = {
|
||||
};
|
||||
|
||||
#ifdef EU
|
||||
void sub_0806E964(Entity* this, ScriptExecutionContext* context) {
|
||||
void sub_0806E964(PhonographEntity* this, ScriptExecutionContext* context) {
|
||||
if (gInput.newKeys & B_BUTTON) {
|
||||
sub_08050384();
|
||||
return;
|
||||
@@ -50,13 +58,13 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) {
|
||||
|
||||
if (context->unk_18 == 0) {
|
||||
context->unk_18++;
|
||||
this->field_0x6c.HWORD = 0;
|
||||
this->unk_6c = 0;
|
||||
sub_0806EABC(this);
|
||||
}
|
||||
|
||||
if (gInput.unk4 & 0xc0) {
|
||||
s32 val2, val3;
|
||||
s32 val = (s16)this->field_0x68.HWORD;
|
||||
s32 val = this->unk_68;
|
||||
if (gInput.unk4 & 0x40) {
|
||||
val++;
|
||||
} else {
|
||||
@@ -76,39 +84,39 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) {
|
||||
val = val2;
|
||||
}
|
||||
|
||||
this->field_0x68.HWORD = val;
|
||||
this->unk_68 = val;
|
||||
sub_0806EABC(this);
|
||||
if ((s16)this->field_0x6c.HWORD > 0) {
|
||||
this->field_0x6c.HWORD--;
|
||||
if (this->unk_6c > 0) {
|
||||
this->unk_6c--;
|
||||
}
|
||||
}
|
||||
|
||||
if (gInput.newKeys & A_BUTTON) {
|
||||
if ((s16)this->field_0x68.HWORD != (s16)this->field_0x6a.HWORD || (s16)this->field_0x6c.HWORD == 0) {
|
||||
if (this->unk_68 != this->unk_6a || this->unk_6c == 0) {
|
||||
const s16* ptr2 = gUnk_081145E4;
|
||||
s32 field_0x68;
|
||||
SoundReq(*(ptr2 + (s16)this->field_0x68.HWORD * 2));
|
||||
this->field_0x6a.HWORD = this->field_0x68.HWORD;
|
||||
field_0x68 = (s16)this->field_0x68.HWORD * 4;
|
||||
SoundReq(*(ptr2 + this->unk_68 * 2));
|
||||
this->unk_6a = this->unk_68;
|
||||
field_0x68 = this->unk_68 * 4;
|
||||
ptr2++;
|
||||
this->field_0x6c.HWORD = *(s16*)((((s32)ptr2 + field_0x68)));
|
||||
this->unk_6c = *(s16*)((((s32)ptr2 + field_0x68)));
|
||||
} else {
|
||||
SoundReq(SONG_STOP_ALL);
|
||||
this->field_0x6a.HWORD = 0;
|
||||
this->unk_6a = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((s16)this->field_0x6c.HWORD > 0) {
|
||||
if ((s16)-- this->field_0x6c.HWORD <= 0) {
|
||||
this->field_0x6a.HWORD = 0;
|
||||
this->field_0x6c.HWORD = 0;
|
||||
if (this->unk_6c > 0) {
|
||||
if (--this->unk_6c <= 0) {
|
||||
this->unk_6a = 0;
|
||||
this->unk_6c = 0;
|
||||
}
|
||||
}
|
||||
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
}
|
||||
#else
|
||||
void sub_0806E964(Entity* this, ScriptExecutionContext* context) {
|
||||
void sub_0806E964(PhonographEntity* this, ScriptExecutionContext* context) {
|
||||
s32 val, val2, val3;
|
||||
if (gInput.newKeys & B_BUTTON) {
|
||||
sub_08050384();
|
||||
@@ -117,15 +125,15 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) {
|
||||
|
||||
if (context->unk_18 == 0) {
|
||||
context->unk_18++;
|
||||
this->field_0x6c.HWORD = 0;
|
||||
sub_0806EABC(this, (s16)this->field_0x68.HWORD);
|
||||
this->unk_6c = 0;
|
||||
sub_0806EABC(super, this->unk_68);
|
||||
}
|
||||
|
||||
val2 = 0x1c;
|
||||
if (CheckGlobalFlag(GAMECLEAR)) {
|
||||
val2 = 0x34;
|
||||
}
|
||||
val = (s16)this->field_0x68.HWORD;
|
||||
val = this->unk_68;
|
||||
if (gInput.newKeys & 0xc0) {
|
||||
if (gInput.newKeys & 0x40) {
|
||||
val++;
|
||||
@@ -156,34 +164,34 @@ void sub_0806E964(Entity* this, ScriptExecutionContext* context) {
|
||||
}
|
||||
}
|
||||
|
||||
if (val != (s16)this->field_0x68.HWORD) {
|
||||
sub_0806EABC(this, val);
|
||||
if ((s16)this->field_0x6c.HWORD > 0) {
|
||||
this->field_0x6c.HWORD--;
|
||||
if (val != this->unk_68) {
|
||||
sub_0806EABC(super, val);
|
||||
if (this->unk_6c > 0) {
|
||||
this->unk_6c--;
|
||||
}
|
||||
}
|
||||
|
||||
this->field_0x68.HWORD = val;
|
||||
this->unk_68 = val;
|
||||
|
||||
if (gInput.newKeys & A_BUTTON) {
|
||||
if ((s16)this->field_0x68.HWORD != (s16)this->field_0x6a.HWORD || (s16)this->field_0x6c.HWORD == 0) {
|
||||
if (this->unk_68 != this->unk_6a || this->unk_6c == 0) {
|
||||
const s16* ptr2 = gUnk_081145E4;
|
||||
s32 field_0x68;
|
||||
SoundReq(*(ptr2 + (s16)this->field_0x68.HWORD * 2));
|
||||
this->field_0x6a.HWORD = this->field_0x68.HWORD;
|
||||
field_0x68 = (s16)this->field_0x68.HWORD * 4;
|
||||
SoundReq(*(ptr2 + this->unk_68 * 2));
|
||||
this->unk_6a = this->unk_68;
|
||||
field_0x68 = this->unk_68 * 4;
|
||||
ptr2++;
|
||||
this->field_0x6c.HWORD = *(s16*)((((s32)ptr2 + field_0x68)));
|
||||
this->unk_6c = *(s16*)((((s32)ptr2 + field_0x68)));
|
||||
} else {
|
||||
SoundReq(SONG_STOP_ALL);
|
||||
this->field_0x6a.HWORD = 0;
|
||||
this->unk_6a = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((s16)this->field_0x6c.HWORD > 0) {
|
||||
if ((s16)-- this->field_0x6c.HWORD <= 0) {
|
||||
this->field_0x6a.HWORD = 0;
|
||||
this->field_0x6c.HWORD = 0;
|
||||
if (this->unk_6c > 0) {
|
||||
if (--this->unk_6c <= 0) {
|
||||
this->unk_6a = 0;
|
||||
this->unk_6c = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,9 +204,9 @@ const static Font gUnk_081146B8 = {
|
||||
};
|
||||
|
||||
#ifdef EU
|
||||
void sub_0806EABC(Entity* this) {
|
||||
void sub_0806EABC(PhonographEntity* this) {
|
||||
sub_08050384();
|
||||
sub_08057044((s16)this->field_0x68.HWORD, gUnk_020227E8, 0x202020);
|
||||
sub_08057044(this->unk_68, gUnk_020227E8, 0x202020);
|
||||
ShowTextBox(0x3302, &gUnk_081146B8);
|
||||
gScreen.bg0.updated = 1;
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
#include "structures.h"
|
||||
|
||||
typedef struct {
|
||||
Entity base;
|
||||
Entity* ent1;
|
||||
Entity* ent2;
|
||||
Entity* ent3;
|
||||
u16 unk74;
|
||||
u16 unk76;
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ Entity* ent1;
|
||||
/*0x6c*/ Entity* ent2;
|
||||
/*0x70*/ Entity* ent3;
|
||||
/*0x74*/ u16 unk74;
|
||||
/*0x76*/ u16 unk76;
|
||||
} PicolyteBottleEntity;
|
||||
|
||||
void sub_0806E014(PicolyteBottleEntity* this);
|
||||
@@ -66,7 +66,7 @@ void PicolyteBottle_Init(PicolyteBottleEntity* this) {
|
||||
this->unk76 = 10;
|
||||
gRoomTransition.field_0x6 = 10;
|
||||
sub_0806E014(this);
|
||||
sub_0807DD50(super);
|
||||
InitScriptForNPC(super);
|
||||
} else {
|
||||
super->hitbox = (Hitbox*)&gHitbox_0;
|
||||
super->collisionLayer = 1;
|
||||
@@ -75,7 +75,7 @@ void PicolyteBottle_Init(PicolyteBottleEntity* this) {
|
||||
}
|
||||
|
||||
void PicolyteBottle_Action1(PicolyteBottleEntity* this) {
|
||||
sub_0807DD94(super, 0);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
if (super->timer != 0xff) {
|
||||
if (super->damage != 0) {
|
||||
this->ent3->timer++;
|
||||
|
||||
+33
-25
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Pina NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "message.h"
|
||||
@@ -11,17 +12,23 @@
|
||||
#include "object.h"
|
||||
#include "save.h"
|
||||
|
||||
void sub_08063B68(Entity* this);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 animIndex;
|
||||
} PinaEntity;
|
||||
|
||||
void sub_08063B68(PinaEntity* this);
|
||||
void sub_08063A80(Entity* this);
|
||||
void sub_08063A98(Entity* this);
|
||||
void sub_08063AC0(Entity* this);
|
||||
void sub_08063B44(Entity* this);
|
||||
|
||||
void Pina(Entity* this) {
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
void Pina(PinaEntity* this) {
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
sub_08063B68(this);
|
||||
} else {
|
||||
sub_08063A80(this);
|
||||
sub_08063A80(super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,32 +82,33 @@ void sub_08063B44(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063B68(Entity* this) {
|
||||
switch (this->action) {
|
||||
void sub_08063B68(PinaEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
sub_0807DD64(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
this->animIndex = 0;
|
||||
sub_0807DD64(super);
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4);
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
this->animIndex = super->animIndex;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 4);
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this) == 0) {
|
||||
if (UpdateFuseInteraction(super) == 0) {
|
||||
return;
|
||||
}
|
||||
this->action = 1;
|
||||
InitAnimationForceUpdate(this, this->field_0x68.HALF.HI);
|
||||
super->action = 1;
|
||||
InitAnimationForceUpdate(super, this->animIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -156,9 +164,9 @@ void sub_08063C90(Entity* this) {
|
||||
ShowNPCDialogue(this, &gUnk_0810CE04[gSave.global_progress]);
|
||||
}
|
||||
|
||||
void Pina_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Pina_MakeInteractable(PinaEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Pina_Fusion(Entity* this) {
|
||||
|
||||
+18
-11
@@ -4,10 +4,17 @@
|
||||
*
|
||||
* @brief Pita NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
|
||||
void Pita(Entity* this) {
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[24];
|
||||
/*0x80*/ u16 unk_80;
|
||||
} PitaEntity;
|
||||
|
||||
void Pita(PitaEntity* this) {
|
||||
static const Hitbox gUnk_0810C428 = {
|
||||
0,
|
||||
2,
|
||||
@@ -19,17 +26,17 @@ void Pita(Entity* this) {
|
||||
#endif
|
||||
18,
|
||||
};
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
SortEntityAbove(this, this);
|
||||
this->hitbox = (Hitbox*)&gUnk_0810C428;
|
||||
sub_0807DD64(this);
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
SortEntityAbove(super, super);
|
||||
super->hitbox = (Hitbox*)&gUnk_0810C428;
|
||||
sub_0807DD64(super);
|
||||
}
|
||||
sub_0807DD94(this, NULL);
|
||||
if ((this->frame & 1) != 0) {
|
||||
InitAnimationForceUpdate(this, (u32)(this->animationState >> 1));
|
||||
this->field_0x80.HWORD = this->animIndex;
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
if ((super->frame & 1) != 0) {
|
||||
InitAnimationForceUpdate(super, (u32)(super->animationState >> 1));
|
||||
this->unk_80 = super->animIndex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+95
-83
@@ -4,16 +4,26 @@
|
||||
*
|
||||
* @brief Postman NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
#include "sound.h"
|
||||
#include "structures.h"
|
||||
|
||||
extern void sub_08060528(Entity*);
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ s8 unk_68;
|
||||
/*0x69*/ s8 unk_69;
|
||||
/*0x6a*/ s16 unk_6a;
|
||||
/*0x6c*/ u8 fusionOffer;
|
||||
/*0x6d*/ u8 unk_6d;
|
||||
} PostmanEntity;
|
||||
|
||||
extern void sub_08060528(PostmanEntity*);
|
||||
extern void sub_080604DC(Entity*);
|
||||
extern void sub_080606D8(Entity*);
|
||||
extern void Postman_MakeInteractable(Entity*);
|
||||
extern void Postman_MakeInteractable(PostmanEntity*);
|
||||
|
||||
const Coords gUnk_0810A66C[] = {
|
||||
{ .HALF = { 0x0, 0x0 } }, { .HALF = { 0x48, 0xa8 } }, { .HALF = { 0x0, 0xf0 } },
|
||||
@@ -154,11 +164,11 @@ const Rect gUnk_0810AA70[][4] = {
|
||||
},
|
||||
};
|
||||
|
||||
void Postman(Entity* this) {
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
void Postman(PostmanEntity* this) {
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
sub_08060528(this);
|
||||
} else {
|
||||
gUnk_0810AA24[this->action](this);
|
||||
gUnk_0810AA24[super->action](super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,76 +240,78 @@ void sub_080604DC(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08060528(Entity* this) {
|
||||
switch (this->action) {
|
||||
void sub_08060528(PostmanEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = TRUE;
|
||||
this->field_0x68.HALF.LO = 0;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
this->field_0x6a.HWORD = 0;
|
||||
this->field_0x6c.HALF.HI = 0;
|
||||
this->field_0x6c.HALF.LO = GetFusionToOffer(this);
|
||||
sub_0807DD50(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = TRUE;
|
||||
this->unk_68 = 0;
|
||||
this->unk_69 = 0;
|
||||
this->unk_6a = 0;
|
||||
this->unk_6d = 0;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
InitScriptForNPC(super);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 3;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
if (super->interactType == 2) {
|
||||
super->action = 3;
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
} else {
|
||||
if (this->interactType != 0) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_080606D8(this);
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
if (super->interactType != 0) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
sub_080606D8(super);
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if ((gMessage.doTextBox & 0x7f) != 0) {
|
||||
break;
|
||||
}
|
||||
this->action = 1;
|
||||
super->action = 1;
|
||||
break;
|
||||
case 3:
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (!UpdateFuseInteraction(this)) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if (!UpdateFuseInteraction(super)) {
|
||||
break;
|
||||
}
|
||||
this->action = 1;
|
||||
super->action = 1;
|
||||
}
|
||||
sub_080604DC(this);
|
||||
if (0 < (s16)this->field_0x6a.HWORD) {
|
||||
if ((s16)this->field_0x6a.HWORD > 0x12b) {
|
||||
this->field_0x6a.HWORD = 0;
|
||||
this->zVelocity = Q_16_16(2.0);
|
||||
this->field_0x6c.HALF.HI = 1;
|
||||
RemoveInteractableObject(this);
|
||||
sub_080604DC(super);
|
||||
if (0 < (s16)this->unk_6a) {
|
||||
if ((s16)this->unk_6a > 0x12b) {
|
||||
this->unk_6a = 0;
|
||||
super->zVelocity = Q_16_16(2.0);
|
||||
this->unk_6d = 1;
|
||||
RemoveInteractableObject(super);
|
||||
EnqueueSFX(SFX_PLY_JUMP);
|
||||
} else {
|
||||
this->field_0x6a.HWORD--;
|
||||
this->unk_6a--;
|
||||
}
|
||||
}
|
||||
GravityUpdate(this, Q_8_8(24.0));
|
||||
if (((this->field_0x6c.HALF.HI != 0) && (this->zVelocity == 0)) && this->z.WORD == 0) {
|
||||
this->field_0x6c.HALF.HI = 0;
|
||||
GravityUpdate(super, Q_8_8(24.0));
|
||||
if (((this->unk_6d != 0) && (super->zVelocity == 0)) && super->z.WORD == 0) {
|
||||
this->unk_6d = 0;
|
||||
Postman_MakeInteractable(this);
|
||||
}
|
||||
if (this->z.WORD >= 0 &&
|
||||
((gPlayerEntity.collisionLayer == 0 || (this->collisionLayer == gPlayerEntity.collisionLayer)))) {
|
||||
sub_0806ED78(this);
|
||||
if (super->z.WORD >= 0 &&
|
||||
((gPlayerEntity.collisionLayer == 0 || (super->collisionLayer == gPlayerEntity.collisionLayer)))) {
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
sub_0800451C(this);
|
||||
sub_0800451C(super);
|
||||
}
|
||||
|
||||
void Postman_MakeInteractable(Entity* this) {
|
||||
this->field_0x6c.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x6c.HALF.LO);
|
||||
void Postman_MakeInteractable(PostmanEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void sub_080606D8(Entity* this) {
|
||||
@@ -312,21 +324,21 @@ void sub_080606D8(Entity* this) {
|
||||
ShowNPCDialogue(this, &gUnk_0810AA30[index]);
|
||||
}
|
||||
|
||||
void sub_08060700(Entity* entity, ScriptExecutionContext* context) {
|
||||
const s8* var0 = gUnk_0810A918[(s8)entity->field_0x68.HALF.LO];
|
||||
const Coords* coords = &gUnk_0810A66C[var0[(s8)entity->field_0x68.HALF.HI]];
|
||||
void sub_08060700(PostmanEntity* this, ScriptExecutionContext* context) {
|
||||
const s8* var0 = gUnk_0810A918[(s8)this->unk_68];
|
||||
const Coords* coords = &gUnk_0810A66C[var0[(s8)this->unk_69]];
|
||||
u32 x = coords->HALF.x + gRoomControls.origin_x;
|
||||
u32 y = coords->HALF.y + gRoomControls.origin_y;
|
||||
sub_0807DEDC(entity, context, x, y);
|
||||
sub_0807DEDC(super, context, x, y);
|
||||
gActiveScriptInfo.flags |= 1;
|
||||
}
|
||||
|
||||
void sub_0806075C(Entity* this) {
|
||||
this->field_0x68.HALF.LO = 0xb;
|
||||
this->field_0x68.HALF.HI = 0xff;
|
||||
void sub_0806075C(PostmanEntity* this) {
|
||||
this->unk_68 = 0xb;
|
||||
this->unk_69 = 0xff;
|
||||
}
|
||||
|
||||
void sub_0806076C(Entity* this, ScriptExecutionContext* context) {
|
||||
void sub_0806076C(PostmanEntity* this, ScriptExecutionContext* context) {
|
||||
s32 cVar2;
|
||||
int iVar4;
|
||||
u32 uVar6;
|
||||
@@ -335,15 +347,15 @@ void sub_0806076C(Entity* this, ScriptExecutionContext* context) {
|
||||
const Coords* ptr;
|
||||
const s8* pbVar10;
|
||||
|
||||
if (this->z.WORD < 0) {
|
||||
if (super->z.WORD < 0) {
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
return;
|
||||
}
|
||||
this->field_0x68.HALF.HI++;
|
||||
this->collisionLayer = 1;
|
||||
this->unk_69++;
|
||||
super->collisionLayer = 1;
|
||||
Postman_MakeInteractable(this);
|
||||
pbVar10 = gUnk_0810A918[(s8)this->field_0x68.HALF.LO];
|
||||
pbVar10 += (s8)this->field_0x68.HALF.HI;
|
||||
pbVar10 = gUnk_0810A918[this->unk_68];
|
||||
pbVar10 += this->unk_69;
|
||||
do {
|
||||
switch ((s8)(pbVar10[0] + 5)) {
|
||||
case 5:
|
||||
@@ -351,21 +363,21 @@ void sub_0806076C(Entity* this, ScriptExecutionContext* context) {
|
||||
uVar9 = pbVar10[0];
|
||||
pbVar10++;
|
||||
iVar4 = (s32)Random() % uVar9;
|
||||
this->field_0x68.HALF.LO = pbVar10[iVar4];
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
this->unk_68 = pbVar10[iVar4];
|
||||
this->unk_69 = 0;
|
||||
return;
|
||||
case 4:
|
||||
this->field_0x6a.HWORD = 300;
|
||||
this->unk_6a = 300;
|
||||
break;
|
||||
case 3:
|
||||
this->collisionLayer = 1;
|
||||
super->collisionLayer = 1;
|
||||
break;
|
||||
case 2:
|
||||
this->collisionLayer = 2;
|
||||
super->collisionLayer = 2;
|
||||
break;
|
||||
case 1:
|
||||
context->wait = 0x1e;
|
||||
this->spriteSettings.draw = 0;
|
||||
super->spriteSettings.draw = 0;
|
||||
break;
|
||||
case 0:
|
||||
pbVar10++;
|
||||
@@ -373,40 +385,40 @@ void sub_0806076C(Entity* this, ScriptExecutionContext* context) {
|
||||
local_24 = ((s32)Random()) % uVar9;
|
||||
|
||||
for (uVar6 = 0; uVar6 < uVar9; uVar6++) {
|
||||
this->field_0x68.HALF.LO = pbVar10[local_24];
|
||||
cVar2 = gUnk_0810A918[(s8)this->field_0x68.HALF.LO][0];
|
||||
this->unk_68 = pbVar10[local_24];
|
||||
cVar2 = gUnk_0810A918[this->unk_68][0];
|
||||
ptr = &gUnk_0810A66C[cVar2];
|
||||
this->x.HALF_U.HI = gRoomControls.origin_x + ptr->HALF.x;
|
||||
this->y.HALF_U.HI = gRoomControls.origin_y + ptr->HALF.y;
|
||||
if (CheckOnScreen(this) == 0)
|
||||
super->x.HALF_U.HI = gRoomControls.origin_x + ptr->HALF.x;
|
||||
super->y.HALF_U.HI = gRoomControls.origin_y + ptr->HALF.y;
|
||||
if (CheckOnScreen(super) == 0)
|
||||
break;
|
||||
local_24 = (s32)(local_24 + 1) % uVar9;
|
||||
}
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
this->unk_69 = 0;
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
this->field_0x68.HALF.HI++;
|
||||
this->unk_69++;
|
||||
pbVar10++;
|
||||
} while (TRUE);
|
||||
}
|
||||
|
||||
void sub_080608E4(Entity* this, ScriptExecutionContext* context) {
|
||||
void sub_080608E4(PostmanEntity* this, ScriptExecutionContext* context) {
|
||||
context->condition = 0;
|
||||
if (this->z.WORD >= 0) {
|
||||
if ((this->collisionLayer != 1 || gPlayerEntity.collisionLayer != 2) &&
|
||||
(this->collisionLayer != 2 || gPlayerEntity.collisionLayer != 1)) {
|
||||
const Rect* ptr = &gUnk_0810AA70[context->intVariable][this->animationState >> 1];
|
||||
u32 x = this->x.HALF.HI + ptr->x;
|
||||
u32 y = this->y.HALF.HI + ptr->y;
|
||||
if (super->z.WORD >= 0) {
|
||||
if ((super->collisionLayer != 1 || gPlayerEntity.collisionLayer != 2) &&
|
||||
(super->collisionLayer != 2 || gPlayerEntity.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 += ptr->width;
|
||||
y += ptr->height;
|
||||
if (ptr->width * 2 > x && ptr->height * 2 > y) {
|
||||
context->condition = 1;
|
||||
this->field_0x6a.HWORD += 2;
|
||||
this->unk_6a += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+178
-166
@@ -4,269 +4,281 @@
|
||||
*
|
||||
* @brief Rem NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68;
|
||||
/*0x69*/ u8 unk_69;
|
||||
/*0x6a*/ u16 unk_6a;
|
||||
/*0x6c*/ u8 unused1[20];
|
||||
/*0x80*/ u16 unk_80;
|
||||
/*0x82*/ u8 unused2[2];
|
||||
/*0x84*/ ScriptExecutionContext* context;
|
||||
} RemEntity;
|
||||
|
||||
extern void sub_0806A8C8(Entity*);
|
||||
|
||||
extern void script_Rem;
|
||||
|
||||
extern void DeleteThoughtBubble(Entity* this, ScriptExecutionContext* context);
|
||||
|
||||
void sub_0806A9B0(Entity*, ScriptExecutionContext*);
|
||||
void sub_0806A9B0(RemEntity*, ScriptExecutionContext*);
|
||||
void sub_0806A914(Entity* this);
|
||||
|
||||
void sub_0806a370(Entity* this);
|
||||
void sub_0806A5E8(Entity* this);
|
||||
void sub_0806A630(Entity* this);
|
||||
void sub_0806A674(Entity* this);
|
||||
void sub_0806A830(Entity* this);
|
||||
void sub_0806A890(Entity* this);
|
||||
void sub_0806a370(RemEntity* this);
|
||||
void sub_0806A5E8(RemEntity* this);
|
||||
void sub_0806A630(RemEntity* this);
|
||||
void sub_0806A674(RemEntity* this);
|
||||
void sub_0806A830(RemEntity* this);
|
||||
void sub_0806A890(RemEntity* this);
|
||||
|
||||
void sub_0806A3D8(Entity* this);
|
||||
void sub_0806A410(Entity* this);
|
||||
void sub_0806A458(Entity* this);
|
||||
void sub_0806A4CC(Entity* this);
|
||||
void sub_0806A550(Entity* this);
|
||||
void nullsub_503(Entity* this);
|
||||
void sub_0806A5C0(Entity* this);
|
||||
void sub_0806A3D8(RemEntity* this);
|
||||
void sub_0806A410(RemEntity* this);
|
||||
void sub_0806A458(RemEntity* this);
|
||||
void sub_0806A4CC(RemEntity* this);
|
||||
void sub_0806A550(RemEntity* this);
|
||||
void nullsub_503(RemEntity* this);
|
||||
void sub_0806A5C0(RemEntity* this);
|
||||
|
||||
void Rem(Entity* this) {
|
||||
static void (*const typeFuncs[])(Entity*) = {
|
||||
void Rem(RemEntity* this) {
|
||||
static void (*const typeFuncs[])(RemEntity*) = {
|
||||
sub_0806a370, sub_0806A5E8, sub_0806A630, sub_0806A674, sub_0806A830, sub_0806A890,
|
||||
};
|
||||
typeFuncs[this->type](this);
|
||||
typeFuncs[super->type](this);
|
||||
}
|
||||
|
||||
void sub_0806a370(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void sub_0806a370(RemEntity* this) {
|
||||
static void (*const actionFuncs[])(RemEntity*) = {
|
||||
sub_0806A3D8, sub_0806A410, sub_0806A458, sub_0806A4CC, sub_0806A550, nullsub_503, sub_0806A5C0,
|
||||
};
|
||||
|
||||
actionFuncs[this->action](this);
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
sub_0806ED78(this);
|
||||
if (this->animIndex == 0xf) {
|
||||
if (this->frame == 1) {
|
||||
this->frame = 0;
|
||||
actionFuncs[super->action](this);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
sub_0806ED78(super);
|
||||
if (super->animIndex == 0xf) {
|
||||
if (super->frame == 1) {
|
||||
super->frame = 0;
|
||||
SoundReq(SFX_218);
|
||||
}
|
||||
if (this->frame == 2) {
|
||||
this->frame = 0;
|
||||
if (super->frame == 2) {
|
||||
super->frame = 0;
|
||||
SoundReq(SFX_219);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806A3D8(Entity* this) {
|
||||
this->action = 1;
|
||||
this->timer = 180;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0806A8C8(this);
|
||||
*(ScriptExecutionContext**)&this->cutsceneBeh = StartCutscene(this, &script_Rem);
|
||||
sub_0807DD94(this, NULL);
|
||||
void sub_0806A3D8(RemEntity* this) {
|
||||
super->action = 1;
|
||||
super->timer = 180;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
sub_0806A8C8(super);
|
||||
this->context = StartCutscene(super, &script_Rem);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
|
||||
void sub_0806A410(Entity* this) {
|
||||
switch (this->subAction) {
|
||||
void sub_0806A410(RemEntity* this) {
|
||||
switch (super->subAction) {
|
||||
case 0:
|
||||
if (--this->timer == 0) {
|
||||
this->subAction++;
|
||||
InitializeAnimation(this, 8);
|
||||
if (--super->timer == 0) {
|
||||
super->subAction++;
|
||||
InitializeAnimation(super, 8);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (((this->frame & ANIM_DONE) != 0)) {
|
||||
sub_0806A9B0(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
|
||||
if (((super->frame & ANIM_DONE) != 0)) {
|
||||
sub_0806A9B0(this, this->context);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806A458(Entity* this) {
|
||||
switch (this->subAction) {
|
||||
void sub_0806A458(RemEntity* this) {
|
||||
switch (super->subAction) {
|
||||
case 0:
|
||||
if (--this->timer == 0) {
|
||||
this->subAction++;
|
||||
if (--super->timer == 0) {
|
||||
super->subAction++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
this->subAction = 2;
|
||||
InitializeAnimation(this, 10);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
super->subAction = 2;
|
||||
InitializeAnimation(super, 10);
|
||||
ClearLocalFlag(0x62);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (((this->frame & ANIM_DONE) != 0)) {
|
||||
this->action = 1;
|
||||
this->subAction = 0;
|
||||
this->timer = 60;
|
||||
InitializeAnimation(this, 2);
|
||||
if (((super->frame & ANIM_DONE) != 0)) {
|
||||
super->action = 1;
|
||||
super->subAction = 0;
|
||||
super->timer = 60;
|
||||
InitializeAnimation(super, 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806A4CC(Entity* this) {
|
||||
switch (this->subAction) {
|
||||
void sub_0806A4CC(RemEntity* this) {
|
||||
switch (super->subAction) {
|
||||
case 0:
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
if ((u8)(this->animIndex - 8) < 2) {
|
||||
this->subAction = 1;
|
||||
this->field_0x6a.HWORD = 1;
|
||||
InitializeAnimation(this, 10);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
if ((u8)(super->animIndex - 8) < 2) {
|
||||
super->subAction = 1;
|
||||
this->unk_6a = 1;
|
||||
InitializeAnimation(super, 10);
|
||||
} else {
|
||||
this->subAction = 2;
|
||||
this->field_0x6a.HWORD = 0;
|
||||
InitializeAnimation(this, GetAnimationState(this));
|
||||
super->subAction = 2;
|
||||
this->unk_6a = 0;
|
||||
InitializeAnimation(super, GetAnimationState(super));
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
this->subAction = 2;
|
||||
InitializeAnimation(this, GetAnimationState(this));
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
super->subAction = 2;
|
||||
InitializeAnimation(super, GetAnimationState(super));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
this->timer = 180;
|
||||
super->timer = 180;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806A550(Entity* this) {
|
||||
if (this->subAction == 0) {
|
||||
this->subAction = 1;
|
||||
InitializeAnimation(this, 0xc);
|
||||
void sub_0806A550(RemEntity* this) {
|
||||
if (super->subAction == 0) {
|
||||
super->subAction = 1;
|
||||
InitializeAnimation(super, 0xc);
|
||||
} else {
|
||||
if (this->frame == 1) {
|
||||
this->frame = 0;
|
||||
if (super->frame == 1) {
|
||||
super->frame = 0;
|
||||
InitScreenShake(8, 2);
|
||||
gActiveScriptInfo.syncFlags |= 0x100;
|
||||
SoundReq(SFX_CHEST_OPEN);
|
||||
}
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
this->action = 5;
|
||||
this->subAction = 0;
|
||||
InitializeAnimation(this, 0xd);
|
||||
sub_0806A914(this);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
super->action = 5;
|
||||
super->subAction = 0;
|
||||
InitializeAnimation(super, 0xd);
|
||||
sub_0806A914(super);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nullsub_503(Entity* this) {
|
||||
void nullsub_503(RemEntity* this) {
|
||||
}
|
||||
|
||||
void sub_0806A5C0(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
InitializeAnimation(this, (Random() & 3) + 4);
|
||||
void sub_0806A5C0(RemEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
InitializeAnimation(super, (Random() & 3) + 4);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806A5E8(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, 0x10);
|
||||
this->timer = (Random() & 0x3f) + 60;
|
||||
void sub_0806A5E8(RemEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, 0x10);
|
||||
super->timer = (Random() & 0x3f) + 60;
|
||||
}
|
||||
this->timer--;
|
||||
if (this->timer == 0) {
|
||||
this->timer = (Random() & 0x3f) + 120;
|
||||
super->timer--;
|
||||
if (super->timer == 0) {
|
||||
super->timer = (Random() & 0x3f) + 120;
|
||||
SoundReq(SFX_REM_SLEEP);
|
||||
}
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
|
||||
void sub_0806A630(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, 0x12);
|
||||
void sub_0806A630(RemEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, 0x12);
|
||||
}
|
||||
if ((gActiveScriptInfo.syncFlags & 0x100) != 0) {
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
if (this->frame == 1) {
|
||||
this->frame = 0;
|
||||
if (super->frame == 1) {
|
||||
super->frame = 0;
|
||||
SoundReq(SFX_SECRET);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806A674(Entity* this) {
|
||||
void sub_0806A674(RemEntity* this) {
|
||||
static const u8 gUnk_08112294[] = { 0, -1, 0, 1, 0, -1, 0, 1 };
|
||||
u32 rand;
|
||||
u8 auStack16[8];
|
||||
|
||||
memcpy(auStack16, &gUnk_08112294, 8);
|
||||
switch (this->action) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
this->action = 1;
|
||||
this->spritePriority.b0 = 6;
|
||||
InitializeAnimation(this, 0x13);
|
||||
super->action = 1;
|
||||
super->spritePriority.b0 = 6;
|
||||
InitializeAnimation(super, 0x13);
|
||||
break;
|
||||
case 1:
|
||||
if ((gActiveScriptInfo.syncFlags & 0x100) != 0) {
|
||||
this->action = 2;
|
||||
this->spriteOffsetY = 0;
|
||||
this->spriteOffsetX = 0;
|
||||
super->action = 2;
|
||||
super->spriteOffsetY = 0;
|
||||
super->spriteOffsetX = 0;
|
||||
} else {
|
||||
if (this->parent->animIndex == 9) {
|
||||
this->spritePriority.b0 = 3;
|
||||
if (super->parent->animIndex == 9) {
|
||||
super->spritePriority.b0 = 3;
|
||||
|
||||
if (this->timer == 0) {
|
||||
if (super->timer == 0) {
|
||||
rand = Random();
|
||||
this->timer = rand & 7;
|
||||
this->field_0x68.HALF.LO = auStack16[rand >> 8 & 7];
|
||||
super->timer = rand & 7;
|
||||
this->unk_68 = auStack16[rand >> 8 & 7];
|
||||
} else if ((gRoomTransition.frameCount & 3U) == 0) {
|
||||
this->timer--;
|
||||
if ((s8)this->spriteOffsetX < 1) {
|
||||
this->field_0x68.HALF.LO = 1;
|
||||
super->timer--;
|
||||
if ((s8)super->spriteOffsetX < 1) {
|
||||
this->unk_68 = 1;
|
||||
}
|
||||
|
||||
if (0xf < (s8)this->spriteOffsetX) {
|
||||
this->field_0x68.HALF.LO = -1;
|
||||
if (0xf < (s8)super->spriteOffsetX) {
|
||||
this->unk_68 = -1;
|
||||
}
|
||||
this->spriteOffsetX += this->field_0x68.HALF.LO;
|
||||
super->spriteOffsetX += this->unk_68;
|
||||
}
|
||||
|
||||
if (this->subtimer == 0) {
|
||||
if (super->subtimer == 0) {
|
||||
rand = Random();
|
||||
this->subtimer = rand & 7;
|
||||
this->field_0x68.HALF.HI = auStack16[rand >> 8 & 7];
|
||||
super->subtimer = rand & 7;
|
||||
this->unk_69 = auStack16[rand >> 8 & 7];
|
||||
} else if (((u32)gRoomTransition.frameCount >> 4 & 3) == 0) {
|
||||
this->subtimer--;
|
||||
if (-1 < this->spriteOffsetY) {
|
||||
this->field_0x68.HALF.HI = -1;
|
||||
super->subtimer--;
|
||||
if (-1 < super->spriteOffsetY) {
|
||||
this->unk_69 = -1;
|
||||
}
|
||||
|
||||
if (this->spriteOffsetY <= -8) {
|
||||
this->field_0x68.HALF.HI = 1;
|
||||
if (super->spriteOffsetY <= -8) {
|
||||
this->unk_69 = 1;
|
||||
}
|
||||
this->spriteOffsetY += this->field_0x68.HALF.HI;
|
||||
super->spriteOffsetY += this->unk_69;
|
||||
}
|
||||
} else {
|
||||
this->spritePriority.b0 = 6;
|
||||
if ((s8)this->spriteOffsetX != 0) {
|
||||
if (0 < (s8)this->spriteOffsetX) {
|
||||
this->spriteOffsetX--;
|
||||
super->spritePriority.b0 = 6;
|
||||
if ((s8)super->spriteOffsetX != 0) {
|
||||
if (0 < (s8)super->spriteOffsetX) {
|
||||
super->spriteOffsetX--;
|
||||
}
|
||||
|
||||
if ((s8)this->spriteOffsetX < 0) {
|
||||
this->spriteOffsetX++;
|
||||
if ((s8)super->spriteOffsetX < 0) {
|
||||
super->spriteOffsetX++;
|
||||
}
|
||||
}
|
||||
|
||||
if (this->spriteOffsetY != 0) {
|
||||
if (0 < this->spriteOffsetY) {
|
||||
this->spriteOffsetY--;
|
||||
if (super->spriteOffsetY != 0) {
|
||||
if (0 < super->spriteOffsetY) {
|
||||
super->spriteOffsetY--;
|
||||
}
|
||||
|
||||
if (this->spriteOffsetY < 0) {
|
||||
this->spriteOffsetY++;
|
||||
if (super->spriteOffsetY < 0) {
|
||||
super->spriteOffsetY++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -274,40 +286,40 @@ void sub_0806A674(Entity* this) {
|
||||
|
||||
break;
|
||||
case 2:
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(super);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806A830(Entity* this) {
|
||||
void sub_0806A830(RemEntity* this) {
|
||||
Entity* npc;
|
||||
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, 0x14);
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, 0x14);
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
}
|
||||
if ((gActiveScriptInfo.syncFlags & 0x200) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if (this->frame == 1) {
|
||||
this->frame = 0;
|
||||
GetNextFrame(super);
|
||||
if (super->frame == 1) {
|
||||
super->frame = 0;
|
||||
npc = CreateNPC(REM, 5, 0);
|
||||
if (npc != NULL) {
|
||||
PositionEntityOnTop(this, npc);
|
||||
PositionEntityOnTop(super, npc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806A890(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, 0x15);
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
void sub_0806A890(RemEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, 0x15);
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if ((this->frame & ANIM_DONE) != 0) {
|
||||
GetNextFrame(super);
|
||||
if ((super->frame & ANIM_DONE) != 0) {
|
||||
DeleteThisEntity();
|
||||
}
|
||||
}
|
||||
@@ -362,13 +374,13 @@ void sub_0806A96C(Entity* this, ScriptExecutionContext* context) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806A9B0(Entity* this, ScriptExecutionContext* context) {
|
||||
void sub_0806A9B0(RemEntity* this, ScriptExecutionContext* context) {
|
||||
static const u8 gUnk_081122A0[] = { 60, 100, 200, 60, 100, 200, 80, 80 };
|
||||
this->action = 2;
|
||||
this->subAction = 0;
|
||||
this->timer = gUnk_081122A0[Random() & 7];
|
||||
this->field_0x80.HWORD = 9;
|
||||
InitializeAnimation(this, 9);
|
||||
super->action = 2;
|
||||
super->subAction = 0;
|
||||
super->timer = gUnk_081122A0[Random() & 7];
|
||||
this->unk_80 = 9;
|
||||
InitializeAnimation(super, 9);
|
||||
SetLocalFlag(NPC37_REM_SLEEP);
|
||||
}
|
||||
|
||||
@@ -384,16 +396,16 @@ void sub_0806AA10(Entity* this) {
|
||||
sub_0806A914(this);
|
||||
}
|
||||
|
||||
void sub_0806AA18(Entity* this) {
|
||||
void sub_0806AA18(RemEntity* this) {
|
||||
u32 index;
|
||||
if (this->field_0x6a.HWORD != 0) {
|
||||
if (this->unk_6a != 0) {
|
||||
index = TEXT_INDEX(TEXT_REM, 0x8);
|
||||
} else if ((gRoomTransition.frameCount & 1) == 0) {
|
||||
index = TEXT_INDEX(TEXT_REM, 0x7);
|
||||
} else {
|
||||
index = TEXT_INDEX(TEXT_REM, 0xd);
|
||||
}
|
||||
MessageNoOverlap(index, this);
|
||||
MessageNoOverlap(index, super);
|
||||
}
|
||||
|
||||
void sub_0806AA50(Entity* this, ScriptExecutionContext* context) {
|
||||
|
||||
+3
-2
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Simon NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
@@ -22,9 +23,9 @@ typedef struct {
|
||||
void Simon(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+48
-39
@@ -4,9 +4,18 @@
|
||||
*
|
||||
* @brief Sitting Person NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "npc.h"
|
||||
#include "functions.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 animIndex;
|
||||
/*0x6a*/ u8 unused[26];
|
||||
/*0x84*/ u32* unk_84;
|
||||
} SittingPersonEntity;
|
||||
|
||||
const SpriteLoadData gUnk_0810CB78[] = {
|
||||
{ 63, 61, 4 }, { 8255, 61, 4 }, { 0, 0, 0 }, { 62, 61, 4 }, { 8255, 61, 4 }, { 0, 0, 0 },
|
||||
{ 64, 61, 4 }, { 8254, 61, 4 }, { 0, 0, 0 }, { 64, 61, 4 }, { 8256, 61, 4 }, { 0, 0, 0 },
|
||||
@@ -16,10 +25,10 @@ const FrameStruct gUnk_0810CBC0[] = {
|
||||
{ 4, 0 }, { 0, 0 }, { 12, 0 }, { 0, 0 }, { 20, 0 }, { 0, 0 },
|
||||
{ 28, 1 }, { 0, 0 }, { 36, 1 }, { 0, 0 }, { 44, 0 }, { 0, 0 },
|
||||
};
|
||||
void SittingPersion_Init(Entity*);
|
||||
void sub_080637B8(Entity*);
|
||||
void sub_08063830(Entity*);
|
||||
void (*const SittingPersion_Actions[])(Entity*) = {
|
||||
void SittingPersion_Init(SittingPersonEntity*);
|
||||
void sub_080637B8(SittingPersonEntity*);
|
||||
void sub_08063830(SittingPersonEntity*);
|
||||
void (*const SittingPersion_Actions[])(SittingPersonEntity*) = {
|
||||
SittingPersion_Init,
|
||||
sub_080637B8,
|
||||
sub_08063830,
|
||||
@@ -112,55 +121,55 @@ const u8 gUnk_0810CD88[][4] = {
|
||||
};
|
||||
|
||||
extern void sub_08096208(Entity*, u32);
|
||||
void sub_080637B8(Entity* this);
|
||||
void sub_080637B8(SittingPersonEntity* this);
|
||||
|
||||
void SittingPerson(Entity* this) {
|
||||
SittingPersion_Actions[this->action](this);
|
||||
void SittingPerson(SittingPersonEntity* this) {
|
||||
SittingPersion_Actions[super->action](this);
|
||||
}
|
||||
|
||||
void SittingPersion_Init(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_0810CB78[this->type * 3])) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.flipX = this->timer;
|
||||
void SittingPersion_Init(SittingPersonEntity* this) {
|
||||
if (LoadExtraSpriteData(super, &gUnk_0810CB78[super->type * 3])) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.flipX = super->timer;
|
||||
|
||||
if (this->spriteSettings.flipX == 0) {
|
||||
this->animationState = 6;
|
||||
if (super->spriteSettings.flipX == 0) {
|
||||
super->animationState = 6;
|
||||
} else {
|
||||
this->animationState = 2;
|
||||
super->animationState = 2;
|
||||
}
|
||||
|
||||
this->timer = this->animationState;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
sub_0807DD50(this);
|
||||
super->timer = super->animationState;
|
||||
this->animIndex = 0;
|
||||
InitScriptForNPC(super);
|
||||
sub_080637B8(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080637B8(Entity* this) {
|
||||
void sub_080637B8(SittingPersonEntity* this) {
|
||||
u32 tmp;
|
||||
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
tmp = sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
|
||||
tmp += this->spriteSettings.flipX ? 4 : 0;
|
||||
InitializeAnimation(this, tmp);
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
this->animIndex = super->animIndex;
|
||||
tmp = GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity));
|
||||
tmp += super->spriteSettings.flipX ? 4 : 0;
|
||||
InitializeAnimation(super, tmp);
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
if (this->frameDuration == 0xfe) {
|
||||
this->frameDuration = (Random() & 0x1f) + 0x1e;
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
if (super->frameDuration == 0xfe) {
|
||||
super->frameDuration = (Random() & 0x1f) + 0x1e;
|
||||
}
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063830(Entity* this) {
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->field_0x68.HALF.HI);
|
||||
void sub_08063830(SittingPersonEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, this->animIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +225,7 @@ void sub_0806390C(Entity* this) {
|
||||
if (CheckLocalFlag(MACHI_MES_60) == 0) {
|
||||
r5 = 0;
|
||||
SetLocalFlag(MACHI_MES_60);
|
||||
(*(u32**)&this->cutsceneBeh)[0x5] = 1;
|
||||
((SittingPersonEntity*)this)->unk_84[5] = 1;
|
||||
}
|
||||
|
||||
MessageNoOverlap(gUnk_0810CC04[r5], this);
|
||||
@@ -241,9 +250,9 @@ void SittingPerson_Head(Entity* this) {
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
void SittingPerson_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void SittingPerson_MakeInteractable(SittingPersonEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void SittingPerson_Fusion(Entity* this) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Small Town Minish NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
@@ -18,10 +19,10 @@ void SmallTownMinish(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->hitbox = (Hitbox*)&gUnk_081142FC;
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
SetInteractableObjectCollision(this, 1, 0, &gUnk_08114304);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
if ((gPlayerState.flags & PL_MINISH) != 0) {
|
||||
this->spriteSettings.draw = 1;
|
||||
|
||||
+77
-69
@@ -4,31 +4,39 @@
|
||||
*
|
||||
* @brief Smith NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 unused[23];
|
||||
/*0x80*/ u16 unk_80;
|
||||
} SmithEntity;
|
||||
|
||||
static const SpriteLoadData gUnk_08110354[] = {
|
||||
{ 0x4d, 0x38, 0x4 },
|
||||
{ 0x4004, 0x38, 0x4 },
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
|
||||
void sub_080660EC(Entity*);
|
||||
void sub_08066118(Entity*);
|
||||
void sub_08066170(Entity*);
|
||||
void sub_08066178(Entity*);
|
||||
void sub_080661B0(Entity*);
|
||||
void sub_080661BC(Entity*);
|
||||
void sub_08066200(Entity*);
|
||||
void sub_08066218(Entity*);
|
||||
void sub_080660EC(SmithEntity*);
|
||||
void sub_08066118(SmithEntity*);
|
||||
void sub_08066170(SmithEntity*);
|
||||
void sub_08066178(SmithEntity*);
|
||||
void sub_080661B0(SmithEntity*);
|
||||
void sub_080661BC(SmithEntity*);
|
||||
void sub_08066200(SmithEntity*);
|
||||
void sub_08066218(SmithEntity*);
|
||||
|
||||
void Smith(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void Smith(SmithEntity* this) {
|
||||
static void (*const actionFuncs[])(SmithEntity*) = {
|
||||
sub_080660EC,
|
||||
sub_08066118,
|
||||
sub_08066170,
|
||||
};
|
||||
static void (*const scriptedActionFuncs[])(Entity*) = {
|
||||
static void (*const scriptedActionFuncs[])(SmithEntity*) = {
|
||||
sub_08066178, sub_080661B0, sub_080661BC, sub_08066200, sub_08066218,
|
||||
};
|
||||
static const u16 gUnk_08110380[] = {
|
||||
@@ -36,28 +44,28 @@ void Smith(Entity* this) {
|
||||
};
|
||||
u32 index;
|
||||
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 4;
|
||||
this->interactType = 0;
|
||||
index = (this->animIndex == 0xc) ? 8 : 0;
|
||||
index += sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
|
||||
InitAnimationForceUpdate(this, index);
|
||||
sub_0806F118(this);
|
||||
if ((super->flags & ENT_SCRIPTED) != 0) {
|
||||
if (super->interactType == 2) {
|
||||
super->action = 4;
|
||||
super->interactType = 0;
|
||||
index = (super->animIndex == 0xc) ? 8 : 0;
|
||||
index += GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity));
|
||||
InitAnimationForceUpdate(super, index);
|
||||
InitializeNPCFusion(super);
|
||||
}
|
||||
scriptedActionFuncs[this->action](this);
|
||||
scriptedActionFuncs[super->action](this);
|
||||
} else {
|
||||
actionFuncs[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
actionFuncs[super->action](this);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
if (this->animIndex == 0xc) {
|
||||
this->spritePriority.b1 = 0;
|
||||
if (super->animIndex == 0xc) {
|
||||
super->spritePriority.b1 = 0;
|
||||
} else {
|
||||
this->spritePriority.b1 = 1;
|
||||
super->spritePriority.b1 = 1;
|
||||
}
|
||||
if ((this->frame & 1) != 0) {
|
||||
this->frame &= 0xfe;
|
||||
CreateFx(this, FX_STARS2, 0x20);
|
||||
if ((super->frame & 1) != 0) {
|
||||
super->frame &= 0xfe;
|
||||
CreateFx(super, FX_STARS2, 0x20);
|
||||
SoundReq(gUnk_08110380[(Random() & 7)]);
|
||||
}
|
||||
}
|
||||
@@ -76,75 +84,75 @@ void Smith_Head(Entity* this) {
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
void sub_080660EC(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, gUnk_08110354)) {
|
||||
this->action = 1;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
void sub_080660EC(SmithEntity* this) {
|
||||
if (LoadExtraSpriteData(super, gUnk_08110354)) {
|
||||
super->action = 1;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
InitAnimationForceUpdate(super, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066118(Entity* this) {
|
||||
void sub_08066118(SmithEntity* this) {
|
||||
s32 uVar1;
|
||||
|
||||
uVar1 = GetAnimationStateInRectRadius(this, 0x28, 0x28);
|
||||
uVar1 = GetAnimationStateInRectRadius(super, 0x28, 0x28);
|
||||
if (uVar1 < 0) {
|
||||
uVar1 = 2;
|
||||
} else {
|
||||
if (this->subtimer == 0) {
|
||||
this->subtimer = 16;
|
||||
if (super->subtimer == 0) {
|
||||
super->subtimer = 16;
|
||||
} else {
|
||||
--this->subtimer;
|
||||
uVar1 = this->animIndex;
|
||||
--super->subtimer;
|
||||
uVar1 = super->animIndex;
|
||||
}
|
||||
}
|
||||
if (sub_0806F078(this, uVar1) == 0) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (sub_0806F078(super, uVar1) == 0) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
if (this->interactType != 0) {
|
||||
this->action = 2;
|
||||
if (super->interactType != 0) {
|
||||
super->action = 2;
|
||||
MessageFromTarget(0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066170(Entity* this) {
|
||||
this->action = 1;
|
||||
void sub_08066170(SmithEntity* this) {
|
||||
super->action = 1;
|
||||
}
|
||||
|
||||
void sub_08066178(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, gUnk_08110354)) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
sub_0807DD50(this);
|
||||
void sub_08066178(SmithEntity* this) {
|
||||
if (LoadExtraSpriteData(super, gUnk_08110354)) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080661B0(Entity* this) {
|
||||
sub_0807DD94(this, NULL);
|
||||
void sub_080661B0(SmithEntity* this) {
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
|
||||
void sub_080661BC(Entity* this) {
|
||||
if (this->animIndex == 0xc) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if (this->frame & ANIM_DONE) {
|
||||
this->field_0x80.HWORD = GetAnimationState(this) + 8;
|
||||
InitAnimationForceUpdate(this, this->field_0x80.HWORD);
|
||||
void sub_080661BC(SmithEntity* this) {
|
||||
if (super->animIndex == 0xc) {
|
||||
UpdateAnimationSingleFrame(super);
|
||||
if (super->frame & ANIM_DONE) {
|
||||
this->unk_80 = GetAnimationState(super) + 8;
|
||||
InitAnimationForceUpdate(super, this->unk_80);
|
||||
}
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066200(Entity* this) {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
UpdateAnimationSingleFrame(this);
|
||||
void sub_08066200(SmithEntity* this) {
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
void sub_08066218(Entity* this) {
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
void sub_08066218(SmithEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,8 +224,8 @@ void Smith_ChangeInteractableHitbox(Entity* this) {
|
||||
SetInteractableObjectCollision(this, 1, 0, &gUnk_081103E0);
|
||||
}
|
||||
|
||||
void Smith_MakeInteractable(Entity* this) {
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Smith_MakeInteractable(SmithEntity* this) {
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Smith_Fusion(Entity* this) {
|
||||
|
||||
+41
-40
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Stamp NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "effects.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
@@ -18,7 +19,7 @@ void sub_08062C24(Entity*);
|
||||
void sub_08062C54(Entity*);
|
||||
void sub_08062C7C(Entity*);
|
||||
|
||||
void Stamp(Entity* ent) {
|
||||
void Stamp(Entity* this) {
|
||||
static void (*const actionFuncs[4])(Entity*) = {
|
||||
sub_08062BD4,
|
||||
sub_08062BF8,
|
||||
@@ -29,62 +30,62 @@ void Stamp(Entity* ent) {
|
||||
sub_08062C7C,
|
||||
sub_08062CA4,
|
||||
};
|
||||
if ((ent->flags & ENT_SCRIPTED) != 0) {
|
||||
scriptedActionFuncs[ent->action](ent);
|
||||
if ((this->flags & ENT_SCRIPTED) != 0) {
|
||||
scriptedActionFuncs[this->action](this);
|
||||
} else {
|
||||
actionFuncs[ent->action](ent);
|
||||
actionFuncs[this->action](this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08062BD4(Entity* ent) {
|
||||
ent->action = 1;
|
||||
ent->spriteSettings.draw = 1;
|
||||
InitializeAnimation(ent, 0);
|
||||
AddInteractableWhenBigObject(ent);
|
||||
void sub_08062BD4(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
AddInteractableWhenBigObject(this);
|
||||
}
|
||||
|
||||
void sub_08062BF8(Entity* ent) {
|
||||
GetNextFrame(ent);
|
||||
if (ent->interactType != 0) {
|
||||
ent->interactType = 0;
|
||||
ent->action++;
|
||||
RequestPriority(ent);
|
||||
void sub_08062BF8(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->interactType != 0) {
|
||||
this->interactType = 0;
|
||||
this->action++;
|
||||
RequestPriority(this);
|
||||
}
|
||||
sub_0806ED78(ent);
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
void sub_08062C24(Entity* ent) {
|
||||
GetNextFrame(ent);
|
||||
if ((ent->frame & 128) != 0) {
|
||||
InitializeAnimation(ent, 4);
|
||||
void sub_08062C24(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if ((this->frame & 128) != 0) {
|
||||
InitializeAnimation(this, 4);
|
||||
MessageFromTarget(TEXT_INDEX(TEXT_EMPTY, 0x01));
|
||||
ent->action++;
|
||||
this->action++;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08062C54(Entity* ent) {
|
||||
void sub_08062C54(Entity* this) {
|
||||
if ((gMessage.doTextBox & 127) == 0) {
|
||||
ent->action = 1;
|
||||
InitializeAnimation(ent, 0);
|
||||
RevokePriority(ent);
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, 0);
|
||||
RevokePriority(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08062C7C(Entity* ent) {
|
||||
ent->action = 1;
|
||||
sub_0807DD64(ent);
|
||||
InitializeAnimation(ent, 0);
|
||||
CreateFx(ent, FX_SWEAT, 0);
|
||||
sub_08062CA4(ent);
|
||||
void sub_08062C7C(Entity* this) {
|
||||
this->action = 1;
|
||||
sub_0807DD64(this);
|
||||
InitializeAnimation(this, 0);
|
||||
CreateFx(this, FX_SWEAT, 0);
|
||||
sub_08062CA4(this);
|
||||
}
|
||||
|
||||
void sub_08062CA4(Entity* ent) {
|
||||
ExecuteScriptForEntity(ent, NULL);
|
||||
HandleEntity0x82Actions(ent);
|
||||
GetNextFrame(ent);
|
||||
void sub_08062CA4(Entity* this) {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_08062CBC(Entity* ent) {
|
||||
void sub_08062CBC(Entity* this) {
|
||||
static const Dialog gUnk_0810C2E4[2] = {
|
||||
{ 0, DIALOG_ROOM_FLAG, DIALOG_TOGGLE_FLAG, 1, { TEXT_INDEX(TEXT_POST, 0x1), TEXT_INDEX(TEXT_POST, 0x0) } },
|
||||
{ 0, DIALOG_ROOM_FLAG, DIALOG_TOGGLE_FLAG, 1, { TEXT_INDEX(TEXT_POST, 0x3), TEXT_INDEX(TEXT_POST, 0x2) } },
|
||||
@@ -95,11 +96,11 @@ void sub_08062CBC(Entity* ent) {
|
||||
} else {
|
||||
uVar1 = 0;
|
||||
}
|
||||
ShowNPCDialogue(ent, &gUnk_0810C2E4[uVar1]);
|
||||
ShowNPCDialogue(this, &gUnk_0810C2E4[uVar1]);
|
||||
}
|
||||
|
||||
void sub_08062CE0(Entity* ent) {
|
||||
if (ent->action == 0) {
|
||||
ent->action = 1;
|
||||
void sub_08062CE0(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
+52
-45
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Stockwell NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "game.h"
|
||||
@@ -18,17 +19,23 @@
|
||||
static const Rect gUnk_0810FDA0 = { 0, 8, 10, 16 };
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[28];
|
||||
/*0x84*/ ScriptExecutionContext* context;
|
||||
} StockwellEntity;
|
||||
|
||||
extern u16 script_StockwellBuy[];
|
||||
extern u16 script_StockwellDogFood[];
|
||||
|
||||
extern void InitScriptExecutionContext(ScriptExecutionContext* context, u16* script);
|
||||
extern u16 script_Stockwell;
|
||||
|
||||
void sub_08065080(Entity*);
|
||||
void sub_080650CC(Entity*);
|
||||
void sub_080651AC(Entity*);
|
||||
void sub_080651D8(Entity*);
|
||||
void sub_08065368(Entity*);
|
||||
void sub_08065080(StockwellEntity*);
|
||||
void sub_080650CC(StockwellEntity*);
|
||||
void sub_080651AC(StockwellEntity*);
|
||||
void sub_080651D8(StockwellEntity*);
|
||||
void sub_08065368(StockwellEntity*);
|
||||
void sub_080651F8(Entity*);
|
||||
void sub_0806522C(Entity*);
|
||||
void sub_08065250(Entity*);
|
||||
@@ -38,82 +45,82 @@ void sub_080652E4(Entity*);
|
||||
void sub_08065314(Entity*);
|
||||
void sub_08065338(Entity*);
|
||||
|
||||
void Stockwell(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void Stockwell(StockwellEntity* this) {
|
||||
static void (*const actionFuncs[])(StockwellEntity*) = {
|
||||
sub_08065080, sub_080650CC, sub_080651AC, sub_080651D8, sub_08065368,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
ExecuteScript(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
|
||||
sub_0806ED78(this);
|
||||
actionFuncs[super->action](this);
|
||||
ExecuteScript(super, this->context);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
|
||||
void sub_08065080(Entity* this) {
|
||||
void sub_08065080(StockwellEntity* this) {
|
||||
ScriptExecutionContext* context;
|
||||
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
InitializeAnimation(this, 4);
|
||||
AddInteractableWhenBigObject(this);
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitializeAnimation(super, 4);
|
||||
AddInteractableWhenBigObject(super);
|
||||
#ifndef EU
|
||||
SetInteractableObjectCollision(this, 0, 0, &gUnk_0810FDA0);
|
||||
SetInteractableObjectCollision(super, 0, 0, &gUnk_0810FDA0);
|
||||
#endif
|
||||
context = StartCutscene(this, &script_Stockwell);
|
||||
*(ScriptExecutionContext**)&this->cutsceneBeh = context;
|
||||
context = StartCutscene(super, &script_Stockwell);
|
||||
this->context = context;
|
||||
}
|
||||
|
||||
void sub_080650CC(Entity* this) {
|
||||
void sub_080650CC(StockwellEntity* this) {
|
||||
static const u8 gUnk_0810FDB8[] = { 4, 6, 6, 5, 6, 6, 6, 5, 6, 6, 6, 5, 6, 6, 6, 5 };
|
||||
u32 bVar2;
|
||||
u32 confirmMsgId;
|
||||
u32 itemPrice;
|
||||
|
||||
if ((gRoomVars.animFlags & 1)) {
|
||||
this->action = 4;
|
||||
this->subAction = 0;
|
||||
InitScriptExecutionContext(*(ScriptExecutionContext**)&this->cutsceneBeh, script_StockwellDogFood);
|
||||
super->action = 4;
|
||||
super->subAction = 0;
|
||||
InitScriptExecutionContext(this->context, script_StockwellDogFood);
|
||||
} else {
|
||||
bVar2 = this->frame & 0x20;
|
||||
if ((bVar2 == 0) && (this->interactType != 0)) {
|
||||
this->interactType = bVar2;
|
||||
this->action++;
|
||||
InitializeAnimation(this, 7);
|
||||
bVar2 = super->frame & 0x20;
|
||||
if ((bVar2 == 0) && (super->interactType != 0)) {
|
||||
super->interactType = bVar2;
|
||||
super->action++;
|
||||
InitializeAnimation(super, 7);
|
||||
if (gRoomVars.shopItemType == 0) {
|
||||
confirmMsgId = TEXT_INDEX(TEXT_STOCKWELL, 0x1);
|
||||
} else {
|
||||
confirmMsgId = GetSaleItemConfirmMessageID(gRoomVars.shopItemType);
|
||||
itemPrice = GetItemPrice(gRoomVars.shopItemType);
|
||||
this->action = 4;
|
||||
this->subAction = bVar2;
|
||||
InitScriptExecutionContext(*(ScriptExecutionContext**)&this->cutsceneBeh, script_StockwellBuy);
|
||||
super->action = 4;
|
||||
super->subAction = bVar2;
|
||||
InitScriptExecutionContext(this->context, script_StockwellBuy);
|
||||
}
|
||||
MessageNoOverlap(confirmMsgId, this);
|
||||
MessageNoOverlap(confirmMsgId, super);
|
||||
|
||||
//! @bug itemPrice (r8) is not initialized if gRoomVars.shopItemType == 0
|
||||
gMessage.rupees = (u16)itemPrice;
|
||||
} else if ((this->frame & 0x40)) {
|
||||
InitializeAnimation(this, gUnk_0810FDB8[Random() & 0xf]);
|
||||
} else if ((super->frame & 0x40)) {
|
||||
InitializeAnimation(super, gUnk_0810FDB8[Random() & 0xf]);
|
||||
} else {
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(super);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080651AC(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
void sub_080651AC(StockwellEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
this->interactType = gMessage.doTextBox & 0x7f;
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, 4);
|
||||
super->interactType = gMessage.doTextBox & 0x7f;
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, 4);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080651D8(Entity* this) {
|
||||
void sub_080651D8(StockwellEntity* this) {
|
||||
static void (*const subActionFuncs[])(Entity*) = {
|
||||
sub_080651F8, sub_0806522C, sub_08065250, sub_0806528C, sub_080652B0, sub_080652E4, sub_08065314, sub_08065338,
|
||||
};
|
||||
GetNextFrame(this);
|
||||
subActionFuncs[this->subAction](this);
|
||||
GetNextFrame(super);
|
||||
subActionFuncs[super->subAction](super);
|
||||
}
|
||||
|
||||
void sub_080651F8(Entity* this) {
|
||||
@@ -192,8 +199,8 @@ void sub_08065338(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065368(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
void sub_08065368(StockwellEntity* this) {
|
||||
GetNextFrame(super);
|
||||
}
|
||||
|
||||
void sub_08065370(Entity* this, ScriptExecutionContext* context) {
|
||||
|
||||
+69
-62
@@ -4,22 +4,28 @@
|
||||
*
|
||||
* @brief Sturgeon NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
#include "object.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} SturgeonEntity;
|
||||
|
||||
const SpriteLoadData gUnk_0810FA38[] = {
|
||||
{ 59, 140, 0 },
|
||||
{ 59, 140, 0 },
|
||||
{ 0, 0, 0 },
|
||||
};
|
||||
void sub_08064B44(Entity*);
|
||||
void sub_08064B88(Entity*);
|
||||
void sub_08064C2C(Entity*);
|
||||
void sub_08064C50(Entity*);
|
||||
void (*const gUnk_0810FA44[])(Entity*) = {
|
||||
void sub_08064B44(SturgeonEntity*);
|
||||
void sub_08064B88(SturgeonEntity*);
|
||||
void sub_08064C2C(SturgeonEntity*);
|
||||
void sub_08064C50(SturgeonEntity*);
|
||||
void (*const gUnk_0810FA44[])(SturgeonEntity*) = {
|
||||
sub_08064B44,
|
||||
sub_08064B88,
|
||||
sub_08064C2C,
|
||||
@@ -34,102 +40,103 @@ extern const u16 gUnk_0810FA54[];
|
||||
// };
|
||||
extern u32 gUnk_0810FA5A; // TODO second parameter of sub_0806EE04
|
||||
|
||||
void Sturgeon_MakeInteractable(Entity* this);
|
||||
void Sturgeon_MakeInteractable(SturgeonEntity* this);
|
||||
void sub_08064C9C(Entity* this);
|
||||
void sub_08064CD8(Entity* this);
|
||||
|
||||
void Sturgeon(Entity* this) {
|
||||
if ((this->flags & ENT_SCRIPTED) == 0) {
|
||||
gUnk_0810FA44[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
void Sturgeon(SturgeonEntity* this) {
|
||||
if ((super->flags & ENT_SCRIPTED) == 0) {
|
||||
gUnk_0810FA44[super->action](this);
|
||||
sub_0806ED78(super);
|
||||
} else {
|
||||
if (this->action == 0) {
|
||||
if (LoadExtraSpriteData(this, gUnk_0810FA38)) {
|
||||
this->action = 1;
|
||||
this->timer = 0;
|
||||
sub_0807DD50(this);
|
||||
if (super->action == 0) {
|
||||
if (LoadExtraSpriteData(super, gUnk_0810FA38)) {
|
||||
super->action = 1;
|
||||
super->timer = 0;
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
} else {
|
||||
u32 tmp = this->action & 0x80;
|
||||
u32 tmp = super->action & 0x80;
|
||||
if (tmp) {
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
if (UpdateFuseInteraction(super)) {
|
||||
super->action = 1;
|
||||
}
|
||||
} else {
|
||||
if (this->interactType == 2) {
|
||||
this->action = this->action | 0xff;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = super->action | 0xff;
|
||||
super->interactType = 0;
|
||||
InitAnimationForceUpdate(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
sub_08064C9C(this);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
sub_08064C9C(super);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08064B44(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, gUnk_0810FA38)) {
|
||||
InitializeAnimation(this, 2);
|
||||
sub_0806EE04(this, &gUnk_0810FA5A, 0);
|
||||
void sub_08064B44(SturgeonEntity* this) {
|
||||
if (LoadExtraSpriteData(super, gUnk_0810FA38)) {
|
||||
InitializeAnimation(super, 2);
|
||||
sub_0806EE04(super, &gUnk_0810FA5A, 0);
|
||||
Sturgeon_MakeInteractable(this);
|
||||
this->action = 1;
|
||||
this->subAction = 0;
|
||||
this->spriteSettings.draw = 1;
|
||||
super->action = 1;
|
||||
super->subAction = 0;
|
||||
super->spriteSettings.draw = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08064B88(Entity* this) {
|
||||
void sub_08064B88(SturgeonEntity* this) {
|
||||
s32 temp;
|
||||
s32 temp2;
|
||||
|
||||
switch (this->interactType) {
|
||||
switch (super->interactType) {
|
||||
case 0:
|
||||
temp = sub_0806EE20(this);
|
||||
this->animationState = this->knockbackDirection;
|
||||
temp = sub_0806EE20(super);
|
||||
super->animationState = super->knockbackDirection;
|
||||
if (temp != 0) {
|
||||
InitializeAnimation(this, temp & 0x7f);
|
||||
InitializeAnimation(super, temp & 0x7f);
|
||||
}
|
||||
GetNextFrame(this);
|
||||
GetNextFrame(super);
|
||||
break;
|
||||
case 2:
|
||||
this->action = 3;
|
||||
temp2 = GetAnimationState(this);
|
||||
super->action = 3;
|
||||
temp2 = GetAnimationState(super);
|
||||
if (temp2 < 0) {
|
||||
temp2 = this->animationState;
|
||||
temp2 = super->animationState;
|
||||
}
|
||||
this->subtimer = this->animIndex;
|
||||
InitializeAnimation(this, temp2);
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
super->subtimer = super->animIndex;
|
||||
InitializeAnimation(super, temp2);
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
this->action = 2;
|
||||
temp2 = GetAnimationState(this);
|
||||
super->action = 2;
|
||||
temp2 = GetAnimationState(super);
|
||||
if (temp2 < 0) {
|
||||
temp2 = this->animationState;
|
||||
temp2 = super->animationState;
|
||||
}
|
||||
this->subtimer = this->animIndex;
|
||||
InitializeAnimation(this, temp2);
|
||||
this->interactType = 0;
|
||||
sub_08064CD8(this);
|
||||
super->subtimer = super->animIndex;
|
||||
InitializeAnimation(super, temp2);
|
||||
super->interactType = 0;
|
||||
sub_08064CD8(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08064C2C(Entity* this) {
|
||||
void sub_08064C2C(SturgeonEntity* this) {
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, (u32)this->subtimer);
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, (u32)super->subtimer);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08064C50(Entity* this) {
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->subtimer);
|
||||
void sub_08064C50(SturgeonEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, super->subtimer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,9 +153,9 @@ void sub_08064C9C(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void Sturgeon_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Sturgeon_MakeInteractable(SturgeonEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void sub_08064CD8(Entity* this) {
|
||||
|
||||
+25
-18
@@ -4,10 +4,17 @@
|
||||
*
|
||||
* @brief Syrup NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
#include "object.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unused[26];
|
||||
/*0x82*/ u16 unk_82;
|
||||
} SyrupEntity;
|
||||
|
||||
static const SpriteLoadData gUnk_081121B4[] = {
|
||||
{ 0xc2, 0x46, 0x4 },
|
||||
{ 0x44c2, 0x46, 0x4 },
|
||||
@@ -22,38 +29,38 @@ static const SpriteLoadData gUnk_081121C4[] = {
|
||||
};
|
||||
|
||||
void sub_0806A26C(Entity*);
|
||||
void sub_0806A1F8(Entity*);
|
||||
void sub_0806A234(Entity*);
|
||||
void sub_0806A1F8(SyrupEntity*);
|
||||
void sub_0806A234(SyrupEntity*);
|
||||
|
||||
void Syrup(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
void Syrup(SyrupEntity* this) {
|
||||
static void (*const actionFuncs[])(SyrupEntity*) = {
|
||||
sub_0806A1F8,
|
||||
sub_0806A234,
|
||||
};
|
||||
actionFuncs[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
actionFuncs[super->action](this);
|
||||
sub_0806ED78(super);
|
||||
}
|
||||
|
||||
void sub_0806A1F8(Entity* this) {
|
||||
void sub_0806A1F8(SyrupEntity* this) {
|
||||
const SpriteLoadData* paVar2;
|
||||
|
||||
this->type == 0 ? (paVar2 = gUnk_081121B4) : (paVar2 = gUnk_081121C4);
|
||||
super->type == 0 ? (paVar2 = gUnk_081121B4) : (paVar2 = gUnk_081121C4);
|
||||
|
||||
if (LoadExtraSpriteData(this, paVar2)) {
|
||||
this->action = 1;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
InitializeAnimation(this, 0);
|
||||
if (LoadExtraSpriteData(super, paVar2)) {
|
||||
super->action = 1;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitScriptForNPC(super);
|
||||
InitializeAnimation(super, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806A234(Entity* this) {
|
||||
sub_0807DD94(this, 0);
|
||||
if ((this->field_0x82.HWORD & 4) != 0) {
|
||||
void sub_0806A234(SyrupEntity* this) {
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
if ((this->unk_82 & 4) != 0) {
|
||||
if ((gRoomTransition.frameCount & 7) == 0) {
|
||||
sub_0806A26C(this);
|
||||
sub_0806A26C(super);
|
||||
}
|
||||
sub_080042BA(this, 2);
|
||||
sub_080042BA(super, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+62
-52
@@ -4,10 +4,20 @@
|
||||
*
|
||||
* @brief Talon NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 unk_69;
|
||||
/*0x6a*/ u8 unk_6a;
|
||||
/*0x6b*/ u8 unused[25];
|
||||
/*0x84*/ u32 unk_84;
|
||||
} TalonEntity;
|
||||
|
||||
static const SpriteLoadData gUnk_0810FEB0[] = {
|
||||
{ 0x4b, 0x8b, 0 },
|
||||
{ 0x4b, 0x8b, 0 },
|
||||
@@ -16,27 +26,27 @@ static const SpriteLoadData gUnk_0810FEB0[] = {
|
||||
|
||||
extern u8 script_TalonGotKey;
|
||||
|
||||
void sub_0806574C(Entity* this);
|
||||
void sub_0806574C(TalonEntity* this);
|
||||
void sub_08065570(Entity* this);
|
||||
void sub_0806559C(Entity* this);
|
||||
void sub_08065608(Entity* this);
|
||||
void sub_08065648(Entity* this);
|
||||
void sub_080656D4(Entity* this);
|
||||
void sub_080656A4(Entity* this);
|
||||
void sub_08065680(Entity* this);
|
||||
void sub_08065608(TalonEntity* this);
|
||||
void sub_08065648(TalonEntity* this);
|
||||
void sub_080656D4(TalonEntity* this);
|
||||
void sub_080656A4(TalonEntity* this);
|
||||
void sub_08065680(TalonEntity* this);
|
||||
|
||||
void Talon(Entity* this) {
|
||||
static void (*const actionFuncs[])(Entity * this) = {
|
||||
void Talon(TalonEntity* this) {
|
||||
static void (*const actionFuncs[])(Entity*) = {
|
||||
sub_08065570,
|
||||
sub_0806559C,
|
||||
};
|
||||
static void (*const scriptedActionFuncs[])(Entity * this) = {
|
||||
static void (*const scriptedActionFuncs[])(TalonEntity*) = {
|
||||
sub_08065608, sub_08065648, sub_080656D4, sub_080656A4, sub_08065680,
|
||||
};
|
||||
if (this->flags & ENT_SCRIPTED) {
|
||||
scriptedActionFuncs[this->action](this);
|
||||
if (super->flags & ENT_SCRIPTED) {
|
||||
scriptedActionFuncs[super->action](this);
|
||||
} else {
|
||||
actionFuncs[this->action](this);
|
||||
actionFuncs[super->action](super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,74 +90,74 @@ void sub_0806559C(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065608(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, gUnk_0810FEB0)) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
sub_0807DD50(this);
|
||||
void sub_08065608(TalonEntity* this) {
|
||||
if (LoadExtraSpriteData(super, gUnk_0810FEB0)) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = 1;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065648(Entity* this) {
|
||||
if (this->interactType == 2) {
|
||||
this->field_0x68.HALF.HI = this->action;
|
||||
this->action = 4;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
void sub_08065648(TalonEntity* this) {
|
||||
if (super->interactType == 2) {
|
||||
this->unk_69 = super->action;
|
||||
super->action = 4;
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08065680(Entity* this) {
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = this->field_0x68.HALF.HI;
|
||||
InitAnimationForceUpdate(this, this->field_0x6a.HALF.LO);
|
||||
void sub_08065680(TalonEntity* this) {
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = this->unk_69;
|
||||
InitAnimationForceUpdate(super, this->unk_6a);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080656A4(Entity* this) {
|
||||
void sub_080656A4(TalonEntity* this) {
|
||||
if ((gMessage.doTextBox & 0x7F) == 0) {
|
||||
this->action = this->field_0x68.HALF.HI;
|
||||
InitAnimationForceUpdate(this, this->field_0x6a.HALF.LO);
|
||||
super->action = this->unk_69;
|
||||
InitAnimationForceUpdate(super, this->unk_6a);
|
||||
}
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
void sub_080656D4(Entity* this) {
|
||||
if (this->interactType == 2) {
|
||||
this->field_0x68.HALF.HI = this->action;
|
||||
this->action = 4;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
void sub_080656D4(TalonEntity* this) {
|
||||
if (super->interactType == 2) {
|
||||
this->unk_69 = super->action;
|
||||
super->action = 4;
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
sub_0806574C(this);
|
||||
} else {
|
||||
if (this->interactType != 0) {
|
||||
if (super->interactType != 0) {
|
||||
if (GetInventoryValue(ITEM_QST_LONLON_KEY) != 0) {
|
||||
StartCutscene(this, (u16*)&script_TalonGotKey);
|
||||
StartCutscene(super, (u16*)&script_TalonGotKey);
|
||||
} else {
|
||||
this->field_0x68.HALF.HI = this->action;
|
||||
this->action = 3;
|
||||
this->interactType = 0;
|
||||
MessageNoOverlap(*(u32*)(*(u32*)&this->cutsceneBeh.HWORD + 4), this);
|
||||
this->unk_69 = super->action;
|
||||
super->action = 3;
|
||||
super->interactType = 0;
|
||||
MessageNoOverlap(*(u32*)(*(u32*)&this->unk_84 + 4), super);
|
||||
sub_0806574C(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806574C(Entity* this) {
|
||||
void sub_0806574C(TalonEntity* this) {
|
||||
u32 j;
|
||||
|
||||
j = (this->animIndex & ~3) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity));
|
||||
if (this->animIndex != j) {
|
||||
InitAnimationForceUpdate(this, j);
|
||||
j = (super->animIndex & ~3) + GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity));
|
||||
if (super->animIndex != j) {
|
||||
InitAnimationForceUpdate(super, j);
|
||||
}
|
||||
this->field_0x6a.HALF.LO = this->animIndex;
|
||||
this->unk_6a = super->animIndex;
|
||||
}
|
||||
|
||||
void sub_08065780(Entity* this, ScriptExecutionContext* context) {
|
||||
|
||||
+30
-23
@@ -4,52 +4,59 @@
|
||||
*
|
||||
* @brief Teachers NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "player.h"
|
||||
#include "save.h"
|
||||
#include "script.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 animIndex;
|
||||
} TeachersEntity;
|
||||
|
||||
static const SpriteLoadData gUnk_08113910[] = {
|
||||
{ 0x103, 0x4f, 0x4 }, { 0x2103, 0x4f, 0x4 }, { 0, 0, 0 }, { 0, 0, 0 },
|
||||
{ 0, 0x50, 0x4 }, { 0x2002, 0x50, 0x4 }, { 0x4000, 0x50, 0x4 }, { 0, 0, 0 },
|
||||
};
|
||||
|
||||
void Teachers(Entity* this) {
|
||||
switch (this->action) {
|
||||
void Teachers(TeachersEntity* this) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
if (LoadExtraSpriteData(this, &gUnk_08113910[this->type * 4])) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = TRUE;
|
||||
this->animationState = this->timer;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
if (LoadExtraSpriteData(super, &gUnk_08113910[super->type * 4])) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = TRUE;
|
||||
super->animationState = super->timer;
|
||||
this->animIndex = 0;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitScriptForNPC(super);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitializeAnimation(this,
|
||||
(this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
this->animIndex = super->animIndex;
|
||||
InitializeAnimation(super, (super->animIndex & -4) + GetAnimationStateForDirection4(
|
||||
GetFacingDirection(super, &gPlayerEntity)));
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (UpdateFuseInteraction(this)) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->field_0x68.HALF.HI);
|
||||
if (UpdateFuseInteraction(super)) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, this->animIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Teachers_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Teachers_MakeInteractable(TeachersEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void Teachers_Head(Entity* this) {
|
||||
|
||||
+21
-14
@@ -4,12 +4,18 @@
|
||||
*
|
||||
* @brief Tingle Siblings NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "kinstone.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} TingleSiblingsEntity;
|
||||
|
||||
extern void sub_08064DE4(Entity*);
|
||||
extern void sub_08064D78(Entity*);
|
||||
extern void sub_08064EE8(Entity*);
|
||||
@@ -58,16 +64,17 @@ void sub_08064DE4(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->animationState = 4;
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
sub_0806F118(this);
|
||||
InitAnimationForceUpdate(this,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
InitializeNPCFusion(this);
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@@ -88,28 +95,28 @@ void sub_08064DE4(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void TingleSiblings_MakeInteractable(Entity* this) {
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
switch (this->type) {
|
||||
void TingleSiblings_MakeInteractable(TingleSiblingsEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
switch (super->type) {
|
||||
case 0:
|
||||
if ((CheckKinstoneFused(KINSTONE_59) != 0) && (GetInventoryValue(ITEM_MAGIC_BOOMERANG) == 0)) {
|
||||
this->field_0x68.HALF.LO = 0;
|
||||
this->fusionOffer = 0;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if ((CheckKinstoneFused(KINSTONE_5A) != 0) && (GetInventoryValue(ITEM_MAGIC_BOOMERANG) == 0)) {
|
||||
this->field_0x68.HALF.LO = 0;
|
||||
this->fusionOffer = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void sub_08064EE8(Entity* this) {
|
||||
u32 bVar1;
|
||||
Entity* fxEnt;
|
||||
Entity* fxEntity;
|
||||
u32 confettiFx;
|
||||
|
||||
UpdateAnimationSingleFrame(this);
|
||||
@@ -122,9 +129,9 @@ void sub_08064EE8(Entity* this) {
|
||||
confettiFx = FX_CONFETTI_LARGE;
|
||||
}
|
||||
|
||||
fxEnt = CreateFx(this, confettiFx, 0);
|
||||
if ((fxEnt != NULL) && (bVar1 == 2)) {
|
||||
fxEnt->spriteSettings.flipX = 1;
|
||||
fxEntity = CreateFx(this, confettiFx, 0);
|
||||
if ((fxEntity != NULL) && (bVar1 == 2)) {
|
||||
fxEntity->spriteSettings.flipX = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+113
-101
@@ -4,17 +4,28 @@
|
||||
*
|
||||
* @brief Town Minish NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 unk_69;
|
||||
/*0x6a*/ u8 unk_6a;
|
||||
/*0x6b*/ u8 unused[23];
|
||||
/*0x82*/ u16 unk_82;
|
||||
/*0x84*/ ScriptExecutionContext* context;
|
||||
} TownMinishEntity;
|
||||
|
||||
extern u32 sub_080B1AC8(u32, u32, u32);
|
||||
void sub_0806ACC4(Entity*);
|
||||
void sub_0806ABFC(Entity*);
|
||||
void sub_0806AC3C(Entity*);
|
||||
void sub_0806AEA8(Entity*);
|
||||
void sub_0806AEE4(Entity*);
|
||||
void sub_0806ACC4(TownMinishEntity*);
|
||||
void sub_0806ABFC(TownMinishEntity*);
|
||||
void sub_0806AC3C(TownMinishEntity*);
|
||||
void sub_0806AEA8(TownMinishEntity*);
|
||||
void sub_0806AEE4(TownMinishEntity*);
|
||||
void sub_0806AFE8(Entity*, ScriptExecutionContext*);
|
||||
void sub_0806B004(Entity*, ScriptExecutionContext*);
|
||||
void sub_0806B098(Entity*, ScriptExecutionContext*);
|
||||
@@ -142,98 +153,99 @@ static const Rect gUnk_081126D4[4] = {
|
||||
};
|
||||
static const u8 gUnk_081126E4[4] = { 0x0e, 0x0d, 0x0b, 0x07 };
|
||||
|
||||
void TownMinish(Entity* this) {
|
||||
static void (*const scriptedActionFuncs[])(Entity*) = {
|
||||
void TownMinish(TownMinishEntity* this) {
|
||||
static void (*const scriptedActionFuncs[])(TownMinishEntity*) = {
|
||||
sub_0806ABFC,
|
||||
sub_0806AC3C,
|
||||
};
|
||||
if ((this->flags & ENT_SCRIPTED) == 0) {
|
||||
scriptedActionFuncs[this->action](this);
|
||||
sub_0806ED78(this);
|
||||
if ((super->flags & ENT_SCRIPTED) == 0) {
|
||||
scriptedActionFuncs[super->action](this);
|
||||
sub_0806ED78(super);
|
||||
} else {
|
||||
sub_0806ACC4(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806ABFC(Entity* this) {
|
||||
const SpriteLoadData* SpriteLoadData = gUnk_08112674[this->type];
|
||||
if (!LoadExtraSpriteData(this, SpriteLoadData)) {
|
||||
void sub_0806ABFC(TownMinishEntity* this) {
|
||||
const SpriteLoadData* SpriteLoadData = gUnk_08112674[super->type];
|
||||
if (!LoadExtraSpriteData(super, SpriteLoadData)) {
|
||||
return;
|
||||
}
|
||||
|
||||
InitializeAnimation(this, 2);
|
||||
this->action = 1;
|
||||
this->field_0x6a.HALF.LO = this->timer;
|
||||
InitializeAnimation(super, 2);
|
||||
super->action = 1;
|
||||
this->unk_6a = super->timer;
|
||||
|
||||
this->animationState = this->field_0x6a.HALF.LO << 1;
|
||||
this->field_0x68.HALF.HI = this->animationState * 4;
|
||||
super->animationState = this->unk_6a << 1;
|
||||
this->unk_69 = super->animationState * 4;
|
||||
|
||||
this->timer = 0;
|
||||
super->timer = 0;
|
||||
}
|
||||
|
||||
void sub_0806AC3C(Entity* this) {
|
||||
if (this->animIndex <= 3) {
|
||||
void sub_0806AC3C(TownMinishEntity* this) {
|
||||
if (super->animIndex <= 3) {
|
||||
s32 unk;
|
||||
Entity* link = &gPlayerEntity;
|
||||
if (EntityInRectRadius(this, link, 0x18, 0x18)) {
|
||||
unk = GetFacingDirection(this, link) & 0x1e;
|
||||
if (EntityInRectRadius(super, link, 0x18, 0x18)) {
|
||||
unk = GetFacingDirection(super, link) & 0x1e;
|
||||
} else {
|
||||
unk = this->animationState * 4;
|
||||
unk = super->animationState * 4;
|
||||
}
|
||||
|
||||
if (unk != this->field_0x68.HALF.HI) {
|
||||
if (((unk - this->field_0x68.HALF.HI) & 0x1f) <= 0xf) {
|
||||
this->field_0x68.HALF.HI--;
|
||||
if (unk != this->unk_69) {
|
||||
if (((unk - this->unk_69) & 0x1f) <= 0xf) {
|
||||
this->unk_69--;
|
||||
} else {
|
||||
this->field_0x68.HALF.HI++;
|
||||
this->unk_69++;
|
||||
}
|
||||
|
||||
this->field_0x68.HALF.HI &= 0x1f;
|
||||
this->unk_69 &= 0x1f;
|
||||
}
|
||||
|
||||
if (!(this->field_0x68.HALF.HI & 7)) {
|
||||
this->animationState = sub_0806F5B0(this->field_0x68.HALF.HI);
|
||||
InitializeAnimation(this, AnimationStateFlip90(this->animationState / 2));
|
||||
if (!(this->unk_69 & 7)) {
|
||||
super->animationState = GetAnimationStateForDirection8(this->unk_69);
|
||||
InitializeAnimation(super, AnimationStateFlip90(super->animationState / 2));
|
||||
}
|
||||
}
|
||||
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
void sub_0806ACC4(Entity* this) {
|
||||
void sub_0806ACC4(TownMinishEntity* this) {
|
||||
u8 delay;
|
||||
switch (this->action) {
|
||||
switch (super->action) {
|
||||
case 0:
|
||||
if (!LoadExtraSpriteData(this, gUnk_08112674[this->type]))
|
||||
if (!LoadExtraSpriteData(super, gUnk_08112674[super->type]))
|
||||
return;
|
||||
|
||||
this->action = 1;
|
||||
delay = this->timer;
|
||||
this->field_0x6a.HALF.LO = delay;
|
||||
this->animationState = delay * 2;
|
||||
this->timer = 0;
|
||||
super->action = 1;
|
||||
delay = super->timer;
|
||||
this->unk_6a = delay;
|
||||
super->animationState = delay * 2;
|
||||
super->timer = 0;
|
||||
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
sub_0807DD50(this);
|
||||
InitializeAnimation(this, (this->animationState / 2) + 8);
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
InitScriptForNPC(super);
|
||||
InitializeAnimation(super, (super->animationState / 2) + 8);
|
||||
break;
|
||||
case 1:
|
||||
if (this->interactType == 2) {
|
||||
this->action = 3;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
if (super->interactType == 2) {
|
||||
super->action = 3;
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
sub_0806AEA8(this);
|
||||
if (this->type2 == 10 && this->interactType) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 8);
|
||||
sub_0806AFE8(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
|
||||
if (super->type2 == 10 && super->interactType) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
InitializeAnimation(super,
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)) + 8);
|
||||
sub_0806AFE8(super, this->context);
|
||||
}
|
||||
if (this->type == 1) {
|
||||
if (super->type == 1) {
|
||||
u8 idx = gPlayerEntity.animationState >> 1;
|
||||
SetInteractableObjectCollision(this, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]);
|
||||
SetInteractableObjectCollision(super, 1, gUnk_081126E4[idx], &gUnk_081126D4[idx]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -241,96 +253,96 @@ void sub_0806ACC4(Entity* this) {
|
||||
if (gMessage.doTextBox & 0x7f)
|
||||
break;
|
||||
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->animationState / 2 + 4);
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, super->animationState / 2 + 4);
|
||||
break;
|
||||
case 3:
|
||||
if (UpdateFuseInteraction(this))
|
||||
this->action = 1;
|
||||
if (UpdateFuseInteraction(super))
|
||||
super->action = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (this->frameDuration != 0xff) {
|
||||
GetNextFrame(this);
|
||||
if (super->frameDuration != 0xff) {
|
||||
GetNextFrame(super);
|
||||
}
|
||||
}
|
||||
|
||||
void TownMinish_MakeInteractable(Entity* this) {
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void TownMinish_MakeInteractable(TownMinishEntity* this) {
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void TownMinish_Head(Entity* this) {
|
||||
void TownMinish_Head(TownMinishEntity* this) {
|
||||
u32 frames;
|
||||
|
||||
if ((this->flags & ENT_SCRIPTED) == 0) {
|
||||
frames = this->field_0x68.HALF.HI / 2;
|
||||
if ((this->frameSpriteSettings & 1)) {
|
||||
SetExtraSpriteFrame(this, 0, frames + 0x1c);
|
||||
if ((super->flags & ENT_SCRIPTED) == 0) {
|
||||
frames = this->unk_69 / 2;
|
||||
if ((super->frameSpriteSettings & 1)) {
|
||||
SetExtraSpriteFrame(super, 0, frames + 0x1c);
|
||||
} else {
|
||||
SetExtraSpriteFrame(this, 0, 0xff);
|
||||
SetExtraSpriteFrame(super, 0, 0xff);
|
||||
}
|
||||
SetExtraSpriteFrame(this, 1, this->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
sub_0807000C(this);
|
||||
SetExtraSpriteFrame(super, 1, super->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(super, 1, 0);
|
||||
sub_0807000C(super);
|
||||
} else {
|
||||
frames = this->frame;
|
||||
frames = super->frame;
|
||||
if (frames != 0xff) {
|
||||
frames &= ~0x80;
|
||||
}
|
||||
if ((this->frameSpriteSettings & 1) == 0) {
|
||||
if ((super->frameSpriteSettings & 1) == 0) {
|
||||
frames = 0xff;
|
||||
}
|
||||
SetExtraSpriteFrame(this, 0, frames);
|
||||
SetExtraSpriteFrame(this, 1, this->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
sub_0807000C(this);
|
||||
SetExtraSpriteFrame(super, 0, frames);
|
||||
SetExtraSpriteFrame(super, 1, super->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(super, 1, 0);
|
||||
sub_0807000C(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806AEA8(Entity* this) {
|
||||
int old = this->field_0x82.HWORD;
|
||||
this->field_0x82.HWORD &= ~0x20;
|
||||
void sub_0806AEA8(TownMinishEntity* this) {
|
||||
int old = this->unk_82;
|
||||
this->unk_82 &= ~0x20;
|
||||
if (old & 0x20) {
|
||||
GravityUpdate(this, Q_8_8(64.0));
|
||||
GravityUpdate(super, Q_8_8(64.0));
|
||||
}
|
||||
HandleEntity0x82Actions(this);
|
||||
this->field_0x82.HWORD = old;
|
||||
HandleEntity0x82Actions(super);
|
||||
this->unk_82 = old;
|
||||
}
|
||||
|
||||
void sub_0806AED8(Entity* this) {
|
||||
this->timer = 0;
|
||||
void sub_0806AED8(TownMinishEntity* this) {
|
||||
super->timer = 0;
|
||||
sub_0806AEE4(this);
|
||||
}
|
||||
|
||||
void sub_0806AEE4(Entity* this) {
|
||||
void sub_0806AEE4(TownMinishEntity* this) {
|
||||
int index;
|
||||
const u8* idx3;
|
||||
u8 tmp1, tmp2;
|
||||
|
||||
if (this->timer) {
|
||||
this->timer--;
|
||||
if (super->timer) {
|
||||
super->timer--;
|
||||
} else {
|
||||
this->timer = 2;
|
||||
index = GetFacingDirectionInRectRadius(this, 0x20, 0x20);
|
||||
super->timer = 2;
|
||||
index = GetFacingDirectionInRectRadius(super, 0x20, 0x20);
|
||||
if (index < 0) {
|
||||
int state = this->field_0x6a.HALF.LO;
|
||||
this->animationState = state * 2;
|
||||
int state = this->unk_6a;
|
||||
super->animationState = state * 2;
|
||||
index = state * 8;
|
||||
}
|
||||
|
||||
idx3 = gUnk_081125F4[this->animationState / 2][index >> 1];
|
||||
idx3 = gUnk_081125F4[super->animationState / 2][index >> 1];
|
||||
tmp1 = idx3[0];
|
||||
tmp2 = idx3[1];
|
||||
|
||||
if (tmp2 & 0x80) {
|
||||
this->animationState = sub_0806F5B0(index);
|
||||
super->animationState = GetAnimationStateForDirection8(index);
|
||||
}
|
||||
tmp2 &= ~0x80;
|
||||
this->frame = tmp1;
|
||||
this->frameIndex = tmp2;
|
||||
this->frameSpriteSettings = 1;
|
||||
this->animIndex = 0;
|
||||
this->frameDuration = 0xff;
|
||||
super->frame = tmp1;
|
||||
super->frameIndex = tmp2;
|
||||
super->frameSpriteSettings = 1;
|
||||
super->animIndex = 0;
|
||||
super->frameDuration = 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+70
-59
@@ -4,10 +4,19 @@
|
||||
*
|
||||
* @brief Townsperson NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "item.h"
|
||||
#include "npc.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
/*0x69*/ u8 unk_69;
|
||||
/*0x6a*/ s16 unk_6a;
|
||||
/*0x6c*/ s16 unk_6c;
|
||||
} TownspersonEntity;
|
||||
|
||||
typedef struct {
|
||||
u8 frame1;
|
||||
u8 frame2;
|
||||
@@ -16,7 +25,7 @@ typedef struct {
|
||||
} struct_0810B680;
|
||||
|
||||
extern void sub_08061CB4(Entity*, u32);
|
||||
extern void sub_08061D64(Entity*);
|
||||
extern void sub_08061D64(TownspersonEntity*);
|
||||
extern void sub_08062048(Entity*);
|
||||
|
||||
extern struct_0810B680 gUnk_0810B680[];
|
||||
@@ -94,77 +103,79 @@ void sub_08061CB4(Entity* this, u32 arg1) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08061CEC(Entity* this) {
|
||||
void sub_08061CEC(TownspersonEntity* this) {
|
||||
u32 uVar2;
|
||||
|
||||
if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->type])) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = TRUE;
|
||||
this->animationState = this->timer;
|
||||
this->field_0x68.HALF.HI = 0xff;
|
||||
uVar2 = sub_0805ACC0(this);
|
||||
if (LoadExtraSpriteData(super, gUnk_0810B6EC[super->type])) {
|
||||
super->action = 1;
|
||||
super->spriteSettings.draw = TRUE;
|
||||
super->animationState = super->timer;
|
||||
this->unk_69 = 0xff;
|
||||
uVar2 = sub_0805ACC0(super);
|
||||
if (uVar2 == 0) {
|
||||
this->field_0x6a.HWORD = this->x.HALF.HI;
|
||||
uVar2 = (u16)this->y.HALF.HI;
|
||||
this->unk_6a = super->x.HALF.HI;
|
||||
uVar2 = (u16)super->y.HALF.HI;
|
||||
} else {
|
||||
this->field_0x6a.HWORD = (uVar2 >> 0x10);
|
||||
this->unk_6a = (uVar2 >> 0x10);
|
||||
}
|
||||
*(u16*)&this->field_0x6c = uVar2;
|
||||
this->field_0x68.HALF.LO = GetFusionToOffer(this);
|
||||
sub_0807DD64(this);
|
||||
this->unk_6c = uVar2;
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
sub_0807DD64(super);
|
||||
sub_08061D64(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08061D64(Entity* this) {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 3;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitializeAnimation(this, (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
void sub_08061D64(TownspersonEntity* this) {
|
||||
if (super->interactType == 2) {
|
||||
super->action = 3;
|
||||
super->interactType = 0;
|
||||
InitializeNPCFusion(super);
|
||||
this->unk_69 = super->animIndex;
|
||||
InitializeAnimation(super, (super->animIndex & -4) +
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
} else {
|
||||
ExecuteScriptForEntity(this, NULL);
|
||||
HandleEntity0x82Actions(this);
|
||||
if (this->frameDuration == 0xff) {
|
||||
this->frameDuration = gUnk_0810B680[this->type].unk2;
|
||||
ExecuteScriptForEntity(super, NULL);
|
||||
HandleEntity0x82Actions(super);
|
||||
if (super->frameDuration == 0xff) {
|
||||
super->frameDuration = gUnk_0810B680[super->type].unk2;
|
||||
}
|
||||
GetNextFrame(this);
|
||||
if (this->interactType != 0) {
|
||||
this->action = 2;
|
||||
this->interactType = 0;
|
||||
sub_08062048(this);
|
||||
this->field_0x68.HALF.HI = this->animIndex;
|
||||
InitializeAnimation(this, (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
|
||||
GetNextFrame(super);
|
||||
if (super->interactType != 0) {
|
||||
super->action = 2;
|
||||
super->interactType = 0;
|
||||
sub_08062048(super);
|
||||
this->unk_69 = super->animIndex;
|
||||
InitializeAnimation(super, (super->animIndex & -4) +
|
||||
GetAnimationStateForDirection4(GetFacingDirection(super, &gPlayerEntity)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08061E24(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
void sub_08061E24(TownspersonEntity* this) {
|
||||
GetNextFrame(super);
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->field_0x68.HALF.HI);
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, this->unk_69);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08061E50(Entity* this) {
|
||||
void sub_08061E50(TownspersonEntity* this) {
|
||||
|
||||
if (UpdateFuseInteraction(this) != 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, this->field_0x68.HALF.HI);
|
||||
if (UpdateFuseInteraction(super) != 0) {
|
||||
super->action = 1;
|
||||
InitializeAnimation(super, this->unk_69);
|
||||
}
|
||||
}
|
||||
|
||||
void Townsperson_MakeInteractable(Entity* this) {
|
||||
if (this->id == 6) {
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void Townsperson_MakeInteractable(TownspersonEntity* this) {
|
||||
if (super->id == 6) {
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
} else {
|
||||
AddInteractableWhenBigObject(this);
|
||||
AddInteractableWhenBigObject(super);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08061E90(Entity* this, ScriptExecutionContext* context) {
|
||||
void sub_08061E90(TownspersonEntity* this, ScriptExecutionContext* context) {
|
||||
u32 animIndex;
|
||||
s32 iVar4;
|
||||
|
||||
@@ -172,7 +183,7 @@ void sub_08061E90(Entity* this, ScriptExecutionContext* context) {
|
||||
context->unk_18++;
|
||||
context->unk_12 = (Random() & 0x3f) + 0x20;
|
||||
animIndex = DirectionRound(Random());
|
||||
switch (this->direction) {
|
||||
switch (super->direction) {
|
||||
case 0x0:
|
||||
if (animIndex == 0x10) {
|
||||
animIndex = 0x8;
|
||||
@@ -193,32 +204,32 @@ void sub_08061E90(Entity* this, ScriptExecutionContext* context) {
|
||||
animIndex = 0;
|
||||
}
|
||||
}
|
||||
this->direction = (u8)animIndex;
|
||||
this->animationState = sub_0806F5B0(animIndex);
|
||||
this->speed = gUnk_0810B74A[this->type];
|
||||
super->direction = (u8)animIndex;
|
||||
super->animationState = GetAnimationStateForDirection8(animIndex);
|
||||
super->speed = gUnk_0810B74A[super->type];
|
||||
}
|
||||
animIndex = (this->animationState >> 1) + 4;
|
||||
if (animIndex != this->animIndex) {
|
||||
InitializeAnimation(this, animIndex);
|
||||
animIndex = (super->animationState >> 1) + 4;
|
||||
if (animIndex != super->animIndex) {
|
||||
InitializeAnimation(super, animIndex);
|
||||
}
|
||||
ProcessMovement0(this);
|
||||
iVar4 = this->x.HALF.HI - *(s16*)&this->field_0x6a.HWORD;
|
||||
ProcessMovement0(super);
|
||||
iVar4 = super->x.HALF.HI - this->unk_6a;
|
||||
if (0x10 < iVar4) {
|
||||
this->x.HALF.HI = this->field_0x6a.HWORD + 0x10;
|
||||
super->x.HALF.HI = this->unk_6a + 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
if (iVar4 < -0x10) {
|
||||
this->x.HALF.HI = *(s16*)&this->field_0x6a.HWORD - 0x10;
|
||||
super->x.HALF.HI = this->unk_6a - 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
|
||||
iVar4 = this->y.HALF.HI - *(s16*)&this->field_0x6c;
|
||||
iVar4 = super->y.HALF.HI - this->unk_6c;
|
||||
if (0x10 < iVar4) {
|
||||
this->y.HALF.HI = *(s16*)&this->field_0x6c + 0x10;
|
||||
super->y.HALF.HI = this->unk_6c + 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
if (iVar4 < -0x10) {
|
||||
this->y.HALF.HI = *(s16*)&this->field_0x6c - 0x10;
|
||||
super->y.HALF.HI = this->unk_6c - 0x10;
|
||||
context->unk_12 = 1;
|
||||
}
|
||||
if (--context->unk_12 != 0) {
|
||||
|
||||
+52
-41
@@ -4,47 +4,58 @@
|
||||
*
|
||||
* @brief Vaati NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "script.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 unk_68;
|
||||
/*0x69*/ s8 unk_69;
|
||||
/*0x6a*/ u8 unused1[22];
|
||||
/*0x80*/ u16 unk_80;
|
||||
/*0x82*/ u8 unused2[2];
|
||||
/*0x84*/ ScriptExecutionContext* context;
|
||||
} VaatiEntity;
|
||||
|
||||
extern void sub_08095CB0(Entity*);
|
||||
extern void CreateRepeatedSoundManager(Entity*);
|
||||
extern void DeleteRepeatedSoundManager(Entity*);
|
||||
extern void CreateVaatiApparateManager(Entity*, u32);
|
||||
|
||||
void VaatiAction0(Entity*);
|
||||
void VaatiAction1(Entity*);
|
||||
void VaatiAction0(VaatiEntity*);
|
||||
void VaatiAction1(VaatiEntity*);
|
||||
void sub_08066B74(Entity*, ScriptExecutionContext*);
|
||||
|
||||
void (*const vaatiActions[])(Entity*) = { VaatiAction0, VaatiAction1 };
|
||||
void (*const vaatiActions[])(VaatiEntity*) = { VaatiAction0, VaatiAction1 };
|
||||
|
||||
void Vaati(Entity* this) {
|
||||
vaatiActions[this->action](this);
|
||||
this->palette.b.b0 = this->palette.b.b4 + (this->frameSpriteSettings & 1);
|
||||
void Vaati(VaatiEntity* this) {
|
||||
vaatiActions[super->action](this);
|
||||
super->palette.b.b0 = super->palette.b.b4 + (super->frameSpriteSettings & 1);
|
||||
}
|
||||
|
||||
void VaatiAction0(Entity* this) {
|
||||
this->action = 1;
|
||||
this->subAction = 0;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->field_0x68.HALF.LO = 0;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD64(this);
|
||||
void VaatiAction0(VaatiEntity* this) {
|
||||
super->action = 1;
|
||||
super->subAction = 0;
|
||||
super->spriteSettings.draw = 1;
|
||||
this->unk_68 = 0;
|
||||
this->unk_69 = 0;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
sub_0807DD64(super);
|
||||
VaatiAction1(this);
|
||||
}
|
||||
|
||||
void VaatiAction1(Entity* this) {
|
||||
ScriptExecutionContext* tmp;
|
||||
sub_0807DD94(this, sub_08066B74);
|
||||
if ((*(s8*)&this->field_0x68.HALF.HI != 0) && ((gRoomTransition.frameCount & 3) == 0)) {
|
||||
sub_08095CB0(this);
|
||||
void VaatiAction1(VaatiEntity* this) {
|
||||
ScriptExecutionContext* context;
|
||||
ExecuteScriptAndHandleAnimation(super, sub_08066B74);
|
||||
if ((*(s8*)&this->unk_69 != 0) && ((gRoomTransition.frameCount & 3) == 0)) {
|
||||
sub_08095CB0(super);
|
||||
}
|
||||
|
||||
if ((this->frame & ~0x80) != 0) {
|
||||
switch (this->frame & ~0x80u) {
|
||||
if ((super->frame & ~0x80) != 0) {
|
||||
switch (super->frame & ~0x80u) {
|
||||
case 1:
|
||||
EnqueueSFX(SFX_21C);
|
||||
break;
|
||||
@@ -52,18 +63,18 @@ void VaatiAction1(Entity* this) {
|
||||
EnqueueSFX(SFX_21E);
|
||||
break;
|
||||
case 3:
|
||||
tmp = (*(ScriptExecutionContext**)&this->cutsceneBeh);
|
||||
tmp->intVariable = 4;
|
||||
CreateRepeatedSoundManager(this);
|
||||
context = this->context;
|
||||
context->intVariable = 4;
|
||||
CreateRepeatedSoundManager(super);
|
||||
break;
|
||||
case 4:
|
||||
tmp = (*(ScriptExecutionContext**)&this->cutsceneBeh);
|
||||
tmp->intVariable = 4;
|
||||
DeleteRepeatedSoundManager(this);
|
||||
context = this->context;
|
||||
context->intVariable = 4;
|
||||
DeleteRepeatedSoundManager(super);
|
||||
EnqueueSFX(SFX_21D);
|
||||
break;
|
||||
}
|
||||
this->frame &= ~0x80;
|
||||
super->frame &= ~0x80;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,45 +93,45 @@ void sub_08066B74(Entity* this, ScriptExecutionContext* context) {
|
||||
|
||||
switch (currentAction) {
|
||||
case 1 << 20:
|
||||
this->field_0x80.HWORD = animationState + 0x10;
|
||||
((VaatiEntity*)this)->unk_80 = animationState + 0x10;
|
||||
break;
|
||||
case 1 << 21:
|
||||
this->field_0x80.HWORD = animationState + 0x14;
|
||||
((VaatiEntity*)this)->unk_80 = animationState + 0x14;
|
||||
break;
|
||||
case 1 << 22:
|
||||
this->field_0x80.HWORD = animationState + 0x18;
|
||||
((VaatiEntity*)this)->unk_80 = animationState + 0x18;
|
||||
break;
|
||||
case 1 << 23:
|
||||
this->field_0x80.HWORD = animationState + 0x1c;
|
||||
((VaatiEntity*)this)->unk_80 = animationState + 0x1c;
|
||||
break;
|
||||
case 1 << 24:
|
||||
this->field_0x80.HWORD = animationState + 0x20;
|
||||
((VaatiEntity*)this)->unk_80 = animationState + 0x20;
|
||||
break;
|
||||
case 1 << 25:
|
||||
this->field_0x80.HWORD = animationState + 0x24;
|
||||
((VaatiEntity*)this)->unk_80 = animationState + 0x24;
|
||||
break;
|
||||
case 1 << 26:
|
||||
this->field_0x80.HWORD = animationState + 0x28;
|
||||
((VaatiEntity*)this)->unk_80 = animationState + 0x28;
|
||||
break;
|
||||
case 1 << 27:
|
||||
this->field_0x80.HWORD = animationState + 0x2c;
|
||||
((VaatiEntity*)this)->unk_80 = animationState + 0x2c;
|
||||
break;
|
||||
case 1 << 28:
|
||||
this->field_0x80.HWORD = animationState + 0x30;
|
||||
((VaatiEntity*)this)->unk_80 = animationState + 0x30;
|
||||
break;
|
||||
case 1 << 29:
|
||||
this->field_0x68.HALF.LO = 1;
|
||||
((VaatiEntity*)this)->unk_68 = 1;
|
||||
break;
|
||||
case 1 << 30:
|
||||
this->field_0x68.HALF.LO = 0xff;
|
||||
((VaatiEntity*)this)->unk_68 = 0xff;
|
||||
break;
|
||||
case 1 << 31:
|
||||
this->field_0x68.HALF.HI ^= 1;
|
||||
((VaatiEntity*)this)->unk_69 ^= 1;
|
||||
break;
|
||||
}
|
||||
} while (actions != 0);
|
||||
}
|
||||
HandlePostScriptActions(this, *(ScriptExecutionContext**)&this->cutsceneBeh);
|
||||
HandlePostScriptActions(this, ((VaatiEntity*)this)->context);
|
||||
}
|
||||
|
||||
void Vaati_Apparate(Entity* this) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Vaati Reborn NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "functions.h"
|
||||
#include "npc.h"
|
||||
|
||||
|
||||
+2
-1
@@ -4,6 +4,7 @@
|
||||
*
|
||||
* @brief Wheaton NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "npc.h"
|
||||
|
||||
void Wheaton(Entity* this) {
|
||||
@@ -17,5 +18,5 @@ void Wheaton(Entity* this) {
|
||||
this->spriteOffsetY = 0xfe;
|
||||
sub_0807DD64(this);
|
||||
}
|
||||
sub_0807DD94(this, 0);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
|
||||
+13
-10
@@ -4,10 +4,16 @@
|
||||
*
|
||||
* @brief Wind Tribespeople NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "entity.h"
|
||||
#include "npc.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct {
|
||||
/*0x00*/ Entity base;
|
||||
/*0x68*/ u8 fusionOffer;
|
||||
} WindTribespeopleEntity;
|
||||
|
||||
void sub_0806C798(Entity*);
|
||||
void sub_0806C7D4(Entity*);
|
||||
void sub_0806C834(Entity*);
|
||||
@@ -48,7 +54,7 @@ void sub_0806C798(Entity* this) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.draw = 1;
|
||||
this->animationState = this->timer;
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
sub_0806C7D4(this);
|
||||
}
|
||||
}
|
||||
@@ -57,12 +63,12 @@ void sub_0806C7D4(Entity* this) {
|
||||
u32 iVar1;
|
||||
u32 uVar2;
|
||||
|
||||
if (this->interactType == '\x02') {
|
||||
if (this->interactType == 2) {
|
||||
this->action = 3;
|
||||
this->interactType = 0;
|
||||
sub_0806F118(this);
|
||||
InitializeNPCFusion(this);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
if ((this->type2 == 3) && (!CheckGlobalFlag(WARP_EVENT_END)) && (CheckLocalFlag(SORA_ELDER_RECOVER)) &&
|
||||
(CheckRoomFlag(0))) {
|
||||
this->type2 = 7;
|
||||
@@ -84,12 +90,9 @@ void sub_0806C85C(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void WindTribespeople_MakeInteractable(Entity* this) {
|
||||
u8 bVar1;
|
||||
|
||||
bVar1 = GetFusionToOffer(this);
|
||||
this->field_0x68.HALF.LO = bVar1;
|
||||
AddInteractableWhenBigFuser(this, this->field_0x68.HALF.LO);
|
||||
void WindTribespeople_MakeInteractable(WindTribespeopleEntity* this) {
|
||||
this->fusionOffer = GetFusionToOffer(super);
|
||||
AddInteractableWhenBigFuser(super, this->fusionOffer);
|
||||
}
|
||||
|
||||
void WindTribespeople_Head(Entity* this) {
|
||||
|
||||
+27
-25
@@ -4,6 +4,8 @@
|
||||
*
|
||||
* @brief Zelda NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "npc/zelda.h"
|
||||
#include "entity.h"
|
||||
#include "flags.h"
|
||||
#include "functions.h"
|
||||
@@ -30,11 +32,11 @@ void sub_08066CCC(Entity* this) {
|
||||
this->spriteSettings.draw = 1;
|
||||
PrependEntityToList(this, 7);
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
}
|
||||
|
||||
void sub_08066CF8(Entity* this) {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
|
||||
void sub_08066D04(Entity* this) {
|
||||
@@ -73,17 +75,17 @@ void sub_08066D4C(Entity* this, ScriptExecutionContext* context) {
|
||||
|
||||
void sub_08066D94(Entity* this) {
|
||||
u32 room;
|
||||
Entity* npc;
|
||||
ZeldaFollowerEntity* npc;
|
||||
|
||||
SetGlobalFlag(ZELDA_CHASE);
|
||||
npc = CreateNPC(ZELDA_FOLLOWER, 0, 0);
|
||||
npc = (ZeldaFollowerEntity*)CreateNPC(ZELDA_FOLLOWER, 0, 0);
|
||||
if (npc != NULL) {
|
||||
npc->animationState = gPlayerEntity.animationState;
|
||||
npc->flags |= ENT_PERSIST;
|
||||
npc->animationState = GetAnimationState(this);
|
||||
npc->base.animationState = gPlayerEntity.animationState;
|
||||
npc->base.flags |= ENT_PERSIST;
|
||||
npc->base.animationState = GetAnimationState(this);
|
||||
room = gRoomControls.room;
|
||||
npc->field_0x74.HWORD = room;
|
||||
CopyPosition(this, npc);
|
||||
npc->unk_74 = room;
|
||||
CopyPosition(this, &npc->base);
|
||||
}
|
||||
DeleteThisEntity();
|
||||
}
|
||||
@@ -96,29 +98,29 @@ void SetZeldaFollowTarget(Entity* target) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066E08(Entity* this) {
|
||||
InitAnimationForceUpdate(this, 0x50);
|
||||
this->field_0x80.HWORD = this->animIndex;
|
||||
void sub_08066E08(ZeldaEntity* this) {
|
||||
InitAnimationForceUpdate(super, 0x50);
|
||||
this->unk_80 = super->animIndex;
|
||||
}
|
||||
|
||||
void sub_08066E20(Entity* this) {
|
||||
InitAnimationForceUpdate(this, 0x44);
|
||||
this->field_0x80.HWORD = this->animIndex;
|
||||
void sub_08066E20(ZeldaEntity* this) {
|
||||
InitAnimationForceUpdate(super, 0x44);
|
||||
this->unk_80 = super->animIndex;
|
||||
}
|
||||
|
||||
void sub_08066E38(Entity* this) {
|
||||
InitAnimationForceUpdate(this, 0x48);
|
||||
this->field_0x80.HWORD = this->animIndex;
|
||||
void sub_08066E38(ZeldaEntity* this) {
|
||||
InitAnimationForceUpdate(super, 0x48);
|
||||
this->unk_80 = super->animIndex;
|
||||
}
|
||||
|
||||
void sub_08066E50(Entity* this) {
|
||||
InitAnimationForceUpdate(this, 0x4C);
|
||||
this->field_0x80.HWORD = this->animIndex;
|
||||
void sub_08066E50(ZeldaEntity* this) {
|
||||
InitAnimationForceUpdate(super, 0x4C);
|
||||
this->unk_80 = super->animIndex;
|
||||
}
|
||||
|
||||
void sub_08066E68(Entity* this) {
|
||||
InitAnimationForceUpdate(this, 0x54);
|
||||
this->field_0x80.HWORD = this->animIndex;
|
||||
void sub_08066E68(ZeldaEntity* this) {
|
||||
InitAnimationForceUpdate(super, 0x54);
|
||||
this->unk_80 = super->animIndex;
|
||||
}
|
||||
|
||||
void sub_08066E80(Entity* this, ScriptExecutionContext* context) {
|
||||
@@ -161,7 +163,7 @@ void sub_08066E80(Entity* this, ScriptExecutionContext* context) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this->field_0x80.HWORD = this->animIndex;
|
||||
((ZeldaEntity*)this)->unk_80 = this->animIndex;
|
||||
gActiveScriptInfo.commandSize = 0;
|
||||
}
|
||||
|
||||
|
||||
+60
-58
@@ -4,6 +4,8 @@
|
||||
*
|
||||
* @brief Zelda Follower NPC
|
||||
*/
|
||||
#define NENT_DEPRECATED
|
||||
#include "npc/zelda.h"
|
||||
#include "common.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
@@ -24,8 +26,8 @@ typedef union {
|
||||
|
||||
#define ZELDA_FOLLOWER_HEAP_LEN 20
|
||||
|
||||
#define ZELDA_FOLLOWER_HEAP ((ZeldaFollowerItem*)this->myHeap)
|
||||
#define ZELDA_FOLLOWER_HEAP_END ((ZeldaFollowerItem*)this->myHeap + (ZELDA_FOLLOWER_HEAP_LEN - 1))
|
||||
#define ZELDA_FOLLOWER_HEAP ((ZeldaFollowerItem*)super->myHeap)
|
||||
#define ZELDA_FOLLOWER_HEAP_END ((ZeldaFollowerItem*)super->myHeap + (ZELDA_FOLLOWER_HEAP_LEN - 1))
|
||||
|
||||
#define ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr) \
|
||||
do { \
|
||||
@@ -38,29 +40,29 @@ typedef union {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
void sub_08068318(Entity*);
|
||||
void sub_0806854C(Entity*, u32*);
|
||||
void sub_08068318(ZeldaFollowerEntity*);
|
||||
void sub_0806854C(ZeldaFollowerEntity*, u32*);
|
||||
void sub_08068578(Entity* this);
|
||||
|
||||
void ZeldaFollower(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action++;
|
||||
this->spriteSettings.draw = TRUE;
|
||||
this->animationState = 4;
|
||||
this->field_0x68.HALF.LO = 0;
|
||||
this->field_0x68.HALF.HI = 0;
|
||||
SetDefaultPriority(this, PRIO_MESSAGE);
|
||||
InitAnimationForceUpdate(this, 0);
|
||||
void ZeldaFollower(ZeldaFollowerEntity* this) {
|
||||
if (super->action == 0) {
|
||||
super->action++;
|
||||
super->spriteSettings.draw = TRUE;
|
||||
super->animationState = 4;
|
||||
this->unk_68 = 0;
|
||||
this->unk_69 = 0;
|
||||
SetDefaultPriority(super, PRIO_MESSAGE);
|
||||
InitAnimationForceUpdate(super, 0);
|
||||
sub_0806854C(this, NULL);
|
||||
}
|
||||
if ((s8)this->field_0x68.HALF.LO != 0) {
|
||||
if ((s8)this->unk_68 != 0) {
|
||||
sub_08068318(this);
|
||||
} else {
|
||||
this->spriteSettings.draw = FALSE;
|
||||
super->spriteSettings.draw = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08068318(Entity* this) {
|
||||
void sub_08068318(ZeldaFollowerEntity* this) {
|
||||
s32 dist;
|
||||
s16 z;
|
||||
|
||||
@@ -77,39 +79,39 @@ void sub_08068318(Entity* this) {
|
||||
item.FIELDS.animationState = gPlayerEntity.animationState;
|
||||
item.FIELDS.collisionLayer = gPlayerEntity.collisionLayer;
|
||||
|
||||
heapPtr = this->myHeap;
|
||||
heapPtr = super->myHeap;
|
||||
|
||||
if ((heapPtr->FIELDS.framestate == 0xa && item.FIELDS.framestate != 0xa) ||
|
||||
(heapPtr->FIELDS.framestate == 0x16 && item.FIELDS.framestate != 0x16)) {
|
||||
this->x.HALF.HI = gPlayerEntity.x.HALF.HI;
|
||||
this->y.HALF.HI = gPlayerEntity.y.HALF.HI;
|
||||
this->spriteSettings.draw = 1;
|
||||
sub_08068578(this);
|
||||
super->x.HALF.HI = gPlayerEntity.x.HALF.HI;
|
||||
super->y.HALF.HI = gPlayerEntity.y.HALF.HI;
|
||||
super->spriteSettings.draw = 1;
|
||||
sub_08068578(super);
|
||||
}
|
||||
|
||||
animIndex = 0;
|
||||
if (item.DWORD != heapPtr->DWORD || item.FIELDS.framestate == 0x16 || item.FIELDS.framestate == 0xa) {
|
||||
ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr);
|
||||
ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(super, heapPtr);
|
||||
heapPtr = ZELDA_FOLLOWER_HEAP;
|
||||
heapPtr[0] = item;
|
||||
animIndex = 0x4;
|
||||
|
||||
if ((s8)this->field_0x68.HALF.HI > 0) {
|
||||
this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1;
|
||||
if ((s8)this->unk_69 > 0) {
|
||||
this->unk_69 = this->unk_69 - 1;
|
||||
}
|
||||
} else {
|
||||
heapPtr += ZELDA_FOLLOWER_HEAP_LEN - 1;
|
||||
z = heapPtr->FIELDS.z;
|
||||
|
||||
if (z < 0) {
|
||||
ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr);
|
||||
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,
|
||||
(u16)heapPtr->FIELDS.y);
|
||||
dist = ((u32)dist) >> 0x4;
|
||||
if (dist > 0x18) {
|
||||
ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(this, heapPtr);
|
||||
ZELDA_FOLLOWER_HEAP_SHIFT_RIGHT(super, heapPtr);
|
||||
animIndex = 0x4;
|
||||
}
|
||||
}
|
||||
@@ -117,43 +119,43 @@ void sub_08068318(Entity* this) {
|
||||
|
||||
heapPtr = ZELDA_FOLLOWER_HEAP;
|
||||
heapPtr += ZELDA_FOLLOWER_HEAP_LEN - 1;
|
||||
this->x.HALF.HI = heapPtr->FIELDS.x;
|
||||
this->y.HALF.HI = heapPtr->FIELDS.y;
|
||||
this->z.HALF.HI = heapPtr->FIELDS.z;
|
||||
this->animationState = heapPtr->FIELDS.animationState;
|
||||
this->collisionLayer = heapPtr->FIELDS.collisionLayer;
|
||||
super->x.HALF.HI = heapPtr->FIELDS.x;
|
||||
super->y.HALF.HI = heapPtr->FIELDS.y;
|
||||
super->z.HALF.HI = heapPtr->FIELDS.z;
|
||||
super->animationState = heapPtr->FIELDS.animationState;
|
||||
super->collisionLayer = heapPtr->FIELDS.collisionLayer;
|
||||
|
||||
if (heapPtr->FIELDS.framestate == 0x16 || heapPtr->FIELDS.framestate == 0xa) {
|
||||
this->spriteSettings.draw = 0;
|
||||
super->spriteSettings.draw = 0;
|
||||
}
|
||||
|
||||
if (((s8)this->field_0x68.HALF.HI) > 0) {
|
||||
this->field_0x68.HALF.HI = this->field_0x68.HALF.HI - 1;
|
||||
if (((s8)this->unk_69) > 0) {
|
||||
this->unk_69 = this->unk_69 - 1;
|
||||
}
|
||||
|
||||
animIndexTmp = animIndex;
|
||||
animIndex += this->animationState >> 1;
|
||||
animIndex += super->animationState >> 1;
|
||||
|
||||
if (!(animIndex == this->animIndex || (animIndexTmp == 0 && ((s8)this->field_0x68.HALF.HI) > 0))) {
|
||||
InitAnimationForceUpdate(this, animIndex);
|
||||
this->field_0x68.HALF.HI = 0x1e;
|
||||
if (!(animIndex == super->animIndex || (animIndexTmp == 0 && ((s8)this->unk_69) > 0))) {
|
||||
InitAnimationForceUpdate(super, animIndex);
|
||||
this->unk_69 = 0x1e;
|
||||
} else {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
UpdateAnimationSingleFrame(super);
|
||||
}
|
||||
|
||||
sub_0800451C(this);
|
||||
if (this->z.HALF.HI < 0) {
|
||||
sub_0806F854(this, 0x0, -0xc);
|
||||
sub_0800451C(super);
|
||||
if (super->z.HALF.HI < 0) {
|
||||
sub_0806F854(super, 0x0, -0xc);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806854C(Entity* this, u32* none) {
|
||||
this->myHeap = zMalloc(sizeof(ZeldaFollowerItem[ZELDA_FOLLOWER_HEAP_LEN]));
|
||||
if (this->myHeap != NULL) {
|
||||
this->field_0x68.HALF.LO = 1;
|
||||
RemoveInteractableObject(this);
|
||||
this->hitbox = NULL;
|
||||
sub_08068578(this);
|
||||
void sub_0806854C(ZeldaFollowerEntity* this, u32* none) {
|
||||
super->myHeap = zMalloc(sizeof(ZeldaFollowerItem[ZELDA_FOLLOWER_HEAP_LEN]));
|
||||
if (super->myHeap != NULL) {
|
||||
this->unk_68 = 1;
|
||||
RemoveInteractableObject(super);
|
||||
super->hitbox = NULL;
|
||||
sub_08068578(super);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,17 +280,17 @@ void sub_08068578(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
void ZeldaFollower_Hide(Entity* zelda, Entity* follower) {
|
||||
follower->field_0x68.HALF.LO = 0;
|
||||
follower->spriteSettings.draw = 0;
|
||||
void ZeldaFollower_Hide(Entity* zelda, ZeldaFollowerEntity* follower) {
|
||||
follower->unk_68 = 0;
|
||||
follower->base.spriteSettings.draw = 0;
|
||||
}
|
||||
|
||||
void ZeldaFollower_Show(Entity* zelda, Entity* follower) {
|
||||
follower->field_0x68.HALF.LO = 1;
|
||||
follower->spriteSettings.draw = 1;
|
||||
follower->animationState = zelda->animationState;
|
||||
sub_08068578(follower);
|
||||
InitAnimationForceUpdate(follower, follower->animationState / 2);
|
||||
void ZeldaFollower_Show(Entity* zelda, ZeldaFollowerEntity* follower) {
|
||||
follower->unk_68 = 1;
|
||||
follower->base.spriteSettings.draw = 1;
|
||||
follower->base.animationState = zelda->animationState;
|
||||
sub_08068578(&follower->base);
|
||||
InitAnimationForceUpdate(&follower->base, follower->base.animationState / 2);
|
||||
}
|
||||
|
||||
void sub_080686C4(Entity* zelda, Entity* follower) {
|
||||
|
||||
+24
-23
@@ -12,8 +12,8 @@ extern const NPCDefinition gNPCDefinitions[];
|
||||
|
||||
typedef struct {
|
||||
u16 textIndex;
|
||||
u16 _2;
|
||||
u16 _4;
|
||||
u16 cancelledTextIndex;
|
||||
u16 fusingTextIndex;
|
||||
} NPCData;
|
||||
extern NPCData* gUnk_08001A7C[];
|
||||
|
||||
@@ -128,7 +128,7 @@ s32 GetAnimationStateInRectRadius(Entity* ent, u32 x, u32 y) {
|
||||
|
||||
u32 GetAnimationState(Entity* ent) {
|
||||
u32 direction = GetFacingDirection(ent, &gPlayerEntity);
|
||||
return sub_0806F5A4(direction);
|
||||
return GetAnimationStateForDirection4(direction);
|
||||
}
|
||||
|
||||
s32 GetFacingDirectionInRectRadius(Entity* ent, u32 x, u32 y) {
|
||||
@@ -161,7 +161,7 @@ u32 sub_0806EE20(Entity* ent) {
|
||||
} else {
|
||||
ent->knockbackSpeed = 8;
|
||||
v3 = GetFacingDirection(ent, &gPlayerEntity);
|
||||
ent->knockbackDirection = sub_0806F5A4(v3);
|
||||
ent->knockbackDirection = GetAnimationStateForDirection4(v3);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ static void sub_0806EF14(Entity* ent) {
|
||||
sub_0806EF4C(ent, xy);
|
||||
ent->direction = sub_080045B4(ent, xy[0], xy[1]);
|
||||
if ((ent->collisionFlags & 1) == 0)
|
||||
ent->knockbackDirection = sub_0806F5A4(ent->direction);
|
||||
ent->knockbackDirection = GetAnimationStateForDirection4(ent->direction);
|
||||
}
|
||||
|
||||
static void sub_0806EF4C(Entity* ent, u16* xy) {
|
||||
@@ -326,36 +326,37 @@ void CollideFollowers(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0806F118(Entity* ent) {
|
||||
u32 idx = GetFuserId(ent);
|
||||
NPCData* data = gUnk_08001A7C[idx];
|
||||
sub_0801DFB4(ent, data->textIndex, data->_2, data->_4);
|
||||
void InitializeNPCFusion(Entity* entity) {
|
||||
u32 fuserId = GetFuserId(entity);
|
||||
NPCData* data = gUnk_08001A7C[fuserId];
|
||||
InitializeFuseInfo(entity, data->textIndex, data->cancelledTextIndex, data->fusingTextIndex);
|
||||
gPlayerState.controlMode = CONTROL_DISABLED;
|
||||
}
|
||||
|
||||
u32 UpdateFuseInteraction(Entity* ent) {
|
||||
u32 ret;
|
||||
sub_0801E00C();
|
||||
ret = -1;
|
||||
switch (gFuseInfo._0) {
|
||||
// Returns -1, 0, or 1
|
||||
u32 UpdateFuseInteraction(Entity* entity) {
|
||||
u32 result;
|
||||
PerformFuseAction();
|
||||
result = -1;
|
||||
switch (gFuseInfo.fusionState) {
|
||||
default:
|
||||
ret = 0;
|
||||
result = 0;
|
||||
break;
|
||||
case 2:
|
||||
case FUSION_STATE_2:
|
||||
gPlayerState.controlMode = CONTROL_DISABLED;
|
||||
ret = 1;
|
||||
case 1:
|
||||
result = 1;
|
||||
case FUSION_STATE_1:
|
||||
PlayerResetStateFromFusion();
|
||||
gPlayerState.controlMode = CONTROL_1;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
return result;
|
||||
}
|
||||
|
||||
void MarkFuserDone(Entity* ent) {
|
||||
u32 idx = GetFuserId(ent);
|
||||
if (idx != 0)
|
||||
gSave.fuserOffers[idx] = KINSTONE_FUSER_DONE;
|
||||
void MarkFuserDone(Entity* entity) {
|
||||
u32 fuserId = GetFuserId(entity);
|
||||
if (fuserId != 0)
|
||||
gSave.fuserOffers[fuserId] = KINSTONE_FUSER_DONE;
|
||||
}
|
||||
|
||||
void ShowNPCDialogue(Entity* ent, const Dialog* dia) {
|
||||
|
||||
@@ -49,10 +49,10 @@ void CameraTarget(Entity* this) {
|
||||
|
||||
u32 uVar2 = gPlayerState.field_0x27[0] > 0;
|
||||
|
||||
switch (gFuseInfo._0) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
switch (gFuseInfo.fusionState) {
|
||||
case FUSION_STATE_0:
|
||||
case FUSION_STATE_1:
|
||||
case FUSION_STATE_2:
|
||||
if ((gMessage.doTextBox & 0x7f) == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ void CuccoMinigame(CuccoMinigameEntity* this) {
|
||||
sub_0807DD64(super);
|
||||
sub_0806EC20(super);
|
||||
}
|
||||
sub_0807DD94(super, 0);
|
||||
ExecuteScriptAndHandleAnimation(super, NULL);
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/objectB9/sub_080A1270.inc", void sub_080A1270(CuccoMinigameEntity* this)) {
|
||||
|
||||
@@ -13,9 +13,9 @@ void CutsceneOrchestrator(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
this->action = 1;
|
||||
this->hitbox = (Hitbox*)&gHitbox_2;
|
||||
sub_0807DD50(this);
|
||||
InitScriptForNPC(this);
|
||||
} else {
|
||||
sub_0807DD94(this, NULL);
|
||||
ExecuteScriptAndHandleAnimation(this, NULL);
|
||||
}
|
||||
} else {
|
||||
this->action = 1;
|
||||
|
||||
@@ -478,7 +478,7 @@ void sub_0809E1F0(KeyStealingTakkuriEntity* this) {
|
||||
}
|
||||
|
||||
void sub_0809E210(KeyStealingTakkuriEntity* this) {
|
||||
gPlayerEntity.animationState = sub_0806F5B0(GetFacingDirection(&gPlayerEntity, super)) & 0xfe;
|
||||
gPlayerEntity.animationState = GetAnimationStateForDirection8(GetFacingDirection(&gPlayerEntity, super)) & 0xfe;
|
||||
gPlayerState.animation = 0x100;
|
||||
}
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ void sub_0808ACEC(PullableMushroomEntity* this) {
|
||||
case 0x14:
|
||||
case 0x16:
|
||||
COLLISION_OFF(super);
|
||||
super->animationState = sub_0806F5A4(super->knockbackDirection);
|
||||
super->animationState = GetAnimationStateForDirection4(super->knockbackDirection);
|
||||
super->subAction = 2;
|
||||
super->timer = 2;
|
||||
break;
|
||||
|
||||
+11
-11
@@ -13,8 +13,8 @@
|
||||
|
||||
const u8 gSpriteSortAboveTable[];
|
||||
const u8 gSpriteSortBelowTable[];
|
||||
const u8 gUnk_08114F58[];
|
||||
const u8 gUnk_08114F38[];
|
||||
const u8 gMapDirectionToAnimationState8[];
|
||||
const u8 gMapDirectionToAnimationState4[];
|
||||
|
||||
extern u16 gExtraFrameOffsets[];
|
||||
extern s8 gUnk_08126EE4[];
|
||||
@@ -131,19 +131,19 @@ u32 sub_0806F548(Entity* a, Entity* b, u32 x, u32 y) {
|
||||
|
||||
u32 sub_0806F564(Entity* ent, u32 b, u32 c) {
|
||||
u32 tmp = CalculateDirectionTo(ent->x.HALF.HI, ent->y.HALF.HI, b, c);
|
||||
return ent->animationState == sub_0806F5A4(tmp);
|
||||
return ent->animationState == GetAnimationStateForDirection4(tmp);
|
||||
}
|
||||
|
||||
u32 sub_0806F58C(Entity* a, Entity* b) {
|
||||
return a->animationState >> 1 == sub_0806FCA0(a, b);
|
||||
}
|
||||
|
||||
u32 sub_0806F5A4(u32 idx) {
|
||||
return gUnk_08114F38[idx];
|
||||
u32 GetAnimationStateForDirection4(u32 direction) {
|
||||
return gMapDirectionToAnimationState4[direction];
|
||||
}
|
||||
|
||||
u32 sub_0806F5B0(u32 idx) {
|
||||
return gUnk_08114F58[idx];
|
||||
u32 GetAnimationStateForDirection8(u32 idx) {
|
||||
return gMapDirectionToAnimationState8[idx];
|
||||
}
|
||||
|
||||
void LinearMoveDirection(Entity* ent, u32 a, u32 b) {
|
||||
@@ -434,11 +434,11 @@ bool32 sub_0806FC80(Entity* ent, Entity* ent2, s32 param_3) {
|
||||
}
|
||||
|
||||
u32 sub_0806FCA0(Entity* this, Entity* other) {
|
||||
return sub_0806F5A4(GetFacingDirection(this, other));
|
||||
return GetAnimationStateForDirection4(GetFacingDirection(this, other));
|
||||
}
|
||||
|
||||
u32 sub_0806FCAC(Entity* this, Entity* other) {
|
||||
return sub_0806F5B0(GetFacingDirection(this, other));
|
||||
return GetAnimationStateForDirection8(GetFacingDirection(this, other));
|
||||
}
|
||||
|
||||
bool32 EntityWithinDistance(Entity* ent, s32 x, s32 y, s32 distance) {
|
||||
@@ -679,11 +679,11 @@ u8* GetSpriteSubEntryOffsetDataPointer(u32 param_1, u32 param_2) {
|
||||
return (u8*)val;
|
||||
}
|
||||
|
||||
const u8 gUnk_08114F38[] = {
|
||||
const u8 gMapDirectionToAnimationState4[] = {
|
||||
0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
const u8 gUnk_08114F58[] = {
|
||||
const u8 gMapDirectionToAnimationState8[] = {
|
||||
0, 0, 0, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 0, 0,
|
||||
};
|
||||
|
||||
|
||||
+34
-32
@@ -97,7 +97,7 @@ void ScriptCommand_0807E974(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_AddInteractableWhenBigObject(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_RemoveInteractableObject(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_AddInteractableWhenBigFuser(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_UpdateFusion(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_0807EA4C(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_AddInteractableFuser(Entity* entity, ScriptExecutionContext* context);
|
||||
void ScriptCommand_WaitUntilTextboxCloses(Entity* entity, ScriptExecutionContext* context);
|
||||
@@ -313,9 +313,10 @@ void HandlePostScriptActions(Entity* entity, ScriptExecutionContext* context) {
|
||||
}
|
||||
}
|
||||
|
||||
void sub_0807DD50(Entity* entity) {
|
||||
// Init some script related variables, execute the script and do something regarding the animation.
|
||||
void InitScriptForNPC(Entity* entity) {
|
||||
sub_0807DD64(entity);
|
||||
sub_0807DD94(entity, 0);
|
||||
ExecuteScriptAndHandleAnimation(entity, NULL);
|
||||
}
|
||||
|
||||
void sub_0807DD64(Entity* entity) {
|
||||
@@ -330,8 +331,8 @@ void sub_0807DD80(Entity* entity, Script* script) {
|
||||
sub_0807DD64(entity);
|
||||
}
|
||||
|
||||
void sub_0807DD94(Entity* entity, void (*function)(Entity*, ScriptExecutionContext*)) {
|
||||
ExecuteScriptForEntity(entity, function);
|
||||
void ExecuteScriptAndHandleAnimation(Entity* entity, void (*postScriptCallback)(Entity*, ScriptExecutionContext*)) {
|
||||
ExecuteScriptForEntity(entity, postScriptCallback);
|
||||
HandleEntity0x82Actions(entity);
|
||||
sub_0807DE80(entity);
|
||||
}
|
||||
@@ -390,6 +391,7 @@ void HandleEntity0x82Actions(Entity* entity) {
|
||||
}
|
||||
}
|
||||
|
||||
// Handles animation for NPCs? Uses u16 0x80 and 0x82 of the entity.
|
||||
void sub_0807DE80(Entity* entity) {
|
||||
u32 local1;
|
||||
u16 local2;
|
||||
@@ -546,7 +548,7 @@ void ExecuteScript(Entity* entity, ScriptExecutionContext* context) {
|
||||
ScriptCommand_AddInteractableWhenBigObject,
|
||||
ScriptCommand_RemoveInteractableObject,
|
||||
ScriptCommand_AddInteractableWhenBigFuser,
|
||||
ScriptCommand_0807E9F0,
|
||||
ScriptCommand_UpdateFusion,
|
||||
ScriptCommand_0807EA4C,
|
||||
ScriptCommand_AddInteractableFuser,
|
||||
ScriptCommand_WaitUntilTextboxCloses,
|
||||
@@ -801,13 +803,13 @@ void ScriptCommand_CheckEntityInteractType(Entity* entity, ScriptExecutionContex
|
||||
void ScriptCommand_FacePlayerAndCheckDist(Entity* entity, ScriptExecutionContext* context) {
|
||||
if ((context->unk_1A & 0xF) == 0 && (gPlayerState.flags & PL_MINISH) == 0 &&
|
||||
EntityInRectRadius(entity, &gPlayerEntity, 40, 40)) {
|
||||
entity->animationState = sub_0806F5B0(GetFacingDirection(entity, &gPlayerEntity));
|
||||
entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity));
|
||||
}
|
||||
context->unk_1A++;
|
||||
if (entity->interactType) {
|
||||
entity->interactType = 0;
|
||||
context->condition = 1;
|
||||
entity->animationState = sub_0806F5B0(GetFacingDirection(entity, &gPlayerEntity));
|
||||
entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity));
|
||||
} else {
|
||||
context->condition = 0;
|
||||
}
|
||||
@@ -1148,25 +1150,25 @@ void ScriptCommand_AddInteractableWhenBigFuser(Entity* entity, ScriptExecutionCo
|
||||
AddInteractableWhenBigFuser(entity, context->scriptInstructionPointer[1]);
|
||||
}
|
||||
|
||||
void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context) {
|
||||
bool32 tmp;
|
||||
sub_0801E00C();
|
||||
tmp = TRUE;
|
||||
switch (gFuseInfo._0) {
|
||||
void ScriptCommand_UpdateFusion(Entity* entity, ScriptExecutionContext* context) {
|
||||
bool32 isFusionSuccessful;
|
||||
PerformFuseAction();
|
||||
isFusionSuccessful = TRUE;
|
||||
switch (gFuseInfo.fusionState) {
|
||||
default:
|
||||
tmp = FALSE;
|
||||
isFusionSuccessful = FALSE;
|
||||
break;
|
||||
case 2:
|
||||
case FUSION_STATE_2:
|
||||
gPlayerState.controlMode = CONTROL_DISABLED;
|
||||
gPauseMenuOptions.disabled = tmp;
|
||||
context->condition = tmp;
|
||||
gPauseMenuOptions.disabled = isFusionSuccessful;
|
||||
context->condition = isFusionSuccessful;
|
||||
break;
|
||||
case 1:
|
||||
case FUSION_STATE_1:
|
||||
context->condition = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (tmp) {
|
||||
if (isFusionSuccessful) {
|
||||
PlayerResetStateFromFusion();
|
||||
gPlayerState.controlMode = CONTROL_1;
|
||||
} else {
|
||||
@@ -1176,7 +1178,7 @@ void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context) {
|
||||
|
||||
void ScriptCommand_0807EA4C(Entity* entity, ScriptExecutionContext* context) {
|
||||
if (entity->interactType == 2) {
|
||||
sub_0801DFB4(entity, 0, 0, 0);
|
||||
InitializeFuseInfo(entity, 0, 0, 0);
|
||||
entity->interactType = 0;
|
||||
gActiveScriptInfo.flags |= 1;
|
||||
} else {
|
||||
@@ -1234,17 +1236,17 @@ void ScriptCommand_SetAnimationState(Entity* entity, ScriptExecutionContext* con
|
||||
}
|
||||
|
||||
void ScriptCommand_0807EB4C(Entity* entity, ScriptExecutionContext* context) {
|
||||
entity->animationState =
|
||||
sub_0806F5B0(sub_080045B4(entity, context->scriptInstructionPointer[1] + gRoomControls.origin_x,
|
||||
context->scriptInstructionPointer[2] + gRoomControls.origin_y));
|
||||
entity->animationState = GetAnimationStateForDirection8(
|
||||
sub_080045B4(entity, context->scriptInstructionPointer[1] + gRoomControls.origin_x,
|
||||
context->scriptInstructionPointer[2] + gRoomControls.origin_y));
|
||||
}
|
||||
|
||||
void ScriptCommand_FacePlayer(Entity* entity, ScriptExecutionContext* context) {
|
||||
entity->animationState = sub_0806F5B0(GetFacingDirection(entity, &gPlayerEntity));
|
||||
entity->animationState = GetAnimationStateForDirection8(GetFacingDirection(entity, &gPlayerEntity));
|
||||
}
|
||||
|
||||
void ScriptCommand_FaceAwayFromPlayer(Entity* entity, ScriptExecutionContext* context) {
|
||||
gPlayerEntity.animationState = sub_0806F5B0(GetFacingDirection(&gPlayerEntity, entity)) & ~1;
|
||||
gPlayerEntity.animationState = GetAnimationStateForDirection8(GetFacingDirection(&gPlayerEntity, entity)) & ~1;
|
||||
}
|
||||
|
||||
void ScriptCommand_SetEntityDirection(Entity* entity, ScriptExecutionContext* context) {
|
||||
@@ -1352,9 +1354,9 @@ void ScriptCommand_0807ED24(Entity* entity, ScriptExecutionContext* context) {
|
||||
tmp = context->scriptInstructionPointer[2];
|
||||
tmp3 = entity->y.HALF.HI - gRoomControls.origin_y;
|
||||
context->y.WORD = ((tmp - tmp3) << 0x10) / context->unk_12;
|
||||
entity->animationState =
|
||||
sub_0806F5B0(sub_080045B4(entity, context->scriptInstructionPointer[1] + gRoomControls.origin_x,
|
||||
context->scriptInstructionPointer[2] + gRoomControls.origin_y));
|
||||
entity->animationState = GetAnimationStateForDirection8(
|
||||
sub_080045B4(entity, context->scriptInstructionPointer[1] + gRoomControls.origin_x,
|
||||
context->scriptInstructionPointer[2] + gRoomControls.origin_y));
|
||||
context->postScriptActions |= 2;
|
||||
} else {
|
||||
if (!--context->unk_12) {
|
||||
@@ -1817,14 +1819,14 @@ void WaitForCameraTouchRoomBorder(Entity* entity, ScriptExecutionContext* contex
|
||||
}
|
||||
|
||||
void sub_0807F634(Entity* entity, ScriptExecutionContext* context) {
|
||||
u16* p = (u16*)context->intVariable;
|
||||
sub_0801DFB4(entity, p[0], p[1], p[2]);
|
||||
u16* textIndices = (u16*)context->intVariable;
|
||||
InitializeFuseInfo(entity, textIndices[0], textIndices[1], textIndices[2]);
|
||||
gPlayerState.controlMode = CONTROL_DISABLED;
|
||||
}
|
||||
|
||||
void sub_0807F650(Entity* entity, ScriptExecutionContext* context) {
|
||||
u32 p = GetFuserId(entity);
|
||||
sub_0801DFB4(entity, gUnk_08001A7C[p][0], gUnk_08001A7C[p][1], gUnk_08001A7C[p][2]);
|
||||
u32 fuserId = GetFuserId(entity);
|
||||
InitializeFuseInfo(entity, gUnk_08001A7C[fuserId][0], gUnk_08001A7C[fuserId][1], gUnk_08001A7C[fuserId][2]);
|
||||
gPlayerState.controlMode = CONTROL_DISABLED;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user