diff Render.cpp @ 973:ec7568e13b24

Minor code cleaning.
author Nomad
date Wed, 08 May 2013 21:37:12 +0200
parents c0d0656aa662
children 062788391c88 c5d8ea1e6ccb
line wrap: on
line diff
--- a/Render.cpp	Wed May 08 19:54:19 2013 +0200
+++ b/Render.cpp	Wed May 08 21:37:12 2013 +0200
@@ -208,7 +208,7 @@
 }
 
 //----- (00487389) --------------------------------------------------------
-__int16 Render::ExecOutdoorDrawSW()
+void Render::ExecOutdoorDrawSW()
 {
   unsigned __int16 *v0; // ebx@1
   unsigned int v1; // esi@1
@@ -227,7 +227,7 @@
   int v14; // ecx@37
   int v15; // eax@40
   Texture *v16; // ebp@51
-  unsigned int v17; // eax@51
+  //unsigned int v17; // eax@51
   int v18; // eax@54
   char v19; // al@56
   unsigned int v20; // eax@57
@@ -315,8 +315,7 @@
                     while ( 1 )
                     {
                       v16 = v4->pTexture;
-                      v17 = pBitmaps_LOD->LoadTexture("wtrtyl");
-                      v4->pTexture = (Texture *)(v17 != -1 ? (int)&pBitmaps_LOD->pTextures[v17] : 0);
+                      v4->pTexture = pBitmaps_LOD->LoadTexturePtr("wtrtyl");
                       if ( pOutdoorCamera->outdoor_no_wavy_water )
                         sr_sub_48408A_prolly_odm_water_no_waves(v3);
                       else
@@ -549,12 +548,19 @@
   }
   v9 = pOutdoorCamera->uNumSpans;
   unnamed_6BE060[0] = pOutdoorCamera->uNumSpans;
-  if ( pOutdoorCamera->numStru148s >= 1999
-    || (array_77EC08[1999]._48607B(&stru_8019C8),
-        array_77EC08[1999].ptr_38->_48694B(),
-        v2 = (stru148 *)&pBitmaps_LOD->pTextures[pOutdoor->uMainTile_BitmapID],
-        (array_77EC08[1999].pTexture = (Texture *)(pOutdoor->uMainTile_BitmapID != -1 ? (int)v2 : 0)) == 0) )
-    return (signed __int16)v2;
+  if (pOutdoorCamera->numStru148s >= 1999)
+    return;
+
+  array_77EC08[1999]._48607B(&stru_8019C8);
+  array_77EC08[1999].ptr_38->_48694B();
+
+  if (pOutdoor->uMainTile_BitmapID == -1)
+  {
+    array_77EC08[1999].pTexture = nullptr;
+    return;
+  }
+  else
+    array_77EC08[1999].pTexture = pBitmaps_LOD->GetTexture(pOutdoor->uMainTile_BitmapID);
   array_77EC08[1999].dimming_level = 23 - (-20 * pOutdoor->vSunlight.z >> 16);
   if ( array_77EC08[1999].dimming_level > 20 )
     array_77EC08[1999].dimming_level = 20;
@@ -570,10 +576,14 @@
   sin((double)pIndoorCamera->sRotationX * 0.0030664064);
   array_77EC08[1999]._48607B(&stru_8019C8);
   array_77EC08[1999].ptr_38->_48694B();
-  v2 = (stru148 *)&pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID];
-  array_77EC08[1999].pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? (int)v2 : 0);
-  if ( !(pOutdoor->uSky_TextureID != -1 ? (int)v2 : 0) )
-    return (signed __int16)v2;
+
+  if (pOutdoor->uSky_TextureID == -1)
+  {
+    array_77EC08[1999].pTexture = nullptr;
+    return;
+  }
+  else
+    array_77EC08[1999].pTexture = pBitmaps_LOD->GetTexture(pOutdoor->uSky_TextureID);
   array_77EC08[1999].dimming_level = 0;
   v11 = stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);
   array_77EC08[1999].v_18.y = 0;
@@ -591,7 +601,7 @@
     v2 = (stru148 *)*(short *)PaletteManager::Get_Mist_or_Red_LUT(array_77EC08[1999].pTexture->palette_id2, 31, 1);
     a1b = (unsigned int)v2;
     if ( (signed int)v9 <= 0 )
-      return (signed __int16)v2;
+      return;
     v29 = v9;
     while ( 1 )
     {
@@ -630,7 +640,7 @@
       --v29;
       --v9;
       if ( !v9 )
-        return (signed __int16)v2;
+        return;
     }
   }
   if ( (signed int)v9 > 0 )
@@ -675,7 +685,6 @@
     }
     while ( v9 );
   }
-  return (signed __int16)v2;
 }
 
 //----- (00485044) --------------------------------------------------------