changeset 491:e01730a207c3

Spell animations on portraits drawn when casting
author Nomad
date Wed, 27 Feb 2013 23:28:03 +0200
parents cc4b7981c1bb
children 59649750a054
files stru6.cpp stru6.h
diffstat 2 files changed, 16 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/stru6.cpp	Wed Feb 27 23:13:02 2013 +0200
+++ b/stru6.cpp	Wed Feb 27 23:28:03 2013 +0200
@@ -1331,7 +1331,7 @@
   //v4[32].uSpellID = uSpellID;  pPlayerBuffs[]::bRender
 
   v4 = &pPlayerBuffs[uPlayerID];
-  v4->field_4 = 0;
+  v4->uSpellAnimTimeElapsed = 0;
   v4->bRender = uSpellID != 0;
 
   switch (uSpellID)
@@ -1594,42 +1594,24 @@
 //----- (004A902A) --------------------------------------------------------
 void stru6::DrawPlayerBuffAnims()
 {
-  __int16 *v1; // edi@1
-  char *v2; // esi@1
-  unsigned int v3; // eax@3
-  unsigned __int8 v4; // zf@3
-  char v5; // sf@3
-  unsigned __int8 v6; // of@3
-  IconFrame *v7; // eax@4
+  for (uint i = 0; i < 4; ++i)
+  {
+    auto buff = pPlayerBuffs + i;
+    if (!buff->bRender)
+      continue;
 
-  uint _it = 0;
-  v1 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing;
-  v2 = (char *)&this->pPlayerBuffs[0].uSpellIconID;
-  do
-  {
-    if ( *((short *)v2 - 2) )
+    buff->uSpellAnimTimeElapsed += pEventTimer->uTimeElapsed;
+    if (buff->uSpellAnimTimeElapsed >= buff->uSpellAnimTime)
     {
-      v3 = pEventTimer->uTimeElapsed + *(int *)v2;
-      v6 = __OFSUB__(v3, *((int *)v2 + 1));
-      v4 = v3 == *((int *)v2 + 1);
-      v5 = ((v3 - *((int *)v2 + 1)) & 0x80000000u) != 0;
-      *(int *)v2 = v3;
-      if ( (unsigned __int8)(v5 ^ v6) | v4 )
-      {
-        v7 = pIconsFrameTable->GetFrame(*((int *)v2 + 2), v3);
-        pRenderer->DrawTextureTransparent(*v1, 0x181u, &pIcons_LOD->pTextures[v7->uTextureID]);
-        pOtherOverlayList->bRedraw = true;
-      }
-      else
-      {
-        *((short *)v2 - 2) = 0;
-      }
+      buff->bRender = false;
+      continue;
     }
-    v2 += 16;
-    ++v1;
+
+    auto icon = pIconsFrameTable->GetFrame(buff->uSpellIconID, buff->uSpellAnimTimeElapsed);
+    pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 385, pIcons_LOD->GetTexture(icon->uTextureID));
+
+    pOtherOverlayList->bRedraw = true;
   }
-  //while ( (signed int)v1 < (signed int)pBaseHealthByClass );
-  while (++_it != 4);
 }
 
 //----- (004A90A0) --------------------------------------------------------
--- a/stru6.h	Wed Feb 27 23:13:02 2013 +0200
+++ b/stru6.h	Wed Feb 27 23:28:03 2013 +0200
@@ -57,7 +57,7 @@
 
   __int16 bRender;
   __int16 field_2;
-  int field_4;
+  int uSpellAnimTimeElapsed;
   int uSpellAnimTime;
   int uSpellIconID;
 };