diff mm7_1.cpp @ 510:7c86030324a5

Слияние
author Ritor1
date Fri, 01 Mar 2013 18:38:12 +0600
parents 00ce82758c72 6fa3ff8ef729
children cb0ad52d6a26
line wrap: on
line diff
--- a/mm7_1.cpp	Fri Mar 01 18:37:54 2013 +0600
+++ b/mm7_1.cpp	Fri Mar 01 18:38:12 2013 +0600
@@ -694,7 +694,7 @@
     {
       v5 = pStru179.field_0[v21];
       v20 = 8 * pStru179.field_0[v21];
-      v6 = (char *)pAwards[v20/8-1].pText;//(char *)dword_723E80_award_related[v20 / 4];
+      v6 = (char *)pAwards[(v20-1)/8].pText;//(char *)dword_723E80_award_related[v20 / 4];
       if ( v5 != 1 )
         break;
       v17 = pParty->uFine;
@@ -2926,17 +2926,9 @@
       v116 = v106.uViewportZ;
     if ( v119 > (signed int)v106.uViewportW )
       v119 = v106.uViewportW;
-    pRenderer->FillRectFast(
-      v106.uViewportX,
-      v106.uViewportY,
-      v106.uViewportZ - v106.uViewportX,
-      v106.uViewportW - v106.uViewportY,
+    pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY,
       pRenderer->uTargetBMask | pRenderer->uTargetGMask);
-    pRenderer->FillRectFast(
-      v106.uViewportX,
-      v106.uViewportY,
-      v106.uViewportZ - v106.uViewportX,
-      v106.uViewportW - v106.uViewportY,
+    pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY,
       pRenderer->uTargetBMask | pRenderer->uTargetGMask);
     v84.left = v106.uViewportX;
     v84.top = v106.uViewportY;
@@ -3020,9 +3012,7 @@
 				{
 				  v110 = (LPVOID)((pDesc.lPitch >> 1) * pDesc.dwHeight * v111 / v13->uAreaHeight);
 				  v33 = v108[(int)((char *)v110 + pDesc.dwWidth * (v32 + v124) / v13->uAreaWidth)];
-				  v34 = v33 & 0x1F | 2
-								   * (unsigned __int16)(v108[(int)((char *)v110
-																	+ pDesc.dwWidth * (v32 + v124++) / v13->uAreaWidth)] & 0xFFE0);
+				  v34 = v33 & 0x1F | 2 * (unsigned __int16)(v108[(int)((char *)v110 + pDesc.dwWidth * (v32 + v124++) / v13->uAreaWidth)] & 0xFFE0);
 				  v35 = v124;
 				  *(short *)v30 = v34;
 				  v30 += 2;
@@ -3092,7 +3082,7 @@
 	  LOBYTE(v40) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID);
 	  v120 = v40;
 	  if ( !v40 )
-					v45 = 1;
+		v45 = 1;
 	  else
 	  {
 		  v41 = (unsigned __int8)v40 & 0x3F;
@@ -3105,7 +3095,7 @@
 			  v119 = 1;
 			}
 			else
-						v45 = 1;
+				v45 = 1;
 		  }
 		  else
 		  {
@@ -3369,22 +3359,11 @@
     a4 = &a4[LOBYTE(v56->uFontHeight) - 3];
     v57 = v121->pMonsterInfo.uAttack1DamageBonus;
     if ( v57 )
-      sprintf(
-        pTmpBuf,
-        "%s\f%05u\t080%dd%d+%d\n",
-        pGlobalTXT_LocalizationStrings[53],
-        0,
-        v121->pMonsterInfo.uAttack1DamageDiceRolls,
-        v121->pMonsterInfo.uAttack1DamageDiceSides,
-        v57);
+      sprintf(pTmpBuf, "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53],
+        0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides, v57);
     else
-      sprintf(
-        pTmpBuf,
-        "%s\f%05u\t080%dd%d\n",
-        pGlobalTXT_LocalizationStrings[53],
-        0,
-        v121->pMonsterInfo.uAttack1DamageDiceRolls,
-        v121->pMonsterInfo.uAttack1DamageDiceSides);
+      sprintf(pTmpBuf, "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53],
+        0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides);
   }
   else
   {
@@ -3505,13 +3484,7 @@
   {
     sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[650], v121->sCurrentHP);
     pFontSmallnum->GetLineWidth(pTmpBuf);
-    result = a1->DrawTitleText(
-               pFontSmallnum,
-               0,
-               a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12,
-               0,
-               pTmpBuf,
-               3u);
+    result = a1->DrawTitleText(pFontSmallnum, 0, a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf, 3);
   }
   return result;
 }
