From a0f7b73e6620db7a49fe55a3ee2765b1ce8074ff Mon Sep 17 00:00:00 2001 From: Elliptic Ellipsis Date: Sat, 19 Mar 2022 05:50:41 +0000 Subject: [PATCH] Misc prototype cleanup --- include/functions.h | 13 +++++++------ src/enemy/armos.c | 4 ++-- src/enemy/darkNut.c | 2 -- src/enemy/flyingPot.c | 20 ++++++++++++-------- src/enemy/gibdo.c | 3 --- src/enemy/octorokGolden.c | 3 --- src/enemy/peahat.c | 3 --- src/enemy/rockChuchu.c | 2 -- src/enemy/rope.c | 1 - src/enemy/ropeGolden.c | 3 --- src/enemy/slime.c | 2 -- src/enemy/sluggula.c | 6 +----- src/enemy/spinyChuchu.c | 5 ----- 13 files changed, 22 insertions(+), 45 deletions(-) diff --git a/include/functions.h b/include/functions.h index ea3d6ce3..59505428 100644 --- a/include/functions.h +++ b/include/functions.h @@ -52,7 +52,7 @@ extern void LoadResources(void); extern bool32 LoadSwapGFX(Entity*, u16, u32); extern void MenuFadeIn(u32, u32); extern void ModBombs(s32); -extern u32 PlayerInRange(Entity*, u32, u32); +extern bool32 PlayerInRange(Entity*, u32, s32); extern bool32 ProcessMovement1(Entity*); extern bool32 ProcessMovement12(Entity*); extern bool32 ProcessMovement2(Entity*); @@ -130,15 +130,16 @@ extern void sub_0803C0AC(Entity*); extern void sub_08049CF4(Entity*); extern Entity* sub_08049DF4(u32); extern u32 sub_08049EE4(Entity*); -extern u32 sub_08049F1C(Entity*, Entity*, u32); -extern u32 sub_08049F84(Entity*, u32); -extern u32 sub_08049FA0(Entity*); -extern u32 sub_08049FDC(Entity*, u32); +extern bool32 sub_08049F1C(Entity*, Entity*, s32); +extern bool32 sub_08049F84(Entity*, s32); +extern bool32 sub_08049FA0(Entity*); +extern bool32 sub_08049FDC(Entity*, u32); extern u32 sub_0804A024(Entity*, u32, u32); extern u32 sub_0804A044(Entity*, Entity*, u32); +extern void sub_0804A4E4(Entity*, Entity*); extern void sub_0804A720(Entity*); extern void sub_0804AA1C(Entity*); -extern void sub_0804C128(); +extern void sub_0804C128(void); extern u32 sub_080542AC(u32); extern void sub_08054564(); extern void sub_08054570(void); diff --git a/src/enemy/armos.c b/src/enemy/armos.c index 0fd596a2..09c732e7 100644 --- a/src/enemy/armos.c +++ b/src/enemy/armos.c @@ -306,12 +306,12 @@ bool32 sub_08030650(ArmosEntity* this) { return 1; } } else if (this->unk_80 != 2) { - if ((sub_08049FDC(super, 1) == 0) || (0x20 < (gUnk_020000B0->x.HALF.HI - super->x.HALF.HI) + 0x10U)) { + if (!sub_08049FDC(super, 1) || (0x20 < (gUnk_020000B0->x.HALF.HI - super->x.HALF.HI) + 0x10U)) { return FALSE; } return TRUE; } else { - if (sub_08049FDC(super, 1) == 0) { + if (!sub_08049FDC(super, 1)) { return FALSE; } if (gUnk_020000B0->x.HALF.HI >= (s32)(gRoomControls.origin_x + 0xa8)) { diff --git a/src/enemy/darkNut.c b/src/enemy/darkNut.c index 7fae4b0b..c3e84e19 100644 --- a/src/enemy/darkNut.c +++ b/src/enemy/darkNut.c @@ -610,8 +610,6 @@ void sub_08021644(Entity* this) { } } -extern u32 sub_08049F1C(Entity*, Entity*, u32); - u32 sub_08021664(Entity* this, Entity* ent) { switch (this->animationState) { case 0: diff --git a/src/enemy/flyingPot.c b/src/enemy/flyingPot.c index d516fe98..93f87543 100644 --- a/src/enemy/flyingPot.c +++ b/src/enemy/flyingPot.c @@ -34,14 +34,14 @@ enum FlyingPotSubActions { /* 1 */ FLYING_POT_SUBACTION_1, /* 2 */ FLYING_POT_SUBACTION_2, /* 3 */ FLYING_POT_SUBACTION_3, - /* 4 */ FLYING_POT_SUBACTION_4, + /* 4 */ FLYING_POT_SUBACTION_DO_NOTHING, /* 5 */ FLYING_POT_SUBACTION_5, }; // Functions -void FlyingPot_OnTick(FlyingPotEntity*); // 0803708C -void sub_080370A4(FlyingPotEntity*); // 080370A4 -void sub_0803712C(FlyingPotEntity*); // 0803712C +void FlyingPot_OnTick(FlyingPotEntity*); // 0803708C +void FlyingPot_OnCollision(FlyingPotEntity*); // 080370A4 +void FlyingPot_OnGrabbed(FlyingPotEntity*); // 0803712C // Subactions void FlyingPot_SubAction0(FlyingPotEntity*); // 08037144 @@ -64,8 +64,12 @@ void sub_08037408(FlyingPotEntity*); void sub_08037418(FlyingPotEntity*); void (*const FlyingPot_Functions[])(Entity*) = { - (EntityActionPtr)FlyingPot_OnTick, (EntityActionPtr)sub_080370A4, GenericKnockback, GenericDeath, GenericConfused, - (EntityActionPtr)sub_0803712C, + (EntityActionPtr)FlyingPot_OnTick, + (EntityActionPtr)FlyingPot_OnCollision, + GenericKnockback, + GenericDeath, + GenericConfused, + (EntityActionPtr)FlyingPot_OnGrabbed, }; void FlyingPot(Entity* thisx) { @@ -87,7 +91,7 @@ void FlyingPot_OnTick(FlyingPotEntity* this) { FlyingPot_Actions[super->action](this); } -void sub_080370A4(FlyingPotEntity* this) { +void FlyingPot_OnCollision(FlyingPotEntity* this) { sub_08037418(this); if (super->bitfield == 0x9D) { @@ -104,7 +108,7 @@ void sub_080370A4(FlyingPotEntity* this) { EnemyFunctionHandlerAfterCollision(super, FlyingPot_Functions); } -void sub_0803712C(FlyingPotEntity* this) { +void FlyingPot_OnGrabbed(FlyingPotEntity* this) { static void (*const FlyingPot_SubActions[])(FlyingPotEntity*) = { FlyingPot_SubAction0, FlyingPot_SubAction1, FlyingPot_SubAction2, FlyingPot_SubAction3, FlyingPot_SubActionDoNothing, FlyingPot_SubAction5, diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index 4e18f26e..611e2fcc 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -42,9 +42,6 @@ void sub_08037ACC(GibdoEntity*); void Gibdo_CreateObjects(GibdoEntity*); void sub_08037A14(GibdoEntity*); -extern void sub_0804A4E4(Entity*, Entity*); -u32 sub_0804A044(Entity*, Entity*, u32); - void (*const Gibdo_Functions[6])(Entity*); void (*const gUnk_080CF2AC[9])(GibdoEntity*); extern Entity* gUnk_020000B0; diff --git a/src/enemy/octorokGolden.c b/src/enemy/octorokGolden.c index 4bdac449..a2fcfab6 100644 --- a/src/enemy/octorokGolden.c +++ b/src/enemy/octorokGolden.c @@ -8,9 +8,6 @@ extern void (*const gUnk_080012C8[])(Entity*); const s8 gUnk_080CF490[]; const u8 gUnk_080CF498[]; -extern s32 sub_080012DC(Entity*); -extern u32 sub_0804A044(Entity*, Entity*, u32); - void sub_08037E14(Entity* this); bool32 sub_08037E90(Entity* this); diff --git a/src/enemy/peahat.c b/src/enemy/peahat.c index c6051ba0..dc15dbb6 100644 --- a/src/enemy/peahat.c +++ b/src/enemy/peahat.c @@ -19,9 +19,6 @@ extern const s8 gUnk_080CA5D4[]; void sub_080205F8(Entity*); void sub_08020604(Entity*); -extern u32 sub_08049F1C(Entity*, Entity*, u32); -extern void sub_0804AA1C(Entity*); - extern Entity* gUnk_020000B0; enum { diff --git a/src/enemy/rockChuchu.c b/src/enemy/rockChuchu.c index f1d8bad4..22746a16 100644 --- a/src/enemy/rockChuchu.c +++ b/src/enemy/rockChuchu.c @@ -8,8 +8,6 @@ #include "enemy.h" #include "functions.h" -extern void sub_0804A4E4(Entity*, Entity*); - extern void (*const RockChuchu_Functions[])(Entity*); extern void (*const gUnk_080CB960[])(Entity*); diff --git a/src/enemy/rope.c b/src/enemy/rope.c index 61f36bc5..37c63337 100644 --- a/src/enemy/rope.c +++ b/src/enemy/rope.c @@ -12,7 +12,6 @@ extern void (*const Rope_Functions[6])(Entity*); extern void (*const gUnk_080CE460[4])(Entity*); extern void (*const gUnk_080CE470[3])(Entity*); extern Entity* gUnk_020000B0; -extern u32 sub_0804A044(Entity*, Entity*, u32); void sub_08031600(Entity*); u32 sub_0803163C(Entity*); diff --git a/src/enemy/ropeGolden.c b/src/enemy/ropeGolden.c index ca3a57c7..a4a6fc99 100644 --- a/src/enemy/ropeGolden.c +++ b/src/enemy/ropeGolden.c @@ -14,9 +14,6 @@ extern void (*const gUnk_080012C8[])(Entity*); extern void (*const RopeGolden_Functions[6])(Entity*); extern void (*const gUnk_080CF4E0[4])(Entity*); -extern s32 sub_080012DC(Entity*); -extern u32 sub_0804A044(Entity*, Entity*, u32); - void sub_080383AC(Entity*); void sub_080383E4(Entity*); diff --git a/src/enemy/slime.c b/src/enemy/slime.c index 3c88ae1c..1cf982a0 100644 --- a/src/enemy/slime.c +++ b/src/enemy/slime.c @@ -15,8 +15,6 @@ typedef struct { void sub_08044FF8(Entity*); void sub_08045178(Entity*, Entity*, int, int); -extern void sub_0804A4E4(Entity*, Entity*); - extern void (*const gUnk_080D16BC[])(Entity*); extern void (*const Slime_Functions[])(Entity*); extern u8 gUnk_080D16D0[4]; // Entity count per form diff --git a/src/enemy/sluggula.c b/src/enemy/sluggula.c index 5405cf71..06d27af1 100644 --- a/src/enemy/sluggula.c +++ b/src/enemy/sluggula.c @@ -8,13 +8,9 @@ #include "enemy.h" #include "functions.h" -extern s32 sub_080012DC(Entity*); -bool32 PlayerInRange(Entity*, u32, u32); - void sub_08023E10(Entity*); void sub_08023E54(Entity*); void sub_08023E9C(Entity*); -void sub_0804A4E4(Entity*, Entity*); extern void (*const gUnk_080012C8[])(Entity*); @@ -178,7 +174,7 @@ extern Entity* gUnk_020000B0; void sub_08023E9C(Entity* this) { u32 uVar3 = Random(); - if (sub_08049FA0(this) == 0 && (uVar3 & 1)) { + if (!sub_08049FA0(this) && (uVar3 & 1)) { this->direction = DirectionRoundUp(sub_08049EE4(this)); } else if (sub_08049FDC(this, 1) && (uVar3 & 6)) { u32 uVar3 = GetFacingDirection(this, gUnk_020000B0) - this->direction; diff --git a/src/enemy/spinyChuchu.c b/src/enemy/spinyChuchu.c index 7d49e0d2..7499234b 100644 --- a/src/enemy/spinyChuchu.c +++ b/src/enemy/spinyChuchu.c @@ -9,11 +9,6 @@ #include "functions.h" #include "hitbox.h" -extern void sub_08001318(Entity*); -extern u32 PlayerInRange(Entity*, u32, u32); -extern void sub_0804A4E4(Entity*, Entity*); -extern void sub_0804AA1C(Entity*); - u32 sub_080228CC(Entity*); u32 sub_080228F0(Entity*);