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

2794 commits

Author SHA1 Message Date
Dav999
ef712f9f0c Add support for Arabic reshaping
This code can probably be polished a bit more, but the hard part is
over!

This part was written with guidance of this code:
https://github.com/TerryCavanagh/hx_arabic_shaper
2024-01-08 19:17:44 -08:00
Dav999
e011273eb3 Add Arabic reshaping lookup table
This adds the lookup table and an accompanying hashmap that will be
used for reshaping Arabic - it's not yet used though.
2024-01-08 19:17:44 -08:00
Dav999
59ccdbea00 Implement bidi reordering at display time
I'm now using SheenBidi to reorder RTL and bidirectional text properly
at text rendering time! For Arabic this is still missing reshaping, but
everything's looking really promising now!

The code changes are really non-invasive. The changes to Font.cpp are
absolutely minimal:

     1305+    if (bidi_should_transform(text))
     1306+    {
     1307+        text = bidi_transform(text);
     1308+    }

There's now a FontBidi.cpp, which implements these two functions,
notably bidi_transform(), which takes a UTF-8 encoded string and
returns another UTF-8 encoded string that has bidi reorderings and
reshapings applied.

In that function, SheenBidi gives us information about where in the
input string runs start and end, and on a basic level, all we need to
do there is to concatenate the parts together in the order that we're
given them, and to reverse the RTL runs (recognizable by odd levels).

As this is a proof-of-concept, bidi_should_transform() still always
returns true, applying the bidi algorithm to all languages and all
strings. I'm thinking of enabling bidi only when the language/font
metadata enables RTL (which could be for the interface or for a custom
level), or outside of that, at least when RTL characters are detected
(such as Arabic or Hebrew Unicode blocks).
2024-01-08 19:17:44 -08:00
Dav999
5766e6c426 Add SheenBidi to CMakeLists
Not much to see here, just making sure SheenBidi is compiled with the
game and we can include its headers.
2024-01-08 19:17:44 -08:00
Dav999
a9a1d7e1d6 Add SheenBidi submodule
I'm going to give it a shot to use this for bidi text support, it looks
like it's a pretty lightweight, compatible and low-dependency library
which is definitely a plus. We'll still need to do reshaping ourselves,
but that's the easy part compared to bidi.
2024-01-08 19:17:44 -08:00
AllyTally
8af57a072a Fix another incorrect autotile 2024-01-08 13:17:59 -08:00
TerryCavanagh
6e436880ab minor fix to Portuguese (pt)
from translator's reply to Kokasgui's feedback
2024-01-08 16:07:27 +01:00
Misa
47eb7acb44 Only trigger CI workflows for code or CI changes
This makes it so that the main CI workflow will only trigger if a change
is made to a code file in desktop_version/ (as the CI is only for
desktop_version/), or if the CI file itself is changed.

The CI workflow for Android will only trigger if Android-specific code
_could have_ changed. This includes all code that is definitely
Android-specific (e.g. Java files), but also C/C++ files that have
__ANDROID__ ifdefs.

Unfortunately, it's not possible to reuse the same list of paths across
two different event trigger types[1]. So we have to copy-paste here.

[1]: https://github.com/orgs/community/discussions/37645
2024-01-07 17:27:37 -08:00
Dav999
5f7cb46a35 Remove hair spaces from Japanese translation
I had added 1px spaces in some Japanese strings with buttons in them,
to avoid the button glyphs touching the rest of the text. However, the
Japanese translator later ended up putting full spaces in, not noticing
the hair spaces. So now the space was 1 pixel wider than it should've
been, and it's better to remove them.
2024-01-07 16:31:42 -08:00
Misa
4922fa4599 Disable debugger logic when not active
This fixes a bug where you could still drag an entity around with the
debugger inactive if you were holding the entity while disabling the
debugger with Y. Furthermore, you couldn't even drop the entity even if
you wanted to.
2024-01-06 20:51:59 -08:00
Misa
9e2d6e921c Fix clash between Gravitron start text and timer
There is a clash between the timer text and the "Survive for 60
seconds!" text. It's minor in English but it can be worse in other
languages (e.g. Polish).

