Skip to content

Commit 38745a9

Browse files
committed
- Add Simulator::cTribeInputStrategy, with methods ChooseInputActionID(), DoToolActionForAllSelected(), DoActionForAllSelected(), DoActionGeneric(), SetHoverObjectCursorAndRollover()
- Add enums Simulator::TribeInputAction and Simulator::CitizenAction - Add cCreatureCitizen::DoAction() - Add BundleManager::RemoveBundles() - Add UI::SimulatorRollover::ShowRollover() (previous method has been renamed to ShowRolloverInternal()) - Rename GameViewManager::func30h() to GetHoveredObject()
1 parent 56de4b1 commit 38745a9

16 files changed

Lines changed: 228 additions & 9 deletions

Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
#include <Spore\Simulator\cTribe.h>
8787
#include <Spore\Simulator\cTribeTool.h>
8888
#include <Spore\Simulator\cTribeToolData.h>
89+
#include <Spore\Simulator\cTribeInputStrategy.h>
8990
#include <Spore\Simulator\SubSystem\cRelationshipManager.h>
9091
#include <Spore\Simulator\SubSystem\GameBehaviorManager.h>
9192
#include <Spore\Simulator\SubSystem\GameInputManager.h>
@@ -217,6 +218,7 @@ namespace Simulator
217218

218219
namespace Addresses(cCreatureCitizen) {
219220
DefineAddress(Update, SelectAddress(0xC24210, 0xC24A30));
221+
DefineAddress(DoAction, SelectAddress(0xC26EF0, 0xC27710));
220222
}
221223

222224
namespace Addresses(cCreatureBase)
@@ -1145,6 +1147,15 @@ namespace Simulator
11451147
DefineAddress(Get, SelectAddress(0xB3D210, 0xB3D3B0));
11461148
DefineAddress(CreateBundles, SelectAddress(0xAC7810, 0xAC79F0));
11471149
}
1150+
1151+
namespace Addresses(cTribeInputStrategy) {
1152+
DefineAddress(DoToolActionForAllSelected, SelectAddress(0xCCFFE0, 0xCD09B0));
1153+
DefineAddress(DoActionForAllSelected, SelectAddress(0xCCFF70, 0xCD0940));
1154+
DefineAddress(ChooseInputActionID, SelectAddress(0xCCE870, 0xCCF130));
1155+
DefineAddress(DoActionGeneric, SelectAddress(0xCD0250, 0xCD0250));
1156+
DefineAddress(SetHoverObjectCursorAndRollover, SelectAddress(0xCCF800, 0xCD00C0));
1157+
DefineAddress(sIsInEditor_ptr, SelectAddress(0x168AD70, 0x1686AF0));
1158+
}
11481159
}
11491160

11501161
#ifdef SDK_TO_GHIDRA

Spore ModAPI/SourceCode/DLL/AddressesUI.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ namespace UI
5757
namespace Addresses(SimulatorRollover)
5858
{
5959
DefineAddress(GetRolloverIdForObject, SelectAddress(0xB67960, 0xB67D70));
60-
DefineAddress(ShowRollover, SelectAddress(0xB68790, 0xB68BA0));
60+
DefineAddress(ShowRollover, SelectAddress(0xB69680, 0xB69A90));
61+
DefineAddress(ShowRolloverInternal, SelectAddress(0xB68790, 0xB68BA0));
6162
}
6263
}
6364
#endif

Spore ModAPI/SourceCode/Simulator/cCreatureAnimal.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
****************************************************************************/
2020
#include <Spore\Simulator\cCreatureAnimal.h>
21+
#include <Spore\Simulator\cCreatureCitizen.h>
2122

