hate Smaxx (tested)
authorunc0rr
Sat, 06 Mar 2010 10:54:24 +0000
changeset 2947 803b277e4894
parent 2946 1d9e0a541c62
child 2948 3f21a9dc93d0
hate Smaxx (tested)
hedgewars/CCHandlers.inc
hedgewars/hwengine.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uMisc.pas
--- a/hedgewars/CCHandlers.inc	Sat Mar 06 01:26:12 2010 +0000
+++ b/hedgewars/CCHandlers.inc	Sat Mar 06 10:54:24 2010 +0000
@@ -1,20 +1,20 @@
 (*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2009 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *)
+* Hedgewars, a free turn based strategy game
+* Copyright (c) 2004-2009 Andrey Korotaev <unC0Rr@gmail.com>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; version 2 of the License
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+*)
 
 function CheckNoTeamOrHH: boolean;
 var bRes: boolean;
@@ -22,7 +22,7 @@
 bRes:= (CurrentTeam = nil) or (CurrentHedgehog^.Gear = nil);
 {$IFDEF DEBUGFILE}
 if bRes then
-   if CurrentTeam = nil then AddFileLog('CONSOLE: CurTeam = nil')
+if CurrentTeam = nil then AddFileLog('CONSOLE: CurTeam = nil')
                         else AddFileLog('CONSOLE: CurTeam <> nil, Gear = nil');
 {$ENDIF}
 CheckNoTeamOrHH:= bRes;
@@ -42,10 +42,10 @@
 procedure chConfirm(var s: shortstring);
 begin
 if GameState = gsConfirm then
-	begin
-	SendIPC('Q');
-	GameState:= gsExit
-	end
+    begin
+    SendIPC('Q');
+    GameState:= gsExit
+    end
 else
     begin
     GameState:= gsChat;
@@ -63,12 +63,12 @@
 var i, c: LongInt;
 begin
 if isDeveloperMode then
-   begin
-   val(s, i, c);
-   if (c <> 0) or (i = 0) then exit;
-   TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old', true);
-   TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new', true)
-   end
+begin
+val(s, i, c);
+if (c <> 0) or (i = 0) then exit;
+TryDo(i <= cNetProtoVersion, 'Protocol version mismatch: engine is too old', true);
+TryDo(i >= cNetProtoVersion, 'Protocol version mismatch: engine is too new', true)
+end
 end;
 
 procedure chAddTeam(var s: shortstring);
@@ -76,22 +76,22 @@
     ts, cs: shortstring;
 begin
 if isDeveloperMode then
-   begin
-   SplitBySpace(s, cs);
-   SplitBySpace(cs, ts);
-   val(cs, Color);
-   TryDo(Color <> 0, 'Error: black team color', true);
+begin
+SplitBySpace(s, cs);
+SplitBySpace(cs, ts);
+val(cs, Color);
+TryDo(Color <> 0, 'Error: black team color', true);
 
-   // color is always little endian so the mask must be constant also in big endian archs
-   Color:= Color or $FF000000;
- 	
-   AddTeam(Color);
-   CurrentTeam^.TeamName:= ts;
-   CurrentTeam^.PlayerHash:= s;
-   if GameType in [gmtDemo, gmtSave] then CurrentTeam^.ExtDriven:= true;
+// color is always little endian so the mask must be constant also in big endian archs
+Color:= Color or $FF000000;
+    
+AddTeam(Color);
+CurrentTeam^.TeamName:= ts;
+CurrentTeam^.PlayerHash:= s;
+if GameType in [gmtDemo, gmtSave] then CurrentTeam^.ExtDriven:= true;
 
-   CurrentTeam^.voicepack:= AskForVoicepack('Default')
-   end
+CurrentTeam^.voicepack:= AskForVoicepack('Default')
+end
 end;
 
 procedure chTeamLocal(var s: shortstring);
@@ -146,22 +146,22 @@
 begin
 if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
 with CurrentTeam^ do
-	begin
-	SplitBySpace(id, s);
-	CurrentHedgehog:= @Hedgehogs[HedgehogsNumber];
-	val(id, CurrentHedgehog^.BotLevel);
-	Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0);
-	SplitBySpace(s, id);
-	val(s, Gear^.Health);
-	TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true);
-	PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam;
+    begin
+    SplitBySpace(id, s);
+    CurrentHedgehog:= @Hedgehogs[HedgehogsNumber];
+    val(id, CurrentHedgehog^.BotLevel);
+    Gear:= AddGear(0, 0, gtHedgehog, 0, _0, _0, 0);
+    SplitBySpace(s, id);
+    val(s, Gear^.Health);
+    TryDo(Gear^.Health > 0, 'Invalid hedgehog health', true);
+    PHedgehog(Gear^.Hedgehog)^.Team:= CurrentTeam;
     if (GameFlags and gfSharedAmmo) <> 0 then CurrentHedgehog^.AmmoStore:= Clan^.ClanIndex
     else CurrentHedgehog^.AmmoStore:= TeamsCount - 1;
-	CurrentHedgehog^.Gear:= Gear;
-	CurrentHedgehog^.Name:= id;
+    CurrentHedgehog^.Gear:= Gear;
+    CurrentHedgehog^.Name:= id;
     CurrHedgehog:= HedgehogsNumber;
-	inc(HedgehogsNumber)
-	end
+    inc(HedgehogsNumber)
+    end
 end;
 
 procedure chSetHat(var s: shortstring);
@@ -170,12 +170,12 @@
 with CurrentTeam^ do
     begin
     if not CurrentHedgehog^.King then
-       if (s = '') or 
-          (((GameFlags and gfKing) <> 0) and (s = 'crown')) or
-          ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then
-           CurrentHedgehog^.Hat:= 'NoHat'
-       else
-           CurrentHedgehog^.Hat:= s
+    if (s = '') or 
+        (((GameFlags and gfKing) <> 0) and (s = 'crown')) or
+        ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then
+        CurrentHedgehog^.Hat:= 'NoHat'
+    else
+        CurrentHedgehog^.Hat:= s
     end;
 end;
 
@@ -206,7 +206,7 @@
 if s[byte(s[0])]='"' then Delete(s, byte(s[0]), 1);
 b:= KeyNameToCode(id);
 if b = 0 then OutError(errmsgUnknownVariable + ' "' + id + '"', false)
-         else CurrentTeam^.Binds[b]:= s
+        else CurrentTeam^.Binds[b]:= s
 end;
 
 procedure chCurU_p(var s: shortstring);
@@ -263,7 +263,7 @@
 if CheckNoTeamOrHH then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('l');
 with CurrentHedgehog^.Gear^ do
-     Message:= Message and not gm_Left
+    Message:= Message and not gm_Left
 end;
 
 procedure chRight_p(var s: shortstring);
@@ -280,7 +280,7 @@
 if CheckNoTeamOrHH then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('r');
 with CurrentHedgehog^.Gear^ do
-     Message:= Message and not gm_Right
+    Message:= Message and not gm_Right
 end;
 
 procedure chUp_p(var s: shortstring);
@@ -297,7 +297,7 @@
 if CheckNoTeamOrHH then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('u');
 with CurrentHedgehog^.Gear^ do
-     Message:= Message and not gm_Up
+    Message:= Message and not gm_Up
 end;
 
 procedure chDown_p(var s: shortstring);
@@ -314,7 +314,7 @@
 if CheckNoTeamOrHH then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('d');
 with CurrentHedgehog^.Gear^ do
-     Message:= Message and not gm_Down
+    Message:= Message and not gm_Down
 end;
 
 procedure chPrecise_p(var s: shortstring);
@@ -331,7 +331,7 @@
 if CheckNoTeamOrHH then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('z');
 with CurrentHedgehog^.Gear^ do
-     Message:= Message and not gm_Precise
+    Message:= Message and not gm_Precise
 end;
 
 procedure chLJump(var s: shortstring);
@@ -357,26 +357,26 @@
 if CheckNoTeamOrHH then exit;
 bShowFinger:= false;
 with CurrentHedgehog^.Gear^ do
-     begin
-     {$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF}
-     if ((State and gstHHDriven) <> 0) then
+    begin
+    {$IFDEF DEBUGFILE}AddFileLog('/+attack: hedgehog''s Gear^.State = '+inttostr(State));{$ENDIF}
+    if ((State and gstHHDriven) <> 0) then
         begin
         FollowGear:= CurrentHedgehog^.Gear;
         if not CurrentTeam^.ExtDriven then SendIPC('A');
         Message:= Message or gm_Attack
         end
-     end
+    end
 end;
 
 procedure chAttack_m(var s: shortstring);
 begin
 if CheckNoTeamOrHH then exit;
 with CurrentHedgehog^.Gear^ do
-     begin
-     if not CurrentTeam^.ExtDriven and
+    begin
+    if not CurrentTeam^.ExtDriven and
         ((Message and gm_Attack) <> 0) then SendIPC('a');
-     Message:= Message and not gm_Attack
-     end
+    Message:= Message and not gm_Attack
+    end
 end;
 
 procedure chSwitch(var s: shortstring);
@@ -384,7 +384,7 @@
 if CheckNoTeamOrHH then exit;
 if not CurrentTeam^.ExtDriven then SendIPC('S');
 with CurrentHedgehog^.Gear^ do
-     Message:= Message or gm_Switch
+    Message:= Message or gm_Switch
 end;
 
 procedure chNextTurn(var s: shortstring);
@@ -401,9 +401,9 @@
 SendIPC('s' + s);
 
 if copy(s, 1, 4) = '/me ' then
-	s:= #2'* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4)
+    s:= #2'* ' + UserNick + ' ' + copy(s, 5, Length(s) - 4)
 else
-	s:= #1 + UserNick + ': ' + s;
+    s:= #1 + UserNick + ': ' + s;
 
 AddChatString(s)
 end;
@@ -424,10 +424,10 @@
 
 if not CurrentTeam^.ExtDriven then SendIPC(s);
 with CurrentHedgehog^.Gear^ do
-     begin
-     Message:= Message or gm_Timer;
-     MsgParam:= byte(s[1]) - ord('0')
-     end
+    begin
+    Message:= Message or gm_Timer;
+    MsgParam:= byte(s[1]) - ord('0')
+    end
 end;
 
 procedure chSlot(var s: shortstring);
@@ -439,10 +439,10 @@
 if slot > cMaxSlotIndex then exit;
 if not CurrentTeam^.ExtDriven then SendIPC(char(byte(s[1]) + 79));
 with CurrentHedgehog^.Gear^ do
-     begin
-     Message:= Message or gm_Slot;
-     MsgParam:= slot
-     end
+    begin
+    Message:= Message or gm_Slot;
+    MsgParam:= slot
+    end
 end;
 
 procedure chSetWeapon(var s: shortstring);
@@ -454,10 +454,10 @@
 if not CurrentTeam^.ExtDriven then SendIPC('w' + s);
 
 with CurrentHedgehog^.Gear^ do
-     begin
-     Message:= Message or gm_Weapon;
-     MsgParam:= byte(s[1])
-     end
+    begin
+    Message:= Message or gm_Weapon;
+    MsgParam:= byte(s[1])
+    end
 end;
 
 procedure chTaunt(var s: shortstring);
@@ -469,10 +469,10 @@
 if not CurrentTeam^.ExtDriven then SendIPC('t' + s);
 
 with CurrentHedgehog^.Gear^ do
-     begin
-     Message:= Message or gm_Animate;
-     MsgParam:= byte(s[1])
-     end
+    begin
+    Message:= Message or gm_Animate;
+    MsgParam:= byte(s[1])
+    end
 end;
 
 procedure chHogSay(var s: shortstring);
@@ -481,7 +481,7 @@
 begin
 text:= copy(s, 2, Length(s)-1);
 if CheckNoTeamOrHH
