changeset 430:58b71c1af7d8

Objects are drawn (items, spells sfx)
author Nomad
date Sun, 24 Feb 2013 00:54:25 +0200
parents 49d945ce4285
children 8c45cac1c5e1
files LayingItem.cpp LayingItem.h ObjectList.h Outdoor.cpp Render.cpp Render.h mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp stru6.cpp
diffstat 13 files changed, 136 insertions(+), 128 deletions(-) [+]
line wrap: on
line diff
--- a/LayingItem.cpp	Sat Feb 23 23:04:00 2013 +0200
+++ b/LayingItem.cpp	Sun Feb 24 00:54:25 2013 +0200
@@ -107,7 +107,7 @@
 
 
 //----- (0042F933) --------------------------------------------------------
-void LayingItem::_42F933(unsigned int uLayingItemID)
+void LayingItem::OnItemPickup(unsigned int uLayingItemID)
 {
   unsigned int v1; // ecx@1
   unsigned __int16 *pAttributes; // ecx@2
--- a/LayingItem.h	Sat Feb 23 23:04:00 2013 +0200
+++ b/LayingItem.h	Sun Feb 24 00:54:25 2013 +0200
@@ -2,11 +2,18 @@
 #include "VectorTypes.h"
 #include "Items.h"
 
+enum
+{
+  OBJECT_ATTACHED_TO_ACTOR = 0x80,
+};
+
 
 /*   72 */
 #pragma pack(push, 1)
 struct LayingItem
 {
+  inline bool AttachedToActor() const {return uAttributes & OBJECT_ATTACHED_TO_ACTOR;}
+
   LayingItem();
   int Create(int yaw, int pitch, int a4, int a5);
   void _46BEF1_apply_spells();
@@ -14,7 +21,7 @@
 
   static void UpdateObject_fn0_BLV(unsigned int uLayingItemID);
   static void UpdateObject_fn0_ODM(unsigned int uLayingItemID);
-  static void _42F933(unsigned int uLayingItemID);
+  static void OnItemPickup(unsigned int uLayingItemID);
 
 
   unsigned __int16 uItemType;
@@ -27,7 +34,7 @@
   __int16 uSectorID;
   unsigned __int16 uSpriteFrameID;
   __int16 field_20;
-  __int16 field_22;
+  __int16 field_22_glow_radius_multiplier;
   struct ItemGen stru_24;
   int field_48;
   int field_4C;
--- a/ObjectList.h	Sat Feb 23 23:04:00 2013 +0200
+++ b/ObjectList.h	Sun Feb 24 00:54:25 2013 +0200
@@ -26,6 +26,8 @@
 #pragma pack(push, 1)
 struct ObjectDesc
 {
+  inline bool NoSprite() const {return uFlags & OBJECT_DESC_NO_SPRITE;}
+
   char field_0[32];
   __int16 uObjectID;
   __int16 uRadius;
--- a/Outdoor.cpp	Sat Feb 23 23:04:00 2013 +0200
+++ b/Outdoor.cpp	Sun Feb 24 00:54:25 2013 +0200
@@ -131,9 +131,9 @@
   uNumSpritesDrawnThisFrame = 0;
   uNumBillboardsToDraw = 0;
 
-  PrepareActorsDrawList();
+  /*PrepareActorsDrawList();
   if (!pOutdoorCamera->bDoNotRenderDecorations)
-    pRenderer->PrepareDecorationsRenderList_ODM();
+    pRenderer->PrepareDecorationsRenderList_ODM();*/
 
   pRenderer->DrawLayingItems_Shooting_Magic_ODM();
   pRenderer->TransformBillboardsAndSetPalettesODM();
@@ -2223,14 +2223,11 @@
   pGameLoadingUI_ProgressBar->Progress();
 
   memcpy(&uNumLayingItems, pSrc, 4);
-  //v93 = (char *)v92 + 4;
-  if (uNumLayingItems > 1000)
-    MessageBoxW(nullptr, L"Can't load file!",
-                L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odmap.cpp:954", 0);
+  assert(uNumLayingItems <= 1000 && "Too many objects");
+  assert(sizeof(LayingItem) == 112);
 
   pGameLoadingUI_ProgressBar->Progress();
 
-  assert(sizeof(LayingItem) == 112);
   //pFilename = (char *)(112 * uNumLayingItems);
   memcpy(pLayingItems, pSrc + 4, uNumLayingItems * sizeof(LayingItem));
   pSrc += 4 + uNumLayingItems * sizeof(LayingItem);
@@ -3111,9 +3108,9 @@
         }
         v28->uScreenSpaceX = v27;
         v28->uScreenSpaceY = v46;
-        v28->some_x = x;
-        v28->some_y = y;
-        v28->some_z = z;
+        v28->world_x = x;
+        v28->world_y = y;
+        v28->world_z = z;
         HIWORD(v34) = HIWORD(X);
         LOWORD(v34) = 0;
         v28->uPaletteSubindex = 0;
--- a/Render.cpp	Sat Feb 23 23:04:00 2013 +0200
+++ b/Render.cpp	Sun Feb 24 00:54:25 2013 +0200
@@ -3053,17 +3053,17 @@
 void Render::DrawLayingItems_Shooting_Magic_ODM()
 {
   //char *v0; // edi@2
-  ObjectDesc *v1; // ebx@4
+  //ObjectDesc *v1; // ebx@4
   __int16 v2; // cx@5
   RenderBillboard *v3; // esi@10
   SpriteFrame *v4; // eax@10
-  SpriteFrame *v5; // ebx@10
+  //SpriteFrame *v5; // ebx@10
   unsigned int v6; // eax@10
-  int v7; // ecx@10
-  int v8; // edx@10
+  //int v7; // ecx@10
+  //int v8; // edx@10
   int v9; // ecx@10
   unsigned __int16 v10; // ax@10
-  int *v11; // eax@14
+  //int *v11; // eax@14
   int v12; // eax@22
   int v13; // ST3C_4@23
   int v14; // eax@23
@@ -3080,8 +3080,8 @@
   int v25; // ST3C_4@30
   int v26; // eax@31
   char v27; // zf@31
-  SpriteFrame *v28; // [sp+Ch] [bp-34h]@10
-  __int16 a5; // [sp+10h] [bp-30h]@10
+  //SpriteFrame *v28; // [sp+Ch] [bp-34h]@10
+  //__int16 a5; // [sp+10h] [bp-30h]@10
   int v30; // [sp+14h] [bp-2Ch]@23
   int v31; // [sp+14h] [bp-2Ch]@29
   __int16 v32; // [sp+14h] [bp-2Ch]@30
@@ -3103,56 +3103,61 @@
   //v41 = 0;
   for (int i = 0; i < uNumLayingItems; ++i)
   {
-    auto v0 = (char *)&pLayingItems[i].uSectorID;
+    auto object = pLayingItems + i;
+    //auto v0 = (char *)&pLayingItems[i].uSectorID;
     //v0 = (char *)&pLayingItems[0].uSectorID;
     //do
     //{
-      if ( *((short *)v0 - 13) )
-      {
-        v1 = &pObjectList->pObjects[*((short *)v0 - 13)];
-        if ( !(v1->uFlags & 1) )
-        {
-          if ( ((v2 = *((short *)v0 - 14), v2 < 1000) || v2 >= 10000) && (v2 < 500 || v2 >= 600)
-            || pGame->pStru6Instance->_4A81CA((LayingItem *)(v0 - 28)) )
-          {
-            a5 = *(short *)v0;
-            x = *((int *)v0 - 6);
-            y = *((int *)v0 - 5);
-            z = *((int *)v0 - 4);
-            v3 = &pBillboardRenderList[::uNumBillboardsToDraw];
-            v4 = pSpriteFrameTable->GetFrame(v1->uSpriteID, *((short *)v0 + 1));
-            v5 = v4;
-            v28 = v4;
-            v36 = v4->uFlags;
-            a6 = v4->uGlowRadius * *((short *)v0 + 3);
-            v6 = stru_5C6E00->Atan2(
-                   *((int *)v0 - 6) - pIndoorCamera->pos.x,
-                   *((int *)v0 - 5) - pIndoorCamera->pos.y);
-            LOWORD(v7) = *((short *)v0 - 3);
-            v8 = v36;
-            v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7;
-            v10 = v5->pHwSpriteIDs[v9];
+    if (!object->uObjectDescID)  // item probably pciked up
+      continue;
+
+    assert(object->uObjectDescID < pObjectList->uNumObjects);
+    auto object_desc = pObjectList->pObjects + object->uObjectDescID;
+    if (object_desc->NoSprite())
+      continue;
+
+        //v1 = &pObjectList->pObjects[*((short *)v0 - 13)];
+        //if ( !(v1->uFlags & 1) )
+        //{
+          //v2 = *((short *)v0 - 14)
+    v2 = object->uItemType;
+    if ( (v2 < 1000 || v2 >= 10000) && (v2 < 500 || v2 >= 600) || pGame->pStru6Instance->_4A81CA(object) )
+    {
+            //a5 = *(short *)v0;
+      x = object->vPosition.x;
+      y = object->vPosition.y;
+      z = object->vPosition.z;
+      v3 = &pBillboardRenderList[::uNumBillboardsToDraw];
+      v4 = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID);
+      //v5 = v4;
+      //v28 = v4;
+      v36 = v4->uFlags;
+      a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier;
+      v6 = stru_5C6E00->Atan2(object->vPosition.x - pIndoorCamera->pos.x, object->vPosition.y - pIndoorCamera->pos.y);
+      //LOWORD(v7) = object->uFacing;
+      //v8 = v36;
+            v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7;
+            v10 = v4->pHwSpriteIDs[v9];
             v3->uHwSpriteID = v10;
             if ( v36 & 0x20 )
             {
-              v8 = v36;
-              z -= (signed int)((unsigned __int64)(v5->scale
-                                                 * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1;
+              //v8 = v36;
+              z -= (signed int)((unsigned __int64)(v4->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1;
             }
             v46 = 0;
-            if ( v8 & 2 )
+            if ( v36 & 2 )
               v46 = 2;
-            v11 = (int *)(256 << v9);
-            if ( (256 << v9) & v8 )
+            //v11 = (int *)(256 << v9);
+            if ( (256 << v9) & v36 )
               v46 |= 4u;
-            if ( v8 & 0x40000 )
+            if ( v36 & 0x40000 )
               v46 |= 0x40u;
-            if ( v8 & 0x20000 )
+            if ( v36 & 0x20000 )
               LOBYTE(v46) = v46 | 0x80;
             if ( a6 )
             {
-              LOBYTE(v11) = byte_4E94D3;
-              pMobileLightsStack->AddLight(x, y, z, a5, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3);
+              //LOBYTE(v11) = byte_4E94D3;
+              pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3);
             }
             v12 = (x - pIndoorCamera->pos.x) << 16;
             if ( pIndoorCamera->sRotationX )
@@ -3185,12 +3190,9 @@
               v42 = v20 + v19;
               if ( v20 + v19 >= 262144 && v16 <= pOutdoorCamera->shading_dist_mist << 16 )
               {
-                v21 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16)
-                                       * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16;
-                v17 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16)
-                    - v21;
-                v40 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16)
-                    - v21;
+                v21 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16;
+                v17 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21;
+                v40 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21;
                 v18 = (z - pIndoorCamera->pos.z) << 16;
 LABEL_29:
                 v31 = v18;
@@ -3203,30 +3205,31 @@
                   v25 = v23 / v42;
                   LODWORD(v23) = 0;
                   HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad);
-                  v35 = pViewport->uScreenCenterX
-                      - ((signed int)(((unsigned __int64)(v25 * (signed __int64)v40) >> 16) + 32768) >> 16);
-                  v32 = LOWORD(pViewport->uScreenCenterY)
-                      - (((unsigned int)((unsigned __int64)(v23 / v42 * v31) >> 16) + 32768) >> 16);
-                  if (::uNumBillboardsToDraw >= 500)
-                    return;
+                  v35 = pViewport->uScreenCenterX - ((signed int)(((unsigned __int64)(v25 * (signed __int64)v40) >> 16) + 32768) >> 16);
+                  v32 = LOWORD(pViewport->uScreenCenterY) - (((unsigned int)((unsigned __int64)(v23 / v42 * v31) >> 16) + 32768) >> 16);
+
+                  //if (::uNumBillboardsToDraw >= 500)
+                  //  return;
+                  assert(::uNumBillboardsToDraw < 500);
                   ++::uNumBillboardsToDraw;
                   ++uNumSpritesDrawnThisFrame;
-                  *(v0 - 2) |= 1u;
-                  v3->uPalette = v28->uPaletteIndex;
-                  v3->uIndoorSectorID = a5;
-                  v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v28->scale * (signed __int64)v24) >> 16;
-                  v26 = (unsigned __int64)(v28->scale * (signed __int64)v24) >> 16;
-                  v3->pSpriteFrame = v28;
+
+                  object->uAttributes |= 1;
+                  v3->uPalette = v4->uPaletteIndex;
+                  v3->uIndoorSectorID = object->uSectorID;
+                  v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16;
+                  v26 = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16;
+                  v3->pSpriteFrame = v4;
                   v3->_screenspace_y_scaler_packedfloat = v26;
                   v3->field_1E = v46;
-                  v3->some_x = x;
-                  v3->some_y = y;
-                  v3->some_z = z;
+                  v3->world_x = x;
+                  v3->world_y = y;
+                  v3->world_z = z;
                   v3->uScreenSpaceX = v35;
                   v3->uScreenSpaceY = v32;
                   HIWORD(v26) = HIWORD(v42);
                   LOWORD(v26) = 0;
-                  v27 = (*(v0 - 2) & 0x20) == 0;
+                  v27 = (object->uAttributes & 0x20) == 0;
                   v3->sZValue = v26 + (8 * i | OBJECT_Item);
                   v3->uPaletteSubindex = 0;
                   v3->uTintColor = 0;
@@ -3240,8 +3243,7 @@
               }
             }
           }
-        }
-      }
+        //}
 LABEL_34:
       ;
       //++v41;
@@ -3659,9 +3661,9 @@
                     HIBYTE(v29) |= 2u;
                     v27->uPalette = v28;
                     v27->field_1E = v29;
-                    v27->some_x = x;
-                    v27->some_y = y;
-                    v27->some_z = v36;
+                    v27->world_x = x;
+                    v27->world_y = y;
+                    v27->world_z = v36;
                     v27->uScreenSpaceY = v40;
                     HIWORD(v30) = HIWORD(v39);
                     v31 = 8 * i | OBJECT_Decoration;
--- a/Render.h	Sat Feb 23 23:04:00 2013 +0200
+++ b/Render.h	Sun Feb 24 00:54:25 2013 +0200
@@ -70,9 +70,9 @@
   __int16 uPalette;
   __int16 uIndoorSectorID;
   __int16 field_1E;
-  __int16 some_x;
-  __int16 some_y;
-  __int16 some_z;
+  __int16 world_x;
+  __int16 world_y;
+  __int16 world_z;
   __int16 uScreenSpaceX;
   __int16 uScreenSpaceY;
   unsigned __int16 uPaletteSubindex;
--- a/mm7_1.cpp	Sat Feb 23 23:04:00 2013 +0200
+++ b/mm7_1.cpp	Sun Feb 24 00:54:25 2013 +0200
@@ -5251,7 +5251,7 @@
         if ( !pParty->AddItem(v22) )
           pParty->SetHoldingItem(v22);
       }
-      LayingItem::_42F933(a2.y);
+      LayingItem::OnItemPickup(a2.y);
       return;
     }
     goto LABEL_13;
