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,144 @@
|
||||
#include "munga.h"
|
||||
#include "set.h"
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
// Set
|
||||
//#############################################################################
|
||||
//
|
||||
Set::Set(Node *node):
|
||||
Socket(node),
|
||||
contents(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
// ~Set
|
||||
//#############################################################################
|
||||
//
|
||||
Set::~Set()
|
||||
{
|
||||
SetReleaseNode(NULL);
|
||||
if (contents)
|
||||
{
|
||||
delete contents;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
// TestInstance
|
||||
//#############################################################################
|
||||
//
|
||||
Logical
|
||||
Set::TestInstance() const
|
||||
{
|
||||
Socket::TestInstance();
|
||||
Check(contents);
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
// Union
|
||||
//
|
||||
// Merge contents of this with rhs. Items that occur in either set are placed
|
||||
// in the resulting set, with no duplication. It is assumed that both operands
|
||||
// are proper sets, ie. they contain no duplicates.
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
Set
|
||||
Set::Union(const Set &) const
|
||||
{
|
||||
Check(this);
|
||||
|
||||
|
||||
Set result(NULL);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
// Intersection
|
||||
//
|
||||
// Merge contents of this with rhs. Items that occur in both sets are placed
|
||||
// only once in the resulting set. It is assumed that both operands are proper
|
||||
// sets, ie. they contain no duplicates.
|
||||
//
|
||||
// This implementation of set intersection is dumb and slow.
|
||||
//#############################################################################
|
||||
//
|
||||
|
||||
Set
|
||||
Set::Intersection(const Set &rhs) const
|
||||
{
|
||||
Check(this);
|
||||
Check(rhs);
|
||||
|
||||
// Contents iterator is a SetIterator and not a ChainIterator in order to
|
||||
// have access to the ChainIterator::ReadAndNextImplentation.
|
||||
// We circumvent encapsulation protections by declaring Set a friend of SetIterator
|
||||
// (which derives from ChainIterator). Set is not a friend of ChainIterator.
|
||||
|
||||
SetIterator contents_iterator(contents);
|
||||
|
||||
// Casting away const is safe since our local iterator is not going to insert or
|
||||
// remove items from rhs.
|
||||
SetIterator rhs_iterator((Set *) &rhs);
|
||||
Plug *lhs_plug;
|
||||
Plug *rhs_plug;
|
||||
Set result(NULL);
|
||||
|
||||
|
||||
while ((lhs_plug = Cast_Object(Plug *, contents_iterator.ReadAndNextImplementation())) != NULL)
|
||||
{
|
||||
while ((rhs_plug = Cast_Object(Plug *,rhs_iterator.ReadAndNextImplementation())) != NULL)
|
||||
{
|
||||
if (lhs_plug == rhs_plug)
|
||||
{
|
||||
result.AddImplementation(lhs_plug);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SetIterator ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
// SetIterator
|
||||
//#############################################################################
|
||||
//
|
||||
SetIterator::SetIterator(Set *set):
|
||||
ChainIterator(set->contents)
|
||||
{
|
||||
Check(set);
|
||||
}
|
||||
|
||||
SetIterator::SetIterator(const SetIterator &iterator):
|
||||
ChainIterator(Cast_Object(Chain*, (Cast_Object(Set *,iterator.socket)->contents)))
|
||||
{
|
||||
Check(&iterator);
|
||||
}
|
||||
|
||||
SetIterator::SetIterator(Chain *chain):
|
||||
ChainIterator(chain)
|
||||
{
|
||||
Check(chain);
|
||||
}
|
||||
|
||||
SetIterator::~SetIterator()
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user