Mech phase 2: reconstruct MechWeapon base (weapon subtree root)

MechWeapon : PoweredSubsystem -- base of all weapons. Ctor chains PoweredSubsystem
+ copies resource (recharge/range/damage/heatCost) into members + damageData.
FireWeapon is the virtual abstract stub (Fail 'should not be here'; PPC/Gauss/
MissileLauncher override it); SendDamage + CreateStreamedSubsystem staged.
BT: 32 ok.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Cyd
2026-07-20 00:15:31 -05:00
co-authored by Claude Fable 5
parent 52cdf75348
commit 9df4176956
+119
View File
@@ -0,0 +1,119 @@
//===========================================================================//
// File: mechweap.cpp //
// Project: BattleTech Brick: Mech weapons //
// Contents: MechWeapon -- the base weapon subsystem //
//---------------------------------------------------------------------------//
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include <bt.hpp>
#pragma hdrstop
#if !defined(MECHWEAP_HPP)
# include <mechweap.hpp>
#endif
#if !defined(MECH_HPP)
# include <mech.hpp>
#endif
Derivation
MechWeapon::ClassDerivations(
PoweredSubsystem::ClassDerivations,
"MechWeapon"
);
MechWeapon::SharedData
MechWeapon::DefaultData(
MechWeapon::ClassDerivations,
Subsystem::MessageHandlers,
Subsystem::AttributeIndex,
Subsystem::StateCount
);
MechWeapon::MechWeapon(
Mech *owner,
int subsystem_ID,
SubsystemResource *subsystem_resource,
SharedData &shared_data
):
PoweredSubsystem(owner, subsystem_ID, subsystem_resource, shared_data)
{
Check(owner);
Check_Pointer(subsystem_resource);
rechargeRate = subsystem_resource->rechargeRate;
weaponRange = subsystem_resource->weaponRange;
damageAmount = subsystem_resource->damageAmount;
damageType = subsystem_resource->damageType;
heatCostToFire = subsystem_resource->heatCostToFire;
targetWithinRange = False;
damageData.damageType = damageType;
damageData.damageAmount = damageAmount;
Check_Fpu();
}
MechWeapon::~MechWeapon()
{
}
Logical
MechWeapon::TestClass(Mech &)
{
return True;
}
Logical
MechWeapon::TestInstance() const
{
return IsDerivedFrom(ClassDerivations);
}
//
//#############################################################################
// FireWeapon Abstract -- each concrete weapon (Emitter/PPC, ProjectileWeapon/
// Gauss/MissileLauncher) overrides this. Reaching the base is a bug.
//#############################################################################
//
void
MechWeapon::FireWeapon()
{
Fail("MechWeapon::FireWeapon -- should not be here (abstract)");
}
//
//#############################################################################
// SendDamage Deliver this weapon's damage to a struck entity. The damage/
// networking path is not yet reconstructed.
//#############################################################################
//
void
MechWeapon::SendDamage(Entity *, Damage &)
{
Fail("MechWeapon::SendDamage -- mechweap.cpp not yet reconstructed");
}
//
//#############################################################################
// CreateStreamedSubsystem Model-load-time construction. Not yet reconstructed.
//#############################################################################
//
int
MechWeapon::CreateStreamedSubsystem(
ResourceFile *,
NotationFile *,
const char *,
const char *,
SubsystemResource *,
NotationFile *,
const ResourceDirectories *,
int
)
{
Fail("MechWeapon::CreateStreamedSubsystem -- mechweap.cpp not yet reconstructed");
return 0;
}