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>
210 lines
4.4 KiB
C++
210 lines
4.4 KiB
C++
#pragma once
|
|
|
|
#include "plug.h"
|
|
#include "table.h"
|
|
#include "resource.h"
|
|
#include "entityid.h"
|
|
#include "cmpnnt.h"
|
|
|
|
class Entity;
|
|
class NotationFile;
|
|
class Point3D;
|
|
|
|
//##############################################################################
|
|
//###################### Class ExplosionTableEntry ########################
|
|
//##############################################################################
|
|
|
|
class ExplosionTableEntry : public Plug
|
|
{
|
|
|
|
protected:
|
|
|
|
Scalar
|
|
damageLevel;
|
|
|
|
Enumeration
|
|
graphicState;
|
|
|
|
ResourceDescription::ResourceID
|
|
explosionResourceID;
|
|
|
|
Scalar
|
|
timeDelay;
|
|
|
|
public:
|
|
|
|
ExplosionTableEntry(MemoryStream *exp_stream);
|
|
~ExplosionTableEntry();
|
|
|
|
static Logical
|
|
CreateStreamedExplosion(
|
|
ResourceFile *resource_file,
|
|
CString exp_file_name,
|
|
NotationFile *exp_file,
|
|
CString exp_page_name,
|
|
MemoryStream *explosion_stream
|
|
);
|
|
|
|
ResourceDescription::ResourceID
|
|
GetExplosionResourceID() const
|
|
{Check(this); return explosionResourceID;}
|
|
|
|
Scalar
|
|
GetDamageLevel() const
|
|
{Check(this); return damageLevel;}
|
|
|
|
Enumeration
|
|
GetGraphicState() const
|
|
{Check(this); return graphicState;}
|
|
|
|
Scalar
|
|
GetTimeDelay() const
|
|
{Check(this); return timeDelay;}
|
|
|
|
void
|
|
CreateExplosion(
|
|
const EntityID &entity_hit_ID,
|
|
const EntityID &creating_entity_ID,
|
|
const Point3D &explode_position
|
|
);
|
|
};
|
|
|
|
//##############################################################################
|
|
//######################## Class ExplosionTable ###########################
|
|
//##############################################################################
|
|
|
|
// (Although sharing instance not fully implemented yet!)
|
|
// Note: Explosion tables specifically do not hold any references to any
|
|
// specific damage Zone as you will most likely be sharing instances of
|
|
// explosion tables across entity's, subsystem's, etc..
|
|
//
|
|
class ExplosionTable : public TableOf<ExplosionTableEntry*, int>
|
|
{
|
|
protected:
|
|
|
|
typedef
|
|
TableIteratorOf<ExplosionTableEntry*, int>
|
|
ExplosionTableIterator;
|
|
|
|
public:
|
|
|
|
ExplosionTable(MemoryStream *exp_stream);
|
|
~ExplosionTable();
|
|
|
|
ExplosionTableEntry*
|
|
SelectDamageLevelEntry(Scalar damage_level);
|
|
|
|
ExplosionTableEntry*
|
|
SelectGraphicStateEntry(Enumeration graphic_state);
|
|
|
|
void
|
|
DamageExplosion(
|
|
const EntityID &entity_hit_ID,
|
|
const EntityID &creating_entity_ID,
|
|
Scalar damage_level,
|
|
const Point3D &explode_position
|
|
)
|
|
{
|
|
Check(this);
|
|
ExplosionTableEntry *exp_entry = SelectDamageLevelEntry(damage_level);
|
|
if (exp_entry)
|
|
{
|
|
CreateExplosion(
|
|
exp_entry,
|
|
entity_hit_ID,
|
|
creating_entity_ID,
|
|
explode_position
|
|
);
|
|
}
|
|
#if DEBUG_LEVEL>0
|
|
else
|
|
{
|
|
Tell("DamageLevel = ");
|
|
Tell(damage_level);
|
|
Warn("not valid for ExplosionTable, no Explosion being created !\n");
|
|
}
|
|
#endif
|
|
}
|
|
|
|
void
|
|
CreateExplosion(
|
|
ExplosionTableEntry *explosion_entry,
|
|
const EntityID &entity_hit_ID,
|
|
const EntityID &creating_entity_ID,
|
|
Point3D explode_position // world coordinates
|
|
);
|
|
|
|
void
|
|
GraphicStateExplosion(
|
|
const EntityID &entity_hit_ID,
|
|
const EntityID &creating_entity_ID,
|
|
const Point3D &explode_position,
|
|
Enumeration graphic_state
|
|
)
|
|
{
|
|
Check(this);
|
|
ExplosionTableEntry *exp_entry = SelectGraphicStateEntry(graphic_state);
|
|
if (exp_entry)
|
|
{
|
|
CreateExplosion(
|
|
exp_entry,
|
|
entity_hit_ID,
|
|
creating_entity_ID,
|
|
explode_position
|
|
);
|
|
}
|
|
#if DEBUG_LEVEL>0
|
|
else
|
|
{
|
|
Tell("DamageZone::GraphicState = ");
|
|
Tell(graphic_state);
|
|
Warn("not valid for ExplosionTable, no Explosion being created !\n");
|
|
}
|
|
#endif
|
|
}
|
|
|
|
Logical
|
|
CrossedDamageLevelThreshold(Scalar old_value, Scalar new_value);
|
|
|
|
static Logical
|
|
CreateStreamedExplosionTable(
|
|
ResourceFile *resource_file,
|
|
CString model_name,
|
|
NotationFile *exp_file,
|
|
CString exp_filename,
|
|
MemoryStream *explosion_stream
|
|
);
|
|
};
|
|
|
|
//##########################################################################
|
|
//###################### EntityEffectWatcher #########################
|
|
//##########################################################################
|
|
|
|
class EntityEffectWatcher :
|
|
public Component
|
|
{
|
|
protected:
|
|
|
|
Scalar
|
|
*oldDamageLevel;
|
|
|
|
Entity
|
|
*entityWatched;
|
|
|
|
public:
|
|
|
|
EntityEffectWatcher(
|
|
Entity *entity_watched
|
|
);
|
|
|
|
~EntityEffectWatcher();
|
|
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
void
|
|
Execute();
|
|
|
|
};
|