update SDLMain.m/.h to latest version
authorkoda
Sat, 19 Dec 2009 19:37:30 +0000
changeset 2666 2b8c8f16421e
parent 2665 50b4e544c163
child 2667 d9201436c6cf
update SDLMain.m/.h to latest version rename cNearBlackColor to cNearBlackColorChannels for readability merge tunsetborder.inc in uLandGraphics.pas
CMakeLists.txt
hedgewars/CMakeLists.txt
hedgewars/SDLMain.m
hedgewars/tunsetborder.inc
hedgewars/uLandGraphics.pas
hedgewars/uMisc.pas
hedgewars/uStore.pas
--- a/CMakeLists.txt	Fri Dec 18 02:47:28 2009 +0000
+++ b/CMakeLists.txt	Sat Dec 19 19:37:30 2009 +0000
@@ -46,7 +46,7 @@
 		if(current_macosx_version MATCHES "10.6")
 			set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")	#;ppc7400
 		else()
-			set(CMAKE_OSX_ARCHITECTURES "i386")	#;ppc7400
+			set(CMAKE_OSX_ARCHITECTURES "i386;ppc7400")
 		endif()
 	ENDIF()	
 
@@ -89,7 +89,7 @@
 set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
 set(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
 
-set(pascal_compiler_flags_cmn "-B" "-FE../bin" "-Fl../bin/" "-Cs2000000" "-vwi" "/Users/vittorio/hedge.build/trunk/SDLMain.o")
+set(pascal_compiler_flags_cmn "-B" "-FE../bin" "-Fl../bin/" "-Cs2000000" "-vwi")
 if(LOWRES)
 	set(pascal_compiler_flags_cmn "-dLOWRES" ${pascal_compiler_flags_cmn})
 	add_definitions(-DLOWRES)
--- a/hedgewars/CMakeLists.txt	Fri Dec 18 02:47:28 2009 +0000
+++ b/hedgewars/CMakeLists.txt	Sat Dec 19 19:37:30 2009 +0000
@@ -50,7 +50,6 @@
 	SinTable.inc
 	options.inc
 	${CMAKE_CURRENT_BINARY_DIR}/proto.inc
-	tunsetborder.inc
 	)
 
 find_program(fpc_executable ${fpc_tryexe})
--- a/hedgewars/SDLMain.m	Fri Dec 18 02:47:28 2009 +0000
+++ b/hedgewars/SDLMain.m	Sat Dec 19 19:37:30 2009 +0000
@@ -64,10 +64,10 @@
 @end
 #endif
 
-@interface NSApplication (SDLApplication)
+@interface SDLApplication : NSApplication
 @end
 
-@implementation NSApplication (SDLApplication)
+@implementation SDLApplication
 /* Invoked from the Quit menu item */
 - (void)terminate:(id)sender
 {
@@ -119,6 +119,7 @@
         if ([menuItem hasSubmenu])
             [self fixMenu:[menuItem submenu] withAppName:appName];
     }
+    [ aMenu sizeToFit ];
 }
 
 #else
@@ -201,7 +202,7 @@
     SDLMain				*sdlMain;
 
     /* Ensure the application object is initialised */
-    [NSApplication sharedApplication];
+    [SDLApplication sharedApplication];
     
 #ifdef SDL_USE_CPS
     {
@@ -210,7 +211,7 @@
         if (!CPSGetCurrentProcess(&PSN))
             if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
                 if (!CPSSetFrontProcess(&PSN))
-                    [NSApplication sharedApplication];
+                    [SDLApplication sharedApplication];
     }
 #endif /* SDL_USE_CPS */
 
@@ -372,6 +373,7 @@
     }
 
 #if SDL_USE_NIB_FILE
+    [SDLApplication poseAsClass:[NSApplication class]];
     NSApplicationMain (argc, argv);
 #else
     CustomApplicationMain (argc, argv);
--- a/hedgewars/tunsetborder.inc	Fri Dec 18 02:47:28 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-(*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006-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
- *)
-
-begin
-X:= X + dX;
-Y:= Y + dY;
-tx:= hwRound(X);
-ty:= hwRound(Y);
-if ((ty and LAND_HEIGHT_MASK) = 0) and
-    ((tx and LAND_WIDTH_MASK) = 0) and
-    ((Land[ty, tx] = COLOR_LAND) or (Land[ty, tx] = COLOR_OBJECT)) then LandPixels[ty, tx]:= cExplosionBorderColor
-end;
--- a/hedgewars/uLandGraphics.pas	Fri Dec 18 02:47:28 2009 +0000
+++ b/hedgewars/uLandGraphics.pas	Sat Dec 19 19:37:30 2009 +0000
@@ -355,7 +355,17 @@
     X:= nx - dX8;
     Y:= ny - dY8;
     for t:= -8 to ticks + 8 do
-        {$INCLUDE "tunsetborder.inc"}
+    begin
+	X:= X + dX;
+	Y:= Y + dY;
+	tx:= hwRound(X);
+	ty:= hwRound(Y);
+	if ((ty and LAND_HEIGHT_MASK) = 0) and
+	   ((tx and LAND_WIDTH_MASK) = 0) and
+	   ((Land[ty, tx] = COLOR_LAND) or 
+	   (Land[ty, tx] = COLOR_OBJECT)) then
+		LandPixels[ty, tx]:= cExplosionBorderColor
+    end;
     nx:= nx - dY;
     ny:= ny + dX;
     end;
