--- a/hedgewars/CCHandlers.inc Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/CCHandlers.inc Sun Jun 03 17:21:57 2007 +0000
@@ -53,7 +53,7 @@
if isDeveloperMode then
begin
inc(TeamsCount);
- ParseCommand('ammstore 9391929422191210332', true);
+ ParseCommand('ammstore 93919294221912103323', true);
TryDo(TeamsCount <= 5, 'Too many teams', true);
AddTeam
end;
--- a/hedgewars/CMakeLists.txt Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/CMakeLists.txt Sun Jun 03 17:21:57 2007 +0000
@@ -69,7 +69,7 @@
message("Minimum required version of FreePascal is 1.9.4")
else (fpc_ver LESS "010904")
set(pascal_compiler ${fpc_executable})
- set(pascal_compiler_flags ${noexecstack_flags} "-B" "-FE../bin" "-Cs2000000" "-O2" ${hwengine_project})
+ set(pascal_compiler_flags ${noexecstack_flags} "-B" "-FE../bin" "-Cs2000000" "-vwi" "-O2" ${hwengine_project})
endif (fpc_ver LESS "010904")
endif (fpc_version)
--- a/hedgewars/GSHandlers.inc Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/GSHandlers.inc Sun Jun 03 17:21:57 2007 +0000
@@ -547,7 +547,7 @@
State:= State or gstFalling;
end;
DeleteGear(Gear);
- OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^.Ammo);
+ OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^);
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^)
end;
@@ -1028,7 +1028,7 @@
DeleteGear(Gear);
if Gear^.Timer > 10 then
begin
- OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^.Ammo);
+ OnUsedAmmo(PHedgehog(HHGear^.Hedgehog)^);
ApplyAmmoChanges(PHedgehog(HHGear^.Hedgehog)^)
end;
exit
@@ -1162,3 +1162,66 @@
end;
TargetPoint.X:= NoPointX
end;
+
+////////////////////////////////////////////////////////////////////////////////
+procedure doStepSwitcherWork(Gear: PGear);
+var HHGear: PGear;
+ Team: PTeam;
+ th: LongInt;
+ Msg, State: Longword;
+begin
+AllInactive:= false;
+
+if (Gear^.Message and not gm_Switch) <> 0 then
+ begin
+ HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+ Msg:= Gear^.Message and not gm_Switch;
+ DeleteGear(Gear);
+ OnUsedAmmo(PHedgehog(Gear^.Hedgehog)^);
+
+ HHGear:= CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear;
+ ApplyAmmoChanges(PHedgehog(Gear^.Hedgehog)^);
+ HHGear^.Message:= Msg;
+ exit
+ end;
+
+if (Gear^.Message and gm_Switch) <> 0 then
+ begin
+ HHGear:= CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear;
+ HHGear^.Message:= HHGear^.Message and not gm_Switch;
+ State:= HHGear^.State;
+ HHGear^.State:= 0;
+ HHGear^.Active:= false;
+ HHGear^.Z:= cHHZ;
+ RemoveGearFromList(HHGear);
+ InsertGearToList(HHGear);
+
+ th:= CurrentTeam^.CurrHedgehog;
+ repeat
+ CurrentTeam^.CurrHedgehog:= Succ(CurrentTeam^.CurrHedgehog) mod (cMaxHHIndex + 1);
+ until (CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear <> nil) or (Gear^.Pos = th);
+
+ HHGear:= CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog].Gear;
+ HHGear^.State:= State;
+ HHGear^.Active:= true;
+ FollowGear:= HHGear;
+ HHGear^.Z:= cCurrHHZ;
+ RemoveGearFromList(HHGear);
+ InsertGearToList(HHGear);
+ Gear^.X:= HHGear^.X;
+ Gear^.Y:= HHGear^.Y
+ end;
+end;
+
+procedure doStepSwitcher(Gear: PGear);
+var HHGear: PGear;
+begin
+Gear^.doStep:= @doStepSwitcherWork;
+
+HHGear:= PHedgehog(Gear^.Hedgehog)^.Gear;
+with HHGear^ do
+ begin
+ State:= State and not gstAttacking;
+ Message:= Message and not gm_Attack
+ end
+end;
--- a/hedgewars/HHHandlers.inc Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/HHHandlers.inc Sun Jun 03 17:21:57 2007 +0000
@@ -73,6 +73,7 @@
amBlowTorch: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBlowTorch, 0, SignAs(_0_5, dX), _0, 0);
amGirder: CurAmmoGear:= AddGear(0, 0, gtGirder, Ammo^[CurSlot, CurAmmo].Pos, _0, _0, 0);
amTeleport: CurAmmoGear:= AddGear(0, 0, gtTeleport, 0, _0, _0, 0);
+ amSwitch: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtSwitcher, 0, _0, _0, 0);
end;
Power:= 0;
if CurAmmoGear <> nil then
@@ -99,7 +100,7 @@
else begin
TurnTimeLeft:= Ammoz[Ammo^[CurSlot, CurAmmo].AmmoType].TimeAfterTurn;
State:= State or gstAttacked;
- OnUsedAmmo(Ammo)
+ OnUsedAmmo(CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog])
end;
AttackBar:= 0;
end
--- a/hedgewars/uAIAmmoTests.pas Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/uAIAmmoTests.pas Sun Jun 03 17:21:57 2007 +0000
@@ -48,7 +48,8 @@
{amMineStrike} nil,
{amBlowTorch} nil,
{amGirder} nil,
-{amTeleport} nil
+{amTeleport} nil,
+{amSwitch} nil
);
const BadTurn = Low(LongInt) div 4;
--- a/hedgewars/uAmmos.pas Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/uAmmos.pas Sun Jun 03 17:21:57 2007 +0000
@@ -18,20 +18,18 @@
unit uAmmos;
interface
-uses uConsts;
+uses uConsts, uTeams;
{$INCLUDE options.inc}
-type PHHAmmo = ^THHAmmo;
- THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo;
procedure AddAmmoStore(s: shortstring);
procedure AssignStores;
procedure AddAmmo(Hedgehog: pointer; ammo: TAmmoType);
function HHHasAmmo(Hedgehog: pointer; Ammo: TAmmoType): boolean;
procedure PackAmmo(Ammo: PHHAmmo; Slot: LongInt);
-procedure OnUsedAmmo(Ammo: PHHAmmo);
+procedure OnUsedAmmo(var Hedgehog: THedgehog);
implementation
-uses uMisc, uTeams, uGears;
+uses uMisc, uGears;
type TAmmoCounts = array[TAmmoType] of Longword;
var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
StoreCnt: Longword = 0;
@@ -130,10 +128,12 @@
until not b;
end;
-procedure OnUsedAmmo(Ammo: PHHAmmo);
+procedure OnUsedAmmo(var Hedgehog: THedgehog);
var s, a: Longword;
+ Ammo: PHHAmmo;
begin
-with CurrentTeam^.Hedgehogs[CurrentTeam^.CurrHedgehog] do
+Ammo:= Hedgehog.Ammo;
+with Hedgehog do
begin
if CurAmmoGear = nil then begin s:= CurSlot; a:= CurAmmo end
else begin s:= AltSlot; a:= AltAmmo end;
--- a/hedgewars/uConsts.pas Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/uConsts.pas Sun Jun 03 17:21:57 2007 +0000
@@ -39,7 +39,8 @@
sprClusterBomb, sprClusterParticle, sprFlame, sprHorizont,
sprSky, sprAMBorders, sprAMSlot, sprAMSlotName, sprAMAmmos,
sprAMSlotKeys, sprAMSelection, sprFinger, sprAirBomb,
- sprAirplane, sprAmAirplane, sprAmGirder, sprHHTelepMask);
+ sprAirplane, sprAmAirplane, sprAmGirder, sprHHTelepMask,
+ sprSwitch);
TGearType = (gtCloud, gtAmmo_Bomb, gtHedgehog, gtAmmo_Grenade, gtHealthTag,
gtGrave, gtUFO, gtShotgunShot, gtPickHammer, gtRope,
@@ -47,7 +48,7 @@
gtTeamHealthSorter, gtClusterBomb, gtCluster, gtShover, gtFlame,
gtFirePunch, gtATStartGame, gtATSmoothWindCh, gtATFinishGame,
gtParachute, gtAirAttack, gtAirBomb, gtBlowTorch, gtGirder,
- gtTeleport, gtSmallDamage);
+ gtTeleport, gtSmallDamage, gtSwitcher);
TGearsType = set of TGearType;
@@ -58,7 +59,7 @@
TAmmoType = (amGrenade, amClusterBomb, amBazooka, amUFO, amShotgun, amPickHammer,
amSkip, amRope, amMine, amDEagle, amDynamite, amFirePunch,
amBaseballBat, amParachute, amAirAttack, amMineStrike, amBlowTorch,
- amGirder, amTeleport);
+ amGirder, amTeleport, amSwitch);
THWFont = (fnt16, fntBig, fntSmall);
@@ -325,7 +326,9 @@
(FileName: 'amGirder'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
Width: 160; Height:160; hasAlpha: false),// sprAmGirder
(FileName: 'hhMask'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
- Width: 32; Height: 32; hasAlpha: false) // sprHHTelepMask
+ Width: 32; Height: 32; hasAlpha: false),// sprHHTelepMask
+ (FileName: 'Switch'; Path: ptGraphics; AltPath: ptNone; Surface: nil;
+ Width: 32; Height: 32; hasAlpha: false) // sprSwitch
);
Soundz: array[TSound] of record
FileName: String[31];
@@ -664,6 +667,22 @@
minAngle: 0;
maxAngle: 0;
PosCount: 1;
+ PosSprite: sprWater),
+ (NameId: sidSwitch;
+ Probability: 100;
+ NumberInCase: 1;
+ Ammo: (Propz: ammoprop_ForwMsgs or
+ ammoprop_NoCrosshair;
+ Count: 3;
+ NumPerTurn: 0;
+ Timer: 0;
+ Pos: 0;
+ AmmoType: amSwitch);
+ Slot: 8;
+ TimeAfterTurn: 0;
+ minAngle: 0;
+ maxAngle: 0;
+ PosCount: 1;
PosSprite: sprWater));
implementation
--- a/hedgewars/uGears.pas Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/uGears.pas Sun Jun 03 17:21:57 2007 +0000
@@ -129,7 +129,8 @@
@doStepBlowTorch,
@doStepGirder,
@doStepTeleport,
- @doStepHealthTag
+ @doStepHealthTag,
+ @doStepSwitcher
);
procedure InsertGearToList(Gear: PGear);
@@ -590,7 +591,8 @@
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: 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)
+ else DrawSprite(sprAirplane, hwRound(Gear^.X) - 60 + WorldDx, hwRound(Gear^.Y) - 25 + WorldDy, 1, Surface);
+ gtSwitcher: DrawSprite(sprSwitch, hwRound(Gear^.X) - 16 + WorldDx, hwRound(Gear^.Y) - 56 + WorldDy, 0, Surface);
end;
Gear:= Gear^.NextGear
end;
--- a/hedgewars/uLandTemplates.pas Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/uLandTemplates.pas Sun Jun 03 17:21:57 2007 +0000
@@ -18,7 +18,7 @@
unit uLandTemplates;
interface
-uses SDLh, uFloat;
+uses SDLh;
{$INCLUDE options.inc}
const NTPX = Low(TSDL_Rect.x);
--- a/hedgewars/uLocale.pas Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/uLocale.pas Sun Jun 03 17:21:57 2007 +0000
@@ -22,7 +22,7 @@
sidPickHammer, sidSkip, sidRope, sidMine, sidDEagle,
sidDynamite, sidBaseballBat, sidFirePunch, sidSeconds,
sidParachute, sidAirAttack, sidMineStrike, sidBlowTorch,
- sidGirder, sidTeleport);
+ sidGirder, sidTeleport, sidSwitch);
TMsgStrId = (sidStartFight, sidDraw, sidWinner, sidVolume, sidPaused);
--- a/hedgewars/uMisc.pas Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/uMisc.pas Sun Jun 03 17:21:57 2007 +0000
@@ -85,7 +85,7 @@
AttackBar: LongInt = 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
function hwSign(r: hwFloat): LongInt;
-function Min(a, b: LongInt): LongInt;
+function Min(a, b: LongInt): LongInt;
function Max(a, b: LongInt): LongInt;
function rndSign(num: hwFloat): hwFloat;
procedure OutError(Msg: String; isFatalError: boolean);
@@ -104,7 +104,7 @@
procedure SendKB;
procedure SetLittle(var r: hwFloat);
procedure SendStat(sit: TStatInfoType; s: shortstring);
-function Str2PChar(var s: shortstring): PChar;
+function Str2PChar(const s: shortstring): PChar;
var CursorPoint: TPoint;
TargetPoint: TPoint = (X: NoPointX; Y: 0);
@@ -222,7 +222,7 @@
rndSign:= num
end;
-function Str2PChar(var s: shortstring): PChar;
+function Str2PChar(const s: shortstring): PChar;
const CharArray: array[byte] of Char = '';
begin
CharArray:= s;
--- a/hedgewars/uStore.pas Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/uStore.pas Sun Jun 03 17:21:57 2007 +0000
@@ -491,7 +491,7 @@
////////////////////////////////////////////////////////////////////////////////
var ProgrSurf: PSDL_Surface = nil;
- Step: Longword = 0;
+ Step: integer = 0;
procedure AddProgress;
var r: TSDL_Rect;
--- a/hedgewars/uTeams.pas Wed May 30 20:48:57 2007 +0000
+++ b/hedgewars/uTeams.pas Sun Jun 03 17:21:57 2007 +0000
@@ -18,8 +18,12 @@
unit uTeams;
interface
-uses SDLh, uConsts, uKeys, uGears, uRandom, uAmmos, uFloat;
+uses SDLh, uConsts, uKeys, uGears, uRandom, uFloat;
{$INCLUDE options.inc}
+
+type PHHAmmo = ^THHAmmo;
+ THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo;
+
type PHedgehog = ^THedgehog;
PTeam = ^TTeam;
THedgehog = record
@@ -73,7 +77,7 @@
procedure SendStats;
implementation
-uses uMisc, uWorld, uAI, uLocale, uConsole;
+uses uMisc, uWorld, uAI, uLocale, uConsole, uAmmos;
const MaxTeamHealth: LongInt = 0;
procedure FreeTeamsList; forward;
@@ -128,7 +132,9 @@
if Gear <> nil then
begin
Gear^.Message:= 0;
- Gear^.Z:= cHHZ
+ Gear^.Z:= cHHZ;
+ RemoveGearFromList(Gear);
+ InsertGearToList(Gear)
end;
repeat
Binary file share/hedgewars/Data/Graphics/Switch.png has changed
--- a/share/hedgewars/Data/Locale/en.txt Wed May 30 20:48:57 2007 +0000
+++ b/share/hedgewars/Data/Locale/en.txt Sun Jun 03 17:21:57 2007 +0000
@@ -20,6 +20,7 @@
00:17=Blow Torch
00:18=Construction
00:19=Teleportation
+00:20=SwitchHedgehog
01:00=Let's fight!
01:01=Round draw
--- a/share/hedgewars/Data/Locale/ru.txt Wed May 30 20:48:57 2007 +0000
+++ b/share/hedgewars/Data/Locale/ru.txt Sun Jun 03 17:21:57 2007 +0000
@@ -20,6 +20,7 @@
00:17=Бур
00:18=Конструктор
00:19=Телепортация
+00:20=Переключить ежа
01:00=Вперёд к победе!
01:01=Ничья