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
9 changes: 9 additions & 0 deletions Spore ModAPI/SourceCode/DLL/AddressesTerrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ namespace Terrain
DefineAddress(ApplyTerrainUserBeachColor, SelectAddress(0xFBDDD0, 0xFBD6B0));
DefineAddress(ApplyTerrainUserAtmosphereColor, SelectAddress(0xFB98C0, 0xFB91A0));
}

namespace Addresses(cTerrainSphereDecal) {
DefineAddress(Initialize, SelectAddress(0xF82DD0, 0xFAEC20));
DefineAddress(Shutdown, SelectAddress(0xF81C20, 0xFADA70));
DefineAddress(UpdateDecal, SelectAddress(0xF82960, 0xFAE7B0));
DefineAddress(DispatchStaticDecal, SelectAddress(0xF816B0, 0xFAD500));
DefineAddress(GetBBoxForFace, SelectAddress(0xF812A0, 0xFAD0F0));
DefineAddress(SetFaceInfoArray, SelectAddress(0xF81D80, 0xFADBD0));
}
}
namespace Addresses(Terrain)
{
Expand Down
55 changes: 42 additions & 13 deletions Spore ModAPI/SourceCode/Terrain/Terrain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <Spore\Terrain\cTerrainMapSet.h>
#include <Spore\Terrain\cTerrainStateMgr.h>
#include <Spore\Terrain\cTerrainSphere.h>
#include <Spore\Terrain\cTerrainSphereDecal.h>
#include <Spore\Terrain\TerrainRendering.h>
#include <Spore\Graphics\ITextureManager.h>
#include <Spore\Properties.h>
Expand Down Expand Up @@ -57,13 +58,9 @@ namespace Terrain


cTerrainMapSet::cHeightRanges::cHeightRanges()
: field_0(0x55)
, field_4(1)
, field_8(5)
, field_C(0x15)
, field_10(0x55)
, field_14(0x155)
, mpCell(new int[8190])
: mFaceSize(0x55)
, mLevelOffsets{ 1, 5, 0x15, 0x55, 0x155 }
, mCellData(new int[8190])
{

}
Expand All @@ -74,12 +71,11 @@ namespace Terrain
, mPlanetRadius(500.0f)
, mAltitudeRange(100.0f)
, mWaterLevel()
, field_40()
, field_44(0.025f)
, field_48()
, mWaterDelta()
, mBeachLevel(0.025f)
, mMinCliffGradient()
, mMaxCliffGradient()
, field_50(-1.0f)
, field_54(-1.0f)
, mHeightRange(-1.0f, -1.0f)
, mpHeightRanges(new cHeightRanges())
{

Expand All @@ -88,7 +84,7 @@ namespace Terrain
cTerrainMapSet::~cTerrainMapSet()
{
if (mpHeightRanges) {
if (mpHeightRanges->mpCell) delete mpHeightRanges->mpCell;
if (mpHeightRanges->mCellData) delete mpHeightRanges->mCellData;
delete mpHeightRanges;
}
}
Expand Down Expand Up @@ -331,6 +327,30 @@ namespace Terrain
}


cTerrainSphereDecal::cTerrainSphereDecal()
: field_74(-1)
, mpParentSphere(nullptr)
, mpTerrainMapSet(nullptr)
, mFaceArray()
, mPosition()
, mUSize(0)
, mVSize(0)
, mUSizeInput(0)
, mVSizeInput(0)
, mDecalRadius(1.0f)
, mDecalTextureID(0)
, mFlags(0)
, mZeroUVLoc(0, 0, 0)
, mTexturePlane(0, 0, 0, 0)
, mDirectionU(1.0f, 0, 0)
, mScaleU(1.0f)
, mDirectionV(0, 1.0f, 0)
, mScaleV(1.0f)
, mpTexture(nullptr)
{

}

auto_METHOD_VOID(cTerrainStateMgr, Initialize, Args(bool a), Args(a));

auto_METHOD_VOID_(cTerrainStateMgr, InitTextures);
Expand All @@ -344,6 +364,15 @@ namespace Terrain
auto_METHOD_VOID(cTerrainStateMgr, ApplyTerrainUserCliffColor, Args(struct Math::Vector3 color), Args(color));
auto_METHOD_VOID(cTerrainStateMgr, ApplyTerrainUserBeachColor, Args(struct Math::Vector3 color), Args(color));
auto_METHOD_VOID(cTerrainStateMgr, ApplyTerrainUserAtmosphereColor, Args(struct Math::Vector3 color), Args(color));


auto_METHOD_VOID(cTerrainSphereDecal, Initialize, Args(int arg_4, Graphics::Texture* pTexture, cTerrainSphere* pParentSphere, const Transform& xform, float turns, bool isStatic), Args(arg_4, pTexture, pParentSphere, xform, turns, isStatic));
auto_METHOD_VOID_(cTerrainSphereDecal, Shutdown);
auto_METHOD_VOID_(cTerrainSphereDecal, UpdateDecal);
auto_METHOD_VOID(cTerrainSphereDecal, DispatchStaticDecal, Args(int face), Args(face));
auto_METHOD(cTerrainSphereDecal, bool, GetBBoxForFace, Args(int faceRequest, Math::Rectangle& bbox), Args(faceRequest, bbox));

auto_METHOD_VOID(cTerrainSphereDecal, SetFaceInfoArray, Args(const Transform& xform, float aspect), Args(xform, aspect));
}


