1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-07-01 17:08:30 +02:00
Commit Graph

823 Commits

Author SHA1 Message Date
Misa
cfcfccf58b Fix segfault if say/reply/text asks for more lines than there are
This commit adds bounds checks to those commands in case say()/reply()
asks for more lines than there are left in the all-script-lines buffer
(not just the current script, so in order for it to segfault your script
has to be last in the all-script-lines vector), and in case text() asks
for more lines than there are in the rest of the rest of the parsed
internal script.
2020-05-31 18:29:16 -04:00
Misa
ff6cc1a777 De-duplicate say/reply line adding code
I found it patently ridiculous that `i++; add(customscript[i]);` was
copy-pasted four separate times. Well, at least it's only copy-pasted
twice now.
2020-05-31 18:29:16 -04:00
Misa
79d55baf6d Remove unnecessary references to global self in loadcustom()
For some reason, scriptclass::loadcustom() sometimes refers to
`customscript` as `script.customscript` instead of `customscript`. The
`script.` is unnecessary.
2020-05-31 18:29:16 -04:00
Matt Penny
50798d5add Fix build with CUSTOM_LEVEL_SUPPORT=disabled 2020-05-30 16:33:17 -04:00
Misa
67a6ab3704 Statically allocate Prize for the Reckless tilemap
Looks like this was either forgotten about, or sufficiently scary enough
to not put a `static` on. But I think it's fine if we put a `static` on
it.
2020-05-29 19:39:05 -04:00
Misa
726a79c568 Statically allocate built-in scripts as well
Although it's not an issue, this should minimize the stack footprint of
calling scriptclass::load(), especially if it goes down to calling
scriptclass::loadcustom() or scriptclass::loadother().
2020-05-29 12:48:36 -04:00
Matt Penny
d27ffa51b6 Statically allocate level arrays
This prevents a potential stack overflow if the compiler tries to
allocate all of the arrays at once (observed on MSVC).
2020-05-29 10:21:25 -04:00
Misa
a623190b09 Fix using speak/speak_active without a text beforehand
Otherwise, it would end up indexing a vector out-of-bounds, which is UB
and causes a segfault, too. This is used in some constructs like

    say(-1)
    <internal command>

where the text contents don't matter, only that a text box shows up.
2020-05-23 16:04:04 -04:00
Misa
46559bbe0a De-duplicate speak_active/speak code
The `speak` command is the exact same as the `speak_active` command,
except without one line of code. So instead of copy-pasting the entire
thing, it's better to just combine them into the same chunk of code.
2020-05-23 16:04:04 -04:00
Misa
e9ffa1863f Refactor TerminalScripts.cpp to not store strings in function parameters
Like the previous commit, except for TerminalScripts.cpp.
2020-05-22 09:46:12 -04:00
Misa
815a48c025 Refactor Scripts.cpp to no longer hold strings in function args
Instead each line is now held in a const char* array, like it should be.
This results in less work for the compiler, especially with
optimization, since every time the compiler encounters a constant
argument in a function, it has to go off and locate a place to put it.
But if we're upfront and say, hey, here's all the strings we ever need
conveniently packaged into one place, it'll be much more cooperative.
2020-05-22 09:46:12 -04:00
Misa
9205421090 Clean up editorclass externs into one location
Again, like the previous commit, it should just be put in the header
file of its respective class instead of being a mess everywhere.
2020-05-22 09:46:12 -04:00
Misa
3a5dd5a616 Clean up all scriptclass externs into one location
I have the feeling that none of the devs understood what extern did, and
they kind of just sprinkled it everywhere until things started working.
But like all other classes, it should just be one line in the class's
respective header file, and shouldn't be so messy.
2020-05-22 09:46:12 -04:00
Misa
7afe206a0d Fix indentation of scriptclass::loadcustom()
It's now indented with tabs like the rest of the file. Furthermore, two
indentation levels have been knocked off.
2020-05-22 09:46:12 -04:00
Misa
fcea247c43 Move custom script parser to its own function
scriptclass::load() is a large enough function as it is, we don't need
any more trouble by shoving the custom script parser in there as well.
2020-05-22 09:46:12 -04:00
Misa
4301a70f2d Remove unnecessary middleman ed.swapmap
When the game loads a room in a custom level, previously it would load
the tilemap of that room into ed.swapmap, and then mapclass::loadlevel()
would manually go through each element in ed.swapmap to set each tile in
`contents`. Why do that, when you can just return the vector from
editorclass::loadlevel() and set it directly? ed.swapmap is really
unnecessary.
2020-05-21 23:28:15 -04:00
Misa
6913abb171 Refactor superpatrons/patrons/githubfriends to not push_back(string)
It's a bit bad for the compiler if you have lots of function calls with
hardcoded strings in them, because every time the compiler encounters
one, it has to go out of its way to find a dedicated storage location
for the string, which is really inefficient. And it does this
inefficient thing every single time.

There's not much of an impact compiling these lists, but I at least want
to encourage this sort of code style, instead of the push_back(string)
style, in case we ever need a hardcoded array of things later.
2020-05-21 09:12:34 -04:00
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
Misa
3c80d136e4 Add towermode checks to minitowermode screen transitions
Apparently, the game just leaves minitowermode on, which can cause
issues if you're in a horizontal warping room (and not any other room
type, due to how frame ordering works). This would manifest itself as a
wrong warp to (20,20) because the game is trying to apply the hardcoded
minitower screen transitions when it shouldn't be.
2020-05-05 14:39:02 -04:00
Misa
27a5d1fa4f Add puts()es to functions unlikely to receive OoB indices
This is every function in Entity.cpp except for updateentitylogic() and
entitymapcollision().
2020-05-05 13:49:47 -04:00
Misa
8a78318990 Add bounds checks to functions taking in entity/blocks/linecross indices
The main ones to beware of here are entityclass::updateentities(),
entityclass::updateentitylogic(), and entityclass::entitymapcollision().
They would index out-of-bounds and thus commit Undefined Behavior if the
entity was removed in entityclass::updateentities(). And it would've
been fine enough if I only added bounds checks to those functions.

However, I decided to be a bit more defensive and play it safe, and
added bounds checks to ALL functions taking in not only an entity
indice, but also blocks and linecrosskludge indices.
2020-05-05 13:49:47 -04:00
Misa
c8d50d3067 Re-draw tower background when dying in No Death Mode
Otherwise, if you died after entering a room with a horizontal or
vertical warp background (but not the all-sides warp background), the
warp background would be the first thing you see when going to the Game
Over screen, and would then start scrolling downwards with the proper
tower background coming in from the top.

This oversight seems to have always been in the game.

Was No Death Mode actually tested? Like, did anyone ever play through
the entire game without dying in the Warp Zone, or even AFTER completing
the Warp Zone, like, ever?
2020-05-04 23:33:37 -04:00
Misa
dc19a51d38 Fix copy-paste bug in command-line playtesting code
Found this because when I compiled with Clang, -Wself-assign-field was
enabled.
2020-05-04 14:58:52 -04:00
Misa
f78603ef87 Fix menu that you land on when you complete game or custom level
When you complete the game, you're now redirected to the play menu. This
is because your quicksave will have been deleted so you can't go back to
the summary menu.

When you complete a custom level, you'll go back to the levels list, in
case you started the level from a quicksave.
2020-05-02 23:47:37 -04:00
Misa
85074c1402 Prevent spawning crewmates/activity zones in custommode
Looks like there wasn't a custommode check for the spawning of crewmates
based on which crewmates were rescued, but now there is.

This has gone undiscovered for a long time, mostly because people don't
use the rescued() internal command.
2020-04-30 05:05:04 -04:00
Misa
192b2f2dba Don't re-draw credits scroll background every frame
While I was working on my over-30-FPS patch, I found out that the tower
background in the credits scroll was being completely re-drawn every
single frame, which was a bit wasteful and expensive. It's also harder
to interpolate for my over-30-FPS patch. I'm guessing this constant
re-draw was done because the math to get the surface scroll properly
working is a bit subtle, but I've figured the precise math out!

The first changes of this patch is just removing the unconditional
`map.tdrawback = true;`, and having to set `map.scrolldir` everywhere to
get the credits scrolling in the right direction but make sure the title
screen doesn't start scrolling like a descending tower, too.

After that, the first problem is that it looks like the ACTION press to
speed up the credits scrolling doesn't speed up the background, too. No
problem, just shove a `!game.press_action` check in
`gamecompletelogic()`.

However, this introduces a mini-problem, which is that NOW when you hold
down ACTION, the background appears to be slowly getting out of sync
with the credits text by a one-pixel-per-second difference. This is
actually due to the fact that, as a result of me adding the conditional,
`map.bscroll` is no longer always unconditionally getting set to 1,
while `game.creditposition` IS always unconditionally getting
decremented by 1. And when you hold down ACTION, `game.creditposition`
gets decremented by 6.

Thus, I need to set `map.bscroll` when holding down ACTION to be 7,
which is 6 plus 1.

Then we have another problem, which is that the incoming textures desync
when you press ACTION, and when you release ACTION. They desync by
precisely 6 pixels, which should be a familiar number. I (eventually)
tracked this down to `map.bypos` being updated at the same time
`map.bscroll` is, even though `map.bypos` should be updated a frame
later AFTER updating `map.bscroll`.

So I had to change the `map.bypos` update in `gamecompleteinput()` and
`gamecompletelogic()` to be `map.bypos += map.bscroll;` and then place
it before any `map.bscroll` update, thus ensuring that `map.bscroll`
updates exactly one frame before `map.ypos` does. I had to move the
`map.bypos += map.bscroll;` to be in `gamecompleteinput()`, because
`gamecompleteinput()` comes first before `gamecompletelogic()` in the
`main.cpp` game loop, otherwise the `map.bypos` update won't be delayed
by one frame for when you press ACTION to make it go faster, and thus
cause a desync when you press ACTION.

Oh and then after that, I had to make the descending tower background
draw a THIRD row of incoming tiles, otherwise you could see some black
flickering at the bottom of the screen when you held down ACTION.

All of this took me way too long to figure out, but now the credits
scroll works perfectly while being more optimized.
2020-04-30 05:04:13 -04:00
Misa
1fd20e5e99 Render screen effects in maprender()
I had forgotten that the game flashed and did screen-shaking when you
pressed ACTION to quicksave.

While testing for my over-30-FPS patch I stumbled across this.
2020-04-29 19:35:00 -04:00
Misa
28db7038fc Merge drawtowerbackgroundsolo() into drawtowerbackground()
It's less code being copied and pasted, especially since for my
over-30-FPS patch I would have to make a separate function for each if
both of them were still there, but if they're unified into one then I
will only have to make one more function.

And since map.scrolldir is now used outside of GAMEMODE, we'll need to
reset it in hardreset() and when exiting playtesting.
2020-04-29 18:08:13 -04:00
Misa
e9dd38ee35 Fix descending tower BG redraw
Due to the previous commit, the descending tower background now has to
account for map.bscroll, or else it will be off by one pixel from the
incoming textures. But ascending tower backgrounds work fine, so no need
to do anything with those.
2020-04-29 18:08:13 -04:00
Misa
b50ca5b9e6 Don't redraw tower background in descending towers
Looks like this was done as a quick fix instead of taking the time to
figure out the math needed to actually draw the incoming textures, which
is fair enough - it only makes one room, Panic Room, slightly laggier.

While I was working on my over-30-FPS patch, though, I came across the
fact that this background kept getting entirely redrawn every frame, and
it seems like it would be easier to interpolate descending tower
backgrounds if we scrolled what was already there instead.

Here, we have to draw two rows of incoming textures, otherwise the
scrolling surface will produce black lines.
2020-04-29 18:08:13 -04:00
Misa
f33cbfbe62 Fix editor menu being drawn on top of editor with BGs disabled
Previously, if you had backgrounds disabled in accessibility options,
and went to the editor and opened up the editor menu, it would be drawn
straight on top of what was already there in the editor instead of being
drawn on top of black. So now it's drawn on top of black.
2020-04-29 14:25:39 -04:00
Misa
e92a21cf8a Fix exiting No Death Mode being one menu too far back
I want exiting No Death Mode to go back to the "play modes" menu, not to
the "start game" menu, because it's too far back. Also do the same if
you either die or complete No Death Mode.

