--- a/hedgewars/GSHandlers.inc Tue Jun 20 21:20:06 2006 +0000
+++ b/hedgewars/GSHandlers.inc Tue Jun 20 21:21:31 2006 +0000
@@ -171,10 +171,10 @@
begin
AllInactive:= false;
if Gear.dY < 0 then
- if TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
+ if TestCollisionY(Gear, -1) then Gear.dY:= 0;
if Gear.dY >=0 then
- if TestCollisionYwithGear(Gear, 1) then
+ if TestCollisionY(Gear, 1) then
begin
Gear.dY:= - Gear.dY * Gear.Elasticity;
if Gear.dY > - 0.001 then
@@ -508,7 +508,7 @@
Gear.Elasticity:= Gear.Elasticity + 1.0;
HHGear:= PHedgehog(Gear.Hedgehog)^.Gear;
if (HHGear.State and gstFalling) <> 0 then
- if HHTestCollisionYwithGear(HHGear, 1) then
+ if TestCollisionYwithGear(HHGear, 1) then
begin
HHGear.dY:= 0;
CheckHHDamage(HHGear);
--- a/hedgewars/HHHandlers.inc Tue Jun 20 21:20:06 2006 +0000
+++ b/hedgewars/HHHandlers.inc Tue Jun 20 21:21:31 2006 +0000
@@ -110,6 +110,7 @@
////////////////////////////////////////////////////////////////////////////////
procedure PickUp(HH, Gear: PGear);
begin
+Gear.Message:= gm_Destroy;
case Gear.Pos of
posCaseHealth: begin
inc(HH.Health, Gear.Health);
@@ -147,10 +148,7 @@
// check for case with ammo
t:= CheckGearNear(Gear, gtCase, 36, 36);
if t <> nil then
- begin
- t.Message:= gm_Destroy;
PickUp(Gear, t)
- end;
end;
if CurAmmoGear <> nil then
@@ -201,7 +199,7 @@
Gear.dY:= Gear.dY + cGravity;
if (Gear.dY < 0)and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
Gear.Y:= Gear.Y + Gear.dY;
- if (Gear.dY >= 0)and HHTestCollisionYwithGear(Gear, 1) then
+ if (Gear.dY >= 0)and TestCollisionYwithGear(Gear, 1) then
begin
CheckHHDamage(Gear);
if ((abs(Gear.dX) + abs(Gear.dY)) < 0.55)
@@ -226,11 +224,11 @@
if ((Gear.Message and gm_LJump )<>0) then
begin
Gear.Message:= 0;
- if not HHTestCollisionYwithGear(Gear, -1) then
+ if not TestCollisionYwithGear(Gear, -1) then
if not TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX)) then Gear.Y:= Gear.Y - 2 else
if not TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX)) then Gear.Y:= Gear.Y - 1;
if not (TestCollisionXwithGear(Gear, Sign(Gear.dX))
- or HHTestCollisionYwithGear(Gear, -1)) then
+ or TestCollisionYwithGear(Gear, -1)) then
begin
Gear.dY:= -0.15;
Gear.dX:= Sign(Gear.dX) * 0.15;
@@ -241,7 +239,7 @@
if ((Gear.Message and gm_HJump )<>0) then
begin
Gear.Message:= 0;
- if not HHTestCollisionYwithGear(Gear, -1) then
+ if not TestCollisionYwithGear(Gear, -1) then
begin
Gear.dY:= -0.20;
Gear.dX:= 0.0000001 * Sign(Gear.dX);
@@ -257,40 +255,40 @@
if TestCollisionXwithGear(Gear, Sign(Gear.dX)) then
begin
if not (TestCollisionXwithXYShift(Gear, 0, -6, Sign(Gear.dX))
- or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
+ or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
if not (TestCollisionXwithXYShift(Gear, 0, -5, Sign(Gear.dX))
- or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
+ or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
if not (TestCollisionXwithXYShift(Gear, 0, -4, Sign(Gear.dX))
- or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
+ or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
if not (TestCollisionXwithXYShift(Gear, 0, -3, Sign(Gear.dX))
- or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
+ or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
if not (TestCollisionXwithXYShift(Gear, 0, -2, Sign(Gear.dX))
- or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
+ or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
if not (TestCollisionXwithXYShift(Gear, 0, -1, Sign(Gear.dX))
- or HHTestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
+ or TestCollisionYwithGear(Gear, -1)) then Gear.Y:= Gear.Y - 1;
end;
if not TestCollisionXwithGear(Gear, Sign(Gear.dX)) then Gear.X:= Gear.X + Gear.dX;
SetAllHHToActive;
- if not HHTestCollisionYwithGear(Gear, 1) then
+ if not TestCollisionYwithGear(Gear, 1) then
begin
Gear.Y:= Gear.Y + 1;
- if not HHTestCollisionYwithGear(Gear, 1) then
+ if not TestCollisionYwithGear(Gear, 1) then
begin
Gear.Y:= Gear.Y + 1;
- if not HHTestCollisionYwithGear(Gear, 1) then
+ if not TestCollisionYwithGear(Gear, 1) then
begin
Gear.Y:= Gear.Y + 1;
- if not HHTestCollisionYwithGear(Gear, 1) then
+ if not TestCollisionYwithGear(Gear, 1) then
begin
Gear.Y:= Gear.Y + 1;
- if not HHTestCollisionYwithGear(Gear, 1) then
+ if not TestCollisionYwithGear(Gear, 1) then
begin
Gear.Y:= Gear.Y + 1;
- if not HHTestCollisionYwithGear(Gear, 1) then
+ if not TestCollisionYwithGear(Gear, 1) then
begin
Gear.Y:= Gear.Y + 1;
- if not HHTestCollisionYwithGear(Gear, 1) then
+ if not TestCollisionYwithGear(Gear, 1) then
begin
Gear.Y:= Gear.Y - 6;
Gear.dY:= 0;
@@ -310,9 +308,9 @@
procedure doStepHedgehogFree(Gear: PGear);
begin
//DeleteCI(Gear);
-if not HHTestCollisionYwithGear(Gear, 1) then
+if not TestCollisionYwithGear(Gear, 1) then
begin
- if (Gear.dY < 0) and HHTestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
+ if (Gear.dY < 0) and TestCollisionYwithGear(Gear, -1) then Gear.dY:= 0;
Gear.State:= Gear.State or gstFalling or gstMoving;
Gear.dY:= Gear.dY + cGravity
end else begin
--- a/hedgewars/uCollisions.pas Tue Jun 20 21:20:06 2006 +0000
+++ b/hedgewars/uCollisions.pas Tue Jun 20 21:21:31 2006 +0000
@@ -49,9 +49,9 @@
procedure AddGearCI(Gear: PGear);
procedure DeleteCI(Gear: PGear);
function CheckGearsCollision(Gear: PGear): PGearArray;
-function HHTestCollisionYwithGear(Gear: PGear; Dir: integer): boolean;
function TestCollisionXwithGear(Gear: PGear; Dir: integer): boolean;
function TestCollisionYwithGear(Gear: PGear; Dir: integer): boolean;
+function TestCollisionY(Gear: PGear; Dir: integer): boolean;
function TestCollisionXwithXYShift(Gear: PGear; ShiftX, ShiftY: integer; Dir: integer): boolean;
function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: integer; Dir: integer): boolean;
@@ -116,43 +116,13 @@
end;
end;
-function HHTestCollisionYwithGear(Gear: PGear; Dir: integer): boolean;
-var x, y, i: integer;
-begin
-Result:= false;
-y:= round(Gear.Y);
-if Dir < 0 then y:= y - Gear.Radius
- else y:= y + Gear.Radius;
-
-if ((y - Dir) and $FFFFFC00) = 0 then
- begin
- x:= round(Gear.X);
- if (((x - Gear.Radius) and $FFFFF800) = 0)and(Land[y - Dir, x - Gear.Radius] <> 0)
- or(((x + Gear.Radius) and $FFFFF800) = 0)and(Land[y - Dir, x + Gear.Radius] <> 0) then
- begin
- Result:= true;
- exit
- end
- end;
-
-if (y and $FFFFFC00) = 0 then
- begin
- x:= round(Gear.X) - Gear.Radius + 1;
- i:= x + Gear.Radius * 2 - 2;
- repeat
- if (x and $FFFFF800) = 0 then Result:= Land[y, x]<>0;
- inc(x)
- until (x > i) or Result
- end
-end;
-
function TestCollisionXwithGear(Gear: PGear; Dir: integer): boolean;
var x, y, i: integer;
begin
Result:= false;
x:= round(Gear.X);
-if Dir < 0 then x:= x - Gear.Radius - 1
- else x:= x + Gear.Radius + 1;
+if Dir < 0 then x:= x - Gear.Radius
+ else x:= x + Gear.Radius;
if (x and $FFFFF800) = 0 then
begin
y:= round(Gear.Y) - Gear.Radius + 1;
@@ -183,7 +153,7 @@
if (y and $FFFFFC00) = 0 then
begin
x:= round(Gear.X) - Gear.Radius + 1;
- i:= x + Gear.Radius * 2 - 2;
+ i:= x + Gear.Radius * 2 - 2;
repeat
if (x and $FFFFF800) = 0 then Result:= Land[y, x]<>0;
inc(x)
@@ -191,6 +161,24 @@
end
end;
+function TestCollisionY(Gear: PGear; Dir: integer): boolean;
+var x, y, i: integer;
+begin
+Result:= false;
+y:= round(Gear.Y);
+if Dir < 0 then y:= y - Gear.Radius
+ else y:= y + Gear.Radius;
+if (y and $FFFFFC00) = 0 then
+ begin
+ x:= round(Gear.X) - Gear.Radius + 1;
+ i:= x + Gear.Radius * 2 - 2;
+ repeat
+ if (x and $FFFFF800) = 0 then Result:= Land[y, x] = COLOR_LAND;
+ inc(x)
+ until (x > i) or Result;
+ end
+end;
+
function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: integer; Dir: integer): boolean;
begin
Gear.X:= Gear.X + ShiftX;
--- a/hedgewars/uGears.pas Tue Jun 20 21:20:06 2006 +0000
+++ b/hedgewars/uGears.pas Tue Jun 20 21:21:31 2006 +0000
@@ -73,11 +73,11 @@
procedure AssignHHCoords;
var CurAmmoGear: PGear = nil;
-
+ GearsList: PGear = nil;
+
implementation
uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics;
-var GearsList: PGear = nil;
- RopePoints: record
+var RopePoints: record
Count: Longword;
HookAngle: integer;
ar: array[0..300] of record
@@ -145,7 +145,7 @@
gtHedgehog: begin
Result.Radius:= cHHRadius;
Result.Elasticity:= 0.002;
- Result.Friction:= 0.999;
+ Result.Friction:= 0.9985;
Result.Angle:= cMaxAngle div 2;
end;
gtAmmo_Grenade: begin