--- a/hedgewars/uCollisions.pas Fri Dec 30 22:20:57 2011 +0300
+++ b/hedgewars/uCollisions.pas Sat Dec 31 01:52:14 2011 +0300
@@ -57,7 +57,7 @@
function CalcSlopeTangent(Gear: PGear; collisionX, collisionY: LongInt; var outDeltaX, outDeltaY: LongInt; TestWord: LongWord): Boolean;
implementation
-uses uConsts, uLandGraphics, uVariables, uDebug, uGears;
+uses uConsts, uLandGraphics, uVariables, uDebug, uGears, uGearsList;
type TCollisionEntry = record
X, Y, Radius: LongInt;
--- a/hedgewars/uGears.pas Fri Dec 30 22:20:57 2011 +0300
+++ b/hedgewars/uGears.pas Sat Dec 31 01:52:14 2011 +0300
@@ -52,16 +52,14 @@
procedure AddMiscGears;
procedure AssignHHCoords;
function GearByUID(uid : Longword) : PGear;
-procedure InsertGearToList(Gear: PGear);
-procedure RemoveGearFromList(Gear: PGear);
-procedure DeleteGear(Gear: PGear);
+procedure doStepDrowningGear(Gear: PGear);
implementation
uses uStore, uSound, uTeams, uRandom, uCollisions, uIO, uLandGraphics,
uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, GLunit, uMobile, uVariables,
uCommands, uUtils, uTextures, uRenderUtils, uGearsRender, uCaptions, uDebug, uLandTexture,
- uGearsHedgehog;
+ uGearsHedgehog, uGearsUtils, uGearsList;
procedure AmmoShove(Ammo: PGear; Damage, Power: LongInt); forward;
@@ -69,8 +67,6 @@
function GearsNear(X, Y: hwFloat; Kind: TGearType; r: LongInt): TPGearArray; forward;
procedure SpawnBoxOfSmth; forward;
procedure ShotgunShot(Gear: PGear); forward;
-procedure PickUp(HH, Gear: PGear); forward;
-procedure HHSetWeapon(HHGear: PGear); forward;
procedure doStepCase(Gear: PGear); forward;
// For better maintainability the step handlers of gears are stored in
@@ -79,70 +75,6 @@
// than the handlers for all other gears.
{$INCLUDE "GSHandlers.inc"}
-const doStepHandlers: array[TGearType] of TGearStepProcedure = (
- @doStepBomb,
- @doStepHedgehog,
- @doStepShell,
- @doStepGrave,
- @doStepBee,
- @doStepShotgunShot,
- @doStepPickHammer,
- @doStepRope,
- @doStepMine,
- @doStepCase,
- @doStepDEagleShot,
- @doStepDynamite,
- @doStepBomb,
- @doStepCluster,
- @doStepShover,
- @doStepFlame,
- @doStepFirePunch,
- @doStepActionTimer,
- @doStepActionTimer,
- @doStepParachute,
- @doStepAirAttack,
- @doStepAirBomb,
- @doStepBlowTorch,
- @doStepGirder,
- @doStepTeleport,
- @doStepSwitcher,
- @doStepTarget,
- @doStepMortar,
- @doStepWhip,
- @doStepKamikaze,
- @doStepCake,
- @doStepSeduction,
- @doStepBomb,
- @doStepCluster,
- @doStepBomb,
- @doStepWaterUp,
- @doStepDrill,
- @doStepBallgun,
- @doStepBomb,
- @doStepRCPlane,
- @doStepSniperRifleShot,
- @doStepJetpack,
- @doStepMolotov,
- @doStepCase,
- @doStepBirdy,
- @doStepEggWork,
- @doStepPortalShot,
- @doStepPiano,
- @doStepBomb,
- @doStepSineGunShot,
- @doStepFlamethrower,
- @doStepSMine,
- @doStepPoisonCloud,
- @doStepHammer,
- @doStepHammerHit,
- @doStepResurrector,
- @doStepNapalmBomb,
- @doStepSnowball,
- @doStepSnowflake,
- @doStepStructure,
- @doStepLandGun,
- @doStepTardis);
-
function CheckNoDamage: boolean; // returns TRUE in case of no damaged hhs
var Gear: PGear;
dmg: LongInt;
@@ -1226,7 +1158,72 @@
end;
procedure initModule;
+const handlers: array[TGearType] of TGearStepProcedure = (
+ @doStepBomb,
+ @doStepHedgehog,
+ @doStepShell,
+ @doStepGrave,
+ @doStepBee,
+ @doStepShotgunShot,
+ @doStepPickHammer,
+ @doStepRope,
+ @doStepMine,
+ @doStepCase,
+ @doStepDEagleShot,
+ @doStepDynamite,
+ @doStepBomb,
+ @doStepCluster,
+ @doStepShover,
+ @doStepFlame,
+ @doStepFirePunch,
+ @doStepActionTimer,
+ @doStepActionTimer,
+ @doStepParachute,
+ @doStepAirAttack,
+ @doStepAirBomb,
+ @doStepBlowTorch,
+ @doStepGirder,
+ @doStepTeleport,
+ @doStepSwitcher,
+ @doStepTarget,
+ @doStepMortar,
+ @doStepWhip,
+ @doStepKamikaze,
+ @doStepCake,
+ @doStepSeduction,
+ @doStepBomb,
+ @doStepCluster,
+ @doStepBomb,
+ @doStepWaterUp,
+ @doStepDrill,
+ @doStepBallgun,
+ @doStepBomb,
+ @doStepRCPlane,
+ @doStepSniperRifleShot,
+ @doStepJetpack,
+ @doStepMolotov,
+ @doStepCase,
+ @doStepBirdy,
+ @doStepEggWork,
+ @doStepPortalShot,
+ @doStepPiano,
+ @doStepBomb,
+ @doStepSineGunShot,
+ @doStepFlamethrower,
+ @doStepSMine,
+ @doStepPoisonCloud,
+ @doStepHammer,
+ @doStepHammerHit,
+ @doStepResurrector,
+ @doStepNapalmBomb,
+ @doStepSnowball,
+ @doStepSnowflake,
+ @doStepStructure,
+ @doStepLandGun,
+ @doStepTardis);
begin
+ doStepHandlers:= handlers;
+
RegisterVariable('skip', vtCommand, @chSkip, false);
RegisterVariable('hogsay', vtCommand, @chHogSay, true );
--- a/hedgewars/uGearsHedgehog.pas Fri Dec 30 22:20:57 2011 +0300
+++ b/hedgewars/uGearsHedgehog.pas Sat Dec 31 01:52:14 2011 +0300
@@ -27,6 +27,7 @@
procedure HedgehogStep(Gear: PGear);
procedure doStepHedgehogMoving(Gear: PGear);
procedure HedgehogChAngle(HHGear: PGear);
+procedure PickUp(HH, Gear: PGear);
implementation
uses uConsts, uVariables, uFloat, uAmmos, uSound, uCaptions, uMisc,
--- a/hedgewars/uGearsList.pas Fri Dec 30 22:20:57 2011 +0300
+++ b/hedgewars/uGearsList.pas Sat Dec 31 01:52:14 2011 +0300
@@ -24,11 +24,14 @@
function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
procedure DeleteGear(Gear: PGear);
+procedure InsertGearToList(Gear: PGear);
+procedure RemoveGearFromList(Gear: PGear);
implementation
-uses uDebug, uRandom, uUtils, uConsts, uVariables, uAmmos, uTeams, uStats,
- uTextures, uScript, uRenderUtils, uAI, uCollisions, uGearsHedgehog;
+uses uRandom, uUtils, uConsts, uVariables, uAmmos, uTeams, uStats,
+ uTextures, uScript, uRenderUtils, uAI, uCollisions,
+ uGearsRender, uGearsUtils;
procedure InsertGearToList(Gear: PGear);
var tmp, ptmp: PGear;
--- a/hedgewars/uGearsUtils.pas Fri Dec 30 22:20:57 2011 +0300
+++ b/hedgewars/uGearsUtils.pas Sat Dec 31 01:52:14 2011 +0300
@@ -33,12 +33,16 @@
procedure FindPlace(var Gear: PGear; withFall: boolean; Left, Right: LongInt; skipProximity: boolean = false);
function CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: LongInt): PGear;
function CheckGearsNear(mX, mY: LongInt; Kind: TGearsType; rX, rY: LongInt): PGear;
+function CheckGearDrowning(Gear: PGear): boolean;
+
+var doStepHandlers: array[TGearType] of TGearStepProcedure;
implementation
uses uFloat, uSound, uCollisions, uUtils, uConsts, uVisualGears, uAIMisc,
uVariables, uLandGraphics, uScript, uStats, uCaptions, uTeams, uStore,
- uLocale, uTextures, uRenderUtils, uRandom, uGearsList, SDLh, uDebug;
+ uLocale, uTextures, uRenderUtils, uRandom, SDLh, uDebug, uGears,
+ uGearsList;
procedure doMakeExplosion(X, Y, Radius: LongInt; AttackingHog: PHedgehog; Mask: Longword; const Tint: LongWord);
var Gear: PGear;
--- a/hedgewars/uScript.pas Fri Dec 30 22:20:57 2011 +0300
+++ b/hedgewars/uScript.pas Sat Dec 31 01:52:14 2011 +0300
@@ -57,7 +57,9 @@
uConsole,
uConsts,
uVisualGears,
+ uGears,
uGearsList,
+ uGearsUtils,
uFloat,
uWorld,
uAmmos,
--- a/hedgewars/uTeams.pas Fri Dec 30 22:20:57 2011 +0300
+++ b/hedgewars/uTeams.pas Sat Dec 31 01:52:14 2011 +0300
@@ -36,7 +36,8 @@
procedure TeamGoneEffect(var Team: TTeam);
implementation
-uses uLocale, uAmmos, uChat, uMobile, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, uScript;
+uses uLocale, uAmmos, uChat, uMobile, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, uScript,
+ uGearsUtils, uGearsList;
const MaxTeamHealth: LongInt = 0;