Fix player being invisible upon loading into game again

When I did #567, I didn't test it. And I should have tested it, because
it made the player invisible. This is because map.resetplayer() also
sets the invis attribute of the player to true as well, and I only undid
it setting game.lifeseq to 10.

So instead, I'll just add a flag to map.resetplayer() that by default
doesn't set game.lifeseq or the player's invis attribute. And I tested
it this time, and it works fine. I tested both respawning after death
and exiting to the menu and loading in the game again.
This commit is contained in:
Misa
2020-12-28 13:16:16 -08:00
committed by Ethan Lee
parent eb7b540346
commit 385f9d244e
4 changed files with 12 additions and 27 deletions

View File

@@ -802,6 +802,11 @@ void mapclass::showship()
}
void mapclass::resetplayer()
{
resetplayer(false);
}
void mapclass::resetplayer(const bool player_died)
{
bool was_in_tower = towermode;
if (game.roomx != game.saverx || game.roomy != game.savery)
@@ -821,8 +826,11 @@ void mapclass::resetplayer()
obj.entities[i].yp = game.savey;
obj.entities[i].dir = game.savedir;
obj.entities[i].colour = 0;
game.lifeseq = 10;
obj.entities[i].invis = true;
if (player_died)
{
game.lifeseq = 10;
obj.entities[i].invis = true;
}
if (!game.glitchrunnermode)
{
obj.entities[i].size = 0;