This commit is contained in:
dannye 2016-07-18 01:32:24 -05:00
commit 7c01509b6b
75 changed files with 983 additions and 868 deletions

View file

@ -6,19 +6,8 @@ MD5 := md5sum -c --quiet
pic := $(PYTHON) extras/pokemontools/pic.py compress pic := $(PYTHON) extras/pokemontools/pic.py compress
includes := $(PYTHON) extras/pokemontools/scan_includes.py includes := $(PYTHON) extras/pokemontools/scan_includes.py
base_obj := \ pokered_obj := audio_red.o main_red.o text_red.o wram_red.o
audio.o \ pokeblue_obj := audio_blue.o main_blue.o text_blue.o wram_blue.o
main.o \
text.o \
wram.o
red_obj := $(base_obj:.o=_red.o)
blue_obj := $(base_obj:.o=_blue.o)
all_obj := $(red_obj) $(blue_obj)
$(foreach obj, $(base_obj:.o=), \
$(eval $(obj)_dep := $(shell $(includes) $(obj).asm)) \
)
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .asm .o .gbc .png .2bpp .1bpp .pic .SUFFIXES: .asm .o .gbc .png .2bpp .1bpp .pic
@ -38,21 +27,24 @@ compare: red blue
@$(MD5) roms.md5 @$(MD5) roms.md5
clean: clean:
rm -f $(roms) $(all_obj) $(roms:.gbc=.sym) rm -f $(roms) $(pokered_obj) $(pokeblue_obj) $(roms:.gbc=.sym)
find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} + find . \( -iname '*.1bpp' -o -iname '*.2bpp' -o -iname '*.pic' \) -exec rm {} +
%.asm: ; %.asm: ;
$(red_obj): %_red.o: %.asm $$(%_dep)
rgbasm -D "_RED" -h -o $@ $*.asm
$(blue_obj): %_blue.o: %.asm $$(%_dep)
rgbasm -D "_BLUE" -h -o $@ $*.asm
dmg_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 %_red.o: dep = $(shell $(includes) $(@D)/$*.asm)
red_opt = $(dmg_opt) -t "POKEMON RED" $(pokered_obj): %_red.o: %.asm $$(dep)
blue_opt = $(dmg_opt) -t "POKEMON BLUE" rgbasm -D _RED -h -o $@ $*.asm
poke%.gbc: $$(%_obj) %_blue.o: dep = $(shell $(includes) $(@D)/$*.asm)
rgblink -n poke$*.sym -o $@ $^ $(pokeblue_obj): %_blue.o: %.asm $$(dep)
rgbasm -D _BLUE -h -o $@ $*.asm
pokered_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON RED"
pokeblue_opt = -jsv -k 01 -l 0x33 -m 0x13 -p 0 -r 03 -t "POKEMON BLUE"
%.gbc: $$(%_obj)
rgblink -n $*.sym -o $@ $^
rgbfix $($*_opt) $@ rgbfix $($*_opt) $@
%.png: ; %.png: ;

View file

@ -147,9 +147,16 @@ charmap "ゅ", $E1
charmap "ょ", $E2 charmap "ょ", $E2
charmap "ー", $E3 charmap "ー", $E3
charmap "<pkmn>", $4A ; PkMn
charmap "@", $50 charmap "@", $50
charmap "<PLAYER>", $52
charmap "<RIVAL>", $53
charmap "#", $54 charmap "#", $54
;charmap "POKé", $54 ;charmap "POKé", $54
charmap "<TARGET>", $59
charmap "<USER>", $5A
charmap "", $71
charmap "″", $73
charmap "№", $74 charmap "№", $74
charmap "…", $75 charmap "…", $75

View file

@ -30,3 +30,4 @@ INCLUDE "constants/tilesets.asm"
INCLUDE "constants/starter_mons.asm" INCLUDE "constants/starter_mons.asm"
INCLUDE "constants/event_constants.asm" INCLUDE "constants/event_constants.asm"
INCLUDE "constants/event_macros.asm" INCLUDE "constants/event_macros.asm"
INCLUDE "constants/text_constants.asm"

View file

@ -29,6 +29,16 @@ D_LEFT EQU %00100000
D_UP EQU %01000000 D_UP EQU %01000000
D_DOWN EQU %10000000 D_DOWN EQU %10000000
const_value set 0
const BIT_A_BUTTON
const BIT_B_BUTTON
const BIT_SELECT
const BIT_START
const BIT_D_RIGHT
const BIT_D_LEFT
const BIT_D_UP
const BIT_D_DOWN
SCREEN_WIDTH EQU 20 SCREEN_WIDTH EQU 20
SCREEN_HEIGHT EQU 18 SCREEN_HEIGHT EQU 18
@ -152,20 +162,6 @@ FLAG_RESET EQU 0
FLAG_SET EQU 1 FLAG_SET EQU 1
FLAG_TEST EQU 2 FLAG_TEST EQU 2
; special text IDs
TEXT_MON_FAINTED EQU $d0
TEXT_BLACKED_OUT EQU $d1
TEXT_REPEL_WORE_OFF EQU $d2
TEXT_SAFARI_GAME_OVER EQU $d3
; PrintNumber
BIT_LEFT_ALIGN EQU 6
BIT_LEADING_ZEROES EQU 7
LEFT_ALIGN EQU (1 << BIT_LEFT_ALIGN)
LEADING_ZEROES EQU (1 << BIT_LEADING_ZEROES)
; HP bar ; HP bar
HP_BAR_GREEN EQU 0 HP_BAR_GREEN EQU 0
HP_BAR_YELLOW EQU 1 HP_BAR_YELLOW EQU 1

View file

@ -0,0 +1,14 @@
; special text IDs
TEXT_MON_FAINTED EQU $d0
TEXT_BLACKED_OUT EQU $d1
TEXT_REPEL_WORE_OFF EQU $d2
TEXT_SAFARI_GAME_OVER EQU $d3
; PrintNumber
BIT_MONEY_SIGN EQU 5
BIT_LEFT_ALIGN EQU 6
BIT_LEADING_ZEROES EQU 7
MONEY_SIGN EQU (1 << BIT_MONEY_SIGN)
LEFT_ALIGN EQU (1 << BIT_LEFT_ALIGN)
LEADING_ZEROES EQU (1 << BIT_LEADING_ZEROES)

View file

@ -18,7 +18,7 @@ HallOfFamePC:
call FillFourRowsWithBlack call FillFourRowsWithBlack
coord hl, 0, 14 coord hl, 0, 14
call FillFourRowsWithBlack call FillFourRowsWithBlack
ld a, $c0 ld a, %11000000
ld [rBGP], a ld [rBGP], a
call EnableLCD call EnableLCD
ld a, $ff ld a, $ff
@ -36,13 +36,13 @@ HallOfFamePC:
FadeInCreditsText: FadeInCreditsText:
ld hl, HoFGBPalettes ld hl, HoFGBPalettes
ld b, 4 ld b, 4
.asm_740bf .loop
ld a, [hli] ld a, [hli]
ld [rBGP], a ld [rBGP], a
ld c, 5 ld c, 5
call DelayFrames call DelayFrames
dec b dec b
jr nz, .asm_740bf jr nz, .loop
ret ret
DisplayCreditsMon: DisplayCreditsMon:

View file

@ -383,29 +383,29 @@ MoveAnimation:
call SetAnimationPalette call SetAnimationPalette
ld a,[wAnimationID] ld a,[wAnimationID]
and a and a
jr z,.AnimationFinished jr z, .animationFinished
; if throwing a Poké Ball, skip the regular animation code ; if throwing a Poké Ball, skip the regular animation code
cp a,TOSS_ANIM cp a,TOSS_ANIM
jr nz,.MoveAnimation jr nz, .moveAnimation
ld de,.AnimationFinished ld de, .animationFinished
push de push de
jp TossBallAnimation jp TossBallAnimation
.MoveAnimation .moveAnimation
; check if battle animations are disabled in the options ; check if battle animations are disabled in the options
ld a,[wOptions] ld a,[wOptions]
bit 7,a bit 7,a
jr nz,.AnimationsDisabled jr nz, .animationsDisabled
call ShareMoveAnimations call ShareMoveAnimations
call PlayAnimation call PlayAnimation
jr .next4 jr .next4
.AnimationsDisabled .animationsDisabled
ld c,30 ld c,30
call DelayFrames call DelayFrames
.next4 .next4
call PlayApplyingAttackAnimation ; shake the screen or flash the pic in and out (to show damage) call PlayApplyingAttackAnimation ; shake the screen or flash the pic in and out (to show damage)
.AnimationFinished .animationFinished
call WaitForSoundToFinish call WaitForSoundToFinish
xor a xor a
ld [wSubAnimSubEntryAddr],a ld [wSubAnimSubEntryAddr],a
@ -431,13 +431,13 @@ ShareMoveAnimations:
cp a,AMNESIA cp a,AMNESIA
ld b,CONF_ANIM ld b,CONF_ANIM
jr z,.Replace jr z, .replaceAnim
cp a,REST cp a,REST
ld b,SLP_ANIM ld b,SLP_ANIM
ret nz ret nz
.Replace .replaceAnim
ld a,b ld a,b
ld [wAnimationID],a ld [wAnimationID],a
ret ret
@ -1845,13 +1845,13 @@ AnimationMinimizeMon:
ld hl, wTempPic ld hl, wTempPic
push hl push hl
xor a xor a
ld bc, $310 ld bc, 7 * 7 * $10
call FillMemory call FillMemory
pop hl pop hl
ld de, $194 ld de, $194
add hl, de add hl, de
ld de, MinimizedMonSprite ld de, MinimizedMonSprite
ld c, $5 ld c, MinimizedMonSpriteEnd - MinimizedMonSprite
.loop .loop
ld a, [de] ld a, [de]
ld [hli], a ld [hli], a
@ -1865,6 +1865,7 @@ AnimationMinimizeMon:
MinimizedMonSprite: MinimizedMonSprite:
INCBIN "gfx/minimized_mon_sprite.1bpp" INCBIN "gfx/minimized_mon_sprite.1bpp"
MinimizedMonSpriteEnd:
AnimationSlideMonDownAndHide: AnimationSlideMonDownAndHide:
; Slides the mon's sprite down and disappears. Used in Acid Armor. ; Slides the mon's sprite down and disappears. Used in Acid Armor.
@ -2308,7 +2309,6 @@ GetMoveSoundB:
ld b, a ld b, a
ret ret
; get the sound of the (move id - 1) in a
GetMoveSound: GetMoveSound:
ld hl,MoveSoundTable ld hl,MoveSoundTable
ld e,a ld e,a
@ -2363,6 +2363,7 @@ IsCryMove:
ret ret
MoveSoundTable: MoveSoundTable:
; ID, pitch mod, tempo mod
db SFX_POUND, $00,$80 ; POUND db SFX_POUND, $00,$80 ; POUND
db SFX_BATTLE_0C, $10,$80 ; KARATE_CHOP db SFX_BATTLE_0C, $10,$80 ; KARATE_CHOP
db SFX_DOUBLESLAP, $00,$80 ; DOUBLESLAP db SFX_DOUBLESLAP, $00,$80 ; DOUBLESLAP

View file

