Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String Variables: Operate on Codepoints #3303

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Nov 24, 2024

Updated the test game by @enewey to use extended latin characters like é everywhere:

https://easyrpg.org/play/pr3303/?game=string-var

In UTF-8 they require 2 bytes and 1 codepoint.

Correct is using 1 codepoint here (which matches the legacy encoding = 1 byte)

For あ it is 3 bytes UTF-8 or 1 codepoint. When running in shift-jis RPG_RT seems to use a multibyte character so it also reports 1. There is no shift-jis case in the project but I tested this locally.

Sooo we are just extremely lucky here that it just works even though our encoding is completely different :)

Code that relies on wchar_t was only activated on Windows because of broken toolchains that lack wchar_t.

I reenabled the code now for all platforms. Lets see if it works this time.
This matches the Maniac Patch behaviour better and is actually much better than using bytes.

For e.g. Latin1 (Western European) MP works with 1 Byte per char and for shift-jis (Japanese) MP works with multi-byte characters (2 bytes per character).

When using Unicode both cases map to 1 codepoint so we are very lucky here: It just works.

Fix EasyRPG#3298
Support left-adjust for PrependMin
Support indexing from the back with negative values

Fix EasyRPG#3305
@Ghabry
Copy link
Member Author

Ghabry commented Nov 25, 2024

I handle now the edge cases for out of bounds values.

Also supports left-adjust now when "AdjustMin" value is negative and indexing from the back when the index is negative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants