diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas
index 476f658d15175b28e911ee8b60e2dca69b6bcd0a..bf8fc5aa2fd8a5e4d90b3dbd8ca47cbfb13ecfaa 100644 (file)
--- a/src/game/g_gfx.pas
+++ b/src/game/g_gfx.pas
*
* 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * the Free Software Foundation, version 3 of the License ONLY.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
PParticle = ^TParticle;
TParticle = record
x, y: Integer;
+ oldX, oldY: Integer;
velX, velY: Single;
accelX, accelY: Single;
state: TPartState;
TOnceAnim = record
AnimType: Byte;
x, y: Integer;
+ oldX, oldY: Integer;
Animation: TAnimation;
end;
end;
begin
+ oldx := x;
+ oldy := y;
// awake sleeping particle, if necessary
if awakeDirty then
begin
begin
x := fX-devX1+Random(devX2);
y := fY-devY1+Random(devY2);
+ oldx := x;
+ oldy := y;
// check for level bounds
if (x < g_Map_MinX) or (y < g_Map_MinY) or (x > g_Map_MaxX) or (y > g_Map_MaxY) then continue;
accelY := 0.8;
end;
+ oldx := x;
+ oldy := y;
+
// check for level bounds
if (x < g_Map_MinX) or (y < g_Map_MinY) or (x > g_Map_MaxX) or (y > g_Map_MaxY) then continue;
begin
x := fX-devX1+Random(devX2);
y := fY-devY1+Random(devY2);
+ oldx := x;
+ oldy := y;
// check for level bounds
if (x < g_Map_MinX) or (y < g_Map_MinY) or (x > g_Map_MaxX) or (y > g_Map_MaxY) then continue;
begin
x := fX-devX1+Random(devX2);
y := fY-devY1+Random(devY2);
+ oldx := x;
+ oldy := y;
// check for level bounds
if (x < g_Map_MinX) or (y < g_Map_MinY) or (x > g_Map_MaxX) or (y > g_Map_MaxY) then continue;
begin
x := fX-devX1+Random(devX2);
y := fY-devY1+Random(devY2);
+ oldx := x;
+ oldy := y;
// check for level bounds
if (x < g_Map_MinX) or (y < g_Map_MinY) or (x > g_Map_MaxX) or (y > g_Map_MaxY) then continue;
for a := 0 to High(OnceAnims) do
if OnceAnims[a].Animation <> nil then
begin
+ OnceAnims[a].oldx := OnceAnims[a].x;
+ OnceAnims[a].oldy := OnceAnims[a].y;
+
case OnceAnims[a].AnimType of
ONCEANIM_SMOKE:
begin
procedure g_GFX_Draw ();
var
- a, len: Integer;
-{$IFDEF USE_NANOGL}
- type
- Vertex = record
- x, y: GLfloat;
- r, g, b, a: GLfloat;
- end;
- var
- count: Integer;
- v: array of Vertex;
-{$ENDIF}
+ a, len, fx, fy: Integer;
begin
if not gpart_dbg_enabled then exit;
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-{$IFDEF USE_NANOGL}
- count := 0;
- SetLength(v, Length(Particles));
- for a := 0 to High(Particles) 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[0].x);
- glColorPointer(4, GL_FLOAT, SizeOf(Vertex), @v[0].r);
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_COLOR_ARRAY);
- glDisableClientState(GL_NORMAL_ARRAY);
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDrawArrays(GL_POINTS, 0, count);
-{$ELSE}
glBegin(GL_POINTS);
len := High(Particles);
if not alive then continue;
if (x >= sX) and (y >= sY) and (x <= sX+sWidth) and (sY <= sY+sHeight) then
begin
+ fx := nlerp(oldx, x, gLerpFactor);
+ fy := nlerp(oldy, y, gLerpFactor);
glColor4ub(red, green, blue, alpha);
- glVertex2f(x+0.37, y+0.37);
+ glVertex2f(fx+0.37, fy+0.37);
end;
end;
end;
glEnd();
-{$ENDIF}
glDisable(GL_BLEND);
end;
begin
if (OnceAnims[a].Animation <> nil) then
begin
- with OnceAnims[a] do Animation.Draw(x, y, TMirrorType.None);
+ with OnceAnims[a] do
+ begin
+ fx := nlerp(oldx, x, gLerpFactor);
+ fy := nlerp(oldy, y, gLerpFactor);
+ Animation.Draw(x, y, TMirrorType.None);
+ end;
end;
end;
end;