changeset 594:badd65dff4e7

Merge
author Nomad
date Wed, 06 Mar 2013 16:14:21 +0200
parents 8ef867ae88b9 (diff) 829fb49eee05 (current diff)
children 55d6b756e03a
files
diffstat 7 files changed, 34 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Wed Mar 06 12:43:58 2013 +0000
+++ b/AudioPlayer.cpp	Wed Mar 06 16:14:21 2013 +0200
@@ -90,7 +90,7 @@
       if ( pSoundList->pSounds[v2].eType != SOUND_DESC_SYSTEM || (sprintf(pSoundName, "%s", pSounds[v2].pSoundName),
             pSoundList->pSounds[v2].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)0xFFFFFFFF, pSounds[v2].uSoundID),
             !pAudioPlayer->b3DSoundInitialized)
-        || (pSoundDesc = &pSoundList->pSounds[v2], !(pSoundDesc->uFlags & 2))
+        || (pSoundDesc = &pSoundList->pSounds[v2], !(pSoundDesc->uFlags & SOUND_DESC_SWAP))
         || !pSoundDesc->pSoundData[0] ) // нужно перевернуть
         goto LABEL_17;
       pSoundData = pSoundDesc->pSoundData[0];
@@ -163,8 +163,8 @@
   if (!pSound)
     return 0;
 
-  if (pSound->uFlags & 2 && pSound->p3DSound ||
-      ~pSound->uFlags & 2 && pSound->pSoundData[0])
+  if (pSound->uFlags & SOUND_DESC_SWAP && pSound->p3DSound ||
+      ~pSound->uFlags & SOUND_DESC_SWAP && pSound->pSoundData[0])
     return uSoundIdx;
 
   if (!pSound->pSoundData[0])
@@ -174,12 +174,12 @@
     return 0;
 
   if (a3)
-    pSound->uFlags |= 1u;
+    pSound->uFlags |= SOUND_DESC_SYSTEM;
 
   if (!pAudioPlayer->b3DSoundInitialized)
     return uSoundIdx;
 
-  if (~pSound->uFlags & 2 || !pSound->pSoundData[0])
+  if (~pSound->uFlags & SOUND_DESC_SWAP || !pSound->pSoundData[0])
     return uSoundIdx;
 
 
@@ -368,7 +368,7 @@
         ReleaseSoundData(v7);
         v2->pSounds[v3].pSoundData[0] = 0;
       }
-      v2->pSounds[v3].uFlags &= 0xFFFFFFFEu;
+      v2->pSounds[v3].uFlags &= ~SOUND_DESC_SYSTEM;
     }
     ++i;
   }
@@ -387,19 +387,19 @@
   v5 = &this->pSounds[uSoundID];
   if ( v5->eType != SOUND_DESC_SYSTEM )
   {
-    if ( v5->uFlags & 2 && v5->p3DSound && a3 )
+    if ( v5->uFlags & SOUND_DESC_SWAP && v5->p3DSound && a3 )
     {
       if ( LOBYTE(v5->bDecompressed) )
         AIL_mem_free_lock(v5->p3DSound);
       pSounds[v3].p3DSound = 0;
-      pSounds[v3].uFlags &= 0xFFFFFFFEu;
+      pSounds[v3].uFlags &= ~SOUND_DESC_SYSTEM;
     }
     v6 = pSounds[v3].pSoundData[0];
     if ( v6 )
     {
       ReleaseSoundData(v6);
       pSounds[v3].pSoundData[0] = 0;
-      pSounds[v3].uFlags &= 0xFFFFFFFEu;
+      pSounds[v3].uFlags &= ~SOUND_DESC_SYSTEM;
     }
   }
 }
@@ -521,7 +521,7 @@
       if ( v19.field_0 >= 4 && !_strcmpi(v19.pProperties[3], "3D") )
       {
         v15 = (int)&v2->pSounds[v2->uNumSounds].uFlags;
-        *(int *)v15 |= 2u;
+        *(int *)v15 |= SOUND_DESC_SWAP;
       }
       ++v2->uNumSounds;
     }
@@ -1743,7 +1743,7 @@
     auto decor_desc = &pDecorationList->pDecorations[decor->uDecorationDescID];
       //v48 = &pDecorationList->pDecorations[decor->uDecorationDescID];
       //v49 = v48->uFlags;
