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>
164 lines
4.9 KiB
C++
164 lines
4.9 KiB
C++
#pragma once
|
|
|
|
#include "host.h"
|
|
#include "objstrm.h"
|
|
#include "entity.h"
|
|
#include "entityid.h"
|
|
#include "resource.h"
|
|
|
|
//##########################################################################
|
|
//############################ Registry ##############################
|
|
//##########################################################################
|
|
|
|
class Player;
|
|
class Registry__MakeEntityMessage;
|
|
class Entity;
|
|
class Entity__MakeMessage;
|
|
class Entity__SharedData;
|
|
|
|
class Registry : public Receiver
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction, Destruction, and Testing
|
|
//
|
|
public:
|
|
Registry(ClassID class_ID, SharedData &shared_data);
|
|
Registry();
|
|
~Registry();
|
|
|
|
Logical TestInstance() const;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Entity creation
|
|
//
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// MakeEntity
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
Entity* MakeEntity(Entity__MakeMessage *message);
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// MakeTransferedEntity
|
|
//
|
|
// The registry creates an entity on this machine which
|
|
// represents the transfer of ownership from the old host to this
|
|
// host.
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
Entity* MakeTransferedEntity(HostID old_entity_host, EntityID old_entity_ID, void *old_entity_state_data);
|
|
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// MakeEntityReplacement
|
|
//
|
|
// If a host abnormally terminates there may be replicants
|
|
// hanging unattended by updates. The host manager attempts
|
|
// to create a replacement for the lost entity using the
|
|
// replicant as a recipe for the replacement.
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
Entity* MakeEntityReplacement(HostID old_entity_host, EntityID replicant_entity_ID);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Entity data access
|
|
//
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// GetStaticData
|
|
//
|
|
// Provides an interface by which the static data for a class
|
|
// may be accessed.
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
virtual Entity__SharedData* GetStaticData(ClassID entity_class);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Player creation
|
|
//
|
|
public:
|
|
//
|
|
//-----------------------------------------------------------------------
|
|
// Create the player object
|
|
//-----------------------------------------------------------------------
|
|
//
|
|
virtual Player* MakePlayer(Mission *mission);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Message Support
|
|
//
|
|
public:
|
|
enum
|
|
{
|
|
MakeEntityMessageID = Receiver::NextMessageID,
|
|
NextMessageID
|
|
};
|
|
|
|
typedef Registry__MakeEntityMessage
|
|
MakeEntityMessage;
|
|
|
|
static const HandlerEntry MessageHandlerEntries[];
|
|
//static MessageHandlerSet MessageHandlers;
|
|
static MessageHandlerSet& GetMessageHandlers();
|
|
|
|
void
|
|
MakeEntityMessageHandler(MakeEntityMessage *message);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Shared Data Support
|
|
//
|
|
public:
|
|
static Derivation *GetClassDerivations();
|
|
static SharedData DefaultData;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Static object methods
|
|
//
|
|
public:
|
|
static ResourceDescription::ResourceID CreateStaticObjectStreamResource(NotationFile *notation_file, ResourceFile *resource_file);
|
|
|
|
void LoadStaticObjectStreamResource();
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~ Registry__MakeEntityMessage ~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
class Registry__MakeEntityMessage : public Receiver::Message
|
|
{
|
|
public:
|
|
Registry__MakeEntityMessage(size_t total_length);
|
|
|
|
static Registry__MakeEntityMessage* Make(Entity__MakeMessage *message);
|
|
};
|
|
|
|
//##########################################################################
|
|
//##################### RegistryObjectStream #########################
|
|
//##########################################################################
|
|
|
|
class RegistryObjectStream : public PlugStream
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction, Destruction and testing
|
|
//
|
|
public:
|
|
RegistryObjectStream();
|
|
RegistryObjectStream(ResourceDescription *resource_description);
|
|
~RegistryObjectStream();
|
|
|
|
Logical TestInstance() const;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Implementations
|
|
//
|
|
private:
|
|
RegisteredClass* MakeObjectImplementation(Enumeration class_ID);
|
|
|
|
void CreatedObjectImplementation(RegisteredClass *object, ObjectID object_ID);
|
|
|
|
void BuildFromPageImplementation(NameList *entry_list, Enumeration class_ID, ObjectID object_ID);
|
|
|
|
void BuiltFromPageImplementation(Enumeration class_ID, ObjectID object_ID, const CString &object_name_string);
|
|
};
|