--- a/hedgewars/GSHandlers.inc Wed Feb 07 14:11:47 2007 +0000
+++ b/hedgewars/GSHandlers.inc Wed Feb 07 17:27:32 2007 +0000
@@ -1014,30 +1014,32 @@
procedure doStepAirAttackWork(Gear: PGear);
begin
AllInactive:= false;
-Gear^.X:= Gear^.X + cAirPlaneSpeed;
+Gear^.X:= Gear^.X + Gear^.Tag * cAirPlaneSpeed;
if (Gear^.Health > 0)and( not (Gear^.X < Gear^.dX))and(Gear^.X < Gear^.dX + cAirPlaneSpeed) then
begin
dec(Gear^.Health);
case Gear^.State of
- 0: AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, cBombsSpeed, 0, 0);
- 1: AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine, 0, cBombsSpeed, 0, 0);
+ 0: AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.Tag * cBombsSpeed, 0, 0);
+ 1: AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtMine, 0, Gear^.Tag * cBombsSpeed, 0, 0);
end;
- Gear^.dX:= Gear^.dX + cBombsDistance
+ Gear^.dX:= Gear^.dX + Gear^.Tag * cBombsDistance
end;
-if Gear^.X > 3072 then DeleteGear(Gear)
+if (Gear^.X > 3072) or (Gear^.X < -1024) then DeleteGear(Gear)
end;
procedure doStepAirAttack(Gear: PGear);
var t: LongInt;
begin
AllInactive:= false;
-Gear^.X:= -1024;
+if Gear^.X.QWordValue = 0 then Gear^.Tag:= 1
+ else Gear^.Tag:= -1;
+Gear^.X:= 1024 - Gear^.Tag * 2048;
Gear^.Y:= -128;
Gear^.dX:= TargetPoint.X -
- cBombsDistance * 5 / 2;
+ Gear^.Tag * cBombsDistance * 5 / 2;
if TargetPoint.Y - Gear^.Y > 0 then
- Gear^.dX:= Gear^.dX - cBombsSpeed * hwSqrt(2 * (TargetPoint.Y - Gear^.Y) / cGravity);
+ Gear^.dX:= Gear^.dX - Gear^.Tag * cBombsSpeed * hwSqrt(2 * (TargetPoint.Y - Gear^.Y) / cGravity);
Gear^.Health:= 6;
Gear^.doStep:= @doStepAirAttackWork
end;
--- a/hedgewars/HHHandlers.inc Wed Feb 07 14:11:47 2007 +0000
+++ b/hedgewars/HHHandlers.inc Wed Feb 07 17:27:32 2007 +0000
@@ -48,8 +48,6 @@
StopSound(sndThrowPowerUp);
PlaySound(sndThrowRelease, false);
end;
-// xx:= hwSign(dX)*Sin(Angle*pi/cMaxAngle);
-// yy:= -Cos(Angle*pi/cMaxAngle);
xx:= AngleSin(Angle);
xx.isNegative:= dX.isNegative;
yy:= -AngleCos(Angle);
@@ -71,8 +69,8 @@
amBaseballBat: AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtShover, 0, xx * _0_5, yy * _0_5, 0)^.Radius:= 20;
amFirePunch: CurAmmoGear:= AddGear(hwRound(X) + hwSign(dX) * 10, hwRound(Y), gtFirePunch, 0, 0, 0, 0);
amParachute: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtParachute, 0, 0, 0, 0);
- amAirAttack: AddGear(0, 0, gtAirAttack, 0, 0, 0, 0);
- amMineStrike: AddGear(0, 0, gtAirAttack, 1, 0, 0, 0);
+ amAirAttack: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 0, 0, 0, 0);
+ amMineStrike: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 1, 0, 0, 0);
amBlowTorch: CurAmmoGear:= AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtBlowTorch, 0, hwSign(Gear^.dX) * _0_5, 0, 0);
end;
Power:= 0;
@@ -137,6 +135,19 @@
begin
if ((Gear^.State and (gstAttacking or gstMoving or gstFalling)) = 0) then
begin
+ if isCursorVisible then
+ with PHedgehog(Gear^.Hedgehog)^ do
+ with Ammo^[CurSlot, CurAmmo] do
+ begin
+ if (Gear^.Message and gm_Left )<>0 then
+ Pos:= (Pos + Ammoz[AmmoType].PosCount - 1) mod Ammoz[AmmoType].PosCount
+ else
+ if (Gear^.Message and gm_Right )<>0 then
+ Pos:= (Pos + 1) mod Ammoz[AmmoType].PosCount
+ else exit;
+ StepTicks:= 350;
+ exit
+ end;
if ((Gear^.Message and gm_LJump ) <> 0) then
begin
Gear^.Message:= 0;
--- a/hedgewars/uConsts.pas Wed Feb 07 14:11:47 2007 +0000
+++ b/hedgewars/uConsts.pas Wed Feb 07 17:27:32 2007 +0000
@@ -39,7 +39,7 @@
sprClusterBomb, sprClusterParticle, sprFlame, sprHorizont,
sprSky, sprAMBorders, sprAMSlot, sprAMSlotName, sprAMAmmos,
sprAMSlotKeys, sprAMSelection, sprFinger, sprAirBomb,
- sprAirplane);
+ sprAirplane, sprAmAirplane);
TGearType = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
@@ -76,6 +76,7 @@
Count: LongWord;
NumPerTurn: LongWord;
Timer: LongWord;
+ Pos: LongWord;
AmmoType: TAmmoType;
end;
@@ -306,7 +307,9 @@
(FileName: 'AirBomb'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
Width: 32; Height: 32; hasAlpha: false),// sprAirBomb
(FileName: 'Airplane'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
- Width: 125; Height: 42; hasAlpha: false) // sprAirplane
+ Width: 125; Height: 42; hasAlpha: false),// sprAirplane
+ (FileName:'amAirplane'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+ Width: 64; Height: 32; hasAlpha: true) // sprAmAirplane
);
Soundz: array[TSound] of record
FileName: String[31];
@@ -333,6 +336,8 @@
Slot: 0..cMaxSlotIndex;
TimeAfterTurn: Longword;
minAngle, maxAngle: Longword;
+ PosCount: Longword;
+ PosSprite: TSprite;
end = (
(NameId: sidGrenade;
Probability: 0;
@@ -342,11 +347,13 @@
Count: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 3000;
+ Pos: 0;
AmmoType: amGrenade);
Slot: 1;
TimeAfterTurn: 3000;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: 0;
+ PosCount: 1),
(NameId: sidClusterBomb;
Probability: 100;
NumberInCase: 3;
@@ -355,11 +362,13 @@
Count: 5;
NumPerTurn: 0;
Timer: 3000;
+ Pos: 0;
AmmoType: amClusterBomb);
Slot: 1;
TimeAfterTurn: 3000;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: 0;
+ PosCount: 1),
(NameId: sidBazooka;
Probability: 0;
NumberInCase: 1;
@@ -367,11 +376,13 @@
Count: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 0;
+ Pos: 0;
AmmoType: amBazooka);
Slot: 0;
TimeAfterTurn: 3000;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: 0;
+ PosCount: 1),
(NameId: sidUFO;
Probability: 100;
NumberInCase: 1;
@@ -380,11 +391,13 @@
Count: 2;
NumPerTurn: 0;
Timer: 0;
+ Pos: 0;
AmmoType: amUFO);
Slot: 0;
TimeAfterTurn: 3000;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: 0;
+ PosCount: 1),
(NameId: sidShotgun;
Probability: 0;
NumberInCase: 1;
@@ -392,11 +405,13 @@
Count: AMMO_INFINITE;
NumPerTurn: 1;
Timer: 0;
+ Pos: 0;
AmmoType: amShotgun);
Slot: 2;
TimeAfterTurn: 3000;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: 0;
+ PosCount: 1),
(NameId: sidPickHammer;
Probability: 0;
NumberInCase: 1;
@@ -407,11 +422,13 @@
Count: 2;
NumPerTurn: 0;
Timer: 0;
+ Pos: 0;
AmmoType: amPickHammer);
Slot: 6;
TimeAfterTurn: 0;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: 0;
+ PosCount: 1),
(NameId: sidSkip;
Probability: 0;
NumberInCase: 1;
@@ -419,11 +436,13 @@
Count: AMMO_INFINITE;
NumPerTurn: 0;
Timer: 0;
+ Pos: 0;
AmmoType: amSkip);
Slot: 8;
TimeAfterTurn: 0;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: 0;
+ PosCount: 1),
(NameId: sidRope;
Probability: 100;
NumberInCase: 3;
@@ -433,11 +452,13 @@
Count: 5;
NumPerTurn: 0;
Timer: 0;
+ Pos: 0;
AmmoType: amRope);
Slot: 7;
TimeAfterTurn: 0;
minAngle: 0;
- maxAngle: cMaxAngle div 2),
+ maxAngle: cMaxAngle div 2;
+ PosCount: 1),
(NameId: sidMine;
Probability: 100;
NumberInCase: 1;
@@ -445,11 +466,13 @@
Count: 2;
NumPerTurn: 0;
Timer: 0;
+ Pos: 0;
AmmoType: amMine);
Slot: 4;
TimeAfterTurn: 5000;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: 0;
+ PosCount: 1),
(NameId: sidDEagle;
Probability: 100;
NumberInCase: 2;
@@ -457,52 +480,60 @@
Count: 3;
NumPerTurn: 3;
Timer: 0;
+ Pos: 0;
AmmoType: amDEagle);
Slot: 2;
TimeAfterTurn: 3000;
minAngle: 0;
- maxAngle: 0),
- (NameId: sidDynamite;
+ maxAngle: 0;
+ PosCount: 1),
+ (NameId: sidDynamite;
Probability: 100;
NumberInCase: 1;
- Ammo: (Propz: ammoprop_NoCrosshair or
- ammoprop_AttackInJump or
- ammoprop_AttackInFall;
- Count: 1;
- NumPerTurn: 0;
- Timer: 0;
- AmmoType: amDynamite);
- Slot: 4;
- TimeAfterTurn: 5000;
+ Ammo: (Propz: ammoprop_NoCrosshair or
+ ammoprop_AttackInJump or
+ ammoprop_AttackInFall;
+ Count: 1;
+ NumPerTurn: 0;
+ Timer: 0;
+ Pos: 0;
+ AmmoType: amDynamite);
+ Slot: 4;
+ TimeAfterTurn: 5000;
minAngle: 0;
- maxAngle: 0),
- (NameId: sidFirePunch;
+ maxAngle: 0;
+ PosCount: 1),
+ (NameId: sidFirePunch;
Probability: 0;
NumberInCase: 1;
- Ammo: (Propz: ammoprop_NoCrosshair or
- ammoprop_ForwMsgs or
- ammoprop_AttackInJump or
- ammoprop_AttackInFall;
- Count: AMMO_INFINITE;
- NumPerTurn: 0;
- Timer: 0;
- AmmoType: amFirePunch);
- Slot: 3;
- TimeAfterTurn: 3000;
- minAngle: 0;
- maxAngle: 0),
- (NameId: sidBaseballBat;
+ Ammo: (Propz: ammoprop_NoCrosshair or
+ ammoprop_ForwMsgs or
+ ammoprop_AttackInJump or
+ ammoprop_AttackInFall;
+ Count: AMMO_INFINITE;
+ NumPerTurn: 0;
+ Timer: 0;
+ Pos: 0;
+ AmmoType: amFirePunch);
+ Slot: 3;
+ TimeAfterTurn: 3000;
+ MinAngle: 0;
+ maxAngle: 0;
+ PosCount: 1),
+ (NameId: sidBaseballBat;
Probability: 100;
NumberInCase: 1;
- Ammo: (Propz: 0;
- Count: 1;
- NumPerTurn: 0;
- Timer: 0;
- AmmoType: amBaseballBat);
- Slot: 3;
- TimeAfterTurn: 5000;
+ Ammo: (Propz: 0;
+ Count: 1;
+ NumPerTurn: 0;
+ Timer: 0;
+ Pos: 0;
+ AmmoType: amBaseballBat);
+ Slot: 3;
+ TimeAfterTurn: 5000;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: cMaxAngle div 2;
+ PosCount: 1),
(NameId: sidParachute;
Probability: 100;
NumberInCase: 1;
@@ -512,11 +543,13 @@
Count: 2;
NumPerTurn: 0;
Timer: 0;
+ Pos: 0;
AmmoType: amParachute);
Slot: 7;
TimeAfterTurn: 0;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: 0;
+ PosCount: 1),
(NameId: sidAirAttack;
Probability: 100;
NumberInCase: 1;
@@ -526,11 +559,14 @@
Count: 1;
NumPerTurn: 0;
Timer: 0;
+ Pos: 0;
AmmoType: amAirAttack);
Slot: 5;
TimeAfterTurn: 0;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: 0;
+ PosCount: 2;
+ PosSprite: sprAmAirplane),
(NameId: sidMineStrike;
Probability: 400;
NumberInCase: 1;
@@ -540,11 +576,14 @@
Count: 1;
NumPerTurn: 0;
Timer: 0;
+ Pos: 0;
AmmoType: amMineStrike);
Slot: 5;
TimeAfterTurn: 0;
minAngle: 0;
- maxAngle: 0),
+ maxAngle: 0;
+ PosCount: 2;
+ PosSprite: sprAmAirplane),
(NameId: sidBlowTorch;
Probability: 100;
NumberInCase: 2;
@@ -552,11 +591,13 @@
Count: 1;
NumPerTurn: 0;
Timer: 0;
+ Pos: 0;
AmmoType: amBlowTorch);
Slot: 6;
TimeAfterTurn: 3000;
minAngle: 768;
- maxAngle: 1280));
+ maxAngle: 1280;
+ PosCount: 1));
implementation
--- a/hedgewars/uGears.pas Wed Feb 07 14:11:47 2007 +0000
+++ b/hedgewars/uGears.pas Wed Feb 07 17:27:32 2007 +0000
@@ -598,7 +598,8 @@
gtCluster: DrawSprite(sprClusterParticle, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy, 0, Surface);
gtFlame: DrawSprite(sprFlame, hwRound(Gear^.X) - 8 + WorldDx, hwRound(Gear^.Y) - 8 + WorldDy,(GameTicks div 128 + Gear^.Angle) mod 8, Surface);
gtAirBomb: DrawSprite(sprAirBomb , hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 16 + WorldDy, DxDy2Angle32(Gear^.dY, Gear^.dX), Surface);
- gtAirAttack: DrawSprite(sprAirplane, hwRound(Gear^.X) - 60 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, 0, Surface);
+ gtAirAttack: if Gear^.Tag > 0 then DrawSprite(sprAirplane, hwRound(Gear^.X) - 60 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, 0, Surface)
+ else DrawSprite(sprAirplane, hwRound(Gear^.X) - 60 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, 1, Surface)
end;
Gear:= Gear^.NextGear
end;
--- a/hedgewars/uWorld.pas Wed Feb 07 14:11:47 2007 +0000
+++ b/hedgewars/uWorld.pas Wed Feb 07 17:27:32 2007 +0000
@@ -330,7 +330,21 @@
if (AMxCurr < cScreenWidth) or bShowAmmoMenu then ShowAmmoMenu(Surface);
// Cursor
-if isCursorVisible then DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (hwFloatTicks shr 6) mod 8, Surface);
+if isCursorVisible then
+ begin
+ if not bShowAmmoMenu then
+ with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do
+ if (Gear^.State and gstHHChooseTarget) <> 0 then
+ begin
+ i:= Ammo^[CurSlot, CurAmmo].Pos;
+ with Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType] do
+ if PosCount > 1 then
+ DrawSprite(PosSprite, CursorPoint.X - SpritesData[PosSprite].Width div 2,
+ CursorPoint.Y - SpritesData[PosSprite].Height div 2,
+ i, Surface);
+ end;
+ DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (hwFloatTicks shr 6) mod 8, Surface)
+ end;
{$IFDEF COUNTTICKS}
DXOutText(10, 10, fnt16, inttostr(cntTicks), Surface);
Binary file share/hedgewars/Data/Graphics/Airplane.png has changed
Binary file share/hedgewars/Data/Graphics/amAirplane.png has changed