Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 109 additions & 34 deletions Mammoth/Include/TSETypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,107 +117,182 @@ static constexpr int MAX_OBJECT_LEVEL = 25; // Max level for space objects
static constexpr int MAX_ITEM_LEVEL = 25; // Max level for items

// Special UNIDs
// LATER: UNID should not be hard-coded
// TODO: UNID should not be hard-coded. Adding comments in preparation for moving the default UNID definitions to XML later.

static constexpr DWORD INVALID_UNID = 0xFFFFFFFF;

static constexpr DWORD DEFAULT_SYSTEM_TABLE_UNID = 0x0000000B; // tbBasicFragments
// This section defines fallback system part tables
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD DEFAULT_SYSTEM_TABLE_UNID = 0x0000000B; // tbBasicFragments - only used for backwards compatibility

// This section defines engine-applied damage effects
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD UNID_DAMAGED_SITE_SMALL = 0x00000050; // ovDamagedSiteSmall
static constexpr DWORD UNID_DAMAGED_SITE_MEDIUM = 0x00000051; // ovDamagedSiteMedium
static constexpr DWORD UNID_DAMAGED_SITE_LARGE = 0x00000052; // ovDamagedSiteSmall
static constexpr DWORD UNID_DEPREZ_SITE_SMALL = 0x00000053; // ovDeprezSiteSmall

// This section defines fallback thruster effects
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD UNID_MANEUVERING_THRUSTER = 0x00000090; // efManeuveringThrusterDefault
static constexpr DWORD UNID_MAIN_THRUSTER = 0x00000091; // efMainThrusterDefault

// This section defines sound effects used by the engine. An adventure may want to override these.
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD UNID_DEFAULT_ENEMY_SHIP_ALARM = 0x000000A0;
static constexpr DWORD UNID_DEFAULT_FUEL_LOW_ALARM = 0x000000A1;
static constexpr DWORD UNID_DEFAULT_RADIATION_ALARM = 0x000000A2;
static constexpr DWORD UNID_DEFAULT_HULL_BREACH_ALARM = 0x000000A3;
static constexpr DWORD UNID_DEFAULT_REACTOR_OVERLOAD_ALARM = 0x000000A4;
static constexpr DWORD UNID_DEFAULT_SHIELDS_DOWN_ALRAM = 0x000000A5;
static constexpr DWORD UNID_DEFAULT_SHIELDS_DOWN_ALRAM = 0x000000A5; // Not used, but an adventure may want to use this so it might be worth implemented after the XML switchover
static constexpr DWORD UNID_DEFAULT_BUTTON_CLICK = 0x000000A6;
static constexpr DWORD UNID_DEFAULT_SELECT = 0x000000A7;
static constexpr DWORD UNID_DEFAULT_GRAVITY_ALARM = 0x000000A8;
static constexpr DWORD UNID_DEFAULT_CANT_DO_IT = 0x000000A4; // For now, we reuse overloard alarm
static constexpr DWORD UNID_DEFAULT_CANT_DO_IT = 0x000000A4; // For now, we reuse overloard alarm. Also not used, but this should be used in place of some others later.

// This section defines a mix of UNIDs for sovereigns and economies
// Some of these are compatibility fallbacks, others are needed for filters or UI
// This may be possible to move to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD g_PlayerSovereignUNID = 0x00001001; // svPlayer
static constexpr DWORD DEFAULT_ECONOMY_UNID = 0x00001017; // ecCreditEconomy
static constexpr DWORD DEFAULT_ECONOMY_UNID = 0x00001017; // ecCreditEconomy - this is a compatibility fallback, as it can now be defined by adventures
static constexpr DWORD UNID_UNKNOWN_ENEMY = 0x00001018; // svUnknownEnemy
static constexpr DWORD UNID_NEUTRAL_SOVEREIGN = 0x00001019; // svNeutral
static constexpr DWORD UNID_NEUTRAL_SOVEREIGN = 0x00001019; // svNeutral - this is a compatibility fallback

// This section is used for filtering certain station types
// This may be possible to move to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD g_ShipWreckUNID = 0x00002001; // stShipwreck
static constexpr DWORD FLOTSAM_UNID = 0x0000200E; // stFlotsam

static constexpr DWORD PLAYER_EI500_FREIGHTER_UNID = 0x00003802; // scEI100XPlayer

