diff mm7_3.cpp @ 363:2bc1c8d68f41

Allocator and SpellCost Tip
author Gloval
date Fri, 22 Feb 2013 00:48:54 +0400
parents 5f36449527c6
children edd2d8b7e3c4
line wrap: on
line diff
--- a/mm7_3.cpp	Thu Feb 21 17:24:15 2013 +0600
+++ b/mm7_3.cpp	Fri Feb 22 00:48:54 2013 +0400
@@ -14211,168 +14211,168 @@
 
 //----- (00443FDC) --------------------------------------------------------
 void OnMapLoad()
-{
-  stru176 *v3; // esi@7
-  __int16 v4; // cx@9
-  __int16 v5; // di@9
-  int v6; // eax@9
-  signed __int64 v8; // qax@26
-  unsigned int v9; // ecx@26
-  signed __int64 v10; // qax@26
-  signed __int64 v11; // qax@26
-  int v12; // ST50_4@26
-  signed __int64 v13; // qax@26
-  signed __int64 v14; // qax@26
-  int v15; // ST58_4@26
-  signed __int64 v16; // qax@26
-  int hours; // ebx@26
-  unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
-  signed __int64 seconds; // [sp+14h] [bp-3Ch]@26
-  unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7
-  int minutes; // [sp+2Ch] [bp-24h]@26
-  int month; // [sp+34h] [bp-1Ch]@26
-  int weeks; // [sp+38h] [bp-18h]@26
-  int v26; // [sp+3Ch] [bp-14h]@15
-  int days; // [sp+3Ch] [bp-14h]@26
-  int v28; // [sp+40h] [bp-10h]@26
-  __int16 v29; // [sp+46h] [bp-Ah]@9
-  __int16 v30; // [sp+48h] [bp-8h]@9
-  __int16 v31; // [sp+4Ah] [bp-6h]@9
-  __int16 v32; // [sp+4Ch] [bp-4h]@9
-  __int16 v33; // [sp+4Eh] [bp-2h]@9
-
-  for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
-  {
-    auto pEvent = pLevelEVT_Index[i];
-
-    auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT);
-
-    if (_evt->_e_type == EVENT_PlaySound)
-    {
-      pSoundList->LoadSound(
-          _evt->v5 +
-          ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8),
-          0);
-    }
-    else if (_evt->_e_type == EVENT_OnMapReload)
-    {
-      start_event_seq_number = pEvent.event_sequence_num;
-      EventProcessor(pEvent.uEventID, 0, 0);
-      start_event_seq_number = 0;
-    }
-    else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer)
-    {
-      v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
-      v20 = pOutdoor->uLastVisitDay;
-      if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
-        v20 = pIndoor->stru1.uLastVisitDay;
-
-      v3->timer_evt_type = _evt->_e_type;
-      v3->timer_evt_ID = pEvent.uEventID;
-      v3->timer_evt_seq_num = pEvent.event_sequence_num;
-
-	  v3->field_10 = _evt->v5;
-      v3->field_12 = _evt->v6;
-      v3->field_14 = _evt->v7;
-      v3->field_16 = _evt->v8;
-	  v3->field_18 = _evt->v9;
-	  v3->field_1A = _evt->v10;
-      
-
-      v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
-     
-      v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11;
-      v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11;
-      if (v3->timer_evt_type  == EVENT_OnLongTimer && !(short)v6 )
-      {
-        if ( v20 )
-          v18 = pParty->uTimePlayed - v20;
-        else
-          v18 = 0i64;
-        v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
-
-        if ( v26 / 7 / 4 / 12 )
-        {
-          if ( v5 )
-          {
-            ++dword_5B65C8_timers_count;
-            v3->field_0_time = 0;
-            continue;
-          }
-        }
-        if (v26 / 7 / 4 != 0 && v33 != 0 ||
-            v26 / 7 != 0 && v32 != 0 ||
-            v26 != 0 || !v20)
-        {
-          ++dword_5B65C8_timers_count;
-          v3->field_0_time = 0;
-          continue;
-        }
-      }
-	  else
-		  {
-      v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
-      v9 = v8;
-      v10 = (signed int)v8 / 60;
-      minutes = v10 % 60;
-      v11 = (signed int)(v10 / 60);
-      v12 = v11 % 24;
-      v13 = (signed int)(v11 / 24);
-      days = v13 % 7;
-      v14 = (signed int)(v13 / 7);
-      v15 = v14 % 4;
-      v16 = (signed int)(v14 / 4);
-      month = v16 / 12;
-
-      auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32;
-      auto _2 = ((__int64)v9 << 32) | _1;
-
-      seconds = _2 % 60;
-      //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32,
-      //                        v9)
-      //    % 60;
-
-      hours = v12;
-      weeks = v15;
-      v28 = v16 % 12;
-      if ( v5 )
-      {
-        ++month;
-      }
-      else
-      {
-        if ( v33 )
-        {
-          ++v28;
-        }
-        else
-        {
-          if ( v32 )
-          {
-            ++weeks;
-          }
-          else
-          {
-            ++days;
-            minutes = v30;
-            hours = v31;
-            seconds = v29;
-          }
-        }
-      }
-      v3->field_0_time = (signed __int64)((double)((seconds
-                                + 60 * minutes
-                                + 3600 * hours
-                                + 0x93A80 * weeks
-                                + 0x15180 * days
-                                + 0x24EA00 * (v28 + 12i64 * month)) << 7)
-                      * 0.033333335);
-
-      ++dword_5B65C8_timers_count;
-		  }
-    }
-  }
-}
+	{
+	stru176 *v3; // esi@7
+	__int16 v4; // cx@9
+	__int16 v5; // di@9
+	int v6; // eax@9
+	signed __int64 v8; // qax@26
+	unsigned int v9; // ecx@26
+	signed __int64 v10; // qax@26
+	signed __int64 v11; // qax@26
+	int v12; // ST50_4@26
+	signed __int64 v13; // qax@26
+	signed __int64 v14; // qax@26
+	int v15; // ST58_4@26
+	signed __int64 v16; // qax@26
+	int hours; // ebx@26
+	unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
+	signed __int64 seconds; // [sp+14h] [bp-3Ch]@26
+	unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7
+	int minutes; // [sp+2Ch] [bp-24h]@26
+	int years; // [sp+34h] [bp-1Ch]@26
+	int weeks; // [sp+38h] [bp-18h]@26
+	int v26; // [sp+3Ch] [bp-14h]@15
+	int days; // [sp+3Ch] [bp-14h]@26
+	int months; // [sp+40h] [bp-10h]@26
+	__int16 v29; // [sp+46h] [bp-Ah]@9
+	__int16 v30; // [sp+48h] [bp-8h]@9
+	__int16 v31; // [sp+4Ah] [bp-6h]@9
+	__int16 v32; // [sp+4Ch] [bp-4h]@9
+	__int16 v33; // [sp+4Eh] [bp-2h]@9
+
+	for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
+		{
+		auto pEvent = pLevelEVT_Index[i];
+
+		auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT);
+
+		if (_evt->_e_type == EVENT_PlaySound)
+			{
+			pSoundList->LoadSound(
+				_evt->v5 +
+				((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8),
+				0);
+			}
+		else if (_evt->_e_type == EVENT_OnMapReload)
+			{
+			start_event_seq_number = pEvent.event_sequence_num;
+			EventProcessor(pEvent.uEventID, 0, 0);
+			start_event_seq_number = 0;
+			}
+		else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer)
+			{
+			v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
+			v20 = pOutdoor->uLastVisitDay;
+			if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
+				v20 = pIndoor->stru1.uLastVisitDay;
+
+			v3->timer_evt_type = _evt->_e_type;
+			v3->timer_evt_ID = pEvent.uEventID;
+			v3->timer_evt_seq_num = pEvent.event_sequence_num;
+
+			v3->field_10 = _evt->v5;
+			v3->field_12 = _evt->v6;
+			v3->field_14 = _evt->v7;
+			v3->field_16 = _evt->v8;
+			v3->field_18 = _evt->v9;
+			v3->field_1A = _evt->v10;
+
+
+			v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
+
+			v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11;
+			v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11;
+			if (v3->timer_evt_type  == EVENT_OnLongTimer && !(short)v6 )
+				{
+				if ( v20 )
+					v18 = pParty->uTimePlayed - v20;
+				else
+					v18 = 0i64;
+				v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
+
+				if ( v26 / 7 / 4 / 12 )
+					{
+					if ( v3->field_10 )
+						{
+						++dword_5B65C8_timers_count;
+						v3->field_0_time = 0;
+						continue;
+						}
+					}
+				if (v26 / 7 / 4 != 0 && v3->field_12 != 0 ||
+					v26 / 7 != 0 && v3->field_14 != 0 ||
+					v26 != 0 || !v20)
+					{
+					++dword_5B65C8_timers_count;
+					v3->field_0_time = 0;
+					continue;
+					}
+				}
+			else
+				{
+				v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
+				v9 = v8;
+				v10 = (signed int)v8 / 60;
+				minutes = v10 % 60;
+				v11 = (signed int)(v10 / 60);
+				v12 = v11 % 24;
+				v13 = (signed int)(v11 / 24);
+				days = v13 % 7;
+				v14 = (signed int)(v13 / 7);
+				v15 = v14 % 4;
+				v16 = (signed int)(v14 / 4);
+				years = v16 / 12;
+
+				auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32;
+				auto _2 = ((__int64)v9 << 32) | _1;
+
+				seconds = _2 % 60;
+				//v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32,
+				//                        v9)
+				//    % 60;
+
+				hours = v12;
+				weeks = v15;
+				months = v16 % 12;
+				if ( v3->field_10 )
+					{
+					++years;
+					}
+				else
+					{
+					if ( v3->field_12 )
+						{
+						++months;
+						}
+					else
+						{
+						if ( v3->field_14 )
+							{
+							++weeks;
+							}
+						else
+							{
+							++days;
+							minutes = v3->field_18;
+							hours = v3->field_16;
+							seconds = v3->field_1A;
+							}
+						}
+					}
+				v3->field_0_time = (signed __int64)((double)((seconds
+					+ 60 * minutes
+					+ 3600 * hours
+					+ 0x93A80 * weeks
+					+ 0x15180 * days
+					+ 0x24EA00 * (months + 12i64 * years)) << 7)
+					* 0.033333335);
+
+				++dword_5B65C8_timers_count;
+				}
+			}
+		}
+	}
 
 //----- (00444360) --------------------------------------------------------
 void __thiscall Level_LoadEvtAndStr(const char *pLevelName)
@@ -15116,7 +15116,7 @@
       strcpy(v14->pButtonName, GetProfessionActionText(pNPC->uProfession));
 	else if (v16 == 19)
 	{
-      __debugbreak(); // learn conditions of this event
+     // __debugbreak(); // learn conditions of this event Scavenger Hunt
       auto topic = pNPCTopics[pNPC->evt_A - 1].pTopic;//(&dword_721660)[8 * v23];
       if (!topic)
       {