From 2a1713ee288e3fdfa7efcdd3c23bf034467c7e89 Mon Sep 17 00:00:00 2001 From: Rosalie Wanders Date: Mon, 1 Jan 2024 16:28:11 +0100 Subject: [PATCH] 3rdParty: update Spore-ModAPI to v2.5.297 --- 3rdParty/BuildSporeModAPI.bat | 2 +- 3rdParty/Spore-ModAPI/.gitrepo | 4 +- .../SourceCode/DLL/AddressesSimulator.cpp | 28 ++++++ .../SourceCode/Simulator/SimulatorMisc.cpp | 41 ++++++++ .../Spore ModAPI/Spore ModAPI.vcxproj | 11 ++- .../Spore ModAPI/Spore ModAPI.vcxproj.filters | 29 +++++- .../Spore ModAPI/Spore/Simulator.h | 9 ++ .../Spore/Simulator/IProjectile.h | 34 ------- .../Spore/Simulator/cArtilleryProjectile.h | 44 +++++++++ .../Spore/Simulator/cCombatSimulator.h | 8 +- .../Spore/Simulator/cCulturalProjectile.h | 47 ++++++++++ .../Spore/Simulator/cDeepSpaceProjectile.h | 21 +++++ .../Spore/Simulator/cDefaultAoEArea.h | 1 + .../Spore/Simulator/cDefaultToolProjectile.h | 93 +++++++++++++++++++ .../Spore/Simulator/cFlakProjectile.h | 36 +++++++ .../Spore ModAPI/Spore/Simulator/cICBM.h | 31 +++++++ .../Spore/Simulator/cProjectile.h | 52 +++++------ .../Spore/Simulator/cResourceProjectile.h | 12 ++- .../Spore/Simulator/cSpaceDefenseMissile.h | 43 +++++++++ .../Spore ModAPI/Spore/Simulator/cSpear.h | 25 +++++ 20 files changed, 496 insertions(+), 75 deletions(-) delete mode 100644 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/IProjectile.h create mode 100644 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cArtilleryProjectile.h create mode 100644 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cCulturalProjectile.h create mode 100644 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDeepSpaceProjectile.h create mode 100644 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDefaultToolProjectile.h create mode 100644 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cFlakProjectile.h create mode 100644 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cICBM.h create mode 100644 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cSpaceDefenseMissile.h create mode 100644 3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cSpear.h diff --git a/3rdParty/BuildSporeModAPI.bat b/3rdParty/BuildSporeModAPI.bat index aaa58da..0cfd7c9 100644 --- a/3rdParty/BuildSporeModAPI.bat +++ b/3rdParty/BuildSporeModAPI.bat @@ -4,7 +4,7 @@ set SPOREMODAPI_CUR_DIR=%~dp0 msbuild "%SPOREMODAPI_CUR_DIR%\Spore-ModAPI\Spore ModAPI" ^ /p:Configuration="Release DLL" ^ - /p:SDK_BUILD_VER=294 ^ + /p:SDK_BUILD_VER=297 ^ /p:EXECUTABLE_TYPE=10 ^ /p:Platform=Win32 ^ /m diff --git a/3rdParty/Spore-ModAPI/.gitrepo b/3rdParty/Spore-ModAPI/.gitrepo index fc7197e..8488098 100644 --- a/3rdParty/Spore-ModAPI/.gitrepo +++ b/3rdParty/Spore-ModAPI/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = git@github.com:emd4600/Spore-ModAPI.git branch = master - commit = 654b0318bd1ecf65cd71fb025752ba5b6524defb - parent = 527f3970042d5ad2ace018e9580a08038444aa48 + commit = 32de907e29bd127807d1d8fdc03ea39f17ff6592 + parent = 7dae66d1806a285eb6edf83b668265c7884386fe method = merge cmdver = 0.4.6 diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp b/3rdParty/Spore-ModAPI/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp index fef9de2..818b1cd 100644 --- a/3rdParty/Spore-ModAPI/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp @@ -72,6 +72,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include #include @@ -120,6 +125,8 @@ namespace Addresses(Simulator) DefineAddress(GetPlanetTemperatureType, SelectAddress(0xFC26B0, 0xFC1F90)); DefineAddress(IsBinaryStar, SelectAddress(0xC8A770, 0xC8B5E0)); DefineAddress(IsNotStarOrBinaryStar, SelectAddress(0xC8A840, 0xC8B6B0)); + + DefineAddress(LaunchDefaultToolProjectile, SelectAddress(0x1054F40, 0x1054390)); #ifndef SDK_TO_GHIDRA DefineAddress(LightingWorld_ptr, SelectAddress(0x1682CD4, 0x167EA54)); @@ -974,6 +981,27 @@ namespace Simulator DefineAddress(SetObject, SelectAddress(0xAF9890, 0xAF9FB0)); DefineAddress(RemoveObject, SelectAddress(0xAF9900, 0xAFA020)); } + + namespace Addresses(cArtilleryProjectile) + { + DefineAddress(LaunchProjectile, SelectAddress(0xCB68C0, 0xCB71C0)); + } + namespace Addresses(cCulturalProjectile) + { + DefineAddress(LaunchProjectile, SelectAddress(0xCBD0A0, 0xCBDB90)); + } + namespace Addresses(cFlakProjectile) + { + DefineAddress(LaunchProjectile, SelectAddress(0xCB7400, 0xCB7CF0)); + } + namespace Addresses(cResourceProjectile) + { + DefineAddress(LaunchProjectile, SelectAddress(0xCBDCD0, 0xCBE7C0)); + } + namespace Addresses(cSpaceDefenseMissile) + { + DefineAddress(LaunchProjectile, SelectAddress(0xCB7FD0, 0xCB88B0)); + } } #ifdef SDK_TO_GHIDRA diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp b/3rdParty/Spore-ModAPI/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp index f532c6f..cdc94ed 100644 --- a/3rdParty/Spore-ModAPI/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp @@ -4,6 +4,12 @@ #include #include #include +#include +#include +#include +#include +#include +#include namespace Simulator { @@ -64,5 +70,40 @@ namespace Simulator { return *(cSimulatorUniverse**)GetAddress(cSimulatorUniverse, _ptr); } + + + //// cDefaultToolProjectile //// + + auto_STATIC_METHOD_VOID(Simulator, LaunchDefaultToolProjectile, + Args(cSpaceToolData* tool, cDefaultToolProjectile* projectile, const Math::Vector3& origin, const Math::Vector3& target), + Args(tool, projectile, origin, target)); + + + //// cArtilleryProjectile //// + + auto_METHOD_VOID(cArtilleryProjectile, LaunchProjectile, Args(const Math::Vector3& target), Args(target)); + + + //// cCulturalProjectile //// + + auto_METHOD_VOID(cCulturalProjectile, LaunchProjectile, + Args(cGameData* owner, cVehicle* vehicle, cSpaceToolData* tool, cCombatant* target, const Math::Vector3& unk0, float unk1, bool unk2, bool spin), + Args(owner, vehicle, tool, target, unk0, unk1, unk2, spin)); + + + //// cFlakProjectile //// + + auto_METHOD_VOID(cFlakProjectile, LaunchProjectile, Args(const Math::Vector3& target, float arg), Args(target, arg)); + + + //// cResourceProjectile //// + + auto_METHOD_VOID(cResourceProjectile, LaunchProjectile, + Args(cCivilization* civilization, cCommodityNode* commodityNode, const Math::Vector3& arg0, float speed, bool arg1), + Args(civilization, commodityNode, arg0, speed, arg1)); + + //// cSpaceDefenseMissile //// + + auto_METHOD_VOID(cSpaceDefenseMissile, LaunchProjectile, Args(const Math::Vector3& target, cCombatant* arg), Args(target, arg)); } #endif \ No newline at end of file diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore ModAPI.vcxproj b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore ModAPI.vcxproj index f38c008..dcd5b48 100644 --- a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore ModAPI.vcxproj +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore ModAPI.vcxproj @@ -393,6 +393,7 @@ + @@ -405,7 +406,10 @@ + + + @@ -416,10 +420,12 @@ + + @@ -436,7 +442,9 @@ + + @@ -450,7 +458,7 @@ - + @@ -595,7 +603,6 @@ - diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore ModAPI.vcxproj.filters b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore ModAPI.vcxproj.filters index 402f4d0..2ada522 100644 --- a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore ModAPI.vcxproj.filters +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore ModAPI.vcxproj.filters @@ -1146,9 +1146,6 @@ Header Files - - Header Files - Header Files @@ -1818,7 +1815,7 @@ Header Files - + Header Files @@ -2139,6 +2136,30 @@ Header Files + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator.h index 890a8a6..33b7cb2 100644 --- a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator.h +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator.h @@ -67,6 +67,15 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/IProjectile.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/IProjectile.h deleted file mode 100644 index 433080f..0000000 --- a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/IProjectile.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include - -#define IProjectilePtr eastl::intrusive_ptr - -namespace Simulator -{ - class IProjectile - { - public: - static const uint32_t TYPE = 0x142DB2A; - - /* 00h */ virtual ~IProjectile(); - /* 04h */ virtual void* Cast(uint32_t type) = 0; - /* 08h */ virtual int Release() = 0; - /* 0Ch */ virtual int AddRef() = 0; - - /// Returns a reference to the locomotive object of this projectile (so just returns `this` as a cLocomotiveObject). - /* 10h */ virtual cLocomotiveObject* GetLocomotiveObject() = 0; - - /// Called every frame by the CombatSimulator. Must return true if the projectile instance is still alive, - /// or false if it has finished and must be destroyed. - /* 14h */ virtual bool Update() = 0; - - /* 18h */ virtual int func18h(); // returns 0 most of the time - /* 1Ch */ virtual float func1Ch(); // returns 1.0 most of the time - /* 20h */ virtual void func20h(int); // does nothing most of the time - /* 24h */ virtual bool func24h(); // returns false most of the time - - public: - /* 04h */ Vector3 projectile_field_4; - }; -} \ No newline at end of file diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cArtilleryProjectile.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cArtilleryProjectile.h new file mode 100644 index 0000000..790fcd8 --- /dev/null +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cArtilleryProjectile.h @@ -0,0 +1,44 @@ +#pragma once + +#include +#include +#include +#include +#include + +#define cArtilleryProjectilePtr eastl::intrusive_ptr + +namespace Simulator +{ + class cArtilleryProjectile + /* 00h */ : public cGameData + /* 34h */ , public cLocomotiveObject + /* 504h */ , public cProjectile + { + public: + static const uint32_t TYPE = 0x1428A48; + static const uint32_t NOUN_ID = 0x18C9380; + + using Object::AddRef; + using Object::Release; + using Object::Cast; + + /// Creates a `cBallisticLocomotion` locomotion strategy to start launching this projectile. + /// @param target + void LaunchProjectile(const Math::Vector3& target); + + public: + /* 518h */ Math::Vector3 mLastPosition; + /* 524h */ cCombatantPtr mpOwner; + /* 528h */ int mMinDamage; + /* 52Ch */ int mMaxDamage; + /* 530h */ int mDamageType; + /* 534h */ cSpaceToolDataPtr mTool; + }; + ASSERT_SIZE(cArtilleryProjectile, 0x538); + + namespace Addresses(cArtilleryProjectile) + { + DeclareAddress(LaunchProjectile); // 0xCB68C0 0xCB71C0 + } +} \ No newline at end of file diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cCombatSimulator.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cCombatSimulator.h index 91951f6..6507093 100644 --- a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cCombatSimulator.h +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cCombatSimulator.h @@ -2,7 +2,7 @@ #include #include -#include +#include #include namespace Simulator @@ -19,10 +19,10 @@ namespace Simulator using Object::Cast; public: - /* 14h */ eastl::vector mProjectiles; - /* 28h */ eastl::vector field_28; + /* 14h */ eastl::vector mProjectiles; + /* 28h */ eastl::vector field_28; /* 3Ch */ bool mIsUpdatingProjectiles; - /// If true, it collects all IProjectile instances and adds listener for SimulatorMessages::kMsgGameNounStatusChanged + /// If true, it collects all cProjectile instances and adds listener for SimulatorMessages::kMsgGameNounStatusChanged /* 3Dh */ bool field_3D; }; ASSERT_SIZE(cCombatSimulator, 0x40); diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cCulturalProjectile.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cCulturalProjectile.h new file mode 100644 index 0000000..c5ebb73 --- /dev/null +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cCulturalProjectile.h @@ -0,0 +1,47 @@ +#pragma once + +#include +#include +#include +#include +#include + +#define cCulturalProjectilePtr eastl::intrusive_ptr + +namespace Simulator +{ + class cCulturalProjectile + /* 00h */ : public cGameData + /* 34h */ , public cLocomotiveObject + /* 504h */ , public cProjectile + { + public: + static const uint32_t TYPE = 0x4F76F08; + static const uint32_t NOUN_ID = 0x4F76F0D; + + using Object::AddRef; + using Object::Release; + using Object::Cast; + + void LaunchProjectile(cGameData* owner, cVehicle* vehicle, cSpaceToolData* tool, cCombatant* target, const Math::Vector3&, float, bool, bool spin); + + public: + /* 518h */ int field_518; + /* 51Ch */ cVehiclePtr mpVehicle; + /* 520h */ cCombatantPtr mpTarget; + /* 524h */ cSpaceToolDataPtr mpTool; + /* 528h */ int field_528; // -1 + /* 52Ch */ Math::Vector3 mTargetPos; + /* 538h */ bool field_538; + /* 539h */ bool mbSpin; + /* 540h */ cGonzagoTimer mLifeTimer; + /* 560h */ uint32_t mOwner; // -1 + /* 568h */ cGonzagoTimer field_568; + }; + ASSERT_SIZE(cCulturalProjectile, 0x588); + + namespace Addresses(cCulturalProjectile) + { + DeclareAddress(LaunchProjectile); // 0xCBD0A0 0xCBDB90 + } +} \ No newline at end of file diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDeepSpaceProjectile.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDeepSpaceProjectile.h new file mode 100644 index 0000000..24783a8 --- /dev/null +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDeepSpaceProjectile.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +#define cDeepSpaceProjectilePtr eastl::intrusive_ptr + +namespace Simulator +{ + class cDeepSpaceProjectile + : public cDefaultToolProjectile + { + public: + static const uint32_t TYPE = 0x24270C6; + static const uint32_t NOUN_ID = 0x24270C7; + + using Object::AddRef; + using Object::Release; + using Object::Cast; + }; + ASSERT_SIZE(cDeepSpaceProjectile, 0x5F0); +} \ No newline at end of file diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDefaultAoEArea.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDefaultAoEArea.h index 165be60..060d680 100644 --- a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDefaultAoEArea.h +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDefaultAoEArea.h @@ -22,6 +22,7 @@ #include #include #include +#include #define cDefaultAoEAreaPtr eastl::intrusive_ptr diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDefaultToolProjectile.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDefaultToolProjectile.h new file mode 100644 index 0000000..ded2447 --- /dev/null +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cDefaultToolProjectile.h @@ -0,0 +1,93 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#define cDefaultToolProjectilePtr eastl::intrusive_ptr + +namespace Simulator +{ + enum class DamageType + { + Bribe = 4, + + Healing = 10, + BlackCloud = 11, + _543F8E29 = 12, + Nuclear = 13, + EMP = 14, + IField = 15, + Diplomatic = 16, + }; + + class cDefaultToolProjectile + /* 00h */ : public cGameData + /* 34h */ , public cLocomotiveObject + /* 504h */ , public cProjectile + { + public: + static const uint32_t TYPE = 0x24270C4; + static const uint32_t NOUN_ID = 0x24270C5; + + using Object::AddRef; + using Object::Release; + using Object::Cast; + + /* 54h */ virtual void ConfigureProjectile(cSpaceToolData* tool, int minDamage, int maxDamage, float explosionRadius, int damageType, float projectileRadius); + /* 58h */ virtual void OnProjetileHit(int strikeType, Object* hitObject); + + public: + /* 518h */ cSpaceToolDataPtr mTool; + /* 51Ch */ int field_51C; + /* 520h */ Math::Vector3 mPrevPosition; + /* 52Ch */ int mMinDamage; + /* 530h */ int mMaxDamage; + /* 534h */ float mExplosionRadius; + /// A value in DamageType + /* 538h */ int mDamageType; + /* 53Ch */ float mProjectileScale; // 1.0 + /* 540h */ float mCurrentExplosionRadius; + /* 544h */ int mBombPhase; + /* 548h */ cGonzagoTimer mPhaseTimer; + /* 568h */ uint64_t mTimeOfLastDamageCheck; + /* 570h */ eastl::set mDamagedObjects; + /* 58Ch */ Math::Vector3 mExplosionPoint; + /* 598h */ int mTargetDamagePointId; // -1 + /* 59Ch */ Math::Vector3 mTargetPoint; + /* 5A8h */ char padding_5A8[0x5CC - 0x5A8]; + /* 5CCh */ int field_5CC; + /* 5D0h */ int mStrikeType; + /* 5D4h */ cGameDataPtr mTargetStruck; + /* 5D8h */ cSpatialObjectPtr mpTarget; + /* 5DCh */ eastl::vector mWaveFrontTargetCities; + }; + ASSERT_SIZE(cDefaultToolProjectile, 0x5F0); + + /// Launches a projectile using the configuration of the specified tool. + /// Example code to shoot 50 meters in front of your UFO: + /// ```cpp + /// auto playerPosition = SimulatorPlayerUFO.GetUFO()->GetPosition(); + /// auto target = playerPosition + 50 * SimulatorPlayerUFO.GetUFO()->GetDirection(); + /// cSpaceToolDataPtr tool; + /// if (ToolManager.LoadTool({ id("AllyMissile1"), TypeIDs::prop, GroupIDs::SpaceTools }, tool)) + /// { + /// auto projectile = simulator_new(); + /// Simulator::LaunchDefaultToolProjectile(tool.get, projectile, playerPosition, target); + /// } + /// ``` + /// @param tool Tool used to configure the projectile trajectory, damage, effect, etc + /// @param projectile Projectile object + /// @param origin Starting point of the projectile + /// @param target Target point of the projectile + void LaunchDefaultToolProjectile(cSpaceToolData* tool, cDefaultToolProjectile* projectile, const Math::Vector3& origin, const Math::Vector3& target); +} + +namespace Addresses(Simulator) +{ + DeclareAddress(LaunchDefaultToolProjectile); // 0x1054F40 0x1054390 +} \ No newline at end of file diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cFlakProjectile.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cFlakProjectile.h new file mode 100644 index 0000000..8cdc3b0 --- /dev/null +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cFlakProjectile.h @@ -0,0 +1,36 @@ +#pragma once + +#include +#include +#include + +#define cFlakProjectilePtr eastl::intrusive_ptr + +namespace Simulator +{ + class cFlakProjectile + /* 00h */ : public cGameData + /* 34h */ , public cLocomotiveObject + /* 504h */ , public cProjectile + { + public: + static const uint32_t TYPE = 0x240E3B7; + static const uint32_t NOUN_ID = 0x240E3BF; + + using Object::AddRef; + using Object::Release; + using Object::Cast; + + void LaunchProjectile(const Math::Vector3&, float); + + public: + /* 518h */ int field_518; + /* 51Ch */ float field_51C; + }; + ASSERT_SIZE(cFlakProjectile, 0x520); + + namespace Addresses(cFlakProjectile) + { + DeclareAddress(LaunchProjectile); // 0xCB7400 0xCB7CF0 + } +} \ No newline at end of file diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cICBM.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cICBM.h new file mode 100644 index 0000000..f81bcbe --- /dev/null +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cICBM.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include +#include +#include + +#define cICBMPtr eastl::intrusive_ptr + +namespace Simulator +{ + class cICBM + /* 00h */ : public cGameData + /* 34h */, public cLocomotiveObject + /* 504h */, public cProjectile + { + public: + static const uint32_t TYPE = 0x903C3EA3; + static const uint32_t NOUN_ID = 0x49CEC61; + + using Object::AddRef; + using Object::Release; + using Object::Cast; + + public: + /* 518h */ int field_518; // not initialized + /* 51Ch */ int field_51C; // not initialized + /* 520h */ cCombatantPtr mpTarget; + }; + ASSERT_SIZE(cICBM, 0x524); +} \ No newline at end of file diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cProjectile.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cProjectile.h index 50f61b7..3ac3a15 100644 --- a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cProjectile.h +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cProjectile.h @@ -1,38 +1,38 @@ -/**************************************************************************** -* Copyright (C) 2019 Eric Mor -* -* This file is part of Spore ModAPI. -* -* Spore ModAPI is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -****************************************************************************/ #pragma once -#include +#include + +#define cProjectilePtr eastl::intrusive_ptr namespace Simulator { - class cProjectile // ? + class cCombatant; + + class cProjectile { public: static const uint32_t TYPE = 0x142DB2A; - public: - virtual ~cProjectile(); - // TODO more - protected: + /* 00h */ virtual ~cProjectile() {}; + /* 04h */ virtual void* Cast(uint32_t type) = 0; + /* 08h */ virtual int Release() = 0; + /* 0Ch */ virtual int AddRef() = 0; + + /// Returns a reference to the locomotive object of this projectile (so just returns `this` as a cLocomotiveObject). + /* 10h */ virtual cLocomotiveObject* GetLocomotiveObject() = 0; - /* 04h */ Math::Vector3 field_04; - /* 10h */ bool field_10; + /// Called every frame by the CombatSimulator. Must return true if the projectile instance is still alive, + /// or false if it has finished and must be destroyed. + /* 14h */ virtual bool Update() = 0; + + /* 18h */ virtual cCombatant* GetOwnerCombatant(); // returns 0 most of the time + /* 1Ch */ virtual float GetProjectileScale(); // returns 1.0 most of the time + /* 20h */ virtual void SetProjectileScale(float); // does nothing most of the time + /* 24h */ virtual bool PreventsPlanetExit(); // returns false most of the time + + public: + /* 04h */ Vector3 mTargetOffset; + /* 10h */ bool projectile_field_10; }; + ASSERT_SIZE(cProjectile, 0x14); } \ No newline at end of file diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cResourceProjectile.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cResourceProjectile.h index 783e9d4..8766cbe 100644 --- a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cResourceProjectile.h +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cResourceProjectile.h @@ -3,8 +3,9 @@ #include #include #include -#include +#include #include +#include #define cResourceProjectilePtr eastl::intrusive_ptr @@ -14,7 +15,7 @@ namespace Simulator class cResourceProjectile /* 00h */ : public cGameData /* 34h */ , public cLocomotiveObject - /* 504h */ , public IProjectile + /* 504h */ , public cProjectile { public: static const uint32_t TYPE = 0x5776A28; @@ -24,6 +25,8 @@ namespace Simulator using Object::Release; using Object::Cast; + void LaunchProjectile(cCivilization* civilization, cCommodityNode* commodityNode, const Math::Vector3&, float speed, bool); + public: /* 514h */ bool field_514; /* 518h */ int field_518; @@ -36,4 +39,9 @@ namespace Simulator /* 554h */ bool field_554; }; ASSERT_SIZE(cResourceProjectile, 0x558); + + namespace Addresses(cResourceProjectile) + { + DeclareAddress(LaunchProjectile); // 0xCBDCD0 0xCBE7C0 + } } \ No newline at end of file diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cSpaceDefenseMissile.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cSpaceDefenseMissile.h new file mode 100644 index 0000000..324ecb3 --- /dev/null +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cSpaceDefenseMissile.h @@ -0,0 +1,43 @@ +#pragma once + +#include +#include +#include +#include + +#define cSpaceDefenseMissilePtr eastl::intrusive_ptr + +namespace Simulator +{ + class cSpaceDefenseMissile + /* 00h */ : public cGameData + /* 34h */ , public cLocomotiveObject + /* 504h */ , public cProjectile + /* 518h */ , public cCombatant + { + public: + static const uint32_t TYPE = 0x244D3C0; + static const uint32_t NOUN_ID = 0x244D3C8; + + using Object::AddRef; + using Object::Release; + using Object::Cast; + + /// Creates a `cSpaceDefenseMissileLocomotion` to launch this projectile. + /// @param target + /// @param source + void LaunchProjectile(const Math::Vector3& target, cCombatant* source); + + public: + /* 5E0h */ int field_5E0; + /* 5E4h */ cCombatantPtr mpSource; + /* 5E8h */ cGonzagoTimer field_5E8; + /* 608h */ int field_608; + }; + ASSERT_SIZE(cSpaceDefenseMissile, 0x610); + + namespace Addresses(cSpaceDefenseMissile) + { + DeclareAddress(LaunchProjectile); // 0xCB7FD0 0xCB88B0 + } +} \ No newline at end of file diff --git a/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cSpear.h b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cSpear.h new file mode 100644 index 0000000..d45987e --- /dev/null +++ b/3rdParty/Spore-ModAPI/Spore ModAPI/Spore/Simulator/cSpear.h @@ -0,0 +1,25 @@ +#pragma once + +#include + +#define cSpearPtr eastl::intrusive_ptr + +namespace Simulator +{ + class cSpear + : public cArtilleryProjectile + { + public: + static const uint32_t TYPE = 0x24270C8; + static const uint32_t NOUN_ID = 0x24270C9; + + using Object::AddRef; + using Object::Release; + using Object::Cast; + + public: + /* 538h */ int field_538; // not initialized + /* 53Ch */ int field_53C; + }; + ASSERT_SIZE(cSpear, 0x540); +} \ No newline at end of file