Move global variables to units that use them
authorJoe Doyle (Ginto8) <ginto8@gmail.com>
Thu, 29 Nov 2012 23:23:19 -0500
changeset 8145 6408c0ba4ba1
parent 8143 3f2ba6debbdd
child 8153 e97e00427204
Move global variables to units that use them
hedgewars/uCommandHandlers.pas
hedgewars/uConsts.pas
hedgewars/uGearsList.pas
hedgewars/uGearsRender.pas
hedgewars/uIO.pas
hedgewars/uInputHandler.pas
hedgewars/uLandObjects.pas
hedgewars/uLandOutline.pas
hedgewars/uRender.pas
hedgewars/uScript.pas
hedgewars/uSound.pas
hedgewars/uStore.pas
hedgewars/uTeams.pas
hedgewars/uVariables.pas
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
--- a/hedgewars/uCommandHandlers.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uCommandHandlers.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -30,6 +30,8 @@
      {$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF};
 
 var prevGState: TGameState = gsConfirm;
+    cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 15, 6, 4, 5, 0, 0, 0, 0, 0, 14, 12, 13);
+    cTagsMasksNoHealth: array[0..15] of byte = (3, 2, 11, 1, 0, 0, 0, 0, 0, 10, 0, 9, 0, 0, 0, 0);
 
 procedure chGenCmd(var s: shortstring);
 begin
--- a/hedgewars/uConsts.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uConsts.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -112,9 +112,7 @@
     GL_TEXTURE_PRIORITY = $8066;
     {$ENDIF}
 
-    cSendCursorPosTime  : LongWord = 50;
     cVisibleWater       : LongInt = 128;
-    cCursorEdgesDist    : LongInt = 100;
     cTeamHealthWidth    : LongInt = 128;
 
     cifRandomize = $00000001;
@@ -135,11 +133,8 @@
     cHHRadius = 9;
     cHHStepTicks = 29;
 
-    cUsualZ = 500;
-    cSmokeZ = 499;
     cHHZ = 1000;
     cCurrHHZ = Succ(cHHZ);
-    cOnHHZ = 2000;
 
     cBarrelHealth = 60;
     cShotgunRadius = 22;
@@ -149,17 +144,11 @@
     cKeyMaxIndex = 1023;
     cKbdMaxIndex = 65536;//need more room for the modifier keys
 
-    cHHFileName = 'Hedgehog';
-    cCHFileName = 'Crosshair';
-    cThemeCFGFilename = 'theme.cfg';
-
     cFontBorder = 2;
 
     // do not change this value
     cDefaultZoomLevel = 2.0;
 
-    cSendEmptyPacketTime = 1000;
-
     // game flags
     gfAny                = $FFFFFFFF;
     gfOneClanMode        = $00000001;           // used in trainings
@@ -286,40 +275,6 @@
     NoPointX = Low(LongInt);
     cTargetPointRef : TPoint = (X: NoPointX; Y: 0);
 
-    // hog tag mask
-    htNone        = $00;
-    htTeamName    = $01;
-    htName        = $02;
-    htHealth      = $04;
-    htTransparent = $08;
-
-    AMAnimDuration = 200;
-    AMHidden    = 0;//AMState values
-    AMShowingUp = 1;
-    AMShowing   = 2;
-    AMHiding    = 3;
-
-    AMTypeMaskX     = $00000001;
-    AMTypeMaskY     = $00000002;
-    AMTypeMaskAlpha = $00000004;
-    AMTypeMaskSlide = $00000008;
-
-{$IFDEF MOBILE}
-    AMSlotSize = 48;
-    AMTITLE = 30;
-{$ELSE}
-    AMSlotSize = 32;
-{$ENDIF}
-    AMSlotPadding = (AMSlotSize - 32) shr 1;
-
-{$IFDEF USE_TOUCH_INTERFACE}
-    FADE_ANIM_TIME = 500;
-    MOVE_ANIM_TIME = 500;
-{$ENDIF}
-
-    cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 15, 6, 4, 5, 0, 0, 0, 0, 0, 14, 12, 13);
-    cTagsMasksNoHealth: array[0..15] of byte = (3, 2, 11, 1, 0, 0, 0, 0, 0, 10, 0, 9, 0, 0, 0, 0);
-       
 implementation
 
 end.
--- a/hedgewars/uGearsList.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uGearsList.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -35,8 +35,83 @@
     uTextures, uScript, uRenderUtils, uAI, uCollisions,
     uGearsRender, uGearsUtils, uDebug;
 
