changeset 2072:2737276390ff

Merge
author Nomad
date Tue, 03 Dec 2013 21:30:40 +0200
parents 9f4d5a9d6fd8 (current diff) a290d9fbdc95 (diff)
children 38bf1c70fc70 70c45d12d9ca
files mm7_4.cpp mm7_data.cpp mm7_data.h
diffstat 11 files changed, 182 insertions(+), 175 deletions(-) [+]
line wrap: on
line diff
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj	Tue Dec 03 21:29:12 2013 +0200
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj	Tue Dec 03 21:30:40 2013 +0200
@@ -163,6 +163,7 @@
     <ClCompile Include="..\..\LightsStack.cpp" />
     <ClCompile Include="..\..\LOD.cpp" />
     <ClCompile Include="..\..\Log.cpp" />
+    <ClCompile Include="..\..\LuaVM.cpp" />
     <ClCompile Include="..\..\mm7text_ru.cpp" />
     <ClCompile Include="..\..\mm7_2.cpp" />
     <ClCompile Include="..\..\mm7_3.cpp" />
@@ -185,6 +186,9 @@
     <ClCompile Include="..\..\ParticleEngine.cpp" />
     <ClCompile Include="..\..\Party.cpp" />
     <ClCompile Include="..\..\Player.cpp" />
+    <ClCompile Include="..\..\Player_wrap.cxx">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\..\Random.cpp" />
     <ClCompile Include="..\..\Render.cpp" />
     <ClCompile Include="..\..\SaveLoad.cpp" />
@@ -322,6 +326,7 @@
     <ClInclude Include="..\..\Lights.h" />
     <ClInclude Include="..\..\LOD.h" />
     <ClInclude Include="..\..\Log.h" />
+    <ClInclude Include="..\..\LuaVM.h" />
     <ClInclude Include="..\..\MapInfo.h" />
     <ClInclude Include="..\..\MM7.h" />
     <ClInclude Include="..\..\mm7_data.h" />
@@ -385,6 +390,7 @@
       <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename)_wrap.cxx</Outputs>
     </CustomBuild>
     <None Include="..\..\lib\swig\swigwin-2.0.11\UIControlModule.swig" />
+    <None Include="..\..\Player.swig" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters	Tue Dec 03 21:29:12 2013 +0200
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters	Tue Dec 03 21:30:40 2013 +0200
@@ -285,6 +285,7 @@
       <Filter>UI</Filter>
     </ClInclude>
     <ClInclude Include="..\..\Timer.h" />
+    <ClInclude Include="..\..\LuaVM.h" />
   </ItemGroup>
   <ItemGroup>
     <Filter Include="lib">
@@ -334,6 +335,7 @@
     <None Include="..\..\lib\swig\swigwin-2.0.11\UIControlModule.swig">
       <Filter>lib\swig\swigwin-2.0.11</Filter>
     </None>
+    <None Include="..\..\Player.swig" />
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\Actor.cpp" />
@@ -605,6 +607,8 @@
       <Filter>UI\Books</Filter>
     </ClCompile>
     <ClCompile Include="..\..\Timer.cpp" />
+    <ClCompile Include="..\..\LuaVM.cpp" />
+    <ClCompile Include="..\..\Player_wrap.cxx" />
   </ItemGroup>
   <ItemGroup>
     <CustomBuild Include="..\..\NewUI\Core\UIControlModule.swig">
