Laser range cheat (#112)
Some checks are pending
GenerateBuilds / generate-port-otr (push) Waiting to run
GenerateBuilds / build-windows (push) Blocked by required conditions
GenerateBuilds / build-macos (push) Blocked by required conditions
GenerateBuilds / build-linux (push) Blocked by required conditions

* Add Laser Range cheat

* Change range cheat to be a multiplier instead

* Address bomb weirdness

* Move cheat to Hooks system
This commit is contained in:
Kiloku 2025-01-04 00:32:59 -03:00 committed by GitHub
parent b4457a03a9
commit 97e63d6b06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 4 deletions

View File

@ -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) {

View File

@ -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]);
}
}

View File

@ -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;);

View File

@ -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() {

View File

@ -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."
});