Skip to content

Commit cfb3ad6

Browse files
committed
Added many fields to cPlanetRecord and cStarManager, added cSpaceNames and cResourceKeyGenerator, added methods related with galaxy generation
1 parent 91d1afd commit cfb3ad6

30 files changed

+779
-148
lines changed

Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <Spore\Simulator\cPlaceColonyToolStrategy.h>
2828
#include <Spore\Simulator\cPlaceObjectToolStrategy.h>
2929
#include <Spore\Simulator\cPlanet.h>
30+
#include <Spore\Simulator\cPlanetRecord.h>
3031
#include <Spore\Simulator\cPlayerInventory.h>
3132
#include <Spore\Simulator\cTimeOfDay.h>
3233
#include <Spore\Simulator\cRallyCallToolStrategy.h>
@@ -481,6 +482,12 @@ namespace Simulator
481482
DefineAddress(RecordToPlanet, SelectAddress(0xBB4960, NO_ADDRESS, 0xBB5B50));
482483
DefineAddress(FindClosestStar, SelectAddress(0xBAFD80, , 0xBB1020));
483484
DefineAddress(FindStars, SelectAddress(0xBAFF70, , 0xBB1210));
485+
486+
DefineAddress(CalculatePlanetScores, SelectAddress(0xBA5C10, , 0xBA65F0));
487+
DefineAddress(StarGenerationMessageHandler, SelectAddress(0xBB4D10, , 0xBB5F00));
488+
DefineAddress(GetStarGridPosition, SelectAddress(0xBA6880, , 0xBA7250));
489+
DefineAddress(GenerateEllipticalOrbit, SelectAddress(0xBA81B0, , 0xBA8D90));
490+
DefineAddress(GenerateSolSystem, SelectAddress(0xBB1A00, , 0xBB2BF0));
484491
}
485492

486493
namespace Addresses(cSpaceTradeRouteManager)
@@ -704,5 +711,10 @@ namespace Simulator
704711
{
705712
DefineAddress(SetCurrentAct, SelectAddress(0xF1F260, , 0xF1EE70));
706713
}
714+
715+
namespace Addresses(cPlanetRecord)
716+
{
717+
DefineAddress(Create, SelectAddress(0xBA5920, , 0xBA6300));
718+
}
707719
}
708720
#endif

Spore ModAPI/SourceCode/Simulator/Planets.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ namespace Simulator
2828
}
2929

3030
StarID cPlanetRecord::GetStarID() const {
31-
return Simulator::GetStarKey(mKey.instanceID);
31+
return PlanetID(mKey.instanceID).GetStarID();
3232
}
3333

3434
PlanetID cPlanetRecord::GetID() const {
35-
return mKey.instanceID;
35+
return PlanetID(mKey.instanceID);
3636
}
3737

3838
TechLevel cPlanetRecord::GetTechLevel() const {
@@ -50,5 +50,7 @@ namespace Simulator
5050
}
5151

5252
auto_METHOD_VOID(cPlanet, SetRepresentationMode, Args(PlanetRepresentationMode mode), Args(mode));
53+
54+
auto_STATIC_METHOD_VOID(cPlanetRecord, Create, Args(PlanetID planetId, cPlanetRecordPtr& dst), Args(planetId, dst));
5355
}
5456
#endif

Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#ifndef MODAPI_DLL_EXPORT
22
#include <Spore\Simulator\cHerd.h>
3+
#include <Spore\Simulator\cSpaceNames.h>
34

45
namespace Simulator
56
{
@@ -16,5 +17,16 @@ namespace Simulator
1617
egg->mEnabled = enabled;
1718
}
1819
}
20+
21+
22+
auto_STATIC_METHOD_(cSpaceNames, cSpaceNames*, Get);
23+
24+
string16 cSpaceNames::GenerateRandomName(SpaceNamesType arg)
25+
{
26+
string16 dst;
27+
CALL(GetAddress(cSpaceNames, GenerateRandomName), void,
28+
Args(cSpaceNames*, string16&, SpaceNamesType), Args(this, dst, arg));
29+
return dst;
30+
}
1931
}
2032
#endif

Spore ModAPI/SourceCode/Simulator/StarManager.cpp

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ namespace Simulator
3030

