project cleanup

isolation_bkp/dynres
Dominik Madarász 2021-05-07 12:51:32 +02:00
parent a71a1d9218
commit 51c31d9777
4 changed files with 18 additions and 18 deletions

View File

@ -19,5 +19,3 @@ add_subdirectory(code/common)
add_subdirectory(code/vendors) add_subdirectory(code/vendors)
add_subdirectory(code/apps/client) add_subdirectory(code/apps/client)
#add_subdirectory(code/apps/server)
#add_subdirectory(code/apps/playground)

View File

@ -17,7 +17,7 @@
#include "packets/pkt_00_init.h" #include "packets/pkt_00_init.h"
#include "packets/pkt_01_welcome.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 *world_viewers;
static world_view *active_viewer; 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) { 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(); platform_init();
world_viewers_init(num_viewers); world_viewers_init(num_viewers);
active_viewer = &world_viewers[0]; active_viewer = &world_viewers[0];
camera_reset(); camera_reset();
if (is_networked_play) { if (is_viewer_only) {
world_setup_pkt_handlers(pkt_reader, mp_pkt_writer); world_setup_pkt_handlers(pkt_reader, mp_pkt_writer);
network_init(); network_init();
network_client_connect("127.0.0.1", 27000); 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() { int8_t game_is_networked() {
return is_networked_play; return is_viewer_only;
} }
void game_shutdown() { void game_shutdown() {
world_viewers_destroy(); world_viewers_destroy();
if (is_networked_play) { if (is_viewer_only) {
network_client_disconnect(); network_client_disconnect();
network_destroy(); network_destroy();
} else { } else {
@ -126,7 +126,7 @@ void game_input() {
} }
void game_update() { void game_update() {
if (is_networked_play) network_client_tick(); if (is_viewer_only) network_client_tick();
else world_update(); else world_update();
} }

View File

@ -15,7 +15,7 @@ int main(int argc, char** argv)
zpl_opts_init(&opts, zpl_heap(), argv[0]); zpl_opts_init(&opts, zpl_heap(), argv[0]);
zpl_opts_add(&opts, "?", "help", "the HELP section", ZPL_OPTS_FLAG); 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, "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, "p", "preview-map", "draw world preview", ZPL_OPTS_FLAG);
zpl_opts_add(&opts, "s", "seed", "world seed", ZPL_OPTS_INT); zpl_opts_add(&opts, "s", "seed", "world seed", ZPL_OPTS_INT);
@ -32,7 +32,7 @@ int main(int argc, char** argv)
return -1; 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); int32_t seed = zpl_opts_integer(&opts, "seed", DEFAULT_WORLD_SEED);
uint16_t num_viewers = zpl_opts_integer(&opts, "viewer-count", 1); uint16_t num_viewers = zpl_opts_integer(&opts, "viewer-count", 1);
uint16_t block_size = zpl_opts_integer(&opts, "block-size", DEFAULT_BLOCK_SIZE); 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(); 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()) { while (game_is_running()) {
game_input(); game_input();

View File

@ -21,17 +21,19 @@ patterns =
blacklist_patterns = blacklist_patterns =
{ {
".*", ".*",
"build/.*",
}; };
load_paths = load_paths =
{ {
{ {{
{ {"."}, .recursive = false, .relative = true }, .os = "win" { ".", .recursive = false, .relative = true },
}, { "code/apps/client", .recursive = true, .relative = true },
{ { "code/common", .recursive = true, .relative = true },
{ {"code"}, .recursive = true, .relative = true }, .os = "win" { "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 = command_list =