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
+5 -5
View File
@@ -443,16 +443,16 @@ struct CutsceneSplinePoint
*/
struct PlayerGeometry
{
/*0x00*/ struct Surface *currFloor;
/*0x00*/ struct SM64SurfaceCollisionData *currFloor;
/*0x04*/ f32 currFloorHeight;
/*0x08*/ s16 currFloorType;
/*0x0C*/ struct Surface *currCeil;
/*0x0C*/ struct SM64SurfaceCollisionData *currCeil;
/*0x10*/ s16 currCeilType;
/*0x14*/ f32 currCeilHeight;
/*0x18*/ struct Surface *prevFloor;
/*0x18*/ struct SM64SurfaceCollisionData *prevFloor;
/*0x1C*/ f32 prevFloorHeight;
/*0x20*/ s16 prevFloorType;
/*0x24*/ struct Surface *prevCeil;
/*0x24*/ struct SM64SurfaceCollisionData *prevCeil;
/*0x28*/ f32 prevCeilHeight;
/*0x2C*/ s16 prevCeilType;
/// Unused, but recalculated every frame
@@ -716,7 +716,7 @@ struct LakituState
// f32 camera_approach_f32_symmetric(f32 value, f32 target, f32 increment);
// void random_vec3s(Vec3s dst, s16 xRange, s16 yRange, s16 zRange);
// s32 clamp_positions_and_find_yaw(Vec3f pos, Vec3f origin, f32 xMax, f32 xMin, f32 zMax, f32 zMin);
// s32 is_range_behind_surface(Vec3f from, Vec3f to, struct Surface *surf, s16 range, s16 surfType);
// s32 is_range_behind_surface(Vec3f from, Vec3f to, struct SM64SurfaceCollisionData *surf, s16 range, s16 surfType);
// void scale_along_line(Vec3f dest, Vec3f from, Vec3f to, f32 scale);
// s16 calculate_pitch(Vec3f from, Vec3f to);
// s16 calculate_yaw(Vec3f from, Vec3f to);
+1 -1
View File
@@ -609,7 +609,7 @@ void push_mario_out_of_object(struct MarioState *m, struct Object *o, f32 paddin
f32 distance = sqrtf(offsetX * offsetX + offsetZ * offsetZ);
if (distance < minDistance) {
struct Surface *floor;
struct SM64SurfaceCollisionData *floor;
s16 pushAngle;
f32 newMarioX;
f32 newMarioZ;
+6 -6
View File
@@ -527,9 +527,9 @@ u32 mario_get_terrain_sound_addend(struct MarioState *m) {
/**
* Collides with walls and returns the most recent wall.
*/
struct Surface *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 radius) {
struct WallCollisionData collisionData;
struct Surface *wall = NULL;
struct SM64SurfaceCollisionData *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 radius) {
struct SM64WallCollisionData collisionData;
struct SM64SurfaceCollisionData *wall = NULL;
collisionData.x = pos[0];
collisionData.y = pos[1];
@@ -553,7 +553,7 @@ struct Surface *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 ra
/**
* Finds the ceiling from a vec3f horizontally and a height (with 80 vertical buffer).
*/
f32 vec3f_find_ceil(Vec3f pos, f32 height, struct Surface **ceil) {
f32 vec3f_find_ceil(Vec3f pos, f32 height, struct SM64SurfaceCollisionData **ceil) {
UNUSED f32 unused;
return find_ceil(pos[0], height + 80.0f, pos[2], ceil);
@@ -681,7 +681,7 @@ s32 mario_floor_is_steep(struct MarioState *m) {
* Finds the floor height relative from Mario given polar displacement.
*/
f32 find_floor_height_relative_polar(struct MarioState *m, s16 angleFromMario, f32 distFromMario) {
struct Surface *floor;
struct SM64SurfaceCollisionData *floor;
f32 floorY;
f32 y = sins(m->faceAngle[1] + angleFromMario) * distFromMario;
@@ -696,7 +696,7 @@ f32 find_floor_height_relative_polar(struct MarioState *m, s16 angleFromMario, f
* Returns the slope of the floor based off points around Mario.
*/
s16 find_floor_slope(struct MarioState *m, s16 yawOffset) {
struct Surface *floor;
struct SM64SurfaceCollisionData *floor;
f32 forwardFloorY, backwardFloorY;
f32 forwardYDelta, backwardYDelta;
s16 result;
+2 -2
View File
@@ -28,8 +28,8 @@ void play_mario_sound(struct MarioState *m, s32 primarySoundBits, s32 scondarySo
void mario_set_forward_vel(struct MarioState *m, f32 speed);
s32 mario_get_floor_class(struct MarioState *m);
u32 mario_get_terrain_sound_addend(struct MarioState *m);
struct Surface *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 radius);
f32 vec3f_find_ceil(Vec3f pos, f32 height, struct Surface **ceil);
struct SM64SurfaceCollisionData *resolve_and_return_wall_collisions(Vec3f pos, f32 offset, f32 radius);
f32 vec3f_find_ceil(Vec3f pos, f32 height, struct SM64SurfaceCollisionData **ceil);
s32 mario_facing_downhill(struct MarioState *m, s32 turnYaw);
u32 mario_floor_is_slippery(struct MarioState *m);
s32 mario_floor_is_slope(struct MarioState *m);
+2 -2
View File
@@ -115,7 +115,7 @@ s32 check_kick_or_dive_in_air(struct MarioState *m) {
}
s32 should_get_stuck_in_ground(struct MarioState *m) {
struct Surface *floor = m->floor;
struct SM64SurfaceCollisionData *floor = m->floor;
s32 flags = floor->flags;
s32 type = floor->type;
@@ -148,7 +148,7 @@ s32 check_fall_damage_or_get_stuck(struct MarioState *m, u32 hardFallAction) {
}
s32 check_horizontal_wind(struct MarioState *m) {
struct Surface *floor;
struct SM64SurfaceCollisionData *floor;
f32 speed;
s16 pushAngle;
+6 -6
View File
@@ -65,8 +65,8 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY) {
UNUSED s32 unused1;
UNUSED s32 unused2;
UNUSED s32 unused3;
struct Surface *floor;
struct Surface *ceil;
struct SM64SurfaceCollisionData *floor;
struct SM64SurfaceCollisionData *ceil;
f32 floorHeight;
f32 ceilHeight;
s32 collided;
@@ -307,8 +307,8 @@ s32 act_top_of_pole(struct MarioState *m) {
s32 perform_hanging_step(struct MarioState *m, Vec3f nextPos) {
UNUSED s32 unused;
struct Surface *ceil;
struct Surface *floor;
struct SM64SurfaceCollisionData *ceil;
struct SM64SurfaceCollisionData *floor;
f32 ceilHeight;
f32 floorHeight;
f32 ceilOffset;
@@ -498,7 +498,7 @@ s32 act_hang_moving(struct MarioState *m) {
s32 let_go_of_ledge(struct MarioState *m) {
f32 floorHeight;
struct Surface *floor;
struct SM64SurfaceCollisionData *floor;
m->vel[1] = 0.0f;
m->forwardVel = -8.0f;
@@ -772,7 +772,7 @@ s32 act_in_cannon(struct MarioState *m) {
}
s32 act_tornado_twirling(struct MarioState *m) {
struct Surface *floor;
struct SM64SurfaceCollisionData *floor;
Vec3f nextPos;
f32 sinAngleVel;
f32 cosAngleVel;
+3 -3
View File
@@ -567,7 +567,7 @@ s32 act_reading_sign(struct MarioState *m) {
s32 act_debug_free_move(struct MarioState *m) {
struct Controller *gPlayer1Controller = &gController;
struct Surface *surf;
struct SM64SurfaceCollisionData *surf;
f32 floorHeight;
Vec3f pos;
f32 speed;
@@ -2014,7 +2014,7 @@ void generate_yellow_sparkles(s16 x, s16 y, s16 z, f32 radius) {
// not sure what this does, returns the height of the floor.
// (animation related?)
// static f32 end_obj_set_visual_pos(struct Object *o) {
// struct Surface *surf;
// struct SM64SurfaceCollisionData *surf;
// Vec3s sp24;
// f32 sp20;
// f32 sp1C;
@@ -2178,7 +2178,7 @@ static void end_peach_cutscene_descend_peach(struct MarioState *m) {
// Mario runs to peach
static void end_peach_cutscene_run_to_peach(struct MarioState *m) {
struct Surface *surf;
struct SM64SurfaceCollisionData *surf;
if (m->actionTimer == 22) {
sEndPeachAnimation = 5;
+5 -5
View File
@@ -102,10 +102,10 @@ s32 begin_walking_action(struct MarioState *m, f32 forwardVel, u32 action, u32 a
}
void check_ledge_climb_down(struct MarioState *m) {
struct WallCollisionData wallCols;
struct Surface *floor;
struct SM64WallCollisionData wallCols;
struct SM64SurfaceCollisionData *floor;
f32 floorHeight;
struct Surface *wall;
struct SM64SurfaceCollisionData *wall;
s16 wallAngle;
s16 wallDYaw;
@@ -164,7 +164,7 @@ void update_sliding_angle(struct MarioState *m, f32 accel, f32 lossFactor) {
s32 newFacingDYaw;
s16 facingDYaw;
struct Surface *floor = m->floor;
struct SM64SurfaceCollisionData *floor = m->floor;
s16 slopeAngle = atan2s(floor->normal.z, floor->normal.x);
f32 steepness = sqrtf(floor->normal.x * floor->normal.x + floor->normal.z * floor->normal.z);
UNUSED f32 normalY = floor->normal.y;
@@ -287,7 +287,7 @@ s32 update_sliding(struct MarioState *m, f32 stopSpeed) {
void apply_slope_accel(struct MarioState *m) {
f32 slopeAccel;
struct Surface *floor = m->floor;
struct SM64SurfaceCollisionData *floor = m->floor;
f32 steepness = sqrtf(floor->normal.x * floor->normal.x + floor->normal.z * floor->normal.z);
UNUSED f32 normalY = floor->normal.y;
+3 -3
View File
@@ -80,9 +80,9 @@ static f32 get_buoyancy(struct MarioState *m) {
}
static u32 perform_water_full_step(struct MarioState *m, Vec3f nextPos) {
struct Surface *wall;
struct Surface *ceil;
struct Surface *floor;
struct SM64SurfaceCollisionData *wall;
struct SM64SurfaceCollisionData *ceil;
struct SM64SurfaceCollisionData *floor;
f32 ceilHeight;
f32 floorHeight;
+13 -13
View File
@@ -10,7 +10,7 @@
static s16 sMovingSandSpeeds[] = { 12, 8, 4, 0 };
struct Surface gWaterSurfacePseudoFloor = {
struct SM64SurfaceCollisionData gWaterSurfacePseudoFloor = {
SURFACE_VERY_SLIPPERY, 0, 0, 0, 0, 0, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 },
{ 0.0f, 1.0f, 0.0f }, 0.0f, 0, NULL, 0
};
@@ -169,7 +169,7 @@ u32 mario_push_off_steep_floor(struct MarioState *m, u32 action, u32 actionArg)
}
u32 mario_update_moving_sand(struct MarioState *m) {
struct Surface *floor = m->floor;
struct SM64SurfaceCollisionData *floor = m->floor;
s32 floorType = floor->type;
if (floorType == SURFACE_DEEP_MOVING_QUICKSAND || floorType == SURFACE_SHALLOW_MOVING_QUICKSAND
@@ -187,7 +187,7 @@ u32 mario_update_moving_sand(struct MarioState *m) {
}
u32 mario_update_windy_ground(struct MarioState *m) {
struct Surface *floor = m->floor;
struct SM64SurfaceCollisionData *floor = m->floor;
if (floor->type == SURFACE_HORIZONTAL_WIND) {
f32 pushSpeed;
@@ -255,10 +255,10 @@ s32 stationary_ground_step(struct MarioState *m) {
}
static s32 perform_ground_quarter_step(struct MarioState *m, Vec3f nextPos) {
UNUSED struct Surface *lowerWall;
struct Surface *upperWall;
struct Surface *ceil;
struct Surface *floor;
UNUSED struct SM64SurfaceCollisionData *lowerWall;
struct SM64SurfaceCollisionData *upperWall;
struct SM64SurfaceCollisionData *ceil;
struct SM64SurfaceCollisionData *floor;
f32 ceilHeight;
f32 floorHeight;
f32 waterLevel;
@@ -344,8 +344,8 @@ s32 perform_ground_step(struct MarioState *m) {
return stepResult;
}
u32 check_ledge_grab(struct MarioState *m, struct Surface *wall, Vec3f intendedPos, Vec3f nextPos) {
struct Surface *ledgeFloor;
u32 check_ledge_grab(struct MarioState *m, struct SM64SurfaceCollisionData *wall, Vec3f intendedPos, Vec3f nextPos) {
struct SM64SurfaceCollisionData *ledgeFloor;
Vec3f ledgePos;
f32 displacementX;
f32 displacementZ;
@@ -387,10 +387,10 @@ u32 check_ledge_grab(struct MarioState *m, struct Surface *wall, Vec3f intendedP
s32 perform_air_quarter_step(struct MarioState *m, Vec3f intendedPos, u32 stepArg) {
s16 wallDYaw;
Vec3f nextPos;
struct Surface *upperWall;
struct Surface *lowerWall;
struct Surface *ceil;
struct Surface *floor;
struct SM64SurfaceCollisionData *upperWall;
struct SM64SurfaceCollisionData *lowerWall;
struct SM64SurfaceCollisionData *ceil;
struct SM64SurfaceCollisionData *floor;
f32 ceilHeight;
f32 floorHeight;
f32 waterLevel;
+1 -1
View File
@@ -14,7 +14,7 @@ struct BullyCollisionData {
/*0x14*/ f32 velZ;
};
extern struct Surface gWaterSurfacePseudoFloor;
extern struct SM64SurfaceCollisionData gWaterSurfacePseudoFloor;
f32 get_additive_y_vel_for_jumps(void);
void stub_mario_step_1(struct MarioState *);
+2 -2
View File
@@ -17,7 +17,7 @@
* within 4 units of the floor. Set his referenced platform object accordingly.
*/
void update_mario_platform(void) {
struct Surface *floor;
struct SM64SurfaceCollisionData *floor;
UNUSED u32 unused;
f32 marioX;
f32 marioY;
@@ -82,7 +82,7 @@ static void set_mario_pos(f32 x, f32 y, f32 z) {
* Apply one frame of platform rotation to Mario or an object using the given
* platform. If isMario is false, use gCurrentObject.
*/
void apply_platform_displacement(u32 isMario, struct SurfaceObjectTransform *platform) {
void apply_platform_displacement(u32 isMario, struct SM64SurfaceObjectTransform *platform) {
f32 x;
f32 y;
f32 z;