complete the replacement of init/free wrappers for every unit
authorkoda
Tue, 26 Jan 2010 21:55:51 +0000
changeset 2716 b9ca1bfca24f
parent 2715 0e4e0db79e2a
child 2717 2b75ef82676d
complete the replacement of init/free wrappers for every unit iphone frontend smaller fixes symbol TOUCHINPUT deprecated revision of some sdl1.3 code
cocoaTouch/GameSetup.m
hedgewars/CCHandlers.inc
hedgewars/PascalExports.pas
hedgewars/SDLh.pas
hedgewars/hwengine.pas
hedgewars/options.inc
hedgewars/uAI.pas
hedgewars/uAIMisc.pas
hedgewars/uAmmos.pas
hedgewars/uChat.pas
hedgewars/uCollisions.pas
hedgewars/uConsts.pas
hedgewars/uGame.pas
hedgewars/uGears.pas
hedgewars/uIO.pas
hedgewars/uKeys.pas
hedgewars/uLandGraphics.pas
hedgewars/uLandTexture.pas
hedgewars/uLocale.pas
hedgewars/uMisc.pas
hedgewars/uRandom.pas
hedgewars/uSound.pas
hedgewars/uStats.pas
hedgewars/uStore.pas
hedgewars/uTeams.pas
hedgewars/uTriggers.pas
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
--- a/cocoaTouch/GameSetup.m	Tue Jan 26 04:13:37 2010 +0000
+++ b/cocoaTouch/GameSetup.m	Tue Jan 26 21:55:51 2010 +0000
@@ -20,7 +20,7 @@
 -(id) init {
 	self = [super init];
 	srandom(time(NULL));
-	ipcPort = (random() % 64541) + 1024 ;//(arc4random() % ((unsigned)64541)) + 1024;
+	ipcPort = (random() % 64541) + 1025;
 		
 	NSString *filePath = [[SDLUIKitDelegate sharedAppDelegate] dataFilePath:@"settings.plist"];
 	self.systemSettings = [[NSDictionary alloc] initWithContentsOfFile:filePath]; //should check it exists
@@ -67,7 +67,7 @@
 	
 	/* Open a connection with the IP provided (listen on the host's port) */
 	if (!(sd = SDLNet_TCP_Open(&ip))) {
-		NSLog(@"SDLNet_TCP_Open: %s\n", SDLNet_GetError());
+		NSLog(@"SDLNet_TCP_Open: %s %\n", SDLNet_GetError(), ipcPort);
 		exit(EXIT_FAILURE);
 	}
 	
--- a/hedgewars/CCHandlers.inc	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/CCHandlers.inc	Tue Jan 26 21:55:51 2010 +0000
@@ -598,6 +598,9 @@
 {$IFDEF DEBUGFILE}
     buf: array[byte] of char;
 {$ENDIF}
+{$IFDEF SDL13}
+    window: PSDL_Window;
+{$ENDIF}
 begin
 	if Length(s) = 0 then cFullScreen:= not cFullScreen
 	else cFullScreen:= s = '1';
@@ -607,10 +610,6 @@
 {$ENDIF}
 
 	flags:= SDL_OPENGL;// or SDL_RESIZABLE;
-{$IFDEF IPHONEOS}
-	// remove the topbar from the iPhone
-	flags:= flags or SDL_NOFRAME;
-{$ENDIF}
 
 	if cFullScreen then
 	begin
@@ -628,9 +627,21 @@
 		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();
+{$ELSE}
 	SDLPrimSurface:= SDL_SetVideoMode(cScreenWidth, cScreenHeight, cBits, flags);
 	SDLTry(SDLPrimSurface <> nil, true);
 	PixelFormat:= SDLPrimSurface^.format;
+{$ENDIF}
 
 {$IFDEF DEBUGFILE}
 	AddFileLog('Setting up OpenGL...');
--- a/hedgewars/PascalExports.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/PascalExports.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -19,7 +19,6 @@
 
 {$IFDEF IPHONEOS}
 // called by pascal code, they deal with the objc code
-procedure IPH_CreateWindowsFromObjc; cdecl; external;
 function  IPH_getDocumentsPath: PChar; cdecl; external;
 procedure IPH_showControls; cdecl; external;
 
--- a/hedgewars/SDLh.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/SDLh.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -327,12 +327,8 @@
 {* SDL_Event type definition *}
 
 {$IFDEF SDL13}
-	//UPDATE TSDL_Window AND TSDL_Texture before usage!!!
-	PSDL_Window = ^TSDL_Window;
-	TSDL_Window = LongInt; //not true anymore
-		
-	PSDL_Texture = ^TSDL_Texture;
-	TSDL_Texture = LongInt; //not true anymore
+	PSDL_Window = pointer;	
+	PSDL_Texture = pointer;
 	
 	TSDL_WindowEvent = record
 		type_: byte;
@@ -631,6 +627,10 @@
 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
 
 {$IFDEF SDL13}
+function  SDL_CreateWindow(title: PChar; x,y,w,h, flags: LongInt): PSDL_Window; cdecl; external SDLLibName; 	 
+function  SDL_CreateRenderer(window: PSDL_Window; index, flags: LongInt): LongInt; cdecl; external SDLLibName; 	 
+function  SDL_SetRenderDrawColor(r,g,b,a: byte): LongInt; cdecl; external SDLLibName;
+
 function  SDL_RenderFill(rect: PSDL_Rect): LongInt;
 function  SDL_RenderFillRect(rect: PSDL_Rect): LongInt; cdecl; external SDLLibName;
 function  SDL_RenderClear: LongInt; cdecl; external SDLLibName;
--- a/hedgewars/hwengine.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/hwengine.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -133,6 +133,9 @@
 		end;
 
 	SDL_GL_SwapBuffers();
+{$IFDEF SDL13}
+	SDL_RenderPresent();
+{$ENDIF}
 {$IFNDEF IPHONEOS}
 	// not going to make captures on the iPhone
 	if flagMakeCapture then
@@ -156,20 +159,18 @@
 	ControllerClose();
 	SendKB();
 	CloseIPC();
-	freeEverything();
 	TTF_Quit();
 	{$IFDEF SDL13}SDL_VideoQuit();{$ENDIF}
 	SDL_Quit();
+	freeEverything();
 	exit();
 end;
 
 ///////////////////
 procedure MainLoop; 
-var PrevTime,
-    CurrTime: Longword;
+var PrevTime, CurrTime: Longword;
     {$IFNDEF IPHONEOS}event: TSDL_Event;{$ENDIF}
 begin
-
 	PrevTime:= SDL_GetTicks;
 	repeat
 {$IFNDEF IPHONEOS}
@@ -235,7 +236,7 @@
 	cInitHeight:= cScreenHeight;
 	cBitsStr:= '32';
 	val(cBitsStr, cBits);
-	cFullScreen:= true;
+	cFullScreen:= false;
 	cVSyncInUse:= true;
 	val('8', cTimerInterval);
 	PathPrefix:= 'Data';
@@ -261,15 +262,15 @@
 	SDL_EnableUNICODE(1);
 
 	WriteToConsole('Init SDL_ttf... ');
-	SDLTry(TTF_Init <> -1, true);
+	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;
@@ -287,11 +288,11 @@
 	s:= 'eproto ' + inttostr(cNetProtoVersion);
 	SendIPCRaw(@s[0], Length(s) + 1); // send proto version
 
-	InitTeams;
-	AssignStores;
+	InitTeams();
+	AssignStores();
 
 	if isSoundEnabled then
-		InitSound;
+		InitSound();
 
 	isDeveloperMode:= false;
 
@@ -307,29 +308,69 @@
 	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_uGears();
+	init_uTriggers();
 	init_uVisualGears();
-	init_uLand();
-	init_uIO();
 	init_uWorld();
-	init_uRandom;
-	init_uTriggers;
-
 end;
 
 procedure freeEverything;
 begin
-	//free_uConts(); not necessary
+	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_uTeams();
-	free_uAmmos();
-	free_uGears();
-	free_uVisualGears();
-	free_uLand();
-	//free_uWorld(); not necessary
+	free_uConsts();		//stub
 
 end;
 {$IFNDEF IPHONEOS}
@@ -525,6 +566,6 @@
 
 	if GameType = gmtLandPreview then GenLandPreview()
 	else Game();
-	ExitCode := 0;
+	ExitCode:= 0;
 {$ENDIF}
 end.
--- a/hedgewars/options.inc	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/options.inc	Tue Jan 26 21:55:51 2010 +0000
@@ -25,8 +25,8 @@
 {$IFDEF IPHONEOS}
   {$DEFINE SDL13}
   {$DEFINE GLES11}
-  {$DEFINE TOUCHINPUT}
   {$DEFINE LOWRES}
+  {$DEFINE SDL_MIXER_NEWER}
   {$DEFINE SDL_IMAGE_NEWER}
   {$MODE OBJFPC}
 {$ENDIF}
@@ -37,8 +37,3 @@
   {  $DEFINE TRACEAIACTIONS}
   {  $DEFINE COUNTTICKS}
 {$ENDIF}
-
-{$IFDEF TOUCHINPUT}
-  {$DEFINE SDL13}
-{$ENDIF}
-
--- a/hedgewars/uAI.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uAI.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -22,6 +22,9 @@
 interface
 uses uFloat;
 
+procedure init_uAI;
+procedure free_uAI;
+
 procedure ProcessBot;
 procedure FreeActionsList;
 
@@ -33,7 +36,7 @@
     CanUseAmmo: array [TAmmoType] of boolean;
     StopThinking: boolean;
     ThinkThread: TThreadID;
-    hasThread: LongInt = 0;
+    hasThread: LongInt;
 
 procedure FreeActionsList;
 begin
@@ -342,4 +345,14 @@
                 or (TurnTimeLeft <= cStopThinkTime) then StopThinking:= true
 end;
 
+procedure init_uAI;
+begin
+	hasThread:= 0;
+end;
+
+procedure free_uAI;
+begin
+
+end;
+
 end.
--- a/hedgewars/uAIMisc.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uAIMisc.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -37,6 +37,9 @@
                JumpType: TJumpType;
                end;
 
+procedure init_uAIMisc;
+procedure free_uAIMisc;
+
 procedure FillTargets;
 procedure FillBonuses(isAfterAttack: boolean);
 procedure AwareOfExplosion(x, y, r: LongInt);
@@ -54,22 +57,25 @@
 
 implementation
 uses uTeams, uMisc, uLand, uCollisions;
-const KillScore = 200;
-      MAXBONUS = 1024;
-      friendlyfactor: LongInt = 300;
 
 type TBonus = record
               X, Y: LongInt;
               Radius: LongInt;
               Score: LongInt;
               end;
-var bonuses: record
+
+const KillScore = 200;
+      MAXBONUS = 1024;
+
+var friendlyfactor: LongInt = 300;
+    KnownExplosion: record
+                    X, Y, Radius: LongInt
+                    end = (X: 0; Y: 0; Radius: 0);
+    bonuses: record
              Count: Longword;
              ar: array[0..Pred(MAXBONUS)] of TBonus;
              end;
-    KnownExplosion: record
-                    X, Y, Radius: LongInt
-                    end = (X: 0; Y: 0; Radius: 0);
+
 
 procedure FillTargets;
 var i, t: Longword;
@@ -459,4 +465,17 @@
                  else AIrndSign:= - num
 end;
 
+procedure init_uAIMisc;
+begin
+	friendlyfactor:= 300;
+	KnownExplosion.X:= 0;
+	KnownExplosion.Y:= 0;
+	KnownExplosion.Radius:= 0;
+end;
+
+procedure free_uAIMisc;
+begin
+
+end;
+
 end.
--- a/hedgewars/uAmmos.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uAmmos.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -22,7 +22,9 @@
 interface
 uses uConsts, uTeams;
 
+procedure init_uAmmos;
 procedure free_uAmmos;
+
 procedure AddAmmoStore(s: shortstring);
 procedure AssignStores;
 procedure AddAmmo(var Hedgehog: THedgehog; ammo: TAmmoType);
@@ -35,13 +37,14 @@
 procedure SetWeapon(weap: TAmmoType);
 procedure DisableSomeWeapons;
 
-var shoppa: Boolean = false;
+var shoppa: boolean;
 
 implementation
 uses uMisc, uGears, uWorld, uLocale, uConsole;
+
 type TAmmoCounts = array[TAmmoType] of Longword;
 var StoresList: array[0..Pred(cMaxHHs)] of PHHAmmo;
-    StoreCnt: Longword = 0;
+    StoreCnt: Longword;
 
 procedure FillAmmoStore(Ammo: PHHAmmo; var cnts: TAmmoCounts);
 var mi: array[0..cMaxSlotIndex] of byte;
@@ -317,11 +320,17 @@
 	if (Ammoz[t].Ammo.Propz and ammoprop_NotBorder) <> 0 then Ammoz[t].Probability:= 0
 end;
 
+procedure init_uAmmos;
+begin
+	shoppa:= false;
+	StoreCnt:= 0
+end;
+
 procedure free_uAmmos;
 var i: LongWord;
 begin
-for i:= 0 to Pred(StoreCnt) do Dispose(StoresList[i]);
-StoreCnt:= 0
+	for i:= 0 to Pred(StoreCnt) do Dispose(StoresList[i]);
+	StoreCnt:= 0
 end;
 
 end.
--- a/hedgewars/uChat.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uChat.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -22,12 +22,15 @@
 
 interface
 
+procedure init_uChat;
+procedure free_uChat;
+
 procedure AddChatString(s: shortstring);
 procedure DrawChat;
 procedure KeyPressChat(Key: Longword);
 
-var UserNick: shortstring = '';
-    showAll: boolean = false;
+var UserNick: shortstring;
+    showAll: boolean;
 
 implementation
 uses uMisc, uStore, uConsts, SDLh, uConsole, uKeys, uTeams;
@@ -42,11 +45,10 @@
 		end;
 
 var Strs: array[0 .. MaxStrIndex] of TChatLine;
-	lastStr: Longword = 0;
-	visibleCount: Longword = 0;
-
-	InputStr: TChatLine;
-	InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char
+    lastStr: LongWord;
+    visibleCount: LongWord;
+    InputStr: TChatLine;
+    InputStrL: array[0..260] of char; // for full str + 4-byte utf-8 char
 
 const colors: array[#1..#4] of TSDL_Color = (
 	(r:$FF; g:$FF; b:$FF; unused:$FF), // chat message [White]
@@ -282,5 +284,17 @@
 	end
 end;
 
+procedure init_uChat;
+begin
+    lastStr:= 0;
+    visibleCount:= 0;
+    UserNick:= '';
+    showAll:= false;
+end;
+
+procedure free_uChat;
+begin
+
+end;
 
 end.
--- a/hedgewars/uCollisions.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uCollisions.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -30,21 +30,24 @@
 			Count: Longword
 			end;
 
+procedure init_uCollisions;
+procedure free_uCollisions;
+
 procedure AddGearCI(Gear: PGear);
 procedure DeleteCI(Gear: PGear);
 
-function CheckGearsCollision(Gear: PGear): PGearArray;
+function  CheckGearsCollision(Gear: PGear): PGearArray;
 
-function TestCollisionXwithGear(Gear: PGear; Dir: LongInt): boolean;
-function TestCollisionYwithGear(Gear: PGear; Dir: LongInt): boolean;
+function  TestCollisionXwithGear(Gear: PGear; Dir: LongInt): boolean;
+function  TestCollisionYwithGear(Gear: PGear; Dir: LongInt): boolean;
 
-function TestCollisionXKick(Gear: PGear; Dir: LongInt): boolean;
-function TestCollisionYKick(Gear: PGear; Dir: LongInt): boolean;
+function  TestCollisionXKick(Gear: PGear; Dir: LongInt): boolean;
+function  TestCollisionYKick(Gear: PGear; Dir: LongInt): boolean;
 
-function TestCollisionY(Gear: PGear; Dir: LongInt): boolean;
+function  TestCollisionY(Gear: PGear; Dir: LongInt): boolean;
 
-function TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt): boolean;
-function TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): boolean;
+function  TestCollisionXwithXYShift(Gear: PGear; ShiftX: hwFloat; ShiftY: LongInt; Dir: LongInt): boolean;
+function  TestCollisionYwithXYShift(Gear: PGear; ShiftX, ShiftY: LongInt; Dir: LongInt): boolean;
 
 implementation
 uses uMisc, uConsts, uLand, uLandGraphics, uConsole;
@@ -55,9 +58,9 @@
 			end;
 
 const MAXRECTSINDEX = 511;
-var Count: Longword = 0;
-	cinfos: array[0..MAXRECTSINDEX] of TCollisionEntry;
-	ga: TGearArray;
+var Count: Longword;
+    cinfos: array[0..MAXRECTSINDEX] of TCollisionEntry;
+    ga: TGearArray;
 
 procedure AddGearCI(Gear: PGear);
 begin
@@ -309,4 +312,14 @@
 Gear^.Y:= Gear^.Y - int2hwFloat(ShiftY)
 end;
 
+procedure init_uCollisions;
+begin
+	Count:= 0;
+end;
+
+procedure free_uCollisions;
+begin
+
+end;
+
 end.
--- a/hedgewars/uConsts.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uConsts.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -267,7 +267,11 @@
 
 	cKeyMaxIndex = 1023;
 
+{$IFDEF IPHONEOS}
+	cMaxCaptions = 3;
+{$ELSE}
 	cMaxCaptions = 4;
+{$ENDIF}
 
 	cSendEmptyPacketTime = 1000;
 
@@ -376,6 +380,8 @@
 	
 	FontBorder = 2;
 var	PathPrefix: string;
+	Pathz: array[TPathType] of String;
+	CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture;
 
 const	cTagsMasks : array[0..7] of byte = (
 				htTeamName or htName or htHealth,
@@ -415,9 +421,7 @@
 			Name: 'DroidSansFallback.ttf')
 			);
 
