improved mission screen in Minesweeper, and also in non-full games

This commit is contained in:
Zeno Rogue 2020-08-02 02:29:29 +02:00
parent 3505f17460
commit c97badc8c4
3 changed files with 40 additions and 8 deletions

View File

@ -509,6 +509,24 @@ EX }
EX namespace mine {
EX int victory_time;
EX void count_status() {
bool last = kills[moBomberbird];
kills[moBomberbird] = 0;
kills[moTameBomberbird] = 0;
for(cell *c: currentmap->allcells()) if(c->wall == waMineUnknown) kills[moBomberbird]++;
for(cell *c: currentmap->allcells()) if(among(c->wall, waMineMine, waMineUnknown) && mine::marked_mine(c)) kills[moTameBomberbird]++;
if(last && !kills[moBomberbird]) {
mine::victory_time = getgametime();
pushScreen(showMission);
}
}
EX bool in_minesweeper() {
return bounded && specialland == laMinefield;
}
EX bool uncoverMines(cell *c, int lev, int dist, bool just_checking) {
bool b = false;
if(c->wall == waMineMine && just_checking) return true;
@ -612,8 +630,10 @@ EX void uncover_full(cell *c2) {
}
EX void auto_teleport_charges() {
if(specialland == laMinefield && firstland == laMinefield && bounded)
if(in_minesweeper()) {
mine::count_status();
items[itOrbTeleport] = isFire(cwt.at->wall) ? 0 : 1;
}
}
EX }

View File

@ -318,11 +318,8 @@ EX eItem wanderingTreasure(cell *c) {
/** generate the wandering monsters */
EX void wandering() {
if(bounded && specialland == laMinefield) {
kills[moBomberbird] = 0;
kills[moTameBomberbird] = 0;
for(cell *c: currentmap->allcells()) if(c->wall == waMineUnknown) kills[moBomberbird]++;
for(cell *c: currentmap->allcells()) if(among(c->wall, waMineMine, waMineUnknown) && mine::marked_mine(c)) kills[moTameBomberbird]++;
if(mine::in_minesweeper()) {
mine::count_status();
return;
}
if(!canmove) return;

View File

@ -320,10 +320,12 @@ EX void showMission() {
0xC00000, 200, 100
);
keyhandler = handleKeyQuit;
bool sweeper = mine::in_minesweeper();
if(!peace::on && !racing::on)
if(!peace::on && !racing::on && !sweeper)
dialog::addInfo(XLAT("Your score: %1", its(gold())));
if(!peace::on && !racing::on)
if(!peace::on && !racing::on && !sweeper)
dialog::addInfo(XLAT("Enemies killed: %1", its(tkills())));
#if CAP_TOUR
@ -333,6 +335,17 @@ EX void showMission() {
dialog::addInfo(XLAT("Orbs of Yendor found: %1", its(items[itOrbYendor])), iinf[itOrbYendor].color);
dialog::addInfo(XLAT("CONGRATULATIONS!"), iinf[itOrbYendor].color);
}
else if(mine::in_minesweeper()) {
int to_uncover = kills[moBomberbird];
if(to_uncover) {
dialog::addInfo(XLAT("Uncover all cells which do not contain mines"));
dialog::addInfo(XLAT("Cells to uncover: %1", its(to_uncover)));
}
else {
dialog::addInfo(XLAT("CONGRATULATIONS!"), iinf[itOrbYendor].color);
dialog::addInfo(XLAT("You won in %1", getgametime_s(mine::victory_time)));
}
}
else {
if(0)
;
@ -343,6 +356,7 @@ EX void showMission() {
else if(racing::on) ;
else if(princess::challenge)
dialog::addInfo(XLAT("Follow the Mouse and escape with %the1!", moPrincess));
else if(!in_full_game()) ;
else if(gold() < R30)
dialog::addInfo(XLAT("Collect %1 $$$ to access more worlds", its(R30)));
else if(gold() < R60)
@ -370,6 +384,7 @@ EX void showMission() {
#endif
else if(peace::on) ;
else if(racing::on) ;
else if(!in_full_game()) ;
else if(tkills() < R100)
dialog::addInfo(XLAT("Defeat %1 enemies to access the Graveyard", its(R100)));
else if(kills[moVizier] == 0 && (items[itFernFlower] < U5 || items[itGold] < U5))