Mercurial > mm7
view Time.cpp @ 793:290afbd48b6b
IndoorLocation::GetSector fixed (even better!)
author | Nomad |
---|---|
date | Mon, 25 Mar 2013 09:17:42 +0200 |
parents | b27dd658ea77 |
children | cfc65feef029 |
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) -------------------------------------------------------- void Timer::Update() { Timer *v1; // esi@1 unsigned int v2; // eax@2 signed int v3; // eax@3 char v4; // zf@5 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; v1->dt_in_some_format = (v3 << 16) / 128; } //----- (00426402) -------------------------------------------------------- void Timer::Initialize() { uTotalGameTimeElapsed = 0; bReady = true; }