changeset 2230:afca92154795

Merge
author Grumpy7
date Sat, 22 Feb 2014 18:25:53 +0100
parents 10c909eb6766 (current diff) b65e71eadd1b (diff)
children 8673f3aedfb9
files
diffstat 7 files changed, 100 insertions(+), 212 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sat Feb 22 18:25:18 2014 +0100
+++ b/Actor.cpp	Sat Feb 22 18:25:53 2014 +0100
@@ -1387,27 +1387,19 @@
   {
     case 1:
       if ( a3 )
-      {
         pOtherOverlayList->_4418B6(904, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0);
-      }
       return;
     case 2:
       if ( a3 )
-      {
         pOtherOverlayList->_4418B6(905, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0);
-      }
       return;
     case 3:
       if ( a3 )
-      {
         pOtherOverlayList->_4418B6(906, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0);
-      }
       return;
     case 4:
       if ( a3 )
-      {
         pOtherOverlayList->_4418B6(907, v4, 0, (int)(sub_43AE12(a3) * 65536.0), 0);
-      }
       return;
     case 5:
       pOtherOverlayList->_4418B6(901, v4, 0, PID(OBJECT_Actor,uActorID), 0);
--- a/AudioPlayer.cpp	Sat Feb 22 18:25:18 2014 +0100
+++ b/AudioPlayer.cpp	Sat Feb 22 18:25:53 2014 +0100
@@ -194,124 +194,66 @@
 //----- (004A9BBD) --------------------------------------------------------
 int SoundList::LoadSound(unsigned int a2, LPVOID lpBuffer, int uBufferSizeLeft, int *pOutSoundSize, int a6)
 {
-  //SoundList *v6; // edi@1
-  signed int v7; // esi@1
-  //unsigned __int8 v8; // zf@1
-  //unsigned __int8 v9; // sf@1
-  SoundDesc *v10; // eax@3
-  SoundDesc *v11; // ecx@3
-  int v12; // ebx@7
-  int result; // eax@13
-  SoundHeader *v14; // esi@16
-  DWORD *v15; // edi@16
-  int v16; // ebx@16
-  unsigned int v17; // eax@18
   void *v18; // ebx@19
-  std::string v19; // [sp-18h] [bp-38h]@22
-  const char *v20; // [sp-8h] [bp-28h]@22
-  int v21; // [sp-4h] [bp-24h]@22
-  //SoundList *v22; // [sp+Ch] [bp-14h]@1
-  SoundDesc *Args; // [sp+10h] [bp-10h]@3
-  unsigned int v24; // [sp+14h] [bp-Ch]@2
-  int v25; // [sp+18h] [bp-8h]@2
-  int v26; // [sp+1Ch] [bp-4h]@1
+  DWORD NumberOfBytesRead;
 
-  //v6 = this;
-  v7 = 0;
-  //v22 = this;
-  //v8 = this->uNumSounds == 0;
-  //v9 = (this->uNumSounds & 0x80000000u) != 0;
-  v26 = 0;
   if (!sNumSounds)
     return 0;
 
-
-    v24 = 0;
-    v25 = 44;
-    while ( 1 )
-    {
-      v10 = pSL_Sounds;
-      v11 = &v10[v24 / 0x78];
-      Args = &v10[v24 / 0x78];
-      if ( a2 == v10[v24 / 0x78].uSoundID )
-      {
-        if ( a6 == v7 && *(int *)&v10->pSoundName[v25] != v7 )
-          return v26;
-        if ( (signed int)pAudioPlayer->uNumSoundHeaders > v7 )
-          break;
-      }
-LABEL_12:
-      ++v26;
-      v25 += 120;
-      v24 += 120;
-      if ( v26 >= (signed int)sNumSounds )
-        return 0;
-    }
-    v12 = 0;
-    while ( _stricmp(pAudioPlayer->pSoundHeaders[v12].pSoundName, v11->pSoundName) )
+  for ( uint i = 0; i < sNumSounds; ++i )
+  {
+    if ( a2 == pSL_Sounds[i].uSoundID )
     {
-      ++v7;
-      ++v12;
-      if ( v7 >= (signed int)pAudioPlayer->uNumSoundHeaders )
+      if ( !a6 && pSL_Sounds[i].pSoundData )
+        return i;
+      for ( uint j = 0; j < (signed int)pAudioPlayer->uNumSoundHeaders; ++j )
       {
-        v7 = 0;
-        goto LABEL_12;
-      }
-      v11 = Args;
-    }
-    v14 = &pAudioPlayer->pSoundHeaders[v7];
-    v15 = (DWORD *)&v14->uDecompressedSize;
-    a2 = v14->uDecompressedSize;
-    v16 = a2;
-    if ( (signed int)a2 > uBufferSizeLeft )
-      Error("Sound %s is size %i bytes, sound buffer size is %i bytes", Args, a2, uBufferSizeLeft);
-
-    SetFilePointer(pAudioPlayer->hAudioSnd, v14->uFileOffset, 0, 0);
-    v17 = v14->uCompressedSize;
-    if ( (signed int)v17 >= (signed int)*v15 )
-    {
-      if ( v17 == *v15 )
-      {
-        ReadFile(pAudioPlayer->hAudioSnd, lpBuffer, *v15, (LPDWORD)&Args, 0);
-      }
-      else
-      {
-      MessageBoxW(nullptr, L"Can't load sound file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Sound.cpp:666", 0);
+        if ( !_stricmp(pAudioPlayer->pSoundHeaders[j].pSoundName, pSL_Sounds[i].pSoundName) )
+        {
+          if ( (signed int)pAudioPlayer->pSoundHeaders[j].uDecompressedSize > uBufferSizeLeft )
+            Error("Sound %s is size %i bytes, sound buffer size is %i bytes", pSL_Sounds[i].pSoundName, pAudioPlayer->pSoundHeaders[j].uDecompressedSize, uBufferSizeLeft);
+          SetFilePointer(pAudioPlayer->hAudioSnd, pAudioPlayer->pSoundHeaders[j].uFileOffset, 0, 0);
+          if ( (signed int)pAudioPlayer->pSoundHeaders[j].uCompressedSize >= (signed int)pAudioPlayer->pSoundHeaders[j].uDecompressedSize )
+          {
+            if ( pAudioPlayer->pSoundHeaders[j].uCompressedSize == pAudioPlayer->pSoundHeaders[j].uDecompressedSize )
+              ReadFile(pAudioPlayer->hAudioSnd, lpBuffer, pAudioPlayer->pSoundHeaders[j].uDecompressedSize, &NumberOfBytesRead, 0);
+            else
+              MessageBoxW(nullptr, L"Can't load sound file!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Sound.cpp:666", 0);
+          }
+          else
+          {
+            v18 = malloc(pAudioPlayer->pSoundHeaders[j].uCompressedSize);
+            ReadFile(pAudioPlayer->hAudioSnd, v18, pAudioPlayer->pSoundHeaders[j].uCompressedSize, &NumberOfBytesRead, 0);
+            zlib::MemUnzip(lpBuffer, &pAudioPlayer->pSoundHeaders[j].uDecompressedSize, v18, pAudioPlayer->pSoundHeaders[j].uCompressedSize);
+            free(v18);
+          }
+          pSL_Sounds[i].pSoundData[a6] = (SoundData *)lpBuffer;
+          *pOutSoundSize = a2;
+          return i;
+        }
       }
     }
-    else
-    {
-      v18 = malloc(v14->uCompressedSize);
-      ReadFile(pAudioPlayer->hAudioSnd, v18, v14->uCompressedSize, (LPDWORD)&Args, 0);
-      zlib::MemUnzip(lpBuffer, &v14->uDecompressedSize, v18, v14->uCompressedSize);
-      free(v18);
-      v16 = a2;
-    }
-    result = v26;
-    pSL_Sounds->pSoundData[a6 + 30 * v26] = (SoundData *)lpBuffer;
-    *pOutSoundSize = v16;
-
-  return result;
+  }
+  return 0;
 }
 
 //----- (004A9D3E) --------------------------------------------------------
 SoundDesc *SoundList::Release()
 {
   SoundDesc *result; // eax@3
-  void *v5; // ecx@3
+  //void *v5; // ecx@3
 
   if ( (signed int)this->sNumSounds > 0 )
   {
     for ( uint i = 0; i < (signed int)this->sNumSounds; ++i )
     {
       result = this->pSL_Sounds;
-      v5 = result[i].pSoundData[0];
-      if ( v5 )
+      //v5 = this->pSL_Sounds[i].pSoundData[0];
+      if ( this->pSL_Sounds[i].pSoundData[0] )
       {
-        ReleaseSoundData(v5);
+        ReleaseSoundData(this->pSL_Sounds[i].pSoundData[0]);
         this->pSL_Sounds[i].pSoundData[0] = 0;
-        result = (SoundDesc *)((char *)&this->pSL_Sounds[i] + 40);
-        *(int *)&result->pSoundName[0] &= 0xFFFFFFFEu;
+        this->pSL_Sounds[i].uFlags &= 0xFFFFFFFE;
       }
     }
   }
@@ -404,13 +346,6 @@
   void *v6; // eax@9
   FILE *v7; // ST0C_4@11
   char *i; // eax@11
-  int v9; // eax@14
-  const char *v10; // ST0C_4@14
-  int v11; // eax@18
-  SoundDesc *v12; // ecx@18
-  char v13; // zf@18
-  unsigned int v14; // eax@18
-  int v15; // eax@23
   char Buf; // [sp+Ch] [bp-2F0h]@3
   FrameTableTxtLine v18; // [sp+200h] [bp-FCh]@4
   FrameTableTxtLine v19; // [sp+27Ch] [bp-80h]@4
@@ -458,21 +393,15 @@
     if ( v19.uPropCount && *v19.pProperties[0] != 47 )
     {
       sprintf(this->pSL_Sounds[this->sNumSounds].pSoundName, "%s", v19.pProperties[0]);
-      v9 = atoi(v19.pProperties[1]);
-      v10 = v19.pProperties[2];
-      this->pSL_Sounds[this->sNumSounds].uSoundID = v9;
-      if ( _stricmp(v10, "system") )
+      this->pSL_Sounds[this->sNumSounds].uSoundID = atoi(v19.pProperties[1]);
+      if ( _stricmp(v19.pProperties[2], "system") )
       {
         if ( _stricmp(v19.pProperties[2], "swap") )
         {
-          v11 = _stricmp(v19.pProperties[2], "lock");
-          v12 = this->pSL_Sounds;
-          v13 = v11 == 0;
-          v14 = this->sNumSounds;
-          if ( v13 )
-            v12[v14].eType = SOUND_DESC_LOCK;
+          if ( !_stricmp(v19.pProperties[2], "lock") )
+            this->pSL_Sounds[this->sNumSounds].eType = SOUND_DESC_LOCK;
           else
-            v12[v14].eType = SOUND_DESC_LEVEL;
+            this->pSL_Sounds[this->sNumSounds].eType = SOUND_DESC_LEVEL;
         }
         else
           this->pSL_Sounds[this->sNumSounds].eType = SOUND_DESC_SWAP;
@@ -480,10 +409,7 @@
       else
         this->pSL_Sounds[this->sNumSounds].eType = SOUND_DESC_SYSTEM;
       if ( v19.uPropCount >= 4 && !_stricmp(v19.pProperties[3], "3D") )
-      {
-        v15 = (int)&this->pSL_Sounds[this->sNumSounds].uFlags;
-        *(int *)v15 |= SOUND_DESC_SWAP;
-      }
+        this->pSL_Sounds[this->sNumSounds].uFlags |= SOUND_DESC_SWAP;
       ++this->sNumSounds;
     }
   }
@@ -1467,12 +1393,7 @@
 //----- (004AAFCF) --------------------------------------------------------
 void AudioPlayer::UpdateSounds()
 {
-  //AudioPlayer *pAudioPlayer; // edi@1
   int v2; // ebx@1
-  //unsigned __int8 v3; // zf@1
-  //int *v4; // eax@2
-  //unsigned __int8 v5; // sf@4
-  //AudioPlayer_3DSample *v6; // esi@5
   int v7; // ebx@6
   int v8; // ebx@9
   int v9; // ebx@10
@@ -1494,31 +1415,8 @@
   int v25; // eax@32
   float v26; // ST10_4@34
   float v27; // ST08_4@34
-  //MixerChannel *v28; // esi@38
-  //unsigned __int8 v29; // of@43
-  //MixerChannel *v30; // esi@44
-  //int v31; // eax@45
-  //SpriteObject *v32; // eax@49
-  //Actor *v33; // edi@50
-  //int v34; // eax@50
-  //unsigned int v35; // edx@51
-  //unsigned int v36; // ecx@51
-  //SpriteObject *v37; // edi@53
   int v38; // eax@53
-  //BLVDoor *v39; // edi@56
-  //int v40; // eax@57
-  //int v41; // eax@60
-  //MixerChannel *v42; // edi@65
-  //int v43; // ebx@68
-  //LevelDecoration *v44; // esi@68
-  //int v45; // ST1C_4@68
-  //int v46; // edi@68
-  //int v47; // eax@68
-  //DecorationDesc *v48; // edi@69
-  //__int16 v49; // ax@69
-  //__int16 v50; // ax@70
   __int16 v51; // ax@71
-  //__int16 v52; // ax@73
   signed int v53; // eax@88
   RenderVertexSoft a1; // [sp+24h] [bp-48h]@1
   float v55; // [sp+54h] [bp-18h]@22
@@ -1526,7 +1424,6 @@
   int uNumRepeats; // [sp+5Ch] [bp-10h]@15
   float v58; // [sp+60h] [bp-Ch]@23
   int v59; // [sp+64h] [bp-8h]@4
-  //AudioPlayer *thisa; // [sp+68h] [bp-4h]@1
 
   //pAudioPlayer = this;
   v2 = 0;
@@ -2034,7 +1931,7 @@
     } */
   }
 
-  if (pCurrentScreen != SCREEN_GAME) //отключение звука декораций при переключенииокна игры
+  if (pCurrentScreen != SCREEN_GAME) //отключение звука декораций при переключении окна игры
   {
     if (AIL_sample_status(pMixerChannels[4].hSample) == AIL::Sample::Playing)
       AIL_end_sample(pMixerChannels[4].hSample);
@@ -2047,7 +1944,7 @@
       //v59 = 0;
   for (uint i = 0; i < _6807E0_num_decorations_with_sounds_6807B8; ++i)
   {
-        LODWORD(v56) = 1;
+    LODWORD(v56) = 1;
         //v43 = _6807B8_level_decorations_ids[v59];
         //v44 = &pLevelDecorations[_6807B8_level_decorations_ids[v59]];
         //v45 = abs(v44->vPosition.z - pParty->vPosition.z);
@@ -2056,7 +1953,7 @@
     LevelDecoration* decor = &pLevelDecorations[_6807B8_level_decorations_ids[i]];
     if (int_get_vector_length(abs(decor->vPosition.x - pParty->vPosition.x),
                               abs(decor->vPosition.y - pParty->vPosition.y),
-                              abs(decor->vPosition.z - pParty->vPosition.z)) > 8192)
+                              abs(decor->vPosition.z - pParty->vPosition.z)) > 0x2000)
       continue;
 
     DecorationDesc* decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID];
