1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-03 03:23:33 +02:00
Commit Graph

2897 Commits

Author SHA1 Message Date
Misa
34e7b1af61 Update FAudio to 24.01
FAudio is usually very stable, after all, our very own Ethan Lee
maintains it. This should be safe to bump.
2024-01-09 23:15:57 -08:00
Misa
9bb463ab0e Add third_party/ to CI workflow paths
This adds the third_party/ directory to the list of paths that will
trigger a CI workflow when changed.

Not all updates to third-party dependencies will necessarily change
code, but we bump dependencies infrequently so there's not much of a
problem with triggering CI on every change to third_party/.
2024-01-09 23:13:39 -08:00
Misa
2a9003ae45 Reverse left & right nav keys in editor for RTL
If the language is RTL, then the left and right menu navigation keys
should be reversed, because the menu layout goes from right to left.

This is to be consistent with the other menus in the game. The editor is
just a special case so it was overlooked.
2024-01-09 21:05:26 -08:00
Misa
163f3a0fde Allow using W and S in editor menus
There was an inconsistency where W and S couldn't be used in place of
the Up and Down arrow keys, but this has been fixed.

This only applies where W and S otherwise are not bound to anything
else. E.g. not the main editor (where W changes the warp direction and S
saves the level) and not the script editor (where W and S can be typed
inside a script), but the script list is fine.
2024-01-09 20:54:11 -08:00
Misa
0e40892eb0 Arabic: Fix translation for Vertigo roomname
By Montassar.

Just adds a U+200F (RTL mark).
2024-01-09 20:25:15 -08:00
Dav999
ef13775456 Add Arabic language files
Here are all the language files for Arabic!
Thanks to Montassar and Seif for their hard work to localize the
entire game in such a short timespan.
2024-01-09 20:20:14 -08:00
Dav999
7b92e7af4d Update Arabic font 2024-01-09 20:20:14 -08:00
Misa
a7b22919ae Modulate text sprite RGB instead of using alpha
Using actual alpha is prone to bugs with doubling alpha, etc. if there
are multiple sprites on top of each other.
2024-01-09 19:22:40 -08:00
Misa
2ed1aac67d Fade text box overlays with text box
Currently, it's a bit jarring that text box overlays (which are text box
images, e.g. Level Complete and Game Complete, and sprites, e.g. the
crewmates) will suddenly appear when their text box has fully faded in
and suddenly disappear once it starts fading out.

This makes it so that text box overlays will be faded in and out
smoothly along with the rest of the text box fading in and out.

Transparent text boxes are not affected, as they do not fade in and out
at all. Thus, text box overlays in transparent text boxes will still
suddenly appear and disappear as usual.
2024-01-09 18:38:40 -08:00
Dav999
ba92174c71 Use wordy2 in Dutch to capitalize één as Eén
The number "one" in Dutch is "één" (silly, I know :P). Capital letters
can have accents, but there's an exception where for this specific
word, the first accent is much more often left off than not. So I'm
now using wordy2 as the uppercase variants of all the numbers, and
using that instead of the |upper flag.
2024-01-09 18:05:15 -08:00
Misa
40b0f9ec36 Account for position of prompt in mode text
I forgot that the position of the activity zone can vary based on
setactivityposition() in custom levels. So account for that.
Additionally, if the activity zone prompt is far down enough, then we
don't need to move the mode text at all.
2024-01-09 17:48:53 -08:00
Misa
18730b465e Allow taking multiple screenshots in same second
Dav999 notified me that if multiple screenshots are taken in the same
second, the second screenshot has `_2` appended to it and so on. We do
the same here by storing the current timestamp and a counter.

This doesn't prevent overwriting files if you have system time that
changes, or have multiple instances of VVVVVV running at the same time,
but my position on those cases is as follows: Don't do that.
2024-01-09 17:21:18 -08:00
Misa
d8b97db6a8 Make sure mode text is visible above act prompts
This makes the mode indicator text be visible even if there is an
activity zone prompt on screen, by making it so that it gets moved if an
activity prompt is being rendered.

This is to make sure that it's visible no matter what, even if e.g. a
custom level starts the player on an activity zone.
2024-01-09 17:06:33 -08:00
Misa
9676bf0006 Fix visual clash between timer and trophy text
Trophy text can overlap with the timer. How bad it is depends on the
localization but in English some text definitely overlaps.

