Merge pull request #263 from Rangi42/master

Syncing style with pokecrystal
This commit is contained in:
Rangi 2020-07-07 19:48:22 -04:00 committed by GitHub
commit 9571c550b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
320 changed files with 6353 additions and 6377 deletions

View file

@ -58,7 +58,7 @@ tools:
$(MAKE) -C tools/ $(MAKE) -C tools/
RGBASMFLAGS = -h -Weverything RGBASMFLAGS = -h -L -Weverything
# Create a sym/map for debug purposes if `make` run with `DEBUG=1` # Create a sym/map for debug purposes if `make` run with `DEBUG=1`
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
RGBASMFLAGS += -E RGBASMFLAGS += -E

View file

@ -20,10 +20,10 @@ Audio1_UpdateMusic::
set 7, a set 7, a
ld [wMuteAudioAndPauseMusic], a ld [wMuteAudioAndPauseMusic], a
xor a ; disable all channels' output xor a ; disable all channels' output
ld [rNR51], a ldh [rNR51], a
ld [rNR30], a ldh [rNR30], a
ld a, $80 ld a, $80
ld [rNR30], a ldh [rNR30], a
jr .nextChannel jr .nextChannel
.applyAffects .applyAffects
call Audio1_ApplyMusicAffects call Audio1_ApplyMusicAffects
@ -183,9 +183,9 @@ Audio1_sound_ret:
jr nz, .skipSfxChannel3 jr nz, .skipSfxChannel3
; restart hardware channel 3 (wave channel) output ; restart hardware channel 3 (wave channel) output
ld a, $0 ld a, $0
ld [rNR30], a ldh [rNR30], a
ld a, $80 ld a, $80
ld [rNR30], a ldh [rNR30], a
.skipSfxChannel3 .skipSfxChannel3
jr nz, .dontDisable jr nz, .dontDisable
ld a, [wDisableChannelOutputWhenSfxEnds] ld a, [wDisableChannelOutputWhenSfxEnds]
@ -219,9 +219,9 @@ Audio1_sound_ret:
.disableChannelOutput .disableChannelOutput
ld hl, Audio1_HWChannelDisableMasks ld hl, Audio1_HWChannelDisableMasks
add hl, bc add hl, bc
ld a, [rNR51] ldh a, [rNR51]
and [hl] and [hl]
ld [rNR51], a ldh [rNR51], a
.afterDisable .afterDisable
ld a, [wChannelSoundIDs + Ch5] ld a, [wChannelSoundIDs + Ch5]
cp CRY_SFX_START cp CRY_SFX_START
@ -241,7 +241,7 @@ Audio1_sound_ret:
ret c ret c
.skipRewind .skipRewind
ld a, [wSavedVolume] ld a, [wSavedVolume]
ld [rNR50], a ldh [rNR50], a
xor a xor a
ld [wSavedVolume], a ld [wSavedVolume], a
.skipCry .skipCry
@ -548,7 +548,7 @@ Audio1_volume:
cp $f0 ; is this command a volume? cp $f0 ; is this command a volume?
jr nz, Audio1_execute_music ; no jr nz, Audio1_execute_music ; no
call Audio1_GetNextMusicByte call Audio1_GetNextMusicByte
ld [rNR50], a ; store volume ldh [rNR50], a ; store volume
jp Audio1_sound_ret jp Audio1_sound_ret
Audio1_execute_music: Audio1_execute_music:
@ -638,7 +638,7 @@ Audio1_pitch_sweep:
bit BIT_EXECUTE_MUSIC, [hl] bit BIT_EXECUTE_MUSIC, [hl]
jr nz, Audio1_note ; no jr nz, Audio1_note ; no
call Audio1_GetNextMusicByte call Audio1_GetNextMusicByte
ld [rNR10], a ldh [rNR10], a
jp Audio1_sound_ret jp Audio1_sound_ret
Audio1_note: Audio1_note:
@ -770,9 +770,9 @@ Audio1_note_pitch:
ld b, 0 ld b, 0
ld hl, Audio1_HWChannelDisableMasks ld hl, Audio1_HWChannelDisableMasks
add hl, bc add hl, bc
ld a, [rNR51] ldh a, [rNR51]
and [hl] and [hl]
ld [rNR51], a ; disable hardware channel 3's output ldh [rNR51], a ; disable hardware channel 3's output
jr .done jr .done
.notChannel3 .notChannel3
ld b, REG_VOLUME_ENVELOPE ld b, REG_VOLUME_ENVELOPE
@ -844,7 +844,7 @@ Audio1_EnableChannelOutput:
ld b, 0 ld b, 0
ld hl, Audio1_HWChannelEnableMasks ld hl, Audio1_HWChannelEnableMasks
add hl, bc add hl, bc
ld a, [rNR51] ldh a, [rNR51]
or [hl] ; set this channel's bits or [hl] ; set this channel's bits
ld d, a ld d, a
ld a, c ld a, c
@ -866,7 +866,7 @@ Audio1_EnableChannelOutput:
add hl, bc add hl, bc
and [hl] and [hl]
ld d, a ld d, a
ld a, [rNR51] ldh a, [rNR51]
ld hl, Audio1_HWChannelDisableMasks ld hl, Audio1_HWChannelDisableMasks
add hl, bc add hl, bc
and [hl] ; reset this channel's output bits and [hl] ; reset this channel's output bits
@ -874,7 +874,7 @@ Audio1_EnableChannelOutput:
ld d, a ld d, a
.skip .skip
ld a, d ld a, d
ld [rNR51], a ldh [rNR51], a
ret ret
Audio1_ApplyDutyCycleAndSoundLength: Audio1_ApplyDutyCycleAndSoundLength:
@ -928,7 +928,7 @@ Audio1_ApplyWavePatternAndFrequency:
ld hl, rWave_0 ld hl, rWave_0
ld b, $f ld b, $f
ld a, $0 ; stop hardware channel 3 ld a, $0 ; stop hardware channel 3
ld [rNR30], a ldh [rNR30], a
.loop .loop
ld a, [de] ld a, [de]
inc de inc de
@ -938,7 +938,7 @@ Audio1_ApplyWavePatternAndFrequency:
and a and a
jr nz, .loop jr nz, .loop
ld a, $80 ; start hardware channel 3 ld a, $80 ; start hardware channel 3
ld [rNR30], a ldh [rNR30], a
pop de pop de
.notChannel3 .notChannel3
ld a, d ld a, d
@ -1399,17 +1399,17 @@ Audio1_PlaySound::
ld a, $ff ld a, $ff
ld [wStereoPanning], a ld [wStereoPanning], a
xor a xor a
ld [rNR50], a ldh [rNR50], a
ld a, $8 ld a, $8
ld [rNR10], a ldh [rNR10], a
ld a, 0 ld a, 0
ld [rNR51], a ldh [rNR51], a
xor a xor a
ld [rNR30], a ldh [rNR30], a
ld a, $80 ld a, $80
ld [rNR30], a ldh [rNR30], a
ld a, $77 ld a, $77
ld [rNR50], a ldh [rNR50], a
jp .playSoundCommon jp .playSoundCommon
.playSfx .playSfx
@ -1555,7 +1555,7 @@ Audio1_PlaySound::
cp Ch5 cp Ch5
jr nz, .skipSweepDisable jr nz, .skipSweepDisable
ld a, $8 ld a, $8
ld [rNR10], a ; sweep off ldh [rNR10], a ; sweep off
.skipSweepDisable .skipSweepDisable
ld a, c ld a, c
and a and a
@ -1565,22 +1565,22 @@ Audio1_PlaySound::
.stopAllAudio .stopAllAudio
ld a, $80 ld a, $80
ld [rNR52], a ; sound hardware on ldh [rNR52], a ; sound hardware on
ld [rNR30], a ; wave playback on ldh [rNR30], a ; wave playback on
xor a xor a
ld [rNR51], a ; no sound output ldh [rNR51], a ; no sound output
ld [rNR32], a ; mute channel 3 (wave channel) ldh [rNR32], a ; mute channel 3 (wave channel)
ld a, $8 ld a, $8
ld [rNR10], a ; sweep off ldh [rNR10], a ; sweep off
ld [rNR12], a ; mute channel 1 (pulse channel 1) ldh [rNR12], a ; mute channel 1 (pulse channel 1)
ld [rNR22], a ; mute channel 2 (pulse channel 2) ldh [rNR22], a ; mute channel 2 (pulse channel 2)
ld [rNR42], a ; mute channel 4 (noise channel) ldh [rNR42], a ; mute channel 4 (noise channel)
ld a, $40 ld a, $40
ld [rNR14], a ; counter mode ldh [rNR14], a ; counter mode
ld [rNR24], a ldh [rNR24], a
ld [rNR44], a ldh [rNR44], a
ld a, $77 ld a, $77
ld [rNR50], a ; full volume ldh [rNR50], a ; full volume
xor a xor a
ld [wUnusedC000], a ld [wUnusedC000], a
ld [wDisableChannelOutputWhenSfxEnds], a ld [wDisableChannelOutputWhenSfxEnds], a
@ -1699,10 +1699,10 @@ Audio1_PlaySound::
ld a, [wSavedVolume] ld a, [wSavedVolume]
and a and a
jr nz, .done jr nz, .done
ld a, [rNR50] ldh a, [rNR50]
ld [wSavedVolume], a ld [wSavedVolume], a
ld a, $77 ld a, $77
ld [rNR50], a ; full volume ldh [rNR50], a ; full volume
.done .done
ret ret

View file

@ -22,10 +22,10 @@ Audio2_UpdateMusic::
set 7, a set 7, a
ld [wMuteAudioAndPauseMusic], a ld [wMuteAudioAndPauseMusic], a
xor a ; disable all channels' output xor a ; disable all channels' output
ld [rNR51], a ldh [rNR51], a
ld [rNR30], a ldh [rNR30], a
ld a, $80 ld a, $80
ld [rNR30], a ldh [rNR30], a
jr .nextChannel jr .nextChannel
.applyAffects .applyAffects
call Audio2_ApplyMusicAffects call Audio2_ApplyMusicAffects
@ -194,9 +194,9 @@ Audio2_sound_ret:
jr nz, .skipSfxChannel3 jr nz, .skipSfxChannel3
; restart hardware channel 3 (wave channel) output ; restart hardware channel 3 (wave channel) output
ld a, $0 ld a, $0
ld [rNR30], a ldh [rNR30], a
ld a, $80 ld a, $80
ld [rNR30], a ldh [rNR30], a
.skipSfxChannel3 .skipSfxChannel3
jr nz, .dontDisable jr nz, .dontDisable
ld a, [wDisableChannelOutputWhenSfxEnds] ld a, [wDisableChannelOutputWhenSfxEnds]
@ -230,9 +230,9 @@ Audio2_sound_ret:
.disableChannelOutput .disableChannelOutput
ld hl, Audio2_HWChannelDisableMasks ld hl, Audio2_HWChannelDisableMasks
add hl, bc add hl, bc
ld a, [rNR51] ldh a, [rNR51]
and [hl] and [hl]
ld [rNR51], a ldh [rNR51], a
.afterDisable .afterDisable
ld a, [wChannelSoundIDs + Ch5] ld a, [wChannelSoundIDs + Ch5]
cp CRY_SFX_START cp CRY_SFX_START
@ -252,7 +252,7 @@ Audio2_sound_ret:
ret c ret c
.skipRewind .skipRewind
ld a, [wSavedVolume] ld a, [wSavedVolume]
ld [rNR50], a ldh [rNR50], a
xor a xor a
ld [wSavedVolume], a ld [wSavedVolume], a
.skipCry .skipCry
@ -559,7 +559,7 @@ Audio2_volume:
cp $f0 ; is this command a volume? cp $f0 ; is this command a volume?
jr nz, Audio2_execute_music ; no jr nz, Audio2_execute_music ; no
call Audio2_GetNextMusicByte call Audio2_GetNextMusicByte
ld [rNR50], a ; store volume ldh [rNR50], a ; store volume
jp Audio2_sound_ret jp Audio2_sound_ret
Audio2_execute_music: Audio2_execute_music:
@ -649,7 +649,7 @@ Audio2_pitch_sweep:
bit BIT_EXECUTE_MUSIC, [hl] bit BIT_EXECUTE_MUSIC, [hl]
jr nz, Audio2_note ; no jr nz, Audio2_note ; no
call Audio2_GetNextMusicByte call Audio2_GetNextMusicByte
ld [rNR10], a ldh [rNR10], a
jp Audio2_sound_ret jp Audio2_sound_ret
Audio2_note: Audio2_note:
@ -781,9 +781,9 @@ Audio2_note_pitch:
ld b, 0 ld b, 0
ld hl, Audio2_HWChannelDisableMasks ld hl, Audio2_HWChannelDisableMasks
add hl, bc add hl, bc
ld a, [rNR51] ldh a, [rNR51]
and [hl] and [hl]
ld [rNR51], a ; disable hardware channel 3's output ldh [rNR51], a ; disable hardware channel 3's output
jr .done jr .done
.notChannel3 .notChannel3
ld b, REG_VOLUME_ENVELOPE ld b, REG_VOLUME_ENVELOPE
@ -855,7 +855,7 @@ Audio2_EnableChannelOutput:
ld b, 0 ld b, 0
ld hl, Audio2_HWChannelEnableMasks ld hl, Audio2_HWChannelEnableMasks
add hl, bc add hl, bc
ld a, [rNR51] ldh a, [rNR51]
or [hl] ; set this channel's bits or [hl] ; set this channel's bits
ld d, a ld d, a
ld a, c ld a, c
@ -877,7 +877,7 @@ Audio2_EnableChannelOutput:
add hl, bc add hl, bc
and [hl] and [hl]
ld d, a ld d, a
ld a, [rNR51] ldh a, [rNR51]
ld hl, Audio2_HWChannelDisableMasks ld hl, Audio2_HWChannelDisableMasks
add hl, bc add hl, bc
and [hl] ; reset this channel's output bits and [hl] ; reset this channel's output bits
@ -885,7 +885,7 @@ Audio2_EnableChannelOutput:
ld d, a ld d, a
.skip .skip
ld a, d ld a, d
ld [rNR51], a ldh [rNR51], a
ret ret
Audio2_ApplyDutyCycleAndSoundLength: Audio2_ApplyDutyCycleAndSoundLength:
@ -939,7 +939,7 @@ Audio2_ApplyWavePatternAndFrequency:
ld hl, rWave_0 ld hl, rWave_0
ld b, $f ld b, $f
ld a, $0 ; stop hardware channel 3 ld a, $0 ; stop hardware channel 3
ld [rNR30], a ldh [rNR30], a
.loop .loop
ld a, [de] ld a, [de]
inc de inc de
@ -949,7 +949,7 @@ Audio2_ApplyWavePatternAndFrequency:
and a and a
jr nz, .loop jr nz, .loop
ld a, $80 ; start hardware channel 3 ld a, $80 ; start hardware channel 3
ld [rNR30], a ldh [rNR30], a
pop de pop de
.notChannel3 .notChannel3
ld a, d ld a, d
@ -1462,17 +1462,17 @@ Audio2_PlaySound::
ld a, $ff ld a, $ff
ld [wStereoPanning], a ld [wStereoPanning], a
xor a xor a
ld [rNR50], a ldh [rNR50], a
ld a, $8 ld a, $8
ld [rNR10], a ldh [rNR10], a
ld a, 0 ld a, 0
ld [rNR51], a ldh [rNR51], a
xor a xor a
ld [rNR30], a ldh [rNR30], a
ld a, $80 ld a, $80
ld [rNR30], a ldh [rNR30], a
ld a, $77 ld a, $77
ld [rNR50], a ldh [rNR50], a
jp .playSoundCommon jp .playSoundCommon
.playSfx .playSfx
@ -1618,7 +1618,7 @@ Audio2_PlaySound::
cp Ch5 cp Ch5
jr nz, .skipSweepDisable jr nz, .skipSweepDisable
ld a, $8 ld a, $8
ld [rNR10], a ; sweep off ldh [rNR10], a ; sweep off
.skipSweepDisable .skipSweepDisable
ld a, c ld a, c
and a and a
@ -1628,22 +1628,22 @@ Audio2_PlaySound::
.stopAllAudio .stopAllAudio
ld a, $80 ld a, $80
ld [rNR52], a ; sound hardware on ldh [rNR52], a ; sound hardware on
ld [rNR30], a ; wave playback on ldh [rNR30], a ; wave playback on
xor a xor a
ld [rNR51], a ; no sound output ldh [rNR51], a ; no sound output
ld [rNR32], a ; mute channel 3 (wave channel) ldh [rNR32], a ; mute channel 3 (wave channel)
ld a, $8 ld a, $8
ld [rNR10], a ; sweep off ldh [rNR10], a ; sweep off
ld [rNR12], a ; mute channel 1 (pulse channel 1) ldh [rNR12], a ; mute channel 1 (pulse channel 1)
ld [rNR22], a ; mute channel 2 (pulse channel 2) ldh [rNR22], a ; mute channel 2 (pulse channel 2)
ld [rNR42], a ; mute channel 4 (noise channel) ldh [rNR42], a ; mute channel 4 (noise channel)
ld a, $40 ld a, $40
ld [rNR14], a ; counter mode ldh [rNR14], a ; counter mode
ld [rNR24], a ldh [rNR24], a
ld [rNR44], a ldh [rNR44], a
ld a, $77 ld a, $77
ld [rNR50], a ; full volume ldh [rNR50], a ; full volume
xor a xor a
ld [wUnusedC000], a ld [wUnusedC000], a
ld [wDisableChannelOutputWhenSfxEnds], a ld [wDisableChannelOutputWhenSfxEnds], a
@ -1762,10 +1762,10 @@ Audio2_PlaySound::
ld a, [wSavedVolume] ld a, [wSavedVolume]
and a and a
jr nz, .done jr nz, .done
ld a, [rNR50] ldh a, [rNR50]
ld [wSavedVolume], a ld [wSavedVolume], a
ld a, $77 ld a, $77
ld [rNR50], a ; full volume ldh [rNR50], a ; full volume
.done .done
ret ret

View file

@ -20,10 +20,10 @@ Audio3_UpdateMusic::
set 7, a set 7, a
ld [wMuteAudioAndPauseMusic], a ld [wMuteAudioAndPauseMusic], a
xor a ; disable all channels' output xor a ; disable all channels' output
ld [rNR51], a ldh [rNR51], a
ld [rNR30], a ldh [rNR30], a
ld a, $80 ld a, $80
ld [rNR30], a ldh [rNR30], a
jr .nextChannel jr .nextChannel
.applyAffects .applyAffects
call Audio3_ApplyMusicAffects call Audio3_ApplyMusicAffects
@ -183,9 +183,9 @@ Audio3_sound_ret:
jr nz, .skipSfxChannel3 jr nz, .skipSfxChannel3
; restart hardware channel 3 (wave channel) output ; restart hardware channel 3 (wave channel) output
ld a, $0 ld a, $0
ld [rNR30], a ldh [rNR30], a
ld a, $80 ld a, $80
ld [rNR30], a ldh [rNR30], a
.skipSfxChannel3 .skipSfxChannel3
jr nz, .dontDisable jr nz, .dontDisable
ld a, [wDisableChannelOutputWhenSfxEnds] ld a, [wDisableChannelOutputWhenSfxEnds]
@ -219,9 +219,9 @@ Audio3_sound_ret:
.disableChannelOutput .disableChannelOutput
ld hl, Audio3_HWChannelDisableMasks ld hl, Audio3_HWChannelDisableMasks
add hl, bc add hl, bc
ld a, [rNR51] ldh a, [rNR51]
and [hl] and [hl]
ld [rNR51], a ldh [rNR51], a
.afterDisable .afterDisable
ld a, [wChannelSoundIDs + Ch5] ld a, [wChannelSoundIDs + Ch5]
cp CRY_SFX_START cp CRY_SFX_START
@ -241,7 +241,7 @@ Audio3_sound_ret:
ret c ret c
.skipRewind .skipRewind
ld a, [wSavedVolume] ld a, [wSavedVolume]
ld [rNR50], a ldh [rNR50], a
xor a xor a
ld [wSavedVolume], a ld [wSavedVolume], a
.skipCry .skipCry
@ -548,7 +548,7 @@ Audio3_volume:
cp $f0 ; is this command a volume? cp $f0 ; is this command a volume?
jr nz, Audio3_execute_music ; no jr nz, Audio3_execute_music ; no
call Audio3_GetNextMusicByte call Audio3_GetNextMusicByte
ld [rNR50], a ; store volume ldh [rNR50], a ; store volume
jp Audio3_sound_ret jp Audio3_sound_ret
Audio3_execute_music: Audio3_execute_music:
@ -638,7 +638,7 @@ Audio3_pitch_sweep:
bit BIT_EXECUTE_MUSIC, [hl] bit BIT_EXECUTE_MUSIC, [hl]
jr nz, Audio3_note ; no jr nz, Audio3_note ; no
call Audio3_GetNextMusicByte call Audio3_GetNextMusicByte
ld [rNR10], a ldh [rNR10], a
jp Audio3_sound_ret jp Audio3_sound_ret
Audio3_note: Audio3_note:
@ -770,9 +770,9 @@ Audio3_note_pitch:
ld b, 0 ld b, 0
ld hl, Audio3_HWChannelDisableMasks ld hl, Audio3_HWChannelDisableMasks
add hl, bc add hl, bc
ld a, [rNR51] ldh a, [rNR51]
and [hl] and [hl]
ld [rNR51], a ; disable hardware channel 3's output ldh [rNR51], a ; disable hardware channel 3's output
jr .done jr .done
.notChannel3 .notChannel3
ld b, REG_VOLUME_ENVELOPE ld b, REG_VOLUME_ENVELOPE
@ -844,7 +844,7 @@ Audio3_EnableChannelOutput:
ld b, 0 ld b, 0
ld hl, Audio3_HWChannelEnableMasks ld hl, Audio3_HWChannelEnableMasks
add hl, bc add hl, bc
ld a, [rNR51] ldh a, [rNR51]
or [hl] ; set this channel's bits or [hl] ; set this channel's bits
ld d, a ld d, a
ld a, c ld a, c
@ -866,7 +866,7 @@ Audio3_EnableChannelOutput:
add hl, bc add hl, bc
and [hl] and [hl]
ld d, a ld d, a
ld a, [rNR51] ldh a, [rNR51]
ld hl, Audio3_HWChannelDisableMasks ld hl, Audio3_HWChannelDisableMasks
add hl, bc add hl, bc
and [hl] ; reset this channel's output bits and [hl] ; reset this channel's output bits
@ -874,7 +874,7 @@ Audio3_EnableChannelOutput:
ld d, a ld d, a
.skip .skip
ld a, d ld a, d
ld [rNR51], a ldh [rNR51], a
ret ret
Audio3_ApplyDutyCycleAndSoundLength: Audio3_ApplyDutyCycleAndSoundLength:
@ -928,7 +928,7 @@ Audio3_ApplyWavePatternAndFrequency:
ld hl, rWave_0 ld hl, rWave_0
ld b, $f ld b, $f
ld a, $0 ; stop hardware channel 3 ld a, $0 ; stop hardware channel 3
ld [rNR30], a ldh [rNR30], a
.loop .loop
ld a, [de] ld a, [de]
inc de inc de
@ -938,7 +938,7 @@ Audio3_ApplyWavePatternAndFrequency:
and a and a
jr nz, .loop jr nz, .loop
ld a, $80 ; start hardware channel 3 ld a, $80 ; start hardware channel 3
ld [rNR30], a ldh [rNR30], a
pop de pop de
.notChannel3 .notChannel3
ld a, d ld a, d
@ -1399,17 +1399,17 @@ Audio3_PlaySound::
ld a, $ff ld a, $ff
ld [wStereoPanning], a ld [wStereoPanning], a
xor a xor a
ld [rNR50], a ldh [rNR50], a
ld a, $8 ld a, $8
ld [rNR10], a ldh [rNR10], a
ld a, 0 ld a, 0
ld [rNR51], a ldh [rNR51], a
xor a xor a
ld [rNR30], a ldh [rNR30], a
ld a, $80 ld a, $80
ld [rNR30], a ldh [rNR30], a
ld a, $77 ld a, $77
ld [rNR50], a ldh [rNR50], a
jp .playSoundCommon jp .playSoundCommon
.playSfx .playSfx
@ -1555,7 +1555,7 @@ Audio3_PlaySound::
cp Ch5 cp Ch5
jr nz, .skipSweepDisable jr nz, .skipSweepDisable
ld a, $8 ld a, $8
ld [rNR10], a ; sweep off ldh [rNR10], a ; sweep off
.skipSweepDisable .skipSweepDisable
ld a, c ld a, c
and a and a
@ -1565,22 +1565,22 @@ Audio3_PlaySound::
.stopAllAudio .stopAllAudio
ld a, $80 ld a, $80
ld [rNR52], a ; sound hardware on ldh [rNR52], a ; sound hardware on
ld [rNR30], a ; wave playback on ldh [rNR30], a ; wave playback on
xor a xor a
ld [rNR51], a ; no sound output ldh [rNR51], a ; no sound output
ld [rNR32], a ; mute channel 3 (wave channel) ldh [rNR32], a ; mute channel 3 (wave channel)
ld a, $8 ld a, $8
ld [rNR10], a ; sweep off ldh [rNR10], a ; sweep off
ld [rNR12], a ; mute channel 1 (pulse channel 1) ldh [rNR12], a ; mute channel 1 (pulse channel 1)
ld [rNR22], a ; mute channel 2 (pulse channel 2) ldh [rNR22], a ; mute channel 2 (pulse channel 2)
ld [rNR42], a ; mute channel 4 (noise channel) ldh [rNR42], a ; mute channel 4 (noise channel)
ld a, $40 ld a, $40
ld [rNR14], a ; counter mode ldh [rNR14], a ; counter mode
ld [rNR24], a ldh [rNR24], a
ld [rNR44], a ldh [rNR44], a
ld a, $77 ld a, $77
ld [rNR50], a ; full volume ldh [rNR50], a ; full volume
xor a xor a
ld [wUnusedC000], a ld [wUnusedC000], a
ld [wDisableChannelOutputWhenSfxEnds], a ld [wDisableChannelOutputWhenSfxEnds], a
@ -1699,10 +1699,10 @@ Audio3_PlaySound::
ld a, [wSavedVolume] ld a, [wSavedVolume]
and a and a
jr nz, .done jr nz, .done
ld a, [rNR50] ldh a, [rNR50]
ld [wSavedVolume], a ld [wSavedVolume], a
ld a, $77 ld a, $77
ld [rNR50], a ; full volume ldh [rNR50], a ; full volume
.done .done
ret ret

View file

@ -1,5 +1,5 @@
PlayPokedexRatingSfx:: PlayPokedexRatingSfx::
ld a, [hDexRatingNumMonsOwned] ldh a, [hDexRatingNumMonsOwned]
ld c, $0 ld c, $0
ld hl, OwnedMonValues ld hl, OwnedMonValues
.getSfxPointer .getSfxPointer

View file

@ -2,9 +2,6 @@ INCLUDE "charmap.asm"
INCLUDE "macros.asm" INCLUDE "macros.asm"
INCLUDE "hram.asm"
INCLUDE "vram.asm"
INCLUDE "constants/hardware_constants.asm" INCLUDE "constants/hardware_constants.asm"
INCLUDE "constants/oam_constants.asm" INCLUDE "constants/oam_constants.asm"
INCLUDE "constants/misc_constants.asm" INCLUDE "constants/misc_constants.asm"

View file

@ -25,10 +25,10 @@
const Ch8 ; 7 const Ch8 ; 7
; HW sound channel register base addresses ; HW sound channel register base addresses
HW_CH1_BASE EQU (rNR10 % $100) HW_CH1_BASE EQU LOW(rNR10)
HW_CH2_BASE EQU ((rNR21 % $100) - 1) HW_CH2_BASE EQU LOW(rNR21) - 1
HW_CH3_BASE EQU (rNR30 % $100) HW_CH3_BASE EQU LOW(rNR30)
HW_CH4_BASE EQU ((rNR41 % $100) - 1) HW_CH4_BASE EQU LOW(rNR41) - 1
; HW sound channel enable bit masks ; HW sound channel enable bit masks
HW_CH1_ENABLE_MASK EQU %00010001 HW_CH1_ENABLE_MASK EQU %00010001

View file

@ -21,6 +21,13 @@ MAX_NEUTRAL_DAMAGE EQU 999
SONICBOOM_DAMAGE EQU 20 SONICBOOM_DAMAGE EQU 20
DRAGON_RAGE_DAMAGE EQU 40 DRAGON_RAGE_DAMAGE EQU 40
; type effectiveness factors, scaled by 10
SUPER_EFFECTIVE EQU 20
MORE_EFFECTIVE EQU 15
EFFECTIVE EQU 10
NOT_VERY_EFFECTIVE EQU 05
NO_EFFECT EQU 00
; non-volatile statuses ; non-volatile statuses
SLP EQU %111 ; sleep counter SLP EQU %111 ; sleep counter
PSN EQU 3 PSN EQU 3
@ -28,6 +35,8 @@ BRN EQU 4
FRZ EQU 5 FRZ EQU 5
PAR EQU 6 PAR EQU 6
MAX_STAT_VALUE EQU 999
; volatile statuses 1 ; volatile statuses 1
STORING_ENERGY EQU 0 ; Bide STORING_ENERGY EQU 0 ; Bide
THRASHING_ABOUT EQU 1 ; e.g. Thrash THRASHING_ABOUT EQU 1 ; e.g. Thrash

View file

@ -20,3 +20,12 @@ SPRITEBUFFERSIZE EQU 7 * 7 * LEN_1BPP_TILE
HP_BAR_GREEN EQU 0 HP_BAR_GREEN EQU 0
HP_BAR_YELLOW EQU 1 HP_BAR_YELLOW EQU 1
HP_BAR_RED EQU 2 HP_BAR_RED EQU 2
; hAutoBGTransferEnabled
TRANSFERTOP EQU 0
TRANSFERMIDDLE EQU 1
TRANSFERBOTTOM EQU 2
; hRedrawRowOrColumnMode
REDRAW_COL EQU 1
REDRAW_ROW EQU 2

View file

@ -1,3 +1,43 @@
; spritestatedata1 struct members (see macros/wram.asm)
const_def
const SPRITESTATEDATA1_PICTUREID ; 0
const SPRITESTATEDATA1_MOVEMENTSTATUS ; 1
const SPRITESTATEDATA1_IMAGEINDEX ; 2
const SPRITESTATEDATA1_YSTEPVECTOR ; 3
const SPRITESTATEDATA1_YPIXELS ; 4
const SPRITESTATEDATA1_XSTEPVECTOR ; 5
const SPRITESTATEDATA1_XPIXELS ; 6
const SPRITESTATEDATA1_INTRAANIMFRAMECOUNTER ; 7
const SPRITESTATEDATA1_ANIMFRAMECOUNTER ; 8
const SPRITESTATEDATA1_FACINGDIRECTION ; 9
const SPRITESTATEDATA1_YADJUSTED ; a
const SPRITESTATEDATA1_XADJUSTED ; b
const SPRITESTATEDATA1_COLLISIONDATA ; c
const SPRITESTATEDATA1_0D ; d
const SPRITESTATEDATA1_0E ; e
const SPRITESTATEDATA1_0F ; f
SPRITESTATEDATA1_LENGTH EQU const_value
; spritestatedata2 struct members (see macros/wram.asm)
const_def
const SPRITESTATEDATA2_WALKANIMATIONCOUNTER ; 0
const SPRITESTATEDATA2_01 ; 1
const SPRITESTATEDATA2_YDISPLACEMENT ; 2
const SPRITESTATEDATA2_XDISPLACEMENT ; 3
const SPRITESTATEDATA2_MAPY ; 4
const SPRITESTATEDATA2_MAPX ; 5
const SPRITESTATEDATA2_MOVEMENTBYTE1 ; 6
const SPRITESTATEDATA2_GRASSPRIORITY ; 7
const SPRITESTATEDATA2_MOVEMENTDELAY ; 8
const SPRITESTATEDATA2_ORIGFACINGDIRECTION ; 9
const SPRITESTATEDATA2_0A ; a
const SPRITESTATEDATA2_0B ; b
const SPRITESTATEDATA2_0C ; c
const SPRITESTATEDATA2_PICTUREID ; d
const SPRITESTATEDATA2_IMAGEBASEOFFSET ; e
const SPRITESTATEDATA2_0F ; f
SPRITESTATEDATA2_LENGTH EQU const_value
; different kinds of people events ; different kinds of people events
ITEM EQU $80 ITEM EQU $80
TRAINER EQU $40 TRAINER EQU $40

View file

@ -1,23 +1,23 @@
const_def const_def
PHYSICAL EQU const_value PHYSICAL EQU const_value
const NORMAL ; $00 const NORMAL ; $00
const FIGHTING ; $01 const FIGHTING ; $01
const FLYING ; $02 const FLYING ; $02
const POISON ; $03 const POISON ; $03
const GROUND ; $04 const GROUND ; $04
const ROCK ; $05 const ROCK ; $05
const BIRD ; $06 const BIRD ; $06
const BUG ; $07 const BUG ; $07
const GHOST ; $08 const GHOST ; $08
const_value = $14 const_value = $14
SPECIAL EQU const_value SPECIAL EQU const_value
const FIRE ; $14 const FIRE ; $14
const WATER ; $15 const WATER ; $15
const GRASS ; $16 const GRASS ; $16
const ELECTRIC ; $17 const ELECTRIC ; $17
const PSYCHIC ; $18 const PSYCHIC_TYPE ; $18
const ICE ; $19 const ICE ; $19
const DRAGON ; $1A const DRAGON ; $1A

View file