-  or ((CurrentHedgehog^.Gear^.State and gstHHDriven) = 0) then
+or ((CurrentHedgehog^.Gear^.State and gstHHDriven) = 0) then
     begin
     chSay(text);
     exit
@@ -493,11 +493,11 @@
     begin
     Gear:= AddVisualGear(0, 0, vgtSpeechBubble);
     if Gear <> nil then
-       begin
-       Gear^.Hedgehog:= CurrentHedgehog;
-       Gear^.Text:= text;
-       Gear^.FrameTicks:= byte(s[1])
-       end
+    begin
+    Gear^.Hedgehog:= CurrentHedgehog;
+    Gear^.Text:= text;
+    Gear^.FrameTicks:= byte(s[1])
+    end
     end
 else
     begin
@@ -520,42 +520,42 @@
 begin
 if CheckNoTeamOrHH then exit;
 if bShowAmmoMenu then
-	begin
-	bSelected:= true;
-	exit
-	end;
+    begin
+    bSelected:= true;
+    exit
+    end;
 
 with CurrentHedgehog^.Gear^,
-	CurrentHedgehog^ do
-	if (State and gstHHChooseTarget) <> 0 then
-		begin
-		isCursorVisible:= false;
-		if not CurrentTeam^.ExtDriven then
-			begin
-			if fromAI then
-				begin
-				TargetPoint.X:= putX;
-				TargetPoint.Y:= putY
-				end else
-				begin
-				TargetPoint.X:= CursorPoint.X - WorldDx;
-				TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy;
-				end;
-			SendIPCXY('p', TargetPoint.X, TargetPoint.Y);
-			end
-		else
-			begin
-			TargetPoint.X:= putX;
-			TargetPoint.Y:= putY
-			end;
-		{$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF}
-		State:= State and not gstHHChooseTarget;
-		if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then
-			Message:= Message or gm_Attack;
-		end
-	else
-		if CurrentTeam^.ExtDriven then
-			OutError('got /put while not being in choose target mode', false)
+    CurrentHedgehog^ do
+    if (State and gstHHChooseTarget) <> 0 then
+        begin
+        isCursorVisible:= false;
+        if not CurrentTeam^.ExtDriven then
+            begin
+            if fromAI then
+                begin
+                TargetPoint.X:= putX;
+                TargetPoint.Y:= putY
+                end else
+                begin
+                TargetPoint.X:= CursorPoint.X - WorldDx;
+                TargetPoint.Y:= cScreenHeight - CursorPoint.Y - WorldDy;
+                end;
+            SendIPCXY('p', TargetPoint.X, TargetPoint.Y);
+            end
+        else
+            begin
+            TargetPoint.X:= putX;
+            TargetPoint.Y:= putY
+            end;
+        {$IFDEF DEBUGFILE}AddFilelog('put: ' + inttostr(TargetPoint.X) + ', ' + inttostr(TargetPoint.Y));{$ENDIF}
+        State:= State and not gstHHChooseTarget;
+        if (Ammo^[CurSlot, CurAmmo].Propz and ammoprop_AttackingPut) <> 0 then
+            Message:= Message or gm_Attack;
+        end
+    else
+        if CurrentTeam^.ExtDriven then
+            OutError('got /put while not being in choose target mode', false)
 end;
 
 procedure chPut(var s: shortstring);
@@ -578,50 +578,50 @@
 procedure chSetMap(var s: shortstring);
 begin
 if isDeveloperMode then
-   begin
-   Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s;
-   InitStepsFlags:= InitStepsFlags or cifMap
-   end
+begin
+Pathz[ptMapCurrent]:= Pathz[ptMaps] + '/' + s;
+InitStepsFlags:= InitStepsFlags or cifMap
+end
 end;
 
 procedure chSetTheme(var s: shortstring);
 begin
 if isDeveloperMode then
-   begin
-   Pathz[ptCurrTheme]:= Pathz[ptThemes] + '/' + s;
-   InitStepsFlags:= InitStepsFlags or cifTheme
-   end
+begin
+Pathz[ptCurrTheme]:= Pathz[ptThemes] + '/' + s;
+InitStepsFlags:= InitStepsFlags or cifTheme
+end
 end;
 
 procedure chSetSeed(var s: shortstring);
 begin
 if isDeveloperMode then
-   begin
-   SetRandomSeed(s);
-   cSeed:= s;
-   InitStepsFlags:= InitStepsFlags or cifRandomize
-   end
+begin
+SetRandomSeed(s);
+cSeed:= s;
+InitStepsFlags:= InitStepsFlags or cifRandomize
+end
 end;
 
 procedure chAmmoMenu(var s: shortstring);
 begin
 if CheckNoTeamOrHH then 
-   bShowAmmoMenu:= true
+bShowAmmoMenu:= true
 else
-   with CurrentTeam^ do
+with CurrentTeam^ do
         with Hedgehogs[CurrHedgehog] do
-             begin
-             bSelected:= false;
+            begin
+            bSelected:= false;
 
-             if bShowAmmoMenu then bShowAmmoMenu:= false
-             else if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or (MultiShootAttacks > 0)
-                  or ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true
-             end
+            if bShowAmmoMenu then bShowAmmoMenu:= false
+            else if ((Gear^.State and (gstAttacking or gstAttacked)) <> 0) or (MultiShootAttacks > 0)
+                or ((Gear^.State and gstHHDriven) = 0) then else bShowAmmoMenu:= true
+            end
 end;
 
 procedure chFullScr(var s: shortstring);
 var flags: Longword = 0;
-	ico: PSDL_Surface;
+    ico: PSDL_Surface;
 {$IFDEF DEBUGFILE}
     buf: array[byte] of char;
 {$ENDIF}
@@ -629,66 +629,66 @@
     window: PSDL_Window;
 {$ENDIF}
 begin
-	if Length(s) = 0 then cFullScreen:= not cFullScreen
-	else cFullScreen:= s = '1';
+    if Length(s) = 0 then cFullScreen:= not cFullScreen
+    else cFullScreen:= s = '1';
 
 {$IFDEF DEBUGFILE}
-	AddFileLog('Prepare to change video parameters...');
+    AddFileLog('Prepare to change video parameters...');
 {$ENDIF}
 
-	flags:= SDL_OPENGL;// or SDL_RESIZABLE;
+    flags:= SDL_OPENGL;// or SDL_RESIZABLE;
 
-	if cFullScreen then
-	begin
-		flags:= flags or SDL_FULLSCREEN;
-		cScreenWidth:= cInitWidth;
-		cScreenHeight:= cInitHeight
-	end;
+    if cFullScreen then
+    begin
+        flags:= flags or SDL_FULLSCREEN;
+        cScreenWidth:= cInitWidth;
+        cScreenHeight:= cInitHeight
+    end;
 
-	// load window icon
-	{$IFNDEF DARWIN}
-	ico:= LoadImage(Pathz[ptGraphics] + '/hwengine', ifIgnoreCaps);
-	{$ELSE}
-	ico:= LoadImage(Pathz[ptGraphics] + '/hwengine_mac', ifIgnoreCaps);
-	{$ENDIF}
-	if ico <> nil then
-		begin
-		SDL_WM_SetIcon(ico, 0);
-		SDL_FreeSurface(ico)
-		end;
-	
-	// set window caption
-	SDL_WM_SetCaption('Hedgewars', nil);
-	
-	if SDLPrimSurface <> nil then
-	begin
+    // load window icon
+    {$IFNDEF DARWIN}
+    ico:= LoadImage(Pathz[ptGraphics] + '/hwengine', ifIgnoreCaps);
+    {$ELSE}
+    ico:= LoadImage(Pathz[ptGraphics] + '/hwengine_mac', ifIgnoreCaps);
+    {$ENDIF}
+    if ico <> nil then
+        begin
+        SDL_WM_SetIcon(ico, 0);
+        SDL_FreeSurface(ico)
+        end;
+    
+    // set window caption
+    SDL_WM_SetCaption('Hedgewars', nil);
+    
+    if SDLPrimSurface <> nil then
+    begin
 {$IFDEF DEBUGFILE}
-		AddFileLog('Freeing old primary surface...');
+        AddFileLog('Freeing old primary surface...');
 {$ENDIF}
-		SDL_FreeSurface(SDLPrimSurface);
-	end;
-	
+        SDL_FreeSurface(SDLPrimSurface);
+    end;
+    
 {$IFDEF SDL13}
-	window:= SDL_CreateWindow('Hedgewars', 0, 0, cScreenWidth, cScreenHeight,
-		SDL_WINDOW_OPENGL or SDL_WINDOW_SHOWN 	 
-	        {$IFDEF IPHONEOS} or SDL_WINDOW_BORDERLESS{$ENDIF}); 	 
-	SDL_CreateRenderer(window, -1, 0); 	 
-	PixelFormat:= nil; 	 
-	  	 
-	SDL_SetRenderDrawColor(0, 0, 0, 255); 	 
-	SDL_RenderFill(nil); 	 
-	SDL_RenderPresent();
+    window:= SDL_CreateWindow('Hedgewars', 0, 0, cScreenWidth, cScreenHeight,
+        SDL_WINDOW_OPENGL or SDL_WINDOW_SHOWN 	 
+            {$IFDEF IPHONEOS} or SDL_WINDOW_BORDERLESS{$ENDIF}); 	 
+    SDL_CreateRenderer(window, -1, 0); 	 
+    PixelFormat:= nil; 	 
+        
+    SDL_SetRenderDrawColor(0, 0, 0, 255); 	 
+    SDL_RenderFill(nil); 	 
+    SDL_RenderPresent();
 {$ELSE}
-	SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags);
-	SDLTry(SDLPrimSurface <> nil, true);
-	PixelFormat:= SDLPrimSurface^.format;
+    SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags);
+    SDLTry(SDLPrimSurface <> nil, true);
+    PixelFormat:= SDLPrimSurface^.format;
 {$ENDIF}
 
 {$IFDEF DEBUGFILE}
-	AddFileLog('Setting up OpenGL...');
-	AddFileLog('SDL video driver: ' + shortstring(SDL_VideoDriverName(buf, sizeof(buf))));
+    AddFileLog('Setting up OpenGL...');
+    AddFileLog('SDL video driver: ' + shortstring(SDL_VideoDriverName(buf, sizeof(buf))));
 {$ENDIF}
-	SetupOpenGL();
+    SetupOpenGL();
 end;
 
 procedure chVol_p(var s: shortstring);
@@ -711,17 +711,14 @@
 procedure chPause(var s: shortstring);
 begin
 if gameType <> gmtNet then
-	isPaused:= not isPaused;
+    isPaused:= not isPaused;
 SDL_ShowCursor(ord(isPaused))
 end;
 
 procedure chRotateMask(var s: shortstring);
 begin
-inc(cTagsMaskIndex);
-if cTagsMaskIndex > High(cTagsMasks) then cTagsMaskIndex:= Low(cTagsMasks);
-
-// HACK: skip "health only" if all hogs are invulnerable
-if ((GameFlags and gfInvulnerable) <> 0) and ((cTagsMasks[cTagsMaskIndex] and not htTransparent) = htHealth) then chRotateMask(s);
+if ((GameFlags and gfInvulnerable) = 0) then cTagsMask:= cTagsMasks[cTagsMask] else cTagsMask:= cTagsMasksNoHealth[cTagsMask];
+addfilelog('tagmask = ' + inttostr(ctagsmask));
 end;
 
 procedure chAddTrigger(var s: shortstring);
@@ -736,7 +733,7 @@
 
 i:= 0;
 while (i < MAXPARAMS) and
-      (Length(s) > 0) do
+    (Length(s) > 0) do
     begin
     SplitBySpace(s, tmp);
     val(s, params[i]);
