summaryrefslogtreecommitdiff
path: root/src/port
diff options
context:
space:
mode:
authorKiloku <mateus.sateles@protonmail.com>2024-12-30 01:47:42 -0300
committerGitHub <noreply@github.com>2024-12-29 22:47:42 -0600
commitad7bc7c6917ade37662969e3a327c72acf59a974 (patch)
tree5c7efdabf24a9b312d1d6b0e6db20a4e73958645 /src/port
parentdbf9b0378f1fea6232f9ee1bb64983590b6e1eba (diff)
Player action hooks (#93)hooks
* Create Player Action and Player Movement event types * Call Boost/Brake events * Change some event types * Make Boost/Brake events cancellable * Use new dynamic hooks * Use separate events for each player action * Add shoot events * Return early on cancel * Add Bomb and Charged Shot Events * Remove movement event hooks, add player param to action hooks * Fix whitespace * Register player action events
Diffstat (limited to 'src/port')
-rw-r--r--src/port/hooks/Events.h3
-rw-r--r--src/port/hooks/list/ActionEvent.h17
-rw-r--r--src/port/mods/PortEnhancements.c13
3 files changed, 32 insertions, 1 deletions
diff --git a/src/port/hooks/Events.h b/src/port/hooks/Events.h
index 30afe9ec..3f53a7d1 100644
--- a/src/port/hooks/Events.h
+++ b/src/port/hooks/Events.h
@@ -2,4 +2,5 @@
#include "list/EngineEvent.h"
#include "list/ActorEvent.h"
-#include "list/ItemEvent.h" \ No newline at end of file
+#include "list/ItemEvent.h"
+#include "list/ActionEvent.h" \ No newline at end of file
diff --git a/src/port/hooks/list/ActionEvent.h b/src/port/hooks/list/ActionEvent.h
new file mode 100644
index 00000000..333c6453
--- /dev/null
+++ b/src/port/hooks/list/ActionEvent.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "sf64player.h"
+#include "port/hooks/impl/EventSystem.h"
+
+DEFINE_EVENT(PlayerActionBoostEvent, Player* player;);
+
+DEFINE_EVENT(PlayerActionBrakeEvent, Player* player;);
+
+DEFINE_EVENT(PlayerActionPreShootEvent, Player* player; LaserStrength laser;);
+DEFINE_EVENT(PlayerActionPostShootEvent, Player* player; LaserStrength laser;);
+
+DEFINE_EVENT(PlayerActionPreShootChargedEvent, Player* player;);
+DEFINE_EVENT(PlayerActionPostShootChargedEvent, Player* player;);
+
+DEFINE_EVENT(PlayerActionPreBombEvent, Player* player;);
+DEFINE_EVENT(PlayerActionPostBombEvent, Player* player;); \ No newline at end of file
diff --git a/src/port/mods/PortEnhancements.c b/src/port/mods/PortEnhancements.c
index b2559422..84bfba62 100644
--- a/src/port/mods/PortEnhancements.c
+++ b/src/port/mods/PortEnhancements.c
@@ -193,6 +193,19 @@ void PortEnhancements_Register() {
REGISTER_EVENT(ObjectUpdateEvent);
REGISTER_EVENT(ObjectDrawEvent);
REGISTER_EVENT(ObjectDestroyEvent);
+
+ // Register player action events
+ REGISTER_EVENT(PlayerActionBoostEvent);
+ REGISTER_EVENT(PlayerActionBrakeEvent);
+
+ REGISTER_EVENT(PlayerActionPreShootEvent);
+ REGISTER_EVENT(PlayerActionPostShootEvent);
+
+ REGISTER_EVENT(PlayerActionPreShootChargedEvent);
+ REGISTER_EVENT(PlayerActionPostShootChargedEvent);
+
+ REGISTER_EVENT(PlayerActionPreBombEvent);
+ REGISTER_EVENT(PlayerActionPostBombEvent);
}
void PortEnhancements_Exit() {