From 0052edae47d1e6ae613497c524719eff5838f52a Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 18 Feb 2022 23:54:30 +0100 Subject: Switched to use GetIntance for Game instead of static methods --- Stars45/Mfd.cpp | 90 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'Stars45/Mfd.cpp') diff --git a/Stars45/Mfd.cpp b/Stars45/Mfd.cpp index e01e1cb..377eabe 100644 --- a/Stars45/Mfd.cpp +++ b/Stars45/Mfd.cpp @@ -326,12 +326,12 @@ MFD::DrawSensorLabels(const char* mfd_mode) int scan_y = rect.y; switch (sensor->GetMode()) { - case Sensor::PAS: strcpy_s(mode_buf, Game::GetText("MFD.mode.passive").data()); break; - case Sensor::STD: strcpy_s(mode_buf, Game::GetText("MFD.mode.standard").data()); break; - case Sensor::ACM: strcpy_s(mode_buf, Game::GetText("MFD.mode.auto-combat").data()); break; - case Sensor::GM: strcpy_s(mode_buf, Game::GetText("MFD.mode.ground").data()); break; - case Sensor::PST: strcpy_s(mode_buf, Game::GetText("MFD.mode.passive").data()); break; - case Sensor::CST: strcpy_s(mode_buf, Game::GetText("MFD.mode.combined").data()); break; + case Sensor::PAS: strcpy_s(mode_buf, Game::GetInstance()->GetText("MFD.mode.passive").data()); break; + case Sensor::STD: strcpy_s(mode_buf, Game::GetInstance()->GetText("MFD.mode.standard").data()); break; + case Sensor::ACM: strcpy_s(mode_buf, Game::GetInstance()->GetText("MFD.mode.auto-combat").data()); break; + case Sensor::GM: strcpy_s(mode_buf, Game::GetInstance()->GetText("MFD.mode.ground").data()); break; + case Sensor::PST: strcpy_s(mode_buf, Game::GetInstance()->GetText("MFD.mode.passive").data()); break; + case Sensor::CST: strcpy_s(mode_buf, Game::GetInstance()->GetText("MFD.mode.combined").data()); break; default: break; } @@ -355,7 +355,7 @@ MFD::DrawSensorLabels(const char* mfd_mode) if (ship->GetProbeLauncher()) { char probes[32]; - sprintf_s(probes, "%s %02d", Game::GetText("MFD.probe").data(), ship->GetProbeLauncher()->Ammo()); + sprintf_s(probes, "%s %02d", Game::GetInstance()->GetText("MFD.probe").data(), ship->GetProbeLauncher()->Ammo()); DrawMFDText(3, probes, probe_rect, DT_RIGHT); } else { @@ -411,7 +411,7 @@ MFD::DrawSensorMFD() Sensor* sensor = ship->GetSensor(); if (!sensor) { - DrawMFDText(0, Game::GetText("MFD.inactive").data(), rect, DT_CENTER); + DrawMFDText(0, Game::GetInstance()->GetText("MFD.inactive").data(), rect, DT_CENTER); return; } @@ -596,7 +596,7 @@ MFD::DrawSensorMFD() } } - DrawSensorLabels(Game::GetText("MFD.mode.field-of-view").data()); + DrawSensorLabels(Game::GetInstance()->GetText("MFD.mode.field-of-view").data()); } // +--------------------------------------------------------------------+ @@ -619,7 +619,7 @@ MFD::DrawHSD() Sensor* sensor = ship->GetSensor(); if (!sensor) { - DrawMFDText(0, Game::GetText("MFD.inactive").data(), rect, DT_CENTER); + DrawMFDText(0, Game::GetInstance()->GetText("MFD.inactive").data(), rect, DT_CENTER); return; } @@ -820,7 +820,7 @@ MFD::DrawHSD() } } - DrawSensorLabels(Game::GetText("MFD.mode.horizontal").data()); + DrawSensorLabels(Game::GetInstance()->GetText("MFD.mode.horizontal").data()); } // +--------------------------------------------------------------------+ @@ -843,7 +843,7 @@ MFD::Draw3D() Sensor* sensor = ship->GetSensor(); if (!sensor) { - DrawMFDText(0, Game::GetText("MFD.inactive").data(), rect, DT_CENTER); + DrawMFDText(0, Game::GetInstance()->GetText("MFD.inactive").data(), rect, DT_CENTER); return; } @@ -1036,7 +1036,7 @@ MFD::Draw3D() } } - DrawSensorLabels(Game::GetText("MFD.mode.3D").data()); + DrawSensorLabels(Game::GetInstance()->GetText("MFD.mode.3D").data()); } // +--------------------------------------------------------------------+ @@ -1047,7 +1047,7 @@ void MFD::DrawMap() { Rect text_rect(rect.x, rect.y, rect.w, 12); - DrawMFDText(0, Game::GetText("MFD.mode.ground").data(), text_rect, DT_CENTER); + DrawMFDText(0, Game::GetInstance()->GetText("MFD.mode.ground").data(), text_rect, DT_CENTER); } // +--------------------------------------------------------------------+ @@ -1086,7 +1086,7 @@ MFD::DrawGameMFD() int t = 0; if (!HUDView::IsArcade() && HUDView::ShowFPS()) { - sprintf_s(txt, "FPS: %6.2f", Game::FrameRate()); + sprintf_s(txt, "FPS: %6.2f", Game::GetInstance()->FrameRate()); DrawMFDText(t++, txt, txt_rect, DT_LEFT); txt_rect.y += 10; @@ -1105,9 +1105,9 @@ MFD::DrawGameMFD() if (lines <= 2) return; - int hours = (Game::GameTime() / 3600000) ; - int minutes = (Game::GameTime() / 60000) % 60; - int seconds = (Game::GameTime() / 1000) % 60; + int hours = (Game::GetInstance()->GameTime() / 3600000) ; + int minutes = (Game::GetInstance()->GameTime() / 60000) % 60; + int seconds = (Game::GetInstance()->GameTime() / 1000) % 60; if (ship) { DWORD clock = ship->MissionClock(); @@ -1117,8 +1117,8 @@ MFD::DrawGameMFD() seconds = (clock / 1000) % 60; } - if (Game::TimeCompression() > 1) - sprintf_s(txt, "%02d:%02d:%02d x%d", hours, minutes, seconds, Game::TimeCompression()); //-V576 + if (Game::GetInstance()->TimeCompression() > 1) + sprintf_s(txt, "%02d:%02d:%02d x%d", hours, minutes, seconds, Game::GetInstance()->TimeCompression()); //-V576 else sprintf_s(txt, "%02d:%02d:%02d", hours, minutes, seconds); @@ -1134,15 +1134,15 @@ MFD::DrawGameMFD() if (ship) { switch (ship->GetFlightPhase()) { - case Ship::DOCKED: DrawMFDText(t++, Game::GetText("MFD.phase.DOCKED").data(), txt_rect, DT_LEFT); break; - case Ship::ALERT: DrawMFDText(t++, Game::GetText("MFD.phase.ALERT").data(), txt_rect, DT_LEFT); break; - case Ship::LOCKED: DrawMFDText(t++, Game::GetText("MFD.phase.LOCKED").data(), txt_rect, DT_LEFT); break; - case Ship::LAUNCH: DrawMFDText(t++, Game::GetText("MFD.phase.LAUNCH").data(), txt_rect, DT_LEFT); break; - case Ship::TAKEOFF: DrawMFDText(t++, Game::GetText("MFD.phase.TAKEOFF").data(), txt_rect, DT_LEFT); break; - case Ship::ACTIVE: DrawMFDText(t++, Game::GetText("MFD.phase.ACTIVE").data(), txt_rect, DT_LEFT); break; - case Ship::APPROACH: DrawMFDText(t++, Game::GetText("MFD.phase.APPROACH").data(), txt_rect, DT_LEFT); break; - case Ship::RECOVERY: DrawMFDText(t++, Game::GetText("MFD.phase.RECOVERY").data(), txt_rect, DT_LEFT); break; - case Ship::DOCKING: DrawMFDText(t++, Game::GetText("MFD.phase.DOCKING").data(), txt_rect, DT_LEFT); break; + case Ship::DOCKED: DrawMFDText(t++, Game::GetInstance()->GetText("MFD.phase.DOCKED").data(), txt_rect, DT_LEFT); break; + case Ship::ALERT: DrawMFDText(t++, Game::GetInstance()->GetText("MFD.phase.ALERT").data(), txt_rect, DT_LEFT); break; + case Ship::LOCKED: DrawMFDText(t++, Game::GetInstance()->GetText("MFD.phase.LOCKED").data(), txt_rect, DT_LEFT); break; + case Ship::LAUNCH: DrawMFDText(t++, Game::GetInstance()->GetText("MFD.phase.LAUNCH").data(), txt_rect, DT_LEFT); break; + case Ship::TAKEOFF: DrawMFDText(t++, Game::GetInstance()->GetText("MFD.phase.TAKEOFF").data(), txt_rect, DT_LEFT); break; + case Ship::ACTIVE: DrawMFDText(t++, Game::GetInstance()->GetText("MFD.phase.ACTIVE").data(), txt_rect, DT_LEFT); break; + case Ship::APPROACH: DrawMFDText(t++, Game::GetInstance()->GetText("MFD.phase.APPROACH").data(), txt_rect, DT_LEFT); break; + case Ship::RECOVERY: DrawMFDText(t++, Game::GetInstance()->GetText("MFD.phase.RECOVERY").data(), txt_rect, DT_LEFT); break; + case Ship::DOCKING: DrawMFDText(t++, Game::GetInstance()->GetText("MFD.phase.DOCKING").data(), txt_rect, DT_LEFT); break; } } } @@ -1162,7 +1162,7 @@ MFD::DrawStatusMFD() Drive* drive = ship->GetDrive(); if (drive) { - DrawMFDText(row++, Game::GetText("MFD.status.THRUST").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.THRUST").data(), status_rect, DT_LEFT); DrawGauge(status_rect.x+70, status_rect.y, (int) ship->Throttle()); status_rect.y += 10; } @@ -1172,7 +1172,7 @@ MFD::DrawStatusMFD() if (ship->Reactors().size() > 0) { PowerSource* reactor = ship->Reactors()[0]; if (reactor) { - DrawMFDText(row++, Game::GetText("MFD.status.FUEL").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.FUEL").data(), status_rect, DT_LEFT); DrawGauge(status_rect.x+70, status_rect.y, reactor->Charge()); status_rect.y += 10; } @@ -1182,7 +1182,7 @@ MFD::DrawStatusMFD() QuantumDrive* quantum_drive = ship->GetQuantumDrive(); if (quantum_drive) { - DrawMFDText(row++, Game::GetText("MFD.status.QUANTUM").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.QUANTUM").data(), status_rect, DT_LEFT); DrawGauge(status_rect.x+70, status_rect.y, (int) quantum_drive->Charge()); status_rect.y += 10; } @@ -1197,7 +1197,7 @@ MFD::DrawStatusMFD() else if (hull > 33) hull_status = System::DEGRADED; - DrawMFDText(row++, Game::GetText("MFD.status.HULL").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.HULL").data(), status_rect, DT_LEFT); DrawGauge(status_rect.x+70, status_rect.y, (int) hull); status_rect.y += 10; @@ -1205,7 +1205,7 @@ MFD::DrawStatusMFD() Shield* shield = ship->GetShield(); if (shield) { - DrawMFDText(row++, Game::GetText("MFD.status.SHIELD").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.SHIELD").data(), status_rect, DT_LEFT); DrawGauge(status_rect.x+70, status_rect.y, ship->ShieldStrength()); status_rect.y += 10; } @@ -1214,7 +1214,7 @@ MFD::DrawStatusMFD() Weapon* primary = ship->GetPrimary(); if (primary) { - DrawMFDText(row++, Game::GetText("MFD.status.GUNS").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.GUNS").data(), status_rect, DT_LEFT); DrawGauge(status_rect.x+70, status_rect.y, primary->Charge()); status_rect.y += 10; } @@ -1244,7 +1244,7 @@ MFD::DrawStatusMFD() if (ship->GetDecoy()) { char ammo[8]; sprintf_s(ammo, "%d", ship->GetDecoy()->Ammo()); - DrawMFDText(row++, Game::GetText("MFD.status.DECOY").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.DECOY").data(), status_rect, DT_LEFT); status_rect.x += 70; DrawMFDText(row++, ammo, status_rect, DT_LEFT); status_rect.x -= 70; @@ -1254,7 +1254,7 @@ MFD::DrawStatusMFD() if (NetGame::GetInstance()) { char lives[8]; sprintf_s(lives, "%d", ship->RespawnCount() + 1); - DrawMFDText(row++, Game::GetText("MFD.status.LIVES").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.LIVES").data(), status_rect, DT_LEFT); status_rect.x += 70; DrawMFDText(row++, lives, status_rect, DT_LEFT); status_rect.x -= 70; @@ -1267,22 +1267,22 @@ MFD::DrawStatusMFD() Sensor* sensor = ship->GetSensor(); if (sensor) { if (ship->GetFlightPhase() != Ship::ACTIVE) { - DrawMFDText(row++, Game::GetText("MFD.status.SENSOR").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.SENSOR").data(), status_rect, DT_LEFT); status_rect.x += 70; - DrawMFDText(row++, Game::GetText("MFD.status.OFFLINE").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.OFFLINE").data(), status_rect, DT_LEFT); status_rect.x -= 70; status_rect.y += 10; } else { - DrawMFDText(row++, Game::GetText("MFD.status.EMCON").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.EMCON").data(), status_rect, DT_LEFT); status_rect.x += 70; - sprintf_s(txt, "%s %d", Game::GetText("MFD.status.MODE").data(), ship->GetEMCON()); + sprintf_s(txt, "%s %d", Game::GetInstance()->GetText("MFD.status.MODE").data(), ship->GetEMCON()); if (!sensor->IsPowerOn() || sensor->GetEnergy() == 0) { - if (!Game::Paused() && (Game::RealTime()/1000) & 2) - strcpy_s(txt, Game::GetText("MFD.status.SENSOR-OFF").data()); + if (!Game::GetInstance()->Paused() && (Game::GetInstance()->RealTime()/1000) & 2) + strcpy_s(txt, Game::GetInstance()->GetText("MFD.status.SENSOR-OFF").data()); } DrawMFDText(row++, txt, status_rect, DT_LEFT); @@ -1293,7 +1293,7 @@ MFD::DrawStatusMFD() if (lines <= 7) return; - DrawMFDText(row++, Game::GetText("MFD.status.SYSTEMS").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.SYSTEMS").data(), status_rect, DT_LEFT); status_rect.x += 70; DrawMFDText(row++, ship->GetDirectorInfo(), status_rect, DT_LEFT); @@ -1302,7 +1302,7 @@ MFD::DrawStatusMFD() sprintf_s(lives, "%d", ship->RespawnCount() + 1); status_rect.x -= 70; status_rect.y += 10; - DrawMFDText(row++, Game::GetText("MFD.status.LIVES").data(), status_rect, DT_LEFT); + DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.LIVES").data(), status_rect, DT_LEFT); status_rect.x += 70; DrawMFDText(row++, lives, status_rect, DT_LEFT); } -- cgit v1.1