clang-format and newlines

This commit is contained in:
theo3 2020-11-13 23:27:50 -08:00
parent 8fd7481395
commit 3079c016b4
236 changed files with 4010 additions and 4415 deletions

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -3,7 +3,6 @@
#include "global.h" #include "global.h"
typedef struct { typedef struct {
u8 areaMetadata; u8 areaMetadata;
u8 locationIndex; u8 locationIndex;

View File

@ -44,7 +44,6 @@ extern u8 gUnk_0812079C[8];
extern s16 gSineTable[]; extern s16 gSineTable[];
extern s8 gUnk_081207AC[]; extern s8 gUnk_081207AC[];
typedef struct { typedef struct {
s32 unk0; s32 unk0;
s32 unk4; s32 unk4;

View File

@ -54,7 +54,6 @@ typedef struct {
extern Main gUnk_03001000; extern Main gUnk_03001000;
extern UI gUnk_02032EC0; extern UI gUnk_02032EC0;
extern void sub_080A3204(void); extern void sub_080A3204(void);
extern void sub_0807CE90(void); extern void sub_0807CE90(void);
extern void sub_080560B8(void); extern void sub_080560B8(void);

View File

@ -172,5 +172,4 @@ extern void NPC58_Head(Entity*);
extern u32 UpdateFuseInteraction(Entity*); extern u32 UpdateFuseInteraction(Entity*);
#endif #endif

View File

@ -61,7 +61,6 @@ typedef struct {
void* field_0x88; void* field_0x88;
} RoomVars; } RoomVars;
// Packets used to store which entities to load in a room // Packets used to store which entities to load in a room
typedef struct { typedef struct {
u8 type : 4; u8 type : 4;

View File

@ -0,0 +1 @@

1
src/chooseFile.c Executable file → Normal file
View File

@ -285,7 +285,6 @@ void sub_0805070C(void) {
} }
sub_0805F300(var0); sub_0805F300(var0);
} }
} }
void sub_08050790(void) { void sub_08050790(void) {

View File

@ -3,8 +3,7 @@
extern u32 SetTileType(u32 tileID, u32 tilePos, u32 layerID); extern u32 SetTileType(u32 tileID, u32 tilePos, u32 layerID);
void CreateMinishEntrance(u32 tilePos) void CreateMinishEntrance(u32 tilePos) {
{
u32 x, y; u32 x, y;
u32 tileID = 0x185; u32 tileID = 0x185;
@ -16,8 +15,7 @@ void CreateMinishEntrance(u32 tilePos)
} }
} }
void sub_08018C58(u32 tilePos) void sub_08018C58(u32 tilePos) {
{
u32 i = 0; u32 i = 0;
for (; i < 6;) { for (; i < 6;) {

0
src/code_0801D79C.c Executable file → Normal file
View File

View File

@ -15,11 +15,9 @@ extern void sub_0805E5A8();
extern void (*const gUnk_080D4120[])(); extern void (*const gUnk_080D4120[])();
extern void (*const gUnk_080D412C[])(); extern void (*const gUnk_080D412C[])();
extern struct_02018EB0 gUnk_02018EB0; extern struct_02018EB0 gUnk_02018EB0;
u32 sub_0804AA84(void) u32 sub_0804AA84(void) {
{
if (gArea.fadeOut != 0) { if (gArea.fadeOut != 0) {
gUnk_03001000.transition = 4; gUnk_03001000.transition = 4;
gArea.filler[8] = 0; gArea.filler[8] = 0;
@ -27,21 +25,18 @@ u32 sub_0804AA84(void)
*(u16*)&gArea.filler[10] = 0; *(u16*)&gArea.filler[10] = 0;
sub_0805E5A8(); sub_0805E5A8();
return 1; return 1;
} } else {
else {
gArea.filler[18] = gArea.fadeOut; gArea.filler[18] = gArea.fadeOut;
*(vu8*)&gArea.fadeOut = gArea.fadeOut; *(vu8*)&gArea.fadeOut = gArea.fadeOut;
return 0; return 0;
} }
} }
void sub_0804AAB8(void) void sub_0804AAB8(void) {
{
gUnk_080D4120[gArea.filler[8]](); gUnk_080D4120[gArea.filler[8]]();
} }
void sub_0804AAD4(void) void sub_0804AAD4(void) {
{
_DmaZero((void*)&gUnk_02018EB0, 0x28); _DmaZero((void*)&gUnk_02018EB0, 0x28);
gUnk_02018EB0.unk = 0; gUnk_02018EB0.unk = 0;
EraseAllEntities(); EraseAllEntities();
@ -49,8 +44,7 @@ void sub_0804AAD4(void)
gArea.filler[8]++; gArea.filler[8]++;
} }
void sub_0804AB04(void) void sub_0804AB04(void) {
{
sub_0805E5C0(); sub_0805E5C0();
if (gArea.field_0x10 != 0) { if (gArea.field_0x10 != 0) {
sub_080AD90C(); sub_080AD90C();
@ -59,8 +53,7 @@ void sub_0804AB04(void)
} }
} }
void sub_0804AB24(void) void sub_0804AB24(void) {
{
if (!gFadeControl.active) { if (!gFadeControl.active) {
gScreen.lcd.displayControl = 0; gScreen.lcd.displayControl = 0;
sub_0801E104(); sub_0801E104();
@ -70,7 +63,6 @@ void sub_0804AB24(void)
} }
} }
void sub_0804AB54(void) void sub_0804AB54(void) {
{
gUnk_080D412C[gArea.filler[8]](); gUnk_080D412C[gArea.filler[8]]();
} }

View File

@ -30,7 +30,6 @@ extern u8 gUnk_080FE1C6[];
extern u32 gUnk_02034398; extern u32 gUnk_02034398;
extern void (*const gUnk_080FE2A0[])(); extern void (*const gUnk_080FE2A0[])();
u32 IsItemEquipped(u32 itemID) { u32 IsItemEquipped(u32 itemID) {
u32 ret; u32 ret;
@ -268,7 +267,6 @@ u32 CreateItemDrop(Entity* arg0, u32 itemID, u32 itemParameter) {
} }
*/ */
void sub_08054870(void) void sub_08054870(void) {
{
gUnk_080FE2A0[gMenu.menuType](); gUnk_080FE2A0[gMenu.menuType]();
} }

View File

@ -3,7 +3,6 @@
#include "player.h" #include "player.h"
#include "functions.h" #include "functions.h"
typedef struct { typedef struct {
u8 unk[12]; u8 unk[12];
} struct_0811BE48; } struct_0811BE48;
@ -20,15 +19,13 @@ extern Entity* sub_0805E744();
extern struct_0811BE48 gUnk_0811BE48[]; extern struct_0811BE48 gUnk_0811BE48[];
void sub_08077B98(UnkItemStruct* unk) void sub_08077B98(UnkItemStruct* unk) {
{
if ((gPlayerState.field_0x2c == NULL) || (gPlayerState.field_0x2c[9] != 1)) { if ((gPlayerState.field_0x2c == NULL) || (gPlayerState.field_0x2c[9] != 1)) {
gPlayerState.field_0x2c = sub_08077C54(unk); gPlayerState.field_0x2c = sub_08077C54(unk);
} }
} }
void sub_08077BB8(UnkItemStruct* unk) void sub_08077BB8(UnkItemStruct* unk) {
{
u8* temp = sub_08077C54(unk); u8* temp = sub_08077C54(unk);
if (temp != NULL) { if (temp != NULL) {
temp[0x10] = 0x20; temp[0x10] = 0x20;
@ -36,18 +33,15 @@ void sub_08077BB8(UnkItemStruct* unk)
gPlayerState.field_0x2c = temp; gPlayerState.field_0x2c = temp;
} }
Entity* sub_08077BD4(ItemBehavior *beh) Entity* sub_08077BD4(ItemBehavior* beh) {
{
if (sub_08077C94(beh, gUnk_0811BE48[beh->behaviorID].unk[3]) != 0) { if (sub_08077C94(beh, gUnk_0811BE48[beh->behaviorID].unk[3]) != 0) {
return NULL; return NULL;
} } else {
else {
return CreatePlayerBomb(beh, gUnk_0811BE48[beh->behaviorID].unk[3]); return CreatePlayerBomb(beh, gUnk_0811BE48[beh->behaviorID].unk[3]);
} }
} }
Entity * sub_08077C0C(ItemBehavior *beh, u32 arg1) Entity* sub_08077C0C(ItemBehavior* beh, u32 arg1) {
{
u8 bVar1; u8 bVar1;
Entity* pEVar3; Entity* pEVar3;
@ -55,14 +49,12 @@ Entity * sub_08077C0C(ItemBehavior *beh, u32 arg1)
if (sub_08077C94(beh, bVar1) != 0) { if (sub_08077C94(beh, bVar1) != 0) {
return NULL; return NULL;
} } else {
else {
return CreatePlayerBomb(beh, bVar1); return CreatePlayerBomb(beh, bVar1);
} }
} }
Entity * CreatePlayerBomb(ItemBehavior *beh, u32 subtype) Entity* CreatePlayerBomb(ItemBehavior* beh, u32 subtype) {
{
Entity* pEVar1; Entity* pEVar1;
pEVar1 = CreatePlayerItem(subtype, 0, 0, beh->behaviorID); pEVar1 = CreatePlayerItem(subtype, 0, 0, beh->behaviorID);
@ -72,8 +64,7 @@ Entity * CreatePlayerBomb(ItemBehavior *beh, u32 subtype)
return pEVar1; return pEVar1;
} }
void* sub_08077C54(UnkItemStruct* unk) void* sub_08077C54(UnkItemStruct* unk) {
{
Entity* item; Entity* item;
item = sub_0805E744(); item = sub_0805E744();
@ -88,8 +79,7 @@ void* sub_08077C54(UnkItemStruct* unk)
return item; return item;
} }
Entity* sub_08077C94(ItemBehavior* arg0, u32 arg1) Entity* sub_08077C94(ItemBehavior* arg0, u32 arg1) {
{
Entity* iVar1; Entity* iVar1;
iVar1 = FindEntityInListBySubtype(8, gUnk_0811BE48[arg1].unk[3], 2); iVar1 = FindEntityInListBySubtype(8, gUnk_0811BE48[arg1].unk[3], 2);
@ -99,8 +89,7 @@ Entity* sub_08077C94(ItemBehavior* arg0, u32 arg1)
return iVar1; return iVar1;
} }
Entity * CreatePlayerItem(u32 subtype, u32 form, u32 parameter, u32 unk) Entity* CreatePlayerItem(u32 subtype, u32 form, u32 parameter, u32 unk) {
{
Entity* ent; Entity* ent;
ent = GetEmptyEntity(); ent = GetEmptyEntity();
@ -116,8 +105,7 @@ Entity * CreatePlayerItem(u32 subtype, u32 form, u32 parameter, u32 unk)
return ent; return ent;
} }
Entity * sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk) Entity* sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk) {
{
Entity* ent; Entity* ent;
ent = sub_0805E744(); ent = sub_0805E744();

View File

@ -12,8 +12,7 @@ typedef struct {
u8 unk[16]; u8 unk[16];
} Unk_struct; } Unk_struct;
void sub_08077DF4(Entity *ent, u32 arg1) void sub_08077DF4(Entity* ent, u32 arg1) {
{
*(u16*)&ent->flags = arg1; *(u16*)&ent->flags = arg1;
if ((arg1 & 0xff) > 0xb8) { if ((arg1 & 0xff) > 0xb8) {
arg1 += (ent->entityType).form >> 1; arg1 += (ent->entityType).form >> 1;
@ -23,28 +22,24 @@ void sub_08077DF4(Entity *ent, u32 arg1)
sub_08077E54(ent); sub_08077E54(ent);
} }
void UpdateItemAnim(Entity *ent) void UpdateItemAnim(Entity* ent) {
{
UpdateAnimationSingleFrame(&gPlayerEntity); UpdateAnimationSingleFrame(&gPlayerEntity);
sub_08077E54(ent); sub_08077E54(ent);
} }
void sub_08077E3C(Entity *ent, u32 idx) void sub_08077E3C(Entity* ent, u32 idx) {
{
sub_080042BA(&gPlayerEntity, idx); sub_080042BA(&gPlayerEntity, idx);
sub_08077E54(ent); sub_08077E54(ent);
} }
void sub_08077E54(Entity *ent) void sub_08077E54(Entity* ent) {
{
ent->action = gPlayerEntity.animIndex; ent->action = gPlayerEntity.animIndex;
*(u8*)&ent->spriteIndex = gPlayerEntity.frameIndex; *(u8*)&ent->spriteIndex = gPlayerEntity.frameIndex;
ent->previousActionFlag = gPlayerEntity.frameDuration; ent->previousActionFlag = gPlayerEntity.frameDuration;
ent->actionDelay = gPlayerEntity.frames.all; ent->actionDelay = gPlayerEntity.frames.all;
} }
void sub_08077E78(void* arg0, u32 bits) void sub_08077E78(void* arg0, u32 bits) {
{
u8* pbVar1; u8* pbVar1;
u32 not ; u32 not ;
@ -52,8 +47,7 @@ void sub_08077E78(void* arg0, u32 bits)
if (gPlayerState.field_0x2c != NULL) { if (gPlayerState.field_0x2c != NULL) {
((Unk_bitfield*)gPlayerState.field_0x2c)[0x11].b0 = 6; ((Unk_bitfield*)gPlayerState.field_0x2c)[0x11].b0 = 6;
gPlayerState.field_0x2c = (u8*)bits; gPlayerState.field_0x2c = (u8*)bits;
} } else {
else {
gPlayerState.field_0x2c = (u8*)bits; gPlayerState.field_0x2c = (u8*)bits;
} }
} }
@ -66,8 +60,7 @@ void sub_08077E78(void* arg0, u32 bits)
_DmaZero(arg0, 0x1c); _DmaZero(arg0, 0x1c);
} }
u32 sub_08077EC8(Unk_struct* arg0) u32 sub_08077EC8(Unk_struct* arg0) {
{
if ((gPlayerState.field_0x1a[1] & 8) != 0) { if ((gPlayerState.field_0x1a[1] & 8) != 0) {
sub_08077DF4((Entity*)arg0, 0x170); sub_08077DF4((Entity*)arg0, 0x170);
@ -75,19 +68,16 @@ u32 sub_08077EC8(Unk_struct* arg0)
arg0->unk[4] = 7; arg0->unk[4] = 7;
arg0->unk[15] = 6; arg0->unk[15] = 6;
return 1; return 1;
} } else {
else {
return 0; return 0;
} }
} }
void sub_08077EFC(ItemBehavior* arg0) void sub_08077EFC(ItemBehavior* arg0) {
{
sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.LO); sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.LO);
} }
void sub_08077F10(ItemBehavior* arg0) void sub_08077F10(ItemBehavior* arg0) {
{
sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.HI); sub_08077F24(arg0, (u16)gPlayerState.field_0x90.HALF.HI);
} }
@ -96,27 +86,23 @@ void sub_08077F24(ItemBehavior* beh, u32 arg1) {
asm(".include \"asm/non_matching/sub_08077F24.inc\""); asm(".include \"asm/non_matching/sub_08077F24.inc\"");
} }
void sub_08077F50(ItemBehavior *beh, u32 arg1) void sub_08077F50(ItemBehavior* beh, u32 arg1) {
{
sub_08079184(); sub_08079184();
sub_08077E78(beh, arg1); sub_08077E78(beh, arg1);
} }
u32 sub_08077F64(ItemBehavior* arg0, u32 unk) u32 sub_08077F64(ItemBehavior* arg0, u32 unk) {
{
u32 temp; u32 temp;
if (gPlayerState.heldObject == 0) { if (gPlayerState.heldObject == 0) {
sub_08077F50(arg0, unk); sub_08077F50(arg0, unk);
temp = 0; temp = 0;
} } else {
else {
temp = 1; temp = 1;
} }
return temp; return temp;
} }
void sub_08077F84(void) void sub_08077F84(void) {
{
Entity* obj; Entity* obj;
if (((gPlayerEntity.collisionLayer & 2) == 0) && if (((gPlayerEntity.collisionLayer & 2) == 0) &&

View File

@ -42,8 +42,7 @@ void sub_080787CC(Entity* ent) {
sub_0807887C(ent, 5, 0); sub_0807887C(ent, 5, 0);
} }
s32 sub_080787D8(Entity *ent) s32 sub_080787D8(Entity* ent) {
{
s32 iVar1; s32 iVar1;
iVar1 = sub_0807887C(ent, 8, 0); iVar1 = sub_0807887C(ent, 8, 0);
@ -53,8 +52,7 @@ s32 sub_080787D8(Entity *ent)
return iVar1; return iVar1;
} }
s32 sub_08078800(Entity *ent) s32 sub_08078800(Entity* ent) {
{
s32 iVar1; s32 iVar1;
iVar1 = sub_0807887C(ent, 6, 0); iVar1 = sub_0807887C(ent, 6, 0);
@ -64,8 +62,7 @@ s32 sub_08078800(Entity *ent)
return iVar1; return iVar1;
} }
s32 sub_08078828(Entity *ent) s32 sub_08078828(Entity* ent) {
{
s32 iVar1; s32 iVar1;
iVar1 = sub_0807887C(ent, 3, 0); iVar1 = sub_0807887C(ent, 3, 0);
@ -75,8 +72,7 @@ s32 sub_08078828(Entity *ent)
return iVar1; return iVar1;
} }
void sub_08078850(u32 arg0, u32 arg1, u32 arg2, u32 arg3) void sub_08078850(u32 arg0, u32 arg1, u32 arg2, u32 arg3) {
{
s32 iVar1; s32 iVar1;
iVar1 = sub_08078904(); iVar1 = sub_08078904();

View File

@ -72,8 +72,7 @@ s32 sub_0807CE54(void) {
return uVar1; return uVar1;
} }
u32 sub_0807CE90(void) u32 sub_0807CE90(void) {
{
struct_0807D1C4* puVar1; struct_0807D1C4* puVar1;
int iVar2; int iVar2;
int iVar3; int iVar3;
@ -125,8 +124,7 @@ u32 sub_0807CF3C(void* arg0) {
return sub_0807D008(5, arg0); return sub_0807D008(5, arg0);
} }
void sub_0807CF48(u32 arg0) void sub_0807CF48(u32 arg0) {
{
struct_0807D1C4* temp; struct_0807D1C4* temp;
temp = sub_0807D1C4(arg0); temp = sub_0807D1C4(arg0);
@ -134,8 +132,7 @@ void sub_0807CF48(u32 arg0)
sub_0807D184(temp->field_0x2, gUnk_0811E4AC); sub_0807D184(temp->field_0x2, gUnk_0811E4AC);
} }
void sub_0807CF68(u32 arg0) void sub_0807CF68(u32 arg0) {
{
struct_0807D1C4* temp; struct_0807D1C4* temp;
char* str; char* str;

View File

@ -36,8 +36,7 @@ void sub_08080910(void) {
gScreenTransition.transitionType = 1; gScreenTransition.transitionType = 1;
} }
void sub_0808091C(ScreenTransitionData* param_1, u32 param_2) void sub_0808091C(ScreenTransitionData* param_1, u32 param_2) {
{
DoExitTransition(param_1); DoExitTransition(param_1);
gScreenTransition.transitionType = param_2; gScreenTransition.transitionType = param_2;
return; return;
@ -54,8 +53,7 @@ void sub_08080930(void)
return; return;
} }
u32* GetLayerByIndex(u32 param_1) u32* GetLayerByIndex(u32 param_1) {
{
if (param_1 == 2) { if (param_1 == 2) {
return &gUnk_0200B650; return &gUnk_0200B650;
@ -64,8 +62,7 @@ u32* GetLayerByIndex(u32 param_1)
} }
} }
void sub_08080964(u16 time, u32 magnitude) void sub_08080964(u16 time, u32 magnitude) {
{
gRoomControls.screenShakeTime = time; gRoomControls.screenShakeTime = time;
gRoomControls.screenShakeMagnitude = magnitude & 7; gRoomControls.screenShakeMagnitude = magnitude & 7;
return; return;

View File

@ -2,13 +2,11 @@
#include "entity.h" #include "entity.h"
#include "room.h" #include "room.h"
void sub_080A29BC(Entity *parent) void sub_080A29BC(Entity* parent) {
{
CreateFx(parent, 2, 0); CreateFx(parent, 2, 0);
} }
void sub_080A29C8(s32 xOff, s32 yOff, u32 layer) void sub_080A29C8(s32 xOff, s32 yOff, u32 layer) {
{
Entity* pEVar1; Entity* pEVar1;
pEVar1 = CreateObject(0xf, 2, 0); pEVar1 = CreateObject(0xf, 2, 0);
@ -19,23 +17,19 @@ void sub_080A29C8(s32 xOff, s32 yOff, u32 layer)
} }
} }
void sub_080A29FC(Entity *parent) void sub_080A29FC(Entity* parent) {
{
CreateFx(parent, 0x11, 0); CreateFx(parent, 0x11, 0);
} }
void sub_080A2A08(Entity *parent) void sub_080A2A08(Entity* parent) {
{
CreateFx(parent, 0x6, 0); CreateFx(parent, 0x6, 0);
} }
void sub_080A2A14(Entity *parent) void sub_080A2A14(Entity* parent) {
{
CreateFx(parent, 0xb, 0); CreateFx(parent, 0xb, 0);
} }
Entity * sub_080A2A20(Entity *parent, u32 form, u32 parameter) Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) {
{
Entity* pEVar1; Entity* pEVar1;
pEVar1 = CreateObjectWithParent(parent, 0, form, parameter); pEVar1 = CreateObjectWithParent(parent, 0, form, parameter);
@ -45,8 +39,7 @@ Entity * sub_080A2A20(Entity *parent, u32 form, u32 parameter)
return pEVar1; return pEVar1;
} }
Entity * sub_080A2A3C(Entity *parent, u32 form, u32 subtype, u32 param_4) Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) {
{
Entity* ent; Entity* ent;
ent = CreateObjectWithParent(parent, 0, form, subtype); ent = CreateObjectWithParent(parent, 0, form, subtype);
@ -57,8 +50,7 @@ Entity * sub_080A2A3C(Entity *parent, u32 form, u32 subtype, u32 param_4)
return ent; return ent;
} }
Entity * sub_080A2A64(Entity *parent) Entity* sub_080A2A64(Entity* parent) {
{
Entity* pEVar1; Entity* pEVar1;
pEVar1 = CreateFx(parent, 0x20, 0); pEVar1 = CreateFx(parent, 0x20, 0);

View File

@ -206,7 +206,6 @@ void sub_08031C1C(Entity* this) {
} }
} }
void sub_08031C58(Entity* this) { void sub_08031C58(Entity* this) {
Entity *a, *b; Entity *a, *b;
@ -412,7 +411,6 @@ void sub_08032008(Entity* this) {
if (this->direction & 0xf) if (this->direction & 0xf)
this->spriteSettings.b.flipX = (this->direction >> 4 ^ 1); this->spriteSettings.b.flipX = (this->direction >> 4 ^ 1);
ProcessMovement(this); ProcessMovement(this);
} else { } else {
if (this->field_0x76.HALF.HI == 0) { if (this->field_0x76.HALF.HI == 0) {

View File

@ -315,7 +315,6 @@ void sub_08021D44(Entity* this, u32 direction) {
} }
} }
// clang-format off // clang-format off
void (*const gUnk_080CB590[])(Entity*) = { void (*const gUnk_080CB590[])(Entity*) = {
sub_08021768, sub_08021768,
@ -356,4 +355,3 @@ const s8 gUnk_080CB5E4[] = {
-1, -2, -1, 0, 1, 2, 1, 0, -1, -2, -1, 0, 1, 2, 1, 0,
}; };
// clang-format on // clang-format on

View File

@ -20,8 +20,6 @@ void BladeTrap(Entity* ent) {
sub_0806F69C(ent); sub_0806F69C(ent);
} }
puVar3 = &(ent->field_0x74.HWORD); puVar3 = &(ent->field_0x74.HWORD);
uVar1 = *puVar3; uVar1 = *puVar3;
*puVar3 = uVar1 - 1; *puVar3 = uVar1 - 1;

View File

@ -10,19 +10,16 @@ extern void sub_0803C5F0(Entity*);
extern void (*const gUnk_080CFF78[])(Entity*); extern void (*const gUnk_080CFF78[])(Entity*);
extern void (*const gUnk_080CFF90[])(Entity*); extern void (*const gUnk_080CFF90[])(Entity*);
void BowMoblin(Entity *this) void BowMoblin(Entity* this) {
{
EnemyFunctionHandler(this, gUnk_080CFF78); EnemyFunctionHandler(this, gUnk_080CFF78);
SetChildOffset(this, 0, 1, -0x18); SetChildOffset(this, 0, 1, -0x18);
} }
void sub_0803C180(Entity *this) void sub_0803C180(Entity* this) {
{
gUnk_080CFF90[this->action](this); gUnk_080CFF90[this->action](this);
} }
void sub_0803C198(Entity *this) void sub_0803C198(Entity* this) {
{
Entity* pEVar1; Entity* pEVar1;
if (this->field_0x43 != 0) { if (this->field_0x43 != 0) {
@ -38,4 +35,5 @@ void sub_0803C198(Entity *this)
} }
} }
void nullsub_168(Entity* this){} void nullsub_168(Entity* this) {
}

View File

@ -70,7 +70,6 @@ void sub_0802B5C8(Entity *this) {
} }
} }
// clang-format off // clang-format off
void (*const gUnk_080CD27C[])(Entity*) = { void (*const gUnk_080CD27C[])(Entity*) = {
sub_0802B518, sub_0802B518,

View File

@ -146,7 +146,6 @@ void sub_08022B44(Entity *this){
EnqueueSFX(0xd6); EnqueueSFX(0xd6);
} }
// clang-format off // clang-format off
void (*const gUnk_080CBB64[])(Entity*) = { void (*const gUnk_080CBB64[])(Entity*) = {
sub_08022934, sub_08022934,

View File

@ -50,4 +50,3 @@ void (*const gUnk_080CB588[])(Entity*) = {
HangingSeed_Hang, HangingSeed_Hang,
}; };
// clang-format on // clang-format on

View File

@ -45,13 +45,13 @@ extern void sub_08001242(Entity *);
// Used in multiple functions // Used in multiple functions
extern Entity* CreateFx(Entity*, u32, u32); extern Entity* CreateFx(Entity*, u32, u32);
extern Entity *sub_0804A98C(Entity *positionEntity, u8 subtype, u8 form); // Creates a projectile positioned at the given entity extern Entity* sub_0804A98C(Entity* positionEntity, u8 subtype,
u8 form); // Creates a projectile positioned at the given entity
extern void UpdateAnimationSingleFrame(Entity*); extern void UpdateAnimationSingleFrame(Entity*);
extern void InitAnimationForceUpdate(Entity*, u32); extern void InitAnimationForceUpdate(Entity*, u32);
extern u32 sub_0806FCB8(Entity*, u32, u32, u32); extern u32 sub_0806FCB8(Entity*, u32, u32, u32);
extern u32 GetFacingDirection(Entity*, Entity*); extern u32 GetFacingDirection(Entity*, Entity*);
// Forward references to functions in lakitu.c // Forward references to functions in lakitu.c
extern void sub_0803CAD0(Entity*); extern void sub_0803CAD0(Entity*);
extern void sub_0803CBAC(Entity*); extern void sub_0803CBAC(Entity*);
@ -106,8 +106,7 @@ void sub_0803C784(Entity *this) {
this->field_0x20 = 0x20000; this->field_0x20 = 0x20000;
sub_0803CBAC(this); sub_0803CBAC(this);
} } else {
else {
if (this->damageType == 0x43) { if (this->damageType == 0x43) {
Entity* fx = CreateFx(this, 2, 0); Entity* fx = CreateFx(this, 2, 0);
@ -217,8 +216,7 @@ void Lakitu_Idle(Entity *this) {
this->damageType = 0x43; this->damageType = 0x43;
InitAnimationForceUpdate(this, this->animationState + 0xc); InitAnimationForceUpdate(this, this->animationState + 0xc);
} } else {
else {
sub_0803CA84(this, 4); sub_0803CA84(this, 4);
} }
} }
@ -250,8 +248,7 @@ void Lakitu_Lightning(Entity *this) {
this->actionDelay = 0xf; this->actionDelay = 0xf;
this->field_0x78.HALF.HI = TRUE; this->field_0x78.HALF.HI = TRUE;
} } else {
else {
this->actionDelay = 0x1e; this->actionDelay = 0x1e;
this->field_0x78.HALF.HI = FALSE; this->field_0x78.HALF.HI = FALSE;
@ -269,8 +266,7 @@ void Lakitu_LightningDelay(Entity *this) {
if (this->field_0x78.HALF.HI == 1) { if (this->field_0x78.HALF.HI == 1) {
sub_0803CB34(this); sub_0803CB34(this);
} } else {
else {
this->action = IDLE; this->action = IDLE;
this->actionDelay = 0xb4; this->actionDelay = 0xb4;
@ -316,7 +312,8 @@ void sub_0803CA84(Entity *this, u32 unkParameter) {
void sub_0803CAD0(Entity* this) { void sub_0803CAD0(Entity* this) {
if (sub_0806FCB8(this, this->field_0x74.HWORD, this->field_0x76.HWORD, 1) == 0) { if (sub_0806FCB8(this, this->field_0x74.HWORD, this->field_0x76.HWORD, 1) == 0) {
this->direction = sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, this->field_0x74.HWORD, this->field_0x76.HWORD); this->direction =
sub_080045D4(this->x.HALF.HI, this->y.HALF.HI, this->field_0x74.HWORD, this->field_0x76.HWORD);
sub_080AEFE0(this); sub_080AEFE0(this);
} }
@ -329,8 +326,7 @@ bool32 sub_0803CB04(Entity *this) {
delay = --this->actionDelay; delay = --this->actionDelay;
if (delay != 0) { if (delay != 0) {
returnValue = 0; returnValue = 0;
} } else {
else {
sub_0803CB34(this); sub_0803CB34(this);
this->field_0x78.HALF.HI = delay; this->field_0x78.HALF.HI = delay;
@ -440,23 +436,12 @@ void sub_0803CC08(Entity *this) {
} }
void (*const gUnk_080D0110[])(Entity*) = { void (*const gUnk_080D0110[])(Entity*) = {
Lakitu_DoAction, Lakitu_DoAction, sub_0803C784, sub_08001324, sub_0804A7D4, sub_08001242, sub_0803C820,
sub_0803C784,
sub_08001324,
sub_0804A7D4,
sub_08001242,
sub_0803C820,
}; };
void (*const LakituActionFuncs[])(Entity*) = { void (*const LakituActionFuncs[])(Entity*) = {
Lakitu_Initialize, Lakitu_Initialize, Lakitu_Hide, Lakitu_EndHide, Lakitu_Idle,
Lakitu_Hide, Lakitu_BeginHide, Lakitu_Lightning, Lakitu_LightningDelay, Lakitu_Cloudless,
Lakitu_EndHide,
Lakitu_Idle,
Lakitu_BeginHide,
Lakitu_Lightning,
Lakitu_LightningDelay,
Lakitu_Cloudless,
}; };
void (*const gUnk_080D0148[])(Entity*) = { void (*const gUnk_080D0148[])(Entity*) = {

View File

@ -41,8 +41,7 @@ void sub_0803CCFC(Entity *this) {
if (this->previousActionFlag == 2) { if (this->previousActionFlag == 2) {
sub_0803CE3C(this); sub_0803CE3C(this);
} }
} } else {
else {
gUnk_080D043C[this->previousActionFlag](this); gUnk_080D043C[this->previousActionFlag](this);
} }
} }
@ -153,12 +152,7 @@ void sub_0803CE3C(Entity *this) {
} }
void (*const gUnk_080D0418[])(Entity*) = { void (*const gUnk_080D0418[])(Entity*) = {
sub_0803CCD4, sub_0803CCD4, sub_0803CCD4, sub_0803CCEC, sub_0804A7D4, sub_08001242, sub_0803CCFC,
sub_0803CCD4,
sub_0803CCEC,
sub_0804A7D4,
sub_08001242,
sub_0803CCFC,
}; };
void (*const gUnk_080D0430[])(Entity*) = { void (*const gUnk_080D0430[])(Entity*) = {

View File

@ -265,23 +265,10 @@ void sub_08028224(u32 param_1) {
TextboxNoOverlapFollow(0x579); TextboxNoOverlapFollow(0x579);
} }
void (*const gUnk_080CC6FC[])(Entity*) = { void (*const gUnk_080CC6FC[])(Entity*) = {
sub_08027D8C, sub_08027D8C, sub_08027DA4, sub_08001324, sub_08027E40, sub_08001242, nullsub_139,
sub_08027DA4,
sub_08001324,
sub_08027E40,
sub_08001242,
nullsub_139,
}; };
void (*const gUnk_080CC714[])(Entity*) = { void (*const gUnk_080CC714[])(Entity*) = {
sub_08027E70, sub_08027E70, sub_08027EFC, nullsub_12, sub_08027F84, sub_08027FB4, sub_08027FE0, sub_0802802C, sub_0802805C,
sub_08027EFC,
nullsub_12,
sub_08027F84,
sub_08027FB4,
sub_08027FE0,
sub_0802802C,
sub_0802805C,
}; };

View File

@ -365,8 +365,6 @@ void sub_08020604(Entity *this){
} }
} }
// clang-format off // clang-format off
void (*const gPeahatFunctions[])(Entity*) = { void (*const gPeahatFunctions[])(Entity*) = {
Peahat_OnTick, Peahat_OnTick,
@ -414,4 +412,3 @@ const s8 gUnk_080CA5D4[] = {
}; };
*/ */
// clang-format on // clang-format on

View File

@ -32,7 +32,8 @@ void sub_08031680(Entity *this){
gUnk_080CE548[this->action](this); gUnk_080CE548[this->action](this);
} }
void nullsub_152(){} void nullsub_152() {
}
void sub_0803169C(Entity* this) { void sub_0803169C(Entity* this) {
s32 iVar1; s32 iVar1;
@ -45,8 +46,7 @@ void sub_0803169C(Entity *this){
this->flags = this->flags | 0x80; this->flags = this->flags | 0x80;
this->nonPlanarMovement = 0x40; this->nonPlanarMovement = 0x40;
this->field_0xf = 1; this->field_0xf = 1;
} } else {
else {
gUnk_080CE554[this->previousActionFlag](this); gUnk_080CE554[this->previousActionFlag](this);
} }
} }
@ -110,7 +110,6 @@ void sub_080317B4(Entity* this){
GetNextFrame(this); GetNextFrame(this);
} }
void sub_080317E0(Entity* this) { void sub_080317E0(Entity* this) {
this->animationState = ((u8)(this->direction + 2) & 0x1c) >> 2; this->animationState = ((u8)(this->direction + 2) & 0x1c) >> 2;
InitializeAnimation(this, this->animationState); InitializeAnimation(this, this->animationState);
@ -139,4 +138,3 @@ void sub_08031840(Entity* this){
enemy->entityType.parameter = 1; enemy->entityType.parameter = 1;
} }
} }

6
src/enemy/treeItem.c Executable file → Normal file
View File

@ -87,10 +87,8 @@ static bool32 ShouldSpawnTreeItem(Entity* this) {
} }
playerState = gPlayerEntity.animationState; playerState = gPlayerEntity.animationState;
if ((playerState == 0 && expectedStateY == 0) || if ((playerState == 0 && expectedStateY == 0) || (playerState == 4 && expectedStateY == 4) ||
(playerState == 4 && expectedStateY == 4) || (playerState == 6 && expectedStateX == 6) || (playerState == 2 && expectedStateX == 2)) {
(playerState == 6 && expectedStateX == 6) ||
(playerState == 2 && expectedStateX == 2)) {
return TRUE; return TRUE;
} }

View File

@ -317,10 +317,8 @@ Entity* FindEntityInListByForm(int type, int subtype, int listIndex, int form, i
list = &gEntityLists[listIndex]; list = &gEntityLists[listIndex];
for (i = list->first; (u32)i != (u32)list; i = i->next) { for (i = list->first; (u32)i != (u32)list; i = i->next) {
if (type == i->entityType.type if (type == i->entityType.type && subtype == i->entityType.subtype && form == i->entityType.form &&
&& subtype == i->entityType.subtype parameter == i->entityType.parameter)
&& form == i->entityType.form
&& parameter == i->entityType.parameter)
return i; return i;
} }
return NULL; return NULL;

View File

@ -30,7 +30,6 @@ u32 CheckFlags(u32 flags) {
default: default:
return 0; return 0;
} }
} }
u32 CheckGlobalFlag(u32 flag) { u32 CheckGlobalFlag(u32 flag) {

View File

@ -13,8 +13,7 @@ extern Entity gPlayerEntity;
extern u8 gUnk_080FCAC8[]; extern u8 gUnk_080FCAC8[];
void InitializePlayer(void) void InitializePlayer(void) {
{
Entity* pl; Entity* pl;
sub_080784C8(); sub_080784C8();

View File

@ -4,14 +4,12 @@
static void StoreKeyInput(Input*, u32); static void StoreKeyInput(Input*, u32);
void ReadKeyInput(void) void ReadKeyInput(void) {
{
u32 keyInput = ~REG_KEYINPUT & KEYS_MASK; u32 keyInput = ~REG_KEYINPUT & KEYS_MASK;
StoreKeyInput(&gUnk_03000FF0, keyInput); StoreKeyInput(&gUnk_03000FF0, keyInput);
} }
static void StoreKeyInput(Input *input, u32 keyInput) static void StoreKeyInput(Input* input, u32 keyInput) {
{
u32 heldKeys = input->heldKeys; u32 heldKeys = input->heldKeys;
u32 difference = keyInput & ~heldKeys; u32 difference = keyInput & ~heldKeys;
input->newKeys = difference; input->newKeys = difference;
@ -19,12 +17,10 @@ static void StoreKeyInput(Input *input, u32 keyInput)
if (--input->unk7 == 0) { if (--input->unk7 == 0) {
input->unk7 = 4; input->unk7 = 4;
input->unk4 = keyInput; input->unk4 = keyInput;
} } else {
else {
input->unk4 = 0; input->unk4 = 0;
} }
} } else {
else {
input->unk7 = 0x14; input->unk7 = 0x14;
input->unk4 = difference; input->unk4 = difference;
} }

View File

@ -48,26 +48,18 @@ static void (*const sIntroSequenceHandlers[])(void) = {
}; };
static const u16 sLightRaysAlphaBlends[] = { static const u16 sLightRaysAlphaBlends[] = {
BLDALPHA_BLEND(9, 9), BLDALPHA_BLEND(9, 9), BLDALPHA_BLEND(8, 10), BLDALPHA_BLEND(7, 11), BLDALPHA_BLEND(6, 12),
BLDALPHA_BLEND(8, 10), BLDALPHA_BLEND(5, 13), BLDALPHA_BLEND(6, 12), BLDALPHA_BLEND(7, 11), BLDALPHA_BLEND(8, 10),
BLDALPHA_BLEND(7, 11),
BLDALPHA_BLEND(6, 12),
BLDALPHA_BLEND(5, 13),
BLDALPHA_BLEND(6, 12),
BLDALPHA_BLEND(7, 11),
BLDALPHA_BLEND(8, 10),
}; };
static u32 AdvanceIntroSequence(u32 transition) static u32 AdvanceIntroSequence(u32 transition) {
{
gUnk_02032EC0.transitionType = transition; gUnk_02032EC0.transitionType = transition;
gUnk_03001000.funcIndex = 2; gUnk_03001000.funcIndex = 2;
_DmaZero(&gIntroState, sizeof(gIntroState)); _DmaZero(&gIntroState, sizeof(gIntroState));
DoFade(7, 8); DoFade(7, 8);
} }
void HandleIntroScreen(void) void HandleIntroScreen(void) {
{
sub_080AD90C(); sub_080AD90C();
switch (gUnk_03001000.funcIndex) { switch (gUnk_03001000.funcIndex) {
case 0: case 0:
@ -89,8 +81,7 @@ void HandleIntroScreen(void)
sub_080AD918(); sub_080AD918();
} }
static void HandleNintendoCapcomLogos(void) static void HandleNintendoCapcomLogos(void) {
{
u32 advance; u32 advance;
u32 paletteGroup; u32 paletteGroup;
@ -103,8 +94,7 @@ static void HandleNintendoCapcomLogos(void)
LoadGfxGroup(1); LoadGfxGroup(1);
if (((struct_02000000*)0x2000000)->gameLanguage == 0) { if (((struct_02000000*)0x2000000)->gameLanguage == 0) {
paletteGroup = 1; paletteGroup = 1;
} } else {
else {
paletteGroup = 2; paletteGroup = 2;
} }
LoadPaletteGroup(paletteGroup); LoadPaletteGroup(paletteGroup);
@ -126,8 +116,7 @@ static void HandleNintendoCapcomLogos(void)
extern u16 gUnk_03001010[5]; extern u16 gUnk_03001010[5];
static void HandleTitlescreen(void) static void HandleTitlescreen(void) {
{
int advance; int advance;
u32 paletteGroup; u32 paletteGroup;
@ -145,8 +134,7 @@ static void HandleTitlescreen(void)
LoadGfxGroup(2); LoadGfxGroup(2);
if (((struct_02000000*)0x2000000)->gameLanguage == 0) { if (((struct_02000000*)0x2000000)->gameLanguage == 0) {
paletteGroup = 3; paletteGroup = 3;
} } else {
else {
paletteGroup = 4; paletteGroup = 4;
} }
LoadPaletteGroup(paletteGroup); LoadPaletteGroup(paletteGroup);
@ -158,8 +146,7 @@ static void HandleTitlescreen(void)
gScreen.affine.bg3Control = 0x1e03; gScreen.affine.bg3Control = 0x1e03;
gScreen.lcd.displayControl |= 0x1e00; gScreen.lcd.displayControl |= 0x1e00;
gScreen.bg.bg2xOffset = 0xff60; gScreen.bg.bg2xOffset = 0xff60;
} } else {
else {
gScreen.controls.layerFXControl = 0x241; gScreen.controls.layerFXControl = 0x241;
gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9); gScreen.controls.alphaBlend = BLDALPHA_BLEND(9, 9);
gScreen.bg.bg0Control = 0x1d02; gScreen.bg.bg0Control = 0x1d02;
@ -180,8 +167,7 @@ static void HandleTitlescreen(void)
} }
if (((struct_02000000*)0x2000000)->gameLanguage == 0) { if (((struct_02000000*)0x2000000)->gameLanguage == 0) {
HandleJapaneseTitlescreenAnimationIntro(); HandleJapaneseTitlescreenAnimationIntro();
} } else {
else {
HandleTitlescreenAnimationIntro(); HandleTitlescreenAnimationIntro();
} }
break; break;
@ -197,8 +183,7 @@ static void HandleTitlescreen(void)
if (advance != ADVANCE_NONE) { if (advance != ADVANCE_NONE) {
if (advance == ADVANCE_KEY_PRESSED) { if (advance == ADVANCE_KEY_PRESSED) {
PlaySFX(0x6a); PlaySFX(0x6a);
} } else {
else {
advance = ADVANCE_NONE; advance = ADVANCE_NONE;
} }
AdvanceIntroSequence(advance); AdvanceIntroSequence(advance);
@ -230,8 +215,7 @@ static void UpdatePressStartIcon(void) {
return; return;
} }
static void UpdateSwordBgAffineData(void) static void UpdateSwordBgAffineData(void) {
{
struct BgAffineSrcData aff; struct BgAffineSrcData aff;
aff.texY = 0x8000; aff.texY = 0x8000;
aff.texX = 0x8000; aff.texX = 0x8000;
@ -242,8 +226,7 @@ static void UpdateSwordBgAffineData(void)
BgAffineSet(&aff, (struct BgAffineDstData*)&gBgControls, 1); BgAffineSet(&aff, (struct BgAffineDstData*)&gBgControls, 1);
} }
static void HandleJapaneseTitlescreenAnimationIntro(void) static void HandleJapaneseTitlescreenAnimationIntro(void) {
{
Entity* pEVar2; Entity* pEVar2;
switch (gIntroState.subState) { switch (gIntroState.subState) {

View File

@ -2,41 +2,12 @@
#include "entity.h" #include "entity.h"
#include "item.h" #include "item.h"
// TODO - How does this relate to PlayerItemFunctions? Is this just a lookup table? // TODO - How does this relate to PlayerItemFunctions? Is this just a lookup table?
void (*const gItemFunctions[])(ItemBehavior*, u32) = { void (*const gItemFunctions[])(ItemBehavior*, u32) = {
DebugItem, DebugItem, Sword, Sword, Sword, Sword, Sword, Sword, Bomb,
Sword, Bomb, Bow, Bow, sub_08075D14, sub_08075D14, Shield, Shield, Lantern,
Sword, Lantern, GustJar, PacciCane, MoleMitts, RocsCape, sub_08076800, DebugItem, Ocarina,
Sword, DebugItem, DebugItem, DebugItem, TryPickupObject, JarEmpty, JarEmpty, JarEmpty, JarEmpty,
Sword,
Sword,
Sword,
Bomb,
Bomb,
Bow,
Bow,
sub_08075D14,
sub_08075D14,
Shield,
Shield,
Lantern,
Lantern,
GustJar,
PacciCane,
MoleMitts,
RocsCape,
sub_08076800,
DebugItem,
Ocarina,
DebugItem,
DebugItem,
DebugItem,
TryPickupObject,
JarEmpty,
JarEmpty,
JarEmpty,
JarEmpty,
}; };
extern void sub_08077E78(ItemBehavior*, u32); extern void sub_08077E78(ItemBehavior*, u32);
@ -141,20 +112,17 @@ void sub_08076D34(ItemBehavior* beh, u32 arg1) {
} }
} }
void sub_08076D94(ItemBehavior *beh, u32 arg1) void sub_08076D94(ItemBehavior* beh, u32 arg1) {
{
if (sub_08077EFC(beh)) { if (sub_08077EFC(beh)) {
gPlayerState.field_0x3[0] |= 1; gPlayerState.field_0x3[0] |= 1;
UpdateItemAnim(beh); UpdateItemAnim(beh);
} } else {
else {
gPlayerState.field_0x3[0] = 0; gPlayerState.field_0x3[0] = 0;
sub_08077E78(beh, arg1); sub_08077E78(beh, arg1);
} }
} }
void GustJar(ItemBehavior *beh, u32 arg1) void GustJar(ItemBehavior* beh, u32 arg1) {
{
gPlayerState.field_0xa8 = 3; gPlayerState.field_0xa8 = 3;
gUnk_0811BDF4[beh->stateID](beh, arg1); gUnk_0811BDF4[beh->stateID](beh, arg1);
} }

View File

@ -14,19 +14,16 @@ extern BoundingBox gUnk_080B3E18;
extern u8 gUnk_080B3DE0[]; extern u8 gUnk_080B3DE0[];
extern BoundingBox* gUnk_080B3DE8[]; extern BoundingBox* gUnk_080B3DE8[];
void Item11(Entity *this) void Item11(Entity* this) {
{
if (this->currentHealth) { if (this->currentHealth) {
this->hurtBlinkTime = 0; this->hurtBlinkTime = 0;
gUnk_080B3DD0[this->action](this); gUnk_080B3DD0[this->action](this);
} } else {
else {
DeleteThisEntity(); DeleteThisEntity();
} }
} }
void sub_08018CBC(Entity *this) void sub_08018CBC(Entity* this) {
{
u32 PVar1; u32 PVar1;
u8 uVar2; u8 uVar2;
Entity* pEVar3; Entity* pEVar3;
@ -49,8 +46,7 @@ void sub_08018CBC(Entity *this)
this->boundingBox = &gUnk_080B3E18; this->boundingBox = &gUnk_080B3E18;
this->attachedEntity->spriteOffsetX = 0; this->attachedEntity->spriteOffsetX = 0;
this->attachedEntity->spriteSettings.b.draw = 0; this->attachedEntity->spriteSettings.b.draw = 0;
} } else {
else {
if (gPlayerState.field_0x1c == 0) { if (gPlayerState.field_0x1c == 0) {
DeleteThisEntity(); DeleteThisEntity();
} }
@ -73,8 +69,7 @@ void sub_08018CBC(Entity *this)
sub_0801766C(this); sub_0801766C(this);
} }
void sub_08018DE8(Entity *this) void sub_08018DE8(Entity* this) {
{
u8 bVar1; u8 bVar1;
bVar1 = this->attachedEntity->field_0x3a & 4; bVar1 = this->attachedEntity->field_0x3a & 4;

View File

@ -15,12 +15,9 @@ static void sub_08055F70(void);
static bool32 SoftResetKeysPressed(void); static bool32 SoftResetKeysPressed(void);
static void (*const sScreenHandlers[])(void) = { static void (*const sScreenHandlers[])(void) = {
[SCREEN_INTRO] = HandleIntroScreen, [SCREEN_INTRO] = HandleIntroScreen, [SCREEN_CHOOSE_FILE] = HandleChooseFileScreen,
[SCREEN_CHOOSE_FILE] = HandleChooseFileScreen, [SCREEN_GAMEPLAY] = HandleGameplayScreen, [SCREEN_GAME_OVER] = HandleGameOverScreen,
[SCREEN_GAMEPLAY] = HandleGameplayScreen, [SCREEN_CREDITS] = HandleCreditsScreen, [SCREEN_DEBUG_TEXT] = HandleDebugTextScreen,
[SCREEN_GAME_OVER] = HandleGameOverScreen,
[SCREEN_CREDITS] = HandleCreditsScreen,
[SCREEN_DEBUG_TEXT] = HandleDebugTextScreen,
}; };
void MainLoop(void) { void MainLoop(void) {

View File

@ -13,8 +13,7 @@ extern void (*const gUnk_08107C48[])(Entity*);
extern u8 gUnk_08107C40[]; extern u8 gUnk_08107C40[];
void Manager1(Entity *this) void Manager1(Entity* this) {
{
u8 bVar1; u8 bVar1;
u8* pbVar2; u8* pbVar2;
@ -27,8 +26,7 @@ void Manager1(Entity *this)
} }
} }
void sub_080570B8(Entity *this) void sub_080570B8(Entity* this) {
{
u8* pbVar1; u8* pbVar1;
LoadGfxGroup(((u8*)&this->field_0x20)[0]); LoadGfxGroup(((u8*)&this->field_0x20)[0]);
@ -36,21 +34,18 @@ void sub_080570B8(Entity *this)
pbVar1 = ((u8*)&this->field_0x20 + 1); pbVar1 = ((u8*)&this->field_0x20 + 1);
if (*pbVar1 == 3) { if (*pbVar1 == 3) {
gScreen.affine.unk4 = 1; gScreen.affine.unk4 = 1;
} } else {
else {
gUnk_08107C48[*pbVar1](this); gUnk_08107C48[*pbVar1](this);
} }
} }
void sub_080570F8(void) void sub_080570F8(void) {
{
gScreen.lcd.displayControl &= 0xf7ff; gScreen.lcd.displayControl &= 0xf7ff;
gScreen.controls.layerFXControl = 0; gScreen.controls.layerFXControl = 0;
sub_08056250(); sub_08056250();
} }
void sub_08057118(Entity *this) void sub_08057118(Entity* this) {
{
this->actionDelay = 0; this->actionDelay = 0;
*(u8*)&this->field_0x20 = 0; *(u8*)&this->field_0x20 = 0;
((u8*)&this->field_0x20)[1] = 0; ((u8*)&this->field_0x20)[1] = 0;

View File

@ -29,7 +29,6 @@ void sub_0805A280(Manager* this) {
gUnk_081085D8[this->unk_0a](this); gUnk_081085D8[this->unk_0a](this);
} }
void sub_0805A89C(Manager15*); void sub_0805A89C(Manager15*);
void sub_0805A8EC(Manager15*); void sub_0805A8EC(Manager15*);
void sub_0805AAF0(u32); void sub_0805AAF0(u32);
@ -201,9 +200,11 @@ void sub_0805A500(Manager15* this) {
this->manager.unk_0d = 1; this->manager.unk_0d = 1;
return; return;
} }
if (!this->manager.unk_0d) return; if (!this->manager.unk_0d)
return;
this->manager.unk_0d = 0; this->manager.unk_0d = 0;
if (this->unk_20 == gRoomControls.roomID) return; if (this->unk_20 == gRoomControls.roomID)
return;
gScreen.lcd.displayControl &= 0xB7FF; gScreen.lcd.displayControl &= 0xB7FF;
DeleteThisEntity(); DeleteThisEntity();
} }
@ -235,8 +236,10 @@ void sub_0805A64C(Manager15* this) {
} }
} }
void sub_0805A65C(Manager15* this) {} void sub_0805A65C(Manager15* this) {
void sub_0805A660(Manager15* this) {} }
void sub_0805A660(Manager15* this) {
}
extern void (*const gUnk_08108638[])(Manager15*); extern void (*const gUnk_08108638[])(Manager15*);
void sub_0805A68C(Manager15*); void sub_0805A68C(Manager15*);
@ -295,10 +298,7 @@ extern void sub_0805E4E0(Manager*, u32);
extern void sub_08077B20(void); extern void sub_08077B20(void);
void sub_0805A76C(Manager15* this) { void sub_0805A76C(Manager15* this) {
if ((gPlayerEntity.currentHealth != 0) if ((gPlayerEntity.currentHealth != 0) && (gPlayerEntity.height.HALF.HI == 0) && (!gPlayerState.field_0x2c)) {
&& (gPlayerEntity.height.HALF.HI == 0)
&& (!gPlayerState.field_0x2c)
) {
switch (gPlayerState.field_0xa9) { switch (gPlayerState.field_0xa9) {
case 1: case 1:
case 0: case 0:
@ -337,7 +337,8 @@ void sub_0805A804(Manager15* this) {
sub_0805E3A0(this, 6); sub_0805E3A0(this, 6);
break; break;
case 1: case 1:
if (CheckLocalFlag(this->unk_3e)) break; if (CheckLocalFlag(this->unk_3e))
break;
this->manager.action = 2; this->manager.action = 2;
sub_0805A4CC(this, 4); sub_0805A4CC(this, 4);
break; break;
@ -347,7 +348,8 @@ void sub_0805A804(Manager15* this) {
} }
break; break;
case 3: case 3:
if (!CheckLocalFlag(this->unk_3e)) break; if (!CheckLocalFlag(this->unk_3e))
break;
this->manager.action = 4; this->manager.action = 4;
sub_0805A4CC(this, 4); sub_0805A4CC(this, 4);
break; break;
@ -387,9 +389,11 @@ void sub_0805A8EC(Manager15* this) {
gScreen.lcd.displayControl |= 0x4000; gScreen.lcd.displayControl |= 0x4000;
this->manager.unk_0d = 1; this->manager.unk_0d = 1;
} else { } else {
if (!this->manager.unk_0d) return; if (!this->manager.unk_0d)
return;
this->manager.unk_0d = 0; this->manager.unk_0d = 0;
if (this->unk_20 == gRoomControls.roomID) return; if (this->unk_20 == gRoomControls.roomID)
return;
gScreen.lcd.displayControl &= 0xB7FF; gScreen.lcd.displayControl &= 0xB7FF;
DeleteThisEntity(); DeleteThisEntity();
} }
@ -401,17 +405,25 @@ void sub_0805A94C(Manager15* this) {
gScreen.affine.bg3yOffset = gRoomControls.roomScrollY - this->unk_26 + this->unk_36; gScreen.affine.bg3yOffset = gRoomControls.roomScrollY - this->unk_26 + this->unk_36;
tmp1 = -gScreen.affine.bg3xOffset; tmp1 = -gScreen.affine.bg3xOffset;
tmp2 = tmp1 + 0x100; tmp2 = tmp1 + 0x100;
if (tmp1 < 0) tmp1 = 0; if (tmp1 < 0)
if (tmp1 > 0xF0) tmp1 = 0xF0; tmp1 = 0;
if (tmp2 < 0) tmp2 = 0; if (tmp1 > 0xF0)
if (tmp2 > 0xF0) tmp2 = 0xF0; tmp1 = 0xF0;
if (tmp2 < 0)
tmp2 = 0;
if (tmp2 > 0xF0)
tmp2 = 0xF0;
gScreen.controls.window1HorizontalDimensions = (tmp1 << 8 | tmp2); gScreen.controls.window1HorizontalDimensions = (tmp1 << 8 | tmp2);
tmp1 = -gScreen.affine.bg3yOffset; tmp1 = -gScreen.affine.bg3yOffset;
tmp2 = tmp1 + 0x100; tmp2 = tmp1 + 0x100;
if (tmp1 < 0) tmp1 = 0; if (tmp1 < 0)
if (tmp1 > 0xA0) tmp1 = 0xA0; tmp1 = 0;
if (tmp2 < 0) tmp2 = 0; if (tmp1 > 0xA0)
if (tmp2 > 0xA0) tmp2 = 0xA0; tmp1 = 0xA0;
if (tmp2 < 0)
tmp2 = 0;
if (tmp2 > 0xA0)
tmp2 = 0xA0;
gScreen.controls.window1VerticalDimensions = (tmp1 << 8 | tmp2); gScreen.controls.window1VerticalDimensions = (tmp1 << 8 | tmp2);
} }
@ -424,18 +436,24 @@ void sub_0805A9CC(Manager15* this) {
gScreen.affine.bg3xOffset = gRoomControls.roomScrollX - this->unk_24 + this->unk_34; gScreen.affine.bg3xOffset = gRoomControls.roomScrollX - this->unk_24 + this->unk_34;
tmp1 = -gScreen.affine.bg3xOffset; tmp1 = -gScreen.affine.bg3xOffset;
tmp2 = tmp1 + 0x100; tmp2 = tmp1 + 0x100;
if (tmp1 < 0) tmp1 = 0; if (tmp1 < 0)
if (tmp1 > 0xF0) tmp1 = 0xF0; tmp1 = 0;
if (tmp2 < 0) tmp2 = 0; if (tmp1 > 0xF0)
if (tmp2 > 0xF0) tmp2 = 0xF0; tmp1 = 0xF0;
if (tmp2 < 0)
tmp2 = 0;
if (tmp2 > 0xF0)
tmp2 = 0xF0;
gScreen.controls.window1HorizontalDimensions = tmp1 << 8 | tmp2; gScreen.controls.window1HorizontalDimensions = tmp1 << 8 | tmp2;
tmp1 = gRoomControls.roomScrollY - this->unk_26 + this->unk_36; tmp1 = gRoomControls.roomScrollY - this->unk_26 + this->unk_36;
gScreen.affine.bg3yOffset = tmp1 & 0x3F; gScreen.affine.bg3yOffset = tmp1 & 0x3F;
if (tmp1 < 0) tmp1 += 0x3F; if (tmp1 < 0)
tmp1 += 0x3F;
tmp3 = (&gUnk_02001A40[(tmp1 >> 6 << 9)]); tmp3 = (&gUnk_02001A40[(tmp1 >> 6 << 9)]);
gScreen.affine.unk5 = (u32)tmp3; gScreen.affine.unk5 = (u32)tmp3;
gScreen.controls.window1VerticalDimensions = 0xa0; gScreen.controls.window1VerticalDimensions = 0xa0;
if (this->unk_28 == tmp3) return; if (this->unk_28 == tmp3)
return;
this->unk_28 = tmp3; this->unk_28 = tmp3;
gScreen.affine.unk4 = 1; gScreen.affine.unk4 = 1;
} }
@ -446,9 +464,7 @@ void sub_0805A9CC(Manager15* this) {
} }
#endif #endif
extern struct { extern struct { u8 unk_00[0x20]; } gUnk_085A97A0[];
u8 unk_00[0x20];
} gUnk_085A97A0[];
extern u16 gUnk_081085B8[]; extern u16 gUnk_081085B8[];
extern void LoadPalettes(const u8*, u32, u32); extern void LoadPalettes(const u8*, u32, u32);
@ -472,7 +488,6 @@ void sub_0805AAC8(Manager15* this) {
sub_0805A280(&this->manager); sub_0805A280(&this->manager);
} }
extern u16 gUnk_08108648[]; extern u16 gUnk_08108648[];
void sub_0805AADC(u32 unk0) { void sub_0805AADC(u32 unk0) {

View File

@ -6,7 +6,6 @@
#include "screen.h" #include "screen.h"
#include "functions.h" #include "functions.h"
typedef struct { typedef struct {
Manager manager; Manager manager;
s16 unk_20; s16 unk_20;
@ -99,14 +98,15 @@ void sub_0805B048(Manager1A* this) {
sub_0805B328(this); sub_0805B328(this);
sub_08052D74(this, sub_0805B328, 0); sub_08052D74(this, sub_0805B328, 0);
} }
if (!tmp->unk_10) return; if (!tmp->unk_10)
return;
obj = CreateObject(0x28, tmp->unk_10->unk_00, tmp->unk_10->unk_01); obj = CreateObject(0x28, tmp->unk_10->unk_00, tmp->unk_10->unk_01);
if (obj) { if (obj) {
obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.roomOriginX; obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.roomOriginX;
obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.roomOriginY; obj->y.HALF.HI = tmp->unk_10->unk_06 + gRoomControls.roomOriginY;
} }
if (this->manager.unk_0a != 0xa if (this->manager.unk_0a != 0xa || CheckLocalFlag(0x4B))
|| CheckLocalFlag(0x4B)) return; return;
obj = CreateObject(0x28, 3, 3); obj = CreateObject(0x28, 3, 3);
if (obj) { if (obj) {
obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.roomOriginX; obj->x.HALF.HI = tmp->unk_10->unk_04 + gRoomControls.roomOriginX;
@ -125,9 +125,11 @@ void sub_0805B168(Manager1A* this) {
this->manager.unk_0d = 1; this->manager.unk_0d = 1;
return; return;
} }
if (!this->manager.unk_0d) return; if (!this->manager.unk_0d)
return;
this->manager.unk_0d = 0; this->manager.unk_0d = 0;
if (this->unk_3f == gRoomControls.roomID) return; if (this->unk_3f == gRoomControls.roomID)
return;
if (this->manager.unk_0b) { if (this->manager.unk_0b) {
gScreen.lcd.displayControl &= ~0x800; gScreen.lcd.displayControl &= ~0x800;
} }
@ -179,7 +181,8 @@ void sub_0805B210(Manager1A* this) {
void sub_0805B2B0(Manager1A* this) { void sub_0805B2B0(Manager1A* this) {
s32 tmp, tmp2; s32 tmp, tmp2;
if (!this->manager.unk_0b) return; if (!this->manager.unk_0b)
return;
tmp = (this->unk_30 - gRoomControls.roomScrollX) / 4; tmp = (this->unk_30 - gRoomControls.roomScrollX) / 4;
tmp2 = (this->unk_32 - gRoomControls.roomScrollY) / 4; tmp2 = (this->unk_32 - gRoomControls.roomScrollY) / 4;
if (tmp < -12) { if (tmp < -12) {
@ -203,7 +206,8 @@ void sub_0805B2B0(Manager1A* this) {
void sub_0805B328(Manager1A* this) { void sub_0805B328(Manager1A* this) {
struct_08108764* tmp; struct_08108764* tmp;
if (!this->manager.unk_0b) return; if (!this->manager.unk_0b)
return;
tmp = &gUnk_08108764[this->manager.unk_0a]; tmp = &gUnk_08108764[this->manager.unk_0a];
LoadAssetAsync(&gGlobalGfxAndPalettes[tmp->unk_0c->unk_00], 0x0600F000, 0x800); LoadAssetAsync(&gGlobalGfxAndPalettes[tmp->unk_0c->unk_00], 0x0600F000, 0x800);
gScreen.affine.bg3Control = 0x1E07; gScreen.affine.bg3Control = 0x1E07;
@ -215,7 +219,8 @@ void sub_0805B328(Manager1A* this) {
void sub_0805B390(u32 unk1) { void sub_0805B390(u32 unk1) {
Manager* tmp = GetEmptyManager(); Manager* tmp = GetEmptyManager();
if (!tmp) return; if (!tmp)
return;
tmp->type = 0x9; tmp->type = 0x9;
tmp->subtype = 0x1A; tmp->subtype = 0x1A;
tmp->unk_0a = unk1; tmp->unk_0a = unk1;

View File

@ -6,8 +6,7 @@ extern void sub_080576A0();
extern void sub_08052D74(); extern void sub_08052D74();
extern void sub_0805754C(Entity*); extern void sub_0805754C(Entity*);
void Manager2(Entity *this) void Manager2(Entity* this) {
{
if (this->action == 0) { if (this->action == 0) {
this->action = 1; this->action = 1;
gScreen.affine.unk4 = 0; gScreen.affine.unk4 = 0;

View File

@ -21,7 +21,8 @@ extern void DeleteManager(Manager20*);
void sub_0805B7A0(Manager20* this) { void sub_0805B7A0(Manager20* this) {
Entity* tmp = CreateObject(this->manager.unk_0e, this->manager.unk_0a, this->manager.unk_0b); Entity* tmp = CreateObject(this->manager.unk_0e, this->manager.unk_0a, this->manager.unk_0b);
if (!tmp) return; if (!tmp)
return;
tmp->field_0x86.HWORD = this->unk_3e; tmp->field_0x86.HWORD = this->unk_3e;
if (CheckFlags(this->unk_3e)) { if (CheckFlags(this->unk_3e)) {
tmp->x.HALF.HI = this->unk_36 | (this->unk_37 & 0xF) << 8; // r1 tmp->x.HALF.HI = this->unk_36 | (this->unk_37 & 0xF) << 8; // r1

View File

@ -9,26 +9,22 @@ extern void (*const gUnk_08108D10[])(Entity*);
extern u8 gUnk_08108D20[]; extern u8 gUnk_08108D20[];
void Manager27(Entity *this) void Manager27(Entity* this) {
{
gUnk_08108D10[this->action](this); gUnk_08108D10[this->action](this);
if (CheckLocalFlagByOffset(0x300, this->entityType.form + 0x67)) { if (CheckLocalFlagByOffset(0x300, this->entityType.form + 0x67)) {
gScreenTransition.field_0xac |= (1 << (this->entityType).form); gScreenTransition.field_0xac |= (1 << (this->entityType).form);
} } else {
else {
gScreenTransition.field_0xac &= ~(1 << (this->entityType).form); gScreenTransition.field_0xac &= ~(1 << (this->entityType).form);
} }
} }
void sub_0805C874(Entity *this) void sub_0805C874(Entity* this) {
{
u8 bVar1; u8 bVar1;
if (sub_0805C920(this)) { if (sub_0805C920(this)) {
this->action = 2; this->action = 2;
} } else {
else {
this->action = 1; this->action = 1;
} }
@ -36,8 +32,7 @@ void sub_0805C874(Entity *this)
this->field_0xf = 0; this->field_0xf = 0;
} }
void sub_0805C894(Entity *this) void sub_0805C894(Entity* this) {
{
if (sub_0805C920(this)) { if (sub_0805C920(this)) {
this->action = 2; this->action = 2;
@ -46,12 +41,10 @@ void sub_0805C894(Entity *this)
} }
} }
void sub_0805C8B4(Entity *this) void sub_0805C8B4(Entity* this) {
{
u8 bVar1; u8 bVar1;
int iVar2; int iVar2;
if (--this->actionDelay == 0) { if (--this->actionDelay == 0) {
this->actionDelay = 0x14; this->actionDelay = 0x14;
@ -68,17 +61,14 @@ void sub_0805C8B4(Entity *this)
} }
} }
void sub_0805C908(Entity *this) void sub_0805C908(Entity* this) {
{
if (this->field_0xf == 0) { if (this->field_0xf == 0) {
this->action = 1; this->action = 1;
} } else {
else {
sub_0805C8B4(this); sub_0805C8B4(this);
} }
} }
u32 sub_0805C920(Entity *this) u32 sub_0805C920(Entity* this) {
{
return CheckLocalFlagByOffset(0x300, (this->entityType).form + 0x67); return CheckLocalFlagByOffset(0x300, (this->entityType).form + 0x67);
} }

View File

@ -4,12 +4,10 @@
extern void (*const gUnk_08108D3C[])(Entity*); extern void (*const gUnk_08108D3C[])(Entity*);
extern void (*const gUnk_08108D44[])(Entity*); extern void (*const gUnk_08108D44[])(Entity*);
void sub_0805D250(Entity *this) void sub_0805D250(Entity* this) {
{
gUnk_08108D3C[this->entityType.form](this); gUnk_08108D3C[this->entityType.form](this);
} }
void sub_0805D268(Entity *this) void sub_0805D268(Entity* this) {
{
gUnk_08108D44[this->action](this); gUnk_08108D44[this->action](this);
} }

View File

@ -51,7 +51,8 @@ void sub_080576C0(Manager3* this) {
} }
} }
if (sub_080002C0(this->unk_38, this->unk_3a, this->manager.unk_0e) == 0x3d) { if (sub_080002C0(this->unk_38, this->unk_3a, this->manager.unk_0e) == 0x3d) {
sub_080577AC(this->unk_38 + gRoomControls.roomOriginX, this->unk_3a + gRoomControls.roomOriginY, this->manager.unk_0e); sub_080577AC(this->unk_38 + gRoomControls.roomOriginX, this->unk_3a + gRoomControls.roomOriginY,
this->manager.unk_0e);
if (!this->manager.unk_0f) { if (!this->manager.unk_0f) {
this->manager.unk_0f = 1; this->manager.unk_0f = 1;
PlaySFX(0x152); PlaySFX(0x152);
@ -62,7 +63,6 @@ void sub_080576C0(Manager3* this) {
} else { } else {
this->manager.unk_0f = 0; this->manager.unk_0f = 0;
} }
} }
void sub_080577AC(u32 baseX, u32 baseY, u32 layer) { void sub_080577AC(u32 baseX, u32 baseY, u32 layer) {
@ -70,9 +70,11 @@ void sub_080577AC(u32 baseX, u32 baseY, u32 layer) {
int offsetX, offsetY; int offsetX, offsetY;
Entity* spark; Entity* spark;
r = Random(); r = Random();
if ((r & 0x7) != 0) return; if ((r & 0x7) != 0)
return;
spark = CreateObject(0xF, 0x26, 0); spark = CreateObject(0xF, 0x26, 0);
if (!spark) return; if (!spark)
return;
offsetX = (r >> 0x8) & 0xF; offsetX = (r >> 0x8) & 0xF;
offsetY = ((r >> 0x10) & 0xF); offsetY = ((r >> 0x10) & 0xF);
if (offsetY > 0x4) { if (offsetY > 0x4) {
@ -88,10 +90,8 @@ void sub_080577AC(u32 baseX, u32 baseY, u32 layer) {
} }
u32 sub_08057810(void) { u32 sub_08057810(void) {
if ((gPlayerState.flags.all & 0x80) if ((gPlayerState.flags.all & 0x80) && !gPlayerState.field_0xaa && (gArea.field_0x17 != 0x6) &&
&& !gPlayerState.field_0xaa (gPlayerState.heldObject == 0)) {
&& (gArea.field_0x17 != 0x6)
&& (gPlayerState.heldObject == 0)) {
switch (gPlayerState.field_0xa8) { switch (gPlayerState.field_0xa8) {
case 0: case 0:
case 1: case 1:

View File

@ -21,12 +21,7 @@ typedef struct Manager30 {
extern void sub_0807B7D8(u32, u32, u32); extern void sub_0807B7D8(u32, u32, u32);
enum { enum { INIT, IN_PROGRESS, FAILED, SUCCEEDED };
INIT,
IN_PROGRESS,
FAILED,
SUCCEEDED
};
/* /*
* Tile puzzles (step on all blue tiles exactly once). * Tile puzzles (step on all blue tiles exactly once).
@ -42,8 +37,7 @@ void Manager30_Main(Manager30* this) {
case INIT: case INIT:
this->manager.action = IN_PROGRESS; this->manager.action = IN_PROGRESS;
this->manager.unk_0f = this->manager.unk_0e; this->manager.unk_0f = this->manager.unk_0e;
this->own_tile = (((this->x >> 4) & 0x3fU) | this->own_tile = (((this->x >> 4) & 0x3fU) | ((this->y >> 4) & 0x3fU) << 6);
((this->y >> 4) & 0x3fU) << 6);
this->player_previous_tile = this->player_current_tile = COORD_TO_TILE((&gPlayerEntity)); this->player_previous_tile = this->player_current_tile = COORD_TO_TILE((&gPlayerEntity));
break; break;
case 1: case 1:
@ -72,8 +66,10 @@ void Manager30_Main(Manager30* this) {
} }
// fall through, can be reset in-progress // fall through, can be reset in-progress
case FAILED: case FAILED:
if (!this->flag_reset) return;//can't be reset if (!this->flag_reset)
if (!CheckFlags(this->flag_reset)) return;//wait for the flag telling it to reset return; // can't be reset
if (!CheckFlags(this->flag_reset))
return; // wait for the flag telling it to reset
ClearFlag(this->flag_reset); // make sure the puzzle can be reset again later ClearFlag(this->flag_reset); // make sure the puzzle can be reset again later
this->manager.action = IN_PROGRESS; this->manager.action = IN_PROGRESS;
this->manager.unk_0e = this->manager.unk_0f; this->manager.unk_0e = this->manager.unk_0f;
@ -85,7 +81,8 @@ void Manager30_Main(Manager30* this) {
} }
break; break;
case SUCCEEDED: case SUCCEEDED:
if (this->manager.unk_0e == 0) return; if (this->manager.unk_0e == 0)
return;
tmp2 = --this->manager.unk_0e; tmp2 = --this->manager.unk_0e;
if (tmp2) { if (tmp2) {
if (tmp2 == 0x20) { if (tmp2 == 0x20) {

View File

@ -56,7 +56,9 @@ void sub_08057920(Manager* this) {
DiggingCaveEntrance* tmp; DiggingCaveEntrance* tmp;
u8 roomID; u8 roomID;
roomID = gRoomControls.roomID; roomID = gRoomControls.roomID;
for (tmp = gUnk_08107DC0[gRoomControls.areaID];(tmp = sub_08057AA8(tmp, roomID)) != 0 && !sub_0805795C(this, tmp);tmp++); for (tmp = gUnk_08107DC0[gRoomControls.areaID]; (tmp = sub_08057AA8(tmp, roomID)) != 0 && !sub_0805795C(this, tmp);
tmp++)
;
} }
void sub_08057A18(Manager*, DiggingCaveEntrance*); void sub_08057A18(Manager*, DiggingCaveEntrance*);
@ -70,22 +72,24 @@ u32 sub_0805795C(Manager* this, DiggingCaveEntrance* entr) {
offsetY = gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY; offsetY = gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY;
offsetX2 = (entr->unk_00 & 0x3F) * 16 + 8; offsetX2 = (entr->unk_00 & 0x3F) * 16 + 8;
offsetY2 = ((entr->unk_00 & 0xFC0) >> 6) * 16 + 0x18; offsetY2 = ((entr->unk_00 & 0xFC0) >> 6) * 16 + 0x18;
if ((u32)(offsetX - offsetX2) + 0x18 > 0x30) return 0; if ((u32)(offsetX - offsetX2) + 0x18 > 0x30)
if ( return 0;
(u32)(offsetY - offsetY2) + 8 > 0x10) return 0; if ((u32)(offsetY - offsetY2) + 8 > 0x10)
if ( return 0;
((offsetY < offsetY2))) if (((offsetY < offsetY2)))
if ( if ((u32)(offsetX - offsetX2) + 0xC <= 0x18)
(u32)(offsetX - offsetX2) + 0xC <= 0x18) return 0; return 0;
} else { } else {
// offsetX = ((gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F; // offsetX = ((gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F;
// offsetY = ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F; // offsetY = ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F;
// tmp = offsetX | (offsetY << 6); // tmp = offsetX | (offsetY << 6);
tmp = COORD_TO_TILE((&gPlayerEntity)); tmp = COORD_TO_TILE((&gPlayerEntity));
if (tmp != entr->unk_00) return 0; if (tmp != entr->unk_00)
return 0;
offsetY = gRoomControls.roomOriginY + ((tmp >> 6) * 16) + 6; offsetY = gRoomControls.roomOriginY + ((tmp >> 6) * 16) + 6;
if (gPlayerEntity.y.HALF.HI >= offsetY) return 0; if (gPlayerEntity.y.HALF.HI >= offsetY)
return 0;
} }
sub_08057A18(this, entr); sub_08057A18(this, entr);
return 1; return 1;
@ -126,7 +130,8 @@ void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) {
DiggingCaveEntrance* sub_08057AA8(DiggingCaveEntrance* entr, int roomID) { DiggingCaveEntrance* sub_08057AA8(DiggingCaveEntrance* entr, int roomID) {
for (; entr->unk_00 != 0xFFFF; entr++) { for (; entr->unk_00 != 0xFFFF; entr++) {
if (entr->source_roomID == roomID) return entr; if (entr->source_roomID == roomID)
return entr;
} }
return 0; return 0;
} }

View File

@ -3,7 +3,6 @@
#include "flags.h" #include "flags.h"
#include "functions.h" #include "functions.h"
typedef struct { typedef struct {
Manager manager; Manager manager;
u8 unk_20[0x08]; u8 unk_20[0x08];
@ -24,32 +23,10 @@ void sub_08057AE8(Manager5*);
void sub_08057BA4(Manager5*); void sub_08057BA4(Manager5*);
void sub_08057C28(Manager5*); void sub_08057C28(Manager5*);
const u16 gUnk_08108024[] = { const u16 gUnk_08108024[] = { 0, -1, 1, 0, 0, 1, -1, 0 };
0, const u16 gUnk_08108034[] = { 0, 1, -1, 0, 0, -1, 1, 0 };
-1,
1,
0,
0,
1,
-1,
0
};
const u16 gUnk_08108034[] = {
0,
1,
-1,
0,
0,
-1,
1,
0
};
void (*const gUnk_08108044[])(Manager5*) = { void (*const gUnk_08108044[])(Manager5*) = { sub_08057AE8, sub_08057BA4, sub_08057C28 };
sub_08057AE8,
sub_08057BA4,
sub_08057C28
};
void sub_08057AD0(Manager5* this) { void sub_08057AD0(Manager5* this) {
gUnk_08108044[this->manager.action](this); gUnk_08108044[this->manager.action](this);
@ -75,8 +52,8 @@ void sub_08057AE8(Manager5* this) {
this->manager.unk_0e = 0x1C; this->manager.unk_0e = 0x1C;
this->manager.unk_0f = 0; this->manager.unk_0f = 0;
this->manager.action = (this->manager.unk_0b & 0x80) ? 2 : 1; this->manager.action = (this->manager.unk_0b & 0x80) ? 2 : 1;
if (this->manager.action != 2 if (this->manager.action != 2 || !CheckFlags(this->unk_3e))
|| !CheckFlags(this->unk_3e)) return; return;
for (; this->unk_32; this->unk_32--) { for (; this->unk_32; this->unk_32--) {
sub_08057CA4(this, this->unk_28, this->unk_2a); sub_08057CA4(this, this->unk_28, this->unk_2a);
sub_0807B7D8(this->unk_30, this->unk_38 | (this->unk_3a << 6), this->unk_3c); sub_0807B7D8(this->unk_30, this->unk_38 | (this->unk_3a << 6), this->unk_3c);
@ -85,16 +62,19 @@ void sub_08057AE8(Manager5* this) {
} }
void sub_08057BA4(Manager5* this) { void sub_08057BA4(Manager5* this) {
if (--this->manager.unk_0e) return; if (--this->manager.unk_0e)
return;
this->manager.unk_0e = 8; this->manager.unk_0e = 8;
if (CheckFlags(this->unk_3e)) { if (CheckFlags(this->unk_3e)) {
if (this->unk_32 == this->manager.unk_0f) return; if (this->unk_32 == this->manager.unk_0f)
return;
sub_08057CA4(this, this->unk_28, this->unk_2a); sub_08057CA4(this, this->unk_28, this->unk_2a);
sub_0807B7D8(this->unk_30, this->unk_38 | (this->unk_3a << 6), this->unk_3c); sub_0807B7D8(this->unk_30, this->unk_38 | (this->unk_3a << 6), this->unk_3c);
this->manager.unk_0f++; this->manager.unk_0f++;
PlaySFX(0x71); PlaySFX(0x71);
} else { } else {
if (!this->manager.unk_0f) return; if (!this->manager.unk_0f)
return;
sub_0807BA8C(this->unk_38 | (this->unk_3a << 6), this->unk_3c); sub_0807BA8C(this->unk_38 | (this->unk_3a << 6), this->unk_3c);
sub_08057CA4(this, this->unk_2c, this->unk_2e); sub_08057CA4(this, this->unk_2c, this->unk_2e);
this->manager.unk_0f--; this->manager.unk_0f--;
@ -104,10 +84,12 @@ void sub_08057BA4(Manager5* this) {
void sub_08057C28(Manager5* this) { void sub_08057C28(Manager5* this) {
if (!this->manager.unk_0d) { if (!this->manager.unk_0d) {
if (!CheckFlags(this->unk_3e)) return; if (!CheckFlags(this->unk_3e))
return;
this->manager.unk_0d++; this->manager.unk_0d++;
} else { } else {
if (--this->manager.unk_0e) return; if (--this->manager.unk_0e)
return;
this->manager.unk_0e = 8; this->manager.unk_0e = 8;
if (this->unk_32 != this->manager.unk_0f) { if (this->unk_32 != this->manager.unk_0f) {
sub_08057CA4(this, this->unk_28, this->unk_2a); sub_08057CA4(this, this->unk_28, this->unk_2a);

View File

@ -3,7 +3,6 @@
#include "functions.h" #include "functions.h"
#include "gba/gba.h" #include "gba/gba.h"
typedef struct { typedef struct {
Manager manager; Manager manager;
u8 unk_20; u8 unk_20;
@ -22,70 +21,24 @@ extern void sub_0805E3A0();
extern u8 gUnk_02034490; extern u8 gUnk_02034490;
extern const u8 gGlobalGfxAndPalettes[]; extern const u8 gGlobalGfxAndPalettes[];
const u16 gUnk_08108050[0x2A] = { const u16 gUnk_08108050[0x2A] = { 0, 0, 0x20, 0xE0, 0xE0, 1, 0, 0x1D0, 0x80, 0x60, 2,
0, 0, 0x20, 0xE0, 0x170, 0x278, 0xF8, 0xA0, 3, 0x310, 0x178, 0xC0, 0x150, 3, 0x340,
0xE0, 1, 0, 0x1D0, 0x2C8, 0x60, 0x90, 4, 0x1D0, 0, 0x200, 0xE0, 1, 0x108, 0x188,
0x80, 0x60, 2, 0x170, 0xD0, 0x80, 2, 0x1E8, 0x338, 0x50, 0xC0, 0xFF, 0 };
0x278, 0xF8, 0xA0, 3,
0x310, 0x178, 0xC0, 0x150,
3, 0x340, 0x2C8, 0x60,
0x90, 4, 0x1D0, 0,
0x200, 0xE0, 1, 0x108,
0x188, 0xD0, 0x80, 2,
0x1E8, 0x338, 0x50, 0xC0,
0xFF, 0
};
const u32 gUnk_081080A4[0x50] = { const u32 gUnk_081080A4[0x50] = {
0x001095E0, 0x06000000, 0x001095E0, 0x06000000, 0x0010A5E0, 0x06001000, 0x0010B5E0, 0x06002000, 0x0010C5E0, 0x06003000, 0x0010D5E0,
0x0010A5E0, 0x06001000, 0x06008000, 0x0010E5E0, 0x06009000, 0x0010F5E0, 0x0600A000, 0x001105E0, 0x0600B000, 0x001115E0, 0x06000000,
0x0010B5E0, 0x06002000, 0x001125E0, 0x06001000, 0x001135E0, 0x06002000, 0x001145E0, 0x06003000, 0x001155E0, 0x06008000, 0x001165E0,
0x0010C5E0, 0x06003000, 0x06009000, 0x001175E0, 0x0600A000, 0x001185E0, 0x0600B000, 0x001195E0, 0x06000000, 0x0011A5E0, 0x06001000,
0x0010D5E0, 0x06008000, 0x0011B5E0, 0x06002000, 0x0011C5E0, 0x06003000, 0x0011D5E0, 0x06008000, 0x0011E5E0, 0x06009000, 0x0011F5E0,
0x0010E5E0, 0x06009000, 0x0600A000, 0x001205E0, 0x0600B000, 0x001215E0, 0x06000000, 0x001225E0, 0x06001000, 0x001235E0, 0x06002000,
0x0010F5E0, 0x0600A000, 0x001245E0, 0x06003000, 0x001255E0, 0x06008000, 0x001265E0, 0x06009000, 0x001275E0, 0x0600A000, 0x001285E0,
0x001105E0, 0x0600B000, 0x0600B000, 0x001295E0, 0x06000000, 0x0012A5E0, 0x06001000, 0x0012B5E0, 0x06002000, 0x0012C5E0, 0x06003000,
0x001115E0, 0x06000000, 0x0012D5E0, 0x06008000, 0x0012E5E0, 0x06009000, 0x0012F5E0, 0x0600A000, 0x001305E0, 0x0600B000
0x001125E0, 0x06001000,
0x001135E0, 0x06002000,
0x001145E0, 0x06003000,
0x001155E0, 0x06008000,
0x001165E0, 0x06009000,
0x001175E0, 0x0600A000,
0x001185E0, 0x0600B000,
0x001195E0, 0x06000000,
0x0011A5E0, 0x06001000,
0x0011B5E0, 0x06002000,
0x0011C5E0, 0x06003000,
0x0011D5E0, 0x06008000,
0x0011E5E0, 0x06009000,
0x0011F5E0, 0x0600A000,
0x001205E0, 0x0600B000,
0x001215E0, 0x06000000,
0x001225E0, 0x06001000,
0x001235E0, 0x06002000,
0x001245E0, 0x06003000,
0x001255E0, 0x06008000,
0x001265E0, 0x06009000,
0x001275E0, 0x0600A000,
0x001285E0, 0x0600B000,
0x001295E0, 0x06000000,
0x0012A5E0, 0x06001000,
0x0012B5E0, 0x06002000,
0x0012C5E0, 0x06003000,
0x0012D5E0, 0x06008000,
0x0012E5E0, 0x06009000,
0x0012F5E0, 0x0600A000,
0x001305E0, 0x0600B000
}; };
const u8 gUnk_081081E4[] = { const u8 gUnk_081081E4[] = { 0x16, 0x17, 0x17, 0x18, 0x18 };
0x16,
0x17,
0x17,
0x18,
0x18
};
void Manager7_Main(Manager7* this) { void Manager7_Main(Manager7* this) {
u32 tmp; u32 tmp;
@ -104,7 +57,8 @@ void Manager7_Main(Manager7* this) {
this->manager.unk_0e = 0; this->manager.unk_0e = 0;
} }
} }
if (gRoomControls.unk2) return; if (gRoomControls.unk2)
return;
tmp = this->unk_20; tmp = this->unk_20;
tmp2 = &gUnk_081080A4[tmp << 4]; tmp2 = &gUnk_081080A4[tmp << 4];
switch (this->manager.unk_0e) { switch (this->manager.unk_0e) {
@ -121,7 +75,8 @@ void Manager7_Main(Manager7* this) {
case 5: case 5:
case 6: case 6:
case 7: case 7:
LoadAssetAsync(&gGlobalGfxAndPalettes[tmp2[(this->manager.unk_0e << 1)]], tmp2[(this->manager.unk_0e << 1)+1], 0x1000); LoadAssetAsync(&gGlobalGfxAndPalettes[tmp2[(this->manager.unk_0e << 1)]],
tmp2[(this->manager.unk_0e << 1) + 1], 0x1000);
this->manager.unk_0e++; this->manager.unk_0e++;
break; break;
case 8: case 8:
@ -156,7 +111,8 @@ void sub_08057E64() {
void sub_08057E7C(u32 unk1) { void sub_08057E7C(u32 unk1) {
u32 tmp; u32 tmp;
const u32* tmp2; const u32* tmp2;
if (unk1 > 4) return; if (unk1 > 4)
return;
LoadPaletteGroup(gUnk_081081E4[unk1]); LoadPaletteGroup(gUnk_081081E4[unk1]);
tmp2 = &gUnk_081080A4[unk1 << 4]; tmp2 = &gUnk_081080A4[unk1 << 4];
for (tmp = 0; tmp < 8; tmp++, tmp2 += 2) { for (tmp = 0; tmp < 8; tmp++, tmp2 += 2) {

View File

@ -4,7 +4,6 @@
#include "screen.h" #include "screen.h"
#include "functions.h" #include "functions.h"
typedef struct { typedef struct {
Manager manager; Manager manager;
u8 unk_00[0x1C]; u8 unk_00[0x1C];
@ -21,13 +20,7 @@ void sub_08058324();
extern u32 gUnk_02006F00[]; extern u32 gUnk_02006F00[];
extern u8 gUnk_02001A40[]; extern u8 gUnk_02001A40[];
const u16 gUnk_081081EC[] = { 0x30, 0x30, 0x30, 0x38 };
const u16 gUnk_081081EC[] = {
0x30,
0x30,
0x30,
0x38
};
void sub_080581D8(Manager9* this) { void sub_080581D8(Manager9* this) {
sub_08058210(this); sub_08058210(this);
@ -44,7 +37,8 @@ void sub_08058204(Manager9* this) {
void sub_08058210(Manager9* this) { void sub_08058210(Manager9* this) {
u32 tmp = sub_08058244(this->manager.unk_0a); u32 tmp = sub_08058244(this->manager.unk_0a);
if (this->unk_3c == tmp) return; if (this->unk_3c == tmp)
return;
this->unk_3c = tmp; this->unk_3c = tmp;
sub_080582A0(tmp, gUnk_02006F00, gUnk_02001A40); sub_080582A0(tmp, gUnk_02006F00, gUnk_02001A40);
gScreen.bg.bg2yOffset = 1; gScreen.bg.bg2yOffset = 1;

View File

@ -5,27 +5,18 @@
#include "flags.h" #include "flags.h"
#include "area.h" #include "area.h"
void sub_08058398(ManagerA*); void sub_08058398(ManagerA*);
void sub_080583EC(ManagerA*); void sub_080583EC(ManagerA*);
void sub_08058408(ManagerA*); void sub_08058408(ManagerA*);
void sub_08058514(ManagerA*); void sub_08058514(ManagerA*);
void sub_080585B0(ManagerA*); void sub_080585B0(ManagerA*);
void (* const gUnk_081081F4[])(ManagerA*) = { void (*const gUnk_081081F4[])(ManagerA*) = { sub_08058398, sub_080583EC, sub_08058408, sub_08058514, sub_080585B0 };
sub_08058398,
sub_080583EC,
sub_08058408,
sub_08058514,
sub_080585B0
};
void sub_08058380(ManagerA* this) { void sub_08058380(ManagerA* this) {
gUnk_081081F4[this->manager.action](this); gUnk_081081F4[this->manager.action](this);
} }
extern void sub_0805E3A0(Manager*, u32); extern void sub_0805E3A0(Manager*, u32);
void sub_08058398(ManagerA* this) { void sub_08058398(ManagerA* this) {
@ -45,7 +36,6 @@ void sub_08058398(ManagerA* this) {
} }
} }
void sub_08058408(ManagerA*); void sub_08058408(ManagerA*);
void sub_080583EC(ManagerA* this) { void sub_080583EC(ManagerA* this) {
@ -68,18 +58,22 @@ void sub_080585DC(ManagerA*);
void sub_08058408(ManagerA* this) { void sub_08058408(ManagerA* this) {
u32 tmp2; u32 tmp2;
tmp2 = (gPlayerState.flags.all & 0x08); tmp2 = (gPlayerState.flags.all & 0x08);
if (tmp2 != 0) return; if (tmp2 != 0)
if (!CheckPlayerInRegion(this->unk_20, this->unk_22, this->unk_24, this->unk_26)) return; return;
if (!CheckPlayerInRegion(this->unk_20, this->unk_22, this->unk_24, this->unk_26))
return;
switch (this->manager.unk_0a) { switch (this->manager.unk_0a) {
case 1: case 1:
return; return;
case 2: case 2:
sub_080585DC(this); sub_080585DC(this);
if ((gPlayerState.flags.all & 0x80) == 0) return; if ((gPlayerState.flags.all & 0x80) == 0)
return;
case 0: case 0:
default: default:
sub_080585DC(this); sub_080585DC(this);
if (sub_0805848C(this) == 0) return; if (sub_0805848C(this) == 0)
return;
sub_08078A90(3); sub_08078A90(3);
sub_08078B48(); sub_08078B48();
sub_0805E544(); sub_0805E544();
@ -95,7 +89,6 @@ void sub_08058408(ManagerA* this){
} }
} }
u32 sub_0805848C(ManagerA* this) { u32 sub_0805848C(ManagerA* this) {
switch (gPlayerState.field_0xa8 - 5) { switch (gPlayerState.field_0xa8 - 5) {
case 0: case 0:
@ -128,7 +121,6 @@ u32 sub_0805848C(ManagerA* this) {
} }
} }
extern void UnfreezeTime(void); extern void UnfreezeTime(void);
void sub_08058514(ManagerA* this) { void sub_08058514(ManagerA* this) {
@ -150,7 +142,8 @@ void sub_08058514(ManagerA* this) {
} }
return; return;
case 3: case 3:
if (gPlayerEntity.action != 1 && gPlayerEntity.action != 9) return; if (gPlayerEntity.action != 1 && gPlayerEntity.action != 9)
return;
gPlayerState.field_0x8b = 1; gPlayerState.field_0x8b = 1;
UnfreezeTime(); UnfreezeTime();
SetFlag(this->unk_3c); SetFlag(this->unk_3c);
@ -161,7 +154,6 @@ void sub_08058514(ManagerA* this) {
} }
} }
extern void sub_0801855C(void); extern void sub_0801855C(void);
void sub_080585B0(ManagerA* this) { void sub_080585B0(ManagerA* this) {

View File

@ -10,7 +10,8 @@
* Manager B is used to create fights: * Manager B is used to create fights:
* It possibly waits for an inhibitor flag to be set, then spawns a bunch of entities (based on room data). * It possibly waits for an inhibitor flag to be set, then spawns a bunch of entities (based on room data).
* Once all enemies created this way are dead, it sets a flag. * Once all enemies created this way are dead, it sets a flag.
* (There is also a part about changing the music and setting it back when the fight is done, which is song 0x33 (a fight theme) by default but can be overridden through room data) * (There is also a part about changing the music and setting it back when the fight is done, which is song 0x33 (a
* fight theme) by default but can be overridden through room data)
*/ */
void (*const ManagerB_ActionFuncs[])(Manager*); void (*const ManagerB_ActionFuncs[])(Manager*);
@ -20,11 +21,7 @@ void sub_080585F0(Manager* this) {
ManagerB_ActionFuncs[this->unk_0a](this); ManagerB_ActionFuncs[this->unk_0a](this);
} }
enum ManagerB_State { enum ManagerB_State { Init, WaitForFlag, WaitForDone };
Init,
WaitForFlag,
WaitForDone
};
void (*const ManagerB_StateFuncs[])(ManagerB*); void (*const ManagerB_StateFuncs[])(ManagerB*);
@ -68,7 +65,8 @@ extern void sub_0801855C(void);
void ManagerB_WaitForDone(ManagerB* this) { void ManagerB_WaitForDone(ManagerB* this) {
// check if all helpers are done // check if all helpers are done
if (this->manager.unk_0e) return; if (this->manager.unk_0e)
return;
// set the completion flag for the fight // set the completion flag for the fight
SetFlag(this->unk_3e); SetFlag(this->unk_3e);
// restore music (if it was set, which apparently is only possible if there's a flag the fight waited for) // restore music (if it was set, which apparently is only possible if there's a flag the fight waited for)
@ -98,7 +96,8 @@ void ManagerB_LoadFight(Manager* this) {
counter = 0; counter = 0;
// Create a helper to keep track of the created entities. // Create a helper to keep track of the created entities.
monitor = CreateHelper(this); monitor = CreateHelper(this);
if (!monitor) DeleteThisEntity(); if (!monitor)
DeleteThisEntity();
prop = (EntityData*)GetCurrentRoomProperty(this->unk_0b); prop = (EntityData*)GetCurrentRoomProperty(this->unk_0b);
if (prop) { if (prop) {
while (*((u8*)prop) != 0xFF) { while (*((u8*)prop) != 0xFF) {
@ -110,7 +109,8 @@ void ManagerB_LoadFight(Manager* this) {
if (counter >= 7) { if (counter >= 7) {
counter = 0; counter = 0;
monitor = CreateHelper(this); monitor = CreateHelper(this);
if (!monitor) return; if (!monitor)
return;
} }
} }
} }
@ -169,7 +169,6 @@ void ManagerBHelper_Main(Manager* this) {
} }
} }
extern Manager gUnk_03003DB0; extern Manager gUnk_03003DB0;
/* /*
@ -179,8 +178,10 @@ void ReplaceMonitoredEntity(Entity* old, Entity* new) {
ManagerBHelper* current; ManagerBHelper* current;
Manager* end = &gUnk_03003DB0; Manager* end = &gUnk_03003DB0;
u32 i; u32 i;
for (current = (ManagerBHelper*) end->next; (Manager*)current != end; current=(ManagerBHelper*)current->manager.next) { for (current = (ManagerBHelper*)end->next; (Manager*)current != end;
if (current->manager.type != 0x9 || current->manager.subtype != 0xB) continue; current = (ManagerBHelper*)current->manager.next) {
if (current->manager.type != 0x9 || current->manager.subtype != 0xB)
continue;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
if (old == current->enemies[i]) { if (old == current->enemies[i]) {
current->enemies[i] = new; current->enemies[i] = new;
@ -190,12 +191,6 @@ void ReplaceMonitoredEntity(Entity* old, Entity* new) {
} }
} }
void (*const ManagerB_ActionFuncs[])(Manager*) = { void (*const ManagerB_ActionFuncs[])(Manager*) = { (void (*)(Manager*))ManagerB_Main,
(void (*)(Manager*)) ManagerB_Main, (void (*)(Manager*))ManagerBHelper_Main };
(void (*)(Manager*)) ManagerBHelper_Main void (*const ManagerB_StateFuncs[])(ManagerB*) = { ManagerB_Init, ManagerB_WaitForFlag, ManagerB_WaitForDone };
};
void (*const ManagerB_StateFuncs[])(ManagerB*) = {
ManagerB_Init,
ManagerB_WaitForFlag,
ManagerB_WaitForDone
};

View File

@ -15,8 +15,7 @@ extern void sub_0807DD94(Entity*, u32);
extern u32 sub_0801E99C(void); extern u32 sub_0801E99C(void);
extern void sub_08078784(Entity*, u32); extern void sub_08078784(Entity*, u32);
void Anju(Entity *this) void Anju(Entity* this) {
{
switch (this->action) { switch (this->action) {
case 0: case 0:
this->action = 1; this->action = 1;
@ -28,7 +27,8 @@ void Anju(Entity *this)
if (this->interactType == 2) { if (this->interactType == 2) {
this->action = 2; this->action = 2;
this->interactType = 0; this->interactType = 0;
InitializeAnimation(this,(this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); InitializeAnimation(this,
(this->animIndex & -4) + sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
sub_0806F118(this); sub_0806F118(this);
} else { } else {
sub_0807DD94(this, 0); sub_0807DD94(this, 0);
@ -42,20 +42,17 @@ void Anju(Entity *this)
} }
} }
void sub_0806C354(Entity *this) void sub_0806C354(Entity* this) {
{
this->field_0x68.HALF.LO = sub_0801E99C(); this->field_0x68.HALF.LO = sub_0801E99C();
sub_08078784(this, this->field_0x68.HALF.LO); sub_08078784(this, this->field_0x68.HALF.LO);
} }
void Anju_Fusion(Entity *this) void Anju_Fusion(Entity* this) {
{
if (this->action == 0) { if (this->action == 0) {
this->action++; this->action++;
this->spriteSettings.b.draw = 1; this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 6); InitAnimationForceUpdate(this, 6);
} } else {
else {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
} }
} }

View File

@ -6,7 +6,6 @@
#include "room.h" #include "room.h"
#include "textbox.h" #include "textbox.h"
extern void (*gUnk_081115C0[])(Entity*); extern void (*gUnk_081115C0[])(Entity*);
extern void (*gUnk_081115D0[])(Entity*); extern void (*gUnk_081115D0[])(Entity*);

View File

@ -13,14 +13,11 @@ extern void sub_0807DD94(Entity *,u32);
extern void EnqueueSFX(u32); extern void EnqueueSFX(u32);
extern void sub_08080964(u32, u32); extern void sub_08080964(u32, u32);
void Carlov(Entity* this) {
void Carlov(Entity *this)
{
if (this->action == 0) { if (this->action == 0) {
this->action++; this->action++;
sub_0807DD50(this); sub_0807DD50(this);
} } else {
else {
sub_0807DD94(this, 0); sub_0807DD94(this, 0);
} }
if ((this->frames.all & 0x10) != 0) { if ((this->frames.all & 0x10) != 0) {

View File

@ -35,7 +35,8 @@ void Carpenter(Entity* this) {
this->action = 2; this->action = 2;
this->interactType = 0; this->interactType = 0;
this->field_0x68.HALF.HI = this->animIndex; this->field_0x68.HALF.HI = this->animIndex;
InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4 + (this->entityType.form * 8)); InitializeAnimation(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)) + 4 +
(this->entityType.form * 8));
sub_0806F118(this); sub_0806F118(this);
} else { } else {
sub_0807DDAC(this, 0); sub_0807DDAC(this, 0);
@ -68,7 +69,6 @@ void Carpenter_Head(Entity* this) {
} }
} }
void sub_080672b0(Entity *this, u32 param_2) void sub_080672b0(Entity* this, u32 param_2) {
{
InitializeAnimation(this, *(u32*)(param_2 + 4) + (this->animationState >> 1) + this->entityType.form * 8); InitializeAnimation(this, *(u32*)(param_2 + 4) + (this->animationState >> 1) + this->entityType.form * 8);
} }

View File

@ -13,14 +13,11 @@ extern void sub_0805FF2C(Entity*, void*);
extern void (*const gUnk_08109BBC[])(Entity*); extern void (*const gUnk_08109BBC[])(Entity*);
void Festari(Entity* this) {
void Festari(Entity *this)
{
gUnk_08109BBC[this->action](this); gUnk_08109BBC[this->action](this);
} }
void sub_0805FE10(Entity *this) void sub_0805FE10(Entity* this) {
{
this->action = 1; this->action = 1;
this->spriteSettings.b.draw = TRUE; this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2); sub_0805E3A0(this, 2);
@ -29,8 +26,7 @@ void sub_0805FE10(Entity *this)
sub_0807DD50(this); sub_0807DD50(this);
} }
void sub_0805FE48(Entity *this) void sub_0805FE48(Entity* this) {
{
u8 bVar1; u8 bVar1;
u16 uVar2; u16 uVar2;
u32 uVar3; u32 uVar3;
@ -41,16 +37,14 @@ void sub_0805FE48(Entity *this)
this->interactType = 0; this->interactType = 0;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
sub_0806F118(this); sub_0806F118(this);
} } else {
else {
ExecuteScriptCommandSet(this, *(void**)&this->cutsceneBeh); ExecuteScriptCommandSet(this, *(void**)&this->cutsceneBeh);
sub_0805FF2C(this, *(void**)&this->cutsceneBeh); sub_0805FF2C(this, *(void**)&this->cutsceneBeh);
uVar4 = this->field_0x80.HWORD; uVar4 = this->field_0x80.HWORD;
if (uVar4 < 8) { if (uVar4 < 8) {
if ((this->field_0x82.HWORD & 1) != 0) { if ((this->field_0x82.HWORD & 1) != 0) {
uVar4 = (uVar4 & 0xfc) + (this->field_0xf >> 1); uVar4 = (uVar4 & 0xfc) + (this->field_0xf >> 1);
} } else {
else {
uVar4 = (uVar4 & 0xfc) + (this->animationState >> 1); uVar4 = (uVar4 & 0xfc) + (this->animationState >> 1);
this->field_0xf = this->animationState; this->field_0xf = this->animationState;
} }
@ -60,8 +54,7 @@ void sub_0805FE48(Entity *this)
} }
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if (this->frames.b.f3) if (this->frames.b.f3) {
{
switch (this->animIndex) { switch (this->animIndex) {
case 8: case 8:
case 10: case 10:
@ -77,8 +70,7 @@ void sub_0805FE48(Entity *this)
} }
} }
void sub_0805FF18(Entity *this) void sub_0805FF18(Entity* this) {
{
if (UpdateFuseInteraction(this)) { if (UpdateFuseInteraction(this)) {
this->action = 1; this->action = 1;
} }

View File

@ -11,8 +11,7 @@ extern u32 sub_0806F5A4(u32);
extern void sub_0806F118(Entity*); extern void sub_0806F118(Entity*);
extern void sub_0807DD94(Entity*, u32); extern void sub_0807DD94(Entity*, u32);
void Gentari(Entity *this) void Gentari(Entity* this) {
{
switch (this->action) { switch (this->action) {
case 0: case 0:
this->action = 1; this->action = 1;
@ -39,15 +38,13 @@ void Gentari(Entity *this)
} }
} }
void Gentari_Fusion(Entity *this) void Gentari_Fusion(Entity* this) {
{
if (this->action == 0) { if (this->action == 0) {
this->action++; this->action++;
this->spriteSettings.b.draw = TRUE; this->spriteSettings.b.draw = TRUE;
sub_0805E3A0(this, 2); sub_0805E3A0(this, 2);
InitAnimationForceUpdate(this, 10); InitAnimationForceUpdate(this, 10);
} } else {
else {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
} }
} }

View File

@ -13,31 +13,25 @@ extern void (*const gUnk_08111B98[])(Entity*);
extern u16 gUnk_08111BA0[]; extern u16 gUnk_08111BA0[];
void GoronMerchant(Entity* this) {
void GoronMerchant(Entity *this)
{
if ((this->flags & 2) != 0) { if ((this->flags & 2) != 0) {
gUnk_08111B98[this->action](this); gUnk_08111B98[this->action](this);
} } else {
else {
gUnk_08111B88[this->action](this); gUnk_08111B88[this->action](this);
sub_0806ED78(this); sub_0806ED78(this);
} }
} }
void sub_08069584(Entity *this) void sub_08069584(Entity* this) {
{
if (gScreenTransition.field_0x24[8] != 0) { if (gScreenTransition.field_0x24[8] != 0) {
this->action = 3; this->action = 3;
} } else {
else {
this->action = 1; this->action = 1;
} }
InitAnimationForceUpdate(this, 2); InitAnimationForceUpdate(this, 2);
} }
void sub_080695AC(Entity *this) void sub_080695AC(Entity* this) {
{
s32 iVar2; s32 iVar2;
if (++this->field_0xf > 0x10) { if (++this->field_0xf > 0x10) {
@ -52,8 +46,7 @@ void sub_080695AC(Entity *this)
} }
} }
void sub_080695E8(Entity *this) void sub_080695E8(Entity* this) {
{
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if ((gTextBox.doTextBox & 0x7f) == 0) { if ((gTextBox.doTextBox & 0x7f) == 0) {
this->action = 1; this->action = 1;
@ -63,16 +56,14 @@ void sub_080695E8(Entity *this)
} }
} }
void sub_0806961C(Entity *this) void sub_0806961C(Entity* this) {
{
if (gScreenTransition.field_0x24[8] == 2) { if (gScreenTransition.field_0x24[8] == 2) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
} }
sub_0806FD3C(this); sub_0806FD3C(this);
} }
void sub_0806963C(Entity *this) void sub_0806963C(Entity* this) {
{
this->action = 1; this->action = 1;
this->spriteSettings.b.draw = TRUE; this->spriteSettings.b.draw = TRUE;
sub_0807DD50(this); sub_0807DD50(this);
@ -82,16 +73,14 @@ void sub_08069654(Entity* this) {
sub_0807DD94(this, 0); sub_0807DD94(this, 0);
} }
void sub_08069660(Entity *this) void sub_08069660(Entity* this) {
{
u32 uVar1; u32 uVar1;
TextboxNoOverlap(0x2c1c, this); TextboxNoOverlap(0x2c1c, this);
gTextBox.field_0x10 = (u16)sub_080696BC(this); gTextBox.field_0x10 = (u16)sub_080696BC(this);
} }
void sub_08069684(void) void sub_08069684(void) {
{
Manager* mgr; Manager* mgr;
if (FindEntityInListBySubtype(9, 0x31, 8) == NULL) { if (FindEntityInListBySubtype(9, 0x31, 8) == NULL) {
@ -104,13 +93,11 @@ void sub_08069684(void)
} }
} }
void sub_080696B0(void) void sub_080696B0(void) {
{
gRoomVars.itemForSaleIndex = 0; gRoomVars.itemForSaleIndex = 0;
} }
u32 sub_080696BC(Entity* this) u32 sub_080696BC(Entity* this) {
{
u32 uVar1; u32 uVar1;
u32 temp; u32 temp;
u32 iVar3; u32 iVar3;
@ -119,8 +106,7 @@ u32 sub_080696BC(Entity* this)
temp2 = gRoomVars.field_0x7; temp2 = gRoomVars.field_0x7;
if (temp2 > 0x70) { if (temp2 > 0x70) {
iVar3 = 1; iVar3 = 1;
} } else {
else {
iVar3 = 0; iVar3 = 0;
} }
if (temp2 > 0x72) { if (temp2 > 0x72) {

View File

@ -57,5 +57,6 @@ void sub_08063280(Entity* this, u32 unused) {
UpdateAnimationSingleFrame(e); UpdateAnimationSingleFrame(e);
var = e->frames.all & 0x7F; var = e->frames.all & 0x7F;
e->frames.all ^= var; e->frames.all ^= var;
if (var == 2) CreateFx(e, 49, 0); if (var == 2)
CreateFx(e, 49, 0);
} }

View File

@ -9,13 +9,11 @@
extern void sub_0807DD50(); extern void sub_0807DD50();
extern void sub_0807DD94(); extern void sub_0807DD94();
void MoblinLady(Entity* this) { void MoblinLady(Entity* this) {
if (this->action == 0) { if (this->action == 0) {
this->action++; this->action++;
sub_0807DD50(this); sub_0807DD50(this);
} } else {
else {
sub_0807DD94(this, 0); sub_0807DD94(this, 0);
} }
} }

View File

@ -9,21 +9,18 @@ extern void sub_0805E584(Entity*);
extern void (*const gUnk_0810C290[])(Entity*); extern void (*const gUnk_0810C290[])(Entity*);
void NPC9(Entity *this) void NPC9(Entity* this) {
{
gUnk_0810C290[this->action](this); gUnk_0810C290[this->action](this);
} }
void sub_08062AF0(Entity *this) void sub_08062AF0(Entity* this) {
{
this->action = 1; this->action = 1;
this->spriteSettings.b.draw = TRUE; this->spriteSettings.b.draw = TRUE;
InitializeAnimation(this, 0); InitializeAnimation(this, 0);
sub_08078778(this); sub_08078778(this);
} }
void sub_08062B14(Entity *this) void sub_08062B14(Entity* this) {
{
GetNextFrame(this); GetNextFrame(this);
if (this->interactType != 0) { if (this->interactType != 0) {
this->interactType = 0; this->interactType = 0;
@ -34,8 +31,7 @@ void sub_08062B14(Entity *this)
sub_0806ED78(this); sub_0806ED78(this);
} }
void sub_08062B48(Entity *this) void sub_08062B48(Entity* this) {
{
GetNextFrame(this); GetNextFrame(this);
if ((this->frames.b.f3) != 0) { if ((this->frames.b.f3) != 0) {
TextboxNoOverlapFollow(0xa01); TextboxNoOverlapFollow(0xa01);
@ -43,8 +39,7 @@ void sub_08062B48(Entity *this)
} }
} }
void sub_08062B70(Entity *this) void sub_08062B70(Entity* this) {
{
if ((gTextBox.doTextBox & 0x7f) == 0) { if ((gTextBox.doTextBox & 0x7f) == 0) {
InitializeAnimation(this, 2); InitializeAnimation(this, 2);
this->action = 1; this->action = 1;

View File

@ -125,8 +125,7 @@ void sub_080604DC(Entity* this) {
} }
} }
void sub_08060528(Entity *this) void sub_08060528(Entity* this) {
{
switch (this->action) { switch (this->action) {
case 0: case 0:
this->action = 1; this->action = 1;
@ -144,15 +143,13 @@ void sub_08060528(Entity *this)
this->interactType = 0; this->interactType = 0;
sub_0806F118(this); sub_0806F118(this);
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
} } else {
else {
if (this->interactType != 0) { if (this->interactType != 0) {
this->action = 2; this->action = 2;
this->interactType = 0; this->interactType = 0;
sub_080606D8(this); sub_080606D8(this);
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
} } else {
else {
sub_0807DD94(this, 0); sub_0807DD94(this, 0);
} }
} }
@ -179,8 +176,7 @@ void sub_08060528(Entity *this)
this->field_0x6c.HALF.HI = 1; this->field_0x6c.HALF.HI = 1;
sub_080788E0(this); sub_080788E0(this);
EnqueueSFX(0x7c); EnqueueSFX(0x7c);
} } else {
else {
this->field_0x6a.HWORD -= 1; this->field_0x6a.HWORD -= 1;
} }
} }
@ -196,14 +192,12 @@ void sub_08060528(Entity *this)
sub_0800451C(this); sub_0800451C(this);
} }
void sub_080606C0(Entity *this) void sub_080606C0(Entity* this) {
{
this->field_0x6c.HALF.LO = sub_0801E99C(this); this->field_0x6c.HALF.LO = sub_0801E99C(this);
sub_08078784(this, this->field_0x6c.HALF.LO); sub_08078784(this, this->field_0x6c.HALF.LO);
} }
void sub_080606D8(Entity* this) void sub_080606D8(Entity* this) {
{
s32 index; s32 index;
index = gUnk_02002A40.unk8 - 2; index = gUnk_02002A40.unk8 - 2;
@ -213,8 +207,7 @@ void sub_080606D8(Entity* this)
ShowNPCDialogue(this, &gUnk_0810AA30[index]); ShowNPCDialogue(this, &gUnk_0810AA30[index]);
} }
void sub_08060700(Entity *entity, u32 arg1) void sub_08060700(Entity* entity, u32 arg1) {
{
s8* var0 = gUnk_0810A918[(s8)entity->field_0x68.HALF.LO]; s8* var0 = gUnk_0810A918[(s8)entity->field_0x68.HALF.LO];
Coords16* coords = &gUnk_0810A66C[var0[(s8)entity->field_0x68.HALF.HI]]; Coords16* coords = &gUnk_0810A66C[var0[(s8)entity->field_0x68.HALF.HI]];
u32 x = coords->x + gRoomControls.roomOriginX; u32 x = coords->x + gRoomControls.roomOriginX;
@ -223,8 +216,7 @@ void sub_08060700(Entity *entity, u32 arg1)
gUnk_02033280.unk |= 1; gUnk_02033280.unk |= 1;
} }
void sub_0806075C(Entity *this) void sub_0806075C(Entity* this) {
{
this->field_0x68.HALF.LO = 0xb; this->field_0x68.HALF.LO = 0xb;
this->field_0x68.HALF.HI = 0xff; this->field_0x68.HALF.HI = 0xff;
} }

View File

@ -38,8 +38,7 @@ void sub_0806a370(Entity* this) {
} }
} }
void sub_0806A3D8(Entity *this) void sub_0806A3D8(Entity* this) {
{
u32* uVar1; u32* uVar1;
this->action = 1; this->action = 1;

View File

@ -17,39 +17,33 @@ extern void DoFade(u32, u32);
extern void gUnk_0813AD60; extern void gUnk_0813AD60;
extern void gUnk_0813AD74; extern void gUnk_0813AD74;
void Simon(Entity *this) void Simon(Entity* this) {
{
if (this->action == 0) { if (this->action == 0) {
this->action++; this->action++;
sub_0807DD50(this); sub_0807DD50(this);
} } else {
else {
sub_0807DD94(this, 0); sub_0807DD94(this, 0);
} }
} }
void sub_0806C224(void) void sub_0806C224(void) {
{
DoExitTransition(&gUnk_0813AD60); DoExitTransition(&gUnk_0813AD60);
gScreenTransition.transitionType = 6; gScreenTransition.transitionType = 6;
} }
void Simon_CreateChest(Entity *this) void Simon_CreateChest(Entity* this) {
{
CreateObjectWithParent(this, 0xf, 0x43, 0); CreateObjectWithParent(this, 0xf, 0x43, 0);
SetTileType(0x73, COORD_TO_TILE(this), this->collisionLayer); SetTileType(0x73, COORD_TO_TILE(this), this->collisionLayer);
PlaySFX(0x73); PlaySFX(0x73);
} }
void sub_0806C280(void) void sub_0806C280(void) {
{
SetGlobalFlag(MAROYA_WAKEUP); SetGlobalFlag(MAROYA_WAKEUP);
DoExitTransition(&gUnk_0813AD74); DoExitTransition(&gUnk_0813AD74);
gScreenTransition.transitionType = 6; gScreenTransition.transitionType = 6;
} }
void sub_0806C2A0(u32 *param_1,struct_0806C2A0 *param_2) void sub_0806C2A0(u32* param_1, struct_0806C2A0* param_2) {
{
switch (param_2->unk) { switch (param_2->unk) {
case 0: case 0:
DoFade(0xd, 4); DoFade(0xd, 4);

View File

@ -2,7 +2,6 @@
#include "entity.h" #include "entity.h"
#include "npc.h" #include "npc.h"
extern void sub_0807DD50(Entity*); extern void sub_0807DD50(Entity*);
extern void sub_0806ED78(Entity*); extern void sub_0806ED78(Entity*);
extern void sub_0805E3A0(Entity*, u32); extern void sub_0805E3A0(Entity*, u32);
@ -16,14 +15,12 @@ extern void sub_0807DD94(Entity*, u32);
extern void sub_0806A26C(Entity*); extern void sub_0806A26C(Entity*);
extern void sub_080042BA(Entity*, u32); extern void sub_080042BA(Entity*, u32);
void Syrup(Entity *this) void Syrup(Entity* this) {
{
gUnk_081121D4[this->action](this); gUnk_081121D4[this->action](this);
sub_0806ED78(this); sub_0806ED78(this);
} }
void sub_0806A1F8(Entity *this) void sub_0806A1F8(Entity* this) {
{
u32 iVar1; u32 iVar1;
SpriteLoadData* paVar2; SpriteLoadData* paVar2;
@ -38,8 +35,7 @@ void sub_0806A1F8(Entity *this)
} }
} }
void sub_0806A234(Entity *this) void sub_0806A234(Entity* this) {
{
sub_0807DD94(this, 0); sub_0807DD94(this, 0);
if ((this->field_0x82.HWORD & 4) != 0) { if ((this->field_0x82.HWORD & 4) != 0) {
if ((gScreenTransition & 7) == 0) { if ((gScreenTransition & 7) == 0) {
@ -50,16 +46,14 @@ void sub_0806A234(Entity *this)
} }
#ifdef NON_MATCHING #ifdef NON_MATCHING
void sub_0806A26C(Entity *this) void sub_0806A26C(Entity* this) {
{
u8 unk; u8 unk;
u32 uVar2; u32 uVar2;
Entity* pEVar1; Entity* pEVar1;
pEVar1 = CreateObject(0xf, 0x2f, 0); pEVar1 = CreateObject(0xf, 0x2f, 0);
if (pEVar1 != NULL) { if (pEVar1 != NULL) {
PositionEntityOnTop(this, pEVar1); PositionEntityOnTop(this, pEVar1);
if (uVar2 = Random(), uVar2) if (uVar2 = Random(), uVar2) {
{
unk = -unk; // wtf?! unk = -unk; // wtf?!
} }
pEVar1->spriteOffsetX = gUnk_081121DC[uVar2 & 7]; pEVar1->spriteOffsetX = gUnk_081121DC[uVar2 & 7];
@ -68,8 +62,7 @@ void sub_0806A26C(Entity *this)
} }
#else #else
NAKED NAKED
void sub_0806A26C(Entity *this) void sub_0806A26C(Entity* this) {
{
asm(".include \"asm/non_matching/syrup/sub_0806A26C.inc\""); asm(".include \"asm/non_matching/syrup/sub_0806A26C.inc\"");
} }
#endif #endif

View File

@ -5,8 +5,7 @@
extern void sub_08068318(Entity*); extern void sub_08068318(Entity*);
extern void sub_0806854C(Entity*, u32); extern void sub_0806854C(Entity*, u32);
void ZeldaFollower(Entity *this) void ZeldaFollower(Entity* this) {
{
if (this->action == 0) { if (this->action == 0) {
this->action++; this->action++;
this->spriteSettings.b.draw = TRUE; this->spriteSettings.b.draw = TRUE;

View File

@ -4,8 +4,7 @@
extern u32 CheckIsDungeon(); extern u32 CheckIsDungeon();
void Archway(Entity *this) void Archway(Entity* this) {
{
u32 v1; u32 v1;
u32 v2; u32 v2;
u32 v3; u32 v3;

View File

@ -30,8 +30,7 @@ void sub_0808F658(Entity* this) {
void sub_0808F6E0(Entity* this) { void sub_0808F6E0(Entity* this) {
sub_0806F69C(this); sub_0806F69C(this);
if ((s16)this->x.HALF.HI < (s16)this->field_0x78.HWORD || if ((s16)this->x.HALF.HI < (s16)this->field_0x78.HWORD || (s16)this->x.HALF.HI > (s16)this->field_0x7a.HWORD)
(s16)this->x.HALF.HI > (s16)this->field_0x7a.HWORD)
this->action = 2; this->action = 2;
} }

View File

@ -190,7 +190,8 @@ u32 sub_08081E3C(Entity* this) {
tmp2 = GetTileType(this->field_0x74.HWORD, this->collisionLayer); tmp2 = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
tmp1 = gUnk_0811EE50; tmp1 = gUnk_0811EE50;
do { do {
if (*tmp1 == tmp2) return 1; if (*tmp1 == tmp2)
return 1;
} while (*++tmp1); } while (*++tmp1);
return 0; return 0;
} }
@ -229,8 +230,10 @@ void sub_08081E6C(Entity* this) {
#endif #endif
u32 sub_08081F00(u32* unk1, u32* unk2) { u32 sub_08081F00(u32* unk1, u32* unk2) {
if (*unk1 != *unk2) return 0; if (*unk1 != *unk2)
if (unk1[0x40] != unk2[1]) return 0; return 0;
if (unk1[0x40] != unk2[1])
return 0;
return 1; return 1;
} }
@ -251,7 +254,8 @@ void sub_08081F24(Entity* this) {
u32 sub_08081F7C(Entity* this, u32 r7) { u32 sub_08081F7C(Entity* this, u32 r7) {
u16 tmp; u16 tmp;
if (this->actionDelay == 0) return 1; if (this->actionDelay == 0)
return 1;
if (--this->actionDelay > 6) { if (--this->actionDelay > 6) {
if (this->attachedEntity) if (this->attachedEntity)
this->attachedEntity->spriteOffsetY = 0xfc; this->attachedEntity->spriteOffsetY = 0xfc;
@ -275,7 +279,8 @@ extern void sub_080044AE(Entity*, u32, u32);
void sub_08081FF8(Entity* this) { void sub_08081FF8(Entity* this) {
u32 direction; u32 direction;
u32 i; u32 i;
if (this->attachedEntity != &gPlayerEntity) return; if (this->attachedEntity != &gPlayerEntity)
return;
direction = GetFacingDirection(this->attachedEntity, this); direction = GetFacingDirection(this->attachedEntity, this);
sub_080044AE(this->attachedEntity, 0x200, direction); sub_080044AE(this->attachedEntity, 0x200, direction);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {

View File

@ -11,8 +11,7 @@ extern void (*const gUnk_0811F808[])(Entity*);
extern void (*const gUnk_0811F818[])(Entity*); extern void (*const gUnk_0811F818[])(Entity*);
extern u32 gUnk_0811F8B0; extern u32 gUnk_0811F8B0;
void ChestSpawner(Entity* this) void ChestSpawner(Entity* this) {
{
gUnk_0811F7E8[this->entityType.form](this); gUnk_0811F7E8[this->entityType.form](this);
} }
@ -20,13 +19,11 @@ void sub_08083DF0(Entity* this) {
gUnk_0811F808[this->action](this); gUnk_0811F808[this->action](this);
} }
void sub_08083E08(Entity *this) void sub_08083E08(Entity* this) {
{
gUnk_0811F818[this->action](this); gUnk_0811F818[this->action](this);
} }
void sub_08083E20(Entity *this) void sub_08083E20(Entity* this) {
{
this->action = 3; this->action = 3;
this->spriteSettings.b.draw = 1; this->spriteSettings.b.draw = 1;
this->spriteRendering.alphaBlend = 0; this->spriteRendering.alphaBlend = 0;

View File

@ -11,33 +11,28 @@ extern void sub_0809EE24(Entity*);
extern void (*const gUnk_081243D4[])(Entity*); extern void (*const gUnk_081243D4[])(Entity*);
void Fan(Entity *this) void Fan(Entity* this) {
{
gUnk_081243D4[this->action](this); gUnk_081243D4[this->action](this);
} }
void sub_0809ED30(Entity *this) void sub_0809ED30(Entity* this) {
{
this->direction = (this->entityType.form ^ 2) << 3; this->direction = (this->entityType.form ^ 2) << 3;
sub_0809EE34(this); sub_0809EE34(this);
sub_0809EFB0(this); sub_0809EFB0(this);
InitializeAnimation(this, this->entityType.form); InitializeAnimation(this, this->entityType.form);
} }
void sub_0809ED54(Entity *this) void sub_0809ED54(Entity* this) {
{
u16 uVar1; u16 uVar1;
u32 iVar2; u32 iVar2;
if (((this->cutsceneBeh.HWORD == 0) || CheckFlags(this->cutsceneBeh.HWORD)) && if (((this->cutsceneBeh.HWORD == 0) || CheckFlags(this->cutsceneBeh.HWORD)) &&
((this->entityType.parameter != 1 || ((this->entityType.parameter != 1 || (--this->field_0x74.HWORD == 0)))) {
(--this->field_0x74.HWORD == 0)))) {
sub_0809EE08(this); sub_0809EE08(this);
} }
} }
void sub_0809ED88(Entity *this) void sub_0809ED88(Entity* this) {
{
sub_0809F08C(); sub_0809F08C();
sub_0809EE44(this); sub_0809EE44(this);
if (this->field_0x86.HWORD != 0) { if (this->field_0x86.HWORD != 0) {
@ -45,20 +40,16 @@ void sub_0809ED88(Entity *this)
if (CheckFlags(this->cutsceneBeh.HWORD)) { if (CheckFlags(this->cutsceneBeh.HWORD)) {
return; return;
} }
} } else if (!CheckFlags(this->cutsceneBeh.HWORD)) {
else if (!CheckFlags(this->cutsceneBeh.HWORD)) {
return; return;
} }
sub_0809EE24(this); sub_0809EE24(this);
} } else if (((this->entityType).parameter == 1) && (--this->field_0x74.HWORD == 0)) {
else if (((this->entityType).parameter == 1) &&
(--this->field_0x74.HWORD == 0)) {
sub_0809EE24(this); sub_0809EE24(this);
} }
} }
void sub_0809EDE4(Entity *this) void sub_0809EDE4(Entity* this) {
{
sub_0809F08C(); sub_0809F08C();
sub_0809EE44(this); sub_0809EE44(this);
if (this->frames.b.f3) { if (this->frames.b.f3) {
@ -66,21 +57,18 @@ void sub_0809EDE4(Entity *this)
} }
} }
void sub_0809EE08(Entity *this) void sub_0809EE08(Entity* this) {
{
this->action = 2; this->action = 2;
this->field_0x74.HWORD = *((u8*)&this->field_0x7c + 3) << 2; this->field_0x74.HWORD = *((u8*)&this->field_0x7c + 3) << 2;
InitializeAnimation(this, this->entityType.form); InitializeAnimation(this, this->entityType.form);
} }
void sub_0809EE24(Entity *this) void sub_0809EE24(Entity* this) {
{
this->action = 3; this->action = 3;
InitializeAnimation(this, this->entityType.form + 4); InitializeAnimation(this, this->entityType.form + 4);
} }
void sub_0809EE34(Entity *this) void sub_0809EE34(Entity* this) {
{
this->action = 1; this->action = 1;
this->field_0x74.HWORD = this->actionDelay << 2; this->field_0x74.HWORD = this->actionDelay << 2;
} }

9
src/object/houseDoorExterior.c Executable file → Normal file
View File

@ -50,8 +50,7 @@ void sub_080866D8(Entity* this) {
prop = GetCurrentRoomProperty(this->field_0x6c.HALF.LO); prop = GetCurrentRoomProperty(this->field_0x6c.HALF.LO);
for (i = 0; prop->unk0 != 0xFFFF && i < 32; prop++, i++) { for (i = 0; prop->unk0 != 0xFFFF && i < 32; prop++, i++) {
int mask = 1 << i; int mask = 1 << i;
if ((*((u32 *)(&this->field_0x68)) & mask) == 0 && if ((*((u32*)(&this->field_0x68)) & mask) == 0 && sub_080867CC(prop->unk5) &&
sub_080867CC(prop->unk5) &&
sub_080562CC(prop->unk0, prop->unk2, 32, 32)) { sub_080562CC(prop->unk0, prop->unk2, 32, 32)) {
entity = CreateObject(0x19, prop->unk7, prop->unk6); entity = CreateObject(0x19, prop->unk7, prop->unk6);
if (entity) { if (entity) {
@ -165,10 +164,8 @@ void sub_0808692C(Entity* this) {
static u8 sub_08086954(Entity* this) { static u8 sub_08086954(Entity* this) {
if (sub_0800445C(this)) { if (sub_0800445C(this)) {
if (sub_0806ED9C(this, 6, 20) >= 0 && if (sub_0806ED9C(this, 6, 20) >= 0 && gPlayerEntity.animationState == 0 &&
gPlayerEntity.animationState == 0 && (u16)gPlayerState.field_0x90.HALF.LO == 0x400 && gPlayerState.jumpStatus == 0) {
(u16)gPlayerState.field_0x90.HALF.LO == 0x400 &&
gPlayerState.jumpStatus == 0) {
this->actionDelay--; this->actionDelay--;
} }
} else { } else {

4
src/object/itemOnGround.c Executable file → Normal file
View File

@ -268,9 +268,7 @@ void sub_080812A8(Entity* this) {
void sub_080812E8(Entity* this) { void sub_080812E8(Entity* this) {
PlayerState* playerState = &gPlayerState; PlayerState* playerState = &gPlayerState;
if ((playerState->swimState & 0x80) && if ((playerState->swimState & 0x80) && !(playerState->flags.all & 0x80) && sub_080177A0(this, &gPlayerEntity)) {
!(playerState->flags.all & 0x80) &&
sub_080177A0(this, &gPlayerEntity)) {
sub_080810FC(this); sub_080810FC(this);
} }
} }

View File

@ -11,18 +11,15 @@ extern void (*const gUnk_08124950[])(Entity*);
extern u8 gUnk_08124960; extern u8 gUnk_08124960;
extern u8 gUnk_0812497A; extern u8 gUnk_0812497A;
void JailBars(Entity *this) void JailBars(Entity* this) {
{
gUnk_08124950[this->action](this); gUnk_08124950[this->action](this);
} }
void sub_080A08C4(Entity *this) void sub_080A08C4(Entity* this) {
{
if (CheckFlags(this->field_0x86.HWORD) == 0) { if (CheckFlags(this->field_0x86.HWORD) == 0) {
this->action = 1; this->action = 1;
sub_080A0960(this, 0); sub_080A0960(this, 0);
} } else {
else {
this->action = 3; this->action = 3;
InitializeAnimation(this, 1); InitializeAnimation(this, 1);
sub_080A0960(this, 1); sub_080A0960(this, 1);
@ -32,8 +29,7 @@ void sub_080A08C4(Entity *this)
UpdateSpriteForCollisionLayer(this); UpdateSpriteForCollisionLayer(this);
} }
void sub_080A0910(Entity *this) void sub_080A0910(Entity* this) {
{
if (CheckFlags(this->field_0x86.HWORD) != 0) { if (CheckFlags(this->field_0x86.HWORD) != 0) {
this->action = 2; this->action = 2;
sub_080A0960(this, 1); sub_080A0960(this, 1);
@ -41,8 +37,7 @@ void sub_080A0910(Entity *this)
} }
} }
void sub_080A0938(Entity *this) void sub_080A0938(Entity* this) {
{
GetNextFrame(this); GetNextFrame(this);
if ((this->frames.b.f3) != 0) { if ((this->frames.b.f3) != 0) {
this->action = 3; this->action = 3;
@ -50,10 +45,10 @@ void sub_080A0938(Entity *this)
} }
} }
void nullsub_127(Entity* this) {} void nullsub_127(Entity* this) {
}
void sub_080A0960(Entity *this, u32 arg1) void sub_080A0960(Entity* this, u32 arg1) {
{
u8* puVar1; u8* puVar1;
puVar1 = &gUnk_08124960; puVar1 = &gUnk_08124960;

View File

@ -142,4 +142,5 @@ void sub_0809EC08(Entity* this) {
} }
} }
void nullsub_126(Entity* this) { } void nullsub_126(Entity* this) {
}

View File

@ -8,8 +8,7 @@ extern void sub_080A2CC0(Entity*, Entity**, u16*);
extern u16 gUnk_08123318[]; extern u16 gUnk_08123318[];
void LilypadSmall(Entity *this) void LilypadSmall(Entity* this) {
{
u32 rand; u32 rand;
u16* psVar4; u16* psVar4;
@ -32,8 +31,7 @@ void LilypadSmall(Entity *this)
} }
} }
u32 sub_08097ADC(Entity *this) u32 sub_08097ADC(Entity* this) {
{
if ((gPlayerState.flags.all & 0x80) == 0) { if ((gPlayerState.flags.all & 0x80) == 0) {
return 0; return 0;
} else if (sub_080041A0(this, &gPlayerEntity, 8, 8) == 0) { } else if (sub_080041A0(this, &gPlayerEntity, 8, 8) == 0) {
@ -50,8 +48,7 @@ u32 sub_08097ADC(Entity *this)
} }
} }
void sub_08097B24(Entity *this) void sub_08097B24(Entity* this) {
{
u32 temp; u32 temp;
u32 temp2; u32 temp2;
u16* temp3; u16* temp3;

View File

@ -24,7 +24,6 @@ extern void EnqueueSFX(u32);
extern void sub_080044EC(Entity*, u16); extern void sub_080044EC(Entity*, u16);
extern void sub_0805457C(Entity*, s32); extern void sub_0805457C(Entity*, s32);
void Mask(Entity* this) { void Mask(Entity* this) {
MaskActionFuncs[this->action](this); MaskActionFuncs[this->action](this);
} }
@ -89,7 +88,8 @@ void sub_08092A94(Entity *this) {
return; return;
} }
if (this->x.HALF.HI - gPlayerEntity.x.HALF.HI >= this->field_0xf || this->x.HALF.HI - gPlayerEntity.x.HALF.HI <= -this->field_0xf) { if (this->x.HALF.HI - gPlayerEntity.x.HALF.HI >= this->field_0xf ||
this->x.HALF.HI - gPlayerEntity.x.HALF.HI <= -this->field_0xf) {
return; return;
} }
@ -112,21 +112,18 @@ void sub_08092B0C(Entity *this) {
this->action = 3; this->action = 3;
this->actionDelay = 0; this->actionDelay = 0;
switch (this->entityType.parameter & 0xC0) switch (this->entityType.parameter & 0xC0) {
{
case 0x80: case 0x80:
EnqueueSFX(0x72); EnqueueSFX(0x72);
case 0x40: case 0x40:
SetFlag(this->field_0x86.HWORD); SetFlag(this->field_0x86.HWORD);
break; break;
} }
CreateFx(this, 5, 0); CreateFx(this, 5, 0);
sub_0805457C(this, 3); sub_0805457C(this, 3);
} } else {
else {
sub_080044EC(this, this->field_0x78.HWORD); sub_080044EC(this, this->field_0x78.HWORD);
if (this->height.HALF.HI == 0) { if (this->height.HALF.HI == 0) {

View File

@ -20,8 +20,7 @@ void MetalDoor(Entity* this) {
gUnk_0812493C[this->action](this); gUnk_0812493C[this->action](this);
} }
void sub_080A0684(Entity *this) void sub_080A0684(Entity* this) {
{
if ((this->cutsceneBeh.HWORD != 0xffff) && CheckFlags(this->cutsceneBeh.HWORD)) { if ((this->cutsceneBeh.HWORD != 0xffff) && CheckFlags(this->cutsceneBeh.HWORD)) {
DeleteThisEntity(); DeleteThisEntity();
} }
@ -37,8 +36,7 @@ void sub_080A0684(Entity *this)
this->field_0x74.HWORD = COORD_TO_TILE(this); this->field_0x74.HWORD = COORD_TO_TILE(this);
} }
void sub_080A0718(Entity *this) void sub_080A0718(Entity* this) {
{
if (sub_08083734(this, 2) != 0) { if (sub_08083734(this, 2) != 0) {
this->action = 2; this->action = 2;
this->actionDelay = 0xc; this->actionDelay = 0xc;
@ -49,8 +47,7 @@ void sub_080A0718(Entity *this)
} }
} }
void sub_080A074C(Entity *this) void sub_080A074C(Entity* this) {
{
u8 bVar1; u8 bVar1;
Entity* ent; Entity* ent;
@ -75,8 +72,7 @@ void sub_080A074C(Entity *this)
} }
} }
void sub_080A07BC(Entity *this) void sub_080A07BC(Entity* this) {
{
if (CheckFlags(this->field_0x86.HWORD)) { if (CheckFlags(this->field_0x86.HWORD)) {
this->action = 4; this->action = 4;
this->actionDelay = 0xc; this->actionDelay = 0xc;
@ -87,8 +83,7 @@ void sub_080A07BC(Entity *this)
} }
} }
void sub_080A07F0(Entity *this) void sub_080A07F0(Entity* this) {
{
sub_0806F69C(this); sub_0806F69C(this);
@ -97,8 +92,7 @@ void sub_080A07F0(Entity *this)
} }
} }
void sub_080A080C(Entity *this) void sub_080A080C(Entity* this) {
{
this->field_0x76.HWORD = sub_080001DA(this->field_0x74.HWORD - 1, this->collisionLayer); this->field_0x76.HWORD = sub_080001DA(this->field_0x74.HWORD - 1, this->collisionLayer);
this->field_0x78.HWORD = sub_080001DA(this->field_0x74.HWORD, this->collisionLayer); this->field_0x78.HWORD = sub_080001DA(this->field_0x74.HWORD, this->collisionLayer);
this->field_0x7a.HWORD = sub_080001DA(this->field_0x74.HWORD + 1, this->collisionLayer); this->field_0x7a.HWORD = sub_080001DA(this->field_0x74.HWORD + 1, this->collisionLayer);
@ -107,8 +101,7 @@ void sub_080A080C(Entity *this)
SetTile(0x4022, this->field_0x74.HWORD + 1, this->collisionLayer); SetTile(0x4022, this->field_0x74.HWORD + 1, this->collisionLayer);
} }
void sub_080A0870(Entity *this) void sub_080A0870(Entity* this) {
{
SetTile(this->field_0x76.HWORD, this->field_0x74.HWORD - 1, this->collisionLayer); SetTile(this->field_0x76.HWORD, this->field_0x74.HWORD - 1, this->collisionLayer);
SetTile(this->field_0x78.HWORD, this->field_0x74.HWORD, this->collisionLayer); SetTile(this->field_0x78.HWORD, this->field_0x74.HWORD, this->collisionLayer);
SetTile(this->field_0x7a.HWORD, this->field_0x74.HWORD + 1, this->collisionLayer); SetTile(this->field_0x7a.HWORD, this->field_0x74.HWORD + 1, this->collisionLayer);

View File

@ -93,8 +93,7 @@ void sub_080917DC(Entity* this) {
} }
} }
void sub_080918A4(Entity *this) void sub_080918A4(Entity* this) {
{
if (sub_080041A0(this, &gPlayerEntity, 2, 2) != 0) { if (sub_080041A0(this, &gPlayerEntity, 2, 2) != 0) {
gPlayerEntity.x.HALF.HI = this->x.HALF.HI; gPlayerEntity.x.HALF.HI = this->x.HALF.HI;
gPlayerEntity.y.HALF.HI = this->y.HALF.HI; gPlayerEntity.y.HALF.HI = this->y.HALF.HI;
@ -116,8 +115,7 @@ void sub_080918A4(Entity *this)
sub_0807BA8C(COORD_TO_TILE(this), this->collisionLayer); sub_0807BA8C(COORD_TO_TILE(this), this->collisionLayer);
PlaySFX(0x137); PlaySFX(0x137);
} }
} } else {
else {
gPlayerEntity.direction = GetFacingDirection(&gPlayerEntity, this); gPlayerEntity.direction = GetFacingDirection(&gPlayerEntity, this);
} }
if (gPlayerEntity.field_0x20 < 0) { if (gPlayerEntity.field_0x20 < 0) {
@ -125,8 +123,7 @@ void sub_080918A4(Entity *this)
} }
} }
void sub_080919AC(Entity *this) void sub_080919AC(Entity* this) {
{
u32 iVar2; u32 iVar2;
u32 uVar3; u32 uVar3;
@ -160,7 +157,8 @@ void sub_080919AC(Entity *this)
this->field_0xf = 0x3c; this->field_0xf = 0x3c;
} }
uVar3 = sub_080002B4(this, gUnk_081223C8[this->animationState * 2], gUnk_081223C8[this->animationState * 2 + 1]); uVar3 = sub_080002B4(this, gUnk_081223C8[this->animationState * 2],
gUnk_081223C8[this->animationState * 2 + 1]);
iVar2 = sub_08007DD6(uVar3, gUnk_081223D8[this->animationState]); iVar2 = sub_08007DD6(uVar3, gUnk_081223D8[this->animationState]);
if (iVar2 == 0) { if (iVar2 == 0) {
this->direction = this->direction ^ 0x10; this->direction = this->direction ^ 0x10;
@ -207,8 +205,7 @@ void sub_080919AC(Entity *this)
gPlayerEntity.animationState = this->animationState << 1; gPlayerEntity.animationState = this->animationState << 1;
if (this->animIndex == this->animationState) { if (this->animIndex == this->animationState) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
} } else {
else {
InitAnimationForceUpdate(this, this->animationState); InitAnimationForceUpdate(this, this->animationState);
} }
} }

View File

@ -3,28 +3,24 @@
extern void (*const gUnk_081247F8[])(Entity*); extern void (*const gUnk_081247F8[])(Entity*);
void MinishLight(Entity* this) void MinishLight(Entity* this) {
{
gUnk_081247F8[this->action](this); gUnk_081247F8[this->action](this);
} }
void sub_0809F840(Entity* this) void sub_0809F840(Entity* this) {
{
this->action = 1; this->action = 1;
this->frameIndex = 0; this->frameIndex = 0;
this->actionDelay = 0x20; this->actionDelay = 0x20;
this->field_0xf = 0; this->field_0xf = 0;
if (this->entityType.parameter != 0) if (this->entityType.parameter != 0) {
{
this->spriteSettings.b.flipX = 1; this->spriteSettings.b.flipX = 1;
} }
UpdateSpriteForCollisionLayer(this); UpdateSpriteForCollisionLayer(this);
} }
void sub_0809F868(Entity* this) void sub_0809F868(Entity* this) {
{
if (--this->actionDelay == 0) { if (--this->actionDelay == 0) {
if (this->field_0xf == 0) { if (this->field_0xf == 0) {
if (++this->frameIndex == 3) { if (++this->frameIndex == 3) {

View File

@ -7,13 +7,11 @@ extern void LoadFixedGFX(Entity*, u32);
extern void (*const gUnk_08122254[])(Entity*); extern void (*const gUnk_08122254[])(Entity*);
void MinishSizedEntrance(Entity* this) void MinishSizedEntrance(Entity* this) {
{
gUnk_08122254[this->action](this); gUnk_08122254[this->action](this);
} }
void sub_08090EC0(Entity *this) void sub_08090EC0(Entity* this) {
{
this->action = 1; this->action = 1;
this->spriteRendering.b3 = 3; this->spriteRendering.b3 = 3;
this->spritePriority.b0 = 7; this->spritePriority.b0 = 7;

View File

@ -4,8 +4,7 @@
extern u32 CheckRectOnScreen(s16, s16, u32, u32); extern u32 CheckRectOnScreen(s16, s16, u32, u32);
extern void DeleteThisEntity(); extern void DeleteThisEntity();
void Object1C(Entity *this) void Object1C(Entity* this) {
{
s32 iVar1; s32 iVar1;
if (this->action == 0) { if (this->action == 0) {

View File

@ -5,14 +5,13 @@ void DeleteThisEntity();
extern void (*gUnk_081208A0[])(Entity*); extern void (*gUnk_081208A0[])(Entity*);
void Object1D(Entity *this) void Object1D(Entity* this) {
{
gUnk_081208A0[this->action](this); gUnk_081208A0[this->action](this);
} }
void sub_080874F8(Entity* this) void sub_080874F8(Entity* this) {
{
DeleteThisEntity(); DeleteThisEntity();
} }
void nullsub_117(Entity* this){} void nullsub_117(Entity* this) {
}

View File

@ -9,8 +9,7 @@ void Object2A(Entity* this) {
gUnk_08120DD0[this->action](this); gUnk_08120DD0[this->action](this);
} }
void sub_08089B18(Entity *this) void sub_08089B18(Entity* this) {
{
this->action = 1; this->action = 1;
this->spriteSettings.b.draw = TRUE; this->spriteSettings.b.draw = TRUE;
if (this->entityType.parameter != 0) { if (this->entityType.parameter != 0) {

1
src/object/object48.c Executable file → Normal file
View File

@ -426,7 +426,6 @@ void sub_0808EE00(Entity* this) {
} }
void nullsub_522(Entity* this) { void nullsub_522(Entity* this) {
} }
void sub_0808EE98(Entity* this) { void sub_0808EE98(Entity* this) {

View File

@ -63,8 +63,7 @@ static void sub_0808F14C(Entity* this) {
} }
} }
void sub_0808F170(Entity *this) void sub_0808F170(Entity* this) {
{
*(u32*)&this->field_0x74 -= 0x20; *(u32*)&this->field_0x74 -= 0x20;
*(u32*)&this->field_0x78 += 0x20; *(u32*)&this->field_0x78 += 0x20;
sub_0806FCF4(this, *(u32*)&this->field_0x78, 8, 2); sub_0806FCF4(this, *(u32*)&this->field_0x78, 8, 2);
@ -74,27 +73,23 @@ void sub_0808F170(Entity *this)
sub_0808F2B0(this); sub_0808F2B0(this);
} }
void sub_0808F1A4(Entity *this) void sub_0808F1A4(Entity* this) {
{
*(u32*)&this->field_0x78 += 0x10; *(u32*)&this->field_0x78 += 0x10;
*(u32*)&this->field_0x74 += 0x10; *(u32*)&this->field_0x74 += 0x10;
sub_0806FCF4(this, *(u32*)&this->field_0x78, 8, 2); sub_0806FCF4(this, *(u32*)&this->field_0x78, 8, 2);
if (*(u32*)&this->field_0x78 > 0x3ff) { if (*(u32*)&this->field_0x78 > 0x3ff) {
this->attachedEntity->action = 0xff; this->attachedEntity->action = 0xff;
DeleteThisEntity(); DeleteThisEntity();
} } else {
else {
sub_0808F2B0(this); sub_0808F2B0(this);
} }
} }
void sub_0808F1E0(Entity *this) void sub_0808F1E0(Entity* this) {
{
gUnk_08121E98[this->action](this); gUnk_08121E98[this->action](this);
} }
void sub_0808F1F8(Entity *this) void sub_0808F1F8(Entity* this) {
{
u8 bVar1; u8 bVar1;
this->spriteRendering.b0 = 3; this->spriteRendering.b0 = 3;
@ -106,8 +101,7 @@ void sub_0808F1F8(Entity *this)
sub_0808F244(this); sub_0808F244(this);
} }
static void sub_0808F244(Entity *this) static void sub_0808F244(Entity* this) {
{
this->spriteSettings.b.draw = this->parent->spriteSettings.b.draw; this->spriteSettings.b.draw = this->parent->spriteSettings.b.draw;
this->y.HALF.HI = this->parent->y.HALF.HI + 3; this->y.HALF.HI = this->parent->y.HALF.HI + 3;
@ -122,13 +116,11 @@ static void sub_0808F244(Entity *this)
} }
} }
static void sub_0808F2B0(Entity *this) static void sub_0808F2B0(Entity* this) {
{
sub_0805EC9C(this, *(u32*)&this->field_0x74, *(u32*)&this->field_0x78, this->field_0x70.WORD); sub_0805EC9C(this, *(u32*)&this->field_0x74, *(u32*)&this->field_0x78, this->field_0x70.WORD);
} }
void sub_0808F2C0(Entity *this) void sub_0808F2C0(Entity* this) {
{
if (this->action == 0) { if (this->action == 0) {
this->action++; this->action++;
this->spriteRendering.b3 = this->parent->spriteRendering.b3; this->spriteRendering.b3 = this->parent->spriteRendering.b3;
@ -144,8 +136,7 @@ void sub_0808F2C0(Entity *this)
if (this->parent->height.HALF.HI == 0) { if (this->parent->height.HALF.HI == 0) {
*(u32*)&this->field_0x74 = *(u32*)&this->parent->field_0x74; *(u32*)&this->field_0x74 = *(u32*)&this->parent->field_0x74;
*(u32*)&this->field_0x78 = *(u32*)&this->parent->field_0x78; *(u32*)&this->field_0x78 = *(u32*)&this->parent->field_0x78;
} } else {
else {
*(u32*)&this->field_0x74 = 0x200 - this->parent->height.HALF.HI; *(u32*)&this->field_0x74 = 0x200 - this->parent->height.HALF.HI;
*(u32*)&this->field_0x78 = this->parent->height.HALF.HI * -2 + 0x300; *(u32*)&this->field_0x78 = this->parent->height.HALF.HI * -2 + 0x300;
} }

View File

@ -42,8 +42,7 @@ void sub_08099E10(Entity* this) {
} }
} }
void sub_08099E58(Entity *this) void sub_08099E58(Entity* this) {
{
GetNextFrame(this); GetNextFrame(this);
if (this->frames.b.f3) { if (this->frames.b.f3) {
this->frames.b.f3 = 0; this->frames.b.f3 = 0;
@ -55,8 +54,7 @@ void sub_08099E58(Entity *this)
} }
} }
void sub_08099E8C(Entity *this) void sub_08099E8C(Entity* this) {
{
if (sub_080041A0(this, &gPlayerEntity, 0xc, 0xc)) { if (sub_080041A0(this, &gPlayerEntity, 0xc, 0xc)) {
if (this->previousActionFlag == 0) { if (this->previousActionFlag == 0) {
sub_08099ECC(this); sub_08099ECC(this);
@ -68,10 +66,10 @@ void sub_08099E8C(Entity *this)
} }
} }
void nullsub_534(Entity* this) {} void nullsub_534(Entity* this) {
}
void sub_08099ECC(Entity *this) void sub_08099ECC(Entity* this) {
{
this->previousActionFlag = 1; this->previousActionFlag = 1;
CopyPosition(this, &gPlayerEntity); CopyPosition(this, &gPlayerEntity);
gPlayerState.playerAction = 3; gPlayerState.playerAction = 3;

View File

@ -6,8 +6,7 @@ extern BoundingBox gUnk_080FD168;
extern void SetTile(u32, u32, u32); extern void SetTile(u32, u32, u32);
void Object9E(Entity *this) void Object9E(Entity* this) {
{
Entity* ent; Entity* ent;
u32 tilePos; u32 tilePos;
u8* layer; u8* layer;
@ -34,8 +33,7 @@ void Object9E(Entity *this)
this->attachedEntity = ent; this->attachedEntity = ent;
CopyPosition(this, ent); CopyPosition(this, ent);
} }
} } else {
else {
this->frameIndex = 0; this->frameIndex = 0;
this->collisionLayer = 2; this->collisionLayer = 2;
UpdateSpriteForCollisionLayer(this); UpdateSpriteForCollisionLayer(this);

View File

@ -9,8 +9,7 @@ extern void (*gUnk_08124824[])(Entity*);
extern Entity gPlayerEntity; extern Entity gPlayerEntity;
void ObjectA8(Entity *this) void ObjectA8(Entity* this) {
{
if ((this->bitfield & 0x80) != 0) { if ((this->bitfield & 0x80) != 0) {
switch (this->bitfield & 0x7f) { switch (this->bitfield & 0x7f) {
case 0: case 0:

View File

@ -9,8 +9,7 @@ void PalaceArchway(Entity* this) {
gUnk_081246EC[this->action](this); gUnk_081246EC[this->action](this);
} }
void sub_0809F2A0(Entity *this) void sub_0809F2A0(Entity* this) {
{
this->action = 1; this->action = 1;
this->frameIndex = this->entityType.parameter; this->frameIndex = this->entityType.parameter;
this->spriteRendering.b3 = 3; this->spriteRendering.b3 = 3;
@ -18,4 +17,5 @@ void sub_0809F2A0(Entity *this)
SetTile(0x4069, COORD_TO_TILE(this), this->collisionLayer); SetTile(0x4069, COORD_TO_TILE(this), this->collisionLayer);
} }
void nullsub_537() {} void nullsub_537() {
}

View File

@ -25,8 +25,7 @@ void sub_080A23DC(Entity *this) {
this->spritePriority.b0 = 7; this->spritePriority.b0 = 7;
if (CheckLocalFlag(this->field_0x68.HWORD) != 0) { if (CheckLocalFlag(this->field_0x68.HWORD) != 0) {
this->action = 2; this->action = 2;
} } else {
else {
this->action = 1; this->action = 1;
} }
InitializeAnimation(this, 0); InitializeAnimation(this, 0);

Some files were not shown because too many files have changed in this diff Show More