1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00
Achievements could be unlocked in custom levels/make and play, so this adds the wrapper function `game.unlockAchievement` which calls `NETWORK_unlockAchievement` if `map.custommode` is false.
Also, this function and `Game::unlocknum` have both been `ifdef`ed to be empty if MAKEANDPLAY is defined.
This commit is contained in:
AllyTally 2020-08-01 16:49:07 -03:00 committed by Ethan Lee
parent c8b4c0f1e7
commit 06e5eb38d9
4 changed files with 47 additions and 38 deletions

View file

@ -1339,12 +1339,12 @@ void Game::updatestate()
{
bestrank[timetriallevel] = timetrialrank;
if(timetrialrank>=3){
if(timetriallevel==0) NETWORK_unlockAchievement("vvvvvvtimetrial_station1_fixed");
if(timetriallevel==1) NETWORK_unlockAchievement("vvvvvvtimetrial_lab_fixed");
if(timetriallevel==2) NETWORK_unlockAchievement("vvvvvvtimetrial_tower_fixed");
if(timetriallevel==3) NETWORK_unlockAchievement("vvvvvvtimetrial_station2_fixed");
if(timetriallevel==4) NETWORK_unlockAchievement("vvvvvvtimetrial_warp_fixed");
if(timetriallevel==5) NETWORK_unlockAchievement("vvvvvvtimetrial_final_fixed");
if(timetriallevel==0) unlockAchievement("vvvvvvtimetrial_station1_fixed");
if(timetriallevel==1) unlockAchievement("vvvvvvtimetrial_lab_fixed");
if(timetriallevel==2) unlockAchievement("vvvvvvtimetrial_tower_fixed");
if(timetriallevel==3) unlockAchievement("vvvvvvtimetrial_station2_fixed");
if(timetriallevel==4) unlockAchievement("vvvvvvtimetrial_warp_fixed");
if(timetriallevel==5) unlockAchievement("vvvvvvtimetrial_final_fixed");
}
}
@ -2944,7 +2944,7 @@ void Game::updatestate()
break;
case 3501:
//Game complete!
NETWORK_unlockAchievement("vvvvvvgamecomplete");
unlockAchievement("vvvvvvgamecomplete");
unlocknum(5);
crewstats[0] = true;
state++;
@ -3091,7 +3091,7 @@ void Game::updatestate()
if (!obj.flags[73])
{
//flip mode complete
NETWORK_unlockAchievement("vvvvvvgamecompleteflip");
unlockAchievement("vvvvvvgamecompleteflip");
unlocknum(19);
}
@ -3109,16 +3109,16 @@ void Game::updatestate()
if (bestgamedeaths > -1) {
if (bestgamedeaths <= 500) {
NETWORK_unlockAchievement("vvvvvvcomplete500");
unlockAchievement("vvvvvvcomplete500");
}
if (bestgamedeaths <= 250) {
NETWORK_unlockAchievement("vvvvvvcomplete250");
unlockAchievement("vvvvvvcomplete250");
}
if (bestgamedeaths <= 100) {
NETWORK_unlockAchievement("vvvvvvcomplete100");
unlockAchievement("vvvvvvcomplete100");
}
if (bestgamedeaths <= 50) {
NETWORK_unlockAchievement("vvvvvvcomplete50");
unlockAchievement("vvvvvvcomplete50");
}
}
@ -3126,7 +3126,7 @@ void Game::updatestate()
savestats();
if (nodeathmode)
{
NETWORK_unlockAchievement("vvvvvvmaster"); //bloody hell
unlockAchievement("vvvvvvmaster"); //bloody hell
unlocknum(20);
state = 3520;
statedelay = 0;
@ -4285,6 +4285,7 @@ void Game::deletestats()
void Game::unlocknum( int t )
{
#if !defined(MAKEANDPLAY)
if (map.custommode)
{
//Don't let custom levels unlock things!
@ -4293,6 +4294,7 @@ void Game::unlocknum( int t )
unlock[t] = true;
savestats();
#endif
}
#define LOAD_ARRAY_RENAME(ARRAY_NAME, DEST) \
@ -7359,3 +7361,9 @@ void Game::returntopausemenu()
}
game.shouldreturntopausemenu = true;
}
void Game::unlockAchievement(const char *name) {
#if !defined(MAKEANDPLAY)
if (!map.custommode) NETWORK_unlockAchievement(name);
#endif
}

View file

@ -413,6 +413,7 @@ public:
bool shouldreturntopausemenu;
void returntopausemenu();
void unlockAchievement(const char *name);
bool disablepause;
};

View file

