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;
@ -17,7 +16,7 @@ typedef struct {
u8 field_0x16; u8 field_0x16;
u8 field_0x17; u8 field_0x17;
u8 field_0x18; u8 field_0x18;
//u8 filler3[7]; // u8 filler3[7];
u8 fadeOut; u8 fadeOut;
u8 filler2[14]; u8 filler2[14];
u8 filler4[0x835]; u8 filler4[0x835];

View File

@ -37,13 +37,13 @@ extern void _DmaZero(void* src, u32 count);
extern void EraseAllEntities(void); extern void EraseAllEntities(void);
extern void SetTile(u32, u32, u32); extern void SetTile(u32, u32, u32);
extern void SetDirtTile(u32); extern void SetDirtTile(u32);
extern void LoadRoomTileEntities(); //tba extern void LoadRoomTileEntities(); // tba
extern Entity* CreateDeathFx(Entity*, u32, u32); extern Entity* CreateDeathFx(Entity*, u32, u32);
extern void UpdateAnimationVariableFrames(Entity*, u32); extern void UpdateAnimationVariableFrames(Entity*, u32);
extern void CopyPositionAndSpriteOffset(Entity*, Entity*); extern void CopyPositionAndSpriteOffset(Entity*, Entity*);
extern u8* GetSpriteSubEntryOffsetDataPointer(u32, u32); extern u8* GetSpriteSubEntryOffsetDataPointer(u32, u32);
extern u32 LoadFixedGFX(Entity*, u32); extern u32 LoadFixedGFX(Entity*, u32);
extern void ExecuteScriptCommandSet(Entity*, void *); extern void ExecuteScriptCommandSet(Entity*, void*);
extern void _DmaFill32(u32, void*, u32); extern void _DmaFill32(u32, void*, u32);
extern Entity* CreateItemEntity(u32, u32, u32); extern Entity* CreateItemEntity(u32, u32, u32);
@ -99,16 +99,16 @@ extern void sub_0804A720(Entity*);
extern u32 sub_080AEFE0(Entity*); extern u32 sub_080AEFE0(Entity*);
extern u32 sub_08049FA0(Entity*); extern u32 sub_08049FA0(Entity*);
extern u32 sub_08049FDC(Entity*, u32); extern u32 sub_08049FDC(Entity*, u32);
extern u32 sub_080041A0(Entity *, Entity *, u32, u32); extern u32 sub_080041A0(Entity*, Entity*, u32, u32);
extern u32 sub_08049EE4(Entity*); extern u32 sub_08049EE4(Entity*);
extern Entity *sub_0804A98C(Entity *, u8, u8); extern Entity* sub_0804A98C(Entity*, u8, u8);
extern u32 sub_080544DC(u8); extern u32 sub_080544DC(u8);
extern void sub_08077E54(Entity*); extern void sub_08077E54(Entity*);
extern void sub_080042BA(Entity*, u32); extern void sub_080042BA(Entity*, u32);
extern void _DmaZero(void*, u32); extern void _DmaZero(void*, u32);
extern void sub_08077F24(ItemBehavior*, u32); extern void sub_08077F24(ItemBehavior*, u32);
extern void sub_08079184(); extern void sub_08079184();
extern void sub_08077F50(ItemBehavior *beh, u32 arg1); extern void sub_08077F50(ItemBehavior* beh, u32 arg1);
extern void sub_0807AA80(Entity*); extern void sub_0807AA80(Entity*);
extern s32 sub_0807887C(Entity*, u32, u32); extern s32 sub_0807887C(Entity*, u32, u32);
extern s32 sub_08078904(); extern s32 sub_08078904();
@ -210,7 +210,7 @@ extern u32 sub_08052638(u32);
extern void sub_0805616C(void); extern void sub_0805616C(void);
extern u32 sub_0807CF08(u32, u8*); extern u32 sub_0807CF08(u32, u8*);
extern void sub_0807CF48(u32); extern void sub_0807CF48(u32);
extern u32 sub_0807CF10(u8 *); extern u32 sub_0807CF10(u8*);
extern void sub_08056208(void); extern void sub_08056208(void);
extern void sub_08050384(); extern void sub_08050384();
extern void sub_080B1520(u32); extern void sub_080B1520(u32);

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

@ -24,7 +24,7 @@ typedef struct Manager {
/*0x0f*/ u8 unk_0f; /*0x0f*/ u8 unk_0f;
/*0x10*/ u8 unk_10; /*0x10*/ u8 unk_10;
/*0x11*/ u8 unk_11[3]; /*0x11*/ u8 unk_11[3];
/*0x14*/ struct Manager * parent; /*0x14*/ struct Manager* parent;
/*0x18*/ u8 unk_18[0x8]; /*0x18*/ u8 unk_18[0x8];
// union SplitHWord unk_20; // union SplitHWord unk_20;
// u16 unk_22; // u16 unk_22;

View File

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

View File

@ -61,8 +61,7 @@ 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;
u8 layer : 4; u8 layer : 4;

View File

@ -0,0 +1 @@

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

@ -125,8 +125,8 @@ void sub_080503E4(u32 saveFileId) {
brightnessPref = saveFile->brightnessPref; brightnessPref = saveFile->brightnessPref;
} }
((struct_02000000 *)0x2000000)->messageSpeed = messageSpeed; ((struct_02000000*)0x2000000)->messageSpeed = messageSpeed;
((struct_02000000 *)0x2000000)->brightnessPref = brightnessPref; ((struct_02000000*)0x2000000)->brightnessPref = brightnessPref;
gUsedPalettes = 0xFFFFFFFF; gUsedPalettes = 0xFFFFFFFF;
} }
@ -134,7 +134,7 @@ void sub_0805041C(u32 saveFileId) {
SaveFile* saveFile; SaveFile* saveFile;
if (saveFileId < 3) { if (saveFileId < 3) {
((struct_02000000 *)0x2000000)->saveFileId = saveFileId; ((struct_02000000*)0x2000000)->saveFileId = saveFileId;
saveFile = &gSaveFiles[saveFileId]; saveFile = &gSaveFiles[saveFileId];
_DmaCopy(saveFile, &gUnk_02002A40, sizeof(*saveFile)); _DmaCopy(saveFile, &gUnk_02002A40, sizeof(*saveFile));
} }
@ -164,8 +164,8 @@ void HandleChooseFileScreen(void) {
sub_0801C208(); sub_0801C208();
sub_080AD9B0(); sub_080AD9B0();
sub_080AD918(); sub_080AD918();
if (gUnk_02019EE0.unk3 != ((struct_02000000 *)0x2000000)->gameLanguage) { if (gUnk_02019EE0.unk3 != ((struct_02000000*)0x2000000)->gameLanguage) {
gUnk_02019EE0.unk3 = ((struct_02000000 *)0x2000000)->gameLanguage; gUnk_02019EE0.unk3 = ((struct_02000000*)0x2000000)->gameLanguage;
sub_080503A8(0x6); sub_080503A8(0x6);
sub_080503A8(0xF); sub_080503A8(0xF);
} }
@ -185,7 +185,7 @@ void sub_080504F4(void) {
_DmaZero(&gUnk_0200AF00, sizeof(gUnk_0200AF00)); _DmaZero(&gUnk_0200AF00, sizeof(gUnk_0200AF00));
_DmaZero(&gUnk_02019EE0, sizeof(gUnk_02019EE0)); _DmaZero(&gUnk_02019EE0, sizeof(gUnk_02019EE0));
gUnk_02019EE0.unk3 = 7; gUnk_02019EE0.unk3 = 7;
gUnk_02019EE0.unk6 = ((struct_02000000 *)0x2000000)->gameLanguage > 1 ? 3 : 0; gUnk_02019EE0.unk6 = ((struct_02000000*)0x2000000)->gameLanguage > 1 ? 3 : 0;
_DmaZero(&gUnk_02032EC0, sizeof(gUnk_02032EC0)); _DmaZero(&gUnk_02032EC0, sizeof(gUnk_02032EC0));
gUnk_02032EC0.transitionType = 8; gUnk_02032EC0.transitionType = 8;
sub_080503BC(0); sub_080503BC(0);
@ -285,7 +285,6 @@ void sub_0805070C(void) {
} }
sub_0805F300(var0); sub_0805F300(var0);
} }
} }
void sub_08050790(void) { void sub_08050790(void) {
@ -395,7 +394,7 @@ void sub_08050940(void) {
newKeys &= ~(DPAD_UP | DPAD_DOWN); newKeys &= ~(DPAD_UP | DPAD_DOWN);
} }
var1 = ((struct_02000000 *)0x2000000)->gameLanguage > 1 ? 4 : 3; var1 = ((struct_02000000*)0x2000000)->gameLanguage > 1 ? 4 : 3;
var2 = gUnk_02032EC0.transitionType; var2 = gUnk_02032EC0.transitionType;
switch (newKeys) { switch (newKeys) {
case DPAD_UP: case DPAD_UP:

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,11 +15,10 @@ 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;) {
SetTileType(0x260 + i, tilePos, 1); SetTileType(0x260 + i, tilePos, 1);
SetTileType(0x261 + i, tilePos + 1, 1); SetTileType(0x261 + i, tilePos + 1, 1);
i += 2; i += 2;

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

@ -53,17 +53,17 @@ void LoadGfxGroup(u32 group) {
case 0xD: case 0xD:
return; return;
case 0xE: case 0xE:
if (((struct_02000000 *)0x2000000)->gameLanguage > 1) { if (((struct_02000000*)0x2000000)->gameLanguage > 1) {
loadGfx = TRUE; loadGfx = TRUE;
} }
break; break;
case 0xF: case 0xF:
if (((struct_02000000 *)0x2000000)->gameLanguage != 0) { if (((struct_02000000*)0x2000000)->gameLanguage != 0) {
loadGfx = TRUE; loadGfx = TRUE;
} }
break; break;
default: default:
if (ctrl == ((struct_02000000 *)0x2000000)->gameLanguage) { if (ctrl == ((struct_02000000*)0x2000000)->gameLanguage) {
loadGfx = TRUE; loadGfx = TRUE;
} }
break; break;

View File

@ -2,7 +2,7 @@
#include "entity.h" #include "entity.h"
#include "functions.h" #include "functions.h"
//extern void DmaZero(void*, u32); // extern void DmaZero(void*, u32);
typedef struct { typedef struct {
u16 unk0; u16 unk0;

View File

@ -6,7 +6,7 @@
#include "screen.h" #include "screen.h"
typedef struct { typedef struct {
u8 filler [18]; u8 filler[18];
u32 unk; u32 unk;
} struct_02018EB0; } struct_02018EB0;
@ -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,30 +25,26 @@ 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();
CreateObject(0x3d, gArea.field_0x17, 0); CreateObject(0x3d, gArea.field_0x17, 0);
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,45 +33,39 @@ 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;
bVar1 = gUnk_0811BE48[arg1].unk[3]; bVar1 = gUnk_0811BE48[arg1].unk[3];
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);
if (pEVar1 != NULL) { if (pEVar1 != NULL) {
*(ItemBehavior **)&pEVar1->parent = beh; *(ItemBehavior**)&pEVar1->parent = beh;
} }
return pEVar1; return pEVar1;
} }
void* sub_08077C54(UnkItemStruct* unk) void* sub_08077C54(UnkItemStruct* unk) {
{ Entity* item;
Entity *item;
item = sub_0805E744(); item = sub_0805E744();
if (item != NULL) { if (item != NULL) {
@ -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,9 +89,8 @@ 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();
if (ent != NULL) { if (ent != NULL) {
@ -116,9 +105,8 @@ 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();
if (ent != NULL) { if (ent != NULL) {
@ -134,6 +122,6 @@ Entity * sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk)
} }
NAKED NAKED
void sub_08077D38(ItemBehavior *beh, u32 arg1) { void sub_08077D38(ItemBehavior* beh, u32 arg1) {
asm(".include \"asm/non_matching/sub_08077D38.inc\""); asm(".include \"asm/non_matching/sub_08077D38.inc\"");
} }

View File

@ -4,17 +4,16 @@
#include "functions.h" #include "functions.h"
typedef struct { typedef struct {
u8 b0: 4; u8 b0 : 4;
u8 b1: 4; u8 b1 : 4;
} PACKED Unk_bitfield; } PACKED Unk_bitfield;
typedef struct { 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,71 +22,62 @@ 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;
if (bits == 0) { if (bits == 0) {
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;
} }
} }
not = (8 >> bits); not = (8 >> bits);
gPlayerState.field_0x3[1] &= ~((u8)((8 >> bits) << 4) | not); gPlayerState.field_0x3[1] &= ~((u8)((8 >> bits) << 4) | not );
not = ~not; not = ~not ;
gPlayerState.field_0xa &= not; gPlayerState.field_0xa &= not ;
gPlayerState.keepFacing &= not; gPlayerState.keepFacing &= not ;
_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);
arg0->unk[7] = 0x28; arg0->unk[7] = 0x28;
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,28 +86,24 @@ 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) &&
GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) { GetTileTypeByPos(gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI - 0xc, 2) - 0x343U < 4) {

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,9 +72,8 @@ 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,18 +124,16 @@ 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);
sub_0807D184(temp->field_0x4, gUnk_0811E4AC); sub_0807D184(temp->field_0x4, gUnk_0811E4AC);
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;
temp = sub_0807D1C4(arg0); temp = sub_0807D1C4(arg0);

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,14 +2,12 @@
#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);
if (pEVar1 != NULL) { if (pEVar1 != NULL) {
@ -19,24 +17,20 @@ 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);
if (pEVar1 != NULL) { if (pEVar1 != NULL) {
@ -45,9 +39,8 @@ 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);
if (ent != NULL) { if (ent != NULL) {
@ -57,9 +50,8 @@ 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);
if (pEVar1 != NULL) { if (pEVar1 != NULL) {

View File

@ -3,6 +3,6 @@
extern void (*const gUnk_080B3E30[])(Entity*); extern void (*const gUnk_080B3E30[])(Entity*);
void sub_08018FCC(Entity* this){ void sub_08018FCC(Entity* this) {
gUnk_080B3E30[(this->action)](this); gUnk_080B3E30[(this->action)](this);
} }

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) {
@ -544,7 +542,7 @@ void sub_080322E8(Entity* this) {
} }
} }
void sub_08032338(Entity *this) { void sub_08032338(Entity* this) {
if ((((Entity*)this->field_0x7c.WORD)->actionDelay += 15) != 80) if ((((Entity*)this->field_0x7c.WORD)->actionDelay += 15) != 80)
this->field_0x6c.HALF.LO = 0; this->field_0x6c.HALF.LO = 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,23 +10,20 @@ 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) {
sub_0804A9FC(this,0x1c); sub_0804A9FC(this, 0x1c);
} }
sub_0804AA30(this, &gUnk_080CFF78); sub_0804AA30(this, &gUnk_080CFF78);
if ((this->bitfield & 0x80) != 0) { if ((this->bitfield & 0x80) != 0) {
@ -38,4 +35,5 @@ void sub_0803C198(Entity *this)
} }
} }
void nullsub_168(Entity* this){} void nullsub_168(Entity* this) {
}

View File

@ -61,16 +61,15 @@ void sub_0802B56C(Entity* this) {
} }
} }
void sub_0802B5C8(Entity *this) { void sub_0802B5C8(Entity* this) {
GetNextFrame(this); GetNextFrame(this);
if (this->frames.all & 0x80) { if (this->frames.all & 0x80) {
this->action = 1; this->action = 1;
this->actionDelay = 30; this->actionDelay = 30;
InitializeAnimation(this,0); InitializeAnimation(this, 0);
} }
} }
// clang-format off // clang-format off
void (*const gUnk_080CD27C[])(Entity*) = { void (*const gUnk_080CD27C[])(Entity*) = {
sub_0802B518, sub_0802B518,

View File

@ -136,17 +136,16 @@ u32 sub_08022B20(Entity* this) {
return sub_080041A0(this, &gPlayerEntity, 0x24, 0x24); return sub_080041A0(this, &gPlayerEntity, 0x24, 0x24);
} }
void sub_08022B44(Entity *this){ void sub_08022B44(Entity* this) {
this->field_0x20 = 0xc000; this->field_0x20 = 0xc000;
this->direction = GetFacingDirection(this,&gPlayerEntity); this->direction = GetFacingDirection(this, &gPlayerEntity);
if (this->direction & 0xf) if (this->direction & 0xf)
this->spriteSettings.b.flipX = (this->direction >> 4)^1; this->spriteSettings.b.flipX = (this->direction >> 4) ^ 1;
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

@ -208,7 +208,7 @@ void sub_0802C4B0(Entity* this) {
} }
} }
void sub_0802C62C(Entity *this) { void sub_0802C62C(Entity* this) {
this->action = 1; this->action = 1;
this->y.HALF.HI = this->field_0x82.HWORD; this->y.HALF.HI = this->field_0x82.HWORD;
this->x.HALF.HI = this->field_0x80.HWORD; this->x.HALF.HI = this->field_0x80.HWORD;

View File

@ -95,11 +95,11 @@ void sub_08045454(Entity* this) {
u32 sub_0804A024(Entity*, u32, u32); u32 sub_0804A024(Entity*, u32, u32);
void sub_08045524(Entity *this) { void sub_08045524(Entity* this) {
u32 tmp, tmp1, tmp2; u32 tmp, tmp1, tmp2;
this->field_0x20 = 0x1c000; this->field_0x20 = 0x1c000;
tmp = sub_0804A024(this,1,8); tmp = sub_0804A024(this, 1, 8);
if (tmp != 0xff && (Random() & 3) == 0) { if (tmp != 0xff && (Random() & 3) == 0) {
this->actionDelay = Random() & 3; this->actionDelay = Random() & 3;
this->direction = DirectionRound(tmp); this->direction = DirectionRound(tmp);

View File

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

View File

@ -5,62 +5,62 @@
#include "random.h" #include "random.h"
#include "player.h" #include "player.h"
extern void (*const LakituActionFuncs[])(Entity *); extern void (*const LakituActionFuncs[])(Entity*);
// Lakitu // Lakitu
extern void EnemyFunctionHandler(Entity *, void (*const funcs[])(Entity*)); extern void EnemyFunctionHandler(Entity*, void (*const funcs[])(Entity*));
// sub_0803C784 // sub_0803C784
extern void sub_0804AA30(Entity *, void (*const funcs[])(Entity *)); extern void sub_0804AA30(Entity*, void (*const funcs[])(Entity*));
// sub_0803C820 // sub_0803C820
extern u32 sub_0806F520(Entity *); extern u32 sub_0806F520(Entity*);
// sub_0803C850 // sub_0803C850
extern void sub_0806F4E8(Entity *); extern void sub_0806F4E8(Entity*);
// Lakitu_Initialize // Lakitu_Initialize
extern void sub_0804A720(Entity *); extern void sub_0804A720(Entity*);
// Lakitu_Cloudless // Lakitu_Cloudless
extern u32 sub_08003FC4(Entity *, u32); extern u32 sub_08003FC4(Entity*, u32);
// sub_0803CA4C // sub_0803CA4C
extern u32 sub_080041A0(Entity *, Entity *, u32, u32); extern u32 sub_080041A0(Entity*, Entity*, u32, u32);
// sub_0803CAD0 // sub_0803CAD0
extern u32 sub_080AEFE0(Entity *); extern u32 sub_080AEFE0(Entity*);
// Lakitu_SpawnLightning // Lakitu_SpawnLightning
void PositionRelative(Entity*, Entity*, s32, s32); void PositionRelative(Entity*, Entity*, s32, s32);
extern void EnqueueSFX(u32); extern void EnqueueSFX(u32);
// sub_0803CC08 // sub_0803CC08
extern void DeleteEntity(Entity *); extern void DeleteEntity(Entity*);
// Part of function tables // Part of function tables
extern void sub_08001324(Entity *); extern void sub_08001324(Entity*);
extern void sub_0804A7D4(Entity *); extern void sub_0804A7D4(Entity*);
extern void sub_08001242(Entity *); 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,
extern void UpdateAnimationSingleFrame(Entity *); u8 form); // Creates a projectile positioned at the given entity
extern void InitAnimationForceUpdate(Entity *, u32); extern void UpdateAnimationSingleFrame(Entity*);
extern u32 sub_0806FCB8(Entity *, u32, u32, u32); extern void InitAnimationForceUpdate(Entity*, u32);
extern u32 GetFacingDirection(Entity *, Entity *); extern u32 sub_0806FCB8(Entity*, u32, u32, u32);
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*);
extern void sub_0803CA84(Entity *, u32); extern void sub_0803CA84(Entity*, u32);
extern bool32 sub_0803CA4C(Entity *); extern bool32 sub_0803CA4C(Entity*);
extern bool32 sub_0803CB04(Entity *); extern bool32 sub_0803CB04(Entity*);
extern void Lakitu_SpawnLightning(Entity *); extern void Lakitu_SpawnLightning(Entity*);
extern void sub_0803CB34(Entity *); extern void sub_0803CB34(Entity*);
extern void sub_0803CC08(Entity *this); extern void sub_0803CC08(Entity* this);
enum { enum {
INIT, INIT,
@ -79,21 +79,21 @@ typedef struct {
} PACKED OffsetCoords; } PACKED OffsetCoords;
// sub_0803CC08 // sub_0803CC08
extern void DeleteEntity(Entity *); extern void DeleteEntity(Entity*);
// Variables // Variables
extern void (*const gUnk_080D0110[])(Entity *); extern void (*const gUnk_080D0110[])(Entity*);
extern void (*const gUnk_080D0128[])(Entity *); extern void (*const gUnk_080D0128[])(Entity*);
extern void (*const gUnk_080D0148[])(Entity *); extern void (*const gUnk_080D0148[])(Entity*);
extern const OffsetCoords gUnk_080D0154[]; extern const OffsetCoords gUnk_080D0154[];
void Lakitu(Entity *this) { void Lakitu(Entity* this) {
EnemyFunctionHandler(this, gUnk_080D0110); EnemyFunctionHandler(this, gUnk_080D0110);
SetChildOffset(this, 0, 1, -16); SetChildOffset(this, 0, 1, -16);
} }
void Lakitu_DoAction(Entity *this) { void Lakitu_DoAction(Entity* this) {
if (this->action != 0 && this->action != 7) { if (this->action != 0 && this->action != 7) {
sub_0803CAD0(this); sub_0803CAD0(this);
} }
@ -101,15 +101,14 @@ void Lakitu_DoAction(Entity *this) {
LakituActionFuncs[this->action](this); LakituActionFuncs[this->action](this);
} }
void sub_0803C784(Entity *this) { void sub_0803C784(Entity* this) {
if ((this->bitfield & 0x7f) == 0x1d) { if ((this->bitfield & 0x7f) == 0x1d) {
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);
if (fx != NULL) { if (fx != NULL) {
u32 angle = (this->field_0x3e ^ 0x10) << 3; u32 angle = (this->field_0x3e ^ 0x10) << 3;
@ -139,19 +138,19 @@ void sub_0803C784(Entity *this) {
sub_0804AA30(this, gUnk_080D0110); sub_0804AA30(this, gUnk_080D0110);
} }
void sub_0803C820(Entity *this) { void sub_0803C820(Entity* this) {
if (sub_0806F520(this)) { if (sub_0806F520(this)) {
gUnk_080D0148[this->previousActionFlag](this); gUnk_080D0148[this->previousActionFlag](this);
} }
} }
void sub_0803C844(Entity *this) { void sub_0803C844(Entity* this) {
this->previousActionFlag = 1; this->previousActionFlag = 1;
this->field_0x1d = 0x3c; this->field_0x1d = 0x3c;
} }
void sub_0803C850(Entity *this) { void sub_0803C850(Entity* this) {
Entity *cloud = this->attachedEntity; Entity* cloud = this->attachedEntity;
if (cloud != NULL) { if (cloud != NULL) {
cloud->spriteOffsetX = this->spriteOffsetX; cloud->spriteOffsetX = this->spriteOffsetX;
} }
@ -159,13 +158,13 @@ void sub_0803C850(Entity *this) {
sub_0806F4E8(this); sub_0806F4E8(this);
} }
void sub_0803C86C(Entity *this) { void sub_0803C86C(Entity* this) {
sub_0803CBAC(this); sub_0803CBAC(this);
this->attachedEntity = NULL; this->attachedEntity = NULL;
} }
void Lakitu_Initialize(Entity *this) { void Lakitu_Initialize(Entity* this) {
Entity *cloud = sub_0804A98C(this, 17, 0); Entity* cloud = sub_0804A98C(this, 17, 0);
if (cloud == NULL) { if (cloud == NULL) {
return; return;
} }
@ -185,7 +184,7 @@ void Lakitu_Initialize(Entity *this) {
this->field_0x76.HWORD = this->y.HALF.HI; this->field_0x76.HWORD = this->y.HALF.HI;
} }
void Lakitu_Hide(Entity *this) { void Lakitu_Hide(Entity* this) {
sub_0803CA84(this, 0); sub_0803CA84(this, 0);
if (sub_0803CA4C(this)) { if (sub_0803CA4C(this)) {
@ -194,7 +193,7 @@ void Lakitu_Hide(Entity *this) {
} }
} }
void Lakitu_EndHide(Entity *this) { void Lakitu_EndHide(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if (this->frames.b.f3) { if (this->frames.b.f3) {
@ -207,7 +206,7 @@ void Lakitu_EndHide(Entity *this) {
} }
} }
void Lakitu_Idle(Entity *this) { void Lakitu_Idle(Entity* this) {
if (sub_0803CB04(this)) { if (sub_0803CB04(this)) {
return; return;
} }
@ -217,13 +216,12 @@ 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);
} }
} }
void Lakitu_BeginHide(Entity *this) { void Lakitu_BeginHide(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if (this->frames.b.f3 != 0) { if (this->frames.b.f3 != 0) {
@ -234,7 +232,7 @@ void Lakitu_BeginHide(Entity *this) {
} }
} }
void Lakitu_Lightning(Entity *this) { void Lakitu_Lightning(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if (this->frames.b.f3 == 0) { if (this->frames.b.f3 == 0) {
@ -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;
@ -260,7 +257,7 @@ void Lakitu_Lightning(Entity *this) {
} }
} }
void Lakitu_LightningDelay(Entity *this) { void Lakitu_LightningDelay(Entity* this) {
this->actionDelay--; this->actionDelay--;
if (this->actionDelay != 0) { if (this->actionDelay != 0) {
@ -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;
@ -278,7 +274,7 @@ void Lakitu_LightningDelay(Entity *this) {
} }
} }
void Lakitu_Cloudless(Entity *this) { void Lakitu_Cloudless(Entity* this) {
if (sub_08003FC4(this, 0x1800) == 0 && this->animIndex <= 19) { if (sub_08003FC4(this, 0x1800) == 0 && this->animIndex <= 19) {
InitAnimationForceUpdate(this, this->animationState + 20); InitAnimationForceUpdate(this, this->animationState + 20);
@ -289,7 +285,7 @@ void Lakitu_Cloudless(Entity *this) {
sub_0803CC08(this); sub_0803CC08(this);
} }
bool32 sub_0803CA4C(Entity *this) { bool32 sub_0803CA4C(Entity* this) {
if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) { if (sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x28) == 0) {
if (sub_080041A0(this, &gPlayerEntity, 0x70, 0x50)) { if (sub_080041A0(this, &gPlayerEntity, 0x70, 0x50)) {
return 1; return 1;
@ -299,7 +295,7 @@ bool32 sub_0803CA4C(Entity *this) {
return 0; return 0;
} }
void sub_0803CA84(Entity *this, u32 unkParameter) { void sub_0803CA84(Entity* this, u32 unkParameter) {
u32 altAnimState = GetFacingDirection(this, &gPlayerEntity); u32 altAnimState = GetFacingDirection(this, &gPlayerEntity);
if (((altAnimState - 3) & 7) > 2 || ((this->animationState - (altAnimState >> 3)) & 3) > 1) { if (((altAnimState - 3) & 7) > 2 || ((this->animationState - (altAnimState >> 3)) & 3) > 1) {
@ -314,23 +310,23 @@ 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);
} }
} }
bool32 sub_0803CB04(Entity *this) { bool32 sub_0803CB04(Entity* this) {
bool32 returnValue; bool32 returnValue;
u8 delay; u8 delay;
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;
@ -341,7 +337,7 @@ bool32 sub_0803CB04(Entity *this) {
return returnValue; return returnValue;
} }
void sub_0803CB34(Entity *this) { void sub_0803CB34(Entity* this) {
this->action = LIGHTNING_THROW; this->action = LIGHTNING_THROW;
this->damageType = 0xa6; this->damageType = 0xa6;
@ -350,9 +346,9 @@ void sub_0803CB34(Entity *this) {
InitAnimationForceUpdate(this, this->animationState + 8); InitAnimationForceUpdate(this, this->animationState + 8);
} }
void Lakitu_SpawnLightning(Entity *this) { void Lakitu_SpawnLightning(Entity* this) {
Entity *lightning; Entity* lightning;
const OffsetCoords *offset; const OffsetCoords* offset;
lightning = sub_0804A98C(this, 18, 0); lightning = sub_0804A98C(this, 18, 0);
@ -369,8 +365,8 @@ void Lakitu_SpawnLightning(Entity *this) {
EnqueueSFX(0x193); EnqueueSFX(0x193);
} }
void sub_0803CBAC(Entity *this) { void sub_0803CBAC(Entity* this) {
Entity *cloud; Entity* cloud;
cloud = this->attachedEntity; cloud = this->attachedEntity;
if (cloud != NULL) { if (cloud != NULL) {
@ -390,9 +386,9 @@ void sub_0803CBAC(Entity *this) {
InitAnimationForceUpdate(this, this->animationState + 16); InitAnimationForceUpdate(this, this->animationState + 16);
} }
void sub_0803CC08(Entity *this) { void sub_0803CC08(Entity* this) {
Entity *cloud; Entity* cloud;
Entity *fx; Entity* fx;
cloud = this->attachedEntity; cloud = this->attachedEntity;
if (cloud == NULL) { if (cloud == NULL) {
@ -439,27 +435,16 @@ void sub_0803CC08(Entity *this) {
DeleteEntity(cloud); DeleteEntity(cloud);
} }
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*) = {
sub_0803C844, sub_0803C844,
sub_0803C850, sub_0803C850,
sub_0803C86C, sub_0803C86C,

View File

@ -2,61 +2,60 @@
#include "entity.h" #include "entity.h"
#include "player.h" #include "player.h"
extern u32 GetNextFunction(Entity *); extern u32 GetNextFunction(Entity*);
extern void sub_0804A7D4(Entity *); extern void sub_0804A7D4(Entity*);
extern void sub_08001242(Entity *); extern void sub_08001242(Entity*);
extern void (*const gUnk_080D0418[6])(Entity *); extern void (*const gUnk_080D0418[6])(Entity*);
extern void (*const gUnk_080D0430[3])(Entity *); extern void (*const gUnk_080D0430[3])(Entity*);
extern void (*const gUnk_080D043C[3])(Entity *); extern void (*const gUnk_080D043C[3])(Entity*);
extern bool32 sub_0806F3E4(Entity *); extern bool32 sub_0806F3E4(Entity*);
extern bool32 sub_0806F520(Entity *); extern bool32 sub_0806F520(Entity*);
extern void sub_0800449C(Entity *, u32); extern void sub_0800449C(Entity*, u32);
extern void sub_0803CE14(Entity *); extern void sub_0803CE14(Entity*);
extern void sub_0803CE3C(Entity *); extern void sub_0803CE3C(Entity*);
extern Entity *GetCurrentRoomProperty(u8); extern Entity* GetCurrentRoomProperty(u8);
extern void sub_0806F4E8(Entity *); extern void sub_0806F4E8(Entity*);
extern void sub_0806F69C(Entity *); extern void sub_0806F69C(Entity*);
extern void sub_08079D84(void); extern void sub_08079D84(void);
extern void sub_080A2CC0(Entity *, Entity **, u16 *); extern void sub_080A2CC0(Entity*, Entity**, u16*);
void LakituCloud(Entity *this) { void LakituCloud(Entity* this) {
gUnk_080D0418[GetNextFunction(this)](this); gUnk_080D0418[GetNextFunction(this)](this);
} }
void sub_0803CCD4(Entity *this) { void sub_0803CCD4(Entity* this) {
gUnk_080D0430[this->action](this); gUnk_080D0430[this->action](this);
} }
void sub_0803CCEC(Entity *this) { void sub_0803CCEC(Entity* this) {
this->field_0x42 = 0; this->field_0x42 = 0;
sub_0803CCD4(this); sub_0803CCD4(this);
} }
void sub_0803CCFC(Entity *this) { void sub_0803CCFC(Entity* this) {
if (sub_0806F520(this) == 0) { if (sub_0806F520(this) == 0) {
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);
} }
} }
void sub_0803CD2C(Entity *this) { void sub_0803CD2C(Entity* this) {
this->previousActionFlag = 1; this->previousActionFlag = 1;
this->field_0x1d = 0x3c; this->field_0x1d = 0x3c;
} }
void sub_0803CD38(Entity *this) { void sub_0803CD38(Entity* this) {
sub_0806F4E8(this); sub_0806F4E8(this);
} }
void sub_0803CD40(Entity *this) { void sub_0803CD40(Entity* this) {
if (!sub_0806F3E4(this)) { if (!sub_0806F3E4(this)) {
return; return;
} }
@ -69,8 +68,8 @@ void sub_0803CD40(Entity *this) {
sub_0803CE3C(this); sub_0803CE3C(this);
} }
void sub_0803CD6C(Entity *this) { void sub_0803CD6C(Entity* this) {
Entity *lakitu; Entity* lakitu;
this->action = 1; this->action = 1;
this->height.HALF.HI = -2; this->height.HALF.HI = -2;
@ -88,7 +87,7 @@ void sub_0803CD6C(Entity *this) {
sub_0803CE14(this); sub_0803CE14(this);
} }
void sub_0803CDA8(Entity *this) { void sub_0803CDA8(Entity* this) {
UpdateAnimationSingleFrame(this); UpdateAnimationSingleFrame(this);
if ((this->direction & 0x80) == 0) { if ((this->direction & 0x80) == 0) {
@ -100,7 +99,7 @@ void sub_0803CDA8(Entity *this) {
} }
} }
void sub_0803CDD8(Entity *this) { void sub_0803CDD8(Entity* this) {
u8 one; u8 one;
u8 draw; u8 draw;
@ -119,7 +118,7 @@ void sub_0803CDD8(Entity *this) {
} }
} }
void sub_0803CE14(Entity *this) { void sub_0803CE14(Entity* this) {
u8 direction; u8 direction;
sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74.HWORD); sub_080A2CC0(this, &this->attachedEntity, &this->field_0x74.HWORD);
@ -134,7 +133,7 @@ void sub_0803CE14(Entity *this) {
InitAnimationForceUpdate(this, direction); InitAnimationForceUpdate(this, direction);
} }
void sub_0803CE3C(Entity *this) { void sub_0803CE3C(Entity* this) {
CreateFx(this, 2, 0); CreateFx(this, 2, 0);
this->action = 2; this->action = 2;
@ -152,22 +151,17 @@ void sub_0803CE3C(Entity *this) {
sub_0803CE14(this); sub_0803CE14(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*) = {
sub_0803CD6C, sub_0803CD6C,
sub_0803CDA8, sub_0803CDA8,
sub_0803CDD8, sub_0803CDD8,
}; };
void (*const gUnk_080D043C[])(Entity *) = { void (*const gUnk_080D043C[])(Entity*) = {
sub_0803CD2C, sub_0803CD2C,
sub_0803CD38, sub_0803CD38,
sub_0803CD40, sub_0803CD40,

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_08027DA4, sub_08001324, sub_08027E40, sub_08001242, nullsub_139,
sub_08027D8C,
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

@ -65,7 +65,7 @@ void sub_080452E4(Entity* this) {
this->actionDelay = (Random() & 0x1f) + 1; this->actionDelay = (Random() & 0x1f) + 1;
} }
void sub_080452FC(Entity *this) { void sub_080452FC(Entity* this) {
u32 cVar2, bVar3; u32 cVar2, bVar3;
GetNextFrame(this); GetNextFrame(this);
if (--this->actionDelay == 0) { if (--this->actionDelay == 0) {

View File

@ -356,7 +356,7 @@ void sub_080205F8(Entity* this) {
this->actionDelay = 60; this->actionDelay = 60;
} }
void sub_08020604(Entity *this){ void sub_08020604(Entity* this) {
if (!sub_08049FA0(this) && (Random() & 3)) { if (!sub_08049FA0(this) && (Random() & 3)) {
this->direction = sub_08049EE4(this); this->direction = sub_08049EE4(this);
} else { } else {
@ -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

@ -24,17 +24,18 @@ void sub_08031840(Entity*);
extern BoundingBox gUnk_080CE560; extern BoundingBox gUnk_080CE560;
void SmallPesto(Entity *this){ void SmallPesto(Entity* this) {
gUnk_080CE530[GetNextFunction(this)](this); gUnk_080CE530[GetNextFunction(this)](this);
} }
void sub_08031680(Entity *this){ 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;
GetNextFrame(this); GetNextFrame(this);
@ -45,39 +46,38 @@ 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);
} }
} }
void sub_080316DC(Entity *this){ void sub_080316DC(Entity* this) {
this->previousActionFlag = 1; this->previousActionFlag = 1;
this->field_0x1d = 0x3c; this->field_0x1d = 0x3c;
} }
void sub_080316E8(Entity *this){ void sub_080316E8(Entity* this) {
sub_0806F4E8(this); sub_0806F4E8(this);
} }
void sub_080316F0(Entity *this){ void sub_080316F0(Entity* this) {
if (sub_0806F3E4()) { if (sub_0806F3E4()) {
sub_0804A7D4(this); sub_0804A7D4(this);
} }
} }
void sub_08031704(Entity *this){ void sub_08031704(Entity* this) {
sub_0804A720(this); sub_0804A720(this);
sub_080317F8(this); sub_080317F8(this);
} }
void sub_08031714(Entity* this){ void sub_08031714(Entity* this) {
u8 newDirection; u8 newDirection;
sub_080317B4(this); sub_080317B4(this);
if(--this->field_0xf == 0){ if (--this->field_0xf == 0) {
this->field_0xf = (Random() & 0xf) + 0x10; this->field_0xf = (Random() & 0xf) + 0x10;
if(sub_08049FA0(this) == 0){ if (sub_08049FA0(this) == 0) {
if((this->field_0xf & 1) != 0){ if ((this->field_0xf & 1) != 0) {
this->direction = sub_08049EE4(this); this->direction = sub_08049EE4(this);
goto _08031766; goto _08031766;
} }
@ -89,34 +89,33 @@ void sub_08031714(Entity* this){
} }
} }
void sub_08031770(Entity* this){ void sub_08031770(Entity* this) {
if(this->field_0x80.HWORD != 0){ if (this->field_0x80.HWORD != 0) {
if(--this->field_0x80.HWORD == 0){ if (--this->field_0x80.HWORD == 0) {
sub_08031840(this); sub_08031840(this);
} }
}else if(this->attachedEntity == NULL){ } else if (this->attachedEntity == NULL) {
this->field_0x80.HWORD = (Random() & 0x7f) | (0x80 << 2); this->field_0x80.HWORD = (Random() & 0x7f) | (0x80 << 2);
}else{ } else {
if(this->attachedEntity->next == NULL){ if (this->attachedEntity->next == NULL) {
this->attachedEntity = NULL; this->attachedEntity = NULL;
} }
} }
return; return;
} }
void sub_080317B4(Entity* this){ void sub_080317B4(Entity* this) {
this->height.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd; this->height.HALF.HI = ((Random() & 0x30) != 0) ? -0xc : -0xd;
sub_0806F69C(this); sub_0806F69C(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);
} }
void sub_080317F8(Entity *this){ void sub_080317F8(Entity* this) {
u8 newDirection = Random() & 0x18; u8 newDirection = Random() & 0x18;
this->action = 1; this->action = 1;
this->height.HALF.HI = 0x0000FFF4; this->height.HALF.HI = 0x0000FFF4;
@ -130,13 +129,12 @@ void sub_080317F8(Entity *this){
this->field_0xf = 0x20; this->field_0xf = 0x20;
} }
void sub_08031840(Entity* this){ void sub_08031840(Entity* this) {
Entity *enemy = CreateEnemy(0x2d, this->entityType.form); Entity* enemy = CreateEnemy(0x2d, this->entityType.form);
if(enemy!= NULL){ if (enemy != NULL) {
CopyPosition(this, enemy); CopyPosition(this, enemy);
enemy->parent = this; enemy->parent = this;
this->attachedEntity = enemy; this->attachedEntity = enemy;
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,17 +13,16 @@ 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();
_DmaZero((void *)&gUnk_03000B80, 0x70); _DmaZero((void*)&gUnk_03000B80, 0x70);
_DmaZero((void *)&gPlayerState, 0xb0); _DmaZero((void*)&gPlayerState, 0xb0);
_DmaFill32(0xffffffff, &gPlayerState.field_0x40, 0x40); _DmaFill32(0xffffffff, &gPlayerState.field_0x40, 0x40);
pl = &gPlayerEntity; pl = &gPlayerEntity;
_DmaZero((void *)pl, 0x88); _DmaZero((void*)pl, 0x88);
gRoomControls.cameraTarget = pl; gRoomControls.cameraTarget = pl;
gPlayerState.playerAction = gUnk_080FCAC8[gScreenTransition.field_0xf]; gPlayerState.playerAction = gUnk_080FCAC8[gScreenTransition.field_0xf];
if (!CheckGlobalFlag(0x14)) { if (!CheckGlobalFlag(0x14)) {

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;
@ -101,10 +92,9 @@ static void HandleNintendoCapcomLogos(void)
gIntroState.timer = 120; gIntroState.timer = 120;
LoadGfxGroup(16); LoadGfxGroup(16);
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;
@ -171,7 +158,7 @@ static void HandleTitlescreen(void)
UpdateSwordBgAffineData(); UpdateSwordBgAffineData();
} }
sub_080A3210(); sub_080A3210();
PlaySFX(3); //fanfare PlaySFX(3); // fanfare
DoFade(6, 8); DoFade(6, 8);
break; break;
case 1: case 1:
@ -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);
@ -208,7 +193,7 @@ static void HandleTitlescreen(void)
if ((gIntroState.timer & 0x20) == 0) { if ((gIntroState.timer & 0x20) == 0) {
gUnk_03001010[4] = 0xe000; gUnk_03001010[4] = 0xe000;
gUnk_03001010[1] = 0x84; gUnk_03001010[1] = 0x84;
sub_080ADA14(0x1ff,0); sub_080ADA14(0x1ff, 0);
} }
} }
if (gIntroState.gameLanguage != ((struct_02000000*)0x2000000)->gameLanguage) { if (gIntroState.gameLanguage != ((struct_02000000*)0x2000000)->gameLanguage) {
@ -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,9 +226,8 @@ 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) {
case 0: case 0:
@ -268,7 +251,7 @@ static void HandleJapaneseTitlescreenAnimationIntro(void)
gFadeControl.field_0x4 = -1; gFadeControl.field_0x4 = -1;
gIntroState.subState++; gIntroState.subState++;
gIntroState.timer = 90; gIntroState.timer = 90;
pEVar2 = CreateObject(0xb4,0,0); pEVar2 = CreateObject(0xb4, 0, 0);
if (pEVar2 != NULL) { if (pEVar2 != NULL) {
pEVar2->x.HALF.HI = 0; pEVar2->x.HALF.HI = 0;
pEVar2->y.HALF.HI = 0x48; pEVar2->y.HALF.HI = 0x48;

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,25 +14,22 @@ 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;
*(u32 *)&this->cutsceneBeh = this->x.WORD = gPlayerEntity.x.WORD; *(u32*)&this->cutsceneBeh = this->x.WORD = gPlayerEntity.x.WORD;
*(u32 *)&this->field_0x80 = this->y.WORD = gPlayerEntity.y.WORD; *(u32*)&this->field_0x80 = this->y.WORD = gPlayerEntity.y.WORD;
uVar2 = this->animationState = gPlayerEntity.animationState & 0xe; uVar2 = this->animationState = gPlayerEntity.animationState & 0xe;
this->direction = (u8)(uVar2 << 2); this->direction = (u8)(uVar2 << 2);
this->nonPlanarMovement = 0x400; this->nonPlanarMovement = 0x400;
@ -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();
} }
@ -64,17 +60,16 @@ void sub_08018CBC(Entity *this)
this->field_0x44 = gUnk_080B3DE0[(this->entityType).form * 2 + 1]; this->field_0x44 = gUnk_080B3DE0[(this->entityType).form * 2 + 1];
this->field_0x40 = 0x1b; this->field_0x40 = 0x1b;
this->boundingBox = gUnk_080B3DE8[(this->entityType).form]; this->boundingBox = gUnk_080B3DE8[(this->entityType).form];
(u32 *)gPlayerEntity.field_0x70.WORD = this; (u32*)gPlayerEntity.field_0x70.WORD = this;
sub_08078CD0(&gPlayerEntity); sub_08078CD0(&gPlayerEntity);
(u32 *)gPlayerEntity.field_0x70.WORD = pEVar3; (u32*)gPlayerEntity.field_0x70.WORD = pEVar3;
InitializeAnimation(this, (this->entityType).form + 10); InitializeAnimation(this, (this->entityType).form + 10);
sub_08018FA0(this); sub_08018FA0(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

@ -47,7 +47,7 @@ void sub_0804B058(EntityData* dat) {
} }
uVar2++; uVar2++;
dat++; dat++;
} while (*(u8*)dat!= 0xff); } while (*(u8*)dat != 0xff);
} }
} }

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) {
@ -93,7 +90,7 @@ static void sub_08055F70(void) {
DisableInterruptsAndDMA(); DisableInterruptsAndDMA();
RegisterRamReset(RESET_ALL & ~RESET_EWRAM); RegisterRamReset(RESET_ALL & ~RESET_EWRAM);
*(vu16 *)BG_PLTT = 0x7FFF; *(vu16*)BG_PLTT = 0x7FFF;
REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3; REG_WAITCNT = WAITCNT_PREFETCH_ENABLE | WAITCNT_WS0_S_1 | WAITCNT_WS0_N_3;
size = 0x3FFD0; size = 0x3FFD0;
_DmaZero(gUnk_02000030, size); _DmaZero(gUnk_02000030, size);

View File

@ -13,48 +13,43 @@ 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;
gUnk_08107C5C[this->action](this); gUnk_08107C5C[this->action](this);
gUnk_08107C48[((u8*)&this->field_0x20)[1]](this); gUnk_08107C48[((u8*)&this->field_0x20)[1]](this);
bVar1 = gUnk_08107C40[((u8*)&this->field_0x20)[1]]; bVar1 = gUnk_08107C40[((u8*)&this->field_0x20)[1]];
if ((bVar1 != 0) && (*(u8 *)&this->field_0x20 != bVar1)) { if ((bVar1 != 0) && (*(u8*)&this->field_0x20 != bVar1)) {
((u8*)&this->field_0x20)[0] = bVar1; ((u8*)&this->field_0x20)[0] = bVar1;
LoadGfxGroup(bVar1); LoadGfxGroup(bVar1);
} }
} }
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]);
this->height.WORD = 0; this->height.WORD = 0;
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;
((u8 *)&this->field_0x20)[2] = 0; ((u8*)&this->field_0x20)[2] = 0;
this->action = 1; this->action = 1;
gScreen.affine.bg3Control = 0x1e04; gScreen.affine.bg3Control = 0x1e04;
gScreen.lcd.displayControl |= 0x800; gScreen.lcd.displayControl |= 0x800;

View File

@ -9,7 +9,7 @@ typedef struct {
u8 unk_20; u8 unk_20;
u8 unk_21; u8 unk_21;
u8 unk_22; u8 unk_22;
u8 unk_23;//used u8 unk_23; // used
u16 unk_24; u16 unk_24;
u16 unk_26; u16 unk_26;
void* unk_28; void* unk_28;
@ -20,7 +20,7 @@ typedef struct {
s16 unk_38; s16 unk_38;
s16 unk_3a; s16 unk_3a;
u16 unk_3c; u16 unk_3c;
u16 unk_3e;//used u16 unk_3e; // used
} Manager15; } Manager15;
extern void (*const gUnk_081085D8[])(Manager*); extern void (*const gUnk_081085D8[])(Manager*);
@ -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);
@ -86,7 +85,7 @@ void sub_0805A370(Manager15* this) {
void sub_0805A394(Manager15* this) { void sub_0805A394(Manager15* this) {
Entity* ent; Entity* ent;
if ((ent = FindEntityInListBySubtype(0x3,0x13,0x4))) { if ((ent = FindEntityInListBySubtype(0x3, 0x13, 0x4))) {
if (ent->entityType.form != 4) { if (ent->entityType.form != 4) {
return; return;
} }
@ -162,7 +161,7 @@ void sub_0805A4CC(Manager15* this, u32 unk_0) {
if (tmp) { if (tmp) {
tmp->x.HALF.HI = this->unk_38 + gRoomControls.roomOriginX; tmp->x.HALF.HI = this->unk_38 + gRoomControls.roomOriginX;
tmp->y.HALF.HI = this->unk_3a + gRoomControls.roomOriginY - 0x30; tmp->y.HALF.HI = this->unk_3a + gRoomControls.roomOriginY - 0x30;
tmp->parent = (Entity*) this; tmp->parent = (Entity*)this;
this->manager.unk_0d = 0; this->manager.unk_0d = 0;
} }
} }
@ -197,13 +196,15 @@ void sub_0805A500(Manager15* this) {
sub_0805AA58(this); sub_0805AA58(this);
sub_0805A9CC(this); sub_0805A9CC(this);
if (gRoomControls.unk2 == 1) { if (gRoomControls.unk2 == 1) {
gScreen.lcd.displayControl |= 0x80<<7; gScreen.lcd.displayControl |= 0x80 << 7;
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();
} }
@ -211,7 +212,7 @@ void sub_0805A500(Manager15* this) {
void sub_0805A5FC(Manager15* this) { void sub_0805A5FC(Manager15* this) {
if (CheckLocalFlag(0x34)) { if (CheckLocalFlag(0x34)) {
this->manager.action = 2; this->manager.action = 2;
sub_0805A4CC(this,2); sub_0805A4CC(this, 2);
} }
} }
@ -225,7 +226,7 @@ void sub_0805A628(Manager15* this) {
if (CheckLocalFlag(0x36)) { if (CheckLocalFlag(0x36)) {
this->manager.action = 4; this->manager.action = 4;
this->unk_23 = 3; this->unk_23 = 3;
sub_0805A4CC(this,3); sub_0805A4CC(this, 3);
} }
} }
@ -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*);
@ -259,7 +262,7 @@ void sub_0805A68C(Manager15* this) {
if (this->unk_2c > 0x1000) { if (this->unk_2c > 0x1000) {
this->unk_2c--; this->unk_2c--;
} }
gScreen.controls.alphaBlend=this->unk_2c; gScreen.controls.alphaBlend = this->unk_2c;
} }
} }
@ -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,9 +337,10 @@ 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;
case 2: case 2:
if (this->manager.unk_0d) { if (this->manager.unk_0d) {
@ -347,9 +348,10 @@ 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;
case 4: case 4:
if (this->manager.unk_0d) { if (this->manager.unk_0d) {
@ -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);
@ -457,7 +473,7 @@ void sub_0805AA58(Manager15* this) {
this->manager.unk_0e = 8; this->manager.unk_0e = 8;
this->unk_21 += 1; this->unk_21 += 1;
this->unk_21 &= 3; this->unk_21 &= 3;
LoadPalettes(gUnk_085A97A0[this->unk_21].unk_00,5,1); LoadPalettes(gUnk_085A97A0[this->unk_21].unk_00, 5, 1);
} }
if (--this->manager.unk_0f == 0) { if (--this->manager.unk_0f == 0) {
this->manager.unk_0f = 0x10; this->manager.unk_0f = 0x10;
@ -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;
@ -35,9 +34,9 @@ extern u32 sub_0806FBFC(u32, u32, u32, u32);
typedef struct struct_08108764 { typedef struct struct_08108764 {
u8 unk_00; u8 unk_00;
u8 unk_01;//area ID? u8 unk_01; // area ID?
u8 unk_02;//room ID? u8 unk_02; // room ID?
u8 unk_03;//layer? u8 unk_03; // layer?
u16 unk_04; u16 unk_04;
u16 unk_06; u16 unk_06;
u8 unk_08; u8 unk_08;
@ -50,14 +49,14 @@ typedef struct struct_08108764 {
u16 unk_06; u16 unk_06;
u16 unk_08; u16 unk_08;
u16 unk_0a; u16 unk_0a;
}* unk_0c; } * unk_0c;
struct { struct {
u8 unk_00; u8 unk_00;
u8 unk_01; u8 unk_01;
u8 unk_02[2]; u8 unk_02[2];
u16 unk_04; u16 unk_04;
u16 unk_06; u16 unk_06;
}* unk_10; } * unk_10;
} struct_08108764; } struct_08108764;
extern struct_08108764 gUnk_08108764[]; extern struct_08108764 gUnk_08108764[];
@ -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;
} }
@ -147,7 +149,7 @@ u32 sub_0805B1CC(Manager1A* this) {
} }
void sub_0805B210(Manager1A* this) { void sub_0805B210(Manager1A* this) {
struct_08108764 *tmp; struct_08108764* tmp;
gScreenTransition.transitioningOut = 1; gScreenTransition.transitioningOut = 1;
gScreenTransition.transitionType = 1; gScreenTransition.transitionType = 1;
gScreenTransition.playerState = 4; gScreenTransition.playerState = 4;
@ -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) {
@ -202,8 +205,9 @@ 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,16 +21,17 @@ 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
tmp->y.HALF.HI = this->unk_3c & 0xFFF; tmp->y.HALF.HI = this->unk_3c & 0xFFF;
tmp->collisionLayer = this->unk_3c >> 0xC; tmp->collisionLayer = this->unk_3c >> 0xC;
} else { } else {
tmp->x.HALF.HI = this->unk_38; tmp->x.HALF.HI = this->unk_38;
tmp->y.HALF.HI = this->unk_3a; tmp->y.HALF.HI = this->unk_3a;
tmp->collisionLayer = this->unk_37>>4; tmp->collisionLayer = this->unk_37 >> 4;
} }
tmp->x.HALF.HI += gRoomControls.roomOriginX; tmp->x.HALF.HI += gRoomControls.roomOriginX;
tmp->y.HALF.HI += gRoomControls.roomOriginY; tmp->y.HALF.HI += gRoomControls.roomOriginY;

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

@ -5,12 +5,12 @@
typedef struct Manager30 { typedef struct Manager30 {
Manager manager; Manager manager;
u8 unk_20[8];//unused u8 unk_20[8]; // unused
u16 own_tile; u16 own_tile;
u8 unk_2a[0x2];//unused u8 unk_2a[0x2]; // unused
u16 player_previous_tile; u16 player_previous_tile;
u16 player_current_tile; u16 player_current_tile;
u8 unk_30[0x6];//unused u8 unk_30[0x6]; // unused
u8 width; u8 width;
u8 height; u8 height;
s16 x; s16 x;
@ -21,19 +21,14 @@ 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).
* *
* The Manager's field 0xe is used for the remaining number of tiles to be changed. * The Manager's field 0xe is used for the remaining number of tiles to be changed.
* field 0xf is used for the total number of tiles to be changed. * field 0xf is used for the total number of tiles to be changed.
*/ */
void Manager30_Main(Manager30* this) { void Manager30_Main(Manager30* this) {
u32 i, j, tmp, tmp2; u32 i, j, tmp, tmp2;
switch (this->manager.action) { switch (this->manager.action) {
@ -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:
@ -52,29 +46,31 @@ void Manager30_Main(Manager30* this) {
this->player_previous_tile = this->player_current_tile; this->player_previous_tile = this->player_current_tile;
switch (GetTileType(this->player_current_tile, this->manager.unk_0b)) { switch (GetTileType(this->player_current_tile, this->manager.unk_0b)) {
case 0x317: case 0x317:
//stepped on a red tile again // stepped on a red tile again
this->manager.action = FAILED; this->manager.action = FAILED;
PlaySFX(0x6d); PlaySFX(0x6d);
break; break;
case 0x318: case 0x318:
//stepped on a blue tile // stepped on a blue tile
//turn the tile into a red tile // turn the tile into a red tile
sub_0807B7D8(0x317, this->player_current_tile, this->manager.unk_0b); sub_0807B7D8(0x317, this->player_current_tile, this->manager.unk_0b);
PlaySFX(0x6b); PlaySFX(0x6b);
//decrease the number of remaining tiles and check if we're done // decrease the number of remaining tiles and check if we're done
if (--this->manager.unk_0e == 0) { if (--this->manager.unk_0e == 0) {
this->manager.action = SUCCEEDED; this->manager.action = SUCCEEDED;
//set up delay for setting the flag/playing the success sfx // set up delay for setting the flag/playing the success sfx
this->manager.unk_0e = 0x40; this->manager.unk_0e = 0x40;
} }
break; break;
} }
} }
//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
ClearFlag(this->flag_reset);//make sure the puzzle can be reset again later 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
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;
for (i = 0; i < this->height; i++) { for (i = 0; i < this->height; i++) {
@ -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

@ -20,7 +20,7 @@ void sub_0805786C(Manager* this) {
DiggingCaveEntrance* tmp; DiggingCaveEntrance* tmp;
u8 roomID; u8 roomID;
u8 areaID; u8 areaID;
u16 uVar = 0x81<<7; u16 uVar = 0x81 << 7;
sub_080805F8(); sub_080805F8();
if (gUnk_03004030.unk_08 != 0) { if (gUnk_03004030.unk_08 != 0) {
if (gUnk_03004030.unk_00 == 0) { if (gUnk_03004030.unk_00 == 0) {
@ -39,8 +39,8 @@ void sub_0805786C(Manager* this) {
} }
roomID = gRoomControls.roomID; roomID = gRoomControls.roomID;
tmp = gUnk_08107DC0[gRoomControls.areaID]; tmp = gUnk_08107DC0[gRoomControls.areaID];
uVar = 0x81<<7; uVar = 0x81 << 7;
for (tmp = sub_08057AA8(tmp, roomID); tmp != 0; tmp = sub_08057AA8(tmp, roomID)){ for (tmp = sub_08057AA8(tmp, roomID); tmp != 0; tmp = sub_08057AA8(tmp, roomID)) {
SetTile(uVar, tmp->unk_00 + 0x3F, 1); SetTile(uVar, tmp->unk_00 + 0x3F, 1);
SetTile(uVar, tmp->unk_00 + 0x40, 1); SetTile(uVar, tmp->unk_00 + 0x40, 1);
SetTile(uVar, tmp->unk_00 + 0x41, 1); SetTile(uVar, tmp->unk_00 + 0x41, 1);
@ -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*);
@ -69,23 +71,25 @@ u32 sub_0805795C(Manager* this, DiggingCaveEntrance* entr) {
offsetX = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX; offsetX = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX;
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)
offsetY = gRoomControls.roomOriginY + ((tmp>>6) * 16) + 6; return 0;
if (gPlayerEntity.y.HALF.HI >= offsetY) return 0; offsetY = gRoomControls.roomOriginY + ((tmp >> 6) * 16) + 6;
if (gPlayerEntity.y.HALF.HI >= offsetY)
return 0;
} }
sub_08057A18(this, entr); sub_08057A18(this, entr);
return 1; return 1;
@ -111,7 +115,7 @@ void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) {
gRoomControls.areaID = entr->target_areaID; gRoomControls.areaID = entr->target_areaID;
gRoomControls.roomID = entr->target_roomID; gRoomControls.roomID = entr->target_roomID;
gUnk_03004030.unk_00 = entr; gUnk_03004030.unk_00 = entr;
gUnk_03004030.unk_04 = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX - ((entr->unk_00 & 0x3F)*16); gUnk_03004030.unk_04 = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX - ((entr->unk_00 & 0x3F) * 16);
gUnk_03004030.unk_06 = gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY - ((entr->unk_00 & 0xFC0) >> 2); gUnk_03004030.unk_06 = gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY - ((entr->unk_00 & 0xFC0) >> 2);
tmp = gUnk_03004030.unk_08; tmp = gUnk_03004030.unk_08;
if (!tmp) { if (!tmp) {
@ -124,9 +128,10 @@ void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) {
DeleteManager(this); DeleteManager(this);
} }
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);
@ -61,40 +38,43 @@ extern void DeleteManager(Manager*);
void sub_08057AE8(Manager5* this) { void sub_08057AE8(Manager5* this) {
u32 tmp; u32 tmp;
tmp = (this->manager.unk_0b & 0x3)<<1; tmp = (this->manager.unk_0b & 0x3) << 1;
if (this->manager.unk_0e == 1) { if (this->manager.unk_0e == 1) {
this->unk_30 = 0x323; this->unk_30 = 0x323;
} else { } else {
this->unk_30 = tmp & 2 ? 0x37 : 0x36; this->unk_30 = tmp & 2 ? 0x37 : 0x36;
} }
this->unk_28 = gUnk_08108024[tmp]; this->unk_28 = gUnk_08108024[tmp];
this->unk_2a = gUnk_08108024[tmp+1]; this->unk_2a = gUnk_08108024[tmp + 1];
this->unk_2c = gUnk_08108034[tmp]; this->unk_2c = gUnk_08108034[tmp];
this->unk_2e = gUnk_08108034[tmp+1]; this->unk_2e = gUnk_08108034[tmp + 1];
this->unk_32 = ((this->manager.unk_0b>>2)&0xF)+1; this->unk_32 = ((this->manager.unk_0b >> 2) & 0xF) + 1;
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);
} }
DeleteManager(&this->manager); DeleteManager(&this->manager);
} }
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

@ -8,14 +8,14 @@ extern u32 CheckPlayerInRegion(u16, u16, u8, u8);
extern void DoExitTransition(void*); extern void DoExitTransition(void*);
extern void DeleteManager(Entity*); extern void DeleteManager(Entity*);
void sub_08057CB4(Manager6 * this) { void sub_08057CB4(Manager6* this) {
u32 tmp; u32 tmp;
Manager6WarpData* i; Manager6WarpData* i;
if (this->manager.action == 0){ if (this->manager.action == 0) {
this->manager.action = 1; this->manager.action = 1;
this->warpList = GetCurrentRoomProperty(this->manager.unk_0a); this->warpList = GetCurrentRoomProperty(this->manager.unk_0a);
if (!this->warpList) { if (!this->warpList) {
DeleteManager((Entity*) this); DeleteManager((Entity*)this);
return; return;
} }
} }
@ -24,7 +24,7 @@ void sub_08057CB4(Manager6 * this) {
tmp = (i->unk_07.all & 0x3); tmp = (i->unk_07.all & 0x3);
if (((tmp & (gPlayerEntity.collisionLayer)) != 0) && if (((tmp & (gPlayerEntity.collisionLayer)) != 0) &&
(((gPlayerState.flags.all & 0x80) != 0) || ((i->unk_07.b.unk2) != 0)) && (((gPlayerState.flags.all & 0x80) != 0) || ((i->unk_07.b.unk2) != 0)) &&
(CheckPlayerInRegion(i->posX,i->posY,i->width,i->height) != 0) && (CheckPlayerInRegion(i->posX, i->posY, i->width, i->height) != 0) &&
(gPlayerEntity.height.HALF.HI == 0)) { (gPlayerEntity.height.HALF.HI == 0)) {
DoExitTransition(GetCurrentRoomProperty(i->unk_06)); DoExitTransition(GetCurrentRoomProperty(i->unk_06));
} }

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,74 +21,28 @@ 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;
const u32 * tmp2; const u32* tmp2;
if (!this->manager.action) { if (!this->manager.action) {
this->manager.action = 1; this->manager.action = 1;
this->manager.unk_0e = 8; this->manager.unk_0e = 8;
@ -104,9 +57,10 @@ 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) {
case 0: case 0:
gUnk_02034490 = 1; gUnk_02034490 = 1;
@ -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,11 +111,12 @@ 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) {
DmaSet(3,&gGlobalGfxAndPalettes[tmp2[0]],tmp2[1],0x84000400); DmaSet(3, &gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x84000400);
} }
gRoomVars.unk_10 = unk1; gRoomVars.unk_10 = unk1;
} }

View File

@ -47,23 +47,23 @@ extern u8 gUnk_02006F00[];
void sub_08057F20(Manager8* this) { void sub_08057F20(Manager8* this) {
u32 tmp; u32 tmp;
tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX; tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX;
tmp = tmp + (tmp >> 3) + ((0x400 - gRoomControls.width)/2); tmp = tmp + (tmp >> 3) + ((0x400 - gRoomControls.width) / 2);
gScreen.affine.bg3xOffset = tmp&0xF; gScreen.affine.bg3xOffset = tmp & 0xF;
gScreen.affine.bg3yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY))>>2); gScreen.affine.bg3yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 2);
gScreen.affine.unk5 = gUnk_02001A40; gScreen.affine.unk5 = gUnk_02001A40;
sub_08058004(tmp, gUnk_02006F00, gUnk_02001A40); sub_08058004(tmp, gUnk_02006F00, gUnk_02001A40);
tmp = ((tmp>>4)<<1); tmp = ((tmp >> 4) << 1);
if (this->unk_38 != tmp) { if (this->unk_38 != tmp) {
this->unk_38 = tmp; this->unk_38 = tmp;
gScreen.affine.unk4 = 1; gScreen.affine.unk4 = 1;
} }
tmp = (gRoomControls.roomScrollX - gRoomControls.roomOriginX); tmp = (gRoomControls.roomScrollX - gRoomControls.roomOriginX);
tmp = tmp + (tmp >> 2) + ((0x400 - gRoomControls.width)/2); tmp = tmp + (tmp >> 2) + ((0x400 - gRoomControls.width) / 2);
gScreen.bg.bg1yOffset = tmp&0xF; gScreen.bg.bg1yOffset = tmp & 0xF;
gScreen.bg.bg2xOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY))>>1); gScreen.bg.bg2xOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1);
gScreen.bg.unk_14 = gUnk_02001A40 + 0x800; gScreen.bg.unk_14 = gUnk_02001A40 + 0x800;
sub_08058004(tmp, gUnk_02006F00 + 0x2000, gUnk_02001A40 + 0x800); sub_08058004(tmp, gUnk_02006F00 + 0x2000, gUnk_02001A40 + 0x800);
tmp = ((tmp>>4)<<1); tmp = ((tmp >> 4) << 1);
if (this->unk_3c != tmp) { if (this->unk_3c != tmp) {
this->unk_3c = tmp; this->unk_3c = tmp;
gScreen.bg.bg2yOffset = 1; gScreen.bg.bg2yOffset = 1;
@ -101,8 +101,8 @@ void sub_08058034() {
void sub_08058084(u16* unk1, u16* unk2) { void sub_08058084(u16* unk1, u16* unk2) {
u32 tmp; u32 tmp;
for (tmp = 0; tmp < 0x20; tmp++, unk1+=0x20, unk2+=0x80) { for (tmp = 0; tmp < 0x20; tmp++, unk1 += 0x20, unk2 += 0x80) {
DmaSet(3,unk1,unk2,0x80000020); DmaSet(3, unk1, unk2, 0x80000020);
} }
} }
@ -115,19 +115,19 @@ void sub_080580B0(u32 unk1) {
LoadGfxGroup(unk1); LoadGfxGroup(unk1);
gRoomVars.unk_10 = unk1; gRoomVars.unk_10 = unk1;
sub_08058034(); sub_08058034();
tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX;//r7 tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX; // r7
tmp = tmp + (tmp >> 3) + (0x400 - gRoomControls.width) / 2; tmp = tmp + (tmp >> 3) + (0x400 - gRoomControls.width) / 2;
sub_08058004(tmp, gUnk_02006F00, gUnk_02001A40); sub_08058004(tmp, gUnk_02006F00, gUnk_02001A40);
gScreen.affine.bg3xOffset = tmp & 0xF; gScreen.affine.bg3xOffset = tmp & 0xF;
gScreen.affine.bg3yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY))>>1);//? gScreen.affine.bg3yOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //?
gScreen.affine.bg3Control = 0x1D09; gScreen.affine.bg3Control = 0x1D09;
gScreen.affine.unk5 = gUnk_02001A40; gScreen.affine.unk5 = gUnk_02001A40;
gScreen.affine.unk4 = 1; gScreen.affine.unk4 = 1;
tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX;//r7 tmp = gRoomControls.roomScrollX - gRoomControls.roomOriginX; // r7
tmp = tmp + (tmp >> 2) + (0x400 - gRoomControls.width) / 2; tmp = tmp + (tmp >> 2) + (0x400 - gRoomControls.width) / 2;
sub_08058004(tmp, gUnk_02006F00 + 0x2000, gUnk_02001A40 + 0x800); sub_08058004(tmp, gUnk_02006F00 + 0x2000, gUnk_02001A40 + 0x800);
gScreen.bg.bg1yOffset = tmp & 0xF; gScreen.bg.bg1yOffset = tmp & 0xF;
gScreen.bg.bg2xOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY))>>1);//? gScreen.bg.bg2xOffset = 0x30 - ((0x30 - (gRoomControls.roomScrollY - gRoomControls.roomOriginY)) >> 1); //?
gScreen.bg.bg1xOffset = 0x1E09; gScreen.bg.bg1xOffset = 0x1E09;
gScreen.bg.unk_14 = gUnk_02001A40 + 0x800; gScreen.bg.unk_14 = gUnk_02001A40 + 0x800;
gScreen.bg.bg2yOffset = 1; gScreen.bg.bg2yOffset = 1;

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,20 +20,14 @@ 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);
if (!this->manager.action) { if (!this->manager.action) {
this->manager.action=1; this->manager.action = 1;
gScreen.bg.bg2yOffset=0; gScreen.bg.bg2yOffset = 0;
sub_08052D74(this,sub_08058204,NULL); sub_08052D74(this, sub_08058204, NULL);
} }
} }
@ -44,10 +37,11 @@ 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;
} }
u32 sub_08058244(int i) { u32 sub_08058244(int i) {
@ -55,16 +49,16 @@ u32 sub_08058244(int i) {
s32 tmp2; s32 tmp2;
u32 tmp3; u32 tmp3;
s32 tmp4; s32 tmp4;
tmp = ((gRoomControls.roomScrollY - gRoomControls.roomOriginY)*0x20)/(gRoomControls.height-0xa0); tmp = ((gRoomControls.roomScrollY - gRoomControls.roomOriginY) * 0x20) / (gRoomControls.height - 0xa0);
gScreen.bg.bg2xOffset = gRoomControls.roomOriginY + tmp; gScreen.bg.bg2xOffset = gRoomControls.roomOriginY + tmp;
tmp = (((gRoomControls.roomScrollX - gRoomControls.roomOriginX) * gUnk_081081EC[i])/(gRoomControls.width-0xf0)); tmp = (((gRoomControls.roomScrollX - gRoomControls.roomOriginX) * gUnk_081081EC[i]) / (gRoomControls.width - 0xf0));
gScreen.bg.bg1yOffset = tmp & 0xf; gScreen.bg.bg1yOffset = tmp & 0xf;
return tmp; return tmp;
} }
void sub_080582A0(u32 unk, u32* unk2, u8* unk3) { void sub_080582A0(u32 unk, u32* unk2, u8* unk3) {
int i = 0x20; int i = 0x20;
unk2 += unk>>4; unk2 += unk >> 4;
for (; i != 0; i--) { for (; i != 0; i--) {
DmaSet(3, unk2, unk3, 0x80000020); DmaSet(3, unk2, unk3, 0x80000020);
unk2 += 0x40; unk2 += 0x40;
@ -94,11 +88,11 @@ extern u32 gUnk_0200B650;
void sub_08058324(u32 unk) { void sub_08058324(u32 unk) {
gUnk_0200B650 = 0; gUnk_0200B650 = 0;
LoadPaletteGroup(unk+0x86); LoadPaletteGroup(unk + 0x86);
LoadGfxGroup(unk+0x36); LoadGfxGroup(unk + 0x36);
sub_080582D0(); sub_080582D0();
sub_080582A0(sub_08058244(unk),gUnk_02006F00,gUnk_02001A40); sub_080582A0(sub_08058244(unk), gUnk_02006F00, gUnk_02001A40);
gScreen.bg.bg1xOffset=0x1D47; gScreen.bg.bg1xOffset = 0x1D47;
gScreen.bg.unk_14 = gUnk_02001A40; gScreen.bg.unk_14 = gUnk_02001A40;
gScreen.bg.bg2yOffset = 1; gScreen.bg.bg2yOffset = 1;
gScreen.lcd.displayControl |= 0x200; gScreen.lcd.displayControl |= 0x200;

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) {
@ -33,10 +24,10 @@ void sub_08058398(ManagerA* this) {
if (CheckFlags(this->unk_3c) != 0) { if (CheckFlags(this->unk_3c) != 0) {
DeleteThisEntity(); DeleteThisEntity();
} }
this->unk_24 = this->unk_3a<<3; this->unk_24 = this->unk_3a << 3;
this->unk_26 = this->unk_3b<<3; this->unk_26 = this->unk_3b << 3;
this->unk_20 = this->unk_24 + (this->unk_38<<4); this->unk_20 = this->unk_24 + (this->unk_38 << 4);
this->unk_22 = this->unk_26 + (this->unk_39<<4); this->unk_22 = this->unk_26 + (this->unk_39 << 4);
sub_0805E3A0(&this->manager, 0x06); sub_0805E3A0(&this->manager, 0x06);
if (this->unk_3e == 0) { if (this->unk_3e == 0) {
this->manager.action = 2; this->manager.action = 2;
@ -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) {
@ -65,21 +55,25 @@ extern void sub_08078B48(void);
u32 sub_0805848C(ManagerA*); u32 sub_0805848C(ManagerA*);
void sub_080585DC(ManagerA*); 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,9 +89,8 @@ 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:
case 2: case 2:
case 3: case 3:
@ -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) {
@ -145,12 +137,13 @@ void sub_08058514(ManagerA* this) {
return; return;
case 0: case 0:
case 2: case 2:
if (((--this->manager.unk_0e)<<0x18) == 0) { if (((--this->manager.unk_0e) << 0x18) == 0) {
this->manager.unk_0d++; this->manager.unk_0d++;
} }
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,36 +10,33 @@
* 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*);
void sub_080585F0(Manager* this) { void sub_080585F0(Manager* this) {
//make a distincion if this is a controller (unk_0a = 0) or a helper (unk_0a = 1) // make a distincion if this is a controller (unk_0a = 0) or a helper (unk_0a = 1)
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*);
void ManagerB_Main(ManagerB* this) { void ManagerB_Main(ManagerB* this) {
//make a distinction based on the state of this controller // make a distinction based on the state of this controller
ManagerB_StateFuncs[this->manager.action](this); ManagerB_StateFuncs[this->manager.action](this);
} }
void ManagerB_LoadFight(Manager*); void ManagerB_LoadFight(Manager*);
void ManagerB_Init(ManagerB* this) { void ManagerB_Init(ManagerB* this) {
//check if the fight was already completed previously (checks the flag that gets set after the fight is done) // check if the fight was already completed previously (checks the flag that gets set after the fight is done)
if (!CheckFlags(this->unk_3e)) { if (!CheckFlags(this->unk_3e)) {
this->manager.action = WaitForFlag; this->manager.action = WaitForFlag;
//if there is no flag that needs to be set before the fight is started, start it immediately // if there is no flag that needs to be set before the fight is started, start it immediately
if (!this->unk_3c) { if (!this->unk_3c) {
ManagerB_LoadFight(&this->manager); ManagerB_LoadFight(&this->manager);
} }
@ -67,11 +64,12 @@ void ManagerB_WaitForFlag(ManagerB* this) {
extern void sub_0801855C(void); 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)
//set the completion flag for the fight return;
// 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)
if (this->unk_3c) { if (this->unk_3c) {
if (!this->unk_35) { if (!this->unk_35) {
gArea.musicIndex = this->unk_20; gArea.musicIndex = this->unk_20;
@ -96,10 +94,11 @@ void ManagerB_LoadFight(Manager* this) {
this->action = 2; this->action = 2;
this->unk_0e = 0; this->unk_0e = 0;
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)
prop = (EntityData*) GetCurrentRoomProperty(this->unk_0b); DeleteThisEntity();
prop = (EntityData*)GetCurrentRoomProperty(this->unk_0b);
if (prop) { if (prop) {
while (*((u8*)prop) != 0xFF) { while (*((u8*)prop) != 0xFF) {
ent = LoadRoomEntity(prop++); ent = LoadRoomEntity(prop++);
@ -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;
} }
} }
} }
@ -119,10 +119,10 @@ void ManagerB_LoadFight(Manager* this) {
/* /*
* Create a helper and increment the counter for the number of helpers (unk_0e). * Create a helper and increment the counter for the number of helpers (unk_0e).
* The helper will decrease said counter when it deletes itself (when none of the enemies it monitors remain). * The helper will decrease said counter when it deletes itself (when none of the enemies it monitors remain).
*/ */
ManagerBHelper* CreateHelper(Manager* this) { ManagerBHelper* CreateHelper(Manager* this) {
ManagerBHelper* extra; ManagerBHelper* extra;
extra = (ManagerBHelper*) GetEmptyManager(); extra = (ManagerBHelper*)GetEmptyManager();
if (extra) { if (extra) {
extra->manager.type = 9; extra->manager.type = 9;
extra->manager.subtype = 0xB; extra->manager.subtype = 0xB;
@ -136,51 +136,52 @@ ManagerBHelper* CreateHelper(Manager* this) {
} }
void ManagerBHelper_Monitor(ManagerBHelper* this, Entity* ent, u32 index) { void ManagerBHelper_Monitor(ManagerBHelper* this, Entity* ent, u32 index) {
this->enemies[index]=ent; this->enemies[index] = ent;
this->manager.unk_0e++; this->manager.unk_0e++;
} }
//case unk_0a is 1: The manager is a helper // case unk_0a is 1: The manager is a helper
void ManagerBHelper_Main(Manager* this) { void ManagerBHelper_Main(Manager* this) {
u8 i, anyRemaining; u8 i, anyRemaining;
Entity* current; Entity* current;
if (this->action == 0) { if (this->action == 0) {
this->action = 1; this->action = 1;
sub_0805E3A0(this,3); sub_0805E3A0(this, 3);
} }
//go through and check all monitored enemies. // go through and check all monitored enemies.
anyRemaining = 0; anyRemaining = 0;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
if ((current = ((ManagerBHelper*)this)->enemies[i])) { if ((current = ((ManagerBHelper*)this)->enemies[i])) {
if (!current->next) { if (!current->next) {
((ManagerBHelper*) this)->enemies[i] = 0; ((ManagerBHelper*)this)->enemies[i] = 0;
} else { } else {
anyRemaining = 1; anyRemaining = 1;
} }
} }
} }
if (!anyRemaining) { if (!anyRemaining) {
//inform the parent that we're done // inform the parent that we're done
if (((ManagerB*) this->parent)->manager.unk_0e) { if (((ManagerB*)this->parent)->manager.unk_0e) {
((ManagerB*) this->parent)->manager.unk_0e--; ((ManagerB*)this->parent)->manager.unk_0e--;
} }
DeleteThisEntity(); DeleteThisEntity();
} }
} }
extern Manager gUnk_03003DB0; extern Manager gUnk_03003DB0;
/* /*
* Replace an entity that is currently being monitored with a new one * Replace an entity that is currently being monitored with a new one
*/ */
void ReplaceMonitoredEntity(Entity* old, Entity* new) { 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

@ -27,7 +27,7 @@ void sub_08058E60(ManagerE* this) {
sub_08078A90(0xff); sub_08078A90(0xff);
sub_08078B48(); sub_08078B48();
} }
if (this->unk_3a == 0){ if (this->unk_3a == 0) {
if (this->unk_38 != 0) { if (this->unk_38 != 0) {
PlaySFX(this->unk_38); PlaySFX(this->unk_38);
} }

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*);
@ -304,22 +303,22 @@ switchD_08068d12_caseD_0:
*(u32*)&param_2->animationState = 1; *(u32*)&param_2->animationState = 1;
} }
//Introduction dialoague // Introduction dialoague
void sub_08068DB8(Entity* this) { void sub_08068DB8(Entity* this) {
TextboxNoOverlap(gUnk_08111664[this->actionDelay], this); TextboxNoOverlap(gUnk_08111664[this->actionDelay], this);
} }
//Ask to teach dialoague // Ask to teach dialoague
void sub_08068DD0(Entity* this) { void sub_08068DD0(Entity* this) {
TextboxNoOverlap(gUnk_0811167A[this->actionDelay], this); TextboxNoOverlap(gUnk_0811167A[this->actionDelay], this);
} }
//Technique Dialogue // Technique Dialogue
void sub_08068DE8(Entity* this) { void sub_08068DE8(Entity* this) {
TextboxNoOverlap(gUnk_08111690[this->actionDelay], this); TextboxNoOverlap(gUnk_08111690[this->actionDelay], this);
} }
//Posession dialogue // Posession dialogue
void sub_08068E00(Entity* this) { void sub_08068E00(Entity* this) {
TextboxNoOverlap(gUnk_081116A6[this->actionDelay], this); TextboxNoOverlap(gUnk_081116A6[this->actionDelay], this);
} }

View File

@ -8,25 +8,22 @@
#include "npc.h" #include "npc.h"
#include "structures.h" #include "structures.h"
extern void sub_0807DD50(Entity *); extern void sub_0807DD50(Entity*);
extern void sub_0807DD94(Entity *,u32); 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) {
this->frames.all = this->frames.all & 0xef; this->frames.all = this->frames.all & 0xef;
EnqueueSFX(0x104); EnqueueSFX(0x104);
sub_08080964(0x10,0); sub_08080964(0x10, 0);
} }
if ((this->frames.all & 0x20) != 0) { if ((this->frames.all & 0x20) != 0) {
this->frames.all = this->frames.all & 0xdf; this->frames.all = this->frames.all & 0xdf;

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

@ -8,19 +8,16 @@ extern u32 sub_0801E99C(Entity*);
extern void sub_08078784(Entity*, u32); extern void sub_08078784(Entity*, u32);
extern void sub_0807DD50(Entity*); extern void sub_0807DD50(Entity*);
extern void sub_0806F118(Entity*); extern void sub_0806F118(Entity*);
extern void ExecuteScriptCommandSet(Entity*, void *); extern void ExecuteScriptCommandSet(Entity*, void*);
extern void sub_0805FF2C(Entity*, void*); 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,17 +73,15 @@ 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) {
mgr = GetEmptyManager(); mgr = GetEmptyManager();
@ -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,15 +38,14 @@ 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;
this->actionDelay = 0xb4; this->actionDelay = 0xb4;
sub_0805E3A0(this, 2); sub_0805E3A0(this, 2);
sub_0806A8C8(this); sub_0806A8C8(this);
uVar1 = StartCutscene(this,&gUnk_08012F0C); uVar1 = StartCutscene(this, &gUnk_08012F0C);
*(u32 *)&this->cutsceneBeh = (u32)uVar1; *(u32*)&this->cutsceneBeh = (u32)uVar1;
sub_0807DD94(this, 0); sub_0807DD94(this, 0);
} }

View File

@ -9,47 +9,41 @@ typedef struct {
u32 unk; u32 unk;
} struct_0806C2A0; } struct_0806C2A0;
extern void DoExitTransition(void *); extern void DoExitTransition(void*);
extern void SetTileType(u32, u32, u32); extern void SetTileType(u32, u32, u32);
extern void DoExitTransition(void *); extern void DoExitTransition(void*);
extern void DoFade(u32, u32); 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,30 +15,27 @@ 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;
(this->entityType).form == 0 ? (paVar2 = &gUnk_081121B4) : (paVar2 = &gUnk_081121C4); (this->entityType).form == 0 ? (paVar2 = &gUnk_081121B4) : (paVar2 = &gUnk_081121C4);
iVar1 = LoadExtraSpriteData(this,paVar2); iVar1 = LoadExtraSpriteData(this, paVar2);
if (iVar1) { if (iVar1) {
this->action = 1; this->action = 1;
sub_0805E3A0(this,2); sub_0805E3A0(this, 2);
sub_0807DD50(this); sub_0807DD50(this);
InitializeAnimation(this,0); InitializeAnimation(this, 0);
} }
} }
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

@ -1,13 +1,13 @@
#include "global.h" #include "global.h"
#include "entity.h" #include "entity.h"
extern void sub_0805E3A0(Entity *, u32); extern void sub_0805E3A0(Entity*, u32);
extern void ResolveEntityOnTop(Entity *, Entity *); extern void ResolveEntityOnTop(Entity*, Entity*);
extern BoundingBox gUnk_0810C3C0; extern BoundingBox gUnk_0810C3C0;
extern void sub_0807DD64(Entity *); extern void sub_0807DD64(Entity*);
extern void sub_0807DD94(Entity *, u32); extern void sub_0807DD94(Entity*, u32);
void Wheaton(Entity *this) { void Wheaton(Entity* this) {
if (this->action == 0) { if (this->action == 0) {
this->action++; this->action++;

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

@ -19,8 +19,8 @@ void sub_08081AE0(Entity* this) {
if (this->cutsceneBeh.HWORD != 0) { if (this->cutsceneBeh.HWORD != 0) {
this->collisionLayer = this->cutsceneBeh.HWORD; this->collisionLayer = this->cutsceneBeh.HWORD;
} }
this->field_0x74.HWORD = (((this->x.HALF.HI - gRoomControls.roomOriginX)>>4) & 0x3F) | this->field_0x74.HWORD = (((this->x.HALF.HI - gRoomControls.roomOriginX) >> 4) & 0x3F) |
((((this->y.HALF.HI - gRoomControls.roomOriginY)>>4) & 0x3F) << 6); ((((this->y.HALF.HI - gRoomControls.roomOriginY) >> 4) & 0x3F) << 6);
this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer); this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
if (this->entityType.form == 0 && CheckFlags(this->field_0x86.HWORD)) { if (this->entityType.form == 0 && CheckFlags(this->field_0x86.HWORD)) {
this->action = 5; this->action = 5;
@ -36,7 +36,7 @@ void sub_08081AE0(Entity* this) {
void sub_08081B84(Entity* this) { void sub_08081B84(Entity* this) {
if (sub_08081E3C(this)) { if (sub_08081E3C(this)) {
this->action=2; this->action = 2;
this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer); this->field_0x70.HALF.HI = GetTileType(this->field_0x74.HWORD, this->collisionLayer);
} }
} }
@ -167,7 +167,7 @@ Entity* sub_08081D74(Entity* this) {
} }
} }
} }
this->attachedEntity=ent; this->attachedEntity = ent;
return ent; return ent;
} }
@ -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;
} }
@ -203,10 +204,10 @@ extern u16 gMapDataTopSpecial[0x2000];
void sub_08081E6C(Entity* this) { void sub_08081E6C(Entity* this) {
u32 r4; u32 r4;
u16 *tmp, *r1; u16 *tmp, *r1;
u8 *tmp2; u8* tmp2;
u32 r6 = this->field_0x74.HWORD; u32 r6 = this->field_0x74.HWORD;
u32 r5 = this->collisionLayer; u32 r5 = this->collisionLayer;
u32 tile = GetTileType(r6,r5); u32 tile = GetTileType(r6, r5);
if (tile < 0x4000) if (tile < 0x4000)
return; return;
r1 = GetLayerByIndex(r5); r1 = GetLayerByIndex(r5);
@ -215,11 +216,11 @@ void sub_08081E6C(Entity* this) {
r1 += 0x3002 + r4; r1 += 0x3002 + r4;
tmp = tmp + (*r1 << 2); tmp = tmp + (*r1 << 2);
tmp2 = (r5 == 2 ? gMapDataTopSpecial : (u8*)&gUnk_02019EE0); tmp2 = (r5 == 2 ? gMapDataTopSpecial : (u8*)&gUnk_02019EE0);
tmp2 += (((0x3f & r6)<<1)+((0xfc0 & r6)<<2))<<1; tmp2 += (((0x3f & r6) << 1) + ((0xfc0 & r6) << 2)) << 1;
if (sub_08081F00((u32*)tmp2, (u32*)tmp)) if (sub_08081F00((u32*)tmp2, (u32*)tmp))
return; return;
SetTileType(r4, r6, r5); SetTileType(r4, r6, r5);
SetTile(tile,r6,r5); SetTile(tile, r6, r5);
} }
#else #else
NAKED NAKED
@ -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,9 +254,10 @@ 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;
} else { } else {
if (this->actionDelay == 6) { if (this->actionDelay == 6) {
@ -275,12 +279,13 @@ 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++) {
if (gUnk_03004040[i]) { if (gUnk_03004040[i]) {
sub_080044AE(gUnk_03004040[i],0x200, direction); sub_080044AE(gUnk_03004040[i], 0x200, direction);
} }
} }
} }

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;
} }

View File

@ -5,7 +5,7 @@
void FloatingBlock(Entity* this) { void FloatingBlock(Entity* this) {
if (this->action == 0) { if (this->action == 0) {
this->action = 1; this->action = 1;
this->frameIndex=this->entityType.form; this->frameIndex = this->entityType.form;
this->spritePriority.b0 = 0xe; this->spritePriority.b0 = 0xe;
this->collisionLayer = 1; this->collisionLayer = 1;
UpdateSpriteForCollisionLayer(this); UpdateSpriteForCollisionLayer(this);

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

@ -11,7 +11,7 @@ typedef struct {
/*0x05*/ u8 unk5; /*0x05*/ u8 unk5;
/*0x06*/ u8 unk6; /*0x06*/ u8 unk6;
/*0x07*/ u8 unk7; /*0x07*/ u8 unk7;
/*0x08*/ u8 *unk8; /*0x08*/ u8* unk8;
} unk_DoorProperty; } unk_DoorProperty;
typedef struct { typedef struct {
@ -42,7 +42,7 @@ void sub_080866D8(Entity* this) {
if (this->action == 0) { if (this->action == 0) {
this->action = 1; this->action = 1;
*((u32 *)(&this->field_0x68)) = 0; *((u32*)(&this->field_0x68)) = 0;
this->field_0x6c.HALF.LO = this->actionDelay; this->field_0x6c.HALF.LO = this->actionDelay;
sub_0805E3A0(this, 6); sub_0805E3A0(this, 6);
} }
@ -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) {
@ -64,9 +63,9 @@ void sub_080866D8(Entity* this) {
entity->collisionLayer = prop->unk4; entity->collisionLayer = prop->unk4;
entity->previousActionFlag = prop->unk5; entity->previousActionFlag = prop->unk5;
UpdateSpriteForCollisionLayer(entity); UpdateSpriteForCollisionLayer(entity);
*((u32 *)(&this->field_0x68)) |= mask; *((u32*)(&this->field_0x68)) |= mask;
if (prop->unk8) { if (prop->unk8) {
*((u32 **)(&entity->cutsceneBeh)) = StartCutscene(entity, prop->unk8); *((u32**)(&entity->cutsceneBeh)) = StartCutscene(entity, prop->unk8);
} }
} }
} }
@ -85,7 +84,7 @@ static bool32 sub_080867CC(u32 arg0) {
void sub_080867E4(Entity* this) { void sub_080867E4(Entity* this) {
if (!sub_080562CC(this->field_0x68.HWORD, this->field_0x6a.HWORD, 32, 32)) { if (!sub_080562CC(this->field_0x68.HWORD, this->field_0x6a.HWORD, 32, 32)) {
*((u32 *)(&this->parent->field_0x68)) = *((u32 *)(&this->parent->field_0x68)) & ~(1 << this->field_0x6c.HALF.LO); *((u32*)(&this->parent->field_0x68)) = *((u32*)(&this->parent->field_0x68)) & ~(1 << this->field_0x6c.HALF.LO);
DeleteThisEntity(); DeleteThisEntity();
} }
sub_0808681C(this); sub_0808681C(this);
@ -118,8 +117,8 @@ static void sub_0808681C(Entity* this) {
} }
if (this->flags & 0x2) { if (this->flags & 0x2) {
ExecuteScriptCommandSet(this, *(u32 **)&this->cutsceneBeh); ExecuteScriptCommandSet(this, *(u32**)&this->cutsceneBeh);
sub_080868EC(this, *(void **)&this->cutsceneBeh); sub_080868EC(this, *(void**)&this->cutsceneBeh);
} }
} }
@ -130,8 +129,8 @@ void sub_080868B0(Entity* this) {
this->boundingBox = &gUnk_081206AC; this->boundingBox = &gUnk_081206AC;
this->actionDelay = 8; this->actionDelay = 8;
} }
ExecuteScriptCommandSet(this, *(u32 **)&this->cutsceneBeh); ExecuteScriptCommandSet(this, *(u32**)&this->cutsceneBeh);
sub_080868EC(this, *(void **)&this->cutsceneBeh); sub_080868EC(this, *(void**)&this->cutsceneBeh);
} }
static void sub_080868EC(Entity* entity, unk_80868EC* arg1) { static void sub_080868EC(Entity* entity, unk_80868EC* arg1) {
@ -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,20 +11,17 @@ 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);
} }
this->spriteSettings.b.draw = 3; // ??? this->spriteSettings.b.draw = 3; // ???
@ -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,11 +45,11 @@ 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;
if (arg1 == 1) { if (arg1 == 1) {

View File

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

View File

@ -8,10 +8,9 @@ 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;
if (this->action == 0) { if (this->action == 0) {
this->action = 1; this->action = 1;
@ -26,17 +25,16 @@ void LilypadSmall(Entity *this)
} }
sub_080A2BE4(this, sub_08097ADC(this)); sub_080A2BE4(this, sub_08097ADC(this));
sub_08097B24(this); sub_08097B24(this);
psVar4 = (u16 *)&this->field_0x70; psVar4 = (u16*)&this->field_0x70;
if (--*psVar4 == 0) { if (--*psVar4 == 0) {
sub_080A2CC0(this, &this->attachedEntity, psVar4); sub_080A2CC0(this, &this->attachedEntity, psVar4);
} }
} }
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) {
return 0; return 0;
} else if (sub_08079F8C() == 0) { } else if (sub_08079F8C() == 0) {
return 0; return 0;
@ -50,11 +48,10 @@ 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;
if (--this->actionDelay == 0) { if (--this->actionDelay == 0) {
this->actionDelay = 0x5a; this->actionDelay = 0x5a;

View File

@ -6,7 +6,7 @@
extern Entity gPlayerEntity; extern Entity gPlayerEntity;
extern u16 gScreenTransition[]; extern u16 gScreenTransition[];
extern void (*MaskActionFuncs[])(Entity *); extern void (*MaskActionFuncs[])(Entity*);
extern void DeleteThisEntity(); extern void DeleteThisEntity();
@ -21,15 +21,14 @@ extern s16 sub_080001DA(u16, u32);
extern u16 sub_080002E0(u16, u32); extern u16 sub_080002E0(u16, u32);
extern void EnqueueSFX(u32); 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);
} }
void sub_080929A4(Entity *this) { void sub_080929A4(Entity* this) {
if (this->entityType.parameter & 0xC0) { if (this->entityType.parameter & 0xC0) {
if (CheckFlags(this->field_0x86.HWORD)) { if (CheckFlags(this->field_0x86.HWORD)) {
s32 field_0x0a; s32 field_0x0a;
@ -74,7 +73,7 @@ void sub_080929A4(Entity *this) {
} }
// Probably related to knocking it down // Probably related to knocking it down
void sub_08092A94(Entity *this) { void sub_08092A94(Entity* this) {
// Check for the first frame of bonking animation // Check for the first frame of bonking animation
if (gPlayerEntity.action != 6) { if (gPlayerEntity.action != 6) {
return; return;
@ -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;
} }
@ -107,26 +107,23 @@ void sub_08092A94(Entity *this) {
} }
// Probably falling down // Probably falling down
void sub_08092B0C(Entity *this) { void sub_08092B0C(Entity* this) {
if (this->actionDelay == 1) { if (this->actionDelay == 1) {
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) {
@ -135,6 +132,6 @@ void sub_08092B0C(Entity *this) {
} }
} }
void Mask_Delete(Entity *this) { void Mask_Delete(Entity* this) {
DeleteThisEntity(); DeleteThisEntity();
} }

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,10 +47,9 @@ void sub_080A0718(Entity *this)
} }
} }
void sub_080A074C(Entity *this) void sub_080A074C(Entity* this) {
{
u8 bVar1; u8 bVar1;
Entity *ent; Entity* ent;
sub_0806F69C(this); sub_0806F69C(this);
@ -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);

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