diff mm7_3.cpp @ 1542:7d986a396092

Merge
author Nomad
date Sat, 07 Sep 2013 13:03:18 +0200
parents 86cb7398d2a8 863de6ec906b
children 499761153844
line wrap: on
line diff
--- a/mm7_3.cpp	Sat Sep 07 12:51:06 2013 +0200
+++ b/mm7_3.cpp	Sat Sep 07 13:03:18 2013 +0200
@@ -5639,45 +5639,6 @@
   MM7Initialization();
 }
 
-//----- (0047A825) --------------------------------------------------------
-bool LevelDecoration::_47A825()
-{
-  bool v1; // ebx@1
-  LevelDecoration *v2; // edi@1
-
-  v1 = 0;
-  v2 = this;
-  if ( pParty->uCurrentHour >= 1 || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 178) )
-  {
-    v1 = 0;
-  }
-  else
-  {
-    if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 164)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 165)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 166)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 167)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 168)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 169)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 170)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 171)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 172)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 173)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 174)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 175)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 176)
-      && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 177) )
-    {
-      v1 = 1;
-      LOBYTE(v2->field_2) &= 0xDFu;
-      return v1;
-    }
-  }
-  LOBYTE(v2->field_2) |= 0x20u;
-  return v1;
-}
-
-
 //----- (0047C370) --------------------------------------------------------
 unsigned int GetLevelFogColor()
 {
@@ -6357,8 +6318,8 @@
   char *v3; // esi@1
   int v4; // edi@4
   bool v5; // ecx@4
-  SpriteFrame *v6; // eax@6
-  SpriteFrame *v7; // edi@6
+  SpriteFrame *pFrame; // eax@6
+  //SpriteFrame *v7; // edi@6
   int v8; // eax@6
   unsigned __int16 v9; // ax@6
   RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1
@@ -6396,24 +6357,24 @@
         {
           if ( !pOtherOverlayList->pOverlays[i].field_0 )
           {
-            v6 = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID,
+            pFrame = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID,
                    pOtherOverlayList->pOverlays[i].field_4);
-            v7 = v6;
+            //v7 = v6;
             v11 = pOtherOverlayList->pOverlays[i].field_E;
-            v13 = v6->scale;
-            v13 = (unsigned __int64)(v11 * (signed __int64)v13) >> 16;
+            //v13 = pFrame->scale;
+            v13 = (unsigned __int64)(v11 * (signed __int64)pFrame->scale) >> 16;
             v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8;
             v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A;
             v10._screenspace_x_scaler_packedfloat = v13;
             v10._screenspace_y_scaler_packedfloat = v13;
-            v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v6->uPaletteIndex, 0, 1);
+            v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(pFrame->uPaletteIndex, 0, 1);
             v8 = pOtherOverlayList->pOverlays[i].field_2;
             v10.sZValue = 0;
             v10.uFlags = 0;
             v9 = pOverlayList->pOverlays[v8].uOverlayType;
             if ( !v9 || v9 == 2 )
-              v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[v7->pHwSpriteIDs[0]].uHeight >> 1;
-            result = pSprites_LOD->pSpriteHeaders[v7->pHwSpriteIDs[0]]._4AD2D1(&v10, 0);
+              v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]].uHeight >> 1;
+            result = pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]]._4AD2D1(&v10, 0);
             ++v12;
             if ( v12 == 5 )
               break;
@@ -7229,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].field_2;
-    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 );
   }
 }
 
@@ -7619,7 +7565,7 @@
         pParty->vPosition.z = _5B65B0_npcdata_rep_or_other;
         pParty->uFallStartY = _5B65B0_npcdata_rep_or_other;
       }
-      if ( _5B65B4_npcdata_loword_house_or_other )
+      if ( _5B65B4_npcdata_loword_house_or_other != -1 )
         pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other;
       if ( _5B65B8_npcdata_hiword_house_or_other )
         pParty->sRotationX = _5B65B8_npcdata_hiword_house_or_other;
@@ -7799,70 +7745,6 @@
   return true;
 }
 
-//----- (0044C2F4) --------------------------------------------------------
-bool LevelDecoration::IsInteractive()
-{
-  switch (uDecorationDescID)
-  {
-    case 4:    // trash pile
-    case 5:    // campfire
-    case 6:    // cauldron
-    case 11:   // fruit plate
-    case 13:   // trash pile
-    case 14:   // dirt
-    case 24:   // keg
-    case 184:  // fire
-    case 187:  // fire
-    case 190:  // fire
-      return true;
-  }
-
-  if (uDecorationDescID >= 206 && uDecorationDescID <= 209) // lighthouse fire
-    return true;
-  if (uDecorationDescID >= 210 && uDecorationDescID <= 221) // magic pedistal
-    return true;
-
-  return false;
-}
-
-//----- (0044C362) --------------------------------------------------------
-void Vec3_int_::Normalize_float()
-{
-  //Vec3_int_ *v1; // esi@1
-  double v2; // st6@1
-  float v3; // ST20_4@1
-  double v4; // st5@1
-  float v5; // ST18_4@1
-  double v6; // st4@1
-  float v7; // ST14_4@1
-  float v8; // ST24_4@1
-  float v9; // ST20_4@1
-  double v10; // ST0C_8@1
-  float v11; // ST18_4@1
-  double v12; // ST0C_8@1
-  float v13; // ST14_4@1
-  double v14; // ST0C_8@1
-
-  assert(false);
-  //v1 = this;
-  v2 = (double)this->x * 0.000015258789;
-  v3 = v2;
-  v4 = (double)this->y * 0.000015258789;
-  v5 = v4;
-  v6 = (double)this->z * 0.000015258789;
-  v7 = v6;
-  v8 = 1.0 / sqrt(v6 * v6 + v4 * v4 + v2 * v2);
-  v9 = v8 * v3 * 65536.0;
-  v10 = v9 + 6.7553994e15;
-  this->x = LODWORD(v10);
-  v11 = v8 * v5 * 65536.0;
-  v12 = v11 + 6.7553994e15;
-  this->y = LODWORD(v12);
-  v13 = v8 * v7 * 65536.0;
-  v14 = v13 + 6.7553994e15;
-  this->z = LODWORD(v14);
-}
-
 //----- (00401000) --------------------------------------------------------
 void mm7__vector_constructor(void *a1, int objSize, int numObjs, int ( *constructor)(int))
 {