Skip to content

Commit 7ece943

Browse files
committed
Add CinematicManager, DoCinematicActionMessage, CinematicVignetteAction
1 parent 002e314 commit 7ece943

File tree

11 files changed

+247
-4
lines changed

11 files changed

+247
-4
lines changed

Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
#include <Spore\Simulator\SubSystem\AnimalSpeciesManager.h>
104104
#include <Spore\Simulator\SubSystem\PlantSpeciesManager.h>
105105
#include <Spore\Simulator\SubSystem\GamePersistenceManager.h>
106+
#include <Spore\Simulator\SubSystem\CinematicManager.h>
106107
#include <Spore\Simulator\NounClassFactories.h>
107108

108109
namespace Addresses(Simulator)
@@ -1105,6 +1106,15 @@ namespace Simulator
11051106
namespace Addresses(cSpatialObject) {
11061107
DefineAddress(SetModelKey, SelectAddress(0xC87B30, 0xC889A0));
11071108
}
1109+
1110+
namespace Addresses(CinematicAction) {
1111+
DefineAddress(StartVignetteFunction_ptr, SelectAddress(0xAD3D50, 0xAD3EF0));
1112+
}
1113+
1114+
namespace Addresses(cCinematicManager) {
1115+
DefineAddress(Get, SelectAddress(0xB3D430, 0xB3D5D0));
1116+
DefineAddress(PlayCinematic, SelectAddress(0xAE0480, 0xAE08B0));
1117+
}
11081118
}
11091119

11101120
#ifdef SDK_TO_GHIDRA

Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <Spore\Simulator\cSpeciesProfile.h>
88
#include <Spore\Simulator\cIdentityColorable.h>
99
#include <Spore\Simulator\SubSystem\GamePersistenceManager.h>
10+
#include <Spore\Simulator\SubSystem\CinematicManager.h>
1011
#include <Spore\Simulator\cDefaultToolProjectile.h>
1112
#include <Spore\Simulator\cArtilleryProjectile.h>
1213
#include <Spore\Simulator\cCulturalProjectile.h>
@@ -156,5 +157,17 @@ namespace Simulator
156157
auto_METHOD_VOID(cPlanetaryArtifact, LoadFromItem,
157158
Args(SpaceInventoryItemType itemType, const ResourceKey& itemKey, int count, bool arg),
158159
Args(itemType, itemKey, count, arg));
160+
161+
//// CinematicManager ////
162+
163+
auto_STATIC_METHOD_(cCinematicManager, cCinematicManager*, Get);
164+
165+
auto_METHOD_VOID(cCinematicManager, PlayCinematic,
166+
Args(const char* cinematicName, int arg0, int arg1, int arg2, int arg3, int arg4),
167+
Args(cinematicName, arg0, arg1, arg2, arg3, arg4));
168+
169+
CinematicActionFunction_t CinematicAction::GetStartVignetteFunction() {
170+
return (CinematicActionFunction_t)(GetAddress(CinematicAction, StartVignetteFunction_ptr));
171+
}
159172
}
160173
#endif

Spore ModAPI/Spore ModAPI.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@
327327
<ClInclude Include="Spore\App\IDGenerator.h" />
328328
<ClInclude Include="Spore\App\JobManager.h" />
329329
<ClInclude Include="Spore\App\Thumbnail_cImportExport.h" />
330+
<ClInclude Include="Spore\Simulator\SubSystem\CinematicManager.h" />
330331
<ClInclude Include="Spore\Simulator\UIStateMachine.h" />
331332
<ClInclude Include="Spore\BasicIncludes.h" />
332333
<ClInclude Include="Spore\Cell.h" />

Spore ModAPI/Spore ModAPI.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,6 +2193,9 @@
21932193
<ClInclude Include="Spore\Simulator\UIStateMachine.h">
21942194
<Filter>Header Files</Filter>
21952195
</ClInclude>
2196+
<ClInclude Include="Spore\Simulator\SubSystem\CinematicManager.h">
2197+
<Filter>Header Files</Filter>
2198+
</ClInclude>
21962199
</ItemGroup>
21972200
<ItemGroup>
21982201
<ClCompile Include="SourceCode\Allocator.cpp">

Spore ModAPI/Spore/ResourceKey.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ ASSERT_SIZE(ResourceKey, 0xC);
8181
#define type_id(id) ResourceKey(0, id, 0)
8282
#define group_id(id) ResourceKey(0, 0, id)
8383

84+
#define WILDCARD_KEY ResourceKey(ResourceKey::kWildcardID, ResourceKey::kWildcardID, ResourceKey::kWildcardID)
85+
8486
inline ResourceKey::ResourceKey()
8587
#ifndef SDK_TO_GHIDRA
8688
: instanceID(0)
@@ -125,7 +127,7 @@ inline bool ResourceKey::operator >(const ResourceKey &b) const
125127

126128
inline bool ResourceKey::operator <(const ResourceKey &b) const
127129
{
128-
return groupID > b.groupID;
130+
return groupID < b.groupID;
129131
}
130132

131133
namespace eastl

