mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 17:38:16 +03:00
Prevent updating an entity if updateentities() removed it
Otherwise, this would result in the game updating an entity twice, which isn't good. This is most noticeable in the Gravitron, where many Gravitron squares are created and destroyed at a time, and it's especially noticeable during the part near the end of the Gravitron where the pattern is two Gravitron squares, one at the top and bottom, and then two Gravitron squares in the middle afterwards. The timing is just right such that the top one of the two middle ones would be misaligned with the bottom one of the two when a Gravitron square gets outside the screen. To do this, I changed entityclass::updateentities() into a bool, and made every single caller check its return value. I only needed to do this for the ones preceding updateentitylogic() and entitymapcollision(), but I wanted to play it safe and be defensive, so I did it for the disappearing platform kludge, as well as the updateentities() within the updateentities() function.
This commit is contained in:
@@ -76,7 +76,7 @@ public:
|
||||
void createentity(float xp, float yp, int t, float vx = 0, float vy = 0,
|
||||
int p1 = 0, int p2 = 0, int p3 = 320, int p4 = 240 );
|
||||
|
||||
void updateentities(int i);
|
||||
bool updateentities(int i);
|
||||
|
||||
void animateentities(int i);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user