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>
170 lines
4.0 KiB
C++
170 lines
4.0 KiB
C++
#pragma once
|
|
|
|
#include "..\munga\icom.h"
|
|
#include "l4ctrl.h"
|
|
#include "..\munga\time.h"
|
|
|
|
//##########################################################################
|
|
//############################ L4Icom ################################
|
|
//##########################################################################
|
|
class L4Icom:
|
|
public Icom
|
|
{
|
|
friend class L4IcomManager;
|
|
|
|
public:
|
|
L4Icom(HostID host_id, int channel_offset);
|
|
~L4Icom(); // base destructor is virtual
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
//--------------------------------------------------
|
|
// Channel offset accessor
|
|
//--------------------------------------------------
|
|
int
|
|
GetChannelOffset()
|
|
{
|
|
Check(this);
|
|
return channelOffset;
|
|
}
|
|
//--------------------------------------------------
|
|
// public data
|
|
//--------------------------------------------------
|
|
ControlsButton
|
|
pttButton;
|
|
|
|
enum
|
|
{
|
|
numberOfChannels=7
|
|
};
|
|
|
|
protected:
|
|
//--------------------------------------------------
|
|
// These methods are used to locally set the value
|
|
// for the channel, PTT, and PA status.
|
|
//
|
|
// The difference between these methods and the
|
|
// public methods defined in the base class is that
|
|
// these methods are called by both the base class
|
|
// public routines and the event receiver to actually
|
|
// set the values involved. Making them virtual
|
|
// allows derived classes to be notified of changes
|
|
// (but also requires that all derived classes
|
|
// explicitly call the overridden methods!)
|
|
//--------------------------------------------------
|
|
void
|
|
SetChannelValue(int new_channel); // base method is virtual
|
|
void
|
|
SetPTTStatusValue(Logical new_ptt); // base method is virtual
|
|
void
|
|
SetPACaptiveValue(Logical new_pa); // base method is virtual
|
|
//--------------------------------------------------
|
|
// Recalibrate hardware
|
|
//--------------------------------------------------
|
|
void
|
|
Recalibrate();
|
|
//--------------------------------------------------
|
|
// Hardware control method
|
|
//--------------------------------------------------
|
|
void
|
|
Update(Scalar delta_t);
|
|
|
|
private:
|
|
Logical
|
|
WaitedLongEnough(Scalar how_long);
|
|
void
|
|
IncrementChannel();
|
|
void
|
|
DecrementChannel();
|
|
void
|
|
ChannelStatusUpdate();
|
|
void
|
|
ChannelSelectState(Logical state);
|
|
//--------------------------------------------------
|
|
// Protected data
|
|
//--------------------------------------------------
|
|
protected:
|
|
LBE4ControlsManager
|
|
*controlsManager;
|
|
|
|
ControlsButton
|
|
homeSensor,
|
|
channelButton;
|
|
Scalar
|
|
timeAccumulator;
|
|
int
|
|
hardwareChannel,
|
|
previousChannel,
|
|
channelOffset,
|
|
seekCount;
|
|
int
|
|
previousPTTStatus;
|
|
Logical
|
|
channelSelectEnabled,
|
|
seekRequired;
|
|
enum
|
|
{
|
|
disabled = -2,
|
|
failed = -1,
|
|
seek40,
|
|
offChannel,
|
|
reachedChannel,
|
|
onChannel,
|
|
}
|
|
state;
|
|
};
|
|
|
|
//##########################################################################
|
|
//######################## L4IcomManager #############################
|
|
//##########################################################################
|
|
class L4IcomManager:
|
|
public IcomManager
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Shared data Support
|
|
//
|
|
public:
|
|
static Derivation *GetClassDerivations();
|
|
static SharedData DefaultData;
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction and Destruction
|
|
//
|
|
public:
|
|
L4IcomManager(
|
|
SharedData &shared_data=DefaultData
|
|
);
|
|
~L4IcomManager(); // base destructor is virtual
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
L4Icom *
|
|
MakeIcom(HostID host_id, int unit_number=0);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// LoadMission, Shutdown methods
|
|
// ...these are declared virtual in ICOM.HPP and must chain back to
|
|
// the previous methods.
|
|
//
|
|
public:
|
|
void
|
|
LoadMission(Mission *mission);
|
|
void
|
|
Shutdown();
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Periodic update function
|
|
//
|
|
void
|
|
Execute();
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// protected data
|
|
//
|
|
protected:
|
|
Time
|
|
previousUpdateTime;
|
|
|
|
SlotOf<L4Icom*>
|
|
localIcom;
|
|
};
|