diff mm7_5.cpp @ 987:9e132060ada3

UIMSG_CHEST_ClickItem
author Ritor1
date Sun, 12 May 2013 18:11:21 +0600
parents d982fffb8b96
children 087a9af8e0ec
line wrap: on
line diff
--- 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();