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>
246 lines
5.2 KiB
C++
246 lines
5.2 KiB
C++
#pragma once
|
|
|
|
#include "vtvsub.h"
|
|
#include "..\munga\average.h"
|
|
|
|
//##########################################################################
|
|
//################ VTVControlsMapper::ModelResource ##################
|
|
//##########################################################################
|
|
|
|
class VTVControlsMapper:
|
|
public VTVSubsystem
|
|
{
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Shared Data support
|
|
//
|
|
public:
|
|
static Derivation *GetClassDerivations();
|
|
static SharedData DefaultData;
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Messaging Support
|
|
//
|
|
public:
|
|
enum {
|
|
ConfigureControlsMessageID = VTVSubsystem::NextMessageID,
|
|
ConfigureSideSlipMappablesMessageID,
|
|
ChooseSideSlipMessageID,
|
|
ConfigureLiftCutMappablesMessageID,
|
|
ChooseLiftCutMessageID,
|
|
ConfigureHornMappablesMessageID,
|
|
ChooseHornMessageID,
|
|
ActivateHornMessageID,
|
|
ConfigurePTTMappablesMessageID,
|
|
ChoosePTTMessageID,
|
|
ActivatePTTMessageID,
|
|
ToggleReticleMessageID,
|
|
NextMessageID
|
|
};
|
|
|
|
void
|
|
ConfigureControlsMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
void
|
|
ConfigureSideSlipMappablesMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
void
|
|
ChooseSideSlipMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
void
|
|
ConfigureLiftCutMappablesMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
void
|
|
ChooseLiftCutMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
void
|
|
ConfigureHornMappablesMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
void
|
|
ChooseHornMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
void
|
|
ActivateHornMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
void
|
|
ConfigurePTTMappablesMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
void
|
|
ChoosePTTMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
void
|
|
ActivatePTTMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
void
|
|
ToggleReticleMessageHandler(
|
|
ReceiverDataMessageOf<ControlsButton> *message
|
|
);
|
|
|
|
private:
|
|
static const HandlerEntry MessageHandlerEntries[];
|
|
|
|
protected:
|
|
//static MessageHandlerSet MessageHandlers;
|
|
static MessageHandlerSet& GetMessageHandlers();
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Attribute Support
|
|
//
|
|
public:
|
|
enum {
|
|
StickPositionAttributeID = VTVSubsystem::NextAttributeID,
|
|
ThrottlePositionAttributeID,
|
|
PedalsPositionAttributeID,
|
|
ReverseThrustAttributeID,
|
|
LiftCutAttributeID,
|
|
SideSlipAttributeID,
|
|
PowerDemandAttributeID,
|
|
AngularVelocityDemandAttributeID,
|
|
BrakeLightsAttributeID,
|
|
LookLeftAttributeID,
|
|
LookRightAttributeID,
|
|
LookBehindAttributeID,
|
|
LookUpAttributeID,
|
|
ControlModeAttributeID,
|
|
HornBlastAttributeID,
|
|
MustMatchAttributeID,
|
|
ReverseThrustEngagedAttributeID, // ECH 8/3/95 - HACK - deal with thrust
|
|
LiftCutEngagedAttributeID,
|
|
PTTStatusAttributeID,
|
|
NextAttributeID
|
|
};
|
|
|
|
private:
|
|
static const IndexEntry AttributePointers[];
|
|
|
|
protected:
|
|
//static AttributeIndexSet AttributeIndex
|
|
static AttributeIndexSet& GetAttributeIndex();
|
|
|
|
//
|
|
// public attribute declarations go here
|
|
//
|
|
public:
|
|
ControlsJoystick stickPosition;
|
|
Scalar throttlePosition;
|
|
Scalar pedalsPosition;
|
|
ControlsButton
|
|
reverseThrust,
|
|
liftCut,
|
|
sideSlip,
|
|
rollLeft,
|
|
rollRight,
|
|
pitchUp,
|
|
pitchDown;
|
|
Vector3D
|
|
powerDemand,
|
|
angularVelocityDemand;
|
|
|
|
int brakeLights;
|
|
ControlsButton
|
|
lookLeft,
|
|
lookRight,
|
|
lookBehind,
|
|
lookUp,
|
|
hornBlast,
|
|
pttStatus;
|
|
|
|
// ECH 8/3/95 - HACK - deal with thrust
|
|
AverageOf<Scalar>
|
|
averageOfForwardThrustDemand;
|
|
Scalar
|
|
forwardThrustDemand;
|
|
Logical
|
|
reverseThrustEngaged;
|
|
|
|
Logical
|
|
liftCutEngaged;
|
|
|
|
enum {
|
|
BasicMode = 0,
|
|
StandardMode,
|
|
VeteranMode,
|
|
MasterMode
|
|
}
|
|
controlMode;
|
|
|
|
unsigned int
|
|
mustMatch,
|
|
mayMatch;
|
|
|
|
protected:
|
|
ControlsButton
|
|
previousPTTStatus; // used to detect change in PTT status
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Model Support
|
|
//
|
|
public:
|
|
enum {
|
|
ConfigurationState = VTVSubsystem::StateCount,
|
|
StateCount
|
|
};
|
|
|
|
typedef void
|
|
(VTVControlsMapper::*Performance)(Scalar time_slice);
|
|
|
|
void
|
|
SetPerformance(Performance performance)
|
|
{
|
|
Check(this);
|
|
activePerformance = (Simulation::Performance)performance;
|
|
}
|
|
|
|
void
|
|
InterpretControls(Scalar time_slice);
|
|
void
|
|
SetConfigurationState(Logical enter_config);
|
|
|
|
virtual void
|
|
CreateTemporaryEventMappings(
|
|
Receiver *receiver,
|
|
Receiver::MessageID config_message_id
|
|
),
|
|
RemoveTemporaryEventMappings(),
|
|
AddOrErase(
|
|
unsigned int button_ID,
|
|
Receiver *target,
|
|
Receiver::MessageID message_ID
|
|
),
|
|
AddOrErase(
|
|
unsigned int button_ID,
|
|
ControlsButton *destination
|
|
);
|
|
|
|
virtual void
|
|
NotifyOfControlModeChange(int new_mode);
|
|
|
|
virtual void
|
|
NotifyOfConfigurationModeChange(Logical new_state);
|
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
// Construction and Destruction
|
|
//
|
|
public:
|
|
VTVControlsMapper(
|
|
VTV *owner,
|
|
int subsystem_ID,
|
|
SubsystemResource *subsystem_resource,
|
|
SharedData &shared_data
|
|
);
|
|
~VTVControlsMapper();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
};
|