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>
570 lines
13 KiB
C++
570 lines
13 KiB
C++
#ifndef __VCSTRUCT_H
|
|
#define __VSTRUCT_H
|
|
struct VCAttribute {
|
|
ElementHandle type; /* The element handle */
|
|
InstanceNo ino;
|
|
VCEntity *first;
|
|
int index;
|
|
uint32 mode;
|
|
uint32 cacheMode;
|
|
uint32 registerMode;
|
|
void *instanceData;
|
|
uint32 instanceDataSize;
|
|
uint32 instanceDataCount;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
struct VCCollision
|
|
{
|
|
InstanceNo ino;
|
|
uint32 status;
|
|
uint32 instanceCount;
|
|
uint32 collReportCount;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
uint32 instanceDataSize;
|
|
uint32 instanceDataCount;
|
|
VCCollisionReportData *collReportData;
|
|
uint32 collReportDataSize;
|
|
uint32 collReportDataCount;
|
|
uint32 numCollisionsReported;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
struct VCIntersection
|
|
{
|
|
InstanceNo ino;
|
|
uint32 status;
|
|
uint32 instanceCount;
|
|
uint32 intersectReportCount;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
uint32 instanceDataSize;
|
|
uint32 instanceDataCount;
|
|
VCIntersectionReportData *intersectReportData;
|
|
uint32 intersectReportDataSize;
|
|
uint32 intersectReportDataCount;
|
|
uint32 numIntersectionsReported;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
struct VCPosition
|
|
{
|
|
InstanceNo ino;
|
|
VCEntity *entity;
|
|
uint32 status;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
struct VCXWindowId
|
|
{
|
|
InstanceNo ino;
|
|
uint32 status;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
uint32 instanceDataSize;
|
|
uint32 instanceDataCount;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
struct VCVisualViewResource
|
|
{
|
|
InstanceNo ino;
|
|
VCAttribute *attribute;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
|
|
struct VCPseudoGravity
|
|
{
|
|
InstanceNo ino;
|
|
uint32 status;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
struct VCMaterial
|
|
{
|
|
|
|
InstanceNo ino;
|
|
char *name;
|
|
uint32 status;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
uint32 instanceDataSize;
|
|
uint32 instanceDataCount;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
struct VCRadiator
|
|
{
|
|
|
|
InstanceNo ino;
|
|
char *name;
|
|
uint32 status;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
|
|
|
|
struct VCTexture
|
|
{
|
|
InstanceNo ino;
|
|
char *name;
|
|
uint32 status;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
uint32 instanceDataSize;
|
|
uint32 instanceDataCount;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
struct VCRamp
|
|
{
|
|
InstanceNo ino;
|
|
char *name;
|
|
uint32 status;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
uint32 instanceDataSize;
|
|
uint32 instanceDataCount;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
struct VCInput
|
|
{
|
|
InstanceNo ino;
|
|
uint32 status;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
uint32 instanceDataSize;
|
|
uint32 instanceDataCount;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
uint32 numWraps;
|
|
uint32 head;
|
|
};
|
|
|
|
struct VCTracker
|
|
{
|
|
InstanceNo ino;
|
|
char *name;
|
|
uint32 status;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
uint32 instanceDataSize;
|
|
uint32 instanceDataCount;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
struct VCSync
|
|
{
|
|
VCSync *next;
|
|
InstanceNo ino;
|
|
uint32 status;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
uint32 instanceDataSize;
|
|
uint32 instanceDataCount;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
struct VCMonitor
|
|
{
|
|
InstanceNo ino;
|
|
char *name;
|
|
uint32 status;
|
|
uint32 cacheMode;
|
|
void *instanceData;
|
|
uint32 instanceDataSize;
|
|
uint32 instanceDataCount;
|
|
VCUserDataList *userDataList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
};
|
|
|
|
typedef struct
|
|
{
|
|
VCAttribute *attribute;
|
|
VCEntity *next;
|
|
int32 index;
|
|
int32 flags;
|
|
VCUserDataList *userDataList;
|
|
} VCAttributeData;
|
|
|
|
typedef struct VCEntityData
|
|
{
|
|
dmMatrix apos;
|
|
VCEntity *newParent;
|
|
uint32 traverseMode;
|
|
VCCallbackFunctions *createFuncList;
|
|
VCCallbackFunctions *updateFuncList;
|
|
VCCallbackFunctions *deleteFuncList;
|
|
VCUserDataList *userData;
|
|
void *vcPosCallbackInfo;
|
|
void *objPosCallbackInfo;
|
|
VCCallbackFunctions *entityRelocateCallbackList;
|
|
uint32 entityRelocateMode;
|
|
} VCEntityData;
|
|
|
|
struct VCEntity {
|
|
VCEntity *parent; /* Local parental ptr */
|
|
VCEntity *child; /* Local child ptr */
|
|
VCEntity *sibling; /* Local sibling ptr */
|
|
_VCObject *object; /* Hierarchy VL data */
|
|
InstanceNo ino; /* VCObject Instance No */
|
|
VCEntityData *systemData;
|
|
int numAttributes;
|
|
VCAttributeData *attributes;/* Hierarchy data objects */
|
|
};
|
|
|
|
|
|
typedef struct
|
|
{
|
|
VCColour backgroundColour;
|
|
int backgroundColourSet;
|
|
float32 nearClip;
|
|
int nearClipSet;
|
|
float32 farClip;
|
|
int farClipSet;
|
|
VCColour fogColour;
|
|
uint32 fogMode;
|
|
int fogColourSet;
|
|
float32 nearFog;
|
|
int nearFogSet;
|
|
float32 farFog;
|
|
int farFogSet;
|
|
|
|
void *callbackHandle;
|
|
|
|
}_VCBodyVisResInfo;
|
|
|
|
typedef struct
|
|
{
|
|
char *resourceFile;
|
|
float32 volume;
|
|
int volumeSet;
|
|
float32 spreadingRollOff;
|
|
int spreadingRollOffSet;
|
|
float32 atmosphericAbsorption;
|
|
int atmosphericAbsorptionSet;
|
|
void *callbackHandle;
|
|
}_VCBodyAudioResInfo;
|
|
|
|
|
|
struct VCBody
|
|
{
|
|
VCBody *next;
|
|
_VCBody *body;
|
|
uint32 bodySize;
|
|
uint32 bodyCount;
|
|
VCEntity *rootEntity;
|
|
VCEntity *bodyPosEntity;
|
|
InstanceNo ino;
|
|
VCCallbackFunctions *bodyPartCreateList;
|
|
_VCBodyPartList *bodyPartList;
|
|
VCCallbackFunctions *attributeFuncList;
|
|
VCCallbackFunctions *inputFuncList;
|
|
VCCallbackFunctions *collisionFuncList;
|
|
_VCBodyVisResInfo visualInfo;
|
|
_VCBodyAudioResInfo audioInfo;
|
|
};
|
|
|
|
|
|
struct _VCBody_InputFuncData
|
|
{
|
|
uint32 minKeyCode;
|
|
uint32 maxKeyCode;
|
|
char *limbName;
|
|
};
|
|
|
|
struct _VCBody_CollideFuncData
|
|
{
|
|
char *limbName;
|
|
};
|
|
|
|
struct _VCInput_FuncData
|
|
{
|
|
uint32 minKeyCode;
|
|
uint32 maxKeyCode;
|
|
};
|
|
|
|
struct VCUserDataList
|
|
{
|
|
VCUserDataList *next;
|
|
uint32 vcId;
|
|
void *data;
|
|
};
|
|
|
|
|
|
struct VCCollisionReport_Traverse
|
|
{
|
|
uint32 instanceCount;
|
|
VCCollision *collision;
|
|
uint32 nextOffset;
|
|
};
|
|
|
|
struct VCIntersectionReport_Traverse
|
|
{
|
|
uint32 instanceCount;
|
|
VCIntersection *intersection;
|
|
uint32 nextOffset;
|
|
};
|
|
|
|
|
|
|
|
struct VCEntity_Traverse
|
|
{
|
|
VCEntity *currentObject; /* Current hierarchy pos */
|
|
VCEntity *startObject; /* Start hierarchy pos */
|
|
};
|
|
|
|
struct VCAttribute_EntityTraverse
|
|
{
|
|
VCEntity *entity;
|
|
int32 index;
|
|
};
|
|
|
|
struct VCEntity_AttributeTraverse
|
|
{
|
|
VCEntity *entity;
|
|
int32 nextIndex;
|
|
ElementHandle element;
|
|
};
|
|
|
|
struct VCBody_Traverse
|
|
{
|
|
VCBody *body;
|
|
};
|
|
|
|
struct VCVisualView_Traverse
|
|
{
|
|
duHashIterator hashIter;
|
|
VCAttribute *visResource;
|
|
};
|
|
|
|
|
|
struct VCBody_AttributeTraverse
|
|
{
|
|
VCBody *body;
|
|
char *limbName; /* Request limb */
|
|
ElementHandle element;
|
|
_VCBodyPartList *currentBodyPart;
|
|
int currentAttribute;
|
|
VCBody *currentBody;
|
|
VCBody_Traverse bodyTraverseInfo;
|
|
};
|
|
|
|
|
|
|
|
struct VCCallbackFunctions
|
|
{
|
|
VCCallbackFunctions *next;
|
|
VC_CallbackFunc function;
|
|
void *data;
|
|
void *systemData;
|
|
};
|
|
|
|
typedef union
|
|
{
|
|
VCEntity_Traverse entityT;
|
|
VCEntity_AttributeTraverse entityAttributeT;
|
|
VCAttribute_EntityTraverse attributeEntityT;
|
|
VCBody_Traverse bodyT;
|
|
VCBody_AttributeTraverse bodyAttributeT;
|
|
VCCollisionReport_Traverse collReportT;
|
|
VCIntersectionReport_Traverse intersectReportT;
|
|
VCVisualView_Traverse viewT;
|
|
}VC_Traverse;
|
|
|
|
typedef struct
|
|
{
|
|
ElementHandle element;
|
|
char *limbName;
|
|
} _VCAttributeElementData;
|
|
|
|
typedef struct
|
|
{
|
|
InstanceNo inst;
|
|
VCCallbackFunctions *functionList;
|
|
} _VCInstCallback;
|
|
|
|
typedef struct
|
|
{
|
|
VCBody *body;
|
|
_VCBodyPartList *bodyPart;
|
|
}_VCBodyPartInfo;
|
|
|
|
|
|
struct _VCTimer_CallbackInfo
|
|
{
|
|
VLTime lastTime;
|
|
VLTime time;
|
|
VLTimerMode mode;
|
|
};
|
|
|
|
struct _VCBodyPartList
|
|
{
|
|
_VCBodyPartList *next;
|
|
VCAttribute *bodyPartAttr;
|
|
VCBody *body;
|
|
uint32 inputNeeded;
|
|
/*
|
|
VCEntity *pickedObject;
|
|
VCEntity_DropFunc dropFunc;
|
|
void *dropData;
|
|
VCAttribute *pickAttr;
|
|
*/
|
|
};
|
|
|
|
typedef struct
|
|
{
|
|
VCAttribute *bodyPartAttr;
|
|
VCBody *body;
|
|
VCEntity_DropFunc dropFunc;
|
|
void *dropData;
|
|
VCPickObjectData pickObject;
|
|
}_VCBodyPickInfo;
|
|
|
|
|
|
|
|
typedef struct
|
|
{
|
|
VCCallbackFunctions *relocateFunctionList;
|
|
VCCallbackFunctions *createFunctionList;
|
|
VCCallbackFunctions *invalidFunctionList;
|
|
VCCallbackFunctions *updateFunctionList;
|
|
VCCallbackFunctions *deleteFunctionList;
|
|
void *createCallbackHandle;
|
|
void *updateCallbackHandle;
|
|
void *deleteCallbackHandle;
|
|
uint32 relocateMode;
|
|
} _VCObjectFunctions;
|
|
|
|
typedef struct
|
|
{
|
|
_VCObjectFunctions functions;
|
|
int explicitInstances;
|
|
duHashTab *instTable;
|
|
ElementHandle element;
|
|
uint32 registered;
|
|
} _VCAttributeCallback;
|
|
|
|
typedef struct
|
|
{
|
|
_VCAttributeCallback *callbackList;
|
|
int32 listSize;
|
|
} _VCAttributeCallbackList;
|
|
|
|
typedef struct
|
|
{
|
|
void *relocateCallbackHandle;
|
|
void *invalidCallbackHandle;
|
|
}_VCEntityRelocateCallbackHandles;
|
|
|
|
|
|
typedef struct _VCSyncCallbackInfo
|
|
{
|
|
struct _VCSyncCallbackInfo *next;
|
|
char *actorName;
|
|
char *actorType;
|
|
VCSync_Func updateFunc;
|
|
VCSync_Func deleteFunc;
|
|
void *data;
|
|
}_VCSyncCallbackInfo;
|
|
|
|
|
|
|
|
#endif
|