3131
cEmpire* cStarManager::GetEmpire(uint32_t politicalID)
3232
{
33-
auto it = mEmpiresMap.find(politicalID);
34-
if (it != mEmpiresMap.end())
33+
auto it = mEmpires.find(politicalID);
34+
if (it != mEmpires.end())
3535
{
3636
return it->second.get();
3737
}
@@ -43,23 +43,23 @@ namespace Simulator
4343

4444
cStarRecord* cStarManager::GetStarRecord(StarID id)
4545
{
46-
if (id == 0)
46+
if (id.internalValue == 0)
4747
{
48-
return field_14C.get();
48+
return mpTempStar.get();
4949
}
50-
else if (id == -1)
50+
else if (id.internalValue == -1)
5151
{
5252
return nullptr;
5353
}
5454
else
5555
{
56-
return mStarRecords[id >> 12][id & 0xFFF].get();
56+
return mStarRecordGrid[id.GetSectorIndex()][id.GetStarIndex()].get();
5757
}
5858
}
5959

6060
EmpiresMap& cStarManager::GetEmpires()
6161
{
62-
return mEmpiresMap;
62+
return mEmpires;
6363
}
6464

6565

@@ -94,6 +94,33 @@ namespace Simulator
9494
auto_METHOD_VOID(cStarManager, FindStars,
9595
Args(const Vector3& coords, const StarRequestFilter& filter, vector<cStarRecordPtr>& dst),
9696
Args(coords, filter, dst));
97+
98+
auto_METHOD_VOID(cStarManager, CalculatePlanetScores,
99+
Args(cPlanetRecord* pPlanetRecord, cStarRecord* pStar, int arg), Args(pPlanetRecord, pStar, arg));
100+
101+
auto_METHOD_VOID(cStarManager, GetStarGridPosition,
102+
Args(const Vector3& position, unsigned int& dstX, unsigned int& dstY), Args(position, dstX, dstY));
103+
104+
auto_METHOD_VOID(cStarManager, GenerateEllipticalOrbit,
105+
Args(cStarRecord* pStarRecord, cEllipticalOrbit& dst, float mind, float maxd, cPlanetRecord* pOrbitAroundPlanet),
106+
Args(pStarRecord, dst, mind, maxd, pOrbitAroundPlanet));
107+
108+
auto_METHOD_VOID_(cStarManager, GenerateSolSystem);
109+
110+
auto_STATIC_METHOD(cStarManager, bool, StarGenerationMessageHandler,
111+
Args(uint32_t messageId, Swarm::Components::DistributeEffectMessageData* pDistributeData, StarType starType),
112+
Args(messageId, pDistributeData, starType));
113+
114+
115+
cPlanetRecord* PlanetID::GetRecord()
116+
{
117+
return StarManager.GetPlanetRecord(*this);
118+
}
119+
120+
cStarRecord* StarID::GetRecord()
121+
{
122+
return StarManager.GetStarRecord(*this);
123+
}
97124
}
98125

99126
auto_STATIC_METHOD_VOID(Simulator, SpaceTeleportTo, Args(cStarRecord* star), Args(star));

Spore ModAPI/SourceCode/Simulator/cEmpire.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace Simulator
3131
auto_METHOD_VOID(cEmpire, SetSpeciesProfile, Args(cSpeciesProfile* pSpecies), Args(pSpecies));
3232

