piratesephiroth / LaMulanaScript

A tool to decode and encode the "script_code" file of the La-Mulana remake.
MIT License
1 stars 0 forks source link

Is possible add new characters to the game? #1

Open kaioloureiro opened 2 years ago

kaioloureiro commented 2 years ago

I'm trying to translate the game to portuguese, but when I try to add a new character, such as an "á", the in-game character appears with a blank space after it.

piratesephiroth commented 2 years ago

yes, you have to add then to the sheets as well.

Here's one example where I added characters from other languages pt.zip

kaioloureiro commented 2 years ago

Yeah, I know, but inside the game these new characters appears with a " " right after them, like shown below. It should be written "Ah, então você não quer?", instead of "Ah, entã o você nã o quer?". I need to solve it.

lm

piratesephiroth commented 2 years ago

Ah, you have to set the width in grif.dat. I haven't made a tool for that but here's the one for the font I made

grif.zip

kaioloureiro commented 2 years ago

Thank you! Worked smoothly. I think that your font has all the characters I need, but in case I need add something more in the future, can you teach me how to set the width on the grif.dat, please?

piratesephiroth commented 2 years ago

grif.dat is structured like I wrote in the readme. It's a sequence of 16-bit values, big endian. The first value contains the glyph count, the rest contains some properties for each glyph:

  1. The first byte is the horizontal offset (how many pixels to move to the right, if the image doesn't start right at the border of the 21x21 zone)
  2. The second byte is the width of the character.

Here's some notes I kept here to help me edit the files:

To calculate char index from fontChars.txt:
index = count all selected chars up to the one you want - line breaks (each line break counts as 2 characters if using windows format)

To calculate the pixel position of the character in font00 from the index:
    x = (index % 48) * 21
    y = (index / 48) * 21

To calculate the index from pixel position in font00
    index = (x / 21) + ((y / 21) * 48)
kaioloureiro commented 2 years ago

I wasn't able to edit it. How can I open the grif.dat file and make these changes? The script doesn't do that.

piratesephiroth commented 2 years ago

yeah, as I said, I didn't make a tool for that. You'll have to use a hex editor, like HxD image

Specifically for editing grif.dat, you could set the byte group size to 2, to make it a bit easier to visualize. image

Hexaae commented 10 months ago

Here's one example where I added characters from other languages pt.zip ... Ah, you have to set the width in grif.dat. I haven't made a tool for that but here's the one for the font I made

grif.zip

🙏🏻Please do it... would be very helpful to solve many annoyances in some cases 😊

EDIT: however... in the end I was able to correctly add some Italian missing accented vowels for the intro/menu font, hex-editing the grif.dat. The original explanation wasn't that clear to me... so I suggest in addition to what's been said above:

image