merge latest 0.9.15 changes into head
authorkoda
Mon, 17 Jan 2011 23:22:52 +0100
changeset 4845 9a0f5377c529
parent 4843 673f74c89687 (current diff)
parent 4756 9f20a38a385a (diff)
child 4847 7f21c08fd7d2
merge latest 0.9.15 changes into head
.hgtags
CMakeLists.txt
QTfrontend/hwform.cpp
hedgewars/hwengine.pas
hedgewars/uCommandHandlers.pas
hedgewars/uKeys.pas
hedgewars/uVariables.pas
--- a/.hgtags	Sun Jan 16 13:53:32 2011 -0500
+++ b/.hgtags	Mon Jan 17 23:22:52 2011 +0100
@@ -24,4 +24,12 @@
 adffb668f06e265b45d1e4aedc283e6f4e5ba7e8 Hedgewars-iOS-1.1
 ede569bb76f389bd5dfbb7ebf68af3087e3e881c Hedgewars-iOS-1.2
 a5735e877aae61cd705265e2f8c0c7ad08d45f0e Hedgewars-iOS-1.2.1
+bd74fd83929a09251d1ede09e6c03a641a0ee35f 0.9.15
+bd74fd83929a09251d1ede09e6c03a641a0ee35f 0.9.15
+0000000000000000000000000000000000000000 0.9.15
+0000000000000000000000000000000000000000 0.9.15
+29ab0d49c3e6e72a7633d0bd316ae533db15c65d 0.9.15
+29ab0d49c3e6e72a7633d0bd316ae533db15c65d 0.9.15
+0000000000000000000000000000000000000000 0.9.15
+29ab0d49c3e6e72a7633d0bd316ae533db15c65d 0.9.15-release
 5ea3d182415e4327e7584b1aa68197931d232ac3 Hedgewars-iOS-1.2.2
--- a/CMakeLists.txt	Sun Jan 16 13:53:32 2011 -0500
+++ b/CMakeLists.txt	Mon Jan 17 23:22:52 2011 +0100
@@ -77,7 +77,6 @@
 
 	set(CMAKE_OSX_ARCHITECTURES "i386;ppc7400")
 
-
 	#create universal binaries only when it's time to bundle the application, also build server
 	IF(BUNDLE)
 		set(WITH_SERVER true)
@@ -86,7 +85,11 @@
 			set(CMAKE_CXX_COMPILER "g++-4.0")
 		else()
 			if(current_macosx_version MATCHES "10.6")
-				set(CMAKE_OSX_ARCHITECTURES "x86_64")
+				if(MACAPPSTORE)
+					set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
+				else()
+					set(CMAKE_OSX_ARCHITECTURES "x86_64")
+				endif()
 			endif()
 		endif()
 	ELSE()
--- a/QTfrontend/game.cpp	Sun Jan 16 13:53:32 2011 -0500
+++ b/QTfrontend/game.cpp	Mon Jan 17 23:22:52 2011 +0100
@@ -56,7 +56,7 @@
             emit HaveRecord(true, demo);
             break;
         default:
-            if (gameState == gsInterrupted) emit HaveRecord(false, demo);
+            if (gameState == gsInterrupted || gameState == gsHalted) emit HaveRecord(false, demo);
             else if (gameState == gsFinished) emit HaveRecord(true, demo);
     }
     SetGameState(gsStopped);
@@ -229,6 +229,10 @@
             SetGameState(gsFinished);
             break;
         }
+        case 'H': {
+            SetGameState(gsHalted);
+            break;
+        }
         case 's': {
             int size = msg.size();
             QString msgbody = QString::fromUtf8(msg.mid(2).left(size - 4));
@@ -250,8 +254,8 @@
             {
                 emit SendNet(msg);
             }
-        if (msg.at(1) != 's')
-            demo.append(msg);
+            if (msg.at(1) != 's')
+                demo.append(msg);
         }
     }
 }
--- a/QTfrontend/game.h	Sun Jan 16 13:53:32 2011 -0500
+++ b/QTfrontend/game.h	Mon Jan 17 23:22:52 2011 +0100
@@ -35,7 +35,8 @@
     gsInterrupted = 2,
     gsFinished = 3,
     gsStopped = 4,