Expand Down
4 changes: 4 additions & 0 deletions Spore ModAPI/Spore ModAPI.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,12 @@
<ClInclude Include="Spore\Editors\cSPEditorVerbTrayCollection.h" />
<ClInclude Include="Spore\Editors\cSPEditorVerbIcon.h" />
<ClInclude Include="Spore\Editors\cSPEditorVerbIconTray.h" />
<ClInclude Include="Spore\Graphics\cCubeMapCoord.h" />
<ClInclude Include="Spore\IO\IniFile.h" />
<ClInclude Include="Spore\IO\StreamCompressionZLib.h" />
<ClInclude Include="Spore\Swarm\cDecal.h" />
<ClInclude Include="Spore\Terrain\cTerrainDecal.h" />
<ClInclude Include="Spore\Terrain\cTerrainSphereDecal.h" />
<ClInclude Include="Spore\UI\cSPUIPropertyLayout.h" />
<ClInclude Include="Spore\Editors\cSPVerbIconRollover.h" />
<ClInclude Include="Spore\Editors\cSPVerbTrayCollection.h" />
Expand Down
12 changes: 12 additions & 0 deletions Spore ModAPI/Spore ModAPI.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -2292,6 +2292,18 @@
<ClInclude Include="Spore\IO\IniFile.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Swarm\cDecal.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Terrain\cTerrainDecal.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Terrain\cTerrainSphereDecal.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Spore\Graphics\cCubeMapCoord.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="SourceCode\Allocator.cpp">
Expand Down
20 changes: 19 additions & 1 deletion Spore ModAPI/Spore/App/cJob.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,20 @@ namespace App
typedef bool(*cJobCallback)(cJob*, void*);
typedef void(*cJobVoidCallback)(cJob*, void*);

enum JobStatus
{
kJobStatusFree,
kJobStatusSuspended,
kJobStatusWaiting,
kJobStatusReady,
kJobStatusRunning,
kJobStatusContinuation,
kJobStatusCancelled,
kJobStatusFinished,
kJobStatusFailed,
kJobStatusCount
};

class cJob
{
public:
Expand Down Expand Up @@ -51,8 +65,12 @@ namespace App
/* 00h */ cJobCallback mCallback;
/* 04h */ void* mpCallbackObject;
/* 08h */ ObjectPtr mReleasebleObject;
/* 0Ch */ char padding[0x18 - 0xC];
/* 0Ch */ char* mpDebugName;
/* 10h */ int mPriority;
/* 14h */ JobStatus mStatus;
/* 18h */ uint32_t mThreadAffinity;
/* 1Ch */ int mSlot;
/* 20h */ void* mpReturnValue;
};

namespace Addresses(cJob)
Expand Down
7 changes: 7 additions & 0 deletions Spore ModAPI/Spore/Graphics/ShaderData.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,11 @@ namespace Graphics
Math::Vector4 mShadowDir;
Math::Vector4 mNestInfo;
};

