From 1b0951057d7105ab2854a83e7c0284587fd747f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Wed, 8 Sep 2021 17:34:30 +0200 Subject: [PATCH] Small world fixes --- code/game/src/game.c | 2 +- code/game/src/packets/pkt_send_keystate.c | 4 ++-- code/game/src/world/world.c | 2 +- run_server.bat | 4 ++++ 4 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 run_server.bat diff --git a/code/game/src/game.c b/code/game/src/game.c index ea2887c..286f17c 100644 --- a/code/game/src/game.c +++ b/code/game/src/game.c @@ -150,10 +150,10 @@ void game_init(game_kind play_mode, uint32_t num_viewers, int32_t seed, uint16_t world_setup_pkt_handlers(pkt_reader, game_mode == GAMEKIND_SINGLE ? sp_pkt_writer : mp_pkt_writer); world_init(seed, chunk_size, chunk_amount); if (is_dash_enabled) flecs_dash_init(); - //ecs_set_target_fps(world_ecs(), 60); if (game_mode == GAMEKIND_HEADLESS) { network_server_start(0, 27000); + ecs_set_target_fps(world_ecs(), 60); } } diff --git a/code/game/src/packets/pkt_send_keystate.c b/code/game/src/packets/pkt_send_keystate.c index 3b465f4..2d9276a 100644 --- a/code/game/src/packets/pkt_send_keystate.c +++ b/code/game/src/packets/pkt_send_keystate.c @@ -57,8 +57,8 @@ int32_t pkt_send_keystate_handler(pkt_header *header) { Input *i = ecs_get_mut(world_ecs(), e, Input, NULL); if (i && !i->is_blocked) { - i->x = table.x; - i->y = table.y; + i->x = zpl_clamp(table.x, -1.0f, 1.0f); + i->y = zpl_clamp(table.y, -1.0f, 1.0f); i->mx = table.mx; i->my = table.my; i->use = table.use; diff --git a/code/game/src/world/world.c b/code/game/src/world/world.c index d14f3ab..65b4c52 100644 --- a/code/game/src/world/world.c +++ b/code/game/src/world/world.c @@ -258,7 +258,7 @@ static void world_tracker_update(uint8_t ticker, uint32_t freq, uint8_t radius) // TODO(zaklaus): SUPER TEMPORARY HOT !!! simulate variable radius queries { - librg_entity_radius_set(world_tracker(), p[i].peer, radius); + librg_entity_radius_set(world_tracker(), it.entities[i], radius); } // TODO(zaklaus): push radius once librg patch comes in int32_t result = librg_world_write(world_tracker(), it.entities[i], buffer, &datalen, NULL); diff --git a/run_server.bat b/run_server.bat new file mode 100644 index 0000000..d6a2a02 --- /dev/null +++ b/run_server.bat @@ -0,0 +1,4 @@ + @echo off + +call package.bat +pkg\eco2d.exe -d %*