Make Surfaces Float
Build libsm64 / Build libsm64 for linux (push) Successful in 29s
Build libsm64 / Build libsm64 for web (push) Successful in 31s
Build libsm64 / Build libsm64 for windows (push) Successful in 24s

This commit is contained in:
2026-05-23 15:08:00 -05:00
parent aa092bebfe
commit 4328104536
5 changed files with 45 additions and 30 deletions
+4 -4
View File
@@ -8,9 +8,9 @@
/**
* Iterate through the list of ceilings and find the first ceiling over a given point.
*/
static struct SM64SurfaceCollisionData *find_ceil_from_list( s32 x, s32 y, s32 z, f32 *pheight) {
static struct SM64SurfaceCollisionData *find_ceil_from_list( f32 x, f32 y, f32 z, f32 *pheight) {
register struct SM64SurfaceCollisionData *surf;
register s32 x1, z1, x2, z2, x3, z3;
register f32 x1, z1, x2, z2, x3, z3;
struct SM64SurfaceCollisionData *ceil = NULL;
ceil = NULL;
@@ -83,9 +83,9 @@ static struct SM64SurfaceCollisionData *find_ceil_from_list( s32 x, s32 y, s32 z
/**
* Iterate through the list of floors and find the first floor under a given point.
*/
static struct SM64SurfaceCollisionData *find_floor_from_list( s32 x, s32 y, s32 z, f32 *pheight) {
static struct SM64SurfaceCollisionData *find_floor_from_list( f32 x, f32 y, f32 z, f32 *pheight) {
register struct SM64SurfaceCollisionData *surf;
register s32 x1, z1, x2, z2, x3, z3;
register f32 x1, z1, x2, z2, x3, z3;
f32 nx, ny, nz;
f32 oo;
f32 height;
+6 -6
View File
@@ -30,7 +30,7 @@ struct SM64Surface
int16_t type;
int16_t force;
uint16_t terrain;
int32_t vertices[3][3];
float vertices[3][3]; // world-space coordinates
};
struct SM64MarioInputs
@@ -115,11 +115,11 @@ struct SM64SurfaceCollisionData
int16_t force;
int8_t flags;
int8_t room;
int32_t lowerY; // libsm64: 32 bit
int32_t upperY; // libsm64: 32 bit
int32_t vertex1[3]; // libsm64: 32 bit
int32_t vertex2[3]; // libsm64: 32 bit
int32_t vertex3[3]; // libsm64: 32 bit
float lowerY;
float upperY;
float vertex1[3];
float vertex2[3];
float vertex3[3];
struct {
float x;
float y;
+13 -13
View File
@@ -93,17 +93,17 @@ static void engine_surface_from_lib_surface( struct SM64SurfaceCollisionData *su
{
int16_t type = libSurf->type;
int16_t force = libSurf->force;
s32 x1 = libSurf->vertices[0][0];
s32 y1 = libSurf->vertices[0][1];
s32 z1 = libSurf->vertices[0][2];
s32 x2 = libSurf->vertices[1][0];
s32 y2 = libSurf->vertices[1][1];
s32 z2 = libSurf->vertices[1][2];
s32 x3 = libSurf->vertices[2][0];
s32 y3 = libSurf->vertices[2][1];
s32 z3 = libSurf->vertices[2][2];
f32 x1 = libSurf->vertices[0][0];
f32 y1 = libSurf->vertices[0][1];
f32 z1 = libSurf->vertices[0][2];
f32 x2 = libSurf->vertices[1][0];
f32 y2 = libSurf->vertices[1][1];
f32 z2 = libSurf->vertices[1][2];
f32 x3 = libSurf->vertices[2][0];
f32 y3 = libSurf->vertices[2][1];
f32 z3 = libSurf->vertices[2][2];
s32 maxY, minY;
f32 maxY, minY;
f32 nx, ny, nz;
f32 mag;
@@ -158,9 +158,9 @@ static void engine_surface_from_lib_surface( struct SM64SurfaceCollisionData *su
if (mag < 0.0001) {
DEBUG_PRINT("ERROR: normal magnitude is very close to zero:");
DEBUG_PRINT("v1 %i %i %i", x1, y1, z1 );
DEBUG_PRINT("v2 %i %i %i", x2, y2, z2 );
DEBUG_PRINT("v3 %i %i %i", x3, y3, z3 );
DEBUG_PRINT("v1 %f %f %f", x1, y1, z1 );
DEBUG_PRINT("v2 %f %f %f", x2, y2, z2 );
DEBUG_PRINT("v3 %f %f %f", x3, y3, z3 );
surface->isValid = 0;
return;
}