Spore ModAPI/Spore/Simulator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <Spore\Simulator\SubSystem\SpaceGfx.h>
3838
#include <Spore\Simulator\SubSystem\SpaceTrading.h>
3939
#include <Spore\Simulator\SubSystem\TerraformingManager.h>
40+
#include <Spore\Simulator\SubSystem\CinematicManager.h>
4041

4142
#include <Spore\Simulator\cGameData.h>
4243
#include <Spore\Simulator\cGonzagoSimulator.h>

Spore ModAPI/Spore/Simulator/SimulatorMessages.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <Spore\ResourceKey.h>
2424
#include <Spore\App\StandardMessage.h>
2525
#include <Spore\Simulator\cMission.h>
26+
#include <Spore\Simulator\SubSystem\CinematicManager.h>
2627

2728
namespace Simulator
2829
{
@@ -100,6 +101,9 @@ namespace Simulator
100101

101102
/// Sent when the ownership of some star changes. No parameters.
102103
kMsgStarOwnershipChanged = 0x55BD8F7,
104+
105+
/// Simulator::DoCinematicActionMessage ; sent to execute a single action within a cinematic stage
106+
kMsgDoCinematicAction = 0x4470A41,
103107
};
104108

105109
class IMessageParameters
@@ -261,4 +265,17 @@ namespace Simulator
261265
return params[0].uint32;
262266
}
263267
};
268+
269+
/// Sent to execute a single action within a cinematic stage
270+
class DoCinematicActionMessage : App::StandardMessage
271+
{
272+
public:
273+
static const uint32_t ID = kMsgDoCinematicAction;
274+
275+
DoCinematicActionMessage(CinematicAction* action);
276+
277+
inline CinematicAction* GetActionData() {
278+
return (CinematicAction*)params[0].object;
279+
}
280+
};
264281
}

Spore ModAPI/Spore/Simulator/StarID.h

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#pragma once
22

33
#include <cstdint>
4+
#include <EASTL\functional.h>
45
#include <Spore\Internal.h>
6+
#include <Spore\Hash.h>
57

68
namespace Simulator
79
{
@@ -43,6 +45,13 @@ namespace Simulator
4345
inline unsigned int GetStarIndex() const {
4446
return internalValue & 0x00000FFF;
4547
}
48+
49+
#ifndef SDK_TO_GHIDRA
50+
bool StarID::operator ==(const StarID& b) const;
51+
bool StarID::operator !=(const StarID& b) const;
52+
bool StarID::operator <(const StarID& b) const;
53+
bool StarID::operator >(const StarID& b) const;
54+
#endif
4655
};
4756
ASSERT_SIZE(StarID, 4);
4857

