diff options
| author | Theo <65437533+notyourav@users.noreply.github.com> | 2023-12-29 21:41:10 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-29 21:41:10 -0800 |
| commit | 335955748912ece0af3f9619932221585dae2221 (patch) | |
| tree | d5e662ea3f01191392910f788d31a6a8355859a1 /src | |
| parent | c2f081600bca5c3f1f82d7bac8bc5827faf0d17a (diff) | |
| parent | 44072497eaa1adf0a7141ad8d4c8f09318021bc6 (diff) | |
Merge pull request #677 from tonyjih/match_sub_0802C334
True match sub_0802C334
Diffstat (limited to 'src')
| -rw-r--r-- | src/enemy/fallingBoulder.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/enemy/fallingBoulder.c b/src/enemy/fallingBoulder.c index 5f9f5ce2..11c6b742 100644 --- a/src/enemy/fallingBoulder.c +++ b/src/enemy/fallingBoulder.c @@ -65,45 +65,42 @@ void sub_0802C318(Entity* this) { } void sub_0802C334(Entity* this) { - register Entity* ent asm("r2"); - u32 diff; - u16 tmp; + Entity* ent; + u32 roomOriginY, tmp; + s32 y, i; if (this->field_0x7c.HALF_U.LO == 0) { - u32 tmp = gRoomControls.origin_y; + roomOriginY = gRoomControls.origin_y; ent = &gPlayerEntity; if (ent == NULL) return; - if (ent->y.HALF.HI - tmp <= 0x38) { + tmp = ent->y.HALF.HI; + if (0x38 >= tmp - roomOriginY) return; - } this->field_0x7c.HALF_U.LO = 1; this->spriteSettings.draw = 1; } + GetNextFrame(this); this->field_0x7c.HALF.HI = COORD_TO_TILE(this); + if (sub_080044EC(this, *(u32*)&this->cutsceneBeh) == 1) { EnqueueSFX(0x14c); COLLISION_ON(this); - this->field_0x7a.HWORD = 0xc; + this->field_0x7a.HWORD = 12; sub_0802C4B0(this); } else { - s32 y; - if (this->field_0x7a.HWORD) { - tmp = --this->field_0x7a.HWORD; - switch (tmp) { + switch (--this->field_0x7a.HWORD) { case 0: COLLISION_OFF(this); break; case 8: if (this->type2 != 0 && !sub_08049FA0(this)) { - diff = 0; - for (y = 1; y > -1; y--) { + for (i = 0; i < 2; i++) { ent = CreateFx(this, FX_ROCK2, 0); if (ent) { - ent->x.HALF.HI = ent->x.HALF.HI + 12 - diff; + ent->x.HALF.HI += 12 - i * 0x18; } - diff += 0x18; } sub_0802C62C(this); this->field_0x7a.HWORD = (Random() & 0xff) | 0x100; @@ -112,11 +109,9 @@ void sub_0802C334(Entity* this) { break; } } - - { - FORCE_REGISTER(RoomControls * tmp, r0) = &gRoomControls; - y = tmp->origin_y + tmp->height - this->y.HALF.HI; - } + roomOriginY = gRoomControls.origin_y; + tmp = gRoomControls.height; + y = roomOriginY + tmp - this->y.HALF.HI; if (y >= 5) { ProcessMovement1(this); @@ -131,6 +126,7 @@ void sub_0802C334(Entity* this) { } } } + this->collisionLayer = 3; this->spritePriority.b0 = 1; UpdateSpriteForCollisionLayer(this); |
