diff --git a/achievement.cpp b/achievement.cpp index d5e404b4..05587bb2 100644 --- a/achievement.cpp +++ b/achievement.cpp @@ -83,38 +83,13 @@ vector achievementsReceived; bool wrongMode(char flags) { if(cheater) return true; - if(flags == 'x') return false; - if(nonbitrunc != (flags == '7')) return true; + if(flags == rg::global) return false; + if(nonbitrunc != (flags == rg::bitrunc)) return true; if(gp::on) return true; - switch(flags) { - case 'e': - if(geometry != gEuclid) - return true; - break; - - case 'E': - if(geometry != gSphere && geometry != gElliptic) - return true; - break; - - case 'q': - if(geometry != gQuotient) - return true; - break; + if((geometry != gNormal) != (flags == rg::geometry)) return true; - case 'Q': - if(geometry != gQuotient2) - return true; - break; - - default: - if(geometry != gNormal) - return true; - break; - } - - if(shmup::on != (flags == 's')) return true; + if(shmup::on != (flags == rg::shmup)) return true; if(randomPatternsMode) return true; if(yendor::on) return true; if(peace::on) return true; @@ -122,8 +97,8 @@ bool wrongMode(char flags) { #if CAP_TOUR if(tour::on) return true; #endif - if(chaosmode != (flags == 'C')) return true; - if((numplayers() > 1) != (flags == 'm')) return true; + if(chaosmode != (flags == rg::chaos)) return true; + if((numplayers() > 1) != (flags == rg::multi)) return true; return false; } @@ -173,11 +148,11 @@ void achievement_collection(eItem it, int prevgold, int newgold) { if(randomPatternsMode) return; int q = items[it]; - if(it == itTreat && q == 50) - achievement_gain("HALLOWEEN1", 'E'); + if(it == itTreat && q == 50 && (geometry == gSphere || geometry == gElliptic)) + achievement_gain("HALLOWEEN1", rg::geometry); - if(it == itTreat && q == 100) - achievement_gain("HALLOWEEN2", 'E'); + if(it == itTreat && q == 100 && (geometry == gSphere || geometry == gElliptic)) + achievement_gain("HALLOWEEN2", rg::geometry); if(q == 1) { if(it == itDiamond) achievement_gain("DIAMOND1"); @@ -245,7 +220,7 @@ void achievement_collection(eItem it, int prevgold, int newgold) { // 32 if(it == itHolyGrail) { - if(q == 1) achievement_gain("GRAIL2"), achievement_gain("GRAILH", '7'); + if(q == 1) achievement_gain("GRAIL2"), achievement_gain("GRAILH", rg::bitrunc); if(q == 3) achievement_gain("GRAIL3"); if(q == 8) achievement_gain("GRAIL4"); } @@ -448,7 +423,7 @@ void achievement_collection(eItem it, int prevgold, int newgold) { if(it == itOrbYendor) { achievement_gain("YENDOR2"); if(pureHardcore()) achievement_gain("HARDCORE"); - if(shmup::on) achievement_gain("SHMUP", 's'); + if(shmup::on) achievement_gain("SHMUP", rg::shmup); } } @@ -486,8 +461,8 @@ void achievement_count(const string& s, int current, int prev) { achievement_gain("LIGHTNING2"); if(s == "LIGHTNING" && current-prev >= 10) achievement_gain("LIGHTNING3"); - if(s == "MIRAGE" && current >= 35) - achievement_gain("MIRAGE", 'e'); + if(s == "MIRAGE" && current >= 35 && geometry == gEuclid) + achievement_gain("MIRAGE", rg::geometry); if(s == "ORB" && current >= 10) achievement_gain("ORB3"); if(s == "BUG" && current >= 1000) diff --git a/commandline.cpp b/commandline.cpp index a839771e..1db1ef88 100644 --- a/commandline.cpp +++ b/commandline.cpp @@ -275,29 +275,29 @@ else if(args()[0] == '-' && args()[1] == x && args()[2] == '1') { showstartmenu else if(args()[0] == '-' && args()[1] == x && args()[2] == '0') { showstartmenu = false; if(curphase == 3 && param) {act;} else {PHASE(2); param = false;} } TOGGLE('o', vid.usingGL, switchGL()) - TOGGLE('C', chaosmode, restartGame('C')) - TOGGLE('7', nonbitrunc, restartGame('7')) + TOGGLE('C', chaosmode, restartGame(rg::chaos)) + TOGGLE('7', nonbitrunc, restartGame(rg::bitrunc)) TOGGLE('f', vid.full, switchFullscreen()) - TOGGLE('T', tactic::on, restartGame('t')) - TOGGLE('S', shmup::on, restartGame('s')) + TOGGLE('T', tactic::on, restartGame(rg::tactic)) + TOGGLE('S', shmup::on, restartGame(rg::shmup)) TOGGLE('H', hardcore, switchHardcore()) - TOGGLE('R', randomPatternsMode, restartGame('r')) - TOGGLE('i', inv::on, restartGame('i')) + TOGGLE('R', randomPatternsMode, restartGame(rg::randpattern)) + TOGGLE('i', inv::on, restartGame(rg::inv)) else if(argis("-peace")) { peace::otherpuzzles = true; - if(curphase == 3) restartGame('P'); + if(curphase == 3) restartGame(rg::peace); else peace::on = true; } else if(argis("-pmem")) { peace::otherpuzzles = false; - if(curphase == 3) restartGame('P'); + if(curphase == 3) restartGame(rg::peace); else peace::on = true; } else if(argis("-geo")) { if(curphase == 3) { shift(); targetgeometry = (eGeometry) argi(); - restartGame('g'); + restartGame(rg::geometry); } else { PHASE(2); shift(); geometry = targetgeometry = (eGeometry) argi(); @@ -330,12 +330,12 @@ else if(args()[0] == '-' && args()[1] == x && args()[2] == '0') { showstartmenu callhooks(hooks_tests); else if(argis("-qpar2")) { if(curphase == 3) { - restartGame('g'); + restartGame(rg::geometry); } else { PHASE(2); } - if(geometry == gQuotient2) restartGame('g'); + if(geometry == gQuotient2) restartGame(rg::geometry); int a, b; shift(); sscanf(argcs(), "%d,%d", &a, &b); using namespace fieldpattern; @@ -343,7 +343,7 @@ else if(args()[0] == '-' && args()[1] == x && args()[2] == '0') { showstartmenu fgeomextras[current_extra].current_prime_id = b; enableFieldChange(); if(curphase == 3) { - targetgeometry = gQuotient2; restartGame('g'); + targetgeometry = gQuotient2; restartGame(rg::geometry); } else geometry = gQuotient2; @@ -388,10 +388,10 @@ else if(args()[0] == '-' && args()[1] == x && args()[2] == '0') { showstartmenu } else if(argis("-gp")) { PHASE(3); - if(nonbitrunc) restartGame('7'); + if(nonbitrunc) restartGame(rg::bitrunc); shift(); gp::param.first = argi(); shift(); gp::param.second = argi(); - restartGame('w'); + restartGame(rg::gp); } else if(argis("-P")) { PHASE(2); shift(); diff --git a/config.cpp b/config.cpp index d0ad7897..21ed5172 100644 --- a/config.cpp +++ b/config.cpp @@ -298,21 +298,21 @@ bool have_current_settings() { void resetModes(char leave) { popAllGames(); firstland = laIce; vid.scfg.players = 1; - if(shmup::on != (leave == 's')) restartGame('s'); - if(inv::on != (leave == 'i')) restartGame('i'); - if(chaosmode != (leave == 'C')) restartGame('C'); - if(nonbitrunc != (leave == '7')) restartGame('7'); - if(peace::on != (leave == 'P')) restartGame('P'); + if(shmup::on != (leave == rg::shmup)) restartGame(rg::shmup); + if(inv::on != (leave == rg::inv)) restartGame(rg::inv); + if(chaosmode != (leave == rg::chaos)) restartGame(rg::chaos); + if(nonbitrunc != (leave == rg::bitrunc)) restartGame(rg::bitrunc); + if(peace::on != (leave == rg::peace)) restartGame(rg::peace); #if CAP_TOUR - if(tour::on != (leave == 'T')) restartGame('T'); + if(tour::on != (leave == rg::tour)) restartGame(rg::tour); #endif - if(yendor::on != (leave == 'y')) restartGame('y'); - if(tactic::on != (leave == 't')) restartGame('t'); - if(randomPatternsMode != (leave == 'r')) restartGame('r'); + if(yendor::on != (leave == rg::yendor)) restartGame(rg::yendor); + if(tactic::on != (leave == rg::tactic)) restartGame(rg::tactic); + if(randomPatternsMode != (leave == rg::randpattern)) restartGame(rg::randpattern); - if(geometry != gNormal && leave != 'g') { + if(geometry != gNormal && leave != rg::geometry) { targetgeometry = gNormal; - restartGame('g'); + restartGame(rg::geometry); } pmodel = mdDisk; vid.alpha = 1; vid.scale = 1; diff --git a/game.cpp b/game.cpp index ac46d834..e06171cd 100644 --- a/game.cpp +++ b/game.cpp @@ -4233,7 +4233,8 @@ void moveWorm(cell *c) { else addMessage(XLAT("The sandworm explodes!")); playSound(NULL, "explosion"); - achievement_gain("ZEBRAWORM", 'q'); + if(geometry == gQuotient) + achievement_gain("ZEBRAWORM", rg::geometry); } return; } @@ -6726,7 +6727,7 @@ bool collectItem(cell *c2, bool telekinesis) { achievement_victory(true); if(chaosmode && gold() >= 300 && !chaosAchieved) { - achievement_gain("CHAOS", 'C'); + achievement_gain("CHAOS", rg::chaos); chaosAchieved = true; } diff --git a/geom-exp.cpp b/geom-exp.cpp index 78b15709..546233e4 100644 --- a/geom-exp.cpp +++ b/geom-exp.cpp @@ -71,14 +71,14 @@ void showQuotientConfig() { else if(uni == 'p') nextPrime(gxcur); else if(uni == 'x' || uni == '\n') { - targetgeometry = gxcur.base; restartGame('g'); + targetgeometry = gxcur.base; restartGame(rg::geometry); enableFieldChange(); - targetgeometry = gQuotient2; restartGame('g'); + targetgeometry = gQuotient2; restartGame(rg::geometry); } else if(uni == 'c') { - targetgeometry = gEuclid; restartGame('g'); + targetgeometry = gEuclid; restartGame(rg::geometry); fieldpattern::quotient_field_changed = false; - targetgeometry = gQuotient2; restartGame('g'); + targetgeometry = gQuotient2; restartGame(rg::geometry); } else if(doexiton(sym, uni)) popScreen(); @@ -184,22 +184,22 @@ void showTorusConfig() { else if(uni == 't') torus_bitrunc = !torus_bitrunc; else if((uni == 'a' || uni == '\n') && torusconfig::newqty >= 3 && valid) { - targetgeometry = gNormal; restartGame('g', false, true); + targetgeometry = gNormal; restartGame(rg::geometry, false, true); torusconfig::torus_mode = torusconfig::newmode; torusconfig::qty = torusconfig::newqty; torusconfig::dy = torusconfig::newdy; torusconfig::sdx = torusconfig::newsdx; torusconfig::sdy = torusconfig::newsdy; torusconfig::activate(); - if((square && torus_bitrunc) != nonbitrunc) restartGame('7', false, true); - targetgeometry = gTorus; restartGame('g', false, true); + if((square && torus_bitrunc) != nonbitrunc) restartGame(rg::bitrunc, false, true); + targetgeometry = gTorus; restartGame(rg::geometry, false, true); } else if(uni == 'c') { - targetgeometry = gEuclid; restartGame('g', false, true); + targetgeometry = gEuclid; restartGame(rg::geometry, false, true); torusconfig::torus_mode = torusconfig::tmSingle; torusconfig::qty = torusconfig::def_qty; torusconfig::dy = torusconfig::def_dy; - targetgeometry = gTorus; restartGame('g', false, true); + targetgeometry = gTorus; restartGame(rg::geometry, false, true); } else if(uni == 'z') editScale(); #if CAP_RUG @@ -329,7 +329,7 @@ void showEuclideanMenu() { dialog::handleNavigation(sym, uni); if(uni >= 'a' && uni < 'a'+gGUARD) { targetgeometry = eGeometry(uni - 'a'); - restartGame(geometry == targetgeometry ? 0 : 'g'); + restartGame(geometry == targetgeometry ? rg::nothing : rg::geometry); pushScreen(showEuclideanMenu); } else if(uni == 't') { @@ -337,7 +337,7 @@ void showEuclideanMenu() { else if(S3 == 3) gp::configure(); else { - restartGame('7'); + restartGame(rg::bitrunc); pushScreen(showEuclideanMenu); } } @@ -423,7 +423,7 @@ void showEuclideanMenu() { } else if(uni == '1') { if(chaosUnlocked) { - restartGame('C'); + restartGame(rg::chaos); pushScreen(showEuclideanMenu); } } @@ -431,7 +431,7 @@ void showEuclideanMenu() { eLand nland = landlist[lid]; if(landvisited[nland]) { specialland = nland; - restartGame(tactic::on ? 't' : 0); + restartGame(tactic::on ? rg::tactic : rg::nothing); pushScreen(showEuclideanMenu); } } diff --git a/goldberg.cpp b/goldberg.cpp index 4b4c423b..4d38472e 100644 --- a/goldberg.cpp +++ b/goldberg.cpp @@ -407,17 +407,17 @@ namespace gp { param = loc(x, y); auto g = screens; if(x == 1 && y == 0) { - if(gp::on) restartGame('7'); - if(!nonbitrunc) restartGame('7'); + if(gp::on) restartGame(rg::bitrunc); + if(!nonbitrunc) restartGame(rg::bitrunc); } else if(x == 1 && y == 1) { - if(gp::on) restartGame('7'); - if(nonbitrunc) restartGame('7'); + if(gp::on) restartGame(rg::bitrunc); + if(nonbitrunc) restartGame(rg::bitrunc); } else { - if(nonbitrunc) restartGame('7'); + if(nonbitrunc) restartGame(rg::bitrunc); param = loc(x, y); - restartGame('w'); + restartGame(rg::gp); } screens = g; } diff --git a/hyper.h b/hyper.h index aed796b7..5240e3e4 100644 --- a/hyper.h +++ b/hyper.h @@ -362,7 +362,30 @@ typedef int cellfunction(cell*); int towerval(cell *c, cellfunction* cf = &coastvalEdge); #define HRANDMAX 0x7FFFFFFF int hrandpos(); // 0 to HRANDMAX + +namespace rg { + // possible parameters e.g. for restartGame and wrongmode + static const char nothing = 0; + static const char peace = 'P'; + static const char inv = 'i'; + static const char chaos = 'C'; + static const char tactic = 't'; + static const char tour = 'T'; + static const char geometry = 'g'; // change targetgeometry first + static const char bitrunc = '7'; + static const char gp = 'w'; // change gp::param first + static const char yendor = 'y'; + static const char shmup = 's'; + static const char randpattern = 'r'; + static const char princess = 'p'; + + // wrongmode only -- marks 'global' achievements not related to the current mode + static const char global = 'x'; + // wrongmode only -- change vid.scfg.players then restartGame(rg::nothing) instead + static const char multi = 'm'; + } void restartGame(char switchWhat = 0, bool push = false, bool keep_screens = false); + int landMultiplier(eLand l); eItem treasureType(eLand l); void buildBarrier(cell *c, int d, eLand l = laNone); diff --git a/hyperweb.cpp b/hyperweb.cpp index 712ece0e..050ff6e9 100644 --- a/hyperweb.cpp +++ b/hyperweb.cpp @@ -89,7 +89,7 @@ void showDemo() { } else if(sym == 'f') { firstland = laIce; - if(tactic::on) restartGame('t'); + if(tactic::on) restartGame(rg::tactic); else restartGame(); } #if CAP_TOUR @@ -100,17 +100,17 @@ void showDemo() { #endif else if(sym == 't') { firstland = laTemple; - if(!tactic::on) restartGame('t'); + if(!tactic::on) restartGame(rg::tactic); else restartGame(); } else if(sym == 'l') { firstland = laStorms; - if(!tactic::on) restartGame('t'); + if(!tactic::on) restartGame(rg::tactic); else restartGame(); } else if(sym == 'b') { firstland = laBurial; - if(!tactic::on) restartGame('t'); + if(!tactic::on) restartGame(rg::tactic); else restartGame(); items[itOrbSword] = 60; } diff --git a/kohonen.cpp b/kohonen.cpp index 8c60fede..90a6774a 100644 --- a/kohonen.cpp +++ b/kohonen.cpp @@ -529,9 +529,9 @@ void sominit(int initto) { /* if(geometry != gQuotient1) { targetGeometry = gQuotient1; - restartGame('g'); + restartGame(rg::geometry); } - if(!nonbitrunc) restartGame('7'); */ + if(!nonbitrunc) restartGame(rg::bitrunc); */ printf("Initializing SOM (1)\n"); diff --git a/mapeditor.cpp b/mapeditor.cpp index f0288be6..d440b00e 100644 --- a/mapeditor.cpp +++ b/mapeditor.cpp @@ -1310,8 +1310,8 @@ namespace mapeditor { int tg, nt, wp; fscanf(f, "%d%d%d%d\n", &tg, &nt, &wp, &patterns::subpattern_flags); patterns::whichPattern = wp; - if(tg != geometry) { targetgeometry = eGeometry(tg); restartGame('g', 0, true); } - if(nt != nonbitrunc) { restartGame('7', 0, true); } + if(tg != geometry) { targetgeometry = eGeometry(tg); restartGame(rg::geometry, 0, true); } + if(nt != nonbitrunc) { restartGame(rg::bitrunc, 0, true); } } while(true) { diff --git a/menus.cpp b/menus.cpp index b21349d7..6defd764 100644 --- a/menus.cpp +++ b/menus.cpp @@ -514,7 +514,7 @@ void showChangeMode() { else if(xuni == 'p') pushScreen(peace::showMenu); else if(xuni == 'i') { - restartGame('i'); + restartGame(rg::inv); } #if CAP_TOUR else if(uni == 'T') { @@ -522,14 +522,14 @@ void showChangeMode() { } #endif else if(uni == 'C') { - if(chaosUnlocked) restartGame('C'); + if(chaosUnlocked) restartGame(rg::chaos); if(chaosmode) help_nochaos(); } else if(xuni == 'P') { if(!princess::everSaved) addMessage(XLAT("Save %the1 first to unlock this challenge!", moPrincess)); else - restartGame('p'); + restartGame(rg::peace); } #if CAP_EDIT else if(xuni == 'm') { @@ -545,7 +545,7 @@ void showChangeMode() { #endif else if(xuni == 's') { #if ISMOBILE==1 - restartGame('s'); + restartGame(rg::shmup); #else multi::shmupcfg = shmup::on; pushScreen(shmup::showShmupConfig); @@ -555,7 +555,7 @@ void showChangeMode() { switchHardcore(); else if(xuni == 'r') { firstland = laIce; - restartGame('r'); + restartGame(rg::randpattern); } else if(doexiton(sym, uni)) popScreen(); @@ -758,7 +758,7 @@ void showStartMenu() { if(!sphere) { specialland = laHalloween; targetgeometry = gSphere; - restartGame('g'); + restartGame(rg::geometry); vid.alpha = 999; vid.scale = 998; } diff --git a/pattern2.cpp b/pattern2.cpp index b07c8cb6..bf3574bb 100644 --- a/pattern2.cpp +++ b/pattern2.cpp @@ -1531,8 +1531,8 @@ namespace patterns { auto old_tstate_max = texture::config.tstate_max; #endif auto &g = cpatterns[cgroup].geometries[uni - 'a']; - if(g.geo != geometry) { targetgeometry = g.geo; restartGame('g', false, true); } - if(g.nonbitru != nonbitrunc) restartGame('7', false, true); + if(g.geo != geometry) { targetgeometry = g.geo; restartGame(rg::geometry, false, true); } + if(g.nonbitru != nonbitrunc) restartGame(rg::bitrunc, false, true); whichPattern = g.whichPattern; subpattern_flags = g.subpattern_flags; #if CAP_TEXTURE diff --git a/quit.cpp b/quit.cpp index 408b71a8..07fb3a28 100644 --- a/quit.cpp +++ b/quit.cpp @@ -179,7 +179,7 @@ hint hints[] = { }, []() { #if CAP_INV - restartGame('i'); + restartGame(rg::inv); #endif } }, @@ -273,7 +273,7 @@ hint hints[] = { resetModes(); specialland = laHalloween; targetgeometry = gSphere; - restartGame('g'); + restartGame(rg::geometry); vid.alpha = 999; vid.scale = 998; } diff --git a/rogueviz.cpp b/rogueviz.cpp index a7d1c7db..a984c012 100644 --- a/rogueviz.cpp +++ b/rogueviz.cpp @@ -1340,7 +1340,7 @@ void init() { #if !ISWEB mapeditor::drawplayer = false; firstland = specialland = laCanvas; - if(!shmup::on) restartGame('s'); + if(!shmup::on) restartGame(rg::shmup); else restartGame(); #else firstland = specialland = laCanvas; @@ -1834,7 +1834,7 @@ slide rvslides[] = { if(mode == pmStartAll) firstland = specialland = laPalace; if(mode == 4) { tour::slides = default_slides; - while(tour::on) restartGame('T', false); + while(tour::on) restartGame(rg::tour, false); firstland = specialland = laIce; tour::start(); } @@ -1959,7 +1959,7 @@ slide rvslides[] = { "Press '5' to leave the presentation.", [] (presmode mode) { firstland = specialland = laIce; - if(mode == 4) restartGame('T'); + if(mode == 4) restartGame(rg::tour); } } }; diff --git a/shmup.cpp b/shmup.cpp index 09e46164..4bd05d5c 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -407,7 +407,7 @@ help += XLAT("This menu can be also used to configure keys.\n\n"); } else if(doexiton(sym, uni)) { popScreen(); - if(shmup::on != shmupcfg) { restartGame('s'); resetScores(); } + if(shmup::on != shmupcfg) { restartGame(rg::shmup); resetScores(); } else if(vid.scfg.players != players) { restartGame(); resetScores(); } } } diff --git a/system.cpp b/system.cpp index e07cafd1..f4ba3fe0 100644 --- a/system.cpp +++ b/system.cpp @@ -1078,18 +1078,18 @@ void restartGame(char switchWhat, bool push, bool keep_screens) { // items[itGreenStone] = 100; clearMemory(); } - if(switchWhat == 'P') { + if(switchWhat == rg::peace) { peace::on = !peace::on; tactic::on = yendor::on = princess::challenge = randomPatternsMode = inv::on = false; } - if(switchWhat == 'i') { + if(switchWhat == rg::inv) { inv::on = !inv::on; if(tactic::on) firstland = laIce; tactic::on = yendor::on = princess::challenge = randomPatternsMode = peace::on = false; } - if(switchWhat == 'C') { + if(switchWhat == rg::chaos) { if(euclid || sphere || quotient) geometry = gNormal; if(tactic::on) firstland = laIce; @@ -1098,7 +1098,7 @@ void restartGame(char switchWhat, bool push, bool keep_screens) { chaosmode = !chaosmode; } #if CAP_TOUR - if(switchWhat == 'T') { + if(switchWhat == rg::tour) { geometry = gNormal; yendor::on = tactic::on = princess::challenge = peace::on = inv::on = false; chaosmode = nonbitrunc = randomPatternsMode = false; @@ -1107,10 +1107,10 @@ void restartGame(char switchWhat, bool push, bool keep_screens) { tour::on = !tour::on; } #endif - if(switchWhat == '7' || switchWhat == 'w') { + if(switchWhat == rg::bitrunc || switchWhat == rg::gp) { if(euclid6) geometry = gNormal; nonbitrunc = !nonbitrunc; - gp::on = (switchWhat == 'w'); + gp::on = (switchWhat == rg::gp); resetGeometry(); #if CAP_TEXTURE if(texture::config.tstate == texture::tsActive) @@ -1119,7 +1119,7 @@ void restartGame(char switchWhat, bool push, bool keep_screens) { texture::config.tstate = texture::tsAdjusting; #endif } - if(switchWhat == 'g') { + if(switchWhat == rg::geometry) { if(geometry == targetgeometry) geometry = gNormal; else geometry = targetgeometry; if(chaosmode && (euclid || sphere || quotient)) chaosmode = false; @@ -1134,7 +1134,7 @@ void restartGame(char switchWhat, bool push, bool keep_screens) { texture::config.tstate = texture::tsAdjusting; #endif } - if(switchWhat == 'y') { + if(switchWhat == rg::yendor) { yendor::on = !yendor::on; tactic::on = false; peace::on = false; @@ -1144,7 +1144,7 @@ void restartGame(char switchWhat, bool push, bool keep_screens) { chaosmode = false; if(!yendor::on) firstland = laIce; } - if(switchWhat == 't') { + if(switchWhat == rg::tactic) { tactic::on = !tactic::on; yendor::on = false; peace::on = false; @@ -1154,11 +1154,11 @@ void restartGame(char switchWhat, bool push, bool keep_screens) { chaosmode = false; if(!tactic::on) firstland = laIce; } - if(switchWhat == 's') { + if(switchWhat == rg::shmup) { shmup::on = !shmup::on; princess::challenge = false; } - if(switchWhat == 'r') { + if(switchWhat == rg::randpattern) { randomPatternsMode = !randomPatternsMode; tactic::on = false; yendor::on = false; @@ -1166,7 +1166,7 @@ void restartGame(char switchWhat, bool push, bool keep_screens) { inv::on = false; princess::challenge = false; } - if(switchWhat == 'p') { + if(switchWhat == rg::princess) { princess::challenge = !princess::challenge; firstland = princess::challenge ? laPalace : laIce; shmup::on = false; diff --git a/textures.cpp b/textures.cpp index 769f2c0c..829e9cf2 100644 --- a/textures.cpp +++ b/textures.cpp @@ -861,12 +861,12 @@ bool texture_config::load() { dynamicval d2(patterns::subpattern_flags, patterns::subpattern_flags); if(targetgeometry != geometry) { - restartGame('g'); + restartGame(rg::geometry); return config.load(); } if(nonbitrunc != target_nonbitru) { - restartGame('7'); + restartGame(rg::bitrunc); } } diff --git a/tour.cpp b/tour.cpp index 23949682..6b9ec2f8 100644 --- a/tour.cpp +++ b/tour.cpp @@ -150,7 +150,7 @@ bool handleKeyTour(int sym, int uni) { if(sym == '1') targetgeometry = gSphere; if(sym == '2') targetgeometry = gEuclid; firstland = specialland = cwt.c->land; - restartGame(sym == '3' ? '7' : 'g', true); + restartGame(sym == '3' ? rg::bitrunc : rg::geometry, true); presentation(pmGeometryStart); return true; } @@ -258,7 +258,7 @@ namespace ss { presentation(pmGeometryReset); } if(slides != wts) { - while(tour::on) restartGame('T', false); + while(tour::on) restartGame(rg::tour, false); slides = wts; tour::start(); } @@ -292,7 +292,7 @@ void start() { presentation(pmStop); firstland = specialland = laIce; } - restartGame('T'); + restartGame(rg::tour); if(tour::on) { slidehelp(); presentation(pmStart); @@ -345,7 +345,7 @@ slide default_slides[] = { "as an introduction to hyperbolic geometry."; if(mode == 4) { slides = rogueviz::rvtour::rvslides; - while(tour::on) restartGame('T', false); + while(tour::on) restartGame(rg::tour, false); tour::start(); } #endif @@ -742,7 +742,7 @@ slide default_slides[] = { [] (presmode mode) { if(mode == 1) { firstland = cwt.c->land; - restartGame('s', true); + restartGame(rg::shmup, true); } if(mode == 3) { shmup::clearMonsters(); @@ -759,7 +759,7 @@ slide default_slides[] = { "Press '5' to leave the tutorial mode.", [] (presmode mode) { slidecommand = "leave the Tutorial"; - if(mode == 4) restartGame('T'); + if(mode == 4) restartGame(rg::tour); } } }; diff --git a/yendor.cpp b/yendor.cpp index 0feeec62..bcd20cf8 100644 --- a/yendor.cpp +++ b/yendor.cpp @@ -98,9 +98,9 @@ namespace yendor { if(tscore > tscorelast) { tscorelast = tscore; - if(tscore >= 1000) achievement_gain("YENDC1", 'x'); - if(tscore >= 5000) achievement_gain("YENDC2", 'x'); - if(tscore >= 15000) achievement_gain("YENDC3", 'x'); + if(tscore >= 1000) achievement_gain("YENDC1", rg::global); + if(tscore >= 5000) achievement_gain("YENDC2", rg::global); + if(tscore >= 15000) achievement_gain("YENDC3", rg::global); } achievement_score(LB_YENDOR_CHALLENGE, tscore); @@ -504,13 +504,13 @@ namespace yendor { if(new_challenge && new_challenge < YENDORLEVELS) { if(levelUnlocked(new_challenge) || autocheat) { challenge = new_challenge; - restartGame(yendor::on ? 0 : 'y'); + restartGame(yendor::on ? 0 : rg::yendor); } else addMessage("Collect 10 treasures in various lands to unlock the challenges there"); } else if(uni == '0') { - if(yendor::on) restartGame('y'); + if(yendor::on) restartGame(rg::yendor); } else if(uni == '1') easy = !easy; else if(uni == '2' || sym == SDLK_F1) gotoHelp(chelp); @@ -742,11 +742,11 @@ namespace tactic { keyhandler = [] (int sym, int uni) { if(uni >= 1000 && uni < 1000 + size(landlist)) { firstland = specialland = landlist[uni - 1000]; - restartGame(tactic::on ? 0 : 't'); + restartGame(tactic::on ? 0 : rg::tactic); } else if(uni == '0') { firstland = laIce; - if(tactic::on) restartGame('t'); + if(tactic::on) restartGame(rg::tactic); else popScreen(); } @@ -1074,12 +1074,12 @@ namespace peace { if(uni == '1') otherpuzzles = !otherpuzzles; else if(uni >= 'a' && uni < 'a' + qty) { specialland = levellist[uni - 'a']; - restartGame(peace::on ? 0 : 'P'); + restartGame(peace::on ? 0 : rg::peace); } else if(uni == '2') { hint = !hint; popScreen(); } else if(uni == '0') { firstland = laIce; - if(peace::on) restartGame('P'); + if(peace::on) restartGame(rg::peace); } else if(uni == 'h' || sym == SDLK_F1) gotoHelp(chelp); else if(doexiton(sym, uni)) popScreen();