2223
namespace Simulator
2324
{
@@ -94,5 +95,8 @@ namespace Simulator
9495

9596
auto_METHOD_VOID(cCreatureBase, ConsumeEnergy,
9697
Args(float energyConsumed), Args(energyConsumed));
98+
99+
100+
auto_METHOD_VOID(cCreatureCitizen, DoAction, Args(int actionId, cGameData* actionObject, App::Property* prop), Args(actionId, actionObject, prop));
97101
}
98102
#endif

Spore ModAPI/SourceCode/Simulator/cTribe.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <Spore\Simulator\cTribe.h>
44
#include <Spore\Simulator\cTribeTool.h>
55
#include <Spore\Simulator\cTribeToolData.h>
6+
#include <Spore\Simulator\cTribeInputStrategy.h>
67

78
namespace Simulator
89
{
@@ -48,5 +49,24 @@ namespace Simulator
4849

4950
auto_STATIC_METHOD_VOID_(Simulator, DisposeTribeToolsData);
5051

52+
53+
auto_METHOD(cTribeInputStrategy, int, ChooseInputActionID,
54+
Args(cGameData* object, int unk), Args(object, unk));
55+
56+
auto_METHOD(cTribeInputStrategy, bool, DoToolActionForAllSelected,
57+
Args(cTribeTool* tribeTool), Args(tribeTool));
58+
59+
auto_METHOD_VOID(cTribeInputStrategy, DoActionForAllSelected,
60+
Args(int citizenActionId, cGameData* actionObject, int unk),
61+
Args(citizenActionId, actionObject, unk));
62+
63+
auto_METHOD_VOID(cTribeInputStrategy, DoActionGeneric, Args(cGameData* actionObject), Args(actionObject));
64+
65+
auto_METHOD_VOID_(cTribeInputStrategy, SetHoverObjectCursorAndRollover);
66+
67+
bool cTribeInputStrategy::IsInEditor() {
68+
return *(bool*)(GetAddress(cTribeInputStrategy, sIsInEditor_ptr));
69+
}
70+
5171
}
5272
#endif

Spore ModAPI/SourceCode/UI/UI.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,10 @@ namespace UI
102102
auto_STATIC_METHOD(SimulatorRollover, SimulatorRolloverID, GetRolloverIdForObject,
103103
Args(Simulator::cGameData* object), Args(object));
104104

105-
auto_STATIC_METHOD(SimulatorRollover, SimulatorRollover*, ShowRollover,
106-
Args(SimulatorRolloverID rolloverId), Args(rolloverId));
105+
auto_STATIC_METHOD_VOID(SimulatorRollover, ShowRollover,
106+
Args(Simulator::cGameData* object), Args(object));
107+
108+
auto_STATIC_METHOD(SimulatorRollover, SimulatorRollover*, ShowRolloverInternal,
109+
Args(Simulator::cGameData* object, SimulatorRolloverID rolloverId, float unk), Args(object, rolloverId, unk));
107110
}
108111
#endif

Spore ModAPI/Spore ModAPI.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@
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\cBaseSimulatorInputStrategy.h" />
331+
<ClInclude Include="Spore\Simulator\cTribeInputStrategy.h" />
330332
<ClInclude Include="Spore\Simulator\cTribeToolData.h" />
331333
<ClInclude Include="Spore\Simulator\SubSystem\BundleManager.h" />
332334
<ClInclude Include="Spore\Simulator\SubSystem\CinematicManager.h" />

Spore ModAPI/Spore ModAPI.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,6 +2214,12 @@
22142214
<ClInclude Include="Spore\Simulator\SubSystem\BundleManager.h">
22152215
<Filter>Header Files</Filter>
22162216
</ClInclude>
2217+
<ClInclude Include="Spore\Simulator\cTribeInputStrategy.h">
2218+
<Filter>Header Files</Filter>
2219+
</ClInclude>
2220+
<ClInclude Include="Spore\Simulator\cBaseSimulatorInputStrategy.h">
2221+
<Filter>Header Files</Filter>
2222+
</ClInclude>
22172223
</ItemGroup>
22182224
<ItemGroup>
22192225
<ClCompile Include="SourceCode\Allocator.cpp">