@ -1,140 +1,37 @@
mon_icon_header: MACRO
dw \1 tile \2
db \3
db BANK(\1)
dw vSprites tile \4
ENDM
MonPartySpritePointers: MonPartySpritePointers:
dw SlowbroSprite + $c0 ; gfx pointer, gfx tile offset, # tiles, vSprites tile offset
db $40 / $10 ; 40 bytes mon_icon_header SlowbroSprite, 12, 4, $00
db BANK(SlowbroSprite) mon_icon_header BallSprite, 0, 8, $04
dw vSprites mon_icon_header ClefairySprite, 12, 4, $0c
mon_icon_header BirdSprite, 12, 4, $10
dw BallSprite mon_icon_header SeelSprite, 0, 4, $14
db $80 / $10 ; $80 bytes mon_icon_header BugIconFrame2, 0, 1, $18
db BANK(BallSprite) mon_icon_header BugIconFrame2, 1, 1, $1a
dw vSprites + $40 mon_icon_header PlantIconFrame2, 0, 1, $1c
mon_icon_header PlantIconFrame2, 1, 1, $1e
dw ClefairySprite + $c0 mon_icon_header SnakeIconFrame1, 0, 1, $20
db $40 / $10 ; $40 bytes mon_icon_header SnakeIconFrame1, 1, 1, $22
db BANK(ClefairySprite) mon_icon_header QuadrupedIconFrame1, 0, 1, $24
dw vSprites + $c0 mon_icon_header QuadrupedIconFrame1, 1, 1, $26
mon_icon_header TradeBubbleIconGFX, 0, 4, $38
dw BirdSprite + $c0 mon_icon_header SlowbroSprite, 0, 4, $40
db $40 / $10 ; $40 bytes mon_icon_header BallSprite, 0, 8, $44
db BANK(BirdSprite) mon_icon_header ClefairySprite, 0, 4, $4c
dw vSprites + $100 mon_icon_header BirdSprite, 0, 4, $50
mon_icon_header SeelSprite, 12, 4, $54
dw SeelSprite mon_icon_header BugIconFrame1, 0, 1, $58
db $40 / $10 ; $40 bytes mon_icon_header BugIconFrame1, 1, 1, $5a
db BANK(SeelSprite) mon_icon_header PlantIconFrame1, 0, 1, $5c
dw vSprites + $140 mon_icon_header PlantIconFrame1, 1, 1, $5e
mon_icon_header SnakeIconFrame2, 0, 1, $60
dw BugIconFrame2 mon_icon_header SnakeIconFrame2, 1, 1, $62
db $10 / $10 ; $10 bytes mon_icon_header QuadrupedIconFrame2, 0, 1, $64
db BANK(BugIconFrame2) mon_icon_header QuadrupedIconFrame2, 1, 1, $66
dw vSprites + $180 mon_icon_header TradeBubbleIconGFX, 4, 4, $78
dw BugIconFrame2 + $10
db $10 / $10 ; $10 bytes
db BANK(BugIconFrame2)
dw vSprites + $1a0
dw PlantIconFrame2
db $10 / $10 ; $10 bytes
db BANK(PlantIconFrame2)
dw vSprites + $1c0
dw PlantIconFrame2 + $10
db $10 / $10 ; $10 bytes
db BANK(PlantIconFrame2)
dw vSprites + $1e0
dw SnakeIconFrame1
db $10 / $10 ; $10 bytes
db BANK(SnakeIconFrame1)
dw vSprites + $200
dw SnakeIconFrame1 + $10
db $10 / $10 ; $10 bytes
db BANK(SnakeIconFrame1)
dw vSprites + $220
dw QuadrupedIconFrame1
db $10 / $10 ; $10 bytes
db BANK(QuadrupedIconFrame1)
dw vSprites + $240
dw QuadrupedIconFrame1 + $10
db $10 / $10 ; $10 bytes
db BANK(QuadrupedIconFrame1)
dw vSprites + $260
dw TradeBubbleIconGFX
db $40 / $10 ; $40 bytes
db BANK(TradeBubbleIconGFX)
dw vSprites + $380
dw SlowbroSprite
db $40 / $10 ; $40 bytes
db BANK(SlowbroSprite)
dw vSprites + $400
dw BallSprite
db $80 / $10 ; $80 bytes
db BANK(BallSprite)
dw vSprites + $440
dw ClefairySprite
db $40 / $10 ; $40 bytes
db BANK(ClefairySprite)
dw vSprites + $4c0
dw BirdSprite
db $40 / $10 ; $40 bytes
db BANK(BirdSprite)
dw vSprites + $500
dw SeelSprite + $C0
db $40 / $10 ; $40 bytes
db BANK(SeelSprite)
dw vSprites + $540
dw BugIconFrame1
db $10 / $10 ; $10 bytes
db BANK(BugIconFrame1)
dw vSprites + $580
dw BugIconFrame1 + $10
db $10 / $10 ; $10 bytes
db BANK(BugIconFrame1)
dw vSprites + $5a0
dw PlantIconFrame1
db $10 / $10 ; $10 bytes
db BANK(PlantIconFrame1)
dw vSprites + $5c0
dw PlantIconFrame1 + $10
db $10 / $10 ; $10 bytes
db BANK(PlantIconFrame1)
dw vSprites + $5E0
dw SnakeIconFrame2
db $10 / $10 ; $10 bytes
db BANK(SnakeIconFrame2)
dw vSprites + $600
dw SnakeIconFrame2 + $10
db $10 / $10 ; $10 bytes
db BANK(SnakeIconFrame2)
dw vSprites + $620
dw QuadrupedIconFrame2
db $10 / $10 ; $10 bytes
db BANK(QuadrupedIconFrame2)
dw vSprites + $640
dw QuadrupedIconFrame2 + $10
db $10 / $10 ; $10 bytes
db BANK(QuadrupedIconFrame2)
dw vSprites + $660
dw TradeBubbleIconGFX + $40
db $40 / $10 ; $40 bytes
db BANK(TradeBubbleIconGFX)
dw vSprites + $780

View file

@ -10,169 +10,169 @@ move: MACRO
db \6 ; pp db \6 ; pp
ENDM ENDM
move POUND, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35 move POUND, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35
MoveEnd: MoveEnd:
move KARATE_CHOP, NO_ADDITIONAL_EFFECT, 50, NORMAL, 100, 25 move KARATE_CHOP, NO_ADDITIONAL_EFFECT, 50, NORMAL, 100, 25
move DOUBLESLAP, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 10 move DOUBLESLAP, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 10
move COMET_PUNCH, TWO_TO_FIVE_ATTACKS_EFFECT, 18, NORMAL, 85, 15 move COMET_PUNCH, TWO_TO_FIVE_ATTACKS_EFFECT, 18, NORMAL, 85, 15
move MEGA_PUNCH, NO_ADDITIONAL_EFFECT, 80, NORMAL, 85, 20 move MEGA_PUNCH, NO_ADDITIONAL_EFFECT, 80, NORMAL, 85, 20
move PAY_DAY, PAY_DAY_EFFECT, 40, NORMAL, 100, 20 move PAY_DAY, PAY_DAY_EFFECT, 40, NORMAL, 100, 20
move FIRE_PUNCH, BURN_SIDE_EFFECT1, 75, FIRE, 100, 15 move FIRE_PUNCH, BURN_SIDE_EFFECT1, 75, FIRE, 100, 15
move ICE_PUNCH, FREEZE_SIDE_EFFECT, 75, ICE, 100, 15 move ICE_PUNCH, FREEZE_SIDE_EFFECT, 75, ICE, 100, 15
move THUNDERPUNCH, PARALYZE_SIDE_EFFECT1, 75, ELECTRIC, 100, 15 move THUNDERPUNCH, PARALYZE_SIDE_EFFECT1, 75, ELECTRIC, 100, 15
move SCRATCH, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35 move SCRATCH, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35
move VICEGRIP, NO_ADDITIONAL_EFFECT, 55, NORMAL, 100, 30 move VICEGRIP, NO_ADDITIONAL_EFFECT, 55, NORMAL, 100, 30
move GUILLOTINE, OHKO_EFFECT, 1, NORMAL, 30, 5 move GUILLOTINE, OHKO_EFFECT, 1, NORMAL, 30, 5
move RAZOR_WIND, CHARGE_EFFECT, 80, NORMAL, 75, 10 move RAZOR_WIND, CHARGE_EFFECT, 80, NORMAL, 75, 10
move SWORDS_DANCE, ATTACK_UP2_EFFECT, 0, NORMAL, 100, 30 move SWORDS_DANCE, ATTACK_UP2_EFFECT, 0, NORMAL, 100, 30
move CUT, NO_ADDITIONAL_EFFECT, 50, NORMAL, 95, 30 move CUT, NO_ADDITIONAL_EFFECT, 50, NORMAL, 95, 30
move GUST, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35 move GUST, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 35
move WING_ATTACK, NO_ADDITIONAL_EFFECT, 35, FLYING, 100, 35 move WING_ATTACK, NO_ADDITIONAL_EFFECT, 35, FLYING, 100, 35
move WHIRLWIND, SWITCH_AND_TELEPORT_EFFECT, 0, NORMAL, 85, 20 move WHIRLWIND, SWITCH_AND_TELEPORT_EFFECT, 0, NORMAL, 85, 20
move FLY, FLY_EFFECT, 70, FLYING, 95, 15 move FLY, FLY_EFFECT, 70, FLYING, 95, 15
move BIND, TRAPPING_EFFECT, 15, NORMAL, 75, 20 move BIND, TRAPPING_EFFECT, 15, NORMAL, 75, 20
move SLAM, NO_ADDITIONAL_EFFECT, 80, NORMAL, 75, 20 move SLAM, NO_ADDITIONAL_EFFECT, 80, NORMAL, 75, 20
move VINE_WHIP, NO_ADDITIONAL_EFFECT, 35, GRASS, 100, 10 move VINE_WHIP, NO_ADDITIONAL_EFFECT, 35, GRASS, 100, 10
move STOMP, FLINCH_SIDE_EFFECT2, 65, NORMAL, 100, 20 move STOMP, FLINCH_SIDE_EFFECT2, 65, NORMAL, 100, 20
move DOUBLE_KICK, ATTACK_TWICE_EFFECT, 30, FIGHTING, 100, 30 move DOUBLE_KICK, ATTACK_TWICE_EFFECT, 30, FIGHTING, 100, 30
move MEGA_KICK, NO_ADDITIONAL_EFFECT, 120, NORMAL, 75, 5 move MEGA_KICK, NO_ADDITIONAL_EFFECT, 120, NORMAL, 75, 5
move JUMP_KICK, JUMP_KICK_EFFECT, 70, FIGHTING, 95, 25 move JUMP_KICK, JUMP_KICK_EFFECT, 70, FIGHTING, 95, 25
move ROLLING_KICK, FLINCH_SIDE_EFFECT2, 60, FIGHTING, 85, 15 move ROLLING_KICK, FLINCH_SIDE_EFFECT2, 60, FIGHTING, 85, 15
move SAND_ATTACK, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 100, 15 move SAND_ATTACK, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 100, 15
move HEADBUTT, FLINCH_SIDE_EFFECT2, 70, NORMAL, 100, 15 move HEADBUTT, FLINCH_SIDE_EFFECT2, 70, NORMAL, 100, 15
move HORN_ATTACK, NO_ADDITIONAL_EFFECT, 65, NORMAL, 100, 25 move HORN_ATTACK, NO_ADDITIONAL_EFFECT, 65, NORMAL, 100, 25
move FURY_ATTACK, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 20 move FURY_ATTACK, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 20
move HORN_DRILL, OHKO_EFFECT, 1, NORMAL, 30, 5 move HORN_DRILL, OHKO_EFFECT, 1, NORMAL, 30, 5
move TACKLE, NO_ADDITIONAL_EFFECT, 35, NORMAL, 95, 35 move TACKLE, NO_ADDITIONAL_EFFECT, 35, NORMAL, 95, 35
move BODY_SLAM, PARALYZE_SIDE_EFFECT2, 85, NORMAL, 100, 15 move BODY_SLAM, PARALYZE_SIDE_EFFECT2, 85, NORMAL, 100, 15
move WRAP, TRAPPING_EFFECT, 15, NORMAL, 85, 20 move WRAP, TRAPPING_EFFECT, 15, NORMAL, 85, 20
move TAKE_DOWN, RECOIL_EFFECT, 90, NORMAL, 85, 20 move TAKE_DOWN, RECOIL_EFFECT, 90, NORMAL, 85, 20
move THRASH, THRASH_PETAL_DANCE_EFFECT, 90, NORMAL, 100, 20 move THRASH, THRASH_PETAL_DANCE_EFFECT, 90, NORMAL, 100, 20
move DOUBLE_EDGE, RECOIL_EFFECT, 100, NORMAL, 100, 15 move DOUBLE_EDGE, RECOIL_EFFECT, 100, NORMAL, 100, 15
move TAIL_WHIP, DEFENSE_DOWN1_EFFECT, 0, NORMAL, 100, 30 move TAIL_WHIP, DEFENSE_DOWN1_EFFECT, 0, NORMAL, 100, 30
move POISON_STING, POISON_SIDE_EFFECT1, 15, POISON, 100, 35 move POISON_STING, POISON_SIDE_EFFECT1, 15, POISON, 100, 35
move TWINEEDLE, TWINEEDLE_EFFECT, 25, BUG, 100, 20 move TWINEEDLE, TWINEEDLE_EFFECT, 25, BUG, 100, 20
move PIN_MISSILE, TWO_TO_FIVE_ATTACKS_EFFECT, 14, BUG, 85, 20 move PIN_MISSILE, TWO_TO_FIVE_ATTACKS_EFFECT, 14, BUG, 85, 20
move LEER, DEFENSE_DOWN1_EFFECT, 0, NORMAL, 100, 30 move LEER, DEFENSE_DOWN1_EFFECT, 0, NORMAL, 100, 30
move BITE, FLINCH_SIDE_EFFECT1, 60, NORMAL, 100, 25 move BITE, FLINCH_SIDE_EFFECT1, 60, NORMAL, 100, 25
move GROWL, ATTACK_DOWN1_EFFECT, 0, NORMAL, 100, 40 move GROWL, ATTACK_DOWN1_EFFECT, 0, NORMAL, 100, 40
move ROAR, SWITCH_AND_TELEPORT_EFFECT, 0, NORMAL, 100, 20 move ROAR, SWITCH_AND_TELEPORT_EFFECT, 0, NORMAL, 100, 20
move SING, SLEEP_EFFECT, 0, NORMAL, 55, 15 move SING, SLEEP_EFFECT, 0, NORMAL, 55, 15
move SUPERSONIC, CONFUSION_EFFECT, 0, NORMAL, 55, 20 move SUPERSONIC, CONFUSION_EFFECT, 0, NORMAL, 55, 20
move SONICBOOM, SPECIAL_DAMAGE_EFFECT, 1, NORMAL, 90, 20 move SONICBOOM, SPECIAL_DAMAGE_EFFECT, 1, NORMAL, 90, 20
move DISABLE, DISABLE_EFFECT, 0, NORMAL, 55, 20 move DISABLE, DISABLE_EFFECT, 0, NORMAL, 55, 20
move ACID, DEFENSE_DOWN_SIDE_EFFECT, 40, POISON, 100, 30 move ACID, DEFENSE_DOWN_SIDE_EFFECT, 40, POISON, 100, 30
move EMBER, BURN_SIDE_EFFECT1, 40, FIRE, 100, 25 move EMBER, BURN_SIDE_EFFECT1, 40, FIRE, 100, 25
move FLAMETHROWER, BURN_SIDE_EFFECT1, 95, FIRE, 100, 15 move FLAMETHROWER, BURN_SIDE_EFFECT1, 95, FIRE, 100, 15
move MIST, MIST_EFFECT, 0, ICE, 100, 30 move MIST, MIST_EFFECT, 0, ICE, 100, 30
move WATER_GUN, NO_ADDITIONAL_EFFECT, 40, WATER, 100, 25 move WATER_GUN, NO_ADDITIONAL_EFFECT, 40, WATER, 100, 25
move HYDRO_PUMP, NO_ADDITIONAL_EFFECT, 120, WATER, 80, 5 move HYDRO_PUMP, NO_ADDITIONAL_EFFECT, 120, WATER, 80, 5
move SURF, NO_ADDITIONAL_EFFECT, 95, WATER, 100, 15 move SURF, NO_ADDITIONAL_EFFECT, 95, WATER, 100, 15
move ICE_BEAM, FREEZE_SIDE_EFFECT, 95, ICE, 100, 10 move ICE_BEAM, FREEZE_SIDE_EFFECT, 95, ICE, 100, 10
move BLIZZARD, FREEZE_SIDE_EFFECT, 120, ICE, 90, 5 move BLIZZARD, FREEZE_SIDE_EFFECT, 120, ICE, 90, 5
move PSYBEAM, CONFUSION_SIDE_EFFECT, 65, PSYCHIC, 100, 20 move PSYBEAM, CONFUSION_SIDE_EFFECT, 65, PSYCHIC_TYPE, 100, 20
move BUBBLEBEAM, SPEED_DOWN_SIDE_EFFECT, 65, WATER, 100, 20 move BUBBLEBEAM, SPEED_DOWN_SIDE_EFFECT, 65, WATER, 100, 20
move AURORA_BEAM, ATTACK_DOWN_SIDE_EFFECT, 65, ICE, 100, 20 move AURORA_BEAM, ATTACK_DOWN_SIDE_EFFECT, 65, ICE, 100, 20
move HYPER_BEAM, HYPER_BEAM_EFFECT, 150, NORMAL, 90, 5 move HYPER_BEAM, HYPER_BEAM_EFFECT, 150, NORMAL, 90, 5
move PECK, NO_ADDITIONAL_EFFECT, 35, FLYING, 100, 35 move PECK, NO_ADDITIONAL_EFFECT, 35, FLYING, 100, 35
move DRILL_PECK, NO_ADDITIONAL_EFFECT, 80, FLYING, 100, 20 move DRILL_PECK, NO_ADDITIONAL_EFFECT, 80, FLYING, 100, 20
move SUBMISSION, RECOIL_EFFECT, 80, FIGHTING, 80, 25 move SUBMISSION, RECOIL_EFFECT, 80, FIGHTING, 80, 25
move LOW_KICK, FLINCH_SIDE_EFFECT2, 50, FIGHTING, 90, 20 move LOW_KICK, FLINCH_SIDE_EFFECT2, 50, FIGHTING, 90, 20
move COUNTER, NO_ADDITIONAL_EFFECT, 1, FIGHTING, 100, 20 move COUNTER, NO_ADDITIONAL_EFFECT, 1, FIGHTING, 100, 20
move SEISMIC_TOSS, SPECIAL_DAMAGE_EFFECT, 1, FIGHTING, 100, 20 move SEISMIC_TOSS, SPECIAL_DAMAGE_EFFECT, 1, FIGHTING, 100, 20
move STRENGTH, NO_ADDITIONAL_EFFECT, 80, NORMAL, 100, 15 move STRENGTH, NO_ADDITIONAL_EFFECT, 80, NORMAL, 100, 15
move ABSORB, DRAIN_HP_EFFECT, 20, GRASS, 100, 20 move ABSORB, DRAIN_HP_EFFECT, 20, GRASS, 100, 20
move MEGA_DRAIN, DRAIN_HP_EFFECT, 40, GRASS, 100, 10 move MEGA_DRAIN, DRAIN_HP_EFFECT, 40, GRASS, 100, 10
move LEECH_SEED, LEECH_SEED_EFFECT, 0, GRASS, 90, 10 move LEECH_SEED, LEECH_SEED_EFFECT, 0, GRASS, 90, 10
move GROWTH, SPECIAL_UP1_EFFECT, 0, NORMAL, 100, 40 move GROWTH, SPECIAL_UP1_EFFECT, 0, NORMAL, 100, 40
move RAZOR_LEAF, NO_ADDITIONAL_EFFECT, 55, GRASS, 95, 25 move RAZOR_LEAF, NO_ADDITIONAL_EFFECT, 55, GRASS, 95, 25
move SOLARBEAM, CHARGE_EFFECT, 120, GRASS, 100, 10 move SOLARBEAM, CHARGE_EFFECT, 120, GRASS, 100, 10
move POISONPOWDER, POISON_EFFECT, 0, POISON, 75, 35 move POISONPOWDER, POISON_EFFECT, 0, POISON, 75, 35
move STUN_SPORE, PARALYZE_EFFECT, 0, GRASS, 75, 30 move STUN_SPORE, PARALYZE_EFFECT, 0, GRASS, 75, 30
move SLEEP_POWDER, SLEEP_EFFECT, 0, GRASS, 75, 15 move SLEEP_POWDER, SLEEP_EFFECT, 0, GRASS, 75, 15
move PETAL_DANCE, THRASH_PETAL_DANCE_EFFECT, 70, GRASS, 100, 20 move PETAL_DANCE, THRASH_PETAL_DANCE_EFFECT, 70, GRASS, 100, 20
move STRING_SHOT, SPEED_DOWN1_EFFECT, 0, BUG, 95, 40 move STRING_SHOT, SPEED_DOWN1_EFFECT, 0, BUG, 95, 40
move DRAGON_RAGE, SPECIAL_DAMAGE_EFFECT, 1, DRAGON, 100, 10 move DRAGON_RAGE, SPECIAL_DAMAGE_EFFECT, 1, DRAGON, 100, 10
move FIRE_SPIN, TRAPPING_EFFECT, 15, FIRE, 70, 15 move FIRE_SPIN, TRAPPING_EFFECT, 15, FIRE, 70, 15
move THUNDERSHOCK, PARALYZE_SIDE_EFFECT1, 40, ELECTRIC, 100, 30 move THUNDERSHOCK, PARALYZE_SIDE_EFFECT1, 40, ELECTRIC, 100, 30
move THUNDERBOLT, PARALYZE_SIDE_EFFECT1, 95, ELECTRIC, 100, 15 move THUNDERBOLT, PARALYZE_SIDE_EFFECT1, 95, ELECTRIC, 100, 15
move THUNDER_WAVE, PARALYZE_EFFECT, 0, ELECTRIC, 100, 20 move THUNDER_WAVE, PARALYZE_EFFECT, 0, ELECTRIC, 100, 20
move THUNDER, PARALYZE_SIDE_EFFECT1, 120, ELECTRIC, 70, 10 move THUNDER, PARALYZE_SIDE_EFFECT1, 120, ELECTRIC, 70, 10
move ROCK_THROW, NO_ADDITIONAL_EFFECT, 50, ROCK, 65, 15 move ROCK_THROW, NO_ADDITIONAL_EFFECT, 50, ROCK, 65, 15
move EARTHQUAKE, NO_ADDITIONAL_EFFECT, 100, GROUND, 100, 10 move EARTHQUAKE, NO_ADDITIONAL_EFFECT, 100, GROUND, 100, 10
move FISSURE, OHKO_EFFECT, 1, GROUND, 30, 5 move FISSURE, OHKO_EFFECT, 1, GROUND, 30, 5
move DIG, CHARGE_EFFECT, 100, GROUND, 100, 10 move DIG, CHARGE_EFFECT, 100, GROUND, 100, 10
move TOXIC, POISON_EFFECT, 0, POISON, 85, 10 move TOXIC, POISON_EFFECT, 0, POISON, 85, 10
move CONFUSION, CONFUSION_SIDE_EFFECT, 50, PSYCHIC, 100, 25 move CONFUSION, CONFUSION_SIDE_EFFECT, 50, PSYCHIC_TYPE, 100, 25
move PSYCHIC_M, SPECIAL_DOWN_SIDE_EFFECT, 90, PSYCHIC, 100, 10 move PSYCHIC_M, SPECIAL_DOWN_SIDE_EFFECT, 90, PSYCHIC_TYPE, 100, 10
move HYPNOSIS, SLEEP_EFFECT, 0, PSYCHIC, 60, 20 move HYPNOSIS, SLEEP_EFFECT, 0, PSYCHIC_TYPE, 60, 20
move MEDITATE, ATTACK_UP1_EFFECT, 0, PSYCHIC, 100, 40 move MEDITATE, ATTACK_UP1_EFFECT, 0, PSYCHIC_TYPE, 100, 40
move AGILITY, SPEED_UP2_EFFECT, 0, PSYCHIC, 100, 30 move AGILITY, SPEED_UP2_EFFECT, 0, PSYCHIC_TYPE, 100, 30
move QUICK_ATTACK, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 30 move QUICK_ATTACK, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 30
move RAGE, RAGE_EFFECT, 20, NORMAL, 100, 20 move RAGE, RAGE_EFFECT, 20, NORMAL, 100, 20
move TELEPORT, SWITCH_AND_TELEPORT_EFFECT, 0, PSYCHIC, 100, 20 move TELEPORT, SWITCH_AND_TELEPORT_EFFECT, 0, PSYCHIC_TYPE, 100, 20
move NIGHT_SHADE, SPECIAL_DAMAGE_EFFECT, 0, GHOST, 100, 15 move NIGHT_SHADE, SPECIAL_DAMAGE_EFFECT, 0, GHOST, 100, 15
move MIMIC, MIMIC_EFFECT, 0, NORMAL, 100, 10 move MIMIC, MIMIC_EFFECT, 0, NORMAL, 100, 10
move SCREECH, DEFENSE_DOWN2_EFFECT, 0, NORMAL, 85, 40 move SCREECH, DEFENSE_DOWN2_EFFECT, 0, NORMAL, 85, 40
move DOUBLE_TEAM, EVASION_UP1_EFFECT, 0, NORMAL, 100, 15 move DOUBLE_TEAM, EVASION_UP1_EFFECT, 0, NORMAL, 100, 15
move RECOVER, HEAL_EFFECT, 0, NORMAL, 100, 20 move RECOVER, HEAL_EFFECT, 0, NORMAL, 100, 20
move HARDEN, DEFENSE_UP1_EFFECT, 0, NORMAL, 100, 30 move HARDEN, DEFENSE_UP1_EFFECT, 0, NORMAL, 100, 30
move MINIMIZE, EVASION_UP1_EFFECT, 0, NORMAL, 100, 20 move MINIMIZE, EVASION_UP1_EFFECT, 0, NORMAL, 100, 20
move SMOKESCREEN, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 100, 20 move SMOKESCREEN, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 100, 20
move CONFUSE_RAY, CONFUSION_EFFECT, 0, GHOST, 100, 10 move CONFUSE_RAY, CONFUSION_EFFECT, 0, GHOST, 100, 10
move WITHDRAW, DEFENSE_UP1_EFFECT, 0, WATER, 100, 40 move WITHDRAW, DEFENSE_UP1_EFFECT, 0, WATER, 100, 40
move DEFENSE_CURL, DEFENSE_UP1_EFFECT, 0, NORMAL, 100, 40 move DEFENSE_CURL, DEFENSE_UP1_EFFECT, 0, NORMAL, 100, 40
move BARRIER, DEFENSE_UP2_EFFECT, 0, PSYCHIC, 100, 30 move BARRIER, DEFENSE_UP2_EFFECT, 0, PSYCHIC_TYPE, 100, 30
move LIGHT_SCREEN, LIGHT_SCREEN_EFFECT, 0, PSYCHIC, 100, 30 move LIGHT_SCREEN, LIGHT_SCREEN_EFFECT, 0, PSYCHIC_TYPE, 100, 30
move HAZE, HAZE_EFFECT, 0, ICE, 100, 30 move HAZE, HAZE_EFFECT, 0, ICE, 100, 30
move REFLECT, REFLECT_EFFECT, 0, PSYCHIC, 100, 20 move REFLECT, REFLECT_EFFECT, 0, PSYCHIC_TYPE, 100, 20
move FOCUS_ENERGY, FOCUS_ENERGY_EFFECT, 0, NORMAL, 100, 30 move FOCUS_ENERGY, FOCUS_ENERGY_EFFECT, 0, NORMAL, 100, 30
move BIDE, BIDE_EFFECT, 0, NORMAL, 100, 10 move BIDE, BIDE_EFFECT, 0, NORMAL, 100, 10
move METRONOME, METRONOME_EFFECT, 0, NORMAL, 100, 10 move METRONOME, METRONOME_EFFECT, 0, NORMAL, 100, 10
move MIRROR_MOVE, MIRROR_MOVE_EFFECT, 0, FLYING, 100, 20 move MIRROR_MOVE, MIRROR_MOVE_EFFECT, 0, FLYING, 100, 20
move SELFDESTRUCT, EXPLODE_EFFECT, 130, NORMAL, 100, 5 move SELFDESTRUCT, EXPLODE_EFFECT, 130, NORMAL, 100, 5
move EGG_BOMB, NO_ADDITIONAL_EFFECT, 100, NORMAL, 75, 10 move EGG_BOMB, NO_ADDITIONAL_EFFECT, 100, NORMAL, 75, 10
move LICK, PARALYZE_SIDE_EFFECT2, 20, GHOST, 100, 30 move LICK, PARALYZE_SIDE_EFFECT2, 20, GHOST, 100, 30
move SMOG, POISON_SIDE_EFFECT2, 20, POISON, 70, 20 move SMOG, POISON_SIDE_EFFECT2, 20, POISON, 70, 20
move SLUDGE, POISON_SIDE_EFFECT2, 65, POISON, 100, 20 move SLUDGE, POISON_SIDE_EFFECT2, 65, POISON, 100, 20
move BONE_CLUB, FLINCH_SIDE_EFFECT1, 65, GROUND, 85, 20 move BONE_CLUB, FLINCH_SIDE_EFFECT1, 65, GROUND, 85, 20
move FIRE_BLAST, BURN_SIDE_EFFECT2, 120, FIRE, 85, 5 move FIRE_BLAST, BURN_SIDE_EFFECT2, 120, FIRE, 85, 5
move WATERFALL, NO_ADDITIONAL_EFFECT, 80, WATER, 100, 15 move WATERFALL, NO_ADDITIONAL_EFFECT, 80, WATER, 100, 15
move CLAMP, TRAPPING_EFFECT, 35, WATER, 75, 10 move CLAMP, TRAPPING_EFFECT, 35, WATER, 75, 10
move SWIFT, SWIFT_EFFECT, 60, NORMAL, 100, 20 move SWIFT, SWIFT_EFFECT, 60, NORMAL, 100, 20
move SKULL_BASH, CHARGE_EFFECT, 100, NORMAL, 100, 15 move SKULL_BASH, CHARGE_EFFECT, 100, NORMAL, 100, 15
move SPIKE_CANNON, TWO_TO_FIVE_ATTACKS_EFFECT, 20, NORMAL, 100, 15 move SPIKE_CANNON, TWO_TO_FIVE_ATTACKS_EFFECT, 20, NORMAL, 100, 15
move CONSTRICT, SPEED_DOWN_SIDE_EFFECT, 10, NORMAL, 100, 35 move CONSTRICT, SPEED_DOWN_SIDE_EFFECT, 10, NORMAL, 100, 35
move AMNESIA, SPECIAL_UP2_EFFECT, 0, PSYCHIC, 100, 20 move AMNESIA, SPECIAL_UP2_EFFECT, 0, PSYCHIC_TYPE, 100, 20
move KINESIS, ACCURACY_DOWN1_EFFECT, 0, PSYCHIC, 80, 15 move KINESIS, ACCURACY_DOWN1_EFFECT, 0, PSYCHIC_TYPE, 80, 15
move SOFTBOILED, HEAL_EFFECT, 0, NORMAL, 100, 10 move SOFTBOILED, HEAL_EFFECT, 0, NORMAL, 100, 10
move HI_JUMP_KICK, JUMP_KICK_EFFECT, 85, FIGHTING, 90, 20 move HI_JUMP_KICK, JUMP_KICK_EFFECT, 85, FIGHTING, 90, 20
move GLARE, PARALYZE_EFFECT, 0, NORMAL, 75, 30 move GLARE, PARALYZE_EFFECT, 0, NORMAL, 75, 30
move DREAM_EATER, DREAM_EATER_EFFECT, 100, PSYCHIC, 100, 15 move DREAM_EATER, DREAM_EATER_EFFECT, 100, PSYCHIC_TYPE, 100, 15
move POISON_GAS, POISON_EFFECT, 0, POISON, 55, 40 move POISON_GAS, POISON_EFFECT, 0, POISON, 55, 40
move BARRAGE, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 20 move BARRAGE, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 20
move LEECH_LIFE, DRAIN_HP_EFFECT, 20, BUG, 100, 15 move LEECH_LIFE, DRAIN_HP_EFFECT, 20, BUG, 100, 15
move LOVELY_KISS, SLEEP_EFFECT, 0, NORMAL, 75, 10 move LOVELY_KISS, SLEEP_EFFECT, 0, NORMAL, 75, 10
move SKY_ATTACK, CHARGE_EFFECT, 140, FLYING, 90, 5 move SKY_ATTACK, CHARGE_EFFECT, 140, FLYING, 90, 5
move TRANSFORM, TRANSFORM_EFFECT, 0, NORMAL, 100, 10 move TRANSFORM, TRANSFORM_EFFECT, 0, NORMAL, 100, 10
move BUBBLE, SPEED_DOWN_SIDE_EFFECT, 20, WATER, 100, 30 move BUBBLE, SPEED_DOWN_SIDE_EFFECT, 20, WATER, 100, 30
move DIZZY_PUNCH, NO_ADDITIONAL_EFFECT, 70, NORMAL, 100, 10 move DIZZY_PUNCH, NO_ADDITIONAL_EFFECT, 70, NORMAL, 100, 10
move SPORE, SLEEP_EFFECT, 0, GRASS, 100, 15 move SPORE, SLEEP_EFFECT, 0, GRASS, 100, 15
move FLASH, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 70, 20 move FLASH, ACCURACY_DOWN1_EFFECT, 0, NORMAL, 70, 20
move PSYWAVE, SPECIAL_DAMAGE_EFFECT, 1, PSYCHIC, 80, 15 move PSYWAVE, SPECIAL_DAMAGE_EFFECT, 1, PSYCHIC_TYPE, 80, 15
move SPLASH, SPLASH_EFFECT, 0, NORMAL, 100, 40 move SPLASH, SPLASH_EFFECT, 0, NORMAL, 100, 40
move ACID_ARMOR, DEFENSE_UP2_EFFECT, 0, POISON, 100, 40 move ACID_ARMOR, DEFENSE_UP2_EFFECT, 0, POISON, 100, 40
move CRABHAMMER, NO_ADDITIONAL_EFFECT, 90, WATER, 85, 10 move CRABHAMMER, NO_ADDITIONAL_EFFECT, 90, WATER, 85, 10
move EXPLOSION, EXPLODE_EFFECT, 170, NORMAL, 100, 5 move EXPLOSION, EXPLODE_EFFECT, 170, NORMAL, 100, 5
move FURY_SWIPES, TWO_TO_FIVE_ATTACKS_EFFECT, 18, NORMAL, 80, 15 move FURY_SWIPES, TWO_TO_FIVE_ATTACKS_EFFECT, 18, NORMAL, 80, 15
move BONEMERANG, ATTACK_TWICE_EFFECT, 50, GROUND, 90, 10 move BONEMERANG, ATTACK_TWICE_EFFECT, 50, GROUND, 90, 10
move REST, HEAL_EFFECT, 0, PSYCHIC, 100, 10 move REST, HEAL_EFFECT, 0, PSYCHIC_TYPE, 100, 10
move ROCK_SLIDE, NO_ADDITIONAL_EFFECT, 75, ROCK, 90, 10 move ROCK_SLIDE, NO_ADDITIONAL_EFFECT, 75, ROCK, 90, 10
move HYPER_FANG, FLINCH_SIDE_EFFECT1, 80, NORMAL, 90, 15 move HYPER_FANG, FLINCH_SIDE_EFFECT1, 80, NORMAL, 90, 15
move SHARPEN, ATTACK_UP1_EFFECT, 0, NORMAL, 100, 30 move SHARPEN, ATTACK_UP1_EFFECT, 0, NORMAL, 100, 30
move CONVERSION, CONVERSION_EFFECT, 0, NORMAL, 100, 30 move CONVERSION, CONVERSION_EFFECT, 0, NORMAL, 100, 30
move TRI_ATTACK, NO_ADDITIONAL_EFFECT, 80, NORMAL, 100, 10 move TRI_ATTACK, NO_ADDITIONAL_EFFECT, 80, NORMAL, 100, 10
move SUPER_FANG, SUPER_FANG_EFFECT, 1, NORMAL, 90, 10 move SUPER_FANG, SUPER_FANG_EFFECT, 1, NORMAL, 90, 10
move SLASH, NO_ADDITIONAL_EFFECT, 70, NORMAL, 100, 20 move SLASH, NO_ADDITIONAL_EFFECT, 70, NORMAL, 100, 20
move SUBSTITUTE, SUBSTITUTE_EFFECT, 0, NORMAL, 100, 10 move SUBSTITUTE, SUBSTITUTE_EFFECT, 0, NORMAL, 100, 10
move STRUGGLE, RECOIL_EFFECT, 50, NORMAL, 100, 10 move STRUGGLE, RECOIL_EFFECT, 50, NORMAL, 100, 10

