diff mm7_6.cpp @ 998:e4383e6dfbef

ProcessInput
author Ritor1
date Tue, 14 May 2013 17:37:24 +0600
parents 1c13fbaad0c5
children 9318dd3f3711
line wrap: on
line diff
--- a/mm7_6.cpp	Tue May 14 10:07:33 2013 +0600
+++ b/mm7_6.cpp	Tue May 14 17:37:24 2013 +0600
@@ -2275,10 +2275,10 @@
         if ( pGUIWindow_Settings )
           return;
         pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
-        pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 0, 49, "", 0);
-        pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 1, 50, "", 0);
-        pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 2, 51, "", 0);
-        pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 3, 52, "", 0);
+        pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 0, 49, "", 0);
+        pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 1, 50, "", 0);
+        pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 2, 51, "", 0);
+        pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 3, 52, "", 0);
         sub_421B2C_PlaceInInventory_or_DropPickedItem();
         return;
       }
@@ -2288,7 +2288,7 @@
           return;
 
         pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
-        pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_SmallShot, 0, 0, "", 0);
+        pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Shoot_Monster, 0, 0, "", 0);
         sub_421B2C_PlaceInInventory_or_DropPickedItem();
         return;
       }
@@ -2320,11 +2320,11 @@
         if ( pGUIWindow_Settings )
           return;
         pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0);
-        pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Fate, 0, 0x31u, "", 0);
-        pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Fate, 1, 0x32u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Fate, 2, 0x33u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Fate, 3, 0x34u, "", 0);
-        pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_GreatShot, 0, 0, "", NULL);
+        pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 0, 0x31u, "", 0);
+        pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 1, 0x32u, "", 0);
+        pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 2, 0x33u, "", 0);
+        pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 3, 0x34u, "", 0);
+        pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Monster_Improvement, 0, 0, "", NULL);
         sub_421B2C_PlaceInInventory_or_DropPickedItem();
       }
       if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings )
@@ -2340,8 +2340,8 @@
                        pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight,
                        1, 0, UIMSG_ScrollNPCPanel, 1, 0, "",
                        pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0);
-        pGUIWindow_Settings->CreateButton(0x1EBu, 149, 64, 74, 1, 0, UIMSG_CastSpell_8F, 4, 0x35u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x231u, 149, 64, 74, 1, 0, UIMSG_CastSpell_8F, 5, 0x36u, "", 0);
+        pGUIWindow_Settings->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 4, 0x35u, "", 0);
+        pGUIWindow_Settings->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 5, 0x36u, "", 0);
       }
     }
 }
@@ -2426,7 +2426,7 @@
   unsigned __int8 v14; // zf@53
   //unsigned int v15; // edx@53
   //signed int v16; // eax@53
-  Player *v17; // esi@70
+  //Player *v17; // esi@70
   //int v18; // eax@72
   //int v19; // eax@74
   Player *v20; // eax@74
@@ -3301,17 +3301,17 @@
         assert(false && "Unknown spell effect #101 (prolly flaming bow arrow");
       case SPELL_BOW_ARROW:
       {
-        v17 = pPlayer;
+        //v17 = pPlayer;
         _this = (ItemGen *)1;
         if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 )
           _this = (ItemGen *)2;
-        sRecoveryTime = v17->GetAttackRecoveryTime(true);
+        sRecoveryTime = pPlayer->GetAttackRecoveryTime(true);
         pSpellSprite.stru_24.Reset();
         pSpellSprite.spell_level = v2;
         pSpellSprite.spell_id = pCastSpell->spellnum;
         pSpellSprite.spell_skill = v731;
         pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType);
-        if ( v17->WearsItem(510, 2) )
+        if ( pPlayer->WearsItem(510, 2) )
           pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u);
         pSpellSprite.vPosition.x = pParty->vPosition.x;
         pSpellSprite.vPosition.y = pParty->vPosition.y;