--- a/Events.cpp	Tue Dec 03 21:29:12 2013 +0200
+++ b/Events.cpp	Tue Dec 03 21:30:40 2013 +0200
@@ -433,6 +433,8 @@
   {
     if (!lua->DoFile("out01.lua"))
       Log::Warning(L"Error opening out01.lua\n");
+    Log::Warning(L"being tested that well\n");
+    return;
   }
   if ( !uEventID )
     {
--- a/Outdoor.cpp	Tue Dec 03 21:29:12 2013 +0200
+++ b/Outdoor.cpp	Tue Dec 03 21:30:40 2013 +0200
@@ -2715,39 +2715,36 @@
 // 6807E0: using guessed type int _6807E0_num_decorations_6807B8;
 
 //----- (0047F223) --------------------------------------------------------
-int OutdoorLocation::_47F223_LooksLikeGenerateMonsterLoot()
+void OutdoorLocation::ArrangeSpriteObjects()
 {
-  signed int v1; // ebx@1
   char *v2; // esi@2
-  int v3; // eax@7
   OutdoorLocation *v5; // [sp+0h] [bp-4h]@1
 
   v5 = this;
-  v1 = 0;
+  
   if ( (signed int)uNumSpriteObjects > 0 )
   {
     v2 = (char *)&pSpriteObjects[0].uObjectDescID;
-    do
+    for ( int i = 0; i < (signed int)uNumSpriteObjects; ++i )
     {
-      if ( *(short *)v2 )
+      if ( pSpriteObjects[i].uObjectDescID )
       {
-        if ( !(v2[24] & 8) && !(pObjectList->pObjects[*(short *)v2].uFlags & 0x10) )
-          *(int *)(v2 + 10) = GetTerrainHeightsAroundParty2(*(int *)(v2 + 2), *(int *)(v2 + 6), (int *)&v5, 0);
-        v3 = *(int *)(v2 + 34);
-        if ( v3 )
+        if ( !(v2[24] & 8) && !(pObjectList->pObjects[pSpriteObjects[i].uObjectDescID].uFlags & 0x10) )
+          pSpriteObjects[i].vPosition.z = GetTerrainHeightsAroundParty2(pSpriteObjects[i].vPosition.x,
+                              pSpriteObjects[i].vPosition.y, (int *)&v5, 0);
+        if ( pSpriteObjects[i].stru_24.uItemID )
         {
-          if ( v3 != 220 && pItemsTable->pItems[v3].uEquipType == 14 && !*(int *)(v2 + 38) )
-            *(int *)(v2 + 38) = rand() % 15 + 5;
-          pItemsTable->SetSpecialBonus((ItemGen *)(v2 + 34));
+          if ( pSpriteObjects[i].stru_24.uItemID != 220
+            && pItemsTable->pItems[pSpriteObjects[i].stru_24.uItemID].uEquipType == EQUIP_POTION
+            && !pSpriteObjects[i].stru_24.uEnchantmentType )
+             pSpriteObjects[i].stru_24.uEnchantmentType = rand() % 15 + 5;
+          pItemsTable->SetSpecialBonus(&pSpriteObjects[i].stru_24);
         }
       }
-      ++v1;
       v2 += 112;
     }
-    while ( v1 < (signed int)uNumSpriteObjects );
   }
   pGameLoadingUI_ProgressBar->Progress();
-  return 1;
 }
 
 //----- (0047F2D3) --------------------------------------------------------
@@ -3167,10 +3164,10 @@
   int v39; // [sp+20h] [bp-20h]@9
   signed int pBModelNum; // [sp+28h] [bp-18h]@1
   int pFaceNum; // [sp+2Ch] [bp-14h]@8
-  bool v43; // [sp+30h] [bp-10h]@22
-  bool v44; // [sp+34h] [bp-Ch]@24
+  bool current_vertices_Y; // [sp+30h] [bp-10h]@22
+  bool next_vertices_Y; // [sp+34h] [bp-Ch]@24
   signed int v46; // [sp+3Ch] [bp-4h]@1
-  signed int v48; // [sp+58h] [bp+18h]@22
+  signed int number_hits; // [sp+58h] [bp+18h]@22
   signed int v49; // [sp+58h] [bp+18h]@43
 
   v46 = 1;
@@ -3198,44 +3195,45 @@
             
               for ( uint i = 0; i < pFace->uNumVertices; ++i)
               {
-                word_721040[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x;
-                word_720F70[2 * i] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y;
-                word_721040[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x;
-                word_720F70[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y;
+                FloorFaceVertCoord_X[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x;
+                FloorFaceVertCoord_Y[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y;
+                FloorFaceVertCoord_X[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x;
+                FloorFaceVertCoord_Y[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y;
               }
-            word_721040[2 * pFace->uNumVertices] = word_721040[0];
-            word_720F70[2 * pFace->uNumVertices] = word_720F70[0];
-            v43 = word_720F70[0] >= Y;
-            v48 = 0;
+            FloorFaceVertCoord_X[2 * pFace->uNumVertices] = FloorFaceVertCoord_X[0];
+            FloorFaceVertCoord_Y[2 * pFace->uNumVertices] = FloorFaceVertCoord_Y[0];
+
+            current_vertices_Y = FloorFaceVertCoord_Y[0] >= Y;
+            number_hits = 0;
             if ( 2 * pFace->uNumVertices > 0 )
             {
               for ( int i = 0; i < 2 * pFace->uNumVertices; ++i )
               {
-                if ( v48 >= 2 )
+                if ( number_hits >= 2 )
                   break;
-                v36 = word_720F70[i + 1];
-                v44 = word_720F70[i + 1] >= Y;
-                if ( v43 != v44 )
+                v36 = FloorFaceVertCoord_Y[i + 1];
+                next_vertices_Y = FloorFaceVertCoord_Y[i + 1] >= Y;
+                if ( current_vertices_Y != next_vertices_Y )//проверка по Y
                 {
-                  v18 = word_721040[i + 1] >= X ? 0 : 2;
-                  v19 = v18 | (word_721040[i] < X);
+                  v18 = FloorFaceVertCoord_X[i + 1] >= X ? 0 : 2;
+                  v19 = v18 | (FloorFaceVertCoord_X[i] < X);
                   if ( v19 != 3 )
                   {
                     if ( !v19 )
-                      ++v48;
+                      ++number_hits;
                     else
                     {
-                      LODWORD(v23) = (Y - word_720F70[i]) << 16;
-                      HIDWORD(v23) = (Y - word_720F70[i]) >> 16;
-                      v22 = ((((word_721040[i + 1] - word_721040[i]) * v23 / (v36 - word_720F70[i])) >> 16) + word_721040[i]);
+                      LODWORD(v23) = (Y - FloorFaceVertCoord_Y[i]) << 16;
+                      HIDWORD(v23) = (Y - FloorFaceVertCoord_Y[i]) >> 16;
+                      v22 = ((((FloorFaceVertCoord_X[i + 1] - FloorFaceVertCoord_X[i]) * v23 / (v36 - FloorFaceVertCoord_Y[i])) >> 16) + FloorFaceVertCoord_X[i]);
                       if ( v22 >= X) 
-                        ++v48;
+                        ++number_hits;
                     }
                   }
                 }
-                v43 = v44;
+                current_vertices_Y = next_vertices_Y;
               }
-              if ( v48 == 1 )
+              if ( number_hits == 1 )
               {
                 if ( v46 >= 20 )
                   break;
--- a/Outdoor.h	Tue Dec 03 21:29:12 2013 +0200
+++ b/Outdoor.h	Tue Dec 03 21:30:40 2013 +0200
@@ -147,7 +147,7 @@
   bool _47F097(signed int a2, signed int a3);
   bool _47F0E2();
   bool PrepareDecorations();
-  int _47F223_LooksLikeGenerateMonsterLoot();
+  void ArrangeSpriteObjects();
   bool InitalizeActors(int a1);
   bool LoadRoadTileset();
   bool LoadTileGroupIds();
--- a/Player.cpp	Tue Dec 03 21:29:12 2013 +0200
+++ b/Player.cpp	Tue Dec 03 21:30:40 2013 +0200
@@ -3675,17 +3675,21 @@
     {
       if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) )
       {
-        PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)GetNthEquippedIndexItem(i)->GetPlayerSkillType();
-        int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType);
-        if ( currentItemSkillType == PLAYER_SKILL_BOW )
+        ItemGen* currItemPtr = GetNthEquippedIndexItem(i);
+        if ( currItemPtr->GetItemEquipType() == EQUIP_TWO_HANDED || currItemPtr->GetItemEquipType() == EQUIP_SINGLE_HANDED )
         {
-          int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 1, 1);
-          return multiplier * (currentItemSkillLevel & 0x3F);
-        }
-        else if ( currentItemSkillType == PLAYER_SKILL_BLASTER )
-        {      
-          int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5);
-          return multiplier * (currentItemSkillLevel & 0x3F);
+          PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)GetNthEquippedIndexItem(i)->GetPlayerSkillType();
+          int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType);
+          if ( currentItemSkillType == PLAYER_SKILL_BOW )
+          {
+            int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 1, 1, 1);
+            return multiplier * (currentItemSkillLevel & 0x3F);
+          }
+          else if ( currentItemSkillType == PLAYER_SKILL_BLASTER )
+          {
+            int multiplier = GetMultiplierForSkillLevel(currentItemSkillLevel, 1, 2, 3, 5);
+            return multiplier * (currentItemSkillLevel & 0x3F);
+          }
         }
       }
     }
--- a/SpriteObject.cpp	Tue Dec 03 21:29:12 2013 +0200
+++ b/SpriteObject.cpp	Tue Dec 03 21:30:40 2013 +0200
@@ -206,8 +206,8 @@
 //----- (00471C03) --------------------------------------------------------
 void SpriteObject::UpdateObject_fn0_ODM(unsigned int uLayingItemID)
 {
-  SpriteObject *v1; // esi@1
-  ObjectDesc *v2; // ebx@1
+  //SpriteObject *v1; // esi@1
+  ObjectDesc *object; // ebx@1
   signed int v3; // edx@1
   int v4; // ecx@1
   int v5; // ST04_4@1
@@ -268,26 +268,26 @@
   int v60; // [sp+A4h] [bp-4h]@11
 
   uLayingItemID_ = uLayingItemID;
-  v1 = &pSpriteObjects[uLayingItemID];
+  //v1 = &pSpriteObjects[uLayingItemID];
   v58 = 0;
-  v2 = &pObjectList->pObjects[v1->uObjectDescID];
-  v57 = IsTerrainSlopeTooHigh(v1->vPosition.x, v1->vPosition.y);
-  v3 = v1->vPosition.y;
-  v4 = v1->vPosition.x;
-  v5 = v2->uHeight;
+  object = &pObjectList->pObjects[pSpriteObjects[uLayingItemID].uObjectDescID];
+  v57 = IsTerrainSlopeTooHigh(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y);
+  v3 = pSpriteObjects[uLayingItemID].vPosition.y;
+  v4 = pSpriteObjects[uLayingItemID].vPosition.x;
+  v5 = object->uHeight;
   v55 = 0;
-  v6 = ODM_GetFloorLevel(v4, v3, v1->vPosition.z, v5, &on_water, &v55, 0);
+  v6 = ODM_GetFloorLevel(v4, v3, pSpriteObjects[uLayingItemID].vPosition.z, v5, &on_water, &v55, 0);
   v7 = v6;
   v54 = v6;
   v8 = v6 + 1;
-  if ( v1->vPosition.z <= v6 + 1 )
+  if ( pSpriteObjects[uLayingItemID].vPosition.z <= v6 + 1 )
   {
     if ( on_water )
     {
       v9 = v6 + 60;
       if ( v55 )
         v9 = v7 + 30;
-      sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v9);
+      sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v9);
       SpriteObject::OnInteraction(uLayingItemID_);
     }
   }
