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

2517 commits

Author SHA1 Message Date
NyakoFox
c2642dbdef Add more checks for checkpoint saving 2024-10-02 00:37:25 -07:00
Misa
a0bd2f3da4 Refactor: Use fullmap() everywhere
This replaces all instances of unlocking all rooms on the map with calls
to map.fullmap(), for consistency.

This also fixes two comments that got swapped around in startgamemode().
I don't know how that happened.

[skip ci]
2024-09-28 00:52:19 +00:00
mothbeanie
8a00ea7aab Add mapexplored(), mapreveal() commands 2024-09-27 17:47:19 -07:00
NyakoFox
c04c6bc552 Abstract checkpoint saving to its own function
This also makes the save failed textbox not appear in special modes,
and allows custom levels to quicksave from checkpoints as well.
2024-09-27 17:14:57 -07:00
NyakoFox
41d5e688e9 Fix menu option, show textbox when save failed
In my last commit, I accidentally inverted whether the description says
ON or OFF.
2024-09-27 17:14:57 -07:00
NyakoFox
e58fd606cf add menu option for checkpoint saving 2024-09-27 17:14:57 -07:00
NyakoFox
8aec83daec Checkpoint autosaving 2024-09-27 17:14:57 -07:00
Misa
c870df4e5b Remove slowdown during death animation
Some discussion on the Discord server resulted in this change. It's a
quality-of-life improvement where, if the game is in slowdown mode, it
will return to 100% speed for the duration of the death animation.

The reasoning is obvious. There is nothing to do during the death
animation, so making it take longer during slowdown is just an annoyance
to the player, almost a penalty for them using an accessibility option.
This is the same reason why slowdown no longer applies in menus, etc.
2024-09-25 21:14:02 -07:00
Misa
32562f03a9 Give MotU trophy in normal mode
This makes it so that it is possible to obtain the Master of the
Universe trophy/achievement, usually unlocked by beating No Death Mode,
outside of NDM.

There are several conditions that need to be met:

1. The game needs to be started from a new game and cannot be from
   loading a save.
2. Accessibility modes (invincibility and slowdown) must never be
   enabled.

If either condition is violated, then the boolean that keeps track of
NDM eligibility will be set to false.
2024-09-23 22:23:45 -07:00
NyakoFox
d8b2b3542a Add enemy speed as a room property
Currently, you can change platform speed, but not enemy speed, which is
always hardcoded to be 4. This commit fixes that, by adding the
"enemyv" property, which is an offset to the speed of 4. Since it
defaults to 0, older levels are not broken by this change.
2024-09-23 18:56:41 -07:00
Misa
8b62bb1d65 Bump version to v2.5
I consider the 2.4 development cycle over now, after the most important
bugs (and regressions) were fixed in 2.4.2.

[skip ci]
2024-08-27 15:13:24 -07:00
Dav999
149f5fbebc Tweak IME selection background left bound
Just extending the selection background left by one pixel so there's
not one pixel of black background to the left of a selection that
starts at the beginning of the text, and so some characters being
selected show up better (particularly where there's a long vertical bar
at the first pixel). We shouldn't be overlapping any part of the
previous character, since every character normally has a pixel of
spacing on the right.
2024-08-06 18:16:46 -07:00
Dav999
9ec8d8b637 Add selection background to IME rendering
Decided to implement it anyway since the broken behavior (selection
length always being 0, at least on Windows) may get fixed later in SDL,
so let's do it right in one go.
2024-08-02 22:25:00 -07:00
Dav999
8b8f827b70 Add IME text rendering
This shows the uncommitted text in a box in the bottom left corner.
This doesn't show the selection (defined by the start and length fields
in the event) yet, but this is already much better than it was on its
own, and I don't know how urgent the selection is since it's broken on
Windows anyway.
2024-08-02 22:25:00 -07:00
Dav999
a9ca63b367 Add buffer for IME editing events
When inputting uncommitted text from an IME, this is now stored in a
std::string imebuffer, just like keybuffer. It also enables extended
editing events, so text longer than what fits in the standard editing
event is also supported. This commit does not yet display the text
onscreen.
2024-08-02 22:25:00 -07:00
Misa
345eca5e10 Fix regression: Escape from conveyor spikes
This fixes a regression from 2.3. Consider the following diagram:

       CC
    X  CC
      <<<<

