Prevent remote player damage from shaking local screen

This commit is contained in:
MysterD 2020-09-21 18:22:58 -07:00
parent 47122758d8
commit 5f3895463f
4 changed files with 8 additions and 8 deletions

View File

@ -543,7 +543,7 @@ void bounce_off_object(struct MarioState *m, struct Object *o, f32 velY) {
void hit_object_from_below(struct MarioState *m, UNUSED struct Object *o) { void hit_object_from_below(struct MarioState *m, UNUSED struct Object *o) {
m->vel[1] = 0.0f; m->vel[1] = 0.0f;
set_camera_shake_from_hit(SHAKE_HIT_FROM_BELOW); if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_HIT_FROM_BELOW); }
} }
static u32 unused_determine_knockback_action(struct MarioState *m) { static u32 unused_determine_knockback_action(struct MarioState *m) {
@ -700,7 +700,7 @@ void bounce_back_from_attack(struct MarioState *m, u32 interaction) {
mario_set_forward_vel(m, -48.0f); mario_set_forward_vel(m, -48.0f);
} }
set_camera_shake_from_hit(SHAKE_ATTACK); if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_ATTACK); }
m->particleFlags |= PARTICLE_TRIANGLE; m->particleFlags |= PARTICLE_TRIANGLE;
} }
@ -749,7 +749,7 @@ u32 take_damage_from_interact_object(struct MarioState *m) {
m->hurtCounter += 4 * damage; m->hurtCounter += 4 * damage;
queue_rumble_data_mario(m, 5, 80); queue_rumble_data_mario(m, 5, 80);
set_camera_shake_from_hit(shake); if (m->playerIndex == 0) { set_camera_shake_from_hit(shake); }
return damage; return damage;
} }

View File

@ -87,7 +87,7 @@ s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) {
if (fallHeight > 3000.0f) { if (fallHeight > 3000.0f) {
m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 16 : 24; m->hurtCounter += (m->flags & MARIO_CAP_ON_HEAD) ? 16 : 24;
queue_rumble_data_mario(m, 5, 80); queue_rumble_data_mario(m, 5, 80);
set_camera_shake_from_hit(SHAKE_FALL_DAMAGE); if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_FALL_DAMAGE); }
play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject);
return drop_and_set_mario_action(m, hardFallAction, 4); return drop_and_set_mario_action(m, hardFallAction, 4);
} else if (fallHeight > damageHeight && !mario_floor_is_slippery(m)) { } else if (fallHeight > damageHeight && !mario_floor_is_slippery(m)) {
@ -95,7 +95,7 @@ s32 check_fall_damage(struct MarioState *m, u32 hardFallAction) {
m->squishTimer = 30; m->squishTimer = 30;
queue_rumble_data_mario(m, 5, 80); queue_rumble_data_mario(m, 5, 80);
set_camera_shake_from_hit(SHAKE_FALL_DAMAGE); if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_FALL_DAMAGE); }
play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MARIO_ATTACKED, m->marioObj->header.gfx.cameraToObject);
} }
} }
@ -955,7 +955,7 @@ s32 act_ground_pound(struct MarioState *m) {
set_mario_action(m, ACT_GROUND_POUND_LAND, 0); set_mario_action(m, ACT_GROUND_POUND_LAND, 0);
} }
} }
set_camera_shake_from_hit(SHAKE_GROUND_POUND); if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_GROUND_POUND); }
} else if (stepResult == AIR_STEP_HIT_WALL) { } else if (stepResult == AIR_STEP_HIT_WALL) {
mario_set_forward_vel(m, -16.0f); mario_set_forward_vel(m, -16.0f);
if (m->vel[1] > 0.0f) { if (m->vel[1] > 0.0f) {

View File

@ -1566,7 +1566,7 @@ s32 act_teleport_fade_in(struct MarioState *m) {
s32 act_shocked(struct MarioState *m) { s32 act_shocked(struct MarioState *m) {
play_sound_if_no_flag(m, SOUND_MARIO_WAAAOOOW, MARIO_ACTION_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_MARIO_WAAAOOOW, MARIO_ACTION_SOUND_PLAYED);
play_sound(SOUND_MOVING_SHOCKED, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MOVING_SHOCKED, m->marioObj->header.gfx.cameraToObject);
set_camera_shake_from_hit(SHAKE_SHOCK); if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_SHOCK); }
if (set_mario_animation(m, MARIO_ANIM_SHOCKED) == 0) { if (set_mario_animation(m, MARIO_ANIM_SHOCKED) == 0) {
m->actionTimer++; m->actionTimer++;

View File

@ -890,7 +890,7 @@ static s32 act_forward_water_kb(struct MarioState *m) {
static s32 act_water_shocked(struct MarioState *m) { static s32 act_water_shocked(struct MarioState *m) {
play_sound_if_no_flag(m, SOUND_MARIO_WAAAOOOW, MARIO_ACTION_SOUND_PLAYED); play_sound_if_no_flag(m, SOUND_MARIO_WAAAOOOW, MARIO_ACTION_SOUND_PLAYED);
play_sound(SOUND_MOVING_SHOCKED, m->marioObj->header.gfx.cameraToObject); play_sound(SOUND_MOVING_SHOCKED, m->marioObj->header.gfx.cameraToObject);
set_camera_shake_from_hit(SHAKE_SHOCK); if (m->playerIndex == 0) { set_camera_shake_from_hit(SHAKE_SHOCK); }
if (set_mario_animation(m, MARIO_ANIM_SHOCKED) == 0) { if (set_mario_animation(m, MARIO_ANIM_SHOCKED) == 0) {
m->actionTimer++; m->actionTimer++;