Simple fix is to disable rendering the timer if we are rendering any
trophy text.
2024-01-09 16:56:38 -08:00
Misa
b3b001c2a8 Place GraphicsResources functions in header file
These are functions used in other files that are not on the
GraphicsResources class but are implemented inside the
GraphicsResources.cpp file. For some reason they were never put in the
GraphicsResources.h file until now, even though it's a perfectly good
header file to put them in.
2024-01-09 16:03:05 -08:00
Misa
10030a4340 Save screenshots with proper filenames
Filenames are timestamped now, down to the second. If you take multiple
screenshots in the same second, then the last one will overwrite the
others. This seems to be how other screenshot programs operate so I
don't think it matters if you can't take more than one per second.

Additionally, 1x screenshots (320x240) will go in the 1x/ subdirectory,
and 2x screenshots (640x480) will go in the 2x/ subdirectory.
2024-01-09 15:48:41 -08:00
Misa
40f6f83328 Add border to indicate taking screenshot
Originally, I was thinking of adding a notification text that you took a
screenshot, but this is better because it is language-agnostic and it
doesn't contribute to potential UI clutter/clashing.

It flashes yellow if the screenshot successfully saved, and red if it
didn't.
2024-01-09 15:48:41 -08:00
Misa
93ec2c6cca Upscale screenshots 2x
The plan is to have Steam screenshots always be 2x, but in the VVVVVV
screenshots directory (for F6 keybind) save both 1x and 2x.

Again, just for now, the 2x screenshot is being saved to a temporary
location for testing and will get proper timestamps later.
2024-01-09 15:48:41 -08:00
Misa
20f0fafa5e Fix screenshots in Flip Mode
One problem with internal screenshot capture is that we rely on SDL's
render subsystem to flip the screen in Flip Mode, while leaving our
actual screen untouched. Since we source the screenshot from the screen
and not what SDL renders, we need to flip the screenshot ourselves when
saving an internal capture.

To do this, we need to support 24-bit colors in DrawPixel() and
ReadPixel(). Luckily, this isn't too hard to do. A 24-bit color is just
a tuple of three bytes, and we just need to do a small amount of bitwise
math to pack/unpack them to a single integer for SDL_GetRGB() and
SDL_MapRGB().
2024-01-09 15:48:41 -08:00
Misa
ae5ef9753c Hook Steam screenshots and send internal capture
Using the Steamworks API, we can hook the screenshot function and listen
for a screenshot request callback to send in our own screenshot. This
applies the screenshot improvements to Steam screenshots as well.

Doing this requires adding some C wrapper functions, as our interface
with the Steam API is only conducted through C.
2024-01-09 15:48:41 -08:00
Misa
f05827f268 Add support for internal screenshots
"But people already have screenshot tools", you might protest. The
rationale is simple: If you play with any video setting other than 1x
windowed (no stretching and no letterbox), then your screenshot will be
too big if you want the internal resolution of 320x240, and downscaling
will be an inconvenience.

The point is to make screenshots based off of internal resolution so
they are always pixel perfect and ideally never have to be altered once
taken.

I've added the keybind of F6 to do this.

Right now it saves to a temporary test location with the same filename;
future commits will save to properly-timestamped filenames.
2024-01-09 15:48:41 -08:00
Dav999
060fe6938d Add support for right-aligned roomtext
This is mostly so people making levels in an RTL language have a more
pleasant and logical experience. If roomtext is placed in a level set
to RTL, it will get p1=1, which makes that roomtext right-aligned.
Because, imagine for English you click to place roomtext, and the text
runs left of where you clicked, which wouldn't be logical.

Since it's an entity-bound property, switching RTL on and off either in
the editor or via a script does not affect existing entities.
2024-01-09 13:13:04 -08:00
Dav999
7b46087077 Update README-translators.txt for some recent additions
These things hadn't been added to the documentation yet:
- <font> in a language's meta.xml
- <gamepad_hint>
- <rtl>
- wordy2/translation2
2024-01-09 12:12:54 -08:00
Misa
fe21be87a2 Remap lang reload keybind from F12 to F8
This remaps the keybind to reload language files from F12 to F8.

This is because the F12 keybind conflicts with the default Steam keybind
to take a Steam screenshot.

I chose F8 because it is next to another keybind that reloads stuff, F9
(which reloads assets in the editor).