-var	Pathz: array[TPathType] of String;
-	
-const	SpritesData: array[TSprite] of record
+	SpritesData: array[TSprite] of record
 			FileName: String[14];
 			Path, AltPath: TPathType;
 			Texture: PTexture;
@@ -760,15 +764,13 @@
 			NameTex: nil;
 			Probability: 0;
 			NumberInCase: 0;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-						  ammoprop_DontHold or
-                          ammoprop_Utility;
-					Count: AMMO_INFINITE;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amNothing;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_Utility;
+				Count: AMMO_INFINITE;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amNothing;
+				AttackVoice: sndNone);
 			Slot: 0;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -781,15 +783,13 @@
 			NameTex: nil;
 			Probability: 0;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_Timerable or
-							ammoprop_Power or
-							ammoprop_AltUse;
-					Count: AMMO_INFINITE;
-					NumPerTurn: 0;
-					Timer: 3000;
-					Pos: 0;
-					AmmoType: amGrenade;
-					AttackVoice: sndCover);
+			Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
+				Count: AMMO_INFINITE;
+				NumPerTurn: 0;
+				Timer: 3000;
+				Pos: 0;
+				AmmoType: amGrenade;
+				AttackVoice: sndCover);
 			Slot: 1;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -802,15 +802,13 @@
 			NameTex: nil;
 			Probability: 100;
 			NumberInCase: 3;
-			Ammo: (Propz: ammoprop_Timerable or
-							ammoprop_Power or
-							ammoprop_AltUse;
-					Count: 5;
-					NumPerTurn: 0;
-					Timer: 3000;
-					Pos: 0;
-					AmmoType: amClusterBomb;
-					AttackVoice: sndCover);
+			Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
+				Count: 5;
+				NumPerTurn: 0;
+				Timer: 3000;
+				Pos: 0;
+				AmmoType: amClusterBomb;
+				AttackVoice: sndCover);
 			Slot: 1;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -823,14 +821,13 @@
 			NameTex: nil;
 			Probability: 0;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_Power or
-							ammoprop_AltUse;
-					Count: AMMO_INFINITE;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amBazooka;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
+				Count: AMMO_INFINITE;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amBazooka;
+				AttackVoice: sndNone);
 			Slot: 0;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -843,15 +840,13 @@
 			NameTex: nil;
 			Probability: 100;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_Power or
-							ammoprop_NeedTarget or
-							ammoprop_DontHold;
-					Count: 2;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amUFO;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_Power or	ammoprop_NeedTarget or ammoprop_DontHold;
+				Count: 2;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amUFO;
+				AttackVoice: sndNone);
 			Slot: 0;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -865,12 +860,12 @@
 			Probability: 0;
 			NumberInCase: 1;
 			Ammo: (Propz: ammoprop_ForwMsgs;
-					Count: AMMO_INFINITE;
-					NumPerTurn: 1;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amShotgun;
-					AttackVoice: sndNone);
+				Count: AMMO_INFINITE;
+				NumPerTurn: 1;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amShotgun;
+				AttackVoice: sndNone);
 			Slot: 2;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -883,16 +878,13 @@
 			NameTex: nil;
 			Probability: 0;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_ForwMsgs or
-							ammoprop_AttackInMove or
-							ammoprop_NoCrosshair or
-							ammoprop_DontHold;
-					Count: 2;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amPickHammer;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInMove or ammoprop_NoCrosshair or ammoprop_DontHold;
+				Count: 2;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amPickHammer;
+				AttackVoice: sndNone);
 			Slot: 6;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -905,14 +897,13 @@
 			NameTex: nil;
 			Probability: 0;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-							ammoprop_DontHold;
-					Count: AMMO_INFINITE;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amSkip;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold;
+				Count: AMMO_INFINITE;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amSkip;
+				AttackVoice: sndNone);
 			Slot: 8;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -925,15 +916,13 @@
 			NameTex: nil;
 			Probability: 100;
 			NumberInCase: 3;
-			Ammo: (Propz: ammoprop_ForwMsgs or
-							ammoprop_AttackInMove or
-							ammoprop_AltAttack;
-					Count: 5;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amRope;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_AttackInMove or ammoprop_AltAttack;
+				Count: 5;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amRope;
+				AttackVoice: sndNone);
 			Slot: 7;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -946,16 +935,13 @@
 			NameTex: nil;
 			Probability: 100;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-							ammoprop_AttackInMove or
-							ammoprop_DontHold or
-							ammoprop_AltUse;
-					Count: 2;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amMine;
-					AttackVoice: sndLaugh);
+			Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse;
+				Count: 2;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amMine;
+				AttackVoice: sndLaugh);
 			Slot: 4;
 			TimeAfterTurn: 5000;
 			minAngle: 0;
@@ -969,12 +955,12 @@
 			Probability: 20;
 			NumberInCase: 2;
 			Ammo: (Propz: 0;
-					Count: 3;
-					NumPerTurn: 3;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amDEagle;
-					AttackVoice: sndNone);
+				Count: 3;
+				NumPerTurn: 3;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amDEagle;
+				AttackVoice: sndNone);
 			Slot: 2;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -987,16 +973,13 @@
 			NameTex: nil;
 			Probability: 100;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-							ammoprop_AttackInMove or
-							ammoprop_DontHold or
-							ammoprop_AltUse;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amDynamite;
-					AttackVoice: sndLaugh);
+			Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_AttackInMove or ammoprop_DontHold or ammoprop_AltUse;
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amDynamite;
+				AttackVoice: sndLaugh);
 			Slot: 4;
 			TimeAfterTurn: 5000;
 			minAngle: 0;
@@ -1009,15 +992,13 @@
 			NameTex: nil;
 			Probability: 0;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-							ammoprop_ForwMsgs or
-							ammoprop_AttackInMove;
-					Count: AMMO_INFINITE;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amFirePunch;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_ForwMsgs or ammoprop_AttackInMove;
+				Count: AMMO_INFINITE;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amFirePunch;
+				AttackVoice: sndNone);
 			Slot: 3;
 			TimeAfterTurn: 3000;
 			MinAngle: 0;
@@ -1031,12 +1012,12 @@
 			Probability: 0;
 			NumberInCase: 1;
 			Ammo: (Propz: ammoprop_NoCrosshair;
-					Count: AMMO_INFINITE;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amWhip;
-					AttackVoice: sndNone);
+				Count: AMMO_INFINITE;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amWhip;
+				AttackVoice: sndNone);
 			Slot: 3;
 			TimeAfterTurn: 3000;
 			MinAngle: 0;
@@ -1050,12 +1031,12 @@
 			Probability: 100;
 			NumberInCase: 1;
 			Ammo: (Propz: ammoprop_DontHold;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amBaseballBat;
-					AttackVoice: sndNone);
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amBaseballBat;
+				AttackVoice: sndNone);
 			Slot: 3;
 			TimeAfterTurn: 5000;
 			minAngle: 0;
@@ -1073,12 +1054,12 @@
 							ammoprop_NoCrosshair or
 							ammoprop_DontHold or
 							ammoprop_AltAttack;
-					Count: 2;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amParachute;
-					AttackVoice: sndNone);
+				Count: 2;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amParachute;
+				AttackVoice: sndNone);
 			Slot: 7;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1096,12 +1077,12 @@
 							ammoprop_AttackingPut or
 							ammoprop_DontHold or
 							ammoprop_NotBorder;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amAirAttack;
-					AttackVoice: sndIncoming);
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amAirAttack;
+				AttackVoice: sndIncoming);
 			Slot: 5;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1119,12 +1100,12 @@
 							ammoprop_AttackingPut or
 							ammoprop_DontHold or
 							ammoprop_NotBorder;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amMineStrike;
-					AttackVoice: sndNone);
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amMineStrike;
+				AttackVoice: sndNone);
 			Slot: 5;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1138,12 +1119,12 @@
 			Probability: 100;
 			NumberInCase: 2;
 			Ammo: (Propz: ammoprop_ForwMsgs;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amBlowTorch;
-					AttackVoice: sndNone);
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amBlowTorch;
+				AttackVoice: sndNone);
 			Slot: 6;
 			TimeAfterTurn: 3000;
 			minAngle: 768;
@@ -1156,15 +1137,13 @@
 			NameTex: nil;
 			Probability: 150;
 			NumberInCase: 3;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-							ammoprop_NeedTarget or
-							ammoprop_AttackingPut;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amGirder;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_NeedTarget or ammoprop_AttackingPut;
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amGirder;
+				AttackVoice: sndNone);
 			Slot: 6;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -1182,12 +1161,12 @@
 							ammoprop_NeedTarget or
 							ammoprop_AttackingPut or
 							ammoprop_DontHold;
-					Count: 2;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amTeleport;
-					AttackVoice: sndNone);
+				Count: 2;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amTeleport;
+				AttackVoice: sndNone);
 			Slot: 7;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1200,15 +1179,13 @@
 			NameTex: nil;
 			Probability: 100;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_ForwMsgs or
-							ammoprop_NoCrosshair or
-							ammoprop_DontHold;
-					Count: 3;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amSwitch;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_NoCrosshair or ammoprop_DontHold;
+				Count: 3;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amSwitch;
+				AttackVoice: sndNone);
 			Slot: 8;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1222,12 +1199,12 @@
 			Probability: 100;
 			NumberInCase: 4;
 			Ammo: (Propz: 0;
-					Count: 4;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amMortar;
-					AttackVoice: sndNone);
+				Count: 4;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amMortar;
+				AttackVoice: sndNone);
 			Slot: 1;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -1240,15 +1217,13 @@
 			NameTex: nil;
 			Probability: 100;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_ForwMsgs or
-							ammoprop_DontHold or
-							ammoprop_AttackInMove;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amKamikaze;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold or ammoprop_AttackInMove;
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amKamikaze;
+				AttackVoice: sndNone);
 			Slot: 3;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1261,15 +1236,13 @@
 			NameTex: nil;
 			Probability: 100;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_ForwMsgs or
