changeset 1781:7b42e79eb2d0

Merge
author Grumpy7
date Thu, 03 Oct 2013 05:30:03 +0200
parents 01b3c314e9be (current diff) 53c0453f4eb2 (diff)
children 421e826f4477
files Player.cpp
diffstat 4 files changed, 94 insertions(+), 113 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Thu Oct 03 05:27:54 2013 +0200
+++ b/Actor.cpp	Thu Oct 03 05:30:03 2013 +0200
@@ -46,55 +46,40 @@
 
 
 //----- (0041AF52) --------------------------------------------------------
-void Actor::DrawHealthBar(Actor *a1, GUIWindow *a2)
+void Actor::DrawHealthBar(Actor *actor, GUIWindow *window)
 {
-  unsigned int v2; // eax@1
-  GUIWindow *v3; // edi@1
-  unsigned int v4; // esi@1
-  signed int v5; // ebx@4
-  double v6; // st7@5
-  unsigned int v7; // eax@6
-  unsigned int v8; // ebx@10
+  unsigned int bar_length; // esi@1
+  unsigned int uX; // ebx@10
   unsigned int v9; // [sp+14h] [bp-Ch]@4
   unsigned int v10; // [sp+1Ch] [bp-4h]@4
 
-  v2 = a1->pMonsterInfo.uHP;
-  v3 = a2;
-  v4 = 25;
-  if ( (signed int)v2 > 25 )
+  bar_length = 25;
+  if ( actor->pMonsterInfo.uHP > 25 )
   {
-    v4 = 200;
-    if ( (signed int)v2 < 200 )
-      v4 = a1->pMonsterInfo.uHP;
+    bar_length = 200;
+    if ( actor->pMonsterInfo.uHP < 200 )
+      bar_length = actor->pMonsterInfo.uHP;
   }
-  v5 = a1->sCurrentHP;
-  v10 = v4;
+  v10 = bar_length;
   v9 = uTextureID_mhp_grn;
-  if ( v5 < (signed int)v2 )
+  if ( actor->sCurrentHP < actor->pMonsterInfo.uHP )
   {
-    v6 = (double)(signed int)v2;
-    v10 = (signed __int64)((double)(signed int)v4 / (double)(signed int)v2 * (double)a1->sCurrentHP);
-    if ( v5 <= (signed int)(signed __int64)(0.34 * v6) )
-    {
-      v7 = uTextureID_mhp_red;
-      v9 = v7;
-    }
-    else if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) )
-    {
-      v7 = uTextureID_mhp_yel;
-      v9 = v7;
-    }
+    v10 = bar_length / actor->pMonsterInfo.uHP * actor->sCurrentHP;
+    if ( actor->sCurrentHP <= (signed int)(signed __int64)(0.34 * (double)(signed int)actor->pMonsterInfo.uHP) )
+      v9 = uTextureID_mhp_red;
+    else if ( actor->sCurrentHP <= (signed int)(signed __int64)((double)(signed int)actor->pMonsterInfo.uHP * 0.67) )
+      v9 = uTextureID_mhp_yel;
   }
-  v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2;
+  uX = window->uFrameX + (signed int)(window->uFrameWidth - bar_length) / 2;
 
-  pRenderer->SetTextureClipRect(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52);
-  pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_bd));
-  pRenderer->SetTextureClipRect(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52);
-  pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 34, pIcons_LOD->GetTexture(v9));
+  pRenderer->SetTextureClipRect(uX, window->uFrameY + 32, uX + bar_length, window->uFrameY + 52);
+  pRenderer->DrawTextureIndexed(uX, window->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_bd));
+  pRenderer->SetTextureClipRect(uX, window->uFrameY + 32, uX + v10, window->uFrameY + 52);
+  pRenderer->DrawTextureIndexed(uX, window->uFrameY + 34, pIcons_LOD->GetTexture(v9));
 
   pRenderer->ResetTextureClipRect();