Also I initialized Game::wasinintermission, probably a good thing to
initialize variables.
2020-04-27 15:41:07 -04:00
Misa
585ff51ec6 Call hardreset() when returning to menu from editor
During testing, I made a cursed level that set the flash timer to
precisely 1,000,000 frames. It turns out that if I activated the timer
in playtesting, exited playtesting, and exited the editor without ever
re-entering playtesting, the timer still kept going. So to prevent being
able to do that, we should hardreset() when exiting the editor.
2020-04-27 15:07:58 -04:00
Misa
edb930344a Reset screen effects timers in hardreset()
That way a gigantic timer from one in-game jaunt doesn't carry over to
the next.
2020-04-27 15:07:58 -04:00
Misa
94edfcf87e Only render screen effects on the title screen and in-game
In-game because that's where screen effects are used the most. But on
the title screen, screen effects are used when you press ACTION to start
the game, and when you enable screen effects, too.

Otherwise, we don't need screen effects for any other game-gamestate.
2020-04-27 15:07:58 -04:00
Misa
857937326e Put screen effects render handling inside a function
This de-duplicates the screen effects rendering code by putting it
inside a function, Graphics::renderwithscreeneffects(), and using that
instead of copy-pasted code.
2020-04-27 15:07:58 -04:00
Misa
0e082551b1 De-duplicate screen effects timer decrementing
The code to decrement the timers for flashing and shaking is now handled
outside the game-gamestate case-switch, instead of having to be
duplicated inside each render function.

As a bonus, I made it so the timer decrements even if screen effects are
disabled. This is to prevent any theoretical situation where the timer
can "pile up" due to disabled screen effects not letting it tick down.
2020-04-27 15:07:58 -04:00
Misa
b26e94b919 Simplify GAMEMODE loop
Now that towers no longer use separate functions, we can remove the
map.towermode conditional.
2020-04-26 19:07:40 -04:00
Misa
53bad3bcaf Merge towerrender() into gamerender()
This removes a lot of duplicate code, which towerrender() mostly
consisted of, even though the only difference is that it draws a
separate map and screen edge spikes are drawn.
2020-04-26 19:07:40 -04:00
Misa
660f752bae Merge drawtowerentities() into drawentities()
This removes lots of duplicated code that drawtowerentities() did,
because all that really changed was accounting for map.ypos (which can
be done conditionally) and where and when the room wrapped (which can
also be done conditionally).
2020-04-26 19:07:40 -04:00
Misa
b5e813dbbb Make Graphics::drawentities() use a case-switch instead of an else-if
Makes it easier to read and doesn't require copy-pasting or re-typing
'obj.entities[i].size =='.
2020-04-26 19:07:40 -04:00
Misa
02dc1084e7 Fix offscreen teleporter rendering
This fixes an oddity that's only visual, which could only happen in
custom levels by using the createentity() internal command.

For the same reason that the second through fourth tiles of moving
platforms on the top and left was buggily rendered, SDL_BlitSurface()
strikes again to mutate the SDL_Rect we pass it and render the next
SDL_BlitSurface() call inbounds, even though we don't need it to.
2020-04-26 19:07:40 -04:00
Misa
4c45a8ac47 Prevent double-rendering of warping sprites on left and top of screen
Previously, the game could end up rendering a warping sprite twice due
to the fact that it could run "if entity is on the right side of the
screen" right after "if entity is on the left side of the screen" (but
not the other way around). This is most noticeable if you have a custom
player sprite with translucent pixels and stand on the left side of a
warping screen, but the code suggests it happens when warping through
the top of the screen, too.
2020-04-26 19:07:40 -04:00
Misa
276daa11bb Invert entity invis check to reduce indentation level
Instead of doing

    if (!obj.entities[i].invis)
    {
        ...
    }

It's better to do

    if (obj.entities[i].invis)
    {
        continue;
    }

    ...

It reduces the indentation by one level, which is always a good thing.
2020-04-26 19:07:40 -04:00
Misa
3f46a0a2e9 Remove temporary indents from the last commit
In the last commit, I removed having the flip mode conditional directly
inside the sprite-drawing code for each size type, which would reduce
the indentation one level. However, I opted to hold off un-indenting
until this commit, otherwise it would've produced too much noise.
2020-04-26 19:07:40 -04:00
Misa
8536185661 De-duplicate flip mode conditional code in Graphics::drawentities()
The game uses flipsprites.png instead of sprites.png when in flip mode,
mostly to add exceptions for sprites that SHOULDN'T be flipped in flip
mode.

Looks like to achieve this, the routines for sprite drawing got
copy-and-pasted every single time flipsprites.png needed to be
conditionally used, resulting in large amounts of copy-pasted code. And
this copy-pasted code resulted in copy-paste errors, with relating to
VVVVVV-Man, because apparently due to two copy-pasting errors, the
combined giant crewmate in the epilogue uses flipsprites.png even if you
aren't in flip mode, and it also uses the width instead of the height of
sprites_rect when in flip mode (although, this doesn't end up mattering,
but still).

The solution here is to simply change the referenced sprites vector to a
pointer that can conditionally change based on the game being in flip
mode or not.
2020-04-26 19:07:40 -04:00
Misa
c040ceda29 Merge towerlogic() into gamelogic()
This doesn't change anything functionality-wise, but it does remove a
lot of duplicate code, which makes it easier to work on.
2020-04-26 19:07:40 -04:00
Misa
841bfb7eae Fix music not being silent during trinket/crewmate collect
Looks like I forgot to test that my music silencing patch didn't break
the music being silent during the "You have found a shiny trinket" and
"You have found a shiny crewmate" text boxes. So I've added a check for
game.completestop in the music handling in main.cpp.

Found this bug while I was testing my towerlogic/gamelogic merge patch.
2020-04-26 19:07:40 -04:00
Misa
197c7caf08 Add and use Game::save_exists()
This is simply a shorthand for telesummary != "" || quicksummary != "",
to make it easier and less error-prone to negate. This improves
readability.
2020-04-26 17:20:16 -04:00
Misa
7df42242e7 Actually delete saves/unlock.vvv in deletestats()
Having to blank everything out in the stats file is very kludge-y.
2020-04-26 17:20:16 -04:00
Misa
2076898020 Fix deletequick() and deletetele() not deleting their files
The problem here is that we're directly using the C stdio library,
instead of using PHYSFS's stuff. So I've added a function
FILESYSTEM_delete() that does exactly that.
2020-04-26 17:20:16 -04:00
Misa
842eb669b7 Make deletequick() and deletetele() error messages less vague
Now it clearly specifies exactly which file failed to be deleted.
2020-04-26 17:20:16 -04:00
Misa
4f3df23e02 Don't clear telesummary/quicksummary if delete unsuccessful
Otherwise the game will think the saves are gone even though they still
exist.
2020-04-26 17:20:16 -04:00
Misa
047d71840b Remove unnecessary 'game.' qualifiers in Game.cpp
No need to refer to the class global name if we're already in the class
itself.
2020-04-26 17:20:16 -04:00
Misa
85f851bc17 Make "start game" goto play menu if any unlocks, even if saves deleted
This commit fixes a slightly frustrating thing where if you start a new
game, and then exit before saving, "start game" will always take you to
a new game, even though you have unlocked things like the Secret Lab or
Time Trials.

Now, if you select "new game" (only possible if you have something
unlocked), then quit before saving, "start game" will still take you to
the play menu, but "continue" is replaced with "start" and "new game" is
gone.
2020-04-26 17:20:16 -04:00
Misa
833bbdbbef Add function Game::anything_unlocked()
This will be a useful shorthand to ask "do we have the Secret Lab, or
any Time Trial, or Intermission replays, or No Death Mode, or Flip Mode
unlocked?"
2020-04-26 17:20:16 -04:00
Misa
dc2adea8ee Improve ed_settings Esc press handling
This fixes being able to rack up a large amount of stack frames by
pressing Esc repeatedly in the editor, which would be a problem if you
were to then return to the main menu afterwards.

Instead, if Menu::ed_settings is already in the stack, the game will
simply return to that menu instead of creating it. Else, it will just
create the menu.

Also, as extra attention to detail, I made sure that the menu create or
return only happens if Esc opens the settings menu, and not when Esc is
closes it.
2020-04-26 08:15:30 -04:00
Misa
98e33fca9e Fix editor menu options going back to editor not using returnmenu()
Instead of directly using Game::createmenu(Menu::ed_settings), we should
be using Game::returnmenu() here, so the stack frames don't keep piling
up.
2020-04-26 08:15:30 -04:00
Misa
9fca3e111f Improve quit-to-menu menu handling
This stabilizes the code that handles the menu that you land on if you
press Esc and quit to the menu.

Instead of using Game::returnmenu(), we now use the new function
Game::returntomenu() to clearly express intent that we want to return to
a specific menu. So I've added another kludge variable
Game::wasinintermission for the was-in-intermission case.

Also, I made it so that if you didn't have a main game telesave or
quicksave, you just get brought back to the main menu. Because you
shouldn't be able to go to the play menu without a quicksave or
telesave.
2020-04-26 08:15:30 -04:00
Misa
536184f394 Add function Game::returntomenu()
When exiting from a game-gamestate which may have been entered through a
varying amount of menus, the solution is to not use Game::returnmenu(),
and to instead have a way to go back to a certain given menu.
2020-04-26 08:15:30 -04:00
Misa
a60cdb3ab7 Fix the 2nd to 4th tiles of moving plats rendering offset from 1st tile
This commit fixes a bug where the second, third, and fourth tiles of
moving platforms would render offset from the first tile if the moving
platform hit the top or left edge of the screen.

This is due to the fact that SDL_BlitSurface() will end up changing the
coordinates of the rectangle we pass to it to be 0 if they're negative,
but only after it's already been drawn. Previously, we kept re-using the
same rectangle each time we drew each segment of the moving platform,
but since it only changes the draw rectangle after it's already been
drawn, the first tile shows up fine, but not the rest of the tiles,
hence resulting in an offset.

To fix this, we do the same thing as we did for drawing the "really big
sprite" (size-type 9): just reset the rectangle we use every time we
draw a segment of the moving platform.
2020-04-25 18:20:33 -04:00
Misa
da612de1f4 De-duplicate size-type 2/8 drawing by putting them together
They're literally the exact same thing, except one is 4 and the other
has an 8. No need to have all that copy-pasted code.

Actually, the only other difference was that size-type 8 set the
drawRect to sprites_rect instead of tiles_rect for some reason? Even
though it doesn't matter, anyway, because SDL_BlitSurface() only cares
about the X and Y you pass it, not the width and height, which is the
only difference between tiles_rect and sprites_rect.

To make sure that people wouldn't wonder where size-type 8 went if they
saw a blank space between size-type 7 and size-type 9, I kept the
size-type 8 conditional, but inside it is just a comment telling you to
go to size-type 2.
2020-04-25 18:20:33 -04:00
Misa
2f180bb6df De-duplicate repeated size-type 2/8 tile drawing with a for-loop
For some reason, previously it looked like this was a for-loop that was
manually unrolled (or never rolled up in the first place).
2020-04-25 18:20:33 -04:00
Misa
a6c1d13603 De-duplicate map.custommode check when drawing size-type 2/8 entities
Instead of copy-pasting all the BlitSurfaceStandard()s all over again,
just make the referenced vector a pointer that changes depending on
map.custommode.
2020-04-25 18:20:33 -04:00
Misa
6e0b267aac Draw first-pass of H/V warp BGs 3 pixels to the left
There's a noticeable seam in the horizontal and warp backgrounds
whenever you enter a new room. Entering a new room triggers the game to
re-draw the entire warp background instead of simply scrolling what it
already has. This seam is the result of the initial background draw
being misaligned with the rest of the scrolling.

If you get out your measuring tools, you'll see that it's misaligned by
exactly 3 pixels (this applies to both horizontal and vertical warping).
If you look at the part of the code where the game draws fresh warping
textures after scrolling the existing ones offscreen, you'll see it
starts with an offset of 317, which is exactly 320 minus 3. And for
vertical, it uses 237, which is exactly 240 minus 3.

This is where the misalignment comes from. Since the incoming textures
are drawn 3 pixels to the left, but the initial draw isn't, this results
in a misalignment and causes the seam.

To fix this, draw the initial draw of the horizontal and vertical warp
backgrounds 3 pixels to the left.
2020-04-25 15:50:09 -04:00
Pierre-Alain TORET
7328508436 Fix build on DragonFlyBSD 2020-04-23 23:35:33 -04:00
Ethan Lee
ac7ee0e959 Check for GCC7 for implicit-fallthrough support 2020-04-23 15:32:34 -04:00
Misa
58e512d001 Fix weird bracketing in game.gamestate switch-case
It looks like one bracket got out-of-place for whatever reason. This
doesn't affect the case-switch at all, due to how case-switches work,
but it's still weird to look at.

Indentation has been updated accordingly.
2020-04-19 20:51:35 -04:00
Misa
4bea40fc22 Pause all audio output when the game is unfocused
Some custom levels have their own custom music and sync that music to
scripted cutscenes, which is actually pretty impressive. However,
they've always run into a small thorn, which is that you can easily
desync the music by unfocusing the game, because the audio will keep
playing when the game is unfocused.

This should remove that thorn by pausing the audio on unfocus, and
resuming when focused, so that the music can no longer desync, but you
can still pause the game by unfocusing it.

This is yet another feature in VCE that hasn't been upstreamed until
now.
2020-04-19 20:51:35 -04:00
Misa
2016ee1b60 Use an 'else' instead of re-checking 'game.muted' again
Makes the code easier to read and parse.
2020-04-19 20:51:35 -04:00
Misa
9db96f004b Remove Game::globalsound
It looks like this variable was originally intended to keep track of th
volume of the game, but then it was used as a boolean in main.cpp to
make sure the game didn't call Mix_Volume() and Mix_VolumeMusic() every
frame.

However, it is now a problem, because I put the music mute handling code
in the very branch that game.globalsound protects against, but since
game.globalsound is here, if I mute the music, then mute the whole game,
then unmute the music, and then unmute the whole game, sound effects
will no longer be muted but the music will still be muted, until I mute
and unmute the whole game again. This is annoying and inconsistent, so
I'm removing this check from the 'if (!game.muted)' branch.

Plus, given that the Mix_VolumeMusic() and Mix_Volume() calls happen
every frame if the game is muted anyways, it doesn't seem to be a
problem to call these every frame.
2020-04-19 20:51:35 -04:00
Misa
c176127529 Remove useless attributes m_globalVol, set/getGlobalSound from Game
These do basically nothing. The only time they're used is
getGlobalSound() in an if-statement in main.cpp, but all that
if-conditional does is call setGlobalSound() anyway, which is something
that doesn't really have any side effects. So I'm removing these vars to
simplify the code.
2020-04-19 20:51:35 -04:00
Misa
aacd39f5c6 Add "Press N to mute music only" to "Game paused" screen
Because there's a "Press M to mute in game" hint, I'll add a "Press N to
mute music only" hint as well to be consistent.
2020-04-19 20:51:35 -04:00
Misa
43b1b71da1 Add being able to mute the music by pressing N
This is for people who want to use their own soundtrack while playing
the game, but who don't want to mute the sound effects as well.

This feature was added to VCE, but it was added in the strangest way. It
was made an option in "game options" instead of being a keybind, and I
don't know why.
2020-04-19 20:51:35 -04:00
Ethan Lee
68bb84f90b Bools are hard... 2020-04-18 11:38:27 -04:00
Ethan Lee
6f26443783 Pull openDirectoryEnabled out of the openDirectory ifdefness 2020-04-18 11:37:28 -04:00
Misa
ca0e9ec963 Disable "open level folder" in Steam Big Picture mode
The environment variable SteamTenfoot corresponds with the game running
in Steam Big Picture mode or SteamOS if it is defined. There's a
certification process for both full controller support and Big Picture
mode, and being able to launch a file window in Big Picture mode is an
instant cert failure.
2020-04-18 11:32:06 -04:00
Misa
bc9013c228 Add "open level folder" option to playerworlds menu
This simply adds another menu option utilizing what I added in the
previous commit.
2020-04-18 11:32:06 -04:00
Misa
6847eb3a87 Add FILESYSTEM_openDirectory() and _openDirectoryEnabled()
Have to add some includes and put these behind some ifdefs, of course.

I'm pretty sure FreeBSD and OpenBSD and Haiku are POSIX enough that the
"open" command will work on them, too.

I would've loved to make FILESYSTEM_openDirectoryEnabled a simple bool
instead of a function, but I ran into issues with putting it in the
FileSystemUtils header file, so I'll just make it a function and call it
a day.
2020-04-18 11:32:06 -04:00
Misa
ec3f937f93 Handle errors from PHYSFS_readBytes()
This fixes a bug where levels in the levels list duplicate if there's an
invalid file (such as a folder) in the levels directory.

It looks like it happens because we don't free the memory if
PHYSFS_readBytes() encounters an error, even though we should. Then we
get into Undefined Behavior territory and end up reusing memory, and
here it just happens that previously, parsing the entire XML document
for each level file was enough to make the loaded file pointer point to
garbage that would fail the metadata check, but if we optimize it so we
don't parse the entire XML document, it starts reusing memory instead.
2020-04-17 19:14:44 -04:00
Misa
9c4c76f609 Optimize editorclass::getLevelMetaData()
Now whenever it looks at a level file, it NOT parse the entire XML
document, which is a huge slowdown. Loading levels should be really
quick now.
2020-04-17 19:14:44 -04:00
Misa
9aeb9ad739 Add tag finder functions
To find each individual tag quickly, to optimize levels list loading.

I opted to not read the tags <Created>, <Modified>, and <Modifiers> as
they're actually pretty useless.

Also I've added a tag finder for <MetaData> but it's not meant to be
used directly, it's only used to check that the tag exists.
2020-04-17 19:14:44 -04:00
Misa
b4f56d39d7 Add find_tag()
This simply finds a given tag in a buffer and returns what's inside that
tag, making sure to parse XML entities and such.
2020-04-17 19:14:44 -04:00
Misa
9b4975e396 Add is_positive_num() to UtilityClass.cpp
This is a convenience function to tell if a string is not only a number
(and can thus be passed into atoi()), but is also positive in
particular.
2020-04-17 19:14:44 -04:00
Misa
a28f68968c Add replace_all()
This is just a function that will be used in the optimized tag-finding
function.
2020-04-17 19:14:44 -04:00
Misa
ae6c4223e2 Don't add -Werror=implicit-fallthrough for MSVC
MSVC doesn't have a neat equivalent, but most development happens on
Linux anyway with Clang/GCC, so it's fine to leave this error out for
MSVC.
2020-04-17 15:41:48 -04:00
Misa
57f027e478 Add -Werror=implicit-fallthrough to CMakeLists.txt
This turns the implicit-fallthrough warning into a full compile-time
error.

Implicit fallthrough is when you forget a break statement in a
case-switch, thus letting one case fall through into the next case and
causing debugging headaches.

This is different from the good type of fallthrough that you use to have
one case with multiple different names, like so:

    case 0:
    case 1:
    case 2:

In that case, it's obvious that you want to have fallthrough there.
2020-04-17 15:41:48 -04:00
Misa
8796f2c9e0 Fix Menu::quickloadlevel not using returnmenu()
Whoops, almost forgot this one.

Now if you hit "back to levels", your position will still be kept on the
selected level.
2020-04-17 15:41:48 -04:00
Misa
b02c4aac78 Fix going to wrong menu upon quit
The problem was, if you were in a time trial and quit, it wouldn't go
back to selecting your current time trial. But also if you were in a
custom level and quit, you would still be on the playerworlds menu.

The problem was twofold: first, I simply wasn't doing the custommode
check. But secondly, I couldn't use map.custommode directly, because
whenever you quit the game aggressively hardreset()s everything
immediately when you press ACTION.

There's probably a good reason for that aggressive hardreset(), so I
won't touch that hardreset() in any way. Instead, I had to introduce two
kludge variables wasintimetrial and wasincustommode to Game, and use
those to do the check proper.
2020-04-17 15:41:48 -04:00
Misa
995dc3940a Add a "previous page" option to the credits menu
The credits aren't super-long, but it's still nice to have this menu
option.

If it's the first page, "previous page" will be "last page" instead.
2020-04-17 15:41:48 -04:00
Misa
85b16b969a Add a "previous page" option to the levels list
This makes it more convenient if you have a large levels directory, as
some people in the VVVVVV custom levels community do.

On the first page, this option will change to be "last page" instead.

