From 0da933a0146a0689546b21231e14f2dfc2bc14e8 Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 23 Feb 2022 23:36:37 +0100 Subject: Switched to use ContentBundle's GetText --- Stars45/Mfd.cpp | 77 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 38 deletions(-) (limited to 'Stars45/Mfd.cpp') diff --git a/Stars45/Mfd.cpp b/Stars45/Mfd.cpp index 377eabe..6dc4822 100644 --- a/Stars45/Mfd.cpp +++ b/Stars45/Mfd.cpp @@ -48,6 +48,7 @@ #include "Keyboard.h" #include "Mouse.h" #include "Game.h" +#include "ContentBundle.h" static Bitmap sensor_fov; static Bitmap sensor_fwd; @@ -326,12 +327,12 @@ MFD::DrawSensorLabels(const char* mfd_mode) int scan_y = rect.y; switch (sensor->GetMode()) { - 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; + case Sensor::PAS: strcpy_s(mode_buf, ContentBundle::GetInstance()->GetText("MFD.mode.passive").data()); break; + case Sensor::STD: strcpy_s(mode_buf, ContentBundle::GetInstance()->GetText("MFD.mode.standard").data()); break; + case Sensor::ACM: strcpy_s(mode_buf, ContentBundle::GetInstance()->GetText("MFD.mode.auto-combat").data()); break; + case Sensor::GM: strcpy_s(mode_buf, ContentBundle::GetInstance()->GetText("MFD.mode.ground").data()); break; + case Sensor::PST: strcpy_s(mode_buf, ContentBundle::GetInstance()->GetText("MFD.mode.passive").data()); break; + case Sensor::CST: strcpy_s(mode_buf, ContentBundle::GetInstance()->GetText("MFD.mode.combined").data()); break; default: break; } @@ -355,7 +356,7 @@ MFD::DrawSensorLabels(const char* mfd_mode) if (ship->GetProbeLauncher()) { char probes[32]; - sprintf_s(probes, "%s %02d", Game::GetInstance()->GetText("MFD.probe").data(), ship->GetProbeLauncher()->Ammo()); + sprintf_s(probes, "%s %02d", ContentBundle::GetInstance()->GetText("MFD.probe").data(), ship->GetProbeLauncher()->Ammo()); DrawMFDText(3, probes, probe_rect, DT_RIGHT); } else { @@ -411,7 +412,7 @@ MFD::DrawSensorMFD() Sensor* sensor = ship->GetSensor(); if (!sensor) { - DrawMFDText(0, Game::GetInstance()->GetText("MFD.inactive").data(), rect, DT_CENTER); + DrawMFDText(0, ContentBundle::GetInstance()->GetText("MFD.inactive").data(), rect, DT_CENTER); return; } @@ -596,7 +597,7 @@ MFD::DrawSensorMFD() } } - DrawSensorLabels(Game::GetInstance()->GetText("MFD.mode.field-of-view").data()); + DrawSensorLabels(ContentBundle::GetInstance()->GetText("MFD.mode.field-of-view").data()); } // +--------------------------------------------------------------------+ @@ -619,7 +620,7 @@ MFD::DrawHSD() Sensor* sensor = ship->GetSensor(); if (!sensor) { - DrawMFDText(0, Game::GetInstance()->GetText("MFD.inactive").data(), rect, DT_CENTER); + DrawMFDText(0, ContentBundle::GetInstance()->GetText("MFD.inactive").data(), rect, DT_CENTER); return; } @@ -820,7 +821,7 @@ MFD::DrawHSD() } } - DrawSensorLabels(Game::GetInstance()->GetText("MFD.mode.horizontal").data()); + DrawSensorLabels(ContentBundle::GetInstance()->GetText("MFD.mode.horizontal").data()); } // +--------------------------------------------------------------------+ @@ -843,7 +844,7 @@ MFD::Draw3D() Sensor* sensor = ship->GetSensor(); if (!sensor) { - DrawMFDText(0, Game::GetInstance()->GetText("MFD.inactive").data(), rect, DT_CENTER); + DrawMFDText(0, ContentBundle::GetInstance()->GetText("MFD.inactive").data(), rect, DT_CENTER); return; } @@ -1036,7 +1037,7 @@ MFD::Draw3D() } } - DrawSensorLabels(Game::GetInstance()->GetText("MFD.mode.3D").data()); + DrawSensorLabels(ContentBundle::GetInstance()->GetText("MFD.mode.3D").data()); } // +--------------------------------------------------------------------+ @@ -1047,7 +1048,7 @@ void MFD::DrawMap() { Rect text_rect(rect.x, rect.y, rect.w, 12); - DrawMFDText(0, Game::GetInstance()->GetText("MFD.mode.ground").data(), text_rect, DT_CENTER); + DrawMFDText(0, ContentBundle::GetInstance()->GetText("MFD.mode.ground").data(), text_rect, DT_CENTER); } // +--------------------------------------------------------------------+ @@ -1134,15 +1135,15 @@ MFD::DrawGameMFD() if (ship) { switch (ship->GetFlightPhase()) { - 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; + case Ship::DOCKED: DrawMFDText(t++, ContentBundle::GetInstance()->GetText("MFD.phase.DOCKED").data(), txt_rect, DT_LEFT); break; + case Ship::ALERT: DrawMFDText(t++, ContentBundle::GetInstance()->GetText("MFD.phase.ALERT").data(), txt_rect, DT_LEFT); break; + case Ship::LOCKED: DrawMFDText(t++, ContentBundle::GetInstance()->GetText("MFD.phase.LOCKED").data(), txt_rect, DT_LEFT); break; + case Ship::LAUNCH: DrawMFDText(t++, ContentBundle::GetInstance()->GetText("MFD.phase.LAUNCH").data(), txt_rect, DT_LEFT); break; + case Ship::TAKEOFF: DrawMFDText(t++, ContentBundle::GetInstance()->GetText("MFD.phase.TAKEOFF").data(), txt_rect, DT_LEFT); break; + case Ship::ACTIVE: DrawMFDText(t++, ContentBundle::GetInstance()->GetText("MFD.phase.ACTIVE").data(), txt_rect, DT_LEFT); break; + case Ship::APPROACH: DrawMFDText(t++, ContentBundle::GetInstance()->GetText("MFD.phase.APPROACH").data(), txt_rect, DT_LEFT); break; + case Ship::RECOVERY: DrawMFDText(t++, ContentBundle::GetInstance()->GetText("MFD.phase.RECOVERY").data(), txt_rect, DT_LEFT); break; + case Ship::DOCKING: DrawMFDText(t++, ContentBundle::GetInstance()->GetText("MFD.phase.DOCKING").data(), txt_rect, DT_LEFT); break; } } } @@ -1162,7 +1163,7 @@ MFD::DrawStatusMFD() Drive* drive = ship->GetDrive(); if (drive) { - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.THRUST").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::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 +1173,7 @@ MFD::DrawStatusMFD() if (ship->Reactors().size() > 0) { PowerSource* reactor = ship->Reactors()[0]; if (reactor) { - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.FUEL").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::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 +1183,7 @@ MFD::DrawStatusMFD() QuantumDrive* quantum_drive = ship->GetQuantumDrive(); if (quantum_drive) { - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.QUANTUM").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::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 +1198,7 @@ MFD::DrawStatusMFD() else if (hull > 33) hull_status = System::DEGRADED; - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.HULL").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::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 +1206,7 @@ MFD::DrawStatusMFD() Shield* shield = ship->GetShield(); if (shield) { - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.SHIELD").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::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 +1215,7 @@ MFD::DrawStatusMFD() Weapon* primary = ship->GetPrimary(); if (primary) { - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.GUNS").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::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 +1245,7 @@ MFD::DrawStatusMFD() if (ship->GetDecoy()) { char ammo[8]; sprintf_s(ammo, "%d", ship->GetDecoy()->Ammo()); - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.DECOY").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::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 +1255,7 @@ MFD::DrawStatusMFD() if (NetGame::GetInstance()) { char lives[8]; sprintf_s(lives, "%d", ship->RespawnCount() + 1); - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.LIVES").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::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 +1268,22 @@ MFD::DrawStatusMFD() Sensor* sensor = ship->GetSensor(); if (sensor) { if (ship->GetFlightPhase() != Ship::ACTIVE) { - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.SENSOR").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::GetInstance()->GetText("MFD.status.SENSOR").data(), status_rect, DT_LEFT); status_rect.x += 70; - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.OFFLINE").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::GetInstance()->GetText("MFD.status.OFFLINE").data(), status_rect, DT_LEFT); status_rect.x -= 70; status_rect.y += 10; } else { - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.EMCON").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::GetInstance()->GetText("MFD.status.EMCON").data(), status_rect, DT_LEFT); status_rect.x += 70; - sprintf_s(txt, "%s %d", Game::GetInstance()->GetText("MFD.status.MODE").data(), ship->GetEMCON()); + sprintf_s(txt, "%s %d", ContentBundle::GetInstance()->GetText("MFD.status.MODE").data(), ship->GetEMCON()); if (!sensor->IsPowerOn() || sensor->GetEnergy() == 0) { if (!Game::GetInstance()->Paused() && (Game::GetInstance()->RealTime()/1000) & 2) - strcpy_s(txt, Game::GetInstance()->GetText("MFD.status.SENSOR-OFF").data()); + strcpy_s(txt, ContentBundle::GetInstance()->GetText("MFD.status.SENSOR-OFF").data()); } DrawMFDText(row++, txt, status_rect, DT_LEFT); @@ -1293,7 +1294,7 @@ MFD::DrawStatusMFD() if (lines <= 7) return; - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.SYSTEMS").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::GetInstance()->GetText("MFD.status.SYSTEMS").data(), status_rect, DT_LEFT); status_rect.x += 70; DrawMFDText(row++, ship->GetDirectorInfo(), status_rect, DT_LEFT); @@ -1302,7 +1303,7 @@ MFD::DrawStatusMFD() sprintf_s(lives, "%d", ship->RespawnCount() + 1); status_rect.x -= 70; status_rect.y += 10; - DrawMFDText(row++, Game::GetInstance()->GetText("MFD.status.LIVES").data(), status_rect, DT_LEFT); + DrawMFDText(row++, ContentBundle::GetInstance()->GetText("MFD.status.LIVES").data(), status_rect, DT_LEFT); status_rect.x += 70; DrawMFDText(row++, lives, status_rect, DT_LEFT); } -- cgit v1.1