mirror of
https://github.com/zeldaret/tmc
synced 2026-09-06 19:10:56 -04:00
@@ -0,0 +1,163 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "functions.h"
|
||||
#include "textbox.h"
|
||||
#include "link.h"
|
||||
#include "room.h"
|
||||
|
||||
typedef struct {
|
||||
u32 unk_00;
|
||||
s8 unk_04;
|
||||
} gUnk_0810C89C_struct;
|
||||
|
||||
extern void sub_08078850(Entity*, u32, s8, gUnk_0810C89C_struct*);
|
||||
|
||||
extern u8 gUnk_0810C88C[];
|
||||
extern BoundingBox gUnk_0810C894;
|
||||
extern gUnk_0810C89C_struct gUnk_0810C89C[];
|
||||
extern SpriteLoadData gUnk_0810C8D4;
|
||||
extern void (*gUnk_0810C8E0[])(Entity*);
|
||||
extern u8 gUnk_0810C8F0[];
|
||||
|
||||
void sub_080632C8(Entity* this);
|
||||
void sub_08063410(Entity* this);
|
||||
s32 sub_080633C8(Entity* this);
|
||||
void sub_0806346C(Entity* this);
|
||||
|
||||
void Beedle(Entity* this) {
|
||||
if (this->flags & 0x2) {
|
||||
sub_08063410(this);
|
||||
} else {
|
||||
sub_080632C8(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080632C8(Entity* this) {
|
||||
gUnk_0810C8E0[this->action](this);
|
||||
}
|
||||
|
||||
void sub_080632E0(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_0810C8D4) != 0) {
|
||||
InitializeAnimation(this, 0);
|
||||
sub_08078778(this);
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->action = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063314(Entity* this) {
|
||||
u32 offset;
|
||||
|
||||
if (((++this->field_0xf & 0xF) == 0) && (offset = sub_080633C8(this), this->animIndex != offset)) {
|
||||
InitializeAnimation(this, offset);
|
||||
}
|
||||
if (this->interactType != '\0') {
|
||||
TextboxNoOverlapFollow(this->actionDelay + 0xA01);
|
||||
this->action++;
|
||||
}
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
void sub_0806336C(Entity* this) {
|
||||
if ((gTextBox.doTextBox & 0x7F) == 0) {
|
||||
this->action++;
|
||||
InitializeAnimation(this, 8);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08063390(Entity* this) {
|
||||
GetNextFrame(this);
|
||||
if (this->frames.b.f3 != 0) {
|
||||
this->action = 1;
|
||||
InitializeAnimation(this, GetAnimationState(this));
|
||||
sub_08078778(this);
|
||||
}
|
||||
sub_0806ED78(this);
|
||||
}
|
||||
|
||||
s32 sub_080633C8(Entity* this) {
|
||||
s32 uVar1;
|
||||
|
||||
uVar1 = sub_0806ED9C(this, 0x20, 0x20);
|
||||
if (uVar1 < 0) {
|
||||
uVar1 = this->animIndex;
|
||||
}
|
||||
return uVar1;
|
||||
}
|
||||
|
||||
void Beedle_Head(Entity* this) {
|
||||
SetExtraSpriteFrame(this, 0, this->frames.all & 0x3F);
|
||||
SetExtraSpriteFrame(this, 1, this->frameIndex);
|
||||
SetSpriteSubEntryOffsetData1(this, 1, 0);
|
||||
sub_0807000C(this);
|
||||
}
|
||||
|
||||
void sub_08063410(Entity* this) {
|
||||
if (this->action == 0) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_0810C8D4) == 0) {
|
||||
return;
|
||||
}
|
||||
this->action++;
|
||||
if (this->entityType.form != 0) {
|
||||
this->boundingBox = &gUnk_0810C894;
|
||||
this->entityType.parameter = 0;
|
||||
}
|
||||
sub_0807DD64(this);
|
||||
sub_08078778(this);
|
||||
}
|
||||
if (this->entityType.form != 0) {
|
||||
sub_0806346C(this);
|
||||
}
|
||||
sub_0807DDAC(this, 0);
|
||||
sub_0807DDE4(this);
|
||||
GetNextFrame(this);
|
||||
}
|
||||
|
||||
void sub_0806346C(Entity* this) {
|
||||
u8 bVar1;
|
||||
s32 iVar2;
|
||||
s32 iVar3;
|
||||
|
||||
iVar3 = (gLinkEntity.x.HALF.HI - this->x.HALF.HI);
|
||||
iVar2 = (gLinkEntity.y.HALF.HI - this->y.HALF.HI);
|
||||
|
||||
iVar3 += 0x30;
|
||||
iVar2 += 0x18;
|
||||
if (iVar3 < 0) {
|
||||
iVar3 = 0;
|
||||
}
|
||||
if (iVar3 > 0x50) {
|
||||
iVar3 = 0x50;
|
||||
}
|
||||
if (iVar2 < 0) {
|
||||
iVar2 = 0;
|
||||
}
|
||||
if (iVar2 > 0x40) {
|
||||
iVar2 = 0x40;
|
||||
}
|
||||
|
||||
iVar3 >>= 4;
|
||||
iVar2 >>= 4;
|
||||
|
||||
bVar1 = gUnk_0810C8F0[(gLinkEntity.animationState >> 1) + iVar3 * 4 + iVar2 * 0x18];
|
||||
if (bVar1 != this->entityType.parameter) {
|
||||
gUnk_0810C89C_struct* temp = &gUnk_0810C89C[bVar1];
|
||||
sub_08078850(this, 1, temp->unk_04, temp);
|
||||
this->entityType.parameter = bVar1;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080634E4(Entity* this, u32* param_1) {
|
||||
param_1[1] = this->entityType.parameter;
|
||||
}
|
||||
|
||||
void sub_080634EC(Entity* this) {
|
||||
gRoomVars.itemForSaleIndex = gUnk_0810C88C[this->entityType.parameter];
|
||||
}
|
||||
|
||||
void sub_08063504(Entity* this, u32* param_2) {
|
||||
u32 uVar1;
|
||||
|
||||
uVar1 = sub_080544DC(gUnk_0810C88C[this->entityType.parameter]);
|
||||
param_2[5] = (-uVar1 | uVar1) >> 0x1F;
|
||||
}
|
||||
Reference in New Issue
Block a user