Files
BT411/engine/MUNGA_L4/L4AUDRND.h
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

208 lines
4.9 KiB
C++

#pragma once
#include "..\munga\audrend.h"
#include "l4audhdw.h"
#include "l4audio.h"
#include "l4audres.h"
#include "openal/al.h"
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ L4AudioRenderer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class L4AudioRenderer:
public AudioRenderer
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Construction, Destruction, Testing
//
public:
L4AudioRenderer(
RendererRate render_rate,
Logical mission_review_mode
);
~L4AudioRenderer();
Logical
TestInstance() const;
virtual void ReleaseSourceSet(SourceSet &sourceSet);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Renderer support
//
public:
void
Initialize();
public:
void
NotifyOfNewInterestingEntity(Entity *interesting_entity);
void
NotifyOfBecomingUninterestingEntity(Entity *uninteresting_entity);
protected:
void
ExecuteImplementation(
RendererComplexity complexity_update,
RendererOrigin::InterestingEntityIterator *iterator
);
private:
void
LoadMissionImplementation(Mission *mission);
void
ShutdownImplementation();
void
SuspendImplementation();
void
ResumeImplementation();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Audio hardware accessors
//
public:
/* AudioCard*
GetFrontCard();
AudioCard*
GetRearCard();*/
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Audio Source support
//
public:
void
StartRequest(L4AudioSource *audio_source);
void
StopRequest(L4AudioSource *audio_source);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Private methods
//
private:
void
CalculateMix();
void
RunningSourceCheckup();
//void
// RunningAudioSourceSort();
void
DormantSourceCheckup();
void
AudioSourceStopMaintenance(L4AudioSource *source);
void
AudioSourceSuspendMaintenance(L4AudioSource *source);
Logical
RequestAudioResources(
L4AudioSource *audio_source,
SourceSet *source_result
);
Logical
RequestAudioChannels(
AudioVoiceCount voices_requested,
SourceSet *source_request
);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Private data
//
private:
Logical
missionReviewMode;
/* AudioHardware
audioHardware;*/
L4AudioResourceManager
audioResourceManager;
AudioFrameCount
nextCalculateMixFrame;
typedef VChainOf<L4AudioSource*, AudioWeighting>
RunningSourceSocket;
typedef VChainIteratorOf<L4AudioSource*, AudioWeighting>
RunningSourceIterator;
RunningSourceSocket
runningAudioSourceSocket;
typedef ChainOf<L4AudioSource*>
DormantSourceSocket;
typedef ChainIteratorOf<L4AudioSource*>
DormantSourceIterator;
DormantSourceSocket
dormantAudioSourceSocket;
typedef VChainOf<L4AudioSource*, Enumeration>
MixingSourceSocket;
typedef VChainIteratorOf<L4AudioSource*, Enumeration>
MixingSourceIterator;
MixingSourceSocket
mixingAudioSourceSocket;
};
//~~~~~~~~~~~~~~~~~~~~~~~~~ L4AudioRenderer inlines ~~~~~~~~~~~~~~~~~~~~~~~~
/*inline AudioCard*
L4AudioRenderer::GetFrontCard()
{
Check(this);
return audioHardware.GetFrontCard();
}
inline AudioCard*
L4AudioRenderer::GetRearCard()
{
Check(this);
return audioHardware.GetRearCard();
}*/
//~~~~~~~~~~~~~~~~~~~~~~ L4AudioRenderer profile macros ~~~~~~~~~~~~~~~~~~~~
#if defined(TRACE_AUDIO_RENDERER_RUNNING_SOURCES)
extern BitTrace Audio_Renderer_Running_Sources;
#define SET_AUDIO_RUNNING_SOURCES() Audio_Renderer_Running_Sources.Set()
#define CLEAR_AUDIO_RUNNING_SOURCES() Audio_Renderer_Running_Sources.Clear()
#else
#define SET_AUDIO_RUNNING_SOURCES()
#define CLEAR_AUDIO_RUNNING_SOURCES()
#endif
#if defined(TRACE_AUDIO_RENDERER_RUNNING_SORT)
extern BitTrace Audio_Renderer_Running_Sort;
#define SET_AUDIO_RUNNING_SORT() Audio_Renderer_Running_Sort.Set()
#define CLEAR_AUDIO_RUNNING_SORT() Audio_Renderer_Running_Sort.Clear()
#else
#define SET_AUDIO_RUNNING_SORT()
#define CLEAR_AUDIO_RUNNING_SORT()
#endif
#if defined(TRACE_AUDIO_RENDERER_CALCULATE_MIX)
extern BitTrace Audio_Renderer_Calculate_Mix;
#define SET_AUDIO_CALCULATE_MIX() Audio_Renderer_Calculate_Mix.Set()
#define CLEAR_AUDIO_CALCULATE_MIX() Audio_Renderer_Calculate_Mix.Clear()
#else
#define SET_AUDIO_CALCULATE_MIX()
#define CLEAR_AUDIO_CALCULATE_MIX()
#endif
#if defined(TRACE_AUDIO_RENDERER_EXECUTE_SOURCES)
extern BitTrace Audio_Renderer_Execute_Sources;
#define SET_AUDIO_EXECUTE_SOURCES() Audio_Renderer_Execute_Sources.Set()
#define CLEAR_AUDIO_EXECUTE_SOURCES() Audio_Renderer_Execute_Sources.Clear()
#else
#define SET_AUDIO_EXECUTE_SOURCES()
#define CLEAR_AUDIO_EXECUTE_SOURCES()
#endif
#if defined(TRACE_AUDIO_RENDERER_DORMANT_SOURCES)
extern BitTrace Audio_Renderer_Dormant_Sources;
#define SET_AUDIO_DORMANT_SOURCES() Audio_Renderer_Dormant_Sources.Set()
#define CLEAR_AUDIO_DORMANT_SOURCES() Audio_Renderer_Dormant_Sources.Clear()
#else
#define SET_AUDIO_DORMANT_SOURCES()
#define CLEAR_AUDIO_DORMANT_SOURCES()
#endif