Skip to content

Commit

Permalink
3rdParty: update Spore-ModAPI to v2.5.327
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Aug 4, 2024
1 parent 591cf63 commit b5a034e
Show file tree
Hide file tree
Showing 13 changed files with 161 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 3rdParty/BuildSporeModAPI.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set SPOREMODAPI_CUR_DIR=%~dp0

msbuild "%SPOREMODAPI_CUR_DIR%\Spore-ModAPI\Spore ModAPI" ^
/p:Configuration="Release DLL" ^
/p:SDK_BUILD_VER=324 ^
/p:SDK_BUILD_VER=327 ^
/p:EXECUTABLE_TYPE=10 ^
/p:Platform=Win32 ^
/m
4 changes: 2 additions & 2 deletions 3rdParty/Spore-ModAPI/.gitrepo
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[subrepo]
remote = [email protected]:emd4600/Spore-ModAPI.git
branch = master
commit = 6108aaf8a4ab9d3d430ae9b020cce794162f1895
parent = efe450b69168156a4fd745e2b27347647bb3c88d
commit = b4eee234431e61ca3dc2fdec54d91b36f753c426
parent = 591cf63f26650206adb0b71c570941b9f6c7b577
method = merge
cmdver = 0.4.6
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,7 @@ namespace Simulator
DefineAddress(GetPerihelion, SelectAddress(0xC70190, 0xC70FC0));
DefineAddress(FillPlanetDataForTechLevel, SelectAddress(0xB96820, 0xB97090));
DefineAddress(CalculateSpiceProduction, SelectAddress(0xC6F920, 0xC70760));
DefineAddress(CalculateDeltaSpiceProduction, SelectAddress(0xC71200, 0xC720A0));
}

namespace Addresses(cCivData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,11 @@ namespace Simulator

auto_STATIC_METHOD(cPlanetRecord, int, CalculateSpiceProduction,
Args(cPlanetRecord* planetRecord, int removeSpice), Args(planetRecord, removeSpice));

auto_STATIC_METHOD(cPlanetRecord, float, CalculateDeltaSpiceProduction,
Args(float baseValue, float maxOutput, float extraFactor, bool isHomeWorld,
bool useSuperpowerMultiplier, bool useStorageMultiplier, float finalFactor, int numCities, bool limitOutput),
Args(baseValue, maxOutput, extraFactor, isHomeWorld, useSuperpowerMultiplier, useStorageMultiplier, finalFactor, numCities, limitOutput));

}
#endif
3 changes: 3 additions & 0 deletions 3rdParty/Spore-ModAPI/Spore ModAPI/Spore ModAPI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -437,13 +437,16 @@
<ClInclude Include="Spore\Simulator\cObjectPool.h" />
<ClInclude Include="Spore\Simulator\cPlanetaryArtifact.h" />
<ClInclude Include="Spore\Simulator\cPlantCargoInfo.h" />
<ClInclude Include="Spore\Simulator\cRaidEvent.h" />
<ClInclude Include="Spore\Simulator\cRaidPlunderEvent.h" />
<ClInclude Include="Spore\Simulator\cResourceProjectile.h" />
<ClInclude Include="Spore\Simulator\cScenarioEditHistory.h" />
<ClInclude Include="Spore\Simulator\cScenarioEconomy.h" />
<ClInclude Include="Spore\Simulator\cScenarioData.h" />
<ClInclude Include="Spore\Simulator\cScenarioPlayMode.h" />
<ClInclude Include="Spore\Simulator\cScenarioSimulator.h" />
<ClInclude Include="Spore\Simulator\cScenarioTerraformMode.h" />
<ClInclude Include="Spore\Simulator\cShipBackgroundData.h" />
<ClInclude Include="Spore\Simulator\cSimPlanetHighLOD.h" />
<ClInclude Include="Spore\Simulator\cSimulatorUniverse.h" />
<ClInclude Include="Spore\Simulator\cSolarHitSphere.h" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2181,6 +2181,15 @@
<ClInclude Include="Spore\Simulator\cPlanetaryArtifact.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Simulator\cRaidEvent.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Simulator\cRaidPlunderEvent.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Simulator\cShipBackgroundData.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="SourceCode\Allocator.cpp">
Expand Down
2 changes: 2 additions & 0 deletions 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
#include <Spore\Simulator\cMovableDestructibleOrnament.h>
#include <Spore\Simulator\cToolObject.h>
#include <Spore\Simulator\cPlanetaryArtifact.h>
#include <Spore\Simulator\cRaidEvent.h>
#include <Spore\Simulator\cRaidPlunderEvent.h>

