changeset 1740:0155fb9254dd

Слияние
author Ritor1
date Fri, 27 Sep 2013 15:19:46 +0600
parents 1776d4f033a7 (current diff) ef86fc6d6a80 (diff)
children 4b0e19d91505
files mm7_data.cpp
diffstat 14 files changed, 398 insertions(+), 442 deletions(-) [+]
line wrap: on
line diff
--- a/CastSpellInfo.cpp	Fri Sep 27 15:19:32 2013 +0600
+++ b/CastSpellInfo.cpp	Fri Sep 27 15:19:46 2013 +0600
@@ -2996,7 +2996,7 @@
 					if ( pLevelDecorations[v445].IsInteractive() )
 					{
 						activeLevelDecoration = &pLevelDecorations[v445];
-						EventProcessor(stru_5E4C90._decor_events[pLevelDecorations[v445]._idx_in_stru123 - 75] + 380, 0, 1);
+						EventProcessor(stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v445]._idx_in_stru123 - 75] + 380, 0, 1);
 						activeLevelDecoration = NULL;
 					}
 				}
--- a/Events.cpp	Fri Sep 27 15:19:32 2013 +0600
+++ b/Events.cpp	Fri Sep 27 15:19:46 2013 +0600
@@ -654,12 +654,12 @@
         v25 = EVT_DWORD(_evt->v5);
         if ( v25 )
           {
-          stru_5E4C90._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124;
+          stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration->_idx_in_stru123] = _evt->v5 - 124;
           }
         else
           {
           v26 = (LevelDecoration *)activeLevelDecoration;
-          stru_5E4C90._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0;
+          stru_5E4C90_MapPersistVars._decor_events[activeLevelDecoration ->_idx_in_stru123] = 0;
           v26->uFlags |= LEVEL_DECORATION_INVISIBLE;
           }
         ++curr_seq_num;
--- a/Events.h	Fri Sep 27 15:19:32 2013 +0600
+++ b/Events.h	Fri Sep 27 15:19:46 2013 +0600
@@ -257,14 +257,9 @@
   VAR_Eradicated = 0x79,
   VAR_MajorCondition = 0x7A,
   VAR_MapPersistentVariable_0 = 123,
-  VAR_MapPersistentVariable_1 = 124,
-  VAR_MapPersistentVariable_2 = 125,
-  VAR_MapPersistentVariable_3 = 126,
-  VAR_MapPersistentVariable_4 = 127,
-  VAR_MapPersistentVariable_5 = 0x80,
-  VAR_NPCs = 0xD6,
-  VAR_Reputation = 0xD7,
-  VAR_ActiveSpells = 0xDE,
+  VAR_MapPersistentVariable_74 = 0xC5,
+  VAR_MapPersistentVariable_75 = 0xC6,
+  VAR_MapPersistentVariable_99 = 0xDE,
   VAR_AutoNotes = 0xDF,
   VAR_IsMightMoreThanBase = 0xE0,
   VAR_IsIntellectMoreThanBase = 0xE1,
--- a/Indoor.cpp	Fri Sep 27 15:19:32 2013 +0600
+++ b/Indoor.cpp	Fri Sep 27 15:19:46 2013 +0600
@@ -2419,7 +2419,7 @@
 
   pGameLoadingUI_ProgressBar->Progress();
 
-  memcpy(&stru_5E4C90, pData, 0xC8);
+  memcpy(&stru_5E4C90_MapPersistVars, pData, 0xC8);
   pData += 0xC8;
 
   pGameLoadingUI_ProgressBar->Progress();
@@ -3874,7 +3874,7 @@
           {
             v21 = v35 + 1;
             pDecortaion->_idx_in_stru123 = v35 + 75;
-            v22 = stru_5E4C90._decor_events[v21 + 74 - 75];
+            v22 = stru_5E4C90_MapPersistVars._decor_events[v21 + 74 - 75];
             v35 = v21;
             if ( !v22 )
               pDecortaion->uFlags |= LEVEL_DECORATION_INVISIBLE;
@@ -6132,7 +6132,7 @@
           return 1;
         v10 = v8->_idx_in_stru123;
         v24 = 1;
-        v11 = stru_5E4C90._decor_events[v10 - 75] + 380;
+        v11 = stru_5E4C90_MapPersistVars._decor_events[v10 - 75] + 380;
         activeLevelDecoration = v8;
         EventProcessor(v11, 0, 1);
         activeLevelDecoration = NULL;
--- a/Outdoor.cpp	Fri Sep 27 15:19:32 2013 +0600
+++ b/Outdoor.cpp	Fri Sep 27 15:19:46 2013 +0600
@@ -2299,7 +2299,7 @@
   //v96 = (char *)v95 + (int)pFilename;
   pGameLoadingUI_ProgressBar->Progress();
 
-  memcpy(&stru_5E4C90, pSrc, 0xC8);
+  memcpy(&stru_5E4C90_MapPersistVars, pSrc, 0xC8);
   pSrc += 0xC8;
 
   pGameLoadingUI_ProgressBar->Progress();
@@ -2700,7 +2700,7 @@
           {
             v6 = v1 + 75;
             decor->_idx_in_stru123 = v6;
-            if ( !stru_5E4C90._decor_events[v1++] )
+            if ( !stru_5E4C90_MapPersistVars._decor_events[v1++] )
               decor->uFlags |= LEVEL_DECORATION_INVISIBLE;
           }
         }
--- a/Party.h	Fri Sep 27 15:19:32 2013 +0600
+++ b/Party.h	Fri Sep 27 15:19:46 2013 +0600
@@ -155,7 +155,7 @@
  // int field_50[170];
   __int64 Shops_next_generation_time[85];//field_50
   __int64 _shop_ban_times[53];
-  int field_4A0[20];
+  unsigned __int64 CounterEventValues[10];
   int field_4F0[38];
   char field_588[2];
   __int64 _s_times[21]; //5d8 440h+8*51
--- a/Player.cpp	Fri Sep 27 15:19:32 2013 +0600
+++ b/Player.cpp	Fri Sep 27 15:19:46 2013 +0600
@@ -24,6 +24,7 @@
 #include "Awards.h"
 #include "texts.h"
 
+#include "stru123.h"
 #include "mm7_data.h"
 #include "MM7.h"
 #include "SpriteObject.h"
@@ -1688,7 +1689,6 @@
 //----- (0048D0B9) --------------------------------------------------------
 int Player::GetRangedAttack()
 {
-  int v2; // eax@1
   int v3; // edi@3
   int v4; // eax@4
   int v5; // edi@4
@@ -4985,98 +4985,79 @@
   }
 }
 
+
+bool CmpSkillValue(int valToCompare, int skillValue)
+{
+  int v4;
+  if ( valToCompare <= 63 )
+    v4 = skillValue & 0x3F;
+  else
+    v4 = valToCompare & skillValue;
+  return v4 >= valToCompare;
+}
+
 //----- (00449BB4) --------------------------------------------------------
-bool Player::CompareVariable( enum VariableType VarNum, signed int pValue )   // in some cases this calls only calls v4 >= pValue, which i've changed to return false, since these values are supposed to be positive
+bool Player::CompareVariable( enum VariableType VarNum, signed int pValue )   // in some cases this calls only calls v4 >= pValue, which i've changed to return false, since these values are supposed to be positive and v4 was -1 by default
 {
   Assert(pValue >= 0, "Compare variable shouldn't have negative arguments");
 
   signed int v4; // edi@1
-  unsigned int v5; // eax@8
-  int v6; // eax@9
-  enum CHARACTER_RACE v7; // eax@11
-  signed int v8; // eax@17
-  unsigned __int8 v9; // sf@17
-  unsigned __int8 v10; // of@17
-  int v11; // eax@19
-  unsigned int v12; // eax@20
-  unsigned int test_bit_value; // eax@25
+  unsigned __int8 test_bit_value; // eax@25
   unsigned __int8 byteWithRequestedBit; // cl@25
-  signed int v15; // ecx@28
-  ItemGen *v16; // eax@28
-  int v18; // edi@90
   DDM_DLV_Header *v19; // eax@122
   DDM_DLV_Header *v21; // eax@126
-  unsigned int v22; // edi@129
-  Player *v23; // esi@134
-  ItemGen *v24; // ecx@135
-  signed int v25; // edx@135
-  ITEM_EQUIP_TYPE v26; // ebx@155
-  char *v27; // edi@155
-  int v28; // ebx@161
-  int v29; // eax@161
-
-  v6 = 0;
-  v4 = -1;
+  int actStat; // ebx@161
+  int baseStat; // eax@161
+
   if ( VarNum > VAR_AutoNotes )
   {
     switch ( VarNum )
     {
-      case VAR_Invisible:
-        if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime >0 )
+      case VAR_AutoNotes :  //TODO: find out why the double subtraction. or whether this is even used
+        test_bit_value = 0x80u >> (pValue - 2) % 8;
+        byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8];
+        return (test_bit_value & byteWithRequestedBit) != 0;
+      case VAR_IsMightMoreThanBase:
+        actStat = GetActualMight();
+        baseStat = GetBaseStrength();
+        return (actStat >= baseStat);
+      case VAR_IsIntellectMoreThanBase:
+        actStat = GetActualIntelligence();
+        baseStat = GetBaseIntelligence();
+        return (actStat >= baseStat);
+      case VAR_IsPersonalityMoreThanBase:
+        actStat = GetActualWillpower();
+        baseStat = GetBaseWillpower();
+        return (actStat >= baseStat);
+      case VAR_IsEnduranceMoreThanBase:
+        actStat = GetActualEndurance();
+        baseStat = GetBaseEndurance();
+        return (actStat >= baseStat);
+      case VAR_IsSpeedMoreThanBase:
+        actStat = GetActualSpeed();
+        baseStat = GetBaseSpeed();
+        return (actStat >= baseStat);
+      case VAR_IsAccuracyMoreThanBase:
+        actStat = GetActualAccuracy();
+        baseStat = GetBaseAccuracy();
+        return (actStat >= baseStat);
+      case VAR_IsLuckMoreThanBase:
+        actStat = GetActualLuck();
+        baseStat = GetBaseLuck();
+        return (actStat >= baseStat);
+      case VAR_PlayerBits:
+        test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8;
+        byteWithRequestedBit = this->field_1A50[((signed __int16)pValue - 1)/8];
+        return ( test_bit_value & byteWithRequestedBit ) != 0;
+      case VAR_NPCs2:
+        return pNPCStats->pNewNPCData[pValue].Hired();
+      case VAR_IsFlying:
+        if ( pParty->bFlying
+          && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) )
           return true;
         return false;
-      case VAR_NumDeaths:
-        v4 = pParty->uNumDeaths;
-        return v4 >= pValue;
-      case VAR_NumBounties:
-        v4 = pParty->uNumBountiesCollected;
-        return v4 >= pValue;
-      case VAR_PrisonTerms:
-        v4 = pParty->uNumPrisonTerms;
-        return v4 >= pValue;
-      case VAR_ArenaWinsPage:
-        v4 = (unsigned __int8)pParty->uNumArenaPageWins;
-        return v4 >= pValue;
-      case VAR_ArenaWinsSquire:
-        v4 = (unsigned __int8)pParty->uNumArenaSquireWins;
-        return v4 >= pValue;
-      case VAR_ArenaWinsKnight:
-        v4 = (unsigned __int8)pParty->uNumArenaKnightWins;
-        return v4 >= pValue;
-      case VAR_ArenaWinsLord:
-        v4 = (unsigned __int8)pParty->uNumArenaLordWins;
-        return v4 >= pValue;
-      case VAR_ReputationInCurrentLocation:
-        v19 = &pOutdoor->ddm;
-        if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
-          v19 = &pIndoor->dlv;
-        v6 = v19->uReputation >= pValue;
-        return v6;
-      case VAR_Unknown1:
-        v21 = &pOutdoor->ddm;
-        if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
-          v21 = &pIndoor->dlv;
-        v6 = v21->field_C_alert == pValue;
-        return v6;
-      case VAR_Counter1:
-      case VAR_Counter2:
-      case VAR_Counter3:
-      case VAR_Counter4:
-      case VAR_Counter5:
-      case VAR_Counter6:
-      case VAR_Counter7:
-      case VAR_Counter8:
-      case VAR_Counter9:
-      case VAR_Counter10:
-        v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304];
-        if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]
-          && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300])
-                            + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed )
-          return true;
-        return false;
-      case VAR_NumSkillPoints:
-        v4 = this->uSkillPoints;
-        return v4 >= pValue;
+      case VAR_HiredNPCHasSpeciality:
+        return CheckHiredNPCSpeciality(pValue);
       case VAR_CircusPrises:    //isn't used in MM6 since 0x1D6u is a book of regeneration
         v4 = 0;
         for (int playerNum = 0; playerNum < 4; playerNum++)
@@ -5099,25 +5080,52 @@
           }
         }
         return v4 >= pValue;
+      case VAR_NumSkillPoints:
+        return this->uSkillPoints >= (unsigned int)pValue;
       case VAR_MonthIs:
-        v6 = pParty->uCurrentMonth == pValue;
-        return v6;
-      case VAR_IsFlying:
-        if ( pParty->bFlying
-          && (pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime> 0) )
-          return true;
-        return false;
-      case VAR_HiredNPCHasSpeciality:
-        return CheckHiredNPCSpeciality(pValue);
-      case VAR_NPCs2:
-        return pNPCStats->pNewNPCData[pValue].Hired();
-      case VAR_PlayerBits:
-        test_bit_value = 0x80u >> ((signed __int16)pValue - 1) % 8;
-        byteWithRequestedBit = this->field_1A50[((signed __int16)pValue - 1)/8];
-        if ( !((unsigned __int8)test_bit_value & byteWithRequestedBit) )
-          return v4 >= pValue;
-        v4 = pValue;
-        return v4 >= pValue;
+        return (pParty->uCurrentMonth == (unsigned int)pValue);
+      case VAR_Counter1:
+      case VAR_Counter2:
+      case VAR_Counter3:
+      case VAR_Counter4:
+      case VAR_Counter5:
+      case VAR_Counter6:
+      case VAR_Counter7:
+      case VAR_Counter8:
+      case VAR_Counter9:
+      case VAR_Counter10:
+        if (pParty->field_3C.CounterEventValues[VarNum - VAR_Counter1])         //originally (signed __int64)(__PAIR__(*(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304], *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300])
+        {
+          return (pParty->field_3C.CounterEventValues[VarNum - VAR_Counter1] + 460800 * pValue * 0.033333335) <= pParty->uTimePlayed ;
+        }
+      case VAR_ReputationInCurrentLocation:
+        v19 = &pOutdoor->ddm;
+        if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
+          v19 = &pIndoor->dlv;
+        return (v19->uReputation >= pValue);
+      case VAR_Unknown1:
+        v21 = &pOutdoor->ddm;
+        if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
+          v21 = &pIndoor->dlv;
+        return (v21->field_C_alert == pValue);        //yes, equality, not >=
+      case VAR_GoldInBank:
+        return pParty->uNumGoldInBank >= (unsigned int)pValue;
+      case VAR_NumDeaths:
+        return pParty->uNumDeaths >= (unsigned int)pValue;
+      case VAR_NumBounties:
+        return pParty->uNumBountiesCollected >= (unsigned int)pValue;
+      case VAR_PrisonTerms:
+        return pParty->uNumPrisonTerms >= pValue;
+      case VAR_ArenaWinsPage:
+        return (unsigned __int8)pParty->uNumArenaPageWins >= pValue;
+      case VAR_ArenaWinsSquire:
+        return (unsigned __int8)pParty->uNumArenaSquireWins >= pValue;
+      case VAR_ArenaWinsKnight:
+        return (unsigned __int8)pParty->uNumArenaKnightWins >= pValue;
+      case VAR_ArenaWinsLord:
+        return pParty->uNumArenaLordWins >= pValue;
+      case VAR_Invisible:
+        return ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0 );
       case VAR_ItemEquipped:
         for (int i = 0; i < 16; i++)
         {
@@ -5127,329 +5135,282 @@
           }
         }
         return false;
-      case VAR_GoldInBank:
-        v4 = pParty->uNumGoldInBank;
-        return v4 >= pValue;
-      case VAR_IsMightMoreThanBase:
-        v28 = GetActualMight();
-        v29 = GetBaseStrength();
-        return (v28 >= v29);
-      case VAR_IsIntellectMoreThanBase:
-        v28 = GetActualIntelligence();
-        v29 = GetBaseIntelligence();
-        return (v28 >= v29);
-      case VAR_IsPersonalityMoreThanBase:
-        v28 = GetActualWillpower();
-        v29 = GetBaseWillpower();
-        return (v28 >= v29);
-      case VAR_IsEnduranceMoreThanBase:
-        v28 = GetActualEndurance();
-        v29 = GetBaseEndurance();
-        return (v28 >= v29);
-      case VAR_IsSpeedMoreThanBase:
-        v28 = GetActualSpeed();
-        v29 = GetBaseSpeed();
-        return (v28 >= v29);
-      case VAR_IsAccuracyMoreThanBase:
-        v28 = GetActualAccuracy();
-        v29 = GetBaseAccuracy();
-        return (v28 >= v29);
-      case VAR_IsLuckMoreThanBase:
-        v28 = GetActualLuck();
-        v29 = GetBaseLuck();
-        return (v28 >= v29);
       default:
         return false;
     }
   }
-  if ( VarNum == VAR_AutoNotes )  //TODO: find out why the double subtraction. or whether this is even used
-  {
-    test_bit_value = 0x80u >> (pValue - 2) % 8;
-    byteWithRequestedBit = pParty->_autonote_bits[(pValue - 2) /8];
-    return (test_bit_value & byteWithRequestedBit);
-  }
-  if ( VarNum <= VAR_BaseLuck )
-  {
-    if ( VarNum != VAR_BaseLuck )
-    {
-      switch ( VarNum )
+  if ( VarNum <= VAR_MajorCondition )
+  {
+    switch ( VarNum )
+    {
+    case VAR_Sex:
+      return ( pValue == this->uSex );
+    case VAR_Class:
+      return ( pValue == this->classType );
+    case VAR_Race:
+      return pValue == GetRace();
+    case VAR_CurrentHP:
+      return this->sHealth >= pValue;
+    case VAR_MaxHP:
+      return (this->sHealth >= GetMaxHealth());
+    case VAR_CurrentSP:
+      return this->sMana >= pValue;
+    case VAR_MaxSP:
+      return (this->sMana >= GetMaxMana());
+    case VAR_ActualAC:
+      return GetActualAC() >= pValue;
+    case VAR_ACModifier:
+      return this->sACModifier >= pValue;
+    case VAR_BaseLevel:
+      return this->uLevel >= pValue;
+    case VAR_LevelModifier:
+      return this->sLevelModifier >= pValue;
+    case VAR_Age:
+      return GetActualAge() >= (unsigned int)pValue;
+    case VAR_Award:
+      test_bit_value = 0x80u >> (pValue - 1) % 8;
+      byteWithRequestedBit = this->_achieved_awards_bits[(pValue - 1) /8];
+      return ( test_bit_value & byteWithRequestedBit ) != 0;
+    case VAR_Experience:
+      return this->uExperience >= pValue;       //TODO change pValue to long long
+    case VAR_QBits_QuestsDone:
+      test_bit_value = 0x80u >> (pValue - 1) % 8;
+      byteWithRequestedBit = pParty->_quest_bits[(pValue - 1)/8];
+      return ( test_bit_value & byteWithRequestedBit ) != 0;
+    case VAR_PlayerItemInHands:
+      for (int i = 0; i < 138; i++)
       {
-        case VAR_Hour:
-          if ( (long long)(pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue )
-            return true;
-          return false;
-        case VAR_DayOfYear:
-          if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 336 + 1 == pValue)
-            return true;
-          return false;
-        case VAR_DayOfWeek:
-          if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 7)
-            return true;
-          return false;
-        case VAR_Sex:
-          if ( pValue == this->uSex )
-            return true;
-          return false;
-        case VAR_Class:
-          if ( pValue == this->classType )
-            return true;
-          return false;
-        case VAR_Race:  
-          if ( pValue == GetRace() )
-            return true;
-          return v4 >= pValue;
-        case VAR_CurrentHP:
-          v4 = this->sHealth;
-          return v4 >= pValue;
-        case VAR_MaxHP:
-          v8 = GetMaxHealth();
-          v9 = this->sHealth;
-          return (v9 >= v8);
-        case VAR_CurrentSP:
-          v4 = this->sMana;
-          return v4 >= pValue;
-        case VAR_MaxSP:
-          v8 = GetMaxMana();
-          v9 = this->sMana;
-          return (v9 >= v8);
-        case VAR_ActualAC:
-          v4 = GetActualAC();
-          return v4 >= pValue;
-        case VAR_ACModifier:
-          v4 = this->sACModifier;
-          return v4 >= pValue;
-        case VAR_BaseLevel:
-          v4 = this->uLevel;
-          return v4 >= pValue;
-        case VAR_LevelModifier:
-          v4 = this->sLevelModifier;
-          return v4 >= pValue;
-        case VAR_Age:
-          v4 = GetActualAge();
-          return v4 >= pValue;
-        case VAR_Award:
-          test_bit_value = 0x80u >> (pValue - 1) % 8;
-          byteWithRequestedBit = this->_achieved_awards_bits[(pValue - 1) /8];
-          return ( test_bit_value & byteWithRequestedBit );
-        case VAR_Experience:
-          v4 = LODWORD(this->uExperience);
-          return v4 >= pValue;
-        case VAR_QBits_QuestsDone:
-          test_bit_value = 0x80u >> (pValue - 1) % 8;
-          byteWithRequestedBit = pParty->_quest_bits[(pValue - 1)/8];
-          return ( test_bit_value & byteWithRequestedBit );
-        case VAR_PlayerItemInHands:
-          for (int i = 0; i < 138; i++)
-          {
-            if (pInventoryItemList[i].uItemID == pValue)
-            {
-              return true;
-            }
-          }
-          return pParty->pPickedItem.uItemID == pValue;
-        case VAR_FixedGold:
-          v4 = pParty->uNumGold;
-          return v4 >= pValue;
-        case VAR_MightBonus:
-          v4 = this->uMightBonus;
-          return v4 >= pValue;
-        case VAR_IntellectBonus:
-          v4 = this->uIntelligenceBonus;
-          return v4 >= pValue;
-        case VAR_PersonalityBonus:
-          v4 = this->uWillpowerBonus;
-          return v4 >= pValue;
-        case VAR_EnduranceBonus:
-          v4 = this->uEnduranceBonus;
-          return v4 >= pValue;
-        case VAR_SpeedBonus:
-          v4 = this->uSpeedBonus;
-          return v4 >= pValue;
-        case VAR_AccuracyBonus:
-          v4 = this->uAccuracyBonus;
-          return v4 >= pValue;
-        case VAR_LuckBonus:
-          v4 = this->uLuckBonus;
-          return v4 >= pValue;
-        case VAR_BaseMight:
-          v4 = this->uMight;
-          return v4 >= pValue;
-        case VAR_BaseIntellect:
-          v4 = this->uIntelligence;
-          return v4 >= pValue;
-        case VAR_BasePersonality:
-          v4 = this->uWillpower;
-          return v4 >= pValue;
-        case VAR_BaseEndurance:
-          v4 = this->uEndurance;
-          return v4 >= pValue;
-        case VAR_BaseSpeed:
-          v4 = this->uSpeed;
-          return v4 >= pValue;
-        case VAR_BaseAccuracy:
-          v4 = this->uAccuracy;
-          return v4 >= pValue;
-        case VAR_FixedFood:
-          v4 = pParty->uNumFoodRations;
-          return v4 >= pValue;
-        default:
-          return false;
-      }
-    }
-    v4 = this->uLuck;
-      return v4 >= pValue;
-  }
-  if ( VarNum <= VAR_MagicResistance )
-  {
-    if ( VarNum == VAR_MagicResistance )
-    {
-      v4 = this->sResMagicBase;
-    }
-    else
-    {
-      switch ( VarNum )
-      {
-        case VAR_FireResistance:
-          v4 = this->sResFireBase;
-          return v4 >= pValue;
-        case VAR_AirResistance:
-          v4 = this->sResAirBase;
-          return v4 >= pValue;
-        case VAR_WaterResistance:
-          v4 = this->sResWaterBase;
-          return v4 >= pValue;
-        case VAR_EarthResistance:
-          v4 = this->sResEarthBase;
-          return v4 >= pValue;
-        case VAR_SpiritResistance:
-          v4 = this->sResSpiritBase;
-          return v4 >= pValue;
-        case VAR_MindResistance:
-          v4 = this->sResMindBase;
-          return v4 >= pValue;
-        case VAR_BodyResistance:
-          v4 = this->sResBodyBase;
-          return v4 >= pValue;
-        case VAR_LightResistance:
-          v4 = this->sResLightBase;
-          return v4 >= pValue;
-        case VAR_DarkResistance:
-          v4 = this->sResDarkBase;
-          return v4 >= pValue;
-        case VAR_ActualMight:
-          v4 = GetActualMight();
-          return v4 >= pValue;
-        case VAR_ActualIntellect:
-          v4 = GetActualIntelligence();
-          return v4 >= pValue;
-        case VAR_ActualPersonality:
-          v4 = GetActualWillpower();
-          return v4 >= pValue;
-        case VAR_ActualEndurance:
-          v4 = GetActualEndurance();
-          return v4 >= pValue;
-        case VAR_ActualSpeed:
-          v4 = GetActualSpeed();
-          return v4 >= pValue;
-        case VAR_ActualAccuracy:
-          v4 = GetActualAccuracy();
-          return v4 >= pValue;
-        case VAR_ActualLuck:
-          v4 = GetActualLuck();
-          return v4 >= pValue;
-          break;
-        default:
-          return v4 >= pValue;
-      }
-    }
-    return v4 >= pValue;
-  }
-  if ( VarNum <= VAR_DisarmTrapSkill )
-  {
-    if ( VarNum != VAR_DisarmTrapSkill )
-    {
-      if ( VarNum <= VAR_MindResistanceBonus )
-      {
-        switch ( VarNum )
+        if (pInventoryItemList[i].uItemID == pValue)
         {
-          case VAR_MindResistanceBonus:
-            v4 = this->sResMindBonus;
-            return v4 >= pValue;
-          case VAR_FireResistanceBonus:
-            v4 = this->sResFireBonus;
-            return v4 >= pValue;
-          case VAR_AirResistanceBonus:
-            v4 = this->sResAirBonus;
-            return v4 >= pValue;
-          case VAR_WaterResistanceBonus:
-            v4 = this->sResWaterBonus;
-            return v4 >= pValue;
-          case VAR_EarthResistanceBonus:
-            v4 = this->sResEarthBonus;
-            return v4 >= pValue;
-          case VAR_SpiritResistanceBonus:
-            v4 = this->sResSpiritBonus;
-            return v4 >= pValue;
+          return true;
         }
       }
-      if ( VarNum == VAR_BodyResistanceBonus )
-      {
-        v4 = this->sResBodyBonus;
-        return v4 >= pValue;
-      }
-      if ( VarNum == VAR_LightResistanceBonus )
+      return pParty->pPickedItem.uItemID == pValue;
+    case VAR_Hour:
+      if ( (long long)(pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue )
+        return true;
+      return false;
+    case VAR_DayOfYear:
+      if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 336 + 1 == pValue)
+        return true;
+      return false;
+    case VAR_DayOfWeek:
+      if (((long long)(pParty->uTimePlayed * 0.234375) / 60 / 60) / 24 % 7)
+        return true;
+      return false;
+    case VAR_FixedGold:
+      return pParty->uNumGold >= (unsigned int)pValue;
+    case VAR_FixedFood:
+      return pParty->uNumFoodRations >= (unsigned int)pValue;
+    case VAR_MightBonus:
+      return this->uMightBonus >= pValue;
+    case VAR_IntellectBonus:
+      return this->uIntelligenceBonus >= pValue;
+    case VAR_PersonalityBonus:
+      return this->uWillpowerBonus >= pValue;
+    case VAR_EnduranceBonus:
+      return this->uEnduranceBonus >= pValue;
+    case VAR_SpeedBonus:
+      return this->uSpeedBonus >= pValue;
+    case VAR_AccuracyBonus:
+      return this->uAccuracyBonus >= pValue;
+    case VAR_LuckBonus:
+      return this->uLuckBonus >= pValue;
+    case VAR_BaseMight:
+      return this->uMight >= pValue;
+    case VAR_BaseIntellect:
+      return this->uIntelligence >= pValue;
+    case VAR_BasePersonality:
+      return this->uWillpower >= pValue;
+    case VAR_BaseEndurance:
+      return this->uEndurance >= pValue;
+    case VAR_BaseSpeed:
+      return this->uSpeed >= pValue;
+    case VAR_BaseAccuracy:
+      return this->uAccuracy >= pValue;
+    case VAR_BaseLuck:
+      return this->uLuck >= pValue;
+    case VAR_ActualMight:
+      return GetActualMight() >= pValue;
+    case VAR_ActualIntellect:
+      return GetActualIntelligence() >= pValue;
+    case VAR_ActualPersonality:
+      return GetActualWillpower() >= pValue;
+    case VAR_ActualEndurance:
+      return GetActualEndurance() >= pValue;
+    case VAR_ActualSpeed:
+      return GetActualSpeed() >= pValue;
+    case VAR_ActualAccuracy:
+      return GetActualAccuracy() >= pValue;
+    case VAR_ActualLuck:
+      return GetActualLuck() >= pValue;
+    case VAR_FireResistance:
+      return this->sResFireBase >= pValue;
+    case VAR_AirResistance:
+      return this->sResAirBase >= pValue;
+    case VAR_WaterResistance:
+      return this->sResWaterBase >= pValue;
+    case VAR_EarthResistance:
+      return this->sResEarthBase >= pValue;
+    case VAR_SpiritResistance:
+      return this->sResSpiritBase >= pValue;
+    case VAR_MindResistance:
+      return this->sResMindBase >= pValue;
+    case VAR_BodyResistance:
+      return this->sResBodyBase >= pValue;
+    case VAR_LightResistance:
+      return this->sResLightBase >= pValue;
+    case VAR_DarkResistance:
+      return this->sResDarkBase >= pValue;
+    case VAR_PhysicalResistance:
+      Error("Physical resistance isn't used in events");
+      return false;
+    case VAR_MagicResistance:
+      return this->sResMagicBase >= pValue;
+    case VAR_FireResistanceBonus:
+      return this->sResFireBonus >= pValue;
+    case VAR_AirResistanceBonus:
+      return this->sResAirBonus >= pValue;
+    case VAR_WaterResistanceBonus:
+      return this->sResWaterBonus >= pValue;
+    case VAR_EarthResistanceBonus:
+      return this->sResEarthBonus >= pValue;
+    case VAR_SpiritResistanceBonus:
+      return this->sResSpiritBonus >= pValue;
+    case VAR_MindResistanceBonus:
+      return this->sResMindBonus >= pValue;
+    case VAR_BodyResistanceBonus:
+      return this->sResBodyBonus >= pValue;
+    case VAR_LightResistanceBonus:
+      return this->sResLightBonus >= pValue;
+    case VAR_DarkResistanceBonus:
+      return this->sResDarkBonus >= pValue;
+    case VAR_MagicResistanceBonus:
+      return this->sResMagicBonus >= pValue;
+    case VAR_StaffSkill:
+      return CmpSkillValue(pValue, this->skillStaff);
+    case VAR_SwordSkill:
+      return CmpSkillValue(pValue, this->skillSword);
+    case VAR_DaggerSkill:
+      return CmpSkillValue(pValue, this->skillDagger);
+    case VAR_AxeSkill:
+      return CmpSkillValue(pValue, this->skillAxe);
+    case VAR_SpearSkill:
+      return CmpSkillValue(pValue, this->skillSpear);
+    case VAR_BowSkill:
+      return CmpSkillValue(pValue, this->skillBow);
+    case VAR_MaceSkill:
+      return CmpSkillValue(pValue, this->skillMace);
+    case VAR_BlasterSkill:
+      return CmpSkillValue(pValue, this->skillBlaster);
+    case VAR_ShieldSkill:
+      return CmpSkillValue(pValue, this->skillShield);
+    case VAR_LeatherSkill:
+      return CmpSkillValue(pValue, this->skillLeather);
+    case VAR_SkillChain:
+      return CmpSkillValue(pValue, this->skillChain);
+    case VAR_PlateSkill:
+      return CmpSkillValue(pValue, this->skillPlate);
+    case VAR_FireSkill:
+      return CmpSkillValue(pValue, this->skillFire);
+    case VAR_AirSkill:
+      return CmpSkillValue(pValue, this->skillAir);
+    case VAR_WaterSkill:
+      return CmpSkillValue(pValue, this->skillWater);
+    case VAR_EarthSkill:
+      return CmpSkillValue(pValue, this->skillEarth);
+    case VAR_SpiritSkill:
+      return CmpSkillValue(pValue, this->skillSpirit);
+    case VAR_MindSkill:
+      return CmpSkillValue(pValue, this->skillMind);
+    case VAR_BodySkill:
+      return CmpSkillValue(pValue, this->skillBody);
+    case VAR_LightSkill:
+      return CmpSkillValue(pValue, this->skillLight);
+    case VAR_DarkSkill:
+      return CmpSkillValue(pValue, this->skillDark);
+    case VAR_IdentifyItemSkill:
+      return CmpSkillValue(pValue, this->skillItemId);
+    case VAR_MerchantSkill:
+      return CmpSkillValue(pValue, this->skillMerchant);
+    case VAR_RepairSkill:
+      return CmpSkillValue(pValue, this->skillRepair);
+    case VAR_BodybuildingSkill:
+      return CmpSkillValue(pValue, this->skillBodybuilding);
+    case VAR_MeditationSkill:
+      return CmpSkillValue(pValue, this->skillMeditation);
+    case VAR_PerceptionSkill:
+      return CmpSkillValue(pValue, this->skillPerception);
+    case VAR_DiplomacySkill:
+      return CmpSkillValue(pValue, this->skillDiplomacy);
+    case VAR_ThieverySkill:
+      Error("Thievery isn't used in events");
+      return false;
+    case VAR_DisarmTrapSkill:         //wasn't in the original
+      return CmpSkillValue(pValue, this->skillDisarmTrap);
+    case VAR_DodgeSkill:         //wasn't in the original
+      return CmpSkillValue(pValue, this->skillDodge);
+    case VAR_UnarmedSkill:         //wasn't in the original
+      return CmpSkillValue(pValue, this->skillUnarmed);
+    case VAR_IdentifyMonsterSkill:         //wasn't in the original
+      return CmpSkillValue(pValue, this->skillMonsterId);
+    case VAR_ArmsmasterSkill:         //wasn't in the original
+      return CmpSkillValue(pValue, this->skillArmsmaster);
+    case VAR_StealingSkill:         //wasn't in the original
+      return CmpSkillValue(pValue, this->skillStealing);
+    case VAR_AlchemySkill:         //wasn't in the original
+      return CmpSkillValue(pValue, this->skillAlchemy);
+    case VAR_LearningSkill:
+      return CmpSkillValue(pValue, this->skillLearning);
+    case VAR_Cursed:
+      return pConditions[Condition_Cursed] > 0;
+    case VAR_Weak:
+      return pConditions[Condition_Weak] > 0;
+    case VAR_Asleep:
+      return pConditions[Condition_Sleep] > 0;
+    case VAR_Afraid:
+      return pConditions[Condition_Fear] > 0;
+    case VAR_Drunk:
+      return pConditions[Condition_Drunk] > 0;
+    case VAR_Insane:
+      return pConditions[Condition_Insane] > 0;
+    case VAR_PoisonedGreen:
+      return pConditions[Condition_Poison1] > 0;
+    case VAR_DiseasedGreen:
+      return pConditions[Condition_Disease1] > 0;
+    case VAR_PoisonedYellow:
+      return pConditions[Condition_Poison2] > 0;
+    case VAR_DiseasedYellow:
+      return pConditions[Condition_Disease2] > 0;
+    case VAR_PoisonedRed:
+      return pConditions[Condition_Poison3] > 0;
+    case VAR_DiseasedRed:
+      return pConditions[Condition_Disease3] > 0;
+    case VAR_Paralyzed:
+      return pConditions[Condition_Paralyzed] > 0;
+    case VAR_Unconsious:
+      return pConditions[Condition_Unconcious] > 0;
+    case VAR_Dead:
+      return pConditions[Condition_Dead] > 0;
+    case VAR_Stoned:
+      return pConditions[Condition_Pertified] > 0;
+    case VAR_Eradicated:
+      return pConditions[Condition_Eradicated] > 0;
+    case VAR_MajorCondition:
+      v4 = GetMajorConditionIdx();
+      if ( v4 != 18 )
       {
-        v4 = this->sResLightBonus;
-        return v4 >= pValue;
-      }
-      if ( VarNum == VAR_DarkResistanceBonus )
-      {
-        v4 = this->sResDarkBonus;
-        return v4 >= pValue;
-      }
-      if ( VarNum == VAR_MagicResistanceBonus )
-      {
-        v4 = this->sResMagicBonus;
         return v4 >= pValue;
       }
-      if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill )
-        return v4 >= pValue;
-    }
-    v18 = *((short *)&this->pConditions[16] + VarNum);
-    if ( pValue <= 63 )
-      v4 = v18 & 0x3F;
-    else
-      v4 = pValue & v18;
-    return v4 >= pValue;
-  }
-  if ( VarNum == 104 )
-  {
-    v18 = *((short *)&this->pConditions[16] + VarNum);
-    if ( pValue <= 63 )
-      v4 = v18 & 0x3F;
-    else
-      v4 = pValue & v18;
-    return v4 >= pValue;
-  }
-  if ( (signed int)VarNum <= 104 )
-    return v4 >= pValue;
-  if ( (signed int)VarNum > 0x79 )
-  {
-    if ( VarNum != 122 )
-    {
-      if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells )
-        v4 = (unsigned __int8)byte_5E4C15[VarNum];
-      return v4 >= pValue;
-    }
-    v4 = GetMajorConditionIdx();
-    if ( v4 != 18 )
-    {
-      return v4 >= pValue;
-    }
-    v4 = pValue;
-    return v4 >= pValue;
-  }
-  return (this->pConditions[VarNum - 105] > 0);// *((int *)this + 2 * VarNum - 210); the original was never used, which is why probably it wasn't correct
+      return true;
+    }
+  }
+  if ( (signed int)VarNum >= VAR_MapPersistentVariable_0 && VarNum <= VAR_MapPersistentVariable_74 )
+    return (unsigned __int8)stru_5E4C90_MapPersistVars.field_0[VarNum - VAR_MapPersistentVariable_0] > 0;  // originally (unsigned __int8)byte_5E4C15[VarNum];
+  if ( (signed int)VarNum >= VAR_MapPersistentVariable_75 && VarNum <= VAR_MapPersistentVariable_99 )
+    return (unsigned __int8)stru_5E4C90_MapPersistVars._decor_events[VarNum - VAR_MapPersistentVariable_75] > 0;      //not really sure whether the number gets up to 99, but can't ignore the possibility
+
+  return false;
 }
 
 
