mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-19 21:03:42 -07:00
Turn song text into a notification (#5712)
This commit is contained in:
parent
6d4c6f8ea6
commit
3e39a94083
6 changed files with 12 additions and 16 deletions
|
@ -2,6 +2,7 @@
|
|||
#include "sequence.h"
|
||||
#include "sfx.h"
|
||||
#include "soh/cvar_prefixes.h"
|
||||
#include "soh/Notification/Notification.h"
|
||||
#include <vector>
|
||||
#include <utils/StringHelper.h>
|
||||
#include <libultraship/bridge.h>
|
||||
|
@ -458,3 +459,11 @@ extern "C" bool AudioCollection_HasSequenceNum(uint16_t seqId) {
|
|||
extern "C" size_t AudioCollection_SequenceMapSize() {
|
||||
return AudioCollection::Instance->SequenceMapSize();
|
||||
}
|
||||
|
||||
extern "C" void AudioCollection_EmitSongNameNotification(s32 seqId) {
|
||||
const char* sequenceName = AudioCollection_GetSequenceName(seqId);
|
||||
if (sequenceName != NULL) {
|
||||
Notification::Emit({ .message = "Currently playing: " + std::string(sequenceName),
|
||||
.remainingTime = (float)CVarGetInteger(CVAR_AUDIO("SeqNameOverlayDuration"), 5) });
|
||||
}
|
||||
}
|
|
@ -73,4 +73,5 @@ void AudioCollection_AddToCollection(char* otrPath, uint16_t seqNum);
|
|||
const char* AudioCollection_GetSequenceName(uint16_t seqId);
|
||||
bool AudioCollection_HasSequenceNum(uint16_t seqId);
|
||||
size_t AudioCollection_SequenceMapSize();
|
||||
void AudioCollection_EmitSongNameNotification(s32 seqId);
|
||||
#endif
|
|
@ -49,7 +49,6 @@ extern "C" {
|
|||
|
||||
extern SaveContext gSaveContext;
|
||||
extern PlayState* gPlayState;
|
||||
extern void Overlay_DisplayText(float duration, const char* text);
|
||||
}
|
||||
|
||||
// GreyScaleEndDlist
|
||||
|
|
|
@ -2580,15 +2580,6 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
|
|||
return false;
|
||||
}
|
||||
|
||||
extern "C" void Overlay_DisplayText(float duration, const char* text) {
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text);
|
||||
}
|
||||
|
||||
extern "C" void Overlay_DisplayText_Seconds(int seconds, const char* text) {
|
||||
float duration = seconds * OTRGlobals::Instance->GetInterpolationFPS() * 0.05;
|
||||
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text);
|
||||
}
|
||||
|
||||
extern "C" void EntranceTracker_SetCurrentGrottoID(s16 entranceIndex) {
|
||||
SetCurrentGrottoIDForTracker(entranceIndex);
|
||||
}
|
||||
|
|
|
@ -156,8 +156,6 @@ void Randomizer_SetSpoilerLoaded(bool spoilerLoaded);
|
|||
uint8_t Randomizer_GenerateRandomizer();
|
||||
void Randomizer_ShowRandomizerMenu();
|
||||
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 EntranceTracker_SetCurrentGrottoID(s16 entranceIndex);
|
||||
|
|
|
@ -640,10 +640,8 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
|
|||
if (gPlayState != NULL) {
|
||||
previousSceneNum = gPlayState->sceneNum;
|
||||
}
|
||||
const char* sequenceName = AudioCollection_GetSequenceName(seqId);
|
||||
if (sequenceName != NULL) {
|
||||
Overlay_DisplayText_Seconds(CVarGetInteger(CVAR_AUDIO("SeqNameOverlayDuration"), 5), sequenceName);
|
||||
}
|
||||
|
||||
AudioCollection_EmitSongNameNotification(seqId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue