mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Implement faster song playback enhancement (#801)
This commit is contained in:
@@ -1226,7 +1226,13 @@ void AddEnhancements() {
|
||||
WIDGET_CVAR_SLIDER_INT,
|
||||
{ 1, 7, 7 } },
|
||||
{ "Prevent Dropped Ocarina Inputs", "gEnhancements.Playback.NoDropOcarinaInput",
|
||||
"Prevent dropping inputs when playing the ocarina quickly.", WIDGET_CVAR_CHECKBOX } } } });
|
||||
"Prevent dropping inputs when playing the ocarina quickly.", WIDGET_CVAR_CHECKBOX },
|
||||
{ "Faster Song Playback",
|
||||
"gEnhancements.Songs.FasterSongPlayback",
|
||||
"Speeds up the playback of songs.",
|
||||
WIDGET_CVAR_CHECKBOX,
|
||||
{},
|
||||
[](widgetInfo& info) { RegisterFasterSongPlayback(); } } } } });
|
||||
enhancementsSidebar.push_back(
|
||||
{ "Time Savers",
|
||||
3,
|
||||
|
||||
@@ -55,6 +55,7 @@ void InitEnhancements() {
|
||||
|
||||
// Songs
|
||||
RegisterEnableSunsSong();
|
||||
RegisterFasterSongPlayback();
|
||||
RegisterPauseOwlWarp();
|
||||
RegisterZoraEggCount();
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#include "2s2h/GameInteractor/GameInteractor.h"
|
||||
#include "libultraship/libultraship.h"
|
||||
|
||||
extern "C" {
|
||||
#include "variables.h"
|
||||
|
||||
extern u8 sPlaybackState;
|
||||
}
|
||||
|
||||
void RegisterFasterSongPlayback() {
|
||||
static uint32_t onPlayerUpdate = 0;
|
||||
GameInteractor::Instance->UnregisterGameHookForID<GameInteractor::OnActorUpdate>(onPlayerUpdate);
|
||||
|
||||
onPlayerUpdate = 0;
|
||||
|
||||
if (!CVarGetInteger("gEnhancements.Songs.FasterSongPlayback", 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
onPlayerUpdate =
|
||||
GameInteractor::Instance->RegisterGameHookForID<GameInteractor::OnActorUpdate>(ACTOR_PLAYER, [](Actor* actor) {
|
||||
if (gPlayState->msgCtx.msgMode >= MSGMODE_SONG_PLAYED && gPlayState->msgCtx.msgMode <= MSGMODE_17) {
|
||||
if (gPlayState->msgCtx.stateTimer > 1) {
|
||||
gPlayState->msgCtx.stateTimer = 1;
|
||||
}
|
||||
gPlayState->msgCtx.ocarinaSongEffectActive = 0;
|
||||
sPlaybackState = 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
#define SONGS_H
|
||||
|
||||
void RegisterEnableSunsSong();
|
||||
void RegisterFasterSongPlayback();
|
||||
void RegisterZoraEggCount();
|
||||
void RegisterPauseOwlWarp();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user