C-Up Player Head Rotation Fix & Particle Flags Sync Fix (#99)

Local head rotation is now no longer copied to all other players
C-Up mode head rotation now sends to the other players through
the player packet so others can see the head move around

m->particleFlags are now synced to the other players now
This commit is contained in:
Marioiscool246 2022-05-19 19:52:47 -04:00 committed by GitHub
parent 4fbafc2708
commit 0c7ada8d2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 89 additions and 70 deletions

View file

@ -755,7 +755,7 @@ void bounce_back_from_attack(struct MarioState *m, u32 interaction) {
}
if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_ATTACK); }
m->particleFlags |= PARTICLE_TRIANGLE;
set_mario_particle_flags(m, PARTICLE_TRIANGLE, FALSE);
}
if (interaction & (INT_PUNCH | INT_KICK | INT_TRIP | INT_FAST_ATTACK_OR_SHELL)) {
@ -2146,11 +2146,11 @@ void check_kick_or_punch_wall(struct MarioState *m) {
mario_set_forward_vel(m, -48.0f);
play_sound(SOUND_ACTION_HIT_2, m->marioObj->header.gfx.cameraToObject);
m->particleFlags |= PARTICLE_TRIANGLE;
set_mario_particle_flags(m, PARTICLE_TRIANGLE, FALSE);
} else if (m->action & ACT_FLAG_AIR) {
mario_set_forward_vel(m, -16.0f);
play_sound(SOUND_ACTION_HIT_2, m->marioObj->header.gfx.cameraToObject);
m->particleFlags |= PARTICLE_TRIANGLE;
set_mario_particle_flags(m, PARTICLE_TRIANGLE, FALSE);
}
}
}

View file

