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

Declare obj.flags a vector of bools instead of ints

It's treated like a bool anyway, so might as well make it one.

This also necessitates updating every single instance where it or an
element inside it is used, too.
This commit is contained in:
Misa 2020-04-08 23:34:26 -07:00 committed by Ethan Lee
parent 2f1c400c9a
commit abfae6b4d7
13 changed files with 213 additions and 213 deletions

View file

@ -74,7 +74,7 @@ void entityclass::resetallflags()
{ {
for (int i = 0; i < 100; i++) for (int i = 0; i < 100; i++)
{ {
flags[i] = 0; flags[i] = false;
} }
} }
@ -105,7 +105,7 @@ void entityclass::changecustomcollect( int t, int s )
collect[t] = s; collect[t] = s;
} }
void entityclass::changeflag( int t, int s ) void entityclass::changeflag( int t, bool s )
{ {
flags[t] = s; flags[t] = s;
} }

View file

@ -36,7 +36,7 @@ public:
void changecustomcollect(int t, int s); void changecustomcollect(int t, int s);
void changeflag(int t, int s); void changeflag(int t, bool s);
void fatal_top() void fatal_top()
{ {
@ -194,7 +194,7 @@ public:
std::vector<blockclass> blocks; std::vector<blockclass> blocks;
std::vector<int> flags; std::vector<bool> flags;
std::vector<int> collect; std::vector<int> collect;
std::vector<int> customcollect; std::vector<int> customcollect;

View file

@ -533,7 +533,7 @@ std::vector<std::string> finalclass::loadlevel(int rx, int ry)
obj.createentity(264, 168, 10, 1, 52410); // (savepoint) obj.createentity(264, 168, 10, 1, 52410); // (savepoint)
obj.createentity(152, 112, 20, 1); // (terminal) obj.createentity(152, 112, 20, 1); // (terminal)
if(obj.flags[72] == 0) if(!obj.flags[72])
{ {
if (game.intimetrial || game.nocutscenes) if (game.intimetrial || game.nocutscenes)
{ {
@ -1313,7 +1313,7 @@ std::vector<std::string> finalclass::loadlevel(int rx, int ry)
obj.createentity(264, 32, 10, 0, 54480); // (savepoint) obj.createentity(264, 32, 10, 0, 54480); // (savepoint)
/*if(!game.nocutscenes && obj.flags[71]==0){ /*if(!game.nocutscenes && !obj.flags[71]){
obj.createblock(1, 72, 0, 320, 240, 49); obj.createblock(1, 72, 0, 320, 240, 49);
}*/ }*/
@ -1434,7 +1434,7 @@ std::vector<std::string> finalclass::loadlevel(int rx, int ry)
if(!game.intimetrial) if(!game.intimetrial)
{ {
if(game.companion==0 && obj.flags[8]==0 && !game.crewstats[3]) //also need to check if he's rescued in a previous game if(game.companion==0 && !obj.flags[8] && !game.crewstats[3]) //also need to check if he's rescued in a previous game
{ {
obj.createentity(264, 185, 18, 15, 1, 17, 0); obj.createentity(264, 185, 18, 15, 1, 17, 0);
obj.createblock(1, 26*8, 0, 32, 240, 36); obj.createblock(1, 26*8, 0, 32, 240, 36);

View file

@ -735,9 +735,9 @@ void Game::updatestate()
case 8: case 8:
//Enter dialogue //Enter dialogue
obj.removetrigger(8); obj.removetrigger(8);
if (obj.flags[13] == 0) if (!obj.flags[13])
{ {
obj.changeflag(13, 1); obj.changeflag(13, true);
graphics.createtextbox(" Press ENTER to view map ", -1, 155, 174, 174, 174); graphics.createtextbox(" Press ENTER to view map ", -1, 155, 174, 174, 174);
graphics.addline(" and quicksave"); graphics.addline(" and quicksave");
graphics.textboxtimer(60); graphics.textboxtimer(60);
@ -837,9 +837,9 @@ void Game::updatestate()
case 12: case 12:
//Intermission 1 instructional textbox, depends on last saved //Intermission 1 instructional textbox, depends on last saved
obj.removetrigger(12); obj.removetrigger(12);
if (obj.flags[61] == 0) if (!obj.flags[61])
{ {
obj.changeflag(61, 1); obj.changeflag(61, true);
graphics.textboxremovefast(); graphics.textboxremovefast();
graphics.createtextbox(" You can't continue to the next ", -1, 8, 174, 174, 174); graphics.createtextbox(" You can't continue to the next ", -1, 8, 174, 174, 174);
if (lastsaved == 5) if (lastsaved == 5)
@ -916,28 +916,28 @@ void Game::updatestate()
break; break;
case 20: case 20:
if (obj.flags[1] == 0) if (!obj.flags[1])
{ {
obj.changeflag(1, 1); obj.changeflag(1, true);
state = 0; state = 0;
graphics.textboxremove(); graphics.textboxremove();
} }
obj.removetrigger(20); obj.removetrigger(20);
break; break;
case 21: case 21:
if (obj.flags[2] == 0) if (!obj.flags[2])
{ {
obj.changeflag(2, 1); obj.changeflag(2, true);
state = 0; state = 0;
graphics.textboxremove(); graphics.textboxremove();
} }
obj.removetrigger(21); obj.removetrigger(21);
break; break;
case 22: case 22:
if (obj.flags[3] == 0) if (!obj.flags[3])
{ {
graphics.textboxremovefast(); graphics.textboxremovefast();
obj.changeflag(3, 1); obj.changeflag(3, true);
state = 0; state = 0;
graphics.createtextbox(" Press ACTION to flip ", -1, 25, 174, 174, 174); graphics.createtextbox(" Press ACTION to flip ", -1, 25, 174, 174, 174);
graphics.textboxtimer(60); graphics.textboxtimer(60);
@ -947,9 +947,9 @@ void Game::updatestate()
case 30: case 30:
//Generic "run script" //Generic "run script"
if (obj.flags[4] == 0) if (!obj.flags[4])
{ {
obj.changeflag(4, 1); obj.changeflag(4, true);
startscript = true; startscript = true;
newscript="firststeps"; newscript="firststeps";
state = 0; state = 0;
@ -961,11 +961,11 @@ void Game::updatestate()
//state = 55; statedelay = 50; //state = 55; statedelay = 50;
state = 0; state = 0;
statedelay = 0; statedelay = 0;
if (obj.flags[6] == 0) if (!obj.flags[6])
{ {
obj.changeflag(6, 1); obj.changeflag(6, true);
obj.changeflag(5, 1); obj.changeflag(5, true);
startscript = true; startscript = true;
newscript="communicationstation"; newscript="communicationstation";
state = 0; state = 0;
@ -975,9 +975,9 @@ void Game::updatestate()
break; break;
case 32: case 32:
//Generic "run script" //Generic "run script"
if (obj.flags[7] == 0) if (!obj.flags[7])
{ {
obj.changeflag(7, 1); obj.changeflag(7, true);
startscript = true; startscript = true;
newscript="teleporterback"; newscript="teleporterback";
state = 0; state = 0;
@ -987,9 +987,9 @@ void Game::updatestate()
break; break;
case 33: case 33:
//Generic "run script" //Generic "run script"
if (obj.flags[9] == 0) if (!obj.flags[9])
{ {
obj.changeflag(9, 1); obj.changeflag(9, true);
startscript = true; startscript = true;
newscript="rescueblue"; newscript="rescueblue";
state = 0; state = 0;
@ -999,9 +999,9 @@ void Game::updatestate()
break; break;
case 34: case 34:
//Generic "run script" //Generic "run script"
if (obj.flags[10] == 0) if (!obj.flags[10])
{ {
obj.changeflag(10, 1); obj.changeflag(10, true);
startscript = true; startscript = true;
newscript="rescueyellow"; newscript="rescueyellow";
state = 0; state = 0;
@ -1011,9 +1011,9 @@ void Game::updatestate()
break; break;
case 35: case 35:
//Generic "run script" //Generic "run script"
if (obj.flags[11] == 0) if (!obj.flags[11])
{ {
obj.changeflag(11, 1); obj.changeflag(11, true);
startscript = true; startscript = true;
newscript="rescuegreen"; newscript="rescuegreen";
state = 0; state = 0;
@ -1023,9 +1023,9 @@ void Game::updatestate()
break; break;
case 36: case 36:
//Generic "run script" //Generic "run script"
if (obj.flags[8] == 0) if (!obj.flags[8])
{ {
obj.changeflag(8, 1); obj.changeflag(8, true);
startscript = true; startscript = true;
newscript="rescuered"; newscript="rescuered";
state = 0; state = 0;
@ -1081,9 +1081,9 @@ void Game::updatestate()
case 41: case 41:
//Generic "run script" //Generic "run script"
if (obj.flags[60] == 0) if (!obj.flags[60])
{ {
obj.changeflag(60, 1); obj.changeflag(60, true);
startscript = true; startscript = true;
if (lastsaved == 2) if (lastsaved == 2)
{ {
@ -1108,9 +1108,9 @@ void Game::updatestate()
break; break;
case 42: case 42:
//Generic "run script" //Generic "run script"
if (obj.flags[62] == 0) if (!obj.flags[62])
{ {
obj.changeflag(62, 1); obj.changeflag(62, true);
startscript = true; startscript = true;
if (lastsaved == 2) if (lastsaved == 2)
{ {
@ -1135,9 +1135,9 @@ void Game::updatestate()
break; break;
case 43: case 43:
//Generic "run script" //Generic "run script"
if (obj.flags[63] == 0) if (!obj.flags[63])
{ {
obj.changeflag(63, 1); obj.changeflag(63, true);
startscript = true; startscript = true;
if (lastsaved == 2) if (lastsaved == 2)
{ {
@ -1162,9 +1162,9 @@ void Game::updatestate()
break; break;
case 44: case 44:
//Generic "run script" //Generic "run script"
if (obj.flags[64] == 0) if (!obj.flags[64])
{ {
obj.changeflag(64, 1); obj.changeflag(64, true);
startscript = true; startscript = true;
if (lastsaved == 2) if (lastsaved == 2)
{ {
@ -1189,9 +1189,9 @@ void Game::updatestate()
break; break;
case 45: case 45:
//Generic "run script" //Generic "run script"
if (obj.flags[65] == 0) if (!obj.flags[65])
{ {
obj.changeflag(65, 1); obj.changeflag(65, true);
startscript = true; startscript = true;
if (lastsaved == 2) if (lastsaved == 2)
{ {
@ -1216,9 +1216,9 @@ void Game::updatestate()
break; break;
case 46: case 46:
//Generic "run script" //Generic "run script"
if (obj.flags[66] == 0) if (!obj.flags[66])
{ {
obj.changeflag(66, 1); obj.changeflag(66, true);
startscript = true; startscript = true;
if (lastsaved == 2) if (lastsaved == 2)
{ {
@ -1244,9 +1244,9 @@ void Game::updatestate()
case 47: case 47:
//Generic "run script" //Generic "run script"
if (obj.flags[69] == 0) if (!obj.flags[69])
{ {
obj.changeflag(69, 1); obj.changeflag(69, true);
startscript = true; startscript = true;
newscript="trenchwarfare"; newscript="trenchwarfare";
state = 0; state = 0;
@ -1256,9 +1256,9 @@ void Game::updatestate()
break; break;
case 48: case 48:
//Generic "run script" //Generic "run script"
if (obj.flags[70] == 0) if (!obj.flags[70])
{ {
obj.changeflag(70, 1); obj.changeflag(70, true);
startscript = true; startscript = true;
newscript="trinketcollector"; newscript="trinketcollector";
state = 0; state = 0;
@ -1268,9 +1268,9 @@ void Game::updatestate()
break; break;
case 49: case 49:
//Start final level music //Start final level music
if (obj.flags[71] == 0) if (!obj.flags[71])
{ {
obj.changeflag(71, 1); obj.changeflag(71, true);
music.niceplay(15); //Final level remix music.niceplay(15); //Final level remix
state = 0; state = 0;
} }
@ -1411,7 +1411,7 @@ void Game::updatestate()
state++; state++;
music.playef(9); music.playef(9);
music.play(2); music.play(2);
obj.flags[72] = 1; obj.flags[72] = true;
screenshake = 10; screenshake = 10;
flashlight = 5; flashlight = 5;
@ -1487,9 +1487,9 @@ void Game::updatestate()
// Meeting crewmate in the warpzone // Meeting crewmate in the warpzone
// //
obj.removetrigger(100); obj.removetrigger(100);
if (obj.flags[4] == 0) if (!obj.flags[4])
{ {
obj.changeflag(4, 1); obj.changeflag(4, true);
state++; state++;
} }
break; break;
@ -1606,9 +1606,9 @@ void Game::updatestate()
// Meeting crewmate in the space station // Meeting crewmate in the space station
// //
obj.removetrigger(120); obj.removetrigger(120);
if (obj.flags[5] == 0) if (!obj.flags[5])
{ {
obj.changeflag(5, 1); obj.changeflag(5, true);
state++; state++;
} }
break; break;
@ -1686,7 +1686,7 @@ void Game::updatestate()
state++; state++;
music.playef(9); music.playef(9);
//music.play(2); //music.play(2);
obj.flags[72] = 1; obj.flags[72] = true;
screenshake = 10; screenshake = 10;
flashlight = 5; flashlight = 5;
@ -2919,27 +2919,27 @@ void Game::updatestate()
//change depending on when they get back to the ship. //change depending on when they get back to the ship.
if (lastsaved == 2) if (lastsaved == 2)
{ {
if (crewstats[3]) obj.flags[25] = 1; if (crewstats[3]) obj.flags[25] = true;
if (crewstats[4]) obj.flags[26] = 1; if (crewstats[4]) obj.flags[26] = true;
if (crewstats[5]) obj.flags[24] = 1; if (crewstats[5]) obj.flags[24] = true;
} }
else if (lastsaved == 3) else if (lastsaved == 3)
{ {
if (crewstats[2]) obj.flags[50] = 1; if (crewstats[2]) obj.flags[50] = true;
if (crewstats[4]) obj.flags[49] = 1; if (crewstats[4]) obj.flags[49] = true;
if (crewstats[5]) obj.flags[48] = 1; if (crewstats[5]) obj.flags[48] = true;
} }
else if (lastsaved == 4) else if (lastsaved == 4)
{ {
if (crewstats[2]) obj.flags[54] = 1; if (crewstats[2]) obj.flags[54] = true;
if (crewstats[3]) obj.flags[55] = 1; if (crewstats[3]) obj.flags[55] = true;
if (crewstats[5]) obj.flags[56] = 1; if (crewstats[5]) obj.flags[56] = true;
} }
else if (lastsaved == 5) else if (lastsaved == 5)
{ {
if (crewstats[2]) obj.flags[37] = 1; if (crewstats[2]) obj.flags[37] = true;
if (crewstats[3]) obj.flags[38] = 1; if (crewstats[3]) obj.flags[38] = true;
if (crewstats[4]) obj.flags[39] = 1; if (crewstats[4]) obj.flags[39] = true;
} }
//We're pitch black now, make a decision //We're pitch black now, make a decision
companion = 0; companion = 0;
@ -2957,22 +2957,22 @@ void Game::updatestate()
startscript = true; startscript = true;
newscript = "intermission_1"; newscript = "intermission_1";
obj.flags[19] = 1; obj.flags[19] = true;
if (lastsaved == 2) obj.flags[32] = 1; if (lastsaved == 2) obj.flags[32] = true;
if (lastsaved == 3) obj.flags[35] = 1; if (lastsaved == 3) obj.flags[35] = true;
if (lastsaved == 4) obj.flags[34] = 1; if (lastsaved == 4) obj.flags[34] = true;
if (lastsaved == 5) obj.flags[33] = 1; if (lastsaved == 5) obj.flags[33] = true;
state = 0; state = 0;
} }
else if (crewrescued() == 5) else if (crewrescued() == 5)
{ {
startscript = true; startscript = true;
newscript = "intermission_2"; newscript = "intermission_2";
obj.flags[20] = 1; obj.flags[20] = true;
if (lastsaved == 2) obj.flags[32] = 1; if (lastsaved == 2) obj.flags[32] = true;
if (lastsaved == 3) obj.flags[35] = 1; if (lastsaved == 3) obj.flags[35] = true;
if (lastsaved == 4) obj.flags[34] = 1; if (lastsaved == 4) obj.flags[34] = true;
if (lastsaved == 5) obj.flags[33] = 1; if (lastsaved == 5) obj.flags[33] = true;
state = 0; state = 0;
} }
else else
@ -3229,7 +3229,7 @@ void Game::updatestate()
break; break;
case 3510: case 3510:
//Save stats and stuff here //Save stats and stuff here
if (obj.flags[73] == 0) if (!obj.flags[73])
{ {
//flip mode complete //flip mode complete
NETWORK_unlockAchievement("vvvvvvgamecompleteflip"); NETWORK_unlockAchievement("vvvvvvgamecompleteflip");
@ -3283,7 +3283,7 @@ void Game::updatestate()
i = obj.getplayer(); i = obj.getplayer();
obj.entities[i].colour = 102; obj.entities[i].colour = 102;
obj.flags[67] = 1; obj.flags[67] = true;
state++; state++;
statedelay = 30; statedelay = 30;
@ -4982,7 +4982,7 @@ void Game::loadquick()
obj.flags.clear(); obj.flags.clear();
for(size_t i = 0; i < values.size(); i++) for(size_t i = 0; i < values.size(); i++)
{ {
obj.flags.push_back(atoi(values[i].c_str())); obj.flags.push_back((bool) atoi(values[i].c_str()));
} }
} }
} }
@ -5139,8 +5139,8 @@ void Game::loadquick()
} }
map.showteleporters = true; map.showteleporters = true;
if(obj.flags[12]==1) map.showtargets = true; if(obj.flags[12]) map.showtargets = true;
if (obj.flags[42] == 1) map.showtrinkets = true; if (obj.flags[42]) map.showtrinkets = true;
} }
@ -5209,7 +5209,7 @@ void Game::customloadquick(std::string savfile)
obj.flags.clear(); obj.flags.clear();
for(size_t i = 0; i < values.size(); i++) for(size_t i = 0; i < values.size(); i++)
{ {
obj.flags.push_back(atoi(values[i].c_str())); obj.flags.push_back((bool) atoi(values[i].c_str()));
} }
} }
} }
@ -5398,8 +5398,8 @@ void Game::customloadquick(std::string savfile)
} }
map.showteleporters = true; map.showteleporters = true;
if(obj.flags[12]==1) map.showtargets = true; if(obj.flags[12]) map.showtargets = true;
if (obj.flags[42] == 1) map.showtrinkets = true; if (obj.flags[42]) map.showtrinkets = true;
} }
@ -5642,7 +5642,7 @@ void Game::savetele()
std::string flags; std::string flags;
for(size_t i = 0; i < obj.flags.size(); i++ ) for(size_t i = 0; i < obj.flags.size(); i++ )
{ {
flags += help.String(obj.flags[i]) + ","; flags += help.String((int) obj.flags[i]) + ",";
} }
msg = new TiXmlElement( "flags" ); msg = new TiXmlElement( "flags" );
msg->LinkEndChild( new TiXmlText( flags.c_str() )); msg->LinkEndChild( new TiXmlText( flags.c_str() ));
@ -5839,7 +5839,7 @@ void Game::savequick()
std::string flags; std::string flags;
for(size_t i = 0; i < obj.flags.size(); i++ ) for(size_t i = 0; i < obj.flags.size(); i++ )
{ {
flags += help.String(obj.flags[i]) + ","; flags += help.String((int) obj.flags[i]) + ",";
} }
msg = new TiXmlElement( "flags" ); msg = new TiXmlElement( "flags" );
msg->LinkEndChild( new TiXmlText( flags.c_str() )); msg->LinkEndChild( new TiXmlText( flags.c_str() ));
@ -6029,7 +6029,7 @@ void Game::customsavequick(std::string savfile)
std::string flags; std::string flags;
for(size_t i = 0; i < obj.flags.size(); i++ ) for(size_t i = 0; i < obj.flags.size(); i++ )
{ {
flags += help.String(obj.flags[i]) + ","; flags += help.String((int) obj.flags[i]) + ",";
} }
msg = new TiXmlElement( "flags" ); msg = new TiXmlElement( "flags" );
msg->LinkEndChild( new TiXmlText( flags.c_str() )); msg->LinkEndChild( new TiXmlText( flags.c_str() ));
@ -6262,7 +6262,7 @@ void Game::loadtele()
obj.flags.clear(); obj.flags.clear();
for(size_t i = 0; i < values.size(); i++) for(size_t i = 0; i < values.size(); i++)
{ {
obj.flags.push_back(atoi(values[i].c_str())); obj.flags.push_back((bool) atoi(values[i].c_str()));
} }
} }
} }
@ -6420,8 +6420,8 @@ void Game::loadtele()
} }
map.showteleporters = true; map.showteleporters = true;
if(obj.flags[12]==1) map.showtargets = true; if(obj.flags[12]) map.showtargets = true;
if (obj.flags[42] == 1) map.showtrinkets = true; if (obj.flags[42]) map.showtrinkets = true;
} }
std::string Game::unrescued() std::string Game::unrescued()

View file

@ -1755,7 +1755,7 @@ void gameinput()
{ {
if(!graphics.flipmode) if(!graphics.flipmode)
{ {
obj.flags[73] = 1; //Flip mode test obj.flags[73] = true; //Flip mode test
} }
if(int(std::abs(obj.entities[ie].vx))<=1 && int(obj.entities[ie].vy)==0) if(int(std::abs(obj.entities[ie].vx))<=1 && int(obj.entities[ie].vy)==0)
{ {
@ -2086,7 +2086,7 @@ void mapinput()
game.menupage++; game.menupage++;
} }
if (game.menupage == 1 && obj.flags[67] == 1 && game.press_action && !game.insecretlab && !map.custommode) if (game.menupage == 1 && obj.flags[67] && game.press_action && !game.insecretlab && !map.custommode)
{ {
//Warp back to the ship //Warp back to the ship
graphics.resumegamemode = true; graphics.resumegamemode = true;

View file

@ -1766,7 +1766,7 @@ std::vector<std::string> labclass::loadlevel(int rx, int ry)
if(!game.intimetrial) if(!game.intimetrial)
{ {
if(game.companion==0 && obj.flags[9]==0 && !game.crewstats[5]) //also need to check if he's rescued in a previous game if(game.companion==0 && !obj.flags[9] && !game.crewstats[5]) //also need to check if he's rescued in a previous game
{ {
obj.createentity(32, 177, 18, 16, 1, 17, 1); obj.createentity(32, 177, 18, 16, 1, 17, 1);
obj.createblock(1, 24*8, 0, 32, 240, 33); obj.createblock(1, 24*8, 0, 32, 240, 33);

View file

@ -1333,7 +1333,7 @@ void gamelogic()
//intermission 2, choose colour based on lastsaved //intermission 2, choose colour based on lastsaved
if (game.roomy == 51) if (game.roomy == 51)
{ {
if (obj.flags[59] == 0) if (!obj.flags[59])
{ {
obj.createentity(225.0f, 169.0f, 18, graphics.crewcolour(game.lastsaved), 0, 10); obj.createentity(225.0f, 169.0f, 18, graphics.crewcolour(game.lastsaved), 0, 10);
j = obj.getcompanion(); j = obj.getcompanion();
@ -1343,7 +1343,7 @@ void gamelogic()
} }
else if (game.roomy >= 52) else if (game.roomy >= 52)
{ {
if (obj.flags[59] == 1) if (obj.flags[59])
{ {
obj.createentity(160.0f, 177.0f, 18, graphics.crewcolour(game.lastsaved), 0, 18, 1); obj.createentity(160.0f, 177.0f, 18, graphics.crewcolour(game.lastsaved), 0, 18, 1);
j = obj.getcompanion(); j = obj.getcompanion();
@ -1352,7 +1352,7 @@ void gamelogic()
} }
else else
{ {
obj.flags[59] = 1; obj.flags[59] = true;
obj.createentity(obj.entities[i].xp, -20.0f, 18.0f, graphics.crewcolour(game.lastsaved), 0, 10, 0); obj.createentity(obj.entities[i].xp, -20.0f, 18.0f, graphics.crewcolour(game.lastsaved), 0, 10, 0);
j = obj.getcompanion(); j = obj.getcompanion();
obj.entities[j].vx = obj.entities[i].vx; obj.entities[j].vx = obj.entities[i].vx;

View file

@ -1060,7 +1060,7 @@ void mapclass::gotoroom(int rx, int ry)
//textbox thingy. if tag five is not set when changing room, reset the game state. (tag 5 is set when you get back to the ship) //textbox thingy. if tag five is not set when changing room, reset the game state. (tag 5 is set when you get back to the ship)
if(!game.intimetrial && !custommode) if(!game.intimetrial && !custommode)
{ {
if (obj.flags[5] == 0 && !finalmode) if (!obj.flags[5] && !finalmode)
{ {
game.state = 0; game.state = 0;
if (game.roomx == 113 && game.roomy == 104) if (game.roomx == 113 && game.roomy == 104)

View file

@ -1415,7 +1415,7 @@ std::vector<std::string> otherlevelclass::loadlevel(int rx, int ry)
obj.createentity(136, 80, 22, 18); // (shiny trinket) obj.createentity(136, 80, 22, 18); // (shiny trinket)
obj.createentity(136, 32, 22, 19); // (shiny trinket) obj.createentity(136, 32, 22, 19); // (shiny trinket)
if(!game.nocutscenes && obj.flags[70]==0) if(!game.nocutscenes && !obj.flags[70])
{ {
obj.createblock(1, 304, 0, 16, 240, 48); obj.createblock(1, 304, 0, 16, 240, 48);
} }

View file

@ -1795,7 +1795,7 @@ void maprender()
{ {
graphics.Print(103, 220, "GRAV", 64, 64, 64); graphics.Print(103, 220, "GRAV", 64, 64, 64);
} }
else if (obj.flags[67] == 1 && !map.custommode) else if (obj.flags[67] && !map.custommode)
{ {
graphics.Print(103, 220, "SHIP", 64,64,64); graphics.Print(103, 220, "SHIP", 64,64,64);
} }
@ -2113,7 +2113,7 @@ void maprender()
} }
} }
} }
else if (obj.flags[67] == 1 && !map.custommode) else if (obj.flags[67] && !map.custommode)
{ {
graphics.Print(30, 220, "MAP", 64,64,64); graphics.Print(30, 220, "MAP", 64,64,64);
graphics.Print(103-8, 220, "[SHIP]", 196, 196, 255 - help.glow); graphics.Print(103-8, 220, "[SHIP]", 196, 196, 255 - help.glow);
@ -2234,7 +2234,7 @@ void maprender()
{ {
graphics.Print(103, 220, "GRAV", 64, 64, 64); graphics.Print(103, 220, "GRAV", 64, 64, 64);
} }
else if (obj.flags[67] == 1 && !map.custommode) else if (obj.flags[67] && !map.custommode)
{ {
graphics.Print(103, 220, "SHIP", 64,64,64); graphics.Print(103, 220, "SHIP", 64,64,64);
} }
@ -2304,7 +2304,7 @@ void maprender()
{ {
graphics.Print(103, 220, "GRAV", 64, 64, 64); graphics.Print(103, 220, "GRAV", 64, 64, 64);
} }
else if (obj.flags[67] == 1 && !map.custommode) else if (obj.flags[67] && !map.custommode)
{ {
graphics.Print(103, 220, "SHIP", 64,64,64); graphics.Print(103, 220, "SHIP", 64,64,64);
} }

View file

@ -171,7 +171,7 @@ void scriptclass::run()
} }
else if (words[0] == "customifflag") else if (words[0] == "customifflag")
{ {
if (obj.flags[ss_toi(words[1])]==1) if (obj.flags[ss_toi(words[1])])
{ {
load("custom_"+words[2]); load("custom_"+words[2]);
position--; position--;
@ -194,9 +194,9 @@ void scriptclass::run()
{ {
if(ss_toi(words[1])>=0 && ss_toi(words[1])<100){ if(ss_toi(words[1])>=0 && ss_toi(words[1])<100){
if(words[2]=="on"){ if(words[2]=="on"){
obj.changeflag(ss_toi(words[1]),1); obj.changeflag(ss_toi(words[1]),true);
}else if(words[2]=="off"){ }else if(words[2]=="off"){
obj.changeflag(ss_toi(words[1]),0); obj.changeflag(ss_toi(words[1]),false);
} }
} }
} }
@ -1305,7 +1305,7 @@ void scriptclass::run()
} }
else if (words[0] == "ifflag") else if (words[0] == "ifflag")
{ {
if (obj.flags[ss_toi(words[1])]==1) if (obj.flags[ss_toi(words[1])])
{ {
load(words[2]); load(words[2]);
position--; position--;
@ -2039,12 +2039,12 @@ void scriptclass::run()
} }
else if (words[0] == "trinketbluecontrol") else if (words[0] == "trinketbluecontrol")
{ {
if (game.trinkets() == 20 && obj.flags[67] == 1) if (game.trinkets() == 20 && obj.flags[67])
{ {
load("talkblue_trinket6"); load("talkblue_trinket6");
position--; position--;
} }
else if (game.trinkets() >= 19 && obj.flags[67] == 0) else if (game.trinkets() >= 19 && !obj.flags[67])
{ {
load("talkblue_trinket5"); load("talkblue_trinket5");
position--; position--;
@ -2093,70 +2093,70 @@ void scriptclass::run()
position--; position--;
} }
} }
else if (obj.flags[67] == 1) else if (obj.flags[67])
{ {
//game complete //game complete
load("talkred_13"); load("talkred_13");
position--; position--;
} }
else if (obj.flags[35] == 1 && obj.flags[52] == 0) else if (obj.flags[35] && !obj.flags[52])
{ {
//Intermission level //Intermission level
obj.flags[52] = 1; obj.flags[52] = true;
load("talkred_9"); load("talkred_9");
position--; position--;
} }
else if (obj.flags[51] == 0) else if (!obj.flags[51])
{ {
//We're back home! //We're back home!
obj.flags[51] = 1; obj.flags[51] = true;
load("talkred_5"); load("talkred_5");
position--; position--;
} }
else if (obj.flags[48] == 0 && game.crewstats[5]) else if (!obj.flags[48] && game.crewstats[5])
{ {
//Victoria's back //Victoria's back
obj.flags[48] = 1; obj.flags[48] = true;
load("talkred_6"); load("talkred_6");
position--; position--;
} }
else if (obj.flags[49] == 0 && game.crewstats[4]) else if (!obj.flags[49] && game.crewstats[4])
{ {
//Verdigris' back //Verdigris' back
obj.flags[49] = 1; obj.flags[49] = true;
load("talkred_7"); load("talkred_7");
position--; position--;
} }
else if (obj.flags[50] == 0 && game.crewstats[2]) else if (!obj.flags[50] && game.crewstats[2])
{ {
//Vitellary's back //Vitellary's back
obj.flags[50] = 1; obj.flags[50] = true;
load("talkred_8"); load("talkred_8");
position--; position--;
} }
else if (obj.flags[45] == 0 && !game.crewstats[5]) else if (!obj.flags[45] && !game.crewstats[5])
{ {
obj.flags[45] = 1; obj.flags[45] = true;
load("talkred_2"); load("talkred_2");
position--; position--;
} }
else if (obj.flags[46] == 0 && !game.crewstats[4]) else if (!obj.flags[46] && !game.crewstats[4])
{ {
obj.flags[46] = 1; obj.flags[46] = true;
load("talkred_3"); load("talkred_3");
position--; position--;
} }
else if (obj.flags[47] == 0 && !game.crewstats[2]) else if (!obj.flags[47] && !game.crewstats[2])
{ {
obj.flags[47] = 1; obj.flags[47] = true;
load("talkred_4"); load("talkred_4");
position--; position--;
} }
else else
{ {
obj.flags[45] = 0; obj.flags[45] = false;
obj.flags[46] = 0; obj.flags[46] = false;
obj.flags[47] = 0; obj.flags[47] = false;
load("talkred_1"); load("talkred_1");
position--; position--;
} }
@ -2179,47 +2179,47 @@ void scriptclass::run()
load("talkgreen_9"); load("talkgreen_9");
position--; position--;
} }
else if (obj.flags[67] == 1) else if (obj.flags[67])
{ {
//game complete //game complete
load("talkgreen_10"); load("talkgreen_10");
position--; position--;
} }
else if (obj.flags[34] == 1 && obj.flags[57] == 0) else if (obj.flags[34] && !obj.flags[57])
{ {
//Intermission level //Intermission level
obj.flags[57] = 1; obj.flags[57] = true;
load("talkgreen_7"); load("talkgreen_7");
position--; position--;
} }
else if (obj.flags[53] == 0) else if (!obj.flags[53])
{ {
//Home! //Home!
obj.flags[53] = 1; obj.flags[53] = true;
load("talkgreen_6"); load("talkgreen_6");
position--; position--;
} }
else if (obj.flags[54] == 0 && game.crewstats[2]) else if (!obj.flags[54] && game.crewstats[2])
{ {
obj.flags[54] = 1; obj.flags[54] = true;
load("talkgreen_5"); load("talkgreen_5");
position--; position--;
} }
else if (obj.flags[55] == 0 && game.crewstats[3]) else if (!obj.flags[55] && game.crewstats[3])
{ {
obj.flags[55] = 1; obj.flags[55] = true;
load("talkgreen_4"); load("talkgreen_4");
position--; position--;
} }
else if (obj.flags[56] == 0 && game.crewstats[5]) else if (!obj.flags[56] && game.crewstats[5])
{ {
obj.flags[56] = 1; obj.flags[56] = true;
load("talkgreen_3"); load("talkgreen_3");
position--; position--;
} }
else if (obj.flags[58] == 0) else if (!obj.flags[58])
{ {
obj.flags[58] = 1; obj.flags[58] = true;
load("talkgreen_2"); load("talkgreen_2");
position--; position--;
} }
@ -2236,20 +2236,20 @@ void scriptclass::run()
load("talkblue_9"); load("talkblue_9");
position--; position--;
} }
else if (obj.flags[67] == 1) else if (obj.flags[67])
{ {
//game complete, everything changes for victoria //game complete, everything changes for victoria
if (obj.flags[41] == 1 && obj.flags[42] == 0) if (obj.flags[41] && !obj.flags[42])
{ {
//second trinket conversation //second trinket conversation
obj.flags[42] = 1; obj.flags[42] = true;
load("talkblue_trinket2"); load("talkblue_trinket2");
position--; position--;
} }
else if (obj.flags[41] == 0 && obj.flags[42] == 0) else if (!obj.flags[41] && !obj.flags[42])
{ {
//Third trinket conversation //Third trinket conversation
obj.flags[42] = 1; obj.flags[42] = true;
load("talkblue_trinket3"); load("talkblue_trinket3");
position--; position--;
} }
@ -2268,56 +2268,56 @@ void scriptclass::run()
} }
} }
} }
else if (obj.flags[33] == 1 && obj.flags[40] == 0) else if (obj.flags[33] && !obj.flags[40])
{ {
//Intermission level //Intermission level
obj.flags[40] = 1; obj.flags[40] = true;
load("talkblue_7"); load("talkblue_7");
position--; position--;
} }
else if (obj.flags[36] == 0 && game.crewstats[5]) else if (!obj.flags[36] && game.crewstats[5])
{ {
//Back on the ship! //Back on the ship!
obj.flags[36] = 1; obj.flags[36] = true;
load("talkblue_3"); load("talkblue_3");
position--; position--;
} }
else if (obj.flags[41] == 0 && game.crewrescued() <= 4) else if (!obj.flags[41] && game.crewrescued() <= 4)
{ {
//First trinket conversation //First trinket conversation
obj.flags[41] = 1; obj.flags[41] = true;
load("talkblue_trinket1"); load("talkblue_trinket1");
position--; position--;
} }
else if (obj.flags[41] == 1 && obj.flags[42] == 0 && game.crewrescued() == 5) else if (obj.flags[41] && !obj.flags[42] && game.crewrescued() == 5)
{ {
//second trinket conversation //second trinket conversation
obj.flags[42] = 1; obj.flags[42] = true;
load("talkblue_trinket2"); load("talkblue_trinket2");
position--; position--;
} }
else if (obj.flags[41] == 0 && obj.flags[42] == 0 && game.crewrescued() == 5) else if (!obj.flags[41] && !obj.flags[42] && game.crewrescued() == 5)
{ {
//Third trinket conversation //Third trinket conversation
obj.flags[42] = 1; obj.flags[42] = true;
load("talkblue_trinket3"); load("talkblue_trinket3");
position--; position--;
} }
else if (obj.flags[37] == 0 && game.crewstats[2]) else if (!obj.flags[37] && game.crewstats[2])
{ {
obj.flags[37] = 1; obj.flags[37] = true;
load("talkblue_4"); load("talkblue_4");
position--; position--;
} }
else if (obj.flags[38] == 0 && game.crewstats[3]) else if (!obj.flags[38] && game.crewstats[3])
{ {
obj.flags[38] = 1; obj.flags[38] = true;
load("talkblue_5"); load("talkblue_5");
position--; position--;
} }
else if (obj.flags[39] == 0 && game.crewstats[4]) else if (!obj.flags[39] && game.crewstats[4])
{ {
obj.flags[39] = 1; obj.flags[39] = true;
load("talkblue_6"); load("talkblue_6");
position--; position--;
} }
@ -2344,75 +2344,75 @@ void scriptclass::run()
load("talkyellow_12"); load("talkyellow_12");
position--; position--;
} }
else if (obj.flags[67] == 1) else if (obj.flags[67])
{ {
//game complete //game complete
load("talkyellow_11"); load("talkyellow_11");
position--; position--;
} }
else if (obj.flags[32] == 1 && obj.flags[31] == 0) else if (obj.flags[32] && !obj.flags[31])
{ {
//Intermission level //Intermission level
obj.flags[31] = 1; obj.flags[31] = true;
load("talkyellow_6"); load("talkyellow_6");
position--; position--;
} }
else if (obj.flags[27] == 0 && game.crewstats[2]) else if (!obj.flags[27] && game.crewstats[2])
{ {
//Back on the ship! //Back on the ship!
obj.flags[27] = 1; obj.flags[27] = true;
load("talkyellow_10"); load("talkyellow_10");
position--; position--;
} }
else if (obj.flags[43] == 0 && game.crewrescued() == 5 && !game.crewstats[5]) else if (!obj.flags[43] && game.crewrescued() == 5 && !game.crewstats[5])
{ {
//If by chance we've rescued everyone except Victoria by the end, Vitellary provides you with //If by chance we've rescued everyone except Victoria by the end, Vitellary provides you with
//the trinket information instead. //the trinket information instead.
obj.flags[43] = 1; obj.flags[43] = true;
obj.flags[42] = 1; obj.flags[42] = true;
obj.flags[41] = 1; obj.flags[41] = true;
load("talkyellow_trinket1"); load("talkyellow_trinket1");
position--; position--;
} }
else if (obj.flags[24] == 0 && game.crewstats[5]) else if (!obj.flags[24] && game.crewstats[5])
{ {
obj.flags[24] = 1; obj.flags[24] = true;
load("talkyellow_8"); load("talkyellow_8");
position--; position--;
} }
else if (obj.flags[26] == 0 && game.crewstats[4]) else if (!obj.flags[26] && game.crewstats[4])
{ {
obj.flags[26] = 1; obj.flags[26] = true;
load("talkyellow_7"); load("talkyellow_7");
position--; position--;
} }
else if (obj.flags[25] == 0 && game.crewstats[3]) else if (!obj.flags[25] && game.crewstats[3])
{ {
obj.flags[25] = 1; obj.flags[25] = true;
load("talkyellow_9"); load("talkyellow_9");
position--; position--;
} }
else if (obj.flags[28] == 0) else if (!obj.flags[28])
{ {
obj.flags[28] = 1; obj.flags[28] = true;
load("talkyellow_3"); load("talkyellow_3");
position--; position--;
} }
else if (obj.flags[29] == 0) else if (!obj.flags[29])
{ {
obj.flags[29] = 1; obj.flags[29] = true;
load("talkyellow_4"); load("talkyellow_4");
position--; position--;
} }
else if (obj.flags[30] == 0) else if (!obj.flags[30])
{ {
obj.flags[30] = 1; obj.flags[30] = true;
load("talkyellow_5"); load("talkyellow_5");
position--; position--;
} }
else if (obj.flags[23] == 0) else if (!obj.flags[23])
{ {
obj.flags[23] = 1; obj.flags[23] = true;
load("talkyellow_2"); load("talkyellow_2");
position--; position--;
} }
@ -2420,7 +2420,7 @@ void scriptclass::run()
{ {
load("talkyellow_1"); load("talkyellow_1");
position--; position--;
obj.flags[23] = 0; obj.flags[23] = false;
} }
} }
else if (words[0] == "purplecontrol") else if (words[0] == "purplecontrol")
@ -2432,68 +2432,68 @@ void scriptclass::run()
load("talkpurple_9"); load("talkpurple_9");
position--; position--;
} }
else if (obj.flags[67] == 1) else if (obj.flags[67])
{ {
//game complete //game complete
load("talkpurple_8"); load("talkpurple_8");
position--; position--;
} }
else if (obj.flags[17] == 0 && game.crewstats[4]) else if (!obj.flags[17] && game.crewstats[4])
{ {
obj.flags[17] = 1; obj.flags[17] = true;
load("talkpurple_6"); load("talkpurple_6");
position--; position--;
} }
else if (obj.flags[15] == 0 && game.crewstats[5]) else if (!obj.flags[15] && game.crewstats[5])
{ {
obj.flags[15] = 1; obj.flags[15] = true;
load("talkpurple_4"); load("talkpurple_4");
position--; position--;
} }
else if (obj.flags[16] == 0 && game.crewstats[3]) else if (!obj.flags[16] && game.crewstats[3])
{ {
obj.flags[16] = 1; obj.flags[16] = true;
load("talkpurple_5"); load("talkpurple_5");
position--; position--;
} }
else if (obj.flags[18] == 0 && game.crewstats[2]) else if (!obj.flags[18] && game.crewstats[2])
{ {
obj.flags[18] = 1; obj.flags[18] = true;
load("talkpurple_7"); load("talkpurple_7");
position--; position--;
} }
else if (obj.flags[19] == 1 && obj.flags[20] == 0 && obj.flags[21] == 0) else if (obj.flags[19] && !obj.flags[20] && !obj.flags[21])
{ {
//intermission one: if played one / not had first conversation / not played two [conversation one] //intermission one: if played one / not had first conversation / not played two [conversation one]
obj.flags[21] = 1; obj.flags[21] = true;
load("talkpurple_intermission1"); load("talkpurple_intermission1");
position--; position--;
} }
else if (obj.flags[20] == 1 && obj.flags[21] == 1 && obj.flags[22] == 0) else if (obj.flags[20] && obj.flags[21] && !obj.flags[22])
{ {
//intermission two: if played two / had first conversation / not had second conversation [conversation two] //intermission two: if played two / had first conversation / not had second conversation [conversation two]
obj.flags[22] = 1; obj.flags[22] = true;
load("talkpurple_intermission2"); load("talkpurple_intermission2");
position--; position--;
} }
else if (obj.flags[20] == 1 && obj.flags[21] == 0 && obj.flags[22] == 0) else if (obj.flags[20] && !obj.flags[21] && !obj.flags[22])
{ {
//intermission two: if played two / not had first conversation / not had second conversation [conversation three] //intermission two: if played two / not had first conversation / not had second conversation [conversation three]
obj.flags[22] = 1; obj.flags[22] = true;
load("talkpurple_intermission3"); load("talkpurple_intermission3");
position--; position--;
} }
else if (obj.flags[12] == 0) else if (!obj.flags[12])
{ {
//Intro conversation //Intro conversation
obj.flags[12] = 1; obj.flags[12] = true;
load("talkpurple_intro"); load("talkpurple_intro");
position--; position--;
} }
else if (obj.flags[14] == 0) else if (!obj.flags[14])
{ {
//Shorter intro conversation //Shorter intro conversation
obj.flags[14] = 1; obj.flags[14] = true;
load("talkpurple_3"); load("talkpurple_3");
position--; position--;
} }

View file

@ -1977,11 +1977,11 @@ std::vector<std::string> spacestation2class::loadlevel(int rx, int ry)
} }
else else
{ {
if(obj.flags[7] == 0) if(!obj.flags[7])
{ {
if (game.nocutscenes) if (game.nocutscenes)
{ {
obj.changeflag(7, 1); obj.changeflag(7, true);
game.teleportscript = "levelonecomplete"; game.teleportscript = "levelonecomplete";
} }
else else
@ -2419,7 +2419,7 @@ std::vector<std::string> spacestation2class::loadlevel(int rx, int ry)
if(!game.intimetrial) if(!game.intimetrial)
{ {
if(game.companion==0 && obj.flags[10]==0 && !game.crewstats[2]) //also need to check if he's rescued in a previous game if(game.companion==0 && !obj.flags[10] && !game.crewstats[2]) //also need to check if he's rescued in a previous game
{ {
obj.createentity(42, 86, 16, 0); obj.createentity(42, 86, 16, 0);
obj.createblock(1, 0, 0, 140, 240, 34); obj.createblock(1, 0, 0, 140, 240, 34);
@ -2560,10 +2560,10 @@ std::vector<std::string> spacestation2class::loadlevel(int rx, int ry)
if(!game.nocutscenes) if(!game.nocutscenes)
{ {
if(obj.flags[68]==0) if(!obj.flags[68])
{ {
obj.createblock(1, 32, 0, 320, 240, 17); obj.createblock(1, 32, 0, 320, 240, 17);
obj.flags[68] = 1; obj.flags[68] = true;
} }
} }
roomname = "Quicksand"; roomname = "Quicksand";

View file

@ -977,7 +977,7 @@ std::vector<std::string> warpclass::loadlevel(int rx, int ry)
if(!game.intimetrial) if(!game.intimetrial)
{ {
if(game.companion==0 && obj.flags[11]==0 && !game.crewstats[4]) //also need to check if he's rescued in a previous game if(game.companion==0 && !obj.flags[11] && !game.crewstats[4]) //also need to check if he's rescued in a previous game
{ {
obj.createentity(255, 121, 15, 0); obj.createentity(255, 121, 15, 0);
obj.createblock(1, 215, 0, 160, 240, 35); obj.createblock(1, 215, 0, 160, 240, 35);