diff options
author | Aki <please@ignore.pl> | 2022-03-07 23:56:54 +0100 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-03-07 23:57:49 +0100 |
commit | f725e598935860d15099a0310a3aef7197a58e9c (patch) | |
tree | ab227ca1318c4a79abdc5ba749724e158869aa46 /Stars45/Starshatter.cpp | |
parent | a80a4f25fe4f7b235443c87ff840e5e06a41290e (diff) | |
download | starshatter-f725e598935860d15099a0310a3aef7197a58e9c.zip starshatter-f725e598935860d15099a0310a3aef7197a58e9c.tar.gz starshatter-f725e598935860d15099a0310a3aef7197a58e9c.tar.bz2 |
Replaced old integrated clock with new one
The interface remains unchanged for now, but changing to use GetClock
or similar method to get clock owned by the Game instance is preferred.
Diffstat (limited to 'Stars45/Starshatter.cpp')
-rw-r--r-- | Stars45/Starshatter.cpp | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/Stars45/Starshatter.cpp b/Stars45/Starshatter.cpp index 7326128..eb971e8 100644 --- a/Stars45/Starshatter.cpp +++ b/Stars45/Starshatter.cpp @@ -855,23 +855,6 @@ Starshatter::GameLoop() void Starshatter::UpdateWorld() { - long new_time = real_time; - double delta = new_time - frame_time; // in milliseconds - seconds = max_frame_length; // in seconds - gui_seconds = delta * 0.001; - - if (frame_time == 0) - gui_seconds = 0; - - if (delta < time_comp * max_frame_length * 1000) { - seconds = time_comp * delta * 0.001; - } - else { - seconds = time_comp * max_frame_length; - } - - frame_time = new_time; - Galaxy* galaxy = Galaxy::GetInstance(); if (galaxy) galaxy->ExecFrame(); @@ -890,12 +873,10 @@ Starshatter::UpdateWorld() } else { - game_time += (DWORD) (seconds * 1000); - Drive::StartFrame(); if (world) - world->ExecFrame(seconds); + world->ExecFrame(clock.Delta()); } if (game_mode == PLAY_MODE || InCutscene()) { @@ -906,7 +887,7 @@ Starshatter::UpdateWorld() cam_dir->VirtualHeadOffset(head_tracker->GetX(), head_tracker->GetY(), head_tracker->GetZ()); } - cam_dir->ExecFrame(gui_seconds); + cam_dir->ExecFrame(clock.GuiDelta()); } Sim* sim = Sim::GetSim(); @@ -916,7 +897,7 @@ Starshatter::UpdateWorld() ListIter<Ship> iter = rgn->Ships(); while (++iter) { Ship* s = iter.value(); - s->SelectDetail(seconds); + s->SelectDetail(clock.Delta()); } } } |