Files
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

188 lines
4.4 KiB
C++

#include "munga.h"
#pragma hdrstop
#include "rndorgn.h"
#include "renderer.h"
#include "app.h"
#include "entity.h"
//
//#############################################################################
// RendererOrigin
//#############################################################################
//
RendererOrigin::RendererOrigin(
Renderer *the_renderer,
Entity *entity,
InterestType interest_type,
InterestDepth depth_calibration
):
InterestOrigin(
entity->GetInterestZoneID(),
interest_type,
depth_calibration
),
interestingEntitySocket(NULL)
{
Check(the_renderer);
renderer = the_renderer;
}
//
//#############################################################################
// ~RendererOrigin
//#############################################################################
//
RendererOrigin::~RendererOrigin()
{
}
//
//#############################################################################
// TestInstance
//#############################################################################
//
Logical
RendererOrigin::TestInstance() const
{
InterestOrigin::TestInstance();
Check_Signature(renderer);
Check(&interestingEntitySocket);
return True;
}
//
//#############################################################################
//#############################################################################
//
void
RendererOrigin::AddInterestingEntity(Entity *interesting_entity)
{
Check(this);
Check(interesting_entity);
//
// Add to the socket
//
#if DEBUG_LEVEL>0
{
SChainIteratorOf<Entity*> iterator(&interestingEntitySocket);
Check(&iterator);
Verify(iterator.IsPlugMember(interesting_entity) == False);
}
#endif
interestingEntitySocket.Add(interesting_entity);
//
// Notify the renderer
//
#if 0
Renderer::NotifyOfNewInterestingEntityMessage
message(interesting_entity);
Check(&message);
Check(application);
Check(renderer);
application->PostInterestEvent(renderer, &message);
#else
Renderer::NotifyOfNewInterestingEntityMessage
message(interesting_entity);
Check(&message);
Check(application);
Check(application->GetInterestManager());
application->GetInterestManager()->PostRendererEvent(
interesting_entity,
renderer,
&message
);
#endif
}
//
//#############################################################################
//#############################################################################
//
void
RendererOrigin::RemoveUninterestingEntity(Entity *uninteresting_entity)
{
Check(this);
Check(uninteresting_entity);
//
// Notify the renderer
//
#if 1
Check(renderer);
renderer->NotifyOfBecomingUninterestingEntity(uninteresting_entity);
#else
Renderer::NotifyOfBecomingUninterestingEntityMessage
message(uninteresting_entity);
Check(&message);
Check(application);
Check(renderer);
application->PostInterestEvent(renderer, &message);
#endif
//
// Remove from socket
//
#if DEBUG_LEVEL>0
{
SChainIteratorOf<Entity*> iterator(&interestingEntitySocket);
Verify(iterator.IsPlugMember(uninteresting_entity) == True);
}
#endif
PlugIterator remover(uninteresting_entity);
remover.RemoveSocket(&interestingEntitySocket);
}
//
//#############################################################################
//#############################################################################
//
void
RendererOrigin::RemoveUninterestingEntities()
{
Check(this);
//
// Notify the renderer of uninteresting entities
//
SChainIteratorOf<Entity*> iterator(&interestingEntitySocket);
Entity *uninteresting_entity;
Check(&iterator);
#if 0
while ((uninteresting_entity = iterator.GetCurrent()) != NULL)
{
Check(uninteresting_entity);
Check(renderer);
renderer->NotifyOfBecomingUninterestingEntity(uninteresting_entity);
iterator.Remove();
}
#else
while ((uninteresting_entity = iterator.GetCurrent()) != NULL)
{
Check(uninteresting_entity);
RemoveUninterestingEntity(uninteresting_entity);
}
#endif
}
//~~~~~~~~~~~~~~~~~ RendererOrigin__InterestingEntityIterator ~~~~~~~~~~~~~~~~~
RendererOrigin__InterestingEntityIterator::
RendererOrigin__InterestingEntityIterator(
RendererOrigin *renderer_origin
):
SChainIteratorOf<Entity*>(&renderer_origin->interestingEntitySocket)
{
}
RendererOrigin__InterestingEntityIterator::
~RendererOrigin__InterestingEntityIterator()
{
}