@@ -745,19 +742,19 @@
     end;
 
 case c of
-  's': begin // sTYPE TICKS LIVES GEARTYPE X Y GEARTRIGGER
-       TryDo(i = 7, errmsgWrongNumber, true);
-       AddTriggerSpawner(params[0], params[1], params[2], TGearType(params[3]), params[4], params[5], params[6]);
-       end;
-  'C': begin
-       TryDo(i = 3, errmsgWrongNumber, true);
-       AddTriggerSuccess(params[0], params[1], params[2]);
-       end;
-  'F': begin
-       TryDo(i = 3, errmsgWrongNumber, true);
-       AddTriggerFail(params[0], params[1], params[2]);
-       end;
-  end
+'s': begin // sTYPE TICKS LIVES GEARTYPE X Y GEARTRIGGER
+    TryDo(i = 7, errmsgWrongNumber, true);
+    AddTriggerSpawner(params[0], params[1], params[2], TGearType(params[3]), params[4], params[5], params[6]);
+    end;
+'C': begin
+    TryDo(i = 3, errmsgWrongNumber, true);
+    AddTriggerSuccess(params[0], params[1], params[2]);
+    end;
+'F': begin
+    TryDo(i = 3, errmsgWrongNumber, true);
+    AddTriggerFail(params[0], params[1], params[2]);
+    end;
+end
 end;
 
 procedure chSpeedup_p(var s: shortstring);
--- a/hedgewars/hwengine.pas	Sat Mar 06 01:26:12 2010 +0000
+++ b/hedgewars/hwengine.pas	Sat Mar 06 10:54:24 2010 +0000
@@ -1,20 +1,20 @@
- (*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2007 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *)
+(*
+* Hedgewars, a free turn based strategy game
+* Copyright (c) 2004-2007 Andrey Korotaev <unC0Rr@gmail.com>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; version 2 of the License
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+*)
 
 {$INCLUDE "options.inc"}
 
@@ -29,39 +29,39 @@
 program hwengine;
 {$ENDIF}
 uses	SDLh in 'SDLh.pas',
-	uConsts in 'uConsts.pas',
-	uGame in 'uGame.pas',
-	uMisc in 'uMisc.pas',
-	uStore in 'uStore.pas',
-	uWorld in 'uWorld.pas',
-	uIO in 'uIO.pas',
-	uGears in 'uGears.pas',
-	uVisualGears in 'uVisualGears.pas',
-	uConsole in 'uConsole.pas',
-	uKeys in 'uKeys.pas',
-	uTeams in 'uTeams.pas',
-	uSound in 'uSound.pas',
-	uRandom in 'uRandom.pas',
-	uAI in 'uAI.pas',
-	uAIMisc in 'uAIMisc.pas',
-	uAIAmmoTests in 'uAIAmmoTests.pas',
-	uAIActions in 'uAIActions.pas',
-	uCollisions in 'uCollisions.pas',
-	uLand in 'uLand.pas',
-	uLandTemplates in 'uLandTemplates.pas',
-	uLandObjects in 'uLandObjects.pas',
-	uLandGraphics in 'uLandGraphics.pas',
-	uLocale in 'uLocale.pas',
-	uAmmos in 'uAmmos.pas',
-	uSHA in 'uSHA.pas',
-	uFloat in 'uFloat.pas',
-	uStats in 'uStats.pas',
-	uChat in 'uChat.pas',
-	uTriggers in 'uTriggers.pas',
-	uLandTexture in 'uLandTexture.pas',
-	uScript in 'uScript.pas',
-	{$IFDEF IPHONEOS}PascalExports in 'PascalExports.pas',{$ENDIF}
-	sysutils;
+    uConsts in 'uConsts.pas',
+    uGame in 'uGame.pas',
+    uMisc in 'uMisc.pas',
+    uStore in 'uStore.pas',
+    uWorld in 'uWorld.pas',
+    uIO in 'uIO.pas',
+    uGears in 'uGears.pas',
+    uVisualGears in 'uVisualGears.pas',
+    uConsole in 'uConsole.pas',
+    uKeys in 'uKeys.pas',
+    uTeams in 'uTeams.pas',
+    uSound in 'uSound.pas',
+    uRandom in 'uRandom.pas',
+    uAI in 'uAI.pas',
+    uAIMisc in 'uAIMisc.pas',
+    uAIAmmoTests in 'uAIAmmoTests.pas',
+    uAIActions in 'uAIActions.pas',
+    uCollisions in 'uCollisions.pas',
+    uLand in 'uLand.pas',
+    uLandTemplates in 'uLandTemplates.pas',
+    uLandObjects in 'uLandObjects.pas',
+    uLandGraphics in 'uLandGraphics.pas',
+    uLocale in 'uLocale.pas',
+    uAmmos in 'uAmmos.pas',
+    uSHA in 'uSHA.pas',
+    uFloat in 'uFloat.pas',
+    uStats in 'uStats.pas',
+    uChat in 'uChat.pas',
+    uTriggers in 'uTriggers.pas',
+    uLandTexture in 'uLandTexture.pas',
+    uScript in 'uScript.pas',
+    {$IFDEF IPHONEOS}PascalExports in 'PascalExports.pas',{$ENDIF}
+    sysutils;
 
 // also: GSHandlers.inc
 //       CCHandlers.inc
@@ -92,84 +92,84 @@
 var s: shortstring;
 {$ENDIF}
 begin
-	inc(RealTicks, Lag);
+    inc(RealTicks, Lag);
 
-	case GameState of
-		gsLandGen: begin
-				GenMap;
-				GameState:= gsStart;
-				end;
-		gsStart: begin
-				if HasBorder then DisableSomeWeapons;
-				AddClouds;
-				AssignHHCoords;
-				AddMiscGears;
-				StoreLoad;
-				InitWorld;
-				ResetKbd;
-				SoundLoad;
-				if GameType = gmtSave then
-					begin
-					isSEBackup:= isSoundEnabled;
-					isSoundEnabled:= false
-					end;
-				FinishProgress;
-				PlayMusic;
-				SetScale(zoom);
-				ScriptCall('onGameStart');
-				GameState:= gsGame;
-				end;
-		gsConfirm,
-		gsGame: begin
-				DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible
-				ProcessKbd;
-				DoGameTick(Lag);
-				ProcessVisualGears(Lag);
-				end;
-		gsChat: begin
-				DrawWorld(Lag);
-				DoGameTick(Lag);
-				ProcessVisualGears(Lag);
-				end;
-		gsExit: begin
-				isTerminated:= true;
-				end;
-		end;
+    case GameState of
+        gsLandGen: begin
+                GenMap;
+                GameState:= gsStart;
+                end;
+        gsStart: begin
+                if HasBorder then DisableSomeWeapons;
+                AddClouds;
+                AssignHHCoords;
+                AddMiscGears;
+                StoreLoad;
+                InitWorld;
+                ResetKbd;
+                SoundLoad;
+                if GameType = gmtSave then
+                    begin
+                    isSEBackup:= isSoundEnabled;
+                    isSoundEnabled:= false
+                    end;
+                FinishProgress;
+                PlayMusic;
+                SetScale(zoom);
+                ScriptCall('onGameStart');
+                GameState:= gsGame;
+                end;
+        gsConfirm,
+        gsGame: begin
+                DrawWorld(Lag); // never place between ProcessKbd and DoGameTick - bugs due to /put cmd and isCursorVisible
+                ProcessKbd;
+                DoGameTick(Lag);
+                ProcessVisualGears(Lag);
+                end;
+        gsChat: begin
+                DrawWorld(Lag);
+                DoGameTick(Lag);
+                ProcessVisualGears(Lag);
+                end;
+        gsExit: begin
+                isTerminated:= true;
+                end;
+        end;
 
-	SDL_GL_SwapBuffers();
+    SDL_GL_SwapBuffers();
 {$IFDEF SDL13}
-	SDL_RenderPresent();
+    SDL_RenderPresent();
 {$ENDIF}
 {$IFNDEF IPHONEOS}
-	// not going to make captures on the iPhone
-	if flagMakeCapture then
-	begin
-		flagMakeCapture:= false;
-		s:= 'hw_' + FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()) + inttostr(GameTicks);
-		WriteLnToConsole('Saving ' + s + '...');
-		MakeScreenshot(s);
-		//SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1)
-	end;
+    // not going to make captures on the iPhone
+    if flagMakeCapture then
+    begin
+        flagMakeCapture:= false;
+        s:= 'hw_' + FormatDateTime('YYYY-MM-DD_HH-mm-ss', Now()) + inttostr(GameTicks);
+        WriteLnToConsole('Saving ' + s + '...');
+        MakeScreenshot(s);
+        //SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1)
+    end;
 {$ENDIF}
 end;
 
 ////////////////////
 procedure OnDestroy;
 begin
-	WriteLnToConsole('Freeing resources...');
-	if isSoundEnabled then ReleaseSound();
-	StoreRelease();
-	FreeLand();
-	ControllerClose();
-	SendKB();
-	CloseIPC();
-	TTF_Quit();
-	{$IFDEF SDL13}SDL_VideoQuit();{$ENDIF}
-	SDL_Quit();
-	{$IFDEF IPHONEOS}
-	freeEverything();
-	{$ENDIF}
-	exit();
+    WriteLnToConsole('Freeing resources...');
+    if isSoundEnabled then ReleaseSound();
+    StoreRelease();
+    FreeLand();
+    ControllerClose();
+    SendKB();
+    CloseIPC();
+    TTF_Quit();
+    {$IFDEF SDL13}SDL_VideoQuit();{$ENDIF}
+    SDL_Quit();
+    {$IFDEF IPHONEOS}
+    freeEverything();
+    {$ENDIF}
+    exit();
 end;
 
 ///////////////////
@@ -177,50 +177,50 @@
 var PrevTime, CurrTime: Longword;
     {$IFNDEF IPHONEOS}event: TSDL_Event;{$ENDIF}
 begin
-	PrevTime:= SDL_GetTicks;
-	repeat
+    PrevTime:= SDL_GetTicks;
+    repeat
 {$IFNDEF IPHONEOS}
 // have to remove this cycle because otherwise it segfaults at exit
-		while SDL_PollEvent(@event) <> 0 do
-		begin
-			case event.type_ of
-				SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
+        while SDL_PollEvent(@event) <> 0 do
+        begin
+            case event.type_ of
+                SDL_KEYDOWN: if GameState = gsChat then KeyPressChat(event.key.keysym.unicode);
 {$IFDEF SDL13}
-				SDL_WINDOWEVENT:
+                SDL_WINDOWEVENT:
 {$ELSE}
-				SDL_ACTIVEEVENT:
+                SDL_ACTIVEEVENT:
 {$ENDIF}
-					if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
-						cHasFocus:= event.active.gain = 1;
-				//SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450));
-				SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then uKeys.wheelDown:= true;
-				SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then uKeys.wheelUp:= true;
-				SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value);
-				SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value);
-				SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true);
-				SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false);
-				SDL_QUITEV: isTerminated:= true
-			end; // end case event.type_ of
-		end; // end while SDL_PollEvent(@event) <> 0 do
+                    if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
+                        cHasFocus:= event.active.gain = 1;
+                //SDL_VIDEORESIZE: Resize(max(event.resize.w, 600), max(event.resize.h, 450));
+                SDL_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then uKeys.wheelDown:= true;
+                SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then uKeys.wheelUp:= true;
+                SDL_JOYAXISMOTION: ControllerAxisEvent(event.jaxis.which, event.jaxis.axis, event.jaxis.value);
+                SDL_JOYHATMOTION: ControllerHatEvent(event.jhat.which, event.jhat.hat, event.jhat.value);
+                SDL_JOYBUTTONDOWN: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, true);
+                SDL_JOYBUTTONUP: ControllerButtonEvent(event.jbutton.which, event.jbutton.button, false);
+                SDL_QUITEV: isTerminated:= true
+            end; // end case event.type_ of
+        end; // end while SDL_PollEvent(@event) <> 0 do
 {$ENDIF}
