diff options
| author | Kiloku <mateus.sateles@protonmail.com> | 2025-01-04 00:32:59 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-03 21:32:59 -0600 |
| commit | 97e63d6b066232ab9ced38adfb6131027fb0bad1 (patch) | |
| tree | 3062ebdb3931cf86c6972aedb56a17c31020221c /src | |
| parent | b4457a03a98edf41e7c2b4cc12c3907a439fcb37 (diff) | |
Laser range cheat (#112)
* Add Laser Range cheat
* Change range cheat to be a multiplier instead
* Address bomb weirdness
* Move cheat to Hooks system
Diffstat (limited to 'src')
| -rw-r--r-- | src/engine/fox_play.c | 5 | ||||
| -rw-r--r-- | src/overlays/ovl_i3/fox_aq.c | 2 | ||||
| -rw-r--r-- | src/port/hooks/list/ActionEvent.h | 2 | ||||
| -rw-r--r-- | src/port/mods/PortEnhancements.c | 5 | ||||
| -rw-r--r-- | src/port/ui/ImguiUI.cpp | 2 |
5 files changed, 12 insertions, 4 deletions
diff --git a/src/engine/fox_play.c b/src/engine/fox_play.c index e4690eb5..3f811f3b 100644 --- a/src/engine/fox_play.c +++ b/src/engine/fox_play.c @@ -3081,6 +3081,7 @@ void Player_SetupArwingShot(Player* player, PlayerShot* shot, f32 arg2, f32 arg3 shot->timer = 30; } } + shot->sourceId = player->num; } @@ -3156,7 +3157,7 @@ void Player_TankCannon(Player* player) { } } if (!PlayerActionPreShootEvent_.event.cancelled){ - CALL_EVENT(PlayerActionPostShootEvent, player, gLaserStrength[gPlayerNum]); + CALL_EVENT(PlayerActionPostShootEvent, player, &gPlayerShots[i]); } } @@ -3205,7 +3206,7 @@ void Player_ArwingLaser(Player* player) { } break; } - CALL_EVENT(PlayerActionPostShootEvent, player, laser); + CALL_EVENT(PlayerActionPostShootEvent, player, &gPlayerShots[i]); } void Player_SmartBomb(Player* player) { diff --git a/src/overlays/ovl_i3/fox_aq.c b/src/overlays/ovl_i3/fox_aq.c index 0e5b74dd..e10ad1b7 100644 --- a/src/overlays/ovl_i3/fox_aq.c +++ b/src/overlays/ovl_i3/fox_aq.c @@ -1247,7 +1247,7 @@ void Aquas_BlueMarineLaser(Player* player) { } } if (!PlayerActionPreShootEvent_.event.cancelled){ - CALL_EVENT(PlayerActionPostShootEvent, player, gLaserStrength[gPlayerNum]); + CALL_EVENT(PlayerActionPostShootEvent, player, &gPlayerShots[i]); } } diff --git a/src/port/hooks/list/ActionEvent.h b/src/port/hooks/list/ActionEvent.h index 333c6453..57c49644 100644 --- a/src/port/hooks/list/ActionEvent.h +++ b/src/port/hooks/list/ActionEvent.h @@ -8,7 +8,7 @@ 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(PlayerActionPostShootEvent, Player* player; PlayerShot* shot;); DEFINE_EVENT(PlayerActionPreShootChargedEvent, Player* player;); DEFINE_EVENT(PlayerActionPostShootChargedEvent, Player* player;); diff --git a/src/port/mods/PortEnhancements.c b/src/port/mods/PortEnhancements.c index 71e4c477..db9383dc 100644 --- a/src/port/mods/PortEnhancements.c +++ b/src/port/mods/PortEnhancements.c @@ -184,6 +184,10 @@ void OnPlayerBrake(PlayerActionBrakeEvent* event) { } } +void OnPlayerShootPost(PlayerActionPostShootEvent* event){ + event->shot->timer *= CVarGetInteger("gLaserRangeMult", 100)/100.0f; +} + void PortEnhancements_Init() { PortEnhancements_Register(); @@ -195,6 +199,7 @@ void PortEnhancements_Init() { // Register Action listeners REGISTER_LISTENER(PlayerActionBoostEvent, OnPlayerBoost, EVENT_PRIORITY_NORMAL); REGISTER_LISTENER(PlayerActionBrakeEvent, OnPlayerBrake, EVENT_PRIORITY_NORMAL); + REGISTER_LISTENER(PlayerActionPostShootEvent, OnPlayerShootPost, EVENT_PRIORITY_NORMAL); } void PortEnhancements_Register() { diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp index 02fa87f7..f2d11a21 100644 --- a/src/port/ui/ImguiUI.cpp +++ b/src/port/ui/ImguiUI.cpp @@ -484,6 +484,8 @@ void DrawCheatsMenu() { UIWidgets::CVarCheckbox("Infinite Bombs", "gInfiniteBombs"); UIWidgets::CVarCheckbox("Infinite Boost/Brake", "gInfiniteBoost"); UIWidgets::CVarCheckbox("Hyper Laser", "gHyperLaser"); + UIWidgets::CVarSliderInt("Laser Range Multiplier: %d%%", "gLaserRangeMult", 15, 800, 100, + { .tooltip = "Changes how far your lasers fly." }); UIWidgets::CVarCheckbox("Self destruct button", "gHit64SelfDestruct", { .tooltip = "Press Down on the D-PAD to instantly self destruct." }); |
