From 69209c38968c6f4066a772e0a51a2928749217de Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Fri, 9 Dec 2011 19:00:23 +0000 Subject: Re-indenting the code to use standard tabs. Yes, I know this is pretty pointless, but who cares? --- Stars45/Drone.cpp | 204 +++++++++++++++++++++++++++--------------------------- 1 file changed, 102 insertions(+), 102 deletions(-) (limited to 'Stars45/Drone.cpp') diff --git a/Stars45/Drone.cpp b/Stars45/Drone.cpp index 49b06fc..3087897 100644 --- a/Stars45/Drone.cpp +++ b/Stars45/Drone.cpp @@ -1,15 +1,15 @@ /* Project Starshatter 4.5 - Destroyer Studios LLC - Copyright © 1997-2004. All Rights Reserved. + Destroyer Studios LLC + Copyright © 1997-2004. All Rights Reserved. - SUBSYSTEM: Stars.exe - FILE: Drone.cpp - AUTHOR: John DiCamillo + SUBSYSTEM: Stars.exe + FILE: Drone.cpp + AUTHOR: John DiCamillo - OVERVIEW - ======== - Laser and Missile class + OVERVIEW + ======== + Laser and Missile class */ #include "MemDebug.h" @@ -31,17 +31,17 @@ // +--------------------------------------------------------------------+ Drone::Drone(const Point& pos, const Camera& shot_cam, WeaponDesign* dsn, const Ship* ship) - : Shot(pos, shot_cam, dsn, ship), - decoy_type(0), iff_code(0) +: Shot(pos, shot_cam, dsn, ship), +decoy_type(0), iff_code(0) { - obj_type = SimObject::SIM_DRONE; - - if (dsn) { - decoy_type = dsn->decoy_type; - probe = dsn->probe; - integrity = dsn->integrity; - sprintf(name, "Drone %04d", Identity()); - } + obj_type = SimObject::SIM_DRONE; + + if (dsn) { + decoy_type = dsn->decoy_type; + probe = dsn->probe; + integrity = dsn->integrity; + sprintf(name, "Drone %04d", Identity()); + } } // +--------------------------------------------------------------------+ @@ -55,8 +55,8 @@ Drone::~Drone() void Drone::SeekTarget(SimObject* target, System* sub) { - if (!probe) - Shot::SeekTarget(target, sub); + if (!probe) + Shot::SeekTarget(target, sub); } // +--------------------------------------------------------------------+ @@ -64,7 +64,7 @@ Drone::SeekTarget(SimObject* target, System* sub) void Drone::ExecFrame(double seconds) { - Shot::ExecFrame(seconds); + Shot::ExecFrame(seconds); } // +--------------------------------------------------------------------+ @@ -72,7 +72,7 @@ Drone::ExecFrame(double seconds) void Drone::Disarm() { - Shot::Disarm(); + Shot::Disarm(); } // +--------------------------------------------------------------------+ @@ -80,7 +80,7 @@ Drone::Disarm() void Drone::Destroy() { - Shot::Destroy(); + Shot::Destroy(); } // +--------------------------------------------------------------------+ @@ -88,19 +88,19 @@ Drone::Destroy() double Drone::PCS() const { - if (decoy_type == 0 && !probe) - return 10e3; + if (decoy_type == 0 && !probe) + return 10e3; - return 0; + return 0; } double Drone::ACS() const { - if (decoy_type == 0 && !probe) - return 1e3; + if (decoy_type == 0 && !probe) + return 1e3; - return 0; + return 0; } // +--------------------------------------------------------------------+ @@ -108,13 +108,13 @@ Drone::ACS() const const char* Drone::ClassName() const { - return Ship::ClassName(decoy_type); + return Ship::ClassName(decoy_type); } int Drone::Class() const { - return decoy_type; + return decoy_type; } // +--------------------------------------------------------------------+ @@ -122,75 +122,75 @@ Drone::Class() const int Drone::HitBy(Shot* shot, Point& impact) { - if (life == 0 || !shot->IsArmed()) return 0; - - const int HIT_NOTHING = 0; - const int HIT_HULL = 1; - - Point hull_impact; - int hit_type = HIT_NOTHING; - Point shot_loc = shot->Location(); - Point shot_org = shot->Origin(); - Point delta = shot_loc - Location(); - double dlen = delta.length(); - double dscale = 1; - float scale = design->explosion_scale; - Sim* sim = Sim::GetSim(); - - if (scale <= 0) - scale = design->scale; - - // MISSILE PROCESSING ------------------------------------------------ - - if (shot->IsMissile()) { - if (dlen < 10 * Radius()) { - hull_impact = impact = shot_loc; - sim->CreateExplosion(impact, Velocity(), Explosion::HULL_FLASH, 0.3f * scale, scale, region); - sim->CreateExplosion(impact, Point(), Explosion::SHOT_BLAST, 2.0f, scale, region); - hit_type = HIT_HULL; - } - } - - // ENERGY WEP PROCESSING --------------------------------------------- - - else { - if (shot->IsBeam()) { - // check right angle spherical distance: - Point d0 = Location() - shot_org; - Point w = shot_loc - shot_org; w.Normalize(); - Point test = shot_org + w * (d0 * w); - Point d1 = test - Location(); - double dlen = d1.length(); // distance of point from line - - if (dlen < 2*Radius()) { - hull_impact = impact = test; - shot->SetBeamPoints(shot_org, impact); - sim->CreateExplosion(impact, Velocity(), Explosion::BEAM_FLASH, 0.30f * scale, scale, region); - hit_type = HIT_HULL; - } - } - else if (dlen < 2*Radius()) { - hull_impact = impact = shot_loc; - sim->CreateExplosion(impact, Velocity(), Explosion::HULL_FLASH, 0.30f * scale, scale, region); - hit_type = HIT_HULL; - } - } - - // DAMAGE RESOLUTION ------------------------------------------------- - - if (hit_type != HIT_NOTHING) { - double effective_damage = shot->Damage() * dscale; - - if (shot->IsBeam()) { - effective_damage *= Game::FrameTime(); - } - else { - ApplyTorque(shot->Velocity() * (float) effective_damage * 1e-6f); - } - - if (effective_damage > 0) - Physical::InflictDamage(effective_damage); - } - - return hit_type; + if (life == 0 || !shot->IsArmed()) return 0; + + const int HIT_NOTHING = 0; + const int HIT_HULL = 1; + + Point hull_impact; + int hit_type = HIT_NOTHING; + Point shot_loc = shot->Location(); + Point shot_org = shot->Origin(); + Point delta = shot_loc - Location(); + double dlen = delta.length(); + double dscale = 1; + float scale = design->explosion_scale; + Sim* sim = Sim::GetSim(); + + if (scale <= 0) + scale = design->scale; + + // MISSILE PROCESSING ------------------------------------------------ + + if (shot->IsMissile()) { + if (dlen < 10 * Radius()) { + hull_impact = impact = shot_loc; + sim->CreateExplosion(impact, Velocity(), Explosion::HULL_FLASH, 0.3f * scale, scale, region); + sim->CreateExplosion(impact, Point(), Explosion::SHOT_BLAST, 2.0f, scale, region); + hit_type = HIT_HULL; + } + } + + // ENERGY WEP PROCESSING --------------------------------------------- + + else { + if (shot->IsBeam()) { + // check right angle spherical distance: + Point d0 = Location() - shot_org; + Point w = shot_loc - shot_org; w.Normalize(); + Point test = shot_org + w * (d0 * w); + Point d1 = test - Location(); + double dlen = d1.length(); // distance of point from line + + if (dlen < 2*Radius()) { + hull_impact = impact = test; + shot->SetBeamPoints(shot_org, impact); + sim->CreateExplosion(impact, Velocity(), Explosion::BEAM_FLASH, 0.30f * scale, scale, region); + hit_type = HIT_HULL; + } + } + else if (dlen < 2*Radius()) { + hull_impact = impact = shot_loc; + sim->CreateExplosion(impact, Velocity(), Explosion::HULL_FLASH, 0.30f * scale, scale, region); + hit_type = HIT_HULL; + } + } + + // DAMAGE RESOLUTION ------------------------------------------------- + + if (hit_type != HIT_NOTHING) { + double effective_damage = shot->Damage() * dscale; + + if (shot->IsBeam()) { + effective_damage *= Game::FrameTime(); + } + else { + ApplyTorque(shot->Velocity() * (float) effective_damage * 1e-6f); + } + + if (effective_damage > 0) + Physical::InflictDamage(effective_damage); + } + + return hit_type; } -- cgit v1.1