changeset 987:9e132060ada3

UIMSG_CHEST_ClickItem
author Ritor1
date Sun, 12 May 2013 18:11:21 +0600
parents b584c743cb47
children bb37d33934b0 d5796c318653
files Chest.cpp GUIWindow.cpp GUIWindow.h UIPopup.cpp UiGame.cpp mm7_1.cpp mm7_2.cpp mm7_5.cpp mm7_6.cpp mm7_data.h
diffstat 10 files changed, 130 insertions(+), 113 deletions(-) [+]
line wrap: on
line diff
--- a/Chest.cpp	Sun May 12 09:38:30 2013 +0600
+++ b/Chest.cpp	Sun May 12 18:11:21 2013 +0600
@@ -242,7 +242,7 @@
   pChestWindow = pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Chest, uChestID, 0);
 
   pBtn_ExitCancel = pChestWindow->CreateButton(471, 445, 169,  35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], pIcons_LOD->GetTexture(uExitCancelTextureId),   0);// Exit
-                    pChestWindow->CreateButton(  7,   8, 460, 343, 1, 0, UIMSG_C,      0, 0, "", 0);
+                    pChestWindow->CreateButton(  7,   8, 460, 343, 1, 0, UIMSG_CHEST_ClickItem,      0, 0, "", 0);
 
   pCurrentScreen = SCREEN_CHEST;
   pEventTimer->Pause();
--- a/GUIWindow.cpp	Sun May 12 09:38:30 2013 +0600
+++ b/GUIWindow.cpp	Sun May 12 18:11:21 2013 +0600
@@ -1160,7 +1160,7 @@
           GuildDialog();
           break;
         case BildingType_18:
-          __debugbreak; //What over the dialog?
+          __debugbreak(); //What over the dialog?
           sub_4B6478();
           break;
         case BildingType_TownHall:
@@ -1185,7 +1185,7 @@
           JailDialog();
           break;
         default:
-          __debugbreak;//New BildingType
+          __debugbreak();//New BildingType
           break;
       }
   }
@@ -1866,7 +1866,7 @@
         case WINDOW_ChangeLocation:
           pMainScreenNum = pCurrentScreen;
           pCurrentScreen = SCREEN_CHANGE_LOCATION;
-          pBtn_ExitCancel = pWindow->CreateButton(                  566,                   445,  75,  33, 1, 0, UIMSG_5B,             0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Остаться в этой области
+          pBtn_ExitCancel = pWindow->CreateButton(                  566,                   445,  75,  33, 1, 0, UIMSG_CHANGE_LOCATION_ClickCencelBtn, 0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);//Остаться в этой области
           pBtn_YES        = pWindow->CreateButton(                  486,                   445,  75,  33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0);
                             pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0],  63,  73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0);
                             pWindow->CreateButton(                    8,                     8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1,   0, pWindow->Hint, 0);
--- a/GUIWindow.h	Sun May 12 09:38:30 2013 +0600
+++ b/GUIWindow.h	Sun May 12 18:11:21 2013 +0600
@@ -14,7 +14,7 @@
 
   UIMSG_MouseLeftClickInGame = 10,
 
-  UIMSG_C = 12,
+  UIMSG_CHEST_ClickItem = 12,
 
   UIMSG_E = 14,
   UIMSG_F = 15,
@@ -70,7 +70,7 @@
   UIMSG_ClickInstallRemoveQuickSpellBtn = 88,
 
   UIMSG_OnTravelByFoot = 90,
-  UIMSG_5B = 91,
+  UIMSG_CHANGE_LOCATION_ClickCencelBtn = 91,
   UIMSG_ShowStatus_DateTime = 92,
   UIMSG_ShowStatus_ManaHP = 93,
   UIMSG_ShowStatus_Player = 94,
@@ -115,9 +115,9 @@
   UIMSG_SelectNPCDialogueOption = 136,
 
   UIMSG_CastSpell_GreatShot = 140,
-  UIMSG_CastSpell_8D = 141,
+  UIMSG_CastSpell_SPIRIT_Fate = 141,
   UIMSG_CastSpellFromBook = 142,
