summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-01-20 21:42:18 -0800
committerGitHub <noreply@github.com>2022-01-20 21:42:18 -0800
commit0cf1dca4d208a1568ed2aeec3bb40d78dd6379dc (patch)
treeb1481f2c82ce3dc72f7af8681c41c6fd9738455d /src
parenteeb685220e7bb7eb6a0ecae2bb3e57ff261c26fc (diff)
parent86dd589875781652cd4cdd02c7e09aa38dd939e8 (diff)
Merge pull request #304 from octorock/lilypadLarge
Decompile LilypadLarge
Diffstat (limited to 'src')
-rw-r--r--src/coord.c5
-rw-r--r--src/enemy/acroBandits.c10
-rw-r--r--src/enemy/bombPeahat.c6
-rw-r--r--src/enemy/bowMoblin.c2
-rw-r--r--src/enemy/businessScrub.c4
-rw-r--r--src/enemy/crow.c2
-rw-r--r--src/enemy/cuccoChickAggr.c2
-rw-r--r--src/enemy/gibdo.c2
-rw-r--r--src/enemy/gyorgMale.c6
-rw-r--r--src/enemy/octorok.c2
-rw-r--r--src/enemy/octorokBoss.c1
-rw-r--r--src/enemy/pesto.c6
-rw-r--r--src/enemy/puffstool.c6
-rw-r--r--src/enemy/slime.c1
-rw-r--r--src/enemy/spearMoblin.c3
-rw-r--r--src/enemy/takkuri.c2
-rw-r--r--src/enemy/vaatiEyesMacro.c1
-rw-r--r--src/enemy/vaatiProjectile.c2
-rw-r--r--src/enemy/wallMaster.c2
-rw-r--r--src/npc/cat.c2
-rw-r--r--src/npc/npc5.c1
-rw-r--r--src/npc/stockwell.c2
-rw-r--r--src/object/bakerOven.c2
-rw-r--r--src/object/button.c1
-rw-r--r--src/object/lilypadLarge.c385
-rw-r--r--src/object/mask.c3
-rw-r--r--src/object/minecart.c1
-rw-r--r--src/object/octorokBossObject.c2
-rw-r--r--src/projectile/gleerokProjectile.c1
-rw-r--r--src/projectile/mandiblesProjectile.c4
-rw-r--r--src/projectile/octorokBossProjectile.c1
-rw-r--r--src/projectile/v1FireProjectile.c1
32 files changed, 392 insertions, 79 deletions
diff --git a/src/coord.c b/src/coord.c
index 1d1f346a..c0c370c0 100644
--- a/src/coord.c
+++ b/src/coord.c
@@ -22,7 +22,6 @@ extern u8 gUnk_08114F38[];
extern u8 gUnk_08114F58[];
void sub_080027EA(Entity*, u32, u32);
-void sub_0806F5BC(Entity*, u32, u32);
u32 sub_0806F58C(Entity*, Entity*);
u32 sub_0806FCA0(Entity*, Entity*);
@@ -214,8 +213,8 @@ u32 sub_0806F804(u32 x, u32 y) {
return gUnk_02025EB0._4[idx];
}
-void sub_0806F824(Entity* a, Entity* b, s32 x, s32 y) {
- sub_080045D4(a->x.HALF.HI, a->y.HALF.HI, b->x.HALF.HI + x, b->y.HALF.HI + y);
+u32 sub_0806F824(Entity* a, Entity* b, s32 x, s32 y) {
+ return sub_080045D4(a->x.HALF.HI, a->y.HALF.HI, b->x.HALF.HI + x, b->y.HALF.HI + y);
}
u32 sub_0806F854(Entity* ent, s32 x, s32 y) {
diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c
index b73c8104..3fe81a09 100644
--- a/src/enemy/acroBandits.c
+++ b/src/enemy/acroBandits.c
@@ -8,16 +8,6 @@
#include "enemy.h"
#include "functions.h"
-extern u32 sub_080002D4(s32, s32, u32);
-extern s32 sub_080012DC(Entity*);
-extern u32 sub_08031E04(Entity*);
-extern void sub_08031E48(Entity*, Entity*);
-extern void sub_08032290(Entity*);
-extern u32 sub_080322A4(Entity*);
-void sub_080322E8(Entity*);
-extern void sub_08032338(Entity*);
-extern Entity* sub_08049DF4(u32);
-
extern Entity* gUnk_020000B0;
extern void (*const gUnk_080012C8[])(Entity*);
extern void (*const gUnk_080CE56C[])(Entity*);
diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c
index dbdda527..3a7a0064 100644
--- a/src/enemy/bombPeahat.c
+++ b/src/enemy/bombPeahat.c
@@ -12,12 +12,6 @@
#include "object.h"
#include "functions.h"
-extern void sub_08078954(Entity*);
-extern void sub_08078930(Entity*);
-extern s32 sub_080012DC(Entity*);
-extern Entity* sub_08049DF4(u32);
-extern void sub_08079BD8(Entity*);
-
void sub_0802AD1C(Entity*, u32);
void sub_0802AD54(Entity*);
void sub_0802B048(Entity*);
diff --git a/src/enemy/bowMoblin.c b/src/enemy/bowMoblin.c
index 61f93cae..19615fe9 100644
--- a/src/enemy/bowMoblin.c
+++ b/src/enemy/bowMoblin.c
@@ -33,8 +33,6 @@ void sub_0803C714(BowMoblinEntity*);
void sub_0803C634(BowMoblinEntity*);
u32 sub_0803C6F8(BowMoblinEntity*);
u32 sub_0803C568(BowMoblinEntity*);
-extern Entity* sub_08049DF4(u32);
-extern u32 sub_0806FC80(Entity*, Entity*, s32);
void sub_0803C664(BowMoblinEntity*);
void (*const gUnk_080CFF78[])(Entity*);
diff --git a/src/enemy/businessScrub.c b/src/enemy/businessScrub.c
index 9c52774f..eb1bb1e1 100644
--- a/src/enemy/businessScrub.c
+++ b/src/enemy/businessScrub.c
@@ -14,10 +14,6 @@
#include "game.h"
#include "item.h"
-extern Entity* sub_08049DF4(u32);
-extern bool32 sub_08056338(void);
-extern void UnloadOBJPalette(Entity*);
-
bool32 sub_0802915C(Entity*);
bool32 sub_080291DC(Entity*);
void sub_0802922C(Entity*);
diff --git a/src/enemy/crow.c b/src/enemy/crow.c
index 8fdb1547..4dfdc773 100644
--- a/src/enemy/crow.c
+++ b/src/enemy/crow.c
@@ -20,8 +20,6 @@ void (*const gUnk_080CE990[])(CrowEntity*);
void (*const gUnk_080CE9A4[])(CrowEntity*);
extern Entity* gUnk_020000B0;
-extern Entity* sub_08049DF4(u32);
-
void sub_08032AF4(CrowEntity* this);
void sub_08032AB0(CrowEntity* this);
void sub_08032B38(CrowEntity* this);
diff --git a/src/enemy/cuccoChickAggr.c b/src/enemy/cuccoChickAggr.c
index e4946da6..2b6bb47f 100644
--- a/src/enemy/cuccoChickAggr.c
+++ b/src/enemy/cuccoChickAggr.c
@@ -8,8 +8,6 @@
#include "enemy.h"
#include "functions.h"
-extern Entity* sub_08049DF4(u32);
-
void sub_08022A88(Entity*);
void sub_08022AA4(Entity*);
void sub_08022B0C(Entity*);
diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c
index a8ca9c69..2cb70480 100644
--- a/src/enemy/gibdo.c
+++ b/src/enemy/gibdo.c
@@ -27,9 +27,7 @@ void sub_08037B48(Entity*);
void sub_08037A14(Entity*);
extern void sub_0804A4E4(Entity*, Entity*);
-extern Entity* sub_08049DF4(u32);
u32 sub_0804A044(Entity*, Entity*, u32);
-extern void SoundReqClipped(Entity*, u32);
extern void (*const gGibdo[6])(Entity*);
extern void (*const gUnk_080CF2AC[9])(Entity*);
diff --git a/src/enemy/gyorgMale.c b/src/enemy/gyorgMale.c
index 4763fe56..d2dabadb 100644
--- a/src/enemy/gyorgMale.c
+++ b/src/enemy/gyorgMale.c
@@ -106,7 +106,7 @@ void GyorgMale(GyorgMaleEntity* this) {
}
gUnk_080D1AFC[super->action](this);
if (super->action != 7) {
- sub_0805EC9C(this, 0xaa, 0xaa, this->unk_78);
+ sub_0805EC9C(super, 0xaa, 0xaa, this->unk_78);
}
super->animationState = -(this->unk_78 >> 8);
sub_08048004(this);
@@ -986,7 +986,7 @@ void sub_08047BF0(GyorgMaleEntity* this) {
}
}
}
- sub_0805EC9C(this, 0xAA, 0xAA, this->unk_78);
+ sub_0805EC9C(super, 0xAA, 0xAA, this->unk_78);
}
void sub_08047D24(GyorgMaleEntity* this) {
@@ -1005,7 +1005,7 @@ void sub_08047D24(GyorgMaleEntity* this) {
} else {
sub_08047E58(this);
}
- sub_0805EC9C(this, this->unk_7e, this->unk_7e, this->unk_78);
+ sub_0805EC9C(super, this->unk_7e, this->unk_7e, this->unk_78);
}
}
diff --git a/src/enemy/octorok.c b/src/enemy/octorok.c
index b1aedfc6..658d94a0 100644
--- a/src/enemy/octorok.c
+++ b/src/enemy/octorok.c
@@ -8,8 +8,6 @@
#include "enemy.h"
#include "functions.h"
-extern Entity* sub_08049DF4(u32);
-
void Octorok_Pause(Entity*);
bool32 Octorok_FacesPlayer(Entity*);
void Octorok_Turn(Entity*);
diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c
index 8514214a..c0aa2b65 100644
--- a/src/enemy/octorokBoss.c
+++ b/src/enemy/octorokBoss.c
@@ -13,7 +13,6 @@
extern void sub_08078AC0(u32, u32, u32);
extern u32 GetRandomByWeight(const u8*);
-extern u32 sub_0806FC80(Entity*, Entity*, s32);
extern void sub_080792BC(s32, u32, u32);
enum OctorokRotation { ROTATION_CW, ROTATION_CCW, NO_ROTATION = 0xff };
diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c
index 7d5db56e..34e316cc 100644
--- a/src/enemy/pesto.c
+++ b/src/enemy/pesto.c
@@ -11,12 +11,6 @@
#include "functions.h"
#include "save.h"
-extern u32 sub_080002E0(u16, u32);
-extern void SoundReqClipped(Entity*, u32);
-extern u32 sub_08049F1C(Entity*, Entity*, u32);
-extern u32 PlayerInRange(Entity*, u32, u32);
-extern void sub_080AEFB4(Entity*);
-
void sub_080249F4(Entity*);
void sub_08024940(Entity*);
void sub_080249DC(Entity*);
diff --git a/src/enemy/puffstool.c b/src/enemy/puffstool.c
index b42e5b2f..6e35dbfc 100644
--- a/src/enemy/puffstool.c
+++ b/src/enemy/puffstool.c
@@ -9,12 +9,6 @@
#include "object.h"
#include "functions.h"
-extern u32 sub_080002E0(u32, u32);
-extern u32 sub_080002C8(u16, u8);
-extern u8 sub_080002D4(u32, u32, u32);
-extern void sub_0804AA1C(Entity*);
-extern Entity* sub_08049DF4(u32);
-
extern u8 gUnk_080B37A0[];
extern u8 gUnk_080B3E80[];
diff --git a/src/enemy/slime.c b/src/enemy/slime.c
index e95bc8c7..0ef493dd 100644
--- a/src/enemy/slime.c
+++ b/src/enemy/slime.c
@@ -16,7 +16,6 @@ void sub_08044FF8(Entity*);
void sub_08045178(Entity*, Entity*, int, int);
extern void sub_0804A4E4(Entity*, Entity*);
-extern u32 sub_080002CC(Entity*, s32, s32);
extern void (*const gUnk_080D16BC[])(Entity*);
extern void (*const gUnk_080D16A4[])(Entity*);
diff --git a/src/enemy/spearMoblin.c b/src/enemy/spearMoblin.c
index 91475342..6cd8f4ca 100644
--- a/src/enemy/spearMoblin.c
+++ b/src/enemy/spearMoblin.c
@@ -8,9 +8,6 @@
#include "enemy.h"
#include "functions.h"
-extern bool32 sub_0806FC80(Entity*, Entity*, u32);
-extern Entity* sub_08049DF4(u32);
-
void sub_08028604(Entity*);
void sub_08028754(Entity*);
void sub_08028784(Entity*);
diff --git a/src/enemy/takkuri.c b/src/enemy/takkuri.c
index a0fc0dbb..7817f0d7 100644
--- a/src/enemy/takkuri.c
+++ b/src/enemy/takkuri.c
@@ -20,8 +20,6 @@ typedef struct {
static_assert(sizeof(TakkuriEntity) == 0x88);
-extern void sub_0803C0AC(Entity*);
-extern Entity* sub_08049DF4(u32);
extern Entity* gUnk_020000B0;
void (*const gUnk_080CFF3C[])(Entity*);
diff --git a/src/enemy/vaatiEyesMacro.c b/src/enemy/vaatiEyesMacro.c
index d268a30e..e53d51f1 100644
--- a/src/enemy/vaatiEyesMacro.c
+++ b/src/enemy/vaatiEyesMacro.c
@@ -8,7 +8,6 @@
#include "enemy.h"
#include "functions.h"
-extern u32 sub_080002E0(u32, u32);
extern s16 gUnk_080B4488[];
void VaatiEyesMacroFunction0(Entity*);
diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c
index d4194d4d..c9d1fbbf 100644
--- a/src/enemy/vaatiProjectile.c
+++ b/src/enemy/vaatiProjectile.c
@@ -8,8 +8,6 @@
#include "enemy.h"
#include "functions.h"
-extern bool32 PlayerInRange(Entity*, u32, u32);
-extern u32 sub_080002E0(u32, u32);
extern Entity* gUnk_020000B0;
extern const ScreenTransitionData gUnk_0813AB94;
diff --git a/src/enemy/wallMaster.c b/src/enemy/wallMaster.c
index 554ca1c5..a9648193 100644
--- a/src/enemy/wallMaster.c
+++ b/src/enemy/wallMaster.c
@@ -9,8 +9,6 @@
#include "area.h"
#include "functions.h"
-extern void sub_08001328(Entity*);
-extern Entity* sub_08049DF4(u32);
extern ScreenTransitionData* gUnk_0813AB1C[];
void sub_0802A78C(Entity*);
diff --git a/src/npc/cat.c b/src/npc/cat.c
index 1b69f913..4d236eb6 100644
--- a/src/npc/cat.c
+++ b/src/npc/cat.c
@@ -40,8 +40,6 @@ extern u16 gUnk_08111104[];
extern u32 sub_0806FCA0(Entity*, Entity*);
-extern Entity* sub_08049DF4(u32);
-
void sub_08067790(Entity* this) {
ShowNPCDialogue(this, &gUnk_08110EF8 + this->type * 10 + gSave.global_progress);
}
diff --git a/src/npc/npc5.c b/src/npc/npc5.c
index 3c2f89b3..3e1c9e7c 100644
--- a/src/npc/npc5.c
+++ b/src/npc/npc5.c
@@ -53,7 +53,6 @@ extern struct {
s8 unk_1;
} gUnk_0810AC4C[];
extern u8 gUnk_0810AC54[8];
-extern u32 sub_080002B4(Entity*, u32, u32);
extern u8 gUnk_0810AC5D;
diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c
index 05f38e8c..a7330944 100644
--- a/src/npc/stockwell.c
+++ b/src/npc/stockwell.c
@@ -11,8 +11,6 @@ extern void (*const gUnk_0810FDC8[])(Entity*);
extern void (*const gUnk_0810FDA4[])(Entity*);
-extern bool32 sub_08056338(void);
-
extern void sub_08078850(Entity*, u32, u8, u32*);
extern u32 gUnk_0810FDA0;
extern u16 script_Stockwell;
diff --git a/src/object/bakerOven.c b/src/object/bakerOven.c
index a5b344ba..51c50ca4 100644
--- a/src/object/bakerOven.c
+++ b/src/object/bakerOven.c
@@ -1,7 +1,7 @@
#include "object.h"
+#include "functions.h"
extern void SoundReqClipped(Entity*, u32);
-extern u32 sub_0806FC80(Entity*, Entity*, s32);
extern void sub_0809CDF0(Entity*);
extern void (*const gUnk_08123E20[])(Entity*);
diff --git a/src/object/button.c b/src/object/button.c
index 1d1c88d9..cb7a58c7 100644
--- a/src/object/button.c
+++ b/src/object/button.c
@@ -136,7 +136,6 @@ u32 sub_08081D28(Entity* this) {
return 1;
}
-extern u32 sub_080002E0(u32, u32);
extern Entity* gPlayerClones[3];
u32 sub_08081E0C(Entity*);
diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c
new file mode 100644
index 00000000..91f13635
--- /dev/null
+++ b/src/object/lilypadLarge.c
@@ -0,0 +1,385 @@
+/**
+ * @file lilypadLarge.c
+ * @ingroup Objects
+ *
+ * @brief Large Lilypad object
+ */
+
+#define NENT_DEPRECATED
+#include "global.h"
+#include "area.h"
+#include "functions.h"
+#include "item.h"
+#include "object.h"
+
+typedef struct {
+ Entity base;
+ u8 unk_68[4];
+ s32 unk_6c;
+ s32 unk_70;
+ s16 unk_74;
+ s16 unk_76;
+ union SplitWord unk_78;
+ union SplitWord unk_7c;
+ u8 unk_80[2];
+ u16 unk_82;
+ u8 unk_84;
+ u8 unk_85;
+} LilypadLargeEntity;
+
+extern void (*const gUnk_08120608[])(LilypadLargeEntity*);
+extern Hitbox gUnk_08120640;
+extern void (*const gUnk_0812062C[])(LilypadLargeEntity*);
+extern u8 gUnk_08120638[];
+extern u8 gUnk_08126EE4[];
+extern u32 gUnk_08120620[];
+
+void sub_080855E8(LilypadLargeEntity*);
+void sub_08085CDC(LilypadLargeEntity*);
+void sub_08085EFC(LilypadLargeEntity*);
+void sub_08085F1C(LilypadLargeEntity*);
+void sub_08085E74(LilypadLargeEntity*);
+void sub_08085F48(LilypadLargeEntity*);
+void sub_08085D28(LilypadLargeEntity*);
+void sub_08085D60(LilypadLargeEntity*);
+
+void LilypadLarge(LilypadLargeEntity* this) {
+ gUnk_08120608[super->action](this);
+}
+
+void sub_08085504(LilypadLargeEntity* this) {
+ if (super->type == 0xff) {
+ if (GetInventoryValue(ITEM_FLIPPERS)) {
+ DeleteThisEntity();
+ }
+ super->type = 0;
+ }
+ if (super->type != 0) {
+ if (gArea.locationIndex == 0x1b) {
+ if (CheckLocalFlag(super->type2) == 0) {
+ DeleteThisEntity();
+ }
+ } else {
+ if (CheckLocalFlag(super->type2) == 0) {
+ super->action = 5;
+ return;
+ }
+ }
+ }
+ if (super->actionDelay != 0) {
+ if (sub_080040A2(super) == 0) {
+ DeleteThisEntity();
+ }
+ super->actionDelay = 0;
+ } else {
+ if (EntityHasDuplicateID(super) != 0) {
+ DeleteThisEntity();
+ }
+ }
+ super->action = 1;
+ super->speed = 0x100;
+ super->spritePriority.b0 = 6;
+ super->hitbox = &gUnk_08120640;
+ super->flags |= 0x80;
+ super->field_0x3c = 7;
+ super->hitType = 1;
+ super->flags2 = 4;
+ this->unk_78.WORD = 0x1000000;
+ this->unk_7c.HALF_U.HI = 0x1000;
+ this->unk_85 = 0;
+ this->unk_84 = 0;
+ InitializeAnimation(super, 9);
+ sub_080855E8(this);
+}
+
+ASM_FUNC("asm/non_matching/lilypadLarge/sub_080855E8.inc", void sub_080855E8(LilypadLargeEntity* this));
+
+void sub_08085A1C(LilypadLargeEntity* this) {
+ gUnk_0812062C[super->subAction](this);
+ gPlayerState.flags |= 2;
+ sub_08078B48();
+}
+
+void sub_08085A44(LilypadLargeEntity* this) {
+ super->speed = 0x200;
+ if (sub_080002B4(super, 0x10, 0x18) != 0x11) {
+ super->direction = 0x18;
+ } else {
+ if (sub_080002B4(super, 0xfffffff0, 0x18) != 0x11) {
+ super->direction = 8;
+ } else {
+ super->direction = 0x10;
+ super->subAction = 1;
+ return;
+ }
+ }
+ sub_08085EFC(this);
+ sub_080AF134(super);
+ sub_08085F1C(this);
+}
+
+void sub_08085A98(LilypadLargeEntity* this) {
+ sub_08085EFC(this);
+ LinearMoveUpdate(super);
+ sub_08085F1C(this);
+ if (0x7fffff < (u32)this->unk_78.WORD) {
+ this->unk_78.WORD -= 0x20000;
+ sub_0805EC9C(super, this->unk_78.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7c.HALF_U.HI);
+ }
+ if (sub_080002B4(super, 0, 0x18) != 0x11) {
+ super->subAction = 2;
+ if (gArea.locationIndex == 0x1b) {
+ super->y.HALF.HI += 0xd0;
+ super->z.HALF.HI = 0xff30;
+ this->unk_82 = 0x46;
+ SetLocalFlag(0x73);
+ } else {
+ super->y.HALF.HI += 0x40;
+ super->z.HALF.HI = 0xffc0;
+ this->unk_82 = 0xf;
+ }
+ CreateObjectWithParent(super, OBJECT_2B, 0, 0);
+ SoundReq(SFX_12D);
+ }
+}
+
+void sub_08085B40(LilypadLargeEntity* this) {
+ if (super->z.WORD != 0) {
+ if (GravityUpdate(super, 0x2000) != 0) {
+ if ((u32)this->unk_78.WORD < 0x1200000) {
+ this->unk_78.WORD += 0x100000;
+ sub_0805EC9C(super, this->unk_78.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7c.HALF_U.HI);
+ }
+ gPlayerEntity.y.HALF.HI = (super->y.HALF.HI + super->z.HALF.HI) - this->unk_74;
+ if (gArea.locationIndex == 0x1b) {
+ gPlayerEntity.z.HALF.HI = super->y.HALF.HI - this->unk_74 - 0xd0 - gPlayerEntity.y.HALF.HI;
+ } else {
+ gPlayerEntity.z.HALF.HI = super->y.HALF.HI - this->unk_74 - 0x40 - gPlayerEntity.y.HALF.HI;
+ }
+ }
+ } else {
+ ResetCollisionLayer(super);
+ if (sub_080002B8(super) == 0xd) {
+ ResetCollisionLayer(&gPlayerEntity);
+ sub_08085CDC(this);
+ super->direction = GetFacingDirection(&gPlayerEntity, super);
+ sub_0806F5BC(&gPlayerEntity, 0x100, super->direction);
+ }
+ }
+
+ if (this->unk_82 == 0) {
+ if (GravityUpdate(&gPlayerEntity, 0x2000) == 0) {
+ ResetCollisionLayer(&gPlayerEntity);
+ sub_08085F1C(this);
+ super->action = 1;
+ super->field_0xf = 4;
+ while (super->field_0xf != 0) {
+ sub_080A2AF4(super, 8, 10);
+ super->field_0xf--;
+ }
+ super->field_0xf = 1;
+ super->actionDelay |= 0x80;
+ this->unk_70 = 0;
+ this->unk_6c = 0;
+ if (sub_080002B8(super) == 0xd) {
+ super->action = 4;
+ }
+ }
+ } else {
+ this->unk_82--;
+ }
+}
+
+void sub_08085C5C(LilypadLargeEntity* this) {
+ if (sub_0806FC80(super, &gPlayerEntity, 0x18) != 0) {
+ LinearMoveUpdate(super);
+ gPlayerEntity.speed = super->speed;
+ gPlayerEntity.direction = super->direction;
+ LinearMoveUpdate(&gPlayerEntity);
+ gPlayerState.flags |= 2;
+ if (super->collisionLayer == 1) {
+ ResetCollisionLayer(&gPlayerEntity);
+ } else {
+ sub_08004542(&gPlayerEntity);
+ }
+ }
+ if (gRoomControls.reload_flags == 0) {
+ super->flags &= 0xdf;
+ super->action = 1;
+ super->updatePriority = super->updatePriorityPrev;
+ gRoomControls.camera_target = &gPlayerEntity;
+ }
+}
+
+void sub_08085CDC(LilypadLargeEntity* this) {
+ this->unk_78.WORD += 0x100000;
+ if (this->unk_78.WORD_U < 0x4000000) {
+ sub_0805EC9C(super, this->unk_78.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7c.HALF_U.HI);
+ } else {
+ DeleteThisEntity();
+ }
+}
+
+void sub_08085D10(LilypadLargeEntity* this) {
+ if (EntityHasDuplicateID(super) != 0) {
+ SetLocalFlag(super->type2);
+ DeleteThisEntity();
+ }
+}
+
+void sub_08085D28(LilypadLargeEntity* this) {
+ if (((gPlayerState.framestate != 0x13) && ((gPlayerState.flags & 2) != 0)) &&
+ (sub_080002B4(super, 0, 0x18) == 0x11)) {
+ super->action = 2;
+ super->subAction = 0;
+ sub_08078B48();
+ }
+}
+
+NONMATCH("asm/non_matching/lilypadLarge/sub_08085D60.inc", void sub_08085D60(LilypadLargeEntity* this)) {
+ u32 r4; // horizontal direction?
+ u32 r6; // vertical direction?
+ if ((gPlayerState.flags & 2) != 0) {
+ if (gPlayerState.framestate != 0x12) {
+ if (gPlayerState.jump_status == 0) {
+ if ((super->direction & 7) == 0) { // North or South
+ r4 = super->direction;
+ r6 = super->direction;
+ } else {
+ if ((super->direction & 0x10) != 0) { // South(already top) or West
+ r4 = DirectionWest;
+ } else {
+ r4 = DirectionEast;
+ }
+ if (super->direction - 8 > 0x10) { // North(already top) or West(?)
+ r6 = DirectionNorth;
+ } else {
+ r6 = DirectionSouth;
+ }
+ }
+ if (r4 == DirectionWest || r4 == DirectionEast) { // Handle horizontal
+ u32 tmp = r4 >> 2;
+ s32 tmpX = gUnk_08120638[tmp];
+ s32 tmpY = gUnk_08120638[tmp + 1];
+ if (sub_080002CC(super, tmpX, tmpY) == 0xff) {
+
+ if (sub_080806BC((super->x.HALF.HI - gRoomControls.origin_x) + tmpX,
+ (super->y.HALF.HI - gRoomControls.origin_y) + tmpY, r4, 5) == 0) {
+ if (sub_0807BD14(&gPlayerEntity, r4 >> 3) != 0) {
+ super->direction = r4;
+ sub_08085E74(this);
+ return;
+ }
+ } else {
+ super->direction = r4;
+ return;
+ }
+ }
+ }
+ if (r6 == DirectionNorth || r6 == DirectionSouth) { // Handle vertical
+ u32 tmp = r6 >> 2;
+ s32 tmpX = (u8)gUnk_08120638[tmp];
+ s32 tmpY = gUnk_08120638[tmp + 1];
+ if (sub_080002CC(super, tmpX, tmpY) == 0xff) {
+ if (sub_0807BD14(&gPlayerEntity, r6 >> 3) != 0) {
+ super->direction = (u8)r6;
+ sub_08085E74(this);
+ }
+ }
+ }
+ return;
+ }
+ }
+ }
+ super->flags &= 0xdf;
+}
+END_NONMATCH
+
+void sub_08085E74(LilypadLargeEntity* this) {
+ super->flags |= 0x20;
+ super->updatePriority = 6;
+ super->action = 3;
+ switch (super->direction) {
+ case DirectionNorth:
+ super->speed = 0x120;
+ break;
+ case DirectionSouth:
+ super->speed = 0x138;
+ break;
+ case DirectionEast:
+ case DirectionWest:
+ super->speed = 0x100;
+ break;
+ }
+ this->unk_70 = 0;
+ this->unk_6c = 0;
+ super->x.HALF.LO = 0;
+ super->y.HALF.LO = 0;
+ gPlayerEntity.x.HALF.LO = 0;
+ gPlayerEntity.y.HALF.LO = 0;
+ gPlayerEntity.direction = super->direction;
+ gPlayerState.animation = 0x100;
+ gRoomControls.camera_target = super;
+ if (gPlayerState.item != NULL) {
+ DeleteEntity(gPlayerState.item);
+ }
+ ResetPlayer();
+}
+
+void sub_08085EFC(LilypadLargeEntity* this) {
+ this->unk_76 = super->x.HALF.HI - gPlayerEntity.x.HALF.HI;
+ this->unk_74 = super->y.HALF.HI - gPlayerEntity.y.HALF.HI;
+}
+
+void sub_08085F1C(LilypadLargeEntity* this) {
+ gPlayerEntity.x.HALF.HI = super->x.HALF.HI - this->unk_76;
+ gPlayerEntity.y.HALF.HI = super->y.HALF.HI - this->unk_74;
+ sub_0807A5B8(super->direction);
+}
+
+void sub_08085F48(LilypadLargeEntity* this) {
+ u32 tmp = super->actionDelay & 0x80;
+ if (tmp != 0) {
+ if (gPlayerState.floor_type == 0x17) {
+ ResetPlayerVelocity();
+ gPlayerState.floor_type = 0x19;
+ }
+ SoundReq(SFX_WATER_WALK);
+ if (this->unk_78.WORD_U < 0x1280000) {
+ this->unk_78.WORD_U += 0x80000;
+ } else {
+ super->actionDelay = 0;
+ }
+ } else {
+ if ((gPlayerState.flags & 2) != 0) {
+ if (super->actionDelay != 0) {
+ if (this->unk_78.WORD_U < 0x1200000) {
+ this->unk_78.WORD_U += 0x8000;
+ } else {
+ super->actionDelay = tmp;
+ }
+ } else {
+ if (this->unk_78.WORD_U > 0x1100000) {
+ this->unk_78.WORD_U -= 0x8000;
+ } else {
+ super->actionDelay = 1;
+ }
+ }
+ } else {
+ if (super->actionDelay != 0) {
+ if (this->unk_78.WORD_U < 0x1100000) {
+ this->unk_78.WORD_U += 0x4000;
+ } else {
+ super->actionDelay = 0;
+ }
+ } else {
+ if (this->unk_78.WORD_U > 0x1060000) {
+ this->unk_78.WORD_U -= 0x4000;
+ } else {
+ super->actionDelay = 1;
+ }
+ }
+ }
+ }
+ sub_0805EC9C(super, this->unk_78.HALF_U.HI, this->unk_78.HALF_U.HI, this->unk_7c.HALF_U.HI);
+}
diff --git a/src/object/mask.c b/src/object/mask.c
index 4e9810c3..73b42095 100644
--- a/src/object/mask.c
+++ b/src/object/mask.c
@@ -5,7 +5,6 @@ extern void (*MaskActionFuncs[])(Entity*);
extern void sub_08000148(u16, u16, u32);
extern s16 sub_080001DA(u16, u32);
-extern u16 sub_080002E0(u16, u32);
extern void sub_0805457C(Entity*, s32);
@@ -52,7 +51,7 @@ void sub_080929A4(Entity* this) {
this->field_0x7c.HALF.HI = COORD_TO_TILE(this);
this->field_0x7c.HALF.LO = sub_080001DA(this->field_0x7c.HALF.HI, 1);
- this->field_0x7a.HWORD = sub_080002E0(this->field_0x7c.HALF.HI, 1);
+ this->field_0x7a.HWORD = sub_080002E0((u16)this->field_0x7c.HALF.HI, 1);
SetTile(0x4022, this->field_0x7c.HALF_U.HI, 1);
}
diff --git a/src/object/minecart.c b/src/object/minecart.c
index fee9da56..c39a4931 100644
--- a/src/object/minecart.c
+++ b/src/object/minecart.c
@@ -2,7 +2,6 @@
#include "functions.h"
extern u32 sub_08091DDC(Entity*);
-extern u32 sub_080002B4(Entity*, u32, u32);
extern u32 sub_08007DD6(u32, u32);
extern void sub_08017744(Entity*);
extern void sub_08091C0C(Entity*);
diff --git a/src/object/octorokBossObject.c b/src/object/octorokBossObject.c
index a6e3a625..7eac6c78 100644
--- a/src/object/octorokBossObject.c
+++ b/src/object/octorokBossObject.c
@@ -40,8 +40,6 @@ enum OctorokBossObjectType {
};
#define GET_HELPER(this) (*(HelperStruct**)&(this)->cutsceneBeh)
-extern u32 sub_0806FC80(Entity*, Entity*, s32);
-
void OctorokBossObject(Entity* this) {
OctorokBossObject_Actions[this->action](this);
}
diff --git a/src/projectile/gleerokProjectile.c b/src/projectile/gleerokProjectile.c
index 959d3957..5b63e25f 100644
--- a/src/projectile/gleerokProjectile.c
+++ b/src/projectile/gleerokProjectile.c
@@ -4,7 +4,6 @@
#include "player.h"
#include "functions.h"
-extern void sub_0806F5BC(Entity*, u32, u32);
extern u32 sub_080041DC(Entity*, u32, u32);
extern void (*const GleerokProjectile_Functions[])(Entity*);
diff --git a/src/projectile/mandiblesProjectile.c b/src/projectile/mandiblesProjectile.c
index 0e5599a2..6e261021 100644
--- a/src/projectile/mandiblesProjectile.c
+++ b/src/projectile/mandiblesProjectile.c
@@ -4,10 +4,6 @@
#include "functions.h"
#include "game.h"
-extern Entity* sub_08049DF4(u32);
-extern u32 sub_08049F1C(Entity*, Entity*, u32);
-extern s32 sub_080AF090(Entity*);
-extern u32 sub_0806F824(Entity*, Entity*, u32, u32);
extern Hitbox gHitbox_0;
extern void (*const MandiblesProjectile_Functions[])(Entity*);
diff --git a/src/projectile/octorokBossProjectile.c b/src/projectile/octorokBossProjectile.c
index b5ed8193..1ca08f9d 100644
--- a/src/projectile/octorokBossProjectile.c
+++ b/src/projectile/octorokBossProjectile.c
@@ -5,7 +5,6 @@
void OctorokBossProjectile_Action2(Entity*);
extern void sub_080AE58C(Entity*, u32, u32);
-extern u32 sub_0806FC80(Entity*, Entity*, s32);
extern void (*const OctorokBossProjectile_Functions[])(Entity*);
extern void (*const OctorokBossProjectile_Actions[])(Entity*);
diff --git a/src/projectile/v1FireProjectile.c b/src/projectile/v1FireProjectile.c
index 68cad995..90bdc5fd 100644
--- a/src/projectile/v1FireProjectile.c
+++ b/src/projectile/v1FireProjectile.c
@@ -3,7 +3,6 @@
#include "player.h"
#include "functions.h"
-extern void sub_0806F5BC(Entity*, u32, u32);
extern u32 sub_080041DC(Entity*, u32, u32);
extern void (*const V1FireProjectile_Functions[])(Entity*);