+const
+    GearKindAmmoTypeMap : array [TGearType] of TAmmoType = (    
+(*          gtFlame *)   amNothing
+(*       gtHedgehog *) , amNothing
+(*           gtMine *) , amMine
+(*           gtCase *) , amNothing
+(*     gtExplosives *) , amNothing
+(*        gtGrenade *) , amGrenade
+(*          gtShell *) , amBazooka
+(*          gtGrave *) , amNothing
+(*            gtBee *) , amBee
+(*    gtShotgunShot *) , amShotgun
+(*     gtPickHammer *) , amPickHammer
+(*           gtRope *) , amRope
+(*     gtDEagleShot *) , amDEagle
+(*       gtDynamite *) , amDynamite
+(*    gtClusterBomb *) , amClusterBomb
+(*        gtCluster *) , amClusterBomb
+(*         gtShover *) , amBaseballBat  // Shover is only used for baseball bat right now
+(*      gtFirePunch *) , amFirePunch
+(*    gtATStartGame *) , amNothing
+(*   gtATFinishGame *) , amNothing
+(*      gtParachute *) , amParachute
+(*      gtAirAttack *) , amAirAttack
+(*        gtAirBomb *) , amAirAttack
+(*      gtBlowTorch *) , amBlowTorch
+(*         gtGirder *) , amGirder
+(*       gtTeleport *) , amTeleport
+(*       gtSwitcher *) , amSwitch
+(*         gtTarget *) , amNothing
+(*         gtMortar *) , amMortar
+(*           gtWhip *) , amWhip
+(*       gtKamikaze *) , amKamikaze
+(*           gtCake *) , amCake
+(*      gtSeduction *) , amSeduction
+(*     gtWatermelon *) , amWatermelon
+(*     gtMelonPiece *) , amWatermelon
+(*    gtHellishBomb *) , amHellishBomb
+(*        gtWaterUp *) , amNothing
+(*          gtDrill *) , amDrill
+(*        gtBallGun *) , amBallgun
+(*           gtBall *) , amBallgun
+(*        gtRCPlane *) , amRCPlane
+(*gtSniperRifleShot *) , amSniperRifle
+(*        gtJetpack *) , amJetpack
+(*        gtMolotov *) , amMolotov
+(*          gtBirdy *) , amBirdy
+(*            gtEgg *) , amBirdy
+(*         gtPortal *) , amPortalGun
+(*          gtPiano *) , amPiano
+(*        gtGasBomb *) , amGasBomb
+(*    gtSineGunShot *) , amSineGun
+(*   gtFlamethrower *) , amFlamethrower
+(*          gtSMine *) , amSMine
+(*    gtPoisonCloud *) , amNothing
+(*         gtHammer *) , amHammer
+(*      gtHammerHit *) , amHammer
+(*    gtResurrector *) , amResurrector
+(*    gtPoisonCloud *) , amNothing
+(*       gtSnowball *) , amSnowball
+(*          gtFlake *) , amNothing
+(*      gtStructure *) , amStructure  // TODO - This will undoubtedly change once there is more than one structure
+(*        gtLandGun *) , amLandGun
+(*         gtTardis *) , amTardis
+(*         gtIceGun *) , amIceGun
+(*        gtAddAmmo *) , amNothing
+(*  gtGenericFaller *) , amNothing
+(*          gtKnife *) , amKnife
+    );
+
+
 var GCounter: LongWord = 0; // this does not get re-initialized, but should be harmless
 
+const
+    cUsualZ = 500;
+    cOnHHZ = 2000;
+
 procedure InsertGearToList(Gear: PGear);
 var tmp, ptmp: PGear;
 begin
--- a/hedgewars/uGearsRender.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uGearsRender.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -39,6 +39,14 @@
 implementation
 uses uRender, uUtils, uVariables, uAmmos, Math, uVisualGears;
 
+const
+    // hog tag mask
+    htNone        = $00;
+    htTeamName    = $01;
+    htName        = $02;
+    htHealth      = $04;
+    htTransparent = $08;
+
 procedure DrawRopeLinesRQ(Gear: PGear);
 begin
 with RopePoints do
--- a/hedgewars/uIO.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uIO.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -41,6 +41,9 @@
 implementation
 uses uConsole, uConsts, uVariables, uCommands, uUtils, uDebug;
 
+const
+    cSendEmptyPacketTime = 1000;
+
 type PCmd = ^TCmd;
      TCmd = packed record
             Next: PCmd;
--- a/hedgewars/uInputHandler.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uInputHandler.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -60,6 +60,16 @@
     quitKeyCode, closeKeyCode: Byte;
     KeyNames: array [0..cKeyMaxIndex] of string[15];
     CurrentBinds: TBinds;
+    ControllerNumControllers: Integer;
+    ControllerEnabled: Integer;
+    ControllerNumAxes: array[0..5] of Integer;
+    //ControllerNumBalls: array[0..5] of Integer;
+    ControllerNumHats: array[0..5] of Integer;
+    ControllerNumButtons: array[0..5] of Integer;
+    ControllerAxes: array[0..5] of array[0..19] of Integer;
+    //ControllerBalls: array[0..5] of array[0..19] of array[0..1] of Integer;
+    ControllerHats: array[0..5] of array[0..19] of Byte;
+    ControllerButtons: array[0..5] of array[0..19] of Byte;
 
 function  KeyNameToCode(name: shortstring): LongInt; inline;
 begin
--- a/hedgewars/uLandObjects.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uLandObjects.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -37,6 +37,7 @@
 const MaxRects = 512;
       MAXOBJECTRECTS = 16;
       MAXTHEMEOBJECTS = 32;
+      cThemeCFGFilename = 'theme.cfg';
 
 type TRectsArray = array[0..MaxRects] of TSDL_Rect;
      PRectArray = ^TRectsArray;
--- a/hedgewars/uLandOutline.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uLandOutline.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -27,6 +27,9 @@
                                      end
            end;
 
+const
+    cMaxEdgePoints = 16384;
+
 procedure Push(_xl, _xr, _y, _dir: LongInt);
 begin
     TryDo(Stack.Count <= 8192, 'FillLand: stack overflow', true);
--- a/hedgewars/uRender.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uRender.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -55,6 +55,12 @@
 implementation
 uses uVariables;
 
+{$IFDEF USE_TOUCH_INTERFACE}
+const
+    FADE_ANIM_TIME = 500;
+    MOVE_ANIM_TIME = 500;
+{$ENDIF}
+
 var LastTint: LongWord = 0;
 
 procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt);
--- a/hedgewars/uScript.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uScript.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -2319,6 +2319,7 @@
 ScriptSetInteger('gstHHGone'         ,$00100000);
 ScriptSetInteger('gstInvisible'      ,$00200000);
 
+// ai hints
 ScriptSetInteger('aihUsualProcessing' ,$00000000);
 ScriptSetInteger('aihDoesntMatter'    ,$00000001);
 
--- a/hedgewars/uSound.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uSound.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -120,6 +120,136 @@
     isMusicEnabled: boolean;
     isSoundEnabled: boolean;
     isSEBackup: boolean;
+    VoiceList : array[0..7] of TVoice =  (
+                    ( snd: sndNone; voicepack: nil),
+                    ( snd: sndNone; voicepack: nil),
+                    ( snd: sndNone; voicepack: nil),
+                    ( snd: sndNone; voicepack: nil),
+                    ( snd: sndNone; voicepack: nil),
+                    ( snd: sndNone; voicepack: nil),
+                    ( snd: sndNone; voicepack: nil),
+                    ( snd: sndNone; voicepack: nil));
+    Soundz: array[TSound] of record
+            FileName: string[31];
+            Path    : TPathType;
+            end = (
+            (FileName:                         ''; Path: ptNone  ),// sndNone
+            (FileName:        'grenadeimpact.ogg'; Path: ptSounds),// sndGrenadeImpact
+            (FileName:            'explosion.ogg'; Path: ptSounds),// sndExplosion
+            (FileName:         'throwpowerup.ogg'; Path: ptSounds),// sndThrowPowerUp
+            (FileName:         'throwrelease.ogg'; Path: ptSounds),// sndThrowRelease
+            (FileName:               'splash.ogg'; Path: ptSounds),// sndSplash
+            (FileName:        'shotgunreload.ogg'; Path: ptSounds),// sndShotgunReload
+            (FileName:          'shotgunfire.ogg'; Path: ptSounds),// sndShotgunFire
+            (FileName:          'graveimpact.ogg'; Path: ptSounds),// sndGraveImpact
+            (FileName:           'mineimpact.ogg'; Path: ptSounds),// sndMineImpact
+            (FileName:             'minetick.ogg'; Path: ptSounds),// sndMineTicks
+            (FileName:             'Droplet1.ogg'; Path: ptSounds),// sndMudballImpact
+            (FileName:           'pickhammer.ogg'; Path: ptSounds),// sndPickhammer
+            (FileName:                  'gun.ogg'; Path: ptSounds),// sndGun
+            (FileName:                  'bee.ogg'; Path: ptSounds),// sndBee
+            (FileName:                'Jump1.ogg'; Path: ptVoices),// sndJump1
+            (FileName:                'Jump2.ogg'; Path: ptVoices),// sndJump2
+            (FileName:                'Jump3.ogg'; Path: ptVoices),// sndJump3
+            (FileName:               'Yessir.ogg'; Path: ptVoices),// sndYesSir
+            (FileName:                'Laugh.ogg'; Path: ptVoices),// sndLaugh
+            (FileName:            'Illgetyou.ogg'; Path: ptVoices),// sndIllGetYou
+            (FileName:          'JustYouWait.ogg'; Path: ptVoices),// sndJustYouWait
+            (FileName:             'Incoming.ogg'; Path: ptVoices),// sndIncoming
+            (FileName:               'Missed.ogg'; Path: ptVoices),// sndMissed
+            (FileName:               'Stupid.ogg'; Path: ptVoices),// sndStupid
+            (FileName:           'Firstblood.ogg'; Path: ptVoices),// sndFirstBlood
+            (FileName:               'Boring.ogg'; Path: ptVoices),// sndBoring
+            (FileName:               'Byebye.ogg'; Path: ptVoices),// sndByeBye
+            (FileName:             'Sameteam.ogg'; Path: ptVoices),// sndSameTeam
+            (FileName:               'Nutter.ogg'; Path: ptVoices),// sndNutter
+            (FileName:       'Reinforcements.ogg'; Path: ptVoices),// sndReinforce
+            (FileName:              'Traitor.ogg'; Path: ptVoices),// sndTraitor
+            (FileName:      'Youllregretthat.ogg'; Path: ptVoices),// sndRegret
+            (FileName:            'Enemydown.ogg'; Path: ptVoices),// sndEnemyDown
+            (FileName:               'Coward.ogg'; Path: ptVoices),// sndCoward
+            (FileName:                'Hurry.ogg'; Path: ptVoices),// sndHurry
+            (FileName:              'Watchit.ogg'; Path: ptVoices),// sndWatchIt
+            (FileName:             'Kamikaze.ogg'; Path: ptVoices),// sndKamikaze
+            (FileName:                'cake2.ogg'; Path: ptSounds),// sndCake
+            (FileName:                  'Ow1.ogg'; Path: ptVoices),// sndOw1
+            (FileName:                  'Ow2.ogg'; Path: ptVoices),// sndOw2
+            (FileName:                  'Ow3.ogg'; Path: ptVoices),// sndOw3
+            (FileName:                  'Ow4.ogg'; Path: ptVoices),// sndOw4
+            (FileName:           'Firepunch1.ogg'; Path: ptVoices),// sndFirepunch1
+            (FileName:           'Firepunch2.ogg'; Path: ptVoices),// sndFirepunch2
+            (FileName:           'Firepunch3.ogg'; Path: ptVoices),// sndFirepunch3
+            (FileName:           'Firepunch4.ogg'; Path: ptVoices),// sndFirepunch4
+            (FileName:           'Firepunch5.ogg'; Path: ptVoices),// sndFirepunch5
+            (FileName:           'Firepunch6.ogg'; Path: ptVoices),// sndFirepunch6
+            (FileName:                'Melon.ogg'; Path: ptVoices),// sndMelon
+            (FileName:              'Hellish.ogg'; Path: ptSounds),// sndHellish
+            (FileName:               'Yoohoo.ogg'; Path: ptSounds),// sndYoohoo
+            (FileName:              'rcplane.ogg'; Path: ptSounds),// sndRCPlane
+            (FileName:            'whipcrack.ogg'; Path: ptSounds),// sndWhipCrack
+            (FileName:'ride_of_the_valkyries.ogg'; Path: ptSounds),// sndRideOfTheValkyries
+            (FileName:               'denied.ogg'; Path: ptSounds),// sndDenied
+            (FileName:               'placed.ogg'; Path: ptSounds),// sndPlaced
+            (FileName:          'baseballbat.ogg'; Path: ptSounds),// sndBaseballBat
+            (FileName:                'steam.ogg'; Path: ptSounds),// sndVaporize
+            (FileName:                 'warp.ogg'; Path: ptSounds),// sndWarp
+            (FileName:          'suddendeath.ogg'; Path: ptSounds),// sndSuddenDeath
+            (FileName:               'mortar.ogg'; Path: ptSounds),// sndMortar
+            (FileName:         'shutterclick.ogg'; Path: ptSounds),// sndShutter
+            (FileName:              'homerun.ogg'; Path: ptSounds),// sndHomerun
+            (FileName:              'molotov.ogg'; Path: ptSounds),// sndMolotov
+            (FileName:            'Takecover.ogg'; Path: ptVoices),// sndCover
+            (FileName:                'Uh-oh.ogg'; Path: ptVoices),// sndUhOh
+            (FileName:                 'Oops.ogg'; Path: ptVoices),// sndOops
+            (FileName:                 'Nooo.ogg'; Path: ptVoices),// sndNooo
+            (FileName:                'Hello.ogg'; Path: ptVoices),// sndHello
+            (FileName:             'ropeshot.ogg'; Path: ptSounds),// sndRopeShot
+            (FileName:           'ropeattach.ogg'; Path: ptSounds),// sndRopeAttach
+            (FileName:          'roperelease.ogg'; Path: ptSounds),// sndRopeRelease
+            (FileName:            'switchhog.ogg'; Path: ptSounds),// sndSwitchHog
+            (FileName:              'Victory.ogg'; Path: ptVoices),// sndVictory
+            (FileName:             'Flawless.ogg'; Path: ptVoices),// sndFlawless
+            (FileName:         'sniperreload.ogg'; Path: ptSounds),// sndSniperReload
+            (FileName:                'steps.ogg'; Path: ptSounds),// sndSteps
+            (FileName:           'lowgravity.ogg'; Path: ptSounds),// sndLowGravity
+            (FileName:           'hell_growl.ogg'; Path: ptSounds),// sndHellishImpact1
+            (FileName:            'hell_ooff.ogg'; Path: ptSounds),// sndHellishImpact2
+            (FileName:              'hell_ow.ogg'; Path: ptSounds),// sndHellishImpact3
+            (FileName:             'hell_ugh.ogg'; Path: ptSounds),// sndHellishImpact4
+            (FileName:          'melonimpact.ogg'; Path: ptSounds),// sndMelonImpact
+            (FileName:             'Droplet1.ogg'; Path: ptSounds),// sndDroplet1
+            (FileName:             'Droplet2.ogg'; Path: ptSounds),// sndDroplet2
+            (FileName:             'Droplet3.ogg'; Path: ptSounds),// sndDroplet3
+            (FileName:                  'egg.ogg'; Path: ptSounds),// sndEggBreak
+            (FileName:             'drillgun.ogg'; Path: ptSounds),// sndDrillRocket
+            (FileName:          'PoisonCough.ogg'; Path: ptVoices),// sndPoisonCough
+            (FileName:           'PoisonMoan.ogg'; Path: ptVoices),// sndPoisonMoan
+            (FileName:             'BirdyLay.ogg'; Path: ptSounds),// sndBirdyLay
+            (FileName:              'Whistle.ogg'; Path: ptSounds),// sndWhistle
+            (FileName:             'beewater.ogg'; Path: ptSounds),// sndBeeWater
+            (FileName:                   '1C.ogg'; Path: ptSounds),// sndPiano0
+            (FileName:                   '2D.ogg'; Path: ptSounds),// sndPiano1
+            (FileName:                   '3E.ogg'; Path: ptSounds),// sndPiano2
+            (FileName:                   '4F.ogg'; Path: ptSounds),// sndPiano3
+            (FileName:                   '5G.ogg'; Path: ptSounds),// sndPiano4
+            (FileName:                   '6A.ogg'; Path: ptSounds),// sndPiano5
+            (FileName:                   '7B.ogg'; Path: ptSounds),// sndPiano6
+            (FileName:                   '8C.ogg'; Path: ptSounds),// sndPiano7
+            (FileName:                   '9D.ogg'; Path: ptSounds),// sndPiano8
+            (FileName:                 'skip.ogg'; Path: ptSounds),// sndSkip
+            (FileName:              'sinegun.ogg'; Path: ptSounds),// sndSineGun
+            (FileName:                'Ooff1.ogg'; Path: ptVoices),// sndOoff1
+            (FileName:                'Ooff2.ogg'; Path: ptVoices),// sndOoff2
+            (FileName:                'Ooff3.ogg'; Path: ptVoices),// sndOoff3
+            (FileName:               'hammer.ogg'; Path: ptSounds),// sndWhack
+            (FileName:           'Comeonthen.ogg'; Path: ptVoices),// sndComeonthen
+            (FileName:            'parachute.ogg'; Path: ptSounds),// sndParachute
+            (FileName:                 'bump.ogg'; Path: ptSounds),// sndBump
+            (FileName:            'hogchant3.ogg'; Path: ptSounds),// sndResurrector
+            (FileName:                'plane.ogg'; Path: ptSounds),// sndPlane
+            (FileName:               'TARDIS.ogg'; Path: ptSounds) // sndTardis
+            );
+
 
 
 function  AskForVoicepack(name: shortstring): Pointer;
--- a/hedgewars/uStore.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uStore.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -33,7 +33,7 @@
 procedure FinishProgress;
 function  LoadImage(const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
 
-// loads an image from the game's data files
+// loads an image from the games data files
 function  LoadDataImage(const path: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
 // like LoadDataImage but uses altPath as fallback-path if file not found/loadable in path
 function  LoadDataImageAltPath(const path, altPath: TPathType; const filename: shortstring; imageFlags: LongInt): PSDL_Surface;
@@ -71,6 +71,13 @@
 {$ELSE}
     SDLPrimSurface: PSDL_Surface;
 {$ENDIF}
+    squaresize : LongInt;
+    numsquares : LongInt;
+    ProgrTex: PTexture;
+
+const 
+    cHHFileName = 'Hedgehog';
+    cCHFileName = 'Crosshair';
 
 function WriteInRect(Surface: PSDL_Surface; X, Y: LongInt; Color: LongWord; Font: THWFont; s: ansistring): TSDL_Rect;
 var w, h: LongInt;
--- a/hedgewars/uTeams.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uTeams.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -46,6 +46,7 @@
 
 var MaxTeamHealth: LongInt;
     GameOver: boolean;
+    NextClan: boolean;
 
 function CheckForWin: boolean;
 var AliveClan: PClan;
--- a/hedgewars/uVariables.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uVariables.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -157,7 +157,6 @@
     cVampiric       : boolean;
     cArtillery      : boolean;
     WeaponTooltipTex: PTexture;
-    AmmoMenuTex     : PTexture;
     AmmoMenuInvalidated: boolean;
     AmmoRect		: TSDL_Rect;
     HHTexture       : PTexture;
@@ -196,15 +195,6 @@
 
     LuaTemplateNumber : LongWord;
 
-    VoiceList : array[0..7] of TVoice =  (
-                    ( snd: sndNone; voicepack: nil),
-                    ( snd: sndNone; voicepack: nil),
-                    ( snd: sndNone; voicepack: nil),
-                    ( snd: sndNone; voicepack: nil),
-                    ( snd: sndNone; voicepack: nil),
-                    ( snd: sndNone; voicepack: nil),
-                    ( snd: sndNone; voicepack: nil),
-                    ( snd: sndNone; voicepack: nil));
     LastVoice : TVoice = ( snd: sndNone; voicepack: nil );
 
 /////////////////////////////////////
@@ -690,126 +680,6 @@
             (Sprite:   sprJuggle; FramesCount: 49; Interval:  38; cmd: '/juggle'; Voice: sndNone; VoiceDelay: 0)
             );
 
-    Soundz: array[TSound] of record
-            FileName: string[31];
-            Path    : TPathType;
-            end = (
-            (FileName:                         ''; Path: ptNone  ),// sndNone
-            (FileName:        'grenadeimpact.ogg'; Path: ptSounds),// sndGrenadeImpact
-            (FileName:            'explosion.ogg'; Path: ptSounds),// sndExplosion
-            (FileName:         'throwpowerup.ogg'; Path: ptSounds),// sndThrowPowerUp
-            (FileName:         'throwrelease.ogg'; Path: ptSounds),// sndThrowRelease
-            (FileName:               'splash.ogg'; Path: ptSounds),// sndSplash
-            (FileName:        'shotgunreload.ogg'; Path: ptSounds),// sndShotgunReload
-            (FileName:          'shotgunfire.ogg'; Path: ptSounds),// sndShotgunFire
-            (FileName:          'graveimpact.ogg'; Path: ptSounds),// sndGraveImpact
-            (FileName:           'mineimpact.ogg'; Path: ptSounds),// sndMineImpact
-            (FileName:             'minetick.ogg'; Path: ptSounds),// sndMineTicks
-            (FileName:             'Droplet1.ogg'; Path: ptSounds),// sndMudballImpact
-            (FileName:           'pickhammer.ogg'; Path: ptSounds),// sndPickhammer
-            (FileName:                  'gun.ogg'; Path: ptSounds),// sndGun
-            (FileName:                  'bee.ogg'; Path: ptSounds),// sndBee
-            (FileName:                'Jump1.ogg'; Path: ptVoices),// sndJump1
-            (FileName:                'Jump2.ogg'; Path: ptVoices),// sndJump2
-            (FileName:                'Jump3.ogg'; Path: ptVoices),// sndJump3
-            (FileName:               'Yessir.ogg'; Path: ptVoices),// sndYesSir
-            (FileName:                'Laugh.ogg'; Path: ptVoices),// sndLaugh
-            (FileName:            'Illgetyou.ogg'; Path: ptVoices),// sndIllGetYou
-            (FileName:          'JustYouWait.ogg'; Path: ptVoices),// sndJustYouWait
-            (FileName:             'Incoming.ogg'; Path: ptVoices),// sndIncoming
-            (FileName:               'Missed.ogg'; Path: ptVoices),// sndMissed
-            (FileName:               'Stupid.ogg'; Path: ptVoices),// sndStupid
-            (FileName:           'Firstblood.ogg'; Path: ptVoices),// sndFirstBlood
-            (FileName:               'Boring.ogg'; Path: ptVoices),// sndBoring
-            (FileName:               'Byebye.ogg'; Path: ptVoices),// sndByeBye
-            (FileName:             'Sameteam.ogg'; Path: ptVoices),// sndSameTeam
-            (FileName:               'Nutter.ogg'; Path: ptVoices),// sndNutter
-            (FileName:       'Reinforcements.ogg'; Path: ptVoices),// sndReinforce
-            (FileName:              'Traitor.ogg'; Path: ptVoices),// sndTraitor
-            (FileName:      'Youllregretthat.ogg'; Path: ptVoices),// sndRegret
-            (FileName:            'Enemydown.ogg'; Path: ptVoices),// sndEnemyDown
-            (FileName:               'Coward.ogg'; Path: ptVoices),// sndCoward
-            (FileName:                'Hurry.ogg'; Path: ptVoices),// sndHurry
-            (FileName:              'Watchit.ogg'; Path: ptVoices),// sndWatchIt
-            (FileName:             'Kamikaze.ogg'; Path: ptVoices),// sndKamikaze
-            (FileName:                'cake2.ogg'; Path: ptSounds),// sndCake
-            (FileName:                  'Ow1.ogg'; Path: ptVoices),// sndOw1
-            (FileName:                  'Ow2.ogg'; Path: ptVoices),// sndOw2
-            (FileName:                  'Ow3.ogg'; Path: ptVoices),// sndOw3
-            (FileName:                  'Ow4.ogg'; Path: ptVoices),// sndOw4
-            (FileName:           'Firepunch1.ogg'; Path: ptVoices),// sndFirepunch1
-            (FileName:           'Firepunch2.ogg'; Path: ptVoices),// sndFirepunch2
-            (FileName:           'Firepunch3.ogg'; Path: ptVoices),// sndFirepunch3
-            (FileName:           'Firepunch4.ogg'; Path: ptVoices),// sndFirepunch4
-            (FileName:           'Firepunch5.ogg'; Path: ptVoices),// sndFirepunch5
-            (FileName:           'Firepunch6.ogg'; Path: ptVoices),// sndFirepunch6
-            (FileName:                'Melon.ogg'; Path: ptVoices),// sndMelon
-            (FileName:              'Hellish.ogg'; Path: ptSounds),// sndHellish
-            (FileName:               'Yoohoo.ogg'; Path: ptSounds),// sndYoohoo
-            (FileName:              'rcplane.ogg'; Path: ptSounds),// sndRCPlane
-            (FileName:            'whipcrack.ogg'; Path: ptSounds),// sndWhipCrack
-            (FileName:'ride_of_the_valkyries.ogg'; Path: ptSounds),// sndRideOfTheValkyries
-            (FileName:               'denied.ogg'; Path: ptSounds),// sndDenied
-            (FileName:               'placed.ogg'; Path: ptSounds),// sndPlaced
-            (FileName:          'baseballbat.ogg'; Path: ptSounds),// sndBaseballBat
-            (FileName:                'steam.ogg'; Path: ptSounds),// sndVaporize
-            (FileName:                 'warp.ogg'; Path: ptSounds),// sndWarp
-            (FileName:          'suddendeath.ogg'; Path: ptSounds),// sndSuddenDeath
-            (FileName:               'mortar.ogg'; Path: ptSounds),// sndMortar
-            (FileName:         'shutterclick.ogg'; Path: ptSounds),// sndShutter
-            (FileName:              'homerun.ogg'; Path: ptSounds),// sndHomerun
-            (FileName:              'molotov.ogg'; Path: ptSounds),// sndMolotov
-            (FileName:            'Takecover.ogg'; Path: ptVoices),// sndCover
-            (FileName:                'Uh-oh.ogg'; Path: ptVoices),// sndUhOh
-            (FileName:                 'Oops.ogg'; Path: ptVoices),// sndOops
-            (FileName:                 'Nooo.ogg'; Path: ptVoices),// sndNooo
-            (FileName:                'Hello.ogg'; Path: ptVoices),// sndHello
-            (FileName:             'ropeshot.ogg'; Path: ptSounds),// sndRopeShot
-            (FileName:           'ropeattach.ogg'; Path: ptSounds),// sndRopeAttach
-            (FileName:          'roperelease.ogg'; Path: ptSounds),// sndRopeRelease
-            (FileName:            'switchhog.ogg'; Path: ptSounds),// sndSwitchHog
-            (FileName:              'Victory.ogg'; Path: ptVoices),// sndVictory
-            (FileName:             'Flawless.ogg'; Path: ptVoices),// sndFlawless
-            (FileName:         'sniperreload.ogg'; Path: ptSounds),// sndSniperReload
-            (FileName:                'steps.ogg'; Path: ptSounds),// sndSteps
-            (FileName:           'lowgravity.ogg'; Path: ptSounds),// sndLowGravity
-            (FileName:           'hell_growl.ogg'; Path: ptSounds),// sndHellishImpact1
-            (FileName:            'hell_ooff.ogg'; Path: ptSounds),// sndHellishImpact2
-            (FileName:              'hell_ow.ogg'; Path: ptSounds),// sndHellishImpact3
-            (FileName:             'hell_ugh.ogg'; Path: ptSounds),// sndHellishImpact4
-            (FileName:          'melonimpact.ogg'; Path: ptSounds),// sndMelonImpact
-            (FileName:             'Droplet1.ogg'; Path: ptSounds),// sndDroplet1
-            (FileName:             'Droplet2.ogg'; Path: ptSounds),// sndDroplet2
-            (FileName:             'Droplet3.ogg'; Path: ptSounds),// sndDroplet3
-            (FileName:                  'egg.ogg'; Path: ptSounds),// sndEggBreak
-            (FileName:             'drillgun.ogg'; Path: ptSounds),// sndDrillRocket
-            (FileName:          'PoisonCough.ogg'; Path: ptVoices),// sndPoisonCough
-            (FileName:           'PoisonMoan.ogg'; Path: ptVoices),// sndPoisonMoan
-            (FileName:             'BirdyLay.ogg'; Path: ptSounds),// sndBirdyLay
-            (FileName:              'Whistle.ogg'; Path: ptSounds),// sndWhistle
-            (FileName:             'beewater.ogg'; Path: ptSounds),// sndBeeWater
-            (FileName:                   '1C.ogg'; Path: ptSounds),// sndPiano0
-            (FileName:                   '2D.ogg'; Path: ptSounds),// sndPiano1
-            (FileName:                   '3E.ogg'; Path: ptSounds),// sndPiano2
-            (FileName:                   '4F.ogg'; Path: ptSounds),// sndPiano3
-            (FileName:                   '5G.ogg'; Path: ptSounds),// sndPiano4
-            (FileName:                   '6A.ogg'; Path: ptSounds),// sndPiano5
-            (FileName:                   '7B.ogg'; Path: ptSounds),// sndPiano6
-            (FileName:                   '8C.ogg'; Path: ptSounds),// sndPiano7
-            (FileName:                   '9D.ogg'; Path: ptSounds),// sndPiano8
-            (FileName:                 'skip.ogg'; Path: ptSounds),// sndSkip
-            (FileName:              'sinegun.ogg'; Path: ptSounds),// sndSineGun
-            (FileName:                'Ooff1.ogg'; Path: ptVoices),// sndOoff1
-            (FileName:                'Ooff2.ogg'; Path: ptVoices),// sndOoff2
-            (FileName:                'Ooff3.ogg'; Path: ptVoices),// sndOoff3
-            (FileName:               'hammer.ogg'; Path: ptSounds),// sndWhack
-            (FileName:           'Comeonthen.ogg'; Path: ptVoices),// sndComeonthen
-            (FileName:            'parachute.ogg'; Path: ptSounds),// sndParachute
-            (FileName:                 'bump.ogg'; Path: ptSounds),// sndBump
-            (FileName:            'hogchant3.ogg'; Path: ptSounds),// sndResurrector
-            (FileName:                'plane.ogg'; Path: ptSounds),// sndPlane
-            (FileName:               'TARDIS.ogg'; Path: ptSounds) // sndTardis
-            );
 var
     Ammoz: array [TAmmoType] of record
             NameId: TAmmoStrId;
@@ -2359,76 +2229,6 @@
             ejectY: 0)
         );
 
-const
-    GearKindAmmoTypeMap : array [TGearType] of TAmmoType = (    
-(*          gtFlame *)   amNothing
-(*       gtHedgehog *) , amNothing
-(*           gtMine *) , amMine
-(*           gtCase *) , amNothing
-(*     gtExplosives *) , amNothing
-(*        gtGrenade *) , amGrenade
-(*          gtShell *) , amBazooka
-(*          gtGrave *) , amNothing
-(*            gtBee *) , amBee
-(*    gtShotgunShot *) , amShotgun
-(*     gtPickHammer *) , amPickHammer
-(*           gtRope *) , amRope
-(*     gtDEagleShot *) , amDEagle
-(*       gtDynamite *) , amDynamite
-(*    gtClusterBomb *) , amClusterBomb
-(*        gtCluster *) , amClusterBomb
-(*         gtShover *) , amBaseballBat  // Shover is only used for baseball bat right now
-(*      gtFirePunch *) , amFirePunch
-(*    gtATStartGame *) , amNothing
-(*   gtATFinishGame *) , amNothing
-(*      gtParachute *) , amParachute
-(*      gtAirAttack *) , amAirAttack
-(*        gtAirBomb *) , amAirAttack
-(*      gtBlowTorch *) , amBlowTorch
-(*         gtGirder *) , amGirder
-(*       gtTeleport *) , amTeleport
-(*       gtSwitcher *) , amSwitch
-(*         gtTarget *) , amNothing
-(*         gtMortar *) , amMortar
-(*           gtWhip *) , amWhip
-(*       gtKamikaze *) , amKamikaze
-(*           gtCake *) , amCake
-(*      gtSeduction *) , amSeduction
-(*     gtWatermelon *) , amWatermelon
-(*     gtMelonPiece *) , amWatermelon
-(*    gtHellishBomb *) , amHellishBomb
-(*        gtWaterUp *) , amNothing
-(*          gtDrill *) , amDrill
-(*        gtBallGun *) , amBallgun
-(*           gtBall *) , amBallgun
-(*        gtRCPlane *) , amRCPlane
-(*gtSniperRifleShot *) , amSniperRifle
-(*        gtJetpack *) , amJetpack
-(*        gtMolotov *) , amMolotov
-(*          gtBirdy *) , amBirdy
-(*            gtEgg *) , amBirdy
-(*         gtPortal *) , amPortalGun
-(*          gtPiano *) , amPiano
-(*        gtGasBomb *) , amGasBomb
-(*    gtSineGunShot *) , amSineGun
-(*   gtFlamethrower *) , amFlamethrower
-(*          gtSMine *) , amSMine
-(*    gtPoisonCloud *) , amNothing
-(*         gtHammer *) , amHammer
-(*      gtHammerHit *) , amHammer
-(*    gtResurrector *) , amResurrector
-(*    gtPoisonCloud *) , amNothing
-(*       gtSnowball *) , amSnowball
-(*          gtFlake *) , amNothing
-(*      gtStructure *) , amStructure  // TODO - This will undoubtedly change once there is more than one structure
-(*        gtLandGun *) , amLandGun
-(*         gtTardis *) , amTardis
-(*         gtIceGun *) , amIceGun
-(*        gtAddAmmo *) , amNothing
-(*  gtGenericFaller *) , amNothing
-(*          gtKnife *) , amKnife
-    );
-
 var
     Land: TCollisionArray;
     LandPixels: TLandArray;
