Add some naming screen stuff.

This commit is contained in:
IIMarckus 2013-05-12 18:36:40 -06:00
parent 5419d34a21
commit e7208f1964
3 changed files with 136 additions and 27 deletions

View File

@ -402,7 +402,7 @@ ParkBall: ; e8a2
pop hl
ld de, StringBuffer1
call $2ef9
call InitString
jp $6be2
@ -466,7 +466,7 @@ ParkBall: ; e8a2
ld hl, $b082
ld de, StringBuffer1
call $2ef9
call InitString
call CloseSRAM

147
main.asm
View File

@ -2421,7 +2421,36 @@ ObjectEventText:
db "@"
; 0x26f7
INCBIN "baserom.gbc", $26f7, $2bed-$26f7
INCBIN "baserom.gbc", $26f7, $2b74-$26f7
Function2b74: ; 0x2b74
push af
ld a, $1
ld [$c2ce], a
call WhiteBGMap
call ClearSprites
call $2bae
ld hl, $c590 ; tile 0, 12
ld bc, $0412
call TextBox
ld hl, VramState
set 0, [hl]
call $1ad2
call $3200
ld b, $9
call GetSGBLayout
ld a, $12
ld hl, $5409
rst $8
call $0485
call DelayFrame
ld a, $1
ld [$ffde], a
pop af
ret
; 0x2bae
INCBIN "baserom.gbc", $2bae, $2bed-$2bae
GetMapHeaderPointer: ; 0x2bed
; Prior to calling this function, you must have switched banks so that
@ -2707,7 +2736,54 @@ BitTableFunc: ; 0x2e76
ret
; 0x2ead
INCBIN "baserom.gbc", $2ead, $2f8c - $2ead
INCBIN "baserom.gbc", $2ead, $2ed3 - $2ead
Function2ed3: ; 0x2ed3
; disables overworld sprite updating?
xor a
ld [$ffde], a
ld a, [VramState]
res 0, a
ld [VramState], a
ld a, $0
ld [$c2ce], a
ret
; 0x2ee4
INCBIN "baserom.gbc", $2ee4, $2ef9 - $2ee4
InitString: ; 0x2ef9
; if the string pointed to by hl is empty (defined as "zero or more spaces
; followed by a null"), then initialize it to the string pointed to by de.
;
; Intended for names, so this function is limited to ten characters.
push hl
ld c, 10
push bc
.loop
ld a, [hli]
cp "@"
jr z, .blank
cp " "
jr nz, .notblank
dec c
jr nz, .loop
.blank
pop bc
ld l, e
ld h, d
pop de
ld b, $0
inc c
call CopyBytes
ret
.notblank
pop bc
pop hl
ret
; 0x2f17
INCBIN "baserom.gbc", $2f17, $2f8c - $2f17
RNG: ; 2f8c
; Two random numbers are generated by adding and subtracting
@ -4623,7 +4699,7 @@ OakSpeech: ; 0x5f99
ld [$d123], a
ld [$d124], a
ld b, $1c
call $3340
call GetSGBLayout
call $6182
ld hl, OakText2
call PrintText
@ -4637,7 +4713,7 @@ OakSpeech: ; 0x5f99
ld [TrainerClass], a
call $619c
ld b, $1c
call $3340
call GetSGBLayout
call $616a
ld hl, OakText5
call PrintText
@ -4649,7 +4725,7 @@ OakSpeech: ; 0x5f99
ld hl, $4874
rst $8
ld b, $1c
call $3340
call GetSGBLayout
call $616a
ld hl, OakText6
call PrintText
@ -5429,7 +5505,7 @@ SpecialsPointers: ; 0xc029
dbw $0b, $4547
dbw $05, $6218
dbw $23, $4c04
dbw $03, $429d
dbw BANK(SpecialNameRival), SpecialNameRival
dbw $24, $4913
dbw $03, $42c0
dbw $03, $42cd
@ -5445,7 +5521,7 @@ SpecialsPointers: ; 0xc029
dbw $23, $4079
dbw $23, $40ab
dbw $00, $0d91
dbw $00, $31f3
dbw BANK(WhiteBGMap), WhiteBGMap
dbw $00, $0485
dbw BANK(ClearTileMap), ClearTileMap
dbw $00, $1ad2
@ -5563,7 +5639,25 @@ SpecialsPointers: ; 0xc029
dbw $24, $4a88
dbw $03, $4224
INCBIN "baserom.gbc", $c224, $c3e2 - $c224
INCBIN "baserom.gbc", $c224, $c29d - $c224
SpecialNameRival: ; 0xc29d
ld b, $2 ; rival
ld de, WRivalName
ld a, BANK(Function116b7)
ld hl, Function116b7
rst $8
; default to "SILVER"
ld hl, WRivalName
ld de, DefaultRivalName
call InitString
ret
; 0xc2b2
DefaultRivalName: ; 0xc2b2
db "SILVER@"
INCBIN "baserom.gbc", $c2b9, $c3e2 - $c2b9
ScriptReturnCarry: ; c3e2
jr c, .carry
@ -6354,7 +6448,16 @@ TechnicalMachines: ; 0x1167a
db WHIRLPOOL
db WATERFALL
INCBIN "baserom.gbc", $116b3, $11ce7 - $116b3
INCBIN "baserom.gbc", $116b3, $116b7 - $116b3
Function116b7: ; 0x116b7
call Function2ed3
call $56c1
call $2b74
ret
; 0x116c1
INCBIN "baserom.gbc", $116c1, $11ce7 - $116c1
NameInputLower:
db "a b c d e f g h i"
@ -6691,7 +6794,7 @@ OpenPartyMenu: ; $12976
.choosemenu ; 1297f
xor a
ld [PartyMenuActionText], a ; Choose a POKéMON.
call $31f3 ; this is also a predef/special, something with delayframe
call WhiteBGMap
.menu ; 12986
ld a, $14
ld hl, $404f
@ -6790,7 +6893,7 @@ INCBIN "baserom.gbc", $12aec, $12e00 - $12aec
OpenPartyStats: ; 12e00
call $1d6e
call $300b
call ClearSprites
xor a
ld [MonType], a ; partymon
call LowVolume
@ -10122,7 +10225,7 @@ StatsScreenInit: ; 4dc8a
ld c, a
push bc
push hl
call $31f3
call WhiteBGMap
call ClearTileMap
call $1ad2
ld a, $3e
@ -10130,7 +10233,7 @@ StatsScreenInit: ; 4dc8a
rst FarCall ; this loads graphics
pop hl
call JpHl
call $31f3
call WhiteBGMap
call ClearTileMap
pop bc
; restore old values
@ -10361,7 +10464,7 @@ PartyMenuSelect: ; 0x50457
PrintPartyMenuText: ; 5049a
ld hl, $c5b8
ld bc, $0212
call $0fe8 ; related to TextBoxBorder
call TextBox
ld a, [PartyCount]
and a
jr nz, .haspokemon
@ -11249,7 +11352,7 @@ HallOfFame3: ; 0x8640e
push af
ld a, $1
ld [$c2cd], a
call $2ed3
call Function2ed3
ld a, $1
ld [$d4b5], a
@ -17033,8 +17136,8 @@ Function117a94: ; 0x117a94
ld [$cf64], a
ld [$cf65], a
ld [$cf66], a
call $31f3
call $300b
call WhiteBGMap
call ClearSprites
ld a, $5c
ld hl, $6e78
rst FarCall
@ -17045,8 +17148,8 @@ Function117a94: ; 0x117a94
; 0x117ab4
Function117ab4: ; 0x117ab4
call $31f3
call $300b
call WhiteBGMap
call ClearSprites
ld a, $5c
ld hl, $6e78
rst FarCall
@ -17070,8 +17173,8 @@ Function117acd: ; 0x117acd
rst FarCall
jr Function117acd
.asm_117ae2
call $31f3
call $300b
call WhiteBGMap
call ClearSprites
ret
Function117ae9: ; 0x117ae9
@ -17194,7 +17297,7 @@ Function117bb6:
ld a, $46
ld hl, $4284
rst FarCall
call $300b
call ClearSprites
ld a, [$c300]
and a
jr z, .asm_117be7 ; 0x117bca $1b

View File

@ -1408,10 +1408,16 @@ PlayerID: ; d47b
ds 2
PlayerName: ; d47d
ds 11
PlayerNameEnd: ; d478
PlayerNameEnd: ; d488
ds 11
WRivalName: ; d493
ds 11
WRivalNameEnd: ; d49e
ds 24
ds 46
; init time set at newgame
StartDay: ; d4b6
ds 1