changeset 2015:9dbc142fc8f7

Слияние
author Ritor1
date Mon, 11 Nov 2013 09:17:08 +0600
parents f39f27b08908 (diff) 7a2fc95f3b99 (current diff)
children f1fd2ed4e9ba
files
diffstat 9 files changed, 110 insertions(+), 142 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Thu Nov 07 09:19:10 2013 +0600
+++ b/AudioPlayer.cpp	Mon Nov 11 09:17:08 2013 +0600
@@ -1677,9 +1677,9 @@
         //v46 = abs(v44->vPosition.y - pParty->vPosition.y);
         //v47 = abs(v44->vPosition.x - pParty->vPosition.x);
     LevelDecoration* decor = &pLevelDecorations[_6807B8_level_decorations_ids[i]];
-    if (int_get_vector_length(decor->vPosition.x - pParty->vPosition.x,
-                              decor->vPosition.y - pParty->vPosition.y,
-                              decor->vPosition.z - pParty->vPosition.z) > 8192)
+    if (int_get_vector_length(abs(decor->vPosition.x - pParty->vPosition.x),
+                              abs(decor->vPosition.y - pParty->vPosition.y),
+                              abs(decor->vPosition.z - pParty->vPosition.z)) > 8192)
       continue;
 
     DecorationDesc* decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID];
Binary file Build/Visual Studio 2012/World of Might and Magic.v11.suo has changed
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj	Thu Nov 07 09:19:10 2013 +0600
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj	Mon Nov 11 09:17:08 2013 +0600
@@ -165,6 +165,7 @@
     <ClCompile Include="..\..\mm7_4.cpp" />
     <ClCompile Include="..\..\mm7_5.cpp" />
     <ClCompile Include="..\..\mm7_6.cpp" />
+    <ClCompile Include="..\..\mm7_7.cpp" />
     <ClCompile Include="..\..\mm7_data.cpp" />
     <ClCompile Include="..\..\Monsters.cpp" />
     <ClCompile Include="..\..\Mouse.cpp" />
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters	Thu Nov 07 09:19:10 2013 +0600
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters	Mon Nov 11 09:17:08 2013 +0600
@@ -298,6 +298,7 @@
     <ClCompile Include="..\..\Viewport.cpp" />
     <ClCompile Include="..\..\Vis.cpp" />
     <ClCompile Include="..\..\Weather.cpp" />
+    <ClCompile Include="..\..\mm7_7.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\..\Level\Decoration.h">
--- a/Chest.cpp	Thu Nov 07 09:19:10 2013 +0600
+++ b/Chest.cpp	Mon Nov 11 09:17:08 2013 +0600
@@ -199,17 +199,17 @@
 //----- (0042038D) --------------------------------------------------------
 void  ChestUI_WritePointedObjectStatusString()
 {
-  POINT *v0; // esi@2
+  //POINT *v0; // esi@2
   int v1; // ecx@2
-  const char *v2; // eax@3
-  POINT v3; // [sp+0h] [bp-10h]@2
-  POINT a2; // [sp+8h] [bp-8h]@1
+  //const char *v2; // eax@3
+  //POINT v3; // [sp+0h] [bp-10h]@2
+  POINT cursor; // [sp+8h] [bp-8h]@1
 
   __debugbreak(); // invalid indexing
-  if ( pMouse->GetCursorPos(&a2)->y < 350 )
+  pMouse->GetCursorPos(&cursor);
+  if ( cursor.y < 350 )
   {
-    v0 = pMouse->GetCursorPos(&a2);
-    v1 = pRenderer->pActiveZBuffer[v0->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v3)->y]];
+    v1 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]];
     if ( v1 )
     {
       ItemGen* _w = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C
@@ -218,8 +218,8 @@
 
       _w = (ItemGen *)(&pChests[(unsigned int)pChestWindow->ptr_1C] -32 
 		  + 18 * *((short *)&pChests[(unsigned int)pChestWindow->ptr_1C].igChestItems[139].uExpireTime + v1 + 3));
-      v2 = _w->GetDisplayName();
-      GameUI_SetFooterString(v2);
+      //v2 = _w->GetDisplayName();
+      GameUI_SetFooterString(_w->GetDisplayName());
     }
   }
 }
--- a/UI/UiGame.cpp	Thu Nov 07 09:19:10 2013 +0600
+++ b/UI/UiGame.cpp	Mon Nov 11 09:17:08 2013 +0600
@@ -1222,8 +1222,18 @@
         uLastPointedObjectID = pMouse->uPointingObjectID;
         return;
       }
-      v28 = pTmpBuf.data();
       sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], pSpriteObjects[v19].stru_24.GetDisplayName());// "Get %s"
+      GameUI_SetFooterString(pTmpBuf.data());
+      if ( pMouse->uPointingObjectID == 0 )
+      {
+        if ( uLastPointedObjectID != 0 )
+        {
+          pFooterString[0] = 0;
+          bForceDrawFooter = 1;
+        }
+      }
+      uLastPointedObjectID = pMouse->uPointingObjectID;
+      return;
     }
 //For Decorations----------------------------------
     if (PID_TYPE(v18) == OBJECT_Decoration)
@@ -1377,86 +1387,62 @@
     uLastPointedObjectID = pMouse->uPointingObjectID;
     return;
   }
-  v1 = uNumVisibleWindows;
-  if ( uNumVisibleWindows > 0 )
+
+  for ( v1 = uNumVisibleWindows; v1 > 0; --v1 ) // some other fullscreen ui
   {
-	  while ( 1 )                                   // some other fullscreen ui
-	  {
-		pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1];
-		if ( (signed int)pX >= (signed int)pWindow->uFrameX
-		  && (signed int)pX <= (signed int)pWindow->uFrameZ
-		  && (signed int)pY >= (signed int)pWindow->uFrameY
-		  && (signed int)pY <= (signed int)pWindow->uFrameW )
-		{
-		  for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext )
-		  {
-			if ( !pButton )
-			  break;
-			if ( pButton->uButtonType == 1 )
-			{
-			  if ( (signed int)pX >= (signed int)pButton->uX
-				&& (signed int)pX <= (signed int)pButton->uZ
-				&& (signed int)pY >= (signed int)pButton->uY
-				&& (signed int)pY <= (signed int)pButton->uW )
-			  {
-				pMessageType1 = (UIMessageType)pButton->field_1C;
-				if ( pMessageType1 )
-				{
-				  pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
-				}
-				GameUI_SetFooterString(pButton->pButtonName);
-				uLastPointedObjectID = 1;
-				return;
-			  }
-			}
-			else
-			{
-			  if ( pButton->uButtonType == 2 )
-			  {
-				v45 = pX - pButton->uX;
-				v45 = pY - pButton->uY;
-				if ( (double)(signed int)pButton->uWidth != 0.0 )
-				{
-				  if ( (double)(signed int)pButton->uHeight != 0.0 )
-				  {
-					  pMessageType1 = (UIMessageType)pButton->field_1C;
-					  if ( pMessageType1 )
-					  {
-						pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
-					  }
-					  GameUI_SetFooterString(pButton->pButtonName);
-					  uLastPointedObjectID = 1;
-					  return;
-					//}
-				  }
-				}
-			  }
-			  else                                  // click on skill
-			  {
-              if ( pButton->uButtonType == 3 && pX >= pButton->uX && pX <= pButton->uZ && pY >= pButton->uY && pY <= pButton->uW )
-              {
-                v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1;
-                if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 )
-                  sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here"
-                else
-                  sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points"
-                GameUI_SetFooterString(Str1);
-                uLastPointedObjectID = 1;
-                return;
-				}
-			  }
-			}
-		  }
-		}
-		if ( pWindow->uFrameHeight == 480 )
-		  break;
-		--v1;
-		if ( v1 <= 0 )
-		{
-		  break;
-		}
-	  }
+    pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1];
+    if ( (signed int)pX >= (signed int)pWindow->uFrameX && (signed int)pX <= (signed int)pWindow->uFrameZ
+      && (signed int)pY >= (signed int)pWindow->uFrameY && (signed int)pY <= (signed int)pWindow->uFrameW )
+    {
+      for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext )
+      {
+        if ( !pButton )
+          break;
+        switch ( pButton->uButtonType )
+        {
+          case 1://for dialogue window
+            if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ
+              && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW )
+            {
+              pMessageType1 = (UIMessageType)pButton->field_1C;
+              if ( pMessageType1 )
+                pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
+              GameUI_SetFooterString(pButton->pButtonName);
+              uLastPointedObjectID = 1;
+              return;
+            }
+            break;
+          case 2:
+            if ( pX >= pButton->uX && pX <= pButton->uZ
+              && pY >= pButton->uY && pY <= pButton->uW )
+            {
+              pMessageType1 = (UIMessageType)pButton->field_1C;
+              if ( pMessageType1 )
+                pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
+              GameUI_SetFooterString(pButton->pButtonName);
+              uLastPointedObjectID = 1;
+              return;
+            }
+            break;
+           case 3:// click on skill
+             if ( pX >= pButton->uX && pX <= pButton->uZ
+               && pY >= pButton->uY && pY <= pButton->uW )
+             {
+               v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1;
+               if ( pPlayers[uActiveCharacter]->uSkillPoints < v7 )
+                 sprintf(Str1, pGlobalTXT_LocalizationStrings[469], v7 - pPlayers[uActiveCharacter]->uSkillPoints);// "You need %d more Skill Points to advance here"
+               else
+                 sprintf(Str1, pGlobalTXT_LocalizationStrings[468], v7);// "Clicking here will spend %d Skill Points"
+               GameUI_SetFooterString(Str1);
+               uLastPointedObjectID = 1;
+               return;
+             }
+             break;
+        }
+      }
+    }
   }
