From: DeaDDooMER Date: Thu, 29 Dec 2022 18:58:16 +0000 (+0300) Subject: gl: fix mouse coords for holmes X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=315aac20797d3060960df924fad4b7c98f970b34;p=d2df-sdl.git gl: fix mouse coords for holmes --- diff --git a/src/game/renders/opengl/r_map.pas b/src/game/renders/opengl/r_map.pas index 86a69a1..c9a4d33 100644 --- a/src/game/renders/opengl/r_map.pas +++ b/src/game/renders/opengl/r_map.pas @@ -40,7 +40,7 @@ interface procedure r_Map_Update; - procedure r_Map_Draw (x, y, w, h, camx, camy: Integer; player: TPlayer); + procedure r_Map_Draw (x, y, w, h, camx, camy: Integer; player: TPlayer; out acx, acy: Integer); implementation @@ -1385,7 +1385,7 @@ implementation end; end; - procedure r_Map_Draw (x, y, w, h, camx, camy: Integer; player: TPlayer); + procedure r_Map_Draw (x, y, w, h, camx, camy: Integer; player: TPlayer; out acx, acy: Integer); var iter: TPanelGrid.Iter; p: PPanel; cx, cy, cw, ch, xx, yy, ww, hh, ml, mt, mr, mb, mcx, mcy: Integer; sx, sy, sw, sh: LongInt; l, t, r, b: Integer; begin r_Draw_GetRect(l, t, r, b); @@ -1415,6 +1415,9 @@ implementation cy := 0; end; + acx := cx; + acy := cy; + (* map bounds *) xx := cx; yy := cy; diff --git a/src/game/renders/opengl/r_render.pas b/src/game/renders/opengl/r_render.pas index 9fa586a..5a15b28 100644 --- a/src/game/renders/opengl/r_render.pas +++ b/src/game/renders/opengl/r_render.pas @@ -392,7 +392,7 @@ implementation end; procedure r_Render_DrawView (x, y, w, h: Integer; p: TPlayer); - var l, t, r, b, xx, yy: Integer; + var l, t, r, b, xx, yy, cx, cy: Integer; begin r_Draw_GetRect(l, t, r, b); r_Draw_SetRect(x, y, x + w, y + h); @@ -400,32 +400,32 @@ implementation r_Common_GetCameraPos(p, true, xx, yy); if p <> nil then begin + r_Map_Draw(x, y, w, h, xx, yy, p, cx, cy); {$IFDEF ENABLE_HOLMES} if p = gPlayer1 then begin - r_Holmes_plrViewPos(x, y); - r_Holmes_plrViewSize(w, h); + r_Holmes_plrViewPos(cx, cy); + r_Holmes_plrViewSize(h, w); end; {$ENDIF} - r_Map_Draw(x, y, w, h, xx, yy, p); r_Render_DrawStatsView(x, y, w, h, p); if p.Spectator and p.NoRespawn then r_Common_DrawText(_lc[I_PLAYER_SPECT4], x div 2 + w div 2, y div 2 + h div 2, 255, 255, 255, 255, stdfont, TBasePoint.BP_CENTER); end else begin - r_Map_Draw(x, y, w, h, xx, yy, nil); + r_Map_Draw(x, y, w, h, xx, yy, nil, cx, cy); end; r_Draw_SetRect(l, t, r, b); end; procedure r_Render_DrawMapView (x, y, w, h, camx, camy: Integer); - var l, t, r, b: Integer; + var l, t, r, b, cx, cy: Integer; begin r_Draw_GetRect(l, t, r, b); r_Draw_SetRect(x, y, x + w, y + h); - r_Map_Draw(x, y, w, h, camx, camy, nil); + r_Map_Draw(x, y, w, h, camx, camy, nil, cx, cy); r_Draw_SetRect(l, t, r, b); end;