mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 09:39: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:
parent
8eeb6f419b
commit
b8e611a3bf
1 changed files with 5 additions and 2 deletions
|
@ -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++)
|
||||
{
|
||||
//Of course the player's always gonna be object zero, this is just in case
|
||||
if (obj.entities[i].rule != 0) obj.entities[i].active = false;
|
||||
if (i != theplayer)
|
||||
{
|
||||
obj.entities[i].active = false;
|
||||
}
|
||||
}
|
||||
obj.cleanup();
|
||||
|
||||
|
|
Loading…
Reference in a new issue