summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-03-20 19:28:07 -0700
committerGitHub <noreply@github.com>2022-03-20 19:28:07 -0700
commitf57f815879ca5d743557125341bf583b48bbdeaf (patch)
tree097531ed20b9f5117cf58386ce81ebc419f7e64e /src
parenta767e16cba73ce613ac4c42c2d86eea31f675fbb (diff)
parent9143b1f4c79b7a54eb440173acf51031999f0542 (diff)
Merge pull request #458 from EllipticEllipsis/code_08049D30
Decompile the file formerly known as `code_08049D30`
Diffstat (limited to 'src')
-rw-r--r--src/code_08049CD4.c69
-rw-r--r--src/code_08049DF4.c324
-rw-r--r--src/enemy/armos.c4
-rw-r--r--src/enemy/darkNut.c2
-rw-r--r--src/enemy/flyingPot.c20
-rw-r--r--src/enemy/gibdo.c3
-rw-r--r--src/enemy/octorokGolden.c3
-rw-r--r--src/enemy/peahat.c3
-rw-r--r--src/enemy/rockChuchu.c2
-rw-r--r--src/enemy/rope.c1
-rw-r--r--src/enemy/ropeGolden.c3
-rw-r--r--src/enemy/slime.c2
-rw-r--r--src/enemy/sluggula.c6
-rw-r--r--src/enemy/spinyChuchu.c5
14 files changed, 399 insertions, 48 deletions
diff --git a/src/code_08049CD4.c b/src/code_08049CD4.c
index a773306d..c98323d1 100644
--- a/src/code_08049CD4.c
+++ b/src/code_08049CD4.c
@@ -1,25 +1,76 @@
+#define NENT_DEPRECATED
#include "global.h"
-
-extern u32* gUnk_020354B0;
-extern u32 gRoomMemory;
+#include "room.h"
extern void MemFill32(u32, void*, u32);
+void sub_08049DCC(RoomMemory*);
+RoomMemory* sub_08049D88(void);
+
void ClearRoomMemory(void) {
- MemFill32(0xFFFFFFFF, &gRoomMemory, 0x40);
- gUnk_020354B0 = &gRoomMemory;
+ MemFill32(0xFFFFFFFF, gRoomMemory, 0x40);
+ gUnk_020354B0 = gRoomMemory;
}
-void sub_08049CF4(u8* arg0) {
- u8 field_0x6c = *(arg0 + 0x6c);
+void sub_08049CF4(GenericEntity* ent) {
+ u8 field_0x6c = ent->field_0x6c.HALF.LO;
if (field_0x6c & 0x80) {
- *(gUnk_020354B0 + 1) |= 1 << (field_0x6c & 0x1f);
+ gUnk_020354B0->unk_04 |= 1 << (field_0x6c & 0x1f);
}
}
u32 sub_08049D1C(u32 arg0) {
- u32 bitmask = *(gUnk_020354B0 + 1) >> arg0;
+ u32 bitmask = gUnk_020354B0->unk_04 >> arg0;
u32 output = 1;
output &= ~bitmask;
return output;
}
+
+void UpdateRoomTracker(void) {
+ gUnk_020354B0 = gRoomMemory;
+
+ do {
+ if (gUnk_020354B0->area == gRoomControls.area && gUnk_020354B0->room == gRoomControls.room) {
+ sub_08049DCC(gUnk_020354B0);
+ return;
+ }
+ gUnk_020354B0++;
+
+ } while (gUnk_020354B0 < gRoomMemory + 8);
+ gUnk_020354B0 = sub_08049D88();
+}
+
+RoomMemory* sub_08049D88(void) {
+ RoomMemory* rm = gRoomMemory;
+ RoomMemory* r1 = rm + 1;
+
+ do {
+ if (r1->unk_02 > rm->unk_02) {
+ rm = r1;
+ }
+ r1++;
+ } while (r1 < gRoomMemory + 8);
+
+ rm->area = gRoomControls.area;
+ rm->room = gRoomControls.room;
+
+ rm->unk_02 = 0xFFFF;
+ rm->unk_04 = 0;
+
+ sub_08049DCC(rm);
+
+ return rm;
+}
+
+void sub_08049DCC(RoomMemory* rm) {
+ RoomMemory* r1 = gRoomMemory;
+
+ do {
+ if (r1->unk_02 < rm->unk_02) {
+ r1->unk_02++;
+ }
+ r1++;
+ } while (r1 < gRoomMemory + 8);
+
+ rm->unk_02 = 0;
+}
diff --git a/src/code_08049DF4.c b/src/code_08049DF4.c
new file mode 100644
index 00000000..06b77524
--- /dev/null
+++ b/src/code_08049DF4.c
@@ -0,0 +1,324 @@
+#define NENT_DEPRECATED
+#include "asm.h"
+#include "global.h"
+#include "entity.h"
+#include "functions.h"
+#include "map.h"
+#include "player.h"
+#include "room.h"
+
+extern Entity* gUnk_020000B0;
+extern Entity* (*const gUnk_080D3BE8[])(void);
+
+extern void ReplaceMonitoredEntity(Entity*, Entity*);
+
+Entity* sub_08049DF4(u32 arg0) {
+ if (gUnk_020000B0 != NULL) {
+ return gUnk_020000B0;
+ }
+ return gUnk_080D3BE8[arg0]();
+}
+
+Entity* sub_08049E18(void) {
+ if ((gPlayerState.field_0x3c[0] == 0) && !(gPlayerState.flags & 0x22189b75)) {
+ gUnk_020000B0 = &gPlayerEntity;
+ return &gPlayerEntity;
+ }
+ return NULL;
+}
+
+Entity* sub_08049E4C(void) {
+ if ((gPlayerState.field_0x3c[0] == 0) && !(gPlayerState.flags & 0x22189bf5)) {
+ gUnk_020000B0 = &gPlayerEntity;
+ return &gPlayerEntity;
+ }
+ return NULL;
+}
+
+Entity* sub_08049E80(void) {
+ if ((gPlayerState.field_0x3c[0] != 0) || !(gPlayerState.flags & 0x80)) {
+ return NULL;
+ }
+ gUnk_020000B0 = &gPlayerEntity;
+ return &gPlayerEntity;
+}
+
+Entity* sub_08049EB0(void) {
+ if ((gPlayerState.field_0x3c[0] == 0) && !(gPlayerState.flags & 0x80190)) {
+ gUnk_020000B0 = &gPlayerEntity;
+ return &gPlayerEntity;
+ }
+ return NULL;
+}
+
+u32 sub_08049EE4(Entity* ent) {
+ GenericEntity* genEnt = (GenericEntity*)ent;
+ u16 tempLO = genEnt->field_0x70.HALF.LO + 4 * genEnt->field_0x6e.HALF.LO;
+ u16 tempHI = genEnt->field_0x70.HALF.HI + 4 * genEnt->field_0x6e.HALF.HI;
+
+ return CalculateDirectionTo(genEnt->base.x.HALF.HI, genEnt->base.y.HALF.HI, tempLO, tempHI);
+}
+
+bool32 sub_08049F1C(Entity* entA, Entity* entB, s32 maxDist) {
+ if ((entA->collisionLayer & entB->collisionLayer) != 0) {
+ s32 xDiff = entB->x.HALF.HI - entA->x.HALF.HI;
+ s32 yDiff = entB->y.HALF.HI - entA->y.HALF.HI;
+ s32 maxDistSq = maxDist * maxDist;
+ s32 distSq = xDiff * xDiff + yDiff * yDiff;
+
+ if (maxDistSq >= distSq) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+bool32 PlayerInRange(Entity* ent, u32 arg1, s32 maxDist) {
+ Entity* tempEnt = sub_08049DF4(arg1);
+ if (tempEnt == NULL) {
+ return FALSE;
+ } else {
+ return sub_08049F1C(ent, tempEnt, maxDist);
+ }
+}
+
+u32 sub_08049F84(Entity* ent, s32 arg2) {
+ Entity* target = sub_08049DF4(arg2);
+
+ if (target == NULL) {
+ return 0xFF;
+ } else {
+ return GetFacingDirection(ent, target);
+ }
+}
+
+bool32 sub_08049FA0(Entity* ent) {
+ GenericEntity* genEnt = (GenericEntity*)ent;
+ u32 temp = 8 * genEnt->field_0x6e.HALF.LO;
+
+ if (temp >= genEnt->base.x.HALF.HI - genEnt->field_0x70.HALF_U.LO) {
+ temp = 8 * genEnt->field_0x6e.HALF.HI;
+ if (temp >= genEnt->base.y.HALF.HI - genEnt->field_0x70.HALF_U.HI) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+bool32 sub_08049FDC(Entity* ent, u32 arg1) {
+ u32 temp;
+ GenericEntity* genEnt = (GenericEntity*)ent;
+ GenericEntity* tempEnt = (GenericEntity*)sub_08049DF4(arg1);
+
+ if (tempEnt != NULL) {
+ temp = 8 * genEnt->field_0x6e.HALF.LO;
+ if (temp >= tempEnt->base.x.HALF.HI - genEnt->field_0x70.HALF_U.LO) {
+ temp = 8 * genEnt->field_0x6e.HALF.HI;
+ if (temp >= tempEnt->base.y.HALF.HI - genEnt->field_0x70.HALF_U.HI) {
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+
+u32 sub_0804A024(Entity* ent, u32 arg1, u32 arg2) {
+ Entity* tempEnt = sub_08049DF4(arg1);
+ if (tempEnt == NULL) {
+ return 0xFF;
+ } else {
+ return sub_0804A044(ent, tempEnt, arg2);
+ }
+}
+
+u32 sub_0804A168(Entity*, Entity*, LayerStruct*);
+u32 sub_0804A318(Entity*, Entity*, LayerStruct*);
+
+u32 sub_0804A044(Entity* entA, Entity* entB, u32 arg2) {
+ LayerStruct* layer;
+ s32 ret;
+ s32 yDiff;
+ s32 xDiff;
+ s32 flags;
+
+ if ((entB->collisionLayer & entA->collisionLayer) != 0) {
+ flags = 0;
+ xDiff = entB->x.HALF.HI + entB->hitbox->offset_x - entA->x.HALF.HI - entA->hitbox->offset_x;
+
+ if (arg2 >= xDiff + (arg2 >> 1)) {
+ flags |= 1;
+ }
+ if (arg2 << 1 >= xDiff + arg2) {
+ flags |= 2;
+ }
+
+ yDiff = entB->y.HALF.HI + entB->hitbox->offset_y - entA->y.HALF.HI - entA->hitbox->offset_y;
+ if (arg2 >= yDiff + (arg2 >> 1)) {
+ flags |= 4;
+ }
+ if (arg2 << 1 >= yDiff + arg2) {
+ flags |= 8;
+ }
+
+ //! @bug flags & 5 can never equal 0xA
+ if (flags && ((flags & 5) != 0xA)) {
+ layer = GetLayerByIndex(entA->collisionLayer);
+ if (xDiff < 0) {
+ xDiff = -xDiff;
+ }
+ if (yDiff < 0) {
+ yDiff = -yDiff;
+ }
+ if (xDiff < yDiff) {
+ if (flags & 1) {
+ ret = sub_0804A168(entA, entB, layer);
+ if (ret != 0xFF) {
+ return ret;
+ }
+ }
+ if (!(flags & 4)) {
+ return 0xFF;
+ }
+ ret = sub_0804A318(entA, entB, layer);
+ } else {
+ if (flags & 4) {
+ ret = sub_0804A318(entA, entB, layer);
+ if (ret != 0xFF) {
+ return ret;
+ }
+ }
+ if (!(flags & 1)) {
+ return 0xFF;
+ }
+ ret = sub_0804A168(entA, entB, layer);
+ }
+ if (ret != 0xFF) {
+ return ret;
+ }
+ }
+ }
+ return 0xFF;
+}
+
+bool32 sub_0804A4BC(u8* arg0, u8* arg1, s32 arg2, u32 arg3);
+
+u32 sub_0804A168(Entity* entA, Entity* entB, LayerStruct* layer) {
+ u32 uVar2;
+ u32 uVar3;
+ u32 tile1;
+ u32 tile2;
+
+ if (entB->y.HALF.HI > entA->y.HALF.HI) {
+ uVar2 = entA->x.HALF.HI - 4;
+ uVar3 = ((uVar2 & 0xF) < 8) ? 10 : 5;
+ tile1 = TILE(uVar2, entA->y.HALF.HI + 10);
+ tile2 = TILE(uVar2, entB->y.HALF.HI);
+
+ if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], 0x40, uVar3)) {
+ uVar2 = entA->x.HALF.HI + 4;
+ uVar3 ^= 0xF;
+ tile1 = TILE(uVar2, entA->y.HALF.HI + 10);
+ tile2 = TILE(uVar2, entB->y.HALF.HI);
+
+ if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], 0x40, uVar3)) {
+ return 0x10;
+ }
+ }
+ } else {
+ uVar2 = entA->x.HALF.HI - 4;
+ uVar3 = ((uVar2 & 0xF) < 8) ? 10 : 5;
+ tile1 = TILE(uVar2, entA->y.HALF.HI - 10);
+ tile2 = TILE(uVar2, entB->y.HALF.HI);
+
+ if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], -0x40, uVar3)) {
+ uVar2 = entA->x.HALF.HI + 4;
+ uVar3 ^= 0xF;
+ tile1 = TILE(uVar2, entA->y.HALF.HI - 10);
+ tile2 = TILE(uVar2, entB->y.HALF.HI);
+
+ if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], -0x40, uVar3)) {
+ return 0;
+ }
+ }
+ }
+ return 0xFF;
+}
+
+u32 sub_0804A318(Entity* entA, Entity* entB, LayerStruct* layer) {
+ u32 uVar2;
+ u32 uVar3;
+ u32 tile1;
+ u32 tile2;
+
+ if (entB->x.HALF.HI > entA->x.HALF.HI) {
+ uVar2 = entA->y.HALF.HI - 4;
+ uVar3 = ((uVar2 & 0xF) < 8) ? 0xC : 3;
+ tile1 = TILE(entA->x.HALF.HI + 10, uVar2);
+ tile2 = TILE(entB->x.HALF.HI, uVar2);
+
+ if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], 1, uVar3)) {
+ uVar2 = entA->y.HALF.HI + 4;
+ uVar3 ^= 0xF;
+ tile1 = TILE(entA->x.HALF.HI + 10, uVar2);
+ tile2 = TILE(entB->x.HALF.HI, uVar2);
+
+ if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], 1, uVar3)) {
+ return 8;
+ }
+ }
+ } else {
+ uVar2 = entA->y.HALF.HI - 4;
+ uVar3 = ((uVar2 & 0xF) < 8) ? 0xC : 3;
+ tile1 = TILE(entA->x.HALF.HI - 10, uVar2);
+ tile2 = TILE(entB->x.HALF.HI, uVar2);
+
+ if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], -1, uVar3)) {
+ uVar2 = entA->y.HALF.HI + 4;
+ uVar3 ^= 0xF;
+ tile1 = TILE(entA->x.HALF.HI - 10, uVar2);
+ tile2 = TILE(entB->x.HALF.HI, uVar2);
+ if (sub_0804A4BC(&layer->collisionData[tile1], &layer->collisionData[tile2], -1, uVar3)) {
+ return 0x18;
+ }
+ }
+ }
+ return 0xFF;
+}
+
+bool32 sub_0804A4BC(u8* arg0, u8* arg1, s32 arg2, u32 arg3) {
+ while (arg0 != arg1) {
+ u8 r0 = *arg0;
+
+ if (r0 != 0) {
+ if (r0 > 0xF) {
+ return FALSE;
+ }
+
+ r0 &= arg3;
+ if (r0 != 0) {
+ return FALSE;
+ }
+ }
+ arg0 += arg2;
+ }
+
+ return TRUE;
+}
+
+void sub_0804A4E4(Entity* entA, Entity* entB) {
+ GenericEntity* r5 = (GenericEntity*)entA;
+ GenericEntity* r6 = (GenericEntity*)entB;
+
+ r6->field_0x6c.HALF.HI = (r5->field_0x6c.HALF.HI & 0x40) | 4;
+ r6->field_0x6c.HALF.LO = r5->field_0x6c.HALF.LO;
+ r6->field_0x70.HALF.LO = r5->field_0x70.HALF.LO;
+ r6->field_0x70.HALF.HI = r5->field_0x70.HALF.HI;
+ r6->field_0x6e.HALF.LO = r5->field_0x6e.HALF.LO;
+ r6->field_0x6e.HALF.HI = r5->field_0x6e.HALF.HI;
+
+ CopyPositionAndSpriteOffset(&r5->base, &r6->base);
+
+ if (r5->field_0x6c.HALF.HI & 0x40) {
+ ReplaceMonitoredEntity(&r5->base, &r6->base);
+ }
+}
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*);