@@ -5893,7 +5854,7 @@
       {
         if ( var_type != VAR_MajorCondition )
         {
-          if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells )
+          if ( var_type > VAR_MajorCondition && var_type <= VAR_MapPersistentVariable_99 )
             byte_5E4C15[var_type] = var_value;
           return;
         }
@@ -6403,7 +6364,7 @@
       {
         if ( var_type != VAR_MajorCondition )
         {
-          if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells )
+          if ( var_type > VAR_MajorCondition && var_type <= VAR_MapPersistentVariable_99 )
           {
             if ( (unsigned __int8)val + (unsigned __int8)byte_5E4C15[var_type] <= 255 )
               byte_5E4C15[var_type] += val;
--- a/SaveLoad.cpp	Fri Sep 27 15:19:32 2013 +0600
+++ b/SaveLoad.cpp	Fri Sep 27 15:19:46 2013 +0600
@@ -430,7 +430,7 @@
       data_write_pos += 16000;
       memcpy(data_write_pos, pIndoor->ptr_0002B4_doors_ddata, pIndoor->blv.uDoors_ddata_Size);
       data_write_pos += pIndoor->blv.uDoors_ddata_Size;
-      memcpy(data_write_pos, &stru_5E4C90, 0xC8);
+      memcpy(data_write_pos, &stru_5E4C90_MapPersistVars, 0xC8);
       data_write_pos += 200;
       memcpy(data_write_pos, &pIndoor->stru1, 0x38);
       data_write_pos += 56;
@@ -475,7 +475,7 @@
       data_write_pos += 4;
       memcpy(data_write_pos, pChests.data(), sizeof(Chest)* uNumChests);
       data_write_pos += sizeof(Chest)* uNumChests;
-      memcpy(data_write_pos, &stru_5E4C90, 0xC8);
+      memcpy(data_write_pos, &stru_5E4C90_MapPersistVars, 0xC8);
       data_write_pos += 200;
       memcpy(data_write_pos, &pOutdoor->loc_time, 0x38);
       data_write_pos += 56;
--- a/UI/UiGame.cpp	Fri Sep 27 15:19:32 2013 +0600
+++ b/UI/UiGame.cpp	Fri Sep 27 15:19:46 2013 +0600
@@ -1230,7 +1230,7 @@
       if ( !pLevelDecorations[v19].uEventID )
       {
         if ( pLevelDecorations[v19].IsInteractive() )
-          pText = pNPCTopics[stru_5E4C90._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 379].pTopic;//  
+          pText = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[v19]._idx_in_stru123 - 75] + 379].pTopic;//  
         else
           pText = pDecorationList->pDecorations[pLevelDecorations[v19].uDecorationDescID].field_20;
         GameUI_SetFooterString(pText);
--- a/Viewport.cpp	Fri Sep 27 15:19:32 2013 +0600
+++ b/Viewport.cpp	Fri Sep 27 15:19:46 2013 +0600
@@ -542,7 +542,7 @@
     {
       if ( pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].IsInteractive() )
       {
-        v15 = stru_5E4C90._decor_events[pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]._idx_in_stru123 - 75] + 380;
+        v15 = stru_5E4C90_MapPersistVars._decor_events[pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]._idx_in_stru123 - 75] + 380;
         activeLevelDecoration = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3];
         EventProcessor(v15, 0, 1);
         activeLevelDecoration = NULL;
