Commit Graph

1837 Commits

Author SHA1 Message Date
Ethan Lee 3469a44489 2.3.4 2021-09-11 02:06:16 -04:00
Misa 222e45ada1 Music: Do not do fades if not playing
This fixes a regression where entering playtesting while a track was
fading out (by exiting out of playtesting with a track playing and then
immediately entering back in with the level start music set) would
result in no music.

The cause is the game doing fades even though nothing is playing, which
puts it in a confusing state.
2021-09-10 19:50:47 -07:00
Misa 6c848a8bb9 Move `Mix_PausedMusic()` call into wrapper function
This wrapper function is for (a) future-proofing (b) proactive
prevention of future copy-pasting (c) to clarify that we never actually
halt music in the SDL_mixer sense, we only pause it, so to check if the
music is halted we actually check if the music is paused instead. This
is important because Mix_PlayingMusic() does not check if the music is
paused and Mix_PausedMusic() does not check if the music is halted.
2021-09-10 19:50:33 -07:00
Misa b5501e4b29 Kludge-fix being able to play music in editor
When you're on the music changing screen in the editor, it plays the
current track. When you return, it stops playing the track. However, if
you press escape, it doesn't stop playing the track. This is because
pressing escape just returns to the previous menu without stopping
playing the track.

To fix this, I just added some kludge in the return menu function. This
is kinda super bad but it works for now and is just something to clean
up later. Maybe like each menu having exit callbacks or something, I
dunno.

This is kinda a regression, kinda sorta not. In 2.2 and previous,
pressing escape would just close the settings menu entirely, which also
bypassed the music fadeout. 2.3 made it so pressing escape doesn't
entirely close the settings menu, and just returns to the previous menu,
which fails in a different way. But the intended way is definitely to
select the return option and having the music fade out.
2021-09-10 19:49:49 -07:00
Misa 7c29bb862a Reset some stats that weren't being reset in deletestats
This function now properly deletes the Super Gravitron record, the Super
Gravitron rank, and the best game deaths. They were not being properly
reset previously, meaning you would have to go into your save file to
properly clean out your save data.
2021-09-10 19:49:45 -07:00
Misa 2b9b4c39cb Reset fade booleans when silencing music
This fixes a bug where the music would keep playing when a collection
prompt appeared if the music was still fading in at that time.
2021-09-10 19:49:45 -07:00
Misa 3c6cb0167d Fix platv values outside map size being saved as 67372036
If the map size was less than 20x20, platv values outside the map would
end up being saved as 67372036.

This happens because SDL_memset() operates on the byte level, and not
the multi-byte level. So it takes only the lower 8 bits of 4 and repeats
it for each byte in each integer, creating 67372036.
2021-09-10 19:49:27 -07:00
Misa 406a19ceb6 Don't check `!muted` when fading music after completion prompt
This was done in 2.2 and previous probably to fix the fact that there
were multiple conflicting audio controls (the player wants to mute the
audio but the game wants to fade in the audio), but is now actively
harmful since 2.3, because muting the game while finishing the
completion prompt means the music will never come back in, even after
unmuting.

I also notice that when collecting a custom crewmate, the game checks
for the level's start music instead of if there's actually a current
song playing right now. I don't know why this was done, because it
would've been better to copy-paste the trinket collection logic here.
It's entirely possible for the audio to just be muted and never come
back if the level has no start music but plays a song by using a script.
Anyways, leaving it alone because it's quite possible that a level might
be intentionally designed around this, I can't really tell the
intentions of every level creator, and it's easy to work around (either
don't use custom crewmates, which every modern level basically does
nowadays, or just set the start music).
2021-09-10 19:49:08 -07:00
Misa 3d090792d2 Don't touch music when completing custom level
For some reason, when completing a custom level and fading to the menu,
the game attempts to fade the music in and also fade the music out at
the same time. This results in nothing happening at all, and in 2.2 and
previous, results in audio fading out from max volume while the game is
frozen on a black screen after the fadeout.

To avoid any potential badness, just remove these.
2021-09-10 19:49:02 -07:00
Misa b6645de749 Fix dying during collection prompt persisting effects
In the main game, if you press R during the trinket collection prompt
after collecting a trinket, AND you have never entered Comms Relay, and
you respawn in a different room, the trinket collection gamestate will
be interrupted, but you will still be left with the advance text prompt,
cutscene bars, and muted music.