@ -443,7 +443,7 @@ MainInBattleLoop:
; the link battle enemy has switched mons ; the link battle enemy has switched mons
ld a, [wPlayerBattleStatus1] ld a, [wPlayerBattleStatus1]
bit UsingTrappingMove, a ; check if using multi-turn move like Wrap bit UsingTrappingMove, a ; check if using multi-turn move like Wrap
jr z, .asm_3c2dd jr z, .specialMoveNotUsed
ld a, [wPlayerMoveListIndex] ld a, [wPlayerMoveListIndex]
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
ld c, a ld c, a
@ -452,9 +452,9 @@ MainInBattleLoop:
ld a, [hl] ld a, [hl]
cp METRONOME ; a MIRROR MOVE check is missing, might lead to a desync in link battles cp METRONOME ; a MIRROR MOVE check is missing, might lead to a desync in link battles
; when combined with multi-turn moves ; when combined with multi-turn moves
jr nz, .asm_3c2dd jr nz, .specialMoveNotUsed
ld [wPlayerSelectedMove], a ld [wPlayerSelectedMove], a
.asm_3c2dd .specialMoveNotUsed
callab SwitchEnemyMon callab SwitchEnemyMon
.noLinkBattle .noLinkBattle
ld a, [wPlayerSelectedMove] ld a, [wPlayerSelectedMove]
@ -665,7 +665,7 @@ HandlePoisonBurnLeechSeed_DecreaseOwnHP:
and a and a
jr z, .playersTurn jr z, .playersTurn
ld hl, wEnemyBattleStatus3 ld hl, wEnemyBattleStatus3
ld de, wEnemyToxcCounter ld de, wEnemyToxicCounter
.playersTurn .playersTurn
bit BadlyPoisoned, [hl] bit BadlyPoisoned, [hl]
jr z, .noToxic jr z, .noToxic
@ -884,6 +884,8 @@ FaintEnemyPokemon:
ld a, MUSIC_DEFEATED_WILD_MON ld a, MUSIC_DEFEATED_WILD_MON
call PlayBattleVictoryMusic call PlayBattleVictoryMusic
.sfxplayed .sfxplayed
; bug: win sfx is played for wild battles before checking for player mon HP
; this can lead to odd scenarios where both player and enemy faint, as the win sfx plays yet the player never won the battle
ld hl, wBattleMonHP ld hl, wBattleMonHP
ld a, [hli] ld a, [hli]
or [hl] or [hl]
@ -1285,7 +1287,7 @@ SlideDownFaintedMonPic:
call CopyData call CopyData
pop de pop de
pop hl pop hl
ld bc, -20 ld bc, -SCREEN_WIDTH
add hl, bc add hl, bc
push hl push hl
ld h, d ld h, d
@ -1297,7 +1299,7 @@ SlideDownFaintedMonPic:
pop bc pop bc
dec b dec b
jr nz, .rowLoop jr nz, .rowLoop
ld bc, 20 ld bc, SCREEN_WIDTH
add hl, bc add hl, bc
ld de, SevenSpacesText ld de, SevenSpacesText
call PlaceString call PlaceString
@ -1925,9 +1927,9 @@ DrawPlayerHUDAndHPBar:
ld de, wLoadedMonStatus ld de, wLoadedMonStatus
call PrintStatusConditionNotFainted call PrintStatusConditionNotFainted
pop hl pop hl
jr nz, .asm_3cdae jr nz, .doNotPrintLevel
call PrintLevel call PrintLevel
.asm_3cdae .doNotPrintLevel
ld a, [wLoadedMonSpecies] ld a, [wLoadedMonSpecies]
ld [wcf91], a ld [wcf91], a
coord hl, 10, 9 coord hl, 10, 9
@ -1939,14 +1941,14 @@ DrawPlayerHUDAndHPBar:
ld hl, wBattleMonHP ld hl, wBattleMonHP
ld a, [hli] ld a, [hli]
or [hl] or [hl]
jr z, .asm_3cdd9 jr z, .fainted
ld a, [wLowHealthAlarmDisabled] ld a, [wLowHealthAlarmDisabled]
and a ; has the alarm been disabled because the player has already won? and a ; has the alarm been disabled because the player has already won?
ret nz ; if so, return ret nz ; if so, return
ld a, [wPlayerHPBarColor] ld a, [wPlayerHPBarColor]
cp HP_BAR_RED cp HP_BAR_RED
jr z, .asm_3cde6 jr z, .setLowHealthAlarm
.asm_3cdd9 .fainted
ld hl, wLowHealthAlarm ld hl, wLowHealthAlarm
bit 7, [hl] ;low health alarm enabled? bit 7, [hl] ;low health alarm enabled?
ld [hl], $0 ld [hl], $0
@ -1954,7 +1956,7 @@ DrawPlayerHUDAndHPBar:
xor a xor a
ld [wChannelSoundIDs + CH4], a ld [wChannelSoundIDs + CH4], a
ret ret
.asm_3cde6 .setLowHealthAlarm
ld hl, wLowHealthAlarm ld hl, wLowHealthAlarm
set 7, [hl] ;enable low health alarm set 7, [hl] ;enable low health alarm
ret ret
@ -2572,9 +2574,10 @@ MoveSelectionMenu:
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
call .loadmoves call .loadmoves
coord hl, 4, 12 coord hl, 4, 12
ld b, $4 ld b, 4
ld c, $e ld c, 14
di di ; out of pure coincidence, it is possible for vblank to occur between the di and ei
; so it is necessary to put the di ei block to not cause tearing
call TextBoxBorder call TextBoxBorder
coord hl, 4, 12 coord hl, 4, 12
ld [hl], $7a ld [hl], $7a
@ -2590,8 +2593,8 @@ MoveSelectionMenu:
ld hl, wEnemyMonMoves ld hl, wEnemyMonMoves
call .loadmoves call .loadmoves
coord hl, 0, 7 coord hl, 0, 7
ld b, $4 ld b, 4
ld c, $e ld c, 14
call TextBoxBorder call TextBoxBorder
coord hl, 2, 8 coord hl, 2, 8
call .writemoves call .writemoves
@ -2605,8 +2608,8 @@ MoveSelectionMenu:
call AddNTimes call AddNTimes
call .loadmoves call .loadmoves
coord hl, 4, 7 coord hl, 4, 7
ld b, $4 ld b, 4
ld c, $e ld c, 14
call TextBoxBorder call TextBoxBorder
coord hl, 6, 8 coord hl, 6, 8
call .writemoves call .writemoves
@ -2688,9 +2691,9 @@ SelectMenuItem:
ld hl, hFlags_0xFFF6 ld hl, hFlags_0xFFF6
res 1, [hl] res 1, [hl]
bit 6, a bit 6, a
jp nz, CursorUp ; up jp nz, SelectMenuItem_CursorUp ; up
bit 7, a bit 7, a
jp nz, CursorDown ; down jp nz, SelectMenuItem_CursorDown ; down
bit 2, a bit 2, a
jp nz, SwapMovesInMenu ; select jp nz, SwapMovesInMenu ; select
bit 1, a ; B, but was it reset above? bit 1, a ; B, but was it reset above?
@ -2703,10 +2706,10 @@ SelectMenuItem:
ld b, a ld b, a
ld a, [wMoveMenuType] ld a, [wMoveMenuType]
dec a ; if not mimic dec a ; if not mimic
jr nz, .nob jr nz, .notB
pop af pop af
ret ret
.nob .notB
dec a dec a
ld a, b ld a, b
ld [wPlayerMoveListIndex], a ld [wPlayerMoveListIndex], a
@ -2723,7 +2726,7 @@ SelectMenuItem:
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and $3f and $3f
jr z, .nopp jr z, .noPP
ld a, [wPlayerDisabledMove] ld a, [wPlayerDisabledMove]
swap a swap a
and $f and $f
@ -2746,7 +2749,7 @@ SelectMenuItem:
.disabled .disabled
ld hl, MoveDisabledText ld hl, MoveDisabledText
jr .print jr .print
.nopp .noPP
ld hl, MoveNoPPText ld hl, MoveNoPPText
.print .print
call PrintText call PrintText
@ -2764,7 +2767,7 @@ MoveDisabledText:
WhichTechniqueString: WhichTechniqueString:
db "WHICH TECHNIQUE?@" db "WHICH TECHNIQUE?@"
CursorUp: SelectMenuItem_CursorUp:
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
and a and a
jp nz, SelectMenuItem jp nz, SelectMenuItem
@ -2774,7 +2777,7 @@ CursorUp:
ld [wCurrentMenuItem], a ld [wCurrentMenuItem], a
jp SelectMenuItem jp SelectMenuItem
CursorDown: SelectMenuItem_CursorDown:
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
ld b, a ld b, a
ld a, [wNumMovesMinusOne] ld a, [wNumMovesMinusOne]
@ -2794,7 +2797,7 @@ AnyMoveToSelect:
ld a, [wPlayerDisabledMove] ld a, [wPlayerDisabledMove]
and a and a
ld hl, wBattleMonPP ld hl, wBattleMonPP
jr nz, .asm_3d40e jr nz, .handleDisabledMove
ld a, [hli] ld a, [hli]
or [hl] or [hl]
inc hl inc hl
@ -2803,26 +2806,26 @@ AnyMoveToSelect:
or [hl] or [hl]
and $3f and $3f
ret nz ret nz
jr .asm_3d423 jr .noMovesLeft
.asm_3d40e .handleDisabledMove
swap a swap a
and $f and $f ; get disabled move
ld b, a ld b, a
ld d, $5 ld d, NUM_MOVES + 1
xor a xor a
.asm_3d416 .handleDisabledMovePPLoop
dec d dec d
jr z, .asm_3d421 jr z, .allMovesChecked
ld c, [hl] ld c, [hl] ; get move PP
inc hl inc hl
dec b dec b ; is this the disabled move?
jr z, .asm_3d416 jr z, .handleDisabledMovePPLoop ; if so, ignore its PP value
or c or c
jr .asm_3d416 jr .handleDisabledMovePPLoop
.asm_3d421 .allMovesChecked
and a and a ; any PP left?
ret nz ret nz ; return if a move has PP left
.asm_3d423 .noMovesLeft
ld hl, NoMovesLeftText ld hl, NoMovesLeftText
call PrintText call PrintText
ld c, 60 ld c, 60
@ -2914,8 +2917,8 @@ PrintMenuItem:
xor a xor a
ld [H_AUTOBGTRANSFERENABLED], a ld [H_AUTOBGTRANSFERENABLED], a
coord hl, 0, 8 coord hl, 0, 8
ld b, $3 ld b, 3
ld c, $9 ld c, 9
call TextBoxBorder call TextBoxBorder
ld a, [wPlayerDisabledMove] ld a, [wPlayerDisabledMove]
and a and a
@ -2997,7 +3000,7 @@ SelectEnemyMove:
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
ld a, [wSerialExchangeNybbleReceiveData] ld a, [wSerialExchangeNybbleReceiveData]
cp $e cp $e
jp z, .asm_3d601 jp z, .linkedOpponentUsedStruggle
cp $d cp $d
jr z, .unableToSelectMove jr z, .unableToSelectMove
cp $4 cp $4
@ -3075,7 +3078,7 @@ SelectEnemyMove:
.done .done
ld [wEnemySelectedMove], a ld [wEnemySelectedMove], a
ret ret
.asm_3d601 .linkedOpponentUsedStruggle
ld a, STRUGGLE ld a, STRUGGLE
jr .done jr .done
@ -3205,7 +3208,7 @@ PlayerCalcMoveDamage:
call RandomizeDamage call RandomizeDamage
.moveHitTest .moveHitTest
call MoveHitTest call MoveHitTest
handleIfPlayerMoveMissed handleIfPlayerMoveMissed:
ld a,[wMoveMissed] ld a,[wMoveMissed]
and a and a
jr z,getPlayerAnimationType jr z,getPlayerAnimationType
@ -3213,13 +3216,13 @@ handleIfPlayerMoveMissed
sub a,EXPLODE_EFFECT sub a,EXPLODE_EFFECT
jr z,playPlayerMoveAnimation ; don't play any animation if the move missed, unless it was EXPLODE_EFFECT jr z,playPlayerMoveAnimation ; don't play any animation if the move missed, unless it was EXPLODE_EFFECT
jr playerCheckIfFlyOrChargeEffect jr playerCheckIfFlyOrChargeEffect
getPlayerAnimationType getPlayerAnimationType:
ld a,[wPlayerMoveEffect] ld a,[wPlayerMoveEffect]
and a and a
ld a,4 ; move has no effect other than dealing damage ld a,4 ; move has no effect other than dealing damage
jr z,playPlayerMoveAnimation jr z,playPlayerMoveAnimation
ld a,5 ; move has effect ld a,5 ; move has effect
playPlayerMoveAnimation playPlayerMoveAnimation:
push af push af
ld a,[wPlayerBattleStatus2] ld a,[wPlayerBattleStatus2]
bit HasSubstituteUp,a bit HasSubstituteUp,a
@ -3238,7 +3241,7 @@ playPlayerMoveAnimation
ld b,BANK(ReshowSubstituteAnim) ld b,BANK(ReshowSubstituteAnim)
call nz,Bankswitch call nz,Bankswitch
jr MirrorMoveCheck jr MirrorMoveCheck
playerCheckIfFlyOrChargeEffect playerCheckIfFlyOrChargeEffect:
ld c,30 ld c,30
call DelayFrames call DelayFrames
ld a,[wPlayerMoveEffect] ld a,[wPlayerMoveEffect]
@ -3252,7 +3255,7 @@ playerCheckIfFlyOrChargeEffect
ld [wAnimationType],a ld [wAnimationType],a
ld a,STATUS_AFFECTED_ANIM ld a,STATUS_AFFECTED_ANIM
call PlayMoveAnimation call PlayMoveAnimation
MirrorMoveCheck MirrorMoveCheck:
ld a,[wPlayerMoveEffect] ld a,[wPlayerMoveEffect]
cp a,MIRROR_MOVE_EFFECT cp a,MIRROR_MOVE_EFFECT
jr nz,.metronomeCheck jr nz,.metronomeCheck
@ -3785,10 +3788,10 @@ MonName1Text:
and a and a
ld a, [wPlayerMoveNum] ld a, [wPlayerMoveNum]
ld hl, wPlayerUsedMove ld hl, wPlayerUsedMove
jr z, .asm_3db11 jr z, .playerTurn
ld a, [wEnemyMoveNum] ld a, [wEnemyMoveNum]
ld hl, wEnemyUsedMove ld hl, wEnemyUsedMove
.asm_3db11 .playerTurn
ld [hl], a ld [hl], a
ld [wd11e], a ld [wd11e], a
call DetermineExclamationPointTextNum call DetermineExclamationPointTextNum
@ -4682,9 +4685,9 @@ CriticalHitTest:
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld a, [wEnemyMonSpecies] ld a, [wEnemyMonSpecies]
jr nz, .asm_3e032 jr nz, .handleEnemy
ld a, [wBattleMonSpecies] ld a, [wBattleMonSpecies]
.asm_3e032 .handleEnemy
ld [wd0b5], a ld [wd0b5], a
call GetMonHeader call GetMonHeader
ld a, [wMonHBaseSpeed] ld a, [wMonHBaseSpeed]
@ -5051,7 +5054,7 @@ ApplyDamageToPlayerPokemon:
ld a,$01 ld a,$01
ld [wHPBarType],a ld [wHPBarType],a
predef UpdateHPBar2 ; animate the HP bar shortening predef UpdateHPBar2 ; animate the HP bar shortening
ApplyAttackToPlayerPokemonDone ApplyAttackToPlayerPokemonDone:
jp DrawHUDsAndHPBars jp DrawHUDsAndHPBars
AttackSubstitute: AttackSubstitute:
@ -5751,12 +5754,12 @@ EnemyMoveHitTest:
handleIfEnemyMoveMissed: handleIfEnemyMoveMissed:
ld a, [wMoveMissed] ld a, [wMoveMissed]
and a and a
jr z, .asm_3e791 jr z, .moveDidNotMiss
ld a, [wEnemyMoveEffect] ld a, [wEnemyMoveEffect]
cp EXPLODE_EFFECT cp EXPLODE_EFFECT
jr z, asm_3e7a0 jr z, handleExplosionMiss
jr EnemyCheckIfFlyOrChargeEffect jr EnemyCheckIfFlyOrChargeEffect
.asm_3e791 .moveDidNotMiss
call SwapPlayerAndEnemyLevels call SwapPlayerAndEnemyLevels
GetEnemyAnimationType: GetEnemyAnimationType:
@ -5766,7 +5769,7 @@ GetEnemyAnimationType:
jr z, playEnemyMoveAnimation jr z, playEnemyMoveAnimation
ld a, $2 ld a, $2
jr playEnemyMoveAnimation jr playEnemyMoveAnimation
asm_3e7a0: handleExplosionMiss:
call SwapPlayerAndEnemyLevels call SwapPlayerAndEnemyLevels
xor a xor a
playEnemyMoveAnimation: playEnemyMoveAnimation:
@ -5824,19 +5827,19 @@ EnemyCheckIfMirrorMoveEffect:
jp c, JumpMoveEffect jp c, JumpMoveEffect
ld a, [wMoveMissed] ld a, [wMoveMissed]
and a and a
jr z, .asm_3e82b jr z, .moveDidNotMiss
call PrintMoveFailureText call PrintMoveFailureText
ld a, [wEnemyMoveEffect] ld a, [wEnemyMoveEffect]
cp EXPLODE_EFFECT cp EXPLODE_EFFECT
jr z, .asm_3e83e jr z, .handleExplosionMiss
jp ExecuteEnemyMoveDone jp ExecuteEnemyMoveDone
.asm_3e82b .moveDidNotMiss
call ApplyAttackToPlayerPokemon call ApplyAttackToPlayerPokemon
call PrintCriticalOHKOText call PrintCriticalOHKOText
callab DisplayEffectiveness callab DisplayEffectiveness
ld a, 1 ld a, 1
ld [wMoveDidntMiss], a ld [wMoveDidntMiss], a
.asm_3e83e .handleExplosionMiss
ld a, [wEnemyMoveEffect] ld a, [wEnemyMoveEffect]
ld hl, AlwaysHappenSideEffects ld hl, AlwaysHappenSideEffects
ld de, $1 ld de, $1
@ -5850,7 +5853,7 @@ EnemyCheckIfMirrorMoveEffect:
call HandleBuildingRage call HandleBuildingRage
ld hl, wEnemyBattleStatus1 ld hl, wEnemyBattleStatus1
bit AttackingMultipleTimes, [hl] ; is mon hitting multiple times? (example: double kick) bit AttackingMultipleTimes, [hl] ; is mon hitting multiple times? (example: double kick)
jr z, .asm_3e873 jr z, .notMultiHitMove
push hl push hl
ld hl, wEnemyNumAttacksLeft ld hl, wEnemyNumAttacksLeft
dec [hl] dec [hl]
@ -5861,7 +5864,7 @@ EnemyCheckIfMirrorMoveEffect:
call PrintText call PrintText
xor a xor a
ld [wEnemyNumHits], a ld [wEnemyNumHits], a
.asm_3e873 .notMultiHitMove
ld a, [wEnemyMoveEffect] ld a, [wEnemyMoveEffect]
and a and a
jr z, ExecuteEnemyMoveDone jr z, ExecuteEnemyMoveDone
@ -6801,16 +6804,16 @@ HandleExplodingAnimation:
ld hl, wEnemyMonType1 ld hl, wEnemyMonType1
ld de, wEnemyBattleStatus1 ld de, wEnemyBattleStatus1
ld a, [wPlayerMoveNum] ld a, [wPlayerMoveNum]
jr z, .asm_3eeea jr z, .player
ld hl, wBattleMonType1 ld hl, wBattleMonType1
ld de, wEnemyBattleStatus1 ld de, wEnemyBattleStatus1
ld a, [wEnemyMoveNum] ld a, [wEnemyMoveNum]
.asm_3eeea .player
cp SELFDESTRUCT cp SELFDESTRUCT
jr z, .asm_3eef1 jr z, .isExplodingMove
cp EXPLOSION cp EXPLOSION
ret nz ret nz
.asm_3eef1 .isExplodingMove
ld a, [de] ld a, [de]
bit Invulnerable, a ; fly/dig bit Invulnerable, a ; fly/dig
ret nz ret nz
@ -7333,7 +7336,7 @@ PoisonEffect:
jr nz, .ok jr nz, .ok
ld b, ANIM_A9 ld b, ANIM_A9
ld hl, wEnemyBattleStatus3 ld hl, wEnemyBattleStatus3
ld de, wEnemyToxcCounter ld de, wEnemyToxicCounter
.ok .ok
cp TOXIC cp TOXIC
jr nz, .normalPoison ; done if move is not Toxic jr nz, .normalPoison ; done if move is not Toxic
@ -7341,18 +7344,18 @@ PoisonEffect:
xor a xor a
ld [de], a ld [de], a
ld hl, BadlyPoisonedText ld hl, BadlyPoisonedText
jr .asm_3f2c0 jr .continue
.normalPoison .normalPoison
ld hl, PoisonedText ld hl, PoisonedText
.asm_3f2c0 .continue
pop de pop de
ld a, [de] ld a, [de]
cp POISON_EFFECT cp POISON_EFFECT
jr z, .asm_3f2cd jr z, .regularPoisonEffect
ld a, b ld a, b
call PlayBattleAnimation2 call PlayBattleAnimation2
jp PrintText jp PrintText
.asm_3f2cd .regularPoisonEffect
call PlayCurrentMoveAnimation2 call PlayCurrentMoveAnimation2
jp PrintText jp PrintText
.noEffect .noEffect
@ -7717,9 +7720,9 @@ MonsStatsRoseText:
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld a, [wPlayerMoveEffect] ld a, [wPlayerMoveEffect]
jr z, .asm_3f53b jr z, .playerTurn
ld a, [wEnemyMoveEffect] ld a, [wEnemyMoveEffect]
.asm_3f53b .playerTurn
cp ATTACK_DOWN1_EFFECT cp ATTACK_DOWN1_EFFECT
ret nc ret nc
ld hl, RoseText ld hl, RoseText
@ -7728,7 +7731,7 @@ MonsStatsRoseText:
GreatlyRoseText: GreatlyRoseText:
TX_DELAY TX_DELAY
TX_FAR _GreatlyRoseText TX_FAR _GreatlyRoseText
; fallthrough
RoseText: RoseText:
TX_FAR _RoseText TX_FAR _RoseText
db "@" db "@"
@ -7817,9 +7820,9 @@ StatModifierDownEffect:
ld a, c ld a, c
add e add e
ld e, a ld e, a
jr nc, .asm_3f5e4 jr nc, .noCarry
inc d ; de = unmodified stat inc d ; de = unmodified stat
.asm_3f5e4 .noCarry
pop bc pop bc
ld a, [hld] ld a, [hld]
sub $1 ; can't lower stat below 1 (-6) sub $1 ; can't lower stat below 1 (-6)
@ -7919,12 +7922,13 @@ MonsStatsFellText:
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld a, [wPlayerMoveEffect] ld a, [wPlayerMoveEffect]
jr z, .asm_3f674 jr z, .playerTurn
ld a, [wEnemyMoveEffect] ld a, [wEnemyMoveEffect]
.asm_3f674 .playerTurn
cp $1a ; check if the move's effect decreases a stat by 2
cp BIDE_EFFECT
ret c ret c
cp $44 cp ATTACK_DOWN_SIDE_EFFECT
ret nc ret nc
ld hl, GreatlyFellText ld hl, GreatlyFellText
ret ret
@ -7932,7 +7936,7 @@ MonsStatsFellText:
GreatlyFellText: GreatlyFellText:
TX_DELAY TX_DELAY
TX_FAR _GreatlyFellText TX_FAR _GreatlyFellText
; fallthrough
FellText: FellText:
TX_FAR _FellText TX_FAR _FellText
db "@" db "@"
@ -7940,15 +7944,15 @@ FellText:
PrintStatText: PrintStatText:
ld hl, StatsTextStrings ld hl, StatsTextStrings
ld c, "@" ld c, "@"
.asm_3f68d .findStatName_outer
dec b dec b
jr z, .asm_3f696 jr z, .foundStatName
.asm_3f690 .findStatName_inner
ld a, [hli] ld a, [hli]
cp c cp c
jr z, .asm_3f68d jr z, .findStatName_outer
jr .asm_3f690 jr .findStatName_inner
.asm_3f696 .foundStatName
ld de, wcf4b ld de, wcf4b
ld bc, $a ld bc, $a
jp CopyData jp CopyData
@ -8026,41 +8030,42 @@ ThrashPetalDanceEffect:
SwitchAndTeleportEffect: SwitchAndTeleportEffect:
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr nz, .asm_3f791 jr nz, .handleEnemy
ld a, [wIsInBattle] ld a, [wIsInBattle]
dec a dec a
jr nz, .asm_3f77e jr nz, .notWildBattle1
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLVL]
ld b, a ld b, a
ld a, [wBattleMonLevel] ld a, [wBattleMonLevel]
cp b cp b ; is the player's level greater than the enemy's level?
jr nc, .asm_3f76e jr nc, .playerMoveWasSuccessful ; if so, teleport will always succeed
add b add b
ld c, a ld c, a
inc c inc c ; c = sum of player level and enemy level
.asm_3f751 .rejectionSampleLoop1
call BattleRandom call BattleRandom
cp c cp c ; get a random number between 0 and c
jr nc, .asm_3f751 jr nc, .rejectionSampleLoop1
srl b srl b
srl b srl b ; b = enemy level * 4
cp b ; bug: does not account for overflow, so levels above 63 can lead to erroneousness results
jr nc, .asm_3f76e cp b ; is rand[0, playerLevel + enemyLevel] > enemyLevel?
jr nc, .playerMoveWasSuccessful ; if so, allow teleporting
ld c, 50 ld c, 50
call DelayFrames call DelayFrames
ld a, [wPlayerMoveNum] ld a, [wPlayerMoveNum]
cp TELEPORT cp TELEPORT
jp nz, PrintDidntAffectText jp nz, PrintDidntAffectText
jp PrintButItFailedText_ jp PrintButItFailedText_
.asm_3f76e .playerMoveWasSuccessful
call ReadPlayerMonCurHPAndStatus call ReadPlayerMonCurHPAndStatus
xor a xor a
ld [wAnimationType], a ld [wAnimationType], a
inc a inc a
ld [wEscapedFromBattle], a ld [wEscapedFromBattle], a
ld a, [wPlayerMoveNum] ld a, [wPlayerMoveNum]
jr .asm_3f7e4 jr .playAnimAndPrintText
.asm_3f77e .notWildBattle1
ld c, 50 ld c, 50
call DelayFrames call DelayFrames
ld hl, IsUnaffectedText ld hl, IsUnaffectedText
@ -8068,41 +8073,41 @@ SwitchAndTeleportEffect:
cp TELEPORT cp TELEPORT
jp nz, PrintText jp nz, PrintText
jp PrintButItFailedText_ jp PrintButItFailedText_
.asm_3f791 .handleEnemy
ld a, [wIsInBattle] ld a, [wIsInBattle]
dec a dec a
jr nz, .asm_3f7d1 jr nz, .notWildBattle2
ld a, [wBattleMonLevel] ld a, [wBattleMonLevel]
ld b, a ld b, a
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLVL]
cp b cp b
jr nc, .asm_3f7c1 jr nc, .enemyMoveWasSuccessful
add b add b
ld c, a ld c, a
inc c inc c
.asm_3f7a4 .rejectionSampleLoop2
call BattleRandom call BattleRandom
cp c cp c
jr nc, .asm_3f7a4 jr nc, .rejectionSampleLoop2
srl b srl b
srl b srl b
cp b cp b
jr nc, .asm_3f7c1 jr nc, .enemyMoveWasSuccessful
ld c, 50 ld c, 50
call DelayFrames call DelayFrames
ld a, [wEnemyMoveNum] ld a, [wEnemyMoveNum]
cp TELEPORT cp TELEPORT
jp nz, PrintDidntAffectText jp nz, PrintDidntAffectText
jp PrintButItFailedText_ jp PrintButItFailedText_
.asm_3f7c1 .enemyMoveWasSuccessful
call ReadPlayerMonCurHPAndStatus call ReadPlayerMonCurHPAndStatus
xor a xor a
ld [wAnimationType], a ld [wAnimationType], a
inc a inc a
ld [wEscapedFromBattle], a ld [wEscapedFromBattle], a
ld a, [wEnemyMoveNum] ld a, [wEnemyMoveNum]
jr .asm_3f7e4 jr .playAnimAndPrintText
.asm_3f7d1 .notWildBattle2
ld c, 50 ld c, 50
call DelayFrames call DelayFrames
ld hl, IsUnaffectedText ld hl, IsUnaffectedText
@ -8110,7 +8115,7 @@ SwitchAndTeleportEffect:
cp TELEPORT cp TELEPORT
jp nz, PrintText jp nz, PrintText
jp ConditionalPrintButItFailed jp ConditionalPrintButItFailed
.asm_3f7e4 .playAnimAndPrintText
push af push af
call PlayBattleAnimation call PlayBattleAnimation
ld c, 20 ld c, 20
@ -8118,12 +8123,12 @@ SwitchAndTeleportEffect:
pop af pop af
ld hl, RanFromBattleText ld hl, RanFromBattleText
cp TELEPORT cp TELEPORT
jr z, .asm_3f7ff jr z, .printText
ld hl, RanAwayScaredText ld hl, RanAwayScaredText
cp ROAR cp ROAR
jr z, .asm_3f7ff jr z, .printText
ld hl, WasBlownAwayText ld hl, WasBlownAwayText
.asm_3f7ff .printText
jp PrintText jp PrintText
RanFromBattleText: RanFromBattleText:
@ -8168,10 +8173,11 @@ TwoToFiveAttacksEffect:
call BattleRandom call BattleRandom
and $3 and $3
cp $2 cp $2
jr c, .asm_3f851 jr c, .gotNumHits
; if the number of hits was greater than 2, re-roll again for a lower chance
call BattleRandom call BattleRandom
and $3 and $3
.asm_3f851 .gotNumHits
inc a inc a
inc a inc a
.saveNumberOfHits .saveNumberOfHits
@ -8250,22 +8256,22 @@ ChargeMoveEffectText:
ld a, [wChargeMoveNum] ld a, [wChargeMoveNum]
cp RAZOR_WIND cp RAZOR_WIND
ld hl, MadeWhirlwindText ld hl, MadeWhirlwindText
jr z, .asm_3f8f8 jr z, .gotText
cp SOLARBEAM cp SOLARBEAM
ld hl, TookInSunlightText ld hl, TookInSunlightText
jr z, .asm_3f8f8 jr z, .gotText
cp SKULL_BASH cp SKULL_BASH
ld hl, LoweredItsHeadText ld hl, LoweredItsHeadText
jr z, .asm_3f8f8 jr z, .gotText
cp SKY_ATTACK cp SKY_ATTACK
ld hl, SkyAttackGlowingText ld hl, SkyAttackGlowingText
jr z, .asm_3f8f8 jr z, .gotText
cp FLY cp FLY
ld hl, FlewUpHighText ld hl, FlewUpHighText
jr z, .asm_3f8f8 jr z, .gotText
cp DIG cp DIG
ld hl, DugAHoleText ld hl, DugAHoleText
.asm_3f8f8 .gotText
ret ret
MadeWhirlwindText: MadeWhirlwindText:
@ -8328,7 +8334,7 @@ RecoilEffect:
ConfusionSideEffect: ConfusionSideEffect:
call BattleRandom call BattleRandom
cp $19 cp $19 ; ~10% chance
ret nc ret nc
jr ConfusionSideEffectSuccess jr ConfusionSideEffectSuccess
@ -8398,9 +8404,9 @@ ClearHyperBeam:
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
jr z, .asm_3f9db jr z, .playerTurn
ld hl, wPlayerBattleStatus2 ld hl, wPlayerBattleStatus2
.asm_3f9db .playerTurn
res NeedsToRecharge, [hl] ; mon no longer needs to recharge res NeedsToRecharge, [hl] ; mon no longer needs to recharge
pop hl pop hl
ret ret
@ -8421,21 +8427,21 @@ MimicEffect:
call MoveHitTest call MoveHitTest
ld a, [wMoveMissed] ld a, [wMoveMissed]
and a and a
jr nz, .asm_3fa74 jr nz, .mimicMissed
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
ld a, [wPlayerBattleStatus1] ld a, [wPlayerBattleStatus1]
jr nz, .asm_3fa13 jr nz, .enemyTurn
ld a, [wLinkState] ld a, [wLinkState]
cp LINK_STATE_BATTLING cp LINK_STATE_BATTLING
jr nz, .asm_3fa3a jr nz, .letPlayerChooseMove
ld hl, wEnemyMonMoves ld hl, wEnemyMonMoves
ld a, [wEnemyBattleStatus1] ld a, [wEnemyBattleStatus1]
.asm_3fa13 .enemyTurn
bit Invulnerable, a bit Invulnerable, a
jr nz, .asm_3fa74 jr nz, .mimicMissed
.asm_3fa17 .getRandomMove
push hl push hl
call BattleRandom call BattleRandom
and $3 and $3
@ -8445,20 +8451,20 @@ MimicEffect:
ld a, [hl] ld a, [hl]
pop hl pop hl
and a and a
jr z, .asm_3fa17 jr z, .getRandomMove
ld d, a ld d, a
ld a, [H_WHOSETURN] ld a, [H_WHOSETURN]
and a and a
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
ld a, [wPlayerMoveListIndex] ld a, [wPlayerMoveListIndex]
jr z, .asm_3fa5f jr z, .playerTurn
ld hl, wEnemyMonMoves ld hl, wEnemyMonMoves
ld a, [wEnemyMoveListIndex] ld a, [wEnemyMoveListIndex]
jr .asm_3fa5f jr .playerTurn
.asm_3fa3a .letPlayerChooseMove
ld a, [wEnemyBattleStatus1] ld a, [wEnemyBattleStatus1]
bit Invulnerable, a bit Invulnerable, a
jr nz, .asm_3fa74 jr nz, .mimicMissed
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
push af push af
ld a, $1 ld a, $1
@ -8473,7 +8479,7 @@ MimicEffect:
ld d, [hl] ld d, [hl]
pop af pop af
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
.asm_3fa5f .playerTurn
ld c, a ld c, a
ld b, $0 ld b, $0
add hl, bc add hl, bc
@ -8484,7 +8490,7 @@ MimicEffect:
call PlayCurrentMoveAnimation call PlayCurrentMoveAnimation
ld hl, MimicLearnedMoveText ld hl, MimicLearnedMoveText
jp PrintText jp PrintText
.asm_3fa74 .mimicMissed
jp PrintButItFailedText_ jp PrintButItFailedText_
MimicLearnedMoveText: MimicLearnedMoveText:

View file

@ -33,7 +33,7 @@ DecrementPP:
ld a, [wPlayerMonNumber] ; which mon in party is active ld a, [wPlayerMonNumber] ; which mon in party is active
ld bc, wPartyMon2 - wPartyMon1 ld bc, wPartyMon2 - wPartyMon1
call AddNTimes ; calculate address of the mon to modify call AddNTimes ; calculate address of the mon to modify
.DecrementPP .DecrementPP:
ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use? ld a, [wPlayerMoveListIndex] ; which move (0, 1, 2, 3) did we use?
ld c, a ld c, a
ld b, 0 ld b, 0

View file

@ -49,11 +49,11 @@ GainExperience:
ld [de], a ld [de], a
.nextBaseStat .nextBaseStat
dec c dec c
jr z, .asm_552a1 jr z, .statExpDone
inc de inc de
inc de inc de
jr .gainStatExpLoop jr .gainStatExpLoop
.asm_552a1 .statExpDone
xor a xor a
ld [H_MULTIPLICAND], a ld [H_MULTIPLICAND], a
ld [H_MULTIPLICAND + 1], a ld [H_MULTIPLICAND + 1], a

View file

@ -2,15 +2,15 @@ GetTrainerName_:
ld hl, wGrassRate ld hl, wGrassRate
ld a, [wLinkState] ld a, [wLinkState]
and a and a
jr nz, .rival jr nz, .foundName
ld hl, wRivalName ld hl, wRivalName
ld a, [wTrainerClass] ld a, [wTrainerClass]
cp SONY1 cp SONY1
jr z, .rival jr z, .foundName
cp SONY2 cp SONY2
jr z, .rival jr z, .foundName
cp SONY3 cp SONY3
jr z, .rival jr z, .foundName
ld [wd0b5], a ld [wd0b5], a
ld a, TRAINER_NAME ld a, TRAINER_NAME
ld [wNameListType], a ld [wNameListType], a
@ -18,7 +18,7 @@ GetTrainerName_:
ld [wPredefBank], a ld [wPredefBank], a
call GetName call GetName
ld hl, wcd6d ld hl, wcd6d
.rival .foundName
ld de, wTrainerName ld de, wTrainerName
ld bc, $d ld bc, $d
jp CopyData jp CopyData

View file

@ -2,8 +2,8 @@
DisplayLinkBattleVersusTextBox: DisplayLinkBattleVersusTextBox:
call LoadTextBoxTilePatterns call LoadTextBoxTilePatterns
coord hl, 3, 4 coord hl, 3, 4
ld b, $7 ld b, 7
ld c, $c ld c, 12
call TextBoxBorder call TextBoxBorder
coord hl, 4, 5 coord hl, 4, 5
ld de, wPlayerName ld de, wPlayerName

View file

@ -182,7 +182,7 @@ AIMoveChoiceModification2:
jr c, .preferMove jr c, .preferMove
jr .nextMove jr .nextMove
.preferMove .preferMove
dec [hl] ; sligthly encourage this move dec [hl] ; slightly encourage this move
jr .nextMove jr .nextMove
; encourages moves that are effective against the player's mon (even if non-damaging). ; encourages moves that are effective against the player's mon (even if non-damaging).

View file

