Cleaning up static HRAM labels; movement stuff, route 38 trainers

This commit is contained in:
PikalaxALT 2015-11-09 23:01:45 -05:00
parent 77d0a8a396
commit f1b2466cc3
20 changed files with 483 additions and 373 deletions

View File

@ -26,7 +26,7 @@ _SoundRestart:: ; e8000
.clearsound .clearsound
; sound channel 1 2 3 4 ; sound channel 1 2 3 4
xor a xor a
ld [hli], a ; rNR10, $ff15, rNR30, $ff1f ; sweep = 0 ld [hli], a ; rNR10, rNR20, rNR30, rNR40 ; sweep = 0
ld [hli], a ; rNR11, rNR21, rNR31, rNR41 ; length/wavepattern = 0 ld [hli], a ; rNR11, rNR21, rNR31, rNR41 ; length/wavepattern = 0
ld a, $08 ld a, $08
@ -345,7 +345,7 @@ UpdateChannels: ; e8125
ld a, [rNR52] ld a, [rNR52]
and a, %10001101 ; ch2 off and a, %10001101 ; ch2 off
ld [rNR52], a ld [rNR52], a
ld hl, $ff15 ld hl, rNR20
call ClearChannel call ClearChannel
ret ret
.asm_e8204 .asm_e8204
@ -418,39 +418,39 @@ rept 4
endr endr
ld de, WaveSamples ld de, WaveSamples
add hl, de add hl, de
; load wavepattern into $ff30-$ff3f ; load wavepattern into rWave_0-rWave_f
ld a, [hli] ld a, [hli]
ld [$ff30], a ld [rWave_0], a
ld a, [hli] ld a, [hli]
ld [$ff31], a ld [rWave_1], a
ld a, [hli] ld a, [hli]
ld [$ff32], a ld [rWave_2], a
ld a, [hli] ld a, [hli]
ld [$ff33], a ld [rWave_3], a
ld a, [hli] ld a, [hli]
ld [$ff34], a ld [rWave_4], a
ld a, [hli] ld a, [hli]
ld [$ff35], a ld [rWave_5], a
ld a, [hli] ld a, [hli]
ld [$ff36], a ld [rWave_6], a
ld a, [hli] ld a, [hli]
ld [$ff37], a ld [rWave_7], a
ld a, [hli] ld a, [hli]
ld [$ff38], a ld [rWave_8], a
ld a, [hli] ld a, [hli]
ld [$ff39], a ld [rWave_9], a
ld a, [hli] ld a, [hli]
ld [$ff3a], a ld [rWave_a], a
ld a, [hli] ld a, [hli]
ld [$ff3b], a ld [rWave_b], a
ld a, [hli] ld a, [hli]
ld [$ff3c], a ld [rWave_c], a
ld a, [hli] ld a, [hli]
ld [$ff3d], a ld [rWave_d], a
ld a, [hli] ld a, [hli]
ld [$ff3e], a ld [rWave_e], a
ld a, [hli] ld a, [hli]
ld [$ff3f], a ld [rWave_f], a
pop hl pop hl
ld a, [wc293] ld a, [wc293]
and a, $f0 and a, $f0
@ -475,7 +475,7 @@ endr
ld a, [rNR52] ld a, [rNR52]
and a, %10000111 ; ch4 off and a, %10000111 ; ch4 off
ld [rNR52], a ld [rNR52], a
ld hl, $ff1f ld hl, rNR40
call ClearChannel call ClearChannel
ret ret
.asm_e82d4 .asm_e82d4
@ -3179,12 +3179,12 @@ endr
; e8ffe ; e8ffe
ClearChannel: ; e8ffe ClearChannel: ; e8ffe
; input: hl = beginning hw sound register (rNR10, $ff15, rNR30, $ff1f) ; input: hl = beginning hw sound register (rNR10, rNR20, rNR30, rNR40)
; output: 00 00 80 00 80 ; output: 00 00 80 00 80
; sound channel 1 2 3 4 ; sound channel 1 2 3 4
xor a xor a
ld [hli], a ; rNR10, $ff15, rNR30, $ff1f ; sweep = 0 ld [hli], a ; rNR10, rNR20, rNR30, rNR40 ; sweep = 0
ld [hli], a ; rNR11, rNR21, rNR31, rNR41 ; length/wavepattern = 0 ld [hli], a ; rNR11, rNR21, rNR31, rNR41 ; length/wavepattern = 0
ld a, $08 ld a, $08

View File

@ -5093,14 +5093,14 @@ DrawEnemyHUD: ; 3e043
rr a rr a
srl b srl b
rr a rr a
ld [$ffb6], a ld [hProduct + 3], a
ld a, b ld a, b
ld [$ffb5], a ld [hProduct + 2], a
.asm_3e105 .asm_3e105
ld a, [$ffb5] ld a, [hProduct + 2]
ld [hDividend + 0], a ld [hDividend + 0], a
ld a, [$ffb6] ld a, [hProduct + 3]
ld [hDividend + 1], a ld [hDividend + 1], a
ld a, $2 ld a, $2
ld b, a ld b, a
@ -7796,17 +7796,17 @@ Function3f0d4: ; 3f0d4
DoubleExp: ; 3f106 DoubleExp: ; 3f106
push bc push bc
ld a, [$ffb5] ld a, [hProduct + 2]
ld b, a ld b, a
ld a, [$ffb6] ld a, [hProduct + 3]
ld c, a ld c, a
srl b srl b
rr c rr c
add c add c
ld [$ffb6], a ld [hProduct + 3], a
ld a, [$ffb5] ld a, [hProduct + 2]
adc b adc b
ld [$ffb5], a ld [hProduct + 2], a
pop bc pop bc
ret ret
; 3f11b ; 3f11b
@ -7846,10 +7846,10 @@ Function3f136: ; 3f136
cp MAX_LEVEL cp MAX_LEVEL
jp nc, .asm_3f219 jp nc, .asm_3f219
ld a, [$ffb6] ld a, [hProduct + 3]
ld [wd004], a ld [wd004], a
push af push af
ld a, [$ffb5] ld a, [hProduct + 2]
ld [wd003], a ld [wd003], a
push af push af
xor a xor a
@ -7883,11 +7883,11 @@ endr
.asm_3f186 .asm_3f186
ld d, MAX_LEVEL ld d, MAX_LEVEL
callab CalcExpAtLevel callab CalcExpAtLevel
ld a, [hMultiplicand] ld a, [hProduct + 1]
ld b, a ld b, a
ld a, [$ffb5] ld a, [hProduct + 2]
ld c, a ld c, a
ld a, [$ffb6] ld a, [hProduct + 3]
ld d, a ld d, a
ld hl, TempMonExp + 2 ld hl, TempMonExp + 2
ld a, [hld] ld a, [hld]
@ -7958,9 +7958,9 @@ endr
call Function3f22c call Function3f22c
call Function3dfe call Function3dfe
pop af pop af
ld [$ffb5], a ld [hProduct + 2], a
pop af pop af
ld [$ffb6], a ld [hProduct + 3], a
.asm_3f219 .asm_3f219
pop bc pop bc
@ -8264,14 +8264,14 @@ Function3f39c: ; 3f39c
push af push af
inc d inc d
callab CalcExpAtLevel callab CalcExpAtLevel
ld hl, $ffb6 ld hl, hProduct + 3
ld a, [hl] ld a, [hl]
ld [$ffba], a ld [hPrintNum8], a
pop bc pop bc
sub b sub b
ld [hld], a ld [hld], a
ld a, [hl] ld a, [hl]
ld [$ffb9], a ld [hPrintNum7], a
pop bc pop bc
sbc b sbc b
ld [hld], a ld [hld], a
@ -8281,7 +8281,7 @@ Function3f39c: ; 3f39c
sbc b sbc b
ld [hl], a ld [hl], a
pop de pop de
ld hl, $ffb5 ld hl, hProduct + 2
ld a, [hli] ld a, [hli]
push af push af
ld a, [hl] ld a, [hl]
@ -8289,13 +8289,13 @@ Function3f39c: ; 3f39c
ld a, [de] ld a, [de]
dec de dec de
ld c, a ld c, a
ld a, [$ffba] ld a, [hPrintNum8]
sub c sub c
ld [hld], a ld [hld], a
ld a, [de] ld a, [de]
dec de dec de
ld b, a ld b, a
ld a, [$ffb9] ld a, [hPrintNum7]
sbc b sbc b
ld [hld], a ld [hld], a
ld a, [de] ld a, [de]
@ -9194,7 +9194,7 @@ endr
add hl, bc add hl, bc
dec d dec d
jr nz, .asm_3fa62 jr nz, .asm_3fa62
ld bc, $ffee ld bc, -18
add hl, bc add hl, bc
push hl push hl

View File

