- BORLAND/: Borland C++ 4.52 (chosen over 4.5 by byte-match: CODE/RP/CW32.LIB
is identical to 4.52's install lib). BCC32/TLINK32/TLIB/MAKE run natively on
Win11; CODE/BT/OPT.MAK is the shipped BTL4OPT.EXE's exact flag recipe
(extender = Borland PowerPack DPMI32, not Phar Lap TNT).
- restoration/source410/: the literal 1995-form reconstruction of the missing
BT game source (never mixed into CODE/). Round 1-3 state:
* 6 of 10 surviving original TUs COMPILE CLEAN under the period toolchain
(BTMSSN, BTCNSL, BTSCNRL, BTTEAM, BTL4MODE, BTL4ARND) - first builds
since 1996.
* BT_L4/BTL4APP.CPP pilot reconstruction: 12/12 functions, Fail() lands on
its binary-recorded line 400 exactly.
* BT/BTCNSL.HPP: console wire IDs recovered from the binary's ctors
(Killed=9, Damaged=10, ScoreUpdate=13, DeathWithoutHonor=15 [T1];
TeamScore=12 flagged [T4]).
* MUNGA/: 8 engine-header backfills back-dated from the BT412 WinTesla tree
(VDATA numbering decomp-verified; AUDREND's OpenAL-era virtual removed -
the period compiler is the drift detector).
* Tooling: backdate.py (WinTesla->1995 header transform), compile410.sh
(per-TU verification sweep under authentic OPT.MAK flags).
* README: corrected roadmap - MECH.HPP is the capstone grown with the mech
TU reconstructions; BTREG.CPP green = the header-family milestone.
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(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(
|
|
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);
|
|
|
|
//
|
|
// Route the PC keyboard to the application's key-command handler
|
|
//
|
|
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(),
|
|
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;
|
|
}
|