changeset 998:e4383e6dfbef

ProcessInput
author Ritor1
date Tue, 14 May 2013 17:37:24 +0600
parents 1c13fbaad0c5
children dcdfbb6eede9
files GUIWindow.h Player.cpp Vis.cpp mm7_3.cpp mm7_5.cpp mm7_6.cpp
diffstat 6 files changed, 187 insertions(+), 329 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.h	Tue May 14 10:07:33 2013 +0600
+++ b/GUIWindow.h	Tue May 14 17:37:24 2013 +0600
@@ -49,8 +49,8 @@
   UIMSG_PlayerCreationClickOK = 66,
   UIMSG_PlayerCreationClickReset = 67,
   UIMSG_44 = 68,
-  UIMSG_CastSpell_SPIRIT_Preservation = 69,
-  UIMSG_CastSpell_SmallShot = 70,
+  UIMSG_CastSpell_Character_Big_Improvement = 69,
+  UIMSG_CastSpell_Shoot_Monster = 70,
   UIMSG_ClickBooksBtn = 71,
   UIMSG_48 = 72,
   UIMSG_49 = 73,
@@ -114,10 +114,10 @@
   UIMSG_StartHireling2Dialogue = 135,
   UIMSG_SelectNPCDialogueOption = 136,
 
-  UIMSG_CastSpell_GreatShot = 140,
-  UIMSG_CastSpell_SPIRIT_Fate = 141,
+  UIMSG_CastSpell_Monster_Improvement = 140,
+  UIMSG_CastSpell_Character_Small_Improvement = 141,
   UIMSG_CastSpellFromBook = 142,
-  UIMSG_CastSpell_8F = 143,
+  UIMSG_HiredNPC_CastSpell = 143,
   UIMSG_PlayerCreation_VoicePrev = 144,
   UIMSG_PlayerCreation_VoiceNext = 145,
   UIMSG_92 = 146,
--- a/Player.cpp	Tue May 14 10:07:33 2013 +0600
+++ b/Player.cpp	Tue May 14 17:37:24 2013 +0600
@@ -7785,13 +7785,14 @@
   {
     _720984_unused = pParty->pPickedItem.uItemID;
     pMouse->RemoveHoldingItem();
-    if ( dword_50C9E8 < 40 )
+    /*if ( dword_50C9E8 < 40 )
     {
       dword_50C9EC[3 * dword_50C9E8] = 146;
       dword_50C9EC[3 * dword_50C9E8 + 1] = v24;
       dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1;
       ++dword_50C9E8;
-    }
+    }*/
+    pMessageQueue_50CBD0->AddMessage(UIMSG_92, 0, 0);
     if ( pCurrentScreen
       && pGUIWindow_CurrentMenu
       && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null)
--- a/Vis.cpp	Tue May 14 10:07:33 2013 +0600
+++ b/Vis.cpp	Tue May 14 17:37:24 2013 +0600
@@ -537,7 +537,7 @@
   if (!default_list.uNumPointers)
     return -1;
 
-  return get_object_zbuf_val(default_list.object_pointers[0]);//Click to the Rat in dragon cave result crash. Maybe object_pointers incorrect
+  return get_object_zbuf_val(default_list.object_pointers[0]);
 }
 
 //----- (004C1C0C) --------------------------------------------------------
--- a/mm7_3.cpp	Tue May 14 10:07:33 2013 +0600
+++ b/mm7_3.cpp	Tue May 14 17:37:24 2013 +0600
@@ -4100,7 +4100,7 @@
 //----- (00477C61) --------------------------------------------------------
 int stru6_stru1_indoor_sw_billboard::sub_477C61()
 {
-  stru6_stru1_indoor_sw_billboard *v1; // ebx@1
+  //stru6_stru1_indoor_sw_billboard *v1; // ebx@1
   int v2; // ecx@2
   int v3; // eax@3
   double v4; // st7@4
@@ -4142,13 +4142,13 @@
   float v41; // [sp+2Ch] [bp-4h]@6
   float v42; // [sp+2Ch] [bp-4h]@9
 
-  v1 = this;
+  //v1 = this;
   if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
   {
     v2 = 0;
-    if ( v1->field_10 > 0 )
-    {
-      v3 = (int)&v1->field_14[1];
+    if ( this->field_10 > 0 )
+    {
+      v3 = (int)&this->field_14[1];
       do
       {
         v4 = *(float *)(v3 - 4);
@@ -4199,7 +4199,7 @@
         *(float *)(v3 + 80) = v11;
         v3 += 16;
       }
-      while ( v2 < v1->field_10 );
+      while ( v2 < this->field_10 );
     }
   }
   else
@@ -4244,7 +4244,7 @@
     }
     while ( v31 );
   }
