diff mm7_5.cpp @ 992:3a3ab572eff5

Merge
author Nomad
date Mon, 13 May 2013 17:07:52 +0200
parents c5d8ea1e6ccb 087a9af8e0ec
children 3431f6abc786 1c13fbaad0c5
line wrap: on
line diff
--- a/mm7_5.cpp	Mon May 13 17:01:20 2013 +0200
+++ b/mm7_5.cpp	Mon May 13 17:07:52 2013 +0200
@@ -438,6 +438,7 @@
           stru_506E40.Release();
           continue;
         case UIMSG_80:
+			__debugbreak();
           pIcons_LOD->_40F9C5();
           pIcons_LOD->_4114F2();
           pGUIWindow_CurrentMenu->Release();
@@ -731,6 +732,7 @@
           }
           continue;
         case UIMSG_1A9:
+			__debugbreak();
           if ( uMessageParam == 4 )
           {
             //--uGammaPos;
@@ -973,35 +975,31 @@
           back_to_game();
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-          if ( pCurrentScreen > SCREEN_F )
-          {
-            if ( pCurrentScreen >= SCREEN_CHANGE_LOCATION && (pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_QUICK_REFERENCE) )
-            {
+          switch ( pCurrentScreen )
+          {
+            case SCREEN_E:
+				__debugbreak();
+            case SCREEN_NPC_DIALOGUE:
+            case SCREEN_CHEST:
+            case SCREEN_CHEST_INVENTORY:
+            case SCREEN_CHANGE_LOCATION:
+            case SCREEN_INPUT_BLV:
+            case SCREEN_QUICK_REFERENCE:
               if ( dword_50CDC8 )
-                goto LABEL_232;
+                break;
               CloseWindowBackground();
               uMessageParam = 1;
-              goto LABEL_232;
-            }
-          }
-          else
-          {
-            if ( pCurrentScreen >= SCREEN_E || pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHEST )
-            {
-              if ( dword_50CDC8 )
-                goto LABEL_232;
-              CloseWindowBackground();
-              uMessageParam = 1;
-              goto LABEL_232;
-            }
-            if ( pCurrentScreen == SCREEN_HOUSE && !dword_50CDC8 && !dword_5C35C8 )
-            {
-              CloseWindowBackground();
-              dword_5C35C8 = 0;
-              uMessageParam = 1;
-            }
-          }
-LABEL_232:
+              break;
+            case SCREEN_HOUSE:
+              if ( !dword_50CDC8 && !dword_5C35C8 )
+              {
+                CloseWindowBackground();
+                dword_5C35C8 = 0;
+                uMessageParam = 1;
+                break;
+              }
+              break;
+          }
           if ( !ptr_507BDC )
           {
             pRenderer->ClearZBuffer(0, 479);
@@ -1012,7 +1010,36 @@
               if ( pCurrentScreen > SCREEN_67 )
               {
                 if ( pCurrentScreen == SCREEN_QUICK_REFERENCE )
-                  goto LABEL_321;
+                {
+                  pIcons_LOD->_4114F2();
+                  if ( pGUIWindow_Settings )
+                  {
+                    if ( pCurrentScreen == SCREEN_CHARACTERS )
+                    {
+                      pMouse->SetCursorBitmap("MICON2");
+                    }
+                    else
+                    {
+                      pGUIWindow_Settings->Release();
+                      pGUIWindow_Settings = 0;
+                      pMouse->SetCursorBitmap("MICON1");
+                      GameUI_Footer_TimeLeft = 0;
+                      unk_50C9A0 = 0;
+                      back_to_game();
+                    }
+                  }
+                  if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
+                    uActiveCharacter = pParty->GetNextActiveCharacter();
+                  pGUIWindow_CurrentMenu->Release();
+                  if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
+                    window_SpeakInHouse = 0;
+                  pGUIWindow_CurrentMenu = 0;
+                  pEventTimer->Resume();
+                  pCurrentScreen = SCREEN_GAME;
+                  viewparams->bRedrawGameUI = 1;
+                  pIcons_LOD->_4355F7();
+                  continue;
+                }
               }
               else
               {
@@ -1104,7 +1131,7 @@
                       //crt_deconstruct_ptr_6A0118();
                       stru_506E40.Release();
                       break;
-                    case SCREEN_F:
+                    case SCREEN_CHEST_INVENTORY:
                       pCurrentScreen = SCREEN_CHEST;
                       continue;
                     case SCREEN_CHEST:
@@ -1116,6 +1143,7 @@
                       pEventTimer->Resume();
                       continue;
                     case SCREEN_19:
+						__debugbreak();
                       pWindow2 = ptr_507BC8;
                       pWindow2->Release();
                       pIcons_LOD->_4114F2();
@@ -1125,7 +1153,6 @@
                       continue;
                     case SCREEN_OPTIONS://Close
                       options_menu_skin.Relaease();
-
                       pIcons_LOD->_40F9C5();
                       WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
                       WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
@@ -1137,18 +1164,12 @@
                       WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit);
                       if ( !uTurnSpeed )
                       {
-                        //v171 = 3;
-                        //v30 = v171;
-                        //v31 = "TurnDelta";
                         WriteWindowsRegistryInt("TurnDelta", 3);
                         stru_506E40.Release();
                         break;
                       }
                       if ( uTurnSpeed == 64 )
                       {
-                        //v171 = 2;
-                        //v30 = v171;
-                        //v31 = "TurnDelta";
                         WriteWindowsRegistryInt("TurnDelta", 2);
                         stru_506E40.Release();
                         break;
@@ -1158,8 +1179,6 @@
                           stru_506E40.Release();
                           break;
                         }
-                      //v30 = v0;
-                      //v31 = "TurnDelta";
                       WriteWindowsRegistryInt("TurnDelta", 1);
                       stru_506E40.Release();
                       break;
@@ -1283,6 +1302,7 @@
                        pIcons_LOD->_4355F7();
                        continue;
                     case SCREEN_E:
+						__debugbreak();
                       pGUIWindow_CurrentMenu->Release();
                       pCurrentScreen = SCREEN_HOUSE;
                       pIcons_LOD->_4114F2();
@@ -1331,7 +1351,7 @@
                       viewparams->bRedrawGameUI = 1;
                       pIcons_LOD->_4355F7();
                       continue;
-                    case SCREEN_INPUT_BLV:
+                    case SCREEN_INPUT_BLV://click escape
                       if ( uCurrentHouse_Animation == 153 )
                         PlayHouseSound(0x99u, HouseSound_Greeting_2);
                       pVideoPlayer->Unload();
@@ -1343,8 +1363,11 @@
                         viewparams->bRedrawGameUI = 1;
                         dword_5B65CC = 0;
                       }
-                      goto LABEL_317;
-                    case SCREEN_NPC_DIALOGUE:
+                      DialogueEnding();
+                      pCurrentScreen = SCREEN_GAME;
+                      viewparams->bRedrawGameUI = 1;
+                      continue;
+                    case SCREEN_NPC_DIALOGUE://click escape
                       if ( dword_5B65CC )
                       {
                         pParty->field_709 = 0;
@@ -1353,12 +1376,19 @@
                         viewparams->bRedrawGameUI = 1;
                         dword_5B65CC = 0;
                       }
-                      goto LABEL_317;
-                    case SCREEN_BRANCHLESS_NPC_DIALOG:
+                      //goto LABEL_317;
+                      DialogueEnding();
+                      pCurrentScreen = SCREEN_GAME;
+                      viewparams->bRedrawGameUI = 1;
+                      continue;
+                    case SCREEN_BRANCHLESS_NPC_DIALOG://click escape
                       memset(GameUI_Footer_TimedString, 0, 0xC8u);
                       sub_4452BB();
-                      goto LABEL_317;
-                    case SCREEN_CHANGE_LOCATION:
+                      DialogueEnding();
+                      pCurrentScreen = SCREEN_GAME;
+                      viewparams->bRedrawGameUI = 1;
+                      continue;
+                    case SCREEN_CHANGE_LOCATION://click escape
                       if ( pParty->vPosition.x < -22528 )
                         pParty->vPosition.x = -22528;
                       if ( pParty->vPosition.x > 22528 )
@@ -1367,12 +1397,44 @@
                         pParty->vPosition.y = -22528;
                       if ( pParty->vPosition.y > 22528 )
                         pParty->vPosition.y = 22528;
-                      goto LABEL_317;
+                      DialogueEnding();
+                      pCurrentScreen = SCREEN_GAME;
+                      viewparams->bRedrawGameUI = 1;
+                      continue;
                     case SCREEN_VIDEO:
                       pVideoPlayer->Unload();
                       continue;
                     case SCREEN_CHARACTERS:
-                      goto LABEL_319;
+                      CharacterUI_ReleaseButtons();
+                      sub_419379();
+                      pIcons_LOD->_4114F2();
+                      if ( pGUIWindow_Settings )
+                      {
+                        if ( pCurrentScreen == SCREEN_CHARACTERS )
+                        {
+                          pMouse->SetCursorBitmap("MICON2");
+                        }
+                        else
+                        {
+                          pGUIWindow_Settings->Release();
+                          pGUIWindow_Settings = 0;
+                          pMouse->SetCursorBitmap("MICON1");
+                          GameUI_Footer_TimeLeft = 0;
+                          unk_50C9A0 = 0;
+                          back_to_game();
+                        }
+                      }
+                      if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 )
+                        uActiveCharacter = pParty->GetNextActiveCharacter();
+                      pGUIWindow_CurrentMenu->Release();
+                      if ( pGUIWindow_CurrentMenu == window_SpeakInHouse )
+                        window_SpeakInHouse = 0;
+                      pGUIWindow_CurrentMenu = 0;
+                      pEventTimer->Resume();
+                      pCurrentScreen = SCREEN_GAME;
+                      viewparams->bRedrawGameUI = 1;
+                      pIcons_LOD->_4355F7();
+                      continue;
                     default:
                       if ( pGUIWindow_Settings )
                       {
@@ -1433,7 +1495,6 @@
 LABEL_319:
                 CharacterUI_ReleaseButtons();
                 sub_419379();
-LABEL_321:
                 pIcons_LOD->_4114F2();
               }
               if ( pGUIWindow_Settings )
