Dimedime-d / kptranslation

English translation of the GBA game Kururin Paradise

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dynamic intro cutscene script location

Dimedime-d opened this issue · comments

The way I laid my custom code out to add variable width/auto-center text is the following:

  • Where the original Japanese text was at offset, add a pointer to English text elsewhere in the ROM. The script parser iterates through each character here.
  • At offset + 4, add a pointer to where the in-game script parser should resume execution.

This is done in nextscriptpointer.asm. Both of these partially overwrite Japanese text and leave some unused bytes interlaced between where the script parser reads the data. Also, as my pointer fixes in nextscriptpointer.asm affect every script in the game, this causes the game to softlock in any other cutscene that loads dialogue, as I haven't put in any English text there yet.

I would rather have the script parser read English text directly, without having to point to any text. This would improve the locality of my text relative to the cutscene data and also not have the unused bytes.

However, English text takes more bytes to represent than Japanese characters, which is why I added pointers to English text in the first place.

I would need to determine at what offsets does the intro cutscene start and end, and copy most of this script-code into some free space, where I can freely add my English text between the script-codes.

My PR not only moves the intro cutscene data elsewhere, but also frees up the space of the original intro cutscene data.

This turned out to be tricker than expected, because the script parser also reads pointers in the original cutscene data to jump around in. I have gone through the entire intro cutscene data and replaced these static pointers with dynamic armips ones. The intro cutscene should still work fine, regardless of whether I delete the original intro cutscene data or where I put my intro cutscene data.

Also, as I'm now inserting the intro text using armips + my table file, Atlas is no longer needed for inserting dialogue (though I am still using it for menu descriptions).

As this is the approach I've decided to take, this would require going through every other cutscene data, adjusting local pointers, and placing it at an arbitrary location in the ROM.