X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Frenders%2Fopengl%2Fr_map.pas;h=86a69a11b85903f4cd83c81dee9eccef81d6c28a;hb=007ba24a2c0e0c07941679f415561c3cdf43cef2;hp=028c724541e5cd119949d364bef86ea4848e940d;hpb=203d8922aa34a34fb63e312691c711c419c34ae1;p=d2df-sdl.git diff --git a/src/game/renders/opengl/r_map.pas b/src/game/renders/opengl/r_map.pas index 028c724..86a69a1 100644 --- a/src/game/renders/opengl/r_map.pas +++ b/src/game/renders/opengl/r_map.pas @@ -236,6 +236,7 @@ implementation var DebugCameraScale: Single; + FillOutsizeArea: Boolean; SkyTexture: TGLTexture; RenTextures: array of record spec: LongInt; @@ -1113,7 +1114,7 @@ implementation begin if gpart_dbg_enabled and (Particles <> nil) then begin - glDisable(GL_TEXTURE_2D); + r_Draw_EnableTexture2D(false); if (g_dbg_scale < 0.6) then glPointSize(1) else if (g_dbg_scale > 1.3) then @@ -1124,6 +1125,7 @@ implementation 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 @@ -1132,10 +1134,11 @@ implementation fx := nlerp(Particles[i].oldX, Particles[i].x, gLerpFactor); fy := nlerp(Particles[i].oldY, Particles[i].y, gLerpFactor); glColor4ub(Particles[i].red, Particles[i].green, Particles[i].blue, Particles[i].alpha); - glVertex2f(fx, fy); + glVertex2i(fx, fy); end; end; glEnd; + r_Draw_SetColor(0, 0, 0, 255); glDisable(GL_BLEND); end; @@ -1383,10 +1386,9 @@ implementation 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; + 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 *) @@ -1398,13 +1400,18 @@ implementation (* 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; @@ -1422,6 +1429,17 @@ implementation 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 @@ -1473,6 +1491,9 @@ implementation 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 @@ -1502,5 +1523,7 @@ implementation initialization conRegVar('r_debug_camera_scale', @DebugCameraScale, 0.0001, 1000.0, '', ''); + conRegVar('r_gl_fill_outside', @FillOutsizeArea, '', ''); DebugCameraScale := 1.0; + FillOutsizeArea := true; end.