@@ -1628,7 +1689,6 @@
             || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 )
           {
             viewparams->bRedrawGameUI = 1;
-LABEL_387:
             CloseWindowBackground();
             if ( pParty->vPosition.x < -22528 )
               pParty->vPosition.x = -22528;
@@ -1638,7 +1698,6 @@
               pParty->vPosition.y = -22528;
             if ( pParty->vPosition.y > 22528 )
               pParty->vPosition.y = 22528;
-LABEL_317:
             DialogueEnding();
             pCurrentScreen = SCREEN_GAME;
           }
@@ -1701,7 +1760,6 @@
             }
             if ( !_strcmpi(pCurrentMapName, "out15.odm") || !_strcmpi(pCurrentMapName, "d47.blv") )
               bNoNPCHiring = 1;
-            //v0 = 1;
             PrepareToLoadODM(1u, (OutdoorCamera *)1);
             pAudioPlayer->SetMapEAX();
             bDialogueUI_InitializeActor_NPC_ID = 0;
@@ -1718,9 +1776,22 @@
           }
           viewparams->bRedrawGameUI = 1;
           continue;
-        case UIMSG_5B:
-          goto LABEL_387;
-        case UIMSG_CastSpell_BE:
+        case UIMSG_CHANGE_LOCATION_ClickCencelBtn:
+          CloseWindowBackground();
+          if ( pParty->vPosition.x < -22528 )
+            pParty->vPosition.x = -22528;
+          if ( pParty->vPosition.x > 22528 )
+            pParty->vPosition.x = 22528;
+          if ( pParty->vPosition.y < -22528 )
+            pParty->vPosition.y = -22528;
+          if ( pParty->vPosition.y > 22528 )
+            pParty->vPosition.y = 22528;
+          DialogueEnding();
+          pCurrentScreen = SCREEN_GAME;
+          viewparams->bRedrawGameUI = 1;
+          continue;
+        case UIMSG_CastSpell_BE://???
+          __debugbreak();
           if ( pRenderer->pRenderD3D )
           {
             LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val();
@@ -1741,10 +1812,10 @@
             if ( !v47 )
               continue;
             v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
-            *((char *)v51 + 8) &= 0xBFu;
-            *((short *)v51 + 2) = uMessageParam;
-            *((int *)v51 + 3) = v44;
-            pParty->pPlayers[*((short *)v51 + 1)].SetRecoveryTime(300);
+            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();
             pGUIWindow_Settings = 0;
@@ -1760,10 +1831,10 @@
             if ( !v47 )
               continue;
             v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
-            *((char *)v51 + 8) &= 0xBFu;
-            *((short *)v51 + 2) = uMessageParam;
-            *((int *)v51 + 3) = v44;
-            pParty->pPlayers[*((short *)v51 + 1)].SetRecoveryTime(300);
+            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();
             pGUIWindow_Settings = 0;
@@ -1787,12 +1858,11 @@
               if ( !(pODMFace->uAttributes & 0x02000000) || !pODMFace->sCogTriggeredID )
                 continue;
               v44 = uNumSeconds;
-              //goto LABEL_415;
               v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
               *((char *)v51 + 8) &= 0xBFu;
-              *((short *)v51 + 2) = uMessageParam;
-              *((int *)v51 + 3) = v44;
-              pParty->pPlayers[*((short *)v51 + 1)].SetRecoveryTime(300);
+              v51->uPlayerID_2 = uMessageParam;
+              v51->spell_target_pid = v44;
+              pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300);
               pWindow3 = pGUIWindow_Settings;
               pWindow3->Release();
               pGUIWindow_Settings = 0;
