From 5f6405bf84641e346f6624ee926f7551d9f6810b Mon Sep 17 00:00:00 2001 From: Tal Hayon Date: Mon, 28 Feb 2022 21:03:39 +0200 Subject: decompile ladderHoleInBookshelf --- src/object/ladderHoleInBookshelf.c | 60 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/object/ladderHoleInBookshelf.c (limited to 'src/object') diff --git a/src/object/ladderHoleInBookshelf.c b/src/object/ladderHoleInBookshelf.c new file mode 100644 index 00000000..4e3cb3fb --- /dev/null +++ b/src/object/ladderHoleInBookshelf.c @@ -0,0 +1,60 @@ +#include "entity.h" +#include "player.h" + +void sub_08093FCC(Entity* this); +void sub_08093FE0(Entity* this); +bool32 sub_08094064(Entity* this); + +void LadderHoleInBookshelf(Entity* this) { + static void (*const actionFuncs[])(Entity*) = { + sub_08093FCC, + sub_08093FE0, + }; + + actionFuncs[this->action](this); +} + +void sub_08093FCC(Entity* this) { + this->action = 1; + this->collisionLayer = 2; + UpdateSpriteForCollisionLayer(this); +} + +void sub_08093FE0(Entity* this) { + if (sub_08094064(this)) { + if (this->collisionLayer == 2) { + switch (gPlayerEntity.action) { + case 0x1d: + case 0x1e: + return; + } + this->collisionLayer = 1; + UpdateSpriteForCollisionLayer(this); + this->spritePriority.b0 = 5; + } else { + switch (gPlayerEntity.action) { + case 0x1d: + case 0x1e: + this->collisionLayer = 2; + UpdateSpriteForCollisionLayer(this); + this->spritePriority.b0 = 1; + break; + default: + if ((gPlayerEntity.collisionLayer & 2) == 0) { + break; + } + gPlayerEntity.collisionLayer = 1; + break; + } + } + } +} + +bool32 sub_08094064(Entity* this) { + bool32 rv = 1; + if (gPlayerEntity.x.HALF.HI - this->x.HALF.HI + 0x1cU >= 0x39) { + rv = 0; + } + + return rv; +} -- cgit v1.2.3