changeset 596:b5240254cbbd

Merge
author Nomad
date Wed, 06 Mar 2013 16:51:39 +0200
parents 55d6b756e03a (diff) a463d7784d33 (current diff)
children c03428cb4119 7bae884b7cd0
files mm7_5.cpp
diffstat 12 files changed, 103 insertions(+), 87 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Wed Mar 06 13:42:24 2013 +0000
+++ b/AudioPlayer.cpp	Wed Mar 06 16:51:39 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 13:42:24 2013 +0000
+++ b/Chest.cpp	Wed Mar 06 16:51:39 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 13:42:24 2013 +0000
+++ b/Game.cpp	Wed Mar 06 16:51:39 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 13:42:24 2013 +0000
+++ b/Game.h	Wed Mar 06 16:51:39 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/Indoor.cpp	Wed Mar 06 13:42:24 2013 +0000
+++ b/Indoor.cpp	Wed Mar 06 16:51:39 2013 +0200
@@ -527,8 +527,7 @@
           stru_F7B60C.face_plane.dist = pFace->pFacePlane.dist;
         }
 
-        if (stru_F8AD28.uNumLightsApplied > 0 && !pFace->uAttributes)
-            //!(pFace->uAttributes & 0x400000))
+        if (stru_F8AD28.uNumLightsApplied > 0 && !(pFace->uAttributes & 0x400000))
           pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0);
 
         if (pDecalBuilder->uNumDecals > 0)
@@ -557,17 +556,20 @@
           v23 = pFace->uBitmapID;
           goto LABEL_42;
         }
-        else if (pFace->uAttributes)//(pFace->uAttributes & 0x4000)
+        else if (pFace->uAttributes & 0x4000)
         {
           v23 = pTextureFrameTable->GetFrameTexture(pFace->uBitmapID, pBLVRenderParams->field_0_timer_);
 LABEL_42:
           v27 = pBitmaps_LOD->pHardwareTextures[v23];
-          if (pFace->uAttributes & 0x400000)
+          if (pFace->uAttributes & FACE_DO_NOT_LIGHT)
             _479A53_draw_some_blv_poly(uNumVerticesa, uFaceID);
           else
             pRenderer->DrawIndoorPolygon(uNumVerticesa, pFace, v27, v28, 8 * uFaceID | 6, v17, 0);
           return;
         }
+        //v17 = 0xFFFFFFFF;
+        v23 = pFace->uBitmapID;
+        goto LABEL_42;
       }
     }
   }
--- a/Indoor.h	Wed Mar 06 13:42:24 2013 +0000
+++ b/Indoor.h	Wed Mar 06 16:51:39 2013 +0200
@@ -257,6 +257,7 @@
 #define FACE_TEXTURE_FRAME    0x00004000 // Texture ID is a frameset from TextureFrameTable, otherwise BitmapID
 #define FACE_OUTLINED         0x00010000 // outline face edges
 #define FACE_TEXTURE_FLOW     0x00040000 // The texture moves slowly. For horizontal facets only.
+#define FACE_DO_NOT_LIGHT     0x00400000
 #define FACE_CLICKABLE        0x02000000 // Event can be triggered by clicking on the facet.
 #define FACE_PRESSURE_PLATE   0x04000000 // Event can be triggered by stepping on the facet.
 #define FACE_ETHEREAL         0x20000000 // Untouchable. You can pass through it.
--- a/LightmapBuilder.cpp	Wed Mar 06 13:42:24 2013 +0000
+++ b/LightmapBuilder.cpp	Wed Mar 06 16:51:39 2013 +0200
@@ -1621,7 +1621,7 @@
   {
     //v30 = 0.0;
     //v4 = pRenderer->pRenderD3D->pDevice;
-    ErrD3D(v4->SetTextureStageState(0, D3DTSS_ADDRESS, 3u));
+    ErrD3D(pRenderer->pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, 3u));
     //v6 = (char *)stru_69BD44.c_str();
     //if ( !stru_69BD44.c_str() )
     //  v6 = (char *)&dword_4D86F0;
