Commit Graph

2918 Commits

Author SHA1 Message Date
TerryCavanagh df559e64a9 minor updates to Brazilian Portuguese 2024-02-06 16:21:08 +01: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
Dav999 929aaebc84 Align stability generator in es_419 and es_AR 2024-02-05 18:03:08 -08:00
Dav999 d6ec4ae72a Change LATAM Spanish meta.xml Oprime to Pulsa
All of them were changed except for the one in meta.xml. I think it's
safe to assume this is correct, because everywhere else, the same
"Oprime {button} para" pattern always became "Pulsa {button} para" too.
2024-02-05 18:03:08 -08:00
Dav999 139612b319 Fix placeholders in Arabic strings_plural
For some reason all of us overlooked that all of them were {n_crew},
even those which required a different placeholder key...

https://steamcommunity.com/sharedfiles/filedetails/?id=3154670529
2024-02-05 18:03:08 -08:00
TerryCavanagh 2ca912889d minor updates to Latin American Spanish and Argentinian Spanish 2024-02-05 12:04:47 +01:00
KabanFriends c1a6a1d1df Improve translation for Down Under 2024-02-04 21:37:21 -08:00
KabanFriends 098e356500 Fix typo for Bilinear 2024-02-04 21:37:21 -08:00
KabanFriends 2e633578fd Fix translator credit 2024-02-04 21:37:21 -08:00
KabanFriends 05a3b16f7e Add missing string translations 2024-02-04 21:37:21 -08:00
KabanFriends 55ed42e34c Don't use wordy for numbers 2024-02-04 21:37:21 -08:00
TerryCavanagh 9d933f6c2f minor fixes for Silesian 2024-02-04 20:49:40 +01: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
Dav999 a770f3e126 Add missing spaces to script editor title in Welsh 2024-02-02 19:03:52 -08:00
Dav999 18b532cd9f Translate the current 4 proxy strings into Dutch
These are the 3 variants of Spanish and "Editing and LQA".
2024-02-02 19:03:52 -08:00
Dav999 df5607959b Sync Spanish LATAM and Spanish ARG language files
They were missing the latest strings and also still had strings that
had been deleted.

(Whoever commits the upcoming delivery should also sync that version)
2024-02-02 19:03:52 -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
Misa 84daa8fbc2 Call resize() before formatting text in cutscene
This fixes a problem where it would incorrectly format the text because
the width of the text box hadn't updated yet.

This fixes a bug where the jukebox informational terminal would
initially be created with too much padding in CJK languages, pushing the
text box offscreen, even though switching languages while the text box
is already open fixes it.
2024-02-02 18:57:24 -08:00
Misa 3de2c543a5 Move all other text boxes to new system
These include the room name translator text boxes (which aren't
translated) and the foundlab and foundlab2 text boxes.
2024-02-02 18:57:24 -08:00
Misa b14ca5e366 Move Game Complete sequence to new text box system
In order to be able to retranslate the game time text box in particular,
I had to create new variables to bake the saved time, since the existing
savetime variable is just an std::string. From there, the saved time can
be retranslated on-the-fly.
2024-02-02 18:57:24 -08:00
Misa 7088858957 Add textbox indexes, update trinket/crew textboxes
This adds an attribute to textboxclass to allow a text box to keep an
index that references another text box inside the graphics.textboxes
std::vector.

This is needed because the second text box of a "You have found a
shiny trinket!" or "You have found a lost crewmate!" pair of text boxes
explicitly relies on the height of the first text box. With this, I have
moved those text boxes over to the new text box translation system.

Since the update order now matters, I added a comment to
recomputetextboxes() that clarifies that the text boxes must be updated
in linear order, starting from 0.
2024-02-02 18:57:24 -08:00
Misa 668d0c744d Add assert for giving func if it won't be used
This adds an assert to Graphics::textboxtranslate() to make sure that
callers don't accidentally provide a function when specifying a
translation type that isn't TEXTTRANSLATE_FUNCTION, because in that case
the function won't be used, and then it will make them scratch their
heads wondering why their function won't work.

And yes, I am stupid enough to blindly type TEXTTRANSLATE_CUTSCENE when
I meant to type TEXTTRANSLATE_FUNCTION. This assert has already caught
one of my mistakes. :)
2024-02-02 18:57:24 -08:00
Misa 76483f96ef Move Comms Relay text boxes to new system
These seemed annoying to do without copy-pasting, because I didn't want
to make a separate function for every single dialogue, and I didn't know
how to pass through the English text, until I realized that I can just
use the existing original.lines vector in the text box to store the
English text. After that, getting it translated on-the-fly isn't too
bad.
2024-02-02 18:57:24 -08:00
Misa 82150fd3a9 Remove unnecessary calls to resize()
Just a small optimization.

For example, consider the calls in adjust(). After the first resize(),
the lines after only change the x-position and y-position of the text
box and depend on the x-position, y-position, width, and height.
However, resize() only changes the width and height if the contents of
the text box change, which after the first call, they don't. So remove
the second call to resize(), because it's completely unnecessary.

By similar reasoning, the second calls to resize() in centerx() and
centery() are unnecessary too.
2024-02-02 18:57:24 -08:00
Misa 28df0148b1 Transfer adjust call to applyposition
This transfers the responsibility of the adjust() call to
applyposition().

