So. This should fix ammo delays being off on a team that is resurrected later in the game, even up freezing delays a bit, prevent an infinite loop in freezing, and reduces fuel burn when adjusting freezer to one-fourth.
--- a/hedgewars/GSHandlers.inc Sun Apr 21 01:38:52 2013 +0200
+++ b/hedgewars/GSHandlers.inc Sun Apr 21 16:39:36 2013 -0400
@@ -5074,7 +5074,11 @@
Gear^.Tex := RenderStringTex(trmsg[sidFuel] + ': ' + inttostr(t) +
'%', cWhiteColor, fntSmall)
end;
- if GameTicks mod 10 = 0 then dec(Gear^.Health);
+ if Gear^.Message and (gmUp or gmDown) <> 0 then
+ begin
+ if GameTicks mod 40 = 0 then dec(Gear^.Health)
+ end
+ else if GameTicks mod 10 = 0 then dec(Gear^.Health);
end;
@@ -5119,8 +5123,9 @@
HHGear: PGear;
landRect: TSDL_Rect;
ndX, ndY: hwFloat;
- i, t, gX, gY: LongInt;
+ i, j, t, gX, gY: LongInt;
hogs: PGearArrayS;
+ vg: PVisualGear;
begin
HHGear := Gear^.Hedgehog^.Gear;
if (Gear^.Message and gmAttack <> 0) or (Gear^.Health = 0) or (HHGear = nil) or (HHGear^.Damage <> 0) then
@@ -5128,8 +5133,8 @@
DeleteGear(Gear);
AfterAttack;
exit
- end
- else if Gear^.Message and (gmUp or gmDown) = 0 then updateFuel(Gear);
+ end;
+ updateFuel(Gear);
with Gear^ do
begin
@@ -5197,6 +5202,21 @@
SetAllHHToActive;
Timer := iceWaitCollision;
end;
+(*
+ Any ideas for something that would look good here?
+ if (Target.X <> NoPointX) and ((Timer = iceCollideWithGround) or (Timer = iceCollideWithWater)) and (GameTicks mod max((groundFreezingTime-((GameTicks - Power)*2)),2) = 0) then //and CheckLandValue(Target.X, Target.Y, lfIce) then
+ begin
+ vg:= AddVisualGear(Target.X+random(20)-10, Target.Y+random(40)-10, vgtDust, 1);
+ if vg <> nil then
+ begin
+ i:= random(100) + 155;
+ vg^.Tint:= IceColor or $FF;
+ vg^.Angle:= random(360);
+ vg^.dx:= 0.001 * random(80);
+ vg^.dy:= 0.001 * random(80)
+ end
+ end;
+*)
// freeze nearby hogs
hogs := GearsNear(int2hwFloat(Target.X), int2hwFloat(Target.Y), gtHedgehog, Gear^.Radius*2);
@@ -5222,14 +5242,16 @@
X:= HHGear^.X;
Y:= HHGear^.Y
end;
- {if (gX > max(LAND_WIDTH,4096)*2) or
+ if (gX > max(LAND_WIDTH,4096)*2) or
(gX < -max(LAND_WIDTH,4096)) or
(gY < -max(LAND_HEIGHT,4096)) or
(gY > max(LAND_HEIGHT,4096)+512) then
- begin
- X:= HHGear^.X;
- Y:= HHGear^.Y
- end}
+ begin
+ //X:= HHGear^.X;
+ //Y:= HHGear^.Y
+ Target.X:= gX;
+ Target.Y:= gY;
+ end
end
end;
end;
--- a/hedgewars/uTeams.pas Sun Apr 21 01:38:52 2013 +0200
+++ b/hedgewars/uTeams.pas Sun Apr 21 16:39:36 2013 -0400
@@ -110,7 +110,7 @@
end;
procedure SwitchHedgehog;
-var c, i, j: LongWord;
+var c, i, t, j: LongWord;
PrevHH, PrevTeam : LongWord;
begin
TargetPoint.X:= NoPointX;
@@ -173,15 +173,7 @@
if c = ClansCount then
begin
if not PlacingHogs then
- begin
inc(TotalRounds);
- for i:= 0 to Pred(TeamsCount) do
- with TeamsArray[i]^ do
- for j:= 0 to Pred(HedgehogsNumber) do
- with Hedgehogs[j] do
- if Effects[heFrozen] > 255 then
- Effects[heFrozen]:= max(255,Effects[heFrozen]-50000)
- end;
c:= 0
end;
@@ -198,9 +190,20 @@
CurrHedgehog:= Succ(CurrHedgehog) mod HedgehogsNumber;
until ((Hedgehogs[CurrHedgehog].Gear <> nil) and (Hedgehogs[CurrHedgehog].Effects[heFrozen] = 0)) or (CurrHedgehog = PrevHH)
end
- until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (PrevTeam = CurrTeam) or ((CurrTeam = TagTeamIndex) and ((GameFlags and gfTagTeam) <> 0));
- end
-until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen] = 0);
+ until ((CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen] < 256)) or (PrevTeam = CurrTeam) or ((CurrTeam = TagTeamIndex) and ((GameFlags and gfTagTeam) <> 0))
+ end;
+ if (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear = nil) or (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen] > 255) then
+ begin
+ inc(CurrentTeam^.Clan^.TurnNumber);
+ with CurrentTeam^.Clan^ do
+ for t:= 0 to Pred(TeamsNumber) do
+ with Teams[t]^ do
+ for i:= 0 to Pred(HedgehogsNumber) do
+ with Hedgehogs[i] do
+ if Effects[heFrozen] > 255 then
+ Effects[heFrozen]:= max(255,Effects[heFrozen]-50000);
+ end;
+until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) and (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Effects[heFrozen] < 256);
SwitchCurrentHedgehog(@(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog]));
{$IFDEF USE_TOUCH_INTERFACE}