diff mm7_6.cpp @ 1765:53c0453f4eb2

new_draw_object_dist
author Ritor1
date Wed, 02 Oct 2013 17:11:15 +0600
parents 845a6503f55c
children d73f4668ef94
line wrap: on
line diff
--- a/mm7_6.cpp	Tue Oct 01 10:44:02 2013 +0600
+++ b/mm7_6.cpp	Wed Oct 02 17:11:15 2013 +0600
@@ -45,12 +45,12 @@
 //----- (00424EE0) --------------------------------------------------------
 int __fastcall sr_424EE0_MakeFanFromTriangle(unsigned int uVertexID)
 {
-  unsigned int v1; // edx@1
+  //unsigned int v1; // edx@1
   double v2; // st7@1
   signed int v3; // edi@1
   char *v4; // esi@4
   char *v5; // ecx@4
-  unsigned int v6; // eax@4
+  //unsigned int v6; // eax@4
   char *v7; // edx@4
   double v8; // st6@10
   double v9; // st5@10
@@ -74,18 +74,16 @@
   char *v27; // [sp+2Ch] [bp-8h]@4
   char *v28; // [sp+30h] [bp-4h]@4
 
-  v1 = uVertexID;
   v2 = (double)pODMRenderParams->shading_dist_mist;
   memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
   v3 = 0;
   v22 = 0;
-  if ( array_50AC10[0].vWorldViewPosition.x <= v2 )
+  if ( array_50AC10[0].vWorldViewPosition.x <= (double)pODMRenderParams->shading_dist_mist )
     v3 = 1;
   if ( (signed int)(uVertexID + 1) <= 1 )
     return 0;
   v4 = (char *)&array_507D30[0].vWorldViewPosition.z;
   v5 = (char *)&array_507D30[0].vWorldViewPosition.y;
-  v6 = v1;
   v23 = (char *)&array_507D30[0].flt_2C;
   v26 = (char *)&array_507D30[0]._rhw;
   v24 = array_507D30;
@@ -95,27 +93,26 @@
   v27 = (char *)&array_507D30[0].v;
   v28 = (char *)&array_507D30[0].u;
   v7 = (char *)&array_50AC10[0].v;
-  v18 = v6;
-  do
+  for ( v18 = 1; v18 <= uVertexID; ++v18 )
   {
-    v19 = v2 >= *((float *)v7 + 5);
+    v19 = v2 >= array_50AC10[v18].vWorldViewPosition.x;
     if ( v3 != v19 )
     {
       if ( v19 )
       {
-        v8 = (v2 - *((float *)v7 - 7)) / (*((float *)v7 + 5) - *((float *)v7 - 7));
-        *(float *)v5 = (*((float *)v7 + 6) - *((float *)v7 - 6)) * v8 + *((float *)v7 - 6);
-        *(float *)v4 = (*((float *)v7 + 7) - *((float *)v7 - 5)) * v8 + *((float *)v7 - 5);
-        *(float *)v28 = (*((float *)v7 + 11) - *((float *)v7 - 1)) * v8 + *((float *)v7 - 1);
-        v9 = (*((float *)v7 + 12) - *(float *)v7) * v8 + *(float *)v7;
+        v8 = (v2 - array_50AC10[v18 - 1].vWorldViewPosition.x) / (array_50AC10[v18].vWorldViewPosition.x - array_50AC10[v18 - 1].vWorldViewPosition.x);
+        *(float *)v5 = (array_50AC10[v18].vWorldViewPosition.y - array_50AC10[v18 - 1].vWorldViewPosition.y) * v8 + array_50AC10[v18 - 1].vWorldViewPosition.y;
+        *(float *)v4 = (array_50AC10[v18].vWorldViewPosition.z - array_50AC10[v18 - 1].vWorldViewPosition.z) * v8 + array_50AC10[v18 - 1].vWorldViewPosition.z;
+        *(float *)v28 = (array_50AC10[v18].u - array_50AC10[v18 - 1].u) * v8 + array_50AC10[v18 - 1].u;
+        v9 = (array_50AC10[v18].v - array_50AC10[v18 - 1].v) * v8 + array_50AC10[v18 - 1].v;
       }
       else
       {
-        v10 = (v2 - *((float *)v7 + 5)) / (*((float *)v7 - 7) - *((float *)v7 + 5));
-        *(float *)v5 = (*((float *)v7 - 6) - *((float *)v7 + 6)) * v10 + *((float *)v7 + 6);
-        *(float *)v4 = (*((float *)v7 - 5) - *((float *)v7 + 7)) * v10 + *((float *)v7 + 7);
-        *(float *)v28 = (*((float *)v7 - 1) - *((float *)v7 + 11)) * v10 + *((float *)v7 + 11);
-        v9 = (*(float *)v7 - *((float *)v7 + 12)) * v10 + *((float *)v7 + 12);
+        v10 = (v2 - array_50AC10[v18].vWorldViewPosition.x) / (array_50AC10[v18 - 1].vWorldViewPosition.x - array_50AC10[v18].vWorldViewPosition.x);
+        *(float *)v5 = (array_50AC10[v18 - 1].vWorldViewPosition.y - array_50AC10[v18].vWorldViewPosition.y) * v10 + array_50AC10[v18].vWorldViewPosition.y;
+        *(float *)v4 = (array_50AC10[v18 - 1].vWorldViewPosition.z - array_50AC10[v18].vWorldViewPosition.z) * v10 + array_50AC10[v18].vWorldViewPosition.z;
+        *(float *)v28 = (array_50AC10[v18 - 1].u - array_50AC10[v18].u) * v10 + array_50AC10[v18].u;
+        v9 = (array_50AC10[v18 - 1].v - array_50AC10[v18].v) * v10 + array_50AC10[v18].v;
       }
       *(float *)v27 = v9;
       *(float *)v25 = v2;
@@ -199,9 +196,9 @@
     }
     v3 = v19;
     v7 += 48;
-    --v18;
+    //--v18;
   }
-  while ( v18 );
+  //while ( v18 );
   result = v22;
   if ( v22 < 3 )
     return 0;
@@ -325,21 +322,21 @@
         pParty->SetHoldingItem(&Dst);
       v13 = 1;
     }