--- a/mm7_2.cpp	Sat Feb 23 23:04:00 2013 +0200
+++ b/mm7_2.cpp	Sun Feb 24 00:54:25 2013 +0200
@@ -15155,7 +15155,7 @@
   v2 = a1;
   switch ( a1 & 7 )
   {
-    case OBJECT_Item:
+    case OBJECT_Item: // take the item
       v17 = a1 >> 3;
       v26 = a1 >> 3;
       v18 = a1 >> 3;
@@ -15165,7 +15165,7 @@
         return 1;
       v19 = &pLayingItems[v18].stru_24;
       v20 = pLayingItems[v18].stru_24.uItemID;
-      if ( pItemsTable->pItems[v20].uEquipType == 18 )
+      if ( pItemsTable->pItems[v20].uEquipType == EQUIP_GOLD)
       {
         party_finds_gold(v19->uSpecEnchantmentType, 0);
         viewparams->bRedrawGameUI = 1;
@@ -15186,7 +15186,7 @@
           pParty->SetHoldingItem(v19);
         v21 = v26;
       }
-      LayingItem::_42F933(v21);
+      LayingItem::OnItemPickup(v21);
       break;
 
     case OBJECT_Actor:
@@ -16117,7 +16117,7 @@
             }
             v2->uObjectDescID = v112;
             if ( !v112 )