--- a/Party.cpp	Wed Mar 06 13:42:24 2013 +0000
+++ b/Party.cpp	Wed Mar 06 16:51:39 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 13:42:24 2013 +0000
+++ b/Party.h	Wed Mar 06 16:51:39 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/Render.cpp	Wed Mar 06 13:42:24 2013 +0000
+++ b/Render.cpp	Wed Mar 06 16:51:39 2013 +0200
@@ -7800,14 +7800,14 @@
   double v17; // st6@10
   //char v18; // zf@10
   Texture *v19; // edx@10
-  Texture *v23; // edx@16
-  char *v24; // ecx@16
-  char *v25; // eax@16
-  double v26; // st6@17
-  int v27; // esi@17
-  double v28; // st6@17
-  unsigned int v33; // ecx@18
-  char *v34; // eax@19
+  //Texture *v23; // edx@16
+  //char *v24; // ecx@16
+  //char *v25; // eax@16
+  //double v26; // st6@17
+  //int v27; // esi@17
+  //double v28; // st6@17
+  //unsigned int v33; // ecx@18
+  //char *v34; // eax@19
   //Texture *v45; // edx@23
   //char *v46; // ecx@23
   //char *v47; // eax@23
@@ -7908,36 +7908,47 @@
     }
     else
     {
-      __debugbreak();
-        if ( (signed int)uNumVertices > 0 )
-        {
-          v23 = pTex;
-          v24 = (char *)&array_507D30[0].vWorldViewPosition;
-          v25 = (char *)&d3d_vertex_buffer[0].pos.y;
-          pTex = (Texture *)uNumVertices;
-          uint v18;
-          do
-          {
-            v26 = *(float *)v24 * 0.061758894;
-            v27 = *((int *)v24 + 3);
-            *((int *)v25 + 4) = 0;
-            *((int *)v25 - 1) = v27;
-            *(int *)v25 = *((int *)v24 + 4);
-            *((int *)v25 + 3) = uColor;
-            v25 += 32;
-            *((float *)v25 - 7) = 1.0 - 1.0 / v26;
-            v28 = 1.0 / *(float *)v24;
-            v24 += 48;
-            v18 = pTex == (Texture *)1;
-            pTex = (Texture *)((char *)pTex - 1);
-            *((float *)v25 - 6) = v28;
+      for (uint i = 0; i < uNumVertices; ++i)
+      {
+        d3d_vertex_buffer[i].pos.x = array_507D30[i].vWorldViewProjX;
+        d3d_vertex_buffer[i].pos.y = array_507D30[i].vWorldViewProjY;
+        d3d_vertex_buffer[i].pos.z = 1.0 - 1.0 / (array_507D30[i].vWorldViewPosition.x * 0.061758894);
+        d3d_vertex_buffer[i].rhw = 1.0 / array_507D30[i].vWorldViewPosition.x;
+        d3d_vertex_buffer[i].diffuse = uColor;
+        d3d_vertex_buffer[i].specular = 0;
+        d3d_vertex_buffer[i].texcoord.x = array_507D30[i].u / (double)pTex->uTextureWidth;
+        d3d_vertex_buffer[i].texcoord.y = array_507D30[i].v / (double)pTex->uTextureHeight;
+      }
+      //__debugbreak();
+        //if ( (signed int)uNumVertices > 0 )
+        //{
+          //v23 = pTex;
+          //v24 = (char *)&array_507D30[0].vWorldViewPosition;
+          //v25 = (char *)&d3d_vertex_buffer[0].pos.y;
+          //pTex = (Texture *)uNumVertices;
+          //uint v18;
+          //do
+          //{
+            //v26 = *(float *)v24 * 0.061758894;
+            //v27 = *((int *)v24 + 3);
+            //*((int *)v25 + 4) = 0;
+            //*((int *)v25 - 1) = v27;
+            //*(int *)v25 = *((int *)v24 + 4);
+            //*((int *)v25 + 3) = uColor;
+            //v25 += 32;
+            //*((float *)v25 - 7) = 1.0 - 1.0 / v26;
+            //v28 = 1.0 / *(float *)v24;
+            //v24 += 48;
+            //v18 = pTex == (Texture *)1;
+            //pTex = (Texture *)((char *)pTex - 1);
+            //*((float *)v25 - 6) = v28;
             //a3 = (BLVFace *)v23->uTextureWidth;
-            *((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth;
+            //*((float *)v25 - 3) = *((float *)v24 - 6) / (double)(signed int)v23->uTextureWidth;
             //a3 = (BLVFace *)v23->uTextureHeight;
-            *((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight;
-          }
-          while ( !v18 );
-        }
+            //*((float *)v25 - 2) = *((float *)v24 - 5) / (double)(signed int)v23->uTextureHeight;
+          //}
+          //while ( !v18 );
+        //}
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false));
         ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));
         ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr));
