From 51c31d977781248939cc954eb1891a0f76ada7f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Fri, 7 May 2021 12:51:32 +0200 Subject: [PATCH] project cleanup --- CMakeLists.txt | 2 -- code/apps/client/source/game.c | 12 ++++++------ code/apps/client/source/main.c | 6 +++--- project.4coder | 16 +++++++++------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 873d290..9679540 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,5 +19,3 @@ add_subdirectory(code/common) add_subdirectory(code/vendors) add_subdirectory(code/apps/client) -#add_subdirectory(code/apps/server) -#add_subdirectory(code/apps/playground) diff --git a/code/apps/client/source/game.c b/code/apps/client/source/game.c index 0f4c272..74d4e44 100644 --- a/code/apps/client/source/game.c +++ b/code/apps/client/source/game.c @@ -17,7 +17,7 @@ #include "packets/pkt_00_init.h" #include "packets/pkt_01_welcome.h" -static int8_t is_networked_play; +static int8_t is_viewer_only; static world_view *world_viewers; static world_view *active_viewer; @@ -80,13 +80,13 @@ void flecs_dash_init() { } void game_init(int8_t play_mode, uint32_t num_viewers, int32_t seed, uint16_t block_size, uint16_t chunk_size, uint16_t world_size) { - is_networked_play = play_mode; + is_viewer_only = play_mode; platform_init(); world_viewers_init(num_viewers); active_viewer = &world_viewers[0]; camera_reset(); - if (is_networked_play) { + if (is_viewer_only) { world_setup_pkt_handlers(pkt_reader, mp_pkt_writer); network_init(); network_client_connect("127.0.0.1", 27000); @@ -103,13 +103,13 @@ void game_init(int8_t play_mode, uint32_t num_viewers, int32_t seed, uint16_t bl } int8_t game_is_networked() { - return is_networked_play; + return is_viewer_only; } void game_shutdown() { world_viewers_destroy(); - if (is_networked_play) { + if (is_viewer_only) { network_client_disconnect(); network_destroy(); } else { @@ -126,7 +126,7 @@ void game_input() { } void game_update() { - if (is_networked_play) network_client_tick(); + if (is_viewer_only) network_client_tick(); else world_update(); } diff --git a/code/apps/client/source/main.c b/code/apps/client/source/main.c index b778e5e..b8092b8 100644 --- a/code/apps/client/source/main.c +++ b/code/apps/client/source/main.c @@ -15,7 +15,7 @@ int main(int argc, char** argv) zpl_opts_init(&opts, zpl_heap(), argv[0]); zpl_opts_add(&opts, "?", "help", "the HELP section", ZPL_OPTS_FLAG); - zpl_opts_add(&opts, "s", "single-player", "play single-player game.", ZPL_OPTS_FLAG); + zpl_opts_add(&opts, "v", "viewer-only", "run viewer-only client", ZPL_OPTS_FLAG); zpl_opts_add(&opts, "c", "viewer-count", "number of viewers (detachable clients)", ZPL_OPTS_INT); zpl_opts_add(&opts, "p", "preview-map", "draw world preview", ZPL_OPTS_FLAG); zpl_opts_add(&opts, "s", "seed", "world seed", ZPL_OPTS_INT); @@ -32,7 +32,7 @@ int main(int argc, char** argv) return -1; } - int8_t is_networked_play = !zpl_opts_has_arg(&opts, "single-player"); + int8_t is_viewer_only = zpl_opts_has_arg(&opts, "viewer-only"); int32_t seed = zpl_opts_integer(&opts, "seed", DEFAULT_WORLD_SEED); uint16_t num_viewers = zpl_opts_integer(&opts, "viewer-count", 1); uint16_t block_size = zpl_opts_integer(&opts, "block-size", DEFAULT_BLOCK_SIZE); @@ -52,7 +52,7 @@ int main(int argc, char** argv) } sighandler_register(); - game_init(is_networked_play, num_viewers, seed, block_size, chunk_size, world_size); + game_init(is_viewer_only, num_viewers, seed, block_size, chunk_size, world_size); while (game_is_running()) { game_input(); diff --git a/project.4coder b/project.4coder index 47b8261..65f4072 100644 --- a/project.4coder +++ b/project.4coder @@ -21,17 +21,19 @@ patterns = blacklist_patterns = { ".*", - "build/.*", }; load_paths = { - { - { {"."}, .recursive = false, .relative = true }, .os = "win" - }, - { - { {"code"}, .recursive = true, .relative = true }, .os = "win" - }, + {{ + { ".", .recursive = false, .relative = true }, + { "code/apps/client", .recursive = true, .relative = true }, + { "code/common", .recursive = true, .relative = true }, + { "code/modules", .recursive = true, .relative = true }, + { "code/vendors", .recursive = true, .relative = true }, + { "cmake", .recursive = true, .relative = true }, + { "build/_deps/raylib-src/src", .recursive = true, .relative = true } + }, .os = "win"} }; command_list =