@ -27,10 +27,10 @@ CableClub_DoBattleOrTradeAgain:
ld hl, wSerialPlayerDataBlock ld hl, wSerialPlayerDataBlock
ld a, SERIAL_PREAMBLE_BYTE ld a, SERIAL_PREAMBLE_BYTE
ld b, 6 ld b, 6
.writePlayeDataBlockPreambleLoop .writePlayerDataBlockPreambleLoop
ld [hli], a ld [hli], a
dec b dec b
jr nz, .writePlayeDataBlockPreambleLoop jr nz, .writePlayerDataBlockPreambleLoop
ld hl, wSerialRandomNumberListBlock ld hl, wSerialRandomNumberListBlock
ld a, SERIAL_PREAMBLE_BYTE ld a, SERIAL_PREAMBLE_BYTE
ld b, 7 ld b, 7
@ -271,7 +271,7 @@ CableClub_DoBattleOrTradeAgain:
cp LINK_STATE_START_BATTLE cp LINK_STATE_START_BATTLE
ld a, LINK_STATE_TRADING ld a, LINK_STATE_TRADING
ld [wLinkState], a ld [wLinkState], a
jr nz, .asm_5506 jr nz, .trading
ld a, LINK_STATE_BATTLING ld a, LINK_STATE_BATTLING
ld [wLinkState], a ld [wLinkState], a
ld a, OPP_SONY1 ld a, OPP_SONY1
@ -283,7 +283,7 @@ CableClub_DoBattleOrTradeAgain:
predef InitOpponent predef InitOpponent
predef HealParty predef HealParty
jp ReturnToCableClubRoom jp ReturnToCableClubRoom
.asm_5506 .trading
ld c, BANK(Music_GameCorner) ld c, BANK(Music_GameCorner)
ld a, MUSIC_GAME_CORNER ld a, MUSIC_GAME_CORNER
call PlayMusic call PlayMusic
@ -900,16 +900,16 @@ CableClub_Run:
call CableClub_DoBattleOrTrade call CableClub_DoBattleOrTrade
ld hl, Club_GFX ld hl, Club_GFX
ld a, h ld a, h
ld [wTileSetGFXPtr + 1], a ld [wTilesetGfxPtr + 1], a
ld a, l ld a, l
ld [wTileSetGFXPtr], a ld [wTilesetGfxPtr], a
ld a, Bank(Club_GFX) ld a, Bank(Club_GFX)
ld [wTileSetBank], a ld [wTilesetBank], a
ld hl, Club_Coll ld hl, Club_Coll
ld a, h ld a, h
ld [wTileSetCollisionPtr + 1], a ld [wTilesetCollisionPtr + 1], a
ld a, l ld a, l
ld [wTileSetCollisionPtr], a ld [wTilesetCollisionPtr], a
xor a xor a
ld [wGrassRate], a ld [wGrassRate], a
inc a ; LINK_STATE_IN_CABLE_CLUB inc a ; LINK_STATE_IN_CABLE_CLUB
@ -964,8 +964,8 @@ CableClub_TextBoxBorder:
; c = width ; c = width
CableClub_DrawHorizontalLine: CableClub_DrawHorizontalLine:
ld d, c ld d, c
.asm_5ae1 .loop
ld [hli], a ld [hli], a
dec d dec d
jr nz, .asm_5ae1 jr nz, .loop
ret ret

View file

@ -199,7 +199,6 @@ MoveDownSmallStars:
add hl, de add hl, de
dec c dec c
jr nz, .innerLoop jr nz, .innerLoop
; Toggle the palette so that the lower star in the small stars tile blinks in ; Toggle the palette so that the lower star in the small stars tile blinks in
; and out. ; and out.
ld a, [rOBP1] ld a, [rOBP1]

View file

@ -58,8 +58,8 @@ AnimateHallOfFame:
ld c, 80 ld c, 80
call DelayFrames call DelayFrames
coord hl, 2, 13 coord hl, 2, 13
ld b, $3 ld b, 3
ld c, $e ld c, 14
call TextBoxBorder call TextBoxBorder
coord hl, 4, 15 coord hl, 4, 15
ld de, HallOfFameText ld de, HallOfFameText
@ -210,12 +210,12 @@ HoFDisplayPlayerStats:
SetEvent EVENT_HALL_OF_FAME_DEX_RATING SetEvent EVENT_HALL_OF_FAME_DEX_RATING
predef DisplayDexRating predef DisplayDexRating
coord hl, 0, 4 coord hl, 0, 4
ld b, $6 ld b, 6
ld c, $a ld c, 10
call TextBoxBorder call TextBoxBorder
coord hl, 5, 0 coord hl, 5, 0
ld b, $2 ld b, 2
ld c, $9 ld c, 9
call TextBoxBorder call TextBoxBorder
coord hl, 7, 2 coord hl, 7, 2
ld de, wPlayerName ld de, wPlayerName

View file

@ -66,18 +66,18 @@ ViridianSchoolNotebookText4:
PrintFightingDojoText2: PrintFightingDojoText2:
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
tx_pre_jump FightingDojoText_52a10 tx_pre_jump EnemiesOnEverySideText
FightingDojoText_52a10: EnemiesOnEverySideText:
TX_FAR _FightingDojoText_52a10 TX_FAR _EnemiesOnEverySideText
db "@" db "@"
PrintFightingDojoText3: PrintFightingDojoText3:
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
tx_pre_jump FightingDojoText_52a1d tx_pre_jump WhatGoesAroundComesAroundText
FightingDojoText_52a1d: WhatGoesAroundComesAroundText:
TX_FAR _FightingDojoText_52a1d TX_FAR _WhatGoesAroundComesAroundText
db "@" db "@"
PrintFightingDojoText: PrintFightingDojoText:

View file