-  v1->field_10 = 3;
+  this->field_10 = 3;
   return 1;
 }
 
--- a/mm7_5.cpp	Tue May 14 10:07:33 2013 +0600
+++ b/mm7_5.cpp	Tue May 14 17:37:24 2013 +0600
@@ -82,7 +82,7 @@
   unsigned int v33; // eax@277
   unsigned __int8 v34; // al@279
   unsigned __int8 v35; // al@280
-  GUIWindow *pWindow3; // ecx@332
+  //GUIWindow *pWindow3; // ecx@332
   int v37; // eax@341
   int v38; // eax@358
   SHORT v39; // ax@365
@@ -97,7 +97,7 @@
   char v48; // zf@405
   BLVFace *pBLVFace; // ecx@410
   ODMFace *pODMFace; // ecx@412
-  CastSpellInfo *v51; // ecx@415
+  CastSpellInfo *pSpellInfo; // ecx@415
   void *v52; // eax@424
   __int16 v53; // ax@431
   int v54; // eax@432
@@ -1486,7 +1486,6 @@
                   pIcons_LOD->_4355F7();
                   continue;
                 }
-LABEL_319:
                 CharacterUI_ReleaseButtons();
                 sub_419379();
                 pIcons_LOD->_4114F2();
@@ -1519,7 +1518,6 @@
               pIcons_LOD->_4355F7();
               continue;
             }
-            pWindow3 = pGUIWindow_Settings;
             if ( !pGUIWindow_Settings )//Draw Menu
             {
               dword_6BE138 = -1;
@@ -1565,7 +1563,7 @@
               stru_506E40._40E55E("gamma.pcx", 0);
               continue;
             }
-            pWindow3->Release();
+            pGUIWindow_Settings->Release();
             pGUIWindow_Settings = 0;
             pMouse->SetCursorBitmap("MICON1");
             GameUI_Footer_TimeLeft = 0;
@@ -1805,13 +1803,12 @@
             v47 = pActors[v46].uAIState == Dead;
             if ( !v47 )
               continue;
-            v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
-            LOBYTE(v51->field_8) &= 0xBFu;
-            v51->uPlayerID_2 = uMessageParam;
-            v51->spell_target_pid = v44;
-            pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300);
-            pWindow3 = pGUIWindow_Settings;
-            pWindow3->Release();
+            pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+            LOBYTE(pSpellInfo->field_8) &= 0xBFu;
+            pSpellInfo->uPlayerID_2 = uMessageParam;
+            pSpellInfo->spell_target_pid = v44;
+            pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
+            pGUIWindow_Settings->Release();
             pGUIWindow_Settings = 0;
             pMouse->SetCursorBitmap("MICON1");
             GameUI_Footer_TimeLeft = 0;
@@ -1824,13 +1821,12 @@
             v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0;
             if ( !v47 )
               continue;
-            v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
-            LOBYTE(v51->field_8) &= 0xBFu;
-            v51->uPlayerID_2 = uMessageParam;
-            v51->spell_target_pid = v44;
-            pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300);
-            pWindow3 = pGUIWindow_Settings;
-            pWindow3->Release();
+            pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+            LOBYTE(pSpellInfo->field_8) &= 0xBFu;
+            pSpellInfo->uPlayerID_2 = uMessageParam;
+            pSpellInfo->spell_target_pid = v44;
+            pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
+            pGUIWindow_Settings->Release();
             pGUIWindow_Settings = 0;
             pMouse->SetCursorBitmap("MICON1");
             GameUI_Footer_TimeLeft = 0;
@@ -1852,13 +1848,12 @@
               if ( !(pODMFace->uAttributes & 0x02000000) || !pODMFace->sCogTriggeredID )
                 continue;
               v44 = uNumSeconds;
-              v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
-              *((char *)v51 + 8) &= 0xBFu;
-              v51->uPlayerID_2 = uMessageParam;
-              v51->spell_target_pid = v44;
-              pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300);
-              pWindow3 = pGUIWindow_Settings;
-              pWindow3->Release();
+              pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+              LOBYTE(pSpellInfo->field_8) &= 0xBFu;
+              pSpellInfo->uPlayerID_2 = uMessageParam;
+              pSpellInfo->spell_target_pid = v44;
+              pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
+              pGUIWindow_Settings->Release();
               pGUIWindow_Settings = 0;
               pMouse->SetCursorBitmap("MICON1");
               GameUI_Footer_TimeLeft = 0;
@@ -1873,23 +1868,21 @@
           }
           if ( v48 )
             continue;
