1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-02 02:53:32 +02:00

Remove assigning block type to -1 when disabling them

This fixes a regression where moving platforms had no collision. Because
their width and height would be maintained, but their type would be -1.
(Also because I didn't test enough.)

In #565, I decided to set blocks' types to -1 when disabling them, to be
a bit safer in case there was some code that used block types but not
their width and heights. However, this means that when blocks get
disabled and re-created in the platform update loops, their types get
set to -1, which effectively also disables their collision.

In the end, I'll just have to compromise and remove setting blocks to
type -1. Because in a better world, we shouldn't be destroying and
creating blocks constantly just to move some platforms - however, fixing
such a fundamental problem is beyond the scope of at least 2.3 (there's
also the fact that this problem also results in some bugs that are a
part of compatibility, whether we like it or not). So I'll just remove
the -1.
This commit is contained in:
Misa 2021-02-19 15:16:28 -08:00 committed by Ethan Lee
parent cd5408e396
commit 4e7d63cf09

View File

@ -767,8 +767,7 @@ void entityclass::createblock( int t, int xp, int yp, int w, int h, int trig /*=
bool reuse = false;
for (size_t i = 0; i < blocks.size(); ++i)
{
if (blocks[i].type == -1
&& blocks[i].wp == 0
if (blocks[i].wp == 0
&& blocks[i].hp == 0
&& blocks[i].rect.w == 0
&& blocks[i].rect.h == 0)
@ -1107,8 +1106,6 @@ void entityclass::disableblock( int t )
return;
}
blocks[t].type = -1;
blocks[t].wp = 0;
blocks[t].hp = 0;