diff mm7_2.cpp @ 838:d061180f2b42

Merge
author Gloval
date Thu, 28 Mar 2013 00:37:58 +0400
parents bebc19f3d2af b66abf8b7d50
children ceef50611567 06fc66ceecd6 710cf848ad24
line wrap: on
line diff
--- a/mm7_2.cpp	Thu Mar 28 00:37:27 2013 +0400
+++ b/mm7_2.cpp	Thu Mar 28 00:37:58 2013 +0400
@@ -5,7 +5,6 @@
 #include "MapInfo.h"
 #include "Game.h"
 #include "GUIWindow.h"
-#include "GUIButton.h"
 #include "GUIFont.h"
 #include "Party.h"
 #include "AudioPlayer.h"
@@ -293,10 +292,10 @@
   uDialogueType = 83;
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0);
-  pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel"
+  pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel"
                  (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
-  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
-  pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0);
+  pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
+  pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, UIMSG_0, 0x53u, 0, "", 0);
   pDialogueWindow->_41D08F(1, 1, 0, 2);
   dialog_menu_id = HOUSE_DIALOGUE_OTHER;
   v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102);
@@ -436,12 +435,12 @@
     pDialogueWindow->pControlsHead = 0;
     pDialogueWindow->pControlsTail = 0;
     pDialogueWindow->uNumControls = 0;
-    pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79],
+    pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79],
                    (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
-    pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x55u, 0, "", 0);
-    pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x56u, 0, "", 0);
-    pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x57u, 0, "", 0);
-    pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, 0x88u, 0x58u, 0, "", 0);
+    pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x55u, 0, "", 0);
+    pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x56u, 0, "", 0);
+    pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x57u, 0, "", 0);
+    pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x58u, 0, "", 0);
     pDialogueWindow->_41D08F(4, 1, 0, 1);
   }
 }
@@ -808,10 +807,10 @@
 {
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0);
-  pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445,  169, 35, 1, 0,  0x71u,  0,  0,
+  pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445,  169, 35, 1, 0, UIMSG_Escape,  0,  0,
                  pGlobalTXT_LocalizationStrings[74],  //"End Conversation"
                  pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
-  pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0);
+  pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
 }
 
 //----- (004BD8B5) --------------------------------------------------------
@@ -827,7 +826,7 @@
   pKeyActionMap->_459ED1(3);
   pKeyActionMap->ResetKeys();
   activeLevelDecoration = NULL;
-  ptr_F8B1E8 = 0;
+  current_npc_text = 0;
   if ( pDialogueNPCCount )
   {
     v0 = dialog_menu_id;
@@ -898,7 +897,7 @@
         do
         {
           HouseNPCData[v2 + 7] = (NPCData *)window_SpeakInHouse->CreateButton(pNPCPortraits_x[v1 - 1][v2], pNPCPortraits_y[v1 - 1][v2],
-                                              0x3Fu, 0x49u, 1, 0, 0x19Au, v2, 0, byte_591180[v2], 0, 0, 0);
+                                              0x3Fu, 0x49u, 1, 0, UIMSG_19A, v2, 0, byte_591180[v2], 0, 0, 0);
           v1 = uNumDialogueNPCPortraits;
           ++v2;
           //v3 += 100;
@@ -1162,7 +1161,6 @@
 		break;
 		}
 
-
 	case HOUSE_DIALOGUE_SHOP_REPAIR:
 		{
 		v1 = pMouse->GetCursorPos(&a2)->x - 14;
@@ -4303,11 +4301,11 @@
   a1a.uFacing = 0;
   a1a.vPosition.z = a2->vPosition.z;
   a1a.vPosition.x = a2->vPosition.x;
-  a1a.field_50 = 0;
-  a1a.field_4C = 0;
-  a1a.field_48 = 0;
-  a1a.field_5C = 0;
-  a1a.field_58_pid = 0;
+  a1a.spell_skill = 0;
+  a1a.spell_level = 0;
+  a1a.spell_id = 0;
+  a1a.spell_target_pid = 0;
+  a1a.spell_caster_pid = 0;
   a1a.uSpriteFrameID = 0;
   a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);;
   return a1a.Create(0, 0, 0, 0);
