Removed dependencies on other files so that libsm64.h can be used on its own.

This commit is contained in:
MeltyPlayer
2022-11-22 00:29:09 -06:00
parent ff41ecfceb
commit 0475d7facf
20 changed files with 163 additions and 168 deletions
+1 -1
View File
@@ -1840,7 +1840,7 @@ void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw) {
* 'radius' is the distance from each triangle vertex to the center
*/
void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius) {
struct Surface *sp74;
struct SM64SurfaceCollisionData *sp74;
Vec3f point0;
Vec3f point1;
Vec3f point2;
+15 -15
View File
@@ -6,10 +6,10 @@
/**
* Iterate through the list of ceilings and find the first ceiling over a given point.
*/
static struct Surface *find_ceil_from_list( s32 x, s32 y, s32 z, f32 *pheight) {
register struct Surface *surf;
static struct SM64SurfaceCollisionData *find_ceil_from_list( s32 x, s32 y, s32 z, f32 *pheight) {
register struct SM64SurfaceCollisionData *surf;
register s32 x1, z1, x2, z2, x3, z3;
struct Surface *ceil = NULL;
struct SM64SurfaceCollisionData *ceil = NULL;
ceil = NULL;
@@ -81,13 +81,13 @@ static struct Surface *find_ceil_from_list( s32 x, s32 y, s32 z, f32 *pheight) {
/**
* Iterate through the list of floors and find the first floor under a given point.
*/
static struct Surface *find_floor_from_list( s32 x, s32 y, s32 z, f32 *pheight) {
register struct Surface *surf;
static struct SM64SurfaceCollisionData *find_floor_from_list( s32 x, s32 y, s32 z, f32 *pheight) {
register struct SM64SurfaceCollisionData *surf;
register s32 x1, z1, x2, z2, x3, z3;
f32 nx, ny, nz;
f32 oo;
f32 height;
struct Surface *floor = NULL;
struct SM64SurfaceCollisionData *floor = NULL;
uint32_t groupCount = loaded_surface_iter_group_count();
for( int i = 0; i < groupCount; ++i ) {
@@ -148,8 +148,8 @@ static struct Surface *find_floor_from_list( s32 x, s32 y, s32 z, f32 *pheight)
return floor;
}
static s32 find_wall_collisions_from_list( struct WallCollisionData *data) {
register struct Surface *surf;
static s32 find_wall_collisions_from_list( struct SM64WallCollisionData *data) {
register struct SM64SurfaceCollisionData *surf;
register f32 offset;
register f32 radius = data->radius;
register f32 x = data->x;
@@ -270,7 +270,7 @@ static s32 find_wall_collisions_from_list( struct WallCollisionData *data) {
s32 f32_find_wall_collision(f32 *xPtr, f32 *yPtr, f32 *zPtr, f32 offsetY, f32 radius)
{
struct WallCollisionData collision;
struct SM64WallCollisionData collision;
s32 numCollisions = 0;
collision.offsetY = offsetY;
@@ -291,7 +291,7 @@ s32 f32_find_wall_collision(f32 *xPtr, f32 *yPtr, f32 *zPtr, f32 offsetY, f32 ra
return numCollisions;
}
s32 find_wall_collisions(struct WallCollisionData *colData)
s32 find_wall_collisions(struct SM64WallCollisionData *colData)
{
s32 numCollisions = 0;
colData->numWalls = 0;
@@ -310,18 +310,18 @@ s32 find_wall_collisions(struct WallCollisionData *colData)
return numCollisions;
}
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil)
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct SM64SurfaceCollisionData **pceil)
{
f32 height = CELL_HEIGHT_LIMIT;
*pceil = find_ceil_from_list( posX, posY, posZ, &height );
return height;
}
struct FloorGeometry sFloorGeo;
struct SM64FloorCollisionData sFloorGeo;
f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometry **floorGeo)
f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct SM64FloorCollisionData **floorGeo)
{
struct Surface *floor;
struct SM64SurfaceCollisionData *floor;
f32 floorHeight = find_floor(xPos, yPos, zPos, &floor);
*floorGeo = NULL;
@@ -344,7 +344,7 @@ f32 find_floor_height(f32 x, f32 y, f32 z)
return height;
}
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor)
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct SM64SurfaceCollisionData **pfloor)
{
f32 height = FLOOR_LOWER_LIMIT;
*pfloor = find_floor_from_list( xPos, yPos, zPos, &height );
+5 -23
View File
@@ -3,6 +3,7 @@
#include "../include/PR/ultratypes.h"
#include "../../libsm64.h"
#include "../include/types.h"
#define LEVEL_BOUNDARY_MAX 0x2000
@@ -11,31 +12,12 @@
#define CELL_HEIGHT_LIMIT 20000.f
#define FLOOR_LOWER_LIMIT -11000.f
struct WallCollisionData
{
/*0x00*/ f32 x, y, z;
/*0x0C*/ f32 offsetY;
/*0x10*/ f32 radius;
/*0x14*/ s16 unk14;
/*0x16*/ s16 numWalls;
/*0x18*/ struct Surface *walls[4];
};
struct FloorGeometry
{
f32 unused[4]; // possibly position data?
f32 normalX;
f32 normalY;
f32 normalZ;
f32 originOffset;
};
s32 f32_find_wall_collision(f32 *xPtr, f32 *yPtr, f32 *zPtr, f32 offsetY, f32 radius);
s32 find_wall_collisions(struct WallCollisionData *colData);
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct Surface **pceil);
f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct FloorGeometry **floorGeo);
s32 find_wall_collisions(struct SM64WallCollisionData *colData);
f32 find_ceil(f32 posX, f32 posY, f32 posZ, struct SM64SurfaceCollisionData **pceil);
f32 find_floor_height_and_data(f32 xPos, f32 yPos, f32 zPos, struct SM64FloorCollisionData **floorGeo);
f32 find_floor_height(f32 x, f32 y, f32 z);
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct Surface **pfloor);
f32 find_floor(f32 xPos, f32 yPos, f32 zPos, struct SM64SurfaceCollisionData **pfloor);
f32 find_water_level(f32 x, f32 z);
f32 find_poison_gas_level(f32 x, f32 z);