View file

@ -3,7 +3,7 @@
db 25, 20, 15, 90, 105 db 25, 20, 15, 90, 105
; hp atk def spd spc ; hp atk def spd spc
db PSYCHIC, PSYCHIC ; type db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
db 200 ; catch rate db 200 ; catch rate
db 73 ; base exp db 73 ; base exp

View file

@ -3,7 +3,7 @@
db 55, 50, 45, 120, 135 db 55, 50, 45, 120, 135
; hp atk def spd spc ; hp atk def spd spc
db PSYCHIC, PSYCHIC ; type db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
db 50 ; catch rate db 50 ; catch rate
db 186 ; base exp db 186 ; base exp

View file

@ -3,7 +3,7 @@
db 60, 48, 45, 42, 90 db 60, 48, 45, 42, 90
; hp atk def spd spc ; hp atk def spd spc
db PSYCHIC, PSYCHIC ; type db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
db 190 ; catch rate db 190 ; catch rate
db 102 ; base exp db 102 ; base exp

View file

@ -3,7 +3,7 @@
db 60, 40, 80, 40, 60 db 60, 40, 80, 40, 60
; hp atk def spd spc ; hp atk def spd spc
db GRASS, PSYCHIC ; type db GRASS, PSYCHIC_TYPE ; type
db 90 ; catch rate db 90 ; catch rate
db 98 ; base exp db 98 ; base exp

View file

@ -3,7 +3,7 @@
db 95, 95, 85, 55, 125 db 95, 95, 85, 55, 125
; hp atk def spd spc ; hp atk def spd spc
db GRASS, PSYCHIC ; type db GRASS, PSYCHIC_TYPE ; type
db 45 ; catch rate db 45 ; catch rate
db 212 ; base exp db 212 ; base exp

View file

@ -3,7 +3,7 @@
db 85, 73, 70, 67, 115 db 85, 73, 70, 67, 115
; hp atk def spd spc ; hp atk def spd spc
db PSYCHIC, PSYCHIC ; type db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
db 75 ; catch rate db 75 ; catch rate
db 165 ; base exp db 165 ; base exp

View file

@ -3,7 +3,7 @@
db 65, 50, 35, 95, 95 db 65, 50, 35, 95, 95
; hp atk def spd spc ; hp atk def spd spc
db ICE, PSYCHIC ; type db ICE, PSYCHIC_TYPE ; type
db 45 ; catch rate db 45 ; catch rate
db 137 ; base exp db 137 ; base exp

View file

@ -3,7 +3,7 @@
db 40, 35, 30, 105, 120 db 40, 35, 30, 105, 120
; hp atk def spd spc ; hp atk def spd spc
db PSYCHIC, PSYCHIC ; type db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
db 100 ; catch rate db 100 ; catch rate
db 145 ; base exp db 145 ; base exp

View file

@ -3,7 +3,7 @@
db 100, 100, 100, 100, 100 db 100, 100, 100, 100, 100
; hp atk def spd spc ; hp atk def spd spc
db PSYCHIC, PSYCHIC ; type db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
db 45 ; catch rate db 45 ; catch rate
db 64 ; base exp db 64 ; base exp

View file

@ -3,7 +3,7 @@
db 106, 110, 90, 130, 154 db 106, 110, 90, 130, 154
; hp atk def spd spc ; hp atk def spd spc
db PSYCHIC, PSYCHIC ; type db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
db 3 ; catch rate db 3 ; catch rate
db 220 ; base exp db 220 ; base exp

View file

@ -3,7 +3,7 @@
db 40, 45, 65, 90, 100 db 40, 45, 65, 90, 100
; hp atk def spd spc ; hp atk def spd spc
db PSYCHIC, PSYCHIC ; type db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
db 45 ; catch rate db 45 ; catch rate
db 136 ; base exp db 136 ; base exp

View file

@ -3,7 +3,7 @@
db 95, 75, 110, 30, 80 db 95, 75, 110, 30, 80
; hp atk def spd spc ; hp atk def spd spc
db WATER, PSYCHIC ; type db WATER, PSYCHIC_TYPE ; type
db 75 ; catch rate db 75 ; catch rate
db 164 ; base exp db 164 ; base exp

View file

@ -3,7 +3,7 @@
db 90, 65, 65, 15, 40 db 90, 65, 65, 15, 40
; hp atk def spd spc ; hp atk def spd spc
db WATER, PSYCHIC ; type db WATER, PSYCHIC_TYPE ; type
db 190 ; catch rate db 190 ; catch rate
db 99 ; base exp db 99 ; base exp

View file

@ -3,7 +3,7 @@
db 60, 75, 85, 115, 100 db 60, 75, 85, 115, 100
; hp atk def spd spc ; hp atk def spd spc
db WATER, PSYCHIC ; type db WATER, PSYCHIC_TYPE ; type
db 60 ; catch rate db 60 ; catch rate
db 207 ; base exp db 207 ; base exp

View file

@ -1,9 +1,9 @@
TitleMons: TitleMons:
; mons on the title screen are randomly chosen from here ; mons on the title screen are randomly chosen from here
IF DEF(_RED) IF DEF(_RED)
db CHARMANDER db STARTER1
db SQUIRTLE db STARTER2
db BULBASAUR db STARTER3
db WEEDLE db WEEDLE
db NIDORAN_M db NIDORAN_M
db SCYTHER db SCYTHER
@ -19,9 +19,9 @@ IF DEF(_RED)
db MAGIKARP db MAGIKARP
ENDC ENDC
IF DEF(_GREEN) IF DEF(_GREEN)
db BULBASAUR db STARTER3
db CHARMANDER db STARTER1
db SQUIRTLE db STARTER2
db CATERPIE db CATERPIE
db NIDORAN_F db NIDORAN_F
db PINSIR db PINSIR
@ -37,9 +37,9 @@ IF DEF(_GREEN)
db MAGIKARP db MAGIKARP
ENDC ENDC
IF DEF(_BLUE) IF DEF(_BLUE)
db SQUIRTLE db STARTER2
db CHARMANDER db STARTER1
db BULBASAUR db STARTER3
db MANKEY db MANKEY
db HITMONLEE db HITMONLEE
db VULPIX db VULPIX

View file

@ -1,89 +1,85 @@
TypeEffects: TypeEffects:
; format: attacking type, defending type, damage multiplier ; attacker, defender, *=
; the multiplier is a (decimal) fixed-point number: db WATER, FIRE, SUPER_EFFECTIVE
; 20 is ×2.0 db FIRE, GRASS, SUPER_EFFECTIVE
; 05 is ×0.5 db FIRE, ICE, SUPER_EFFECTIVE
; 00 is ×0 db GRASS, WATER, SUPER_EFFECTIVE
db WATER,FIRE,20 db ELECTRIC, WATER, SUPER_EFFECTIVE
db FIRE,GRASS,20 db WATER, ROCK, SUPER_EFFECTIVE
db FIRE,ICE,20 db GROUND, FLYING, NO_EFFECT
db GRASS,WATER,20 db WATER, WATER, NOT_VERY_EFFECTIVE
db ELECTRIC,WATER,20 db FIRE, FIRE, NOT_VERY_EFFECTIVE
db WATER,ROCK,20 db ELECTRIC, ELECTRIC, NOT_VERY_EFFECTIVE
db GROUND,FLYING,00 db ICE, ICE, NOT_VERY_EFFECTIVE
db WATER,WATER,05 db GRASS, GRASS, NOT_VERY_EFFECTIVE
db FIRE,FIRE,05 db PSYCHIC_TYPE, PSYCHIC_TYPE, NOT_VERY_EFFECTIVE
db ELECTRIC,ELECTRIC,05 db FIRE, WATER, NOT_VERY_EFFECTIVE
db ICE,ICE,05 db GRASS, FIRE, NOT_VERY_EFFECTIVE
db GRASS,GRASS,05 db WATER, GRASS, NOT_VERY_EFFECTIVE
db PSYCHIC,PSYCHIC,05 db ELECTRIC, GRASS, NOT_VERY_EFFECTIVE
db FIRE,WATER,05 db NORMAL, ROCK, NOT_VERY_EFFECTIVE
db GRASS,FIRE,05 db NORMAL, GHOST, NO_EFFECT
db WATER,GRASS,05 db GHOST, GHOST, SUPER_EFFECTIVE
db ELECTRIC,GRASS,05 db FIRE, BUG, SUPER_EFFECTIVE
db NORMAL,ROCK,05 db FIRE, ROCK, NOT_VERY_EFFECTIVE
db NORMAL,GHOST,00 db WATER, GROUND, SUPER_EFFECTIVE
db GHOST,GHOST,20 db ELECTRIC, GROUND, NO_EFFECT
db FIRE,BUG,20 db ELECTRIC, FLYING, SUPER_EFFECTIVE
db FIRE,ROCK,05 db GRASS, GROUND, SUPER_EFFECTIVE
db WATER,GROUND,20 db GRASS, BUG, NOT_VERY_EFFECTIVE
db ELECTRIC,GROUND,00 db GRASS, POISON, NOT_VERY_EFFECTIVE
db ELECTRIC,FLYING,20 db GRASS, ROCK, SUPER_EFFECTIVE
db GRASS,GROUND,20 db GRASS, FLYING, NOT_VERY_EFFECTIVE
db GRASS,BUG,05 db ICE, WATER, NOT_VERY_EFFECTIVE
db GRASS,POISON,05 db ICE, GRASS, SUPER_EFFECTIVE
db GRASS,ROCK,20 db ICE, GROUND, SUPER_EFFECTIVE
db GRASS,FLYING,05 db ICE, FLYING, SUPER_EFFECTIVE
db ICE,WATER,05 db FIGHTING, NORMAL, SUPER_EFFECTIVE
db ICE,GRASS,20 db FIGHTING, POISON, NOT_VERY_EFFECTIVE
db ICE,GROUND,20 db FIGHTING, FLYING, NOT_VERY_EFFECTIVE
db ICE,FLYING,20 db FIGHTING, PSYCHIC_TYPE, NOT_VERY_EFFECTIVE
db FIGHTING,NORMAL,20 db FIGHTING, BUG, NOT_VERY_EFFECTIVE
db FIGHTING,POISON,05 db FIGHTING, ROCK, SUPER_EFFECTIVE
db FIGHTING,FLYING,05 db FIGHTING, ICE, SUPER_EFFECTIVE
db FIGHTING,PSYCHIC,05 db FIGHTING, GHOST, NO_EFFECT
db FIGHTING,BUG,05 db POISON, GRASS, SUPER_EFFECTIVE
db FIGHTING,ROCK,20 db POISON, POISON, NOT_VERY_EFFECTIVE
db FIGHTING,ICE,20 db POISON, GROUND, NOT_VERY_EFFECTIVE
db FIGHTING,GHOST,00 db POISON, BUG, SUPER_EFFECTIVE
db POISON,GRASS,20 db POISON, ROCK, NOT_VERY_EFFECTIVE
db POISON,POISON,05 db POISON, GHOST, NOT_VERY_EFFECTIVE
db POISON,GROUND,05 db GROUND, FIRE, SUPER_EFFECTIVE
db POISON,BUG,20 db GROUND, ELECTRIC, SUPER_EFFECTIVE
db POISON,ROCK,05 db GROUND, GRASS, NOT_VERY_EFFECTIVE
db POISON,GHOST,05 db GROUND, BUG, NOT_VERY_EFFECTIVE
db GROUND,FIRE,20 db GROUND, ROCK, SUPER_EFFECTIVE
db GROUND,ELECTRIC,20 db GROUND, POISON, SUPER_EFFECTIVE
db GROUND,GRASS,05 db FLYING, ELECTRIC, NOT_VERY_EFFECTIVE
db GROUND,BUG,05 db FLYING, FIGHTING, SUPER_EFFECTIVE
db GROUND,ROCK,20 db FLYING, BUG, SUPER_EFFECTIVE
db GROUND,POISON,20 db FLYING, GRASS, SUPER_EFFECTIVE
db FLYING,ELECTRIC,05 db FLYING, ROCK, NOT_VERY_EFFECTIVE
db FLYING,FIGHTING,20 db PSYCHIC_TYPE, FIGHTING, SUPER_EFFECTIVE
db FLYING,BUG,20 db PSYCHIC_TYPE, POISON, SUPER_EFFECTIVE
db FLYING,GRASS,20 db BUG, FIRE, NOT_VERY_EFFECTIVE
db FLYING,ROCK,05 db BUG, GRASS, SUPER_EFFECTIVE
db PSYCHIC,FIGHTING,20 db BUG, FIGHTING, NOT_VERY_EFFECTIVE
db PSYCHIC,POISON,20 db BUG, FLYING, NOT_VERY_EFFECTIVE
db BUG,FIRE,05 db BUG, PSYCHIC_TYPE, SUPER_EFFECTIVE
db BUG,GRASS,20 db BUG, GHOST, NOT_VERY_EFFECTIVE
db BUG,FIGHTING,05 db BUG, POISON, SUPER_EFFECTIVE
db BUG,FLYING,05 db ROCK, FIRE, SUPER_EFFECTIVE
db BUG,PSYCHIC,20 db ROCK, FIGHTING, NOT_VERY_EFFECTIVE
db BUG,GHOST,05 db ROCK, GROUND, NOT_VERY_EFFECTIVE
db BUG,POISON,20 db ROCK, FLYING, SUPER_EFFECTIVE
db ROCK,FIRE,20 db ROCK, BUG, SUPER_EFFECTIVE
db ROCK,FIGHTING,05 db ROCK, ICE, SUPER_EFFECTIVE
db ROCK,GROUND,05 db GHOST, NORMAL, NO_EFFECT
db ROCK,FLYING,20 db GHOST, PSYCHIC_TYPE, NO_EFFECT
db ROCK,BUG,20 db FIRE, DRAGON, NOT_VERY_EFFECTIVE
db ROCK,ICE,20 db WATER, DRAGON, NOT_VERY_EFFECTIVE
db GHOST,NORMAL,00 db ELECTRIC, DRAGON, NOT_VERY_EFFECTIVE
db GHOST,PSYCHIC,00 db GRASS, DRAGON, NOT_VERY_EFFECTIVE
db FIRE,DRAGON,05 db ICE, DRAGON, SUPER_EFFECTIVE
db WATER,DRAGON,05 db DRAGON, DRAGON, SUPER_EFFECTIVE
db ELECTRIC,DRAGON,05 db -1 ; end
db GRASS,DRAGON,05
db ICE,DRAGON,20
db DRAGON,DRAGON,20
db $FF

View file

@ -163,7 +163,7 @@ DrawFrameBlock:
PlayAnimation: PlayAnimation:
xor a xor a
ld [hROMBankTemp], a ; it looks like nothing reads this ldh [hROMBankTemp], a ; it looks like nothing reads this
ld [wSubAnimTransform], a ld [wSubAnimTransform], a
ld a, [wAnimationID] ; get animation number ld a, [wAnimationID] ; get animation number
dec a dec a
@ -241,15 +241,15 @@ PlayAnimation:
ld l, c ld l, c
ld h, b ld h, b
push hl push hl
ld a, [rOBP0] ldh a, [rOBP0]
push af push af
ld a, [wAnimPalette] ld a, [wAnimPalette]
ld [rOBP0], a ldh [rOBP0], a
call LoadAnimationTileset call LoadAnimationTileset
call LoadSubanimation call LoadSubanimation
call PlaySubanimation call PlaySubanimation
pop af pop af
ld [rOBP0], a ldh [rOBP0], a
.nextAnimationCommand .nextAnimationCommand
pop hl pop hl
jr .animationLoop jr .animationLoop
@ -308,7 +308,7 @@ LoadSubanimation:
; sets the transform to the subanimation type if it's the enemy's turn ; sets the transform to the subanimation type if it's the enemy's turn
GetSubanimationTransform1: GetSubanimationTransform1:
ld b, a ld b, a
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, b ld a, b
ret nz ret nz
@ -319,7 +319,7 @@ GetSubanimationTransform1:
; sets the transform to 2 (i.e. horizontal and vertical flip) if it's the player's turn ; sets the transform to 2 (i.e. horizontal and vertical flip) if it's the player's turn
; sets the transform to 0 (i.e. no transform) if it's the enemy's turn ; sets the transform to 0 (i.e. no transform) if it's the enemy's turn
GetSubanimationTransform2: GetSubanimationTransform2:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, 2 << 5 ld a, 2 << 5
ret z ret z
@ -341,7 +341,7 @@ LoadAnimationTileset:
ld e, a ld e, a
ld a, [hl] ld a, [hl]
ld d, a ; de = address of tileset ld d, a ; de = address of tileset
ld hl, vSprites + $310 ld hl, vSprites tile $31
ld b, BANK(AnimationTileset1) ; ROM bank ld b, BANK(AnimationTileset1) ; ROM bank
ld a, [wTempTilesetNumTiles] ld a, [wTempTilesetNumTiles]
ld c, a ; number of tiles ld c, a ; number of tiles
@ -373,6 +373,7 @@ ENDC
IF DEF(_BLUE) IF DEF(_BLUE)
INCBIN "gfx/slots/blue_slots_2.2bpp" INCBIN "gfx/slots/blue_slots_2.2bpp"
ENDC ENDC
SlotMachineTiles2End:
MoveAnimation: MoveAnimation:
push hl push hl
@ -421,11 +422,11 @@ MoveAnimation:
ShareMoveAnimations: ShareMoveAnimations:
; some moves just reuse animations from status conditions ; some moves just reuse animations from status conditions
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ret z ret z
; opponents turn ; opponent's turn
ld a, [wAnimationID] ld a, [wAnimationID]
@ -497,18 +498,18 @@ AnimationShakeScreenHorizontallySlow:
push bc push bc
push bc push bc
.loop1 .loop1
ld a, [rWX] ldh a, [rWX]
inc a inc a
ld [rWX], a ldh [rWX], a
ld c, 2 ld c, 2
call DelayFrames call DelayFrames
dec b dec b
jr nz, .loop1 jr nz, .loop1
pop bc pop bc
.loop2 .loop2
ld a, [rWX] ldh a, [rWX]
dec a dec a
ld [rWX], a ldh [rWX], a
ld c, 2 ld c, 2
call DelayFrames call DelayFrames
dec b dec b
@ -534,16 +535,16 @@ SetAnimationPalette:
ld b, $f0 ld b, $f0
.next .next
ld a, b ld a, b
ld [rOBP0], a ldh [rOBP0], a
ld a, $6c ld a, $6c
ld [rOBP1], a ldh [rOBP1], a
ret ret
.notSGB .notSGB
ld a, $e4 ld a, $e4
ld [wAnimPalette], a ld [wAnimPalette], a
ld [rOBP0], a ldh [rOBP0], a
ld a, $6c ld a, $6c
ld [rOBP1], a ldh [rOBP1], a
ret ret
PlaySubanimation: PlaySubanimation:
@ -656,9 +657,9 @@ DoBallTossSpecialEffects:
cp 3 ; is it a Master Ball or Ultra Ball? cp 3 ; is it a Master Ball or Ultra Ball?
jr nc, .skipFlashingEffect jr nc, .skipFlashingEffect
.flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball .flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball
ld a, [rOBP0] ldh a, [rOBP0]
xor %00111100 ; complement colors 1 and 2 xor %00111100 ; complement colors 1 and 2
ld [rOBP0], a ldh [rOBP0], a
.skipFlashingEffect .skipFlashingEffect
ld a, [wSubAnimCounter] ld a, [wSubAnimCounter]
cp 11 ; is it the beginning of the subanimation? cp 11 ; is it the beginning of the subanimation?
@ -682,7 +683,7 @@ DoBallTossSpecialEffects:
cp 1 cp 1
ret nz ret nz
.moveGhostMarowakLeft .moveGhostMarowakLeft
coord hl, 17, 0 hlcoord 17, 0
ld de, 20 ld de, 20
lb bc, 7, 7 lb bc, 7, 7
.loop .loop
@ -695,7 +696,7 @@ DoBallTossSpecialEffects:
dec b dec b
jr nz, .loop jr nz, .loop
ld a, %00001000 ld a, %00001000
ld [rNR10], a ; Channel 1 sweep register ldh [rNR10], a ; Channel 1 sweep register
ret ret
.isTrainerBattle ; if it's a trainer battle, shorten the animation by one frame .isTrainerBattle ; if it's a trainer battle, shorten the animation by one frame
ld a, [wSubAnimCounter] ld a, [wSubAnimCounter]
@ -781,7 +782,7 @@ DoExplodeSpecialEffects:
cp 1 ; is it the end of the subanimation? cp 1 ; is it the end of the subanimation?
jr nz, FlashScreenEveryFourFrameBlocks jr nz, FlashScreenEveryFourFrameBlocks
; if it's the end of the subanimation, make the attacking pokemon disappear ; if it's the end of the subanimation, make the attacking pokemon disappear
coord hl, 1, 5 hlcoord 1, 5
jp AnimationHideMonPic ; make pokemon disappear jp AnimationHideMonPic ; make pokemon disappear
; flashes the screen when subanimation counter is 1 modulo 4 ; flashes the screen when subanimation counter is 1 modulo 4
@ -882,9 +883,9 @@ TradeJumpPokeball:
ld c, 5 ld c, 5
call DelayFrames call DelayFrames
pop bc pop bc
ld a, [hSCX] ; background scroll X ldh a, [hSCX] ; background scroll X
sub 8 ; scroll to the left sub 8 ; scroll to the left
ld [hSCX], a ldh [hSCX], a
pop de pop de
jr .loop jr .loop
@ -920,16 +921,16 @@ AnimationDelay10:
; calls a function with the turn flipped from player to enemy or vice versa ; calls a function with the turn flipped from player to enemy or vice versa
; input - hl - address of function to call ; input - hl - address of function to call
CallWithTurnFlipped: CallWithTurnFlipped:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
push af push af
xor 1 xor 1
ld [hWhoseTurn], a ldh [hWhoseTurn], a
ld de, .returnAddress ld de, .returnAddress
push de push de
jp hl jp hl
.returnAddress .returnAddress
pop af pop af
ld [hWhoseTurn], a ldh [hWhoseTurn], a
ret ret
; flashes the screen for an extended period (48 frames) ; flashes the screen for an extended period (48 frames)
@ -947,7 +948,7 @@ AnimationFlashScreenLong:
ld a, [hli] ld a, [hli]
cp $01 ; is it the end of the palettes? cp $01 ; is it the end of the palettes?
jr z, .endOfPalettes jr z, .endOfPalettes
ld [rBGP], a ldh [rBGP], a
call FlashScreenLongDelay call FlashScreenLongDelay
jr .innerLoop jr .innerLoop
.endOfPalettes .endOfPalettes
@ -1006,18 +1007,18 @@ FlashScreenLongDelay:
jp DelayFrames jp DelayFrames
AnimationFlashScreen: AnimationFlashScreen:
ld a, [rBGP] ldh a, [rBGP]
push af ; save initial palette push af ; save initial palette
ld a, %00011011 ; 0, 1, 2, 3 (inverted colors) ld a, %00011011 ; 0, 1, 2, 3 (inverted colors)
ld [rBGP], a ldh [rBGP], a
ld c, 2 ld c, 2
call DelayFrames call DelayFrames
xor a ; white out background xor a ; white out background
ld [rBGP], a ldh [rBGP], a
ld c, 2 ld c, 2
call DelayFrames call DelayFrames
pop af pop af
ld [rBGP], a ; restore initial palette ldh [rBGP], a ; restore initial palette
ret ret
AnimationDarkScreenPalette: AnimationDarkScreenPalette:
@ -1062,7 +1063,7 @@ SetAnimationBGPalette:
jr z, .next jr z, .next
ld a, c ld a, c
.next .next
ld [rBGP], a ldh [rBGP], a
ret ret
ld b, $5 ld b, $5
@ -1133,14 +1134,14 @@ _AnimationWaterDroplets:
AnimationSlideMonUp: AnimationSlideMonUp:
; Slides the mon's sprite upwards. ; Slides the mon's sprite upwards.
ld c, 7 ld c, 7
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
coord hl, 1, 6 hlcoord 1, 6
coord de, 1, 5 decoord 1, 5
ld a, $30 ld a, $30
jr z, .next jr z, .next
coord hl, 12, 1 hlcoord 12, 1
coord de, 12, 0 decoord 12, 0
ld a, $ff ld a, $ff
.next .next
ld [wSlideMonUpBottomRowLeftTile], a ld [wSlideMonUpBottomRowLeftTile], a
@ -1201,11 +1202,11 @@ _AnimationSlideMonUp:
jr nz, .slideLoop jr nz, .slideLoop
; Fill in the bottom row of the mon pic with the next row's tile IDs. ; Fill in the bottom row of the mon pic with the next row's tile IDs.
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
coord hl, 1, 11 hlcoord 1, 11
jr z, .next jr z, .next
coord hl, 12, 6 hlcoord 12, 6
.next .next
ld a, [wSlideMonUpBottomRowLeftTile] ld a, [wSlideMonUpBottomRowLeftTile]
inc a inc a
@ -1370,13 +1371,13 @@ AnimationShowEnemyMonPic:
AnimationShakeBackAndForth: AnimationShakeBackAndForth:
; Shakes the mon's sprite back and forth rapidly. This is used in Double Team. ; Shakes the mon's sprite back and forth rapidly. This is used in Double Team.
; The mon's sprite disappears after this animation. ; The mon's sprite disappears after this animation.
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
coord hl, 0, 5 hlcoord 0, 5
coord de, 2, 5 decoord 2, 5
jr z, .next jr z, .next
coord hl, 11, 0 hlcoord 11, 0
coord de, 13, 0 decoord 13, 0
.next .next
xor a xor a
@ -1418,11 +1419,11 @@ AnimationMoveMonHorizontally:
; Shifts the mon's sprite horizontally to a fixed location. Used by lots of ; Shifts the mon's sprite horizontally to a fixed location. Used by lots of
; animations like Tackle/Body Slam. ; animations like Tackle/Body Slam.
call AnimationHideMonPic call AnimationHideMonPic
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
coord hl, 2, 5 hlcoord 2, 5
jr z, .next jr z, .next
coord hl, 11, 0 hlcoord 11, 0
.next .next
xor a xor a
push hl push hl
@ -1434,7 +1435,7 @@ AnimationMoveMonHorizontally:
AnimationResetMonPosition: AnimationResetMonPosition:
; Resets the mon's sprites to be located at the normal coordinates. ; Resets the mon's sprites to be located at the normal coordinates.
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, 5 * SCREEN_WIDTH + 2 ld a, 5 * SCREEN_WIDTH + 2
jr z, .next jr z, .next
@ -1446,7 +1447,7 @@ AnimationResetMonPosition:
AnimationSpiralBallsInward: AnimationSpiralBallsInward:
; Creates an effect that looks like energy balls spiralling into the ; Creates an effect that looks like energy balls spiralling into the
; player mon's sprite. Used in Focus Energy, for example. ; player mon's sprite. Used in Focus Energy, for example.
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .playerTurn jr z, .playerTurn
ld a, -40 ld a, -40
@ -1530,15 +1531,15 @@ AnimationSquishMonPic:
ld c, 4 ld c, 4
.loop .loop
push bc push bc
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .playerTurn jr z, .playerTurn
coord hl, 16, 0 hlcoord 16, 0
coord de, 14, 0 decoord 14, 0
jr .next jr .next
.playerTurn .playerTurn
coord hl, 5, 5 hlcoord 5, 5
coord de, 3, 5 decoord 3, 5
.next .next
push de push de
xor a ; left xor a ; left
@ -1583,7 +1584,7 @@ _AnimationSquishMonPic:
AnimationShootBallsUpward: AnimationShootBallsUpward:
; Shoots one pillar of "energy" balls upwards. Used in Teleport/Sky Attack ; Shoots one pillar of "energy" balls upwards. Used in Teleport/Sky Attack
; animations. ; animations.
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .playerTurn jr z, .playerTurn
lb bc, 0, 16 * 8 lb bc, 0, 16 * 8
@ -1651,7 +1652,7 @@ _AnimationShootBallsUpward:
AnimationShootManyBallsUpward: AnimationShootManyBallsUpward:
; Shoots several pillars of "energy" balls upward. ; Shoots several pillars of "energy" balls upward.
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld hl, UpwardBallsAnimXCoordinatesPlayerTurn ld hl, UpwardBallsAnimXCoordinatesPlayerTurn
ld a, $50 ; y coordinate for "energy" ball pillar ld a, $50 ; y coordinate for "energy" ball pillar
@ -1743,13 +1744,13 @@ AnimationSlideMonDownAndHide:
_AnimationSlideMonOff: _AnimationSlideMonOff:
; Slides the mon's sprite off the screen horizontally by e tiles and waits ; Slides the mon's sprite off the screen horizontally by e tiles and waits
; [wSlideMonDelay] V-blanks each time the pic is slid by one tile. ; [wSlideMonDelay] V-blanks each time the pic is slid by one tile.
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .playerTurn jr z, .playerTurn
coord hl, 12, 0 hlcoord 12, 0
jr .next jr .next
.playerTurn .playerTurn
coord hl, 0, 5 hlcoord 0, 5
.next .next
ld d, 8 ; d's value is unused ld d, 8 ; d's value is unused
.slideLoop ; iterates once for each time the pic slides by one tile .slideLoop ; iterates once for each time the pic slides by one tile
@ -1758,7 +1759,7 @@ _AnimationSlideMonOff:
.rowLoop ; iterates once for each row .rowLoop ; iterates once for each row
ld c, 8 ld c, 8
.tileLoop ; iterates once for each tile in the row .tileLoop ; iterates once for each tile in the row
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .playerTurn2 jr z, .playerTurn2
call .EnemyNextTile call .EnemyNextTile
@ -1821,7 +1822,7 @@ AnimationSlideMonHalfOff:
jp Delay3 jp Delay3
CopyTempPicToMonPic: CopyTempPicToMonPic:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld hl, vBackPic ; player turn ld hl, vBackPic ; player turn
jr z, .next jr z, .next
@ -1837,9 +1838,9 @@ AnimationWavyScreen:
call BattleAnimCopyTileMapToVRAM call BattleAnimCopyTileMapToVRAM
call Delay3 call Delay3
xor a xor a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
ld a, SCREEN_HEIGHT_PX ld a, SCREEN_HEIGHT_PX
ld [hWY], a ldh [hWY], a
ld d, $80 ; terminator ld d, $80 ; terminator
ld e, SCREEN_HEIGHT_PX - 1 ld e, SCREEN_HEIGHT_PX - 1
ld c, $ff ld c, $ff
@ -1848,7 +1849,7 @@ AnimationWavyScreen:
push hl push hl
.innerLoop .innerLoop
call WavyScreen_SetSCX call WavyScreen_SetSCX
ld a, [rLY] ldh a, [rLY]
cp e ; is it the last visible line in the frame? cp e ; is it the last visible line in the frame?
jr nz, .innerLoop ; keep going if not jr nz, .innerLoop ; keep going if not
pop hl pop hl
@ -1861,11 +1862,11 @@ AnimationWavyScreen:
dec c dec c
jr nz, .loop jr nz, .loop
xor a xor a
ld [hWY], a ldh [hWY], a
call SaveScreenTilesToBuffer2 call SaveScreenTilesToBuffer2
call ClearScreen call ClearScreen
ld a, 1 ld a, 1
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
call Delay3 call Delay3
call LoadScreenTilesFromBuffer2 call LoadScreenTilesFromBuffer2
ld hl, vBGMap1 ld hl, vBGMap1
@ -1873,11 +1874,11 @@ AnimationWavyScreen:
ret ret
WavyScreen_SetSCX: WavyScreen_SetSCX:
ld a, [rSTAT] ldh a, [rSTAT]
and $3 ; is it H-blank? and $3 ; is it H-blank?
jr nz, WavyScreen_SetSCX ; wait until it's H-blank jr nz, WavyScreen_SetSCX ; wait until it's H-blank
ld a, [hl] ld a, [hl]
ld [rSCX], a ldh [rSCX], a
inc hl inc hl
ld a, [hl] ld a, [hl]
cp d ; have we reached the end? cp d ; have we reached the end?
@ -1898,7 +1899,7 @@ AnimationSubstitute:
xor a xor a
ld bc, $310 ld bc, $310
call FillMemory call FillMemory
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .playerTurn jr z, .playerTurn
ld hl, SlowbroSprite ; facing down sprite ld hl, SlowbroSprite ; facing down sprite
@ -1937,7 +1938,7 @@ CopySlowbroSpriteData:
jp FarCopyData2 jp FarCopyData2
HideSubstituteShowMonAnim: HideSubstituteShowMonAnim:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld hl, wPlayerMonMinimized ld hl, wPlayerMonMinimized
ld a, [wPlayerBattleStatus2] ld a, [wPlayerBattleStatus2]
@ -1987,7 +1988,7 @@ AnimationTransformMon:
ld [wChangeMonPicEnemyTurnSpecies], a ld [wChangeMonPicEnemyTurnSpecies], a
ChangeMonPic: ChangeMonPic:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .playerTurn jr z, .playerTurn
ld a, [wChangeMonPicEnemyTurnSpecies] ld a, [wChangeMonPicEnemyTurnSpecies]
@ -1996,7 +1997,7 @@ ChangeMonPic:
xor a xor a
ld [wSpriteFlipped], a ld [wSpriteFlipped], a
call GetMonHeader call GetMonHeader
coord hl, 12, 0 hlcoord 12, 0
call LoadFrontSpriteByMonIndex call LoadFrontSpriteByMonIndex
jr .done jr .done
.playerTurn .playerTurn
@ -2020,11 +2021,11 @@ ChangeMonPic:
AnimationHideEnemyMonPic: AnimationHideEnemyMonPic:
; Hides the enemy mon's sprite ; Hides the enemy mon's sprite
xor a xor a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
ld hl, AnimationHideMonPic ld hl, AnimationHideMonPic
call CallWithTurnFlipped call CallWithTurnFlipped
ld a, $1 ld a, $1
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
jp Delay3 jp Delay3
InitMultipleObjectsOAM: InitMultipleObjectsOAM:
@ -2050,7 +2051,7 @@ InitMultipleObjectsOAM:
AnimationHideMonPic: AnimationHideMonPic:
; Hides the mon's sprite. ; Hides the mon's sprite.
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .playerTurn jr z, .playerTurn
ld a, 12 ld a, 12
@ -2064,7 +2065,7 @@ ClearMonPicFromTileMap:
push bc push bc
ld e, a ld e, a
ld d, 0 ld d, 0
coord hl, 0, 0 hlcoord 0, 0
add hl, de add hl, de
lb bc, 7, 7 lb bc, 7, 7
call ClearScreenArea call ClearScreenArea
@ -2078,7 +2079,7 @@ ClearMonPicFromTileMap:
; in order to show only a portion of the mon sprite. ; in order to show only a portion of the mon sprite.
GetMonSpriteTileMapPointerFromRowCount: GetMonSpriteTileMapPointerFromRowCount:
push de push de
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr nz, .enemyTurn jr nz, .enemyTurn
ld a, 20 * 5 + 1 ld a, 20 * 5 + 1
@ -2086,7 +2087,7 @@ GetMonSpriteTileMapPointerFromRowCount:
.enemyTurn .enemyTurn
ld a, 12 ld a, 12
.next .next
coord hl, 0, 0 hlcoord 0, 0
ld e, a ld e, a
ld d, 0 ld d, 0
add hl, de add hl, de
@ -2166,7 +2167,7 @@ GetMoveSound:
ld b, a ld b, a
call IsCryMove call IsCryMove
jr nc, .NotCryMove jr nc, .NotCryMove
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr nz, .next jr nz, .next
ld a, [wBattleMonSpecies] ; get number of current monster ld a, [wBattleMonSpecies] ; get number of current monster
@ -2211,14 +2212,14 @@ IsCryMove:
INCLUDE "data/moves/sfx.asm" INCLUDE "data/moves/sfx.asm"
CopyPicTiles: CopyPicTiles:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, $31 ; base tile ID of player mon sprite ld a, $31 ; base tile ID of player mon sprite
jr z, .next jr z, .next
; enemy turn ; enemy turn
xor a ; base tile ID of enemy mon sprite xor a ; base tile ID of enemy mon sprite
.next .next
ld [hBaseTileID], a ldh [hBaseTileID], a
jr CopyTileIDs_NoBGTransfer jr CopyTileIDs_NoBGTransfer
; copy the tiles used when a mon is being sent out of or into a pokeball ; copy the tiles used when a mon is being sent out of or into a pokeball
@ -2235,7 +2236,7 @@ CopyDownscaledMonTiles:
CopyTileIDs_NoBGTransfer: CopyTileIDs_NoBGTransfer:
xor a xor a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
; fall through ; fall through
; b = number of rows ; b = number of rows
@ -2245,7 +2246,7 @@ CopyTileIDs:
.rowLoop .rowLoop
push bc push bc
push hl push hl
ld a, [hBaseTileID] ldh a, [hBaseTileID]
ld b, a ld b, a
.columnLoop .columnLoop
ld a, [de] ld a, [de]
@ -2261,7 +2262,7 @@ CopyTileIDs:
dec b dec b
jr nz, .rowLoop jr nz, .rowLoop
ld a, $1 ld a, $1
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
pop hl pop hl
ret ret
@ -2361,16 +2362,16 @@ Unknown_79c50:
AnimationLeavesFalling: AnimationLeavesFalling:
; Makes leaves float down from the top of the screen. This is used ; Makes leaves float down from the top of the screen. This is used
; in Razor Leaf's animation. ; in Razor Leaf's animation.
ld a, [rOBP0] ldh a, [rOBP0]
push af push af
ld a, [wAnimPalette] ld a, [wAnimPalette]
ld [rOBP0], a ldh [rOBP0], a
ld d, $37 ; leaf tile ld d, $37 ; leaf tile
ld a, 3 ; number of leaves ld a, 3 ; number of leaves
ld [wNumFallingObjects], a ld [wNumFallingObjects], a
call AnimationFallingObjects call AnimationFallingObjects
pop af pop af
ld [rOBP0], a ldh [rOBP0], a
ret ret
AnimationPetalsFalling: AnimationPetalsFalling:
@ -2529,7 +2530,7 @@ AnimationShakeEnemyHUD:
call CopyVideoData call CopyVideoData
xor a xor a
ld [hSCX], a ldh [hSCX], a
; Copy wTileMap to BG map 0. The regular BG (not the window) is set to use ; Copy wTileMap to BG map 0. The regular BG (not the window) is set to use
; map 0 and can be scrolled with SCX, which allows a shaking effect. ; map 0 and can be scrolled with SCX, which allows a shaking effect.
@ -2539,7 +2540,7 @@ AnimationShakeEnemyHUD:
; Now that the regular BG is showing the same thing the window was, move the ; Now that the regular BG is showing the same thing the window was, move the
; window off the screen so that we can modify its contents below. ; window off the screen so that we can modify its contents below.
ld a, SCREEN_HEIGHT_PX ld a, SCREEN_HEIGHT_PX
ld [hWY], a ldh [hWY], a
; Copy wTileMap to VRAM such that the row below the enemy HUD (in wTileMap) is ; Copy wTileMap to VRAM such that the row below the enemy HUD (in wTileMap) is
; lined up with row 0 of the window. ; lined up with row 0 of the window.
@ -2551,7 +2552,7 @@ AnimationShakeEnemyHUD:
; covers everything below the enemy HD with a copy that looks just like what ; covers everything below the enemy HD with a copy that looks just like what
; was there before. ; was there before.
ld a, 7 * 8 ld a, 7 * 8
ld [hWY], a ldh [hWY], a
; Write OAM entries so that the copy of the back pic from the top of this ; Write OAM entries so that the copy of the back pic from the top of this
; function shows up on screen. We need this because the back pic's Y coordinates ; function shows up on screen. We need this because the back pic's Y coordinates
@ -2576,11 +2577,11 @@ AnimationShakeEnemyHUD:
call AnimationShowMonPic call AnimationShowMonPic
call ClearSprites call ClearSprites
ld a, SCREEN_HEIGHT_PX ld a, SCREEN_HEIGHT_PX
ld [hWY], a ldh [hWY], a
ld hl, vBGMap1 ld hl, vBGMap1
call BattleAnimCopyTileMapToVRAM call BattleAnimCopyTileMapToVRAM
xor a xor a
ld [hWY], a ldh [hWY], a
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
ld hl, vBGMap0 ld hl, vBGMap0
call BattleAnimCopyTileMapToVRAM call BattleAnimCopyTileMapToVRAM
@ -2595,7 +2596,7 @@ AnimationShakeEnemyHUD:
CopyTileIDsFromList: CopyTileIDsFromList:
call GetPredefRegisters call GetPredefRegisters
ld a, c ld a, c
ld [hBaseTileID], a ldh [hBaseTileID], a
ld a, b ld a, b
push hl push hl
call GetTileIDList call GetTileIDList
@ -2603,30 +2604,30 @@ CopyTileIDsFromList:
jp CopyTileIDs jp CopyTileIDs
ShakeEnemyHUD_ShakeBG: ShakeEnemyHUD_ShakeBG:
ld a, [hSCX] ldh a, [hSCX]
ld [wTempSCX], a ld [wTempSCX], a
.loop .loop
ld a, [wTempSCX] ld a, [wTempSCX]
add d add d
ld [hSCX], a ldh [hSCX], a
ld c, 2 ld c, 2
call DelayFrames call DelayFrames
ld a, [wTempSCX] ld a, [wTempSCX]
sub d sub d
ld [hSCX], a ldh [hSCX], a
ld c, 2 ld c, 2
call DelayFrames call DelayFrames
dec e dec e
jr nz, .loop jr nz, .loop
ld a, [wTempSCX] ld a, [wTempSCX]
ld [hSCX], a ldh [hSCX], a
ret ret
BattleAnimCopyTileMapToVRAM: BattleAnimCopyTileMapToVRAM:
ld a, h ld a, h
ld [hAutoBGTransferDest + 1], a ldh [hAutoBGTransferDest + 1], a
ld a, l ld a, l
ld [hAutoBGTransferDest], a ldh [hAutoBGTransferDest], a
jp Delay3 jp Delay3
TossBallAnimation: TossBallAnimation:

