diff --git a/Projects/Example Projects/ModCreatorKit/ThumbnailCaptureScript.cpp b/Projects/Example Projects/ModCreatorKit/ThumbnailCaptureScript.cpp index 3fe17d08..534ef4b3 100644 --- a/Projects/Example Projects/ModCreatorKit/ThumbnailCaptureScript.cpp +++ b/Projects/Example Projects/ModCreatorKit/ThumbnailCaptureScript.cpp @@ -90,7 +90,7 @@ void ThumbnailCaptureScript::DrawLayer(int flags, int layerIndex, App::cViewer** mOldColorSet = true; } - mpItemViewer->field_16A = false; + mpItemViewer->mbRotationEnabled = false; auto viewer = mpItemViewer->mpLayeredObject->GetViewer(); viewer->SetBackgroundColor(ColorRGBA(0, 0, 0, 0)); @@ -114,7 +114,7 @@ void ThumbnailCaptureScript::DrawLayer(int flags, int layerIndex, App::cViewer** if (mpItemViewer->mZoom == mpItemViewer->mFinalZoom) { CaptureImage(); // We will only do it once, also restore the rotation - mpItemViewer->field_16A = true; + mpItemViewer->mbRotationEnabled = true; mpItemViewer = nullptr; model->mColor = ColorRGBA(mOldColor, 1.0f); diff --git a/Spore ModAPI/SourceCode/DLL/AddressesAnim.cpp b/Spore ModAPI/SourceCode/DLL/AddressesAnim.cpp index 5e213d55..f74c300a 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesAnim.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesAnim.cpp @@ -4,6 +4,11 @@ namespace Anim { + namespace Addresses(AnimatedCreature) + { + DefineAddress(PlayAnimation, SelectAddress(0xA0C5D0, 0xA0C5D0)); + } + namespace Addresses(IAnimManager) { DefineAddress(Get, SelectAddress(0x67CC70, 0x67CAE0)); diff --git a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp index 821a8e8d..4c907da4 100644 --- a/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp +++ b/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp @@ -1128,9 +1128,15 @@ namespace Simulator namespace Addresses(cCollectableItems) { + DefineAddress(sub_5976E0, SelectAddress(0x5976E0, 0x597A20)); DefineAddress(LoadConfig, SelectAddress(0x599100, 0x599440)); DefineAddress(AddUnlockableItem, SelectAddress(0x598A70, 0x598DB0)); DefineAddress(AddUnlockableItemFromProp, SelectAddress(0x598B50, 0x598E90)); + + DefineAddress(UnlockPart, SelectAddress(0x596A60, 0x596DA0)); + DefineAddress(LockPart, SelectAddress(0x596AD0, 0x596E10)); + DefineAddress(sub_594010, SelectAddress(0x594010, 0x5942E0)); + DefineAddress(sub_597BC0, SelectAddress(0x597BC0, 0x597F00)); DefineAddress(sub_597390, SelectAddress(0x597390, 0x5976D0)); } diff --git a/Spore ModAPI/SourceCode/Editors/EditorPalettes.cpp b/Spore ModAPI/SourceCode/Editors/EditorPalettes.cpp index 046b3da1..75779623 100644 --- a/Spore ModAPI/SourceCode/Editors/EditorPalettes.cpp +++ b/Spore ModAPI/SourceCode/Editors/EditorPalettes.cpp @@ -531,17 +531,17 @@ namespace Palettes auto_METHOD_VOID(AdvancedItemViewer, SetAutoRotate, Args(bool arg), Args(arg)); auto_METHOD_VOID(AdvancedItemViewer, SetZoom, Args(float zoom), Args(zoom)); - void AdvancedItemViewer::func2Ch(bool value) { - field_166 = value; + void AdvancedItemViewer::SetShowModelOnHover(bool value) { + mbShowModelOnHover = value; } - bool AdvancedItemViewer::func30h() const { - return field_166; + bool AdvancedItemViewer::GetShowModelOnHover() const { + return mbShowModelOnHover; } UTFWin::IWindow* AdvancedItemViewer::GetWindow() const { return mpWindow.get(); } void AdvancedItemViewer::Set3dPreview(bool value) { - field_EA = value; + mb3DPreviewEnabled = value; } Anim::AnimatedCreature* AdvancedItemViewer::GetAnimatedCreature() const { return mpCreature.get(); @@ -607,32 +607,32 @@ namespace Palettes , field_34() , field_38() , field_3C() - , field_40() - , field_44() - , field_48() + , mInstanceID() + , mTypeID() + , mGroupID() , mFileName() , mpWindow() - , field_60() - , mZoom(1.0f) + , mpWindowUnk1() + , mInitialZoom(1.0f) , mRotation(0.0f) - , field_6C(0.0f) + , mInitialRotation(0.0f) + , mZoom(1.0f) , mFinalZoom(1.0f) - , field_94(1.0f) , field_98(Matrix3().SetIdentity()) , field_BC() , field_C0() , field_C4() , field_C8(-1) , field_CC(-1) - , field_D0(u"ui_material_blink") - , field_D4(u"ui_material_blink") + , mUIMaterialUnk1(u"ui_material_blink") + , mUIMaterialUnk2(u"ui_material_blink") , field_D8() , field_DC() , field_E0(-1) - , field_E4(u"ui_material_blink") + , mUIMaterialUnk3(u"ui_material_blink") , field_E8(true) , field_E9() - , field_EA(true) + , mb3DPreviewEnabled(true) , field_EB() , field_EC() , mpCreature() @@ -640,7 +640,7 @@ namespace Palettes , field_F8() , field_FC(true) , field_FD() - , field_100(0x71FA7D3F) + , mTriggerBehavior(TriggerBehaviors::Drag) , field_104() , mpModel() , field_11C() @@ -654,10 +654,10 @@ namespace Palettes , mbCreationIsBaked() , field_164() , field_165(true) - , field_166(true) + , mbShowModelOnHover(true) , field_167() , field_169() - , field_16A(true) + , mbRotationEnabled(true) , mShowTooltip(true) , mbOmitBackground() , field_170() diff --git a/Spore ModAPI/SourceCode/Simulator/CommManager.cpp b/Spore ModAPI/SourceCode/Simulator/CommManager.cpp index 38c6f8e7..40928b4c 100644 --- a/Spore ModAPI/SourceCode/Simulator/CommManager.cpp +++ b/Spore ModAPI/SourceCode/Simulator/CommManager.cpp @@ -11,7 +11,7 @@ namespace Simulator auto_METHOD(cCommManager, cCommEvent*, CreateSpaceCommEvent, Args(uint32_t source, PlanetID planetKey, uint32_t fileID, - uint32_t dialogID, void* pMission, int priority, unsigned int duration), + uint32_t dialogID, cMission* pMission, int priority, unsigned int duration), Args(source, planetKey, fileID, dialogID, pMission, priority, duration)); auto_METHOD_VOID(cCommManager, ShowCommEvent, Args(cCommEvent* pEvent), Args(pEvent)); @@ -19,12 +19,27 @@ namespace Simulator auto_METHOD_const_(cCommManager, bool, IsCommScreenActive); auto_METHOD_VOID(cCommManager, HandleCivCommAction, - Args(const CnvAction& action, void* pUnk, cCity* pSourceCity, cCity* pTargetCity), + Args(const CnvAction& action, cCivilization* pUnk, cCity* pSourceCity, cCity* pTargetCity), Args(action, pUnk, pSourceCity, pTargetCity)); auto_METHOD_VOID(cCommManager, HandleSpaceCommAction, - Args(const CnvAction& action, uint32_t source, PlanetID planetKey, void* pMission), + Args(const CnvAction& action, uint32_t source, PlanetID planetKey, cMission* pMission), Args(action, source, planetKey, pMission)); + + + UTFWin::IWindow* cCommManager::GetCommBackgroundWindow() { return GetCommWindow(kWindowBackground); } + + UTFWin::IWindow* cCommManager::GetCommWindow(uint32_t windowid) { + if (CommManager.IsCommScreenActive()) { + auto window = WindowManager.GetMainWindow()->FindWindowByID(0x01C3BB0C); + return window->FindWindowByID(uint32_t(windowid)); + } + return nullptr; + } + + UTFWin::IButton* cCommManager::GetCommButton(uint32_t buttonid) { + return object_cast(GetCommWindow(buttonid)); + } } #endif \ No newline at end of file diff --git a/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp b/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp index a21bb8af..fe41fcc9 100644 --- a/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp +++ b/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp @@ -155,6 +155,24 @@ namespace Simulator Args(struct ResourceKey key, uint32_t categoryID, int row, int column, int pageIndex), Args(key, categoryID, row, column, pageIndex)); + + auto_METHOD_VOID_(cCollectableItems, sub_5976E0); + + auto_METHOD_VOID(cCollectableItems, UnlockPart, + Args(uint32_t instanceID, uint32_t groupID, int unk), + Args(instanceID, groupID, unk)); + + auto_METHOD_VOID(cCollectableItems, LockPart, + Args(uint32_t instanceID, uint32_t groupID), + Args(instanceID, groupID)); + + auto_METHOD_VOID_(cCollectableItems, sub_594010); + + auto_METHOD_VOID(cCollectableItems, sub_597BC0, + Args(UnkCategoryHashMap& dst, int unk, const ResourceKey& speciesKey), + Args(dst, unk, speciesKey)); + + auto_METHOD_VOID(cCollectableItems, sub_597390, Args(eastl::vector& dst, struct cCollectableItemID itemID, int unk), Args(dst, itemID, unk)); diff --git a/Spore ModAPI/Spore/Anim/AnimatedCreature.h b/Spore ModAPI/Spore/Anim/AnimatedCreature.h index c3341a2a..e628caac 100644 --- a/Spore ModAPI/Spore/Anim/AnimatedCreature.h +++ b/Spore ModAPI/Spore/Anim/AnimatedCreature.h @@ -107,11 +107,14 @@ namespace Anim /* 64h */ virtual int func64h() = 0; /* 68h */ virtual int func68h() = 0; /* 6Ch */ virtual int func6Ch() = 0; - /* 70h */ virtual Graphics::IModelWorld* GetAnimWorld() = 0; + /* 70h */ virtual Graphics::IModelWorld* zGetModelWorld() = 0; // Broken. /* 74h */ virtual int func74h() = 0; /* 78h */ virtual int func78h() = 0; // returns main anim_query? /* 7Ch */ virtual ~AnimatedCreature(); + IAnimWorld* GetAnimWorld() { return (mpAnimWorld); } + Graphics::IModelWorld* GetModelWorld() { return GetModel() ? GetModel()->GetModelWorld() : nullptr; } + static bool IsIdleWalkLookatStart(uint32_t animID); static bool IsIdleWalkStop(uint32_t animID); static bool IsIdleWalk(uint32_t animID); @@ -124,12 +127,14 @@ namespace Anim /* 04h */ Vector3 mPosition; /* 10h */ Quaternion mOrientation; - /* 20h */ char padding_20[0x154 - 0x20]; + /* 20h */ char padding_20[0x74 - 0x20]; // 3Ch scale? // 70h flags? - // 74h ColorRGBA that gets copied to model color + /* 74h */ ColorRGBA mColor; // gets copied to model color initially. At runtime, color should be applied directly to the mpModel. + + /* 84h */ char padding_84[0x154 - 0x84]; /* 154h */ int field_154; /* 158h */ int field_158; @@ -149,6 +154,11 @@ namespace Anim }; ASSERT_SIZE(AnimatedCreature, 0x19C); + namespace Addresses(AnimatedCreature) + { + DeclareAddress(PlayAnimation); // 0xA0C5D0 0xA0C5D0 + } + struct anim_query { struct AnimReference { diff --git a/Spore ModAPI/Spore/Anim/IAnimWorld.h b/Spore ModAPI/Spore/Anim/IAnimWorld.h index 2db73f21..dc9d5a1e 100644 --- a/Spore ModAPI/Spore/Anim/IAnimWorld.h +++ b/Spore ModAPI/Spore/Anim/IAnimWorld.h @@ -35,7 +35,7 @@ namespace Anim /* 28h */ virtual void UpdateCreatures(float deltaTime, App::cViewer* = nullptr) = 0; /* 2Ch */ virtual void PostUpdateCreatures(float deltaTime, App::cViewer* = nullptr) = 0; // model is not visible by default - /* 30h */ virtual AnimatedCreature* LoadCreature(const ResourceKey& key, int = 2, const Vector3& = Vector3(), const Quaternion& = Quaternion(), bool = true) = 0; + /* 30h */ virtual AnimatedCreature* LoadCreature(const ResourceKey& key, int = 2, const Vector3& position = Vector3(), const Quaternion& orientation = Quaternion(), bool = true) = 0; /* 34h */ virtual int func34h(int, int, int, int, int) = 0; // Loads a *.blocks file /* 38h */ virtual int LoadCreatureByName(const char*, int, int, int, int, int) = 0; diff --git a/Spore ModAPI/Spore/App/cCreatureModeStrategy.h b/Spore ModAPI/Spore/App/cCreatureModeStrategy.h index 8d5e6b1e..8d91d4ac 100644 --- a/Spore ModAPI/Spore/App/cCreatureModeStrategy.h +++ b/Spore ModAPI/Spore/App/cCreatureModeStrategy.h @@ -7,6 +7,7 @@ #include #include #include +#include #define cCreatureModeStrategyPtr eastl::intrusive_ptr #define ICreatureModeActionHandlerPtr eastl::intrusive_ptr @@ -82,21 +83,133 @@ namespace App #endif namespace CreatureModeStrategies { + using namespace Simulator; struct Interact { static const uint32_t ID = 0xD3353638; - Simulator::cCreatureBase* creature; - Simulator::cGameData* interactableObject; + cCreatureBase* creature; + cInteractableObject* interactableObject; int count; // ? + void* unk1; // unknown class }; + + struct EatFruit { + static const uint32_t ID = 0xD335362B; + cCreatureBase* creature; + cInteractableObject* food; + int field_8; // 0 + int field_16; // 0 + void* unk1; // unknown class? + }; + + struct EatMeat { + static const uint32_t ID = 0xD335362D; + + cCreatureBase* creature; + cInteractableObject* food; + int field_8; // 0 + void* unk1; // unknown class? + }; + struct UnlockPart { static const uint32_t ID = 0x5371F11; - Simulator::cCreatureBase* creature; + cCreatureBase* creature; int field_4; int unlockLevel; }; + + struct Mate { + static const uint32_t ID = 0xD335362C; + + cCreatureBase* creature; + cCreatureBase* targetcreature; + int field_8; // 0 + void* unk1; // unknown class? + }; + + struct LayEgg { + static const uint32_t ID = 0xD335362C; + + cCreatureBase* creature; + cCreatureBase* targetcreature; + int field_8; // 0 + void* unk1; // unknown class? + }; + + struct Pickup { + static const uint32_t ID = 0xD335362C; + + cCreatureBase* creature; + cInteractableObject* item; + int field_8; // 0 + void* unk1; // unknown class? + }; + + /// Unknowns /// + + + struct UnkActionCombat1 { // something to do with combat? + static const uint32_t ID = 0xD3353637; + + uint32_t field_4; // 0 + int field_8; // usually 1 + uint32_t field_12; // 0 + uint32_t field_16; // large value + uint32_t field_20; + }; + + struct UnkActionRelation1 { // Called when socializing or killing successfully? + static const uint32_t ID = 0x45AB96E; + + cCreatureBase* creature; + int field_4; + // struct, class, or pointer? Not cGameData + uint32_t field_8; + int field_12; // usually 1 + uint32_t field_16; + uint32_t field_20; + }; + + struct UnkActionSocial1 { // Called when socializing successfully, after UnkActionRelation1 + static const uint32_t ID = 0x60B4123; + + cCreatureBase* creature; + cCreatureBase* targetcreature; + uint32_t field_8; + uint32_t field_12; + uint32_t field_16; + uint32_t field_20; + uint32_t field_24; + uint32_t field_28; + }; + + struct UnkActionKill1 { // Called when killing successfully, after UnkActionRelation1 + static const uint32_t ID = 0xD335362C; + + cCreatureBase* creature; + cCreatureBase* targetcreature; + uint32_t field_8; + uint32_t field_12; + uint32_t field_16; + uint32_t field_20; + uint32_t field_24; + uint32_t field_28; + }; + + struct UnkActionKill2 { // Called when killing successfully, after UnkActionKill1 + static const uint32_t ID = 0xD3353637; + + cCreatureBase* creature; + cCreatureBase* targetcreature; + uint32_t field_12; // large value + uint32_t field_16; // large value + uint32_t field_20; + uint32_t field_24; + uint32_t field_28; + }; + } } diff --git a/Spore ModAPI/Spore/CommonIDs.h b/Spore ModAPI/Spore/CommonIDs.h index 71eac4b9..e5606ce1 100644 --- a/Spore ModAPI/Spore/CommonIDs.h +++ b/Spore ModAPI/Spore/CommonIDs.h @@ -147,6 +147,8 @@ namespace TypeIDs flr = 0x438F6347, /// City Music Planner (Anthems) cmp = 0x04F684A4, + /// Conversation + cnv = 0x055ADA24, /// Binary Editor Model bem = 0x1A99B06B, /// Spore Materials diff --git a/Spore ModAPI/Spore/Editors/Editor.h b/Spore ModAPI/Spore/Editors/Editor.h index 26251dfa..136696c2 100644 --- a/Spore ModAPI/Spore/Editors/Editor.h +++ b/Spore ModAPI/Spore/Editors/Editor.h @@ -192,7 +192,7 @@ namespace Editors // Editor::ScalePart(EditorRigblock *, int, int) - bool sub_581F70(EditorRigblock* part, void* activeHandle, int value); + bool sub_581F70(EditorRigblock* part, void* activeHandle, int value); // MorphPart? // loc_573BB1 -> set part is hovered? @@ -556,7 +556,7 @@ namespace Editors /* 4ACh */ int mRenderingQuality; // 1 /* 4B0h */ bool field_4B0; // true /* 4B1h */ bool field_4B1; // true - /* 4B2h */ bool field_4B2; + /* 4B2h */ bool field_4B2; // Something to do with skinpaint? /* 4B3h */ bool field_4B3; // not initialized /* 4B4h */ bool field_4B4; // not initialized /* 4B5h */ bool field_4B5; diff --git a/Spore ModAPI/Spore/Editors/EditorPlayMode.h b/Spore ModAPI/Spore/Editors/EditorPlayMode.h index 2aec563c..9fa3018d 100644 --- a/Spore ModAPI/Spore/Editors/EditorPlayMode.h +++ b/Spore ModAPI/Spore/Editors/EditorPlayMode.h @@ -70,7 +70,7 @@ namespace Editors /* 0Ch */ PlayModeUIPtr mpUI; /* 10h */ char padding_10[0x7C - 0x10]; - /* 7Ch */ PlayModeActor** mpMainActor; // at 10h, AnimatedCreatureController + /* 7Ch */ PlayModeActor* mpMainActor; // at 10h, AnimatedCreatureController /* 80h */ char padding_80[0xC8 - 0x80]; /* C8h */ IPlayModeModule* mModules[4]; /* D8h */ char padding_D8[0x3588 - 0xD8]; diff --git a/Spore ModAPI/Spore/Editors/EditorRequest.h b/Spore ModAPI/Spore/Editors/EditorRequest.h index ed95d23a..3a65ac56 100644 --- a/Spore ModAPI/Spore/Editors/EditorRequest.h +++ b/Spore ModAPI/Spore/Editors/EditorRequest.h @@ -73,7 +73,7 @@ namespace Editors void SetDefaultValidation(); - /// When this method is executed, the given request will be processed and + /// When this method is executed, the given request will be processed and open the editor. static bool Submit(EditorRequest* request); protected: @@ -115,7 +115,7 @@ namespace Editors /* 60h */ float field_60; /* 64h */ bool field_64; - /* 65h */ bool field_65; // show (unused) play button? + /* 65h */ bool field_65; // show (unused) play button /* 66h */ bool field_66; /* 68h */ int field_68; /* 6Ch */ bool field_6C; diff --git a/Spore ModAPI/Spore/Editors/PlayModeActor.h b/Spore ModAPI/Spore/Editors/PlayModeActor.h index 777762b9..68b28b1c 100644 --- a/Spore ModAPI/Spore/Editors/PlayModeActor.h +++ b/Spore ModAPI/Spore/Editors/PlayModeActor.h @@ -16,11 +16,11 @@ namespace Editors /* 14h */ int field_14; // not initialized /* 18h */ int field_18; // not initialized /* 1Ch */ int field_1C; // not initialized - /* 20h */ float field_20; - /* 24h */ float field_24; + /* 20h */ float field_20; // set to 1.0 Does not affect speed? + /* 24h */ float field_24; // set to 0.5. Something to do with acceleration and look dir? Higher values make acceleration faster and head not turn down. /* 28h */ bool field_28; /* 29h */ bool field_29; - /* 2Ah */ bool field_2A; + /* 2Ah */ bool field_2A; // set to true /* 2Bh */ bool field_2B; }; diff --git a/Spore ModAPI/Spore/Palettes/AdvancedItemViewer.h b/Spore ModAPI/Spore/Palettes/AdvancedItemViewer.h index ab500f6e..2e8d1e1c 100644 --- a/Spore ModAPI/Spore/Palettes/AdvancedItemViewer.h +++ b/Spore ModAPI/Spore/Palettes/AdvancedItemViewer.h @@ -50,8 +50,8 @@ namespace Palettes /* 20h */ virtual void Update(int time) override; /* 24h */ virtual void Load(const ResourceKey& fileName) override; /* 28h */ virtual void SetName(const ResourceKey& fileName) override; - /* 2Ch */ virtual void func2Ch(bool) override; - /* 30h */ virtual bool func30h() const override; + /* 2Ch */ virtual void SetShowModelOnHover(bool enabled) override; + /* 30h */ virtual bool GetShowModelOnHover() const override; /* 34h */ virtual UTFWin::IWindow* GetWindow() const override; /* 38h */ virtual void Set3dPreview(bool enabled) override; /* 3Ch */ virtual Anim::AnimatedCreature* GetAnimatedCreature() const override; diff --git a/Spore ModAPI/Spore/Palettes/ItemViewer.h b/Spore ModAPI/Spore/Palettes/ItemViewer.h index 0faef850..59aeb0c7 100644 --- a/Spore ModAPI/Spore/Palettes/ItemViewer.h +++ b/Spore ModAPI/Spore/Palettes/ItemViewer.h @@ -32,6 +32,13 @@ namespace Palettes { + enum class TriggerBehaviors : uint32_t + { + None = 0x2CA33BDB, + Drag = 0x71FA7D3, + Click = 0x5E71AB9B, + }; + class ItemViewer : public UTFWin::IWinProc , public DefaultRefCounted @@ -52,8 +59,8 @@ namespace Palettes /* 24h */ virtual void Load(const ResourceKey& fileName) = 0; /* 28h */ virtual void SetName(const ResourceKey& fileName) = 0; - /* 2Ch */ virtual void func2Ch(bool) = 0; - /* 30h */ virtual bool func30h() const = 0; + /* 2Ch */ virtual void SetShowModelOnHover(bool enabled) = 0; + /* 30h */ virtual bool GetShowModelOnHover() const = 0; /* 34h */ virtual UTFWin::IWindow* GetWindow() const = 0; /* 38h */ virtual void Set3dPreview(bool enabled) = 0; /* 3Ch */ virtual Anim::AnimatedCreature* GetAnimatedCreature() const = 0; //PLACEHOLDER GetAnimatedCreature() @@ -84,34 +91,34 @@ namespace Palettes /* 34h */ ObjectPtr field_34; /* 38h */ ObjectPtr field_38; /* 3Ch */ int field_3C; - /* 40h */ int field_40; - /* 44h */ int field_44; - /* 48h */ int field_48; - /* 4Ch */ ResourceKey mFileName; - /* 58h */ int field_58; // not initialized + /* 40h */ uint32_t mInstanceID; // Item instanceID + /* 44h */ uint32_t mTypeID; // Item typeID + /* 48h */ uint32_t mGroupID; // Item groupID + /* 4Ch */ ResourceKey mFileName; // Item Key + /* 58h */ uint32_t mTypeIDUnk1; // not initialized, usually set to 'prop' hash /* 5Ch */ IWindowPtr mpWindow; - /* 60h */ IWindowPtr field_60; + /* 60h */ IWindowPtr mpWindowUnk1; // Same as above? /* 64h */ float mZoom; // 1 /* 68h */ float mRotation; // 0 - /* 6Ch */ float field_6C; // 0 - /* 70h */ float mFinalZoom; // 1 + /* 6Ch */ float mInitialRotation; // 0 + /* 70h */ float mFinalZoom; // 1 // Desired zoom /* 74h */ char _padding_74[0x20]; - /* 94h */ float field_94; // 1 - /* 98h */ Math::Matrix3 field_98; + /* 94h */ float mInitialZoom; // 1 + /* 98h */ Math::Matrix3 field_98; // Something to do with model transforms /* BCh */ bool field_BC; /* C0h */ float field_C0; /* C4h */ float field_C4; /* C8h */ int field_C8; // -1 /* CCh */ int field_CC; // -1 - /* D0h */ const char16_t* field_D0; // "ui_material_blink" - /* D4h */ const char16_t* field_D4; // "ui_material_blink" + /* D0h */ const char16_t* mUIMaterialUnk1; // "ui_material_blink" + /* D4h */ const char16_t* mUIMaterialUnk2; // "ui_material_blink" /* D8h */ float field_D8; /* DCh */ float field_DC; /* E0h */ int field_E0; // -1 - /* E4h */ const char16_t* field_E4; // "ui_material_blink" + /* E4h */ const char16_t* mUIMaterialUnk3; // "ui_material_blink" /* E8h */ bool field_E8; // true /* E9h */ bool field_E9; - /* EAh */ bool field_EA; // true + /* EAh */ bool mb3DPreviewEnabled; // true // If set to false, model will not show when hovered /* EBh */ bool field_EB; /* ECh */ bool field_EC; /* F0h */ AnimatedCreaturePtr mpCreature; @@ -119,7 +126,7 @@ namespace Palettes /* F8h */ int field_F8; /* FCh */ bool field_FC; // true /* FDh */ bool field_FD; - /* 100h */ uint32_t field_100; // 0x71FA7D3F ('drag') + /* 100h */ TriggerBehaviors mTriggerBehavior; // TriggerBehaviors::Drag /* 104h */ eastl::vector field_104; /* 118h */ ModelPtr mpModel; /* 11Ch */ eastl::vector field_11C; @@ -134,11 +141,11 @@ namespace Palettes /* 163h */ bool mbCreationIsBaked; /* 164h */ bool field_164; /* 165h */ bool field_165; // true - /* 166h */ bool field_166; // true + /* 166h */ bool mbShowModelOnHover; // true /* 167h */ bool field_167; /* 168h */ bool field_168; // not initialized /* 169h */ bool field_169; - /* 16Ah */ bool field_16A; // true // mbRotationEnabled ? + /* 16Ah */ bool mbRotationEnabled; // true /* 16Bh */ bool mShowTooltip; // true /// If true, no background image will be set in the preview. /* 16Ch */ bool mbOmitBackground; diff --git a/Spore ModAPI/Spore/Palettes/PaletteMain.h b/Spore ModAPI/Spore/Palettes/PaletteMain.h index 0f083eba..aa0407ab 100644 --- a/Spore ModAPI/Spore/Palettes/PaletteMain.h +++ b/Spore ModAPI/Spore/Palettes/PaletteMain.h @@ -52,11 +52,11 @@ namespace Palettes /// @param creationTypeID The ID that represents the type of creation of the editor, such as 'creature'. /// @param arg_8 Sets the field_34 value; it's a folder ID used for icons, but only on very specific occasions. /// @param layoutID The default instance ID of the layout file that the palette must use. If this is specified, the - /// 'palettePaletteLayoutID' property willbe ignored. + /// 'palettePaletteLayoutID' property will be ignored. /// @param categoryLayoutID An instance ID that points to the layout categories must use. If this is specified, the - /// 'paletteCategoryLayoutFile' property on each category will be ignored. + /// 'paletteCategoryLayoutFile' property on each category will be ignored. /// @param pageLayoutID An instance ID that points to the layout pages must use. If this is specified, the - /// 'palettePageLayoutFile' property on each page will be ignored. + /// 'palettePageLayoutFile' property on each page will be ignored. /// @param arg_18 A value that will be set in field_2C. /// @returns True if the .prop file existed and was read, false otherwise. /// diff --git a/Spore ModAPI/Spore/Simulator/SimulatorEnums.h b/Spore ModAPI/Spore/Simulator/SimulatorEnums.h index 8c5e978f..62c68991 100644 --- a/Spore ModAPI/Spore/Simulator/SimulatorEnums.h +++ b/Spore ModAPI/Spore/Simulator/SimulatorEnums.h @@ -391,6 +391,19 @@ namespace Simulator StealFood = 10 }; + /// NOTE: RelationshipEvents corresponds to configurations in 0x0568DE14 (space_npc_relationship_effects~) which abide by the below format: + /// All values x10. + /* + floats RelationshipEventName + [initial bonus] (value x10, one-time) + [add value] (value x10, adds this value each time, including initially) + [min value] (returns max(relation, this x10) ) + [max value] (returns min(relation, this x10) ) + [decay amount] (returns relation + [add value] x [this]) (over time decay scale of addition value. Negative values decay down, Positive up.) + [decay frequency] lower values = faster decay + end + */ + /// Properties of relationships between communities (tribes, civilizations, empires) enum RelationshipEvents { @@ -475,6 +488,63 @@ namespace Simulator kRelationshipEventTribeSocialPower = 0x54EAB4B3 }; + // Default Spore CNV actions + enum CnvActions { + kCnvCommExit = 0x01994745, // "exit" + kCnvCommcontinue = 0xCAFF0F72, // "continue" + kCnvCommEvent = 0x02D5DCEC, // runs a comm event from the key + + kCnvInsult = 0x26B14441, + kCnvCompliment = 0x70C14C34, + + kCnvAttackCity1 = 0x18646F3F, + kCnvAttackCity2 = 0x18646F3C, + kCnvAttackCity3 = 0x18646F3D, + kCnvAttackCity4 = 0x18646F3A, + kCnvAttackCity5 = 0x18646F3B, + kCnvAttackCity6 = 0x18646F38, + kCnvAttackCity7 = 0x18646F39, + kCnvAttackCity8 = 0x18646F36, + kCnvAttackCity9 = 0x18646F37, + kCnvAttackCity10 = 0xA51B201D, + + kCnvAcceptSurrender = 0x3EF09234, + + kCnvBuyCityFor3200 = 0x758330B8, + kCnvBuyCityFor2400 = 0x758330BB, + kCnvBuyCityFor1600 = 0x758330BA, + kCnvBuyCityFor8000 = 0x758330BD, + kCnvBuyCityFor4000 = 0x758330BC, + kCnvCancelBuy = 0xA3C1D501, + + kCnvCaptureCitybyMilitary = 0x6BA64250, + kCnvCityBuyAccepted = 0x8650BD5B, + kCnvCityBuyAcceptedHigh = 0x6668560E, + + kCnvLargeGift = 0xD648ED4D, // 4000 + kCnvMediumGift = 0x5EA6D3ED, // 2000 + kCnvSmallGift = 0x410C4A65, // 1000 + + kCnvTradeRouteAccept = 0xCADAC8A0, + kCnvTradeRouteDeny = 0x1125D6A9, + kCnvAllianceAccept = 0x24E1525D, + kCnvAllianceRequestMoney = 0x9F0FF4CB, + kCnvAllianceRefuse = 0x0764C336, + + kCnvEmbargoAccept = 0xD50A1A6D, + kCnvEmbargoRequestMoney = 0xE7977907, + kCnvEmbargoRefuse = 0x789418DC, + kCnvPlayerBidTooLow = 0x96508A98, + kCnvDemandAccept = 0x23A2D684, + kCnvDemandDeny = 0x764EA37C, + + kCnvUnk1 = 0x6BA64250, // Civ War/capture related + kCnvUnk2 = 0xBF3B803A, // Civ buy offer refused? + kCnvUnk3 = 0x015BC92B, // Civ NPC-to-player buy offer related + kCnvUnk4 = 0x7E41D64A, // Civ NPC-to-player buy offer related + kCnvUnk5 = 0x91386D6C, // Civ attack city counter? + }; + /// Possible genres of an adventure, used by Simulator::cScenarioModeData enum class ScenarioGenre : uint32_t { diff --git a/Spore ModAPI/Spore/Simulator/SimulatorMessages.h b/Spore ModAPI/Spore/Simulator/SimulatorMessages.h index a74b6430..95afd177 100644 --- a/Spore ModAPI/Spore/Simulator/SimulatorMessages.h +++ b/Spore ModAPI/Spore/Simulator/SimulatorMessages.h @@ -32,7 +32,7 @@ namespace Simulator /// Simulator::EnterEditorMessage; Enters the correct editor modifying the specified creation. kMsgEnterEditor = 0x53850BAE, - /// Switches the editor. Use the desired editor ID as the message data . + /// Switches the editor. Use the desired editor ID as the message data. kMsgSwitchEditor = 0x0212D3E7, kMsgSwitchGameMode = 0x0212D3E7, diff --git a/Spore ModAPI/Spore/Simulator/SubSystem/CommManager.h b/Spore ModAPI/Spore/Simulator/SubSystem/CommManager.h index 3170f5c3..93d4e515 100644 --- a/Spore ModAPI/Spore/Simulator/SubSystem/CommManager.h +++ b/Spore ModAPI/Spore/Simulator/SubSystem/CommManager.h @@ -3,11 +3,50 @@ #include #include #include +#include +#include +#include #define CommManager (*Simulator::cCommManager::Get()) namespace Simulator { + // Corresponds to window controlIDs in CommScreen-3.spui + enum CommWindowIDs { + // Panels containing windows + kWindowPanelViewport = 0x06429C80, + kWindowPanelLower = 0x05E4E5F0, + + // Windows inside panels + kWindowBackground = 0x05EDFF88, + //kCnvWindowViewport = 0x06243260, // Needs verification + kWindowTrading = 0x05E62A48, + kWindowText = 0x018072CB, + + }; + + // Corresponds to button controlIDs in CommScreen-3.spui + enum CommButtonIDs { + + // Space only Buttons + kBtnTrade = 0x057DF5CA, + kBtnRepair = 0x057DF5C8, + kBtnRecharge = 0x057DF5C9, + + kBtnMissions = 0x05E51D28, + kBtnDiplomacy = 0x05E51D30, + + kBtnMenu = 0x05DFF098, // Satellite icon + kBtnExit = 0x05E4F778, // Goodbye + + kBtnAccept = 0x05E4F788, // Red in spui + kBtnDecline = 0x05E4F770, + + kBtnTradeBuy = 0x04C1510A, + kBtnTradeSell = 0x04C1510C, + }; + + class cCommManager : public cStrategy { @@ -15,16 +54,21 @@ namespace Simulator cCommEvent* CreateCivCommEvent(cCivilization* pSourceCivilization, cCity* pTargetCity, PlanetID planetKey, uint32_t fileID, uint32_t dialogID, int priority = 0); - cCommEvent* CreateSpaceCommEvent(uint32_t sourceEmpire, PlanetID planetKey, uint32_t fileID, - uint32_t dialogID, void* pMission = nullptr, int priority = 0, unsigned int duration = 0); + cCommEvent* CreateSpaceCommEvent(uint32_t sourceEmpireID, PlanetID planetKey, uint32_t fileID, + uint32_t dialogID, cMission* pMission = nullptr, int priority = 0, unsigned int duration = 0); void ShowCommEvent(cCommEvent* pEvent); bool IsCommScreenActive() const; - void HandleCivCommAction(const CnvAction& action, void* pSourceCiv, cCity* pSourceCity, cCity* pTargetCity); + void HandleCivCommAction(const CnvAction& action, cCivilization* pSourceCiv, cCity* pSourceCity, cCity* pTargetCity); + + void HandleSpaceCommAction(const CnvAction& action, uint32_t sourceEmpireID, PlanetID planetKey, cMission* pMission); + - void HandleSpaceCommAction(const CnvAction& action, uint32_t source, PlanetID planetKey, void* pMission); + UTFWin::IWindow* GetCommBackgroundWindow(); + UTFWin::IWindow* GetCommWindow(uint32_t windowid); + UTFWin::IButton* GetCommButton(uint32_t buttonid); public: /* 20h */ cCommEventPtr mCurrentCommEvent; diff --git a/Spore ModAPI/Spore/Simulator/SubSystem/GameModeManager.h b/Spore ModAPI/Spore/Simulator/SubSystem/GameModeManager.h index 5e926024..d4312294 100644 --- a/Spore ModAPI/Spore/Simulator/SubSystem/GameModeManager.h +++ b/Spore ModAPI/Spore/Simulator/SubSystem/GameModeManager.h @@ -122,6 +122,41 @@ namespace Simulator return GetGameModeID() == kLoadGameMode; } + /// Returns true if the game is currently in the editor + inline bool IsEditorMode() { + return GetGameModeID() == kEditorMode; + } + + /// Returns true if the game is currently in one of the ingame "X Stage" modes + inline bool IsStageGameMode() { + switch (GetGameModeID()) + { + case kGameCell: + case kGameCreature: + case kGameTribe: + case kGameCiv: + case kGameSpace: + return true; + default: + return false; + } + } + + /// Returns true if the game is currently in one of the Simulator modes + inline bool IsSimulatorGameMode() { + switch (GetGameModeID()) + { + case kGameCreature: + case kGameTribe: + case kGameCiv: + case kGameSpace: + case kScenarioMode: + return true; + default: + return false; + } + } + namespace Addresses(cGameModeManager) { DeclareAddress(Get); diff --git a/Spore ModAPI/Spore/Simulator/SubSystem/cRelationshipManager.h b/Spore ModAPI/Spore/Simulator/SubSystem/cRelationshipManager.h index 90d2440c..c2286ef5 100644 --- a/Spore ModAPI/Spore/Simulator/SubSystem/cRelationshipManager.h +++ b/Spore ModAPI/Spore/Simulator/SubSystem/cRelationshipManager.h @@ -52,7 +52,7 @@ namespace Simulator /* 00h */ float mValue; // Flag 0x1 is at war, 0x2 allied? /* 04h */ int mFlags; - /* 08h */ eastl::map mRelationshipEvents; + /* 08h */ eastl::map mRelationshipEvents; // map of RelationshipEvents to their values. }; /// Handles relationships between political entities. @@ -149,13 +149,21 @@ namespace Simulator /// @returns float GetRelationshipEventValue(uint32_t politicalID1, uint32_t politicalID2, uint32_t relationshipID); + /// Returns the cRelationshipData between 2 political entities. + /// NOTE: order of the IDs does not matter. + cRelationshipData* GetRelationshipData(uint32_t politicalID1, uint32_t politicalID2) { + eastl::pair key = eastl::make_pair(politicalID1, politicalID2); + auto it = mRelationships.find(key); + if (it != mRelationships.end()) { return &(it->second); } { return nullptr; } + } + public: /* 10h */ float field_10; /* 14h */ float field_14; /* 18h */ float field_18; /* 1Ch */ float field_1C; /* 20h */ bool mbIsInitialized; - /* 24h */ eastl::map, cRelationshipData> mRelationships; // map of maps? + /* 24h */ eastl::map, cRelationshipData> mRelationships; // map of maps? seems to tie pairs of political IDs to relationship data /* 40h */ int field_40; /* 44h */ int field_44; /* 48h */ eastl::vector field_48; diff --git a/Spore ModAPI/Spore/Simulator/SubSystem/cStrategy.h b/Spore ModAPI/Spore/Simulator/SubSystem/cStrategy.h index 367b043b..39c45dd7 100644 --- a/Spore ModAPI/Spore/Simulator/SubSystem/cStrategy.h +++ b/Spore ModAPI/Spore/Simulator/SubSystem/cStrategy.h @@ -81,6 +81,7 @@ namespace Simulator public: /* 08h */ int mnRefCount; + // NOTE: These 2 mode values can sometimes appear swapped when changing modes. /* 0Ch */ uint32_t mLastGameMode; // -1 /* 10h */ uint32_t mCurrentGameMode; // -1 /* 14h */ uint32_t field_14; // -1 diff --git a/Spore ModAPI/Spore/Simulator/cCollectableItems.h b/Spore ModAPI/Spore/Simulator/cCollectableItems.h index 1db646fc..da0e0423 100644 --- a/Spore ModAPI/Spore/Simulator/cCollectableItems.h +++ b/Spore ModAPI/Spore/Simulator/cCollectableItems.h @@ -19,6 +19,7 @@ namespace Simulator { Unlocked = 1, + // Highlighted = 2 ??? // NotUnlockable = 4 ??? }; @@ -26,6 +27,11 @@ namespace Simulator uint32_t instanceID; uint32_t groupID; }; + struct alignas(8) cCollectableRowID { + uint16_t rowIndex; + uint16_t pageIndex; + uint32_t categoryID; + }; constexpr cCollectableItemID COLLECTABLE_ITEM_NULL_ID = { -1, -1 }; } @@ -38,6 +44,11 @@ namespace eastl { size_t operator()(const Simulator::cCollectableItemID& val) const { return static_cast(val.instanceID); } }; + /// A necessary structure to be able to use cCollectableRowID on containers such as hash_map. + template <> struct hash + { + size_t operator()(const Simulator::cCollectableRowID& val) const { return static_cast(val.pageIndex & 0xFFFF + val.rowIndex); } + }; } #endif @@ -54,17 +65,28 @@ namespace Simulator inline cCollectableItemsRowID GetCollectableItemsRowID(uint32_t categoryID, int pageIndex, int row) { return ((uint64_t)categoryID) << 32 | (pageIndex << 16) | row; } - + + /// One of these structs per unlockable page struct UnkHashtableItem { - int field_0; - int field_4; + //int field_0; // generally stays the same as parts are unlocked, but not always + //int field_4; // decreases as parts are unlocked + + uint16_t field_0; // some type of storage size. usually 1 value below some power of 2. generally stays the same as parts are unlocked, but not always + uint16_t field_2; + uint16_t field_4; // decreases to 0 as parts are unlocked + uint16_t field_6; // usually 0? }; ASSERT_SIZE(UnkHashtableItem, 8); - typedef eastl::sp_fixed_hash_map UnkHastable; - ASSERT_SIZE(UnkHastable, 0xDC); - typedef eastl::sp_fixed_hash_map UnkHashMap; - ASSERT_SIZE(UnkHashMap, 0x888); + /// Map {value, pageindex} to the UnkHashtableItem + /// Before all parts are unlocked, 'value' = 0x3e09800e + /// After all parts are unlocked, 'value' = 0x5c225570 + typedef eastl::sp_fixed_hash_map UnkPageHashtable; + ASSERT_SIZE(UnkPageHashtable, 0xDC); + + /// maps categoryID to UnkPageHashtable for each unlockable category + typedef eastl::sp_fixed_hash_map UnkCategoryHashMap; + ASSERT_SIZE(UnkCategoryHashMap, 0x888); class cCollectableItems : public ISimulatorSerializable @@ -77,12 +99,13 @@ namespace Simulator using Object::Release; using Object::Cast; + void sub_5976E0(); void LoadConfig(uint32_t configGroupID, uint32_t configInstanceID, uint32_t itemsGroupID); void AddUnlockableItem(uint32_t instanceID, uint32_t groupID, int itemUnlockLevel, uint32_t categoryID, int row, int column, int pageIndex, float itemUnlockFindPercentage, uint32_t itemUnlockEffect); /// Reads the prop file, checks the `itemUnlockLevel`, `itemUnlockEffect` and `itemUnlockFindPercentage` properties, and calls AddUnlockableItem(). - /// If itemUnlockFindPercentage is greater or equal than 1, it unlocks the item. + /// If itemUnlockFindPercentage is greater than or equal to 1, it unlocks the item. /// @param key /// @param categoryID /// @param row @@ -90,9 +113,19 @@ namespace Simulator /// @param pageIndex bool AddUnlockableItemFromProp(struct ResourceKey key, uint32_t categoryID, int row, int column, int pageIndex); + // UnlockPart and LockPart do not update the part visiblity when called in the editor. + void UnlockPart(uint32_t instanceID, uint32_t groupID, int = 0); + void LockPart(uint32_t instanceID, uint32_t groupID); + + // Called after UnlockPart and LockPart, then UnlockPart is called again after this to add the highlighted "new" parts + void sub_594010(); + // called at the start of creature stage with an int of "1" and a nullptr speciesKey - void sub_597BC0(UnkHashMap& dst, int, const ResourceKey& speciesKey); + // populates the category hash map? + void sub_597BC0(UnkCategoryHashMap& dst, int, const ResourceKey& speciesKey); + // called when cCreatureModeStrategy::ExecuteAction calls with an 'UnlockPart' action + // currently cannot be detoured without crashing? void sub_597390(eastl::vector& dst, struct cCollectableItemID itemID, int); public: @@ -109,12 +142,12 @@ namespace Simulator ASSERT_SIZE(UnlockableItem, 0x1C); #ifndef SDK_TO_GHIDRA - /* 0Ch */ bool field_C; // true + /* 0Ch */ bool field_C; // true (set to false after LoadConfig and before UnlockPart/LockPart) /// Stores a progression of unlockable items (for instance, all the mouths in the same row) /* 10h */ eastl::sp_fixed_map mUnlockableRows; /// Maps the group/instance of a rigblock to its UnlockableItem data /* 148Ch */ eastl::sp_fixed_hash_map mUnlockableItems; - /// Some flags + /// Some flags. mItemStatusInfos->reset_lose_memory() makes all items hidden in the editor. /* 4D00h */ eastl::sp_fixed_hash_map mItemStatusInfos; /* 6D5Ch */ eastl::vector mUnlocksPerLevel; /* 6D70h */ int mUnlockPoints; @@ -122,7 +155,7 @@ namespace Simulator /* 6D78h */ float mFindPercentageLevelMultiplier; // 1.0 /* 6D7Ch */ float mGlobalFindPercentageMultiplier; // 1.0 /* 6D80h */ eastl::list mUnlockedItems; - /* 6D8Ch */ eastl::hash_map field_6D8C; + /* 6D8Ch */ eastl::hash_map field_6D8C; // empty? #else // SDKtoGHIDRA does not support sp_fixed_ structures with alignment 8 /* 0Ch */ bool field_C; // true @@ -148,6 +181,11 @@ namespace Simulator DeclareAddress(AddUnlockableItem); // 0x598A70 0x598DB0 DeclareAddress(AddUnlockableItemFromProp); // 0x598B50 0x598E90 + DeclareAddress(sub_5976E0); // 0x5976E0 0x597A20 + DeclareAddress(UnlockPart); // 0x596A60 0x596DA0 + DeclareAddress(LockPart); // 0x596AD0 0x596E10 + DeclareAddress(sub_594010); // 0x594010 0x5942E0 + DeclareAddress(sub_597BC0); // 0x597BC0 0x597F00 DeclareAddress(sub_597390); // 0x597390 0x5976D0 } @@ -156,6 +194,7 @@ namespace Simulator class CreatureGamePartUnlocking { public: + // Given an (unknown) hashmap (the creature parts one always is size 56), // return a valid new part ID to unlock, or call this func again until it returns a valid part. // @@ -163,10 +202,11 @@ namespace Simulator // unk1 has something to do with how many times the function is called unsuccessfully; if it reaches 2 twice, unlockLevel is set to -1. // unlockLevel will be either a .prop unlockLevel value or -1 // - // the cCollectableItemID return value is formatted as such: + // The cCollectableRowID return value is formatted as such: // groupID: category name (eg: ce_category_mouths) - // instanceID: part placement in category by page index and part row (eg: a part on page 4 and row 5 would have a hex of 0x30004) - struct cCollectableItemID sub_D3B460(UnkHashMap& unk0, bool firstCall, int unk1, int unlockLevel); + // instanceID: part placement in category by page index and part row index (eg: a part on page 4 and row 5 would have a hex of 0x30004) + // (column is unspecified because it returns the next unlocked part in the row) + struct cCollectableRowID sub_D3B460(UnkCategoryHashMap& unk0, bool firstCall, int unk1, int unlockLevel); }; namespace Addresses(CreatureGamePartUnlocking) diff --git a/Spore ModAPI/Spore/Simulator/cCombatant.h b/Spore ModAPI/Spore/Simulator/cCombatant.h index 91957d67..e9a487f5 100644 --- a/Spore ModAPI/Spore/Simulator/cCombatant.h +++ b/Spore ModAPI/Spore/Simulator/cCombatant.h @@ -79,7 +79,8 @@ namespace Simulator /* 14h */ virtual cSpaceToolData* GetWeapon(); /// Called when the combatant is attacked, takes the damage - /* 18h */ virtual int TakeDamage(float damage, uint32_t attackerPoliticalID, int, const Vector3&, cCombatant* pAttacker); // used to substract health + /// Vector3 may be knockback direction? + /* 18h */ virtual int TakeDamage(float damage, uint32_t attackerPoliticalID, int damagetype, const Vector3&, cCombatant* pAttacker); // used to substract health /* 1Ch */ virtual void AddHostileUnit(cCombatant* combatant); /* 20h */ virtual Math::Vector3 func20h(); diff --git a/Spore ModAPI/Spore/Simulator/cCommEvent.h b/Spore ModAPI/Spore/Simulator/cCommEvent.h index ac794cd0..08499e32 100644 --- a/Spore ModAPI/Spore/Simulator/cCommEvent.h +++ b/Spore ModAPI/Spore/Simulator/cCommEvent.h @@ -22,6 +22,7 @@ namespace Simulator /* 0Ch */ cCommEventType mEventType; // -1 /* 10h */ int field_10; /* 14h */ int field_14; + // These values don't seem to be empire political IDs /* 18h */ uint32_t mSource; // -1 /* 1Ch */ uint32_t mTarget; // -1 /* 20h */ cCityPtr mpSourceCity; diff --git a/Spore ModAPI/Spore/Simulator/cCommunity.h b/Spore ModAPI/Spore/Simulator/cCommunity.h index af0b52cf..b461797d 100644 --- a/Spore ModAPI/Spore/Simulator/cCommunity.h +++ b/Spore ModAPI/Spore/Simulator/cCommunity.h @@ -76,7 +76,7 @@ namespace Simulator /* 64h */ virtual Vector3& func64h(); /* 68h */ virtual void func68h(); /* 6Ch */ virtual cCityWalls* GetCityWalls(); // returns 0 - /* 70h */ virtual eastl::vector& GetPopulation(); + /* 70h */ virtual eastl::vector& GetPopulation(); /* 74h */ virtual int GetPopulationCount(); // returns the count of vector returned by GetPopulation() /* 78h */ virtual void func78h(); /* 7Ch */ virtual eastl::string16& GetCommunityName(); diff --git a/Spore ModAPI/Spore/Simulator/cCreatureBase.h b/Spore ModAPI/Spore/Simulator/cCreatureBase.h index 751b7418..512cdd67 100644 --- a/Spore ModAPI/Spore/Simulator/cCreatureBase.h +++ b/Spore ModAPI/Spore/Simulator/cCreatureBase.h @@ -115,7 +115,7 @@ namespace Simulator // sub_C1BE40 WALK TO?? // arg_8 is normalized vector - void WalkTo(int speedState, const Vector3& dstPos, const Vector3& arg_8, float goalStopDistance=1.0f, float acceptableStopDistance=2.0f); + void WalkTo(int speedState, const Vector3& dstPos, const Vector3& arg_8, float goalStopDistance = 1.0f, float acceptableStopDistance = 2.0f); //TODO loc_D315AE know how much distance advances with WASD diff --git a/Spore ModAPI/Spore/Simulator/cCreatureDisplayStrategy.h b/Spore ModAPI/Spore/Simulator/cCreatureDisplayStrategy.h index d4aced3a..a155024a 100644 --- a/Spore ModAPI/Spore/Simulator/cCreatureDisplayStrategy.h +++ b/Spore ModAPI/Spore/Simulator/cCreatureDisplayStrategy.h @@ -45,9 +45,9 @@ namespace Simulator /* 17Ch */ float field_17C; /* 180h */ float field_180; /* 184h */ float field_184; // true - /// Effect 0x36099ACF + /// Effect 0x36099ACF, something related to low health? vignette effect /* 188h */ IVisualEffectPtr field_188; - /// Effect 0xAAA2AC3C + /// Effect 0xAAA2AC3C, something related to low health? red drops effect /* 18Ch */ IVisualEffectPtr field_18C; /* 190h */ char field_190[0x320 - 0x190]; }; diff --git a/Spore ModAPI/Spore/Simulator/cCreatureGameData.h b/Spore ModAPI/Spore/Simulator/cCreatureGameData.h index 775a7dae..86f6f057 100644 --- a/Spore ModAPI/Spore/Simulator/cCreatureGameData.h +++ b/Spore ModAPI/Spore/Simulator/cCreatureGameData.h @@ -62,7 +62,7 @@ namespace Simulator /* 11h */ bool field_11; /* 14h */ int field_14; /* 18h */ Math::Vector3 field_18; - /* 24h */ AbilityMode mAbilityMode; + /* 24h */ AbilityMode mAbilityMode; // Social / Attack stance /* 28h */ float mEvolutionPoints; /* 30h */ uint64_t DEPRECATED_mLearnedAbilities; /* 38h */ int mLearnedAbilities[3]; diff --git a/Spore ModAPI/Spore/Simulator/cCultureSet.h b/Spore ModAPI/Spore/Simulator/cCultureSet.h index c83ca83b..fffc625c 100644 --- a/Spore ModAPI/Spore/Simulator/cCultureSet.h +++ b/Spore ModAPI/Spore/Simulator/cCultureSet.h @@ -26,6 +26,7 @@ namespace Simulator { /// Contains the IDs of all the creation types of a specific "culture" or civilization/empire. This maps /// each member of the ModelTypes enum to a creation ID. + /// Note: Does not store creature data. class cCultureSet { public: diff --git a/Spore ModAPI/Spore/Simulator/cGameDataUFO.h b/Spore ModAPI/Spore/Simulator/cGameDataUFO.h index b7b38fbd..8d1df49a 100644 --- a/Spore ModAPI/Spore/Simulator/cGameDataUFO.h +++ b/Spore ModAPI/Spore/Simulator/cGameDataUFO.h @@ -81,7 +81,7 @@ namespace Simulator /* 6D0h */ cGonzagoTimer field_6D0; /* 6F0h */ cGonzagoTimer field_6F0; /* 710h */ int field_710; - /// 0 is player UFO + /// 0 is player UFO. See UfoType enum. /* 714h */ int mUFOType; // -1 /* 718h */ Vector3 mNextPosition; /* 724h */ Vector3 mNextVelocity; diff --git a/Spore ModAPI/Spore/Simulator/cTribe.h b/Spore ModAPI/Spore/Simulator/cTribe.h index 831c257d..6c372749 100644 --- a/Spore ModAPI/Spore/Simulator/cTribe.h +++ b/Spore ModAPI/Spore/Simulator/cTribe.h @@ -69,10 +69,10 @@ namespace Simulator /// Generates the tribe food mat and tribe members /* 8Ch */ virtual void SpawnTribe(const Math::Vector3& position, int numMembers, int, bool); - /// Returns the vector with the members of the tribe + /// Returns the vector with the members of the tribe, including non-selectables /* 90h */ virtual eastl::vector& GetTribeMembers(); - /// Returns a vector of all selectable members of the tribe - /* 94h */ virtual eastl::vector& GetSelectableMembers(); + /// Returns a vector of all selectable members of the tribe (excludes baby creatures) + /* 94h */ virtual eastl::vector& GetSelectableMembers(); /* 98h */ virtual cCreatureCitizen* SpawnMember(int age); /// Removes a member of the tribe. index seems to cause issues if not 0. /* 9Ch */ virtual void func9Ch(int index, bool); diff --git a/Spore ModAPI/Spore/UTFWin/ITextEdit.h b/Spore ModAPI/Spore/UTFWin/ITextEdit.h index cf5a1595..e4c139dd 100644 --- a/Spore ModAPI/Spore/UTFWin/ITextEdit.h +++ b/Spore ModAPI/Spore/UTFWin/ITextEdit.h @@ -91,14 +91,14 @@ namespace UTFWin /// Gets the component color for the given text type. /// @param index The type of text affected by the color, in the TextColors enum. /// - /* 1Ch */ virtual Color GetColor(TextColors index) const = 0; + /* 1Ch */ virtual Math::Color GetColor(TextColors index) const = 0; /// /// Specifies the component colors for the given text mode. /// @param index The type of text affected by this color, in the TextColors enum. /// @param color The new Color. /// - /* 20h */ virtual void SetColor(TextColors index, Color color) = 0; + /* 20h */ virtual void SetColor(TextColors index, Math::Color color) = 0; /* 24h */ virtual const Math::Rectangle& GetBorderWidth() const = 0; /* 28h */ virtual void SetBorderWidth(const Math::Rectangle& widths) = 0; diff --git a/Spore ModAPI/Spore/UTFWin/Image.h b/Spore ModAPI/Spore/UTFWin/Image.h index 7e29e84c..9e89b7f0 100644 --- a/Spore ModAPI/Spore/UTFWin/Image.h +++ b/Spore ModAPI/Spore/UTFWin/Image.h @@ -57,6 +57,8 @@ namespace UTFWin const Math::Rectangle& GetTexCoords() const; const Math::Dimensions& GetDimensions() const; + void SetTexCoords(const Math::Rectangle& coords); + void SetDimensions(const Math::Dimensions& dimensions); /// /// Creates an UTFWin::Image instance with the image extracted from the file specified. @@ -127,5 +129,13 @@ namespace UTFWin { return mDimensions; } + inline void Image::SetTexCoords(const Math::Rectangle& coords) + { + mTexCoords = coords; + } + inline void Image::SetDimensions(const Math::Dimensions& dimensions) + { + mDimensions = dimensions; + } } diff --git a/Spore ModAPI/Spore/UTFWin/UILayout.h b/Spore ModAPI/Spore/UTFWin/UILayout.h index e4fbeb33..6a1414c9 100644 --- a/Spore ModAPI/Spore/UTFWin/UILayout.h +++ b/Spore ModAPI/Spore/UTFWin/UILayout.h @@ -61,7 +61,7 @@ namespace UTFWin /// (undocumented) .xml format. A new IWindow will be created and added to the main window; the main windows /// of the user interface loaded will be added as children of that new container window. /// This method will just process the resource name and call UILayout::Load(). - /// @param pResourceName The name of the layour file (no extension or group needed). + /// @param pResourceName The name of the layout file (no extension or group needed). /// @param groupID [Optional] The ID of the group where the file is stored, usually UILayout::kDefaultGroup. /// bool LoadByName(const char16_t* pLayoutName, uint32_t groupID = kDefaultGroup, bool = true, uint32_t = kDefaultParameter);