summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2023-10-29 08:26:31 +0100
committerAldrik Ramaekers <aldrik@amftech.nl>2023-10-29 08:26:31 +0100
commitd2c3f612b3d7b0071e98e589777d495ba45eafe4 (patch)
treee3084f2ac5ea942c41cb2878263a397b1eaa1b56 /main.c
parentf2522c04446bb4bd597a8625f9398e67ff957565 (diff)
more sounds
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/main.c b/main.c
index ef9d26e..87ac283 100644
--- a/main.c
+++ b/main.c
@@ -77,6 +77,9 @@ void handle_args(int argc, char **argv) {
}
connect_to_server(ip, port);
}
+
+ log_info("STATE: GAMESTATE_PLAYING");
+ global_state.state = GAMESTATE_PLAYING;
}
int main(int argc, char **argv)
@@ -91,8 +94,13 @@ int main(int argc, char **argv)
settings_set_number("USE_GPU", 1);
if (Mix_OpenAudio(48000, AUDIO_F32SYS, 2, 2048) == 0) {
- log_info("Audio system initialized.");
- Mix_MasterVolume(MIX_MAX_VOLUME/4);
+ if (Mix_AllocateChannels(NUMBER_OF_AUDIO_CHANNELS) == 64) {
+ log_info("Audio system initialized.");
+ Mix_MasterVolume(MIX_MAX_VOLUME/4);
+ }
+ else {
+ log_info("Channel allocation failed.");
+ }
}
else {
log_info("Audio failed.");
@@ -102,7 +110,7 @@ int main(int argc, char **argv)
bool did_handle_args = false;
while(platform_keep_running(window)) {
- if (global_asset_collection.done_loading_assets && !did_handle_args) {
+ if (global_asset_collection.done_loading_assets && !did_handle_args && global_state.state == GAMESTATE_LOADING_ASSETS) {
handle_args(argc, argv);
did_handle_args = true;
}