changeset 132:8981a63bb559

Слияние
author Ritor1
date Wed, 07 Nov 2012 23:47:35 +0600
parents d2ca891da89f (current diff) 75faebd0a975 (diff)
children b07ebaa9a30d
files LOD.cpp
diffstat 3 files changed, 136 insertions(+), 305 deletions(-) [+]
line wrap: on
line diff
--- a/LOD.cpp	Wed Nov 07 22:10:04 2012 +0600
+++ b/LOD.cpp	Wed Nov 07 23:47:35 2012 +0600
@@ -1644,16 +1644,16 @@
 }
 // 6A0CA8: using guessed type int 6A0CA8_lod_unused;
 
-//----- (00461B48) --------------------------------------------------------
-/*unsigned int LODWriteableFile::Write(const LOD::Directory *pDir, const void *pDirData, int a4)
+
+unsigned int LODWriteableFile::Write(const LOD::Directory *pDir, const void *pDirData, int a4)
 {
-  LODWriteableFile *v4; // ebx@1
+  //LODWriteableFile *v4; // ebx@1
   int v5; // esi@1
-  unsigned __int8 v7; // zf@7
-  unsigned __int8 v8; // sf@7
+  //unsigned __int8 v7; // zf@7
+  //unsigned __int8 v8; // sf@7
   const LOD::Directory *v9; // edi@9
   int v10; // eax@9
-  unsigned __int8 v11; // of@15
+  //unsigned __int8 v11; // of@15
   unsigned __int16 v12; // dx@17
   LOD::Directory *v13; // eax@17
   unsigned __int16 v14; // cx@17
@@ -1675,7 +1675,7 @@
   char NewFilename[256]; // [sp+10Ch] [bp-130h]@51
   //LOD::Directory Str; // [sp+20Ch] [bp-30h]@27
   size_t v33; // [sp+22Ch] [bp-10h]@27
-  int v34; // [sp+230h] [bp-Ch]@7
+  //int v34; // [sp+230h] [bp-Ch]@7
   __int32 v35; // [sp+234h] [bp-8h]@8
   int v36; // [sp+238h] [bp-4h]@7
   size_t Count; // [sp+244h] [bp+8h]@40
@@ -1683,63 +1683,81 @@
   size_t Countb; // [sp+244h] [bp+8h]@47
   FILE *pFile; // [sp+24Ch] [bp+10h]@22
 
-  v4 = this;
-  v5 = 0;
-  if ( !this->isFileOpened )
+  //v4 = this;
+  //v5 = 0;
+
+  if (!isFileOpened)
     return 1;
-  if ( !this->pSubIndices )
+  if (!pSubIndices)
     return 2;
-  if ( !this->pIOBuffer || !this->uIOBufferSize )
+  if (!pIOBuffer || !uIOBufferSize)
     return 3;
-  v7 = this->uNumSubIndices == 0;
-  v8 = (this->uNumSubIndices & 0x80000000u) != 0;
+
+  //v7 = this->uNumSubIndices == 0;
+  //v8 = (this->uNumSubIndices & 0x80000000u) != 0;
+  v35 = 0;
   v36 = 0;
-  v34 = 0;
-  if ( v8 | v7 )
+  //v34 = 0;
+  for (v5 = 0; v5 < uNumSubIndices; ++v5)
+  /*if ( v8 | v7 )
   {
     v9 = pDir;
     goto LABEL_22;
   }
-  v35 = 0;
-  while ( 1 )
+  while ( 1 )*/
   {
     v9 = pDir;
-    v10 = _strcmpi((const char *)v4->pSubIndices + v35, (const char *)pDir);
-    if ( v10 )
+    v10 = _strcmpi(pSubIndices[v5].pFilename, pDir->pFilename);
+    if (v10 > 0)
+      break;
+    else if (v10 < 0)
+      continue;
+    /*if ( v10 )
     {
       if ( v10 > 0 )
         goto LABEL_22;
       goto LABEL_15;
-    }
+    }*/
     if ( !a4 )
-      goto LABEL_20;
+    {
+      v36 = 1;
+      break;
+    }
     if ( a4 == 1 )
+    {
+      v12 = pDir->uNumSubIndices;
+      v13 = &pSubIndices[v5];
+      v14 = v13->uNumSubIndices;
+      if ( v14 >= v12 && (v14 != v12 || (unsigned __int16)v13->word_00001E >= pDir->word_00001E) )
+        return 4;
+      v36 = 1;
       break;
+    }
     if ( a4 == 2 )
       return 4;
-LABEL_15:
-    v35 += 32;
-    ++v5;
-    v11 = __OFSUB__(v5, v4->uNumSubIndices);
-    v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0;
-    v34 = v5;
-    if ( !(v8 ^ v11) )
-      goto LABEL_22;
+//LABEL_15:
+    //v35 += 32;
+    //++v5;
+    //v11 = __OFSUB__(v5, v4->uNumSubIndices);
+    //v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0;
+    //v34 = v5;
+    //if ( !(v8 ^ v11) )
+      //goto LABEL_22;
   }
-  v12 = pDir->uNumSubIndices;
+/*  v12 = pDir->uNumSubIndices;
   v13 = &v4->pSubIndices[v5];
   v14 = v13->uNumSubIndices;
   if ( v14 >= v12 && (v14 != v12 || (unsigned __int16)v13->word_00001E >= pDir->word_00001E) )
     return 4;
 LABEL_20:
   v36 = 1;
-LABEL_22:
+LABEL_22:*/
   strcpy(pFilename, "lod.tmp");
   pFile = fopen(pFilename, "wb+");
   if ( !pFile )
     return 5;
   if ( v36 )
-    v35 = v4->pSubIndices[v5].uDataSize;
+    v35 = pSubIndices[v5].uDataSize;
   else
     v35 = 0;
   v33 = v9->uDataSize;
@@ -1748,9 +1766,9 @@
   LOD::Directory Str; // [sp+20Ch] [bp-30h]@27
   //LOD::Directory::LOD::Directory(&Str);
 
-  strcpy((char *)&Str, "chapter");
-  v16 = v4->uLODDataSize;
-  Str.uNumSubIndices = LOWORD(v4->uNumSubIndices);
+  strcpy(Str.pFilename, "chapter");
+  v16 = uLODDataSize;
+  Str.uNumSubIndices = uNumSubIndices;
   Str.dword_000018 = 0;
   Str.word_00001E = 0;
   if ( !v36 )
@@ -1758,263 +1776,76 @@
     ++Str.uNumSubIndices;
     v15 += 32;
   }
-  v7 = v36 == 0;
+  //v7 = v36 == 0;
   Str.uDataSize = v15 + v16;
   Str.uOfsetFromSubindicesStart = 288;
   v17 = (signed __int16)Str.uNumSubIndices;
-  v4->uNumSubIndices = (signed __int16)Str.uNumSubIndices;
-  if ( v7 && v17 > v5 )
+  uNumSubIndices = (signed __int16)Str.uNumSubIndices;
+  if ( !v36 && v17 > v5 )
   {
     v18 = v17;
     v19 = v17 - v5;
     do
     {
-      v20 = &v4->pSubIndices[v18];
+      v20 = &pSubIndices[v18];
       --v18;
       --v19;
       memcpy(v20, (char *)v20 - 32, 0x20u);
     }
     while ( v19 );
-    v5 = v34;
+    //v5 = v34;
   }
-  v34 = 32 * v5;
-  memcpy(&v4->pSubIndices[v5], pDir, sizeof(v4->pSubIndices[v5]));
-  v23 = 32 * v4->uNumSubIndices;
-  if ( (signed int)v4->uNumSubIndices > 0 )
+  //v34 = 32 * v5;
+  memcpy(&pSubIndices[v5], pDir, sizeof(LOD::Directory));
+  v23 = 32 * uNumSubIndices;
+  if ( (signed int)uNumSubIndices > 0 )
   {
-    for (int i =  0; i < (signed int)v4->uNumSubIndices; ++i)
+    for (int i =  0; i < (signed int)uNumSubIndices; ++i)
     {
-      v4->pSubIndices[i].uOfsetFromSubindicesStart = v23;
-      v23 += v4->pSubIndices[i].uDataSize;
+      pSubIndices[i].uOfsetFromSubindicesStart = v23;
+      v23 += pSubIndices[i].uDataSize;
     }
   }
-  fwrite(&v4->header, 0x100, 1, pFile);
+  fwrite(&header, 0x100, 1, pFile);
   fwrite(&Str, 0x20, 1, pFile);
-  fseek(v4->pFile, Str.uOfsetFromSubindicesStart, 0);
-  fwrite(v4->pSubIndices, 0x20u, v4->uNumSubIndices, pFile);
-  v26 = 32 * v4->uNumSubIndices;
+  fseek(pFile, Str.uOfsetFromSubindicesStart, 0);
+  fwrite(pSubIndices, 0x20u, uNumSubIndices, pFile);
+  v26 = 32 * uNumSubIndices;
   if ( !v36 )
     v26 -= 32;
-  fseek(v4->pFile, v26, 1);
-  for ( i = *(unsigned int *)((char *)&v4->pSubIndices->uOfsetFromSubindicesStart + v34)
-          - v4->pSubIndices->uOfsetFromSubindicesStart; i > 0; i -= Count )
+  fseek(pFile, v26, 1);
+  for ( i = pSubIndices[v5].uOfsetFromSubindicesStart
+          - pSubIndices->uOfsetFromSubindicesStart; i > 0; i -= Count )
   {
-    Count = v4->uIOBufferSize;
-    if ( i <= (signed int)v4->uIOBufferSize )
+    Count = uIOBufferSize;
+    if ( i <= (signed int)uIOBufferSize )
       Count = i;
-    fread(v4->pIOBuffer, 1u, Count, v4->pFile);
-    fwrite(v4->pIOBuffer, 1u, Count, pFile);
+    fread(pIOBuffer, 1u, Count, pFile);
+    fwrite(pIOBuffer, 1u, Count, pFile);
   }
   fwrite(pDirData, 1u, v33, pFile);
   if ( v36 )
-    fseek(v4->pFile, v35, 1);
-  Countc = ftell(v4->pFile);
-  fseek(v4->pFile, 0, 2);
-  v28 = ftell(v4->pFile) - Countc;
-  fseek(v4->pFile, Countc, 0);
+    fseek(pFile, v35, 1);
+  Countc = ftell(pFile);
+  fseek(pFile, 0, 2);
+  v28 = ftell(pFile) - Countc;
+  fseek(pFile, Countc, 0);
   while ( v28 > 0 )
   {
-    Countb = v4->uIOBufferSize;
-    if ( v28 <= (signed int)v4->uIOBufferSize )
+    Countb = uIOBufferSize;
+    if ( v28 <= (signed int)uIOBufferSize )
       Countb = v28;
-    fread(v4->pIOBuffer, 1u, Countb, v4->pFile);
-    fwrite(v4->pIOBuffer, 1u, Countb, pFile);
+    fread(pIOBuffer, 1u, Countb, pFile);
+    fwrite(pIOBuffer, 1u, Countb, pFile);
     v28 -= Countb;
   }
-  strcpy(NewFilename, (const char *)v4->pLODName);
+  strcpy(NewFilename, (const char *)pLODName);
   fclose(pFile);
-  v4->CloseWriteFile();
+  CloseWriteFile();
   remove(NewFilename);
   rename(pFilename, NewFilename);
