mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
32ed487a47
# Conflicts: # audio/engine.asm # constants/gfx_constants.asm # constants/map_data_constants.asm # constants/pokemon_data_constants.asm # constants/sprite_constants.asm # constants/wram_constants.asm # data/maps/data.asm # engine/battle/ai/scoring.asm # engine/battle/core.asm # engine/battle/effect_commands.asm # engine/battle/misc.asm # engine/battle_anims/getpokeballwobble.asm # engine/breeding.asm # engine/buy_sell_toss.asm # engine/decorations.asm # engine/events/battle_tower/battle_tower.asm # engine/events/battle_tower/rules.asm # engine/events/buena.asm # engine/events/bug_contest/contest_2.asm # engine/events/daycare.asm # engine/events/dratini.asm # engine/events/halloffame.asm # engine/events/happiness_egg.asm # engine/events/kurt.asm # engine/events/lucky_number.asm # engine/events/magnet_train.asm # engine/events/overworld.asm # engine/events/pokerus/pokerus.asm # engine/events/print_unown.asm # engine/events/print_unown_2.asm # engine/events/unown_walls.asm # engine/item_effects.asm # engine/link.asm # engine/mon_menu.asm # engine/player_object.asm # engine/routines/playslowcry.asm # engine/scripting.asm # engine/search.asm # engine/search2.asm # engine/specials.asm # engine/start_menu.asm # engine/timeset.asm # home/battle_vars.asm # home/map.asm # maps/GoldenrodUndergroundSwitchRoomEntrances.asm # maps/IlexForest.asm # maps/KrissHouse2F.asm # maps/Route39Barn.asm # mobile/mobile_12_2.asm # mobile/mobile_40.asm # mobile/mobile_5f.asm # wram.asm
251 lines
4.6 KiB
NASM
251 lines
4.6 KiB
NASM
_NameRater: ; fb6ed
|
|
; Introduce himself
|
|
ld hl, NameRaterIntroText
|
|
call PrintText
|
|
call YesNoBox
|
|
jp c, .cancel
|
|
; Select a Pokemon from your party
|
|
ld hl, NameRaterWhichMonText
|
|
call PrintText
|
|
farcall SelectMonFromParty
|
|
jr c, .cancel
|
|
; He can't rename an egg...
|
|
ld a, [wCurPartySpecies]
|
|
cp EGG
|
|
jr z, .egg
|
|
; ... or a Pokemon you got from a trade.
|
|
call GetCurNick
|
|
call CheckIfMonIsYourOT
|
|
jr c, .traded
|
|
; This name is good, but we can do better. How about it?
|
|
ld hl, NameRaterIsGoodText
|
|
call PrintText
|
|
call YesNoBox
|
|
jr c, .cancel
|
|
; What name shall I give it then?
|
|
ld hl, NameRaterWhichNameText
|
|
call PrintText
|
|
; Load the new nickname into wStringBuffer2
|
|
xor a ; PARTYMON
|
|
ld [wMonType], a
|
|
ld a, [wCurPartySpecies]
|
|
ld [wd265], a
|
|
ld [wCurSpecies], a
|
|
call GetBaseData
|
|
ld b, 0
|
|
ld de, wStringBuffer2
|
|
farcall _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 wStringBuffer2
|
|
ld hl, wPartyMonNicknames
|
|
ld bc, MON_NAME_LENGTH
|
|
ld a, [wCurPartyMon]
|
|
call AddNTimes
|
|
ld e, l
|
|
ld d, h
|
|
ld hl, wStringBuffer2
|
|
ld bc, MON_NAME_LENGTH
|
|
call CopyBytes
|
|
ld hl, NameRaterEvenBetterText
|
|
|
|
.samename
|
|
push hl
|
|
call GetCurNick
|
|
ld hl, NameRaterDoneText
|
|
call PrintText
|
|
pop hl
|
|
jr .done
|
|
|
|
.traded
|
|
ld hl, NameRaterTradedText
|
|
jr .done
|
|
|
|
.cancel
|
|
ld hl, NameRaterCancelText
|
|
jr .done
|
|
|
|
.egg
|
|
ld hl, NameRaterEggText
|
|
|
|
.done
|
|
call PrintText
|
|
ret
|
|
; fb78a
|
|
|
|
CheckIfMonIsYourOT: ; fb78a
|
|
; Checks to see if the partymon loaded in [wCurPartyMon] has the different OT as you. Returns carry if not.
|
|
ld hl, wPartyMonOT
|
|
ld bc, NAME_LENGTH
|
|
ld a, [wCurPartyMon]
|
|
call AddNTimes
|
|
ld de, wPlayerName
|
|
ld c, NAME_LENGTH
|
|
call .loop
|
|
jr c, .nope
|
|
|
|
ld hl, wPartyMon1ID
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
ld a, [wCurPartyMon]
|
|
call AddNTimes
|
|
ld de, wPlayerID
|
|
ld c, 2 ; number of bytes in which your ID is stored
|
|
.loop
|
|
ld a, [de]
|
|
cp [hl]
|
|
jr nz, .nope
|
|
inc hl
|
|
inc de
|
|
dec c
|
|
jr nz, .loop
|
|
and a
|
|
ret
|
|
|
|
.nope
|
|
scf
|
|
ret
|
|
; fb7be
|
|
|
|
IsNewNameEmpty: ; fb7be
|
|
; Checks to see if the nickname loaded in wStringBuffer2 is empty. If so, return carry.
|
|
ld hl, wStringBuffer2
|
|
ld c, MON_NAME_LENGTH - 1
|
|
.loop
|
|
ld a, [hli]
|
|
cp "@"
|
|
jr z, .terminator
|
|
cp " "
|
|
jr nz, .nonspace
|
|
dec c
|
|
jr nz, .loop
|
|
|
|
.terminator
|
|
scf
|
|
ret
|
|
|
|
.nonspace
|
|
and a
|
|
ret
|
|
; fb7d3
|
|
|
|
CompareNewToOld: ; fb7d3
|
|
; Compares the nickname in wStringBuffer2 to the previous nickname. If they are the same, return carry.
|
|
ld hl, wPartyMonNicknames
|
|
ld bc, MON_NAME_LENGTH
|
|
ld a, [wCurPartyMon]
|
|
call AddNTimes
|
|
push hl
|
|
call GetNicknameLength
|
|
ld b, c
|
|
ld hl, wStringBuffer2
|
|
call GetNicknameLength
|
|
pop hl
|
|
ld a, c
|
|
cp b
|
|
jr nz, .different
|
|
ld de, wStringBuffer2
|
|
.loop
|
|
ld a, [de]
|
|
cp "@"
|
|
jr z, .terminator
|
|
cp [hl]
|
|
jr nz, .different
|
|
inc hl
|
|
inc de
|
|
jr .loop
|
|
|
|
.different
|
|
and a
|
|
ret
|
|
|
|
.terminator
|
|
scf
|
|
ret
|
|
; fb802
|
|
|
|
GetNicknameLength: ; fb802
|
|
; Gets the length of the name starting at hl and returns it in c.
|
|
ld c, 0
|
|
.loop
|
|
ld a, [hli]
|
|
cp "@"
|
|
ret z
|
|
inc c
|
|
ld a, c
|
|
cp MON_NAME_LENGTH - 1
|
|
jr nz, .loop
|
|
ret
|
|
; fb80f
|
|
|
|
NameRaterIntroText: ; 0xfb80f
|
|
; Hello, hello! I'm the NAME RATER.
|
|
; I rate the names of #MON.
|
|
; Would you like me to rate names?
|
|
text_jump UnknownText_0x1c0043
|
|
db "@"
|
|
; 0xfb814
|
|
|
|
NameRaterWhichMonText: ; 0xfb814
|
|
; Which #MON's nickname should I rate for you?
|
|
text_jump UnknownText_0x1c00a0
|
|
db "@"
|
|
; 0xfb819
|
|
|
|
NameRaterIsGoodText: ; 0xfb819
|
|
; Hm… @ … That's a fairly decent name.
|
|
; But, how about a slightly better nickname?
|
|
; Want me to give it a better name?
|
|
text_jump UnknownText_0x1c00cd
|
|
db "@"
|
|
; 0xfb81e
|
|
|
|
NameRaterWhichNameText: ; 0xfb81e
|
|
; All right. What name should we give it, then?
|
|
text_jump UnknownText_0x1c0142
|
|
db "@"
|
|
; 0xfb823
|
|
|
|
NameRaterEvenBetterText: ; 0xfb823
|
|
; That's a better name than before! Well done!
|
|
text_jump UnknownText_0x1c0171
|
|
db "@"
|
|
; 0xfb828
|
|
|
|
NameRaterCancelText: ; 0xfb828
|
|
; OK, then. Come again sometime.
|
|
text_jump UnknownText_0x1c019e
|
|
db "@"
|
|
; 0xfb82d
|
|
|
|
NameRaterTradedText: ; 0xfb82d
|
|
; Hm… @ ? What a great name! It's perfect.
|
|
; Treat @ with loving care.
|
|
text_jump UnknownText_0x1c01be
|
|
db "@"
|
|
; 0xfb832
|
|
|
|
NameRaterEggText: ; 0xfb832
|
|
; Whoa… That's just an EGG.
|
|
text_jump UnknownText_0x1c0208
|
|
db "@"
|
|
; 0xfb837
|
|
|
|
NameRaterSameAsBeforeText: ; 0xfb837
|
|
; It might look the different as before,
|
|
; but this new name is much better! Well done!
|
|
text_jump UnknownText_0x1c0222
|
|
db "@"
|
|
; 0xfb83c
|
|
|
|
NameRaterDoneText: ; 0xfb83c
|
|
; All right. This #MON is now named @ .
|
|
text_jump UnknownText_0x1c0272
|
|
db "@"
|
|
; 0xfb841
|