@@ -8506,27 +8506,13 @@
 //----- (0042FC4E) --------------------------------------------------------
 void __cdecl ProcessInputActions()
 {
-  ActionQueue *pActionQueue; // esi@7
-  //Keyboard *v3; // ecx@8
   char v4; // al@9
-  ActionQueue *v5; // ecx@19
-  Player *v6; // ecx@86
-  Player *v7; // esi@100
   char v8; // bl@100
   unsigned __int16 v9; // ax@102
   int v10; // eax@103
-  unsigned int v11; // eax@127
-  signed int v12; // esi@157
-  Keyboard *v13; // ecx@158
   char v14; // al@159
   unsigned int v15; // eax@168
-  void *v16; // esi@177
-  int v17; // [sp-14h] [bp-1Ch]@8
   PartyAction partyAction; // [sp-14h] [bp-1Ch]@20
-  PartyAction partyAction_; // [sp-14h] [bp-1Ch]@54
-  //__int16 v20; // [sp-14h] [bp-1Ch]@60
-  int v21; // [sp-14h] [bp-1Ch]@68
-  int v22; // [sp-Ch] [bp-14h]@158
   InputAction inputAction; // [sp+0h] [bp-8h]@7
   int v24; // [sp+4h] [bp-4h]@87
 
@@ -8548,18 +8534,50 @@
   }
 
   //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
-//LABEL_6:
+  for ( uint i = 0; i < 30; ++i )
+  {
+    if ( pKeyActionMap->pToggleTypes[i] )
+      v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]);
+    else
+      v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]);
+    if ( v14 && i == 9 )
+    {
+      if ( !pCurrentScreen )
+      {
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
+        continue;
+      }
+      if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
+      {
+        v15 = pMessageQueue_50CBD0->uNumMessages;
+        if ( pMessageQueue_50CBD0->uNumMessages )
+        {
+          v15 = 0;
+          if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 )
+          {
+            v15 = 1;
+            pMessageQueue_50CBD0->uNumMessages = 0;
+            pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape;
+            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
+            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
+            ++pMessageQueue_50CBD0->uNumMessages;
+            continue;
+          }
+          pMessageQueue_50CBD0->uNumMessages = 0;
+        }
+        //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+      }
+    }
+  }
   if ( !pEventTimer->bPaused )
   {
-    inputAction = (InputAction)0;
-    pActionQueue = pPartyActionQueue;
-    while ( 1 )
+    for ( uint i = 0; i < 30; ++i )
     {
-      v17 = pKeyActionMap->pVirtualKeyCodesMapping[inputAction];
-      if ( pKeyActionMap->pToggleTypes[inputAction] )
-        v4 = pKeyboard->WasKeyPressed(v17);
+      inputAction = (InputAction)i;
+      if ( pKeyActionMap->pToggleTypes[(InputAction)i] )
+        v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
       else
-        v4 = pKeyboard->IsKeyBeingHeld(v17);
+        v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]);
       if ( v4 )
       {
         switch ( inputAction )
@@ -8568,104 +8586,77 @@
             if (pCurrentScreen  != SCREEN_GAME)
               break;
             if (!pParty->bTurnBasedModeOn)
-              //goto _do_move_forward;
             {
-              v5 = pActionQueue;
               if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
                 partyAction = PARTY_RunForward;
               else
                 partyAction = PARTY_WalkForward;
-              //goto _add_action_and_continue;
-              v5->Add(partyAction);
+              pPartyActionQueue->Add(partyAction);
               break;
             }
             if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 )
             {
               pTurnEngine->uActionPointsLeft -= 26;
-//_do_move_forward:
-              v5 = pActionQueue;
               if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
                 partyAction = PARTY_RunForward;
               else
                 partyAction = PARTY_WalkForward;
-              //goto _add_action_and_continue;
-              v5->Add(partyAction);
+              pPartyActionQueue->Add(partyAction);
               break;
             }
             break;
           case INPUT_MoveBackwards:
-            //__debugbreak();
             if (pCurrentScreen  != SCREEN_GAME)
               break;
             if (!pParty->bTurnBasedModeOn)
-              //goto _do_move_backwards;
             {
-              v5 = pActionQueue;
               if ( pParty->uFlags2 & 2 )
                 partyAction = PARTY_RunBackward;
               else
                 partyAction = PARTY_WalkBackward;
-              //goto _add_action_and_continue;
-              v5->Add(partyAction);
+              pPartyActionQueue->Add(partyAction);
               break;
             }
             if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 )
             {
               pTurnEngine->uActionPointsLeft -= 26;
-//_do_move_backwards:
-              v5 = pActionQueue;
               if ( pParty->uFlags2 & 2 )
                 partyAction = PARTY_RunBackward;
               else
                 partyAction = PARTY_WalkBackward;
-              //goto _add_action_and_continue;
-              v5->Add(partyAction);
+              pPartyActionQueue->Add(partyAction);
               break;
             }
             break;
           case INPUT_StrafeLeft:
-            //__debugbreak();
             if (pCurrentScreen  != SCREEN_GAME)
               break;
             if (!pParty->bTurnBasedModeOn)
-              //goto _do_strafe_left;
             {
               partyAction = PARTY_StrafeLeft;
-              //goto _add_action_and_continue_;
-              v5 = pActionQueue;
-              v5->Add(partyAction);
+              pPartyActionQueue->Add(partyAction);
               break;
             }
             if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 )
               break;
             pTurnEngine->uActionPointsLeft -= 26;
-//_do_strafe_left:
             partyAction = PARTY_StrafeLeft;
-            //goto _add_action_and_continue_;
-              v5 = pActionQueue;
-              v5->Add(partyAction);
-              break;
+            pPartyActionQueue->Add(partyAction);
+            break;
           case INPUT_StrafeRight:
-            //__debugbreak();
             if (pCurrentScreen != SCREEN_GAME)
               break;
             if (!pParty->bTurnBasedModeOn)
-              //goto _do_strafe_right;
             {
               partyAction = PARTY_StrafeRight;
-              //goto _add_action_and_continue_;
-              v5 = pActionQueue;
-              v5->Add(partyAction);
+              pPartyActionQueue->Add(partyAction);
               break;
             }
             if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 )
               break;
             pTurnEngine->uActionPointsLeft -= 26;
-//_do_strafe_right:
             partyAction = PARTY_StrafeRight;
-            //goto _add_action_and_continue_;
-            v5 = pActionQueue;
-            v5->Add(partyAction);
+            pPartyActionQueue->Add(partyAction);
             break;
           case INPUT_TurnLeft:
             if (pCurrentScreen != SCREEN_GAME)
@@ -8678,16 +8669,16 @@
                   break;
                 pTurnEngine->uActionPointsLeft -= 26;
               }
-              partyAction_ = PARTY_StrafeLeft;
+              partyAction = PARTY_StrafeLeft;
             }
             else
             {
               if ( pParty->uFlags2 & 2 )
-                partyAction_ = PARTY_FastTurnLeft;
+                partyAction = PARTY_FastTurnLeft;
               else
-                partyAction_ = PARTY_TurnLeft;
+                partyAction = PARTY_TurnLeft;
             }
-            pActionQueue->Add(partyAction_);
+            pPartyActionQueue->Add(partyAction);
             if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
             {
               pWeather->OnPlayerTurn(10);
@@ -8704,29 +8695,26 @@
                   break;
                 pTurnEngine->uActionPointsLeft -= 26;
               }
-              v21 = PARTY_StrafeRight;
+              partyAction = PARTY_StrafeRight;
             }
             else
             {
               if ( pParty->uFlags2 & 2 )
-                v21 = PARTY_FastTurnRight;
+                partyAction = PARTY_FastTurnRight;
               else
-                v21 = PARTY_TurnRight;
+                partyAction = PARTY_TurnRight;
             }