The previous workaround to fix the music would be to mute and then
unmute the game, but due to the new music changes, this workaround
(which in and of itself is a bug) no longer works. Instead, the music
would have to be restarted by going into another zone on the map.

Having an advance text prompt outside of a cutscene results in the
player being unable to flip, but they can still move around left and
right.

Speedrunners previously used the no-Comms-Relay interrupting behavior to
skip certain trinket collection prompts entirely with a frame-perfect R
press, so I can't patch that out. Having an advance text prompt outside
of a cutscene is (ab)used in custom levels to intentionally prevent the
player from flipping, and furthermore, it's also used in credits warp
runs of the main game to increment the gamestate; so I cannot patch that
out. The ability to press R everywhere even during cutscenes was added
for good reason - to make it less likely that a softlock can happen - so
I don't want to revert it.

But I still think this is worth fixing because previously, the
punishment for missing the frame-perfect window late was simply not
skipping the trinket prompt (since the R-press would be ignored), but
now the punishment is basically having to reset because of the advance
text prompt.

I would usually handle this in gamestate 0, but awful custom levels
might want to intentionally interrupt the gamestate to do, I don't know,
something. No level does that so far, but I'd like to do the least
invasive thing.

So what I've done is made it so the effects of interruption are undone
if you press R and the gamestate is interrupted. This is handled in
mapclass::resetplayer().
2021-09-10 19:49:01 -07:00
Misa 25af54529b Don't check `map.extrarow` when opening map
This is just to make sure there aren't any more inconsistencies with
regards to the value of graphics.menuoffset. Can't hurt to be sure.
2021-09-05 17:06:56 -07:00
Misa f467f86dc2 Use `resumegamemode` to track menu animation
This fixes a bug where the player could bring up the map on the very
first frame of a gamemode(game) animation. This is because the menu
animation checked graphics.menuoffset, but graphics.menuoffset wouldn't
have changed at that point because it only set graphics.resumegamemode.

Instead, just check for graphics.resumegamemode directly. We also need
to assign it to false whenever the map is closed so the player won't be
prevented from using the map screen again.
2021-09-05 17:06:55 -07:00
Ethan Lee ca35c53c1a 2.3.3 2021-09-04 16:31:56 -04:00
Misa b667e44bcf Don't use `map.extrarow` for menu animations
This fixes all the headaches about map.extrarow having to be the correct
value and which way it should be and whatnot. The latest headache was
the detection that prevent user-initiated menu animations while an
animation was already happening being tripped because
graphics.menuoffset would be 230 (due to closing the menu while being in
a room without a room name), but then going to a room with a room name
would check for 240 instead, and 230 is less than 240. (The numbers are
the wrong way round because I got the ternaries the wrong way round, but
even if the numbers are the correct way round, the bug would still
happen, but it would just be reversed.)

So instead, I've just made it 240 for both. This doesn't change the
duration of the menu animation (because the animation moves in
increments of 25, and 230 / 25 == 240 / 25 under integer division). It
might change the animation slightly, but it was already inconsistent
anyway because map.extrarow was always set to be 1 in custom levels, and
I legitimately would not be able to tell the difference without
recording the animations and nitpicking it frame-by-frame.

