Skip to content

Commit a8801ef

Browse files
committed
Add cRaidEvent class
1 parent 6108aaf commit a8801ef

File tree

6 files changed

+73
-1
lines changed

6 files changed

+73
-1
lines changed

Spore ModAPI/Spore ModAPI.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@
437437
<ClInclude Include="Spore\Simulator\cObjectPool.h" />
438438
<ClInclude Include="Spore\Simulator\cPlanetaryArtifact.h" />
439439
<ClInclude Include="Spore\Simulator\cPlantCargoInfo.h" />
440+
<ClInclude Include="Spore\Simulator\cRaidEvent.h" />
440441
<ClInclude Include="Spore\Simulator\cResourceProjectile.h" />
441442
<ClInclude Include="Spore\Simulator\cScenarioEditHistory.h" />
442443
<ClInclude Include="Spore\Simulator\cScenarioEconomy.h" />

Spore ModAPI/Spore ModAPI.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,6 +2181,9 @@
21812181
<ClInclude Include="Spore\Simulator\cPlanetaryArtifact.h">
21822182
<Filter>Header Files</Filter>
21832183
</ClInclude>
2184+
<ClInclude Include="Spore\Simulator\cRaidEvent.h">
2185+
<Filter>Header Files</Filter>
2186+
</ClInclude>
21842187
</ItemGroup>
21852188
<ItemGroup>
21862189
<ClCompile Include="SourceCode\Allocator.cpp">

Spore ModAPI/Spore/Simulator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#include <Spore\Simulator\cMovableDestructibleOrnament.h>
8282
#include <Spore\Simulator\cToolObject.h>
8383
#include <Spore\Simulator\cPlanetaryArtifact.h>
84+
#include <Spore\Simulator\cRaidEvent.h>
8485

8586
#include <Spore\Simulator\SimulatorMessages.h>
8687

Spore ModAPI/Spore/Simulator/cMission.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ namespace Simulator
7171
/// @param pEmpire
7272
void SetTargetEmpire(cEmpire* pEmpire);
7373

74+
inline void AcceptMission() {
75+
SetState(MissionState::Accepted);
76+
}
77+
inline void CompleteMission() {
78+
SetState(MissionState::Completed);
79+
}
80+
7481
/* 54h */ virtual int func54h();
7582
/* 58h */ virtual int func58h();
7683
/* 5Ch */ virtual int func5Ch();

Spore ModAPI/Spore/Simulator/cMissionManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace Simulator
5858
/// @param pOwnerEmpire Empire that is assigning the mission.
5959
/// @param pParentMission Parent mission, this is generally null unless you want the new mission to be part of a larger, multi-step mission.
6060
/// @returns The created cMission subclass object, or nullptr.
61-
cMission* CreateMission(uint32_t missionID, cPlanetRecord* pSourcePlanetRecord, cEmpire* pOwnerEmpire, cMission* pParentMission);
61+
cMission* CreateMission(uint32_t missionID, cPlanetRecord* pSourcePlanetRecord, cEmpire* pOwnerEmpire, cMission* pParentMission = nullptr);
6262

6363
/// This function decides what mission needs to be done for the given empire.
6464
/// To be precise, if you communicate with empire `pEmpire` on planet `pPlanetRecord`
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#pragma once
2+
3+
#include <Spore\Simulator\cMission.h>
4+
#include <Spore\Simulator\cGameDataUFO.h>
5+
6+
namespace Simulator
7+
{
8+
class cShipBackgroundData
9+
: public ISimulatorSerializable
10+
{
11+
public:
12+
/* 04h */ UfoType mUfoType;
13+
/* 08h */ Math::Vector3 mPosition;
14+
/* 14h */ float mHealth;
15+
/* 18h */ float mMaxHealth;
16+
/* 1Ch */ int mBomberIndex;
17+
};
18+
ASSERT_SIZE(cShipBackgroundData, 0x20);
19+
20+
/// The kind of mission for raid events. Example usage, to raid the current planet:
21+
/// ```cpp
22+
/// using namespace Simulator;
23+
/// auto planet = GetActivePlanetRecord();
24+
/// auto empireID = planet->GetStarRecord()->mEmpireID;
25+
/// auto empire = StarManager.GetEmpire(empireID);
26+
/// auto mission = MissionManager.CreateMission(id("RaidEvent"), planet, empire);
27+
/// auto raidEvent = object_cast<cRaidEvent>(mission);
28+
/// raidEvent->mpTargetPlanet = GetActivePlanet();
29+
/// raidEvent->mNumBombers = 10;
30+
/// raidEvent->AcceptMission();
31+
/// ```
32+
class cRaidEvent
33+
: public cMission
34+
{
35+
public:
36+
static const uint32_t TYPE = 0x3960C0A;
37+
static const uint32_t NOUN_ID = 0x3960C0E;
38+
39+
public:
40+
/* 1F0h */ cGameDataUFOPtr mGalaxyBomber;
41+
/* 1F4h */ int mOriginStarRecordID;
42+
/* 1F8h */ int mNumBombers;
43+
/* 1FCh */ int mNumFighters;
44+
/* 200h */ ResourceKey mPendingUFOKey;
45+
/* 20Ch */ float mDamageRemainder;
46+
/* 210h */ float mDamageRemainderUFO;
47+
/* 214h */ bool mShouldDestroyColonyObject;
48+
/* 215h */ bool mWaitingForRaid; // true
49+
/* 218h */ int field_218;
50+
/* 21Ch */ bool mUFOsLeaveOnArrival;
51+
/* 21Dh */ bool mInitialized;
52+
/* 21Eh */ bool mShowDefaultEventLog; // true
53+
/* 220h */ uint32_t mTimeOfArrivalMS;
54+
/* 224h */ Math::Vector3 mUFOSpawnLocation;
55+
/* 230h */ uint32_t mAttackerEmpire; // -1
56+
/* 234h */ bool mIsPlayerSummoned;
57+
/* 238h */ eastl::vector<int> mBackgroundShipsList;
58+
};
59+
ASSERT_SIZE(cRaidEvent, 0x250);
60+
}

0 commit comments

Comments
 (0)