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 "surface_collision.h"
#include "../include/surface_terrains.h" #include "../include/surface_terrains.h"
#include "../../load_surfaces.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. * 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, //! (Wall Overlaps) Because this doesn't update the x and z local variables,
// multiple walls can push mario more than is required. // multiple walls can push mario more than is required.
data->x += surf->normal.x * (radius - offset); data->x += surf->normal.x * (radius - offset);
+1 -50
View File
@@ -1,62 +1,13 @@
/** /**
* This file just hacks a bunch of stuff together to get a valid Object and GraphNode for Mario * This file just hacks a bunch of stuff together to get a valid Object and GraphNode for Mario
*/ */
#include "object_stuff.h"
#include <stdlib.h> #include <stdlib.h>
#include "mario.h" #include "mario.h"
#include "../shim.h" #include "../shim.h"
#include "../engine/math_util.h" #include "../engine/math_util.h"
#include "../include/object_fields.h" #include "../include/object_fields.h"
/* activeFlags */
#define ACTIVE_FLAG_DEACTIVATED 0 // 0x0000
#define ACTIVE_FLAG_ACTIVE (1 << 0) // 0x0001
#define ACTIVE_FLAG_FAR_AWAY (1 << 1) // 0x0002
#define ACTIVE_FLAG_UNK2 (1 << 2) // 0x0004
#define ACTIVE_FLAG_IN_DIFFERENT_ROOM (1 << 3) // 0x0008
#define ACTIVE_FLAG_UNIMPORTANT (1 << 4) // 0x0010
#define ACTIVE_FLAG_INITIATED_TIME_STOP (1 << 5) // 0x0020
#define ACTIVE_FLAG_MOVE_THROUGH_GRATE (1 << 6) // 0x0040
#define ACTIVE_FLAG_DITHERED_ALPHA (1 << 7) // 0x0080
#define ACTIVE_FLAG_UNK8 (1 << 8) // 0x0100
#define ACTIVE_FLAG_UNK9 (1 << 9) // 0x0200
#define ACTIVE_FLAG_UNK10 (1 << 10) // 0x0400
// The discriminant for different types of geo nodes
#define GRAPH_NODE_TYPE_ROOT 0x001
#define GRAPH_NODE_TYPE_ORTHO_PROJECTION 0x002
#define GRAPH_NODE_TYPE_PERSPECTIVE (0x003 | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_MASTER_LIST 0x004
#define GRAPH_NODE_TYPE_START 0x00A
#define GRAPH_NODE_TYPE_LEVEL_OF_DETAIL 0x00B
#define GRAPH_NODE_TYPE_SWITCH_CASE (0x00C | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_CAMERA (0x014 | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_TRANSLATION_ROTATION 0x015
#define GRAPH_NODE_TYPE_TRANSLATION 0x016
#define GRAPH_NODE_TYPE_ROTATION 0x017
#define GRAPH_NODE_TYPE_OBJECT 0x018
#define GRAPH_NODE_TYPE_ANIMATED_PART 0x019
#define GRAPH_NODE_TYPE_BILLBOARD 0x01A
#define GRAPH_NODE_TYPE_DISPLAY_LIST 0x01B
#define GRAPH_NODE_TYPE_SCALE 0x01C
#define GRAPH_NODE_TYPE_SHADOW 0x028
#define GRAPH_NODE_TYPE_OBJECT_PARENT 0x029
#define GRAPH_NODE_TYPE_GENERATED_LIST (0x02A | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_BACKGROUND (0x02C | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_HELD_OBJ (0x02E | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_CULLING_RADIUS 0x02F
/* respawnInfoType */
#define RESPAWN_INFO_TYPE_NULL 0
#define RESPAWN_INFO_TYPE_32 1
#define RESPAWN_INFO_TYPE_16 2
#define GRAPH_RENDER_ACTIVE (1 << 0)
#define GRAPH_RENDER_CHILDREN_FIRST (1 << 1)
#define GRAPH_RENDER_BILLBOARD (1 << 2)
#define GRAPH_RENDER_Z_BUFFER (1 << 3)
#define GRAPH_RENDER_INVISIBLE (1 << 4)
#define GRAPH_RENDER_HAS_ANIMATION (1 << 5)
static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f }; static Vec3f gVec3fZero = { 0.0f, 0.0f, 0.0f };
static Vec3s gVec3sZero = { 0, 0, 0 }; static Vec3s gVec3sZero = { 0, 0, 0 };
+50
View File
@@ -2,6 +2,56 @@
#include "../include/types.h" #include "../include/types.h"
/* activeFlags */
#define ACTIVE_FLAG_DEACTIVATED 0 // 0x0000
#define ACTIVE_FLAG_ACTIVE (1 << 0) // 0x0001
#define ACTIVE_FLAG_FAR_AWAY (1 << 1) // 0x0002
#define ACTIVE_FLAG_UNK2 (1 << 2) // 0x0004
#define ACTIVE_FLAG_IN_DIFFERENT_ROOM (1 << 3) // 0x0008
#define ACTIVE_FLAG_UNIMPORTANT (1 << 4) // 0x0010
#define ACTIVE_FLAG_INITIATED_TIME_STOP (1 << 5) // 0x0020
#define ACTIVE_FLAG_MOVE_THROUGH_GRATE (1 << 6) // 0x0040
#define ACTIVE_FLAG_DITHERED_ALPHA (1 << 7) // 0x0080
#define ACTIVE_FLAG_UNK8 (1 << 8) // 0x0100
#define ACTIVE_FLAG_UNK9 (1 << 9) // 0x0200
#define ACTIVE_FLAG_UNK10 (1 << 10) // 0x0400
// The discriminant for different types of geo nodes
#define GRAPH_NODE_TYPE_ROOT 0x001
#define GRAPH_NODE_TYPE_ORTHO_PROJECTION 0x002
#define GRAPH_NODE_TYPE_PERSPECTIVE (0x003 | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_MASTER_LIST 0x004
#define GRAPH_NODE_TYPE_START 0x00A
#define GRAPH_NODE_TYPE_LEVEL_OF_DETAIL 0x00B
#define GRAPH_NODE_TYPE_SWITCH_CASE (0x00C | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_CAMERA (0x014 | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_TRANSLATION_ROTATION 0x015
#define GRAPH_NODE_TYPE_TRANSLATION 0x016
#define GRAPH_NODE_TYPE_ROTATION 0x017
#define GRAPH_NODE_TYPE_OBJECT 0x018
#define GRAPH_NODE_TYPE_ANIMATED_PART 0x019
#define GRAPH_NODE_TYPE_BILLBOARD 0x01A
#define GRAPH_NODE_TYPE_DISPLAY_LIST 0x01B
#define GRAPH_NODE_TYPE_SCALE 0x01C
#define GRAPH_NODE_TYPE_SHADOW 0x028
#define GRAPH_NODE_TYPE_OBJECT_PARENT 0x029
#define GRAPH_NODE_TYPE_GENERATED_LIST (0x02A | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_BACKGROUND (0x02C | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_HELD_OBJ (0x02E | GRAPH_NODE_TYPE_FUNCTIONAL)
#define GRAPH_NODE_TYPE_CULLING_RADIUS 0x02F
/* respawnInfoType */
#define RESPAWN_INFO_TYPE_NULL 0
#define RESPAWN_INFO_TYPE_32 1
#define RESPAWN_INFO_TYPE_16 2
#define GRAPH_RENDER_ACTIVE (1 << 0)
#define GRAPH_RENDER_CHILDREN_FIRST (1 << 1)
#define GRAPH_RENDER_BILLBOARD (1 << 2)
#define GRAPH_RENDER_Z_BUFFER (1 << 3)
#define GRAPH_RENDER_INVISIBLE (1 << 4)
#define GRAPH_RENDER_HAS_ANIMATION (1 << 5)
struct Object *hack_allocate_mario(void); struct Object *hack_allocate_mario(void);
void bhv_mario_update(void); void bhv_mario_update(void);
void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2); void create_transformation_from_matrices(Mat4 a0, Mat4 a1, Mat4 a2);