mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 10:09:43 +01:00
Add bounds checks to roomdeaths and roomdeathsfinal
This fixes being able to trigger Undefined Behavior by pressing R when not in-bounds in the Outside Dimension VVVVVV map, usually when you're falling upwards towards Game Complete. I also put bounds checks on normal roomdeaths for good measure. You'll never know when you need it.
This commit is contained in:
parent
e795fbb511
commit
4034c22833
1 changed files with 10 additions and 4 deletions
|
@ -4798,16 +4798,22 @@ void Game::deathsequence()
|
|||
music.playef(2);
|
||||
obj.entities[i].invis = true;
|
||||
if (map.finalmode)
|
||||
{
|
||||
if (roomx - 41 >= 0 && roomx - 41 < 20 && roomy - 48 >= 0 && roomy - 48 < 20)
|
||||
{
|
||||
map.roomdeathsfinal[roomx - 41 + (20 * (roomy - 48))]++;
|
||||
currentroomdeaths = map.roomdeathsfinal[roomx - 41 + (20 * (roomy - 48))];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (roomx - 100 >= 0 && roomx - 100 < 20 && roomy - 100 >= 0 && roomy - 100 < 20)
|
||||
{
|
||||
map.roomdeaths[roomx - 100 + (20*(roomy - 100))]++;
|
||||
currentroomdeaths = map.roomdeaths[roomx - 100 + (20 * (roomy - 100))];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (deathseq == 25) obj.entities[i].invis = true;
|
||||
if (deathseq == 20) obj.entities[i].invis = true;
|
||||
if (deathseq == 16) obj.entities[i].invis = true;
|
||||
|
|
Loading…
Reference in a new issue