All 10 surviving original TUs plus the reconstructed BTL4APP.CPP pilot build clean with the authentic OPT.MAK flags (compile410.sh --sweep). First time the 4.10 BattleTech source has compiled since 1996. - layout_probe.cpp: the period compiler measures 1995 layouts from the surviving headers; validated 3/3 against binary alloc sizes (BTMission 0xFC, BTL4ModeManager 0xC, BTRegistry 0x10). Base boundary: Simulation 0xD0 / Entity 0x1C4 / Mover 0x300 / JointedMover 0x328 => Mech-own region 0x328-0x854 (MECH-LAYOUT.md staging worksheet). - 13 staged headers close the family ([T3] reserved[]-parked layouts; interfaces PROVEN by the surviving consumers): MECH, MECHSUB, HEAT, POWERSUB, MECHWEAP, EMITTER, MECHMPPR, BTPLAYER (BTPlayer__MakeMessage = Player's 8 args + roleName/teamName [T1 via BTREG]), PROJTILE, MISSILE, BTL4MPPR, BTL4VID + the round-2 BTCNSL/BTSCNRL. - compile410.sh: PCH gate retired (bt.hpp/mungal4.hpp full include sets), DPL SDK roots on the include line. - BTL4APP.CPP: appmgr include + GetApplicationManager()->GetFrameRate() + ResourceDescription:: scoping; Fail() held at its recorded line 400. - Evidence ledgers: STAGED-HEADERS.NOTES.md, MECH-LAYOUT.md, BACKFILLS, BTCNSL (binary-recovered console wire IDs), BTSCNRL. Remaining for a linkable BTL4OPT: the ~40 missing TU bodies (917-function manifest) - the header skeleton they grow into now exists and compiles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
487 lines
12 KiB
C++
487 lines
12 KiB
C++
//===========================================================================//
|
|
// File: rp4lbe4.cc //
|
|
// Project: MUNGA Brick: Red Planet LBE Application //
|
|
// Contents: //
|
|
//---------------------------------------------------------------------------//
|
|
// Date Who Modification //
|
|
// -------- --- ---------------------------------------------------------- //
|
|
// //
|
|
//---------------------------------------------------------------------------//
|
|
// Copyright (C) 1994, Virtual World Entertainment, Inc. //
|
|
// All Rights reserved worldwide //
|
|
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
|
|
//===========================================================================//
|
|
|
|
#include <btl4.hpp>
|
|
#pragma hdrstop
|
|
|
|
#if !defined(BTL4APP_HPP)
|
|
# include <btl4app.hpp>
|
|
#endif
|
|
|
|
#if !defined(BTREG_HPP)
|
|
# include <btreg.hpp>
|
|
#endif
|
|
|
|
#if !defined(APPMGR_HPP)
|
|
# include <appmgr.hpp>
|
|
#endif
|
|
|
|
#if !defined(BTL4VID_HPP)
|
|
# include <btl4vid.hpp>
|
|
#endif
|
|
|
|
#if !defined(BTL4ARND_HPP)
|
|
# include <btl4arnd.hpp>
|
|
#endif
|
|
|
|
#if !defined(BTL4GRND_HPP)
|
|
# include <btl4grnd.hpp>
|
|
#endif
|
|
|
|
#if !defined(BTL4MODE_HPP)
|
|
# include <btl4mode.hpp>
|
|
#endif
|
|
|
|
#if !defined(BTL4MSSN_HPP)
|
|
# include <btl4mssn.hpp>
|
|
#endif
|
|
|
|
#if !defined(MECH_HPP)
|
|
# include <mech.hpp>
|
|
#endif
|
|
|
|
#if !defined(CAMSHIP_HPP)
|
|
# include <camship.hpp>
|
|
#endif
|
|
|
|
#if !defined(L4MPPR_HPP)
|
|
# include <l4mppr.hpp>
|
|
#endif
|
|
|
|
#if !defined(L4CTRL_HPP)
|
|
# include <l4ctrl.hpp>
|
|
#endif
|
|
|
|
//
|
|
//#############################################################################
|
|
//#############################################################################
|
|
//
|
|
const Receiver::HandlerEntry
|
|
BTL4Application::MessageHandlerEntries[]=
|
|
{
|
|
MESSAGE_ENTRY(BTL4Application, RunMission),
|
|
MESSAGE_ENTRY(BTL4Application, StopMission)
|
|
};
|
|
|
|
BTL4Application::MessageHandlerSet
|
|
BTL4Application::MessageHandlers(
|
|
ELEMENTS(BTL4Application::MessageHandlerEntries),
|
|
BTL4Application::MessageHandlerEntries,
|
|
L4Application::MessageHandlers
|
|
);
|
|
|
|
//
|
|
//#############################################################################
|
|
//#############################################################################
|
|
//
|
|
Derivation
|
|
BTL4Application::ClassDerivations(
|
|
L4Application::ClassDerivations,
|
|
"BTL4Application"
|
|
);
|
|
|
|
BTL4Application::SharedData
|
|
BTL4Application::DefaultData(
|
|
BTL4Application::ClassDerivations,
|
|
BTL4Application::MessageHandlers
|
|
);
|
|
|
|
//
|
|
//#############################################################################
|
|
//#############################################################################
|
|
//
|
|
BTL4Application::BTL4Application(
|
|
ResourceFile *resource_file,
|
|
ClassID class_ID,
|
|
SharedData &shared_data
|
|
):
|
|
L4Application(
|
|
resource_file,
|
|
BTL4,
|
|
class_ID,
|
|
shared_data
|
|
)
|
|
{
|
|
DEBUG_STREAM << "BTL4Application::BTL4Application" << endl;
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
//#############################################################################
|
|
//
|
|
BTL4Application::~BTL4Application()
|
|
{
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// MakeRegistry
|
|
//#############################################################################
|
|
//
|
|
Registry*
|
|
BTL4Application::MakeRegistry()
|
|
{
|
|
Check(this);
|
|
|
|
return new BTRegistry(GetResourceFile());
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// MakeVideoRenderer
|
|
//#############################################################################
|
|
//
|
|
VideoRenderer*
|
|
BTL4Application::MakeVideoRenderer()
|
|
{
|
|
Check(this);
|
|
|
|
//
|
|
// Only build a video renderer when there is a division card
|
|
//
|
|
if (!divisionParameters)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
return
|
|
new BTL4VideoRenderer(
|
|
DefaultRendererRate,
|
|
MaxRendererComplexity,
|
|
DefaultRendererPriority,
|
|
VisualInterestType,
|
|
1
|
|
);
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// MakeAudioRenderer
|
|
//#############################################################################
|
|
//
|
|
AudioRenderer*
|
|
BTL4Application::MakeAudioRenderer()
|
|
{
|
|
Check(this);
|
|
|
|
//
|
|
// Both sound cards must be present
|
|
//
|
|
if (!getenv("AWE_FRONT") || !getenv("AWE_REAR"))
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
return
|
|
new BTL4AudioRenderer(
|
|
GetApplicationManager()->GetFrameRate(),
|
|
GetMissionReviewMode()
|
|
);
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// MakeModeManager
|
|
//#############################################################################
|
|
//
|
|
ModeManager*
|
|
BTL4Application::MakeModeManager()
|
|
{
|
|
Check(this);
|
|
|
|
return new BTL4ModeManager(BTL4ModeManager::ModeInitial);
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// MakeControlsManager
|
|
//#############################################################################
|
|
//
|
|
ControlsManager*
|
|
BTL4Application::MakeControlsManager()
|
|
{
|
|
Check(this);
|
|
|
|
LBE4ControlsManager
|
|
*controls_manager = new LBE4ControlsManager;
|
|
Check_Pointer(controls_manager);
|
|
controls_manager->keyboardGroup[LBE4ControlsManager::KeyboardPC].Add(
|
|
ModeManager::ModeAlwaysActive,
|
|
this,
|
|
KeyCommandMessageID,
|
|
this
|
|
);
|
|
|
|
return controls_manager;
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// MakeGaugeRenderer
|
|
//#############################################################################
|
|
//
|
|
GaugeRenderer*
|
|
BTL4Application::MakeGaugeRenderer()
|
|
{
|
|
Check(this);
|
|
|
|
//
|
|
// Only build the gauge renderer on a machine with gauge hardware
|
|
//
|
|
if (!getenv("L4GAUGE"))
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
return new BTL4GaugeRenderer;
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// MakeMission
|
|
//#############################################################################
|
|
//
|
|
Mission*
|
|
BTL4Application::MakeMission(
|
|
NotationFile *notation_file,
|
|
ResourceFile *resources
|
|
)
|
|
{
|
|
Check(this);
|
|
|
|
return new BTL4Mission(notation_file, resources);
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// MakeViewpointEntity
|
|
//#############################################################################
|
|
//
|
|
Entity*
|
|
BTL4Application::MakeViewpointEntity(Entity::MakeMessage *message)
|
|
{
|
|
Check(this);
|
|
|
|
LBE4ControlsManager
|
|
*controls_manager = GetControlsManager();
|
|
|
|
Entity
|
|
*viewing_entity = NULL;
|
|
char
|
|
*primary_mapping_name = NULL;
|
|
|
|
switch (message->classToCreate)
|
|
{
|
|
case CameraShipClassID:
|
|
//===============================================================
|
|
// Create Camera ship
|
|
//===============================================================
|
|
{
|
|
CameraShip
|
|
*viewing_camera =
|
|
CameraShip::Make((CameraShip::MakeMessage*)message);
|
|
Check(viewing_camera);
|
|
|
|
viewing_entity = viewing_camera;
|
|
|
|
//------------------------------------------------------------
|
|
// Create the controls mapping subsystem resource
|
|
//------------------------------------------------------------
|
|
CameraControlsMapper::SubsystemResource
|
|
control_subsystem_resource;
|
|
|
|
Str_Copy(
|
|
control_subsystem_resource.subsystemName,
|
|
"ControlsMapper",
|
|
sizeof(control_subsystem_resource.subsystemName)
|
|
);
|
|
control_subsystem_resource.classID = TrivialSubsystemClassID;
|
|
control_subsystem_resource.subsystemModelSize =
|
|
sizeof(control_subsystem_resource);
|
|
|
|
CameraControlsMapper
|
|
*camera_mapper;
|
|
|
|
switch (controls_manager->primaryControlType)
|
|
{
|
|
case LBE4ControlsManager::PrimaryThrustMaster:
|
|
camera_mapper =
|
|
new CameraThrustmasterMapper(
|
|
viewing_camera,
|
|
0,
|
|
&control_subsystem_resource
|
|
);
|
|
primary_mapping_name = "Thrustmaster";
|
|
break;
|
|
|
|
case LBE4ControlsManager::PrimaryRIO:
|
|
camera_mapper =
|
|
new CameraRIOMapper(
|
|
viewing_camera,
|
|
0,
|
|
&control_subsystem_resource
|
|
);
|
|
primary_mapping_name = "L4";
|
|
break;
|
|
|
|
default:
|
|
camera_mapper =
|
|
new CameraL4Mapper(
|
|
viewing_camera,
|
|
0,
|
|
&control_subsystem_resource
|
|
);
|
|
break;
|
|
}
|
|
|
|
//------------------------------------------------------------
|
|
// Attach the mapping subsystem to the entity
|
|
//------------------------------------------------------------
|
|
viewing_camera->SetMappingSubsystem(camera_mapper);
|
|
}
|
|
break;
|
|
|
|
case MechClassID:
|
|
//===============================================================
|
|
// Create Mech
|
|
//===============================================================
|
|
{
|
|
Mech
|
|
*viewing_mech = Mech::Make((Mech::MakeMessage*)message);
|
|
Check(viewing_mech);
|
|
|
|
viewing_entity = viewing_mech;
|
|
|
|
//------------------------------------------------------------
|
|
// Control deadbanding
|
|
//------------------------------------------------------------
|
|
controls_manager->SetJoystickDeadBand(0.05f);
|
|
controls_manager->SetThrottleDeadBand(0.05f);
|
|
controls_manager->SetPedalsDeadBand(0.05f);
|
|
|
|
MechControlsMapper
|
|
*mech_mapper;
|
|
|
|
switch (controls_manager->primaryControlType)
|
|
{
|
|
case LBE4ControlsManager::PrimaryThrustMaster:
|
|
mech_mapper =
|
|
new MechThrustmasterMapper(
|
|
viewing_mech,
|
|
0,
|
|
"ControlsMapper"
|
|
);
|
|
primary_mapping_name = "Thrustmaster";
|
|
break;
|
|
|
|
case LBE4ControlsManager::PrimaryRIO:
|
|
mech_mapper =
|
|
new MechRIOMapper(
|
|
viewing_mech,
|
|
0,
|
|
"ControlsMapper"
|
|
);
|
|
primary_mapping_name = "L4";
|
|
break;
|
|
|
|
default:
|
|
DEBUG_STREAM << "*****Mech has no controls mapping!*****";
|
|
Fail("BTL4Application::MakeViewpointEntity");
|
|
mech_mapper = NULL;
|
|
break;
|
|
}
|
|
|
|
//------------------------------------------------------------
|
|
// Attach the mapping subsystem to the entity
|
|
//------------------------------------------------------------
|
|
viewing_mech->SetMappingSubsystem(mech_mapper);
|
|
viewing_mech->StartCollisionAssistant();
|
|
}
|
|
break;
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Load the control mappings for the entity
|
|
//-------------------------------------------------------------------
|
|
if (primary_mapping_name)
|
|
{
|
|
ResourceDescription
|
|
*description =
|
|
application->GetResourceFile()->SearchList(
|
|
viewing_entity->GetResourceID(),
|
|
ResourceDescription::ControlMappingsListResourceType
|
|
);
|
|
|
|
if (description)
|
|
{
|
|
description =
|
|
GetResourceFile()->SearchList(
|
|
description->resourceID,
|
|
primary_mapping_name
|
|
);
|
|
|
|
if (description)
|
|
{
|
|
description->Lock();
|
|
GetControlsManager()->CreateStreamedMappings(
|
|
viewing_entity,
|
|
(int*)description->resourceAddress
|
|
);
|
|
description->Unlock();
|
|
}
|
|
}
|
|
}
|
|
|
|
//-------------------------------------------------------------------
|
|
// Configure the gauges for the entity
|
|
//-------------------------------------------------------------------
|
|
if (GetGaugeRenderer())
|
|
{
|
|
GetGaugeRenderer()->ConfigureForModel("Init", viewing_entity);
|
|
}
|
|
|
|
return viewing_entity;
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// RunMissionMessageHandler
|
|
//#############################################################################
|
|
//
|
|
void
|
|
BTL4Application::RunMissionMessageHandler(RunMissionMessage *message)
|
|
{
|
|
DEBUG_STREAM << "BTL4Application::RunMissionMessageHandler" << endl;
|
|
|
|
GetModeManager()->AddModeMask(BTL4ModeManager::ModePlasmaDisplay);
|
|
DEBUG_STREAM << "Turning Plasma Score Display On" << endl;
|
|
|
|
L4Application::RunMissionMessageHandler(message);
|
|
}
|
|
|
|
//
|
|
//#############################################################################
|
|
// StopMissionMessageHandler
|
|
//#############################################################################
|
|
//
|
|
void
|
|
BTL4Application::StopMissionMessageHandler(StopMissionMessage *message)
|
|
{
|
|
GetModeManager()->RemoveModeMask(BTL4ModeManager::ModePlasmaDisplay);
|
|
|
|
L4Application::StopMissionMessageHandler(message);
|
|
|
|
DEBUG_STREAM << "Turning Plasma Score Display Off" << endl;
|
|
}
|