@@ -5102,88 +5075,90 @@
   int a4; // [sp+44h] [bp-4h]@2
 
   v0 = pPlayers[uActiveCharacter];
-  if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] != 103
-    || (pMouse->GetClickPos(&pX, &pY),
-        v1 = pY - 17,
-        v2 = pX - 14,
-        pY = v1,
-        pX = v2,
-        v3 = 14 * (v1 >> 5),
-        v2 >>= 5,
-        v4 = v2 + v3 < 0,
-        v5 = v2 + v3,
-        a4 = v5,
-        v4)
-    || v5 > 126
-    || pMouse->GetCursorPos(&a2)->x >= 462
-    || pMouse->GetCursorPos(&a2)->x < 14 )
-    return;
-  if ( unk_50C9A0 )
+  if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )
   {
-    v6 = v0->GetItemIDAtInventoryIndex(&a4);
-    if ( v6 )
+    pMouse->GetClickPos(&pX, &pY);
+    pY = pY - 17;
+    v2 =pX - 14;
+    pX = v2;
+    v3 = 14 * (pY >> 5);
+    v2 >>= 5;
+    v4 = v2 + v3 < 0;
+    v5 = v2 + v3;
+    a4 = v5;
+    if ( !v4 )
     {
-      *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu;
-      *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1;
-      *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1;
-      *((short *)pGUIWindow_Settings->ptr_1C + 3) = a4;
-      ptr_50C9A4 = (ItemGen *)&v0->pInventoryItems[v6-1];
-      unk_50C9A0 = 0;
-      if ( pMessageQueue_50CBD0->uNumMessages )
-        pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-      pMouse->SetCursorBitmap("MICON1");
-      dword_50C9D0 = 113;
-      dword_50C9D4 = 0;
-      dword_50C9D8 = 256;
-    }
-    return;
-  }
-  if ( ptr_50C9A4 )
-    return;
-  v7 = pParty->pPickedItem.uItemID;
-  v8 = v0->GetItemIDAtInventoryIndex(&a4);
-  if ( !v7 )
-  {
-    if ( !v8 )
-      return;
-    memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem));
-    v0->RemoveItemAtInventoryIndex(a4);
-    v9 = pParty->pPickedItem.uItemID;
-    goto LABEL_24;
-  }
-  v13 = v8;
-  if ( v8 )
-  {
-    a2.y = (LONG)&v0->pInventoryItems[v8-1];
-    memcpy(&this_, (const void *)a2.y, sizeof(this_));
-    v0->RemoveItemAtInventoryIndex(a4);
-    pX = v0->AddItem2(a4, &pParty->pPickedItem);
-    if ( !pX )
-    {
-      pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem);
-      if ( !pX )
+      if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462
+            && pMouse->GetCursorPos(&a2)->x >= 14 )
       {
-        v0->_49298B(&this_, v13 - 1, a4);
-        memcpy((void *)a2.y, &this_, sizeof(ItemGen));
-        return;
+        if ( unk_50C9A0 )
+        {
+          v6 = v0->GetItemIDAtInventoryIndex(&a4);
+          if ( v6 )
+          {
+            *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu;
+            *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1;
+            *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1;
+            *((short *)pGUIWindow_Settings->ptr_1C + 3) = a4;
+            ptr_50C9A4 = (ItemGen *)&v0->pInventoryItems[v6-1];
+            unk_50C9A0 = 0;
+            if ( pMessageQueue_50CBD0->uNumMessages )
+              pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+            pMouse->SetCursorBitmap("MICON1");
+            dword_50C9D0 = 113;
+            dword_50C9D4 = 0;
+            dword_50C9D8 = 256;
+          }
+          return;
+        }
+        if ( ptr_50C9A4 )
+          return;
+        v7 = pParty->pPickedItem.uItemID;
+        v8 = v0->GetItemIDAtInventoryIndex(&a4);
+        if ( !v7 )
+        {
+          if ( !v8 )
+            return;
+          memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem));
+          v0->RemoveItemAtInventoryIndex(a4);
+          v9 = pParty->pPickedItem.uItemID;
+          goto LABEL_24;
+        }
+        v13 = v8;
+        if ( v8 )
+        {
+          a2.y = (LONG)&v0->pInventoryItems[v8-1];
+          memcpy(&this_, (const void *)a2.y, sizeof(this_));
+          v0->RemoveItemAtInventoryIndex(a4);
+          pX = v0->AddItem2(a4, &pParty->pPickedItem);
+          if ( !pX )
+          {
+            pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem);
+            if ( !pX )
+            {
+              v0->_49298B(&this_, v13 - 1, a4);
+              memcpy((void *)a2.y, &this_, sizeof(ItemGen));
+              return;
+            }
+          }
+          v9 = this_.uItemID;
+          memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem));
+LABEL_24:
+          pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName);
+          return;
+        }
+        v10 = v0->AddItem(a4, v7);
+        pX = v10;
+        if ( v10 || (v10 = v0->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID), (pX = v10) != 0) )
+        {
+          memcpy(&v0->pInventoryItems[v10-1], &pParty->pPickedItem, 0x24u);
+          pMouse->RemoveHoldingItem();
+        }
       }
     }
-    v9 = this_.uItemID;
-    memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem));
-LABEL_24:
-    pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName);
-    return;
-  }
-  v10 = v0->AddItem(a4, v7);
-  pX = v10;
-  if ( v10 || (v10 = v0->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID), (pX = v10) != 0) )
-  {
-    memcpy(&v0->pInventoryItems[v10-1], &pParty->pPickedItem, 0x24u);
-    pMouse->RemoveHoldingItem();
   }
 }
 
-
 //----- (0042213C) --------------------------------------------------------
 void __cdecl OnGameViewportClick()
 {
@@ -5940,10 +5915,7 @@
           LODWORD(v14) = v13 << 16;
           HIDWORD(v14) = v13 >> 16;
           v15 = &_50B744_view_transformed_ys[i - 1];
-          dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i] - _50B834_view_transformed_zs[i - 1])
-                                                * v14
-                                                / v12) >> 16)
-                            + _50B834_view_transformed_zs[i - 1];
+          dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i] - _50B834_view_transformed_zs[i - 1]) * v14 / v12) >> 16) + _50B834_view_transformed_zs[i - 1];
           thisb = (unsigned __int64)((_50B744_view_transformed_ys[i] - _50B744_view_transformed_ys[i - 1]) * v14 / v12) >> 16;
         }
         else
@@ -6028,8 +6000,7 @@
       }
     }
     dword_50BA08[v22] = v32;
-    dword_50BAF4_xs[v22 + 1] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40)
-                                                * (signed __int64)dword_50BAF4_xs[v22 + 1]) >> 16;
+    dword_50BAF4_xs[v22 + 1] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BAF4_xs[v22 + 1]) >> 16;
     v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BA08[v22]) >> 16;
     dword_50BAF4_xs[v22 + 1] = pBLVRenderParams->uViewportCenterX - dword_50BAF4_xs[v22 + 1];
     ++ia;