-    gsDestroyed = 5
+    gsDestroyed = 5,
+    gsHalted = 6
 };
 
 bool checkForDir(const QString & dir);
--- a/QTfrontend/hwform.cpp	Sun Jan 16 13:53:32 2011 -0500
+++ b/QTfrontend/hwform.cpp	Mon Jan 17 23:22:52 2011 +0100
@@ -974,12 +974,13 @@
             if (id == ID_PAGE_INGAME ||
 // was room chief and the game was aborted
                 (hwnet && hwnet->isRoomChief() && hwnet->isInRoom() && 
-                    (gameState == gsInterrupted || gameState == gsStopped || gameState == gsDestroyed))) {
+                    (gameState == gsInterrupted || gameState == gsStopped || gameState == gsDestroyed || gameState == gsHalted))) {
                 if (id == ID_PAGE_INGAME) GoBack();
                 Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
                 if (wBackground) wBackground->startAnimation();
                 if (hwnet) hwnet->gameFinished();
             }
+            if (gameState == gsHalted) close();
         };
     }
 }
--- a/hedgewars/hwengine.pas	Sun Jan 16 13:53:32 2011 -0500
+++ b/hedgewars/hwengine.pas	Mon Jan 17 23:22:52 2011 +0100
@@ -157,8 +157,8 @@
                         cHasFocus:= true;
 {$ELSE}
                     KeyPressChat(event.key.keysym.unicode);
-                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_MOUSEBUTTONDOWN: if event.button.button = SDL_BUTTON_WHEELDOWN then wheelDown:= true;
+                SDL_MOUSEBUTTONUP: if event.button.button = SDL_BUTTON_WHEELUP then wheelUp:= true;
                 SDL_ACTIVEEVENT:
                     if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then
                         cHasFocus:= event.active.gain = 1;
--- a/hedgewars/uCommandHandlers.pas	Sun Jan 16 13:53:32 2011 -0500
+++ b/hedgewars/uCommandHandlers.pas	Mon Jan 17 23:22:52 2011 +0100
@@ -23,27 +23,41 @@
 procedure chQuit(var s: shortstring);
 const prevGState: TGameState = gsConfirm;
 begin
-s:= s; // avoid compiler hint
-if GameState <> gsConfirm then
-        begin
+    s:= s; // avoid compiler hint
+    if GameState <> gsConfirm then
+    begin
         prevGState:= GameState;
         GameState:= gsConfirm
-        end else
-        GameState:= prevGState
+    end else
+    GameState:= prevGState
+end;
+
+procedure chForceQuit(var s: shortstring);
+begin
+    s:= s; // avoid compiler hint
+    GameState:= gsConfirm;
+    ParseCommand('confirm', true);
 end;
 
 procedure chConfirm(var s: shortstring);
 begin
-s:= s; // avoid compiler hint
-if GameState = gsConfirm then
+    s:= s; // avoid compiler hint
+    if GameState = gsConfirm then
     begin
-    SendIPC('Q');
-    GameState:= gsExit
+        SendIPC('Q');
+        GameState:= gsExit
     end
 else
     ParseCommand('chat team', true);
 end;
 
+procedure chHalt (var s: shortstring);
+begin
+    s:= s; // avoid compiler hint
+    SendIPC('H');
+    GameState:= gsExit
+end;
+
 procedure chCheckProto(var s: shortstring);
 var i, c: LongInt;
 begin
@@ -581,7 +595,9 @@
     RegisterVariable('grave'   , vtCommand, @chGrave        , false);
     RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
     RegisterVariable('quit'    , vtCommand, @chQuit         , true );
+    RegisterVariable('forcequit', vtCommand, @chForceQuit   , true );
     RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
+    RegisterVariable('halt',     vtCommand, @chHalt         , true );
     RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
     RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
     RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );
--- a/hedgewars/uKeys.pas	Sun Jan 16 13:53:32 2011 -0500
+++ b/hedgewars/uKeys.pas	Mon Jan 17 23:22:52 2011 +0100
@@ -40,47 +40,10 @@
 procedure ControllerHatEvent(joy, hat, value: Byte);
 procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean);
 
