From 4ef8cf8b3d9ad5235aa858a68f70a8aaf2b356da Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Mon, 3 Jul 2023 21:40:42 +0100 Subject: Sound queue This is to queue sounds and play them when we update the screen, so the sounds are synced with the action. It is required because the MikMod_Update function updates on the clock int, and is not synced with the VGA's vsync. --- src/player.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/player.c') diff --git a/src/player.c b/src/player.c index 8d80923..c07cc34 100644 --- a/src/player.c +++ b/src/player.c @@ -165,7 +165,7 @@ void player_update() momentum = 0; frame = FRAME_JUMPING; gravity = GRAVITY_UP; - sound_play_efx(EFX_JUMP); + sound_queue_efx(EFX_JUMP); } } else @@ -278,7 +278,7 @@ void player_update() if (map_update_gold(x + (dir == DIR_LEFT ? 7 : 8), y + 15)) { add_score(10); - sound_play_efx(EFX_GOLD); + sound_queue_efx(EFX_GOLD); } } @@ -325,13 +325,13 @@ void player_hit() if (use_pickaxe()) { invuln = INVULN_TIME; - sound_play_efx(EFX_HIT); + sound_queue_efx(EFX_HIT); } else { dying = 1; frame = FRAME_DYING; gravity = GRAVITY_UP; - sound_play_efx(EFX_DEATH); + sound_queue_efx(EFX_DEATH); } } -- cgit v1.2.3