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>
262 lines
5.3 KiB
C++
262 lines
5.3 KiB
C++
#pragma once
|
|
|
|
#include "chain.h"
|
|
|
|
// Classes Defined in this file
|
|
|
|
class Set;
|
|
class SetIterator;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
class Set : public Socket
|
|
{
|
|
|
|
friend class SetIterator;
|
|
|
|
public:
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
|
|
// Constructor
|
|
Set(Node *node);
|
|
|
|
~Set();
|
|
|
|
protected:
|
|
Set& operator=(const Set &rhs);
|
|
|
|
//STUBBED: UNKNOWN RB 1/15/07
|
|
//void
|
|
// AddImplementation(Plug *plug);
|
|
|
|
// Useful Set Operations
|
|
Logical operator==(const Set &rhs);
|
|
Set operator-(const Set &rhs) const;
|
|
Set Union(const Set &rhs) const;
|
|
Set Intersection(const Set &rhs) const;
|
|
|
|
// Set membership
|
|
Logical
|
|
Exists(const Plug &element) const;
|
|
|
|
private:
|
|
Chain *contents;
|
|
};
|
|
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SetOf ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
template <class T> class SetOf:
|
|
public Set
|
|
{
|
|
public:
|
|
SetOf(Node *node);
|
|
~SetOf();
|
|
|
|
protected:
|
|
SetOf(Set set):
|
|
Set(set)
|
|
{
|
|
}
|
|
|
|
public:
|
|
|
|
// Public interface
|
|
|
|
void
|
|
Add(T *plug)
|
|
{AddImplementation(plug);}
|
|
|
|
// Useful Set Operations
|
|
SetOf<T>&
|
|
operator=(const SetOf<T> &rhs)
|
|
{
|
|
if (this==&rhs) return *this;
|
|
Set::operator=(rhs);
|
|
return *this;
|
|
}
|
|
|
|
Logical
|
|
operator==(const SetOf<T> &rhs)
|
|
{return Set::operator==(rhs);}
|
|
|
|
|
|
SetOf<T>
|
|
operator-(const SetOf<T> rhs) const
|
|
{return (SetOf<T>) Set::operator-(rhs);}
|
|
|
|
SetOf<T>
|
|
Union(const SetOf<T> &rhs) const
|
|
{return (SetOf<T>) Set::Union(rhs);}
|
|
|
|
SetOf<T>
|
|
Intersection(const SetOf<T> &rhs) const
|
|
{return (SetOf<T>) Set::Intersection(rhs);}
|
|
|
|
|
|
};
|
|
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~ SetOf templates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
template <class T>
|
|
SetOf<T>::SetOf(Node *node):
|
|
Set(node)
|
|
{
|
|
}
|
|
|
|
template <class T>
|
|
SetOf<T>::~SetOf()
|
|
{
|
|
}
|
|
|
|
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~ SetIterator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
class SetIterator:
|
|
public ChainIterator
|
|
{
|
|
public:
|
|
friend class Set;
|
|
//
|
|
//--------------------------------------------------------------------
|
|
//--------------------------------------------------------------------
|
|
// Public interface
|
|
//--------------------------------------------------------------------
|
|
//--------------------------------------------------------------------
|
|
//
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Constructors, Destructor and testing
|
|
//--------------------------------------------------------------------
|
|
//
|
|
SetIterator(Set *set);
|
|
SetIterator(const SetIterator &iterator);
|
|
~SetIterator();
|
|
|
|
protected:
|
|
SetIterator(Chain *chain); // Used fot Set implementation to iterate on own contents
|
|
};
|
|
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~ SetIteratorOf ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
template <class T> class SetIteratorOf:
|
|
public SetIterator
|
|
{
|
|
public:
|
|
//
|
|
//--------------------------------------------------------------------
|
|
//--------------------------------------------------------------------
|
|
// Public interface
|
|
//--------------------------------------------------------------------
|
|
//--------------------------------------------------------------------
|
|
//
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Constructors and Destructor
|
|
//--------------------------------------------------------------------
|
|
//
|
|
SetIteratorOf(SetOf<T> *chain);
|
|
SetIteratorOf(SetOf<T> &chain);
|
|
SetIteratorOf(const SetIteratorOf<T> &iterator);
|
|
~SetIteratorOf();
|
|
|
|
//
|
|
//--------------------------------------------------------------------
|
|
// Iterator methods (see Iterator for full listing)
|
|
//--------------------------------------------------------------------
|
|
//
|
|
T*
|
|
ReadAndNext()
|
|
{return (T*)ReadAndNextImplementation();}
|
|
T*
|
|
ReadAndPrevious()
|
|
{return (T*)ReadAndPreviousImplementation();}
|
|
T*
|
|
GetCurrent()
|
|
{return (T*)GetCurrentImplementation();}
|
|
T*
|
|
GetNth(CollectionSize index)
|
|
{return (T*)GetNthImplementation(index);}
|
|
void
|
|
Insert(T *plug)
|
|
{InsertImplementation(plug);}
|
|
|
|
SetIteratorOf<T>&
|
|
Begin()
|
|
{return (SetIteratorOf<T>&)BeginImplementation();}
|
|
SetIteratorOf<T>&
|
|
End()
|
|
{return (SetIteratorOf<T>&)EndImplementation();}
|
|
SetIteratorOf<T>&
|
|
Forward()
|
|
{return (SetIteratorOf<T>&)ForwardImplementation();}
|
|
SetIteratorOf<T>&
|
|
Backward()
|
|
{return (SetIteratorOf<T>&)BackwardImplementation();}
|
|
|
|
//
|
|
//---------------------------------------------------
|
|
// Operators useful when it is know that the iterator
|
|
// is a SetOf<> Iterator
|
|
//---------------------------------------------------
|
|
//
|
|
#if 0
|
|
Logical
|
|
operator!()
|
|
{return currentLink == NULL;}
|
|
operator T*()
|
|
{return GetCurrent();}
|
|
T*
|
|
operator->()
|
|
{return GetCurrent();}
|
|
T&
|
|
operator*()
|
|
{return *GetCurrent();}
|
|
|
|
SetIteratorOf<T>&
|
|
operator++()
|
|
{Next(); return *this;}
|
|
SetIteratorOf<T>&
|
|
operator--()
|
|
{Previous(); return *this;}
|
|
T*
|
|
operator++(int)
|
|
{return ReadAndNext();}
|
|
T*
|
|
operator--(int)
|
|
{return ReadAndPrevious();}
|
|
#endif
|
|
};
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~ SetIteratorOf templates ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
template <class T>
|
|
SetIteratorOf<T>::SetIteratorOf(SetOf<T> *set):
|
|
SetIterator(chain)
|
|
{
|
|
}
|
|
|
|
template <class T>
|
|
SetIteratorOf<T>::SetIteratorOf(SetOf<T> &set):
|
|
SetIterator(&chain)
|
|
{
|
|
}
|
|
|
|
template <class T>
|
|
SetIteratorOf<T>::SetIteratorOf(const SetIteratorOf<T> &iterator):
|
|
SetIterator(iterator)
|
|
{
|
|
}
|
|
|
|
template <class T>
|
|
SetIteratorOf<T>::~SetIteratorOf()
|
|
{
|
|
}
|