-            pActionQueue->Add((PartyAction)v21);
+            pPartyActionQueue->Add(partyAction);
             if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow)
             {
               pWeather->OnPlayerTurn(-10);
             }
             break;
           case INPUT_Jump:
-            //__debugbreak();
             if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn)
               break;
             partyAction = (PartyAction)12;
-            //goto _add_action_and_continue_;
-            v5 = pActionQueue;
-            v5->Add(partyAction);
+            pPartyActionQueue->Add(partyAction);
             break;
           case INPUT_Yell:
             if (!pCurrentScreen && uActiveCharacter)
@@ -8736,21 +8724,18 @@
             }
           break;
           case INPUT_Pass:
-            //__debugbreak();
             if ( pCurrentScreen )
               break;
             if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3)
-              //goto LABEL_118;
             {
               pTurnEngine->field_18 |= 8u;
               break;
             }
             if ( uActiveCharacter )
             {
-              v6 = pPlayers[uActiveCharacter];
-              if ( !v6->uTimeToRecovery )
+              if ( !pPlayers[uActiveCharacter]->uTimeToRecovery )
               {
-                v24 = v6->GetAttackRecoveryTime(false);
+                v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false);
                 if ( !pParty->bTurnBasedModeOn )
                   pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333));
                 pCastSpellInfo->_427D48(uActiveCharacter);
@@ -8758,8 +8743,7 @@
               }
             }
             break;
-          case INPUT_Combat:
-            //__debugbreak();
+          case INPUT_Combat://if press ENTER
             if (pCurrentScreen == SCREEN_GAME)
             {
               if (pParty->bTurnBasedModeOn)
@@ -8778,87 +8762,66 @@
             }
             break;
           case INPUT_CastReady:
-            //__debugbreak();
             if (pCurrentScreen != SCREEN_GAME)
               break;
             if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3)
-              //goto LABEL_118;
             {
               pTurnEngine->field_18 |= 8u;
               break;
             }
             if ( !uActiveCharacter )
               break;
-            v7 = pPlayers[uActiveCharacter];
-            v8 = v7->uQuickSpell;
+            v8 = pPlayers[uActiveCharacter]->uQuickSpell;
             if ( !v8
               || bUnderwater
-              || ((v9 = v7->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)),
-                  v10 > v7->sMana) )
+              || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? 
+                 ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : 
+                 (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : 
+                 (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : 
+                 (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)),
+                  v10 > pPlayers[uActiveCharacter]->sMana) )
             {
-              pActionQueue = pPartyActionQueue;
-LABEL_120:
+              pPartyActionQueue = pPartyActionQueue;
               pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
               break;
-              /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-              {
-                pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack;
-                //goto _send_message;
-                pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-                *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-                ++pMessageQueue_50CBD0->uNumMessages;
-                break;
-              }*/
             }
             else
             {
-              pActionQueue = pPartyActionQueue;
-              if ( dword_50C9E8 < 40 )
+              /*if ( dword_50C9E8 < 40 )
               {
                 dword_50C9EC[3 * dword_50C9E8] = 25;
                 dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
                 dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
                 ++dword_50C9E8;
-              }
+              }*/
+              pMessageQueue_50CBD0->AddMessage(UIMSG_CastQuickSpell, 0, 0);
             }
             break;
           case INPUT_Attack:
-            //__debugbreak();
             if (pCurrentScreen != SCREEN_GAME)
               break;
