Merge pull request #439 from djoslin0/to-upstream

Prevent crash in vanish cap switch course
This commit is contained in:
fgsfds 2020-10-11 23:45:23 +03:00 committed by GitHub
commit 2cf99649d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -925,7 +925,7 @@ void find_surface_on_ray(Vec3f orig, Vec3f dir, struct Surface **hit_surface, Ve
}
// increase collision checking precision (normally 1)
f32 precision = 3;
f32 precision = gCheckingSurfaceCollisionsForCamera ? 3 : 1;
// Get cells we cross using DDA
if (absx(dir[0]) >= absx(dir[2]))

View File

@ -4,6 +4,14 @@ struct Struct8032F754 D_8032F754[] = { { 145, { 0.7f, 1.5f, 0.7f }, 7.0f },
{ 235, { 1.2f, 2.0f, 1.2f }, 11.6f } };
void bhv_checkerboard_elevator_group_init(void) {
// Added to prevent a crash in the vanish cap stage
cur_obj_hide();
// Here's the theory: Since it is only valid for a few frames, I believe
// the model gets deallocated after removal. Since changing the camera
// precision makes the camera end up in a slightly different spot, it
// could be trying to render the object when `precision` is set to 3 but
// not to 1.
s32 sp3C;
s32 sp38;
s32 sp34;