From 31f324e3a7e4d0dec27d85ee6b50a42ec6df8f7b Mon Sep 17 00:00:00 2001 From: theo3 Date: Fri, 19 Feb 2021 15:03:20 -0800 Subject: [PATCH] clang-format pass and workflow --- .github/workflows/lint_pr.yml | 2 +- include/audio.h | 4 +- include/functions.h | 8 +- include/gba/macro.h | 11 +- include/gba/syscall.h | 15 +- include/manager.h | 1 - include/npc.h | 1 - include/save.h | 2 +- include/script.h | 4 +- src/arm_proxy.c | 21 +- src/enemy/gyorgMale.c | 414 +++++++++++++-------------------- src/fileScreen.c | 3 +- src/item14.c | 42 ++-- src/manager.c | 67 +----- src/manager/manager1E.c | 14 +- src/manager/manager26.c | 12 +- src/manager/manager27.c | 11 +- src/manager/manager28.c | 61 +++-- src/manager/manager39.c | 35 +-- src/manager/managerC.c | 106 +++------ src/npc/festari.c | 2 +- src/object/houseDoorExterior.c | 6 +- src/player.c | 10 +- src/playerItem.c | 29 +-- src/save.c | 140 +++++------ src/screenDebug.c | 2 +- src/script.c | 228 +++++------------- 27 files changed, 461 insertions(+), 790 deletions(-) diff --git a/.github/workflows/lint_pr.yml b/.github/workflows/lint_pr.yml index 7afa3866..1a313769 100644 --- a/.github/workflows/lint_pr.yml +++ b/.github/workflows/lint_pr.yml @@ -7,5 +7,5 @@ jobs: - uses: actions/checkout@v2 - uses: DoozyX/clang-format-lint-action@v0.8 with: - source: 'src, include' + source: './src ./include' clangFormatVersion: 10 diff --git a/include/audio.h b/include/audio.h index 3690de89..0f1a1b40 100644 --- a/include/audio.h +++ b/include/audio.h @@ -145,7 +145,7 @@ typedef enum { SFX_VO_MINISH2, SFX_VO_MINISH3, SFX_VO_MINISH4, - + SFX_REM_SLEEP = 0xCC, SFX_TASK_COMPLETE, SFX_KEY_APPEAR, @@ -183,7 +183,7 @@ typedef enum { SFX_APPARATE, SFX_F8, SFX_TELEPORTER, - + SFX_ITEM_BOMB_EXPLODE = 0xFD, SFX_HIT, diff --git a/include/functions.h b/include/functions.h index f3213239..9e8b7d0b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -284,10 +284,10 @@ extern void sub_0801E00C(); extern void sub_08050038(u32); extern void sub_080500F4(u32); extern void sub_08050110(u32, u32, u32, u32); -extern u32 sub_08052734(); //has Dungeon Map? -extern u32 sub_08052764(); //has Dungeon Compass? -extern u32 sub_0805279C(); //has Dungeon Big Key? -extern u32 sub_080527CC(); //num Dungeon small keys? +extern u32 sub_08052734(); // has Dungeon Map? +extern u32 sub_08052764(); // has Dungeon Compass? +extern u32 sub_0805279C(); // has Dungeon Big Key? +extern u32 sub_080527CC(); // num Dungeon small keys? extern u32 sub_08053FE0(); extern void sub_08078790(Entity*, u32); extern void sub_080788E0(Entity*); diff --git a/include/gba/macro.h b/include/gba/macro.h index 2fa1abb2..b08ed921 100644 --- a/include/gba/macro.h +++ b/include/gba/macro.h @@ -167,11 +167,12 @@ #define DmaClear16Defvars(dmaNum, dest, size) DmaClearDefvars(dmaNum, dest, size, 16) #define DmaClear32Defvars(dmaNum, dest, size) DmaClearDefvars(dmaNum, dest, size, 32) -#define DmaWait(DmaNo) \ -{ \ - vu32 *(DmaCntp) = (vu32 *)REG_ADDR_DMA##DmaNo; \ - while (DmaCntp[2] & (DMA_ENABLE << 16)) ; \ -} +#define DmaWait(DmaNo) \ + { \ + vu32*(DmaCntp) = (vu32*)REG_ADDR_DMA##DmaNo; \ + while (DmaCntp[2] & (DMA_ENABLE << 16)) \ + ; \ + } #define IntrEnable(flags) \ { \ diff --git a/include/gba/syscall.h b/include/gba/syscall.h index d319a9fe..0c07bcbb 100644 --- a/include/gba/syscall.h +++ b/include/gba/syscall.h @@ -11,17 +11,18 @@ #define RESET_REGS 0x80 #define RESET_ALL 0xFF -#define SystemCall(x) { asm("svc " #x); } +#define SystemCall(x) \ + { asm("svc " #x); } extern void SoundBiasReset(); extern void SoundBiasSet(); -#define Stop() \ -{ \ - SoundBiasReset(); \ - SystemCall(3); \ - SoundBiasSet(); \ -} +#define Stop() \ + { \ + SoundBiasReset(); \ + SystemCall(3); \ + SoundBiasSet(); \ + } void SoftReset(u32 resetFlags); diff --git a/include/manager.h b/include/manager.h index a0d8eb1c..f292baf2 100644 --- a/include/manager.h +++ b/include/manager.h @@ -193,5 +193,4 @@ extern void sub_0805E0FC(); void (*const gManagerFunctions[58])(); - #endif diff --git a/include/npc.h b/include/npc.h index 024a9a43..b27a82f9 100644 --- a/include/npc.h +++ b/include/npc.h @@ -172,7 +172,6 @@ extern void NPC58_Head(Entity*); extern u32 UpdateFuseInteraction(Entity*); - void (*const gNPCFunctions[128][3])(Entity*); #endif diff --git a/include/save.h b/include/save.h index 83ef1e3f..eaf1eaf5 100644 --- a/include/save.h +++ b/include/save.h @@ -11,7 +11,7 @@ typedef enum { SAVE_BUSY = 0, - SAVE_OK = 1, + SAVE_OK = 1, SAVE_ERROR = -1, } SaveResult; diff --git a/include/script.h b/include/script.h index 93b7554c..9abc5291 100644 --- a/include/script.h +++ b/include/script.h @@ -31,6 +31,6 @@ extern void StartPlayerScript(u16*); extern void sub_0807DEDC(Entity*, ScriptExecutionContext*, u32, u32); extern ScriptExecutionContext* StartCutscene(Entity*, u16*); -extern void sub_0807DDAC(Entity*, void(*function)(Entity*, ScriptExecutionContext*)); -extern void sub_0807DD94(Entity*, void(*function)(Entity*, ScriptExecutionContext*)); +extern void sub_0807DDAC(Entity*, void (*function)(Entity*, ScriptExecutionContext*)); +extern void sub_0807DD94(Entity*, void (*function)(Entity*, ScriptExecutionContext*)); #endif diff --git a/src/arm_proxy.c b/src/arm_proxy.c index aebfa3f2..a0dc1c24 100644 --- a/src/arm_proxy.c +++ b/src/arm_proxy.c @@ -286,7 +286,7 @@ void sub_080171F0(void) { } } -void sub_08017338(Entity *this) { +void sub_08017338(Entity* this) { if (!(this->flags & 1) && !this->action && !this->previousActionFlag) sub_080173A4(this); @@ -338,7 +338,7 @@ END_NONMATCH void sub_080174A4(Entity* this) { int iVar1; - + if (((this->flags & 1) == 0) && (this->action == 0)) { sub_080A2838(this); } @@ -359,8 +359,7 @@ void sub_08017508(Entity* this) { // regalloc NONMATCH("asm/non_matching/arm_proxy/sub_08017530.inc", void sub_08017530(Entity* this)) { - if ((this->currentHealth & 0x7f) && - !ReadBit(&gUnk_020342F8, this->currentHealth - 1)) { + if ((this->currentHealth & 0x7f) && !ReadBit(&gUnk_020342F8, this->currentHealth - 1)) { DeleteThisEntity(); } if ((this->action == 0) && ((this->flags & 1) == 0)) { @@ -392,7 +391,7 @@ void sub_080175F4(void) { u32 temp; void (*func)(void); - + temp = gUnk_03003DC0.unk0; if (gUnk_03003DC0.unk0 <= gUnk_03003DC0.unk1) temp = gUnk_03003DC0.unk1; @@ -411,7 +410,7 @@ void sub_080175F4(void) { } void sub_08017640(void) { - _DmaZero(&gUnk_03003C70,0x100); + _DmaZero(&gUnk_03003C70, 0x100); gUnk_02018EA0 = (LinkedList2*)&gUnk_03003C70[0].last; gUnk_03003C70[0].last = &gUnk_03003C70[0].last; gUnk_03003C70[0].first = &gUnk_03003C70[0].last; @@ -426,7 +425,7 @@ NONMATCH("asm/non_matching/arm_proxy/sub_0801766C.inc", u32 sub_0801766C(Entity* LinkedList2* pLVar2; LinkedList2* i; u8* pbVar4; - + if (this->spritePriority.b2 != 0) { return 1; } else { @@ -513,16 +512,18 @@ END_NONMATCH NONMATCH("asm/non_matching/arm_proxy/sub_080177A0.inc", bool32 sub_080177A0(Entity* this, Entity* that)) { u32 this_d; u32 depth; - + if ((that->collisionLayer & this->collisionLayer) != 0) { BoundingBox* bb_this = this->boundingBox; BoundingBox* bb_that = that->boundingBox; u32 this_w = bb_this->width; u32 that_w = bb_that->width; - if ((((this->x.HALF.HI - that->x.HALF.HI) + bb_this->offset_x) - bb_that->offset_x) + this_w + that_w <= (this_w + that_w) * 2) { + if ((((this->x.HALF.HI - that->x.HALF.HI) + bb_this->offset_x) - bb_that->offset_x) + this_w + that_w <= + (this_w + that_w) * 2) { u32 this_h = bb_this->height; u32 that_h = bb_that->height; - if ((((this->y.HALF.HI - that->y.HALF.HI) + bb_this->offset_y) - bb_that->offset_y) + this_h + that_h <= (this_h + that_h) * 2) { + if ((((this->y.HALF.HI - that->y.HALF.HI) + bb_this->offset_y) - bb_that->offset_y) + this_h + that_h <= + (this_h + that_h) * 2) { if ((this->field_0x3c & 0x10) != 0) this_d = ((BoundingBox3D*)bb_this)->depth; else diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c index 5301647f..56091980 100644 --- a/src/enemy/gyorgMale.c +++ b/src/enemy/gyorgMale.c @@ -7,19 +7,19 @@ #include "functions.h" #include "fileScreen.h" -void (* const gUnk_080D1AFC[8])(Entity*); -void (* const gUnk_080D1B1C[7])(Entity*); -void (* const gUnk_080D1B38[5])(Entity*); -void (* const gUnk_080D1B4C[5])(Entity*); +void (*const gUnk_080D1AFC[8])(Entity*); +void (*const gUnk_080D1B1C[7])(Entity*); +void (*const gUnk_080D1B38[5])(Entity*); +void (*const gUnk_080D1B4C[5])(Entity*); const u16 gUnk_080D1B60[8]; -const s16 gUnk_080D1B70[2];//or 3? +const s16 gUnk_080D1B70[2]; // or 3? const u16 gUnk_080D1B74[0x10]; -void (* const gUnk_080D1B94[0xA])(Entity*); +void (*const gUnk_080D1B94[0xA])(Entity*); const u16 gUnk_080D1BBC[2]; -void (* const gUnk_080D1BC0[7])(Entity*); -void (* const gUnk_080D1BDC[5])(Entity*); +void (*const gUnk_080D1BC0[7])(Entity*); +void (*const gUnk_080D1BDC[5])(Entity*); const s16 gUnk_080D1BF0[2]; -void (* const gUnk_080D1BF4[3])(Entity*); +void (*const gUnk_080D1BF4[3])(Entity*); const s8 gUnk_080D1C00[4]; const u16 gUnk_080D1C04[0x20]; const u8 gUnk_080D1C44[0xC]; @@ -27,77 +27,69 @@ const u16 gUnk_080D1C50[8]; const u16 gUnk_080D1C60[8]; void GyorgMale(Entity*); -void sub_08046898(Entity*);//action 0 -void sub_08046910(Entity*);//action 1 -void sub_08046930(Entity*);//action 1 previousActionFlag 0 -void sub_0804696C(Entity*);//action 1 previousActionFlag 1 -void sub_080469CC(Entity*);//action 1 previousActionFlag 2 -void sub_080469F4(Entity*);//action 1 previousActionFlag 3 -void sub_08046A30(Entity*);//action 1 previousActionFlag 4 -void sub_08046A54(Entity*);//action 1 previousActionFlag 5 -void sub_08046A78(Entity*);//action 1 previousActionFlag 6 -void sub_08046A9C(Entity*);//action 2 -void sub_08046AE8(Entity*);//action 2 previousActionFlag 0 -void sub_08046B18(Entity*);//action 2 previousActionFlag 1 -void sub_08046B8C(Entity*);//action 2 previousActionFlag 2 -void sub_08046C04(Entity*);//action 2 previousActionFlag 3 -void sub_08046C88(Entity*);//action 2 previousActionFlag 4 -void sub_08046CEC(Entity*);//action 3 -void sub_08046D44(Entity*);//action 3 previousActionFlag 0 -void sub_08046D98(Entity*);//action 3 previousActionFlag 1 -void sub_08046E0C(Entity*);//action 3 previousActionFlag 2 -void sub_08046E68(Entity*);//action 3 previousActionFlag 3 -void sub_08046EF4(Entity*);//action 3 previousActionFlag 4 -void sub_08046F64(Entity*);//action 4 -void sub_08046FE8(Entity*);//action 4 previousActionFlag 0 -void sub_0804702C(Entity*);//action 4 previousActionFlag 1 -void sub_080470B4(Entity*);//action 4 previousActionFlag 2 -void sub_08047140(Entity*);//action 4 previousActionFlag 3 -void sub_0804717C(Entity*);//action 4 previousActionFlag 4 -void sub_080471C8(Entity*);//action 4 previousActionFlag 5 -void sub_0804723C(Entity*);//action 4 previousActionFlag 6 -void sub_08047284(Entity*);//action 4 previousActionFlag 7 -void sub_080472BC(Entity*);//action 4 previousActionFlag 8 -void sub_08047310(Entity*);//action 4 previousActionFlag 9 -void sub_0804736C(Entity*);//action 5 -void sub_080473B8(Entity*);//action 5 previousActionFlag 0 -void sub_080473F0(Entity*);//action 5 previousActionFlag 1 -void sub_08047484(Entity*);//action 5 previousActionFlag 2 -void sub_08047508(Entity*);//action 5 previousActionFlag 3 -void sub_080475F4(Entity*);//action 5 previousActionFlag 4 -void sub_0804763C(Entity*);//action 5 previousActionFlag 5 -void sub_0804772C(Entity*);//action 5 previousActionFlag 6 -void sub_08047778(Entity*);//action 6 -void sub_08047798(Entity*);//action 6 previousActionFlag 0 -void sub_080477F0(Entity*);//action 6 previousActionFlag 1 -void sub_08047914(Entity*);//action 6 previousActionFlag 2 -void sub_08047978(Entity*);//action 6 previousActionFlag 3 -void sub_08047B08(Entity*);//action 6 previousActionFlag 4 -void sub_08047B84(Entity*);//action 7 -void sub_08047BA4(Entity*);//action 7 previousActionFlag 0 -void sub_08047BF0(Entity*);//action 7 previousActionFlag 1, also called elsewhere -void sub_08047D24(Entity*);//action 7 previousActionFlag 2 -void sub_08047D88(Entity*);// +void sub_08046898(Entity*); // action 0 +void sub_08046910(Entity*); // action 1 +void sub_08046930(Entity*); // action 1 previousActionFlag 0 +void sub_0804696C(Entity*); // action 1 previousActionFlag 1 +void sub_080469CC(Entity*); // action 1 previousActionFlag 2 +void sub_080469F4(Entity*); // action 1 previousActionFlag 3 +void sub_08046A30(Entity*); // action 1 previousActionFlag 4 +void sub_08046A54(Entity*); // action 1 previousActionFlag 5 +void sub_08046A78(Entity*); // action 1 previousActionFlag 6 +void sub_08046A9C(Entity*); // action 2 +void sub_08046AE8(Entity*); // action 2 previousActionFlag 0 +void sub_08046B18(Entity*); // action 2 previousActionFlag 1 +void sub_08046B8C(Entity*); // action 2 previousActionFlag 2 +void sub_08046C04(Entity*); // action 2 previousActionFlag 3 +void sub_08046C88(Entity*); // action 2 previousActionFlag 4 +void sub_08046CEC(Entity*); // action 3 +void sub_08046D44(Entity*); // action 3 previousActionFlag 0 +void sub_08046D98(Entity*); // action 3 previousActionFlag 1 +void sub_08046E0C(Entity*); // action 3 previousActionFlag 2 +void sub_08046E68(Entity*); // action 3 previousActionFlag 3 +void sub_08046EF4(Entity*); // action 3 previousActionFlag 4 +void sub_08046F64(Entity*); // action 4 +void sub_08046FE8(Entity*); // action 4 previousActionFlag 0 +void sub_0804702C(Entity*); // action 4 previousActionFlag 1 +void sub_080470B4(Entity*); // action 4 previousActionFlag 2 +void sub_08047140(Entity*); // action 4 previousActionFlag 3 +void sub_0804717C(Entity*); // action 4 previousActionFlag 4 +void sub_080471C8(Entity*); // action 4 previousActionFlag 5 +void sub_0804723C(Entity*); // action 4 previousActionFlag 6 +void sub_08047284(Entity*); // action 4 previousActionFlag 7 +void sub_080472BC(Entity*); // action 4 previousActionFlag 8 +void sub_08047310(Entity*); // action 4 previousActionFlag 9 +void sub_0804736C(Entity*); // action 5 +void sub_080473B8(Entity*); // action 5 previousActionFlag 0 +void sub_080473F0(Entity*); // action 5 previousActionFlag 1 +void sub_08047484(Entity*); // action 5 previousActionFlag 2 +void sub_08047508(Entity*); // action 5 previousActionFlag 3 +void sub_080475F4(Entity*); // action 5 previousActionFlag 4 +void sub_0804763C(Entity*); // action 5 previousActionFlag 5 +void sub_0804772C(Entity*); // action 5 previousActionFlag 6 +void sub_08047778(Entity*); // action 6 +void sub_08047798(Entity*); // action 6 previousActionFlag 0 +void sub_080477F0(Entity*); // action 6 previousActionFlag 1 +void sub_08047914(Entity*); // action 6 previousActionFlag 2 +void sub_08047978(Entity*); // action 6 previousActionFlag 3 +void sub_08047B08(Entity*); // action 6 previousActionFlag 4 +void sub_08047B84(Entity*); // action 7 +void sub_08047BA4(Entity*); // action 7 previousActionFlag 0 +void sub_08047BF0(Entity*); // action 7 previousActionFlag 1, also called elsewhere +void sub_08047D24(Entity*); // action 7 previousActionFlag 2 +void sub_08047D88(Entity*); // void sub_08047DF0(Entity*, u32); -void sub_08047E48(Entity*);// -void sub_08047E58(Entity*);// +void sub_08047E48(Entity*); // +void sub_08047E58(Entity*); // void sub_08047EA4(Entity*, u32); -u32 sub_08047F68(Entity*);//distance this to player? -void sub_08048004(Entity*);// -void sub_0804813C(Entity*);// +u32 sub_08047F68(Entity*); // distance this to player? +void sub_08048004(Entity*); // +void sub_0804813C(Entity*); // u32 sub_08048158(u32); void sub_08048178(Entity*, u32); -void (* const gUnk_080D1AFC[8])(Entity*) = { - sub_08046898, - sub_08046910, - sub_08046A9C, - sub_08046CEC, - sub_08046F64, - sub_0804736C, - sub_08047778, - sub_08047B84 -}; +void (*const gUnk_080D1AFC[8])(Entity*) = { sub_08046898, sub_08046910, sub_08046A9C, sub_08046CEC, + sub_08046F64, sub_0804736C, sub_08047778, sub_08047B84 }; void GyorgMale(Entity* this) { if (this->action) { @@ -120,7 +112,8 @@ void GyorgMale(Entity* this) { void sub_08046898(Entity* this) { Entity* tmp = sub_080A7EE0(0x22); u32 tmp2; - if (!tmp) return; + if (!tmp) + return; tmp->entityType.form = 1; tmp->parent = this; this->attachedEntity = tmp; @@ -139,15 +132,8 @@ void sub_08046898(Entity* this) { InitAnimationForceUpdate(this, 0); } -void (* const gUnk_080D1B1C[7])(Entity*) = { - sub_08046930, - sub_0804696C, - sub_080469CC, - sub_080469F4, - sub_08046A30, - sub_08046A54, - sub_08046A78 -}; +void (*const gUnk_080D1B1C[7])(Entity*) = { sub_08046930, sub_0804696C, sub_080469CC, sub_080469F4, + sub_08046A30, sub_08046A54, sub_08046A78 }; void sub_08046910(Entity* this) { gUnk_080D1B1C[this->previousActionFlag](this); @@ -161,7 +147,8 @@ void sub_08046930(Entity* this) { this->nonPlanarMovement = 0x280; } sub_08047D88(this); - if (this->field_0x7c.BYTES.byte0 == 0) return; + if (this->field_0x7c.BYTES.byte0 == 0) + return; this->previousActionFlag = 1; this->actionDelay = 1; this->animationState = 0; @@ -206,7 +193,7 @@ void sub_080469F4(Entity* this) { void sub_08046A30(Entity* this) { sub_08047D88(this); - if (((Entity*) this->otherEntity)->prev->field_0x6c.HWORD & 1) { + if (((Entity*)this->otherEntity)->prev->field_0x6c.HWORD & 1) { this->action = 2; this->previousActionFlag = 0; } @@ -221,19 +208,13 @@ void sub_08046A54(Entity* this) { void sub_08046A78(Entity* this) { sub_08047D88(this); - if (((Entity*) this->otherEntity)->prev->field_0x6c.HWORD & 0x10) { + if (((Entity*)this->otherEntity)->prev->field_0x6c.HWORD & 0x10) { this->action = 3; this->previousActionFlag = 0; } } -void (* const gUnk_080D1B38[5])(Entity*) = { - sub_08046AE8, - sub_08046B18, - sub_08046B8C, - sub_08046C04, - sub_08046C88 -}; +void (*const gUnk_080D1B38[5])(Entity*) = { sub_08046AE8, sub_08046B18, sub_08046B8C, sub_08046C04, sub_08046C88 }; void sub_08046A9C(Entity* this) { if (this->animIndex == 1) { @@ -252,7 +233,7 @@ void sub_08046A9C(Entity* this) { void sub_08046AE8(Entity* this) { this->previousActionFlag = 1; this->nonPlanarMovement = 0x180; - sub_08048178(this, ((Entity*) this->otherEntity)->next->animationState >> 5); + sub_08048178(this, ((Entity*)this->otherEntity)->next->animationState >> 5); this->field_0x76.HWORD = this->direction << 8; sub_08047D88(this); } @@ -281,7 +262,8 @@ void sub_08046B8C(Entity* this) { this->field_0x82.HWORD = gRoomControls.roomOriginY + 0x210; sub_08047D88(this); } else { - this->direction = sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI); + this->direction = + sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI); sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8); } } @@ -309,18 +291,13 @@ void sub_08046C88(Entity* this) { sub_08048178(this, sub_08048158(this->field_0x70.HALF_U.LO)); sub_08047D88(this); } else { - this->direction = sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI); + this->direction = + sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI); sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8); } } -void (* const gUnk_080D1B4C[5])(Entity*) = { - sub_08046D44, - sub_08046D98, - sub_08046E0C, - sub_08046E68, - sub_08046EF4 -}; +void (*const gUnk_080D1B4C[5])(Entity*) = { sub_08046D44, sub_08046D98, sub_08046E0C, sub_08046E68, sub_08046EF4 }; void sub_08046CEC(Entity* this) { if (this->animIndex == 0) { @@ -330,29 +307,20 @@ void sub_08046CEC(Entity* this) { } gUnk_080D1B4C[this->previousActionFlag](this); UpdateAnimationSingleFrame(this); - if (((Entity*) this->otherEntity)->prev->field_0x6c.HWORD & 2) { + if (((Entity*)this->otherEntity)->prev->field_0x6c.HWORD & 2) { this->action = 2; this->previousActionFlag = 0; this->animationState = this->nonPlanarMovement; } } -const u16 gUnk_080D1B60[8] = { - 0x200, - 0x184, - 0x28C, - 0x210, - 0x200, - 0x29C, - 0x174, - 0x210 -}; +const u16 gUnk_080D1B60[8] = { 0x200, 0x184, 0x28C, 0x210, 0x200, 0x29C, 0x174, 0x210 }; void sub_08046D44(Entity* this) { - const u16 * tmp; + const u16* tmp; this->previousActionFlag = 1; this->nonPlanarMovement = 0x200; - tmp = gUnk_080D1B60 + (((Entity*) this->otherEntity)->next->animationState >> 5); + tmp = gUnk_080D1B60 + (((Entity*)this->otherEntity)->next->animationState >> 5); this->field_0x80.HWORD = tmp[0] + gRoomControls.roomOriginX; this->field_0x82.HWORD = tmp[1] + gRoomControls.roomOriginY; this->field_0x76.HWORD = this->direction << 8; @@ -381,18 +349,16 @@ void sub_08046E0C(Entity* this) { this->field_0x76.HWORD = this->direction << 8; sub_08047D88(this); } else { - this->direction = sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI); + this->direction = + sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI); sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8); } } -const s16 gUnk_080D1B70[2] = { - 0x40, - -0x40 -}; +const s16 gUnk_080D1B70[2] = { 0x40, -0x40 }; void sub_08046E68(Entity* this) { - u32 tmp = ((Entity*) this->otherEntity)->next->animationState ^ 0x80; + u32 tmp = ((Entity*)this->otherEntity)->next->animationState ^ 0x80; if (tmp != this->direction) { if (((tmp - this->direction) & 0xFF) > 0x80) { this->field_0x76.HWORD -= 0x100; @@ -411,24 +377,8 @@ void sub_08046E68(Entity* this) { } } -const u16 gUnk_080D1B74[0x10] = { - 0x20, - 0x40, - 0x60, - 0x80, - 0xA0, - 0xC0, - 0xE0, - 0x100, - 0x100, - 0xE0, - 0xC0, - 0xA0, - 0x80, - 0x60, - 0x40, - 0x20 -}; +const u16 gUnk_080D1B74[0x10] = { 0x20, 0x40, 0x60, 0x80, 0xA0, 0xC0, 0xE0, 0x100, + 0x100, 0xE0, 0xC0, 0xA0, 0x80, 0x60, 0x40, 0x20 }; void sub_08046EF4(Entity* this) { if (--this->actionDelay == 0) { @@ -449,18 +399,8 @@ void sub_08046EF4(Entity* this) { sub_08047E48(this); } -void (* const gUnk_080D1B94[0xA])(Entity*) = { - sub_08046FE8, - sub_0804702C, - sub_080470B4, - sub_08047140, - sub_0804717C, - sub_080471C8, - sub_0804723C, - sub_08047284, - sub_080472BC, - sub_08047310 -}; +void (*const gUnk_080D1B94[0xA])(Entity*) = { sub_08046FE8, sub_0804702C, sub_080470B4, sub_08047140, sub_0804717C, + sub_080471C8, sub_0804723C, sub_08047284, sub_080472BC, sub_08047310 }; void sub_08046F64(Entity* this) { if (this->animIndex == 0) { @@ -480,7 +420,7 @@ void sub_08046F64(Entity* this) { UpdateSpriteForCollisionLayer(tmp); } } - if (((Entity*) this->otherEntity)->prev->field_0x6c.HWORD & 4) { + if (((Entity*)this->otherEntity)->prev->field_0x6c.HWORD & 4) { this->action = 5; this->previousActionFlag = 0; } @@ -512,10 +452,7 @@ void sub_0804702C(Entity* this) { } } -const u16 gUnk_080D1BBC[2] = { - 0x1A0, - 0xE0 -}; +const u16 gUnk_080D1BBC[2] = { 0x1A0, 0xE0 }; void sub_080470B4(Entity* this) { u32 tmp = 0x40; @@ -565,7 +502,8 @@ void sub_080471C8(Entity* this) { this->direction++; } sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8); - if (gRoomControls.roomOriginY + 0x190 <= this->y.HALF.HI) return; + if (gRoomControls.roomOriginY + 0x190 <= this->y.HALF.HI) + return; if (this->field_0x74.HWORD > 0x100) { if (Random() & 1) { this->previousActionFlag = 6; @@ -604,7 +542,8 @@ void sub_080472BC(Entity* this) { this->nonPlanarMovement += 8; } sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8); - if (gRoomControls.roomOriginX + 0x2B0 >= this->x.HALF.HI) return; + if (gRoomControls.roomOriginX + 0x2B0 >= this->x.HALF.HI) + return; this->previousActionFlag = 9; this->field_0x76.HWORD = this->direction << 8; } @@ -615,22 +554,15 @@ void sub_08047310(Entity* this) { } this->field_0x76.HWORD -= 0x1D0; this->direction = this->field_0x76.HWORD >> 8; - if ((u8) (this->direction + 0x7F) < 0x40) { + if ((u8)(this->direction + 0x7F) < 0x40) { this->direction = 0xC0; this->previousActionFlag = 4; } sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8); } -void (* const gUnk_080D1BC0[7])(Entity*) = { - sub_080473B8, - sub_080473F0, - sub_08047484, - sub_08047508, - sub_080475F4, - sub_0804763C, - sub_0804772C -}; +void (*const gUnk_080D1BC0[7])(Entity*) = { sub_080473B8, sub_080473F0, sub_08047484, sub_08047508, + sub_080475F4, sub_0804763C, sub_0804772C }; void sub_0804736C(Entity* this) { if (this->animIndex == 1) { @@ -766,7 +698,7 @@ void sub_0804763C(Entity* this) { this->direction = this->field_0x76.HWORD >> 8; } } else { - s32 tmp = (s16) this->field_0x74.HWORD; + s32 tmp = (s16)this->field_0x74.HWORD; if (tmp > 0) { this->field_0x76.HWORD += tmp; this->direction = this->field_0x76.HWORD >> 8; @@ -812,13 +744,7 @@ void sub_0804772C(Entity* this) { sub_08047DF0(this, ((0x100 - this->direction) & 0xFF) << 8); } -void (* const gUnk_080D1BDC[5])(Entity*) = { - sub_08047798, - sub_080477F0, - sub_08047914, - sub_08047978, - sub_08047B08 -}; +void (*const gUnk_080D1BDC[5])(Entity*) = { sub_08047798, sub_080477F0, sub_08047914, sub_08047978, sub_08047B08 }; void sub_08047778(Entity* this) { gUnk_080D1BDC[this->previousActionFlag](this); @@ -838,10 +764,7 @@ void sub_08047798(Entity* this) { sub_08047D88(this); } -const s16 gUnk_080D1BF0[2] = { - 0x80, - -0x80 -}; +const s16 gUnk_080D1BF0[2] = { 0x80, -0x80 }; void sub_080477F0(Entity* this) { if (this->nonPlanarMovement < 0x300) { @@ -865,10 +788,11 @@ void sub_080477F0(Entity* this) { this->previousActionFlag = 2; this->field_0x76.HWORD = this->animationState << 8; this->field_0x74.HWORD = gUnk_080D1BF0[Random() & 1]; - if (((Entity*) this->otherEntity)->prev->field_0x6c.HWORD & 1) { - ((Entity*) this->otherEntity)->next->field_0x78.HALF.HI = gRoomControls.roomOriginX + 0x200 > this->x.HALF.HI ? 0x81 : 0x83; + if (((Entity*)this->otherEntity)->prev->field_0x6c.HWORD & 1) { + ((Entity*)this->otherEntity)->next->field_0x78.HALF.HI = + gRoomControls.roomOriginX + 0x200 > this->x.HALF.HI ? 0x81 : 0x83; } else { - ((Entity*) this->otherEntity)->next->field_0x78.HALF.HI = 0x80; + ((Entity*)this->otherEntity)->next->field_0x78.HALF.HI = 0x80; } } } @@ -883,7 +807,7 @@ void sub_08047914(Entity* this) { this->previousActionFlag = 3; this->field_0x70.HALF.LO = 0x3C; this->field_0x7c.HALF.HI = ((this->entityType.form * 0xF) << 2) + 0x78; - sub_080A1D70(((Entity*) this->otherEntity)->prev, this->animationState); + sub_080A1D70(((Entity*)this->otherEntity)->prev, this->animationState); } } @@ -920,11 +844,13 @@ void sub_08047978(Entity* this) { this->spriteRendering.b3 = 2; this->direction = this->animationState; } - if (this->currentHealth != 0) return; - if (this->attachedEntity->action != 1) return; + if (this->currentHealth != 0) + return; + if (this->attachedEntity->action != 1) + return; this->previousActionFlag = 4; if (this->entityType.form == 0) { - if ((((Entity*) this->otherEntity)->next->animationState >> 6) == 1) { + if ((((Entity*)this->otherEntity)->next->animationState >> 6) == 1) { this->field_0x80.HWORD = gRoomControls.roomOriginX + 0x1C0; this->field_0x82.HWORD = gRoomControls.roomOriginY + 0x250; } else { @@ -945,7 +871,6 @@ void sub_08047978(Entity* this) { } this->field_0x82.HWORD += gRoomControls.roomOriginY; } - } void sub_08047B08(Entity* this) { @@ -953,7 +878,8 @@ void sub_08047B08(Entity* this) { this->direction = sub_080045DA(this->field_0x80.HWORD - this->x.HALF.HI, this->field_0x82.HWORD - this->y.HALF.HI); this->nonPlanarMovement = 0x200; sub_08047E58(this); - if (!sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) return; + if (!sub_0806FCB8(this, this->field_0x80.HWORD, this->field_0x82.HWORD, 4)) + return; if (this->entityType.form == 0) { this->action = 7; this->previousActionFlag = 0; @@ -967,11 +893,7 @@ void sub_08047B08(Entity* this) { } } -void (* const gUnk_080D1BF4[3])(Entity*) = { - sub_08047BA4, - sub_08047BF0, - sub_08047D24 -}; +void (*const gUnk_080D1BF4[3])(Entity*) = { sub_08047BA4, sub_08047BF0, sub_08047D24 }; void sub_08047B84(Entity* this) { gUnk_080D1BF4[this->previousActionFlag](this); @@ -991,12 +913,7 @@ void sub_08047BA4(Entity* this) { sub_08047BF0(this); } -const s8 gUnk_080D1C00[4] = { - 0x40, - -0x40, - -0x40, - 0x40 -}; +const s8 gUnk_080D1C00[4] = { 0x40, -0x40, -0x40, 0x40 }; void sub_08047BF0(Entity* this) { Entity* tmp; @@ -1052,9 +969,9 @@ void sub_08047D24(Entity* this) { this->field_0x7c.HALF_U.HI += 8; if (this->field_0x7c.HALF_U.HI > 0x800) { if (this->entityType.form == 0) { - ((u32*) this->otherEntity)[2] = 0; + ((u32*)this->otherEntity)[2] = 0; } else { - ((u32*) this->otherEntity)[3] = 0; + ((u32*)this->otherEntity)[3] = 0; } this->otherEntity = 0; DeleteThisEntity(); @@ -1074,17 +991,21 @@ void sub_08047D88(Entity* this) { tmp = ((tmp << 1) & 0x7F) | (tmp & 0x80); this->field_0x7c.BYTES.byte0 = tmp; tmp2 = this->spriteRendering.b3; - if (tmp2 == 3 && gPlayerState.field_0x14 != 0) return; - if (this->animIndex == 1) return; - if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20)) return; + if (tmp2 == 3 && gPlayerState.field_0x14 != 0) + return; + if (this->animIndex == 1) + return; + if (!sub_0806FCB8(this, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20)) + return; gPlayerState.field_0x14 = 1; - if (gPlayerEntity.height.HALF.HI != 0) return; + if (gPlayerEntity.height.HALF.HI != 0) + return; this->field_0x7c.BYTES.byte0 |= 1; } void sub_08047DF0(Entity* this, u32 unk1) { u32 oldX, oldY; - sub_08047D88(this); + sub_08047D88(this); sub_08047EA4(this, unk1); oldX = this->x.HALF.HI; oldY = this->y.HALF.HI; @@ -1120,7 +1041,8 @@ void sub_08047EA4(Entity* this, u32 unk1) { u32 tmp2, dir; this->field_0x78.HWORD = unk1; tmp = this->field_0x78.HWORD - this->field_0x7a.HWORD; - if (tmp + 0x100 < 0x200u) return; + if (tmp + 0x100 < 0x200u) + return; if (this->field_0x7c.BYTES.byte0 & 1) { tmp2 = sub_08047F68(this) << 8; dir = sub_080045DA(gPlayerEntity.x.HALF.HI - this->x.HALF.HI, gPlayerEntity.y.HALF.HI - this->y.HALF.HI); @@ -1132,24 +1054,17 @@ void sub_08047EA4(Entity* this, u32 unk1) { this->field_0x7a.HWORD = this->field_0x78.HWORD; } -const u16 gUnk_080D1C04[0x20] = { - 0, 1, 4, 9, - 16, 25, 36, 49, - 64, 81, 100, 121, - 144, 169, 196, 225, - 256, 289, 324, 361, - 400, 441, 484, 529, - 576, 625, 676, 729, - 784, 841, 900, 961 -}; +const u16 gUnk_080D1C04[0x20] = { 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, + 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961 }; u32 sub_08047F68(Entity* this) { s32 diffX, diffY; s32 distSquared, approx; - diffX = gPlayerEntity.x.HALF.HI - this->x.HALF.HI; + diffX = gPlayerEntity.x.HALF.HI - this->x.HALF.HI; diffY = gPlayerEntity.y.HALF.HI - this->y.HALF.HI; distSquared = (diffX * diffX) + (diffY * diffY); - if (distSquared == 0x400) return 0x20; + if (distSquared == 0x400) + return 0x20; if (distSquared < gUnk_080D1C04[0x10]) { approx = 0x8; } else { @@ -1171,7 +1086,7 @@ u32 sub_08047F68(Entity* this) { approx += 1; } if (distSquared < gUnk_080D1C04[approx]) { - s32 tmp = gUnk_080D1C04[approx-1]; + s32 tmp = gUnk_080D1C04[approx - 1]; tmp += (gUnk_080D1C04[approx] - tmp) / 2; if (distSquared <= tmp) { approx = approx - 1; @@ -1181,22 +1096,26 @@ u32 sub_08047F68(Entity* this) { } void sub_08048004(Entity* this) { - if (this->action == 0) return; + if (this->action == 0) + return; if (this->animIndex == 0) { this->flags &= ~0x80; - if (gPlayerEntity.height.HALF.HI != 0) return; - if (!sub_08079F8C()) return; + if (gPlayerEntity.height.HALF.HI != 0) + return; + if (!sub_08079F8C()) + return; if (this->field_0x7c.BYTES.byte0 & 1) { u32 b = this->spriteRendering.b3; if (b == 3) { - s32 posX = ((gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX) >> 3); + s32 posX = ((gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX) >> 3); s32 posY = ((gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY) >> 3); - u16 * tmp = (u16*)&gUnk_02019EE0; + u16* tmp = (u16*)&gUnk_02019EE0; if (tmp[(posY << 7) + posX]) { if (!(this->field_0x7c.BYTES.byte0 & 2)) { this->field_0x7c.BYTES.byte0 |= 0x80; } - if ((this->field_0x7c.BYTES.byte0 & 0x80)) return; + if ((this->field_0x7c.BYTES.byte0 & 0x80)) + return; gPlayerEntity.x.HALF.HI = this->cutsceneBeh.HWORD; gPlayerEntity.y.HALF.HI = this->field_0x86.HWORD; return; @@ -1208,7 +1127,8 @@ void sub_08048004(Entity* this) { if (b != 3) { if (sub_0806FCB8(&gPlayerEntity, this->x.HALF.HI, this->y.HALF.HI, 0x24)) { if (!(this->field_0x7c.BYTES.byte0 & 2)) { - u32 tmp = sub_080045DA(gPlayerEntity.x.HALF.HI - this->x.HALF.HI, gPlayerEntity.y.HALF.HI - this->y.HALF.HI); + u32 tmp = sub_080045DA(gPlayerEntity.x.HALF.HI - this->x.HALF.HI, + gPlayerEntity.y.HALF.HI - this->y.HALF.HI); gPlayerEntity.x.WORD = this->x.WORD + (gSineTable[tmp] * 9216); gPlayerEntity.y.WORD = this->y.WORD - (gSineTable[tmp + 0x40] * 9216); } @@ -1226,41 +1146,19 @@ void sub_0804813C(Entity* this) { sub_080A1ED0(rand & 7, 1, (rand >> 8) & 3); } - -const u8 gUnk_080D1C44[0xC] = { - 0, 2, 6, 0, - 2, 4, 2, 4, - 6, 0, 4, 6 -}; +const u8 gUnk_080D1C44[0xC] = { 0, 2, 6, 0, 2, 4, 2, 4, 6, 0, 4, 6 }; u32 sub_08048158(u32 unk1) { return gUnk_080D1C44[(unk1 * 3) + ((signed)Random() % 3)]; } -const u16 gUnk_080D1C50[8] = { - 0x200, - 0x180, - 0x2C0, - 0x210, - 0x200, - 0x2A0, - 0x140, - 0x210 -}; +const u16 gUnk_080D1C50[8] = { 0x200, 0x180, 0x2C0, 0x210, 0x200, 0x2A0, 0x140, 0x210 }; -const u16 gUnk_080D1C60[8] = { - 0x200, - 0x150, - 0x290, - 0x210, - 0x200, - 0x2D0, - 0x170, - 0x210 -}; +const u16 gUnk_080D1C60[8] = { 0x200, 0x150, 0x290, 0x210, 0x200, 0x2D0, 0x170, 0x210 }; void sub_08048178(Entity* this, u32 unk1) { - const u16* tmp = ((((Entity*) this->otherEntity)->next->animationState >> 6 & 1) ? gUnk_080D1C60 + unk1: gUnk_080D1C50 + unk1); + const u16* tmp = + ((((Entity*)this->otherEntity)->next->animationState >> 6 & 1) ? gUnk_080D1C60 + unk1 : gUnk_080D1C50 + unk1); this->field_0x80.HWORD = *tmp + gRoomControls.roomOriginX; this->field_0x82.HWORD = *(tmp + 1) + gRoomControls.roomOriginY; } diff --git a/src/fileScreen.c b/src/fileScreen.c index 23384734..0dcd5287 100644 --- a/src/fileScreen.c +++ b/src/fileScreen.c @@ -1146,8 +1146,7 @@ void sub_08051874(void) { gUnk_02019EE0.saveStatus[gUnk_02019EE0.unk7] = temp; switch (temp) { case 1: - _DmaCopy(&gSave, &gUnk_02019EE0.saves[gUnk_02019EE0.unk7], - sizeof(gUnk_02019EE0.saves[gUnk_02019EE0.unk7])); + _DmaCopy(&gSave, &gUnk_02019EE0.saves[gUnk_02019EE0.unk7], sizeof(gUnk_02019EE0.saves[gUnk_02019EE0.unk7])); SetFileSelectState(0); break; case -1: diff --git a/src/item14.c b/src/item14.c index d1e6086d..08b3ec35 100644 --- a/src/item14.c +++ b/src/item14.c @@ -9,42 +9,42 @@ extern u8 gUnk_08003E44; void sub_0805FC74(Entity*); -void Item14(Entity *this) { +void Item14(Entity* this) { gUnk_08109AC8[this->action](this); } void sub_0805FBE8(Entity* this) { - CopyPosition(&gPlayerEntity,this); - this->action++; - this->spriteSettings.b.draw = TRUE; - this->field_0x3c = gPlayerEntity.field_0x3c + 1; - this->boundingBox = &gUnk_08109AD0; - this->nonPlanarMovement = 0x380; - this->animationState = this->animationState & 0x7f; - if (this->collisionLayer == 2) { - this->entityType.parameter = 1; - } - this->direction = this->animationState << 2; - *(u32 *)&this->field_0x6c = 0x3c; - InitializeAnimation(this, (this->animationState >> 1) + 0xc); - sub_0801766C(this); - sub_0806F69C(this); - sub_0805FC74(this); - PlaySFX(0x13f); + CopyPosition(&gPlayerEntity, this); + this->action++; + this->spriteSettings.b.draw = TRUE; + this->field_0x3c = gPlayerEntity.field_0x3c + 1; + this->boundingBox = &gUnk_08109AD0; + this->nonPlanarMovement = 0x380; + this->animationState = this->animationState & 0x7f; + if (this->collisionLayer == 2) { + this->entityType.parameter = 1; + } + this->direction = this->animationState << 2; + *(u32*)&this->field_0x6c = 0x3c; + InitializeAnimation(this, (this->animationState >> 1) + 0xc); + sub_0801766C(this); + sub_0806F69C(this); + sub_0805FC74(this); + PlaySFX(0x13f); } void sub_0805FC74(Entity* this) { int iVar1; - if (--*(int *)&this->field_0x6c != -1) { + if (--*(int*)&this->field_0x6c != -1) { GetNextFrame(this); sub_0806F69C(this); ++this->actionDelay; if (this->entityType.parameter == 0) { sub_0800451C(this); } - if (!sub_080002F0(COORD_TO_TILE(this),gPlayerEntity.collisionLayer,0x80) && - sub_080040D8(this,&gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI)) { + if (!sub_080002F0(COORD_TO_TILE(this), gPlayerEntity.collisionLayer, 0x80) && + sub_080040D8(this, &gUnk_08003E44, this->x.HALF.HI, this->y.HALF.HI)) { CreateFx(this, 0x19, 0); DeleteThisEntity(); } diff --git a/src/manager.c b/src/manager.c index a57bbae4..27124146 100644 --- a/src/manager.c +++ b/src/manager.c @@ -2,62 +2,13 @@ // TODO: change all manager arguments to be Entity* and cast to specific type later. void (*const gManagerFunctions[])() = { - NULL, - Manager1, - Manager2, - sub_080576C0, - sub_08057854, - sub_08057AD0, - sub_08057CB4, - Manager7_Main, - sub_08057ED0, - sub_080581D8, - sub_08058380, - sub_080585F0, - sub_0805884C, - sub_08058DD0, - sub_08058E60, - sub_08058ECC, - sub_08059570, - sub_080599B8, - sub_080599EC, - sub_08059DAC, - sub_08059E58, - sub_0805A280, - sub_0805AB4C, - sub_0805AD48, - sub_0805ADD8, - sub_0805AF60, - sub_0805B030, - sub_0805B3B4, - sub_0805B53C, - sub_0805B5C8, - Manager1E_Handler, - sub_0805B6F4, - sub_0805B7A0, - sub_0805B820, - sub_0805B8EC, - sub_0805BC74, - sub_0805BF18, - sub_0805C61C, - sub_0805C6B8, - Manager27, - Manager28_Entry, - sub_0805CB90, - sub_0805CFC0, - sub_0805D014, - sub_0805D174, - sub_0805D1FC, - sub_0805D250, - sub_0805D3C8, - Manager30_Main, - sub_0805D630, - sub_0805D7A4, - sub_0805DAE8, - sub_0805DB94, - sub_0805DC84, - sub_0805DDB4, - sub_0805DE38, - sub_0805E0A8, - sub_0805E0FC + NULL, Manager1, Manager2, sub_080576C0, sub_08057854, sub_08057AD0, sub_08057CB4, + Manager7_Main, sub_08057ED0, sub_080581D8, sub_08058380, sub_080585F0, sub_0805884C, sub_08058DD0, + sub_08058E60, sub_08058ECC, sub_08059570, sub_080599B8, sub_080599EC, sub_08059DAC, sub_08059E58, + sub_0805A280, sub_0805AB4C, sub_0805AD48, sub_0805ADD8, sub_0805AF60, sub_0805B030, sub_0805B3B4, + sub_0805B53C, sub_0805B5C8, Manager1E_Handler, sub_0805B6F4, sub_0805B7A0, sub_0805B820, sub_0805B8EC, + sub_0805BC74, sub_0805BF18, sub_0805C61C, sub_0805C6B8, Manager27, Manager28_Entry, sub_0805CB90, + sub_0805CFC0, sub_0805D014, sub_0805D174, sub_0805D1FC, sub_0805D250, sub_0805D3C8, Manager30_Main, + sub_0805D630, sub_0805D7A4, sub_0805DAE8, sub_0805DB94, sub_0805DC84, sub_0805DDB4, sub_0805DE38, + sub_0805E0A8, sub_0805E0FC }; diff --git a/src/manager/manager1E.c b/src/manager/manager1E.c index cf45af71..363c3113 100644 --- a/src/manager/manager1E.c +++ b/src/manager/manager1E.c @@ -6,28 +6,22 @@ typedef struct { Manager manager; - u8 unk_20[0x14];//unused + u8 unk_20[0x14]; // unused u16 radiusX; u16 radiusY; s16 posX; s16 posY; - u8 unk_3c[2];//unused + u8 unk_3c[2]; // unused u16 playerInRegionFlag; } Manager1E; -enum Manager1E_State { - Init, - ObserveRegion -}; +enum Manager1E_State { Init, ObserveRegion }; void Manager1E_Handler(Manager1E*); void Manager1E_Init(Manager1E*); void Manager1E_ObserveRegion(Manager1E*); -void (* const Manager1E_ActionFuncs[2])(Manager1E*) = { - Manager1E_Init, - Manager1E_ObserveRegion -}; +void (*const Manager1E_ActionFuncs[2])(Manager1E*) = { Manager1E_Init, Manager1E_ObserveRegion }; void Manager1E_Handler(Manager1E* this) { Manager1E_ActionFuncs[this->manager.action](this); diff --git a/src/manager/manager26.c b/src/manager/manager26.c index dda5761c..80613c41 100644 --- a/src/manager/manager26.c +++ b/src/manager/manager26.c @@ -17,16 +17,12 @@ void sub_0805C6D0(Manager26*); void sub_0805C7A0(Manager26*); void sub_0805C7C4(Manager26*); -void (* const gUnk_08108D04[])(Manager26*) = { - sub_0805C6D0, - sub_0805C7A0, - sub_0805C7C4 -}; +void (*const gUnk_08108D04[])(Manager26*) = { sub_0805C6D0, sub_0805C7A0, sub_0805C7C4 }; void sub_0805C7CC(Manager26*); void sub_0805C6B8(Manager26* this) { - gUnk_08108D04[this->manager.action](this); + gUnk_08108D04[this->manager.action](this); } void sub_0805C6D0(Manager26* this) { @@ -46,7 +42,7 @@ void sub_0805C6D0(Manager26* this) { obj->actionDelay = tmp->unk_03; obj->x.HALF.HI = gRoomControls.roomOriginX + tmp->unk_04; obj->y.HALF.HI = gRoomControls.roomOriginY + tmp->unk_06; - obj->parent = (Entity*) this; + obj->parent = (Entity*)this; obj->collisionLayer = 1; obj->field_0x82.HALF.HI = this->manager.unk_0e; obj->field_0x82.HALF.LO = tmp->unk_00; @@ -75,7 +71,7 @@ void sub_0805C7A0(Manager26* this) { } void sub_0805C7C4(Manager26* this) { - sub_0805C7CC(this); + sub_0805C7CC(this); } void sub_0805C7CC(Manager26* this) { diff --git a/src/manager/manager27.c b/src/manager/manager27.c index 641fdc9b..36719574 100644 --- a/src/manager/manager27.c +++ b/src/manager/manager27.c @@ -11,16 +11,9 @@ void sub_0805C894(Entity*); void sub_0805C8B4(Entity*); void sub_0805C908(Entity*); -void (*const gUnk_08108D10[])(Entity*) = { - sub_0805C874, - sub_0805C894, - sub_0805C8B4, - sub_0805C908 -}; +void (*const gUnk_08108D10[])(Entity*) = { sub_0805C874, sub_0805C894, sub_0805C8B4, sub_0805C908 }; -const u8 gUnk_08108D20[] = { - 0x6F, 0x70, 0x71, 0x72, 0x71, 0x70 -}; +const u8 gUnk_08108D20[] = { 0x6F, 0x70, 0x71, 0x72, 0x71, 0x70 }; void Manager27(Entity* this) { diff --git a/src/manager/manager28.c b/src/manager/manager28.c index 66864d13..9f518f1c 100644 --- a/src/manager/manager28.c +++ b/src/manager/manager28.c @@ -18,20 +18,11 @@ u32 Manager28_FindMatchingEntities(Manager28*); Entity* Manager28_FindMatchingEntity(EntityData*); void Manager28_RemoveDeletedEntities(Manager28*); -void (* const Manager28_ActionFuncs[])(Manager28*) = { - Manager28_Init, - Manager28_Main -}; +void (*const Manager28_ActionFuncs[])(Manager28*) = { Manager28_Init, Manager28_Main }; -enum Manager28_Action { - Init = 0, - Main = 1 -}; +enum Manager28_Action { Init = 0, Main = 1 }; -enum Manager28_InitState { - DoInit = 0, - DoNotInit = 1 -}; +enum Manager28_InitState { DoInit = 0, DoNotInit = 1 }; void Manager28_Entry(Manager28* this) { Manager28_ActionFuncs[this->manager.action](this); @@ -46,7 +37,7 @@ void Manager28_Init(Manager28* this) { } tmp2 = Manager28_FindMatchingEntities(this); if (tmp2 > 1) { - Manager28* tmp3 = (Manager28*) GetEmptyManager(); + Manager28* tmp3 = (Manager28*)GetEmptyManager(); if (tmp3) { tmp3->manager.type = 9; tmp3->manager.subtype = 0x28; @@ -92,20 +83,26 @@ void Manager28_Main(Manager28* this) { u32 Manager28_FindMatchingEntities(Manager28* this) { u32 re = 0; - EntityData * tmp = GetCurrentRoomProperty(this->manager.unk_0b); - if (!tmp) return 0; - for (; *((u8*) tmp) != 0xFF && !(tmp->type == 9 && tmp->subtype == 0x28); tmp++) { + EntityData* tmp = GetCurrentRoomProperty(this->manager.unk_0b); + if (!tmp) + return 0; + for (; *((u8*)tmp) != 0xFF && !(tmp->type == 9 && tmp->subtype == 0x28); tmp++) { Entity* tmp2; u32 i; - if (tmp->type != 3) continue; + if (tmp->type != 3) + continue; tmp2 = Manager28_FindMatchingEntity(tmp); - if (!tmp2) continue; + if (!tmp2) + continue; for (i = 0; i < re; i++) { - if (this->d.enemies[i] == tmp2) break; + if (this->d.enemies[i] == tmp2) + break; } - if (i != re) continue; + if (i != re) + continue; this->d.enemies[re++] = tmp2; - if (re == 8) return 8; + if (re == 8) + return 8; } return re; } @@ -115,15 +112,12 @@ Entity* Manager28_FindMatchingEntity(EntityData* unk1) { Entity* i; LinkedList* tmp; x = unk1->xPos + gRoomControls.roomOriginX; - y = unk1->yPos + gRoomControls.roomOriginY; - tmp = &gUnk_03003D90; - for (i = tmp->first; (u32) i != (u32) tmp; i = i->next) { - if (x == i->x.HALF.HI - && y == i->y.HALF.HI - && unk1->subtype == i->entityType.subtype - && 3 == i->entityType.type - && unk1->form == i->entityType.form) { - return i; + y = unk1->yPos + gRoomControls.roomOriginY; + tmp = &gUnk_03003D90; + for (i = tmp->first; (u32)i != (u32)tmp; i = i->next) { + if (x == i->x.HALF.HI && y == i->y.HALF.HI && unk1->subtype == i->entityType.subtype && + 3 == i->entityType.type && unk1->form == i->entityType.form) { + return i; } } return 0; @@ -133,13 +127,14 @@ void Manager28_RemoveDeletedEntities(Manager28* this) { s32 i; for (i = 0; i < this->manager.unk_0e; i++) { if (this->d.enemies[i]->next == 0) { - if (this->manager.unk_0e-1 == i) { + if (this->manager.unk_0e - 1 == i) { this->d.enemies[i] = 0; } else { - this->d.enemies[i] = this->d.enemies[this->manager.unk_0e-1]; + this->d.enemies[i] = this->d.enemies[this->manager.unk_0e - 1]; } this->manager.unk_0e--; } } - if (this->manager.unk_0e <= 1) DeleteThisEntity(); + if (this->manager.unk_0e <= 1) + DeleteThisEntity(); } diff --git a/src/manager/manager39.c b/src/manager/manager39.c index 9228b682..134e1551 100644 --- a/src/manager/manager39.c +++ b/src/manager/manager39.c @@ -7,20 +7,20 @@ typedef struct { Manager manager; - u8 unk_20;//unused - u8 unk_21[0x13];//unused - u16 unk_34;//unused - u16 unk_36;//unused - s16 unk_38;//unused - s16 unk_3A;//unused - u16 unk_3C;//unused - u16 unk_3E;//unused + u8 unk_20; // unused + u8 unk_21[0x13]; // unused + u16 unk_34; // unused + u16 unk_36; // unused + s16 unk_38; // unused + s16 unk_3A; // unused + u16 unk_3C; // unused + u16 unk_3E; // unused } Manager39; extern u8 gUnk_02034DF0[0x2F2]; extern const u16 gUnk_08108DE8[]; -extern void (* const gUnk_08108E28[])(Manager39*); +extern void (*const gUnk_08108E28[])(Manager39*); extern const u8 gUnk_08108E30[0x18]; extern const u8 gUnk_08108E48[0x18]; extern const u8 gUnk_08108E60[]; @@ -31,14 +31,13 @@ extern u32 CheckIsDungeon(void); extern void sub_0805E5B4(void); void sub_0805E140(Manager39*); -void sub_0805E18C(Manager39*); //unused? +void sub_0805E18C(Manager39*); // unused? void sub_0805E1D8(Manager39*); void sub_0805E1F8(u32, u32); void sub_0805E0FC(Manager39* this) { gUnk_08108E28[this->manager.action](this); - if ((gRoomControls.roomID != this->unk_20) - || (gTextBox.doTextBox & 0x7F)) { + if ((gRoomControls.roomID != this->unk_20) || (gTextBox.doTextBox & 0x7F)) { sub_0805E1D8(this); } } @@ -49,12 +48,13 @@ void sub_0805E140(Manager39* this) { this->unk_20 = gRoomControls.roomID; this->manager.unk_0e = 0x78; this->manager.unk_0f = 0x3c; - sub_0805E3A0((Entity*) this, 7); + sub_0805E3A0((Entity*)this, 7); sub_0805E1F8(gUnk_08108DE8[gArea.locationIndex], CheckIsDungeon()); } void sub_0805E18C(Manager39* this) { - if (gFadeControl.active) return; + if (gFadeControl.active) + return; if (this->manager.unk_0b) { if (!--this->manager.unk_0f) { this->manager.unk_0b = 0; @@ -80,13 +80,14 @@ void sub_0805E1F8(u32 unk0, u32 unk1) { u8 unk_05; u8 unk_06[3]; } PACKED tmp; - const u8 * tmp2; + const u8* tmp2; _DmaZero(&gUnk_02034DF0, 0x80); _DmaCopy(gUnk_08108E60, &tmp, sizeof(tmp)); - tmp.unk_04 = unk0>>8; + tmp.unk_04 = unk0 >> 8; tmp.unk_05 = unk0; tmp2 = gUnk_08108E48; - if (!unk1) tmp2 = gUnk_08108E30; + if (!unk1) + tmp2 = gUnk_08108E30; sub_0805F46C(&tmp, tmp2); gScreen.bg.bg3Control = 1; } diff --git a/src/manager/managerC.c b/src/manager/managerC.c index 2eec1a0d..25aed20e 100644 --- a/src/manager/managerC.c +++ b/src/manager/managerC.c @@ -9,10 +9,9 @@ #include "functions.h" #include "save.h" - typedef struct { Manager manager; - s32 unk_20; + s32 unk_20; union SplitWord unk_24; u32 unk_28; u32 unk_2c; @@ -26,7 +25,7 @@ typedef struct { u16 unk_6; } struct_08108228; -void (* const gUnk_0810821C[])(ManagerC*); +void (*const gUnk_0810821C[])(ManagerC*); const struct_08108228 gUnk_08108228[6]; const struct_08108228 gUnk_08108258[6]; const struct_08108228 gUnk_08108288[6]; @@ -60,11 +59,7 @@ void sub_08058894(ManagerC*); void sub_080588CC(ManagerC*); void nullsub_108(ManagerC*); -void (* const gUnk_0810821C[])(ManagerC*) = { - sub_08058894, - sub_080588CC, - nullsub_108 -}; +void (*const gUnk_0810821C[])(ManagerC*) = { sub_08058894, sub_080588CC, nullsub_108 }; void sub_0805884C(ManagerC* this) { u32 tmp; @@ -90,9 +85,10 @@ void sub_080588CC(ManagerC* this) { } } -void nullsub_108(ManagerC* this) {} +void nullsub_108(ManagerC* this) { +} -#define ABS_DIFF_GT(a, b, c) (signed) a - b >= 0 ? a - b > c : b - a > c +#define ABS_DIFF_GT(a, b, c) (signed)a - b >= 0 ? a - b > c : b - a > c void sub_080588F8(ManagerC* this) { if (this->manager.unk_0f == 0) { @@ -126,8 +122,8 @@ void sub_080588F8(ManagerC* this) { this->unk_24.WORD += tmp2; } if (ABS_DIFF_GT(this->unk_2c, this->unk_24.WORD, 0x100000)) { - this->unk_2c = this->unk_24.WORD; - PlaySFX(0x8b); + this->unk_2c = this->unk_24.WORD; + PlaySFX(0x8b); } } } @@ -140,50 +136,27 @@ void sub_080588F8(ManagerC* this) { } } -const struct_08108228 gUnk_08108228[6] = { - {0x40, 0x2A, 0x1C, 0x10}, - {0x3C, 0x24, 0x1C, 0x12}, - {0x3C, 0x1C, 0x1A, 0x18}, - {0x38, 0x16, 0x1C, 0x16}, - {0x34, 0x16, 0x1E, 0x0E}, - {0x30, 0x16, 0x20, 0x0A} -}; +const struct_08108228 gUnk_08108228[6] = { { 0x40, 0x2A, 0x1C, 0x10 }, { 0x3C, 0x24, 0x1C, 0x12 }, + { 0x3C, 0x1C, 0x1A, 0x18 }, { 0x38, 0x16, 0x1C, 0x16 }, + { 0x34, 0x16, 0x1E, 0x0E }, { 0x30, 0x16, 0x20, 0x0A } }; -const struct_08108228 gUnk_08108258[6] = { - {0x30, 0x88, 0x20, 0x0A}, - {0x34, 0x7E, 0x1E, 0x12}, - {0x38, 0x78, 0x1A, 0x16}, - {0x3A, 0x70, 0x1A, 0x18}, - {0x3C, 0x64, 0x1E, 0x1E}, - {0x3E, 0x6A, 0x1C, 0x10} -}; +const struct_08108228 gUnk_08108258[6] = { { 0x30, 0x88, 0x20, 0x0A }, { 0x34, 0x7E, 0x1E, 0x12 }, + { 0x38, 0x78, 0x1A, 0x16 }, { 0x3A, 0x70, 0x1A, 0x18 }, + { 0x3C, 0x64, 0x1E, 0x1E }, { 0x3E, 0x6A, 0x1C, 0x10 } }; -const struct_08108228 gUnk_08108288[6] = { - {0x98, 0x2A, 0x1C, 0x10}, - {0x98, 0x24, 0x1C, 0x12}, - {0x9C, 0x1C, 0x1A, 0x18}, - {0x9C, 0x16, 0x1C, 0x16}, - {0xA0, 0x16, 0x1E, 0x0E}, - {0xA0, 0x16, 0x20, 0x0A} -}; +const struct_08108228 gUnk_08108288[6] = { { 0x98, 0x2A, 0x1C, 0x10 }, { 0x98, 0x24, 0x1C, 0x12 }, + { 0x9C, 0x1C, 0x1A, 0x18 }, { 0x9C, 0x16, 0x1C, 0x16 }, + { 0xA0, 0x16, 0x1E, 0x0E }, { 0xA0, 0x16, 0x20, 0x0A } }; -const struct_08108228 gUnk_081082B8[6] = { - {0xA0, 0x88, 0x20, 0x0A}, - {0x9E, 0x7E, 0x1E, 0x12}, - {0x9C, 0x78, 0x1A, 0x16}, - {0x9A, 0x70, 0x1A, 0x18}, - {0x98, 0x64, 0x1E, 0x1E}, - {0x98, 0x6A, 0x1C, 0x10} -}; +const struct_08108228 gUnk_081082B8[6] = { { 0xA0, 0x88, 0x20, 0x0A }, { 0x9E, 0x7E, 0x1E, 0x12 }, + { 0x9C, 0x78, 0x1A, 0x16 }, { 0x9A, 0x70, 0x1A, 0x18 }, + { 0x98, 0x64, 0x1E, 0x1E }, { 0x98, 0x6A, 0x1C, 0x10 } }; void sub_08058A04(ManagerC* this) { s32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX; s32 tmp2 = gPlayerEntity.y.HALF.HI - gRoomControls.roomOriginY; - if ((this->unk_20 - 0x118 < 0xDu) && - CheckGlobalFlag(LV1TARU_OPEN) && - (tmp - 0x6d < 0x17u) && - (tmp2 - 0x45 < 0x17u) && - (gPlayerEntity.height.HALF.HI == 0)) { + if ((this->unk_20 - 0x118 < 0xDu) && CheckGlobalFlag(LV1TARU_OPEN) && (tmp - 0x6d < 0x17u) && + (tmp2 - 0x45 < 0x17u) && (gPlayerEntity.height.HALF.HI == 0)) { gPlayerState.playerAction = 3; gPlayerState.field_0x38 = 0; gPlayerEntity.x.HALF.HI = gRoomControls.roomOriginX + 0x78; @@ -228,12 +201,7 @@ u32 sub_08058B08(ManagerC* this, u32 unk1, u32 unk2, const struct_08108228* unk3 } } -const u16 gUnk_081082E8[0xC] = { - 0xB8, 0x80, 0x0, - 0xB8, 0x110, 0x2, - 0x118, 0x80, 0x2, - 0x118, 0x110, 0x0 -}; +const u16 gUnk_081082E8[0xC] = { 0xB8, 0x80, 0x0, 0xB8, 0x110, 0x2, 0x118, 0x80, 0x2, 0x118, 0x110, 0x0 }; void sub_08058B5C(ManagerC* this, u32 unk1) { gScreenTransition.transitioningOut = 1; @@ -242,14 +210,14 @@ void sub_08058B5C(ManagerC* this, u32 unk1) { gScreenTransition.areaID = gRoomControls.areaID; gScreenTransition.roomID = 6; gScreenTransition.playerState = unk1 & 1 ? 4 : 0; - gScreenTransition.playerStartPos.HALF.x = gUnk_081082E8[unk1*3]; - gScreenTransition.playerStartPos.HALF.y = gUnk_081082E8[unk1*3+1]; - gSave.unk7 = gUnk_081082E8[unk1*3+2]; + gScreenTransition.playerStartPos.HALF.x = gUnk_081082E8[unk1 * 3]; + gScreenTransition.playerStartPos.HALF.y = gUnk_081082E8[unk1 * 3 + 1]; + gSave.unk7 = gUnk_081082E8[unk1 * 3 + 2]; PlaySFX(0x121); } void sub_08058BC8(ManagerC* this) { - struct BgAffineDstData * tmp = &gUnk_02017AA0[gUnk_03003DE4[0]*0xA0]; + struct BgAffineDstData* tmp = &gUnk_02017AA0[gUnk_03003DE4[0] * 0xA0]; struct BgAffineSrcData tmp2; s32 tmp3; tmp2.texX = 0x10000; @@ -262,25 +230,25 @@ void sub_08058BC8(ManagerC* this) { do { u32 indx = ((tmp3 << 7) / 0xA0) & 0xFF; tmp2.sx = 0x100 + ((gSineTable[indx] * 3) >> 2); - tmp2.sy = 0x100 - ((gSineTable[indx * 2] * 2) >> 5);//yes, it makes no sense to multiply first and then shift right, but it's matching this way + tmp2.sy = + 0x100 - ((gSineTable[indx * 2] * 2) >> + 5); // yes, it makes no sense to multiply first and then shift right, but it's matching this way tmp2.texY = (this->unk_20 + tmp3) << 8; BgAffineSet(&tmp2, tmp, 1); tmp++; - } while (++tmp3<0xA0u); - tmp = &gUnk_02017BA0[gUnk_03003DE4[0]*0xA0]; + } while (++tmp3 < 0xA0u); + tmp = &gUnk_02017BA0[gUnk_03003DE4[0] * 0xA0]; gScreen.controls.bg2dx = tmp->pa; gScreen.controls.bg2dmx = tmp->pb; gScreen.controls.bg2dy = tmp->pc; gScreen.controls.bg2dmy = tmp->pd; - gScreen.controls.bg2xPointLeastSig = ((union SplitWord *) &tmp->dx)->HALF.LO; - gScreen.controls.bg2xPointMostSig = ((union SplitWord *) &tmp->dx)->HALF.HI; - gScreen.controls.bg2yPointLeastSig = ((union SplitWord *) &tmp->dy)->HALF.LO; - gScreen.controls.bg2yPointMostSig = ((union SplitWord *) &tmp->dy)->HALF.HI; + gScreen.controls.bg2xPointLeastSig = ((union SplitWord*)&tmp->dx)->HALF.LO; + gScreen.controls.bg2xPointMostSig = ((union SplitWord*)&tmp->dx)->HALF.HI; + gScreen.controls.bg2yPointLeastSig = ((union SplitWord*)&tmp->dy)->HALF.LO; + gScreen.controls.bg2yPointMostSig = ((union SplitWord*)&tmp->dy)->HALF.HI; } -const u16 gUnk_08108300[4] = { - 0xA4, 0x4C, 0xF4, 0x9C -}; +const u16 gUnk_08108300[4] = { 0xA4, 0x4C, 0xF4, 0x9C }; void sub_08058CB0(ManagerC* this) { u32 tmp = gPlayerEntity.x.HALF.HI - gRoomControls.roomOriginX; diff --git a/src/npc/festari.c b/src/npc/festari.c index fa1dac19..ad1635bd 100644 --- a/src/npc/festari.c +++ b/src/npc/festari.c @@ -38,7 +38,7 @@ void sub_0805FE48(Entity* this) { InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); sub_0806F118(this); } else { - ExecuteScriptCommandSet(this, *(ScriptExecutionContext **)&this->cutsceneBeh); + ExecuteScriptCommandSet(this, *(ScriptExecutionContext**)&this->cutsceneBeh); sub_0805FF2C(this, *(void**)&this->cutsceneBeh); uVar4 = this->field_0x80.HWORD; if (uVar4 < 8) { diff --git a/src/object/houseDoorExterior.c b/src/object/houseDoorExterior.c index ddf5b87e..8ef49de2 100644 --- a/src/object/houseDoorExterior.c +++ b/src/object/houseDoorExterior.c @@ -65,7 +65,7 @@ void sub_080866D8(Entity* this) { UpdateSpriteForCollisionLayer(entity); *((u32*)(&this->field_0x68)) |= mask; if (prop->unk8) { - *((ScriptExecutionContext **)(&entity->cutsceneBeh)) = StartCutscene(entity, (u16*)prop->unk8); + *((ScriptExecutionContext**)(&entity->cutsceneBeh)) = StartCutscene(entity, (u16*)prop->unk8); } } } @@ -117,7 +117,7 @@ static void sub_0808681C(Entity* this) { } if (this->flags & 0x2) { - ExecuteScriptCommandSet(this, *(ScriptExecutionContext **)&this->cutsceneBeh); + ExecuteScriptCommandSet(this, *(ScriptExecutionContext**)&this->cutsceneBeh); sub_080868EC(this, *(void**)&this->cutsceneBeh); } } @@ -129,7 +129,7 @@ void sub_080868B0(Entity* this) { this->boundingBox = &gUnk_081206AC; this->actionDelay = 8; } - ExecuteScriptCommandSet(this, *(ScriptExecutionContext **)&this->cutsceneBeh); + ExecuteScriptCommandSet(this, *(ScriptExecutionContext**)&this->cutsceneBeh); sub_080868EC(this, *(void**)&this->cutsceneBeh); } diff --git a/src/player.c b/src/player.c index f4264601..8b1c47b0 100644 --- a/src/player.c +++ b/src/player.c @@ -487,7 +487,7 @@ void sub_080712F0(Entity* this) { sub_08079458(); } -void sub_08071380(Entity *this) { +void sub_08071380(Entity* this) { gPlayerState.field_0xa8 = 0xe; gUnk_0811BA9C[this->previousActionFlag](this); @@ -499,7 +499,7 @@ void sub_08071380(Entity *this) { if ((gInput.newKeys & 0x102) == 0) return; - + if (CheckIsDungeon() || gArea.field_0x17 == 3) { this->previousActionFlag = 7; this->actionDelay = 30; @@ -528,7 +528,7 @@ void sub_08071400(Entity* this) { sub_08073904(this); UpdateAnimationSingleFrame(this); - + if (gPlayerState.jumpStatus == 0) { gPlayerState.flags.all |= 0x20; this->previousActionFlag = 1; @@ -538,9 +538,9 @@ void sub_08071400(Entity* this) { gPlayerState.field_0x8 = 0x52c; } } - + this->actionDelay = 8; - + if (gArea.field_0x17 != 3) { this->spritePriority.b0 = 3; } diff --git a/src/playerItem.c b/src/playerItem.c index 97c37c23..364502d0 100644 --- a/src/playerItem.c +++ b/src/playerItem.c @@ -21,29 +21,8 @@ extern void sub_080A306C(); extern void NulledItem(); void (*const gPlayerItemFunctions[])() = { - DeleteEntity, - sub_080A7544, - sub_0801B188, - sub_0801B45C, - sub_08018FCC, - sub_080A2D74, - sub_08054A40, - sub_08056330, - sub_080ADA30, - sub_080704BC, - DeleteEntity, - DeleteEntity, - sub_0801B898, - CellOverwriteSet, - SwordSpin, - SwordBeam, - sub_080ACBCC, - Item11, - sub_080700E8, - sub_080ACF14, - Item14, - sub_080A306C, - SwordBeam, - NulledItem, - CellOverwriteSet + DeleteEntity, sub_080A7544, sub_0801B188, sub_0801B45C, sub_08018FCC, sub_080A2D74, sub_08054A40, + sub_08056330, sub_080ADA30, sub_080704BC, DeleteEntity, DeleteEntity, sub_0801B898, CellOverwriteSet, + SwordSpin, SwordBeam, sub_080ACBCC, Item11, sub_080700E8, sub_080ACF14, Item14, + sub_080A306C, SwordBeam, NulledItem, CellOverwriteSet }; diff --git a/src/save.c b/src/save.c index 281e54c5..c6d0bfcd 100644 --- a/src/save.c +++ b/src/save.c @@ -203,71 +203,71 @@ u32 sub_0807CF88(u32 arg0, u8* arg1) { } NONMATCH("asm/non_matching/save/sub_0807D008.inc", u32 sub_0807D008(u32 param_1, SaveFile* saveFile)) { - u32 set_0; - char auStack32[8]; + u32 set_0; + char auStack32[8]; - struct_0807D1C4* unk_s; - u32 t1; - u32 t2; - u32 ret; - u32 temp; + struct_0807D1C4* unk_s; + u32 t1; + u32 t2; + u32 ret; + u32 temp; - unk_s = sub_0807D1C4(param_1); - t1 = sub_0807D0EC(unk_s->field_0x2, auStack32); - if (t1 == 2) { - if ((sub_0807D1D8(unk_s->field_0x6, (char*)saveFile, unk_s->field_0x0) == 0) || - (sub_0807D0A0((u16*)auStack32, (u16*)saveFile, (u32)unk_s->field_0x0) == 0)) { - t1 = 0; - } else { - return 1; - } + unk_s = sub_0807D1C4(param_1); + t1 = sub_0807D0EC(unk_s->field_0x2, auStack32); + if (t1 == 2) { + if ((sub_0807D1D8(unk_s->field_0x6, (char*)saveFile, unk_s->field_0x0) == 0) || + (sub_0807D0A0((u16*)auStack32, (u16*)saveFile, (u32)unk_s->field_0x0) == 0)) { + t1 = 0; + } else { + return 1; } - t2 = sub_0807D0EC(unk_s->field_0x4, auStack32); - if (t2 == 2) { - if ((sub_0807D1D8(unk_s->field_0x8, (char*)saveFile, unk_s->field_0x0) != 0) && - (sub_0807D0A0((u16*)auStack32, (u16*)saveFile, (u32)unk_s->field_0x0) != 0)) { - return 1; - } - t2 = 0; - } - set_0 = 0; - CpuSet(&set_0, saveFile, unk_s->field_0x0 >> 2 | CPU_SET_SRC_FIXED | CPU_SET_32BIT); - temp = t1 | t2; - ret = 0; - if (temp == 0) { - ret = -1; - } - return ret; } + t2 = sub_0807D0EC(unk_s->field_0x4, auStack32); + if (t2 == 2) { + if ((sub_0807D1D8(unk_s->field_0x8, (char*)saveFile, unk_s->field_0x0) != 0) && + (sub_0807D0A0((u16*)auStack32, (u16*)saveFile, (u32)unk_s->field_0x0) != 0)) { + return 1; + } + t2 = 0; + } + set_0 = 0; + CpuSet(&set_0, saveFile, unk_s->field_0x0 >> 2 | CPU_SET_SRC_FIXED | CPU_SET_32BIT); + temp = t1 | t2; + ret = 0; + if (temp == 0) { + ret = -1; + } + return ret; +} END_NONMATCH NONMATCH("asm/non_matching/save/sub_0807D0A0.inc", u32 sub_0807D0A0(u16* unk_1, u16* unk_2, u32 unk_3)) { - u32 r0; + u32 r0; - u32* u32_1 = (u32*)unk_1; + u32* u32_1 = (u32*)unk_1; - u16 u0; - u32 u1; + u16 u0; + u32 u1; - u0 = sub_0807D1A4(unk_1 + 2, 4); - u0 = u0 + sub_0807D1A4(unk_2, unk_3); + u0 = sub_0807D1A4(unk_1 + 2, 4); + u0 = u0 + sub_0807D1A4(unk_2, unk_3); - u1 = unk_1[0]; - if (u1 != u0) { - r0 = 0; - } else { - if (unk_1[1] == (-(u1 << 0x10) >> 0x10)) { - if (*(u32_1 + 1) != 'MCZ3') { - r0 = 0; - } else { - r0 = 1; - } - } else { + u1 = unk_1[0]; + if (u1 != u0) { + r0 = 0; + } else { + if (unk_1[1] == (-(u1 << 0x10) >> 0x10)) { + if (*(u32_1 + 1) != 'MCZ3') { r0 = 0; + } else { + r0 = 1; } + } else { + r0 = 0; } - return r0; } + return r0; +} END_NONMATCH u32 sub_0807D0EC(u32 unk_1, const char* unk_2) { @@ -336,33 +336,33 @@ struct_0807D1C4* sub_0807D1C4(u32 unk_1) { // these three are basically the same and wrong by basically one instruction in the wrong place NONMATCH("asm/non_matching/save/sub_0807D1D8.inc", u32 sub_0807D1D8(u32 unk_1, const char* unk_2, u32 unk_3)) { - } +} END_NONMATCH NONMATCH("asm/non_matching/save/sub_0807D20C.inc", u32 sub_0807D20C(u32 unk_1, const char* unk_2, u32 unk_3)) { - unk_3 >>= 3; - unk_1 >>= 3; - while (unk_3-- > 0) { - if (sub_080B18DC(unk_1, unk_2)) { - sub_080B18DC(unk_1, gUnk_0811E4B4); - return 0; - } - unk_1++; - unk_2 += 8; + unk_3 >>= 3; + unk_1 >>= 3; + while (unk_3-- > 0) { + if (sub_080B18DC(unk_1, unk_2)) { + sub_080B18DC(unk_1, gUnk_0811E4B4); + return 0; } - return 1; + unk_1++; + unk_2 += 8; } + return 1; +} END_NONMATCH NONMATCH("asm/non_matching/save/sub_0807D24C.inc", u32 sub_0807D24C(u32 unk_1, const char* unk_2, u32 unk_3)) { - unk_3 >>= 3; - unk_1 >>= 3; - while (unk_3-- > 0) { - if (sub_080B180C(unk_1, unk_2)) - return 0; - unk_1++; - unk_2 += 8; - } - return 1; + unk_3 >>= 3; + unk_1 >>= 3; + while (unk_3-- > 0) { + if (sub_080B180C(unk_1, unk_2)) + return 0; + unk_1++; + unk_2 += 8; } + return 1; +} END_NONMATCH diff --git a/src/screenDebug.c b/src/screenDebug.c index a370e373..5efe9713 100644 --- a/src/screenDebug.c +++ b/src/screenDebug.c @@ -18,7 +18,7 @@ extern u8 gBG3Buffer[]; extern void (*const gUnk_08109A30[])(); void HandleDebugTextScreen() { - gUnk_08109A30[gUnk_03001000.funcIndex](); + gUnk_08109A30[gUnk_03001000.funcIndex](); } void sub_0805FA04(void) { diff --git a/src/script.c b/src/script.c index 2f38b5f3..c5284391 100644 --- a/src/script.c +++ b/src/script.c @@ -12,7 +12,7 @@ void sub_0807DAF0(Entity*, ScriptExecutionContext*, u16*); void sub_0807DB88(ScriptExecutionContext*, u16*); void sub_0807DE80(Entity*); void sub_0807DF38(void); -void nullsub_507 (Entity*, ScriptExecutionContext*); +void nullsub_507(Entity*, ScriptExecutionContext*); void sub_0807E004(Entity*, ScriptExecutionContext*); void sub_0807E014(Entity*, ScriptExecutionContext*); void sub_0807E024(Entity*, ScriptExecutionContext*); @@ -71,7 +71,7 @@ void sub_0807E75C(Entity*, ScriptExecutionContext*); void sub_0807E778(Entity*, ScriptExecutionContext*); void sub_0807E788(Entity*, ScriptExecutionContext*); void sub_0807E79C(Entity*, ScriptExecutionContext*); -void nullsub_508 (Entity*, ScriptExecutionContext*); +void nullsub_508(Entity*, ScriptExecutionContext*); void sub_0807E7B0(Entity*, ScriptExecutionContext*); void sub_0807E7C4(Entity*, ScriptExecutionContext*); void sub_0807E7D8(Entity*, ScriptExecutionContext*); @@ -118,7 +118,7 @@ void sub_0807EBC8(Entity*, ScriptExecutionContext*); void sub_0807EBD8(Entity*, ScriptExecutionContext*); void sub_0807EBF4(Entity*, ScriptExecutionContext*); void sub_0807EC08(Entity*, ScriptExecutionContext*); -void nullsub_509 (Entity*, ScriptExecutionContext*); +void nullsub_509(Entity*, ScriptExecutionContext*); void sub_0807EC1C(Entity*, ScriptExecutionContext*); void sub_0807EC44(Entity*, ScriptExecutionContext*); void sub_0807EC64(Entity*, ScriptExecutionContext*); @@ -155,146 +155,29 @@ extern void CreateSpeechBubbleExclamationMark(Entity*, u32, u32); extern void CreateSpeechBubbleQuestionMark(Entity*, u32, u32); extern void sub_0801C4A0(u32); -void (* const gUnk_0811E524[])() = { - nullsub_507, - sub_0807E004, - sub_0807E014, - sub_0807E024, - sub_0807E050, - sub_0807E064, - sub_0807E078, - sub_0807E0A0, - sub_0807E0B8, - sub_0807E0CC, - sub_0807E0E0, - sub_0807E10C, - sub_0807E124, - sub_0807E148, - sub_0807E158, - sub_0807E188, +void (*const gUnk_0811E524[])() = { + nullsub_507, sub_0807E004, sub_0807E014, sub_0807E024, sub_0807E050, sub_0807E064, sub_0807E078, sub_0807E0A0, + sub_0807E0B8, sub_0807E0CC, sub_0807E0E0, sub_0807E10C, sub_0807E124, sub_0807E148, sub_0807E158, sub_0807E188, sub_0807E1D8, - sub_0807E4AC,//defined out of order - sub_0807E200, - sub_0807E220, - sub_0807E240, - sub_0807E260, - sub_0807E280, - sub_0807E2A8, - sub_0807E2E4, - sub_0807E30C, - sub_0807E390, - sub_0807E3BC, - sub_0807E3E8, - sub_0807E40C, - sub_0807E42C, - sub_0807E48C, - sub_0807E4CC, - sub_0807E4EC, - sub_0807E514, - sub_0807E538, - sub_0807E564, - sub_0807E584, - sub_0807E5A0, - sub_0807E5CC, - sub_0807E5F8, - sub_0807E610, - sub_0807E628, - sub_0807E634, - sub_0807E644, - sub_0807E650, - sub_0807E65C, - sub_0807E668, - sub_0807E674, - sub_0807E680, - sub_0807E690, - sub_0807E6AC, - sub_0807E6DC, - sub_0807E700, - sub_0807E72C, - sub_0807E75C, - sub_0807E778, - sub_0807E788, - sub_0807E79C, - nullsub_508, - sub_0807E7B0, - sub_0807E7C4, - sub_0807E7D8, - sub_0807E7EC, - sub_0807E800, - sub_0807E80C, - sub_0807E858, - sub_0807E864, - sub_0807E878, - sub_0807E888, - sub_0807E898, - sub_0807E8C4, - sub_0807E8D4, - sub_0807E8E4, - sub_0807E8E4,//duplicate - sub_0807E8E4,//duplicate - sub_0807E8E4,//duplicate - sub_0807E908, - sub_0807E914, - sub_0807E924, - sub_0807E930, - sub_0807E944, - sub_0807E974, - sub_0807E9D4, - sub_0807E9DC, - sub_0807E9E4, - sub_0807E9F0, - sub_0807EA4C, - sub_0807EA88, - sub_0807EA94, - sub_0807EAB4, - sub_0807EAC0, - sub_0807EAD0, - sub_0807EAF0, - sub_0807EB18, - sub_0807EB28, - sub_0807EB38, - sub_0807EB44, - sub_0807EB4C, - sub_0807EB74, - sub_0807EB8C, - sub_0807EBA8, - sub_0807EBB0, - sub_0807EBC0, - sub_0807EBC8, - sub_0807EBD8, - sub_0807EBF4, - sub_0807EC08, - nullsub_509, - sub_0807EC1C, - sub_0807EC64, - sub_0807EC94, - sub_0807ECC4, - sub_0807ECF4, - sub_0807ED24, - sub_0807EDD4, - sub_0807EE04, - sub_0807EE30, - sub_0807EEB4, - sub_0807EEF4, - sub_0807EF3C, - sub_0807EF80, - sub_0807EF90, - sub_0807EFA0, - sub_0807EFAC, - sub_0807EFD4, - sub_0807EFE4, - sub_0807EFF4, - sub_0807F004, - sub_0807F010, - sub_0807F034, - sub_0807F050, - sub_0807F060, - sub_0807F078, - sub_0807F088, - sub_0807F098, - sub_0807F0A4, - sub_0807F0B4, - sub_0807F0C8 + sub_0807E4AC, // defined out of order + sub_0807E200, sub_0807E220, sub_0807E240, sub_0807E260, sub_0807E280, sub_0807E2A8, sub_0807E2E4, sub_0807E30C, + sub_0807E390, sub_0807E3BC, sub_0807E3E8, sub_0807E40C, sub_0807E42C, sub_0807E48C, sub_0807E4CC, sub_0807E4EC, + sub_0807E514, sub_0807E538, sub_0807E564, sub_0807E584, sub_0807E5A0, sub_0807E5CC, sub_0807E5F8, sub_0807E610, + sub_0807E628, sub_0807E634, sub_0807E644, sub_0807E650, sub_0807E65C, sub_0807E668, sub_0807E674, sub_0807E680, + sub_0807E690, sub_0807E6AC, sub_0807E6DC, sub_0807E700, sub_0807E72C, sub_0807E75C, sub_0807E778, sub_0807E788, + sub_0807E79C, nullsub_508, sub_0807E7B0, sub_0807E7C4, sub_0807E7D8, sub_0807E7EC, sub_0807E800, sub_0807E80C, + sub_0807E858, sub_0807E864, sub_0807E878, sub_0807E888, sub_0807E898, sub_0807E8C4, sub_0807E8D4, sub_0807E8E4, + sub_0807E8E4, // duplicate + sub_0807E8E4, // duplicate + sub_0807E8E4, // duplicate + sub_0807E908, sub_0807E914, sub_0807E924, sub_0807E930, sub_0807E944, sub_0807E974, sub_0807E9D4, sub_0807E9DC, + sub_0807E9E4, sub_0807E9F0, sub_0807EA4C, sub_0807EA88, sub_0807EA94, sub_0807EAB4, sub_0807EAC0, sub_0807EAD0, + sub_0807EAF0, sub_0807EB18, sub_0807EB28, sub_0807EB38, sub_0807EB44, sub_0807EB4C, sub_0807EB74, sub_0807EB8C, + sub_0807EBA8, sub_0807EBB0, sub_0807EBC0, sub_0807EBC8, sub_0807EBD8, sub_0807EBF4, sub_0807EC08, nullsub_509, + sub_0807EC1C, sub_0807EC64, sub_0807EC94, sub_0807ECC4, sub_0807ECF4, sub_0807ED24, sub_0807EDD4, sub_0807EE04, + sub_0807EE30, sub_0807EEB4, sub_0807EEF4, sub_0807EF3C, sub_0807EF80, sub_0807EF90, sub_0807EFA0, sub_0807EFAC, + sub_0807EFD4, sub_0807EFE4, sub_0807EFF4, sub_0807F004, sub_0807F010, sub_0807F034, sub_0807F050, sub_0807F060, + sub_0807F078, sub_0807F088, sub_0807F098, sub_0807F0A4, sub_0807F0B4, sub_0807F0C8 }; extern const u16 gUnk_08016984; @@ -599,16 +482,18 @@ void sub_0807DF50(void) { } void ExecuteScriptCommandSet(Entity* unk1, ScriptExecutionContext* unk2) { - if (!unk2->unk_00) return; + if (!unk2->unk_00) + return; if (unk2->unk_10) { unk2->unk_10--; } else { - struct_02033280 * tmp2 = &gUnk_02033280; + struct_02033280* tmp2 = &gUnk_02033280; tmp2->unk_07 = 0; do { u32 cmd = GetNextScriptCommandHalfword(unk2->unk_00); u16* tmp; - if (cmd == 0xFFFF) return; + if (cmd == 0xFFFF) + return; tmp2->unk_06 = cmd >> 0xA; tmp2->unk_04 = cmd & 0x3FF; tmp = unk2->unk_00; @@ -622,7 +507,8 @@ void ExecuteScriptCommandSet(Entity* unk1, ScriptExecutionContext* unk2) { } } -void nullsub_507(Entity* unk1, ScriptExecutionContext* unk2) {} +void nullsub_507(Entity* unk1, ScriptExecutionContext* unk2) { +} void sub_0807E004(Entity* unk1, ScriptExecutionContext* unk2) { gUnk_02033280.unk_07 |= 2; @@ -660,7 +546,7 @@ void sub_0807E078(Entity* unk1, ScriptExecutionContext* unk2) { } void sub_0807E0A0(Entity* unk1, ScriptExecutionContext* unk2) { - unk2->unk_00 = (u16*) GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00); + unk2->unk_00 = (u16*)GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00); gUnk_02033280.unk_06 = 0; } @@ -684,11 +570,13 @@ void sub_0807E0E0(Entity* unk1, ScriptExecutionContext* unk2) { } void sub_0807E10C(Entity* unk1, ScriptExecutionContext* unk2) { - ((void (*)(Entity*, ScriptExecutionContext*)) GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00))(unk1, unk2); + ((void (*)(Entity*, ScriptExecutionContext*))GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00))(unk1, + unk2); } void sub_0807E124(Entity* unk1, ScriptExecutionContext* unk2) { - void (* tmp)(Entity*, ScriptExecutionContext*) = (void (*)(Entity*, ScriptExecutionContext*)) GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00); + void (*tmp)(Entity*, ScriptExecutionContext*) = + (void (*)(Entity*, ScriptExecutionContext*))GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00); unk2->unk_04 = GetNextScriptCommandWord(unk2->unk_00 + 3); tmp(unk1, unk2); } @@ -701,7 +589,8 @@ void sub_0807E158(Entity* unk1, ScriptExecutionContext* unk2) { u32 tmp = GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00); u32 tmp2 = 0; u32 tmp3 = gUnk_02033280.unk_00; - if ((tmp3 & tmp) == tmp) tmp2 = 1; + if ((tmp3 & tmp) == tmp) + tmp2 = 1; unk2->unk_14 = tmp2; gUnk_02033280.unk_00 = tmp3 & ~tmp; gUnk_02033280.unk_07 |= 1; @@ -762,7 +651,7 @@ void sub_0807E280(Entity* unk1, ScriptExecutionContext* unk2) { width &= 0xFF; x = unk2->unk_00[1]; y = unk2->unk_00[2]; - unk2->unk_14 = CheckPlayerInRegion(x,y,width, height); + unk2->unk_14 = CheckPlayerInRegion(x, y, width, height); gUnk_02033280.unk_07 |= 1; } @@ -772,7 +661,7 @@ void sub_0807E2A8(Entity* unk1, ScriptExecutionContext* unk2) { height = unk2->unk_00[1] >> 8; x = unk1->x.HALF.HI - gRoomControls.roomOriginX; y = unk1->y.HALF.HI - gRoomControls.roomOriginY; - unk2->unk_14 = CheckPlayerInRegion(x,y,width, height); + unk2->unk_14 = CheckPlayerInRegion(x, y, width, height); gUnk_02033280.unk_07 |= 1; } @@ -787,9 +676,8 @@ void sub_0807E2E4(Entity* unk1, ScriptExecutionContext* unk2) { } void sub_0807E30C(Entity* unk1, ScriptExecutionContext* unk2) { - if ((unk2->unk_1A & 0xF) == 0 - && (gPlayerState.flags.all & 0x80) == 0 - && sub_080041A0(unk1, &gPlayerEntity, 0x28, 0x28)) { + if ((unk2->unk_1A & 0xF) == 0 && (gPlayerState.flags.all & 0x80) == 0 && + sub_080041A0(unk1, &gPlayerEntity, 0x28, 0x28)) { unk1->animationState = sub_0806F5B0(GetFacingDirection(unk1, &gPlayerEntity)); } unk2->unk_1A++; @@ -994,7 +882,8 @@ void sub_0807E79C(Entity* unk1, ScriptExecutionContext* unk2) { sub_080500F4(gUnk_02033280.unk_08); } -void nullsub_508(Entity* unk1, ScriptExecutionContext* unk2) {} +void nullsub_508(Entity* unk1, ScriptExecutionContext* unk2) { +} void sub_0807E7B0(Entity* unk1, ScriptExecutionContext* unk2) { DoFade(4, gUnk_02033280.unk_08); @@ -1103,16 +992,19 @@ void sub_0807E944(Entity* unk1, ScriptExecutionContext* unk2) { void sub_0807E974(Entity* unk1, ScriptExecutionContext* unk2) { switch (unk2->unk_18) { default: - if (!--unk2->unk_19) return; + if (!--unk2->unk_19) + return; break; case 0: - if (!unk1->interactType) break; + if (!unk1->interactType) + break; unk1->interactType = 0; unk2->unk_18++; TextboxNoOverlapFollow(unk2->unk_00[1]); break; case 1: - if (gTextBox.doTextBox & 0x7F) break; + if (gTextBox.doTextBox & 0x7F) + break; unk2->unk_18 = 2; unk2->unk_19 = 0xF; break; @@ -1152,7 +1044,7 @@ void sub_0807E9F0(Entity* unk1, ScriptExecutionContext* unk2) { sub_0807919C(); gPlayerState.field_0x8b = 1; } else { - lbl: + lbl: gUnk_02033280.unk_06 = 0; } } @@ -1193,7 +1085,7 @@ void sub_0807EAD0(Entity* unk1, ScriptExecutionContext* unk2) { void sub_0807EAF0(Entity* unk1, ScriptExecutionContext* unk2) { if (gUnk_02033280.unk_06 > unk2->unk_04) { - u16 * tmp = unk2->unk_00 + unk2->unk_04; + u16* tmp = unk2->unk_00 + unk2->unk_04; TextboxNoOverlapFollow(tmp[1]); } else { TextboxNoOverlapFollow(0); @@ -1217,7 +1109,8 @@ void sub_0807EB44(Entity* unk1, ScriptExecutionContext* unk2) { } void sub_0807EB4C(Entity* unk1, ScriptExecutionContext* unk2) { - unk1->animationState = sub_0806F5B0(sub_080045B4(unk1, unk2->unk_00[1] + gRoomControls.roomOriginX, unk2->unk_00[2] + gRoomControls.roomOriginY)); + unk1->animationState = sub_0806F5B0( + sub_080045B4(unk1, unk2->unk_00[1] + gRoomControls.roomOriginX, unk2->unk_00[2] + gRoomControls.roomOriginY)); } void sub_0807EB74(Entity* unk1, ScriptExecutionContext* unk2) { @@ -1259,7 +1152,8 @@ void sub_0807EC08(Entity* unk1, ScriptExecutionContext* unk2) { CopyPosition(&gPlayerEntity, unk1); } -void nullsub_509(Entity* unk1, ScriptExecutionContext* unk2) {} +void nullsub_509(Entity* unk1, ScriptExecutionContext* unk2) { +} void sub_0807EC1C(Entity* unk1, ScriptExecutionContext* unk2) { if (!unk2->unk_18) { @@ -1332,7 +1226,8 @@ void sub_0807ED24(Entity* unk1, ScriptExecutionContext* unk2) { tmp = unk2->unk_00[2]; tmp3 = unk1->y.HALF.HI - gRoomControls.roomOriginY; unk2->unk_20.WORD = ((tmp - tmp3) << 0x10) / unk2->unk_12; - unk1->animationState = sub_0806F5B0(sub_080045B4(unk1, unk2->unk_00[1] + gRoomControls.roomOriginX, unk2->unk_00[2] + gRoomControls.roomOriginY)); + unk1->animationState = sub_0806F5B0(sub_080045B4(unk1, unk2->unk_00[1] + gRoomControls.roomOriginX, + unk2->unk_00[2] + gRoomControls.roomOriginY)); unk2->unk_08 |= 2; } else { if (!--unk2->unk_12) { @@ -1407,11 +1302,12 @@ void sub_0807EEF4(Entity* unk1, ScriptExecutionContext* unk2) { void sub_0807EF3C(Entity* unk1, ScriptExecutionContext* unk2) { if (!unk2->unk_18) { unk2->unk_18 = 1; - unk1->field_0x20 = ((s16) unk2->unk_00[1]) << 8; + unk1->field_0x20 = ((s16)unk2->unk_00[1]) << 8; unk2->unk_1C.HALF.LO = unk2->unk_00[2] << 8; sub_08003FC4(unk1, (u16)unk2->unk_1C.HALF.LO); } else { - if (!sub_08003FC4(unk1, (u16)unk2->unk_1C.HALF.LO)) return; + if (!sub_08003FC4(unk1, (u16)unk2->unk_1C.HALF.LO)) + return; } gUnk_02033280.unk_06 = 0; }