#include <Spore\Simulator\SimulatorMessages.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ namespace Simulator
/// @param pEmpire
void SetTargetEmpire(cEmpire* pEmpire);

inline void AcceptMission() {
SetState(MissionState::Accepted);
}
inline void CompleteMission() {
SetState(MissionState::Completed);
}

/* 54h */ virtual int func54h();
/* 58h */ virtual int func58h();
/* 5Ch */ virtual int func5Ch();
Expand Down Expand Up @@ -283,7 +290,7 @@ namespace Simulator
/* 108h */ eastl::vector<int> field_108;
/* 11Ch */ eastl::vector<ResourceKey> mUnlockToolIDList;
/* 130h */ int mFlags;
/* 134h */ eastl::vector<int> field_134;
/* 134h */ eastl::vector<uint32_t> mAssociatedEventLogIDs;
/* 148h */ uint32_t mProgressEventID; // -1
/* 14Ch */ eastl::string16 mTitle;
/* 15Ch */ eastl::string16 field_15C;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace Simulator
/// @param pOwnerEmpire Empire that is assigning the mission.
/// @param pParentMission Parent mission, this is generally null unless you want the new mission to be part of a larger, multi-step mission.
/// @returns The created cMission subclass object, or nullptr.
cMission* CreateMission(uint32_t missionID, cPlanetRecord* pSourcePlanetRecord, cEmpire* pOwnerEmpire, cMission* pParentMission);
cMission* CreateMission(uint32_t missionID, cPlanetRecord* pSourcePlanetRecord, cEmpire* pOwnerEmpire, cMission* pParentMission = nullptr);

/// This function decides what mission needs to be done for the given empire.
/// To be precise, if you communicate with empire `pEmpire` on planet `pPlanetRecord`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,30 @@ namespace Simulator
/// @param techLevel
static void FillPlanetDataForTechLevel(cPlanetRecord* planetRecord, TechLevel techLevel);

/// Calculates the current spice production of a planet, which is the sum of the
/// Calculates the current total spice of a planet, which is the sum of the
/// production of all its cities. If 'removeSpice' is not 0, that amount of spice will be
/// removed from the planet.
/// @param planetRecord
/// @param removeSpice
/// @returns The total spice production of the planet.
static int CalculateSpiceProduction(cPlanetRecord* planetRecord, int removeSpice = 0);

/// Method that calculates how much spice is being produced on a single planet, based on difficulty tunings
/// and number of cities. This method is called every X ticks to update the total spice held on each city.
/// @param baseValue Base value of the computation (e.g. cCityData::mSpiceProduction)
/// @param maxOutput Maximum output value, only applied if `limitOutput` is true
/// @param extraFactor Extra multilpier for the base value
/// @param isHomeWorld
/// @param useSuperpowerMultiplier
/// @param useStorageMultiplier
/// @param finalFactor Extra multiplied applied to the final output value
/// @param numCities
/// @param limitOutput If true, the output value will be capped at `maxOutput`
/// @returns
static float CalculateDeltaSpiceProduction(
float baseValue, float maxOutput, float extraFactor, bool isHomeWorld,
bool useSuperpowerMultiplier, bool useStorageMultiplier, float finalFactor, int numCities, bool limitOutput);

public:
/* 18h */ eastl::string16 mName;
/// The type of the planet, which determines whether it is a gas giant, asteroid belt, or regular rocky planet.
Expand Down Expand Up @@ -261,6 +277,7 @@ namespace Simulator
DeclareAddress(GetPerihelion); // 0xC70190 0xC70FC0
DeclareAddress(FillPlanetDataForTechLevel); // 0xB96820 0xB97090
DeclareAddress(CalculateSpiceProduction); // 0xC6F920 0xC70760
DeclareAddress(CalculateDeltaSpiceProduction); // 0xC71200 0xC720A0
}

inline ResourceKey cPlanetRecord::GenerateTerrainKey()
Expand Down
49 changes: 49 additions & 0 deletions 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cRaidEvent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#pragma once

#include <Spore\Simulator\cMission.h>
#include <Spore\Simulator\cGameDataUFO.h>
#include <Spore\Simulator\cShipBackgroundData.h>

