1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Use enums for unlock, unlocknotify, unlocknum

This adds an anonymous enum for the unlock and unlocknotify arrays and
unlocknum function, and replaces all integer literals with them.

This is not named and thus cannot be used for strict typechecking
because these are actually indexes into an array in XML save files, so
the numbers themselves matter a lot.
This commit is contained in:
Misa 2023-06-05 17:34:27 -07:00
parent 14d034e4c6
commit e931f2a4a1
7 changed files with 202 additions and 118 deletions

View file

@ -1871,7 +1871,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
break; break;
case 7: case 7:
if(game.unlock[5]) if (game.unlock[UnlockTrophy_GAME_COMPLETE])
{ {
entity.tile = 188 + meta1; entity.tile = 188 + meta1;
entity.colour = 37; entity.colour = 37;
@ -1880,7 +1880,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
} }
break; break;
case 8: case 8:
if(game.unlock[19]) if (game.unlock[UnlockTrophy_FLIPMODE_COMPLETE])
{ {
entity.tile = 188 + meta1; entity.tile = 188 + meta1;
entity.colour = 37; entity.colour = 37;
@ -1973,7 +1973,7 @@ void entityclass::createentity(int xp, int yp, int t, int meta1, int meta2, int
break; break;
case 19: case 19:
if(game.unlock[20]) if (game.unlock[UnlockTrophy_NODEATHMODE_COMPLETE])
{ {
entity.tile = 3; entity.tile = 3;
entity.colour = 102; entity.colour = 102;

View file

@ -2462,7 +2462,7 @@ void Game::updatestate(void)
case 3006: case 3006:
//Level complete! (warp zone) //Level complete! (warp zone)
unlocknum(4); unlocknum(Unlock_WARPZONE_COMPLETE);
lastsaved = 4; lastsaved = 4;
music.play(Music_PATHCOMPLETE); music.play(Music_PATHCOMPLETE);
incstate(); incstate();
@ -2503,7 +2503,7 @@ void Game::updatestate(void)
case 3020: case 3020:
//Level complete! (Space Station 2) //Level complete! (Space Station 2)
unlocknum(3); unlocknum(Unlock_SPACESTATION2_COMPLETE);
lastsaved = 2; lastsaved = 2;
music.play(Music_PATHCOMPLETE); music.play(Music_PATHCOMPLETE);
incstate(); incstate();
@ -2545,7 +2545,7 @@ void Game::updatestate(void)
case 3040: case 3040:
//Level complete! (Lab) //Level complete! (Lab)
unlocknum(1); unlocknum(Unlock_LABORATORY_COMPLETE);
lastsaved = 5; lastsaved = 5;
music.play(Music_PATHCOMPLETE); music.play(Music_PATHCOMPLETE);
incstate(); incstate();
@ -2586,7 +2586,7 @@ void Game::updatestate(void)
case 3050: case 3050:
//Level complete! (Space Station 1) //Level complete! (Space Station 1)
unlocknum(0); unlocknum(Unlock_SPACESTATION1_COMPLETE);
lastsaved = 1; lastsaved = 1;
music.play(Music_PATHCOMPLETE); music.play(Music_PATHCOMPLETE);
incstate(); incstate();
@ -2653,7 +2653,7 @@ void Game::updatestate(void)
case 3060: case 3060:
//Level complete! (Tower) //Level complete! (Tower)
unlocknum(2); unlocknum(Unlock_TOWER_COMPLETE);
lastsaved = 3; lastsaved = 3;
music.play(Music_PATHCOMPLETE); music.play(Music_PATHCOMPLETE);
incstate(); incstate();
@ -2782,7 +2782,7 @@ void Game::updatestate(void)
} }
else else
{ {
unlocknum(7); unlocknum(Unlock_INTERMISSION2_COMPLETE);
graphics.fademode = FADE_START_FADEOUT; graphics.fademode = FADE_START_FADEOUT;
companion = 0; companion = 0;
incstate(); incstate();
@ -2815,7 +2815,7 @@ void Game::updatestate(void)
} }
else else
{ {
unlocknum(6); unlocknum(Unlock_INTERMISSION1_COMPLETE);
graphics.fademode = FADE_START_FADEOUT; graphics.fademode = FADE_START_FADEOUT;
companion = 0; companion = 0;
supercrewmate = false; supercrewmate = false;
@ -2875,7 +2875,7 @@ void Game::updatestate(void)
case 3501: case 3501:
//Game complete! //Game complete!
unlockAchievement("vvvvvvgamecomplete"); unlockAchievement("vvvvvvgamecomplete");
unlocknum(5); unlocknum(UnlockTrophy_GAME_COMPLETE);
crewstats[0] = true; crewstats[0] = true;
incstate(); incstate();
setstatedelay(75); setstatedelay(75);
@ -2994,7 +2994,7 @@ void Game::updatestate(void)
{ {
//flip mode complete //flip mode complete
unlockAchievement("vvvvvvgamecompleteflip"); unlockAchievement("vvvvvvgamecompleteflip");
unlocknum(19); unlocknum(UnlockTrophy_FLIPMODE_COMPLETE);
} }
#ifndef MAKEANDPLAY #ifndef MAKEANDPLAY
@ -3033,7 +3033,7 @@ void Game::updatestate(void)
if (nodeathmode) if (nodeathmode)
{ {
unlockAchievement("vvvvvvmaster"); //bloody hell unlockAchievement("vvvvvvmaster"); //bloody hell
unlocknum(20); unlocknum(UnlockTrophy_NODEATHMODE_COMPLETE);
setstate(3520); setstate(3520);
setstatedelay(0); setstatedelay(0);
} }
@ -6406,7 +6406,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
break; break;
case Menu::gameplayoptions: case Menu::gameplayoptions:
#if !defined(MAKEANDPLAY) #if !defined(MAKEANDPLAY)
if (ingame_titlemode && unlock[18]) if (ingame_titlemode && unlock[Unlock_FLIPMODE])
#endif #endif
{ {
option(loc::gettext("flip mode")); option(loc::gettext("flip mode"));
@ -6694,11 +6694,11 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
break; break;
case Menu::unlockmenu: case Menu::unlockmenu:
option(loc::gettext("unlock time trials")); option(loc::gettext("unlock time trials"));
option(loc::gettext("unlock intermissions"), !unlock[16]); option(loc::gettext("unlock intermissions"), !unlock[Unlock_INTERMISSION_REPLAYS]);
option(loc::gettext("unlock no death mode"), !unlock[17]); option(loc::gettext("unlock no death mode"), !unlock[Unlock_NODEATHMODE]);
option(loc::gettext("unlock flip mode"), !unlock[18]); option(loc::gettext("unlock flip mode"), !unlock[Unlock_FLIPMODE]);
option(loc::gettext("unlock ship jukebox"), (stat_trinkets<20)); option(loc::gettext("unlock ship jukebox"), (stat_trinkets<20));
option(loc::gettext("unlock secret lab"), !unlock[8]); option(loc::gettext("unlock secret lab"), !unlock[Unlock_SECRETLAB]);
option(loc::gettext("return")); option(loc::gettext("return"));
menuyoff = -20; menuyoff = -20;
break; break;
@ -6729,44 +6729,74 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
//Ok, here's where the unlock stuff comes into it: //Ok, here's where the unlock stuff comes into it:
//First up, time trials: //First up, time trials:
int temp = 0; int temp = 0;
if (unlock[0] && stat_trinkets >= 3 && !unlocknotify[9]) temp++; if (unlock[Unlock_SPACESTATION1_COMPLETE]
if (unlock[1] && stat_trinkets >= 6 && !unlocknotify[10]) temp++; && stat_trinkets >= 3
if (unlock[2] && stat_trinkets >= 9 && !unlocknotify[11]) temp++; && !unlocknotify[Unlock_TIMETRIAL_SPACESTATION1])
if (unlock[3] && stat_trinkets >= 12 && !unlocknotify[12]) temp++; {
if (unlock[4] && stat_trinkets >= 15 && !unlocknotify[13]) temp++; temp++;
if (unlock[5] && stat_trinkets >= 18 && !unlocknotify[14]) temp++; }
if (unlock[Unlock_LABORATORY_COMPLETE]
&& stat_trinkets >= 6
&& !unlocknotify[Unlock_TIMETRIAL_LABORATORY])
{
temp++;
}
if (unlock[Unlock_TOWER_COMPLETE]
&& stat_trinkets >= 9
&& !unlocknotify[Unlock_TIMETRIAL_TOWER])
{
temp++;
}
if (unlock[Unlock_SPACESTATION2_COMPLETE]
&& stat_trinkets >= 12
&& !unlocknotify[Unlock_TIMETRIAL_SPACESTATION2])
{
temp++;
}
if (unlock[Unlock_WARPZONE_COMPLETE]
&& stat_trinkets >= 15
&& !unlocknotify[Unlock_TIMETRIAL_WARPZONE])
{
temp++;
}
if (unlock[UnlockTrophy_GAME_COMPLETE]
&& stat_trinkets >= 18
&& !unlocknotify[Unlock_TIMETRIAL_FINALLEVEL])
{
temp++;
}
if (temp > 0) if (temp > 0)
{ {
//you've unlocked a time trial! //you've unlocked a time trial!
if (unlock[0] && stat_trinkets >= 3) if (unlock[Unlock_SPACESTATION1_COMPLETE] && stat_trinkets >= 3)
{ {
unlocknotify[9] = true; unlocknotify[Unlock_TIMETRIAL_SPACESTATION1] = true;
unlock[9] = true; unlock[Unlock_TIMETRIAL_SPACESTATION1] = true;
} }
if (unlock[1] && stat_trinkets >= 6) if (unlock[Unlock_LABORATORY_COMPLETE] && stat_trinkets >= 6)
{ {
unlocknotify[10] = true; unlocknotify[Unlock_TIMETRIAL_LABORATORY] = true;
unlock[10] = true; unlock[Unlock_TIMETRIAL_LABORATORY] = true;
} }
if (unlock[2] && stat_trinkets >= 9) if (unlock[Unlock_TOWER_COMPLETE] && stat_trinkets >= 9)
{ {
unlocknotify[11] = true; unlocknotify[Unlock_TIMETRIAL_TOWER] = true;
unlock[11] = true; unlock[Unlock_TIMETRIAL_TOWER] = true;
} }
if (unlock[3] && stat_trinkets >= 12) if (unlock[Unlock_SPACESTATION2_COMPLETE] && stat_trinkets >= 12)
{ {
unlocknotify[12] = true; unlocknotify[Unlock_TIMETRIAL_SPACESTATION2] = true;
unlock[12] = true; unlock[Unlock_TIMETRIAL_SPACESTATION2] = true;
} }
if (unlock[4] && stat_trinkets >= 15) if (unlock[Unlock_WARPZONE_COMPLETE] && stat_trinkets >= 15)
{ {
unlocknotify[13] = true; unlocknotify[Unlock_TIMETRIAL_WARPZONE] = true;
unlock[13] = true; unlock[Unlock_TIMETRIAL_WARPZONE] = true;
} }
if (unlock[5] && stat_trinkets >= 18) if (unlock[UnlockTrophy_GAME_COMPLETE] && stat_trinkets >= 18)
{ {
unlocknotify[14] = true; unlocknotify[Unlock_TIMETRIAL_FINALLEVEL] = true;
unlock[14] = true; unlock[Unlock_TIMETRIAL_FINALLEVEL] = true;
} }
if (temp == 1) if (temp == 1)
@ -6790,27 +6820,29 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
if (bestrank[3] >= 2) temp++; if (bestrank[3] >= 2) temp++;
if (bestrank[4] >= 2) temp++; if (bestrank[4] >= 2) temp++;
if (bestrank[5] >= 2) temp++; if (bestrank[5] >= 2) temp++;
if (temp >= 4 && !unlocknotify[17]) if (temp >= 4 && !unlocknotify[Unlock_NODEATHMODE])
{ {
//Unlock No Death Mode //Unlock No Death Mode
unlocknotify[17] = true; unlocknotify[Unlock_NODEATHMODE] = true;
unlock[17] = true; unlock[Unlock_NODEATHMODE] = true;
createmenu(Menu::unlocknodeathmode, true); createmenu(Menu::unlocknodeathmode, true);
savestatsandsettings(); savestatsandsettings();
} }
//Alright then! Flip mode? //Alright then! Flip mode?
else if (unlock[5] && !unlocknotify[18]) else if (unlock[UnlockTrophy_GAME_COMPLETE]
&& !unlocknotify[Unlock_FLIPMODE])
{ {
unlock[18] = true; unlock[Unlock_FLIPMODE] = true;
unlocknotify[18] = true; unlocknotify[Unlock_FLIPMODE] = true;
createmenu(Menu::unlockflipmode, true); createmenu(Menu::unlockflipmode, true);
savestatsandsettings(); savestatsandsettings();
} }
//What about the intermission levels? //What about the intermission levels?
else if (unlock[7] && !unlocknotify[16]) else if (unlock[Unlock_INTERMISSION2_COMPLETE]
&& !unlocknotify[Unlock_INTERMISSION_REPLAYS])
{ {
unlock[16] = true; unlock[Unlock_INTERMISSION_REPLAYS] = true;
unlocknotify[16] = true; unlocknotify[Unlock_INTERMISSION_REPLAYS] = true;
createmenu(Menu::unlockintermission, true); createmenu(Menu::unlockintermission, true);
savestatsandsettings(); savestatsandsettings();
} }
@ -6825,7 +6857,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option(loc::gettext("new game")); option(loc::gettext("new game"));
} }
//ok, secret lab! no notification, but test: //ok, secret lab! no notification, but test:
if (unlock[8]) if (unlock[Unlock_SECRETLAB])
{ {
option(loc::gettext("secret lab")); option(loc::gettext("secret lab"));
} }
@ -6835,7 +6867,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
option(loc::gettext("new game")); option(loc::gettext("new game"));
} }
option(loc::gettext("return")); option(loc::gettext("return"));
if (unlock[8]) if (unlock[Unlock_SECRETLAB])
{ {
menuyoff = -30; menuyoff = -30;
} }
@ -6862,9 +6894,9 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
break; break;
case Menu::playmodes: case Menu::playmodes:
option(loc::gettext("time trials"), !nocompetitive_unless_translator()); option(loc::gettext("time trials"), !nocompetitive_unless_translator());
option(loc::gettext("intermissions"), unlock[16]); option(loc::gettext("intermissions"), unlock[Unlock_INTERMISSION_REPLAYS]);
option(loc::gettext("no death mode"), unlock[17] && !nocompetitive()); option(loc::gettext("no death mode"), unlock[Unlock_NODEATHMODE] && !nocompetitive());
option(loc::gettext("flip mode"), unlock[18]); option(loc::gettext("flip mode"), unlock[Unlock_FLIPMODE]);
option(loc::gettext("return")); option(loc::gettext("return"));
menuyoff = 8; menuyoff = 8;
maxspacing = 20; maxspacing = 20;
@ -6915,23 +6947,29 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
menuyoff = 80; menuyoff = 80;
break; break;
case Menu::unlockmenutrials: case Menu::unlockmenutrials:
option(loc::gettext("space station 1"), !unlock[9]); option(loc::gettext("space station 1"), !unlock[Unlock_TIMETRIAL_SPACESTATION1]);
option(loc::gettext("the laboratory"), !unlock[10]); option(loc::gettext("the laboratory"), !unlock[Unlock_TIMETRIAL_LABORATORY]);
option(loc::gettext("the tower"), !unlock[11]); option(loc::gettext("the tower"), !unlock[Unlock_TIMETRIAL_TOWER]);
option(loc::gettext("space station 2"), !unlock[12]); option(loc::gettext("space station 2"), !unlock[Unlock_TIMETRIAL_SPACESTATION2]);
option(loc::gettext("the warp zone"), !unlock[13]); option(loc::gettext("the warp zone"), !unlock[Unlock_TIMETRIAL_WARPZONE]);
option(loc::gettext("the final level"), !unlock[14]); option(loc::gettext("the final level"), !unlock[Unlock_TIMETRIAL_FINALLEVEL]);
option(loc::gettext("return")); option(loc::gettext("return"));
menuyoff = 0; menuyoff = 0;
break; break;
case Menu::timetrials: case Menu::timetrials:
option(loc::gettext(unlock[9] ? "space station 1" : "???"), unlock[9]); option(loc::gettext(unlock[Unlock_TIMETRIAL_SPACESTATION1] ? "space station 1" : "???"),
option(loc::gettext(unlock[10] ? "the laboratory" : "???"), unlock[10]); unlock[Unlock_TIMETRIAL_SPACESTATION1]);
option(loc::gettext(unlock[11] ? "the tower" : "???"), unlock[11]); option(loc::gettext(unlock[Unlock_TIMETRIAL_LABORATORY] ? "the laboratory" : "???"),
option(loc::gettext(unlock[12] ? "space station 2" : "???"), unlock[12]); unlock[Unlock_TIMETRIAL_LABORATORY]);
option(loc::gettext(unlock[13] ? "the warp zone" : "???"), unlock[13]); option(loc::gettext(unlock[Unlock_TIMETRIAL_TOWER] ? "the tower" : "???"),
option(loc::gettext(unlock[14] ? "the final level" : "???"), unlock[14]); unlock[Unlock_TIMETRIAL_TOWER]);
option(loc::gettext(unlock[Unlock_TIMETRIAL_SPACESTATION2] ? "space station 2" : "???"),
unlock[Unlock_TIMETRIAL_SPACESTATION2]);
option(loc::gettext(unlock[Unlock_TIMETRIAL_WARPZONE] ? "the warp zone" : "???"),
unlock[Unlock_TIMETRIAL_WARPZONE]);
option(loc::gettext(unlock[Unlock_TIMETRIAL_FINALLEVEL] ? "the final level" : "???"),
unlock[Unlock_TIMETRIAL_FINALLEVEL]);
option(loc::gettext("return")); option(loc::gettext("return"));
menuyoff = 0; menuyoff = 0;

View file

@ -132,6 +132,32 @@ enum SWNMODE
SWN_NONE SWN_NONE
}; };
/* enums for unlock, unlocknotify arrays and unlocknum function */
enum
{
Unlock_SPACESTATION1_COMPLETE = 0,
Unlock_LABORATORY_COMPLETE = 1,
Unlock_TOWER_COMPLETE = 2,
Unlock_SPACESTATION2_COMPLETE = 3,
Unlock_WARPZONE_COMPLETE = 4,
UnlockTrophy_GAME_COMPLETE = 5,
Unlock_INTERMISSION1_COMPLETE = 6,
Unlock_INTERMISSION2_COMPLETE = 7,
Unlock_SECRETLAB = 8,
Unlock_TIMETRIAL_SPACESTATION1 = 9,
Unlock_TIMETRIAL_LABORATORY = 10,
Unlock_TIMETRIAL_TOWER = 11,
Unlock_TIMETRIAL_SPACESTATION2 = 12,
Unlock_TIMETRIAL_WARPZONE = 13,
Unlock_TIMETRIAL_FINALLEVEL = 14,
Unlock_INTERMISSION_UNUSED = 15,
Unlock_INTERMISSION_REPLAYS = 16,
Unlock_NODEATHMODE = 17,
Unlock_FLIPMODE = 18,
UnlockTrophy_FLIPMODE_COMPLETE = 19,
UnlockTrophy_NODEATHMODE_COMPLETE = 20
};
struct MenuStackFrame struct MenuStackFrame
{ {
int option; int option;

View file

@ -938,7 +938,7 @@ static void menuactionpress(void)
{ {
int gameplayoptionsoffset = 0; int gameplayoptionsoffset = 0;
#if !defined(MAKEANDPLAY) #if !defined(MAKEANDPLAY)
if (game.ingame_titlemode && game.unlock[18]) if (game.ingame_titlemode && game.unlock[Unlock_FLIPMODE])
#endif #endif
{ {
gameplayoptionsoffset = 1; gameplayoptionsoffset = 1;
@ -1401,43 +1401,43 @@ static void menuactionpress(void)
switch (game.currentmenuoption) switch (game.currentmenuoption)
{ {
case 0: //unlock 1 case 0: //unlock 1
game.unlock[9] = true; game.unlock[Unlock_TIMETRIAL_SPACESTATION1] = true;
game.unlocknotify[9] = true; game.unlocknotify[Unlock_TIMETRIAL_SPACESTATION1] = true;
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::unlockmenutrials, true); game.createmenu(Menu::unlockmenutrials, true);
game.savestatsandsettings_menu(); game.savestatsandsettings_menu();
break; break;
case 1: //unlock 2 case 1: //unlock 2
game.unlock[10] = true; game.unlock[Unlock_TIMETRIAL_LABORATORY] = true;
game.unlocknotify[10] = true; game.unlocknotify[Unlock_TIMETRIAL_LABORATORY] = true;
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::unlockmenutrials, true); game.createmenu(Menu::unlockmenutrials, true);
game.savestatsandsettings_menu(); game.savestatsandsettings_menu();
break; break;
case 2: //unlock 3 case 2: //unlock 3
game.unlock[11] = true; game.unlock[Unlock_TIMETRIAL_TOWER] = true;
game.unlocknotify[11] = true; game.unlocknotify[Unlock_TIMETRIAL_TOWER] = true;
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::unlockmenutrials, true); game.createmenu(Menu::unlockmenutrials, true);
game.savestatsandsettings_menu(); game.savestatsandsettings_menu();
break; break;
case 3: //unlock 4 case 3: //unlock 4
game.unlock[12] = true; game.unlock[Unlock_TIMETRIAL_SPACESTATION2] = true;
game.unlocknotify[12] = true; game.unlocknotify[Unlock_TIMETRIAL_SPACESTATION2] = true;
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::unlockmenutrials, true); game.createmenu(Menu::unlockmenutrials, true);
game.savestatsandsettings_menu(); game.savestatsandsettings_menu();
break; break;
case 4: //unlock 5 case 4: //unlock 5
game.unlock[13] = true; game.unlock[Unlock_TIMETRIAL_WARPZONE] = true;
game.unlocknotify[13] = true; game.unlocknotify[Unlock_TIMETRIAL_WARPZONE] = true;
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::unlockmenutrials, true); game.createmenu(Menu::unlockmenutrials, true);
game.savestatsandsettings_menu(); game.savestatsandsettings_menu();
break; break;
case 5: //unlock 6 case 5: //unlock 6
game.unlock[14] = true; game.unlock[Unlock_TIMETRIAL_FINALLEVEL] = true;
game.unlocknotify[14] = true; game.unlocknotify[Unlock_TIMETRIAL_FINALLEVEL] = true;
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::unlockmenutrials, true); game.createmenu(Menu::unlockmenutrials, true);
game.savestatsandsettings_menu(); game.savestatsandsettings_menu();
@ -1462,26 +1462,26 @@ static void menuactionpress(void)
case 1: case 1:
//unlock intermissions //unlock intermissions
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.unlock[16] = true; game.unlock[Unlock_INTERMISSION_REPLAYS] = true;
game.unlocknotify[16] = true; game.unlocknotify[Unlock_INTERMISSION_REPLAYS] = true;
game.unlock[6] = true; game.unlock[Unlock_INTERMISSION1_COMPLETE] = true;
game.unlock[7] = true; game.unlock[Unlock_INTERMISSION2_COMPLETE] = true;
game.createmenu(Menu::unlockmenu, true); game.createmenu(Menu::unlockmenu, true);
game.savestatsandsettings_menu(); game.savestatsandsettings_menu();
break; break;
case 2: case 2:
//unlock no death mode //unlock no death mode
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.unlock[17] = true; game.unlock[Unlock_NODEATHMODE] = true;
game.unlocknotify[17] = true; game.unlocknotify[Unlock_NODEATHMODE] = true;
game.createmenu(Menu::unlockmenu, true); game.createmenu(Menu::unlockmenu, true);
game.savestatsandsettings_menu(); game.savestatsandsettings_menu();
break; break;
case 3: case 3:
//unlock flip mode //unlock flip mode
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.unlock[18] = true; game.unlock[Unlock_FLIPMODE] = true;
game.unlocknotify[18] = true; game.unlocknotify[Unlock_FLIPMODE] = true;
game.createmenu(Menu::unlockmenu, true); game.createmenu(Menu::unlockmenu, true);
game.savestatsandsettings_menu(); game.savestatsandsettings_menu();
break; break;
@ -1495,8 +1495,8 @@ static void menuactionpress(void)
case 5: case 5:
//unlock secret lab //unlock secret lab
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.unlock[8] = true; game.unlock[Unlock_SECRETLAB] = true;
game.unlocknotify[8] = true; game.unlocknotify[Unlock_SECRETLAB] = true;
game.createmenu(Menu::unlockmenu, true); game.createmenu(Menu::unlockmenu, true);
game.savestatsandsettings_menu(); game.savestatsandsettings_menu();
break; break;
@ -1754,7 +1754,7 @@ static void menuactionpress(void)
case Menu::play: case Menu::play:
{ {
//Do we have the Secret Lab option? //Do we have the Secret Lab option?
int sloffset = game.unlock[8] ? 0 : -1; int sloffset = game.unlock[Unlock_SECRETLAB] ? 0 : -1;
//Do we have a telesave or quicksave? //Do we have a telesave or quicksave?
int ngoffset = game.save_exists() ? 0 : -1; int ngoffset = game.save_exists() ? 0 : -1;
if (game.currentmenuoption == 0) if (game.currentmenuoption == 0)
@ -1787,7 +1787,7 @@ static void menuactionpress(void)
game.createmenu(Menu::continuemenu); game.createmenu(Menu::continuemenu);
} }
} }
else if (game.currentmenuoption == 1 && game.unlock[8]) else if (game.currentmenuoption == 1 && game.unlock[Unlock_SECRETLAB])
{ {
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
startmode(Start_SECRETLAB); startmode(Start_SECRETLAB);
@ -1893,26 +1893,31 @@ static void menuactionpress(void)
map.nexttowercolour(); map.nexttowercolour();
break; break;
case Menu::playmodes: case Menu::playmodes:
if (game.currentmenuoption == 0 && !game.nocompetitive_unless_translator()) //go to the time trial menu if (game.currentmenuoption == 0
&& !game.nocompetitive_unless_translator()) //go to the time trial menu
{ {
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::timetrials); game.createmenu(Menu::timetrials);
map.nexttowercolour(); map.nexttowercolour();
} }
else if (game.currentmenuoption == 1 && game.unlock[16]) else if (game.currentmenuoption == 1
&& game.unlock[Unlock_INTERMISSION_REPLAYS])
{ {
//intermission mode menu //intermission mode menu
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::intermissionmenu); game.createmenu(Menu::intermissionmenu);
map.nexttowercolour(); map.nexttowercolour();
} }
else if (game.currentmenuoption == 2 && game.unlock[17] && !game.nocompetitive()) //start a game in no death mode else if (game.currentmenuoption == 2
&& game.unlock[Unlock_NODEATHMODE]
&& !game.nocompetitive()) //start a game in no death mode
{ {
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
game.createmenu(Menu::startnodeathmode); game.createmenu(Menu::startnodeathmode);
map.nexttowercolour(); map.nexttowercolour();
} }
else if (game.currentmenuoption == 3 && game.unlock[18]) //enable/disable flip mode else if (game.currentmenuoption == 3
&& game.unlock[Unlock_FLIPMODE]) //enable/disable flip mode
{ {
toggleflipmode(); toggleflipmode();
} }
@ -2060,32 +2065,38 @@ static void menuactionpress(void)
map.nexttowercolour(); map.nexttowercolour();
break; break;
case Menu::timetrials: case Menu::timetrials:
if (game.currentmenuoption == 0 && game.unlock[9]) if (game.currentmenuoption == 0
&& game.unlock[Unlock_TIMETRIAL_SPACESTATION1])
{ {
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
startmode(Start_TIMETRIAL_SPACESTATION1); startmode(Start_TIMETRIAL_SPACESTATION1);
} }
else if (game.currentmenuoption == 1 && game.unlock[10]) else if (game.currentmenuoption == 1
&& game.unlock[Unlock_TIMETRIAL_LABORATORY])
{ {
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
startmode(Start_TIMETRIAL_LABORATORY); startmode(Start_TIMETRIAL_LABORATORY);
} }
else if (game.currentmenuoption == 2 && game.unlock[11]) else if (game.currentmenuoption == 2
&& game.unlock[Unlock_TIMETRIAL_TOWER])
{ {
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
startmode(Start_TIMETRIAL_TOWER); startmode(Start_TIMETRIAL_TOWER);
} }
else if (game.currentmenuoption == 3 && game.unlock[12]) else if (game.currentmenuoption == 3
&& game.unlock[Unlock_TIMETRIAL_SPACESTATION2])
{ {
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
startmode(Start_TIMETRIAL_SPACESTATION2); startmode(Start_TIMETRIAL_SPACESTATION2);
} }
else if (game.currentmenuoption == 4 && game.unlock[13]) else if (game.currentmenuoption == 4
&& game.unlock[Unlock_TIMETRIAL_WARPZONE])
{ {
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
startmode(Start_TIMETRIAL_WARPZONE); startmode(Start_TIMETRIAL_WARPZONE);
} }
else if (game.currentmenuoption == 5 && game.unlock[14]) else if (game.currentmenuoption == 5
&& game.unlock[Unlock_TIMETRIAL_FINALLEVEL])
{ {
music.playef(Sound_VIRIDIAN); music.playef(Sound_VIRIDIAN);
startmode(Start_TIMETRIAL_FINALLEVEL); startmode(Start_TIMETRIAL_FINALLEVEL);

View file

@ -164,7 +164,7 @@ static inline void draw_skip_message()
* but not Flip Mode until the player hits "play" on the title screen */ * but not Flip Mode until the player hits "play" on the title screen */
bool draw = bool draw =
#ifndef MAKEANDPLAY #ifndef MAKEANDPLAY
game.unlock[18] && game.unlock[Unlock_FLIPMODE] &&
#endif #endif
graphics.fademode == FADE_NONE; graphics.fademode == FADE_NONE;
if (!draw) if (!draw)
@ -269,7 +269,7 @@ static void menurender(void)
{ {
int gameplayoptionsoffset = 0; int gameplayoptionsoffset = 0;
#if !defined(MAKEANDPLAY) #if !defined(MAKEANDPLAY)
if (game.ingame_titlemode && game.unlock[18]) if (game.ingame_titlemode && game.unlock[Unlock_FLIPMODE])
#endif #endif
{ {
gameplayoptionsoffset = 1; gameplayoptionsoffset = 1;
@ -1161,7 +1161,7 @@ static void menurender(void)
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Intermissions"), tr, tg, tb); font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Intermissions"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Replay the intermission levels."), tr, tg, tb); int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Replay the intermission levels."), tr, tg, tb);
if (!game.unlock[15] && !game.unlock[16]) if (!game.unlock[Unlock_INTERMISSION_REPLAYS])
{ {
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("TO UNLOCK: Complete the intermission levels in-game."), tr, tg, tb); font::print_wrap(PR_CEN, -1, next_y, loc::gettext("TO UNLOCK: Complete the intermission levels in-game."), tr, tg, tb);
} }
@ -1176,7 +1176,7 @@ static void menurender(void)
{ {
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("No Death Mode is not available with slowdown or invincibility."), tr, tg, tb); font::print_wrap(PR_CEN, -1, next_y, loc::gettext("No Death Mode is not available with slowdown or invincibility."), tr, tg, tb);
} }
else if (!game.unlock[17]) else if (!game.unlock[Unlock_NODEATHMODE])
{ {
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("TO UNLOCK: Achieve an S-rank or above in at least 4 time trials."), tr, tg, tb); font::print_wrap(PR_CEN, -1, next_y, loc::gettext("TO UNLOCK: Achieve an S-rank or above in at least 4 time trials."), tr, tg, tb);
} }
@ -1187,7 +1187,7 @@ static void menurender(void)
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Flip Mode"), tr, tg, tb); font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Flip Mode"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Flip the entire game vertically. Compatible with other game modes."), tr, tg, tb); int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Flip the entire game vertically. Compatible with other game modes."), tr, tg, tb);
if (game.unlock[18]) if (game.unlock[Unlock_FLIPMODE])
{ {
if (graphics.setflipmode) if (graphics.setflipmode)
{ {
@ -1427,7 +1427,7 @@ static void menurender(void)
switch (game.currentmenuoption) switch (game.currentmenuoption)
{ {
case 0: case 0:
if(game.unlock[9]) if (game.unlock[Unlock_TIMETRIAL_SPACESTATION1])
{ {
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Space Station 1"), tr, tg, tb); font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Space Station 1"), tr, tg, tb);
unlocked = true; unlocked = true;
@ -1443,7 +1443,7 @@ static void menurender(void)
} }
break; break;
case 1: case 1:
if(game.unlock[10]) if (game.unlock[Unlock_TIMETRIAL_LABORATORY])
{ {
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("The Laboratory"), tr, tg, tb); font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("The Laboratory"), tr, tg, tb);
unlocked = true; unlocked = true;
@ -1459,7 +1459,7 @@ static void menurender(void)
} }
break; break;
case 2: case 2:
if(game.unlock[11]) if (game.unlock[Unlock_TIMETRIAL_TOWER])
{ {
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("The Tower"), tr, tg, tb); font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("The Tower"), tr, tg, tb);
unlocked = true; unlocked = true;
@ -1475,7 +1475,7 @@ static void menurender(void)
} }
break; break;
case 3: case 3:
if(game.unlock[12]) if (game.unlock[Unlock_TIMETRIAL_SPACESTATION2])
{ {
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Space Station 2"), tr, tg, tb); font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Space Station 2"), tr, tg, tb);
unlocked = true; unlocked = true;
@ -1491,7 +1491,7 @@ static void menurender(void)
} }
break; break;
case 4: case 4:
if(game.unlock[13]) if (game.unlock[Unlock_TIMETRIAL_WARPZONE])
{ {
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("The Warp Zone"), tr, tg, tb); font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("The Warp Zone"), tr, tg, tb);
unlocked = true; unlocked = true;
@ -1507,7 +1507,7 @@ static void menurender(void)
} }
break; break;
case 5: case 5:
if(game.unlock[14]) if (game.unlock[Unlock_TIMETRIAL_FINALLEVEL])
{ {
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("The Final Level"), tr, tg, tb); font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("The Final Level"), tr, tg, tb);
unlocked = true; unlocked = true;