@ -302,15 +302,15 @@ void adjust_sound_for_speed(struct MarioState *m) {
void play_sound_and_spawn_particles(struct MarioState *m, u32 soundBits, u32 waveParticleType) {
if (m->terrainSoundAddend == (SOUND_TERRAIN_WATER << 16)) {
if (waveParticleType != 0) {
m->particleFlags |= PARTICLE_SHALLOW_WATER_SPLASH;
set_mario_particle_flags(m, PARTICLE_SHALLOW_WATER_SPLASH, FALSE);
} else {
m->particleFlags |= PARTICLE_SHALLOW_WATER_WAVE;
set_mario_particle_flags(m, PARTICLE_SHALLOW_WATER_WAVE, FALSE);
}
} else {
if (m->terrainSoundAddend == (SOUND_TERRAIN_SAND << 16)) {
m->particleFlags |= PARTICLE_DIRT;
set_mario_particle_flags(m, PARTICLE_DIRT, FALSE);
} else if (m->terrainSoundAddend == (SOUND_TERRAIN_SNOW << 16)) {
m->particleFlags |= PARTICLE_SNOW;
set_mario_particle_flags(m, PARTICLE_SNOW, FALSE);
}
}
@ -1596,7 +1596,7 @@ void set_submerged_cam_preset_and_spawn_bubbles(struct MarioState *m) {
// of the water with his head out, spawn bubbles.
if (!(m->action & ACT_FLAG_INTANGIBLE)) {
if ((m->pos[1] < (f32)(m->waterLevel - 160)) || (m->faceAngle[0] < -0x800)) {
m->particleFlags |= PARTICLE_BUBBLE;
set_mario_particle_flags(m, PARTICLE_BUBBLE, FALSE);
}
}
}
@ -2248,3 +2248,15 @@ void init_mario_from_save_file(void) {
gHudDisplay.coins = 0;
gHudDisplay.wedges = 8;
}
void set_mario_particle_flags(struct MarioState* m, u32 flags, u8 clear) {
if (m->playerIndex != 0) {
return;
}
if (clear) {
m->particleFlags &= ~flags;
} else {
m->particleFlags |= flags;
}
}

View file

@ -57,5 +57,6 @@ s32 force_idle_state(struct MarioState* m);
void init_single_mario(struct MarioState* m);
void init_mario(void);
void init_mario_from_save_file(void);
void set_mario_particle_flags(struct MarioState* m, u32 flags, u8 clear);
#endif // MARIO_H

View file

@ -139,7 +139,7 @@ s32 check_fall_damage_or_get_stuck(struct MarioState *m, u32 hardFallAction) {
#else
play_character_sound(m, CHAR_SOUND_OOOF2);
#endif
m->particleFlags |= PARTICLE_MIST_CIRCLE;
set_mario_particle_flags(m, PARTICLE_MIST_CIRCLE, FALSE);
drop_and_set_mario_action(m, ACT_FEET_STUCK_IN_GROUND, 0);
queue_rumble_data_mario(m, 5, 80);
@ -417,7 +417,7 @@ u32 common_air_action_step(struct MarioState *m, u32 landAction, s32 animation,
// that the final quarter step detects a ledge, but you are
// not able to ledge grab it.
if (m->forwardVel >= 38.0f) {
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0);
} else {
if (m->forwardVel > 8.0f) {
@ -762,7 +762,7 @@ s32 act_dive(struct MarioState *m) {
#else
play_character_sound(m, CHAR_SOUND_OOOF2);
#endif
m->particleFlags |= PARTICLE_MIST_CIRCLE;
set_mario_particle_flags(m, PARTICLE_MIST_CIRCLE, FALSE);
drop_and_set_mario_action(m, ACT_HEAD_STUCK_IN_GROUND, 0);
} else if (!check_fall_damage(m, ACT_HARD_FORWARD_GROUND_KB)) {
if (m->heldObj == NULL) {
@ -782,7 +782,7 @@ s32 act_dive(struct MarioState *m) {
m->vel[1] = 0.0f;
}
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
drop_and_set_mario_action(m, ACT_BACKWARD_AIR_KB, 0);
break;
@ -958,12 +958,12 @@ s32 act_ground_pound(struct MarioState *m) {
#else
play_character_sound(m, CHAR_SOUND_OOOF2);
#endif
m->particleFlags |= PARTICLE_MIST_CIRCLE;
set_mario_particle_flags(m, PARTICLE_MIST_CIRCLE, FALSE);
set_mario_action(m, ACT_BUTT_STUCK_IN_GROUND, 0);
} else {
play_mario_heavy_landing_sound(m, SOUND_ACTION_TERRAIN_HEAVY_LANDING);
if (!check_fall_damage(m, ACT_HARD_BACKWARD_GROUND_KB)) {
m->particleFlags |= PARTICLE_MIST_CIRCLE | PARTICLE_HORIZONTAL_STAR;
set_mario_particle_flags(m, (PARTICLE_MIST_CIRCLE | PARTICLE_HORIZONTAL_STAR), FALSE);
set_mario_action(m, ACT_GROUND_POUND_LAND, 0);
}
}
@ -974,7 +974,7 @@ s32 act_ground_pound(struct MarioState *m) {
m->vel[1] = 0.0f;
}
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0);
}
}
@ -992,7 +992,7 @@ s32 act_burning_jump(struct MarioState *m) {
}
set_mario_animation(m, m->actionArg == 0 ? MARIO_ANIM_SINGLE_JUMP : MARIO_ANIM_FIRE_LAVA_BURN);
m->particleFlags |= PARTICLE_FIRE;
set_mario_particle_flags(m, PARTICLE_FIRE, FALSE);
play_sound(SOUND_MOVING_LAVA_BURN, m->marioObj->header.gfx.cameraToObject);
m->marioObj->oMarioBurnTimer += 3;
@ -1020,7 +1020,7 @@ s32 act_burning_fall(struct MarioState *m) {
}
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
m->particleFlags |= PARTICLE_FIRE;
set_mario_particle_flags(m, PARTICLE_FIRE, FALSE);
m->marioObj->oMarioBurnTimer += 3;
m->health -= 10;
@ -1085,7 +1085,7 @@ s32 act_crazy_box_bounce(struct MarioState *m) {
set_mario_action(m, ACT_STOMACH_SLIDE, 0);
}
queue_rumble_data_mario(m, 5, 80);
m->particleFlags |= PARTICLE_MIST_CIRCLE;
set_mario_particle_flags(m, PARTICLE_MIST_CIRCLE, FALSE);
break;
case AIR_STEP_HIT_WALL:
@ -1334,7 +1334,7 @@ s32 act_air_hit_wall(struct MarioState *m) {
m->vel[1] = 0.0f;
}
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
return set_mario_action(m, ACT_BACKWARD_AIR_KB, 0);
} else {
m->wallKickTimer = 5;
@ -1465,7 +1465,7 @@ s32 act_butt_slide_air(struct MarioState *m) {
if (m->vel[1] > 0.0f) {
m->vel[1] = 0.0f;
}
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0);
break;
@ -1506,7 +1506,7 @@ s32 act_hold_butt_slide_air(struct MarioState *m) {
}
mario_drop_held_object(m);
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0);
break;
@ -1566,7 +1566,7 @@ s32 act_lava_boost(struct MarioState *m) {
set_mario_animation(m, MARIO_ANIM_FIRE_LAVA_BURN);
if ((m->area->terrainType & TERRAIN_MASK) != TERRAIN_SNOW && !(m->flags & MARIO_METAL_CAP)
&& m->vel[1] > 0.0f) {
m->particleFlags |= PARTICLE_FIRE;
set_mario_particle_flags(m, PARTICLE_FIRE, FALSE);
if (m->actionState == 0) {
play_sound(SOUND_MOVING_LAVA_BURN, m->marioObj->header.gfx.cameraToObject);
}
@ -1637,7 +1637,7 @@ s32 act_slide_kick(struct MarioState *m) {
m->vel[1] = 0.0f;
}
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0);
break;
@ -1731,7 +1731,7 @@ s32 act_shot_from_cannon(struct MarioState *m) {
m->vel[1] = 0.0f;
}
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0);
#ifndef BETTERCAMERA
if (allowCameraChange) { set_camera_mode(m->area->camera, m->area->camera->defMode, 1); }
@ -1762,7 +1762,7 @@ s32 act_shot_from_cannon(struct MarioState *m) {
}
if (m->vel[1] > 0.0f) {
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
}
reset_rumble_timers(m);
@ -1897,7 +1897,7 @@ s32 act_flying(struct MarioState *m) {
: SOUND_ACTION_BONK,
m->marioObj->header.gfx.cameraToObject);
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
set_mario_action(m, ACT_BACKWARD_AIR_KB, 0);
if (m->playerIndex == 0) {
@ -1938,7 +1938,7 @@ s32 act_flying(struct MarioState *m) {
}
if (m->faceAngle[0] > 0x800 && m->forwardVel >= 48.0f) {
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
}
if (startPitch <= 0 && m->faceAngle[0] > 0 && m->forwardVel >= 48.0f) {
@ -2170,7 +2170,7 @@ s32 act_special_triple_jump(struct MarioState *m) {
set_mario_animation(m, MARIO_ANIM_GENERAL_FALL);
}
m->particleFlags |= PARTICLE_SPARKLES;
set_mario_particle_flags(m, PARTICLE_SPARKLES, FALSE);
return FALSE;
}

View file

@ -44,7 +44,7 @@ void add_tree_leaf_particles(struct MarioState *m) {
leafHeight = 100.0f;
}
if (m->pos[1] - m->floorHeight > leafHeight) {
m->particleFlags |= PARTICLE_LEAF;
set_mario_particle_flags(m, PARTICLE_LEAF, FALSE);
}
}
}
@ -187,7 +187,7 @@ s32 act_holding_pole(struct MarioState *m) {
//! The Shifting Sand Land palm tree check is done climbing up in
// add_tree_leaf_particles, but not here, when climbing down.
if (m->pos[1] - m->floorHeight > 100.0f) {
m->particleFlags |= PARTICLE_LEAF;
set_mario_particle_flags(m, PARTICLE_LEAF, FALSE);
}
}
play_climbing_sounds(m, 2);

View file

@ -762,7 +762,7 @@ s32 act_star_dance_water(struct MarioState *m) {
s32 act_fall_after_star_grab(struct MarioState *m) {
if (m->pos[1] < m->waterLevel - 130) {
play_sound(SOUND_ACTION_UNKNOWN430, m->marioObj->header.gfx.cameraToObject);
m->particleFlags |= PARTICLE_WATER_SPLASH;
set_mario_particle_flags(m, PARTICLE_WATER_SPLASH, FALSE);
return set_mario_action(m, ACT_STAR_DANCE_WATER, m->actionArg);
}
if (perform_air_step(m, 1) == AIR_STEP_LANDED) {
@ -1241,7 +1241,7 @@ s32 act_exit_airborne(struct MarioState *m) {
}
// rotate him to face away from the entrance
m->marioObj->header.gfx.angle[1] += 0x8000;
m->particleFlags |= PARTICLE_SPARKLES;
set_mario_particle_flags(m, PARTICLE_SPARKLES, FALSE);
return FALSE;
}
@ -1252,7 +1252,7 @@ s32 act_falling_exit_airborne(struct MarioState *m) {
}
// rotate Mario to face away from the entrance
m->marioObj->header.gfx.angle[1] += 0x8000;
m->particleFlags |= PARTICLE_SPARKLES;
set_mario_particle_flags(m, PARTICLE_SPARKLES, FALSE);
return FALSE;
}
@ -1409,7 +1409,7 @@ s32 act_special_exit_airborne(struct MarioState *m) {
m->actionArg = 1;
}
m->particleFlags |= PARTICLE_SPARKLES;
set_mario_particle_flags(m, PARTICLE_SPARKLES, FALSE);
// rotate Mario to face away from the entrance
marioObj->header.gfx.angle[1] += 0x8000;
// show Mario
@ -2121,7 +2121,7 @@ static s32 jumbo_star_cutscene_taking_off(struct MarioState *m) {
play_character_sound(m, CHAR_SOUND_YAHOO);
break;
}
m->particleFlags |= PARTICLE_SPARKLES;
set_mario_particle_flags(m, PARTICLE_SPARKLES, FALSE);
if (is_anim_past_end(m)) {
advance_cutscene_step(m);
@ -2180,7 +2180,7 @@ static s32 jumbo_star_cutscene_flying(struct MarioState *m) {
m->marioBodyState->handState = MARIO_HAND_RIGHT_OPEN;
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
m->particleFlags |= PARTICLE_SPARKLES;
set_mario_particle_flags(m, PARTICLE_SPARKLES, FALSE);
if (m->actionTimer++ == 500 && m->playerIndex == 0) {
level_trigger_warp(m, WARP_OP_CREDITS_START);
@ -2419,7 +2419,7 @@ static void end_peach_cutscene_run_to_peach(struct MarioState *m) {
play_step_sound(m, 9, 45);
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
}
// dialog 1
@ -2858,7 +2858,7 @@ static s32 act_credits_cutscene(struct MarioState *m) {
vec3f_copy(m->marioObj->header.gfx.pos, m->pos);
// will copy over roll and pitch, if set
vec3s_copy(m->marioObj->header.gfx.angle, m->faceAngle);
m->particleFlags |= PARTICLE_BUBBLE;
set_mario_particle_flags(m, PARTICLE_BUBBLE, FALSE);
} else {
set_mario_animation(m, MARIO_ANIM_FIRST_PERSON);
if (m->actionTimer > 0) {
@ -3027,7 +3027,7 @@ s32 mario_execute_cutscene_action(struct MarioState *m) {
}
if (!cancel && (m->input & INPUT_IN_WATER)) {
m->particleFlags |= PARTICLE_IDLE_WATER_WAVE;
set_mario_particle_flags(m, PARTICLE_IDLE_WATER_WAVE, FALSE);
}
return cancel;

View file

@ -712,7 +712,7 @@ void push_or_sidle_wall(struct MarioState *m, Vec3f startPos) {
if (m->marioObj->header.gfx.animInfo.animFrame < 20) {
play_sound(SOUND_MOVING_TERRAIN_SLIDE + m->terrainSoundAddend, m->marioObj->header.gfx.cameraToObject);
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
}
m->actionState = 1;
@ -836,7 +836,7 @@ s32 act_walking(struct MarioState *m) {
case GROUND_STEP_NONE:
anim_and_audio_for_walk(m);
if (m->intendedMag - m->forwardVel > 16.0f) {
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
}
break;
@ -879,7 +879,7 @@ s32 act_move_punching(struct MarioState *m) {
break;
case GROUND_STEP_NONE:
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
break;
}
@ -934,7 +934,7 @@ s32 act_hold_walking(struct MarioState *m) {
anim_and_audio_for_hold_walk(m);
if (0.4f * m->intendedMag - m->forwardVel > 10.0f) {
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
}
return FALSE;
@ -1004,7 +1004,7 @@ s32 act_turning_around(struct MarioState *m) {
break;
case GROUND_STEP_NONE:
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
break;
}
@ -1069,7 +1069,7 @@ s32 act_braking(struct MarioState *m) {
break;
case GROUND_STEP_NONE:
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
break;
case GROUND_STEP_HIT_WALL:
@ -1131,7 +1131,7 @@ s32 act_decelerating(struct MarioState *m) {
set_mario_animation(m, MARIO_ANIM_IDLE_HEAD_LEFT);
play_sound(SOUND_MOVING_TERRAIN_SLIDE + m->terrainSoundAddend, m->marioObj->header.gfx.cameraToObject);
adjust_sound_for_speed(m);
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
} else {
// (Speed Crash) Crashes if speed exceeds 2^17.
if ((val0C = (s32)(m->forwardVel / 4.0f * 0x10000)) < 0x1000) {
@ -1197,7 +1197,7 @@ s32 act_hold_decelerating(struct MarioState *m) {
set_mario_animation(m, MARIO_ANIM_IDLE_WITH_LIGHT_OBJ);
play_sound(SOUND_MOVING_TERRAIN_SLIDE + m->terrainSoundAddend, m->marioObj->header.gfx.cameraToObject);
adjust_sound_for_speed(m);
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
} else {
//! (Speed Crash) This crashes if Mario has more speed than 2^15 speed.
if ((val0C = (s32)(m->forwardVel * 0x10000)) < 0x1000) {
@ -1238,7 +1238,7 @@ s32 act_riding_shell_ground(struct MarioState *m) {
mario_stop_riding_object(m);
play_sound(m->flags & MARIO_METAL_CAP ? SOUND_ACTION_METAL_BONK : SOUND_ACTION_BONK,
m->marioObj->header.gfx.cameraToObject);
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
set_mario_action(m, ACT_BACKWARD_GROUND_KB, 0);
break;
}
@ -1348,7 +1348,7 @@ s32 act_burning_ground(struct MarioState *m) {
set_mario_anim_with_accel(m, MARIO_ANIM_RUNNING, (s32)(m->forwardVel / 2.0f * 0x10000));
play_step_sound(m, 9, 45);
m->particleFlags |= PARTICLE_FIRE;
set_mario_particle_flags(m, PARTICLE_FIRE, FALSE);
play_sound(SOUND_MOVING_LAVA_BURN, m->marioObj->header.gfx.cameraToObject);
m->health -= 10;
@ -1393,16 +1393,16 @@ void common_slide_action(struct MarioState *m, u32 endAction, u32 airAction, s32
case GROUND_STEP_NONE:
set_mario_animation(m, animation);
align_with_floor(m);
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
break;
case GROUND_STEP_HIT_WALL:
if (!mario_floor_is_slippery(m)) {
#ifdef VERSION_JP
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
#else
if (m->forwardVel > 16.0f) {
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
}
#endif
slide_bonk(m, ACT_GROUND_BONK, endAction);
@ -1519,13 +1519,13 @@ s32 act_slide_kick_slide(struct MarioState *m) {
case GROUND_STEP_HIT_WALL:
mario_bonk_reflection(m, TRUE);
m->particleFlags |= PARTICLE_VERTICAL_STAR;
set_mario_particle_flags(m, PARTICLE_VERTICAL_STAR, FALSE);
set_mario_action(m, ACT_BACKWARD_GROUND_KB, 0);
break;
}
play_sound(SOUND_MOVING_TERRAIN_SLIDE + m->terrainSoundAddend, m->marioObj->header.gfx.cameraToObject);
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
return FALSE;
}
@ -1761,7 +1761,7 @@ u32 common_landing_action(struct MarioState *m, s16 animation, u32 airAction) {
}
if (m->forwardVel > 16.0f) {
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
}
set_mario_animation(m, animation);
@ -2052,8 +2052,8 @@ s32 mario_execute_moving_action(struct MarioState *m) {
}
if (!cancel && (m->input & INPUT_IN_WATER)) {
m->particleFlags |= PARTICLE_WAVE_TRAIL;
m->particleFlags &= ~PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_WAVE_TRAIL, FALSE);
set_mario_particle_flags(m, PARTICLE_DUST, TRUE);
}
return cancel;

View file

@ -515,7 +515,7 @@ s32 mario_execute_object_action(struct MarioState *m) {
}
if (!cancel && (m->input & INPUT_IN_WATER)) {
m->particleFlags |= PARTICLE_IDLE_WATER_WAVE;
set_mario_particle_flags(m, PARTICLE_IDLE_WATER_WAVE, FALSE);
}
return cancel;

View file

@ -397,7 +397,7 @@ s32 act_shivering(struct MarioState *m) {
case 0:
animFrame = set_mario_animation(m, MARIO_ANIM_SHIVERING_WARMING_HAND);
if (animFrame == 49) {
m->particleFlags |= PARTICLE_BREATH;
set_mario_particle_flags(m, PARTICLE_BREATH, FALSE);
play_character_sound(m, CHAR_SOUND_PANTING_COLD);
}
if (animFrame == 7 || animFrame == 81) {
@ -1178,7 +1178,7 @@ s32 mario_execute_stationary_action(struct MarioState *m) {
}
if (!cancel && (m->input & INPUT_IN_WATER)) {
m->particleFlags |= PARTICLE_IDLE_WATER_WAVE;
set_mario_particle_flags(m, PARTICLE_IDLE_WATER_WAVE, FALSE);
}
return cancel;

View file

@ -45,7 +45,7 @@ void set_swimming_at_surface_particles(struct MarioState *m, u32 particleFlag) {
u16 pIndex = m->playerIndex;
if (atSurface) {
m->particleFlags |= particleFlag;
set_mario_particle_flags(m, particleFlag, FALSE);
if (atSurface ^ sWasAtSurface[pIndex]) {
play_sound(SOUND_ACTION_UNKNOWN431, m->marioObj->header.gfx.cameraToObject);
}
@ -1024,7 +1024,7 @@ static s32 act_water_plunge(struct MarioState *m) {
play_character_sound(m, CHAR_SOUND_HAHA_2);
}
m->particleFlags |= PARTICLE_WATER_SPLASH;
set_mario_particle_flags(m, PARTICLE_WATER_SPLASH, FALSE);
m->actionState = 1;
if (m->prevAction & ACT_FLAG_AIR) {
queue_rumble_data_mario(m, 5, 80);
@ -1076,7 +1076,7 @@ static s32 act_water_plunge(struct MarioState *m) {
break;
}
m->particleFlags |= PARTICLE_PLUNGE_BUBBLE;
set_mario_particle_flags(m, PARTICLE_PLUNGE_BUBBLE, FALSE);
return FALSE;
}
@ -1157,7 +1157,7 @@ static s32 act_caught_in_whirlpool(struct MarioState *m) {
static void play_metal_water_jumping_sound(struct MarioState *m, u32 landing) {
if (!(m->flags & MARIO_ACTION_SOUND_PLAYED)) {
m->particleFlags |= PARTICLE_MIST_CIRCLE;
set_mario_particle_flags(m, PARTICLE_MIST_CIRCLE, FALSE);
}
play_sound_if_no_flag(m, landing ? SOUND_ACTION_METAL_LAND_WATER : SOUND_ACTION_METAL_JUMP_WATER,
@ -1167,7 +1167,7 @@ static void play_metal_water_jumping_sound(struct MarioState *m, u32 landing) {
static void play_metal_water_walking_sound(struct MarioState *m) {
if (is_anim_past_frame(m, 10) || is_anim_past_frame(m, 49)) {
play_sound(SOUND_ACTION_METAL_STEP_WATER, m->marioObj->header.gfx.cameraToObject);
m->particleFlags |= PARTICLE_DUST;
set_mario_particle_flags(m, PARTICLE_DUST, FALSE);
}
}
@ -1257,7 +1257,7 @@ static s32 act_metal_water_standing(struct MarioState *m) {
stop_and_set_height_to_floor(m);
if (m->pos[1] >= m->waterLevel - 150) {
m->particleFlags |= PARTICLE_IDLE_WATER_WAVE;
set_mario_particle_flags(m, PARTICLE_IDLE_WATER_WAVE, FALSE);
}
return FALSE;

View file

@ -539,9 +539,9 @@ Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, Mat4* c) {
if (!marioActive) {
node->flags &= ~GRAPH_RENDER_ACTIVE;
} else if (camera->mode == CAMERA_MODE_C_UP) {
rotNode->rotation[0] = gPlayerCameraState->headRotation[1];
rotNode->rotation[2] = gPlayerCameraState->headRotation[0];
} else if (((plrIdx == 0) && (camera->mode == CAMERA_MODE_C_UP)) || ((plrIdx != 0) && (action == ACT_FIRST_PERSON))) {
rotNode->rotation[0] = gPlayerCameraState[plrIdx].headRotation[1];
rotNode->rotation[2] = gPlayerCameraState[plrIdx].headRotation[0];
}
else if (action & ACT_FLAG_WATER_OR_TEXT) {
rotNode->rotation[0] = bodyState->headAngle[1];

View file

@ -281,7 +281,10 @@ void bhv_mario_update(void) {
vec3f_copy(gMarioState->marioBodyState->torsoPos, gMarioState->pos);
}
gMarioState->particleFlags = 0;
if (stateIndex == 0) {
gMarioState->particleFlags = 0;
}
smlua_call_event_hooks_mario_param(HOOK_BEFORE_MARIO_UPDATE, gMarioState);
u32 particleFlags = 0;

View file

@ -59,6 +59,7 @@ struct PacketPlayerData {
u8 squishTimer;
f32 peakHeight;
s16 currentRoom;
Vec3s headRotation;
u8 customFlags;
u8 heldSyncID;
@ -121,6 +122,7 @@ static void read_packet_data(struct PacketPlayerData* data, struct MarioState* m
data->squishTimer = m->squishTimer;
data->peakHeight = m->peakHeight;
data->currentRoom = m->currentRoom;
memcpy(data->headRotation, gPlayerCameraState[m->playerIndex].headRotation, sizeof(s16) * 3);
data->customFlags = customFlags;
data->heldSyncID = heldSyncID;
@ -176,6 +178,7 @@ static void write_packet_data(struct PacketPlayerData* data, struct MarioState*
m->squishTimer = data->squishTimer;
m->peakHeight = data->peakHeight;
m->currentRoom = data->currentRoom;
memcpy(gPlayerCameraState[m->playerIndex].headRotation, data->headRotation, sizeof(s16) * 3);
*customFlags = data->customFlags;
*heldSyncID = data->heldSyncID;