Quick and dirty napalm implementation
authorunc0rr
Sat, 22 Nov 2008 14:39:14 +0000
changeset 1507 d18c67b7ad4c
parent 1506 a4ab75470ce1
child 1508 ef093f31ced1
Quick and dirty napalm implementation
QTfrontend/hwconsts.cpp.in
hedgewars/GSHandlers.inc
hedgewars/HHHandlers.inc
hedgewars/uAIAmmoTests.pas
hedgewars/uConsts.pas
--- a/QTfrontend/hwconsts.cpp.in	Fri Nov 21 21:47:51 2008 +0000
+++ b/QTfrontend/hwconsts.cpp.in	Sat Nov 22 14:39:14 2008 +0000
@@ -29,7 +29,7 @@
 QStringList * Themes;
 QStringList * mapList;
 
-QString * cDefaultAmmoStore = new QString("eammstore 939192942219912103223511100");
+QString * cDefaultAmmoStore = new QString("eammstore 9391929422199121032235111001");
 
 QColor * color1 = new QColor(  0, 255, 255);
 QColor * color2 = new QColor(255, 127, 127);
--- a/hedgewars/GSHandlers.inc	Fri Nov 21 21:47:51 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Sat Nov 22 14:39:14 2008 +0000
@@ -1240,6 +1240,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepAirAttackWork(Gear: PGear);
+var i: Longint;
 begin
 AllInactive:= false;
 Gear^.X:= Gear^.X + cAirPlaneSpeed * Gear^.Tag;
@@ -1250,6 +1251,8 @@
 	case Gear^.State of
 			0: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed * Gear^.Tag, _0, 0);
 			1: FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine,    0, cBombsSpeed * Gear^.Tag, _0, 0);
+			2: for i:= -17 to 17 do
+				FollowGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtFlame, 0, _0_01 * i, _0, 0);
 			end;
 	Gear^.dX:= Gear^.dX + int2hwFloat(30 * Gear^.Tag)
 	end;
@@ -1264,8 +1267,11 @@
 begin
 AllInactive:= false;
 
-if Gear^.X.QWordValue = 0 then Gear^.Tag:=  1
-                          else Gear^.Tag:= -1;
+if Gear^.X.QWordValue = 0 then
+	Gear^.Tag:=  1
+else
+	Gear^.Tag:= -1;
+
 Gear^.X:= _1024 - _2048 * Gear^.Tag;
 Gear^.Y:= -_300;
 Gear^.dX:= int2hwFloat(TargetPoint.X - 5 * Gear^.Tag * 15);
--- a/hedgewars/HHHandlers.inc	Fri Nov 21 21:47:51 2008 +0000
+++ b/hedgewars/HHHandlers.inc	Sat Nov 22 14:39:14 2008 +0000
@@ -169,6 +169,7 @@
                     amSeduction: CurAmmoGear:= AddGear(hwRound(X + xx * cHHRadius * 2), hwRound(Y + yy * cHHRadius * 2), gtSeduction, 0, xx * _0_4, yy * _0_4, 0);
                    amWatermelon: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtWatermelon,  0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, Ammo^[CurSlot, CurAmmo].Timer);
                   amHellishBomb: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtHellishBomb,    0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 5000);
+                       amNapalm: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 2, _0, _0, 0);
                   end;
 
         uStats.AmmoUsed(Ammo^[CurSlot, CurAmmo].AmmoType);
--- a/hedgewars/uAIAmmoTests.pas	Fri Nov 21 21:47:51 2008 +0000
+++ b/hedgewars/uAIAmmoTests.pas	Sat Nov 22 14:39:14 2008 +0000
@@ -22,11 +22,11 @@
 const amtest_OnTurn = $00000001;
 
 type TAttackParams = record
