Skip to content

Commit

Permalink
Some text fixes (#731)
Browse files Browse the repository at this point in the history
* Change maxLinePixelWidth when there is an item icon

* Use player name for Dark Link Soul in shops

and keep "Link" in the item name for the spoiler log

* Use player name for Dark Link hints in English

for consistency with the other languages and the vanilla game
  • Loading branch information
HylianFreddy authored May 23, 2024
1 parent c900b09 commit 12cb7a0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
10 changes: 9 additions & 1 deletion source/custom_messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,7 @@ void CreateAlwaysIncludedMessages() {
for (u32 shopitems = 0; shopitems < NonShopItems.size(); shopitems++) {
Text name = NonShopItems[shopitems].Name;
std::string price = std::to_string(NonShopItems[shopitems].Price);
name.Replace("Link", PLAYER_NAME()); // for "Dark Link Soul" item
// Prevent names from being too long and overflowing textbox
Text priceSeparator = Text{
name.NAenglish.length() <= 30 ? ": " : NEWLINE() + " ",
Expand Down Expand Up @@ -1145,7 +1146,14 @@ static std::map<std::string, int> pixelWidthTable = {
// Calculates the maximum number of characters that could satisfy
// next line in the string from the last calculated newline.
static size_t NextLineLength(std::string* textStr, size_t lastNewline) {
constexpr size_t maxLinePixelWidth = 287;
size_t maxLinePixelWidth = 287;
size_t lastCaret = textStr->rfind('^', lastNewline);
size_t lastItemIcon = textStr->rfind("\x7F\x0F", lastNewline);

// For text boxes with an item icon, decrease max line pixel width to leave space for the icon
if (lastItemIcon != std::string::npos && (lastCaret == std::string::npos || lastItemIcon > lastCaret)) {
maxLinePixelWidth = 252;
}

size_t totalPixelWidth = 0;
size_t currentPos = lastNewline;
Expand Down
14 changes: 7 additions & 7 deletions source/hint_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1795,16 +1795,16 @@ void HintTable_Init() {
hintTable[BRIDGE_OPEN_HINT] = HintText::Bridge({
// obscure text
Text{"The awakened ones will have #already&created a bridge# to the castle where&the evil dwells.",
/*french*/"Les êtres de sagesse ont#déjà créé&un pont# vers le repaire du mal.",
/*spanish*/"Los sabios #ya habrán creado un puente#&al castillo, de donde emana el mal.",
/*french*/"Les êtres de sagesse ont #déjà créé&un pont# vers le repaire du mal.",
/*spanish*/"Los sabios #ya habrán creado un&puente #al castillo, de donde emana el mal.",
/*italian*/"I Saggi avranno #già creato un ponte#&verso il castello dove risiede il male.",
/*german*/"Die Weisen haben #bereits&eine Brücke zum Portal von&Ganons Schloss gelegt#..."},
});

hintTable[BRIDGE_VANILLA_HINT] = HintText::Bridge({
// obscure text
Text{"The awakened ones will await for the&Hero to collect the #Shadow and Spirit&Medallions# as well as the #Light Arrows#.",
/*french*/"Les êtres de sagesse attendront le&héros muni des #médaillons de l'ombre et&l'esprit# et des #flèches de lumière#.",
/*french*/"Les êtres de sagesse attendront le&héros muni des #médaillons de l'ombre&et l'esprit# et des #flèches de lumière#.",
/*spanish*/"Los sabios aguardarán a que el héroe&obtenga tanto el #Medallón de las&Sombras y el del Espíritu# junto a la #flecha de luz#.",
/*italian*/"I Saggi aspetteranno che l'Eroe&ottenga sia i #medaglioni dell'Ombra&e dello Spirito# che la #freccia di luce#.",
/*german*/"Die Weisen werden darauf warten,&dass der Held das #Amulett des&Schattens, Amulett der Geister#&und die #Licht-Pfeile# sammelt."},
Expand Down Expand Up @@ -1841,7 +1841,7 @@ void HintTable_Init() {
// obscure text singular plural
Text{"The awakened ones will await for the&Hero to conquer #%d |Dungeon|Dungeons|#.",
/*french*/"Les êtres de sagesse attendront la&conquête de #%d |donjon|donjons|#.",
/*spanish*/"Los sabios aguardarán a que el héroe& complete #%d |mazmorra|mazmorras|#.",
/*spanish*/"Los sabios aguardarán a que el héroe&complete #%d |mazmorra|mazmorras|#.",
/*italian*/"I Saggi aspetteranno che l'Eroe&completi #%d dungeon#.",
/*german*/"Die Weisen werden darauf&warten, dass der Held #%d&|Labyrinth|Labyrinthe|# abschließt."},
});
Expand Down Expand Up @@ -2062,8 +2062,8 @@ void HintTable_Init() {
hintTable[CHILD_ALTAR_TEXT_END_DOTCLOSED] = HintText::Altar({
// obscure text
Text{"Ye who may become a Hero...&Stand with the Ocarina and&play the Song of Time.",
/*french*/"À celui qui a quête de devenir héros...&Portez l'Ocarina et&jouez le chant du temps.",
/*spanish*/"Para aquel que se convierta en el héroe...&Tome la ocarina y&entone la Canción del Tiempo.",
/*french*/"À celui qui a quête de devenir héros...&Portez l'Ocarina et jouez&le chant du temps.",
/*spanish*/"Para aquel que se convierta en el héroe...&Tome la ocarina y entone&la Canción del Tiempo.",
/*italian*/"O tu che diventerai un Eroe...&Prendi l'ocarina e suona&la Canzone del Tempo.",
/*german*/"Jener auf dem Weg des Helden...&Nehme er seine Okarina zur Hand und&spiele hier die Hymne der Zeit."},
});
Expand All @@ -2073,7 +2073,7 @@ void HintTable_Init() {
Text{"Ye who may become a Hero...&Offer the spiritual stones and&play the Song of Time.",
/*french*/"À celui qui a quête de devenir héros...&Présentez les pierres spirituelles et&jouez le chant du temps.",
/*spanish*/"Para aquel que se convierta en el héroe...&Tome las piedras espirituales y&entone la Canción del Tiempo.",
/*italian*/"O tu che diventerai un Eroe...&Offri le tre pietre spirituali&e suona la Canzone del Tempo.",
/*italian*/"O tu che diventerai un Eroe...&Offri le tre pietre spirituali e&suona la Canzone del Tempo.",
/*german*/"Jener mit den drei Heiligen Steinen&nehme seine Okarina zur Hand und&spiele hier die Hymne der Zeit."},
});

Expand Down
4 changes: 2 additions & 2 deletions source/hint_list/hint_list_exclude_dungeon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ void HintTable_Init_Exclude_Dungeon() {
Text{"a #dark reflection# of yourself guards", /*french*/"son #propre reflet# cache", /*spanish*/"el #oscuro reflejo de ti mismo# guarda", /*italian*/"la #tua ombra# difende", /*german*/"nahe eines #dunklen Spiegelbilds#, |wäre|wären|"},
}, {},
// clear text
Text{"#Dark Link# guards", /*french*/"l'#Ombre de @# protège", /*spanish*/"#@ Oscuro# guarda", /*italian*/"#@ oscuro# protegge", /*german*/"nahe #dem schwarzen @#, |wäre|wären|"}
Text{"#Dark @# guards", /*french*/"l'#Ombre de @# protège", /*spanish*/"#@ Oscuro# guarda", /*italian*/"#@ oscuro# protegge", /*german*/"nahe #dem schwarzen @#, |wäre|wären|"}
);


Expand Down Expand Up @@ -1965,4 +1965,4 @@ void HintTable_Init_Exclude_Dungeon() {
Text{"#scrubs in Ganon's Castle# sell", /*french*/"les #pestes Mojo dans le château de Ganon# vendent", /*spanish*/"los #dekus del Castillo de Ganon# venden", /*italian*/"un #cespuglio nel castello di Ganon# vende", /*german*/"die Ware, eines #Deku-Händlers in Ganons Schloss#, |wäre|wären|"},
});
}
// clang-format on
// clang-format on
2 changes: 1 addition & 1 deletion source/hint_list/hint_list_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,7 @@ void HintTable_Init_Item() {

hintTable[SOUL_ITEM_DARK_LINK] = HintText::Item({
// obscure text
Text{"the Dark Link Soul", /*french*/"l'Essence de l'ombre de @", /*spanish*/"el alma de @ Oscuro", /*italian*/"l'anima di @ Oscuro", /*german*/"die Seele von schwarzen @"},
Text{"the Dark @ Soul", /*french*/"l'Essence de l'ombre de @", /*spanish*/"el alma de @ Oscuro", /*italian*/"l'anima di @ Oscuro", /*german*/"die Seele von schwarzen @"},
}, {
// ambiguous text
Text{"a Soul", /*french*/"une Essence", /*spanish*/"un alma", /*italian*/"un'anima", /*german*/"eine Seele"},
Expand Down
2 changes: 1 addition & 1 deletion source/item_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ void ItemTable_Init() { //Item Type
itemTable[SOUL_ITEM_GUAY] = Item(ITEMTYPE_ENEMY_SOUL, GI_SOUL_GUAY, true, &SoulGuay, SOUL_ITEM_GUAY, Text{"Guay Soul", "Essence de Toukor", "Alma de Guay", "Anima di Corvacchia", "Seele von Wüstenkrähen"});
itemTable[SOUL_ITEM_DOOR_MIMIC] = Item(ITEMTYPE_ENEMY_SOUL, GI_SOUL_DOOR_MIMIC, true, &SoulDoorMimic, SOUL_ITEM_DOOR_MIMIC, Text{"Door Mimic Soul", "Essence de Simili-Porte", "Alma de Puerta Falsa", "Anima di Porta Falsa", "Seele von Türmimics"});
itemTable[SOUL_ITEM_STALFOS] = Item(ITEMTYPE_ENEMY_SOUL, GI_SOUL_STALFOS, true, &SoulStalfos, SOUL_ITEM_STALFOS, Text{"Stalfos Soul", "Essence de Stalfos", "Alma de Stalfos", "Anima di Stalfos", "Seele von Stalfos"});
itemTable[SOUL_ITEM_DARK_LINK] = Item(ITEMTYPE_ENEMY_SOUL, GI_SOUL_DARK_LINK, true, &SoulDarkLink, SOUL_ITEM_DARK_LINK, Text{"Dark Link Soul", "Essence de l'ombre de @", "Alma de @ Oscuro", "Anima di @ Oscuro", "Seele von schwarzen @"});
itemTable[SOUL_ITEM_DARK_LINK] = Item(ITEMTYPE_ENEMY_SOUL, GI_SOUL_DARK_LINK, true, &SoulDarkLink, SOUL_ITEM_DARK_LINK, Text{"Dark Link Soul", "Essence de l'ombre de Link", "Alma de Link Oscuro", "Anima di Link Oscuro", "Seele von schwarzen Link"});
itemTable[SOUL_ITEM_FLARE_DANCER] = Item(ITEMTYPE_ENEMY_SOUL, GI_SOUL_FLARE_DANCER, true, &SoulFlareDancer, SOUL_ITEM_FLARE_DANCER, Text{"Flare Dancer Soul", "Essence de Danse-Flamme", "Alma de Bailafuego", "Anima di Fiammerino", "Seele von Flammenderwischen"});
itemTable[SOUL_ITEM_DEAD_HAND] = Item(ITEMTYPE_ENEMY_SOUL, GI_SOUL_DEAD_HAND, true, &SoulDeadHand, SOUL_ITEM_DEAD_HAND, Text{"Dead Hand Soul", "Essence de Poigneur", "Alma de Mano Muerta", "Anima di Smaniosso", "Seele von Hirnsaugern"});
itemTable[SOUL_ITEM_GERUDO] = Item(ITEMTYPE_ENEMY_SOUL, GI_SOUL_GERUDO, true, &SoulGerudo, SOUL_ITEM_GERUDO, Text{"Gerudo Soul", "Essence de Voleuse Gerudo", "Alma de Gerudo", "Anima di Gerudo", "Seele von Gerudos"});
Expand Down

0 comments on commit 12cb7a0

Please sign in to comment.