1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 14:38:30 +02:00
Commit Graph

536 Commits

Author SHA1 Message Date
Misa
b5a009f2e2 Reset game.activeactivity and game.act_fade in scriptclass::hardreset()
Resetting game.activeactivity fixes triggering Undefined Behavior if you
quit to the menu while standing inside an activity zone, and then
re-entered the game. Resetting game.act_fade also fixes the activity
zone prompt fadeout that happens once the above segfault is fixed.

Don't worry, other activity-zone like variables such as teleporter
prompts and trophy text are already covered. obj.trophytext is reset in
scriptclass::hardreset(), too, and game.readytotele is reset every time
mapclass::gotoroom() is called, and mapclass::gotoroom() is called every
time a gamemode is started.
2020-05-20 05:12:49 -04:00
Terry Cavanagh
a10265787d
Merge pull request #143 from InfoTeddy/general-bug-fixes
Add and draw one more row to all rooms with room names
2020-05-20 13:13:56 +10:30
Misa
4d0e1549a5 Allow crewmate to be cyan when initially placing it down
For some reason, the only way to get a cyan crewmate is by cycling
through an already-existing crewmate by keeping left-clicking on it.
This is because when you cycle through crewmate colors, the allowed
colors are 0-5, but when you place down a crewmate, it picks a random
color from 1-5, which seems to be a bit consistent.

So placing and cycling a crewmate now use the same color ranges.
2020-05-19 21:38:28 -04:00
Misa
99562075c5 Don't draw "Game paused" when in blackout mode
Blackout mode doesn't work properly, because the game doesn't actually
black out the screen, it merely stops drawing things. Oh and only some
things at that, some other things are still drawn. This results in a
freeze-frame effect, which is apparently fixed in the Switch version.
Custom levels utilize this freeze-frame effect, so it's a bit annoying
that the "Game paused" screen draws on top of it and makes it so that
the freeze-frame freezes on "Game paused" until blackout is turned off.

So I'm making it so that "Game paused" doesn't get drawn in blackout
mode. However it will still do graphics.render() because otherwise it'll
just result in a black screen.
2020-05-19 21:37:40 -04:00
Misa
4034c22833 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.
2020-05-19 20:43:02 -04:00
Misa
e795fbb511 Simplify inits/resets in entityclass/mapclass
Instead of using somewhat-obtuse for-loops to initialize or reset these
vectors, it takes up less lines of code and is clearer if we use
std::vector::resize() and std::vector::clear() instead.
2020-05-19 20:41:56 -04:00
Info Teddy
291d358b7e Add and draw one more row to all rooms with roomnames
Since translucent roomname backgrounds were introduced in
TerryCavanagh/VVVVVV#122, it exposes one glaring flaw with the game that
until now has been kept hidden: in rooms with room names, the game
cheapens out with the tile data and doesn't have a 30th row, because the
room name would hide the missing row. As a result, rooms with room names
have 29 rows instead of 30 to fill up the entire screen. And it looks
really weird when there's nothing but empty space behind the translucent
room name background.

To remedy this, I added one row to each room with a room name in the level.
First, I had to filter out all the rooms with no room names. However, that's
actually all contained in Otherlevel.cpp, the Overworld, which contains 221
rooms (8 of which are the Secret Lab, 6 more of which are the Ship, so 207 are
the actual Overworld, right? Wrong, 2 of those Overworld no-roomname rooms are
in the Lab, so there are actually 205 Overworld rooms). The remaining level
data files all contain rooms with room names.

But the process wasn't that easy. I noticed a while ago that each room
contains 29 `tmap.push_back()`s, one for each row of the room, and each row is
simply a string containing the 40 tiles for that row, concatenated with
commas.

However, I decided to actually check my intuition by doing a grep on each
level file and counting the number of results, for example `grep 'push_back'
Labclass.cpp | wc -l`. Whatever number comes out should be divisible by 29.
That particular grep on Labclass.cpp returns 1306, which divided by 29 is 45
with a remainder of 1.

