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>
This commit is contained in:
@@ -0,0 +1,311 @@
|
||||
#pragma once
|
||||
|
||||
#include "cmpnnt.h"
|
||||
#include "slot.h"
|
||||
#include "memstrm.h"
|
||||
|
||||
class PlugStream;
|
||||
class Simulation;
|
||||
class Entity;
|
||||
|
||||
//##########################################################################
|
||||
//########################### AttributeWatcher #######################
|
||||
//##########################################################################
|
||||
|
||||
class AttributeWatcher:
|
||||
public Component
|
||||
{
|
||||
public:
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// Destructor
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
~AttributeWatcher();
|
||||
|
||||
Logical
|
||||
TestInstance() const;
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// DidAttributeChange
|
||||
//
|
||||
// Returns True if attribute has changed since the last time
|
||||
// DidAttributeChange was called.
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
Logical
|
||||
DidAttributeChange();
|
||||
|
||||
protected:
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// Constructor
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
AttributeWatcher(
|
||||
PlugStream *stream,
|
||||
Entity *entity
|
||||
);
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// SendNotificationOfChange
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
virtual void
|
||||
SendNotificationOfChange();
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// BuildFromPage
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
static void
|
||||
BuildFromPage(
|
||||
PlugStream *stream,
|
||||
NameList *name_list,
|
||||
ClassID class_ID,
|
||||
ObjectID object_ID
|
||||
);
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// Protected data
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
Simulation*
|
||||
simulation;
|
||||
void*
|
||||
attributePointer;
|
||||
Logical
|
||||
attributeChanged;
|
||||
Logical
|
||||
sendNotificationOnChange;
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
//########################### AttributeWatcherOf #####################
|
||||
//##########################################################################
|
||||
|
||||
template <class T> class AttributeWatcherOf:
|
||||
public AttributeWatcher
|
||||
{
|
||||
public:
|
||||
~AttributeWatcherOf();
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// Accessors
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
T
|
||||
GetCurrentValue()
|
||||
{return currentValue;}
|
||||
T*
|
||||
GetCurrentPointer()
|
||||
{return ¤tValue;}
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// Execute
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
void
|
||||
Execute();
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// PrimeWatcher
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
void
|
||||
PrimeWatcher();
|
||||
|
||||
protected:
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// Constructor
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
AttributeWatcherOf(
|
||||
PlugStream *stream,
|
||||
Entity *entity
|
||||
);
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// BuildFromPage
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
static void
|
||||
BuildFromPage(
|
||||
PlugStream *stream,
|
||||
NameList *name_list,
|
||||
ClassID class_ID,
|
||||
ObjectID object_ID
|
||||
);
|
||||
|
||||
private:
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// InitializeCurrentValue
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
void
|
||||
InitializeCurrentValue();
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// GrabCurrentValue
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
void
|
||||
GrabCurrentValue();
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// DumpValue
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
virtual void
|
||||
DumpValue(const T *attribute_ptr);
|
||||
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
// Private data
|
||||
//-----------------------------------------------------------------------
|
||||
//
|
||||
T
|
||||
currentValue;
|
||||
#if DEBUG_LEVEL>0
|
||||
Logical
|
||||
dumpValue;
|
||||
#endif
|
||||
};
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~ AttributeWatcherOf templates ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
template <class T>
|
||||
AttributeWatcherOf<T>::~AttributeWatcherOf()
|
||||
{
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
template <class T>
|
||||
AttributeWatcherOf<T>::AttributeWatcherOf(
|
||||
PlugStream *stream,
|
||||
Entity *entity
|
||||
):
|
||||
AttributeWatcher(stream, entity)
|
||||
{
|
||||
Check_Pointer(this);
|
||||
|
||||
Logical dump_value;
|
||||
|
||||
MemoryStream_Read(stream, &dump_value);
|
||||
|
||||
#if DEBUG_LEVEL>0
|
||||
dumpValue = dump_value;
|
||||
if (dumpValue)
|
||||
{
|
||||
Tell(
|
||||
"AttributeWatcherOf<T>::AttributeWatcherOf - " <<
|
||||
*(T*)attributePointer <<
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
InitializeCurrentValue();
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
template <class T> void
|
||||
AttributeWatcherOf<T>::BuildFromPage(
|
||||
PlugStream *stream,
|
||||
NameList *name_list,
|
||||
ClassID class_ID,
|
||||
ObjectID object_ID
|
||||
)
|
||||
{
|
||||
Check(stream);
|
||||
Check(name_list);
|
||||
|
||||
AttributeWatcher::BuildFromPage(stream, name_list, class_ID, object_ID);
|
||||
|
||||
//
|
||||
// Store dump_value
|
||||
//
|
||||
MEM_STRM_WRITE_ENTRY(*stream, name_list, Logical, dump_value);
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
template <class T> void
|
||||
AttributeWatcherOf<T>::PrimeWatcher()
|
||||
{
|
||||
Check(this);
|
||||
#if DEBUG_LEVEL>0
|
||||
if (dumpValue)
|
||||
{
|
||||
DumpValue((T*)attributePointer);
|
||||
}
|
||||
#endif
|
||||
GrabCurrentValue();
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
template <class T> void
|
||||
AttributeWatcherOf<T>::Execute()
|
||||
{
|
||||
Check(this);
|
||||
|
||||
Check_Pointer(attributePointer);
|
||||
if (!(currentValue == *(T*)attributePointer))
|
||||
{
|
||||
#if DEBUG_LEVEL>0
|
||||
if (dumpValue)
|
||||
{
|
||||
DumpValue((T*)attributePointer);
|
||||
}
|
||||
#endif
|
||||
GrabCurrentValue();
|
||||
}
|
||||
Check_Fpu();
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
template <class T> void
|
||||
AttributeWatcherOf<T>::InitializeCurrentValue()
|
||||
{
|
||||
Check_Pointer(attributePointer);
|
||||
currentValue = *(T*)attributePointer;
|
||||
Verify(currentValue == *(T*)attributePointer);
|
||||
Check_Fpu();
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
template <class T> void
|
||||
AttributeWatcherOf<T>::GrabCurrentValue()
|
||||
{
|
||||
InitializeCurrentValue();
|
||||
attributeChanged = True;
|
||||
if (sendNotificationOnChange)
|
||||
{
|
||||
SendNotificationOfChange();
|
||||
}
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
#if DEBUG_LEVEL>0
|
||||
template <class T> void
|
||||
AttributeWatcherOf<T>::DumpValue(const T *attribute_ptr)
|
||||
#else
|
||||
template <class T> void
|
||||
AttributeWatcherOf<T>::DumpValue(const T*)
|
||||
#endif
|
||||
{
|
||||
Check_Pointer(attribute_ptr);
|
||||
Tell((void *)attribute_ptr << " = " << *attribute_ptr << "\n");
|
||||
}
|
||||
Reference in New Issue
Block a user