@@ -1809,15 +1879,12 @@
           }
           if ( v48 )
             continue;
-//LABEL_415:
           v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
-          *((char *)v51 + 8) &= 0xBFu;
-//LABEL_416:
-          *((short *)v51 + 2) = uMessageParam;
-          *((int *)v51 + 3) = v44;
-          pParty->pPlayers[*((short *)v51 + 1)].SetRecoveryTime(300);
+          LOBYTE(v51->field_8) &= 0xBFu;
+          v51->uPlayerID_2 = uMessageParam;
+          v51->spell_target_pid = v44;
+          pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300);
           pWindow3 = pGUIWindow_Settings;
-//LABEL_333:
           pWindow3->Release();
           pGUIWindow_Settings = 0;
           pMouse->SetCursorBitmap("MICON1");
@@ -1825,9 +1892,10 @@
           unk_50C9A0 = 0;
           back_to_game();
           continue;
-        case UIMSG_CastSpell_SPIRIT_Preservation:
-        case UIMSG_CastSpell_8D:
-        case UIMSG_8F:
+        case UIMSG_CastSpell_8F:
+			__debugbreak();
+        case UIMSG_CastSpell_SPIRIT_Preservation://and blessing, treatment paralysis, hand hammers(individual upgrade)
+        case UIMSG_CastSpell_SPIRIT_Fate:
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
           if ( unk_50C9A0 )