@ -683,7 +683,7 @@ void gamelogic()
game.swnrank = 1;
if (game.swnbestrank < 1)
{
NETWORK_unlockAchievement("vvvvvvsupgrav5");
game.unlockAchievement("vvvvvvsupgrav5");
game.swnbestrank = 1;
game.swnmessage = 2+30;
music.playef(26);
@ -694,7 +694,7 @@ void gamelogic()
game.swnrank = 2;
if (game.swnbestrank < 2)
{
NETWORK_unlockAchievement("vvvvvvsupgrav10");
game.unlockAchievement("vvvvvvsupgrav10");
game.swnbestrank = 2;
game.swnmessage = 2+30;
music.playef(26);
@ -705,7 +705,7 @@ void gamelogic()
game.swnrank = 3;
if (game.swnbestrank < 3)
{
NETWORK_unlockAchievement("vvvvvvsupgrav15");
game.unlockAchievement("vvvvvvsupgrav15");
game.swnbestrank = 3;
game.swnmessage = 2+30;
music.playef(26);
@ -716,7 +716,7 @@ void gamelogic()
game.swnrank = 4;
if (game.swnbestrank < 4)
{
NETWORK_unlockAchievement("vvvvvvsupgrav20");
game.unlockAchievement("vvvvvvsupgrav20");
game.swnbestrank = 4;
game.swnmessage = 2+30;
music.playef(26);
@ -727,7 +727,7 @@ void gamelogic()
game.swnrank = 5;
if (game.swnbestrank < 5)
{
NETWORK_unlockAchievement("vvvvvvsupgrav30");
game.unlockAchievement("vvvvvvsupgrav30");
game.swnbestrank = 5;
game.swnmessage = 2+30;
music.playef(26);
@ -738,7 +738,7 @@ void gamelogic()
game.swnrank = 6;
if (game.swnbestrank < 6)
{
NETWORK_unlockAchievement("vvvvvvsupgrav60");
game.unlockAchievement("vvvvvvsupgrav60");
game.swnbestrank = 6;
game.swnmessage = 2+30;
music.playef(26);

View file

@ -274,39 +274,39 @@ int main(int argc, char *argv[])
//Check to see if you've already unlocked some achievements here from before the update
if (game.swnbestrank > 0){
if(game.swnbestrank >= 1) NETWORK_unlockAchievement("vvvvvvsupgrav5");
if(game.swnbestrank >= 2) NETWORK_unlockAchievement("vvvvvvsupgrav10");
if(game.swnbestrank >= 3) NETWORK_unlockAchievement("vvvvvvsupgrav15");
if(game.swnbestrank >= 4) NETWORK_unlockAchievement("vvvvvvsupgrav20");
if(game.swnbestrank >= 5) NETWORK_unlockAchievement("vvvvvvsupgrav30");
if(game.swnbestrank >= 6) NETWORK_unlockAchievement("vvvvvvsupgrav60");
if(game.swnbestrank >= 1) game.unlockAchievement("vvvvvvsupgrav5");
if(game.swnbestrank >= 2) game.unlockAchievement("vvvvvvsupgrav10");
if(game.swnbestrank >= 3) game.unlockAchievement("vvvvvvsupgrav15");
if(game.swnbestrank >= 4) game.unlockAchievement("vvvvvvsupgrav20");
if(game.swnbestrank >= 5) game.unlockAchievement("vvvvvvsupgrav30");
if(game.swnbestrank >= 6) game.unlockAchievement("vvvvvvsupgrav60");
}
if(game.unlock[5]) NETWORK_unlockAchievement("vvvvvvgamecomplete");
if(game.unlock[19]) NETWORK_unlockAchievement("vvvvvvgamecompleteflip");
if(game.unlock[20]) NETWORK_unlockAchievement("vvvvvvmaster");
if(game.unlock[5]) game.unlockAchievement("vvvvvvgamecomplete");
if(game.unlock[19]) game.unlockAchievement("vvvvvvgamecompleteflip");
if(game.unlock[20]) game.unlockAchievement("vvvvvvmaster");
if (game.bestgamedeaths > -1) {
if (game.bestgamedeaths <= 500) {
NETWORK_unlockAchievement("vvvvvvcomplete500");
game.unlockAchievement("vvvvvvcomplete500");
}
if (game.bestgamedeaths <= 250) {
NETWORK_unlockAchievement("vvvvvvcomplete250");
game.unlockAchievement("vvvvvvcomplete250");
}
if (game.bestgamedeaths <= 100) {
NETWORK_unlockAchievement("vvvvvvcomplete100");
game.unlockAchievement("vvvvvvcomplete100");
}
if (game.bestgamedeaths <= 50) {
NETWORK_unlockAchievement("vvvvvvcomplete50");
game.unlockAchievement("vvvvvvcomplete50");
}
}
if(game.bestrank[0]>=3) NETWORK_unlockAchievement("vvvvvvtimetrial_station1_fixed");
if(game.bestrank[1]>=3) NETWORK_unlockAchievement("vvvvvvtimetrial_lab_fixed");
if(game.bestrank[2]>=3) NETWORK_unlockAchievement("vvvvvvtimetrial_tower_fixed");
if(game.bestrank[3]>=3) NETWORK_unlockAchievement("vvvvvvtimetrial_station2_fixed");
if(game.bestrank[4]>=3) NETWORK_unlockAchievement("vvvvvvtimetrial_warp_fixed");
if(game.bestrank[5]>=3) NETWORK_unlockAchievement("vvvvvvtimetrial_final_fixed");
if(game.bestrank[0]>=3) game.unlockAchievement("vvvvvvtimetrial_station1_fixed");
if(game.bestrank[1]>=3) game.unlockAchievement("vvvvvvtimetrial_lab_fixed");
if(game.bestrank[2]>=3) game.unlockAchievement("vvvvvvtimetrial_tower_fixed");
if(game.bestrank[3]>=3) game.unlockAchievement("vvvvvvtimetrial_station2_fixed");
if(game.bestrank[4]>=3) game.unlockAchievement("vvvvvvtimetrial_warp_fixed");
if(game.bestrank[5]>=3) game.unlockAchievement("vvvvvvtimetrial_final_fixed");
obj.init();