-		CurrTime:= SDL_GetTicks;
-		if PrevTime + cTimerInterval <= CurrTime then
-		begin
-			DoTimer(CurrTime - PrevTime);
-			PrevTime:= CurrTime
-		end else SDL_Delay(1);
-		if isTerminated = false then IPCCheckSock();
-	until isTerminated;
+        CurrTime:= SDL_GetTicks;
+        if PrevTime + cTimerInterval <= CurrTime then
+        begin
+            DoTimer(CurrTime - PrevTime);
+            PrevTime:= CurrTime
+        end else SDL_Delay(1);
+        if isTerminated = false then IPCCheckSock();
+    until isTerminated;
 
-	exit();
+    exit();
 end;
 
 /////////////////////////
 procedure ShowMainWindow;
 begin
-	if cFullScreen then ParseCommand('fullscr 1', true)
-	else ParseCommand('fullscr 0', true);
-	SDL_ShowCursor(0)
+    if cFullScreen then ParseCommand('fullscr 1', true)
+    else ParseCommand('fullscr 0', true);
+    SDL_ShowCursor(0)
 end;
 
 ///////////////
@@ -230,161 +230,163 @@
 procedure Game;cdecl; export;
 {$ENDIF}
 var	p: TPathType;
-	s: shortstring;
+    s: shortstring;
 begin
 {$IFDEF HWLIBRARY}
-	initEverything();
-	Randomize();
+    initEverything();
+    Randomize();
 
-	cScreenWidth:= 480;
-	cScreenHeight:= 320;
-	cInitWidth:= cScreenWidth;
-	cInitHeight:= cScreenHeight;
-	cBits:= 32;
-	cFullScreen:= false;
-	cVSyncInUse:= true;
-	cTimerInterval:= 8;
-	PathPrefix:= 'Data';
-	cReducedQuality:= false;
-	cShowFPS:= true;
-	cInitVolume:= 100;
+    cScreenWidth:= 480;
+    cScreenHeight:= 320;
+    cInitWidth:= cScreenWidth;
+    cInitHeight:= cScreenHeight;
+    cBits:= 32;
+    cFullScreen:= false;
+    cVSyncInUse:= true;
+    cTimerInterval:= 8;
+    PathPrefix:= 'Data';
+    cReducedQuality:= false;
+    cShowFPS:= true;
+    cInitVolume:= 100;
 
-	UserNick:= gameArgs[0];
-	val(gameArgs[1], ipcPort);
-	isSoundEnabled:= gameArgs[2] = '1';
-	isMusicEnabled:= gameArgs[3] = '1';
-	cLocaleFName:= gameArgs[4];
-	cAltDamage:= gameArgs[5] = '1';
+    UserNick:= gameArgs[0];
+    val(gameArgs[1], ipcPort);
+    isSoundEnabled:= gameArgs[2] = '1';
+    isMusicEnabled:= gameArgs[3] = '1';
+    cLocaleFName:= gameArgs[4];
+    cAltDamage:= gameArgs[5] = '1';
 {$ENDIF}
 
-	for p:= Succ(Low(TPathType)) to High(TPathType) do
-		if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p];
-		
-	WriteToConsole('Init SDL... ');
-	SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true);
-	WriteLnToConsole(msgOK);
+    for p:= Succ(Low(TPathType)) to High(TPathType) do
+        if p <> ptMapCurrent then Pathz[p]:= PathPrefix + '/' + Pathz[p];
+        
+    WriteToConsole('Init SDL... ');
+    SDLTry(SDL_Init(SDL_INIT_VIDEO) >= 0, true);
+    WriteLnToConsole(msgOK);
 
-	SDL_EnableUNICODE(1);
+    SDL_EnableUNICODE(1);
 
-	WriteToConsole('Init SDL_ttf... ');
-	SDLTry(TTF_Init() <> -1, true);
-	WriteLnToConsole(msgOK);
+    WriteToConsole('Init SDL_ttf... ');
+    SDLTry(TTF_Init() <> -1, true);
+    WriteLnToConsole(msgOK);
 
-	ShowMainWindow();
+    ShowMainWindow();
 
-	AddProgress();
+    AddProgress();
 
-	ControllerInit(); // has to happen before InitKbdKeyTable to map keys
-	InitKbdKeyTable();
+    ControllerInit(); // has to happen before InitKbdKeyTable to map keys
+    InitKbdKeyTable();
 
-	if recordFileName = '' then
-		InitIPC;
-	WriteLnToConsole(msgGettingConfig);
+    if recordFileName = '' then
+        InitIPC;
+    WriteLnToConsole(msgGettingConfig);
 
-	LoadLocale(Pathz[ptLocale] + '/en.txt');  // Do an initial load with english
-	if cLocaleFName <> 'en.txt' then
+    LoadLocale(Pathz[ptLocale] + '/en.txt');  // Do an initial load with english
+    if cLocaleFName <> 'en.txt' then
         begin
         // Try two letter locale first before trying specific locale overrides
         if (Length(cLocaleFName) > 6) and (Copy(cLocaleFName,1,2)+'.txt' <> 'en.txt') then 
             LoadLocale(Pathz[ptLocale] + '/' + Copy(cLocaleFName,1,2)+'.txt');
-	    LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName);
+        LoadLocale(Pathz[ptLocale] + '/' + cLocaleFName);
         end;
 
-	if recordFileName = '' then
-		SendIPCAndWaitReply('C')        // ask for game config
-	else
-		LoadRecordFromFile(recordFileName);
+    if recordFileName = '' then
+        SendIPCAndWaitReply('C')        // ask for game config
+    else
+        LoadRecordFromFile(recordFileName);
 
-	ScriptOnGameInit;
+    ScriptOnGameInit;
 
-	s:= 'eproto ' + inttostr(cNetProtoVersion);
-	SendIPCRaw(@s[0], Length(s) + 1); // send proto version
+    s:= 'eproto ' + inttostr(cNetProtoVersion);
+    SendIPCRaw(@s[0], Length(s) + 1); // send proto version
+
+    InitTeams();
+    AssignStores();
 
-	InitTeams();
-	AssignStores();
+    if isSoundEnabled then
+        InitSound();
 
-	if isSoundEnabled then
-		InitSound();
+    isDeveloperMode:= false;
 
