Files
BT412/game/original/BT/BTREG.CPP
T
arcattackandClaude Opus 4.8 7b7d465e5e Initial commit: bt411 -- standalone Windows BattleTech (Tesla 4.10 port)
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>
2026-07-05 21:03:40 -05:00

163 lines
4.0 KiB
C++

//===========================================================================//
// File: btreg.cc //
// Project: MUNGA Brick: Registry Manager //
// Contents: Interface specification for Registry Manager //
//---------------------------------------------------------------------------//
// Date Who Modification //
// -------- --- ---------------------------------------------------------- //
// 11/22/94 ECH Initial coding. //
// 11/29/94 JMA Changed Identities to IDs //
//---------------------------------------------------------------------------//
// Copyright (C) 1994, Virtual World Entertainment, Inc. //
// All Rights reserved worldwide //
// This unpublished sourcecode is PROPRIETARY and CONFIDENTIAL //
//===========================================================================//
#include <bt.hpp>
#pragma hdrstop
#if !defined(BTREG_HPP)
# include <btreg.hpp>
#endif
#if !defined(BTPLAYER_HPP)
# include <btplayer.hpp>
#endif
#if !defined(BTDIRECT_HPP)
# include <btdirect.hpp>
#endif
//
// Registered classes...
//
#if !defined(MECH_HPP)
# include <mech.hpp>
#endif
#if !defined(PROJTILE_HPP)
# include <projtile.hpp>
#endif
#if !defined(MISSILE_HPP)
# include <missile.hpp>
#endif
#if !defined(BTTEAM_HPP)
# include <btteam.hpp>
#endif
//
//~~~~~~~~~~~~~~~~
// Munga Includes
//~~~~~~~~~~~~~~~~
//
#if !defined(BTMSSN_HPP)
# include <btmssn.hpp>
#endif
#if !defined(DIRECTOR_HPP)
# include <director.hpp>
#endif
#if !defined(HOSTMGR_HPP)
# include <hostmgr.hpp>
#endif
#if !defined(APP_HPP)
# include <app.hpp>
#endif
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Registry ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
//#############################################################################
// Registry
//#############################################################################
//
BTRegistry::BTRegistry(ResourceFile *)
{
}
//
//#############################################################################
// ~Registry
//#############################################################################
//
BTRegistry::~BTRegistry()
{
}
//
//#############################################################################
// GetStaticData
//#############################################################################
//
Entity::SharedData*
BTRegistry::GetStaticData(ClassID class_ID)
{
switch (class_ID)
{
case MechClassID:
return &Mech::DefaultData;
case ProjectileClassID:
return &Projectile::DefaultData;
case MissileClassID:
return &Missile::DefaultData;
case BTPlayerClassID:
return &BTPlayer::DefaultData;
case BTTeamClassID:
return &BTTeam::DefaultData;
default:
return Registry::GetStaticData(class_ID);
}
}
//
//#############################################################################
// GetStaticData
//#############################################################################
//
Player*
BTRegistry::MakePlayer(Mission *mission)
{
Check(this);
Check(mission);
BTMission *bt_mission = Cast_Object(BTMission *, mission);
if (strcmp(mission->GetGameModel(), "camera"))
{
BTPlayer::MakeMessage
make_player(
BTPlayer::MakeMessageID,
sizeof(BTPlayer::MakeMessage),
BTPlayerClassID,
EntityID::Null,
ResourceDescription::NullResourceID,
BTPlayer::DefaultFlags,
Origin::Identity,
mission->GetPlayerBitmapIndex(),
bt_mission->GetRoleName(),
bt_mission->GetTeamName()
);
return new BTPlayer(&make_player);
}
else
{
BTCameraDirector::MakeMessage create_director(
BTCameraDirector::MakeMessageID,
sizeof(BTCameraDirector::MakeMessage),
CameraDirectorClassID,
EntityID::Null,
ResourceDescription::NullResourceID,
BTCameraDirector::DefaultFlags,
Origin::Identity,
mission->GetPlayerBitmapIndex()
);
return new BTCameraDirector(&create_director);
}
}