mirror of
https://github.com/zeldaret/tmc
synced 2026-07-02 12:36:27 -04:00
Decompile floatingPlatform
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user