struct ShaderDataDecalState
{
Math::Vector4 mDecalColorTint;
Math::Vector4 mDirScaleU;
Math::Vector4 mDirScaleV;
};
}
14 changes: 14 additions & 0 deletions Spore ModAPI/Spore/Graphics/cCubeMapCoord.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#pragma once

#include <Spore\Internal.h>

namespace Graphics
{
struct cCubeMapCoord
{
/* 00h */ float mU;
/* 04h */ float mV;
/* 08h */ int mFace;
};
ASSERT_SIZE(cCubeMapCoord, 0x0C);
}
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/Graphics/cMeshData.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Graphics
/* 08h */ eastl::vector<int> mElementsArray; // cMDElementArray
/* 1Ch */ eastl::vector<int> mSections; // cMDSection
/* 30h */ eastl::vector<int> mPrimitives; // cMDPrimitive
/* 44h */ eastl::vector<int> field_44; // ObjectPtr
/* 44h */ eastl::vector<ObjectPtr> mAttachments;
};
ASSERT_SIZE(cMeshData, 0x58);
}
4 changes: 2 additions & 2 deletions Spore ModAPI/Spore/Palettes/cSPScenarioBrushItemUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace Palettes
/* 3Ch */ ResourceKey mToolPreviewEffect;
/* 48h */ ResourceKey mMarkerModelID;
/* 54h */ uint32_t mBrushCategory;
/* 58h */ Vector2 mBrushIntensityRange; // 0.0, 1.0
/* 60h */ Vector2 mBrushSizeRange; // 0.0, 1.0
/* 58h */ Math::Vector2 mBrushIntensityRange; // 0.0, 1.0
/* 60h */ Math::Vector2 mBrushSizeRange; // 0.0, 1.0
/* 68h */ bool mIsTerraformModel; // uses terraformModelID instead of toolGenericEffectID
/* 69h */ bool mIsValidComplexity; // true
/* 6Ah */ bool mIsDragging;
Expand Down
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/Resource/FakeRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Resource
/* 10h */ ResourceKey mKey;
/* 1Ch */ bool mCloseStreamOnClose;
/* 1Dh */ bool mDeleteStreamOnClose;
/* 20h */ int field_20;
/* 20h */ int mnOpenCount; // AtomicInt<int>
};
ASSERT_SIZE(FakeRecord, 0x24);

Expand Down
8 changes: 4 additions & 4 deletions Spore ModAPI/Spore/Simulator/ICityMusic.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace Simulator
{
static const uint32_t TYPE = 0x424E7F2;

/* 24h */ virtual void func24h(const Math::Vector3&) = 0;
/* 28h */ virtual void func28h() = 0;
/* 2Ch */ virtual void func2Ch(bool) = 0;
/* 30h */ virtual void func30h(const Math::Vector3&) = 0;
/* 24h */ virtual void Start(const Math::Vector3&) = 0;
/* 28h */ virtual void Stop() = 0;
/* 2Ch */ virtual void Pause(bool) = 0;
/* 30h */ virtual void SetPosition(const Math::Vector3&) = 0;
/* 34h */ virtual int func34h() = 0;
};
}
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/Simulator/cPlanet.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ namespace Simulator
/* 184h */ float mPlanetScale;
/* 188h */ cSolarHitSpherePtr mpSolarHitSphere;
/* 18Ch */ cVisiblePlanetPtr mpVisiblePlanet;
/* 190h */ bool field_190; // true
/* 190h */ bool mbLoadNounsFromBackground; // true
/* 198h */ cGonzagoTimer mTimeSinceLastColonyPlaced;
/* 1B8h */ bool field_1B8; // true
/* 1BCh */ int mPlanetFlags;
Expand Down
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/Simulator/cPlanetRecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace Simulator
/* 3Ch */ float mCapturePercent;
/* 40h */ eastl::string16 mName;
/* 50h */ eastl::string16 mDescription;
/* 60h */ int16_t field_60[14];
/* 60h */ uint16_t maabBuildingLinks[14];
/* 7Ch */ eastl::vector<cBuildingData> mBuilding;
/* 90h */ eastl::vector<cOrnamentData> mOrnament;
/* A4h */ eastl::vector<cWallData> mWall;
Expand Down
50 changes: 50 additions & 0 deletions Spore ModAPI/Spore/Swarm/cDecal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#pragma once