@@ -2089,7 +1986,7 @@
           {
             v53 = 8 * _6807B8_level_decorations_ids[i];
             LOBYTE(v53) = v53 | OBJECT_Decoration;
-            PlaySound((SoundID)decor_desc->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0);//звуки корабля, плескания воды
+            PlaySound((SoundID)decor_desc->uSoundID, v53, uNumRepeats, -1, 0, 0, 0, 0);//sound of Boat and water(звуки корабля, плескания воды)
           }
           continue;
         }
@@ -2173,7 +2070,7 @@
   dir_y = abs(y - pParty->vPosition.y);
   dir_x = abs(x - pParty->vPosition.x);
   length = int_get_vector_length(dir_x, dir_y, dir_z);
-  if ( length <= 8192 )
+  if ( length <= 0x2000 )
     return 114 - (unsigned __int64)(signed __int64)((double)length * 0.0001220703125 * 100.0);
   else
     return 0;
@@ -2513,39 +2410,39 @@
 
   if (!pSoundList->pSL_Sounds)
     return;
- 
-    //v4 = &pSoundList->pSounds[pChannel->uSourceTrackIdx];
-    if ( pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].eType == SOUND_DESC_SWAP)
+
+  //v4 = &pSoundList->pSounds[pChannel->uSourceTrackIdx];
+  if ( pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].eType == SOUND_DESC_SWAP)
+  {
+    if ( pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].pSoundData[0] && 
+       !(pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].uFlags & SOUND_DESC_SYSTEM) )
     {
-      if ( pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].pSoundData[0] && 
-          !(pSoundList->pSL_Sounds[pChannel->uSourceTrackIdx].uFlags & SOUND_DESC_SYSTEM) )
+      num_playing_channels = 0;
+      num_same_sound_on_channels = 0;
+      if ( this->uMixerChannels <= 0 )
+        goto LABEL_16;
+      for ( uint i = 0; i < uMixerChannels; i++ )
       {
-        num_playing_channels = 0;
-        num_same_sound_on_channels = 0;
-        if ( this->uMixerChannels <= 0 )
-          goto LABEL_16;
-        for ( uint i = 0; i < uMixerChannels; i++ )
+        if ( pChannel->uSourceTrackID == pMixerChannels[i].uSourceTrackID )
         {
-          if ( pChannel->uSourceTrackID == pMixerChannels[i].uSourceTrackID )
-          {
-            v14[num_same_sound_on_channels++] = i;
-            if ( AIL_sample_status((HSAMPLE)pMixerChannels[i].hSample) == AIL::Sample::Playing)
-              ++num_playing_channels;
-          }
+          v14[num_same_sound_on_channels++] = i;
+          if ( AIL_sample_status((HSAMPLE)pMixerChannels[i].hSample) == AIL::Sample::Playing)
+            ++num_playing_channels;
         }
-        if ( !num_playing_channels )
+      }
+      if ( !num_playing_channels )
+      {
+LABEL_16:
+        pSoundList->UnloadSound(pChannel->uSourceTrackIdx, 1);
+        for ( v10 = 0; v10 < num_same_sound_on_channels; v10++ )
         {
-LABEL_16:
-          pSoundList->UnloadSound(pChannel->uSourceTrackIdx, 1);
-          for ( v10 = 0; v10 < num_same_sound_on_channels; v10++ )
-          {
-            v12 = 16 * (v14[v10] + 47);
-            pMixerChannels[v14[v10]].uSourceTrackID = 0;
-            *(unsigned int *)((char *)&bEAXSupported + v12) = 0;
-          }
+          v12 = 16 * (v14[v10] + 47);
+          pMixerChannels[v14[v10]].uSourceTrackID = 0;
+          *(unsigned int *)((char *)&bEAXSupported + v12) = 0;
         }
       }
     }
