breaking news, we don't support typed consts anymore
authorkoda
Tue, 01 May 2012 19:56:55 +0200
changeset 6982 8d41d22a291d
parent 6981 045e8162c9cd
child 6983 ede55af89e78
breaking news, we don't support typed consts anymore
hedgewars/ArgParsers.inc
hedgewars/GSHandlers.inc
hedgewars/SDLh.pas
hedgewars/options.inc
hedgewars/uAI.pas
hedgewars/uAIActions.pas
hedgewars/uCommandHandlers.pas
hedgewars/uConsole.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uGearsList.pas
hedgewars/uGearsRender.pas
hedgewars/uIO.pas
hedgewars/uInputHandler.pas
hedgewars/uLand.pas
hedgewars/uLandGraphics.pas
hedgewars/uLandObjects.pas
hedgewars/uLandTemplates.pas
hedgewars/uRender.pas
hedgewars/uRenderUtils.pas
hedgewars/uScript.pas
hedgewars/uStore.pas
hedgewars/uTeams.pas
hedgewars/uTextures.pas
hedgewars/uVariables.pas
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
--- a/hedgewars/ArgParsers.inc	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/ArgParsers.inc	Tue May 01 19:56:55 2012 +0200
@@ -50,10 +50,10 @@
     UserNick:= DecodeBase64(ParamStr(14));
     val(ParamStr(15), cReducedQuality);
     val(ParamStr(16), tmp);
-    cGrayScale:= false;
+    GrayScale:= false;
     if (tmp > 9) and (tmp < 16) then 
         begin
-        cGrayScale:= true;
+        GrayScale:= true;
         cStereoMode:= TStereoMode(max(0, min(ord(high(TStereoMode)), tmp-9)))
         end
     else if tmp <= 9 then 
--- a/hedgewars/GSHandlers.inc	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/GSHandlers.inc	Tue May 01 19:56:55 2012 +0200
@@ -170,14 +170,14 @@
     Gear^.Y := Gear^.Y + cDrownSpeed;
     Gear^.X := Gear^.X + Gear^.dX * cDrownSpeed;
     // Create some bubbles (0.5% might be better but causes too few bubbles sometimes)
-    if ((not SuddenDeathDmg and (cWaterOpacity < $FF))
-    or (SuddenDeathDmg and (cSDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then
+    if ((not SuddenDeathDmg and (WaterOpacity < $FF))
+    or (SuddenDeathDmg and (SDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then
         if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then
             AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble)
     else if Random(12) = 0 then
              AddVisualGear(hwRound(Gear^.X) - Gear^.Radius, hwRound(Gear^.Y) - Gear^.Radius, vgtBubble);
-    if (not SuddenDeathDmg and (cWaterOpacity > $FE))
-    or (SuddenDeathDmg and (cSDWaterOpacity > $FE))
+    if (not SuddenDeathDmg and (WaterOpacity > $FE))
+    or (SuddenDeathDmg and (SDWaterOpacity > $FE))
     or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
         DeleteGear(Gear);
     end;
@@ -690,7 +690,7 @@
                                 end
                             else Land[ly, lx]:= lf;
                         if gun then
-                            LandPixels[ry, rx]:= (cExplosionBorderColor and (not AMask)) or (p^[px] and AMask)
+                            LandPixels[ry, rx]:= (ExplosionBorderColor and (not AMask)) or (p^[px] and AMask)
                         else LandPixels[ry, rx]:= addBgColor(LandPixels[ry, rx], p^[px]);
                         end
                     else allpx:= false
@@ -1032,7 +1032,7 @@
         dec(Gear^.Health, Gear^.Damage);
         Gear^.Damage := 0
         end;
-    if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Damage < Gear^.Health) and ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cSDWaterOpacity < $FF))) then
+    if ((Gear^.State and gstDrowning) <> 0) and (Gear^.Damage < Gear^.Health) and ((not SuddenDeathDmg and (WaterOpacity < $FF)) or (SuddenDeathDmg and (SDWaterOpacity < $FF))) then
         begin
         for i:=(Gear^.Health - Gear^.Damage) * 4 downto 0 do
             begin
@@ -2815,8 +2815,6 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepKamikazeWork(Gear: PGear);
-
-const upd: Longword =   0;
 var 
     i: LongWord;
     HHGear: PGear;
--- a/hedgewars/SDLh.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/SDLh.pas	Tue May 01 19:56:55 2012 +0200
@@ -1088,13 +1088,14 @@
     exit(0);
 end;
 {$ELSE}
-function SDL_AllocFormat(format: LongWord): PSDL_PixelFormat;
 const conversionFormat: TSDL_PixelFormat = (
         palette: nil; BitsPerPixel: 32; BytesPerPixel: 4;
         Rloss: 0; Gloss: 0; Bloss: 0; Aloss: 0;
         Rshift: RShift; Gshift: GShift; Bshift: BShift; Ashift: AShift;
         RMask: RMask; GMask: GMask; BMask: BMask; AMask: AMask;
         colorkey: 0; alpha: 255);
+
+function SDL_AllocFormat(format: LongWord): PSDL_PixelFormat;
 begin
     format:= format;
     exit(@conversionFormat);
--- a/hedgewars/options.inc	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/options.inc	Tue May 01 19:56:55 2012 +0200
@@ -17,7 +17,7 @@
  *)
 
 {$IFDEF FPC}
-    {$WRITEABLECONST ON} 
+    {$WRITEABLECONST OFF} 
     {$MODE OBJFPC}
 {$ELSE}
     {$ERROR Only Free Pascal supported!}
--- a/hedgewars/uAI.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uAI.pas	Tue May 01 19:56:55 2012 +0200
@@ -408,8 +408,7 @@
 end;
 
 procedure ProcessBot;
-const StartTicks: Longword = 0;
-      cStopThinkTime = 40;
+const cStopThinkTime = 40;
 begin
 with CurrentHedgehog^ do
     if (Gear <> nil)
@@ -439,6 +438,7 @@
 procedure initModule;
 begin
     hasThread:= 0;
+    StartTicks:= 0;
     ThinkThread:= ThinkThread;
 end;
 
--- a/hedgewars/uAIActions.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uAIActions.pas	Tue May 01 19:56:55 2012 +0200
@@ -126,8 +126,6 @@
 end;
 
 procedure CheckHang(Me: PGear);
-const PrevX: LongInt = 0;
-      timedelta: Longword = 0;
 begin
 if hwRound(Me^.X) <> PrevX then
     begin
--- a/hedgewars/uCommandHandlers.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uCommandHandlers.pas	Tue May 01 19:56:55 2012 +0200
@@ -41,7 +41,6 @@
 end;
 
 procedure chQuit(var s: shortstring);
-const prevGState: TGameState = gsConfirm;
 begin
     s:= s; // avoid compiler hint
     if (GameState = gsGame) or (GameState = gsChat) then
--- a/hedgewars/uConsole.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uConsole.pas	Tue May 01 19:56:55 2012 +0200
@@ -31,8 +31,8 @@
 implementation
 uses Types, uVariables, uUtils {$IFDEF ANDROID}, log in 'log.pas'{$ENDIF};
 
-const cLineWidth: LongInt = 0;
-    cLinesCount = 8;
+const cLinesCount = 8;
+var   cLineWidth: LongInt;
 
 type
     TTextLine = record
--- a/hedgewars/uConsts.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uConsts.pas	Tue May 01 19:56:55 2012 +0200
@@ -51,7 +51,6 @@
     cWhiteColor           : Longword = $FFFFFFFF;
     cYellowColor          : Longword = $FFFFFF00;
     cNearBlackColor       : Longword = $FF000010;
-    cExplosionBorderColor : LongWord = $FF808080;
 
 {$WARNINGS OFF}
     cAirPlaneSpeed: hwFloat = (isNegative: false; QWordValue:   3006477107); // 1.4
@@ -115,8 +114,6 @@
     cVisibleWater       : LongInt = 128;
     cCursorEdgesDist    : LongInt = 100;
     cTeamHealthWidth    : LongInt = 128;
-    cWaterOpacity       : byte = $80;
-    cSDWaterOpacity     : byte = $80;
 
     cifRandomize = $00000001;
     cifTheme     = $00000002;
@@ -124,16 +121,10 @@
     cifAllInited = cifRandomize or cifTheme or cifMap;
 
     cTransparentColor: Longword = $00000000;
-    cGrayScale: Boolean = false;
 
     RGB_LUMINANCE_RED    = 0.212671;
     RGB_LUMINANCE_GREEN  = 0.715160;
     RGB_LUMINANCE_BLUE   = 0.072169;
-(*
-    RGB_LUMINANCE_RED    = 0.3333333333;
-    RGB_LUMINANCE_GREEN  = 0.3333333333;
-    RGB_LUMINANCE_BLUE   = 0.3333333333;
-*)
 
     cMaxTeams        = 8;
     cMaxHHIndex      = 7;
@@ -157,6 +148,11 @@
 
     cKeyMaxIndex = 1023;
 
+    cHHFileName = 'Hedgehog';
+    cCHFileName = 'Crosshair';
+    cThemeCFGFilename = 'theme.cfg';
+
+    cFontBorder = 2;
 
     // do not change this value
     cDefaultZoomLevel = 2.0;
@@ -316,6 +312,10 @@
     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/uGears.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uGears.pas	Tue May 01 19:56:55 2012 +0200
@@ -69,6 +69,14 @@
 procedure ShotgunShot(Gear: PGear); forward;
 procedure doStepCase(Gear: PGear); forward;
 
+
+var delay: LongWord;
+    delay2: LongWord;
+    step: (stDelay, stChDmg, stSweep, stTurnReact,
+    stAfterDelay, stChWin, stWater, stChWin2, stHealth,
+    stSpawn, stNTurn);
+    upd: Longword;
+
 // For better maintainability the step handlers of gears are stored in
 // separate files.
 // Note: step handlers of gears that are hedgehogs are in a different file
@@ -172,11 +180,6 @@
 end;
 
 procedure ProcessGears;
-const delay: LongWord = 0;
-    delay2: LongWord = 0;
-    step: (stDelay, stChDmg, stSweep, stTurnReact,
-    stAfterDelay, stChWin, stWater, stChWin2, stHealth,
-    stSpawn, stNTurn) = stDelay;
 var Gear, t: PGear;
     i, AliveCount: LongInt;
     s: shortstring;
@@ -1315,6 +1318,12 @@
 
     AllInactive:= false;
     PrvInactive:= false;
+
+    //typed const
+    delay:= 0;
+    delay2:= 0;
+    step:= stDelay;
+    upd:= 0;
 end;
 
 procedure freeModule;
--- a/hedgewars/uGearsHedgehog.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uGearsHedgehog.pas	Tue May 01 19:56:55 2012 +0200
@@ -634,8 +634,6 @@
      end
 end;
 
-const StepTicks: LongWord = 0;
-
 procedure HedgehogStep(Gear: PGear);
 var PrevdX: LongInt;
     CurWeapon: PAmmo;
--- a/hedgewars/uGearsList.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uGearsList.pas	Tue May 01 19:56:55 2012 +0200
@@ -72,7 +72,6 @@
 end;
     
 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
-const Counter: Longword = 0;
 var gear: PGear;
 begin
 inc(Counter);
@@ -502,7 +501,7 @@
             begin
             t:= max(Gear^.Damage, Gear^.Health);
             Gear^.Damage:= t;
-            if ((not SuddenDeathDmg and (cWaterOpacity < $FF)) or (SuddenDeathDmg and (cWaterOpacity < $FF)))
+            if ((not SuddenDeathDmg and (WaterOpacity < $FF)) or (SuddenDeathDmg and (WaterOpacity < $FF)))
             and (hwRound(Gear^.Y) < cWaterLine + 256) then
                 spawnHealthTagForHH(Gear, t);
             end;
--- a/hedgewars/uGearsRender.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uGearsRender.pas	Tue May 01 19:56:55 2012 +0200
@@ -1119,9 +1119,9 @@
       gtNapalmBomb: DrawRotated(sprNapalmBomb, x, y, 0, DxDy2Angle(Gear^.dY, Gear^.dX));
            gtFlake: if Gear^.State and (gstDrowning or gstTmpFlag) <> 0  then
                         begin
-                        Tint((cExplosionBorderColor shr RShift) and $FF, 
-                             (cExplosionBorderColor shr GShift) and $FF, 
-                             (cExplosionBorderColor shr BShift) and $FF, 
+                        Tint((ExplosionBorderColor shr RShift) and $FF, 
+                             (ExplosionBorderColor shr GShift) and $FF, 
+                             (ExplosionBorderColor shr BShift) and $FF, 
                              $FF);
                         // Needs a nicer white texture to tint
                         DrawRotatedTextureF(SpritesData[sprSnowDust].Texture, 1, 0, 0, x, y, 0, 1, 8, 8, Gear^.DirAngle);
--- a/hedgewars/uIO.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uIO.pas	Tue May 01 19:56:55 2012 +0200
@@ -143,27 +143,26 @@
 end;
 
 procedure IPCCheckSock;
-const ss: shortstring = '';
 var i: LongInt;
     s: shortstring;
 begin
-if IPCSock = nil then
-    exit;
+    if IPCSock = nil then
+        exit;
 
-fds^.numsockets:= 0;
-SDLNet_AddSocket(fds, IPCSock);
+    fds^.numsockets:= 0;
+    SDLNet_AddSocket(fds, IPCSock);
 
-while SDLNet_CheckSockets(fds, 0) > 0 do
+    while SDLNet_CheckSockets(fds, 0) > 0 do
     begin
-    i:= SDLNet_TCP_Recv(IPCSock, @s[1], 255 - Length(ss));
-    if i > 0 then
+        i:= SDLNet_TCP_Recv(IPCSock, @s[1], 255 - Length(SocketString));
+        if i > 0 then
         begin
-        s[0]:= char(i);
-        ss:= ss + s;
-        while (Length(ss) > 1) and (Length(ss) > byte(ss[1])) do
+            s[0]:= char(i);
+            SocketString:= SocketString + s;
+            while (Length(SocketString) > 1) and (Length(SocketString) > byte(SocketString[1])) do
             begin
-            ParseIPCCommand(copy(ss, 2, byte(ss[1])));
-            Delete(ss, 1, Succ(byte(ss[1])))
+                ParseIPCCommand(copy(SocketString, 2, byte(SocketString[1])));
+                Delete(SocketString, 1, Succ(byte(SocketString[1])))
             end
         end
     else
@@ -435,8 +434,9 @@
 
     headcmd:= nil;
     lastcmd:= nil;
-    isPonged:= false;   // was const
-
+    isPonged:= false;
+    SocketString:= '';
+    
     hiTicks:= 0;
     SendEmptyPacketTicks:= 0;
 end;
--- a/hedgewars/uInputHandler.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uInputHandler.pas	Tue May 01 19:56:55 2012 +0200
@@ -48,7 +48,7 @@
 var tkbd, tkbdn: TKeyboardState;
     quitKeyCode: Byte;
     KeyNames: array [0..cKeyMaxIndex] of string[15];
-    
+    CurrentBinds: TBinds;
 
 function KeyNameToCode(name: shortstring): word;
 var code: Word;
@@ -450,31 +450,6 @@
 begin
     wheelUp:= false;
     wheelDown:= false;
-{$IFDEF HWLIBRARY}
-    // this function is called by HW_allKeysUp so be careful
-
-    // mouse emulation
-    leftClick:= false;
-    middleClick:= false;
-    rightClick:= false;
-
-    // arrow key emulation
-    upKey:= false;
-    downKey:= false;
-    rightKey:= false;
-    leftKey:= false;
-    preciseKey:= false;
-
-    // action key emulation
-    backspaceKey:= false;
-    spaceKey:= false;
-    enterKey:= false;
-    tabKey:= false;
-
-    // other key emulation
-    chatAction:= false;
-    pauseAction:= false;
-{$ENDIF}
 end;
 
 procedure freeModule;
--- a/hedgewars/uLand.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uLand.pas	Tue May 01 19:56:55 2012 +0200
@@ -57,7 +57,7 @@
     // freed in freeModule() below
     LandBackSurface:= LoadImage(UserPathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
     if LandBackSurface = nil then LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
-    if (LandBackSurface <> nil) and cGrayScale then Surface2GrayScale(LandBackSurface);
+    if (LandBackSurface <> nil) and GrayScale then Surface2GrayScale(LandBackSurface);
 
     tmpsurf:= LoadImage(UserPathz[ptCurrTheme] + '/Border', ifIgnoreCaps or ifTransparent);
     if tmpsurf = nil then tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent);
@@ -458,7 +458,7 @@
         LandBackSurface:= LoadImage(UserPathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
         if LandBackSurface = nil then
             LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent);
-        if (LandBackSurface <> nil) and cGrayScale then
+        if (LandBackSurface <> nil) and GrayScale then
             Surface2GrayScale(LandBackSurface)
         end;
 end;
@@ -647,7 +647,7 @@
 
 FreeLandObjects;
 
-if cGrayScale then
+if GrayScale then
     begin
     if (cReducedQuality and rqBlurryLand) = 0 then
         for x:= leftX to rightX do
--- a/hedgewars/uLandGraphics.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uLandGraphics.pas	Tue May 01 19:56:55 2012 +0200
@@ -328,9 +328,9 @@
         if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
             begin
             if (cReducedQuality and rqBlurryLand) = 0 then
-                LandPixels[t, i]:= cExplosionBorderColor
+                LandPixels[t, i]:= ExplosionBorderColor
             else
-                LandPixels[t div 2, i div 2]:= cExplosionBorderColor;
+                LandPixels[t div 2, i div 2]:= ExplosionBorderColor;
 
             Land[t, i]:= Land[t, i] or lfDamaged;
             //Despeckle(i, t);
@@ -343,9 +343,9 @@
         if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
             begin
             if (cReducedQuality and rqBlurryLand) = 0 then
-                LandPixels[t, i]:= cExplosionBorderColor
+                LandPixels[t, i]:= ExplosionBorderColor
             else
-                LandPixels[t div 2, i div 2]:= cExplosionBorderColor;
+                LandPixels[t div 2, i div 2]:= ExplosionBorderColor;
             Land[t, i]:= Land[t, i] or lfDamaged;
             //Despeckle(i, t);
             LandDirty[t div 32, i div 32]:= 1;
@@ -357,9 +357,9 @@
         if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
             begin
             if (cReducedQuality and rqBlurryLand) = 0 then
-                LandPixels[t, i]:= cExplosionBorderColor
+                LandPixels[t, i]:= ExplosionBorderColor
             else
-               LandPixels[t div 2, i div 2]:= cExplosionBorderColor;
+               LandPixels[t div 2, i div 2]:= ExplosionBorderColor;
 
             Land[t, i]:= Land[t, i] or lfDamaged;
             //Despeckle(i, t);
@@ -372,9 +372,9 @@
         if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
             begin
             if (cReducedQuality and rqBlurryLand) = 0 then
-                LandPixels[t, i]:= cExplosionBorderColor
+                LandPixels[t, i]:= ExplosionBorderColor
             else
-                LandPixels[t div 2, i div 2]:= cExplosionBorderColor;
+                LandPixels[t div 2, i div 2]:= ExplosionBorderColor;
 
             Land[t, i]:= Land[t, i] or lfDamaged;
             //Despeckle(i, y - dy);
@@ -503,9 +503,9 @@
             if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then
                 begin
                  if (cReducedQuality and rqBlurryLand) = 0 then
-                    LandPixels[ty, tx]:= cExplosionBorderColor
+                    LandPixels[ty, tx]:= ExplosionBorderColor
                 else
-                    LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor;
+                    LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor;
 
                 Land[ty, tx]:= Land[ty, tx] or lfDamaged;
                 LandDirty[ty div 32, tx div 32]:= 1;
@@ -555,9 +555,9 @@
             LandDirty[ty div 32, tx div 32]:= 1
             end;
         if (cReducedQuality and rqBlurryLand) = 0 then
-            LandPixels[ty, tx]:= cExplosionBorderColor
+            LandPixels[ty, tx]:= ExplosionBorderColor
         else
-            LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
+            LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor
         end
     end;
     nx:= nx - dY;
@@ -581,9 +581,9 @@
             if despeckle then
                 LandDirty[ty div 32, tx div 32]:= 1;
             if (cReducedQuality and rqBlurryLand) = 0 then
-                LandPixels[ty, tx]:= cExplosionBorderColor
+                LandPixels[ty, tx]:= ExplosionBorderColor
             else
-                LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
+                LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor
             end
         end;
     X:= nx;
@@ -624,9 +624,9 @@
         if despeckle then
             LandDirty[ty div 32, tx div 32]:= 1;
         if (cReducedQuality and rqBlurryLand) = 0 then
-            LandPixels[ty, tx]:= cExplosionBorderColor
+            LandPixels[ty, tx]:= ExplosionBorderColor
         else
-            LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
+            LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor
         end
         end;
     nx:= nx - dY;
@@ -650,9 +650,9 @@
         if despeckle then
             LandDirty[ty div 32, tx div 32]:= 1;
         if (cReducedQuality and rqBlurryLand) = 0 then
-            LandPixels[ty, tx]:= cExplosionBorderColor
+            LandPixels[ty, tx]:= ExplosionBorderColor
         else
-            LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
+            LandPixels[ty div 2, tx div 2]:= ExplosionBorderColor
         end
     end;
     nx:= nx - dY;
@@ -824,12 +824,12 @@
         if (cReducedQuality and rqBlurryLand) = 0 then
             begin
             if ((LandPixels[y,x] and AMask) shr AShift) < 10 then
-                LandPixels[y,x]:= (cExplosionBorderColor and (not AMask)) or (128 shl AShift)
+                LandPixels[y,x]:= (ExplosionBorderColor and (not AMask)) or (128 shl AShift)
             else
                 LandPixels[y,x]:=
-                                (((((LandPixels[y,x] and RMask shr RShift) div 2)+((cExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or
-                                (((((LandPixels[y,x] and GMask shr GShift) div 2)+((cExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or
-                                (((((LandPixels[y,x] and BMask shr BShift) div 2)+((cExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift)
+                                (((((LandPixels[y,x] and RMask shr RShift) div 2)+((ExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or
+                                (((((LandPixels[y,x] and GMask shr GShift) div 2)+((ExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or
+                                (((((LandPixels[y,x] and BMask shr BShift) div 2)+((ExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift)
             end;
         if (Land[y, x-1] = lfObject) then
             Land[y,x]:= lfObject
@@ -850,12 +850,12 @@
         if (cReducedQuality and rqBlurryLand) = 0 then
             begin
             if ((LandPixels[y,x] and AMask) shr AShift) < 10 then
-                LandPixels[y,x]:= (cExplosionBorderColor and (not AMask)) or (64 shl AShift)
+                LandPixels[y,x]:= (ExplosionBorderColor and (not AMask)) or (64 shl AShift)
             else
                 LandPixels[y,x]:=
-                                (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((cExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or
-                                (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((cExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or
-                                (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((cExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift)
+                                (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((ExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or
+                                (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((ExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or
+                                (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((ExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift)
             end;
         if (Land[y, x-1] = lfObject) then
             Land[y, x]:= lfObject
@@ -876,9 +876,9 @@
     or (((Land[y, x+1] and lfDamaged) <> 0) and (((Land[y-1,x] and lfDamaged) <> 0) or ((Land[y+1,x] and lfDamaged) <> 0)))) then
         begin
         LandPixels[y,x]:=
-                        (((((LandPixels[y,x] and RMask shr RShift) div 2)+((cExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or
-                        (((((LandPixels[y,x] and GMask shr GShift) div 2)+((cExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or
-                        (((((LandPixels[y,x] and BMask shr BShift) div 2)+((cExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift)
+                        (((((LandPixels[y,x] and RMask shr RShift) div 2)+((ExplosionBorderColor and RMask) shr RShift) div 2) and $FF) shl RShift) or
+                        (((((LandPixels[y,x] and GMask shr GShift) div 2)+((ExplosionBorderColor and GMask) shr GShift) div 2) and $FF) shl GShift) or
+                        (((((LandPixels[y,x] and BMask shr BShift) div 2)+((ExplosionBorderColor and BMask) shr BShift) div 2) and $FF) shl BShift) or ($FF shl AShift)
         end
     else if ((((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y+1,x-1] and lfDamaged) <> 0) and ((Land[y+2,x] and lfDamaged) <> 0))
     or (((Land[y, x-1] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y-2,x] and lfDamaged) <> 0))
@@ -890,9 +890,9 @@
     or (((Land[y-1, x] and lfDamaged) <> 0) and ((Land[y-1,x-1] and lfDamaged) <> 0) and ((Land[y,x-2] and lfDamaged) <> 0))) then
         begin
         LandPixels[y,x]:=
-                        (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((cExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or
-                        (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((cExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or
-                        (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((cExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift)
+                        (((((LandPixels[y,x] and RMask shr RShift) * 3 div 4)+((ExplosionBorderColor and RMask) shr RShift) div 4) and $FF) shl RShift) or
+                        (((((LandPixels[y,x] and GMask shr GShift) * 3 div 4)+((ExplosionBorderColor and GMask) shr GShift) div 4) and $FF) shl GShift) or
+                        (((((LandPixels[y,x] and BMask shr BShift) * 3 div 4)+((ExplosionBorderColor and BMask) shr BShift) div 4) and $FF) shl BShift) or ($FF shl AShift)
         end
     end
 end;
--- a/hedgewars/uLandObjects.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uLandObjects.pas	Tue May 01 19:56:55 2012 +0200
@@ -406,7 +406,7 @@
 
 AddProgress;
 // Set default water greyscale values
-if cGrayScale then
+if GrayScale then
     begin
     for i:= 0 to 3 do
         begin
@@ -461,7 +461,7 @@
         SkyColor.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
         Delete(s, 1, i);
         SkyColor.b:= StrToInt(Trim(s));
-        if cGrayScale
+        if GrayScale
             then
             begin
             t:= round(SkyColor.r * RGB_LUMINANCE_RED + SkyColor.g * RGB_LUMINANCE_GREEN + SkyColor.b * RGB_LUMINANCE_BLUE);
@@ -485,7 +485,7 @@
         c2.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
         Delete(s, 1, i);
         c2.b:= StrToInt(Trim(s));
-        if cGrayScale then
+        if GrayScale then
             begin
             t:= round(SkyColor.r * RGB_LUMINANCE_RED + SkyColor.g * RGB_LUMINANCE_GREEN + SkyColor.b * RGB_LUMINANCE_BLUE);
             if t > 255 then
@@ -494,7 +494,7 @@
             c2.g:= t;
             c2.b:= t
             end;
-        cExplosionBorderColor:= c2.value or AMask;
+        ExplosionBorderColor:= c2.value or AMask;
         end
     else if key = 'water-top' then
         begin
@@ -506,7 +506,7 @@
         Delete(s, 1, i);
         WaterColorArray[0].b:= StrToInt(Trim(s));
         WaterColorArray[0].a := 255;
-        if cGrayScale then
+        if GrayScale then
             begin
             t:= round(WaterColorArray[0].r * RGB_LUMINANCE_RED + WaterColorArray[0].g * RGB_LUMINANCE_GREEN + WaterColorArray[0].b * RGB_LUMINANCE_BLUE);
             if t > 255 then
@@ -527,7 +527,7 @@
         Delete(s, 1, i);
         WaterColorArray[2].b:= StrToInt(Trim(s));
         WaterColorArray[2].a := 255;
-        if cGrayScale then
+        if GrayScale then
             begin
             t:= round(WaterColorArray[2].r * RGB_LUMINANCE_RED + WaterColorArray[2].g * RGB_LUMINANCE_GREEN + WaterColorArray[2].b * RGB_LUMINANCE_BLUE);
             if t > 255 then
@@ -540,8 +540,8 @@
         end
     else if key = 'water-opacity' then
         begin
-        cWaterOpacity:= StrToInt(Trim(s));
-        cSDWaterOpacity:= cWaterOpacity
+        WaterOpacity:= StrToInt(Trim(s));
+        SDWaterOpacity:= WaterOpacity
         end
     else if key = 'music' then
         MusicFN:= Trim(s)
@@ -658,7 +658,7 @@
         Delete(s, 1, i);
         SDWaterColorArray[0].b:= StrToInt(Trim(s));
         SDWaterColorArray[0].a := 255;
-        if cGrayScale then
+        if GrayScale then
             begin
             t:= round(SDWaterColorArray[0].r * RGB_LUMINANCE_RED + SDWaterColorArray[0].g * RGB_LUMINANCE_GREEN + SDWaterColorArray[0].b * RGB_LUMINANCE_BLUE);
             if t > 255 then
@@ -679,7 +679,7 @@
         Delete(s, 1, i);
         SDWaterColorArray[2].b:= StrToInt(Trim(s));
         SDWaterColorArray[2].a := 255;
-        if cGrayScale then
+        if GrayScale then
             begin
             t:= round(SDWaterColorArray[2].r * RGB_LUMINANCE_RED + SDWaterColorArray[2].g * RGB_LUMINANCE_GREEN + SDWaterColorArray[2].b * RGB_LUMINANCE_BLUE);
             if t > 255 then
@@ -691,7 +691,7 @@
         SDWaterColorArray[3]:= SDWaterColorArray[2];
         end
     else if key = 'sd-water-opacity' then
-        cSDWaterOpacity:= StrToInt(Trim(s))
+        SDWaterOpacity:= StrToInt(Trim(s))
     else if key = 'sd-clouds' then
         cSDCloudsNumber:= Word(StrToInt(Trim(s))) * cScreenSpace div LAND_WIDTH
     else if key = 'sd-flakes' then
@@ -724,7 +724,7 @@
             RQSkyColor.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
             Delete(s, 1, i);
             RQSkyColor.b:= StrToInt(Trim(s));
-            if cGrayScale then
+            if GrayScale then
                 begin
                 t:= round(RQSkyColor.r * RGB_LUMINANCE_RED + RQSkyColor.g * RGB_LUMINANCE_GREEN + RQSkyColor.b * RGB_LUMINANCE_BLUE);
                 if t > 255 then
--- a/hedgewars/uLandTemplates.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uLandTemplates.pas	Tue May 01 19:56:55 2012 +0200
@@ -1573,7 +1573,7 @@
       );
 
 ////////////////////////////////////////////////////////////////////////
-const EdgeTemplates: array[0..42] of TEdgeTemplate =
+var EdgeTemplates: array[0..42] of TEdgeTemplate =
       (
        (BasePoints: @Template0Points;
         BasePointsCount: Succ(High(Template0Points));
--- a/hedgewars/uRender.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uRender.pas	Tue May 01 19:56:55 2012 +0200
@@ -493,17 +493,14 @@
 end;
 
 procedure Tint(r, g, b, a: Byte); inline;
-const 
-    lastTint: Longword = 0;
-var 
-    nc, tw: Longword;
+var nc, tw: Longword;
 begin
 nc:= (a shl 24) or (b shl 16) or (g shl 8) or r;
 
 if nc = lastTint then
     exit;
 
-if cGrayScale then
+if GrayScale then
     begin
     tw:= round(r * RGB_LUMINANCE_RED + g * RGB_LUMINANCE_GREEN + b * RGB_LUMINANCE_BLUE);
     if tw > 255 then
--- a/hedgewars/uRenderUtils.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uRenderUtils.pas	Tue May 01 19:56:55 2012 +0200
@@ -76,8 +76,8 @@
     if (maxLength <> 0) and (w > maxLength) then w := maxLength;
     finalRect.x:= X;
     finalRect.y:= Y;
-    finalRect.w:= w + FontBorder * 2 + 4;
-    finalRect.h:= h + FontBorder * 2;
+    finalRect.w:= w + cFontBorder * 2 + 4;
+    finalRect.h:= h + cFontBorder * 2;
     textRect.x:= X;
     textRect.y:= Y;
     textRect.w:= w;
@@ -87,15 +87,15 @@
     clr.g:= (Color shr 8) and $FF;
     clr.b:= Color and $FF;
     tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(s), clr);
-    finalRect.x:= X + FontBorder + 2;
-    finalRect.y:= Y + FontBorder;
+    finalRect.x:= X + cFontBorder + 2;
+    finalRect.y:= Y + cFontBorder;
     SDLTry(tmpsurf <> nil, true);
     SDL_UpperBlit(tmpsurf, @textRect, Surface, @finalRect);
     SDL_FreeSurface(tmpsurf);
     finalRect.x:= X;
     finalRect.y:= Y;
-    finalRect.w:= w + FontBorder * 2 + 4;
-    finalRect.h:= h + FontBorder * 2;
+    finalRect.w:= w + cFontBorder * 2 + 4;
+    finalRect.h:= h + cFontBorder * 2;
     WriteInRoundRect:= finalRect;
 end;
 
@@ -244,7 +244,7 @@
     TTF_SizeUTF8(Fontz[font].Handle, Str2PChar(s), @w, @h);
     if (maxLength <> 0) and (w > maxLength) then w := maxLength;
 
-    finalSurface:= SDL_CreateRGBSurface(SDL_SWSURFACE, w + FontBorder * 2 + 4, h + FontBorder * 2,
+    finalSurface:= SDL_CreateRGBSurface(SDL_SWSURFACE, w + cFontBorder * 2 + 4, h + cFontBorder * 2,
             32, RMask, GMask, BMask, AMask);
 
     TryDo(finalSurface <> nil, 'RenderString: fail to create surface', true);
--- a/hedgewars/uScript.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uScript.pas	Tue May 01 19:56:55 2012 +0200
@@ -1713,7 +1713,7 @@
     exit;
 
 // push game variables so they may be modified by the script
-ScriptSetInteger('BorderColor', cExplosionBorderColor);
+ScriptSetInteger('BorderColor', ExplosionBorderColor);
 ScriptSetInteger('GameFlags', GameFlags);
 ScriptSetString('Seed', cSeed);
 ScriptSetInteger('TemplateFilter', cTemplateFilter);
--- a/hedgewars/uStore.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uStore.pas	Tue May 01 19:56:55 2012 +0200
@@ -57,10 +57,10 @@
 begin
 w:= 0; h:= 0; // avoid compiler hints
 TTF_SizeUTF8(Fontz[Font].Handle, Str2PChar(s), @w, @h);
-finalRect.x:= X + FontBorder + 2;
-finalRect.y:= Y + FontBorder;
-finalRect.w:= w + FontBorder * 2 + 4;
-finalRect.h:= h + FontBorder * 2;
+finalRect.x:= X + cFontBorder + 2;
+finalRect.y:= Y + cFontBorder;
+finalRect.w:= w + cFontBorder * 2 + 4;
+finalRect.h:= h + cFontBorder * 2;
 clr.r:= Color shr 16;
 clr.g:= (Color shr 8) and $FF;
 clr.b:= Color and $FF;
@@ -71,8 +71,8 @@
 SDL_FreeSurface(tmpsurf);
 finalRect.x:= X;
 finalRect.y:= Y;
-finalRect.w:= w + FontBorder * 2 + 4;
-finalRect.h:= h + FontBorder * 2;
+finalRect.w:= w + cFontBorder * 2 + 4;
+finalRect.h:= h + cFontBorder * 2;
 WriteInRect:= finalRect
 end;
 
@@ -827,8 +827,8 @@
 
 w:= 0;
 h:= 0;
-wa:= FontBorder * 2 + 4;
-ha:= FontBorder * 2;
+wa:= cFontBorder * 2 + 4;
+ha:= cFontBorder * 2;
 
 i:= 0; j:= 0; // avoid compiler hints
 
@@ -886,9 +886,9 @@
 DrawRoundRect(@r, cWhiteColor, cNearBlackColor, tmpsurf, true);
 
 // render caption
-r:= WriteInRect(tmpsurf, 36 + FontBorder + 2, ha, $ffffffff, font, caption);
+r:= WriteInRect(tmpsurf, 36 + cFontBorder + 2, ha, $ffffffff, font, caption);
 // render sub caption
-r:= WriteInRect(tmpsurf, 36 + FontBorder + 2, r.y + r.h, $ffc7c7c7, font, subcaption);
+r:= WriteInRect(tmpsurf, 36 + cFontBorder + 2, r.y + r.h, $ffc7c7c7, font, subcaption);
 
 // render all description lines
 tmpdesc:= description;
@@ -899,21 +899,21 @@
     r2:= r;
     if tmpline <> '' then
         begin
-        r:= WriteInRect(tmpsurf, FontBorder + 2, r.y + r.h, $ff707070, font, tmpline);
+        r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, $ff707070, font, tmpline);
 
         // render highlighted caption (if there is a ':')
         tmpline2:= '';
         SplitByChar(tmpline, tmpline2, ':');
         if tmpline2 <> '' then
-            WriteInRect(tmpsurf, FontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, tmpline + ':');
+            WriteInRect(tmpsurf, cFontBorder + 2, r2.y + r2.h, $ffc7c7c7, font, tmpline + ':');
         end
     end;
 
 if extra <> '' then
-    r:= WriteInRect(tmpsurf, FontBorder + 2, r.y + r.h, extracolor, font, extra);
+    r:= WriteInRect(tmpsurf, cFontBorder + 2, r.y + r.h, extracolor, font, extra);
 
-r.x:= FontBorder + 6;
-r.y:= FontBorder + 4;
+r.x:= cFontBorder + 6;
+r.y:= cFontBorder + 4;
 r.w:= 32;
 r.h:= 32;
 SDL_FillRect(tmpsurf, @r, $ffffffff);
--- a/hedgewars/uTeams.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uTeams.pas	Tue May 01 19:56:55 2012 +0200
@@ -39,7 +39,7 @@
 uses uLocale, uAmmos, uChat, uMobile, uVariables, uUtils, uIO, uCaptions, uCommands, uDebug, uScript,
     uGearsUtils, uGearsList{$IFDEF SDL13}, uTouch{$ENDIF};
 
-const MaxTeamHealth: LongInt = 0;
+var MaxTeamHealth: LongInt;
 
 function CheckForWin: boolean;
 var AliveClan: PClan;
@@ -624,6 +624,7 @@
 LocalAmmo:= -1;
 GameOver:= false;
 NextClan:= true;
+MaxTeamHealth:= 0;
 end;
 
 procedure freeModule;
--- a/hedgewars/uTextures.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uTextures.pas	Tue May 01 19:56:55 2012 +0200
@@ -156,7 +156,7 @@
 
 fromP4:= Surf^.pixels;
 
-if cGrayScale then
+if GrayScale then
     Surface2GrayScale(Surf);
 
 if (not SupportNPOTT) and (not (isPowerOf2(Surf^.w) and isPowerOf2(Surf^.h))) then
--- a/hedgewars/uVariables.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uVariables.pas	Tue May 01 19:56:55 2012 +0200
@@ -110,6 +110,22 @@
 
     GameTicks   : LongWord;
 
+    // originally typed consts
+    CharArray: array[byte] of Char;
+    LastTint: Longword;
+    SocketString: shortstring;
+    VGCounter: Longword;
+    PrevX: LongInt;
+    timedelta: Longword;
+    StartTicks: Longword;
+    Counter: Longword;
+    StepTicks: LongWord;
+    ExplosionBorderColor: LongWord;
+    WaterOpacity: byte;
+    SDWaterOpacity: byte;
+    prevGState: TGameState;
+    GrayScale: Boolean;
+
     // originally from uConsts
     Pathz: array[TPathType] of shortstring;
     UserPathz: array[TPathType] of shortstring;
@@ -194,6 +210,17 @@
 
     LuaGoals        : shortstring;
 
+    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 );
+
 /////////////////////////////////////
 //Buttons
 {$IFDEF USE_TOUCH_INTERFACE}
@@ -203,14 +230,11 @@
     firebutton, jumpWidget, AMWidget          : TOnScreenWidget;
     pauseButton, utilityWidget                : TOnScreenWidget;
 {$ENDIF}
+    AMAnimType      : LongInt;
 
-    AMAnimType      : LongInt;
+
 const
-    cHHFileName = 'Hedgehog';
-    cCHFileName = 'Crosshair';
-    cThemeCFGFilename = 'theme.cfg';
-
-    FontBorder = 2;
+    // these consts are here because they would cause circular dependencies in uConsts/uTypes
     cPathz: array[TPathType] of shortstring = (
         '',                              // ptNone
         '',                              // ptData
@@ -236,20 +260,6 @@
         'Graphics/Buttons'                // ptButton
     );
 
-    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);
-
-    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 );
-
     Fontz: array[THWFont] of THHFont = (
             (Handle: nil;
             Height: 12;
@@ -279,6 +289,7 @@
             {$ENDIF}
             );
 
+var
     SpritesData: array[TSprite] of record
             FileName: string[15];
             Path, AltPath: TPathType;
@@ -664,7 +675,7 @@
             Width: 3; Height: 17; imageWidth: 3; imageHeight: 17; saveSurf: false; priority: tpLow; getDimensions: false; getImageDimensions: false) // sprSlider
             );
 
-
+const
     Wavez: array [TWave] of record
             Sprite: TSprite;
             FramesCount: Longword;
@@ -801,7 +812,7 @@
             (FileName:                'plane.ogg'; Path: ptSounds),// sndPlane
             (FileName:               'TARDIS.ogg'; Path: ptSounds) // sndTardis
             );
-
+var
     Ammoz: array [TAmmoType] of record
             NameId: TAmmoStrId;
             NameTex: PTexture;
@@ -2297,6 +2308,7 @@
             ejectY: -3)
         );
 
+const
     GearKindAmmoTypeMap : array [TGearType] of TAmmoType = (    
 (*          gtFlame *)   amNothing
 (*       gtHedgehog *) , amNothing
@@ -2443,7 +2455,6 @@
     vobSDFrameTicks, vobSDFramesCount, vobSDCount: Longword;
     vobSDVelocity, vobSDFallSpeed: LongInt;
 
-
     hideAmmoMenu: boolean;
     wheelUp: boolean;
     wheelDown: boolean;
@@ -2459,29 +2470,7 @@
     ControllerHats: array[0..5] of array[0..19] of Byte;
     ControllerButtons: array[0..5] of array[0..19] of Byte;
 
-    DefaultBinds, CurrentBinds: TBinds;
-
-    coeff: LongInt;
-
-{$IFDEF HWLIBRARY}
-    leftClick: boolean;
-    middleClick: boolean;
-    rightClick: boolean;
-
-    upKey: boolean;
-    downKey: boolean;
-    rightKey: boolean;
-    leftKey: boolean;
-    preciseKey: boolean;
-
-    backspaceKey: boolean;
-    spaceKey: boolean;
-    enterKey: boolean;
-    tabKey: boolean;
-
-    chatAction: boolean;
-    pauseAction: boolean;
-{$ENDIF}
+    DefaultBinds : TBinds;
 
 var trammo:  array[TAmmoStrId] of ansistring;   // name of the weapon
     trammoc: array[TAmmoStrId] of ansistring;   // caption of the weapon
@@ -2640,6 +2629,16 @@
     vobSDVelocity:= 15;
     vobSDFallSpeed:= 250;
 
+    PrevX:= 0;
+    timedelta:= 0;
+    Counter:= 0;
+    StepTicks:= 0;
+    ExplosionBorderColor:= $FF808080;
+    WaterOpacity:= $80;
+    SDWaterOpacity:= $80;
+    prevGState:= gsConfirm;
+    GrayScale:= false;
+
     LuaGoals:= '';
 end;
 
--- a/hedgewars/uVisualGears.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uVisualGears.pas	Tue May 01 19:56:55 2012 +0200
@@ -113,7 +113,6 @@
         );
 
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType; State: LongWord = 0; Critical: Boolean = false): PVisualGear;
-const VGCounter: Longword = 0;
 var gear: PVisualGear;
     t: Longword;
     sp: real;
@@ -980,6 +979,7 @@
 procedure initModule;
 var i: LongWord;
 begin
+VGCounter:= 0;
 for i:= 0 to 6 do
     VisualGearLayers[i]:= nil;
 end;
@@ -987,6 +987,7 @@
 procedure freeModule;
 var i: LongWord;
 begin
+VGCounter:= 0;
 for i:= 0 to 6 do
     while VisualGearLayers[i] <> nil do DeleteVisualGear(VisualGearLayers[i]);
 end;
--- a/hedgewars/uWorld.pas	Tue May 01 20:54:30 2012 +0400
+++ b/hedgewars/uWorld.pas	Tue May 01 19:56:55 2012 +0200
@@ -1186,9 +1186,9 @@
 DrawVisualGears(6);
 
 if SuddenDeathDmg then
-    DrawWater(cSDWaterOpacity, 0)
+    DrawWater(SDWaterOpacity, 0)
 else
-    DrawWater(cWaterOpacity, 0);
+    DrawWater(WaterOpacity, 0);
 
     // Waves
 ChangeDepth(RM, cStereo_Water_near);
@@ -1196,19 +1196,19 @@
 
 if (cReducedQuality and rq2DWater) = 0 then
     begin
-    //DrawWater(cWaterOpacity, - offsetY div 40);
+    //DrawWater(WaterOpacity, - offsetY div 40);
     ChangeDepth(RM, cStereo_Water_near);
     DrawWaves(-1, 50 + WorldDx div 6, - cWaveHeight - offsetY div 40, 8);
     if SuddenDeathDmg then
-        DrawWater(cSDWaterOpacity, - offsetY div 20)
+        DrawWater(SDWaterOpacity, - offsetY div 20)
     else
-        DrawWater(cWaterOpacity, - offsetY div 20);
+        DrawWater(WaterOpacity, - offsetY div 20);
     ChangeDepth(RM, cStereo_Water_near);
     DrawWaves( 1, 75 - WorldDx div 4, - cWaveHeight - offsetY div 20, 2);
         if SuddenDeathDmg then
-            DrawWater(cSDWaterOpacity, - offsetY div 10)
+            DrawWater(SDWaterOpacity, - offsetY div 10)
         else
-            DrawWater(cWaterOpacity, - offsetY div 10);
+            DrawWater(WaterOpacity, - offsetY div 10);
         ChangeDepth(RM, cStereo_Water_near);
         DrawWaves( -1, 25 + WorldDx div 3, - cWaveHeight - offsetY div 10, 0);
         end