mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Refactor entities and linecrosskludge to not use the 'active' system
This removes the variables obj.nentity and obj.nlinecrosskludge, as well as removing the 'active' attribute from the entity class object. Now every entity you access is guaranteed to be real and you don't have to check the 'active' variable. The biggest part of this is changing createentity() to modify a newly-created entity object and push it back instead of already modifying an indice in obj.entities. As well, removing an entity now uses the new obj.removeentity() function and removeentity_iter() macro.
This commit is contained in:
parent
a67ab8e3a7
commit
b1b1474b7b
12 changed files with 678 additions and 726 deletions
|
@ -8,7 +8,6 @@ entclass::entclass()
|
|||
void entclass::clear()
|
||||
{
|
||||
// Set all values to a default, required for creating a new entity
|
||||
active = false;
|
||||
invis = false;
|
||||
type = 0;
|
||||
size = 0;
|
||||
|
|
|
@ -20,7 +20,7 @@ public:
|
|||
|
||||
public:
|
||||
//Fundamentals
|
||||
bool active, invis;
|
||||
bool invis;
|
||||
int type, size, tile, rule;
|
||||
int state, statedelay;
|
||||
int behave, animate;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -181,10 +181,7 @@ public:
|
|||
|
||||
std::vector<entclass> entities;
|
||||
|
||||
int nentity;
|
||||
|
||||
std::vector<entclass> linecrosskludge;
|
||||
int nlinecrosskludge;
|
||||
|
||||
point colpoint1, colpoint2;
|
||||
|
||||
|
|
|
@ -2296,7 +2296,7 @@ void Game::updatestate()
|
|||
i = obj.getcompanion();
|
||||
if(i>-1)
|
||||
{
|
||||
obj.entities[i].active = false;
|
||||
obj.removeentity(i);
|
||||
}
|
||||
|
||||
i = obj.getteleporter();
|
||||
|
|
|
@ -1417,9 +1417,9 @@ void Graphics::drawentities()
|
|||
|
||||
trinketcolset = false;
|
||||
|
||||
for (int i = obj.nentity - 1; i >= 0; i--)
|
||||
for (int i = obj.entities.size() - 1; i >= 0; i--)
|
||||
{
|
||||
if (!obj.entities[i].invis && obj.entities[i].active)
|
||||
if (!obj.entities[i].invis)
|
||||
{
|
||||
if (obj.entities[i].size == 0)
|
||||
{
|
||||
|
@ -2429,9 +2429,9 @@ void Graphics::drawtowerentities()
|
|||
point tpoint;
|
||||
SDL_Rect trect;
|
||||
|
||||
for (int i = obj.nentity - 1; i >= 0; i--)
|
||||
for (int i = obj.entities.size() - 1; i >= 0; i--)
|
||||
{
|
||||
if (!obj.entities[i].invis && obj.entities[i].active)
|
||||
if (!obj.entities[i].invis)
|
||||
{
|
||||
if (obj.entities[i].size == 0) // Sprites
|
||||
{
|
||||
|
|
|
@ -1744,7 +1744,7 @@ void gameinput()
|
|||
#endif
|
||||
|
||||
//Entity type 0 is player controled
|
||||
for (int ie = 0; ie < obj.nentity; ++ie)
|
||||
for (size_t ie = 0; ie < obj.entities.size(); ++ie)
|
||||
{
|
||||
if (obj.entities[ie].rule == 0)
|
||||
{
|
||||
|
|
|
@ -347,7 +347,7 @@ void towerlogic()
|
|||
|
||||
if(!game.completestop)
|
||||
{
|
||||
for (int i = obj.nentity - 1; i >= 0; i--)
|
||||
for (int i = obj.entities.size() - 1; i >= 0; i--)
|
||||
{
|
||||
obj.updateentities(i); // Behavioral logic
|
||||
obj.updateentitylogic(i); // Basic Physics
|
||||
|
@ -411,7 +411,7 @@ void towerlogic()
|
|||
//Always wrap except for the very top and very bottom of the tower
|
||||
if(map.ypos>=500 && map.ypos <=5000)
|
||||
{
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
if (obj.entities[i].xp <= -10)
|
||||
{
|
||||
|
@ -557,7 +557,7 @@ void gamelogic()
|
|||
|
||||
if (game.deathseq != -1)
|
||||
{
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
if (game.roomx == 111 && game.roomy == 107 && !map.custommode)
|
||||
{
|
||||
|
@ -848,7 +848,7 @@ void gamelogic()
|
|||
obj.entities[obj.getlineat(148 + 32)].xp += 24;
|
||||
if (obj.entities[obj.getlineat(148 + 32)].xp > 320)
|
||||
{
|
||||
obj.entities[obj.getlineat(148 + 32)].active = false;
|
||||
obj.removeentity(obj.getlineat(148 + 32));
|
||||
game.swnmode = false;
|
||||
game.swngame = 6;
|
||||
}
|
||||
|
@ -937,7 +937,7 @@ void gamelogic()
|
|||
{
|
||||
if(obj.vertplatforms)
|
||||
{
|
||||
for (int i = obj.nentity - 1; i >= 0; i--)
|
||||
for (int i = obj.entities.size() - 1; i >= 0; i--)
|
||||
{
|
||||
if (obj.entities[i].isplatform)
|
||||
{
|
||||
|
@ -966,7 +966,7 @@ void gamelogic()
|
|||
|
||||
if(obj.horplatforms)
|
||||
{
|
||||
for (int ie = obj.nentity - 1; ie >= 0; ie--)
|
||||
for (int ie = obj.entities.size() - 1; ie >= 0; ie--)
|
||||
{
|
||||
if (obj.entities[ie].isplatform)
|
||||
{
|
||||
|
@ -1001,7 +1001,7 @@ void gamelogic()
|
|||
}
|
||||
}
|
||||
|
||||
for (int ie = obj.nentity - 1; ie >= 0; ie--)
|
||||
for (int ie = obj.entities.size() - 1; ie >= 0; ie--)
|
||||
{
|
||||
if (!obj.entities[ie].isplatform)
|
||||
{
|
||||
|
@ -1040,7 +1040,7 @@ void gamelogic()
|
|||
//Finally: Are we changing room?
|
||||
if (map.warpx && map.warpy)
|
||||
{
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
if(obj.entities[i].type<50){ //Don't warp warp lines
|
||||
if (obj.entities[i].size < 12) //Don't wrap SWN enemies
|
||||
|
@ -1060,7 +1060,7 @@ void gamelogic()
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
|
||||
if(obj.entities[i].type<50){ //Don't warp warp lines
|
||||
|
@ -1083,7 +1083,7 @@ void gamelogic()
|
|||
}
|
||||
else if (map.warpx)
|
||||
{
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
if(obj.entities[i].type<50){ //Don't warp warp lines
|
||||
if (obj.entities[i].size < 12) //Don't wrap SWN enemies
|
||||
|
@ -1135,7 +1135,7 @@ void gamelogic()
|
|||
}
|
||||
else if (map.warpy)
|
||||
{
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
if(obj.entities[i].type<50){ //Don't warp warp lines
|
||||
if (obj.entities[i].yp <= -12)
|
||||
|
@ -1152,7 +1152,7 @@ void gamelogic()
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
|
||||
if(obj.entities[i].type<50){ //Don't warp warp lines
|
||||
|
|
|
@ -515,7 +515,7 @@ void mapclass::changefinalcol(int t)
|
|||
final_mapcol = t;
|
||||
temp = 6 - t;
|
||||
//Next, entities
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
if (obj.entities[i].type == 1) //something with a movement behavior
|
||||
{
|
||||
|
@ -886,10 +886,10 @@ void mapclass::gotoroom(int rx, int ry)
|
|||
game.readytotele = 0;
|
||||
|
||||
//Ok, let's save the position of all lines on the screen
|
||||
obj.nlinecrosskludge = 0;
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
obj.linecrosskludge.clear();
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
if (obj.entities[i].type == 9 && obj.entities[i].active)
|
||||
if (obj.entities[i].type == 9)
|
||||
{
|
||||
//It's a horizontal line
|
||||
if (obj.entities[i].xp <= 0 || (obj.entities[i].xp + obj.entities[i].w) >= 312)
|
||||
|
@ -901,11 +901,12 @@ void mapclass::gotoroom(int rx, int ry)
|
|||
}
|
||||
|
||||
int theplayer = obj.getplayer();
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (int i = 0; i < (int) obj.entities.size(); i++)
|
||||
{
|
||||
if (i != theplayer)
|
||||
{
|
||||
obj.entities[i].active = false;
|
||||
removeentity_iter(i);
|
||||
theplayer--; //just in case indice of player is not 0
|
||||
}
|
||||
}
|
||||
obj.cleanup();
|
||||
|
@ -1084,15 +1085,15 @@ void mapclass::gotoroom(int rx, int ry)
|
|||
obj.entities[temp].oldyp = obj.entities[temp].yp;
|
||||
}
|
||||
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
if (obj.entities[i].type == 9 && obj.entities[i].active)
|
||||
if (obj.entities[i].type == 9)
|
||||
{
|
||||
//It's a horizontal line
|
||||
if (obj.entities[i].xp <= 0 || obj.entities[i].xp + obj.entities[i].w >= 312)
|
||||
{
|
||||
//it's on a screen edge
|
||||
for (j = 0; j < obj.nlinecrosskludge; j++)
|
||||
for (j = 0; j < (int) obj.linecrosskludge.size(); j++)
|
||||
{
|
||||
if (obj.entities[i].yp == obj.linecrosskludge[j].yp)
|
||||
{
|
||||
|
@ -1823,9 +1824,9 @@ void mapclass::loadlevel(int rx, int ry)
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
if (obj.entities[i].active)
|
||||
if (true) //FIXME: remove this later (no more 'active')
|
||||
{
|
||||
if (obj.entities[i].type == 1 && obj.entities[i].behave >= 8 && obj.entities[i].behave < 10)
|
||||
{
|
||||
|
@ -1965,7 +1966,7 @@ void mapclass::loadlevel(int rx, int ry)
|
|||
}
|
||||
|
||||
//Make sure our crewmates are facing the player if appliciable
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
if (obj.entities[i].rule == 6 || obj.entities[i].rule == 7)
|
||||
{
|
||||
|
|
|
@ -141,17 +141,17 @@ void scriptclass::run()
|
|||
if (words[0] == "destroy")
|
||||
{
|
||||
if(words[1]=="gravitylines"){
|
||||
for(int edi=0; edi<obj.nentity; edi++){
|
||||
if(obj.entities[edi].type==9) obj.entities[edi].active=false;
|
||||
if(obj.entities[edi].type==10) obj.entities[edi].active=false;
|
||||
for(size_t edi=0; edi<obj.entities.size(); edi++){
|
||||
if(obj.entities[edi].type==9) removeentity_iter(edi);
|
||||
if(obj.entities[edi].type==10) removeentity_iter(edi);
|
||||
}
|
||||
}else if(words[1]=="warptokens"){
|
||||
for(int edi=0; edi<obj.nentity; edi++){
|
||||
if(obj.entities[edi].type==11) obj.entities[edi].active=false;
|
||||
for(size_t edi=0; edi<obj.entities.size(); edi++){
|
||||
if(obj.entities[edi].type==11) removeentity_iter(edi);
|
||||
}
|
||||
}else if(words[1]=="platforms"){
|
||||
for(int edi=0; edi<obj.nentity; edi++){
|
||||
if(obj.entities[edi].rule==2 && obj.entities[edi].animate==100) obj.entities[edi].active=false;
|
||||
for(size_t edi=0; edi<obj.entities.size(); edi++){
|
||||
if(obj.entities[edi].rule==2 && obj.entities[edi].animate==100) removeentity_iter(edi);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1652,9 +1652,9 @@ void scriptclass::run()
|
|||
}
|
||||
else if (words[0] == "jukebox")
|
||||
{
|
||||
for (j = 0; j < obj.nentity; j++)
|
||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||
{
|
||||
if (obj.entities[j].type == 13 && obj.entities[j].active)
|
||||
if (obj.entities[j].type == 13)
|
||||
{
|
||||
obj.entities[j].colour = 4;
|
||||
}
|
||||
|
@ -1662,7 +1662,7 @@ void scriptclass::run()
|
|||
if (ss_toi(words[1]) == 1)
|
||||
{
|
||||
obj.createblock(5, 88 - 4, 80, 20, 16, 25);
|
||||
for (j = 0; j < obj.nentity; j++)
|
||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||
{
|
||||
if (obj.entities[j].xp == 88 && obj.entities[j].yp==80)
|
||||
{
|
||||
|
@ -1673,7 +1673,7 @@ void scriptclass::run()
|
|||
else if (ss_toi(words[1]) == 2)
|
||||
{
|
||||
obj.createblock(5, 128 - 4, 80, 20, 16, 26);
|
||||
for (j = 0; j < obj.nentity; j++)
|
||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||
{
|
||||
if (obj.entities[j].xp == 128 && obj.entities[j].yp==80)
|
||||
{
|
||||
|
@ -1684,7 +1684,7 @@ void scriptclass::run()
|
|||
else if (ss_toi(words[1]) == 3)
|
||||
{
|
||||
obj.createblock(5, 176 - 4, 80, 20, 16, 27);
|
||||
for (j = 0; j < obj.nentity; j++)
|
||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||
{
|
||||
if (obj.entities[j].xp == 176 && obj.entities[j].yp==80)
|
||||
{
|
||||
|
@ -1695,7 +1695,7 @@ void scriptclass::run()
|
|||
else if (ss_toi(words[1]) == 4)
|
||||
{
|
||||
obj.createblock(5, 216 - 4, 80, 20, 16, 28);
|
||||
for (j = 0; j < obj.nentity; j++)
|
||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||
{
|
||||
if (obj.entities[j].xp == 216 && obj.entities[j].yp==80)
|
||||
{
|
||||
|
@ -1706,7 +1706,7 @@ void scriptclass::run()
|
|||
else if (ss_toi(words[1]) == 5)
|
||||
{
|
||||
obj.createblock(5, 88 - 4, 128, 20, 16, 29);
|
||||
for (j = 0; j < obj.nentity; j++)
|
||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||
{
|
||||
if (obj.entities[j].xp == 88 && obj.entities[j].yp==128)
|
||||
{
|
||||
|
@ -1717,7 +1717,7 @@ void scriptclass::run()
|
|||
else if (ss_toi(words[1]) == 6)
|
||||
{
|
||||
obj.createblock(5, 176 - 4, 128, 20, 16, 30);
|
||||
for (j = 0; j < obj.nentity; j++)
|
||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||
{
|
||||
if (obj.entities[j].xp == 176 && obj.entities[j].yp==128)
|
||||
{
|
||||
|
@ -1728,7 +1728,7 @@ void scriptclass::run()
|
|||
else if (ss_toi(words[1]) == 7)
|
||||
{
|
||||
obj.createblock(5, 40 - 4, 40, 20, 16, 31);
|
||||
for (j = 0; j < obj.nentity; j++)
|
||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||
{
|
||||
if (obj.entities[j].xp == 40 && obj.entities[j].yp==40)
|
||||
{
|
||||
|
@ -1739,7 +1739,7 @@ void scriptclass::run()
|
|||
else if (ss_toi(words[1]) == 8)
|
||||
{
|
||||
obj.createblock(5, 216 - 4, 128, 20, 16, 32);
|
||||
for (j = 0; j < obj.nentity; j++)
|
||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||
{
|
||||
if (obj.entities[j].xp == 216 && obj.entities[j].yp==128)
|
||||
{
|
||||
|
@ -1750,7 +1750,7 @@ void scriptclass::run()
|
|||
else if (ss_toi(words[1]) == 9)
|
||||
{
|
||||
obj.createblock(5, 128 - 4, 128, 20, 16, 33);
|
||||
for (j = 0; j < obj.nentity; j++)
|
||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||
{
|
||||
if (obj.entities[j].xp == 128 && obj.entities[j].yp==128)
|
||||
{
|
||||
|
@ -1761,7 +1761,7 @@ void scriptclass::run()
|
|||
else if (ss_toi(words[1]) == 10)
|
||||
{
|
||||
obj.createblock(5, 264 - 4, 40, 20, 16, 34);
|
||||
for (j = 0; j < obj.nentity; j++)
|
||||
for (j = 0; j < (int) obj.entities.size(); j++)
|
||||
{
|
||||
if (obj.entities[j].xp == 264 && obj.entities[j].yp==40)
|
||||
{
|
||||
|
@ -1959,7 +1959,7 @@ void scriptclass::run()
|
|||
}
|
||||
else if (words[0] == "everybodysad")
|
||||
{
|
||||
for (i = 0; i < obj.nentity; i++)
|
||||
for (i = 0; i < (int) obj.entities.size(); i++)
|
||||
{
|
||||
if (obj.entities[i].rule == 6 || obj.entities[i].rule == 0)
|
||||
{
|
||||
|
@ -2535,7 +2535,7 @@ void scriptclass::resetgametomenu()
|
|||
{
|
||||
game.gamestate = TITLEMODE;
|
||||
graphics.flipmode = false;
|
||||
obj.nentity = 0;
|
||||
obj.entities.clear();
|
||||
graphics.fademode = 4;
|
||||
game.createmenu("gameover");
|
||||
}
|
||||
|
@ -2555,7 +2555,7 @@ void scriptclass::startgamemode( int t )
|
|||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2578,7 +2578,7 @@ void scriptclass::startgamemode( int t )
|
|||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2600,7 +2600,7 @@ void scriptclass::startgamemode( int t )
|
|||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2639,7 +2639,7 @@ void scriptclass::startgamemode( int t )
|
|||
game.jumpheld = true;
|
||||
|
||||
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2667,7 +2667,7 @@ void scriptclass::startgamemode( int t )
|
|||
game.jumpheld = true;
|
||||
|
||||
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2695,7 +2695,7 @@ void scriptclass::startgamemode( int t )
|
|||
game.jumpheld = true;
|
||||
|
||||
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2723,7 +2723,7 @@ void scriptclass::startgamemode( int t )
|
|||
game.jumpheld = true;
|
||||
|
||||
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2751,7 +2751,7 @@ void scriptclass::startgamemode( int t )
|
|||
game.jumpheld = true;
|
||||
|
||||
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2785,7 +2785,7 @@ void scriptclass::startgamemode( int t )
|
|||
game.jumpheld = true;
|
||||
|
||||
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2808,7 +2808,7 @@ void scriptclass::startgamemode( int t )
|
|||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2835,7 +2835,7 @@ void scriptclass::startgamemode( int t )
|
|||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2871,7 +2871,7 @@ void scriptclass::startgamemode( int t )
|
|||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2906,7 +2906,7 @@ void scriptclass::startgamemode( int t )
|
|||
|
||||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2941,7 +2941,7 @@ void scriptclass::startgamemode( int t )
|
|||
|
||||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -2976,7 +2976,7 @@ void scriptclass::startgamemode( int t )
|
|||
|
||||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -3011,7 +3011,7 @@ void scriptclass::startgamemode( int t )
|
|||
|
||||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -3043,7 +3043,7 @@ void scriptclass::startgamemode( int t )
|
|||
|
||||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -3075,7 +3075,7 @@ void scriptclass::startgamemode( int t )
|
|||
|
||||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -3107,7 +3107,7 @@ void scriptclass::startgamemode( int t )
|
|||
|
||||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -3139,7 +3139,7 @@ void scriptclass::startgamemode( int t )
|
|||
|
||||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -3162,7 +3162,7 @@ void scriptclass::startgamemode( int t )
|
|||
game.jumpheld = true;
|
||||
|
||||
if (graphics.setflipmode) graphics.flipmode = true;//set flipmode
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -3196,7 +3196,7 @@ void scriptclass::startgamemode( int t )
|
|||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -3233,7 +3233,7 @@ void scriptclass::startgamemode( int t )
|
|||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
@ -3278,7 +3278,7 @@ void scriptclass::startgamemode( int t )
|
|||
//set flipmode
|
||||
if (graphics.setflipmode) graphics.flipmode = true;
|
||||
|
||||
if(obj.nentity==0)
|
||||
if(obj.entities.empty())
|
||||
{
|
||||
obj.createentity(game.savex, game.savey, 0, 0); //In this game, constant, never destroyed
|
||||
}
|
||||
|
|
|
@ -931,10 +931,7 @@ std::vector<std::string> warpclass::loadlevel(int rx, int ry)
|
|||
warpy = true;
|
||||
rcol = 5;
|
||||
|
||||
obj.entities[obj.nentity].active = true;
|
||||
obj.nentity++;
|
||||
obj.createentity(14 * 8, (8 * 8) + 4, 14); //Teleporter!
|
||||
obj.entities[obj.nentity - 2].active = false;
|
||||
|
||||
if(game.intimetrial)
|
||||
{
|
||||
|
|
|
@ -1423,7 +1423,7 @@ void gamerender()
|
|||
|
||||
if(!game.completestop)
|
||||
{
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
//Is this entity on the ground? (needed for jumping)
|
||||
if (obj.entitycollidefloor(i))
|
||||
|
@ -2606,7 +2606,7 @@ void towerrender()
|
|||
|
||||
if(!game.completestop)
|
||||
{
|
||||
for (int i = 0; i < obj.nentity; i++)
|
||||
for (size_t i = 0; i < obj.entities.size(); i++)
|
||||
{
|
||||
//Is this entity on the ground? (needed for jumping)
|
||||
if (obj.entitycollidefloor(i))
|
||||
|
|
Loading…
Reference in a new issue