-	isDeveloperMode:= false;
+    TryDo(InitStepsFlags = cifAllInited, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
 
-	TryDo(InitStepsFlags = cifAllInited, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
+    ParseCommand('rotmask', true);
 
-	MainLoop();
-	OnDestroy();
-	exit();
+    MainLoop();
+    OnDestroy();
+    exit();
 end;
 
 procedure initEverything;
 begin
-	init_uConsts();
-	init_uMisc();
-	init_uConsole();	// MUST happen after uMisc
-	
-	init_uAI();
-	//uAIActions does not need initialization
-	//uAIAmmoTests does not need initialization
-	init_uAIMisc();
-	init_uAmmos();
-	init_uChat();
-	init_uCollisions();
-	//uFloat does not need initialization
-	//uGame does not need initialization
-	init_uGears();
-	init_uIO();
-	init_uKeys();
-	init_uLand();
-	//uLandGraphics does not need initialization
-	//uLandObjects does not need initialization
-	//uLandTemplates does not need initialization
-	//uLandTexture does not need initialization
-	//uLocale does not need initialization
-	init_uRandom();	
-	//uSHA does not need initialization
-	init_uSound();
-	init_uStats();
-	init_uStore();
-	init_uTeams();
-	init_uTriggers();
-	init_uVisualGears();
-	init_uWorld();
-	init_uScript();
+    init_uConsts();
+    init_uMisc();
+    init_uConsole();	// MUST happen after uMisc
+    
+    init_uAI();
+    //uAIActions does not need initialization
+    //uAIAmmoTests does not need initialization
+    init_uAIMisc();
+    init_uAmmos();
+    init_uChat();
+    init_uCollisions();
+    //uFloat does not need initialization
+    //uGame does not need initialization
+    init_uGears();
+    init_uIO();
+    init_uKeys();
+    init_uLand();
+    //uLandGraphics does not need initialization
+    //uLandObjects does not need initialization
+    //uLandTemplates does not need initialization
+    //uLandTexture does not need initialization
+    //uLocale does not need initialization
+    init_uRandom();	
+    //uSHA does not need initialization
+    init_uSound();
+    init_uStats();
+    init_uStore();
+    init_uTeams();
+    init_uTriggers();
+    init_uVisualGears();
+    init_uWorld();
+    init_uScript();
 end;
 
 procedure freeEverything;
 begin
-	free_uWorld();
-	free_uVisualGears();	//stub
-	free_uTriggers();	//stub
-	free_uTeams();
-	free_uStore();
-	free_uStats();		//stub
-	free_uSound();		//stub
-	//uSHA does not need to be freed
-	free_uRandom();		//stub
-	//uLocale does not need to be freed
-	//uLandTemplates does not need to be freed
-	//uLandTexture does not need to be freed
-	//uLandObjects does not need to be freed
-	//uLandGraphics does not need to be freed
-	free_uLand();
-	free_uKeys();		//stub
-	free_uIO();
-	free_uGears();
-	//uGame does not need to be freed
-	//uFloat does not need to be freed
-	free_uCollisions();
-	free_uChat();
-	free_uAmmos();
-	free_uAIMisc();		//stub
-	//uAIAmmoTests does not need to be freed
-	//uAIActions does not need to be freed
-	free_uAI();		//stub
+    free_uWorld();
+    free_uVisualGears();	//stub
+    free_uTriggers();	//stub
+    free_uTeams();
+    free_uStore();
+    free_uStats();		//stub
+    free_uSound();		//stub
+    //uSHA does not need to be freed
+    free_uRandom();		//stub
+    //uLocale does not need to be freed
+    //uLandTemplates does not need to be freed
+    //uLandTexture does not need to be freed
+    //uLandObjects does not need to be freed
+    //uLandGraphics does not need to be freed
+    free_uLand();
+    free_uKeys();		//stub
+    free_uIO();
+    free_uGears();
+    //uGame does not need to be freed
+    //uFloat does not need to be freed
+    free_uCollisions();
+    free_uChat();
+    free_uAmmos();
+    free_uAIMisc();		//stub
+    //uAIAmmoTests does not need to be freed
+    //uAIActions does not need to be freed
+    free_uAI();		//stub
 
-	free_uConsole();
-	free_uMisc();
-	free_uConsts();		//stub
-	free_uScript();
+    free_uConsole();
+    free_uMisc();
+    free_uConsts();		//stub
+    free_uScript();
 end;
 
 {$IFNDEF HWLIBRARY}
@@ -393,50 +395,50 @@
 var Preview: TPreview;
     h: byte;
 begin
-	InitIPC;
-	IPCWaitPongEvent;
-	TryDo(InitStepsFlags = cifRandomize, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
+    InitIPC;
+    IPCWaitPongEvent;
+    TryDo(InitStepsFlags = cifRandomize, 'Some parameters not set (flags = ' + inttostr(InitStepsFlags) + ')', true);
 
-	Preview:= GenPreview;
-	WriteLnToConsole('Sending preview...');
-	SendIPCRaw(@Preview, sizeof(Preview));
-	h:= MaxHedgehogs;
-	SendIPCRaw(@h, sizeof(h));
-	WriteLnToConsole('Preview sent, disconnect');
-	CloseIPC();
+    Preview:= GenPreview;
+    WriteLnToConsole('Sending preview...');
+    SendIPCRaw(@Preview, sizeof(Preview));
+    h:= MaxHedgehogs;
+    SendIPCRaw(@h, sizeof(h));
+    WriteLnToConsole('Preview sent, disconnect');
+    CloseIPC();
 end;
 
 ////////////////////////////////
 procedure Resize(w, h: LongInt);
 begin
-	cScreenWidth:= w;
-	cScreenHeight:= h;
-	if cFullScreen then
-		ParseCommand('/fullscr 1', true)
-	else
-		ParseCommand('/fullscr 0', true);
+    cScreenWidth:= w;
+    cScreenHeight:= h;
+    if cFullScreen then
+        ParseCommand('/fullscr 1', true)
+    else
+        ParseCommand('/fullscr 0', true);
 end;
 
 /////////////////////
 procedure DisplayUsage;
 var i: LongInt;
 begin
-	WriteLn('Wrong argument format: correct configurations is');
-	WriteLn();
-	WriteLn('  hwengine <path to data folder> <path to replay file> [option]');
-	WriteLn();
-	WriteLn('where [option] must be specified either as');
-	WriteLn(' --set-video [screen width] [screen height] [color dept]');
-	WriteLn(' --set-audio [volume] [enable music] [enable sounds]');
-	WriteLn(' --set-other [language file] [full screen] [show FPS]');
-	WriteLn(' --set-multimedia [screen height] [screen width] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]');
-	WriteLn(' --set-everything [screen height] [screen width] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]');
-	WriteLn();
-	WriteLn('Read documentation online at http://www.hedgewars.org/node/1465 for more information');
-	Write('parsed command: ');
-	for i:=0 to ParamCount do
-		Write(ParamStr(i) + ' ');
-	WriteLn();
+    WriteLn('Wrong argument format: correct configurations is');
+    WriteLn();
+    WriteLn('  hwengine <path to data folder> <path to replay file> [option]');
+    WriteLn();
+    WriteLn('where [option] must be specified either as');
+    WriteLn(' --set-video [screen width] [screen height] [color dept]');
+    WriteLn(' --set-audio [volume] [enable music] [enable sounds]');
+    WriteLn(' --set-other [language file] [full screen] [show FPS]');
+    WriteLn(' --set-multimedia [screen height] [screen width] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen]');
+    WriteLn(' --set-everything [screen height] [screen width] [color dept] [volume] [enable music] [enable sounds] [language file] [full screen] [show FPS] [alternate damage] [timer value] [reduced quality]');
+    WriteLn();
+    WriteLn('Read documentation online at http://www.hedgewars.org/node/1465 for more information');
+    Write('parsed command: ');
+    for i:=0 to ParamCount do
+        Write(ParamStr(i) + ' ');
+    WriteLn();
 end;
 
 ////////////////////
@@ -446,124 +448,124 @@
 {$ENDIF}
 begin
 
-	case ParamCount of
-		18: begin
-			val(ParamStr(2), cScreenWidth);
-			val(ParamStr(3), cScreenHeight);
-			cInitWidth:= cScreenWidth;
-			cInitHeight:= cScreenHeight;
-			cBitsStr:= ParamStr(4);
-			val(cBitsStr, cBits);
-			val(ParamStr(5), ipcPort);
-			cFullScreen:= ParamStr(6) = '1';
-			isSoundEnabled:= ParamStr(7) = '1';
-			cVSyncInUse:= ParamStr(8) = '1';
-			cWeaponTooltips:= ParamStr(9) = '1';
-			cLocaleFName:= ParamStr(10);
-			val(ParamStr(11), cInitVolume);
-			val(ParamStr(12), cTimerInterval);
-			PathPrefix:= ParamStr(13);
-			cShowFPS:= ParamStr(14) = '1';
-			cAltDamage:= ParamStr(15) = '1';
-			UserNick:= DecodeBase64(ParamStr(16));
-			isMusicEnabled:= ParamStr(17) = '1';
-			cReducedQuality:= ParamStr(18) = '1';
-		end;
-		3: begin
-			val(ParamStr(2), ipcPort);
-			GameType:= gmtLandPreview;
-			if ParamStr(3) <> 'landpreview' then 
-				OutError(errmsgShouldntRun, true);
-		end;
-		2: begin
-			PathPrefix:= ParamStr(1);
-			recordFileName:= ParamStr(2);
-		end;
-		6: begin
-			PathPrefix:= ParamStr(1);
-			recordFileName:= ParamStr(2);
+    case ParamCount of
+        18: begin
+            val(ParamStr(2), cScreenWidth);
+            val(ParamStr(3), cScreenHeight);
+            cInitWidth:= cScreenWidth;
+            cInitHeight:= cScreenHeight;
+            cBitsStr:= ParamStr(4);
+            val(cBitsStr, cBits);
+            val(ParamStr(5), ipcPort);
+            cFullScreen:= ParamStr(6) = '1';
+            isSoundEnabled:= ParamStr(7) = '1';
+            cVSyncInUse:= ParamStr(8) = '1';
+            cWeaponTooltips:= ParamStr(9) = '1';
+            cLocaleFName:= ParamStr(10);
+            val(ParamStr(11), cInitVolume);
+            val(ParamStr(12), cTimerInterval);
+            PathPrefix:= ParamStr(13);
+            cShowFPS:= ParamStr(14) = '1';
+            cAltDamage:= ParamStr(15) = '1';
+            UserNick:= DecodeBase64(ParamStr(16));
+            isMusicEnabled:= ParamStr(17) = '1';
+            cReducedQuality:= ParamStr(18) = '1';
+        end;
+        3: begin
+            val(ParamStr(2), ipcPort);
+            GameType:= gmtLandPreview;
+            if ParamStr(3) <> 'landpreview' then 
+                OutError(errmsgShouldntRun, true);
+        end;
+        2: begin
+            PathPrefix:= ParamStr(1);
+            recordFileName:= ParamStr(2);
+        end;
+        6: begin
+            PathPrefix:= ParamStr(1);
+            recordFileName:= ParamStr(2);
 
-			if ParamStr(3) = '--set-video'	then
-			begin
-				val(ParamStr(4), cScreenWidth);
-				val(ParamStr(5), cScreenHeight);
-				cInitWidth:= cScreenWidth;
-				cInitHeight:= cScreenHeight;
-				cBitsStr:= ParamStr(6);
-				val(cBitsStr, cBits);
-			end
-			else
-			begin
-				if ParamStr(3) = '--set-audio' then
-				begin
-					val(ParamStr(4), cInitVolume);
-					isMusicEnabled:= ParamStr(5) = '1';
-					isSoundEnabled:= ParamStr(6) = '1';
-				end
-				else
-				begin
-					if ParamStr(3) = '--set-other' then
-					begin
-						cLocaleFName:= ParamStr(4);
-						cFullScreen:= ParamStr(5) = '1';
-						cShowFPS:= ParamStr(6) = '1';
-					end
-					else GameType:= gmtSyntax;
-				end
-			end;
-		end;
-		11: begin
-			PathPrefix:= ParamStr(1);
-			recordFileName:= ParamStr(2);
+            if ParamStr(3) = '--set-video'	then
+            begin
+                val(ParamStr(4), cScreenWidth);
+                val(ParamStr(5), cScreenHeight);
+                cInitWidth:= cScreenWidth;
+                cInitHeight:= cScreenHeight;
+                cBitsStr:= ParamStr(6);
+                val(cBitsStr, cBits);
+            end
+            else
+            begin
+                if ParamStr(3) = '--set-audio' then
+                begin
+                    val(ParamStr(4), cInitVolume);
+                    isMusicEnabled:= ParamStr(5) = '1';
+                    isSoundEnabled:= ParamStr(6) = '1';
+                end
+                else
+                begin
+                    if ParamStr(3) = '--set-other' then
+                    begin
+                        cLocaleFName:= ParamStr(4);
+                        cFullScreen:= ParamStr(5) = '1';
+                        cShowFPS:= ParamStr(6) = '1';
+                    end
+                    else GameType:= gmtSyntax;
+                end
+            end;
+        end;
+        11: begin
+            PathPrefix:= ParamStr(1);
+            recordFileName:= ParamStr(2);
 
-			if ParamStr(3) = '--set-multimedia' then
-			begin
-				val(ParamStr(4), cScreenWidth);
-				val(ParamStr(5), cScreenHeight);
-				cInitWidth:= cScreenWidth;
-				cInitHeight:= cScreenHeight;
-				cBitsStr:= ParamStr(6);
-				val(cBitsStr, cBits);
-				val(ParamStr(7), cInitVolume);
-				isMusicEnabled:= ParamStr(8) = '1';
-				isSoundEnabled:= ParamStr(9) = '1';
-				cLocaleFName:= ParamStr(10);
-				cFullScreen:= ParamStr(11) = '1';
-			end
-			else GameType:= gmtSyntax;
-		end;
-		15: begin
-			PathPrefix:= ParamStr(1);
-			recordFileName:= ParamStr(2);
-			if ParamStr(3) = '--set-everything' then
-			begin
-				val(ParamStr(4), cScreenWidth);
-				val(ParamStr(5), cScreenHeight);
-				cInitWidth:= cScreenWidth;
-				cInitHeight:= cScreenHeight;
-				cBitsStr:= ParamStr(6);
-				val(cBitsStr, cBits);
-				val(ParamStr(7), cInitVolume);
-				isMusicEnabled:= ParamStr(8) = '1';
-				isSoundEnabled:= ParamStr(9) = '1';
-				cLocaleFName:= ParamStr(10);
-				cFullScreen:= ParamStr(11) = '1';
-				cAltDamage:= ParamStr(12) = '1';
-				cShowFPS:= ParamStr(13) = '1';
-				val(ParamStr(14), cTimerInterval);
-				cReducedQuality:= ParamStr(15) = '1';
-			end
-			else GameType:= gmtSyntax;
-		end;
-		else GameType:= gmtSyntax;
-	end;
+            if ParamStr(3) = '--set-multimedia' then
+            begin
+                val(ParamStr(4), cScreenWidth);
+                val(ParamStr(5), cScreenHeight);
+                cInitWidth:= cScreenWidth;
+                cInitHeight:= cScreenHeight;
+                cBitsStr:= ParamStr(6);
+                val(cBitsStr, cBits);
+                val(ParamStr(7), cInitVolume);
+                isMusicEnabled:= ParamStr(8) = '1';
+                isSoundEnabled:= ParamStr(9) = '1';
+                cLocaleFName:= ParamStr(10);
+                cFullScreen:= ParamStr(11) = '1';
+            end
+            else GameType:= gmtSyntax;
+        end;
+        15: begin
+            PathPrefix:= ParamStr(1);
+            recordFileName:= ParamStr(2);
+            if ParamStr(3) = '--set-everything' then
+            begin
+                val(ParamStr(4), cScreenWidth);
+                val(ParamStr(5), cScreenHeight);
+                cInitWidth:= cScreenWidth;
+                cInitHeight:= cScreenHeight;
+                cBitsStr:= ParamStr(6);
+                val(cBitsStr, cBits);
+                val(ParamStr(7), cInitVolume);
+                isMusicEnabled:= ParamStr(8) = '1';
+                isSoundEnabled:= ParamStr(9) = '1';
+                cLocaleFName:= ParamStr(10);
+                cFullScreen:= ParamStr(11) = '1';
+                cAltDamage:= ParamStr(12) = '1';
+                cShowFPS:= ParamStr(13) = '1';
+                val(ParamStr(14), cTimerInterval);
+                cReducedQuality:= ParamStr(15) = '1';
+            end
+            else GameType:= gmtSyntax;
+        end;
+        else GameType:= gmtSyntax;
+    end;
 
 {$IFDEF DEBUGFILE}
-	AddFileLog('Prefix: "' + PathPrefix +'"');
-	for i:= 0 to ParamCount do
-		AddFileLog(inttostr(i) + ': ' + ParamStr(i));
+    AddFileLog('Prefix: "' + PathPrefix +'"');
+    for i:= 0 to ParamCount do
+        AddFileLog(inttostr(i) + ': ' + ParamStr(i));
 {$IFDEF IPHONEOS}
-	WriteLnToConsole('Saving debug file at: ' + IPH_getDocumentsPath());
+    WriteLnToConsole('Saving debug file at: ' + IPH_getDocumentsPath());
 {$ENDIF}
 {$ENDIF}
 end;
@@ -572,20 +574,20 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 begin
-	initEverything();
-	WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
-	
-	GetParams();
-	Randomize();
+    initEverything();
+    WriteLnToConsole('Hedgewars ' + cVersionString + ' engine (network protocol: ' + inttostr(cNetProtoVersion) + ')');
+    
+    GetParams();
+    Randomize();
 
-	if GameType = gmtLandPreview then GenLandPreview()
-	else if GameType = gmtSyntax then DisplayUsage()
-	else Game();
-	freeEverything();
-	
-	if GameType = gmtSyntax then
-		ExitCode:= 1
-	else
-		ExitCode:= 0;
+    if GameType = gmtLandPreview then GenLandPreview()
+    else if GameType = gmtSyntax then DisplayUsage()
+    else Game();
+    freeEverything();
+    
+    if GameType = gmtSyntax then
+        ExitCode:= 1
+    else
+        ExitCode:= 0;
 {$ENDIF}
 end.
--- a/hedgewars/uConsts.pas	Sat Mar 06 01:26:12 2010 +0000
+++ b/hedgewars/uConsts.pas	Sat Mar 06 10:54:24 2010 +0000
@@ -383,31 +383,25 @@
 	cTargetPointRef	: TPoint = (X: NoPointX; Y: 0);
 
 	// hog tag mask
-	htNone        = $00;
-	htTeamName    = $01;
-	htName        = $02;
-	htHealth      = $04;
-	htTransparent = $80;
-	
-	cHHFileName = 'Hedgehog';
-	cCHFileName = 'Crosshair';
-	cThemeCFGFilename = 'theme.cfg';
-	
-	FontBorder = 2;
-var	PathPrefix: shortstring;
-	Pathz: array[TPathType] of shortstring;
-	CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture;
+    // hog tag mask
+    htNone        = $00;
+    htTeamName    = $01;
+    htName        = $02;
+    htHealth      = $04;
+    htTransparent = $08;
+    
+    cHHFileName = 'Hedgehog';
+    cCHFileName = 'Crosshair';
+    cThemeCFGFilename = 'theme.cfg';
+    
+    FontBorder = 2;
+var PathPrefix: shortstring;
+    Pathz: array[TPathType] of shortstring;
+    CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture;
 
-const	cTagsMasks : array[0..7] of byte = (
-				htTeamName or htName or htHealth,
-				htName or htHealth,
-				htHealth,
-				htNone,
-				htTeamName or htName or htHealth or htTransparent,
-				htName or htHealth or htTransparent,
-				htHealth or htTransparent,
-				htNone
-				);
+const
+    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);
 
 	Fontz: array[THWFont] of THHFont = (
 			(Handle: nil;
--- a/hedgewars/uGears.pas	Sat Mar 06 01:26:12 2010 +0000
+++ b/hedgewars/uGears.pas	Sat Mar 06 10:54:24 2010 +0000
@@ -1349,24 +1349,24 @@
 		or (bShowFinger and ((Gear^.State and gstHHDriven) <> 0)) then
 		begin
 		t:= hwRound(Gear^.Y) - cHHRadius - 12 + WorldDy;
-		if (cTagsMasks[cTagsMaskIndex] and htTransparent) <> 0 then
+		if (cTagsMask and htTransparent) <> 0 then
 			glColor4f(1, 1, 1, 0.5);
-		if ((cTagsMasks[cTagsMaskIndex] and htHealth) <> 0) and ((GameFlags and gfInvulnerable) = 0) then
+		if ((cTagsMask and htHealth) <> 0) then
 			begin
 			dec(t, HealthTagTex^.h + 2);
 			DrawCentered(hwRound(Gear^.X) + WorldDx, t, HealthTagTex)
 			end;
-		if (cTagsMasks[cTagsMaskIndex] and htName) <> 0 then
+		if (cTagsMask and htName) <> 0 then
 			begin
 			dec(t, NameTagTex^.h + 2);
 			DrawCentered(hwRound(Gear^.X) + WorldDx, t, NameTagTex)
 			end;
-		if (cTagsMasks[cTagsMaskIndex] and htTeamName) <> 0 then
+		if (cTagsMask and htTeamName) <> 0 then
 			begin
 			dec(t, Team^.NameTagTex^.h + 2);
 			DrawCentered(hwRound(Gear^.X) + WorldDx, t, Team^.NameTagTex)
 			end;
-		if (cTagsMasks[cTagsMaskIndex] and htTransparent) <> 0 then
+		if (cTagsMask and htTransparent) <> 0 then
 			glColor4f(1, 1, 1, 1)
 		end;
 	if (Gear^.State and gstHHDriven) <> 0 then // Current hedgehog
--- a/hedgewars/uMisc.pas	Sat Mar 06 01:26:12 2010 +0000
+++ b/hedgewars/uMisc.pas	Sat Mar 06 10:54:24 2010 +0000
@@ -1,20 +1,20 @@
 (*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2004-2008 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *)
+* Hedgewars, a free turn based strategy game
+* Copyright (c) 2004-2008 Andrey Korotaev <unC0Rr@gmail.com>
+*
+* This program is free software; you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation; version 2 of the License
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+*)
 
 {$INCLUDE "options.inc"}
 
@@ -23,106 +23,106 @@
 
 uses	SDLh, uConsts, uFloat,
 {$IFDEF GLES11}
-	gles11;
+    gles11;
 {$ELSE}
-	GL;
+    GL;
 {$ENDIF}
 
 var
-	isCursorVisible : boolean;
-	isTerminated    : boolean;
-	isInLag         : boolean;
-	isPaused        : boolean;
-	isSoundEnabled  : boolean;
-	isMusicEnabled  : boolean;
-	isSEBackup      : boolean;
-	isInMultiShoot  : boolean;
-	isSpeed         : boolean;
+    isCursorVisible : boolean;
+    isTerminated    : boolean;
+    isInLag         : boolean;
+    isPaused        : boolean;
+    isSoundEnabled  : boolean;
+    isMusicEnabled  : boolean;
+    isSEBackup      : boolean;
+    isInMultiShoot  : boolean;
+    isSpeed         : boolean;
 
-	fastUntilLag    : boolean;
+    fastUntilLag    : boolean;
 
-	GameState	: TGameState;
-	GameType	: TGameType;
-	GameFlags	: Longword;
-	TrainingFlags	: Longword;
-	TurnTimeLeft	: Longword;
-	cSuddenDTurns	: LongInt;
-	cDamagePercent	: LongInt;
-	cMineDudPercent	: LongInt;
-	cTemplateFilter	: LongInt;
+    GameState   : TGameState;
+    GameType    : TGameType;
+    GameFlags   : Longword;
+    TrainingFlags   : Longword;
+    TurnTimeLeft    : Longword;
+    cSuddenDTurns   : LongInt;
+    cDamagePercent  : LongInt;
+    cMineDudPercent : LongWord;
+    cTemplateFilter : LongInt;
 
-	cHedgehogTurnTime: Longword;
-	cMinesTime       : LongInt;
-	cMaxAIThinkTime  : Longword;
+    cHedgehogTurnTime: Longword;
+    cMinesTime       : LongInt;
+    cMaxAIThinkTime  : Longword;
 
-	cCloudsNumber    : LongInt;
-	cScreenWidth     : LongInt;
-	cScreenHeight    : LongInt;
-	cInitWidth       : LongInt;
-	cInitHeight      : LongInt;
-	cVSyncInUse	 : boolean;	
-	cBits            : LongInt;
-	cBitsStr         : string[2];
-	cTagsMaskIndex   : byte;
-	zoom             : GLfloat;
-	ZoomValue        : GLfloat;
+    cCloudsNumber    : LongInt;
+    cScreenWidth     : LongInt;
+    cScreenHeight    : LongInt;
+    cInitWidth       : LongInt;
+    cInitHeight      : LongInt;
+    cVSyncInUse      : boolean;
+    cBits            : LongInt;
+    cBitsStr         : string[2];
+    cTagsMask        : byte;
+    zoom             : GLfloat;
+    ZoomValue        : GLfloat;
 
-	cWaterLine       : LongInt;
-	cGearScrEdgesDist: LongInt;
-	cAltDamage       : boolean;
+    cWaterLine       : LongInt;
+    cGearScrEdgesDist: LongInt;
+    cAltDamage       : boolean;
 
-	GameTicks	: LongWord;
-	TrainingTimeInc	: Longword;
-	TrainingTimeInD	: Longword;
-	TrainingTimeInM	: Longword;
-	TrainingTimeMax	: Longword;
+    GameTicks	: LongWord;
+    TrainingTimeInc	: Longword;
+    TrainingTimeInD	: Longword;
+    TrainingTimeInM	: Longword;
+    TrainingTimeMax	: Longword;
 
-	TimeTrialStartTime: Longword;
-	TimeTrialStopTime : Longword;
-	
-	recordFileName	: shortstring;
-	cShowFPS	: boolean;
-	cCaseFactor	: Longword;
-	cLandAdditions	: Longword;
-	cExplosives	: Longword;
-	cFullScreen	: boolean;
-	cReducedQuality	: boolean;
-	cLocaleFName	: shortstring;
-	cSeed		: shortstring;
-	cInitVolume	: LongInt;
-	cVolumeDelta	: LongInt;
-	cTimerInterval	: Longword;
-	cHasFocus	: boolean;
-	cInactDelay	: Longword;
+    TimeTrialStartTime: Longword;
+    TimeTrialStopTime : Longword;
+    
+    recordFileName	: shortstring;
+    cShowFPS	: boolean;
+    cCaseFactor	: Longword;
+    cLandAdditions	: Longword;
+    cExplosives	: Longword;
+    cFullScreen	: boolean;
+    cReducedQuality	: boolean;
+    cLocaleFName	: shortstring;
+    cSeed		: shortstring;
+    cInitVolume	: LongInt;
+    cVolumeDelta	: LongInt;
+    cTimerInterval	: Longword;
+    cHasFocus	: boolean;
+    cInactDelay	: Longword;
 
-	bBetweenTurns	: boolean;
-	cHealthDecrease	: LongWord;
-	bWaterRising	: Boolean;
+    bBetweenTurns	: boolean;
+    cHealthDecrease	: LongWord;
+    bWaterRising	: Boolean;
 
-	ShowCrosshair	: boolean;
-	CursorMovementX : Integer;
-	CursorMovementY : Integer;
-	cDrownSpeed	: hwFloat;
-	cMaxWindSpeed	: hwFloat;
-	cWindSpeed	: hwFloat;
-	cGravity	: hwFloat;
-	cDamageModifier	: hwFloat;
-	cLaserSighting	: boolean;
-	cVampiric	: boolean;
-	cArtillery	: boolean;
-	WeaponTooltipTex : PTexture;
-	cWeaponTooltips: boolean;
+    ShowCrosshair	: boolean;
+    CursorMovementX : Integer;
+    CursorMovementY : Integer;
+    cDrownSpeed	: hwFloat;
+    cMaxWindSpeed	: hwFloat;
+    cWindSpeed	: hwFloat;
+    cGravity	: hwFloat;
+    cDamageModifier	: hwFloat;
+    cLaserSighting	: boolean;
+    cVampiric	: boolean;
+    cArtillery	: boolean;
+    WeaponTooltipTex : PTexture;
+    cWeaponTooltips: boolean;
 
-	flagMakeCapture	: boolean;
+    flagMakeCapture	: boolean;
 
-	InitStepsFlags	: Longword;
-	RealTicks	: Longword;
-	AttackBar	: LongInt;
+    InitStepsFlags	: Longword;
+    RealTicks	: Longword;
+    AttackBar	: LongInt;
 
-	WaterColorArray	: array[0..3] of HwColor4f;
+    WaterColorArray	: array[0..3] of HwColor4f;
 
-	CursorPoint	: TPoint;
-	TargetPoint	: TPoint;
+    CursorPoint	: TPoint;
+    TargetPoint	: TPoint;
 
     TextureList : PTexture;
 
@@ -178,12 +178,12 @@
 begin
 i:= Pos(' ', a);
 if i > 0 then
-	begin
-	for t:= 1 to Pred(i) do
-		if (a[t] >= 'A')and(a[t] <= 'Z') then Inc(a[t], 32);
-	b:= copy(a, i + 1, Length(a) - i);
-	byte(a[0]):= Pred(i)
-	end else b:= '';
+    begin
+    for t:= 1 to Pred(i) do
+        if (a[t] >= 'A')and(a[t] <= 'Z') then Inc(a[t], 32);
+    b:= copy(a, i + 1, Length(a) - i);
+    byte(a[0]):= Pred(i)
+    end else b:= '';
 end;
 
 procedure SplitByChar(var a, b: ansistring; c: char);
@@ -191,10 +191,10 @@
 begin
 i:= Pos(c, a);
 if i > 0 then
-	begin
-	b:= copy(a, i + 1, Length(a) - i);
-	setlength(a, Pred(i));
-	end else b:= '';
+    begin
+    b:= copy(a, i + 1, Length(a) - i);
+    setlength(a, Pred(i));
+    end else b:= '';
 end;
 
 procedure movecursor(dx, dy: Integer);
@@ -229,11 +229,11 @@
 {$IFDEF DEBUGFILE}AddFileLog(Msg);{$ENDIF}
 WriteLnToConsole(Msg);
 if isFatalError then
-   begin
-   SendIPC('E' + GetLastConsoleLine);
-   SDL_Quit;
-   halt(1)
-   end
+begin
+SendIPC('E' + GetLastConsoleLine);
+SDL_Quit;
+halt(1)
+end
 end;
 
 procedure TryDo(Assert: boolean; Msg: shortstring; isFatal: boolean);
@@ -313,10 +313,10 @@
 var s: shortstring;
 begin
 if KBnum <> 0 then
-   begin
-   s:= 'K' + inttostr(KBnum);
-   SendIPCRaw(@s, Length(s) + 1)
-   end
+begin
+s:= 'K' + inttostr(KBnum);
+SendIPCRaw(@s, Length(s) + 1)
+end
 end;
 
 procedure SetLittle(var r: hwFloat);
@@ -356,25 +356,25 @@
 procedure ResetVertexArrays(texture: PTexture);
 begin
 with texture^ do
-	begin
-	vb[0].X:= 0;
-	vb[0].Y:= 0;
-	vb[1].X:= w;
-	vb[1].Y:= 0;
-	vb[2].X:= w;
-	vb[2].Y:= h;
-	vb[3].X:= 0;
-	vb[3].Y:= h;
+    begin
+    vb[0].X:= 0;
+    vb[0].Y:= 0;
+    vb[1].X:= w;
+    vb[1].Y:= 0;
+    vb[2].X:= w;
+    vb[2].Y:= h;
+    vb[3].X:= 0;
+    vb[3].Y:= h;
 
-	tb[0].X:= 0;
-	tb[0].Y:= 0;
-	tb[1].X:= rx;
-	tb[1].Y:= 0;
-	tb[2].X:= rx;
-	tb[2].Y:= ry;
-	tb[3].X:= 0;
-	tb[3].Y:= ry
-	end;
+    tb[0].X:= 0;
+    tb[0].Y:= 0;
+    tb[1].X:= rx;
+    tb[1].Y:= 0;
+    tb[2].X:= rx;
+    tb[2].Y:= ry;
+    tb[3].X:= 0;
+    tb[3].Y:= ry
+    end;
 end;
 
 function NewTexture(width, height: Longword; buf: Pointer): PTexture;
@@ -424,9 +424,9 @@
 
 if (surf^.format^.BytesPerPixel <> 4) then
 begin
-	TryDo(false, 'Surface2Tex failed, expecting 32 bit surface', true);
-	Surface2Tex^.id:= 0;
-	exit
+    TryDo(false, 'Surface2Tex failed, expecting 32 bit surface', true);
+    Surface2Tex^.id:= 0;
+    exit
 end;
 
 
@@ -435,50 +435,50 @@
 glBindTexture(GL_TEXTURE_2D, Surface2Tex^.id);
 
 if SDL_MustLock(surf) then
-	SDLTry(SDL_LockSurface(surf) >= 0, true);
+    SDLTry(SDL_LockSurface(surf) >= 0, true);
 
 if (not SupportNPOTT) and (not (isPowerOf2(Surf^.w) and isPowerOf2(Surf^.h))) then
 begin
-	tw:= toPowerOf2(Surf^.w);
-	th:= toPowerOf2(Surf^.h);
+    tw:= toPowerOf2(Surf^.w);
+    th:= toPowerOf2(Surf^.h);
 
-	Surface2Tex^.rx:= Surf^.w / tw;
-	Surface2Tex^.ry:= Surf^.h / th;
+    Surface2Tex^.rx:= Surf^.w / tw;
+    Surface2Tex^.ry:= Surf^.h / th;
 
-	GetMem(tmpp, tw * th * surf^.format^.BytesPerPixel);
+    GetMem(tmpp, tw * th * surf^.format^.BytesPerPixel);
 
-		fromP4:= Surf^.pixels;
-		toP4:= tmpp;
+        fromP4:= Surf^.pixels;
+        toP4:= tmpp;
 
-		for y:= 0 to Pred(Surf^.h) do
-		begin
-			for x:= 0 to Pred(Surf^.w) do toP4^[x]:= fromP4^[x];
-			for x:= Surf^.w to Pred(tw) do toP4^[x]:= 0;
-			toP4:= @(toP4^[tw]);
-			fromP4:= @(fromP4^[Surf^.pitch div 4]);
-		end;
+        for y:= 0 to Pred(Surf^.h) do
+        begin
+            for x:= 0 to Pred(Surf^.w) do toP4^[x]:= fromP4^[x];
+            for x:= Surf^.w to Pred(tw) do toP4^[x]:= 0;
+            toP4:= @(toP4^[tw]);
+            fromP4:= @(fromP4^[Surf^.pitch div 4]);
+        end;
 
-		for y:= Surf^.h to Pred(th) do
-		begin
-			for x:= 0 to Pred(tw) do toP4^[x]:= 0;
-			toP4:= @(toP4^[tw]);
-		end;
+        for y:= Surf^.h to Pred(th) do
+        begin
+            for x:= 0 to Pred(tw) do toP4^[x]:= 0;
+            toP4:= @(toP4^[tw]);
+        end;
 
-	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpp);
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tw, th, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpp);
 
-	FreeMem(tmpp, tw * th * surf^.format^.BytesPerPixel)
+    FreeMem(tmpp, tw * th * surf^.format^.BytesPerPixel)
 end
 else
 begin
-	Surface2Tex^.rx:= 1.0;
-	Surface2Tex^.ry:= 1.0;
-	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surf^.w, surf^.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, surf^.pixels);
+    Surface2Tex^.rx:= 1.0;
+    Surface2Tex^.ry:= 1.0;
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, surf^.w, surf^.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, surf^.pixels);
 end;
 
 ResetVertexArrays(Surface2Tex);
 
 if SDL_MustLock(surf) then