@ -73,29 +73,29 @@ PrintBenchGuyText:
; format: db map id, player sprite facing direction, text id of PredefTextIDPointerTable ; format: db map id, player sprite facing direction, text id of PredefTextIDPointerTable
BenchGuyTextPointers: BenchGuyTextPointers:
db VIRIDIAN_POKECENTER, SPRITE_FACING_LEFT db VIRIDIAN_POKECENTER, SPRITE_FACING_LEFT
db (ViridianCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db_tx_pre ViridianCityPokecenterBenchGuyText
db PEWTER_POKECENTER, SPRITE_FACING_LEFT db PEWTER_POKECENTER, SPRITE_FACING_LEFT
db (PewterCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db_tx_pre PewterCityPokecenterBenchGuyText
db CERULEAN_POKECENTER, SPRITE_FACING_LEFT db CERULEAN_POKECENTER, SPRITE_FACING_LEFT
db (CeruleanCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db_tx_pre CeruleanCityPokecenterBenchGuyText
db LAVENDER_POKECENTER, SPRITE_FACING_LEFT db LAVENDER_POKECENTER, SPRITE_FACING_LEFT
db (LavenderCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db_tx_pre LavenderCityPokecenterBenchGuyText
db VERMILION_POKECENTER, SPRITE_FACING_LEFT db VERMILION_POKECENTER, SPRITE_FACING_LEFT
db (VermilionCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db_tx_pre VermilionCityPokecenterBenchGuyText
db CELADON_POKECENTER, SPRITE_FACING_LEFT db CELADON_POKECENTER, SPRITE_FACING_LEFT
db (CeladonCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db_tx_pre CeladonCityPokecenterBenchGuyText
db CELADON_HOTEL, SPRITE_FACING_LEFT db CELADON_HOTEL, SPRITE_FACING_LEFT
db (CeladonCityHotelText_id - TextPredefs) / 2 + 1 db_tx_pre CeladonCityHotelText
db FUCHSIA_POKECENTER, SPRITE_FACING_LEFT db FUCHSIA_POKECENTER, SPRITE_FACING_LEFT
db (FuchsiaCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db_tx_pre FuchsiaCityPokecenterBenchGuyText
db CINNABAR_POKECENTER, SPRITE_FACING_LEFT db CINNABAR_POKECENTER, SPRITE_FACING_LEFT
db (CinnabarIslandPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db_tx_pre CinnabarIslandPokecenterBenchGuyText
db SAFFRON_POKECENTER, SPRITE_FACING_LEFT db SAFFRON_POKECENTER, SPRITE_FACING_LEFT
db (SaffronCityPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db_tx_pre SaffronCityPokecenterBenchGuyText
db MT_MOON_POKECENTER, SPRITE_FACING_LEFT db MT_MOON_POKECENTER, SPRITE_FACING_LEFT
db (MtMoonPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db_tx_pre MtMoonPokecenterBenchGuyText
db ROCK_TUNNEL_POKECENTER,SPRITE_FACING_LEFT db ROCK_TUNNEL_POKECENTER,SPRITE_FACING_LEFT
db (RockTunnelPokecenterBenchGuyText_id - TextPredefs) / 2 + 1 db_tx_pre RockTunnelPokecenterBenchGuyText
db $FF db $FF
ViridianCityPokecenterBenchGuyText: ViridianCityPokecenterBenchGuyText:

View file

@ -39,39 +39,39 @@ PrintBookshelfText:
; format: db tileset id, bookshelf tile id, text id ; format: db tileset id, bookshelf tile id, text id
BookshelfTileIDs: BookshelfTileIDs:
db PLATEAU, $30 db PLATEAU, $30
db (IndigoPlateauStatues_id - TextPredefs) / 2 + 1 db_tx_pre IndigoPlateauStatues
db HOUSE, $3D db HOUSE, $3D
db (TownMapText_id - TextPredefs) / 2 + 1 db_tx_pre TownMapText
db HOUSE, $1E db HOUSE, $1E
db (BookOrSculptureText_id - TextPredefs) / 2 + 1 db_tx_pre BookOrSculptureText
db MANSION, $32 db MANSION, $32
db (BookOrSculptureText_id - TextPredefs) / 2 + 1 db_tx_pre BookOrSculptureText
db REDS_HOUSE_1, $32 db REDS_HOUSE_1, $32
db (BookOrSculptureText_id - TextPredefs) / 2 + 1 db_tx_pre BookOrSculptureText
db LAB, $28 db LAB, $28
db (BookOrSculptureText_id - TextPredefs) / 2 + 1 db_tx_pre BookOrSculptureText
db LOBBY, $16 db LOBBY, $16
db (ElevatorText_id - TextPredefs) / 2 + 1 db_tx_pre ElevatorText
db GYM, $1D db GYM, $1D
db (BookOrSculptureText_id - TextPredefs) / 2 + 1 db_tx_pre BookOrSculptureText
db DOJO, $1D db DOJO, $1D
db (BookOrSculptureText_id - TextPredefs) / 2 + 1 db_tx_pre BookOrSculptureText
db GATE, $22 db GATE, $22
db (BookOrSculptureText_id - TextPredefs) / 2 + 1 db_tx_pre BookOrSculptureText
db MART, $54 db MART, $54
db (PokemonStuffText_id - TextPredefs) / 2 + 1 db_tx_pre PokemonStuffText
db MART, $55 db MART, $55
db (PokemonStuffText_id - TextPredefs) / 2 + 1 db_tx_pre PokemonStuffText
db POKECENTER, $54 db POKECENTER, $54
db (PokemonStuffText_id - TextPredefs) / 2 + 1 db_tx_pre PokemonStuffText
db POKECENTER, $55 db POKECENTER, $55
db (PokemonStuffText_id - TextPredefs) / 2 + 1 db_tx_pre PokemonStuffText
db LOBBY, $50 db LOBBY, $50
db (PokemonStuffText_id - TextPredefs) / 2 + 1 db_tx_pre PokemonStuffText
db LOBBY, $52 db LOBBY, $52
db (PokemonStuffText_id - TextPredefs) / 2 + 1 db_tx_pre PokemonStuffText
db SHIP, $36 db SHIP, $36
db (BookOrSculptureText_id - TextPredefs) / 2 + 1 db_tx_pre BookOrSculptureText
db $FF db $FF
IndigoPlateauStatues: IndigoPlateauStatues:
@ -81,9 +81,9 @@ IndigoPlateauStatues:
ld a, [wXCoord] ld a, [wXCoord]
bit 0, a bit 0, a
ld hl, IndigoPlateauStatuesText2 ld hl, IndigoPlateauStatuesText2
jr nz, .asm_fbd3 jr nz, .ok
ld hl, IndigoPlateauStatuesText3 ld hl, IndigoPlateauStatuesText3
.asm_fbd3 .ok
call PrintText call PrintText
jp TextScriptEnd jp TextScriptEnd
@ -104,12 +104,12 @@ BookOrSculptureText:
ld hl, PokemonBooksText ld hl, PokemonBooksText
ld a, [wCurMapTileset] ld a, [wCurMapTileset]
cp MANSION ; Celadon Mansion tileset cp MANSION ; Celadon Mansion tileset
jr nz, .asm_fbfd jr nz, .ok
aCoord 8, 6 aCoord 8, 6
cp $38 cp $38
jr nz, .asm_fbfd jr nz, .ok
ld hl, DiglettSculptureText ld hl, DiglettSculptureText
.asm_fbfd .ok
call PrintText call PrintText
jp TextScriptEnd jp TextScriptEnd

View file

@ -70,10 +70,10 @@ SafariZoneGameOver:
ld c, BANK(SFX_Safari_Zone_PA) ld c, BANK(SFX_Safari_Zone_PA)
ld a, SFX_SAFARI_ZONE_PA ld a, SFX_SAFARI_ZONE_PA
call PlayMusic call PlayMusic
.asm_1e9c2 .waitForMusicToPlay
ld a, [wChannelSoundIDs + CH4] ld a, [wChannelSoundIDs + CH4]
cp $b9 cp SFX_SAFARI_ZONE_PA
jr nz, .asm_1e9c2 jr nz, .waitForMusicToPlay
ld a, TEXT_SAFARI_GAME_OVER ld a, TEXT_SAFARI_GAME_OVER
ld [hSpriteIndexOrTextID], a ld [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
@ -100,10 +100,10 @@ SafariGameOverText:
TX_ASM TX_ASM
ld a, [wNumSafariBalls] ld a, [wNumSafariBalls]
and a and a
jr z, .asm_1ea04 jr z, .noMoreSafariBalls
ld hl, TimesUpText ld hl, TimesUpText
call PrintText call PrintText
.asm_1ea04 .noMoreSafariBalls
ld hl, GameOverText ld hl, GameOverText
call PrintText call PrintText
jp TextScriptEnd jp TextScriptEnd
@ -326,14 +326,14 @@ BillsHousePC:
cp SPRITE_FACING_UP cp SPRITE_FACING_UP
ret nz ret nz
CheckEvent EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING CheckEvent EVENT_LEFT_BILLS_HOUSE_AFTER_HELPING
jr nz, .asm_1ebd2 jr nz, .displayBillsHousePokemonList
CheckEventReuseA EVENT_USED_CELL_SEPARATOR_ON_BILL CheckEventReuseA EVENT_USED_CELL_SEPARATOR_ON_BILL
jr nz, .asm_1eb86 jr nz, .displayBillsHouseMonitorText
CheckEventReuseA EVENT_BILL_SAID_USE_CELL_SEPARATOR CheckEventReuseA EVENT_BILL_SAID_USE_CELL_SEPARATOR
jr nz, .asm_1eb8b jr nz, .doCellSeparator
.asm_1eb86 .displayBillsHouseMonitorText
tx_pre_jump BillsHouseMonitorText tx_pre_jump BillsHouseMonitorText
.asm_1eb8b .doCellSeparator
ld a, $1 ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld [wDoNotWaitForButtonPressAfterDisplayingText], a
tx_pre BillsHouseInitiatedText tx_pre BillsHouseInitiatedText
@ -360,7 +360,7 @@ BillsHousePC:
call PlayDefaultMusic call PlayDefaultMusic
SetEvent EVENT_USED_CELL_SEPARATOR_ON_BILL SetEvent EVENT_USED_CELL_SEPARATOR_ON_BILL
ret ret
.asm_1ebd2 .displayBillsHousePokemonList
ld a, $1 ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld [wDoNotWaitForButtonPressAfterDisplayingText], a
tx_pre BillsHousePokemonList tx_pre BillsHousePokemonList

View file

@ -87,6 +87,7 @@ UpdateHPBar2:
call UpdateHPBar_CompareNewHPToOldHP call UpdateHPBar_CompareNewHPToOldHP
jr z, .animateHPBarDone jr z, .animateHPBarDone
jr nc, .HPIncrease jr nc, .HPIncrease
; HP decrease
dec bc ; subtract 1 HP dec bc ; subtract 1 HP
ld a, c ld a, c
ld [wHPBarNewHP], a ld [wHPBarNewHP], a
@ -95,7 +96,7 @@ UpdateHPBar2:
call UpdateHPBar_CalcOldNewHPBarPixels call UpdateHPBar_CalcOldNewHPBarPixels
ld a, e ld a, e
sub d ; calc pixel difference sub d ; calc pixel difference
jr .asm_fa7e jr .ok
.HPIncrease .HPIncrease
inc bc ; add 1 HP inc bc ; add 1 HP
ld a, c ld a, c
@ -105,7 +106,7 @@ UpdateHPBar2:
call UpdateHPBar_CalcOldNewHPBarPixels call UpdateHPBar_CalcOldNewHPBarPixels
ld a, d ld a, d
sub e ; calc pixel difference sub e ; calc pixel difference
.asm_fa7e .ok
call UpdateHPBar_PrintHPNumber call UpdateHPBar_PrintHPNumber
and a and a
jr z, .noPixelDifference jr z, .noPixelDifference

View file

@ -21,7 +21,7 @@ DoInGameTradeDialogue:
call CopyData call CopyData
pop af pop af
ld l,a ld l,a
ld h,$0 ld h,0
ld de,InGameTradeTextPointers ld de,InGameTradeTextPointers
add hl,hl add hl,hl
add hl,de add hl,de

View file

@ -305,7 +305,7 @@ PlayShootingStar:
ld b, SET_PAL_GAME_FREAK_INTRO ld b, SET_PAL_GAME_FREAK_INTRO
call RunPaletteCommand call RunPaletteCommand
callba LoadCopyrightAndTextBoxTiles callba LoadCopyrightAndTextBoxTiles
ld a, $e4 ld a, %11100100
ld [rBGP], a ld [rBGP], a
ld c, 180 ld c, 180
call DelayFrames call DelayFrames

View file

@ -697,7 +697,7 @@ ItemUseSurfboard:
ld hl,TilePairCollisionsWater ld hl,TilePairCollisionsWater
call CheckForTilePairCollisions call CheckForTilePairCollisions
jr c,.cannotStopSurfing jr c,.cannotStopSurfing
ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles ld hl,wTilesetCollisionPtr ; pointer to list of passable tiles
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ; hl now points to passable tiles ld l,a ; hl now points to passable tiles

View file

@ -248,7 +248,7 @@ BillsPCDeposit:
add "1" add "1"
.next .next
ld [hli], a ld [hli], a
ld [hl], $50 ld [hl], "@"
ld hl, MonWasStoredText ld hl, MonWasStoredText
call PrintText call PrintText
jp BillsPCMenu jp BillsPCMenu

View file

@ -7,7 +7,7 @@ AskName:
coord hl, 0, 0 coord hl, 0, 0
ld b, 4 ld b, 4
ld c, 11 ld c, 11
call z, ClearScreenArea ; only if in wild batle call z, ClearScreenArea ; only if in wild battle
ld a, [wcf91] ld a, [wcf91]
ld [wd11e], a ld [wd11e], a
call GetMonName call GetMonName
@ -40,7 +40,7 @@ AskName:
pop af pop af
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld a, [wcf4b] ld a, [wcf4b]
cp $50 cp "@"
ret nz ret nz
.declinedNickname .declinedNickname
ld d, h ld d, h
@ -108,7 +108,7 @@ DisplayNamingScreen:
ld [wMenuWatchedKeys], a ld [wMenuWatchedKeys], a
ld a, 7 ld a, 7
ld [wMaxMenuItem], a ld [wMaxMenuItem], a
ld a, $50 ld a, "@"
ld [wcf4b], a ld [wcf4b], a
xor a xor a
ld hl, wNamingScreenSubmitName ld hl, wNamingScreenSubmitName
@ -153,7 +153,7 @@ DisplayNamingScreen:
ld h, [hl] ld h, [hl]
ld l, a ld l, a
push de push de
jp [hl] jp hl
.submitNickname .submitNickname
pop de pop de
@ -259,7 +259,7 @@ DisplayNamingScreen:
.addLetter .addLetter
ld a, [wNamingScreenLetter] ld a, [wNamingScreenLetter]
ld [hli], a ld [hli], a
ld [hl], $50 ld [hl], "@"
ld a, SFX_PRESS_AB ld a, SFX_PRESS_AB
call PlaySound call PlaySound
ret ret

View file

@ -7,9 +7,9 @@ OpenOaksPC:
call YesNoChoice call YesNoChoice
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
and a and a
jr nz, .asm_1e932 jr nz, .closePC
predef DisplayDexRating predef DisplayDexRating
.asm_1e932 .closePC
ld hl, ClosedOaksPCText ld hl, ClosedOaksPCText
call PrintText call PrintText
jp LoadScreenTilesFromBuffer2 jp LoadScreenTilesFromBuffer2

View file

@ -121,18 +121,18 @@ RemoveItemByID:
ld b, a ld b, a
xor a xor a
ld [hItemToRemoveIndex], a ld [hItemToRemoveIndex], a
.asm_17f40 .loop
ld a, [hli] ld a, [hli]
cp $ff cp -1 ; reached terminator?
ret z ret z
cp b cp b
jr z, .asm_17f4f jr z, .foundItem
inc hl inc hl
ld a, [hItemToRemoveIndex] ld a, [hItemToRemoveIndex]
inc a inc a
ld [hItemToRemoveIndex], a ld [hItemToRemoveIndex], a
jr .asm_17f40 jr .loop
.asm_17f4f .foundItem
ld a, $1 ld a, $1
ld [wItemQuantity], a ld [wItemQuantity], a
ld a, [hItemToRemoveIndex] ld a, [hItemToRemoveIndex]

View file

@ -125,6 +125,7 @@ HandlePokedexSideMenu:
call DrawTileLine ; cover up the menu cursor in the pokemon list call DrawTileLine ; cover up the menu cursor in the pokemon list
pop bc pop bc
ret ret
.buttonBPressed .buttonBPressed
push bc push bc
coord hl, 15, 10 coord hl, 15, 10
@ -133,16 +134,19 @@ HandlePokedexSideMenu:
call DrawTileLine ; cover up the menu cursor in the side menu call DrawTileLine ; cover up the menu cursor in the side menu
pop bc pop bc
jr .exitSideMenu jr .exitSideMenu
.choseData .choseData
call ShowPokedexDataInternal call ShowPokedexDataInternal
ld b,0 ld b,0
jr .exitSideMenu jr .exitSideMenu
; play pokemon cry ; play pokemon cry
.choseCry .choseCry
ld a,[wd11e] ld a,[wd11e]
call GetCryData call GetCryData
call PlaySound call PlaySound
jr .handleMenuInput jr .handleMenuInput
.choseArea .choseArea
predef LoadTownMap_Nest ; display pokemon areas predef LoadTownMap_Nest ; display pokemon areas
ld b,0 ld b,0
@ -206,6 +210,7 @@ HandlePokedexListMenu:
dec c dec c
jr nz,.maxSeenPokemonInnerLoop jr nz,.maxSeenPokemonInnerLoop
jr .maxSeenPokemonLoop jr .maxSeenPokemonLoop
.storeMaxSeenPokemon .storeMaxSeenPokemon
ld a,b ld a,b
ld [wDexMaxSeenMon],a ld [wDexMaxSeenMon],a
@ -409,20 +414,25 @@ ShowPokedexDataInternal:
push af push af
xor a xor a
ld [hTilesetType],a ld [hTilesetType],a
coord hl, 0, 0 coord hl, 0, 0
ld de,1 ld de,1
lb bc, $64, SCREEN_WIDTH lb bc, $64, SCREEN_WIDTH
call DrawTileLine ; draw top border call DrawTileLine ; draw top border
coord hl, 0, 17 coord hl, 0, 17
ld b, $6f ld b, $6f
call DrawTileLine ; draw bottom border call DrawTileLine ; draw bottom border
coord hl, 0, 1 coord hl, 0, 1
ld de,20 ld de,20
lb bc, $66, $10 lb bc, $66, $10
call DrawTileLine ; draw left border call DrawTileLine ; draw left border
coord hl, 19, 1 coord hl, 19, 1
ld b,$67 ld b,$67
call DrawTileLine ; draw right border call DrawTileLine ; draw right border
ld a,$63 ; upper left corner tile ld a,$63 ; upper left corner tile
Coorda 0, 0 Coorda 0, 0
ld a,$65 ; upper right corner tile ld a,$65 ; upper right corner tile
@ -431,15 +441,19 @@ ShowPokedexDataInternal:
Coorda 0, 17 Coorda 0, 17
ld a,$6e ; lower right corner tile ld a,$6e ; lower right corner tile
Coorda 19, 17 Coorda 19, 17
coord hl, 0, 9 coord hl, 0, 9
ld de,PokedexDataDividerLine ld de,PokedexDataDividerLine
call PlaceString ; draw horizontal divider line call PlaceString ; draw horizontal divider line
coord hl, 9, 6 coord hl, 9, 6
ld de,HeightWeightText ld de,HeightWeightText
call PlaceString call PlaceString
call GetMonName call GetMonName
coord hl, 9, 2 coord hl, 9, 2
call PlaceString call PlaceString
ld hl,PokedexEntryPointers ld hl,PokedexEntryPointers
ld a,[wd11e] ld a,[wd11e]
dec a dec a
@ -450,14 +464,17 @@ ShowPokedexDataInternal:
ld a,[hli] ld a,[hli]
ld e,a ld e,a
ld d,[hl] ; de = address of pokedex entry ld d,[hl] ; de = address of pokedex entry
coord hl, 9, 4 coord hl, 9, 4
call PlaceString ; print species name call PlaceString ; print species name
ld h,b ld h,b
ld l,c ld l,c
push de push de
ld a,[wd11e] ld a,[wd11e]
push af push af
call IndexToPokedex call IndexToPokedex
coord hl, 2, 8 coord hl, 2, 8
ld a, "№" ld a, "№"
ld [hli],a ld [hli],a
@ -466,6 +483,7 @@ ShowPokedexDataInternal:
ld de,wd11e ld de,wd11e
lb bc, LEADING_ZEROES | 1, 3 lb bc, LEADING_ZEROES | 1, 3
call PrintNumber ; print pokedex number call PrintNumber ; print pokedex number
ld hl,wPokedexOwned ld hl,wPokedexOwned
call IsPokemonBitSet call IsPokemonBitSet
pop af pop af
@ -473,10 +491,12 @@ ShowPokedexDataInternal:
ld a,[wcf91] ld a,[wcf91]
ld [wd0b5],a ld [wd0b5],a
pop de pop de
push af push af
push bc push bc
push de push de
push hl push hl
call Delay3 call Delay3
call GBPalNormal call GBPalNormal
call GetMonHeader ; load pokemon picture location call GetMonHeader ; load pokemon picture location
@ -484,10 +504,12 @@ ShowPokedexDataInternal:
call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture call LoadFlippedFrontSpriteByMonIndex ; draw pokemon picture
ld a,[wcf91] ld a,[wcf91]
call PlayCry ; play pokemon cry call PlayCry ; play pokemon cry
pop hl pop hl
pop de pop de
pop bc pop bc
pop af pop af
ld a,c ld a,c
and a and a
jp z,.waitForButtonPress ; if the pokemon has not been owned, don't print the height, weight, or description jp z,.waitForButtonPress ; if the pokemon has not been owned, don't print the height, weight, or description

View file

@ -23,8 +23,8 @@ CeladonPrizeMenu:
ld [wTopMenuItemX],a ld [wTopMenuItemX],a
call PrintPrizePrice call PrintPrizePrice
coord hl, 0, 2 coord hl, 0, 2
ld b,$08 ld b, 8
ld c,$10 ld c, 16
call TextBoxBorder call TextBoxBorder
call GetPrizeMenuId call GetPrizeMenuId
call UpdateSprites call UpdateSprites
@ -32,12 +32,12 @@ CeladonPrizeMenu:
call PrintText call PrintText
call HandleMenuInput ; menu choice handler call HandleMenuInput ; menu choice handler
bit 1,a ; keypress = B (Cancel) bit 1,a ; keypress = B (Cancel)
jr nz,.NoChoice jr nz, .noChoice
ld a,[wCurrentMenuItem] ld a,[wCurrentMenuItem]
cp a,$03 ; "NO,THANKS" choice cp 3 ; "NO,THANKS" choice
jr z,.NoChoice jr z, .noChoice
call HandlePrizeChoice call HandlePrizeChoice
.NoChoice .noChoice
ld hl,wd730 ld hl,wd730
res 6,[hl] res 6,[hl]
ret ret
@ -65,7 +65,7 @@ GetPrizeMenuId:
; (distinguishing between Pokemon names ; (distinguishing between Pokemon names
; and Items (specifically TMs) names) ; and Items (specifically TMs) names)
ld a,[hSpriteIndexOrTextID] ld a,[hSpriteIndexOrTextID]
sub a,3 ; prize-texts' id are 3, 4 and 5 sub 3 ; prize-texts' id are 3, 4 and 5
ld [wWhichPrizeWindow],a ; prize-texts' id (relative, i.e. 0, 1 or 2) ld [wWhichPrizeWindow],a ; prize-texts' id (relative, i.e. 0, 1 or 2)
add a add a
add a add a
@ -88,7 +88,7 @@ GetPrizeMenuId:
ld bc,6 ld bc,6
call CopyData call CopyData
ld a,[wWhichPrizeWindow] ld a,[wWhichPrizeWindow]
cp a,$02 ;is TM_menu? cp 2 ;is TM_menu?
jr nz,.putMonName jr nz,.putMonName
ld a,[wPrize1] ld a,[wPrize1]
ld [wd11e],a ld [wd11e],a
@ -138,7 +138,7 @@ GetPrizeMenuId:
call PrintBCDNumber call PrintBCDNumber
ld de,wPrize2Price ld de,wPrize2Price
coord hl, 13, 7 coord hl, 13, 7
ld c,(%1 << 7 | 2) ld c,(1 << 7 | 2)
call PrintBCDNumber call PrintBCDNumber
ld de,wPrize3Price ld de,wPrize3Price
coord hl, 13, 9 coord hl, 13, 9
@ -149,15 +149,15 @@ INCLUDE "data/prizes.asm"
PrintPrizePrice: PrintPrizePrice:
coord hl, 11, 0 coord hl, 11, 0
ld b,$01 ld b, 1
ld c,$07 ld c, 7
call TextBoxBorder call TextBoxBorder
call UpdateSprites call UpdateSprites
coord hl, 12, 0 coord hl, 12, 0
ld de,.CoinText ld de, .CoinString
call PlaceString call PlaceString
coord hl, 13, 1 coord hl, 13, 1
ld de,.SixSpacesText ld de, .SixSpacesString
call PlaceString call PlaceString
coord hl, 13, 1 coord hl, 13, 1
ld de,wPlayerCoins ld de,wPlayerCoins
@ -165,10 +165,10 @@ PrintPrizePrice:
call PrintBCDNumber call PrintBCDNumber
ret ret
.CoinText .CoinString:
db "COIN@" db "COIN@"
.SixSpacesText .SixSpacesString:
db " @" db " @"
LoadCoinsToSubtract: LoadCoinsToSubtract:
@ -196,33 +196,33 @@ HandlePrizeChoice:
ld a,[hl] ld a,[hl]
ld [wd11e],a ld [wd11e],a
ld a,[wWhichPrizeWindow] ld a,[wWhichPrizeWindow]
cp a,$02 ; is prize a TM? cp 2 ; is prize a TM?
jr nz,.GetMonName jr nz, .getMonName
call GetItemName call GetItemName
jr .GivePrize jr .givePrize
.GetMonName .getMonName
call GetMonName call GetMonName
.GivePrize .givePrize
ld hl,SoYouWantPrizeTextPtr ld hl,SoYouWantPrizeTextPtr
call PrintText call PrintText
call YesNoChoice call YesNoChoice
ld a,[wCurrentMenuItem] ; yes/no answer (Y=0, N=1) ld a,[wCurrentMenuItem] ; yes/no answer (Y=0, N=1)
and a and a
jr nz,.PrintOhFineThen jr nz, .printOhFineThen
call LoadCoinsToSubtract call LoadCoinsToSubtract
call HasEnoughCoins call HasEnoughCoins
jr c,.NotEnoughCoins jr c, .notEnoughCoins
ld a,[wWhichPrizeWindow] ld a,[wWhichPrizeWindow]
cp a,$02 cp $02
jr nz,.GiveMon jr nz, .giveMon
ld a,[wd11e] ld a,[wd11e]
ld b,a ld b,a
ld a,1 ld a,1
ld c,a ld c,a
call GiveItem call GiveItem
jr nc,.BagFull jr nc, .bagFull
jr .SubtractCoins jr .subtractCoins
.GiveMon .giveMon
ld a,[wd11e] ld a,[wd11e]
ld [wcf91],a ld [wcf91],a
push af push af
@ -243,24 +243,24 @@ HandlePrizeChoice:
; were full), return without subtracting coins. ; were full), return without subtracting coins.
ret nc ret nc
.SubtractCoins .subtractCoins
call LoadCoinsToSubtract call LoadCoinsToSubtract
ld hl,hCoins + 1 ld hl,hCoins + 1
ld de,wPlayerCoins + 1 ld de,wPlayerCoins + 1
ld c,$02 ; how many bytes ld c,$02 ; how many bytes
predef SubBCDPredef predef SubBCDPredef
jp PrintPrizePrice jp PrintPrizePrice
.BagFull .bagFull
ld hl,PrizeRoomBagIsFullTextPtr ld hl,PrizeRoomBagIsFullTextPtr
jp PrintText jp PrintText
.NotEnoughCoins .notEnoughCoins
ld hl,SorryNeedMoreCoinsText ld hl,SorryNeedMoreCoinsText
jp PrintText jp PrintText
.PrintOhFineThen .printOhFineThen
ld hl,OhFineThenTextPtr ld hl,OhFineThenTextPtr
jp PrintText jp PrintText
UnknownData52951: UnknownPrizeData:
; XXX what's this? ; XXX what's this?
db $00,$01,$00,$01,$00,$01,$00,$00,$01 db $00,$01,$00,$01,$00,$01,$00,$00,$01

View file

@ -34,7 +34,7 @@ StartMenu_Pokemon:
ld [wTextBoxID],a ld [wTextBoxID],a
call DisplayTextBoxID ; display pokemon menu options call DisplayTextBoxID ; display pokemon menu options
ld hl,wFieldMoves ld hl,wFieldMoves
lb bc, $02, $0c ; max menu item ID, top menu item Y lb bc, 2, 12 ; max menu item ID, top menu item Y
ld e,5 ld e,5
.adjustMenuVariablesLoop .adjustMenuVariablesLoop
dec e dec e
@ -222,7 +222,7 @@ StartMenu_Pokemon:
res 4,[hl] res 4,[hl]
ld c,60 ld c,60
call DelayFrames call DelayFrames
call GBPalWhiteOutWithDelay3 ; zero all three palettes and wait 3 V-blanks call GBPalWhiteOutWithDelay3
jp .goBackToMap jp .goBackToMap
.warpToLastPokemonCenterText .warpToLastPokemonCenterText
TX_FAR _WarpToLastPokemonCenterText TX_FAR _WarpToLastPokemonCenterText

View file

@ -250,16 +250,16 @@ PrintStatsBox:
and a ; a is 0 from the status screen and a ; a is 0 from the status screen
jr nz, .DifferentBox jr nz, .DifferentBox
coord hl, 0, 8 coord hl, 0, 8
ld b, $8 ld b, 8
ld c, $8 ld c, 8
call TextBoxBorder ; Draws the box call TextBoxBorder ; Draws the box
coord hl, 1, 9 ; Start printing stats from here coord hl, 1, 9 ; Start printing stats from here
ld bc, $0019 ; Number offset ld bc, $0019 ; Number offset
jr .PrintStats jr .PrintStats
.DifferentBox .DifferentBox
coord hl, 9, 2 coord hl, 9, 2
ld b, $8 ld b, 8
ld c, $9 ld c, 9
call TextBoxBorder call TextBoxBorder
coord hl, 11, 3 coord hl, 11, 3
ld bc, $0018 ld bc, $0018
@ -280,7 +280,7 @@ PrintStatsBox:
call PrintStat call PrintStat
ld de, wLoadedMonSpecial ld de, wLoadedMonSpecial
jp PrintNumber jp PrintNumber
PrintStat PrintStat:
push hl push hl
call PrintNumber call PrintNumber
pop hl pop hl

View file

@ -131,6 +131,9 @@ LoadVendingMachineItem:
ret ret
VendingPrices: VendingPrices:
db FRESH_WATER,$00,$02,$00 db FRESH_WATER
db SODA_POP, $00,$03,$00 money 200
db LEMONADE, $00,$03,$50 db SODA_POP
money 300
db LEMONADE
money 350

View file

@ -132,7 +132,7 @@ LoadMonPartySpriteGfxWithLCDDisabled:
ld hl, MonPartySpritePointers ld hl, MonPartySpritePointers
ld a, $1c ld a, $1c
ld bc, $0 ld bc, $0
.asm_7179c .loop
push af push af
push bc push bc
push hl push hl
@ -159,7 +159,7 @@ LoadMonPartySpriteGfxWithLCDDisabled:
ld c, a ld c, a
pop af pop af
dec a dec a
jr nz, .asm_7179c jr nz, .loop
jp EnableLCD jp EnableLCD
MonPartySpritePointers: MonPartySpritePointers:

View file

@ -6,7 +6,7 @@ SetDefaultNames:
ld a, [wd732] ld a, [wd732]
push af push af
ld hl, wPlayerName ld hl, wPlayerName
ld bc, $d8a ld bc, wBoxDataEnd - wPlayerName
xor a xor a
call FillMemory call FillMemory
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
@ -195,7 +195,7 @@ MovePicLeft:
ld [rWX],a ld [rWX],a
call DelayFrame call DelayFrame
ld a,$E4 ld a,%11100100
ld [rBGP],a ld [rBGP],a
.next .next
call DelayFrame call DelayFrame

View file

@ -74,7 +74,7 @@ UsedCutText:
InitCutAnimOAM: InitCutAnimOAM:
xor a xor a
ld [wWhichAnimationOffsets], a ld [wWhichAnimationOffsets], a
ld a, $e4 ld a, %11100100
ld [rOBP1], a ld [rOBP1], a
ld a, [wCutTile] ld a, [wCutTile]
cp $52 cp $52

View file

@ -34,7 +34,7 @@ ShakeElevator:
call PlayMusic call PlayMusic
.musicLoop .musicLoop
ld a, [wChannelSoundIDs + CH4] ld a, [wChannelSoundIDs + CH4]
cp $b9 cp SFX_SAFARI_ZONE_PA
jr z, .musicLoop jr z, .musicLoop
call UpdateSprites call UpdateSprites
jp PlayDefaultMusic jp PlayDefaultMusic
@ -56,7 +56,7 @@ ShakeElevatorRedrawRow:
add hl, de add hl, de
ld a, h ld a, h
and $3 and $3
or $98 or vBGMap0 / $100
ld d, a ld d, a
ld a, l ld a, l
pop hl pop hl

View file

@ -17,11 +17,11 @@ EmotionBubble:
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld a, [wd736] ld a, [wd736]
bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod? bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod?
ld hl, wOAMBuffer + $8f ld hl, wOAMBuffer + 4 * 35 + $3 ; $8f
ld de, wOAMBuffer + $9f ld de, wOAMBuffer + 4 * 39 + $3 ; $9f
jr z, .next jr z, .next
ld hl, wOAMBuffer + $7f ld hl, wOAMBuffer + 4 * 31 + $3 ; $7f
ld de, wOAMBuffer + $8f ld de, wOAMBuffer + 4 * 35 + $3 ; $8f
; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the ; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the
; start of the OAM buffer. ; start of the OAM buffer.

View file

@ -27,7 +27,7 @@ FoundHiddenItemText:
ld b, a ld b, a
ld c, 1 ld c, 1
call GiveItem call GiveItem
jr nc, .BagFull jr nc, .bagFull
ld hl, wObtainedHiddenItemsFlags ld hl, wObtainedHiddenItemsFlags
ld a, [wHiddenItemOrCoinsIndex] ld a, [wHiddenItemOrCoinsIndex]
ld c, a ld c, a
@ -37,7 +37,7 @@ FoundHiddenItemText:
call PlaySoundWaitForCurrent call PlaySoundWaitForCurrent
call WaitForSoundToFinish call WaitForSoundToFinish
jp TextScriptEnd jp TextScriptEnd
.BagFull .bagFull
call WaitForTextScrollButtonPress ; wait for button press call WaitForTextScrollButtonPress ; wait for button press
xor a xor a
ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld [wDoNotWaitForButtonPressAfterDisplayingText], a
@ -77,24 +77,24 @@ HiddenCoins:
cp 20 cp 20
jr z, .bcd20 jr z, .bcd20
cp 40 cp 40
jr z, .bcd20 jr z, .bcd20 ; should be bcd40
jr .bcd100 jr .bcd100
.bcd10 .bcd10
ld a, $10 ld a, $10
ld [hCoins + 1], a ld [hCoins + 1], a
jr .bcddone jr .bcdDone
.bcd20 .bcd20
ld a, $20 ld a, $20
ld [hCoins + 1], a ld [hCoins + 1], a
jr .bcddone jr .bcdDone
.bcd40 ; due to a typo, this is never used .bcd40 ; due to a typo, this is never used
ld a, $40 ld a, $40
ld [hCoins + 1], a ld [hCoins + 1], a
jr .bcddone jr .bcdDone
.bcd100 .bcd100
ld a, $1 ld a, $1
ld [hCoins], a ld [hCoins], a
.bcddone .bcdDone
ld de, wPlayerCoins + 1 ld de, wPlayerCoins + 1
ld hl, hCoins + 1 ld hl, hCoins + 1
ld c, $2 ld c, $2
@ -107,13 +107,13 @@ HiddenCoins:
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld a, [wPlayerCoins] ld a, [wPlayerCoins]
cp $99 cp $99
jr nz, .RoomInCoinCase jr nz, .roomInCoinCase
ld a, [wPlayerCoins + 1] ld a, [wPlayerCoins + 1]
cp $99 cp $99
jr nz, .RoomInCoinCase jr nz, .roomInCoinCase
tx_pre_id DroppedHiddenCoinsText tx_pre_id DroppedHiddenCoinsText
jr .done jr .done
.RoomInCoinCase .roomInCoinCase
tx_pre_id FoundHiddenCoinsText tx_pre_id FoundHiddenCoinsText
.done .done
jp PrintPredefTextID jp PrintPredefTextID

View file

@ -393,7 +393,7 @@ UpdateSpriteMovementDelay:
ld l, a ld l, a
ld [hl], $1 ; c1x1 = 1 (mark as ready to move) ld [hl], $1 ; c1x1 = 1 (mark as ready to move)
notYetMoving: notYetMoving:
ld h, $c1 ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
add $8 add $8
ld l, a ld l, a
@ -408,7 +408,6 @@ MakeNPCFacePlayer:
ld a, [wd72d] ld a, [wd72d]
bit 5, a bit 5, a
jr nz, notYetMoving jr nz, notYetMoving
res 7, [hl] res 7, [hl]
ld a, [wPlayerDirection] ld a, [wPlayerDirection]
bit PLAYER_DIR_BIT_UP, a bit PLAYER_DIR_BIT_UP, a
@ -449,7 +448,7 @@ InitializeSpriteStatus:
; calculates the spprite's scrren position form its map position and the player position ; calculates the spprite's scrren position form its map position and the player position
InitializeSpriteScreenPosition: InitializeSpriteScreenPosition:
ld h, $c2 ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
add $4 add $4
ld l, a ld l, a
@ -477,7 +476,7 @@ CheckSpriteAvailability:
ld a, [$ffe5] ld a, [$ffe5]
and a and a
jp nz, .spriteInvisible jp nz, .spriteInvisible
ld h, $c2 ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
add $6 add $6
ld l, a ld l, a
@ -525,7 +524,7 @@ CheckSpriteAvailability:
cp d cp d
jr c, .spriteVisible ; standing on tile with ID >=$60 (top right tile) jr c, .spriteVisible ; standing on tile with ID >=$60 (top right tile)
.spriteInvisible .spriteInvisible
ld h, $c1 ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
add $2 add $2
ld l, a ld l, a
@ -579,7 +578,7 @@ UpdateSpriteImage:
; e: X movement delta (-1, 0 or 1) ; e: X movement delta (-1, 0 or 1)
; set carry on failure, clears carry on success ; set carry on failure, clears carry on success
CanWalkOntoTile: CanWalkOntoTile:
ld h, $c2 ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
add $6 add $6
ld l, a ld l, a
@ -590,9 +589,9 @@ CanWalkOntoTile:
and a and a
ret ret
.notScripted .notScripted
ld a, [wTileSetCollisionPtr] ld a, [wTilesetCollisionPtr]
ld l, a ld l, a
ld a, [wTileSetCollisionPtr+1] ld a, [wTilesetCollisionPtr+1]
ld h, a ld h, a
.tilePassableLoop .tilePassableLoop
ld a, [hli] ld a, [hli]
@ -607,7 +606,7 @@ CanWalkOntoTile:
ld a, [hl] ; $c2x6 (movement byte 1) ld a, [hl] ; $c2x6 (movement byte 1)
inc a inc a
jr z, .impassable ; if $ff, no movement allowed (however, changing direction is) jr z, .impassable ; if $ff, no movement allowed (however, changing direction is)
ld h, $c1 ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
add $4 add $4
ld l, a ld l, a
@ -626,14 +625,14 @@ CanWalkOntoTile:
call DetectCollisionBetweenSprites call DetectCollisionBetweenSprites
pop bc pop bc
pop de pop de
ld h, $c1 ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
add $c add $c
ld l, a ld l, a
ld a, [hl] ; c1xc (directions in which sprite collision would occur) ld a, [hl] ; c1xc (directions in which sprite collision would occur)
and b ; check against chosen direction (1,2,4 or 8) and b ; check against chosen direction (1,2,4 or 8)
jr nz, .impassable ; collision between sprites, don't go there jr nz, .impassable ; collision between sprites, don't go there
ld h, $c2 ld h, wSpriteStateData2 / $100
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
add $2 add $2
ld l, a ld l, a
@ -690,7 +689,7 @@ CanWalkOntoTile:
; this is always the lower left tile of the 2x2 tile blocks all sprites are snapped to ; this is always the lower left tile of the 2x2 tile blocks all sprites are snapped to
; hl: output pointer ; hl: output pointer
GetTileSpriteStandsOn: GetTileSpriteStandsOn:
ld h, $c1 ld h, wSpriteStateData1 / $100
ld a, [H_CURRENTSPRITEOFFSET] ld a, [H_CURRENTSPRITEOFFSET]
add $4 add $4
ld l, a ld l, a

View file

@ -6,7 +6,7 @@ PrepareOAMData:
dec a dec a
jr z, .updateEnabled jr z, .updateEnabled
cp 0 - 1 cp -1
ret nz ret nz
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
jp HideSprites jp HideSprites

View file

@ -388,7 +388,7 @@ FishingAnim:
set 6, [hl] ; reserve the last 4 OAM entries set 6, [hl] ; reserve the last 4 OAM entries
ld de, RedSprite ld de, RedSprite
ld hl, vNPCSprites ld hl, vNPCSprites
lb bc, BANK(RedSprite), $0c lb bc, BANK(RedSprite), $c
call CopyVideoData call CopyVideoData
ld a, $4 ld a, $4
ld hl, RedFishingTiles ld hl, RedFishingTiles

View file

@ -85,7 +85,7 @@ DisplayPokemartDialogue_:
lb bc, 14, 1 ; location that PrintText always prints to, this is useless lb bc, 14, 1 ; location that PrintText always prints to, this is useless
call PrintText call PrintText
coord hl, 14, 7 coord hl, 14, 7
lb bc, 08, 15 lb bc, 8, 15
ld a,TWO_OPTION_MENU ld a,TWO_OPTION_MENU
ld [wTextBoxID],a ld [wTextBoxID],a
call DisplayTextBoxID ; yes/no menu call DisplayTextBoxID ; yes/no menu

View file

@ -4,16 +4,16 @@ _GetSpritePosition1:
ld a, [wSpriteIndex] ld a, [wSpriteIndex]
ld [H_SPRITEINDEX], a ld [H_SPRITEINDEX], a
call GetSpriteDataPointer call GetSpriteDataPointer
ld a, [hli] ld a, [hli] ; c1x4 (screen Y pos)
ld [$ffeb], a ld [$ffeb], a
inc hl inc hl
ld a, [hl] ld a, [hl] ; c1x6 (screen X pos)
ld [$ffec], a ld [$ffec], a
ld de, $fe ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
add hl, de add hl, de
ld a, [hli] ld a, [hli] ; c2x4 (map Y pos)
ld [$ffed], a ld [$ffed], a
ld a, [hl] ld a, [hl] ; c2x5 (map X pos)
ld [$ffee], a ld [$ffee], a
ret ret
@ -28,7 +28,7 @@ _GetSpritePosition2:
inc hl inc hl
ld a, [hl] ; c1x6 (screen X pos) ld a, [hl] ; c1x6 (screen X pos)
ld [wSavedSpriteScreenX], a ld [wSavedSpriteScreenX], a
ld de, $104 - $6 ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
add hl, de add hl, de
ld a, [hli] ; c2x4 (map Y pos) ld a, [hli] ; c2x4 (map Y pos)
ld [wSavedSpriteMapY], a ld [wSavedSpriteMapY], a
@ -47,7 +47,7 @@ _SetSpritePosition1:
inc hl inc hl
ld a, [$ffec] ; c1x6 (screen X pos) ld a, [$ffec] ; c1x6 (screen X pos)
ld [hl], a ld [hl], a
ld de, $104 - $6 ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
add hl, de add hl, de
ld a, [$ffed] ; c2x4 (map Y pos) ld a, [$ffed] ; c2x4 (map Y pos)
ld [hli], a ld [hli], a
@ -57,21 +57,21 @@ _SetSpritePosition1:
_SetSpritePosition2: _SetSpritePosition2:
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
ld de, $0004 ld de, 4
ld a, [wSpriteIndex] ld a, [wSpriteIndex]
ld [H_SPRITEINDEX], a ld [H_SPRITEINDEX], a
call GetSpriteDataPointer call GetSpriteDataPointer
ld a, [wSavedSpriteScreenY] ld a, [wSavedSpriteScreenY]
ld [hli], a ld [hli], a ; c1x4 (screen Y pos)
inc hl inc hl
ld a, [wSavedSpriteScreenX] ld a, [wSavedSpriteScreenX]
ld [hl], a ld [hl], a ; c1x6 (screen X pos)
ld de, $00fe ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6)
add hl, de add hl, de
ld a, [wSavedSpriteMapY] ld a, [wSavedSpriteMapY]
ld [hli], a ld [hli], a ; c2x4 (map Y pos)
ld a, [wSavedSpriteMapX] ld a, [wSavedSpriteMapX]
ld [hl], a ld [hl], a ; c2x5 (map X pos)
ret ret
TrainerWalkUpToPlayer: TrainerWalkUpToPlayer:
@ -80,11 +80,11 @@ TrainerWalkUpToPlayer:
ld [wTrainerSpriteOffset], a ld [wTrainerSpriteOffset], a
call ReadTrainerScreenPosition call ReadTrainerScreenPosition
ld a, [wTrainerFacingDirection] ld a, [wTrainerFacingDirection]
and a and a ; SPRITE_FACING_DOWN
jr z, .facingDown jr z, .facingDown
cp $4 cp SPRITE_FACING_UP
jr z, .facingUp jr z, .facingUp
cp $8 cp SPRITE_FACING_LEFT
jr z, .facingLeft jr z, .facingLeft
jr .facingRight jr .facingRight
.facingDown .facingDown
@ -148,7 +148,7 @@ TrainerWalkUpToPlayer:
jp MoveSprite_ jp MoveSprite_
; input: de = offset within sprite entry ; input: de = offset within sprite entry
; output: de = pointer to sprite data ; output: hl = pointer to sprite data
GetSpriteDataPointer: GetSpriteDataPointer:
push de push de
add hl, de add hl, de
@ -225,7 +225,7 @@ TrainerEngage:
set 0, [hl] set 0, [hl]
call EngageMapTrainer call EngageMapTrainer
ld a, $ff ld a, $ff
.noEngage: .noEngage
ld [wTrainerSpriteOffset], a ld [wTrainerSpriteOffset], a
pop de pop de
pop hl pop hl
@ -239,7 +239,7 @@ ReadTrainerScreenPosition:
ld e, a ld e, a
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
add hl, de add hl, de
ld a, [hl] ld a, [hl] ; c1x4 (sprite Y pos)
ld [wTrainerScreenY], a ld [wTrainerScreenY], a
ld a, [wTrainerSpriteOffset] ld a, [wTrainerSpriteOffset]
add $6 add $6
@ -247,7 +247,7 @@ ReadTrainerScreenPosition:
ld e, a ld e, a
ld hl, wSpriteStateData1 ld hl, wSpriteStateData1
add hl, de add hl, de
ld a, [hl] ld a, [hl] ; c1x6 (sprite X pos)
ld [wTrainerScreenX], a ld [wTrainerScreenX], a
ret ret
@ -262,13 +262,13 @@ CheckSpriteCanSeePlayer:
jr .notInLine ; player too far away jr .notInLine ; player too far away
.checkIfLinedUp .checkIfLinedUp
ld a, [wTrainerFacingDirection] ; sprite facing direction ld a, [wTrainerFacingDirection] ; sprite facing direction
cp $0 ; down cp SPRITE_FACING_DOWN
jr z, .checkXCoord jr z, .checkXCoord
cp $4 ; up cp SPRITE_FACING_UP
jr z, .checkXCoord jr z, .checkXCoord
cp $8 ; left cp SPRITE_FACING_LEFT
jr z, .checkYCoord jr z, .checkYCoord
cp $c ; right cp SPRITE_FACING_RIGHT
jr z, .checkYCoord jr z, .checkYCoord
jr .notInLine jr .notInLine
.checkXCoord .checkXCoord
@ -315,21 +315,21 @@ CheckPlayerIsInFrontOfSprite:
ld a, [hl] ; c1x6 (sprite screen X pos) ld a, [hl] ; c1x6 (sprite screen X pos)
ld [wTrainerScreenX], a ld [wTrainerScreenX], a
ld a, [wTrainerFacingDirection] ; facing direction ld a, [wTrainerFacingDirection] ; facing direction
cp $0 cp SPRITE_FACING_DOWN
jr nz, .notFacingDown jr nz, .notFacingDown
ld a, [wTrainerScreenY] ; sprite screen Y pos ld a, [wTrainerScreenY] ; sprite screen Y pos
cp $3c cp $3c
jr c, .engage ; sprite above player jr c, .engage ; sprite above player
jr .noEngage ; sprite below player jr .noEngage ; sprite below player
.notFacingDown .notFacingDown
cp $4 cp SPRITE_FACING_UP
jr nz, .notFacingUp jr nz, .notFacingUp
ld a, [wTrainerScreenY] ; sprite screen Y pos ld a, [wTrainerScreenY] ; sprite screen Y pos
cp $3c cp $3c
jr nc, .engage ; sprite below player jr nc, .engage ; sprite below player
jr .noEngage ; sprite above player jr .noEngage ; sprite above player
.notFacingUp .notFacingUp
cp $8 cp SPRITE_FACING_LEFT
jr nz, .notFacingLeft jr nz, .notFacingLeft
ld a, [wTrainerScreenX] ; sprite screen X pos ld a, [wTrainerScreenX] ; sprite screen X pos
cp $40 cp $40

View file

@ -27,10 +27,10 @@ GetPredefPointer:
add a add a
add e add e
ld e,a ld e,a
jr nc,.next jr nc, .nocarry
inc d inc d
.next .nocarry
add hl,de add hl,de
ld d,h ld d,h
ld e,l ld e,l
@ -60,7 +60,7 @@ PredefPointers::
add_predef CopyDownscaledMonTiles add_predef CopyDownscaledMonTiles
add_predef LoadMissableObjects add_predef LoadMissableObjects
add_predef HealParty add_predef HealParty
add_predef MoveAnimation; 08 play move animation add_predef MoveAnimation
add_predef DivideBCDPredef add_predef DivideBCDPredef
add_predef DivideBCDPredef2 add_predef DivideBCDPredef2
add_predef AddBCDPredef add_predef AddBCDPredef
@ -81,8 +81,8 @@ PredefPointers::
add_predef LearnMoveFromLevelUp add_predef LearnMoveFromLevelUp
add_predef LearnMove add_predef LearnMove
add_predef GetQuantityOfItemInBag add_predef GetQuantityOfItemInBag
dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; for these two, the bank number is actually 0 dbw $03,CheckForHiddenObjectOrBookshelfOrCardKeyDoor ; home bank
dbw $03,GiveItem dbw $03,GiveItem ; home bank
add_predef ChangeBGPalColor0_4Frames add_predef ChangeBGPalColor0_4Frames
add_predef FindPathToPlayer add_predef FindPathToPlayer
add_predef PredefShakeScreenVertically add_predef PredefShakeScreenVertically
@ -122,7 +122,7 @@ PredefPointers::
add_predef CanLearnTM add_predef CanLearnTM
add_predef TMToMove add_predef TMToMove
add_predef _RunPaletteCommand add_predef _RunPaletteCommand
add_predef StarterDex ; 46 add_predef StarterDex
add_predef _AddPartyMon add_predef _AddPartyMon
add_predef UpdateHPBar2 add_predef UpdateHPBar2
add_predef DrawEnemyHUDAndHPBar add_predef DrawEnemyHUDAndHPBar
@ -147,7 +147,7 @@ PredefPointers::
add_predef PickUpItem add_predef PickUpItem
add_predef PrintMoveType add_predef PrintMoveType
add_predef LoadMovePPs add_predef LoadMovePPs
add_predef DrawHP ; 5F add_predef DrawHP
add_predef DrawHP2 add_predef DrawHP2
add_predef DisplayElevatorFloorMenu add_predef DisplayElevatorFloorMenu
add_predef OaksAideScript add_predef OaksAideScript

View file

@ -638,7 +638,7 @@ SaveHallOfFameTeams:
ld a, [wNumHoFTeams] ld a, [wNumHoFTeams]
dec a dec a
cp HOF_TEAM_CAPACITY cp HOF_TEAM_CAPACITY
jr nc, .asm_73b28 jr nc, .shiftHOFTeams
ld hl, sHallOfFame ld hl, sHallOfFame
ld bc, HOF_TEAM ld bc, HOF_TEAM
call AddNTimes call AddNTimes
@ -648,7 +648,9 @@ SaveHallOfFameTeams:
ld bc, HOF_TEAM ld bc, HOF_TEAM
jr HallOfFame_Copy jr HallOfFame_Copy
.asm_73b28 .shiftHOFTeams
; if the space designated for HOF teams is full, then shift all HOF teams to the next slot, making space for the new HOF team
; this deletes the last HOF team though
ld hl, sHallOfFame + HOF_TEAM ld hl, sHallOfFame + HOF_TEAM
ld de, sHallOfFame ld de, sHallOfFame
ld bc, HOF_TEAM * (HOF_TEAM_CAPACITY - 1) ld bc, HOF_TEAM * (HOF_TEAM_CAPACITY - 1)

View file

@ -865,7 +865,7 @@ LoadSlotMachineTiles:
call FarCopyData2 call FarCopyData2
ld hl, SlotMachineMap ld hl, SlotMachineMap
coord de, 0, 0 coord de, 0, 0
ld bc, $00f0 ld bc, SlotMachineMapEnd - SlotMachineMap
call CopyData call CopyData
call EnableLCD call EnableLCD
ld hl, wSlotMachineWheel1Offset ld hl, wSlotMachineWheel1Offset
@ -879,6 +879,7 @@ LoadSlotMachineTiles:
SlotMachineMap: SlotMachineMap:
INCBIN "gfx/tilemaps/slotmachine.map" INCBIN "gfx/tilemaps/slotmachine.map"
SlotMachineMapEnd:
INCLUDE "data/slot_machine_wheels.asm" INCLUDE "data/slot_machine_wheels.asm"

View file

@ -169,7 +169,7 @@ ENDC
db -1,2 db -1,2
db 0 ; terminate list with 0 db 0 ; terminate list with 0
.ScrollTitleScreenPokemonLogo .ScrollTitleScreenPokemonLogo:
; Scrolls the Pokemon logo on the title screen to create the bouncing effect ; Scrolls the Pokemon logo on the title screen to create the bouncing effect
; Scrolls d pixels e times ; Scrolls d pixels e times
call DelayFrame call DelayFrame

View file

@ -67,7 +67,7 @@ _TitleScroll:
pop bc pop bc
jr _TitleScroll jr _TitleScroll
.ScrollBetween .ScrollBetween:
.wait .wait
ld a, [rLY] ; rLY ld a, [rLY] ; rLY
cp l cp l

View file

@ -141,7 +141,7 @@ LoadTownMap_Fly:
call LoadFontTilePatterns call LoadFontTilePatterns
ld de, BirdSprite ld de, BirdSprite
ld hl, vSprites + $40 ld hl, vSprites + $40
lb bc, BANK(BirdSprite), $0c lb bc, BANK(BirdSprite), $c
call CopyVideoData call CopyVideoData
ld de, TownMapUpArrow ld de, TownMapUpArrow
ld hl, vChars1 + $6d0 ld hl, vChars1 + $6d0
@ -355,12 +355,12 @@ DrawPlayerOrBirdSprite:
call WritePlayerOrBirdSpriteOAM call WritePlayerOrBirdSpriteOAM
pop hl pop hl
ld de, wcd6d ld de, wcd6d
.asm_711dc .loop
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
cp $50 cp "@"
jr nz, .asm_711dc jr nz, .loop
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld de, wTileMapBackup ld de, wTileMapBackup
ld bc, $a0 ld bc, $a0
@ -397,8 +397,8 @@ DisplayWildLocations:
jr nz, .drawPlayerSprite jr nz, .drawPlayerSprite
; if no OAM entries were written, print area unknown text ; if no OAM entries were written, print area unknown text
coord hl, 1, 7 coord hl, 1, 7
ld b, $2 ld b, 2
ld c, $f ld c, 15
call TextBoxBorder call TextBoxBorder
coord hl, 2, 9 coord hl, 2, 9
ld de, AreaUnknownText ld de, AreaUnknownText

View file

@ -305,7 +305,7 @@ Trade_AnimateBallEnteringLinkCable:
ld [rOBP0], a ld [rOBP0], a
xor a xor a
ld [wLinkCableAnimBulgeToggle], a ld [wLinkCableAnimBulgeToggle], a
ld bc, $2060 lb bc, $20, $60
.moveBallInsideLinkCableLoop .moveBallInsideLinkCableLoop
push bc push bc
xor a xor a
@ -380,7 +380,7 @@ Trade_AnimLeftToRight:
call Trade_InitGameboyTransferGfx call Trade_InitGameboyTransferGfx
ld a, $1 ld a, $1
ld [wTradedMonMovingRight], a ld [wTradedMonMovingRight], a
ld a, $e4 ld a, %11100100
ld [rOBP0], a ld [rOBP0], a
ld a, $54 ld a, $54
ld [wBaseCoordX], a ld [wBaseCoordX], a
@ -466,7 +466,7 @@ Trade_DrawLeftGameboy:
ld a, $5d ld a, $5d
ld [hli], a ld [hli], a
ld a, $5e ld a, $5e
ld c, $8 ld c, 8
.loop .loop
ld [hli], a ld [hli], a
dec c dec c
@ -526,8 +526,8 @@ Trade_DrawRightGameboy:
; draw text box with enemy name above link cable ; draw text box with enemy name above link cable
coord hl, 6, 0 coord hl, 6, 0
ld b, $2 ld b, 2
ld c, $7 ld c, 7
call TextBoxBorder call TextBoxBorder
coord hl, 7, 2 coord hl, 7, 2
ld de, wLinkEnemyTrainerName ld de, wLinkEnemyTrainerName

129
home.asm
View file

@ -117,7 +117,6 @@ INCLUDE "home/joypad.asm"
INCLUDE "data/map_header_pointers.asm" INCLUDE "data/map_header_pointers.asm"
INCLUDE "home/overworld.asm" INCLUDE "home/overworld.asm"
CheckForUserInterruption:: CheckForUserInterruption::
; Return carry if Up+Select+B, Start or A are pressed in c frames. ; Return carry if Up+Select+B, Start or A are pressed in c frames.
; Used only in the intro and title screen. ; Used only in the intro and title screen.
@ -255,7 +254,6 @@ DrawHPBar::
LoadMonData:: LoadMonData::
jpab LoadMonData_ jpab LoadMonData_
OverwritewMoves:: OverwritewMoves::
; Write c to [wMoves + b]. Unused. ; Write c to [wMoves + b]. Unused.
ld hl, wMoves ld hl, wMoves
@ -327,7 +325,7 @@ GetCryData::
add hl, bc add hl, bc
add hl, bc add hl, bc
ld a, Bank(CryData) ld a, BANK(CryData)
call BankswitchHome call BankswitchHome
ld a, [hli] ld a, [hli]
ld b, a ; cry id ld b, a ; cry id
@ -347,7 +345,6 @@ GetCryData::
add c add c
ret ret
DisplayPartyMenu:: DisplayPartyMenu::
ld a,[hTilesetType] ld a,[hTilesetType]
push af push af
@ -497,6 +494,7 @@ PrintStatusCondition::
ld [hl],"T" ld [hl],"T"
and a and a
ret ret
PrintStatusConditionNotFainted: PrintStatusConditionNotFainted:
ld a,[H_LOADEDROMBANK] ld a,[H_LOADEDROMBANK]
push af push af
@ -519,7 +517,7 @@ PrintLevel::
ld [hli],a ld [hli],a
ld c,2 ; number of digits ld c,2 ; number of digits
ld a,[wLoadedMonLevel] ; level ld a,[wLoadedMonLevel] ; level
cp a,100 cp 100
jr c,PrintLevelCommon jr c,PrintLevelCommon
; if level at least 100, write over the ":L" tile ; if level at least 100, write over the ":L" tile
dec hl dec hl
@ -569,25 +567,25 @@ GetMonHeader::
ld [wd11e],a ld [wd11e],a
ld de,FossilKabutopsPic ld de,FossilKabutopsPic
ld b,$66 ; size of Kabutops fossil and Ghost sprites ld b,$66 ; size of Kabutops fossil and Ghost sprites
cp a,FOSSIL_KABUTOPS ; Kabutops fossil cp FOSSIL_KABUTOPS ; Kabutops fossil
jr z,.specialID jr z,.specialID
ld de,GhostPic ld de,GhostPic
cp a,MON_GHOST ; Ghost cp MON_GHOST ; Ghost
jr z,.specialID jr z,.specialID
ld de,FossilAerodactylPic ld de,FossilAerodactylPic
ld b,$77 ; size of Aerodactyl fossil sprite ld b,$77 ; size of Aerodactyl fossil sprite
cp a,FOSSIL_AERODACTYL ; Aerodactyl fossil cp FOSSIL_AERODACTYL ; Aerodactyl fossil
jr z,.specialID jr z,.specialID
cp a,MEW cp a,MEW
jr z,.mew jr z,.mew
predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number
ld a,[wd11e] ld a,[wd11e]
dec a dec a
ld bc,MonBaseStatsEnd - MonBaseStats ld bc, MonBaseStatsEnd - MonBaseStats
ld hl,BaseStats ld hl,BaseStats
call AddNTimes call AddNTimes
ld de,wMonHeader ld de,wMonHeader
ld bc,MonBaseStatsEnd - MonBaseStats ld bc, MonBaseStatsEnd - MonBaseStats
call CopyData call CopyData
jr .done jr .done
.specialID .specialID
@ -703,7 +701,7 @@ PrintBCDDigit::
.skipCurrencySymbol .skipCurrencySymbol
res 7,b ; unset 7 to indicate that a nonzero digit has been reached res 7,b ; unset 7 to indicate that a nonzero digit has been reached
.outputDigit .outputDigit
add a,"0" add "0"
ld [hli],a ld [hli],a
jp PrintLetterDelay jp PrintLetterDelay
.zeroDigit .zeroDigit
@ -999,15 +997,15 @@ ResetPlayerSpriteData_ClearSpriteData::
FadeOutAudio:: FadeOutAudio::
ld a, [wAudioFadeOutControl] ld a, [wAudioFadeOutControl]
and a and a ; currently fading out audio?
jr nz, .asm_28dc jr nz, .fadingOut
ld a, [wd72c] ld a, [wd72c]
bit 1, a bit 1, a
ret nz ret nz
ld a, $77 ld a, $77
ld [rNR50], a ld [rNR50], a
ret ret
.asm_28dc .fadingOut
ld a, [wAudioFadeOutCounter] ld a, [wAudioFadeOutCounter]
and a and a
jr z, .counterReachedZero jr z, .counterReachedZero
@ -1018,8 +1016,8 @@ FadeOutAudio::
ld a, [wAudioFadeOutCounterReloadValue] ld a, [wAudioFadeOutCounterReloadValue]
ld [wAudioFadeOutCounter], a ld [wAudioFadeOutCounter], a
ld a, [rNR50] ld a, [rNR50]
and a and a ; has the volume reached 0?
jr z, .asm_2903 jr z, .fadeOutComplete
ld b, a ld b, a
and $f and $f
dec a dec a
@ -1032,7 +1030,7 @@ FadeOutAudio::
or c or c
ld [rNR50], a ld [rNR50], a
ret ret
.asm_2903 .fadeOutComplete
ld a, [wAudioFadeOutControl] ld a, [wAudioFadeOutControl]
ld b, a ld b, a
xor a xor a
@ -1070,13 +1068,13 @@ DisplayTextID::
ld [wSpriteIndex],a ld [wSpriteIndex],a
and a and a
jp z,DisplayStartMenu jp z,DisplayStartMenu
cp a,TEXT_SAFARI_GAME_OVER cp TEXT_SAFARI_GAME_OVER
jp z,DisplaySafariGameOverText jp z,DisplaySafariGameOverText
cp a,TEXT_MON_FAINTED cp TEXT_MON_FAINTED
jp z,DisplayPokemonFaintedText jp z,DisplayPokemonFaintedText
cp a,TEXT_BLACKED_OUT cp TEXT_BLACKED_OUT
jp z,DisplayPlayerBlackedOutText jp z,DisplayPlayerBlackedOutText
cp a,TEXT_REPEL_WORE_OFF cp TEXT_REPEL_WORE_OFF
jp z,DisplayRepelWoreOffText jp z,DisplayRepelWoreOffText
ld a,[wNumSprites] ld a,[wNumSprites]
ld e,a ld e,a
@ -1115,24 +1113,24 @@ DisplayTextID::
ld l,a ; hl = address of the text ld l,a ; hl = address of the text
ld a,[hl] ; a = first byte of text ld a,[hl] ; a = first byte of text
; check first byte of text for special cases ; check first byte of text for special cases
cp a,$fe ; Pokemart NPC cp $fe ; Pokemart NPC
jp z,DisplayPokemartDialogue jp z,DisplayPokemartDialogue
cp a,$ff ; Pokemon Center NPC cp $ff ; Pokemon Center NPC
jp z,DisplayPokemonCenterDialogue jp z,DisplayPokemonCenterDialogue
cp a,$fc ; Item Storage PC cp $fc ; Item Storage PC
jp z,FuncTX_ItemStoragePC jp z,FuncTX_ItemStoragePC
cp a,$fd ; Bill's PC cp $fd ; Bill's PC
jp z,FuncTX_BillsPC jp z,FuncTX_BillsPC
cp a,$f9 ; Pokemon Center PC cp $f9 ; Pokemon Center PC
jp z,FuncTX_PokemonCenterPC jp z,FuncTX_PokemonCenterPC
cp a,$f5 ; Vending Machine cp $f5 ; Vending Machine
jr nz,.notVendingMachine jr nz,.notVendingMachine
callba VendingMachineMenu ; jump banks to vending machine routine callba VendingMachineMenu ; jump banks to vending machine routine
jr AfterDisplayingTextID jr AfterDisplayingTextID
.notVendingMachine .notVendingMachine
cp a,$f7 ; slot machine cp $f7 ; prize menu
jp z,FuncTX_SlotMachine jp z, FuncTX_GameCornerPrizeMenu
cp a,$f6 ; cable connection NPC in Pokemon Center cp $f6 ; cable connection NPC in Pokemon Center
jr nz,.notSpecialCase jr nz,.notSpecialCase
callab CableClubNPC callab CableClubNPC
jr AfterDisplayingTextID jr AfterDisplayingTextID
@ -1227,7 +1225,7 @@ LoadItemList::
ld a,[hli] ld a,[hli]
ld [de],a ld [de],a
inc de inc de
cp a,$ff cp $ff
jr nz,.loop jr nz,.loop
ret ret
@ -1381,7 +1379,7 @@ DisplayListMenuID::
ld a,$01 ; hardcoded bank ld a,$01 ; hardcoded bank
jr .bankswitch jr .bankswitch
.specialBattleType ; Old Man battle .specialBattleType ; Old Man battle
ld a, Bank(DisplayBattleMenu) ld a, BANK(DisplayBattleMenu)
.bankswitch .bankswitch
call BankswitchHome call BankswitchHome
ld hl,wd730 ld hl,wd730
@ -1410,7 +1408,7 @@ DisplayListMenuID::
ld a,1 ; max menu item ID is 1 if the list has less than 2 entries ld a,1 ; max menu item ID is 1 if the list has less than 2 entries
ld [wMenuWatchMovingOutOfBounds],a ld [wMenuWatchMovingOutOfBounds],a
ld a,[wListCount] ld a,[wListCount]
cp a,2 ; does the list have less than 2 entries? cp 2 ; does the list have less than 2 entries?
jr c,.setMenuVariables jr c,.setMenuVariables
ld a,2 ; max menu item ID is 2 if the list has at least 2 entries ld a,2 ; max menu item ID is 2 if the list has at least 2 entries
.setMenuVariables .setMenuVariables
@ -1480,7 +1478,7 @@ DisplayListMenuIDLoop::
ld a,c ld a,c
ld [wWhichPokemon],a ld [wWhichPokemon],a
ld a,[wListMenuID] ld a,[wListMenuID]
cp a,ITEMLISTMENU cp ITEMLISTMENU
jr nz,.skipMultiplying jr nz,.skipMultiplying
; if it's an item menu ; if it's an item menu
sla c ; item entries are 2 bytes long, so multiply by 2 sla c ; item entries are 2 bytes long, so multiply by 2
@ -1501,7 +1499,7 @@ DisplayListMenuIDLoop::
call GetItemPrice call GetItemPrice
pop hl pop hl
ld a,[wListMenuID] ld a,[wListMenuID]
cp a,ITEMLISTMENU cp ITEMLISTMENU
jr nz,.skipGettingQuantity jr nz,.skipGettingQuantity
; if it's an item menu ; if it's an item menu
inc hl inc hl
@ -1547,7 +1545,7 @@ DisplayListMenuIDLoop::
jr z,.upPressed jr z,.upPressed
.downPressed .downPressed
ld a,[hl] ld a,[hl]
add a,3 add 3
ld b,a ld b,a
ld a,[wListCount] ld a,[wListCount]
cp b ; will going down scroll past the Cancel button? cp b ; will going down scroll past the Cancel button?
@ -1567,7 +1565,7 @@ DisplayChooseQuantityMenu::
ld b,1 ; height ld b,1 ; height
ld c,3 ; width ld c,3 ; width
ld a,[wListMenuID] ld a,[wListMenuID]
cp a,PRICEDITEMLISTMENU cp PRICEDITEMLISTMENU
jr nz,.drawTextBox jr nz,.drawTextBox
; text box dimensions/coordinates for quantity and price ; text box dimensions/coordinates for quantity and price
coord hl, 7, 9 coord hl, 7, 9
@ -1577,7 +1575,7 @@ DisplayChooseQuantityMenu::
call TextBoxBorder call TextBoxBorder
coord hl, 16, 10 coord hl, 16, 10
ld a,[wListMenuID] ld a,[wListMenuID]
cp a,PRICEDITEMLISTMENU cp PRICEDITEMLISTMENU
jr nz,.printInitialQuantity jr nz,.printInitialQuantity
coord hl, 8, 10 coord hl, 8, 10
.printInitialQuantity .printInitialQuantity
@ -1621,7 +1619,7 @@ DisplayChooseQuantityMenu::
.handleNewQuantity .handleNewQuantity
coord hl, 17, 10 coord hl, 17, 10
ld a,[wListMenuID] ld a,[wListMenuID]
cp a,PRICEDITEMLISTMENU cp PRICEDITEMLISTMENU
jr nz,.printQuantity jr nz,.printQuantity
.printPrice .printPrice
ld c,$03 ld c,$03
@ -1715,7 +1713,7 @@ PrintListMenuEntries::
ld a,[wListScrollOffset] ld a,[wListScrollOffset]
ld c,a ld c,a
ld a,[wListMenuID] ld a,[wListMenuID]
cp a,ITEMLISTMENU cp ITEMLISTMENU
ld a,c ld a,c
jr nz,.skipMultiplying jr nz,.skipMultiplying
; if it's an item menu ; if it's an item menu
@ -1735,7 +1733,7 @@ PrintListMenuEntries::
ld [wWhichPokemon],a ld [wWhichPokemon],a
ld a,[de] ld a,[de]
ld [wd11e],a ld [wd11e],a
cp a,$ff cp $ff
jp z,.printCancelMenuItem jp z,.printCancelMenuItem
push bc push bc
push de push de
@ -1745,7 +1743,7 @@ PrintListMenuEntries::
ld a,[wListMenuID] ld a,[wListMenuID]
and a and a
jr z,.pokemonPCMenu jr z,.pokemonPCMenu
cp a,$01 cp MOVESLISTMENU
jr z,.movesMenu jr z,.movesMenu
.itemMenu .itemMenu
call GetItemName call GetItemName
@ -1833,7 +1831,7 @@ PrintListMenuEntries::
pop de pop de
inc de inc de
ld a,[wListMenuID] ld a,[wListMenuID]
cp a,ITEMLISTMENU cp ITEMLISTMENU
jr nz,.nextListEntry jr nz,.nextListEntry
.printItemQuantity .printItemQuantity
ld a,[wd11e] ld a,[wd11e]
@ -1990,7 +1988,6 @@ GetMachineName::
inc de inc de
ld a,"@" ld a,"@"
ld [de],a ld [de],a
pop af pop af
ld [wd11e],a ld [wd11e],a
pop bc pop bc
@ -2006,9 +2003,9 @@ HiddenPrefix::
; sets carry if item is HM, clears carry if item is not HM ; sets carry if item is HM, clears carry if item is not HM
; Input: a = item ID ; Input: a = item ID
IsItemHM:: IsItemHM::
cp a,HM_01 cp HM_01
jr c,.notHM jr c,.notHM
cp a,TM_01 cp TM_01
ret ret
.notHM .notHM
and a and a
@ -2188,6 +2185,7 @@ RunNPCMovementScript::
ld [H_LOADEDROMBANK], a ld [H_LOADEDROMBANK], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
ret ret
.NPCMovementScriptPointerTables .NPCMovementScriptPointerTables
dw PalletMovementScriptPointerTable dw PalletMovementScriptPointerTable
dw PewterMuseumGuyMovementScriptPointerTable dw PewterMuseumGuyMovementScriptPointerTable
@ -2678,7 +2676,7 @@ FuncTX_BillsPC::
ld hl, BillsPC_ ld hl, BillsPC_
jr bankswitchAndContinue jr bankswitchAndContinue
FuncTX_SlotMachine:: FuncTX_GameCornerPrizeMenu::
; XXX find a better name for this function ; XXX find a better name for this function
; special_F7 ; special_F7
ld b,BANK(CeladonPrizeMenu) ld b,BANK(CeladonPrizeMenu)
@ -2751,7 +2749,7 @@ CheckCoords::
ld [wCoordIndex],a ld [wCoordIndex],a
.loop .loop
ld a,[hli] ld a,[hli]
cp a,$ff ; reached terminator? cp $ff ; reached terminator?
jr z,.notInArray jr z,.notInArray
push hl push hl
ld hl,wCoordIndex ld hl,wCoordIndex
@ -2870,7 +2868,7 @@ GetSpriteMovementByte1Pointer::
ld h,$C2 ld h,$C2
ld a,[H_SPRITEINDEX] ld a,[H_SPRITEINDEX]
swap a swap a
add a,6 add 6
ld l,a ld l,a
ret ret
@ -2923,7 +2921,6 @@ GetTrainerInformation::
GetTrainerName:: GetTrainerName::
jpba GetTrainerName_ jpba GetTrainerName_
HasEnoughMoney:: HasEnoughMoney::
; Check if the player has at least as much ; Check if the player has at least as much
; money as the 3-byte BCD value at hMoney. ; money as the 3-byte BCD value at hMoney.
@ -3005,12 +3002,13 @@ YesNoChoicePokeCenter::
lb bc, 8, 12 lb bc, 8, 12
jr DisplayYesNoChoice jr DisplayYesNoChoice
Func_361a:: WideYesNoChoice:: ; unused
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
ld a, WIDE_YES_NO_MENU ld a, WIDE_YES_NO_MENU
ld [wTwoOptionMenuID], a ld [wTwoOptionMenuID], a
coord hl, 12, 7 coord hl, 12, 7
lb bc, 8, 13 lb bc, 8, 13
DisplayYesNoChoice:: DisplayYesNoChoice::
ld a, TWO_OPTION_MENU ld a, TWO_OPTION_MENU
ld [wTextBoxID], a ld [wTextBoxID], a
@ -3044,7 +3042,7 @@ MoveSprite_::
ld [hli],a ld [hli],a
inc de inc de
inc c inc c
cp a,$FF ; have we reached the end of the movement data? cp $FF ; have we reached the end of the movement data?
jr nz,.loop jr nz,.loop
ld a,c ld a,c
@ -3065,7 +3063,7 @@ MoveSprite_::
; divides [hDividend2] by [hDivisor2] and stores the quotient in [hQuotient2] ; divides [hDividend2] by [hDivisor2] and stores the quotient in [hQuotient2]
DivideBytes:: DivideBytes::
push hl push hl
ld hl, $ffe7 ld hl, hQuotient2
xor a xor a
ld [hld], a ld [hld], a
ld a, [hld] ld a, [hld]
@ -3156,7 +3154,6 @@ UncompressSpriteFromDE::
ld [hl], d ld [hl], d
jp UncompressSpriteData jp UncompressSpriteData
SaveScreenTilesToBuffer2:: SaveScreenTilesToBuffer2::
coord hl, 0, 0 coord hl, 0, 0
ld de, wTileMapBackup2 ld de, wTileMapBackup2
@ -3198,7 +3195,7 @@ LoadScreenTilesFromBuffer1::
ret ret
DelayFrames:: DelayFrames::
; wait n frames, where n is the value in c ; wait c frames
call DelayFrame call DelayFrame
dec c dec c
jr nz,DelayFrames jr nz,DelayFrames
@ -3299,7 +3296,7 @@ GetName::
ld e,l ld e,l
.nextChar .nextChar
ld a,[hli] ld a,[hli]
cp a, "@" cp "@"
jr nz,.nextChar jr nz,.nextChar
inc c ;entry counter inc c ;entry counter
ld a,b ;wanted entry ld a,b ;wanted entry
@ -3331,9 +3328,9 @@ GetItemPrice::
ld a, [wListMenuID] ld a, [wListMenuID]
cp MOVESLISTMENU cp MOVESLISTMENU
ld a, BANK(ItemPrices) ld a, BANK(ItemPrices)
jr nz, .asm_37ed jr nz, .ok
ld a, $f ; hardcoded Bank ld a, $f ; hardcoded Bank
.asm_37ed .ok
ld [H_LOADEDROMBANK], a ld [H_LOADEDROMBANK], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
ld hl, wItemPrices ld hl, wItemPrices
@ -3344,10 +3341,10 @@ GetItemPrice::
cp HM_01 cp HM_01
jr nc, .getTMPrice jr nc, .getTMPrice
ld bc, $3 ld bc, $3
.asm_3802 .loop
add hl, bc add hl, bc
dec a dec a
jr nz, .asm_3802 jr nz, .loop
dec hl dec hl
ld a, [hld] ld a, [hld]
ld [hItemPrice + 2], a ld [hItemPrice + 2], a
@ -3355,13 +3352,13 @@ GetItemPrice::
ld [hItemPrice + 1], a ld [hItemPrice + 1], a
ld a, [hl] ld a, [hl]
ld [hItemPrice], a ld [hItemPrice], a
jr .asm_381c jr .done
.getTMPrice .getTMPrice
ld a, Bank(GetMachinePrice) ld a, Bank(GetMachinePrice)
ld [H_LOADEDROMBANK], a ld [H_LOADEDROMBANK], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
call GetMachinePrice call GetMachinePrice
.asm_381c .done
ld de, hItemPrice ld de, hItemPrice
pop af pop af
ld [H_LOADEDROMBANK], a ld [H_LOADEDROMBANK], a
@ -4074,7 +4071,7 @@ PlaceMenuCursor::
jr nz,.currentMenuItemLoop jr nz,.currentMenuItemLoop
.checkForArrow2 .checkForArrow2
ld a,[hl] ld a,[hl]
cp a,"▶" ; has the right arrow already been placed? cp "▶" ; has the right arrow already been placed?
jr z,.skipSavingTile ; if so, don't lose the saved tile jr z,.skipSavingTile ; if so, don't lose the saved tile
ld [wTileBehindCursor],a ; save tile before overwriting with right arrow ld [wTileBehindCursor],a ; save tile before overwriting with right arrow
.skipSavingTile .skipSavingTile
@ -4655,6 +4652,8 @@ SetMapTextPointer::
ret ret
TextPredefs:: TextPredefs::
const_value = 1
add_tx_pre CardKeySuccessText ; 01 add_tx_pre CardKeySuccessText ; 01
add_tx_pre CardKeyFailText ; 02 add_tx_pre CardKeyFailText ; 02
add_tx_pre RedBedroomPCText ; 03 add_tx_pre RedBedroomPCText ; 03
@ -4709,8 +4708,8 @@ TextPredefs::
add_tx_pre LinkCableHelp ; 34 add_tx_pre LinkCableHelp ; 34
add_tx_pre TMNotebook ; 35 add_tx_pre TMNotebook ; 35
add_tx_pre FightingDojoText ; 36 add_tx_pre FightingDojoText ; 36
add_tx_pre FightingDojoText_52a10 ; 37 add_tx_pre EnemiesOnEverySideText ; 37
add_tx_pre FightingDojoText_52a1d ; 38 add_tx_pre WhatGoesAroundComesAroundText ; 38
add_tx_pre NewBicycleText ; 39 add_tx_pre NewBicycleText ; 39
add_tx_pre IndigoPlateauStatues ; 3A add_tx_pre IndigoPlateauStatues ; 3A
add_tx_pre VermilionGymTrashSuccessText1 ; 3B add_tx_pre VermilionGymTrashSuccessText1 ; 3B

View file

@ -1,7 +1,7 @@
; These routines manage gradual fading ; These routines manage gradual fading
; (e.g., entering a doorway) ; (e.g., entering a doorway)
LoadGBPal:: LoadGBPal::
ld a, [wMapPalOffset] ;tells if cur.map is dark (requires HM5_FLASH?) ld a, [wMapPalOffset] ;tells if wCurMap is dark (requires HM5_FLASH?)
ld b, a ld b, a
ld hl, FadePal4 ld hl, FadePal4
ld a, l ld a, l

View file

@ -59,7 +59,7 @@ OverworldLoopLessDelay::
res 3,[hl] res 3,[hl]
jp nz,WarpFound2 jp nz,WarpFound2
ld a,[wd732] ld a,[wd732]
and a,1 << 4 | 1 << 3 ; fly warp or dungeon warp and 1 << 4 | 1 << 3 ; fly warp or dungeon warp
jp nz,HandleFlyWarpOrDungeonWarp jp nz,HandleFlyWarpOrDungeonWarp
ld a,[wCurOpponent] ld a,[wCurOpponent]
and a and a
@ -133,7 +133,7 @@ OverworldLoopLessDelay::
ld hl,wFlags_0xcd60 ld hl,wFlags_0xcd60
res 2,[hl] res 2,[hl]
call UpdateSprites call UpdateSprites
ld a,1 ld a, 1
ld [wCheckFor180DegreeTurn],a ld [wCheckFor180DegreeTurn],a
ld a,[wPlayerMovingDirection] ; the direction that was pressed last time ld a,[wPlayerMovingDirection] ; the direction that was pressed last time
and a and a
@ -143,6 +143,7 @@ OverworldLoopLessDelay::
xor a xor a
ld [wPlayerMovingDirection],a ; zero the direction ld [wPlayerMovingDirection],a ; zero the direction
jp OverworldLoop jp OverworldLoop
.checkIfDownButtonIsPressed .checkIfDownButtonIsPressed
ld a,[hJoyHeld] ; current joypad state ld a,[hJoyHeld] ; current joypad state
bit 7,a ; down button bit 7,a ; down button
@ -151,6 +152,7 @@ OverworldLoopLessDelay::
ld [wSpriteStateData1 + 3],a ; delta Y ld [wSpriteStateData1 + 3],a ; delta Y
ld a,PLAYER_DIR_DOWN ld a,PLAYER_DIR_DOWN
jr .handleDirectionButtonPress jr .handleDirectionButtonPress
.checkIfUpButtonIsPressed .checkIfUpButtonIsPressed
bit 6,a ; up button bit 6,a ; up button
jr z,.checkIfLeftButtonIsPressed jr z,.checkIfLeftButtonIsPressed
@ -158,6 +160,7 @@ OverworldLoopLessDelay::
ld [wSpriteStateData1 + 3],a ; delta Y ld [wSpriteStateData1 + 3],a ; delta Y
ld a,PLAYER_DIR_UP ld a,PLAYER_DIR_UP
jr .handleDirectionButtonPress jr .handleDirectionButtonPress
.checkIfLeftButtonIsPressed .checkIfLeftButtonIsPressed
bit 5,a ; left button bit 5,a ; left button
jr z,.checkIfRightButtonIsPressed jr z,.checkIfRightButtonIsPressed
@ -165,11 +168,14 @@ OverworldLoopLessDelay::
ld [wSpriteStateData1 + 5],a ; delta X ld [wSpriteStateData1 + 5],a ; delta X
ld a,PLAYER_DIR_LEFT ld a,PLAYER_DIR_LEFT
jr .handleDirectionButtonPress jr .handleDirectionButtonPress
.checkIfRightButtonIsPressed .checkIfRightButtonIsPressed
bit 4,a ; right button bit 4,a ; right button
jr z,.noDirectionButtonsPressed jr z,.noDirectionButtonsPressed
ld a,1 ; PLAYER_DIR_RIGHT ld a, 1
ld [wSpriteStateData1 + 5],a ; delta X ld [wSpriteStateData1 + 5],a ; delta X
.handleDirectionButtonPress .handleDirectionButtonPress
ld [wPlayerDirection],a ; new direction ld [wPlayerDirection],a ; new direction
ld a,[wd730] ld a,[wd730]
@ -226,12 +232,13 @@ OverworldLoopLessDelay::
call NewBattle call NewBattle
jp c,.battleOccurred jp c,.battleOccurred
jp OverworldLoop jp OverworldLoop
.noDirectionChange .noDirectionChange
ld a,[wPlayerDirection] ; current direction ld a,[wPlayerDirection] ; current direction
ld [wPlayerMovingDirection],a ; save direction ld [wPlayerMovingDirection],a ; save direction
call UpdateSprites call UpdateSprites
ld a,[wWalkBikeSurfState] ld a,[wWalkBikeSurfState]
cp a,$02 ; surfing cp $02 ; surfing
jr z,.surfing jr z,.surfing
; not surfing ; not surfing
call CollisionCheckOnLand call CollisionCheckOnLand
@ -248,20 +255,24 @@ OverworldLoopLessDelay::
pop hl pop hl
jp c,CheckWarpsCollision jp c,CheckWarpsCollision
jp OverworldLoop jp OverworldLoop
.surfing .surfing
call CollisionCheckOnWater call CollisionCheckOnWater
jp c,OverworldLoop jp c,OverworldLoop
.noCollision .noCollision
ld a,$08 ld a,$08
ld [wWalkCounter],a ld [wWalkCounter],a
jr .moveAhead2 jr .moveAhead2
.moveAhead .moveAhead
ld a,[wd736] ld a,[wd736]
bit 7,a bit 7,a
jr z,.noSpinning jr z,.noSpinning
callba LoadSpinnerArrowTiles ; spin while moving callba LoadSpinnerArrowTiles
.noSpinning .noSpinning
call UpdateSprites call UpdateSprites
.moveAhead2 .moveAhead2
ld hl,wFlags_0xcd60 ld hl,wFlags_0xcd60
res 2,[hl] res 2,[hl]
@ -271,7 +282,7 @@ OverworldLoopLessDelay::
ld a,[wd736] ld a,[wd736]
bit 6,a ; jumping a ledge? bit 6,a ; jumping a ledge?
jr nz,.normalPlayerSpriteAdvancement jr nz,.normalPlayerSpriteAdvancement
call BikeSpeedup ; if riding a bike and not jumping a ledge call DoBikeSpeedup
.normalPlayerSpriteAdvancement .normalPlayerSpriteAdvancement
call AdvancePlayerSprite call AdvancePlayerSprite
ld a,[wWalkCounter] ld a,[wWalkCounter]
@ -323,14 +334,14 @@ OverworldLoopLessDelay::
xor a xor a
ld [hJoyHeld],a ld [hJoyHeld],a
ld a,[wCurMap] ld a,[wCurMap]
cp a,CINNABAR_GYM cp CINNABAR_GYM
jr nz,.notCinnabarGym jr nz,.notCinnabarGym
SetEvent EVENT_2A7 SetEvent EVENT_2A7
.notCinnabarGym .notCinnabarGym
ld hl,wd72e ld hl,wd72e
set 5,[hl] set 5,[hl]
ld a,[wCurMap] ld a,[wCurMap]
cp a,OAKS_LAB cp OAKS_LAB
jp z,.noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab jp z,.noFaintCheck ; no blacking out if the player lost to the rival in Oak's lab
callab AnyPartyAlive callab AnyPartyAlive
ld a,d ld a,d
@ -363,15 +374,15 @@ NewBattle::
ret ret
; function to make bikes twice as fast as walking ; function to make bikes twice as fast as walking
BikeSpeedup:: DoBikeSpeedup::
ld a,[wNPCMovementScriptPointerTableNum] ld a,[wNPCMovementScriptPointerTableNum]
and a and a
ret nz ret nz
ld a,[wCurMap] ld a,[wCurMap]
cp a,ROUTE_17 ; Cycling Road cp ROUTE_17 ; Cycling Road
jr nz,.goFaster jr nz,.goFaster
ld a,[hJoyHeld] ld a,[hJoyHeld]
and a,D_UP | D_LEFT | D_RIGHT and D_UP | D_LEFT | D_RIGHT
ret nz ret nz
.goFaster .goFaster
jp AdvancePlayerSprite jp AdvancePlayerSprite
@ -421,7 +432,7 @@ CheckWarpsNoCollisionLoop::
pop bc pop bc
pop de pop de
ld a,[hJoyHeld] ld a,[hJoyHeld]
and a,D_DOWN | D_UP | D_LEFT | D_RIGHT and D_DOWN | D_UP | D_LEFT | D_RIGHT
jr z,CheckWarpsNoCollisionRetry2 ; if directional buttons aren't being pressed, do not pass through the warp jr z,CheckWarpsNoCollisionRetry2 ; if directional buttons aren't being pressed, do not pass through the warp
jr WarpFound1 jr WarpFound1
@ -483,7 +494,7 @@ WarpFound2::
ld [wUnusedD366],a ; not read ld [wUnusedD366],a ; not read
ld a,[hWarpDestinationMap] ld a,[hWarpDestinationMap]
ld [wCurMap],a ld [wCurMap],a
cp a,ROCK_TUNNEL_1 cp ROCK_TUNNEL_1
jr nz,.notRockTunnel jr nz,.notRockTunnel
ld a,$06 ld a,$06
ld [wMapPalOffset],a ld [wMapPalOffset],a
@ -491,10 +502,12 @@ WarpFound2::
.notRockTunnel .notRockTunnel
call PlayMapChangeSound call PlayMapChangeSound
jr .done jr .done
; for maps that can have the 0xFF destination map, which means to return to the outside map; not all these maps are necessarily indoors, though
; for maps that can have the 0xFF destination map, which means to return to the outside map
; not all these maps are necessarily indoors, though
.indoorMaps .indoorMaps
ld a,[hWarpDestinationMap] ; destination map ld a,[hWarpDestinationMap] ; destination map
cp a,$ff cp $ff
jr z,.goBackOutside jr z,.goBackOutside
; if not going back to the previous map ; if not going back to the previous map
ld [wCurMap],a ld [wCurMap],a
@ -535,7 +548,7 @@ ContinueCheckWarpsNoCollisionLoop::
CheckMapConnections:: CheckMapConnections::
.checkWestMap .checkWestMap
ld a,[wXCoord] ld a,[wXCoord]
cp a,$ff cp $ff
jr nz,.checkEastMap jr nz,.checkEastMap
ld a,[wMapConn3Ptr] ld a,[wMapConn3Ptr]
ld [wCurMap],a ld [wCurMap],a
@ -555,7 +568,7 @@ CheckMapConnections::
jr z,.savePointer1 jr z,.savePointer1
.pointerAdjustmentLoop1 .pointerAdjustmentLoop1
ld a,[wWestConnectedMapWidth] ; width of connected map ld a,[wWestConnectedMapWidth] ; width of connected map
add a,MAP_BORDER * 2 add MAP_BORDER * 2
ld e,a ld e,a
ld d,0 ld d,0
ld b,0 ld b,0
@ -568,6 +581,7 @@ CheckMapConnections::
ld a,h ld a,h
ld [wCurrentTileBlockMapViewPointer + 1],a ld [wCurrentTileBlockMapViewPointer + 1],a
jp .loadNewMap jp .loadNewMap
.checkEastMap .checkEastMap
ld b,a ld b,a
ld a,[wCurrentMapWidth2] ; map width ld a,[wCurrentMapWidth2] ; map width
@ -591,7 +605,7 @@ CheckMapConnections::
jr z,.savePointer2 jr z,.savePointer2
.pointerAdjustmentLoop2 .pointerAdjustmentLoop2
ld a,[wEastConnectedMapWidth] ld a,[wEastConnectedMapWidth]
add a,MAP_BORDER * 2 add MAP_BORDER * 2
ld e,a ld e,a
ld d,0 ld d,0
ld b,0 ld b,0
@ -604,9 +618,10 @@ CheckMapConnections::
ld a,h ld a,h
ld [wCurrentTileBlockMapViewPointer + 1],a ld [wCurrentTileBlockMapViewPointer + 1],a
jp .loadNewMap jp .loadNewMap
.checkNorthMap .checkNorthMap
ld a,[wYCoord] ld a,[wYCoord]
cp a,$ff cp $ff
jr nz,.checkSouthMap jr nz,.checkSouthMap
ld a,[wMapConn1Ptr] ld a,[wMapConn1Ptr]
ld [wCurMap],a ld [wCurMap],a
@ -630,6 +645,7 @@ CheckMapConnections::
ld a,h ld a,h
ld [wCurrentTileBlockMapViewPointer + 1],a ld [wCurrentTileBlockMapViewPointer + 1],a
jp .loadNewMap jp .loadNewMap
.checkSouthMap .checkSouthMap
ld b,a ld b,a
ld a,[wCurrentMapHeight2] ld a,[wCurrentMapHeight2]
@ -666,13 +682,14 @@ CheckMapConnections::
callba InitMapSprites callba InitMapSprites
call LoadTileBlockMap call LoadTileBlockMap
jp OverworldLoopLessDelay jp OverworldLoopLessDelay
.didNotEnterConnectedMap .didNotEnterConnectedMap
jp OverworldLoop jp OverworldLoop
; function to play a sound when changing maps ; function to play a sound when changing maps
PlayMapChangeSound:: PlayMapChangeSound::
aCoord 8, 8 ; upper left tile of the 4x4 square the player's sprite is standing on aCoord 8, 8 ; upper left tile of the 4x4 square the player's sprite is standing on
cp a,$0b ; door tile in tileset 0 cp $0b ; door tile in tileset 0
jr nz,.didNotGoThroughDoor jr nz,.didNotGoThroughDoor
ld a,SFX_GO_INSIDE ld a,SFX_GO_INSIDE
jr .playSound jr .playSound
@ -854,13 +871,13 @@ INCLUDE "data/bike_riding_tilesets.asm"
; load the tile pattern data of the current tileset into VRAM ; load the tile pattern data of the current tileset into VRAM
LoadTilesetTilePatternData:: LoadTilesetTilePatternData::
ld a,[wTileSetGFXPtr] ld a,[wTilesetGfxPtr]
ld l,a ld l,a
ld a,[wTileSetGFXPtr + 1] ld a,[wTilesetGfxPtr + 1]
ld h,a ld h,a
ld de,vTileset ld de,vTileset
ld bc,$600 ld bc,$600
ld a,[wTileSetBank] ld a,[wTilesetBank]
jp FarCopyData2 jp FarCopyData2
; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8 ; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8
@ -883,7 +900,7 @@ LoadTileBlockMap::
ld hl,wOverworldMap ld hl,wOverworldMap
ld a,[wCurMapWidth] ld a,[wCurMapWidth]
ld [hMapWidth],a ld [hMapWidth],a
add a,MAP_BORDER * 2 ; east and west add MAP_BORDER * 2 ; east and west
ld [hMapStride],a ; map width + border ld [hMapStride],a ; map width + border
ld b,0 ld b,0
ld c,a ld c,a
@ -921,7 +938,7 @@ LoadTileBlockMap::
jr nz,.rowLoop jr nz,.rowLoop
.northConnection .northConnection
ld a,[wMapConn1Ptr] ld a,[wMapConn1Ptr]
cp a,$ff cp $ff
jr z,.southConnection jr z,.southConnection
call SwitchToMapRomBank call SwitchToMapRomBank
ld a,[wNorthConnectionStripSrc] ld a,[wNorthConnectionStripSrc]
@ -939,7 +956,7 @@ LoadTileBlockMap::
call LoadNorthSouthConnectionsTileMap call LoadNorthSouthConnectionsTileMap
.southConnection .southConnection
ld a,[wMapConn2Ptr] ld a,[wMapConn2Ptr]
cp a,$ff cp $ff
jr z,.westConnection jr z,.westConnection
call SwitchToMapRomBank call SwitchToMapRomBank
ld a,[wSouthConnectionStripSrc] ld a,[wSouthConnectionStripSrc]
@ -957,7 +974,7 @@ LoadTileBlockMap::
call LoadNorthSouthConnectionsTileMap call LoadNorthSouthConnectionsTileMap
.westConnection .westConnection
ld a,[wMapConn3Ptr] ld a,[wMapConn3Ptr]
cp a,$ff cp $ff
jr z,.eastConnection jr z,.eastConnection
call SwitchToMapRomBank call SwitchToMapRomBank
ld a,[wWestConnectionStripSrc] ld a,[wWestConnectionStripSrc]
@ -975,7 +992,7 @@ LoadTileBlockMap::
call LoadEastWestConnectionsTileMap call LoadEastWestConnectionsTileMap
.eastConnection .eastConnection
ld a,[wMapConn4Ptr] ld a,[wMapConn4Ptr]
cp a,$ff cp $ff
jr z,.done jr z,.done
call SwitchToMapRomBank call SwitchToMapRomBank
ld a,[wEastConnectionStripSrc] ld a,[wEastConnectionStripSrc]
@ -1016,7 +1033,7 @@ LoadNorthSouthConnectionsTileMap::
inc h inc h
.noCarry1 .noCarry1
ld a,[wCurMapWidth] ld a,[wCurMapWidth]
add a,MAP_BORDER * 2 add MAP_BORDER * 2
add e add e
ld e,a ld e,a
jr nc,.noCarry2 jr nc,.noCarry2
@ -1045,7 +1062,7 @@ LoadEastWestConnectionsTileMap::
inc h inc h
.noCarry1 .noCarry1
ld a,[wCurMapWidth] ld a,[wCurMapWidth]
add a,MAP_BORDER * 2 add MAP_BORDER * 2
add e add e
ld e,a ld e,a
jr nc,.noCarry2 jr nc,.noCarry2
@ -1100,7 +1117,7 @@ IsSpriteOrSignInFrontOfPlayer::
; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC ; check if the player is front of a counter in a pokemon center, pokemart, etc. and if so, extend the range at which he can talk to the NPC
.extendRangeOverCounter .extendRangeOverCounter
predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player in c predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player in c
ld hl,wTileSetTalkingOverTiles ; list of tiles that extend talking range (counter tiles) ld hl,wTilesetTalkingOverTiles ; list of tiles that extend talking range (counter tiles)
ld b,3 ld b,3
ld d,$20 ; talking range in pixels (long range) ld d,$20 ; talking range in pixels (long range)
.counterTilesLoop .counterTilesLoop
@ -1126,6 +1143,7 @@ IsSpriteInFrontOfPlayer2::
ld b,a ld b,a
ld a,PLAYER_DIR_UP ld a,PLAYER_DIR_UP
jr .doneCheckingDirection jr .doneCheckingDirection
.checkIfPlayerFacingDown .checkIfPlayerFacingDown
cp SPRITE_FACING_DOWN cp SPRITE_FACING_DOWN
jr nz,.checkIfPlayerFacingRight jr nz,.checkIfPlayerFacingRight
@ -1135,6 +1153,7 @@ IsSpriteInFrontOfPlayer2::
ld b,a ld b,a
ld a,PLAYER_DIR_DOWN ld a,PLAYER_DIR_DOWN
jr .doneCheckingDirection jr .doneCheckingDirection
.checkIfPlayerFacingRight .checkIfPlayerFacingRight
cp SPRITE_FACING_RIGHT cp SPRITE_FACING_RIGHT
jr nz,.playerFacingLeft jr nz,.playerFacingLeft
@ -1144,6 +1163,7 @@ IsSpriteInFrontOfPlayer2::
ld c,a ld c,a
ld a,PLAYER_DIR_RIGHT ld a,PLAYER_DIR_RIGHT
jr .doneCheckingDirection jr .doneCheckingDirection
.playerFacingLeft .playerFacingLeft
; facing left ; facing left
ld a,c ld a,c
@ -1225,7 +1245,7 @@ CollisionCheckOnLand::
jr nc,.noCollision jr nc,.noCollision
.collision .collision
ld a,[wChannelSoundIDs + CH4] ld a,[wChannelSoundIDs + CH4]
cp a,SFX_COLLISION ; check if collision sound is already playing cp SFX_COLLISION ; check if collision sound is already playing
jr z,.setCarry jr z,.setCarry
ld a,SFX_COLLISION ld a,SFX_COLLISION
call PlaySound ; play collision sound (if it's not already playing) call PlaySound ; play collision sound (if it's not already playing)
@ -1242,7 +1262,7 @@ CheckTilePassable::
predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player
ld a,[wTileInFrontOfPlayer] ; tile in front of player ld a,[wTileInFrontOfPlayer] ; tile in front of player
ld c,a ld c,a
ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles ld hl,wTilesetCollisionPtr ; pointer to list of passable tiles
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ; hl now points to passable tiles ld l,a ; hl now points to passable tiles
@ -1287,7 +1307,7 @@ CheckForTilePairCollisions::
ld a,[wCurMapTileset] ; tileset number ld a,[wCurMapTileset] ; tileset number
ld b,a ld b,a
ld a,[hli] ld a,[hli]
cp a,$ff cp $ff
jr z,.noMatch jr z,.noMatch
cp b cp b
jr z,.tilesetMatches jr z,.tilesetMatches
@ -1354,7 +1374,7 @@ TilePairCollisionsWater::
LoadCurrentMapView:: LoadCurrentMapView::
ld a,[H_LOADEDROMBANK] ld a,[H_LOADEDROMBANK]
push af push af
ld a,[wTileSetBank] ; tile data ROM bank ld a,[wTilesetBank] ; tile data ROM bank
ld [H_LOADEDROMBANK],a ld [H_LOADEDROMBANK],a
ld [MBC1RomBank],a ; switch to ROM bank that contains tile data ld [MBC1RomBank],a ; switch to ROM bank that contains tile data
ld a,[wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view ld a,[wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view
@ -1387,7 +1407,7 @@ LoadCurrentMapView::
; update tile block map pointer to next row's address ; update tile block map pointer to next row's address
pop de pop de
ld a,[wCurMapWidth] ld a,[wCurMapWidth]
add a,MAP_BORDER * 2 add MAP_BORDER * 2
add e add e
ld e,a ld e,a
jr nc,.noCarry jr nc,.noCarry
@ -1722,8 +1742,8 @@ ScheduleSouthRowRedraw::
ld bc,$0200 ld bc,$0200
add hl,bc add hl,bc
ld a,h ld a,h
and a,$03 and $03
or a,$98 or $98
ld [hRedrawRowOrColumnDest + 1],a ld [hRedrawRowOrColumnDest + 1],a
ld a,l ld a,l
ld [hRedrawRowOrColumnDest],a ld [hRedrawRowOrColumnDest],a
@ -1736,11 +1756,11 @@ ScheduleEastColumnRedraw::
call ScheduleColumnRedrawHelper call ScheduleColumnRedrawHelper
ld a,[wMapViewVRAMPointer] ld a,[wMapViewVRAMPointer]
ld c,a ld c,a
and a,$e0 and $e0
ld b,a ld b,a
ld a,c ld a,c
add a,18 add 18
and a,$1f and $1f
or b or b
ld [hRedrawRowOrColumnDest],a ld [hRedrawRowOrColumnDest],a
ld a,[wMapViewVRAMPointer + 1] ld a,[wMapViewVRAMPointer + 1]
@ -1784,17 +1804,17 @@ ScheduleWestColumnRedraw::
; Input: c = tile block ID, hl = destination address ; Input: c = tile block ID, hl = destination address
DrawTileBlock:: DrawTileBlock::
push hl push hl
ld a,[wTileSetBlocksPtr] ; pointer to tiles ld a,[wTilesetBlocksPtr] ; pointer to tiles
ld l,a ld l,a
ld a,[wTileSetBlocksPtr + 1] ld a,[wTilesetBlocksPtr + 1]
ld h,a ld h,a
ld a,c ld a,c
swap a swap a
ld b,a ld b,a
and a,$f0 and $f0
ld c,a ld c,a
ld a,b ld a,b
and a,$0f and $0f
ld b,a ; bc = tile block ID * 0x10 ld b,a ; bc = tile block ID * 0x10
add hl,bc add hl,bc
ld d,h ld d,h
@ -1833,10 +1853,10 @@ JoypadOverworld::
bit 3,a ; check if a trainer wants a challenge bit 3,a ; check if a trainer wants a challenge
jr nz,.notForcedDownwards jr nz,.notForcedDownwards
ld a,[wCurMap] ld a,[wCurMap]
cp a,ROUTE_17 ; Cycling Road cp ROUTE_17 ; Cycling Road
jr nz,.notForcedDownwards jr nz,.notForcedDownwards
ld a,[hJoyHeld] ld a,[hJoyHeld]
and a,D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON and D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON
jr nz,.notForcedDownwards jr nz,.notForcedDownwards
ld a,D_DOWN ld a,D_DOWN
ld [hJoyHeld],a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press ld [hJoyHeld],a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press
@ -1868,6 +1888,7 @@ JoypadOverworld::
ld [hJoyPressed],a ld [hJoyPressed],a
ld [hJoyReleased],a ld [hJoyReleased],a
ret ret
; if done simulating button presses ; if done simulating button presses
.doneSimulating .doneSimulating
xor a xor a
@ -1878,7 +1899,7 @@ JoypadOverworld::
ld [hJoyHeld],a ld [hJoyHeld],a
ld hl,wd736 ld hl,wd736
ld a,[hl] ld a,[hl]
and a,$f8 and $f8
ld [hl],a ld [hl],a
ld hl,wd730 ld hl,wd730
res 7,[hl] res 7,[hl]
@ -1915,7 +1936,7 @@ CollisionCheckOnWater::
jr z,.noCollision ; keep surfing jr z,.noCollision ; keep surfing
; check if the [land] tile in front of the player is passable ; check if the [land] tile in front of the player is passable
.checkIfNextTileIsPassable .checkIfNextTileIsPassable
ld hl,wTileSetCollisionPtr ; pointer to list of passable tiles ld hl,wTilesetCollisionPtr ; pointer to list of passable tiles
ld a,[hli] ld a,[hli]
ld h,[hl] ld h,[hl]
ld l,a ld l,a
@ -1928,7 +1949,7 @@ CollisionCheckOnWater::
jr .loop jr .loop
.collision .collision
ld a,[wChannelSoundIDs + CH4] ld a,[wChannelSoundIDs + CH4]
cp a,SFX_COLLISION ; check if collision sound is already playing cp SFX_COLLISION ; check if collision sound is already playing
jr z,.setCarry jr z,.setCarry
ld a,SFX_COLLISION ld a,SFX_COLLISION
call PlaySound ; play collision sound (if it's not already playing) call PlaySound ; play collision sound (if it's not already playing)
@ -2386,7 +2407,7 @@ IgnoreInputForHalfSecond:
ld [wIgnoreInputCounter], a ld [wIgnoreInputCounter], a
ld hl, wd730 ld hl, wd730
ld a, [hl] ld a, [hl]
or $26 or %00100110
ld [hl], a ; set ignore input bit ld [hl], a ; set ignore input bit
ret ret

View file

@ -531,9 +531,9 @@ ReverseNybble::
ld de, NybbleReverseTable ld de, NybbleReverseTable
add e add e
ld e, a ld e, a
jr nc, .asm_283f jr nc, .noCarry
inc d inc d
.asm_283f .noCarry
ld a, [de] ld a, [de]
ret ret

View file

@ -91,79 +91,79 @@ Serial_ExchangeByte::
ld [hSerialReceivedNewData], a ld [hSerialReceivedNewData], a
ld a, [hSerialConnectionStatus] ld a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK cp USING_INTERNAL_CLOCK
jr nz, .asm_21a7 jr nz, .loop
ld a, START_TRANSFER_INTERNAL_CLOCK ld a, START_TRANSFER_INTERNAL_CLOCK
ld [rSC], a ld [rSC], a
.asm_21a7 .loop
ld a, [hSerialReceivedNewData] ld a, [hSerialReceivedNewData]
and a and a
jr nz, .asm_21f1 jr nz, .ok
ld a, [hSerialConnectionStatus] ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK cp USING_EXTERNAL_CLOCK
jr nz, .asm_21cc jr nz, .doNotIncrementUnknownCounter
call IsUnknownCounterZero call IsUnknownCounterZero
jr z, .asm_21cc jr z, .doNotIncrementUnknownCounter
call WaitLoop_15Iterations call WaitLoop_15Iterations
push hl push hl
ld hl, wUnknownSerialCounter + 1 ld hl, wUnknownSerialCounter + 1
inc [hl] inc [hl]
jr nz, .asm_21c3 jr nz, .noCarry
dec hl dec hl
inc [hl] inc [hl]
.asm_21c3 .noCarry
pop hl pop hl
call IsUnknownCounterZero call IsUnknownCounterZero
jr nz, .asm_21a7 jr nz, .loop
jp SetUnknownCounterToFFFF jp SetUnknownCounterToFFFF
.asm_21cc .doNotIncrementUnknownCounter
ld a, [rIE] ld a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
cp (1 << SERIAL) cp (1 << SERIAL)
jr nz, .asm_21a7 jr nz, .loop
ld a, [wUnknownSerialCounter2] ld a, [wUnknownSerialCounter2]
dec a dec a
ld [wUnknownSerialCounter2], a ld [wUnknownSerialCounter2], a
jr nz, .asm_21a7 jr nz, .loop
ld a, [wUnknownSerialCounter2 + 1] ld a, [wUnknownSerialCounter2 + 1]
dec a dec a
ld [wUnknownSerialCounter2 + 1], a ld [wUnknownSerialCounter2 + 1], a
jr nz, .asm_21a7 jr nz, .loop
ld a, [hSerialConnectionStatus] ld a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK cp USING_EXTERNAL_CLOCK
jr z, .asm_21f1 jr z, .ok
ld a, 255 ld a, 255
.waitLoop .waitLoop
dec a dec a
jr nz, .waitLoop jr nz, .waitLoop
.asm_21f1 .ok
xor a xor a
ld [hSerialReceivedNewData], a ld [hSerialReceivedNewData], a
ld a, [rIE] ld a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
sub (1 << SERIAL) sub (1 << SERIAL)
jr nz, .asm_2204 jr nz, .skipReloadingUnknownCounter2
ld [wUnknownSerialCounter2], a ld [wUnknownSerialCounter2], a
ld a, $50 ld a, $50
ld [wUnknownSerialCounter2 + 1], a ld [wUnknownSerialCounter2 + 1], a
.asm_2204 .skipReloadingUnknownCounter2
ld a, [hSerialReceiveData] ld a, [hSerialReceiveData]
cp SERIAL_NO_DATA_BYTE cp SERIAL_NO_DATA_BYTE
ret nz ret nz
call IsUnknownCounterZero call IsUnknownCounterZero
jr z, .asm_221f jr z, .done
push hl push hl
ld hl, wUnknownSerialCounter + 1 ld hl, wUnknownSerialCounter + 1
ld a, [hl] ld a, [hl]
dec a dec a
ld [hld], a ld [hld], a
inc a inc a
jr nz, .asm_2219 jr nz, .noBorrow
dec [hl] dec [hl]
.asm_2219 .noBorrow
pop hl pop hl
call IsUnknownCounterZero call IsUnknownCounterZero
jr z, SetUnknownCounterToFFFF jr z, SetUnknownCounterToFFFF
.asm_221f .done
ld a, [rIE] ld a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
cp (1 << SERIAL) cp (1 << SERIAL)

View file

@ -52,28 +52,28 @@ PlaceNextChar::
ld a,[de] ld a,[de]
cp "@" cp "@"
jr nz,.PlaceText jr nz, Char4ETest
ld b,h ld b,h
ld c,l ld c,l
pop hl pop hl
ret ret
.PlaceText Char4ETest::
cp $4E cp $4E ; next
jr nz,.next jr nz, .char4FTest
ld bc,SCREEN_WIDTH * 2 ld bc, 2 * SCREEN_WIDTH
ld a,[hFlags_0xFFF6] ld a,[hFlags_0xFFF6]
bit 2,a bit 2,a
jr z,.next2 jr z,.ok
ld bc,SCREEN_WIDTH ld bc,SCREEN_WIDTH
.next2 .ok
pop hl pop hl
add hl,bc add hl,bc
push hl push hl
jp PlaceNextChar_inc jp PlaceNextChar_inc
.next .char4FTest
cp $4F cp $4F ; line
jr nz,.next3 jr nz,.next3
pop hl pop hl
coord hl, 1, 16 coord hl, 1, 16
@ -81,46 +81,36 @@ PlaceNextChar::
jp PlaceNextChar_inc jp PlaceNextChar_inc
.next3 ; Check against a dictionary .next3 ; Check against a dictionary
dict: macro
if \1 == 0
and a and a
jp z,Char00 else
cp $4C cp \1
jp z,Char4C endc
cp $4B jp z, \2
jp z,Char4B endm
cp $51
jp z,Char51 dict $00, Char00 ; error
cp $49 dict $4C, Char4C ; autocont
jp z,Char49 dict $4B, Char4B ; cont_
cp $52 dict $51, Char51 ; para
jp z,Char52 dict $49, Char49 ; page
cp $53 dict $52, Char52 ; player
jp z,Char53 dict $53, Char53 ; rival
cp $54 dict $54, Char54 ; POKé
jp z,Char54 dict $5B, Char5B ; PC
cp $5B dict $5E, Char5E ; ROCKET
jp z,Char5B dict $5C, Char5C ; TM
cp $5E dict $5D, Char5D ; TRAINER
jp z,Char5E dict $55, Char55 ; cont
cp $5C dict $56, Char56 ; 6 dots
jp z,Char5C dict $57, Char57 ; done
cp $5D dict $58, Char58 ; prompt
jp z,Char5D dict $4A, Char4A ; PKMN
cp $55 dict $5F, Char5F ; dex
jp z,Char55 dict $59, Char59 ; TARGET
cp $56 dict $5A, Char5A ; USER
jp z,Char56
cp $57
jp z,Char57
cp $58
jp z,Char58
cp $4A
jp z,Char4A
cp $5F
jp z,Char5F
cp $59
jp z,Char59
cp $5A
jp z,Char5A
ld [hli],a ld [hli],a
call PrintLetterDelay call PrintLetterDelay
PlaceNextChar_inc:: PlaceNextChar_inc::
@ -211,7 +201,6 @@ MonsterNameCharsCommon::
; print “Enemy ” ; print “Enemy ”
ld de,Char5AText ld de,Char5AText
call PlaceString call PlaceString
ld h,b ld h,b
ld l,c ld l,c
ld de,wEnemyMonNick ; enemy active monster name ld de,wEnemyMonNick ; enemy active monster name
@ -264,36 +253,36 @@ Char5F::
pop hl pop hl
ret ret
Char58:: Char58:: ; prompt
ld a,[wLinkState] ld a,[wLinkState]
cp LINK_STATE_BATTLING cp LINK_STATE_BATTLING
jp z,Next1AA2 jp z, .ok
ld a,"▼" ld a, "▼"
Coorda 18, 16 Coorda 18, 16
Next1AA2:: .ok
call ProtectedDelay3 call ProtectedDelay3
call ManualTextScroll call ManualTextScroll
ld a, " " ld a, " "
Coorda 18, 16 Coorda 18, 16
Char57:: Char57:: ; done
pop hl pop hl
ld de,Char58Text ld de, Char58Text
dec de dec de
ret ret
Char58Text:: Char58Text::
db "@" db "@"
Char51:: Char51:: ; para
push de push de
ld a,"▼" ld a, "▼"
Coorda 18, 16 Coorda 18, 16
call ProtectedDelay3 call ProtectedDelay3
call ManualTextScroll call ManualTextScroll
coord hl, 1, 13 coord hl, 1, 13
lb bc, 4, 18 lb bc, 4, 18
call ClearScreenArea call ClearScreenArea
ld c,20 ld c, 20
call DelayFrames call DelayFrames
pop de pop de
coord hl, 1, 14 coord hl, 1, 14
@ -328,8 +317,8 @@ Char4B::
;fall through ;fall through
Char4C:: Char4C::
push de push de
call ScrollTextUp call ScrollTextUpOneLine
call ScrollTextUp call ScrollTextUpOneLine
coord hl, 1, 16 coord hl, 1, 16
pop de pop de
jp PlaceNextChar_inc jp PlaceNextChar_inc
@ -338,7 +327,7 @@ Char4C::
; always called twice in a row ; always called twice in a row
; first time, copy the two rows of text to the "in between" rows that are usually emtpy ; first time, copy the two rows of text to the "in between" rows that are usually emtpy
; second time, copy the bottom row of text into the top row of text ; second time, copy the bottom row of text into the top row of text
ScrollTextUp:: ScrollTextUpOneLine::
coord hl, 0, 14 ; top row of text coord hl, 0, 14 ; top row of text
coord de, 0, 13 ; empty line above text coord de, 0, 13 ; empty line above text
ld b, SCREEN_WIDTH * 3 ld b, SCREEN_WIDTH * 3
@ -376,7 +365,7 @@ TextCommandProcessor::
push af push af
set 1,a set 1,a
ld e,a ld e,a
ld a,[$fff4] ld a, [$fff4]
xor e xor e
ld [wLetterPrintingDelayFlags],a ld [wLetterPrintingDelayFlags],a
ld a,c ld a,c
@ -393,22 +382,22 @@ NextTextCommand::
ret ret
.doTextCommand .doTextCommand
push hl push hl
cp a,$17 cp a, $17
jp z,TextCommand17 jp z, TextCommand17
cp a,$0e cp a, $0e
jp nc,TextCommand0B ; if a != 0x17 and a >= 0xE, go to command 0xB jp nc,TextCommand0B ; if a != 0x17 and a >= 0xE, go to command 0xB
; if a < 0xE, use a jump table ; if a < 0xE, use a jump table
ld hl,TextCommandJumpTable ld hl,TextCommandJumpTable
push bc push bc
add a add a
ld b,$00 ld b, 0
ld c,a ld c, a
add hl,bc add hl, bc
pop bc pop bc
ld a,[hli] ld a, [hli]
ld h,[hl] ld h, [hl]
ld l,a ld l, a
jp [hl] jp hl
; draw box ; draw box
; 04AAAABBCC ; 04AAAABBCC
@ -527,10 +516,10 @@ TextCommand06::
; 07 ; 07
; (no arguments) ; (no arguments)
TextCommand07:: TextCommand07::
ld a," " ld a, " "
Coorda 18, 16 ; place blank space in lower right corner of dialogue text box Coorda 18, 16 ; place blank space in lower right corner of dialogue text box
call ScrollTextUp call ScrollTextUpOneLine
call ScrollTextUp call ScrollTextUpOneLine
pop hl pop hl
coord bc, 1, 16 ; address of second line of dialogue text box coord bc, 1, 16 ; address of second line of dialogue text box
jp NextTextCommand jp NextTextCommand
@ -541,7 +530,7 @@ TextCommand08::
pop hl pop hl
ld de,NextTextCommand ld de,NextTextCommand
push de ; return address push de ; return address
jp [hl] jp hl
; print decimal number (converted from binary number) ; print decimal number (converted from binary number)
; 09AAAABB ; 09AAAABB
@ -630,16 +619,16 @@ TextCommand0B::
; format: text command ID, sound ID or cry ID ; format: text command ID, sound ID or cry ID
TextCommandSounds:: TextCommandSounds::
db $0B,SFX_GET_ITEM_1 ; actually plays SFX_LEVEL_UP when the battle music engine is loaded db $0B, SFX_GET_ITEM_1 ; actually plays SFX_LEVEL_UP when the battle music engine is loaded
db $12,SFX_CAUGHT_MON db $12, SFX_CAUGHT_MON
db $0E,SFX_POKEDEX_RATING ; unused? db $0E, SFX_POKEDEX_RATING ; unused?
db $0F,SFX_GET_ITEM_1 ; unused? db $0F, SFX_GET_ITEM_1 ; unused?
db $10,SFX_GET_ITEM_2 db $10, SFX_GET_ITEM_2
db $11,SFX_GET_KEY_ITEM db $11, SFX_GET_KEY_ITEM
db $13,SFX_DEX_PAGE_ADDED db $13, SFX_DEX_PAGE_ADDED
db $14,NIDORINA ; used in OakSpeech db $14, NIDORINA ; used in OakSpeech
db $15,PIDGEOT ; used in SaffronCityText12 db $15, PIDGEOT ; used in SaffronCityText12
db $16,DEWGONG ; unused? db $16, DEWGONG ; unused?
; draw ellipses ; draw ellipses
; 0CAA ; 0CAA

View file

@ -27,7 +27,7 @@ VBlank::
call VBlankCopyDouble call VBlankCopyDouble
call UpdateMovingBgTiles call UpdateMovingBgTiles
call $ff80 ; hOAMDMA call $ff80 ; hOAMDMA
ld a, Bank(PrepareOAMData) ld a, BANK(PrepareOAMData)
ld [H_LOADEDROMBANK], a ld [H_LOADEDROMBANK], a
ld [MBC1RomBank], a ld [MBC1RomBank], a
call PrepareOAMData call PrepareOAMData

View file

@ -33,13 +33,13 @@ ClearBgMap::
jr nz,.loop jr nz,.loop
ret ret
RedrawRowOrColumn::
; This function redraws a BG row of height 2 or a BG column of width 2. ; This function redraws a BG row of height 2 or a BG column of width 2.
; One of its main uses is redrawing the row or column that will be exposed upon ; One of its main uses is redrawing the row or column that will be exposed upon
; scrolling the BG when the player takes a step. Redrawing only the exposed ; scrolling the BG when the player takes a step. Redrawing only the exposed
; row or column is more efficient than redrawing the entire screen. ; row or column is more efficient than redrawing the entire screen.
; However, this function is also called repeatedly to redraw the whole screen ; However, this function is also called repeatedly to redraw the whole screen
; when necessary. It is also used in trade animation and elevator code. ; when necessary. It is also used in trade animation and elevator code.
RedrawRowOrColumn::
ld a,[hRedrawRowOrColumnMode] ld a,[hRedrawRowOrColumnMode]
and a and a
ret z ret z

View file

@ -69,29 +69,62 @@ bcd3: MACRO
coins equs "bcd2" coins equs "bcd2"
money equs "bcd3" money equs "bcd3"
validateCoords: MACRO
if \1 >= SCREEN_WIDTH
fail "x coord out of range"
endc
if \2 >= SCREEN_HEIGHT
fail "y coord out of range"
endc
endm
;\1 = r ;\1 = r
;\2 = X ;\2 = X
;\3 = Y ;\3 = Y
;\4 = which tilemap (optional)
coord: MACRO coord: MACRO
ld \1, wTileMap + 20 * \3 + \2 validateCoords \2, \3
if _NARG >= 4
ld \1, \4 + SCREEN_WIDTH * \3 + \2
else
ld \1, wTileMap + SCREEN_WIDTH * \3 + \2
endc
ENDM ENDM
;\1 = X ;\1 = X
;\2 = Y ;\2 = Y
;\3 = which tilemap (optional)
aCoord: MACRO aCoord: MACRO
ld a, [wTileMap + 20 * \2 + \1] validateCoords \1, \2
if _NARG >= 3
ld a, [\3 + SCREEN_WIDTH * \2 + \1]
else
ld a, [wTileMap + SCREEN_WIDTH * \2 + \1]
endc
ENDM ENDM
;\1 = X ;\1 = X
;\2 = Y ;\2 = Y
;\3 = which tilemap (optional)
Coorda: MACRO Coorda: MACRO
ld [wTileMap + 20 * \2 + \1], a validateCoords \1, \2
if _NARG >= 3
ld [\3 + SCREEN_WIDTH * \2 + \1], a
else
ld [wTileMap + SCREEN_WIDTH * \2 + \1], a
endc
ENDM ENDM
;\1 = X ;\1 = X
;\2 = Y ;\2 = Y
;\3 = which tilemap (optional)
dwCoord: MACRO dwCoord: MACRO
dw wTileMap + 20 * \2 + \1 validateCoords \1, \2
if _NARG >= 3
dw \3 + SCREEN_WIDTH * \2 + \1
else
dw wTileMap + SCREEN_WIDTH * \2 + \1
endc
ENDM ENDM
;\1 = r ;\1 = r
@ -122,7 +155,7 @@ EMAP: MACRO ; emap x-coordinate,y-coordinate,textpointer
; nybble: y-coordinate ; nybble: y-coordinate
; nybble: x-coordinate ; nybble: x-coordinate
; word : pointer to map name ; word : pointer to map name
db (\1 + (\2 << 4)) dn \2, \1
dw \3 dw \3
ENDM ENDM
@ -134,7 +167,7 @@ IMAP: MACRO ; imap mapid_less_than,x-coordinate,y-coordinate,textpointer
; nybble: x-coordinate ; nybble: x-coordinate
; word : pointer to map name ; word : pointer to map name
db \1 + 1 db \1 + 1
db \2 + \3 << 4 dn \3, \2
dw \4 dw \4
ENDM ENDM
@ -162,6 +195,24 @@ dbw: MACRO
dw \2 dw \2
ENDM ENDM
dba: MACRO
dbw BANK(\1), \1
ENDM
dwb: MACRO
dw \1
db \2
ENDM
dab: MACRO
dwb \1, BANK(\1)
ENDM
dbbw: MACRO
db \1, \2
dw \3
ENDM
; data format macros ; data format macros
RGB: MACRO RGB: MACRO
dw (\3 << 10 | \2 << 5 | \1) dw (\3 << 10 | \2 << 5 | \1)
@ -248,6 +299,10 @@ TX_MART: MACRO
TX_POKECENTER_NURSE EQUS "db $ff" TX_POKECENTER_NURSE EQUS "db $ff"
; Predef macro. ; Predef macro.
predef_const: MACRO
const \1PredefID
ENDM
add_predef: MACRO add_predef: MACRO
\1Predef:: \1Predef::
db BANK(\1) db BANK(\1)
@ -268,11 +323,18 @@ predef_jump: MACRO
jp Predef jp Predef
ENDM ENDM
tx_pre_const: MACRO
const \1_id
ENDM
add_tx_pre: MACRO add_tx_pre: MACRO
\1_id:: dw \1 \1_id:: dw \1
ENDM ENDM
db_tx_pre: MACRO
db (\1_id - TextPredefs) / 2 + 1
ENDM
tx_pre_id: MACRO tx_pre_id: MACRO
ld a, (\1_id - TextPredefs) / 2 + 1 ld a, (\1_id - TextPredefs) / 2 + 1
ENDM ENDM
@ -684,9 +746,9 @@ ENDM
tmlearn: MACRO tmlearn: MACRO
x = 0 x = 0
rept _NARG rept _NARG
if \1 != 0 IF \1 != 0
x = x | (1 << ((\1 - 1) % 8)) x = x | (1 << ((\1 - 1) % 8))
endc ENDC
shift shift
endr endr
db x db x

View file

@ -2442,7 +2442,7 @@ GetTileTwoStepsInFrontOfPlayer:
CheckForCollisionWhenPushingBoulder: CheckForCollisionWhenPushingBoulder:
call GetTileTwoStepsInFrontOfPlayer call GetTileTwoStepsInFrontOfPlayer
ld hl, wTileSetCollisionPtr ld hl, wTilesetCollisionPtr
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
@ -2672,7 +2672,7 @@ LoadTilesetHeader:
ld e, a ld e, a
ld hl, Tilesets ld hl, Tilesets
add hl, de add hl, de
ld de, wTileSetBank ld de, wTilesetBank
ld c, $b ld c, $b
.copyTilesetHeaderLoop .copyTilesetHeaderLoop
ld a, [hli] ld a, [hli]

309
text.asm

File diff suppressed because it is too large Load diff

View file

@ -25,7 +25,7 @@ _BikeShopText_1d81f::
prompt prompt
_BikeShopText_1d824:: _BikeShopText_1d824::
text $52, " exchanged" text "<PLAYER> exchanged"
line "the BIKE VOUCHER" line "the BIKE VOUCHER"
cont "for a BICYCLE.@@" cont "for a BICYCLE.@@"

View file

@ -8,7 +8,7 @@ _TM18PreReceiveText::
prompt prompt
_ReceivedTM18Text:: _ReceivedTM18Text::
text $52, " received" text "<PLAYER> received"
line "@" line "@"
TX_RAM wcf4b TX_RAM wcf4b
text "!@@" text "!@@"

View file

@ -83,13 +83,13 @@ FanClubChairStoryText::
prompt prompt
ReceivedBikeVoucherText:: ReceivedBikeVoucherText::
text $52, " received" text "<PLAYER> received"
line "a @" line "a @"
TX_RAM wcf4b TX_RAM wcf4b
text "!@@" text "!@@"
ExplainBikeVoucherText:: ExplainBikeVoucherText::
db $0 text ""
para "Exchange that for" para "Exchange that for"
line "a BICYCLE!" line "a BICYCLE!"
@ -111,7 +111,7 @@ FanClubNoStoryText::
done done
FanClubChairFinalText:: FanClubChairFinalText::
text "Hello, ", $52, "!" text "Hello, <PLAYER>!"
para "Did you come see" para "Did you come see"
line "me about my" line "me about my"

View file

@ -1,7 +1,7 @@
_HallofFameRoomText1:: _HallofFameRoomText1::
text "OAK: Er-hem!" text "OAK: Er-hem!"
line "Congratulations" line "Congratulations"
cont $52, "!" cont "<PLAYER>!"
para "This floor is the" para "This floor is the"
line "#MON HALL OF" line "#MON HALL OF"
@ -16,13 +16,13 @@ _HallofFameRoomText1::
line "also recorded in" line "also recorded in"
cont "the HALL OF FAME!" cont "the HALL OF FAME!"
para $52, "! You have" para "<PLAYER>! You have"
line "endeavored hard" line "endeavored hard"
cont "to become the new" cont "to become the new"
cont "LEAGUE champion!" cont "LEAGUE champion!"
para "Congratulations," para "Congratulations,"
line $52, ", you and" line "<PLAYER>, you and"
cont "your #MON are" cont "your #MON are"
cont "HALL OF FAMERs!" cont "HALL OF FAMERs!"
done done

View file

@ -1,6 +1,6 @@
_LanceBeforeBattleText:: _LanceBeforeBattleText::
text "Ah! I heard about" text "Ah! I heard about"
line "you ", $52, "!" line "you <PLAYER>!"
para "I lead the ELITE" para "I lead the ELITE"
line "FOUR! You can" line "FOUR! You can"

View file

@ -81,7 +81,7 @@ _Museum1FText_5c28e::
prompt prompt
_ReceivedOldAmberText:: _ReceivedOldAmberText::
text $52, " received" text "<PLAYER> received"
line "OLD AMBER!@@" line "OLD AMBER!@@"
_Museum1FText_5c299:: _Museum1FText_5c299::

View file

@ -1,11 +1,11 @@
_OaksLabGaryText1:: _OaksLabGaryText1::
text $53,": Yo" text "<RIVAL>: Yo"
line $52,"! Gramps" line "<PLAYER>! Gramps"
cont "isn't around!" cont "isn't around!"
done done
_OaksLabText40:: _OaksLabText40::
text $53,": Heh, I" text "<RIVAL>: Heh, I"
line "don't need to be" line "don't need to be"
cont "greedy like you!" cont "greedy like you!"
@ -14,7 +14,7 @@ _OaksLabText40::
done done
_OaksLabText41:: _OaksLabText41::
text $53,": My" text "<RIVAL>: My"
line "#MON looks a" line "#MON looks a"
cont "lot stronger." cont "lot stronger."
done done
@ -60,7 +60,7 @@ _OaksLabLastMonText::
done done
_OaksLabText_1d2f0:: _OaksLabText_1d2f0::
text "OAK: Now, ", $52, "," text "OAK: Now, <PLAYER>,"
line "which #MON do" line "which #MON do"
cont "you want?" cont "you want?"
done done
@ -73,14 +73,14 @@ _OaksLabText_1d2f5::
done done
_OaksLabText_1d2fa:: _OaksLabText_1d2fa::
text "OAK: ", $52, "," text "OAK: <PLAYER>,"
line "raise your young" line "raise your young"
cont "#MON by making" cont "#MON by making"
cont "it fight!" cont "it fight!"
done done
_OaksLabDeliverParcelText1:: _OaksLabDeliverParcelText1::
text "OAK: Oh, ", $52, "!" text "OAK: Oh, <PLAYER>!"
para "How is my old" para "How is my old"
line "#MON?" line "#MON?"
@ -95,11 +95,11 @@ _OaksLabDeliverParcelText1::
para "What? You have" para "What? You have"
line "something for me?" line "something for me?"
para $52, " delivered" para "<PLAYER> delivered"
line "OAK's PARCEL.@@" line "OAK's PARCEL.@@"
_OaksLabDeliverParcelText2:: _OaksLabDeliverParcelText2::
db $0 text ""
para "Ah! This is the" para "Ah! This is the"
line "custom # BALL" line "custom # BALL"
cont "I ordered!" cont "I ordered!"
@ -109,7 +109,7 @@ _OaksLabDeliverParcelText2::
_OaksLabAroundWorldText:: _OaksLabAroundWorldText::
text "#MON around the" text "#MON around the"
line "world wait for" line "world wait for"
cont "you, ", $52, "!" cont "you, <PLAYER>!"
done done
_OaksLabGivePokeballsText1:: _OaksLabGivePokeballsText1::
@ -123,11 +123,11 @@ _OaksLabGivePokeballsText1::
cont "to capture wild" cont "to capture wild"
cont "#MON." cont "#MON."
para $52, " got 5" para "<PLAYER> got 5"
line "# BALLs!@@" line "# BALLs!@@"
_OaksLabGivePokeballsText2:: _OaksLabGivePokeballsText2::
db $0 text ""
para "When a wild" para "When a wild"
line "#MON appears," line "#MON appears,"
cont "it's fair game." cont "it's fair game."
@ -182,20 +182,20 @@ _OaksLabText_1d340::
done done
_OaksLabRivalWaitingText:: _OaksLabRivalWaitingText::
text $53, ": Gramps!" text "<RIVAL>: Gramps!"
line "I'm fed up with" line "I'm fed up with"
cont "waiting!" cont "waiting!"
done done
_OaksLabChooseMonText:: _OaksLabChooseMonText::
text "OAK: ", $53, "?" text "OAK: <RIVAL>?"
line "Let me think..." line "Let me think..."
para "Oh, that's right," para "Oh, that's right,"
line "I told you to" line "I told you to"
cont "come! Just wait!" cont "come! Just wait!"
para "Here, ", $52, "!" para "Here, <PLAYER>!"
para "There are 3" para "There are 3"
line "#MON here!" line "#MON here!"
@ -216,14 +216,14 @@ _OaksLabChooseMonText::
done done
_OaksLabRivalInterjectionText:: _OaksLabRivalInterjectionText::
text $53, ": Hey!" text "<RIVAL>: Hey!"
line "Gramps! What" line "Gramps! What"
cont "about me?" cont "about me?"
done done
_OaksLabBePatientText:: _OaksLabBePatientText::
text "OAK: Be patient!" text "OAK: Be patient!"
line $53, ", you can" line "<RIVAL>, you can"
cont "have one too!" cont "have one too!"
done done
@ -233,19 +233,19 @@ _OaksLabLeavingText::
done done
_OaksLabRivalPickingMonText:: _OaksLabRivalPickingMonText::
text $53, ": I'll take" text "<RIVAL>: I'll take"
line "this one, then!" line "this one, then!"
done done
_OaksLabRivalReceivedMonText:: _OaksLabRivalReceivedMonText::
text $53, " received" text "<RIVAL> received"
line "a @" line "a @"
TX_RAM wcd6d TX_RAM wcd6d
text "!@@" text "!@@"
_OaksLabRivalChallengeText:: _OaksLabRivalChallengeText::
text $53, ": Wait" text "<RIVAL>: Wait"
line $52, "!" line "<PLAYER>!"
cont "Let's check out" cont "Let's check out"
cont "our #MON!" cont "our #MON!"
@ -261,26 +261,26 @@ _OaksLabText_1d3be::
prompt prompt
_OaksLabText_1d3c3:: _OaksLabText_1d3c3::
text $53, ": Yeah! Am" text "<RIVAL>: Yeah! Am"
line "I great or what?" line "I great or what?"
prompt prompt
_OaksLabRivalToughenUpText:: _OaksLabRivalToughenUpText::
text $53, ": Okay!" text "<RIVAL>: Okay!"
line "I'll make my" line "I'll make my"
cont "#MON fight to" cont "#MON fight to"
cont "toughen it up!" cont "toughen it up!"
para $52, "! Gramps!" para "<PLAYER>! Gramps!"
line "Smell you later!" line "Smell you later!"
done done
_OaksLabText21:: _OaksLabText21::
text $53, ": Gramps!" text "<RIVAL>: Gramps!"
done done
_OaksLabText22:: _OaksLabText22::
text $53, ": What did" text "<RIVAL>: What did"
line "you call me for?" line "you call me for?"
done done
@ -305,11 +305,11 @@ _OaksLabText24::
done done
_OaksLabText25:: _OaksLabText25::
text "OAK: ", $52, " and" text "OAK: <PLAYER> and"
line $53, "! Take" line "<RIVAL>! Take"
cont "these with you!" cont "these with you!"
para $52, " got" para "<PLAYER> got"
line "#DEX from OAK!@@" line "#DEX from OAK!@@"
_OaksLabText26:: _OaksLabText26::
@ -336,11 +336,11 @@ _OaksLabText26::
done done
_OaksLabText27:: _OaksLabText27::
text $53, ": Alright" text "<RIVAL>: Alright"
line "Gramps! Leave it" line "Gramps! Leave it"
cont "all to me!" cont "all to me!"
para $52, ", I hate to" para "<PLAYER>, I hate to"
line "say it, but I" line "say it, but I"
cont "don't need you!" cont "don't need you!"
@ -350,7 +350,7 @@ _OaksLabText27::
para "I'll tell her not" para "I'll tell her not"
line "to lend you one," line "to lend you one,"
cont $52, "! Hahaha!" cont "<PLAYER>! Hahaha!"
done done
_OaksLabText_1d405:: _OaksLabText_1d405::

View file

@ -10,7 +10,7 @@ _MomWakeUpText::
done done
_MomHealText1:: _MomHealText1::
text "MOM: ",$52,"!" text "MOM: <PLAYER>!"
line "You should take a" line "You should take a"
cont "quick rest." cont "quick rest."
prompt prompt

View file

@ -60,7 +60,7 @@ _Route22RivalBeforeBattleText2::
cont "That's cool!" cont "That's cool!"
para "Then I'll whip you" para "Then I'll whip you"
line $52, " as a" line "<PLAYER> as a"
cont "warm up for" cont "warm up for"
cont "#MON LEAGUE!" cont "#MON LEAGUE!"
@ -88,8 +88,8 @@ _Route22RivalDefeatedText2::
prompt prompt
_Route22Text_511d0:: _Route22Text_511d0::
text $53, ": Hahaha!" text "<RIVAL>: Hahaha!"
line $52, "! That's" line "<PLAYER>! That's"
cont "your best? You're" cont "your best? You're"
cont "nowhere near as" cont "nowhere near as"
cont "good as me, pal!" cont "good as me, pal!"

View file

@ -58,7 +58,7 @@ _SilphCo11Text2::
done done
_SilphCo11Text3:: _SilphCo11Text3::
text "Ah ", $52, "!" text "Ah <PLAYER>!"
line "So we meet again!" line "So we meet again!"
para "The PRESIDENT and" para "The PRESIDENT and"

View file

@ -35,7 +35,7 @@ _SSAnneWelcomeText9::
prompt prompt
_SSAnneFlashedTicketText:: _SSAnneFlashedTicketText::
text $52, " flashed" text "<PLAYER> flashed"
line "the S.S.TICKET!" line "the S.S.TICKET!"
para "Great! Welcome to" para "Great! Welcome to"
@ -43,7 +43,7 @@ _SSAnneFlashedTicketText::
done done
_SSAnneNoTicketText:: _SSAnneNoTicketText::
text $52, " doesn't" text "<PLAYER> doesn't"
line "have the needed" line "have the needed"
cont "S.S.TICKET." cont "S.S.TICKET."
@ -71,7 +71,7 @@ _VermilionCityText5::
line "Gogogoh!@@" line "Gogogoh!@@"
_VermilionCityText14:: _VermilionCityText14::
db $0 text ""
para "A MACHOP is" para "A MACHOP is"
line "stomping the land" line "stomping the land"
cont "flat." cont "flat."

View file

@ -53,4 +53,3 @@ _OakSpeechText3::
cont "with #MON" cont "with #MON"
cont "awaits! Let's go!" cont "awaits! Let's go!"
done done

View file

@ -1778,7 +1778,7 @@ wEnemyNumAttacksLeft:: ; d06f
wEnemyConfusedCounter:: ; d070 wEnemyConfusedCounter:: ; d070
ds 1 ds 1
wEnemyToxcCounter:: ; d071 wEnemyToxicCounter:: ; d071
ds 1 ds 1
wEnemyDisabledMove:: ; d072 wEnemyDisabledMove:: ; d072
@ -2637,21 +2637,21 @@ wPlayerDirection:: ; d52a
; if the player is not moving, the last the direction in which the player moved ; if the player is not moving, the last the direction in which the player moved
ds 1 ds 1
wTileSetBank:: ; d52b wTilesetBank:: ; d52b
ds 1 ds 1
wTileSetBlocksPtr:: ; d52c wTilesetBlocksPtr:: ; d52c
; maps blocks (4x4 tiles) to tiles ; maps blocks (4x4 tiles) to tiles
ds 2 ds 2
wTileSetGFXPtr:: ; d52e wTilesetGfxPtr:: ; d52e
ds 2 ds 2
wTileSetCollisionPtr:: ; d530 wTilesetCollisionPtr:: ; d530
; list of all walkable tiles ; list of all walkable tiles
ds 2 ds 2
wTileSetTalkingOverTiles:: ; d532 wTilesetTalkingOverTiles:: ; d532
ds 3 ds 3
wGrassTile:: ; d535 wGrassTile:: ; d535