-							ammoprop_NoCrosshair or
-							ammoprop_DontHold;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amCake;
-					AttackVoice: sndLaugh);
+			Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_NoCrosshair or ammoprop_DontHold;
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amCake;
+				AttackVoice: sndLaugh);
 			Slot: 4;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1283,12 +1256,12 @@
 			Probability: 100;
 			NumberInCase: 1;
 			Ammo: (Propz: ammoprop_ForwMsgs or ammoprop_DontHold;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amSeduction;
-					AttackVoice: sndNone);
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amSeduction;
+				AttackVoice: sndNone);
 			Slot: 2;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1301,15 +1274,13 @@
 			NameTex: nil;
 			Probability: 400;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_Timerable or
-							ammoprop_Power or
-							ammoprop_AltUse;
-					Count: 0;
-					NumPerTurn: 0;
-					Timer: 3000;
-					Pos: 0;
-					AmmoType: amWatermelon;
-					AttackVoice: sndMelon);
+			Ammo: (Propz: ammoprop_Timerable or ammoprop_Power or ammoprop_AltUse;
+				Count: 0;
+				NumPerTurn: 0;
+				Timer: 3000;
+				Pos: 0;
+				AmmoType: amWatermelon;
+				AttackVoice: sndMelon);
 			Slot: 1;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -1322,14 +1293,13 @@
 			NameTex: nil;
 			Probability: 400;
 			NumberInCase: 1;
-			Ammo: (Propz:  ammoprop_Power or
-							ammoprop_AltUse;
-					Count: 0;
-					NumPerTurn: 0;
-					Timer: 5000;
-					Pos: 0;
-					AmmoType: amHellishBomb;
-					AttackVoice: sndNone);
+			Ammo: (Propz:  ammoprop_Power or ammoprop_AltUse;
+				Count: 0;
+				NumPerTurn: 0;
+				Timer: 5000;
+				Pos: 0;
+				AmmoType: amHellishBomb;
+				AttackVoice: sndNone);
 			Slot: 4;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -1347,12 +1317,12 @@
 							ammoprop_AttackingPut or
 							ammoprop_DontHold or
 							ammoprop_NotBorder;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amNapalm;
-					AttackVoice: sndNone);
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amNapalm;
+				AttackVoice: sndNone);
 			Slot: 5;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1365,14 +1335,13 @@
 			NameTex: nil;
 			Probability: 300;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_Power or
-							ammoprop_AltUse;
-					Count: AMMO_INFINITE;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amDrill;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
+				Count: AMMO_INFINITE;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amDrill;
+				AttackVoice: sndNone);
 			Slot: 0;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -1385,14 +1354,13 @@
 			NameTex: nil;
 			Probability: 400;
 			NumberInCase: 1;
-			Ammo: (Propz:  ammoprop_ForwMsgs or
-							 ammoprop_DontHold;
-					Count: AMMO_INFINITE;
-					NumPerTurn: 0;
-					Timer: 5001;
-					Pos: 0;
-					AmmoType: amBallgun;
-					AttackVoice: sndNone);
+			Ammo: (Propz:  ammoprop_ForwMsgs or ammoprop_DontHold;
+				Count: AMMO_INFINITE;
+				NumPerTurn: 0;
+				Timer: 5001;
+				Pos: 0;
+				AmmoType: amBallgun;
+				AttackVoice: sndNone);
 			Slot: 2;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1408,12 +1376,12 @@
 			Ammo: (Propz: ammoprop_ForwMsgs{ or
 							ammoprop_DontHold or
 							ammoprop_AltAttack};
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amRCPlane;
-					AttackVoice: sndNone);
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amRCPlane;
+				AttackVoice: sndNone);
 			Slot: 6;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1426,16 +1394,13 @@
 			NameTex: nil;
 			Probability: 20;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-						  ammoprop_DontHold or
-						  ammoprop_AltUse or
-                          ammoprop_Utility;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amLowGravity;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_AltUse or ammoprop_Utility;
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amLowGravity;
+				AttackVoice: sndNone);
 			Slot: 8;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1448,16 +1413,13 @@
 			NameTex: nil;
 			Probability: 15;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-						  ammoprop_DontHold or
-						  ammoprop_AltUse or
-                          ammoprop_Utility;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amExtraDamage;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_AltUse or ammoprop_Utility;
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amExtraDamage;
+				AttackVoice: sndNone);
 			Slot: 8;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1470,16 +1432,13 @@
 			NameTex: nil;
 			Probability: 20;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-						  ammoprop_DontHold or
-						  ammoprop_AltUse or
-                          ammoprop_Utility;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amInvulnerable;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_AltUse or ammoprop_Utility;
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amInvulnerable;
+				AttackVoice: sndNone);
 			Slot: 8;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1492,16 +1451,13 @@
 			NameTex: nil;
 			Probability: 30;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-						  ammoprop_DontHold or
-						  ammoprop_AltUse or
-                          ammoprop_Utility;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amExtraTime;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_AltUse or ammoprop_Utility;
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amExtraTime;
+				AttackVoice: sndNone);
 			Slot: 7;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1514,16 +1470,13 @@
 			NameTex: nil;
 			Probability: 15;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-						  ammoprop_DontHold or
-						  ammoprop_AltUse or
-                          ammoprop_Utility;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amLaserSight;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_NoCrosshair or ammoprop_DontHold or ammoprop_AltUse or ammoprop_Utility;
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amLaserSight;
+				AttackVoice: sndNone);
 			Slot: 7;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1536,16 +1489,13 @@
 			NameTex: nil;
 			Probability: 15;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_NoCrosshair or
-						  ammoprop_DontHold or
-						  ammoprop_AltUse or
-                          ammoprop_Utility;
-					Count: 1;
-					NumPerTurn: 0;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amVampiric;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_NoCrosshair or  ammoprop_DontHold or  ammoprop_AltUse or ammoprop_Utility;
+				Count: 1;
+				NumPerTurn: 0;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amVampiric;
+				AttackVoice: sndNone);
 			Slot: 6;
 			TimeAfterTurn: 0;
 			minAngle: 0;
@@ -1559,12 +1509,12 @@
 			Probability: 20;
 			NumberInCase: 2;
 			Ammo: (Propz: 0;
-					Count: 2;
-					NumPerTurn: 1;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amSniperRifle;
-					AttackVoice: sndNone);
+				Count: 2;
+				NumPerTurn: 1;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amSniperRifle;
+				AttackVoice: sndNone);
 			Slot: 2;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -1582,12 +1532,12 @@
 							ammoprop_NoCrosshair or
 							ammoprop_DontHold or
 							ammoprop_AltAttack;
-					Count: 1;
-					NumPerTurn: 1;
-					Timer: 0;
-					Pos: 0;
-					AmmoType: amJetpack;
-					AttackVoice: sndNone);
+				Count: 1;
+				NumPerTurn: 1;
+				Timer: 0;
+				Pos: 0;
+				AmmoType: amJetpack;
+				AttackVoice: sndNone);
 			Slot: 3;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -1601,14 +1551,13 @@
 			NameTex: nil;
 			Probability: 0;
 			NumberInCase: 1;