-  UIMSG_8F = 143,
+  UIMSG_CastSpell_8F = 143,
   UIMSG_PlayerCreation_VoicePrev = 144,
   UIMSG_PlayerCreation_VoiceNext = 145,
   UIMSG_92 = 146,
@@ -386,7 +386,7 @@
   SCREEN_LOADGAME = 0xC,
   SCREEN_HOUSE = 0xD,
   SCREEN_E = 0xE,
-  SCREEN_F = 0xF,
+  SCREEN_CHEST_INVENTORY = 0xF,
   SCREEN_VIDEO = 0x10,
   SCREEN_CHANGE_LOCATION = 0x11,
   SCREEN_INPUT_BLV = 0x12,
--- a/UIPopup.cpp	Sun May 12 09:38:30 2013 +0600
+++ b/UIPopup.cpp	Sun May 12 18:11:21 2013 +0600
@@ -1735,7 +1735,7 @@
         sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription);
       break;
     case 26:
-      __debugbreak;
+      __debugbreak();
       //_y = (Player *)(4 * pPlayers[uActiveCharacter]->classType);
       //v24 = *(char **)((char *)_y->pConditions + (int)pClassNames);
       //v7 = *(char **)((char *)_y->pConditions + (int)pClassDescriptions);
@@ -1848,7 +1848,7 @@
         ItemGen *v8; // ecx@70
         unsigned int v9; // eax@72
         unsigned int v10; // eax@76
-        char v11; // zf@83
+        //char v11; // zf@83
         GUIButton *pButton; // esi@84
         unsigned int v13; // ecx@85
         char *pStr; // edi@85
@@ -2079,7 +2079,7 @@
             }
         case SCREEN_CHARACTERS:
         case SCREEN_E:
-        case SCREEN_F:
+        case SCREEN_CHEST_INVENTORY:
             {
             if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E )
                 {
@@ -2096,11 +2096,10 @@
                 CharacterUI_SkillsTab_ShowHint();
                 }
             else
-                {
-                v11 = pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103;//2DEvent - CharacerScreenInventory
-                if ( v11 )
-                    identify_item();
-                }
+              {
+                if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory
+                  identify_item();
+              }
             break;
             }
         case SCREEN_SPELL_BOOK:
--- a/UiGame.cpp	Sun May 12 09:38:30 2013 +0600
+++ b/UiGame.cpp	Sun May 12 18:11:21 2013 +0600
@@ -1871,7 +1871,7 @@
         || pCurrentScreen == SCREEN_CHEST
         || pCurrentScreen == SCREEN_SAVEGAME
         || pCurrentScreen == SCREEN_LOADGAME
-        || pCurrentScreen == SCREEN_F
+        || pCurrentScreen == SCREEN_CHEST_INVENTORY
         || pCurrentScreen == SCREEN_BOOKS
         || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
         {
--- a/mm7_1.cpp	Sun May 12 09:38:30 2013 +0600
+++ b/mm7_1.cpp	Sun May 12 18:11:21 2013 +0600
@@ -625,7 +625,7 @@
 }
 
 //----- (00420E01) --------------------------------------------------------
