# HG changeset patch # User unc0rr # Date 1520118818 -3600 # Node ID c213645ff8481572b47f29adf9e35971253fffee # Parent 65a3b4bea4593e0d7410268e7338cb3705bac2d5 Having chat mode as game state was a mistake diff -r 65a3b4bea459 -r c213645ff848 hedgewars/hwengine.pas --- a/hedgewars/hwengine.pas Fri Mar 02 19:44:09 2018 +0100 +++ b/hedgewars/hwengine.pas Sun Mar 04 00:13:38 2018 +0100 @@ -105,7 +105,7 @@ RecountAllTeamsHealth; GameState:= gsGame; end; - gsConfirm, gsGame, gsChat: + gsConfirm, gsGame: begin // disable screenshot flash effect when about to make another screenshot if flagMakeCapture and (ScreenFade = sfFromWhite) then @@ -180,7 +180,7 @@ begin case event.type_ of SDL_KEYDOWN: - if GameState = gsChat then + if isInChatMode then begin // sdl on iphone supports only ashii keyboards and the unicode field is deprecated in sdl 1.3 KeyPressChat(event.key.keysym); @@ -188,10 +188,10 @@ else if GameState >= gsGame then ProcessKey(event.key); SDL_KEYUP: - if (GameState <> gsChat) and (GameState >= gsGame) then + if (not isInChatMode) and (GameState >= gsGame) then ProcessKey(event.key); - SDL_TEXTINPUT: if GameState = gsChat then uChat.TextInput(event.text); + SDL_TEXTINPUT: if isInChatMode then uChat.TextInput(event.text); SDL_WINDOWEVENT: begin diff -r 65a3b4bea459 -r c213645ff848 hedgewars/uChat.pas --- a/hedgewars/uChat.pas Fri Mar 02 19:44:09 2018 +0100 +++ b/hedgewars/uChat.pas Sun Mar 04 00:13:38 2018 +0100 @@ -303,7 +303,7 @@ top := 10 + visibleCount * ClHeight; // we start with input line (if any) // draw chat input line first and under all other lines -if (GameState = gsChat) and (InputStr.Tex <> nil) then +if isInChatMode and (InputStr.Tex <> nil) then begin if InputLinePrefix.Tex = nil then @@ -575,7 +575,7 @@ history:= 0; SDL_StopTextInput(); //SDL_EnableKeyRepeat(0,0); - GameState:= gsGame; + isInChatMode:= false; ResetKbd; end; @@ -1101,7 +1101,7 @@ var i: Integer; begin s:= s; // avoid compiler hint - GameState:= gsChat; + isInChatMode:= true; SDL_StopTextInput(); SDL_StartTextInput(); //Make REALLY sure unexpected events are flushed (1 time is insufficient as of SDL 2.0.7) diff -r 65a3b4bea459 -r c213645ff848 hedgewars/uCommandHandlers.pas --- a/hedgewars/uCommandHandlers.pas Fri Mar 02 19:44:09 2018 +0100 +++ b/hedgewars/uCommandHandlers.pas Sun Mar 04 00:13:38 2018 +0100 @@ -49,14 +49,15 @@ procedure chQuit(var s: shortstring); begin s:= s; // avoid compiler hint - if (GameState = gsGame) or (GameState = gsChat) then - begin - prevGState:= GameState; + if (GameState = gsGame) then + begin + isInChatMode:= false; GameState:= gsConfirm; - end - else + end + else begin if GameState = gsConfirm then - GameState:= prevGState; + GameState:= gsGame; + end; updateCursorVisibility; end; diff -r 65a3b4bea459 -r c213645ff848 hedgewars/uGearsHandlersRope.pas --- a/hedgewars/uGearsHandlersRope.pas Fri Mar 02 19:44:09 2018 +0100 +++ b/hedgewars/uGearsHandlersRope.pas Sun Mar 04 00:13:38 2018 +0100 @@ -26,7 +26,7 @@ implementation uses uConsts, uFloat, uCollisions, uVariables, uGearsList, uSound, uGearsUtils, - uAmmos, uDebug, uUtils, uGearsHedgehog, uGearsRender, uGearsHandlersMess; + uAmmos, uDebug, uUtils, uGearsHedgehog, uGearsRender; const IsNilHHFatal = false; diff -r 65a3b4bea459 -r c213645ff848 hedgewars/uTypes.pas --- a/hedgewars/uTypes.pas Fri Mar 02 19:44:09 2018 +0100 +++ b/hedgewars/uTypes.pas Sun Mar 04 00:13:38 2018 +0100 @@ -36,7 +36,7 @@ end; // Possible states of the game - TGameState = (gsLandGen, gsStart, gsGame, gsChat, gsConfirm, gsExit, gsSuspend); + TGameState = (gsLandGen, gsStart, gsGame, gsConfirm, gsExit, gsSuspend); // Game types that help determining what the engine is actually supposed to do TGameType = (gmtLocal, gmtDemo, gmtNet, gmtSave, gmtLandPreview, gmtSyntax, gmtRecord); diff -r 65a3b4bea459 -r c213645ff848 hedgewars/uVariables.pas --- a/hedgewars/uVariables.pas Fri Mar 02 19:44:09 2018 +0100 +++ b/hedgewars/uVariables.pas Sun Mar 04 00:13:38 2018 +0100 @@ -51,6 +51,7 @@ cFlattenClouds : boolean; cIce : boolean; cSnow : boolean; + isInChatMode : boolean; cAltDamage : boolean; cReducedQuality : LongWord; @@ -2662,6 +2663,7 @@ lastVisualGearByUID := nil; lastGearByUID := nil; cReadyDelay := 5000; + isInChatMode := false; {* REFERENCE 4096 -> $FFFFF000