diff mm7_2.cpp @ 832:dfd683c4f538

Hotkeys fixed Moved GUIButton.h to GUIWindow.h
author Nomad
date Wed, 27 Mar 2013 19:50:37 +0200
parents 9c3f28b31b4a
children b66abf8b7d50
line wrap: on
line diff
--- a/mm7_2.cpp	Wed Mar 27 15:04:59 2013 +0200
+++ b/mm7_2.cpp	Wed Mar 27 19:50:37 2013 +0200
@@ -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) --------------------------------------------------------
@@ -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;
@@ -6941,7 +6940,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 +6987,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 +7028,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 +7094,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 +7108,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 +7133,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 +7155,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 +7170,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 +7199,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 +7217,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 +7229,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 +7250,7 @@
           return 0;
         }
         if ( wParam != 40001 )
-          return DefWindowProcA(hWnd, Msg, wParam, v4);
+          return DefWindowProcA(hWnd, Msg, wParam, lParam);
       }
       v38 = 0;
       v37 = 0;
@@ -7268,7 +7263,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 +7593,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 +7625,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) --------------------------------------------------------