Fixes #1089.
2024-01-09 11:14:11 -08:00
Misa
b077f24a50 CWrappers.cpp: Extern "C"
While working on adding a screenshots keybind, I encountered a link
error with these functions. Wrapping them in `extern "C"` fixed it. It's
most likely due to the fact that they were `extern "C"` in the header,
but not in the `.cpp` file. They should be both `extern "C"`'d
regardless.
2024-01-09 11:11:15 -08:00
TerryCavanagh
4b2b3f2a08 another spanish wordy2 fix 2024-01-09 15:26:55 +01:00
TerryCavanagh
607bfd89a7 more spanish wordy2 changes 2024-01-09 13:58:11 +01:00
TerryCavanagh
c0d6002d44 added wordy2 support to spanish
uno/una in e.g. "Y has encontrado {n_trinkets|wordy2} baratijas."
2024-01-09 13:27:32 +01:00
Misa
858c2cb081 Indicate modes when loading in to gameplay
If you load in to gameplay with invincibility mode, glitchrunner mode,
Flip Mode, or slowdown enabled, then there will be text displayed on
screen for a few seconds that says so.

This is to serve as a useful reminder. A common pitfall with using
invincibility is forgetting to turn it off when you don't want it
anymore. What usually happens is that players forget that they have it
on until they encounter a hazard. Now, they can realize it as soon as
they load in.

See #1091.
2024-01-08 20:01:27 -08:00
Dav999
f846ba5d59 Inverse centered text screen border for RTL
If text is set to be centered, but is so long that it starts running
offscreen on both sides, the print function instead makes the text
start no further left than the left border of the screen (x=0).
This is because text running offscreen at the end only is more readable
and looks less sloppy than running offscreen at both sides.