@@ -1839,21 +1907,21 @@
           {
             if ( pGUIWindow_Settings )
             {
-              v52 = pGUIWindow_Settings->ptr_1C;
+              v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
               switch ( uMessage )
               {
-                case 69:
-                  *((char *)v52 + 8) &= 0xFDu;
+                case UIMSG_CastSpell_SPIRIT_Preservation:
+                  LOBYTE(v51->field_8) &= 0xFDu;
                   break;
-                case 141:
-                  *((char *)v52 + 9) &= 0xFEu;
+                case UIMSG_CastSpell_SPIRIT_Fate:
+                  HIBYTE(v51->field_8) &= 0xFEu;
                   break;
-                case 143:
-                  *((char *)v52 + 9) &= 0xFDu;
+                case UIMSG_CastSpell_8F:
+                  HIBYTE(v51->field_8) &= 0xFDu;
                   break;
               }
-              *((short *)v52 + 2) = uMessageParam;
-              pParty->pPlayers[*((short *)v52 + 1)].SetRecoveryTime(300);
+              v51->uPlayerID_2 = uMessageParam;
+              pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300);
               pGUIWindow_Settings->Release();
               pGUIWindow_Settings = 0;
               pEventTimer->Resume();
@@ -1864,6 +1932,7 @@
           }
           continue;
         case UIMSG_BF:
+			__debugbreak();
           dword_50CDC8 = 1;
           sub_42FBDD();
           SaveGame(1, 0);
@@ -1890,7 +1959,7 @@
           //goto LABEL_434;
           /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
           {
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
+            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
             pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
             *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
             ++pMessageQueue_50CBD0->uNumMessages;
@@ -1944,11 +2013,10 @@
           continue;
         case UIMSG_CloseAfterInstallBeacon:
           dword_50CDC8 = 1;
-          //goto LABEL_453;
           pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
           /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
             continue;
-          pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
+          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;*/
@@ -2094,12 +2162,10 @@
                     *((int *)v67 + 17) = 1;
                   else
                     pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u);
-//LABEL_434:
                   /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
                   {
-                    pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
+                    pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
                     pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0;
-//LABEL_771:
                     *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
                     ++pMessageQueue_50CBD0->uNumMessages;
                   }*/
@@ -2230,12 +2296,11 @@
           uGameState = GAME_STATE_FINAL_WINDOW;
           continue;
         case UIMSG_C4:
-			__debugbreak;
+			__debugbreak();
           uGameState = GAME_STATE_PLAYING;
           strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2");
-          goto LABEL_524;
         case UIMSG_DD:
-LABEL_524:
+			__debugbreak();
           sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer);
           memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216));
           if ( v216.uPropCount == 1 )
@@ -2244,10 +2309,7 @@
             v70 = atoi(v216.pProperties[0]);
             if ( v70 <= 0 || v70 >= 77 )
             {
-//LABEL_90:
               v1 = "";
-//LABEL_91:
-              //v0 = 1;
               continue;
             }
             v71 = v70;
@@ -2270,9 +2332,7 @@
                 dword_6BE364_game_settings_1 |= 1u;
                 uGameState = GAME_STATE_2;
                 OnMapLeave();
-                //goto LABEL_90;
                 v1 = "";
-                //v0 = 1;
                 continue;
               }
             }
@@ -2282,10 +2342,8 @@
           else
           {
             if ( v216.uPropCount != 3 )
-              //goto LABEL_90;
             {
               v1 = "";
-              //v0 = 1;
               continue;
             }
             v74 = atoi(v216.pProperties[0]);
@@ -2297,14 +2355,11 @@
               if ( pIndoor->GetSector(v74, thisi, v75) )
               {
                 v77 = thisi;
-//LABEL_544:
                 pParty->vPosition.x = v74;
                 pParty->vPosition.y = v77;
                 pParty->vPosition.z = v76;
                 pParty->uFallStartY = v76;
-                //goto LABEL_90;
                 v1 = "";
-                //v0 = 1;
                 continue;
               }
             }
@@ -2318,15 +2373,12 @@
                   if ( thisi > -32768 )
                   {
                     if ( thisi < 32768 && v76 >= 0 && v76 < 10000 )
-                      //goto LABEL_544;
                     {
                       pParty->vPosition.x = v74;
                       pParty->vPosition.y = v77;
                       pParty->vPosition.z = v76;
                       pParty->uFallStartY = v76;
-                      //goto LABEL_90;
                       v1 = "";
-                      //v0 = 1;
                       continue;
                     }
                   }
@@ -2337,9 +2389,7 @@
             v73 = "Can't jump to that location!";
           }
           ShowStatusBarString(v73, 6u);
-          //goto LABEL_90;
           v1 = "";
-          //v0 = 1;
           continue;
         case UIMSG_CastQuickSpell:
           if ( bUnderwater == 1 )
@@ -2349,16 +2399,15 @@
             continue;
           }
           if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) )
