Code to display scenes with custom backgrounds and text; ideal for cinematics.
Requirements (Windows):
- DevkitPro/ARM (https://devkitpro.org/wiki/Getting_Started/devkitARM windows installer here)
- Visual C++ runtime DLL https://www.microsoft.com/en-ca/download/details.aspx?id=48145
Make sure you have an environment variable for "DEVKITARM". If not, create them.
Next, place a clean FireRed US version 1.0 ROM and rename it to "BPRE0.gba".
Modify line 7 of "main.s" .org 0x08800000 and enter the offset where you want the system to be inserted. Remember, it must be an offset that ends in 0, 4, 8, or C.
Open Cygwin and navigate to the project folder. Now we can build the project by running make.
If the last line is Build Complete then everything succeeded.
A new rom named Show Backgroud.gba should have appeared in the directory build
- To display the scenes, simply create a script with the following lines of code:
special 6
It is worth noting that the system is designed to continue the script after displaying the scene, so you can either continue the script or end it with end.
To edit the texts to be displayed in Scene 0, simply open the show_background.c file and modify the texts in sText_Scene0_Text0, sText_Scene0_Text1, and sText_Scene0_Text2.
Then, edit the array static const u8 *const TextsScene0[] if necessary to remove or add new phrases.
To add new scenes, a few additional steps are required:
-
Have the Tilesets (bg.png and sprite.png) and Tilemaps (bg.bin and sprite.bin) for both the background and the sprite to be displayed in the scene. The background must use palette 0, and the sprite must use palette 1. The Tilesets should be indexed to 16 colors with transparency in the first slot of the palette. Create a folder with the scene index in
graphics/show_background/, for example:graphics/show_background/scene_1for Scene 1, and include the Tilesets and Tilemaps for that scene. -
Open the
Makefilewith a plain text editor like Notepad++, for example, and add the following under thegraphics:section for Scene 1:
$(GFX) $(GRAPHICS)/show_bg/scene_1/bg.png $(GRAPHICS)/show_bg/scene_1/bg.4bpp
$(GFX) $(GRAPHICS)/show_bg/scene_1/bg.4bpp $(GRAPHICS)/show_bg/scene_1/bg.4bpp.lz
$(GFX) $(GRAPHICS)/show_bg/scene_1/bg.bin $(GRAPHICS)/show_bg/scene_1/bg.bin.lz
$(GFX) $(GRAPHICS)/show_bg/scene_1/sprite.png $(GRAPHICS)/show_bg/scene_1/sprite.gbapal
$(GFX) $(GRAPHICS)/show_bg/scene_1/sprite.png $(GRAPHICS)/show_bg/scene_1/sprite.4bpp
$(GFX) $(GRAPHICS)/show_bg/scene_1/sprite.4bpp $(GRAPHICS)/show_bg/scene_1/sprite.4bpp.lz
$(GFX) $(GRAPHICS)/show_bg/scene_1/sprite.bin $(GRAPHICS)/show_bg/scene_1/sprite.bin.lz```
**Note:** Repeat steps 1 and 2 to add more scenes, changing `scene_1` to `scene_2` and so on.
3. Open the `show_background.c` file and in the `// Graphics` section, add the following for Scene 1:
static const u32 sTilesBG_Scene1[] = INCBIN_U32("graphics/show_bg/scene_1/bg.4bpp.lz"); static const u32 sMapBG_Scene1[] = INCBIN_U32("graphics/show_bg/scene_1/bg.bin.lz"); static const u32 sTilesSprite_Scene1[] = INCBIN_U32("graphics/show_bg/scene_1/sprite.4bpp.lz"); static const u32 sMapSprite_Scene1[] = INCBIN_U32("graphics/show_bg/scene_1/sprite.bin.lz"); static const u16 sPalBG_Scene1[] = INCBIN_U16("graphics/show_bg/scene_1/bg.gbapal"); static const u16 sPalSprite_Scene1[] = INCBIN_U16("graphics/show_bg/scene_1/sprite.gbapal");
**Note:** Repeat this step to add more scenes, changing `Scene1` and `scene_1` to `Scene2` and `scene_2`, and so on.
4. In the arrays `static const void * BgsScenes[]`, `static const void * SpritesScenes[]`, and `static const void * PalettesScenes[]`,
add the Background (sTilesBG_Scene1 and sMapBG_Scene1), Sprite (sTilesSprite_Scene1 and sMapSprite_Scene1), and Palettes (sPalBG_Scene1 and sPalSprite_Scene1)
respectively, following Scene 0 as an example.
5. In the `// Texts` section, add new texts by changing the prefix `sText_Scene0` to `sText_Scene1` for Scene 1, to `sText_Scene2` for Scene 2, and so on.
6. Below the array `static const u8 *const TextsScene0`, create a new array for each new scene, using Scene 0 as an example. It is worth noting that
each scene can have its own unique number of texts.
7. In the array `static const struct SceneTexts TextAllScenes[]`, add the new text arrays for the new scenes, following the example of Scene 0.
Replace `TextsScene0` with `TextsScene1` and so on. Here’s how it would look if Scene 1 is added:
static const struct SceneTexts TextAllScenes[] = { { TextsScene0, NELEMS(TextsScene0) }, { TextsScene1, NELEMS(TextsScene1) }, };
8. Finally, recompile the system and configure the script to load Scene 1:
``` setvar 0x8000 1
special 6
Credits:
- CompuMax Developer
- https://github.com/Touched project structure
- https://github.com/pret string related tools and pokeemerald resources
- Wobb
- All contributors!