Merge pull request #677 from tonyjih/match_sub_0802C334

True match sub_0802C334
This commit is contained in:
Theo 2023-12-29 21:41:10 -08:00 committed by GitHub
commit 3359557489
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 20 deletions

View File

@ -65,45 +65,42 @@ void sub_0802C318(Entity* this) {
} }
void sub_0802C334(Entity* this) { void sub_0802C334(Entity* this) {
register Entity* ent asm("r2"); Entity* ent;
u32 diff; u32 roomOriginY, tmp;
u16 tmp; s32 y, i;
if (this->field_0x7c.HALF_U.LO == 0) { if (this->field_0x7c.HALF_U.LO == 0) {
u32 tmp = gRoomControls.origin_y; roomOriginY = gRoomControls.origin_y;
ent = &gPlayerEntity; ent = &gPlayerEntity;
if (ent == NULL) if (ent == NULL)
return; return;
if (ent->y.HALF.HI - tmp <= 0x38) { tmp = ent->y.HALF.HI;
if (0x38 >= tmp - roomOriginY)
return; return;
}
this->field_0x7c.HALF_U.LO = 1; this->field_0x7c.HALF_U.LO = 1;
this->spriteSettings.draw = 1; this->spriteSettings.draw = 1;
} }
GetNextFrame(this); GetNextFrame(this);
this->field_0x7c.HALF.HI = COORD_TO_TILE(this); this->field_0x7c.HALF.HI = COORD_TO_TILE(this);
if (sub_080044EC(this, *(u32*)&this->cutsceneBeh) == 1) { if (sub_080044EC(this, *(u32*)&this->cutsceneBeh) == 1) {
EnqueueSFX(0x14c); EnqueueSFX(0x14c);
COLLISION_ON(this); COLLISION_ON(this);
this->field_0x7a.HWORD = 0xc; this->field_0x7a.HWORD = 12;
sub_0802C4B0(this); sub_0802C4B0(this);
} else { } else {
s32 y;
if (this->field_0x7a.HWORD) { if (this->field_0x7a.HWORD) {
tmp = --this->field_0x7a.HWORD; switch (--this->field_0x7a.HWORD) {
switch (tmp) {
case 0: case 0:
COLLISION_OFF(this); COLLISION_OFF(this);
break; break;
case 8: case 8:
if (this->type2 != 0 && !sub_08049FA0(this)) { if (this->type2 != 0 && !sub_08049FA0(this)) {
diff = 0; for (i = 0; i < 2; i++) {
for (y = 1; y > -1; y--) {
ent = CreateFx(this, FX_ROCK2, 0); ent = CreateFx(this, FX_ROCK2, 0);
if (ent) { if (ent) {
ent->x.HALF.HI = ent->x.HALF.HI + 12 - diff; ent->x.HALF.HI += 12 - i * 0x18;
} }
diff += 0x18;
} }
sub_0802C62C(this); sub_0802C62C(this);
this->field_0x7a.HWORD = (Random() & 0xff) | 0x100; this->field_0x7a.HWORD = (Random() & 0xff) | 0x100;
@ -112,11 +109,9 @@ void sub_0802C334(Entity* this) {
break; break;
} }
} }
roomOriginY = gRoomControls.origin_y;
{ tmp = gRoomControls.height;
FORCE_REGISTER(RoomControls * tmp, r0) = &gRoomControls; y = roomOriginY + tmp - this->y.HALF.HI;
y = tmp->origin_y + tmp->height - this->y.HALF.HI;
}
if (y >= 5) { if (y >= 5) {
ProcessMovement1(this); ProcessMovement1(this);
@ -131,6 +126,7 @@ void sub_0802C334(Entity* this) {
} }
} }
} }
this->collisionLayer = 3; this->collisionLayer = 3;
this->spritePriority.b0 = 1; this->spritePriority.b0 = 1;
UpdateSpriteForCollisionLayer(this); UpdateSpriteForCollisionLayer(this);