From 06d69487e8ed454d11cfad4e9675a9b4374b3fb6 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Fri, 10 Jun 2022 00:31:28 +0300 Subject: [PATCH] gl: handle map bounds --- src/game/renders/opengl/r_map.pas | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/game/renders/opengl/r_map.pas b/src/game/renders/opengl/r_map.pas index 7cac17f..3ef4979 100644 --- a/src/game/renders/opengl/r_map.pas +++ b/src/game/renders/opengl/r_map.pas @@ -1165,7 +1165,19 @@ implementation ww := w; hh := h; - // TODO lock camera at map bounds + if g_dbg_ignore_bounds = false then + begin + if xx + ww > gMapInfo.Width then + xx := gMapInfo.Width - ww; + if yy + hh > gMapInfo.Height then + yy := gMapInfo.Height - hh; + if xx < 0 then + xx := 0; + if yy < 0 then + yy := 0; + cx := xx - x; + cy := yy - y; + end; // TODO draw paralax if SkyTexture <> nil then -- 2.29.2