Restore Vanish Cap wall collision logic

This commit is contained in:
Renato Rotenberg
2024-04-01 19:13:18 -03:00
parent 0c73039d97
commit f71a100c8d
3 changed files with 74 additions and 51 deletions
+22
View File
@@ -2,6 +2,8 @@
#include "surface_collision.h"
#include "../include/surface_terrains.h"
#include "../../load_surfaces.h"
#include "../include/sm64.h"
#include "../game/object_stuff.h"
/**
* Iterate through the list of ceilings and find the first ceiling over a given point.
@@ -250,6 +252,26 @@ static s32 find_wall_collisions_from_list( struct SM64WallCollisionData *data) {
}
}
// Ignore camera only surfaces.
if (surf->type == SURFACE_CAMERA_BOUNDARY) {
continue;
}
// If an object can pass through a vanish cap wall, pass through.
if (surf->type == SURFACE_VANISH_CAP_WALLS) {
// If an object can pass through a vanish cap wall, pass through.
if (gCurrentObject != NULL
&& (gCurrentObject->activeFlags & ACTIVE_FLAG_MOVE_THROUGH_GRATE)) {
continue;
}
// If Mario has a vanish cap, pass through the vanish cap wall.
if (gCurrentObject != NULL && gCurrentObject == gMarioObject
&& (gMarioState->flags & MARIO_VANISH_CAP)) {
continue;
}
}
//! (Wall Overlaps) Because this doesn't update the x and z local variables,
// multiple walls can push mario more than is required.
data->x += surf->normal.x * (radius - offset);