-                     Time: Longword;
-                     Angle, Power: LongInt;
-                     ExplX, ExplY, ExplR: LongInt;
-                     AttackPutX, AttackPutY: LongInt;
-                     end;
+			Time: Longword;
+			Angle, Power: LongInt;
+			ExplX, ExplY, ExplR: LongInt;
+			AttackPutX, AttackPutY: LongInt;
+			end;
 
 function TestBazooka(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
 function TestGrenade(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
@@ -38,41 +38,42 @@
 function TestAirAttack(Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
 
 type TAmmoTestProc = function (Me: PGear; Targ: TPoint; Level: LongInt; var ap: TAttackParams): LongInt;
-     TAmmoTest = record
-                 proc: TAmmoTestProc;
-                 flags: Longword;
-                 end;
+	TAmmoTest = record
+			proc: TAmmoTestProc;
+			flags: Longword;
+			end;
 
 const AmmoTests: array[TAmmoType] of TAmmoTest =
-                 (
-                  (proc: @TestGrenade;     flags: 0), // amGrenade
-                  (proc: nil;              flags: 0), // amClusterBomb
-                  (proc: @TestBazooka;     flags: 0), // amBazooka
-                  (proc: nil;              flags: 0), // amUFO
-                  (proc: @TestShotgun;     flags: 0), // amShotgun
-                  (proc: nil;              flags: 0), // amPickHammer
-                  (proc: nil;              flags: 0), // amSkip
-                  (proc: nil;              flags: 0), // amRope
-                  (proc: nil;              flags: 0), // amMine
-                  (proc: @TestDesertEagle; flags: 0), // amDEagle
-                  (proc: nil;              flags: 0), // amDynamite
-                  (proc: @TestFirePunch;   flags: 0), // amFirePunch
-                  (proc: nil;              flags: 0), // amWhip
-                  (proc: @TestBaseballBat; flags: 0), // amBaseballBat
-                  (proc: nil;              flags: 0), // amParachute
-                  (proc: @TestAirAttack;   flags: amtest_OnTurn), // amAirAttack
-                  (proc: nil;              flags: 0), // amMineStrike
-                  (proc: nil;              flags: 0), // amBlowTorch
-                  (proc: nil;              flags: 0), // amGirder
-                  (proc: nil;              flags: amtest_OnTurn), // amTeleport
-                  (proc: nil;              flags: 0), // amSwitch
-                  (proc: @TestMortar;      flags: 0), // amMortar
-                  (proc: nil;              flags: 0), // amKamikaze
-                  (proc: nil;              flags: 0), // amCake
-                  (proc: nil;              flags: 0), // amSeduction
-                  (proc: nil;              flags: 0), // amBanana
-                  (proc: nil;              flags: 0)  // amHellishBomb
-                  );
+			(
+			(proc: @TestGrenade;     flags: 0), // amGrenade
+			(proc: nil;              flags: 0), // amClusterBomb
+			(proc: @TestBazooka;     flags: 0), // amBazooka
+			(proc: nil;              flags: 0), // amUFO
+			(proc: @TestShotgun;     flags: 0), // amShotgun
+			(proc: nil;              flags: 0), // amPickHammer
+			(proc: nil;              flags: 0), // amSkip
+			(proc: nil;              flags: 0), // amRope
+			(proc: nil;              flags: 0), // amMine
+			(proc: @TestDesertEagle; flags: 0), // amDEagle
+			(proc: nil;              flags: 0), // amDynamite
+			(proc: @TestFirePunch;   flags: 0), // amFirePunch
+			(proc: nil;              flags: 0), // amWhip
+			(proc: @TestBaseballBat; flags: 0), // amBaseballBat
+			(proc: nil;              flags: 0), // amParachute
+			(proc: @TestAirAttack;   flags: amtest_OnTurn), // amAirAttack
+			(proc: nil;              flags: 0), // amMineStrike
+			(proc: nil;              flags: 0), // amBlowTorch
+			(proc: nil;              flags: 0), // amGirder
+			(proc: nil;              flags: amtest_OnTurn), // amTeleport
+			(proc: nil;              flags: 0), // amSwitch
+			(proc: @TestMortar;      flags: 0), // amMortar
+			(proc: nil;              flags: 0), // amKamikaze
+			(proc: nil;              flags: 0), // amCake
+			(proc: nil;              flags: 0), // amSeduction
+			(proc: nil;              flags: 0), // amBanana
+			(proc: nil;              flags: 0), // amHellishBomb
+			(proc: nil;              flags: 0)  // amNapalm
+			);
 
 const BadTurn = Low(LongInt) div 4;
 
--- a/hedgewars/uConsts.pas	Fri Nov 21 21:47:51 2008 +0000
+++ b/hedgewars/uConsts.pas	Sat Nov 22 14:39:14 2008 +0000
@@ -81,7 +81,7 @@
 			amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch, amWhip,
 			amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch,
 			amGirder, amTeleport, amSwitch, amMortar, amKamikaze, amCake,
-			amSeduction, amWatermelon, amHellishBomb);
+			amSeduction, amWatermelon, amHellishBomb, amNapalm);
 
 	THWFont = (fnt16, fntBig, fntSmall);
 
@@ -1057,7 +1057,28 @@
 			isDamaging: true;
 			SkipTurns: 0;
 			PosCount: 1;
-			PosSprite: sprWater)
+			PosSprite: sprWater),
+			(NameId: sidAirAttack;
+			NameTex: nil;
+			Probability: 100;
+			NumberInCase: 1;
+			Ammo: (Propz: ammoprop_NoCrosshair or
+							ammoprop_NeedTarget or
+							ammoprop_AttackingPut or
+							ammoprop_DontHold;
+					Count: 1;
+					NumPerTurn: 0;
+					Timer: 0;
+					Pos: 0;
+					AmmoType: amNapalm);
+			Slot: 5;
+			TimeAfterTurn: 0;
+			minAngle: 0;
+			maxAngle: 0;
+			isDamaging: true;
+			SkipTurns: 0;
+			PosCount: 2;
+			PosSprite: sprAmAirplane)
 			);
 
 var CountTexz: array[1..9] of PTexture;