-	SDL_UnlockSurface(surf);
+    SDL_UnlockSurface(surf);
 
 SetTextureParameters(enableClamp);
 end;
@@ -486,13 +486,13 @@
 procedure FreeTexture(tex: PTexture);
 begin
 if tex <> nil then
-	begin
+    begin
     if tex^.NextTexture <> nil then tex^.NextTexture^.PrevTexture:= tex^.PrevTexture;
     if tex^.PrevTexture <> nil then tex^.PrevTexture^.NextTexture:= tex^.NextTexture
-       else TextureList:= tex^.NextTexture;
-	glDeleteTextures(1, @tex^.id);
-	Dispose(tex)
-	end
+    else TextureList:= tex^.NextTexture;
+    glDeleteTextures(1, @tex^.id);
+    Dispose(tex)
+    end
 end;
 
 function DecodeBase64(s: shortstring): shortstring;
@@ -501,22 +501,22 @@
 begin
 c:= 0;
 for i:= 1 to Length(s) do
-	begin
-	t:= Pos(s[i], table);
-	if s[i] = '=' then inc(c);
-	if t > 0 then byte(s[i]):= t - 1 else byte(s[i]):= 0
-	end;
+    begin
+    t:= Pos(s[i], table);
+    if s[i] = '=' then inc(c);
+    if t > 0 then byte(s[i]):= t - 1 else byte(s[i]):= 0
+    end;
 
 i:= 1;
 t:= 1;
 while i <= length(s) do
