Files
BT412/game/original/BT/MECHDMG.HPP
T
arcattackandClaude Opus 4.8 7b7d465e5e Initial commit: bt411 -- standalone Windows BattleTech (Tesla 4.10 port)
Clean, self-contained extraction of the BattleTech-specific work from the
reverse-engineering workspace -- engine + game + content + build, with nothing
from Red Planet or the raw archive dumps. Builds green (Win32) and runs the
single-player drive->animate->target->fire->damage->destroy loop out of the box.

Layout:
  engine/   MUNGA + MUNGA_L4 shared 2007 engine, carrying our BT render/loader
            work (bgfload/L4D3D/L4VIDEO: BSL bit-slice decode, LOD/ground/shadow
            models) + image codec; the minimal rp/ headers the audio HAL needs
  game/     reconstructed BT logic + surviving-original BT source + fwd shims
            + WinMain launcher
  content/  full runtime tree (BTL4.RES, VIDEO/, GAUGE/, AUDIO/, eggs, BTDPL.INI)
  docs/     format specs + reconstruction ledgers
  reference/ raw Ghidra pseudocode (recon source-of-truth) + decomp exporter
  tools/    MP console emulator + map/resource scanners

One top-level CMake builds munga_engine lib + bt410_l4 game lib + btl4.exe.
All paths relativized (186 fwd shims + ~437 CMake abs paths -> repo-relative);
DXSDK is the one external, overridable via -DDXSDK. Verified: builds to a
byte-identical 2.27MB exe and runs combat (TARGET DESTROYED, 0 crashes) against
the bundled content.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-05 21:03:40 -05:00

209 lines
4.7 KiB
C++

//==========================================================================//
// File: mechdmg.hpp //
// Project: BattleTech //
// Contents: Mech::DamageZone //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 06/05/95 JM Initial coding. //
//---------------------------------------------------------------------------//
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#if !defined(MECHDMG_HPP)
# define MECHDMG_HPP
# if !defined(DAMAGE_HPP)
# include <damage.hpp>
# endif
# if !defined(SLOT_HPP)
# include <slot.hpp>
# endif
# if !defined(TABLE_HPP)
# include <table.hpp>
# endif
# if !defined(ENTITYID_HPP)
# include <entityid.hpp>
# endif
class Mech;
class Subsystem;
class DamageZone;
//##########################################################################
//###################### MechCriticalSubsystem #################
//##########################################################################
class
MechCriticalSubsystem SIGNATURED
{
public:
MechCriticalSubsystem(DamageZone *owner);
virtual ~MechCriticalSubsystem();
SlotOf<Subsystem*>
subsystemPlug;
Scalar
damagePercentage, damagePercentageUsed;
Scalar
criticalWeight;
Logical
TestInstance() const;
};
//##########################################################################
//#################### Mech::DamageZone ###########################
//##########################################################################
class Mech__DamageZone :
public DamageZone
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// LOD Support
//
protected:
void
LODDamageRouter(EntityID inflicting, Damage damage);
int
RandomRedirect();
typedef PlugOf<int> IntegerPlug;
typedef TableOf<IntegerPlug*, int> DamageZoneIndexTable;
typedef TableIteratorOf<IntegerPlug*, int> DamageZoneIndexTableIterator;
// Zones which are artifacts have a table of their real children.
DamageZoneIndexTable redirectTable;
// The result of the last random redirect
int lastHitZone;
Scalar lastDamageTime;
EntityID lastInflicting;
//
// Zones which are real have a pointer (slot) back to their artifact parent.
// With the current art (1/30/96) no zone has both a parent and children,
// and many zones have neither.
SlotOf<Mech__DamageZone*> parentArtifactZone;
void
UpdateLODDamageLevel();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Descending Heirarchy when DamageZone Destroyed Support
//
void
ShortAttachedGenerators();
void
SendSubsystemDamage();
void
RecurseSegmentTable(Mech *my_mech);
int
segmentIndex;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Damage Support
//
public:
void
TakeDamage(Damage& damage);
Subsystem*
CriticalHit(Damage &damage_data);
protected:
Logical
vitalDamageZone;
Logical
descendOnDestruction;
Logical
destroySiblingsOnDestruction;
Logical
leftLeg;
Logical
rightLeg;
int
criticalSubsystemCount;
Scalar
criticalWeightSum;
MechCriticalSubsystem
**criticalSubsystems;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Graphic State Support
//
public:
void
SetGraphicState(Enumeration new_state);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Construction / Destruction
//
public:
static const int NullDamageZone;
Mech__DamageZone(
Mech *mech,
int damage_zone_index,
MemoryStream *stream
);
void SetLODParentPointers();
~Mech__DamageZone();
static Logical
CreateStreamedDamageZone(
ResourceFile *resource_file,
NotationFile *model_file,
const char *model_name,
NotationFile *skl_file,
const char *damage_zone_name,
NotationFile *dmg_file,
const ResourceDirectories *directories,
MemoryStream *damage_zone_stream
);
static int
GetSegmentIndex(
CString damage_zone_name,
NotationFile *skl_file
);
};
#endif