// This section is used for default item icons and is not really how it should be implemented
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe) - and use the ImageTypes instead
//
static constexpr DWORD TRITIUM_PROPULSION_UPGRADE_UNID = 0x0000404B; // Tritium propulsion upgrade
static constexpr DWORD UNKNOWN_ROM_UNID = 0x00004061;
static constexpr DWORD CARGO_HOLD_EXPANSION_UNID = 0x00004079; // Cargo hold expansion
static constexpr DWORD g_SuperconductingShieldsUNID = 0x0000407D; // Superconducting shield generator
static constexpr DWORD g_SuperconductingCoilUNID = 0x0000407E; // Superconducting shield generator
static constexpr DWORD NOVA25_REACTOR_UNID = 0x00004107; // Nova-25 reactor

// This section defines default shield hit effects
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD g_ShieldEffectUNID = 0x00009004; // efShieldHit1

// This section defines default explosions and uses hardcoded explosion levels to offset by UNID
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD g_ExplosionUNID = 0x00009001; // efMediumExplosion1 - no explosion levels associated with it
static constexpr DWORD g_StationDestroyedUNID = 0x00009009; // efStationExplosion - no explosion levels associated with it
static constexpr DWORD UNID_KINETIC_EXPLOSION_1 = 0x00005007;
static constexpr DWORD UNID_BLAST_EXPLOSION_1 = 0x0000500B;
static constexpr DWORD UNID_THERMO_EXPLOSION_1 = 0x0000500F;
static constexpr DWORD UNID_PLASMA_EXPLOSION_1 = 0x00005013;
static constexpr DWORD UNID_ANTIMATTER_EXPLOSION_1 = 0x00030030;
static constexpr DWORD UNID_GRAVITON_EXPLOSION_1 = 0x00030034;
static constexpr DWORD UNID_DISINTEGRATION_EXPLOSION = 0x00030044; // no explosion levels associated with it

static constexpr DWORD g_ExplosionUNID = 0x00009001; // efMediumExplosion1
static constexpr DWORD g_ShieldEffectUNID = 0x00009004; // efShieldHit1
// This section defines default exploion sounds
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD g_ShipExplosionSoundUNID = 0x0000F204; // snShipExplosion1
static constexpr DWORD g_StationExplosionSoundUNID = 0x0000F205; // snStationExplosion1

// This section defines stargate in-out effects
// This should be moved to the stargate as standard
// However compatibility fallbacks should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD g_StargateInUNID = 0x00009005; // efStargateIn
static constexpr DWORD g_StargateOutUNID = 0x00009006; // efStargateOut
static constexpr DWORD g_StationDestroyedUNID = 0x00009009; // efStationExplosion

// This section defines station damage overlays
// This should be moved to the station as standard
// However compatibility fallbacks should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD LARGE_STATION_DAMAGE_UNID = 0x0000900E; // efLargeStationDamage
static constexpr DWORD MEDIUM_STATION_DAMAGE_UNID = 0x0000900F; // efMediumStationDamage

// This section defines default player or wingmate ship related dockscreens for compatibility fallbacks
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD DEFAULT_SHIP_SCREEN_UNID = 0x0000A001; // dsShipInterior
static constexpr DWORD COMPATIBLE_SHIP_CONFIG_SCREEN = 0x0000A01B;
static constexpr DWORD DEFAULT_DOCK_SERVICES_SCREEN = 0x00010029;
static constexpr DWORD COMPATIBLE_DOCK_SERVICES_SCREEN = 0x0001002A;
static constexpr DWORD UNID_RPG_SQUADRON_SCREEN = 0x00010123;

// This section defines default effects for compatibility fallbacks
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD g_DamageImageUNID = 0x0000F001; // rsMediumDamage
static constexpr DWORD g_LRSImageUNID = 0x0000F006; // rsZubrinLRS
static constexpr DWORD g_ShipExplosionParticlesUNID = 0x0000F114; // rsDebris1

