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
|
@ -4799,13 +4799,19 @@ void Game::deathsequence()
|
||||||
obj.entities[i].invis = true;
|
obj.entities[i].invis = true;
|
||||||
if (map.finalmode)
|
if (map.finalmode)
|
||||||
{
|
{
|
||||||
map.roomdeathsfinal[roomx - 41 + (20 * (roomy - 48))]++;
|
if (roomx - 41 >= 0 && roomx - 41 < 20 && roomy - 48 >= 0 && roomy - 48 < 20)
|
||||||
currentroomdeaths = map.roomdeathsfinal[roomx - 41 + (20 * (roomy - 48))];
|
{
|
||||||
|
map.roomdeathsfinal[roomx - 41 + (20 * (roomy - 48))]++;
|
||||||
|
currentroomdeaths = map.roomdeathsfinal[roomx - 41 + (20 * (roomy - 48))];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
map.roomdeaths[roomx - 100 + (20*(roomy - 100))]++;
|
if (roomx - 100 >= 0 && roomx - 100 < 20 && roomy - 100 >= 0 && roomy - 100 < 20)
|
||||||
currentroomdeaths = map.roomdeaths[roomx - 100 + (20 * (roomy - 100))];
|
{
|
||||||
|
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 == 25) obj.entities[i].invis = true;
|
||||||
|
|
Loading…
Reference in a new issue