-            //goto LABEL_90;
           {
             v1 = "";
-            //v0 = 1;
             continue;
           }
           _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_GreatShot://Fireball, Spraying poison and other
           if ( pRenderer->pRenderD3D )
           {
             v81 = pGame->pVisInstance->get_picked_object_zbuf_val();
@@ -2373,27 +2422,24 @@
           v44 = (unsigned __int16)v81;
           v84 = v83 >> 16;
           if ( PID_TYPE(v44) != 3 || v84 >= 5120 )
-            //goto LABEL_90;
           {
             v1 = "";
-            //v0 = 1;
             continue;
           }
           v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C;
-          if ( uMessage == 70 )
-          {
-            *((char *)v51 + 8) &= 247;
+          if ( uMessage == UIMSG_CastSpell_SmallShot )
+          {
+            LOBYTE(v51->field_8) &= 0xF7;
           }
           else
           {
-            if ( uMessage == 140 )
-              *((char *)v51 + 9) &= 0xFEu;
+            if ( uMessage == UIMSG_CastSpell_GreatShot )
+              HIBYTE(v51->field_8) &= 0xFEu;
             else
-              *((char *)v51 + 9) &= 0xFDu;
-          }
-          //goto LABEL_416;
-          *((short *)v51 + 2) = uMessageParam;
-          *((int *)v51 + 3) = v44;
+              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();
@@ -2404,11 +2450,10 @@
           back_to_game();
           continue;
         case UIMSG_1C:
+			__debugbreak();
           if ( !uActiveCharacter || pCurrentScreen )
-            //goto LABEL_90;
           {
             v1 = "";
-            //v0 = 1;
             continue;
           }
           ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0);
@@ -2416,15 +2461,13 @@
           pEventTimer->Pause();
           continue;
         case UIMSG_1B:
+			__debugbreak();
           if ( !uActiveCharacter )
-            //goto LABEL_90;
           {
             v1 = "";
-            //v0 = 1;
             continue;
           }
           if ( pParty->bTurnBasedModeOn != 1 )
-            //goto LABEL_569;
           {
             if ( pActors[uMessageParam].uAIState == 5 )
               stru_50C198.LootActor(&pActors[uMessageParam]);
@@ -2433,15 +2476,12 @@
             continue;
           }
           if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 )
-            //goto LABEL_90;
           {
             v1 = "";
-            //v0 = 1;
             continue;
           }
           if ( !(pTurnEngine->field_18 & 2) )
           {
-//LABEL_569:
             if ( pActors[uMessageParam].uAIState == 5 )
               stru_50C198.LootActor(&pActors[uMessageParam]);
             else
@@ -2451,27 +2491,21 @@
 
         case UIMSG_Attack:
           if ( !uActiveCharacter )
-            //goto LABEL_90;
           {
             v1 = "";
-            //v0 = 1;
             continue;
           }
           if ( pParty->bTurnBasedModeOn != 1 )
-            //goto LABEL_577;
           {
             _42ECB5_PlayerAttacksActor();
             continue;
           }
           if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 )
-            //goto LABEL_90;
           {
             v1 = "";
-            //v0 = 1;
             continue;
           }
           if ( !(pTurnEngine->field_18 & 2) )
-//LABEL_577:
             _42ECB5_PlayerAttacksActor();
           continue;
         case UIMSG_ExitRest:
@@ -2535,7 +2569,6 @@
             if ( !uActiveCharacter )
             {
               v1 = "";
-              //v0 = 1;
               continue;
             }
             pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
@@ -2563,7 +2596,6 @@
           if ( !uActiveCharacter )
           {
             v1 = "";
-            //v0 = 1;
             continue;
           }
           pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
@@ -2613,7 +2645,7 @@
                 dword_506F14 = 0;
                 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
                 {
-                  pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
+                  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;
@@ -2683,7 +2715,6 @@
           }
           sprintfex(pTmpBuf, v161, v178);
           sub_41C0B8_set_status_string(pTmpBuf);
