Skip to content

Commit 801035f

Browse files
committed
Add PlayAbility(), DoJump() and ConsumeEnergy() to cCreatureAbility. Add kScenarioEnergyConsumedMsg.
1 parent e3783ea commit 801035f

4 files changed

Lines changed: 47 additions & 0 deletions

File tree

Spore ModAPI/SourceCode/DLL/AddressesSimulator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ namespace Simulator
206206
DefineAddress(GetEffectFromPools, SelectAddress(0xC14830, 0xC14FD0));
207207
DefineAddress(StopEffectFromPools, SelectAddress(0xC16CB0, 0xC174B0));
208208
DefineAddress(PlayVoice, SelectAddress(0xC1CEC0, 0xC1D7A0));
209+
DefineAddress(PlayAbility, SelectAddress(0xC1DCE0, 0xC1E5C0));
210+
DefineAddress(DoJump, SelectAddress(0xC184A0, 0xC18CA0));
211+
DefineAddress(ConsumeEnergy, SelectAddress(0xC15780, 0xC15F20));
209212
}
210213

211214
namespace Addresses(cCropCirclesToolStrategy)

Spore ModAPI/SourceCode/Simulator/cCreatureAnimal.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,15 @@ namespace Simulator
8484

8585
auto_METHOD_VOID(cCreatureAnimal, NPCTickAI, Args(float f), Args(f));
8686
auto_METHOD_VOID(cCreatureAnimal, AvatarTickAI, Args(float f), Args(f));
87+
88+
89+
auto_METHOD_VOID(cCreatureBase, PlayAbility,
90+
Args(int abilityIndex, Anim::AnimIndex* dstAnimIndex), Args(abilityIndex, dstAnimIndex));
91+
92+
auto_METHOD(cCreatureBase, bool, DoJump,
93+
Args(int energyConsumed), Args(energyConsumed));
94+
95+
auto_METHOD_VOID(cCreatureBase, ConsumeEnergy,
96+
Args(float energyConsumed), Args(energyConsumed));
8797
}
8898
#endif

Spore ModAPI/Spore/Simulator/SimulatorMessages.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ namespace Simulator
6060
/// Simulator::ScenarioCreatureHealedMessage; called when a creature is healed (either by natural heal rate, or using a medkit) in Scenario mode
6161
kMsgScenarioCreatureHealed = 0x7C789F8,
6262

63+
/// Simulator::ScenarioEnergyConsumedMessage; sent when the player consumes captain energy
64+
kMsgScenarioEnergyConsumed = 0x7C7A52E,
65+
6366
/// No data, called when pressing the undo button in the scenario editor
6467
kMsgScenarioUndo = 0xC9D86390,
6568
/// No data, called when pressing the redo button in the scenario editor
@@ -237,6 +240,17 @@ namespace Simulator
237240
}
238241
};
239242

243+
/// Called when the player captain consumes energy in Scenario mode
244+
class ScenarioEnergyConsumedMessage : App::StandardMessage
245+
{
246+
public:
247+
static const uint32_t ID = kMsgScenarioEnergyConsumed;
248+
249+
inline float GetAmountConsumed() {
250+
return params[0]._float;
251+
}
252+
};
253+
240254
/// Sent when a rare item is found (even if it had already been found before) in Space Stage.
241255
class SpaceRareFoundMessage : App::StandardMessage
242256
{

Spore ModAPI/Spore/Simulator/cCreatureBase.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,23 @@ namespace Simulator
123123

124124
// sub_D48710 play ability
125125

126+
/// Makes the creature play an ability, the index can be obtained with GetAbilityIndexByType().
127+
/// If dstAnimIndex is specified, the index of the ability animation played will be written there.
128+
/// Does not work with skill abilties (glide, jump, mating call, sprint and sneak)
129+
/// @param abilityIndex
130+
/// @param[out] dstAnimIndex [Optional]
131+
void PlayAbility(int abilityIndex, Anim::AnimIndex* dstAnimIndex = nullptr);
132+
133+
/// If possible, causes the creature to jump, even if the creature is already in the air.
134+
/// @param energyConsumed [Optional] For captains, how much energy will be consumed
135+
/// @returns Whether the jump was carried out
136+
bool DoJump(int energyConsumed = 0);
137+
138+
/// For scenario captains, consumes a certain amount of energy.
139+
/// If it's the player, it sends a kMsgScenarioEnergyConsumed message.
140+
/// @param amount
141+
void ConsumeEnergy(float amount);
142+
126143
/// Returns the index to the first ability of the craeture that has the specified ability type.
127144
/// @param abilityType
128145
/// @returns Index to ability, or -1 if not found
@@ -391,5 +408,8 @@ namespace Simulator
391408
DeclareAddress(GetEffectFromPools);
392409
DeclareAddress(StopEffectFromPools);
393410
DeclareAddress(PlayVoice); // C1CEC0
411+
DeclareAddress(PlayAbility); // 0xC1DCE0 0xC1E5C0
412+
DeclareAddress(DoJump); // 0xC184A0 0xC18CA0
413+
DeclareAddress(ConsumeEnergy); // 0xC15780 0xC15F20
394414
}
395415
}

0 commit comments

Comments
 (0)