@ -1966,18 +1966,18 @@ BattleCommand_CheckHit: ; 34d32
ld a, [hQuotient + 1] ld a, [hQuotient + 1]
or b or b
jr nz, .asm_34ea2 jr nz, .asm_34ea2
ld [$ffb5], a ld [hQuotient + 1], a
ld a, $1 ld a, $1
ld [$ffb6], a ld [hQuotient + 2], a
.asm_34ea2 .asm_34ea2
ld b, c ld b, c
dec d dec d
jr nz, .asm_34e7a jr nz, .asm_34e7a
ld a, [$ffb5] ld a, [hQuotient + 1]
and a and a
ld a, [$ffb6] ld a, [hQuotient + 2]
jr z, .asm_34eaf jr z, .asm_34eaf
ld a, $ff ld a, $ff
@ -2683,7 +2683,7 @@ BattleCommand_RageDamage: ; 3527b
dec a dec a
add hl, bc add hl, bc
jr nc, .asm_35290 jr nc, .asm_35290
ld hl, $ffff ld hl, -1
.asm_3529a .asm_3529a
ld a, h ld a, h
ld [CurDamage], a ld [CurDamage], a
@ -3371,33 +3371,33 @@ BattleCommand_DamageCalc: ; 35612
; Selfdestruct and Explosion halve defense. ; Selfdestruct and Explosion halve defense.
cp EFFECT_EXPLOSION cp EFFECT_EXPLOSION
jr nz, .asm_35620 jr nz, .dont_explode
srl c srl c
jr nz, .asm_35620 jr nz, .dont_explode
inc c inc c
.asm_35620 .dont_explode
; Variable-hit moves and Conversion can have a power of 0. ; Variable-hit moves and Conversion can have a power of 0.
cp EFFECT_MULTI_HIT cp EFFECT_MULTI_HIT
jr z, .asm_3562b jr z, .skip_zero_damage_check
cp EFFECT_CONVERSION cp EFFECT_CONVERSION
jr z, .asm_3562b jr z, .skip_zero_damage_check
; No damage if move power is 0. ; No damage if move power is 0.
ld a, d ld a, d
and a and a
ret z ret z
.asm_3562b .skip_zero_damage_check
; Minimum defense value is 1. ; Minimum defense value is 1.
ld a, c ld a, c
and a and a
jr nz, .asm_35631 jr nz, .not_dividing_by_zero
ld c, 1 ld c, 1
.asm_35631 .not_dividing_by_zero
xor a xor a
ld hl, hDividend ld hl, hDividend
@ -3409,9 +3409,9 @@ endr
; Level * 2 ; Level * 2
ld a, e ld a, e
add a add a
jr nc, .asm_3563e jr nc, .level_not_overflowing
ld [hl], $1 ld [hl], $1
.asm_3563e .level_not_overflowing
inc hl inc hl
ld [hli], a ld [hli], a
@ -3493,44 +3493,44 @@ endr
; Update CurDamage (capped at 997). ; Update CurDamage (capped at 997).
ld hl, CurDamage ld hl, CurDamage
ld b, [hl] ld b, [hl]
ld a, [hQuotient + 2] ld a, [hProduct + 3]
add b add b
ld [$ffb6], a ld [hProduct + 3], a
jr nc, .asm_356a5 jr nc, .dont_cap_1
ld a, [hQuotient + 1] ld a, [hProduct + 2]
inc a inc a
ld [$ffb5], a ld [hProduct + 2], a
and a and a
jr z, .Cap jr z, .Cap
.asm_356a5 .dont_cap_1
ld a, [$ffb3] ld a, [hProduct]
ld b, a ld b, a
ld a, [$ffb4] ld a, [hProduct + 1]
or a or a
jr nz, .Cap jr nz, .Cap
ld a, [$ffb5] ld a, [hProduct + 2]
cp 998 / $100 cp 998 / $100
jr c, .asm_356bd jr c, .dont_cap_2
cp 998 / $100 + 1 cp 998 / $100 + 1
jr nc, .Cap jr nc, .Cap
ld a, [$ffb6] ld a, [hProduct + 3]
cp 998 % $100 cp 998 % $100
jr nc, .Cap jr nc, .Cap
.asm_356bd .dont_cap_2
inc hl inc hl
ld a, [$ffb6] ld a, [hProduct + 3]
ld b, [hl] ld b, [hl]
add b add b
ld [hld], a ld [hld], a
ld a, [$ffb5] ld a, [hProduct + 2]
ld b, [hl] ld b, [hl]
adc b adc b
ld [hl], a ld [hl], a
@ -3538,7 +3538,7 @@ endr
ld a, [hl] ld a, [hl]
cp 998 / $100 cp 998 / $100
jr c, .asm_356df jr c, .dont_cap_3
cp 998 / $100 + 1 cp 998 / $100 + 1
jr nc, .Cap jr nc, .Cap
@ -3546,7 +3546,7 @@ endr
inc hl inc hl
ld a, [hld] ld a, [hld]
cp 998 % $100 cp 998 % $100
jr c, .asm_356df jr c, .dont_cap_3
.Cap .Cap
ld a, 997 / $100 ld a, 997 / $100
@ -3555,15 +3555,15 @@ endr
ld [hld], a ld [hld], a
.asm_356df .dont_cap_3
; Minimum neutral damage is 2 (bringing the cap to 999). ; Minimum neutral damage is 2 (bringing the cap to 999).
inc hl inc hl
ld a, [hl] ld a, [hl]
add 2 add 2
ld [hld], a ld [hld], a
jr nc, .asm_356e7 jr nc, .dont_floor
inc [hl] inc [hl]
.asm_356e7 .dont_floor
ld a, 1 ld a, 1
and a and a
@ -3576,20 +3576,20 @@ endr
ret z ret z
; x2 ; x2
ld a, [$ffb6] ld a, [hQuotient + 2]
add a add a
ld [$ffb6], a ld [hProduct + 3], a
ld a, [$ffb5] ld a, [hQuotient + 1]
rl a rl a
ld [$ffb5], a ld [hProduct + 2], a
; Cap at $ffff. ; Cap at $ffff.
ret nc ret nc
ld a, $ff ld a, $ff
ld [$ffb5], a ld [hProduct + 2], a
ld [$ffb6], a ld [hProduct + 3], a
ret ret
; 35703 ; 35703
@ -3623,55 +3623,56 @@ BattleCommand_ConstantDamage: ; 35726
ld hl, BattleMonLevel ld hl, BattleMonLevel
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_35731 jr z, .got_turn
ld hl, EnemyMonLevel ld hl, EnemyMonLevel
.asm_35731 .got_turn
ld a, BATTLE_VARS_MOVE_EFFECT ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar call GetBattleVar
cp EFFECT_LEVEL_DAMAGE cp EFFECT_LEVEL_DAMAGE
ld b, [hl] ld b, [hl]
ld a, 0 ld a, 0
jr z, .asm_3578c jr z, .got_power
ld a, BATTLE_VARS_MOVE_EFFECT ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar call GetBattleVar
cp EFFECT_PSYWAVE cp EFFECT_PSYWAVE
jr z, .asm_35758 jr z, .psywave
cp EFFECT_SUPER_FANG cp EFFECT_SUPER_FANG
jr z, .asm_3576b jr z, .super_fang
cp EFFECT_REVERSAL cp EFFECT_REVERSAL
jr z, .asm_35792 jr z, .reversal
ld a, BATTLE_VARS_MOVE_POWER ld a, BATTLE_VARS_MOVE_POWER
call GetBattleVar call GetBattleVar
ld b, a ld b, a
ld a, $0 ld a, $0
jr .asm_3578c jr .got_power
.asm_35758 .psywave
ld a, b ld a, b
srl a srl a
add b add b
ld b, a ld b, a
.asm_3575d .psywave_loop
call BattleRandom call BattleRandom
and a and a
jr z, .asm_3575d ; 35761 $fa jr z, .psywave_loop ; 35761 $fa
cp b cp b
jr nc, .asm_3575d ; 35764 $f7 jr nc, .psywave_loop ; 35764 $f7
ld b, a ld b, a
ld a, $0 ld a, $0
jr .asm_3578c ; 35769 $21 jr .got_power ; 35769 $21
.asm_3576b
.super_fang
ld hl, EnemyMonHP ld hl, EnemyMonHP
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_35776 ; 35771 $3 jr z, .got_hp ; 35771 $3
ld hl, BattleMonHP ld hl, BattleMonHP
.asm_35776 .got_hp
ld a, [hli] ld a, [hli]
srl a srl a
ld b, a ld b, a
@ -3681,26 +3682,28 @@ BattleCommand_ConstantDamage: ; 35726
ld a, b ld a, b
pop bc pop bc
and a and a
jr nz, .asm_3578c ; 35781 $9 jr nz, .got_power ; 35781 $9
or b or b
ld a, $0 ld a, $0
jr nz, .asm_3578c ; 35786 $4 jr nz, .got_power ; 35786 $4
ld b, $1 ld b, $1
jr .asm_3578c ; 3578a $0 jr .got_power ; 3578a $0
.asm_3578c
.got_power
ld hl, CurDamage ld hl, CurDamage
ld [hli], a ld [hli], a
ld [hl], b ld [hl], b
ret ret
.asm_35792
.reversal
ld hl, BattleMonHP ld hl, BattleMonHP
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
jr z, .asm_3579d ; 35798 $3 jr z, .reversal_got_hp ; 35798 $3
ld hl, EnemyMonHP ld hl, EnemyMonHP
.asm_3579d .reversal_got_hp
xor a xor a
ld [$ffb3], a ld [hDividend], a
ld [hMultiplicand + 0], a ld [hMultiplicand + 0], a
ld a, [hli] ld a, [hli]
ld [hMultiplicand + 1], a ld [hMultiplicand + 1], a
@ -3715,9 +3718,9 @@ BattleCommand_ConstantDamage: ; 35726
ld [hDivisor], a ld [hDivisor], a
ld a, b ld a, b
and a and a
jr z, .asm_357d6 jr z, .skip_to_divide
ld a, [$ffb7] ld a, [hProduct + 4]
srl b srl b
rr a rr a
srl b srl b
@ -3734,21 +3737,21 @@ BattleCommand_ConstantDamage: ; 35726
ld a, b ld a, b
ld [hDividend + 2], a ld [hDividend + 2], a
.asm_357d6 .skip_to_divide
ld b, $4 ld b, $4
call Divide call Divide
ld a, [hQuotient + 2] ld a, [hQuotient + 2]
ld b, a ld b, a
ld hl, .FlailPower ld hl, .FlailPower
.asm_357e1 .reversal_loop
ld a, [hli] ld a, [hli]
cp b cp b
jr nc, .asm_357e8 jr nc, .break_loop
inc hl inc hl
jr .asm_357e1 jr .reversal_loop
.asm_357e8 .break_loop
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
ld a, [hl] ld a, [hl]
@ -6277,16 +6280,16 @@ endr
jr c, .not_maxed_out jr c, .not_maxed_out
ld a, 999 % $100 ld a, 999 % $100
ld [$ffb6], a ld [hQuotient + 2], a
ld a, 999 / $100 ld a, 999 / $100
ld [$ffb5], a ld [hQuotient + 1], a
.not_maxed_out .not_maxed_out
pop bc pop bc
ld a, [$ffb5] ld a, [hQuotient + 1]
ld [bc], a ld [bc], a
inc bc inc bc
ld a, [$ffb6] ld a, [hQuotient + 2]
ld [bc], a ld [bc], a
inc bc inc bc
pop hl pop hl

View File

@ -93,3 +93,18 @@
const BUENA_ITEM const BUENA_ITEM
const BUENA_MOVE const BUENA_MOVE
const BUENA_STRING const BUENA_STRING
const_def
const BUENA_STARTERS
const BUENA_DRINKS
const BUENA_ITEMS
const BUENA_BALLS
const BUENA_MON1
const BUENA_MON2
const BUENA_TOWNS
const BUENA_TYPES
const BUENA_MOVES
const BUENA_XITEMS
const BUENA_STATIONS
NUM_PASSWORD_CATEGORIES EQU const_value
NUM_PASSWORDS_PER_CATEGORY EQU 3

View File

@ -899,7 +899,7 @@ PlayerMovement: ; 96af0
CheckMenuOW: ; 96b30 CheckMenuOW: ; 96b30
xor a xor a
ld [hMenuReturn], a ld [hMenuReturn], a
ld [$ffa1], a ld [hMenuReturn + 1], a
ld a, [hJoyPressed] ld a, [hJoyPressed]
bit 2, a ; SELECT bit 2, a ; SELECT

