changeset 2439:daf7807d0a86

Merge
author a.parshin
date Thu, 24 Jul 2014 00:32:18 +0300
parents c10c639f8365 (current diff) ea7748f4dc60 (diff)
children 135b2116db9d
files
diffstat 1 files changed, 3 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Sprites.cpp	Thu Jul 24 00:31:49 2014 +0300
+++ b/Sprites.cpp	Thu Jul 24 00:32:18 2014 +0300
@@ -406,17 +406,9 @@
   memcpy(pSpriteSFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 8, mm8_frames_size);
   memcpy(pSpriteEFrames + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 8 + mm8_frames_size, 2 * num_mm8_eframes);
 
-  for (uint i = 0; i < num_mm7_frames; ++i)
-    pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i]];//Uninitialized memory access
-  
-  for (uint i = num_mm7_frames; i < num_mm6_frames + num_mm7_frames; ++i)
-    pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i] + num_mm7_frames];
-  
-  for (uint i = num_mm6_frames + num_mm7_frames; i < num_mm6_frames + num_mm7_frames + num_mm8_frames; ++i)
-    pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i] + num_mm6_frames + num_mm7_frames];
-
-  //for (uint i = 0; i < uNumSpriteFrames; ++i)
-  //  pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i]];
+  //the original was using num_mmx_frames, but never accessed any element beyond num_mmx_eframes, but boing beyong eframes caused invalid memory accesses
+  for (uint i = 0; i < num_mm6_eframes + num_mm7_eframes + num_mm8_eframes; ++i)
+    pSpritePFrames[i] = &pSpriteSFrames[pSpriteEFrames[i]];
 }
 
 //----- (0044DA92) --------------------------------------------------------