@@ -7946,9 +7957,13 @@
                 d3d_vertex_buffer,
                 uNumVertices,
                 28));
-        ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, 1));
+
+        ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE));
         pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0);
-        v33 = uNumVertices;
+
+        for (uint i = 0; i < uNumVertices; ++i)
+          d3d_vertex_buffer[i].diffuse = uCorrectedColor;
+        /*v33 = uNumVertices;
         if ( (signed int)uNumVertices > 0 )
         {
           v34 = (char *)&d3d_vertex_buffer[0].diffuse;
@@ -7959,7 +7974,7 @@
             --v33;
           }
           while ( v33 );
-        }
+        }*/
         ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex));
         ErrD3D(pRenderD3D->pDevice->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP));
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE));
--- a/mm7_1.cpp	Wed Mar 06 13:42:24 2013 +0000
+++ b/mm7_1.cpp	Wed Mar 06 16:51:39 2013 +0200
@@ -2511,8 +2511,8 @@
           sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], item_desc->uDamageDice + item_desc->uDamageMod);
       break;
       case EQUIP_POTION:
-          if ( inspect_item->uEncantmentType )
-              sprintf(out_text + 200,  "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEncantmentType); //"Power"
+          if ( inspect_item->uEnchantmentType )
+              sprintf(out_text + 200,  "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power"
           break;
       case EQUIP_REAGENT:
          sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power"
@@ -2522,10 +2522,10 @@
     if ( !v77 )
 	{
     //v23 = item_desc->uEquipType;
-		if ( inspect_item->uEncantmentType )
+		if ( inspect_item->uEnchantmentType )
 		 {
 			sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210],
-				 pItemsTable->pEnchantments[inspect_item->uEncantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special"
+				 pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special"
 		}
 		else  if ( inspect_item->uSpecEnchantmentType )
 		  {      
@@ -2565,7 +2565,7 @@
         wHintWindow.uFrameHeight = v73->uTextureHeight + v81 + 54;
         if ( (signed int)Str > (signed int)wHintWindow.uFrameHeight )
             wHintWindow.uFrameHeight = (unsigned int)Str;
-        if ( inspect_item->uAttributes & 8 && (inspect_item->uSpecEnchantmentType || inspect_item->uEncantmentType) )
+        if ( inspect_item->uAttributes & 8 && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
             wHintWindow.uFrameHeight += LOBYTE(pFontComic->uFontHeight);
         v85 = 0;
         if ( pFontArrus->uFontHeight )
@@ -2633,7 +2633,7 @@
                 }
             else
                 {
-                if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEncantmentType) )
+                if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
                     {
                     sub_493F79(&v67, inspect_item->uExpireTime - pParty->uTimePlayed);
                     strcpy(pTmpBuf, "Duration:");
@@ -4894,7 +4894,7 @@
     {
       player = pPlayers[uActiveCharacter];
     }
-    if(playerCanAct() || !pPlayers[uActiveCharacter]->CanAct())
+    if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct())
 		player->PlaySound(SPEECH_NoRoom, 0);
   }
 
--- a/mm7_5.cpp	Wed Mar 06 13:42:24 2013 +0000
+++ b/mm7_5.cpp	Wed Mar 06 16:51:39 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);