1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-11-04 18:29:41 +01:00
Commit graph

1221 commits

Author SHA1 Message Date
tzann
a4c1ffee12 Fix checkpoint starts in editor 2020-07-29 14:45:28 -04:00
Tynan Richards
8aac6a758d
Wrap entities (#408)
Make entities able to wrap both vertically and horizontally, also add a case for when entities are wrapping both directions at the same time
2020-07-29 12:17:28 -04:00
tzann
178951e5e1 Added myself to contributors list 2020-07-29 10:04:27 -04:00
tzann
11ef68bea2 Change back the order of entity creation 2020-07-29 10:04:27 -04:00
tzann
b4bac64361 Also change oldyp so there's no deltaframe issues 2020-07-29 10:04:27 -04:00
tzann
e48fef4fe5 Fix the 'Game Complete' trophy stand so it no longer hovers above the ground. Also update comments in Otherlevel.cpp to reflect what entities are actually being created. 2020-07-29 10:04:27 -04:00
tzann
e2321f84b9 Add check for singular trinkets and crewmates in NDM game over screen 2020-07-28 21:54:35 -04:00
Misa
6c04f56099 Don't savestats() every frame of New Record animation
Otherwise, this would cause immense slowdown during the New Record
animation that plays when you die, as the game would be writing
unlock.vvv every frame.

To fix this, I just put it under the same if-guard as the
music.playef(), since the sound effect also only plays once. But I have
to watch out for frame ordering and make sure the record is actually set
before I call game.savestats(), and then of course I have to move
game.swnmessage = 1 over because that's the variable being checked in
the conditional.
2020-07-27 19:21:18 -04:00
Misa
18b7d1ca14 Set oldxp/oldyp when player teleports through warp token
This fixes the bug where it would appear as if they "zipped" to the
destination from the warp token.

Fixes #384.
2020-07-21 18:13:50 -04:00
Misa
ff8d616438 Use INBOUNDS() check for mapclass::warpto()
There's a lot of places where the INBOUNDS() check is spelled out
instead of using the macro, before the macro was introduced. Also the
macro should probably be renamed INBOUNDS_VEC() to be consistent.
2020-07-21 18:13:50 -04:00
Misa
fdb01adc68 Set oldxp/oldyp when being teleported around during teleport
This fixes the bug where Viridian would appear to "zip" when they would
be teleported to the position of the teleporter before being flung out
of it.

As discussed in #393, I've also set the oldxp/oldyp when Viridian is
temporarily positioned in the center of the room, even though at this
point they should already be invisible. This is just to be safe.

Fixes #393.
2020-07-21 18:06:41 -04:00
Misa
52f7a587fe Separate includes into sections and alphabetize them
Okay, so basically here's the include layout that this game now
consistently uses:

[The "main" header file, if any (e.g. Graphics.h for Graphics.cpp)]
[blank line]
[All system includes, such as tinyxml2/physfs/utfcpp/SDL]
[blank line]
[All project includes, such as Game.h/Entity.h/etc.]

And if applicable, another blank line, and then some special-case
include screwy stuff (take a look at editor.cpp or FileSystemUtils.cpp,
for example, they have ifdefs and defines with their includes).
2020-07-19 21:37:40 -04:00
Misa
b108e28c5a Remove unnecessary EditorData constructor stub
It's useless anyway because `std::string`s get initialized
automatically.
2020-07-19 21:37:40 -04:00
Misa
58308f9826 Remove unused time stuff from editor.cpp
It was never used and didn't do anything. It looks like it was intended
to be used but I guess time ran out or something, but it's too late now
and level files don't have timestamps or anything, so might as well just
remove it.

Good thing too, because asctime() is apparently deprecated.
2020-07-19 21:37:40 -04:00
Misa
b5ff65c84e Remove unnecessary includes from header files
Including a header file inside another header file means a bunch of
files are going to be unnecessarily recompiled whenever that inner
header file is changed. So I minimized the amount of header files
included in a header file, and only included the ones that were
necessary (system includes don't count, I'm only talking about includes
from within this project). Then the includes are only in the .cpp files
themselves.

This also minimizes problems such as a NO_CUSTOM_LEVELS build failing
because some file depended on an include that got included in editor.h,
which is another benefit of removing unnecessary includes from header
files.
2020-07-19 21:37:40 -04:00
Misa
d455e38715 Use angle brackets for including tinyxml2.h
Since TinyXML2 is a third-party dependency, we should use angle brackets
and treat it like one.
2020-07-19 21:37:40 -04:00
Misa
2af396fb30 Consistently use angle brackets for SDL.h includes
That's how it should be done, because the SDL headers aren't going to be
installed in this repository. The game was a bit inconsistent before but
now it isn't anymore.
2020-07-19 21:37:40 -04:00
Misa
6c85fae339 Change all tilemaps to be short[1200] instead of int[1200]
This removes around megabyte from the binary, so a stripped -Og binary
went from 4.0 megabytes to 2.9 megabytes, and an unstripped -O0 binary
went from 8.1 megabytes to 7.1 megabytes, which means I can now finally
upload an unstripped -O0 binary to Discord without having to give money
to Discord for their dumb Nitro thing or whatever.
2020-07-19 16:25:53 -04:00
Misa
df96b2a594 Fix softlock using tele while in its hitbox post-rescue/intermission
There were many different ways I could've fixed it, but one thing that
stood out to me was the fact that touching the teleporter wasn't
guaranteed to set its onentity to 0, even though it should be. So now,
every time Viridian touches the teleporter, the teleporter's onentity
will be set to 0, and thus there's no chance of the teleporter
interrupting its own teleport animation and softlocking the game.

We should still do what I suggested in #391, namely setting
game.hascontrol to true if the game is in gamestate 0 and script.running
is false, and also always allowing Esc/Enter to be pressed regardless of
game.hascontrol. But this softlock is fixed now.

Fixes #391.
2020-07-18 17:41:21 -04:00
Misa
af89c52813 Wrap around enemy type when switching enemy types
Whoops. Forgot to do this earlier when adding the Shift+F3 hotkey.
Otherwise the enemy type would become invalid and just turn into the
default square.
2020-07-17 16:32:07 -04:00
Misa
fb8cb705da Fix softlock if exiting Super Grav and bringing up map in glitchrunner
The game would softlock if you brought up the map screen or quit screen
after exiting the Super Gravitron to the Secret Lab. This softlock would
only happen if you were in glitchrunner mode.

This is because glitchrunner mode set game.fadetolabdelay when it
shouldn't have, and also checked game.fadetolabdelay when it shouldn't
have.

So I made it so that the game will only set game.fadetolabdelay when not
in glitchrunner mode (I already had a check for game.fadetomenudelay,
too!) and the game will only check for game.fadetomenudelay and
game.fadetolabdelay when not in glitchrunner mode, as well.

I originally made the game check game.fadetomenudelay and
game.fadetolabdelay to prevent being able to re-press ACTION to re-start
the fadeout if the game was already fading out. And I made sure that
this wasn't broken, both in glitchrunner mode and normal mode.
2020-07-16 18:48:08 -04:00
Misa
ecf43d05dc Fix undeffing ARG_IS instead of ARG
Whoops.

Noticed this earlier when I was merging upstream back into VCE, and
interestingly enough, it doesn't look like cppcheck warns about
undeffing a non-existent define.
2020-07-15 22:57:50 -04:00
Misa
78faea87ba Fix brace style and spacing in custom loadlevel()
I don't know who wrote this code originally, but it's extremely obvious
that it was a different person than who wrote the rest of the code.
Anyway, I fixed the spacing and braces so everything is smushed together
less.
2020-07-15 12:21:12 -04:00
Misa
ccb3d6e974 Use case-switch for warpdir checking
Also, there's no need to put the entire warpdir checking in an
'if(room.warpdir>0)' statement. If any of the cases is jumped to, then
you already know that's true.
2020-07-15 12:21:12 -04:00
Misa
2938db057b Unindent case labels in room tileset case-switch
Again, best practice is to put the case labels on the same indentation
level as the switch itself.
2020-07-15 12:21:12 -04:00
Misa
01f6a97ed0 Fix and update comments for edentities
"Threadmills" are now properly called "conveyors". I don't know why they
were called "threadmills" anyway, the proper spelling is "treadmills".
Also, warp line `p1`s of 0 and 3 are now properly labeled, as well as
the trinket edentity.
2020-07-15 12:21:12 -04:00
Misa
f8e23119bf Use case-switch for warp line creation
No need to repeat the left part of a conditional if we can just use
case-switches instead.
2020-07-15 12:21:12 -04:00
Misa
c7ea684c08 Use enum names instead of raw values in createblock() calls
It makes it clearer if the enum names are used instead of their values.
2020-07-15 12:21:12 -04:00
Misa
a2f20e7e49 De-duplicate enemy/platform bounding box logic
It was basically being copy-pasted twice, which isn't good.
2020-07-15 12:21:12 -04:00
Misa
0ec38ad0f8 Get rid of unnecessary roomname logic
Just set the map roomname to the roomname of the room. It's completely
redundant to set the roomname to an empty string and check if the
roomname of the room is empty.
2020-07-15 12:21:12 -04:00
Misa
2558cccd40 Fix 'break' statements in other cases not being inside braces
It just looks bad visually, so I'm fixing it.
2020-07-15 12:21:12 -04:00
Misa
2646642664 Add braces to case 12 custom level loading
I do this because we declare-and-initialize some variables in the case.
This isn't strictly necessary, since there's no cross-initialization
errors since it's the last case in the switch, but I'd just like to be
future-proof.
2020-07-15 12:21:12 -04:00
Misa
71a989707e De-duplicate and add safety check to ed.level reference
Instead of repeating 'ed.level[curlevel]' (or even worse, you type in
that giant expression inside the brackets instead of reusing
'curlevel'), why not just type 'room'? As an added bonus, I added bounds
checks so 'room' is always guaranteed to point to an existing object.

There are some levels that index 'ed.level' out of bounds, and I'd like
to make their behavior properly defined instead of being undefined. One
of the things usually true about out-of-bounds rooms is that they're
always tiles2.png (that means an edlevelclass tileset that isn't 0),
because the chance of the memory location being exactly 0 is smaller
than it being nonzero. So the out-of-bounds room has tileset 1.
2020-07-15 12:21:12 -04:00
Misa
729f24d732 De-duplicate reference to edentity
'edentity[edi]' is a bit long-winded when you really just want to access
the attributes of the edentity. How about just 'ent'?
2020-07-15 12:21:12 -04:00
Misa
4b6406d08e Unindent case labels in entity creation
Everyone knows that best practice is to put case labels on the same line
as the switch statement...
2020-07-15 12:21:12 -04:00
Misa
fd2ee96c49 Clean up tsx/tsy initialization
Again, it used this severely overcomplicated expression for god knows
what reason. I've replaced it with a simpler one. Also it's const just
to indicate intent.
2020-07-15 12:21:12 -04:00
Misa
d591c77088 De-duplicate expressions of actual coordinates for edentities
Previously it copy-pasted this god-awful overcomplicated expression
(possibly for cursed ActionScript legacy reasons?) everywhere, instead
of putting it in a variable, or even just using a simpler one like the
one I replaced it with.

Now the obj.createentity() and obj.createblock() calls are much nicer.
2020-07-15 12:21:12 -04:00
Misa
34b0e2c812 Unindent ending for-loop brace
It's rather unnecessary to have it be on the same level as the ending
brace for the case-switch.
2020-07-15 12:21:12 -04:00
Misa
8b8f9b3389 Negate edentity room check and use a continue
This reduces the brace level by one, meaning the indentation level is no
longer semi-misleading.
2020-07-15 12:21:12 -04:00
Ethan Lee
264279d17a Warning fix for uninitialized prefix 2020-07-15 12:11:23 -04:00
Ethan Lee
b302e4dbbb Valgrind warning fix 2020-07-15 12:09:24 -04:00
Ethan Lee
5ff5ae7294 mmmmmm is initialized earlier in init() 2020-07-15 11:58:00 -04:00
Misa
f8190439a9 Reset ed.roomnamehide to 0 when exiting playtesting
Now if your cursor was at the bottom of the screen when you entered
playtesting but then was moved to the top during playtesting, when you
exit, the roomname won't instantly disappear and then sheepishly rise
back up again.

And if your cursor was at the bottom of the screen when you entered
playtesting, and exited still being that way, the roomname will rise
back down again and won't instantly disappear.

Both of these behaviors make the roomname movement much more continuous
than it was previously, and it feels smoother and less janky.
2020-07-15 11:45:29 -04:00
Misa
def540d184 Reset ed.notedelay when exiting playtesting
It's not very useful to show a message that was relevant only when you
started playtesting.
2020-07-15 11:45:29 -04:00
Misa
22d556f4be Disable "Game Saved" text box in custommode
Also, use inspecial() instead of writing out each part of the
conditional separately. This just basically adds the insecretlab
conditional to the if-statement, which shouldn't be a big deal.
2020-07-15 11:45:29 -04:00
Misa
13e260bf50 Fix pressing Esc in teleporter menu going to quit screen
When I added the new pause menu, I forgot to make pressing Esc in the
teleporter menu go to the new pause menu instead. But it's fixed now.
2020-07-15 11:45:29 -04:00
Misa
5f131b426b Allow pressing Enter on teleporters during playtesting
There's no reason you shouldn't be allowed to press Enter on teleporters
during playtesting.

Well, except that you can press Esc in the teleporter menu in order to
go to the pause menu, which isn't intended in playtesting. But I can
just add a check there so that pressing Esc closes the teleporter menu
instead, it's fine.
2020-07-15 11:45:28 -04:00
Misa
846c6f61d4 Use .clear() when removing text boxes in reset functions
graphics.textbox.clear() should be used instead of
graphics.textboxremove() or graphics.textboxremovefast(), because even
with graphics.textboxremovefast(), you'll still have to process at least
one frame of GAMEMODE logic before the text boxes are actually properly
removed, and this caused a 1-frame glitch when exiting playtesting with
text boxes on-screen and then re-entering playtesting.

Technically I could've only fixed it in Game::returntoeditor(), but I
wanted to be safe, so I also fixed it in scriptclass::hardreset(), too.
2020-07-15 11:45:28 -04:00
Misa
7fada0548b Set ed.settingskey to true when returning to editor
This fixes a bug where the settings menu would immediately be brought up
if you used Esc to exit playtesting, unless you were an incredible ninja
and only pressed it for exactly one frame.
2020-07-15 11:45:28 -04:00
Misa
6c52b79ddf Set ed.keydelay to 6 when returning to editor
This fixes an annoying bug where if you use Up or Down to press ACTION
on the "All crewmates rescued!" dialogue whenever you rescue the last
crewmate during playtesting, it'll move you to the room above or below
you. This is because ed.keydelay isn't set to 6 (which is the standard
value that it gets set to whenever you press most keys in the editor),
but now it is.
2020-07-15 11:45:28 -04:00