View File

@ -342,7 +342,7 @@ Function4e7e8: ; 4e7e8
Function4e80c: ; 4e80c Function4e80c: ; 4e80c
push bc push bc
callab Function8cf69 callab Function8cf69
ld a, [$ff9b] ld a, [hVBlankCounter]
and $e and $e
srl a srl a
rept 2 rept 2

View File

@ -2926,7 +2926,7 @@ Function56cd: ; 56cd
srl a srl a
srl a srl a
srl a srl a
cp $14 cp SCREEN_WIDTH
jr c, .ok3 jr c, .ok3
sub $20 sub $20

View File

@ -1,7 +1,7 @@
PlayRadioShow: ; b8612 PlayRadioShow: ; b8612
; If we're already in the radio program proper, we don't need to be here. ; If we're already in the radio program proper, we don't need to be here.
ld a, [wd002] ld a, [wCurrentRadioLine]
cp 8 cp POKE_FLUTE_RADIO
jr nc, .ok jr nc, .ok
; If Team Rocket is not occupying the radio tower, we don't need to be here. ; If Team Rocket is not occupying the radio tower, we don't need to be here.
ld a, [StatusFlags2] ld a, [StatusFlags2]
@ -12,11 +12,11 @@ PlayRadioShow: ; b8612
and a and a
jr nz, .ok jr nz, .ok
; Team Rocket broadcasts on all stations. ; Team Rocket broadcasts on all stations.
ld a, 7 ld a, ROCKET_RADIO
ld [wd002], a ld [wCurrentRadioLine], a
.ok .ok
; Jump to the currently loaded station. The index to which we need to jump is in wd002. ; Jump to the currently loaded station. The index to which we need to jump is in wCurrentRadioLine.
ld a, [wd002] ld a, [wCurrentRadioLine]
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, RadioJumptable ld hl, RadioJumptable
@ -128,16 +128,16 @@ RadioJumptable: ; b863a (2e:463a)
PrintRadioLine: ; b86ea (2e:46ea) PrintRadioLine: ; b86ea (2e:46ea)
ld [wd003], a ld [wNextRadioLine], a
ld hl, wd00c ld hl, wRadioText
ld a, [wd005] ld a, [wNumRadioLinesPrinted]
cp $2 cp 2
jr nc, .print jr nc, .print
inc hl inc hl
ld [hl], $0 ld [hl], "<START>"
inc a inc a
ld [wd005], a ld [wNumRadioLinesPrinted], a
cp $2 cp 2
jr nz, .print jr nz, .print
bccoord 1, 16 bccoord 1, 16
call PlaceWholeStringInBoxAtOnce call PlaceWholeStringInBoxAtOnce
@ -146,9 +146,9 @@ PrintRadioLine: ; b86ea (2e:46ea)
call PrintTextBoxText call PrintTextBoxText
.skip .skip
ld a, RADIO_SCROLL ld a, RADIO_SCROLL
ld [wd002], a ld [wCurrentRadioLine], a
ld a, 100 ld a, 100
ld [wd004], a ld [wRadioTextDelay], a
ret ret
; b8718 (2e:4718) ; b8718 (2e:4718)
@ -170,23 +170,23 @@ ReplacePeriodsWithSpaces: ; b8718
; b8728 ; b8728
RadioScroll: ; b8728 (2e:4728) RadioScroll: ; b8728 (2e:4728)
ld hl, wd004 ld hl, wRadioTextDelay
ld a, [hl] ld a, [hl]
and a and a
jr z, .proceed jr z, .proceed
dec [hl] dec [hl]
ret ret
.proceed .proceed
ld a, [wd003] ld a, [wNextRadioLine]
ld [wd002], a ld [wCurrentRadioLine], a
ld a, [wd005] ld a, [wNumRadioLinesPrinted]
cp 1 cp 1
call nz, CopyBottomLineToTopLine call nz, CopyBottomLineToTopLine
jp ClearBottomLine jp ClearBottomLine
OaksPkmnTalk1: ; b8742 (2e:4742) OaksPkmnTalk1: ; b8742 (2e:4742)
ld a, $5 ld a, 5
ld [wd006], a ld [wOaksPkmnTalkSegmentCounter], a
call StartRadioStation call StartRadioStation
ld hl, UnknownText_0xb8820 ld hl, UnknownText_0xb8820
ld a, OAKS_POKEMON_TALK_2 ld a, OAKS_POKEMON_TALK_2
@ -274,7 +274,7 @@ endr
ld [CurPartySpecies], a ld [CurPartySpecies], a
call GetPokemonName call GetPokemonName
ld hl, StringBuffer1 ld hl, StringBuffer1
ld de, wd050 ld de, wOaksPkmnTalkPkmnNameBuffer
ld bc, PKMN_NAME_LENGTH ld bc, PKMN_NAME_LENGTH
call CopyBytes call CopyBytes
; Now that we've chosen our wild Pokemon, ; Now that we've chosen our wild Pokemon,
@ -290,7 +290,7 @@ endr
.overflow .overflow
pop bc pop bc
ld a, $0 ld a, OAKS_POKEMON_TALK
jp PrintRadioLine jp PrintRadioLine
; b87f2 (2e:47f2) ; b87f2 (2e:47f2)
@ -361,7 +361,7 @@ UnknownText_0xb8839: ; 0xb8839
OaksPkmnTalk7: ; b883e (2e:483e) OaksPkmnTalk7: ; b883e (2e:483e)
ld a, [CurPartySpecies] ld a, [CurPartySpecies]
ld [wd265], a ld [wNamedObjectIndexBuffer], a
call GetPokemonName call GetPokemonName
ld hl, UnknownText_0xb884f ld hl, UnknownText_0xb884f
ld a, OAKS_POKEMON_TALK_8 ld a, OAKS_POKEMON_TALK_8
@ -517,13 +517,13 @@ endr
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld a, [wd006] ld a, [wOaksPkmnTalkSegmentCounter]
dec a dec a
ld [wd006], a ld [wOaksPkmnTalkSegmentCounter], a
ld a, OAKS_POKEMON_TALK_4 ld a, OAKS_POKEMON_TALK_4
jr nz, .ok jr nz, .ok
ld a, $5 ld a, 5
ld [wd006], a ld [wOaksPkmnTalkSegmentCounter], a
ld a, OAKS_POKEMON_TALK_10 ld a, OAKS_POKEMON_TALK_10
.ok .ok
jp NextRadioLine jp NextRadioLine
@ -652,9 +652,9 @@ OaksPkmnTalk10: ; b896e (2e:496e)
ld hl, UnknownText_0xb898e ld hl, UnknownText_0xb898e
call PrintText call PrintText
ld a, OAKS_POKEMON_TALK_11 ld a, OAKS_POKEMON_TALK_11
ld [wd002], a ld [wCurrentRadioLine], a
ld a, 100 ld a, 100
ld [wd004], a ld [wRadioTextDelay], a
ret ret
; b898e (2e:498e) ; b898e (2e:498e)
@ -669,7 +669,7 @@ UnknownText_0xb8993: ; 0xb8993
; 0xb8994 ; 0xb8994
OaksPkmnTalk11: ; b8994 (2e:4994) OaksPkmnTalk11: ; b8994 (2e:4994)
ld hl, wd004 ld hl, wRadioTextDelay
dec [hl] dec [hl]
ret nz ret nz
hlcoord 9, 14 hlcoord 9, 14
@ -683,7 +683,7 @@ OaksPkmnTalk11: ; b8994 (2e:4994)
; b89a9 ; b89a9
OaksPkmnTalk12: ; b89a9 (2e:49a9) OaksPkmnTalk12: ; b89a9 (2e:49a9)
ld hl, wd004 ld hl, wRadioTextDelay
dec [hl] dec [hl]
ret nz ret nz
hlcoord 1, 16 hlcoord 1, 16
@ -697,7 +697,7 @@ OaksPkmnTalk12: ; b89a9 (2e:49a9)
; b89c6 ; b89c6
OaksPkmnTalk13: ; b89c6 (2e:49c6) OaksPkmnTalk13: ; b89c6 (2e:49c6)
ld hl, wd004 ld hl, wRadioTextDelay
dec [hl] dec [hl]
ret nz ret nz
hlcoord 12, 16 hlcoord 12, 16
@ -711,7 +711,7 @@ OaksPkmnTalk13: ; b89c6 (2e:49c6)
; b89d7 ; b89d7
OaksPkmnTalk14: ; b89d7 (2e:49d7) OaksPkmnTalk14: ; b89d7 (2e:49d7)
ld hl, wd004 ld hl, wRadioTextDelay
dec [hl] dec [hl]
ret nz ret nz
ld de, $1d ld de, $1d
@ -719,13 +719,13 @@ OaksPkmnTalk14: ; b89d7 (2e:49d7)
ld hl, .terminator ld hl, .terminator
call PrintText call PrintText
ld a, OAKS_POKEMON_TALK_4 ld a, OAKS_POKEMON_TALK_4
ld [wd003], a ld [wNextRadioLine], a
xor a xor a
ld [wd005], a ld [wNumRadioLinesPrinted], a
ld a, RADIO_SCROLL ld a, RADIO_SCROLL
ld [wd002], a ld [wCurrentRadioLine], a
ld a, 10 ld a, 10
ld [wd004], a ld [wRadioTextDelay], a
ret ret
; b89ff (2e:49ff) ; b89ff (2e:49ff)
@ -734,9 +734,9 @@ OaksPkmnTalk14: ; b89d7 (2e:49d7)
; 0xb8a00 ; 0xb8a00
PlaceRadioString: ; b8a00 (2e:4a00) PlaceRadioString: ; b8a00 (2e:4a00)
ld [wd002], a ld [wCurrentRadioLine], a
ld a, 100 ld a, 100
ld [wd004], a ld [wRadioTextDelay], a
jp PlaceString jp PlaceString
CopyBottomLineToTopLine: ; b8a0b (2e:4a0b) CopyBottomLineToTopLine: ; b8a0b (2e:4a0b)
@ -747,11 +747,11 @@ CopyBottomLineToTopLine: ; b8a0b (2e:4a0b)
ClearBottomLine: ; b8a17 (2e:4a17) ClearBottomLine: ; b8a17 (2e:4a17)
hlcoord 1, 15 hlcoord 1, 15
ld bc, $12 ld bc, SCREEN_WIDTH - 2
ld a, " " ld a, " "
call ByteFill call ByteFill
hlcoord 1, 16 hlcoord 1, 16
ld bc, $12 ld bc, SCREEN_WIDTH - 2
ld a, " " ld a, " "
jp ByteFill jp ByteFill
@ -784,7 +784,7 @@ PokedexShow1: ; b8a46 (2e:4a46)
call StartRadioStation call StartRadioStation
.loop .loop
call Random call Random
cp CELEBI cp NUM_POKEMON
jr nc, .loop jr nc, .loop
ld c, a ld c, a
push bc push bc
@ -795,7 +795,7 @@ PokedexShow1: ; b8a46 (2e:4a46)
inc c inc c
ld a, c ld a, c
ld [CurPartySpecies], a ld [CurPartySpecies], a
ld [wd265], a ld [wNamedObjectIndexBuffer], a
call GetPokemonName call GetPokemonName
ld hl, UnknownText_0xb8b30 ld hl, UnknownText_0xb8b30
ld a, POKEDEX_SHOW_2 ld a, POKEDEX_SHOW_2
@ -817,8 +817,8 @@ endr
push hl push hl
call CopyDexEntryPart1 call CopyDexEntryPart1
dec hl dec hl
ld [hl], $57 ld [hl], "<DONE>"
ld hl, wd26b ld hl, wPokedexShowPointerAddr
call CopyRadioTextToRAM call CopyRadioTextToRAM
pop hl pop hl
pop af pop af
@ -827,9 +827,9 @@ rept 4
inc hl inc hl
endr endr
ld a, l ld a, l
ld [wd26b], a ld [wPokedexShowPointerAddr], a
ld a, h ld a, h
ld [wd26c], a ld [wPokedexShowPointerAddr + 1], a
ld a, POKEDEX_SHOW_3 ld a, POKEDEX_SHOW_3
jp PrintRadioLine jp PrintRadioLine
@ -864,17 +864,17 @@ PokedexShow8: ; b8acc (2e:4acc)
jp PrintRadioLine jp PrintRadioLine
CopyDexEntry: ; b8ad4 (2e:4ad4) CopyDexEntry: ; b8ad4 (2e:4ad4)
ld a, [wd26b] ld a, [wPokedexShowPointerAddr]
ld l, a ld l, a
ld a, [wd26c] ld a, [wPokedexShowPointerAddr + 1]
ld h, a ld h, a
ld a, [wd26d] ld a, [wPokedexShowPointerBank]
push af push af
push hl push hl
call CopyDexEntryPart1 call CopyDexEntryPart1
dec hl dec hl
ld [hl], "<DONE>" ld [hl], "<DONE>"
ld hl, wd26b ld hl, wPokedexShowPointerAddr
call CopyRadioTextToRAM call CopyRadioTextToRAM
pop hl pop hl
pop af pop af
@ -882,10 +882,10 @@ CopyDexEntry: ; b8ad4 (2e:4ad4)
ret ret
CopyDexEntryPart1: ; b8af3 (2e:4af3) CopyDexEntryPart1: ; b8af3 (2e:4af3)
ld de, wd26d ld de, wPokedexShowPointerBank
ld bc, SCREEN_WIDTH - 1 ld bc, SCREEN_WIDTH - 1
call FarCopyBytes call FarCopyBytes
ld hl, wd26b ld hl, wPokedexShowPointerAddr
ld [hl], "<START>" ld [hl], "<START>"
inc hl inc hl
ld [hl], "<LINE>" ld [hl], "<LINE>"
@ -914,11 +914,11 @@ CopyDexEntryPart2: ; b8b11 (2e:4b11)
jr nz, .loop jr nz, .loop
.okay .okay
ld a, l ld a, l
ld [wd26b], a ld [wPokedexShowPointerAddr], a
ld a, h ld a, h
ld [wd26c], a ld [wPokedexShowPointerAddr + 1], a
ld a, d ld a, d
ld [wd26d], a ld [wPokedexShowPointerBank], a
ret ret
; b8b30 (2e:4b30) ; b8b30 (2e:4b30)
@ -1302,9 +1302,9 @@ PeoplePlaces4: ; People
jp NextRadioLine jp NextRadioLine
; b8d3e (2e:4d3e) ; b8d3e (2e:4d3e)
.E4Names: db WILL, BRUNO, KAREN, KOGA, CHAMPION ; $0b, $0d, $0e, $0f, $10 .E4Names: db WILL, BRUNO, KAREN, KOGA, CHAMPION
.KantoLeaderNames: db BROCK, MISTY, LT_SURGE, ERIKA, JANINE, SABRINA, BLAINE, BLUE ; $11, $12, $13, $15, $1a, $23, $2e, $40 .KantoLeaderNames: db BROCK, MISTY, LT_SURGE, ERIKA, JANINE, SABRINA, BLAINE, BLUE
.MiscNames: db RIVAL1, POKEMON_PROF, CAL, RIVAL2, RED ; $09, $0a, $0c, $2a, $3f .MiscNames: db RIVAL1, POKEMON_PROF, CAL, RIVAL2, RED
db -1 db -1
; b8d51 ; b8d51
@ -1507,11 +1507,11 @@ endr
ld l, a ld l, a
call CopyRadioTextToRAM call CopyRadioTextToRAM
call Random call Random
cp $a ; 6.25 percent cp 4 percent
ld a, PLACES_AND_PEOPLE ld a, PLACES_AND_PEOPLE
jr c, .ok jr c, .ok
call Random call Random
cp $7b ; 48 percent cp 1 + 48 percent
ld a, PLACES_AND_PEOPLE_4 ; People ld a, PLACES_AND_PEOPLE_4 ; People
jr c, .ok jr c, .ok
ld a, PLACES_AND_PEOPLE_6 ; Places ld a, PLACES_AND_PEOPLE_6 ; Places
@ -1653,26 +1653,26 @@ UnknownText_0xb8ef2: ; 0xb8ef2
PokeFluteRadio: ; b8ef7 (2e:4ef7) PokeFluteRadio: ; b8ef7 (2e:4ef7)
call StartRadioStation call StartRadioStation
ld a, 1 ld a, 1
ld [wd005], a ld [wNumRadioLinesPrinted], a
ret ret
UnownRadio: ; b8f00 (2e:4f00) UnownRadio: ; b8f00 (2e:4f00)
call StartRadioStation call StartRadioStation
ld a, 1 ld a, 1
ld [wd005], a ld [wNumRadioLinesPrinted], a
ret ret
EvolutionRadio: ; b8f09 (2e:4f09) EvolutionRadio: ; b8f09 (2e:4f09)
call StartRadioStation call StartRadioStation
ld a, 1 ld a, 1
ld [wd005], a ld [wNumRadioLinesPrinted], a
ret ret
BuenasPassword1: ; b8f12 (2e:4f12) BuenasPassword1: ; b8f12 (2e:4f12)
; Determine if we need to be here ; Determine if we need to be here
call BuenasPasswordCheckMidnight call BuenasPasswordCheckTime
jp nc, .PlayPassword jp nc, .PlayPassword
ld a, [wd005] ld a, [wNumRadioLinesPrinted]
and a and a
jp z, BuenasPassword20 jp z, BuenasPassword20
jp BuenasPassword8 jp BuenasPassword8
@ -1698,14 +1698,14 @@ BuenasPassword2: ; b8f3f (2e:4f3f)
jp NextRadioLine jp NextRadioLine
BuenasPassword3: ; b8f47 (2e:4f47) BuenasPassword3: ; b8f47 (2e:4f47)
call BuenasPasswordCheckMidnight call BuenasPasswordCheckTime
ld hl, UnknownText_0xb918c ld hl, UnknownText_0xb918c
jp c, BuenasPasswordAfterMidnight jp c, BuenasPasswordAfterMidnight
ld a, BUENAS_PASSWORD_4 ld a, BUENAS_PASSWORD_4
jp NextRadioLine jp NextRadioLine
BuenasPassword4: ; b8f55 (2e:4f55) BuenasPassword4: ; b8f55 (2e:4f55)
call BuenasPasswordCheckMidnight call BuenasPasswordCheckTime
jp c, BuenasPassword8 jp c, BuenasPassword8
ld a, [wBuenasPassword] ld a, [wBuenasPassword]
; If we already generated the password today, we don't need to generate a new one. ; If we already generated the password today, we don't need to generate a new one.
@ -1716,7 +1716,7 @@ BuenasPassword4: ; b8f55 (2e:4f55)
.greater_than_11 .greater_than_11
call Random call Random
and $f and $f
cp $b cp NUM_PASSWORD_CATEGORIES
jr nc, .greater_than_11 jr nc, .greater_than_11
; Store it in the high nybble of e. ; Store it in the high nybble of e.
swap a swap a
@ -1725,7 +1725,7 @@ BuenasPassword4: ; b8f55 (2e:4f55)
.greater_than_three .greater_than_three
call Random call Random
and $3 and $3
cp $3 cp NUM_PASSWORDS_PER_CATEGORY
jr nc, .greater_than_three jr nc, .greater_than_three
; The high nybble of wBuenasPassword will now contain the password group index, and the low nybble contains the actual password. ; The high nybble of wBuenasPassword will now contain the password group index, and the low nybble contains the actual password.
add e add e
@ -1808,7 +1808,7 @@ endr
ld l, c ld l, c
add hl, de add hl, de
ld a, [hl] ld a, [hl]
ld [wd265], a ld [wNamedObjectIndexBuffer], a
ret ret
.RawString: ; b8fde (2e:4fde) .RawString: ; b8fde (2e:4fde)
@ -1874,7 +1874,7 @@ BuenasPassword6: ; b90a4 (2e:50a4)
jp NextRadioLine jp NextRadioLine
BuenasPassword7: ; b90ac (2e:50ac) BuenasPassword7: ; b90ac (2e:50ac)
call BuenasPasswordCheckMidnight call BuenasPasswordCheckTime
ld hl, UnknownText_0xb91a0 ld hl, UnknownText_0xb91a0
jr c, BuenasPasswordAfterMidnight jr c, BuenasPasswordAfterMidnight
ld a, BUENAS_PASSWORD ld a, BUENAS_PASSWORD
@ -1959,29 +1959,29 @@ BuenasPassword20: ; b912a (2e:512a)
ld [hBGMapMode], a ; $ff00+$d4 ld [hBGMapMode], a ; $ff00+$d4
ld hl, WeeklyFlags ld hl, WeeklyFlags
res 7, [hl] res 7, [hl]
ld a, $4 ld a, BUENAS_PASSWORD
ld [wd002], a ld [wCurrentRadioLine], a
xor a xor a
ld [wd005], a ld [wNumRadioLinesPrinted], a
ld hl, UnknownText_0xb91d7 ld hl, UnknownText_0xb91d7
ld a, BUENAS_PASSWORD_21 ld a, BUENAS_PASSWORD_21
jp NextRadioLine jp NextRadioLine
BuenasPassword21: ; b9152 (2e:5152) BuenasPassword21: ; b9152 (2e:5152)
ld a, $4 ld a, BUENAS_PASSWORD
ld [wd002], a ld [wCurrentRadioLine], a
xor a xor a
ld [wd005], a ld [wNumRadioLinesPrinted], a
call BuenasPasswordCheckMidnight call BuenasPasswordCheckTime
jp nc, BuenasPassword1 jp nc, BuenasPassword1
ld hl, UnknownText_0xb91d7 ld hl, UnknownText_0xb91d7
ld a, BUENAS_PASSWORD_21 ld a, BUENAS_PASSWORD_21
jp NextRadioLine jp NextRadioLine
BuenasPasswordCheckMidnight: ; b9169 (2e:5169) BuenasPasswordCheckTime: ; b9169 (2e:5169)
call UpdateTime call UpdateTime
ld a, [hHours] ; $ff00+$94 ld a, [hHours] ; $ff00+$94
cp $12 cp 18 ; 6 PM
ret ret
; b9171 (2e:5171) ; b9171 (2e:5171)
@ -2100,19 +2100,19 @@ UnknownText_0xb91d7: ; 0xb91d7
CopyRadioTextToRAM: ; b91dc (2e:51dc) CopyRadioTextToRAM: ; b91dc (2e:51dc)
ld a, [hl] ld a, [hl]
cp TX_FAR cp TX_FAR
jp z, FarJumpText jp z, FarCopyRadioText
ld de, wd00c ld de, wRadioText
ld bc, SCREEN_WIDTH * 2 ld bc, SCREEN_WIDTH * 2
jp CopyBytes jp CopyBytes
StartRadioStation: ; b91eb (2e:51eb) StartRadioStation: ; b91eb (2e:51eb)
ld a, [wd005] ld a, [wNumRadioLinesPrinted]
and a and a
ret nz ret nz
call RadioTerminator call RadioTerminator
call PrintText call PrintText
ld hl, RadioChannelSongs ld hl, RadioChannelSongs
ld a, [wd002] ld a, [wCurrentRadioLine]
ld c, a ld c, a
ld b, 0 ld b, 0
rept 2 rept 2

