Skip to content

Commit 474a155

Browse files
authored
Merge pull request #96 from Valla-Chan/master
Part Unlocks + Comm Conversations + Documentation
2 parents db6ff10 + fc9afd8 commit 474a155

37 files changed

+496
-100
lines changed

Projects/Example Projects/ModCreatorKit/ThumbnailCaptureScript.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void ThumbnailCaptureScript::DrawLayer(int flags, int layerIndex, App::cViewer**
9090
mOldColorSet = true;
9191
}
9292

93-
mpItemViewer->field_16A = false;
93+
mpItemViewer->mbRotationEnabled = false;
9494

9595
auto viewer = mpItemViewer->mpLayeredObject->GetViewer();
9696
viewer->SetBackgroundColor(ColorRGBA(0, 0, 0, 0));
@@ -114,7 +114,7 @@ void ThumbnailCaptureScript::DrawLayer(int flags, int layerIndex, App::cViewer**
114114
if (mpItemViewer->mZoom == mpItemViewer->mFinalZoom) {
115115
CaptureImage();
116116
// We will only do it once, also restore the rotation
117-
mpItemViewer->field_16A = true;
117+
mpItemViewer->mbRotationEnabled = true;
118118
mpItemViewer = nullptr;
119119

120120
model->mColor = ColorRGBA(mOldColor, 1.0f);

Spore ModAPI/SourceCode/DLL/AddressesAnim.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
namespace Anim
66
{
7+
namespace Addresses(AnimatedCreature)
8+
{
9+
DefineAddress(PlayAnimation, SelectAddress(0xA0C5D0, 0xA0C5D0));
10+
}
11+
712
namespace Addresses(IAnimManager)
813
{
914
DefineAddress(Get, SelectAddress(0x67CC70, 0x67CAE0));

Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,9 +1128,15 @@ namespace Simulator
11281128

11291129
namespace Addresses(cCollectableItems)
11301130
{
1131+
DefineAddress(sub_5976E0, SelectAddress(0x5976E0, 0x597A20));
11311132
DefineAddress(LoadConfig, SelectAddress(0x599100, 0x599440));
11321133
DefineAddress(AddUnlockableItem, SelectAddress(0x598A70, 0x598DB0));
11331134
DefineAddress(AddUnlockableItemFromProp, SelectAddress(0x598B50, 0x598E90));
1135+
1136+
DefineAddress(UnlockPart, SelectAddress(0x596A60, 0x596DA0));
1137+
DefineAddress(LockPart, SelectAddress(0x596AD0, 0x596E10));
1138+
DefineAddress(sub_594010, SelectAddress(0x594010, 0x5942E0));
1139+
11341140
DefineAddress(sub_597BC0, SelectAddress(0x597BC0, 0x597F00));
11351141
DefineAddress(sub_597390, SelectAddress(0x597390, 0x5976D0));
11361142
}

Spore ModAPI/SourceCode/Editors/EditorPalettes.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -531,17 +531,17 @@ namespace Palettes
531531
auto_METHOD_VOID(AdvancedItemViewer, SetAutoRotate, Args(bool arg), Args(arg));
532532
auto_METHOD_VOID(AdvancedItemViewer, SetZoom, Args(float zoom), Args(zoom));
533533

534-
void AdvancedItemViewer::func2Ch(bool value) {
535-
field_166 = value;
534+
void AdvancedItemViewer::SetShowModelOnHover(bool value) {
535+
mbShowModelOnHover = value;
536536
}
537-
bool AdvancedItemViewer::func30h() const {
538-
return field_166;
537+
bool AdvancedItemViewer::GetShowModelOnHover() const {
538+
return mbShowModelOnHover;
539539
}
540540
UTFWin::IWindow* AdvancedItemViewer::GetWindow() const {
541541
return mpWindow.get();
542542
}
543543
void AdvancedItemViewer::Set3dPreview(bool value) {
544-
field_EA = value;
544+
mb3DPreviewEnabled = value;
545545
}
546546
Anim::AnimatedCreature* AdvancedItemViewer::GetAnimatedCreature() const {
547547
return mpCreature.get();
@@ -607,40 +607,40 @@ namespace Palettes
607607
, field_34()
608608
, field_38()
609609
, field_3C()
610-
, field_40()
611-
, field_44()
612-
, field_48()
610+
, mInstanceID()
611+
, mTypeID()
612+
, mGroupID()
613613
, mFileName()
614614
, mpWindow()
615-
, field_60()
616-
, mZoom(1.0f)
615+
, mpWindowUnk1()
616+
, mInitialZoom(1.0f)
617617
, mRotation(0.0f)
618-
, field_6C(0.0f)
618+
, mInitialRotation(0.0f)
619+
, mZoom(1.0f)
619620
, mFinalZoom(1.0f)
620-
, field_94(1.0f)
621621
, field_98(Matrix3().SetIdentity())
622622
, field_BC()
623623
, field_C0()
624624
, field_C4()
625625
, field_C8(-1)
626626
, field_CC(-1)
627-
, field_D0(u"ui_material_blink")
628-
, field_D4(u"ui_material_blink")
627+
, mUIMaterialUnk1(u"ui_material_blink")
628+
, mUIMaterialUnk2(u"ui_material_blink")
629629
, field_D8()
630630
, field_DC()
631631
, field_E0(-1)
632-
, field_E4(u"ui_material_blink")
632+
, mUIMaterialUnk3(u"ui_material_blink")
633633
, field_E8(true)
634634
, field_E9()
635-
, field_EA(true)
635+
, mb3DPreviewEnabled(true)
636636
, field_EB()
637637
, field_EC()
638638
, mpCreature()
639639
, field_F4(2)
640640
, field_F8()
641641
, field_FC(true)
642642
, field_FD()
643-
, field_100(0x71FA7D3F)
643+
, mTriggerBehavior(TriggerBehaviors::Drag)
644644
, field_104()
645645
, mpModel()
646646
, field_11C()
@@ -654,10 +654,10 @@ namespace Palettes
654654
, mbCreationIsBaked()
655655
, field_164()
656656
, field_165(true)
657-
, field_166(true)
657+
, mbShowModelOnHover(true)
658658
, field_167()
659659
, field_169()
660-
, field_16A(true)
660+
, mbRotationEnabled(true)
661661
, mShowTooltip(true)
662662
, mbOmitBackground()
663663
, field_170()

Spore ModAPI/SourceCode/Simulator/CommManager.cpp

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,35 @@ namespace Simulator
1111

1212
auto_METHOD(cCommManager, cCommEvent*, CreateSpaceCommEvent,
1313
Args(uint32_t source, PlanetID planetKey, uint32_t fileID,
14-
uint32_t dialogID, void* pMission, int priority, unsigned int duration),
14+
uint32_t dialogID, cMission* pMission, int priority, unsigned int duration),
1515
Args(source, planetKey, fileID, dialogID, pMission, priority, duration));
1616

1717
auto_METHOD_VOID(cCommManager, ShowCommEvent, Args(cCommEvent* pEvent), Args(pEvent));
1818

1919
auto_METHOD_const_(cCommManager, bool, IsCommScreenActive);
2020

2121
auto_METHOD_VOID(cCommManager, HandleCivCommAction,
22-
Args(const CnvAction& action, void* pUnk, cCity* pSourceCity, cCity* pTargetCity),
22+
Args(const CnvAction& action, cCivilization* pUnk, cCity* pSourceCity, cCity* pTargetCity),
2323
Args(action, pUnk, pSourceCity, pTargetCity));
2424

2525
auto_METHOD_VOID(cCommManager, HandleSpaceCommAction,
26-
Args(const CnvAction& action, uint32_t source, PlanetID planetKey, void* pMission),
26+
Args(const CnvAction& action, uint32_t source, PlanetID planetKey, cMission* pMission),
2727
Args(action, source, planetKey, pMission));
28+
29+
30+
UTFWin::IWindow* cCommManager::GetCommBackgroundWindow() { return GetCommWindow(kWindowBackground); }
31+
32+
UTFWin::IWindow* cCommManager::GetCommWindow(uint32_t windowid) {
33+
if (CommManager.IsCommScreenActive()) {
34+
auto window = WindowManager.GetMainWindow()->FindWindowByID(0x01C3BB0C);
35+
return window->FindWindowByID(uint32_t(windowid));
36+
}
37+
return nullptr;
38+
}
39+
40+
UTFWin::IButton* cCommManager::GetCommButton(uint32_t buttonid) {
41+
return object_cast<UTFWin::IButton>(GetCommWindow(buttonid));
42+
}
2843
}
2944

3045
#endif

Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,24 @@ namespace Simulator
155155
Args(struct ResourceKey key, uint32_t categoryID, int row, int column, int pageIndex),
156156
Args(key, categoryID, row, column, pageIndex));
157157

158+
159+
auto_METHOD_VOID_(cCollectableItems, sub_5976E0);
160+
161+
auto_METHOD_VOID(cCollectableItems, UnlockPart,
162+
Args(uint32_t instanceID, uint32_t groupID, int unk),
163+
Args(instanceID, groupID, unk));
164+
165+
auto_METHOD_VOID(cCollectableItems, LockPart,
166+
Args(uint32_t instanceID, uint32_t groupID),
167+
Args(instanceID, groupID));
168+
169+
auto_METHOD_VOID_(cCollectableItems, sub_594010);
170+
171+
auto_METHOD_VOID(cCollectableItems, sub_597BC0,
172+
Args(UnkCategoryHashMap& dst, int unk, const ResourceKey& speciesKey),
173+
Args(dst, unk, speciesKey));
174+
175+
158176
auto_METHOD_VOID(cCollectableItems, sub_597390,
159177
Args(eastl::vector<int>& dst, struct cCollectableItemID itemID, int unk),
160178
Args(dst, itemID, unk));

Spore ModAPI/Spore/Anim/AnimatedCreature.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,14 @@ namespace Anim
107107
/* 64h */ virtual int func64h() = 0;
108108
/* 68h */ virtual int func68h() = 0;
109109
/* 6Ch */ virtual int func6Ch() = 0;
110-
/* 70h */ virtual Graphics::IModelWorld* GetAnimWorld() = 0;
110+
/* 70h */ virtual Graphics::IModelWorld* zGetModelWorld() = 0; // Broken.
111111
/* 74h */ virtual int func74h() = 0;
112112
/* 78h */ virtual int func78h() = 0; // returns main anim_query?
113113
/* 7Ch */ virtual ~AnimatedCreature();
114114

115+
IAnimWorld* GetAnimWorld() { return (mpAnimWorld); }
116+
Graphics::IModelWorld* GetModelWorld() { return GetModel() ? GetModel()->GetModelWorld() : nullptr; }
117+
115118
static bool IsIdleWalkLookatStart(uint32_t animID);
116119
static bool IsIdleWalkStop(uint32_t animID);
117120
static bool IsIdleWalk(uint32_t animID);
@@ -124,12 +127,14 @@ namespace Anim
124127

125128
/* 04h */ Vector3 mPosition;
126129
/* 10h */ Quaternion mOrientation;
127-
/* 20h */ char padding_20[0x154 - 0x20];
130+
/* 20h */ char padding_20[0x74 - 0x20];
128131

129132
// 3Ch scale?
130133

131134
// 70h flags?
132-
// 74h ColorRGBA that gets copied to model color
135+
/* 74h */ ColorRGBA mColor; // gets copied to model color initially. At runtime, color should be applied directly to the mpModel.
136+
137+
/* 84h */ char padding_84[0x154 - 0x84];
133138

134139
/* 154h */ int field_154;
135140
/* 158h */ int field_158;
@@ -149,6 +154,11 @@ namespace Anim
149154
};
150155
ASSERT_SIZE(AnimatedCreature, 0x19C);
151156

157+
namespace Addresses(AnimatedCreature)
158+
{
159+
DeclareAddress(PlayAnimation); // 0xA0C5D0 0xA0C5D0
160+
}
161+
152162
struct anim_query
153163
{
154164
struct AnimReference {

Spore ModAPI/Spore/Anim/IAnimWorld.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace Anim
3535
/* 28h */ virtual void UpdateCreatures(float deltaTime, App::cViewer* = nullptr) = 0;
3636
/* 2Ch */ virtual void PostUpdateCreatures(float deltaTime, App::cViewer* = nullptr) = 0;
3737
// model is not visible by default
38-
/* 30h */ virtual AnimatedCreature* LoadCreature(const ResourceKey& key, int = 2, const Vector3& = Vector3(), const Quaternion& = Quaternion(), bool = true) = 0;
38+
/* 30h */ virtual AnimatedCreature* LoadCreature(const ResourceKey& key, int = 2, const Vector3& position = Vector3(), const Quaternion& orientation = Quaternion(), bool = true) = 0;
3939
/* 34h */ virtual int func34h(int, int, int, int, int) = 0;
4040
// Loads a *.blocks file
4141
/* 38h */ virtual int LoadCreatureByName(const char*, int, int, int, int, int) = 0;

0 commit comments

Comments
 (0)