@@ -2462,7 +2262,6 @@
     LocalTeam: LongInt;  // last non-bot, non-extdriven clan first team
     LocalAmmo: LongInt;  // last non-bot, non-extdriven clan's first team's ammo index, updated to next upcoming hog for per-hog-ammo
     CurMinAngle, CurMaxAngle: Longword;
-    NextClan: boolean;
 
     FollowGear: PGear;
     WindBarWidth: LongInt;
@@ -2473,12 +2272,9 @@
     WaterColor, DeepWaterColor: TSDL_Color;
     SkyColor, RQSkyColor, SDSkyColor: TSDL_Color;
     SkyOffset: LongInt;
-    HorizontOffset: LongInt;
 {$IFDEF COUNTTICKS}
     cntTicks: LongWord;
 {$ENDIF}
-    cOffsetY: LongInt;
-    AFRToggle: Boolean;
 
 
     PauseTexture,
@@ -2487,9 +2283,6 @@
     cScaleFactor: GLfloat;
     SupportNPOTT: Boolean;
     Step: LongInt;
-    squaresize : LongInt;
-    numsquares : LongInt;
-    ProgrTex: PTexture;
     MissionIcons: PSDL_Surface;
     ropeIconTex: PTexture;
 
@@ -2501,24 +2294,12 @@
     defaultFrame, depthv: GLuint;
     texv: GLuint;
 
