From cc0356038978d1e80a6abf7a9f609c1259628993 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 25 Jul 2017 00:21:36 +0200 Subject: [PATCH] 10.0d --- achievement.cpp | 11 +++++-- basegraph.cpp | 6 ++-- complex.cpp | 4 +-- config.cpp | 81 +++++++++++++++++++++++++++++++++++++++++++------ control.cpp | 2 +- game.cpp | 17 ++++++----- graph.cpp | 8 ++--- help.cpp | 9 ++---- hyper.h | 6 ++-- init.cpp | 6 ++-- landgen.cpp | 6 ++-- language-pl.cpp | 9 +++++- polygons.cpp | 7 ++++- quit.cpp | 2 +- rug.cpp | 2 +- shmup.cpp | 2 ++ system.cpp | 18 ++++++++--- tour.cpp | 14 ++++----- 18 files changed, 149 insertions(+), 61 deletions(-) diff --git a/achievement.cpp b/achievement.cpp index 0c15e383..ece2f8a8 100644 --- a/achievement.cpp +++ b/achievement.cpp @@ -1,7 +1,7 @@ // Hyperbolic Rogue -- achievements // Copyright (C) 2011-2016 Zeno Rogue, see 'hyper.cpp' for details -#define NUMLEADER 70 +#define NUMLEADER 72 #define SCORE_UNKNOWN (-1) #define NO_SCORE_YET (-2) @@ -60,6 +60,8 @@ const char* leadernames[NUMLEADER] = { "Green Grass", // 67 "Spinel", // 68 "Orb Strategy Score", // 69 + "Real time to Win-OS", // 70 + "Turns to Win-OS", // 71 }; #define LB_STATISTICS 62 @@ -633,8 +635,11 @@ void achievement_victory(bool hyper) { int t = savetime + time(NULL) - timerstart; - int ih1 = hyper ? 15 : shmup::on ? (numplayers() > 1 ? 45 : 29) : 13; - int ih2 = hyper ? 16 : shmup::on ? 30 : 14; + if(hyper && shmup::on) return; + if(hyper && inv::on) return; + + int ih1 = hyper ? 15 : inv::on ? 70 : shmup::on ? (numplayers() > 1 ? 45 : 29) : 13; + int ih2 = hyper ? 16 : inv::on ? 71 : shmup::on ? 30 : 14; int improved = 0; if(currentscore[ih1] == NO_SCORE_YET || currentscore[ih2] == NO_SCORE_YET) diff --git a/basegraph.cpp b/basegraph.cpp index 8d168c7b..36673bad 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -1,6 +1,6 @@ -int backcolor = 0; -int bordcolor = 0; -int forecolor = 0xFFFFFF; +unsigned backcolor = 0; +unsigned bordcolor = 0; +unsigned forecolor = 0xFFFFFF; int utfsize(char c) { unsigned char cu = c; diff --git a/complex.cpp b/complex.cpp index 029ea2b3..4fb4c8af 100644 --- a/complex.cpp +++ b/complex.cpp @@ -677,7 +677,7 @@ namespace princess { if(msgid == 0 && d < 20 && inpalace) { addMessage(XLAT("%The1 kisses you, and begs you to bring %him1 away from here.", m)); } - else if(msgid == 1 && d >= 20 && inpalace) { + else if(msgid == 1 && d >= 20 && inpalace && !peace::on) { if(m == moPrincess) addMessage(XLAT("\"I want my revenge. Stun a guard and leave him for me!\"", m)); else @@ -689,7 +689,7 @@ namespace princess { else if(msgid == 3 && !inpalace) { addMessage(XLAT("%The1 kisses you, and thanks you for saving %him1.", m)); } - else if(msgid == 4 && !inpalace && m == moPrincess) { + else if(msgid == 4 && !inpalace && m == moPrincess && !peace::on) { addMessage(XLAT("\"I have been trained to fight with a Hypersian scimitar, you know?\"", m)); } else if(msgid == 5 && !inpalace) { diff --git a/config.cpp b/config.cpp index 9877303a..bd1e4e9d 100644 --- a/config.cpp +++ b/config.cpp @@ -50,6 +50,7 @@ struct supersaver { virtual string save() = 0; virtual void load(const string& s) = 0; virtual bool dosave() = 0; + virtual void reset() = 0; }; vector> savers; @@ -58,6 +59,7 @@ template struct dsaver : supersaver { T& val; T dft; bool dosave() { return val != dft; } + void reset() { val = dft; } dsaver(T& val) : val(val) { } }; @@ -78,6 +80,7 @@ template struct saverenum : supersaver { T& val; T dft; bool dosave() { return val != dft; } + void reset() { val = dft; } saverenum(T& v) : val(v) { } string save() { return its(val); } void load(const string& s) { val = (T) atoi(s.c_str()); } @@ -234,18 +237,16 @@ void initConfig() { addsaver(geom3::highdetail, "3D highdetail"); addsaver(geom3::middetail, "3D middetail"); -#if CAP_RUG addsaver(rug::renderonce, "rug-renderonce"); addsaver(rug::rendernogl, "rug-rendernogl"); addsaver(rug::texturesize, "rug-texturesize"); addsaver(rug::scale, "rug-scale"); -#endif addsaverenum(pmodel, "used model"); addsaver(polygonal::SI, "polygon sides"); addsaver(polygonal::STAR, "polygon star factor"); addsaver(polygonal::deg, "polygonal degree"); - addsaver(conformal::includeHistory, "include history"); // check! + addsaver(conformal::autobandhistory, "include history"); // check! addsaver(conformal::lvspeed, "lineview speed"); addsaver(polygonal::maxcoef, "polynomial degree"); @@ -280,10 +281,40 @@ void initConfig() { addsaver(chaosmode, "mode-chaos"); addsaver(inv::on, "mode-Orb Strategy"); addsaver(purehepta, "mode-heptagonal", false); + addsaver(peace::on, "mode-peace"); + + addsaver(backcolor, "color:background"); + addsaver(forecolor, "color:foreground"); + addsaver(bordcolor, "color:borders"); + addsaver(viewdists, "expansion mode"); shmup::initConfig(); } +void resetModes() { + popAllGames(); + if(shmup::on) restartGame('s'); + if(inv::on) restartGame('i'); + if(chaosmode) restartGame('C'); + if(purehepta) restartGame('7'); + if(peace::on) restartGame('P'); + if(tour::on) restartGame('T'); + if(yendor::on) restartGame('y'); + if(tactic::on) restartGame('t'); + if(randomPatternsMode) restartGame('r'); + if(geometry != gNormal) { targetgeometry = gNormal; restartGame('g'); } + } + +void resetConfig() { + dynamicval rx(vid.xres, 0); + dynamicval ry(vid.yres, 0); + dynamicval rf(vid.fsize, 0); + dynamicval rfs(vid.full, false); + for(auto s: savers) + if(s->name.substr(0,5) != "mode-") + s->reset(); + } + void saveConfig() { DEBB(DF_INIT, (debugfile,"save config\n")); FILE *f = fopen(conffile, "wt"); @@ -353,23 +384,21 @@ void loadOldConfig(FILE *f) { shmup::loadConfig(f); -#if CAP_RUG aa = rug::renderonce; bb = rug::rendernogl; cc = purehepta; dd = chaosmode; int ee = vid.steamscore; double rs = rug::scale; err=fscanf(f, "%d%d%d%d%lf%d%d", &aa, &bb, &rug::texturesize, &cc, &rs, &ee, &dd); rug::renderonce = aa; rug::rendernogl = bb; purehepta = cc; chaosmode = dd; vid.steamscore = ee; rug::scale = rs; -#endif - aa=conformal::includeHistory; + aa=conformal::autobandhistory; double ps = polygonal::STAR, lv = conformal::lvspeed; int pmb = pmodel; err=fscanf(f, "%d%d%lf%d%d%lf", &pmb, &polygonal::SI, &ps, &polygonal::deg, &aa, &lv); pmodel = eModel(pmb); - conformal::includeHistory = aa; polygonal::STAR = ps; conformal::lvspeed = lv; + conformal::autobandhistory = aa; polygonal::STAR = ps; conformal::lvspeed = lv; aa=conformal::autoband; bb=conformal::autobandhistory; cc=conformal::dospiral; err=fscanf(f, "%d%d%d%d%d%d", @@ -678,6 +707,8 @@ void switchGL() { #endif } +void resetConfigMenu(); + void showBasicConfig() { gamescreen(3); const char *axmodes[5] = {"OFF", "auto", "light", "heavy", "arrows"}; @@ -714,8 +745,8 @@ void showBasicConfig() { if(CAP_SHMUP && !ISMOBILE) dialog::addSelItem(XLAT("configure keys/joysticks"), "", 'p'); - showAllConfig(); - + dialog::addItem(XLAT("reset all configuration"), 'R'); + if(lang() != 0) { string tw = ""; string s = XLAT("TRANSLATIONWARNING"); @@ -765,8 +796,9 @@ void showBasicConfig() { } #endif - if(xuni == 'r') vid.revcontrol = !vid.revcontrol; + if(uni == 'r') vid.revcontrol = !vid.revcontrol; if(xuni == 'd') vid.drawmousecircle = !vid.drawmousecircle; + if(uni == 'R') pushScreen(resetConfigMenu); #if ISSTEAM if(xuni == 'l') vid.steamscore = vid.steamscore^1; @@ -1087,3 +1119,32 @@ void showCustomizeChar() { }; } +void resetConfigMenu() { + dialog::init(XLAT("reset all configuration")); + dialog::addInfo("Are you sure?"); + dialog::addItem("yes, and delete the config file", 'd'); + dialog::addItem("yes", 'y'); + dialog::addItem("cancel", 'n'); + dialog::addItem("reset the special game modes", 'r'); + dialog::display(); + keyhandler = [] (int sym, int uni) { + dialog::handleNavigation(sym, uni); + + if(uni == 'd') { + resetConfig(); + unlink(conffile); + popScreen(); + } + else if(uni == 'y') { + printf("reseting config\n"); + resetConfig(); + printf("config reset\n"); + popScreen(); + } + else if(uni == 'r') + resetModes(); + else if(uni == 'n' || doexiton(sym, uni)) + popScreen(); + + }; + } diff --git a/control.cpp b/control.cpp index f6c0f0b3..7d40c2b2 100644 --- a/control.cpp +++ b/control.cpp @@ -287,7 +287,7 @@ void handleKeyNormal(int sym, int uni) { if(sym == 'u' || sym == 'e' || sym == SDLK_KP9) movepckeydir(7); } -#if !ISPANDORA +#if ISPANDORA if(DEFAULTCONTROL) { if(sym == SDLK_RIGHT) movepckeydir(0); if(sym == SDLK_LEFT) movepckeydir(4); diff --git a/game.cpp b/game.cpp index 25ced41b..b7ee4f44 100644 --- a/game.cpp +++ b/game.cpp @@ -4380,7 +4380,7 @@ bool swordAttack(cell *mt, eMonster who, cell *c, int bb) { drawParticles(c, winf[c->wall].color, 16); c->wall = waNone; } - if(canAttack(mt, who, c, m, AF_SWORD)) { + if(!peace::on && canAttack(mt, who, c, m, AF_SWORD)) { markOrb(bb ? itOrbSword2: itOrbSword); int k = tkills(); attackMonster(c, AF_ORSTUN | AF_MSG | AF_SWORD, who); @@ -4398,7 +4398,6 @@ void swordAttackStatic() { } void stabbingAttack(cell *mf, cell *mt, eMonster who, int bonuskill) { - if(peace::on) return; int numsh = 0, numflail = 0, numlance = 0, numslash = 0; int backdir = neighborId(mt, mf); @@ -4416,6 +4415,8 @@ void stabbingAttack(cell *mf, cell *mt, eMonster who, int bonuskill) { achievement_count("SLASH", numbb, 0); numslash += numbb; } + + if(peace::on) return; for(int t=0; ttype; t++) { cell *c = mf->mov[t]; @@ -4815,7 +4816,7 @@ void specialMoves() { c->stuntime = 1; } - else if(m == moPyroCultist) { + else if(m == moPyroCultist && !peace::on) { bool shot = false; bool dont_approach = false; // smaller range on the sphere @@ -6013,7 +6014,7 @@ void knightFlavorMessage(cell *c2) { else if(msgid == 2 && !tooeasy) { addMessage(XLAT("\"The Holy Grail is in the center of the Round Table.\"")); } - else if(msgid == 3) { + else if(msgid == 3 && !peace::on) { addMessage(XLAT("\"I enjoy watching the hyperbug battles.\"")); } else if(msgid == 4) { @@ -6022,10 +6023,10 @@ void knightFlavorMessage(cell *c2) { else if(msgid == 5) { addMessage(XLAT("\"Nice castle, eh?\"")); } - else if(msgid == 6 && items[itSpice] < 10) { + else if(msgid == 6 && items[itSpice] < 10 && !peace::on) { addMessage(XLAT("\"The Red Rock Valley is dangerous, but beautiful.\"")); } - else if(msgid == 7 && items[itSpice] < 10) { + else if(msgid == 7 && items[itSpice] < 10 && !peace::on) { addMessage(XLAT("\"Train in the Desert first!\"")); } else if(msgid == 8) { @@ -6037,7 +6038,7 @@ void knightFlavorMessage(cell *c2) { else if(msgid == 9 && rad <= lastsize) { addMessage(XLAT("\"There are %1 floor tiles inside our Table!\"", llts(disksize[rad]))); } - else if(msgid == 10 && !items[itPirate] && !items[itWhirlpool]) { + else if(msgid == 10 && !items[itPirate] && !items[itWhirlpool] && !peace::on) { addMessage(XLAT("\"Have you tried to take a boat and go into the Ocean? Try it!\"")); } else if(msgid == 11 && !princess::saved) { @@ -6046,7 +6047,7 @@ void knightFlavorMessage(cell *c2) { else if(msgid == 12 && !princess::saved) { addMessage(XLAT("\"I wonder what was there...\"")); } - else if(msgid == 13) { + else if(msgid == 13 && !peace::on) { addMessage(XLAT("\"Be careful in the Rose Garden! It is beautiful, but very dangerous!\"")); } else if(msgid == 14) { diff --git a/graph.cpp b/graph.cpp index 14a0a170..fbe13ce1 100644 --- a/graph.cpp +++ b/graph.cpp @@ -235,10 +235,10 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) { if(shmup::on) { if(items[itOrbSword]) - queuepoly(V*spin(esh+shmup::pc[multi::cpid]->swordangle), shMagicSword, darkena(iinf[itOrbSword].color, 0, 0xC0 + 0x30 * sin(ticks / 200.0))); + queuepoly(V*spin(esh+shmup::pc[multi::cpid]->swordangle), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword].color, 0, 0xC0 + 0x30 * sin(ticks / 200.0))); if(items[itOrbSword2]) - queuepoly(V*spin(esh+shmup::pc[multi::cpid]->swordangle+M_PI), shMagicSword, darkena(iinf[itOrbSword2].color, 0, 0xC0 + 0x30 * sin(ticks / 200.0))); + queuepoly(V*spin(esh+shmup::pc[multi::cpid]->swordangle+M_PI), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword2].color, 0, 0xC0 + 0x30 * sin(ticks / 200.0))); } else { @@ -258,10 +258,10 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) { } if(items[itOrbSword]) - queuepoly(Vnow*spin(esh+M_PI+(-1-2*ang)*2*M_PI/S84), shMagicSword, darkena(iinf[itOrbSword].color, 0, 0x80 + 0x70 * sin(ticks / 200.0))); + queuepoly(Vnow*spin(esh+M_PI+(-1-2*ang)*2*M_PI/S84), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword].color, 0, 0x80 + 0x70 * sin(ticks / 200.0))); if(items[itOrbSword2]) - queuepoly(Vnow*spin(esh+(-1-2*ang)*2*M_PI/S84), shMagicSword, darkena(iinf[itOrbSword2].color, 0, 0x80 + 0x70 * sin(ticks / 200.0))); + queuepoly(Vnow*spin(esh+(-1-2*ang)*2*M_PI/S84), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword2].color, 0, 0x80 + 0x70 * sin(ticks / 200.0))); } } diff --git a/help.cpp b/help.cpp index 098344d0..19f750f7 100644 --- a/help.cpp +++ b/help.cpp @@ -36,11 +36,7 @@ string buildHelpText() { if(inv::on) h += XLAT( - "You are playing in the Orb Strategy Mode. Collecting treasure " - "gives you access to magical Orb powers. In this mode, " - "unlocking requirements are generally higher, and " - "several quests and lands " - "give you extremely powerful Orbs of the Mirror.\n" + inv::helptext ); else h += XLAT( @@ -345,13 +341,14 @@ string generateHelpForMonster(eMonster m) { if(m == moPlayer) { #if CAP_TOUR - if(tour::on) + if(tour::on || peace::on) return s+XLAT( "A tourist from another world. They mutter something about the 'tutorial', " "and claim that they are here just to learn, and to leave without any treasures. " "Do not kill them!" ); #endif + s += XLAT( "This monster has come from another world, presumably to steal our treasures. " "Not as fast as an Eagle, not as resilient as the guards from the Palace, " diff --git a/hyper.h b/hyper.h index dabba127..f89061b7 100644 --- a/hyper.h +++ b/hyper.h @@ -395,21 +395,21 @@ namespace mapeditor { void showDrawEditor(); } -#if CAP_RUG namespace rug { extern bool rugged; extern bool renderonce; extern bool rendernogl; extern int texturesize; extern ld scale; +#if CAP_RUG void show(); void init(); void close(); void actDraw(); void select(); void buildVertexInfo(cell *c, transmatrix V); - } #endif + } #define HASLINEVIEW @@ -1045,7 +1045,7 @@ extern cell *recallCell; extern eLand cheatdest; void cheatMoveTo(eLand l); -extern int backcolor, bordcolor, forecolor; +extern unsigned backcolor, bordcolor, forecolor; extern bool overgenerate; void doOvergenerate(); diff --git a/init.cpp b/init.cpp index c5a0e249..4c9b94b3 100644 --- a/init.cpp +++ b/init.cpp @@ -1,6 +1,6 @@ -#define VER "10.0d" -#define VERNUM 10004 -#define VERNUM_HEX 0xA004 +#define VER "10.0e" +#define VERNUM 10005 +#define VERNUM_HEX 0xA005 #define GEN_M 0 #define GEN_F 1 diff --git a/landgen.cpp b/landgen.cpp index 719b9e8f..f615fdf9 100644 --- a/landgen.cpp +++ b/landgen.cpp @@ -980,7 +980,7 @@ int buildIvy(cell *c, int children, int minleaf) { if(children && !child) child = c->mov[i], leafchild = buildIvy(c->mov[i], children-1, 5); else - c->mov[i]->monst = (leaf++) ? moIvyWait : moIvyHead, + c->mov[i]->monst = (leaf++ || peace::on) ? moIvyWait : moIvyHead, c->mov[i]->mondir = c->spn(i); } } @@ -5349,7 +5349,7 @@ void setdist(cell *c, int d, cell *from) { if(c->mov[t]->wall == waColumn) c->mov[t]->item = itNone; } - if(buildIvy(c, 0, 3)) c->item = itStatue; + if(buildIvy(c, 0, 3) && !peace::on) c->item = itStatue; } } if(c->land == laTemple) { @@ -5371,7 +5371,7 @@ void setdist(cell *c, int d, cell *from) { c->monst = hrand(3) ? moCultist : moPyroCultist; else if(hrand(100000) < -d) c->monst = moCultistLeader; - else if(hrand(5000) < 250) + else if(hrand(5000) < 250 && !peace::on) c->item = itGrimoire; else if(hrand(5000) < 10 && (chaosmode ? items[itGrimoire] >= 10 : -d > TEMPLE_EACH * 10) && !peace::on && !inv::on) c->item = itOrbDragon; diff --git a/language-pl.cpp b/language-pl.cpp index 8055753b..e85efaaf 100644 --- a/language-pl.cpp +++ b/language-pl.cpp @@ -5778,7 +5778,7 @@ S( "i Pałac (idź za myszą). Można też zwiedzić kilka " "innych miejsc.") -S("puzzles and exploration", "hádanky a zkoumání") +S("puzzles and exploration", "zagadki i zwiedzanie") S("cheats", "oszustwa") S("help for keyboard user", "pomoc dla użytkowników klawiatury") @@ -5786,6 +5786,13 @@ S("mark heptagons", "oznacz siedmiokąty") S("Collect as many Dodecahedra as you can, then return here!", "Zbierz jak najwięcej Dwunastościanów i tu wróć!") + +S("reset all configuration", "reset konfiguracji") +S("Are you sure?", "Czy na pewno?") +S("yes, and delete the config file", "tak, i skasuj plik konfiguracyjny") +S("yes", "tak") +S("cancel", "anuluj") +S("reset the special game modes", "zresetuj specjalne tryby gry") #undef Orb diff --git a/polygons.cpp b/polygons.cpp index 2ca8e3c9..109216d6 100644 --- a/polygons.cpp +++ b/polygons.cpp @@ -635,7 +635,7 @@ hpcshape shDogStripes, shPBody, shPSword, shPKnife, shHumanFoot, shHumanLeg, shHumanGroin, shHumanNeck, shSkeletalFoot, shYetiFoot, - shMagicSword, shSeaTentacle, shKrakenHead, shKrakenEye, shKrakenEye2, + shMagicSword, shMagicShovel, shSeaTentacle, shKrakenHead, shKrakenEye, shKrakenEye2, shArrow, shPHead, shPFace, shGolemhead, shHood, shArmor, shAztecHead, shAztecCap, @@ -1585,6 +1585,9 @@ void buildpolys() { if(purehepta) bshape(shMagicSword, PPR_MAGICSWORD, 1, 243); else bshape(shMagicSword, PPR_MAGICSWORD, 1, 244); + + if(purehepta) bshape(shMagicShovel, PPR_MAGICSWORD, 1, 333); + else bshape(shMagicShovel, PPR_MAGICSWORD, 1, 333); bshape(shBead0, 20, 1, 250); bshape(shBead1, 20, 1, 251); @@ -2700,6 +2703,8 @@ NEWSHAPE, 331, 1, 1, 0.148337,0.215535, 0.267624,0.150567, 0.262973,0.019662, 0. // 0 0 1 [000000] NEWSHAPE, 332, 6, 2, -0.016778,-0.008267, -0.261607,-0.011992, +NEWSHAPE, 333, 1, 2, 0.309841,0.030742, 0.317580,0.053457, 0.334636,0.058055, 0.348174,0.020510, 0.376877,0.022300, 0.687421,0.025648, 0.689655,0.067551, 0.764187,0.063670, 0.857074,0.041713, 0.877970,0.009947, + NEWSHAPE }; diff --git a/quit.cpp b/quit.cpp index 2434b3e2..8ca5b3a4 100644 --- a/quit.cpp +++ b/quit.cpp @@ -63,7 +63,7 @@ hint hints[] = { }, []() { dialog::addHelp(XLAT( - "Remember that you can right click mostly anything for more information.")); + "Remember that you can right click almost anything for more information.")); #if ISMAC dialog::addHelp(XLAT( "(You can also use right Shift)\n\n")); diff --git a/rug.cpp b/rug.cpp index eb352822..52e9fb6a 100644 --- a/rug.cpp +++ b/rug.cpp @@ -718,7 +718,7 @@ namespace rug { bool renderonce = false; bool rendernogl = true; int texturesize = 512; - double scale = 1.0f; + ld scale = 1.0f; } #endif diff --git a/shmup.cpp b/shmup.cpp index 5bb50c82..4033dec6 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -2301,6 +2301,8 @@ void moveMonster(monster *m, int delta) { } else if(m->type == moMetalBeast || m->type == moMetalBeast2) step /= 2; + else if(m->type == moTortoise && peace::on) + step = 0; else if(m->type == moTortoise) step /= 3; else if(isBull(m->type)) diff --git a/system.cpp b/system.cpp index 16bad564..b22fd025 100644 --- a/system.cpp +++ b/system.cpp @@ -984,17 +984,27 @@ namespace gamestack { }; +void popGame() { + if(gamestack::pushed()) { + gamestack::pop(); + } + } + +void popAllGames() { + while(gamestack::pushed()) { + gamestack::pop(); + } + } + void restartGame(char switchWhat, bool push) { popScreenAll(); DEBB(DF_INIT, (debugfile,"restartGame\n")); + if(push) gamestack::push(); - else if(gamestack::pushed()) { - gamestack::pop(); - return; - } else { + popAllGames(); achievement_final(true); #if CAP_SAVE saveStats(); diff --git a/tour.cpp b/tour.cpp index 1af7a484..5f54e56c 100644 --- a/tour.cpp +++ b/tour.cpp @@ -26,12 +26,12 @@ void setCanvas(presmode mode, char canv) { mapeditor::whichCanvas = canv; ld = firstland; firstland = laCanvas; - restartGame(0, true); + restartGame(0, true); } if(mode == pmStop) { mapeditor::whichCanvas = wc; firstland = ld; - restartGame(0, false); + popGame(); } } @@ -80,7 +80,7 @@ bool handleKeyTour(int sym, int uni) { if((sym == SDLK_RETURN || sym == SDLK_KP_ENTER) && (!inhelp || (flags & QUICKSKIP))) { if(inhelp) popScreen(); if(geometry || purehepta) { - restartGame(0, false); + popGame(); if(!(flags & QUICKGEO)) return true; } if(flags & FINALSLIDE) return true; @@ -92,7 +92,7 @@ bool handleKeyTour(int sym, int uni) { } if(sym == SDLK_BACKSPACE) { if(geometry || purehepta) { - restartGame(0, false); + popGame(); if(!(flags & QUICKGEO)) return true; } if(currentslide == 0) { slidehelp(); return true; } @@ -141,7 +141,7 @@ bool handleKeyTour(int sym, int uni) { } if(geometry || purehepta) { - restartGame(0, false); + popGame(); presentation(pmGeometryReset); return true; } @@ -253,7 +253,7 @@ namespace ss { keyhandler = [] (int sym, int uni) { if(uni >= 'a' && uni < 'a' + sssize) { if(geometry || purehepta) { - restartGame(0, false); + popGame(); presentation(pmGeometryReset); } if(slides != wts) { @@ -726,7 +726,7 @@ slide default_slides[] = { } if(mode == 3) { shmup::clearMonsters(); - restartGame(0, false); + popGame(); } } },