-              LayingItem::_42F933(v153);
+              LayingItem::OnItemPickup(v153);
             v2->vVelocity.z = 0;
             v2->vVelocity.y = 0;
             v2->vVelocity.x = 0;
@@ -16140,7 +16140,7 @@
             goto LABEL_269;
           }
 LABEL_246:
-          LayingItem::_42F933(v153);
+          LayingItem::OnItemPickup(v153);
           return 0;
         }
         v106 = v145;
@@ -16287,7 +16287,7 @@
             }
             v2->uObjectDescID = v58;
             if ( !v58 )
-              LayingItem::_42F933(v153);
+              LayingItem::OnItemPickup(v153);
             v14 = v153;
             v2->vVelocity.z = 0;
             v2->vVelocity.y = 0;
@@ -16343,7 +16343,7 @@
           }
           v2->uObjectDescID = v63;
           if ( !v63 )
-            LayingItem::_42F933(v153);
+            LayingItem::OnItemPickup(v153);
           v64 = v2->uFacing - stru_5C6E00->uIntegerDoublePi;
           v44 = v2->field_50 == 4;
           v2->vVelocity.z = 0;
@@ -16366,7 +16366,7 @@
 LABEL_160:
           v14 = v153;
 LABEL_34:
-          LayingItem::_42F933(v14);
+          LayingItem::OnItemPickup(v14);
           goto LABEL_35;
         }
         if ( v151 == 6 || v151 == 5 || (v66 = 0, !v151) )