namespace Simulator
{
/// The kind of mission for raid events. Example usage, to raid the current planet:
/// ```cpp
/// using namespace Simulator;
/// auto planet = GetActivePlanetRecord();
/// auto empireID = planet->GetStarRecord()->mEmpireID;
/// auto empire = StarManager.GetEmpire(empireID);
/// auto mission = MissionManager.CreateMission(id("RaidEvent"), planet, empire);
/// auto raidEvent = object_cast<cRaidEvent>(mission);
/// raidEvent->mpTargetPlanet = GetActivePlanet();
/// raidEvent->mNumBombers = 10;
/// raidEvent->AcceptMission();
/// ```
class cRaidEvent
: public cMission
{
public:
static const uint32_t TYPE = 0x3960C0E;
static const uint32_t NOUN_ID = 0x3960C0A;

public:
/* 1F0h */ cGameDataUFOPtr mGalaxyBomber;
/* 1F4h */ int mOriginStarRecordID;
/* 1F8h */ int mNumBombers;
/* 1FCh */ int mNumFighters;
/* 200h */ ResourceKey mPendingUFOKey;
/* 20Ch */ float mDamageRemainder;
/* 210h */ float mDamageRemainderUFO;
/* 214h */ bool mShouldDestroyColonyObject;
/* 215h */ bool mWaitingForRaid; // true
/* 218h */ int field_218;
/* 21Ch */ bool mUFOsLeaveOnArrival;
/* 21Dh */ bool mInitialized;
/* 21Eh */ bool mShowDefaultEventLog; // true
/* 220h */ uint32_t mTimeOfArrivalMS;
/* 224h */ Math::Vector3 mUFOSpawnLocation;
/* 230h */ uint32_t mAttackerEmpire; // -1
/* 234h */ bool mIsPlayerSummoned;
/* 238h */ eastl::vector<int> mBackgroundShipsList;
};
ASSERT_SIZE(cRaidEvent, 0x250);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#pragma once

#include <Spore\Simulator\cMission.h>
#include <Spore\Simulator\cShipBackgroundData.h>

namespace Simulator
{
/// The kind of mission for pirate raid events. Example usage, to raid the current planet:
/// ```cpp
/// using namespace Simulator;
/// auto planet = GetActivePlanetRecord();
/// auto empireID = planet->GetStarRecord()->mEmpireID;
/// auto empire = StarManager.GetEmpire(empireID);
/// auto mission = MissionManager.CreateMission(id("RaidPlunderEvent"), planet, empire);
/// auto raidEvent = object_cast<cRaidPlunderEvent>(mission);
/// raidEvent->mNumPirates = 20;
/// raidEvent->mNumBombers = 10;
/// raidEvent->mpTargetPlanet = GetActivePlanet();
/// raidEvent->AcceptMission();
/// auto eventID = UIEventLog.ShowEvent(0x31DF9AC0, GroupIDs::SpacePopups);
/// raidEvent->mAssociatedEventLogIDs.push_back(eventID);
/// ```
class cRaidPlunderEvent
: public cMission
{
public:
static const uint32_t TYPE = 0x397BFF2;
static const uint32_t NOUN_ID = 0x397BFF3;

public:
/* 1F0h */ ResourceKey mPendingUFOKey;
/* 1FCh */ bool mCanStart;
/* 200h */ int mNumPirates;
/* 204h */ int mNumBombers;
/* 208h */ int mNumFighters;
/* 20Ch */ float mDamageRemainderUFO;
/* 210h */ float mStolenSpiceFraction;
/* 214h */ eastl::vector<cShipBackgroundData> mBackgroundShipsList;
};
ASSERT_SIZE(cRaidPlunderEvent, 0x228);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once

#include <Spore\Simulator\ISimulatorSerializable.h>
#include <Spore\Simulator\SimulatorEnums.h>
#include <Spore\MathUtils.h>

namespace Simulator
{
class cShipBackgroundData
: public ISimulatorSerializable
{
public:
/* 04h */ UfoType mUfoType;
/* 08h */ Math::Vector3 mPosition;
/* 14h */ float mHealth;
/* 18h */ float mMaxHealth;
/* 1Ch */ int mBomberIndex;
};
ASSERT_SIZE(cShipBackgroundData, 0x20);
}

0 comments on commit b5a034e

Please sign in to comment.