View File

@ -510,7 +510,7 @@ Function16571: ; 16571
ld de, StringBuffer2 ld de, StringBuffer2
lb bc, PRINTNUM_MONEY | PRINTNUM_LEADINGZEROS | 3, 6 lb bc, PRINTNUM_MONEY | PRINTNUM_LEADINGZEROS | 3, 6
call PrintNum call PrintNum
ld a, [$ff9b] ld a, [hVBlankCounter]
and $10 and $10
jr nz, .skip jr nz, .skip
hlcoord 13, 6 hlcoord 13, 6

View File

@ -59,6 +59,7 @@ rNR11 EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W)
rNR12 EQU $ff12 ; Channel 1 Volume Envelope (R/W) rNR12 EQU $ff12 ; Channel 1 Volume Envelope (R/W)
rNR13 EQU $ff13 ; Channel 1 Frequency lo (Write Only) rNR13 EQU $ff13 ; Channel 1 Frequency lo (Write Only)
rNR14 EQU $ff14 ; Channel 1 Frequency hi (R/W) rNR14 EQU $ff14 ; Channel 1 Frequency hi (R/W)
rNR20 EQU $ff15 ; Channel 2 Sweep register (R/W)
rNR21 EQU $ff16 ; Channel 2 Sound Length/Wave Pattern Duty (R/W) rNR21 EQU $ff16 ; Channel 2 Sound Length/Wave Pattern Duty (R/W)
rNR22 EQU $ff17 ; Channel 2 Volume Envelope (R/W) rNR22 EQU $ff17 ; Channel 2 Volume Envelope (R/W)
rNR23 EQU $ff18 ; Channel 2 Frequency lo data (W) rNR23 EQU $ff18 ; Channel 2 Frequency lo data (W)
@ -68,6 +69,7 @@ rNR31 EQU $ff1b ; Channel 3 Sound Length
rNR32 EQU $ff1c ; Channel 3 Select output level (R/W) rNR32 EQU $ff1c ; Channel 3 Select output level (R/W)
rNR33 EQU $ff1d ; Channel 3 Frequency's lower data (W) rNR33 EQU $ff1d ; Channel 3 Frequency's lower data (W)
rNR34 EQU $ff1e ; Channel 3 Frequency's higher data (R/W) rNR34 EQU $ff1e ; Channel 3 Frequency's higher data (R/W)
rNR40 EQU $ff1f ; Channel 4 Sweep register (R/W)
rNR41 EQU $ff20 ; Channel 4 Sound Length (R/W) rNR41 EQU $ff20 ; Channel 4 Sound Length (R/W)
rNR42 EQU $ff21 ; Channel 4 Volume Envelope (R/W) rNR42 EQU $ff21 ; Channel 4 Volume Envelope (R/W)
rNR43 EQU $ff22 ; Channel 4 Polynomial Counter (R/W) rNR43 EQU $ff22 ; Channel 4 Polynomial Counter (R/W)
@ -75,6 +77,22 @@ rNR44 EQU $ff23 ; Channel 4 Counter/consecutive; Inital (R/W)
rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W) rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W)
rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W) rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W)
rNR52 EQU $ff26 ; Sound on/off rNR52 EQU $ff26 ; Sound on/off
rWave_0 EQU $ff30
rWave_1 EQU $ff31
rWave_2 EQU $ff32
rWave_3 EQU $ff33
rWave_4 EQU $ff34
rWave_5 EQU $ff35
rWave_6 EQU $ff36
rWave_7 EQU $ff37
rWave_8 EQU $ff38
rWave_9 EQU $ff39
rWave_a EQU $ff3a
rWave_b EQU $ff3b
rWave_c EQU $ff3c
rWave_d EQU $ff3d
rWave_e EQU $ff3e
rWave_f EQU $ff3f
rLCDC EQU $ff40 ; LCD Control (R/W) rLCDC EQU $ff40 ; LCD Control (R/W)
rSTAT EQU $ff41 ; LCDC Status (R/W) rSTAT EQU $ff41 ; LCDC Status (R/W)
rSCY EQU $ff42 ; Scroll Y (R/W) rSCY EQU $ff42 ; Scroll Y (R/W)