View file

@ -1,9 +1,9 @@
BattleTransition: BattleTransition:
ld a, 1 ld a, 1
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
call Delay3 call Delay3
xor a xor a
ld [hWY], a ldh [hWY], a
dec a dec a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
call DelayFrame call DelayFrame
@ -11,7 +11,7 @@ BattleTransition:
; Determine which OAM block is being used by the enemy trainer sprite (if there ; Determine which OAM block is being used by the enemy trainer sprite (if there
; is one). ; is one).
ld hl, wSpritePlayerStateData1ImageIndex ld hl, wSpritePlayerStateData1ImageIndex
ld a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle) ldh a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle)
ld c, a ld c, a
ld b, 0 ld b, 0
ld de, $10 ld de, $10
@ -154,20 +154,18 @@ GetBattleTransitionID_IsDungeonMap:
INCLUDE "data/maps/dungeon_maps.asm" INCLUDE "data/maps/dungeon_maps.asm"
LoadBattleTransitionTile: LoadBattleTransitionTile:
ld hl, vChars1 + $7f0 ld hl, vChars1 tile $7f
ld de, BattleTransitionTile ld de, BattleTransitionTile
lb bc, BANK(BattleTransitionTile), (BattleTransitionTileEnd - BattleTransitionTile) / $10 lb bc, BANK(BattleTransitionTile), 1
jp CopyVideoData jp CopyVideoData
BattleTransitionTile: BattleTransitionTile: INCBIN "gfx/overworld/battle_transition.2bpp"
INCBIN "gfx/overworld/battle_transition.2bpp"
BattleTransitionTileEnd:
BattleTransition_BlackScreen: BattleTransition_BlackScreen:
ld a, $ff ld a, $ff
ld [rBGP], a ldh [rBGP], a
ld [rOBP0], a ldh [rOBP0], a
ld [rOBP1], a ldh [rOBP1], a
ret ret
; for non-dungeon trainer battles ; for non-dungeon trainer battles
@ -181,7 +179,7 @@ BattleTransition_Spiral:
call BattleTransition_InwardSpiral call BattleTransition_InwardSpiral
jr .done jr .done
.outwardSpiral .outwardSpiral
coord hl, 10, 10 hlcoord 10, 10
ld a, $3 ld a, $3
ld [wOutwardSpiralCurrentDirection], a ld [wOutwardSpiralCurrentDirection], a
ld a, l ld a, l
@ -210,7 +208,7 @@ BattleTransition_Spiral:
BattleTransition_InwardSpiral: BattleTransition_InwardSpiral:
ld a, 7 ld a, 7
ld [wInwardSpiralUpdateScreenCounter], a ld [wInwardSpiralUpdateScreenCounter], a
coord hl, 0, 0 hlcoord 0, 0
ld c, SCREEN_HEIGHT - 1 ld c, SCREEN_HEIGHT - 1
ld de, SCREEN_WIDTH ld de, SCREEN_WIDTH
call BattleTransition_InwardSpiral_ call BattleTransition_InwardSpiral_
@ -330,7 +328,7 @@ BattleTransition_FlashScreen_:
ld a, [hli] ld a, [hli]
cp $1 cp $1
jr z, .done jr z, .done
ld [rBGP], a ldh [rBGP], a
ld c, 2 ld c, 2
call DelayFrames call DelayFrames
jr .loop jr .loop
@ -349,25 +347,25 @@ BattleTransition_Shrink:
.loop .loop
push bc push bc
xor a xor a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
coord hl, 0, 7 hlcoord 0, 7
coord de, 0, 8 decoord 0, 8
ld bc, -SCREEN_WIDTH * 2 ld bc, -SCREEN_WIDTH * 2
call BattleTransition_CopyTiles1 call BattleTransition_CopyTiles1
coord hl, 0, 10 hlcoord 0, 10
coord de, 0, 9 decoord 0, 9
ld bc, SCREEN_WIDTH * 2 ld bc, SCREEN_WIDTH * 2
call BattleTransition_CopyTiles1 call BattleTransition_CopyTiles1
coord hl, 8, 0 hlcoord 8, 0
coord de, 9, 0 decoord 9, 0
ld bc, -2 ld bc, -2
call BattleTransition_CopyTiles2 call BattleTransition_CopyTiles2
coord hl, 11, 0 hlcoord 11, 0
coord de, 10, 0 decoord 10, 0
ld bc, 2 ld bc, 2
call BattleTransition_CopyTiles2 call BattleTransition_CopyTiles2
ld a, $1 ld a, $1
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
ld c, 6 ld c, 6
call DelayFrames call DelayFrames
pop bc pop bc
@ -381,23 +379,23 @@ BattleTransition_Shrink:
BattleTransition_Split: BattleTransition_Split:
ld c, SCREEN_HEIGHT / 2 ld c, SCREEN_HEIGHT / 2
xor a xor a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
.loop .loop
push bc push bc
coord hl, 0, 16 hlcoord 0, 16
coord de, 0, 17 decoord 0, 17
ld bc, -SCREEN_WIDTH * 2 ld bc, -SCREEN_WIDTH * 2
call BattleTransition_CopyTiles1 call BattleTransition_CopyTiles1
coord hl, 0, 1 hlcoord 0, 1
coord de, 0, 0 decoord 0, 0
ld bc, SCREEN_WIDTH * 2 ld bc, SCREEN_WIDTH * 2
call BattleTransition_CopyTiles1 call BattleTransition_CopyTiles1
coord hl, 18, 0 hlcoord 18, 0
coord de, 19, 0 decoord 19, 0
ld bc, -2 ld bc, -2
call BattleTransition_CopyTiles2 call BattleTransition_CopyTiles2
coord hl, 1, 0 hlcoord 1, 0
coord de, 0, 0 decoord 0, 0
ld bc, 2 ld bc, 2
call BattleTransition_CopyTiles2 call BattleTransition_CopyTiles2
call BattleTransition_TransferDelay3 call BattleTransition_TransferDelay3
@ -493,10 +491,10 @@ BattleTransition_CopyTiles2:
; used for high level wild dungeon battles ; used for high level wild dungeon battles
BattleTransition_VerticalStripes: BattleTransition_VerticalStripes:
ld c, SCREEN_HEIGHT ld c, SCREEN_HEIGHT
coord hl, 0, 0 hlcoord 0, 0
coord de, 1, 17 decoord 1, 17
xor a xor a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
.loop .loop
push bc push bc
push hl push hl
@ -532,10 +530,10 @@ BattleTransition_VerticalStripes_:
; used for low level wild dungeon battles ; used for low level wild dungeon battles
BattleTransition_HorizontalStripes: BattleTransition_HorizontalStripes:
ld c, SCREEN_WIDTH ld c, SCREEN_WIDTH
coord hl, 0, 0 hlcoord 0, 0
coord de, 19, 1 decoord 19, 1
xor a xor a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
.loop .loop
push bc push bc
push hl push hl
@ -582,7 +580,7 @@ BattleTransition_FlashScreen:
ld b, $3 ld b, $3
call BattleTransition_FlashScreen_ call BattleTransition_FlashScreen_
xor a xor a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
ret ret
BattleTransition_Circle_Sub1: BattleTransition_Circle_Sub1:
@ -601,10 +599,10 @@ BattleTransition_Circle_Sub1:
BattleTransition_TransferDelay3: BattleTransition_TransferDelay3:
ld a, 1 ld a, 1
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
call Delay3 call Delay3
xor a xor a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
ret ret
; used for low level wild non-dungeon battles ; used for low level wild non-dungeon battles
@ -654,84 +652,84 @@ BattleTransition_Circle_Sub2:
BattleTransition_HalfCircle1: BattleTransition_HalfCircle1:
db $01 db $01
dw BattleTransition_CircleData1 dw BattleTransition_CircleData1
dwCoord 18, 6 dwcoord 18, 6
db $01 db $01
dw BattleTransition_CircleData2 dw BattleTransition_CircleData2
dwCoord 19, 3 dwcoord 19, 3
db $01 db $01
dw BattleTransition_CircleData3 dw BattleTransition_CircleData3
dwCoord 18, 0 dwcoord 18, 0
db $01 db $01
dw BattleTransition_CircleData4 dw BattleTransition_CircleData4
dwCoord 14, 0 dwcoord 14, 0
db $01 db $01
dw BattleTransition_CircleData5 dw BattleTransition_CircleData5
dwCoord 10, 0 dwcoord 10, 0
db $00 db $00
dw BattleTransition_CircleData5 dw BattleTransition_CircleData5
dwCoord 9, 0 dwcoord 9, 0
db $00 db $00
dw BattleTransition_CircleData4 dw BattleTransition_CircleData4
dwCoord 5, 0 dwcoord 5, 0
db $00 db $00
dw BattleTransition_CircleData3 dw BattleTransition_CircleData3
dwCoord 1, 0 dwcoord 1, 0
db $00 db $00
dw BattleTransition_CircleData2 dw BattleTransition_CircleData2
dwCoord 0, 3 dwcoord 0, 3
db $00 db $00
dw BattleTransition_CircleData1 dw BattleTransition_CircleData1
dwCoord 1, 6 dwcoord 1, 6
BattleTransition_HalfCircle2: BattleTransition_HalfCircle2:
db $00 db $00
dw BattleTransition_CircleData1 dw BattleTransition_CircleData1
dwCoord 1, 11 dwcoord 1, 11
db $00 db $00
dw BattleTransition_CircleData2 dw BattleTransition_CircleData2
dwCoord 0, 14 dwcoord 0, 14
db $00 db $00
dw BattleTransition_CircleData3 dw BattleTransition_CircleData3
dwCoord 1, 17 dwcoord 1, 17
db $00 db $00
dw BattleTransition_CircleData4 dw BattleTransition_CircleData4
dwCoord 5, 17 dwcoord 5, 17
db $00 db $00
dw BattleTransition_CircleData5 dw BattleTransition_CircleData5
dwCoord 9, 17 dwcoord 9, 17
db $01 db $01
dw BattleTransition_CircleData5 dw BattleTransition_CircleData5
dwCoord 10, 17 dwcoord 10, 17
db $01 db $01
dw BattleTransition_CircleData4 dw BattleTransition_CircleData4
dwCoord 14, 17 dwcoord 14, 17
db $01 db $01
dw BattleTransition_CircleData3 dw BattleTransition_CircleData3
dwCoord 18, 17 dwcoord 18, 17
db $01 db $01
dw BattleTransition_CircleData2 dw BattleTransition_CircleData2
dwCoord 19, 14 dwcoord 19, 14
db $01 db $01
dw BattleTransition_CircleData1 dw BattleTransition_CircleData1
dwCoord 18, 11 dwcoord 18, 11
BattleTransition_Circle_Sub3: BattleTransition_Circle_Sub3:
push hl push hl

View file

@ -24,7 +24,7 @@ PrintBeginningBattleText:
ld hl, TrainerWantsToFightText ld hl, TrainerWantsToFightText
.wildBattle .wildBattle
push hl push hl
callab DrawAllPokeballs callfar DrawAllPokeballs
pop hl pop hl
call PrintText call PrintText
jr .done jr .done
@ -38,7 +38,7 @@ PrintBeginningBattleText:
ld a, b ld a, b
and a and a
jr z, .noSilphScope jr z, .noSilphScope
callab LoadEnemyMonData callfar LoadEnemyMonData
jr .notPokemonTower jr .notPokemonTower
.noSilphScope .noSilphScope
ld hl, EnemyAppearedText ld hl, EnemyAppearedText
@ -54,8 +54,8 @@ PrintBeginningBattleText:
call PrintText call PrintText
ld hl, UnveiledGhostText ld hl, UnveiledGhostText
call PrintText call PrintText
callab LoadEnemyMonData callfar LoadEnemyMonData
callab MarowakAnim callfar MarowakAnim
ld hl, WildMonAppearedText ld hl, WildMonAppearedText
call PrintText call PrintText
@ -101,16 +101,16 @@ PrintSendOutMonMessage:
ld hl, GoText ld hl, GoText
jr z, .printText jr z, .printText
xor a xor a
ld [hMultiplicand], a ldh [hMultiplicand], a
ld hl, wEnemyMonHP ld hl, wEnemyMonHP
ld a, [hli] ld a, [hli]
ld [wLastSwitchInEnemyMonHP], a ld [wLastSwitchInEnemyMonHP], a
ld [hMultiplicand + 1], a ldh [hMultiplicand + 1], a
ld a, [hl] ld a, [hl]
ld [wLastSwitchInEnemyMonHP + 1], a ld [wLastSwitchInEnemyMonHP + 1], a
ld [hMultiplicand + 2], a ldh [hMultiplicand + 2], a
ld a, 25 ld a, 25
ld [hMultiplier], a ldh [hMultiplier], a
call Multiply call Multiply
ld hl, wEnemyMonMaxHP ld hl, wEnemyMonMaxHP
ld a, [hli] ld a, [hli]
@ -121,9 +121,9 @@ PrintSendOutMonMessage:
rr b rr b
ld a, b ld a, b
ld b, 4 ld b, 4
ld [hDivisor], a ; enemy mon max HP divided by 4 ldh [hDivisor], a ; enemy mon max HP divided by 4
call Divide call Divide
ld a, [hQuotient + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP ldh a, [hQuotient + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP
ld hl, GoText ; 70% or greater ld hl, GoText ; 70% or greater
cp 70 cp 70
jr nc, .printText jr nc, .printText
@ -179,14 +179,14 @@ PlayerMon2Text:
dec hl dec hl
ld a, [de] ld a, [de]
sub b sub b
ld [hMultiplicand + 2], a ldh [hMultiplicand + 2], a
dec de dec de
ld b, [hl] ld b, [hl]
ld a, [de] ld a, [de]
sbc b sbc b
ld [hMultiplicand + 1], a ldh [hMultiplicand + 1], a
ld a, 25 ld a, 25
ld [hMultiplier], a ldh [hMultiplier], a
call Multiply call Multiply
ld hl, wEnemyMonMaxHP ld hl, wEnemyMonMaxHP
ld a, [hli] ld a, [hli]
@ -197,11 +197,11 @@ PlayerMon2Text:
rr b rr b
ld a, b ld a, b
ld b, 4 ld b, 4
ld [hDivisor], a ldh [hDivisor], a
call Divide call Divide
pop bc pop bc
pop de pop de
ld a, [hQuotient + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4) ldh a, [hQuotient + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4)
; Assuming that the enemy mon hasn't gained HP since the last switch in, ; Assuming that the enemy mon hasn't gained HP since the last switch in,
; a approximates the percentage that the enemy mon's total HP has decreased ; a approximates the percentage that the enemy mon's total HP has decreased
; since the last switch in. ; since the last switch in.

File diff suppressed because it is too large Load diff

View file

@ -12,7 +12,7 @@ DrawEnemyPokeballs:
LoadPartyPokeballGfx: LoadPartyPokeballGfx:
ld de, PokeballTileGraphics ld de, PokeballTileGraphics
ld hl, vSprites + $310 ld hl, vSprites tile $31
lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / $10 lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / $10
jp CopyVideoData jp CopyVideoData
@ -121,7 +121,7 @@ PlacePlayerHUDTiles:
ld de, wHUDGraphicsTiles ld de, wHUDGraphicsTiles
ld bc, $3 ld bc, $3
call CopyData call CopyData
coord hl, 18, 10 hlcoord 18, 10
ld de, -1 ld de, -1
jr PlaceHUDTiles jr PlaceHUDTiles
@ -136,7 +136,7 @@ PlaceEnemyHUDTiles:
ld de, wHUDGraphicsTiles ld de, wHUDGraphicsTiles
ld bc, $3 ld bc, $3
call CopyData call CopyData
coord hl, 1, 2 hlcoord 1, 2
ld de, $1 ld de, $1
jr PlaceHUDTiles jr PlaceHUDTiles

View file

@ -4,7 +4,7 @@ JumpMoveEffect:
ret ret
_JumpMoveEffect: _JumpMoveEffect:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, [wPlayerMoveEffect] ld a, [wPlayerMoveEffect]
jr z, .next1 jr z, .next1
@ -26,7 +26,7 @@ INCLUDE "data/moves/effects_pointers.asm"
SleepEffect: SleepEffect:
ld de, wEnemyMonStatus ld de, wEnemyMonStatus
ld bc, wEnemyBattleStatus2 ld bc, wEnemyBattleStatus2
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jp z, .sleepEffect jp z, .sleepEffect
ld de, wBattleMonStatus ld de, wBattleMonStatus
@ -78,7 +78,7 @@ AlreadyAsleepText:
PoisonEffect: PoisonEffect:
ld hl, wEnemyMonStatus ld hl, wEnemyMonStatus
ld de, wPlayerMoveEffect ld de, wPlayerMoveEffect
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .poisonEffect jr z, .poisonEffect
ld hl, wBattleMonStatus ld hl, wBattleMonStatus
@ -121,7 +121,7 @@ PoisonEffect:
set 3, [hl] ; mon is now poisoned set 3, [hl] ; mon is now poisoned
push de push de
dec de dec de
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld b, ANIM_C7 ld b, ANIM_C7
ld hl, wPlayerBattleStatus3 ld hl, wPlayerBattleStatus3
@ -170,12 +170,12 @@ BadlyPoisonedText:
text_end text_end
DrainHPEffect: DrainHPEffect:
jpab DrainHPEffect_ jpfar DrainHPEffect_
ExplodeEffect: ExplodeEffect:
ld hl, wBattleMonHP ld hl, wBattleMonHP
ld de, wPlayerBattleStatus2 ld de, wPlayerBattleStatus2
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .faintUser jr z, .faintUser
ld hl, wEnemyMonHP ld hl, wEnemyMonHP
@ -196,7 +196,7 @@ FreezeBurnParalyzeEffect:
ld [wAnimationType], a ld [wAnimationType], a
call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag] call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag]
ret nz ; return if they have a substitute, can't effect them ret nz ; return if they have a substitute, can't effect them
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jp nz, opponentAttacker jp nz, opponentAttacker
ld a, [wEnemyMonStatus] ld a, [wEnemyMonStatus]
@ -308,7 +308,7 @@ CheckDefrost:
; any fire-type move that has a chance inflict burn (all but Fire Spin) will defrost a frozen target ; any fire-type move that has a chance inflict burn (all but Fire Spin) will defrost a frozen target
and 1 << FRZ ; are they frozen? and 1 << FRZ ; are they frozen?
ret z ; return if so ret z ; return if so
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr nz, .opponent jr nz, .opponent
;player [attacker] ;player [attacker]
@ -346,7 +346,7 @@ FireDefrostedText:
StatModifierUpEffect: StatModifierUpEffect:
ld hl, wPlayerMonStatMods ld hl, wPlayerMonStatMods
ld de, wPlayerMoveEffect ld de, wPlayerMoveEffect
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .statModifierUpEffect jr z, .statModifierUpEffect
ld hl, wEnemyMonStatMods ld hl, wEnemyMonStatMods
@ -382,7 +382,7 @@ StatModifierUpEffect:
push hl push hl
ld hl, wBattleMonAttack + 1 ld hl, wBattleMonAttack + 1
ld de, wPlayerMonUnmodifiedAttack ld de, wPlayerMonUnmodifiedAttack
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .pointToStats jr z, .pointToStats
ld hl, wEnemyMonAttack + 1 ld hl, wEnemyMonAttack + 1
@ -399,11 +399,12 @@ StatModifierUpEffect:
inc d ; de = unmodified (original) stat inc d ; de = unmodified (original) stat
.checkIf999 .checkIf999
pop bc pop bc
; check if stat is already 999
ld a, [hld] ld a, [hld]
sub 999 % $100 ; check if stat is already 999 sub LOW(MAX_STAT_VALUE)
jr nz, .recalculateStat jr nz, .recalculateStat
ld a, [hl] ld a, [hl]
sbc 999 / $100 sbc HIGH(MAX_STAT_VALUE)
jp z, RestoreOriginalStatModifier jp z, RestoreOriginalStatModifier
.recalculateStat ; recalculate affected stat .recalculateStat ; recalculate affected stat
; paralysis and burn penalties, as well as badge boosts are ignored ; paralysis and burn penalties, as well as badge boosts are ignored
@ -417,35 +418,35 @@ StatModifierUpEffect:
add hl, bc add hl, bc
pop bc pop bc
xor a xor a
ld [hMultiplicand], a ldh [hMultiplicand], a
ld a, [de] ld a, [de]
ld [hMultiplicand + 1], a ldh [hMultiplicand + 1], a
inc de inc de
ld a, [de] ld a, [de]
ld [hMultiplicand + 2], a ldh [hMultiplicand + 2], a
ld a, [hli] ld a, [hli]
ld [hMultiplier], a ldh [hMultiplier], a
call Multiply call Multiply
ld a, [hl] ld a, [hl]
ld [hDivisor], a ldh [hDivisor], a
ld b, $4 ld b, $4
call Divide call Divide
pop hl pop hl
; cap at 999 ; cap at MAX_STAT_VALUE (999)
ld a, [hProduct + 3] ldh a, [hProduct + 3]
sub 999 % $100 sub LOW(MAX_STAT_VALUE)
ld a, [hProduct + 2] ldh a, [hProduct + 2]
sbc 999 / $100 sbc HIGH(MAX_STAT_VALUE)
jp c, UpdateStat jp c, UpdateStat
ld a, 999 / $100 ld a, HIGH(MAX_STAT_VALUE)
ld [hMultiplicand + 1], a ldh [hMultiplicand + 1], a
ld a, 999 % $100 ld a, LOW(MAX_STAT_VALUE)
ld [hMultiplicand + 2], a ldh [hMultiplicand + 2], a
UpdateStat: UpdateStat:
ld a, [hProduct + 2] ldh a, [hProduct + 2]
ld [hli], a ld [hli], a
ld a, [hProduct + 3] ldh a, [hProduct + 3]
ld [hl], a ld [hl], a
pop hl pop hl
UpdateStatDone: UpdateStatDone:
@ -455,7 +456,7 @@ UpdateStatDone:
ld hl, wPlayerBattleStatus2 ld hl, wPlayerBattleStatus2
ld de, wPlayerMoveNum ld de, wPlayerMoveNum
ld bc, wPlayerMonMinimized ld bc, wPlayerMonMinimized
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .asm_3f4e6 jr z, .asm_3f4e6
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
@ -488,7 +489,7 @@ UpdateStatDone:
pop af pop af
call nz, Bankswitch call nz, Bankswitch
.applyBadgeBoostsAndStatusPenalties .applyBadgeBoostsAndStatusPenalties
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
call z, ApplyBadgeStatBoosts ; whenever the player uses a stat-up move, badge boosts get reapplied again to every stat, call z, ApplyBadgeStatBoosts ; whenever the player uses a stat-up move, badge boosts get reapplied again to every stat,
; even to those not affected by the stat-up move (will be boosted further) ; even to those not affected by the stat-up move (will be boosted further)
@ -511,7 +512,7 @@ MonsStatsRoseText:
text_far _MonsStatsRoseText text_far _MonsStatsRoseText
text_asm text_asm
ld hl, GreatlyRoseText ld hl, GreatlyRoseText
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, [wPlayerMoveEffect] ld a, [wPlayerMoveEffect]
jr z, .playerTurn jr z, .playerTurn
@ -534,7 +535,7 @@ StatModifierDownEffect:
ld hl, wEnemyMonStatMods ld hl, wEnemyMonStatMods
ld de, wPlayerMoveEffect ld de, wPlayerMoveEffect
ld bc, wEnemyBattleStatus1 ld bc, wEnemyBattleStatus1
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .statModifierDownEffect jr z, .statModifierDownEffect
ld hl, wPlayerMonStatMods ld hl, wPlayerMonStatMods
@ -601,7 +602,7 @@ StatModifierDownEffect:
push de push de
ld hl, wEnemyMonAttack + 1 ld hl, wEnemyMonAttack + 1
ld de, wEnemyMonUnmodifiedAttack ld de, wEnemyMonUnmodifiedAttack
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .pointToStat jr z, .pointToStat
ld hl, wBattleMonAttack + 1 ld hl, wBattleMonAttack + 1
@ -637,33 +638,33 @@ StatModifierDownEffect:
add hl, bc add hl, bc
pop bc pop bc
xor a xor a
ld [hMultiplicand], a ldh [hMultiplicand], a
ld a, [de] ld a, [de]
ld [hMultiplicand + 1], a ldh [hMultiplicand + 1], a
inc de inc de
ld a, [de] ld a, [de]
ld [hMultiplicand + 2], a ldh [hMultiplicand + 2], a
ld a, [hli] ld a, [hli]
ld [hMultiplier], a ldh [hMultiplier], a
call Multiply call Multiply
ld a, [hl] ld a, [hl]
ld [hDivisor], a ldh [hDivisor], a
ld b, $4 ld b, $4
call Divide call Divide
pop hl pop hl
ld a, [hProduct + 3] ldh a, [hProduct + 3]
ld b, a ld b, a
ld a, [hProduct + 2] ldh a, [hProduct + 2]
or b or b
jp nz, UpdateLoweredStat jp nz, UpdateLoweredStat
ld [hMultiplicand + 1], a ldh [hMultiplicand + 1], a
ld a, $1 ld a, $1
ld [hMultiplicand + 2], a ldh [hMultiplicand + 2], a
UpdateLoweredStat: UpdateLoweredStat:
ld a, [hProduct + 2] ldh a, [hProduct + 2]
ld [hli], a ld [hli], a
ld a, [hProduct + 3] ldh a, [hProduct + 3]
ld [hl], a ld [hl], a
pop de pop de
pop hl pop hl
@ -678,7 +679,7 @@ UpdateLoweredStatDone:
jr nc, .ApplyBadgeBoostsAndStatusPenalties jr nc, .ApplyBadgeBoostsAndStatusPenalties
call PlayCurrentMoveAnimation2 call PlayCurrentMoveAnimation2
.ApplyBadgeBoostsAndStatusPenalties .ApplyBadgeBoostsAndStatusPenalties
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
call nz, ApplyBadgeStatBoosts ; whenever the player uses a stat-down move, badge boosts get reapplied again to every stat, call nz, ApplyBadgeStatBoosts ; whenever the player uses a stat-down move, badge boosts get reapplied again to every stat,
; even to those not affected by the stat-up move (will be boosted further) ; even to those not affected by the stat-up move (will be boosted further)
@ -713,7 +714,7 @@ MonsStatsFellText:
text_far _MonsStatsFellText text_far _MonsStatsFellText
text_asm text_asm
ld hl, FellText ld hl, FellText
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, [wPlayerMoveEffect] ld a, [wPlayerMoveEffect]
jr z, .playerTurn jr z, .playerTurn
@ -759,7 +760,7 @@ BideEffect:
ld hl, wPlayerBattleStatus1 ld hl, wPlayerBattleStatus1
ld de, wPlayerBideAccumulatedDamage ld de, wPlayerBideAccumulatedDamage
ld bc, wPlayerNumAttacksLeft ld bc, wPlayerNumAttacksLeft
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .bideEffect jr z, .bideEffect
ld hl, wEnemyBattleStatus1 ld hl, wEnemyBattleStatus1
@ -778,14 +779,14 @@ BideEffect:
inc a inc a
inc a inc a
ld [bc], a ; set Bide counter to 2 or 3 at random ld [bc], a ; set Bide counter to 2 or 3 at random
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
add XSTATITEM_ANIM add XSTATITEM_ANIM
jp PlayBattleAnimation2 jp PlayBattleAnimation2
ThrashPetalDanceEffect: ThrashPetalDanceEffect:
ld hl, wPlayerBattleStatus1 ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft ld de, wPlayerNumAttacksLeft
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .thrashPetalDanceEffect jr z, .thrashPetalDanceEffect
ld hl, wEnemyBattleStatus1 ld hl, wEnemyBattleStatus1
@ -797,12 +798,12 @@ ThrashPetalDanceEffect:
inc a inc a
inc a inc a
ld [de], a ; set thrash/petal dance counter to 2 or 3 at random ld [de], a ; set thrash/petal dance counter to 2 or 3 at random
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
add ANIM_B0 add ANIM_B0
jp PlayBattleAnimation2 jp PlayBattleAnimation2
SwitchAndTeleportEffect: SwitchAndTeleportEffect:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr nz, .handleEnemy jr nz, .handleEnemy
ld a, [wIsInBattle] ld a, [wIsInBattle]
@ -920,7 +921,7 @@ TwoToFiveAttacksEffect:
ld hl, wPlayerBattleStatus1 ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft ld de, wPlayerNumAttacksLeft
ld bc, wPlayerNumHits ld bc, wPlayerNumHits
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .twoToFiveAttacksEffect jr z, .twoToFiveAttacksEffect
ld hl, wEnemyBattleStatus1 ld hl, wEnemyBattleStatus1
@ -931,7 +932,7 @@ TwoToFiveAttacksEffect:
ret nz ret nz
set ATTACKING_MULTIPLE_TIMES, [hl] ; mon is now attacking multiple times set ATTACKING_MULTIPLE_TIMES, [hl] ; mon is now attacking multiple times
ld hl, wPlayerMoveEffect ld hl, wPlayerMoveEffect
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .setNumberOfHits jr z, .setNumberOfHits
ld hl, wEnemyMoveEffect ld hl, wEnemyMoveEffect
@ -967,7 +968,7 @@ FlinchSideEffect:
ret nz ret nz
ld hl, wEnemyBattleStatus1 ld hl, wEnemyBattleStatus1
ld de, wPlayerMoveEffect ld de, wPlayerMoveEffect
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .flinchSideEffect jr z, .flinchSideEffect
ld hl, wPlayerBattleStatus1 ld hl, wPlayerBattleStatus1
@ -987,12 +988,12 @@ FlinchSideEffect:
ret ret
OneHitKOEffect: OneHitKOEffect:
jpab OneHitKOEffect_ jpfar OneHitKOEffect_
ChargeEffect: ChargeEffect:
ld hl, wPlayerBattleStatus1 ld hl, wPlayerBattleStatus1
ld de, wPlayerMoveEffect ld de, wPlayerMoveEffect
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld b, XSTATITEM_ANIM ld b, XSTATITEM_ANIM
jr z, .chargeEffect jr z, .chargeEffect
@ -1074,7 +1075,7 @@ DugAHoleText:
TrappingEffect: TrappingEffect:
ld hl, wPlayerBattleStatus1 ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft ld de, wPlayerNumAttacksLeft
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .trappingEffect jr z, .trappingEffect
ld hl, wEnemyBattleStatus1 ld hl, wEnemyBattleStatus1
@ -1097,13 +1098,13 @@ TrappingEffect:
ret ret
MistEffect: MistEffect:
jpab MistEffect_ jpfar MistEffect_
FocusEnergyEffect: FocusEnergyEffect:
jpab FocusEnergyEffect_ jpfar FocusEnergyEffect_
RecoilEffect: RecoilEffect:
jpab RecoilEffect_ jpfar RecoilEffect_
ConfusionSideEffect: ConfusionSideEffect:
call BattleRandom call BattleRandom
@ -1120,7 +1121,7 @@ ConfusionEffect:
jr nz, ConfusionEffectFailed jr nz, ConfusionEffectFailed
ConfusionSideEffectSuccess: ConfusionSideEffectSuccess:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld hl, wEnemyBattleStatus1 ld hl, wEnemyBattleStatus1
ld bc, wEnemyConfusedCounter ld bc, wEnemyConfusedCounter
@ -1157,14 +1158,14 @@ ConfusionEffectFailed:
jp ConditionalPrintButItFailed jp ConditionalPrintButItFailed
ParalyzeEffect: ParalyzeEffect:
jpab ParalyzeEffect_ jpfar ParalyzeEffect_
SubstituteEffect: SubstituteEffect:
jpab SubstituteEffect_ jpfar SubstituteEffect_
HyperBeamEffect: HyperBeamEffect:
ld hl, wPlayerBattleStatus2 ld hl, wPlayerBattleStatus2
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .hyperBeamEffect jr z, .hyperBeamEffect
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
@ -1175,7 +1176,7 @@ HyperBeamEffect:
ClearHyperBeam: ClearHyperBeam:
push hl push hl
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .playerTurn jr z, .playerTurn
ld hl, wPlayerBattleStatus2 ld hl, wPlayerBattleStatus2
@ -1186,7 +1187,7 @@ ClearHyperBeam:
RageEffect: RageEffect:
ld hl, wPlayerBattleStatus2 ld hl, wPlayerBattleStatus2
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .player jr z, .player
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
@ -1201,7 +1202,7 @@ MimicEffect:
ld a, [wMoveMissed] ld a, [wMoveMissed]
and a and a
jr nz, .mimicMissed jr nz, .mimicMissed
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
ld a, [wPlayerBattleStatus1] ld a, [wPlayerBattleStatus1]
@ -1226,7 +1227,7 @@ MimicEffect:
and a and a
jr z, .getRandomMove jr z, .getRandomMove
ld d, a ld d, a
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld hl, wBattleMonMoves ld hl, wBattleMonMoves
ld a, [wPlayerMoveListIndex] ld a, [wPlayerMoveListIndex]
@ -1271,7 +1272,7 @@ MimicLearnedMoveText:
text_end text_end
LeechSeedEffect: LeechSeedEffect:
jpab LeechSeedEffect_ jpfar LeechSeedEffect_
SplashEffect: SplashEffect:
call PlayCurrentMoveAnimation call PlayCurrentMoveAnimation
@ -1284,7 +1285,7 @@ DisableEffect:
jr nz, .moveMissed jr nz, .moveMissed
ld de, wEnemyDisabledMove ld de, wEnemyDisabledMove
ld hl, wEnemyMonMoves ld hl, wEnemyMonMoves
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .disableEffect jr z, .disableEffect
ld de, wPlayerDisabledMove ld de, wPlayerDisabledMove
@ -1307,7 +1308,7 @@ DisableEffect:
jr z, .pickMoveToDisable ; loop until a non-00 move slot is found jr z, .pickMoveToDisable ; loop until a non-00 move slot is found
ld [wd11e], a ; store move number ld [wd11e], a ; store move number
push hl push hl
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld hl, wBattleMonPP ld hl, wBattleMonPP
jr nz, .enemyTurn jr nz, .enemyTurn
@ -1345,7 +1346,7 @@ DisableEffect:
ld [de], a ld [de], a
call PlayCurrentMoveAnimation2 call PlayCurrentMoveAnimation2
ld hl, wPlayerDisabledMoveNumber ld hl, wPlayerDisabledMoveNumber
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr nz, .printDisableText jr nz, .printDisableText
inc hl ; wEnemyDisabledMoveNumber inc hl ; wEnemyDisabledMoveNumber
@ -1365,22 +1366,22 @@ MoveWasDisabledText:
text_end text_end
PayDayEffect: PayDayEffect:
jpab PayDayEffect_ jpfar PayDayEffect_
ConversionEffect: ConversionEffect:
jpab ConversionEffect_ jpfar ConversionEffect_
HazeEffect: HazeEffect:
jpab HazeEffect_ jpfar HazeEffect_
HealEffect: HealEffect:
jpab HealEffect_ jpfar HealEffect_
TransformEffect: TransformEffect:
jpab TransformEffect_ jpfar TransformEffect_
ReflectLightScreenEffect: ReflectLightScreenEffect:
jpab ReflectLightScreenEffect_ jpfar ReflectLightScreenEffect_
NothingHappenedText: NothingHappenedText:
text_far _NothingHappenedText text_far _NothingHappenedText
@ -1430,7 +1431,7 @@ ParalyzedMayNotAttackText:
CheckTargetSubstitute: CheckTargetSubstitute:
push hl push hl
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .next1 jr z, .next1
ld hl, wPlayerBattleStatus2 ld hl, wPlayerBattleStatus2
@ -1442,7 +1443,7 @@ CheckTargetSubstitute:
PlayCurrentMoveAnimation2: PlayCurrentMoveAnimation2:
; animation at MOVENUM will be played unless MOVENUM is 0 ; animation at MOVENUM will be played unless MOVENUM is 0
; plays wAnimationType 3 or 6 ; plays wAnimationType 3 or 6
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, [wPlayerMoveNum] ld a, [wPlayerMoveNum]
jr z, .notEnemyTurn jr z, .notEnemyTurn
@ -1454,7 +1455,7 @@ PlayCurrentMoveAnimation2:
PlayBattleAnimation2: PlayBattleAnimation2:
; play animation ID at a and animation type 6 or 3 ; play animation ID at a and animation type 6 or 3
ld [wAnimationID], a ld [wAnimationID], a
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, $6 ld a, $6
jr z, .storeAnimationType jr z, .storeAnimationType
@ -1468,7 +1469,7 @@ PlayCurrentMoveAnimation:
; resets wAnimationType ; resets wAnimationType
xor a xor a
ld [wAnimationType], a ld [wAnimationType], a
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, [wPlayerMoveNum] ld a, [wPlayerMoveNum]
jr z, .notEnemyTurn jr z, .notEnemyTurn