-void __cdecl sub_420E01()
+void __cdecl OnChestLeftClick()
 {
   int chest_id; // edi@1
   POINT *v1; // esi@2
@@ -850,7 +850,7 @@
     if ( uActiveCharacter == uPlayerID )
     {
       pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
-      pCurrentScreen = SCREEN_F;
+      pCurrentScreen = SCREEN_CHEST_INVENTORY;
       //goto LABEL_28;
       uActiveCharacter = uPlayerID;
       return;
@@ -870,7 +870,7 @@
       uActiveCharacter = uPlayerID;
       return;
     }
-    if ( pCurrentScreen != SCREEN_F )
+    if ( pCurrentScreen != SCREEN_CHEST_INVENTORY )
     {
       viewparams->bRedrawGameUI = true;
       uActiveCharacter = uPlayerID;
@@ -883,7 +883,7 @@
     if ( uActiveCharacter == uPlayerID )
     {
       pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
-      pCurrentScreen = SCREEN_F;
+      pCurrentScreen = SCREEN_CHEST_INVENTORY;
       //goto LABEL_28;
       uActiveCharacter = uPlayerID;
       return;
@@ -916,7 +916,7 @@
 // F8B19C: using guessed type int dword_F8B19C;
 
 //----- (00421EA6) --------------------------------------------------------
-void __cdecl sub_421EA6_OnInventoryLeftClick()
+void __cdecl OnInventoryLeftClick()
 {
   Player *v0; // ebx@1
   signed int v1; // eax@2
--- a/mm7_2.cpp	Sun May 12 09:38:30 2013 +0600
+++ b/mm7_2.cpp	Sun May 12 18:11:21 2013 +0600
@@ -907,7 +907,7 @@
 
   if ( pCurrentScreen == SCREEN_E )
   {
-    sub_421EA6_OnInventoryLeftClick();
+    OnInventoryLeftClick();
     return;
   }
   if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
@@ -921,7 +921,7 @@
     case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT:
     {
       pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
-      sub_421EA6_OnInventoryLeftClick();
+      OnInventoryLeftClick();
       break;
     }
     case HOUSE_DIALOGUE_GUILD_BUY_BOOKS:
--- a/mm7_5.cpp	Sun May 12 09:38:30 2013 +0600
+++ b/mm7_5.cpp	Sun May 12 18:11:21 2013 +0600
@@ -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,7 +975,7 @@
           back_to_game();
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-          if ( pCurrentScreen > SCREEN_F )
+          if ( pCurrentScreen > SCREEN_CHEST_INVENTORY )
           {
             if ( pCurrentScreen >= SCREEN_CHANGE_LOCATION && (pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_QUICK_REFERENCE) )
             {
@@ -1104,7 +1106,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 +1118,7 @@
                       pEventTimer->Resume();
                       continue;
                     case SCREEN_19:
+						__debugbreak();
                       pWindow2 = ptr_507BC8;
                       pWindow2->Release();
                       pIcons_LOD->_4114F2();
@@ -1125,7 +1128,6 @@
                       continue;
                     case SCREEN_OPTIONS://Close
                       options_menu_skin.Relaease();
-
                       pIcons_LOD->_40F9C5();
                       WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
                       WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
@@ -1137,18 +1139,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 +1154,6 @@
                           stru_506E40.Release();
                           break;
                         }
-                      //v30 = v0;
-                      //v31 = "TurnDelta";
                       WriteWindowsRegistryInt("TurnDelta", 1);
                       stru_506E40.Release();
                       break;
@@ -1283,6 +1277,7 @@
                        pIcons_LOD->_4355F7();
                        continue;
                     case SCREEN_E:
+						__debugbreak();
                       pGUIWindow_CurrentMenu->Release();
                       pCurrentScreen = SCREEN_HOUSE;
                       pIcons_LOD->_4114F2();
@@ -1331,7 +1326,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 +1338,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 +1351,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,7 +1372,10 @@
                         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;
@@ -1628,7 +1636,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 +1645,6 @@
               pParty->vPosition.y = -22528;
             if ( pParty->vPosition.y > 22528 )
               pParty->vPosition.y = 22528;
-LABEL_317:
             DialogueEnding();
             pCurrentScreen = SCREEN_GAME;
           }
@@ -1701,7 +1707,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 +1723,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 +1759,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 +1778,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 +1805,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 +1826,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 +1839,9 @@
           unk_50C9A0 = 0;
           back_to_game();
           continue;
-        case UIMSG_CastSpell_SPIRIT_Preservation:
-        case UIMSG_CastSpell_8D:
-        case UIMSG_8F:
+        case UIMSG_CastSpell_SPIRIT_Preservation://and blessing, treatment paralysis, hand hammers(individual upgrade)
+        case UIMSG_CastSpell_SPIRIT_Fate:
+        case UIMSG_CastSpell_8F://???
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
           if ( unk_50C9A0 )
@@ -1839,21 +1853,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 +1878,7 @@
           }
           continue;
         case UIMSG_BF:
+			__debugbreak();
           dword_50CDC8 = 1;
           sub_42FBDD();
           SaveGame(1, 0);
@@ -1944,7 +1959,6 @@
           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;
@@ -2230,7 +2244,7 @@
           uGameState = GAME_STATE_FINAL_WINDOW;
           continue;
         case UIMSG_C4:
-			__debugbreak;
+			__debugbreak();
           uGameState = GAME_STATE_PLAYING;
           strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2");
           goto LABEL_524;
@@ -2358,7 +2372,7 @@
           _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter);
           continue;
         case UIMSG_CastSpell_SmallShot://FireBlow, Lightning, Ice Lightning, Swarm, 
-        case UIMSG_CastSpell_GreatShot://Fireball, Spraying poison and other
+        case UIMSG_CastSpell_GreatShot://???
           if ( pRenderer->pRenderD3D )
           {
             v81 = pGame->pVisInstance->get_picked_object_zbuf_val();
@@ -2373,27 +2387,25 @@
           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;
+              HIBYTE(v51->field_8) &= 0xFDu;
           }
           //goto LABEL_416;
-          *((short *)v51 + 2) = uMessageParam;
-          *((int *)v51 + 3) = v44;
+          v51->uPlayerID_2 = uMessageParam;
+          v51->spell_target_pid = v44;
           pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300);
           pWindow3 = pGUIWindow_Settings;
           pWindow3->Release();
@@ -2404,11 +2416,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,6 +2427,7 @@
           pEventTimer->Pause();
           continue;
         case UIMSG_1B:
+			__debugbreak();
           if ( !uActiveCharacter )
             //goto LABEL_90;
           {
@@ -2705,6 +2717,7 @@
           byte_506550 = 0;
           continue;
         case UIMSG_33:
+			__debugbreak();
           if ( !uActiveCharacter )
             continue;
           pPlayer3 = pPlayers[uActiveCharacter];
@@ -2802,6 +2815,7 @@
         continue;
 
         case UIMSG_92:
+			__debugbreak();
           if ( pTurnEngine->field_4 != 3 )
             _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0);
           continue;
@@ -2891,6 +2905,7 @@
           pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
           continue;
         case UIMSG_C0:
+			__debugbreak();
           dword_50651C = 1;
           if ( pMouse->GetCursorPos(&v211)->y > 178 )
             dword_50651C = -1;
@@ -3090,16 +3105,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 )
@@ -3151,12 +3166,14 @@
             continue;
           }*/
           continue;