-    VisualGearLayers: array[0..6] of PVisualGear;
     lastVisualGearByUID: PVisualGear;
     vobFrameTicks, vobFramesCount, vobCount: Longword;
     vobVelocity, vobFallSpeed: LongInt;
     vobSDFrameTicks, vobSDFramesCount, vobSDCount: Longword;
     vobSDVelocity, vobSDFallSpeed: LongInt;
 
-    ControllerNumControllers: Integer;
-    ControllerEnabled: Integer;
-    ControllerNumAxes: array[0..5] of Integer;
-    //ControllerNumBalls: array[0..5] of Integer;
-    ControllerNumHats: array[0..5] of Integer;
-    ControllerNumButtons: array[0..5] of Integer;
-    ControllerAxes: array[0..5] of array[0..19] of Integer;
-    //ControllerBalls: array[0..5] of array[0..19] of array[0..1] of Integer;
-    ControllerHats: array[0..5] of array[0..19] of Byte;
-    ControllerButtons: array[0..5] of array[0..19] of Byte;
-
     DefaultBinds : TBinds;
 
     lastTurnChecksum : Longword;
--- a/hedgewars/uVisualGears.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uVisualGears.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -55,8 +55,11 @@
 implementation
 uses uSound, uMobile, uVariables, uTextures, uRender, Math, uRenderUtils, uStore, uUtils;
 
