diff options
| author | Tal Hayon <talhayon1@gmail.com> | 2022-03-08 06:21:15 +0200 |
|---|---|---|
| committer | Tal Hayon <talhayon1@gmail.com> | 2022-03-08 06:34:19 +0200 |
| commit | ea85b8e04b1983cec3fc132ae90b73ca69d7a11a (patch) | |
| tree | c196b60181be94da3edf8a2b1471a577c1266dca /src | |
| parent | 12e8722606b1bb8686949f7f7e6afd3b495e985a (diff) | |
Decompile floatingPlatform
Diffstat (limited to 'src')
| -rw-r--r-- | src/object/floatingPlatform.c | 72 | ||||
| -rw-r--r-- | src/playerUtils.c | 6 |
2 files changed, 76 insertions, 2 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; + } +} diff --git a/src/playerUtils.c b/src/playerUtils.c index ada94b39..4b511d7c 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -1254,8 +1254,10 @@ bool32 sub_08079F48(u32 param_1, u32 param_2) { } bool32 sub_08079F8C(void) { - if ((gPlayerState.flags & 0x22189b75) != 0 || gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == 3 || - gPlayerEntity.action == 0xb) { + if ((gPlayerState.flags & + (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_FROZEN | PL_FALLING | PL_DISABLE_ITEMS | + PL_FLAGS8000 | PL_IN_MINECART | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING)) != 0 || + gPlayerState.field_0x3c[0] != 0 || gPlayerEntity.action == 3 || gPlayerEntity.action == 0xb) { return FALSE; } else { return TRUE; |
