Mercurial > might-and-magic-trilogy
view Time.cpp @ 126:2331a331d36a
3.11.12 palette
author | Ritor1 |
---|---|
date | Sun, 04 Nov 2012 09:37:15 +0600 |
parents | fd64b06a39a8 |
children |
line wrap: on
line source
#include "OSAPI.h" #include "Time.h" #include "Keyboard.h" #include "mm7_data.h" Timer *pMiscTimer = new Timer; Timer *pEventTimer; //----- (00426317) -------------------------------------------------------- unsigned __int64 Timer::Time() { uint v2 = (timeGetTime() << 7) / 0x3E8; 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) -------------------------------------------------------- int Timer::Update() { Timer *v1; // esi@1 unsigned int v2; // eax@2 signed int v3; // eax@3 char v4; // zf@5 int result; // eax@8 v1 = this; do { v2 = Time() - v1->uStartTime; v1->uTimeElapsed = v2; } while ( (signed int)v2 <= 0 ); v1->uStartTime = Time(); v3 = v1->uTimeElapsed; if ( v3 > 32 ) v3 = 32; v4 = v1->bPaused == 0; v1->uTimeElapsed = v3; if ( v4 && !v1->bTackGameTime ) v1->uTotalGameTimeElapsed += v3; result = (v3 << 16) / 128; v1->dt_in_some_format = result; return result; } //----- (00426402) -------------------------------------------------------- void Timer::Initialize() { uTotalGameTimeElapsed = 0; bReady = true; }