more XLAT refactoring, and preparation for gentrans.cpp

This commit is contained in:
Zeno Rogue 2021-05-23 15:47:45 +02:00
parent 087c815372
commit 8f4a0935b9
11 changed files with 37 additions and 34 deletions

View File

@ -1841,8 +1841,6 @@ EX void projectionDialog() {
XLAT("HyperRogue uses the Minkowski hyperboloid model internally. " XLAT("HyperRogue uses the Minkowski hyperboloid model internally. "
"Klein and Poincaré models can be obtained by perspective, " "Klein and Poincaré models can be obtained by perspective, "
"and the Gans model is obtained by orthogonal projection. " "and the Gans model is obtained by orthogonal projection. "
// "This parameter specifies the distance from the hyperboloid center "
// "to the eye. "
"See also the conformal mode (in the special modes menu) " "See also the conformal mode (in the special modes menu) "
"for more models.")); "for more models."));
dialog::extra_options = [] () { dialog::extra_options = [] () {
@ -2222,7 +2220,7 @@ EX void show3D() {
else if(GDIM == 2 && !spatial_graphics) else if(GDIM == 2 && !spatial_graphics)
dialog::addInfo(XLAT("set 3D monsters or walls in basic config first")); dialog::addInfo(XLAT("set 3D monsters or walls in basic config first"));
else if(geom3::invalid != "") else if(geom3::invalid != "")
dialog::addInfo(XLAT("error: "+geom3::invalid), 0xC00000); dialog::addInfo(XLAT("error: ")+geom3::invalid, 0xC00000);
else else
dialog::addInfo(XLAT("parameters set correctly")); dialog::addInfo(XLAT("parameters set correctly"));
dialog::addBreak(50); dialog::addBreak(50);

View File

@ -409,12 +409,12 @@ string expansion_analyzer::approximate_descendants(int d, int max_length) {
} }
enum eDistanceFrom { dfPlayer, dfStart, dfWorld }; enum eDistanceFrom { dfPlayer, dfStart, dfWorld };
string dfnames[3] = { "player", "start", "land" }; EX string dfnames[3] = { "player", "start", "land" };
eDistanceFrom distance_from = dfPlayer; eDistanceFrom distance_from = dfPlayer;
enum eNumberCoding { ncNone, ncDistance, ncType, ncDebug }; enum eNumberCoding { ncNone, ncDistance, ncType, ncDebug };
string ncnames[4] = { "NO", "distance", "type", "debug" }; EX string ncnames[4] = { "NO", "distance", "type", "debug" };
eNumberCoding number_coding = ncDistance; eNumberCoding number_coding = ncDistance;
bool mod_allowed() { bool mod_allowed() {

View File

@ -261,7 +261,7 @@ EX geometry_filter gf_quotient = {"interesting quotient spaces", [] {
return forced_quotient() && !elliptic; return forced_quotient() && !elliptic;
}}; }};
vector<geometry_filter*> available_filters = { &gf_hyperbolic, &gf_spherical, &gf_euclidean, &gf_other, &gf_regular_2d, &gf_regular_3d, &gf_quotient }; EX vector<geometry_filter*> available_filters = { &gf_hyperbolic, &gf_spherical, &gf_euclidean, &gf_other, &gf_regular_2d, &gf_regular_3d, &gf_quotient };
void ge_select_filter() { void ge_select_filter() {
cmode = sm::SIDE | sm::MAYDARK; cmode = sm::SIDE | sm::MAYDARK;
@ -674,7 +674,7 @@ EX void menuitem_binary_width(char key) {
} }
EX void menuitem_nilwidth(char key) { EX void menuitem_nilwidth(char key) {
dialog::addSelItem(XLAT("nil width"), fts(nilv::nilwidth), key); dialog::addSelItem(XLAT("Nil width"), fts(nilv::nilwidth), key);
dialog::add_action([] { dialog::add_action([] {
dialog::editNumber(nilv::nilwidth, 0.01, 2, 0.1, 1, XLAT("Nil width"), ""); dialog::editNumber(nilv::nilwidth, 0.01, 2, 0.1, 1, XLAT("Nil width"), "");
dialog::reaction = ray::reset_raycaster; dialog::reaction = ray::reset_raycaster;

View File

@ -820,16 +820,16 @@ EX namespace geom3 {
pconf.alpha = tan_auto(vid.depth) / tan_auto(vid.camera); pconf.alpha = tan_auto(vid.depth) / tan_auto(vid.camera);
else if(vid.tc_depth < vid.tc_alpha && vid.tc_depth < vid.tc_camera) { else if(vid.tc_depth < vid.tc_alpha && vid.tc_depth < vid.tc_camera) {
ld v = pconf.alpha * tan_auto(vid.camera); ld v = pconf.alpha * tan_auto(vid.camera);
if(hyperbolic && (v<1e-6-12 || v>1-1e-12)) invalid = "cannot adjust depth", vid.depth = vid.camera; if(hyperbolic && (v<1e-6-12 || v>1-1e-12)) invalid = XLAT("cannot adjust depth"), vid.depth = vid.camera;
else vid.depth = atan_auto(v); else vid.depth = atan_auto(v);
} }
else { else {
ld v = tan_auto(vid.depth) / pconf.alpha; ld v = tan_auto(vid.depth) / pconf.alpha;
if(hyperbolic && (v<1e-12-1 || v>1-1e-12)) invalid = "cannot adjust camera", vid.camera = vid.depth; if(hyperbolic && (v<1e-12-1 || v>1-1e-12)) invalid = XLAT("cannot adjust camera"), vid.camera = vid.depth;
else vid.camera = atan_auto(v); else vid.camera = atan_auto(v);
} }
if(fabs(pconf.alpha) < 1e-6) invalid = "does not work with perfect Klein"; if(fabs(pconf.alpha) < 1e-6) invalid = XLAT("does not work with perfect Klein");
if(invalid != "") { if(invalid != "") {
INFDEEP = .7; INFDEEP = .7;

View File

@ -3215,7 +3215,7 @@ EX colortable distcolors = {
0xA0A000, 0xA000A0, 0x00A0A0, 0xFFD500 0xA0A000, 0xA000A0, 0x00A0A0, 0xFFD500
}; };
const char* minetexts[8] = { EX const char* minetexts[8] = {
"No mines next to you.", "No mines next to you.",
"A mine is next to you!", "A mine is next to you!",
"Two mines next to you!", "Two mines next to you!",

View File

@ -112,6 +112,10 @@ string choose4(int g, string a, string b, string c, string d) {
set<string> warnshown; set<string> warnshown;
EX bool translation_exists(const string& x) {
return findInHashTable(x, all_sentences);
}
void basicrep(string& x) { void basicrep(string& x) {
#if CAP_TRANS #if CAP_TRANS

View File

@ -235,16 +235,15 @@ EX void showMainMenu() {
#if ISMOBILE #if ISMOBILE
dialog::addItem(XLAT("visit the website"), 'q'); dialog::addItem(XLAT("visit the website"), 'q');
#else #else
q = quitsaves() ? "save" : "quit"; q = quitsaves() ? XLAT("save the game") : XLAT("quit the game");
q = q + " the game"; dialog::addItem(q, 'q');
dialog::addItem(XLAT(q), 'q');
#endif #endif
if(canmove) if(canmove)
q = "review your quest"; q = XLAT("review your quest");
else else
q = "game over screen"; q = XLAT("game over screen");
dialog::addItem(XLAT(q), SDLK_ESCAPE); dialog::addItem(q, SDLK_ESCAPE);
dialog::addItem(get_o_key().first, 'o'); dialog::addItem(get_o_key().first, 'o');
if(inv::on) if(inv::on)
@ -260,11 +259,11 @@ EX void showMainMenu() {
dialog::addItem("SHARE", 's'-96); dialog::addItem("SHARE", 's'-96);
#endif #endif
if(!canmove) q = "review the scene"; if(!canmove) q = XLAT("review the scene");
else if(turncount > 0) q = "continue game"; else if(turncount > 0) q = XLAT("continue game");
else q = "play the game!"; else q = XLAT("play the game!");
dialog::addItem(XLAT(q), ' '); dialog::addItem(q, ' ');
dialog::display(); dialog::display();
keyhandler = [] (int sym, int uni) { keyhandler = [] (int sym, int uni) {
@ -330,6 +329,10 @@ EX void editScale() {
dialog::scaleSinh(); dialog::scaleSinh();
} }
EX const char *wdmodes[7] = {"ASCII", "black", "plain", "Escher", "plain/3D", "Escher/3D", "ASCII/3D"};
EX const char *mdmodes[6] = {"ASCII", "items only", "items and monsters", "3D", "?", "?"};
EX const char *hlmodes[3] = {"press Alt", "highlight", "super-highlight"};
EX void showGraphQuickKeys() { EX void showGraphQuickKeys() {
cmode = sm::SIDE | sm::MAYDARK; cmode = sm::SIDE | sm::MAYDARK;
gamescreen(0); gamescreen(0);
@ -338,13 +341,10 @@ EX void showGraphQuickKeys() {
dialog::addItem("quick projection", '1'); dialog::addItem("quick projection", '1');
const char *wdmodes[7] = {"ASCII", "black", "plain", "Escher", "plain/3D", "Escher/3D", "ASCII/3D"};
dialog::addSelItem(XLAT("wall display mode"), XLAT(wdmodes[vid.wallmode]), '5'); dialog::addSelItem(XLAT("wall display mode"), XLAT(wdmodes[vid.wallmode]), '5');
const char *mdmodes[6] = {"ASCII", "items only", "items and monsters", "3D", "?", "?"};
dialog::addSelItem(XLAT("monster display mode"), XLAT(mdmodes[vid.monmode]), '8'); dialog::addSelItem(XLAT("monster display mode"), XLAT(mdmodes[vid.monmode]), '8');
const char *hlmodes[3] = {"press Alt", "highlight", "super-highlight"};
dialog::addSelItem(XLAT("highlight stuff"), XLAT(hlmodes[vid.highlightmode]), 508); dialog::addSelItem(XLAT("highlight stuff"), XLAT(hlmodes[vid.highlightmode]), 508);
dialog::addBoolItem(XLAT("draw the grid"), (vid.grid), '6'); dialog::addBoolItem(XLAT("draw the grid"), (vid.grid), '6');

View File

@ -115,7 +115,7 @@ EX namespace multi {
#define SHMUPAXES_CUR ((SHMUPAXES_BASE) + 4 * playercfg) #define SHMUPAXES_CUR ((SHMUPAXES_BASE) + 4 * playercfg)
#endif #endif
const char* axemodes[SHMUPAXES] = { EX const char* axemodes[SHMUPAXES] = {
"do nothing", "do nothing",
"rotate view", "rotate view",
"panning X", "panning X",
@ -150,7 +150,7 @@ const char* axemodes[SHMUPAXES] = {
"player 7 spin" "player 7 spin"
}; };
const char* axemodes3[4] = { EX const char* axemodes3[4] = {
"do nothing", "do nothing",
"camera forward", "camera forward",
"camera rotate X", "camera rotate X",
@ -378,6 +378,8 @@ struct joy_configurer {
}; };
#endif #endif
EX const char *axmodes[7] = {"OFF", "auto", "light", "heavy", "arrows", "WASD keys", "VI keys"};
struct shmup_configurer { struct shmup_configurer {
void operator()() { void operator()() {
@ -418,7 +420,6 @@ struct shmup_configurer {
dialog::addItem(XLAT("configure player 5"), '5'); dialog::addItem(XLAT("configure player 5"), '5');
else if(!shmup::on && !multi::alwaysuse) { else if(!shmup::on && !multi::alwaysuse) {
if(GDIM == 2) { if(GDIM == 2) {
const char *axmodes[7] = {"OFF", "auto", "light", "heavy", "arrows", "WASD keys", "VI keys"};
dialog::addSelItem(XLAT("help for keyboard users"), XLAT(axmodes[vid.axes]), 'h'); dialog::addSelItem(XLAT("help for keyboard users"), XLAT(axmodes[vid.axes]), 'h');
dialog::add_action([] {vid.axes += 70 + (shiftmul > 0 ? 1 : -1); vid.axes %= 7; } ); dialog::add_action([] {vid.axes += 70 + (shiftmul > 0 ? 1 : -1); vid.axes %= 7; } );
} }

View File

@ -189,7 +189,7 @@ const orbinfo& getNativityOrbInfo(eItem orb) {
return oi; return oi;
} }
EX string olrDescriptions[] = { EX string olrDescriptions[18] = {
"forbidden to find in %the1", "forbidden to find in %the1",
"too dangerous to use in %the1", "too dangerous to use in %the1",
"useless in %the1", "useless in %the1",

View File

@ -121,13 +121,13 @@ EX hint hints[] = {
0, 0,
[]() { return in_full_game(); }, []() { return in_full_game(); },
[]() { []() {
dialog::addInfo(XLAT( dialog::addInfo(
#if ISMOBILE #if ISMOBILE
"The 'world overview' shows all the lands in HyperRogue." XLAT("The 'world overview' shows all the lands in HyperRogue.")
#else #else
"Press 'o' to see all the lands in HyperRogue." XLAT("Press 'o' to see all the lands in HyperRogue.")
#endif #endif
)); );
dialog::addBreak(50); dialog::addBreak(50);
dialog::addItem(XLAT("world overview"), 'z'); dialog::addItem(XLAT("world overview"), 'z');
}, },

View File

@ -729,7 +729,7 @@ enum eMagicParameter {
mpMAX mpMAX
}; };
vector<string> mpnames = { EX vector<string> mpnames = {
"affect model scale", "affect model scale",
"affect model projection", "affect model projection",
"affect model central point", "affect model central point",