Skip to content

Commit

Permalink
Built-in Plandomizer Editor (HarbourMasters#4532)
Browse files Browse the repository at this point in the history
* Add Plandomizer Editor Window

* UI, Ice Trap Editor, Hint Editor

* Drop down for previous seeds, wip hash display.

* Clean Up, Hash Icon Editor

* Updates based on suggestions

* Replace Tint with Color

* Add Boss Soul Icon

* Corrected App Folder Directory and updated from suggesstions.

* Add Hints to Junk Pool

* Utilize RandomElement for hints

* Hint update for pep

* apply patch

* Fix Sorting issue on Linux

* Skeleton Key, Shop Items, Milk, Fishing Pole, Ocarina Buttons, Loser Rupee fixed

* Fix stretched note icons.

* Remove Triforce, add Triforce Pieces. Centered Song Notes.

* Update soh/soh/Enhancements/randomizer/Plandomizer.cpp

Co-authored-by: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com>

* Update hint_list.cpp

One spelling, removed 1 hint.

* Update Plandomizer.cpp

---------

Co-authored-by: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com>
Co-authored-by: Malkierian <malkierian@live.com>
  • Loading branch information
3 people authored Nov 17, 2024
1 parent 53e2fe4 commit 70f3dfa
Show file tree
Hide file tree
Showing 15 changed files with 1,376 additions and 23 deletions.
42 changes: 30 additions & 12 deletions soh/soh/Enhancements/custom-message/CustomMessageManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ static const std::unordered_map<std::string, std::string> percentColors = { { "w
{ "b", QM_BLUE }, { "c", QM_LBLUE }, { "p", QM_PINK },
{ "y", QM_YELLOW }, { "B", QM_BLACK } };

static const std::unordered_map<std::string, std::string> colorToPercent = { { QM_WHITE, "%w" }, { QM_RED, "%r"}, { QM_GREEN, "%g" },
{ QM_BLUE, "%b" }, { QM_LBLUE, "%c"}, { QM_PINK, "%p" },
{ QM_YELLOW, "%y" }, { QM_BLACK, "%B" } };

static const std::unordered_map<std::string, ItemID> altarIcons = {
{ "0", ITEM_KOKIRI_EMERALD },
{ "1", ITEM_GORON_RUBY },
Expand Down Expand Up @@ -147,6 +151,8 @@ void CustomMessage::ProcessMessageFormat(std::string& str, MessageFormat format)
CleanString(str);
} else if (format == MF_AUTO_FORMAT){
AutoFormatString(str);
}else if (format == MF_ENCODE){
EncodeColors(str);
}
}

Expand Down Expand Up @@ -281,6 +287,12 @@ void CustomMessage::Clean() {
}
}

void CustomMessage::Encode() {
for (std::string& str : messages) {
EncodeColors(str);
}
}