-    goto LABEL_44;
+    v8 = pParty;
+    goto LABEL_45;
   }
   if ( rand() % 100 >= pActor->pMonsterInfo.uTreasureDropChance || (v7 = pActor->pMonsterInfo.uTreasureLevel) == 0 )
   {
-LABEL_44:
     v8 = pParty;
     goto LABEL_45;
   }
   pItemsTable->GenerateItem(v7, pActor->pMonsterInfo.uTreasureType, &Dst);
   v10 = pItemsTable->pItems[Dst.uItemID].pUnidentifiedName;
   if ( v14 )
-    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[490], v14, v10);//Вы нашли ^I[%d] золот^L[ой;ых;ых] и предмет (%s)!
   else
-    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);
-  ShowStatusBarString(pTmpBuf2.data(), 2u);
+    sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[471], v10);//Вы нашли ^Pv[%s]!
+  ShowStatusBarString(pTmpBuf2.data(), 2);
   v8 = pParty;
   if ( !pParty->AddItemToParty(&Dst) )
     pParty->SetHoldingItem(&Dst);
@@ -891,9 +888,6 @@
     v5 = pActor->pActorBuffs[14].uPower;
   switch ( a2 )
   {
-    case 4:
-      v6 = pActor->pMonsterInfo.uResPhysical;
-      break;
     case 0:
       v6 = pActor->pMonsterInfo.uResFire;
       v4 = v5;
@@ -910,6 +904,9 @@
       v6 = pActor->pMonsterInfo.uResEarth;
       v4 = v5;
       break;
+    case 4:
+      v6 = pActor->pMonsterInfo.uResPhysical;
+      break;
     case 6:
       v6 = pActor->pMonsterInfo.uResSpirit;
       break;
@@ -960,50 +957,47 @@
 //----- (00427662) --------------------------------------------------------
 bool stru319::GetMagicalResistance(Actor *pActor, unsigned int uType)
 {
-  Actor *v3; // edi@2
-  signed int v4; // esi@2
+  signed int resist; // esi@2
   bool result; // eax@13
 
   switch ( uType )
   {
-    case 0u:
-      v3 = pActor;
-      v4 = pActor->pMonsterInfo.uResFire;
-    case 1u:
-      v3 = pActor;
-      v4 = pActor->pMonsterInfo.uResAir;
-    case 2u:
-      v3 = pActor;
-      v4 = pActor->pMonsterInfo.uResWater;
-    case 3u:
-      v3 = pActor;
-      v4 = pActor->pMonsterInfo.uResEarth;
-    case 7u:
-      v3 = pActor;
-      v4 = pActor->pMonsterInfo.uResMind;
-    case 6u:
-      v3 = pActor;
-      v4 = pActor->pMonsterInfo.uResSpirit;
-    case 8u:
-      v3 = pActor;
-      v4 = pActor->pMonsterInfo.uResBody;
-    case 9u:
-      v3 = pActor;
-      v4 = pActor->pMonsterInfo.uResLight;
-    case 0xAu:
-      v3 = pActor;
-      v4 = pActor->pMonsterInfo.uResDark;
-    case 4u:
-      v3 = pActor;
-      v4 = pActor->pMonsterInfo.uResPhysical;
+    case 0:
+      resist = pActor->pMonsterInfo.uResFire;
+      break;
+    case 1:
+      resist = pActor->pMonsterInfo.uResAir;
+      break;
+    case 2:
+      resist = pActor->pMonsterInfo.uResWater;
+      break;
+    case 3:
+      resist = pActor->pMonsterInfo.uResEarth;
+      break;
+    case 4:
+      resist = pActor->pMonsterInfo.uResPhysical;
+      break;
+    case 6:
+      resist = pActor->pMonsterInfo.uResSpirit;
+      break;
+    case 7:
+      resist = pActor->pMonsterInfo.uResMind;
+    case 8:
+      resist = pActor->pMonsterInfo.uResBody;
+      break;
+    case 9:
+      resist = pActor->pMonsterInfo.uResLight;
+      break;
+    case 10:
+      resist = pActor->pMonsterInfo.uResDark;
       break;
     default:
       return 1;
   }
-  if ( v4 < 200 )
-	result = rand() % (signed int)(((unsigned int)v3->pMonsterInfo.uLevel >> 2) + v4 + 30) < 30;
+  if ( resist < 200 )
+    result = rand() % (signed int)(((unsigned int)pActor->pMonsterInfo.uLevel >> 2) + resist + 30) < 30;
   else
-	result = 0;
+    result = 0;
   return result;
 }