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

Don't use separate variable for number of crewmates in level

Same as previous commit, this time for crewmates.
This commit is contained in:
Misa 2020-04-08 22:13:43 -07:00 committed by Ethan Lee
parent 0047dc8d81
commit 89b6b67a77
4 changed files with 33 additions and 28 deletions

View file

@ -2011,17 +2011,17 @@ void Game::updatestate()
graphics.addline("You have found a lost crewmate!");
graphics.textboxcenterx();
if(ed.numcrewmates-crewmates()==0)
if(ed.numcrewmates()-crewmates()==0)
{
graphics.createtextbox(" All crewmates rescued! ", 50, 65, 174, 174, 174);
}
else if(ed.numcrewmates-crewmates()==1)
else if(ed.numcrewmates()-crewmates()==1)
{
graphics.createtextbox(" " + help.number(ed.numcrewmates-crewmates())+ " remains ", 50, 65, 174, 174, 174);
graphics.createtextbox(" " + help.number(ed.numcrewmates()-crewmates())+ " remains ", 50, 65, 174, 174, 174);
}
else
{
graphics.createtextbox(" " + help.number(ed.numcrewmates-crewmates())+ " remain ", 50, 65, 174, 174, 174);
graphics.createtextbox(" " + help.number(ed.numcrewmates()-crewmates())+ " remain ", 50, 65, 174, 174, 174);
}
graphics.textboxcenterx();
@ -2033,17 +2033,17 @@ void Game::updatestate()
graphics.addline("You have found a lost crewmate!");
graphics.textboxcenterx();
if(ed.numcrewmates-crewmates()==0)
if(ed.numcrewmates()-crewmates()==0)
{
graphics.createtextbox(" All crewmates rescued! ", 50, 135, 174, 174, 174);
}
else if(ed.numcrewmates-crewmates()==1)
else if(ed.numcrewmates()-crewmates()==1)
{
graphics.createtextbox(" " + help.number(ed.numcrewmates-crewmates())+ " remains ", 50, 135, 174, 174, 174);
graphics.createtextbox(" " + help.number(ed.numcrewmates()-crewmates())+ " remains ", 50, 135, 174, 174, 174);
}
else
{
graphics.createtextbox(" " + help.number(ed.numcrewmates-crewmates())+ " remain ", 50, 135, 174, 174, 174);
graphics.createtextbox(" " + help.number(ed.numcrewmates()-crewmates())+ " remain ", 50, 135, 174, 174, 174);
}
graphics.textboxcenterx();
}
@ -2055,7 +2055,7 @@ void Game::updatestate()
completestop = false;
state = 0;
if(ed.numcrewmates-crewmates()==0)
if(ed.numcrewmates()-crewmates()==0)
{
if(map.custommodeforreal)
{
@ -2092,7 +2092,7 @@ void Game::updatestate()
map.tdrawback = true;
#if !defined(NO_CUSTOM_LEVELS)
//Update level stats
if(ed.numcrewmates-crewmates()==0)
if(ed.numcrewmates()-crewmates()==0)
{
//Finished level
if(ed.numtrinkets()-trinkets()==0)

View file

@ -2138,10 +2138,10 @@ void maprender()
graphics.Print( -1, 220-110, ed.ListOfMetaData[game.playcustomlevel].Desc2, 196, 196, 255 - help.glow, true);
graphics.Print( -1, 220-120, ed.ListOfMetaData[game.playcustomlevel].Desc3, 196, 196, 255 - help.glow, true);
if(ed.numcrewmates-game.crewmates()==1){
graphics.Print(1,220-165, help.number(ed.numcrewmates-game.crewmates())+ " crewmate remains", 196, 196, 255 - help.glow, true);
}else if(ed.numcrewmates-game.crewmates()>0){
graphics.Print(1,220-165, help.number(ed.numcrewmates-game.crewmates())+ " crewmates remain", 196, 196, 255 - help.glow, true);
if(ed.numcrewmates()-game.crewmates()==1){
graphics.Print(1,220-165, help.number(ed.numcrewmates()-game.crewmates())+ " crewmate remains", 196, 196, 255 - help.glow, true);
}else if(ed.numcrewmates()-game.crewmates()>0){
graphics.Print(1,220-165, help.number(ed.numcrewmates()-game.crewmates())+ " crewmates remain", 196, 196, 255 - help.glow, true);
}
}
else
@ -2153,10 +2153,10 @@ void maprender()
graphics.Print( -1, 110, ed.ListOfMetaData[game.playcustomlevel].Desc2, 196, 196, 255 - help.glow, true);
graphics.Print( -1, 120, ed.ListOfMetaData[game.playcustomlevel].Desc3, 196, 196, 255 - help.glow, true);
if(ed.numcrewmates-game.crewmates()==1){
graphics.Print(1,165, help.number(ed.numcrewmates-game.crewmates())+ " crewmate remains", 196, 196, 255 - help.glow, true);
}else if(ed.numcrewmates-game.crewmates()>0){
graphics.Print(1,165, help.number(ed.numcrewmates-game.crewmates())+ " crewmates remain", 196, 196, 255 - help.glow, true);
if(ed.numcrewmates()-game.crewmates()==1){
graphics.Print(1,165, help.number(ed.numcrewmates()-game.crewmates())+ " crewmate remains", 196, 196, 255 - help.glow, true);
}else if(ed.numcrewmates()-game.crewmates()>0){
graphics.Print(1,165, help.number(ed.numcrewmates()-game.crewmates())+ " crewmates remain", 196, 196, 255 - help.glow, true);
}
}
}

View file

@ -285,7 +285,6 @@ void editorclass::reset()
entframe=0;
entframedelay=0;
numcrewmates=0;
edentity.clear();
levmusic=0;
@ -1621,11 +1620,6 @@ int editorclass::findwarptoken(int t)
void editorclass::countstuff()
{
numcrewmates=0;
for(size_t i=0; i<edentity.size(); i++)
{
if(edentity[i].t==15) numcrewmates++;
}
}
void editorclass::load(std::string& _path)
@ -4920,11 +4914,10 @@ void editorinput()
}
else if(ed.drawmode==15) //Crewmate
{
if(ed.numcrewmates<100)
if(ed.numcrewmates()<100)
{
addedentity(ed.tilex+ (ed.levx*40),ed.tiley+ (ed.levy*30),15,1 + int(fRandom() * 5));
ed.lclickdelay=1;
ed.numcrewmates++;
}
else
{
@ -5047,7 +5040,6 @@ void editorinput()
{
if(edentity[i].x==ed.tilex + (ed.levx*40)&& edentity[i].y==ed.tiley+ (ed.levy*30))
{
if(edentity[i].t==15) ed.numcrewmates--;
removeedentity(i);
}
}
@ -5214,4 +5206,17 @@ int editorclass::numtrinkets()
return temp;
}
int editorclass::numcrewmates()
{
int temp = 0;
for (size_t i = 0; i < edentity.size(); i++)
{
if (edentity[i].t == 15)
{
temp++;
}
}
return temp;
}
#endif /* NO_CUSTOM_LEVELS */

View file

@ -152,7 +152,7 @@ class editorclass{
std::vector <int> contents;
std::vector <int> vmult;
int numtrinkets();
int numcrewmates;
int numcrewmates();
edlevelclass level[400]; //Maxwidth*maxheight
int kludgewarpdir[400]; //Also maxwidth*maxheight