test synced pole
Build libsm64 / Build libsm64 for linux (push) Successful in 33s
Build libsm64 / Build libsm64 for web (push) Successful in 33s
Build libsm64 / Build libsm64 for windows (push) Successful in 25s

This commit is contained in:
2026-06-01 14:54:23 -05:00
parent 40bee0f224
commit 42132a5646
7 changed files with 123 additions and 50 deletions
+52 -33
View File
@@ -21,6 +21,7 @@
#include "../include/object_fields.h"
#include "../include/mario_geo_switch_case_ids.h"
#include "../../rumble.h"
#include "../../FakeObject.h"
static Vec3f gVec3fZero = {0.0f, 0.0f, 0.0f};
@@ -35,16 +36,21 @@ static Vec3f gVec3fZero = {0.0f, 0.0f, 0.0f};
void add_tree_leaf_particles(struct MarioState *m)
{
f32 leafHeight;
s32 isOnTree = false;//(m->usedObj->behavior == segmented_to_virtual(bhvTree));
s32 isOnTree = false; //(m->usedObj->behavior == segmented_to_virtual(bhvTree));
if (isOnTree) {
if (isOnTree)
{
// make leaf effect spawn higher on the Shifting Sand Land palm tree
if (gCurrLevelNum == LEVEL_SSL) {
if (gCurrLevelNum == LEVEL_SSL)
{
leafHeight = 250.0f;
} else {
}
else
{
leafHeight = 100.0f;
}
if (m->pos[1] - m->floorHeight > leafHeight) {
if (m->pos[1] - m->floorHeight > leafHeight)
{
m->particleFlags |= PARTICLE_LEAF;
}
}
@@ -52,24 +58,33 @@ void add_tree_leaf_particles(struct MarioState *m)
void play_climbing_sounds(struct MarioState *m, s32 b)
{
s32 isOnTree = false;//(m->usedObj->behavior == segmented_to_virtual(bhvTree));
s32 isOnTree = false; //(m->usedObj->behavior == segmented_to_virtual(bhvTree));
if (b == 1) {
if (is_anim_past_frame(m, 1)) {
play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE,
m->marioObj->header.gfx.cameraToObject);
if (b == 1)
{
if (is_anim_past_frame(m, 1))
{
play_sound(isOnTree ? SOUND_ACTION_CLIMB_UP_TREE : SOUND_ACTION_CLIMB_UP_POLE, m->marioObj->header.gfx.cameraToObject);
}
} else {
play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE,
m->marioObj->header.gfx.cameraToObject);
}
else
{
play_sound(isOnTree ? SOUND_MOVING_SLIDE_DOWN_TREE : SOUND_MOVING_SLIDE_DOWN_POLE, m->marioObj->header.gfx.cameraToObject);
}
}
s32 set_pole_position(struct MarioState *m, f32 offsetY)
{
if (!m->isLocal && m->usedObj == NULL)
if (!m) { return 0;}
if (m->usedObj == NULL)
{
return POLE_NONE;
m->usedObj = cur_obj_find_nearest_pole();
}
if (m->usedObj == NULL)
{
set_mario_action(m, ACT_FREEFALL, 0);
return POLE_FELL_OFF;
}
UNUSED s32 unused1;
@@ -146,7 +161,11 @@ s32 set_pole_position(struct MarioState *m, f32 offsetY)
s32 act_holding_pole(struct MarioState *m)
{
if (!m) { return 0; }
struct Object *marioObj = m->marioObj;
if (m->usedObj == NULL) { m->usedObj = cur_obj_find_nearest_pole(); }
if (m->usedObj == NULL) { return FALSE; }
f32 poleStickY = -m->controller->stickY;
#ifdef VERSION_JP
@@ -155,9 +174,7 @@ s32 act_holding_pole(struct MarioState *m)
add_tree_leaf_particles(m);
m->faceAngle[1] += 0x8000;
return set_mario_action(m, ACT_WALL_KICK_AIR, 0);
}
if (m->input & INPUT_Z_PRESSED)
} if (m->input & INPUT_Z_PRESSED)
{
add_tree_leaf_particles(m);
m->forwardVel = -2.0f;
@@ -181,12 +198,7 @@ s32 act_holding_pole(struct MarioState *m)
if (poleStickY > 16.0f)
{
f32 poleTop = m->pos[1] + 1000;
if (m->usedObj != NULL)
{
poleTop = m->usedObj->hitboxHeight - 100.0f;
}
f32 poleTop = m->usedObj->hitboxHeight - 100.0f;
// const BehaviorScript *poleBehavior = virtual_to_segmented(0x13, m->usedObj->behavior);
if (marioObj->oMarioPolePos < poleTop - 0.4f)
@@ -241,6 +253,8 @@ s32 act_holding_pole(struct MarioState *m)
s32 act_climbing_pole(struct MarioState *m)
{
if (!m) { return 0; }
if (m->usedObj == NULL) { m->usedObj = cur_obj_find_nearest_pole(); }
s32 sp24;
struct Object *marioObj = m->marioObj;
s16 cameraAngle = m->area->camera->yaw;
@@ -284,6 +298,8 @@ s32 act_climbing_pole(struct MarioState *m)
s32 act_grab_pole_slow(struct MarioState *m)
{
if (!m) { return 0; }
if (m->usedObj == NULL) { m->usedObj = cur_obj_find_nearest_pole(); }
play_sound_if_no_flag(m, SOUND_MARIO_WHOA, MARIO_MARIO_SOUND_PLAYED);
if (set_pole_position(m, 0.0f) == POLE_NONE)
@@ -301,6 +317,8 @@ s32 act_grab_pole_slow(struct MarioState *m)
s32 act_grab_pole_fast(struct MarioState *m)
{
if (!m) { return 0; }
if (m->usedObj == NULL) { m->usedObj = cur_obj_find_nearest_pole(); }
struct Object *marioObj = m->marioObj;
play_sound_if_no_flag(m, SOUND_MARIO_WHOA, MARIO_MARIO_SOUND_PLAYED);
@@ -330,6 +348,8 @@ s32 act_grab_pole_fast(struct MarioState *m)
s32 act_top_of_pole_transition(struct MarioState *m)
{
if (!m) { return 0; }
if (m->usedObj == NULL) { m->usedObj = cur_obj_find_nearest_pole(); }
struct Object *marioObj = m->marioObj;
marioObj->oMarioPoleYawVel = 0;
@@ -356,8 +376,9 @@ s32 act_top_of_pole_transition(struct MarioState *m)
s32 act_top_of_pole(struct MarioState *m)
{
UNUSED
struct Object *marioObj = m->marioObj;
if (!m) { return 0; }
UNUSED struct Object *marioObj = m->marioObj;
if (m->usedObj == NULL) { m->usedObj = cur_obj_find_nearest_pole(); }
f32 poleStickY = -m->controller->stickY;
if (m->input & INPUT_A_PRESSED)
@@ -435,8 +456,7 @@ s32 update_hang_moving(struct MarioState *m)
m->forwardVel = maxSpeed;
}
m->faceAngle[1] =
m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
m->faceAngle[1] = m->intendedYaw - approach_s32((s16)(m->intendedYaw - m->faceAngle[1]), 0, 0x800, 0x800);
m->slideYaw = m->faceAngle[1];
m->slideVelX = m->forwardVel * sins(m->faceAngle[1]);
@@ -739,9 +759,7 @@ s32 act_ledge_climb_slow(struct MarioState *m)
m->actionTimer++;
if (m->actionTimer >= 28
&& m->input
& (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE))
if (m->actionTimer >= 28 && m->input & (INPUT_NONZERO_ANALOG | INPUT_A_PRESSED | INPUT_OFF_FLOOR | INPUT_ABOVE_SLIDE))
{
climb_up_ledge(m);
return check_common_action_exits(m);
@@ -810,8 +828,7 @@ s32 act_grabbed(struct MarioState *m)
queue_rumble_data(5, 60);
// #endif
return set_mario_action(m, m->forwardVel >= 0.0f ? ACT_THROWN_FORWARD : ACT_THROWN_BACKWARD,
thrown);
return set_mario_action(m, m->forwardVel >= 0.0f ? ACT_THROWN_FORWARD : ACT_THROWN_BACKWARD, thrown);
}
set_mario_animation(m, MARIO_ANIM_BEING_GRABBED);
@@ -920,6 +937,8 @@ s32 act_in_cannon(struct MarioState *m)
s32 act_tornado_twirling(struct MarioState *m)
{
if (!m) { return 0; }
if (m->usedObj == NULL) { return FALSE; }
struct SM64SurfaceCollisionData *floor;
Vec3f nextPos;
struct Object *marioObj = m->marioObj;
+13 -1
View File
@@ -68,7 +68,19 @@ static void print_text_fmt_int(s32 x, s32 y, const char *str, s32 n)
{
}
static s16 level_trigger_warp(struct MarioState *m, s32 warpOp) { return 0; }
static s16 level_trigger_warp(struct MarioState *m, s32 warpOp)
{
if (warpOp == WARP_OP_DEATH && m->health > 0xFF)
{
m->health = 0xFF;
}
if (warpOp == WARP_OP_WARP_FLOOR && m->health > 0xFF)
{
m->health = 0xFF;
return 20;
}
return 0;
}
//static void play_cap_music(u16 seqArgs) {}
//static void fadeout_cap_music(void) {}
//static void stop_cap_music(void) {}