-  pRenderer->DrawTextureIndexed(v8 - 5, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capl));
-  pRenderer->DrawTextureIndexed(v8 + v4, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capr));
+  pRenderer->DrawTextureIndexed(uX - 5, window->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capl));
+  pRenderer->DrawTextureIndexed(uX + bar_length, window->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capr));
 }
 
 //----- (00448A40) --------------------------------------------------------
@@ -227,7 +212,6 @@
   }
 }
 
-  
 //----- (0040894B) --------------------------------------------------------
 bool Actor::CanAct()
 {
@@ -1910,16 +1894,13 @@
 //----- (00403E61) --------------------------------------------------------
 void __fastcall Actor::StandAwhile(unsigned int uActorID)
 {
-  Actor *v1; // esi@1
-
-  v1 = &pActors[uActorID];
-  v1->uCurrentActionLength = rand() % 128 + 128;
-  v1->uCurrentActionTime = 0;
-  v1->uAIState = Standing;
-  v1->vVelocity.z = 0;
-  v1->vVelocity.y = 0;
-  v1->vVelocity.x = 0;
-  v1->UpdateAnimation();
+  pActors[uActorID].uCurrentActionLength = rand() % 128 + 128;
+  pActors[uActorID].uCurrentActionTime = 0;
+  pActors[uActorID].uAIState = Standing;
+  pActors[uActorID].vVelocity.z = 0;
+  pActors[uActorID].vVelocity.y = 0;
+  pActors[uActorID].vVelocity.x = 0;
+  pActors[uActorID].UpdateAnimation();
 }
 
 //----- (00403C6C) --------------------------------------------------------
--- a/Actor.h	Thu Oct 03 05:27:54 2013 +0200
+++ b/Actor.h	Thu Oct 03 05:30:03 2013 +0200
@@ -237,7 +237,7 @@
   static void GiveItem(signed int uActorID, unsigned int uItemID, unsigned int bGive);
   static void ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle);
   static void ApplyFineForKillingPeasant(unsigned int uActorID);
-  static void DrawHealthBar(Actor *a1, struct GUIWindow *a2);
+  static void DrawHealthBar(Actor *actor, struct GUIWindow *window);
   static int _43B3E0_CalcDamage(Actor *a1, signed int a2);
   static void AddBloodsplatOnDamageOverlay(unsigned int uActorID, int a2, signed int a3);
 
--- a/mm7_2.cpp	Thu Oct 03 05:27:54 2013 +0200
+++ b/mm7_2.cpp	Thu Oct 03 05:30:03 2013 +0200
@@ -5104,6 +5104,7 @@
 }
 
 bool new_sky = false;
+bool new_draw_object_dist = true;
 bool change_seasons = false;
 bool all_magic = true;
 bool wizard_eye = false;
@@ -5398,7 +5399,12 @@
   mipmapping_building_mm3 = GetPrivateProfileIntW(L"mipmapping", L"bld_mm3", 4096, pIniFilename);
   pODMRenderParams->shading_dist_shade     = GetPrivateProfileIntW(L"shading", L"dist_shade", 2048, pIniFilename);
   pODMRenderParams->shading_dist_shademist = GetPrivateProfileIntW(L"shading", L"dist_shademist", 4096, pIniFilename);
-  pODMRenderParams->shading_dist_mist      = GetPrivateProfileIntW(L"shading", L"dist_mist", 8192, pIniFilename);
+
+  int dist = 0x2000;
+  extern bool new_draw_object_dist;
+  if ( new_draw_object_dist )
+      dist = 0x6000;
+  pODMRenderParams->shading_dist_mist      = GetPrivateProfileIntW(L"shading", L"dist_mist", dist, pIniFilename);
 
   wchar_t pDefaultSkyTextureW[1024];
   GetPrivateProfileStringW(L"textures", L"sky", L"plansky1", pDefaultSkyTextureW, 0x10u, pIniFilename);
--- a/mm7_6.cpp	Thu Oct 03 05:27:54 2013 +0200
+++ b/mm7_6.cpp	Thu Oct 03 05:30:03 2013 +0200
@@ -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;
 }