custom text for donating 100 rupees to charlo

This commit is contained in:
gymnast86
2026-05-08 09:11:36 -07:00
parent 48bfcec0a3
commit 2dea7375ef
6 changed files with 39 additions and 2 deletions
+11
View File
@@ -31,6 +31,7 @@
#if TARGET_PC
#include "d/d_item.h"
#include "dusk/randomizer/game/messages.hpp"
#include "dusk/randomizer/game/stages.h"
#include "dusk/randomizer/game/tools.h"
#include "dusk/randomizer/game/verify_item_functions.h"
@@ -639,6 +640,16 @@ void dMsgObject_c::setMessageIndex(u32 revoIndex, u32 param_2, bool param_3) {
mpRefer->setSelMsgPtr(NULL);
} else {
char* my_ptr = (char*) (iVar2 + pMsg->entries[msgIndex].string_offset + 8);
#if TARGET_PC
// This is where the game sets the pointer to the string for message choices.
// If any of our custom messages are for message choices, override them here
if (randomizer_IsActive()) {
auto override = GetTextOverride(groupID, field_0x15c);
if (override != NULL) {
my_ptr = override;
}
}
#endif
mpRefer->setSelMsgPtr(my_ptr);
}
}
+11 -1
View File
@@ -7,7 +7,7 @@
#include <format>
// Format certain messages that need to have dynamic info in them
const char* GetFormatedTextOverride(u32 key, const std::string& text) {
char* GetFormatedTextOverride(u32 key, std::string& text) {
// Store formatted message in static buffer so it never goes away.
// This is fine as long as we only ever need to format messages
// for textboxes, but will cause issues if we need to use it for
@@ -63,3 +63,13 @@ void HandleTextOverrides(JMessage::TControl* control, JMessage::TProcessor const
}
}
}
// Used in special cases
char* GetTextOverride(s16 groupID, u32 messageId) {
u32 key = (groupID << 16) | messageId;
auto& textOverrides = randomizer_GetContext().mTextOverrides;
if (textOverrides.contains(key)) {
return GetFormatedTextOverride(key, textOverrides[key]);
}
return NULL;
}
+3 -1
View File
@@ -6,4 +6,6 @@ struct TProcessor;
struct TControl;
}
void HandleTextOverrides(JMessage::TControl* control, JMessage::TProcessor const* pProcessor, int groupID, int index);
void HandleTextOverrides(JMessage::TControl* control, JMessage::TProcessor const* pProcessor, int groupID, int index);
char* GetTextOverride(s16 groupID, u32 messageId);
@@ -323,3 +323,10 @@ Partially Filled Sky Book Get Item Text:
Text: |-
<fast>You got a <red>Sky Character<white>!
You've collected <red>{}<white> so far.
Charlo Donation Choice Text:
Standard:
Text: |-
<choice 1>100 Rupees
<choice 2>50 Rupees
<choice 3>Sorry...
@@ -221,3 +221,7 @@
- Name: Partially Filled Sky Book Get Item Text
Group: 0
Message Id: 335
- Name: Charlo Donation Choice Text
Group: 4
Message Id: 6403
@@ -267,6 +267,9 @@ namespace randomizer {
const static std::unordered_map<std::string, std::string> messageCodes = {
{"<fast>", "\x1A\x05\x00\x00\x01"s },
{"<slow>", "\x1A\x05\x00\x00\x02"s },
{"<choice 1>", "\x1A\x06\x00\x00\x09\x01"s},
{"<choice 2>", "\x1A\x06\x00\x00\x09\x02"s},
{"<choice 3>", "\x1A\x06\x00\x00\x09\x03"s},
{"<white>", "\x1A\x06\xFF\x00\x00\x00"s},
{"<red>", "\x1A\x06\xFF\x00\x00\x01"s},
{"<green>", "\x1A\x06\xFF\x00\x00\x02"s},