@@ -16396,7 +16396,7 @@
         }
         v2->uObjectDescID = v71;
         if ( !v71 )
-          LayingItem::_42F933(v153);
+          LayingItem::OnItemPickup(v153);
         v134 = 0;
         v72 = v153;
         v132 = 0;
@@ -16452,7 +16452,7 @@
         }
         v2->uObjectDescID = v88;
         if ( !v88 )
-          LayingItem::_42F933(v153);
+          LayingItem::OnItemPickup(v153);
         v89 = v2->uFacing - stru_5C6E00->uIntegerDoublePi;
         v2->vVelocity.z = 0;
         v2->vVelocity.y = 0;
@@ -16499,7 +16499,7 @@
         }
         v2->uObjectDescID = v83;
         if ( !v83 )
-          LayingItem::_42F933(v153);
+          LayingItem::OnItemPickup(v153);
         v134 = 0;
         v72 = v153;
         v132 = v2->field_61;
@@ -16544,7 +16544,7 @@
 LABEL_42:
       v2->uObjectDescID = v22;
       if ( v22 == v18 )
-        LayingItem::_42F933(v153);
+        LayingItem::OnItemPickup(v153);
       v2->vVelocity.z = v18;
       v2->vVelocity.y = v18;
       v2->vVelocity.x = v18;
