mirror of
https://github.com/zeldaret/tmc
synced 2026-06-22 00:46:48 -04:00
Merge branch 'master' of https://github.com/zeldaret/tmc
This commit is contained in:
+136
-176
@@ -1,30 +1,21 @@
|
||||
#include "global.h"
|
||||
#include "entity.h"
|
||||
#include "textbox.h"
|
||||
|
||||
typedef struct {
|
||||
u8 filler[8];
|
||||
u8 unk;
|
||||
} SaveFile;
|
||||
#include "functions.h"
|
||||
|
||||
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);
|
||||
|
||||
@@ -33,193 +24,162 @@ extern void (*const gUnk_0811036C[])(Entity*);
|
||||
|
||||
extern u16 gUnk_08110380[];
|
||||
extern SpriteLoadData gUnk_08110354;
|
||||
extern SaveFile gUnk_02002A40;
|
||||
extern u32 gUnk_08110390[];
|
||||
extern Dialog 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, &gPlayerEntity));
|
||||
InitAnimationForceUpdate(this, iVar2 + iVar4);
|
||||
sub_0806F118(this);
|
||||
void Smith(Entity* this) {
|
||||
u32 index;
|
||||
|
||||
if ((this->flags & 2) != 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);
|
||||
}
|
||||
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)]);
|
||||
}
|
||||
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)
|
||||
{
|
||||
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.HALF.LO = 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;
|
||||
this->action = 1;
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
InitAnimationForceUpdate(this, 2);
|
||||
}
|
||||
else {
|
||||
--this->field_0xf;
|
||||
uVar1 = this->animIndex;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (sub_0806F078(this, uVar1) == 0) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
}
|
||||
if (this->interactType != 0) {
|
||||
this->action = 2;
|
||||
TextboxNoOverlapFollow(0);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_08066170(Entity *this)
|
||||
{
|
||||
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.HALF.LO = sub_0801E99C(this);
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
void sub_08066178(Entity* this) {
|
||||
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
|
||||
this->action = 1;
|
||||
this->spriteSettings.b.draw = 1;
|
||||
this->field_0x68.HALF.LO = sub_0801E99C(this);
|
||||
sub_0807DD50(this);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_080661B0(Entity *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.HWORD = GetAnimationState(this) + 8;
|
||||
InitAnimationForceUpdate(this, this->field_0x80.HWORD);
|
||||
void sub_080661BC(Entity* this) {
|
||||
u32 sVar1;
|
||||
|
||||
if (this->animIndex == 0xc) {
|
||||
UpdateAnimationSingleFrame(this);
|
||||
if ((this->frames.b.f3) != 0) {
|
||||
this->field_0x80.HWORD = GetAnimationState(this) + 8;
|
||||
InitAnimationForceUpdate(this, this->field_0x80.HWORD);
|
||||
}
|
||||
} else {
|
||||
sub_0807DD94(this, 0);
|
||||
}
|
||||
}
|
||||
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.HALF.LO);
|
||||
}
|
||||
|
||||
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 {
|
||||
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 index;
|
||||
|
||||
if (gUnk_02002A40.unk8 - 2 < 0) {
|
||||
index = 0;
|
||||
} else {
|
||||
index = gUnk_02002A40.unk8 - 2;
|
||||
}
|
||||
ShowNPCDialogue(this, &gUnk_08110390[index]);
|
||||
}
|
||||
|
||||
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.HALF.LO);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user