View File

@ -1460,17 +1460,17 @@ CheckTrainerBattle:: ; 360d
pop af pop af
ld [hLastTalked], a ld [hLastTalked], a
ld a, b ld a, b
ld [CurFruit], a ld [EngineBuffer2], a
ld a, c ld a, c
ld [wd040], a ld [EngineBuffer3], a
jr Function367e jr Function367e
; 3674 ; 3674
Function3674:: ; 3674 Function3674:: ; 3674
ld a, 1 ld a, 1
ld [CurFruit], a ld [EngineBuffer2], a
ld a, -1 ld a, -1
ld [wd040], a ld [EngineBuffer3], a
Function367e:: ; 367e Function367e:: ; 367e
call GetMapScriptHeaderBank call GetMapScriptHeaderBank

View File

@ -234,7 +234,7 @@ endr
; 3a90 ; 3a90
FarJumpText:: ; 3a90 FarCopyRadioText:: ; 3a90
inc hl inc hl
ld a, [hROMBank] ld a, [hROMBank]
push af push af
@ -249,8 +249,8 @@ FarJumpText:: ; 3a90
ld l, a ld l, a
ld a, d ld a, d
ld h, a ld h, a
ld de, wd00c ld de, wRadioText
ld bc, $0028 ld bc, 2 * SCREEN_WIDTH
call CopyBytes call CopyBytes
pop af pop af
ld [hROMBank], a ld [hROMBank], a

View File

@ -437,7 +437,7 @@ KeepTextOpen:: ; aaf
; af5 ; af5
.blink_cursor: ; af5 .blink_cursor: ; af5
ld a, [$ff9b] ld a, [hVBlankCounter]
and %00010000 ; bit 4, a and %00010000 ; bit 4, a
jr z, .cursor_off jr z, .cursor_off
ld a, "▼" ld a, "▼"

View File

@ -1,29 +1,29 @@
Function1b1e:: ; 1b1e InitMovementBuffer:: ; 1b1e
ld [wd003], a ld [wMovementBufferPerson], a
xor a xor a
ld [DefaultFlypoint], a ld [wMovementBufferCount], a
ld a, $0 ld a, $0 ; useless
ld [wd004], a ld [wd004], a
ld a, $7 ld a, $7
ld [StartFlypoint], a ld [wd005], a
ld a, $d0 ld a, $d0
ld [EndFlypoint], a ld [wd006], a
ret ret
; 1b35 ; 1b35
Function1b35:: ; 1b35 DecrementMovementBufferCount:: ; 1b35
ld a, [DefaultFlypoint] ld a, [wMovementBufferCount]
and a and a
ret z ret z
dec a dec a
ld [DefaultFlypoint], a ld [wMovementBufferCount], a
ret ret
; 1b3f ; 1b3f
Function1b3f:: ; 1b3f AppendToMovementBuffer:: ; 1b3f
push hl push hl
push de push de
ld hl, DefaultFlypoint ld hl, wMovementBufferCount
ld e, [hl] ld e, [hl]
inc [hl] inc [hl]
ld d, 0 ld d, 0
@ -35,47 +35,50 @@ Function1b3f:: ; 1b3f
ret ret
; 1b50 ; 1b50
Function1b50:: ; 1b50 AppendToMovementBufferNTimes:: ; 1b50
push af push af
ld a, c ld a, c
and a and a
jr nz, .asm_1b57 jr nz, .okay
pop af pop af
ret ret
.asm_1b57 .okay
pop af pop af
.asm_1b58 .loop
call Function1b3f call AppendToMovementBuffer
dec c dec c
jr nz, .asm_1b58 jr nz, .loop
ret ret
; 1b5f ; 1b5f
Function1b5f:: ; 1b5f ComputePathToWalkToPlayer:: ; 1b5f
push af push af
; compare x coords, load left/right into h, and x distance into d
ld a, b ld a, b
sub d sub d
ld h, $2 ld h, LEFT
jr nc, .asm_1b6a jr nc, .got_x_distance
dec a dec a
cpl cpl
ld h, $3 ld h, RIGHT
.asm_1b6a .got_x_distance
ld d, a ld d, a
; compare y coords, load up/down into l, and y distance into e
ld a, c ld a, c
sub e sub e
ld l, $1 ld l, UP
jr nc, .asm_1b75 jr nc, .got_y_distance
dec a dec a
cpl cpl
ld l, $0 ld l, DOWN
.asm_1b75 .got_y_distance
ld e, a ld e, a
; if the x distance is less than the y distance, swap h and l, and swap d and e
cp d cp d
jr nc, .asm_1b7f jr nc, .done
ld a, h ld a, h
ld h, l ld h, l
ld l, a ld l, a
@ -83,21 +86,23 @@ Function1b5f:: ; 1b5f
ld d, e ld d, e
ld e, a ld e, a
.asm_1b7f .done
pop af pop af
ld b, a ld b, a
; Add movement in the longer direction first...
ld a, h ld a, h
call Function1b92 call .GetMovementData
ld c, d ld c, d
call Function1b50 call AppendToMovementBufferNTimes
; ... then add the shorter direction.
ld a, l ld a, l
call Function1b92 call .GetMovementData
ld c, e ld c, e
call Function1b50 call AppendToMovementBufferNTimes
ret ret
; 1b92 ; 1b92
Function1b92:: ; 1b92 .GetMovementData: ; 1b92
push de push de
push hl push hl
ld l, b ld l, b
@ -108,7 +113,7 @@ endr
ld e, a ld e, a
ld d, 0 ld d, 0
add hl, de add hl, de
ld de, .data_1ba5 ld de, .MovementData
add hl, de add hl, de
ld a, [hl] ld a, [hl]
pop hl pop hl
@ -116,8 +121,19 @@ endr
ret ret
; 1ba5 ; 1ba5
.data_1ba5 .MovementData
db 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 slow_step_down
slow_step_up
slow_step_left
slow_step_right
step_down
step_up
step_left
step_right
big_step_down
big_step_up
big_step_left
big_step_right
; 1bb1 ; 1bb1
Function1bb1:: ; 1bb1 Function1bb1:: ; 1bb1