So make the timer go away when that text is onscreen.
2024-01-06 20:38:25 -08:00
Misa
44fb76ba90 Fix clash between timer and return editor text
The "[Press {button} to return to editor]" and the "TIME:" text
overlapped, which resulted in an ugly clash.

To fix this, make the return editor text take priority over the timer
text. This involves a minor refactor to first calculate whether or not
we should draw the return editor text before we check if we should draw
the timer text.
2024-01-06 15:45:40 -08:00
Dav999
f4bdea7d6d Add a system for selecting between wordy/wordy2
Some languages have different spellings of wordy numbers based on the
gender of the things they're counting (uno crewmate versus una trinket)
or what a number's role is in the sentence (e.g. twenta out of twentu).
We've always had the idea we couldn't support such complex differences
though, because the game can't be adapted to know what gender each
object will have and what word classes might exist in other languages,
so translators would in those cases just have to forgo the wordy
numbers and just let the game use "20 out of 20".

A solution we came up semi-recently though (after all translations were
finished except for Arabic), was to allow the translator to define
however many classes of wordy numbers they need, and fill them all out.
This would not need the game to be *adapted* for every language's
specific grammar and word genders/classes. Instead, the translator
would just choose their correct self-defined class at the time they use
`wordy` in the VFormat placeholder. Something like
{n|wordy|class=feminine}, or {n|wordy_feminine}.

So this would benefit several languages, but we came up with the
solution a little late for all languages to benefit from it. The Arabic
translators asked for two separate classes of wordy numbers though, so
my plan is to first just have a second list of wordy numbers
(translation2 in numbers.xml), which can be accessed by passing the
`wordy2` flag to VFormat, instead of `wordy`.

Once 2.4 is released, we can take our time to do it properly. This
would involve the ability for translators to define however many
classes they need, to name them what they want, and this name would
then be useable in VFormat placeholders. We can convert all existing
translations to have one class defined by default, such as "wordy", or
"translation" depending on implementation, but there's not so much
concern for maintaining backwards compatibility here, so we can do a
mass-switchover for all language files. That said, it wouldn't be too
hard to add a special case for "translation" being "wordy" either.
We can then ask translators if they would like to change anything with
the new system in place.

For now, we can use this system for Arabic, maybe Spanish since there
were complaints about uno/una, and *maybe* Dutch (it has a thing where
the number "one" is often capitalized differently, but it's not
mandatory per se)
2024-01-06 14:11:40 -08:00
Dav999
ce1327f37a Enable SDL_HINT_IME_SHOW_UI to make typing CJK not guesswork
For some reason, the default behavior of SDL and/or Windows(?) (I only
tested this on Windows) seems to result in the fact that if any SDL app
doesn't account for it, there is no way for Japanese and Chinese
speakers to know what they're typing in.

How IMEs are supposed to work is that you can type words as sort of
WIP versions, and then select out of a list of candidates what the
final result should be. The app may display the WIP text and tell the
IME where the text field is so that the IME's menu can be displayed
around it. But if the app doesn't say where the text field is, then the
candidate list can also be displayed at the corner of the screen, which
is done in Minecraft.

By default, however, SDL apps don't get a candidate list at all, which
means you're basically flying blind as to what you're typing in, and
you would have to basically open notepad and copy-paste everything from
there - unless I'm missing something.

This commit sets the SDL_HINT_IME_SHOW_UI hint (added in SDL 2.0.18
apparently), so that the candidate list is at least shown in the corner.
We can probably deal with positioning and uncommitted text later.
2024-01-05 15:24:27 -08:00
Misa
95c6dc58d3 Fix TAB bind conflict with translator & debugger
The TAB bind is used in both roomname translator mode and the level
debugger. To fix this, the TAB keybind will prioritize roomname
translator mode, unless the debugger text is enabled (with the Y
keybind), in which case the debugger takes priority. Additionally, the
roomname translator text will not render when the debugger text is
shown.

Fixes #1094.
2024-01-05 11:42:10 -08:00
Terry Cavanagh
7bd281ee3d updated credits to include the Eternal Dream Arabization team 2024-01-04 16:29:01 +01:00
Misa
fc51c2219d README: Reword to "Viki", wordwrap line 2024-01-02 15:33:35 -08:00
TerryCavanagh
eb13e7962a updated Italian localisation credits 2024-01-02 22:27:05 +01:00
Terry Cavanagh
e99c2b7487 reverted note at end of desktop_version/Readme about data.zip and distribution 2024-01-02 22:27:05 +01:00
Terry Cavanagh
8683a9f853 Fixed broken table in License exceptions.md 2024-01-02 22:27:05 +01:00
Terry Cavanagh
e71c8714ba Added a link in the readme directly to the desktop_version folder 2024-01-02 22:27:05 +01:00
Terry Cavanagh
f1a5857ffb Update README.md
general cleanup, added a link to Misa's very helpful guide on the vsix wiki
2024-01-02 22:27:05 +01:00
Terry Cavanagh
49df15ebb5 added translators to main readme 2024-01-02 22:27:05 +01:00
Terry Cavanagh
d94328c6cc added localisation credits to repo 2024-01-02 22:27:05 +01:00
Terry Cavanagh
d6a8858643 Update readme.MD 2024-01-02 22:27:05 +01:00
Terry Cavanagh
da2573f87a Update readme.MD 2024-01-02 22:27:05 +01:00
Terry Cavanagh
41a605f8e6 Update readme.MD
typo
2024-01-02 22:27:05 +01:00
Terry Cavanagh
06f4c7efea Update LICENSE.md
typo
2024-01-02 22:27:05 +01:00
Terry Cavanagh
f175b52d55 Update License exceptions.md
general cleanup, made the Make and Play exception clearer
2024-01-02 22:27:05 +01:00
Terry Cavanagh
5bf313afa7 Update LICENSE.md
Just added a quick paragraph at the top summarising the rules
2024-01-02 22:27:05 +01:00
Terry Cavanagh
fde9882402 Update README.md
- Added a logo
 - Cleaned up the description, answering the number one question I get asked about the source code
 - Added link to the discord to direct potential contributors to
 - Updated credits
 - fixed some links in the credits (Magnus' site is currently down, but this is temporary)
2024-01-02 22:27:05 +01:00
TerryCavanagh
7a569deabe Update logo.gif 2024-01-02 22:27:05 +01:00
TerryCavanagh
6fab933683 Create logo.gif 2024-01-02 22:27:05 +01:00
Misa
b4579d88d3 Add SimpleMessageBox for early filesystem bail
This ensures that the game won't silently fail to start if it can't
initialize the filesystem. Instead, it will fail loudly by popping open
a message box (using SDL_ShowSimpleMessageBox).

The motivation for this comes from issue #1010 where this is likely to
occur if the user has Controlled Folder Access enabled on Windows, but I
didn't want to put in the work to specifically detect CFA (and not sure
if it's even possible if it turns out that the OS just gives a standard
"permission denied" in this case). At least any message box is better
than silently failing but printing to console when most users don't know
what a console is.

Fixes #1010.
2023-12-31 16:54:53 -08:00
Reese Rivers
76882e9a13 Update "It's Not Easy Being Green" Esperanto roomname translation 2023-12-30 11:37:43 -08:00
Misa
e318d6f176 Fix regression: Tower BG lerps in reverse direction
This is the same as commit 70357a65bf
("Fix regression: Warp BG lerps in reverse direction"), but for the
tower background.

This bug is most visible when moving the camera in a tower using
invincibility, or holding down ACTION during the credits scroll.
2023-12-29 14:11:08 -08:00
Misa
e6b1b54214 Add a fast-forward keybind to level debugger
This lets you hold down F to fast-forward the game if you have the level
debugger interface open (with Y) and the game isn't paused.

