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>
120 lines
3.3 KiB
C++
120 lines
3.3 KiB
C++
//===========================================================================//
|
|
// 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;
|
|
}
|