@@ -16621,7 +16621,7 @@
 LABEL_24:
       v2->uObjectDescID = v12;
       if ( !v12 )
-        LayingItem::_42F933(v153);
+        LayingItem::OnItemPickup(v153);
       v44 = v2->uItemType == 555;
       v2->vVelocity.z = 0;
       v2->vVelocity.y = 0;
@@ -16672,7 +16672,7 @@
 LABEL_182:
     v2->uObjectDescID = v95;
     if ( v95 == (short)v9 )
-      LayingItem::_42F933(v153);
+      LayingItem::OnItemPickup(v153);
     v96 = v2->uSoundID;
     v2->vVelocity.z = v9;
     v2->vVelocity.y = v9;
@@ -16717,7 +16717,7 @@
     }
     v2->uObjectDescID = v36;
     if ( !v36 )
-      LayingItem::_42F933(v153);
+      LayingItem::OnItemPickup(v153);
     v37 = v2->vPosition.z;
     v2->vVelocity.z = 0;
     v38 = 8 * v153;
@@ -16774,7 +16774,7 @@
 LABEL_196:
         v2->uObjectDescID = v46;
         if ( v46 == (short)v32 )
-          LayingItem::_42F933(v153);
+          LayingItem::OnItemPickup(v153);
         v100 = v2->field_61;
         v101 = v2->vPosition.z;
         v2->uSpriteFrameID = v32;
