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>
144 lines
3.0 KiB
C++
144 lines
3.0 KiB
C++
#pragma once
|
|
|
|
#include "vdata.h"
|
|
#include "iterator.h"
|
|
#include "link.h"
|
|
|
|
class PlugStream;
|
|
|
|
typedef Enumeration NodeCommandID;
|
|
|
|
enum
|
|
{
|
|
NodeNullCommandID = 0,
|
|
NodeNextCommandID
|
|
};
|
|
|
|
class PlugIterator;
|
|
|
|
class Plug : public RegisteredClass
|
|
{
|
|
friend class Link;
|
|
friend class PlugIterator;
|
|
|
|
public:
|
|
~Plug();
|
|
Logical TestInstance() const;
|
|
|
|
protected:
|
|
Plug(ClassID class_id = TrivialPlugClassID);
|
|
Plug(PlugStream *stream);
|
|
|
|
private:
|
|
Link *linkHead;
|
|
};
|
|
|
|
template <class T> class PlugOf : public Plug
|
|
{
|
|
public:
|
|
PlugOf(const T &item);
|
|
~PlugOf();
|
|
|
|
operator T() const { return item; }
|
|
|
|
T GetItem() const { return item; }
|
|
T *GetPointer() { return &item; }
|
|
|
|
private:
|
|
T item;
|
|
};
|
|
|
|
template <class T> PlugOf<T>::PlugOf(const T &the_item)
|
|
{
|
|
item = the_item;
|
|
}
|
|
|
|
template <class T> PlugOf<T>::~PlugOf()
|
|
{
|
|
}
|
|
|
|
class PlugIterator : public Iterator
|
|
{
|
|
public:
|
|
PlugIterator(const Plug *plug, RegisteredClass::ClassID class_to_iterate = RegisteredClass::NullClassID);
|
|
PlugIterator(const PlugIterator &iterator);
|
|
~PlugIterator();
|
|
|
|
Logical TestInstance() const;
|
|
|
|
void First();
|
|
void Last();
|
|
void Next();
|
|
void Previous();
|
|
CollectionSize GetSize();
|
|
void Remove();
|
|
|
|
int SendNodeCommand(NodeCommandID node_command, void *info = NULL);
|
|
|
|
void RemoveSocket(Socket *socket);
|
|
|
|
protected:
|
|
void *ReadAndNextImplementation();
|
|
void *ReadAndPreviousImplementation();
|
|
void *GetCurrentImplementation();
|
|
void *GetNthImplementation(CollectionSize index);
|
|
|
|
protected:
|
|
const Plug *plug;
|
|
Link *currentLink;
|
|
|
|
private:
|
|
RegisteredClass::ClassID classToIterate;
|
|
|
|
void NextNode();
|
|
void PreviousNode();
|
|
};
|
|
|
|
template <class T> class PlugIteratorOf : public PlugIterator
|
|
{
|
|
public:
|
|
PlugIteratorOf(const Plug *plug, RegisteredClass::ClassID class_to_iterate=RegisteredClass::NullClassID);
|
|
PlugIteratorOf(const Plug &plug, RegisteredClass::ClassID class_to_iterate=RegisteredClass::NullClassID);
|
|
PlugIteratorOf(const PlugIteratorOf<T> &iterator);
|
|
|
|
~PlugIteratorOf();
|
|
|
|
T ReadAndNext() { return (T)ReadAndNextImplementation(); }
|
|
T ReadAndPrevious() { return (T)ReadAndPreviousImplementation(); }
|
|
T GetCurrent() { return (T)GetCurrentImplementation(); }
|
|
T GetNth(CollectionSize index) { return (T)GetNthImplementation(index); }
|
|
|
|
#if 0
|
|
Logical operator !() { return currentLink == NULL; }
|
|
operator T() { return GetCurrent(); }
|
|
T operator->() { return GetCurrent(); }
|
|
PlugIteratorOf<T>& operator++()
|
|
{
|
|
Next();
|
|
return *this;
|
|
}
|
|
PlugIteratorOf<T>& operator--()
|
|
{
|
|
Previous();
|
|
return *this;
|
|
}
|
|
T operator++(int) { return ReadAndNext(); }
|
|
T operator--(int) { return ReadAndPrevious(); }
|
|
#endif
|
|
};
|
|
|
|
template <class T> PlugIteratorOf<T>::PlugIteratorOf(const Plug *plug, RegisteredClass::ClassID class_to_iterate) : PlugIterator(plug, class_to_iterate)
|
|
{
|
|
}
|
|
|
|
template <class T> PlugIteratorOf<T>::PlugIteratorOf(const Plug &plug, RegisteredClass::ClassID class_to_iterate) : PlugIterator(&plug, class_to_iterate)
|
|
{
|
|
}
|
|
|
|
template <class T> PlugIteratorOf<T>::PlugIteratorOf(const PlugIteratorOf<T> &iterator) : PlugIterator(iterator)
|
|
{
|
|
}
|
|
|
|
template <class T> PlugIteratorOf<T>::~PlugIteratorOf()
|
|
{
|
|
} |