summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortheo3 <arisstephenson2@gmail.com>2020-08-04 17:18:59 -0700
committertheo3 <arisstephenson2@gmail.com>2020-08-04 17:18:59 -0700
commit2575c0a63df8770448f92a177a3f45634d7ce45e (patch)
treeb69c2fe1bc3a4cd0178fb8b47c9e6595ab9f41ca /src
parent7f7b74cfd5874da1e7bc75756319a38d6fd94660 (diff)
parent765047808cf2306fe6130c316213aaf0aab1d0cf (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src')
-rw-r--r--src/code_08077B98.c6
-rw-r--r--src/enemy/lakitu.c4
-rw-r--r--src/enemy/miniFireballGuy.c2
-rw-r--r--src/enemy/rupeeLike.c1
-rw-r--r--src/input.c29
-rw-r--r--src/introSetTransition.c13
-rw-r--r--src/loadRoom.c2
-rw-r--r--src/npc/anju.c4
-rw-r--r--src/npc/bladeBrothers.c12
-rw-r--r--src/npc/carpenter.c6
-rw-r--r--src/npc/cow.c10
-rw-r--r--src/npc/dampe.c4
-rw-r--r--src/npc/epona.c10
-rw-r--r--src/npc/festari.c4
-rw-r--r--src/npc/forestMinish.c14
-rw-r--r--src/npc/gentari.c4
-rw-r--r--src/npc/librari.c4
-rw-r--r--src/npc/malon.c4
-rw-r--r--src/npc/mayorHagen.c10
-rw-r--r--src/npc/melari.c4
-rw-r--r--src/npc/mutoh.c6
-rw-r--r--src/npc/postman.c28
-rw-r--r--src/npc/smith.c6
-rw-r--r--src/npc/talon.c14
-rw-r--r--src/npc/teachers.c10
-rw-r--r--src/npc/townMinish.c22
-rw-r--r--src/npc/townsperson.c16
-rw-r--r--src/npc/windTribespeople.c6
-rw-r--r--src/object/cloud.c14
-rw-r--r--src/object/greatFairy.c13
-rwxr-xr-xsrc/object/object48.c544
-rw-r--r--src/object/object49.c2
-rw-r--r--src/room.c59
-rw-r--r--src/sub_0801D754.c8
-rw-r--r--src/sub_080A3B84.c2
35 files changed, 702 insertions, 195 deletions
diff --git a/src/code_08077B98.c b/src/code_08077B98.c
index c908595b..a29e2c22 100644
--- a/src/code_08077B98.c
+++ b/src/code_08077B98.c
@@ -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;
diff --git a/src/enemy/lakitu.c b/src/enemy/lakitu.c
index 9189c525..146523f0 100644
--- a/src/enemy/lakitu.c
+++ b/src/enemy/lakitu.c
@@ -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 *);
diff --git a/src/enemy/miniFireballGuy.c b/src/enemy/miniFireballGuy.c
index d7bdc540..820381c4 100644
--- a/src/enemy/miniFireballGuy.c
+++ b/src/enemy/miniFireballGuy.c
@@ -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;
}
diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c
index 009b8789..cbd991c4 100644
--- a/src/enemy/rupeeLike.c
+++ b/src/enemy/rupeeLike.c
@@ -2,6 +2,7 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
+#include "npc.h"
#include "structures.h"
#include "link.h"
diff --git a/src/input.c b/src/input.c
index df5b2290..438a6e6b 100644
--- a/src/input.c
+++ b/src/input.c
@@ -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;
} \ No newline at end of file
diff --git a/src/introSetTransition.c b/src/introSetTransition.c
index 32bb02c3..33f0e62c 100644
--- a/src/introSetTransition.c
+++ b/src/introSetTransition.c
@@ -4,6 +4,7 @@
#include "entity.h"
#include "functions.h"
#include "screen.h"
+#include "structures.h"
extern void (*const gUnk_081320F0[])();
@@ -18,14 +19,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;
} struct_02000010;
@@ -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++;
}
diff --git a/src/loadRoom.c b/src/loadRoom.c
index ebc66264..86749a52 100644
--- a/src/loadRoom.c
+++ b/src/loadRoom.c
@@ -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 {
diff --git a/src/npc/anju.c b/src/npc/anju.c
index e1b7e4e8..19e5a7a2 100644
--- a/src/npc/anju.c
+++ b/src/npc/anju.c
@@ -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)
diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c
index 71456fe1..09c942e7 100644
--- a/src/npc/bladeBrothers.c
+++ b/src/npc/bladeBrothers.c
@@ -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) {
diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c
index b0608f6d..bbf9a1ed 100644
--- a/src/npc/carpenter.c
+++ b/src/npc/carpenter.c
@@ -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;
}
}
diff --git a/src/npc/cow.c b/src/npc/cow.c
index e9df0918..ed448997 100644
--- a/src/npc/cow.c
+++ b/src/npc/cow.c
@@ -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
diff --git a/src/npc/dampe.c b/src/npc/dampe.c
index b7947c32..8e9707a7 100644
--- a/src/npc/dampe.c
+++ b/src/npc/dampe.c
@@ -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) {
diff --git a/src/npc/epona.c b/src/npc/epona.c
index 617867b6..51e2da86 100644
--- a/src/npc/epona.c
+++ b/src/npc/epona.c
@@ -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) {
diff --git a/src/npc/festari.c b/src/npc/festari.c
index ff64ccd6..b362359e 100644
--- a/src/npc/festari.c
+++ b/src/npc/festari.c
@@ -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);
}
diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c
index 8fb7da7b..32b9c77a 100644
--- a/src/npc/forestMinish.c
+++ b/src/npc/forestMinish.c
@@ -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;
diff --git a/src/npc/gentari.c b/src/npc/gentari.c
index f41a7438..31b3bdc4 100644
--- a/src/npc/gentari.c
+++ b/src/npc/gentari.c
@@ -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:
diff --git a/src/npc/librari.c b/src/npc/librari.c
index 77b48bb6..5725f1ea 100644
--- a/src/npc/librari.c
+++ b/src/npc/librari.c
@@ -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;
diff --git a/src/npc/malon.c b/src/npc/malon.c
index de484cc4..4a599435 100644
--- a/src/npc/malon.c
+++ b/src/npc/malon.c
@@ -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);
}
diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c
index 1eb0ff64..bedf82be 100644
--- a/src/npc/mayorHagen.c
+++ b/src/npc/mayorHagen.c
@@ -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) {
diff --git a/src/npc/melari.c b/src/npc/melari.c
index ae906fd5..a4cce8f6 100644
--- a/src/npc/melari.c
+++ b/src/npc/melari.c
@@ -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) {
diff --git a/src/npc/mutoh.c b/src/npc/mutoh.c
index 46256dbe..d9d54769 100644
--- a/src/npc/mutoh.c
+++ b/src/npc/mutoh.c
@@ -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)
diff --git a/src/npc/postman.c b/src/npc/postman.c
index b3a51dba..e2ed44c8 100644
--- a/src/npc/postman.c
+++ b/src/npc/postman.c
@@ -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;
} \ No newline at end of file
diff --git a/src/npc/smith.c b/src/npc/smith.c
index 744bd8e2..ef3b80ac 100644
--- a/src/npc/smith.c
+++ b/src/npc/smith.c
@@ -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)
diff --git a/src/npc/talon.c b/src/npc/talon.c
index 01449c06..5b01b650 100644
--- a/src/npc/talon.c
+++ b/src/npc/talon.c
@@ -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);
diff --git a/src/npc/teachers.c b/src/npc/teachers.c
index a82bdadd..1a98617f 100644
--- a/src/npc/teachers.c
+++ b/src/npc/teachers.c
@@ -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)
diff --git a/src/npc/townMinish.c b/src/npc/townMinish.c
index c47a2a3f..d6595f2b 100644
--- a/src/npc/townMinish.c
+++ b/src/npc/townMinish.c
@@ -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);
}
}
diff --git a/src/npc/townsperson.c b/src/npc/townsperson.c
index a10aed22..c0b1dd76 100644
--- a/src/npc/townsperson.c
+++ b/src/npc/townsperson.c
@@ -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;
}
diff --git a/src/npc/windTribespeople.c b/src/npc/windTribespeople.c
index b95db3d4..60f9905b 100644
--- a/src/npc/windTribespeople.c
+++ b/src/npc/windTribespeople.c
@@ -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)
diff --git a/src/object/cloud.c b/src/object/cloud.c
index 5314d9a4..96ffc659 100644
--- a/src/object/cloud.c
+++ b/src/object/cloud.c
@@ -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);
}
}
diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c
index 21edd60f..4e2c4d40 100644
--- a/src/object/greatFairy.c
+++ b/src/object/greatFairy.c
@@ -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*) = {
diff --git a/src/object/object48.c b/src/object/object48.c
new file mode 100755
index 00000000..c2a25071
--- /dev/null
+++ b/src/object/object48.c
@@ -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);
+ }
+}
diff --git a/src/object/object49.c b/src/object/object49.c
index d9551953..a586e520 100644
--- a/src/object/object49.c
+++ b/src/object/object49.c
@@ -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();
}
}
diff --git a/src/room.c b/src/room.c
index 9c7a6b6f..202a5bf9 100644
--- a/src/room.c
+++ b/src/room.c
@@ -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)
{
diff --git a/src/sub_0801D754.c b/src/sub_0801D754.c
index f2bab6f9..dad57fa1 100644
--- a/src/sub_0801D754.c
+++ b/src/sub_0801D754.c
@@ -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);
}
diff --git a/src/sub_080A3B84.c b/src/sub_080A3B84.c
index da4e5ce1..892e010a 100644
--- a/src/sub_080A3B84.c
+++ b/src/sub_080A3B84.c
@@ -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);