#include <Spore\Transform.h>
#include <EASTL\bitset.h>

namespace Swarm
{
enum DecalType
{
kDecalTypeTerrain,
kDecalTypeWater,
kDecalTypeTerrainAndWater,
kDecalTypePaint,
kDecalTypeUser1,
kDecalTypeUser2,
kDecalTypeUser3,
kDecalTypeUser4,
kDecalTypeUser5,
kDecalTypeUser6,
kDecalTypeUser7,
kDecalTypeUser8,

kMaxDecalTypes
};

class cDecal
{
public:
typedef eastl::bitset<1> FlagSet;

enum Flags
{
kFlagEnabled,

kMaxFlags
};

/* 00h */ Transform mTransform;
/* 38h */ Math::Vector4 mColorAlpha{ 1.0f, 1.0f, 1.0f, 1.0f };
/* 48h */ float mTurns = 1.0f;
/* 4Ch */ float mAspect = 1.0f;
/* 50h */ float mRepeatU = 1.0f;
/* 54h */ float mRepeatV = 1.0f;
/* 58h */ float mOffsetU = 1.0f;
/* 5Ch */ float mOffsetV = 1.0f;
/* 60h */ uint32_t mLayer = 0;
/* 64h */ FlagSet mFlags = 0;
};
ASSERT_SIZE(cDecal, 0x68);
}
3 changes: 2 additions & 1 deletion Spore ModAPI/Spore/Terrain.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
#include <Spore\Terrain\TerrainRendering.h>
#include <Spore\Terrain\ITerrainResourceManager.h>
#include <Spore\Terrain\cTerrainMapSet.h>
#include <Spore\Terrain\cTerrainShaderMgr.h>
#include <Spore\Terrain\cTerrainShaderMgr.h>
#include <Spore\Terrain\cTerrainSphereDecal.h>
13 changes: 13 additions & 0 deletions Spore ModAPI/Spore/Terrain/cTerrainDecal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include <Spore\Swarm\cDecal.h>

namespace Terrain
{
struct cTerrainDecal
: public Swarm::cDecal
{
/* 68h */ Swarm::DecalType mType = Swarm::DecalType::kDecalTypeTerrain;
};
ASSERT_SIZE(cTerrainDecal, 0x6C);
}
20 changes: 8 additions & 12 deletions Spore ModAPI/Spore/Terrain/cTerrainMapSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,11 @@ namespace Terrain
{
cHeightRanges();

/* 00h */ int field_0; // 0x555
/* 04h */ int field_4; // 1
/* 08h */ int field_8; // 5
/* 0Ch */ int field_C; // 0x15
/* 10h */ int field_10; // 0x55
/* 14h */ int field_14; // 0x155
/* 18h */ int* mpCell;
/* 00h */ int mFaceSize; // 0x555
/* 04h */ int mLevelOffsets[5]; // 1, 5, 0x15, 0x55, 0x155
/* 18h */ int* mCellData;
};
ASSERT_SIZE(cHeightRanges, 0x1C);

cTerrainMapSet();
virtual ~cTerrainMapSet();
Expand Down Expand Up @@ -82,12 +79,11 @@ namespace Terrain
/* 38h */ float mAltitudeRange; // 100.0
/// Between -1 and 1, gets multiplied by altitude range
/* 3Ch */ float mWaterLevel;
/* 40h */ float field_40;
/* 44h */ float field_44; // 0.025
/* 48h */ float field_48;
/* 40h */ float mWaterDelta;
/* 44h */ float mBeachLevel; // 0.025
/* 48h */ float mMinCliffGradient;
/* 4Ch */ float mMaxCliffGradient;
/* 50h */ float field_50; // -1.0
/* 54h */ float field_54; // -1.0
/* 50h */ Math::Vector2 mHeightRange;
/* 58h */ cHeightRanges* mpHeightRanges;
};
ASSERT_SIZE(cTerrainMapSet, 0x5C);
Expand Down
Loading
Loading