diff Render.cpp @ 2226:5944810e88e2

occasionally pRenderer->pBillboardRenderListD3D array elements are not correct (0xcdcdcdcd) fix
author Ritor1
date Thu, 20 Feb 2014 12:20:49 +0600
parents c69013c186c7
children 8817c398b792
line wrap: on
line diff
--- a/Render.cpp	Wed Feb 19 22:30:39 2014 +0100
+++ b/Render.cpp	Thu Feb 20 12:20:49 2014 +0600
@@ -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;