Spore ModAPI/Spore/Simulator/SimulatorEnums.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,4 +722,48 @@ namespace Simulator
722722
kTribeBundleTypeMeat = 2,
723723
kTribeBundleTypeFish = 3,
724724
};
725+
726+
enum TribeInputAction
727+
{
728+
//TODO there are more
729+
730+
kTribeInputActionToolAttack1 = 19,
731+
kTribeInputActionToolAttack2 = 20,
732+
kTribeInputActionToolAttack3 = 21,
733+
kTribeInputActionToolSocial1 = 22,
734+
kTribeInputActionToolSocial2 = 23,
735+
kTribeInputActionToolSocial3 = 24,
736+
kTribeInputActionToolHeal = 25,
737+
kTribeInputActionToolFirepit = 26,
738+
};
739+
740+
enum CitizenAction
741+
{
742+
//TODO there are more
743+
kCitizenActionEat = 0,
744+
kCitizenActionFish = 1,
745+
kCitizenActionGather = 2,
746+
kCitizenActionGrabTool = 3,
747+
748+
kCitizenActionHeal = 5,
749+
750+
kCitizenActionAttack = 7,
751+
kCitizenActionRaid1 = 8,
752+
kCitizenActionGift1 = 9,
753+
kCitizenActionHunt = 10,
754+
kCitizenActionMate = 11,
755+
kCitizenActionParty = 12,
756+
kCitizenActionCollectEgg = 13,
757+
kCitizenActionBundle = 14,
758+
759+
kCitizenActionRaid2 = 15,
760+
761+
kCitizenActionFeedWild = 20,
762+
kCitizenActionGift2 = 21,
763+
764+
kCitizenActionRepair = 24,
765+
kCitizenActionTame = 25,
766+
kCitizenActionRecruit = 26,
767+
kCitizenActionGatherMeat = 27,
768+
};
725769
}

Spore ModAPI/Spore/Simulator/SubSystem/BundleManager.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ namespace Simulator
2222
/// @returns The last bundle created
2323
cGameBundle* CreateBundles(float amount, cGameBundleContainer* container, int bundleType);
2424

25+
/// Removes a certain quantity from a bundle container. This will remove as many bundles as necessary,
26+
/// and change the value of the last remaining bundle. If the amount is small enough, no bundle may be deleted.
27+
/// @param amount
28+
/// @param container
29+
/// @param bundle If not null, removes only that specific bundle
30+
/// @returns The actual amount that has been removed.
31+
float RemoveBundles(float amount, cGameBundleContainer* container, cGameBundle* bundle = nullptr);
32+
2533
public:
2634
/* 1Ch */ void* mpGroundContainer; //TODO cGameBundleGroundContainerPtr
2735
};
@@ -30,5 +38,6 @@ namespace Simulator
3038
namespace Addresses(cBundleManager) {
3139
DeclareAddress(Get); // 0xB3D210 0xB3D3B0
3240
DeclareAddress(CreateBundles); // 0xAC7810 0xAC79F0
41+
DeclareAddress(RemoveBundles); // 0xAC7A70 TODO
3342
}
3443
}

Spore ModAPI/Spore/Simulator/SubSystem/CinematicManager.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ namespace Simulator
5555
void PlayCinematic(const char* cinematicName, int arg0, int arg1, int arg2, int arg3, int arg4);
5656

5757
public:
58-
/* 20h */ char padding_20[0x3c8 - 0x20];
58+
/* 20h */ int field_20;
59+
/* 24h */ int field_24;
60+
/* 28h */ int field_28;
61+
/* 2Ch */ int field_2C;
62+
/* 30h */ char padding_30[0x3c8 - 0x30];
5963
};
6064
ASSERT_SIZE(cCinematicManager, 0x3C8);
6165

0 commit comments

Comments
 (0)