diff --git a/src/game/g_phys.pas b/src/game/g_phys.pas
index ce56afefa1612f45ed881936519955d5b3bc7a0e..81bdb78d6b095492405bb06c4afaf4d9601749d4 100644 (file)
--- a/src/game/g_phys.pas
+++ b/src/game/g_phys.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
*
* 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
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
interface
uses
interface
uses
- e_graphics;
+ r_graphics;
type
PObj = ^TObj;
type
PObj = ^TObj;
// this is purely visual change, it won't affect anything else
slopeUpLeft: Integer; // left to go
slopeFramesLeft: Integer; // frames left to go
// this is purely visual change, it won't affect anything else
slopeUpLeft: Integer; // left to go
slopeFramesLeft: Integer; // frames left to go
+ // for frame interpolation
+ oldX, oldY: Integer;
+ procedure lerp(t: Single; out fX, fY: Integer);
end;
const
end;
const
const
SmoothSlopeFrames = 4;
const
SmoothSlopeFrames = 4;
+procedure TObj.lerp(t: Single; out fX, fY: Integer);
+begin
+ fX := nlerp(oldX, X, t);
+ fY := nlerp(oldY, Y, t);
+end;
function g_Obj_StayOnStep(Obj: PObj): Boolean; inline;
begin
function g_Obj_StayOnStep(Obj: PObj): Boolean; inline;
begin
//writeln('velocity=(', Obj^.Vel.X, ',', Obj^.Vel.Y, '); acceleration=(', Obj^.Accel.X, ',', Obj^.Accel.Y, ')');
if (g_Obj_GetSpeedDirF(Obj, dirx, diry, speed)) then
begin
//writeln('velocity=(', Obj^.Vel.X, ',', Obj^.Vel.Y, '); acceleration=(', Obj^.Accel.X, ',', Obj^.Accel.Y, ')');
if (g_Obj_GetSpeedDirF(Obj, dirx, diry, speed)) then
begin
- if (speed > 4) then
+ //writeln('SPEED: ', speed);
+ if (speed > 5) then
begin
begin
- speed := speed/2.0;
+ speed := speed/1.4;
Obj^.Vel.X := round(dirx*speed);
Obj^.Vel.Y := round(diry*speed);
end;
Obj^.Vel.X := round(dirx*speed);
Obj^.Vel.Y := round(diry*speed);
end;
// acceleration
if (g_Obj_GetAccelDirF(Obj, dirx, diry, speed)) then
begin
// acceleration
if (g_Obj_GetAccelDirF(Obj, dirx, diry, speed)) then
begin
- if (speed > 4) then
+ if (speed > 5) then
begin
begin
- speed := speed/2.0;
+ speed := speed/1.4;
Obj^.Accel.X := round(dirx*speed);
Obj^.Accel.Y := round(diry*speed);
end;
Obj^.Accel.X := round(dirx*speed);
Obj^.Accel.Y := round(diry*speed);
end;