diff options
Diffstat (limited to 'mm/2s2h/Enhancements/Restorations/DayTelopDuration.cpp')
| -rw-r--r-- | mm/2s2h/Enhancements/Restorations/DayTelopDuration.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mm/2s2h/Enhancements/Restorations/DayTelopDuration.cpp b/mm/2s2h/Enhancements/Restorations/DayTelopDuration.cpp new file mode 100644 index 000000000..024924a73 --- /dev/null +++ b/mm/2s2h/Enhancements/Restorations/DayTelopDuration.cpp @@ -0,0 +1,29 @@ +#include <libultraship/bridge/consolevariablebridge.h> +#include "2s2h/GameInteractor/GameInteractor.h" +#include "2s2h/ShipInit.hpp" + +extern "C" { +#include "variables.h" +#include "overlays/gamestates/ovl_daytelop/z_daytelop.h" +} + +#define CVAR_NAME "gEnhancements.Restorations.DayTelopDuration" +#define CVAR CVarGetInteger(CVAR_NAME, 0) + +void RegisterDayTelopDurationRestoration() { + COND_HOOK(OnGameStateMainStart, CVAR, []() { + if (gGameState == nullptr || gGameState->destroy != DayTelop_Destroy) { + return; + } + + // Only add frames the first time the DayTelop state is detected + if (gGameState->frames != 1) { + return; + } + + DayTelopState* dayTelop = reinterpret_cast<DayTelopState*>(gGameState); + dayTelop->transitionCountdown += 120; + }); +} + +static RegisterShipInitFunc initFunc(RegisterDayTelopDurationRestoration, { CVAR_NAME }); |
