The reconstructed tree now produces a runnable binary with the authentic 1995 toolchain (BC4.52 / tlink32 / DPMI32): - BTL4.CPP main TU reconstructed from the 4.11 Ghidra decomp (FUN_0040109c) + the 4.10 binary's own string pool + surviving RPL4TOOL.CPP house style; probe_main.cpp scaffold retired (BTL4.NOTES.md documents every decoded call) - L4NET.CPP staged: L4NetworkManager ctor/dtor + 10 vtable-pulled virtuals (standalone-benign ones no-op, network ones Fail loudly) + NetNub client globals (Net_Common_Ptr=NULL routes L4File to its plain-DOS path) - build410.sh: libs now built in the AUTHENTIC makefile member order (MUNGA.MAK / mungal4.mak / BT.MAK / BTL4.MAK). Order is load-bearing: tlink emits static-init records in module pull order, and alphabetical order booted into a null-vptr crash (IcomManager::ClassDerivations constructing before parent NetworkClient::ClassDerivations). Also fixed stage_link to the proven 32-bit lib set (SOSDBXC+SOSMBXC, no WATTCPLG) - BOXTREE.HPP MemoryBlock unify, BTL4GRND notify stubs, remaining engine backfills (audio/gauge/resource/stream TUs) that closed the deep ledger Smoke test (DOSBox-X + 32RTM, copy of the pod BT tree, our exe swapped in): BattleTech v4.10 BTL4Application::BTL4Application l4net.cpp(22): L4NetworkManager -- l4net.cpp not yet reconstructed Static init, main, -egg parse, BTL4.RES load (version 1.0.6 check passes), ApplicationManager and the BTL4Application ctor chain all execute real reconstructed code; boot halts at the first staged Fail() as designed. Next brick: the real l4net.cpp body. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
217 lines
4.8 KiB
C++
217 lines
4.8 KiB
C++
#if !defined(BOXTREE_HPP)
|
|
# define BOXTREE_HPP
|
|
|
|
# if !defined(BNDGBOX_HPP)
|
|
# include <bndgbox.hpp>
|
|
# endif
|
|
# if !defined(MEMBLOCK_HPP)
|
|
# include <memblock.hpp>
|
|
# endif
|
|
|
|
//##########################################################################
|
|
//####################### BoundingBoxTreeNode ########################
|
|
//##########################################################################
|
|
|
|
class BoundingBoxTree;
|
|
|
|
class BoundingBoxTreeNode SIGNATURED
|
|
{
|
|
friend class BoundingBoxTree;
|
|
|
|
//##########################################################################
|
|
// Memory Allocation
|
|
//
|
|
private:
|
|
static MemoryBlock AllocatedMemory;
|
|
static MemoryBlock* GetAllocatedMemory() { return &AllocatedMemory; }
|
|
void* operator new(size_t) { return AllocatedMemory.New(); }
|
|
void operator delete(void *where) { AllocatedMemory.Delete(where); }
|
|
|
|
//##########################################################################
|
|
// Construction and Destruction
|
|
//
|
|
protected:
|
|
ExtentBox
|
|
nodeExtents;
|
|
BoundingBox
|
|
*staticContents;
|
|
BoundingBoxTreeNode
|
|
*nodeBranches[6],
|
|
*innerNode;
|
|
|
|
BoundingBoxTreeNode(
|
|
BoundingBox *volume,
|
|
const ExtentBox &extents
|
|
);
|
|
~BoundingBoxTreeNode();
|
|
|
|
void
|
|
Add(
|
|
BoundingBox *BoundingBox,
|
|
const ExtentBox &extents
|
|
);
|
|
void
|
|
Remove(
|
|
BoundingBox *BoundingBox,
|
|
const ExtentBox &extents
|
|
);
|
|
|
|
//##########################################################################
|
|
// Tree Traversal Functions
|
|
//
|
|
protected:
|
|
static int
|
|
TraversalOrder[6];
|
|
|
|
static void
|
|
SetTraversalOrder(
|
|
int first,
|
|
int second,
|
|
int third
|
|
);
|
|
|
|
public:
|
|
BoundingBoxTreeNode*
|
|
FindSmallestNodeContaining(
|
|
const ExtentBox &extents,
|
|
BoundingBoxTreeNode *parent
|
|
);
|
|
|
|
BoundingBoxTreeNode*
|
|
FindSmallestNodeContainingColumn(const ExtentBox &extents);
|
|
|
|
BoundingBox*
|
|
FindBoundingBoxContaining(
|
|
const Point3D &point,
|
|
BoundingBox *parent
|
|
);
|
|
|
|
void
|
|
FindBoundingBoxesContaining(
|
|
BoundingBox *volume,
|
|
const ExtentBox &slice,
|
|
BoundingBoxCollisionList &list
|
|
);
|
|
|
|
BoundingBox*
|
|
FindBoundingBoxUnder(
|
|
const Point3D &point,
|
|
Scalar *height
|
|
);
|
|
|
|
BoundingBox*
|
|
FindBoundingBoxHitBy(Line *line);
|
|
|
|
//##########################################################################
|
|
// Test Support
|
|
//
|
|
public:
|
|
Logical
|
|
TestInstance() const;
|
|
};
|
|
|
|
//##########################################################################
|
|
//######################## BoundingBoxTree ###########################
|
|
//##########################################################################
|
|
|
|
class BoundingBoxTree SIGNATURED
|
|
{
|
|
|
|
//##########################################################################
|
|
// Construction and Destruction
|
|
//
|
|
protected:
|
|
BoundingBoxTreeNode *root;
|
|
|
|
public:
|
|
BoundingBoxTree()
|
|
{Check_Pointer(this); root = NULL;}
|
|
~BoundingBoxTree()
|
|
{Check(this); EraseTree();}
|
|
|
|
static void
|
|
SetTraversalOrder(
|
|
int first,
|
|
int second,
|
|
int third
|
|
)
|
|
{BoundingBoxTreeNode::SetTraversalOrder(first, second, third);}
|
|
|
|
void
|
|
Add(
|
|
BoundingBox* volume,
|
|
const ExtentBox &extents
|
|
);
|
|
void
|
|
Remove(BoundingBox* volume)
|
|
{
|
|
Check(this); Check(volume); Check(root);
|
|
root->Remove(volume, *volume);
|
|
}
|
|
void
|
|
EraseTree();
|
|
|
|
//##########################################################################
|
|
// Tree Traversal Functions
|
|
//
|
|
public:
|
|
BoundingBox*
|
|
FindBoundingBoxContaining(const Point3D &point)
|
|
{
|
|
Check(this); Check(&point); Check(root);
|
|
return root->FindBoundingBoxContaining(point, NULL);
|
|
}
|
|
|
|
BoundingBoxTreeNode*
|
|
FindSmallestNodeContaining(const ExtentBox &extents)
|
|
{
|
|
Check(this); Check(&extents); Check(root);
|
|
return root->FindSmallestNodeContaining(extents, NULL);
|
|
}
|
|
|
|
void
|
|
FindBoundingBoxesContaining(
|
|
BoundingBox *volume,
|
|
BoundingBoxCollisionList &list
|
|
)
|
|
{
|
|
Check(this); Check(volume); Check(&list); Check(root);
|
|
root->FindBoundingBoxesContaining(
|
|
volume,
|
|
*volume,
|
|
list
|
|
);
|
|
}
|
|
|
|
BoundingBoxTreeNode*
|
|
FindSmallestNodeContainingColumn(const ExtentBox &extents)
|
|
{
|
|
Check(this); Check(&extents); Check(root);
|
|
Verify((BoundingBoxTreeNode::TraversalOrder[4]>>1) == Y_Axis);
|
|
return root->FindSmallestNodeContainingColumn(extents);
|
|
}
|
|
|
|
BoundingBox*
|
|
FindBoundingBoxUnder(
|
|
const Point3D &point,
|
|
Scalar *height
|
|
)
|
|
{
|
|
Check(this); Check(&point); Check(root); Check_Pointer(height);
|
|
Verify((BoundingBoxTreeNode::TraversalOrder[4]>>1) == Y_Axis);
|
|
return root->FindBoundingBoxUnder(point, height);
|
|
}
|
|
|
|
BoundingBox*
|
|
FindBoundingBoxHitBy(Line *line);
|
|
|
|
//##########################################################################
|
|
// Test Support
|
|
//
|
|
public:
|
|
Logical
|
|
TestInstance() const;
|
|
};
|
|
|
|
#endif
|