add subdirs

This commit is contained in:
theo3
2020-07-13 15:27:20 -07:00
parent c47f16e5e7
commit 62ddaaa5f6
77 changed files with 138 additions and 186 deletions
+81
View File
@@ -0,0 +1,81 @@
#include "global.h"
#include "entity.h"
#include "link.h"
extern void (*gUnk_081140D4[])(Entity*);
extern u16 gUnk_081140CC[];
extern u32 gUnk_030010A0;
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0806D0B0(Entity*);
extern void sub_0807DD64(Entity*);
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern u32 Random(void);
extern void PlaySFX(u32);
extern void sub_0806D02C(Entity*);
extern Entity* sub_0805EB2C(u32, u32, u32, u32, u32);
void BigGoron(Entity* this) {
gUnk_081140D4[this->entityType.form](this);
}
#ifdef NON_MATCHING
void sub_0806CF30(Entity* this) {
u8 bVar1;
u32 uVar2;
int iVar3;
if (this->action == 0) {
this->action = 1;
this->previousActionFlag = 1;
this->field_0x68 = (this->x).HALF.HI;
sub_0805E3A0(this, 2);
sub_0806D0B0(this);
sub_0807DD64(this);
} else {
sub_0807DDAC(this, 0);
sub_0807DDE4(this);
}
if (this->previousActionFlag != 2) {
if (this->previousActionFlag < 3) {
if ((gUnk_030010A0 & 3) == 0) {
iVar3 = this->x.HALF.HI;
if (gLinkEntity.x.HALF.HI < iVar3) {
if ((this->field_0x68 - 32) < iVar3) {
this->x.HALF.HI = -1;
}
}
if (this->x.HALF.HI > gLinkEntity.x.HALF.HI) {
if (this->x.HALF.HI < (this->field_0x68 + 32)) {
this->x.HALF.HI += 1;
}
}
}
}
} else {
bVar1 = this->actionDelay -= 1;
if (bVar1 == 0) {
uVar2 = Random();
PlaySFX(gUnk_081140CC[uVar2 & 3]);
this->actionDelay = ((u8)uVar2 & 7) * 10 + 128;
}
}
sub_0806D02C(this);
}
#else
NAKED
void sub_0806CF30(Entity* this) {
asm(".include \"asm/non_matching/bigGoron/sub_0806CF30.inc\"");
}
#endif
void sub_0806D00C(Entity* this) {
Entity* pEVar1;
pEVar1 = sub_0805EB2C(7, 76, 7, 0, 0);
if (pEVar1 != NULL) {
this->parent = pEVar1;
}
}
+413
View File
@@ -0,0 +1,413 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "flags.h"
#include "link.h"
#include "room.h"
#include "textbox.h"
typedef struct {
/*0x00*/ u8 filler[0x2C];
/*0x2C*/ u8 unk;
} struct_030010A0;
typedef struct {
u8 filler[0xa8];
Stats stats;
} struct_02002A40;
extern void (*gUnk_081115C0[])(Entity*);
extern void (*gUnk_081115D0[])(Entity*);
extern struct_030010A0 gUnk_030010A0;
extern u16 gUnk_081115DC[];
extern u8 gUnk_08111618[];
extern u32* gUnk_081115EC[];
extern struct_02002A40 gUnk_02002A40;
extern u8 gUnk_08111623[];
extern u8 gUnk_0811162B[];
extern u16 gUnk_08111664[];
extern u16 gUnk_0811167A[];
extern u16 gUnk_08111690[];
extern u16 gUnk_081116A6[];
extern u16 gUnk_081116BC[];
extern u16 gUnk_081116D2[];
extern u16 gUnk_081116E8[];
extern u16 gUnk_081116FE[];
extern u16 gUnk_08111714[];
extern u32 gUnk_08111740[];
extern u16 gUnk_0811172A[];
extern u32 gUnk_0300402B;
extern EntityData gUnk_080F3494;
void BladeBrothers(Entity* this) {
if ((this->flags & 2) != 0) {
gUnk_081115D0[this->action](this);
} else {
gUnk_081115C0[this->action](this);
sub_0806ED78(this);
}
if ((this->frames.all & 1) != 0) {
this->frames.all &= 0xfe;
sub_08068BEC(this, 0);
}
}
void sub_08068A1C(Entity* this) {
u8 bVar1;
int offset;
(this->entityType).parameter = (this->entityType).form;
if (gUnk_030010A0.unk != 0) {
offset = 6;
bVar1 = 3;
} else {
sub_08078778(this);
offset = 2;
bVar1 = 1;
}
this->action = bVar1;
InitializeAnimation(this, offset);
}
void sub_08068A4C(Entity* this) {
s32 uVar1;
s32 iVar2;
uVar1 = sub_0806ED9C(this, 0x28, 0x28);
if (uVar1 < 0) {
uVar1 = 2;
} else {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
} else {
this->field_0xf--;
uVar1 = (u32)this->animIndex;
}
}
iVar2 = sub_0806F078(this, uVar1);
if (iVar2 == 0) {
GetNextFrame(this);
}
if (this->interactType != 0) {
this->interactType = 0;
this->action = 2;
TextboxNoOverlapFollow(0);
}
}
void sub_08068AA4(Entity* this) {
u8 bVar1;
this->action = 1;
if (this->entityType.form != 0) {
this->entityType.parameter++;
this->entityType.parameter &= 7;
if (this->entityType.parameter == 0) {
this->entityType.parameter += 1;
}
sub_0801D2B4(this, gUnk_081115DC[this->entityType.parameter]);
}
}
void sub_08068ADC(Entity* this) {
if (gUnk_030010A0.unk == 2) {
GetNextFrame(this);
}
sub_0806FD3C(this);
}
void sub_08068AFC(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
*(u8*)&this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, *(u8*)&this->field_0x68);
sub_0807DD50(this);
}
void FUN_08068b2c(Entity* this) {
u32 uVar1;
if (this->interactType == '\x02') {
this->action = 2;
this->interactType = '\0';
uVar1 = sub_0806F5A4(GetFacingDirection(this, &gLinkEntity));
InitAnimationForceUpdate(this, uVar1);
sub_0806F118(this);
} else {
sub_0807DD94(this, 0);
}
}
void sub_08068B70(Entity* this) {
if (UpdateFuseInteraction()) {
this->action = 1;
}
}
void sub_08068B84(Entity* this) {
u8 p;
if (gUnk_08111618) {}
if (p = this->actionDelay, gUnk_08111618[p]) {
ForceEquipItem(gUnk_08111618[this->actionDelay], 0);
}
sub_0805ED14(gUnk_081115EC[this->actionDelay]);
}
void sub_08068BB4(Entity* this) {
u32 item = gUnk_02002A40.stats.itemOnA;
this->field_0x69 = item;
item = gUnk_02002A40.stats.itemOnB;
*(&this->field_0x69 + 1) = item;
}
void sub_08068BD0(Entity* this) {
ForceEquipItem(this->field_0x69, 0);
ForceEquipItem(*(u8*)(&this->field_0x69 + 1), 1);
}
void sub_08068BEC(Entity* this, u32 unused) {
Entity* target;
target = CreateFx(this, 0x44, 0);
if (target) {
target->spritePriority.b0 = 1;
PositionRelative(this, target, 0, -0x100000);
PlaySFX(0xfa);
}
}
void sub_08068C28(Entity* this) {
u8 bVar1;
u32 uVar2;
this->actionDelay = gUnk_08111623[(this->entityType).form];
if ((this->entityType).form == 1) {
if (GetInventoryValue(0x48)) { // spin attack
if (!GetInventoryValue(0x4b)) { // rock breaker
this->actionDelay = 1;
} else {
if (!GetInventoryValue(0x4a)) { // dash attack
this->actionDelay = 2;
} else {
this->actionDelay = 3;
}
}
}
}
}
void sub_08068C6C(Entity* this) {
sub_080A7C18(gUnk_0811162B[this->actionDelay] & 0xffffff7f, 0, 0);
}
void sub_08068C8C(Entity* param_1, Entity* param_2) {
u8* arr = gUnk_0811162B + 0xd;
*(u32*)&param_2->animationState = *(u32*)(arr + param_1->actionDelay * 4);
}
void sub_08068CA0(Entity* param_1, Entity* param_2) {
u8 bVar1;
u32 uVar2;
bVar1 = (param_1->entityType).form;
if (bVar1 == 1) {
*(u32*)&param_2->animationState = bVar1;
uVar2 = GetInventoryValue(0x48); // spin attack
if (uVar2 == 0) {
*(u32*)&param_2->animationState = 0;
}
uVar2 = GetInventoryValue(0x4b); // rock breaker
if (uVar2 == 0) {
*(u32*)&param_2->animationState = 0;
}
uVar2 = GetInventoryValue(0x4a); // dash attack
if (uVar2 == 0) {
*(u32*)&param_2->animationState = 0;
}
uVar2 = GetInventoryValue(0x4e); // down thrust
if (uVar2 != 0) {
return;
}
} else {
uVar2 = GetInventoryValue(gUnk_0811162B[param_1->actionDelay] & -0x81);
if (uVar2 != 0) {
uVar2 = 1;
}
}
*(u32*)&param_2->animationState = uVar2;
}
void sub_08068CFC(Entity* param_1, Entity* param_2, u32 param_3, u32 param_4)
{
u8 bVar1;
u8 itemID;
u32 uVar2;
*(u32*)&param_2->animationState = 0;
bVar1 = param_1->actionDelay;
if (bVar1 > 10)
return;
switch (bVar1) {
case 0:
default:
goto switchD_08068d12_caseD_0;
case 1:
itemID = 0x2;
break;
case 2:
itemID = 0x15;
break;
case 3:
itemID = 0x14;
break;
case 5:
uVar2 = CheckLocalFlag(3);
goto LABEL1;
break;
case 6:
if (gUnk_02002A40.stats.maxHealth < 0x50)
return;
goto switchD_08068d12_caseD_0;
case 7:
uVar2 = GetInventoryValue(0x48); // spin attack
if (uVar2 == 0) {
return;
}
uVar2 = GetInventoryValue(0x49); // roll attack
if (uVar2 == 0) {
return;
}
uVar2 = GetInventoryValue(0x4a); // dash attack
if (uVar2 == 0) {
return;
}
uVar2 = GetInventoryValue(0x4b); // rock breaker
if (uVar2 == 0) {
return;
}
uVar2 = GetInventoryValue(0x4c); // sword beam
if (uVar2 == 0) {
return;
}
uVar2 = GetInventoryValue(0x4e); // down thrust
if (uVar2 == 0) {
return;
}
itemID = 0x4f; // peril beam
break;
case 10:
itemID = 0x4d; // great spin
}
uVar2 = GetInventoryValue(itemID);
LABEL1:
if (uVar2 == 0) {
return;
}
switchD_08068d12_caseD_0:
*(u32*)&param_2->animationState = 1;
}
//Introduction dialoague
void sub_08068DB8(Entity* this) {
TextboxNoOverlap(gUnk_08111664[this->actionDelay], this);
}
//Ask to teach dialoague
void sub_08068DD0(Entity* this) {
TextboxNoOverlap(gUnk_0811167A[this->actionDelay], this);
}
//Technique Dialogue
void sub_08068DE8(Entity* this) {
TextboxNoOverlap(gUnk_08111690[this->actionDelay], this);
}
//Posession dialogue
void sub_08068E00(Entity* this) {
TextboxNoOverlap(gUnk_081116A6[this->actionDelay], this);
}
void sub_08068E18(Entity* this) {
TextboxNoOverlap(gUnk_081116BC[this->actionDelay], this);
}
void sub_08068E30(Entity* this) {
TextboxNoOverlap(gUnk_081116D2[this->actionDelay], this);
}
void sub_08068E48(Entity* this) {
TextboxNoOverlap(gUnk_081116E8[this->actionDelay], this);
}
void sub_08068E60(Entity* this) {
TextboxNoOverlap(gUnk_081116FE[this->actionDelay], this);
}
void sub_08068E78(Entity* this) {
TextboxNoOverlap(gUnk_08111714[this->actionDelay], this);
}
void sub_08068E90(Entity* this) {
LinkState* s = &gLinkState;
*(u16*)&s->unk8 = (1 << (gUnk_08111740[this->actionDelay] - 1)) | *(u16*)&s->unk8;
}
void sub_08068EB4(void) {
gLinkState.unk71 = 0;
}
void sub_08068EC4(Entity* param_1, Entity* param_2) {
if (gUnk_08111740[param_1->actionDelay] == gLinkState.unk71) {
*(u16*)&param_2->flags = gUnk_0811172A[param_1->actionDelay];
*(u32*)&param_2->animationState = 1;
} else {
*(u32*)&param_2->animationState = 0;
}
}
void sub_08068F00(Entity* this) {
if (this->actionDelay == 1) {
LoadRoomEntityList(&gUnk_080F3494);
}
}
void sub_08068F14(Entity* this) {
if (this->actionDelay == 5) {
ModHealth(160);
}
if (this->actionDelay == 6) {
ModHealth(-160);
ModHealth(2);
}
}
void sub_08068F3C(Entity* this) {
if (this->actionDelay == 6) {
ModHealth(160);
}
}
void BladeBrothers_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 0;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 4);
} else {
UpdateAnimationSingleFrame(this);
}
if ((this->frames.all & 1) != 0) {
this->frames.all &= 0xfe;
sub_08068BEC(this, 0);
}
}
+74
View File
@@ -0,0 +1,74 @@
#include "global.h"
#include "entity.h"
#include "sprite.h"
#include "link.h"
extern void DeleteThisEntity();
extern u32 LoadExtraSpriteData(Entity*, SpriteLoadData*);
extern SpriteLoadData gUnk_08110CA8[];
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD64(Entity*);
extern u32 GetFacingDirection(Entity*, Entity*);
extern void sub_0806F118(Entity*);
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern u32 UpdateFuseInteraction(Entity*);
extern void SetSpriteSubEntryOffsetData2(Entity*, u32, u32);
extern void sub_0807000C(Entity*);
extern u32 sub_0806F5A4();
void Carpenter(Entity* this) {
if (*(u32*)&this->cutsceneBeh == 0) {
DeleteThisEntity();
}
switch (this->action) {
case 0:
if (!LoadExtraSpriteData(this, gUnk_08110CA8 + this->entityType.form * 4))
break;
this->action = 1;
this->field_0x69 = 0;
sub_0805E3A0(this, 2);
sub_0807DD64(this);
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
this->field_0x69 = this->animIndex;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)) + 4 + (this->entityType.form * 8));
sub_0806F118(this);
} else {
sub_0807DDAC(this, 0);
sub_0807DDE4(this);
GetNextFrame(this);
}
break;
case 2:
if (!UpdateFuseInteraction(this))
break;
this->action = 1;
InitializeAnimation(this, this->field_0x69);
break;
}
}
void Carpenter_Head(Entity* this) {
if ((this->entityType).form < 2) {
SetExtraSpriteFrame(this, 0, this->frames.all & 0xffffff7f);
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetExtraSpriteFrame(this, 2, this->frameSpriteSettings & 0x3f);
SetSpriteSubEntryOffsetData1(this, 1, 0);
SetSpriteSubEntryOffsetData2(this, 1, 2);
sub_0807000C(this);
} else {
SetExtraSpriteFrame(this, 0, this->frames.all & 0xffffff7f);
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
}
void sub_080672b0(Entity *this, u32 param_2)
{
InitializeAnimation(this,*(u32 *)(param_2 + 4) + (this->animationState >> 1) + this->entityType.form * 8);
}
+16
View File
@@ -0,0 +1,16 @@
#include "global.h"
#include "entity.h"
extern void sub_0806ED78();
extern void sub_08067C44();
extern void (*gCat[9])(Entity*);
// Main
void Cat(Entity* ent) {
gCat[ent->action](ent);
sub_08067C44(ent);
if (((ent->flags & 128) == 0) && ((ent->entityType).form != 5)) {
sub_0806ED78(ent);
}
}
+8
View File
@@ -0,0 +1,8 @@
#include "global.h"
#include "entity.h"
extern void (*gUnk_0811423C[])(Entity*);
void ClothesRack(Entity* this) {
gUnk_0811423C[this->action](this);
}
+237
View File
@@ -0,0 +1,237 @@
#include "global.h"
#include "entity.h"
#include "link.h"
extern void sub_0806ED78(Entity*);
extern void sub_0806920C(Entity*);
extern u32 sub_0805ACC0(Entity*);
extern u32 sub_0801E99C(Entity*);
extern void sub_0806924C(Entity*);
extern void sub_080AEF88(Entity*);
extern void ShowNPCDialogue(Entity*, u32*);
extern void sub_08078778(Entity*);
extern void sub_080787A8(Entity*, u32);
extern void sub_0806F118(Entity*);
extern void sub_080791D0();
extern void (*gUnk_08111914[])(Entity*);
extern void (*gUnk_08111928[])(Entity*);
extern u32 gUnk_08111938[];
extern void PlaySFX(u32);
extern u32 Random();
extern u32 UpdateFuseInteraction(Entity*);
extern LinkState gLinkState;
void Cow(Entity* ent) {
gUnk_08111914[ent->action](ent);
sub_0806ED78(ent);
sub_0806920C(ent);
}
void sub_08068FC0(Entity* ent) {
u32 r2;
ent->action = 1;
ent->animationState = ent->entityType.parameter;
ent->nonPlanarMovement = 0x40;
ent->field_0x6d = 0xFF;
r2 = sub_0805ACC0(ent);
if (r2 == 0) {
u16 x, y;
x = ent->x.HALF.HI;
*(u16*)&ent->field_0x68 = x;
y = ent->y.HALF.HI;
ent->field_0x6a.HWORD = y;
} else {
u32 var1 = r2 >> 16;
// 0x68+0x69 probably a SplitWord
*(u16*)&ent->field_0x68 = var1;
ent->field_0x6a.HWORD = r2;
}
ent->field_0x6c = sub_0801E99C(ent);
InitAnimationForceUpdate(ent, ent->animationState + 4);
}
void sub_08069018(Entity* ent) {
s32 var0;
if (ent->previousActionFlag == 0) {
ent->previousActionFlag++;
ent->field_0xf = (Random() & 0x3F) + 0x3C;
InitAnimationForceUpdate(ent, ent->animationState);
}
UpdateAnimationSingleFrame(ent);
var0 = --ent->field_0xf;
if (var0 == 0) {
if (ent->actionDelay == 0) {
ent->action = 2;
} else {
ent->action = 3;
}
ent->previousActionFlag = var0;
}
sub_0806924C(ent);
}
void sub_08069068(Entity* ent) {
s32 var0;
if (ent->previousActionFlag == 0) {
u32 anim;
ent->previousActionFlag++;
anim = (Random() & 2) - 1;
anim = (anim + ent->animationState) & 3;
ent->animationState = anim;
ent->direction = anim <<= 3;
ent->field_0xf = (Random() & 0x3F) + 0x3C;
InitAnimationForceUpdate(ent, ent->animationState + 4);
}
sub_080AEF88(ent);
UpdateAnimationSingleFrame(ent);
{
s32 x = ent->x.HALF.HI;
s16* x2 = (s16*)&ent->field_0x68;
x -= *x2;
if (x > 16) {
ent->x.HALF.HI = *x2 + 16;
ent->field_0xf = 1;
}
if (x < -16) {
ent->x.HALF.HI = *x2 - 16;
ent->field_0xf = 1;
}
}
{
s32 y = ent->y.HALF.HI;
s16* y2 = &ent->field_0x6a.HWORD;
y -= *y2;
if (y > 16) {
ent->y.HALF.HI = *y2 + 16;
ent->field_0xf = 1;
}
if (y < -16) {
ent->y.HALF.HI = *y2 - 16;
ent->field_0xf = 1;
}
}
var0 = --ent->field_0xf;
if (var0 == 0) {
ent->action = 3;
ent->previousActionFlag = var0;
}
sub_0806924C(ent);
}
void sub_08069124(Entity* ent) {
UpdateAnimationSingleFrame(ent);
gUnk_08111928[ent->previousActionFlag](ent);
sub_0806924C(ent);
}
void sub_08069148(Entity* ent) {
u32 var0 = Random() & 3;
var0 += 3;
ent->field_0xf = var0;
ent->previousActionFlag = 1;
InitAnimationForceUpdate(ent, ent->animationState + 8);
}
void sub_08069168(Entity* ent) {
if ((s8)ent->frames.all < 0) {
ent->previousActionFlag = 2;
InitAnimationForceUpdate(ent, ent->animationState + 12);
}
}
void sub_08069188(Entity* ent) {
if (ent->frames.b.f0 == 0)
return;
ent->frames.all = 0;
if (((s8)--ent->field_0xf) != 0)
return;
ent->previousActionFlag = 3;
InitAnimationForceUpdate(ent, ent->animationState + 16);
}
void sub_080691BC(Entity* ent) {
if ((s8)ent->frames.all < 0) {
ent->action = 1;
ent->previousActionFlag = 0;
InitAnimationForceUpdate(ent, ent->animationState + 4);
}
}
void sub_080691E0(Entity* ent) {
if (UpdateFuseInteraction(ent) != 0) {
ent->action = 1;
ent->previousActionFlag = 0;
}
}
// Show dialogue
void sub_080691F8(Entity* ent) {
u32 var0 = ent->entityType.form;
u32* var1 = gUnk_08111938 + (var0 * 2);
ShowNPCDialogue(ent, var1);
}
void sub_0806920C(Entity* ent) {
// TODO: figure out what bitfield flag this is
u32 var0 = gLinkState.flags.all & 0x80;
u32 var1 = -var0 >> 0x1F;
if (var1 != ent->field_0x6d) {
if (var1 == 0) {
sub_08078778(ent);
} else {
sub_080787A8(ent, ent->field_0x6c);
}
}
ent->field_0x6d = var1;
}
// Check if player interacting
void sub_0806924C(Entity* ent) {
s8 itype = ent->interactType;
if (itype != 0) {
// TODO: figure out what bitfield flag this is
if ((gLinkState.flags.all & 0x80) != 0) {
if (itype == 2) {
ent->action = 4;
sub_0806F118(ent);
} else {
sub_080691F8(ent);
}
} else {
sub_080691F8(ent);
sub_080791D0();
}
PlaySFX(212);
ent->interactType = 0;
}
}
void Cow_Fusion(Entity* ent) {
if (ent->action == 0) {
ent->action++;
ent->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(ent, 15);
} else {
UpdateAnimationSingleFrame(ent);
}
}
+116
View File
@@ -0,0 +1,116 @@
#include "global.h"
#include "entity.h"
#include "link.h"
#include "room.h"
#include "flags.h"
#include "sprite.h"
#include "textbox.h"
#include "npc.h"
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_0806F118(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern u32 sub_0801E99C(void);
extern void sub_08078784(Entity*, u32);
extern u16 gUnk_08113344[];
extern u16 gUnk_0811334A[];
typedef struct {
u8 filler[18];
u32 unk;
} struct_0806BE84;
void Dampe(Entity* this) {
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_0805E3A0(this, 2);
sub_0807DD50(this);
return;
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)) + 4);
sub_0806F118(this);
} else {
sub_0807DD94(this, 0);
}
return;
case 2:
UpdateAnimationSingleFrame(this);
if (UpdateFuseInteraction(this)) {
this->action = 1;
}
default:
}
}
void sub_0806BE3C(Entity* this) {
this->field_0x68 = sub_0801E99C();
sub_08078784(this, this->field_0x68);
}
void Dampe_Fusion(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 2);
} else {
UpdateAnimationSingleFrame(this);
}
}
void sub_0806BE84(Entity* this, struct_0806BE84* r1) {
u32 msgIndex;
r1->unk = 0;
msgIndex = 1;
if (!CheckLocalFlag(0x69)) {
msgIndex = 0;
SetLocalFlag(0x69);
r1->unk = 1;
}
// Graveyard key
if (GetInventoryValue(0x3C) >= 2) {
msgIndex = 2;
}
TextboxNoOverlap(gUnk_08113344[msgIndex], this);
}
void sub_0806BEC8(Entity* this, struct_0806BE84* r1) {
u32 hasGraveyardKey;
u32 msgIndex;
msgIndex = 0;
r1->unk = 0;
hasGraveyardKey = GetInventoryValue(0x3C);
if (hasGraveyardKey == 1) {
msgIndex = 1;
r1->unk = 1;
} else if (hasGraveyardKey >= 2) {
msgIndex = 2;
}
TextboxNoOverlap(gUnk_0811334A[msgIndex], this);
}
void sub_0806BEFC() {
SetTileType(0x17E, 0x58E, 1);
SetTileType(0x17F, 0x58F, 1);
SetTileType(0x180, 0x5CE, 1);
SetTileType(0x181, 0x5CF, 1);
}
void sub_0806BF44(Entity* this, struct_0806BE84* r1) {
r1->unk = 0;
if (((this->x.HALF.HI - gRoomControls.roomScrollX) + 0x10U < 0x110) &&
((this->y.HALF.HI - gRoomControls.roomScrollY) + 0x18U < 0xD0)) {
r1->unk = 1;
}
}
+45
View File
@@ -0,0 +1,45 @@
#include "global.h"
#include "entity.h"
extern u32 gUnk_0813AD10;
extern u32 gUnk_0813AD24;
extern u32 gUnk_0813AD38;
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern void DoExitTransition(u32*);
void Emma(Entity* param_1)
{
if (param_1->action == 0) {
param_1->action += 1;
sub_0805E3A0(param_1, 2);
sub_0807DD50(param_1);
} else {
sub_0807DD94(param_1, 0);
}
return;
}
void sub_0806C578(void)
{
DoExitTransition(&gUnk_0813AD10);
return;
}
void sub_0806C588(void)
{
DoExitTransition(&gUnk_0813AD24);
return;
}
void FUN_0806c598(void)
{
DoExitTransition(&gUnk_0813AD38);
return;
}
+99
View File
@@ -0,0 +1,99 @@
#include "global.h"
#include "entity.h"
#include "textbox.h"
#include "link.h"
#include "functions.h"
void sub_08065A64(Entity* this);
void sub_08065AA4(Entity*);
extern void (*gUnk_0811006C[])(Entity*);
extern u32 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.b.draw = 1;
this->animationState = 6;
this->field_0x69 = -1;
this->field_0x68 = 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 ((gTextBox.doTextBox & 0x7F) == 0) {
this->action = 1;
InitAnimationForceUpdate(this, this->animationState / 2);
}
}
void sub_08065A34(Entity* this) {
if (UpdateFuseInteraction() != 0) {
this->action = 1;
InitAnimationForceUpdate(this, this->animationState / 2);
}
}
void sub_08065A50(Entity* this) {
ShowNPCDialogue(this, &gUnk_08110080[this->entityType.form * 2]);
}
void sub_08065A64(Entity* this) {
u32 uVar2;
uVar2 = -(gLinkState.flags.all & 0x80) >> 0x1f;
if (uVar2 != this->field_0x69) {
if (uVar2 == 0) {
sub_08078778(this);
} else {
sub_080787A8(this, this->field_0x68);
}
}
this->field_0x69 = uVar2;
}
void sub_08065AA4(Entity* this) {
if (this->interactType != 0) {
if (gLinkState.flags.all & 0x80) {
if (this->interactType == 2) {
this->action = 4;
sub_0806F118(this);
} else {
this->action = 3;
sub_0805E3A0(this, 2);
sub_08065A50(this);
}
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
} else {
sub_08065A50(this);
sub_080791D0();
}
PlaySFX(0xD3);
this->interactType = 0;
}
}
void Epona_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 7);
} else {
UpdateAnimationSingleFrame(this);
}
}
+91
View File
@@ -0,0 +1,91 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "link.h"
extern void sub_0805E3A0(Entity*, u32);
extern u32 sub_0801E99C(Entity*);
extern void sub_08078784(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern void sub_0806F118(Entity*);
extern void ExecuteScriptCommandSet(Entity*, void *);
extern void sub_0805FF2C(Entity*, void*);
extern void sub_0806ED78(Entity*);
extern void (*const gUnk_08109BBC[])(Entity*);
void Festari(Entity *this)
{
gUnk_08109BBC[this->action](this);
}
void sub_0805FE10(Entity *this)
{
this->action = 1;
this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2);
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
sub_0807DD50(this);
}
#if NON_MATCHING
void sub_0805FE48(Entity *this)
{
u8 bVar1;
u16 uVar2;
u32 uVar3;
u32 uVar4;
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
sub_0806F118(this);
}
else {
ExecuteScriptCommandSet(this, *(void **)&this->cutsceneBeh);
sub_0805FF2C(this, *(void **)&this->cutsceneBeh);
if (this->field_0x80 < 8) {
if ((this->field_0x82 & 1) != 0) {
uVar4 = (uVar4 & 0xfc) + (this->field_0xf >> 1);
}
else {
uVar4 = (uVar4 & 0xfc) + (this->animationState >> 1);
this->field_0xf = this->animationState;
}
}
if (uVar4 != this->animIndex) {
InitAnimationForceUpdate(this, uVar4);
}
UpdateAnimationSingleFrame(this);
if (this->frames.b.f3)
{
switch (this->animIndex) {
case 8:
case 10:
case 11:
case 12:
this->field_0x80 = 0;
}
}
if ((this->field_0x82 & (~this->field_0x82 + 1)) == 2) {
sub_0806ED78(this);
}
}
}
#else
NAKED
void sub_0805FE48(Entity *this) {
asm(".include \"asm/non_matching/festari/sub_0805FE48.inc\"");
}
#endif
void sub_0805FF18(Entity *this)
{
if (UpdateFuseInteraction(this)) {
this->action = 1;
}
}
+304
View File
@@ -0,0 +1,304 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "flags.h"
#include "textbox.h"
#include "link.h"
extern void sub_0805E3A0(Entity*, u32);
extern void StartCutscene(Entity*, void*);
extern void sub_0807DD50(Entity*);
extern void sub_0806F118(Entity*);
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern void sub_080600F0(Entity*);
extern u32 sub_0801E99C(Entity*);
extern void sub_08078784(Entity*, u32);
extern void sub_0807000C(Entity*);
extern void sub_080042BA(Entity*, u32);
extern void sub_08060158(Entity*);
extern u32 CheckKinstoneFused(u32);
extern Entity* sub_0805EB00(u32, u32, u32);
extern void sub_080A29BC(Entity* parent);
extern void DeleteEntity(Entity*);
extern u32 Random(void);
extern void ModBombs(s32);
extern SpriteLoadData gUnk_0810A348;
extern void* gUnk_08109D18[];
extern u8 gUnk_08109C98[];
extern u16 gUnk_0810A354[];
extern u32 gUnk_08109DC8[];
extern u16 gUnk_0810A35A[];
extern u16 gUnk_0810A362[];
void ForestMinish(Entity* this) {
switch (this->action) {
case 0:
if (LoadExtraSpriteData(this, &gUnk_0810A348)) {
this->action = 1;
this->spriteSettings.b.draw = TRUE;
this->field_0x69 = this->animationState = this->actionDelay << 1;
this->actionDelay = 0;
sub_0805E3A0(this, 2);
StartCutscene(this, gUnk_08109D18[this->entityType.parameter]);
sub_0807DD50(this);
}
break;
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
sub_0806F118(this);
} else {
sub_0807DDAC(this, 0);
sub_0807DDE4(this);
if (this->frameDuration != 0xf0) {
sub_080600F0(this);
}
}
break;
case 2:
if (UpdateFuseInteraction(this)) {
this->action = 1;
}
}
}
void sub_08060090(Entity* this) {
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
}
void ForestMinish_Head(Entity* this) {
u32 pbVar1;
pbVar1 = this->frames.all;
if (this->frames.all != 0xff) {
pbVar1 &= -0x81;
}
if ((this->frameSpriteSettings & 1) == 0) {
pbVar1 = 0xff;
}
SetExtraSpriteFrame(this, 0, pbVar1);
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
void sub_080600F0(Entity* this) {
u32 uVar1;
u32 uVar2;
uVar2 = this->field_0x80;
if (this->field_0x80 < 8) {
if ((this->field_0x82 & 1) != 0) {
uVar2 = (uVar2 & 0xfc) + (this->field_0xf >> 1);
} else {
uVar2 = (uVar2 & 0xfc) + (this->animationState >> 1);
this->field_0xf = this->animationState;
}
}
if (uVar2 != this->animIndex) {
InitAnimationForceUpdate(this, uVar2);
}
if ((this->field_0x82 & 4) != 0) {
uVar1 = 2;
} else {
uVar1 = 1;
}
sub_080042BA(this, uVar1);
}
void sub_0806014C(Entity* this) {
this->actionDelay = 0;
sub_08060158(this);
}
#if 0
void sub_08060158(Entity *this)
{
u8 bVar1;
u8 bVar2;
s32 iVar4;
u32 temp;
if (this->actionDelay != 0) {
this->actionDelay--;
}
else {
this->actionDelay = 2;
iVar4 = sub_0806EDD8(this, 0x20, 0x20);
if (iVar4 < 0) {
this->animationState = this->field_0x69;
iVar4 = this->field_0x69 << 2;
}
temp = (this->animationState >> 1) * 0x20 + (iVar4 >> 1) * 2;
bVar1 = gUnk_08109C98[temp];
bVar2 = gUnk_08109C98[temp + 1];
if ((bVar2 & 0x80) != 0) {
this->animationState = sub_0806F5B0(iVar4);
}
this->frames.all = bVar1;
this->frameIndex = bVar2 & 0x7f;
this->frameSpriteSettings = 1;
this->animIndex = 0;
this->frameDuration = 0xf0;
}
}
#endif
NAKED
void sub_08060158(Entity* this) {
asm(".include \"asm/non_matching/forestMinish/sub_08060158.inc\"");
}
void sub_080601D4(Entity* this) {
u32 temp;
u32 uVar2;
if (CheckGlobalFlag(4) == 0) {
uVar2 = 2;
} else {
temp = CheckKinstoneFused(0x17);
uVar2 = (-temp | temp) >> 0x1f;
}
TextboxNoOverlap(gUnk_0810A354[uVar2], this);
}
void sub_08060208(Entity *this)
{
ShowNPCDialogue(this, &gUnk_08109DC8[this->entityType.parameter * 0x8]);
}
void sub_0806021C(Entity *this)
{
u32 uVar1;
u32 uVar2;
//jabber nut
uVar1 = GetInventoryValue(0x5B);
uVar2 = (-uVar1 | uVar1) >> 0x1f;
//earth element
if (GetInventoryValue(0x40)) {
uVar2 = 2;
}
//mole mitts
if (GetInventoryValue(0x13)) {
uVar2 = 3;
}
ShowNPCDialogue(this, gUnk_08109DC8 + this->entityType.parameter * 0x8 + uVar2 * 2);
}
void sub_0806025C(Entity *this)
{
ShowNPCDialogue(this, &gUnk_08109DC8[this->entityType.parameter * 0x8]);
}
void sub_08060270(Entity *this)
{
u32 index;
//flippers
if (GetInventoryValue(0x46) == 0) {
index = 1;
if (CheckGlobalFlag(0x29) == 0) {
index = 0;
SetGlobalFlag(0x29);
}
}
else {
index = 3;
if (CheckLocalFlag(0x76) == 0) {
index = 2;
SetLocalFlag(0x76);
}
}
TextboxNoOverlap(gUnk_0810A35A[index], this);
}
void sub_080602BC(Entity *this)
{
u32 index;
//spin attack
if (GetInventoryValue(0x48) != 0) {
index = (Random() & 1) + 2;
}
else {
if (gUnk_02002A40.stats.bombCount < gBombBagSizes[gUnk_02002A40.stats.bombBagType]) {
index = 1;
}
else {
index = 0;
}
}
TextboxNoOverlap(gUnk_0810A362[index], this);
}
void sub_0806030C(Entity* this, u32 *arg1)
{
ModBombs(*(arg1 + 1));
}
void sub_08060318(void)
{
Entity *ent;
int i;
for (i = 2; i >= 0; i--) {
ent = sub_0805EB00(8, 2, 2);
if (ent != NULL) {
sub_080A29BC(ent);
DeleteEntity(ent);
}
}
}
void sub_08060340(void)
{
gUnk_02002A40.unk3 = gUnk_02002A40.unk2;
}
u32 sub_08060354(void)
{
u32 iVar1;
s32 iVar2;
iVar2 = gUnk_02002A40.unk2 - gUnk_02002A40.unk3;
if (CheckGlobalFlag(0x3b) == 0) {
if (4 < iVar2) {
return 0x8444;
}
}
else {
if (CheckGlobalFlag(0x3c) == 0) {
if (iVar2 > 9) {
return 0x8444;
}
}
else {
if (CheckGlobalFlag(0x3d) == 0) {
if (iVar2 > 14) {
return 0x8444;
}
}
}
}
return 0;
}
void ForestMinish_Fusion(Entity *this)
{
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_0810A348)) {
this->action++;
this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2);
InitializeAnimation(this, 6);
}
}
else {
GetNextFrame(this);
}
}
+53
View File
@@ -0,0 +1,53 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "link.h"
extern void sub_0805E3A0(Entity*, u32);
extern u32 sub_0801E99C(Entity*);
extern void sub_08078784(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_0806F118(Entity*);
extern void sub_0807DD94(Entity*, u32);
void Gentari(Entity *this)
{
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2);
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
sub_0807DD50(this);
break;
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
sub_0806F118(this);
} else {
sub_0807DD94(this, 0);
}
break;
case 2:
if (UpdateFuseInteraction(this)) {
this->action = 1;
}
}
}
void Gentari_Fusion(Entity *this)
{
if (this->action == 0) {
this->action++;
this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2);
InitAnimationForceUpdate(this, 10);
}
else {
UpdateAnimationSingleFrame(this);
}
}
+135
View File
@@ -0,0 +1,135 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "textbox.h"
extern void (*gUnk_08111A80[])(Entity*);
extern void (*gUnk_08111A8C[])(Entity*);
extern u8 gUnk_02033280[];
void Goron(Entity* this) {
if (this->flags & 2) {
gUnk_08111A8C[this->action](this);
} else {
gUnk_08111A80[this->action](this);
sub_0806ED78(this);
}
}
void sub_08069310(Entity* this) {
sub_08078778(this);
this->action = 1;
InitAnimationForceUpdate(this, 2);
}
void sub_08069328(Entity* this) {
if (((u32)(++this->field_0xf << 24) >> 24) > 16) {
int action;
this->field_0xf = 0;
action = sub_0806ED9C(this, 40, 40);
if (action >= 0) {
this->animationState = action;
}
}
if (this->animIndex != this->animationState) {
InitAnimationForceUpdate(this, this->animationState);
}
if (this->interactType != 0) {
this->action = 2;
sub_0805E47C(this);
InitAnimationForceUpdate(this, 8);
TextboxNoOverlapFollow(this->actionDelay + (0x90 << 5));
}
}
void sub_08069390(Entity* this) {
UpdateAnimationSingleFrame(this);
if ((gTextBox.doTextBox & 0x7F) == 0) {
this->action = 1;
this->interactType = 0;
sub_0805E584(this);
InitAnimationForceUpdate(this, this->animationState);
}
}
void sub_080693C4(Entity* this) {
this->action = 1;
sub_0807DD50(this);
}
void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65);
void sub_080693D0(Entity* this) {
sub_0807DD94(this, 0);
if (this->animIndex == 8) {
u32 var0 = this->field_0x82 & 0xF;
bool32 createFx65 = ((-var0) | var0) >> 0x1F; // = !var0
if (this->frames.all == 1) {
this->frames.all = 0;
sub_08069428(this, 0xFFF80000, createFx65);
}
if (this->frames.all == 2) {
this->frames.all = 0;
sub_08069428(this, 0x80<<12, createFx65);
}
}
}
void sub_08069428(Entity* this, s32 offsetX, bool32 createFx65) {
Entity* fx = CreateFx(this, 4, 0);
if (fx) {
PositionRelative(this, fx, offsetX, 0xFFF00000);
ResolveEntityOnTop(this, fx);
}
if (createFx65 != 0) {
fx = CreateFx(this, 65, 0);
if (fx) {
PositionRelative(this, fx, offsetX, 0xFFF00000);
ResolveEntityOnTop(this, fx);
}
}
}
u32 sub_08069480(Entity* this) {
return (sub_0801E99C(this) << 24) >> 24;
}
void sub_0806948C(Entity* this, u32* param_1) {
param_1[5] = CheckKinstoneFused((sub_08069480(this) << 24) >> 24);
gUnk_02033280[7] |= 1;
}
void sub_080694B0(Entity* this) {
u32 kinstone = (sub_08069480(this) << 24) >> 24;
if (CheckKinstoneFused(kinstone)) {
sub_08078778(this);
} else {
sub_08078784(this, kinstone);
}
}
extern u64 gUnk_08111A94[]; //array of unknown 64 bit structure type
void sub_080694D8(Entity* this) {
ShowNPCDialogue(this, (u32*)&gUnk_08111A94[this->entityType.form]);
}
void sub_080694EC(Entity* this) {
u32 anim;
this->animationState = 4;
anim = 2;
if (!CheckKinstoneFused(47)) anim = 8;
InitAnimationForceUpdate(this, anim);
this->field_0x80 = anim;
}
void Goron_Fusion(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 2);
} else {
UpdateAnimationSingleFrame(this);
}
}
+196
View File
@@ -0,0 +1,196 @@
#include "global.h"
#include "entity.h"
#include "link.h"
#include "flags.h"
#include "textbox.h"
#include "room.h"
typedef struct {
u32 unk;
u32 entityCount;
} struct_03003DB8;
typedef struct {
u8 filler[8];
u8 unk;
} struct_030010A0;
typedef struct {
u32 unk;
u32 unk2;
} struct_08064050;
extern void sub_08063D24(Entity*);
extern void sub_0806ED78(Entity*);
extern u32 GetFacingDirection(Entity*, Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_0806EE20(Entity*);
extern void sub_08064428(Entity*);
extern u32 sub_0805ACC0(Entity*);
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern void sub_0807000C(Entity*);
extern void (*const gUnk_0810F544[])(Entity*);
extern void (*const gUnk_0810F550[])(Entity*);
// entity count
extern u8 gUnk_03003DBC;
extern SpriteLoadData gUnk_0810F524[];
extern void* gUnk_0810F6BC[];
extern struct_030010A0 gUnk_030010A0;
void Guard(Entity *this)
{
if ((this->flags & 2) != 0) {
gUnk_0810F544[this->action](this);
}
else {
sub_08063D24(this);
}
}
void sub_08063D24(Entity *this)
{
gUnk_0810F550[this->action](this);
sub_0806ED78(this);
}
NAKED
void sub_08063D44(Entity* this) {
asm(".include \"asm/non_matching/guard/sub_08063D44.inc\"");
}
void sub_08063DC8(Entity *this)
{
if ((this->entityType).form == 0xff) {
this->action = 2;
this->actionDelay = 0x1e;
this->animationState = sub_0806F5A4(GetFacingDirection(this,&gLinkEntity));
InitAnimationForceUpdate(this, this->animationState + 4);
}
else {
sub_0806EE20(this);
if (this->field_0x3e != this->animationState) {
this->animationState = this->field_0x3e;
InitializeAnimation(this, this->animationState + 4);
}
else {
GetNextFrame(this);
}
if (this->interactType != 0) {
this->action = 3;
this->interactType = 0;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this,&gLinkEntity)));
sub_08064428(this);
}
}
}
void sub_08063E54(Entity *this)
{
if (--this->actionDelay == 0) {
SetRoomFlag(0xf);
}
}
void sub_08063E6C(Entity *this)
{
if ((gTextBox.doTextBox & 0x7f) == 0) {
this->action = 1;
InitializeAnimation(this, this->animationState + 4);
}
}
NAKED
void sub_08063E90(Entity* this) {
asm(".include \"asm/non_matching/guard/sub_08063E90.inc\"");
}
void sub_08063F20(Entity *this)
{
sub_0807DDAC(this, 0);
sub_0807DDE4(this);
GetNextFrame(this);
if (this->interactType != 0) {
this->action++;
this->interactType = 0;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)) + *(s8 *)&this->field_0x70);
sub_08064428(this);
}
}
void sub_08063F78(Entity *this)
{
if ((gTextBox.doTextBox & 0x7f) == 0) {
this->action = this->action - 1;
InitializeAnimation(this,(this->animationState >> 1) + 4 + *(s8 *)&this->field_0x70);
}
}
void Guard_Head(Entity *this)
{
u8 bVar1;
u32 uVar2;
u32 pbVar3;
u32 uVar4;
u32 pbVar5;
uVar2 = this->frames.all & 0x3f;
pbVar5 = (this->frameIndex & 0x3f);
uVar4 = this->frameSpriteSettings & 0x3f;
if ((this->entityType).subtype == 0x15) {
if ((this->frameIndex & 0x40) != 0) {
pbVar5 = pbVar5 + 0x21;
pbVar3 = 0xffffffff;
uVar4 = 0;
}
else {
pbVar3 = (uVar2 + 0x19);
if ((this->frameSpriteSettings & 0x3f) != 0) {
uVar4 += 0x1f;
}
}
}
else {
pbVar3 = (uVar2 + 0x46);
pbVar5 = pbVar5 + 0x2d;
if ((this->frameSpriteSettings & 0x3f) != 0) {
uVar4 += 0x4c;
}
}
uVar4--;
SetExtraSpriteFrame(this, 0, pbVar3);
SetExtraSpriteFrame(this, 1, pbVar5);
SetExtraSpriteFrame(this, 2, uVar4);
SetSpriteSubEntryOffsetData1(this, 1, 0);
SetSpriteSubEntryOffsetData2(this, 1, 2);
sub_0807000C(this);
}
void sub_08064030(Entity *arg0,Entity *arg1)
{
*(u32*)&arg1->animationState = (-gRoomVars.greatFairyState | gRoomVars.greatFairyState) >> 0x1f;
}
void sub_08064044(void)
{
gUnk_030010A0.unk = 1;
}
void sub_08064050(Entity *arg0, struct_08064050 *arg1)
{
u32 unk;
arg1->unk2 = 0;
switch (arg0->entityType.parameter) {
case 0x11:
arg1->unk2 = 1;
break;
case 0x12:
arg1->unk2 = 2;
break;
case 0x13:
arg1->unk2 = 3;
}
}
+61
View File
@@ -0,0 +1,61 @@
#include "global.h"
#include "entity.h"
#include "textbox.h"
extern void sub_0806ED78(Entity*);
extern void sub_08063280();
extern void (*gMailboxBehaviors[4])(Entity*);
void Mailbox(Entity* this) {
gMailboxBehaviors[this->action](this);
if (this->action != 0) {
sub_0806ED78(this);
}
}
void sub_08063210(Entity* this) {
this->action = 1;
InitAnimationForceUpdate(this, 0);
}
void sub_08063220(Entity* this) {
u8 bVar1;
if (this->interactType != 0) {
this->action = 2;
bVar1 = 8;
} else {
bVar1 = 0;
}
if (this->animIndex != bVar1) {
InitAnimationForceUpdate(this, bVar1);
} else {
sub_08063280(this, bVar1);
}
}
void sub_08063254(Entity* this, u32 unused) {
sub_08063280(this, unused);
if ((this->frames.all & 0x80) != 0) {
this->action = 3;
TextboxNoOverlapFollow(0);
}
}
void sub_08063278(Entity* this, u32 unused) {
sub_08063280(this, unused);
}
void sub_08063280(Entity* this, u32 unused) {
Entity* e; // r4@1
u8 var; // r2@1
e = this;
UpdateAnimationSingleFrame(e);
var = e->frames.all & 0x7F;
e->frames.all ^= var;
if (var == 2) CreateFx(e, 49, 0);
}
+80
View File
@@ -0,0 +1,80 @@
#include "global.h"
#include "functions.h"
#include "entity.h"
extern Entity gLinkEntity;
extern void (*gUnk_0810FF5C[])(Entity* this);
extern void (*gUnk_0810FF64[])(Entity* this);
void Malon(Entity* this) {
if (this->flags & 0x2) {
gUnk_0810FF64[this->action](this);
} else {
gUnk_0810FF5C[this->action](this);
if (this->action != 0) {
sub_0806ED78(this);
}
}
}
void sub_08065864(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 0xC);
}
void sub_08065880(Entity* this) {
UpdateAnimationSingleFrame(this);
}
void sub_08065888(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 1;
this->animationState = 4;
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
sub_0807DD50(this);
}
void sub_080658BC(Entity* this) {
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
sub_0806F118(this);
} else {
sub_0807DD94(this, 0);
}
}
void sub_08065900(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
}
}
void sub_08065914(Entity* this) {
Entity* target;
target = sub_0805EB00(7, 0x1F, 7);
if (target != NULL) {
PositionRelative(this, target, 0x180000, -0x10000);
target->parent = this;
}
target = sub_0805EB00(7, 0x20, 7);
if (target != NULL) {
PositionRelative(this, target, 0x280000, 0);
target->parent = this;
}
}
void Malon_Fusion(Entity* this) {
if (this->action == 0) {
this->action++;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 0xC);
} else {
UpdateAnimationSingleFrame(this);
}
}
+23
View File
@@ -0,0 +1,23 @@
#include "global.h"
#include "entity.h"
extern void sub_0806ED78();
extern void (*gMilkCartBehaviors[2])(Entity*);
void MilkCart(Entity* ent) {
gMilkCartBehaviors[ent->action](ent);
sub_0806ED78(ent);
}
void sub_08065B6C(Entity* ent) {
ent->action++;
ent->spriteSettings.b.draw = 1;
ent->y.HALF.LO += -0x8000;
ent->animationState = 6;
InitAnimationForceUpdate(ent, 3);
}
void sub_08065B9C(Entity* ent) {
UpdateAnimationSingleFrame(ent);
}
+99
View File
@@ -0,0 +1,99 @@
#include "global.h"
#include "entity.h"
#include "link.h"
#include "flags.h"
#include "textbox.h"
#include "npc.h"
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern u32 GetFacingDirection(Entity*, Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_0806F118(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern u32 UpdateFuseInteraction(Entity*);
extern void sub_0807000C(Entity*);
extern u32 sub_0801E99C(Entity*);
extern void sub_08078784(Entity*, u32);
extern SpriteLoadData gUnk_08110C00;
extern u16 gUnk_08110C0C[];
extern u32 gUnk_08110C10[];
void Mutoh(Entity* this)
{
if (*(u32*)&this->cutsceneBeh == 0) {
DeleteThisEntity();
}
switch (this->action) {
case 0:
if (LoadExtraSpriteData(this, &gUnk_08110C00)) {
this->action = 1;
this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2);
sub_0807DD50(this);
}
break;
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)) + 4);
sub_0806F118(this);
} else {
sub_0807DD94(this, 0);
}
break;
case 2:
if (UpdateFuseInteraction(this)) {
this->action = 1;
}
}
}
void Mutoh_Head(Entity *this)
{
SetExtraSpriteFrame(this, 0, (this->frames.all & -0x81));
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this,1,0);
sub_0807000C(this);
}
void sub_080670B4(Entity *this)
{
u32 uVar1;
u32 uVar2;
uVar2 = 0;
if (GetInventoryValue(0x11) == 0) {
uVar1 = CheckGlobalFlag(0x15);
uVar2 = (-uVar1 | uVar1) >> 0x1f;
}
TextboxNoOverlap(gUnk_08110C0C[uVar2],this);
}
void sub_080670E4(Entity *this)
{
ShowNPCDialogue(this, &gUnk_08110C10[gUnk_02002A40.unk * 2]);
}
void sub_08067100(Entity *this)
{
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
}
void Mutoh_Fusion(Entity *this)
{
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08110C00) != 0) {
this->action++;
this->spriteSettings.b.draw = TRUE;
InitializeAnimation(this, 2);
}
}
else {
GetNextFrame(this);
}
}
+227
View File
@@ -0,0 +1,227 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "textbox.h"
#include "link.h"
typedef struct {
u8 filler[7];
u8 unk;
} struct_02033280;
extern void sub_08060528(Entity*);
extern void* GetCurrentRoomProperty(u32);
extern void sub_0806EE04(Entity*, void*, u32);
extern void sub_080604DC(Entity*);
extern s32 sub_0806ED9C(Entity*, u32, u32);
extern void sub_0806EE20(Entity*);
extern void sub_0806ED78(Entity*);
extern u32 sub_080040A8(Entity*);
extern void sub_0805E3A0(Entity*, u32);
extern u32 sub_0801E99C(Entity*);
extern void sub_0807DD50(Entity*);
extern void sub_0806F118(Entity*);
extern u32 sub_0806F5A4(u32);
extern u32 GetFacingDirection(Entity*, Entity*);
extern void sub_080606D8(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern void sub_080788E0(Entity*);
extern void sub_08004488(u32);
extern void sub_08003FC4(Entity*, u32);
extern void sub_080606C0(Entity*);
extern void sub_0800451C(Entity*);
extern void sub_08078784(Entity*, u32);
extern void sub_0807DEDC(Entity*, u32, u32, u32);
extern void (*const gUnk_0810AA24[])(Entity*);
extern u32 gUnk_0810AA30[];
extern u32** gUnk_0810A66C;
extern u32 gUnk_0810A918[];
extern struct_02033280 gUnk_02033280;
void Postman(Entity* this) {
if ((this->flags & 2) != 0) {
sub_08060528(this);
} else {
gUnk_0810AA24[this->action](this);
}
}
void sub_08060428(Entity* this) {
u8 bVar1;
void* data;
this->actionDelay = 0x5a;
this->nonPlanarMovement = 0x180;
if (this->entityType.parameter != 0) {
data = GetCurrentRoomProperty(this->entityType.parameter);
} else {
data = NULL;
}
sub_0806EE04(this, data, 0);
this->action = 1;
InitAnimationForceUpdate(this, 4);
}
void sub_0806045C(Entity* this) {
u8 bVar1;
u32 uVar2;
u32 bVar3;
s32 temp;
UpdateAnimationSingleFrame(this);
sub_080604DC(this);
switch (this->interactType) {
case 1:
case 2:
this->action = 2;
TextboxNoOverlapFollow(0);
break;
default:
bVar1 = this->field_0x3e;
if (bVar1 != this->animationState) {
this->animationState = bVar1;
InitAnimationForceUpdate(this, 4 + bVar1);
}
temp = sub_0806ED9C(this, 0x18, 0x18);
if ((temp > -1) && (temp == this->animationState)) {
bVar3 = 1;
} else {
bVar3 = 0;
}
if (!bVar3) {
sub_0806EE20(this);
}
}
sub_0806ED78(this);
}
void sub_080604C8(Entity* this) {
UpdateAnimationSingleFrame(this);
sub_080604DC(this);
this->action = 1;
}
void sub_080604DC(Entity* this) {
u8 bVar1;
int iVar2;
Entity* ent;
if (((u32)(this->spriteSettings.raw << 0x1e) >> 0x1e == 1) && sub_080040A8(this)) {
if ((this->frames.all & 1) != 0) {
this->frames.all &= 0xfe;
ent = CreateFx(this, 0x11, 0x40);
if (ent != NULL) {
ent->y.HALF.HI++;
sub_0805E3A0(ent, 3);
}
}
}
}
void sub_08060528(Entity *this)
{
switch (this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = TRUE;
this->field_0x68 = 0;
this->field_0x69 = 0;
this->field_0x6a.HWORD = 0;
this->field_0x6d = 0;
this->field_0x6c = sub_0801E99C(this);
sub_0807DD50(this);
break;
case 1:
if (this->interactType == 2) {
this->action = 3;
this->interactType = 0;
sub_0806F118(this);
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
}
else {
if (this->interactType != 0) {
this->action = 2;
this->interactType = 0;
sub_080606D8(this);
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
}
else {
sub_0807DD94(this, 0);
}
}
break;
case 2:
UpdateAnimationSingleFrame(this);
if ((gTextBox.doTextBox & 0x7f) != 0) {
break;
}
this->action = 1;
break;
case 3:
UpdateAnimationSingleFrame(this);
if (!UpdateFuseInteraction(this)) {
break;
}
this->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->field_0x20 = 0x20000;
this->field_0x6d = 1;
sub_080788E0(this);
sub_08004488(0x7c);
}
else {
this->field_0x6a.HWORD -= 1;
}
}
sub_08003FC4(this, 0x1800);
if (((this->field_0x6d != 0) && (this->field_0x20 == 0)) && this->height.WORD == 0) {
this->field_0x6d = 0;
sub_080606C0(this);
}
if ((-1 < this->height.WORD) &&
((gLinkEntity.collisionLayer == 0 || (this->collisionLayer == gLinkEntity.collisionLayer)))) {
sub_0806ED78(this);
}
sub_0800451C(this);
}
void sub_080606C0(Entity *this)
{
this->field_0x6c = sub_0801E99C(this);
sub_08078784(this, this->field_0x6c);
}
void sub_080606D8(Entity* this)
{
s32 iVar1;
iVar1 = gUnk_02002A40.unk - 2;
if (iVar1 < 0) {
iVar1 = 0;
}
ShowNPCDialogue(this, &gUnk_0810AA30[iVar1 * 2]);
}
#if 0
void sub_08060700(Entity *arg0, u32 arg1)
{
sub_0807DEDC(arg0,arg1,
gUnk_0810A918[gUnk_0810A66C[arg0->field_0x69][arg0->field_0x68] * 4 + gRoomControls.roomOriginX],
gUnk_0810A918[gUnk_0810A66C[arg0->field_0x69][arg0->field_0x68] * 4 + gRoomControls.roomOriginY + 2]);
gUnk_02033280.unk |= 1;
}
#endif
NAKED void sub_08060700(Entity *arg0, u32 arg1) {
asm(".include \"asm/non_matching/postman/sub_08060700.inc\"");
}
void sub_0806075C(Entity *this)
{
this->field_0x68 = 0xb;
this->field_0x69 = 0xff;
}
+54
View File
@@ -0,0 +1,54 @@
#include "global.h"
#include "functions.h"
#include "entity.h"
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern void sub_0806ED78(Entity*);
extern void PlaySFX(u32);
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0806A8C8(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern void (*gUnk_08112260[])(Entity*);
extern void (*gUnk_08112278[])(Entity*);
extern void gUnk_08012F0C;
void Rem(Entity* this) {
gUnk_08112260[this->entityType.form](this);
}
void sub_0806a370(Entity* this) {
u8* pbVar1;
gUnk_08112278[this->action](this);
sub_0807DDAC(this, 0);
sub_0807DDE4(this);
UpdateAnimationSingleFrame(this);
sub_0806ED78(this);
if (this->animIndex == 0xf) {
pbVar1 = &this->frames.all;
if (*pbVar1 == 1) {
*pbVar1 = 0;
PlaySFX(0x218);
}
if (*pbVar1 == 2) {
*pbVar1 = 0;
PlaySFX(0x219);
}
}
}
void sub_0806A3D8(Entity *this)
{
u32 *uVar1;
this->action = 1;
this->actionDelay = 0xb4;
sub_0805E3A0(this, 2);
sub_0806A8C8(this);
uVar1 = StartCutscene(this,&gUnk_08012F0C);
*(u32 *)&this->cutsceneBeh = (u32)uVar1;
sub_0807DD94(this, 0);
}
+67
View File
@@ -0,0 +1,67 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "room.h"
#include "flags.h"
typedef struct {
u8 filler[9];
u8 unk;
} struct_030010A0;
typedef struct {
u8 filler[4];
u32 unk;
} struct_0806C2A0;
extern void DoExitTransition(void *);
extern void SetTileType(u32, u32, u32);
extern void DoExitTransition(void *);
extern void DoFade(u32, u32);
extern void gUnk_0813AD60;
extern void gUnk_0813AD74;
extern struct_030010A0 gUnk_030010A0;
void Simon(Entity *this)
{
if (this->action == 0) {
this->action++;
sub_0807DD50(this);
}
else {
sub_0807DD94(this, 0);
}
}
void sub_0806C224(void)
{
DoExitTransition(&gUnk_0813AD60);
gUnk_030010A0.unk = 6;
}
void Simon_CreateChest(Entity *this)
{
CreateObjectWithParent(this,0xf,0x43,0);
SetTileType(0x73, COORD_TO_TILE(this), this->collisionLayer);
PlaySFX(0x73);
}
void sub_0806C280(void)
{
SetGlobalFlag(0x50);
DoExitTransition(&gUnk_0813AD74);
gUnk_030010A0.unk = 6;
}
void sub_0806C2A0(u32 *param_1,struct_0806C2A0 *param_2)
{
switch (param_2->unk) {
case 0:
DoFade(0xd, 4);
break;
case 1:
DoFade(0xc, 4);
break;
}
}
+225
View File
@@ -0,0 +1,225 @@
#include "global.h"
#include "entity.h"
#include "textbox.h"
typedef struct {
u8 filler[8];
u8 unk;
} struct_02002A40;
extern u32 GetFacingDirection(Entity*, Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_0806F118(Entity*);
extern void sub_0806ED78(Entity*);
extern Entity* CreateFx(Entity*, u32, u32);
extern void PlaySFX(u32);
extern u32 Random(void);
extern void sub_0807000C(Entity*);
extern u32 sub_0801E99C(Entity*);
extern u32 sub_0806ED9C(Entity*, u32, u32);
extern u32 sub_0806F078(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern u32 UpdateFuseInteraction(Entity*);
extern u32 GetAnimationState(Entity*);
extern void ShowNPCDialogue(Entity*, u32*);
extern void sub_08078850(u32, u32, u32, u32*);
extern void sub_08078784(Entity*, u32);
extern void (*const gUnk_08110360[])(Entity*);
extern void (*const gUnk_0811036C[])(Entity*);
extern u16 gUnk_08110380[];
extern SpriteLoadData gUnk_08110354;
extern struct_02002A40 gUnk_02002A40;
extern u32 gUnk_08110390[];
extern u16 gUnk_081103D0[];
extern u32 gUnk_081103E0;
#if NON_MATCHING //reg-alloc
void Smith(Entity *this)
{
u32 iVar2;
u32 iVar4;
if ((this->flags & 2) != 0) {
if (this->interactType == 2) {
this->action = 4;
this->interactType = 0;
iVar4 = (this->animIndex == 0xc) ? 8 : 0;
iVar2 = sub_0806F5A4(GetFacingDirection(this, &gLinkEntity));
InitAnimationForceUpdate(this, iVar2 + iVar4);
sub_0806F118(this);
}
gUnk_0811036C[this->action](this);
}
else {
gUnk_08110360[this->action](this);
sub_0806ED78(this);
}
if (this->animIndex == 0xc) {
this->spritePriority.b1 = 0;
}
else {
this->spritePriority.b1 = 1;
}
if ((this->frames.all & 1) != 0) {
this->frames.all &= 0xfe;
CreateFx(this, 0x3d, 0x20);
PlaySFX(gUnk_08110380[(Random() & 7)]);
}
}
#else
NAKED
void Smith(Entity *this) {
asm(".include \"asm/non_matching/smith/smith.inc\"");
}
#endif
void Smith_Head(Entity *this)
{
u8 bVar1;
bVar1 = this->frames.all;
SetExtraSpriteFrame(this, 0, this->frameIndex);
if ((bVar1 & 0x40) != 0) {
SetExtraSpriteFrame(this, 1, 0x16);
}
else {
SetExtraSpriteFrame(this, 1, 0xff);
}
SetSpriteSubEntryOffsetData1(this,0,1);
sub_0807000C(this);
}
void sub_080660EC(Entity *this)
{
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
this->action = 1;
this->field_0x68 = sub_0801E99C(this);
InitAnimationForceUpdate(this, 2);
}
}
void sub_08066118(Entity *this)
{
s32 uVar1;
u32 iVar2;
uVar1 = sub_0806ED9C(this, 0x28, 0x28);
if (uVar1 < 0) {
uVar1 = 2;
}
else {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
}
else {
--this->field_0xf;
uVar1 = this->animIndex;
}
}
if (sub_0806F078(this, uVar1) == 0) {
UpdateAnimationSingleFrame(this);
}
if (this->interactType != 0) {
this->action = 2;
TextboxNoOverlapFollow(0);
}
}
void sub_08066170(Entity *this)
{
this->action = 1;
}
void sub_08066178(Entity *this)
{
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
this->action = 1;
this->spriteSettings.b.draw = 1;
this->field_0x68 = sub_0801E99C(this);
sub_0807DD50(this);
}
}
void sub_080661B0(Entity *this)
{
sub_0807DD94(this, 0);
}
void sub_080661BC(Entity *this)
{
u32 sVar1;
if (this->animIndex == 0xc) {
UpdateAnimationSingleFrame(this);
if ((this->frames.b.f3) != 0) {
this->field_0x80 = GetAnimationState(this) + 8;
InitAnimationForceUpdate(this, this->field_0x80);
}
}
else {
sub_0807DD94(this,0);
}
}
void sub_08066200(Entity *this)
{
sub_0807DDAC(this, 0);
sub_0807DDE4(this);
UpdateAnimationSingleFrame(this);
}
void sub_08066218(Entity *this)
{
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
}
}
void sub_0806622C(Entity *this)
{
u32 iVar1;
if (gUnk_02002A40.unk - 2 < 0) {
iVar1 = 0;
}
else {
iVar1 = gUnk_02002A40.unk - 2;
}
ShowNPCDialogue(this, &gUnk_08110390[iVar1 * 2]);
}
void nullsub_501(Entity* this) {}
void sub_08066258(void)
{
PlaySFX(gUnk_081103D0[Random() & 7]);
}
void sub_08066274(u32 arg0)
{
sub_08078850(arg0, 1, 0, &gUnk_081103E0);
}
void sub_08066288(Entity *arg0)
{
sub_08078784(arg0, arg0->field_0x68);
}
void Smith_Fusion(Entity *this)
{
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
this->action++;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 6);
}
}
else {
UpdateAnimationSingleFrame(this);
}
}
+90
View File
@@ -0,0 +1,90 @@
#include "global.h"
#include "entity.h"
#include "textbox.h"
extern void sub_08078778(Entity*);
extern void sub_0805E47C(Entity*);
extern void sub_0806ED78(Entity*);
extern void sub_0805E584();
extern void sub_0807DD64();
extern void sub_08062CA4();
extern void sub_0807DDAC();
extern void sub_0807DDE4();
extern u32 CheckKinstoneFused();
extern void ShowNPCDialogue();
extern void (*gStampBehaviors1[4])(Entity*);
extern void (*gStampBehaviors2[2])(Entity*);
extern u32 gUnk_0810C2E4;
void Stamp(Entity* ent) {
if ((ent->flags & 2) != 0) {
gStampBehaviors2[ent->action](ent);
} else {
gStampBehaviors1[ent->action](ent);
}
}
void sub_08062BD4(Entity* ent) {
ent->action = 1;
ent->spriteSettings.b.draw = 1;
InitializeAnimation(ent, 0);
sub_08078778(ent);
}
void sub_08062BF8(Entity* ent) {
GetNextFrame(ent);
if (ent->interactType != 0) {
ent->interactType = 0;
ent->action++;
sub_0805E47C(ent);
}
sub_0806ED78(ent);
}
void sub_08062C24(Entity* ent) {
GetNextFrame(ent);
if ((ent->frames.all & 128) != 0) {
InitializeAnimation(ent, 4);
TextboxNoOverlapFollow(2561);
ent->action++;
}
}
void sub_08062C54(Entity* ent) {
if ((gTextBox.doTextBox & 127) == 0) {
ent->action = 1;
InitializeAnimation(ent, 0);
sub_0805E584(ent);
}
}
void sub_08062C7C(Entity* ent) {
ent->action = 1;
sub_0807DD64(ent);
InitializeAnimation(ent, 0);
CreateFx(ent, 37, 0);
sub_08062CA4(ent);
}
void sub_08062CA4(Entity* ent) {
sub_0807DDAC(ent, 0);
sub_0807DDE4(ent);
GetNextFrame(ent);
}
void sub_08062CBC(Entity* ent) {
u32 uVar1;
uVar1 = CheckKinstoneFused(44);
ShowNPCDialogue(ent, &gUnk_0810C2E4 + ((-uVar1 | uVar1) >> 31) * 2);
}
void sub_08062CE0(Entity* ent) {
if (ent->action == 0) {
ent->action = 1;
}
}
+75
View File
@@ -0,0 +1,75 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
extern void sub_0807DD50(Entity*);
extern void sub_0806ED78(Entity*);
extern void sub_0805E3A0(Entity*, u32);
extern void (*gUnk_081121D4[])(Entity*);
extern SpriteLoadData gUnk_081121C4;
extern SpriteLoadData gUnk_081121B4;
extern u32 gUnk_030010A0;
extern void sub_0807DD94(Entity*, u32);
extern void sub_0806A26C(Entity*);
extern void sub_080042BA(Entity*, u32);
void Syrup(Entity *this)
{
gUnk_081121D4[this->action](this);
sub_0806ED78(this);
}
void sub_0806A1F8(Entity *this)
{
u32 iVar1;
SpriteLoadData *paVar2;
(this->entityType).form == 0 ? (paVar2 = &gUnk_081121B4) : (paVar2 = &gUnk_081121C4);
iVar1 = LoadExtraSpriteData(this,paVar2);
if (iVar1) {
this->action = 1;
sub_0805E3A0(this,2);
sub_0807DD50(this);
InitializeAnimation(this,0);
}
}
void sub_0806A234(Entity *this)
{
sub_0807DD94(this, 0);
if ((this->field_0x82 & 4) != 0) {
if ((gUnk_030010A0 & 7) == 0) {
sub_0806A26C(this);
}
sub_080042BA(this, 2);
}
}
#ifdef NON_MATCHING
void sub_0806A26C(Entity *this)
{
u8 unk;
u32 uVar2;
Entity *pEVar1;
pEVar1 = CreateObject(0xf,0x2f,0);
if (pEVar1 != NULL) {
PositionEntityOnTop(this, pEVar1);
if (uVar2 = Random(), uVar2)
{
unk = -unk; // wtf?!
}
pEVar1->spriteOffsetX = gUnk_081121DC[uVar2 & 7];
pEVar1->spriteOffsetY = gUnk_081121DC[(uVar2 / 256) & 7] - 8;
}
}
#else
NAKED
void sub_0806A26C(Entity *this)
{
asm(".include \"asm/non_matching/syrup/sub_0806A26C.inc\"");
}
#endif
+161
View File
@@ -0,0 +1,161 @@
#include "global.h"
#include "entity.h"
#include "textbox.h"
#include "functions.h"
#include "link.h"
extern void (*gUnk_0810FEC4[])(Entity* this);
extern void (*gUnk_0810FEBC[])(Entity* this);
extern SpriteLoadData gUnk_0810FEB0;
extern u8 gUnk_0800B41C;
extern u8 gUnk_0810FED8[];
void sub_0806574C(Entity* this);
void Talon(Entity* this) {
if (this->flags & 2) {
gUnk_0810FEC4[this->action](this);
} else {
gUnk_0810FEBC[this->action](this);
}
}
void sub_08065570(Entity* this) {
if (LoadExtraSpriteData(this, &gUnk_0810FEB0) != 0) {
InitializeAnimation(this, 0);
sub_08078778(this);
this->action = 1;
this->field_0xf = 1;
this->animationState = 2;
}
}
void sub_0806559C(Entity* this) {
s32 offset;
s32 result;
this->actionDelay++;
if (this->actionDelay >= 9) {
this->actionDelay = 0;
result = sub_0806ED9C(this, 0x20, 0x20);
if (result < 0) {
offset = this->animationState + 4;
} else {
this->animationState = result;
offset = result;
}
} else {
offset = this->animIndex;
}
if (this->animIndex != offset) {
InitializeAnimation(this, offset);
} else {
GetNextFrame(this);
}
sub_0806ED78(this);
if (this->interactType != 0) {
this->interactType = 0;
sub_080791D0();
}
}
void sub_08065608(Entity* this) {
if (LoadExtraSpriteData(this, &gUnk_0810FEB0) != 0) {
this->action = 1;
this->spriteSettings.b.draw = 1;
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
sub_0807DD50(this);
}
}
void sub_08065648(Entity* this) {
if (this->interactType == 2) {
this->field_0x69 = this->action;
this->action = 4;
this->interactType = 0;
sub_0806F118(this);
} else {
sub_0807DD94(this, 0);
}
}
void sub_08065680(Entity* this) {
if (UpdateFuseInteraction() != 0) {
this->action = this->field_0x69;
InitAnimationForceUpdate(this, this->field_0x6a.HALF.LO);
}
}
void sub_080656A4(Entity* this) {
if ((gTextBox.doTextBox & 0x7F) == 0) {
this->action = this->field_0x69;
InitAnimationForceUpdate(this, this->field_0x6a.HALF.LO);
}
UpdateAnimationSingleFrame(this);
}
void sub_080656D4(Entity* this) {
if (this->interactType == 2) {
this->field_0x69 = this->action;
this->action = 4;
this->interactType = 0;
sub_0806F118(this);
goto label;
} else {
if (this->interactType != 0) {
if (GetInventoryValue(0x37) != 0) { // keyLonLon
StartCutscene(this, &gUnk_0800B41C);
goto label2;
} else {
this->field_0x69 = this->action;
this->action = 3;
this->interactType = 0;
TextboxNoOverlap(*(u32*)(*(u32*)&this->cutsceneBeh.HWORD + 4), this);
label:
sub_0806574C(this);
}
} else {
label2:
sub_0807DD94(this, 0);
}
}
}
void sub_0806574C(Entity* this) {
u32 j;
j = (this->animIndex & ~3) + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity));
if (this->animIndex != j) {
InitAnimationForceUpdate(this, j);
}
this->field_0x6a.HALF.LO = this->animIndex;
}
void sub_08065780(Entity* this, u16* param_2) {
u32 rand;
rand = Random();
this->animationState = rand & 6;
param_2[8] = gUnk_0810FED8[rand >> 8 & 7];
}
void Talon_Head(Entity* this) {
SetExtraSpriteFrame(this, 0, ((this->frames.all & 7) + 0xB));
SetExtraSpriteFrame(this, 1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
void Talon_Fusion(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_0810FEB0) != 0) {
this->action++;
this->spriteSettings.b.draw = 1;
InitializeAnimation(this, 6);
}
} else {
GetNextFrame(this);
}
}
+113
View File
@@ -0,0 +1,113 @@
#include "global.h"
#include "entity.h"
#include "link.h"
typedef struct {
u8 filler[8];
u8 unk;
} struct_02002A40;
extern SpriteLoadData gUnk_08113910[];
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern u32 GetFacingDirection(Entity*, Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_0806F118(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern u32 sub_0801E99C();
extern void sub_08078784(Entity*, u32);
extern u32 UpdateFuseInteraction(Entity*);
extern void sub_0807000C(Entity*);
extern void ShowNPCDialogue(Entity*, u16*);
extern struct_02002A40 gUnk_02002A40;
extern u16 gUnk_08113930[];
void Teachers(Entity* this) {
switch (this->action) {
case 0:
if (LoadExtraSpriteData(this, &gUnk_08113910[this->entityType.form * 4])) {
this->action = 1;
this->spriteSettings.b.draw = TRUE;
this->animationState = this->actionDelay;
this->field_0x69 = 0;
sub_0805E3A0(this, 2);
sub_0807DD50(this);
}
break;
case 1:
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
this->field_0x69 = this->animIndex;
InitializeAnimation(this,
(this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
sub_0806F118(this);
} else {
sub_0807DD94(this, 0);
}
break;
case 2:
if (UpdateFuseInteraction(this)) {
this->action = 1;
InitializeAnimation(this, this->field_0x69);
}
}
}
void sub_0806C674(Entity *this)
{
this->field_0x68 = sub_0801E99C();
sub_08078784(this, this->field_0x68);
}
void Teachers_Head(Entity *this)
{
u8 bVar1;
u8 bVar2;
u32 uVar3;
uVar3 = this->frames.all & -0x81;
bVar1 = this->frameIndex;
bVar2 = this->frameSpriteSettings & 0x3f;
if ((this->entityType).form == 0) {
SetExtraSpriteFrame(this,0, (uVar3 + 3));
SetExtraSpriteFrame(this,1, bVar1);
SetSpriteSubEntryOffsetData1(this, 1, 0);
sub_0807000C(this);
}
else {
SetExtraSpriteFrame(this, 0, (uVar3 + 6));
SetExtraSpriteFrame(this, 1, ((bVar2) + 3));
SetExtraSpriteFrame(this, 2, bVar1);
SetSpriteSubEntryOffsetData1(this, 2, 1);
SetSpriteSubEntryOffsetData2(this, 2, 0);
sub_0807000C(this);
}
}
void sub_0806C70C(Entity *this)
{
int offset;
offset = gUnk_02002A40.unk - 2;
if (offset < 0) {
offset = 0;
}
ShowNPCDialogue(this, gUnk_08113930 + this->entityType.form * 0x20 + offset * 4);
}
void Teachers_Fusion(Entity *this)
{
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_08113910[this->entityType.form * 4])) {
this->action++;
this->spriteSettings.b.draw = TRUE;
InitializeAnimation(this, 2);
}
}
else {
GetNextFrame(this);
}
}
+84
View File
@@ -0,0 +1,84 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
extern void InitializeAnimation(Entity *, u32);
extern void sub_0806ED78(Entity *);
extern void (*gUnk_081126E8[])();
extern void sub_0806ACC4(Entity *);
extern u32 LoadExtraSpriteData(Entity *, SpriteLoadData *);
extern SpriteLoadData gUnk_08112674[];
void TownMinish(Entity *this)
{
if ((this->flags & 2) == 0) {
(*gUnk_081126E8[this->action])(this);
sub_0806ED78(this);
}
else {
sub_0806ACC4(this);
}
}
void sub_0806ABFC(Entity *this)
{
u8 animationState;
SpriteLoadData* SpriteLoadData = &gUnk_08112674[this->entityType.form << 2];
if (!LoadExtraSpriteData(this, SpriteLoadData))
{
return;
}
InitializeAnimation(this, 2);
this->action = 1;
this->field_0x6a.HALF.LO = this->actionDelay;
this->animationState = this->field_0x6a.HALF.LO << 1;
animationState = this->animationState;
this->field_0x69 = animationState << 2;
this->actionDelay = 0;
}
// Not matching yet, not 100% sure it's functionally identical
/*void sub_0806AC3C(Entity *this) {
if (this->field_0x58 <= 3) {
s32 unk;
u8 field_0x69;
Entity *link = &gLinkEntity;
if (sub_080041A0(this, link, 0x18, 0x18)) {
unk = GetFacingDirection(this, link) & (u8)0x1e;
}
else {
unk = this->animationState << 2;
}
field_0x69 = this->field_0x69;
if (unk != field_0x69) {
s32 temp;
if (((unk - field_0x69) & 0x1f) <= 0xf) {
field_0x69--;
}
else {
field_0x69++;
}
temp = field_0x69;
this->field_0x69 = temp & 0x1f;
}
if (!(this->field_0x69 & 7)) {
this->animationState = sub_0806F5B0(this->field_0x69);
UpdateSprite(this, (this->animationState >> 1) ^ 2);
}
}
sub_080042B8(this);
}*/
+58
View File
@@ -0,0 +1,58 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "link.h"
#include "textbox.h"
extern void (*const gUnk_0810B774[])(Entity*);
extern void (*const gUnk_0810B77C[])(Entity*);
extern void sub_08061CB4(Entity*, u32);
extern u32 sub_0806ED9C(Entity*, u32, u32);
extern void sub_0806ED78(Entity*);
extern SpriteLoadData* gUnk_0810B6EC[];
void Townsperson(Entity *this)
{
if ((this->flags & 2) != 0) {
gUnk_0810B77C[this->action](this);
}
else {
gUnk_0810B774[this->action](this);
}
}
void sub_08061BC8(Entity *this)
{
if (LoadExtraSpriteData(this, gUnk_0810B6EC[this->entityType.form])) {
this->animationState = 2;
this->field_0xf = this->entityType.form + 1;
this->action++;
sub_08061CB4(this, 2);
}
}
void sub_08061C00(Entity *this)
{
s32 uVar1;
uVar1 = sub_0806ED9C(this, 0x20, 0x20);
if (uVar1 < 0) {
uVar1 = this->animationState + 4;
}
else {
if (this->field_0xf == 0) {
this->field_0xf = 0x10;
}
else {
this->field_0xf--;
uVar1 = this->animIndex & 3;
}
}
sub_08061CB4(this, uVar1);
sub_0806ED78(this);
if (this->interactType != 0) {
this->interactType = 0;
TextboxNoOverlapFollow(this->entityType.parameter + 0xa01);
}
}
+26
View File
@@ -0,0 +1,26 @@
#include "global.h"
#include "entity.h"
extern void sub_0805E3A0(Entity *, u32);
extern void ResolveEntityOnTop(Entity *, Entity *);
extern BoundingBox gUnk_0810C3C0;
extern void sub_0807DD64(Entity *);
extern void sub_0807DD94(Entity *, u32);
void Wheaton(Entity *this) {
if (this->action == 0) {
this->action++;
sub_0805E3A0(this, 2);
ResolveEntityOnTop(this, this);
this->boundingBox = &gUnk_0810C3C0;
this->spriteOffsetY = 0xfe;
sub_0807DD64(this);
}
sub_0807DD94(this, 0);
}
+145
View File
@@ -0,0 +1,145 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "textbox.h"
#include "flags.h"
extern u32 LoadExtraSpriteData(Entity*, SpriteLoadData*);
extern void sub_0807DD50(Entity*);
extern void sub_0806C7D4(Entity*);
extern void sub_0806F118(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern void sub_0807DD80(Entity*, u32*);
extern u32 sub_0801E99C();
extern void sub_08078784(Entity*, u32);
extern void SetExtraSpriteFrame(Entity*, u32, u32);
extern void SetSpriteSubEntryOffsetData2(Entity*, u32, u32);
extern void SetSpriteSubEntryOffsetData1(Entity*, u32, u32);
extern void sub_0807000C(Entity*);
extern void (*const gUnk_08113A7C[])(Entity*);
extern void (*const gUnk_08113A8C[])(Entity*, Entity*);
extern SpriteLoadData gUnk_08113A1C[];
extern u32 gUnk_08014A80;
extern u32 gUnk_08113ABC[];
extern u16 gUnk_08113B0C[];
void WindTribespeople(Entity* this) {
gUnk_08113A7C[this->action](this);
}
void sub_0806C798(Entity* this) {
s32 iVar1;
iVar1 = LoadExtraSpriteData(this, gUnk_08113A1C + (this->entityType.form * 4));
if (iVar1 != 0) {
this->action = 1;
this->spriteSettings.b.draw = 1;
this->animationState = this->actionDelay;
sub_0807DD50(this);
sub_0806C7D4(this);
}
}
void sub_0806C7D4(Entity* this) {
u32 iVar1;
u32 uVar2;
if (this->interactType == '\x02') {
this->action = 3;
this->interactType = '\0';
sub_0806F118(this);
} else {
sub_0807DD94(this, 0);
if ((this->entityType.parameter == 3) && (!CheckGlobalFlag(0x58)) && (CheckLocalFlag(0x63)) &&
(CheckRoomFlag(0))) {
(this->entityType).parameter = 7;
sub_0807DD80(this, &gUnk_08014A80);
}
}
}
void sub_0806C834(Entity* this) {
if ((gTextBox.doTextBox & 0x7f) == 0) {
--this->action;
InitializeAnimation(this, (this->animationState / 2) + 4);
}
}
void sub_0806C85C(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
}
}
void sub_0806C870(Entity *this)
{
u8 bVar1;
bVar1 = sub_0801E99C();
this->field_0x68 = bVar1;
sub_08078784(this, this->field_0x68);
}
void WindTribespeople_Head(Entity *this)
{
u32 uVar1;
u32 uVar2;
u8 pbVar3;
pbVar3 = (this->frames.all & 0x3F);
if (this->entityType.form == 4) {
SetExtraSpriteFrame(this, 0, 9);
SetExtraSpriteFrame(this, 1, pbVar3);
SetExtraSpriteFrame(this, 2, this->frameIndex);
SetSpriteSubEntryOffsetData2(this, 2, 0);
SetSpriteSubEntryOffsetData1(this, 2, 1);
sub_0807000C(this);
}
else {
if (this->frames.b.f2 != 0) {
uVar2 = 1;
uVar1 = 0;
}
else {
uVar2 = 0;
uVar1 = 1;
}
SetExtraSpriteFrame(this, uVar2, pbVar3);
SetExtraSpriteFrame(this, uVar1, this->frameIndex);
SetSpriteSubEntryOffsetData1(this, uVar1, uVar2);
sub_0807000C(this);
}
}
//body and head entities?
void sub_0806C90C(Entity *param_1,Entity *param_2)
{
*(u32 *)&param_2->animationState = 0;
gUnk_08113A8C[param_1->entityType.parameter](param_1, param_2);
}
void sub_0806C928(Entity *this)
{
ShowNPCDialogue(this, &gUnk_08113ABC[gUnk_02002A40.unk * 2]);
}
void sub_0806C944(Entity *this)
{
int iVar1;
int iVar2;
iVar1 = CheckGlobalFlag(0x58);
if (iVar1 == 0) {
iVar2 = 0;
}
else {
iVar1 = CheckLocalFlag(0x63);
iVar2 = 2;
if (iVar1 != 0) {
iVar2 = 1;
}
}
TextboxNoOverlap(gUnk_08113B0C[iVar2], this);
}
+201
View File
@@ -0,0 +1,201 @@
#include "global.h"
#include "entity.h"
#include "room.h"
#include "flags.h"
extern void sub_0805EA78(Entity*, u32);
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD50(Entity*);
extern void sub_0807DD94(Entity*, u32);
extern Entity* sub_0805EB9C(u32, u32);
void CopyPosition(Entity*, Entity*);
void sub_08068680(Entity*, Entity*);
void sub_08068694(Entity*, Entity*);
u32 GetAnimationState(Entity* ent);
void DeleteThisEntity(void);
extern Entity* GetEntityByType(u32, u32);
extern void sub_080686C4(Entity*, Entity*);
extern void sub_0806F62C(Entity*, u32, u32);
extern u32 sub_08003FC4(Entity*, u32);
extern void PlaySFX(u32);
extern void SetTileType(u32, u32, u32);
extern void sub_0807BA8C(u16, u32);
extern Entity gLinkEntity;
extern RoomControls gRoomControls;
extern void (*gUnk_08110BD8[])(Entity* ent);
extern u8 gUnk_02033280[];
extern u16 gUnk_08110BE0[];
void Zelda(Entity* ent) {
gUnk_08110BD8[ent->action](ent);
}
void sub_08066CCC(Entity* ent) {
ent->action = 1;
ent->spriteSettings.b.draw = 1;
sub_0805EA78(ent, 7);
sub_0805E3A0(ent, 2);
sub_0807DD50(ent);
}
void sub_08066CF8(Entity* ent) {
sub_0807DD94(ent, 0);
}
void sub_08066D04(Entity* ent) {
ent->parent = sub_0805EB9C(7, 0x2E);
}
void sub_08066D14(Entity* ent, u32* param_2) {
Entity* parent;
parent = ent->parent;
if (parent != NULL) {
ent->animationState = parent->animationState;
ent->spriteSettings.b.draw = 1;
CopyPosition(parent, ent);
sub_08068680(ent, ent->parent);
param_2[5] = 1;
} else {
param_2[5] = 0;
}
}
void sub_08066D4C(Entity* ent, u32* param_2) {
Entity* parent;
parent = ent->parent;
if (ent->parent != NULL) {
CopyPosition(ent, parent);
ent->parent->spriteSettings.b.draw = 1;
ent->parent->animationState = ent->animationState;
ent->spriteSettings.b.draw = 0;
ent->field_0x17 &= 0xFE;
sub_08068694(ent, ent->parent);
param_2[5] = 1;
} else {
param_2[5] = 0;
}
}
void sub_08066D94(Entity* ent) {
u32 roomID;
Entity* npc;
SetGlobalFlag(0x1C);
npc = CreateNPC(0x2E, 0, 0);
if (npc != NULL) {
npc->animationState = gLinkEntity.animationState;
npc->flags |= 0x20;
npc->animationState = GetAnimationState(ent);
roomID = gRoomControls.roomID;
npc->field_0x74 = roomID;
CopyPosition(ent, npc);
}
DeleteThisEntity();
}
void sub_08066DE4(Entity* ent) {
Entity* pEVar1;
pEVar1 = sub_0805EB9C(7, 0x2E);
if (pEVar1 != NULL) {
CopyPosition(ent, pEVar1);
sub_080686C4(ent, pEVar1);
}
}
void sub_08066E08(Entity* ent) {
InitAnimationForceUpdate(ent, 0x50);
ent->field_0x80 = ent->animIndex;
}
void sub_08066E20(Entity* ent) {
InitAnimationForceUpdate(ent, 0x44);
ent->field_0x80 = ent->animIndex;
}
void sub_08066E38(Entity* ent) {
InitAnimationForceUpdate(ent, 0x48);
ent->field_0x80 = ent->animIndex;
}
void sub_08066E50(Entity* ent) {
InitAnimationForceUpdate(ent, 0x4C);
ent->field_0x80 = ent->animIndex;
}
void sub_08066E68(Entity* ent) {
InitAnimationForceUpdate(ent, 0x54);
ent->field_0x80 = ent->animIndex;
}
void sub_08066E80(Entity* ent, u8* param_2) {
switch (param_2[0x18]) {
case 0:
param_2[0x18]++;
InitAnimationForceUpdate(ent, 0x16);
break;
case 1:
UpdateAnimationSingleFrame(ent);
if (ent->frames.all & 1) {
param_2[0x18]++;
ent->field_0x20 = 0x20000;
ent->frames.all &= 0xFE;
PlaySFX(0x7C);
}
break;
case 2:
sub_0806F62C(ent, 0x100, 0x80);
sub_08003FC4(ent, 0x2000);
if (!(ent->frames.all & 1)) {
UpdateAnimationSingleFrame(ent);
}
if (ent->field_0x20 < 0) {
param_2[0x18]++;
}
break;
case 3:
sub_0806F62C(ent, 0x100, 0x80);
UpdateAnimationSingleFrame(ent);
if (sub_08003FC4(ent, 0x2000) == 0) {
param_2[0x18]++;
InitAnimationForceUpdate(ent, 0x1E);
}
break;
case 4:
UpdateAnimationSingleFrame(ent);
if (ent->frames.b.f3) {
gUnk_02033280[7] |= 1;
return;
}
}
ent->field_0x80 = ent->animIndex;
gUnk_02033280[6] = 0;
}
void sub_08066F94(void) {
u16 uVar1;
u16* puVar2;
puVar2 = gUnk_08110BE0;
while (*puVar2 != 0) {
uVar1 = *puVar2;
puVar2++;
SetTileType(16498, uVar1, 1);
}
}
void sub_08066FB8(void) {
u16 uVar1;
u16* puVar2;
puVar2 = gUnk_08110BE0;
while (*puVar2 != 0) {
uVar1 = *puVar2;
puVar2++;
sub_0807BA8C(uVar1, 1);
}
}