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

Destroy duplicate player entities during gotoroom

The game makes sure that the player entity is never destroyed, but in
doing so, it doesn't destroy any duplicate player entities that might
have been created via strange means e.g. a custom level doing a
createentity with t=0.

Duplicate player entities are, in a sense, not the "real" player entity.
For one, they can take damage and die, but when they do they'll still be
stuck inside the hazard, which can result in a softlock. For another,
their position isn't updated when going between rooms. It's better to
just destroy them when we can.
This commit is contained in:
Info Teddy 2020-01-13 14:43:11 -08:00 committed by Ethan Lee
parent 8eeb6f419b
commit b8e611a3bf

View file

@ -900,10 +900,13 @@ void mapclass::gotoroom(int rx, int ry, Graphics& dwgfx, Game& game, entityclass
} }
} }
int theplayer = obj.getplayer();
for (int i = 0; i < obj.nentity; i++) for (int i = 0; i < obj.nentity; i++)
{ {
//Of course the player's always gonna be object zero, this is just in case if (i != theplayer)
if (obj.entities[i].rule != 0) obj.entities[i].active = false; {
obj.entities[i].active = false;
}
} }
obj.cleanup(); obj.cleanup();