Decompile oject48.c

This commit is contained in:
Marcus Huderle 2020-08-02 20:02:39 -05:00
parent e2bbe039de
commit c74456f175
45 changed files with 758 additions and 1512 deletions

View File

@ -1,38 +0,0 @@
.syntax unified
push {r4, lr}
adds r4, r0, #0
ldrb r1, [r4, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r1
movs r1, #1
orrs r0, r1
strb r0, [r4, #0x18]
ldrb r1, [r4, #0x1b]
movs r2, #0x3f
adds r0, r2, #0
ands r0, r1
movs r1, #0x40
orrs r0, r1
strb r0, [r4, #0x1b]
ldrb r0, [r4, #0x19]
ands r2, r0
strb r2, [r4, #0x19]
ldrh r1, [r4, #0x2e]
adds r0, r4, #0
adds r0, #0x68
strh r1, [r0]
ldrh r0, [r4, #0x32]
adds r1, r4, #0
adds r1, #0x6a
strh r0, [r1]
bl Random
movs r1, #0x1f
ands r0, r1
strb r0, [r4, #0x15]
movs r0, #0x20
strh r0, [r4, #0x24]
adds r0, r4, #0
bl GreatFairy_InitializeAnimation
pop {r4, pc}
.syntax divided

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,7 @@ typedef struct {
typedef struct Entity {
/*0x00*/ u32* field_0x0;
/*0x04*/ u32* field_0x4;
/*0x04*/ struct Entity* field_0x4;
/*0x08*/ EntityType entityType;
/*0x0c*/ u8 action;
/*0x0d*/ u8 previousActionFlag;
@ -124,13 +124,11 @@ typedef struct Entity {
/*0x5c*/ Frame* animPtr;
/*0x60*/ u16 spriteVramOffset;
/*0x62*/ u8 spriteOffsetX;
/*0x64*/ u8 spriteOffsetY;
/*0x63*/ u8 spriteOffsetY;
/*0x64*/ u32* otherEntity;
/*0x68*/ u8 field_0x68;
/*0x69*/ u8 field_0x69;
/*0x68*/ union SplitHWord field_0x68;
/*0x6a*/ union SplitHWord field_0x6a;
/*0x6c*/ u8 field_0x6c;
/*0x6d*/ u8 field_0x6d;
/*0x6c*/ union SplitHWord field_0x6c;
/*0x6e*/ u8 filler4[2];
/*0x70*/ union SplitWord field_0x70;
/*0x74*/ u16 field_0x74;
@ -171,4 +169,7 @@ extern void SetSpriteSubEntryOffsetData2(Entity*, u32, u32);
extern u32 GetFacingDirection(Entity*, Entity*);
extern void DeleteThisEntity();
extern Entity gUnk_03003DA0;
#endif

View File

@ -64,6 +64,9 @@ union SplitWord {
struct {
s16 LO, HI;
} HALF;
struct {
u8 byte0, byte1, byte2, byte3;
} BYTES;
};
union SplitHWord {

View File

@ -27,9 +27,14 @@ typedef struct {
u8 overlayType;
u8 storyPanelIndex;
u16 transitionTimer;
u8 field_0xa[8];
u8 field_0x11;
u8 field_0x12[0x16];
u8 fillerA[0x6];
u8 unk10[2];
u8 field_0x12;
u8 unk13;
u8 filler14[0x2];
u8 unk16;
u8 filler17[0x13];
u8 unk2a;
u32 field_0x2c;
} Menu;

View File

@ -170,19 +170,22 @@ extern void Phonograph(Entity*);
extern void NPC58(Entity*);
extern void NPC58_Head(Entity*);
extern u32 UpdateFuseInteraction(Entity*);
extern void ShowNPCDialogue(Entity*, u32*);
typedef struct {
/*0x000*/ u8 filler[8];
/*0x008*/ u8 unk;
/*0x009*/ u8 filler2[0x47];
/*0x050*/ u32 unk2;
/*0x051*/ u8 filler3[0x54];
/*0x0a8*/ Stats stats;
/*0x0d0*/ u8 filler4[0x3c0];
/*0x490*/ u32 unk3;
/*0x000*/ u8 filler0[0x6];
/*0x006*/ u8 unk6;
/*0x007*/ u8 unk7;
/*0x008*/ u8 unk8;
/*0x009*/ u8 field_0x9[0x34];
/*0x040*/ u32 windcrests;
/*0x044*/ u8 filler44[0xC];
/*0x050*/ u32 unk50;
/*0x054*/ u8 filler54[0x54];
/*0x0A8*/ Stats stats;
/*0x0D0*/ u8 filler4[0x3c0];
/*0x490*/ u32 unk490;
} struct_02002A40;
extern struct_02002A40 gUnk_02002A40;

View File

@ -9,5 +9,6 @@ void PositionEntityOnTop(Entity*, Entity*);
void PositionRelative(Entity*, Entity*, s32, s32);
void sub_0806FA90(Entity*, Entity*, s32, s32);
void ResolveEntityOnTop(Entity*, Entity*);
void sub_0806FAD8(Entity*, Entity*);
#endif

View File

@ -1,9 +1,9 @@
struct Input {
u16 unk0;
u16 unk1;
u16 unk2;
u8 unk3;
u8 unk4;
};
typedef struct {
u16 heldKeys;
u16 newKeys;
u16 unk4;
u8 unk6;
u8 unk7;
} Input;
// void ReadKeyInput(void);
extern Input gUnk_03000FF0;

View File

@ -6,15 +6,14 @@
#include "link.h"
typedef struct {
u8 filler[8];
u8 field_0x8;
u8 field_0x9[0x34];
u32 windcrests;
u8 field_0x44[0x64];
Stats stats;
} struct_02002A40;
char header[4];
u8 saveFile;
u8 field_0x5;
u8 brightnessPref;
u8 gameLanguage;
} struct_02000000;
extern struct_02002A40 gUnk_02002A40;
extern struct_02000000 gUnk_02000000;
typedef struct {
u8 field_0x0[8];
@ -39,5 +38,14 @@ typedef struct {
extern struct_030010A0 gUnk_030010A0;
typedef struct {
/*0x00*/ u8 unk0;
/*0x01*/ u8 filler1[0x5];
/*0x06*/ u8 unk6;
/*0x07*/ u8 unk7;
/*0x08*/ s8 unk8[0x10]; // ?? unclear know how large this is
} struct_02019EE0;
extern struct_02019EE0 gUnk_02019EE0;
#endif

View File

@ -744,7 +744,7 @@ SECTIONS {
asm/object45.o(.text);
asm/giantBookLadder.o(.text);
src/object/heartContainer.o(.text);
asm/object48.o(.text);
src/object/object48.o(.text);
src/object/object49.o(.text);
asm/object49.o(.text);
asm/backgroundCloud.o(.text);

View File

@ -83,7 +83,7 @@ void* sub_08077C54(UnkItemStruct* unk)
item->entityType.type = 8;
item->flags = 0xa0;
item->parent = (Entity*)unk;
item->field_0x68 = unk->field_0x1;
item->field_0x68.HALF.LO = unk->field_0x1;
sub_0805EA2C(item, 2);
}
return item;
@ -111,7 +111,7 @@ Entity * CreatePlayerItem(u32 subtype, u32 form, u32 parameter, u32 unk)
(ent->entityType).subtype = subtype;
(ent->entityType).form = form;
(ent->entityType).parameter = parameter;
ent->field_0x68 = unk;
ent->field_0x68.HALF.LO = unk;
sub_0805EA2C(ent, 2);
}
return ent;
@ -128,7 +128,7 @@ Entity * sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk)
(ent->entityType).subtype = subtype;
(ent->entityType).form = form;
(ent->entityType).parameter = parameter;
ent->field_0x68 = unk;
ent->field_0x68.HALF.LO = unk;
sub_0805EA2C(ent, 2);
}
return ent;

View File

@ -31,10 +31,6 @@ extern void sub_0804A720(Entity *);
extern void sub_0803CA84(Entity *, u32);
extern bool32 sub_0803CA4C(Entity *);
// Many functions
extern void UpdateAnimationSingleFrame(Entity *);
extern void InitAnimationForceUpdate(Entity *, u32);
// sub_0803C918
extern u32 sub_0803CB04(Entity *);

View File

@ -31,7 +31,7 @@ void sub_080455D4(Entity *this)
void sub_080455E4(Entity *this)
{
if ((this != this->parent) && (this->parent != NULL)) {
this->field_0x6c = this->field_0x6c & 0x7f;
this->field_0x6c.HALF.LO &= 0x7f;
this->parent->attachedEntity = this->attachedEntity;
this->attachedEntity->parent = this->parent;
}

View File

@ -2,6 +2,7 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "npc.h"
#include "structures.h"
#include "link.h"

View File

@ -1,18 +1,9 @@
#include "global.h"
#include "entity.h"
typedef struct {
u16 field_0x0;
u16 field_0x2;
u16 field_0x4;
u8 field_0x6;
u8 field_0x7;
} Input;
#include "readKeyInput.h"
void StoreKeyInput(Input *pkeyInput, u32 ioKeyInput);
extern Input gUnk_03000FF0;
void ReadKeyInput(void)
{
u32 reg = ~*(u16*)0x04000130 & 0x3FF;
@ -23,22 +14,22 @@ void ReadKeyInput(void)
void StoreKeyInput(Input *input, u32 ioKeyInput)
{
u32 difference;
u32 temp = input->field_0x0;
u32 temp = input->heldKeys;
difference = ioKeyInput & ~temp;
input->field_0x2 = difference;
input->newKeys = difference;
if (ioKeyInput == temp) {
if (--input->field_0x7 == 0) {
input->field_0x7 = 4;
input->field_0x4 = ioKeyInput;
if (--input->unk7 == 0) {
input->unk7 = 4;
input->unk4 = ioKeyInput;
}
else {
input->field_0x4 = 0;
input->unk4 = 0;
}
}
else {
input->field_0x7 = 0x14;
input->field_0x4 = difference;
input->unk7 = 0x14;
input->unk4 = difference;
}
input->field_0x0 = ioKeyInput;
input->heldKeys = ioKeyInput;
}

View File

@ -4,6 +4,7 @@
#include "entity.h"
#include "functions.h"
#include "screen.h"
#include "structures.h"
extern void (*const gUnk_081320F0[])();
@ -17,14 +18,6 @@ typedef struct {
extern struct_03000FD0 gUnk_03000FD0;
typedef struct {
char header[4];
u8 saveFile;
u8 field_0x5;
u8 brightnessPref;
u8 gameLanguage;
} struct_02000000;
typedef struct {
u8 filler[5];
u8 field_0x5;
@ -111,7 +104,7 @@ void sub_080AD474(void)
int iVar2;
u32 uVar3;
gMenu.field_0x11++;
gMenu.field_0x12++;
switch (gMenu.menuType) {
case 0:
gMenu.menuType = 1;
@ -230,7 +223,7 @@ void sub_080AD6AC(void)
switch (gMenu.overlayType) {
case 0:
if (gUnk_03000FD0.field_0x0 == 0) {
if ((gMenu.field_0x11 & 1) == 0) {
if ((gMenu.field_0x12 & 1) == 0) {
gScreen.bg2.bg0Control++;
}

View File

@ -39,7 +39,7 @@ void sub_0804B058(EntityData* dat) {
if (sub_08049D1C(uVar2) != 0) {
ent = CreateEntity(dat);
if ((ent != NULL) && ((ent->entityType).type == 3)) {
ent->field_0x6c = uVar2 | 0x80;
ent->field_0x6c.HALF.LO = uVar2 | 0x80;
}
}
} else {

View File

@ -44,8 +44,8 @@ void Anju(Entity *this)
void sub_0806C354(Entity *this)
{
this->field_0x68 = sub_0801E99C();
sub_08078784(this,this->field_0x68);
this->field_0x68.HALF.LO = sub_0801E99C();
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Anju_Fusion(Entity *this)

View File

@ -123,8 +123,8 @@ void sub_08068ADC(Entity* 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);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
sub_0807DD50(this);
}
@ -161,14 +161,14 @@ void sub_08068B84(Entity* this) {
void sub_08068BB4(Entity* this) {
u32 item = gUnk_02002A40.stats.itemOnA;
this->field_0x69 = item;
this->field_0x68.HALF.HI = item;
item = gUnk_02002A40.stats.itemOnB;
*(&this->field_0x69 + 1) = item;
*(&this->field_0x68.HALF.HI + 1) = item;
}
void sub_08068BD0(Entity* this) {
ForceEquipItem(this->field_0x69, 0);
ForceEquipItem(*(u8*)(&this->field_0x69 + 1), 1);
ForceEquipItem(this->field_0x68.HALF.HI, 0);
ForceEquipItem(*(u8*)(&this->field_0x68.HALF.HI + 1), 1);
}
void sub_08068BEC(Entity* this, u32 unused) {

View File

@ -26,7 +26,7 @@ void Carpenter(Entity* this) {
if (!LoadExtraSpriteData(this, gUnk_08110CA8 + this->entityType.form * 4))
break;
this->action = 1;
this->field_0x69 = 0;
this->field_0x68.HALF.HI = 0;
sub_0805E3A0(this, 2);
sub_0807DD64(this);
@ -34,7 +34,7 @@ void Carpenter(Entity* this) {
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
this->field_0x69 = this->animIndex;
this->field_0x68.HALF.HI = this->animIndex;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)) + 4 + (this->entityType.form * 8));
sub_0806F118(this);
} else {
@ -47,7 +47,7 @@ void Carpenter(Entity* this) {
if (!UpdateFuseInteraction(this))
break;
this->action = 1;
InitializeAnimation(this, this->field_0x69);
InitializeAnimation(this, this->field_0x68.HALF.HI);
break;
}
}

View File

@ -34,7 +34,7 @@ void sub_08068FC0(Entity* ent) {
ent->animationState = ent->entityType.parameter;
ent->nonPlanarMovement = 0x40;
ent->field_0x6d = 0xFF;
ent->field_0x6c.HALF.HI = 0xFF;
r2 = sub_0805ACC0(ent);
if (r2 == 0) {
@ -51,7 +51,7 @@ void sub_08068FC0(Entity* ent) {
*(u16*)&ent->field_0x68 = var1;
ent->field_0x6a.HWORD = r2;
}
ent->field_0x6c = sub_0801E99C(ent);
ent->field_0x6c.HALF.LO = sub_0801E99C(ent);
InitAnimationForceUpdate(ent, ent->animationState + 4);
}
@ -194,15 +194,15 @@ void sub_0806920C(Entity* ent) {
u32 var0 = gLinkState.flags.all & 0x80;
u32 var1 = -var0 >> 0x1F;
if (var1 != ent->field_0x6d) {
if (var1 != ent->field_0x6c.HALF.HI) {
if (var1 == 0) {
sub_08078778(ent);
} else {
sub_080787A8(ent, ent->field_0x6c);
sub_080787A8(ent, ent->field_0x6c.HALF.LO);
}
}
ent->field_0x6d = var1;
ent->field_0x6c.HALF.HI = var1;
}
// Check if player interacting

View File

@ -52,8 +52,8 @@ void Dampe(Entity* this) {
}
void sub_0806BE3C(Entity* this) {
this->field_0x68 = sub_0801E99C();
sub_08078784(this, this->field_0x68);
this->field_0x68.HALF.LO = sub_0801E99C();
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Dampe_Fusion(Entity* this) {

View File

@ -20,8 +20,8 @@ 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);
this->field_0x68.HALF.HI = -1;
this->field_0x68.HALF.LO = sub_0801E99C(this);
InitAnimationForceUpdate(this, this->animationState / 2);
}
@ -57,14 +57,14 @@ void sub_08065A64(Entity* this) {
u32 uVar2;
uVar2 = -(gLinkState.flags.all & 0x80) >> 0x1f;
if (uVar2 != this->field_0x69) {
if (uVar2 != this->field_0x68.HALF.HI) {
if (uVar2 == 0) {
sub_08078778(this);
} else {
sub_080787A8(this, this->field_0x68);
sub_080787A8(this, this->field_0x68.HALF.LO);
}
}
this->field_0x69 = uVar2;
this->field_0x68.HALF.HI = uVar2;
}
void sub_08065AA4(Entity* this) {

View File

@ -25,8 +25,8 @@ 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);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
sub_0807DD50(this);
}

View File

@ -38,7 +38,7 @@ void ForestMinish(Entity* this) {
if (LoadExtraSpriteData(this, &gUnk_0810A348)) {
this->action = 1;
this->spriteSettings.b.draw = TRUE;
this->field_0x69 = this->animationState = this->actionDelay << 1;
this->field_0x68.HALF.HI = this->animationState = this->actionDelay << 1;
this->actionDelay = 0;
sub_0805E3A0(this, 2);
StartCutscene(this, gUnk_08109D18[this->entityType.parameter]);
@ -66,8 +66,8 @@ void ForestMinish(Entity* this) {
}
void sub_08060090(Entity* this) {
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void ForestMinish_Head(Entity* this) {
@ -129,8 +129,8 @@ void sub_08060158(Entity *this)
this->actionDelay = 2;
iVar4 = sub_0806EDD8(this, 0x20, 0x20);
if (iVar4 < 0) {
this->animationState = this->field_0x69;
iVar4 = this->field_0x69 << 2;
this->animationState = this->field_0x68.HALF.HI;
iVar4 = this->field_0x68.HALF.HI << 2;
}
temp = (this->animationState >> 1) * 0x20 + (iVar4 >> 1) * 2;
bVar1 = gUnk_08109C98[temp];
@ -257,7 +257,7 @@ void sub_08060318(void)
void sub_08060340(void)
{
gUnk_02002A40.unk3 = gUnk_02002A40.unk2;
gUnk_02002A40.unk490 = gUnk_02002A40.unk50;
}
u32 sub_08060354(void)
@ -265,7 +265,7 @@ u32 sub_08060354(void)
u32 iVar1;
s32 iVar2;
iVar2 = gUnk_02002A40.unk2 - gUnk_02002A40.unk3;
iVar2 = gUnk_02002A40.unk50 - gUnk_02002A40.unk490;
if (CheckGlobalFlag(DRUG_1) == 0) {
if (4 < iVar2) {
return 0x8444;

View File

@ -18,8 +18,8 @@ void Gentari(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);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
sub_0807DD50(this);
break;
case 1:

View File

@ -13,8 +13,8 @@ void Librari(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = TRUE;
this->animationState = this->actionDelay;
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
sub_0805E3A0(this, 2);
sub_0807DD50(this);
break;

View File

@ -32,8 +32,8 @@ 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);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
sub_0807DD50(this);
}

View File

@ -28,8 +28,8 @@ void MayorHagen(Entity *this)
switch (this->action) {
case 0:
this->action = 1;
this->field_0x69 = 0;
this->field_0x68 = sub_0801E99C(this);
this->field_0x68.HALF.HI = 0;
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_0805E3A0(this, 2);
sub_0807DD50(this);
break;
@ -38,7 +38,7 @@ void MayorHagen(Entity *this)
if (v == 2) {
this->action = v;
this->interactType = 0;
this->field_0x69 = this->animIndex;
this->field_0x68.HALF.HI = this->animIndex;
InitAnimationForceUpdate(this,4 + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
sub_0806F118(this);
break;
@ -50,7 +50,7 @@ void MayorHagen(Entity *this)
case 2:
if (UpdateFuseInteraction(this)) {
this->action = 1;
InitAnimationForceUpdate(this, this->field_0x69);
InitAnimationForceUpdate(this, this->field_0x68.HALF.HI);
}
}
}
@ -65,7 +65,7 @@ void sub_0806CE80(Entity *this)
{
u32 v;
u32 v2;
v = gUnk_02002A40.filler[8];
v = gUnk_02002A40.unk8;
if (v == 5) {
//flippers
if (GetInventoryValue(0x46) == 0) {

View File

@ -111,8 +111,8 @@ void sub_08068780(Entity* this) {
}
void sub_08068884(Entity* this) {
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Melari_Head(Entity* this) {

View File

@ -75,13 +75,13 @@ void sub_080670B4(Entity *this)
void sub_080670E4(Entity *this)
{
ShowNPCDialogue(this, &gUnk_08110C10[gUnk_02002A40.unk * 2]);
ShowNPCDialogue(this, &gUnk_08110C10[gUnk_02002A40.unk8 * 2]);
}
void sub_08067100(Entity *this)
{
this->field_0x68 = sub_0801E99C(this);
sub_08078784(this, this->field_0x68);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Mutoh_Fusion(Entity *this)

View File

@ -125,11 +125,11 @@ void sub_08060528(Entity *this)
case 0:
this->action = 1;
this->spriteSettings.b.draw = TRUE;
this->field_0x68 = 0;
this->field_0x69 = 0;
this->field_0x68.HALF.LO = 0;
this->field_0x68.HALF.HI = 0;
this->field_0x6a.HWORD = 0;
this->field_0x6d = 0;
this->field_0x6c = sub_0801E99C(this);
this->field_0x6c.HALF.HI = 0;
this->field_0x6c.HALF.LO = sub_0801E99C(this);
sub_0807DD50(this);
break;
case 1:
@ -170,7 +170,7 @@ void sub_08060528(Entity *this)
if ((s16)this->field_0x6a.HWORD > 0x12b) {
this->field_0x6a.HWORD = 0;
this->field_0x20 = 0x20000;
this->field_0x6d = 1;
this->field_0x6c.HALF.HI = 1;
sub_080788E0(this);
sub_08004488(0x7c);
}
@ -179,8 +179,8 @@ void sub_08060528(Entity *this)
}
}
sub_08003FC4(this, 0x1800);
if (((this->field_0x6d != 0) && (this->field_0x20 == 0)) && this->height.WORD == 0) {
this->field_0x6d = 0;
if (((this->field_0x6c.HALF.HI != 0) && (this->field_0x20 == 0)) && this->height.WORD == 0) {
this->field_0x6c.HALF.HI = 0;
sub_080606C0(this);
}
if ((-1 < this->height.WORD) &&
@ -192,15 +192,15 @@ void sub_08060528(Entity *this)
void sub_080606C0(Entity *this)
{
this->field_0x6c = sub_0801E99C(this);
sub_08078784(this, this->field_0x6c);
this->field_0x6c.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x6c.HALF.LO);
}
void sub_080606D8(Entity* this)
{
s32 iVar1;
iVar1 = gUnk_02002A40.unk - 2;
iVar1 = gUnk_02002A40.unk8 - 2;
if (iVar1 < 0) {
iVar1 = 0;
}
@ -211,8 +211,8 @@ void sub_080606D8(Entity* this)
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_0810A918[gUnk_0810A66C[arg0->field_0x68.HALF.HI][arg0->field_0x68.HALF.LO] * 4 + gRoomControls.roomOriginX],
gUnk_0810A918[gUnk_0810A66C[arg0->field_0x68.HALF.HI][arg0->field_0x68.HALF.LO] * 4 + gRoomControls.roomOriginY + 2]);
gUnk_02033280.unk |= 1;
}
#endif
@ -222,6 +222,6 @@ NAKED void sub_08060700(Entity *arg0, u32 arg1) {
void sub_0806075C(Entity *this)
{
this->field_0x68 = 0xb;
this->field_0x69 = 0xff;
this->field_0x68.HALF.LO = 0xb;
this->field_0x68.HALF.HI = 0xff;
}

View File

@ -98,7 +98,7 @@ void sub_080660EC(Entity *this)
{
if (LoadExtraSpriteData(this, &gUnk_08110354) != 0) {
this->action = 1;
this->field_0x68 = sub_0801E99C(this);
this->field_0x68.HALF.LO = sub_0801E99C(this);
InitAnimationForceUpdate(this, 2);
}
}
@ -140,7 +140,7 @@ 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);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_0807DD50(this);
}
}
@ -207,7 +207,7 @@ void sub_08066274(u32 arg0)
void sub_08066288(Entity *arg0)
{
sub_08078784(arg0, arg0->field_0x68);
sub_08078784(arg0, arg0->field_0x68.HALF.LO);
}
void Smith_Fusion(Entity *this)

View File

@ -64,15 +64,15 @@ 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);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x68.HALF.LO);
sub_0807DD50(this);
}
}
void sub_08065648(Entity* this) {
if (this->interactType == 2) {
this->field_0x69 = this->action;
this->field_0x68.HALF.HI = this->action;
this->action = 4;
this->interactType = 0;
sub_0806F118(this);
@ -83,14 +83,14 @@ void sub_08065648(Entity* this) {
void sub_08065680(Entity* this) {
if (UpdateFuseInteraction() != 0) {
this->action = this->field_0x69;
this->action = this->field_0x68.HALF.HI;
InitAnimationForceUpdate(this, this->field_0x6a.HALF.LO);
}
}
void sub_080656A4(Entity* this) {
if ((gTextBox.doTextBox & 0x7F) == 0) {
this->action = this->field_0x69;
this->action = this->field_0x68.HALF.HI;
InitAnimationForceUpdate(this, this->field_0x6a.HALF.LO);
}
UpdateAnimationSingleFrame(this);
@ -98,7 +98,7 @@ void sub_080656A4(Entity* this) {
void sub_080656D4(Entity* this) {
if (this->interactType == 2) {
this->field_0x69 = this->action;
this->field_0x68.HALF.HI = this->action;
this->action = 4;
this->interactType = 0;
sub_0806F118(this);
@ -109,7 +109,7 @@ void sub_080656D4(Entity* this) {
StartCutscene(this, &gUnk_0800B41C);
goto label2;
} else {
this->field_0x69 = this->action;
this->field_0x68.HALF.HI = this->action;
this->action = 3;
this->interactType = 0;
TextboxNoOverlap(*(u32*)(*(u32*)&this->cutsceneBeh.HWORD + 4), this);

View File

@ -30,7 +30,7 @@ void Teachers(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = TRUE;
this->animationState = this->actionDelay;
this->field_0x69 = 0;
this->field_0x68.HALF.HI = 0;
sub_0805E3A0(this, 2);
sub_0807DD50(this);
}
@ -39,7 +39,7 @@ void Teachers(Entity* this) {
if (this->interactType == 2) {
this->action = 2;
this->interactType = 0;
this->field_0x69 = this->animIndex;
this->field_0x68.HALF.HI = this->animIndex;
InitializeAnimation(this,
(this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
sub_0806F118(this);
@ -50,15 +50,15 @@ void Teachers(Entity* this) {
case 2:
if (UpdateFuseInteraction(this)) {
this->action = 1;
InitializeAnimation(this, this->field_0x69);
InitializeAnimation(this, this->field_0x68.HALF.HI);
}
}
}
void sub_0806C674(Entity *this)
{
this->field_0x68 = sub_0801E99C();
sub_08078784(this, this->field_0x68);
this->field_0x68.HALF.LO = sub_0801E99C();
sub_08078784(this, this->field_0x68.HALF.LO);
}
void Teachers_Head(Entity *this)

View File

@ -39,7 +39,7 @@ void sub_0806ABFC(Entity *this)
this->animationState = this->field_0x6a.HALF.LO << 1;
animationState = this->animationState;
this->field_0x69 = animationState << 2;
this->field_0x68.HALF.HI = animationState << 2;
this->actionDelay = 0;
}
@ -48,7 +48,7 @@ void sub_0806ABFC(Entity *this)
/*void sub_0806AC3C(Entity *this) {
if (this->field_0x58 <= 3) {
s32 unk;
u8 field_0x69;
u8 field_0x68;
Entity *link = &gLinkEntity;
if (sub_080041A0(this, link, 0x18, 0x18)) {
@ -58,24 +58,24 @@ void sub_0806ABFC(Entity *this)
unk = this->animationState << 2;
}
field_0x69 = this->field_0x69;
field_0x68.HALF.HI = this->field_0x68.HALF.HI;
if (unk != field_0x69) {
if (unk != field_0x68.HALF.HI) {
s32 temp;
if (((unk - field_0x69) & 0x1f) <= 0xf) {
field_0x69--;
if (((unk - field_0x68.HALF.HI) & 0x1f) <= 0xf) {
field_0x68.HALF.HI--;
}
else {
field_0x69++;
field_0x68.HALF.HI++;
}
temp = field_0x69;
this->field_0x69 = temp & 0x1f;
temp = field_0x68.HALF.HI;
this->field_0x68.HALF.HI = temp & 0x1f;
}
if (!(this->field_0x69 & 7)) {
this->animationState = sub_0806F5B0(this->field_0x69);
if (!(this->field_0x68.HALF.HI & 7)) {
this->animationState = sub_0806F5B0(this->field_0x68.HALF.HI);
UpdateSprite(this, (this->animationState >> 1) ^ 2);
}
}

View File

@ -123,7 +123,7 @@ void sub_08061CEC(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = TRUE;
this->animationState = this->actionDelay;
this->field_0x69 = 0xff;
this->field_0x68.HALF.HI = 0xff;
uVar2 = sub_0805ACC0(this);
if (uVar2 == 0) {
this->field_0x6a.HWORD = this->x.HALF.HI;
@ -132,7 +132,7 @@ void sub_08061CEC(Entity* this) {
this->field_0x6a.HWORD = (uVar2 >> 0x10);
}
*(u16*)&this->field_0x6c = uVar2;
this->field_0x68 = sub_0801E99C(this);
this->field_0x68.HALF.LO = sub_0801E99C(this);
sub_0807DD64(this);
sub_08061D64(this);
}
@ -143,7 +143,7 @@ void sub_08061D64(Entity* this) {
this->action = 3;
this->interactType = 0;
sub_0806F118(this);
this->field_0x69 = this->animIndex;
this->field_0x68.HALF.HI = this->animIndex;
InitializeAnimation(this, (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
} else {
sub_0807DDAC(this, 0);
@ -156,7 +156,7 @@ void sub_08061D64(Entity* this) {
this->action = 2;
this->interactType = 0;
sub_08062048(this);
this->field_0x69 = this->animIndex;
this->field_0x68.HALF.HI = this->animIndex;
InitializeAnimation(this, (this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
}
}
@ -166,7 +166,7 @@ void sub_08061E24(Entity* this) {
GetNextFrame(this);
if ((gTextBox.doTextBox & 0x7f) == 0) {
this->action = 1;
InitializeAnimation(this, this->field_0x69);
InitializeAnimation(this, this->field_0x68.HALF.HI);
}
}
@ -174,13 +174,13 @@ void sub_08061E50(Entity* this) {
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
InitializeAnimation(this, this->field_0x69);
InitializeAnimation(this, this->field_0x68.HALF.HI);
}
}
void sub_08061E70(Entity* this) {
if ((this->entityType).subtype == 6) {
sub_08078784(this, this->field_0x68);
sub_08078784(this, this->field_0x68.HALF.LO);
} else {
sub_08078778(this);
}
@ -300,7 +300,7 @@ void sub_08062048(Entity *this)
int iVar1;
if ((this->entityType).subtype == 6) {
iVar1 = gUnk_02002A40.unk - 2;
iVar1 = gUnk_02002A40.unk8 - 2;
if (iVar1 < 0) {
iVar1 = 0;
}

View File

@ -78,8 +78,8 @@ void sub_0806C870(Entity *this)
u8 bVar1;
bVar1 = sub_0801E99C();
this->field_0x68 = bVar1;
sub_08078784(this, this->field_0x68);
this->field_0x68.HALF.LO = bVar1;
sub_08078784(this, this->field_0x68.HALF.LO);
}
void WindTribespeople_Head(Entity *this)
@ -122,7 +122,7 @@ void sub_0806C90C(Entity *param_1,Entity *param_2)
void sub_0806C928(Entity *this)
{
ShowNPCDialogue(this, &gUnk_08113ABC[gUnk_02002A40.unk * 2]);
ShowNPCDialogue(this, &gUnk_08113ABC[gUnk_02002A40.unk8 * 2]);
}
void sub_0806C944(Entity *this)

View File

@ -47,7 +47,7 @@ void sub_0809F514(Entity* this) {
this->action = 1;
this->actionDelay = 120;
this->spriteSettings.b.draw = 0;
*(u8*)&this->field_0x68 = 12;
this->field_0x68.HALF.LO = 12;
gRoomControls.cameraTarget = this;
gUnk_02034490 = 255;
sub_0809F7BC(this);
@ -81,7 +81,7 @@ void sub_0809F5B0(Entity* this) {
void sub_0809F5DC(Entity* this) {
this->action = 1;
this->spriteSettings.b.draw = 0;
*(u8*)&this->field_0x68 = 12;
this->field_0x68.HALF.LO = 12;
}
void sub_0809F5F0(Entity* this) {
@ -195,14 +195,8 @@ void sub_0809F7BC(Entity* this) {
}
void sub_0809F7F4(Entity* this) {
u8 cVar1;
u8* puVar2;
puVar2 = (u8*)&this->field_0x68;
*puVar2 -= 1;
if (*puVar2 == 0) {
*puVar2 = 12;
if (--this->field_0x68.HALF.LO == 0) {
this->field_0x68.HALF.LO = 12;
PlaySFX(388);
}
}

View File

@ -459,23 +459,16 @@ void sub_08087294(Entity* this) {
gUnk_081207A4[this->action](this);
}
#ifdef NON_MATCHING
void sub_080872AC(Entity* this) {
this->spriteSettings.b.draw = 1;
this->spriteOrientation.flipY = 1;
this->spriteRendering.b0 = 0;
this->field_0x68 = (u16)(this->x).HALF.HI;
this->field_0x6a = (u16)(this->y).HALF.HI;
this->spriteRendering.b3 = 0;
this->field_0x68.HWORD = this->x.HALF.HI;
this->field_0x6a.HWORD = this->y.HALF.HI;
this->direction = (u8)Random() & 0x1F;
this->nonPlanarMovement = 32;
GreatFairy_InitializeAnimation(this);
}
#else
NAKED
void sub_080872AC(Entity* this) {
asm(".include \"asm/greatFairy/sub_080872AC.inc\"");
}
#endif
//clang-format off
void (*const GreatFairy_Main[])(Entity*) = {

544
src/object/object48.c Executable file
View File

@ -0,0 +1,544 @@
#include "global.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "main.h"
#include "menu.h"
#include "npc.h"
#include "position.h"
#include "readKeyInput.h"
#include "structures.h"
extern bool32 sub_080AE008(Entity*, int, int);
extern int sub_0807A094(int);
extern u32 sub_0801D754(const u8*, u8, u8);
extern u32 sub_080041EC(int, int);
extern u32 sub_080045DA(int, int);
static bool32 sub_0808E950(void);
static void sub_0808EABC(Entity*);
static Entity* sub_0808EC80(int);
static u32 sub_0808EF6C(Entity*);
static void sub_0808EFF0(Entity*);
typedef struct {
u8 unk0;
u8 unk1;
u8 unk2;
} PACKED struct_08121CD4;
typedef struct {
u16 unk0;
u16 unk2;
u16 unk4;
u8 unk6_0 : 3;
u8 unk6_3 : 3;
u8 unk6_6 : 2;
u8 unk7;
} struct_08121D54;
extern void (*const gUnk_08121C64[])(Entity*);
extern void (*const gUnk_08121CCC[])(Entity*);
extern const int gUnk_08133368[];
extern const u8 gUnk_085A2E80[];
extern const struct_08121CD4 gUnk_08121CD4[][4];
extern const u8 gUnk_08121D10[];
extern const u8 gUnk_08121D38[][8];
extern const u16 gUnk_08121D18[][8];
extern const u8 gUnk_08121D48[];
extern const struct_08121D54 gUnk_08121D54[];
void Object48(Entity* this) {
if (this->currentHealth == 0) {
sub_0808EFF0(this);
}
gUnk_08121C64[this->entityType.form](this);
if (this->animIndex < 64) {
UpdateAnimationSingleFrame(this);
}
}
void sub_0808E7D8(Entity* this) {
gUnk_08121CCC[this->action](this);
}
void sub_0808E7F0(Entity* this) {
sub_080AE008(this, 1, 2);
this->palette.b.b0 = 0xF;
this->spriteSettings.b.draw = 0;
this->entityType.parameter = 0xFF;
this->action = 1;
}
void sub_0808E818(Entity* this) {
u32 var0;
u32 var1;
if (!sub_0808E950()) {
int var2 = -1;
this->entityType.parameter = var2;
this->field_0x68.HWORD = var2;
this->field_0x6a.HWORD = var2;
this->spriteSettings.b.draw = 0;
return;
}
if (this->entityType.parameter != gUnk_02019EE0.unk6) {
this->entityType.parameter = gUnk_02019EE0.unk6;
this->field_0x68.HWORD = CheckGlobalFlag(EZERO_1ST) == 0 ? 0x400 : 0x100;
this->field_0x70.BYTES.byte0 = 4;
this->animationState = 2;
var1 = gUnk_08133368[sub_0807A094(1) - 22] & 0xFFFFFF;
sub_0801D754(&gUnk_085A2E80[var1], 31, 1);
}
if (gUnk_02032EC0.transitionType == 0) {
if (gUnk_03000FF0.heldKeys & L_BUTTON) {
switch (gUnk_03000FF0.newKeys) {
case DPAD_UP:
this->animationState = 0;
break;
case DPAD_RIGHT:
this->animationState = 1;
break;
case DPAD_DOWN:
this->animationState = 2;
break;
case DPAD_LEFT:
this->animationState = 3;
break;
case B_BUTTON:
this->field_0x70.BYTES.byte0 = this->field_0x70.BYTES.byte0 ? 0 : 4;
break;
}
}
}
this->spriteSettings.b.flipX = this->animationState == 3;
var0 = this->field_0x68.HWORD + this->field_0x70.BYTES.byte0 + this->animationState;
if (this->field_0x6a.HWORD != var0) {
this->field_0x6a.HWORD = var0;
this->spriteIndex = var0 >> 8;
InitAnimationForceUpdate(this, (u8)var0);
}
this->spriteSettings.b.draw = 2;
}
static bool32 sub_0808E950(void) {
bool32 result = FALSE;
switch (gUnk_02032EC0.transitionType) {
case 0:
case 4:
case 5:
case 6:
case 7:
result = gUnk_02019EE0.unk8[gUnk_02019EE0.unk6] == 1;
break;
}
return result;
}
void sub_0808E988(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->spriteIndex = 0x142;
this->entityType.parameter = 0xFF;
sub_080AE008(this, 1, 3);
}
if (sub_0808E950()) {
int i;
for (i = 6; i != 0; i--) {
if (GetInventoryValue(i)) {
break;
}
}
if (i != 0) {
if (this->entityType.parameter != i) {
InitAnimationForceUpdate(this, i);
}
this->spriteSettings.b.draw = 2;
return;
}
}
this->spriteSettings.b.draw = 0;
}
void sub_0808E9F4(Entity* this) {
if (sub_0808E950() && gUnk_02002A40.unk6) {
this->spriteSettings.b.draw = 2;
} else {
this->spriteSettings.b.draw = 0;
}
}
void sub_0808EA28(Entity* this) {
u32 var0;
u32 var1;
if (this->entityType.form == 3) {
if (((struct_02000000 *)0x2000000)->gameLanguage > 1) {
this->spriteSettings.b.draw = 2;
} else {
this->spriteSettings.b.draw = 0;
}
}
if (this->entityType.form == gUnk_02019EE0.unk6) {
var0 = 12;
var1 = 1;
} else {
if (gUnk_02032EC0.transitionType == 5 && this->entityType.form == gUnk_02019EE0.unk7) {
var0 = 13;
var1 = 2;
} else {
var0 = 14;
var1 = 2;
}
}
this->palette.b.b0 = var0;
this->spriteRendering.b3 = var1;
sub_0808EABC(this);
gUnk_02019EE0.unk0 |= sub_0808EF6C(this);
}
void sub_0808EABC(Entity* this) {
int var0 = -72;
int var1 = this->entityType.form * 32 + 40;
int var2 = gUnk_02019EE0.unk6 == this->entityType.form;
switch (gUnk_02032EC0.transitionType) {
case 0:
var0 = 24;
break;
case 3:
case 4:
case 6:
case 7:
if (var2) {
var0 = 42;
var1 = 56;
}
break;
case 5:
switch (gMenu.unk10[this->entityType.form]) {
case 0:
var0 = 42;
var1 = 40;
break;
case 1:
case 2:
var0 = 20;
var1 = 144;
var1 -= (gMenu.unk16 - gMenu.unk10[this->entityType.form]) * 32;
break;
}
break;
case 2:
if (var2) {
var0 = 26;
var1 = 42;
}
break;
default:
if (var2) {
var0 = 8;
var1 = 35;
}
break;
}
this->field_0x68.HWORD = var0;
this->field_0x6a.HWORD = var1;
}
void sub_0808EB74(Entity* this) {
Entity* entity = sub_0808EC80(gUnk_02019EE0.unk6);
if (entity) {
this->x.WORD = entity->x.WORD;
this->y.WORD = entity->y.WORD;
this->spriteRendering.b3 = entity->spriteRendering.b3;
sub_0806FAD8(entity, this);
} else {
this->x.HALF.HI = 0xF000;
this->y.HALF.HI = 0xF000;
}
}
void sub_0808EBB8(Entity* this) {
u32 var0;
u32 x, y;
Entity* entity;
switch (gUnk_02032EC0.transitionType) {
case 4:
var0 = gMenu.field_0x1 + 4;
break;
case 5:
var0 = 2;
break;
case 6:
var0 = gMenu.field_0x1 == 0 ? 7 : 6;
break;
case 7:
var0 = 4;
break;
case 2:
var0 = 1;
break;
default:
var0 = 0;
break;
}
x = y = 0xF000;
switch (var0) {
case 0:
break;
case 1:
y = ((struct_02000000 *)0x2000000)->gameLanguage * 16 + 24;
x = 112;
break;
case 2:
var0 = gUnk_02019EE0.unk7;
if (var0 == 4) {
var0 = 7;
}
// Fall through
default:
entity = sub_0808EC80(var0);
if (entity) {
sub_0806FAD8(entity, this);
this->spriteRendering.b3 = entity->spriteRendering.b3;
x = entity->x.HALF.HI;
y = entity->y.HALF.HI;
}
break;
}
this->x.HALF.HI = x;
this->y.HALF.HI = y;
}
static Entity* sub_0808EC80(int form) {
Entity* entityA = &gUnk_03003DA0;
Entity* entityB = entityA->field_0x4;
while (entityB != entityA) {
if ((entityB->entityType.type == 0x6 && entityB->entityType.subtype == 0x48) &&
form == entityB->entityType.form) {
return entityB;
}
entityB = entityB->field_0x4;
}
return NULL;
}
void sub_0808ECBC(Entity* this) {
int var0;
int var1;
int var2;
const struct_08121CD4* var3;
var0 = gMenu.field_0x1;
switch (gUnk_02032EC0.transitionType) {
case 4:
var1 = 1;
break;
case 5:
var0 = gUnk_02019EE0.unk7;
var1 = 2;
break;
case 6:
var1 = 3;
break;
case 7:
var1 = 4;
break;
default:
var1 = 0;
break;
}
var2 = this->entityType.form - 4;
var3 = &gUnk_08121CD4[var1][var2];
this->field_0x68.HWORD = var3->unk1;
this->field_0x6a.HWORD = var3->unk2;
if (var3->unk0 == var0) {
this->palette.b.b0 = 13;
} else {
this->palette.b.b0 = 14;
}
gUnk_02019EE0.unk0 |= sub_0808EF6C(this);
}
void sub_0808ED64(Entity* this) {
int y = 255;
if (gUnk_02032EC0.transitionType == 1 && gMenu.unk10[1] != 5) {
this->x.HALF.HI = gMenu.unk10[0] * 16 + 28;
y = gMenu.unk10[1] * 16 + 58;
}
this->y.HALF.HI = y;
}
void sub_0808ED98(Entity* this) {
int y;
if (gUnk_02032EC0.transitionType != 1) {
this->field_0x68.HWORD = 27;
y = -10;
} else {
u32 var0 = gMenu.unk13;
if (var0 > 5) {
var0 = 5;
}
this->field_0x68.HWORD = var0 * 8 + 27;
y = 24;
}
this->y.HALF.HI = y;
this->field_0x6a.HWORD = y;
this->field_0xf++;
this->spriteOffsetY = gUnk_08121D10[(this->field_0xf / 4) & 0x7];
sub_0808EF6C(this);
}
void sub_0808EE00(Entity* this) {
int var0, var1, var2;
var0 = ((struct_02000000 *)0x2000000)->gameLanguage != 0;
var1 = this->entityType.form - 10;
this->frameIndex = gUnk_08121D38[var0][var1];
this->x.HALF.HI = gUnk_08121D18[var0][var1];
this->field_0x68.HWORD = gUnk_08121D18[var0][var1];
var1 -= var0;
if (gUnk_02032EC0.transitionType != 1) {
var1 = 128;
var2 = 176;
} else {
var2 = 140;
}
this->field_0x6a.HWORD = var2;
this->palette.b.b0 = gMenu.unk10[1] == 5 && var1 == gMenu.field_0x12 ? 11 : 9;
gUnk_02019EE0.unk0 |= sub_0808EF6C(this);
}
void nullsub_522(Entity* this) {
}
void sub_0808EE98(Entity* this) {
this->actionDelay = gUnk_02032EC0.transitionType;
this->frameIndex = gUnk_08121D48[this->actionDelay];
if (this->actionDelay != 2) {
this->field_0x68.HWORD = 96;
} else {
this->field_0x68.HWORD = -96;
}
sub_0808EF6C(this);
}
void sub_0808EED8(Entity* this) {
int var0;
if (gUnk_02032EC0.transitionType != 3) {
this->spriteSettings.b.draw = 0;
} else {
this->spriteSettings.b.draw = 2;
var0 = this->entityType.form - 19;
this->palette.b.b0 = gMenu.field_0x1 == var0 ? 4 : 3;
}
}
void sub_0808EF24(Entity* this) {
int var0;
if (gUnk_02032EC0.transitionType != 3) {
this->spriteSettings.b.draw = 0;
} else {
this->spriteSettings.b.draw = 2;
if (this->entityType.form == 21) {
var0 = ((struct_02000000 *)0x2000000)->field_0x5;
} else {
var0 = ((struct_02000000 *)0x2000000)->brightnessPref;
}
this->frameIndex = this->lastFrameIndex + var0;
}
}
static u32 sub_0808EF6C(Entity* this) {
int var0;
u32 var1;
int var2;
u32 var3;
int var4;
s16 var5;
s16 var6;
int var7;
var6 = this->field_0x68.HWORD;
var0 = var6 - this->x.HALF.HI;
var1 = var0;
if (var0 < 0) {
var1 = -var0;
}
if (var1 < 2) {
this->x.WORD = var6 << 16;
var0 = 0;
}
var5 = this->field_0x6a.HWORD;
var2 = var5 - this->y.HALF.HI;
var3 = var2;
if (var2 < 0) {
var3 = -var2;
}
if (var3 < 2) {
this->y.WORD = var5 << 16;
var2 = 0;
}
if ((var0 | var2) == 0) {
return 0;
}
var4 = var7 = sub_080041EC(var0, var2);
var4 += 128;
var7 = var4 + var7 * 16;
if (this->field_0x6c.HWORD < var7) {
var7 = this->field_0x6c.HWORD;
}
this->nonPlanarMovement = var7;
this->direction = sub_080045DA(var0, var2) >> 3;
sub_0806F69C(this);
return 1;
}
static void sub_0808EFF0(Entity* this) {
const struct_08121D54* var0;
int var1;
this->spriteSettings.b.draw = 2;
this->nonPlanarMovement = 0x400;
this->currentHealth = 1;
this->frameIndex = 0xFF;
this->animIndex = 0xFF;
var0 = &gUnk_08121D54[this->entityType.form];
this->x.HALF.HI = var0->unk2;
this->field_0x68.HWORD = var0->unk2;
this->y.HALF.HI = var0->unk4;
this->field_0x6a.HWORD = var0->unk4;
this->spriteRendering.b3 = var0->unk6_0;
this->spritePriority.b0 = var0->unk6_3;
this->spriteOrientation.flipY = var0->unk6_6;
this->field_0x6c.HWORD = var0->unk0;
var1 = var0->unk7;
if (var1 & 0x80) {
var1 &= 0x7F;
this->frameIndex = var1;
this->lastFrameIndex = var1;
} else {
InitAnimationForceUpdate(this, var1);
}
}

View File

@ -114,7 +114,7 @@ void sub_0808F244(Entity *this)
*(u32 *)&this->field_0x78 = 0x100 - this->parent->height.HALF.HI;
*(u32 *)&this->field_0x70.WORD = *((u8 *)&this->parent->field_0x7c + 3);
sub_0808F2B0(this);
if ((this->parent->field_0x6d & 2) != 0) {
if ((this->parent->field_0x6c.HALF.HI & 2) != 0) {
DeleteThisEntity();
}
}

View File

@ -4,6 +4,7 @@
#include "room.h"
#include "functions.h"
#include "flags.h"
#include "npc.h"
#include "link.h"
#include "screen.h"
#include "main.h"
@ -345,7 +346,7 @@ extern EntityData gUnk_080D6734;
extern EntityData gUnk_080D66F4;
void sub_0804B738(void) {
if (gUnk_02002A40.field_0x8 > 4) {
if (gUnk_02002A40.unk8 > 4) {
LoadRoomEntityList(&gUnk_080D6714);
}
// flippers
@ -363,7 +364,7 @@ u32 sub_0804B788() {
extern EntityData gUnk_080D6924;
void sub_0804B78C(void) {
if (gUnk_02002A40.field_0x8 > 7) {
if (gUnk_02002A40.unk8 > 7) {
LoadRoomEntityList(&gUnk_080D6924);
}
}
@ -465,7 +466,7 @@ extern EntityData UpperInn_Din;
void sub_0804B938(void) {
int iVar1;
if (gUnk_02002A40.field_0x8 < 4)
if (gUnk_02002A40.unk8 < 4)
return;
if (CheckGlobalFlag(RENTED_HOUSE_DIN)) {
@ -515,7 +516,7 @@ u32 sub_0804BA08() {
extern EntityData gUnk_080D7038;
void sub_0804BA0C(void) {
if (gUnk_02002A40.field_0x8 < 8) {
if (gUnk_02002A40.unk8 < 8) {
LoadRoomEntityList(&gUnk_080D7038);
}
if (gRoomVars.filler[0] == 0) {
@ -535,13 +536,13 @@ extern EntityData gUnk_080D71F0;
void sub_0804BA44(void) {
if (gUnk_02002A40.field_0x8 == 6)
if (gUnk_02002A40.unk8 == 6)
LoadRoomEntityList(&gUnk_080D7140);
if (gUnk_02002A40.field_0x8 == 7)
if (gUnk_02002A40.unk8 == 7)
LoadRoomEntityList(&gUnk_080D7170);
if ((gUnk_02002A40.field_0x8 < 8) || (LoadRoomEntityList(&gUnk_080D71A0), gUnk_02002A40.field_0x8 < 8))
if ((gUnk_02002A40.unk8 < 8) || (LoadRoomEntityList(&gUnk_080D71A0), gUnk_02002A40.unk8 < 8))
LoadRoomEntityList(&gUnk_080D71D0);
else
LoadRoomEntityList(&gUnk_080D71F0);
@ -1449,7 +1450,7 @@ extern EntityData gUnk_080DB238;
void sub_0804C664(void) {
if (gUnk_02002A40.field_0x8 > 8)
if (gUnk_02002A40.unk8 > 8)
LoadRoomEntityList(&gUnk_080DB238);
sub_0801AFE4();
@ -2120,10 +2121,10 @@ u32 sub_0804CC6C() {
}
void sub_0804CC70(void) {
if (gUnk_02002A40.filler[7] == 0) {
if (gUnk_02002A40.unk7 == 0) {
goto a;
}
if (gUnk_02002A40.filler[7] != 2) {
if (gUnk_02002A40.unk7 != 2) {
a:
SetTileType(0x90, 0x20b, 1);
SetTileType(0x90, 0x411, 1);
@ -4233,7 +4234,7 @@ void LoadHyruleTown(void) {
sub_08054570();
sub_08059D18();
SetTileType(0x176, 0x66b, 1);
if (gUnk_02002A40.field_0x8 == 1) {
if (gUnk_02002A40.unk8 == 1) {
sub_0801D000(0);
} else {
sub_08018C58(0xdb4);
@ -4258,7 +4259,7 @@ void LoadHyruleTown(void) {
} else {
LoadRoomEntityList(&gUnk_080EECBC);
}
if (CheckKinstoneFused(0x1b) && (gUnk_02002A40.field_0x8 > 3)) {
if (CheckKinstoneFused(0x1b) && (gUnk_02002A40.unk8 > 3)) {
if (!CheckGlobalFlag(NEW_HOUSE_DIN) && !CheckGlobalFlag(NEW_HOUSE_NAYRU) && !CheckGlobalFlag(NEW_HOUSE_FARORE)) {
if (!CheckGlobalFlag(RENTED_HOUSE_DIN) && !CheckGlobalFlag(RENTED_HOUSE_NAYRU) && !CheckGlobalFlag(RENTED_HOUSE_FARORE)) {
LoadRoomEntityList(&gUnk_080EE95C);
@ -4282,7 +4283,7 @@ void LoadHyruleTown(void) {
} else {
LoadRoomEntityList(&gUnk_080EE9DC);
}
if ((gUnk_02002A40.field_0x8 > 4) && !CheckKinstoneFused(0xb) &&
if ((gUnk_02002A40.unk8 > 4) && !CheckKinstoneFused(0xb) &&
(CheckGlobalFlag(RENTED_HOUSE_DIN) || CheckGlobalFlag(RENTED_HOUSE_NAYRU) || CheckGlobalFlag(RENTED_HOUSE_FARORE))) {
LoadRoomEntityList(&gUnk_080EEA5C);
}
@ -4290,10 +4291,10 @@ void LoadHyruleTown(void) {
if (!CheckLocalFlag(0xd0) && GetInventoryValue(0x14)) {
LoadRoomEntityList(&gUnk_080EEABC);
}
if ((gUnk_02002A40.field_0x8 > 3) && CheckGlobalFlag(INLOCK)) {
if ((gUnk_02002A40.unk8 > 3) && CheckGlobalFlag(INLOCK)) {
LoadRoomEntityList(&gUnk_080EEA7C);
}
if ((gUnk_02002A40.field_0x8 < 6) && !CheckGlobalFlag(MIZUKAKI_START)) {
if ((gUnk_02002A40.unk8 < 6) && !CheckGlobalFlag(MIZUKAKI_START)) {
LoadRoomEntityList(&gUnk_080EEA9C);
}
if ((gUnk_02002A40.windcrests & 0x8000000) == 0) {
@ -4552,7 +4553,7 @@ extern EntityData gUnk_080F236C;
void sub_0804E52C(void)
{
if (gUnk_02002A40.field_0x8 > 7) {
if (gUnk_02002A40.unk8 > 7) {
LoadRoomEntityList(&gUnk_080F23BC);
}
// flippers
@ -4575,7 +4576,7 @@ extern EntityData gUnk_080F2600;
void sub_0804E574(void)
{
switch (gUnk_02002A40.field_0x8) {
switch (gUnk_02002A40.unk8) {
case 0:
case 2:
case 4:
@ -4816,7 +4817,7 @@ void sub_0804E8FC(void)
if (!CheckGlobalFlag(INLOCK)) {
LoadRoomEntityList(&gUnk_080F36FC);
}
else if (gUnk_02002A40.field_0x8 < 4) {
else if (gUnk_02002A40.unk8 < 4) {
LoadRoomEntityList(&gUnk_080F3604);
}
}
@ -4882,7 +4883,7 @@ void sub_0804E9D0(void)
if (CheckKinstoneFused(0x12)) {
LoadRoomEntityList(&gUnk_080F3C94);
}
if ((gUnk_02002A40.field_0x8 > 3) && CheckGlobalFlag(TINGLE_TALK1ST)) {
if ((gUnk_02002A40.unk8 > 3) && CheckGlobalFlag(TINGLE_TALK1ST)) {
LoadRoomEntityList(&gUnk_080F3C44);
}
SetTile(0x4091, 0x590, 1);
@ -5270,7 +5271,7 @@ extern u32 gUnk_08011C50;
void sub_0804EFF8(void)
{
if (gUnk_02002A40.field_0x8 > 7) {
if (gUnk_02002A40.unk8 > 7) {
LoadRoomEntityList(&gUnk_080F5DD0);
}
if (CheckGlobalFlag(MAROYA_WAKEUP)) {
@ -5302,7 +5303,7 @@ extern EntityData gUnk_080F5F78;
void sub_0804F050(void)
{
if (gUnk_02002A40.field_0x8 > 4) {
if (gUnk_02002A40.unk8 > 4) {
LoadRoomEntityList(&gUnk_080F5F38);
}
if (!CheckLocalFlag(0x92)) {
@ -5503,7 +5504,7 @@ void sub_0804F25C(void)
if ((gUnk_02002A40.windcrests & 0x40000000) == 0) {
LoadRoomEntityList(&gUnk_080F70D8);
}
if (gUnk_02002A40.field_0x8 > 3) {
if (gUnk_02002A40.unk8 > 3) {
LoadRoomEntityList(&gUnk_080F7088);
}
}
@ -5549,7 +5550,7 @@ extern EntityData gUnk_080F7550;
void sub_0804F330(void)
{
sub_0805ADD8(0);
if (gUnk_02002A40.field_0x8 > 3) {
if (gUnk_02002A40.unk8 > 3) {
LoadRoomEntityList(&gUnk_080F7500);
}
if (GetInventoryValue(0x11) && !GetInventoryValue(0x12)) {
@ -5591,7 +5592,7 @@ void sub_0804F3B0(void)
SetTile(0x4072, 0xd88, 1);
SetTile(0x4096, 0xdc8, 1);
}
if ((gUnk_02002A40.field_0x8 > 3) && CheckGlobalFlag(TINGLE_TALK1ST)) {
if ((gUnk_02002A40.unk8 > 3) && CheckGlobalFlag(TINGLE_TALK1ST)) {
LoadRoomEntityList(&gUnk_080F78A0);
}
}
@ -5818,7 +5819,7 @@ extern EntityData gUnk_080F806C;
void sub_0804FA00(void) {
sub_0805ADD8(0);
if ((gUnk_02002A40.field_0x8 > 3) && CheckGlobalFlag(TINGLE_TALK1ST)) {
if ((gUnk_02002A40.unk8 > 3) && CheckGlobalFlag(TINGLE_TALK1ST)) {
LoadRoomEntityList(&gUnk_080F806C);
}
}
@ -6547,14 +6548,6 @@ u32 sub_0804FF7C() {
void nullsub_106() {}
typedef struct {
char header[4];
u8 saveFile;
u8 field_0x5;
u8 brightnessPref;
} struct_02000000;
extern struct_02000000 gUnk_02000000;
void sub_0804FF84(u32 arg0)
{

View File

@ -1,7 +1,9 @@
#include "global.h"
extern u8 gUnk_020176E0;
extern void sub_0807C960();
extern u32 sub_0801D754(u32, u8, u8);
extern u32 sub_0801D754(const u8*, u8, u8);
u32 sub_0807C9D8(u32* a1) {
u32* v1; // r5@1
@ -10,6 +12,6 @@ u32 sub_0807C9D8(u32* a1) {
sub_0807C960(0x6004000, *a1);
sub_0807C960(0x6000000, v1[1]);
sub_0807C960(0x6008000, v1[2]);
sub_0807C960(0x20176E0, v1[3]);
return sub_0801D754(0x20176E0, 2, 13);
sub_0807C960(&gUnk_020176E0, v1[3]);
return sub_0801D754(&gUnk_020176E0, 2, 13);
}

View File

@ -29,7 +29,7 @@ void sub_080A3BD0(void)
s32 iVar2;
gMenu.field_0x1 = 1;
gMenu.field_0x12[0x17] = 0;
gMenu.unk2a = 0;
sub_080A4D34();
LoadPalettesByPaletteGroupIndex(0xcb);
sub_0801D7EC(0x75);