diff options
| author | notyourav <65437533+notyourav@users.noreply.github.com> | 2022-03-02 15:42:43 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-02 15:42:43 -0800 |
| commit | 1c32cee2d2ba6deed2554b18eff8041bbb3d5444 (patch) | |
| tree | 1269cb101cf5d9a18048e87ca9ce8100e7f14238 /src/object | |
| parent | 80ab6d013fa58042bd0218464813fac4b844c035 (diff) | |
| parent | 5f6405bf84641e346f6624ee926f7551d9f6810b (diff) | |
Merge pull request #419 from hatal175/ladder
decompile ladderHoleInBookshelf
Diffstat (limited to 'src/object')
| -rw-r--r-- | src/object/ladderHoleInBookshelf.c | 60 |
1 files changed, 60 insertions, 0 deletions
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; +} |
