From f3012e0b7241bd5140b9f818813e92bedb528eff Mon Sep 17 00:00:00 2001 From: Sad Date: Wed, 2 Sep 2026 22:29:01 -0300 Subject: [PATCH 1/6] Add Destroy to cEmpire --- Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp | 1 + Spore ModAPI/SourceCode/Simulator/cEmpire.cpp | 2 ++ Spore ModAPI/Spore/Simulator/cEmpire.h | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp index 5bc74710..d6566d10 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp @@ -369,6 +369,7 @@ namespace Simulator DefineAddress(UpdateAndGetColor, SelectAddress(0xC325F0, 0xC32E30)); DefineAddress(AddStarOwnership, SelectAddress(0xC33AB0, 0xC34300)); DefineAddress(RequireHomePlanet, SelectAddress(0xC30F90, 0xC31890)); + DefineAddress(Destroy, SelectAddress(0xC33C30, 0xC34480)); } namespace Addresses(cEnergyRepairToolStrategy) diff --git a/Spore ModAPI/SourceCode/Simulator/cEmpire.cpp b/Spore ModAPI/SourceCode/Simulator/cEmpire.cpp index f0f5f526..f04777a2 100644 --- a/Spore ModAPI/SourceCode/Simulator/cEmpire.cpp +++ b/Spore ModAPI/SourceCode/Simulator/cEmpire.cpp @@ -34,6 +34,8 @@ namespace Simulator auto_METHOD_(cEmpire, cPlanetRecord*, RequireHomePlanet); + auto_METHOD_VOID_(cEmpire, Destroy); + cStarRecord* cEmpire::GetHomeStarRecord() { if (mHomeStar.internalValue != -1) { return StarManager.GetStarRecord(mHomeStar); diff --git a/Spore ModAPI/Spore/Simulator/cEmpire.h b/Spore ModAPI/Spore/Simulator/cEmpire.h index de03dcc6..e4fd2b64 100644 --- a/Spore ModAPI/Spore/Simulator/cEmpire.h +++ b/Spore ModAPI/Spore/Simulator/cEmpire.h @@ -78,6 +78,9 @@ namespace Simulator /// Makes this empire the owner of the given star. It will emit a kMsgStarOwnershipChanged message. void AddStarOwnership(cStarRecord* star); + /// Called when the empire loses its last system. + void Destroy(); + /// Captures a star system for a specific empire. This can only be used when the star belongs to another empire. /// For any kind of star, use cEmpire::AddStarOwnership /// @param pStarRecord The star system to capture. @@ -142,6 +145,7 @@ namespace Simulator DeclareAddress(UpdateAndGetColor); // 0xC325F0 0xC32E30 DeclareAddress(AddStarOwnership); // 0xC33AB0 0xC34300 DeclareAddress(RequireHomePlanet); // 0xC30F90 0xC31890 + DeclareAddress(Destroy); // 0xC33C30 0xC34480 } } From 8e5b3ac7264def3aa8b656edd6fd6e983974b4a0 Mon Sep 17 00:00:00 2001 From: Sad Date: Sat, 19 Sep 2026 02:13:45 -0300 Subject: [PATCH 2/6] Add CalculateRelationship and CalculateRelationshipAbsolute to cRelationshipManager.h --- .../SourceCode/DLL/AddressesSimulator.cpp | 2 ++ .../Simulator/RelationshipManager.cpp | 4 ++++ .../SubSystem/cRelationshipManager.h | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp index d6566d10..8471c274 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp @@ -549,6 +549,8 @@ namespace Simulator DefineAddress(ApplyRelationship, SelectAddress(0xD054E0, 0xD06280)); DefineAddress(RelationshipExists, SelectAddress(0xD010C0, 0xD01B90)); DefineAddress(GetRelationshipEventValue, SelectAddress(0xD010F0, 0xD01BC0)); + DefineAddress(CalculateRelationship, SelectAddress(0xCFFF60, 0xD00950)); + DefineAddress(CalculateRelationshipAbsolute, SelectAddress(0xD04CC0, 0xD05A60)); } namespace Addresses(cGameBehaviorManager) diff --git a/Spore ModAPI/SourceCode/Simulator/RelationshipManager.cpp b/Spore ModAPI/SourceCode/Simulator/RelationshipManager.cpp index 0490c8f1..d5559da3 100644 --- a/Spore ModAPI/SourceCode/Simulator/RelationshipManager.cpp +++ b/Spore ModAPI/SourceCode/Simulator/RelationshipManager.cpp @@ -45,6 +45,10 @@ namespace Simulator auto_METHOD(cRelationshipManager, float, GetRelationshipEventValue, Args(uint32_t id1, uint32_t id2, uint32_t eventId), Args(id1, id2, eventId)); + auto_METHOD(cRelationshipManager, float, CalculateRelationship, Args(uint32_t id1, uint32_t id2, bool useCachedValue), Args(id1, id2, useCachedValue)); + + auto_METHOD(cRelationshipManager, float, CalculateRelationshipAbsolute, Args(uint32_t id1, uint32_t id2, bool useCachedValue), Args(id1, id2, useCachedValue)); + bool cRelationshipManager::IsAtWar(uint32_t politicalID1, uint32_t politicalID2) { return CALL(GetAddress(cRelationshipManager, IsAtWar2), bool, Args(cRelationshipManager*, uint32_t, uint32_t), Args(this, politicalID1, politicalID2)); } diff --git a/Spore ModAPI/Spore/Simulator/SubSystem/cRelationshipManager.h b/Spore ModAPI/Spore/Simulator/SubSystem/cRelationshipManager.h index c2286ef5..5d7292d6 100644 --- a/Spore ModAPI/Spore/Simulator/SubSystem/cRelationshipManager.h +++ b/Spore ModAPI/Spore/Simulator/SubSystem/cRelationshipManager.h @@ -157,6 +157,23 @@ namespace Simulator if (it != mRelationships.end()) { return &(it->second); } { return nullptr; } } + + /// Calculates the relationship value between two political entities, which is the sum of all the relationship events between the entities. + /// The value is capped between 10.0f and -10.0f. + /// @param politicalID1 + /// @param politicalID2 + /// @param useCachedValue If true, uses a cached value instead of performing the sum. + /// @returns The relationship value between the two political entities, capped between 10.0f and -10.0f. + float CalculateRelationship(uint32_t politicalID1, uint32_t politicalID2, bool useCachedValue); + + /// Calculates the relationship value between two political entities, that being the sum of all the relationship events between the entities. + /// Unlike CalculateRelationship(), the value is not capped. + /// @param politicalID1 + /// @param politicalID2 + /// @param useCachedValue If true, uses a cached value instead of performing the sum. + /// @returns The relationship value between the two political entities. + float CalculateRelationshipAbsolute(uint32_t politicalID1, uint32_t politicalID2, bool useCachedValue); + public: /* 10h */ float field_10; /* 14h */ float field_14; @@ -205,5 +222,7 @@ namespace Simulator DeclareAddress(ApplyRelationship); DeclareAddress(RelationshipExists); DeclareAddress(GetRelationshipEventValue); + DeclareAddress(CalculateRelationship); // 0xCFFF60 0xD00950 + DeclareAddress(CalculateRelationshipAbsolute); // 0xD04CC0 0xD05A60 } } From afd41716414ae39a858a78d23fe5f88cc1ff070a Mon Sep 17 00:00:00 2001 From: Sad Date: Sun, 20 Sep 2026 15:16:49 -0300 Subject: [PATCH 3/6] add BuildSpiceCommodities to SpaceTrading.h --- Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp | 1 + Spore ModAPI/SourceCode/Simulator/SimulatorSpaceGame.cpp | 2 ++ Spore ModAPI/Spore/Simulator/SubSystem/SpaceTrading.h | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp index 8471c274..f443965f 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp @@ -1184,6 +1184,7 @@ namespace Simulator DefineAddress(SetRareAsFound, SelectAddress(0x1040820, 0x103FBB0)); DefineAddress(GenerateNPCStore, SelectAddress(0x103F560, 0x103E8F0)); DefineAddress(CreateTradingObject, SelectAddress(0x103B470, 0x103A490)); + DefineAddress(BuildSpiceCommodities, SelectAddress(0x0103D650, 0x0103C950)); } namespace Addresses(cScenarioEditModeDisplayStrategy) { diff --git a/Spore ModAPI/SourceCode/Simulator/SimulatorSpaceGame.cpp b/Spore ModAPI/SourceCode/Simulator/SimulatorSpaceGame.cpp index c2b7faba..6c80512f 100644 --- a/Spore ModAPI/SourceCode/Simulator/SimulatorSpaceGame.cpp +++ b/Spore ModAPI/SourceCode/Simulator/SimulatorSpaceGame.cpp @@ -62,5 +62,7 @@ namespace Simulator auto_METHOD_VOID(cSpaceTrading, CreateTradingObject, Args(cSpaceInventoryItemPtr& dst, const ResourceKey& itemID, int itemCount, float itemCost), Args(dst, itemID, itemCount, itemCost)); + + auto_METHOD_VOID_(cSpaceTrading, BuildSpiceCommodities); } #endif diff --git a/Spore ModAPI/Spore/Simulator/SubSystem/SpaceTrading.h b/Spore ModAPI/Spore/Simulator/SubSystem/SpaceTrading.h index 33dcda1c..aba2bb0c 100644 --- a/Spore ModAPI/Spore/Simulator/SubSystem/SpaceTrading.h +++ b/Spore ModAPI/Spore/Simulator/SubSystem/SpaceTrading.h @@ -97,6 +97,11 @@ namespace Simulator /// @param itemCost Cost of the object void CreateTradingObject(cSpaceInventoryItemPtr& dst, const ResourceKey& itemID, int itemCount, float itemCost); + /// Populates `mSpices` with the resource keys of every `.prop` file in the `GroupIDs::SpaceTrading_` group + /// whose `spaceTradingType` is set to `spice`. + /// Has no effect if `mSpices` is not empty. + void BuildSpiceCommodities(); + public: struct RareGroup { /* 00h */ uint32_t mGroupID; @@ -134,5 +139,6 @@ namespace Simulator DeclareAddress(SetRareAsFound); // 0x1040820 0x103FBB0 DeclareAddress(GenerateNPCStore); // 0x103F560 0x103E8F0 DeclareAddress(CreateTradingObject); // 0x103B470 0x103A490 + DeclareAddress(BuildSpiceCommodities); // 0x0103D650 0x0103C950 } } \ No newline at end of file From bf897affb1a47128b68c3232e08807cf11607ff9 Mon Sep 17 00:00:00 2001 From: Sad Date: Sun, 20 Sep 2026 16:12:18 -0300 Subject: [PATCH 4/6] Add GetWeaponryLevel to cEmpire.h --- Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp | 1 + Spore ModAPI/SourceCode/Simulator/cEmpire.cpp | 2 ++ Spore ModAPI/Spore/Simulator/cEmpire.h | 13 +++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp index f443965f..47e1ec53 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp @@ -370,6 +370,7 @@ namespace Simulator DefineAddress(AddStarOwnership, SelectAddress(0xC33AB0, 0xC34300)); DefineAddress(RequireHomePlanet, SelectAddress(0xC30F90, 0xC31890)); DefineAddress(Destroy, SelectAddress(0xC33C30, 0xC34480)); + DefineAddress(GetWeaponryLevel, SelectAddress(0xC31000, 0xC31900)); } namespace Addresses(cEnergyRepairToolStrategy) diff --git a/Spore ModAPI/SourceCode/Simulator/cEmpire.cpp b/Spore ModAPI/SourceCode/Simulator/cEmpire.cpp index f04777a2..b6c0dbef 100644 --- a/Spore ModAPI/SourceCode/Simulator/cEmpire.cpp +++ b/Spore ModAPI/SourceCode/Simulator/cEmpire.cpp @@ -36,6 +36,8 @@ namespace Simulator auto_METHOD_VOID_(cEmpire, Destroy); + auto_METHOD_(cEmpire, int, GetWeaponryLevel); + cStarRecord* cEmpire::GetHomeStarRecord() { if (mHomeStar.internalValue != -1) { return StarManager.GetStarRecord(mHomeStar); diff --git a/Spore ModAPI/Spore/Simulator/cEmpire.h b/Spore ModAPI/Spore/Simulator/cEmpire.h index e4fd2b64..be21cf6d 100644 --- a/Spore ModAPI/Spore/Simulator/cEmpire.h +++ b/Spore ModAPI/Spore/Simulator/cEmpire.h @@ -81,6 +81,15 @@ namespace Simulator /// Called when the empire loses its last system. void Destroy(); + /// Returns the empire's weaponry level, which determines the 'level' of the empire. + /// If `mWeaponry` is greater or equal than 0, that cached value is returned directly. + /// Otherwise, the level is calculated from the empire's number of star systems, using the + /// thresholds defined in `spaceshipWeaponEmpireSize` (SpaceCombat.prop), the result is then + /// cached in `mWeaponry` before being returned. + /// The Grox empire always has a weaponry level of 5. + /// @returns The empire's weaponry level. + int GetWeaponryLevel(); + /// Captures a star system for a specific empire. This can only be used when the star belongs to another empire. /// For any kind of star, use cEmpire::AddStarOwnership /// @param pStarRecord The star system to capture. @@ -107,8 +116,7 @@ namespace Simulator /* C4h */ ResourceKey mCaptainKey; /* D0h */ int mEmpireMoney; /* D4h */ char mTravelDistance; // 3 - //TODO sub_C31000 GetEmpireTier ? - /* D8h */ int field_D8; // -1 //TODO empire size? Related with combat tuning, check loc_C31039 + /* D8h */ int mWeaponry; // -1 /* DCh */ float field_DC; /* E0h */ float field_E0; /* E4h */ float field_E4; @@ -146,6 +154,7 @@ namespace Simulator DeclareAddress(AddStarOwnership); // 0xC33AB0 0xC34300 DeclareAddress(RequireHomePlanet); // 0xC30F90 0xC31890 DeclareAddress(Destroy); // 0xC33C30 0xC34480 + DeclareAddress(GetWeaponryLevel); // 0xC31000 0xC31900 } } From 6ff7145fca73fec3ac41ab99529689fac2ad97a8 Mon Sep 17 00:00:00 2001 From: Sad Date: Sun, 20 Sep 2026 22:37:20 -0300 Subject: [PATCH 5/6] Add GetDefaultTerrainThemeFlora, PickPlantSpecies and PickAnimalSpecies to cStarManager.h --- .../SourceCode/DLL/AddressesSimulator.cpp | 3 ++ .../SourceCode/Simulator/StarManager.cpp | 12 ++++++ .../Spore/Simulator/SubSystem/StarManager.h | 39 +++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp index 47e1ec53..36e33c39 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp @@ -638,6 +638,9 @@ namespace Simulator DefineAddress(GenerateSolSystem, SelectAddress(0xBB1A00, 0xBB2BF0)); DefineAddress(RequirePlanetsForStar, SelectAddress(0xBB3AA0, 0xBB4C90)); DefineAddress(GeneratePlanetsForStar, SelectAddress(0xBB30B0, 0xBB42A0)); + DefineAddress(GetDefaultTerrainThemeFlora, SelectAddress(0xBABFF0, 0xBAD210)); + DefineAddress(PickPlantSpecies, SelectAddress(0xBAB7A0, 0xBAC9C0)); + DefineAddress(PickAnimalSpecies, SelectAddress(0xBABC40, 0xBACE60)); } namespace Addresses(cSpaceTradeRouteManager) diff --git a/Spore ModAPI/SourceCode/Simulator/StarManager.cpp b/Spore ModAPI/SourceCode/Simulator/StarManager.cpp index d051cd04..eea18af4 100644 --- a/Spore ModAPI/SourceCode/Simulator/StarManager.cpp +++ b/Spore ModAPI/SourceCode/Simulator/StarManager.cpp @@ -123,6 +123,18 @@ namespace Simulator Args(cStarRecord* pStarRecord, StarRequestFilter* pFilter, bool arg), Args(pStarRecord, pFilter, arg)); + auto_METHOD_VOID(cStarManager, GetDefaultTerrainThemeFlora, + Args(const ResourceKey& planetTerrainKey, eastl::vector& plantSpecies), + Args(planetTerrainKey, plantSpecies)); + + auto_METHOD_VOID(cStarManager, PickPlantSpecies, + Args(const eastl::vector& speciesIDs, int tScore, int numFullRows, int numFullColumns, bool fillAllSlots, eastl::vector& selections), + Args(speciesIDs, tScore, numFullRows, numFullColumns, fillAllSlots, selections)); + + auto_METHOD_VOID(cStarManager, PickAnimalSpecies, + Args(const eastl::vector& speciesIDs, int tScore, int numFullRows, int numHerbivoreSlots, int numCarnivoreSlots, eastl::vector& selections), + Args(speciesIDs, tScore, numFullRows, numHerbivoreSlots, numCarnivoreSlots, selections)); + auto_STATIC_METHOD(cStarManager, bool, StarGenerationMessageHandler, Args(uint32_t messageId, Swarm::Components::DistributeEffectMessageData* pDistributeData, StarType starType), Args(messageId, pDistributeData, starType)); diff --git a/Spore ModAPI/Spore/Simulator/SubSystem/StarManager.h b/Spore ModAPI/Spore/Simulator/SubSystem/StarManager.h index 5c499736..30515029 100644 --- a/Spore ModAPI/Spore/Simulator/SubSystem/StarManager.h +++ b/Spore ModAPI/Spore/Simulator/SubSystem/StarManager.h @@ -258,6 +258,42 @@ namespace Simulator /// @param useMaxPlanets If true, spawn the maximum amount of planets. void GeneratePlanetsForStar(cStarRecord* pStarRecord, StarRequestFilter* pFilter, bool useMaxPlanets); + /// Gets the complete flora ecosystem associated with `planetTerrainKey`, or an arbitrary one if the terrain key doesn't have one. + /// @param planetTerrainKey + /// @param[out] plantSpecies Output vector with the flora for the terrain key: 3 big flora, 3 medium flora, and 3 small flora. + void GetDefaultTerrainThemeFlora(const ResourceKey& planetTerrainKey, eastl::vector& plantSpecies); + + /// Picks the flora to use for a planet's food web from `speciesIDs`, according to the given parameters, and returns the result in `selections`. + /// @param speciesIDs Vector of 9 flora (3 big, 3 medium, 3 small) obtained from GetDefaultTerrainThemeFlora, from which `selections` is populated. + /// @param tScore Terrascore of the planet the flora is being chosen for, caps the number of flora placed into `selections`. + /// @param numFullRows Number between 0 and `tScore`, for each full row, one flora of each size (big, medium, small) is added to `selections`. + /// @param numFullColumns Number between 0 and 3, number of flora filling the uppermost row of the food web. + /// @param fillAllSlots If true, all 9 flora from `speciesIDs` are placed into `selections`, ignoring the other parameters. + /// @param[out] selections Output vector with the flora that were picked. + void PickPlantSpecies( + const eastl::vector& speciesIDs, + int tScore, + int numFullRows, + int numFullColumns, + bool fillAllSlots, + eastl::vector& selections); + + /// Picks the animal species to use for a planet's food web from `speciesIDs`, according to the given parameters, and returns the result in `selections`. + /// @param speciesIDs Vector of 9 animals (6 herbivores, 3 carnivores) obtained from a previous call to PickAnimalSpecies, + /// from which `selections` is populated, if empty, the species are sourced elsewhere. + /// @param tScore Terrascore of the planet the species are being chosen for, caps the number of species placed into `selections`. + /// @param numFullRows Number between 0 and `tScore`, for each full row, 2 herbivores and 1 carnivore are added to `selections`. + /// @param numHerbivoreSlots Number between 0 and 2, number of herbivores filling the uppermost row of the food web. + /// @param numCarnivoreSlots Number between 0 and 1, number of carnivores filling the uppermost row of the food web. + /// @param[out] selections Output vector with the species that were picked. + void PickAnimalSpecies( + const eastl::vector& speciesIDs, + int tScore, + int numFullRows, + int numHerbivoreSlots, + int numCarnivoreSlots, + eastl::vector& selections); + /// Method used by the galaxy generation effect to create the cStarRecord instances. This method is the handler of the corresponding /// `kMsgGalaxyGenerate...` messages, such as SimulatorMessages::kMsgGalaxyGenerateBlackHole. The method generates /// one cStarRecord for every entry in the `pDistributeData` object. @@ -347,6 +383,9 @@ namespace Simulator DeclareAddress(GenerateSolSystem); // 0xBB1A00, 0xBB2BF0 DeclareAddress(RequirePlanetsForStar); // 0xBB3AA0 0xBB4C90 DeclareAddress(GeneratePlanetsForStar); // 0xBB30B0 0xBB42A0 + DeclareAddress(GetDefaultTerrainThemeFlora); //0xBABFF0 0xBAD210 + DeclareAddress(PickPlantSpecies); // 0xBAB7A0, 0xBAC9C0 + DeclareAddress(PickAnimalSpecies); // 0xBABC40 0xBACE60 } namespace Addresses(cSpaceTradeRouteManager) From 17578e590f9672d69af4db1bcf085854d187445a Mon Sep 17 00:00:00 2001 From: Sad Date: Sun, 20 Sep 2026 23:17:03 -0300 Subject: [PATCH 6/6] Add SpawnUFO to cGameDataUFO.h --- Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp | 1 + Spore ModAPI/SourceCode/Simulator/cGameDataUFO.cpp | 4 ++++ Spore ModAPI/Spore/Simulator/cGameDataUFO.h | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp index 36e33c39..7518c0fc 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp @@ -152,6 +152,7 @@ namespace Addresses(Simulator) DefineAddress(sCreatureGameUnlockCategoriesCount, SelectAddress(0x1587278, 0x1583298)); DefineAddress(CreateUFO, SelectAddress(0x102BB50, 0x102AC60)); + DefineAddress(SpawnUFO, SelectAddress(0x102BBB0, 0x102ACC0)); DefineAddress(SpawnNpcTribe, SelectAddress(0xC92860, 0xC932F0)); DefineAddress(sTribeFishHotSpots_ptr, SelectAddress(0x157EB90 ,0x157ABB0)); diff --git a/Spore ModAPI/SourceCode/Simulator/cGameDataUFO.cpp b/Spore ModAPI/SourceCode/Simulator/cGameDataUFO.cpp index 5838d775..276fc114 100644 --- a/Spore ModAPI/SourceCode/Simulator/cGameDataUFO.cpp +++ b/Spore ModAPI/SourceCode/Simulator/cGameDataUFO.cpp @@ -26,5 +26,9 @@ namespace Simulator auto_METHOD_VOID(cGameDataUFO, Initialize, Args(UfoType type, cEmpire* empire), Args(type, empire)); auto_STATIC_METHOD(Simulator, cGameDataUFO*, CreateUFO, Args(UfoType type, cEmpire* empire), Args(type, empire)); + + auto_STATIC_METHOD(Simulator, cGameDataUFO*, SpawnUFO, + Args(UfoType type, const uint32_t& politicalID, const ResourceKey& modelKey), + Args(type, politicalID, modelKey)); } #endif diff --git a/Spore ModAPI/Spore/Simulator/cGameDataUFO.h b/Spore ModAPI/Spore/Simulator/cGameDataUFO.h index 8d1df49a..91eeae63 100644 --- a/Spore ModAPI/Spore/Simulator/cGameDataUFO.h +++ b/Spore ModAPI/Spore/Simulator/cGameDataUFO.h @@ -133,6 +133,14 @@ namespace Simulator DeclareAddress(Initialize); // 0xC3D8D0 0xC3E210 } + /// Spawns a new UFO instance of the given type and assigns it to the empire with the given politicalID. + /// It will have full AI, show up on the minimap, and have the color of the corresponding empire. + /// @param type + /// @param politicalID + /// @param modelKey Resource key of a UFO model, the spawned UFO will use this model. + /// @returns + cGameDataUFO* SpawnUFO(UfoType type, const uint32_t& politicalID, const ResourceKey& modelKey); + /// Creates a new UFO instance of the given type and assigned to the specified empire. /// It will call cGameDataUFO::Initialize(), which sets up the necessary tools and AI. /// @param type @@ -144,4 +152,5 @@ namespace Simulator namespace Addresses(Simulator) { DeclareAddress(CreateUFO); // 0x102BB50 0x102AC60 + DeclareAddress(SpawnUFO); // 0x102BBB0 0x102ACC0 } \ No newline at end of file