Factor out slowdown/invincibility conds to function

This factors out the slowdown and invincibility conditionals to a
function. This means less copy-pasted code, and it also conveys intent
(that we don't want to allow competitive options if we have either of
these cheats enabled).

This function isn't implemented in the header because then we would have
to include Map.h for map.invincibility, and transitive includes are
evil. Although, map.invincibility ought to be on Game instead (it was
only mapclass due to 2.2-and-previous argument passing), but that's a
bunch of variable reshuffling that can be done later.
This commit is contained in:
Misa
2021-05-03 18:29:23 -07:00
committed by Ethan Lee
parent 96488d27c8
commit b3c2f56c79
4 changed files with 17 additions and 8 deletions

View File

@@ -1252,7 +1252,7 @@ static void menuactionpress(void)
}
else if (game.currentmenuoption == 1 && game.unlock[8])
{
if(!map.invincibility && game.slowdown == 30){
if(!game.nocompetitive()){
music.playef(11);
startmode(11);
}else{
@@ -1346,7 +1346,7 @@ static void menuactionpress(void)
}
break;
case Menu::playmodes:
if (game.currentmenuoption == 0 && game.slowdown == 30 && !map.invincibility) //go to the time trial menu
if (game.currentmenuoption == 0 && !game.nocompetitive()) //go to the time trial menu
{
music.playef(11);
game.createmenu(Menu::timetrials);
@@ -1359,7 +1359,7 @@ static void menuactionpress(void)
game.createmenu(Menu::intermissionmenu);
map.nexttowercolour();
}
else if (game.currentmenuoption == 2 && game.unlock[17] && game.slowdown == 30 && !map.invincibility) //start a game in no death mode
else if (game.currentmenuoption == 2 && game.unlock[17] && !game.nocompetitive()) //start a game in no death mode
{
music.playef(11);
game.createmenu(Menu::startnodeathmode);