Files
TeslaRel410/restoration/source410/BT/MECHTECH.CPP
T
CydandClaude Fable 5 80ac2943a0 BT410 5.3.118: the census closes -- the authoring-side CreateStreamedSubsystem family, and the Fail count reaches ZERO
The last eight stubs plus the two chain layers they actually need
(PoweredSubsystem @004b13ac and ProjectileWeapon @004bc7cc were DECLARED in
our headers all along -- only their definitions were missing).  These are
the notation->stream converters the 1995 authoring pipeline ran; missions
read prebuilt streams and never call them, so the verification standard is
compile + link + the raw decomp's key fingerprints -- and those fingerprints
convicted the donors three more times:

- The heat chain: Condenser, Reservoir AND PoweredSubsystem all chain ONE
  shared parser (@004ae150, reconstructed in full from the decomp -- the
  BT411 donor's body was its own TODO stub with a miscited address).  It
  reads the five thermal scalars and the conduction-graph link (the
  linkedSinkIndex our wire-format work dump-verified from the runtime side,
  with the +2 segment-table bias), and HeatSink adds no keys of its own.
- The Emitter's SeekVoltage LADDER is a notation ENTRY LIST walked in file
  order (curve rungs in sequence, the RecommendedIndex entry by name); the
  donor flattened it to one keyed read, which would author one-rung ladders
  against the runtime's real five-rung ones.  MakeEntryList/GetFirstEntry
  is the engine's own idiom.
- PipColor and MuzzleVelocity parse through the engine's authentic
  Convert_From_Ascii overloads (RGBColor / Vector3D); the donors' sscanf
  substitutes were port drift.  Explosion and alarm models resolve as model
  FAMILIES (ModelListResourceType == the literal 1 in the binary; the donor
  comment calling it GameModelResourceType was wrong-name-right-number).

Entry reads target the SUBSYSTEM notation file -- the decomp's fifth
argument at every site; several donors wrote model_file.  Class IDs stamp
through OUR reader's enum symbols (they parse the real BTL4.RES streams
today, and the 3000-base enum lands exactly on the binary's 0xBBB.. ids;
0x0BCD is the weapon-base stamp every concrete leaf overwrites).

Stubs: NONE.  Every function in restoration/source410 now has a body.
Mission soak clean.  Remaining reconstruction is depth, not holes: the
mech4/mech3 archaeology (IntegrateMotion, the master-perf disasm, the
stream builders that seed the 0xC/0x100 flags), HUD blocks 4-6, and the
live networked/rig verifications queued for when a pod is available.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-04 11:22:12 -05:00

116 lines
3.3 KiB
C++

//===========================================================================//
// File: mechtech.cpp //
// Project: BattleTech Brick: Mech subsystems //
// Contents: MechTech -- the on-board technician / repair subsystem //
//---------------------------------------------------------------------------//
// Copyright (C) 1995, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
//===========================================================================//
#include <bt.hpp>
#pragma hdrstop
#if !defined(MECHTECH_HPP)
# include <mechtech.hpp>
#endif
#if !defined(MECH_HPP)
# include <mech.hpp>
#endif
Derivation
MechTech::ClassDerivations(Subsystem::ClassDerivations, "MechTech");
MechTech::SharedData
MechTech::DefaultData(
MechTech::ClassDerivations,
Subsystem::MessageHandlers,
Subsystem::AttributeIndex,
Subsystem::StateCount
);
MechTech::MechTech(
Mech *entity,
int subsystem_id,
SubsystemResource *model,
SharedData &shared_data
):
Subsystem(entity, subsystem_id, model, shared_data),
subsystemMonitors(NULL)
{
Check(entity);
Check_Pointer(model);
Check_Fpu();
}
MechTech::~MechTech()
{
}
Logical
MechTech::TestInstance() const
{
return IsDerivedFrom(ClassDerivations);
}
//
//#############################################################################
// CreateStreamedSubsystem -- binary @004ad48c. Stamps classID 0x0BDC / size
// 0x40 and zeroes the wooHoo trio; "AlarmModel" is OPTIONAL -- absent means
// no alarm; present, the named model family must resolve in the resource
// file ("<name> couldn't locate <name>.mod" otherwise). The surviving
// MECHTECH.HPP signature puts the ResourceFile LAST.
//#############################################################################
//
Logical
MechTech::CreateStreamedSubsystem(
NotationFile *model_file,
const char *model_name,
const char *subsystem_name,
SubsystemResource *subsystem_resource,
NotationFile *subsystem_file,
const ResourceDirectories *directories,
ResourceFile *resource_file
)
{
if (
!Subsystem::CreateStreamedSubsystem(
model_file, model_name, subsystem_name,
subsystem_resource, subsystem_file, directories
)
)
{
return False;
}
subsystem_resource->subsystemModelSize = 0x40;
subsystem_resource->classID = RegisteredClass::MechTechClassID;
subsystem_resource->alarmModel = (ResourceDescription::ResourceID)-1;
subsystem_resource->wooHooMinimumDuration = 0.0f;
subsystem_resource->wooHooDurationRange = 0.0f;
subsystem_resource->wooHooChance = 0.0f;
const char
*alarm_model_name = NULL;
if (!subsystem_file->GetEntry(subsystem_name, "AlarmModel", &alarm_model_name))
{
return True;
}
ResourceDescription
*description =
resource_file->FindResourceDescription(
alarm_model_name,
ResourceDescription::ModelListResourceType);
if (description == NULL)
{
DEBUG_STREAM << subsystem_name << " couldn't locate "
<< alarm_model_name << ".mod" << endl;
return False;
}
subsystem_resource->alarmModel = description->resourceID;
Check_Fpu();
return True;
}