3333
cStarRecord* cEmpire::GetHomeStarRecord() {
34-
if (mHomeStar != -1) {
34+
if (mHomeStar.internalValue != -1) {
3535
return StarManager.GetStarRecord(mHomeStar);
3636
}
3737
else {

Spore ModAPI/SourceCode/Simulator/cStarRecord.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
namespace Simulator
2323
{
2424
auto_METHOD(cStarRecord, cPlanetRecord*, GetPlanetRecord, Args(size_t arg), Args(arg));
25+
auto_METHOD_(cStarRecord, vector<cPlanetRecordPtr>&, GetPlanetRecords);
2526

2627
StarType cStarRecord::GetType() const {
2728
return mType;

Spore ModAPI/Spore ModAPI.vcxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@
311311
<ClInclude Include="Spore\App\FileDrop.h" />
312312
<ClInclude Include="Spore\App\GameSpace.h" />
313313
<ClInclude Include="Spore\App\ITokenTranslator.h" />
314+
<ClInclude Include="Spore\App\ResourceKeyGenerator.h" />
314315
<ClInclude Include="Spore\App\Thumbnail_cImportExport.h" />
315316
<ClInclude Include="Spore\BasicIncludes.h" />
316317
<ClInclude Include="Spore\CppRevEng.h" />
@@ -376,6 +377,7 @@
376377
<ClInclude Include="Spore\Simulator\cScenarioTerraformMode.h" />
377378
<ClInclude Include="Spore\Simulator\cSimPlanetHighLOD.h" />
378379
<ClInclude Include="Spore\Simulator\cSolarHitSphere.h" />
380+
<ClInclude Include="Spore\Simulator\cSpaceNames.h" />
379381
<ClInclude Include="Spore\Simulator\cTimeOfDay.h" />
380382
<ClInclude Include="Spore\Simulator\cTotemPole.h" />
381383
<ClInclude Include="Spore\Simulator\cTribe.h" />
@@ -660,6 +662,7 @@
660662
<ClInclude Include="Spore\Simulator\tGameDataVectorT.h" />
661663
<ClInclude Include="Spore\Simulator\UnknownCreatureClass.h" />
662664
<ClInclude Include="Spore\Swarm\CollectionResource.h" />
665+
<ClInclude Include="Spore\Swarm\Components\DistributeEffect.h" />
663666
<ClInclude Include="Spore\Swarm\Constants.h" />
664667
<ClInclude Include="Spore\Swarm\cSwarmManager.h" />
665668
<ClInclude Include="Spore\Swarm\cEffectWorld.h" />

Spore ModAPI/Spore ModAPI.vcxproj.filters

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1866,6 +1866,15 @@
18661866
<ClInclude Include="Spore\Editors\EditorBaseHandle.h">
18671867
<Filter>Header Files</Filter>
18681868
</ClInclude>
1869+
<ClInclude Include="Spore\Simulator\cSpaceNames.h">
1870+
<Filter>Header Files</Filter>
1871+
</ClInclude>
1872+
<ClInclude Include="Spore\Swarm\Components\DistributeEffect.h">
1873+
<Filter>Header Files</Filter>
1874+
</ClInclude>
1875+
<ClInclude Include="Spore\App\ResourceKeyGenerator.h">
1876+
<Filter>Header Files</Filter>
1877+
</ClInclude>
18691878
</ItemGroup>
18701879
<ItemGroup>
18711880
<ClCompile Include="SourceCode\Allocator.cpp">

Spore ModAPI/Spore/App/IMessageListener.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ namespace App
4343
/// Called every time a message is received. Only the messages with an ID this listened
4444
/// signed up for will call this event.
4545
/// @param messageID The ID of the message received.
46-
/// @param msg The data of the message received, it might be nullptr.
46+
/// @param pMessage The data of the message received, it might be nullptr.
4747
/// @returns Whether the message was handled or not.
4848
///
4949
virtual bool HandleMessage(uint32_t messageID, void* msg) = 0;
@@ -65,7 +65,7 @@ namespace App
6565
/// Called every time a message is received. Only the messages with an ID this listened
6666
/// signed up for will call this event.
6767
/// @param messageID The ID of the message received.
68-
/// @param msg The data of the message received, it might be nullptr.
68+
/// @param pMessage The data of the message received, it might be nullptr.
6969
/// @returns Whether the message was handled or not.
7070
///
7171
virtual bool HandleMessage(uint32_t messageID, void* pMessage) = 0;

Spore ModAPI/Spore/App/IPropManager.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@ using namespace eastl;
3131

3232
namespace App
3333
{
34-
///
35-
/// A manager that stores all the property lists in the game, used for most configurations. Property lists (.prop files) are
34+
/// A manager that stores all the property lists in the game, used for most configurations. Property lists (`.prop` files) are
3635
/// simple instances of the class PropertyList that contains properties. This is used for configuring most objects and things
3736
/// in the game.
3837
///
39-
/// A property manager can also contain definitions for properties, which are stored in the Properties.txt and AppProperties.txt
38+
/// A property manager can also contain definitions for properties, which are stored in the `Properties.txt` and `AppProperties.txt`
4039
/// files.
41-
///
4240
class IPropManager
4341
{
4442
public:
@@ -122,8 +120,7 @@ namespace App
122120
/// Gets the instance IDs of all the PropertyList objects contained in the specified group.
123121
/// @param groupID The ID of the group where the lists are (i.e. the folder)
124122
/// @param[out] result A uint32_t vector that will receive the instance IDs.
125-
/// @param
126-
///
123+
/// @returns
127124
/* 48h */ virtual bool GetAllListIDs(uint32_t groupID, vector<uint32_t>& result) const = 0;
128125

129126
/* 4Ch */ virtual void* func4Ch(int arg_0, int arg_4) = 0;

0 commit comments

Comments
 (0)