diff options
| author | Aldrik Ramaekers <aldrik@amftech.nl> | 2023-12-24 11:04:11 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrik@amftech.nl> | 2023-12-24 11:04:11 +0100 |
| commit | cb9c0f812695da554e1feb5afe71b38324b65103 (patch) | |
| tree | 36fb3d13a9136acbfc63684e1ab750fa0f25709e /src/players.c | |
| parent | aa7043faa9ed8ed676603bd1a44388026700b3b1 (diff) | |
new font and audio
Diffstat (limited to 'src/players.c')
| -rw-r--r-- | src/players.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/players.c b/src/players.c index cd2e479..93b87cf 100644 --- a/src/players.c +++ b/src/players.c @@ -64,6 +64,7 @@ void spawn_player(u32 id, network_client client) { players[i].throwables.grenades = 3; players[i].throwables.molotovs = 1; players[i].points = 800; + players[i].sec_since_last_step = 0.0f; gun g = get_gun_by_type(players[i].guntype); players[i].total_ammo = g.max_ammunition; @@ -121,6 +122,11 @@ void move_user(platform_window* window, u32 id, protocol_move_type move, float d return; } + if (p->sec_since_last_step > 0.2f) { + add_audio_event_to_queue(EVENT_FOOTSTEP, p->id, (vec3f){.x = p->playerx, .y = p->playery, .z = p->height}); + p->sec_since_last_step = 0.0f; + } + if (move == MOVE_UPLEFT || move == MOVE_UPRIGHT || move == MOVE_DOWNLEFT || move == MOVE_DOWNRIGHT) { float diag = (speed_straight * sqrt(2)); speed = (speed_straight * (speed_straight / diag)) * delta; @@ -347,6 +353,7 @@ void update_players_server() { if (!players[i].active) continue; players[i].sec_since_last_shot += SERVER_TICK_RATE; players[i].sec_since_interact_state_change += SERVER_TICK_RATE; + players[i].sec_since_last_step += SERVER_TICK_RATE; gun g = get_gun_by_type(players[i].guntype); if (players[i].interact_state == INTERACT_RELOADING && players[i].sec_since_interact_state_change >= g.reload_time) { |