-const cExplFrameTicks = 110;
+const 
+    cExplFrameTicks = 110;
+    cSmokeZ = 499;
 var VGCounter: LongWord;
+    VisualGearLayers: array[0..6] of PVisualGear;
 
 // For better maintainability the step handlers of visual gears are stored
 // in a separate file.
--- a/hedgewars/uWorld.pas	Thu Nov 29 23:13:06 2012 -0500
+++ b/hedgewars/uWorld.pas	Thu Nov 29 23:23:19 2012 -0500
@@ -84,6 +84,10 @@
     isFirstFrame: boolean;
     AMAnimType: LongInt;
     recTexture: PTexture;
+    AmmoMenuTex     : PTexture;
+    HorizontOffset: LongInt;
+    cOffsetY: LongInt;
+    AFRToggle: Boolean;
 
 const cStereo_Sky           = 0.0500;
       cStereo_Horizon       = 0.0250;
@@ -93,6 +97,28 @@
       cStereo_Water_near    = 0.0025;
       cStereo_Outside       = -0.0400;
 
+      AMAnimDuration = 200;
+      AMHidden    = 0;//AMState values
+      AMShowingUp = 1;
+      AMShowing   = 2;
+      AMHiding    = 3;
+
+      AMTypeMaskX     = $00000001;
+      AMTypeMaskY     = $00000002;
+      AMTypeMaskAlpha = $00000004;
+      AMTypeMaskSlide = $00000008;
+
+{$IFDEF MOBILE}
+      AMSlotSize = 48;
+      AMTITLE    = 30;
+{$ELSE}
+      AMSlotSize = 32;
+{$ENDIF}
+      AMSlotPadding = (AMSlotSize - 32) shr 1;
+
+      cSendCursorPosTime = 50;
+      cCursorEdgesDist   = 100;
+
 // helper functions to create the goal/game mode string
 function AddGoal(s: ansistring; gf: longword; si: TGoalStrId; i: LongInt): ansistring;
 var t: ansistring;