Enhancement: Adds Slider for Duration of Sequence Names on the Overlay (#2375)

* New function: overlay text duration in seconds.

`Overlay_DisplayText` took a float as an argument, with no clear indication of what that float represented. That float also evaluates to different durations given different frame rates. However, since we know what the frame rate should be at any given time (since it's stored in a CVar) we can calculate what this duration should be based on the number of seconds we want the overlay to be displayed. That's what `Overlay_DisplayText_Seconds` does.

* Adds Slider for Overlay Sequence Name Durations
This commit is contained in:
Christopher Leggett 2023-01-20 21:48:17 -05:00 committed by GitHub
parent 1b9ab52e35
commit 1b9962dfc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 1 deletions

View File

@ -448,6 +448,10 @@ void DrawSfxEditor(bool& open) {
"Displays the name of the current sequence in the corner of the screen whenever a new sequence "
"is loaded to the main sequence player (does not apply to fanfares or enemy BGM)."
);
ImGui::SameLine();
UIWidgets::EnhancementSliderInt("Overlay Duration: %d seconds", "##SeqNameOverlayDuration",
"gSeqNameOverlayDuration", 1, 10, "", 5, true);
ImGui::NewLine();
UIWidgets::PaddedSeparator();
UIWidgets::PaddedText("The following options are experimental and may cause music\nto sound odd or have other undesireable effects.");
UIWidgets::EnhancementCheckbox("Lower Octaves of Unplayable High Notes", "gExperimentalOctaveDrop");

View File

@ -1598,6 +1598,11 @@ extern "C" void Overlay_DisplayText(float duration, const char* text) {
SohImGui::GetGameOverlay()->TextDrawNotification(duration, true, text);
}
extern "C" void Overlay_DisplayText_Seconds(int seconds, const char* text) {
float duration = seconds * CVarGetInteger("gInterpolationFPS", 20) * 0.05;
SohImGui::GetGameOverlay()->TextDrawNotification(duration, true, text);
}
extern "C" void Entrance_ClearEntranceTrackingData(void) {
ClearEntranceTrackingData();
}

View File

@ -130,6 +130,7 @@ GetItemEntry Randomizer_GetItemFromKnownCheckWithoutObtainabilityCheck(Randomize
ItemObtainability Randomizer_GetItemObtainabilityFromRandomizerCheck(RandomizerCheck randomizerCheck);
int CustomMessage_RetrieveIfExists(PlayState* play);
void Overlay_DisplayText(float duration, const char* text);
void Overlay_DisplayText_Seconds(int seconds, const char* text);
GetItemEntry ItemTable_Retrieve(int16_t getItemID);
GetItemEntry ItemTable_RetrieveEntry(s16 modIndex, s16 getItemID);
void Entrance_ClearEntranceTrackingData(void);

View File

@ -615,7 +615,7 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
if (CVarGetInteger("gSeqNameOverlay", 0) && playerIdx == SEQ_PLAYER_BGM_MAIN) {
const char* sequenceName = SfxEditor_GetSequenceName(seqId);
if (sequenceName != NULL) {
Overlay_DisplayText(5.0f, sequenceName);
Overlay_DisplayText_Seconds(CVarGetInteger("gSeqNameOverlayDuration", 5), sequenceName);
}
}
}