@@ -365,7 +375,17 @@
     X:= nx - dX8;
     Y:= ny - dY8;
     for t:= 0 to 7 do
-        {$INCLUDE "tunsetborder.inc"}
+    begin
+	X:= X + dX;
+	Y:= Y + dY;
+	tx:= hwRound(X);
+	ty:= hwRound(Y);
+	if ((ty and LAND_HEIGHT_MASK) = 0) and
+	   ((tx and LAND_WIDTH_MASK) = 0) and
+	   ((Land[ty, tx] = COLOR_LAND) or 
+	   (Land[ty, tx] = COLOR_OBJECT)) then
+		LandPixels[ty, tx]:= cExplosionBorderColor
+    end;
     X:= nx;
     Y:= ny;
     for t:= 0 to ticks do
@@ -384,7 +404,17 @@
             end
         end;
     for t:= 0 to 7 do
-        {$INCLUDE "tunsetborder.inc"}
+    begin
+	X:= X + dX;
+	Y:= Y + dY;
+	tx:= hwRound(X);
+	ty:= hwRound(Y);
+	if ((ty and LAND_HEIGHT_MASK) = 0) and
+	   ((tx and LAND_WIDTH_MASK) = 0) and
+	   ((Land[ty, tx] = COLOR_LAND) or 
+	   (Land[ty, tx] = COLOR_OBJECT)) then
+		LandPixels[ty, tx]:= cExplosionBorderColor
+    end;
     nx:= nx - dY;
     ny:= ny + dX;
     end;
@@ -394,7 +424,17 @@
     X:= nx - dX8;
     Y:= ny - dY8;
     for t:= -8 to ticks + 8 do
-        {$INCLUDE "tunsetborder.inc"}
+    begin
+	X:= X + dX;
+	Y:= Y + dY;
+	tx:= hwRound(X);
+	ty:= hwRound(Y);
+	if ((ty and LAND_HEIGHT_MASK) = 0) and
+	   ((tx and LAND_WIDTH_MASK) = 0) and
+	   ((Land[ty, tx] = COLOR_LAND) or 
+	   (Land[ty, tx] = COLOR_OBJECT)) then
+		LandPixels[ty, tx]:= cExplosionBorderColor
+    end;
     nx:= nx - dY;
     ny:= ny + dX;
     end;
--- a/hedgewars/uMisc.pas	Fri Dec 18 02:47:28 2009 +0000
+++ b/hedgewars/uMisc.pas	Sat Dec 19 19:37:30 2009 +0000
@@ -83,7 +83,8 @@
 	TimeTrialStopTime : Longword = 0;
 	
 	cWhiteColorChannels	: TSDL_Color = (r:$FF; g:$FF; b:$FF; unused:$FF);
-	cNearBlackColor		: TSDL_Color = (r:$00; g:$00; b:$10; unused:$FF);
+	cNearBlackColorChannels	: TSDL_Color = (r:$00; g:$00; b:$10; unused:$FF);
+
 	cWhiteColor		: Longword = $FFFFFFFF;
 	cYellowColor		: Longword = $FFFFFF00;
 	cExplosionBorderColor	: LongWord = $FF808080;
--- a/hedgewars/uStore.pas	Fri Dec 18 02:47:28 2009 +0000
+++ b/hedgewars/uStore.pas	Sat Dec 19 19:37:30 2009 +0000
@@ -123,7 +123,7 @@
 Result.y:= Y;
 Result.w:= w + FontBorder * 2 + 4;
 Result.h:= h + FontBorder * 2;
-DrawRoundRect(@Result, cWhiteColor, cNearBlackColor.value, Surface, true);
+DrawRoundRect(@Result, cWhiteColor, cNearBlackColorChannels.value, Surface, true);
 clr.r:= Color shr 16;
 clr.g:= (Color shr 8) and $FF;
 clr.b:= Color and $FF;
@@ -166,7 +166,7 @@
 		TryDo(texsurf <> nil, errmsgCreateSurface, true);
 		TryDo(SDL_SetColorKey(texsurf, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true);
 
-		DrawRoundRect(@r, cWhiteColor, cNearBlackColor.value, texsurf, true);
+		DrawRoundRect(@r, cWhiteColor, cNearBlackColorChannels.value, texsurf, true);
 		rr:= r;
 		inc(rr.x, 2); dec(rr.w, 4); inc(rr.y, 2); dec(rr.h, 4);
 		DrawRoundRect(@rr, Clan^.Color, Clan^.Color, texsurf, false);
@@ -935,7 +935,7 @@
         substr:= copy(s, prevpos+1, pos-prevpos-1);
         if Length(substr) <> 0 then
            begin
-           tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(substr), cNearBlackColor);
+           tmpsurf:= TTF_RenderUTF8_Blended(Fontz[Font].Handle, Str2PChar(substr), cNearBlackColorChannels);
            rect.x:= edgeHeight + 1 + ((i - w) div 2);
            // trying to more evenly position the text, vertically
            rect.y:= edgeHeight + ((j-(numLines*h)) div 2) + line * h;