# HG changeset patch
# User Ritor1
# Date 1385637170 -21600
# Node ID 28cb79ae2f6fba32ec016219265253acf8f4d7d1
# Parent 2ccf638342d6b73283f4b07272c8540b14616afb
Time.h rename
diff -r 2ccf638342d6 -r 28cb79ae2f6f Actor.cpp
--- a/Actor.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/Actor.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -21,7 +21,7 @@
#include "TurnEngine.h"
#include "MapInfo.h"
#include "CastSpellInfo.h"
-#include "Time.h"
+#include "Timer.h"
#include "LOD.h"
#include "Party.h"
#include "GUIWindow.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f Arcomage.cpp
--- a/Arcomage.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/Arcomage.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -11,7 +11,7 @@
#include "Mouse.h"
#include "Game.h"
#include "Viewport.h"
-#include "Time.h"
+#include "Timer.h"
#include "GUIFont.h"
#include "Party.h"
#include "GUIWindow.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f AudioPlayer.cpp
--- a/AudioPlayer.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/AudioPlayer.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -14,7 +14,7 @@
#include "Actor.h"
#include "Game.h"
#include "DecorationList.h"
-#include "Time.h"
+#include "Timer.h"
#include "OSInfo.h"
#include "OurMath.h"
#include "MapInfo.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f Build/Visual Studio 2010/World of Might and Magic.vcxproj
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj Tue Nov 26 17:49:42 2013 +0600
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj Thu Nov 28 17:12:50 2013 +0600
@@ -198,7 +198,7 @@
-
+
@@ -366,7 +366,7 @@
-
+
diff -r 2ccf638342d6 -r 28cb79ae2f6f Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters
--- a/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Tue Nov 26 17:49:42 2013 +0600
+++ b/Build/Visual Studio 2010/World of Might and Magic.vcxproj.filters Thu Nov 28 17:12:50 2013 +0600
@@ -75,7 +75,6 @@
-
@@ -285,6 +284,7 @@
UI
+
@@ -399,7 +399,6 @@
-
@@ -605,6 +604,7 @@
UI\Books
+
diff -r 2ccf638342d6 -r 28cb79ae2f6f CastSpellInfo.cpp
--- a/CastSpellInfo.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/CastSpellInfo.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -18,7 +18,7 @@
#include "SpriteObject.h"
#include "ObjectList.h"
#include "stru123.h"
-#include "Time.h"
+#include "Timer.h"
#include "IconFrameTable.h"
#include "Awards.h"
#include "TurnEngine.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f Chest.cpp
--- a/Chest.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/Chest.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -19,7 +19,7 @@
#include "Texts.h"
#include "ObjectList.h"
#include "GUIWindow.h"
-#include "Time.h"
+#include "Timer.h"
#include "Overlays.h"
#include "mm7_data.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f DecalBuilder.cpp
--- a/DecalBuilder.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/DecalBuilder.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -1,6 +1,6 @@
#include "DecalBuilder.h"
#include "Game.h"
-#include "Time.h"
+#include "Timer.h"
#include "stru314.h"
#include "Outdoor.h"
#include "Log.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f GUIWindow.cpp
--- a/GUIWindow.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/GUIWindow.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -10,7 +10,7 @@
#include "OurMath.h"
#include "VideoPlayer.h"
#include "MapInfo.h"
-#include "Time.h"
+#include "Timer.h"
#include "AudioPlayer.h"
#include "Mouse.h"
#include "Viewport.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f Game.cpp
--- a/Game.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/Game.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -18,7 +18,7 @@
#include "Game.h"
#include "Party.h"
#include "Viewport.h"
-#include "Time.h"
+#include "Timer.h"
#include "Outdoor.h"
#include "Outdoor_stuff.h"
#include "Overlays.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f Indoor.cpp
--- a/Indoor.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/Indoor.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -14,7 +14,7 @@
#include "Events.h"
#include "Game.h"
#include "Viewport.h"
-#include "Time.h"
+#include "Timer.h"
#include "Party.h"
#include "OurMath.h"
#include "LOD.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f OSWindow.cpp
--- a/OSWindow.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/OSWindow.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -4,7 +4,7 @@
#include "AudioPlayer.h"
#include "VideoPlayer.h"
#include "Mouse.h"
-#include "Time.h"
+#include "Timer.h"
#include "GUIWindow.h"
#include "Party.h"
#include "Game.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f Outdoor.cpp
--- a/Outdoor.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/Outdoor.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -21,7 +21,7 @@
#include "Actor.h"
#include "Chest.h"
#include "stru123.h"
-#include "Time.h"
+#include "Timer.h"
#include "Viewport.h"
#include "Events.h"
#include "ParticleEngine.h"
@@ -3926,7 +3926,6 @@
pZ -= 30;
v113 -= 30;
pParty->uFallSpeed = 0;
- //pParty->uFallSpeed = 0;
pParty->bFlying = true;
pModel = (BSPModel *)1;
if ( pZ <= v111 )
diff -r 2ccf638342d6 -r 28cb79ae2f6f Overlays.cpp
--- a/Overlays.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/Overlays.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -8,7 +8,7 @@
#include "Sprites.h"
#include "FrameTableInc.h"
#include "IconFrameTable.h"
-#include "Time.h"
+#include "Timer.h"
#include "Party.h"
#include "TurnEngine.h"
#include "LOD.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f ParticleEngine.cpp
--- a/ParticleEngine.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/ParticleEngine.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -1,5 +1,5 @@
#include "ParticleEngine.h"
-#include "Time.h"
+#include "Timer.h"
#include "Render.h"
#include "Viewport.h"
#include "Outdoor.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f Party.cpp
--- a/Party.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/Party.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -4,7 +4,7 @@
#include "Party.h"
#include "MapInfo.h"
-#include "Time.h"
+#include "Timer.h"
#include "AudioPlayer.h"
#include "IconFrameTable.h"
#include "Mouse.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f Render.cpp
--- a/Render.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/Render.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -18,7 +18,7 @@
#include "Viewport.h"
#include "OurMath.h"
#include "PaletteManager.h"
-#include "Time.h"
+#include "Timer.h"
#include "Game.h"
#include "LightmapBuilder.h"
#include "ObjectList.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f SaveLoad.cpp
--- a/SaveLoad.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/SaveLoad.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -13,7 +13,7 @@
#include "AudioPlayer.h"
#include "Actor.h"
#include "Chest.h"
-#include "Time.h"
+#include "Timer.h"
#include "GUIWindow.h"
#include "GUIFont.h"
#include "Overlays.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f SpriteObject.cpp
--- a/SpriteObject.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/SpriteObject.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -8,7 +8,7 @@
#include "Indoor.h"
#include "Outdoor.h"
#include "ParticleEngine.h"
-#include "Time.h"
+#include "Timer.h"
#include "Game.h"
#include "LOD.h"
#include "Actor.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f Timer.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Timer.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -0,0 +1,104 @@
+
+#include "Timer.h"
+#include "Keyboard.h"
+#include "Log.h"
+
+#include "OSAPI.h"
+
+
+
+
+
+Timer *pMiscTimer = new Timer;
+Timer *pEventTimer;
+
+
+
+
+
+
+//----- (00426317) --------------------------------------------------------
+unsigned __int64 Timer::Time()
+{
+ unsigned __int64 v2 = TimeQuant * timeGetTime() / 1000;
+ if (v2 < uStartTime)
+ uStartTime = 0;
+ return v2;
+}
+
+
+
+//----- (00426349) --------------------------------------------------------
+void Timer::Pause()
+{
+ if (!bPaused)
+ {
+ uStopTime = Time();
+ bPaused = true;
+ }
+}
+
+
+//----- (00426363) --------------------------------------------------------
+void Timer::Resume()
+{
+ if (bPaused)
+ {
+ pKeyActionMap->ResetKeys();
+ bPaused = 0;
+ uStartTime = Time();
+ }
+}
+
+//----- (00426386) --------------------------------------------------------
+void Timer::TrackGameTime()
+{
+ if (!bTackGameTime)
+ {
+ uGameTimeStart = Time();
+ bTackGameTime = true;
+ }
+}
+
+
+
+//----- (004263A0) --------------------------------------------------------
+void Timer::StopGameTime()
+{
+ if (bTackGameTime)
+ {
+ bTackGameTime = 0;
+ uStartTime = Time();
+ }
+}
+
+//----- (004263B7) --------------------------------------------------------
+void Timer::Update()
+{
+ //Timer *v1; // esi@1
+ //unsigned int v2; // eax@2
+ //signed int v3; // eax@3
+ //char v4; // zf@5
+
+
+ unsigned __int64 new_time = Time();
+ while (new_time <= uStartTime)
+ new_time = Time();
+
+ uTimeElapsed = new_time - uStartTime;
+ uStartTime = new_time;
+
+ if (uTimeElapsed > 32)
+ uTimeElapsed = 32;
+
+ if (!bPaused && !bTackGameTime)
+ uTotalGameTimeElapsed += uTimeElapsed;
+ dt_in_some_format = (uTimeElapsed << 16) / 128;
+}
+
+//----- (00426402) --------------------------------------------------------
+void Timer::Initialize()
+{
+ uTotalGameTimeElapsed = 0;
+ bReady = true;
+}
diff -r 2ccf638342d6 -r 28cb79ae2f6f Timer.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Timer.h Thu Nov 28 17:12:50 2013 +0600
@@ -0,0 +1,58 @@
+#pragma once
+
+
+
+
+/* 61 */
+#pragma pack(push, 1)
+struct Timer
+{
+ static Timer *Create() {return new Timer;}
+
+ Timer():
+ bReady(false), bPaused(false)
+ {
+ bTackGameTime = 0;
+ uStartTime = 0;
+ uStopTime = 0;
+ uGameTimeStart = 0;
+ field_18 = 0;
+ uTimeElapsed = 0;
+ dt_in_some_format = 0;
+ uTotalGameTimeElapsed = 0;
+ }
+
+ void Initialize();
+ unsigned __int64 Time();
+ void Update();
+ void Pause();
+ void Resume();
+ void TrackGameTime();
+ void StopGameTime();
+
+ unsigned int bReady;
+ unsigned int bPaused;
+ int bTackGameTime;
+ unsigned int uStartTime;
+ unsigned int uStopTime;
+ int uGameTimeStart;
+ int field_18;
+ unsigned int uTimeElapsed;
+ int dt_in_some_format;
+ unsigned int uTotalGameTimeElapsed;
+
+ static const unsigned int TimeQuant = 128;
+ static const unsigned int Minute = 2 * TimeQuant;
+ static const unsigned int Hour = 60 * Minute;
+ static const unsigned int Day = 24 * Hour;
+ static const unsigned int Week = 7 * Day;
+ static const unsigned int Month = 4 * Week;
+ static const unsigned int Year = 12 * Month;
+};
+
+#pragma pack(pop)
+
+
+
+extern Timer *pMiscTimer;
+extern Timer *pEventTimer;
\ No newline at end of file
diff -r 2ccf638342d6 -r 28cb79ae2f6f TurnEngine.cpp
--- a/TurnEngine.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/TurnEngine.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -6,7 +6,7 @@
#include "Party.h"
#include "AudioPlayer.h"
#include "SpriteObject.h"
-#include "Time.h"
+#include "Timer.h"
#include "stru298.h"
#include "IconFrameTable.h"
#include "Viewport.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f UI/UICharacter.cpp
--- a/UI/UICharacter.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/UI/UICharacter.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -14,7 +14,7 @@
#include "..\Render.h"
#include "..\LOD.h"
#include "..\Viewport.h"
-#include "..\Time.h"
+#include "..\Timer.h"
#include "..\Awards.h"
#include "..\CastSpellInfo.h"
#include "..\texts.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f UI/UIPartyCreation.cpp
--- a/UI/UIPartyCreation.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/UI/UIPartyCreation.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -12,7 +12,7 @@
#include "..\AudioPlayer.h"
#include "..\Render.h"
#include "..\LOD.h"
-#include "..\Time.h"
+#include "..\Timer.h"
#include "..\IconFrameTable.h"
#include "..\texts.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f UI/UIPopup.cpp
--- a/UI/UIPopup.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/UI/UIPopup.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -20,7 +20,7 @@
#include "..\ObjectList.h"
#include "..\Chest.h"
#include "..\PaletteManager.h"
-#include "..\Time.h"
+#include "..\Timer.h"
#include "..\texts.h"
#include "..\mm7_data.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f UI/UIRest.cpp
--- a/UI/UIRest.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/UI/UIRest.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -9,7 +9,7 @@
#include "..\Outdoor.h"
#include "..\LOD.h"
#include "..\Viewport.h"
-#include "..\Time.h"
+#include "..\Timer.h"
#include "..\texts.h"
#include "..\mm7_data.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f UI/UITransition.cpp
--- a/UI/UITransition.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/UI/UITransition.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -14,7 +14,7 @@
#include "..\AudioPlayer.h"
#include "..\Outdoor.h"
#include "..\LOD.h"
-#include "..\Time.h"
+#include "..\Timer.h"
#include "..\stru159.h"
#include "..\Events2D.h"
#include "..\texts.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f UI/UiGame.cpp
--- a/UI/UiGame.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/UI/UiGame.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -25,7 +25,7 @@
#include "..\DecorationList.h"
#include "..\PlayerFrameTable.h"
#include "..\stru123.h"
-#include "..\Time.h"
+#include "..\Timer.h"
#include "..\IconFrameTable.h"
#include "..\TurnEngine.h"
#include "..\texts.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f VideoPlayer.cpp
--- a/VideoPlayer.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/VideoPlayer.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -16,7 +16,7 @@
#include "Render.h"
#include "Party.h"
#include "GUIWindow.h"
-#include "Time.h"
+#include "Timer.h"
#include "Log.h"
#include "texts.h"
#include "UI\UIHouses.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f mm7_2.cpp
--- a/mm7_2.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/mm7_2.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -48,7 +48,7 @@
#include "SaveLoad.h"
#include "stru123.h"
#include "stru176.h"
-#include "Time.h"
+#include "Timer.h"
#include "IconFrameTable.h"
#include "GUIProgressBar.h"
#include "Bink_Smacker.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f mm7_3.cpp
--- a/mm7_3.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/mm7_3.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -34,7 +34,7 @@
#include "PaletteManager.h"
#include "DecorationList.h"
#include "stru123.h"
-#include "Time.h"
+#include "Timer.h"
#include "IconFrameTable.h"
#include "TurnEngine.h"
#include "Events2D.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f mm7_4.cpp
--- a/mm7_4.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/mm7_4.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -29,7 +29,7 @@
#include "SpriteObject.h"
#include "ObjectList.h"
#include "DecorationList.h"
-#include "Time.h"
+#include "Timer.h"
#include "IconFrameTable.h"
#include "PlayerFrameTable.h"
#include "Awards.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f mm7_5.cpp
--- a/mm7_5.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/mm7_5.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -13,7 +13,7 @@
#include "Viewport.h"
#include "OurMath.h"
#include "SpriteObject.h"
-#include "Time.h"
+#include "Timer.h"
#include "stru298.h"
#include "Lights.h"
#include "Level/Decoration.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f mm7_6.cpp
--- a/mm7_6.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/mm7_6.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -30,7 +30,7 @@
#include "SpriteObject.h"
#include "ObjectList.h"
#include "stru123.h"
-#include "Time.h"
+#include "Timer.h"
#include "IconFrameTable.h"
#include "Awards.h"
#include "TurnEngine.h"
diff -r 2ccf638342d6 -r 28cb79ae2f6f stru6.cpp
--- a/stru6.cpp Tue Nov 26 17:49:42 2013 +0600
+++ b/stru6.cpp Thu Nov 28 17:12:50 2013 +0600
@@ -14,7 +14,7 @@
#include "Random.h"
#include "Spells.h"
#include "IconFrameTable.h"
-#include "Time.h"
+#include "Timer.h"
#include "Viewport.h"
#include "PaletteManager.h"
#include "Overlays.h"