View File

@ -64,7 +64,7 @@ VBlank0:: ; 2b1
; sound ; sound
; inc frame counter ; inc frame counter
ld hl, $ff9b ld hl, hVBlankCounter
inc [hl] inc [hl]
; advance random variables ; advance random variables
@ -418,7 +418,7 @@ VBlank6:: ; 436
ld [hROMBankBackup], a ld [hROMBankBackup], a
; inc frame counter ; inc frame counter
ld hl, $ff9b ld hl, hVBlankCounter
inc [hl] inc [hl]
call UpdateCGBPals call UpdateCGBPals

View File

@ -1149,7 +1149,7 @@ Function627b: ; 627b
; 6292 ; 6292
Function6292: ; 6292 ; unreferenced Function6292: ; 6292 ; unreferenced
ld a, [$ff9b] ld a, [hVBlankCounter]
and $7 and $7
ret nz ret nz
ld hl, LYOverrides + $5f ld hl, LYOverrides + $5f
@ -3688,28 +3688,29 @@ Function830d: ; 830d
TrainerWalkToPlayer: ; 831e TrainerWalkToPlayer: ; 831e
ld a, [hLastTalked] ld a, [hLastTalked]
call Function1b1e call InitMovementBuffer
ld a, $3e ld a, movement_show_person
call Function1b3f call AppendToMovementBuffer
ld a, [wd03f] ld a, [wd03f]
dec a dec a
jr z, Function833b jr z, .TerminateStep
ld a, [hLastTalked] ld a, [hLastTalked]
ld b, a ld b, a
ld c, 0 ld c, PLAYER
ld d, 1 ld d, 1
call Function8341 call .GetPathToPlayer
call Function1b35 call DecrementMovementBufferCount
Function833b .TerminateStep
ld a, $47 ld a, movement_step_end
call Function1b3f call AppendToMovementBuffer
ret ret
; 8341 ; 8341
Function8341: ; 8341 .GetPathToPlayer: ; 8341
push de push de
push bc push bc
; get player object struct, load to de
ld a, c ld a, c
call GetMapObject call GetMapObject
ld hl, MAPOBJECT_OBJECT_STRUCT_ID ld hl, MAPOBJECT_OBJECT_STRUCT_ID
@ -3718,6 +3719,8 @@ Function8341: ; 8341
call GetObjectStruct call GetObjectStruct
ld d, b ld d, b
ld e, c ld e, c
; get last talked object struct, load to bc
pop bc pop bc
ld a, b ld a, b
call GetMapObject call GetMapObject
@ -3725,6 +3728,8 @@ Function8341: ; 8341
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
call GetObjectStruct call GetObjectStruct
; get last talked coords, load to bc
ld hl, OBJECT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
@ -3732,6 +3737,8 @@ Function8341: ; 8341
add hl, bc add hl, bc
ld c, [hl] ld c, [hl]
ld b, a ld b, a
; get player coords, load to de
ld hl, OBJECT_MAP_X ld hl, OBJECT_MAP_X
add hl, de add hl, de
ld a, [hl] ld a, [hl]
@ -3739,35 +3746,39 @@ Function8341: ; 8341
add hl, de add hl, de
ld e, [hl] ld e, [hl]
ld d, a ld d, a
pop af pop af
call Function1b5f call ComputePathToWalkToPlayer
ret ret
; 8379 ; 8379
Special_SurfStartStep: ; 8379 Special_SurfStartStep: ; 8379
call Function1b1e call InitMovementBuffer
call Function8388 call .GetMovementData
call Function1b3f call AppendToMovementBuffer
ld a, $47 ld a, movement_step_end
call Function1b3f call AppendToMovementBuffer
ret ret
; 8388 ; 8388
Function8388: ; 8388 .GetMovementData: ; 8388
ld a, [PlayerDirection] ld a, [PlayerDirection]
srl a srl a
srl a srl a
and 3 and 3
ld e, a ld e, a
ld d, 0 ld d, 0
ld hl, .data_839a ld hl, .movement_data
add hl, de add hl, de
ld a, [hl] ld a, [hl]
ret ret
; 839a ; 839a
.data_839a .movement_data
db 8 + DOWN, 8 + UP, 8 + LEFT, 8 + RIGHT slow_step_down
slow_step_up
slow_step_left
slow_step_right
; 839e ; 839e
@ -23185,7 +23196,7 @@ Function25415: ; 25415 (9:5415)
ld de, GameTimeMinutes ld de, GameTimeMinutes
lb bc, PRINTNUM_LEADINGZEROS | 1, 2 lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum call PrintNum
ld a, [$ff9b] ld a, [hVBlankCounter]
and $1f and $1f
ret nz ret nz
hlcoord 15, 12 hlcoord 15, 12
@ -23195,7 +23206,7 @@ Function25415: ; 25415 (9:5415)
ret ret
Function25438: ; 25438 (9:5438) Function25438: ; 25438 (9:5438)
ld a, [$ff9b] ld a, [hVBlankCounter]
and $7 and $7
ret nz ret nz
ld a, [wcf64] ld a, [wcf64]
@ -59041,7 +59052,7 @@ Function91d9b: ; 91d9b
; 91dcd ; 91dcd
Function91dcd: ; 91dcd Function91dcd: ; 91dcd
ld a, [$ff9b] ld a, [hVBlankCounter]
ld e, a ld e, a
and $f and $f
ret nz ret nz
@ -64357,7 +64368,7 @@ endr
.CheckTheCard: ; e02da .CheckTheCard: ; e02da
xor a xor a
ld [$ff9b], a ld [hVBlankCounter], a
call Functione0960 call Functione0960
call WaitSFX call WaitSFX
ld de, SFX_CHOOSE_A_CARD ld de, SFX_CHOOSE_A_CARD
@ -65463,7 +65474,7 @@ Functione0960: ; e0960
ld a, [hCGB] ld a, [hCGB]
and a and a
jr nz, .asm_e096d jr nz, .asm_e096d
ld a, [$ff9b] ld a, [hVBlankCounter]
and $4 and $4
ret nz ret nz
@ -65867,7 +65878,7 @@ Functione1190: ; e1190
ld a, [wcf64] ld a, [wcf64]
and a and a
jr nz, .asm_e1230 jr nz, .asm_e1230
ld a, [$ff9b] ld a, [hVBlankCounter]
and $10 and $10
jr z, .asm_e1235 jr z, .asm_e1235

View File

