Skip to content

Commit

Permalink
Add LaunchProjectile() method to cArtilleryProjectile, `cCultural…
Browse files Browse the repository at this point in the history
…Projectile`, `cDefaultToolProjectile`, `cFlakProjectile`, `cResourceProjectile`, `cSpaceDefenseMissile`.
  • Loading branch information
emd4600 committed Jan 1, 2024
1 parent 677eeec commit 32de907
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 2 deletions.
26 changes: 26 additions & 0 deletions Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
#include <Spore\Simulator\cSimulatorUniverse.h>
#include <Spore\Simulator\Serialization.h>
#include <Spore\Simulator\SpaceConstants.h>
#include <Spore\Simulator\cArtilleryProjectile.h>
#include <Spore\Simulator\cCulturalProjectile.h>
#include <Spore\Simulator\cFlakProjectile.h>
#include <Spore\Simulator\cResourceProjectile.h>
#include <Spore\Simulator\cSpaceDefenseMissile.h>
#include <Spore\Simulator\SubSystem\cRelationshipManager.h>
#include <Spore\Simulator\SubSystem\GameBehaviorManager.h>
#include <Spore\Simulator\SubSystem\GameInputManager.h>
Expand Down Expand Up @@ -976,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
Expand Down
33 changes: 33 additions & 0 deletions Spore ModAPI/SourceCode/Simulator/SimulatorMisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
#include <Spore\Simulator\cObjectPool.h>
#include <Spore\Simulator\cSimulatorUniverse.h>
#include <Spore\Simulator\cDefaultToolProjectile.h>
#include <Spore\Simulator\cArtilleryProjectile.h>
#include <Spore\Simulator\cCulturalProjectile.h>
#include <Spore\Simulator\cFlakProjectile.h>
#include <Spore\Simulator\cResourceProjectile.h>
#include <Spore\Simulator\cSpaceDefenseMissile.h>

namespace Simulator
{
Expand Down Expand Up @@ -72,5 +77,33 @@ namespace Simulator
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
9 changes: 9 additions & 0 deletions Spore ModAPI/Spore/Simulator/cArtilleryProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ namespace Simulator
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;
Expand All @@ -32,4 +36,9 @@ namespace Simulator
/* 534h */ cSpaceToolDataPtr mTool;
};
ASSERT_SIZE(cArtilleryProjectile, 0x538);

namespace Addresses(cArtilleryProjectile)
{
DeclareAddress(LaunchProjectile); // 0xCB68C0 0xCB71C0
}
}
7 changes: 7 additions & 0 deletions Spore ModAPI/Spore/Simulator/cCulturalProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ namespace Simulator
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;
Expand All @@ -37,4 +39,9 @@ namespace Simulator
/* 568h */ cGonzagoTimer field_568;
};
ASSERT_SIZE(cCulturalProjectile, 0x588);

namespace Addresses(cCulturalProjectile)
{
DeclareAddress(LaunchProjectile); // 0xCBD0A0 0xCBDB90
}
}
2 changes: 1 addition & 1 deletion Spore ModAPI/Spore/Simulator/cDefaultToolProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace Simulator
ASSERT_SIZE(cDefaultToolProjectile, 0x5F0);

/// Launches a projectile using the configuration of the specified tool.
/// Example code to shoot 200 meters in front of your UFO:
/// Example code to shoot 50 meters in front of your UFO:
/// ```cpp
/// auto playerPosition = SimulatorPlayerUFO.GetUFO()->GetPosition();
/// auto target = playerPosition + 50 * SimulatorPlayerUFO.GetUFO()->GetDirection();
Expand Down
7 changes: 7 additions & 0 deletions Spore ModAPI/Spore/Simulator/cFlakProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ namespace Simulator
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
}
}
8 changes: 8 additions & 0 deletions Spore ModAPI/Spore/Simulator/cResourceProjectile.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <Spore\Simulator\cCommodityNode.h>
#include <Spore\Simulator\cProjectile.h>
#include <Spore\Simulator\cGonzagoTimer.h>
#include <Spore\Simulator\cCivilization.h>

#define cResourceProjectilePtr eastl::intrusive_ptr<Simulator::cResourceProjectile>

Expand All @@ -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;
Expand All @@ -36,4 +39,9 @@ namespace Simulator
/* 554h */ bool field_554;
};
ASSERT_SIZE(cResourceProjectile, 0x558);

namespace Addresses(cResourceProjectile)
{
DeclareAddress(LaunchProjectile); // 0xCBDCD0 0xCBE7C0
}
}
12 changes: 11 additions & 1 deletion Spore ModAPI/Spore/Simulator/cSpaceDefenseMissile.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ namespace Simulator
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 */ int field_5E4;
/* 5E4h */ cCombatantPtr mpSource;
/* 5E8h */ cGonzagoTimer field_5E8;
/* 608h */ int field_608;
};
ASSERT_SIZE(cSpaceDefenseMissile, 0x610);

namespace Addresses(cSpaceDefenseMissile)
{
DeclareAddress(LaunchProjectile); // 0xCB7FD0 0xCB88B0
}
}

0 comments on commit 32de907

Please sign in to comment.