1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 13:07:16 +00:00

refactored some XLAT calls for automated analysis, fixing some bugs on the way

This commit is contained in:
Zeno Rogue 2021-05-23 14:17:06 +02:00
parent b92c621112
commit c0002da574
9 changed files with 58 additions and 41 deletions

View File

@ -2835,7 +2835,8 @@ EX void edit_all_settings() {
}
void list_setting::show_edit_option(char key) {
dialog::addSelItem(XLAT(menu_item_name), XLAT(options[get_value()].first), key);
string opt = options[get_value()].first;
dialog::addSelItem(XLAT(menu_item_name), XLAT(opt), key);
dialog::add_action_push([this] {
add_to_changed(this);
gamescreen(2);

View File

@ -178,9 +178,6 @@ EX void ge_land_selection() {
dialog::init(XLAT("experiment with geometry"));
// dialog::addSelItem(XLAT("geometry"), XLAT(bitruncnames[int(variation)]), '5');
// dialog::addBreak(50);
generateLandList([] (eLand l) { return land_validity(l).flags & lv::appears_in_geom_exp; });
stable_sort(landlist.begin(), landlist.end(), [] (eLand l1, eLand l2) { return land_validity(l1).quality_level > land_validity(l2).quality_level; });
@ -391,10 +388,13 @@ void ge_select_tiling() {
if(ginf[j].tiling_name == ginf[i].tiling_name)
geometry = g = eGeometry(j);
}
dialog::addBoolItem(XLAT(
(geometry == gProduct && in_2d) ? XLAT("current geometry x E") :
(geometry == gRotSpace && in_2d) ? XLAT("space of rotations in current geometry") :
ginf[g].menu_displayed_name), on, letter++);
bool is_product = (geometry == gProduct && in_2d);
bool is_rotspace = (geometry == gRotSpace && in_2d);
dialog::addBoolItem(
is_product ? XLAT("current geometry x E") :
is_rotspace ? XLAT("space of rotations in current geometry") :
XLAT(ginf[g].menu_displayed_name), on, letter++);
dialog::lastItem().value += validclasses[land_validity(specialland).quality_level];
dialog::add_action([g] { set_or_configure_geometry(g); });
}

View File

@ -1824,15 +1824,11 @@ EX namespace mapeditor {
case sgFloor:
line1 = GDIM == 3 ? XLAT("pick something") : XLAT("floor");
line2 = "#" + its(drawcellShapeID());
/* line2 = XLAT(ishept(drawcell) ? "heptagonal" :
ishex1(drawcell) ? "hexagonal #1" : "hexagonal"); */
break;
case sgWall:
line1 = XLAT("statue");
line2 = "#" + its(drawcellShapeID());
/* line2 = XLAT(ishept(drawcell) ? "heptagonal" :
ishex1(drawcell) ? "hexagonal #1" : "hexagonal"); */
break;
}

View File

@ -124,9 +124,10 @@ EX void showOverview() {
if(items[it] >= 10) col = winf[waMirror].color; else col = BLACKISH;
if(displayfrZH(xr*46, i0, 1, vf-4, XLAT1(winf[waMirror].name), col, 0))
getcstat = 3000+waMirror;
if(getcstat == 3000+waMirror)
mouseovers = XLAT(
olrDescriptions[getOLR(io, cwt.at->land)], cwt.at->land, it, treasureTypeUnlock(curland, io));
if(getcstat == 3000+waMirror) {
string olrdesc = olrDescriptions[getOLR(io, cwt.at->land)];
mouseovers = XLAT(olrdesc, cwt.at->land, it, treasureTypeUnlock(curland, io));
}
}
else if(io) {
if(lv >= 25) col = 0xFFD500;
@ -139,9 +140,10 @@ EX void showOverview() {
getcstat = 2000+io;
if(displayfrZH(xr*46, i0, 1, vf-4, XLAT1(iinf[io].name), col, 0))
getcstat = 2000+io;
if(getcstat == 2000+io)
mouseovers = XLAT(
olrDescriptions[getOLR(io, curland)], curland, it, treasureTypeUnlock(curland, io));
if(getcstat == 2000+io) {
string olrdesc = olrDescriptions[getOLR(io, curland)];
mouseovers = XLAT(olrdesc, curland, it, treasureTypeUnlock(curland, io));
}
}
}
@ -227,7 +229,7 @@ EX void showMainMenu() {
else dialog::addBreak(100);
dialog::addItem(XLAT("restart game"), 'r');
dialog::addItem(XLAT(inSpecialMode() ? "reset special modes" : "back to the start menu"), 'R');
dialog::addItem(inSpecialMode() ? XLAT("reset special modes") : XLAT("back to the start menu"), 'R');
string q;
#if ISMOBILE

View File

@ -666,12 +666,22 @@ bool pcmove::actual_move() {
return after_escape();
}
void blowaway_message(cell *c2) {
addMessage(airdist(c2) < 3 ? XLAT("The Air Elemental blows you away!") : XLAT("You cannot go against the wind!"));
}
EX void tortoise_hero_message(cell *c2) {
bool fem = playergender() == GEN_F;
playSound(c2, fem ? "heal-princess" : "heal-prince");
addMessage(fem ? XLAT("You are now a tortoise heroine!") : XLAT("You are now a tortoise hero!"));
}
bool pcmove::boat_move() {
cell *& c2 = mi.t;
if(againstWind(c2, cwt.at)) {
if(vmsg()) addMessage(XLAT(airdist(c2) < 3 ? "The Air Elemental blows you away!" : "You cannot go against the wind!"));
if(vmsg()) blowaway_message(c2);
return false;
}
@ -875,14 +885,13 @@ bool pcmove::move_if_okay() {
void pcmove::tell_why_impassable() {
cell*& c2 = mi.t;
if(nonAdjacent(cwt.at,c2))
addMessage(XLAT(
geosupport_football() < 2 ?
"You cannot move between the cells without dots here!" :
"You cannot move between the triangular cells here!"
));
else if(againstWind(c2, cwt.at))
addMessage(XLAT(airdist(c2) < 3 ? "The Air Elemental blows you away!" : "You cannot go against the wind!"));
if(nonAdjacent(cwt.at,c2)) {
addMessage(geosupport_football() < 2 ?
XLAT("You cannot move between the cells without dots here!") :
XLAT("You cannot move between the triangular cells here!")
);
}
else if(againstWind(c2, cwt.at)) blowaway_message(c2);
else if(isAlch(c2))
addMessage(XLAT("Wrong color!"));
else if(c2->wall == waRoundTable)
@ -963,8 +972,7 @@ bool pcmove::attack() {
updateHi(itBabyTortoise, items[itBabyTortoise]);
c2->item = itBabyTortoise;
tortoise::babymap[c2] = tortoise::seekbits;
playSound(c2, playergender() ? "heal-princess" : "heal-prince");
addMessage(XLAT(playergender() == GEN_F ? "You are now a tortoise heroine!" : "You are now a tortoise hero!"));
tortoise_hero_message(c2);
achievement_collection(itBabyTortoise);
});
}

View File

@ -491,7 +491,7 @@ EX void showMission() {
if(racing::on)
dialog::addItem(XLAT("racing menu"), 'o');
#if !ISMOBILE
dialog::addItem(XLAT(quitsaves() ? "save" : "quit"), SDLK_F10);
dialog::addItem(quitsaves() ? XLAT("save") : XLAT("quit"), SDLK_F10);
#endif
#if CAP_ANDROIDSHARE
dialog::addItem(XLAT("SHARE"), 's'-96);

View File

@ -2417,7 +2417,7 @@ void moveMonster(monster *m, int delta) {
if(m->type == moTortoise && tortoise::seek() && !tortoise::diff(getBits(m->torigin)) && sqdist(m->pat*C0, pc[i]->pat*C0) < SCALE2) {
items[itBabyTortoise] += 4;
m->dead = true;
addMessage(XLAT(playergender() == GEN_F ? "You are now a tortoise heroine!" : "You are now a tortoise hero!"));
tortoise_hero_message(m->base);
}
for(int i=0; i<players; i++) if(!pc[i]->isVirtual)
if(m->type == moFlailer && curtime >= m->nextshot &&

View File

@ -188,9 +188,10 @@ string get_subname(const string& s, const string& folder) {
/** \brief display the help text for the current slide if texts enabled */
EX void slidehelp() {
if(texts && slides[currentslide].help[0]) {
string slidename = get_slidename(slides[currentslide].name);
gotoHelp(
help =
helptitle(XLAT(get_slidename(slides[currentslide].name)), 0xFF8000) +
helptitle(XLAT(slidename), 0xFF8000) +
XLAT(slides[currentslide].help)
);
presentation(pmHelpEx);
@ -339,11 +340,14 @@ bool handleKeyTour(int sym, int uni) {
canmove = true;
}
}
else addMessage(XLAT(
(vid.shifttarget&1) ?
"Shift-click a location to teleport there."
: "Click a location to teleport there."
));
else {
bool shift = vid.shifttarget & 1;
addMessage(
shift ?
XLAT("Shift-click a location to teleport there.")
: XLAT("Click a location to teleport there.")
);
}
return true;
}
if(NUMBERKEY == '5') {
@ -451,8 +455,11 @@ EX namespace ss {
if(sf == last) continue;
last = sf;
string sfd;
if(sf.back() == '/') sfd = XLAT(sf.substr(0, isize(sf)-1)) + "/ ";
if(sf.back() == '/') {
sfd = sf.substr(0, isize(sf)-1);
sfd = XLAT(sfd) + "/ ";
}
else sfd = XLAT(sf);
dialog::addBoolItem(XLAT(sf), wts == slides && in_folder(slides[currentslide].name, current_folder+sf), slidechars[key++]);

View File

@ -1269,7 +1269,10 @@ EX namespace peace {
}
EX void showMenu() {
string title = XLAT(otherpuzzles ? (explore_other ? "exploration" : "puzzles") : "memory game");
string title =
!otherpuzzles ? XLAT("memory game") :
explore_other ? XLAT("exploration") :
XLAT("puzzles");
dialog::init(title, 0x40A040, 150, 100);
int kind = 0;