@@ -6941,7 +6939,7 @@
                 && pt.y >= (signed int)pButton->uY && pt.y <= (signed int)pButton->uW
                 && pWindow == pWindow_MainMenu )
            {
-            pControlParam = pButton->uControlParam;
+            pControlParam = pButton->msg_param;
             switch (pControlParam) // подсветка кнопок
             {
               case 0:
@@ -6988,7 +6986,7 @@
 //----- (004637EB) --------------------------------------------------------
 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam)
 {
-  unsigned int v4; // esi@1
+  //unsigned int v4; // esi@1
   Render *v5; // ecx@14
   HANDLE v6; // eax@32
   Keyboard *v7; // eax@33
@@ -7029,10 +7027,15 @@
   switch (Msg)
   {
     case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam);
+    case WM_CHAR:
+    {
+      if (!pKeyActionMap->_459F10(wParam) && !viewparams->field_4C)
+        GUI_HandleHotkey(wParam);
+    }
+    return DefWindowProcA(hWnd, Msg, wParam, lParam);
   };
   
 
-  v4 = lParam;
   if ( Msg > WM_SYSCOMMAND )
   {
     switch ( Msg )
@@ -7090,7 +7093,7 @@
           if ( pAsyncMouse != v32 )
             goto _def_wnd_proc;
           back_to_game();
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         if (pAsyncMouse)
           goto _def_wnd_proc;
@@ -7104,7 +7107,7 @@
           if (pAsyncMouse)
             goto _def_wnd_proc;
           pArcomageGame->stru1.field_0 = 7;
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         if ( pVideoPlayer->pVideoFrame.pPixels )
           pVideoPlayer->bStopBeforeSchedule = 1;
@@ -7129,7 +7132,7 @@
         if ( pAsyncMouse == (void *)v28 )
         {
           UI_OnMouseLeftClick(0);
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         goto _def_wnd_proc;
       case WM_RBUTTONDBLCLK:
@@ -7151,14 +7154,14 @@
           if (!pAsyncMouse)
           {
             sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0);
-            return DefWindowProcA(hWnd, Msg, wParam, v4);
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
           }
           goto _def_wnd_proc;
         }
         if (pAsyncMouse)
           goto _def_wnd_proc;
         pArcomageGame->stru1.field_0 = 8;
-        return DefWindowProcA(hWnd, Msg, wParam, v4);
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
       case WM_MBUTTONDOWN:
         if ( pRenderer->pRenderD3D )
         {
@@ -7166,14 +7169,14 @@
           {
             v34 = GetPickDepth();
             pGame->PickMouse(v34, (unsigned __int16)lParam, lParam >> 16, 1, &vis_sprite_filter_3, &vis_face_filter);
-            return DefWindowProcA(hWnd, Msg, wParam, v4);
+            return DefWindowProcA(hWnd, Msg, wParam, lParam);
           }
           goto _def_wnd_proc;
         }
         if ( !pGame )
           goto _def_wnd_proc;
         sub_417871(0);
-        return DefWindowProcA(hWnd, Msg, wParam, v4);
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
       case WM_MOUSEMOVE:
         if ( pArcomageGame->bGameInProgress )
         {
@@ -7195,7 +7198,7 @@
             goto _def_wnd_proc;
           pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16);
         }
-        return DefWindowProcA(hWnd, Msg, wParam, v4);
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
     }
   }
   if ( Msg == WM_SYSCOMMAND )
@@ -7213,7 +7216,7 @@
         if (pVideoPlayer->AnyMovieLoaded() && pVideoPlayer->pBinkBuffer)
         {
           BinkBufferSetOffset(pVideoPlayer->pBinkBuffer, 0, 0);
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
       }
       goto _def_wnd_proc;
@@ -7225,16 +7228,7 @@
         if ( wParam == VK_CONTROL )
         {
           dword_507B98_ctrl_pressed = 0;
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
-        }
-        goto _def_wnd_proc;
-      }
-      if ( Msg == WM_CHAR )
-      {
-        if ( !pKeyActionMap->_459F10(wParam) && !viewparams->field_4C )
-        {
-          GUI_HandleHotkey(wParam);
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
         }
         goto _def_wnd_proc;
       }
@@ -7255,7 +7249,7 @@
           return 0;
         }
         if ( wParam != 40001 )
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
       }
       v38 = 0;
       v37 = 0;
@@ -7268,7 +7262,7 @@
     if ( dword_506E68 != -1 )
     {
       pKeyActionMap->_459F10(wParam);
-      return DefWindowProcA(hWnd, Msg, wParam, v4);
+      return DefWindowProcA(hWnd, Msg, wParam, lParam);
     }
     if ( !pArcomageGame->bGameInProgress )
     {
@@ -7598,12 +7592,11 @@
       if (pAsyncMouse)
       {
         pAsyncMouse->Suspend();
-        return DefWindowProcA(hWnd, Msg, wParam, v4);
+        return DefWindowProcA(hWnd, Msg, wParam, lParam);
       }
     }
 _def_wnd_proc:
-    v4 = lParam;
-    return DefWindowProcA(hWnd, Msg, wParam, v4);
+    return DefWindowProcA(hWnd, Msg, wParam, lParam);
   }
   if ( Msg != WM_KILLFOCUS )
   {
@@ -7631,12 +7624,12 @@
     goto _def_wnd_proc;
   }
   if ( ::hWnd != (HWND)wParam || (dword_4E98BC_bApplicationActive = 1, pRenderer->bWindowMode) || !pAsyncMouse )