For RTL, the opposite applies, so it now also works oppositely for RTL
prints, where centered strings will only run offscreen on the left side
of the screen.
2024-01-08 19:17:44 -08:00
Dav999
d78338f9ef XFLIP prompts in the editor 2024-01-08 19:17:44 -08:00
Dav999
1b55c6501c Swap definitions of left and right textbox padding
Spaces on the left and right would end up on the other side in RTL,
which made the "You have rescued a crewmate!" text overlap with the
crewmate sprite, and makes the [C[C[C[C[Captain!] dialogs have spaces
on the left instead of on the right. So, best thing is to just swap
the directions so that they match.
2024-01-08 19:17:44 -08:00
Dav999
945f0edaae Ignore directional control chars in font::len()
They're invisible in font::print(), but they were still considered
characters with widths in the width function. This change made the
levels screen look better in RTL too - I was wondering why the level
options were too far left.
2024-01-08 19:17:44 -08:00
Dav999
18dfcff985 XFLIP cursor in roomname translator mode 2024-01-08 19:17:44 -08:00
Dav999
fd0aefe0ee XFLIP LOADING... screen 2024-01-08 19:17:44 -08:00
Dav999
96fa932a8a Don't pass newline characters to bidi algorithm
If you copy-paste a newline character where it's not interpreted, such
as in a level title, the print function wouldn't treat it any special.
font::print_wrap() would, but that's not used here.

However, now that bidi is involved, the newline is passed straight to
SheenBidi which interprets it as a new line (which would need a new
SBLine to be created, or maybe even a new SBParagraph if there's two).
All while we're still treating it as a single line. This means the text
would just stop being displayed after the first newline. This is now
fixed by treating all newlines as spaces.
2024-01-08 19:17:44 -08:00
Dav999
c8dbdc890e Flip Game Complete screen
Obvious "Key: value" things here, this one was easy.
2024-01-08 19:17:44 -08:00
Dav999
3d04d0acbc Mirror time trial results screen
This has a lot of reading-orientation stuff on it like "Key: value",
so easiest is to just flip the whole design of the screen rather than
trying to flip individual strings.
2024-01-08 19:17:44 -08:00
Dav999
79a0ad8493 XFLIP analog stick sensitivity slider properly
The slider itself was getting mirrored, but not the labels
(Low/Medium/High). This fixes that.
2024-01-08 19:17:44 -08:00
Dav999
5620edeb6b Fix orientation of levels list
I forgot to add the PR_RTL_XFLIP flag to these menu options, so they
were always left-aligned, no matter what.

What actually took me a bit to figure out was how to make the level
completion stars work regardless of the contents of the title - the
stars should always be to the left of the title in an LTR language, and
always to the right of the title in an RTL language. Level titles can
contain bidi characters regardless of the level's rtl flag being set,
so I just let bidi handle all the level menu options, with some control
characters to make sure everything always appears in the correct order.
2024-01-08 19:17:44 -08:00
Dav999
3f8333400f Base text box padding/centering on font width instead of codepoints
Stuff like centertext="1" and padtowidth="264" in cutscene translations
looked wrong in RTL mode, both with Arabic and English text. For Arabic
text, I could easily fix the problem by not counting the number of
codepoints (and assuming they all have the same glyph width), but by
instead taking the width of the string as reported for the font, and
dividing it by the glyph width. This leaves English text still looking
weird in RTL mode. But this shouldn't be a problem either: the Arabic
translations will probably be in Arabic (where the problem doesn't
happen), and I can get English text to show up fine by wrapping it in
U+2066 LEFT-TO-RIGHT ISOLATE and U+2069 POP DIRECTIONAL ISOLATE. So it
looks like an inherent quirk of bidi, that translators familiar with
bidi can easily grasp and fix.

This is main-game only functionality, so it shouldn't break existing
custom levels. We should just make sure textboxes in other languages
aren't broken, but from my testing, it's completely fine - in fact, it
should've improved if it was broken.
2024-01-08 19:17:44 -08:00
Dav999
25bdf0866a Make left/right key input correct for RTL menus
Instead of just up/down, you can also control menus with left/right.
Which is illogical in Arabic... No big deal, I imagined this code
to become much worse than it did. (And action sets is probably gonna
refactor the whole thing anyway)
2024-01-08 19:17:44 -08:00
Dav999
2b22f7cda2 Add PR_RTL_XFLIP to some important places
Okay, the "Font:" thing needed some local code after all, because both
the interface font as well as the level font are used there. But it's
good enough - all the other places can just use the flag.

Notably, I also used this for the menus, since the existing ones are
kinda LTR-oriented, and it's something that we don't *really* have to
do, but I think it shows we care!
2024-01-08 19:17:44 -08:00
Dav999
eac612c309 Add PR_RTL_XFLIP print flag
This lets you mirror the X axis specifically in RTL languages, so the
left border is 320 and the right border is 0, and invert the meaning of
PR_LEFT (0) and PR_RIGHT. Most of the time this is not necessary,
it's just for stuff where a label is followed by a different print,
like "Font: " followed by the font name, time trial time displays, etc
2024-01-08 19:17:44 -08:00
Dav999
3588168c4d Right-align textboxes in RTL languages
Most of this diff is just moving some existing code around, and
changing inline things to variables that could be changed more easily.
2024-01-08 19:17:44 -08:00
Dav999
27e83b6008 Add font::is_rtl(uint32_t flags)
This will return if the given flags indicate RTL properties
(such as textboxes being right-aligned).
2024-01-08 19:17:44 -08:00
Dav999
ed0c9b6b1f Add setrtl(on/off) scripting command
With the <font> tag (which doesn't indicate RTL-ness as explained),
we've had a setfont(font) scripting command. Now we have an <rtl>
tag, so we need a setrtl(on/off) command too to control that.
2024-01-08 19:17:44 -08:00
Dav999
29e2b19698 Add RTL level property and print flag
Again, the RTL property controls whether textboxes will be
right-aligned, and that kind of stuff. It can't be font-bound, since
Space Station supports Hebrew characters and we want to be able to
support, say, a Hebrew translation or Hebrew levels in the future
without having to make a dedicated (or duplicated) font for it.
Therefore it's a property of both the language pack as well as custom
levels - like custom levels already had a <font> tag, they now also
have an <rtl> tag that sets this property.

Right now, we'll have to hardcode it so the menu option for the Arabic
font sets the <rtl> property to 1, and all the other options set it to
0. But it's future-proof in that we can later decide to split the
option for Space Station into an LTR option and an RTL option (so both
"english/..." and "עברית" would select Space Station, but one sets the
RTL property to 0 and the other sets it to 1).
2024-01-08 19:17:44 -08:00
Dav999
37c4f76988 Add RTL language property
This doesn't have an effect yet, but it'll do things like
right-alignment in textboxes and other design-flipping.
2024-01-08 19:17:44 -08:00
Dav999
2003eed2a5 Hide unicode directional control characters
They shouldn't be looked up in the font and displayed under any
circumstances.
2024-01-08 19:17:44 -08:00