-			Ammo: (Propz: ammoprop_Power or
-							ammoprop_AltUse;
-					Count: AMMO_INFINITE;
-					NumPerTurn: 0;
-					Timer: 3000;
-					Pos: 0;
-					AmmoType: amMolotov;
-					AttackVoice: sndNone);
+			Ammo: (Propz: ammoprop_Power or ammoprop_AltUse;
+				Count: AMMO_INFINITE;
+				NumPerTurn: 0;
+				Timer: 3000;
+				Pos: 0;
+				AmmoType: amMolotov;
+				AttackVoice: sndNone);
 			Slot: 1;
 			TimeAfterTurn: 3000;
 			minAngle: 0;
@@ -1648,9 +1597,8 @@
 	);
 			
 
-var CountTexz: array[1..Pred(AMMO_INFINITE)] of PTexture;
-
 procedure init_uConsts;
+procedure free_uConsts;
 
 implementation
 
@@ -1680,4 +1628,9 @@
 	Pathz:= cPathz;
 end;
 
+procedure free_uConsts;
+begin
+
+end;
+
 end.
--- a/hedgewars/uGame.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uGame.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -62,7 +62,7 @@
                         end;
                gmtSave: begin
                         RestoreTeamsFromSave;
-{$IFNDEF TOUCHINPUT}
+{$IFNDEF IPHONEOS}
                         SetBinds(CurrentTeam^.Binds);
 {$ENDIF}
                         //CurrentHedgehog^.Gear^.Message:= 0; <- produces bugs with further save restoring and demos
--- a/hedgewars/uGears.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uGears.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -21,10 +21,10 @@
 unit uGears;
 interface
 uses SDLh, uConsts, uFloat;
-const AllInactive: boolean = false;
-      PrvInactive: boolean = false;
 
-type PGear = ^TGear;
+    
+type
+	PGear = ^TGear;
 	TGearStepProcedure = procedure (Gear: PGear);
 	TGear = record
 			NextGear, PrevGear: PGear;
@@ -57,8 +57,19 @@
 			TriggerId: Longword;
 			FlightTime: Longword;
 			uid: Longword
-			end;
+		end;
 
+var AllInactive: boolean;
+    PrvInactive: boolean;
+    CurAmmoGear: PGear;
+    GearsList: PGear;
+    KilledHHs: Longword;
+    SuddenDeathDmg: Boolean;
+    SpeechType: Longword;
+    SpeechText: shortstring;
+    TrainingTargetGear: PGear;
+    skipFlag: boolean;
+    
 procedure init_uGears;
 procedure free_uGears;
 function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
@@ -74,15 +85,6 @@
 procedure InsertGearToList(Gear: PGear);
 procedure RemoveGearFromList(Gear: PGear);
 
-var CurAmmoGear: PGear;
-    GearsList: PGear;
-    KilledHHs: Longword;
-    SuddenDeathDmg: Boolean;
-    SpeechType: Longword;
-    SpeechText: shortstring;
-    TrainingTargetGear: PGear;
-    skipFlag: boolean;
-
 implementation
 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics,
 	uAIMisc, uLocale, uAI, uAmmos, uTriggers, uStats, uVisualGears,
@@ -1534,13 +1536,13 @@
 procedure FreeGearsList;
 var t, tt: PGear;
 begin
-tt:= GearsList;
-GearsList:= nil;
-while tt <> nil do
+	tt:= GearsList;
+	GearsList:= nil;
+	while tt <> nil do
 	begin
-	t:= tt;
-	tt:= tt^.NextGear;
-	Dispose(t)
+		t:= tt;
+		tt:= tt^.NextGear;
+		Dispose(t)
 	end;
 end;
 
@@ -2051,6 +2053,9 @@
 	SpeechType:= 1;
 	TrainingTargetGear:= nil;
 	skipFlag:= false;
+	
+	AllInactive:= false;
+	PrvInactive:= false;
 end;
 
 procedure free_uGears;
--- a/hedgewars/uIO.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uIO.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -22,10 +22,12 @@
 interface
 uses SDLh;
 
-const ipcPort: Word = 0;
-var hiTicks: Word;
+var ipcPort: Word;
+    hiTicks: Word;
 
 procedure init_uIO;
+procedure free_uIO;
+
 procedure SendIPC(s: shortstring);
 procedure SendIPCXY(cmd: char; X, Y: SmallInt);
 procedure SendIPCRaw(p: pointer; len: Longword);
@@ -352,6 +354,12 @@
 
 	hiTicks:= 0;
 	SendEmptyPacketTicks:= 0;
+	ipcPort:= 0;
+end;
+
+procedure free_uIO;
+begin
+
 end;
 
 end.
--- a/hedgewars/uKeys.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uKeys.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -25,6 +25,9 @@
 type TBinds = array[0..cKeyMaxIndex] of shortstring;
 type TKeyboardState = array[0..cKeyMaxIndex] of Byte;
 
+procedure init_uKeys;
+procedure free_uKeys;
+
 function  KeyNameToCode(name: string): word;
 procedure ProcessKbd;
 procedure ResetKbd;
@@ -41,27 +44,23 @@
 procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean);
 
 var	hideAmmoMenu: boolean;
-	wheelUp: boolean = false;
-	wheelDown: boolean = false;
-{$IFDEF TOUCHINPUT}
-	leftClick: boolean = false;
-	middleClick: boolean = false;
-	rightClick: boolean = false;
+	wheelUp: boolean;
+	wheelDown: boolean;
+{$IFDEF IPHONEOS}
+	leftClick: boolean;
+	middleClick: boolean;
+	rightClick: boolean;
 
-	upKey: boolean = false;
-	downKey: boolean = false;
-	rightKey: boolean = false;
-	leftKey: boolean = false;
+	upKey: boolean;
+	downKey: boolean;
+	rightKey: boolean;
+	leftKey: boolean;
 
-	backspaceKey: boolean = false;
-	spaceKey: boolean = false;
-	enterKey: boolean = false;
-	tabKey: boolean = false;
+	backspaceKey: boolean;
+	spaceKey: boolean;
+	enterKey: boolean;
+	tabKey: boolean;
 
-	isAttacking: boolean = false;
-	isWalking: boolean = false;
-{$ENDIF}
-{$IFDEF IPHONEOS}
 	theJoystick: PSDL_Joystick;
 {$ENDIF}
 	ControllerNumControllers: Integer;
@@ -130,7 +129,7 @@
 tkbdn[5]:= ord(wheelUp);
 wheelUp:= false;
 wheelDown:= false;
-{$IFDEF TOUCHINPUT}
+{$IFDEF IPHONEOS}
 tkbdn[1]:= ord(leftClick);
 tkbdn[2]:= ord(middleClick);
 tkbdn[3]:= ord(rightClick);
@@ -331,7 +330,7 @@
 		end;
 	end;
 
-{$IFDEF TOUCHINPUT}
+{$IFDEF IPHONEOS}
 DefaultBinds[  1]:= '/put';
 DefaultBinds[  3]:= 'ammomenu';
 DefaultBinds[  8]:= 'hjump';
@@ -469,8 +468,34 @@
 
 procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean);
 begin
-	if pressed then ControllerButtons[joy][button]:= 1 else ControllerButtons[joy][button]:= 0;
+	if pressed then ControllerButtons[joy][button]:= 1
+	else ControllerButtons[joy][button]:= 0;
 end;
 