-      uNumRepeats = (~(unsigned __int8)decor_desc->uFlags & 0x40) >> 6;
+      uNumRepeats = (~(unsigned __int8)decor_desc->uFlags & DECORATION_SLOW_LOOP) >> 6;
  
     if (decor_desc->SoundOnDawn() || decor_desc->SoundOnDusk())
     {
@@ -2231,7 +2231,7 @@
     v4 = &pSoundList->pSounds[pChannel->uSourceTrackIdx];
     if ( v4->eType == SOUND_DESC_SWAP)
     {
-      if ( v4->pSoundData[0] && !(v4->uFlags & 1) )
+      if ( v4->pSoundData[0] && !(v4->uFlags & SOUND_DESC_SYSTEM) )
       {
         v5 = this->uMixerChannels == 0;
         v6 = this->uMixerChannels < 0;
@@ -2371,7 +2371,7 @@
     v4 = &pSoundList->pSounds[a2->field_8];
     if ( v4->eType == SOUND_DESC_SWAP)
     {
-      if ( v4->p3DSound && !(v4->uFlags & 1) )
+      if ( v4->p3DSound && !(v4->uFlags & SOUND_DESC_SYSTEM) )
       {
         v5 = this->uNum3DSamples == 0;
         v6 = this->uNum3DSamples < 0;
--- a/Chest.cpp	Wed Mar 06 12:43:58 2013 +0000
+++ b/Chest.cpp	Wed Mar 06 16:14:21 2013 +0200
@@ -613,7 +613,7 @@
             if(test_position<uChestArea)
                 {
                 Chest::PlaceItemAt((unsigned __int8)chest_cells_map[test_position], items_counter, uChestID);
-                if ( pChests[uChestID].uFlags & 4 )
+                if ( pChests[uChestID].uFlags & CHEST_OPENED)
                     pChests[uChestID].igChestItems[items_counter].SetIdentified();
                 }
             }
--- a/Game.cpp	Wed Mar 06 12:43:58 2013 +0000
+++ b/Game.cpp	Wed Mar 06 16:14:21 2013 +0200
@@ -611,7 +611,7 @@
   }
   else
   {
-    if ( uFlags2 & 0x10 )
+    if ( uFlags2 & GAME_FLAGS_2_TARGETING_MODE )
     {
       v11 = &vis_face_filter;
       v10 = &vis_sprite_filter_1;
--- a/Game.h	Wed Mar 06 12:43:58 2013 +0000
+++ b/Game.h	Wed Mar 06 16:14:21 2013 +0200
@@ -16,7 +16,10 @@
 
 
 
-#define GAME_FLAGS_2_DRAW_BLOODSPLATS 0x20
+#define GAME_FLAGS_2_SATURATE_LIGHTMAPS 0x02
+#define GAME_FLAGS_2_ALTER_GRAVITY      0x08
+#define GAME_FLAGS_2_TARGETING_MODE     0x10
+#define GAME_FLAGS_2_DRAW_BLOODSPLATS   0x20
 
 
 
--- a/Party.cpp	Wed Mar 06 12:43:58 2013 +0000
+++ b/Party.cpp	Wed Mar 06 16:14:21 2013 +0200
@@ -198,38 +198,31 @@
 
 
 //----- (00492AD5) --------------------------------------------------------
-__int16 Party::SetFood(unsigned int uNumFood)
+void Party::SetFood(unsigned int uNumFood)
 {
-  __int16 result; // ax@1
-
   pUIAnim_Food->uAnimTime = 0;
   pParty->uNumFoodRations = uNumFood;
-  result = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
-  pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
-  return result;
+  pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength;
 }
 
 //----- (00492B03) --------------------------------------------------------
 void Party::TakeFood(unsigned int uNumFood)
 {
-  if ( ((pParty->uNumFoodRations - uNumFood) & 0x80000000u) == 0 )
-    pParty->uNumFoodRations -= uNumFood;
+  if (pParty->uNumFoodRations <= uNumFood)
+    pParty->uNumFoodRations = 0;
   else
-    pParty->uNumFoodRations = 0;
+    pParty->uNumFoodRations -= uNumFood;
+
   pUIAnim_Food->uAnimTime = 0;
-  pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
+  pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength;
 }
 
 //----- (00492B42) --------------------------------------------------------
-__int16 Party::GiveFood(unsigned int _this)
+void Party::GiveFood(unsigned int _this)
 {
-  __int16 result; // ax@1
-
   pParty->uNumFoodRations += _this;
   pUIAnim_Food->uAnimTime = 0;
-  result = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
-  pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Food->uIconID].uAnimLength;
-  return result;
+  pUIAnim_Food->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Food->uIconID].uAnimLength;
 }
 
 //----- (00492B70) --------------------------------------------------------
@@ -237,7 +230,7 @@
 {
   pParty->uNumGold = uNumGold;
   pUIAnim_Gold->uAnimTime = 0;
-  pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength;
+  pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength;
   pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0);
 }
 
@@ -249,7 +242,7 @@
   else
     pParty->uNumGold = 0;
   pUIAnim_Gold->uAnimTime = 0;
-  pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength;
+  pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[pUIAnim_Gold->uIconID].uAnimLength;
   pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0);
 }
 
--- a/Party.h	Wed Mar 06 12:43:58 2013 +0000
+++ b/Party.h	Wed Mar 06 16:14:21 2013 +0200
@@ -180,9 +180,9 @@
   
   static void SetGold(unsigned int uNumGold);
   static void TakeGold(unsigned int uNumGold);
-  static __int16 SetFood(unsigned int uNumFood);
+  static void SetFood(unsigned int uNumFood);
   static void TakeFood(unsigned int uNumFood);
-  static __int16 GiveFood(unsigned int _this);
+  static void GiveFood(unsigned int _this);
 
   inline bool WizardEyeActive()      {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uExpireTime > 0;}
   inline int  WizardEyeSkillLevel()  {return pPartyBuffs[PARTY_BUFF_WIZARD_EYE].uSkill;}
--- a/mm7_5.cpp	Wed Mar 06 12:43:58 2013 +0000
+++ b/mm7_5.cpp	Wed Mar 06 16:14:21 2013 +0200
@@ -15978,6 +15978,8 @@
 			v9 = pX + pSRZBufferLineOffsets[pY];
 			if ( pRenderer->pActiveZBuffer[v9] & 0xFFFF )
 			{
+
+              __debugbreak(); // invalid indexing will result in invalid object ptr
 				v8 = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18* *((short *)&pChests[0].igChestItems[139].uExpireTime
 								+ (pRenderer->pActiveZBuffer[v9] & 0xFFFF) + 2662 * (unsigned int)pChestWindow->ptr_1C + 3));
 				GameUI_DrawItemInfo(v8);