diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas
index e75af88921d5fc2306767f98df5921c0241e76d2..01ada5245edcbb7606cfd4ffdd3f12af364719b6 100644 (file)
--- a/src/game/g_gfx.pas
+++ b/src/game/g_gfx.pas
-(* Copyright (C) DooM 2D:Forever Developers
+(* Copyright (C) Doom 2D: Forever Developers
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
implementation
uses
- g_map, g_panel, g_basic, Math, e_graphics, GL, GLExt,
+{$IFDEF USE_NANOGL}
+ nanoGL,
+{$ELSE}
+ GL, GLExt,
+{$ENDIF}
+ g_map, g_panel, g_basic, Math, e_graphics,
g_options, g_console, SysUtils, g_triggers, MAPDEF,
g_game, g_language, g_net, utils, xprofiler;
// tracer will return `false` if we started outside of the liquid
{$IF DEFINED(D2F_DEBUG_BUBBLES)}
- stt := curTimeMicro();
+ stt := getTimeMicro();
ptr := mapGrid.traceOrthoRayWhileIn(liquidx, liquidTopY, x, y, x, 0, GridTagWater or GridTagAcid1 or GridTagAcid2);
- stt := curTimeMicro()-stt;
+ stt := getTimeMicro()-stt;
e_LogWritefln('traceOrthoRayWhileIn: time=%s (%s); liquidTopY=%s', [Integer(stt), ptr, liquidTopY]);
//
- stt := curTimeMicro();
+ stt := getTimeMicro();
nptr := g_Map_TraceLiquidNonPrecise(x, y, 0, -8, liquidx, liquidTopY);
- stt := curTimeMicro()-stt;
+ stt := getTimeMicro()-stt;
e_LogWritefln('g_Map_TraceLiquidNonPrecise: time=%s (%s); liquidTopY=%s', [Integer(stt), nptr, liquidTopY]);
if not nptr then continue;
{$ELSE}
procedure g_GFX_Draw ();
-var
- a, len: Integer;
+ var
+ a, len: Integer;
+{$IFDEF USE_NANOGL}
+ type
+ PVertex = ^Vertex;
+ Vertex = record
+ x, y: GLfloat;
+ r, g, b, a: GLfloat;
+ end;
+ var
+ count: Integer;
+ v: PVertex;
+{$ENDIF}
begin
if not gpart_dbg_enabled then exit;
if (Particles <> nil) then
begin
glDisable(GL_TEXTURE_2D);
- glPointSize(2);
+ if (g_dbg_scale < 0.6) then glPointSize(1)
+ else if (g_dbg_scale > 1.3) then glPointSize(g_dbg_scale+1)
+ else glPointSize(2);
+ glDisable(GL_POINT_SMOOTH);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+{$IFDEF USE_NANOGL}
+ len := High(Particles);
+ v := GetMem(len * SizeOf(Vertex) + 1);
+ count := 0;
+ for a := 0 to len do
+ begin
+ with Particles[a] do
+ begin
+ if alive and (x >= sX) and (y >= sY) and (x <= sX + sWidth) and (sY <= sY + sHeight) then
+ begin
+ v[count].x := x + 0.37;
+ v[count].y := y + 0.37;
+ v[count].r := red / 255;
+ v[count].g := green / 255;
+ v[count].b := blue / 255;
+ v[count].a := alpha / 255;
+ Inc(count);
+ end;
+ end;
+ end;
+
+ glVertexPointer(2, GL_FLOAT, SizeOf(Vertex), @v.x);
+ glColorPointer(4, GL_FLOAT, SizeOf(Vertex), @v.r);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glEnableClientState(GL_COLOR_ARRAY);
+ glDisableClientState(GL_NORMAL_ARRAY);
+ glDisableClientState(GL_TEXTURE_COORD_ARRAY);
+ glDrawArrays(GL_POINTS, 0, count - 1);
+
+ Dispose(v);
+{$ELSE}
glBegin(GL_POINTS);
len := High(Particles);
end;
glEnd();
+{$ENDIF}
glDisable(GL_BLEND);
end;
begin
if (OnceAnims[a].Animation <> nil) then
begin
- with OnceAnims[a] do Animation.Draw(x, y, M_NONE);
+ with OnceAnims[a] do Animation.Draw(x, y, TMirrorType.None);
end;
end;
end;