Skip to content

Commit 002e314

Browse files
committed
Merge branch 'master' of github.com:emd4600/Spore-ModAPI
2 parents 5d3082c + 42a2f67 commit 002e314

17 files changed

+183
-17
lines changed

Projects/Example Projects/ModCreatorKit/Cheats.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
#include "ContextCheat.h"
2323
#include "AddressCheat.h"
2424
#include "AnimLogCheat.h"
25+
#include "EffectLogCheat.h"
2526
#include "PackageCheat.h"
27+
#include "PrintCursorCheat.h"
2628
#include "UILogCheat.h"
2729
#include "UIInspectCheat.h"
2830

@@ -47,9 +49,11 @@ void AddCheats()
4749
{
4850
CheatManager.AddCheat("devContext", new ContextCheat());
4951
CheatManager.AddCheat("devAnimLog", new AnimLogCheat());
52+
CheatManager.AddCheat("devEffectLog", new EffectLogCheat());
5053
CheatManager.AddCheat("devPackage", new PackageCheat());
5154
CheatManager.AddCheat("devLogUI", new UILogCheat());
5255
CheatManager.AddCheat("devInspectUI", new UIInspectCheat());
56+
CheatManager.AddCheat("devPrintCursor", new PrintCursorCheat());
5357

5458
AddressCheat::AddCheat(Address(ModAPI::ChooseAddress(0x1498444, 0x1493E5C)), "devRaid");
5559
AddressCheat::AddCheat(Address(ModAPI::ChooseAddress(0x149845C, 0x1493E74)), "devSpace");
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include "stdafx.h"
2+
#include "EffectLogCheat.h"
3+
#include <Spore/Swarm/cEffectsManager.h>
4+
5+
bool EffectLogCheat::IsEnabled = false;
6+
7+
member_detour(ReadEffect_detour, Swarm::cEffectsManager, int(uint32_t, uint32_t)) {
8+
int detoured(uint32_t instanceId, uint32_t groupId) {
9+
if (EffectLogCheat::IsEnabled && instanceId != 0)
10+
{
11+
App::ConsolePrintF("devEffectLog: loaded effect ID: 0x%x", instanceId);
12+
}
13+
return original_function(this, instanceId, groupId); //And call the original function with the new instance ID.
14+
}
15+
};
16+
17+
void EffectLogCheat::AttachDetour() {
18+
ReadEffect_detour::attach(GetAddress(Swarm::cEffectsManager, GetDirectoryAndEffectIndex));
19+
}
20+
21+
void EffectLogCheat::ParseLine(const ArgScript::Line& line)
22+
{
23+
auto args = line.GetArguments(1);
24+
EffectLogCheat::IsEnabled = mpFormatParser->ParseBool(args[0]);
25+
}
26+
27+
const char* EffectLogCheat::GetDescription(ArgScript::DescriptionMode mode) const
28+
{
29+
return "Usage: effectLog on/off. If enabled, every time an effect is loaded it will print its ID.";
30+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#pragma once
2+
3+
#include <Spore\BasicIncludes.h>
4+
5+
class EffectLogCheat
6+
: public ArgScript::ICommand
7+
{
8+
public:
9+
void ParseLine(const ArgScript::Line& line) override;
10+
const char* GetDescription(ArgScript::DescriptionMode mode) const override;
11+
12+
static bool IsEnabled;
13+
14+
static void AttachDetour();
15+
};

Projects/Example Projects/ModCreatorKit/ModCreatorKit.vcxproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
<LocalDebuggerCommand>$(SporeLauncherPath)Spore ModAPI Launcher.exe</LocalDebuggerCommand>
5252
<LocalDebuggerWorkingDirectory>$(SporeLauncherPath)</LocalDebuggerWorkingDirectory>
5353
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
54+
<PublicIncludeDirectories>
55+
</PublicIncludeDirectories>
5456
</PropertyGroup>
5557
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
5658
<LinkIncremental>false</LinkIncremental>
@@ -115,11 +117,19 @@
115117
<ClInclude Include="DetouredSwarmManager.h" />
116118
<ClInclude Include="EffectEditorCheat.h" />
117119
<ClInclude Include="EffectEditorMode.h" />
120+
<ClInclude Include="EffectLogCheat.h">
121+
<SubType>
122+
</SubType>
123+
</ClInclude>
118124
<ClInclude Include="FilePFRecord.h" />
119125
<ClInclude Include="PackageCheat.h">
120126
<SubType>
121127
</SubType>
122128
</ClInclude>
129+
<ClInclude Include="PrintCursorCheat.h">
130+
<SubType>
131+
</SubType>
132+
</ClInclude>
123133
<ClInclude Include="stdafx.h" />
124134
<ClInclude Include="targetver.h" />
125135
<ClInclude Include="ThumbnailCaptureScript.h" />
@@ -155,11 +165,19 @@
155165
</ClCompile>
156166
<ClCompile Include="EffectEditorCheat.cpp" />
157167
<ClCompile Include="EffectEditorMode.cpp" />
168+
<ClCompile Include="EffectLogCheat.cpp">
169+
<SubType>
170+
</SubType>
171+
</ClCompile>
158172
<ClCompile Include="FilePFRecord.cpp" />
159173
<ClCompile Include="PackageCheat.cpp">
160174
<SubType>
161175
</SubType>
162176
</ClCompile>
177+
<ClCompile Include="PrintCursorCheat.cpp">
178+
<SubType>
179+
</SubType>
180+
</ClCompile>
163181
<ClCompile Include="stdafx.cpp">
164182
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
165183
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>

Projects/Example Projects/ModCreatorKit/ModCreatorKit.vcxproj.filters

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@
8888
<ClInclude Include="AnimEditorUI.h">
8989
<Filter>ModCreatorKit\AnimEditor</Filter>
9090
</ClInclude>
91+
<ClInclude Include="PrintCursorCheat.h">
92+
<Filter>ModCreatorKit\Cheats</Filter>
93+
</ClInclude>
94+
<ClInclude Include="EffectLogCheat.h">
95+
<Filter>ModCreatorKit\Cheats</Filter>
96+
</ClInclude>
9197
</ItemGroup>
9298
<ItemGroup>
9399
<ClCompile Include="DetouredDBPF.cpp">
@@ -153,6 +159,12 @@
153159
<ClCompile Include="AnimEditorUI.cpp">
154160
<Filter>ModCreatorKit\AnimEditor</Filter>
155161
</ClCompile>
162+
<ClCompile Include="PrintCursorCheat.cpp">
163+
<Filter>ModCreatorKit\Cheats</Filter>
164+
</ClCompile>
165+
<ClCompile Include="EffectLogCheat.cpp">
166+
<Filter>ModCreatorKit\Cheats</Filter>
167+
</ClCompile>
156168
</ItemGroup>
157169
<ItemGroup>
158170
<None Include="SdkPathConfig.props" />
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "stdafx.h"
2+
#include "PrintCursorCheat.h"
3+
4+
void PrintCursorCheat::ParseLine(const ArgScript::Line& line)
5+
{
6+
App::ConsolePrintF("Current Cursor ID: 0x%x", CursorManager.GetActiveCursor());
7+
}
8+
9+
const char* PrintCursorCheat::GetDescription(ArgScript::DescriptionMode mode) const
10+
{
11+
if (mode == ArgScript::DescriptionMode::Basic) {
12+
return "Prints the ID of the current cursor to the console.";
13+
}
14+
else {
15+
return "DevPrintCursor: Prints the ID of the current cursor to the console.";
16+
}
17+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#pragma once
2+
3+
#include <Spore\BasicIncludes.h>
4+
5+
class PrintCursorCheat
6+
: public ArgScript::ICommand
7+
{
8+
public:
9+
10+
// Called when the cheat is invoked
11+
void ParseLine(const ArgScript::Line& line) override;
12+
13+
// Returns a string containing the description. If mode != DescriptionMode::Basic, return a more elaborated description
14+
const char* GetDescription(ArgScript::DescriptionMode mode) const override;
15+
};
16+

Projects/Example Projects/ModCreatorKit/ThumbnailCaptureScript.cpp

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,23 +157,54 @@ void ThumbnailCaptureScript::CaptureImage() {
157157
void ThumbnailCaptureScript::InjectListeners() {
158158
RemoveListeners();
159159
for (auto catUI : GetEditor()->mpPartsPaletteUI->mCategories) {
160-
for (auto pageUI : catUI->mPageUIs) {
161-
for (auto itemUI : pageUI.page->mStandardItems) {
162-
itemUI->field_18->AddWinProc(this);
163-
mItemViewers[itemUI->field_18.get()] = itemUI->mpViewer.get();
160+
auto subCatUIs = catUI->mpSubcategoriesUI;
161+
if (subCatUIs) {
162+
for (auto subCatUI : subCatUIs->mCategoryUIs) {
163+
for (auto pageUI : catUI->mPageUIs) {
164+
for (auto itemUI : pageUI.page->mStandardItems) {
165+
itemUI->field_18->AddWinProc(this);
166+
mItemViewers[itemUI->field_18.get()] = itemUI->mpViewer.get();
167+
}
168+
}
169+
}
170+
}
171+
else {
172+
for (auto pageUI : catUI->mPageUIs) {
173+
for (auto itemUI : pageUI.page->mStandardItems) {
174+
itemUI->field_18->AddWinProc(this);
175+
mItemViewers[itemUI->field_18.get()] = itemUI->mpViewer.get();
176+
}
164177
}
165178
}
179+
180+
181+
166182
}
167183

168184
Renderer.RegisterLayer(this, 40);
169185
}
170186

171187
void ThumbnailCaptureScript::RemoveListeners() {
188+
172189
for (auto catUI : GetEditor()->mpPartsPaletteUI->mCategories) {
173-
for (auto pageUI : catUI->mPageUIs) {
174-
for (auto itemUI : pageUI.page->mStandardItems) {
175-
if (itemUI && itemUI->field_18) {
176-
itemUI->field_18->RemoveWinProc(this);
190+
auto subCatUIs = catUI->mpSubcategoriesUI;
191+
if (subCatUIs) {
192+
for (auto subCatUI : subCatUIs->mCategoryUIs) {
193+
for (auto pageUI : catUI->mPageUIs) {
194+
for (auto itemUI : pageUI.page->mStandardItems) {
195+
if (itemUI && itemUI->field_18) {
196+
itemUI->field_18->RemoveWinProc(this);
197+
}
198+
}
199+
}
200+
}
201+
}
202+
else {
203+
for (auto pageUI : catUI->mPageUIs) {
204+
for (auto itemUI : pageUI.page->mStandardItems) {
205+
if (itemUI && itemUI->field_18) {
206+
itemUI->field_18->RemoveWinProc(this);
207+
}
177208
}
178209
}
179210
}

Spore ModAPI/Spore/Anim/AnimatedCreature.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace Anim
5858
/// Loads an animation to be used by this creature. It takes the ID of a TLSA group.
5959
/// It returns an index that is used to identify the animation within this creature.
6060
///
61-
/// TLSA Animaiton groups can specify multiple animation choices with different probabilities.
61+
/// TLSA Animation groups can specify multiple animation choices with different probabilities.
6262
/// The `pChoice` argument can be provided to force a certain choice index; if the value is -1,
6363
/// the argument will be used as an ooutput to know what choice has been selected.
6464
/// @param animID The ID of the animation to play, a TLSA group.

Spore ModAPI/Spore/App/cCreatureModeStrategy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ namespace App
9696

9797
Simulator::cCreatureBase* creature;
9898
int field_4;
99-
int field_8;
99+
int unlockLevel;
100100
};
101101
}
102102
}

0 commit comments

Comments
 (0)