mirror of
https://github.com/zeldaret/tmc
synced 2026-06-08 12:27:21 -04:00
82 lines
2.1 KiB
C
82 lines
2.1 KiB
C
#include "entity.h"
|
|
#include "script.h"
|
|
#include "functions.h"
|
|
#include "npc.h"
|
|
|
|
extern Dialog gUnk_08113158[];
|
|
|
|
extern SpriteLoadData gUnk_08113140[];
|
|
void sub_0806BC58(Entity* this);
|
|
|
|
void Farmers(Entity* this) {
|
|
if (this->action == 0) {
|
|
if (LoadExtraSpriteData(this, &gUnk_08113140[this->type * 3]) == 0) {
|
|
return;
|
|
}
|
|
this->action++;
|
|
this->spriteSettings.flipX = this->actionDelay;
|
|
if (this->spriteSettings.flipX == 0) {
|
|
this->animationState = 6;
|
|
} else {
|
|
this->animationState = 2;
|
|
}
|
|
this->actionDelay = this->animationState;
|
|
sub_0806BC58(this);
|
|
sub_0807DD64(this);
|
|
}
|
|
ExecuteScriptForEntity(this, 0);
|
|
HandleEntity0x82Actions(this);
|
|
GetNextFrame(this);
|
|
}
|
|
|
|
void sub_0806BC58(Entity* this) {
|
|
SetDefaultPriority(this, PRIO_MESSAGE);
|
|
}
|
|
|
|
void Farmers_Head(Entity* this) {
|
|
SetExtraSpriteFrame(this, 0, this->frame & 0x7f);
|
|
SetExtraSpriteFrame(this, 1, this->frameIndex);
|
|
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
|
sub_0807000C(this);
|
|
}
|
|
|
|
void sub_0806BC94(Entity* this, ScriptExecutionContext* context) {
|
|
u32 offset = 0;
|
|
if (this->spriteSettings.flipX) {
|
|
offset = 8;
|
|
}
|
|
InitializeAnimation(this, context->intVariable + offset + (this->animationState >> 1));
|
|
}
|
|
|
|
void sub_0806BCB8(Entity* this) {
|
|
this->animationState = this->actionDelay;
|
|
}
|
|
|
|
void sub_0806BCC0(Entity* this) {
|
|
if (this->type == 0) {
|
|
sub_0806F188(this);
|
|
}
|
|
}
|
|
|
|
void sub_0806BCD4(Entity* this) {
|
|
sub_08078784(this, sub_0801E99C(this));
|
|
}
|
|
|
|
void sub_0806BCE8(Entity* this) {
|
|
ShowNPCDialogue(this, &gUnk_08113158[this->type]);
|
|
}
|
|
|
|
void Farmers_Fusion(Entity* this) {
|
|
if (this->action == 0) {
|
|
if (LoadExtraSpriteData(this, &gUnk_08113140[this->type * 3]) != 0) {
|
|
this->action = this->action + 1;
|
|
this->spriteSettings.draw = 1;
|
|
this->spriteSettings.flipX = 0;
|
|
sub_0806BC58(this);
|
|
InitAnimationForceUpdate(this, 3);
|
|
}
|
|
} else {
|
|
UpdateAnimationSingleFrame(this);
|
|
}
|
|
}
|