project cleanup
parent
a71a1d9218
commit
51c31d9777
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 =
|
||||
|
|
Loading…
Reference in New Issue