This is because cutscene text boxes (TEXTTRANSLATE_CUTSCENE) will have
adjust() called, but all other text boxes won't. And I can't place the
adjust() call inside applyposition(), because adjust() also calls
applyposition(), and that leads to an infinite loop which leads to a
stack overflow, so I had to remove the applyposition() call from
adjust(), and replace the other existing call to
Graphics::textboxadjust() with Graphics::textboxapplyposition(), and
then remove Graphics::textboxadjust() function because it's no longer
used.
2024-02-02 18:57:24 -08:00
Misa 3ef089ed3d Save context of untranslated text boxes
Several text boxes in the gamestate system are unused and are
untranslated. To prevent them from becoming empty when retranslating
text boxes, we need to save their original context by calling
graphics.textboxoriginalcontextauto() (which is just
graphics.textboxoriginalcontext() but automatically saving whatever is
already in the text box at the time).
2024-02-02 18:57:24 -08:00
Misa d989c232af Recompute text boxes in Flip Mode
With the new system of retranslating text boxes on-the-fly, this also
enables us to retranslate them whenever the player toggles Flip Mode.
This is relevant because the Intermission 1 instructional text boxes
refer to a floor when Flip Mode is off, but when it is on, it talks
about the ceiling.
2024-02-02 18:57:24 -08:00
Misa 94b9722b7b Split textwraps, move more textboxes to new system
This splits the text wrapping functionality of Graphics::textboxwrap to
a new function textboxclass::wrap, and with this new function, some more
text boxes can be moved to the new TEXTTRANSLATE_FUNCTION system.
Namely, Game Saved (specifically the game failing to save text box),
instructional text boxes in Space Station 1, and the Intermission 1
instructional text boxes.
2024-02-02 18:57:24 -08:00
Misa de00dd4031 Save special text box state using functions
This adds a way to save the text box state of the crew remaining, ACTION
prompt, etc. text boxes by just letting there be a function that is
called to retranslate the text box when needed.

It also adds a way to ignore translating a text box and to leave it
alone, in case there's actually no text in the text box, which is the
case with Level Complete and Game Complete.

Both ways are now in an enum, TextboxTranslate. The former is
TEXTTRANSLATE_FUNCTION and the latter is TEXTTRANSLATE_NONE. The
existing way of translating text boxes became TEXTTRANSLATE_CUTSCENE,
since it's only used for cutscene scripts.

Here's a quick guide to the three ways of creating a text box now.

- TEXTTRANSLATE_NONE: You must call
  graphics.textboxoriginalcontextauto() to save the existing text to the
  original context of the text box, as that will be copied back to the
  text box after the text of the text box is updated due to not having a
  translation.
- TEXTTRANSLATE_CUTSCENE: Translates the text from cutscenes.xml, and
  overrides the spacing (padding and text centering). Shouldn't need to
  be used outside of scriptclass.
- TEXTTRANSLATE_FUNCTION: You must pass in a function that takes in a
  single parameter, a pointer to the textboxclass object to be modified.
  General advice when retranslating text is to clear the `lines` vector
  and then push_back the retranslated text. The function is also solely
  responsible for spacing.

In most cases, you will also need to call
graphics.textboxapplyposition() or graphics.textboxadjust() afterwards.
(Some text boxes shouldn't use graphics.textboxadjust() as they are
within the 10-pixel inner border around the screen that
textboxclass::adjust tries to push the text box out of.)

This commit doesn't fix every text box just yet, though. But it fixes
the Level Complete, Game Complete, crew remaining, and ACTION prompt
text boxes, for a start.
2024-02-02 18:57:24 -08:00
Misa 0ea0b8e00b Save text box centering state
This is another piece of state that needs to be kept and re-played when
switching language, because a different language could change the
dimensions of the text box, which affects how it's centered.

Also, to make sure that crewmate positions override any text centering,
the scriptclass variables textx and texty should be reset in the
position and customposition commands.
2024-02-02 18:57:24 -08:00
Misa e8a231f2e2 Fix translating text box ignoring line limit
Originally I did a straight deep copy of the original lines, but this
ignores the limit of either 12 or 26 lines in a text box. So we defer to
addline() which will enforce the limit accordingly, just like it would
do with the original text box.
2024-02-02 18:57:24 -08:00
Misa 8b03fbd9f4 Save textbox state, allow lang switches w/ textbox
This allows switching languages while a text box is on screen by saving
the necessary state for a text box to be retranslated when the language
is switched.

This saves the state of the position and direction of the crewmate that
the text box position is based off of (if applicable), and the text
case of the text box, the script name of the script, and the original
(English) lines of the text box. I did not explicitly label the original
lines as English lines except in a main game context, because
technically, custom levels could have original lines in a different
language.

Unfortunately, this doesn't work for every text box in the game.
Notably, the Level Complete, Game Complete, number of crewmates
remaining, trinket collection, Intermission 1 guides, etc. text boxes
are special and require further fixes, but that will be coming in later
commits.
2024-02-02 18:57:24 -08:00
Misa 3b0757bd82 Add bounds check to setlinegap
This is for consistency with all other functions dealing with the latest
created text box. There are several cases in custom levels where these
functions can be called even though there are no text boxes on screen.
2024-02-02 15:00:44 -08:00
Misa 2b476bb4c1 Remove trailing whitespace on getlinegap decl 2024-02-02 14:59:52 -08:00
TerryCavanagh 69684994be added translation category support to ending credits also 2024-02-02 18:24:49 +01:00
TerryCavanagh 5f9e326b67 Added proxy string for "Editing and LQA"
I checked the pt_BR one with our translators, so that one's correct
2024-02-02 18:15:45 +01:00