-  v4->CloseWriteFile();
-  v4->LoadFile(v4->pLODName, 0);
-  return 0;
-}
-*/
-
-unsigned int LODWriteableFile::Write(const LOD::Directory *pDir, const void *pDirData, int a4)
-{
-  LODWriteableFile *v4; // ebx@1
-  int v5; // esi@1
-  unsigned __int8 v7; // zf@7
-  unsigned __int8 v8; // sf@7
-  const LOD::Directory *v9; // edi@9
-  int v10; // eax@9
-  unsigned __int8 v11; // of@15
-  unsigned __int16 v12; // dx@17
-  LOD::Directory *v13; // eax@17
-  unsigned __int16 v14; // cx@17
-  int v15; // edi@27
-  unsigned int v16; // eax@27
-  int v17; // eax@29
-  int v18; // edx@31
-  int v19; // eax@31
-  void *v20; // edi@32
-  LOD::Directory *v21; // edi@34
-  signed int v22; // esi@34
-  int v23; // eax@34
-  LOD::Directory *v24; // ecx@35
-  int v25; // edx@35
-  __int32 v26; // eax@37
-  int i; // esi@39
-  __int32 v28; // esi@46
-  char pFilename[256]; // [sp+Ch] [bp-230h]@22
-  char NewFilename[256]; // [sp+10Ch] [bp-130h]@51
-  //LOD::Directory Str; // [sp+20Ch] [bp-30h]@27
-  size_t v33; // [sp+22Ch] [bp-10h]@27
-  int v34; // [sp+230h] [bp-Ch]@7
-  __int32 v35; // [sp+234h] [bp-8h]@8
-  int v36; // [sp+238h] [bp-4h]@7
-  size_t Count; // [sp+244h] [bp+8h]@40
-  __int32 Countc; // [sp+244h] [bp+8h]@46
-  size_t Countb; // [sp+244h] [bp+8h]@47
-  FILE *pFile; // [sp+24Ch] [bp+10h]@22
-
-  v4 = this;
-  v5 = 0;
-  if ( !this->isFileOpened )
-    return 1;
-  if ( !this->pSubIndices )
-    return 2;
-  if ( !this->pIOBuffer || !this->uIOBufferSize )
-    return 3;
-  v7 = this->uNumSubIndices == 0;
-  v8 = (this->uNumSubIndices & 0x80000000u) != 0;
-  v36 = 0;
-  v34 = 0;
-  if ( v8 | v7 )
-  {
-    v9 = pDir;
-    goto LABEL_22;
-  }
-  v35 = 0;
-  while ( 1 )
-  {
-    v9 = pDir;
-    v10 = _strcmpi((const char *)v4->pSubIndices + v35, (const char *)pDir);
-    if ( v10 )
-    {
-      if ( v10 > 0 )
-        goto LABEL_22;
-      goto LABEL_15;
-    }
-    if ( !a4 )
-      goto LABEL_20;
-    if ( a4 == 1 )
-      break;
-    if ( a4 == 2 )
-      return 4;
-LABEL_15:
-    v35 += 32;
-    ++v5;
-    v11 = __OFSUB__(v5, v4->uNumSubIndices);
-    v8 = ((v5 - v4->uNumSubIndices) & 0x80000000u) != 0;
-    v34 = v5;
-    if ( !(v8 ^ v11) )
-      goto LABEL_22;
-  }
-  v12 = pDir->uNumSubIndices;
-  v13 = &v4->pSubIndices[v5];
-  v14 = v13->uNumSubIndices;
-  if ( v14 >= v12 && (v14 != v12 || (unsigned __int16)v13->word_00001E >= pDir->word_00001E) )
-    return 4;
-LABEL_20:
-  v36 = 1;
-LABEL_22:
-  strcpy(pFilename, "lod.tmp");
-  pFile = fopen(pFilename, "wb+");
-  if ( !pFile )
-    return 5;
-  if ( v36 )
-    v35 = v4->pSubIndices[v5].uDataSize;
-  else
-    v35 = 0;
-  v33 = v9->uDataSize;
-  v15 = v33 - v35;
-
-  LOD::Directory Str; // [sp+20Ch] [bp-30h]@27
-  //LOD::Directory::LOD::Directory(&Str);
-
-  strcpy((char *)&Str, "chapter");
-  v16 = v4->uLODDataSize;
-  Str.uNumSubIndices = LOWORD(v4->uNumSubIndices);
-  Str.dword_000018 = 0;
-  Str.word_00001E = 0;
-  if ( !v36 )
-  {
-    ++Str.uNumSubIndices;
-    v15 += 32;
-  }
-  v7 = v36 == 0;
-  Str.uDataSize = v15 + v16;
-  Str.uOfsetFromSubindicesStart = 288;
-  v17 = (signed __int16)Str.uNumSubIndices;
-  v4->uNumSubIndices = (signed __int16)Str.uNumSubIndices;
-  if ( v7 && v17 > v5 )
-  {
-    v18 = v17;
-    v19 = v17 - v5;
-    do
-    {
-      v20 = &v4->pSubIndices[v18];
-      --v18;
-      --v19;
-      memcpy(v20, (char *)v20 - 32, 0x20u);
-    }
-    while ( v19 );
-    v5 = v34;
-  }
-  v34 = 32 * v5;
-  memcpy(&v4->pSubIndices[v5], pDir, sizeof(v4->pSubIndices[v5]));
-  v23 = 32 * v4->uNumSubIndices;
-  if ( (signed int)v4->uNumSubIndices > 0 )
-  {
-    for (int i =  0; i < (signed int)v4->uNumSubIndices; ++i)
-    {
-      v4->pSubIndices[i].uOfsetFromSubindicesStart = v23;
-      v23 += v4->pSubIndices[i].uDataSize;
-    }
-  }
-  fwrite(&v4->header, 0x100, 1, pFile);
-  fwrite(&Str, 0x20, 1, pFile);
-  fseek(v4->pFile, Str.uOfsetFromSubindicesStart, 0);
-  fwrite(v4->pSubIndices, 0x20u, v4->uNumSubIndices, pFile);
-  v26 = 32 * v4->uNumSubIndices;
-  if ( !v36 )
-    v26 -= 32;
-  fseek(v4->pFile, v26, 1);
-  for ( i = *(unsigned int *)((char *)&v4->pSubIndices->uOfsetFromSubindicesStart + v34)
-          - v4->pSubIndices->uOfsetFromSubindicesStart; i > 0; i -= Count )
-  {
-    Count = v4->uIOBufferSize;
-    if ( i <= (signed int)v4->uIOBufferSize )
-      Count = i;
-    fread(v4->pIOBuffer, 1u, Count, v4->pFile);
-    fwrite(v4->pIOBuffer, 1u, Count, pFile);
-  }
-  fwrite(pDirData, 1u, v33, pFile);
-  if ( v36 )
-    fseek(v4->pFile, v35, 1);
-  Countc = ftell(v4->pFile);
-  fseek(v4->pFile, 0, 2);
-  v28 = ftell(v4->pFile) - Countc;
-  fseek(v4->pFile, Countc, 0);
-  while ( v28 > 0 )
-  {
-    Countb = v4->uIOBufferSize;
-    if ( v28 <= (signed int)v4->uIOBufferSize )
-      Countb = v28;
-    fread(v4->pIOBuffer, 1u, Countb, v4->pFile);
-    fwrite(v4->pIOBuffer, 1u, Countb, pFile);
-    v28 -= Countb;
-  }
-  strcpy(NewFilename, (const char *)v4->pLODName);
-  fclose(pFile);
-  v4->CloseWriteFile();
-  remove(NewFilename);
-  rename(pFilename, NewFilename);
-  v4->CloseWriteFile();
-  v4->LoadFile(v4->pLODName, 0);
+  CloseWriteFile();
+  LoadFile(pLODName, 0);
   return 0;
 }
 
