changeset 800:e6bab3f2c1be

Слияние
author Ritor1
date Mon, 25 Mar 2013 10:40:44 +0600
parents 977407dfa4c5 (current diff) 41b4e9769863 (diff)
children 5f0029b4bf09
files
diffstat 6 files changed, 65 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/Render.cpp	Mon Mar 25 10:40:37 2013 +0600
+++ b/Render.cpp	Mon Mar 25 10:40:44 2013 +0600
@@ -7809,6 +7809,15 @@
     uCorrectedColor = 0xFFFFFFFF;
   pGame->AlterGamma_BLV(pFace, &uCorrectedColor);
 
+
+  if (pFace->uAttributes & FACE_OUTLINED)
+  {
+    int color;
+    if (GetTickCount() % 300 >= 150)
+      uColor = uCorrectedColor = 0xFF20FF20;
+    else uColor = uCorrectedColor = 0xFF109010;
+  }
+
   if (byte_4D864C && pGame->uFlags & 1)
   {
       __debugbreak();
--- a/mm7_3.cpp	Mon Mar 25 10:40:37 2013 +0600
+++ b/mm7_3.cpp	Mon Mar 25 10:40:44 2013 +0600
@@ -1606,7 +1606,15 @@
   v78 = 0;
   v71 = 0;
   bJumping = 0;
+
+  uFaceID = -1;
   v80 = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
+  assert(uFaceID != -1);
+
+  for (uint i = 0; i < pIndoor->uNumFaces; ++i)
+    pIndoor->pFaces[i].uAttributes &= ~FACE_OUTLINED;
+  pIndoor->pFaces[uFaceID].uAttributes |= FACE_OUTLINED;
+
   if ( pParty->bFlying )
   {
     pParty->bFlying = false;
@@ -15095,7 +15103,7 @@
                 {
                   Actor::Die(v84);
                   if ( v5->pMonsterInfo.uExp )
-                    sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp);
+                    GivePartyExp(pMonsterStats->pInfos[v5->pMonsterInfo.uID].uExp);
                 }
               }
             }
--- a/mm7_4.cpp	Mon Mar 25 10:40:37 2013 +0600
+++ b/mm7_4.cpp	Mon Mar 25 10:40:44 2013 +0600
@@ -228,11 +228,11 @@
   signed int v14; // ebx@14
   int v15; // eax@16
   //int v16; // edx@19
-  int v17; // ST18_4@19
-  signed int v18; // edx@19
-  signed __int64 v19; // qtt@19
+  //int v17; // ST18_4@19
+  //signed int v18; // edx@19
+  //signed __int64 v19; // qtt@19
   int v21; // eax@27
-  int v22; // ecx@29
+  //int v22; // ecx@29
   signed int v28; // eax@45
   int v29; // ebx@47
   int v30; // edx@49
@@ -243,7 +243,7 @@
   signed int v35; // esi@56
   int result; // eax@57
   int v38; // edx@62
-  int v44; // [sp+20h] [bp-20h]@10
+  //int v44; // [sp+20h] [bp-20h]@10
   bool v47; // [sp+24h] [bp-1Ch]@43
   bool v48; // [sp+28h] [bp-18h]@10
   bool v49; // [sp+28h] [bp-18h]@41
@@ -261,13 +261,14 @@
   static __int16 word_721460_xs[104]; // idb
 
   auto pSector = &pIndoor->pSectors[uSectorID];
-  v55 = 1;
+  v55 = 0;
   for (uint i = 0; i < pSector->uNumFloors; ++i)
   {
     auto pFloor = &pIndoor->pFaces[pSector->pFloors[i]];
     if (pFloor->Clickable())
       continue;
 
+    assert(pFloor->uNumVertices);
     if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 &&
         y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1)
     {
@@ -278,52 +279,42 @@
         word_721390_ys[2 * j] =     pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y;
         word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y;
       }
-      v44 = 2 * pFloor->uNumVertices;
       word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0];
       word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0];
 
-      v48 = word_721390_ys[0] >= y;
+      v50 = word_721390_ys[0] >= y;
       v53 = 0;