+procedure init_uKeys;
+begin
+	wheelUp:= false;
+	wheelDown:= false;
+{$IFDEF IPHONEOS}
+	leftClick:= false;
+	middleClick:= false;
+	rightClick:= false;
+
+	upKey:= false;
+	downKey:= false;
+	rightKey:= false;
+	leftKey:= false;
+
+	backspaceKey:= false;
+	spaceKey:= false;
+	enterKey:= false;
+	tabKey:= false;
+{$ENDIF}
+end;
+
+procedure free_uKeys;
+begin
+
+end;
 
 end.
--- a/hedgewars/uLandGraphics.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uLandGraphics.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -27,9 +27,9 @@
                                    Left, Right: LongInt;
                                    end;
 
-function SweepDirty: boolean;
-function Despeckle(X, Y: LongInt): boolean;
-function CheckLandValue(X, Y: LongInt; Color: Word): boolean;
+function  SweepDirty: boolean;
+function  Despeckle(X, Y: LongInt): boolean;
+function  CheckLandValue(X, Y: LongInt; Color: Word): boolean;
 procedure DrawExplosion(X, Y, Radius: LongInt);
 procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
 procedure DrawTunnel(X, Y, dX, dY: hwFloat; ticks, HalfWidth: LongInt);
--- a/hedgewars/uLandTexture.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uLandTexture.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -115,10 +115,13 @@
 procedure FreeLand;
 var x, y: LongInt;
 begin
-for x:= 0 to LANDTEXARW -1 do
-	for y:= 0 to LANDTEXARH - 1 do
-		with LandTextures[x, y] do
-			FreeTexture(tex)
+	for x:= 0 to LANDTEXARW -1 do
+		for y:= 0 to LANDTEXARH - 1 do
+			with LandTextures[x, y] do
+			begin
+				FreeTexture(tex);
+				tex:= nil;
+			end;
 end;
 
 end.
--- a/hedgewars/uLocale.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uLocale.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -62,8 +62,8 @@
 trammo[sidNothing]:= ' ';
 for e:= Low(TEventId) to High(TEventId) do first[e]:= true;
 
-{$I-} //iochecks off
-filemode:=0; //readonly
+{$I-} // iochecks off
+filemode:= 0; // readonly
 Assign(f, FileName);
 reset(f);
 // if the locale does not exist, fallback to the default one
--- a/hedgewars/uMisc.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uMisc.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -581,7 +581,7 @@
 	cGravity                := cMaxWindSpeed;
 	cDamageModifier         := _1;
 	TargetPoint             := cTargetPointRef;
-    TextureList             := nil;
+	TextureList             := nil;
 	
 	// int, longint longword and byte
 	CursorMovementX		:= 0;
@@ -681,7 +681,6 @@
 		if IOResult = 0 then break;
 	end;
 {$ENDIF}
-
 {$I+}
 {$ENDIF}
 
@@ -689,13 +688,13 @@
 
 procedure free_uMisc;
 begin
-while TextureList <> nil do FreeTexture(TextureList);
-//uRandom.DumpBuffer;
+	//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;
 
--- a/hedgewars/uRandom.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uRandom.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -24,6 +24,8 @@
 {$INCLUDE "proto.inc"}
 
 procedure init_uRandom;
+procedure free_uRandom;
+
 procedure SetRandomSeed(Seed: shortstring);
 function  GetRandom: hwFloat; overload;
 function  GetRandom(m: LongWord): LongWord; overload;
@@ -99,4 +101,9 @@
 	n:= 54;
 end;
 
+procedure free_uRandom;
+begin
+
+end;
+
 end.
--- a/hedgewars/uSound.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uSound.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -28,6 +28,11 @@
 		chunks: array [TSound] of PMixChunk;
 		end;
 
+var MusicFN: shortstring;
+
+procedure init_uSound;
+procedure free_uSound;
+
 procedure InitSound;
 procedure ReleaseSound;
 procedure SoundLoad;
@@ -38,20 +43,18 @@
 procedure ResumeMusic;
 procedure StopSound(snd: TSound);
 function  ChangeVolume(voldelta: LongInt): LongInt;
-
 function  AskForVoicepack(name: shortstring): Pointer;
 
-var MusicFN: shortstring = '';
 
 implementation
 uses uMisc, uConsole;
 
 const chanTPU = 12;
 var Volume: LongInt;
-	lastChan: array [TSound] of LongInt;
-	voicepacks: array[0..cMaxTeams] of TVoicepack;
-	defVoicepack: PVoicepack;
-	Mus: PMixMusic = nil;
+    lastChan: array [TSound] of LongInt;
+    voicepacks: array[0..cMaxTeams] of TVoicepack;
+    defVoicepack: PVoicepack;
+    Mus: PMixMusic = nil;
 
 function  AskForVoicepack(name: shortstring): Pointer;
 var i: Longword;
@@ -226,5 +229,15 @@
 Mix_ResumeMusic(Mus);
 end;
 
+procedure init_uSound;
+begin
+	MusicFN:='';
+end;
+
+procedure free_uSound;
+begin
+
+end;
+
 end.
 
--- a/hedgewars/uStats.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uStats.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -34,16 +34,18 @@
                    FinishedTurns: Longword;
                    end;
 
+var TotalRounds: LongInt;
+    FinishedTurnsTotal: LongInt;
+
+procedure init_uStats;
+procedure free_uStats;
+
 procedure AmmoUsed(am: TAmmoType);
 procedure HedgehogDamaged(Gear: PGear);
 procedure Skipped;
 procedure TurnReaction;
 procedure SendStats;
 
-var
-	TotalRounds: LongInt = -1;
-	FinishedTurnsTotal: LongInt = -1;
-
 implementation
 uses uTeams, uSound, uMisc, uLocale, uWorld;
 var DamageGiven : Longword = 0;
@@ -217,4 +219,15 @@
 if KilledHHs > 0 then SendStat(siKilledHHs, inttostr(KilledHHs));
 end;
 
+procedure init_uStats;
+begin
+	TotalRounds:= -1;
+	FinishedTurnsTotal:= -1;
+end;
+    
+procedure free_uStats;
+begin
+
+end;
+
 end.
--- a/hedgewars/uStore.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uStore.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -45,6 +45,8 @@
 {$ENDIF}
 
 procedure init_uStore;
+procedure free_uStore;
+
 procedure StoreLoad;
 procedure StoreRelease;
 procedure DrawSpriteFromRect(Sprite: TSprite; r: TSDL_Rect; X, Y, Height, Position: LongInt);
@@ -1185,21 +1187,15 @@
 	
 		WriteToConsole(msgLoading + 'progress sprite: ');
 		texsurf:= LoadImage(Pathz[ptGraphics] + '/Progress', ifCritical or ifTransparent);
-{$IFDEF SDL13notworking}
-		ProgrTex:= SDL_CreateTextureFromSurface(0, texsurf);
-{$ELSE}
+
 		ProgrTex:= Surface2Tex(texsurf, false);
-{$ENDIF}
+		
 		squaresize:= texsurf^.w shr 1;
 		numsquares:= texsurf^.h div squaresize;
 		SDL_FreeSurface(texsurf);
 	end;
 