Since the addition of another menu option pushes up the list of levels
too close to the selected level data itself, I've had to move the list
of levels down by 4 pixels (but "next page"/"previous page"/"return to
menu" are still in their same position).

This feature was already added to VCE but hasn't been upstreamed until
now.
2020-04-17 15:41:48 -04:00
Misa
e909515f3d Don't go to main menu when exiting to menu
This also replaces some createmenu()s with returnmenu()s as needed even
when said createmenu()s already didn't go to the main menu.

Now when you exit the level editor, you'll be selecting the "level
editor" option in "play levels", and if you exit from a level you'll
still be selecting that level in the levels list.

Furthermore, regardless of what you're exiting, your cursor position
will be remembered.
2020-04-17 15:41:48 -04:00
Misa
4d9c834a13 Change gamestate ints to their enum names
This is to make it easier to read, so I don't have to reference Enums.h
if I want to know what they are referring to.
2020-04-17 15:41:48 -04:00
Misa
637a9d5665 Remove now-unused variable Game::previousmenuname
This used to be used for Menu::youwannaquit, but now it uses the same
stack frame system as everything else, so it's gone unused now.
2020-04-17 15:41:48 -04:00
Misa
2bb64198fe Use game.returnmenu() for all "return" menu options
This is to not reset your cursor position every time you return on
something. It's also to automatically keep track of which menu was the
previous menu instead of manually hardcoding said previous menu.
2020-04-17 15:41:48 -04:00
Misa
224585d774 Fix being able to mismatch summary and menu color
You were able to mismatch the color of the quicksave/telesave summary
and the text/background by pressing Esc when in the "continue" menu,
then pressing ACTION on "no, return".

This commit fixes that bug by putting the map.settowercolour(3) inside
the Menu::continuemenu creation code itself. However, since the
Menu::youwannaquit code does map.nexttowercolour() right after it does
the game.createmenu(), we also need to put the map.nexttowercolour()
before the game.createmenu() beforehand so it doesn't mess up the cyan
color that Menu::continuemenu sets.

Additionally, I removed the map.settowercolour() from the input handling
of Menu::play, as it's superfluous.
2020-04-17 15:41:48 -04:00
Misa
250be2dbb7 Mark same menus in levels list, credits, and unlock menus
This marks pressing ACTION on "next page" in the levels list, credits,
pressing ACTION on "continue" in "You have unlocked" menus, and pressing
ACTION on an unlock option in the unlock menu and time trial unlock menu
as being the same menu.

This is to prevent creating unnecessary stack frames when using said
menu options in those menus.
2020-04-17 15:41:48 -04:00
Misa
80ae625585 Remove unnecessary createmenu(Menu::graphicoptions) calls
These aren't necessary, the menu will update regardless. There isn't
even such a call for the mouse cursor toggle option, that's how
unnecessary it is.
2020-04-17 15:41:48 -04:00
Misa
bf4427c75a Add function Game::returnmenu()
It simply goes to the previous menu stack frame.
2020-04-17 15:41:48 -04:00
Misa
de0205e09b Push a stack frame when Game::createmenu() is called
Unless it's the main menu, or unless it's not the same menu. Whether or
not the menu is the same is left up to the caller, because some menus
could be the same but use different names, so we can't simply
automatically check that the names are different and assume that they
aren't the same menu.
2020-04-17 15:41:48 -04:00
Misa
58b9941d73 Add vector of MenuStackFrame menustack to Game
We need a stack to put our stack frames inside.
2020-04-17 15:41:48 -04:00
Misa
13d2d6b623 Add struct MenuStackFrame
This will be pushed onto a stack when going to a different menu so the
game can dynamically keep track of which menu option got you to which
menu.
2020-04-17 15:41:48 -04:00
Misa
503b3f1692 Move temp int off of Game
This temp variable isn't used anywhere else, and even if it was it's set
to something every time it's used, so there's no risk of this commit
breaking any backwards compatibility.
2020-04-17 15:41:48 -04:00
Misa
56a168eed6 Remove ABCDEFG comment
I assume it was so a dev could mark the spot where they needed to put in
the analogue toggle, and they found a unique yet easy to remember
sequence of characters to Ctrl+F as a marker.
2020-04-17 15:41:48 -04:00
Misa
7b233a0e69 Rename Menu::setslowdown2 to Menu::setslowdown
Now that setslowdown1 has been removed it's no longer necessary to have
a 2 on the end of setslowdown2.
2020-04-17 15:41:48 -04:00
Misa
1c2cee48a7 Remove unused menu setslowdown1
Looks like it was a remnant from the Flash days, and the "delete your
saves if you want to use slowdown" was a bit too mean so it stopped
being a thing in the C++ version.
2020-04-17 15:41:48 -04:00
Misa
9e99246e02 Turn game.currentmenuname "else-if"s into case-switches
Much more stylistic, you don't need to repeat "game.currentmenuname" for
each case, and you don't need to deal with the dangling first "if" that
doesn't have an "else".
2020-04-17 15:41:48 -04:00
Misa
ceb8d3f3d8 Remove unused variable Game::menuselection
I presume it was meant to have the text of the currently-selected menu
option inside it, before the code switched over to using the indice of
the currently-selected menu instead? Would've been more error-prone to
use the text name directly.
2020-04-17 15:41:48 -04:00
Misa
e8a07f9c3d Convert menu names to be an enum instead of being stringly-typed
Stringly-typed things are bad, because if you make a typo when typing
out a string, it's not caught at compile-time. And in the case of this
menu system, you'd have to do an excessive amount of testing to uncover
any bugs caused by a typo. Why do that when you can just use an enum and
catch compile-time errors instead?

Also, you can't use switch-case statements on stringly-typed variables.

So every menu name is now in the enum Menu::MenuName, but you can simply
refer to a menu name by just prefixing it with Menu::.

Unfortunately, I've had to change the "continue" menu name to be
"continuemenu", because "continue" is a keyword in C and C++. Also, it
looks like "timetrialcomplete4" is an unused menu name, even though it
was referenced in Render.cpp.
2020-04-17 15:41:48 -04:00
Misa
83ca75a831 Change "else if"-chain in editormenuactionpress to case-switch
It makes it better so you don't have to deal with that dangling first
"if" that doesn't have an 'else'.
2020-04-17 15:41:48 -04:00
Misa
78169cdc1c Move editor menu option rendering to separate function
Just like before, it makes editorrender() easier to read and reduces the
indentation level of the option rendering by one level.
2020-04-17 15:41:48 -04:00
Misa
0b5d7b1fef Move editor menu ACTION press handling to separate function
This removes a whopping four indentation levels from the ACTION
handling, and makes editorinput() easier to read.
2020-04-17 15:41:48 -04:00
Misa
d6d9b505a2 Capitalize "No Death Mode" in "not available" message
It's fully capitalized everywhere else, so why not here?
2020-04-17 15:41:48 -04:00
Misa
256ead4799 Bump version number in bottom-right to 2.3
I think it's about time that this number be updated, yeah? This isn't to
say that 2.3 is finished or almost finished or anything, this is just to
clearly differentiate that this isn't 2.2.
2020-04-17 15:41:48 -04:00
Misa
cbd7ef94ba Gray out play modes if disabled due to enabled accessibility options
If you have invincibility mode or slowdown enabled, the game will not
let you select the Secret Lab, Time Trials, or No Death Mode. To make
this clearer, this commit grays out said options if they are disabled
for that reason.
2020-04-17 15:41:48 -04:00
Misa
38d749f536 Prevent selecting Secret Lab if game isn't at full speed
The game won't let you select the Secret Lab if you're in invincibility
mode, probably so you can't set illegitimate Super Gravitron records
just by standing there and doing nothing.

However, for some reason, it'll still let you select the Secret Lab even
if you've slowed down the game. For consistency, let's prevent selecting
the Secret Lab if the game isn't running at fullspeed, too.
2020-04-17 15:41:48 -04:00
Misa
d9d0748ce3 Use case-switch for menu options where possible
I've converted every "else if"-chain in menu render/input code to be a
case-switch, except for the levels list, the "game options" menu
(because it has the MMMMMM menu option which isn't a compile-time
constant), and the "play" menu (because it has the Secret Lab menu
option which also isn't a compile-time option).

I also did NOT convert some case-switches relating to unlocks in
Input.cpp, mostly because they use a system where the "if we have this
unlocked" conditional is a part of the "if this is the current menu
option" conditional, and they use the 'else' branch to play a sad sound
if that "if we have this unlocked" conditional fails.

I've also converted the game.gameframerate and game.crewrescued() "else
if"-chains to be case-switches instead.
2020-04-17 15:41:48 -04:00
Misa
46d0b3a4e9 Fix indentation of "graphicoptions" in Render.cpp
There was one level that was indented with 2 spaces instead of 4, which
made everything else look weird. Then some lines were randomly indented
further for no reason.

Doing this before the next commit is done so as to not make the next
commit noisier.
2020-04-17 15:41:48 -04:00
Misa
678ade88b9 De-duplicate "secret lab" menu option in "play" menu
Instead of creating an entirely new menu for it, just dynamically add
the Secret Lab menu option as needed.
2020-04-17 15:41:48 -04:00
Misa
4f6835c485 De-duplicate copy-pasted input/render code in menus
This removes duplicate code that came about as a result of various
possible permutations of menu options, depending on being M&P, having no
custom level support, having no editor support, and having MMMMMM.

The menus with such permutations are the following:

- main menu
  - "start game" is gone in MAKEANDPLAY
  - "player levels" is gone in NO_CUSTOM_LEVELS
  - "view credits" is gone in MAKEANDPLAY

- "game options"
  - "unlock play data" is gone in MAKEANDPLAY
  - "soundtrack" is gone if you don't have an mmmmmm.vvv file

- "player levels"
  - "level editor" is gone in NO_EDITOR

I achieve this de-duplication by clever use of calculating offsets,
which I feel is the best way to de-duplicate the code with the least
amount of work, if a little brittle.

The other options are to (1) put function pointers on each MenuOption
object, which is pretty verbose and would inflate Game::createmenu() by
a lot, (2) switch all game.currentmenuoption checks to instead check for
the text of the currently-selected menu option, which is very
error-prone because if you make a typo it won't be caught at
compile-time, (3) add a unique ID to each MenuOption object that
represents a text but will error at compile-time if you make a typo,
however this just duplicates all the menu option text, which is more
code than was duplicated previously.

So I just went with this one.
2020-04-17 15:41:48 -04:00
Misa
bf62233b60 Fix compile failure if both MAKEANDPLAY and NO_CUSTOM_LEVELS are defined
I don't know why you would have to have both defined simultaneously, but
now you can.

The compile fail was caused by the fact that if both were defined, then
there would be an expression like this in Map.cpp:

    switch (t)
    {
    case 0:
    }

which is an invalid expression.

The solution is to put 'case 0:' into the MAKEANDPLAY ifdef-guard as
well.
2020-04-17 15:41:48 -04:00
Misa
4ace8d15be Fix NO_CUSTOM_LEVELS builds breaking after command-line playtesting 2020-04-17 15:41:48 -04:00
Misa
b835ce3927 Move menu rendering to separate function
Just like I moved the menu ACTION press handler, I'm doing this as well.
It only removes one level of indentation, but it makes titlerender()
easier to understand.

Just like before, I have to put the separate function first, else
titlerender() won't know what it is.
2020-04-17 15:41:48 -04:00
Misa
1e3879b8fe De-duplicate "You have unlocked" menu input and options
They all have the same input handling and menu options, so condense them
into one block instead of duplicating the same block of code multiple
times.
2020-04-17 15:41:48 -04:00
Misa
119d2ad25f Condense indentation levels of else-if chain in "play" menu
Previously, the code looked something like:

    else { if (...) {...} else { if (...) {...} else { etc. } }

And kept indenting every time there was an else-if.

This commit puts all else-ifs on the same indentation level, so it
doesn't slowly push the code to the right.
2020-04-17 15:41:48 -04:00
Misa
be64d4f704 Move menu ACTION press handling to separate function
This takes out 3 indentation levels from the ACTION press handling,
making titleinput() easier to read as a whole.

Unfortunately, we have to put menuactionpress() first, even though I'd
want it the other way around, otherwise titleinput() won't know what it
is.
2020-04-17 15:41:48 -04:00
Misa
fe178f817b Remove outdated commented-out graphics options code
If we need it (which I don't think we will be anytime soon) we can
always just get it back through source control. Otherwise, it simply
gets in the way.
2020-04-17 15:41:48 -04:00
Misa
511de0c5c1 Refactor menu creation code
Firstly, menu options are no longer ad-hoc objects, and are added by
using Game::option() (this is the biggest change). This removes the
vector Game::menuoptionsactive, and Game::menuoptions is now a vector of
MenuOption instead of std::string.

Secondly, the manual tracker variable of the amount of menu options,
Game::nummenuoptions, has been removed, in favor of using vectors
properly and using Game::menuoptions::size().

As a result, a lot of copy-pasted code has been removed from
Game::createmenu(), mostly due to having to have different versions of
menus depending on whether or not we have certain defines, or having an
mmmmmm.vvv file inside the VVVVVV directory. In the old days, you
couldn't just add or remove a menu option conveniently, you had to
shuffle around the position of every other menu option too, which
resulted in lots of copy-pasted code. But now this copy-pasted code has
been de-duplicated, at least in Game::createmenu().
2020-04-17 15:41:48 -04:00
Misa
a0d2be6362 Add Game::option()
This simply adds a menu option to the list of menu options, and is neat
and tidy and not messy.
2020-04-17 15:41:48 -04:00
Misa
c5db440318 Add struct MenuOption
This fully represents an actual menu option object, instead of having
both attributes of a menu option go off and be in separate vectors.
2020-04-17 15:41:48 -04:00
Misa
5fdbaa0076 Remove unused function entityclass::cblocks()
Just noticed this was unused, so I'm removing it.
2020-04-14 22:54:16 -04:00
Misa
76e3b3ede4 Remove map.numshinytrinkets
This removes map.numshinytrinkets in favor of using
map.shinytrinkets.size(). Having automatic length tracking is much less
error-prone and less tedious.
2020-04-14 22:54:16 -04:00
Misa
4f7290440b Remove now-unused parameter 't' from mapclass::settrinket()
This parameter used to be used to set the trinket based on indice, but
now that we push_back it's no longer used.
2020-04-14 22:54:16 -04:00
Misa
d43daa5fae Dynamically add shinytrinkets instead of using indices
That is, instead of doing shinytrinkets[t] = ..., do
shinytrinkets.push_back(...).
2020-04-14 22:54:16 -04:00
Misa
d63ba761d5 Remove map.numteleporters
This removes the separate length-tracking variable map.numteleporters,
in favor of using map.teleporters.size().
2020-04-14 22:54:16 -04:00
Misa
5b9c6a9680 Remove now-unused parameter 't' from mapclass::setteleporter()
This was previously used to set the indice of the teleporter, but now
that we do push_back() it's no longer necessary and is now unused.
2020-04-14 22:54:16 -04:00
Misa
fd7d6076e0 Dynamically add teleporters instead of using indices
That is, instead of doing the following:

    teleporters[0] = ...;
    teleporters[1] = ...;
    teleporters[2] = ...;
    ...

Instead do:

    teleporters.push_back(...);
    teleporters.push_back(...);
    teleporters.push_back(...);
    ...
2020-04-14 22:54:16 -04:00
Misa
d4034661e2 Don't use std::count() in Game::crewmates()
The less STL usage, the better.
2020-04-09 19:20:31 -04:00
Misa
3774ec390c Don't use std::count() in Game::trinkets()
The less STL, the better.
2020-04-09 19:20:31 -04:00
Misa
45e7a9db3e Use for-loop in Game::crewrescued()
It's better to not use an STL function here.
2020-04-09 19:20:31 -04:00
Misa
a37715abb6 Put trinkets() and crewmates() declaration on their own lines
Done to improve readability.
2020-04-09 19:20:31 -04:00
Misa
17a64aee7a Make obj.customcollect a vector of bools
It's already treated as a vector of bools, so might as well formally
declare it as that.
2020-04-09 19:20:31 -04:00
Misa
8507bdc65d Change obj.collect into a vector of bools
It's already treated like a bunch of bools anyway, so might as well just
formalize it.
2020-04-09 19:20:31 -04:00
Misa
7493129044 Remove unused function entityclass::confirmflags()
Same as before, flags can never be the number 2, and never could be even
before I changed all flags to be bools. Also this function is unused.
2020-04-09 19:20:31 -04:00
Misa
ee5f8dce78 Remove unused function entityclass::resetflags()
This looks like a weird hack, but there's no way a flag will ever end up
being 2, not even before I changed all flags to be bools instead.
2020-04-09 19:20:31 -04:00
Misa
0648d6bb0f Remove unused function entityclass::changecustomcollect()
Looks like all accesses on obj.customcollect are done manually, so this
function is unused.
2020-04-09 19:20:31 -04:00
Misa
a6340f356e Remove unused function entityclass::changecollect()
Looks like all access on obj.collect are done manually, so this function
is unused.
2020-04-09 19:20:31 -04:00
Misa
c24e2abfad Remove now-unused function entityclass::changeflag()
It's now unused after I changed it so that every obj.flags access is
done directly, instead of going through this function.
2020-04-09 19:20:31 -04:00
Misa
2ba9a0e67b Don't use obj.changeflag() to set flags
The way I see it, that function is basically an unnecessary middleman.
2020-04-09 19:20:31 -04:00
Misa
abfae6b4d7 Declare obj.flags a vector of bools instead of ints
It's treated like a bool anyway, so might as well make it one.

This also necessitates updating every single instance where it or an
element inside it is used, too.
2020-04-09 19:20:31 -04:00
Misa
2f1c400c9a Remove temporary UtilityClass from Game::savestats()
Looks like it was here from that arg passing stuff from earlier, as a
workaround to not pass args around. Well, there's no need to create an
extra UtilityClass now either, just use the one in the global namespace.
2020-04-09 19:20:31 -04:00
Misa
699af342e8 Refactor Game::crewrescued() to use std::count() instead
Makes the code less hardcoded, take up less lines, and is way easier to
read.
2020-04-09 19:20:31 -04:00
Misa
588a49dbc8 Remove useless variable game.timerStartTime
It sometimes gets set to SDL_GetTicks(), but without being checked or
actually used, it's useless and does nothing.
2020-04-09 19:20:31 -04:00
Misa
6428a14244 Declare game.teleport as a bool instead of an int
This should affect nothing, but it's a bit confusing to have it declared
an int. Everywhere in the code treats it as a bool anyway.
2020-04-09 19:20:31 -04:00
Misa
c5803863bf Remove unused variables temp_unlock and temp_unlocknotify
Have no idea why they're here, so removing them.
2020-04-09 19:20:31 -04:00
Misa
1110d46c8b Remove unused stat_* variables
Looks like all variables other than stat_trinkets are unused.
2020-04-09 19:20:31 -04:00
Misa
317eece28d Remove useless variable game.coins
It kept getting set to 0 and getting incremented sometimes, but without
it ever actually getting checked, it's a useless variable.
2020-04-09 19:20:31 -04:00
Misa
756c409d1d Remove unused variable game.trinkencollect
Don't know why it's here. Looks like a typo of 'trinketcollect' maybe?
2020-04-09 19:20:31 -04:00
Misa
fb9791a4c7 Remove now-useless function editorclass::countstuff()
Previously, it existed solely to count the number of trinkets and
crewmates when loading a level, because we were keeping track of the
amount of them manually, incrementing and decrementing every time a
trinket or crewmate was added or removed, but loading a new level
represented a case that could potentially not be an increment or
decrement.

However, since the amount tracking is now handled automatically, this
function now does nothing, and can be safely removed.
2020-04-09 19:20:31 -04:00
Misa
89b6b67a77 Don't use separate variable for number of crewmates in level
Same as previous commit, this time for crewmates.
2020-04-09 19:20:31 -04:00
Misa
0047dc8d81 Don't use separate variable for number of trinkets in level
Same principle as removing the separate variable to track number of
collected trinkets. This means it's less error-prone as we're no longer
tracking number of trinkets separately.

In the function that counts the number of trinkets, I would've liked to
have used std::count_if(). However, the most optimal way would require
using a lambda, and lambdas are too new for the C++ standard we're
using. So I just bit the bullet and counted them manually.
2020-04-09 19:20:31 -04:00
Misa
5661f46a52 Remove unnecessary int casts relating to custom crewmate numbers
I don't know why these are here, but there's never a point where these
integers were at any risk of no longer being integers.
2020-04-09 19:20:31 -04:00
Misa
6b317c5ab9 Remove map.customcrewmates
Same as the previous commit, except for the amount of custom crewmates.
2020-04-09 19:20:31 -04:00
Misa
85bd7d9a2d Remove map.customtrinkets
This variable's sole purpose is to copy ed.numtrinkets, even though ed
has always been a name that's been accessible globally. So let's not
dupe cope.
2020-04-09 19:20:31 -04:00
Misa
c077e51fb4 Don't use separate variable for number of collected crewmates
Same as previous commit, except for crewmates in custom levels instead.
2020-04-09 19:20:31 -04:00
Misa
9510c3c871 Don't use separate variable for number of collected trinkets
game.trinkets is supposed to be correlated with obj.collect, however why
not just count obj.collect directly?

This turns game.trinkets into a function, game.trinkets(), which will
directly count the number of collected trinkets and return it. This will
fix a few corner cases where the number of trinkets can desync with the
actual collection statuses of trinkets.

In order to keep save compatibility with previous versions of VVVVVV,
the game will still write the <trinkets> variable. However, it will not
read the <trinkets> variable from a save file.
2020-04-09 19:20:31 -04:00
leo60228
94b2ebd55c
Implement command-line playtesting (#163) 2020-04-09 15:03:24 -04:00
Misa
4511ea172e Don't boot user back to main menu after toggling using MMMMMM
It's a bit rude to put the user back at the main menu after toggling
something. Maybe they also wanted to do something else in the menu while
they're toggling MMMMMM, there's no reason to immediately put them back
there.
2020-04-06 15:41:52 -04:00
Misa
5a9cd861ef Don't update game.stat_trinkets in custom levels
Whenever you collect a trinket, game.stat_trinkets gets updated (if
applicable) to signify the greatest amount of trinkets you have ever
collected in the game. However, custom levels shouldn't be able to
affect this, as their trinkets are not the same trinkets as the main
game.
2020-04-05 18:31:03 -04:00
Misa
7f0db19abd Fix memory leak from warping moving platforms
It turns out that when the game warps moving platforms, it won't remove
the block from the position before they warped. Eventually, these blocks
will pile up and will never be removed, causing a memory leak.
2020-04-04 16:26:15 -04:00
Misa
79a54f23e6 De-dupe screen transition / warping logic
I noticed that the code for going to the adjacent room when offscreen
and for warping instead if the room is warping was a bit
copy-and-pasted. To clean up the code a bit, there's now 5 separate
checks in gamelogic():

if (map.warpx)
if (map.warpy)
if (map.warpy && !map.warpx)
if (!map.warpy)
if (!map.warpx)

I made sure to preserve the previous weird horizontal warping behavior
that happens with vertical warping (thus the middle one), and to
preserve the frame ordering just in case there's something dependent on
the frame ordering.

The frame ordering is that first it will warp you horizontally, if
applicable, then it will warp you vertically, if applicable. Then if you
have vertical warping only, that weird horizontal warp. Then it will
screen transition you vertically, if applicable. Then it will screen
transition you horizontally, if applicable.

To explain the weird horizontal warp with the vertical warp: apparently
if an entity is far offscreen enough, and if that entity is not the
player, it will be warped horizontally during a vertical warp. The
points at which it will warp is 30 pixels farther out than normal
horizontal warping.

I think someone ran into this before, but my memory is fuzzy. The best I
can recall is that they were probably createentity()ing a high-speed
horizontally-moving enemy in a vertically warping room, only to discover
that said enemy kept warping horizontally.
2020-04-04 16:26:15 -04:00
Misa
7899cb8088 Condense some nested else-if statements
It's better to write 'else if' than 'else { if }'.
2020-04-04 16:26:15 -04:00
Misa
e6c6c7cf60 Condense some nested if-statements in gamelogic()
It's better to write if (cond1 && cond2) than it is to write if (cond1)
{ if (cond2) }.
2020-04-04 16:26:15 -04:00
Misa
3818340011 Clean up some indentation in gamelogic()
This is just a miscellaneous indentation cleanup to fix some places
where it is indented with 2 spaces instead of 4.
2020-04-04 16:26:15 -04:00
Misa
37a3670dde Rename titlerender.cpp to Render.cpp
This also renames titlerender.h to Render.h, and updates all references
to titlerender.cpp accordingly.
2020-04-04 02:05:41 -04:00
Misa
97e340b5a7 Fix typo "Your have unlocked" to "You have unlocked"
Looks like this was copy-pasted for every single unlock message, too.
Either everyone is THAT blind, or everyone is too lazy, or both.
2020-04-04 00:20:45 -04:00
Misa
168fa53f7c Refactor scriptclass txt to not use a separate length-tracker
This removes the variable txtnumlines off of scriptclass, in favor of
using txt.size() instead.
2020-04-03 23:28:47 -04:00
Misa
31321ee19c Remove textboxclass's firstcreate and clear, simplify initializations
As a result of the previous commit, textboxclass::clear() is now unused.
textboxclass::firstcreate() was already useless. So remove both those
functions and initialize the values in the textboxclass constructor.
2020-04-03 23:28:47 -04:00
Misa
09c9a6b862 Refactor text box contents to not use a separate length-tracker
This removes the variable numlines from each text box object, in favor
of using line.size().
2020-04-03 23:28:47 -04:00
Misa
2ec1080b3d Remove remnant of 'active' if-conditional
This commit removes that 'if (true)' and unindents everything in
drawgui() by one level.
2020-04-03 23:28:47 -04:00
Misa
bc0d22eec6 Refactor text boxes to not use the 'active' system
This removes the variables graphics.ntextbox, as well as removing
'active' from each text box object. Thus, all text boxes are really
real, and you don't have to check its 'active' variable.
2020-04-03 23:28:47 -04:00
Misa
0127a84698 Move text box fadeout removal to Graphics::drawgui()
Something that's slightly annoying is that in order to make the vector
of text boxes be properly used, the text box cannot remove itself.
Because the text box does not know it's in a vector. So move the removal
of the text box to drawgui() instead.
2020-04-03 23:28:47 -04:00
Misa
313c2661af Fix nested if-statements relating to blocks in Entity.cpp
Just like earlier, these are of the form
if (cond1) { if (cond2) { if (cond3) { thing; } } }
and are really annoying to read.

Also this removes the remnants of the 'active' system that have been
replaced with 'if (true)' conditionals in order to not add noise to the
diff.
2020-04-03 23:28:47 -04:00
Misa
9de5b57989 Remove blockclass::clear(), simplify blockclass initializations
Previously, it was used in order to clear a block and deactivate it, and
the constructor function simply called clear() in order to not duplicate
code. However, clear() is no longer necessary (just remove the block
from the blocks vector), and so we can put initialization right back in
the constructor function.
2020-04-03 23:28:47 -04:00
Misa
b027a3ddc6 Fix mixed indentation in Enter-handling code when playtesting
It was indenting with 2 spaces instead of 4 spaces like the surrounding
code.
2020-04-03 23:28:47 -04:00
Misa
2a80c80f6c Fix undefined behavior when removing activity zones
It turns out the game engaged in pseudo-UB when removing activity zones,
which got turned into actual UB due to the previous commit.

There were three places where this could happen:
 - Pressing ENTER on an activity zone in normal gameplay
 - Pressing ENTER on an activity zone in in-editor playtesting (because
   the code is duped here)
 - Pressing ESC and quitting to menu while standing inside an activity
   zone

In all cases, game.activeactivity would still be pointing to a
non-existent activity zone. This activity zone in the previous system
would simply be a block with a false 'active', and in the system where
C++ vectors are used properly, would index past the blocks array.

In fact, it is a bug that when you press ENTER on an activity zone, the
activity zone prompt suddenly turns to black, then immediately
disappears. It was pointing to a block that had its clear() method
called, which is why it was all black, and it was an inactive block!
This commit makes it so pressing ENTER on an activity zone smoothly
fades out the activity zone prompt instead of being sudden black.
2020-04-03 23:28:47 -04:00
Misa
f10ac88c1a Refactor blocks to not use the 'active' system
This removes the variables obj.nblocks, as well as removing the 'active'
attribute from the block object. Now every block is guaranteed to be
real without having to check the 'active' variable.

Removing a block while iterating now uses the removeblock_iter() macro.
2020-04-03 23:28:47 -04:00
Misa
7689241d3a Add macro removeblock_iter()
When we switch blocks to not use 'active', we'll need this macro to
remove blocks while iterating through the vector, one at a time,
forwards.
2020-04-03 23:28:47 -04:00
Misa
7edbebac92 Move entityclass::setblockcolour() to blockclass::setblockcolour()
This moves the function setblockcolour(), so I can directly call it on a
particular block without having to have it be inside obj.blocks.
2020-04-03 23:28:47 -04:00
Misa
2cb90afbda Remove entclass::clear(), simplify entclass initializations
Previously there was an entclass::clear(), and initialization of an
entclass was done by calling clear() in order to not duplicate code. But
now there's no need for an entclass::clear(), and it is in fact unused
(just call entityclass::removeentity() instead), so I'm removing this
function.
2020-04-03 23:28:47 -04:00
Misa
ecf556dc55 Remove 'if (entities[i].state == 0) { }'
That's right, it's an if-conditional that does absolutely nothing.
Classic.
2020-04-03 23:28:47 -04:00
Misa
1b78db9079 Remove two '//Active' comments
I guess these were here earlier when there were 'active' conditionals,
but then I removed those, so now they look weird next to the 'i != j'
conditionals, so I'm removing them.
2020-04-03 23:28:47 -04:00
Misa
2f3eeccdf0 Fix nested if-statement chains relating to entities in Entity.cpp
These would be of the form
if (cond1) { if (cond2) { if (cond3) { thing; } } }
which is really annoying to read and could've been written as
if (cond1 && cond2 && cond3) { thing; }
so that's what I'm fixing here.

There will be another commit later that fixes this but in places related
to blocks.
2020-04-03 23:28:47 -04:00
Misa
e40a4c3948 Remove some more outdated comments from Entity.cpp
Most of these won't work if you uncomment them without any additional
changes, so it's best to just remove them.
2020-04-03 23:28:47 -04:00
Misa
0fb37352ce Make entityclass::updateentities() no longer a bool
It always returns true anyway, so why bother? And it doesn't look like
any code uses its return value, anyway.
2020-04-03 23:28:47 -04:00
Misa
46c17052c6 Remove unused function entityclass::gettype()
Not sure why this function is here. It makes sense if you know that the
game will only do certain moving platform things if you already have a
moving platform in the room, however apparently this function has
absolutely nothing to do with it.
2020-04-03 23:28:47 -04:00
Misa
744c685614 Remove entityclass::cleanup()
This function's sole purpose was to make sure obj.nentity was in sync,
and that obj.nentity-1 pointed to the last 'active' entity in
obj.entities. But now that obj.nentity is removed and we use
obj.entities.size() instead, it is no longer necessary.
2020-04-03 23:28:47 -04:00
Misa
fd417d6a8c Remove remnants of entity 'active' conditionals
In the previous commit, if an if-statement consisted solely of checking
the active attribute of an entity, I temporarily changed it to 'true'
and put a comment to remove it later, because it would add too much
noise to unindent everything in the same commit.
2020-04-03 23:28:47 -04:00
Misa
b1b1474b7b Refactor entities and linecrosskludge to not use the 'active' system
This removes the variables obj.nentity and obj.nlinecrosskludge, as well
as removing the 'active' attribute from the entity class object. Now
every entity you access is guaranteed to be real and you don't have to
check the 'active' variable.

The biggest part of this is changing createentity() to modify a
newly-created entity object and push it back instead of already
modifying an indice in obj.entities.

As well, removing an entity now uses the new obj.removeentity() function
and removeentity_iter() macro.
2020-04-03 23:28:47 -04:00
Misa
a67ab8e3a7 Add macro removeentity_iter()
Also when we switch everything to not use 'active', we'll need this
macro to remove entities while iterating forwards through the vector one
at a time.
2020-04-03 23:28:47 -04:00
Misa
1156582ceb Add entityclass::removeentity()
Ok, once we switch everything over to not use the 'active' system, it's
easier to read removeentity(t) than it is to read
entities.erase(entities.begin() + t).
2020-04-03 23:28:47 -04:00
Misa
ae84de2c7e Move entityclass::settreadmillcolour() to entclass::settreadmillcolour()
This moves settreadmillcolour() onto the entity object, so I can invoke
it independent of an indice in obj.entities.
2020-04-03 23:28:47 -04:00
Misa
f5a84d7972 Move entityclass::setenemyroom() to entclass::setenemyroom()
This moves the setenemyroom() function onto the entity object itself, so
I can more easily change all 'entities[k].' to 'entity.' in
entityclass::createentity() later.

Additionally, I've had to move the rn() macro from Entity.h to Ent.h, or
else entclass::setenemyroom() won't know what it is.
2020-04-03 23:28:47 -04:00
Misa
d4cffed176 Move entityclass::setenemy() to entclass::setenemy()
This moves the setenemy() function onto the entity object itself,
instead of having to give the indice of the entity in obj.entities. This
makes the code more object-oriented so later I can simply change all
'entities[k]' to 'entity.' in entityclass::createentity().
2020-04-03 23:28:47 -04:00
Misa
c278f05397 Remove duplicate function musicclass::stopmusic()
It is an exact duplicate of musicclass::haltdasmusik(), so use that
function instead and update callers. Looks like
musicclass::haltdasmusik() came first, anyway (musicclass::stopmusic()
was only used in editor.cpp).
2020-04-03 19:19:45 -04:00
Misa
34395435f0 Remove unused function musicclass::loopmusic()
Maybe back in the Flash days, you had to loop music manually instead of
having SDL_mixer handle it? Or something?
2020-04-03 19:19:45 -04:00
Misa
dc6d38276c Remove another outdated comment in Music.cpp
Looks like musicfade is an unused variable, anyway. I might remove it,
but I have some plans in the future that involve repairing what it was
intended for, so I'll hold off on removing it (and some other unused
variables in Music.cpp) for now.
2020-04-03 19:19:45 -04:00
Misa
e571081f92 Un-fix using-PPPPPP-while-MMMMMM-present for custom levels
As discussed earlier, some custom levels have taken advantage of the
fact that songs 0 and 7 loop and also fade in when using PPPPPP while
having an mmmmmm.vvv file present.
2020-04-03 19:19:45 -04:00
Misa
7b1388f85c Fix undefined behavior when backspacing in script list with 0 scripts
The problem is that it would index out-of-bounds if you did this, but
this UB hasn't caused an exception until my change to refactor
script-related vectors by removing their separate length-trackers.
2020-04-03 16:57:52 -04:00
Misa
dafadf158a Remove outdated comments from preloader.cpp
Was just skimming through my diffs, looks like I missed these comments
in preloader.cpp.
2020-04-03 10:40:50 -04:00
Misa
134510d26a Remove remnants of screen recording stuff
Most of the code was already commented out, and those comments were
removed in earlier commits, but this removes all recording variables
from Game and simplifies the game-gamestate handling in main.cpp a
little bit.
2020-04-03 10:40:50 -04:00
Misa
fd21fbb341 Remove outdated comments from main.cpp
Mostly comments from all the global args were not-so-global args, along
with input recording.
2020-04-03 10:40:50 -04:00
Misa
04d14000ec Remove global 'temp' variable from titlerender.cpp
Just a miscellaneous code cleanup.

There's no glitches that take advantage of the previous situation,
namely that 'temp' was a global variable in Logic.cpp and editor.cpp.
Even if there were, it seems like it would easily lead to some undefined
behavior. So it's good to clean this up.
2020-04-03 10:40:50 -04:00
Misa
d3cdd33605 Remove unused function musicclass::processmusicfade()
It's a function that does nothing, and is also used by nothing.
2020-04-03 10:40:50 -04:00
Misa
eea2232c12 Remove outdated comments from Music.h and Music.cpp
Lots of stuff from the Flash version, especially in Music.h.
2020-04-03 10:40:50 -04:00
Misa
4c2ecac0e0 Remove outdated comments from Input.cpp
There's a commented-out recording input option, which sounds
interesting.
2020-04-03 10:40:50 -04:00
Misa
d13c24b9b0 Realign logic update trio comments
This is the "Behavioral logic", "Basic Physics", and "Collisions with
walls" trio.

They were originally aligned but then I removed global args, thus
misaligning them. So now I'm re-aligning them back again.
2020-04-03 10:40:50 -04:00
Misa
07573ad738 Remove outdated comments from Logic.cpp
Earlier design decisions that have been commented out and are now
obselete.
2020-04-03 10:40:50 -04:00
Misa
9817e19150 Remove outdated comments from Map.cpp
Surprisingly not that many. It looks like at one point in development,
damage blocks were created for every single spike in the Tower, before
it was too laggy so they switched to directly checking collision with
the tile instead.
2020-04-03 10:40:50 -04:00
Misa
d1661c20a8 Remove outdated comments from Script.cpp
Some of these seem to be copy-pasting stuff and then commenting it out
if it doesn't fit the pasted case.
2020-04-03 10:40:50 -04:00
Misa
92544cbdbb Remove outdated comments from editor.cpp
A lot of these seem to be based on an earlier version of the C++ port,
but they left some Flash stuff (like the buffer lock/unlocking) in, too.
2020-04-03 10:40:50 -04:00
Misa
69364736ff Remove outdated comments from titlerender.cpp
Lots of these are from the Flash version!
2020-04-03 10:40:50 -04:00
Misa
b4937ff8d5 Remove outdated comments from Graphics.cpp
This removes a bunch of commented-out code that was clearly kept from
the Flash version, even though the Flash graphics API is much different
than SDL's. Also removes a bunch of TODOs that either say nothing, or
say something whose meaning has been totally lost to time due to being
completely vague, or something that's already been done and someone
forgot to remove the TODO.
2020-04-03 10:40:50 -04:00
Misa
b061051297 Remove outdated comments from Game.cpp
Most of this is telecookie/quickcookie stuff, which was used in the
Flash version, but there's no longer any such thing as a save cookie.

Also one TODO that says to make a function that's now been made.
2020-04-03 10:40:50 -04:00
Misa
f7ff076074 Move tempstring off of Graphics, Game, and UtilityClass
Unlike, say, the scriptclass i/j/k stuff, these tempstrings are only
purely visual, and there's no known glitches to manipulate them anyway.
Thus I think it's safe to make this cleanup.
2020-04-03 10:40:50 -04:00
Misa
ff449a2c3a Remove game.test and game.teststring
It looks like this may have been used earlier in development, judging
from the name, obviously, but right now it seems like it's used as an
error message if a main game level is asked for an invalid room (well,
only two of them - the Lab and Warp Zone). It should probably be
formalized into an error system, if we want to keep teststring, and also
people would never see it anyway because I don't think there's a
reliable and consistent way to trigger loading a non-existent room.

I have seen someone manage to load a non-existent Warp Zone room only
one time, but even then this teststring didn't pop up. So this
teststring doesn't even trigger in the right circumstances.

Also, when it does pop up, as far as I can tell it will stay onscreen,
which is kinda annoying. So I'm just removing this ancient relic from
the code.
2020-04-03 10:40:50 -04:00
Misa
9a3a8bf2be Fix mixed indentation in main.cpp
Also fix the indentation of preprocessor statements.
2020-04-03 10:40:50 -04:00
Misa
e73966f2b7 Fix only one line of mixed indentation in Music.cpp
And this is the winner for having the least amount of mixed indentation
that is nonzero.
2020-04-03 10:40:50 -04:00
Misa
b0e1079611 Fix mixed indentation in Scripts.cpp
Only 3 lines, which is really impressive and the lowest amount of mixed
indentation so far.
2020-04-03 10:40:50 -04:00
Misa
c33caefae8 Fix mixed indentation in preloader.cpp
Not that much, but only because it's not a big file to begin with.
2020-04-03 10:40:50 -04:00
Misa
31410a2d64 Remove one trailing whitespace in preloader.cpp
Only one.
2020-04-03 10:40:50 -04:00
Misa
a31a6ef614 Fix mixed indentation in titlerender.cpp
There's a lot, looks like mainly because of the person who added MMMMMM
and M&P.
2020-04-03 10:40:50 -04:00
Misa
dd8cf0f200 Fix mixed indentation in Input.cpp
There is a lot to be had for this one.
2020-04-03 10:40:50 -04:00
Misa
e56b0d9f39 Fix mixed indentation in Logic.cpp
It's clear that there was another person who added achievements and did
some warp line stuff.
2020-04-03 10:40:50 -04:00
Misa
079544c0b1 Fix mixed indentation in Entity.cpp and Entity.h
That guy who indents with 2-wide tabs to match 4-wide spaces strikes
again...
2020-04-03 10:40:50 -04:00
Misa
7c511b1550 Fix mixed indentation in GraphicsUtil.cpp
To be fair, it was more on the level of entire functions using different
indentation than the surrounding code, but it's not consistent enough
for me to justify leaving it alone.
2020-04-03 10:40:50 -04:00
Misa
0947840365 Remove unused variable Screen::glScreen
Not sure what this was meant to be - a flag for if the screen is OpenGL
or not? Either way, unused.
2020-04-03 10:40:50 -04:00
Misa
ef234d3fc0 Fix mixed indentation in Screen.cpp
Screen.cpp now consistently uses tabs.
2020-04-03 10:40:50 -04:00
Misa
4657760c2d Fix mixed indentation in Script.cpp and Script.h
Looks like the person who added starting a custom level indented with
spaces instead of tabs.
2020-04-03 10:40:50 -04:00
Misa
1310896191 Remove semi-useless function editorclass::weirdloadthing()
Looks like this function was created because editorclass::load() takes
in a string by reference, not by value, and thus mutates it afterwards,
so if you passed a string in when you didn't want it to be mutated, bad
things would happen.

However, a better workaround for the above issue would simply to
duplicate the string and pass that string instead, thus the original
string wouldn't be affected.
2020-04-03 10:40:50 -04:00
Misa
5ba1cf7571 Fix mixed indentation in Map.h and Map.cpp
Again, not that much. These files more-or-less consistently use their
respective indentation.
2020-04-03 10:40:50 -04:00
Misa
3943e160de Fix mixed indentation in Graphics.cpp
To reiterate, I just want to remove the mixed indentation that just
randomly pops up in the middle of a file, because it gets annoying.
Thus, the indentation of a particular piece of code should simply match
the surrounding code. And I consider it completely fine that this file
switches from indenting 4-wide spaces to tabs starting from
Graphics::setcol() onwards. I don't think it's worth it to untabify
Graphics::setcol() and below.
2020-04-03 10:40:50 -04:00
Misa
88c16cdae8 Fix mixed indentation in Game.cpp and Game.h
This removes all indentation that suddenly switches in the middle of a
function. Most particularly egregious offenses are the ones made by the
person who has 2-wide tabs, but keeps tabbing up to make each
indentation level match up with the 4-wide spaces, so to them (and only
them) it will look just fine, but since by default tabstop is 8-wide,
their lines are pushed off all the way to the right.
2020-04-03 10:40:50 -04:00
Misa
12d5433efc Remove trailing whitespace from all files
Surprisingly, there's not a lot of it. There is, however, a lot of mixed
indentation in this project.
2020-04-03 10:40:50 -04:00
Misa
6c6b6c68ff Change all UtilityClass::something to help.something
This changes something like UtilityClass::String to help.String,
basically. It takes less typing this way, and is a neat effect of having
global args actually be global variables.
2020-04-03 10:40:50 -04:00
Misa
c8906d97f5 Remove usages of second argument of playef() script command
Just to be in line with the removal of the argument in the actual
function itself.
2020-04-03 10:40:50 -04:00
Misa
16c3966ace Remove unused argument from musicclass::playef()
Apparently the 'offset' argument did something in the 1.x Flash
versions, but now it does nothing.
2020-04-03 10:40:50 -04:00
Misa
253d44ac0b Remove unused function musicclass::initefchannels()
It's a function that does nothing, used by no one.
2020-04-03 10:40:50 -04:00
Misa
e722251ebe Remove useless function Screen::ClearScreen()
This function does not clear the screen at all, it does absolutely
nothing.
2020-04-03 10:40:50 -04:00
Misa
691673ed30 Remove useless function updategraphicsmode()
Now that it does nothing due to some earlier changes, it's a useless
function that does nothing. (Well, it was already a useless function,
but those earlier changes made it clearer just exactly how useless it
is.) So remove that function and remove all its callsites.
2020-04-03 10:40:50 -04:00
Misa
297f1b6e3a Remove now-unused class Stage
Since I removed the useless variables 'stage' and 'swfStage' earlier,
now this class is unused. So I'm removing it, too.
2020-04-03 10:40:50 -04:00
Misa
16df287c90 Remove useless variables 'swfStage' and 'stage'
'swfStage' gets set to 'stage' in updategraphicsmode() but... that does
absolutely nothing, because they both contain exactly the same thing.
And these variables aren't referenced anywhere else. So I'm removing
both of these variables.
2020-04-03 10:40:50 -04:00
Misa
606c740b4f Remove useless variable Game::quickcookieexists
Even though it keeps getting set to true and false everywhere, it never
once gets checked. So it's a variable that does nothing.
2020-04-03 10:40:50 -04:00
Misa
340f57762d Remove useless variable Game::telecookieexists
Although it keeps getting set to true and false in various places, it
never once gets checked, essentially deeming it a variable that's used
but does nothing.
2020-04-03 10:40:50 -04:00
Misa
9cec63bcf7 Remove unused variable Game::sfpsmode
This variable does absolutely nothing, so I'm removing it.
2020-04-03 10:40:50 -04:00
Misa
66b3c32899 Remove useless function Game::telegotoship()
This function does absolutely nothing. It is, however, called once in
gamecompletelogic2(), making it technically used.
2020-04-03 10:40:50 -04:00
Misa
4f318e1ee1 Remove unused function entityclass::checkdirectional()
This function is never used anywhere in the game.
2020-04-03 10:40:50 -04:00
Misa
6a28c5de30 Remove unused arguments from Graphics::drawtile2()
The 'r', 'g', and 'b' arguments do absolutely nothing. Except unlike
Graphics::drawtile(), there's only one version of Graphics::drawtile2(),
so just remove those args and update callers.
2020-04-03 10:40:50 -04:00
Misa
5c60b8df5f Remove unused arguments from Graphics::drawtile()
The 'r', 'g', and 'b' arguments do absolutely nothing, even though
they're used in the version of Graphics::drawtile() that's more used. So
delete the other version without those extra arguments, and then remove
the extra arguments from the remaining version. And then update callers.
2020-04-03 10:40:50 -04:00
Misa
af8d7345c9 Remove unused arguments from Graphics::Hitest()
The two arguments 'col' and 'col2', both the only integer arguments of
the function, do absolutely nothing. Remove those and update callers.
2020-04-03 10:40:50 -04:00
Misa
7abf40881a Remove unused argument of entityclass::getcompanion()
The argument provided to entityclass::getcompanion() does absolutely
nothing. Remove it, and update all callers.
2020-04-03 10:40:50 -04:00
Misa
d910800423 Remove global args from main game loadlevel() functions
This removes global args from Finalclass.cpp, Labclass.cpp,
Otherlevel.cpp, Spacestation2.cpp, and WarpClass.cpp.
2020-04-03 10:40:50 -04:00
Misa
cef111d35b Remove global args from preloader.cpp
This removes all global args from preloader.cpp, and changes all 'dwgfx'
to 'graphics'.
2020-04-03 10:40:50 -04:00
Misa
07a0c74b01 Remove global args from titlerender.cpp
This removes all global args in all functions in titlerender.cpp.
Additionally, all 'dwgfx' has been renamed to 'graphics' in that file
(there are a lot of them, as you might guess).
2020-04-03 10:40:50 -04:00
Misa
a1fd4c6f02 Remove global args from Input.cpp
This removes all global args from functions in Input.cpp. Additionally,
'dwgfx' has been renamed to 'graphics' in Input.cpp.
2020-04-03 10:40:50 -04:00
Misa
2c138a4a60 Remove global args from Logic.cpp
This commit removes the passing around of global args in the logic
functions. Additionally, all 'dwgfx' has been replaced with 'graphics'
in Logic.cpp.
2020-04-03 10:40:50 -04:00
Misa
9bc45c586e Remove global args from editorclass
This removes global arg passing from all functions on editorclass.
Callers have been updated correspondingly. Additionally, all 'dwgfx' has
been replaced with 'graphics' in editor.cpp.
2020-04-03 10:40:50 -04:00
Misa
ea3c778b84 Remove global args from scriptclass
This commit removes all global args from the parameters of each function
on the scriptclass object, and updates all places they are called
accordingly. It also changes all instances of 'dwgfx' to 'graphics' in
Script.cpp.

Interestingly enough, it looks like editor.h depended on Script.h's
class define of the musicclass. I've temporarily placed the class define
in editor.h, but by the end of this patchset it'll be gone.
2020-04-03 10:40:50 -04:00
Misa
2826bd828c Remove global args from Graphics
This removes global args from all functions on the Graphics class.
Callers of those functions in other files have been updated accordingly.

Of course, since Graphics.cpp is already in the Graphics namespace,
I do not need to change all 'dwgfx' to 'graphics' in Graphics.cpp.
2020-04-03 10:40:50 -04:00
Misa
35d9bcce05 Remove global args from mapclass
This commit removes the global args being passed around from the
function args on the mapclass object, as well as updating all callers in
other files to not have those args. Furthermore, 'dwgfx' has been
renamed to 'graphics' in Map.cpp.
2020-04-03 10:40:50 -04:00
Misa
cac1a9e3ab Remove global args from entityclass
This commit removes all global args from functions on the entityclass
object, and updates the callers of those functions in other files
accordingly (most significantly, the game level files Finalclass.cpp,
Labclass.cpp, Otherlevel.cpp, Spacestation2.cpp, WarpClass.cpp, due to
them using createentity()), as well as renaming all instances of 'dwgfx'
in Entity.cpp to 'graphics'.
2020-04-03 10:40:50 -04:00
Misa
0e561f23f8 Remove global args from Game
I've decided to call dwgfx/game/map/obj/key/help/music the "global args".
Because they're essentially global variables that are being passed
around in args.

This commit removes global args from all functions on the Game class,
and deals with updating the callsites of said functions accordingly. It
also renames all usages of 'dwgfx' in Game.cpp to 'graphics', since the
global variable is called 'graphics' now.

Interesting to note, I was removing the class defines from Game.h, but
it turns out that Graphics.h depends on the mapclass and entityclass
defines from Game.h. And also Graphics.h spelled mapclass wrong (it
forgot the "class") so I just decided to use that existing line instead.
This is only temporary and after all is said and done, at the end of
this pull request those class defines will be gone.
2020-04-03 10:40:50 -04:00
Misa
1be398319c Make commands, sb, and hooklist not use separate length-trackers
This is a refactor that turns the script-related arrays `ed.sb`, and
`ed.hooklist` into C++ vectors (`script.commands` was already a vector, it was
just misused). The code handling these vectors now looks more like idiomatic
C++ than sloppily-pasted pseudo-ActionScript. This removes the variables
`script.scriptlength`, `ed.sblength`, and `ed.numhooks`, too.

This reduces the amount of code needed to e.g. simply remove something from
any of these vectors. Previously the code had to manually shift the rest of
the elements down one-by-one, and doing it manually is definitely error-prone
and tedious.

But now we can just use fancy functions like `std::vector::erase()` and
`std::remove()` to do it all in one line!

Don't worry, I checked and `std::remove()` is in the C++ standard since at least
1998.

This patch makes it so the `commands` vector gets cleared when
`scriptclass::load()` is ran. Previously, the `commands` vector never actually
properly got cleared, so there could potentially be glitches that rely on the
game indexing past the bounds set by `scriptlength` but still in-bounds in the
eyes of C++, and people could potentially rely on such an exploit...

However, I checked, and I'm pretty sure that no such glitch previously existed
at all, because the only times the vector gets indexed are when `scriptlength`
is either being incremented after starting from 0 (`add()`) or when it's
underneath a `position < scriptlength` conditional.

Furthermore, I'm unaware of anyone who has actually found or used such an
exploit, and I've been in the custom level community for 6 years.

So I think it's fine.
2020-03-24 20:20:53 -04:00
Misa
cfd355bf4d Don't let custom levels tamper with main game save data
Someone being mean could've overwritten the telesaves of unsuspecting
players, or unlocked a bunch of stuff which they shouldn't have for
those players, using things like the telesave() command and gamestates.
To prevent this, return early in Game::savequick(), Game::savetele(),
and Game::unlocknum() if we are in custommode.
2020-03-15 12:29:26 -04:00
Misa
cad0b4fcc4 Do proper error handling inside Screen::ResizeScreen()
Instead of passing the error codes out of the function, just handle the
errors directly as they happen, and fail gracefully if something goes
wrong instead of continuing.
2020-03-13 19:05:56 -04:00
Misa
9175c08763 Don't print useless false error message when toggling fullscreen
Whenever you would press Alt+Enter, or Alt+F, or on macOS Command+Enter,
or on macOS Command+F, or F11, the game would print this useless error
message to console, every single time: "Error: failed: " and it would
concatenate SDL_GetError() after it, but most of the time SDL_GetError()
is blank, so it would print just that.

Instead, what the fullscreen shortcut will now do is check the result of
the relevant SDL functions, BEFORE it decides to print an error message.
And when it DOES print an error message, it will be less vague and will
say instead "Error: toggling fullscreen failed: <output of
SDL_GetError()>".

This means Screen::ResizeScreen() and Screen::toggleFullScreen() are now
int-returning functions. Ideally, every function interfacing with SDL
would return an error code, but that's too much for this simple patch.

Additionally, I took the opportunity to clean up the surrounding
formatting of the code a bit, most notably dedenting the
keypress-clearing stuff by one tab level, converting the
shortcut-handling code to spaces, and removing commented-out code.
2020-03-13 08:40:59 -04:00
Misa
8fa916c55d Make the toggle fullscreen conditional more readable
Each check has been put in its own variable, so the final conditional is
more readable, and the ifdef is no longer right smack in the middle of
an if-statement.

Also the control flow has been changed (the "else" has been removed from
the shortcut-checking conditional) so I could put the variables closer
to the actual conditional itself. I don't think it affects anything,
though.
2020-03-12 21:20:25 -04:00
Misa
e23682615d Allow using F11 and (on macOS) RCmd+Enter/F to toggle fullscreen
This patch allows the use of pressing F11 to toggle fullscreen, as well as
allowing the use of Right Command when using the Command+Enter/F shortcut on
macOS. Apparently Alt+Enter isn't the only shortcut to toggle fullscreen,
Alt+F also works, which I didn't know before.

I'm adding F11 as a shortcut because it's a far more natural shortcut to
toggle fullscreen than this Alt+Enter or Alt+F business, which seems to be a
relic mimicking some other games and some Microsoft stuff?

I'm also adding RCommand+Enter/F because I see no reason not to. If you can
use RAlt on non-macOS, why can't you use RCommand on macOS, too?

I also cleaned up the formatting relating to the shortcut code, and made sure
the closing parenthesis was outside the ifdef so my text editor wouldn't
highlight the parenthesis inside the non-macOS ifdef-branch as a dangling
closing parenthesis, because it assumes the one in the branch above is the
actual closing parenthesis and doesn't parse macros.
2020-03-12 21:20:25 -04:00
AlexApps99
aff0c06458 Fixes #112: Backbuffer is always 32bpp 2020-03-12 10:06:23 -04:00
Misa
c322ae131e Fix unfocusing the game while in fullscreen mode
If you Alt+Tabbed while in fullscreen mode, the game would stay in
fullscreen instead of switching to windowed, but there was a chance it
would EITHER use the same internal resolution which would mismatch the
window resolution (don't know when exactly this happens, but still) and
stay being in an actual windowed mode, OR switch between
fullscreen/windowed every other time you re-focused the window, which is
annoying.

Now, whenever you Alt+Tab in fullscreen, the game will be in windowed
mode, and then when you re-focus it will go back to fullscreen.
Consistently.
2020-03-05 00:22:18 -05:00
Misa
a46d5b126c Write unlock.vvv when pressing Alt+F4
Previously, the only way to guarantee that the game actually saved your
unlock.vvv after changing an option, was to ensure you pressed ACTION on
the "quit game" menu option.

This makes Alt+F4 graceful in that pressing it will also save
unlock.vvv, as it should. Now truly UN-graceful ways of exiting the
game, such as SIGSEGV, SIGABRT, or pkill -9 or pkill -15 will not save
unlock.vvv, as should be the case.
2020-03-04 17:20:42 -05:00
Misa
5a25cad74b Don't draw text outline for roomtext in the editor
Text outline is not drawn on roomtext when you're actually playing the
game, so don't draw the outline in the editor, either.

FIQ mistakenly added text outline to roomtext in
ca9f577fc4.
2020-03-04 15:50:52 -05:00
Misa
b82a8a0925 Fix undefined behavior with left-click logic in editor
There's an if-else chain that first deals with figuring out if there's
an entity where your left-click happened, and to do this it uses
edentat(), which returns a sentinel value of -1 if there is NOT an
entity where your cursor is.

It's very important to check that the value returned ISN'T -1 before you
start indexing the 'edentity' vector, since if you DO index it with that
-1, it'll result in Undefined Behavior because you're doing an
out-of-bounds array access.

Now, here's what the if-else chain looked like before:

    if(tmp==-1 && ed.free(ed.tilex,ed.tiley)==0)
    {
        ...
    }
    else if(edentity[tmp].t==1)

The bug here is very subtle but it was an easy oversight. Basically, if
'ed.free' ended up not being zero, control flow would jump to the next
"else if" over, which then ends up asking for the -1th index of
'edentity', which is Undefined Behavior.

This undefined behavior has now resulted in a crash on my system after
TerryCavanagh/VVVVVV#172, due it shuffling things around juuuuust enough
such that this UB would end up resulting in a segfault instead of
chugging along and working fine. For me and my system, this meant that
if my first left-click in the editor upon opening the game was me
placing down a tile and not placing down an entity, the game would
crash. But, it would be fine if I first placed down an entity and then
afterwards placed down tiles, because it's UB.

And I'm almost certain this was the cause of the very strange bug where
you couldn't hold down left-click for the foreground-placing tool (but
you COULD for the background-placing tool) that seemed to occur most
often on Windows (TerryCavanagh/VVVVVV#25).

The solution to this is to stick in another conditional in the tree
before any indexing occurs, such that there's no way any other
conditionals with the indexing in the conditional tree could end up
being hit. In summary, the if-else chain looks like this now:

    if(tmp==-1 && ed.free(ed.tilex,ed.tiley)==0)
    {
        ...
    }
    else if(tmp == -1)
    {
        //Important! Do nothing, or else Undefined Behavior will happen
    }
    else if(edentity[tmp].t==1)
2020-03-02 08:22:08 -05:00
Misa
8d44d9387b Refactor edentities to not use separate length-trackers
This turns the array 'edentity' into a proper vector, and removes the need to
use a separate length-tracking variable and manually keep track of the actual
amount of edentities in the level by using the long-winded
'EditorData::GetInstance().numedentities'. This manual tracking was more
error-prone and much less maintainable.

editorclass::naddedentity() has been removed due to now functionally being the
same as editorclass::addedentity() (there's no more
'EditorData::GetInstance().numedentities' to not increment) and for also being
unused in the first place.

editorclass::copyedentity() has been removed because it was only used to shift
the rest of the edentities up manually, but now that we let C++ do all the
hard work it's no longer necessary.
2020-03-01 15:47:01 -05:00
Misa
a4d7fc017c Refactor roomtext to not use ad-hoc objects / separate length trackers
This refactors the roomtext code to (1) not use ad-hoc objects and (2)
not use a separate length-tracking variable to keep track of the actual
amount of roomtext in a room.

What I mean by ad-hoc object is, instead of formally creating a
fully-fledged struct or class and storing one vector containing that
object, this game instead hacks together an object by storing each
attribute of an object in different vectors.

In the case of roomtext, instead of making a Roomtext object that has
attributes 'x', 'y', and 'text', the 'text' attribute of each is stored
in the vector 'roomtext', the 'x' attribute of each is stored in the
vector 'roomtextx', and the 'y' attribute of each is stored in the
vector 'roomtexty'. It's only an object in the sense that you can grab
the attributes of each roomtext by using the same index across all three
vectors.

This makes it somewhat annoying to maintain and deal with, like when I
wanted add sub-tile positions to roomtext in VVVVVV: Community Edition.
Instead of being able to add attributes to an already-existing
formalized Roomtext object, I would instead have to add two more
vectors, which is inelegant. Or I could refactor the whole system, which
is what I decided to do instead.

Furthermore, this removes the separate length-tracking variable
'roomtextnumlines', which makes the code much more easy to maintain and
deal with, as the amount of roomtext is naturally tracked by C++ instead
of us having to keep track of the actual amount of roomtext manually.
2020-02-29 23:02:52 -05:00
Misa
f7e71bd668 Fix left-clicking on script boxes
You can now left-click on script boxes in order to change their script.
2020-02-21 18:15:26 -05:00
Misa
ea8053303d Initialize x to 0 in ss_toi()
This fixes a source of undefined behavior, where the int returned by
ss_toi() would be random garbage memory if the string passed into it
would be empty. That's because if the string is empty, there are no
characters to parse, so nothing simply gets put into x.

The easiest way to pass an empty string in to ss_toi() would be to use
script commands with empty arguments.
2020-02-20 00:05:55 -05:00
Ethan Lee
0531ee9b19 SDL_Init after FILESYSTEM_init, for gamecontrollerdb.txt 2020-02-19 12:44:36 -05:00
Misa
e18dd195ba Fix typo: "quiting" (one T) to "quitting" (two Ts) 2020-02-17 13:17:36 -05:00
Misa
1b04cb5dd6 Fix crewmate-found text boxes overlapping in flip mode
The problem was that the code seemed to be wrongly copy-pasted from the
code for generating the trinket-found text boxes (to the point where
even the comment for the crewmate-found text boxes didn't get changed
from "//Found a trinket!").

For the trinket-found text boxes, they use y-positions 85 and 135 if not
in flip mode, and y-positions 105 and 65 if the game IS in flip mode.
These text boxes are positioned correctly in flip mode.

However, for the crewmate-found text boxes, they use y-positions 85 and
135 if not in flip mode, as usual, but they use y-positions 105 and 135
if the game IS in flip mode. Looks like someone forgot to change the
second y-position when copy-pasting code around.

Which is actually a bit funny, because I can conclude from this that it
seems like the code to position these text boxes in flip mode was
bolted-on AFTER the initial code of these text boxes was written.

I can also conclude (hot take incoming) that basically no one actually
ever tested this game in flip mode (but that was already evident, given
TerryCavanagh/VVVVVV#140, less strongly TerryCavanagh/VVVVVV#141, and
TerryCavanagh/VVVVVV#142 is another flip-mode-related bug which I guess
sorta kinda doesn't really count since text outline wasn't enabled until
2.3?).

So I fixed the second y-position to be 65, just like the y-position the
trinket text boxes use. I even took the opportunity to fix the comment
to say "//Found a crewmate!" instead of "//Found a trinket!".
2020-02-16 09:30:00 -05:00
Stelpjo
c665d5b8c8 Fixed some music bugs
Previously, when MMMMMM is installed but the user is using PPPPPP, niceplay would still restart the song even if it's the same. That has been fixed. In addition, Plenary and Path Complete no longer loop when MMMMMM is installed but PPPPPP is in use.
2020-02-12 21:52:25 -05:00
Matt Penny
df1c1303bf
Use dynamic credits lists for main menu credits screens (and add GitHub contributors) (#160)
Also added GitHub contributors to the credits on the main menu
(previously they were only present in the credits at the end of the
game)
2020-02-11 23:45:58 -05:00
Matt Penny
4ccb48f440 Use uint32_t instead of char32_t 2020-02-11 06:02:35 -05:00
Matt Penny
e7252888b6 Support pre-C++11 compilers 2020-02-11 06:02:35 -05:00
Matt Penny
9adcbaed6c Fix NO_CUSTOM_LEVELS compile after #158
ifdef out the code that draws the "return to editor" text in
NO_CUSTOM_LEVELS builds now that it accesses variables in the
editor class (PR #158)
2020-02-11 05:59:28 -05:00
Misa
9b125ad8df Prevent removing line if there is only one line
This fixes another way you could end up typing on a non-existent line in
the script editor.

In a script with only 1 line, which is empty, the game would let you
press backspace on it, removing the line. This results in you typing on
a non-existent line.

You will keep typing on it until you either close the script or press
Up. If you press Up, you will be unable to get back to the non-existent
line, for it doesn't exist - but the text you typed on the non-existent
line will still be there, until you close the script and re-open it.
2020-02-10 22:57:00 -05:00
Terry Cavanagh
172ab9195d
Merge pull request #158 from AllyTally/entertoreturn
Make "[Press ENTER to return to editor]" fade out after a bit
2020-02-10 18:41:13 +01:00
Matt Penny
1b00d12600 Add option to allow custom levels when the editor is disabled 2020-02-09 23:31:44 -05:00
Matt Penny
7d35c5ce4e Add option to compile without the level editor 2020-02-09 23:31:44 -05:00
AllyTally
6b1a7ebce6 Make "[Press ENTER to return to editor]" fade out after a bit
This makes the "[Press ENTER to return to editor]" fade out after a few frames, allowing screenshots of custom levels to be cleaner and to make sure nothing is obscured while the user is editing their level.
This commit also adds alpha support in BlitSurfaceColoured, where it takes into account the alpha of the pixel *and* the alpha of the color.
`graphics::getRGBA(r,g,b,a)` was added to help with this.
2020-02-09 22:31:33 -04:00
Info Teddy
3273b4ab55 Re-comment out #define MAKEANDPLAY
Silly me forgot to remove it after testing the MAKEANDPLAY define.
2020-02-09 10:42:03 -05:00