summaryrefslogtreecommitdiffhomepage
path: root/Stars45/HUDView.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-03-08 19:33:59 +0100
committerAki <please@ignore.pl>2022-03-08 19:33:59 +0100
commite472d9537ee7919630e5f6039f8425b06f6c4213 (patch)
treec146d59b532ec1ae248727faa182102cab6365e2 /Stars45/HUDView.cpp
parentb563a07d9fcaa58514eeb3ec78438db56ecf2e63 (diff)
downloadstarshatter-e472d9537ee7919630e5f6039f8425b06f6c4213.zip
starshatter-e472d9537ee7919630e5f6039f8425b06f6c4213.tar.gz
starshatter-e472d9537ee7919630e5f6039f8425b06f6c4213.tar.bz2
Replaced time funcs from Game with Clock equivalents
This excludes time compression stuff, as it will need some more attention due to casting. I don't quite like the long invocations that go through game instance first then get the clock. It looks bad. I'll need to rethink how modules are being made available in the codebase.
Diffstat (limited to 'Stars45/HUDView.cpp')
-rw-r--r--Stars45/HUDView.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Stars45/HUDView.cpp b/Stars45/HUDView.cpp
index 2ca3bf4..2f0ec20 100644
--- a/Stars45/HUDView.cpp
+++ b/Stars45/HUDView.cpp
@@ -863,7 +863,7 @@ HUDView::MarkerColor(Contact* contact)
c = Ship::IFFColor(c_iff) * contact->Age();
if (contact->GetShot() && contact->Threat(ship)) {
- if ((Game::GetInstance()->RealTime()/500) & 1)
+ if ((Game::GetInstance()->GetClock()->RealTime()/500) & 1)
c = c * 2;
else
c = c * 0.5;
@@ -1463,7 +1463,7 @@ HUDView::DrawBars()
else if (threat > 1) {
threat_warn = ContentBundle::GetInstance()->GetText("HUDView.missile-warn");
- show_msg = ((Game::GetInstance()->RealTime()/500) & 1) != 0;
+ show_msg = ((Game::GetInstance()->GetClock()->RealTime()/500) & 1) != 0;
}
if (show_msg) {
@@ -2115,9 +2115,9 @@ HUDView::DrawTarget()
System* sys = ship->GetSubTarget();
if (sys) {
Color stat = hud_color;
- static DWORD blink = Game::GetInstance()->RealTime();
+ static DWORD blink = Game::GetInstance()->GetClock()->RealTime();
- int blink_delta = Game::GetInstance()->RealTime() - blink;
+ int blink_delta = Game::GetInstance()->GetClock()->RealTime() - blink;
sprintf_s(txt, "%s %03d", sys->Abbreviation(), (int) sys->Availability());
switch (sys->Status()) {
@@ -2131,7 +2131,7 @@ HUDView::DrawTarget()
}
if (blink_delta > 500)
- blink = Game::GetInstance()->RealTime();
+ blink = Game::GetInstance()->GetClock()->RealTime();
range_rect.y += 10;
DrawHUDText(TXT_TARGET_SUB, txt, range_rect, DT_RIGHT);
@@ -2657,7 +2657,7 @@ HUDView::DrawWarningPanel()
int y = cockpit_hud_texture ? 410 : height-97;
int c = cockpit_hud_texture ? 3 : 4;
- static DWORD blink = Game::GetInstance()->RealTime();
+ static DWORD blink = Game::GetInstance()->GetClock()->RealTime();
for (int index = 0; index < 12; index++) {
int stat = -1;
@@ -2698,7 +2698,7 @@ HUDView::DrawWarningPanel()
Color tc = status_color;
if (stat != System::NOMINAL) {
- if (Game::GetInstance()->RealTime() - blink < 250) {
+ if (Game::GetInstance()->GetClock()->RealTime() - blink < 250) {
tc = cockpit_hud_texture ? txt_color : Color(8,8,8);
}
}
@@ -2740,8 +2740,8 @@ HUDView::DrawWarningPanel()
}
}
- if (Game::GetInstance()->RealTime() - blink > 500)
- blink = Game::GetInstance()->RealTime();
+ if (Game::GetInstance()->GetClock()->RealTime() - blink > 500)
+ blink = Game::GetInstance()->GetClock()->RealTime();
// reset for next time
SetStatusColor(System::NOMINAL);
@@ -2876,7 +2876,7 @@ HUDView::DrawMessages()
// age messages:
for (int i = 0; i < MAX_MSG; i++) {
if (msg_time[i] > 0) {
- msg_time[i] -= Game::GetInstance()->GUITime();
+ msg_time[i] -= Game::GetInstance()->GetClock()->GuiDelta();
if (msg_time[i] <= 0) {
msg_time[i] = 0;