Skip to content

Commit d0bcdce

Browse files
committed
- Add SpaceGameUI::FillStarTooltipPlanetInfo()
- Add Simulator::GetMainSpeciesImageKey() - Add cPlanetRecord::GetTerrainScriptSource() - Add IImageDrawable::SetImageForWindow()
1 parent 3bb9343 commit d0bcdce

11 files changed

Lines changed: 65 additions & 1 deletion

File tree

Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ namespace Addresses(Simulator)
142142

143143
DefineAddress(SpawnNpcTribe, SelectAddress(0xC92860, 0xC932F0));
144144

145+
DefineAddress(GetMainSpeciesImageKey, SelectAddress(0x1066AF0, 0x1065F10));
146+
145147
#ifndef SDK_TO_GHIDRA
146148
DefineAddress(LightingWorld_ptr, SelectAddress(0x1682CD4, 0x167EA54));
147149
DefineAddress(PrecalculatedSolarStarRadius_ptr, SelectAddress(0x157DCF0, 0x1579D10));
@@ -834,6 +836,7 @@ namespace Simulator
834836
DefineAddress(FillPlanetDataForTechLevel, SelectAddress(0xB96820, 0xB97090));
835837
DefineAddress(CalculateSpiceProduction, SelectAddress(0xC6F920, 0xC70760));
836838
DefineAddress(CalculateDeltaSpiceProduction, SelectAddress(0xC71200, 0xC720A0));
839+
DefineAddress(GetTerrainScriptSource, SelectAddress(0xB8D690, 0xB8DEB0));
837840
}
838841

839842
namespace Addresses(cCivData) {

Spore ModAPI/SourceCode/DLL/AddressesUI.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ namespace UI
1919
{
2020
DefineAddress(Load, SelectAddress(0x10743F0, 0x1073730));
2121
DefineAddress(SetActivePalette, SelectAddress(0x106F060, 0x106E410));
22+
DefineAddress(FillStarTooltipPlanetInfo, SelectAddress(0x1069520, 0x1068980));
2223
}
2324

2425
namespace Addresses(cHintManager)

Spore ModAPI/SourceCode/DLL/AddressesUTFWin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ namespace UTFWin
239239
namespace Addresses(IImageDrawable)
240240
{
241241
DefineAddress(AddImageWindow, SelectAddress(0x807EC0, 0x807970));
242+
DefineAddress(SetImageForWindow, SelectAddress(0xE2F550, 0xE2F590));
242243
}
243244

244245
namespace Addresses(InflateEffect)

Spore ModAPI/SourceCode/Simulator/Planets.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,16 @@ namespace Simulator
7474

7575
auto_METHOD_VOID_(cEllipticalOrbit, Precalculate);
7676

77+
ResourceKey GetMainSpeciesImageKey(cPlanetRecord* planetRecord) {
78+
ResourceKey key;
79+
STATIC_CALL(GetAddress(Simulator, GetMainSpeciesImageKey), void, Args(ResourceKey&, cPlanetRecord*), Args(key, planetRecord));
80+
return key;
81+
}
82+
83+
ResourceKey cPlanetRecord::GetTerrainScriptSource() const {
84+
ResourceKey key;
85+
STATIC_CALL(GetAddress(cPlanetRecord, GetTerrainScriptSource), void, Args(ResourceKey&), Args(key));
86+
return key;
87+
}
7788
}
7889
#endif

Spore ModAPI/SourceCode/UI/SpaceGameUI.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
namespace UI
55
{
66
auto_METHOD_VOID(SpaceGameUI, SetActivePalette, Args(uint32_t paletteID), Args(paletteID));
7+
8+
auto_METHOD(SpaceGameUI, bool, FillStarTooltipPlanetInfo,
9+
Args(UTFWin::UILayout* layout, int slotIndex, Simulator::cPlanetRecord* planetRecord),
10+
Args(layout, slotIndex, planetRecord));
711
}
812

913
#endif

Spore ModAPI/SourceCode/UTFWin/Drawables.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ namespace UTFWin
4343
Args(const ResourceKey& imageName, float offsetX, float offsetY, IWindow* parentWindow),
4444
Args(imageName, offsetX, offsetY, parentWindow));
4545

46+
auto_STATIC_METHOD_VOID(IImageDrawable, SetImageForWindow,
47+
Args(IWindow* window, const ResourceKey& imageName),
48+
Args(window, imageName));
49+
4650
DEFAULT_REFCOUNT(ImageDrawable);
4751

4852
auto_METHOD_VIRTUAL_VOID(ImageDrawable, ILayoutElement, SetSerializer, Args(Serializer& dst), Args(dst));

Spore ModAPI/Spore/Simulator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <Spore\Simulator\SubSystem\AnimalSpeciesManager.h>
3737
#include <Spore\Simulator\SubSystem\SpaceGfx.h>
3838
#include <Spore\Simulator\SubSystem\SpaceTrading.h>
39+
#include <Spore\Simulator\SubSystem\TerraformingManager.h>
3940

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

