Commit Graph

1845 Commits

Author SHA1 Message Date
Misa 146678aac4 Make PhysFS RWops work with `-DBUNDLE_DEPENDENCIES=OFF`
The RWops stuff isn't a part of any standard PhysFS package (and given
that it explicitly wraps around SDL I'm not sure how you _would_ package
it). So we need to get the physfsrwops.h include in if
BUNDLE_DEPENDENCIES is off, otherwise this results in a compile-time
include-not-found failure.

Additionally, I've placed the PhysFS RWops stuff in their own extras/
folder, so none of the other PhysFS stuff gets included in a
-DBUNDLE_DEPENDENCIES=OFF build.
2021-08-31 23:09:13 -07:00
Ethan Lee 342dfcb48d Minor VS buildfix 2021-08-31 19:07:24 -04:00
leo60228 14c24069fd Fix indentation consistency 2021-08-31 15:37:52 -07:00
leo60228 52fceb3f69 Allow any player entity to be on the ground/roof to flip
This re-adds the midair flip glitch.
2021-08-31 15:37:52 -07:00
leo60228 1e8b5a6ba7 Actually move checks out of loop
How did this ever work?
2021-08-31 15:37:52 -07:00
leo60228 cd4ce05cb3 Split out tap_left and tap_right from player input loop
The game will freeze the player immediately if they release a
directional button within 3 frames of pressing it. Similar to flipping,
this involves global state, and will only apply to the first player
entity.
2021-08-31 15:37:52 -07:00
leo60228 1eb8570329 Split flip logic from player input logic
Closes #484

Flipping only applies momentum to the player entity currently being
processed. This normally wouldn't be a problem. However, flipping
involves global state, and only one flip can occur per frame. This means
that additional player entities don't get this boost of momentum, which
feels somewhat unnatural during gameplay.

This commit fixes this by splitting flip logic out of the loop over
player entities, and applying the flip momentum to all player entities.
2021-08-31 15:37:52 -07:00
Misa 416fe00c9d Fix not-Flip-Mode flag turning off when returning from options menu
We need to check for graphics.setflipmode, not graphics.flipmode,
because graphics.flipmode only gets assigned at the end of the frame
(due to the deferred callback). Otherwise, returning from the options
menu would always turn flag 73 on, which would make you ineligible to
get the Flip Mode trophy, even if you're in Flip Mode.
2021-08-31 15:33:20 -07:00
leo60228 b132f4fc6c Change physfsrwops.h SDL.h include, again 2021-08-31 15:30:23 -07:00
leo60228 de0998ca34 Compile physfsrwops with VVVVVV because of SDL dependency 2021-08-31 15:30:23 -07:00
leo60228 668c3d91d6 Return false from unPackBinary if no tracks are valid 2021-08-31 15:30:23 -07:00
leo60228 f86a67456b Remove data/ from track name list, refactor music loading, and support loose ogg music
(these should be separate commits but they're annoying to split after
the fact, oh well)
2021-08-31 15:30:23 -07:00
leo60228 5b6c4b6b28 Add physfsrwops 2021-08-31 15:30:23 -07:00
Ally 64be7dbd53
Refactor colors in internal commands
Originally this started as a "deduplicate a bunch of duplicated code in script commands" PR,
but as I was working on that, I discovered there's a lot more that needs to be done than
just deduplication.
Anything which needs a crewmate entity now calls `getcrewmanfromname(name)`, and anything which
just needs the crewmate's color calls `getcolorfromname(name)`. This was done to make sure that
everything works consistently and no copy/pasting is required. Next is the fallback; instead of
giving up and doing various things when it can't find a specific color, it now attempts to treat
the color name as an ID, and if it can't then it returns -1, where each individual command handles
that return value. This means we can keep around AEM -- a bug used in custom levels -- by not
doing anything with the return value if it's -1.

Also, for some reason, there were two `crewcolour` functions, so I stripped out the one in
entityclass and left (and modified) the one in the graphics class, since the graphics class also
has the `crewcolourreal` function.
2021-08-31 15:09:51 -07:00
Ethan Lee 8ebf8a21e4 Default to VSync being enabled 2021-08-31 15:08:46 -04:00
AllyTally 1c34dc2533 Reset new variables in hardreset 2021-08-31 11:17:00 -07:00
AllyTally 656941202a Fix formatting and add an INBOUNDS_VEC
If `setactivitytext` was the last line in a script,
the command would index the vector out of bounds.