+
   if ( uNumVisibleWindows <= 0 || (uNumVisibleWindows > 0 && pWindow->uFrameHeight != 480 && v1 <= 0))
   {
     if ( pCurrentScreen == SCREEN_CHEST )
@@ -1535,64 +1521,45 @@
       return;
     }
 _click_on_game_ui:
-    if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX
-      && (signed int)pX <= (signed int)pWindowList[0].uFrameZ
-      && (signed int)pY >= (signed int)pWindowList[0].uFrameY
-      && (signed int)pY <= (signed int)pWindowList[0].uFrameW )
+    if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX && (signed int)pX <= (signed int)pWindowList[0].uFrameZ
+      && (signed int)pY >= (signed int)pWindowList[0].uFrameY && (signed int)pY <= (signed int)pWindowList[0].uFrameW )
     {
-      for ( pButton = pWindowList[0].pControlsHead; pButton != (GUIButton *)0; pButton = pButton->pNext )
+      for ( pButton = pWindowList[0].pControlsHead; ; pButton = pButton->pNext )
       {
-        if ( pButton->uButtonType == 1 )
+        if ( !pButton )
+          break;
+        switch ( pButton->uButtonType )
         {
-          if ( (signed int)pX >= (signed int)pButton->uX
-            && (signed int)pX <= (signed int)pButton->uZ
-            && (signed int)pY >= (signed int)pButton->uY
-            && (signed int)pY <= (signed int)pButton->uW )
-          {
-            pMessageType3 = (UIMessageType)pButton->field_1C;
-            if ( pMessageType3 == 0 ) // For books
+          case 1:
+            if ( (signed int)pX >= (signed int)pButton->uX && (signed int)pX <= (signed int)pButton->uZ
+              && (signed int)pY >= (signed int)pButton->uY && (signed int)pY <= (signed int)pButton->uW )
             {
-              GameUI_SetFooterString(pButton->pButtonName);
+              pMessageType3 = (UIMessageType)pButton->field_1C;
+              if ( pMessageType3 == 0 ) // For books
+              {
+                GameUI_SetFooterString(pButton->pButtonName);
+                uLastPointedObjectID = 1;
+                return;
+              }
+              pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0);
               uLastPointedObjectID = 1;
               return;
             }
-
-            pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0);
-            uLastPointedObjectID = 1;
-            return;
-          }
-        }
-        else
-        {
-          if ( pButton->uButtonType == 2 )
-          {
-            v45 = pX - pButton->uX;
-            v45 = pY - pButton->uY;
-
+            break;
+          case 2:
             if (pX >= pButton->uX && pX <= pButton->uZ &&
                 pY >= pButton->uY && pY <= pButton->uW)
-            if ( (double)(signed int)pButton->uWidth != 0.0 )
             {
-              if ( (double)(signed int)pButton->uHeight != 0.0 )
-              {
-                 //UNDEF(v32);
-                //if ( v33 | v34 )
-                //{
-                  pMessageType2 = (UIMessageType)pButton->field_1C;
-                  if ( pMessageType2 != 0 )
-                      pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0);
-
-                  GameUI_SetFooterString(pButton->pButtonName);
-                  uLastPointedObjectID = 1;
-                  return;
-                //}
-              }
+              pMessageType2 = (UIMessageType)pButton->field_1C;
+              if ( pMessageType2 != 0 )
+                pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0);
+              GameUI_SetFooterString(pButton->pButtonName); // for character name
+              uLastPointedObjectID = 1;
+              return;
             }
