summaryrefslogtreecommitdiff
path: root/src/object
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-03-08 06:21:15 +0200
committerTal Hayon <talhayon1@gmail.com>2022-03-08 06:34:19 +0200
commitea85b8e04b1983cec3fc132ae90b73ca69d7a11a (patch)
treec196b60181be94da3edf8a2b1471a577c1266dca /src/object
parent12e8722606b1bb8686949f7f7e6afd3b495e985a (diff)
Decompile floatingPlatform
Diffstat (limited to 'src/object')
-rw-r--r--src/object/floatingPlatform.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/object/floatingPlatform.c b/src/object/floatingPlatform.c
new file mode 100644
index 00000000..d62d7603
--- /dev/null
+++ b/src/object/floatingPlatform.c
@@ -0,0 +1,72 @@
+#define NENT_DEPRECATED
+#include "entity.h"
+#include "functions.h"
+#include "object.h"
+
+typedef struct {
+ Entity base;
+ u8 filler[0x8];
+ u16 unk70;
+} FloatingPlatformEntity;
+
+void sub_080860D8(FloatingPlatformEntity*);
+void sub_0808611C(FloatingPlatformEntity*);
+bool32 sub_08086168(FloatingPlatformEntity*);
+
+void FloatingPlatform(Entity* this) {
+ static void (*const actionFuncs[])(FloatingPlatformEntity*) = {
+ sub_080860D8,
+ sub_0808611C,
+ };
+
+ actionFuncs[this->action]((FloatingPlatformEntity*)this);
+}
+
+void sub_080860D8(FloatingPlatformEntity* this) {
+ super->action = 1;
+ super->speed = 0x100;
+ super->spriteSettings.draw = 1;
+ super->frameIndex = super->type;
+ super->spritePriority.b0 = 7;
+ super->child = (Entity*)GetCurrentRoomProperty(super->type2);
+ sub_080A2CC0(super, (u16**)&super->child, &this->unk70);
+}
+
+void sub_0808611C(FloatingPlatformEntity* this) {
+ int iVar2;
+
+ iVar2 = sub_08086168(this);
+ if (super->actionDelay != 0 && super->parent->actionDelay == 0) {
+
+ if (iVar2 != 0) {
+ super->parent->actionDelay++;
+ }
+
+ sub_080A2BE4(super, iVar2);
+ } else if (super->actionDelay == 0) {
+ sub_080A2BE4(super, iVar2);
+ } else {
+ sub_080A2BE4(super, 0);
+ }
+
+ if (--this->unk70 == 0) {
+ sub_080A2CC0(super, (u16**)&super->child, &this->unk70);
+ }
+}
+
+bool32 sub_08086168(FloatingPlatformEntity* this) {
+ static const u8 gUnk_08120658[] = { 0x12, 0xa, 0xa, 0x12, 0x12, 0x12, 0x1a, 0x1a };
+ const u8* ptr;
+
+ ptr = gUnk_08120658 + super->type * 2;
+ if (((EntityInRectRadius(super, &gPlayerEntity, ptr[0], ptr[1])) && sub_08079F8C())) {
+ gPlayerState.field_0x14 = 1;
+ if (gPlayerEntity.z.HALF.HI == 0) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ } else {
+ return FALSE;
+ }
+}