void CustomMessage::FormatString(std::string& str) const {
std::replace(str.begin(), str.end(), '&', NEWLINE()[0]);
std::replace(str.begin(), str.end(), '^', WAIT_FOR_INPUT()[0]);
Expand Down Expand Up @@ -506,7 +518,23 @@ const char* Interface_ReplaceSpecialCharacters(char text[]) {
return textChar;
}

void CustomMessage::EncodeColors(std::string& str) const {
for (std::string color: colors) {
if (const size_t firstHashtag = str.find('#'); firstHashtag != std::string::npos) {
str.replace(firstHashtag, 1, colorToPercent.at(color));
if (const size_t secondHashtag = str.find('#', firstHashtag + 1); secondHashtag != std::string::npos) {
str.replace(secondHashtag, 1, "%w");
} else {
SPDLOG_DEBUG("non-matching hashtags in string: \"%s\"", str);
}
}
}
// Remove any remaining '#' characters.
std::erase(str, '#');
}

void CustomMessage::ReplaceColors(std::string& str) const {
EncodeColors(str);
for (const auto& colorPair : percentColors) {
std::string textToReplace = "%";
textToReplace += colorPair.first;
Expand All @@ -516,18 +544,6 @@ void CustomMessage::ReplaceColors(std::string& str) const {
start_pos += textToReplace.length();
}
}
for (auto color: colors) {
if (const size_t firstHashtag = str.find('#'); firstHashtag != std::string::npos) {
str.replace(firstHashtag, 1, COLOR(color));
if (const size_t secondHashtag = str.find('#', firstHashtag + 1); secondHashtag != std::string::npos) {
str.replace(secondHashtag, 1, COLOR(QM_WHITE));
} else {
SPDLOG_DEBUG("non-matching hashtags in string: \"%s\"", str);
}
}
}
// Remove any remaining '#' characters.
std::erase(str, '#');
}

void CustomMessage::ReplaceAltarIcons(std::string& str) const {
Expand Down Expand Up @@ -619,6 +635,8 @@ CustomMessage CustomMessageManager::RetrieveMessage(std::string tableID, uint16_
message.AutoFormat();
} else if (format == MF_CLEAN){
message.Clean();
} else if (format == MF_ENCODE){
message.Encode();
}

return message;
Expand Down
13 changes: 12 additions & 1 deletion soh/soh/Enhancements/custom-message/CustomMessageManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ typedef enum {
MF_FORMATTED,
MF_CLEAN,
MF_RAW,
MF_AUTO_FORMAT
MF_AUTO_FORMAT,
MF_ENCODE,
} MessageFormat;

/**
Expand Down Expand Up @@ -108,6 +109,11 @@ class CustomMessage {
*/
void ReplaceSpecialCharacters(std::string& str) const;

/**
* @brief Replaces hashtags with stored colors.
*/
void EncodeColors(std::string& str) const;

/**
* @brief Replaces our color variable strings with the OoT control codes.
*/
Expand Down Expand Up @@ -160,6 +166,11 @@ class CustomMessage {
*/
void Clean();

/**
* @brief Replaces variable characters with fixed ones to store the sata in string form
*/
void Encode();

/**
* @brief Replaces various symbols with the control codes necessary to
* display them in OoT's textboxes for a single string
Expand Down
2 changes: 1 addition & 1 deletion soh/soh/Enhancements/debugger/debugSaveEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ void DrawQuestStatusTab() {
ImGui::SameLine();
DrawQuestItemButton(QUEST_GERUDO_CARD);

for (const SongMapEntry& entry : songMapping) {
for (const auto& [quest, entry] : songMapping) {
if ((entry.id != QUEST_SONG_MINUET) && (entry.id != QUEST_SONG_LULLABY)) {
ImGui::SameLine();
}
Expand Down
112 changes: 112 additions & 0 deletions soh/soh/Enhancements/randomizer/3drando/hint_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2253,6 +2253,118 @@ void StaticData::HintTable_Init() {
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_1] = HintText(CustomMessage("They say that %gGanondorf's Mom%w is going out with %ySqueak%w!",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_2] = HintText(CustomMessage("They say that %gProxySaw%w is still fixing %yCaladius's Bugs%w...",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_3] = HintText(CustomMessage("They say that %gItsHeckinPat%w is still just %yEyeballing it%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_4] = HintText(CustomMessage("They say that %gCaladius%w is working on %yV2%w of something.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_5] = HintText(CustomMessage("They say that %gdice%w is a funny name for a %ytaco%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_6] = HintText(CustomMessage("They say %g2Ship Rando%w is still blocked by %yV3%w...",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_7] = HintText(CustomMessage("They say if you click your heels and say %gframebuffer%w 3 times, %yArchez%w appears!",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_8] = HintText(CustomMessage("They say %gVB%w stands for %yVirtual Bananas%w... Probably.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_9] = HintText(CustomMessage("They say %gZeru%w is still routing his %yHundo%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_10] = HintText(CustomMessage("They say %gRaccoonCloud%w is still looking for his %yHover Boots%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_11] = HintText(CustomMessage("They say %gItsHeckinPat%w foreclosed on his %yHut%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_12] = HintText(CustomMessage("They say %gRaccoonCloud%w is part of the %yInner Circle%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_13] = HintText(CustomMessage("They say %gMoonlitxShadows%w is the %rleader%w of the %yDork Army%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_14] = HintText(CustomMessage("They say %gGanondorf%w hates the %yInternet%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_15] = HintText(CustomMessage("They say %gMido's House%w hoards %yTrash%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_16] = HintText(CustomMessage("They say %gSweettalking Ganondorf%w rewards %yHis Heart%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_17] = HintText(CustomMessage("They say %gaMannus%w said %yGo To Bed%w!",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_18] = HintText(CustomMessage("They say %gCaladius%w is a %yPinhead%w!",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_19] = HintText(CustomMessage("They say %gRaccoonCloud%w loves the %yIce Cavern%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_20] = HintText(CustomMessage("They say %gNo One%w should forget %yHover Scrub%w!",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_21] = HintText(CustomMessage("They say %gMoonlitxShadows%w likes to %ySlide%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_23] = HintText(CustomMessage("They say that %gBackwalking%w should be %rBanned%w!",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_24] = HintText(CustomMessage("They say that %gGorons%w should always have %yLong Necks%w!",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_25] = HintText(CustomMessage("They say that %gCaladius%w has a %ytendency to lose his shirt%w!",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_26] = HintText(CustomMessage("They say that if your %rSkip keeps Failing%w, you're probably an %yESS Off%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_27] = HintText(CustomMessage("They say that %gLogic%w is just a %ySuggestion%w.",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_28] = HintText(CustomMessage("They say there's %gAlways Logic%w in %yNo Logic%w...",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

hintTextTable[RHT_JUNK_CREW_29] = HintText(CustomMessage("They said that %rFredomato%w has just %yone more push up%w to do!",
/*german*/ "",
/*french*/ HINT_TEXT_NEEDS_TRANSLATION_FR));

/*--------------------------
| DUNGEON HINT TEXT |
---------------------------*/
Expand Down
4 changes: 2 additions & 2 deletions soh/soh/Enhancements/randomizer/3drando/hints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ StaticHintInfo::StaticHintInfo(HintType _type, std::vector<RandomizerHintTextKey

RandomizerHintTextKey GetRandomJunkHint(){
//temp code to handle random junk hints now I work in keys instead of a vector of HintText
// Will be replaced with a better system once more customisable hint pools are added
uint32_t range = RHT_JUNK_SG_8 - RHT_JUNK02;
//Will be replaced with a better system once more customisable hint pools are added
uint32_t range = RHT_JUNK_CREW_29 - RHT_JUNK02;
return (RandomizerHintTextKey)(Random(0, range) + RHT_JUNK02);
}

Expand Down
4 changes: 3 additions & 1 deletion soh/soh/Enhancements/randomizer/3drando/hints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ struct StaticHintInfo{
std::vector<RandomizerCheck> _hintChecks = {}, bool _yourPocket = false, int _num = 0);
};

RandomizerHintTextKey GetRandomJunkHint();
extern void CreateAllHints();
extern void CreateWarpSongTexts();
void CreateStaticHints();
void CreateStaticHints();
RandomizerHintTextKey GetRandomJunkHint();
Loading

0 comments on commit 70f3dfa

Please sign in to comment.