From 957ef307c34d0f2c8ee92ecd089bfa49ec80a4e4 Mon Sep 17 00:00:00 2001 From: Quentin Bazin Date: Thu, 2 Jul 2020 20:37:20 +0200 Subject: [PATCH] [DebugOverlay] Now using positive modulo from GameKit. --- external/gamekit | 2 +- source/client/hud/DebugOverlay.cpp | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/external/gamekit b/external/gamekit index 72b969c10..eca073ea4 160000 --- a/external/gamekit +++ b/external/gamekit @@ -1 +1 @@ -Subproject commit 72b969c10838ed48c984f3b844192435cfb913b7 +Subproject commit eca073ea4ae4758477e0f931c7e8d8bd8216fc2e diff --git a/source/client/hud/DebugOverlay.cpp b/source/client/hud/DebugOverlay.cpp index b1b50b633..3b7628608 100644 --- a/source/client/hud/DebugOverlay.cpp +++ b/source/client/hud/DebugOverlay.cpp @@ -26,6 +26,8 @@ */ #include +#include + #include "ClientPlayer.hpp" #include "ClientScene.hpp" #include "ClientWorld.hpp" @@ -56,14 +58,6 @@ void DebugOverlay::update() { s32 py = std::floor(m_player.y()); s32 pz = std::floor(m_player.z()); - s32 rx = px % CHUNK_WIDTH; - s32 ry = py % CHUNK_DEPTH; - s32 rz = pz % CHUNK_HEIGHT; - - if (rx < 0) rx += 16; - if (ry < 0) ry += 16; - if (rz < 0) rz += 16; - // Directions is now an angle4 const char *directions[4] = {"East", "North", "West", "South"}; const char *direction = directions[m_player.getDirection()]; @@ -73,9 +67,9 @@ void DebugOverlay::update() { stream << "y: " << py << " | "; stream << "z: " << pz; stream << '\n'; - stream << "rx: " << rx << " | "; - stream << "ry: " << ry << " | "; - stream << "rz: " << rz; + stream << "rx: " << gk::pmod(px, CHUNK_WIDTH) << " | "; + stream << "ry: " << gk::pmod(py, CHUNK_DEPTH) << " | "; + stream << "rz: " << gk::pmod(pz, CHUNK_HEIGHT); stream << '\n'; stream << "cx: " << (px & -CHUNK_WIDTH) / CHUNK_WIDTH << " | "; stream << "cy: " << (py & -CHUNK_DEPTH) / CHUNK_DEPTH << " | ";