Fix throwing things off rope, also make throwing things a bit more generic and gear density dependent (so you can throw mines further, and also throw dynamite a little).
--- a/hedgewars/uGearsHandlersRope.pas Sat Aug 25 15:04:24 2012 -0400
+++ b/hedgewars/uGearsHandlersRope.pas Sat Aug 25 18:22:15 2012 -0400
@@ -76,8 +76,8 @@
procedure RopeDeleteMe(Gear, HHGear: PGear);
begin
PlaySound(sndRopeRelease);
- HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shr 3;
- HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shr 3;
+ HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue div Gear^.stepFreq;
+ HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue div Gear^.stepFreq;
with HHGear^ do
begin
Message := Message and (not gmAttack);
@@ -89,8 +89,6 @@
procedure RopeWaitCollision(Gear, HHGear: PGear);
begin
PlaySound(sndRopeRelease);
- HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue shr 3;
- HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue shr 3;
with HHGear^ do
begin
Message := Message and (not gmAttack);
@@ -98,7 +96,10 @@
end;
RopePoints.Count := 0;
Gear^.Elasticity := _0;
- Gear^.doStep := @doStepRopeAfterAttack
+ Gear^.doStep := @doStepRopeAfterAttack;
+ HHGear^.dX.QWordValue:= HHGear^.dX.QWordValue div Gear^.stepFreq;
+ HHGear^.dY.QWordValue:= HHGear^.dY.QWordValue div Gear^.stepFreq;
+ Gear^.stepFreq := 1
end;
procedure doStepRopeWork(Gear: PGear);
@@ -411,6 +412,7 @@
Gear^.Y := Gear^.Y + ty;
Gear^.Elasticity := tt;
Gear^.doStep := @doStepRopeWork;
+ Gear^.stepFreq:= 8;
PlaySound(sndRopeAttach);
with HHGear^ do
begin
@@ -441,6 +443,7 @@
else
begin
Gear^.doStep := @doStepRopeWork;
+ Gear^.stepFreq:= 8;
PlaySound(sndRopeAttach);
with HHGear^ do
begin
--- a/hedgewars/uGearsHedgehog.pas Sat Aug 25 15:04:24 2012 -0400
+++ b/hedgewars/uGearsHedgehog.pas Sat Aug 25 18:22:15 2012 -0400
@@ -234,9 +234,9 @@
and ((Gear^.Message and gmLJump) <> 0)
and ((Ammoz[CurAmmoType].Ammo.Propz and ammoprop_AltUse) <> 0) then
begin
- newDx:= dX / _2;
- newDy:= dY / _2;
- altUse:= true;
+ newDx:= dX / CurAmmoGear^.stepFreq;
+ newDy:= dY / CurAmmoGear^.stepFreq;
+ altUse:= true
end
else
begin
@@ -260,10 +260,7 @@
amPickHammer: newGear:= AddGear(hwRound(lx), hwRound(ly) + cHHRadius, gtPickHammer, 0, _0, _0, 0);
amSkip: ParseCommand('/skip', true);
amRope: newGear:= AddGear(hwRound(lx), hwRound(ly), gtRope, 0, xx, yy, 0);
- amMine: if altUse then
- newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, newDx, newDy, 3000)
- else
- newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
+ amMine: newGear:= AddGear(hwRound(lx) + hwSign(dX) * 7, hwRound(ly), gtMine, gstWait, SignAs(_0_02, dX), _0, 3000);
amSMine: newGear:= AddGear(hwRound(lx), hwRound(ly), gtSMine, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
amDEagle: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtDEagleShot, 0, xx * _0_5, yy * _0_5, 0);
amSineGun: newGear:= AddGear(hwRound(lx + xx * cHHRadius), hwRound(ly + yy * cHHRadius), gtSineGunShot, 0, xx * _0_5, yy * _0_5, 0);
@@ -360,6 +357,11 @@
amTardis: newGear:= AddGear(hwRound(X), hwRound(Y), gtTardis, 0, _0, _0, 5000);
amIceGun: newGear:= AddGear(hwRound(X), hwRound(Y), gtIceGun, 0, _0, _0, 0);
end;
+ if altUse then
+ begin
+ newGear^.dX:= newDx / newGear^.Density;
+ newGear^.dY:= newDY / newGear^.Density
+ end;
case CurAmmoType of
amGrenade, amMolotov,
--- a/hedgewars/uGearsList.pas Sat Aug 25 15:04:24 2012 -0400
+++ b/hedgewars/uGearsList.pas Sat Aug 25 18:22:15 2012 -0400
@@ -105,6 +105,7 @@
// Define ammo association, if any.
gear^.AmmoType:= GearKindAmmoTypeMap[Kind];
gear^.CollisionMask:= $FFFF;
+gear^.stepFreq:= 1;
if CurrentHedgehog <> nil then gear^.Hedgehog:= CurrentHedgehog;
@@ -230,7 +231,7 @@
gear^.Radius:= 2;
gear^.Elasticity:= _0_55;
gear^.Friction:= _0_995;
- gear^.Density:= _0_9;
+ gear^.Density:= _1;
if cMinesTime < 0 then
gear^.Timer:= getrandom(51)*100
else
@@ -242,7 +243,7 @@
gear^.Radius:= 2;
gear^.Elasticity:= _0_55;
gear^.Friction:= _0_995;
- gear^.Density:= _0_9;
+ gear^.Density:= _1_6;
gear^.Timer:= 500;
end;
gtCase: begin
--- a/hedgewars/uTypes.pas Sat Aug 25 15:04:24 2012 -0400
+++ b/hedgewars/uTypes.pas Sat Aug 25 18:22:15 2012 -0400
@@ -235,6 +235,7 @@
Kind: TGearType;
Pos: Longword;
doStep: TGearStepProcedure;
+ stepFreq: Longword;
Radius: LongInt;
Angle, Power : Longword;
DirAngle: real;