@@ -16862,7 +16862,7 @@
   }
   v2->uObjectDescID = v121;
   if ( !v121 )
-    LayingItem::_42F933(v153);
+    LayingItem::OnItemPickup(v153);
   v2->vVelocity.z = 0;
   v2->vVelocity.y = 0;
   v2->vVelocity.x = 0;
--- a/mm7_3.cpp	Sat Feb 23 23:04:00 2013 +0200
+++ b/mm7_3.cpp	Sun Feb 24 00:54:25 2013 +0200
@@ -1448,7 +1448,7 @@
          (v1->uSectorID = v4) == 0)
      || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v4, &uFaceID), v42 == -30000)) )
   {
-    LayingItem::_42F933(uLayingItemID_);
+    LayingItem::OnItemPickup(uLayingItemID_);
     return;
   }
   v5 = v2->uFlags;
@@ -1844,7 +1844,7 @@
       if ( v55 )
         v9 = v7 + 30;
       sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v9);
-      LayingItem::_42F933(uLayingItemID_);
+      LayingItem::OnItemPickup(uLayingItemID_);
       v7 = v54;
     }
   }
@@ -2035,7 +2035,7 @@
         else
           v44 = v54 + 60;
         sub_42F960_create_object(v1->vPosition.x, v1->vPosition.y, v44);
-        LayingItem::_42F933(uLayingItemID_);
+        LayingItem::OnItemPickup(uLayingItemID_);
         return;
       }
       if ( stru_721530.field_7C >= stru_721530.field_6C )