View file

@ -10,7 +10,7 @@ EndOfBattle:
ld a, [wEnemyMonStatus] ld a, [wEnemyMonStatus]
ld [hl], a ld [hl], a
call ClearScreen call ClearScreen
callab DisplayLinkBattleVersusTextBox callfar DisplayLinkBattleVersusTextBox
ld a, [wBattleResult] ld a, [wBattleResult]
cp $1 cp $1
ld de, YouWinText ld de, YouWinText
@ -19,7 +19,7 @@ EndOfBattle:
jr z, .placeWinOrLoseString jr z, .placeWinOrLoseString
ld de, DrawText ld de, DrawText
.placeWinOrLoseString .placeWinOrLoseString
coord hl, 6, 8 hlcoord 6, 8
call PlaceString call PlaceString
ld c, 200 ld c, 200
call DelayFrames call DelayFrames

View file

@ -55,15 +55,15 @@ GainExperience:
jr .gainStatExpLoop jr .gainStatExpLoop
.statExpDone .statExpDone
xor a xor a
ld [hMultiplicand], a ldh [hMultiplicand], a
ld [hMultiplicand + 1], a ldh [hMultiplicand + 1], a
ld a, [wEnemyMonBaseExp] ld a, [wEnemyMonBaseExp]
ld [hMultiplicand + 2], a ldh [hMultiplicand + 2], a
ld a, [wEnemyMonLevel] ld a, [wEnemyMonLevel]
ld [hMultiplier], a ldh [hMultiplier], a
call Multiply call Multiply
ld a, 7 ld a, 7
ld [hDivisor], a ldh [hDivisor], a
ld b, 4 ld b, 4
call Divide call Divide
ld hl, wPartyMon1OTID - (wPartyMon1DVs - 1) ld hl, wPartyMon1OTID - (wPartyMon1DVs - 1)
@ -91,12 +91,12 @@ GainExperience:
inc hl inc hl
; add the gained exp to the party mon's exp ; add the gained exp to the party mon's exp
ld b, [hl] ld b, [hl]
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
ld [wExpAmountGained + 1], a ld [wExpAmountGained + 1], a
add b add b
ld [hld], a ld [hld], a
ld b, [hl] ld b, [hl]
ld a, [hQuotient + 2] ldh a, [hQuotient + 2]
ld [wExpAmountGained], a ld [wExpAmountGained], a
adc b adc b
ld [hl], a ld [hl], a
@ -117,13 +117,13 @@ GainExperience:
ld [wd0b5], a ld [wd0b5], a
call GetMonHeader call GetMonHeader
ld d, MAX_LEVEL ld d, MAX_LEVEL
callab CalcExperience ; get max exp callfar CalcExperience ; get max exp
; compare max exp with current exp ; compare max exp with current exp
ld a, [hExperience] ldh a, [hExperience]
ld b, a ld b, a
ld a, [hExperience + 1] ldh a, [hExperience + 1]
ld c, a ld c, a
ld a, [hExperience + 2] ldh a, [hExperience + 2]
ld d, a ld d, a
pop hl pop hl
ld a, [hld] ld a, [hld]
@ -155,7 +155,7 @@ GainExperience:
ld bc, wPartyMon1Level - wPartyMon1Exp ld bc, wPartyMon1Level - wPartyMon1Exp
add hl, bc add hl, bc
push hl push hl
callba CalcLevelFromExperience farcall CalcLevelFromExperience
pop hl pop hl
ld a, [hl] ; current level ld a, [hl] ; current level
cp d cp d
@ -233,11 +233,11 @@ GainExperience:
.recalcStatChanges .recalcStatChanges
xor a ; battle mon xor a ; battle mon
ld [wCalculateWhoseStats], a ld [wCalculateWhoseStats], a
callab CalculateModifiedStats callfar CalculateModifiedStats
callab ApplyBurnAndParalysisPenaltiesToPlayer callfar ApplyBurnAndParalysisPenaltiesToPlayer
callab ApplyBadgeStatBoosts callfar ApplyBadgeStatBoosts
callab DrawPlayerHUDAndHPBar callfar DrawPlayerHUDAndHPBar
callab PrintEmptyString callfar PrintEmptyString
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
.printGrewLevelText .printGrewLevelText
ld hl, GrewLevelText ld hl, GrewLevelText
@ -246,7 +246,7 @@ GainExperience:
ld [wMonDataLocation], a ld [wMonDataLocation], a
call LoadMonData call LoadMonData
ld d, $1 ld d, $1
callab PrintStatsBox callfar PrintStatsBox
call WaitForTextScrollButtonPress call WaitForTextScrollButtonPress
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
xor a ; PLAYER_PARTY_DATA xor a ; PLAYER_PARTY_DATA
@ -311,14 +311,14 @@ DivideExpDataByNumMonsGainingExp:
ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats
.divideLoop .divideLoop
xor a xor a
ld [hDividend], a ldh [hDividend], a
ld a, [hl] ld a, [hl]
ld [hDividend + 1], a ldh [hDividend + 1], a
ld a, [wd11e] ld a, [wd11e]
ld [hDivisor], a ldh [hDivisor], a
ld b, $2 ld b, $2
call Divide ; divide value by number of mons gaining exp call Divide ; divide value by number of mons gaining exp
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
ld [hli], a ld [hli], a
dec c dec c
jr nz, .divideLoop jr nz, .divideLoop
@ -326,17 +326,17 @@ DivideExpDataByNumMonsGainingExp:
; multiplies exp by 1.5 ; multiplies exp by 1.5
BoostExp: BoostExp:
ld a, [hQuotient + 2] ldh a, [hQuotient + 2]
ld b, a ld b, a
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
ld c, a ld c, a
srl b srl b
rr c rr c
add c add c
ld [hQuotient + 3], a ldh [hQuotient + 3], a
ld a, [hQuotient + 2] ldh a, [hQuotient + 2]
adc b adc b
ld [hQuotient + 2], a ldh [hQuotient + 2], a
ret ret
GainedText: GainedText:

View file

@ -1,21 +1,21 @@
MarowakAnim: MarowakAnim:
; animate the ghost being unveiled as a Marowak ; animate the ghost being unveiled as a Marowak
ld a, $e4 ld a, $e4
ld [rOBP1], a ldh [rOBP1], a
call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same
; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap ; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap
coord hl, 12, 0 hlcoord 12, 0
lb bc, 7, 7 lb bc, 7, 7
call ClearScreenArea call ClearScreenArea
call Delay3 call Delay3
xor a xor a
ld [hAutoBGTransferEnabled], a ; disable BG transfer so we don't see the Marowak too soon ldh [hAutoBGTransferEnabled], a ; disable BG transfer so we don't see the Marowak too soon
; replace ghost pic with Marowak in BG ; replace ghost pic with Marowak in BG
ld a, MAROWAK ld a, MAROWAK
ld [wChangeMonPicEnemyTurnSpecies], a ld [wChangeMonPicEnemyTurnSpecies], a
ld a, $1 ld a, $1
ld [hWhoseTurn], a ldh [hWhoseTurn], a
callab ChangeMonPic callfar ChangeMonPic
; alternate between black and light grey 8 times. ; alternate between black and light grey 8 times.
; this makes the ghost's body appear to flash ; this makes the ghost's body appear to flash
ld d, $80 ld d, $80
@ -23,10 +23,10 @@ MarowakAnim:
.fadeOutGhostLoop .fadeOutGhostLoop
ld c, 10 ld c, 10
call DelayFrames call DelayFrames
ld a, [rOBP1] ldh a, [rOBP1]
sla a sla a
sla a sla a
ld [rOBP1], a ldh [rOBP1], a
jr nz, .fadeOutGhostLoop jr nz, .fadeOutGhostLoop
call ClearSprites call ClearSprites
call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM
@ -34,17 +34,17 @@ MarowakAnim:
.fadeInMarowakLoop .fadeInMarowakLoop
ld c, 10 ld c, 10
call DelayFrames call DelayFrames
ld a, [rOBP1] ldh a, [rOBP1]
srl b srl b
rra rra
srl b srl b
rra rra
ld [rOBP1], a ldh [rOBP1], a
ld a, b ld a, b
and a and a
jr nz, .fadeInMarowakLoop jr nz, .fadeInMarowakLoop
ld a, $1 ld a, $1
ld [hAutoBGTransferEnabled], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared ldh [hAutoBGTransferEnabled], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared
call Delay3 call Delay3
jp ClearSprites jp ClearSprites

View file

@ -1,5 +1,5 @@
InitBattleVariables: InitBattleVariables:
ld a, [hTilesetType] ldh a, [hTilesetType]
ld [wSavedTilesetType], a ld [wSavedTilesetType], a
xor a xor a
ld [wActionResultOrTookBattleTurn], a ld [wActionResultOrTookBattleTurn], a
@ -35,4 +35,4 @@ InitBattleVariables:
ld a, BATTLE_TYPE_SAFARI ld a, BATTLE_TYPE_SAFARI
ld [wBattleType], a ld [wBattleType], a
.notSafariBattle .notSafariBattle
jpab PlayBattleMusic jpfar PlayBattleMusic

View file

@ -1,23 +1,23 @@
; display "[player] VS [enemy]" text box with pokeballs representing their parties next to the names ; display "[player] VS [enemy]" text box with pokeballs representing their parties next to the names
DisplayLinkBattleVersusTextBox: DisplayLinkBattleVersusTextBox:
call LoadTextBoxTilePatterns call LoadTextBoxTilePatterns
coord hl, 3, 4 hlcoord 3, 4
ld b, 7 ld b, 7
ld c, 12 ld c, 12
call TextBoxBorder call TextBoxBorder
coord hl, 4, 5 hlcoord 4, 5
ld de, wPlayerName ld de, wPlayerName
call PlaceString call PlaceString
coord hl, 4, 10 hlcoord 4, 10
ld de, wLinkEnemyTrainerName ld de, wLinkEnemyTrainerName
call PlaceString call PlaceString
; place bold "VS" tiles between the names ; place bold "VS" tiles between the names
coord hl, 9, 8 hlcoord 9, 8
ld a, $69 ld a, $69
ld [hli], a ld [hli], a
ld [hl], $6a ld [hl], $6a
xor a xor a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
callab SetupPlayerAndEnemyPokeballs callfar SetupPlayerAndEnemyPokeballs
ld c, 150 ld c, 150
jp DelayFrames jp DelayFrames

View file

@ -1,7 +1,7 @@
ConversionEffect_: ConversionEffect_:
ld hl, wEnemyMonType1 ld hl, wEnemyMonType1
ld de, wBattleMonType1 ld de, wBattleMonType1
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, [wEnemyBattleStatus1] ld a, [wEnemyBattleStatus1]
jr z, .conversionEffect jr z, .conversionEffect

View file

@ -14,7 +14,7 @@ DrainHPEffect_:
.getAttackerHP .getAttackerHP
ld hl, wBattleMonHP ld hl, wBattleMonHP
ld de, wBattleMonMaxHP ld de, wBattleMonMaxHP
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jp z, .addDamageToAttackerHP jp z, .addDamageToAttackerHP
ld hl, wEnemyMonHP ld hl, wEnemyMonHP
@ -69,21 +69,21 @@ DrainHPEffect_:
ld [wHPBarNewHP+1], a ld [wHPBarNewHP+1], a
inc de inc de
.next .next
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
coord hl, 10, 9 hlcoord 10, 9
ld a, $1 ld a, $1
jr z, .next2 jr z, .next2
coord hl, 2, 2 hlcoord 2, 2
xor a xor a
.next2 .next2
ld [wHPBarType], a ld [wHPBarType], a
predef UpdateHPBar2 predef UpdateHPBar2
predef DrawPlayerHUDAndHPBar predef DrawPlayerHUDAndHPBar
predef DrawEnemyHUDAndHPBar predef DrawEnemyHUDAndHPBar
callab ReadPlayerMonCurHPAndStatus callfar ReadPlayerMonCurHPAndStatus
ld hl, SuckedHealthText ld hl, SuckedHealthText
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, [wPlayerMoveEffect] ld a, [wPlayerMoveEffect]
jr z, .next3 jr z, .next3

View file

@ -1,6 +1,6 @@
FocusEnergyEffect_: FocusEnergyEffect_:
ld hl, wPlayerBattleStatus2 ld hl, wPlayerBattleStatus2
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .notEnemy jr z, .notEnemy
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
@ -8,13 +8,13 @@ FocusEnergyEffect_:
bit GETTING_PUMPED, [hl] ; is mon already using focus energy? bit GETTING_PUMPED, [hl] ; is mon already using focus energy?
jr nz, .alreadyUsing jr nz, .alreadyUsing
set GETTING_PUMPED, [hl] ; mon is now using focus energy set GETTING_PUMPED, [hl] ; mon is now using focus energy
callab PlayCurrentMoveAnimation callfar PlayCurrentMoveAnimation
ld hl, GettingPumpedText ld hl, GettingPumpedText
jp PrintText jp PrintText
.alreadyUsing .alreadyUsing
ld c, 50 ld c, 50
call DelayFrames call DelayFrames
jpab PrintButItFailedText_ jpfar PrintButItFailedText_
GettingPumpedText: GettingPumpedText:
text_pause text_pause

View file

@ -15,7 +15,7 @@ HazeEffect_:
; cure non-volatile status, but only for the target ; cure non-volatile status, but only for the target
ld hl, wEnemyMonStatus ld hl, wEnemyMonStatus
ld de, wEnemySelectedMove ld de, wEnemySelectedMove
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .cureStatuses jr z, .cureStatuses
ld hl, wBattleMonStatus ld hl, wBattleMonStatus

View file

@ -1,5 +1,5 @@
HealEffect_: HealEffect_:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld de, wBattleMonHP ld de, wBattleMonHP
ld hl, wBattleMonMaxHP ld hl, wBattleMonMaxHP
@ -27,7 +27,7 @@ HealEffect_:
ld c, 50 ld c, 50
call DelayFrames call DelayFrames
ld hl, wBattleMonStatus ld hl, wBattleMonStatus
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .restEffect jr z, .restEffect
ld hl, wEnemyMonStatus ld hl, wEnemyMonStatus
@ -87,12 +87,12 @@ HealEffect_:
.playAnim .playAnim
ld hl, PlayCurrentMoveAnimation ld hl, PlayCurrentMoveAnimation
call BankswitchEtoF call BankswitchEtoF
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
coord hl, 10, 9 hlcoord 10, 9
ld a, $1 ld a, $1
jr z, .updateHPBar jr z, .updateHPBar
coord hl, 2, 2 hlcoord 2, 2
xor a xor a
.updateHPBar .updateHPBar
ld [wHPBarType], a ld [wHPBarType], a

View file

@ -1,11 +1,11 @@
LeechSeedEffect_: LeechSeedEffect_:
callab MoveHitTest callfar MoveHitTest
ld a, [wMoveMissed] ld a, [wMoveMissed]
and a and a
jr nz, .moveMissed jr nz, .moveMissed
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
ld de, wEnemyMonType1 ld de, wEnemyMonType1
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .leechSeedEffect jr z, .leechSeedEffect
ld hl, wPlayerBattleStatus2 ld hl, wPlayerBattleStatus2
@ -22,7 +22,7 @@ LeechSeedEffect_:
bit SEEDED, [hl] bit SEEDED, [hl]
jr nz, .moveMissed jr nz, .moveMissed
set SEEDED, [hl] set SEEDED, [hl]
callab PlayCurrentMoveAnimation callfar PlayCurrentMoveAnimation
ld hl, WasSeededText ld hl, WasSeededText
jp PrintText jp PrintText
.moveMissed .moveMissed

View file

@ -1,6 +1,6 @@
MistEffect_: MistEffect_:
ld hl, wPlayerBattleStatus2 ld hl, wPlayerBattleStatus2
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .mistEffect jr z, .mistEffect
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
@ -8,11 +8,11 @@ MistEffect_:
bit PROTECTED_BY_MIST, [hl] ; is mon protected by mist? bit PROTECTED_BY_MIST, [hl] ; is mon protected by mist?
jr nz, .mistAlreadyInUse jr nz, .mistAlreadyInUse
set PROTECTED_BY_MIST, [hl] ; mon is now protected by mist set PROTECTED_BY_MIST, [hl] ; mon is now protected by mist
callab PlayCurrentMoveAnimation callfar PlayCurrentMoveAnimation
ld hl, ShroudedInMistText ld hl, ShroudedInMistText
jp PrintText jp PrintText
.mistAlreadyInUse .mistAlreadyInUse
jpab PrintButItFailedText_ jpfar PrintButItFailedText_
ShroudedInMistText: ShroudedInMistText:
text_far _ShroudedInMistText text_far _ShroudedInMistText

View file

@ -7,7 +7,7 @@ OneHitKOEffect_:
ld [wCriticalHitOrOHKO], a ld [wCriticalHitOrOHKO], a
ld hl, wBattleMonSpeed + 1 ld hl, wBattleMonSpeed + 1
ld de, wEnemyMonSpeed + 1 ld de, wEnemyMonSpeed + 1
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .compareSpeed jr z, .compareSpeed
ld hl, wEnemyMonSpeed + 1 ld hl, wEnemyMonSpeed + 1

View file

@ -1,7 +1,7 @@
ParalyzeEffect_: ParalyzeEffect_:
ld hl, wEnemyMonStatus ld hl, wEnemyMonStatus
ld de, wPlayerMoveType ld de, wPlayerMoveType
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jp z, .next jp z, .next
ld hl, wBattleMonStatus ld hl, wBattleMonStatus
@ -26,22 +26,22 @@ ParalyzeEffect_:
jr z, .doesntAffect jr z, .doesntAffect
.hitTest .hitTest
push hl push hl
callab MoveHitTest callfar MoveHitTest
pop hl pop hl
ld a, [wMoveMissed] ld a, [wMoveMissed]
and a and a
jr nz, .didntAffect jr nz, .didntAffect
set PAR, [hl] set PAR, [hl]
callab QuarterSpeedDueToParalysis callfar QuarterSpeedDueToParalysis
ld c, 30 ld c, 30
call DelayFrames call DelayFrames
callab PlayCurrentMoveAnimation callfar PlayCurrentMoveAnimation
jpab PrintMayNotAttackText jpfar PrintMayNotAttackText
.didntAffect .didntAffect
ld c, 50 ld c, 50
call DelayFrames call DelayFrames
jpab PrintDidntAffectText jpfar PrintDidntAffectText
.doesntAffect .doesntAffect
ld c, 50 ld c, 50
call DelayFrames call DelayFrames
jpab PrintDoesntAffectText jpfar PrintDoesntAffectText

View file

@ -2,7 +2,7 @@ PayDayEffect_:
xor a xor a
ld hl, wcd6d ld hl, wcd6d
ld [hli], a ld [hli], a
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, [wBattleMonLevel] ld a, [wBattleMonLevel]
jr z, .payDayEffect jr z, .payDayEffect
@ -10,28 +10,28 @@ PayDayEffect_:
.payDayEffect .payDayEffect
; level * 2 ; level * 2
add a add a
ld [hDividend + 3], a ldh [hDividend + 3], a
xor a xor a
ld [hDividend], a ldh [hDividend], a
ld [hDividend + 1], a ldh [hDividend + 1], a
ld [hDividend + 2], a ldh [hDividend + 2], a
; convert to BCD ; convert to BCD
ld a, 100 ld a, 100
ld [hDivisor], a ldh [hDivisor], a
ld b, $4 ld b, $4
call Divide call Divide
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
ld [hli], a ld [hli], a
ld a, [hRemainder] ldh a, [hRemainder]
ld [hDividend + 3], a ldh [hDividend + 3], a
ld a, 10 ld a, 10
ld [hDivisor], a ldh [hDivisor], a
ld b, $4 ld b, $4
call Divide call Divide
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
swap a swap a
ld b, a ld b, a
ld a, [hRemainder] ldh a, [hRemainder]
add b add b
ld [hl], a ld [hl], a
ld de, wTotalPayDayMoney + 2 ld de, wTotalPayDayMoney + 2

View file

@ -1,5 +1,5 @@
RecoilEffect_: RecoilEffect_:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, [wPlayerMoveNum] ld a, [wPlayerMoveNum]
ld hl, wBattleMonMaxHP ld hl, wBattleMonMaxHP
@ -53,12 +53,12 @@ RecoilEffect_:
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
.getHPBarCoords .getHPBarCoords
coord hl, 10, 9 hlcoord 10, 9
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, $1 ld a, $1
jr z, .updateHPBar jr z, .updateHPBar
coord hl, 2, 2 hlcoord 2, 2
xor a xor a
.updateHPBar .updateHPBar
ld [wHPBarType], a ld [wHPBarType], a

View file

@ -1,7 +1,7 @@
ReflectLightScreenEffect_: ReflectLightScreenEffect_:
ld hl, wPlayerBattleStatus3 ld hl, wPlayerBattleStatus3
ld de, wPlayerMoveEffect ld de, wPlayerMoveEffect
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .reflectLightScreenEffect jr z, .reflectLightScreenEffect
ld hl, wEnemyBattleStatus3 ld hl, wEnemyBattleStatus3

View file