--- a/mm7_2.cpp	Fri Sep 27 15:19:32 2013 +0600
+++ b/mm7_2.cpp	Fri Sep 27 15:19:46 2013 +0600
@@ -1740,7 +1740,7 @@
 //----- (00450AAA) --------------------------------------------------------
 void RespawnGlobalDecorations()
 {
-  memset(stru_5E4C90._decor_events, 0, 125);
+  memset(stru_5E4C90_MapPersistVars._decor_events, 0, 125);
 
   uint decorEventIdx = 0;
   for (uint i = 0; i < uNumLevelDecorations; ++i)
@@ -1754,7 +1754,7 @@
         if (decorEventIdx < 124)
         {
           decor->_idx_in_stru123 = decorEventIdx + 75;
-          stru_5E4C90._decor_events[decorEventIdx++] = decor->GetGlobalEvent();
+          stru_5E4C90_MapPersistVars._decor_events[decorEventIdx++] = decor->GetGlobalEvent();
         }
       }
     }
@@ -5965,7 +5965,7 @@
 	return v19;
   }
   if ( v25->IsInteractive() )
-    v24 = pNPCTopics[stru_5E4C90._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic;
+    v24 = pNPCTopics[stru_5E4C90_MapPersistVars._decor_events[v26->_idx_in_stru123 - 75] + 379].pTopic;
   else
     v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20;
   GameUI_SetFooterString(v24);
--- a/mm7_3.cpp	Fri Sep 27 15:19:32 2013 +0600
+++ b/mm7_3.cpp	Fri Sep 27 15:19:46 2013 +0600
@@ -2181,7 +2181,7 @@
   {
     //LOBYTE(pParty->uFlags) &= 0x7Fu;
     bWaterWalk = 1;
-    *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u;
+    *(short *)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u;
     if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) &&
 		pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 )
       bWaterWalk = 0;
