diff Sprites.cpp @ 639:4f2837124c69

Decoration animations
author Nomad
date Mon, 11 Mar 2013 22:20:05 +0200
parents 1bfe546561c4
children 9824e2eeee30
line wrap: on
line diff
--- a/Sprites.cpp	Mon Mar 11 21:43:26 2013 +0200
+++ b/Sprites.cpp	Mon Mar 11 22:20:05 2013 +0200
@@ -326,23 +326,29 @@
 }
 
 //----- (0044D8D0) --------------------------------------------------------
-SpriteFrame *SpriteFrameTable::GetFrame(unsigned int uSpriteID, unsigned int uFrameID)
+SpriteFrame *SpriteFrameTable::GetFrame(unsigned int uSpriteID, unsigned int uTime)
 {
-  SpriteFrame *v3; // edi@1
+  //SpriteFrame *v3; // edi@1
   SpriteFrame *v4; // ecx@1
-  __int16 v5; // dx@2
-  int v6; // edx@3
-  unsigned int v7; // eax@3
-  char *i; // ecx@3
-  int v9; // esi@5
-  SpriteFrame *result; // eax@6
+  //__int16 v5; // dx@2
+  //int v6; // edx@3
+  //unsigned int v7; // eax@3
+  //char *i; // ecx@3
+  //int v9; // esi@5
+  //SpriteFrame *result; // eax@6
 
-  v3 = this->pSpriteSFrames;
-  v4 = &v3[uSpriteID];
-  if ( v4->uFlags & 1 && (v5 = v4->uAnimLength) != 0 )
-  {
-    v6 = ((signed int)uFrameID >> 3) % v5;
-    v7 = uSpriteID;
+  v4 = &pSpriteSFrames[uSpriteID];
+  if (~v4->uFlags & 1 || !v4->uAnimLength)
+    return pSpriteSFrames + uSpriteID;
+
+  for (uint t = (uTime / 8) % v4->uAnimLength; t > v4->uAnimTime; ++v4)
+    t -= v4->uAnimTime;
+  return v4;
+
+  /*for (v4; v4->uAnimTime <= t; ++v4)
+
+    v6 = (uTime / 8) % v4->uAnimLength;
+    //v7 = uSpriteID;
     for ( i = (char *)&v4->uAnimTime; ; i += 60 )
     {
       v9 = *(short *)i;
@@ -351,13 +357,8 @@
       v6 -= v9;
       ++v7;
     }
-    result = &v3[v7];
-  }
-  else
-  {
-    result = &v3[uSpriteID];
-  }
-  return result;
+    return &pSpriteSFrames[v7];*/
+
 }
 
 //----- (0044D91F) --------------------------------------------------------