-    return DefWindowProcA(hWnd, Msg, wParam, v4);
+    return DefWindowProcA(hWnd, Msg, wParam, lParam);
   pAsyncMouse->Resume();
   if ( !pAsyncMouse )
     goto _def_wnd_proc;
   pAsyncMouse->Clip();
-  return DefWindowProcA(hWnd, Msg, wParam, v4);
+  return DefWindowProcA(hWnd, Msg, wParam, lParam);
 }
 
 //----- (00464479) --------------------------------------------------------
@@ -7777,7 +7770,7 @@
     bUnderwater = 1;
     pGame->uFlags2 |= 8u;
   }
-  pParty->field_6F4_packedid = 0;
+  pParty->floor_face_pid = 0;
   if ( _strcmpi(Str1, "blv") )
     PrepareToLoadODM(v9, 0);
   else
@@ -10991,9 +10984,9 @@
         {
           if ( stru_50C198.GetMagicalResistance(v2, 0xAu) )
           {
-			  v2->pActorBuffs[v1->field_48].Apply(
-              pParty->uTimePlayed + (signed int)(signed __int64)((double)(v1->field_4C << 7) * 0.033333335),
-              v1->field_50,
+			  v2->pActorBuffs[v1->spell_id].Apply(
+              pParty->uTimePlayed + (signed int)(signed __int64)((double)(v1->spell_level << 7) * 0.033333335),
+              v1->spell_skill,
               4u,
               0,
               0);
@@ -11170,12 +11163,12 @@
   v151 = a2 & 7;
   if ( (a2 & 7) == OBJECT_Actor)
   {
-    if ( (v2->field_58_pid & 7) == OBJECT_Actor && !pActors[v2->field_58_pid >> 3].GetActorsRelation(&pActors[a2 >> 3]) )
+    if ( (v2->spell_caster_pid & 7) == OBJECT_Actor && !pActors[v2->spell_caster_pid >> 3].GetActorsRelation(&pActors[a2 >> 3]) )
       return 1;
   }
   else
   {
-    if ( (a2 & 7) == OBJECT_Player && (v2->field_58_pid & 7) == OBJECT_Player)
+    if ( (a2 & 7) == OBJECT_Player && (v2->spell_caster_pid & 7) == OBJECT_Player)
       return 1;
   }
   if ( pParty->bTurnBasedModeOn == 1 )
@@ -11187,8 +11180,8 @@
       v2->uAttributes = v5 & 0xFFFB;
     }
   }
-  if ( v151 == OBJECT_BModel && (v2->field_58_pid & 7) != OBJECT_Player)
-    BYTE2(pActors[v2->field_58_pid >> 3].uAttributes) |= 4u;
+  if ( v151 == OBJECT_BModel && (v2->spell_caster_pid & 7) != OBJECT_Player)
+    BYTE2(pActors[v2->spell_caster_pid >> 3].uAttributes) |= 4u;
   v6 = v2->uType;
   v7 = v2->uType;
   if ( v7 > 3060 )
@@ -11246,7 +11239,7 @@
         v138 = 1;
         if ( v151 != OBJECT_Actor)
         {
-          if ( v6 != 9030 || v2->field_50 != 4 )
+          if ( v6 != 9030 || v2->spell_skill != 4 )
             goto LABEL_246;
           v2->_46BEF1_apply_spells();
 LABEL_233:
@@ -11303,9 +11296,9 @@
         v106 = v145;
         v150 = 0;
         v139 = v106 >> 3;
-        v137 = v2->field_4C;
-        v152 = v2->field_50;
-        v136 = v2->field_48;
+        v137 = v2->spell_level;
+        v152 = v2->spell_skill;
+        v136 = v2->spell_id;
         if ( v6 == 9030 )
         {
           v150 = 2;
@@ -11359,9 +11352,9 @@
               {
                 v2->_46BEF1_apply_spells();
               }
-              v2->field_4C = 0;
-              v2->field_50 = 0;
-              v2->field_48 = 0;
+              v2->spell_level = 0;
+              v2->spell_skill = 0;
+              v2->spell_id = 0;
               goto LABEL_233;
             }
             v135 = 10;
@@ -11469,7 +11462,7 @@
             v127 = v9;
             v126 = v124;
 LABEL_268:
-            v116 = word_4EE088_sound_ids[v2->field_48];
+            v116 = word_4EE088_sound_ids[v2->spell_id];
 LABEL_269:
             v125 = v116 + 1;
             goto LABEL_29;
@@ -11502,7 +11495,7 @@
           if ( !v63 )
             SpriteObject::OnInteraction(v153);
           v64 = v2->uFacing - stru_5C6E00->uIntegerDoublePi;
-          v44 = v2->field_50 == 4;
+          v44 = v2->spell_skill == 4;
           v2->vVelocity.z = 0;
           v2->vVelocity.y = 0;
           v2->vVelocity.x = 0;