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/Starshatter.cpp | 62 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'Stars45/Starshatter.cpp') diff --git a/Stars45/Starshatter.cpp b/Stars45/Starshatter.cpp index 29f44c7..59ad3fd 100644 --- a/Stars45/Starshatter.cpp +++ b/Stars45/Starshatter.cpp @@ -456,7 +456,7 @@ Starshatter::InitGame() SetupSplash(); } - time_mark = Game::GameTime(); + time_mark = Game::GetInstance()->GameTime(); minutes = 0; return true; @@ -567,7 +567,7 @@ Starshatter::OpenTacticalReference() LoadDlg* load_dlg = menuscreen->GetLoadDlg(); if (load_dlg && load_dlg->IsShown()) { - load_activity = Game::GetText("Starshatter.load.tac-ref"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.tac-ref"); load_progress = 1; catalog_index = 0; } @@ -608,14 +608,14 @@ Starshatter::SetGameMode(int m) if (m == CLOD_MODE || m == PREP_MODE || m == LOAD_MODE) { load_step = 0; load_progress = 0; - load_activity = Game::GetText("Starshatter.load.general"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.general"); paused = true; } else if (m == CMPN_MODE) { load_step = 0; load_progress = 100; - load_activity = Game::GetText("Starshatter.load.complete"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.complete"); paused = false; } @@ -624,7 +624,7 @@ Starshatter::SetGameMode(int m) player_ship = 0; load_progress = 100; - load_activity = Game::GetText("Starshatter.load.complete"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.complete"); if (!world) { CreateWorld(); @@ -1107,7 +1107,7 @@ Starshatter::GameState() } if (game_mode == EXIT_MODE) { - exit_time -= Game::GUITime(); + exit_time -= Game::GetInstance()->GUITime(); if (exit_time <= 0) Game::Exit(); @@ -1133,7 +1133,7 @@ Starshatter::DoMenuScreenFrame() } if (time_til_change > 0) - time_til_change -= Game::GUITime(); + time_til_change -= Game::GetInstance()->GUITime(); if (!menuscreen) return; @@ -1159,7 +1159,7 @@ Starshatter::DoMenuScreenFrame() // load all ship designs in the standard catalog if (catalog_index < ShipDesign::StandardCatalogSize()) { ShipDesign::PreloadCatalog(catalog_index++); - load_activity = Game::GetText("Starshatter.load.tac-ref"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.tac-ref"); if (load_progress < 95) load_progress++; @@ -1195,7 +1195,7 @@ Starshatter::DoPlanScreenFrame() Mouse::SetCursor(Mouse::ARROW); if (time_til_change > 0) - time_til_change -= Game::GUITime(); + time_til_change -= Game::GetInstance()->GUITime(); if (KeyDown(KEY_EXIT)) { if (time_til_change <= 0) { @@ -1228,7 +1228,7 @@ Starshatter::DoCmpnScreenFrame() Mouse::SetCursor(Mouse::ARROW); if (time_til_change > 0) - time_til_change -= Game::GUITime(); + time_til_change -= Game::GetInstance()->GUITime(); exit_latch = KeyDown(KEY_EXIT) ? true : false; @@ -1313,7 +1313,7 @@ Starshatter::DoLoadScreenFrame() switch (load_step) { case 0: - load_activity = Game::GetText("Starshatter.load.campaign"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.campaign"); load_progress = 1; catalog_index = 0; break; @@ -1322,7 +1322,7 @@ Starshatter::DoLoadScreenFrame() // load all ship designs in the standard catalog if (catalog_index < ShipDesign::StandardCatalogSize()) { ShipDesign::PreloadCatalog(catalog_index++); - load_activity = Game::GetText("Starshatter.load.campaign"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.campaign"); if (load_progress < 80) load_progress++; @@ -1330,7 +1330,7 @@ Starshatter::DoLoadScreenFrame() load_step = 0; // force return to current step on next frame } else { - load_activity = Game::GetText("Starshatter.load.start"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.start"); load_progress = 80; } break; @@ -1345,7 +1345,7 @@ Starshatter::DoLoadScreenFrame() load_progress++; } else { - load_activity = Game::GetText("Starshatter.load.ready"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.ready"); load_progress = 100; SetGameMode(CMPN_MODE); } @@ -1355,40 +1355,40 @@ Starshatter::DoLoadScreenFrame() else { switch (load_step) { case 0: - load_activity = Game::GetText("Starshatter.load.drives"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.drives"); load_progress = 0; break; case 1: Drive::Initialize(); LandingGear::Initialize(); - load_activity = Game::GetText("Starshatter.load.explosions"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.explosions"); load_progress = 5; break; case 2: Explosion::Initialize(); - load_activity = Game::GetText("Starshatter.load.systems"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.systems"); load_progress = 10; break; case 3: FlightDeck::Initialize(); NavLight::Initialize(); - load_activity = Game::GetText("Starshatter.load.ships"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.ships"); load_progress = 15; break; case 4: Ship::Initialize(); Shot::Initialize(); - load_activity = Game::GetText("Starshatter.load.hud"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.hud"); load_progress = 20; break; case 5: MFD::Initialize(); - load_activity = Game::GetText("Starshatter.load.menus"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.menus"); load_progress = 25; break; @@ -1400,7 +1400,7 @@ Starshatter::DoLoadScreenFrame() if (!gamescreen && game_mode != PREP_MODE) SetupGameScreen(); - load_activity = Game::GetText("Starshatter.load.mission"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.mission"); load_progress = 65; break; @@ -1409,26 +1409,26 @@ Starshatter::DoLoadScreenFrame() if (Campaign::GetCampaign()) Campaign::GetCampaign()->GetMission(); SetGameMode(PLAN_MODE); - load_activity = Game::GetText("Starshatter.load.loaded"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.loaded"); load_progress = 100; Button::PlaySound(4); } else { CreateWorld(); - load_activity = Game::GetText("Starshatter.load.simulation"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.simulation"); load_progress = 75; } break; case 8: InstantiateMission(); - load_activity = Game::GetText("Starshatter.load.viewscreen"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.viewscreen"); load_progress = 90; break; default: SetGameMode(PLAY_MODE); - load_activity = Game::GetText("Starshatter.load.ready"); + load_activity = Game::GetInstance()->GetText("Starshatter.load.ready"); load_progress = 100; break; } @@ -1522,7 +1522,7 @@ Starshatter::DoGameScreenFrame() } if (time_til_change > 0) - time_til_change -= Game::GUITime(); + time_til_change -= Game::GetInstance()->GUITime(); if (exit_latch && !KeyDown(KEY_EXIT)) exit_latch = false; @@ -1590,8 +1590,8 @@ Starshatter::DoGameScreenFrame() gamescreen->FrameRate(frame_rate); gamescreen->ExecFrame(); - if (Game::GameTime() - time_mark > 60000) { - time_mark = Game::GameTime(); + if (Game::GetInstance()->GameTime() - time_mark > 60000) { + time_mark = Game::GetInstance()->GameTime(); minutes++; if (minutes > 60) Print(" TIME %2d:%02d:00\n", minutes/60, minutes%60); @@ -1847,7 +1847,7 @@ Starshatter::DoGameKeys() } if (cam_dir) { - double spin = (PI/2) * Game::FrameTime(); // Game::GUITime(); + double spin = (PI/2) * Game::GetInstance()->FrameTime(); // Game::GetInstance()->GUITime(); if (KeyDown(KEY_CAM_EXT_PLUS_AZ)) cam_dir->ExternalAzimuth(spin); @@ -1875,13 +1875,13 @@ Starshatter::DoGameKeys() if (KeyDown(KEY_CAM_EXT_PLUS_RANGE)){ if (!gamescreen->IsNavShown()) { - cam_dir->ExternalRange((float) (1 + 1.5 * Game::FrameTime())); // 1.1f); + cam_dir->ExternalRange((float) (1 + 1.5 * Game::GetInstance()->FrameTime())); // 1.1f); } } else if (KeyDown(KEY_CAM_EXT_MINUS_RANGE)) { if (!gamescreen->IsNavShown()) { - cam_dir->ExternalRange((float) (1 - 1.5 * Game::FrameTime())); // 0.9f); + cam_dir->ExternalRange((float) (1 - 1.5 * Game::GetInstance()->FrameTime())); // 0.9f); } } -- cgit v1.1