@@ -295,60 +295,59 @@
   {
     v58 = 1;
   }
-  v10 = v2->uFlags;
-  if ( !(v2->uFlags & OBJECT_DESC_NO_GRAVITY) )
+  v10 = object->uFlags;
+  if ( !(object->uFlags & OBJECT_DESC_NO_GRAVITY) )
   {
     if ( v58 )
     {
-      v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
+      pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
       goto LABEL_13;
     }
     if ( v57 )
     {
-      v11 = v1->vPosition.y;
-      v12 = v1->vPosition.x;
-      v1->vPosition.z = v8;
+      v11 = pSpriteObjects[uLayingItemID].vPosition.y;
+      v12 = pSpriteObjects[uLayingItemID].vPosition.x;
+      pSpriteObjects[uLayingItemID].vPosition.z = v8;
       ODM_GetTerrainNormalAt(v12, v11, &v51);
-      v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
-      v56 = abs(v51.y * v1->vVelocity.y + v51.z * v1->vVelocity.z + v51.x * v1->vVelocity.x) >> 16;
+      pSpriteObjects[uLayingItemID].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
+      v56 = abs(v51.y * pSpriteObjects[uLayingItemID].vVelocity.y + v51.z * pSpriteObjects[uLayingItemID].vVelocity.z + v51.x * pSpriteObjects[uLayingItemID].vVelocity.x) >> 16;
       //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
-      v1->vVelocity.x += fixpoint_mul(v56, v51.x);
+      pSpriteObjects[uLayingItemID].vVelocity.x += fixpoint_mul(v56, v51.x);
       //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
-      v1->vVelocity.y += fixpoint_mul(v56, v51.y);
+      pSpriteObjects[uLayingItemID].vVelocity.y += fixpoint_mul(v56, v51.y);
       //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
-      v1->vVelocity.z += fixpoint_mul(v56, v51.z);
-LABEL_12:
+      pSpriteObjects[uLayingItemID].vVelocity.z += fixpoint_mul(v56, v51.z);
       v7 = v54;
       goto LABEL_13;
     }
     if ( v10 & 0x40 )
     {
-      if ( v1->vPosition.z < v7 )
-        v1->vPosition.z = v8;
+      if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 )
+        pSpriteObjects[uLayingItemID].vPosition.z = v8;
       if ( !_46BFFA_check_object_intercept(uLayingItemID_, 0) )
         return;
     }