@ -6,9 +6,9 @@ Route38_MapScriptHeader:
db 0 db 0
TrainerBird_keeperToby: TrainerBird_keeperToby:
trainer EVENT_BEAT_BIRD_KEEPER_TOBY, BIRD_KEEPER, TOBY, Bird_keeperTobySeenText, Bird_keeperTobyBeatenText, 0, Bird_keeperTobyScript trainer EVENT_BEAT_BIRD_KEEPER_TOBY, BIRD_KEEPER, TOBY, Bird_keeperTobySeenText, Bird_keeperTobyBeatenText, 0, .script
Bird_keeperTobyScript: .script:
talkaftercancel talkaftercancel
loadfont loadfont
writetext UnknownText_0x1a1f86 writetext UnknownText_0x1a1f86
@ -17,9 +17,9 @@ Bird_keeperTobyScript:
end end
TrainerSailorHarry: TrainerSailorHarry:
trainer EVENT_BEAT_SAILOR_HARRY, SAILOR, HARRY, SailorHarrySeenText, SailorHarryBeatenText, 0, SailorHarryScript trainer EVENT_BEAT_SAILOR_HARRY, SAILOR, HARRY, SailorHarrySeenText, SailorHarryBeatenText, 0, .script
SailorHarryScript: .script:
talkaftercancel talkaftercancel
loadfont loadfont
writetext UnknownText_0x1a220c writetext UnknownText_0x1a220c
@ -28,38 +28,38 @@ SailorHarryScript:
end end
TrainerLassDana1: TrainerLassDana1:
trainer EVENT_BEAT_LASS_DANA, LASS, DANA1, LassDana1SeenText, LassDana1BeatenText, 0, LassDana1Script trainer EVENT_BEAT_LASS_DANA, LASS, DANA1, LassDana1SeenText, LassDana1BeatenText, 0, .script
LassDana1Script: .script:
writecode VAR_CALLERID, PHONE_LASS_DANA writecode VAR_CALLERID, PHONE_LASS_DANA
talkaftercancel talkaftercancel
loadfont loadfont
checkflag ENGINE_DANA checkflag ENGINE_DANA
iftrue UnknownScript_0x1a1d82 iftrue .DanaRematch
checkflag ENGINE_DANA_HAS_THUNDERSTONE checkflag ENGINE_DANA_HAS_THUNDERSTONE
iftrue UnknownScript_0x1a1df6 iftrue .TryGiveThunderstone
checkcellnum PHONE_LASS_DANA checkcellnum PHONE_LASS_DANA
iftrue UnknownScript_0x1a1e17 iftrue .NumberAccepted
checkevent EVENT_DANA_ASKED_FOR_PHONE_NUMBER checkevent EVENT_DANA_ASKED_FOR_PHONE_NUMBER
iftrue UnknownScript_0x1a1d6b iftrue .SecondTimeAsking
writetext UnknownText_0x1a20ec writetext UnknownText_0x1a20ec
keeptextopen keeptextopen
setevent EVENT_DANA_ASKED_FOR_PHONE_NUMBER setevent EVENT_DANA_ASKED_FOR_PHONE_NUMBER
scall UnknownScript_0x1a1e0b scall .AskNumber1F
jump UnknownScript_0x1a1d6e jump .AskForPhoneNumber
UnknownScript_0x1a1d6b: .SecondTimeAsking:
scall UnknownScript_0x1a1e0f scall .AskNumber2F
UnknownScript_0x1a1d6e: .AskForPhoneNumber:
askforphonenumber PHONE_LASS_DANA askforphonenumber PHONE_LASS_DANA
if_equal $1, UnknownScript_0x1a1e1f if_equal $1, .PhoneFull
if_equal $2, UnknownScript_0x1a1e1b if_equal $2, .DeclinedPhoneNumber
trainertotext LASS, DANA1, $0 trainertotext LASS, DANA1, $0
scall UnknownScript_0x1a1e13 scall .RegisteredPhoneNumber
jump UnknownScript_0x1a1e17 jump .NumberAccepted
UnknownScript_0x1a1d82: .DanaRematch:
scall UnknownScript_0x1a1e23 scall .Rematch
winlosstext LassDana1BeatenText, 0 winlosstext LassDana1BeatenText, 0
copybytetovar wDanaFightCount copybytetovar wDanaFightCount
if_equal 4, .Fight4 if_equal 4, .Fight4
@ -118,84 +118,84 @@ UnknownScript_0x1a1d82:
clearflag ENGINE_DANA clearflag ENGINE_DANA
end end
UnknownScript_0x1a1df6: .TryGiveThunderstone:
scall UnknownScript_0x1a1e27 scall .Gift
verbosegiveitem THUNDERSTONE verbosegiveitem THUNDERSTONE
iffalse UnknownScript_0x1a1e08 iffalse .NoRoomForThunderstone
clearflag ENGINE_DANA_HAS_THUNDERSTONE clearflag ENGINE_DANA_HAS_THUNDERSTONE
setevent EVENT_DANA_GAVE_THUNDERSTONE setevent EVENT_DANA_GAVE_THUNDERSTONE
jump UnknownScript_0x1a1e17 jump .NumberAccepted
UnknownScript_0x1a1e08: .NoRoomForThunderstone:
jump UnknownScript_0x1a1e2b jump .PackFull
UnknownScript_0x1a1e0b: .AskNumber1F:
jumpstd asknumber1f jumpstd asknumber1f
end end
UnknownScript_0x1a1e0f: .AskNumber2F:
jumpstd asknumber2f jumpstd asknumber2f
end end
UnknownScript_0x1a1e13: .RegisteredPhoneNumber:
jumpstd registerednumberf jumpstd registerednumberf
end end
UnknownScript_0x1a1e17: .NumberAccepted:
jumpstd numberacceptedf jumpstd numberacceptedf
end end
UnknownScript_0x1a1e1b: .DeclinedPhoneNumber:
jumpstd numberdeclinedf jumpstd numberdeclinedf
end end
UnknownScript_0x1a1e1f: .PhoneFull:
jumpstd phonefullf jumpstd phonefullf
end end
UnknownScript_0x1a1e23: .Rematch:
jumpstd rematchf jumpstd rematchf
end end
UnknownScript_0x1a1e27: .Gift:
jumpstd giftf jumpstd giftf
end end
UnknownScript_0x1a1e2b: .PackFull:
jumpstd packfullf jumpstd packfullf
end end
TrainerSchoolboyChad1: TrainerSchoolboyChad1:
trainer EVENT_BEAT_SCHOOLBOY_CHAD, SCHOOLBOY, CHAD1, SchoolboyChad1SeenText, SchoolboyChad1BeatenText, 0, SchoolboyChad1Script trainer EVENT_BEAT_SCHOOLBOY_CHAD, SCHOOLBOY, CHAD1, SchoolboyChad1SeenText, SchoolboyChad1BeatenText, 0, .script
SchoolboyChad1Script: .script:
writecode VAR_CALLERID, PHONE_SCHOOLBOY_CHAD writecode VAR_CALLERID, PHONE_SCHOOLBOY_CHAD
talkaftercancel talkaftercancel
loadfont loadfont
checkflag ENGINE_CHAD checkflag ENGINE_CHAD
iftrue UnknownScript_0x1a1e75 iftrue .ChadRematch
checkcellnum PHONE_SCHOOLBOY_CHAD checkcellnum PHONE_SCHOOLBOY_CHAD
iftrue UnknownScript_0x1a1ef5 iftrue .HaveChadsNumber
checkevent EVENT_CHAD_ASKED_FOR_PHONE_NUMBER checkevent EVENT_CHAD_ASKED_FOR_PHONE_NUMBER
iftrue UnknownScript_0x1a1e5e iftrue .SecondTimeAsking
writetext UnknownText_0x1a200e writetext UnknownText_0x1a200e
keeptextopen keeptextopen
setevent EVENT_CHAD_ASKED_FOR_PHONE_NUMBER setevent EVENT_CHAD_ASKED_FOR_PHONE_NUMBER
scall UnknownScript_0x1a1ee9 scall .AskPhoneNumber1
jump UnknownScript_0x1a1e61 jump .AskToRegisterNumber
UnknownScript_0x1a1e5e: .SecondTimeAsking:
scall UnknownScript_0x1a1eed scall .AskPhoneNumber2
UnknownScript_0x1a1e61: .AskToRegisterNumber:
askforphonenumber PHONE_SCHOOLBOY_CHAD askforphonenumber PHONE_SCHOOLBOY_CHAD
if_equal $1, UnknownScript_0x1a1efd if_equal $1, .PhoneFull
if_equal $2, UnknownScript_0x1a1ef9 if_equal $2, .SaidNo
trainertotext SCHOOLBOY, CHAD1, $0 trainertotext SCHOOLBOY, CHAD1, $0
scall UnknownScript_0x1a1ef1 scall .RegisteredChad
jump UnknownScript_0x1a1ef5 jump .HaveChadsNumber
UnknownScript_0x1a1e75: .ChadRematch:
scall UnknownScript_0x1a1f01 scall .Rematch
winlosstext SchoolboyChad1BeatenText, 0 winlosstext SchoolboyChad1BeatenText, 0
copybytetovar wChadFightCount copybytetovar wChadFightCount
if_equal 4, .Fight4 if_equal 4, .Fight4
@ -254,38 +254,38 @@ UnknownScript_0x1a1e75:
clearflag ENGINE_CHAD clearflag ENGINE_CHAD
end end
UnknownScript_0x1a1ee9: .AskPhoneNumber1:
jumpstd asknumber1m jumpstd asknumber1m
end end
UnknownScript_0x1a1eed: .AskPhoneNumber2:
jumpstd asknumber2m jumpstd asknumber2m
end end
UnknownScript_0x1a1ef1: .RegisteredChad:
jumpstd registerednumberm jumpstd registerednumberm
end end
UnknownScript_0x1a1ef5: .HaveChadsNumber:
jumpstd numberacceptedm jumpstd numberacceptedm
end end
UnknownScript_0x1a1ef9: .SaidNo:
jumpstd numberdeclinedm jumpstd numberdeclinedm
end end
UnknownScript_0x1a1efd: .PhoneFull:
jumpstd phonefullm jumpstd phonefullm
end end
UnknownScript_0x1a1f01: .Rematch:
jumpstd rematchm jumpstd rematchm
end end
TrainerBeautyValerie: TrainerBeautyValerie:
trainer EVENT_BEAT_BEAUTY_VALERIE, BEAUTY, VALERIE, BeautyValerieSeenText, BeautyValerieBeatenText, 0, BeautyValerieScript trainer EVENT_BEAT_BEAUTY_VALERIE, BEAUTY, VALERIE, BeautyValerieSeenText, BeautyValerieBeatenText, 0, .script
BeautyValerieScript: .script:
talkaftercancel talkaftercancel
loadfont loadfont
writetext UnknownText_0x1a2185 writetext UnknownText_0x1a2185
@ -294,9 +294,9 @@ BeautyValerieScript:
end end
TrainerBeautyOlivia: TrainerBeautyOlivia:
trainer EVENT_BEAT_BEAUTY_OLIVIA, BEAUTY, OLIVIA, BeautyOliviaSeenText, BeautyOliviaBeatenText, 0, BeautyOliviaScript trainer EVENT_BEAT_BEAUTY_OLIVIA, BEAUTY, OLIVIA, BeautyOliviaSeenText, BeautyOliviaBeatenText, 0, .script
BeautyOliviaScript: .script:
talkaftercancel talkaftercancel
loadfont loadfont
writetext UnknownText_0x1a229a writetext UnknownText_0x1a229a

View File