Fixes #841.
2021-09-03 17:18:17 -07:00
Misa 70d3c999be Only reset fade booleans when music is actually played
Otherwise, the block that fades existing music out if m_doFadeOutVol is
true will never execute, because m_doFadeOutVol would always be false!
2021-09-03 16:44:19 -07:00
Ethan Lee 6f315af42d Updated .ico 2021-09-03 15:57:30 -04:00
Ethan Lee c8fcbc1256 2.3.2 2021-09-03 15:26:38 -04:00
Misa a302692ab2 Add message when player is kicked out of Super Gravitron
The player gets kicked out of the Super Gravitron if they have
invincibility or slowdown enabled. However, this can be confusing if no
message pops up
( https://steamcommunity.com/app/70300/discussions/0/3039355280230178910/ )
. So I've made it so that a text box will pop up when they get kicked
out.
2021-09-03 12:09:53 -07:00
Misa a59e9d51db gamemode(teleporter): Set gamestate to GAMEMODE
This makes it so gamemode(teleporter) will always do an animation, even
if the game is already in TELEPORTERMODE.

I used this script to test:

    gamemode(teleporter)
    delay(5)
    gamemode(teleporter)
    delay(5)
    gamemode(teleporter)

In 2.2, this script starts the map menu bringing-up animation three
times.

In previous 2.3, this script starts the map menu bringing-up animation
once, but then the next gamemode(teleporter) immediately finishes the
animation, and the third gamemode(teleporter) does nothing.

This commit restores it to 2.2 behavior.
2021-09-02 12:29:55 -07:00
Misa 82971296c2 Prevent user-initiated map menu changes during menu animations
This makes it so it's not even possible to stay on the TELEPORTERMODE
screen by opening the map while it's being brought down. It also makes
it so the map animation is able to be canceled when being brought up
just by opening the map and closing it.

Fixes #833.
2021-09-02 12:29:55 -07:00
Misa 4ecec8a327 Call teleporterrenderfixed in TELEPORTERMODE
This restores it to 2.2 behavior, where the cutscene bars timer also
ticked in TELEPORTERMODE. It was a 2.3 regression that the cutscene bars
timer didn't tick there.

This makes it so if you manage to get stuck in TELEPORTERMODE when a
cutscene ends, the cutscene won't be stuck on untilbars() waiting for
the cutscene bars to go away, since the cutscene bars timer now ticks.
2021-09-02 12:29:55 -07:00
Ethan Lee f1ae40a7c5 2.3.1 2021-09-01 12:26:53 -04:00
Ethan Lee d501a6245f Added my quick script to fixup Mac dylib paths 2021-09-01 12:08:12 -04:00
Ethan Lee 514d56ee20 Minor VS buildfix 2021-08-31 19:07:36 -04:00
Misa 9cfbd1ae51 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:34:32 -07:00
Ethan Lee 96812f8046 Default to VSync being enabled 2021-08-31 15:09:07 -04: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
Misa 749a885d9a Actually finally fix createentity default args
Third time's the charm.

The fundamental problem with the previous attempts was that they ended
up saying arguments existed due to stale `words` anyway. So to actually
know if an argument exists or not, we need to assign to `argexists` _as_
we parse the line.

And make sure to take care of that last argument too.

Also I thoroughly tested this this time around. I'm done pulling my hair
out over this.
2021-08-22 22:47:47 -07:00
Misa 01ae5c6c70 Allow custom levels to use 2 billion tile numbers once again
Ever since tilesheets got expanded, custom levels could use as many
tiles as they wanted, as long as it fit under the 32-bit signed integer
limit.

Until 6c85fae339 happened and they were
reduced to 32,767 tiles.

So I'm being generous again and changing the type of the contents array
(in mapclass and editorclass) back to int. This won't affect the
existing tilemaps of the main game, they'll still stay short arrays. But
it means level makers can use 2 billion tiles once again.
2021-08-22 21:30:53 -07:00
Misa 92aace50f6 Don't assume tilesheet size in Direct Mode
This lets users place down tiles above 1199 in Direct Mode, if their
tilesheet has more than 1200 tiles.

I don't like the copy-pasted code here but it'll have to make do.
2021-08-22 21:13:28 -07:00
Misa 731fb89c90 Add being able to use Lab rainbow background in editor
If you use Lab tilecol 6, you get the rainbow background. However, this
is unintended, because the associated autotiling is... not very good.

To combat that, Ved disallows using the Lab rainbow background outside
of Direct Mode. We will follow Ved here and only allow switching to the
rainbow background if you're in Direct Mode. Also make sure if someone
is disabling Direct Mode with the rainbow background that it gets reset
properly.
2021-08-22 20:56:47 -07:00
Misa 3947949ebb Add being able to use Shift+W to change warp dir backwards
A minor convenience, but a convenience is a convenience.
2021-08-22 20:51:51 -07:00
Misa d2153aee87 Refactor warp dir switching to separate function
This is so the same code can be used to go in reverse instead of
copy-pasting it.
2021-08-22 20:51:21 -07:00
Misa 0489293885 Remove default arguments from ed switch_* funcs
I don't like default arguments and if we're going to be moving to C
we'll need to remove them anyway.
2021-08-22 20:44:18 -07:00
Misa 52918ba510 Increment total flips for flip tokens and flipgravity(player)
They flip the player, they should count towards total flips like gravity
lines do.
2021-08-22 20:39:05 -07:00