This is most useful for quickly skipping through cutscenes to test
something.
2023-12-29 13:56:30 -08:00
Misa
b8fdbe53b9 Fix loading plain font.png Unicode indexing out of bounds
This code was introduced by Dav999 in
abf12632bb (PR #1077), but it contains a
memory error. I spotted this with Valgrind.

The problem comes from the fact that `max_codepoint` is calculated from
the width and height of the surface (which will have the same width and
height as the source `font.png` from the filesystem). Let's work through
an example using a typical 128 by 128 `font.png` and an 8 by 8 glyph.

`chars_per_line` is calculated by dividing the width of the image
(`temp_surface->w`, or 128) by `f->glyph_w` (8), yielding 16.
`max_codepoint` is calculated by first calculating the height of the
image divided by the height of the glyph - which here just happens to be
the same as `chars_per_line` (16) since we have a square `font.png` -
and then multiplying the result by `chars_per_line`. 16 times 16 is 256.

Now it is important to recognize here that this is the _amount_ of
glyphs in `font.png`. It is _not_ the last codepoint in the image. To
see why, consider the fact that codepoint 0 is contained in the image.
If we have codepoint 0, then we can't have codepoint 256, because that
would imply that we have 257 codepoints, but clearly, we don't. If we
try to read codepoint 256, then after working through the calculations
to read the glyphs, we would be trying to read from pixel columns 0
through 7 and pixel rows 128 through 135... in a 128 by 128 image...
which is clearly incorrect.

Therefore, it's incorrect to write the upper bound of the for-loop
iterating over every codepoint as `codepoint <= max_codepoint` instead
of `codepoint < max_codepoint`.
2023-12-29 11:55:09 -08:00
Misa
6f435661e7 Add inbounds pixel assertion to DrawPixel/ReadPixel
I was running the game through Valgrind and I noticed a memory error
where the game was attempting to read a pixel that was just outside the
image. Since this is an error that doesn't immediately result in a
segfault, I figured that it would be prudent to put in an assertion to
make it loud and clear that a memory error is, in fact, happening here.

Similarly, drawing to a pixel just outside the surface wouldn't result
in a crash, so I copy-pasted the check there too (with changes).
2023-12-29 11:54:19 -08:00
AllyTally
e1e5e43089 Fix another incorrect tile in autotiler 2023-12-24 12:39:22 -08:00
AllyTally
1d130acc20 Fix resizing the map not changing the current room
If you're in (5, 5) (1-indexed) and you resize the map to (4,5), the
editor stays in (5, 5). This has no real consequences, other than
possibly confusing the user, but it should probably be fixed anyway.
2023-12-24 12:36:16 -08:00
Dav999
a97ba5e768 Fix minor [Press ACTION to save your game] overflow in German
Turns out the string I fixed in the previous commit was also never
noticed in German. For that one, I simply used the wording that was
used in the old hardcoded-ACTION string (with my German knowledge,
I'm confident that's still correct).
2023-12-23 10:50:12 -08:00
Dav999
1dc7ed4d65 Fix minor [Press ACTION to save your game] overflow in Turkish
When ACTION is filled in, the closing ] will go offscreen.
To fix it, I simply removed the square brackets.
2023-12-23 10:50:12 -08:00
Ethan Lee
148b518745
Steam now shares device info with SDL! 2023-12-20 23:17:28 -05:00
TerryCavanagh
30c9438f17 minor fixes for Spanish 2023-12-18 16:59:12 +01:00
Dav999
827417fec8 Restore gravity/warp lines sticking out a tile offscreen
I just discovered this: whereas 2.3 and older versions make gravity
and warp lines - when placed in the editor - stick out one tile
offscreen, the latest version stops the lines at the room border.

This change restores the old behavior, and it's a simple fix: the
refactored code was written to let tiles outside the room block
gravity/warp lines. Instead of all offscreen tiles blocking lines, now
there's a 1-tile padding around the room that will let them through.
2023-12-15 20:03:34 -08:00
Dav999
82aef30649 Minor indentation style fix in Render.cpp
This used 2-space indentation for one level, as well as }else{ on a
single line.
2023-12-15 20:00:05 -08:00
Dav999
e638544665 Add limits to the translator credits strings
Luckily, seems like no language has broken the limit when it is 40!
2023-12-15 20:00:05 -08:00
Dav999
bf85e10219 Try to prevent some lines in rolling credits going offscreen
The new localization-related credits are placed 5 characters from
the left border in the rolling credits (at x=40), which means the
limit was 35 8x8 characters. Which was broken by several languages.
So instead, move the string leftward a bit if it would run offscreen
otherwise.
2023-12-15 20:00:05 -08:00
Dav999
c1fea5f55a Fix current_credits_list_index not always being reset
If you go into the middle of the list of translators in the main menu
credits, then press Escape, and then go into the credits again, the
first page of the list may start at the wrong place, because while
game.translator_credits_pagenum was reset to 0,
game.current_credits_list_index wasn't. This is fixed now.
2023-12-15 20:00:05 -08:00