-          //v0 = 1;
           continue;
         case UIMSG_ClickInstallRemoveQuickSpellBtn:
           GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0);
@@ -2705,6 +2736,7 @@
           byte_506550 = 0;
           continue;
         case UIMSG_33:
+			__debugbreak();
           if ( !uActiveCharacter )
             continue;
           pPlayer3 = pPlayers[uActiveCharacter];
@@ -2802,6 +2834,7 @@
         continue;
 
         case UIMSG_92:
+			__debugbreak();
           if ( pTurnEngine->field_4 != 3 )
             _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0);
           continue;
@@ -2820,7 +2853,6 @@
             if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery )
             {
               if ( !pCurrentScreen )
-                //goto LABEL_693;
               {
                 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0);
                 pCurrentScreen = SCREEN_SPELL_BOOK;
@@ -2883,7 +2915,7 @@
 //LABEL_453:
           /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 )
             continue;
-          pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
+          pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
           //goto LABEL_770;
           pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
           *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
@@ -2891,17 +2923,18 @@
           pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
           continue;
         case UIMSG_C0:
+			__debugbreak();
           dword_50651C = 1;
           if ( pMouse->GetCursorPos(&v211)->y > 178 )
             dword_50651C = -1;
           continue;
         case UIMSG_ClickAwardsUpBtn:
           GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0);
-          dword_506548 = 1;
+          BtnUp_flag = 1;
           continue;
         case UIMSG_ClickAwardsDownBtn:
           GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0);
-          dword_506544 = 1;
+          BtnDown_flag = 1;
           continue;
         case UIMSG_ChangeDetaliz:
           bRingsShownInCharScreen ^= 1;
@@ -2983,57 +3016,59 @@
           GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0);
           FillAwardsData();
           continue;
-        case UIMSG_AutonotesBook:
+        case UIMSG_AutonotesBook://не только Автозаметки (в процессе)
           switch ( uMessageParam )
           {
-            default:
-              continue;
-            case 11:
-              dword_506548 = 1;
-              continue;
-            case 10:
-              dword_506544 = 1;
-              continue;
+            case 11://Page UP
+              BtnUp_flag = 1;
+              pButton = pBtn_Book_2;
+              break;
+            case 10://Page DOWN
+              BtnDown_flag = 1;
+              pButton = pBtn_Book_1;
+              break;
             case 0:
               pButton = pBtn_Book_1;
-              dword_506544 = 1;
+              BtnDown_flag = 1;
               break;
             case 1:
-              pButton = pBtn_Book_2;
-              dword_506548 = 1;
+              pButton = pBtn_Book_2;//увеличить в MapsBook
+              BtnUp_flag = 1;
               break;
-            case 2:
-              dword_506540 = 1;
+            case 2://Potions
+              Book_PageBtn3_flag = 1;
               if ( dword_506364 )
                 continue;
               pButton = pBtn_Book_3;
               break;
-            case 3:
-              dword_50653C = 1;
+            case 3://fountains
+              Book_PageBtn4_flag = 1;
               if ( dword_506364 )
                 continue;
               pButton = pBtn_Book_4;
               break;
-            case 4:
-              dword_506538 = 1;
+            case 4://obelisks
+              Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag
               if ( dword_506364 )
                 continue;
               pButton = pBtn_Book_5;
               break;
-            case 5:
-              dword_506534 = 1;
+            case 5://seer
+              Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag
               if ( dword_506364 )
                 continue;
               pButton = pBtn_Book_6;
               break;
-            case 6:
+            case 6://misc
               pButton = pBtn_Autonotes_Misc;
-              dword_506530 = 1;
+              Autonotes_Misc_page_flag = 1;
               break;
-            case 7:
+            case 7://Instructors
               pButton = pBtn_Autonotes_Instructors;
-              dword_50652C = 1;
+              Autonotes_Instructors_page_flag = 1;
               break;
+            default:
+              continue;
           }
           GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1);
           continue;
@@ -3090,16 +3125,16 @@
           sprintf(pTmpBuf, "%d / %d %s    %d / %d %s", v110->sHealth, v114, v113, v112, v111, v109);
           sub_41C0B8_set_status_string(pTmpBuf);
           continue;
