Patch by koda:
authorunc0rr
Thu, 11 Jun 2009 15:22:02 +0000
changeset 2152 a2811690da1b
parent 2151 541d3a475442
child 2153 e41fdfaa8edd
Patch by koda: - Rename some symbols - Ctrl click
hedgewars/SDLh.pas
hedgewars/hwengine.dpr
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uKeys.pas
hedgewars/uLand.pas
hedgewars/uLandObjects.pas
hedgewars/uLandTexture.pas
hedgewars/uMisc.pas
hedgewars/uStore.pas
hedgewars/uTeams.pas
hedgewars/uVisualGears.pas
hedgewars/uWorld.pas
--- a/hedgewars/SDLh.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/SDLh.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -37,7 +37,7 @@
 
 {$IFDEF DARWIN}
 	  {$PASCALMAINNAME SDL_main}
-{$IFNDEF IPHONE}
+{$IFNDEF IPHONEOS}
 	  {$linkframework Cocoa}
 	  {$linkframework SDL}
 	  {$linkframework SDL_mixer}
@@ -57,7 +57,7 @@
       {$ENDIF}
       {$IFDEF UNIX}
 	{$IFDEF DARWIN}
-	  SDLLibName = 'libSDL.a';
+	  SDLLibName = 'SDL';
 	{$ELSE}
           SDLLibName = 'libSDL.so';
         {$ENDIF}
@@ -264,7 +264,11 @@
 function  SDL_RWFromFile(filename, mode: PChar): PSDL_RWops; cdecl; external SDLLibName;
 function  SDL_SaveBMP_RW(surface: PSDL_Surface; dst: PSDL_RWops; freedst: LongInt): LongInt; cdecl; external SDLLibName;
 
+{$IFDEF SDL13}
+function  SDL_GetKeyboardState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
+{$ELSE}
 function  SDL_GetKeyState(numkeys: PLongInt): PByteArray; cdecl; external SDLLibName;
+{$ENDIF}
 function  SDL_GetMouseState(x, y: PInteger): Byte; cdecl; external SDLLibName;
 function  SDL_GetKeyName(key: Longword): PChar; cdecl; external SDLLibName;
 procedure SDL_WarpMouse(x, y: Word); cdecl; external SDLLibName;
@@ -290,7 +294,7 @@
       {$ENDIF}
       {$IFDEF UNIX}
 	{$IFDEF DARWIN}
-	  SDL_TTFLibName = 'libSDL_ttf.a';
+	  SDL_TTFLibName = 'SDL_ttf';
 	{$ELSE}
           SDL_TTFLibName = 'libSDL_ttf.so';
         {$ENDIF}
@@ -324,7 +328,7 @@
       {$ENDIF}
       {$IFDEF UNIX}
 	{$IFDEF DARWIN}
-	  SDL_MixerLibName = 'libSDL_mixer.a';
+	  SDL_MixerLibName = 'SDL_mixer';
 	{$ELSE}
           SDL_MixerLibName = 'libSDL_mixer.so';
 	{$ENDIF}
@@ -389,7 +393,7 @@
       {$ENDIF}
       {$IFDEF UNIX}
 	{$IFDEF DARWIN}
-	  SDL_ImageLibName = 'libSDL_image.a';
+	  SDL_ImageLibName = 'SDL_image';
 	{$ELSE}
            SDL_ImageLibName = 'libSDL_image.so';
 	{$ENDIF}
@@ -404,7 +408,7 @@
       {$ENDIF}
       {$IFDEF UNIX}
 	{$IFDEF DARWIN}
-	  SDL_NetLibName = 'libSDL_net.a';
+	  SDL_NetLibName = 'SDL_net';
 	{$ELSE}
           SDL_NetLibName = 'libSDL_net.so';
 	{$ENDIF}
--- a/hedgewars/hwengine.dpr	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/hwengine.dpr	Thu Jun 11 15:22:02 2009 +0000
@@ -23,7 +23,7 @@
 program hwengine;
 uses
 	SDLh in 'SDLh.pas',
-{$IFDEF IPHONE}
+{$IFDEF GLES11}
 	gles11,
 {$ELSE}
 	GL,
--- a/hedgewars/uConsts.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uConsts.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -21,7 +21,7 @@
 
 uses 
 	SDLh,
-{$IFDEF IPHONE}
+{$IFDEF GLES11}
 	gles11,
 {$ELSE}
 	GL,
--- a/hedgewars/uGears.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uGears.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -79,7 +79,7 @@
 implementation
 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions,
 	uLand, uIO, uLandGraphics, uAIMisc, uLocale, uAI, uAmmos, uTriggers, 
-{$IFDEF IPHONE}
+{$IFDEF GLES11}
 	gles11,
 {$ELSE}
 	GL,
--- a/hedgewars/uKeys.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uKeys.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -62,11 +62,21 @@
           and (not CurrentTeam^.ExtDriven)
           and (CurrentHedgehog^.BotLevel = 0);
 
+{$IFDEF SDL13}
+pkbd:= SDL_GetKeyboardState(nil);
+{$ELSE}
 pkbd:= SDL_GetKeyState(nil);
+{$ENDIF}
 i:= SDL_GetMouseState(nil, nil);
 pkbd^[1]:= (i and 1);
 pkbd^[2]:= ((i shr 1) and 1);
+{$IFDEF DARWIN}
+//    normal right click     ||      ctrl (left/right) + left click	  
+pkbd^[3]:= ((i shr 2) and 1) or ((i and 1) and (pkbd^[306] or pkbd^[305]));
+{$ELSE}
 pkbd^[3]:= ((i shr 2) and 1);
+{$ENDIF}
+
 for i:= 1 to cKeyMaxIndex do
 if CurrentBinds[i][0] <> #0 then
 	begin
@@ -88,7 +98,11 @@
 var i, t: LongInt;
     pkbd: PByteArray;
 begin
+{$IFDEF SDL13}
+pkbd:= PByteArray(SDL_GetKeyboardState(@i));
+{$ELSE}
 pkbd:= PByteArray(SDL_GetKeyState(@i));
+{$ENDIF}
 TryDo(i < cKeyMaxIndex, 'SDL keys number is more than expected (' + inttostr(i) + ')', true);
 for t:= 0 to Pred(i) do
     tkbd[i]:= pkbd^[i]
--- a/hedgewars/uLand.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uLand.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -19,7 +19,7 @@
 unit uLand;
 interface
 uses SDLh, uLandTemplates, uFloat, 
-{$IFDEF IPHONE}
+{$IFDEF GLES11}
 	gles11,
 {$ELSE}
 	GL,
@@ -34,7 +34,7 @@
      LandPixels: TLandArray;
      LandDirty: TDirtyTag;
      hasBorder: boolean; // I'm putting this here for now.  I'd like it to be toggleable by user (so user can set a border on a non-cave map) - will turn off air attacks
-     hasGirders: boolean;  // I think should be on template by template basis. some caverns might have open water and large spaces.  Some islands don't need? It might be better to tweak the girder code based upon space above.  dunno.
+     hasGirders: boolean;  // I think should be on template by template basis. some caverns might have open water and large spaces.  Some islands do not need? It might be better to tweak the girder code based upon space above.  dunno.
      playHeight, playWidth, leftX, rightX, topY, MaxHedgehogs: Longword;  // idea is that a template can specify height/width.  Or, a map, a height/width by the dimensions of the image.  If the map has pixels near top of image, it triggers border.  Maybe not a good idea, but, for now?  Could also be used to prevent placing a girder outside play area on maps with hasBorder = true
 
 // in your coding style, it appears to be "isXXXX" for a verb, and "FooBar" for everything else - should be PlayHeight ?
@@ -77,7 +77,11 @@
 if digest = '' then
    digest:= s
 else
+{$IFDEF IPHONEOS}
+   //TryDo(s = digest, 'Different maps generated, sorry', false)
+{$ELSE}
    TryDo(s = digest, 'Different maps generated, sorry', true)
+{$ENDIF}
 end;
 
 procedure DrawLine(X1, Y1, X2, Y2: LongInt; Color: Longword);
--- a/hedgewars/uLandObjects.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uLandObjects.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -28,7 +28,7 @@
 
 implementation
 uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uFloat, 
-{$IFDEF IPHONE}
+{$IFDEF GLES11}
 	gles11,
 {$ELSE}
 	GL,
--- a/hedgewars/uLandTexture.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uLandTexture.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -26,7 +26,7 @@
 
 implementation
 uses uMisc, uLand, uStore, 
-{$IFDEF IPHONE}
+{$IFDEF GLES11}
 	gles11,
 {$ELSE}
 	GL,
--- a/hedgewars/uMisc.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uMisc.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -19,7 +19,7 @@
 unit uMisc;
 interface
 uses uConsts, SDLh,
-{$IFDEF IPHONE}
+{$IFDEF GLES11}
 	gles11,
 {$ELSE}
 	GL,
@@ -507,7 +507,7 @@
 size:= cScreenWidth * cScreenHeight * 3;
 p:= GetMem(size);
 
-{$IFDEF IPHONE}
+{$IFDEF IPHONEOS}
 //since opengl es operates on a single surface GL_FRONT is implied, but how to test that?
 {$ELSE}
 glReadBuffer(GL_FRONT);
--- a/hedgewars/uStore.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uStore.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -19,7 +19,7 @@
 unit uStore;
 interface
 uses sysutils, uConsts, uTeams, SDLh,
-{$IFDEF IPHONE}
+{$IFDEF GLES11}
 	gles11,
 {$ELSE}
 	GL,
--- a/hedgewars/uTeams.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uTeams.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -19,7 +19,7 @@
 unit uTeams;
 interface
 uses SDLh, uConsts, uKeys, uGears, uRandom, uFloat, uStats, uVisualGears, 
-{$IFDEF IPHONE}
+{$IFDEF GLES11}
 	gles11,
 {$ELSE}
 	GL,
--- a/hedgewars/uVisualGears.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uVisualGears.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -19,7 +19,7 @@
 unit uVisualGears;
 interface
 uses SDLh, uConsts,
-{$IFDEF IPHONE}
+{$IFDEF GLES11}
 	gles11,
 {$ELSE}
 	GL,
--- a/hedgewars/uWorld.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uWorld.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -40,7 +40,7 @@
 
 implementation
 uses uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound,
-{$IFDEF IPHONE}
+{$IFDEF GLES11}
 	gles11,
 {$ELSE}
 	GL,
@@ -417,7 +417,7 @@
       CountTicks:= 0;
       s:= inttostr(FPS) + ' fps';
       if fpsTexture <> nil then FreeTexture(fpsTexture);
-{$IFNDEF IPHONE}
+{$IFNDEF IPHONEOS}
       tmpSurface:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(s), $FFFFFF);
 {$ENDIF}
       fpsTexture:= Surface2Tex(tmpSurface);