"C" indicates one tile of a checkpoint entity, "X" indicates a spike
tile, and "<" indicates one tile of a conveyor entity that has the
default speed (4 pixels per frame) going leftwards.

Now consider if the player were to touch the checkpoint and die. In 2.2,
they would be able to escape from the spike by holding right. But in
2.3, they would not be able to, and would die from the spike
continuously with no escape.

This happens because in 2.2, the player would spawn a couple pixels off
the surface, and this gained them an extra frame of movement to move
away from the conveyor. 2.3 places the player directly on the ground,
moving them one frame earlier and thus forcing them to their doom.

Now consider the following diagram:

      CC
    X CC
     <<<<

The difference with the previous diagram is that this time, the spike is
one tile closer. This time, there is no escape in 2.2 and you will
always die no matter what.

By the way, both diagrams have the same behavior if the conveyor is
rightwards and if everything is flipped upside-down. Thankfully, it
doesn't seem to be direction-dependent.

The reason 2.3 lowered the player onto the surface was for consistency
(see PR #502), and I don't want to undo that. So I think the best
solution here is to re-add the extra frame of control by conveyors only
moving the player after lifeseq has advanced enough.
2024-07-31 22:17:50 -07:00
Misa
6930bde91b Use variable timestep for SDL_Delay
This fixes a bug where fast-forward wouldn't work in 30-FPS-only mode.

This is because the 30-FPS-only code has a hardcoded check for the
number 34, as in 34 milliseconds must pass before the next frame can
advance. This is why slowdown still worked, because slowdown means
you're waiting longer than 34 ms anyways, but fast-forward tries to wait
for only 1 ms, which wouldn't work if the 34 limit was still enforced.

So instead, swap out the 34 with game.get_timestep() and this will be
fixed.

Fixes #1185.
2024-07-20 18:40:16 -07:00
mothbeanie
487e0c6b2d fix music ear blast bug 2024-07-13 13:11:05 -07:00
Misa
7d01c6bdb0 Fix double error dialog if data.zip is missing
A minor gripe, but one thing I didn't notice with commit
b4579d88d3 is that it now results in two
dialogs if data.zip is missing: The first being the "data.zip is
missing" dialog, and the second is the generic "Unable to initialize
filesystem" dialog.

So just bail early if data.zip can't be found, it's going to take the
error path in main() and also bail regardless.
2024-07-11 11:47:59 -07:00
Misa
64c554261e Fix regression: Entities not moving
Commit 53d725f78a, intended to fix an
overzealous commit, was itself overzealous. This is because it applied
to all entities when it should only apply to entity-emitting entities.
To fix this, `entityclonefix` needs to no-op if the entity is not an
entity emitter.

Fixes #1176.
2024-06-09 19:41:48 -07:00
Misa
53d725f78a Fix regression: Overzealous emitter dupe fix
Commit 4f881b9e26 fixed a duplication bug
where enemy movement types 10 and 12 would keep duplicating itself on
every frame if it was spawned outside of the rooms they were supposed to
be used in the main game. The downside was that this was an overzealous
fix and unintentionally broke some cases that were working before.

As brought to my attention by Ally, you can no longer place an edentity
with a `p1` of 10 or 12 (translating to movement type 10 or 12) in the
proper rooms and have it spawn perfectly working entities (that don't
clone on themselves every frame), whereas you could in 2.2. This is
considered a regression from 2.3.

So the problem here is that the reason the two emitter entities were so
dangerous outside their respective rooms is because the entity they
spawned (`createentity` entry 1) checked if it was in the correct rooms,
and if so, it would call `setenemy`, and `setenemy` would set the
`behave` attribute (movement type) correctly, and so the new entity
would have a different `behave` that wouldn't be the exact same `behave`
as the previous one, so it wouldn't be a duplicate emitter entity.

The previous `entityclonefix` worked okay for entry 1, because it would
only be run if the room checks failed and `setenemy` wasn't called, but
it broke a previously-working case for entry 56, because it was always
run for entry 56.

So the best way to check if we have a dangerous entity is not by seeing
if it is still `behave` 10 or 12 at the end of entity creation - because
10 or 12 could be harmless under the right conditions - but by checking
if the right conditions were satisfied, and if not, then neutralize the
entity.

I considered making the emitter entities work everywhere - which would
be simpler - but I didn't want to go too far and add a new feature,
especially in a minor release.
2024-06-07 14:20:28 -07:00
Misa
c20db02f15 Unload zips before loading zips
This fixes a minor issue where if you had a zip in the levels list, but
then removed it, it would still show up in the levels list after
reloading it (if you also had a .vvvvvv file named the same as in the
zip) even though it shouldn't.

Thankfully, this didn't lead to a memory leak or duplicate zip mounts or
anything like that, because PhysFS ignores mounting a zip if it's
already mounted.

This also didn't result in a level entry from a zip persisting after
removal after reloading the levels list, because the entry would be gone
due to the .vvvvvv file not being found.
2024-06-04 15:42:39 -07:00
Misa
dd15d67e62 Fix info args not working with -console
The intention of the `-console` argument was to enable seeing console
output on Windows without having to use workarounds. However, this
didn't actually work for arguments like `-addresses` and `-version`,
because the program would exit first before it could get the chance to
create the console.

The other issue is that the console closes too quickly before output can
be read by the user. So to fix that, we must hold it open and let the
user close it when they want to by waiting for an enter press from
STDIN.
2024-06-03 21:42:57 -07:00
Misa
a9d43b543f Fix regression: Foreground redraw after G keybind
This fixes a regression from 2.4 where the foreground wouldn't update
after using the G keybind to go to a room, requiring the user to touch a
tile to update the rendering.
2024-06-03 20:58:52 -07:00
Misa
16d75d2da8 Disable state locking if inc'ing state w/ ACTION
This fixes a bug report from Elomavi that you could still softlock from
warping to ship and incrementing the gamestate by pressing ACTION, which
is diverging behavior from how it was in 2.3. Warping to ship and
incrementing by pressing ACTION is useful behavior for a couple niche
speedrun categories.

I had already fixed this earlier by ignoring state locking if
glitchrunner 2.2 or 2.0 was enabled, but softlocks could still happen
because having glitchrunner mode off still enabled you to increment the
gamestate when otherwise unintended. Softlocks shouldn't happen.

But without removing state locking entirely, I've chosen a middle ground
where it will only be disabled if you press ACTION. That signifies
intent that you still want to perform state incrementing glitches even
with glitchrunner mode off (but in the future it could be considered a
2.3/2.4 glitch that could be patched and made re-enable-able). That way,
casual players can't interrupt the warp to ship by accident (unless they
accidentally press ACTION) while softlocks will be removed.
2024-05-25 23:34:03 -07:00
Misa
ff6bb68f3a Fix "Thanks for playing!" reversed in Flip Mode
For localization, the "Thanks for playing!" text was split into two
lines, when it was originally one line. Unfortunately, it was not
updated to account for Flip Mode, so in Flip Mode, it looked like
"playing! Thanks for".

