diff options
Diffstat (limited to 'Stars45/Ship.cpp')
-rw-r--r-- | Stars45/Ship.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/Stars45/Ship.cpp b/Stars45/Ship.cpp index 12b9b7c..89b582f 100644 --- a/Stars45/Ship.cpp +++ b/Stars45/Ship.cpp @@ -73,6 +73,7 @@ #include "Joystick.h" #include "Bolt.h" #include "Game.h" +#include "Clock.h" #include "ContentBundle.h" #include "Solid.h" #include "Shadow.h" @@ -1043,7 +1044,7 @@ Ship::ClearTrack() track[0] = Location(); ntrack = 1; - track_time = Game::GetInstance()->GetClock()->GameTime(); + track_time = Clock::GetInstance()->GameTime(); } void @@ -1052,7 +1053,7 @@ Ship::UpdateTrack() const int DEFAULT_TRACK_UPDATE = 500; // milliseconds const int DEFAULT_TRACK_LENGTH = 20; // 10 seconds - DWORD time = Game::GetInstance()->GetClock()->GameTime(); + DWORD time = Clock::GetInstance()->GameTime(); if (!track) { track = new(__FILE__,__LINE__) Point[DEFAULT_TRACK_LENGTH]; @@ -1323,7 +1324,7 @@ void Ship::SetFlightPhase(OP_MODE phase) { if (phase == ACTIVE && !launch_time) { - launch_time = Game::GetInstance()->GetClock()->GameTime() + 1; + launch_time = Clock::GetInstance()->GameTime() + 1; dock = 0; if (element) @@ -1643,8 +1644,8 @@ Ship::HitBy(Shot* shot, Point& impact) RadioMessage* warn = new(__FILE__,__LINE__) RadioMessage(s, this, RadioMessage::DECLARE_ROGUE); RadioTraffic::Transmit(warn); } - else if (!s->IsRogue() && (Game::GetInstance()->GetClock()->GameTime() - ff_warn_time) > 5000) { - ff_warn_time = Game::GetInstance()->GetClock()->GameTime(); + else if (!s->IsRogue() && (Clock::GetInstance()->GameTime() - ff_warn_time) > 5000) { + ff_warn_time = Clock::GetInstance()->GameTime(); RadioMessage* warn = 0; if (s->GetTarget() == this) @@ -1956,7 +1957,7 @@ Ship::CheckFriendlyFire() return; // only check once each second - if (Game::GetInstance()->GetClock()->GameTime() - friendly_fire_time < 1000) + if (Clock::GetInstance()->GameTime() - friendly_fire_time < 1000) return; List<Weapon> w_list; @@ -2013,7 +2014,7 @@ Ship::CheckFriendlyFire() } } - friendly_fire_time = Game::GetInstance()->GetClock()->GameTime() + (DWORD) Random(0, 500); + friendly_fire_time = Clock::GetInstance()->GameTime() + (DWORD) Random(0, 500); } // +----------------------------------------------------------------------+ @@ -2613,10 +2614,10 @@ Ship::ExecEvalFrame(double seconds) static DWORD last_eval_frame = 0; // one ship per game frame if (element && element->NumObjectives() > 0 && - Game::GetInstance()->GetClock()->GameTime() - last_eval_time > EVAL_FREQUENCY && + Clock::GetInstance()->GameTime() - last_eval_time > EVAL_FREQUENCY && last_eval_frame != Game::GetInstance()->Frame()) { - last_eval_time = Game::GetInstance()->GetClock()->GameTime(); + last_eval_time = Clock::GetInstance()->GameTime(); last_eval_frame = Game::GetInstance()->Frame(); for (int i = 0; i < element->NumObjectives(); i++) { @@ -3027,7 +3028,7 @@ Ship::StatFrame(double seconds) { if (flight_phase != ACTIVE) { flight_phase = ACTIVE; - launch_time = Game::GetInstance()->GetClock()->GameTime() + 1; + launch_time = Clock::GetInstance()->GameTime() + 1; if (element) element->SetLaunchTime(launch_time); @@ -3585,7 +3586,7 @@ Ship::TimeSkip() { if (CanTimeSkip()) { // go back to regular time before performing the skip: - Game::GetInstance()->GetClock()->SetTimeCompression(1.0); + Clock::GetInstance()->SetTimeCompression(1.0); transition_time = 7.5f; transition_type = TRANSITION_TIME_SKIP; @@ -4516,26 +4517,26 @@ Ship::InflictDamage(double damage, Shot* shot, int hit_type, Point impact) if (shot) { if (shot->IsBeam()) { if (design->beam_hit_sound_resource) { - if (Game::GetInstance()->GetClock()->RealTime() - last_beam_time > 400) { + if (Clock::GetInstance()->RealTime() - last_beam_time > 400) { Sound* s = design->beam_hit_sound_resource->Duplicate(); s->SetLocation(impact); s->SetVolume(AudioConfig::EfxVolume()); s->Play(); - last_beam_time = Game::GetInstance()->GetClock()->RealTime(); + last_beam_time = Clock::GetInstance()->RealTime(); } } } else { if (design->bolt_hit_sound_resource) { - if (Game::GetInstance()->GetClock()->RealTime() - last_bolt_time > 400) { + if (Clock::GetInstance()->RealTime() - last_bolt_time > 400) { Sound* s = design->bolt_hit_sound_resource->Duplicate(); s->SetLocation(impact); s->SetVolume(AudioConfig::EfxVolume()); s->Play(); - last_bolt_time = Game::GetInstance()->GetClock()->RealTime(); + last_bolt_time = Clock::GetInstance()->RealTime(); } } } @@ -4814,10 +4815,10 @@ Ship::ExecMaintFrame(double seconds) static DWORD last_repair_frame = 0; // one ship per game frame if (auto_repair && - Game::GetInstance()->GetClock()->GameTime() - last_repair_time > REPAIR_FREQUENCY && + Clock::GetInstance()->GameTime() - last_repair_time > REPAIR_FREQUENCY && last_repair_frame != Game::GetInstance()->Frame()) { - last_repair_time = Game::GetInstance()->GetClock()->GameTime(); + last_repair_time = Clock::GetInstance()->GameTime(); last_repair_frame = Game::GetInstance()->Frame(); ListIter<System> iter = systems; @@ -5199,7 +5200,7 @@ DWORD Ship::MissionClock() const { if (launch_time > 0) - return Game::GetInstance()->GetClock()->GameTime() + 1 - launch_time; + return Clock::GetInstance()->GameTime() + 1 - launch_time; return 0; } |