From 60cb5a829b54732176936e21511aa5372ae46fab Mon Sep 17 00:00:00 2001 From: untodesu Date: Thu, 27 Mar 2025 13:28:09 +0500 Subject: Allow game to not die when sound is not available --- game/client/game.cc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'game/client/game.cc') diff --git a/game/client/game.cc b/game/client/game.cc index af6fba6..c1d3fa8 100644 --- a/game/client/game.cc +++ b/game/client/game.cc @@ -342,7 +342,9 @@ void client_game::init(void) globals::gui_scale = 0U; globals::gui_screen = GUI_MAIN_MENU; - sound::init(); + if(globals::sound_ctx) { + sound::init(); + } client_receive::init(); @@ -356,7 +358,9 @@ void client_game::init_late(void) { toggles::init_late(); - sound::init_late(); + if(globals::sound_ctx) { + sound::init_late(); + } language::init_late(); @@ -418,7 +422,9 @@ void client_game::deinit(void) session::deinit(); - sound::deinit(); + if(globals::sound_ctx) { + sound::deinit(); + } hotbar::deinit(); main_menu::deinit(); @@ -506,9 +512,13 @@ void client_game::update(void) else globals::dimension->entities.emplace_or_replace(globals::player); } - sound::update(); + if(globals::sound_ctx) { + sound::update(); - listener::update(); + listener::update(); + + SoundEmitterComponent::update(); + } interpolation::update(); @@ -516,8 +526,6 @@ void client_game::update(void) camera::update(); - SoundEmitterComponent::update(); - voxel_anims::update(); chunk_mesher::update(); -- cgit