Merge branch 'master' of github.com:zeldaret/tmc

This commit is contained in:
Behemoth
2020-08-05 17:34:36 +02:00
147 changed files with 1783 additions and 2813 deletions
+3 -3
View File
@@ -17,11 +17,11 @@ typedef struct {
typedef struct {
u8 filler[0x2e];
u8 unk;
} struct_030010A0;
} ScreenTransition;
extern struct_02002A40 gUnk_02002A40;
extern struct_080FD5B4 gUnk_080FD5B4[];
extern struct_030010A0 gUnk_030010A0;
extern ScreenTransition gScreenTransition;
extern u8 gUnk_0200AF13;
extern u8 gUnk_0200AF14;
@@ -154,7 +154,7 @@ void sub_08054524(void) {
bVar1 = gArea.locationIndex;
if (gArea.locationIndex == 0) {
bVar1 = gUnk_030010A0.unk;
bVar1 = gScreenTransition.unk;
}
if (bVar1 > 0x16) {
bVar1 = 0;
+3 -3
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;
+125
View File
@@ -0,0 +1,125 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
#include "menu.h"
#include "structures.h"
extern void (*const gUnk_0811E478[])(u32);
extern s16 gUnk_02021EE0[6];
void sub_0807CD9C() {
sub_080530C8();
}
void sub_0807CDA4(u32 arg0) {
gUnk_0811E478[gMenu.storyPanelIndex](arg0);
}
u32 sub_0807CDC0(void) {
gUnk_02021EE0[5] -= 8;
if (gUnk_02021EE0[4] <= 0) {
gMenu.field_0xa = 8;
gMenu.storyPanelIndex = 1;
}
return 0;
}
u32 sub_0807CDE8(u32 arg0) {
u32 temp;
if (gMenu.field_0xa == 0) {
sub_0805616C();
switch (arg0) {
case 0:
temp = sub_0807CF08(gUnk_02000000->saveFile, gUnk_02002A40.filler0);
break;
case 1:
sub_0807CF48(gUnk_02000000->saveFile);
temp = 1;
break;
case 2:
temp = sub_0807CF10((u8*)gUnk_02000000->header);
break;
}
gMenu.field_0xa = temp;
gMenu.storyPanelIndex = 2;
sub_08056208();
} else {
gMenu.field_0xa--;
}
return 0;
}
s32 sub_0807CE54(void) {
u32 uVar1;
uVar1 = 0;
gUnk_02021EE0[5] += 8;
if (gUnk_02021EE0[3] <= gUnk_02021EE0[5]) {
gUnk_02021EE0[5] = gUnk_02021EE0[3];
sub_08050384();
gMenu.storyPanelIndex = 0;
if (gMenu.field_0xa == 1) {
uVar1 = 1;
} else {
uVar1 = -1;
}
}
return uVar1;
}
extern char gUnk_0811E484[];
u32 sub_0807CE90(void)
{
struct_0807D1C4 *puVar1;
int iVar2;
int iVar3;
sub_080B1520(0x40);
puVar1 = sub_0807D1C4(4);
iVar3 = 0;
if (sub_0807D24C(puVar1->field_0x6, gUnk_0811E484, puVar1->field_0x0) == 0) {
iVar3 += 1;
}
if (sub_0807D24C(puVar1->field_0x8, gUnk_0811E484, puVar1->field_0x0) == 0) {
iVar3 += 2;
}
if (iVar3 != 0) {
if (iVar3 == 3) {
sub_0807CF68(5);
sub_0807CF68(3);
sub_0807CF68(2);
sub_0807CF68(1);
sub_0807CF68(0);
}
sub_0807D20C(puVar1->field_0x8, gUnk_0811E484, puVar1->field_0x0);
sub_0807D20C(puVar1->field_0x6, gUnk_0811E484, puVar1->field_0x0);
}
return 1;
}
u32 sub_0807CF08(u32 arg0, u8* arg1) {
return sub_0807CF88(arg0, arg1);
}
u32 sub_0807CF10(u8* arg0) {
return sub_0807CF88(3, arg0);
}
u32 sub_0807CF1C(u8* arg0) {
return sub_0807CF88(5, arg0);
}
u32 sub_0807CF28(u32 arg0, void* arg1) {
return sub_0807D008(arg0, arg1);
}
u32 sub_0807CF30(void* arg0) {
return sub_0807D008(3, arg0);
}
u32 sub_0807CF3C(void* arg0) {
return sub_0807D008(5, arg0);
}
+25
View File
@@ -0,0 +1,25 @@
#include "global.h"
#include "entity.h"
#include "structures.h"
#include "functions.h"
void sub_080808D8(void) {
gScreenTransition.transitionType = 0;
}
void sub_080808E4(void) {
if (sub_08052638(gScreenTransition.areaID)) {
gScreenTransition.transitionType = 0;
} else {
gScreenTransition.transitionType = 5;
}
}
void sub_08080904(void) {
gScreenTransition.transitionType = 1;
}
void sub_08080910(void) {
gScreenTransition.transitionType = 1;
}
+2 -2
View File
@@ -6,7 +6,7 @@ extern void sub_0805E5A8();
extern RoomControls gRoomControls;
extern u32 gUnk_0200B650;
extern u32 gUnk_02025EB0;
extern u8 gUnk_030010A0[10];
extern u8 gScreenTransition[10];
extern void DoExitTransition(Entity*);
extern void sub_080809D4();
@@ -15,7 +15,7 @@ void sub_0808091C(Entity* param_1, u32 param_2)
{
DoExitTransition(param_1);
gUnk_030010A0[9] = param_2;
gScreenTransition[9] = param_2;
return;
}
-4
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 *);
+1 -1
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;
}
+1
View File
@@ -2,6 +2,7 @@
#include "entity.h"
#include "enemy.h"
#include "functions.h"
#include "npc.h"
#include "structures.h"
#include "link.h"
+10 -19
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;
}
+3 -10
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++;
}
+1 -1
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 {
+2 -8
View File
@@ -3,16 +3,10 @@
#include "flags.h"
#include "functions.h"
typedef struct {
u8 filler[0xAC];
u16 unk;
} struct_030010A0;
extern u32 sub_0805C920(Entity*);
extern void LoadPalettesByPaletteGroupIndex(u32);
extern void (*const gUnk_08108D10[])(Entity*);
extern struct_030010A0 gUnk_030010A0;
extern u8 gUnk_08108D20[];
void Manager27(Entity *this)
@@ -20,10 +14,10 @@ void Manager27(Entity *this)
gUnk_08108D10[this->action](this);
if (CheckLocalFlagByOffset(0x300, this->entityType.form + 0x67)) {
gUnk_030010A0.unk |= (1 << (this->entityType).form);
gScreenTransition.field_0xac |= (1 << (this->entityType).form);
}
else {
gUnk_030010A0.unk &= ~(1 << (this->entityType).form);
gScreenTransition.field_0xac &= ~(1 << (this->entityType).form);
}
}
+2 -2
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)
+2 -2
View File
@@ -5,7 +5,7 @@
extern void (*gUnk_081140D4[])(Entity*);
extern u16 gUnk_081140CC[];
extern u32 gUnk_030010A0;
extern u32 gScreenTransition;
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0806D0B0(Entity*);
extern void sub_0807DD64(Entity*);
@@ -40,7 +40,7 @@ void sub_0806CF30(Entity* this) {
if (this->previousActionFlag != 2) {
if (this->previousActionFlag < 3) {
if ((gUnk_030010A0 & 3) == 0) {
if ((gScreenTransition & 3) == 0) {
iVar3 = this->x.HALF.HI;
if (gLinkEntity.x.HALF.HI < iVar3) {
if ((this->field_0x68 - 32) < iVar3) {
+8 -20
View File
@@ -6,25 +6,13 @@
#include "room.h"
#include "textbox.h"
typedef struct {
/*0x00*/ u8 filler[0x2C];
/*0x2C*/ u8 unk;
} struct_030010A0;
typedef struct {
u8 filler[0xa8];
Stats stats;
} struct_02002A40;
extern void (*gUnk_081115C0[])(Entity*);
extern void (*gUnk_081115D0[])(Entity*);
extern struct_030010A0 gUnk_030010A0;
extern u16 gUnk_081115DC[];
extern u8 gUnk_08111618[];
extern u32* gUnk_081115EC[];
extern struct_02002A40 gUnk_02002A40;
extern u8 gUnk_08111623[];
extern u8 gUnk_0811162B[];
extern u16 gUnk_08111664[];
@@ -60,7 +48,7 @@ void sub_08068A1C(Entity* this) {
int offset;
(this->entityType).parameter = (this->entityType).form;
if (gUnk_030010A0.unk != 0) {
if (gScreenTransition.field_0x24[8] != 0) {
offset = 6;
bVar1 = 3;
@@ -114,7 +102,7 @@ void sub_08068AA4(Entity* this) {
}
void sub_08068ADC(Entity* this) {
if (gUnk_030010A0.unk == 2) {
if (gScreenTransition.field_0x24[8] == 2) {
GetNextFrame(this);
}
sub_0806FD3C(this);
@@ -123,8 +111,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 +149,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) {
+3 -3
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;
}
}
+5 -5
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
+2 -2
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) {
+5 -5
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) {
+2 -2
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);
}
+8 -7
View File
@@ -4,6 +4,7 @@
#include "flags.h"
#include "textbox.h"
#include "link.h"
#include "structures.h"
extern void sub_0805E3A0(Entity*, u32);
extern void StartCutscene(Entity*, void*);
@@ -38,7 +39,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 +67,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 +130,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 +258,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 +266,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;
+2 -2
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:
+2 -2
View File
@@ -27,7 +27,7 @@ void GoronMerchant(Entity *this)
void sub_08069584(Entity *this)
{
if (gUnk_030010A0.field_0x24[8] != 0) {
if (gScreenTransition.field_0x24[8] != 0) {
this->action = 3;
}
else {
@@ -65,7 +65,7 @@ void sub_080695E8(Entity *this)
void sub_0806961C(Entity *this)
{
if (gUnk_030010A0.field_0x24[8] == 2) {
if (gScreenTransition.field_0x24[8] == 2) {
UpdateAnimationSingleFrame(this);
}
sub_0806FD3C(this);
+3 -3
View File
@@ -13,7 +13,7 @@ typedef struct {
typedef struct {
u8 filler[8];
u8 unk;
} struct_030010A0;
} ScreenTransition;
typedef struct {
u32 unk;
@@ -38,7 +38,7 @@ extern void (*const gUnk_0810F550[])(Entity*);
extern u8 gUnk_03003DBC;
extern SpriteLoadData gUnk_0810F524[];
extern void* gUnk_0810F6BC[];
extern struct_030010A0 gUnk_030010A0;
extern ScreenTransition gScreenTransition;
void Guard(Entity *this)
{
@@ -175,7 +175,7 @@ void sub_08064030(Entity *arg0,Entity *arg1)
void sub_08064044(void)
{
gUnk_030010A0.unk = 1;
gScreenTransition.unk = 1;
}
void sub_08064050(Entity *arg0, struct_08064050 *arg1)
+2 -2
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;
+2 -2
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);
}
+7 -5
View File
@@ -6,6 +6,8 @@
#include "sprite.h"
#include "textbox.h"
#include "npc.h"
#include "structures.h"
extern void sub_0807DD50(Entity*);
extern u32 sub_0806F5A4(u32);
extern void sub_0806F118(Entity*);
@@ -28,8 +30,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 +40,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 +52,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 +67,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) {
+2 -2
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) {
+4 -3
View File
@@ -4,6 +4,7 @@
#include "flags.h"
#include "textbox.h"
#include "npc.h"
#include "structures.h"
extern void sub_0805E3A0(Entity*, u32);
extern void sub_0807DD50(Entity*);
@@ -75,13 +76,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)
+15 -14
View File
@@ -3,6 +3,7 @@
#include "npc.h"
#include "textbox.h"
#include "link.h"
#include "structures.h"
typedef struct {
u8 filler[7];
@@ -125,11 +126,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 +171,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 +180,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 +193,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 +212,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 +223,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;
}
+2 -8
View File
@@ -4,11 +4,6 @@
#include "room.h"
#include "flags.h"
typedef struct {
u8 filler[9];
u8 unk;
} struct_030010A0;
typedef struct {
u8 filler[4];
u32 unk;
@@ -21,7 +16,6 @@ extern void DoFade(u32, u32);
extern void gUnk_0813AD60;
extern void gUnk_0813AD74;
extern struct_030010A0 gUnk_030010A0;
void Simon(Entity *this)
{
@@ -37,7 +31,7 @@ void Simon(Entity *this)
void sub_0806C224(void)
{
DoExitTransition(&gUnk_0813AD60);
gUnk_030010A0.unk = 6;
gScreenTransition.transitionType = 6;
}
void Simon_CreateChest(Entity *this)
@@ -51,7 +45,7 @@ void sub_0806C280(void)
{
SetGlobalFlag(MAROYA_WAKEUP);
DoExitTransition(&gUnk_0813AD74);
gUnk_030010A0.unk = 6;
gScreenTransition.transitionType = 6;
}
void sub_0806C2A0(u32 *param_1,struct_0806C2A0 *param_2)
+3 -3
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)
+2 -2
View File
@@ -11,7 +11,7 @@ extern void (*gUnk_081121D4[])(Entity*);
extern SpriteLoadData gUnk_081121C4;
extern SpriteLoadData gUnk_081121B4;
extern u32 gUnk_030010A0;
extern u32 gScreenTransition;
extern void sub_0807DD94(Entity*, u32);
extern void sub_0806A26C(Entity*);
extern void sub_080042BA(Entity*, u32);
@@ -42,7 +42,7 @@ void sub_0806A234(Entity *this)
{
sub_0807DD94(this, 0);
if ((this->field_0x82.HWORD & 4) != 0) {
if ((gUnk_030010A0 & 7) == 0) {
if ((gScreenTransition & 7) == 0) {
sub_0806A26C(this);
}
sub_080042BA(this, 2);
+7 -7
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);
+5 -5
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)
+11 -11
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);
}
}
+9 -8
View File
@@ -4,6 +4,7 @@
#include "link.h"
#include "textbox.h"
#include "flags.h"
#include "structures.h"
typedef struct {
u8 frame1;
@@ -123,7 +124,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 +133,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 +144,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 +157,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 +167,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 +175,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 +301,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;
}
+4 -3
View File
@@ -3,6 +3,7 @@
#include "npc.h"
#include "textbox.h"
#include "flags.h"
#include "structures.h"
extern u32 LoadExtraSpriteData(Entity*, SpriteLoadData*);
extern void sub_0807DD50(Entity*);
@@ -78,8 +79,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 +123,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)
+8 -14
View File
@@ -23,7 +23,7 @@ extern void PositionEntityOnTop(Entity*, Entity*);
extern void sub_0807BB68(u32*, u32, u32);
extern u8 gUnk_02034490;
extern u32 gUnk_030010A0;
extern u32 gScreenTransition;
extern void* gUnk_080DD750;
extern Entity gLinkEntity;
extern LinkState gLinkState;
@@ -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);
@@ -62,7 +62,7 @@ void sub_0809F548(Entity* this) {
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
} else {
if ((gUnk_030010A0 & 7) == 0) {
if ((gScreenTransition & 7) == 0) {
sub_0809F7BC(this);
}
sub_0809F7F4(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) {
@@ -110,7 +110,7 @@ void sub_0809F61C(Entity* this) {
sub_0809F814((((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 63) |
(((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 63) << 6);
} else {
if ((gUnk_030010A0 & 7) == 0) {
if ((gScreenTransition & 7) == 0) {
sub_0809F7BC(this);
}
sub_0809F7F4(this);
@@ -145,7 +145,7 @@ void sub_0809F700(Entity* this) {
this->actionDelay = (Random() & 30) + 8;
this->flags = this->flags | 12;
}
if ((gUnk_030010A0 & 3) == 0) {
if ((gScreenTransition & 3) == 0) {
uVar2 = Random();
this->spriteOffsetX = gUnk_081247C0[uVar2 & 7];
this->spriteOffsetY = gUnk_081247C0[uVar2 >> 4 & 7];
@@ -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);
}
}
+3 -10
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*) = {
+187
View File
@@ -0,0 +1,187 @@
#include "global.h"
#include "entity.h"
#include "flags.h"
#include "functions.h"
#include "room.h"
typedef struct {
/*0x00*/ u16 unk0;
/*0x02*/ u16 unk2;
/*0x04*/ u8 unk4;
/*0x05*/ u8 unk5;
/*0x06*/ u8 unk6;
/*0x07*/ u8 unk7;
/*0x08*/ u8 *unk8;
} unk_DoorProperty;
typedef struct {
/*0x00*/ u8 filler0[0x8];
/*0x08*/ u32 unk8;
} unk_80868EC;
static void sub_080868EC(Entity* entity, unk_80868EC* arg1);
static bool32 sub_080867CC(u32);
static void sub_0808681C(Entity*);
static u8 sub_08086954(Entity*);
extern u32 sub_080562CC(u32, u32, u32, u32);
extern void sub_08078AC0(u32, u32, u32);
extern void* GetCurrentRoomProperty(u8);
extern void (*const gUnk_081206B4[])(Entity*);
extern BoundingBox gUnk_081206AC; // TODO: should be const
void HouseDoorExterior(Entity* this) {
gUnk_081206B4[this->entityType.parameter](this);
}
void sub_080866D8(Entity* this) {
unk_DoorProperty* prop;
Entity* entity;
u32 i;
if (this->action == 0) {
this->action = 1;
*((u32 *)(&this->field_0x68)) = 0;
this->field_0x6c.HALF.LO = this->actionDelay;
sub_0805E3A0(this, 6);
}
prop = GetCurrentRoomProperty(this->field_0x6c.HALF.LO);
for (i = 0; prop->unk0 != 0xFFFF && i < 32; prop++, i++) {
int mask = 1 << i;
if ((*((u32 *)(&this->field_0x68)) & mask) == 0 &&
sub_080867CC(prop->unk5) &&
sub_080562CC(prop->unk0, prop->unk2, 32, 32)) {
entity = CreateObject(0x19, prop->unk7, prop->unk6);
if (entity) {
entity->field_0x6c.HALF.LO = i;
entity->x.HALF.HI = gRoomControls.roomOriginX + prop->unk0 + 16;
entity->y.HALF.HI = gRoomControls.roomOriginY + prop->unk2 + 32;
entity->parent = this;
entity->field_0x68.HWORD = prop->unk0;
entity->field_0x6a.HWORD = prop->unk2;
entity->collisionLayer = prop->unk4;
entity->previousActionFlag = prop->unk5;
UpdateSpriteForCollisionLayer(entity);
*((u32 *)(&this->field_0x68)) |= mask;
if (prop->unk8) {
*((u32 **)(&entity->cutsceneBeh)) = StartCutscene(entity, prop->unk8);
}
}
}
}
}
static bool32 sub_080867CC(u32 arg0) {
if (arg0 == 0) {
return TRUE;
}
if (arg0 != 2) {
return TRUE;
}
return CheckGlobalFlag(TATEKAKE_HOUSE);
}
void sub_080867E4(Entity* this) {
if (!sub_080562CC(this->field_0x68.HWORD, this->field_0x6a.HWORD, 32, 32)) {
*((u32 *)(&this->parent->field_0x68)) = *((u32 *)(&this->parent->field_0x68)) & ~(1 << this->field_0x6c.HALF.LO);
DeleteThisEntity();
}
sub_0808681C(this);
}
static void sub_0808681C(Entity* this) {
switch (this->action) {
case 0:
this->action = 1;
this->actionDelay = 8;
this->spriteSettings.b.draw = 1;
this->frameIndex = 0;
this->boundingBox = &gUnk_081206AC;
if (this->previousActionFlag == 1) {
this->action = 2;
this->frameIndex = 1;
}
if (this->flags & 0x2) {
this->action = 2;
}
break;
case 1:
if (!sub_08086954(this)) {
this->action++;
this->frameIndex = 1;
sub_08078AC0(16, 0, 1);
PlaySFX(0x111);
}
break;
}
if (this->flags & 0x2) {
ExecuteScriptCommandSet(this, *(u32 **)&this->cutsceneBeh);
sub_080868EC(this, *(void **)&this->cutsceneBeh);
}
}
void sub_080868B0(Entity* this) {
if (this->action == 0) {
this->action = 1;
this->spriteSettings.b.draw = 1;
this->boundingBox = &gUnk_081206AC;
this->actionDelay = 8;
}
ExecuteScriptCommandSet(this, *(u32 **)&this->cutsceneBeh);
sub_080868EC(this, *(void **)&this->cutsceneBeh);
}
static void sub_080868EC(Entity* entity, unk_80868EC* arg1) {
u32 var0 = arg1->unk8;
arg1->unk8 = 0;
while (var0 != 0) {
u32 rightMostSetBit = var0 & (~var0 + 1);
var0 ^= rightMostSetBit;
switch (rightMostSetBit) {
case 0x80:
entity->frameIndex = 0;
break;
case 0x100:
entity->frameIndex = 1;
break;
}
}
if (entity->frameIndex == 0) {
sub_0800445C(entity);
}
}
void sub_0808692C(Entity* this) {
this->flags &= 0xFD;
this->entityType.parameter = 2;
this->action = this->frameIndex == 0 ? 1 : 2;
this->previousActionFlag = 0;
this->actionDelay = 8;
}
static u8 sub_08086954(Entity* this) {
if (sub_0800445C(this)) {
if (sub_0806ED9C(this, 6, 20) >= 0 &&
gLinkEntity.animationState == 0 &&
(u16)gLinkState.field_0x90.HALF.LO == 0x400 &&
gLinkState.jumpStatus == 0) {
this->actionDelay--;
}
} else {
this->actionDelay = 8;
}
return this->actionDelay;
}
// TODO: Second arg is some unknown struct.
void sub_080869A4(Entity* entityA, u32* entityB) {
entityB[5] = 0;
if (!sub_08086954(entityA)) {
entityA->actionDelay = 8;
entityB[5] = 1;
}
}
+2 -2
View File
@@ -4,7 +4,7 @@
#include "random.h"
extern Entity gLinkEntity;
extern u16 gUnk_030010A0[];
extern u16 gScreenTransition[];
extern void (*MaskActionFuncs[])(Entity *);
@@ -36,7 +36,7 @@ void sub_080929A4(Entity *this) {
switch (this->entityType.parameter & 0xC0) {
case 0x40:
field_0x0a = gUnk_030010A0[0x5];
field_0x0a = gScreenTransition[0x5];
switch (field_0x0a) {
case 0x44D ... 0x44F:
+1 -1
View File
@@ -155,7 +155,7 @@ void sub_080919AC(Entity *this)
CopyPosition(this,&gLinkEntity);
gLinkEntity.spritePriority.b0 = this->spritePriority.b0 - 1;
if (!sub_08091DDC(this)) {
if ((gUnk_030010A0.field_0x0 & 0xf) == 0) {
if ((gScreenTransition.field_0x0 & 0xf) == 0) {
PlaySFX(0x138);
}
+40
View File
@@ -0,0 +1,40 @@
#include "global.h"
#include "entity.h"
extern void (* const gUnk_081247F8[])(Entity*);
void MinishLight(Entity* this)
{
gUnk_081247F8[this->action](this);
}
void sub_0809F840(Entity* this)
{
this->action = 1;
this->frameIndex = 0;
this->actionDelay = 0x20;
this->field_0xf = 0;
if (this->entityType.parameter != 0)
{
this->spriteSettings.b.flipX = 1;
}
UpdateSpriteForCollisionLayer(this);
}
void sub_0809F868(Entity* this)
{
if (--this->actionDelay == 0) {
if (this->field_0xf == 0) {
if (++this->frameIndex == 3) {
this->field_0xf = 1;
}
} else {
if (--this->frameIndex == 0) {
this->field_0xf = 0;
}
}
this->actionDelay = 32;
}
}
+544
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);
}
}
+1 -1
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();
}
}
+2 -2
View File
@@ -15,7 +15,7 @@ extern void CreateMinishEntrance(u32 tile);
extern void (*const gUnk_08124354[])(Entity*);
extern u32 gUnk_030010A0;
extern u32 gScreenTransition;
extern s16 gUnk_08124364[];
void TreeHidingPortal(Entity* this) {
@@ -36,7 +36,7 @@ void sub_0809E86C(Entity* this) {
if (sub_0800419C(this, &gLinkEntity, 0x30, 0x30)) {
if (CheckGlobalFlag(EZERO_1ST)) {
if (((gUnk_030010A0 & 3) == 0)) {
if (((gScreenTransition & 3) == 0)) {
sub_080A2B80(this);
}
}
-6
View File
@@ -2,11 +2,6 @@
#include "entity.h"
#include "functions.h"
typedef struct {
u8 filler[64];
u32 windcrests;
} struct_02002A40;
extern void sub_0807DD64(Entity*);
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
@@ -15,7 +10,6 @@ extern void PlaySFX(u32);
extern Entity* CreateFx (Entity*, u32, u32);
extern u8 gUnk_08125010;
extern struct_02002A40 gUnk_02002A40;
void Windcrest(Entity *this)
{
+44 -51
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"
@@ -233,7 +234,7 @@ extern EntityData gUnk_080D6210;
void sub_0804B5BC(void) {
if ((u16)gUnk_030010A0.field_0x10.HALF.HI > 0x40)
if ((u16)gScreenTransition.playerStartPos.HALF.y > 0x40)
LoadRoomEntityList(&gUnk_080D6210);
}
@@ -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);
@@ -640,7 +641,7 @@ void sub_0804bc38(void) {
u32 sub_0804BC50(void) {
if (!CheckLocalFlag(0x9f)) {
gUnk_030010A0.field_0xa[5] = 5;
gScreenTransition.field_0xf = 5;
ClearGlobalFlag(ZELDA_CHASE);
}
return 1;
@@ -1023,7 +1024,7 @@ void sub_0804C018(void) {
SetTile(0x4072, 0xc47, 1);
if (CheckGlobalFlag(MAZE_CLEAR))
if (gUnk_030010A0.field_0x10.WORD == 0x2780078)
if (gScreenTransition.playerStartPos.WORD == 0x2780078) // todo: wtf
PlaySFX(0x72);
ClearGlobalFlag(MAZE_CLEAR);
@@ -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);
@@ -2444,8 +2445,8 @@ u32 sub_0804CF40() {
}
void sub_0804CF44(void) {
gUnk_030010A0.field_0x38 = 0;
gUnk_030010A0.field_0x39 = 0x5a;
gScreenTransition.field_0x38 = 0;
gScreenTransition.field_0x39 = 0x5a;
}
u32 sub_0804CF5C() {
@@ -2520,10 +2521,10 @@ u32 sub_0804CFAC() {
void sub_0804CFB0(void) {
if (!CheckFlags(0x31)) {
if (gUnk_030010A0.field_0x38 == 0) {
if (gScreenTransition.field_0x38 == 0) {
PlaySFX(0x80100000);
} else {
if (gUnk_030010A0.field_0x39 == 0) {
if (gScreenTransition.field_0x39 == 0) {
PlaySFX(0x80050000);
sub_08078A90(3);
}
@@ -3508,16 +3509,16 @@ u32 sub_0804D6EC() {
void sub_0804D6F0(void) {
sub_0805D3C8(0);
if ((gUnk_030010A0.field_0x38 & 1) && gUnk_030010A0.field_0x39) {
if (gUnk_030010A0.field_0x3c == 1) {
gLinkEntity.x.HALF.HI = gUnk_030010A0.field_0x48;
gLinkEntity.y.HALF.HI = gUnk_030010A0.field_0x4a + 8;
if ((gScreenTransition.field_0x38 & 1) && gScreenTransition.field_0x39) {
if (gScreenTransition.field_0x3c == 1) {
gLinkEntity.x.HALF.HI = gScreenTransition.field_0x48;
gLinkEntity.y.HALF.HI = gScreenTransition.field_0x4a + 8;
} else {
if (gUnk_030010A0.field_0x3c) {
if (gScreenTransition.field_0x3c) {
return;
}
gLinkEntity.x.HALF.HI = gUnk_030010A0.field_0x44;
gLinkEntity.y.HALF.HI = gUnk_030010A0.field_0x46 + 8;
gLinkEntity.x.HALF.HI = gScreenTransition.field_0x44;
gLinkEntity.y.HALF.HI = gScreenTransition.field_0x46 + 8;
}
}
}
@@ -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) {
@@ -4536,7 +4537,7 @@ void sub_0804E4E4(void)
if (!GetInventoryValue(0x3a) && CheckGlobalFlag(MIZUKAKI_HARIFALL)) {
LoadRoomEntityList(&gUnk_080F2194);
}
if (gUnk_030010A0.field_0xa[5] == 1) {
if (gScreenTransition.field_0xf == 1) {
LoadRoomEntityList(&gUnk_080F21B4);
}
}
@@ -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);
}
}
@@ -4852,8 +4853,8 @@ void sub_0804E954(void)
if (!GetInventoryValue(0x46) && CheckGlobalFlag(MIZUKAKI_START) && !GetInventoryValue(0x3b)) {
LoadRoomEntityList(&gUnk_080F3A48);
}
gUnk_030010A0.field_0x20 = 0xf28;
gUnk_030010A0.field_0x22 = 0x82d;
gScreenTransition.field_0x20 = 0xf28;
gScreenTransition.field_0x22 = 0x82d;
}
extern u32 gUnk_080F3D44;
@@ -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);
@@ -5260,7 +5261,7 @@ void nullsub_398() {}
u32 sub_0804EFDC(void)
{
if (CheckGlobalFlag(MAROYA_WAKEUP)) {
gUnk_030010A0.field_0xa[5] = 5;
gScreenTransition.field_0xf = 5;
}
return 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)
{
+5 -3
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);
}
+2 -2
View File
@@ -1,10 +1,10 @@
#include "entity.h"
extern Entity* sub_0805E3A0(Entity*, u32);
extern u8 gUnk_030010A0[];
extern u8 gScreenTransition[];
extern u8 gUnk_081091F8[];
extern u8 gUnk_081091EE[];
Entity* sub_0805E374(Entity* param_1) {
u8 r3 = gUnk_030010A0[0x2C];
u8 r3 = gScreenTransition[0x2C];
u8* array = gUnk_081091F8;
if (r3 != '\x02') {
+3 -3
View File
@@ -8,7 +8,7 @@ extern void (*const gUnk_081280C4[])();
void DrawKinstoneMenu(void)
{
gUnk_030010A0.field_0x24[8] = 2;
gScreenTransition.field_0x24[8] = 2;
sub_080AD90C();
gUnk_081280C4[gMenu.menuType]();
sub_080A3B74();
@@ -18,7 +18,7 @@ void DrawKinstoneMenu(void)
sub_0805E5C0();
sub_080AD9B0();
sub_080AD918();
gUnk_030010A0.field_0x24[8] = 0;
gScreenTransition.field_0x24[8] = 0;
}
extern void gUnk_081280DC;
@@ -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);