@@ -6053,16 +6024,12 @@
     {
       if ( v41 >= (signed int)v37 )
       {
-        v67 = (signed int)(v37 - dword_50BAF4_xs[v40])
-            * (signed __int64)(dword_50BA08[v40] - dword_50B9F8[v40 + 3])
-            / (v41 - dword_50BAF4_xs[v40]);
+        v67 = (signed int)(v37 - dword_50BAF4_xs[v40]) * (signed __int64)(dword_50BA08[v40] - dword_50B9F8[v40 + 3]) / (v41 - dword_50BAF4_xs[v40]);
         v42 = dword_50B9F8[v40 + 3];
       }
       else
       {
-        v67 = (signed int)(v37 - v41)
-            * (signed __int64)(dword_50B9F8[v40 + 3] - dword_50BA08[v40])
-            / (dword_50BAF4_xs[v40] - v41);
+        v67 = (signed int)(v37 - v41) * (signed __int64)(dword_50B9F8[v40 + 3] - dword_50BA08[v40]) / (dword_50BAF4_xs[v40] - v41);
         v42 = dword_50BA08[v40];
       }
       ++v36;
@@ -6080,16 +6047,16 @@
   }
   while ( ib <= v79 );
 
-  if ( !v36
-    || (v43 = 0,
-        dword_50BAE8_xs[v36 + 1] = dword_50BAE8_xs[1],
-        dword_50B9F8[v36 + 1] = dword_50B9F8[1],
-        v44 = pBLVRenderParams->uViewportZ,
-        thisd = dword_50BAE8_xs[1] <= (signed int)pBLVRenderParams->uViewportZ,
-        ic = 1,
-        v36 < 1) )
+  if (v36 < 1)
     return 0;
 
