diff --git a/src/game/g_gfx.pas b/src/game/g_gfx.pas
index d3cc071ad5f4a0a4c1598884ad276bb2176ac699..c365e662fe81db704f64ea09438007fcbd7bcc46 100644 (file)
--- a/src/game/g_gfx.pas
+++ b/src/game/g_gfx.pas
pan: TPanel;
dX, dY: SmallInt;
ex, ey: Integer;
pan: TPanel;
dX, dY: SmallInt;
ex, ey: Integer;
+ checkEnv: Boolean;
begin
if not gpart_dbg_phys_enabled then goto _done;
begin
if not gpart_dbg_phys_enabled then goto _done;
begin
// has some horizontal velocity
pan := g_Map_traceToNearest(x, y, x+dX, y+dY, GridTagObstacle, @ex, @ey);
begin
// has some horizontal velocity
pan := g_Map_traceToNearest(x, y, x+dX, y+dY, GridTagObstacle, @ex, @ey);
- if (x <> ex) then begin floorY := Unknown; ceilingY := Unknown; end; // dunno yet
+ checkEnv := (x <> ex);
x := ex;
y := ey;
x := ex;
y := ey;
+ if checkEnv then
+ begin
+ // dunno yet
+ floorY := Unknown;
+ ceilingY := Unknown;
+ // check environment (air/liquid)
+ if (g_Map_PanelAtPoint(x, y, GridTagLiquid) <> nil) then env := TEnvType.ELiquid else env := TEnvType.EAir;
+ end;
if (pan <> nil) then
begin
// we stuck
// the only case when we can have both ceiling and wall is corner; stick to wall in this case
if (pan <> nil) then
begin
// we stuck
// the only case when we can have both ceiling and wall is corner; stick to wall in this case
- // check environment (air/liquid)
- if (g_Map_PanelAtPoint(x, y, GridTagLiquid) <> nil) then env := TEnvType.ELiquid else env := TEnvType.EAir;
// 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
// 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
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
+ if (floorType = TFloorType.LiquidOut) then env := TEnvType.ELiquid else env := TEnvType.EAir;
y += dY;
//e_LogWritefln('floorY=%s; newy=%s; dY=%s; floorType=%s', [floorY, y, dY, floorType]);
if (y >= floorY) then
y += dY;
//e_LogWritefln('floorY=%s; newy=%s; dY=%s; floorType=%s', [floorY, y, dY, floorType]);
if (y >= floorY) then
time += 1;
if (liveTime <= 0) then begin die(); exit; end;
ex := 255-trunc(255.0*time/liveTime);
time += 1;
if (liveTime <= 0) then begin die(); exit; end;
ex := 255-trunc(255.0*time/liveTime);
- if (ex >= 250) then begin die(); exit; end;
- if (ex < 0) then ex := 0;
+ if (ex <= 10) then begin die(); exit; end;
+ if (ex > 250) then ex := 255;
alpha := Byte(ex);
end;
end
else
begin
alpha := Byte(ex);
end;
end
else
begin
- // water will disappear in water (?)
- if (env = TEnvType.ELiquid) then die();
+ // water will disappear in any liquid
+ if (env = TEnvType.ELiquid) then begin die(); exit; end;
time += 1;
time += 1;
+ // dry water
+ if (liveTime <= 0) then begin die(); exit; end;
+ ex := 255-trunc(255.0*time/liveTime);
+ if (ex <= 10) then begin die(); exit; end;
+ if (ex > 250) then ex := 255;
+ alpha := Byte(ex);
end;
end;
end;
end;
if (dX <> 0) then
begin
// has some horizontal velocity
if (dX <> 0) then
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 or GridTagLiquid), @ex, @ey);
if (x <> ex) then begin floorY := Unknown; ceilingY := Unknown; end; // dunno yet
x := ex;
y := ey;
if (pan <> nil) then
begin
if (x <> ex) then begin floorY := Unknown; ceilingY := Unknown; end; // dunno yet
x := ex;
y := ey;
if (pan <> nil) then
begin
+ if ((pan.tag and GridTagLiquid) <> 0) then begin die(); exit; end; // die in liquid
// hit the wall; falling down vertically
velX := 0;
accelX := 0;
// hit the wall; falling down vertically
velX := 0;
accelX := 0;
if alive and (x >= sX) and (y >= sY) and (x <= sX+sWidth) and (sY <= sY+sHeight) then
begin
glColor4ub(red, green, blue, alpha);
if alive and (x >= sX) and (y >= sY) and (x <= sX+sWidth) and (sY <= sY+sHeight) then
begin
glColor4ub(red, green, blue, alpha);
- glVertex2i(x, y);
+ glVertex2f(x+0.37, y+0.37);
end;
end;
end;
end;
end;
end;