Skip to content

Add an About Page to the Intro Menu

willow edited this page Dec 18, 2024 · 4 revisions

This tutorial shows how to add a custom "About" page to the intro menu (i.e. alongside CONTINUE, NEW GAME, OPTIONS). You can use this to describe the changes in your romhack, list credits, etc.

pokecrystal11-5 pokecrystal11-3

This is a relatively simple edit, mostly reusing the code from Oak's speech in the beginning of the game. Because of this, text will be limited to the standard dialog box format.

Contents

  1. Adding the Menu Item
  2. Creating the About Page function
  3. Writing the text itself

1. Adding the Menu Item

To add an entry for an "About" page to the main menu, edit engine/menus/main_menu.asm.

First, we need to create a constant for the About page in the MAINMENUITEM_ list, and update the numbering in the comments if you deire.

; ...
	const MAINMENU_MYSTERY_STUDIUM        ; 7
	const MAINMENU_STUDIUM                ; 8

	; MainMenu.Strings and MainMenu.Jumptable indexes
	const_def
	const MAINMENUITEM_CONTINUE       ; 0
	const MAINMENUITEM_NEW_GAME       ; 1
	const MAINMENUITEM_OPTION         ; 2
-	const MAINMENUITEM_MYSTERY_GIFT   ; 3
-	const MAINMENUITEM_MOBILE         ; 4
-	const MAINMENUITEM_MOBILE_STUDIUM ; 5
-	const MAINMENUITEM_DEBUG_ROOM     ; 6
+	const MAINMENUITEM_ABOUT          ; 3
+	const MAINMENUITEM_MYSTERY_GIFT   ; 4
+	const MAINMENUITEM_MOBILE         ; 5
+	const MAINMENUITEM_MOBILE_STUDIUM ; 6
+	const MAINMENUITEM_DEBUG_ROOM     ; 7

Next, we need to add the strings and jumptable entries for this:

; ...

.Strings:
; entries correspond to MAINMENUITEM_* constants
	db "CONTINUE@"
	db "NEW GAME@"
	db "OPTIONS@"
+	db "ABOUT@"
	db "MYSTERY GIFT@"
	db "MOBILE@"
	db "MOBILE STUDIUM@"
if DEF(_DEBUG)
	db "DEBUG ROOM@"
endc

.Jumptable:
; entries correspond to MAINMENUITEM_* constants
	dw MainMenu_Continue
	dw MainMenu_NewGame
	dw MainMenu_Option
+	dw MainMenu_About
	dw MainMenu_MysteryGift
	dw MainMenu_Mobile
	dw MainMenu_MobileStudium
if DEF(_DEBUG)
	dw MainMenu_DebugRoom
endc

The next step is actually adding this entry to the different menu item lists, and updating their item count.

The game stores multiple possible lists of menu items, to account for the availability of the mystery gift or mobile menu items, so you will need to update each possible list you want the About page to show up in. For the purposes of this tutorial, only the edits to the standard two menu lists (with and without CONTINUE) will be shown.

pokecrystal11-0 pokecrystal11-5

Still in engine/menus/main_menu.asm, edit:

; ...

	; MAINMENU_NEW_GAME
-	db 2
+	db 3
	db MAINMENUITEM_NEW_GAME
	db MAINMENUITEM_OPTION
+	db MAINMENUITEM_ABOUT
	db -1

	; MAINMENU_CONTINUE
-	db 3 + DEF(_DEBUG)
+	db 4 + DEF(_DEBUG)
	db MAINMENUITEM_CONTINUE
	db MAINMENUITEM_NEW_GAME
	db MAINMENUITEM_OPTION
+	db MAINMENUITEM_ABOUT
if DEF(_DEBUG)
	db MAINMENUITEM_DEBUG_ROOM
endc

Lastly, we need to call the about page function itself.

; ...

MainMenu_Option:
	farcall Option
	ret

+MainMenu_About:
+	farcall AboutSpeech
+	ret
+
MainMenu_Continue:
	farcall Continue
	ret

2. Creating the About Page function

Next, we need to actually write the code to display a sprite and show the about text. Edit engine/menus/intro_menu.asm, adding a new function at the end:

; ...

+AboutSpeech:
+	call ClearTilemap
+
+       ; prepare for sprite display
+       call RotateThreePalettesRight
+	ld a, MILTANK ; change this to show a different pokemon
+	ld [wCurSpecies], a
+	ld [wCurPartySpecies], a
+	call GetBaseData
+	hlcoord 6, 4
+	call PrepMonFrontpic
+	xor a
+	ld [wTempMonDVs], a
+	ld [wTempMonDVs + 1], a
+	ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
+	call GetSGBLayout
+	call Intro_WipeInFrontpic ; actually display the sprite
+
+       ; Display text
+	ld hl, AboutText1
+	call PrintText
+	ret

If you want multiple text segments, with a changing pokemon sprite between them, you will need to add those sections as well.

        ; Display text
        ld hl, AboutText1
 	call PrintText
+
+       ; prepare for second sprite display
+       call ClearTilemap
+       call RotateThreePalettesRight
+	ld a, TOGEPI ; change this to show a different pokemon
+	ld [wCurSpecies], a
+	ld [wCurPartySpecies], a
+	call GetBaseData
+	hlcoord 6, 4
+	call PrepMonFrontpic
+	xor a
+	ld [wTempMonDVs], a
+	ld [wTempMonDVs + 1], a
+	ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
+	call GetSGBLayout
+	call Intro_WipeInFrontpic ; actually display the sprite
+
+       ; Display second text
+	ld hl, AboutText2
+	call PrintText
	ret

Next, we need to create references for the text that will be displayed. After the above function, add the following:

+
+AboutText1:
+	text_far _AboutText1
+	text_end
+
+; for multiple pages:
+AboutText2:
+	text_far _AboutText2
+	text_end

This code is adapted from the OakSpeech: function in intro_menu.asm. If you want to display a different kind of sprite, like professor oak, use that function for reference.

3. Writing the text itself

Finally, we need to define the actual text that will be written.

I put my text at the end of data/text/common_2.asm, like the normal Oak introduction speech text, but you are welcome to put it anywhere text is stored.

; ...

+_AboutText1::
+	text "changes made by"
+	line "willow:"
+
+	para "- player is always"
+	line "  a girl"
+
+	para "- different"
+	line "  starter <PKMN>"
+
+       prompt

If you want multiple text segments, with a changing pokemon sprite between them, you will need to define them as well.

; ...

+_AboutText2::
+	text "changes copied"
+	line "from others:"
+
+	para "BUGFIX X from"
+	line "source Y, on"
+       cont "the Z discord."
+
+       prompt

pokecrystal11-1 pokecrystal11-4

Clone this wiki locally