-        case UIMSG_E://срабатывает при нажатии на правую кнопку мыши после UIMSG_MouseLeftClickInGame
+        case UIMSG_E:
+			__debugbreak();//срабатывает при нажатии на правую кнопку мыши после 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,6 +3188,7 @@
           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);
           continue;
@@ -10278,7 +10296,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();
--- a/mm7_6.cpp	Sun May 12 09:38:30 2013 +0600
+++ b/mm7_6.cpp	Sun May 12 18:11:21 2013 +0600
@@ -2320,10 +2320,10 @@
         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_8D, 0, 0x31u, "", 0);
-        pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_8D, 1, 0x32u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_8D, 2, 0x33u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_8D, 3, 0x34u, "", 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);
         sub_421B2C_PlaceInInventory_or_DropPickedItem();
       }
@@ -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_8F, 4, 0x35u, "", 0);
-        pGUIWindow_Settings->CreateButton(0x231u, 149, 64, 74, 1, 0, UIMSG_8F, 5, 0x36u, "", 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);
       }
     }
 }
--- a/mm7_data.h	Sun May 12 09:38:30 2013 +0600
+++ b/mm7_data.h	Sun May 12 18:11:21 2013 +0600
@@ -1624,14 +1624,14 @@
 void __cdecl sub_42038D();
 
 void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal); // idb
-void __cdecl sub_420E01();
+void OnChestLeftClick();
 void __cdecl GameUI_WritePointedObjectStatusString();
 struct GUIWindow *__thiscall GameUI_InitializeCharacterWindow(unsigned int _this);
 struct GUIWindow *__thiscall sub_4219BE(void *a4);
 bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem();
 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb
-void __cdecl sub_421EA6_OnInventoryLeftClick();
-void __cdecl OnGameViewportClick();
+void OnInventoryLeftClick();
+void OnGameViewportClick();
 bool PauseGameDrawing();
 void SetUserInterface(enum PartyAlignment alignment, bool bReplace);
 void __cdecl reset_some_strus_flt_2Cs();