+  }
 }
 
 //----- (004ABF23) --------------------------------------------------------
--- a/Indoor.cpp	Sat Feb 22 18:25:18 2014 +0100
+++ b/Indoor.cpp	Sat Feb 22 18:25:53 2014 +0100
@@ -3881,7 +3881,7 @@
         ++uNumBillboardsToDraw;
         ++uNumSpritesDrawnThisFrame;
         pActors[i].uAttributes |= 8;
-        pBillboardRenderList[uNumBillboardsToDraw - 1].uHwSpriteID = v9->pHwSpriteIDs[v6];
+        pBillboardRenderList[uNumBillboardsToDraw - 1].HwSpriteID = v9->pHwSpriteIDs[v6];
         pBillboardRenderList[uNumBillboardsToDraw - 1].uPalette = v9->uPaletteIndex;
         pBillboardRenderList[uNumBillboardsToDraw - 1].uIndoorSectorID = pActors[i].uSectorID;
         /*if ( !pRenderer->pRenderD3D )
@@ -3978,9 +3978,9 @@
                                     pSpriteObjects[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y);
             LOWORD(v7) = pSpriteObjects[i].uFacing;
             v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7;
-            pBillboardRenderList[uNumBillboardsToDraw].uHwSpriteID = v4->pHwSpriteIDs[v9];
+            pBillboardRenderList[uNumBillboardsToDraw].HwSpriteID = v4->pHwSpriteIDs[v9];
             if ( v4->uFlags & 0x20 )
-              pSpriteObjects[i].vPosition.z -= (signed int)(fixpoint_mul(v4->scale, pSprites_LOD->pSpriteHeaders[pBillboardRenderList[uNumBillboardsToDraw].uHwSpriteID].uHeight) / 2);
+              pSpriteObjects[i].vPosition.z -= (signed int)(fixpoint_mul(v4->scale, pSprites_LOD->pSpriteHeaders[pBillboardRenderList[uNumBillboardsToDraw].HwSpriteID].uHeight) / 2);
 
             v34 = 0;
             if ( v4->uFlags & 2 )
@@ -4213,7 +4213,7 @@
 
       ++uNumBillboardsToDraw;
       ++uNumDecorationsDrawnThisFrame;
-      pBillboardRenderList[uNumBillboardsToDraw - 1].uHwSpriteID = v11->pHwSpriteIDs[v9];
+      pBillboardRenderList[uNumBillboardsToDraw - 1].HwSpriteID = v11->pHwSpriteIDs[v9];
       pBillboardRenderList[uNumBillboardsToDraw - 1].uPalette = v11->uPaletteIndex;
       pBillboardRenderList[uNumBillboardsToDraw - 1].uIndoorSectorID = uSectorID;
       /*if ( !pRenderer->pRenderD3D )
--- a/Outdoor.cpp	Sat Feb 22 18:25:18 2014 +0100
+++ b/Outdoor.cpp	Sat Feb 22 18:25:53 2014 +0100
@@ -2793,7 +2793,7 @@
         ++uNumBillboardsToDraw;
         ++uNumSpritesDrawnThisFrame;
         pActors[i].uAttributes |= 8;
-        pBillboardRenderList[uNumBillboardsToDraw - 1].uHwSpriteID = v15->pHwSpriteIDs[v41];
+        pBillboardRenderList[uNumBillboardsToDraw - 1].HwSpriteID = v15->pHwSpriteIDs[v41];
         pBillboardRenderList[uNumBillboardsToDraw - 1].uIndoorSectorID = 0;
         pBillboardRenderList[uNumBillboardsToDraw - 1].uPalette = v15->uPaletteIndex;
         pBillboardRenderList[uNumBillboardsToDraw - 1]._screenspace_x_scaler_packedfloat = fixpoint_mul(v15->scale, v58);
--- a/Overlays.cpp	Sat Feb 22 18:25:18 2014 +0100
+++ b/Overlays.cpp	Sat Feb 22 18:25:53 2014 +0100
@@ -289,14 +289,15 @@
 //----- (0045855F) --------------------------------------------------------
 void OtherOverlay::Reset()
 {
-  this->field_10 = 65536;
-  this->field_A = 0;
+  this->field_0 = 0;
+  this->field_2 = 0;
+  this->field_4 = 0;
+  this->field_6 = 0;
   this->field_8 = 0;
-  this->field_6 = 0;
-  this->field_4 = 0;
-  this->field_2 = 0;
+  this->field_A = 0;
   this->field_C = 0;
   this->field_E = 0;
+  this->field_10 = 65536;
 }
 
 //----- (004584B8) --------------------------------------------------------
--- a/Render.cpp	Sat Feb 22 18:25:18 2014 +0100
+++ b/Render.cpp	Sat Feb 22 18:25:53 2014 +0100
@@ -152,7 +152,7 @@
       soft_billboard.sZValue = p->sZValue;
       soft_billboard.uFlags = p->field_1E;
       soft_billboard.sTintColor = p->sTintColor;
-      v2 = p->uHwSpriteID;
+      v2 = p->HwSpriteID;
       if ( v2 != -1 )
       {
         if ( pRenderer->pRenderD3D )
@@ -164,7 +164,7 @@
             soft_billboard.pPalette = pPaletteManager->field_261600[p->uPalette];
           if ( !(soft_billboard.uFlags & 0x40) && soft_billboard.uFlags & 0x80 )
             soft_billboard.pPalette2 = PaletteManager::Get_Dark_or_Red_LUT(p->uPalette, 0, 1);
-          v5 = p->uHwSpriteID;
+          v5 = p->HwSpriteID;
           if ( v5 >= 0 )
             pSprites_LOD->pSpriteHeaders[v5].DrawSprite_sw(&soft_billboard, 1);
         }
@@ -416,23 +416,21 @@
 
   for (int i = 0; i < ::uNumBillboardsToDraw; ++i)
   {
-    RenderBillboard* pBillboard = &pBillboardRenderList[i];
-
-    billboard.uScreenSpaceX = pBillboard->uScreenSpaceX;
-    billboard.uScreenSpaceY = pBillboard->uScreenSpaceY;
+    billboard.uScreenSpaceX = pBillboardRenderList[i].uScreenSpaceX;
+    billboard.uScreenSpaceY = pBillboardRenderList[i].uScreenSpaceY;
     billboard.sParentBillboardID = i;
-    billboard._screenspace_x_scaler_packedfloat = pBillboard->_screenspace_x_scaler_packedfloat;
-    billboard.sTintColor = pBillboard->sTintColor;
-    billboard._screenspace_y_scaler_packedfloat = pBillboard->_screenspace_y_scaler_packedfloat;
-    billboard.sZValue = pBillboard->sZValue;
-    billboard.uFlags = pBillboard->field_1E;
-    if (pBillboard->uHwSpriteID != -1)
+    billboard._screenspace_x_scaler_packedfloat = pBillboardRenderList[i]._screenspace_x_scaler_packedfloat;
+    billboard.sTintColor = pBillboardRenderList[i].sTintColor;
+    billboard._screenspace_y_scaler_packedfloat = pBillboardRenderList[i]._screenspace_y_scaler_packedfloat;
+    billboard.sZValue = pBillboardRenderList[i].sZValue;
+    billboard.uFlags = pBillboardRenderList[i].field_1E;
+    if (pBillboardRenderList[i].HwSpriteID != -1)
     {
       if (!pRenderer->pRenderD3D) __debugbreak(); // no sw rendering
       //if (pRenderer->pRenderD3D)
         pRenderer->TransformBillboard(&billboard,
-                                      &pSprites_LOD->pHardwareSprites[pBillboard->uHwSpriteID],
-                                      pBillboard->dimming_level, pBillboard);
+                                      &pSprites_LOD->pHardwareSprites[pBillboardRenderList[i].HwSpriteID],
+                                      pBillboardRenderList[i].dimming_level, &pBillboardRenderList[i]);
       /*else
       {
           assert(false);
@@ -516,7 +514,7 @@
       //LOWORD(v7) = object->uFacing;
       //v8 = v36;
       v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7;
-      pBillboardRenderList[::uNumBillboardsToDraw].uHwSpriteID = frame->pHwSpriteIDs[v9];
+      pBillboardRenderList[::uNumBillboardsToDraw].HwSpriteID = frame->pHwSpriteIDs[v9];
       if ( frame->uFlags & 0x20 )
       {
         //v8 = v36;
@@ -999,7 +997,7 @@
                 {
                   if (::uNumBillboardsToDraw >= 500)
                     return;
-                  pBillboardRenderList[::uNumBillboardsToDraw].uHwSpriteID = v8->pHwSpriteIDs[(int)v37];
+                  pBillboardRenderList[::uNumBillboardsToDraw].HwSpriteID = v8->pHwSpriteIDs[(int)v37];
                   pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_x_scaler_packedfloat = v41;
                   pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_y_scaler_packedfloat = v41;
                   v29 = v38;
@@ -1051,7 +1049,7 @@
                 {
                   if (::uNumBillboardsToDraw >= 500)
                     return;
-                  pBillboardRenderList[::uNumBillboardsToDraw].uHwSpriteID = v8->pHwSpriteIDs[(int)v37];
+                  pBillboardRenderList[::uNumBillboardsToDraw].HwSpriteID = v8->pHwSpriteIDs[(int)v37];
                   pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_x_scaler_packedfloat = v41;
                   pBillboardRenderList[::uNumBillboardsToDraw]._screenspace_y_scaler_packedfloat = v41;
                   v29 = v38;
--- a/Render.h	Sat Feb 22 18:25:18 2014 +0100
+++ b/Render.h	Sat Feb 22 18:25:53 2014 +0100
@@ -80,7 +80,7 @@
     };
   };
   int field_14_actor_id;
-  unsigned __int16 uHwSpriteID;
+  signed __int16 HwSpriteID;
   __int16 uPalette;
   __int16 uIndoorSectorID;
   __int16 field_1E;