Add SurfaceFlags, and more formatting :)
Build libsm64 / Build libsm64 for linux (push) Successful in 32s
Build libsm64 / Build libsm64 for web (push) Successful in 39s
Build libsm64 / Build libsm64 for windows (push) Successful in 25s

This commit is contained in:
2026-05-24 18:03:08 -05:00
parent d3ea4e5e99
commit bd3dd8f523
38 changed files with 716 additions and 1295 deletions
+11 -22
View File
@@ -70,9 +70,6 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY)
UNUSED s32 unused3;
struct SM64SurfaceCollisionData *floor;
struct SM64SurfaceCollisionData *ceil;
f32 floorHeight;
f32 ceilHeight;
s32 collided;
s32 result = POLE_NONE;
f32 poleTop = m->usedObj->hitboxHeight - 100.0f;
struct Object *marioObj = m->marioObj;
@@ -86,17 +83,17 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY)
m->pos[2] = m->usedObj->oPosZ;
m->pos[1] = m->usedObj->oPosY + marioObj->oMarioPolePos + offsetY;
collided = f32_find_wall_collision(&m->pos[0], &m->pos[1], &m->pos[2], 60.0f, 50.0f);
s32 collided = f32_find_wall_collision(&m->pos[0], &m->pos[1], &m->pos[2], 60.0f, 50.0f);
collided |= f32_find_wall_collision(&m->pos[0], &m->pos[1], &m->pos[2], 30.0f, 24.0f);
ceilHeight = vec3f_find_ceil(m->pos, m->pos[1], &ceil);
f32 ceilHeight = vec3f_find_ceil(m->pos, m->pos[1], &ceil);
if (m->pos[1] > ceilHeight - 160.0f)
{
m->pos[1] = ceilHeight - 160.0f;
marioObj->oMarioPolePos = m->pos[1] - m->usedObj->oPosY;
}
floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
f32 floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
if (m->pos[1] < floorHeight)
{
m->pos[1] = floorHeight;
@@ -360,13 +357,10 @@ s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos)
UNUSED s32 unused;
struct SM64SurfaceCollisionData *ceil;
struct SM64SurfaceCollisionData *floor;
f32 ceilHeight;
f32 floorHeight;
f32 ceilOffset;
m->wall = resolve_and_return_wall_collisions(nextPos, 50.0f, 50.0f);
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
f32 floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
f32 ceilHeight = vec3f_find_ceil(nextPos, floorHeight, &ceil);
if (floor == NULL)
{
@@ -385,7 +379,7 @@ s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos)
return HANG_LEFT_CEIL;
}
ceilOffset = ceilHeight - (nextPos[1] + 160.0f);
f32 ceilOffset = ceilHeight - (nextPos[1] + 160.0f);
if (ceilOffset < -30.0f)
{
return HANG_HIT_CEIL_OR_OOB;
@@ -408,7 +402,6 @@ s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos)
s32 update_hang_moving(struct MarioState *m)
{
s32 stepResult;
Vec3f nextPos;
f32 maxSpeed = 4.0f;
@@ -433,7 +426,7 @@ s32 update_hang_moving(struct MarioState *m)
nextPos[2] = m->pos[2] - m->ceil->normal.y * m->vel[2];
nextPos[1] = m->pos[1];
stepResult = perform_hanging_step(m, nextPos);
s32 stepResult = perform_hanging_step(m, nextPos);
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
vec3s_set(m->marioObj->header.gfx.angle, 0, m->faceAngle[1], 0);
@@ -583,7 +576,6 @@ s32 act_hang_moving(struct MarioState *m)
s32 let_go_of_ledge(struct MarioState *m)
{
f32 floorHeight;
struct SM64SurfaceCollisionData *floor;
m->vel[1] = 0.0f;
@@ -591,7 +583,7 @@ s32 let_go_of_ledge(struct MarioState *m)
m->pos[0] -= 60.0f * sins(m->faceAngle[1]);
m->pos[2] -= 60.0f * coss(m->faceAngle[1]);
floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
f32 floorHeight = find_floor(m->pos[0], m->pos[1], m->pos[2], &floor);
if (floorHeight < m->pos[1] - 100.0f)
{
m->pos[1] -= 100.0f;
@@ -906,9 +898,6 @@ s32 act_tornado_twirling(struct MarioState *m)
{
struct SM64SurfaceCollisionData *floor;
Vec3f nextPos;
f32 sinAngleVel;
f32 cosAngleVel;
f32 floorHeight;
struct Object *marioObj = m->marioObj;
struct Object *usedObj = m->usedObj;
s16 prevTwirlYaw = m->twirlYaw;
@@ -946,8 +935,8 @@ s32 act_tornado_twirling(struct MarioState *m)
m->twirlYaw += m->angleVel[1];
sinAngleVel = sins(marioObj->oMarioTornadoYawVel);
cosAngleVel = coss(marioObj->oMarioTornadoYawVel);
f32 sinAngleVel = sins(marioObj->oMarioTornadoYawVel);
f32 cosAngleVel = coss(marioObj->oMarioTornadoYawVel);
nextPos[0] = usedObj->oPosX + dx * cosAngleVel + dz * sinAngleVel;
nextPos[2] = usedObj->oPosZ - dx * sinAngleVel + dz * cosAngleVel;
@@ -955,7 +944,7 @@ s32 act_tornado_twirling(struct MarioState *m)
f32_find_wall_collision(&nextPos[0], &nextPos[1], &nextPos[2], 60.0f, 50.0f);
floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
f32 floorHeight = find_floor(nextPos[0], nextPos[1], nextPos[2], &floor);
if (floor != NULL)
{
m->floor = floor;