-          }
-          else
-          {
-            if ( pButton->uButtonType == 3
-              && pX >= pButton->uX && pX <= pButton->uZ
+            break;
+          case 3:
+            if ( pX >= pButton->uX && pX <= pButton->uZ
               && pY >= pButton->uY && pY <= pButton->uW )
             {
               v7 = (LOBYTE(pPlayers[uActiveCharacter]->pActiveSkills[pButton->msg_param]) & 0x3F) + 1;
@@ -1604,7 +1571,7 @@
               uLastPointedObjectID = 1;
               return;
             }
-          }
+            break;
         }
       }
     }
--- a/mm7_2.cpp	Thu Nov 07 09:19:10 2013 +0600
+++ b/mm7_2.cpp	Mon Nov 11 09:17:08 2013 +0600
@@ -3997,7 +3997,7 @@
     //window->SetWindowedMode(game_width, game_height);
     pRenderer->SwitchToWindow();
   }
-
+  sub_4C023F();
   uSoundVolumeMultiplier = ReadWindowsRegistryInt("soundflag", 9);
   if (uSoundVolumeMultiplier > 9)
     uSoundVolumeMultiplier = 9;
--- a/mm7_7.cpp	Thu Nov 07 09:19:10 2013 +0600
+++ b/mm7_7.cpp	Mon Nov 11 09:17:08 2013 +0600
@@ -102,7 +102,6 @@
 	sub_401022();
 	sub_423B4A();
 	crt_init_globals_46BD9F();
-	sub_4C023F();
 
 	//no call to these anywhere
 	uGameUIFontMain_initialize();
--- a/mm7_data.h	Thu Nov 07 09:19:10 2013 +0600
+++ b/mm7_data.h	Mon Nov 11 09:17:08 2013 +0600
@@ -1343,7 +1343,7 @@
     *p++ = value;
 }
 //inline void __fastcall j_memset32(int a2, void *a1, unsigned int a3) {memset32(a1, a2, a3);}
-
+void __cdecl sub_4C023F();
 #define ErrD3D(hr) do {extern void ErrHR(HRESULT, const char *, const char *, const char *, int); ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__);} while(0)