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>
103 lines
3.0 KiB
C
103 lines
3.0 KiB
C
// Recovered decompilation of functions attributed to bt_l4/btl4rdr.cpp
|
|
// (from BTL4OPT.EXE via embedded assert paths). Pseudocode — reconstruct against the header.
|
|
|
|
/* ---- @ 004c2178 ---- */
|
|
|
|
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
|
|
|
|
void __cdecl FUN_004c2178(int param_1)
|
|
|
|
{
|
|
float fVar1;
|
|
float fVar2;
|
|
int iVar3;
|
|
|
|
if (*(float *)(param_1 + 0x2d4) <= _DAT_004c2284) {
|
|
FUN_0040385c(s_MapDisplay__CalculateBounds_dete_00514038,
|
|
s_d__tesla_bt_bt_l4_BTL4RDR_CPP_00514071,0x224);
|
|
*(undefined4 *)(param_1 + 0x2d4) = 0x3f800000;
|
|
}
|
|
*(float *)(param_1 + 0x2e8) = (float)(*(int *)(param_1 + 0x364) * 2) / *(float *)(param_1 + 0x2d4)
|
|
;
|
|
*(float *)(param_1 + 0x2ec) = _DAT_004c2288 / *(float *)(param_1 + 0x2e8);
|
|
*(undefined4 *)(param_1 + 0x2e4) = *(undefined4 *)(param_1 + 0x2ec);
|
|
fVar1 = (float)*(int *)(param_1 + 0x364) / *(float *)(param_1 + 0x2e8);
|
|
fVar2 = (float)*(int *)(param_1 + 0x368) / *(float *)(param_1 + 0x2e8);
|
|
iVar3 = FUN_00417ab4(*(int *)(param_1 + 0x1c) + 0x40);
|
|
FUN_00408440((undefined4 *)(param_1 + 0x310),(undefined4 *)(iVar3 + 0x100));
|
|
*(float *)(param_1 + 0x2f8) = *(float *)(param_1 + 0x310) - fVar1;
|
|
*(float *)(param_1 + 0x304) = *(float *)(param_1 + 0x310) + fVar1;
|
|
*(undefined4 *)(param_1 + 0x2fc) = 0xc7000000;
|
|
*(undefined4 *)(param_1 + 0x308) = 0x47000000;
|
|
*(float *)(param_1 + 0x300) = *(float *)(param_1 + 0x318) - fVar2;
|
|
*(float *)(param_1 + 0x30c) = *(float *)(param_1 + 0x318) + fVar2;
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
/* ---- @ 004c28c4 ---- */
|
|
|
|
void __cdecl FUN_004c28c4(int param_1,float *param_2)
|
|
|
|
{
|
|
int iVar1;
|
|
float *pfVar2;
|
|
int iVar3;
|
|
undefined4 uVar4;
|
|
int local_1c [3];
|
|
int local_10;
|
|
int local_c;
|
|
int local_8;
|
|
|
|
local_8 = FUN_00417ab4(*(int *)(param_1 + 0x1c) + 0x40);
|
|
local_c = 0;
|
|
if (local_8 != 0) {
|
|
local_c = *(int *)(*(int *)(local_8 + 400) + 0x284);
|
|
}
|
|
FUN_0042ac1c(local_1c,param_1 + 0x3a0);
|
|
local_10 = (**(code **)(local_1c[0] + 0x14))(local_1c);
|
|
if (local_10 < 1) {
|
|
FUN_0042ac79(local_1c,2);
|
|
}
|
|
else {
|
|
if (0x10 < local_10) {
|
|
local_10 = 0x10;
|
|
}
|
|
iVar3 = 0;
|
|
pfVar2 = (float *)(param_1 + 0x90);
|
|
if (0 < local_10) {
|
|
do {
|
|
iVar1 = (**(code **)(local_1c[0] + 0x28))(local_1c);
|
|
if (iVar1 == 0) {
|
|
FUN_0040385c(s_MapDisplay__DrawNames___GetSize__0051408f,
|
|
s_d__tesla_bt_bt_l4_BTL4RDR_CPP_005140b7,0x408);
|
|
}
|
|
FUN_004c19fc(pfVar2,iVar1,param_2,local_8,local_c);
|
|
iVar3 = iVar3 + 1;
|
|
pfVar2 = pfVar2 + 9;
|
|
} while (iVar3 < local_10);
|
|
}
|
|
if (*(int *)(param_1 + 0x374) == 0) {
|
|
uVar4 = 0;
|
|
}
|
|
else {
|
|
uVar4 = *(undefined4 *)(param_1 + 0x360);
|
|
}
|
|
iVar1 = 0;
|
|
iVar3 = param_1 + 0x90;
|
|
if (0 < local_10) {
|
|
do {
|
|
FUN_004c1ab0(iVar3,(int *)(param_1 + 0x48),uVar4);
|
|
iVar1 = iVar1 + 1;
|
|
iVar3 = iVar3 + 0x24;
|
|
} while (iVar1 < local_10);
|
|
}
|
|
FUN_0042ac79(local_1c,2);
|
|
}
|
|
return;
|
|
}
|
|
|
|
|
|
|