-	begin
-	DecodeBase64[t    ]:= char((byte(s[i    ]) shl 2) or (byte(s[i + 1]) shr 4));
-	DecodeBase64[t + 1]:= char((byte(s[i + 1]) shl 4) or (byte(s[i + 2]) shr 2));
-	DecodeBase64[t + 2]:= char((byte(s[i + 2]) shl 6) or (byte(s[i + 3])      ));
-	inc(t, 3);
-	inc(i, 4)
-	end;
+    begin
+    DecodeBase64[t    ]:= char((byte(s[i    ]) shl 2) or (byte(s[i + 1]) shr 4));
+    DecodeBase64[t + 1]:= char((byte(s[i + 1]) shl 4) or (byte(s[i + 2]) shr 2));
+    DecodeBase64[t + 2]:= char((byte(s[i + 2]) shl 6) or (byte(s[i + 3])      ));
+    inc(t, 3);
+    inc(i, 4)
+    end;
 
 if c < 3 then t:= t - c;
 
@@ -526,30 +526,30 @@
 {$IFNDEF IPHONEOS}
 procedure MakeScreenshot(filename: shortstring);
 var p: Pointer;
-	size: Longword;
-	f: file;
+    size: Longword;
+    f: file;
 {$IFNDEF WIN32}
-	// TGA Header
-	head: array[0..8] of Word = (0, 2, 0, 0, 0, 0, 0, 0, 24);
+    // TGA Header
+    head: array[0..8] of Word = (0, 2, 0, 0, 0, 0, 0, 0, 24);
 {$ELSE}