-var hideAmmoMenu: boolean;
-    wheelUp: boolean;
-    wheelDown: boolean;
-
-    ControllerNumControllers: Integer;
-    ControllerEnabled: Integer;
-    ControllerNumAxes: array[0..5] of Integer;
-    //ControllerNumBalls: array[0..5] of Integer;
-    ControllerNumHats: array[0..5] of Integer;
-    ControllerNumButtons: array[0..5] of Integer;
-    ControllerAxes: array[0..5] of array[0..19] of Integer;
-    //ControllerBalls: array[0..5] of array[0..19] of array[0..1] of Integer;
-    ControllerHats: array[0..5] of array[0..19] of Byte;
-    ControllerButtons: array[0..5] of array[0..19] of Byte;
-
-    DefaultBinds, CurrentBinds: TBinds;
-
-    coeff: LongInt;
-{$IFDEF HWLIBRARY}
-    leftClick: boolean;
-    middleClick: boolean;
-    rightClick: boolean;
-
-    upKey: boolean;
-    downKey: boolean;
-    rightKey: boolean;
-    leftKey: boolean;
-    preciseKey: boolean;
-
-    backspaceKey: boolean;
-    spaceKey: boolean;
-    enterKey: boolean;
-    tabKey: boolean;
-
-    chatAction: boolean;
-    pauseAction: boolean;
-
 {$IFDEF IPHONEOS}
 procedure setiPhoneBinds;
 {$ENDIF}
-{$ENDIF}
+
 implementation
 uses uConsole, uCommands, uMisc, uVariables, uConsts, uUtils, uDebug;
 
@@ -109,7 +72,7 @@
 
 // move cursor/camera
 // TODO: Scale on screen dimensions and/or axis value (game controller)?
-movecursor(coeff * CursorMovementX, coeff * CursorMovementY);
+movecursor(5 * CursorMovementX, 5 * CursorMovementY);
 
 k:= SDL_GetMouseState(nil, nil);
 
@@ -139,8 +102,7 @@
 
 {$IFDEF IPHONEOS}
 setiPhoneBinds();
-{$ENDIF}
-
+{$ELSE}
 // Controller(s)
 k:= j; // should we test k for hitting the limit? sounds rather unlikely to ever reach it
 for j:= 0 to Pred(ControllerNumControllers) do
@@ -165,6 +127,18 @@
         inc(k, 1);
         end;
     end;
+{$ENDIF}
+
+// ctrl/cmd + w/q to close engine and/or frontend
+{$IFDEF DARWIN}
+    if ((tkbdn[KeyNameToCode('left_meta')] = 1) or (tkbdn[KeyNameToCode('right_meta')] = 1)) then
+{$ELSE}
+    if ((tkbdn[KeyNameToCode('left_ctrl')] = 1) or (tkbdn[KeyNameToCode('right_ctrl')] = 1)) then
+{$ENDIF}
+    begin
+        if tkbdn[KeyNameToCode('q')] = 1 then ParseCommand ('halt', true)
+        else if tkbdn[KeyNameToCode('w')] = 1 then ParseCommand ('forcequit', true);
+    end;
 
 // now process strokes
 for i:= 0 to cKeyMaxIndex do
@@ -222,8 +196,7 @@
 
 {$IFDEF IPHONEOS}
 setiPhoneBinds();
-{$ENDIF}
-
+{$ELSE}
 // Controller(s)
 k:= j; // should we test k for hitting the limit? sounds rather unlikely to ever reach it
 for j:= 0 to Pred(ControllerNumControllers) do
@@ -248,6 +221,7 @@
         inc(k, 1);
         end;
     end;
+{$ENDIF}
 
 for t:= 0 to cKeyMaxIndex do
     tkbd[i]:= tkbdn[i]
@@ -502,7 +476,6 @@
 begin
     wheelUp:= false;
     wheelDown:= false;
-    coeff:= 5;
 {$IFDEF HWLIBRARY}
     // this function is called by HW_allKeysUp so be careful