Files
tmc/src/npc/epona.c
T
2021-12-28 13:53:53 -08:00

101 lines
2.5 KiB
C

#include "global.h"
#include "sound.h"
#include "entity.h"
#include "message.h"
#include "npc.h"
#include "functions.h"
void sub_08065A64(Entity* this);
void sub_08065AA4(Entity*);
extern void (*gUnk_0811006C[])(Entity*);
extern Dialog gUnk_08110080[];
void Epona(Entity* this) {
gUnk_0811006C[this->action](this);
sub_08065A64(this);
sub_0806ED78(this);
}
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 = sub_0801E99C(this);
InitAnimationForceUpdate(this, this->animationState / 2);
}
void sub_080659F0(Entity* this) {
UpdateAnimationSingleFrame(this);
sub_08065AA4(this);
}
void sub_08065A00(Entity* this) {
UpdateAnimationSingleFrame(this);
sub_08065AA4(this);
}
void sub_08065A10(Entity* this) {
if ((gMessage.doTextBox & 0x7F) == 0) {
this->action = 1;
InitAnimationForceUpdate(this, this->animationState / 2);
}
}
void sub_08065A34(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
InitAnimationForceUpdate(this, this->animationState / 2);
}
}
void sub_08065A50(Entity* this) {
ShowNPCDialogue(this, &gUnk_08110080[this->type]);
}
void sub_08065A64(Entity* this) {
u32 uVar2;
uVar2 = -(gPlayerState.flags & PL_MINISH) >> 0x1f;
if (uVar2 != this->field_0x68.HALF.HI) {
if (uVar2 == 0) {
sub_08078778(this);
} else {
sub_080787A8(this, this->field_0x68.HALF.LO);
}
}
this->field_0x68.HALF.HI = uVar2;
}
void sub_08065AA4(Entity* this) {
if (this->interactType != 0) {
if (gPlayerState.flags & PL_MINISH) {
if (this->interactType == 2) {
this->action = 4;
sub_0806F118(this);
} else {
this->action = 3;
SetDefaultPriority(this, PRIO_MESSAGE);
sub_08065A50(this);
}
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
} else {
sub_08065A50(this);
ResetPlayerAnimationAndAction();
}
SoundReq(SFX_VO_EPONA);
this->interactType = 0;
}
}
void Epona_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.draw = 1;
InitAnimationForceUpdate(this, 7);
} else {
UpdateAnimationSingleFrame(this);
}
}