--- a/LOD.h	Wed Nov 07 22:10:04 2012 +0600
+++ b/LOD.h	Wed Nov 07 23:47:35 2012 +0600
@@ -1,7 +1,8 @@
 #pragma once
 #include <stdio.h>
+#include <memory.h>
+
 #include "Texture.h"
-#include <memory.h>
 
 
 /*  354 */
--- a/mm7_3.cpp	Wed Nov 07 22:10:04 2012 +0600
+++ b/mm7_3.cpp	Wed Nov 07 23:47:35 2012 +0600
@@ -2178,12 +2178,12 @@
 
 
 //----- (0047253E) --------------------------------------------------------
-void __cdecl UpdateObjects()
+void UpdateObjects()
 {
   unsigned int v0; // ebx@0
-  unsigned int v1; // edi@1
+  //unsigned int v1; // edi@1
   char *v2; // esi@2
-  __int16 v3; // dx@5
+  //__int16 v3; // dx@5
   ObjectDesc *v4; // eax@5
   int v5; // ecx@6
   __int16 v6; // cx@7
@@ -2200,68 +2200,66 @@
   unsigned int v17; // edx@32
   int v18; // [sp+4h] [bp-10h]@27
   int v19; // [sp+8h] [bp-Ch]@27
-  signed int v20; // [sp+10h] [bp-4h]@1
-
-  v1 = 0;
-  v20 = 0;
-  if ( (signed int)uNumLayingItems > 0 )
-  {
-    __debugbreak();
-    v2 = (char *)&pLayingItems[0].uSpriteFrameID;
-    do
-    {
-      LOWORD(v0) = *((short *)v2 - 2);
-      if ( v0 & 0x40 )
-      {
-        v0 &= 0xFFFFFFBFu;
-        *((short *)v2 - 2) = v0;
-      }
-      else
-      {
-        v3 = *((short *)v2 - 14);
-        v4 = &pObjectList->pObjects[*((short *)v2 - 14)];
-        if ( (v0 & 0x80u) != 0 )
-        {
+  //signed int v20; // [sp+10h] [bp-4h]@1
+
+  //v1 = 0;
+  //v20 = 0;
+  for (uint i = 0; i < uNumLayingItems; ++i)
+  {
+    auto item = pLayingItems + i;
+    v2 = (char *)&item->uSpriteFrameID;
+    //do
+    //{
+      //LOWORD(v0) = item->uAttributes;
+    if (item->uAttributes & 0x40)
+      item->uAttributes &= 0xFFBF;
+    else
+    {
+              //v3 = item->uObjectDescID;
+      v4 = &pObjectList->pObjects[item->uObjectDescID];
+      if (item->uAttributes)
+      {
           v5 = *(int *)(v2 + 62) >> 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;
-          if ( !v3 || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) )
+          if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2, *(short *)v2 = v6, !(v4->uFlags & 4)) )
             goto LABEL_36;
           if ( v6 >= 0 )
           {
             v7 = v4->uLifetime;
-            if ( v0 & 2 )
+            if (item->uAttributes & 2)
               v7 = *((short *)v2 + 1);
             if ( v6 < v7 )
               goto LABEL_36;
           }
           goto LABEL_34;
-        }
-        if ( v3 )
-        {
-          v8 = LOWORD(pEventTimer->uTimeElapsed) + *(short *)v2;
-          *(short *)v2 = v8;
+      }
+
+        if ( item->uObjectDescID )
+        {
+          v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID;
+          item->uSpriteFrameID = v8;
           v9 = v4->uFlags;
           if ( !(v9 & 4) )
             goto LABEL_22;
           if ( v8 < 0 )
           {
-            v10 = v1;
+            v10 = i;
 LABEL_35:
             LayingItem::_42F933(v10);
             goto LABEL_36;
           }
           v11 = v4->uLifetime;
-          if ( v0 & 2 )
+          if ( item->uAttributes & 2 )
             v11 = *((short *)v2 + 1);
           if ( v8 < v11 )
           {
 LABEL_22:
             if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-              LayingItem::UpdateObject_fn0_BLV(v1);
+              LayingItem::UpdateObject_fn0_BLV(i);
             else
-              LayingItem::UpdateObject_fn0_ODM(v1);
+              LayingItem::UpdateObject_fn0_ODM(i);
             if ( pParty->bTurnBasedModeOn != 1 || !(*(v2 - 4) & 4) )
               goto LABEL_36;
             v12 = abs(pParty->vPosition.x - *(int *)(v2 - 26));
@@ -2291,20 +2289,21 @@
             if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 )
               goto LABEL_36;
 LABEL_34:
-            v10 = v20;
+            v10 = i;
             goto LABEL_35;
           }
-          v10 = v1;
+          v10 = i;
           if ( !(v9 & 0x40) )
             goto LABEL_35;
-          _46BFFA_check_object_intercept(v1, 8 * v1 | OBJECT_Item);
-        }
-      }
+          _46BFFA_check_object_intercept(i, 8 * i | OBJECT_Item);
+        }
+    }
 LABEL_36:
-      v2 += 112;
-      v1 = v20++ + 1;
-    }
-    while ( v20 < (signed int)uNumLayingItems );
+    ;
+      //v2 += 112;
+      //v1 = v20++ + 1;
+    //}
+    //while ( v20 < (signed int)uNumLayingItems );
   }
 }