-          v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
-          LOBYTE(v51->field_8) &= 0xBFu;
-          v51->uPlayerID_2 = uMessageParam;
-          v51->spell_target_pid = v44;
-          pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300);
-          pWindow3 = pGUIWindow_Settings;
-          pWindow3->Release();
+          pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+          LOBYTE(pSpellInfo->field_8) &= 0xBFu;
+          pSpellInfo->uPlayerID_2 = uMessageParam;
+          pSpellInfo->spell_target_pid = v44;
+          pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
+          pGUIWindow_Settings->Release();
           pGUIWindow_Settings = 0;
           pMouse->SetCursorBitmap("MICON1");
           GameUI_Footer_TimeLeft = 0;
           unk_50C9A0 = 0;
           back_to_game();
           continue;
-        case UIMSG_CastSpell_8F:
-			__debugbreak();
-        case UIMSG_CastSpell_SPIRIT_Preservation://and blessing, treatment paralysis, hand hammers(individual upgrade)
-        case UIMSG_CastSpell_SPIRIT_Fate:
+        case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade),regeneration
+        case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure
+        case UIMSG_HiredNPC_CastSpell:
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
           if ( unk_50C9A0 )
@@ -1901,21 +1894,21 @@
           {
             if ( pGUIWindow_Settings )
             {
-              v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+              pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
               switch ( uMessage )
               {
-                case UIMSG_CastSpell_SPIRIT_Preservation:
-                  LOBYTE(v51->field_8) &= 0xFDu;
+                case UIMSG_CastSpell_Character_Big_Improvement:
+                  LOBYTE(pSpellInfo->field_8) &= 0xFDu;
                   break;
-                case UIMSG_CastSpell_SPIRIT_Fate:
-                  HIBYTE(v51->field_8) &= 0xFEu;
+                case UIMSG_CastSpell_Character_Small_Improvement:
+                  HIBYTE(pSpellInfo->field_8) &= 0xFEu;
                   break;
-                case UIMSG_CastSpell_8F:
-                  HIBYTE(v51->field_8) &= 0xFDu;
+                case UIMSG_HiredNPC_CastSpell:
+                  HIBYTE(pSpellInfo->field_8) &= 0xFDu;
                   break;
               }
-              v51->uPlayerID_2 = uMessageParam;
-              pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300);
+              pSpellInfo->uPlayerID_2 = uMessageParam;
+              pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
               pGUIWindow_Settings->Release();
               pGUIWindow_Settings = 0;
               pEventTimer->Resume();
@@ -2399,9 +2392,8 @@
           }
           _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter);
           continue;
-        case UIMSG_CastSpell_GreatShot://???
-			__debugbreak();
-        case UIMSG_CastSpell_SmallShot://FireBlow, Lightning, Ice Lightning, Swarm, 
+        case UIMSG_CastSpell_Monster_Improvement://Fate, cure
+        case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, 
           if ( pRenderer->pRenderD3D )
           {
             v81 = pGame->pVisInstance->get_picked_object_zbuf_val();
@@ -2420,23 +2412,22 @@
             v1 = "";
             continue;
           }
-          v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
-          if ( uMessage == UIMSG_CastSpell_SmallShot )
-          {
-            LOBYTE(v51->field_8) &= 0xF7;
+          pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
+          if ( uMessage == UIMSG_CastSpell_Shoot_Monster )
+          {
+            LOBYTE(pSpellInfo->field_8) &= 0xF7;
           }
           else
           {
-            if ( uMessage == UIMSG_CastSpell_GreatShot )
-              HIBYTE(v51->field_8) &= 0xFEu;
+            if ( uMessage == UIMSG_CastSpell_Monster_Improvement )
+              HIBYTE(pSpellInfo->field_8) &= 0xFEu;
             else
-              HIBYTE(v51->field_8) &= 0xFDu;
-          }
-          v51->uPlayerID_2 = uMessageParam;
-          v51->spell_target_pid = v44;
-          pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300);
-          pWindow3 = pGUIWindow_Settings;
-          pWindow3->Release();
+              HIBYTE(pSpellInfo->field_8) &= 0xFDu;
+          }
+          pSpellInfo->uPlayerID_2 = uMessageParam;
+          pSpellInfo->spell_target_pid = v44;
+          pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300);
+          pGUIWindow_Settings->Release();
           pGUIWindow_Settings = 0;
           pMouse->SetCursorBitmap("MICON1");
           GameUI_Footer_TimeLeft = 0;
@@ -2805,13 +2796,14 @@
                   pCurrentScreen = SCREEN_GAME;
                   pIcons_LOD->_4114F2();
                   v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage;
-                  if ( dword_50C9E8 < 40 )
+                  /*if ( dword_50C9E8 < 40 )
                   {
                     dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook;
                     dword_50C9EC[3 * dword_50C9E8 + 1] = v103;
                     dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1;
                     ++dword_50C9E8;
-                  }
+                  }*/
+                  pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1);
                 }
                 else
                 {
--- 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();
   }
 }