-        case UIMSG_C:
-          if ( pCurrentScreen == SCREEN_F )
-          {
-            sub_421EA6_OnInventoryLeftClick();
+        case UIMSG_CHEST_ClickItem:
+          if ( pCurrentScreen == SCREEN_CHEST_INVENTORY )
+          {
+            OnInventoryLeftClick();
             continue;
           }
-          sub_420E01();
+          OnChestLeftClick();
           continue;
         case UIMSG_InventoryLeftClick:
-          sub_421EA6_OnInventoryLeftClick();
+          OnInventoryLeftClick();
           continue;
         case UIMSG_MouseLeftClickInGame:
           if ( !pRenderer->pRenderD3D )
@@ -3113,11 +3148,11 @@
           if ( !pMessageQueue_50CBD0->uNumMessages )
             //goto LABEL_768;
           {
-            pMessageQueue_50CBD0->AddMessage(UIMSG_E, 0, 0);
+            pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
             /*if ( (signed int)v115 < 40 )
             //goto LABEL_769;
             {
-              pMessageQueue_50CBD0->pMessages[v115].eType = (UIMessageType)14;
+              pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen;
               pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
               *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
               ++pMessageQueue_50CBD0->uNumMessages;
@@ -3128,10 +3163,10 @@
           if ( pMessageQueue_50CBD0->pMessages[0].field_8 )
           {
             pMessageQueue_50CBD0->uNumMessages = 1;
-            pMessageQueue_50CBD0->AddMessage(UIMSG_E, 0, 0);
+            pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
             /*v115 = v0;
             pMessageQueue_50CBD0->uNumMessages = v0;
-            pMessageQueue_50CBD0->pMessages[v115].eType = (UIMessageType)14;
+            pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen;
             pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
             //goto LABEL_771;
             *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
@@ -3140,23 +3175,24 @@
           }
           v115 = 0;
           pMessageQueue_50CBD0->uNumMessages = 0;
-          pMessageQueue_50CBD0->AddMessage(UIMSG_E, 0, 0);
+          pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0);
           /*if ( (signed int)v115 < 40 )
             //goto LABEL_769;
           {
-            pMessageQueue_50CBD0->pMessages[v115].eType = (UIMessageType)14;
+            pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen;
             pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
             *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
             ++pMessageQueue_50CBD0->uNumMessages;
             continue;
           }*/
           continue;
-        case UIMSG_E://срабатывает при нажатии на правую кнопку мыши после UIMSG_MouseLeftClickInGame
+        case UIMSG_MouseLeftClickInScreen://срабатывает при нажатии на правую кнопку мыши после UIMSG_MouseLeftClickInGame
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
           OnGameViewportClick();
           continue;
         case UIMSG_F:
+			__debugbreak();
           if ( pRenderer->pRenderD3D )
           {
             LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val();
@@ -3171,8 +3207,9 @@
           GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0);
           continue;
         case UIMSG_54:
+			__debugbreak();
           pButton2 = (GUIButton *)uMessageParam;
-          GUIWindow::Create(0, 0, 0, 0, (WindowType)22, (int)pButton2, 0);
+          GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0);
           continue;
         case UIMSG_Game_Action:
           if ( pMessageQueue_50CBD0->uNumMessages )
@@ -10278,7 +10315,7 @@
         {
           Chest::DrawChestUI((unsigned int)pWindow->ptr_1C);
         }
-        else if ( pCurrentScreen == SCREEN_F )
+        else if ( pCurrentScreen == SCREEN_CHEST_INVENTORY )
         {
           pRenderer->ClearZBuffer(0, 479);
           draw_leather();
@@ -10894,7 +10931,7 @@
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
       /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
       {
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
+        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;
@@ -10970,7 +11007,7 @@
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
       /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
       {
-        pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
+        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;
@@ -11286,7 +11323,7 @@
   {
     /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
     {
-      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)27;
+      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_1B;
       pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3;
       *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
       ++pMessageQueue_50CBD0->uNumMessages;