-
Notifications
You must be signed in to change notification settings - Fork 811
Name the rival during the intro
Generation 2 made it so that the player's rival gets named early on in the game, unlike the Generation 1 games, which had it as part of the intro lecture. The goal of this tutorial is to port the latter sequence to Crystal, where the rival would have three predefined names, and the option to give him a unique name.
Edit engine/menus/intro_menu.asm:
ld hl, OakText6
call PrintText
call NamePlayer
ld hl, OakText7
call PrintText
+ call RotateThreePalettesRight
+ call ClearTilemap
+
+ xor a
+ ld [wCurPartySpecies], a
+ ld a, RIVAL1
+ ld [wTrainerClass], a
+ call Intro_PrepTrainerPic
+
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
+ call GetSGBLayout
+ call Intro_RotatePalettesLeftFrontpic
+
+ ld hl, OakText8
+ call PrintText
+ call NameRivalIntro
+ ld hl, OakText9
+ call PrintText
+ call RotateThreePalettesRight
+ call ClearTilemap
+
+ xor a
+ ld [wCurPartySpecies], a
+ farcall DrawIntroPlayerPic
+
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
+ call GetSGBLayout
+ call Intro_RotatePalettesLeftFrontpic
+ ld hl, OakText10
+ call PrintText
ret
We want to assign some new text entries to Prof.Oak for the expanded intro sequence. We'll go about adding the text later, now let's stick to defining the new strings we'll be needing:
OakText7:
text_far _OakText7
text_end
+OakText8:
+ text_far _OakText8
+ text_end
+
+OakText9:
+ text_far _OakText9
+ text_end
+
+OakText10:
+ text_far _OakText10
+ text_end
Now let's add the remainder of the code:
.Chris:
db "CHRIS@@@@@@"
.Kris:
db "KRIS@@@@@@@"
+NameRivalIntro:
+ farcall MovePlayerPicRight
+ call ShowRivalNamingChoices
+ ld a, [wMenuCursorY]
+ dec a
+ jr z, .NewName
+ call StoreRivalName
+ farcall ApplyMonOrTrainerPals
+ farcall MovePlayerPicLeft
+ ret
+
+.NewName:
+ ld b, NAME_RIVAL
+ ld de, wRivalName
+ farcall NamingScreen
+
+ call RotateThreePalettesRight
+ call ClearTilemap
+
+ call LoadFontsExtra
+ call WaitBGMap
+
+ xor a
+ ld [wCurPartySpecies], a
+ ld a, RIVAL1
+ ld [wTrainerClass], a
+ call Intro_PrepTrainerPic
+
+ ld b, SCGB_TRAINER_OR_MON_FRONTPIC_PALS
+ call GetSGBLayout
+ call RotateThreePalettesLeft
+
+ ld hl, wRivalName
+ ld de, RivalNames
+ call InitName
+ ret
+
+.RivalName:
+ db "SILVER@@@@@"
+
+ShowRivalNamingChoices:
+ ld hl, RivalNameMenuHeaderIntro
+ call LoadMenuHeader
+ call VerticalMenu
+ ld a, [wMenuCursorY]
+ dec a
+ call CopyNameFromMenu
+ call CloseWindow
+ ret
+
+RivalNameMenuHeaderIntro:
+ db MENU_BACKUP_TILES ; flags
+ menu_coords 0, 0, 10, TEXTBOX_Y - 1
+ dw .Names
+ db 1 ; default option
+ db 0 ; ????
+
+.Names:
+ db STATICMENU_CURSOR | STATICMENU_PLACE_TITLE | STATICMENU_DISABLE_B ; flags
+ db 5 ; items
+ db "NEW NAME@"
+RivalNames:
+ db "SILVER@"
+ db "KAMON@"
+ db "OSCAR@"
+ db "MAX@"
+ db 2 ; title indent
+ db " NAME @" ; title
StorePlayerName:
ld a, "@"
ld bc, NAME_LENGTH
ld hl, wPlayerName
call ByteFill
ld hl, wPlayerName
ld de, wStringBuffer2
call CopyName2
ret
+StoreRivalName:
+ ld a, "@"
+ ld bc, NAME_LENGTH
+ ld hl, wRivalName
+ call ByteFill
+ ld hl, wRivalName
+ ld de, wStringBuffer2
+ call CopyName2
+ ret
Now let's add what Prof.Oak will be saying when it'll be time to give the rival a name. Edit data/text/common_3.asm:
_OakText6::
text "Now, what did you"
line "say your name was?"
prompt
_OakText7::
+ text "Right! So your"
+ line "name is <PLAYER>!"
+ prompt
+
+_OakText8::
+ text "That boy has been"
+ line "hanging around my"
+ cont "lab lately."
+
+ para "Do you know him?"
+ line "What's his name?"
+ prompt
+
+_OakText9::
+ text "Oh, so his name is"
+ line "<RIVAL> then!"
+ prompt
+
+_OakText10::
text "<PLAYER>, are you"
line "ready?"
para "Your very own"
line "#MON story is"
cont "about to unfold."
para "You'll face fun"
line "times and tough"
cont "challenges."
para "A world of dreams"
line "and adventures"
para "with #MON"
line "awaits! Let's go!"
para "I'll be seeing you"
line "later!"
done
And now we're all set!
Of course, this tutorial assumes that your hack will feature a new story. Otherwise, the only other changes required would be rewriting the officer cutscene in maps/ElmsLab.asm, and updating the rival's post-battle dialogue in maps/CherrygroveCity.asm, since it uses ???
instead of <RIVAL>
.