// This section defines default images and UI effects
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD UNID_TARGETING_HUD_BACKGROUND = 0x0000F007; // rsZubrinTargeting
static constexpr DWORD UNID_SRS_SNOW_PATTERN = 0x0000F008; // rsSRSSnow
static constexpr DWORD g_LRSBorderUNID = 0x0000F009; // rsZubrinLRSBorder
static constexpr DWORD UNID_SRS_SNOW_PATTERN = 0x0000F008; // rsSRSSnow - This should be replaced with an alternative system (such as reducing sensor range) entirely because its a visual hazard for photosensitive people
static constexpr DWORD DEFAULT_REACTOR_DISPLAY_IMAGE = 0x0000F00C; // rsZubrinReactor
static constexpr DWORD DEFAULT_DOCK_SCREEN_IMAGE_UNID = 0x0000F013; // Default dock screen background
static constexpr DWORD DEFAULT_DOCK_SCREEN_MASK_UNID = 0x0000F014; // Default dock screen mask
static constexpr DWORD g_ShipExplosionParticlesUNID = 0x0000F114; // rsDebris1
static constexpr DWORD g_ShipExplosionSoundUNID = 0x0000F204; // snShipExplosion1
static constexpr DWORD g_StationExplosionSoundUNID = 0x0000F205; // snStationExplosion1
static constexpr DWORD UNID_CORE_ICON_BAR = 0x00030005;

static constexpr DWORD DEFAULT_DOCK_SERVICES_SCREEN = 0x00010029;
static constexpr DWORD COMPATIBLE_DOCK_SERVICES_SCREEN = 0x0001002A;
static constexpr DWORD UNID_RPG_SQUADRON_SCREEN = 0x00010123;
// This section defines status effect overlays
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
// However we may want to consider to allow weapons to specify this, possibly via event?
//
static constexpr DWORD UNID_TIME_STOP_OVERLAY = 0x00030080;

// This section defines the default system background effect for compatibility reasons
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD UNID_DEFAULT_SYSTEM_BACKGROUND = 0x00030001;
static constexpr DWORD UNID_CORE_ICON_BAR = 0x00030005;
static constexpr DWORD UNID_DISINTEGRATION_EXPLOSION = 0x00030044;
static constexpr DWORD UNID_TIME_STOP_OVERLAY = 0x00030080;

// This section defines a fallback enhancement for compatibility reasons
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD UNID_GENERIC_ENHANCEMENT = 0x00030140;

#ifdef DEBUG_HENCHMAN
const DWORD g_DebugHenchmenShipUNID = 0x00103001; // scCenturion
#endif
// This section defines a default character class for compatibility reasons
// This should be moved to the TranscendenceUniverse or Adventure (overrides universe)
//
static constexpr DWORD UNID_PILGRIM_CHARACTER_CLASS = 0x00201002;

// This section defines library UNIDs and is used for compatibility loading purposes
// Due to complexities with the loading system it might not be possible to move but
//
// At least some aspects of the compatibility loading system should just be defined in the
// TranscendenceUniverse itself
//
static constexpr DWORD UNID_RPG_LIBRARY = 0x00010000;
static constexpr DWORD UNID_UNIVERSE_LIBRARY = 0x00020000;
static constexpr DWORD UNID_CORE_TYPES_LIBRARY = 0x00030000;
static constexpr DWORD UNID_HUMAN_SPACE_LIBRARY = 0x00100000;
static constexpr DWORD UNID_COMPATIBILITY_LIBRARY_API26 = 0x00700000;
static constexpr DWORD UNID_COMPATIBILITY_LIBRARY_API54 = 0x00710000;

// This section defines the default adventure to use on a fresh install
// It should be defined by the TranscendenceUniverse
//
static constexpr DWORD DEFAULT_ADVENTURE_EXTENSION_UNID = 0x00200000;
static constexpr DWORD UNID_PILGRIM_CHARACTER_CLASS = 0x00201002;
static constexpr DWORD DEFAULT_COMPATIBILITY_LIBRARY_UNID = 0x00700000;
static constexpr DWORD DEFAULT_COMPATIBILITY_UNID_LIBRARY_UNID =0x00710000;

// This section defines two official extensions that use a hacky workaround to
// Compensate for switching off of the compatibility library at API28 instead of API26
//
static constexpr DWORD UNID_SOUNDTRACK_EXTENSION = 0x00820000;
static constexpr DWORD UNID_HD_EXTENSION = 0x00830000;

static constexpr DWORD UNID_DIAGNOSTICS_EXTENSION = 0xA0010000;
// This section defines the default diagnostics extension used for development/test purposes
// We should probably have a more flexible system to enable other diagnostics packages
// to be run in place of or to extend each other
//
static constexpr DWORD UNID_DIAGNOSTICS_EXTENSION = 0xA0010000;

// Object IDs

static constexpr DWORD OBJID_NULL = 0xFFFFFFFF;
static constexpr DWORD OBJID_NULL = 0xFFFFFFFF;

// Global constants

Expand Down
12 changes: 6 additions & 6 deletions Mammoth/TSE/CExtensionCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ ALERROR CExtensionCollection::AddCompatibilityLibrary (CExtension *pAdventure, c
// Add the library

CExtension *pLibrary;
if (!FindBestExtension(DEFAULT_COMPATIBILITY_LIBRARY_UNID, 1, dwFlags, &pLibrary))
if (!FindBestExtension(UNID_COMPATIBILITY_LIBRARY_API26, 1, dwFlags, &pLibrary))
{
if (retsError) *retsError = strPatternSubst(CONSTLIT("Unable to find compatibility library: %08x"), DEFAULT_COMPATIBILITY_LIBRARY_UNID);
if (retsError) *retsError = strPatternSubst(CONSTLIT("Unable to find compatibility library: %08x"), UNID_COMPATIBILITY_LIBRARY_API26);
return ERR_FAIL;
}

Expand Down Expand Up @@ -206,9 +206,9 @@ ALERROR CExtensionCollection::AddCompatibilityUNIDLibrary (CExtension *pAdventur
// Add the library

CExtension *pLibrary;
if (!FindBestExtension(DEFAULT_COMPATIBILITY_UNID_LIBRARY_UNID, 1, dwFlags, &pLibrary))
if (!FindBestExtension(UNID_COMPATIBILITY_LIBRARY_API54, 1, dwFlags, &pLibrary))
{
if (retsError) *retsError = strPatternSubst(CONSTLIT("Unable to find compatibility UNID library: %08x"), DEFAULT_COMPATIBILITY_UNID_LIBRARY_UNID);
if (retsError) *retsError = strPatternSubst(CONSTLIT("Unable to find compatibility UNID library: %08x"), UNID_COMPATIBILITY_LIBRARY_API54);
return ERR_FAIL;
}

Expand Down Expand Up @@ -933,7 +933,7 @@ void CExtensionCollection::ComputeCoreLibraries (CExtension *pExtension, TArray<

if (pExtension->GetAPIVersion() < 12)
{
if (FindBestExtension(DEFAULT_COMPATIBILITY_LIBRARY_UNID, 1, 0, &pLibrary))
if (FindBestExtension(UNID_COMPATIBILITY_LIBRARY_API26, 1, 0, &pLibrary))
retList->Insert(pLibrary);
}

Expand All @@ -942,7 +942,7 @@ void CExtensionCollection::ComputeCoreLibraries (CExtension *pExtension, TArray<

if (pExtension->GetAPIVersion() < 54)
{
if (FindBestExtension(DEFAULT_COMPATIBILITY_UNID_LIBRARY_UNID, 1, 0, &pLibrary))
if (FindBestExtension(UNID_COMPATIBILITY_LIBRARY_API54, 1, 0, &pLibrary))
retList->Insert(pLibrary);
}

Expand Down
2 changes: 1 addition & 1 deletion Mammoth/TSE/CUniverse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2509,7 +2509,7 @@ ALERROR CUniverse::SaveToStream (IWriteStream *pStream)

dwSave = 0;
dwSave |= (m_bRegistered ? 0x00000001 : 0);
dwSave |= (m_Design.FindExtension(DEFAULT_COMPATIBILITY_LIBRARY_UNID) ? 0x00000002 : 0);
dwSave |= (m_Design.FindExtension(UNID_COMPATIBILITY_LIBRARY_API26) ? 0x00000002 : 0);
pStream->Write(dwSave);

pStream->Write(m_dwNextID);
Expand Down
3 changes: 2 additions & 1 deletion Transcendence/Transcendence/CTranscendenceModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2835,7 +2835,8 @@ ALERROR CTranscendenceModel::StartNewGameBackground (const SNewGameSettings &New
for (int i = 0; i < 14; i++)
{
CFleetShipAI *pController = new CFleetShipAI;
if (error = pStartingSystem->CreateShip(g_DebugHenchmenShipUNID,
int iDebugHenchmenShipUNID = 0x00103001; //scCenturion
if (error = pStartingSystem->CreateShip(iDebugHenchmenShipUNID,
pController,
NULL,
m_Universe.FindSovereign(g_PlayerSovereignUNID),
Expand Down