slight cleanup, fix compiling with sdl-1.2 hedgeroid
authorkoda
Sat, 12 Nov 2011 18:38:21 +0100
branchhedgeroid
changeset 6341 ccc0a58e123d
parent 6338 633af6fec34f
child 6344 cba81e10235c
slight cleanup, fix compiling with sdl-1.2
hedgewars/SDLh.pas
hedgewars/hwengine.pas
hedgewars/uAI.pas
hedgewars/uGame.pas
--- a/hedgewars/SDLh.pas	Sat Nov 12 18:02:55 2011 +0100
+++ b/hedgewars/SDLh.pas	Sat Nov 12 18:38:21 2011 +0100
@@ -41,8 +41,8 @@
   {$IFDEF HAIKU}
     {$linklib root}
   {$ELSE}
-    {$IFNDEF ANDROID}    
-	{$linklib pthread}
+    {$IFNDEF ANDROID}
+      {$linklib pthread}
     {$ENDIF}
   {$ENDIF}
 {$ENDIF}
@@ -464,9 +464,6 @@
         text: array[0..31] of Byte;
         end;
 
-    SDL_TouchID = LongInt;
-    SDL_FingerID = LongInt;
-
     TSDL_TouchFingerEvent = record
         type_: LongWord;
         windowId: LongWord;
@@ -615,8 +612,6 @@
 {$ENDIF}
         end;
 
-//TODO: implement SDL_TouchButtonEvent, SDL_MultiGestureEvent, SDL_DollarGestureEvent
-
     TSDL_QuitEvent = record
         type_: {$IFDEF SDL13}LongWord{$ELSE}Byte{$ENDIF};
         end;
@@ -865,9 +860,9 @@
 procedure SDL_StartTextInput; cdecl; external SDLLibName;
 
 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; minType, maxType: LongWord): LongInt; cdecl; external SDLLibName;
-function  SDL_CreateThread(fn: pointer; name: PChar; data: pointer): PSDL_Thread; cdecl; external SDLLibName;
+function  SDL_CreateThread(fn: Pointer; name: PChar; data: Pointer): PSDL_Thread; cdecl; external SDLLibName;
 {$ELSE}
-function  SDL_CreateThread(fn: pointer; data: pointer): PSDL_Thread; cdecl; external SDLLibName;
+function  SDL_CreateThread(fn: Pointer; data: Pointer): PSDL_Thread; cdecl; external SDLLibName;
 function  SDL_PeepEvents(event: PSDL_Event; numevents: LongInt; action: SDL_eventaction; mask: LongWord): LongInt; cdecl; external SDLLibName;
 {$ENDIF}
 
--- a/hedgewars/hwengine.pas	Sat Nov 12 18:02:55 2011 +0100
+++ b/hedgewars/hwengine.pas	Sat Nov 12 18:38:21 2011 +0100
@@ -31,7 +31,8 @@
 
 uses SDLh, uMisc, uConsole, uGame, uConsts, uLand, uAmmos, uVisualGears, uGears, uStore, uWorld, uKeys, uSound,
      uScript, uTeams, uStats, uIO, uLocale, uChat, uAI, uAIMisc, uRandom, uLandTexture, uCollisions,
-     sysutils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted,uTouch {$IFDEF ANDROID}, GLUnit {$ENDIF};
+     sysutils, uTypes, uVariables, uCommands, uUtils, uCaptions, uDebug, uCommandHandlers, uLandPainted
+     {$IFDEF SDL13}, uTouch{$ENDIF}{$IFDEF ANDROID}, GLUnit{$ENDIF};
 
 {$IFDEF HWLIBRARY}
 procedure initEverything(complete:boolean);
@@ -258,8 +259,6 @@
     cBits:= 32;
     cFullScreen:= false;
     cTimerInterval:= 8;
-    PathPrefix:= 'Data';
-    UserPathPrefix:= '../Documents';
     cShowFPS:= {$IFDEF DEBUGFILE}true{$ELSE}false{$ENDIF};
     val(gameArgs[0], ipcPort);
     val(gameArgs[1], cScreenWidth);
@@ -273,7 +272,7 @@
     isMusicEnabled:= gameArgs[7] = '1';
     cAltDamage:= gameArgs[8] = '1';
     PathPrefix:= gameArgs[9];
-    UserPathPrefix:= PathPrefix;
+    UserPathPrefix:= '../Documents';
     recordFileName:= gameArgs[10];
     cStereoMode:= smNone;
 {$ENDIF}
@@ -388,10 +387,8 @@
 
     if complete then
     begin
-{$IFDEF ANDROID}
-	GLUnit.init;
-{$ENDIF}
-        uTouch.initModule;
+{$IFDEF ANDROID}GLUnit.init;{$ENDIF}
+{$IFDEF SDL13}uTouch.initModule;{$ENDIF}
 	uAI.initModule;
         //uAIActions does not need initialization
         //uAIAmmoTests does not need initialization
--- a/hedgewars/uAI.pas	Sat Nov 12 18:02:55 2011 +0100
+++ b/hedgewars/uAI.pas	Sat Nov 12 18:38:21 2011 +0100
@@ -320,10 +320,7 @@
 //TODO: sdl_thread works on device but crashes in simulator, most likely because of outdated toolchain
 BeginThread(@Think, Me, ThinkThread);
 {$ELSE}
-{$IFDEF SDL13}
-ThinkThread := SDL_CreateThread(@Think, nil, Me);
-{$ELSE}
-ThinkThread := SDL_CreateThread(@Think, Me);
+ThinkThread := SDL_CreateThread(@Think{$IFDEF SDL13}, nil{$ENDIF}, Me);
 {$ENDIF}
 AddFileLog('Thread started');
 end;
--- a/hedgewars/uGame.pas	Sat Nov 12 18:02:55 2011 +0100
+++ b/hedgewars/uGame.pas	Sat Nov 12 18:38:21 2011 +0100
@@ -26,7 +26,7 @@
 ////////////////////
    implementation
 ////////////////////
-uses uKeys, uTeams, uIO, uAI, uGears, uSound, uMobile, uVisualGears, uTypes, uVariables, uTouch;
+uses uKeys, uTeams, uIO, uAI, uGears, uSound, uMobile, uVisualGears, uTypes, uVariables{$IFDEF SDL13}, uTouch{$ENDIF};
 
 procedure DoGameTick(Lag: LongInt);
 var i: LongInt;
@@ -53,7 +53,7 @@
        begin
        if CurrentHedgehog^.BotLevel <> 0 then ProcessBot;
        ProcessGears;
-       ProcessTouch;
+       {$IFDEF SDL13}ProcessTouch;{$ENDIF}
        end else
        begin
        NetGetNextCmd;