+  v43 = 0;
+  dword_50BAE8_xs[v36 + 1] = dword_50BAE8_xs[1];
+  dword_50B9F8[v36 + 1] = dword_50B9F8[1];
+  v44 = pBLVRenderParams->uViewportZ;
+  thisd = dword_50BAE8_xs[1] <= (signed int)pBLVRenderParams->uViewportZ;
+  ic = 1;
+
   do
   {
     v45 = ic;
@@ -6099,16 +6066,12 @@
     {
       if ( v46 <= (signed int)v44 )
       {
-        v68 = (signed int)(v44 - dword_50BAE8_xs[v45])
-            * (signed __int64)(dword_50B9F8[v45 + 1] - dword_50B9F8[v45])
-            / (v46 - dword_50BAE8_xs[v45]);
+        v68 = (signed int)(v44 - dword_50BAE8_xs[v45]) * (signed __int64)(dword_50B9F8[v45 + 1] - dword_50B9F8[v45]) / (v46 - dword_50BAE8_xs[v45]);
         v47 = dword_50B9F8[v45];
       }
       else
       {
-        v68 = (signed int)(v44 - v46)
-            * (signed __int64)(dword_50B9F8[v45] - dword_50B9F8[v45 + 1])
-            / (dword_50BAE8_xs[v45] - v46);
+        v68 = (signed int)(v44 - v46) * (signed __int64)(dword_50B9F8[v45] - dword_50B9F8[v45 + 1]) / (dword_50BAE8_xs[v45] - v46);
         v47 = dword_50B9F8[v45 + 1];
       }
       ++v43;
@@ -6125,17 +6088,18 @@
     thisd = v83;
   }
   while ( ic <= v36 );
-  if ( !v43
-    || (v48 = 0,
-        dword_50BAE0[v43] = dword_50BAE0[0],
-        dword_50B9F0[v43] = dword_50B9F0[0],
-        v49 = pBLVRenderParams->uViewportY,
-        v50 = dword_50B9F0[0] < (signed int)pBLVRenderParams->uViewportY,
-        LOBYTE(v50) = dword_50B9F0[0] >= (signed int)pBLVRenderParams->uViewportY,
-        v51 = 1,
-        id = 1,
-        v43 < 1) )
+
+  if (v43 < 1)
     return 0;
+
+  v48 = 0;
+  dword_50BAE0[v43] = dword_50BAE0[0];
+  dword_50B9F0[v43] = dword_50B9F0[0];
+  v49 = pBLVRenderParams->uViewportY;
+  v50 = dword_50B9F0[0] < (signed int)pBLVRenderParams->uViewportY;
+  LOBYTE(v50) = dword_50B9F0[0] >= (signed int)pBLVRenderParams->uViewportY;
+  v51 = 1;
+  id = 1;
   do
   {
     v52 = v51;
@@ -6145,16 +6109,12 @@
     {
       if ( v53 >= (signed int)v49 )
       {
-        v69 = (signed int)(v49 - dword_50B9EC[v52])
-            * (signed __int64)(dword_50BAE0[v52] - dword_50BADC_xs[v52])
-            / (v53 - dword_50B9EC[v52]);
+        v69 = (signed int)(v49 - dword_50B9EC[v52]) * (signed __int64)(dword_50BAE0[v52] - dword_50BADC_xs[v52]) / (v53 - dword_50B9EC[v52]);
         v54 = dword_50BADC_xs[v52];
       }
       else
       {
-        v69 = (signed int)(v49 - v53)
-            * (signed __int64)(dword_50BADC_xs[v52] - dword_50BAE0[v52])
-            / (dword_50B9EC[v52] - v53);
+        v69 = (signed int)(v49 - v53) * (signed __int64)(dword_50BADC_xs[v52] - dword_50BAE0[v52]) / (dword_50B9EC[v52] - v53);
         v54 = dword_50BAE0[v52];
       }
       ++v48;
@@ -6171,15 +6131,16 @@
     v51 = id++ + 1;
   }
   while ( id <= v43 );
-  if ( !v48
-    || (v55 = 0,
-        dword_50BAD4[v48] = dword_50BAD4[0],
-        dword_50B9E0_ys[v48 + 1] = dword_50B9E0_ys[1],
-        v56 = pBLVRenderParams->uViewportW,
-        thise = dword_50B9E0_ys[1] <= (signed int)pBLVRenderParams->uViewportW,
-        ie = 1,
-        v48 < 1) )
+
+  if (v48 < 1)
     return 0;
+
+  v55 = 0;
+  dword_50BAD4[v48] = dword_50BAD4[0];
+  dword_50B9E0_ys[v48 + 1] = dword_50B9E0_ys[1];
+  v56 = pBLVRenderParams->uViewportW;
+  thise = dword_50B9E0_ys[1] <= (signed int)pBLVRenderParams->uViewportW;
+  ie = 1;
   do
   {
     v57 = ie;
@@ -6189,16 +6150,12 @@
     {
       if ( v58 <= (signed int)v56 )
       {
-        v70 = (signed int)(v56 - dword_50B9E0_ys[v57])
-            * (signed __int64)(dword_50BAD4[v57] - dword_50BAD0[v57])
-            / (v58 - dword_50B9E0_ys[v57]);
+        v70 = (signed int)(v56 - dword_50B9E0_ys[v57]) * (signed __int64)(dword_50BAD4[v57] - dword_50BAD0[v57]) / (v58 - dword_50B9E0_ys[v57]);
         v59 = dword_50BAD0[v57];
       }
       else
       {
-        v70 = (signed int)(v56 - v58)
-            * (signed __int64)(dword_50BAD0[v57] - dword_50BAD4[v57])
-            / (dword_50B9E0_ys[v57] - v58);
+        v70 = (signed int)(v56 - v58) * (signed __int64)(dword_50BAD0[v57] - dword_50BAD4[v57]) / (dword_50B9E0_ys[v57] - v58);
         v59 = dword_50BAD4[v57];
       }
       ++v55;
@@ -6215,6 +6172,7 @@
     thise = v85;
   }
   while ( ie <= v48 );
+
   if ( !v55 )
     return 0;
   v61 = pRenderer->pRenderD3D == 0;