-            if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3)
-              goto LABEL_120;
-//LABEL_118:
-            pTurnEngine->field_18 |= 8u;
+            if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3)
+            {
+              pTurnEngine->field_18 |= 8u;
+              break;
+            }
+            pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0);
             break;
           case INPUT_EventTrigger:
             if (pCurrentScreen == SCREEN_GAME)
             {
-              /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
-                break;
-              pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Game_Action;
-              //goto _send_message;
-              pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-              *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-              ++pMessageQueue_50CBD0->uNumMessages;
-              break;*/
               pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
               break;
             }
             if ( pCurrentScreen == SCREEN_NPC_DIALOGUE )
             {
-              v11 = pMessageQueue_50CBD0->uNumMessages;
               if ( pMessageQueue_50CBD0->uNumMessages )
               {
-                v11 = 0;
                 pMessageQueue_50CBD0->uNumMessages = 0;
                 if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
                 {
-                  v11 = 1;
                   pMessageQueue_50CBD0->uNumMessages = 1;
-//LABEL_132:
-                  pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape;
-//_send_message:
+                  pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
                   pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
                   *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
                   ++pMessageQueue_50CBD0->uNumMessages;
@@ -8866,188 +8829,90 @@
                 }
                 break;
               }
-              /*if ( (signed int)v11 < 40 )
-                //goto LABEL_132;
-              {
-                pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape;
-                pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-                *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-                ++pMessageQueue_50CBD0->uNumMessages;
-                break;
-              }*/
               pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
             }
             break;
           case INPUT_CharCycle:
-            //__debugbreak();
-            if ( pCurrentScreen == SCREEN_SPELL_BOOK
-              || dword_50C9E8 >= 40 )
+            if ( pCurrentScreen == SCREEN_SPELL_BOOK )// || dword_50C9E8 >= 40 )
               break;
-            dword_50C9EC[3 * dword_50C9E8] = 176;
-            //goto LABEL_155;
+            /*dword_50C9EC[3 * dword_50C9E8] = 176;
             dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
             dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
-            ++dword_50C9E8;
+            ++dword_50C9E8;*/
+            pMessageQueue_50CBD0->AddMessage(UIMSG_CycleCharacters, 0, 0);
             break;
           case INPUT_LookUp:
-            //__debugbreak();
             if ( pEventTimer->bPaused )
               break;
             partyAction = (PartyAction)7;
-            //goto _add_action_and_continue_;
-            v5 = pActionQueue;
-            v5->Add(partyAction);
+            pPartyActionQueue->Add(partyAction);
             break;
           case INPUT_CenterView:
-            //__debugbreak();
             if ( pEventTimer->bPaused )
               break;
             partyAction = (PartyAction)9;
-            //goto _add_action_and_continue_;
-            v5 = pActionQueue;
-            v5->Add(partyAction);
+            pPartyActionQueue->Add(partyAction);
             break;
           case INPUT_LookDown:
-            //__debugbreak();
             if ( pEventTimer->bPaused )
               break;
             partyAction = (PartyAction)8;
-            //goto _add_action_and_continue_;
-            v5 = pActionQueue;
-            v5->Add(partyAction);
+            pPartyActionQueue->Add(partyAction);
             break;
           case INPUT_FlyUp:
-            //__debugbreak();
-            if ( pCurrentScreen
-              || pEventTimer->bPaused )
+            if ( pCurrentScreen || pEventTimer->bPaused )
               break;
             partyAction = (PartyAction)13;
-            //goto _add_action_and_continue_;
-            v5 = pActionQueue;
-            v5->Add(partyAction);
+            pPartyActionQueue->Add(partyAction);
             break;
           case INPUT_Land:
-            //__debugbreak();
-            if ( pCurrentScreen
-              || pEventTimer->bPaused )
+            if ( pCurrentScreen || pEventTimer->bPaused )
               break;
             partyAction = (PartyAction)15;
-            //goto _add_action_and_continue_;
-            v5 = pActionQueue;
-            v5->Add(partyAction);
+            pPartyActionQueue->Add(partyAction);
             break;
           case INPUT_FlyDown:
-            //__debugbreak();
             if ( !pCurrentScreen
               && !pEventTimer->bPaused )
             {
               partyAction = (PartyAction)14;
-//_add_action_and_continue_:
-              v5 = pActionQueue;
-//_add_action_and_continue:
-              v5->Add(partyAction);
+              pPartyActionQueue->Add(partyAction);
             }
             break;
           case INPUT_ZoomIn:
-            //__debugbreak();
-            if ( dword_50C9E8 >= 40 )
+            /*if ( dword_50C9E8 >= 40 )
               break;
             dword_50C9EC[3 * dword_50C9E8] = 367;
-            //goto LABEL_155;
             dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
             dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
-            ++dword_50C9E8;
+            ++dword_50C9E8;*/
+            pMessageQueue_50CBD0->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0);
             break;
           case INPUT_ZoomOut:
-            //__debugbreak();
-            if ( dword_50C9E8 < 40 )
+            /*if ( dword_50C9E8 < 40 )
             {
               dword_50C9EC[3 * dword_50C9E8] = 368;
-//LABEL_155:
               dword_50C9EC[3 * dword_50C9E8 + 1] = 0;
               dword_50C9EC[3 * dword_50C9E8 + 2] = 0;
               ++dword_50C9E8;
-            }
+            }*/
+            pMessageQueue_50CBD0->AddMessage(UIMSG_ClickZoomInBtn, 0, 0);
             break;
           case INPUT_AlwaysRun:
             bAlwaysRun = bAlwaysRun == 0;
             break;
           default:
-            //__debugbreak();
             break;
         }
       }
-      inputAction = (InputAction)((int)inputAction + 1);
-      if ( (signed int)inputAction >= 30 )
-        goto LABEL_176;
     }
   }
-  v12 = 0;
-  do
-  {
-    v22 = pKeyActionMap->pVirtualKeyCodesMapping[v12];
-    v13 = pGame->pKeyboardInstance;
-    if ( pKeyActionMap->pToggleTypes[v12] )
-      v14 = v13->WasKeyPressed(v22);
-    else
-      v14 = v13->IsKeyBeingHeld(v22);
-    if ( v14 && v12 == 9 )
-    {
-      if ( !pCurrentScreen )
-      {
-        /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
-          goto LABEL_175;
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Game_Action;
-        //goto LABEL_174;
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-        *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-        ++pMessageQueue_50CBD0->uNumMessages;*/
-        pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0);
-        goto LABEL_175;
-      }
-      if ( pCurrentScreen == SCREEN_NPC_DIALOGUE
-        || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
-      {
-        v15 = pMessageQueue_50CBD0->uNumMessages;
-        if ( pMessageQueue_50CBD0->uNumMessages )
-        {
-          v15 = 0;
-          if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
-          {
-            v15 = 1;
-            pMessageQueue_50CBD0->uNumMessages = 0;
-            //goto LABEL_173;
-            pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape;
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-            ++pMessageQueue_50CBD0->uNumMessages;
-            goto LABEL_175;
-          }
-          pMessageQueue_50CBD0->uNumMessages = 0;
-        }
-        /*if ( (signed int)v15 >= 40 )
-          goto LABEL_175;
-//LABEL_173:
-        pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape;
-//LABEL_174:
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
-        *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-        ++pMessageQueue_50CBD0->uNumMessages;*/
-        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-        goto LABEL_175;
-      }
-    }
-LABEL_175:
-    ++v12;
-  }
-  while ( v12 < 30 );
-LABEL_176:
   if (pGame->pKeyboardInstance->bUsingAsynKeyboard)
   {
     AsyncKeyboard::LeaveCriticalSection();
-    v16 = pAsyncKeyboard;
+    //v16 = pAsyncKeyboard;
     AsyncKeyboard::EnterCriticalSection();
-    memset((char *)v16 + 521, 0, 0x100u);
+    memset((char *)pAsyncKeyboard + 521, 0, 0x100u);
     AsyncKeyboard::LeaveCriticalSection();
   }
 }