Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Spore ModAPI/SourceCode/Simulator/SimulatorSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ namespace Simulator
: mnRefCount(0)
, mLastGameMode(0xFFFFFFFF)
, mCurrentGameMode(0xFFFFFFFF)
, field_14(0xFFFFFFFF)
, field_18(0)
, mCurrentTransition(0xFFFFFFFF)
, mCurrentTransitionPhase(0)
{}
cStrategy::~cStrategy() {}

Expand Down Expand Up @@ -102,7 +102,7 @@ namespace Simulator
return mCurrentGameMode;
}
bool cStrategy::func24h(uint32_t mode) {
return mode == GetCurrentGameMode() && mode == GetLastGameMode() && field_14 == 0xFFFFFFFF;
return mode == GetCurrentGameMode() && mode == GetLastGameMode() && mCurrentTransition == 0xFFFFFFFF;
}

void cStrategy::OnLoad(const cSavedGameHeader& savedGame) {}
Expand All @@ -111,22 +111,22 @@ namespace Simulator
void cStrategy::PostUpdate(int deltaTime, int deltaGameTime) {}

void cStrategy::func40h(uint32_t mode) {
field_18 = 1;
if (field_14 == 0xFFFFFFFF) field_14 = mode;
mCurrentTransitionPhase = 1;
if (mCurrentTransition == 0xFFFFFFFF) mCurrentTransition = mode;
}
void cStrategy::func44h(uint32_t mode) {
field_18 = 2;
if (field_14 == 0xFFFFFFFF) field_14 = mode;
mCurrentTransitionPhase = 2;
if (mCurrentTransition == 0xFFFFFFFF) mCurrentTransition = mode;
}
void cStrategy::func48h() {
mLastGameMode = field_14;
field_14 = 0xFFFFFFFF;
field_18 = 0;
mLastGameMode = mCurrentTransition;
mCurrentTransition = 0xFFFFFFFF;
mCurrentTransitionPhase = 0;
}
void cStrategy::func4Ch() {
mCurrentGameMode = field_14;
field_14 = 0xFFFFFFFF;
field_18 = 0;
mCurrentGameMode = mCurrentTransition;
mCurrentTransition = 0xFFFFFFFF;
mCurrentTransitionPhase = 0;
}
}
#endif
1 change: 1 addition & 0 deletions Spore ModAPI/Spore ModAPI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
<ClInclude Include="Spore\Editors\cSPEditorVerbIcon.h" />
<ClInclude Include="Spore\Editors\cSPEditorVerbIconTray.h" />
<ClInclude Include="Spore\Graphics\cCubeMapCoord.h" />
<ClInclude Include="Spore\Graphics\cCubeMapIndex.h" />
<ClInclude Include="Spore\IO\IniFile.h" />
<ClInclude Include="Spore\IO\StreamCompressionZLib.h" />
<ClInclude Include="Spore\Swarm\cDecal.h" />
Expand Down
3 changes: 3 additions & 0 deletions Spore ModAPI/Spore ModAPI.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -2304,6 +2304,9 @@
<ClInclude Include="Spore\Graphics\cCubeMapCoord.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Graphics\cCubeMapIndex.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="SourceCode\Allocator.cpp">
Expand Down
14 changes: 14 additions & 0 deletions Spore ModAPI/Spore/Graphics/cCubeMapIndex.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include <Spore\Internal.h>

namespace Graphics
{
struct cCubeMapIndex
{
/* 00h */ int mCol;
/* 04h */ int mRow;
/* 08h */ int mFace;
};
ASSERT_SIZE(cCubeMapIndex, 0x0C);
}
73 changes: 62 additions & 11 deletions Spore ModAPI/Spore/Simulator/SubSystem/PlanetModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
****************************************************************************/
#pragma once

#include <Spore\Graphics\cCubeMapIndex.h>
#include <Spore\Simulator\SubSystem\cStrategy.h>
#include <Spore\Simulator\cCity.h>
#include <Spore\Terrain\ITerrain.h>
#include <Spore\Terrain\cTerrainSphere.h>
#include <Spore\MathUtils.h>