@@ -2571,7 +2571,7 @@
       if ( pModel )
         pZ = v113;
       if (pParty->FlyActive())
-        stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu;
+        stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu;
       pParty->uFallStartY = pZ;
     }
     else
@@ -2583,14 +2583,14 @@
       pParty->uFallStartY = v111;
       v113 = pZ;
       if (pParty->FlyActive())
-        stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;
+        stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;
     }
   }
   else
   {
 	  v113 = pZ;
 	  if (pParty->FlyActive())
-		stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;
+		stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;
   }
 //LABEL_141:
   if (bJumping && !pParty->bFlying)
@@ -3078,7 +3078,7 @@
       pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
       //v79 = 20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 6180178;
       //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u;
-      v79 = (int)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119];
+      v79 = (int)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119];
       *(short *)v79 |= 1u;
       if ( !v122 || !v69 )
       {
--- a/mm7_data.cpp	Fri Sep 27 15:19:32 2013 +0600
+++ b/mm7_data.cpp	Fri Sep 27 15:19:46 2013 +0600
@@ -40,7 +40,7 @@
 
 
 #include "stru123.h"
-stru123 stru_5E4C90;
+stru123 stru_5E4C90_MapPersistVars;
 
 #include "stru298.h"
 stru298 stru_50FE08; // weak
--- a/stru123.h	Fri Sep 27 15:19:32 2013 +0600
+++ b/stru123.h	Fri Sep 27 15:19:46 2013 +0600
@@ -9,4 +9,4 @@
   unsigned char _decor_events[125];
 };
 #pragma pack(pop)
-extern stru123 stru_5E4C90;
\ No newline at end of file
+extern stru123 stru_5E4C90_MapPersistVars;
\ No newline at end of file