From: DeaDDooMER Date: Thu, 9 Jun 2022 21:31:28 +0000 (+0300) Subject: gl: handle map bounds X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=06d69487e8ed454d11cfad4e9675a9b4374b3fb6;p=d2df-sdl.git gl: handle map bounds --- 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