mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Change obj.collect into a vector of bools
It's already treated like a bunch of bools anyway, so might as well just formalize it.
This commit is contained in:
parent
7493129044
commit
8507bdc65d
5 changed files with 19 additions and 19 deletions
|
@ -1368,7 +1368,7 @@ void entityclass::createentity( float xp, float yp, int t, float vx /*= 0*/, flo
|
||||||
|
|
||||||
//Check if it's already been collected
|
//Check if it's already been collected
|
||||||
entity.para = vx;
|
entity.para = vx;
|
||||||
if (collect[vx] == 1) return;
|
if (collect[vx]) return;
|
||||||
break;
|
break;
|
||||||
case 9: //Something Shiny
|
case 9: //Something Shiny
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
|
@ -1385,7 +1385,7 @@ void entityclass::createentity( float xp, float yp, int t, float vx /*= 0*/, flo
|
||||||
|
|
||||||
//Check if it's already been collected
|
//Check if it's already been collected
|
||||||
entity.para = vx;
|
entity.para = vx;
|
||||||
if (collect[vx] == 1) return;
|
if (collect[vx]) return;
|
||||||
break;
|
break;
|
||||||
case 10: //Savepoint
|
case 10: //Savepoint
|
||||||
entity.rule = 3;
|
entity.rule = 3;
|
||||||
|
@ -1607,7 +1607,7 @@ void entityclass::createentity( float xp, float yp, int t, float vx /*= 0*/, flo
|
||||||
|
|
||||||
//Check if it's already been collected
|
//Check if it's already been collected
|
||||||
entity.para = vx;
|
entity.para = vx;
|
||||||
if (collect[ (vx)] == 0) return;
|
if (!collect[ (vx)]) return;
|
||||||
break;
|
break;
|
||||||
case 23: //SWN Enemies
|
case 23: //SWN Enemies
|
||||||
//Given a different behavior, these enemies are especially for SWN mode and disappear outside the screen.
|
//Given a different behavior, these enemies are especially for SWN mode and disappear outside the screen.
|
||||||
|
@ -2467,7 +2467,7 @@ void entityclass::updateentities( int i )
|
||||||
if (entities[i].state == 1)
|
if (entities[i].state == 1)
|
||||||
{
|
{
|
||||||
music.playef(4);
|
music.playef(4);
|
||||||
collect[entities[i].para] = 1;
|
collect[entities[i].para] = true;
|
||||||
|
|
||||||
removeentity(i);
|
removeentity(i);
|
||||||
}
|
}
|
||||||
|
@ -2478,7 +2478,7 @@ void entityclass::updateentities( int i )
|
||||||
{
|
{
|
||||||
if (game.intimetrial)
|
if (game.intimetrial)
|
||||||
{
|
{
|
||||||
collect[entities[i].para] = 1;
|
collect[entities[i].para] = true;
|
||||||
music.playef(25);
|
music.playef(25);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2486,7 +2486,7 @@ void entityclass::updateentities( int i )
|
||||||
game.state = 1000;
|
game.state = 1000;
|
||||||
if(music.currentsong!=-1) music.silencedasmusik();
|
if(music.currentsong!=-1) music.silencedasmusik();
|
||||||
music.playef(3);
|
music.playef(3);
|
||||||
collect[entities[i].para] = 1;
|
collect[entities[i].para] = true;
|
||||||
if (game.trinkets() > game.stat_trinkets && !map.custommode)
|
if (game.trinkets() > game.stat_trinkets && !map.custommode)
|
||||||
{
|
{
|
||||||
game.stat_trinkets = game.trinkets();
|
game.stat_trinkets = game.trinkets();
|
||||||
|
|
|
@ -185,7 +185,7 @@ public:
|
||||||
|
|
||||||
std::vector<blockclass> blocks;
|
std::vector<blockclass> blocks;
|
||||||
std::vector<bool> flags;
|
std::vector<bool> flags;
|
||||||
std::vector<int> collect;
|
std::vector<bool> collect;
|
||||||
std::vector<int> customcollect;
|
std::vector<int> customcollect;
|
||||||
|
|
||||||
bool skipblocks, skipdirblocks;
|
bool skipblocks, skipdirblocks;
|
||||||
|
|
|
@ -5010,7 +5010,7 @@ void Game::loadquick()
|
||||||
obj.collect.clear();
|
obj.collect.clear();
|
||||||
for(size_t i = 0; i < values.size(); i++)
|
for(size_t i = 0; i < values.size(); i++)
|
||||||
{
|
{
|
||||||
obj.collect.push_back(atoi(values[i].c_str()));
|
obj.collect.push_back((bool) atoi(values[i].c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5250,7 +5250,7 @@ void Game::customloadquick(std::string savfile)
|
||||||
obj.collect.clear();
|
obj.collect.clear();
|
||||||
for(size_t i = 0; i < values.size(); i++)
|
for(size_t i = 0; i < values.size(); i++)
|
||||||
{
|
{
|
||||||
obj.collect.push_back(atoi(values[i].c_str()));
|
obj.collect.push_back((bool) atoi(values[i].c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5660,7 +5660,7 @@ void Game::savetele()
|
||||||
std::string collect;
|
std::string collect;
|
||||||
for(size_t i = 0; i < obj.collect.size(); i++ )
|
for(size_t i = 0; i < obj.collect.size(); i++ )
|
||||||
{
|
{
|
||||||
collect += help.String(obj.collect[i]) + ",";
|
collect += help.String((int) obj.collect[i]) + ",";
|
||||||
}
|
}
|
||||||
msg = new TiXmlElement( "collect" );
|
msg = new TiXmlElement( "collect" );
|
||||||
msg->LinkEndChild( new TiXmlText( collect.c_str() ));
|
msg->LinkEndChild( new TiXmlText( collect.c_str() ));
|
||||||
|
@ -5857,7 +5857,7 @@ void Game::savequick()
|
||||||
std::string collect;
|
std::string collect;
|
||||||
for(size_t i = 0; i < obj.collect.size(); i++ )
|
for(size_t i = 0; i < obj.collect.size(); i++ )
|
||||||
{
|
{
|
||||||
collect += help.String(obj.collect[i]) + ",";
|
collect += help.String((int) obj.collect[i]) + ",";
|
||||||
}
|
}
|
||||||
msg = new TiXmlElement( "collect" );
|
msg = new TiXmlElement( "collect" );
|
||||||
msg->LinkEndChild( new TiXmlText( collect.c_str() ));
|
msg->LinkEndChild( new TiXmlText( collect.c_str() ));
|
||||||
|
@ -6056,7 +6056,7 @@ void Game::customsavequick(std::string savfile)
|
||||||
std::string collect;
|
std::string collect;
|
||||||
for(size_t i = 0; i < obj.collect.size(); i++ )
|
for(size_t i = 0; i < obj.collect.size(); i++ )
|
||||||
{
|
{
|
||||||
collect += help.String(obj.collect[i]) + ",";
|
collect += help.String((int) obj.collect[i]) + ",";
|
||||||
}
|
}
|
||||||
msg = new TiXmlElement( "collect" );
|
msg = new TiXmlElement( "collect" );
|
||||||
msg->LinkEndChild( new TiXmlText( collect.c_str() ));
|
msg->LinkEndChild( new TiXmlText( collect.c_str() ));
|
||||||
|
@ -6290,7 +6290,7 @@ void Game::loadtele()
|
||||||
obj.collect.clear();
|
obj.collect.clear();
|
||||||
for(size_t i = 0; i < values.size(); i++)
|
for(size_t i = 0; i < values.size(); i++)
|
||||||
{
|
{
|
||||||
obj.collect.push_back(atoi(values[i].c_str()));
|
obj.collect.push_back((bool) atoi(values[i].c_str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7633,7 +7633,7 @@ void Game::resetgameclock()
|
||||||
|
|
||||||
int Game::trinkets()
|
int Game::trinkets()
|
||||||
{
|
{
|
||||||
return std::count(obj.collect.begin(), obj.collect.end(), 1);
|
return std::count(obj.collect.begin(), obj.collect.end(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Game::crewmates()
|
int Game::crewmates()
|
||||||
|
|
|
@ -2028,7 +2028,7 @@ void maprender()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < map.numshinytrinkets; i++)
|
for (int i = 0; i < map.numshinytrinkets; i++)
|
||||||
{
|
{
|
||||||
if (obj.collect[i] == 0)
|
if (!obj.collect[i])
|
||||||
{
|
{
|
||||||
int temp = 1086;
|
int temp = 1086;
|
||||||
if (graphics.flipmode) temp += 3;
|
if (graphics.flipmode) temp += 3;
|
||||||
|
@ -2839,7 +2839,7 @@ void teleporterrender()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < map.numshinytrinkets; i++)
|
for (int i = 0; i < map.numshinytrinkets; i++)
|
||||||
{
|
{
|
||||||
if (obj.collect[i] == 0)
|
if (!obj.collect[i])
|
||||||
{
|
{
|
||||||
temp = 1086;
|
temp = 1086;
|
||||||
if (graphics.flipmode) temp += 3;
|
if (graphics.flipmode) temp += 3;
|
||||||
|
|
|
@ -1468,7 +1468,7 @@ void scriptclass::run()
|
||||||
|
|
||||||
for (i = 0; i < 100; i++)
|
for (i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
obj.collect[i] = 0;
|
obj.collect[i] = false;
|
||||||
obj.customcollect[i] = 0;
|
obj.customcollect[i] = 0;
|
||||||
}
|
}
|
||||||
game.deathcounts = 0;
|
game.deathcounts = 0;
|
||||||
|
@ -1877,7 +1877,7 @@ void scriptclass::run()
|
||||||
music.haltdasmusik();
|
music.haltdasmusik();
|
||||||
music.playef(3);
|
music.playef(3);
|
||||||
|
|
||||||
obj.collect[ss_toi(words[1])] = 1;
|
obj.collect[ss_toi(words[1])] = true;
|
||||||
|
|
||||||
graphics.textboxremovefast();
|
graphics.textboxremovefast();
|
||||||
|
|
||||||
|
@ -3560,7 +3560,7 @@ void scriptclass::hardreset()
|
||||||
|
|
||||||
for (i = 0; i < 100; i++)
|
for (i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
obj.collect[i] = 0;
|
obj.collect[i] = false;
|
||||||
obj.customcollect[i] = 0;
|
obj.customcollect[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue