Added player sprint sound

dev
Shariq Shah 6 years ago
parent a44e61c4e5
commit dcb62add68
  1. BIN
      assets/sounds/player_sprint.wav
  2. 2
      src/common/version.h
  3. 13
      src/game/player.c

Binary file not shown.

@ -4,7 +4,7 @@
/* Auto generated version file. DO NOT MODIFY */ /* Auto generated version file. DO NOT MODIFY */
#define SYMMETRY_VERSION_MAJOR 0 #define SYMMETRY_VERSION_MAJOR 0
#define SYMMETRY_VERSION_MINOR 1 #define SYMMETRY_VERSION_MINOR 1
#define SYMMETRY_VERSION_REVISION 343 #define SYMMETRY_VERSION_REVISION 344
#define SYMMETRY_VERSION_BRANCH "dev" #define SYMMETRY_VERSION_BRANCH "dev"
#endif #endif

@ -242,14 +242,23 @@ void player_update_physics(struct Player* player, struct Scene* scene, float fix
if(translation.x != 0.f || translation.z != 0.f) if(translation.x != 0.f || translation.z != 0.f)
{ {
// Walking
if(player->grounded) if(player->grounded)
{ {
if(strncmp(player->footstep_sound->source_buffer->filename, "sounds/player_walk.wav", MAX_FILENAME_LEN) != 0) // Sprinting/Walking
if(input_map_state_get("Sprint", KS_PRESSED))
{
if(strncmp(player->footstep_sound->source_buffer->filename, "sounds/player_sprint.wav", MAX_FILENAME_LEN) != 0)
sound_source_buffer_set(sound, player->footstep_sound, "sounds/player_sprint.wav", ST_WAV);
}
else if(strncmp(player->footstep_sound->source_buffer->filename, "sounds/player_walk.wav", MAX_FILENAME_LEN) != 0)
{
sound_source_buffer_set(sound, player->footstep_sound, "sounds/player_walk.wav", ST_WAV); sound_source_buffer_set(sound, player->footstep_sound, "sounds/player_walk.wav", ST_WAV);
}
if(sound_source_is_paused(sound, player->footstep_sound)) if(sound_source_is_paused(sound, player->footstep_sound))
{
sound_source_play(sound, player->footstep_sound); sound_source_play(sound, player->footstep_sound);
}
} }
} }
else else

Loading…
Cancel
Save