# HG changeset patch
# User Ritor1
# Date 1403545557 -21600
# Node ID 5f395dd759fbfeb37dbe7ecde54a003a7c34445a
# Parent 41c36ecc9f32469e7293aa24bef3e39060c2692b# Parent b842e1b77c8cd8eaba8e65b9f9f3574463f8068e
Слияние
diff -r b842e1b77c8c -r 5f395dd759fb Build/Visual Studio 2012/World of Might and Magic.vcxproj
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj Sun Jun 22 15:14:10 2014 +0100
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj Mon Jun 23 23:45:57 2014 +0600
@@ -468,7 +468,7 @@
-
+
diff -r b842e1b77c8c -r 5f395dd759fb Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Sun Jun 22 15:14:10 2014 +0100
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj.filters Mon Jun 23 23:45:57 2014 +0600
@@ -460,7 +460,6 @@
-
@@ -968,6 +967,7 @@
UI
+
diff -r b842e1b77c8c -r 5f395dd759fb Events.cpp
--- a/Events.cpp Sun Jun 22 15:14:10 2014 +0100
+++ b/Events.cpp Mon Jun 23 23:45:57 2014 +0600
@@ -16,7 +16,7 @@
#include "GUIProgressBar.h"
#include "SpriteObject.h"
#include "Chest.h"
-#include "stru176.h"
+#include "MapsLongTimer.h"
#include "LOD.h"
#include "Actor.h"
#include "Party.h"
@@ -143,11 +143,11 @@
if (!uLevelEVT_Size)
return;
- memset(array_5B5928_timers, 0, 3200);
+ memset(MapsLongTimersList, 0, 3200);
memset(pLevelEVT_Index.data(), 80, sizeof(EventIndex)*4400);
uLevelEVT_NumEvents = 0;
- dword_5B65C8_timers_count = 0;
+ MapsLongTimers_count = 0;
current_hdr=(raw_event_header *)pLevelEVT.data();
offset_in=0;
diff -r b842e1b77c8c -r 5f395dd759fb MapsLongTimer.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/MapsLongTimer.h Mon Jun 23 23:45:57 2014 +0600
@@ -0,0 +1,24 @@
+#pragma once
+
+
+/* 169 */
+#pragma pack(push, 1)
+struct MapsLongTimer
+{
+ __int64 NextStartTime; // timer will either fire event at this time (type 2, field_C == 0)
+ __int16 timer_evt_ID;
+ __int16 timer_evt_seq_num;
+ __int16 time_left_to_fire;
+ __int16 IntervalHalfMins; // or fire on these intervals (type 1)
+ __int16 YearsInterval;
+ __int16 MonthsInterval;
+ __int16 WeeksInterval;
+ __int16 HoursInterval;
+ __int16 MinutesInterval;
+ __int16 SecondsInterval;
+ __int16 timer_evt_type;
+ __int16 field_1E;
+};
+#pragma pack(pop)
+extern MapsLongTimer MapsLongTimersList[100];
+
diff -r b842e1b77c8c -r 5f395dd759fb SaveLoad.cpp
--- a/SaveLoad.cpp Sun Jun 22 15:14:10 2014 +0100
+++ b/SaveLoad.cpp Mon Jun 23 23:45:57 2014 +0600
@@ -40,12 +40,10 @@
{
bool v25; // esi@62
bool v26; // eax@62
-// int v30; // [sp-Ch] [bp-FCh]@65
-// int v31; // [sp-8h] [bp-F8h]@4
SavegameHeader header; // [sp+Ch] [bp-E4h]@23
char Str[123]; // [sp+70h] [bp-80h]@25
- dword_5B65C8_timers_count = 0;
+ MapsLongTimers_count = 0;
if (!pSavegameUsedSlots[uSlot])
{
pAudioPlayer->PlaySound(SOUND_error, 0, 0, -1, 0, 0, 0, 0);
diff -r b842e1b77c8c -r 5f395dd759fb mm7_2.cpp
--- a/mm7_2.cpp Sun Jun 22 15:14:10 2014 +0100
+++ b/mm7_2.cpp Mon Jun 23 23:45:57 2014 +0600
@@ -42,7 +42,7 @@
#include "DecorationList.h"
#include "SaveLoad.h"
#include "stru123.h"
-#include "stru176.h"
+#include "MapsLongTimer.h"
#include "Timer.h"
#include "IconFrameTable.h"
#include "GUIProgressBar.h"
@@ -224,9 +224,9 @@
sprintf(pTmpBuf2.data(), " %lu %s, %lu %s, %lu %s ", v14, v9, v18, v8, v17, v7);
strcat(pTmpBuf.data(), pTmpBuf2.data());
- pWindow.DrawTitleText(pFont, 1u, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1u, pTmpBuf.data(), 3u);
+ pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight - 2 * LOBYTE(pFont->uFontHeight) - 5, 1, pTmpBuf.data(), 3);
sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[94], v23);
- pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1u, pTmpBuf.data(), 3);
+ pWindow.DrawTitleText(pFont, 1, pWindow.uFrameHeight, 1, pTmpBuf.data(), 3);
dword_6BE364_game_settings_1 |= GAME_SETTINGS_4000;
pRenderer->EndScene();
pRenderer->Present();
@@ -1939,7 +1939,7 @@
static_assert(sizeof(TrailParticle) == 0x18, "Wrong type size");
static_assert(sizeof(EventIndex) == 0xC, "Wrong type size");
static_assert(sizeof(_2devent) == 0x34, "Wrong type size");
- static_assert(sizeof(stru176) == 0x20, "Wrong type size");
+ static_assert(sizeof(MapsLongTimer) == 0x20, "Wrong type size");
static_assert(sizeof(SavegameHeader) == 0x64, "Wrong type size");
static_assert(sizeof(SavegameList) == 0x3138, "Wrong type size");
static_assert(sizeof(StorylineText) == 0x160, "Wrong type size");
diff -r b842e1b77c8c -r 5f395dd759fb mm7_3.cpp
--- a/mm7_3.cpp Sun Jun 22 15:14:10 2014 +0100
+++ b/mm7_3.cpp Mon Jun 23 23:45:57 2014 +0600
@@ -26,7 +26,7 @@
#include "Timer.h"
#include "TurnEngine.h"
#include "Events2D.h"
-#include "stru176.h"
+#include "MapsLongTimer.h"
#include "stru298.h"
#include "texts.h"
#include "Level/Decoration.h"
@@ -3444,16 +3444,8 @@
//----- (00443FDC) --------------------------------------------------------
void OnMapLoad()
{
-// __int16 v4; // cx@9
int v6; // eax@9
unsigned __int64 v8; // qax@26
-// unsigned int v9; // ecx@26
- unsigned __int64 v10; // qax@26
- unsigned __int64 v11; // qax@26
- unsigned __int64 v13; // qax@26
- unsigned __int64 v14; // qax@26
-// int v15; // ST58_4@26
- unsigned __int64 v16; // qax@26
int hours; // ebx@26
unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
unsigned int seconds; // [sp+14h] [bp-3Ch]@26
@@ -3464,10 +3456,6 @@
int v26; // [sp+3Ch] [bp-14h]@15
unsigned int days; // [sp+3Ch] [bp-14h]@26
unsigned int months; // [sp+40h] [bp-10h]@26
-// __int16 v29; // [sp+46h] [bp-Ah]@9
-// __int16 v30; // [sp+48h] [bp-8h]@9
-// __int16 v32; // [sp+4Ch] [bp-4h]@9
-// __int16 v33; // [sp+4Eh] [bp-2h]@9
for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
{
@@ -3481,28 +3469,28 @@
EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num);
else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize)
{
- //v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
+ //v3 = &MapsLongTimersList[MapsLongTimers_count];
v20 = pOutdoor->loc_time.uLastVisitDay;
if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
v20 = pIndoor->stru1.uLastVisitDay;
- array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_type = _evt->_e_type;
- array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_ID = pEvent.uEventID;
- array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_seq_num = pEvent.event_sequence_num;
-
- array_5B5928_timers[dword_5B65C8_timers_count].field_10 = _evt->v5;
- array_5B5928_timers[dword_5B65C8_timers_count].field_12 = _evt->v6;
- array_5B5928_timers[dword_5B65C8_timers_count].field_14 = _evt->v7;
- array_5B5928_timers[dword_5B65C8_timers_count].field_16 = _evt->v8;
- array_5B5928_timers[dword_5B65C8_timers_count].field_18 = _evt->v9;
- array_5B5928_timers[dword_5B65C8_timers_count].field_1A = _evt->v10;
+ MapsLongTimersList[MapsLongTimers_count].timer_evt_type = _evt->_e_type;
+ MapsLongTimersList[MapsLongTimers_count].timer_evt_ID = pEvent.uEventID;
+ MapsLongTimersList[MapsLongTimers_count].timer_evt_seq_num = pEvent.event_sequence_num;
+
+ MapsLongTimersList[MapsLongTimers_count].YearsInterval = _evt->v5;
+ MapsLongTimersList[MapsLongTimers_count].MonthsInterval = _evt->v6;
+ MapsLongTimersList[MapsLongTimers_count].WeeksInterval = _evt->v7;
+ MapsLongTimersList[MapsLongTimers_count].HoursInterval = _evt->v8;
+ MapsLongTimersList[MapsLongTimers_count].MinutesInterval = _evt->v9;
+ MapsLongTimersList[MapsLongTimers_count].SecondsInterval = _evt->v10;
v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
- array_5B5928_timers[dword_5B65C8_timers_count].time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11;
- array_5B5928_timers[dword_5B65C8_timers_count].fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11;
- if (array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_type == EVENT_Initialize && !(short)v6 )
+ MapsLongTimersList[MapsLongTimers_count].time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11;
+ MapsLongTimersList[MapsLongTimers_count].IntervalHalfMins = ((unsigned short)_evt->v12 << 8) + _evt->v11;
+ if (MapsLongTimersList[MapsLongTimers_count].timer_evt_type == EVENT_Initialize && !(short)v6 )
{
if ( v20 )
v18 = pParty->uTimePlayed - v20;
@@ -3510,13 +3498,13 @@
v18 = 0;
v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
- if ( v26 / 7 / 4 / 12 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_10 ||
- v26 / 7 / 4 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_12 != 0 ||
- v26 / 7 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_14 != 0 ||
+ if ( v26 / 7 / 4 / 12 != 0 && MapsLongTimersList[MapsLongTimers_count].YearsInterval ||
+ v26 / 7 / 4 != 0 && MapsLongTimersList[MapsLongTimers_count].MonthsInterval != 0 ||
+ v26 / 7 != 0 && MapsLongTimersList[MapsLongTimers_count].WeeksInterval != 0 ||
v26 != 0 || !v20)
{
- ++dword_5B65C8_timers_count;
- array_5B5928_timers[dword_5B65C8_timers_count].next_fire_time = 0;
+ ++MapsLongTimers_count;
+ MapsLongTimersList[MapsLongTimers_count].NextStartTime = 0;
continue;
}
}
@@ -3524,32 +3512,27 @@
{
v8 = (__int64)((double)pParty->uTimePlayed * 0.234375);
seconds = v8 % 60;
- v10 = v8 / 60;
- minutes = v10 % 60;
- v11 = v10 / 60;
- hours = v11 % 24;
- v13 = v11 / 24;
- days = v13 % 7;
- v14 = v13 / 7;
- weeks = v14 % 4;
- v16 = v14 / 4;
- months = v16 % 12;
- years = v16 / 12;
-
- if ( array_5B5928_timers[dword_5B65C8_timers_count].field_10 )
+ minutes = (v8 / 60) % 60;
+ hours = ((v8 / 60) / 60) % 24;
+ days = (((v8 / 60) / 60) / 24) % 7;
+ weeks = ((((v8 / 60) / 60) / 24) / 7) % 4;
+ months = (((((v8 / 60) / 60) / 24) / 7) / 4) % 12;
+ years = (((((v8 / 60) / 60) / 24) / 7) / 4) / 12;
+
+ if ( MapsLongTimersList[MapsLongTimers_count].YearsInterval )
++years;
- else if ( array_5B5928_timers[dword_5B65C8_timers_count].field_12 )
+ else if ( MapsLongTimersList[MapsLongTimers_count].MonthsInterval )
++months;
- else if ( array_5B5928_timers[dword_5B65C8_timers_count].field_14 )
+ else if ( MapsLongTimersList[MapsLongTimers_count].WeeksInterval )
++weeks;
else
{
++days;
- minutes = array_5B5928_timers[dword_5B65C8_timers_count].field_18;
- hours = array_5B5928_timers[dword_5B65C8_timers_count].field_16;
- seconds = array_5B5928_timers[dword_5B65C8_timers_count].field_1A;
+ hours = MapsLongTimersList[MapsLongTimers_count].HoursInterval;
+ minutes = MapsLongTimersList[MapsLongTimers_count].MinutesInterval;
+ seconds = MapsLongTimersList[MapsLongTimers_count].SecondsInterval;
}
- array_5B5928_timers[dword_5B65C8_timers_count].next_fire_time = (signed __int64)((double)((seconds
+ MapsLongTimersList[MapsLongTimers_count].NextStartTime = (signed __int64)((double)((seconds
+ 60 * minutes
+ 3600 * hours
+ 86400 * days
@@ -3558,7 +3541,7 @@
+ 29030400 * years) << 7)
* 0.033333335);
- ++dword_5B65C8_timers_count;
+ ++MapsLongTimers_count;
}
}
}
@@ -3797,10 +3780,10 @@
_5773B8_event_timer = pParty->uTimePlayed;
- for (uint i = 0; i < dword_5B65C8_timers_count; ++i)
+ for (uint i = 0; i < MapsLongTimers_count; ++i)
{
//v4 = (char *)&array_5B5928_timers[0].field_C;
- stru176* timer = &array_5B5928_timers[i];
+ MapsLongTimer* timer = &MapsLongTimersList[i];
//while ( 1 )
//{
//v5 = *(short *)v4;
@@ -3810,25 +3793,25 @@
timer->time_left_to_fire -= v13;
else
{
- timer->time_left_to_fire = timer->fire_interval;
+ timer->time_left_to_fire = timer->IntervalHalfMins;
EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
}
}
else
{
- if (timer->next_fire_time < pParty->uTimePlayed)
+ if (timer->NextStartTime < pParty->uTimePlayed)
{
uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day
- if (timer->field_10)
+ if (timer->YearsInterval)
next_trigger_time = 336 * 60 * 60 * 24; // 1 year
- else if (timer->field_12)
+ else if (timer->MonthsInterval)
next_trigger_time = 28 * 60 * 60 * 24; // 1 month
- else if (timer->field_14)
+ else if (timer->WeeksInterval)
next_trigger_time = 7 * 60 * 60 * 24; // 1 week
- timer->next_fire_time += (next_trigger_time * 128) / 3.0f;
- if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed
- timer->next_fire_time = pParty->uTimePlayed;
+ timer->NextStartTime += (next_trigger_time * 128) / 3.0f;
+ if (timer->NextStartTime < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed
+ timer->NextStartTime = pParty->uTimePlayed;
EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num);
}
diff -r b842e1b77c8c -r 5f395dd759fb mm7_data.cpp
--- a/mm7_data.cpp Sun Jun 22 15:14:10 2014 +0100
+++ b/mm7_data.cpp Mon Jun 23 23:45:57 2014 +0600
@@ -222,8 +222,8 @@
0x00000031, 0x00000031, 0x0000002D, 0x00000041
}};
-#include "stru176.h"
-stru176 array_5B5928_timers[100];
+#include "MapsLongTimer.h"
+MapsLongTimer MapsLongTimersList[100];
#include "ObjectList.h"
struct ObjectList *pObjectList;
@@ -873,7 +873,7 @@
int dword_5B65BC; // weak
int dword_5B65C0; // weak
int dword_5B65C4_cancelEventProcessing; // weak
-int dword_5B65C8_timers_count; // weak
+int MapsLongTimers_count; // dword_5B65C8 , -
int npcIdToDismissAfterDialogue; // weak
signed int dword_5B65D0_dialogue_actor_npc_id; // weak
int dword_5C3418; // weak
diff -r b842e1b77c8c -r 5f395dd759fb mm7_data.h
--- a/mm7_data.h Sun Jun 22 15:14:10 2014 +0100
+++ b/mm7_data.h Mon Jun 23 23:45:57 2014 +0600
@@ -537,7 +537,7 @@
extern int dword_5B65BC; // weak
extern int dword_5B65C0; // weak
extern int dword_5B65C4_cancelEventProcessing; // weak
-extern int dword_5B65C8_timers_count; // weak
+extern int MapsLongTimers_count; // dword_5B65C8
extern int npcIdToDismissAfterDialogue; // weak
extern int dword_5B65D0_dialogue_actor_npc_id; // weak
extern int dword_5C3418; // weak
diff -r b842e1b77c8c -r 5f395dd759fb stru176.h
--- a/stru176.h Sun Jun 22 15:14:10 2014 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#pragma once
-
-
-/* 169 */
-#pragma pack(push, 1)
-struct stru176
-{
- __int64 next_fire_time; // timer will either fire event at this time (type 2, field_C == 0)
- __int16 timer_evt_ID;
- __int16 timer_evt_seq_num;
- __int16 time_left_to_fire;
- __int16 fire_interval; // or fire on these intervals (type 1)
- __int16 field_10;
- __int16 field_12;
- __int16 field_14;
- __int16 field_16;
- __int16 field_18;
- __int16 field_1A;
- __int16 timer_evt_type;
- __int16 field_1E;
-};
-#pragma pack(pop)
-extern stru176 array_5B5928_timers[100];
-