I also modified the formatting to keep consistent
with the rest of the codebase.
2021-08-31 11:17:00 -07:00
AllyTally b15e25f106 Add `setactivitycolour(colour)` and `setactivitytext()` commands
These commands will change the colour and text of the next
activity zone that gets spawned. `setactivitycolour` takes all
textbox colors, and `setactivitytext` will take the text on
the next line. These commands were designed this way
to avoid breaking forwards compatibility.
2021-08-31 11:17:00 -07:00
AllyTally 0685cade69 Change the text of custom activity zones
When an activity zone is spawned through the
use of `createactivityzone`, and `i` is 35,
then it'll change the activity zone text to
"Press ENTER to interact".
2021-08-31 11:17:00 -07:00
leo60228 1cbc3bdc7c Treat __unix__ define as generic Unix 2021-08-31 10:35:20 -07:00
leo60228 6abf87f1e4 Explicitly use void in emscriptenloop declaration
Co-authored-by: Misa <infoteddy@infoteddy.info>
2021-08-31 10:28:55 -07:00
leo60228 46ee84d6ef Disable unfocus on Emscripten 2021-08-31 10:28:55 -07:00
leo60228 0063e1c3bc Use Emscripten's main loop
On Emscripten, SDL_Delay is implemented as a busy loop. In addition,
everything happens on a single thread. This effectively means that
you have to let Emscripten manage the main loop, since if you do it
yourself the browser will just be frozen.
2021-08-31 10:28:55 -07:00
leo60228 7baf143a6b Add necessary Emscripten linker flags 2021-08-31 10:28:55 -07:00
leo60228 6d57ccc25b Support Emscripten in FileSystemUtils 2021-08-31 10:28:55 -07:00
leo60228 a689c3ab96 Support Emscripten's SDL2
Emscripten defaults to using SDL 2.0.10, but
`export EMCC_LOCAL_PORTS=sdl2=/path/to/SDL2` seems to work.
2021-08-31 10:28:55 -07:00
Misa 62cff254b7 Bump version to 2.4 2021-08-31 10:25:29 -07:00
Misa c97b28f238 Don't hardcode destroy() arguments in loadcustom()
Otherwise, the new arguments to destroy(), which are 'moving' and
'disappear', would be thrown away by the simplified parser. Let's create
less work for ourselves to do and simply not have a hardcoded list of
allowed arguments for destroy() in the parser.
2021-08-31 09:26:39 -07:00
Misa 08971b3311 Fix destroy(platforms), implement under different names
destroy(platforms) has been bugged since 2.0. The problem with it is
that it removes the platform entity, but doesn't remove its block. This
results in essentially turning the platorm invisible and stopping it
from moving.

This error should be fixed, but some levels (including my own) rely on
the invisible platform trick. So instead, the fixed version will be
implemented under a different name, destroy(moving).

There's also another problem with destroy(platforms), which is that the
name is misleading and it doesn't additionally destroy disappearing
platforms. I would also fix this, but in order to not run the risk of
breakage, it will have to be implemented under a different name, too. So
this will be destroy(disappear). As an added benefit, it's also more
granular to have platform-destroying functions under different names
than it is to consolidate them under the same name.
2021-08-31 09:26:39 -07:00
Misa bca8d39bd7 Axe save file migration
The chances of someone using 2.0, then directly jumping to 2.4, are
pretty low - 2.0 is almost a decade old at this point.
2021-08-31 09:26:14 -07:00
Misa 85dc6db85b Axe screen_transition variable in favor of roomchange
When I added the two-frame delay fix, I didn't realize that Game had a
roomchange variable that was being used as a temporary variable here.
Now that it's fully spelled out and obvious (just look at the top of
gamelogic()), I realize that the variable exists and is being used, and
other readers will realize it's being used too - so now that I know it
exists, I can axe the screen_transition variable I added in favor of
using roomchange instead.
2021-08-31 09:25:47 -07:00
Misa 7a598f5811 Move roomchange off of Game
The purpose of this variable was to keep track of if gamelogic() called
map.gotoroom() at any point during its execution. So map.gotoroom()
always unconditionally set it to true, and then gamelogic() would check
it later.

Well, there's no need to put that in a global variable and do it like
that! It makes it less clear when you do that.

