diff options
| author | Tony Jih <tonyjih@gmail.com> | 2023-12-23 17:20:52 +0800 |
|---|---|---|
| committer | Tony Jih <tonyjih@gmail.com> | 2023-12-23 17:20:52 +0800 |
| commit | c8598c065ded05b4e8723be3e5727c74f0684db9 (patch) | |
| tree | c93b4d305a7cf0481f524fa899b0c748fdd8b23d /src | |
| parent | 040b1f3a5972ee86d12c84ae741d286d6b43f8fa (diff) | |
Match sub_08039B28
Diffstat (limited to 'src')
| -rw-r--r-- | src/enemy/stalfos.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/enemy/stalfos.c b/src/enemy/stalfos.c index bb2db80e..d2b2855f 100644 --- a/src/enemy/stalfos.c +++ b/src/enemy/stalfos.c @@ -453,24 +453,23 @@ u32 sub_08039B28(StalfosEntity* this) { const u16* ptr; const s8* ptr2; - if (super->child == NULL) { - ptr2 = &gUnk_080CF930[super->animationState * 2]; - pos = COORD_TO_TILE_OFFSET(super, -ptr2[0], -ptr2[1]); - - tileType = GetTileType(pos, (u32)super->collisionLayer); - ptr = gUnk_080CF938; - do { - if (ptr[0] != tileType) { - ptr += 2; - } else { - goto found; - } - } while (ptr[0] != 0); - } - return 0xffff; -found: - super->type2 = ptr[1]; - return pos; + if (super->child != NULL) { + return (u16)-1; + } + ptr2 = &gUnk_080CF930[super->animationState * 2]; + pos = COORD_TO_TILE_OFFSET(super, -ptr2[0], -ptr2[1]); + tileType = GetTileType(pos, (u32)super->collisionLayer); + ptr = gUnk_080CF938; + + do { + if (ptr[0] == tileType) { + super->type2 = ptr[1]; + return pos; + } + ptr += 2; + } while (ptr[0] != 0); + + return (u16)-1; } void (*const Stalfos_Functions[])(StalfosEntity*) = { |
