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>
This commit is contained in:
@@ -0,0 +1,177 @@
|
||||
#include "munga.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "audent.h"
|
||||
#include "jmover.h"
|
||||
#include "app.h"
|
||||
#include "hostmgr.h"
|
||||
|
||||
//#############################################################################
|
||||
//########################### AudioEntity ###############################
|
||||
//#############################################################################
|
||||
|
||||
//#############################################################################
|
||||
// Shared Data Support
|
||||
//
|
||||
Derivation* AudioEntity::GetClassDerivations()
|
||||
{ static Derivation classDerivations(Explosion::GetClassDerivations(), "AudioEntity");
|
||||
return &classDerivations;
|
||||
}
|
||||
|
||||
|
||||
AudioEntity::SharedData
|
||||
AudioEntity::DefaultData(
|
||||
AudioEntity::GetClassDerivations(),
|
||||
AudioEntity::GetMessageHandlers(),
|
||||
AudioEntity::GetAttributeIndex(),
|
||||
AudioEntity::StateCount,
|
||||
(Entity::MakeHandler)AudioEntity::Make
|
||||
);
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
//#############################################################################
|
||||
//
|
||||
AudioEntity::AudioEntity(
|
||||
AudioEntity::MakeMessage *creation_message,
|
||||
AudioEntity::SharedData &shared_data
|
||||
):
|
||||
Explosion(creation_message, shared_data),
|
||||
parentEntitySocket(NULL)
|
||||
{
|
||||
Check_Pointer(this);
|
||||
Check_Pointer(creation_message);
|
||||
|
||||
//
|
||||
// Get the parent entity
|
||||
//
|
||||
Entity *parent_entity;
|
||||
|
||||
parent_entity =
|
||||
application->GetHostManager()->GetEntityPointer(
|
||||
creation_message->parentEntityID
|
||||
);
|
||||
if (parent_entity != NULL)
|
||||
{
|
||||
parentEntitySocket.Add(parent_entity);
|
||||
parentEntitySegment = creation_message->parentEntitySegment;
|
||||
}
|
||||
else
|
||||
{
|
||||
parentEntitySegment = NULL;
|
||||
}
|
||||
|
||||
//
|
||||
// Set simulation
|
||||
//
|
||||
SetPerformance(&AudioEntity::AudioEntitySimulation);
|
||||
SetValidFlag();
|
||||
}
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
//#############################################################################
|
||||
//
|
||||
AudioEntity::~AudioEntity()
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
//#############################################################################
|
||||
//
|
||||
Logical
|
||||
AudioEntity::TestInstance() const
|
||||
{
|
||||
if (!IsDerivedFrom(*GetClassDerivations()))
|
||||
{
|
||||
return False;
|
||||
}
|
||||
Check(&parentEntitySocket);
|
||||
if (parentEntitySegment != NULL)
|
||||
{
|
||||
Check(parentEntitySegment);
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
//#############################################################################
|
||||
//
|
||||
AudioEntity*
|
||||
AudioEntity::Make(AudioEntity::MakeMessage *creation_message)
|
||||
{
|
||||
return new AudioEntity(creation_message);
|
||||
}
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
//#############################################################################
|
||||
//
|
||||
void
|
||||
AudioEntity::AudioEntitySimulation(Scalar time_slice)
|
||||
{
|
||||
Check(this);
|
||||
|
||||
//
|
||||
// Get the parent entity, if it does not exist, condemn to death row
|
||||
//
|
||||
Entity *parent_entity;
|
||||
|
||||
if ((parent_entity = parentEntitySocket.GetCurrent()) == NULL)
|
||||
{
|
||||
CondemnToDeathRow();
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the orign of the parent entities segment
|
||||
//
|
||||
JointedMover *jointed_mover;
|
||||
|
||||
Verify(parent_entity->IsDerivedFrom(JointedMover::GetClassDerivations()));
|
||||
jointed_mover = Cast_Object(JointedMover*, parent_entity);
|
||||
Check(jointed_mover);
|
||||
Check(parentEntitySegment);
|
||||
jointed_mover->GetSegmentToWorld(
|
||||
*parentEntitySegment,
|
||||
&localToWorld
|
||||
);
|
||||
|
||||
//
|
||||
// Set the origin of this entity
|
||||
//
|
||||
localOrigin = localToWorld;
|
||||
updateOrigin = localOrigin;
|
||||
|
||||
//
|
||||
// Call inherited simulation
|
||||
//
|
||||
Explosion::ExplosionSimulation(time_slice);
|
||||
}
|
||||
|
||||
//#############################################################################
|
||||
//##################### AudioEntity__MakeMessage ########################
|
||||
//#############################################################################
|
||||
|
||||
AudioEntity__MakeMessage::AudioEntity__MakeMessage(
|
||||
ResourceDescription::ResourceID resource_ID,
|
||||
Entity *parent_entity,
|
||||
EntitySegment *parent_entity_segment
|
||||
):
|
||||
Explosion::MakeMessage(
|
||||
AudioEntity::MakeMessageID,
|
||||
sizeof(AudioEntity__MakeMessage),
|
||||
RegisteredClass::AudioEntityClassID,
|
||||
EntityID::Null,
|
||||
resource_ID,
|
||||
Entity::HermitInstance|Entity::DynamicFlag,
|
||||
parent_entity->localOrigin,
|
||||
parent_entity->GetEntityID(),
|
||||
EntityID::Null
|
||||
),
|
||||
parentEntityID(parent_entity->GetEntityID()),
|
||||
parentEntitySegment(parent_entity_segment)
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user