//===========================================================================// // File: mislanch.cpp // // Project: BattleTech Brick: Mech weapons // // Contents: MissileLauncher -- a projectile weapon that fires missile salvos // //---------------------------------------------------------------------------// // Copyright (C) 1995, Virtual World Entertainment, Inc. // // All Rights reserved worldwide // // This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL // //===========================================================================// #include #pragma hdrstop #if !defined(MISLANCH_HPP) # include #endif #if !defined(MECH_HPP) # include #endif Derivation MissileLauncher::ClassDerivations( ProjectileWeapon::ClassDerivations, "MissileLauncher" ); MissileLauncher::SharedData MissileLauncher::DefaultData( MissileLauncher::ClassDerivations, Subsystem::MessageHandlers, Subsystem::AttributeIndex, Subsystem::StateCount ); MissileLauncher::MissileLauncher( Mech *owner, int subsystem_ID, SubsystemResource *subsystem_resource, SharedData &default_data ): ProjectileWeapon(owner, subsystem_ID, subsystem_resource, default_data) { Check(owner); Check_Pointer(subsystem_resource); missileCount = subsystem_resource->missileCount; // // A salvo delivers missileCount missiles; split the per-shot damage across // the salvo. (The per-missile launch mechanics live in FireWeapon, staged.) // if (missileCount > 0) { damageData.burstCount = missileCount; damageData.damageAmount = damageData.damageAmount / (Scalar)missileCount; } Check_Fpu(); } MissileLauncher::~MissileLauncher() { } Logical MissileLauncher::TestInstance() const { return IsDerivedFrom(ClassDerivations); } // //############################################################################# // Damage / death. //############################################################################# // void MissileLauncher::TakeDamage(Damage &damage) { Check(this); ProjectileWeapon::TakeDamage(damage); } void MissileLauncher::DeathReset(Logical /*full_reset*/) { Check(this); } // // The missile-salvo discharge. Not yet reconstructed. // void MissileLauncher::FireWeapon() { Check(this); // // PARTIAL (binary @004bcc60): the authentic body launches missileCount // Missile entities toward the owner's target (each carrying the salvo-split // damageData) and dumps the firing heat. The Missile entity spawn needs // the entity-spawn + targeting waves; the view/target gate, ammo pull and // recoil all live in the CALLER (ProjectileWeaponSimulation's Loaded case). // // Ballistic heatCostToFire is stored 1e7-unit-NATIVE in the stream (SRM6 // reads 5.06e7 = +641K on its own sink -- the same design magnitude as the // PPC's +632K); dump it raw. (The EMITTER's authored value is small and // its 1e7 comes from the energy algebra -- see EMITTER.CPP.) AddPendingHeat(heatCostToFire); if (getenv("BT_MECH_LOG")) { DEBUG_STREAM << "[fire] '" << GetName() << "' FIRED (salvo of " << missileCount << ", recharge=" << rechargeRate << "s heat+=" << heatCostToFire << ")" << endl << flush; } } // // Model-load-time construction. Not yet reconstructed. // Logical MissileLauncher::CreateStreamedSubsystem( ResourceFile *, NotationFile *, const char *, const char *, SubsystemResource *, NotationFile *, const ResourceDirectories *, int ) { Fail("MissileLauncher::CreateStreamedSubsystem -- mislanch.cpp not yet reconstructed"); return False; }