@ -2357,38 +2357,45 @@ Function100efb: ; 100efb
asm_100f02: asm_100f02:
ld a, c ld a, c
ld [StringBuffer2], a ld [StringBuffer2], a
; someting that was previously stored in de gets backed up to here
ld a, e ld a, e
ld [StringBuffer2 + 1], a ld [StringBuffer2 + 1], a
ld a, d ld a, d
ld [StringBuffer2 + 2], a ld [StringBuffer2 + 2], a
; empty this
xor a xor a
ld [StringBuffer2 + 4], a ld [StringBuffer2 + 4], a
ld [StringBuffer2 + 5], a ld [StringBuffer2 + 5], a
.asm_100f15 .loop
ld a, [hl] ld a, [hl]
cp $ff cp $ff
jr z, .asm_100f34 jr z, .done
ld [StringBuffer2 + 3], a ld [StringBuffer2 + 3], a ; bank
push hl push hl
inc hl inc hl
; addr 1
ld a, [hli] ld a, [hli]
ld e, a ld e, a
ld a, [hli] ld a, [hli]
ld d, a ld d, a
; size
ld a, [hli] ld a, [hli]
ld c, a ld c, a
ld a, [hli] ld a, [hli]
ld b, a ld b, a
; addr 2
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
call Function100f3d call Function100f3d
; next line
pop hl pop hl
ld de, $0007 ld de, $0007
add hl, de add hl, de
jr .asm_100f15 jr .loop
.asm_100f34 .done
; recover the values into bc
ld a, [StringBuffer2 + 4] ld a, [StringBuffer2 + 4]
ld c, a ld c, a
ld a, [StringBuffer2 + 5] ld a, [StringBuffer2 + 5]
@ -2397,16 +2404,20 @@ asm_100f02:
; 100f3d ; 100f3d
Function100f3d: ; 100f3d Function100f3d: ; 100f3d
; parameter
ld a, [StringBuffer2] ld a, [StringBuffer2]
cp $2 cp $2
jr z, .asm_100f61 jr z, .two
cp $1 cp $1
jr z, .asm_100f77 jr z, .one
cp $3 cp $3
jr z, .asm_100f4d jr z, .three
ret ret
.asm_100f4d .three
; what was once in de gets copied to hl,
; modified by Function100f8d, and put back
; into this backup
ld a, [StringBuffer2 + 1] ld a, [StringBuffer2 + 1]
ld l, a ld l, a
ld a, [StringBuffer2 + 2] ld a, [StringBuffer2 + 2]
@ -2418,7 +2429,9 @@ Function100f3d: ; 100f3d
ld [StringBuffer2 + 2], a ld [StringBuffer2 + 2], a
ret ret
.asm_100f61 .two
; hl gets backed up to de, then
; do the same as in .three
ld d, h ld d, h
ld e, l ld e, l
ld a, [StringBuffer2 + 1] ld a, [StringBuffer2 + 1]
@ -2432,7 +2445,11 @@ Function100f3d: ; 100f3d
ld [StringBuffer2 + 2], a ld [StringBuffer2 + 2], a
ret ret
.asm_100f77 .one
; de gets copied to hl, then
; load the backup into de,
; finally run Function100f8d
; and store the de result
ld h, d ld h, d
ld l, e ld l, e
ld a, [StringBuffer2 + 1] ld a, [StringBuffer2 + 1]
@ -2462,18 +2479,18 @@ Function100f8d: ; 100f8d
ld a, [StringBuffer2 + 3] ld a, [StringBuffer2 + 3]
bit 7, a bit 7, a
res 7, a res 7, a
jr z, .asm_100fb6 jr z, .sram
and a and a
jr nz, .asm_100fb0 jr nz, .wram
call CopyBytes call CopyBytes
ret ret
.asm_100fb0 .wram
and $7f and $7f
call FarCopyWRAM call FarCopyWRAM
ret ret
.asm_100fb6 .sram
call GetSRAMBank call GetSRAMBank
call CopyBytes call CopyBytes
call CloseSRAM call CloseSRAM
@ -2481,16 +2498,20 @@ Function100f8d: ; 100f8d
; 100fc0 ; 100fc0
Unknown_100fc0: ; 100fc0 Unknown_100fc0: ; 100fc0
dbwww $80, PlayerName, NAME_LENGTH, wd26b ; first byte:
; Bit 7 set: Not SRAM
; Lower 7 bits: Bank
; Address, size (dw), address
dbwww $80, PlayerName, NAME_LENGTH, OTPlayerName
dbwww $80, PartyCount, 1 + PARTY_LENGTH + 1, OTPartyCount dbwww $80, PartyCount, 1 + PARTY_LENGTH + 1, OTPartyCount
dbwww $80, PlayerID, 2, wd276 dbwww $80, PlayerID, 2, OTPlayerID
dbwww $80, PartyMons, $30 * PARTY_LENGTH, OTPartyMons dbwww $80, PartyMons, PARTYMON_STRUCT_LENGTH * PARTY_LENGTH, OTPartyMons
dbwww $80, PartyMonOT, NAME_LENGTH * PARTY_LENGTH, OTPartyMonOT dbwww $80, PartyMonOT, NAME_LENGTH * PARTY_LENGTH, OTPartyMonOT
dbwww $80, PartyMonNicknames, PKMN_NAME_LENGTH * PARTY_LENGTH, OTPartyMonNicknames dbwww $80, PartyMonNicknames, PKMN_NAME_LENGTH * PARTY_LENGTH, OTPartyMonNicknames
db -1 db -1
Unknown_100feb: ; 100feb Unknown_100feb: ; 100feb
dbwww $00, $a600, $2f * PARTY_LENGTH, NULL dbwww $00, sPartyScratch1, SCRATCHMON_STRUCT_LENGTH * PARTY_LENGTH, NULL
db -1 db -1
Unknown_100ff3: ; 100ff3 Unknown_100ff3: ; 100ff3
@ -2501,15 +2522,15 @@ Unknown_100ff3: ; 100ff3
dbwww $80, wSecretID, 2, NULL dbwww $80, wSecretID, 2, NULL
dbwww $80, PlayerGender, 1, NULL dbwww $80, PlayerGender, 1, NULL
dbwww $04, $a603, 8, NULL dbwww $04, $a603, 8, NULL
dbwww $04, $a007, $30, NULL dbwww $04, $a007, PARTYMON_STRUCT_LENGTH, NULL
db -1 db -1
Unknown_10102c: ; 10102c Unknown_10102c: ; 10102c
dbwww $80, wd26b, 11, NULL dbwww $80, OTPlayerName, 11, NULL
dbwww $80, wd276, 2, NULL dbwww $80, OTPlayerID, 2, NULL
dbwww $80, OTPartyMonNicknames, PKMN_NAME_LENGTH * PARTY_LENGTH, NULL dbwww $80, OTPartyMonNicknames, PKMN_NAME_LENGTH * PARTY_LENGTH, NULL
dbwww $80, OTPartyMonOT, NAME_LENGTH * PARTY_LENGTH, NULL dbwww $80, OTPartyMonOT, NAME_LENGTH * PARTY_LENGTH, NULL
dbwww $80, OTPartyMons, $30 * PARTY_LENGTH, NULL dbwww $80, OTPartyMons, PARTYMON_STRUCT_LENGTH * PARTY_LENGTH, NULL
db -1 db -1
; 10104f ; 10104f

View File

@ -1008,7 +1008,7 @@ FlickeringCaveEntrancePalette: ; fc71e
; Ready for BGPD input... ; Ready for BGPD input...
ld a, %10100000 ; auto-increment, index $20 (pal 4 color 0) ld a, %10100000 ; auto-increment, index $20 (pal 4 color 0)
ld [rBGPI], a ld [rBGPI], a
ld a, [$ff9b] ld a, [hVBlankCounter]
and %00000010 and %00000010
jr nz, .bit1set jr nz, .bit1set
ld hl, Unkn1Pals + $20 ; pal 4 color 0 ld hl, Unkn1Pals + $20 ; pal 4 color 0

View File

@ -1395,26 +1395,33 @@ MiscBuffer2::
PhoneScriptBank:: PhoneScriptBank::
DefaultFlypoint:: ; d002 DefaultFlypoint:: ; d002
LuckyNumberDigit1Buffer:: LuckyNumberDigit1Buffer::
wCurrentRadioLine::
wMovementBufferCount::
ds 1 ds 1
wd003:: wd003::
MiscBuffer3:: MiscBuffer3::
LuckyNumberDigit2Buffer:: LuckyNumberDigit2Buffer::
PhoneCallerLo:: PhoneCallerLo::
wNextRadioLine::
wMovementBufferPerson::
ds 1 ds 1
wd004:: wd004::
MiscBuffer4:: MiscBuffer4::
LuckyNumberDigit3Buffer:: LuckyNumberDigit3Buffer::
PhoneCallerHi:: PhoneCallerHi::
wRadioTextDelay::
ds 1 ds 1
wd005:: wd005::
MiscBuffer5:: MiscBuffer5::
LuckyNumberDigit4Buffer:: LuckyNumberDigit4Buffer::
StartFlypoint:: ; d005 StartFlypoint:: ; d005
wNumRadioLinesPrinted::
ds 1 ds 1
wd006:: wd006::
MiscBuffer6:: MiscBuffer6::
LuckyNumberDigit5Buffer:: LuckyNumberDigit5Buffer::
EndFlypoint:: ; d006 EndFlypoint:: ; d006
wOaksPkmnTalkSegmentCounter::
ds 1 ds 1
wd007:: wd007::
@ -1425,6 +1432,11 @@ MovementBuffer:: ; d007
wd008:: ds 2 wd008:: ds 2
wd00a:: ds 1 wd00a:: ds 1
wd00b:: ds 1 wd00b:: ds 1
wRadioText:: ds 2 * SCREEN_WIDTH
wRadioTextEnd::
ds wRadioText - @
wd00c:: ds 1 wd00c:: ds 1
wd00d:: ds 1 wd00d:: ds 1
wd00e:: ds 1 wd00e:: ds 1
@ -1474,31 +1486,40 @@ EngineBuffer3::
wd041:: wd041::
EngineBuffer4:: EngineBuffer4::
wTempTrainerEventFlagLo::
ds 1 ds 1
wTempTrainerEventFlagHi::
MovementAnimation:: ; d042 MovementAnimation:: ; d042
ds 1 ds 1
wTempTrainerClass::
WalkingDirection:: ; d043 WalkingDirection:: ; d043
ds 1 ds 1
wTempTrainerID::
FacingDirection:: ; d044 FacingDirection:: ; d044
ds 1 ds 1
wSeenTextPointer::
WalkingX:: ; d045 WalkingX:: ; d045
ds 1 ds 1
WalkingY:: ; d046 WalkingY:: ; d046
ds 1 ds 1
WalkingTile:: ; d047 WalkingTile:: ; d047
wWinTextPointer:: wWinTextPointer::
ds 1 ds 1
wd048:: ds 1 wd048:: ds 1
wLossTextPointer:: ds 2 wLossTextPointer:: ds 2
wScriptAfterPointer::
wd04b:: ds 2 wd04b:: ds 2
wd04d:: ds 1 wd04d:: ds 1
MenuItemsListEnd:: MenuItemsListEnd::
wd04e:: ds 2 wd04e:: ds 2
wd050:: ds 10 wOaksPkmnTalkPkmnNameBuffer::
wd050:: ds PKMN_NAME_LENGTH +- 1
wd05a:: ds 12 wd05a:: ds 12
wd066:: ds 10 wd066:: ds 10
wd070:: ds 3 wd070:: ds 3
@ -1929,11 +1950,16 @@ TimeOfDay:: ; d269
ds 1 ds 1
SECTION "Enemy Party", WRAMX, BANK [1] SECTION "Enemy Party", WRAMX, BANK [1]
OTPlayerName:: OTPlayerName:: ds NAME_LENGTH
ds OTPlayerName - @
wPokedexShowPointerAddr::
wd26b:: ds 1 wd26b:: ds 1
wd26c:: ds 1 wd26c:: ds 1
wd26d:: ds 4 wPokedexShowPointerBank::
wd26d:: ds 1
ds 3
wd271:: ds 5 wd271:: ds 5
OTPlayerID::
wd276:: ds 10 wd276:: ds 10
OTPartyCount:: ds 1 ; d280 OTPartyCount:: ds 1 ; d280