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>
146 lines
4.8 KiB
C++
146 lines
4.8 KiB
C++
//===========================================================================//
|
|
// File: btl4pb.hpp //
|
|
// Project: BattleTech Brick: BattleTech LBE Application //
|
|
// Contents: BTL4PlaybackApplication -- the LBE "mission review" / playback //
|
|
// application, plus the BTSpoolerTask background task that pumps //
|
|
// recorded network packets out of a SpoolFile. //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
//
|
|
// This declaration is the SURVIVING header
|
|
// (410SRC\Telsa40\Rel410\CODE\BT\BT_L4\BTL4PB.HPP) reproduced verbatim. Only
|
|
// the file banner has been corrected (the shipped copy still carried the Red
|
|
// Planet "rp4lbe4.hh / RPSpoolerTask / RPPlaybackApplication" comment block
|
|
// from which it was cloned). The class bodies are unchanged ground truth and
|
|
// match the shipped binary BTL4OPT.EXE: BTL4PlaybackApplication vtable
|
|
// @0051f1a4 (ctor @004d3be4), BTSpoolerTask vtable @0051f204 (ctor @004d3b74).
|
|
//
|
|
|
|
#if !defined(BTL4PB_HPP)
|
|
# define BTL4PB_HPP
|
|
|
|
// NOTE (reconstruction): btl4app.hpp uses L4Application as a base but does not
|
|
// itself pull in l4app.hpp (it only chains through btl4mppr.hpp), so the base
|
|
// must be made visible here first -- exactly as the RP twin rpl4pb.h relies on
|
|
// rpl4app.h -> l4app.h. This also brings in <app.h>/<appmgr.h> (Application,
|
|
// the RunMission/StopMission message IDs, Derivation, SharedData, etc.).
|
|
# include <l4app.hpp>
|
|
|
|
# if !defined(BTL4APP_HPP)
|
|
# include <btl4app.hpp>
|
|
# endif
|
|
|
|
# if !defined(L4SPLR_HPP)
|
|
# include <l4splr.hpp>
|
|
# endif
|
|
|
|
//##########################################################################
|
|
//####################### BTSpoolerTask ##############################
|
|
//##########################################################################
|
|
|
|
class BTSpoolerTask:
|
|
public SpoolerTask
|
|
{
|
|
public:
|
|
BTSpoolerTask();
|
|
~BTSpoolerTask();
|
|
|
|
void
|
|
DispatchPacket(NetworkPacket *packet);
|
|
long
|
|
GetTimeBias();
|
|
};
|
|
|
|
//##########################################################################
|
|
//#################### BTL4PlaybackApplication #######################
|
|
//##########################################################################
|
|
|
|
class BTL4PlaybackApplication:
|
|
public BTL4Application
|
|
{
|
|
public:
|
|
// PORT NOTE: the surviving DOS header declared this as
|
|
// (ResourceFile*, SpoolFile*). The WinTesla L4Application base ctor
|
|
// requires (HINSTANCE, HWND, ...) for the Windows window/instance, so --
|
|
// exactly as RPL4PlaybackApplication does -- the playback application
|
|
// threads HINSTANCE/HWND through to the base.
|
|
BTL4PlaybackApplication(
|
|
HINSTANCE hInstance,
|
|
HWND hWnd,
|
|
ResourceFile *resource,
|
|
SpoolFile *spool_file = NULL
|
|
);
|
|
~BTL4PlaybackApplication();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
void
|
|
SetSpoolFile(SpoolFile *spool_file)
|
|
{spoolFile = spool_file;}
|
|
|
|
MissionReviewApplicationManager*
|
|
GetApplicationManager()
|
|
{
|
|
return
|
|
(MissionReviewApplicationManager*)
|
|
Application::GetApplicationManager();
|
|
}
|
|
|
|
long
|
|
GetTimeBias()
|
|
{return timeBias;}
|
|
|
|
void
|
|
DispatchPacket(NetworkPacket *packet);
|
|
|
|
protected:
|
|
NetworkManager*
|
|
MakeNetworkManager();
|
|
|
|
long
|
|
timeBias;
|
|
|
|
void
|
|
Initialize();
|
|
void
|
|
LoadBackgroundTasks();
|
|
Logical
|
|
ExecuteForeground(
|
|
Time start_of_frame,
|
|
Scalar frame_duration
|
|
);
|
|
void
|
|
ExecuteBackgroundTask();
|
|
|
|
static const HandlerEntry
|
|
MessageHandlerEntries[];
|
|
// Modernized WinTesla idiom (cf. RPL4PlaybackApplication): the shipped
|
|
// 1995 source declared a plain "static MessageHandlerSet MessageHandlers;"
|
|
// but the ported engine exposes the handler set through an accessor that
|
|
// chains to the inherited Application::GetMessageHandlers().
|
|
static MessageHandlerSet&
|
|
GetMessageHandlers();
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Shared Data Support
|
|
//
|
|
public:
|
|
static Derivation *GetClassDerivations();
|
|
static SharedData DefaultData;
|
|
|
|
void
|
|
RunMissionMessageHandler(RunMissionMessage *message);
|
|
void
|
|
StopMissionMessageHandler(StopMissionMessage *message);
|
|
};
|
|
|
|
#endif
|