hedgewars/hwengine.pas
branch0.9.19
changeset 9081 7f04ad2cda54
parent 9028 3a38c9453697
child 9080 9b42757d7e71
--- a/hedgewars/hwengine.pas	Sun Apr 21 01:36:08 2013 +0200
+++ b/hedgewars/hwengine.pas	Wed May 29 22:52:37 2013 +0400
@@ -93,13 +93,7 @@
             ScriptCall('onGameStart');
             GameState:= gsGame;
             end;
-        gsConfirm, gsGame:
-            begin
-            if not cOnlyStats then DrawWorld(Lag);
-            DoGameTick(Lag);
-            if not cOnlyStats then ProcessVisualGears(Lag);
-            end;
-        gsChat:
+        gsConfirm, gsGame, gsChat:
             begin
             if not cOnlyStats then DrawWorld(Lag);
             DoGameTick(Lag);
@@ -168,10 +162,10 @@
                     // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3
                         KeyPressChat(SDL_GetKeyFromScancode(event.key.keysym.sym), event.key.keysym.sym); //TODO correct for keymodifiers
                         end
-                    else
-                        ProcessKey(event.key);
+                    else 
+                        if GameState >= gsGame then ProcessKey(event.key);
                 SDL_KEYUP:
-                    if GameState <> gsChat then
+                    if (GameState <> gsChat) and (GameState >= gsGame) then
                         ProcessKey(event.key);
 
                 SDL_WINDOWEVENT:
@@ -213,22 +207,19 @@
                     if GameState = gsChat then
                         KeyPressChat(event.key.keysym.unicode, event.key.keysym.sym)
                     else
-                        ProcessKey(event.key);
+                        if GameState >= gsGame then ProcessKey(event.key);
                 SDL_KEYUP:
-                    if GameState <> gsChat then
+                    if (GameState <> gsChat) and (GameState >= gsGame) then
                         ProcessKey(event.key);
 
                 SDL_MOUSEBUTTONDOWN:
                     if GameState = gsConfirm then
-                    begin
-                        resetPosition();
-                        ParseCommand('quit', true);
-                    end
+                        ParseCommand('quit', true)
                     else
-                        ProcessMouse(event.button, true);
+                        if (GameState >= gsGame) then ProcessMouse(event.button, true);
 
                 SDL_MOUSEBUTTONUP:
-                    ProcessMouse(event.button, false);
+                    if (GameState >= gsGame) then ProcessMouse(event.button, false);
 
                 SDL_ACTIVEEVENT:
                     if (event.active.state and SDL_APPINPUTFOCUS) <> 0 then