diff mm7_1.cpp @ 989:bb37d33934b0

Слияние
author Ritor1
date Mon, 13 May 2013 09:39:58 +0600
parents 9e132060ada3
children 087a9af8e0ec
line wrap: on
line diff
--- a/mm7_1.cpp	Mon May 13 09:39:49 2013 +0600
+++ b/mm7_1.cpp	Mon May 13 09:39:58 2013 +0600
@@ -99,273 +99,266 @@
         j->uY = dword_506988;
         j->uZ = dword_506984;
         j->uW = dword_506980;
-        pGUIWindow_CurrentMenu->_41D08F(1, 0, 0, 0);
+        pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0);
       }
     }
   }
 }
 
 //----- (0041CD4F) --------------------------------------------------------
-bool __thiscall sub_41CD4F(unsigned int _this)
+bool UI_OnKeyDown(unsigned int vkKey)
 {
-  unsigned int v1; // edi@1
-  unsigned int v2; // eax@2
+  //unsigned int v1; // edi@1
+  //unsigned int v2; // eax@2
   int v3; // esi@3
   int v4; // ecx@10
-  GUIButton *v5; // eax@11
+  GUIButton *pButton; // eax@11
   int v6; // edx@12
   int v7; // ecx@20
   char v8; // zf@21
-  GUIButton *v9; // ecx@24
+  //GUIButton *v9; // ecx@24
   int v10; // esi@24
   //int v11; // edx@26
   int v12; // edx@28
   int v13; // esi@32
-  GUIButton *v14; // eax@37
+  //GUIButton *v14; // eax@37
   int v15; // edx@38
   int v17; // ecx@50
   int v18; // edx@50
-  GUIButton *v19; // ecx@54
+  //GUIButton *v19; // ecx@54
   int v20; // esi@54
   //int v21; // edx@56
   int v22; // ecx@59
   int v23; // edx@59
   int v24; // ecx@60
   int v25; // esi@63
-  unsigned int v26; // [sp+Ch] [bp-14h]@1
-  int v27; // [sp+10h] [bp-10h]@1
+  //unsigned int v26; // [sp+Ch] [bp-14h]@1
+  //int v27; // [sp+10h] [bp-10h]@1
   int v28; // [sp+14h] [bp-Ch]@10
   int v29; // [sp+14h] [bp-Ch]@36
   unsigned int uClickX; // [sp+18h] [bp-8h]@10
   unsigned int uClickY; // [sp+1Ch] [bp-4h]@10
 
-  v1 = 0;
-  v26 = _this;
-  v27 = uNumVisibleWindows;
+  //v1 = 0;
+  //v27 = uNumVisibleWindows;
   if ( uNumVisibleWindows < 0 )
-    return 0;
-  v2 = pMessageQueue_50CBD0->uNumMessages;
-  while ( 1 )
+    return false;
+  //v2 = pMessageQueue_50CBD0->uNumMessages;
+  for (int i = uNumVisibleWindows; i >= 0; --i)
+  //while ( 1 )
   {
-    v3 = pVisibleWindowsIdxs[v27] - 1;
-    if ( pWindowList[v3].field_44 != v1 )
-	{
-		switch(v26)
-		{
-			case VK_LEFT:
-				{
-				v12 = pWindowList[v3].field_34;
-				if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 )
-				{
-				  v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
-				  pWindowList[v3].pCurrentPosActiveItem -= v12;
-				  if ( v8 )
-				  {
-					pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1);
-					v2 = pMessageQueue_50CBD0->uNumMessages;
-				  }
-				}
-				if ( pWindowList[v3].field_30 != v1 )
-				{
-					break;
-				}
-				v9 = pWindowList[v3].pControlsHead;
-				v13 = pWindowList[v3].pCurrentPosActiveItem;
-				if ( v13 > (signed int)v1 )
-				{
-				  do
-				  {
-					v9 = v9->pNext;
-					--v13;
-				  }
-				  while ( v13 );
-				}
+    v3 = pVisibleWindowsIdxs[i] - 1;
+    if (!pWindowList[v3].receives_keyboard_input)
+      continue;
 
-                pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, v1);
-				break;
-				}
-			case VK_RIGHT:
-				{
-				v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34;
-				if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem )
-				{
-					v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
-					pWindowList[v3].pCurrentPosActiveItem = v7;
-					if ( v8 )
-					{
-						pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1);
-						v2 = pMessageQueue_50CBD0->uNumMessages;
-					}
-				}
-				if ( pWindowList[v3].field_30 != v1 )
-				{
-					break;
-				}
-				v9 = pWindowList[v3].pControlsHead;
-				v10 = pWindowList[v3].pCurrentPosActiveItem;
-				if ( v10 > (signed int)v1 )
-				{
-					do
-					{
-						v9 = v9->pNext;
-						--v10;
-					}
-					while ( v10 );
-				}
-				pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, v1);
-				break;				
-				}
-			case VK_DOWN:
-				{
-				v17 = pWindowList[v3].pStartingPosActiveItem;
-				v18 = pWindowList[v3].pCurrentPosActiveItem;
-				if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 )
-					pWindowList[v3].pCurrentPosActiveItem = v17;
-				else
-					pWindowList[v3].pCurrentPosActiveItem = v18 + 1;
-				if ( pWindowList[v3].field_30 != v1 )
-					return 1;
-				v19 = pWindowList[v3].pControlsHead;
-				v20 = pWindowList[v3].pCurrentPosActiveItem;
-				if ( v20 > (signed int)v1 )
-				{
-					do
-					{
-						v19 = v19->pNext;
-						--v20;
-					}
-					while ( v20 );
-				}
-				pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, v1);
-				return 1;
-				}
-			case VK_SELECT:
-				{
-				pMouse->GetClickPos(&uClickX, &uClickY);
-				v4 = pWindowList[v3].pStartingPosActiveItem;
-				v28 = v4 + pWindowList[v3].pNumPresenceButton;
-				if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
-				{
-					while ( 1 )
-					{
-						v5 = pWindowList[v3].pControlsHead;
-						if ( v4 > 0 )
-						{
-							v6 = v4;
-							do
-							{
-								v5 = v5->pNext;
-								--v6;
-							}
-							while ( v6 );
-						}
-						if ( (signed int)uClickX >= (signed int)v5->uX
-						&& (signed int)uClickX <= (signed int)v5->uZ
-						&& (signed int)uClickY >= (signed int)v5->uY
-						&& (signed int)uClickY <= (signed int)v5->uW )
-							break;
-						++v4;
-						if ( v4 >= v28 )
-						{
-							v1 = 0;
-							v2 = pMessageQueue_50CBD0->uNumMessages;
-							--v27;
-							if ( v27 < 0 )
-  								return 0;
-							continue;
-						}
-					}
-					pWindowList[v3].pCurrentPosActiveItem = v4;
-					return 1;
-				}
-				v2 = pMessageQueue_50CBD0->uNumMessages;
-				break;
-				}
-			case VK_UP:
-				{
-				v22 = pWindowList[v3].pCurrentPosActiveItem;
-				v23 = pWindowList[v3].pStartingPosActiveItem;
-				if ( v22 <= v23 )
-					v24 = pWindowList[v3].pNumPresenceButton + v23 - 1;
-				else
-					v24 = v22 - 1;
-				v8 = pWindowList[v3].field_30 == v1;
-				pWindowList[v3].pCurrentPosActiveItem = v24;
-				if ( !v8 )
-					return 1;
-				v19 = pWindowList[v3].pControlsHead;
-				v25 = pWindowList[v3].pCurrentPosActiveItem;
-				if ( v25 > (signed int)v1 )
-				{
-					do
-					{
-						v19 = v19->pNext;
-						--v25;
-					}
-					while ( v25 );
-				}
-
-				pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, v1);
-				return 1;
-				}
-			case VK_NEXT:
-				{
-				if ( pWindowList[v3].field_30 != v1 )
-				{
-					pMouse->GetClickPos(&uClickX, &uClickY);
-					v4 = pWindowList[v3].pStartingPosActiveItem;
-					v29 = v4 + pWindowList[v3].pNumPresenceButton;
-					if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
-					{
-						while ( 1 )
-						{
-							v14 = pWindowList[v3].pControlsHead;
-							if ( v4 > 0 )
-							{
-								v15 = v4;
-								do
-								{
-									v14 = v14->pNext;
-									--v15;
-								}
-								while ( v15 );
-							}
-							if ( (signed int)uClickX >= (signed int)v14->uX
-							&& (signed int)uClickX <= (signed int)v14->uZ
-							&& (signed int)uClickY >= (signed int)v14->uY
-							&& (signed int)uClickY <= (signed int)v14->uW )
-							{
-								pWindowList[v3].pCurrentPosActiveItem = v4;
-								return 1;
-							}
-							++v4;
-							if ( v4 >= v29 )
-							{
-								v1 = 0;
-								v2 = pMessageQueue_50CBD0->uNumMessages;
-								break;
-							}
-						}
-					}
-					else
-					{
-						v2 = pMessageQueue_50CBD0->uNumMessages;
-					}
-				}
-				break;
-				}
-			default:
-				{
-				break;
-				}
-			
-		}
-	}
-    --v27;
-    if ( v27 < 0 )
-      return 0;
+    switch (vkKey)
+    {
+      case VK_LEFT:
+      {
+        v12 = pWindowList[v3].field_34;
+        if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 )
+        {
+          v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
+          pWindowList[v3].pCurrentPosActiveItem -= v12;
+          if ( v8 )
+          {
+            pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
+            //v2 = pMessageQueue_50CBD0->uNumMessages;
+          }
+        }
+        if ( pWindowList[v3].field_30 != 0 )
+        {
+          break;
+        }
+        pButton = pWindowList[v3].pControlsHead;
+        v13 = pWindowList[v3].pCurrentPosActiveItem;
+        if ( v13 > 0)
+        {
+          do
+          {
+            pButton = pButton->pNext;
+            --v13;
+          }
+          while ( v13 );
+        }
+        pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
+        break;
+      }
+      case VK_RIGHT:
+      {
+        v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34;
+        if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem )
+        {
+          v8 = pCurrentScreen == SCREEN_PARTY_CREATION;
+          pWindowList[v3].pCurrentPosActiveItem = v7;
+          if ( v8 )
+          {
+            pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0);
+            //v2 = pMessageQueue_50CBD0->uNumMessages;
+          }
+        }
+        if ( pWindowList[v3].field_30 != 0 )
+        {
+          break;
+        }
+        pButton = pWindowList[v3].pControlsHead;
+        v10 = pWindowList[v3].pCurrentPosActiveItem;
+        if ( v10 > 0)
+        {
+          do
+          {
+            pButton = pButton->pNext;
+            --v10;
+          }
+          while ( v10 );
+        }
+        pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
+        break;
+      }
+      case VK_DOWN:
+      {
+        v17 = pWindowList[v3].pStartingPosActiveItem;
+        v18 = pWindowList[v3].pCurrentPosActiveItem;
+        if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 )
+          pWindowList[v3].pCurrentPosActiveItem = v17;
+        else
+          pWindowList[v3].pCurrentPosActiveItem = v18 + 1;
+        if ( pWindowList[v3].field_30 != 0 )
+          return true;
+        pButton = pWindowList[v3].pControlsHead;
+        v20 = pWindowList[v3].pCurrentPosActiveItem;
+        if ( v20 > 0)
+        {
+          do
+          {
+            pButton = pButton->pNext;
+            --v20;
+          }
+          while ( v20 );
+        }
+        pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
+        return true;
+      }
+      case VK_SELECT:
+      {
+        pMouse->GetClickPos(&uClickX, &uClickY);
+        v4 = pWindowList[v3].pStartingPosActiveItem;
+        v28 = v4 + pWindowList[v3].pNumPresenceButton;
+        if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
+        {
+          while ( 1 )
+          {
+            pButton = pWindowList[v3].pControlsHead;
+            if ( v4 > 0 )
+            {
+              v6 = v4;
+              do
+              {
+                pButton = pButton->pNext;
+                --v6;
+              }
+              while ( v6 );
+            }
+            if ( (signed int)uClickX >= (signed int)pButton->uX//test for StatsTab in PlayerCreation Window
+               && (signed int)uClickX <= (signed int)pButton->uZ
+               && (signed int)uClickY >= (signed int)pButton->uY
+               && (signed int)uClickY <= (signed int)pButton->uW )
+              break;
+            ++v4;
+            if ( v4 >= v28 )
+            {
+              //v1 = 0;
+              //v2 = pMessageQueue_50CBD0->uNumMessages;
+              //--i;
+              //if ( i < 0 )
+                return false;
+              //continue;
+            }
+          }
+          pWindowList[v3].pCurrentPosActiveItem = v4;
+          return true;
+        }
+        //v2 = pMessageQueue_50CBD0->uNumMessages;
+        break;
+      }
+      case VK_UP:
+      {
+        v22 = pWindowList[v3].pCurrentPosActiveItem;
+        v23 = pWindowList[v3].pStartingPosActiveItem;
+        if ( v22 <= v23 )
+          v24 = pWindowList[v3].pNumPresenceButton + v23 - 1;
+        else
+          v24 = v22 - 1;
+        v8 = pWindowList[v3].field_30 == 0;
+        pWindowList[v3].pCurrentPosActiveItem = v24;
+        if ( !v8 )
+          return true;
+        pButton = pWindowList[v3].pControlsHead;
+        v25 = pWindowList[v3].pCurrentPosActiveItem;
+        if ( v25 > 0)
+        {
+          do
+          {
+            pButton = pButton->pNext;
+            --v25;
+          }
+          while ( v25 );
+        }
+        pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0);
+        return true;
+      }
+      case VK_NEXT:
+      {
+        if ( pWindowList[v3].field_30 != 0 )
+        {
+          pMouse->GetClickPos(&uClickX, &uClickY);
+          v4 = pWindowList[v3].pStartingPosActiveItem;
+          v29 = v4 + pWindowList[v3].pNumPresenceButton;
+          if ( v4 < v4 + pWindowList[v3].pNumPresenceButton )
+          {
+            while ( 1 )
+            {
+              pButton = pWindowList[v3].pControlsHead;
+              if ( v4 > 0 )
+              {
+                v15 = v4;
+                do
+                {
+                  pButton = pButton->pNext;
+                  --v15;
+                }
+                while ( v15 );
+              }
+              if ( (signed int)uClickX >= (signed int)pButton->uX
+                && (signed int)uClickX <= (signed int)pButton->uZ
+                && (signed int)uClickY >= (signed int)pButton->uY
+                && (signed int)uClickY <= (signed int)pButton->uW )
+              {
+                pWindowList[v3].pCurrentPosActiveItem = v4;
+                return true;
+              }
+              ++v4;
+              if ( v4 >= v29 )
+              {
+                //v1 = 0;
+                //v2 = pMessageQueue_50CBD0->uNumMessages;
+                break;
+              }
+            }
+          }
+          else
+          {
+            //v2 = pMessageQueue_50CBD0->uNumMessages;
+          }
+        }
+        break;
+      }
+      default:
+      {
+        break;
+      }
+    }
   }
-
 }
 
 //----- (0041D20D) --------------------------------------------------------
@@ -632,7 +625,7 @@
 }
 
 //----- (00420E01) --------------------------------------------------------
-void __cdecl sub_420E01()
+void __cdecl OnChestLeftClick()
 {
   int chest_id; // edi@1
   POINT *v1; // esi@2
@@ -857,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;
@@ -877,7 +870,7 @@
       uActiveCharacter = uPlayerID;
       return;
     }
-    if ( pCurrentScreen != SCREEN_F )
+    if ( pCurrentScreen != SCREEN_CHEST_INVENTORY )
     {
       viewparams->bRedrawGameUI = true;
       uActiveCharacter = uPlayerID;
@@ -890,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;
@@ -923,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
@@ -1327,6 +1320,9 @@
   unsigned __int16 v6; // [sp-4h] [bp-14h]@7
 
 
+  extern void set_default_ui_skin();
+  set_default_ui_skin();
+
     if (align == PartyAlignment_Evil)
     {
       if ( bReplace )
@@ -1364,7 +1360,7 @@
 
         pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-c", 2);
         pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-c", 2);
+        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-c", 2);
         pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
         pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2);
         pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2);
@@ -1404,7 +1400,7 @@
         uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE);
         uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE);
         uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE);
-        uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
+        uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
         pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC");
         pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
         pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC");
@@ -1449,7 +1445,7 @@
         pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
         pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-a", 2);
         pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2);
-        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven", 2);
+        pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven", 2);
         pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
         pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2);
         pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2);
@@ -1489,7 +1485,7 @@
         uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE);
         uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE);
         uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE);
-        uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
+        uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE);
         pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA");
         pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
         pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA");
@@ -1545,7 +1541,7 @@
       pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-b", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-b", 2);
+      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-b", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-b", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-b", 2);