View file

@ -1359,7 +1359,7 @@ void scriptclass::run(void)
} }
else if (words[0] == "entersecretlab") else if (words[0] == "entersecretlab")
{ {
game.unlocknum(8); game.unlocknum(Unlock_SECRETLAB);
game.insecretlab = true; game.insecretlab = true;
SDL_memset(map.explored, true, sizeof(map.explored)); SDL_memset(map.explored, true, sizeof(map.explored));
} }

View file

@ -701,9 +701,18 @@ int main(int argc, char *argv[])
if(game.swnbestrank >= 6) game.unlockAchievement("vvvvvvsupgrav60"); if(game.swnbestrank >= 6) game.unlockAchievement("vvvvvvsupgrav60");
} }
if(game.unlock[5]) game.unlockAchievement("vvvvvvgamecomplete"); if (game.unlock[UnlockTrophy_GAME_COMPLETE])
if(game.unlock[19]) game.unlockAchievement("vvvvvvgamecompleteflip"); {
if(game.unlock[20]) game.unlockAchievement("vvvvvvmaster"); game.unlockAchievement("vvvvvvgamecomplete");
}
if (game.unlock[UnlockTrophy_FLIPMODE_COMPLETE])
{
game.unlockAchievement("vvvvvvgamecompleteflip");
}
if (game.unlock[UnlockTrophy_NODEATHMODE_COMPLETE])
{
game.unlockAchievement("vvvvvvmaster");
}
if (game.bestgamedeaths > -1) { if (game.bestgamedeaths > -1) {
if (game.bestgamedeaths <= 500) { if (game.bestgamedeaths <= 500) {