This has been fixed.
2024-05-25 23:33:45 -07:00
leo60228
4b2b4fb7c9 CONTRIBUTORS.txt: leo60228 -> leo vriska 2024-05-21 20:57:19 -07:00
Misa
ff785aaa8a Bump version to 2.4.2
We still need to fix a couple bugs from 2.4.0.
2024-03-29 21:18:39 -07:00
Misa
217996b134 Fix UB from out-of-range <stretch>
If there was a scaling mode value (serialized in the XML as <stretch>
for legacy reasons) that was not 0 or 1 or 2, then the rectangle with
the stretch information would not be initialized by get_stretch_info,
which would lead to a crash, either from dividing by zero (most likely)
or from reading an uninitialized value.

To fix this, when reading <stretch>, normalize it to a sane default if
the value is otherwise bogus. And for good measure, an assertion is
added in get_stretch_info() if the value is still somehow bogus.

Fixes #1155.
2024-03-29 20:22:00 -07:00
Misa
8640ead937 Fix copy-paste error in customposition
This would otherwise result in text boxes for custom crewmates being
improperly positioned.
2024-03-29 19:55:41 -07:00
Dav999
a9d438968d Change reply scripting command to player color
This is just a small visual fix to an inconsistency with textbox
colors in simplified scripting. The `reply` command is meant to be
used for the player, and always correctly positions it above the
player, while the `say` command may be used to generate a cyan textbox
that's positioned above a cyan non-player crewmate. However, the color
for both textboxes is always `cyan`, so the `reply` command doesn't use
the (normally identical) `player` color even though all its other
behavior (squeak, position) does. Now that customized textbox colors
were added in 2.4 (#910), it's a shame that this distinction isn't
made between `cyan` and `player`, so this change addresses that (before
we're stuck with levels that change `cyan` but not `player`).
2024-03-29 19:47:46 -07:00
Dav999
99a1562d87 Only re-show language screen in default basedir
After some discussion about the previous commit, the usecase of
managing tons of basedirs and locking files in the filesystem might
mean it gets annoying to have the language screen show up again
whenever a new language is added, for a small group of people. The
solution to get the best of both worlds is to only re-ask for the
language in the default basedir. This means barely anyone will miss
their language having been newly added (especially since barely anyone
will use any custom basedirs, let alone ONLY custom ones).
2024-02-08 10:28:27 -08:00
Dav999
fbc3bd4d5a Make language screen show up once more
Now that two new variants of Spanish have been added, it would be
a shame that many players from Latin-America/Argentina may stay on
Castilian or English because they don't realize the new versions
were added for them. So now, if you've set your language in 2.4.0,
the language screen will show up once more in 2.4.1. This is done by
simply incrementing the lang_set flag to 2 - so that if it's 0 or 1,
your language setting is considered to be possibly outdated.

This shouldn't inconvenience players who don't need to select a new
language - their existing language will still be pre-selected, so they
can just hit ACTION once.

Terry confirms he did the same thing with Dicey Dungeons and says
it's a good idea (and that nobody minds).
2024-02-08 10:28:27 -08:00
Misa
365ee963eb Fix resize-to-nearest could be larger than desktop
This fixes the possibility of the "resize to nearest" graphics option
resizing the game window to be bigger than the resolution of the user's
desktop monitor.

To fix this, just subtract multiples of 320x240 until the chosen
multiple is smaller than the dimensions of the desktop.

Discord user Dzhake discovered this issue.
2024-02-05 18:03:32 -08:00
Ally
3e57d6620c Update desktop_version/src/Graphics.cpp
Co-authored-by: Misa Elizabeth Kai <infoteddy@infoteddy.info>
2024-02-03 18:11:11 -08:00
AllyTally
77a571017d Implement scaling modes manually
For future PRs, it'll be very nice to have full control over how VVVVVV
gets drawn to the window. This means we can use the entire window size
for things like touch input, drawing borders, or anything we want.
2024-02-03 18:11:11 -08:00
Misa
935db27d39 Revert "Translate editor notes on-the-fly"
This reverts commit ec3de52970.

The complexity is not worth it for something that only lasts less than
two seconds anyway. *shrug*
2024-02-02 19:13:59 -08:00
Misa
ec3de52970 Translate editor notes on-the-fly
This is so they will be updated when switching language with CTRL+F8.

Most of the editor notes are simple text that don't use any string
formatting. For the ones that aren't, some (saving and loading, changing
map size) reference variables that wouldn't change without initiating a
new note anyway. For the others, i.e. the ones that _do_ reference
variables that could easily be changed (tileset name, speed) by
switching the current room, we cache their values and use the cached
values when drawing the note. Unfortunately, this requires adding a
couple of ugly attributes to editorclass, but it'll be fine.
2024-02-02 18:57:24 -08:00
Misa
67f41a780c Translate editor prompt text on-the-fly
These are simple strings (no vformat), so we can just un-bake them to
make sure that cycling languages with one of them onscreen updates them
accordingly.
2024-02-02 18:57:24 -08:00
Misa
a7acf4e177 Fix cycling menus in editor not updating
While there's a check to recreate the menu if you cycle the language
while in a menu, editor menus are a special case and need specific
handling.
2024-02-02 18:57:24 -08:00
Misa
53ed33039f Translate level title and creator on-the-fly
These weren't getting updated when cycling language with CTRL+F8. This
is because they would be already baked. Luckily, at least the bool
keeping track of whether or not to translate them in the first place
already exists, so we can just rely on that.
2024-02-02 18:57:24 -08:00
Misa
0aea27f237 Fix limits check not updating with CTRL+F8
This makes it work pretty well. It basically just resets the state of
the limits check and starts from the first limit broken (if any), which
is behavior that makes sense to me.

Otherwise, without this, it seems to invalidate pointers and, on my
machine, start pulling strings from the language XML, which is
horrifying.
2024-02-02 18:57:24 -08:00
Misa
ad6e31aa12 Disable switching languages during cutscene tests
Not gonna lie, I am a bit disappointed at having to do this, because it
actually worked pretty well despite a few bugs depending on which
language you entered with. But that's only because I'm working with
the official translation files, which are in sync with each other.

With translation files that are completely arbitrary, it would be
apparent that switching languages during the cutscene test doesn't
really make sense. Like, at all. That's because the list of cutscenes is
populated entirely from language-specific XML and the cutscenes in them
are also from language-specific XML. So keeping the same position in the
menu doesn't really make sense, and keeping the same position in a
cutscene definitely doesn't make sense.
2024-02-02 18:57:24 -08:00
Misa
3d61f9067b Translate NDM hardest room on-the-fly
Otherwise, cycling languages through CTRL+F8 would result in mismatched
languages.
2024-02-02 18:57:24 -08:00
Misa
531b151d12 Translate menu options on-the-fly
I saw that the only problem with cycling languages in a title screen
menu is that the menu options don't get updated. So I was like, we can
just recreate the menu, and then I was like "Sure, why not." So that's
what I did.

To accommodate the CTRL+F8 keybind in the language menu, it
automatically updates the menu option when you cycle it. This is because
otherwise using the keybind in the language menu wouldn't visibly update
the language, but it still actually does change your language, and that
can be seen by pressing Escape.

Also, the menucountdown needs to be preserved because otherwise
createmenu() resets it, even if it's the "same" menu (this behavior is
needed so that the menu that is shown during the countdown isn't added
as a stack frame which would make it a menu that could be returned to).
2024-02-02 18:57:24 -08:00
Misa
c173dec8f9 Reset textcase in speak/speak_active
Originally, textcase was reset in scriptclass::translate_dialogue(),
which is called inside the `text` script command. However, this didn't
really work with the new on-the-fly text box translation system, and
that function is gone now, so I removed that and kind of forgot about
it.