Spore ModAPI/Spore/Simulator/cPlanetRecord.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ namespace Simulator
153153
kPlanetFlagHasRings = 0x2, // 1 << 1
154154
kPlanetFlagIsMoon = 0x4, // 1 << 2
155155

156+
kPlanetFlagIsDestroyed = 0x100, // 1 << 8
157+
156158
kPlanetFlagRedOrbit = 0x1000, // 1 << 12
157159
kPlanetFlagBlueOrbit = 0x2000, // 1 << 13
158160
};
@@ -175,6 +177,13 @@ namespace Simulator
175177
PlanetID GetID() const;
176178
TechLevel GetTechLevel() const;
177179

180+
inline bool IsMoon() const {
181+
return (mFlags & kPlanetFlagIsMoon) != 0;
182+
}
183+
inline bool IsDestroyed() const {
184+
return (mFlags & kPlanetFlagIsDestroyed) != 0;
185+
}
186+
178187
void SetGeneratedTerrainKey(const ResourceKey& key);
179188
ResourceKey& GetGeneratedTerrainKey();
180189

@@ -183,6 +192,8 @@ namespace Simulator
183192
/// @returns
184193
static ResourceKey GenerateTerrainKey();
185194

195+
ResourceKey GetTerrainScriptSource() const;
196+
186197
/// Returns the distance of the perihelion, which is the planet's closest point to the parent object
187198
/// in its orbit (the parent object is either a sun, or another planet if this planet is a moon).
188199
/// @param pRecord The planet
@@ -267,6 +278,12 @@ namespace Simulator
267278
};
268279
ASSERT_SIZE(cPlanetRecord, 0x1B0);
269280

281+
/// Returns the key to the image file that represents this planet main species,
282+
/// for planets in tribe, civilization, or space tech level.
283+
/// @param planetRecord
284+
ResourceKey GetMainSpeciesImageKey(cPlanetRecord* planetRecord);
285+
286+
270287
/////////////////////////////////
271288
//// INTERNAL IMPLEMENTATION ////
272289
/////////////////////////////////
@@ -278,6 +295,7 @@ namespace Simulator
278295
DeclareAddress(FillPlanetDataForTechLevel); // 0xB96820 0xB97090
279296
DeclareAddress(CalculateSpiceProduction); // 0xC6F920 0xC70760
280297
DeclareAddress(CalculateDeltaSpiceProduction); // 0xC71200 0xC720A0
298+
DeclareAddress(GetTerrainScriptSource); // 0xB8D690 0xB8DEB0
281299
}
282300

283301
inline ResourceKey cPlanetRecord::GenerateTerrainKey()
@@ -295,4 +313,8 @@ namespace Simulator
295313
{
296314
return mGeneratedTerrainKey;
297315
}
316+
}
317+
318+
namespace Addresses(Simulator) {
319+
DeclareAddress(GetMainSpeciesImageKey); // 0x1066AF0 0x1065F10
298320
}

Spore ModAPI/Spore/Simulator/cStarRecord.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ namespace Simulator
3737
{
3838
kStarFlagIsOwned = 0x10, // 1 << 4
3939

40+
// 1 << 6 has destroyed planet?
4041
// 0x200 has raid?
4142

4243
kStarFlagHasRare = 0x1000, // 1 << 12

Spore ModAPI/Spore/UI/SpaceGameUI.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#pragma once
2020

2121
#include <Spore\Simulator\cPlayerInventory.h>
22+
#include <Spore\Simulator\cPlanetRecord.h>
2223

2324
#include <Spore\UTFWin\IWinProc.h>
2425
#include <Spore\UTFWin\UILayout.h>
@@ -42,7 +43,8 @@
4243

4344
namespace UI
4445
{
45-
/// User interface for the Space game. The main SPUI is `0x1e453b88.spui`
46+
/// User interface for the Space game. The main SPUI is `0x1e453b88.spui`.
47+
/// It can be accessed through cSimulatorSpaceGame::GetUI().
4648
class SpaceGameUI
4749
: public UTFWin::IWinProc
4850
, public DefaultRefCounted
@@ -56,6 +58,12 @@ namespace UI
5658

5759
void SetActivePalette(uint32_t paletteID);
5860

61+
/// Fills one planet slot in the star tooltip that appears when hovering over a star in the Galaxy view.
62+
/// @param layout
63+
/// @param slotIndex
64+
/// @param planetRecord
65+
bool FillStarTooltipPlanetInfo(UTFWin::UILayout* layout, int slotIndex, Simulator::cPlanetRecord* planetRecord);
66+
5967
public:
6068
struct TerraformColors {
6169
/* 00h */ Color spaceUITerraformRingColorOff;
@@ -221,5 +229,6 @@ namespace UI
221229
{
222230
DeclareAddress(Load);
223231
DeclareAddress(SetActivePalette);
232+
DeclareAddress(FillStarTooltipPlanetInfo); // 0x1069520 0x1068980
224233
}
225234
}

0 commit comments

Comments
 (0)