diff mm7_3.cpp @ 1515:46f6fc6f72fd

Clean :-)
author yoctozepto
date Tue, 03 Sep 2013 15:29:09 +0200
parents ff1867836af5
children f3cd08b89476
line wrap: on
line diff
--- a/mm7_3.cpp	Tue Sep 03 15:09:07 2013 +0200
+++ b/mm7_3.cpp	Tue Sep 03 15:29:09 2013 +0200
@@ -7190,40 +7190,25 @@
 }
 
 //----- (0044882F) --------------------------------------------------------
-void __fastcall SetDecorationSprite(unsigned int uCog, int a2, const char *pFileName)
+void __fastcall SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName)
 {
-  signed int v3; // ebp@1
-  char *v4; // esi@2
-  unsigned __int16 v5; // ax@6
-  unsigned int v6; // [sp+4h] [bp-8h]@1
-  int v7; // [sp+8h] [bp-4h]@1
-
-  v3 = 0;
-  v7 = a2;
-  v6 = uCog;
-  if ( (signed int)uNumLevelDecorations > 0 )
-  {
-    v4 = (char *)&pLevelDecorations[0].uFlags;
-    do
+  for (size_t i = 0; i < uNumLevelDecorations; i++)
+  {
+    if (pLevelDecorations[i].uCog == uCog)
     {
-      if ( *((_WORD *)v4 + 9) == v6 )
+      if (pFileName && strcmp(pFileName, "0"))
       {
-        if ( pFileName && _stricmp(pFileName, "0") )
-        {
-          v5 = pDecorationList->GetDecorIdByName(pFileName);
-          *((_WORD *)v4 - 1) = v5;
-          pDecorationList->InitializeDecorationSprite((signed __int16)v5);
-        }
-        if ( v7 )
-          *v4 &= 0xDFu;
-        else
-          *v4 |= 0x20u;
-        pParty->uFlags |= 2u;
+        pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pFileName);
+        pDecorationList->InitializeDecorationSprite(pLevelDecorations[i].uDecorationDescID);
       }
-      ++v3;
-      v4 += 32;
+
+      if (bHide)
+        pLevelDecorations[i].uFlags &= ~LEVEL_DECORATION_INVISIBLE;
+      else
+        pLevelDecorations[i].uFlags |= LEVEL_DECORATION_INVISIBLE;
+
+      pParty->uFlags |= 2u;
     }
-    while ( v3 < (signed int)uNumLevelDecorations );
   }
 }