@@ -85,6 +94,63 @@ namespace Simulator
8594
inline unsigned int GetPlanetIndex() const {
8695
return internalValue & 0xFF000000 >> 24;
8796
}
97+
98+
#ifndef SDK_TO_GHIDRA
99+
bool PlanetID::operator ==(const PlanetID& b) const;
100+
bool PlanetID::operator !=(const PlanetID& b) const;
101+
bool PlanetID::operator <(const PlanetID& b) const;
102+
bool PlanetID::operator >(const PlanetID& b) const;
103+
#endif
88104
};
89105
ASSERT_SIZE(PlanetID, 4);
90-
}
106+
107+
#ifndef SDK_TO_GHIDRA
108+
inline bool StarID::operator ==(const StarID& b) const
109+
{
110+
return internalValue == b.internalValue;
111+
}
112+
inline bool StarID::operator !=(const StarID& b) const
113+
{
114+
return internalValue != b.internalValue;
115+
}
116+
inline bool StarID::operator >(const StarID& b) const
117+
{
118+
return internalValue > b.internalValue;
119+
}
120+
inline bool StarID::operator <(const StarID& b) const
121+
{
122+
return internalValue < b.internalValue;
123+
}
124+
125+
inline bool PlanetID::operator ==(const PlanetID& b) const
126+
{
127+
return internalValue == b.internalValue;
128+
}
129+
inline bool PlanetID::operator !=(const PlanetID& b) const
130+
{
131+
return internalValue != b.internalValue;
132+
}
133+
inline bool PlanetID::operator >(const PlanetID& b) const
134+
{
135+
return internalValue > b.internalValue;
136+
}
137+
inline bool PlanetID::operator <(const PlanetID& b) const
138+
{
139+
return internalValue < b.internalValue;
140+
}
141+
#endif
142+
}
143+
144+
#ifndef SDK_TO_GHIDRA
145+
namespace eastl
146+
{
147+
template <> struct hash<Simulator::StarID>
148+
{
149+
size_t operator()(const Simulator::StarID& val) const { return hash<uint32_t>()(val.internalValue); }
150+
};
151+
template <> struct hash<Simulator::PlanetID>
152+
{
153+
size_t operator()(const Simulator::PlanetID& val) const { return hash<uint32_t>()(val.internalValue); }
154+
};
155+
}
156+
#endif
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#pragma once
2+
3+
#include <Spore\App\IMessageListener.h>
4+
#include <Spore\ArgScript\ICommand.h>
5+
#include <Spore\Simulator\SubSystem\cStrategy.h>
6+
#include <Spore\MathUtils.h>
7+
8+
/// Accesses the current instance of Simulator::cCinematicManager
9+
#define CinematicManager (*Simulator::cCinematicManager::Get())
10+
11+
namespace Simulator
12+
{
13+
class CinematicActionUnkBase
14+
{
15+
public:
16+
virtual ~CinematicActionUnkBase() = 0;
17+
virtual int AddRef() = 0;
18+
virtual int Release() = 0;
19+
};
20+
21+
typedef bool(*CinematicActionFunction_t)(Object* actionData, bool);
22+
23+
class CinematicAction
24+
: public RefCountTemplate
25+
, public CinematicActionUnkBase
26+
{
27+
public:
28+
virtual ~CinematicAction();
29+
virtual int AddRef() override;
30+
virtual int Release() override;
31+
32+
static CinematicActionFunction_t GetStartVignetteFunction();
33+
34+
public:
35+
/// For instance, CinematicVignetteAction
36+
/* 0Ch */ ObjectPtr mActionData;
37+
/* 10h */ CinematicActionFunction_t mFunction;
38+
};
39+
ASSERT_SIZE(CinematicAction, 0x14);
40+
41+
namespace Addresses(CinematicAction) {
42+
DeclareAddress(StartVignetteFunction_ptr); // 0xAD3D50 0xAD3EF0
43+
}
44+
45+
46+
class cCinematicManager
47+
: public App::IMessageListener
48+
, public cStrategy
49+
{
50+
public:
51+
static cCinematicManager* Get();
52+
53+
/* 10h */ virtual void AddCommand(const char* commandName, ArgScript::ICommand* command);
54+
55+
void PlayCinematic(const char* cinematicName, int arg0, int arg1, int arg2, int arg3, int arg4);
56+
57+
public:
58+
/* 20h */ char padding_20[0x3c8 - 0x20];
59+
};
60+
ASSERT_SIZE(cCinematicManager, 0x3C8);
61+
62+
namespace Addresses(cCinematicManager) {
63+
DeclareAddress(Get); // 0xB3D430 0xB3D5D0
64+
DeclareAddress(PlayCinematic); // 0xAE0480 0xAE08B0
65+
}
66+
67+
68+
69+
class CinematicVignetteAction
70+
: public Object
71+
, public DefaultRefCounted
72+
{
73+
public:
74+
enum class PositionType
75+
{
76+
None = 0,
77+
Unk1 = 1,
78+
Effect = 2,
79+
ActorNest = 3,
80+
ActorHut = 4,
81+
ActorTribe = 5,
82+
ActorCity = 6,
83+
Object = 7,
84+
Actor = 8,
85+
NearestWater = 9,
86+
NearestLand = 10
87+
};
88+
89+
enum class OffsetMultiplier {
90+
/// Uses the foot radius of the actor as an offset multiplier
91+
FootprintRadius = 0,
92+
/// Uses the max width of the target object as an offset multiplier
93+
TargetWidth = 1,
94+
/// Uses the height of the target object as an offset multiplier
95+
TargetHeight = 2,
96+
None = 3,
97+
};
98+
99+
static const uint32_t TYPE = 0x55113D6;
100+
101+
virtual int AddRef() override;
102+
virtual int Release() override;
103+
virtual void* Cast(uint32_t type) const override;
104+
105+
public:
106+
/// Actor name
107+
/* 0Ch */ uint32_t mActorId;
108+
/// Vignette identifier
109+
/* 10h */ uint32_t mVignetteId;
110+
/// Vignette identifier
111+
/* 14h */ ResourceKey mVignetteKey;
112+
/// Relative position (if no options specified, then relative to the actor)
113+
/* 20h */ Math::Vector3 mPosition;
114+
/* 2Ch */ Math::Vector3 mFacingOffset;
115+
/// If not None, relative to a position
116+
/* 38h */ PositionType mRelativePosType; // Unk1
117+
/* 3Ch */ uint32_t mRelativePosId;
118+
/// If not None, face a position with an optional offset mFacingOffset
119+
/* 40h */ PositionType mFacingType; // None
120+
/* 44h */ uint32_t mFacingId;
121+
/// state does not wait for routing to finish
122+
/* 48h */ bool mNoWait;
123+
/* 4Ch */ OffsetMultiplier mOffsetMultiplier; // None
124+
/* 50h */ uint32_t field_50; // -1
125+
};
126+
ASSERT_SIZE(CinematicVignetteAction, 0x54);
127+
}

Spore ModAPI/Spore/Simulator/cScenarioData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ namespace Simulator
8989
/* 24h */ int field_24;
9090
/* 28h */ int field_28;
9191
/* 2Ch */ bool field_2C;
92-
/* 30h */ int field_30;
92+
/* 30h */ TexturePtr field_30;
9393
/* 34h */ int field_34;
9494
/* 38h */ TexturePtr mThumbnail;
9595
/* 3Ch */ TexturePtr mLargeThumbnail;

0 commit comments

Comments
 (0)