Of course, this now causes a regression. Namely, that the text boxes
after the VVVVVV-Man sequence in the Secret Lab entrance cutscene are
not translated.

I can't reset the text case in `text`, as the scripts assume that they
can set the text case before `text`. So the next best thing is to reset
it in speak/speak_active.
2024-02-02 18:57:24 -08:00
Misa
861f724d90 Recompute textboxes on active input device change
This fixes a bug where some text boxes wouldn't update the displayed
button if the active input device changed from a keyboard to controller,
or vice versa. Namely, the "Press ACTION to continue" text boxes.
2024-02-02 18:57:24 -08:00
Misa
505956ae83 Remove textboxwrap() and wrap() return value
This removes Graphics::textboxwrap(), as it is now an unused function.
Additionally, this removes the return value of textboxclass::wrap(), as
it is also now unused.
2024-02-02 18:57:24 -08:00
Misa
c50da88ad4 Store original position of text box
This stores the original x-position and y-position of the text box, and
when a text box gets repositioned, it will use those unless a crewmate
position overrides it.

This is the original position of the text box, before centering or
crewmate position is considered.

This fixes a bug where a cutscene text box can be "shifted" from its
normal position via CTRL+F8 cycling if there is a translation that is
too long for the screen and thus gets pushed by adjust(). I tested this
with the text box in the Comms Relay cutscene that starts with "If YOU
can find a teleporter".

This is not applicable to function-based translations
(TEXTTRANSLATE_FUNCTION), because the responsibility of correctly
positioning the text box resides with the function.
2024-02-02 18:57:24 -08:00
Misa
9b56a53d98 Add debug keybind CTRL+(SHIFT)+F8 to cycle lang
This adds a debug keybind to cycle the current language forwards,
CTRL+F8. It also adds a debug keybind to cycle it backwards,
CTRL+SHIFT+F8.

This is only active if the translator menu is active (and so if the
regular F8 keybind is also active).

This is useful for quickly catching errors in translations and/or
inconsistencies between translations. In fact, I've already caught
several translation mistakes using this keybind which made me mildly
panic that I screwed something up in my own code, only to realize that
no, actually, it was the translation that was at fault.

For now, this is only meant to be used in-game, as text boxes get
retranslated instantly, whereas things like menu options don't. But menu
options will be retranslated on-the-fly in a later commit.
2024-02-02 18:57:24 -08:00