2013-09-09 13:09:34 -07:00
|
|
|
NameRater: ; fb6ed
|
2015-07-19 01:58:31 -07:00
|
|
|
; Introduce himself
|
|
|
|
ld hl, NameRaterIntroText
|
2013-09-09 13:09:34 -07:00
|
|
|
call PrintText
|
2013-12-03 23:49:12 -08:00
|
|
|
call YesNoBox
|
2015-07-19 01:58:31 -07:00
|
|
|
jp c, .cancel
|
|
|
|
; Select a Pokemon from your party
|
|
|
|
ld hl, NameRaterWhichMonText
|
2013-09-09 13:09:34 -07:00
|
|
|
call PrintText
|
2015-07-19 01:58:31 -07:00
|
|
|
callba SelectMonFromParty
|
|
|
|
jr c, .cancel
|
|
|
|
; He can't rename an egg...
|
2013-09-09 13:09:34 -07:00
|
|
|
ld a, [CurPartySpecies]
|
|
|
|
cp EGG
|
2015-07-19 01:58:31 -07:00
|
|
|
jr z, .egg
|
|
|
|
; ... or a Pokemon you got from a trade.
|
2013-09-09 13:09:34 -07:00
|
|
|
call GetCurNick
|
2015-07-19 01:58:31 -07:00
|
|
|
call CheckIfMonIsYourOT
|
|
|
|
jr c, .traded
|
|
|
|
; This name is good, but we can do better. How about it?
|
|
|
|
ld hl, NameRaterIsGoodText
|
2013-09-09 13:09:34 -07:00
|
|
|
call PrintText
|
2013-12-03 23:49:12 -08:00
|
|
|
call YesNoBox
|
2015-07-19 01:58:31 -07:00
|
|
|
jr c, .cancel
|
|
|
|
; What name shall I give it then?
|
|
|
|
ld hl, NameRaterWhichNameText
|
2013-09-09 13:09:34 -07:00
|
|
|
call PrintText
|
2015-07-19 01:58:31 -07:00
|
|
|
; Load the new nickname into StringBuffer2
|
2015-10-07 18:27:32 -07:00
|
|
|
xor a ; PARTYMON
|
2013-09-09 13:09:34 -07:00
|
|
|
ld [MonType], a
|
|
|
|
ld a, [CurPartySpecies]
|
2015-02-10 15:32:30 -08:00
|
|
|
ld [wd265], a
|
2013-09-09 13:09:34 -07:00
|
|
|
ld [CurSpecies], a
|
|
|
|
call GetBaseData
|
|
|
|
ld b, 0
|
|
|
|
ld de, StringBuffer2
|
2015-07-19 01:58:31 -07:00
|
|
|
callba _NamingScreen
|
|
|
|
; If the new name is empty, treat it as unchanged.
|
|
|
|
call IsNewNameEmpty
|
|
|
|
ld hl, NameRaterSameAsBeforeText
|
|
|
|
jr c, .samename
|
|
|
|
; If the new name is the same as the old name, treat it as unchanged.
|
|
|
|
call CompareNewToOld
|
|
|
|
ld hl, NameRaterSameAsBeforeText
|
|
|
|
jr c, .samename
|
|
|
|
; Copy the new name from StringBuffer2
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, PartyMonNicknames
|
2015-07-19 01:58:31 -07:00
|
|
|
ld bc, PKMN_NAME_LENGTH
|
2013-09-09 13:09:34 -07:00
|
|
|
ld a, [CurPartyMon]
|
|
|
|
call AddNTimes
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
|
|
|
ld hl, StringBuffer2
|
2015-07-19 01:58:31 -07:00
|
|
|
ld bc, PKMN_NAME_LENGTH
|
2013-09-09 13:09:34 -07:00
|
|
|
call CopyBytes
|
2015-07-19 01:58:31 -07:00
|
|
|
ld hl, NameRaterEvenBetterText
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
.samename
|
2013-09-09 13:09:34 -07:00
|
|
|
push hl
|
|
|
|
call GetCurNick
|
2015-07-19 01:58:31 -07:00
|
|
|
ld hl, NameRaterDoneText
|
2013-09-09 13:09:34 -07:00
|
|
|
call PrintText
|
|
|
|
pop hl
|
2015-07-19 01:58:31 -07:00
|
|
|
jr .done
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
.traded
|
|
|
|
ld hl, NameRaterTradedText
|
|
|
|
jr .done
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
.cancel
|
|
|
|
ld hl, NameRaterCancelText
|
|
|
|
jr .done
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
.egg
|
|
|
|
ld hl, NameRaterEggText
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
.done
|
2013-09-09 13:09:34 -07:00
|
|
|
call PrintText
|
|
|
|
ret
|
|
|
|
; fb78a
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
CheckIfMonIsYourOT: ; fb78a
|
|
|
|
; Checks to see if the partymon loaded in [CurPartyMon] has the different OT as you. Returns carry if not.
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, PartyMonOT
|
|
|
|
ld bc, NAME_LENGTH
|
2013-09-09 13:09:34 -07:00
|
|
|
ld a, [CurPartyMon]
|
|
|
|
call AddNTimes
|
|
|
|
ld de, PlayerName
|
2014-06-12 18:32:42 -07:00
|
|
|
ld c, NAME_LENGTH
|
2015-07-19 01:58:31 -07:00
|
|
|
call .loop
|
|
|
|
jr c, .nope
|
|
|
|
|
2013-09-09 13:09:34 -07:00
|
|
|
ld hl, PartyMon1ID
|
|
|
|
ld bc, PartyMon2 - PartyMon1
|
|
|
|
ld a, [CurPartyMon]
|
|
|
|
call AddNTimes
|
|
|
|
ld de, PlayerID
|
2015-07-19 01:58:31 -07:00
|
|
|
ld c, 2 ; number of bytes in which your ID is stored
|
|
|
|
.loop
|
2013-09-09 13:09:34 -07:00
|
|
|
ld a, [de]
|
|
|
|
cp [hl]
|
2015-07-19 01:58:31 -07:00
|
|
|
jr nz, .nope
|
2013-09-09 13:09:34 -07:00
|
|
|
inc hl
|
|
|
|
inc de
|
|
|
|
dec c
|
2015-07-19 01:58:31 -07:00
|
|
|
jr nz, .loop
|
2013-09-09 13:09:34 -07:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
.nope
|
2013-09-09 13:09:34 -07:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; fb7be
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
IsNewNameEmpty: ; fb7be
|
|
|
|
; Checks to see if the nickname loaded in StringBuffer2 is empty. If so, return carry.
|
2013-09-09 13:09:34 -07:00
|
|
|
ld hl, StringBuffer2
|
2015-07-19 01:58:31 -07:00
|
|
|
ld c, PKMN_NAME_LENGTH - 1
|
|
|
|
.loop
|
2013-09-09 13:09:34 -07:00
|
|
|
ld a, [hli]
|
|
|
|
cp "@"
|
2015-07-19 01:58:31 -07:00
|
|
|
jr z, .terminator
|
2013-09-09 13:09:34 -07:00
|
|
|
cp " "
|
2015-07-19 01:58:31 -07:00
|
|
|
jr nz, .nonspace
|
2013-09-09 13:09:34 -07:00
|
|
|
dec c
|
2015-07-19 01:58:31 -07:00
|
|
|
jr nz, .loop
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
.terminator
|
2013-09-09 13:09:34 -07:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
.nonspace
|
2013-09-09 13:09:34 -07:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
; fb7d3
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
CompareNewToOld: ; fb7d3
|
|
|
|
; Compares the nickname in StringBuffer2 to the previous nickname. If they are the same, return carry.
|
2014-06-12 18:32:42 -07:00
|
|
|
ld hl, PartyMonNicknames
|
2015-07-19 01:58:31 -07:00
|
|
|
ld bc, PKMN_NAME_LENGTH
|
2013-09-09 13:09:34 -07:00
|
|
|
ld a, [CurPartyMon]
|
|
|
|
call AddNTimes
|
|
|
|
push hl
|
2015-07-19 01:58:31 -07:00
|
|
|
call GetNicknameLength
|
2013-09-09 13:09:34 -07:00
|
|
|
ld b, c
|
|
|
|
ld hl, StringBuffer2
|
2015-07-19 01:58:31 -07:00
|
|
|
call GetNicknameLength
|
2013-09-09 13:09:34 -07:00
|
|
|
pop hl
|
|
|
|
ld a, c
|
|
|
|
cp b
|
2015-07-19 01:58:31 -07:00
|
|
|
jr nz, .different
|
2013-09-09 13:09:34 -07:00
|
|
|
ld de, StringBuffer2
|
2015-07-19 01:58:31 -07:00
|
|
|
.loop
|
2013-09-09 13:09:34 -07:00
|
|
|
ld a, [de]
|
|
|
|
cp "@"
|
2015-07-19 01:58:31 -07:00
|
|
|
jr z, .terminator
|
2013-09-09 13:09:34 -07:00
|
|
|
cp [hl]
|
2015-07-19 01:58:31 -07:00
|
|
|
jr nz, .different
|
2013-09-09 13:09:34 -07:00
|
|
|
inc hl
|
|
|
|
inc de
|
2015-07-19 01:58:31 -07:00
|
|
|
jr .loop
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
.different
|
2013-09-09 13:09:34 -07:00
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
.terminator
|
2013-09-09 13:09:34 -07:00
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; fb802
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
GetNicknameLength: ; fb802
|
|
|
|
; Gets the length of the name starting at hl and returns it in c.
|
2013-09-09 13:09:34 -07:00
|
|
|
ld c, 0
|
2015-07-19 01:58:31 -07:00
|
|
|
.loop
|
2013-09-09 13:09:34 -07:00
|
|
|
ld a, [hli]
|
|
|
|
cp "@"
|
|
|
|
ret z
|
|
|
|
inc c
|
|
|
|
ld a, c
|
2015-07-19 01:58:31 -07:00
|
|
|
cp PKMN_NAME_LENGTH - 1
|
|
|
|
jr nz, .loop
|
2013-09-09 13:09:34 -07:00
|
|
|
ret
|
|
|
|
; fb80f
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
NameRaterIntroText: ; 0xfb80f
|
2013-09-09 13:09:34 -07:00
|
|
|
; Hello, hello! I'm the NAME RATER.
|
|
|
|
; I rate the names of #MON.
|
|
|
|
; Would you like me to rate names?
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c0043
|
2013-09-09 13:09:34 -07:00
|
|
|
db "@"
|
|
|
|
; 0xfb814
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
NameRaterWhichMonText: ; 0xfb814
|
2013-09-09 13:09:34 -07:00
|
|
|
; Which #MON's nickname should I rate for you?
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c00a0
|
2013-09-09 13:09:34 -07:00
|
|
|
db "@"
|
|
|
|
; 0xfb819
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
NameRaterIsGoodText: ; 0xfb819
|
2013-09-09 13:09:34 -07:00
|
|
|
; Hm… @ … That's a fairly decent name.
|
|
|
|
; But, how about a slightly better nickname?
|
|
|
|
; Want me to give it a better name?
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c00cd
|
2013-09-09 13:09:34 -07:00
|
|
|
db "@"
|
|
|
|
; 0xfb81e
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
NameRaterWhichNameText: ; 0xfb81e
|
2013-09-09 13:09:34 -07:00
|
|
|
; All right. What name should we give it, then?
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c0142
|
2013-09-09 13:09:34 -07:00
|
|
|
db "@"
|
|
|
|
; 0xfb823
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
NameRaterEvenBetterText: ; 0xfb823
|
2013-09-09 13:09:34 -07:00
|
|
|
; That's a better name than before! Well done!
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c0171
|
2013-09-09 13:09:34 -07:00
|
|
|
db "@"
|
|
|
|
; 0xfb828
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
NameRaterCancelText: ; 0xfb828
|
2013-09-09 13:09:34 -07:00
|
|
|
; OK, then. Come again sometime.
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c019e
|
2013-09-09 13:09:34 -07:00
|
|
|
db "@"
|
|
|
|
; 0xfb82d
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
NameRaterTradedText: ; 0xfb82d
|
2013-09-09 13:09:34 -07:00
|
|
|
; Hm… @ ? What a great name! It's perfect.
|
|
|
|
; Treat @ with loving care.
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c01be
|
2013-09-09 13:09:34 -07:00
|
|
|
db "@"
|
|
|
|
; 0xfb832
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
NameRaterEggText: ; 0xfb832
|
2013-09-09 13:09:34 -07:00
|
|
|
; Whoa… That's just an EGG.
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c0208
|
2013-09-09 13:09:34 -07:00
|
|
|
db "@"
|
|
|
|
; 0xfb837
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
NameRaterSameAsBeforeText: ; 0xfb837
|
|
|
|
; It might look the different as before,
|
2013-09-09 13:09:34 -07:00
|
|
|
; but this new name is much better! Well done!
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c0222
|
2013-09-09 13:09:34 -07:00
|
|
|
db "@"
|
|
|
|
; 0xfb83c
|
|
|
|
|
2015-07-19 01:58:31 -07:00
|
|
|
NameRaterDoneText: ; 0xfb83c
|
2013-09-09 13:09:34 -07:00
|
|
|
; All right. This #MON is now named @ .
|
2013-12-01 14:54:09 -08:00
|
|
|
text_jump UnknownText_0x1c0272
|
2013-09-09 13:09:34 -07:00
|
|
|
db "@"
|
|
|
|
; 0xfb841
|