Files
BT411/engine/MUNGA/MISSION.h
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

275 lines
5.5 KiB
C++

#pragma once
#include "cstr.h"
#include "schain.h"
#include "vchain.h"
#include "resource.h"
#include "host.h"
#include "scnrole.h"
class BitMap;
//##########################################################################
//####################### MissionHostData ############################
//##########################################################################
class MissionHostData : public Plug
{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Construction, Destruction
//
public:
MissionHostData(const CString &address_string, HostType host_type);
virtual ~MissionHostData();
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Accessors
//
public:
CString GetAddressString() { return addressString; }
HostType GetHostType() { return hostType; }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Private data
//
private:
CString addressString;
HostType hostType;
};
//##########################################################################
//########################### Mission ################################
//##########################################################################
class Mission SIGNATURED
{
friend class Mission_HostIterator;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Public types
//
public:
typedef Mission_HostIterator HostIterator;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Construction, Destruction, and Testing
//
public:
Mission(
NotationFile *notation_file,
ResourceFile *resources
);
virtual ~Mission();
Logical
TestInstance() const;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Set the player data
//
public:
virtual void
SetPlayerData(NotationFile *notation_file);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Accessors
//
public:
ResourceDescription::ResourceID
GetMapID();
ResourceDescription::ResourceID
GetExistanceMapID();
const char*
GetDropZoneName()
{Check(this); return dropZoneName;}
const char*
GetGameModel()
{Check(this); return gameModel;}
Logical
IsDropZoneHost()
{Check(this); return dropZoneHost;}
const char*
GetColorName()
{Check(this); return colorName;}
const char*
GetBadgeName()
{Check(this); return badgeName;}
const char*
GetMissionTime()
{Check(this); return missionTime;}
const char*
GetMissionWeather()
{Check(this); return missionWeather;}
const char*
GetScenarioName()
{Check(this); return scenarioName;}
int
GetTeamID()
{ Check(this); return teamID; }
int
GetPlayerCount()
{Check(this); return playerCount;}
const char*
GetPositionName()
{ Check(this); return positionName; }
Scalar
GetGameLength()
{ Check(this); return gameLength; }
BitMap*
GetLargeNameBitmap(int index)
{
Check(this);
return largeNameBitmapChain.Find(index);
}
BitMap*
GetSmallNameBitmap(int index)
{
Check(this);
return smallNameBitmapChain.Find(index);
}
BitMap*
GetOrdinalBitmap(int index)
{
Check(this);
return ordinalBitmapChain.Find(index);
}
BitMap*
GetTeamBitmap(int team_index)
{
Check(this);
return teamBitmapChain.Find(team_index);
}
BitMap*
GetLandmarkBitmap(int landmark_index)
{
Check(this);
return landmarkBitmapChain.Find(landmark_index);
}
int
GetPlayerBitmapIndex() const
{Check(this); return playerBitmapIndex;}
ScenarioRole*
GetScenarioRole(const CString &role_name)
{
Check(this);
VChainIteratorOf<ScenarioRole*, CString> iterator(scenarioRoleChain);
return iterator.Find(role_name);
}
void
AddScenarioRole(ScenarioRole *scenario_role)
{
Check(this);
Check(scenario_role);
if (!GetScenarioRole(scenario_role->GetRoleName()))
{
scenarioRoleChain.AddValue(scenario_role, scenario_role->GetRoleName());
}
#if DEBUG_LEVEL > 0
else
{
Tell(scenario_role->GetRoleName());
Warn(" already exists not adding to Mission \n");
}
#endif
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Protected data
//
protected:
ResourceDescription::ResourceID
mapID,
existanceMapID;
SChainOf<MissionHostData*>
missionHostSocket;
char
*colorName,
*badgeName,
*dropZoneName,
*gameModel,
*missionTime,
*missionWeather,
*scenarioName;
Logical
dropZoneHost;
char
*positionName;
int
teamID,
playerCount;
int
playerBitmapIndex;
VChainOf<ScenarioRole*, CString>
scenarioRoleChain;
VChainOf<BitMap*, int>
largeNameBitmapChain,
smallNameBitmapChain;
VChainOf<BitMap*, int>
ordinalBitmapChain;
VChainOf<BitMap*, int>
teamBitmapChain;
VChainOf<BitMap*, int>
landmarkBitmapChain;
void
LoadOrdinalBitmaps(NotationFile *notation_file);
void
LoadNameBitmaps(NotationFile *notation_file);
void
LoadTeamBitmaps(NotationFile *notation_file);
void
LoadLandmarkBitmaps(NotationFile *notation_file);
Scalar
gameLength;
};
inline ResourceDescription::ResourceID
Mission::GetMapID()
{
Check(this);
return mapID;
}
inline ResourceDescription::ResourceID
Mission::GetExistanceMapID()
{
Check(this);
return existanceMapID;
}
//##########################################################################
//##################### Mission_HostIterator #########################
//##########################################################################
class Mission_HostIterator:
public SChainIteratorOf<MissionHostData*>
{
public:
Mission_HostIterator(Mission *mission);
~Mission_HostIterator();
};