Use SDL_GetTicks instead of timeGetTime

This commit is contained in:
Anonymous Maarten 2024-12-23 21:43:19 +01:00
parent 92945a581b
commit c3e2e787da
6 changed files with 19 additions and 11 deletions

View File

@ -5,6 +5,8 @@
#include "legostate.h"
#include "legoworld.h"
#include <SDL3/SDL_stdinc.h>
class LegoCarBuildAnimPresenter;
class LegoControlManagerNotificationParam;
class LegoEventNotificationParam;
@ -176,7 +178,7 @@ class LegoCarBuild : public LegoWorld {
MxU8 m_unk0x109; // 0x109
MxU16 m_unk0x10a; // 0x10a
DWORD m_unk0x10c; // 0x10c
Uint64 m_unk0x10c; // 0x10c
LegoROI* m_unk0x110; // 0x110
BoundingSphere m_unk0x114; // 0x114
MxMatrix m_unk0x12c; // 0x12c

View File

@ -5,6 +5,7 @@
#include "mxcore.h"
#include <ddraw.h>
#include <SDL3/SDL_stdinc.h>
class MxVideoPresenter;
@ -78,7 +79,7 @@ class MxTransitionManager : public MxCore {
MxU16 m_animationTimer; // 0x34
MxU16 m_columnOrder[640]; // 0x36
MxU16 m_randomShift[480]; // 0x536
MxULong m_systemTime; // 0x8f8
Uint64 m_systemTime; // 0x8f8
MxS32 m_animationSpeed; // 0x8fc
};

View File

@ -35,6 +35,7 @@
#include <vec.h>
#include <SDL3/SDL_stdinc.h>
#include <SDL3/SDL_timer.h>
// Names and values verified by BETA10 0x1006d742.
// Note that these were probably hard-coded numbers in the original.
@ -561,7 +562,7 @@ MxResult LegoCarBuild::Tickle()
}
if (m_unk0x10a) {
DWORD time = timeGetTime();
Uint64 time = SDL_GetTicks();
DWORD dTime = (time - m_unk0x10c) / 100;
if (m_carId == RaceCar_Actor) {
@ -1605,7 +1606,7 @@ void LegoCarBuild::FUN_10025720(undefined4 p_param)
#endif
if (m_unk0x10a != 0) {
m_unk0x10c = timeGetTime();
m_unk0x10c = SDL_GetTicks();
}
}

View File

@ -12,6 +12,8 @@
#include "mxticklemanager.h"
#include "mxvideopresenter.h"
#include <SDL3/SDL_timer.h>
DECOMP_SIZE_ASSERT(MxTransitionManager, 0x900)
// GLOBAL: LEGO1 0x100f4378
@ -54,11 +56,11 @@ MxResult MxTransitionManager::GetDDrawSurfaceFromVideoManager() // vtable+0x14
// FUNCTION: LEGO1 0x1004bac0
MxResult MxTransitionManager::Tickle()
{
if (m_animationSpeed + m_systemTime > timeGetTime()) {
if (m_animationSpeed + m_systemTime > SDL_GetTicks()) {
return SUCCESS;
}
m_systemTime = timeGetTime();
m_systemTime = SDL_GetTicks();
switch (m_mode) {
case e_noAnimation:
@ -112,7 +114,7 @@ MxResult MxTransitionManager::StartTransition(
action->SetFlags(action->GetFlags() | MxDSAction::c_bit10);
}
MxU32 time = timeGetTime();
Uint64 time = SDL_GetTicks();
m_systemTime = time;
m_animationSpeed = p_speed;

View File

@ -3,6 +3,8 @@
#include "mxcore.h"
#include <SDL3/SDL_stdinc.h>
// VTABLE: LEGO1 0x100dc0e0
// VTABLE: BETA10 0x101c1bb0
// SIZE 0x10
@ -35,7 +37,7 @@ class MxTimer : public MxCore {
// MxTimer::`scalar deleting destructor'
private:
MxLong m_startTime; // 0x08
Uint64 m_startTime; // 0x08
MxBool m_isRunning; // 0x0c
static MxLong g_lastTimeCalculated;

View File

@ -1,6 +1,6 @@
#include "mxtimer.h"
#include <windows.h>
#include <SDL3/SDL_timer.h>
// GLOBAL: LEGO1 0x10101414
// GLOBAL: BETA10 0x10201f84
@ -14,7 +14,7 @@ MxLong MxTimer::g_lastTimeTimerStarted = 0;
MxTimer::MxTimer()
{
m_isRunning = FALSE;
m_startTime = timeGetTime();
m_startTime = SDL_GetTicks();
InitLastTimeCalculated();
}
@ -22,7 +22,7 @@ MxTimer::MxTimer()
// FUNCTION: BETA10 0x1012bf23
MxLong MxTimer::GetRealTime()
{
MxTimer::g_lastTimeCalculated = timeGetTime();
MxTimer::g_lastTimeCalculated = SDL_GetTicks();
return MxTimer::g_lastTimeCalculated - m_startTime;
}