-	// Windows Bitmap Header
-	head: array[0..53] of Byte = (
-	$42, $4D, // identifier ("BM")
-	0, 0, 0, 0, // file size
-	0, 0, 0, 0, // reserved
-	54, 0, 0, 0, // starting offset
-	40, 0, 0, 0, // header size
-	0, 0, 0, 0, // width
-	0, 0, 0, 0, // height
-	1, 0, // color planes
-	24, 0, // bit depth
-	0, 0, 0, 0, // compression method (uncompressed)
-	0, 0, 0, 0, // image size
-	96, 0, 0, 0, // horizontal resolution
-	96, 0, 0, 0, // vertical resolution
-	0, 0, 0, 0, // number of colors (all)
-	0, 0, 0, 0 // number of important colors
-	);
+    // Windows Bitmap Header
+    head: array[0..53] of Byte = (
+    $42, $4D, // identifier ("BM")
+    0, 0, 0, 0, // file size
+    0, 0, 0, 0, // reserved
+    54, 0, 0, 0, // starting offset
+    40, 0, 0, 0, // header size
+    0, 0, 0, 0, // width
+    0, 0, 0, 0, // height
+    1, 0, // color planes
+    24, 0, // bit depth
+    0, 0, 0, 0, // compression method (uncompressed)
+    0, 0, 0, 0, // image size
+    96, 0, 0, 0, // horizontal resolution
+    96, 0, 0, 0, // vertical resolution
+    0, 0, 0, 0, // number of colors (all)
+    0, 0, 0, 0 // number of important colors
+    );
 {$ENDIF}
 begin
 playSound(sndShutter);
@@ -592,11 +592,11 @@
 Assign(f, filename);
 Rewrite(f, 1);
 if IOResult = 0 then
-	begin
-	BlockWrite(f, head, sizeof(head));
-	BlockWrite(f, p^, size);
-	Close(f);
-	end;
+    begin
+    BlockWrite(f, head, sizeof(head));
+    BlockWrite(f, p^, size);
+    Close(f);
+    end;
 {$I+}
 
 FreeMem(p)
@@ -620,14 +620,14 @@
 {* for more information http://www.idevgames.com/forum/showpost.php?p=85864&postcount=7 *}
 var convertedSurf: PSDL_Surface = nil;
 begin
-	if (tmpsurf^.format^.bitsperpixel = 24) or ((tmpsurf^.format^.bitsperpixel = 32) and (tmpsurf^.format^.rshift > tmpsurf^.format^.bshift)) then
-	begin
-		convertedSurf:= SDL_ConvertSurface(tmpsurf, @conversionFormat, SDL_SWSURFACE);
-		SDL_FreeSurface(tmpsurf);
-		exit(convertedSurf);
-	end;
+    if (tmpsurf^.format^.bitsperpixel = 24) or ((tmpsurf^.format^.bitsperpixel = 32) and (tmpsurf^.format^.rshift > tmpsurf^.format^.bshift)) then
+    begin
+        convertedSurf:= SDL_ConvertSurface(tmpsurf, @conversionFormat, SDL_SWSURFACE);
+        SDL_FreeSurface(tmpsurf);
+        exit(convertedSurf);
+    end;
 
-	exit(tmpsurf);
+    exit(tmpsurf);
 end;
 
 function endian(independent: LongWord): LongWord;
@@ -636,9 +636,9 @@
 endian:= independent;
 {$ELSE}
 endian:= (((independent and $FF000000) shr 24) or
-	  ((independent and $00FF0000) shr 8) or
-	  ((independent and $0000FF00) shl 8) or
-	  ((independent and $000000FF) shl 24))
+    ((independent and $00FF0000) shr 8) or
+    ((independent and $0000FF00) shl 8) or
+    ((independent and $000000FF) shl 24))
 {$ENDIF}
 end;
 
@@ -646,112 +646,112 @@
 procedure init_uMisc;
 {$IFNDEF IPHONEOS}var i: LongInt;{$ENDIF}
 begin
-	cDrownSpeed.QWordValue	:= 257698038;		// 0.06
-	cMaxWindSpeed.QWordValue:= 2147484;		// 0.0005
-	cWindSpeed.QWordValue	:= 429496;		// 0.0001
-	cGravity                := cMaxWindSpeed;
-	cDamageModifier         := _1;
-	TargetPoint             := cTargetPointRef;
-	TextureList             := nil;
-	
-	// int, longint longword and byte
-	CursorMovementX		:= 0;
-	CursorMovementY		:= 0;
-	GameTicks		:= 0;
-	TrainingTimeInc		:= 10000;
-	TrainingTimeInD		:= 500;
-	TrainingTimeInM		:= 5000;
-	TrainingTimeMax		:= 60000;
-	TimeTrialStartTime	:= 0;
-	TimeTrialStopTime	:= 0;
-	cWaterLine		:= LAND_HEIGHT;
-	cGearScrEdgesDist	:= 240;
-	cHealthDecrease		:= 0;
+    cDrownSpeed.QWordValue	:= 257698038;		// 0.06
+    cMaxWindSpeed.QWordValue:= 2147484;		// 0.0005
+    cWindSpeed.QWordValue	:= 429496;		// 0.0001
+    cGravity                := cMaxWindSpeed;
+    cDamageModifier         := _1;
+    TargetPoint             := cTargetPointRef;
+    TextureList             := nil;
+    
+    // int, longint longword and byte
+    CursorMovementX		:= 0;
+    CursorMovementY		:= 0;
+    GameTicks		:= 0;
+    TrainingTimeInc		:= 10000;
+    TrainingTimeInD		:= 500;
+    TrainingTimeInM		:= 5000;
+    TrainingTimeMax		:= 60000;
+    TimeTrialStartTime	:= 0;
+    TimeTrialStopTime	:= 0;
+    cWaterLine		:= LAND_HEIGHT;
+    cGearScrEdgesDist	:= 240;
+    cHealthDecrease		:= 0;
 
-	GameFlags		:= 0;
-	TrainingFlags		:= 0;
-	TurnTimeLeft		:= 0;
-	cSuddenDTurns		:= 15;
-	cDamagePercent		:= 100;
-	cMineDudPercent		:= 0;
-	cTemplateFilter		:= 0;
+    GameFlags		:= 0;
+    TrainingFlags		:= 0;
+    TurnTimeLeft		:= 0;
+    cSuddenDTurns		:= 15;
+    cDamagePercent		:= 100;
+    cMineDudPercent		:= 0;
+    cTemplateFilter		:= 0;
 
-	cHedgehogTurnTime	:= 45000;
-	cMinesTime		:= 3000;
-	cMaxAIThinkTime		:= 9000;
+    cHedgehogTurnTime	:= 45000;
+    cMinesTime		:= 3000;
+    cMaxAIThinkTime		:= 9000;
 
-	cCloudsNumber		:= 9;
-	cScreenWidth		:= 1024;
-	cScreenHeight		:= 768;
-	cInitWidth		:= cScreenWidth;
-	cInitHeight		:= cScreenHeight;
-	cBits			:= 32;
-	cTagsMaskIndex		:= Low(cTagsMasks);
-	KBnum			:= 0;
-	InitStepsFlags		:= 0;
-	RealTicks		:= 0;
-	AttackBar		:= 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
-	
-	// tgametype and glfloat and string
-	GameState		:= Low(TGameState);
-	GameType		:= gmtLocal;
-	zoom			:= 2.0;
-	ZoomValue		:= 2.0;
-	cBitsStr		:= '32';
-	WeaponTooltipTex	:= nil;
+    cCloudsNumber		:= 9;
+    cScreenWidth		:= 1024;
+    cScreenHeight		:= 768;
+    cInitWidth		:= cScreenWidth;
+    cInitHeight		:= cScreenHeight;
+    cBits			:= 32;
+    cTagsMask		:= 0;
+    KBnum			:= 0;
+    InitStepsFlags		:= 0;
+    RealTicks		:= 0;
+    AttackBar		:= 0; // 0 - none, 1 - just bar at the right-down corner, 2 - like in WWP
+    
+    // tgametype and glfloat and string
+    GameState		:= Low(TGameState);
+    GameType		:= gmtLocal;
+    zoom			:= 2.0;
+    ZoomValue		:= 2.0;
+    cBitsStr		:= '32';
+    WeaponTooltipTex	:= nil;
 
-	// booleans
-	cLaserSighting		:= false;
-	cVampiric		:= false;
-	cArtillery		:= false;
-	flagMakeCapture		:= false;
-	bBetweenTurns		:= false;
-	bWaterRising		:= false;
-	isCursorVisible		:= false;
-	isTerminated		:= false;
-	isInLag			:= false;
-	isPaused		:= false;
-	isMusicEnabled		:= false;
-	isInMultiShoot		:= false;
-	isSpeed			:= false;
-	fastUntilLag		:= false;
-	cVSyncInUse		:= true;	
-	isSoundEnabled		:= true;
-	isSEBackup		:= true;
-	
-	// init flags
-	recordFileName		:= '';
-	cShowFPS		:= false;
-	cCaseFactor		:= 5;  {0..9}
-	cLandAdditions		:= 4;
-	cExplosives		:= 2;
-	cFullScreen		:= false;
-	cReducedQuality		:= false;
-	cLocaleFName		:= 'en.txt';
-	cSeed			:= '';
-	cInitVolume		:= 50;
-	cVolumeDelta		:= 0;
-	cTimerInterval		:= 8;
-	cHasFocus		:= true;
-	cInactDelay		:= 1250;
-	cAltDamage		:= true;
+    // booleans
+    cLaserSighting		:= false;
+    cVampiric		:= false;
+    cArtillery		:= false;
+    flagMakeCapture		:= false;
+    bBetweenTurns		:= false;
+    bWaterRising		:= false;
+    isCursorVisible		:= false;
+    isTerminated		:= false;
+    isInLag			:= false;
+    isPaused		:= false;
+    isMusicEnabled		:= false;
+    isInMultiShoot		:= false;
+    isSpeed			:= false;
+    fastUntilLag		:= false;
+    cVSyncInUse		:= true;	
+    isSoundEnabled		:= true;
+    isSEBackup		:= true;
+    
+    // init flags
+    recordFileName		:= '';
+    cShowFPS		:= false;
+    cCaseFactor		:= 5;  {0..9}
+    cLandAdditions		:= 4;
+    cExplosives		:= 2;
+    cFullScreen		:= false;
+    cReducedQuality		:= false;
+    cLocaleFName		:= 'en.txt';
+    cSeed			:= '';
+    cInitVolume		:= 50;
+    cVolumeDelta		:= 0;
+    cTimerInterval		:= 8;
+    cHasFocus		:= true;
+    cInactDelay		:= 1250;
+    cAltDamage		:= true;
 {$IFDEF DEBUGFILE}
 {$I-}
 {$IFDEF IPHONEOS}
-	f:= stderr;
+    f:= stderr;
 {$ELSE}
-	if ParamStr(1) <> '' then
-		begin
-		for i:= 0 to 7 do
-		begin
-			assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt');
-			rewrite(f);
-			if IOResult = 0 then break;
-		end;
-		if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr
-		end
-	else
-		f:= stderr;
+    if ParamStr(1) <> '' then
+        begin
+        for i:= 0 to 7 do
+        begin
+            assign(f, ParamStr(1) + '/debug' + inttostr(i) + '.txt');
+            rewrite(f);
+            if IOResult = 0 then break;
+        end;
+        if IOResult <> 0 then f:= stderr; // if everything fails, write to stderr
+        end
+    else
+        f:= stderr;
 {$ENDIF}
 {$I+}
 {$ENDIF}
@@ -760,13 +760,13 @@
 
 procedure free_uMisc;
 begin
-	//uRandom.DumpBuffer;
-	while TextureList <> nil do FreeTexture(TextureList);
+    //uRandom.DumpBuffer;
+    while TextureList <> nil do FreeTexture(TextureList);
 
 {$IFDEF DEBUGFILE}
-	writeln(f, 'halt at ', GameTicks, ' ticks. TurnTimeLeft = ', TurnTimeLeft);
-	flush(f);
-	close(f);
+    writeln(f, 'halt at ', GameTicks, ' ticks. TurnTimeLeft = ', TurnTimeLeft);
+    flush(f);
+    close(f);
 {$ENDIF}
 end;