@ -4,7 +4,7 @@ SubstituteEffect_:
ld hl, wBattleMonMaxHP ld hl, wBattleMonMaxHP
ld de, wPlayerSubstituteHP ld de, wPlayerSubstituteHP
ld bc, wPlayerBattleStatus2 ld bc, wPlayerBattleStatus2
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .notEnemy jr z, .notEnemy
ld hl, wEnemyMonMaxHP ld hl, wEnemyMonMaxHP
@ -55,7 +55,7 @@ SubstituteEffect_:
call Bankswitch ; jump to routine depending on animation setting call Bankswitch ; jump to routine depending on animation setting
ld hl, SubstituteText ld hl, SubstituteText
call PrintText call PrintText
jpab DrawHUDsAndHPBars jpfar DrawHUDsAndHPBars
.alreadyHasSubstitute .alreadyHasSubstitute
ld hl, HasSubstituteText ld hl, HasSubstituteText
jr .printText jr .printText

View file

@ -3,7 +3,7 @@ TransformEffect_:
ld de, wEnemyMonSpecies ld de, wEnemyMonSpecies
ld bc, wEnemyBattleStatus3 ld bc, wEnemyBattleStatus3
ld a, [wEnemyBattleStatus1] ld a, [wEnemyBattleStatus1]
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr nz, .hitTest jr nz, .hitTest
ld hl, wEnemyMonSpecies ld hl, wEnemyMonSpecies
@ -18,7 +18,7 @@ TransformEffect_:
push de push de
push bc push bc
ld hl, wPlayerBattleStatus2 ld hl, wPlayerBattleStatus2
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .transformEffect jr z, .transformEffect
ld hl, wEnemyBattleStatus2 ld hl, wEnemyBattleStatus2
@ -64,7 +64,7 @@ TransformEffect_:
inc bc inc bc
inc bc inc bc
call CopyData call CopyData
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .next jr z, .next
; save enemy mon DVs at wTransformedEnemyMonOriginalDVs ; save enemy mon DVs at wTransformedEnemyMonOriginalDVs
@ -128,7 +128,7 @@ TransformEffect_:
jp PrintText jp PrintText
.copyBasedOnTurn .copyBasedOnTurn
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
jr z, .gotStatsOrModsToCopy jr z, .gotStatsOrModsToCopy
push hl push hl

View file

@ -41,16 +41,16 @@ ScaleFirstThreeSpriteColumnsByTwo:
ScaleLastSpriteColumnByTwo: ScaleLastSpriteColumnByTwo:
ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows
ld [hSpriteInterlaceCounter], a ldh [hSpriteInterlaceCounter], a
ld bc, -1 ld bc, -1
.columnInnerLoop .columnInnerLoop
ld a, [de] ld a, [de]
dec de dec de
swap a ; only high nybble contains information swap a ; only high nybble contains information
call ScalePixelsByTwo call ScalePixelsByTwo
ld a, [hSpriteInterlaceCounter] ldh a, [hSpriteInterlaceCounter]
dec a dec a
ld [hSpriteInterlaceCounter], a ldh [hSpriteInterlaceCounter], a
jr nz, .columnInnerLoop jr nz, .columnInnerLoop
dec de ; skip last 4 rows of new column dec de ; skip last 4 rows of new column
dec de dec de

View file

@ -5,8 +5,8 @@ _ScrollTrainerPicAfterBattle:
ld [wEnemyMonSpecies2], a ld [wEnemyMonSpecies2], a
ld b, SET_PAL_BATTLE ld b, SET_PAL_BATTLE
call RunPaletteCommand call RunPaletteCommand
callab _LoadTrainerPic callfar _LoadTrainerPic
coord hl, 19, 0 hlcoord 19, 0
ld c, $0 ld c, $0
.scrollLoop .scrollLoop
inc c inc c

View file

@ -204,7 +204,7 @@ AIMoveChoiceModification3:
push hl push hl
push bc push bc
push de push de
callab AIGetTypeEffectiveness callfar AIGetTypeEffectiveness
pop de pop de
pop bc pop bc
pop hl pop hl
@ -542,7 +542,7 @@ AIRecoverHP:
AIPrintItemUseAndUpdateHPBar: AIPrintItemUseAndUpdateHPBar:
call AIPrintItemUse_ call AIPrintItemUse_
coord hl, 2, 2 hlcoord 2, 2
xor a xor a
ld [wHPBarType], a ld [wHPBarType], a
predef UpdateHPBar2 predef UpdateHPBar2
@ -599,7 +599,7 @@ SwitchEnemyMon:
; switching in a new mon in response to this switch. ; switching in a new mon in response to this switch.
ld a, 1 ld a, 1
ld [wFirstMonsNotOutYet], a ld [wFirstMonsNotOutYet], a
callab EnemySendOut callfar EnemySendOut
xor a xor a
ld [wFirstMonsNotOutYet], a ld [wFirstMonsNotOutYet], a
@ -655,17 +655,17 @@ AIUseDireHit: ; unused
AICheckIfHPBelowFraction: AICheckIfHPBelowFraction:
; return carry if enemy trainer's current HP is below 1 / a of the maximum ; return carry if enemy trainer's current HP is below 1 / a of the maximum
ld [hDivisor], a ldh [hDivisor], a
ld hl, wEnemyMonMaxHP ld hl, wEnemyMonMaxHP
ld a, [hli] ld a, [hli]
ld [hDividend], a ldh [hDividend], a
ld a, [hl] ld a, [hl]
ld [hDividend + 1], a ldh [hDividend + 1], a
ld b, 2 ld b, 2
call Divide call Divide
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
ld c, a ld c, a
ld a, [hQuotient + 2] ldh a, [hQuotient + 2]
ld b, a ld b, a
ld hl, wEnemyMonHP + 1 ld hl, wEnemyMonHP + 1
ld a, [hld] ld a, [hld]
@ -713,7 +713,7 @@ AIIncreaseStat:
ld a, ANIM_AF ld a, ANIM_AF
ld [hli], a ld [hli], a
ld [hl], b ld [hl], b
callab StatModifierUpEffect callfar StatModifierUpEffect
pop hl pop hl
pop af pop af
ld [hli], a ld [hli], a

View file

@ -1,6 +1,6 @@
; does nothing since no stats are ever selected (barring glitches) ; does nothing since no stats are ever selected (barring glitches)
DoubleSelectedStats: DoubleSelectedStats:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, [wPlayerStatsToDouble] ld a, [wPlayerStatsToDouble]
ld hl, wBattleMonAttack + 1 ld hl, wBattleMonAttack + 1
@ -30,7 +30,7 @@ DoubleSelectedStats:
; does nothing since no stats are ever selected (barring glitches) ; does nothing since no stats are ever selected (barring glitches)
HalveSelectedStats: HalveSelectedStats:
ld a, [hWhoseTurn] ldh a, [hWhoseTurn]
and a and a
ld a, [wPlayerStatsToHalve] ld a, [wPlayerStatsToHalve]
ld hl, wBattleMonAttack ld hl, wBattleMonAttack

View file

