Add hedgehog effect heArtillery, allows to set per-hedgehog artillery mode
Allowed effect values:
0 = not active
1 = permanently active
2 = termporarily active (sniper rifle)
--- a/ChangeLog.txt Wed Mar 07 20:27:42 2018 +0100
+++ b/ChangeLog.txt Wed Mar 07 22:47:55 2018 +0100
@@ -81,6 +81,7 @@
+ New call: HealHog(gearUid, healthBoost[, showMessage[, tint]]): Heal hedgehog with graphical effects and message
+ New call: SetTeamLabel(teamname[, label]): Set an arbitrary label for a team, will be displayed next to the team bar
+ New callback: onEndTurn(): Called at the end of a turn (when gears have settled)
+ + New hedgehog effect: heArtillery: Per-hedgehog artillery mode (can't walk). Values: 1 = permanently active. 2 = temporarily active (sniper rifle). 0 = not active
* AddAmmo now automatically unselects weapon if it would remove current ammo from current hedgehog
* Fix call: SetWeapon(amNothing) now unselects weapon
* Fix call: SetWind did not update flake flying direction
--- a/hedgewars/uAI.pas Wed Mar 07 20:27:42 2018 +0100
+++ b/hedgewars/uAI.pas Wed Mar 07 22:47:55 2018 +0100
@@ -288,7 +288,7 @@
AddAction(Actions, aia_Weapon, Longword(amSkip), 100 + random(200), 0, 0);
if ((CurrentHedgehog^.MultiShootAttacks = 0) or ((Ammoz[Me^.Hedgehog^.CurAmmoType].Ammo.Propz and ammoprop_NoMoveAfter) = 0))
- and (GameFlags and gfArtillery = 0) and (cGravityf <> 0) then
+ and (CurrentHedgehog^.Effects[heArtillery] = 0) and (cGravityf <> 0) then
begin
tmp:= random(2) + 1;
Push(0, Actions, Me^, tmp);
--- a/hedgewars/uGears.pas Wed Mar 07 20:27:42 2018 +0100
+++ b/hedgewars/uGears.pas Wed Mar 07 22:47:55 2018 +0100
@@ -515,8 +515,6 @@
cLaserSightingSniper:= false
end;
- if (GameFlags and gfArtillery) = 0 then
- cArtillery:= false;
// have to sweep *all* current team hedgehogs since it is theoretically possible if you have enough invulnerabilities and switch turns to make your entire team invulnerable
if (CurrentTeam <> nil) then
with CurrentTeam^ do
@@ -735,8 +733,6 @@
if (GameFlags and gfLaserSight) <> 0 then
cLaserSighting:= true;
-if (GameFlags and gfArtillery) <> 0 then
- cArtillery:= true;
for i:= (LAND_WIDTH*LAND_HEIGHT) div 524288+2 downto 0 do
begin
rx:= GetRandom(rightX-leftX)+leftX;
--- a/hedgewars/uGearsHandlersMess.pas Wed Mar 07 20:27:42 2018 +0100
+++ b/hedgewars/uGearsHandlersMess.pas Wed Mar 07 22:47:55 2018 +0100
@@ -1363,8 +1363,8 @@
begin
if (Gear^.Kind = gtSniperRifleShot) then
cLaserSightingSniper := false;
- if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and ((GameFlags and gfArtillery) = 0) then
- cArtillery := false;
+ if (Ammoz[Gear^.AmmoType].Ammo.NumPerTurn <= CurrentHedgehog^.MultiShootAttacks) and (CurrentHedgehog^.Effects[heArtillery] = 2) then
+ CurrentHedgehog^.Effects[heArtillery]:= 0;
// Bullet Hit
if ((Gear^.State and gstDrowning) = 0) and (hwRound(Gear^.X) and LAND_WIDTH_MASK = 0) and (hwRound(Gear^.Y) and LAND_HEIGHT_MASK = 0) then
@@ -1410,8 +1410,9 @@
shell: PVisualGear;
begin
- cArtillery := true;
HHGear := Gear^.Hedgehog^.Gear;
+ if (Gear^.Hedgehog^.Effects[heArtillery] <> 1) then
+ Gear^.Hedgehog^.Effects[heArtillery]:= 2;
if HHGear = nil then
begin
@@ -4860,7 +4861,7 @@
// let's save the HH's dX's direction so we can decide where the "top" of the portal hole
newPortal^.Elasticity.isNegative := CurrentHedgehog^.Gear^.dX.isNegative;
// when doing a backjump the dx is the opposite of the facing direction
- if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then
+ if ((Gear^.State and gstHHHJump) <> 0) and (Effects[heArtillery] = 0) then
newPortal^.Elasticity.isNegative := not newPortal^.Elasticity.isNegative;
// make portal gun look unloaded
--- a/hedgewars/uGearsHedgehog.pas Wed Mar 07 20:27:42 2018 +0100
+++ b/hedgewars/uGearsHedgehog.pas Wed Mar 07 22:47:55 2018 +0100
@@ -77,8 +77,8 @@
if (MultiShootAttacks > 0) then
begin
- if (CurAmmoType = amSniperRifle) and ((GameFlags and gfArtillery) = 0) then
- cArtillery := false;
+ if (Effects[heArtillery] = 2) then
+ Effects[heArtillery]:= 0;
if (Ammoz[CurAmmoType].Ammo.Propz and ammoprop_NoRoundEnd) = 0 then
begin
MultiShootAttacks:= Ammoz[CurAmmoType].Ammo.NumPerTurn;
@@ -270,7 +270,7 @@
lx:= X + int2hwfloat(round(GetLaunchX(CurAmmoType, hwSign(dX), Angle)));
ly:= Y + int2hwfloat(round(GetLaunchY(CurAmmoType, Angle)));
- if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then
+ if ((Gear^.State and gstHHHJump) <> 0) and (Effects[heArtillery] = 0) then
xx:= - xx;
if Ammoz[CurAmmoType].Ammo.AttackVoice <> sndNone then
AddVoice(Ammoz[CurAmmoType].Ammo.AttackVoice, CurrentTeam^.voicepack);
@@ -829,7 +829,7 @@
(TestCollisionYwithGear(Gear, -1) = 0) then
begin
Gear^.dY:= -_0_15;
- if not cArtillery then
+ if Gear^.Hedgehog^.Effects[heArtillery] = 0 then
Gear^.dX:= SignAs(_0_15, Gear^.dX);
Gear^.State:= Gear^.State or gstMoving or gstHHJumping;
PlaySoundV(sndJump1, Gear^.Hedgehog^.Team^.voicepack);
@@ -874,7 +874,7 @@
Gear^.Hedgehog^.visStepPos:= (Gear^.Hedgehog^.visStepPos + 1) and 7;
- if (not cArtillery or
+ if ((Gear^.Hedgehog^.Effects[heArtillery] = 0) or
((CurAmmoGear <> nil) and (CurAmmoGear^.Kind = gtBlowTorch))) and
((Gear^.Message and gmPrecise) = 0) then
MakeHedgehogsStep(Gear);
@@ -1043,7 +1043,7 @@
if (land and lfBouncy = 0) or (Gear^.State and gstCollision <> 0) then
begin
- if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery)
+ if ((Gear^.State and gstHHHJump) <> 0) and (Gear^.Hedgehog^.Effects[heArtillery] = 0)
and (Gear^.dX.QWordValue < _0_02.QWordValue) then
begin
if land and lfBouncy <> 0 then
@@ -1348,14 +1348,14 @@
begin
HHGear^.State:= HHGear^.State or gstHHHJump;
HHGear^.dY:= -_0_25;
- if not cArtillery then
+ if (Hedgehog^.Effects[heArtillery] = 0) then
HHGear^.dX:= -SignAs(_0_02, HHGear^.dX);
PlaySoundV(sndJump2, Hedgehog^.Team^.voicepack)
end;
HHGear^.Message:= HHGear^.Message and (not (gmLJump or gmHJump));
- if (not cArtillery) and wasJumping and (TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) <> 0) then
+ if (Hedgehog^.Effects[heArtillery] = 0) and wasJumping and (TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) <> 0) then
SetLittle(HHGear^.dX);
if Hedgehog^.Gear <> nil then
--- a/hedgewars/uGearsList.pas Wed Mar 07 20:27:42 2018 +0100
+++ b/hedgewars/uGearsList.pas Wed Mar 07 22:47:55 2018 +0100
@@ -315,6 +315,8 @@
if (GameFlags and gfAISurvival) <> 0 then
if gear^.Hedgehog^.BotLevel > 0 then
gear^.Hedgehog^.Effects[heResurrectable] := 1;
+ if (GameFlags and gfArtillery) <> 0 then
+ gear^.Hedgehog^.Effects[heArtillery] := 1;
// this would presumably be set in the frontend
// if we weren't going to do that yet, would need to reinit GetRandom
// oh, and, randomising slightly R and B might be nice too.
--- a/hedgewars/uGearsRender.pas Wed Mar 07 20:27:42 2018 +0100
+++ b/hedgewars/uGearsRender.pas Wed Mar 07 22:47:55 2018 +0100
@@ -279,7 +279,7 @@
curhat:= ChefHatTexture
else curhat:= HH^.HatTex;
m:= 1;
- if ((Gear^.State and gstHHHJump) <> 0) and (not cArtillery) then
+ if ((Gear^.State and gstHHHJump) <> 0) and (HH^.Effects[heArtillery] = 0) then
m:= -1;
sx:= ox + 1; // this offset is very common
sy:= oy - 3;
--- a/hedgewars/uTypes.pas Wed Mar 07 20:27:42 2018 +0100
+++ b/hedgewars/uTypes.pas Wed Mar 07 22:47:55 2018 +0100
@@ -229,7 +229,7 @@
PrevTexture, NextTexture: PTexture;
end;
- THogEffect = (heInvulnerable, heResurrectable, hePoisoned, heResurrected, heFrozen);
+ THogEffect = (heInvulnerable, heResurrectable, hePoisoned, heResurrected, heFrozen, heArtillery);
TScreenFade = (sfNone, sfInit, sfToBlack, sfFromBlack, sfToWhite, sfFromWhite);
--- a/hedgewars/uVariables.pas Wed Mar 07 20:27:42 2018 +0100
+++ b/hedgewars/uVariables.pas Wed Mar 07 22:47:55 2018 +0100
@@ -193,7 +193,6 @@
cLaserSighting : boolean;
cLaserSightingSniper : boolean;
cVampiric : boolean;
- cArtillery : boolean;
WeaponTooltipTex: PTexture;
AmmoMenuInvalidated: boolean;
AmmoRect : TSDL_Rect;
@@ -2823,7 +2822,6 @@
cLaserSighting := false;
cLaserSightingSniper := false;
cVampiric := false;
- cArtillery := false;
flagMakeCapture := false;
flagDumpLand := false;
bBetweenTurns := false;