summaryrefslogtreecommitdiffhomepage
path: root/Stars45/Starshatter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45/Starshatter.cpp')
-rw-r--r--Stars45/Starshatter.cpp55
1 files changed, 28 insertions, 27 deletions
diff --git a/Stars45/Starshatter.cpp b/Stars45/Starshatter.cpp
index d1602b2..b49fbc4 100644
--- a/Stars45/Starshatter.cpp
+++ b/Stars45/Starshatter.cpp
@@ -85,6 +85,7 @@
#include "MachineInfo.h"
#include "Game.h"
#include "GameWinDX9.h"
+#include "Clock.h"
#include "ContentBundle.h"
#include "VideoFactory.h"
#include "Screen.h"
@@ -456,7 +457,7 @@ Starshatter::InitGame()
SetupSplash();
}
- time_mark = Game::GetInstance()->GetClock()->GameTime();
+ time_mark = Clock::GetInstance()->GameTime();
minutes = 0;
return true;
@@ -617,7 +618,7 @@ Starshatter::SetGameMode(int m)
HUDView::ClearMessages();
RadioView::ClearMessages();
- clock.SetTimeCompression(1.0);
+ Clock::GetInstance()->SetTimeCompression(1.0);
Pause(false);
Print(" Stardate: %.1f\n", StarSystem::GetBaseTime());
@@ -855,7 +856,7 @@ Starshatter::UpdateWorld()
Drive::StartFrame();
if (world)
- world->ExecFrame(clock.Delta());
+ world->ExecFrame(Clock::GetInstance()->Delta());
}
if (game_mode == PLAY_MODE || InCutscene()) {
@@ -866,7 +867,7 @@ Starshatter::UpdateWorld()
cam_dir->VirtualHeadOffset(head_tracker->GetX(), head_tracker->GetY(), head_tracker->GetZ());
}
- cam_dir->ExecFrame(clock.GuiDelta());
+ cam_dir->ExecFrame(Clock::GetInstance()->GuiDelta());
}
Sim* sim = Sim::GetSim();
@@ -876,7 +877,7 @@ Starshatter::UpdateWorld()
ListIter<Ship> iter = rgn->Ships();
while (++iter) {
Ship* s = iter.value();
- s->SelectDetail(clock.Delta());
+ s->SelectDetail(Clock::GetInstance()->Delta());
}
}
}
@@ -1068,7 +1069,7 @@ Starshatter::GameState()
}
if (game_mode == EXIT_MODE) {
- exit_time -= Game::GetInstance()->GetClock()->GuiDelta();
+ exit_time -= Clock::GetInstance()->GuiDelta();
if (exit_time <= 0)
Game::Exit();
@@ -1094,7 +1095,7 @@ Starshatter::DoMenuScreenFrame()
}
if (time_til_change > 0)
- time_til_change -= Game::GetInstance()->GetClock()->GuiDelta();
+ time_til_change -= Clock::GetInstance()->GuiDelta();
if (!menuscreen)
return;
@@ -1156,7 +1157,7 @@ Starshatter::DoPlanScreenFrame()
Mouse::SetCursor(Mouse::ARROW);
if (time_til_change > 0)
- time_til_change -= Game::GetInstance()->GetClock()->GuiDelta();
+ time_til_change -= Clock::GetInstance()->GuiDelta();
if (KeyDown(KEY_EXIT)) {
if (time_til_change <= 0) {
@@ -1189,7 +1190,7 @@ Starshatter::DoCmpnScreenFrame()
Mouse::SetCursor(Mouse::ARROW);
if (time_til_change > 0)
- time_til_change -= Game::GetInstance()->GetClock()->GuiDelta();
+ time_til_change -= Clock::GetInstance()->GuiDelta();
exit_latch = KeyDown(KEY_EXIT) ? true : false;
@@ -1233,18 +1234,18 @@ Starshatter::DoCmpnScreenFrame()
else if (KeyDown(KEY_TIME_COMPRESS)) {
time_til_change = 1;
- double compression = clock.TimeCompression() * 2;
+ double compression = Clock::GetInstance()->TimeCompression() * 2;
if (compression > 8.0)
compression = 8.0;
- clock.SetTimeCompression(compression);
+ Clock::GetInstance()->SetTimeCompression(compression);
}
else if (KeyDown(KEY_TIME_EXPAND)) {
time_til_change = 1;
- double compression = clock.TimeCompression() / 2;
+ double compression = Clock::GetInstance()->TimeCompression() / 2;
if (compression < 0.5)
compression = 0.5;
- clock.SetTimeCompression(compression);
+ Clock::GetInstance()->SetTimeCompression(compression);
}
}
}
@@ -1464,7 +1465,7 @@ Starshatter::DoGameScreenFrame()
}
}
- gamescreen->FrameRate(Game::GetInstance()->GetClock()->Rate());
+ gamescreen->FrameRate(Clock::GetInstance()->Rate());
gamescreen->ExecFrame();
if (KeyDown(KEY_EXIT)) {
@@ -1479,7 +1480,7 @@ Starshatter::DoGameScreenFrame()
}
if (time_til_change > 0)
- time_til_change -= Game::GetInstance()->GetClock()->GuiDelta();
+ time_til_change -= Clock::GetInstance()->GuiDelta();
if (exit_latch && !KeyDown(KEY_EXIT))
exit_latch = false;
@@ -1544,11 +1545,11 @@ Starshatter::DoGameScreenFrame()
DoGameKeys();
}
- gamescreen->FrameRate(Game::GetInstance()->GetClock()->Rate());
+ gamescreen->FrameRate(Clock::GetInstance()->Rate());
gamescreen->ExecFrame();
- if (Game::GetInstance()->GetClock()->GameTime() - time_mark > 60000) {
- time_mark = Game::GetInstance()->GetClock()->GameTime();
+ if (Clock::GetInstance()->GameTime() - time_mark > 60000) {
+ time_mark = Clock::GetInstance()->GameTime();
minutes++;
if (minutes > 60)
Print(" TIME %2d:%02d:00\n", minutes/60, minutes%60);
@@ -1633,12 +1634,12 @@ Starshatter::DoGameKeys()
else if (KeyDown(KEY_TIME_COMPRESS)) {
time_til_change = 0.5;
if (NetGame::IsNetGame())
- clock.SetTimeCompression(1.0);
+ Clock::GetInstance()->SetTimeCompression(1.0);
else {
- double compression = clock.TimeCompression() * 2;
+ double compression = Clock::GetInstance()->TimeCompression() * 2;
if (compression > 4.0)
compression = 4.0;
- clock.SetTimeCompression(compression);
+ Clock::GetInstance()->SetTimeCompression(compression);
}
}
@@ -1646,12 +1647,12 @@ Starshatter::DoGameKeys()
time_til_change = 0.5;
if (NetGame::IsNetGame())
- clock.SetTimeCompression(1.0);
+ Clock::GetInstance()->SetTimeCompression(1.0);
else {
- double compression = clock.TimeCompression() / 2;
+ double compression = Clock::GetInstance()->TimeCompression() / 2;
if (compression < 0.5)
compression = 0.5;
- clock.SetTimeCompression(compression);
+ Clock::GetInstance()->SetTimeCompression(compression);
}
}
@@ -1806,7 +1807,7 @@ Starshatter::DoGameKeys()
}
if (cam_dir) {
- double spin = (PI/2) * Game::GetInstance()->GetClock()->Delta(); // Game::GetInstance()->GetClock()->GuiDelta();
+ double spin = (PI/2) * Clock::GetInstance()->Delta(); // Game::GetInstance()->GetClock()->GuiDelta();
if (KeyDown(KEY_CAM_EXT_PLUS_AZ))
cam_dir->ExternalAzimuth(spin);
@@ -1834,13 +1835,13 @@ Starshatter::DoGameKeys()
if (KeyDown(KEY_CAM_EXT_PLUS_RANGE)){
if (!gamescreen->IsNavShown()) {
- cam_dir->ExternalRange((float) (1 + 1.5 * Game::GetInstance()->GetClock()->Delta())); // 1.1f);
+ cam_dir->ExternalRange((float) (1 + 1.5 * Clock::GetInstance()->Delta())); // 1.1f);
}
}
else if (KeyDown(KEY_CAM_EXT_MINUS_RANGE)) {
if (!gamescreen->IsNavShown()) {
- cam_dir->ExternalRange((float) (1 - 1.5 * Game::GetInstance()->GetClock()->Delta())); // 0.9f);
+ cam_dir->ExternalRange((float) (1 - 1.5 * Clock::GetInstance()->Delta())); // 0.9f);
}
}