@ -7,14 +7,14 @@ TryDoWildEncounter:
ld a, [wd736] ld a, [wd736]
and a and a
ret nz ret nz
callab IsPlayerStandingOnDoorTileOrWarpTile callfar IsPlayerStandingOnDoorTileOrWarpTile
jr nc, .notStandingOnDoorOrWarpTile jr nc, .notStandingOnDoorOrWarpTile
.CantEncounter .CantEncounter
ld a, $1 ld a, $1
and a and a
ret ret
.notStandingOnDoorOrWarpTile .notStandingOnDoorOrWarpTile
callab IsPlayerJustOutsideMap callfar IsPlayerJustOutsideMap
jr z, .CantEncounter jr z, .CantEncounter
ld a, [wRepelRemainingSteps] ld a, [wRepelRemainingSteps]
and a and a
@ -25,7 +25,7 @@ TryDoWildEncounter:
.next .next
; determine if wild pokemon can appear in the half-block we're standing in ; determine if wild pokemon can appear in the half-block we're standing in
; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile? ; is the bottom right tile (9,9) of the half-block we're standing in a grass/water tile?
coord hl, 9, 9 hlcoord 9, 9
ld c, [hl] ld c, [hl]
ld a, [wGrassTile] ld a, [wGrassTile]
cp c cp c
@ -48,10 +48,10 @@ TryDoWildEncounter:
.CanEncounter .CanEncounter
; compare encounter chance with a random number to determine if there will be an encounter ; compare encounter chance with a random number to determine if there will be an encounter
ld b, a ld b, a
ld a, [hRandomAdd] ldh a, [hRandomAdd]
cp b cp b
jr nc, .CantEncounter2 jr nc, .CantEncounter2
ld a, [hRandomSub] ldh a, [hRandomSub]
ld b, a ld b, a
ld hl, WildMonEncounterSlotChances ld hl, WildMonEncounterSlotChances
.determineEncounterSlot .determineEncounterSlot
@ -64,7 +64,7 @@ TryDoWildEncounter:
; determine which wild pokemon (grass or water) can appear in the half-block we're standing in ; determine which wild pokemon (grass or water) can appear in the half-block we're standing in
ld c, [hl] ld c, [hl]
ld hl, wGrassMons ld hl, wGrassMons
aCoord 8, 9 lda_coord 8, 9
cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile? cp $14 ; is the bottom left tile (8,9) of the half-block we're standing in a water tile?
jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default
ld hl, wWaterMons ld hl, wWaterMons
@ -90,7 +90,7 @@ TryDoWildEncounter:
.lastRepelStep .lastRepelStep
ld [wRepelRemainingSteps], a ld [wRepelRemainingSteps], a
ld a, TEXT_REPEL_WORE_OFF ld a, TEXT_REPEL_WORE_OFF
ld [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
call DisplayTextID call DisplayTextID
.CantEncounter2 .CantEncounter2

View file

@ -41,5 +41,5 @@ TestBattle:
; do it all again. ; do it all again.
ld a, 1 ld a, 1
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
jr .loop jr .loop

View file

@ -6,34 +6,34 @@ ResetStatusAndHalveMoneyOnBlackout::
ld [wIsInBattle], a ld [wIsInBattle], a
ld [wMapPalOffset], a ld [wMapPalOffset], a
ld [wNPCMovementScriptFunctionNum], a ld [wNPCMovementScriptFunctionNum], a
ld [hJoyHeld], a ldh [hJoyHeld], a
ld [wNPCMovementScriptPointerTableNum], a ld [wNPCMovementScriptPointerTableNum], a
ld [wFlags_0xcd60], a ld [wFlags_0xcd60], a
ld [hMoney], a ldh [hMoney], a
ld [hMoney + 1], a ldh [hMoney + 1], a
ld [hMoney + 2], a ldh [hMoney + 2], a
call HasEnoughMoney call HasEnoughMoney
jr c, .lostmoney ; never happens jr c, .lostmoney ; never happens
; Halve the player's money. ; Halve the player's money.
ld a, [wPlayerMoney] ld a, [wPlayerMoney]
ld [hMoney], a ldh [hMoney], a
ld a, [wPlayerMoney + 1] ld a, [wPlayerMoney + 1]
ld [hMoney + 1], a ldh [hMoney + 1], a
ld a, [wPlayerMoney + 2] ld a, [wPlayerMoney + 2]
ld [hMoney + 2], a ldh [hMoney + 2], a
xor a xor a
ld [hDivideBCDDivisor], a ldh [hDivideBCDDivisor], a
ld [hDivideBCDDivisor + 1], a ldh [hDivideBCDDivisor + 1], a
ld a, 2 ld a, 2
ld [hDivideBCDDivisor + 2], a ldh [hDivideBCDDivisor + 2], a
predef DivideBCDPredef3 predef DivideBCDPredef3
ld a, [hDivideBCDQuotient] ldh a, [hDivideBCDQuotient]
ld [wPlayerMoney], a ld [wPlayerMoney], a
ld a, [hDivideBCDQuotient + 1] ldh a, [hDivideBCDQuotient + 1]
ld [wPlayerMoney + 1], a ld [wPlayerMoney + 1], a
ld a, [hDivideBCDQuotient + 2] ldh a, [hDivideBCDQuotient + 2]
ld [wPlayerMoney + 2], a ld [wPlayerMoney + 2], a
.lostmoney .lostmoney

View file

@ -28,7 +28,7 @@ PrintCardKeyText:
call GetCoordsInFrontOfPlayer call GetCoordsInFrontOfPlayer
push de push de
tx_pre_id CardKeySuccessText tx_pre_id CardKeySuccessText
ld [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
call PrintPredefTextID call PrintPredefTextID
pop de pop de
srl d srl d
@ -55,7 +55,7 @@ PrintCardKeyText:
jp PlaySound jp PlaySound
.noCardKey .noCardKey
tx_pre_id CardKeyFailText tx_pre_id CardKeyFailText
ld [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
jp PrintPredefTextID jp PrintPredefTextID
SilphCoMapList: SilphCoMapList:

View file

@ -20,7 +20,7 @@ GiveFossilToCinnabarLab::
dec l dec l
ld b, l ld b, l
ld c, $d ld c, $d
coord hl, 0, 0 hlcoord 0, 0
call TextBoxBorder call TextBoxBorder
call UpdateSprites call UpdateSprites
call PrintFossilsInBag call PrintFossilsInBag
@ -35,7 +35,7 @@ GiveFossilToCinnabarLab::
ld e, a ld e, a
add hl, de add hl, de
ld a, [hl] ld a, [hl]
ld [hItemToRemoveID], a ldh [hItemToRemoveID], a
cp DOME_FOSSIL cp DOME_FOSSIL
jr z, .choseDomeFossil jr z, .choseDomeFossil
cp HELIX_FOSSIL cp HELIX_FOSSIL
@ -61,8 +61,8 @@ GiveFossilToCinnabarLab::
ld hl, LabFossil_610b3 ld hl, LabFossil_610b3
call PrintText call PrintText
ld a, [wFossilItem] ld a, [wFossilItem]
ld [hItemToRemoveID], a ldh [hItemToRemoveID], a
callba RemoveItemByID farcall RemoveItemByID
ld hl, LabFossil_610b8 ld hl, LabFossil_610b8
call PrintText call PrintText
SetEvents EVENT_GAVE_FOSSIL_TO_LAB, EVENT_LAB_STILL_REVIVING_FOSSIL SetEvents EVENT_GAVE_FOSSIL_TO_LAB, EVENT_LAB_STILL_REVIVING_FOSSIL
@ -92,7 +92,7 @@ PrintFossilsInBag:
; Prints each fossil in the player's bag on a separate line in the menu. ; Prints each fossil in the player's bag on a separate line in the menu.
ld hl, wFilteredBagItems ld hl, wFilteredBagItems
xor a xor a
ld [hItemCounter], a ldh [hItemCounter], a
.loop .loop
ld a, [hli] ld a, [hli]
cp $ff cp $ff
@ -100,8 +100,8 @@ PrintFossilsInBag:
push hl push hl
ld [wd11e], a ld [wd11e], a
call GetItemName call GetItemName
coord hl, 2, 2 hlcoord 2, 2
ld a, [hItemCounter] ldh a, [hItemCounter]
ld bc, SCREEN_WIDTH * 2 ld bc, SCREEN_WIDTH * 2
call AddNTimes call AddNTimes
ld de, wcd6d ld de, wcd6d

View file

@ -10,11 +10,11 @@ DisplayDiploma::
set 6, [hl] set 6, [hl]
call DisableLCD call DisableLCD
ld hl, CircleTile ld hl, CircleTile
ld de, vChars2 + CIRCLE_TILE_ID * $10 ld de, vChars2 tile CIRCLE_TILE_ID
ld bc, $10 ld bc, $10
ld a, BANK(CircleTile) ld a, BANK(CircleTile)
call FarCopyData2 call FarCopyData2
coord hl, 0, 0 hlcoord 0, 0
lb bc, 16, 18 lb bc, 16, 18
predef Diploma_TextBoxBorder predef Diploma_TextBoxBorder
ld hl, DiplomaTextPointersAndCoords ld hl, DiplomaTextPointersAndCoords
@ -35,10 +35,10 @@ DisplayDiploma::
pop bc pop bc
dec c dec c
jr nz, .asm_56715 jr nz, .asm_56715
coord hl, 10, 4 hlcoord 10, 4
ld de, wPlayerName ld de, wPlayerName
call PlaceString call PlaceString
callba DrawPlayerCharacter farcall DrawPlayerCharacter
; Move the player 33 pixels right and set the priority bit so he appears ; Move the player 33 pixels right and set the priority bit so he appears
; behind the background layer. ; behind the background layer.
@ -56,13 +56,13 @@ DisplayDiploma::
jr nz, .adjustPlayerGfxLoop jr nz, .adjustPlayerGfxLoop
call EnableLCD call EnableLCD
callba LoadTrainerInfoTextBoxTiles farcall LoadTrainerInfoTextBoxTiles
ld b, SET_PAL_GENERIC ld b, SET_PAL_GENERIC
call RunPaletteCommand call RunPaletteCommand
call Delay3 call Delay3
call GBPalNormal call GBPalNormal
ld a, $90 ld a, $90
ld [rOBP0], a ldh [rOBP0], a
call WaitForTextScrollButtonPress call WaitForTextScrollButtonPress
ld hl, wd730 ld hl, wd730
res 6, [hl] res 6, [hl]
@ -85,15 +85,15 @@ UnusedPlayerNameLengthFunc:
DiplomaTextPointersAndCoords: DiplomaTextPointersAndCoords:
dw DiplomaText dw DiplomaText
dwCoord 5, 2 dwcoord 5, 2
dw DiplomaPlayer dw DiplomaPlayer
dwCoord 3, 4 dwcoord 3, 4
dw DiplomaEmptyText dw DiplomaEmptyText
dwCoord 15, 4 dwcoord 15, 4
dw DiplomaCongrats dw DiplomaCongrats
dwCoord 2, 6 dwcoord 2, 6
dw DiplomaGameFreak dw DiplomaGameFreak
dwCoord 9, 16 dwcoord 9, 16
DiplomaText: DiplomaText:
db CIRCLE_TILE_ID, "Diploma", CIRCLE_TILE_ID, "@" db CIRCLE_TILE_ID, "Diploma", CIRCLE_TILE_ID, "@"

View file

@ -38,7 +38,7 @@ EvolveTradeMon:
ld [wForceEvolution], a ld [wForceEvolution], a
ld a, LINK_STATE_TRADING ld a, LINK_STATE_TRADING
ld [wLinkState], a ld [wLinkState], a
callab TryEvolvingMon callfar TryEvolvingMon
xor a ; LINK_STATE_NONE xor a ; LINK_STATE_NONE
ld [wLinkState], a ld [wLinkState], a
jp PlayDefaultMusic jp PlayDefaultMusic

View file

@ -15,9 +15,9 @@ _GivePokemon::
ld [wEnemyBattleStatus3], a ld [wEnemyBattleStatus3], a
ld a, [wcf91] ld a, [wcf91]
ld [wEnemyMonSpecies2], a ld [wEnemyMonSpecies2], a
callab LoadEnemyMonData callfar LoadEnemyMonData
call SetPokedexOwnedFlag call SetPokedexOwnedFlag
callab SendNewMonToBox callfar SendNewMonToBox
ld hl, wcf4b ld hl, wcf4b
ld a, [wCurrentBoxNum] ld a, [wCurrentBoxNum]
and $7f and $7f

View file

@ -67,9 +67,9 @@ HiddenCoins:
and a and a
ret nz ret nz
xor a xor a
ld [hUnusedCoinsByte], a ldh [hUnusedCoinsByte], a
ld [hCoins], a ldh [hCoins], a
ld [hCoins + 1], a ldh [hCoins + 1], a
ld a, [wHiddenObjectFunctionArgument] ld a, [wHiddenObjectFunctionArgument]
sub COIN sub COIN
cp 10 cp 10
@ -81,19 +81,19 @@ HiddenCoins:
jr .bcd100 jr .bcd100
.bcd10 .bcd10
ld a, $10 ld a, $10
ld [hCoins + 1], a ldh [hCoins + 1], a
jr .bcdDone jr .bcdDone
.bcd20 .bcd20
ld a, $20 ld a, $20
ld [hCoins + 1], a ldh [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 ldh [hCoins + 1], a
jr .bcdDone jr .bcdDone
.bcd100 .bcd100
ld a, $1 ld a, $1
ld [hCoins], a ldh [hCoins], a
.bcdDone .bcdDone
ld de, wPlayerCoins + 1 ld de, wPlayerCoins + 1
ld hl, hCoins + 1 ld hl, hCoins + 1

View file

@ -84,11 +84,11 @@ BillsHousePokemonList::
.billsPokemonLoop .billsPokemonLoop
ld hl, wd730 ld hl, wd730
set 6, [hl] set 6, [hl]
coord hl, 0, 0 hlcoord 0, 0
ld b, 10 ld b, 10
ld c, 9 ld c, 9
call TextBoxBorder call TextBoxBorder
coord hl, 2, 2 hlcoord 2, 2
ld de, BillsMonListText ld de, BillsMonListText
call PlaceString call PlaceString
ld hl, BillsHousePokemonListText2 ld hl, BillsHousePokemonListText2

View file

@ -4,7 +4,7 @@ BookOrSculptureText::
ld a, [wCurMapTileset] ld a, [wCurMapTileset]
cp MANSION ; Celadon Mansion tileset cp MANSION ; Celadon Mansion tileset
jr nz, .ok jr nz, .ok
aCoord 8, 6 lda_coord 8, 6
cp $38 cp $38
jr nz, .ok jr nz, .ok
ld hl, DiglettSculptureText ld hl, DiglettSculptureText

View file

@ -6,7 +6,7 @@ PrintBookshelfText::
; facing up ; facing up
ld a, [wCurMapTileset] ld a, [wCurMapTileset]
ld b, a ld b, a
aCoord 8, 7 lda_coord 8, 7
ld c, a ld c, a
ld hl, BookshelfTileIDs ld hl, BookshelfTileIDs
.loop .loop
@ -24,7 +24,7 @@ PrintBookshelfText::
pop af pop af
call PrintPredefTextID call PrintPredefTextID
xor a xor a
ld [hFFDB], a ldh [hFFDB], a
ret ret
.nextBookshelfEntry1 .nextBookshelfEntry1
inc hl inc hl
@ -33,7 +33,7 @@ PrintBookshelfText::
jr .loop jr .loop
.noMatch .noMatch
ld a, $ff ld a, $ff
ld [hFFDB], a ldh [hFFDB], a
jpba PrintCardKeyText farjp PrintCardKeyText
INCLUDE "data/tilesets/bookshelf_tile_ids.asm" INCLUDE "data/tilesets/bookshelf_tile_ids.asm"

View file

@ -12,14 +12,14 @@ CinnabarGymQuiz::
ld a, [wHiddenObjectFunctionArgument] ld a, [wHiddenObjectFunctionArgument]
push af push af
and $f and $f
ld [hGymGateIndex], a ldh [hGymGateIndex], a
pop af pop af
and $f0 and $f0
swap a swap a
ld [hGymGateAnswer], a ldh [hGymGateAnswer], a
ld hl, CinnabarGymQuizIntroText ld hl, CinnabarGymQuizIntroText
call PrintText call PrintText
ld a, [hGymGateIndex] ldh a, [hGymGateIndex]
dec a dec a
add a add a
ld d, 0 ld d, 0
@ -77,18 +77,18 @@ CinnabarGymGateFlagAction:
CinnabarGymQuiz_1ea92: CinnabarGymQuiz_1ea92:
call YesNoChoice call YesNoChoice
ld a, [hGymGateAnswer] ldh a, [hGymGateAnswer]
ld c, a ld c, a
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
cp c cp c
jr nz, .wrongAnswer jr nz, .wrongAnswer
ld hl, wCurrentMapScriptFlags ld hl, wCurrentMapScriptFlags
set 5, [hl] set 5, [hl]
ld a, [hGymGateIndex] ldh a, [hGymGateIndex]
ld [hBackupGymGateIndex], a ldh [hBackupGymGateIndex], a
ld hl, CinnabarGymQuizCorrectText ld hl, CinnabarGymQuizCorrectText
call PrintText call PrintText
ld a, [hBackupGymGateIndex] ldh a, [hBackupGymGateIndex]
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a ld c, a
ld b, FLAG_SET ld b, FLAG_SET
@ -101,7 +101,7 @@ CinnabarGymQuiz_1ea92:
call WaitForSoundToFinish call WaitForSoundToFinish
ld hl, CinnabarGymQuizIncorrectText ld hl, CinnabarGymQuizIncorrectText
call PrintText call PrintText
ld a, [hGymGateIndex] ldh a, [hGymGateIndex]
add $2 add $2
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2 AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
ld c, a ld c, a
@ -111,7 +111,7 @@ CinnabarGymQuiz_1ea92:
ld a, c ld a, c
and a and a
ret nz ret nz
ld a, [hGymGateIndex] ldh a, [hGymGateIndex]
add $2 add $2
ld [wOpponentAfterWrongAnswer], a ld [wOpponentAfterWrongAnswer], a
ret ret
@ -122,7 +122,7 @@ CinnabarGymQuizCorrectText:
text_promptbutton text_promptbutton
text_asm text_asm
ld a, [hBackupGymGateIndex] ldh a, [hBackupGymGateIndex]
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a ld c, a
ld b, FLAG_TEST ld b, FLAG_TEST
@ -144,9 +144,9 @@ UpdateCinnabarGymGateTileBlocks_::
; Update the overworld map with open floor blocks or locked gate blocks ; Update the overworld map with open floor blocks or locked gate blocks
; depending on event flags. ; depending on event flags.
ld a, 6 ld a, 6
ld [hGymGateIndex], a ldh [hGymGateIndex], a
.loop .loop
ld a, [hGymGateIndex] ldh a, [hGymGateIndex]
dec a dec a
add a add a
add a add a
@ -161,8 +161,8 @@ UpdateCinnabarGymGateTileBlocks_::
ld a, [hl] ld a, [hl]
ld [wGymGateTileBlock], a ld [wGymGateTileBlock], a
push bc push bc
ld a, [hGymGateIndex] ldh a, [hGymGateIndex]
ld [hBackupGymGateIndex], a ldh [hBackupGymGateIndex], a
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a ld c, a
ld b, FLAG_TEST ld b, FLAG_TEST

View file

@ -1,6 +1,6 @@
GymStatues: GymStatues:
; if in a gym and have the corresponding badge, a = GymStatueText2_id and jp PrintPredefTextID ; if in a gym and have the corresponding badge, a = GymStatueText2_id and jp PrintPredefTextID
; if in a gym and dont have the corresponding badge, a = GymStatueText1_id and jp PrintPredefTextID ; if in a gym and don't have the corresponding badge, a = GymStatueText1_id and jp PrintPredefTextID
; else ret ; else ret
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld a, [wSpritePlayerStateData1FacingDirection] ld a, [wSpritePlayerStateData1FacingDirection]

View file

@ -26,10 +26,10 @@ DisplayMonFrontSpriteInBox:
; Displays a pokemon's front sprite in a pop-up window. ; Displays a pokemon's front sprite in a pop-up window.
; [wcf91] = pokemon internal id number ; [wcf91] = pokemon internal id number
ld a, 1 ld a, 1
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
call Delay3 call Delay3
xor a xor a
ld [hWY], a ldh [hWY], a
call SaveScreenTilesToBuffer1 call SaveScreenTilesToBuffer1
ld a, MON_SPRITE_POPUP ld a, MON_SPRITE_POPUP
ld [wTextBoxID], a ld [wTextBoxID], a
@ -38,15 +38,15 @@ DisplayMonFrontSpriteInBox:
ld a, [wcf91] ld a, [wcf91]
ld [wd0b5], a ld [wd0b5], a
call GetMonHeader call GetMonHeader
ld de, vChars1 + $310 ld de, vChars1 tile $31
call LoadMonFrontSprite call LoadMonFrontSprite
ld a, $80 ld a, $80
ld [hStartTileID], a ldh [hStartTileID], a
coord hl, 10, 11 hlcoord 10, 11
predef AnimateSendingOutMon predef AnimateSendingOutMon
call WaitForTextScrollButtonPress call WaitForTextScrollButtonPress
call LoadScreenTilesFromBuffer1 call LoadScreenTilesFromBuffer1
call Delay3 call Delay3
ld a, $90 ld a, $90
ld [hWY], a ldh [hWY], a
ret ret

View file

@ -37,12 +37,12 @@ SafariZoneGameOver:
cp SFX_SAFARI_ZONE_PA cp SFX_SAFARI_ZONE_PA
jr nz, .waitForMusicToPlay jr nz, .waitForMusicToPlay
ld a, TEXT_SAFARI_GAME_OVER ld a, TEXT_SAFARI_GAME_OVER
ld [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
xor a xor a
ld [wPlayerMovingDirection], a ld [wPlayerMovingDirection], a
ld a, SAFARI_ZONE_GATE ld a, SAFARI_ZONE_GATE
ld [hWarpDestinationMap], a ldh [hWarpDestinationMap], a
ld a, $3 ld a, $3
ld [wDestinationWarpID], a ld [wDestinationWarpID], a
ld a, $5 ld a, $5

View file

@ -26,11 +26,11 @@ LinkCableHelp::
.linkHelpLoop .linkHelpLoop
ld hl, wd730 ld hl, wd730
set 6, [hl] set 6, [hl]
coord hl, 0, 0 hlcoord 0, 0
ld b, 8 ld b, 8
ld c, 13 ld c, 13
call TextBoxBorder call TextBoxBorder
coord hl, 2, 2 hlcoord 2, 2
ld de, HowToLinkText ld de, HowToLinkText
call PlaceString call PlaceString
ld hl, LinkCableHelpText2 ld hl, LinkCableHelpText2
@ -110,13 +110,13 @@ ViridianSchoolBlackboard::
.blackboardLoop .blackboardLoop
ld hl, wd730 ld hl, wd730
set 6, [hl] set 6, [hl]
coord hl, 0, 0 hlcoord 0, 0
lb bc, 6, 10 lb bc, 6, 10
call TextBoxBorder call TextBoxBorder
coord hl, 1, 2 hlcoord 1, 2
ld de, StatusAilmentText1 ld de, StatusAilmentText1
call PlaceString call PlaceString
coord hl, 6, 2 hlcoord 6, 2
ld de, StatusAilmentText2 ld de, StatusAilmentText2
call PlaceString call PlaceString
ld hl, ViridianSchoolBlackboardText2 ld hl, ViridianSchoolBlackboardText2

View file

@ -8,15 +8,15 @@ TownMapText::
set 6, [hl] set 6, [hl]
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
xor a xor a
ld [hWY], a ldh [hWY], a
inc a inc a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
call LoadFontTilePatterns call LoadFontTilePatterns
callba DisplayTownMap farcall DisplayTownMap
ld hl, wd730 ld hl, wd730
res 6, [hl] res 6, [hl]
ld de, TextScriptEnd ld de, TextScriptEnd
push de push de
ld a, [hLoadedROMBank] ldh a, [hLoadedROMBank]
push af push af
jp CloseTextDisplay jp CloseTextDisplay

View file

@ -56,12 +56,12 @@ GymTrashScript:
; first lock was in trash can 1 or 3. However, due to this bug, trash can 0 can ; first lock was in trash can 1 or 3. However, due to this bug, trash can 0 can
; have the second lock regardless of which trash can had the first lock. ; have the second lock regardless of which trash can had the first lock.
ld [hGymTrashCanRandNumMask], a ldh [hGymTrashCanRandNumMask], a
push hl push hl
call Random call Random
swap a swap a
ld b, a ld b, a
ld a, [hGymTrashCanRandNumMask] ldh a, [hGymTrashCanRandNumMask]
and b and b
dec a dec a
pop hl pop hl

View file

@ -137,10 +137,10 @@ InGameTrade_DoTrade:
ld [wMonDataLocation], a ld [wMonDataLocation], a
call AddPartyMon call AddPartyMon
call InGameTrade_CopyDataToReceivedMon call InGameTrade_CopyDataToReceivedMon
callab EvolveTradeMon callfar EvolveTradeMon
call ClearScreen call ClearScreen
call InGameTrade_RestoreScreen call InGameTrade_RestoreScreen
callba RedrawMapView farcall RedrawMapView
and a and a
ld a, $3 ld a, $3
jr .tradeSucceeded jr .tradeSucceeded
@ -159,7 +159,7 @@ InGameTrade_RestoreScreen:
call LoadGBPal call LoadGBPal
ld c, 10 ld c, 10
call DelayFrames call DelayFrames
jpba LoadWildData farjp LoadWildData
InGameTrade_PrepareTradeData: InGameTrade_PrepareTradeData:
ld hl, wTradedPlayerMonSpecies ld hl, wTradedPlayerMonSpecies

View file

@ -9,16 +9,16 @@ OaksAideScript:
ld b, wPokedexOwnedEnd - wPokedexOwned ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits call CountSetBits
ld a, [wNumSetBits] ld a, [wNumSetBits]
ld [hOaksAideNumMonsOwned], a ldh [hOaksAideNumMonsOwned], a
ld b, a ld b, a
ld a, [hOaksAideRequirement] ldh a, [hOaksAideRequirement]
cp b cp b
jr z, .giveItem jr z, .giveItem
jr nc, .notEnoughOwnedMons jr nc, .notEnoughOwnedMons
.giveItem .giveItem
ld hl, OaksAideHereYouGoText ld hl, OaksAideHereYouGoText
call PrintText call PrintText
ld a, [hOaksAideRewardItem] ldh a, [hOaksAideRewardItem]
ld b, a ld b, a
ld c, 1 ld c, 1
call GiveItem call GiveItem
@ -42,7 +42,7 @@ OaksAideScript:
call PrintText call PrintText
ld a, $ff ld a, $ff
.done .done
ld [hOaksAideResult], a ldh [hOaksAideResult], a
ret ret
OaksAideHiText: OaksAideHiText:

View file

@ -1,7 +1,7 @@
PickUpItem: PickUpItem:
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld a, [hSpriteIndexOrTextID] ldh a, [hSpriteIndexOrTextID]
ld b, a ld b, a
ld hl, wMissableObjectList ld hl, wMissableObjectList
.missableObjectsListLoop .missableObjectsListLoop
@ -15,10 +15,10 @@ PickUpItem:
.isMissable .isMissable
ld a, [hl] ld a, [hl]
ld [hMissableObjectIndex], a ldh [hMissableObjectIndex], a
ld hl, wMapSpriteExtraData ld hl, wMapSpriteExtraData
ld a, [hSpriteIndexOrTextID] ldh a, [hSpriteIndexOrTextID]
dec a dec a
add a add a
ld d, 0 ld d, 0
@ -30,7 +30,7 @@ PickUpItem:
call GiveItem call GiveItem
jr nc, .BagFull jr nc, .BagFull
ld a, [hMissableObjectIndex] ldh a, [hMissableObjectIndex]
ld [wMissableObjectIndex], a ld [wMissableObjectIndex], a
predef HideObject predef HideObject
ld a, 1 ld a, 1

View file

@ -52,7 +52,7 @@ ApplyOutOfBattlePoisonDamage:
ld [wJoyIgnore], a ld [wJoyIgnore], a
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld a, TEXT_MON_FAINTED ld a, TEXT_MON_FAINTED
ld [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
pop de pop de
pop hl pop hl
@ -99,7 +99,7 @@ ApplyOutOfBattlePoisonDamage:
jr nz, .noBlackOut jr nz, .noBlackOut
call EnableAutoTextBoxDrawing call EnableAutoTextBoxDrawing
ld a, TEXT_BLACKED_OUT ld a, TEXT_BLACKED_OUT
ld [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
call DisplayTextID call DisplayTextID
ld hl, wd72e ld hl, wd72e
set 5, [hl] set 5, [hl]

View file

@ -22,7 +22,7 @@ DisplayPokemonCenterDialogue_::
ld [wSprite01StateData1ImageIndex], a ; make the nurse turn to face the machine ld [wSprite01StateData1ImageIndex], a ; make the nurse turn to face the machine
call Delay3 call Delay3
predef HealParty predef HealParty
callba AnimateHealingMachine ; do the healing machine animation farcall AnimateHealingMachine ; do the healing machine animation
xor a xor a
ld [wAudioFadeOutControl], a ld [wAudioFadeOutControl], a
ld a, [wAudioSavedROMBank] ld a, [wAudioSavedROMBank]

View file

@ -3,17 +3,17 @@ DisplayDexRating:
ld b, wPokedexSeenEnd - wPokedexSeen ld b, wPokedexSeenEnd - wPokedexSeen
call CountSetBits call CountSetBits
ld a, [wNumSetBits] ld a, [wNumSetBits]
ld [hDexRatingNumMonsSeen], a ldh [hDexRatingNumMonsSeen], a
ld hl, wPokedexOwned ld hl, wPokedexOwned
ld b, wPokedexOwnedEnd - wPokedexOwned ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits call CountSetBits
ld a, [wNumSetBits] ld a, [wNumSetBits]
ld [hDexRatingNumMonsOwned], a ldh [hDexRatingNumMonsOwned], a
ld hl, DexRatingsTable ld hl, DexRatingsTable
.findRating .findRating
ld a, [hli] ld a, [hli]
ld b, a ld b, a
ld a, [hDexRatingNumMonsOwned] ldh a, [hDexRatingNumMonsOwned]
cp b cp b
jr c, .foundRating jr c, .foundRating
inc hl inc hl
@ -30,14 +30,14 @@ DisplayDexRating:
call PrintText call PrintText
pop hl pop hl
call PrintText call PrintText
callba PlayPokedexRatingSfx farcall PlayPokedexRatingSfx
jp WaitForTextScrollButtonPress jp WaitForTextScrollButtonPress
.hallOfFame .hallOfFame
ld de, wDexRatingNumMonsSeen ld de, wDexRatingNumMonsSeen
ld a, [hDexRatingNumMonsSeen] ldh a, [hDexRatingNumMonsSeen]
ld [de], a ld [de], a
inc de inc de
ld a, [hDexRatingNumMonsOwned] ldh a, [hDexRatingNumMonsOwned]
ld [de], a ld [de], a
inc de inc de
.copyRatingTextLoop .copyRatingTextLoop

View file

@ -42,7 +42,7 @@ DisplayPokemartDialogue_::
ld [wPrintItemPrices], a ld [wPrintItemPrices], a
ld a, INIT_BAG_ITEM_LIST ld a, INIT_BAG_ITEM_LIST
ld [wInitListType], a ld [wInitListType], a
callab InitList callfar InitList
ld a, [wNumBagItems] ld a, [wNumBagItems]
and a and a
@ -77,14 +77,14 @@ DisplayPokemartDialogue_::
jr c, .unsellableItem jr c, .unsellableItem
ld a, PRICEDITEMLISTMENU ld a, PRICEDITEMLISTMENU
ld [wListMenuID], a ld [wListMenuID], a
ld [hHalveItemPrices], a ; halve prices when selling ldh [hHalveItemPrices], a ; halve prices when selling
call DisplayChooseQuantityMenu call DisplayChooseQuantityMenu
inc a inc a
jr z, .sellMenuLoop ; if the player closed the choose quantity menu with the B button jr z, .sellMenuLoop ; if the player closed the choose quantity menu with the B button
ld hl, PokemartTellSellPriceText ld hl, PokemartTellSellPriceText
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 hlcoord 14, 7
lb bc, 8, 15 lb bc, 8, 15
ld a, TWO_OPTION_MENU ld a, TWO_OPTION_MENU
ld [wTextBoxID], a ld [wTextBoxID], a
@ -126,7 +126,7 @@ DisplayPokemartDialogue_::
ld [wPrintItemPrices], a ld [wPrintItemPrices], a
ld a, INIT_OTHER_ITEM_LIST ld a, INIT_OTHER_ITEM_LIST
ld [wInitListType], a ld [wInitListType], a
callab InitList callfar InitList
ld hl, PokemartBuyingGreetingText ld hl, PokemartBuyingGreetingText
call PrintText call PrintText
@ -152,7 +152,7 @@ DisplayPokemartDialogue_::
ld a, 99 ld a, 99
ld [wMaxItemQuantity], a ld [wMaxItemQuantity], a
xor a xor a
ld [hHalveItemPrices], a ; don't halve item prices when buying ldh [hHalveItemPrices], a ; don't halve item prices when buying
call DisplayChooseQuantityMenu call DisplayChooseQuantityMenu
inc a inc a
jr z, .buyMenuLoop ; if the player closed the choose quantity menu with the B button jr z, .buyMenuLoop ; if the player closed the choose quantity menu with the B button
@ -162,7 +162,7 @@ DisplayPokemartDialogue_::
call CopyStringToCF4B ; copy name to wcf4b call CopyStringToCF4B ; copy name to wcf4b
ld hl, PokemartTellBuyPriceText ld hl, PokemartTellBuyPriceText
call PrintText call PrintText
coord hl, 14, 7 hlcoord 14, 7
lb bc, 8, 15 lb bc, 8, 15
ld a, TWO_OPTION_MENU ld a, TWO_OPTION_MENU
ld [wTextBoxID], a ld [wTextBoxID], a

View file

@ -22,7 +22,7 @@ CeladonPrizeMenu::
ld a, $01 ld a, $01
ld [wTopMenuItemX], a ld [wTopMenuItemX], a
call PrintPrizePrice call PrintPrizePrice
coord hl, 0, 2 hlcoord 0, 2
ld b, 8 ld b, 8
ld c, 16 ld c, 16
call TextBoxBorder call TextBoxBorder
@ -64,7 +64,7 @@ GetPrizeMenuId:
; display the three prizes' names ; display the three prizes' names
; (distinguishing between Pokemon names ; (distinguishing between Pokemon names
; and Items (specifically TMs) names) ; and Items (specifically TMs) names)
ld a, [hSpriteIndexOrTextID] ldh a, [hSpriteIndexOrTextID]
sub 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
@ -93,71 +93,71 @@ GetPrizeMenuId:
ld a, [wPrize1] ld a, [wPrize1]
ld [wd11e], a ld [wd11e], a
call GetItemName call GetItemName
coord hl, 2, 4 hlcoord 2, 4
call PlaceString call PlaceString
ld a, [wPrize2] ld a, [wPrize2]
ld [wd11e], a ld [wd11e], a
call GetItemName call GetItemName
coord hl, 2, 6 hlcoord 2, 6
call PlaceString call PlaceString
ld a, [wPrize3] ld a, [wPrize3]
ld [wd11e], a ld [wd11e], a
call GetItemName call GetItemName
coord hl, 2, 8 hlcoord 2, 8
call PlaceString call PlaceString
jr .putNoThanksText jr .putNoThanksText
.putMonName .putMonName
ld a, [wPrize1] ld a, [wPrize1]
ld [wd11e], a ld [wd11e], a
call GetMonName call GetMonName
coord hl, 2, 4 hlcoord 2, 4
call PlaceString call PlaceString
ld a, [wPrize2] ld a, [wPrize2]
ld [wd11e], a ld [wd11e], a
call GetMonName call GetMonName
coord hl, 2, 6 hlcoord 2, 6
call PlaceString call PlaceString
ld a, [wPrize3] ld a, [wPrize3]
ld [wd11e], a ld [wd11e], a
call GetMonName call GetMonName
coord hl, 2, 8 hlcoord 2, 8
call PlaceString call PlaceString
.putNoThanksText .putNoThanksText
coord hl, 2, 10 hlcoord 2, 10
ld de, NoThanksText ld de, NoThanksText
call PlaceString call PlaceString
; put prices on the right side of the textbox ; put prices on the right side of the textbox
ld de, wPrize1Price ld de, wPrize1Price
coord hl, 13, 5 hlcoord 13, 5
; reg. c: ; reg. c:
; [low nybble] number of bytes ; [low nybble] number of bytes
; [bits 765 = %100] space-padding (not zero-padding) ; [bits 765 = %100] space-padding (not zero-padding)
ld c, (1 << 7 | 2) ld c, (1 << 7 | 2)
call PrintBCDNumber call PrintBCDNumber
ld de, wPrize2Price ld de, wPrize2Price
coord hl, 13, 7 hlcoord 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 hlcoord 13, 9
ld c, (1 << 7 | 2) ld c, (1 << 7 | 2)
jp PrintBCDNumber jp PrintBCDNumber
INCLUDE "data/events/prizes.asm" INCLUDE "data/events/prizes.asm"
PrintPrizePrice: PrintPrizePrice:
coord hl, 11, 0 hlcoord 11, 0
ld b, 1 ld b, 1
ld c, 7 ld c, 7
call TextBoxBorder call TextBoxBorder
call UpdateSprites call UpdateSprites
coord hl, 12, 0 hlcoord 12, 0
ld de, .CoinString ld de, .CoinString
call PlaceString call PlaceString
coord hl, 13, 1 hlcoord 13, 1
ld de, .SixSpacesString ld de, .SixSpacesString
call PlaceString call PlaceString
coord hl, 13, 1 hlcoord 13, 1
ld de, wPlayerCoins ld de, wPlayerCoins
ld c, %10000010 ld c, %10000010
call PrintBCDNumber call PrintBCDNumber
@ -177,11 +177,11 @@ LoadCoinsToSubtract:
ld hl, wPrize1Price ld hl, wPrize1Price
add hl, de ; get selected prize's price add hl, de ; get selected prize's price
xor a xor a
ld [hUnusedCoinsByte], a ldh [hUnusedCoinsByte], a
ld a, [hli] ld a, [hli]
ld [hCoins], a ldh [hCoins], a
ld a, [hl] ld a, [hl]
ld [hCoins + 1], a ldh [hCoins + 1], a
ret ret
HandlePrizeChoice: HandlePrizeChoice:

View file

@ -2,7 +2,7 @@ RemoveGuardDrink::
ld hl, GuardDrinksList ld hl, GuardDrinksList
.drinkLoop .drinkLoop
ld a, [hli] ld a, [hli]
ld [hItemToRemoveID], a ldh [hItemToRemoveID], a
and a and a
ret z ret z
push hl push hl
@ -10,6 +10,6 @@ RemoveGuardDrink::
call IsItemInBag call IsItemInBag
pop hl pop hl
jr z, .drinkLoop jr z, .drinkLoop
jpba RemoveItemByID farjp RemoveItemByID
INCLUDE "data/items/guard_drink_items.asm" INCLUDE "data/items/guard_drink_items.asm"

View file

@ -1,9 +1,9 @@
; this function temporarily makes the starters (and Ivysaur) seen ; this function temporarily makes the starters (and Ivysaur) seen
; so that the full Pokedex information gets displayed in Oak's lab ; so that the full Pokedex information gets displayed in Oak's lab
StarterDex: StarterDex:
ld a, %01001011 ; set starter flags ld a, 1 << (DEX_BULBASAUR - 1) | 1 << (DEX_IVYSAUR - 1) | 1 << (DEX_CHARMANDER - 1) | 1 << (DEX_SQUIRTLE - 1)
ld [wPokedexOwned], a ld [wPokedexOwned], a
predef ShowPokedexData predef ShowPokedexData
xor a ; unset starter flags xor a
ld [wPokedexOwned], a ld [wPokedexOwned], a
ret ret

View file

@ -17,15 +17,15 @@ VendingMachineMenu::
ld [wTopMenuItemX], a ld [wTopMenuItemX], a
ld hl, wd730 ld hl, wd730
set 6, [hl] set 6, [hl]
coord hl, 0, 3 hlcoord 0, 3
ld b, 8 ld b, 8
ld c, 12 ld c, 12
call TextBoxBorder call TextBoxBorder
call UpdateSprites call UpdateSprites
coord hl, 2, 5 hlcoord 2, 5
ld de, DrinkText ld de, DrinkText
call PlaceString call PlaceString
coord hl, 9, 6 hlcoord 9, 6
ld de, DrinkPriceText ld de, DrinkPriceText
call PlaceString call PlaceString
ld hl, wd730 ld hl, wd730
@ -37,17 +37,17 @@ VendingMachineMenu::
cp 3 ; chose Cancel? cp 3 ; chose Cancel?
jr z, .notThirsty jr z, .notThirsty
xor a xor a
ld [hMoney], a ldh [hMoney], a
ld [hMoney + 2], a ldh [hMoney + 2], a
ld a, $2 ld a, $2
ld [hMoney + 1], a ldh [hMoney + 1], a
call HasEnoughMoney call HasEnoughMoney
jr nc, .enoughMoney jr nc, .enoughMoney
ld hl, VendingMachineText4 ld hl, VendingMachineText4
jp PrintText jp PrintText
.enoughMoney .enoughMoney
call LoadVendingMachineItem call LoadVendingMachineItem
ld a, [hVendingMachineItem] ldh a, [hVendingMachineItem]
ld b, a ld b, a
ld c, 1 ld c, 1
call GiveItem call GiveItem
@ -121,13 +121,13 @@ LoadVendingMachineItem:
ld e, a ld e, a
add hl, de add hl, de
ld a, [hli] ld a, [hli]
ld [hVendingMachineItem], a ldh [hVendingMachineItem], a
ld a, [hli] ld a, [hli]
ld [hVendingMachinePrice], a ldh [hVendingMachinePrice], a
ld a, [hli] ld a, [hli]
ld [hVendingMachinePrice + 1], a ldh [hVendingMachinePrice + 1], a
ld a, [hl] ld a, [hl]
ld [hVendingMachinePrice + 2], a ldh [hVendingMachinePrice + 2], a
ret ret
INCLUDE "data/items/vending_prices.asm" INCLUDE "data/items/vending_prices.asm"

View file

@ -21,22 +21,22 @@ GetHPBarLength:
rr e rr e
srl d srl d
rr e rr e
ld a, [hMultiplicand+1] ldh a, [hMultiplicand+1]
ld b, a ld b, a
ld a, [hMultiplicand+2] ldh a, [hMultiplicand+2]
srl b ; divide multiplication result as well srl b ; divide multiplication result as well
rr a rr a
srl b srl b
rr a rr a
ld [hMultiplicand+2], a ldh [hMultiplicand+2], a
ld a, b ld a, b
ld [hMultiplicand+1], a ldh [hMultiplicand+1], a
.maxHPSmaller256 .maxHPSmaller256
ld a, e ld a, e
ld [hDivisor], a ldh [hDivisor], a
ld b, $4 ld b, $4
call Divide call Divide
ld a, [hMultiplicand+2] ldh a, [hMultiplicand+2]
ld e, a ; e = bc * 48 / de (num of pixels of HP bar) ld e, a ; e = bc * 48 / de (num of pixels of HP bar)
pop hl pop hl
and a and a
@ -213,7 +213,7 @@ UpdateHPBar_PrintHPNumber:
ld a, [wHPBarOldHP + 1] ld a, [wHPBarOldHP + 1]
ld [wHPBarTempHP], a ld [wHPBarTempHP], a
push hl push hl
ld a, [hFlagsFFF6] ldh a, [hFlagsFFF6]
bit 0, a bit 0, a
jr z, .asm_fb15 jr z, .asm_fb15
ld de, $9 ld de, $9

View file

@ -2,10 +2,10 @@
LoadPokedexTilePatterns: LoadPokedexTilePatterns:
call LoadHpBarAndStatusTilePatterns call LoadHpBarAndStatusTilePatterns
ld de, PokedexTileGraphics ld de, PokedexTileGraphics
ld hl, vChars2 + $600 ld hl, vChars2 tile $60
lb bc, BANK(PokedexTileGraphics), (PokedexTileGraphicsEnd - PokedexTileGraphics) / $10 lb bc, BANK(PokedexTileGraphics), (PokedexTileGraphicsEnd - PokedexTileGraphics) / $10
call CopyVideoData call CopyVideoData
ld de, PokeballTileGraphics ld de, PokeballTileGraphics
ld hl, vChars2 + $720 ld hl, vChars2 tile $72
lb bc, BANK(PokeballTileGraphics), $01 lb bc, BANK(PokeballTileGraphics), 1
jp CopyVideoData ; load pokeball tile for marking caught mons jp CopyVideoData ; load pokeball tile for marking caught mons

View file

@ -169,7 +169,7 @@ WriteMonPartySpriteOAMByPartyIndex:
push hl push hl
push de push de
push bc push bc
ld a, [hPartyMonIndex] ldh a, [hPartyMonIndex]
ld hl, wPartySpecies ld hl, wPartySpecies
ld e, a ld e, a
ld d, 0 ld d, 0
@ -187,7 +187,7 @@ WriteMonPartySpriteOAMBySpecies:
; Write OAM blocks for the party sprite of the species in ; Write OAM blocks for the party sprite of the species in
; [wMonPartySpriteSpecies]. ; [wMonPartySpriteSpecies].
xor a xor a
ld [hPartyMonIndex], a ldh [hPartyMonIndex], a
ld a, [wMonPartySpriteSpecies] ld a, [wMonPartySpriteSpecies]
call GetPartyMonSpriteID call GetPartyMonSpriteID
ld [wOAMBaseTile], a ld [wOAMBaseTile], a
@ -201,11 +201,11 @@ UnusedPartyMonSpriteFunction:
ld a, [wcf91] ld a, [wcf91]
call GetPartyMonSpriteID call GetPartyMonSpriteID
push af push af
ld hl, vSprites ld hl, vSprites tile $00
call .LoadTilePatterns call .LoadTilePatterns
pop af pop af
add $54 add $54
ld hl, vSprites + $40 ld hl, vSprites tile $04
call .LoadTilePatterns call .LoadTilePatterns
xor a xor a
ld [wMonPartySpriteSpecies], a ld [wMonPartySpriteSpecies], a
@ -236,8 +236,8 @@ WriteMonPartySpriteOAM:
; make a copy at wMonPartySpritesSavedOAM. ; make a copy at wMonPartySpritesSavedOAM.
push af push af
ld c, $10 ld c, $10
ld h, wOAMBuffer / $100 ld h, HIGH(wOAMBuffer)
ld a, [hPartyMonIndex] ldh a, [hPartyMonIndex]
swap a swap a
ld l, a ld l, a
add $10 add $10

View file

@ -1,7 +1,7 @@
WriteDMACodeToHRAM:: WriteDMACodeToHRAM::
; Since no other memory is available during OAM DMA, ; Since no other memory is available during OAM DMA,
; DMARoutine is copied to HRAM and executed there. ; DMARoutine is copied to HRAM and executed there.
ld c, hDMARoutine % $100 ld c, LOW(hDMARoutine)
ld b, DMARoutineEnd - DMARoutine ld b, DMARoutineEnd - DMARoutine
ld hl, DMARoutine ld hl, DMARoutine
.copy .copy
@ -14,8 +14,8 @@ WriteDMACodeToHRAM::
DMARoutine: DMARoutine:
; initiate DMA ; initiate DMA
ld a, wOAMBuffer / $100 ld a, HIGH(wOAMBuffer)
ld [rDMA], a ldh [rDMA], a
; wait for DMA to finish ; wait for DMA to finish
ld a, $28 ld a, $28

View file

@ -335,13 +335,13 @@ SendSGBPacket:
push bc push bc
; disable ReadJoypad to prevent it from interfering with sending the packet ; disable ReadJoypad to prevent it from interfering with sending the packet
ld a, 1 ld a, 1
ld [hDisableJoypadPolling], a ldh [hDisableJoypadPolling], a
; send RESET signal (P14=LOW, P15=LOW) ; send RESET signal (P14=LOW, P15=LOW)
xor a xor a
ld [rJOYP], a ldh [rJOYP], a
; set P14=HIGH, P15=HIGH ; set P14=HIGH, P15=HIGH
ld a, $30 ld a, $30
ld [rJOYP], a ldh [rJOYP], a
;load length of packets (16 bytes) ;load length of packets (16 bytes)
ld b, $10 ld b, $10
.nextByte .nextByte
@ -358,10 +358,10 @@ SendSGBPacket:
; else (if 0th bit is zero) set P14=LOW,P15=HIGH (send bit 0) ; else (if 0th bit is zero) set P14=LOW,P15=HIGH (send bit 0)
ld a, $20 ld a, $20
.next0 .next0
ld [rJOYP], a ldh [rJOYP], a
; must set P14=HIGH,P15=HIGH between each "pulse" ; must set P14=HIGH,P15=HIGH between each "pulse"
ld a, $30 ld a, $30
ld [rJOYP], a ldh [rJOYP], a
; rotation will put next bit in 0th position (so we can always use command ; rotation will put next bit in 0th position (so we can always use command
; "bit 0,d" to fetch the bit that has to be sent) ; "bit 0,d" to fetch the bit that has to be sent)
rr d rr d
@ -372,12 +372,12 @@ SendSGBPacket:
jr nz, .nextByte jr nz, .nextByte
; send bit 1 as a "stop bit" (end of parameter data) ; send bit 1 as a "stop bit" (end of parameter data)
ld a, $20 ld a, $20
ld [rJOYP], a ldh [rJOYP], a
; set P14=HIGH,P15=HIGH ; set P14=HIGH,P15=HIGH
ld a, $30 ld a, $30
ld [rJOYP], a ldh [rJOYP], a
xor a xor a
ld [hDisableJoypadPolling], a ldh [hDisableJoypadPolling], a
; wait for about 70000 cycles ; wait for about 70000 cycles
call Wait7000 call Wait7000
; restore (previously pushed) number of packets ; restore (previously pushed) number of packets
@ -457,41 +457,41 @@ CheckSGB:
di di
call SendSGBPacket call SendSGBPacket
ld a, 1 ld a, 1
ld [hDisableJoypadPolling], a ldh [hDisableJoypadPolling], a
ei ei
call Wait7000 call Wait7000
ld a, [rJOYP] ldh a, [rJOYP]
and $3 and $3
cp $3 cp $3
jr nz, .isSGB jr nz, .isSGB
ld a, $20 ld a, $20
ld [rJOYP], a ldh [rJOYP], a
ld a, [rJOYP] ldh a, [rJOYP]
ld a, [rJOYP] ldh a, [rJOYP]
call Wait7000 call Wait7000
call Wait7000 call Wait7000
ld a, $30 ld a, $30
ld [rJOYP], a ldh [rJOYP], a
call Wait7000 call Wait7000
call Wait7000 call Wait7000
ld a, $10 ld a, $10
ld [rJOYP], a ldh [rJOYP], a
ld a, [rJOYP] ldh a, [rJOYP]
ld a, [rJOYP] ldh a, [rJOYP]
ld a, [rJOYP] ldh a, [rJOYP]
ld a, [rJOYP] ldh a, [rJOYP]
ld a, [rJOYP] ldh a, [rJOYP]
ld a, [rJOYP] ldh a, [rJOYP]
call Wait7000 call Wait7000
call Wait7000 call Wait7000
ld a, $30 ld a, $30
ld [rJOYP], a ldh [rJOYP], a
ld a, [rJOYP] ldh a, [rJOYP]
ld a, [rJOYP] ldh a, [rJOYP]
ld a, [rJOYP] ldh a, [rJOYP]
call Wait7000 call Wait7000
call Wait7000 call Wait7000
ld a, [rJOYP] ldh a, [rJOYP]
and $3 and $3
cp $3 cp $3
jr nz, .isSGB jr nz, .isSGB
@ -513,7 +513,7 @@ CopyGfxToSuperNintendoVRAM:
push de push de
call DisableLCD call DisableLCD
ld a, $e4 ld a, $e4
ld [rBGP], a ldh [rBGP], a
ld de, vChars1 ld de, vChars1
ld a, [wCopyingSGBTileData] ld a, [wCopyingSGBTileData]
and a and a
@ -539,11 +539,11 @@ CopyGfxToSuperNintendoVRAM:
dec c dec c
jr nz, .loop jr nz, .loop
ld a, $e3 ld a, $e3
ld [rLCDC], a ldh [rLCDC], a
pop hl pop hl
call SendSGBPacket call SendSGBPacket
xor a xor a
ld [rBGP], a ldh [rBGP], a
ei ei
ret ret
@ -577,7 +577,7 @@ SendSGBPackets:
InitGBCPalettes: InitGBCPalettes:
ld a, $80 ; index 0 with auto-increment ld a, $80 ; index 0 with auto-increment
ld [rBGPI], a ldh [rBGPI], a
inc hl inc hl
ld c, $20 ld c, $20
.loop .loop
@ -592,7 +592,7 @@ InitGBCPalettes:
inc d inc d
.noCarry .noCarry
ld a, [de] ld a, [de]
ld [rBGPD], a ldh [rBGPD], a
dec c dec c
jr nz, .loop jr nz, .loop
ret ret

View file

@ -1,14 +1,14 @@
; b = new colour for BG colour 0 (usually white) for 4 frames ; b = new colour for BG colour 0 (usually white) for 4 frames
ChangeBGPalColor0_4Frames: ChangeBGPalColor0_4Frames:
call GetPredefRegisters call GetPredefRegisters
ld a, [rBGP] ldh a, [rBGP]
or b or b
ld [rBGP], a ldh [rBGP], a
ld c, 4 ld c, 4
call DelayFrames call DelayFrames
ld a, [rBGP] ldh a, [rBGP]
and %11111100 and %11111100
ld [rBGP], a ldh [rBGP], a
ret ret
PredefShakeScreenVertically: PredefShakeScreenVertically:
@ -19,7 +19,7 @@ PredefShakeScreenVertically:
ld [wDisableVBlankWYUpdate], a ld [wDisableVBlankWYUpdate], a
xor a xor a
.loop .loop
ld [hMutateWY], a ldh [hMutateWY], a
call .MutateWY call .MutateWY
call .MutateWY call .MutateWY
dec b dec b
@ -30,10 +30,10 @@ PredefShakeScreenVertically:
ret ret
.MutateWY .MutateWY
ld a, [hMutateWY] ldh a, [hMutateWY]
xor b xor b
ld [hMutateWY], a ldh [hMutateWY], a
ld [rWY], a ldh [rWY], a
ld c, 3 ld c, 3
jp DelayFrames jp DelayFrames
@ -43,7 +43,7 @@ PredefShakeScreenHorizontally:
call GetPredefRegisters call GetPredefRegisters
xor a xor a
.loop .loop
ld [hMutateWX], a ldh [hMutateWX], a
call .MutateWX call .MutateWX
ld c, 1 ld c, 1
call DelayFrames call DelayFrames
@ -54,18 +54,18 @@ PredefShakeScreenHorizontally:
; restore normal WX ; restore normal WX
ld a, 7 ld a, 7
ld [rWX], a ldh [rWX], a
ret ret
.MutateWX .MutateWX
ld a, [hMutateWX] ldh a, [hMutateWX]
xor b xor b
ld [hMutateWX], a ldh [hMutateWX], a
bit 7, a bit 7, a
jr z, .skipZeroing jr z, .skipZeroing
xor a ; zero a if it's negative xor a ; zero a if it's negative
.skipZeroing .skipZeroing
add 7 add 7
ld [rWX], a ldh [rWX], a
ld c, 4 ld c, 4
jp DelayFrames jp DelayFrames

View file

@ -13,21 +13,21 @@ PrepareOAMData::
.updateEnabled .updateEnabled
xor a xor a
ld [hOAMBufferOffset], a ldh [hOAMBufferOffset], a
.spriteLoop .spriteLoop
ld [hSpriteOffset2], a ldh [hSpriteOffset2], a
ld d, wSpriteStateData1 / $100 ld d, HIGH(wSpriteStateData1)
ld a, [hSpriteOffset2] ldh a, [hSpriteOffset2]
ld e, a ld e, a
ld a, [de] ; c1x0 ld a, [de] ; [x#SPRITESTATEDATA1_PICTUREID]
and a and a
jp z, .nextSprite jp z, .nextSprite
inc e inc e
inc e inc e
ld a, [de] ; c1x2 (facing/anim) ld a, [de] ; [x#SPRITESTATEDATA1_IMAGEINDEX]
ld [wd5cd], a ld [wd5cd], a
cp $ff ; off-screen (don't draw) cp $ff ; off-screen (don't draw)
jr nz, .visible jr nz, .visible
@ -56,9 +56,9 @@ PrepareOAMData::
ld a, e ld a, e
add $5 add $5
ld e, a ld e, a
ld a, [de] ; c2x7 ld a, [de] ; [x#SPRITESTATEDATA2_GRASSPRIORITY]
and $80 and $80
ld [hSpritePriority], a ; temp store sprite priority ldh [hSpritePriority], a ; temp store sprite priority
pop de pop de
; read the entry from the table ; read the entry from the table
@ -77,17 +77,17 @@ PrepareOAMData::
call GetSpriteScreenXY call GetSpriteScreenXY
ld a, [hOAMBufferOffset] ldh a, [hOAMBufferOffset]
ld e, a ld e, a
ld d, wOAMBuffer / $100 ld d, HIGH(wOAMBuffer)
.tileLoop .tileLoop
ld a, [hSpriteScreenY] ; temp for sprite Y position ldh a, [hSpriteScreenY] ; temp for sprite Y position
add $10 ; Y=16 is top of screen (Y=0 is invisible) add $10 ; Y=16 is top of screen (Y=0 is invisible)
add [hl] ; add Y offset from table add [hl] ; add Y offset from table
ld [de], a ; write new sprite OAM Y position ld [de], a ; write new sprite OAM Y position
inc hl inc hl
ld a, [hSpriteScreenX] ; temp for sprite X position ldh a, [hSpriteScreenX] ; temp for sprite X position
add $8 ; X=8 is left of screen (X=0 is invisible) add $8 ; X=8 is left of screen (X=0 is invisible)
add [hl] ; add X offset from table add [hl] ; add X offset from table
inc e inc e
@ -98,7 +98,7 @@ PrepareOAMData::
push bc push bc
ld b, a ld b, a
ld a, [wd5cd] ; temp copy of c1x2 ld a, [wd5cd] ; temp copy of [x#SPRITESTATEDATA1_IMAGEINDEX]
swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs) swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs)
and $f and $f
@ -126,7 +126,7 @@ PrepareOAMData::
ld a, [hl] ld a, [hl]
bit 1, a ; is the tile allowed to set the sprite priority bit? bit 1, a ; is the tile allowed to set the sprite priority bit?
jr z, .skipPriority jr z, .skipPriority
ld a, [hSpritePriority] ldh a, [hSpritePriority]
or [hl] or [hl]
.skipPriority .skipPriority
inc hl inc hl
@ -136,18 +136,18 @@ PrepareOAMData::
jr z, .tileLoop jr z, .tileLoop
ld a, e ld a, e
ld [hOAMBufferOffset], a ldh [hOAMBufferOffset], a
.nextSprite .nextSprite
ld a, [hSpriteOffset2] ldh a, [hSpriteOffset2]
add $10 add $10
cp $100 % $100 cp LOW($100)
jp nz, .spriteLoop jp nz, .spriteLoop
; Clear unused OAM. ; Clear unused OAM.
ld a, [hOAMBufferOffset] ldh a, [hOAMBufferOffset]
ld l, a ld l, a
ld h, wOAMBuffer / $100 ld h, HIGH(wOAMBuffer)
ld de, $4 ld de, $4
ld b, $a0 ld b, $a0
ld a, [wd736] ld a, [wd736]
@ -169,21 +169,21 @@ PrepareOAMData::
GetSpriteScreenXY: GetSpriteScreenXY:
inc e inc e
inc e inc e
ld a, [de] ; c1x4 ld a, [de] ; [x#SPRITESTATEDATA1_YPIXELS]
ld [hSpriteScreenY], a ldh [hSpriteScreenY], a
inc e inc e
inc e inc e
ld a, [de] ; c1x6 ld a, [de] ; [x#SPRITESTATEDATA1_XPIXELS]
ld [hSpriteScreenX], a ldh [hSpriteScreenX], a
ld a, 4 ld a, 4
add e add e
ld e, a ld e, a
ld a, [hSpriteScreenY] ldh a, [hSpriteScreenY]
add 4 add 4
and $f0 and $f0
ld [de], a ; c1xa (y) ld [de], a ; [x#SPRITESTATEDATA1_YADJUSTED]
inc e inc e
ld a, [hSpriteScreenX] ldh a, [hSpriteScreenX]
and $f0 and $f0
ld [de], a ; c1xb (x) ld [de], a ; [x#SPRITESTATEDATA1_XADJUSTED]
ret ret

View file

@ -12,10 +12,10 @@ AddItemToInventory_::
push hl push hl
push hl push hl
ld d, PC_ITEM_CAPACITY ; how many items the PC can hold ld d, PC_ITEM_CAPACITY ; how many items the PC can hold
ld a, wNumBagItems & $FF ld a, LOW(wNumBagItems)
cp l cp l
jr nz, .checkIfInventoryFull jr nz, .checkIfInventoryFull
ld a, wNumBagItems >> 8 ld a, HIGH(wNumBagItems)
cp h cp h
jr nz, .checkIfInventoryFull jr nz, .checkIfInventoryFull
; if the destination is the bag ; if the destination is the bag

View file

@ -147,7 +147,7 @@ ItemUseBall:
; If the player is fighting an unidentified ghost, set the value that indicates ; If the player is fighting an unidentified ghost, set the value that indicates
; the Pokémon can't be caught and skip the capture calculations. ; the Pokémon can't be caught and skip the capture calculations.
callab IsGhostBattle callfar IsGhostBattle
ld b, $10 ; can't be caught value ld b, $10 ; can't be caught value
jp z, .setAnimData jp z, .setAnimData
@ -239,14 +239,14 @@ ItemUseBall:
; Calculate MaxHP * 255. ; Calculate MaxHP * 255.
xor a xor a
ld [hMultiplicand], a ldh [hMultiplicand], a
ld hl, wEnemyMonMaxHP ld hl, wEnemyMonMaxHP
ld a, [hli] ld a, [hli]
ld [hMultiplicand + 1], a ldh [hMultiplicand + 1], a
ld a, [hl] ld a, [hl]
ld [hMultiplicand + 2], a ldh [hMultiplicand + 2], a
ld a, 255 ld a, 255
ld [hMultiplier], a ldh [hMultiplier], a
call Multiply call Multiply
; Determine BallFactor. It's 8 for Great Balls and 12 for the others. ; Determine BallFactor. It's 8 for Great Balls and 12 for the others.
@ -260,7 +260,7 @@ ItemUseBall:
; Note that the results of all division operations are floored. ; Note that the results of all division operations are floored.
; Calculate (MaxHP * 255) / BallFactor. ; Calculate (MaxHP * 255) / BallFactor.
ld [hDivisor], a ldh [hDivisor], a
ld b, 4 ; number of bytes in dividend ld b, 4 ; number of bytes in dividend
call Divide call Divide
@ -281,17 +281,17 @@ ItemUseBall:
.skip2 .skip2
; Let W = ((MaxHP * 255) / BallFactor) / max(HP / 4, 1). Calculate W. ; Let W = ((MaxHP * 255) / BallFactor) / max(HP / 4, 1). Calculate W.
ld [hDivisor], a ldh [hDivisor], a
ld b, 4 ld b, 4
call Divide call Divide
; If W > 255, store 255 in [hQuotient + 3]. ; If W > 255, store 255 in [hQuotient + 3].
; Let X = min(W, 255) = [hQuotient + 3]. ; Let X = min(W, 255) = [hQuotient + 3].
ld a, [hQuotient + 2] ldh a, [hQuotient + 2]
and a and a
jr z, .skip3 jr z, .skip3
ld a, 255 ld a, 255
ld [hQuotient + 3], a ldh [hQuotient + 3], a
.skip3 .skip3
pop bc ; b = Rand1 - Status pop bc ; b = Rand1 - Status
@ -302,7 +302,7 @@ ItemUseBall:
jr c, .failedToCapture jr c, .failedToCapture
; If W > 255, the ball captures the Pokémon. ; If W > 255, the ball captures the Pokémon.
ld a, [hQuotient + 2] ldh a, [hQuotient + 2]
and a and a
jr nz, .captured jr nz, .captured
@ -310,7 +310,7 @@ ItemUseBall:
; If Rand2 > X, the ball fails to capture the Pokémon. ; If Rand2 > X, the ball fails to capture the Pokémon.
ld b, a ld b, a
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
cp b cp b
jr c, .failedToCapture jr c, .failedToCapture
@ -318,17 +318,17 @@ ItemUseBall:
jr .skipShakeCalculations jr .skipShakeCalculations
.failedToCapture .failedToCapture
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
ld [wPokeBallCaptureCalcTemp], a ; Save X. ld [wPokeBallCaptureCalcTemp], a ; Save X.
; Calculate CatchRate * 100. ; Calculate CatchRate * 100.
xor a xor a
ld [hMultiplicand], a ldh [hMultiplicand], a
ld [hMultiplicand + 1], a ldh [hMultiplicand + 1], a
ld a, [wEnemyMonActualCatchRate] ld a, [wEnemyMonActualCatchRate]
ld [hMultiplicand + 2], a ldh [hMultiplicand + 2], a
ld a, 100 ld a, 100
ld [hMultiplier], a ldh [hMultiplier], a
call Multiply call Multiply
; Determine BallFactor2. ; Determine BallFactor2.
@ -349,26 +349,26 @@ ItemUseBall:
.skip4 .skip4
; Let Y = (CatchRate * 100) / BallFactor2. Calculate Y. ; Let Y = (CatchRate * 100) / BallFactor2. Calculate Y.
ld a, b ld a, b
ld [hDivisor], a ldh [hDivisor], a
ld b, 4 ld b, 4
call Divide call Divide
; If Y > 255, there are 3 shakes. ; If Y > 255, there are 3 shakes.
; Note that this shouldn't be possible. ; Note that this shouldn't be possible.
; The maximum value of Y is (255 * 100) / 150 = 170. ; The maximum value of Y is (255 * 100) / 150 = 170.
ld a, [hQuotient + 2] ldh a, [hQuotient + 2]
and a and a
ld b, $63 ; 3 shakes ld b, $63 ; 3 shakes
jr nz, .setAnimData jr nz, .setAnimData
; Calculate X * Y. ; Calculate X * Y.
ld a, [wPokeBallCaptureCalcTemp] ld a, [wPokeBallCaptureCalcTemp]
ld [hMultiplier], a ldh [hMultiplier], a
call Multiply call Multiply
; Calculate (X * Y) / 255. ; Calculate (X * Y) / 255.
ld a, 255 ld a, 255
ld [hDivisor], a ldh [hDivisor], a
ld b, 4 ld b, 4
call Divide call Divide
@ -386,9 +386,9 @@ ItemUseBall:
.addAilmentValue .addAilmentValue
; If the Pokémon has a status ailment, add Status2. ; If the Pokémon has a status ailment, add Status2.
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
add b add b
ld [hQuotient + 3], a ldh [hQuotient + 3], a
.skip5 .skip5
; Finally determine the number of shakes. ; Finally determine the number of shakes.
@ -398,7 +398,7 @@ ItemUseBall:
; 10 ≤ Z < 30: 1 shake ; 10 ≤ Z < 30: 1 shake
; 30 ≤ Z < 70: 2 shakes ; 30 ≤ Z < 70: 2 shakes
; 70 ≤ Z: 3 shakes ; 70 ≤ Z: 3 shakes
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
cp 10 cp 10
ld b, $20 ld b, $20
jr c, .setAnimData jr c, .setAnimData
@ -422,7 +422,7 @@ ItemUseBall:
ld a, TOSS_ANIM ld a, TOSS_ANIM
ld [wAnimationID], a ld [wAnimationID], a
xor a xor a
ld [hWhoseTurn], a ldh [hWhoseTurn], a
ld [wAnimationType], a ld [wAnimationType], a
ld [wDamageMultipliers], a ld [wDamageMultipliers], a
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
@ -495,7 +495,7 @@ ItemUseBall:
ld [wcf91], a ld [wcf91], a
ld a, [wEnemyMonLevel] ld a, [wEnemyMonLevel]
ld [wCurEnemyLVL], a ld [wCurEnemyLVL], a
callab LoadEnemyMonData callfar LoadEnemyMonData
pop af pop af
ld [wcf91], a ld [wcf91], a
pop hl pop hl
@ -632,7 +632,7 @@ ItemUseTownMap:
ld a, [wIsInBattle] ld a, [wIsInBattle]
and a and a
jp nz, ItemUseNotTime jp nz, ItemUseNotTime
jpba DisplayTownMap farjp DisplayTownMap
ItemUseBicycle: ItemUseBicycle:
ld a, [wIsInBattle] ld a, [wIsInBattle]
@ -656,7 +656,7 @@ ItemUseBicycle:
jp nc, NoCyclingAllowedHere jp nc, NoCyclingAllowedHere
call ItemUseReloadOverworldData call ItemUseReloadOverworldData
xor a ; no keys pressed xor a ; no keys pressed
ld [hJoyHeld], a ; current joypad state ldh [hJoyHeld], a ; current joypad state
inc a inc a
ld [wWalkBikeSurfState], a ; change player state to bicycling ld [wWalkBikeSurfState], a ; change player state to bicycling
ld hl, GotOnBicycleText ld hl, GotOnBicycleText
@ -687,11 +687,11 @@ ItemUseSurfboard:
jp PrintText jp PrintText
.tryToStopSurfing .tryToStopSurfing
xor a xor a
ld [hSpriteIndexOrTextID], a ldh [hSpriteIndexOrTextID], a
ld d, 16 ; talking range in pixels (normal range) ld d, 16 ; talking range in pixels (normal range)
call IsSpriteInFrontOfPlayer2 call IsSpriteInFrontOfPlayer2
res 7, [hl] res 7, [hl]
ld a, [hSpriteIndexOrTextID] ldh a, [hSpriteIndexOrTextID]
and a ; is there a sprite in the way? and a ; is there a sprite in the way?
jr nz, .cannotStopSurfing jr nz, .cannotStopSurfing
ld hl, TilePairCollisionsWater ld hl, TilePairCollisionsWater
@ -778,7 +778,7 @@ ItemUseEvoStone:
ld a, SFX_HEAL_AILMENT ld a, SFX_HEAL_AILMENT
call PlaySoundWaitForCurrent call PlaySoundWaitForCurrent
call WaitForSoundToFinish call WaitForSoundToFinish
callab TryEvolvingMon ; try to evolve pokemon callfar TryEvolvingMon ; try to evolve pokemon
ld a, [wEvolutionOccurred] ld a, [wEvolutionOccurred]
and a and a
jr z, .noEffect jr z, .noEffect
@ -1018,18 +1018,18 @@ ItemUseMedicine:
call AddNTimes call AddNTimes
ld a, [hli] ld a, [hli]
ld [wHPBarMaxHP + 1], a ld [wHPBarMaxHP + 1], a
ld [hDividend], a ldh [hDividend], a
ld a, [hl] ld a, [hl]
ld [wHPBarMaxHP], a ld [wHPBarMaxHP], a
ld [hDividend + 1], a ldh [hDividend + 1], a
ld a, 5 ld a, 5
ld [hDivisor], a ldh [hDivisor], a
ld b, 2 ; number of bytes ld b, 2 ; number of bytes
call Divide ; get 1/5 of max HP of pokemon that used Softboiled call Divide ; get 1/5 of max HP of pokemon that used Softboiled
ld bc, (wPartyMon1HP + 1) - (wPartyMon1MaxHP + 1) ld bc, (wPartyMon1HP + 1) - (wPartyMon1MaxHP + 1)
add hl, bc ; hl now points to LSB of current HP of pokemon that used Softboiled add hl, bc ; hl now points to LSB of current HP of pokemon that used Softboiled
; subtract 1/5 of max HP from current HP of pokemon that used Softboiled ; subtract 1/5 of max HP from current HP of pokemon that used Softboiled
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
push af push af
ld b, a ld b, a
ld a, [hl] ld a, [hl]
@ -1037,28 +1037,28 @@ ItemUseMedicine:
sub b sub b
ld [hld], a ld [hld], a
ld [wHPBarNewHP], a ld [wHPBarNewHP], a
ld a, [hQuotient + 2] ldh a, [hQuotient + 2]
ld b, a ld b, a
ld a, [hl] ld a, [hl]
ld [wHPBarOldHP+1], a ld [wHPBarOldHP+1], a
sbc b sbc b
ld [hl], a ld [hl], a
ld [wHPBarNewHP+1], a ld [wHPBarNewHP+1], a
coord hl, 4, 1 hlcoord 4, 1
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
ld bc, 2 * SCREEN_WIDTH ld bc, 2 * SCREEN_WIDTH
call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled
ld a, SFX_HEAL_HP ld a, SFX_HEAL_HP
call PlaySoundWaitForCurrent call PlaySoundWaitForCurrent
ld a, [hFlagsFFF6] ldh a, [hFlagsFFF6]
set 0, a set 0, a
ld [hFlagsFFF6], a ldh [hFlagsFFF6], a
ld a, $02 ld a, $02
ld [wHPBarType], a ld [wHPBarType], a
predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled
ld a, [hFlagsFFF6] ldh a, [hFlagsFFF6]
res 0, a res 0, a
ld [hFlagsFFF6], a ldh [hFlagsFFF6], a
pop af pop af
ld b, a ; store heal amount (1/5 of max HP) ld b, a ; store heal amount (1/5 of max HP)
ld hl, wHPBarOldHP + 1 ld hl, wHPBarOldHP + 1
@ -1200,15 +1200,15 @@ ItemUseMedicine:
jr z, .playStatusAilmentCuringSound jr z, .playStatusAilmentCuringSound
ld a, SFX_HEAL_HP ld a, SFX_HEAL_HP
call PlaySoundWaitForCurrent call PlaySoundWaitForCurrent
ld a, [hFlagsFFF6] ldh a, [hFlagsFFF6]
set 0, a set 0, a
ld [hFlagsFFF6], a ldh [hFlagsFFF6], a
ld a, $02 ld a, $02
ld [wHPBarType], a ld [wHPBarType], a
predef UpdateHPBar2 ; animate the HP bar lengthening predef UpdateHPBar2 ; animate the HP bar lengthening
ld a, [hFlagsFFF6] ldh a, [hFlagsFFF6]
res 0, a res 0, a
ld [hFlagsFFF6], a ldh [hFlagsFFF6], a
ld a, REVIVE_MSG ld a, REVIVE_MSG
ld [wPartyMenuTypeOrMessageID], a ld [wPartyMenuTypeOrMessageID], a
ld a, [wcf91] ld a, [wcf91]
@ -1224,13 +1224,13 @@ ItemUseMedicine:
call PlaySoundWaitForCurrent call PlaySoundWaitForCurrent
.showHealingItemMessage .showHealingItemMessage
xor a xor a
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
call ClearScreen call ClearScreen
dec a dec a
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
call RedrawPartyMenu ; redraws the party menu and displays the message call RedrawPartyMenu ; redraws the party menu and displays the message
ld a, 1 ld a, 1
ld [hAutoBGTransferEnabled], a ldh [hAutoBGTransferEnabled], a
ld c, 50 ld c, 50
call DelayFrames call DelayFrames
call WaitForTextScrollButtonPress call WaitForTextScrollButtonPress
@ -1341,17 +1341,17 @@ ItemUseMedicine:
push hl push hl
push de push de
ld d, a ld d, a
callab CalcExperience ; calculate experience for next level and store it at hExperience callfar CalcExperience ; calculate experience for next level and store it at hExperience
pop de pop de
pop hl pop hl
ld bc, wPartyMon1Exp - wPartyMon1Level ld bc, wPartyMon1Exp - wPartyMon1Level
add hl, bc ; hl now points to MSB of experience add hl, bc ; hl now points to MSB of experience
; update experience to minimum for new level ; update experience to minimum for new level
ld a, [hExperience] ldh a, [hExperience]
ld [hli], a ld [hli], a
ld a, [hExperience + 1] ldh a, [hExperience + 1]
ld [hli], a ld [hli], a
ld a, [hExperience + 2] ldh a, [hExperience + 2]
ld [hl], a ld [hl], a
pop hl pop hl
ld a, [wWhichPokemon] ld a, [wWhichPokemon]
@ -1400,14 +1400,14 @@ ItemUseMedicine:
ld [wMonDataLocation], a ld [wMonDataLocation], a
call LoadMonData call LoadMonData
ld d, $01 ld d, $01
callab PrintStatsBox ; display new stats text box callfar PrintStatsBox ; display new stats text box
call WaitForTextScrollButtonPress ; wait for button press call WaitForTextScrollButtonPress ; wait for button press
xor a ; PLAYER_PARTY_DATA xor a ; PLAYER_PARTY_DATA
ld [wMonDataLocation], a ld [wMonDataLocation], a
predef LearnMoveFromLevelUp ; learn level up move, if any predef LearnMoveFromLevelUp ; learn level up move, if any
xor a xor a
ld [wForceEvolution], a ld [wForceEvolution], a
callab TryEvolvingMon ; evolve pokemon, if appropriate callfar TryEvolvingMon ; evolve pokemon, if appropriate
ld a, $01 ld a, $01
ld [wUpdateSpritesEnabled], a ld [wUpdateSpritesEnabled], a
pop af pop af
@ -1459,7 +1459,7 @@ BaitRockCommon:
ld [wAnimationID], a ld [wAnimationID], a
xor a xor a
ld [wAnimationType], a ld [wAnimationType], a
ld [hWhoseTurn], a ldh [hWhoseTurn], a
ld [de], a ; zero escape factor (for bait), zero bait factor (for rock) ld [de], a ; zero escape factor (for bait), zero bait factor (for rock)
.randomLoop ; loop until a random number less than 5 is generated .randomLoop ; loop until a random number less than 5 is generated
call Random call Random
@ -1698,8 +1698,8 @@ ItemUseXStat:
call LoadScreenTilesFromBuffer1 ; restore saved screen call LoadScreenTilesFromBuffer1 ; restore saved screen
call Delay3 call Delay3
xor a xor a
ld [hWhoseTurn], a ; set turn to player's turn ldh [hWhoseTurn], a ; set turn to player's turn
callba StatModifierUpEffect ; do stat increase move farcall StatModifierUpEffect ; do stat increase move
pop hl pop hl
pop af pop af
ld [hld], a ; restore [wPlayerMoveEffect] ld [hld], a ; restore [wPlayerMoveEffect]
@ -1775,7 +1775,7 @@ ItemUsePokeflute:
and $80 and $80
jr nz, .skipMusic jr nz, .skipMusic
call WaitForSoundToFinish ; wait for sound to end call WaitForSoundToFinish ; wait for sound to end
callba Music_PokeFluteInBattle ; play in-battle pokeflute music farcall Music_PokeFluteInBattle ; play in-battle pokeflute music
.musicWaitLoop ; wait for music to finish playing .musicWaitLoop ; wait for music to finish playing
ld a, [wChannelSoundIDs + Ch7] ld a, [wChannelSoundIDs + Ch7]
and a ; music off? and a ; music off?
@ -1927,7 +1927,7 @@ RodResponse:
push af push af
push hl push hl
ld [hl], 0 ld [hl], 0
callba FishingAnim farcall FishingAnim
pop hl pop hl
pop af pop af
ld [hl], a ld [hl], a
@ -1968,7 +1968,7 @@ ItemUseItemfinder:
and a and a
jp nz, ItemUseNotTime jp nz, ItemUseNotTime
call ItemUseReloadOverworldData call ItemUseReloadOverworldData
callba HiddenItemNear ; check for hidden items farcall HiddenItemNear ; check for hidden items
ld hl, ItemfinderFoundNothingText ld hl, ItemfinderFoundNothingText
jr nc, .printText ; if no hidden items jr nc, .printText ; if no hidden items
ld c, 4 ld c, 4
@ -2024,7 +2024,7 @@ ItemUsePPRestore:
call PrintText call PrintText
xor a xor a
ld [wPlayerMoveListIndex], a ld [wPlayerMoveListIndex], a
callab MoveSelectionMenu ; move selection menu callfar MoveSelectionMenu ; move selection menu
ld a, 0 ld a, 0
ld [wPlayerMoveListIndex], a ld [wPlayerMoveListIndex], a
jr nz, .chooseMon jr nz, .chooseMon
@ -2221,7 +2221,7 @@ ItemUseTMHM:
call PrintText call PrintText
ld hl, TeachMachineMoveText ld hl, TeachMachineMoveText
call PrintText call PrintText
coord hl, 14, 7 hlcoord 14, 7
lb bc, 8, 15 lb bc, 8, 15
ld a, TWO_OPTION_MENU ld a, TWO_OPTION_MENU
ld [wTextBoxID], a ld [wTextBoxID], a
@ -2278,7 +2278,7 @@ ItemUseTMHM:
call PrintText call PrintText
jr .chooseMon jr .chooseMon
.checkIfAlreadyLearnedMove .checkIfAlreadyLearnedMove
callab CheckIfMoveIsKnown ; check if the pokemon already knows the move callfar CheckIfMoveIsKnown ; check if the pokemon already knows the move
jr c, .chooseMon jr c, .chooseMon
predef LearnMove ; teach move predef LearnMove ; teach move
pop af pop af
@ -2463,13 +2463,13 @@ RestoreBonusPP:
AddBonusPP: AddBonusPP:
push bc push bc
ld a, [de] ; normal max PP of move ld a, [de] ; normal max PP of move
ld [hDividend + 3], a ldh [hDividend + 3], a
xor a xor a
ld [hDividend], a ldh [hDividend], a
ld [hDividend + 1], a ldh [hDividend + 1], a
ld [hDividend + 2], a ldh [hDividend + 2], a
ld a, 5 ld a, 5
ld [hDivisor], a ldh [hDivisor], a
ld b, 4 ld b, 4
call Divide call Divide
ld a, [hl] ; move PP ld a, [hl] ; move PP
@ -2480,7 +2480,7 @@ AddBonusPP:
srl a srl a
ld c, a ; c = number of PP Ups used ld c, a ; c = number of PP Ups used
.loop .loop
ld a, [hQuotient + 3] ldh a, [hQuotient + 3]
cp 8 ; is the amount greater than or equal to 8? cp 8 ; is the amount greater than or equal to 8?
jr c, .addAmount jr c, .addAmount
ld a, 7 ; cap the amount at 7 ld a, 7 ; cap the amount at 7
@ -2607,7 +2607,7 @@ TossItem_::
call CopyStringToCF4B ; copy name to wcf4b call CopyStringToCF4B ; copy name to wcf4b
ld hl, IsItOKToTossItemText ld hl, IsItOKToTossItemText
call PrintText call PrintText
coord hl, 14, 7 hlcoord 14, 7
lb bc, 8, 15 lb bc, 8, 15
ld a, TWO_OPTION_MENU ld a, TWO_OPTION_MENU
ld [wTextBoxID], a ld [wTextBoxID], a
@ -2820,15 +2820,15 @@ SendNewMonToBox:
push de push de
ld a, [wCurEnemyLVL] ld a, [wCurEnemyLVL]
ld d, a ld d, a
callab CalcExperience callfar CalcExperience
pop de pop de
ld a, [hExperience] ldh a, [hExperience]
ld [de], a ld [de], a
inc de inc de
ld a, [hExperience + 1] ldh a, [hExperience + 1]
ld [de], a ld [de], a
inc de inc de
ld a, [hExperience + 2] ldh a, [hExperience + 2]
ld [de], a ld [de], a
inc de inc de
xor a xor a

View file

@ -16,10 +16,10 @@ GetMachinePrice::
swap a swap a
.highNybbleIsPrice .highNybbleIsPrice
and $f0 and $f0
ld [hItemPrice + 1], a ldh [hItemPrice + 1], a
xor a xor a
ld [hItemPrice], a ldh [hItemPrice], a
ld [hItemPrice + 2], a ldh [hItemPrice + 2], a
ret ret
INCLUDE "data/items/tm_prices.asm" INCLUDE "data/items/tm_prices.asm"

View file

@ -6,19 +6,19 @@ DisplayTownMap:
ld [hl], $ff ld [hl], $ff
push hl push hl
ld a, $1 ld a, $1
ld [hJoy7], a ldh [hJoy7], a
ld a, [wCurMap] ld a, [wCurMap]
push af push af
ld b, $0 ld b, $0
call DrawPlayerOrBirdSprite ; player sprite call DrawPlayerOrBirdSprite ; player sprite
coord hl, 1, 0 hlcoord 1, 0
ld de, wcd6d ld de, wcd6d
call PlaceString call PlaceString
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld de, wTileMapBackup ld de, wTileMapBackup
ld bc, $10 ld bc, $10
call CopyData call CopyData
ld hl, vSprites + $40 ld hl, vSprites tile $04
ld de, TownMapCursor ld de, TownMapCursor
lb bc, BANK(TownMapCursor), (TownMapCursorEnd - TownMapCursor) / $8 lb bc, BANK(TownMapCursor), (TownMapCursorEnd - TownMapCursor) / $8
call CopyVideoDataDouble call CopyVideoDataDouble
@ -28,7 +28,7 @@ DisplayTownMap:
jr .enterLoop jr .enterLoop
.townMapLoop .townMapLoop
coord hl, 0, 0 hlcoord 0, 0
lb bc, 1, 20 lb bc, 1, 20
call ClearScreenArea call ClearScreenArea
ld hl, TownMapOrder ld hl, TownMapOrder
@ -55,7 +55,7 @@ DisplayTownMap:
inc de inc de
cp $50 cp $50
jr nz, .copyMapName jr nz, .copyMapName
coord hl, 1, 0 hlcoord 1, 0
ld de, wcd6d ld de, wcd6d
call PlaceString call PlaceString
ld hl, wOAMBuffer + $10 ld hl, wOAMBuffer + $10
@ -65,7 +65,7 @@ DisplayTownMap:
.inputLoop .inputLoop
call TownMapSpriteBlinkingAnimation call TownMapSpriteBlinkingAnimation
call JoypadLowSensitivity call JoypadLowSensitivity
ld a, [hJoy5] ldh a, [hJoy5]
ld b, a ld b, a
and A_BUTTON | B_BUTTON | D_UP | D_DOWN and A_BUTTON | B_BUTTON | D_UP | D_DOWN
jr z, .inputLoop jr z, .inputLoop
@ -77,7 +77,7 @@ DisplayTownMap:
jr nz, .pressedDown jr nz, .pressedDown
xor a xor a
ld [wTownMapSpriteBlinkingEnabled], a ld [wTownMapSpriteBlinkingEnabled], a
ld [hJoy7], a ldh [hJoy7], a
ld [wAnimCounter], a ld [wAnimCounter], a
call ExitTownMap call ExitTownMap
pop hl pop hl
@ -118,7 +118,7 @@ LoadTownMap_Nest:
push hl push hl
call DisplayWildLocations call DisplayWildLocations
call GetMonName call GetMonName
coord hl, 1, 0 hlcoord 1, 0
call PlaceString call PlaceString
ld h, b ld h, b
ld l, c ld l, c
@ -140,11 +140,11 @@ LoadTownMap_Fly::
call LoadPlayerSpriteGraphics call LoadPlayerSpriteGraphics
call LoadFontTilePatterns call LoadFontTilePatterns
ld de, BirdSprite ld de, BirdSprite
ld hl, vSprites + $40 ld hl, vSprites tile $04
lb bc, BANK(BirdSprite), $c lb bc, BANK(BirdSprite), 12
call CopyVideoData call CopyVideoData
ld de, TownMapUpArrow ld de, TownMapUpArrow
ld hl, vChars1 + $6d0 ld hl, vChars1 tile $6d
lb bc, BANK(TownMapUpArrow), (TownMapUpArrowEnd - TownMapUpArrow) / $8 lb bc, BANK(TownMapUpArrow), (TownMapUpArrowEnd - TownMapUpArrow) / $8
call CopyVideoDataDouble call CopyVideoDataDouble
call BuildFlyLocationsList call BuildFlyLocationsList
@ -153,41 +153,41 @@ LoadTownMap_Fly::
push af push af
ld [hl], $ff ld [hl], $ff
push hl push hl
coord hl, 0, 0 hlcoord 0, 0
ld de, ToText ld de, ToText
call PlaceString call PlaceString
ld a, [wCurMap] ld a, [wCurMap]
ld b, $0 ld b, $0
call DrawPlayerOrBirdSprite call DrawPlayerOrBirdSprite
ld hl, wFlyLocationsList ld hl, wFlyLocationsList
coord de, 18, 0 decoord 18, 0
.townMapFlyLoop .townMapFlyLoop
ld a, " " ld a, " "
ld [de], a ld [de], a
push hl push hl
push hl push hl
coord hl, 3, 0 hlcoord 3, 0
lb bc, 1, 15 lb bc, 1, 15
call ClearScreenArea call ClearScreenArea
pop hl pop hl
ld a, [hl] ld a, [hl]
ld b, $4 ld b, $4
call DrawPlayerOrBirdSprite ; draw bird sprite call DrawPlayerOrBirdSprite ; draw bird sprite
coord hl, 3, 0 hlcoord 3, 0
ld de, wcd6d ld de, wcd6d
call PlaceString call PlaceString
ld c, 15 ld c, 15
call DelayFrames call DelayFrames
coord hl, 18, 0 hlcoord 18, 0
ld [hl], "▲" ld [hl], "▲"
coord hl, 19, 0 hlcoord 19, 0
ld [hl], "▼" ld [hl], "▼"
pop hl pop hl
.inputLoop .inputLoop
push hl push hl
call DelayFrame call DelayFrame
call JoypadLowSensitivity call JoypadLowSensitivity
ld a, [hJoy5] ldh a, [hJoy5]
ld b, a ld b, a
pop hl pop hl
and A_BUTTON | B_BUTTON | D_UP | D_DOWN and A_BUTTON | B_BUTTON | D_UP | D_DOWN
@ -219,7 +219,7 @@ LoadTownMap_Fly::
ld [hl], a ld [hl], a
ret ret
.pressedUp .pressedUp
coord de, 18, 0 decoord 18, 0
inc hl inc hl
ld a, [hl] ld a, [hl]
cp $ff cp $ff
@ -231,7 +231,7 @@ LoadTownMap_Fly::
ld hl, wFlyLocationsList ld hl, wFlyLocationsList
jp .townMapFlyLoop jp .townMapFlyLoop
.pressedDown .pressedDown
coord de, 19, 0 decoord 19, 0
dec hl dec hl
ld a, [hl] ld a, [hl]
cp $ff cp $ff
@ -278,22 +278,22 @@ LoadTownMap:
call GBPalWhiteOutWithDelay3 call GBPalWhiteOutWithDelay3
call ClearScreen call ClearScreen
call UpdateSprites call UpdateSprites
coord hl, 0, 0 hlcoord 0, 0
ld b, $12 ld b, $12
ld c, $12 ld c, $12
call TextBoxBorder call TextBoxBorder
call DisableLCD call DisableLCD
ld hl, WorldMapTileGraphics ld hl, WorldMapTileGraphics
ld de, vChars2 + $600 ld de, vChars2 tile $60
ld bc, WorldMapTileGraphicsEnd - WorldMapTileGraphics ld bc, WorldMapTileGraphicsEnd - WorldMapTileGraphics
ld a, BANK(WorldMapTileGraphics) ld a, BANK(WorldMapTileGraphics)
call FarCopyData2 call FarCopyData2
ld hl, MonNestIcon ld hl, MonNestIcon
ld de, vSprites + $40 ld de, vSprites tile $04
ld bc, MonNestIconEnd - MonNestIcon ld bc, MonNestIconEnd - MonNestIcon
ld a, BANK(MonNestIcon) ld a, BANK(MonNestIcon)
call FarCopyDataDouble call FarCopyDataDouble
coord hl, 0, 0 hlcoord 0, 0
ld de, CompressedMap ld de, CompressedMap
.nextTile .nextTile
ld a, [de] ld a, [de]
@ -366,7 +366,7 @@ DrawPlayerOrBirdSprite:
jp CopyData jp CopyData
DisplayWildLocations: DisplayWildLocations:
callba FindWildLocationsOfMon farcall FindWildLocationsOfMon
call ZeroOutDuplicatesInList call ZeroOutDuplicatesInList
ld hl, wOAMBuffer ld hl, wOAMBuffer
ld de, wTownMapCoords ld de, wTownMapCoords
@ -395,11 +395,11 @@ DisplayWildLocations:
and a ; were any OAM entries written? and a ; were any OAM entries written?
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 hlcoord 1, 7
ld b, 2 ld b, 2
ld c, 15 ld c, 15
call TextBoxBorder call TextBoxBorder
coord hl, 2, 9 hlcoord 2, 9
ld de, AreaUnknownText ld de, AreaUnknownText
call PlaceString call PlaceString
jr .done jr .done

View file

@ -2,29 +2,29 @@ _Joypad::
; hJoyReleased: (hJoyLast ^ hJoyInput) & hJoyLast ; hJoyReleased: (hJoyLast ^ hJoyInput) & hJoyLast
; hJoyPressed: (hJoyLast ^ hJoyInput) & hJoyInput ; hJoyPressed: (hJoyLast ^ hJoyInput) & hJoyInput
ld a, [hJoyInput] ldh a, [hJoyInput]
cp A_BUTTON + B_BUTTON + SELECT + START ; soft reset cp A_BUTTON + B_BUTTON + SELECT + START ; soft reset
jp z, TrySoftReset jp z, TrySoftReset
ld b, a ld b, a
ld a, [hJoyLast] ldh a, [hJoyLast]
ld e, a ld e, a
xor b xor b
ld d, a ld d, a
and e and e
ld [hJoyReleased], a ldh [hJoyReleased], a
ld a, d ld a, d
and b and b
ld [hJoyPressed], a ldh [hJoyPressed], a
ld a, b ld a, b
ld [hJoyLast], a ldh [hJoyLast], a
ld a, [wd730] ld a, [wd730]
bit 5, a bit 5, a
jr nz, DiscardButtonPresses jr nz, DiscardButtonPresses
ld a, [hJoyLast] ldh a, [hJoyLast]
ld [hJoyHeld], a ldh [hJoyHeld], a
ld a, [wJoyIgnore] ld a, [wJoyIgnore]
and a and a
@ -32,19 +32,19 @@ _Joypad::
cpl cpl
ld b, a ld b, a
ld a, [hJoyHeld] ldh a, [hJoyHeld]
and b and b
ld [hJoyHeld], a ldh [hJoyHeld], a
ld a, [hJoyPressed] ldh a, [hJoyPressed]
and b and b
ld [hJoyPressed], a ldh [hJoyPressed], a
ret ret
DiscardButtonPresses: DiscardButtonPresses:
xor a xor a
ld [hJoyHeld], a ldh [hJoyHeld], a
ld [hJoyPressed], a ldh [hJoyPressed], a
ld [hJoyReleased], a ldh [hJoyReleased], a
ret ret
TrySoftReset: TrySoftReset:
@ -52,7 +52,7 @@ TrySoftReset:
; deselect (redundant) ; deselect (redundant)
ld a, $30 ld a, $30
ld [rJOYP], a ldh [rJOYP], a
ld hl, hSoftReset ld hl, hSoftReset
dec [hl] dec [hl]

Some files were not shown because too many files have changed in this diff Show more