/// Access the active Simulator planet manager.
Expand All @@ -29,13 +30,52 @@
namespace Simulator
{
using namespace Math;

struct cPoliticalZone
{
uint32_t mPoliticalID;
Vector3 mCenter;
bool mCityZone;
bool mVisible;
cCity* mCity;
};

//sizeof 0x13208
class cPlanetModel
: public App::IMessageListener
, public cStrategy
{
public:
struct cLandTradeRoute
{
cCity* city1;
cCity* city2;
eastl::vector<Vector3> path;
};

struct cBoundaryPointInfo
{
Vector3 mDisplacedPoint;
int8_t mZoneIdxs[4];
bool mVisited[4];
};

struct cCubeCornerHash
{
size_t operator()(const Graphics::cCubeMapIndex& c) const
{
return c.mFace * 0xfd + c.mCol * 0x25 + c.mRow;
}
};

struct cCubeMapIndexEqual
{
bool operator()(const Graphics::cCubeMapIndex& a, const Graphics::cCubeMapIndex& b) const
{
return (a.mFace == b.mFace) && (a.mCol == b.mCol) && (a.mRow == b.mRow);
}
};

//TODO PLACEHOLDER

// B7DC40 Get water level?
Expand Down Expand Up @@ -63,19 +103,30 @@ namespace Simulator

public:
//TODO
/* 1Ch */ int field_1C; // not initialized
// one of these is cTerrainSphere*?
/* 20h */ ITerrainPtr mpTerrain;
/* 24h */ Terrain::ITerrain* mpTerrain2;
/* 28h */ float field_28;
/* 20h */ cTerrainSpherePtr mpSphere;
/* 24h */ ITerrainPtr mpTerrain;
/* 28h */ float mWaterFraction;
/* 2Ch */ ResourceKey mPlanetKey;
/* 38h */ eastl::string16 field_38;
/* 38h */ eastl::string16 mPlanetName;
/* 48h */ bool mbAddedMessageListeners;
/* 4Ch */ void* mpPlanetAStarInfo;

/* 7Ch */ void* mpPlanetObstacles;
/* 4Ch */ uint32_t* mContinentMap;
/* 50h */ eastl::vector<uint32_t> mContinentAreas;
/* 64h */ eastl::vector<bool> mContinentAboveWater;
/* 78h */ bool mContinentMapDirty;
/* 7Ch */ uint8_t* mObstacleBitMap;
/* 80h */ eastl::vector<cPoliticalZone> mPoliticalZones;
/* 94h */ eastl::vector<int8_t> mPoliticalZoneIdxMap;
/* A8h */ void* mPlanetRibbonGfx; // cPlanetRibbonGfx
/* ACh */ eastl::vector<eastl::pair<cCity*, cCity*>> mSeaTradeRoutes;
/* C0h */ eastl::vector<eastl::pair<cCity*, cCity*>> mAirTradeRoutes;
/* D4h */ eastl::vector<cLandTradeRoute> mLandTradeRoutes;
/* E8h */ bool mSeaTradeRoutesDirty;
/* E9h */ bool mAirTradeRoutesDirty;
/* EAh */ bool mLandTradeRoutesDirty;
/* ECh */ uint32_t mGameMode;
// eastl::fixed_hash_map<Graphics::cCubeMapIndex, cBoundaryPointInfo, 2048, 512, true, cCubeCornerHash, cCubeMapIndexEqual, false> mPoliticalBoundaryPoints;
// Graphics::cCubeMapIndex mPoliticalBoundaryStartCorner[15];

/* A8h */ void* mpPlanetRibbonGfx;
//PLACEHODER more things
};

Expand Down
4 changes: 2 additions & 2 deletions Spore ModAPI/Spore/Simulator/SubSystem/cStrategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ namespace Simulator
// NOTE: These 2 mode values can sometimes appear swapped when changing modes.
/* 0Ch */ uint32_t mLastGameMode; // -1
/* 10h */ uint32_t mCurrentGameMode; // -1
/* 14h */ uint32_t field_14; // -1
/* 18h */ int field_18;
/* 14h */ uint32_t mCurrentTransition; // -1
/* 18h */ int mCurrentTransitionPhase;
};
ASSERT_SIZE(cStrategy, 0x1C);
}
Expand Down
3 changes: 2 additions & 1 deletion Spore ModAPI/Spore/Terrain/cTerrainDecal.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ namespace Terrain
struct cTerrainDecal
: public Swarm::cDecal
{
/* 68h */ Swarm::DecalType mType = Swarm::DecalType::kDecalTypeTerrain;
/* 68h */ float field_68;
// /* 68h */ Swarm::DecalType mType = Swarm::DecalType::kDecalTypeTerrain;
};
ASSERT_SIZE(cTerrainDecal, 0x6C);
}
14 changes: 8 additions & 6 deletions Spore ModAPI/Spore/Terrain/cTerrainSphere.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include <Spore\Terrain\TerrainShaderData.h>
#include <Spore\Terrain\cTerrainSphereQuad.h>

#define cTerrainSpherePtr eastl::intrusive_ptr<Terrain::cTerrainSphere>

namespace Terrain
{
enum TerrainGameMode
Expand Down Expand Up @@ -138,11 +140,11 @@ namespace Terrain

struct TerrainModification
{
/* 00h */ Transform transform;
/* 38h */ char field_38[0x60]; // floats
/* 98h */ ResourceKey key;
/* A4h */ int field_A4;
/* A8h */ uint32_t modid;
/* 00h */ Transform mTransform;
/* 38h */ Math::Rectangle mBounds[6];
/* 98h */ ResourceKey mKey;
/* A4h */ uint32_t mFlagsAndBits;
/* A8h */ uint32_t mModId;
};
ASSERT_SIZE(TerrainModification, 0xAC);

Expand Down Expand Up @@ -188,7 +190,7 @@ namespace Terrain
/* 20Ch */ cTerrainStateMgr* mpTerrainStateMgr;
/* 210h */ cWeatherManagerPtr mpWeatherManager;
/* 214h */ int field_214;
/* 218h */ eastl::vector<int> mpDecalList[4];
/* 218h */ eastl::vector<cTerrainSphereDecal*> mpDecalList[4];
/* 268h */ eastl::vector<int> mDecalIdFreeList[4];
/* 2B8h */ eastl::vector<int> mpDecalSegList;
/* 2CCh */ eastl::vector<int> mDecalSegListIdFreeList;
Expand Down
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/Terrain/cTerrainSphereDecal.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace Terrain
}

public:
/* 74h */ int field_74; // -1
/* 74h */ int field_74; // -1, index?
/* 78h */ cTerrainSphere* mpParentSphere;
/* 7Ch */ cTerrainMapSet* mpTerrainMapSet;
/* 80h */ eastl::vector<FaceInfo> mFaceArray;
Expand Down
Loading