So what I've done instead is made a temporary macro wrapper around
map.gotoroom() that also sets roomchange to true. I've also made it so
any attempt to use map.gotoroom() directly results in failure (and since
then using map.gotoroom() in the wrapper macro would also fail, I've had
to make a gotoroom wrapper function around map.gotoroom() so the wrapper
macro itself doesn't fail).
2021-08-31 09:25:47 -07:00
Misa 75ed9f9631 Move linecrosskludge off of entityclass
This is a temporary vector that only gets used in mapclass::gotoroom().
It's always guaranteed to be cleared, so it's safe to move it off.

I'm fine with using references here because, like, it's a C++ STL vector
anyway - when we switch away from the STL (which is a precondition for
moving to C), we'll be passing around raw pointers here instead, and
won't be using references here anyway.
2021-08-31 09:25:47 -07:00
Misa 382b83a54d Move roomchangedir off of Game
This is a temporary variable that doesn't need to be on Game. It is
guaranteed to be initialized every time mapclass::gotoroom() gets
called, so it's safe to move it off.
2021-08-31 09:25:47 -07:00
Misa 48cddf57a6 Reset obj.customscript in hardreset()
This prevents yet another place where stale level data from one level
could have affected another level...
2021-08-31 07:55:40 -07:00
Misa fea2010204 Fix enemy/plat bounds not being drawn if any side touches a screen edge
Enemy/platform bounds are intended to not be drawn if they cover the
whole screen, since that's what their default bounds are.

However, the code inadvertently made it so if ANY of the bounds touched
a screen edge, the bounds wouldn't be drawn. This is because the
conditionals used "and"s instead of "or"s. The proper way to write the
positive conditional is "x1 is 0 and y1 is 0 and x2 is 320 and y2 is
240", and when you invert that conditional, you need to also invert all
"and"s to be "or"s. This is not the first time that the game developers
failed to properly negate conjunctional statements...
2021-08-28 13:03:04 -07:00
Ethan Lee fe1c8d3336 Embedded .ico 2021-08-28 11:21:49 -04:00
Misa fd4415317d Replace Gravitron RNG with seeded Xoshiro
This is to make it so RNG is deterministic when played back with the
same inputs in a libTAS movie even if screen effects or backgrounds are
disabled.

That way, Gravitron RNG is on its own system (seeded in hardreset()),
separate from the constant fRandom() calls that go to visual systems and
don't do anything of actual consequence.

The seed is based off of SDL_GetTicks(), so RTA runners don't get the
same Gravitron RNG every time. This also paves the way for a future
in-built input-based recording system, which now only has to save the
seed for a given recording in order for it to play back
deterministically.
2021-08-27 12:28:35 -07:00
Misa 69e36229ec Add -A Win32 flag to README
This avoids failure modes made possible by mismatching 32-bit and 64-bit
settings.
2021-08-26 13:29:05 -07:00
Misa c591b79daf Reset words array in hardreset()
Otherwise, levels could leave stale arguments in the array, and then the
behavior of another level loaded right after might end up being
different because of that.
2021-08-25 11:12:23 -07:00
Misa 580096dded Update comments about contributor ordering
I reordered them but forgot to update these comments...
2021-08-24 09:42:23 -07:00
Misa d472363542 Fix positioning of "Thanks for playing!"
When the screen reached the bottom of the credits, it ended up being 10
pixels higher (and not perfectly centered) than in 2.2 and previous.
2021-08-24 09:39:20 -07:00
Misa 676294332f Add Vee to credits
He did say to feel free to not credit him, but I'd like to add him
anyways just for completeness's sake.
2021-08-24 09:39:19 -07:00
Misa e69fd80bac Add KyoZM to Credits.h
They were in CONTRIBUTORS.txt but not Credits.h.

In the future we ought to just parse CONTRIBUTORS.txt directly somehow,
but This Works Okay for now.
2021-08-24 09:38:36 -07:00
Misa b9c028fd9b Alphabetically sort contributors by first name, not last
This is done for consistency with Terry's patrons, which are sorted by
first name and not last.

Also some people go with their usernames and so don't have a last name
to speak of, which ended up being pretty weird.
2021-08-24 09:37:36 -07:00
Misa 89d1873a5a Add Elijah Stone's GitHub handle to CONTRIBUTORS.txt
They were the odd one out out of everyone else.
2021-08-24 09:31:59 -07:00
Misa da6871f6f4 Fix missing at-symbols on people in CONTRIBUTORS.txt
For consistency.
2021-08-24 09:14:42 -07:00
Misa 9bdd45b7e1 Update Misa's name in credits
Kai is my last name. Elizabeth is my middle name. I went with my middle
name as last name for a while before figuring out what I wanted my last
name to be.
2021-08-24 09:13:07 -07:00
Misa 950b9523ce Add Visual Studio string list
If people compile with VS 2019, then putting in VS 2010 will just result
in a weird error that's not really indicative of anything.
2021-08-24 09:11:02 -07:00
Misa 4e910c2182 Update license exceptions last updated date
Terry updated it last on November 22nd but forgot to update the 'last
updated' date...
2021-08-24 09:10:23 -07:00