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>
173 lines
4.0 KiB
C++
173 lines
4.0 KiB
C++
#pragma once
|
|
|
|
#include "gaugrend.h"
|
|
#include "style.h"
|
|
#include "graph2d.h"
|
|
#include "mode.h"
|
|
#include "slot.h"
|
|
#include "chain.h"
|
|
|
|
class LampManager;
|
|
class GraphicLamp;
|
|
typedef int LampID;
|
|
typedef int LampState;
|
|
|
|
//#########################################################################
|
|
//################################# Lamp ##################################
|
|
//#########################################################################
|
|
class Lamp : public Node
|
|
{
|
|
friend class LampManager;
|
|
//----------------------------------------------------------------------
|
|
// Public methods
|
|
//----------------------------------------------------------------------
|
|
public:
|
|
enum
|
|
{
|
|
LampStateUndefined = -1,
|
|
LampStateOff = 0,
|
|
LampStateOn,
|
|
NextLampState
|
|
};
|
|
|
|
virtual ~Lamp();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
virtual void
|
|
SetState(LampState new_state);
|
|
|
|
void
|
|
SetAlertState(Logical alert_on = True);
|
|
|
|
LampState
|
|
GetState()
|
|
{
|
|
Check(this);
|
|
return previousState;
|
|
}
|
|
|
|
protected:
|
|
//----------------------------------------------------------------------
|
|
// Protected methods
|
|
//----------------------------------------------------------------------
|
|
Lamp(
|
|
LampID lamp_id,
|
|
ModeMask mode_mask,
|
|
LampManager *lamp_manager
|
|
);
|
|
|
|
virtual void
|
|
Update(Logical force_notify_of_state_change = False);
|
|
|
|
virtual void
|
|
NotifyOfStateChange();
|
|
//
|
|
//----------------------------------------------------------------------
|
|
// Protected data
|
|
//----------------------------------------------------------------------
|
|
//
|
|
LampID
|
|
lampID;
|
|
ModeMask
|
|
modeMask;
|
|
LampState
|
|
previousState;
|
|
LampManager
|
|
*manager;
|
|
int
|
|
alertActive;
|
|
};
|
|
|
|
//#########################################################################
|
|
//############################## GraphicLamp ##############################
|
|
//#########################################################################
|
|
class GraphicLamp :
|
|
public Lamp
|
|
{
|
|
//----------------------------------------------------------------------
|
|
// Public methods
|
|
//----------------------------------------------------------------------
|
|
public:
|
|
~GraphicLamp();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
//----------------------------------------------------------------------
|
|
// Protected methods
|
|
//----------------------------------------------------------------------
|
|
protected:
|
|
GraphicLamp(
|
|
LampID lamp_id,
|
|
ModeMask mode_mask,
|
|
LampManager *lamp_manager,
|
|
GaugeRenderer *renderer,
|
|
int graphics_port_number
|
|
);
|
|
//----------------------------------------------------------------------
|
|
// Public data
|
|
//----------------------------------------------------------------------
|
|
GaugeRenderer
|
|
*renderer;
|
|
GraphicsView
|
|
localView;
|
|
};
|
|
|
|
#include "gaugrend.h" // LampManager is a part of GaugeRenderer...
|
|
|
|
//############################## LampManager ##############################
|
|
// The Lamp Manager belongs to the Gauge Renderer: it is responsible for
|
|
// handling specialized 'lamp' objects similar to (but not identical to)
|
|
// gauge objects.
|
|
//#########################################################################
|
|
class LampManager SIGNATURED
|
|
{
|
|
friend class Lamp;
|
|
//----------------------------------------------------------------------
|
|
// Public methods
|
|
//----------------------------------------------------------------------
|
|
public:
|
|
virtual ~LampManager();
|
|
|
|
Logical
|
|
TestInstance() const;
|
|
|
|
virtual void
|
|
Update(ModeMask current_mode_mask);
|
|
Lamp *
|
|
FindLamp(LampID lamp_id, ModeMask mode_mask);
|
|
void
|
|
RemoveAllLamps();
|
|
ModeMask
|
|
GetPreviousModeMask()
|
|
{
|
|
Check(this);
|
|
Check_Fpu();
|
|
return previousModeMask;
|
|
}
|
|
//----------------------------------------------------------------------
|
|
// Protected methods
|
|
//----------------------------------------------------------------------
|
|
protected:
|
|
LampManager();
|
|
|
|
void
|
|
ActivateLamps(ModeMask bits_became_active);
|
|
void
|
|
DeactivateLamps(ModeMask bits_became_inactive);
|
|
void
|
|
AddLamp(Lamp *new_lamp);
|
|
void
|
|
RemoveLamp(LampID lamp_id, ModeMask mode_mask);
|
|
|
|
ModeMask
|
|
previousModeMask;
|
|
|
|
ChainOf<Lamp*>
|
|
lampList,
|
|
activeLampList,
|
|
inactiveLampList;
|
|
};
|