From 2b891f1cb1e57e3bd1f7407d8035b785c00287a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Thu, 12 Aug 2021 02:31:07 +0200 Subject: [PATCH] code: disable prediction for now --- code/game/src/platform_raylib.c | 2 +- code/game/src/prediction.c | 3 ++- code/game/src/renderer_3d.c | 16 +++++++++++++++- code/modules/modules/systems.c | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/code/game/src/platform_raylib.c b/code/game/src/platform_raylib.c index 8ca26a2..bc1c932 100644 --- a/code/game/src/platform_raylib.c +++ b/code/game/src/platform_raylib.c @@ -23,7 +23,7 @@ static bool request_shutdown; void platform_init() { InitWindow(screenWidth, screenHeight, "eco2d"); - SetWindowState(FLAG_WINDOW_UNDECORATED|FLAG_WINDOW_MAXIMIZED|FLAG_WINDOW_RESIZABLE); + SetWindowState(FLAG_WINDOW_UNDECORATED|FLAG_WINDOW_MAXIMIZED|FLAG_WINDOW_RESIZABLE|FLAG_MSAA_4X_HINT); SetTargetFPS(60); screenWidth = GetScreenWidth(); diff --git a/code/game/src/prediction.c b/code/game/src/prediction.c index c2adf31..b0cdaf3 100644 --- a/code/game/src/prediction.c +++ b/code/game/src/prediction.c @@ -76,11 +76,12 @@ void lerp_entity_positions(uint64_t key, entity_view *data) { if (data->flag == EFLAG_INTERP) { -#if 1 +#if 0 data->x = smooth_val(data->x, data->tx, view->delta_time[data->layer_id]); data->y = smooth_val(data->y, data->ty, view->delta_time[data->layer_id]); data->heading = smooth_val_spherical(data->heading, data->theading, view->delta_time[data->layer_id]); #else + (void)view; data->x = data->tx; data->y = data->ty; data->heading = data->theading; diff --git a/code/game/src/renderer_3d.c b/code/game/src/renderer_3d.c index ca04f4c..af00e68 100644 --- a/code/game/src/renderer_3d.c +++ b/code/game/src/renderer_3d.c @@ -13,13 +13,27 @@ void DEBUG_draw_ground_3d(uint64_t key, entity_view * data) { world_view *view = game_world_view_get_active(); int32_t size = view->chunk_size * WORLD_BLOCK_SIZE; int32_t half_size = size >> 1; + int32_t half_block_size = WORLD_BLOCK_SIZE >> 1; int16_t offset = 0; float x = data->x * size + offset; float y = data->y * size + offset; RenderTexture2D tex = GetChunkTexture(key); - DrawCubeTexture(tex.texture, (Vector3){x+half_size, 0.0f, y+half_size}, size, 1.0f, size, WHITE); + DrawCubeTexture(tex.texture, (Vector3){x+half_size, 0.0f, y+half_size}, size, 0.01f, size, WHITE); + + for (int by = 0; by < 16; by++) { + for (int bx = 0; bx < 16; bx++) { + switch (blocks_get_flags(data->blocks[by*16+bx])) { + case BLOCK_FLAG_COLLISION:{ + DrawCubeWires((Vector3){x + bx*WORLD_BLOCK_SIZE+half_block_size, 34.f, y + by*WORLD_BLOCK_SIZE+half_block_size}, 64, 66, 64, BLUE); + }break; + case BLOCK_FLAG_HAZARD:{ + DrawCubeWires((Vector3){x + bx*WORLD_BLOCK_SIZE+half_block_size, 16.667f, y + by*WORLD_BLOCK_SIZE+half_block_size}, 64, 33, 64, RED); + }break; + } + } + } }break; default:break; diff --git a/code/modules/modules/systems.c b/code/modules/modules/systems.c index 57f7486..113cf02 100644 --- a/code/modules/modules/systems.c +++ b/code/modules/modules/systems.c @@ -131,4 +131,5 @@ void SystemsImport(ecs_world_t *ecs) { ECS_SYSTEM(ecs, UpdateTrackerPos, EcsPostUpdate, components.Position); ECS_SYSTEM(ecs, ClearVehicle, EcsUnSet, components.Vehicle); + }