-      if ( pFloor->uNumVertices > 0 )
-      {
-        for ( int i = 0; i < v44; i++ )
-        {
-          if ( v53 >= 2 )
-            break;
-          v50 = word_721390_ys[i + 1] >= y;
+
+      for (uint j = 0; j < 2 * pFloor->uNumVertices - 1; ++j)
+      {
+        if (v53 >= 2)
+          break;
+
+        v48 = v50;
+        v50 = word_721390_ys[j + 1] >= y;
 
           v13 = i;
-          if ( v48 != v50 )
+          if (v48 == v50)
+            continue;
+
+            v14 = word_721460_xs[j + 1] >= x ? 0 : 2;
+            v15 = v14 | word_721460_xs[j] < x;
+
+          if (v15 == 3)
+            continue;
+          else if (!v15)
+            ++v53;
+          else
           {
-            v14 = word_721460_xs[i + 1] >= x ? 0 : 2;
-            v15 = v14 | word_721460_xs[i] < x;
-
-            if ( !v15)
-              ++v53;
-            else
-            {
-              //v16 = word_721390_ys[i];
-              v17 = word_721390_ys[i + 1] - word_721390_ys[i];
-              v18 = y - word_721390_ys[i];
-              LODWORD(v19) = v18 << 16;
-              HIDWORD(v19) = v18 >> 16;
-              if ((signed int)(((unsigned __int64)(((signed int)word_721460_xs[i + 1] - (signed int)word_721460_xs[i]) * v19 / v17) >> 16) + word_721460_xs[i]) >= x)
+            auto a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]);
+            auto res = fixpoint_mul((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b);
+
+            if (res + word_721460_xs[j] >= x)
                 ++v53;
-            }
-            /*if ( v15 != 3 )
-            {
-              if ( !v15 )
-              {
-                LODWORD(v19) = (y - word_721390_ys[i]) << 16;
-                HIDWORD(v19) = (y - word_721390_ys[i]) >> 16;
-                v16 = ((((word_721460_xs[i + 1] - word_721460_xs[i]) * v19 / (word_721390_ys[i + 1] - word_721390_ys[i])) >> 16) + word_721460_xs[i]);
-                if ( v16 >= x)
-                  ++v53;
-              }
-            }*/
           }
-          v48 = v50;
-        }
+      }
+
+
         if ( v53 == 1 )
         {
           if ( v55 >= 50 )
@@ -334,16 +325,16 @@
           }
           else
           {
-            v21 = ((unsigned __int64)(pFloor->zCalc1 * (signed __int64)x) >> 16) + ((unsigned __int64)(pFloor->zCalc2 * (signed __int64)y) >> 16)
-                + HIWORD(pFloor->zCalc3);
+            v21 = fixpoint_mul(pFloor->zCalc1, x) + fixpoint_mul(pFloor->zCalc2, y) + (short)(pFloor->zCalc3 >> 16);
           }
-          v22 = v55++;
-          blv_floor_level[v22] = v21;
-          blv_floor_id[v22] = pSector->pFloors[i];
+          blv_floor_level[v55] = v21;
+          blv_floor_id[v55] = pSector->pFloors[i];
+          v55++;
         }
-      }
-    }
-  }
+    }
+  }
+
+
   if ( pSector->field_0 & 8 )
   {
     for (uint i = 0; i < pSector->uNumPortals; ++i)
--- a/mm7_5.cpp	Mon Mar 25 10:40:37 2013 +0600
+++ b/mm7_5.cpp	Mon Mar 25 10:40:44 2013 +0600
@@ -5097,7 +5097,7 @@
     Actor::ApplyFineForKillingPeasant(uActorID_Monster_);
     Actor::AggroSurroundingPeasants(uActorID_Monster_, 1);
     if ( pMonster->pMonsterInfo.uExp )
-      sub_4269A2_GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp);
+      GivePartyExp(pMonsterStats->pInfos[pMonster->pMonsterInfo.uID].uExp);
     v40 = SPEECH_51;
     if ( rand() % 100 < 20 )
       v40 = ((signed int)pMonster->pMonsterInfo.uHP >= 100) + 1;
@@ -5413,7 +5413,7 @@
                 Actor::ApplyFineForKillingPeasant(uActorID);
                 Actor::AggroSurroundingPeasants(uActorID, 1);
                 if ( v7->pMonsterInfo.uExp )
-                  sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp);
+                  GivePartyExp(pMonsterStats->pInfos[v7->pMonsterInfo.uID].uExp);
                 v34 = SPEECH_51;
                 if ( rand() % 100 < 20 )
                   v34 = ((signed int)v7->pMonsterInfo.uHP >= 100) + 1;
@@ -5599,7 +5599,7 @@
                       Actor::ApplyFineForKillingPeasant(uActorID);
                       Actor::AggroSurroundingPeasants(uActorID, 1);
                       if ( v44->pMonsterInfo.uExp )
-                        sub_4269A2_GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp);
+                        GivePartyExp(pMonsterStats->pInfos[v44->pMonsterInfo.uID].uExp);
                       v64 = SPEECH_51;
                       if ( rand() % 100 < 20 )
                         v64 = ((signed int)v44->pMonsterInfo.uHP >= 100) + 1;
--- a/mm7_6.cpp	Mon Mar 25 10:40:37 2013 +0600
+++ b/mm7_6.cpp	Mon Mar 25 10:40:44 2013 +0600
@@ -1200,7 +1200,7 @@
 // 50C998: using guessed type int dword_50C998_turnbased_icon_1A;
 
 //----- (004269A2) --------------------------------------------------------
-int __fastcall sub_4269A2_GivePartyExp(unsigned int a1)
+int __fastcall GivePartyExp(unsigned int a1)
 {
   //unsigned __int64 v1; // qax@1
   Player *v1;
--- a/mm7_data.h	Mon Mar 25 10:40:37 2013 +0600
+++ b/mm7_data.h	Mon Mar 25 10:40:44 2013 +0600
@@ -1752,7 +1752,7 @@
 int __fastcall _4268E3_smthn_to_a1r5g5b5(unsigned int uColor); // idb
 int __fastcall _42690D_colors_cvt(unsigned int a1);
 void __cdecl sub_426947();
-int __fastcall sub_4269A2_GivePartyExp(unsigned int a1);
+int __fastcall GivePartyExp(unsigned int a1);
 bool __fastcall sub_427769_spell(unsigned int uSpellID);
 void _42777D_CastSpell_UseWand_ShootArrow(int a1, unsigned int uPlayerID, unsigned int a4, __int16 a5, int a6);
 int __fastcall sub_42EBBE(int, int); // weak