-    v1->vPosition.z = v8;
-    if ( !(v2->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -v1->vVelocity.z >> 1, v1->vVelocity.z = v21, (signed __int16)v21 < 10) )
-      v1->vVelocity.z = 0;
+    pSpriteObjects[uLayingItemID].vPosition.z = v8;
+    if ( !(object->uFlags & OBJECT_DESC_BOUNCE) || (v21 = -pSpriteObjects[uLayingItemID].vVelocity.z >> 1, pSpriteObjects[uLayingItemID].vVelocity.z = v21, (signed __int16)v21 < 10) )
+      pSpriteObjects[uLayingItemID].vVelocity.z = 0;
 
-    v1->vVelocity.x = fixpoint_mul(58500, v1->vVelocity.x);
-    v1->vVelocity.y = fixpoint_mul(58500, v1->vVelocity.y);
-    v1->vVelocity.z = fixpoint_mul(58500, v1->vVelocity.z);
+    pSpriteObjects[uLayingItemID].vVelocity.x = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.x);
+    pSpriteObjects[uLayingItemID].vVelocity.y = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.y);
+    pSpriteObjects[uLayingItemID].vVelocity.z = fixpoint_mul(58500, pSpriteObjects[uLayingItemID].vVelocity.z);
 
-    if ( (v1->vVelocity.y * v1->vVelocity.y + v1->vVelocity.x * v1->vVelocity.x) < 400 )
+    if ( (pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y + pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x) < 400 )
         {
 
-    v1->vVelocity.y = 0;
-    v1->vVelocity.x = 0;
+    pSpriteObjects[uLayingItemID].vVelocity.y = 0;
+    pSpriteObjects[uLayingItemID].vVelocity.x = 0;
     memset(&Dst, 0, 0x68u);
-    Dst.x = (double)v1->vPosition.x;
-    Dst.y = (double)v1->vPosition.y;
-    Dst.z = (double)v1->vPosition.z;
+    Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x;
+    Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y;
+    Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z;
     Dst.r = 0.0;
     Dst.g = 0.0;
     Dst.b = 0.0;
-    if (v2->uFlags & OBJECT_DESC_TRIAL_FIRE )
+    if (object->uFlags & OBJECT_DESC_TRIAL_FIRE )
     {
       Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
       Dst.uDiffuse = 0xFF3C1E;
@@ -357,7 +356,7 @@
       Dst.flt_28 = 1.0;
       pGame->pParticleEngine->AddParticle(&Dst);
     }
-    else if ( v2->uFlags & OBJECT_DESC_TRIAL_LINE)
+    else if ( object->uFlags & OBJECT_DESC_TRIAL_LINE)
     {
 
         Dst.type = ParticleType_Line;
@@ -367,7 +366,7 @@
         Dst.flt_28 = 1.0;
         pGame->pParticleEngine->AddParticle(&Dst);
       }
-    else if ( v2->uFlags & OBJECT_DESC_TRIAL_PARTICLE )
+    else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE )
         {
       Dst.type = ParticleType_Bitmap | ParticleType_8;
       Dst.uDiffuse = rand();
@@ -380,49 +379,49 @@
         }
   }
 LABEL_13:
-  if ( v1->vPosition.z > v7
-    && (v13 = v1->vPosition.x, v13 >= -0x8000)
+  if ( pSpriteObjects[uLayingItemID].vPosition.z > v7
+    && (v13 = pSpriteObjects[uLayingItemID].vPosition.x, v13 >= -0x8000)
     && v13 <= 0x8000
-    && (v14 = v1->vPosition.y, v14 >= -0x8000)
+    && (v14 = pSpriteObjects[uLayingItemID].vPosition.y, v14 >= -0x8000)
     && v14 <= 0x8000
-    && v1->vPosition.z <= 13000
-    || !(v2->uFlags & OBJECT_DESC_INTERACTABLE) )
+    && pSpriteObjects[uLayingItemID].vPosition.z <= 13000
+    || !(object->uFlags & OBJECT_DESC_INTERACTABLE) )
     goto LABEL_92;
-  if ( v1->vPosition.z < v7 )
-    v1->vPosition.z = v8;
+  if ( pSpriteObjects[uLayingItemID].vPosition.z < v7 )
+    pSpriteObjects[uLayingItemID].vPosition.z = v8;
   if ( _46BFFA_check_object_intercept(uLayingItemID_, 0) )
   {
 LABEL_92:
     stru_721530.field_0 = 0;
     v55 = 0;
-    stru_721530.prolly_normal_d = v2->uRadius;
-    stru_721530.height = v2->uHeight;
+    stru_721530.prolly_normal_d = object->uRadius;
+    stru_721530.height = object->uHeight;
     stru_721530.field_8_radius = 0;
     stru_721530.field_70 = 0;
     while ( 1 )
     {
-      stru_721530.position.x = v1->vPosition.x;
+      stru_721530.position.x = pSpriteObjects[uLayingItemID].vPosition.x;
       stru_721530.normal.x = stru_721530.position.x;
-      v15 = v1->vPosition.y;
+      v15 = pSpriteObjects[uLayingItemID].vPosition.y;
       stru_721530.uSectorID = 0;
       stru_721530.position.y = v15;
       stru_721530.normal.y = v15;
-      stru_721530.position.z = v1->vPosition.z + stru_721530.prolly_normal_d + 1;
+      stru_721530.position.z = pSpriteObjects[uLayingItemID].vPosition.z + stru_721530.prolly_normal_d + 1;
       stru_721530.normal.z = stru_721530.position.z;
-      stru_721530.velocity.x = v1->vVelocity.x;
-      stru_721530.velocity.y = v1->vVelocity.y;
-      stru_721530.velocity.z = v1->vVelocity.z;
+      stru_721530.velocity.x = pSpriteObjects[uLayingItemID].vVelocity.x;
+      stru_721530.velocity.y = pSpriteObjects[uLayingItemID].vVelocity.y;
+      stru_721530.velocity.z = pSpriteObjects[uLayingItemID].vVelocity.z;
       if ( stru_721530._47050A(0) )
         return;
       _46E889_collide_against_bmodels(0);
-      v16 = WorldPosToGridCellZ(v1->vPosition.y);
-      v18 = WorldPosToGridCellX(v1->vPosition.x);
+      v16 = WorldPosToGridCellZ(pSpriteObjects[uLayingItemID].vPosition.y);
+      v18 = WorldPosToGridCellX(pSpriteObjects[uLayingItemID].vPosition.x);
       _46E26D_collide_against_sprites(v18, v16);
-      if (PID_TYPE(v1->spell_caster_pid) != OBJECT_Player)
+      if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) != OBJECT_Player)
         _46EF01_collision_chech_player(0);
