index a1d781c5bf7f502aee87e3691457fa14f9c97657..eb69057102cc93d82fcbc59885aaac33f8a8acf7 100644 (file)
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
var
DebugCameraScale: Single;
+ FillOutsizeArea: Boolean;
SkyTexture: TGLTexture;
RenTextures: array of record
spec: LongInt;
end;
procedure r_Map_DrawParticles (x, y, w, h: Integer);
- var i, fx, fy: Integer;
+ var i, fx, fy: Integer; factor: Single;
begin
if gpart_dbg_enabled and (Particles <> nil) then
begin
r_Draw_EnableTexture2D(false);
- if (g_dbg_scale < 0.6) then
+ factor := r_pixel_scale * g_dbg_scale;
+ if factor < 0.6 then
glPointSize(1)
- else if (g_dbg_scale > 1.3) then
- glPointSize(g_dbg_scale + 1)
+ else if factor > 1.3 then
+ glPointSize(factor + 1)
else
glPointSize(2);
glDisable(GL_POINT_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ r_Draw_SetColor(255, 255, 255, 255);
glBegin(GL_POINTS);
for i := 0 to High(Particles) do
begin
end;
end;
glEnd;
+ r_Draw_SetColor(0, 0, 0, 255);
glDisable(GL_BLEND);
end;
end;
end;
- procedure r_Map_Draw (x, y, w, h, camx, camy: Integer; player: TPlayer);
- var iter: TPanelGrid.Iter; p: PPanel; cx, cy, cw, ch, xx, yy, ww, hh: Integer; sx, sy, sw, sh: LongInt; l, t, r, b: Integer;
+ 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);
- r_Draw_SetRect(x, y, x + w, y + h);
glTranslatef(x, y, 0);
(* camera rect *)
(* camera bounds *)
if g_dbg_ignore_bounds = false then
begin
- if cx + cw > gMapInfo.Width then
- cx := gMapInfo.Width - cw;
- if cy + ch > gMapInfo.Height then
- cy := gMapInfo.Height - ch;
- if cx < 0 then
+ if w > gMapInfo.Width then
+ cx := gMapInfo.Width div 2 - w div 2
+ else if cx + cw > gMapInfo.Width then
+ cx := gMapInfo.Width - cw
+ else if cx < 0 then
cx := 0;
- if cy < 0 then
+
+ if h > gMapInfo.Height then
+ cy := gMapInfo.Height div 2 - h div 2
+ else if cy + ch > gMapInfo.Height then
+ cy := gMapInfo.Height - ch
+ else if cy < 0 then
cy := 0;
end;
+ acx := cx;
+ acy := cy;
+
(* map bounds *)
xx := cx;
yy := cy;
if yy < 0 then
yy := 0;
+ (* view bounds *)
+ ml := x; mt := y; mr := x + w; mb := y + h;
+ if FillOutsizeArea and (DebugCameraScale = 1.0) then
+ begin
+ ml := MAX(cx + ml, 0) - cx;
+ mt := MAX(cy + mt, 0) - cy;
+ mr := MIN(cx + mr, gMapInfo.Width - 1) - cx;
+ mb := MIN(cy + mb, gMapInfo.Height - 1) - cy;
+ end;
+ r_Draw_SetRect(ml, mt, mr, mb);
+
plist.Clear;
iter := mapGrid.ForEachInAABB(xx, yy, ww, hh, GridDrawableMask);
for p in iter do
r_Map_DrawPanelType(PANEL_FORE);
// TODO draw monsters health bar
// TODO draw players health bar
+
+ r_Draw_SetRect(x, y, x + w, y + h);
+
if gGameSettings.GameMode <> GM_SINGLE then
r_Map_DrawPlayerIndicators(player, cx, cy, cw, ch);
if DebugCameraScale <> 1.0 then
initialization
conRegVar('r_debug_camera_scale', @DebugCameraScale, 0.0001, 1000.0, '', '');
+ conRegVar('r_gl_fill_outside', @FillOutsizeArea, '', '');
DebugCameraScale := 1.0;
+ FillOutsizeArea := true;
end.