Port Quit Fishing At Door and clean up unused stuff

This commit is contained in:
Christopher Leggett 2025-02-27 17:25:08 -05:00
commit d28cb70984
No known key found for this signature in database
GPG key ID: F2121C0AF9938ABF
4 changed files with 26 additions and 23 deletions

View file

@ -0,0 +1,26 @@
#include <soh/OTRGlobals.h>
extern "C" {
#include <variables.h>
}
// TODO: Port the rest of the behavior for this enhancement here.
void BuildQuitFishingMessage(uint16_t* textId, bool* loadFromMessageTable) {
// TODO: See about loading the vanilla message and manipulating that instead of
// a brand new one. Might not be worth it.
CustomMessage msg = CustomMessage(
"Hey! Hey!&You can't take the rod out of here!&I'm serious!^Do you want to quit?&\x1B&%gYes&No%w",
"Hey! Hey!&Du kannst die Angel doch nicht&einfach mitnehmen!&Ganz im Ernst!^Möchtest Du aufhören?&\x1B&%gJa&Nein%w",
"Holà! Holà!&Les cannes ne sortent pas d'ici!&Je suis sérieux!^Voulez-vous arrêter?&\x1B&%gOui&Non%w"
);
msg.AutoFormat();
msg.LoadIntoFont();
*loadFromMessageTable = false;
}
void QuitFishingAtDoor_Register() {
COND_ID_HOOK(OnOpenText, TEXT_FISHERMAN_LEAVE, CVarGetInteger(CVAR_ENHANCEMENT("QuitFishingAtDoor"), 0), BuildQuitFishingMessage);
}
RegisterShipInitFunc initFunc(QuitFishingAtDoor_Register, { CVAR_ENHANCEMENT("QuitFishingAtDoor") });

View file

@ -2130,20 +2130,6 @@ extern "C" void Randomizer_ShowRandomizerMenu() {
SohGui::ShowRandomizerSettingsMenu();
}
extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) {
MessageContext* msgCtx = &play->msgCtx;
uint16_t textId = msgCtx->textId;
Font* font = &msgCtx->font;
char* buffer = font->msgBuf;
const int maxBufferSize = sizeof(font->msgBuf);
CustomMessage messageEntry;
s16 actorParams = 0;
if (textId == TEXT_FISHERMAN_LEAVE && CVarGetInteger(CVAR_ENHANCEMENT("QuitFishingAtDoor"), 0)) {
messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_FISHERMAN_LEAVE, MF_FORMATTED);
}
return false;
}
extern "C" void Overlay_DisplayText(float duration, const char* text) {
Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text);
}

View file

@ -30,7 +30,6 @@ struct ExtensionEntry {
extern std::unordered_map<std::string, ExtensionEntry> ExtensionCache;
#include "Enhancements/randomizer/settings.h"
const std::string customMessageTableID = "BaseGameOverrides";
const std::string appShortName = "soh";
#ifdef __WIIU__
@ -149,7 +148,6 @@ uint8_t Randomizer_IsSpoilerLoaded();
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);

View file

@ -111,11 +111,4 @@ extern "C" void OTRMessage_Init() {
// Assert staff credits start at the first credits ID
assert(sStaffMessageEntryTablePtr[0].textId == 0x0500);
}
CustomMessageManager::Instance->AddCustomMessageTable(customMessageTableID);
CustomMessageManager::Instance->CreateMessage(
customMessageTableID, TEXT_FISHERMAN_LEAVE,
CustomMessage("Hey! Hey!&You can't take the rod out of here!&I'm serious!^Do you want to quit?&\x1B&%gYes&No%w",
"Hey! Hey!&Du kannst die Angel doch nicht&einfach mitnehmen!&Ganz im Ernst!^Möchtest Du aufhören?&\x1B&%gJa&Nein%w",
"Holà! Holà!&Les cannes ne sortent pas d'ici!&Je suis sérieux!^Voulez-vous arrêter?&\x1B&%gOui&Non%w")); //TODO Used AI translation as placeholder
}