changeset 1515:46f6fc6f72fd

Clean :-)
author yoctozepto
date Tue, 03 Sep 2013 15:29:09 +0200
parents 965af46e8793
children f3cd08b89476
files mm7_3.cpp mm7_data.h
diffstat 2 files changed, 15 insertions(+), 30 deletions(-) [+]
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 );
   }
 }
 
--- a/mm7_data.h	Tue Sep 03 15:09:07 2013 +0200
+++ b/mm7_data.h	Tue Sep 03 15:29:09 2013 +0200
@@ -1360,7 +1360,7 @@
 int NPC_EventProcessor(int npc_event_id, int entry_line = 0);
 void __fastcall sub_448518_npc_set_item(int npc, unsigned int item, int a3);
 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename);
-void __fastcall SetDecorationSprite(unsigned int uCog, int a2, const char *pFileName); // idb
+void __fastcall SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName); // idb
 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on);
 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle);
 void  GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide); // idb