2018-06-24 07:09:41 -07:00
|
|
|
_NameRater:
|
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
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall SelectMonFromParty
|
2015-07-19 01:58:31 -07:00
|
|
|
jr c, .cancel
|
|
|
|
; He can't rename an egg...
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartySpecies]
|
2013-09-09 13:09:34 -07:00
|
|
|
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
|
2018-01-23 14:39:09 -08:00
|
|
|
; Load the new nickname into wStringBuffer2
|
2015-10-07 18:27:32 -07:00
|
|
|
xor a ; PARTYMON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wMonType], a
|
|
|
|
ld a, [wCurPartySpecies]
|
2018-07-28 16:27:34 -07:00
|
|
|
ld [wNamedObjectIndexBuffer], a
|
2018-01-23 14:39:09 -08:00
|
|
|
ld [wCurSpecies], a
|
2013-09-09 13:09:34 -07:00
|
|
|
call GetBaseData
|
2018-09-16 13:02:58 -07:00
|
|
|
ld b, NAME_MON
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wStringBuffer2
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall _NamingScreen
|
2015-07-19 01:58:31 -07:00
|
|
|
; 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
|
2018-01-23 14:39:09 -08:00
|
|
|
; Copy the new name from wStringBuffer2
|
|
|
|
ld hl, wPartyMonNicknames
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2013-09-09 13:09:34 -07:00
|
|
|
call AddNTimes
|
|
|
|
ld e, l
|
|
|
|
ld d, h
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wStringBuffer2
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_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
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CheckIfMonIsYourOT:
|
2018-01-23 14:39:09 -08:00
|
|
|
; Checks to see if the partymon loaded in [wCurPartyMon] has the different OT as you. Returns carry if not.
|
|
|
|
ld hl, wPartyMonOT
|
2014-06-12 18:32:42 -07:00
|
|
|
ld bc, NAME_LENGTH
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2013-09-09 13:09:34 -07:00
|
|
|
call AddNTimes
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wPlayerName
|
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
|
|
|
|
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wPartyMon1ID
|
2015-11-04 08:19:58 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2013-09-09 13:09:34 -07:00
|
|
|
call AddNTimes
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wPlayerID
|
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
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
IsNewNameEmpty:
|
2018-01-23 14:39:09 -08:00
|
|
|
; Checks to see if the nickname loaded in wStringBuffer2 is empty. If so, return carry.
|
|
|
|
ld hl, wStringBuffer2
|
2018-01-20 09:25:55 -08:00
|
|
|
ld c, MON_NAME_LENGTH - 1
|
2015-07-19 01:58:31 -07:00
|
|
|
.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
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CompareNewToOld:
|
2018-01-23 14:39:09 -08:00
|
|
|
; Compares the nickname in wStringBuffer2 to the previous nickname. If they are the same, return carry.
|
|
|
|
ld hl, wPartyMonNicknames
|
2018-01-20 09:25:55 -08:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2018-01-23 14:39:09 -08:00
|
|
|
ld a, [wCurPartyMon]
|
2013-09-09 13:09:34 -07:00
|
|
|
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
|
2018-01-23 14:39:09 -08:00
|
|
|
ld hl, wStringBuffer2
|
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
|
2018-01-23 14:39:09 -08:00
|
|
|
ld de, wStringBuffer2
|
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
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetNicknameLength:
|
2015-07-19 01:58:31 -07:00
|
|
|
; 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
|
2018-01-20 09:25:55 -08:00
|
|
|
cp MON_NAME_LENGTH - 1
|
2015-07-19 01:58:31 -07:00
|
|
|
jr nz, .loop
|
2013-09-09 13:09:34 -07:00
|
|
|
ret
|
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
NameRaterIntroText:
|
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?
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far UnknownText_0x1c0043
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
NameRaterWhichMonText:
|
2013-09-09 13:09:34 -07:00
|
|
|
; Which #MON's nickname should I rate for you?
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far UnknownText_0x1c00a0
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
NameRaterIsGoodText:
|
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?
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far UnknownText_0x1c00cd
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
NameRaterWhichNameText:
|
2013-09-09 13:09:34 -07:00
|
|
|
; All right. What name should we give it, then?
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far UnknownText_0x1c0142
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
NameRaterEvenBetterText:
|
2013-09-09 13:09:34 -07:00
|
|
|
; That's a better name than before! Well done!
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far UnknownText_0x1c0171
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
NameRaterCancelText:
|
2013-09-09 13:09:34 -07:00
|
|
|
; OK, then. Come again sometime.
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far UnknownText_0x1c019e
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
NameRaterTradedText:
|
2013-09-09 13:09:34 -07:00
|
|
|
; Hm… @ ? What a great name! It's perfect.
|
|
|
|
; Treat @ with loving care.
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far UnknownText_0x1c01be
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
NameRaterEggText:
|
2013-09-09 13:09:34 -07:00
|
|
|
; Whoa… That's just an EGG.
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far UnknownText_0x1c0208
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
NameRaterSameAsBeforeText:
|
2015-07-19 01:58:31 -07:00
|
|
|
; It might look the different as before,
|
2013-09-09 13:09:34 -07:00
|
|
|
; but this new name is much better! Well done!
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far UnknownText_0x1c0222
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|
2013-09-09 13:09:34 -07:00
|
|
|
|
2018-06-24 17:10:37 -07:00
|
|
|
NameRaterDoneText:
|
2013-09-09 13:09:34 -07:00
|
|
|
; All right. This #MON is now named @ .
|
2018-10-28 09:16:55 -07:00
|
|
|
text_far UnknownText_0x1c0272
|
2018-11-17 10:33:03 -08:00
|
|
|
text_end
|