-      if (PID_TYPE(v1->spell_caster_pid) == OBJECT_Actor)
+      if (PID_TYPE(pSpriteObjects[uLayingItemID].spell_caster_pid) == OBJECT_Actor)
       {
-        v19 = PID_ID(v1->spell_caster_pid);
+        v19 = PID_ID(pSpriteObjects[uLayingItemID].spell_caster_pid);
         if (( v19 >= 0 )&&( v19 < (signed int)(uNumActors - 1) ))
         {
          
@@ -441,38 +440,32 @@
           Actor::_46DF1A_collide_against_actor(i, 0);
       }
       v26 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
-      v27 = ODM_GetFloorLevel(
-              stru_721530.normal2.x,
-              stru_721530.normal2.y,
-              stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
-              v2->uHeight,
-              &v49,
-              &v50,
-              0);
+      v27 = ODM_GetFloorLevel( stru_721530.normal2.x, stru_721530.normal2.y, stru_721530.normal2.z - stru_721530.prolly_normal_d - 1,
+              object->uHeight, &v49, &v50, 0);
       if ( on_water && v26 < v27 + 60 )
       {
         if ( v50 )
           v44 = v27 + 30;
         else
           v44 = v54 + 60;
-        sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v44);
+        sub_42F960_create_object(pSpriteObjects[uLayingItemID].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y, v44);
         SpriteObject::OnInteraction(uLayingItemID_);
         return;
       }
       if ( stru_721530.field_7C >= stru_721530.field_6C )
       {
-        v1->vPosition.x = stru_721530.normal2.x;
-        v1->vPosition.y = stru_721530.normal2.y;
-        v1->vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
-        v1->uSectorID = LOWORD(stru_721530.uSectorID);
+        pSpriteObjects[uLayingItemID].vPosition.x = stru_721530.normal2.x;
+        pSpriteObjects[uLayingItemID].vPosition.y = stru_721530.normal2.y;
+        pSpriteObjects[uLayingItemID].vPosition.z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
+        pSpriteObjects[uLayingItemID].uSectorID = LOWORD(stru_721530.uSectorID);
         memset(&Dst, 0, 0x68u);
-        Dst.x = (double)v1->vPosition.x;
-        Dst.y = (double)v1->vPosition.y;
-        Dst.z = (double)v1->vPosition.z;
+        Dst.x = (double)pSpriteObjects[uLayingItemID].vPosition.x;
+        Dst.y = (double)pSpriteObjects[uLayingItemID].vPosition.y;
+        Dst.z = (double)pSpriteObjects[uLayingItemID].vPosition.z;
         Dst.r = 0.0;
         Dst.g = 0.0;
         Dst.b = 0.0;
-        if ( v2->uFlags & OBJECT_DESC_TRIAL_FIRE )
+        if ( object->uFlags & OBJECT_DESC_TRIAL_FIRE )
         {
           Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8;
           Dst.uDiffuse = 0xFF3C1E;
@@ -482,7 +475,7 @@
           pGame->pParticleEngine->AddParticle(&Dst);
           return;
         }
-        else if ( v2->uFlags & OBJECT_DESC_TRIAL_LINE )
+        else if ( object->uFlags & OBJECT_DESC_TRIAL_LINE )
         {
           Dst.type = ParticleType_Line;
           Dst.uTextureID = 0;
@@ -492,31 +485,31 @@
           pGame->pParticleEngine->AddParticle(&Dst);
           return;
         }
-        else if ( v2->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
-            { 
-            Dst.type = ParticleType_Bitmap | ParticleType_8;
-            Dst.uDiffuse = rand();         
-            Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
-            Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
-            Dst.flt_28 = 1.0;
-            pGame->pParticleEngine->AddParticle(&Dst);
-            }
+        else if ( object->uFlags & OBJECT_DESC_TRIAL_PARTICLE)
+        {
+          Dst.type = ParticleType_Bitmap | ParticleType_8;
+          Dst.uDiffuse = rand();
+          Dst.timeToLive = (unsigned __int8)(rand() & 0x80) + 128;
+          Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT);
+          Dst.flt_28 = 1.0;
+          pGame->pParticleEngine->AddParticle(&Dst);
+        }
         return;
       }
       //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16);
-      v1->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
+      pSpriteObjects[uLayingItemID].vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
       //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16);
-      v1->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
+      pSpriteObjects[uLayingItemID].vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
       //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16);
       v28 = LOWORD(stru_721530.uSectorID);
-      v1->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
-      v29 = v1->vPosition.z;
-      v1->uSectorID = v28;
+      pSpriteObjects[uLayingItemID].vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
+      v29 = pSpriteObjects[uLayingItemID].vPosition.z;
+      pSpriteObjects[uLayingItemID].uSectorID = v28;
       stru_721530.field_70 += stru_721530.field_7C;
-      if ( v2->uFlags & OBJECT_DESC_INTERACTABLE )
+      if ( object->uFlags & OBJECT_DESC_INTERACTABLE )
       {
         if ( v29 < v54 )
-          v1->vPosition.z = v54 + 1;
+          pSpriteObjects[uLayingItemID].vPosition.z = v54 + 1;
         if ( !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) )
           return;
       }
@@ -529,8 +522,8 @@
         v32 = &v31->pFaces[v30 & 0x3F];
         if ( v32->uPolygonType != 3 )
         {
-          v56 = abs(v32->pFacePlane.vNormal.z * v1->vVelocity.z + v32->pFacePlane.vNormal.y * v1->vVelocity.y
-                                                                + v32->pFacePlane.vNormal.x * v1->vVelocity.x) >> 16;
+          v56 = abs(v32->pFacePlane.vNormal.z * pSpriteObjects[uLayingItemID].vVelocity.z + v32->pFacePlane.vNormal.y * pSpriteObjects[uLayingItemID].vVelocity.y
+                                                                + v32->pFacePlane.vNormal.x * pSpriteObjects[uLayingItemID].vVelocity.x) >> 16;
           if ( (stru_721530.speed >> 3) > v56 )
             v56 = stru_721530.speed >> 3;
           v57 = v32->pFacePlane.vNormal.x;
@@ -538,8 +531,8 @@
           v58 = v32->pFacePlane.vNormal.y;
           v58 = (unsigned __int64)(v56 * (signed __int64)v58) >> 16;
           v60 = ((unsigned __int64)(v56 * (signed __int64)v32->pFacePlane.vNormal.z) >> 16);
-          v1->vVelocity.x += 2 * v57;
-          v1->vVelocity.y += 2 * v58;
+          pSpriteObjects[uLayingItemID].vVelocity.x += 2 * v57;
+          pSpriteObjects[uLayingItemID].vVelocity.y += 2 * v58;
           if ( v32->pFacePlane.vNormal.z <= 32000 )
           {
             v37 = 2 * (short)v60;
@@ -547,30 +540,33 @@
           else
           {
             v36 = v60;
-            v1->vVelocity.z += (signed __int16)v60;
+            pSpriteObjects[uLayingItemID].vVelocity.z += (signed __int16)v60;
             v58 = (unsigned __int64)(32000 * (signed __int64)(signed int)v36) >> 16;
             v37 = (unsigned int)(32000 * v36) >> 16;
           }
-          v1->vVelocity.z += v37;
-LABEL_70:
+          pSpriteObjects[uLayingItemID].vVelocity.z += v37;
           if ( BYTE3(v32->uAttributes) & 0x10 )
             EventProcessor(v32->sCogTriggeredID, 0, 1);
           goto LABEL_74;
         }
         v33 = v31->pVertices.pVertices[v32->pVertexIDs[0]].z;
-        v34 = v1->vVelocity.x;
-        v1->vPosition.z = v33 + 1;
-        if ( v1->vVelocity.y * v1->vVelocity.y + v34 * v34 >= 400 )
-          goto LABEL_70;
+        v34 = pSpriteObjects[uLayingItemID].vVelocity.x;
+        pSpriteObjects[uLayingItemID].vPosition.z = v33 + 1;
+        if ( pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y + v34 * v34 >= 400 )
+        {
+          if ( BYTE3(v32->uAttributes) & 0x10 )
+            EventProcessor(v32->sCogTriggeredID, 0, 1);
+          goto LABEL_74;
+        }
         LOWORD(v35) = 0;
-        v1->vVelocity.z = 0;
-        v1->vVelocity.x = 0;
-        goto LABEL_73;
+        pSpriteObjects[uLayingItemID].vVelocity.z = 0;
+        pSpriteObjects[uLayingItemID].vVelocity.x = 0;
+        pSpriteObjects[uLayingItemID].vVelocity.y = v35;
       }
 LABEL_74:
-      v1->vVelocity.x = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.x) >> 16);
-      v1->vVelocity.y = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.y) >> 16);
-      v1->vVelocity.z = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)v1->vVelocity.z) >> 16);
+      pSpriteObjects[uLayingItemID].vVelocity.x = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)pSpriteObjects[uLayingItemID].vVelocity.x) >> 16);
+      pSpriteObjects[uLayingItemID].vVelocity.y = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)pSpriteObjects[uLayingItemID].vVelocity.y) >> 16);
+      pSpriteObjects[uLayingItemID].vVelocity.z = (signed __int16)((unsigned __int64)(58500i64 * (signed __int64)(signed int)pSpriteObjects[uLayingItemID].vVelocity.z) >> 16);
 
       ++v55;
       //v43 = __OFSUB__(v55, 100);
