From 339f130b947dc39e04000e3682118b649bf78424 Mon Sep 17 00:00:00 2001 From: Dominic Szablewski Date: Sun, 24 Sep 2023 13:59:57 +0200 Subject: [PATCH] Fix ebolt thrust effect on player being frame rate dependent --- src/wipeout/ship_player.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/wipeout/ship_player.c b/src/wipeout/ship_player.c index 1aab69a..412c9b5 100644 --- a/src/wipeout/ship_player.c +++ b/src/wipeout/ship_player.c @@ -197,13 +197,18 @@ void ship_player_update_race(ship_t *self) { if (flags_is(self->flags, SHIP_ELECTROED)) { self->ebolt_effect_timer += system_tick(); + // Yank the ship every 0.1 seconds if (self->ebolt_effect_timer > 0.1) { + self->ebolt_effect_timer -= 0.1; if (flags_is(self->flags, SHIP_VIEW_INTERNAL)) { // SetShake(2); // FIXME } - self->angular_velocity.y += rand_float(-0.5, 0.5); // FIXME: 60fps - self->ebolt_effect_timer -= 0.1; + self->angular_velocity.y += rand_float(-0.5, 0.5); + + if (rand_int(0, 10) == 0) { // approx once per second + self->thrust_mag -= self->thrust_mag * 0.25; + } } } @@ -231,10 +236,6 @@ void ship_player_update_race(ship_t *self) { } self->thrust_mag = clamp(self->thrust_mag, 0, self->current_thrust_max); - if (flags_is(self->flags, SHIP_ELECTROED) && rand_int(0, 80) == 0) { - self->thrust_mag -= self->thrust_mag * 0.25; // FIXME: 60fps - } - // Brake if (input_state(A_BRAKE_RIGHT)) { self->brake_right += SHIP_BRAKE_RATE * system_tick();