diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas
index 52c3b24890adb90e6ab452556ad93b65f220a654..42dfa8c8eae83811f7bb35f823ac7d7b47ea3e2d 100644 (file)
--- a/src/game/g_gfx.pas
+++ b/src/game/g_gfx.pas
ex: Integer;
begin
state := TPartState.Stuck;
ex: Integer;
begin
state := TPartState.Stuck;
- if (dX > 0) then stickDX := 1 else stickDX := -1;
+ if (dx > 0) then stickDX := 1 else stickDX := -1;
freeze();
// find next floor transition
findFloor();
freeze();
// find next floor transition
findFloor();
_done, _gravityagain, _stuckagain;
var
pan: TPanel;
_done, _gravityagain, _stuckagain;
var
pan: TPanel;
- dX, dY: SmallInt;
+ dx, dy: SmallInt;
ex, ey: Integer;
checkEnv: Boolean;
floorJustTraced: Boolean;
ex, ey: Integer;
checkEnv: Boolean;
floorJustTraced: Boolean;
oldFloorY: Integer;
{$ENDIF}
begin
oldFloorY: Integer;
{$ENDIF}
begin
- if not gpart_dbg_phys_enabled then goto _done;
+ if not gpart_dbg_phys_enabled then begin x += round(velX); y += round(velY); goto _done; end;
if gAdvBlood then
begin
if gAdvBlood then
begin
end;
// it is important to have it here
end;
// it is important to have it here
- dX := round(velX);
- dY := round(velY);
+ dx := round(velX);
+ dy := round(velY);
if (state = TPartState.Normal) then checkAirStreams();
if (state = TPartState.Normal) then checkAirStreams();
end;
// trace movement
end;
// trace movement
- if (dX <> 0) then
+ if (dx <> 0) then
begin
// has some horizontal velocity
begin
// has some horizontal velocity
- pan := g_Map_traceToNearest(x, y, x+dX, y+dY, GridTagObstacle, @ex, @ey);
+ pan := g_Map_traceToNearest(x, y, x+dx, y+dy, GridTagObstacle, @ex, @ey);
checkEnv := (x <> ex);
x := ex;
y := ey;
checkEnv := (x <> ex);
x := ex;
y := ey;
// we stuck
// the only case when we can have both ceiling and wall is corner; stick to wall in this case
// check if we stuck to a wall
// we stuck
// the only case when we can have both ceiling and wall is corner; stick to wall in this case
// check if we stuck to a wall
- if (dX < 0) then dX := -1 else dX := 1;
- if (g_Map_PanelAtPoint(x+dX, y, GridTagObstacle) <> nil) then
+ if (dx < 0) then dx := -1 else dx := 1;
+ if (g_Map_PanelAtPoint(x+dx, y, GridTagObstacle) <> nil) then
begin
// stuck to a wall
begin
// stuck to a wall
- stickToWall(dX);
+ stickToWall(dx);
end
else
begin
end
else
begin
end;
end;
end
end;
end;
end
- else if (dY <> 0) then
+ else if (dy <> 0) then
begin
// has only vertical velocity
begin
// has only vertical velocity
- if (dY < 0) then
+ if (dy < 0) then
begin
// flying up
if (ceilingY = Unknown) then findCeiling(); // need to do this anyway
begin
// flying up
if (ceilingY = Unknown) then findCeiling(); // need to do this anyway
- y += dY;
+ y += dy;
if (y <= ceilingY) then begin y := ceilingY; stickToCeiling(); end; // oops, hit a ceiling
// environment didn't changed
end
else
begin
if (y <= ceilingY) then begin y := ceilingY; stickToCeiling(); end; // oops, hit a ceiling
// environment didn't changed
end
else
begin
- while (dY > 0) do
+ while (dy > 0) do
begin
// falling down
floorJustTraced := (floorY = Unknown);
if floorJustTraced then findFloor();
if (floorType = TFloorType.LiquidOut) then env := TEnvType.ELiquid else env := TEnvType.EAir;
begin
// falling down
floorJustTraced := (floorY = Unknown);
if floorJustTraced then findFloor();
if (floorType = TFloorType.LiquidOut) then env := TEnvType.ELiquid else env := TEnvType.EAir;
- y += dY;
+ y += dy;
//e_LogWritefln('floorY=%s; newy=%s; dY=%s; floorType=%s', [floorY, y, dY, floorType]);
if (y >= floorY) then
begin
// floor transition
//e_LogWritefln('floorY=%s; newy=%s; dY=%s; floorType=%s', [floorY, y, dY, floorType]);
if (y >= floorY) then
begin
// floor transition
- dY := y-floorY;
+ dy := y-floorY;
y := floorY;
//e_LogWritefln(' HIT FLOORY: floorY=%s; newy=%s; dY=%s; floorType=%s', [floorY, y, dY, floorType]);
case floorType of
y := floorY;
//e_LogWritefln(' HIT FLOORY: floorY=%s; newy=%s; dY=%s; floorType=%s', [floorY, y, dY, floorType]);
case floorType of
else
begin
// simple blood
else
begin
// simple blood
- dX := round(velX);
- dY := round(velY);
- y += dY;
- x += dX;
+ dx := round(velX);
+ dy := round(velY);
+ y += dy;
+ x += dx;
if (g_Map_PanelAtPoint(x, y, GridTagObstacle) <> nil) then begin die(); exit; end;
end;
if (g_Map_PanelAtPoint(x, y, GridTagObstacle) <> nil) then begin die(); exit; end;
end;
// ////////////////////////////////////////////////////////////////////////// //
procedure TParticle.thinkerBubble ();
var
// ////////////////////////////////////////////////////////////////////////// //
procedure TParticle.thinkerBubble ();
var
- dY: Integer;
+ dy: Integer;
begin
begin
- dY := round(velY);
+ dy := round(velY);
- if (dY <> 0) then
+ if (dy <> 0) then
begin
begin
- y += dY;
- if (dY < 0) then
+ y += dy;
+ if (dy < 0) then
begin
if (y <= ceilingY) then begin die(); exit; end;
end
begin
if (y <= ceilingY) then begin die(); exit; end;
end
// tracer will return `false` if we started outside of the liquid
{$IF DEFINED(D2F_DEBUG_BUBBLES)}
// 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);
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]);
//
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);
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}
e_LogWritefln('g_Map_TraceLiquidNonPrecise: time=%s (%s); liquidTopY=%s', [Integer(stt), nptr, liquidTopY]);
if not nptr then continue;
{$ELSE}
label
_done;
var
label
_done;
var
- dX, dY: SmallInt;
+ dx, dy: SmallInt;
pan: TPanel;
ex, ey: Integer;
begin
pan: TPanel;
ex, ey: Integer;
begin
- if not gpart_dbg_phys_enabled then goto _done;
+ if not gpart_dbg_phys_enabled then begin x += round(velX); y += round(velY); goto _done; end;
- dX := round(velX);
- dY := round(velY);
+ dx := round(velX);
+ dy := round(velY);
+
+ //writeln('spark0: pos=(', x, ',', y, '); delta=(', dx, ',', dy, '); state=', state, '; ceilingY=', ceilingY, '; floorY=', floorY);
// apply gravity
if (abs(velX) < 0.1) and (abs(velY) < 0.1) then
// apply gravity
if (abs(velX) < 0.1) and (abs(velY) < 0.1) then
end;
// flying
end;
// flying
- if (dX <> 0) then
+ if (dx <> 0) then
begin
// has some horizontal velocity
begin
// has some horizontal velocity
- pan := g_Map_traceToNearest(x, y, x+dX, y+dY, (GridTagObstacle or GridTagLiquid), @ex, @ey);
+ pan := g_Map_traceToNearest(x, y, x+dx, y+dy, (GridTagObstacle or GridTagLiquid), @ex, @ey);
if (x <> ex) then begin floorY := Unknown; ceilingY := Unknown; end; // dunno yet
x := ex;
y := ey;
if (x <> ex) then begin floorY := Unknown; ceilingY := Unknown; end; // dunno yet
x := ex;
y := ey;
accelX := 0;
end;
end
accelX := 0;
end;
end
- else if (dY <> 0) then
+ else if (dy <> 0) then
begin
// has some vertical velocity
begin
// has some vertical velocity
- if (dY < 0) then
+ if (dy < 0) then
begin
// flying up
if (ceilingY = Unknown) then findCeiling(); // need to do this anyway
begin
// flying up
if (ceilingY = Unknown) then findCeiling(); // need to do this anyway
- y += dY;
+ y += dy;
if (y <= ceilingY) then
begin
// oops, hit a ceiling
if (y <= ceilingY) then
begin
// oops, hit a ceiling
begin
// falling down
if (floorY = Unknown) then findFloor(); // need to do this anyway
begin
// falling down
if (floorY = Unknown) then findFloor(); // need to do this anyway
- y += dY;
+ y += dy;
if (y >= floorY) then
begin
// hit something except a floor?
if (y >= floorY) then
begin
// hit something except a floor?
velY += accelY;
end;
velY += accelY;
end;
+ //writeln('spark1: pos=(', x, ',', y, '); delta=(', velX:6:3, ',', velY:6:3, '); state=', state, '; ceilingY=', ceilingY, '; floorY=', floorY);
+
time += 1;
end;
time += 1;
end;
if (Particles <> nil) then
begin
glDisable(GL_TEXTURE_2D);
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);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
begin
if (OnceAnims[a].Animation <> nil) then
begin
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;
end;
end;
end;