@@ -578,22 +574,19 @@
       if (v55>=100 )//!(v42 ^ v43) 
         return;
     }
-    v57 = integer_sqrt(v1->vVelocity.y * v1->vVelocity.y + v1->vVelocity.x * v1->vVelocity.x);
-    v38 = stru_5C6E00->Atan2(
-            v1->vPosition.x - pLevelDecorations[v30].vPosition.x,
-            v1->vPosition.y - pLevelDecorations[v30].vPosition.y);
+    v57 = integer_sqrt(pSpriteObjects[uLayingItemID].vVelocity.y * pSpriteObjects[uLayingItemID].vVelocity.y + pSpriteObjects[uLayingItemID].vVelocity.x * pSpriteObjects[uLayingItemID].vVelocity.x);
+    v38 = stru_5C6E00->Atan2(pSpriteObjects[uLayingItemID].vPosition.x - pLevelDecorations[v30].vPosition.x, pSpriteObjects[uLayingItemID].vPosition.y - pLevelDecorations[v30].vPosition.y);
     v56 = v38;
     v39 = stru_5C6E00->Cos(v38);
    // v60 = v39;
     v40 = v39 * (signed __int64)v57;
     v58 = v40 >> 16;
-    v1->vVelocity.x = WORD1(v40);
+    pSpriteObjects[uLayingItemID].vVelocity.x = WORD1(v40);
     v41 = stru_5C6E00->Sin(v56 - stru_5C6E00->uIntegerHalfPi);
    // v60 = v41;
     v35 = (unsigned __int64)(v41 * (signed __int64)v57) >> 16;
     v58 = v35;
-LABEL_73:
-    v1->vVelocity.y = v35;
+    pSpriteObjects[uLayingItemID].vVelocity.y = v35;
     goto LABEL_74;
   }
 }
--- a/mm7_3.cpp	Tue Dec 03 21:29:12 2013 +0200
+++ b/mm7_3.cpp	Tue Dec 03 21:30:40 2013 +0200
@@ -3853,7 +3853,7 @@
     RespawnGlobalDecorations();
   }
   pOutdoor->PrepareDecorations();
-  pOutdoor->_47F223_LooksLikeGenerateMonsterLoot();
+  pOutdoor->ArrangeSpriteObjects();
   pOutdoor->InitalizeActors(v2);
   pOutdoor->MessWithLUN();
   v7 = strlen("levels\\");
--- a/mm7_4.cpp	Tue Dec 03 21:29:12 2013 +0200
+++ b/mm7_4.cpp	Tue Dec 03 21:30:40 2013 +0200
@@ -931,7 +931,7 @@
       if (!pPlayers[pBuf->uCaster]->CanAct())
       {
         pBuf->Reset();
-        if (dword_4EE07C[i] == 7 )
+        if (dword_4EE07C[i] == PARTY_BUFF_FLY )
           pParty->bFlying = false;
       }
     }
--- a/mm7_data.cpp	Tue Dec 03 21:29:12 2013 +0200
+++ b/mm7_data.cpp	Tue Dec 03 21:30:40 2013 +0200
@@ -1234,8 +1234,8 @@
 std::array<int, 20> dword_720E80;
 std::array<int, 20> dword_720ED0;
 std::array<int, 20> ceiling_height_level;
-std::array<__int16, 777> word_720F70; // idb
-std::array<__int16, 777> word_721040; // idb
+std::array<__int16, 777> FloorFaceVertCoord_Y; // idb
+std::array<__int16, 777> FloorFaceVertCoord_X; // idb
 std::array<int, 777> dword_721110; // idb
 std::array<int, 777> dword_721160; // idb
 std::array<int, 20> odm_floor_level; // idb
--- a/mm7_data.h	Tue Dec 03 21:29:12 2013 +0200
+++ b/mm7_data.h	Tue Dec 03 21:30:40 2013 +0200
@@ -907,8 +907,8 @@
 extern std::array<int, 20> dword_720E80;
 extern std::array<int, 20> dword_720ED0;
 extern std::array<int, 20> ceiling_height_level;
-extern std::array<__int16, 777> word_720F70; // idb
-extern std::array<__int16, 777> word_721040; // idb
+extern std::array<__int16, 777> FloorFaceVertCoord_Y; // idb
+extern std::array<__int16, 777> FloorFaceVertCoord_X; // idb
 extern std::array<int, 777> dword_721110; // idb
 extern std::array<int, 777> dword_721160; // idb
 extern std::array<int, 20> odm_floor_level; // idb dword_7211B0