-{$IFDEF SDL13notworking}
-	TryDo(ProgrTex <> 0, 'Error - Progress Texure is 0!', true);
-{$ELSE}
 	TryDo(ProgrTex <> nil, 'Error - Progress Texure is nil!', true);
-{$ENDIF}
 
 	glClear(GL_COLOR_BUFFER_BIT);
 	glEnable(GL_TEXTURE_2D);
@@ -1210,25 +1206,22 @@
 	r.w:= squaresize;
 	r.h:= squaresize;
 	
-{$IFDEF SDL13notworking}
-	SDL_RenderCopy(ProgrTex, nil, @r);
-{$ELSE}	
 	DrawFromRect( -squaresize div 2, (cScreenHeight - squaresize) shr 1, @r, ProgrTex);
-{$ENDIF}
+
 	glDisable(GL_TEXTURE_2D);
 	SDL_GL_SwapBuffers();
+{$IFDEF SDL13}
+	SDL_RenderPresent();
+{$ENDIF}
 	inc(Step);
+
 end;
 
 
 procedure FinishProgress;
 begin
 	WriteLnToConsole('Freeing progress surface... ');
-{$IFDEF SDL13notworking}
-	SDL_DestroyTexture(ProgrTex);
-{$ELSE}
 	FreeTexture(ProgrTex);
-{$ENDIF}
 
 {$IFDEF IPHONEOS}
 	// show overlay buttons
@@ -1319,4 +1312,9 @@
 {$ENDIF}
 end;
 
+procedure free_uStore;
+begin
+
+end;
+
 end.
--- a/hedgewars/uTeams.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uTeams.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -234,7 +234,7 @@
 {$IFDEF DEBUGFILE}AddFileLog('Wind = '+FloatToStr(cWindSpeed));{$ENDIF}
 ApplyAmmoChanges(CurrentHedgehog^);
 
-{$IFNDEF TOUCHINPUT}
+{$IFNDEF IPHONEOS}
 if not CurrentTeam^.ExtDriven then SetBinds(CurrentTeam^.Binds);
 {$ENDIF}
 
--- a/hedgewars/uTriggers.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uTriggers.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -26,6 +26,7 @@
 type TTrigAction = (taSpawnGear, taSuccessFinish, taFailFinish);
 
 procedure init_uTriggers;
+procedure free_uTriggers;
 procedure AddTriggerSpawner(id, Ticks, Lives: Longword; GearType: TGearType; X, Y: LongInt; GearTriggerId: Longword);
 procedure AddTriggerSuccess(id, Ticks, Lives: Longword);
 procedure AddTriggerFail(id, Ticks, Lives: Longword);
@@ -149,4 +150,9 @@
 	TriggerList:= nil;
 end;
 
+procedure free_uTriggers;
+begin
+
+end;
+
 end.
--- a/hedgewars/uVisualGears.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uVisualGears.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -49,6 +49,7 @@
 
 procedure init_uVisualGears;
 procedure free_uVisualGears;
+
 function  AddVisualGear(X, Y: LongInt; Kind: TVisualGearType): PVisualGear;
 procedure ProcessVisualGears(Steps: Longword);
 procedure DrawVisualGears(Layer: LongWord);
@@ -561,7 +562,7 @@
 
 procedure free_uVisualGears;
 begin
-while VisualGearsList <> nil do DeleteVisualGear(VisualGearsList);
+	while VisualGearsList <> nil do DeleteVisualGear(VisualGearsList);
 end;
 
 end.
--- a/hedgewars/uWorld.pas	Tue Jan 26 04:13:37 2010 +0000
+++ b/hedgewars/uWorld.pas	Tue Jan 26 21:55:51 2010 +0000
@@ -22,17 +22,7 @@
 interface
 uses SDLh, uGears, uConsts, uFloat, uRandom;
 
-const WorldDx: LongInt = -512;
-      WorldDy: LongInt = -256;
 
-procedure init_uWorld;
-procedure InitWorld;
-procedure DrawWorld(Lag: LongInt);
-procedure AddCaption(s: string; Color: Longword; Group: TCapGroup);
-
-{$IFDEF COUNTTICKS}
-var cntTicks: LongWord;
-{$ENDIF}
 var FollowGear: PGear;
     WindBarWidth: LongInt;
     bShowAmmoMenu: boolean;
@@ -40,6 +30,18 @@
     bShowFinger: boolean;
     Frames: Longword;
     WaterColor, DeepWaterColor: TSDL_Color;
+    WorldDx: LongInt;
+    WorldDy: LongInt;
+{$IFDEF COUNTTICKS}
+    cntTicks: LongWord;
+{$ENDIF}
+
+procedure init_uWorld;
+procedure free_uWorld;
+
+procedure InitWorld;
+procedure DrawWorld(Lag: LongInt);
+procedure AddCaption(s: string; Color: Longword; Group: TCapGroup);
 
 implementation
 uses	uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand,
@@ -49,11 +51,6 @@
 	GL;
 {$ENDIF}
 
-const FPS: Longword = 0;
-      CountTicks: Longword = 0;
-      SoundTimerTicks: Longword = 0;
-      prevPoint: TPoint = (X: 0; Y: 0);
-
 type TCaptionStr = record
                    Tex: PTexture;
                    EndTime: LongWord;
@@ -64,6 +61,10 @@
     AMxShift, SlotsNum: LongInt;
     tmpSurface: PSDL_Surface;
     fpsTexture: PTexture;
+    FPS: Longword;
+    CountTicks: Longword;
+    SoundTimerTicks: Longword;
+    prevPoint: TPoint;
 
 procedure InitWorld;
 var i, t: LongInt;
@@ -505,19 +506,19 @@
 if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then i:= 48 else i:= 8;
 {$ENDIF}
 
-for grp:= Low(TCapGroup) to High(TCapGroup) do
-    with Captions[grp] do
-         if Tex <> nil then
-            begin
-            DrawCentered(0, i, Tex);
-            inc(i, Tex^.h + 2);
-            if EndTime <= RealTicks then
-               begin
-               FreeTexture(Tex);
-               Tex:= nil;
-               EndTime:= 0
-               end
-            end;
+	for grp:= Low(TCapGroup) to High(TCapGroup) do
+		with Captions[grp] do
+			if Tex <> nil then
+			begin
+				DrawCentered(0, i, Tex);
+				inc(i, Tex^.h + 2);
+				if EndTime <= RealTicks then
+				begin
+					FreeTexture(Tex);
+					Tex:= nil;
+					EndTime:= 0
+				end;
+			end;
 
 // Teams Healths
 for t:= 0 to Pred(TeamsCount) do
@@ -753,8 +754,21 @@
 	bSelected:= false;
 	bShowFinger:= false;
 	Frames:= 0;
+	WorldDx:= -512;
+	WorldDy:= -256;
+    
+	FPS:= 0;
+	CountTicks:= 0;
+	SoundTimerTicks:= 0;
+	prevPoint.X:= 0;
+	prevPoint.Y:= 0;
 	
 	FillChar(Captions, sizeof(Captions), 0)
 end;
 
+procedure free_uWorld;
+begin
+
+end;
+
 end.