So what does that mean? Does that mean there's 45 rooms each, and 1 leftover
row? Well, not exactly. The extra row comes from the fact that Outer Space has
30 rows instead of 29. Outer Space is the room that comes up when the game
finds a room is non-existent, which shouldn't happen with a properly-working
game, except in Outside Dimension VVVVVV. In fact, each level file has their
own Outer Space, and every single Outer Space also has 30 rooms. So really,
this means there are 44 rooms in the Lab and one Outer Space room. (Well, in
reality, there are 46 rooms in the Lab, because 2 of them use the Outside
tileset but have no room names, so they're stored in Otherlevel.cpp instead.)

We find the same result for the Warp Zone. `grep 'push_back' WarpClass.cpp |
wc -l` returns 697, which is 24 remainder 1, meaning 23 rooms of 29 rows and 1
room of 30 rows, which corresponds with 23 rooms in the Warp Zone and one
Outer Space room.

However, Outside Dimension VVVVVV + Tower Hallways and Space Station 1 and 2
are both odd curiosities. Finalclass.cpp contains Outside Dimension VVVVVV,
(which is Intermission 1 and 2 and the Final Level), but also the Tower
Hallway rooms, i.e. the auxiliary Tower rooms that are not a part of the main
tower. Spacestation2.cpp contains both Space Station 1 and 2, so don't be
deceived by the name.

`grep 'push_back' Finalclass.cpp | wc -l` returns 1597, which is actually 55
remainder 2. So... are there two rooms with 30 rows? Yes, in fact, The
Gravitron and Outer Space both contain 30 rows. So there are actually 55 rooms
stored in Finalclass.cpp (not including the minitowers Panic Room and The
Final Challenge), 54 rooms of actual level data and one Outer Space room, and
breaking down the 54 rooms even further, 51 of them are actually in Outside
Dimension VVVVVV and 3 of them are Tower Hallways. Of the 51 Outside Dimension
VVVVVV rooms, 14 of those are Intermission 1, 4 of them are Intermission 2,
and the rest of the 33 rooms are the Final Level (again, not including the
minitowers).

`grep 'push_back' Spacestation2.cpp | wc -l` returns 2148, which is 74
remainder 2. Are there two rooms with 30 rows again? No; one of those counted
2148 rows is a false-positive, because there's an if-else in Prize for the
Reckless that replaces the row with spikes with a row without spikes if you
are in a time trial or in No Death Mode. So there's 73 rooms in Space Station
1 and 2, and one Outer Space room.

With all this in mind, I decided to duplicate the current last row of each
room, the 29th row, to add a 30th row. However, I wasn't going to do this
automatically! But neither was I going to write some kludge-y code to parse
each nightmare of a level file and duplicate the rows that way.

Enter: Vim macros! (Er, well, actually, I use Neovim.) I first did
`/push_back`, so that pressing `n` would keep going to the next `push_back` in
the file. Then I went to the 29th row of the first room in the file, did a
`Yp`, and then started my macro with `qq`. The macro went like this: `30nYp`,
which is simply going to the 29th row of the next room over and duplicating
it. And that's all there was to it. However, I had to make sure that (1) my
cursor was before the `push_back` on the line of the 29th row of the room, and
(2) that I didn't skip rooms, both of which were problems I encountered when
pressing Ctrl+Z a given invocation of the macro (the Ctrl+Z is just a
metaphor, you actually undo by typing `u` in Vim). And also I had to make sure
to be careful around the extra lines of `push_back`s in Prize for the Reckless
and The Gravitron, and make sure I didn't run past the end of the file and
loop back around. Thankfully, all Outer Space rooms are at the end of each
file.

But first, I had to increase the number of rows drawn in Graphics.cpp by 1 in
order to compensate for this, and do the same when reading the tile data in
Map.cpp. I had to change fillcontent(), drawmap(), drawfinalmap(),
drawtowermap(), and drawtowermap_nobackground(). Funnily enough, the tower
functions already used 30 rows, but I guess it's an off-by-one due to the
camera scrolling, so they now draw 31 rows each.

Then, I went in-game to make sure that the row behind each room name looked
fine. I checked EVERY single room with a room name. I turned on invincibility
mode and added a temporary line to hardreset() that always turned on
game.nocutscenes for a smoother playtesting experience. And to make sure that
rooms which have entirely empty bottom rows actually still have 30 rows,
instead of having 29 and the game assuming that the 30th row was empty
(because that sounds like it could lead to Undefined Behavior), I added this
temporary debugging line to the start of mapclass::fillcontent():

    printf("(%i,%i) has %i rows\n", game.roomx, game.roomy, (int) tmap.size());

Everywhere I checked - and I made sure to check all rooms - every room had 30
rows and not 29 rows.

Unfortunately, some rooms simply couldn't be left alone with their 29th row
duplicated and had to be manually edited. This was because the 29th row would
contain some edge tiles because the player would be able to walk somewhere on
the 28th, 27th, and 26th rows, and if you duplicated said edge tiles behind
the room name, it would look bad.

Here's a list of rooms whose 30th rows I had to manually edit:

 - Comms Relay
 - The Yes Men
 - Stop and Reflect
 - They Call Him Flipper
 - Double-slit Experiment
 - Square Root
 - Brought to you by the letter G
 - The Bernoulli Principle
 - Purest Unobtainium
 - I Smell Ozone
 - Conveying a New Idea
 - Upstream Downstream
 - Give Me A V
 - $eeing Dollar $ign$
 - Doing Things The Hard Way
 - Very Good
 - Must I Do Everything For You?
 - Now Stay Close To Me...
 - ...But Not Too Close
 - ...Not as I Do
 - Do Try To Keep Up
 - Whee Sports
 - As you like it

   This is actually a strange case where it looked bad because of the 29th
   row, instead of the 30th row, and I had to change the 29th row instead of
   the 30th row to fix it.
 - Maze With No Entrance
 - Ascending and Descending
 - Mind The Gap

   Same strange case as "As you like it" (it's the 29th row I had to change
   that was the problem, not the 30th).
 - 1950 Silverstone Grand V
 - The Villi People

I found that Panic Room and The Final Challenge also looked strange behind the
roomname background, but I can't do much about either because towers' tile
data wrap around at the top and bottom, and if I added another row to either
it would be visible above the room name.

I've considered updating the development editors with these new level tiles,
but I decided against it as the development editors are already pretty
outdated anyway.
2020-05-19 11:25:38 -07:00
Misa
de82918efd Fix 7 extra zeroes on the 21st row of Philadelphia Experiment
This didn't cause any issues on the old push_back(string) system, but it
causes a huge alignment issue now. Don't know why these 7 zeroes are
here, but I'm fixing them.
2020-05-19 14:24:16 -04:00
Misa
3178aec5d2 Only flash and shake screen when enabling Flip Mode
It's a bit inconsistent how every time you toggle flip mode, it does
this flashing and shaking (and different SFX), regardless of whether or
not you're turning it on or off. To be more consistent with what happens
when you toggle screen effects, only turning on Flip Mode should do the
flashing/shaking/game-saved sound, and turning it off should just play
the Viridian squeak.
2020-05-18 22:22:36 -04:00
Misa
7bd2f92f03 Make all gamemode starts play a Viridan squeak
It's always personally irked me that the only time you get a Viridian
squeak when pressing ACTION to start fading out and going in-game is
when you start playing a custom level. And that's only if you don't have
a quicksave.

To make things more consistent (and to add more polish to the game), I
made sure there was a music.playef(11) every time game.mainmenu gets
set. I also made sure that this doesn't result in double-squeaking, i.e.
music.playef(11) being called twice, which can be very loud and
ear-hurting.
2020-05-18 22:22:36 -04:00
Misa
14af88695f Select "continue" if returning from new game when having had a save
If you started a new game while having had a save (meaning you selectedd
"new game" while it wasn't in the same position as "continue"), then
saved and quit, your cursor will now end up at "continue" instead of
"new game". (If you didn't save, then your cursor would be out-of-bounds
and end up at position 0 anyway.)
2020-05-18 21:01:07 -04:00
Misa
a33c460d40 Re-create menu if returntomenu() is given current menu
This fixes a bug where if you had the play menu in a state where the
first option was "new game", then kept playing up until a quicksave or
telesave was created, then quit to the menu, the menu wouldn't update.
Thanks to KSSBrawl for reporting this bug to me:
https://cdn.discordapp.com/attachments/708567577978470410/712060797924147240/untitled.webm
2020-05-18 21:01:07 -04:00
Misa
72ddd9bdb4 Fix <hardestroom> having atoi() called on it when loading quicksave
For some reason (probably a copy-paste error), this XML tag gets atoi()
called on it before being assigned to Game::hardestroom. And only when
loading a quicksave, at that.

This would result in Game::hardestroom being set to an empty string,
which if you kept until Game Complete, would end up rendering as a
single null byte (if you even have a font face for said null byte).

I'm not sure how this error compiles in the first place, but whatever.
2020-05-18 17:43:04 -04:00
Misa
9b3853bf94 Fix indentation with ifdefs and FILESYSTEM_delete()
Nested ifdefs have been indented one space accordingly, and
FILESYSTEM_delete() has been changed to use a tab instead of 4 spaces.
2020-05-18 17:11:09 -04:00
Misa
bf21c13f80 Handle return values from fread() and fwrite() in PLATFORM_copyFile()
Whenever I compile with -O2, GCC gives me a warning that the return
value of fread() is being ignored. Which is a fair point, it means that
we're not doing proper error handling if something goes wrong. But I'm
also going to check the return value of fwrite() for good measure.

I believe that checking that this number is not equal to length is the
way to catch all errors and output an error message accordingly. I
didn't use ferror() or feof() mostly because I think it takes up too
much code. Also an error from fwrite() only says "Warning" because I
don't think there's much we can do if we don't fully write all bytes to
the intended file.
2020-05-18 17:11:09 -04:00
Misa
664bf8ca6c Remove now-unused function mapclass::fillareamap()
This is no longer needed since we load the areamap directly, instead of
having strings as unnecessary middlemen for our tilemap.
2020-05-17 22:03:29 -04:00
Misa
e938bfdb57 Refactor areamap initialization to not use strings
Instead, the data is held in a const int array, which is directly loaded
into areamap.
2020-05-17 22:03:29 -04:00
Misa
86516bb284 Remove now-unused fillbackground/fillcontents/fillminitower from Tower
They are now unused because we no longer have to parse 120, 100, or 700
strings in order to load these tilemaps.
2020-05-17 22:03:29 -04:00
Misa
aae07336eb Refactor Tower.cpp to no longer use strings for tilemaps
Instead, they are all now held in constant int arrays. Including the
menu background.
2020-05-17 22:03:29 -04:00
Misa
aed7b220c7 Remove now-unused function mapclass::fillcontent()
Previously, it was used to parse 30 strings whenever loading a room. But
now it's no longer used since we just assign the tilemap to the vector
directly.
2020-05-17 22:03:29 -04:00
Misa
ec72031cfd Refactor Otherlevel.cpp to not use strings for tilemaps
Instead, they're all held in a constant int array instead.
2020-05-17 22:03:29 -04:00
Misa
8a573af273 Refactor Spacestation2.cpp to not use strings for tilemaps
They are now stored in const int arrays instead. Except for the Prize
for the Reckless room, which I made sure had its spikes removed in No
Death Mode and the Time Trial.
2020-05-17 22:03:29 -04:00
Misa
781aa38e1f Refactor Finalclass.cpp to not use strings for tilemaps
Instead, they're all stored in a constant int array.

I made sure The Gravitron still has 30 rows just like Outer Space,
though I don't think it matters.
2020-05-17 22:03:29 -04:00
Misa
5126c4dbc4 Refactor WarpClass.cpp to not use strings for tilemaps
They now use a constant int array instead.
2020-05-17 22:03:29 -04:00
Misa
cc0d5d1d79 Refactor Labclass.cpp to not use strings for tilemaps
They now use a const int array instead.
2020-05-17 22:03:29 -04:00
Misa
f617b6d695 Fix FILESYSTEM_openDirectory command used on Haiku and *BSD
Previously:
 - Linux: xdg-open
 - Everything else: open

Now:
 - macOS and Haiku: open
 - Everything else: xdg-open

This is all according to a comment by leo60228 in PR #203.
2020-05-14 17:18:47 -04:00
Misa
e69cc964ab Don't duplicate activity zone handling code in playtesting
This change makes it so that in in-editor playtesting, the code to
handle pressing ENTER on activity zones is the same code to handle
pressing ENTER on activity zones in custommodeforreal.

This removes the need to copy-paste code and adapt it to in-editor
playtesting. And thus, this fixes an editor artifact where you can press
ENTER on activity zones while doing the death animation, even though you
can't do that when you're playing custom levels normally.
2020-05-14 16:15:07 -04:00
Misa
610768658e Remove graphics.drawgui() from maprender()
Since this is at the start of maprender(), the text boxes drawn by this
function will get hidden behind everything else being drawn on top of
it. Thus, it'll only result in a glitchy rendering where the text boxes
at the very top of the screen will be rendered in the roomname space of
the map screen.

To fix this rendering glitch, just remove the drawgui(). It's useless
anyway since it's being drawn behind everything else, so no need to have
it here.
2020-05-14 14:40:27 -04:00
Misa
be2d2e1e2a Fix 1x1 quicksand collision optimization not working
We need to replace an "or" with an "and".

My best guess for this oversight happening was because of the weird
ordering. The code originally did "temp < 30" first and "temp > -30"
second instead of the other way around. With the weird ordering, it
becomes more natural to insert an "or" instead of an "and". So I swapped
around the ordering just for good measure.

This is also fixed in the mobile version.
2020-05-13 08:16:34 -04:00
Misa
2d07090a6b Move returning to editor to end of frame
This fixes horizontal and vertical warp backgrounds not resetting, and
also a bunch of other 1-frame glitches, most noticeably cutscene bars
and fadeouts.

This adds a new variable shouldreturntoeditor to Game to signal whether
or not it should return to editor at the end of the frame.
2020-05-09 16:40:01 -04:00
Misa
51971fa84c Abstract returning-to-editor code to Game::returntoeditor()
This way I can easily move it around without moving around a bunch of
lines of code.
2020-05-09 16:40:01 -04:00
Misa
915100b370 Reset vvvvvvman size in mapclass::resetplayer()
It's a bit annoying how vvvvvvman status is preserved between in-game
sessions, and the only thing reset is the color. This is annoying
because it means you have to close the game to reset vvvvvvman.

But now it'll be reset properly. I chose to put this reset code in
mapclass::resetplayer() instead of scriptclass::hardreset() because it
seemed like the more appropriate place. It's where all other properties
of the player are reset, after all.
2020-05-09 15:16:11 -04:00
Misa
269ad18b86 Call game.savestats() when setting new Super Gravitron record
This is to be extra safe and ensure that your hard-earned record isn't
lost at all.

In 2.2, the game didn't save your Super Gravitron record at all. It only
saved it if you closed the game by quitting to the title screen and
pressing ACTION on "quit game". You couldn't press Alt+F4, and you
couldn't press X, you had to do it that way, otherwise your record would
be lost.

In 2.3 right now, the game WILL save your unlock.vvv when you close the
game gracefully by any means, but this still means that if it doesn't
otherwise close gracefully (like, say, a crash), it won't save your
record. It feels like we shouldn't rely on this catch-all saving to save
Super Gravitron records.
2020-05-09 15:07:41 -04:00
Misa
f585d53955 Fix flag 67 turning on too early
Flag 67 seems to be a general-purpose Game Complete flag. It's used to
replace the CREW option with the SHIP option on the pause screen.

Unfortunately, it gets turned on too early during Game Complete. Right
when Viridian starts to teleport, you can bring up the pause screen and
select the SHIP option.

It will teleport you to the ship coordinates, but still keep you in
finalmode, and since the ship coordinates are at 102,111 (finalmode is
only around 46,54), you'll still be stuck in Outside Dimension VVVVVV,
and you've interrupted the Game Complete gamestate by switching to the
teleporting gamestate. Oh, and your checkpoint is set, too, so you can't
even press R. Oh and since there's no teleporter, and checkpoint setting
doesn't check the sentinel value, this results in Undefined Behavior,
too.

So this results in an in-game softlock. The only option you can do is
quit the game at this point.

To fix this issue, just move turning on flag 67 before the savetele() in
gamecompletelogic2().
2020-05-09 14:55:24 -04:00
Misa
65341a8d1c Unindent block that previously had the fademode check
From the previous commit. It makes the diffs easier to read if I do the
unindent in a separate commit.
2020-05-08 08:34:46 -04:00
Misa
c61025c172 Remove fademode check from quitting to menu
This means you're allowed to quit to the menu even if you're faded-out,
because it's weird if you can close the menu but not be able to quit.
2020-05-08 08:34:46 -04:00
Misa
82d19145ae Only draw fading-in and fading-out animations in MAPMODE
This makes it so if you bring up the quit screen during a faded-out
screen, you will at least see the screen and won't see black. And also
the fade-in and fade-out animations will still work on the quit screen.
And more importantly, I tested and there's no 1-frame flicker or
anything.
2020-05-08 08:34:46 -04:00
Misa
3235b64d19 Remove reliance on fademode to return to menu
This was used by the old system, which also had an over-reliance on
Terry's State Machine. And due to the fact that it relied on fademode,
it also meant that bringing up the pause screen while faded-out would
result in the player getting sent back to the menu, so one accidental
Esc press during a cutscene could mean countless hours of progress lost
(especially in custom levels).
2020-05-08 08:34:46 -04:00
Misa
656680b49c Fix returning to editor when game is faded-out
This would cause the editor to think that it itself is in the middle of
fading to the menu, and so then will fade to the menu, thus losing any
unsaved work without warning.
2020-05-08 08:34:46 -04:00
Misa
b83cab8577 Directly do returntolab code instead of relying on a script
Having to rely on a script means the fade out wouldn't be self-contained
in MAPMODE, which could cause a small issue where you could die during
the return to the lab. But that issue is now fixed. There's no need to
use the script, and anyway the endcutscene() and untilbars() in said
script don't do anything because there are no cutscene bars in the first
place, so no need to worry about those.
2020-05-08 08:34:46 -04:00
Misa
fc2f269548 Move returning to lab to separate variables
Again, what I've done here is removed the over-reliance on Terry's State
Machine to return to the lab, and just moved it into separate variables
instead. This means that returning to the lab is ALMOST entirely
self-contained in MAPMODE, except there's a quick jaunt over to GAMEMODE
to run a script because you can only run scripts in GAMEMODE.
2020-05-08 08:34:46 -04:00
Misa
17e7c6983b Move fading to menu to separate variables
Alright, so what I've done here is made exiting to the menu entirely
separate from Terry's State Machine, and thus it can now take place
entirely within MAPMODE instead of having to go back to GAMEMODE. Also,
it's faster by 15 frames since we don't need to wait for the map screen
to go back down.
2020-05-08 08:34:46 -04:00
Misa
69aeac2410 Move return to lab code to Game::returntolab()
Again, I'll keep gamestate 96 and 97 for compatibility reasons, but
ultimately we shouldn't be using gamestates to return to the lab.
2020-05-08 08:34:46 -04:00
Misa
b59e5a8346 Move script.hardreset() to after quit to menu
This cleans up a whole lot of kludge variables, because this aggressive
hardreset() right as ACTION is pressed doesn't do anyone any favors.

This aggressive hardreset() was probably here because of the whole fact
that exiting to the menu uses Terry's State Machine, to minimize the
chances of interruption, but it actually causes more issues and allows
towers to interrupt the fadeout. And we should fix the root cause (the
usage of the state machine) instead of patching together some kludge.
2020-05-08 08:34:46 -04:00
Misa
6ac41e112c Move quit to menu to Game::quittomenu()
I don't want the quit code to only be in the state machine, but I'll
keep the gamestate around for compatibility reasons (there are custom
levels that directly use gamestate 80 to quit to the menu).
2020-05-08 08:34:46 -04:00
Misa
0787475e63 Remove unused variable 'pause' from Game
Looks like this variable is never used anywhere.
2020-05-08 08:34:46 -04:00
Misa
38a25b985e Fix a copy-paste error in getLevelMetaData()
Whoops.
2020-05-08 08:14:55 -04:00
Misa
29ff773cc4 Rename "start" option to "new game"
By popular request. Aizu said that "start" looks ugly since it's too
short compared to the rest of the menu options.
2020-05-06 20:52:47 -04:00
Misa
80db2f1d15 Add out-of-bounds puts() to updateentitylogic and entitymapcollision
Due to the previous commit, these will no longer be regularly taking in
out-of-bounds entity indices. Or at least they shouldn't, so I'm putting
in these print statements here on the off-chance that they do.
2020-05-05 17:22:47 -04:00
Misa
ce1e212317 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.
2020-05-05 17:22:47 -04:00