@@ -2223,9 +2223,9 @@
     {
               //v3 = item->uObjectDescID;
       v4 = &pObjectList->pObjects[item->uObjectDescID];
-      if (item->uAttributes)
-      {
-          v5 = *(int *)(v2 + 62) >> 3;
+      if (item->AttachedToActor())
+      {
+          v5 = item->field_5C >> 3;
           *(int *)(v2 - 26) = pActors[v5].vPosition.x;
           *(int *)(v2 - 22) = pActors[v5].vPosition.y;
           *(int *)(v2 - 18) = pActors[v5].vPosition.z + pActors[v5].uActorHeight;
@@ -2253,7 +2253,7 @@
           {
             v10 = i;
 LABEL_35:
-            LayingItem::_42F933(v10);
+            LayingItem::OnItemPickup(v10);
             goto LABEL_36;
           }
           v11 = v4->uLifetime;
@@ -12099,9 +12099,9 @@
               HIWORD(v22) = HIWORD(x);
               v15->_screenspace_y_scaler_packedfloat = v37;
               v15->field_1E = v30;
-              v15->some_x = a1;
-              v15->some_y = a2;
-              v15->some_z = a3;
+              v15->world_x = a1;
+              v15->world_y = a2;
+              v15->world_z = a3;
               v15->uScreenSpaceX = a5;
               v15->uScreenSpaceY = a6;
               v23 = 8 * v26;
@@ -12198,10 +12198,9 @@
             v5 = v4;
             v24 = v4;
             v30 = v4->uFlags;
-            a6 = v4->uGlowRadius * p->field_22;
-            v6 = stru_5C6E00->Atan2(
-                   p->vPosition.x - pBLVRenderParams->vPartyPos.x,
-                   p->vPosition.y - pBLVRenderParams->vPartyPos.y);
+            a6 = v4->uGlowRadius * p->field_22_glow_radius_multiplier;
+            v6 = stru_5C6E00->Atan2(p->vPosition.x - pBLVRenderParams->vPartyPos.x,
+                                    p->vPosition.y - pBLVRenderParams->vPartyPos.y);
             LOWORD(v7) = p->uFacing;
             v8 = v30;
             v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7;
@@ -12274,9 +12273,9 @@
               HIWORD(v21) = HIWORD(x);
               v3->_screenspace_y_scaler_packedfloat = v31;
               v3->field_1E = v34;
-              v3->some_x = a1;
-              v3->some_y = a2;
-              v3->some_z = a3;
+              v3->world_x = a1;
+              v3->world_y = a2;
+              v3->world_z = a3;
               v3->uScreenSpaceX = v36;
               v22 = v35;
               v3->uTintColor = 0;
@@ -18578,7 +18577,7 @@
   LayingItem *v1; // esi@1
 
   v1 = this;
-  v1->field_22 = 1;
+  v1->field_22_glow_radius_multiplier = 1;
   v1->uSoundID = 0;
   v1->uFacing = 0;
   v1->vVelocity.z = 0;
--- a/mm7_4.cpp	Sat Feb 23 23:04:00 2013 +0200
+++ b/mm7_4.cpp	Sun Feb 24 00:54:25 2013 +0200
@@ -14536,9 +14536,9 @@
     }
 LABEL_44:
     HIWORD(v25) = HIWORD(x);
-    v0->some_x = a1a;
-    v0->some_y = a2;
-    v0->some_z = a3;
+    v0->world_x = a1a;
+    v0->world_y = a2;
+    v0->world_z = a3;
     v0->uScreenSpaceX = v43;
     v0->uScreenSpaceY = a6;
     LOWORD(v25) = 0;
--- a/mm7_5.cpp	Sat Feb 23 23:04:00 2013 +0200
+++ b/mm7_5.cpp	Sun Feb 24 00:54:25 2013 +0200
@@ -9319,7 +9319,7 @@
     else
       v3 = uBaseLightLevel;
   }
-  return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->some_x, a1->some_y, a1->some_z);
+  return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->world_x, a1->world_y, a1->world_z);
 }
 
 //----- (0043F5C8) --------------------------------------------------------
@@ -12138,7 +12138,7 @@
 
     if (item->uItemType &&
         (item->uSoundID & 8 || pObjectList->pObjects[item->uItemType].uFlags & 0x10))
-      LayingItem::_42F933(i);
+      LayingItem::OnItemPickup(i);
   }
 
   for (uint i = 0; i < 100; ++i)
--- a/mm7_6.cpp	Sat Feb 23 23:04:00 2013 +0200
+++ b/mm7_6.cpp	Sun Feb 24 00:54:25 2013 +0200
@@ -6469,7 +6469,7 @@
             if ( !pParty->AddItem(&pLayingItems[v445].stru_24) )
               pParty->SetHoldingItem(&pLayingItems[v445].stru_24);
           }
-          LayingItem::_42F933(v445);
+          LayingItem::OnItemPickup(v445);
         }
         else
         {
--- a/stru6.cpp	Sat Feb 23 23:04:00 2013 +0200
+++ b/stru6.cpp	Sun Feb 24 00:54:25 2013 +0200
@@ -777,6 +777,7 @@
   signed int v35; // [sp+0h] [bp-18h]@81
   char pContainer[7]; // [sp+10h] [bp-8h]@81
 
+  __debugbreak(); // need to refactor carefully & collect data
   v2 = this;
   result = a2->uItemType;
   if ( result <= 545 )