mirror of
https://github.com/pret/pokered.git
synced 2024-10-22 22:55:31 +00:00
Merge pull request #263 from Rangi42/master
Syncing style with pokecrystal
This commit is contained in:
commit
9571c550b6
320 changed files with 6353 additions and 6377 deletions
2
Makefile
2
Makefile
|
@ -58,7 +58,7 @@ tools:
|
|||
$(MAKE) -C tools/
|
||||
|
||||
|
||||
RGBASMFLAGS = -h -Weverything
|
||||
RGBASMFLAGS = -h -L -Weverything
|
||||
# Create a sym/map for debug purposes if `make` run with `DEBUG=1`
|
||||
ifeq ($(DEBUG),1)
|
||||
RGBASMFLAGS += -E
|
||||
|
|
|
@ -20,10 +20,10 @@ Audio1_UpdateMusic::
|
|||
set 7, a
|
||||
ld [wMuteAudioAndPauseMusic], a
|
||||
xor a ; disable all channels' output
|
||||
ld [rNR51], a
|
||||
ld [rNR30], a
|
||||
ldh [rNR51], a
|
||||
ldh [rNR30], a
|
||||
ld a, $80
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
jr .nextChannel
|
||||
.applyAffects
|
||||
call Audio1_ApplyMusicAffects
|
||||
|
@ -183,9 +183,9 @@ Audio1_sound_ret:
|
|||
jr nz, .skipSfxChannel3
|
||||
; restart hardware channel 3 (wave channel) output
|
||||
ld a, $0
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
ld a, $80
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
.skipSfxChannel3
|
||||
jr nz, .dontDisable
|
||||
ld a, [wDisableChannelOutputWhenSfxEnds]
|
||||
|
@ -219,9 +219,9 @@ Audio1_sound_ret:
|
|||
.disableChannelOutput
|
||||
ld hl, Audio1_HWChannelDisableMasks
|
||||
add hl, bc
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
and [hl]
|
||||
ld [rNR51], a
|
||||
ldh [rNR51], a
|
||||
.afterDisable
|
||||
ld a, [wChannelSoundIDs + Ch5]
|
||||
cp CRY_SFX_START
|
||||
|
@ -241,7 +241,7 @@ Audio1_sound_ret:
|
|||
ret c
|
||||
.skipRewind
|
||||
ld a, [wSavedVolume]
|
||||
ld [rNR50], a
|
||||
ldh [rNR50], a
|
||||
xor a
|
||||
ld [wSavedVolume], a
|
||||
.skipCry
|
||||
|
@ -548,7 +548,7 @@ Audio1_volume:
|
|||
cp $f0 ; is this command a volume?
|
||||
jr nz, Audio1_execute_music ; no
|
||||
call Audio1_GetNextMusicByte
|
||||
ld [rNR50], a ; store volume
|
||||
ldh [rNR50], a ; store volume
|
||||
jp Audio1_sound_ret
|
||||
|
||||
Audio1_execute_music:
|
||||
|
@ -638,7 +638,7 @@ Audio1_pitch_sweep:
|
|||
bit BIT_EXECUTE_MUSIC, [hl]
|
||||
jr nz, Audio1_note ; no
|
||||
call Audio1_GetNextMusicByte
|
||||
ld [rNR10], a
|
||||
ldh [rNR10], a
|
||||
jp Audio1_sound_ret
|
||||
|
||||
Audio1_note:
|
||||
|
@ -770,9 +770,9 @@ Audio1_note_pitch:
|
|||
ld b, 0
|
||||
ld hl, Audio1_HWChannelDisableMasks
|
||||
add hl, bc
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
and [hl]
|
||||
ld [rNR51], a ; disable hardware channel 3's output
|
||||
ldh [rNR51], a ; disable hardware channel 3's output
|
||||
jr .done
|
||||
.notChannel3
|
||||
ld b, REG_VOLUME_ENVELOPE
|
||||
|
@ -844,7 +844,7 @@ Audio1_EnableChannelOutput:
|
|||
ld b, 0
|
||||
ld hl, Audio1_HWChannelEnableMasks
|
||||
add hl, bc
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
or [hl] ; set this channel's bits
|
||||
ld d, a
|
||||
ld a, c
|
||||
|
@ -866,7 +866,7 @@ Audio1_EnableChannelOutput:
|
|||
add hl, bc
|
||||
and [hl]
|
||||
ld d, a
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
ld hl, Audio1_HWChannelDisableMasks
|
||||
add hl, bc
|
||||
and [hl] ; reset this channel's output bits
|
||||
|
@ -874,7 +874,7 @@ Audio1_EnableChannelOutput:
|
|||
ld d, a
|
||||
.skip
|
||||
ld a, d
|
||||
ld [rNR51], a
|
||||
ldh [rNR51], a
|
||||
ret
|
||||
|
||||
Audio1_ApplyDutyCycleAndSoundLength:
|
||||
|
@ -928,7 +928,7 @@ Audio1_ApplyWavePatternAndFrequency:
|
|||
ld hl, rWave_0
|
||||
ld b, $f
|
||||
ld a, $0 ; stop hardware channel 3
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
.loop
|
||||
ld a, [de]
|
||||
inc de
|
||||
|
@ -938,7 +938,7 @@ Audio1_ApplyWavePatternAndFrequency:
|
|||
and a
|
||||
jr nz, .loop
|
||||
ld a, $80 ; start hardware channel 3
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
pop de
|
||||
.notChannel3
|
||||
ld a, d
|
||||
|
@ -1399,17 +1399,17 @@ Audio1_PlaySound::
|
|||
ld a, $ff
|
||||
ld [wStereoPanning], a
|
||||
xor a
|
||||
ld [rNR50], a
|
||||
ldh [rNR50], a
|
||||
ld a, $8
|
||||
ld [rNR10], a
|
||||
ldh [rNR10], a
|
||||
ld a, 0
|
||||
ld [rNR51], a
|
||||
ldh [rNR51], a
|
||||
xor a
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
ld a, $80
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
ld a, $77
|
||||
ld [rNR50], a
|
||||
ldh [rNR50], a
|
||||
jp .playSoundCommon
|
||||
|
||||
.playSfx
|
||||
|
@ -1555,7 +1555,7 @@ Audio1_PlaySound::
|
|||
cp Ch5
|
||||
jr nz, .skipSweepDisable
|
||||
ld a, $8
|
||||
ld [rNR10], a ; sweep off
|
||||
ldh [rNR10], a ; sweep off
|
||||
.skipSweepDisable
|
||||
ld a, c
|
||||
and a
|
||||
|
@ -1565,22 +1565,22 @@ Audio1_PlaySound::
|
|||
|
||||
.stopAllAudio
|
||||
ld a, $80
|
||||
ld [rNR52], a ; sound hardware on
|
||||
ld [rNR30], a ; wave playback on
|
||||
ldh [rNR52], a ; sound hardware on
|
||||
ldh [rNR30], a ; wave playback on
|
||||
xor a
|
||||
ld [rNR51], a ; no sound output
|
||||
ld [rNR32], a ; mute channel 3 (wave channel)
|
||||
ldh [rNR51], a ; no sound output
|
||||
ldh [rNR32], a ; mute channel 3 (wave channel)
|
||||
ld a, $8
|
||||
ld [rNR10], a ; sweep off
|
||||
ld [rNR12], a ; mute channel 1 (pulse channel 1)
|
||||
ld [rNR22], a ; mute channel 2 (pulse channel 2)
|
||||
ld [rNR42], a ; mute channel 4 (noise channel)
|
||||
ldh [rNR10], a ; sweep off
|
||||
ldh [rNR12], a ; mute channel 1 (pulse channel 1)
|
||||
ldh [rNR22], a ; mute channel 2 (pulse channel 2)
|
||||
ldh [rNR42], a ; mute channel 4 (noise channel)
|
||||
ld a, $40
|
||||
ld [rNR14], a ; counter mode
|
||||
ld [rNR24], a
|
||||
ld [rNR44], a
|
||||
ldh [rNR14], a ; counter mode
|
||||
ldh [rNR24], a
|
||||
ldh [rNR44], a
|
||||
ld a, $77
|
||||
ld [rNR50], a ; full volume
|
||||
ldh [rNR50], a ; full volume
|
||||
xor a
|
||||
ld [wUnusedC000], a
|
||||
ld [wDisableChannelOutputWhenSfxEnds], a
|
||||
|
@ -1699,10 +1699,10 @@ Audio1_PlaySound::
|
|||
ld a, [wSavedVolume]
|
||||
and a
|
||||
jr nz, .done
|
||||
ld a, [rNR50]
|
||||
ldh a, [rNR50]
|
||||
ld [wSavedVolume], a
|
||||
ld a, $77
|
||||
ld [rNR50], a ; full volume
|
||||
ldh [rNR50], a ; full volume
|
||||
.done
|
||||
ret
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@ Audio2_UpdateMusic::
|
|||
set 7, a
|
||||
ld [wMuteAudioAndPauseMusic], a
|
||||
xor a ; disable all channels' output
|
||||
ld [rNR51], a
|
||||
ld [rNR30], a
|
||||
ldh [rNR51], a
|
||||
ldh [rNR30], a
|
||||
ld a, $80
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
jr .nextChannel
|
||||
.applyAffects
|
||||
call Audio2_ApplyMusicAffects
|
||||
|
@ -194,9 +194,9 @@ Audio2_sound_ret:
|
|||
jr nz, .skipSfxChannel3
|
||||
; restart hardware channel 3 (wave channel) output
|
||||
ld a, $0
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
ld a, $80
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
.skipSfxChannel3
|
||||
jr nz, .dontDisable
|
||||
ld a, [wDisableChannelOutputWhenSfxEnds]
|
||||
|
@ -230,9 +230,9 @@ Audio2_sound_ret:
|
|||
.disableChannelOutput
|
||||
ld hl, Audio2_HWChannelDisableMasks
|
||||
add hl, bc
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
and [hl]
|
||||
ld [rNR51], a
|
||||
ldh [rNR51], a
|
||||
.afterDisable
|
||||
ld a, [wChannelSoundIDs + Ch5]
|
||||
cp CRY_SFX_START
|
||||
|
@ -252,7 +252,7 @@ Audio2_sound_ret:
|
|||
ret c
|
||||
.skipRewind
|
||||
ld a, [wSavedVolume]
|
||||
ld [rNR50], a
|
||||
ldh [rNR50], a
|
||||
xor a
|
||||
ld [wSavedVolume], a
|
||||
.skipCry
|
||||
|
@ -559,7 +559,7 @@ Audio2_volume:
|
|||
cp $f0 ; is this command a volume?
|
||||
jr nz, Audio2_execute_music ; no
|
||||
call Audio2_GetNextMusicByte
|
||||
ld [rNR50], a ; store volume
|
||||
ldh [rNR50], a ; store volume
|
||||
jp Audio2_sound_ret
|
||||
|
||||
Audio2_execute_music:
|
||||
|
@ -649,7 +649,7 @@ Audio2_pitch_sweep:
|
|||
bit BIT_EXECUTE_MUSIC, [hl]
|
||||
jr nz, Audio2_note ; no
|
||||
call Audio2_GetNextMusicByte
|
||||
ld [rNR10], a
|
||||
ldh [rNR10], a
|
||||
jp Audio2_sound_ret
|
||||
|
||||
Audio2_note:
|
||||
|
@ -781,9 +781,9 @@ Audio2_note_pitch:
|
|||
ld b, 0
|
||||
ld hl, Audio2_HWChannelDisableMasks
|
||||
add hl, bc
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
and [hl]
|
||||
ld [rNR51], a ; disable hardware channel 3's output
|
||||
ldh [rNR51], a ; disable hardware channel 3's output
|
||||
jr .done
|
||||
.notChannel3
|
||||
ld b, REG_VOLUME_ENVELOPE
|
||||
|
@ -855,7 +855,7 @@ Audio2_EnableChannelOutput:
|
|||
ld b, 0
|
||||
ld hl, Audio2_HWChannelEnableMasks
|
||||
add hl, bc
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
or [hl] ; set this channel's bits
|
||||
ld d, a
|
||||
ld a, c
|
||||
|
@ -877,7 +877,7 @@ Audio2_EnableChannelOutput:
|
|||
add hl, bc
|
||||
and [hl]
|
||||
ld d, a
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
ld hl, Audio2_HWChannelDisableMasks
|
||||
add hl, bc
|
||||
and [hl] ; reset this channel's output bits
|
||||
|
@ -885,7 +885,7 @@ Audio2_EnableChannelOutput:
|
|||
ld d, a
|
||||
.skip
|
||||
ld a, d
|
||||
ld [rNR51], a
|
||||
ldh [rNR51], a
|
||||
ret
|
||||
|
||||
Audio2_ApplyDutyCycleAndSoundLength:
|
||||
|
@ -939,7 +939,7 @@ Audio2_ApplyWavePatternAndFrequency:
|
|||
ld hl, rWave_0
|
||||
ld b, $f
|
||||
ld a, $0 ; stop hardware channel 3
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
.loop
|
||||
ld a, [de]
|
||||
inc de
|
||||
|
@ -949,7 +949,7 @@ Audio2_ApplyWavePatternAndFrequency:
|
|||
and a
|
||||
jr nz, .loop
|
||||
ld a, $80 ; start hardware channel 3
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
pop de
|
||||
.notChannel3
|
||||
ld a, d
|
||||
|
@ -1462,17 +1462,17 @@ Audio2_PlaySound::
|
|||
ld a, $ff
|
||||
ld [wStereoPanning], a
|
||||
xor a
|
||||
ld [rNR50], a
|
||||
ldh [rNR50], a
|
||||
ld a, $8
|
||||
ld [rNR10], a
|
||||
ldh [rNR10], a
|
||||
ld a, 0
|
||||
ld [rNR51], a
|
||||
ldh [rNR51], a
|
||||
xor a
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
ld a, $80
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
ld a, $77
|
||||
ld [rNR50], a
|
||||
ldh [rNR50], a
|
||||
jp .playSoundCommon
|
||||
|
||||
.playSfx
|
||||
|
@ -1618,7 +1618,7 @@ Audio2_PlaySound::
|
|||
cp Ch5
|
||||
jr nz, .skipSweepDisable
|
||||
ld a, $8
|
||||
ld [rNR10], a ; sweep off
|
||||
ldh [rNR10], a ; sweep off
|
||||
.skipSweepDisable
|
||||
ld a, c
|
||||
and a
|
||||
|
@ -1628,22 +1628,22 @@ Audio2_PlaySound::
|
|||
|
||||
.stopAllAudio
|
||||
ld a, $80
|
||||
ld [rNR52], a ; sound hardware on
|
||||
ld [rNR30], a ; wave playback on
|
||||
ldh [rNR52], a ; sound hardware on
|
||||
ldh [rNR30], a ; wave playback on
|
||||
xor a
|
||||
ld [rNR51], a ; no sound output
|
||||
ld [rNR32], a ; mute channel 3 (wave channel)
|
||||
ldh [rNR51], a ; no sound output
|
||||
ldh [rNR32], a ; mute channel 3 (wave channel)
|
||||
ld a, $8
|
||||
ld [rNR10], a ; sweep off
|
||||
ld [rNR12], a ; mute channel 1 (pulse channel 1)
|
||||
ld [rNR22], a ; mute channel 2 (pulse channel 2)
|
||||
ld [rNR42], a ; mute channel 4 (noise channel)
|
||||
ldh [rNR10], a ; sweep off
|
||||
ldh [rNR12], a ; mute channel 1 (pulse channel 1)
|
||||
ldh [rNR22], a ; mute channel 2 (pulse channel 2)
|
||||
ldh [rNR42], a ; mute channel 4 (noise channel)
|
||||
ld a, $40
|
||||
ld [rNR14], a ; counter mode
|
||||
ld [rNR24], a
|
||||
ld [rNR44], a
|
||||
ldh [rNR14], a ; counter mode
|
||||
ldh [rNR24], a
|
||||
ldh [rNR44], a
|
||||
ld a, $77
|
||||
ld [rNR50], a ; full volume
|
||||
ldh [rNR50], a ; full volume
|
||||
xor a
|
||||
ld [wUnusedC000], a
|
||||
ld [wDisableChannelOutputWhenSfxEnds], a
|
||||
|
@ -1762,10 +1762,10 @@ Audio2_PlaySound::
|
|||
ld a, [wSavedVolume]
|
||||
and a
|
||||
jr nz, .done
|
||||
ld a, [rNR50]
|
||||
ldh a, [rNR50]
|
||||
ld [wSavedVolume], a
|
||||
ld a, $77
|
||||
ld [rNR50], a ; full volume
|
||||
ldh [rNR50], a ; full volume
|
||||
.done
|
||||
ret
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ Audio3_UpdateMusic::
|
|||
set 7, a
|
||||
ld [wMuteAudioAndPauseMusic], a
|
||||
xor a ; disable all channels' output
|
||||
ld [rNR51], a
|
||||
ld [rNR30], a
|
||||
ldh [rNR51], a
|
||||
ldh [rNR30], a
|
||||
ld a, $80
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
jr .nextChannel
|
||||
.applyAffects
|
||||
call Audio3_ApplyMusicAffects
|
||||
|
@ -183,9 +183,9 @@ Audio3_sound_ret:
|
|||
jr nz, .skipSfxChannel3
|
||||
; restart hardware channel 3 (wave channel) output
|
||||
ld a, $0
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
ld a, $80
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
.skipSfxChannel3
|
||||
jr nz, .dontDisable
|
||||
ld a, [wDisableChannelOutputWhenSfxEnds]
|
||||
|
@ -219,9 +219,9 @@ Audio3_sound_ret:
|
|||
.disableChannelOutput
|
||||
ld hl, Audio3_HWChannelDisableMasks
|
||||
add hl, bc
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
and [hl]
|
||||
ld [rNR51], a
|
||||
ldh [rNR51], a
|
||||
.afterDisable
|
||||
ld a, [wChannelSoundIDs + Ch5]
|
||||
cp CRY_SFX_START
|
||||
|
@ -241,7 +241,7 @@ Audio3_sound_ret:
|
|||
ret c
|
||||
.skipRewind
|
||||
ld a, [wSavedVolume]
|
||||
ld [rNR50], a
|
||||
ldh [rNR50], a
|
||||
xor a
|
||||
ld [wSavedVolume], a
|
||||
.skipCry
|
||||
|
@ -548,7 +548,7 @@ Audio3_volume:
|
|||
cp $f0 ; is this command a volume?
|
||||
jr nz, Audio3_execute_music ; no
|
||||
call Audio3_GetNextMusicByte
|
||||
ld [rNR50], a ; store volume
|
||||
ldh [rNR50], a ; store volume
|
||||
jp Audio3_sound_ret
|
||||
|
||||
Audio3_execute_music:
|
||||
|
@ -638,7 +638,7 @@ Audio3_pitch_sweep:
|
|||
bit BIT_EXECUTE_MUSIC, [hl]
|
||||
jr nz, Audio3_note ; no
|
||||
call Audio3_GetNextMusicByte
|
||||
ld [rNR10], a
|
||||
ldh [rNR10], a
|
||||
jp Audio3_sound_ret
|
||||
|
||||
Audio3_note:
|
||||
|
@ -770,9 +770,9 @@ Audio3_note_pitch:
|
|||
ld b, 0
|
||||
ld hl, Audio3_HWChannelDisableMasks
|
||||
add hl, bc
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
and [hl]
|
||||
ld [rNR51], a ; disable hardware channel 3's output
|
||||
ldh [rNR51], a ; disable hardware channel 3's output
|
||||
jr .done
|
||||
.notChannel3
|
||||
ld b, REG_VOLUME_ENVELOPE
|
||||
|
@ -844,7 +844,7 @@ Audio3_EnableChannelOutput:
|
|||
ld b, 0
|
||||
ld hl, Audio3_HWChannelEnableMasks
|
||||
add hl, bc
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
or [hl] ; set this channel's bits
|
||||
ld d, a
|
||||
ld a, c
|
||||
|
@ -866,7 +866,7 @@ Audio3_EnableChannelOutput:
|
|||
add hl, bc
|
||||
and [hl]
|
||||
ld d, a
|
||||
ld a, [rNR51]
|
||||
ldh a, [rNR51]
|
||||
ld hl, Audio3_HWChannelDisableMasks
|
||||
add hl, bc
|
||||
and [hl] ; reset this channel's output bits
|
||||
|
@ -874,7 +874,7 @@ Audio3_EnableChannelOutput:
|
|||
ld d, a
|
||||
.skip
|
||||
ld a, d
|
||||
ld [rNR51], a
|
||||
ldh [rNR51], a
|
||||
ret
|
||||
|
||||
Audio3_ApplyDutyCycleAndSoundLength:
|
||||
|
@ -928,7 +928,7 @@ Audio3_ApplyWavePatternAndFrequency:
|
|||
ld hl, rWave_0
|
||||
ld b, $f
|
||||
ld a, $0 ; stop hardware channel 3
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
.loop
|
||||
ld a, [de]
|
||||
inc de
|
||||
|
@ -938,7 +938,7 @@ Audio3_ApplyWavePatternAndFrequency:
|
|||
and a
|
||||
jr nz, .loop
|
||||
ld a, $80 ; start hardware channel 3
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
pop de
|
||||
.notChannel3
|
||||
ld a, d
|
||||
|
@ -1399,17 +1399,17 @@ Audio3_PlaySound::
|
|||
ld a, $ff
|
||||
ld [wStereoPanning], a
|
||||
xor a
|
||||
ld [rNR50], a
|
||||
ldh [rNR50], a
|
||||
ld a, $8
|
||||
ld [rNR10], a
|
||||
ldh [rNR10], a
|
||||
ld a, 0
|
||||
ld [rNR51], a
|
||||
ldh [rNR51], a
|
||||
xor a
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
ld a, $80
|
||||
ld [rNR30], a
|
||||
ldh [rNR30], a
|
||||
ld a, $77
|
||||
ld [rNR50], a
|
||||
ldh [rNR50], a
|
||||
jp .playSoundCommon
|
||||
|
||||
.playSfx
|
||||
|
@ -1555,7 +1555,7 @@ Audio3_PlaySound::
|
|||
cp Ch5
|
||||
jr nz, .skipSweepDisable
|
||||
ld a, $8
|
||||
ld [rNR10], a ; sweep off
|
||||
ldh [rNR10], a ; sweep off
|
||||
.skipSweepDisable
|
||||
ld a, c
|
||||
and a
|
||||
|
@ -1565,22 +1565,22 @@ Audio3_PlaySound::
|
|||
|
||||
.stopAllAudio
|
||||
ld a, $80
|
||||
ld [rNR52], a ; sound hardware on
|
||||
ld [rNR30], a ; wave playback on
|
||||
ldh [rNR52], a ; sound hardware on
|
||||
ldh [rNR30], a ; wave playback on
|
||||
xor a
|
||||
ld [rNR51], a ; no sound output
|
||||
ld [rNR32], a ; mute channel 3 (wave channel)
|
||||
ldh [rNR51], a ; no sound output
|
||||
ldh [rNR32], a ; mute channel 3 (wave channel)
|
||||
ld a, $8
|
||||
ld [rNR10], a ; sweep off
|
||||
ld [rNR12], a ; mute channel 1 (pulse channel 1)
|
||||
ld [rNR22], a ; mute channel 2 (pulse channel 2)
|
||||
ld [rNR42], a ; mute channel 4 (noise channel)
|
||||
ldh [rNR10], a ; sweep off
|
||||
ldh [rNR12], a ; mute channel 1 (pulse channel 1)
|
||||
ldh [rNR22], a ; mute channel 2 (pulse channel 2)
|
||||
ldh [rNR42], a ; mute channel 4 (noise channel)
|
||||
ld a, $40
|
||||
ld [rNR14], a ; counter mode
|
||||
ld [rNR24], a
|
||||
ld [rNR44], a
|
||||
ldh [rNR14], a ; counter mode
|
||||
ldh [rNR24], a
|
||||
ldh [rNR44], a
|
||||
ld a, $77
|
||||
ld [rNR50], a ; full volume
|
||||
ldh [rNR50], a ; full volume
|
||||
xor a
|
||||
ld [wUnusedC000], a
|
||||
ld [wDisableChannelOutputWhenSfxEnds], a
|
||||
|
@ -1699,10 +1699,10 @@ Audio3_PlaySound::
|
|||
ld a, [wSavedVolume]
|
||||
and a
|
||||
jr nz, .done
|
||||
ld a, [rNR50]
|
||||
ldh a, [rNR50]
|
||||
ld [wSavedVolume], a
|
||||
ld a, $77
|
||||
ld [rNR50], a ; full volume
|
||||
ldh [rNR50], a ; full volume
|
||||
.done
|
||||
ret
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
PlayPokedexRatingSfx::
|
||||
ld a, [hDexRatingNumMonsOwned]
|
||||
ldh a, [hDexRatingNumMonsOwned]
|
||||
ld c, $0
|
||||
ld hl, OwnedMonValues
|
||||
.getSfxPointer
|
||||
|
|
|
@ -2,9 +2,6 @@ INCLUDE "charmap.asm"
|
|||
|
||||
INCLUDE "macros.asm"
|
||||
|
||||
INCLUDE "hram.asm"
|
||||
INCLUDE "vram.asm"
|
||||
|
||||
INCLUDE "constants/hardware_constants.asm"
|
||||
INCLUDE "constants/oam_constants.asm"
|
||||
INCLUDE "constants/misc_constants.asm"
|
||||
|
|
|
@ -25,10 +25,10 @@
|
|||
const Ch8 ; 7
|
||||
|
||||
; HW sound channel register base addresses
|
||||
HW_CH1_BASE EQU (rNR10 % $100)
|
||||
HW_CH2_BASE EQU ((rNR21 % $100) - 1)
|
||||
HW_CH3_BASE EQU (rNR30 % $100)
|
||||
HW_CH4_BASE EQU ((rNR41 % $100) - 1)
|
||||
HW_CH1_BASE EQU LOW(rNR10)
|
||||
HW_CH2_BASE EQU LOW(rNR21) - 1
|
||||
HW_CH3_BASE EQU LOW(rNR30)
|
||||
HW_CH4_BASE EQU LOW(rNR41) - 1
|
||||
|
||||
; HW sound channel enable bit masks
|
||||
HW_CH1_ENABLE_MASK EQU %00010001
|
||||
|
|
|
@ -21,6 +21,13 @@ MAX_NEUTRAL_DAMAGE EQU 999
|
|||
SONICBOOM_DAMAGE EQU 20
|
||||
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
|
||||
SLP EQU %111 ; sleep counter
|
||||
PSN EQU 3
|
||||
|
@ -28,6 +35,8 @@ BRN EQU 4
|
|||
FRZ EQU 5
|
||||
PAR EQU 6
|
||||
|
||||
MAX_STAT_VALUE EQU 999
|
||||
|
||||
; volatile statuses 1
|
||||
STORING_ENERGY EQU 0 ; Bide
|
||||
THRASHING_ABOUT EQU 1 ; e.g. Thrash
|
||||
|
|
|
@ -20,3 +20,12 @@ SPRITEBUFFERSIZE EQU 7 * 7 * LEN_1BPP_TILE
|
|||
HP_BAR_GREEN EQU 0
|
||||
HP_BAR_YELLOW EQU 1
|
||||
HP_BAR_RED EQU 2
|
||||
|
||||
; hAutoBGTransferEnabled
|
||||
TRANSFERTOP EQU 0
|
||||
TRANSFERMIDDLE EQU 1
|
||||
TRANSFERBOTTOM EQU 2
|
||||
|
||||
; hRedrawRowOrColumnMode
|
||||
REDRAW_COL EQU 1
|
||||
REDRAW_ROW EQU 2
|
||||
|
|
|
@ -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
|
||||
ITEM EQU $80
|
||||
TRAINER EQU $40
|
||||
|
|
|
@ -18,6 +18,6 @@ SPECIAL EQU const_value
|
|||
const WATER ; $15
|
||||
const GRASS ; $16
|
||||
const ELECTRIC ; $17
|
||||
const PSYCHIC ; $18
|
||||
const PSYCHIC_TYPE ; $18
|
||||
const ICE ; $19
|
||||
const DRAGON ; $1A
|
||||
|
|
|
@ -1,140 +1,37 @@
|
|||
mon_icon_header: MACRO
|
||||
dw \1 tile \2
|
||||
db \3
|
||||
db BANK(\1)
|
||||
dw vSprites tile \4
|
||||
ENDM
|
||||
|
||||
MonPartySpritePointers:
|
||||
dw SlowbroSprite + $c0
|
||||
db $40 / $10 ; 40 bytes
|
||||
db BANK(SlowbroSprite)
|
||||
dw vSprites
|
||||
|
||||
dw BallSprite
|
||||
db $80 / $10 ; $80 bytes
|
||||
db BANK(BallSprite)
|
||||
dw vSprites + $40
|
||||
|
||||
dw ClefairySprite + $c0
|
||||
db $40 / $10 ; $40 bytes
|
||||
db BANK(ClefairySprite)
|
||||
dw vSprites + $c0
|
||||
|
||||
dw BirdSprite + $c0
|
||||
db $40 / $10 ; $40 bytes
|
||||
db BANK(BirdSprite)
|
||||
dw vSprites + $100
|
||||
|
||||
dw SeelSprite
|
||||
db $40 / $10 ; $40 bytes
|
||||
db BANK(SeelSprite)
|
||||
dw vSprites + $140
|
||||
|
||||
dw BugIconFrame2
|
||||
db $10 / $10 ; $10 bytes
|
||||
db BANK(BugIconFrame2)
|
||||
dw vSprites + $180
|
||||
|
||||
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
|
||||
; gfx pointer, gfx tile offset, # tiles, vSprites tile offset
|
||||
mon_icon_header SlowbroSprite, 12, 4, $00
|
||||
mon_icon_header BallSprite, 0, 8, $04
|
||||
mon_icon_header ClefairySprite, 12, 4, $0c
|
||||
mon_icon_header BirdSprite, 12, 4, $10
|
||||
mon_icon_header SeelSprite, 0, 4, $14
|
||||
mon_icon_header BugIconFrame2, 0, 1, $18
|
||||
mon_icon_header BugIconFrame2, 1, 1, $1a
|
||||
mon_icon_header PlantIconFrame2, 0, 1, $1c
|
||||
mon_icon_header PlantIconFrame2, 1, 1, $1e
|
||||
mon_icon_header SnakeIconFrame1, 0, 1, $20
|
||||
mon_icon_header SnakeIconFrame1, 1, 1, $22
|
||||
mon_icon_header QuadrupedIconFrame1, 0, 1, $24
|
||||
mon_icon_header QuadrupedIconFrame1, 1, 1, $26
|
||||
mon_icon_header TradeBubbleIconGFX, 0, 4, $38
|
||||
mon_icon_header SlowbroSprite, 0, 4, $40
|
||||
mon_icon_header BallSprite, 0, 8, $44
|
||||
mon_icon_header ClefairySprite, 0, 4, $4c
|
||||
mon_icon_header BirdSprite, 0, 4, $50
|
||||
mon_icon_header SeelSprite, 12, 4, $54
|
||||
mon_icon_header BugIconFrame1, 0, 1, $58
|
||||
mon_icon_header BugIconFrame1, 1, 1, $5a
|
||||
mon_icon_header PlantIconFrame1, 0, 1, $5c
|
||||
mon_icon_header PlantIconFrame1, 1, 1, $5e
|
||||
mon_icon_header SnakeIconFrame2, 0, 1, $60
|
||||
mon_icon_header SnakeIconFrame2, 1, 1, $62
|
||||
mon_icon_header QuadrupedIconFrame2, 0, 1, $64
|
||||
mon_icon_header QuadrupedIconFrame2, 1, 1, $66
|
||||
mon_icon_header TradeBubbleIconGFX, 4, 4, $78
|
||||
|
|
|
@ -70,7 +70,7 @@ MoveEnd:
|
|||
move SURF, NO_ADDITIONAL_EFFECT, 95, WATER, 100, 15
|
||||
move ICE_BEAM, FREEZE_SIDE_EFFECT, 95, ICE, 100, 10
|
||||
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 AURORA_BEAM, ATTACK_DOWN_SIDE_EFFECT, 65, ICE, 100, 20
|
||||
move HYPER_BEAM, HYPER_BEAM_EFFECT, 150, NORMAL, 90, 5
|
||||
|
@ -103,14 +103,14 @@ MoveEnd:
|
|||
move FISSURE, OHKO_EFFECT, 1, GROUND, 30, 5
|
||||
move DIG, CHARGE_EFFECT, 100, GROUND, 100, 10
|
||||
move TOXIC, POISON_EFFECT, 0, POISON, 85, 10
|
||||
move CONFUSION, CONFUSION_SIDE_EFFECT, 50, PSYCHIC, 100, 25
|
||||
move PSYCHIC_M, SPECIAL_DOWN_SIDE_EFFECT, 90, PSYCHIC, 100, 10
|
||||
move HYPNOSIS, SLEEP_EFFECT, 0, PSYCHIC, 60, 20
|
||||
move MEDITATE, ATTACK_UP1_EFFECT, 0, PSYCHIC, 100, 40
|
||||
move AGILITY, SPEED_UP2_EFFECT, 0, PSYCHIC, 100, 30
|
||||
move CONFUSION, CONFUSION_SIDE_EFFECT, 50, PSYCHIC_TYPE, 100, 25
|
||||
move PSYCHIC_M, SPECIAL_DOWN_SIDE_EFFECT, 90, PSYCHIC_TYPE, 100, 10
|
||||
move HYPNOSIS, SLEEP_EFFECT, 0, PSYCHIC_TYPE, 60, 20
|
||||
move MEDITATE, ATTACK_UP1_EFFECT, 0, PSYCHIC_TYPE, 100, 40
|
||||
move AGILITY, SPEED_UP2_EFFECT, 0, PSYCHIC_TYPE, 100, 30
|
||||
move QUICK_ATTACK, NO_ADDITIONAL_EFFECT, 40, NORMAL, 100, 30
|
||||
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 MIMIC, MIMIC_EFFECT, 0, NORMAL, 100, 10
|
||||
move SCREECH, DEFENSE_DOWN2_EFFECT, 0, NORMAL, 85, 40
|
||||
|
@ -122,10 +122,10 @@ MoveEnd:
|
|||
move CONFUSE_RAY, CONFUSION_EFFECT, 0, GHOST, 100, 10
|
||||
move WITHDRAW, DEFENSE_UP1_EFFECT, 0, WATER, 100, 40
|
||||
move DEFENSE_CURL, DEFENSE_UP1_EFFECT, 0, NORMAL, 100, 40
|
||||
move BARRIER, DEFENSE_UP2_EFFECT, 0, PSYCHIC, 100, 30
|
||||
move LIGHT_SCREEN, LIGHT_SCREEN_EFFECT, 0, PSYCHIC, 100, 30
|
||||
move BARRIER, DEFENSE_UP2_EFFECT, 0, PSYCHIC_TYPE, 100, 30
|
||||
move LIGHT_SCREEN, LIGHT_SCREEN_EFFECT, 0, PSYCHIC_TYPE, 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 BIDE, BIDE_EFFECT, 0, NORMAL, 100, 10
|
||||
move METRONOME, METRONOME_EFFECT, 0, NORMAL, 100, 10
|
||||
|
@ -143,12 +143,12 @@ MoveEnd:
|
|||
move SKULL_BASH, CHARGE_EFFECT, 100, 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 AMNESIA, SPECIAL_UP2_EFFECT, 0, PSYCHIC, 100, 20
|
||||
move KINESIS, ACCURACY_DOWN1_EFFECT, 0, PSYCHIC, 80, 15
|
||||
move AMNESIA, SPECIAL_UP2_EFFECT, 0, PSYCHIC_TYPE, 100, 20
|
||||
move KINESIS, ACCURACY_DOWN1_EFFECT, 0, PSYCHIC_TYPE, 80, 15
|
||||
move SOFTBOILED, HEAL_EFFECT, 0, NORMAL, 100, 10
|
||||
move HI_JUMP_KICK, JUMP_KICK_EFFECT, 85, FIGHTING, 90, 20
|
||||
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 BARRAGE, TWO_TO_FIVE_ATTACKS_EFFECT, 15, NORMAL, 85, 20
|
||||
move LEECH_LIFE, DRAIN_HP_EFFECT, 20, BUG, 100, 15
|
||||
|
@ -159,14 +159,14 @@ MoveEnd:
|
|||
move DIZZY_PUNCH, NO_ADDITIONAL_EFFECT, 70, NORMAL, 100, 10
|
||||
move SPORE, SLEEP_EFFECT, 0, GRASS, 100, 15
|
||||
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 ACID_ARMOR, DEFENSE_UP2_EFFECT, 0, POISON, 100, 40
|
||||
move CRABHAMMER, NO_ADDITIONAL_EFFECT, 90, WATER, 85, 10
|
||||
move EXPLOSION, EXPLODE_EFFECT, 170, NORMAL, 100, 5
|
||||
move FURY_SWIPES, TWO_TO_FIVE_ATTACKS_EFFECT, 18, NORMAL, 80, 15
|
||||
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 HYPER_FANG, FLINCH_SIDE_EFFECT1, 80, NORMAL, 90, 15
|
||||
move SHARPEN, ATTACK_UP1_EFFECT, 0, NORMAL, 100, 30
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 25, 20, 15, 90, 105
|
||||
; hp atk def spd spc
|
||||
|
||||
db PSYCHIC, PSYCHIC ; type
|
||||
db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
|
||||
db 200 ; catch rate
|
||||
db 73 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 55, 50, 45, 120, 135
|
||||
; hp atk def spd spc
|
||||
|
||||
db PSYCHIC, PSYCHIC ; type
|
||||
db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
|
||||
db 50 ; catch rate
|
||||
db 186 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 60, 48, 45, 42, 90
|
||||
; hp atk def spd spc
|
||||
|
||||
db PSYCHIC, PSYCHIC ; type
|
||||
db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
|
||||
db 190 ; catch rate
|
||||
db 102 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 60, 40, 80, 40, 60
|
||||
; hp atk def spd spc
|
||||
|
||||
db GRASS, PSYCHIC ; type
|
||||
db GRASS, PSYCHIC_TYPE ; type
|
||||
db 90 ; catch rate
|
||||
db 98 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 95, 95, 85, 55, 125
|
||||
; hp atk def spd spc
|
||||
|
||||
db GRASS, PSYCHIC ; type
|
||||
db GRASS, PSYCHIC_TYPE ; type
|
||||
db 45 ; catch rate
|
||||
db 212 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 85, 73, 70, 67, 115
|
||||
; hp atk def spd spc
|
||||
|
||||
db PSYCHIC, PSYCHIC ; type
|
||||
db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
|
||||
db 75 ; catch rate
|
||||
db 165 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 65, 50, 35, 95, 95
|
||||
; hp atk def spd spc
|
||||
|
||||
db ICE, PSYCHIC ; type
|
||||
db ICE, PSYCHIC_TYPE ; type
|
||||
db 45 ; catch rate
|
||||
db 137 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 40, 35, 30, 105, 120
|
||||
; hp atk def spd spc
|
||||
|
||||
db PSYCHIC, PSYCHIC ; type
|
||||
db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
|
||||
db 100 ; catch rate
|
||||
db 145 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 100, 100, 100, 100, 100
|
||||
; hp atk def spd spc
|
||||
|
||||
db PSYCHIC, PSYCHIC ; type
|
||||
db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
|
||||
db 45 ; catch rate
|
||||
db 64 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 106, 110, 90, 130, 154
|
||||
; hp atk def spd spc
|
||||
|
||||
db PSYCHIC, PSYCHIC ; type
|
||||
db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
|
||||
db 3 ; catch rate
|
||||
db 220 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 40, 45, 65, 90, 100
|
||||
; hp atk def spd spc
|
||||
|
||||
db PSYCHIC, PSYCHIC ; type
|
||||
db PSYCHIC_TYPE, PSYCHIC_TYPE ; type
|
||||
db 45 ; catch rate
|
||||
db 136 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 95, 75, 110, 30, 80
|
||||
; hp atk def spd spc
|
||||
|
||||
db WATER, PSYCHIC ; type
|
||||
db WATER, PSYCHIC_TYPE ; type
|
||||
db 75 ; catch rate
|
||||
db 164 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 90, 65, 65, 15, 40
|
||||
; hp atk def spd spc
|
||||
|
||||
db WATER, PSYCHIC ; type
|
||||
db WATER, PSYCHIC_TYPE ; type
|
||||
db 190 ; catch rate
|
||||
db 99 ; base exp
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
db 60, 75, 85, 115, 100
|
||||
; hp atk def spd spc
|
||||
|
||||
db WATER, PSYCHIC ; type
|
||||
db WATER, PSYCHIC_TYPE ; type
|
||||
db 60 ; catch rate
|
||||
db 207 ; base exp
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
TitleMons:
|
||||
; mons on the title screen are randomly chosen from here
|
||||
IF DEF(_RED)
|
||||
db CHARMANDER
|
||||
db SQUIRTLE
|
||||
db BULBASAUR
|
||||
db STARTER1
|
||||
db STARTER2
|
||||
db STARTER3
|
||||
db WEEDLE
|
||||
db NIDORAN_M
|
||||
db SCYTHER
|
||||
|
@ -19,9 +19,9 @@ IF DEF(_RED)
|
|||
db MAGIKARP
|
||||
ENDC
|
||||
IF DEF(_GREEN)
|
||||
db BULBASAUR
|
||||
db CHARMANDER
|
||||
db SQUIRTLE
|
||||
db STARTER3
|
||||
db STARTER1
|
||||
db STARTER2
|
||||
db CATERPIE
|
||||
db NIDORAN_F
|
||||
db PINSIR
|
||||
|
@ -37,9 +37,9 @@ IF DEF(_GREEN)
|
|||
db MAGIKARP
|
||||
ENDC
|
||||
IF DEF(_BLUE)
|
||||
db SQUIRTLE
|
||||
db CHARMANDER
|
||||
db BULBASAUR
|
||||
db STARTER2
|
||||
db STARTER1
|
||||
db STARTER3
|
||||
db MANKEY
|
||||
db HITMONLEE
|
||||
db VULPIX
|
||||
|
|
|
@ -1,89 +1,85 @@
|
|||
TypeEffects:
|
||||
; format: attacking type, defending type, damage multiplier
|
||||
; the multiplier is a (decimal) fixed-point number:
|
||||
; 20 is ×2.0
|
||||
; 05 is ×0.5
|
||||
; 00 is ×0
|
||||
db WATER,FIRE,20
|
||||
db FIRE,GRASS,20
|
||||
db FIRE,ICE,20
|
||||
db GRASS,WATER,20
|
||||
db ELECTRIC,WATER,20
|
||||
db WATER,ROCK,20
|
||||
db GROUND,FLYING,00
|
||||
db WATER,WATER,05
|
||||
db FIRE,FIRE,05
|
||||
db ELECTRIC,ELECTRIC,05
|
||||
db ICE,ICE,05
|
||||
db GRASS,GRASS,05
|
||||
db PSYCHIC,PSYCHIC,05
|
||||
db FIRE,WATER,05
|
||||
db GRASS,FIRE,05
|
||||
db WATER,GRASS,05
|
||||
db ELECTRIC,GRASS,05
|
||||
db NORMAL,ROCK,05
|
||||
db NORMAL,GHOST,00
|
||||
db GHOST,GHOST,20
|
||||
db FIRE,BUG,20
|
||||
db FIRE,ROCK,05
|
||||
db WATER,GROUND,20
|
||||
db ELECTRIC,GROUND,00
|
||||
db ELECTRIC,FLYING,20
|
||||
db GRASS,GROUND,20
|
||||
db GRASS,BUG,05
|
||||
db GRASS,POISON,05
|
||||
db GRASS,ROCK,20
|
||||
db GRASS,FLYING,05
|
||||
db ICE,WATER,05
|
||||
db ICE,GRASS,20
|
||||
db ICE,GROUND,20
|
||||
db ICE,FLYING,20
|
||||
db FIGHTING,NORMAL,20
|
||||
db FIGHTING,POISON,05
|
||||
db FIGHTING,FLYING,05
|
||||
db FIGHTING,PSYCHIC,05
|
||||
db FIGHTING,BUG,05
|
||||
db FIGHTING,ROCK,20
|
||||
db FIGHTING,ICE,20
|
||||
db FIGHTING,GHOST,00
|
||||
db POISON,GRASS,20
|
||||
db POISON,POISON,05
|
||||
db POISON,GROUND,05
|
||||
db POISON,BUG,20
|
||||
db POISON,ROCK,05
|
||||
db POISON,GHOST,05
|
||||
db GROUND,FIRE,20
|
||||
db GROUND,ELECTRIC,20
|
||||
db GROUND,GRASS,05
|
||||
db GROUND,BUG,05
|
||||
db GROUND,ROCK,20
|
||||
db GROUND,POISON,20
|
||||
db FLYING,ELECTRIC,05
|
||||
db FLYING,FIGHTING,20
|
||||
db FLYING,BUG,20
|
||||
db FLYING,GRASS,20
|
||||
db FLYING,ROCK,05
|
||||
db PSYCHIC,FIGHTING,20
|
||||
db PSYCHIC,POISON,20
|
||||
db BUG,FIRE,05
|
||||
db BUG,GRASS,20
|
||||
db BUG,FIGHTING,05
|
||||
db BUG,FLYING,05
|
||||
db BUG,PSYCHIC,20
|
||||
db BUG,GHOST,05
|
||||
db BUG,POISON,20
|
||||
db ROCK,FIRE,20
|
||||
db ROCK,FIGHTING,05
|
||||
db ROCK,GROUND,05
|
||||
db ROCK,FLYING,20
|
||||
db ROCK,BUG,20
|
||||
db ROCK,ICE,20
|
||||
db GHOST,NORMAL,00
|
||||
db GHOST,PSYCHIC,00
|
||||
db FIRE,DRAGON,05
|
||||
db WATER,DRAGON,05
|
||||
db ELECTRIC,DRAGON,05
|
||||
db GRASS,DRAGON,05
|
||||
db ICE,DRAGON,20
|
||||
db DRAGON,DRAGON,20
|
||||
db $FF
|
||||
; attacker, defender, *=
|
||||
db WATER, FIRE, SUPER_EFFECTIVE
|
||||
db FIRE, GRASS, SUPER_EFFECTIVE
|
||||
db FIRE, ICE, SUPER_EFFECTIVE
|
||||
db GRASS, WATER, SUPER_EFFECTIVE
|
||||
db ELECTRIC, WATER, SUPER_EFFECTIVE
|
||||
db WATER, ROCK, SUPER_EFFECTIVE
|
||||
db GROUND, FLYING, NO_EFFECT
|
||||
db WATER, WATER, NOT_VERY_EFFECTIVE
|
||||
db FIRE, FIRE, NOT_VERY_EFFECTIVE
|
||||
db ELECTRIC, ELECTRIC, NOT_VERY_EFFECTIVE
|
||||
db ICE, ICE, NOT_VERY_EFFECTIVE
|
||||
db GRASS, GRASS, NOT_VERY_EFFECTIVE
|
||||
db PSYCHIC_TYPE, PSYCHIC_TYPE, NOT_VERY_EFFECTIVE
|
||||
db FIRE, WATER, NOT_VERY_EFFECTIVE
|
||||
db GRASS, FIRE, NOT_VERY_EFFECTIVE
|
||||
db WATER, GRASS, NOT_VERY_EFFECTIVE
|
||||
db ELECTRIC, GRASS, NOT_VERY_EFFECTIVE
|
||||
db NORMAL, ROCK, NOT_VERY_EFFECTIVE
|
||||
db NORMAL, GHOST, NO_EFFECT
|
||||
db GHOST, GHOST, SUPER_EFFECTIVE
|
||||
db FIRE, BUG, SUPER_EFFECTIVE
|
||||
db FIRE, ROCK, NOT_VERY_EFFECTIVE
|
||||
db WATER, GROUND, SUPER_EFFECTIVE
|
||||
db ELECTRIC, GROUND, NO_EFFECT
|
||||
db ELECTRIC, FLYING, SUPER_EFFECTIVE
|
||||
db GRASS, GROUND, SUPER_EFFECTIVE
|
||||
db GRASS, BUG, NOT_VERY_EFFECTIVE
|
||||
db GRASS, POISON, NOT_VERY_EFFECTIVE
|
||||
db GRASS, ROCK, SUPER_EFFECTIVE
|
||||
db GRASS, FLYING, NOT_VERY_EFFECTIVE
|
||||
db ICE, WATER, NOT_VERY_EFFECTIVE
|
||||
db ICE, GRASS, SUPER_EFFECTIVE
|
||||
db ICE, GROUND, SUPER_EFFECTIVE
|
||||
db ICE, FLYING, SUPER_EFFECTIVE
|
||||
db FIGHTING, NORMAL, SUPER_EFFECTIVE
|
||||
db FIGHTING, POISON, NOT_VERY_EFFECTIVE
|
||||
db FIGHTING, FLYING, NOT_VERY_EFFECTIVE
|
||||
db FIGHTING, PSYCHIC_TYPE, NOT_VERY_EFFECTIVE
|
||||
db FIGHTING, BUG, NOT_VERY_EFFECTIVE
|
||||
db FIGHTING, ROCK, SUPER_EFFECTIVE
|
||||
db FIGHTING, ICE, SUPER_EFFECTIVE
|
||||
db FIGHTING, GHOST, NO_EFFECT
|
||||
db POISON, GRASS, SUPER_EFFECTIVE
|
||||
db POISON, POISON, NOT_VERY_EFFECTIVE
|
||||
db POISON, GROUND, NOT_VERY_EFFECTIVE
|
||||
db POISON, BUG, SUPER_EFFECTIVE
|
||||
db POISON, ROCK, NOT_VERY_EFFECTIVE
|
||||
db POISON, GHOST, NOT_VERY_EFFECTIVE
|
||||
db GROUND, FIRE, SUPER_EFFECTIVE
|
||||
db GROUND, ELECTRIC, SUPER_EFFECTIVE
|
||||
db GROUND, GRASS, NOT_VERY_EFFECTIVE
|
||||
db GROUND, BUG, NOT_VERY_EFFECTIVE
|
||||
db GROUND, ROCK, SUPER_EFFECTIVE
|
||||
db GROUND, POISON, SUPER_EFFECTIVE
|
||||
db FLYING, ELECTRIC, NOT_VERY_EFFECTIVE
|
||||
db FLYING, FIGHTING, SUPER_EFFECTIVE
|
||||
db FLYING, BUG, SUPER_EFFECTIVE
|
||||
db FLYING, GRASS, SUPER_EFFECTIVE
|
||||
db FLYING, ROCK, NOT_VERY_EFFECTIVE
|
||||
db PSYCHIC_TYPE, FIGHTING, SUPER_EFFECTIVE
|
||||
db PSYCHIC_TYPE, POISON, SUPER_EFFECTIVE
|
||||
db BUG, FIRE, NOT_VERY_EFFECTIVE
|
||||
db BUG, GRASS, SUPER_EFFECTIVE
|
||||
db BUG, FIGHTING, NOT_VERY_EFFECTIVE
|
||||
db BUG, FLYING, NOT_VERY_EFFECTIVE
|
||||
db BUG, PSYCHIC_TYPE, SUPER_EFFECTIVE
|
||||
db BUG, GHOST, NOT_VERY_EFFECTIVE
|
||||
db BUG, POISON, SUPER_EFFECTIVE
|
||||
db ROCK, FIRE, SUPER_EFFECTIVE
|
||||
db ROCK, FIGHTING, NOT_VERY_EFFECTIVE
|
||||
db ROCK, GROUND, NOT_VERY_EFFECTIVE
|
||||
db ROCK, FLYING, SUPER_EFFECTIVE
|
||||
db ROCK, BUG, SUPER_EFFECTIVE
|
||||
db ROCK, ICE, SUPER_EFFECTIVE
|
||||
db GHOST, NORMAL, NO_EFFECT
|
||||
db GHOST, PSYCHIC_TYPE, NO_EFFECT
|
||||
db FIRE, DRAGON, NOT_VERY_EFFECTIVE
|
||||
db WATER, DRAGON, NOT_VERY_EFFECTIVE
|
||||
db ELECTRIC, DRAGON, NOT_VERY_EFFECTIVE
|
||||
db GRASS, DRAGON, NOT_VERY_EFFECTIVE
|
||||
db ICE, DRAGON, SUPER_EFFECTIVE
|
||||
db DRAGON, DRAGON, SUPER_EFFECTIVE
|
||||
db -1 ; end
|
||||
|
|
|
@ -163,7 +163,7 @@ DrawFrameBlock:
|
|||
|
||||
PlayAnimation:
|
||||
xor a
|
||||
ld [hROMBankTemp], a ; it looks like nothing reads this
|
||||
ldh [hROMBankTemp], a ; it looks like nothing reads this
|
||||
ld [wSubAnimTransform], a
|
||||
ld a, [wAnimationID] ; get animation number
|
||||
dec a
|
||||
|
@ -241,15 +241,15 @@ PlayAnimation:
|
|||
ld l, c
|
||||
ld h, b
|
||||
push hl
|
||||
ld a, [rOBP0]
|
||||
ldh a, [rOBP0]
|
||||
push af
|
||||
ld a, [wAnimPalette]
|
||||
ld [rOBP0], a
|
||||
ldh [rOBP0], a
|
||||
call LoadAnimationTileset
|
||||
call LoadSubanimation
|
||||
call PlaySubanimation
|
||||
pop af
|
||||
ld [rOBP0], a
|
||||
ldh [rOBP0], a
|
||||
.nextAnimationCommand
|
||||
pop hl
|
||||
jr .animationLoop
|
||||
|
@ -308,7 +308,7 @@ LoadSubanimation:
|
|||
; sets the transform to the subanimation type if it's the enemy's turn
|
||||
GetSubanimationTransform1:
|
||||
ld b, a
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, b
|
||||
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 0 (i.e. no transform) if it's the enemy's turn
|
||||
GetSubanimationTransform2:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, 2 << 5
|
||||
ret z
|
||||
|
@ -341,7 +341,7 @@ LoadAnimationTileset:
|
|||
ld e, a
|
||||
ld a, [hl]
|
||||
ld d, a ; de = address of tileset
|
||||
ld hl, vSprites + $310
|
||||
ld hl, vSprites tile $31
|
||||
ld b, BANK(AnimationTileset1) ; ROM bank
|
||||
ld a, [wTempTilesetNumTiles]
|
||||
ld c, a ; number of tiles
|
||||
|
@ -373,6 +373,7 @@ ENDC
|
|||
IF DEF(_BLUE)
|
||||
INCBIN "gfx/slots/blue_slots_2.2bpp"
|
||||
ENDC
|
||||
SlotMachineTiles2End:
|
||||
|
||||
MoveAnimation:
|
||||
push hl
|
||||
|
@ -421,11 +422,11 @@ MoveAnimation:
|
|||
|
||||
ShareMoveAnimations:
|
||||
; some moves just reuse animations from status conditions
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ret z
|
||||
|
||||
; opponent’s turn
|
||||
; opponent's turn
|
||||
|
||||
ld a, [wAnimationID]
|
||||
|
||||
|
@ -497,18 +498,18 @@ AnimationShakeScreenHorizontallySlow:
|
|||
push bc
|
||||
push bc
|
||||
.loop1
|
||||
ld a, [rWX]
|
||||
ldh a, [rWX]
|
||||
inc a
|
||||
ld [rWX], a
|
||||
ldh [rWX], a
|
||||
ld c, 2
|
||||
call DelayFrames
|
||||
dec b
|
||||
jr nz, .loop1
|
||||
pop bc
|
||||
.loop2
|
||||
ld a, [rWX]
|
||||
ldh a, [rWX]
|
||||
dec a
|
||||
ld [rWX], a
|
||||
ldh [rWX], a
|
||||
ld c, 2
|
||||
call DelayFrames
|
||||
dec b
|
||||
|
@ -534,16 +535,16 @@ SetAnimationPalette:
|
|||
ld b, $f0
|
||||
.next
|
||||
ld a, b
|
||||
ld [rOBP0], a
|
||||
ldh [rOBP0], a
|
||||
ld a, $6c
|
||||
ld [rOBP1], a
|
||||
ldh [rOBP1], a
|
||||
ret
|
||||
.notSGB
|
||||
ld a, $e4
|
||||
ld [wAnimPalette], a
|
||||
ld [rOBP0], a
|
||||
ldh [rOBP0], a
|
||||
ld a, $6c
|
||||
ld [rOBP1], a
|
||||
ldh [rOBP1], a
|
||||
ret
|
||||
|
||||
PlaySubanimation:
|
||||
|
@ -656,9 +657,9 @@ DoBallTossSpecialEffects:
|
|||
cp 3 ; is it a Master Ball or Ultra Ball?
|
||||
jr nc, .skipFlashingEffect
|
||||
.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
|
||||
ld [rOBP0], a
|
||||
ldh [rOBP0], a
|
||||
.skipFlashingEffect
|
||||
ld a, [wSubAnimCounter]
|
||||
cp 11 ; is it the beginning of the subanimation?
|
||||
|
@ -682,7 +683,7 @@ DoBallTossSpecialEffects:
|
|||
cp 1
|
||||
ret nz
|
||||
.moveGhostMarowakLeft
|
||||
coord hl, 17, 0
|
||||
hlcoord 17, 0
|
||||
ld de, 20
|
||||
lb bc, 7, 7
|
||||
.loop
|
||||
|
@ -695,7 +696,7 @@ DoBallTossSpecialEffects:
|
|||
dec b
|
||||
jr nz, .loop
|
||||
ld a, %00001000
|
||||
ld [rNR10], a ; Channel 1 sweep register
|
||||
ldh [rNR10], a ; Channel 1 sweep register
|
||||
ret
|
||||
.isTrainerBattle ; if it's a trainer battle, shorten the animation by one frame
|
||||
ld a, [wSubAnimCounter]
|
||||
|
@ -781,7 +782,7 @@ DoExplodeSpecialEffects:
|
|||
cp 1 ; is it the end of the subanimation?
|
||||
jr nz, FlashScreenEveryFourFrameBlocks
|
||||
; 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
|
||||
|
||||
; flashes the screen when subanimation counter is 1 modulo 4
|
||||
|
@ -882,9 +883,9 @@ TradeJumpPokeball:
|
|||
ld c, 5
|
||||
call DelayFrames
|
||||
pop bc
|
||||
ld a, [hSCX] ; background scroll X
|
||||
ldh a, [hSCX] ; background scroll X
|
||||
sub 8 ; scroll to the left
|
||||
ld [hSCX], a
|
||||
ldh [hSCX], a
|
||||
pop de
|
||||
jr .loop
|
||||
|
||||
|
@ -920,16 +921,16 @@ AnimationDelay10:
|
|||
; calls a function with the turn flipped from player to enemy or vice versa
|
||||
; input - hl - address of function to call
|
||||
CallWithTurnFlipped:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
push af
|
||||
xor 1
|
||||
ld [hWhoseTurn], a
|
||||
ldh [hWhoseTurn], a
|
||||
ld de, .returnAddress
|
||||
push de
|
||||
jp hl
|
||||
.returnAddress
|
||||
pop af
|
||||
ld [hWhoseTurn], a
|
||||
ldh [hWhoseTurn], a
|
||||
ret
|
||||
|
||||
; flashes the screen for an extended period (48 frames)
|
||||
|
@ -947,7 +948,7 @@ AnimationFlashScreenLong:
|
|||
ld a, [hli]
|
||||
cp $01 ; is it the end of the palettes?
|
||||
jr z, .endOfPalettes
|
||||
ld [rBGP], a
|
||||
ldh [rBGP], a
|
||||
call FlashScreenLongDelay
|
||||
jr .innerLoop
|
||||
.endOfPalettes
|
||||
|
@ -1006,18 +1007,18 @@ FlashScreenLongDelay:
|
|||
jp DelayFrames
|
||||
|
||||
AnimationFlashScreen:
|
||||
ld a, [rBGP]
|
||||
ldh a, [rBGP]
|
||||
push af ; save initial palette
|
||||
ld a, %00011011 ; 0, 1, 2, 3 (inverted colors)
|
||||
ld [rBGP], a
|
||||
ldh [rBGP], a
|
||||
ld c, 2
|
||||
call DelayFrames
|
||||
xor a ; white out background
|
||||
ld [rBGP], a
|
||||
ldh [rBGP], a
|
||||
ld c, 2
|
||||
call DelayFrames
|
||||
pop af
|
||||
ld [rBGP], a ; restore initial palette
|
||||
ldh [rBGP], a ; restore initial palette
|
||||
ret
|
||||
|
||||
AnimationDarkScreenPalette:
|
||||
|
@ -1062,7 +1063,7 @@ SetAnimationBGPalette:
|
|||
jr z, .next
|
||||
ld a, c
|
||||
.next
|
||||
ld [rBGP], a
|
||||
ldh [rBGP], a
|
||||
ret
|
||||
|
||||
ld b, $5
|
||||
|
@ -1133,14 +1134,14 @@ _AnimationWaterDroplets:
|
|||
AnimationSlideMonUp:
|
||||
; Slides the mon's sprite upwards.
|
||||
ld c, 7
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 1, 6
|
||||
coord de, 1, 5
|
||||
hlcoord 1, 6
|
||||
decoord 1, 5
|
||||
ld a, $30
|
||||
jr z, .next
|
||||
coord hl, 12, 1
|
||||
coord de, 12, 0
|
||||
hlcoord 12, 1
|
||||
decoord 12, 0
|
||||
ld a, $ff
|
||||
.next
|
||||
ld [wSlideMonUpBottomRowLeftTile], a
|
||||
|
@ -1201,11 +1202,11 @@ _AnimationSlideMonUp:
|
|||
jr nz, .slideLoop
|
||||
|
||||
; Fill in the bottom row of the mon pic with the next row's tile IDs.
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 1, 11
|
||||
hlcoord 1, 11
|
||||
jr z, .next
|
||||
coord hl, 12, 6
|
||||
hlcoord 12, 6
|
||||
.next
|
||||
ld a, [wSlideMonUpBottomRowLeftTile]
|
||||
inc a
|
||||
|
@ -1370,13 +1371,13 @@ AnimationShowEnemyMonPic:
|
|||
AnimationShakeBackAndForth:
|
||||
; Shakes the mon's sprite back and forth rapidly. This is used in Double Team.
|
||||
; The mon's sprite disappears after this animation.
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 0, 5
|
||||
coord de, 2, 5
|
||||
hlcoord 0, 5
|
||||
decoord 2, 5
|
||||
jr z, .next
|
||||
coord hl, 11, 0
|
||||
coord de, 13, 0
|
||||
hlcoord 11, 0
|
||||
decoord 13, 0
|
||||
|
||||
.next
|
||||
xor a
|
||||
|
@ -1418,11 +1419,11 @@ AnimationMoveMonHorizontally:
|
|||
; Shifts the mon's sprite horizontally to a fixed location. Used by lots of
|
||||
; animations like Tackle/Body Slam.
|
||||
call AnimationHideMonPic
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 2, 5
|
||||
hlcoord 2, 5
|
||||
jr z, .next
|
||||
coord hl, 11, 0
|
||||
hlcoord 11, 0
|
||||
.next
|
||||
xor a
|
||||
push hl
|
||||
|
@ -1434,7 +1435,7 @@ AnimationMoveMonHorizontally:
|
|||
|
||||
AnimationResetMonPosition:
|
||||
; Resets the mon's sprites to be located at the normal coordinates.
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, 5 * SCREEN_WIDTH + 2
|
||||
jr z, .next
|
||||
|
@ -1446,7 +1447,7 @@ AnimationResetMonPosition:
|
|||
AnimationSpiralBallsInward:
|
||||
; Creates an effect that looks like energy balls spiralling into the
|
||||
; player mon's sprite. Used in Focus Energy, for example.
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
ld a, -40
|
||||
|
@ -1530,15 +1531,15 @@ AnimationSquishMonPic:
|
|||
ld c, 4
|
||||
.loop
|
||||
push bc
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
coord hl, 16, 0
|
||||
coord de, 14, 0
|
||||
hlcoord 16, 0
|
||||
decoord 14, 0
|
||||
jr .next
|
||||
.playerTurn
|
||||
coord hl, 5, 5
|
||||
coord de, 3, 5
|
||||
hlcoord 5, 5
|
||||
decoord 3, 5
|
||||
.next
|
||||
push de
|
||||
xor a ; left
|
||||
|
@ -1583,7 +1584,7 @@ _AnimationSquishMonPic:
|
|||
AnimationShootBallsUpward:
|
||||
; Shoots one pillar of "energy" balls upwards. Used in Teleport/Sky Attack
|
||||
; animations.
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
lb bc, 0, 16 * 8
|
||||
|
@ -1651,7 +1652,7 @@ _AnimationShootBallsUpward:
|
|||
|
||||
AnimationShootManyBallsUpward:
|
||||
; Shoots several pillars of "energy" balls upward.
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, UpwardBallsAnimXCoordinatesPlayerTurn
|
||||
ld a, $50 ; y coordinate for "energy" ball pillar
|
||||
|
@ -1743,13 +1744,13 @@ AnimationSlideMonDownAndHide:
|
|||
_AnimationSlideMonOff:
|
||||
; 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.
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
coord hl, 12, 0
|
||||
hlcoord 12, 0
|
||||
jr .next
|
||||
.playerTurn
|
||||
coord hl, 0, 5
|
||||
hlcoord 0, 5
|
||||
.next
|
||||
ld d, 8 ; d's value is unused
|
||||
.slideLoop ; iterates once for each time the pic slides by one tile
|
||||
|
@ -1758,7 +1759,7 @@ _AnimationSlideMonOff:
|
|||
.rowLoop ; iterates once for each row
|
||||
ld c, 8
|
||||
.tileLoop ; iterates once for each tile in the row
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn2
|
||||
call .EnemyNextTile
|
||||
|
@ -1821,7 +1822,7 @@ AnimationSlideMonHalfOff:
|
|||
jp Delay3
|
||||
|
||||
CopyTempPicToMonPic:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, vBackPic ; player turn
|
||||
jr z, .next
|
||||
|
@ -1837,9 +1838,9 @@ AnimationWavyScreen:
|
|||
call BattleAnimCopyTileMapToVRAM
|
||||
call Delay3
|
||||
xor a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
ld a, SCREEN_HEIGHT_PX
|
||||
ld [hWY], a
|
||||
ldh [hWY], a
|
||||
ld d, $80 ; terminator
|
||||
ld e, SCREEN_HEIGHT_PX - 1
|
||||
ld c, $ff
|
||||
|
@ -1848,7 +1849,7 @@ AnimationWavyScreen:
|
|||
push hl
|
||||
.innerLoop
|
||||
call WavyScreen_SetSCX
|
||||
ld a, [rLY]
|
||||
ldh a, [rLY]
|
||||
cp e ; is it the last visible line in the frame?
|
||||
jr nz, .innerLoop ; keep going if not
|
||||
pop hl
|
||||
|
@ -1861,11 +1862,11 @@ AnimationWavyScreen:
|
|||
dec c
|
||||
jr nz, .loop
|
||||
xor a
|
||||
ld [hWY], a
|
||||
ldh [hWY], a
|
||||
call SaveScreenTilesToBuffer2
|
||||
call ClearScreen
|
||||
ld a, 1
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
call LoadScreenTilesFromBuffer2
|
||||
ld hl, vBGMap1
|
||||
|
@ -1873,11 +1874,11 @@ AnimationWavyScreen:
|
|||
ret
|
||||
|
||||
WavyScreen_SetSCX:
|
||||
ld a, [rSTAT]
|
||||
ldh a, [rSTAT]
|
||||
and $3 ; is it H-blank?
|
||||
jr nz, WavyScreen_SetSCX ; wait until it's H-blank
|
||||
ld a, [hl]
|
||||
ld [rSCX], a
|
||||
ldh [rSCX], a
|
||||
inc hl
|
||||
ld a, [hl]
|
||||
cp d ; have we reached the end?
|
||||
|
@ -1898,7 +1899,7 @@ AnimationSubstitute:
|
|||
xor a
|
||||
ld bc, $310
|
||||
call FillMemory
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
ld hl, SlowbroSprite ; facing down sprite
|
||||
|
@ -1937,7 +1938,7 @@ CopySlowbroSpriteData:
|
|||
jp FarCopyData2
|
||||
|
||||
HideSubstituteShowMonAnim:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wPlayerMonMinimized
|
||||
ld a, [wPlayerBattleStatus2]
|
||||
|
@ -1987,7 +1988,7 @@ AnimationTransformMon:
|
|||
ld [wChangeMonPicEnemyTurnSpecies], a
|
||||
|
||||
ChangeMonPic:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
ld a, [wChangeMonPicEnemyTurnSpecies]
|
||||
|
@ -1996,7 +1997,7 @@ ChangeMonPic:
|
|||
xor a
|
||||
ld [wSpriteFlipped], a
|
||||
call GetMonHeader
|
||||
coord hl, 12, 0
|
||||
hlcoord 12, 0
|
||||
call LoadFrontSpriteByMonIndex
|
||||
jr .done
|
||||
.playerTurn
|
||||
|
@ -2020,11 +2021,11 @@ ChangeMonPic:
|
|||
AnimationHideEnemyMonPic:
|
||||
; Hides the enemy mon's sprite
|
||||
xor a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
ld hl, AnimationHideMonPic
|
||||
call CallWithTurnFlipped
|
||||
ld a, $1
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
jp Delay3
|
||||
|
||||
InitMultipleObjectsOAM:
|
||||
|
@ -2050,7 +2051,7 @@ InitMultipleObjectsOAM:
|
|||
|
||||
AnimationHideMonPic:
|
||||
; Hides the mon's sprite.
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
ld a, 12
|
||||
|
@ -2064,7 +2065,7 @@ ClearMonPicFromTileMap:
|
|||
push bc
|
||||
ld e, a
|
||||
ld d, 0
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
add hl, de
|
||||
lb bc, 7, 7
|
||||
call ClearScreenArea
|
||||
|
@ -2078,7 +2079,7 @@ ClearMonPicFromTileMap:
|
|||
; in order to show only a portion of the mon sprite.
|
||||
GetMonSpriteTileMapPointerFromRowCount:
|
||||
push de
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .enemyTurn
|
||||
ld a, 20 * 5 + 1
|
||||
|
@ -2086,7 +2087,7 @@ GetMonSpriteTileMapPointerFromRowCount:
|
|||
.enemyTurn
|
||||
ld a, 12
|
||||
.next
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
ld e, a
|
||||
ld d, 0
|
||||
add hl, de
|
||||
|
@ -2166,7 +2167,7 @@ GetMoveSound:
|
|||
ld b, a
|
||||
call IsCryMove
|
||||
jr nc, .NotCryMove
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .next
|
||||
ld a, [wBattleMonSpecies] ; get number of current monster
|
||||
|
@ -2211,14 +2212,14 @@ IsCryMove:
|
|||
INCLUDE "data/moves/sfx.asm"
|
||||
|
||||
CopyPicTiles:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, $31 ; base tile ID of player mon sprite
|
||||
jr z, .next
|
||||
; enemy turn
|
||||
xor a ; base tile ID of enemy mon sprite
|
||||
.next
|
||||
ld [hBaseTileID], a
|
||||
ldh [hBaseTileID], a
|
||||
jr CopyTileIDs_NoBGTransfer
|
||||
|
||||
; copy the tiles used when a mon is being sent out of or into a pokeball
|
||||
|
@ -2235,7 +2236,7 @@ CopyDownscaledMonTiles:
|
|||
|
||||
CopyTileIDs_NoBGTransfer:
|
||||
xor a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
; fall through
|
||||
|
||||
; b = number of rows
|
||||
|
@ -2245,7 +2246,7 @@ CopyTileIDs:
|
|||
.rowLoop
|
||||
push bc
|
||||
push hl
|
||||
ld a, [hBaseTileID]
|
||||
ldh a, [hBaseTileID]
|
||||
ld b, a
|
||||
.columnLoop
|
||||
ld a, [de]
|
||||
|
@ -2261,7 +2262,7 @@ CopyTileIDs:
|
|||
dec b
|
||||
jr nz, .rowLoop
|
||||
ld a, $1
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
pop hl
|
||||
ret
|
||||
|
||||
|
@ -2361,16 +2362,16 @@ Unknown_79c50:
|
|||
AnimationLeavesFalling:
|
||||
; Makes leaves float down from the top of the screen. This is used
|
||||
; in Razor Leaf's animation.
|
||||
ld a, [rOBP0]
|
||||
ldh a, [rOBP0]
|
||||
push af
|
||||
ld a, [wAnimPalette]
|
||||
ld [rOBP0], a
|
||||
ldh [rOBP0], a
|
||||
ld d, $37 ; leaf tile
|
||||
ld a, 3 ; number of leaves
|
||||
ld [wNumFallingObjects], a
|
||||
call AnimationFallingObjects
|
||||
pop af
|
||||
ld [rOBP0], a
|
||||
ldh [rOBP0], a
|
||||
ret
|
||||
|
||||
AnimationPetalsFalling:
|
||||
|
@ -2529,7 +2530,7 @@ AnimationShakeEnemyHUD:
|
|||
call CopyVideoData
|
||||
|
||||
xor a
|
||||
ld [hSCX], a
|
||||
ldh [hSCX], a
|
||||
|
||||
; 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.
|
||||
|
@ -2539,7 +2540,7 @@ AnimationShakeEnemyHUD:
|
|||
; 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.
|
||||
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
|
||||
; 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
|
||||
; was there before.
|
||||
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
|
||||
; function shows up on screen. We need this because the back pic's Y coordinates
|
||||
|
@ -2576,11 +2577,11 @@ AnimationShakeEnemyHUD:
|
|||
call AnimationShowMonPic
|
||||
call ClearSprites
|
||||
ld a, SCREEN_HEIGHT_PX
|
||||
ld [hWY], a
|
||||
ldh [hWY], a
|
||||
ld hl, vBGMap1
|
||||
call BattleAnimCopyTileMapToVRAM
|
||||
xor a
|
||||
ld [hWY], a
|
||||
ldh [hWY], a
|
||||
call SaveScreenTilesToBuffer1
|
||||
ld hl, vBGMap0
|
||||
call BattleAnimCopyTileMapToVRAM
|
||||
|
@ -2595,7 +2596,7 @@ AnimationShakeEnemyHUD:
|
|||
CopyTileIDsFromList:
|
||||
call GetPredefRegisters
|
||||
ld a, c
|
||||
ld [hBaseTileID], a
|
||||
ldh [hBaseTileID], a
|
||||
ld a, b
|
||||
push hl
|
||||
call GetTileIDList
|
||||
|
@ -2603,30 +2604,30 @@ CopyTileIDsFromList:
|
|||
jp CopyTileIDs
|
||||
|
||||
ShakeEnemyHUD_ShakeBG:
|
||||
ld a, [hSCX]
|
||||
ldh a, [hSCX]
|
||||
ld [wTempSCX], a
|
||||
.loop
|
||||
ld a, [wTempSCX]
|
||||
add d
|
||||
ld [hSCX], a
|
||||
ldh [hSCX], a
|
||||
ld c, 2
|
||||
call DelayFrames
|
||||
ld a, [wTempSCX]
|
||||
sub d
|
||||
ld [hSCX], a
|
||||
ldh [hSCX], a
|
||||
ld c, 2
|
||||
call DelayFrames
|
||||
dec e
|
||||
jr nz, .loop
|
||||
ld a, [wTempSCX]
|
||||
ld [hSCX], a
|
||||
ldh [hSCX], a
|
||||
ret
|
||||
|
||||
BattleAnimCopyTileMapToVRAM:
|
||||
ld a, h
|
||||
ld [hAutoBGTransferDest + 1], a
|
||||
ldh [hAutoBGTransferDest + 1], a
|
||||
ld a, l
|
||||
ld [hAutoBGTransferDest], a
|
||||
ldh [hAutoBGTransferDest], a
|
||||
jp Delay3
|
||||
|
||||
TossBallAnimation:
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
BattleTransition:
|
||||
ld a, 1
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
xor a
|
||||
ld [hWY], a
|
||||
ldh [hWY], a
|
||||
dec a
|
||||
ld [wUpdateSpritesEnabled], a
|
||||
call DelayFrame
|
||||
|
@ -11,7 +11,7 @@ BattleTransition:
|
|||
; Determine which OAM block is being used by the enemy trainer sprite (if there
|
||||
; is one).
|
||||
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 b, 0
|
||||
ld de, $10
|
||||
|
@ -154,20 +154,18 @@ GetBattleTransitionID_IsDungeonMap:
|
|||
INCLUDE "data/maps/dungeon_maps.asm"
|
||||
|
||||
LoadBattleTransitionTile:
|
||||
ld hl, vChars1 + $7f0
|
||||
ld hl, vChars1 tile $7f
|
||||
ld de, BattleTransitionTile
|
||||
lb bc, BANK(BattleTransitionTile), (BattleTransitionTileEnd - BattleTransitionTile) / $10
|
||||
lb bc, BANK(BattleTransitionTile), 1
|
||||
jp CopyVideoData
|
||||
|
||||
BattleTransitionTile:
|
||||
INCBIN "gfx/overworld/battle_transition.2bpp"
|
||||
BattleTransitionTileEnd:
|
||||
BattleTransitionTile: INCBIN "gfx/overworld/battle_transition.2bpp"
|
||||
|
||||
BattleTransition_BlackScreen:
|
||||
ld a, $ff
|
||||
ld [rBGP], a
|
||||
ld [rOBP0], a
|
||||
ld [rOBP1], a
|
||||
ldh [rBGP], a
|
||||
ldh [rOBP0], a
|
||||
ldh [rOBP1], a
|
||||
ret
|
||||
|
||||
; for non-dungeon trainer battles
|
||||
|
@ -181,7 +179,7 @@ BattleTransition_Spiral:
|
|||
call BattleTransition_InwardSpiral
|
||||
jr .done
|
||||
.outwardSpiral
|
||||
coord hl, 10, 10
|
||||
hlcoord 10, 10
|
||||
ld a, $3
|
||||
ld [wOutwardSpiralCurrentDirection], a
|
||||
ld a, l
|
||||
|
@ -210,7 +208,7 @@ BattleTransition_Spiral:
|
|||
BattleTransition_InwardSpiral:
|
||||
ld a, 7
|
||||
ld [wInwardSpiralUpdateScreenCounter], a
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
ld c, SCREEN_HEIGHT - 1
|
||||
ld de, SCREEN_WIDTH
|
||||
call BattleTransition_InwardSpiral_
|
||||
|
@ -330,7 +328,7 @@ BattleTransition_FlashScreen_:
|
|||
ld a, [hli]
|
||||
cp $1
|
||||
jr z, .done
|
||||
ld [rBGP], a
|
||||
ldh [rBGP], a
|
||||
ld c, 2
|
||||
call DelayFrames
|
||||
jr .loop
|
||||
|
@ -349,25 +347,25 @@ BattleTransition_Shrink:
|
|||
.loop
|
||||
push bc
|
||||
xor a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
coord hl, 0, 7
|
||||
coord de, 0, 8
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
hlcoord 0, 7
|
||||
decoord 0, 8
|
||||
ld bc, -SCREEN_WIDTH * 2
|
||||
call BattleTransition_CopyTiles1
|
||||
coord hl, 0, 10
|
||||
coord de, 0, 9
|
||||
hlcoord 0, 10
|
||||
decoord 0, 9
|
||||
ld bc, SCREEN_WIDTH * 2
|
||||
call BattleTransition_CopyTiles1
|
||||
coord hl, 8, 0
|
||||
coord de, 9, 0
|
||||
hlcoord 8, 0
|
||||
decoord 9, 0
|
||||
ld bc, -2
|
||||
call BattleTransition_CopyTiles2
|
||||
coord hl, 11, 0
|
||||
coord de, 10, 0
|
||||
hlcoord 11, 0
|
||||
decoord 10, 0
|
||||
ld bc, 2
|
||||
call BattleTransition_CopyTiles2
|
||||
ld a, $1
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
ld c, 6
|
||||
call DelayFrames
|
||||
pop bc
|
||||
|
@ -381,23 +379,23 @@ BattleTransition_Shrink:
|
|||
BattleTransition_Split:
|
||||
ld c, SCREEN_HEIGHT / 2
|
||||
xor a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
.loop
|
||||
push bc
|
||||
coord hl, 0, 16
|
||||
coord de, 0, 17
|
||||
hlcoord 0, 16
|
||||
decoord 0, 17
|
||||
ld bc, -SCREEN_WIDTH * 2
|
||||
call BattleTransition_CopyTiles1
|
||||
coord hl, 0, 1
|
||||
coord de, 0, 0
|
||||
hlcoord 0, 1
|
||||
decoord 0, 0
|
||||
ld bc, SCREEN_WIDTH * 2
|
||||
call BattleTransition_CopyTiles1
|
||||
coord hl, 18, 0
|
||||
coord de, 19, 0
|
||||
hlcoord 18, 0
|
||||
decoord 19, 0
|
||||
ld bc, -2
|
||||
call BattleTransition_CopyTiles2
|
||||
coord hl, 1, 0
|
||||
coord de, 0, 0
|
||||
hlcoord 1, 0
|
||||
decoord 0, 0
|
||||
ld bc, 2
|
||||
call BattleTransition_CopyTiles2
|
||||
call BattleTransition_TransferDelay3
|
||||
|
@ -493,10 +491,10 @@ BattleTransition_CopyTiles2:
|
|||
; used for high level wild dungeon battles
|
||||
BattleTransition_VerticalStripes:
|
||||
ld c, SCREEN_HEIGHT
|
||||
coord hl, 0, 0
|
||||
coord de, 1, 17
|
||||
hlcoord 0, 0
|
||||
decoord 1, 17
|
||||
xor a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
.loop
|
||||
push bc
|
||||
push hl
|
||||
|
@ -532,10 +530,10 @@ BattleTransition_VerticalStripes_:
|
|||
; used for low level wild dungeon battles
|
||||
BattleTransition_HorizontalStripes:
|
||||
ld c, SCREEN_WIDTH
|
||||
coord hl, 0, 0
|
||||
coord de, 19, 1
|
||||
hlcoord 0, 0
|
||||
decoord 19, 1
|
||||
xor a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
.loop
|
||||
push bc
|
||||
push hl
|
||||
|
@ -582,7 +580,7 @@ BattleTransition_FlashScreen:
|
|||
ld b, $3
|
||||
call BattleTransition_FlashScreen_
|
||||
xor a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
ret
|
||||
|
||||
BattleTransition_Circle_Sub1:
|
||||
|
@ -601,10 +599,10 @@ BattleTransition_Circle_Sub1:
|
|||
|
||||
BattleTransition_TransferDelay3:
|
||||
ld a, 1
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
xor a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
ret
|
||||
|
||||
; used for low level wild non-dungeon battles
|
||||
|
@ -654,84 +652,84 @@ BattleTransition_Circle_Sub2:
|
|||
BattleTransition_HalfCircle1:
|
||||
db $01
|
||||
dw BattleTransition_CircleData1
|
||||
dwCoord 18, 6
|
||||
dwcoord 18, 6
|
||||
|
||||
db $01
|
||||
dw BattleTransition_CircleData2
|
||||
dwCoord 19, 3
|
||||
dwcoord 19, 3
|
||||
|
||||
db $01
|
||||
dw BattleTransition_CircleData3
|
||||
dwCoord 18, 0
|
||||
dwcoord 18, 0
|
||||
|
||||
db $01
|
||||
dw BattleTransition_CircleData4
|
||||
dwCoord 14, 0
|
||||
dwcoord 14, 0
|
||||
|
||||
db $01
|
||||
dw BattleTransition_CircleData5
|
||||
dwCoord 10, 0
|
||||
dwcoord 10, 0
|
||||
|
||||
db $00
|
||||
dw BattleTransition_CircleData5
|
||||
dwCoord 9, 0
|
||||
dwcoord 9, 0
|
||||
|
||||
db $00
|
||||
dw BattleTransition_CircleData4
|
||||
dwCoord 5, 0
|
||||
dwcoord 5, 0
|
||||
|
||||
db $00
|
||||
dw BattleTransition_CircleData3
|
||||
dwCoord 1, 0
|
||||
dwcoord 1, 0
|
||||
|
||||
db $00
|
||||
dw BattleTransition_CircleData2
|
||||
dwCoord 0, 3
|
||||
dwcoord 0, 3
|
||||
|
||||
db $00
|
||||
dw BattleTransition_CircleData1
|
||||
dwCoord 1, 6
|
||||
dwcoord 1, 6
|
||||
|
||||
BattleTransition_HalfCircle2:
|
||||
db $00
|
||||
dw BattleTransition_CircleData1
|
||||
dwCoord 1, 11
|
||||
dwcoord 1, 11
|
||||
|
||||
db $00
|
||||
dw BattleTransition_CircleData2
|
||||
dwCoord 0, 14
|
||||
dwcoord 0, 14
|
||||
|
||||
db $00
|
||||
dw BattleTransition_CircleData3
|
||||
dwCoord 1, 17
|
||||
dwcoord 1, 17
|
||||
|
||||
db $00
|
||||
dw BattleTransition_CircleData4
|
||||
dwCoord 5, 17
|
||||
dwcoord 5, 17
|
||||
|
||||
db $00
|
||||
dw BattleTransition_CircleData5
|
||||
dwCoord 9, 17
|
||||
dwcoord 9, 17
|
||||
|
||||
db $01
|
||||
dw BattleTransition_CircleData5
|
||||
dwCoord 10, 17
|
||||
dwcoord 10, 17
|
||||
|
||||
db $01
|
||||
dw BattleTransition_CircleData4
|
||||
dwCoord 14, 17
|
||||
dwcoord 14, 17
|
||||
|
||||
db $01
|
||||
dw BattleTransition_CircleData3
|
||||
dwCoord 18, 17
|
||||
dwcoord 18, 17
|
||||
|
||||
db $01
|
||||
dw BattleTransition_CircleData2
|
||||
dwCoord 19, 14
|
||||
dwcoord 19, 14
|
||||
|
||||
db $01
|
||||
dw BattleTransition_CircleData1
|
||||
dwCoord 18, 11
|
||||
dwcoord 18, 11
|
||||
|
||||
BattleTransition_Circle_Sub3:
|
||||
push hl
|
||||
|
|
|
@ -24,7 +24,7 @@ PrintBeginningBattleText:
|
|||
ld hl, TrainerWantsToFightText
|
||||
.wildBattle
|
||||
push hl
|
||||
callab DrawAllPokeballs
|
||||
callfar DrawAllPokeballs
|
||||
pop hl
|
||||
call PrintText
|
||||
jr .done
|
||||
|
@ -38,7 +38,7 @@ PrintBeginningBattleText:
|
|||
ld a, b
|
||||
and a
|
||||
jr z, .noSilphScope
|
||||
callab LoadEnemyMonData
|
||||
callfar LoadEnemyMonData
|
||||
jr .notPokemonTower
|
||||
.noSilphScope
|
||||
ld hl, EnemyAppearedText
|
||||
|
@ -54,8 +54,8 @@ PrintBeginningBattleText:
|
|||
call PrintText
|
||||
ld hl, UnveiledGhostText
|
||||
call PrintText
|
||||
callab LoadEnemyMonData
|
||||
callab MarowakAnim
|
||||
callfar LoadEnemyMonData
|
||||
callfar MarowakAnim
|
||||
ld hl, WildMonAppearedText
|
||||
call PrintText
|
||||
|
||||
|
@ -101,16 +101,16 @@ PrintSendOutMonMessage:
|
|||
ld hl, GoText
|
||||
jr z, .printText
|
||||
xor a
|
||||
ld [hMultiplicand], a
|
||||
ldh [hMultiplicand], a
|
||||
ld hl, wEnemyMonHP
|
||||
ld a, [hli]
|
||||
ld [wLastSwitchInEnemyMonHP], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ldh [hMultiplicand + 1], a
|
||||
ld a, [hl]
|
||||
ld [wLastSwitchInEnemyMonHP + 1], a
|
||||
ld [hMultiplicand + 2], a
|
||||
ldh [hMultiplicand + 2], a
|
||||
ld a, 25
|
||||
ld [hMultiplier], a
|
||||
ldh [hMultiplier], a
|
||||
call Multiply
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [hli]
|
||||
|
@ -121,9 +121,9 @@ PrintSendOutMonMessage:
|
|||
rr b
|
||||
ld a, b
|
||||
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
|
||||
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
|
||||
cp 70
|
||||
jr nc, .printText
|
||||
|
@ -179,14 +179,14 @@ PlayerMon2Text:
|
|||
dec hl
|
||||
ld a, [de]
|
||||
sub b
|
||||
ld [hMultiplicand + 2], a
|
||||
ldh [hMultiplicand + 2], a
|
||||
dec de
|
||||
ld b, [hl]
|
||||
ld a, [de]
|
||||
sbc b
|
||||
ld [hMultiplicand + 1], a
|
||||
ldh [hMultiplicand + 1], a
|
||||
ld a, 25
|
||||
ld [hMultiplier], a
|
||||
ldh [hMultiplier], a
|
||||
call Multiply
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [hli]
|
||||
|
@ -197,11 +197,11 @@ PlayerMon2Text:
|
|||
rr b
|
||||
ld a, b
|
||||
ld b, 4
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
call Divide
|
||||
pop bc
|
||||
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,
|
||||
; a approximates the percentage that the enemy mon's total HP has decreased
|
||||
; since the last switch in.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -12,7 +12,7 @@ DrawEnemyPokeballs:
|
|||
|
||||
LoadPartyPokeballGfx:
|
||||
ld de, PokeballTileGraphics
|
||||
ld hl, vSprites + $310
|
||||
ld hl, vSprites tile $31
|
||||
lb bc, BANK(PokeballTileGraphics), (PokeballTileGraphicsEnd - PokeballTileGraphics) / $10
|
||||
jp CopyVideoData
|
||||
|
||||
|
@ -121,7 +121,7 @@ PlacePlayerHUDTiles:
|
|||
ld de, wHUDGraphicsTiles
|
||||
ld bc, $3
|
||||
call CopyData
|
||||
coord hl, 18, 10
|
||||
hlcoord 18, 10
|
||||
ld de, -1
|
||||
jr PlaceHUDTiles
|
||||
|
||||
|
@ -136,7 +136,7 @@ PlaceEnemyHUDTiles:
|
|||
ld de, wHUDGraphicsTiles
|
||||
ld bc, $3
|
||||
call CopyData
|
||||
coord hl, 1, 2
|
||||
hlcoord 1, 2
|
||||
ld de, $1
|
||||
jr PlaceHUDTiles
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ JumpMoveEffect:
|
|||
ret
|
||||
|
||||
_JumpMoveEffect:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveEffect]
|
||||
jr z, .next1
|
||||
|
@ -26,7 +26,7 @@ INCLUDE "data/moves/effects_pointers.asm"
|
|||
SleepEffect:
|
||||
ld de, wEnemyMonStatus
|
||||
ld bc, wEnemyBattleStatus2
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jp z, .sleepEffect
|
||||
ld de, wBattleMonStatus
|
||||
|
@ -78,7 +78,7 @@ AlreadyAsleepText:
|
|||
PoisonEffect:
|
||||
ld hl, wEnemyMonStatus
|
||||
ld de, wPlayerMoveEffect
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .poisonEffect
|
||||
ld hl, wBattleMonStatus
|
||||
|
@ -121,7 +121,7 @@ PoisonEffect:
|
|||
set 3, [hl] ; mon is now poisoned
|
||||
push de
|
||||
dec de
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld b, ANIM_C7
|
||||
ld hl, wPlayerBattleStatus3
|
||||
|
@ -170,12 +170,12 @@ BadlyPoisonedText:
|
|||
text_end
|
||||
|
||||
DrainHPEffect:
|
||||
jpab DrainHPEffect_
|
||||
jpfar DrainHPEffect_
|
||||
|
||||
ExplodeEffect:
|
||||
ld hl, wBattleMonHP
|
||||
ld de, wPlayerBattleStatus2
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .faintUser
|
||||
ld hl, wEnemyMonHP
|
||||
|
@ -196,7 +196,7 @@ FreezeBurnParalyzeEffect:
|
|||
ld [wAnimationType], a
|
||||
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
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jp nz, opponentAttacker
|
||||
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
|
||||
and 1 << FRZ ; are they frozen?
|
||||
ret z ; return if so
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .opponent
|
||||
;player [attacker]
|
||||
|
@ -346,7 +346,7 @@ FireDefrostedText:
|
|||
StatModifierUpEffect:
|
||||
ld hl, wPlayerMonStatMods
|
||||
ld de, wPlayerMoveEffect
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .statModifierUpEffect
|
||||
ld hl, wEnemyMonStatMods
|
||||
|
@ -382,7 +382,7 @@ StatModifierUpEffect:
|
|||
push hl
|
||||
ld hl, wBattleMonAttack + 1
|
||||
ld de, wPlayerMonUnmodifiedAttack
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .pointToStats
|
||||
ld hl, wEnemyMonAttack + 1
|
||||
|
@ -399,11 +399,12 @@ StatModifierUpEffect:
|
|||
inc d ; de = unmodified (original) stat
|
||||
.checkIf999
|
||||
pop bc
|
||||
; check if stat is already 999
|
||||
ld a, [hld]
|
||||
sub 999 % $100 ; check if stat is already 999
|
||||
sub LOW(MAX_STAT_VALUE)
|
||||
jr nz, .recalculateStat
|
||||
ld a, [hl]
|
||||
sbc 999 / $100
|
||||
sbc HIGH(MAX_STAT_VALUE)
|
||||
jp z, RestoreOriginalStatModifier
|
||||
.recalculateStat ; recalculate affected stat
|
||||
; paralysis and burn penalties, as well as badge boosts are ignored
|
||||
|
@ -417,35 +418,35 @@ StatModifierUpEffect:
|
|||
add hl, bc
|
||||
pop bc
|
||||
xor a
|
||||
ld [hMultiplicand], a
|
||||
ldh [hMultiplicand], a
|
||||
ld a, [de]
|
||||
ld [hMultiplicand + 1], a
|
||||
ldh [hMultiplicand + 1], a
|
||||
inc de
|
||||
ld a, [de]
|
||||
ld [hMultiplicand + 2], a
|
||||
ldh [hMultiplicand + 2], a
|
||||
ld a, [hli]
|
||||
ld [hMultiplier], a
|
||||
ldh [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, [hl]
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
pop hl
|
||||
; cap at 999
|
||||
ld a, [hProduct + 3]
|
||||
sub 999 % $100
|
||||
ld a, [hProduct + 2]
|
||||
sbc 999 / $100
|
||||
; cap at MAX_STAT_VALUE (999)
|
||||
ldh a, [hProduct + 3]
|
||||
sub LOW(MAX_STAT_VALUE)
|
||||
ldh a, [hProduct + 2]
|
||||
sbc HIGH(MAX_STAT_VALUE)
|
||||
jp c, UpdateStat
|
||||
ld a, 999 / $100
|
||||
ld [hMultiplicand + 1], a
|
||||
ld a, 999 % $100
|
||||
ld [hMultiplicand + 2], a
|
||||
ld a, HIGH(MAX_STAT_VALUE)
|
||||
ldh [hMultiplicand + 1], a
|
||||
ld a, LOW(MAX_STAT_VALUE)
|
||||
ldh [hMultiplicand + 2], a
|
||||
|
||||
UpdateStat:
|
||||
ld a, [hProduct + 2]
|
||||
ldh a, [hProduct + 2]
|
||||
ld [hli], a
|
||||
ld a, [hProduct + 3]
|
||||
ldh a, [hProduct + 3]
|
||||
ld [hl], a
|
||||
pop hl
|
||||
UpdateStatDone:
|
||||
|
@ -455,7 +456,7 @@ UpdateStatDone:
|
|||
ld hl, wPlayerBattleStatus2
|
||||
ld de, wPlayerMoveNum
|
||||
ld bc, wPlayerMonMinimized
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .asm_3f4e6
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
@ -488,7 +489,7 @@ UpdateStatDone:
|
|||
pop af
|
||||
call nz, Bankswitch
|
||||
.applyBadgeBoostsAndStatusPenalties
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
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)
|
||||
|
@ -511,7 +512,7 @@ MonsStatsRoseText:
|
|||
text_far _MonsStatsRoseText
|
||||
text_asm
|
||||
ld hl, GreatlyRoseText
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveEffect]
|
||||
jr z, .playerTurn
|
||||
|
@ -534,7 +535,7 @@ StatModifierDownEffect:
|
|||
ld hl, wEnemyMonStatMods
|
||||
ld de, wPlayerMoveEffect
|
||||
ld bc, wEnemyBattleStatus1
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .statModifierDownEffect
|
||||
ld hl, wPlayerMonStatMods
|
||||
|
@ -601,7 +602,7 @@ StatModifierDownEffect:
|
|||
push de
|
||||
ld hl, wEnemyMonAttack + 1
|
||||
ld de, wEnemyMonUnmodifiedAttack
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .pointToStat
|
||||
ld hl, wBattleMonAttack + 1
|
||||
|
@ -637,33 +638,33 @@ StatModifierDownEffect:
|
|||
add hl, bc
|
||||
pop bc
|
||||
xor a
|
||||
ld [hMultiplicand], a
|
||||
ldh [hMultiplicand], a
|
||||
ld a, [de]
|
||||
ld [hMultiplicand + 1], a
|
||||
ldh [hMultiplicand + 1], a
|
||||
inc de
|
||||
ld a, [de]
|
||||
ld [hMultiplicand + 2], a
|
||||
ldh [hMultiplicand + 2], a
|
||||
ld a, [hli]
|
||||
ld [hMultiplier], a
|
||||
ldh [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, [hl]
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
pop hl
|
||||
ld a, [hProduct + 3]
|
||||
ldh a, [hProduct + 3]
|
||||
ld b, a
|
||||
ld a, [hProduct + 2]
|
||||
ldh a, [hProduct + 2]
|
||||
or b
|
||||
jp nz, UpdateLoweredStat
|
||||
ld [hMultiplicand + 1], a
|
||||
ldh [hMultiplicand + 1], a
|
||||
ld a, $1
|
||||
ld [hMultiplicand + 2], a
|
||||
ldh [hMultiplicand + 2], a
|
||||
|
||||
UpdateLoweredStat:
|
||||
ld a, [hProduct + 2]
|
||||
ldh a, [hProduct + 2]
|
||||
ld [hli], a
|
||||
ld a, [hProduct + 3]
|
||||
ldh a, [hProduct + 3]
|
||||
ld [hl], a
|
||||
pop de
|
||||
pop hl
|
||||
|
@ -678,7 +679,7 @@ UpdateLoweredStatDone:
|
|||
jr nc, .ApplyBadgeBoostsAndStatusPenalties
|
||||
call PlayCurrentMoveAnimation2
|
||||
.ApplyBadgeBoostsAndStatusPenalties
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
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)
|
||||
|
@ -713,7 +714,7 @@ MonsStatsFellText:
|
|||
text_far _MonsStatsFellText
|
||||
text_asm
|
||||
ld hl, FellText
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveEffect]
|
||||
jr z, .playerTurn
|
||||
|
@ -759,7 +760,7 @@ BideEffect:
|
|||
ld hl, wPlayerBattleStatus1
|
||||
ld de, wPlayerBideAccumulatedDamage
|
||||
ld bc, wPlayerNumAttacksLeft
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .bideEffect
|
||||
ld hl, wEnemyBattleStatus1
|
||||
|
@ -778,14 +779,14 @@ BideEffect:
|
|||
inc a
|
||||
inc a
|
||||
ld [bc], a ; set Bide counter to 2 or 3 at random
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
add XSTATITEM_ANIM
|
||||
jp PlayBattleAnimation2
|
||||
|
||||
ThrashPetalDanceEffect:
|
||||
ld hl, wPlayerBattleStatus1
|
||||
ld de, wPlayerNumAttacksLeft
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .thrashPetalDanceEffect
|
||||
ld hl, wEnemyBattleStatus1
|
||||
|
@ -797,12 +798,12 @@ ThrashPetalDanceEffect:
|
|||
inc a
|
||||
inc a
|
||||
ld [de], a ; set thrash/petal dance counter to 2 or 3 at random
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
add ANIM_B0
|
||||
jp PlayBattleAnimation2
|
||||
|
||||
SwitchAndTeleportEffect:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .handleEnemy
|
||||
ld a, [wIsInBattle]
|
||||
|
@ -920,7 +921,7 @@ TwoToFiveAttacksEffect:
|
|||
ld hl, wPlayerBattleStatus1
|
||||
ld de, wPlayerNumAttacksLeft
|
||||
ld bc, wPlayerNumHits
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .twoToFiveAttacksEffect
|
||||
ld hl, wEnemyBattleStatus1
|
||||
|
@ -931,7 +932,7 @@ TwoToFiveAttacksEffect:
|
|||
ret nz
|
||||
set ATTACKING_MULTIPLE_TIMES, [hl] ; mon is now attacking multiple times
|
||||
ld hl, wPlayerMoveEffect
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .setNumberOfHits
|
||||
ld hl, wEnemyMoveEffect
|
||||
|
@ -967,7 +968,7 @@ FlinchSideEffect:
|
|||
ret nz
|
||||
ld hl, wEnemyBattleStatus1
|
||||
ld de, wPlayerMoveEffect
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .flinchSideEffect
|
||||
ld hl, wPlayerBattleStatus1
|
||||
|
@ -987,12 +988,12 @@ FlinchSideEffect:
|
|||
ret
|
||||
|
||||
OneHitKOEffect:
|
||||
jpab OneHitKOEffect_
|
||||
jpfar OneHitKOEffect_
|
||||
|
||||
ChargeEffect:
|
||||
ld hl, wPlayerBattleStatus1
|
||||
ld de, wPlayerMoveEffect
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld b, XSTATITEM_ANIM
|
||||
jr z, .chargeEffect
|
||||
|
@ -1074,7 +1075,7 @@ DugAHoleText:
|
|||
TrappingEffect:
|
||||
ld hl, wPlayerBattleStatus1
|
||||
ld de, wPlayerNumAttacksLeft
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .trappingEffect
|
||||
ld hl, wEnemyBattleStatus1
|
||||
|
@ -1097,13 +1098,13 @@ TrappingEffect:
|
|||
ret
|
||||
|
||||
MistEffect:
|
||||
jpab MistEffect_
|
||||
jpfar MistEffect_
|
||||
|
||||
FocusEnergyEffect:
|
||||
jpab FocusEnergyEffect_
|
||||
jpfar FocusEnergyEffect_
|
||||
|
||||
RecoilEffect:
|
||||
jpab RecoilEffect_
|
||||
jpfar RecoilEffect_
|
||||
|
||||
ConfusionSideEffect:
|
||||
call BattleRandom
|
||||
|
@ -1120,7 +1121,7 @@ ConfusionEffect:
|
|||
jr nz, ConfusionEffectFailed
|
||||
|
||||
ConfusionSideEffectSuccess:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wEnemyBattleStatus1
|
||||
ld bc, wEnemyConfusedCounter
|
||||
|
@ -1157,14 +1158,14 @@ ConfusionEffectFailed:
|
|||
jp ConditionalPrintButItFailed
|
||||
|
||||
ParalyzeEffect:
|
||||
jpab ParalyzeEffect_
|
||||
jpfar ParalyzeEffect_
|
||||
|
||||
SubstituteEffect:
|
||||
jpab SubstituteEffect_
|
||||
jpfar SubstituteEffect_
|
||||
|
||||
HyperBeamEffect:
|
||||
ld hl, wPlayerBattleStatus2
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .hyperBeamEffect
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
@ -1175,7 +1176,7 @@ HyperBeamEffect:
|
|||
ClearHyperBeam:
|
||||
push hl
|
||||
ld hl, wEnemyBattleStatus2
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .playerTurn
|
||||
ld hl, wPlayerBattleStatus2
|
||||
|
@ -1186,7 +1187,7 @@ ClearHyperBeam:
|
|||
|
||||
RageEffect:
|
||||
ld hl, wPlayerBattleStatus2
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .player
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
@ -1201,7 +1202,7 @@ MimicEffect:
|
|||
ld a, [wMoveMissed]
|
||||
and a
|
||||
jr nz, .mimicMissed
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wBattleMonMoves
|
||||
ld a, [wPlayerBattleStatus1]
|
||||
|
@ -1226,7 +1227,7 @@ MimicEffect:
|
|||
and a
|
||||
jr z, .getRandomMove
|
||||
ld d, a
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wBattleMonMoves
|
||||
ld a, [wPlayerMoveListIndex]
|
||||
|
@ -1271,7 +1272,7 @@ MimicLearnedMoveText:
|
|||
text_end
|
||||
|
||||
LeechSeedEffect:
|
||||
jpab LeechSeedEffect_
|
||||
jpfar LeechSeedEffect_
|
||||
|
||||
SplashEffect:
|
||||
call PlayCurrentMoveAnimation
|
||||
|
@ -1284,7 +1285,7 @@ DisableEffect:
|
|||
jr nz, .moveMissed
|
||||
ld de, wEnemyDisabledMove
|
||||
ld hl, wEnemyMonMoves
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .disableEffect
|
||||
ld de, wPlayerDisabledMove
|
||||
|
@ -1307,7 +1308,7 @@ DisableEffect:
|
|||
jr z, .pickMoveToDisable ; loop until a non-00 move slot is found
|
||||
ld [wd11e], a ; store move number
|
||||
push hl
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld hl, wBattleMonPP
|
||||
jr nz, .enemyTurn
|
||||
|
@ -1345,7 +1346,7 @@ DisableEffect:
|
|||
ld [de], a
|
||||
call PlayCurrentMoveAnimation2
|
||||
ld hl, wPlayerDisabledMoveNumber
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .printDisableText
|
||||
inc hl ; wEnemyDisabledMoveNumber
|
||||
|
@ -1365,22 +1366,22 @@ MoveWasDisabledText:
|
|||
text_end
|
||||
|
||||
PayDayEffect:
|
||||
jpab PayDayEffect_
|
||||
jpfar PayDayEffect_
|
||||
|
||||
ConversionEffect:
|
||||
jpab ConversionEffect_
|
||||
jpfar ConversionEffect_
|
||||
|
||||
HazeEffect:
|
||||
jpab HazeEffect_
|
||||
jpfar HazeEffect_
|
||||
|
||||
HealEffect:
|
||||
jpab HealEffect_
|
||||
jpfar HealEffect_
|
||||
|
||||
TransformEffect:
|
||||
jpab TransformEffect_
|
||||
jpfar TransformEffect_
|
||||
|
||||
ReflectLightScreenEffect:
|
||||
jpab ReflectLightScreenEffect_
|
||||
jpfar ReflectLightScreenEffect_
|
||||
|
||||
NothingHappenedText:
|
||||
text_far _NothingHappenedText
|
||||
|
@ -1430,7 +1431,7 @@ ParalyzedMayNotAttackText:
|
|||
CheckTargetSubstitute:
|
||||
push hl
|
||||
ld hl, wEnemyBattleStatus2
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .next1
|
||||
ld hl, wPlayerBattleStatus2
|
||||
|
@ -1442,7 +1443,7 @@ CheckTargetSubstitute:
|
|||
PlayCurrentMoveAnimation2:
|
||||
; animation at MOVENUM will be played unless MOVENUM is 0
|
||||
; plays wAnimationType 3 or 6
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveNum]
|
||||
jr z, .notEnemyTurn
|
||||
|
@ -1454,7 +1455,7 @@ PlayCurrentMoveAnimation2:
|
|||
PlayBattleAnimation2:
|
||||
; play animation ID at a and animation type 6 or 3
|
||||
ld [wAnimationID], a
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, $6
|
||||
jr z, .storeAnimationType
|
||||
|
@ -1468,7 +1469,7 @@ PlayCurrentMoveAnimation:
|
|||
; resets wAnimationType
|
||||
xor a
|
||||
ld [wAnimationType], a
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveNum]
|
||||
jr z, .notEnemyTurn
|
||||
|
|
|
@ -10,7 +10,7 @@ EndOfBattle:
|
|||
ld a, [wEnemyMonStatus]
|
||||
ld [hl], a
|
||||
call ClearScreen
|
||||
callab DisplayLinkBattleVersusTextBox
|
||||
callfar DisplayLinkBattleVersusTextBox
|
||||
ld a, [wBattleResult]
|
||||
cp $1
|
||||
ld de, YouWinText
|
||||
|
@ -19,7 +19,7 @@ EndOfBattle:
|
|||
jr z, .placeWinOrLoseString
|
||||
ld de, DrawText
|
||||
.placeWinOrLoseString
|
||||
coord hl, 6, 8
|
||||
hlcoord 6, 8
|
||||
call PlaceString
|
||||
ld c, 200
|
||||
call DelayFrames
|
||||
|
|
|
@ -55,15 +55,15 @@ GainExperience:
|
|||
jr .gainStatExpLoop
|
||||
.statExpDone
|
||||
xor a
|
||||
ld [hMultiplicand], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ldh [hMultiplicand], a
|
||||
ldh [hMultiplicand + 1], a
|
||||
ld a, [wEnemyMonBaseExp]
|
||||
ld [hMultiplicand + 2], a
|
||||
ldh [hMultiplicand + 2], a
|
||||
ld a, [wEnemyMonLevel]
|
||||
ld [hMultiplier], a
|
||||
ldh [hMultiplier], a
|
||||
call Multiply
|
||||
ld a, 7
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, 4
|
||||
call Divide
|
||||
ld hl, wPartyMon1OTID - (wPartyMon1DVs - 1)
|
||||
|
@ -91,12 +91,12 @@ GainExperience:
|
|||
inc hl
|
||||
; add the gained exp to the party mon's exp
|
||||
ld b, [hl]
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
ld [wExpAmountGained + 1], a
|
||||
add b
|
||||
ld [hld], a
|
||||
ld b, [hl]
|
||||
ld a, [hQuotient + 2]
|
||||
ldh a, [hQuotient + 2]
|
||||
ld [wExpAmountGained], a
|
||||
adc b
|
||||
ld [hl], a
|
||||
|
@ -117,13 +117,13 @@ GainExperience:
|
|||
ld [wd0b5], a
|
||||
call GetMonHeader
|
||||
ld d, MAX_LEVEL
|
||||
callab CalcExperience ; get max exp
|
||||
callfar CalcExperience ; get max exp
|
||||
; compare max exp with current exp
|
||||
ld a, [hExperience]
|
||||
ldh a, [hExperience]
|
||||
ld b, a
|
||||
ld a, [hExperience + 1]
|
||||
ldh a, [hExperience + 1]
|
||||
ld c, a
|
||||
ld a, [hExperience + 2]
|
||||
ldh a, [hExperience + 2]
|
||||
ld d, a
|
||||
pop hl
|
||||
ld a, [hld]
|
||||
|
@ -155,7 +155,7 @@ GainExperience:
|
|||
ld bc, wPartyMon1Level - wPartyMon1Exp
|
||||
add hl, bc
|
||||
push hl
|
||||
callba CalcLevelFromExperience
|
||||
farcall CalcLevelFromExperience
|
||||
pop hl
|
||||
ld a, [hl] ; current level
|
||||
cp d
|
||||
|
@ -233,11 +233,11 @@ GainExperience:
|
|||
.recalcStatChanges
|
||||
xor a ; battle mon
|
||||
ld [wCalculateWhoseStats], a
|
||||
callab CalculateModifiedStats
|
||||
callab ApplyBurnAndParalysisPenaltiesToPlayer
|
||||
callab ApplyBadgeStatBoosts
|
||||
callab DrawPlayerHUDAndHPBar
|
||||
callab PrintEmptyString
|
||||
callfar CalculateModifiedStats
|
||||
callfar ApplyBurnAndParalysisPenaltiesToPlayer
|
||||
callfar ApplyBadgeStatBoosts
|
||||
callfar DrawPlayerHUDAndHPBar
|
||||
callfar PrintEmptyString
|
||||
call SaveScreenTilesToBuffer1
|
||||
.printGrewLevelText
|
||||
ld hl, GrewLevelText
|
||||
|
@ -246,7 +246,7 @@ GainExperience:
|
|||
ld [wMonDataLocation], a
|
||||
call LoadMonData
|
||||
ld d, $1
|
||||
callab PrintStatsBox
|
||||
callfar PrintStatsBox
|
||||
call WaitForTextScrollButtonPress
|
||||
call LoadScreenTilesFromBuffer1
|
||||
xor a ; PLAYER_PARTY_DATA
|
||||
|
@ -311,14 +311,14 @@ DivideExpDataByNumMonsGainingExp:
|
|||
ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats
|
||||
.divideLoop
|
||||
xor a
|
||||
ld [hDividend], a
|
||||
ldh [hDividend], a
|
||||
ld a, [hl]
|
||||
ld [hDividend + 1], a
|
||||
ldh [hDividend + 1], a
|
||||
ld a, [wd11e]
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, $2
|
||||
call Divide ; divide value by number of mons gaining exp
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
ld [hli], a
|
||||
dec c
|
||||
jr nz, .divideLoop
|
||||
|
@ -326,17 +326,17 @@ DivideExpDataByNumMonsGainingExp:
|
|||
|
||||
; multiplies exp by 1.5
|
||||
BoostExp:
|
||||
ld a, [hQuotient + 2]
|
||||
ldh a, [hQuotient + 2]
|
||||
ld b, a
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
ld c, a
|
||||
srl b
|
||||
rr c
|
||||
add c
|
||||
ld [hQuotient + 3], a
|
||||
ld a, [hQuotient + 2]
|
||||
ldh [hQuotient + 3], a
|
||||
ldh a, [hQuotient + 2]
|
||||
adc b
|
||||
ld [hQuotient + 2], a
|
||||
ldh [hQuotient + 2], a
|
||||
ret
|
||||
|
||||
GainedText:
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
MarowakAnim:
|
||||
; animate the ghost being unveiled as a Marowak
|
||||
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
|
||||
; 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
|
||||
call ClearScreenArea
|
||||
call Delay3
|
||||
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
|
||||
ld a, MAROWAK
|
||||
ld [wChangeMonPicEnemyTurnSpecies], a
|
||||
ld a, $1
|
||||
ld [hWhoseTurn], a
|
||||
callab ChangeMonPic
|
||||
ldh [hWhoseTurn], a
|
||||
callfar ChangeMonPic
|
||||
; alternate between black and light grey 8 times.
|
||||
; this makes the ghost's body appear to flash
|
||||
ld d, $80
|
||||
|
@ -23,10 +23,10 @@ MarowakAnim:
|
|||
.fadeOutGhostLoop
|
||||
ld c, 10
|
||||
call DelayFrames
|
||||
ld a, [rOBP1]
|
||||
ldh a, [rOBP1]
|
||||
sla a
|
||||
sla a
|
||||
ld [rOBP1], a
|
||||
ldh [rOBP1], a
|
||||
jr nz, .fadeOutGhostLoop
|
||||
call ClearSprites
|
||||
call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM
|
||||
|
@ -34,17 +34,17 @@ MarowakAnim:
|
|||
.fadeInMarowakLoop
|
||||
ld c, 10
|
||||
call DelayFrames
|
||||
ld a, [rOBP1]
|
||||
ldh a, [rOBP1]
|
||||
srl b
|
||||
rra
|
||||
srl b
|
||||
rra
|
||||
ld [rOBP1], a
|
||||
ldh [rOBP1], a
|
||||
ld a, b
|
||||
and a
|
||||
jr nz, .fadeInMarowakLoop
|
||||
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
|
||||
jp ClearSprites
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
InitBattleVariables:
|
||||
ld a, [hTilesetType]
|
||||
ldh a, [hTilesetType]
|
||||
ld [wSavedTilesetType], a
|
||||
xor a
|
||||
ld [wActionResultOrTookBattleTurn], a
|
||||
|
@ -35,4 +35,4 @@ InitBattleVariables:
|
|||
ld a, BATTLE_TYPE_SAFARI
|
||||
ld [wBattleType], a
|
||||
.notSafariBattle
|
||||
jpab PlayBattleMusic
|
||||
jpfar PlayBattleMusic
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
; display "[player] VS [enemy]" text box with pokeballs representing their parties next to the names
|
||||
DisplayLinkBattleVersusTextBox:
|
||||
call LoadTextBoxTilePatterns
|
||||
coord hl, 3, 4
|
||||
hlcoord 3, 4
|
||||
ld b, 7
|
||||
ld c, 12
|
||||
call TextBoxBorder
|
||||
coord hl, 4, 5
|
||||
hlcoord 4, 5
|
||||
ld de, wPlayerName
|
||||
call PlaceString
|
||||
coord hl, 4, 10
|
||||
hlcoord 4, 10
|
||||
ld de, wLinkEnemyTrainerName
|
||||
call PlaceString
|
||||
; place bold "VS" tiles between the names
|
||||
coord hl, 9, 8
|
||||
hlcoord 9, 8
|
||||
ld a, $69
|
||||
ld [hli], a
|
||||
ld [hl], $6a
|
||||
xor a
|
||||
ld [wUpdateSpritesEnabled], a
|
||||
callab SetupPlayerAndEnemyPokeballs
|
||||
callfar SetupPlayerAndEnemyPokeballs
|
||||
ld c, 150
|
||||
jp DelayFrames
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
ConversionEffect_:
|
||||
ld hl, wEnemyMonType1
|
||||
ld de, wBattleMonType1
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wEnemyBattleStatus1]
|
||||
jr z, .conversionEffect
|
||||
|
|
|
@ -14,7 +14,7 @@ DrainHPEffect_:
|
|||
.getAttackerHP
|
||||
ld hl, wBattleMonHP
|
||||
ld de, wBattleMonMaxHP
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jp z, .addDamageToAttackerHP
|
||||
ld hl, wEnemyMonHP
|
||||
|
@ -69,21 +69,21 @@ DrainHPEffect_:
|
|||
ld [wHPBarNewHP+1], a
|
||||
inc de
|
||||
.next
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 10, 9
|
||||
hlcoord 10, 9
|
||||
ld a, $1
|
||||
jr z, .next2
|
||||
coord hl, 2, 2
|
||||
hlcoord 2, 2
|
||||
xor a
|
||||
.next2
|
||||
ld [wHPBarType], a
|
||||
predef UpdateHPBar2
|
||||
predef DrawPlayerHUDAndHPBar
|
||||
predef DrawEnemyHUDAndHPBar
|
||||
callab ReadPlayerMonCurHPAndStatus
|
||||
callfar ReadPlayerMonCurHPAndStatus
|
||||
ld hl, SuckedHealthText
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveEffect]
|
||||
jr z, .next3
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
FocusEnergyEffect_:
|
||||
ld hl, wPlayerBattleStatus2
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .notEnemy
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
@ -8,13 +8,13 @@ FocusEnergyEffect_:
|
|||
bit GETTING_PUMPED, [hl] ; is mon already using focus energy?
|
||||
jr nz, .alreadyUsing
|
||||
set GETTING_PUMPED, [hl] ; mon is now using focus energy
|
||||
callab PlayCurrentMoveAnimation
|
||||
callfar PlayCurrentMoveAnimation
|
||||
ld hl, GettingPumpedText
|
||||
jp PrintText
|
||||
.alreadyUsing
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
jpab PrintButItFailedText_
|
||||
jpfar PrintButItFailedText_
|
||||
|
||||
GettingPumpedText:
|
||||
text_pause
|
||||
|
|
|
@ -15,7 +15,7 @@ HazeEffect_:
|
|||
; cure non-volatile status, but only for the target
|
||||
ld hl, wEnemyMonStatus
|
||||
ld de, wEnemySelectedMove
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .cureStatuses
|
||||
ld hl, wBattleMonStatus
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
HealEffect_:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld de, wBattleMonHP
|
||||
ld hl, wBattleMonMaxHP
|
||||
|
@ -27,7 +27,7 @@ HealEffect_:
|
|||
ld c, 50
|
||||
call DelayFrames
|
||||
ld hl, wBattleMonStatus
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .restEffect
|
||||
ld hl, wEnemyMonStatus
|
||||
|
@ -87,12 +87,12 @@ HealEffect_:
|
|||
.playAnim
|
||||
ld hl, PlayCurrentMoveAnimation
|
||||
call BankswitchEtoF
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
coord hl, 10, 9
|
||||
hlcoord 10, 9
|
||||
ld a, $1
|
||||
jr z, .updateHPBar
|
||||
coord hl, 2, 2
|
||||
hlcoord 2, 2
|
||||
xor a
|
||||
.updateHPBar
|
||||
ld [wHPBarType], a
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
LeechSeedEffect_:
|
||||
callab MoveHitTest
|
||||
callfar MoveHitTest
|
||||
ld a, [wMoveMissed]
|
||||
and a
|
||||
jr nz, .moveMissed
|
||||
ld hl, wEnemyBattleStatus2
|
||||
ld de, wEnemyMonType1
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .leechSeedEffect
|
||||
ld hl, wPlayerBattleStatus2
|
||||
|
@ -22,7 +22,7 @@ LeechSeedEffect_:
|
|||
bit SEEDED, [hl]
|
||||
jr nz, .moveMissed
|
||||
set SEEDED, [hl]
|
||||
callab PlayCurrentMoveAnimation
|
||||
callfar PlayCurrentMoveAnimation
|
||||
ld hl, WasSeededText
|
||||
jp PrintText
|
||||
.moveMissed
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
MistEffect_:
|
||||
ld hl, wPlayerBattleStatus2
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .mistEffect
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
@ -8,11 +8,11 @@ MistEffect_:
|
|||
bit PROTECTED_BY_MIST, [hl] ; is mon protected by mist?
|
||||
jr nz, .mistAlreadyInUse
|
||||
set PROTECTED_BY_MIST, [hl] ; mon is now protected by mist
|
||||
callab PlayCurrentMoveAnimation
|
||||
callfar PlayCurrentMoveAnimation
|
||||
ld hl, ShroudedInMistText
|
||||
jp PrintText
|
||||
.mistAlreadyInUse
|
||||
jpab PrintButItFailedText_
|
||||
jpfar PrintButItFailedText_
|
||||
|
||||
ShroudedInMistText:
|
||||
text_far _ShroudedInMistText
|
||||
|
|
|
@ -7,7 +7,7 @@ OneHitKOEffect_:
|
|||
ld [wCriticalHitOrOHKO], a
|
||||
ld hl, wBattleMonSpeed + 1
|
||||
ld de, wEnemyMonSpeed + 1
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .compareSpeed
|
||||
ld hl, wEnemyMonSpeed + 1
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
ParalyzeEffect_:
|
||||
ld hl, wEnemyMonStatus
|
||||
ld de, wPlayerMoveType
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jp z, .next
|
||||
ld hl, wBattleMonStatus
|
||||
|
@ -26,22 +26,22 @@ ParalyzeEffect_:
|
|||
jr z, .doesntAffect
|
||||
.hitTest
|
||||
push hl
|
||||
callab MoveHitTest
|
||||
callfar MoveHitTest
|
||||
pop hl
|
||||
ld a, [wMoveMissed]
|
||||
and a
|
||||
jr nz, .didntAffect
|
||||
set PAR, [hl]
|
||||
callab QuarterSpeedDueToParalysis
|
||||
callfar QuarterSpeedDueToParalysis
|
||||
ld c, 30
|
||||
call DelayFrames
|
||||
callab PlayCurrentMoveAnimation
|
||||
jpab PrintMayNotAttackText
|
||||
callfar PlayCurrentMoveAnimation
|
||||
jpfar PrintMayNotAttackText
|
||||
.didntAffect
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
jpab PrintDidntAffectText
|
||||
jpfar PrintDidntAffectText
|
||||
.doesntAffect
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
jpab PrintDoesntAffectText
|
||||
jpfar PrintDoesntAffectText
|
||||
|
|
|
@ -2,7 +2,7 @@ PayDayEffect_:
|
|||
xor a
|
||||
ld hl, wcd6d
|
||||
ld [hli], a
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wBattleMonLevel]
|
||||
jr z, .payDayEffect
|
||||
|
@ -10,28 +10,28 @@ PayDayEffect_:
|
|||
.payDayEffect
|
||||
; level * 2
|
||||
add a
|
||||
ld [hDividend + 3], a
|
||||
ldh [hDividend + 3], a
|
||||
xor a
|
||||
ld [hDividend], a
|
||||
ld [hDividend + 1], a
|
||||
ld [hDividend + 2], a
|
||||
ldh [hDividend], a
|
||||
ldh [hDividend + 1], a
|
||||
ldh [hDividend + 2], a
|
||||
; convert to BCD
|
||||
ld a, 100
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
ld [hli], a
|
||||
ld a, [hRemainder]
|
||||
ld [hDividend + 3], a
|
||||
ldh a, [hRemainder]
|
||||
ldh [hDividend + 3], a
|
||||
ld a, 10
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
swap a
|
||||
ld b, a
|
||||
ld a, [hRemainder]
|
||||
ldh a, [hRemainder]
|
||||
add b
|
||||
ld [hl], a
|
||||
ld de, wTotalPayDayMoney + 2
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
RecoilEffect_:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerMoveNum]
|
||||
ld hl, wBattleMonMaxHP
|
||||
|
@ -53,12 +53,12 @@ RecoilEffect_:
|
|||
ld [hli], a
|
||||
ld [hl], a
|
||||
.getHPBarCoords
|
||||
coord hl, 10, 9
|
||||
ld a, [hWhoseTurn]
|
||||
hlcoord 10, 9
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, $1
|
||||
jr z, .updateHPBar
|
||||
coord hl, 2, 2
|
||||
hlcoord 2, 2
|
||||
xor a
|
||||
.updateHPBar
|
||||
ld [wHPBarType], a
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
ReflectLightScreenEffect_:
|
||||
ld hl, wPlayerBattleStatus3
|
||||
ld de, wPlayerMoveEffect
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .reflectLightScreenEffect
|
||||
ld hl, wEnemyBattleStatus3
|
||||
|
|
|
@ -4,7 +4,7 @@ SubstituteEffect_:
|
|||
ld hl, wBattleMonMaxHP
|
||||
ld de, wPlayerSubstituteHP
|
||||
ld bc, wPlayerBattleStatus2
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .notEnemy
|
||||
ld hl, wEnemyMonMaxHP
|
||||
|
@ -55,7 +55,7 @@ SubstituteEffect_:
|
|||
call Bankswitch ; jump to routine depending on animation setting
|
||||
ld hl, SubstituteText
|
||||
call PrintText
|
||||
jpab DrawHUDsAndHPBars
|
||||
jpfar DrawHUDsAndHPBars
|
||||
.alreadyHasSubstitute
|
||||
ld hl, HasSubstituteText
|
||||
jr .printText
|
||||
|
|
|
@ -3,7 +3,7 @@ TransformEffect_:
|
|||
ld de, wEnemyMonSpecies
|
||||
ld bc, wEnemyBattleStatus3
|
||||
ld a, [wEnemyBattleStatus1]
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr nz, .hitTest
|
||||
ld hl, wEnemyMonSpecies
|
||||
|
@ -18,7 +18,7 @@ TransformEffect_:
|
|||
push de
|
||||
push bc
|
||||
ld hl, wPlayerBattleStatus2
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .transformEffect
|
||||
ld hl, wEnemyBattleStatus2
|
||||
|
@ -64,7 +64,7 @@ TransformEffect_:
|
|||
inc bc
|
||||
inc bc
|
||||
call CopyData
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .next
|
||||
; save enemy mon DVs at wTransformedEnemyMonOriginalDVs
|
||||
|
@ -128,7 +128,7 @@ TransformEffect_:
|
|||
jp PrintText
|
||||
|
||||
.copyBasedOnTurn
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
jr z, .gotStatsOrModsToCopy
|
||||
push hl
|
||||
|
|
|
@ -41,16 +41,16 @@ ScaleFirstThreeSpriteColumnsByTwo:
|
|||
|
||||
ScaleLastSpriteColumnByTwo:
|
||||
ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows
|
||||
ld [hSpriteInterlaceCounter], a
|
||||
ldh [hSpriteInterlaceCounter], a
|
||||
ld bc, -1
|
||||
.columnInnerLoop
|
||||
ld a, [de]
|
||||
dec de
|
||||
swap a ; only high nybble contains information
|
||||
call ScalePixelsByTwo
|
||||
ld a, [hSpriteInterlaceCounter]
|
||||
ldh a, [hSpriteInterlaceCounter]
|
||||
dec a
|
||||
ld [hSpriteInterlaceCounter], a
|
||||
ldh [hSpriteInterlaceCounter], a
|
||||
jr nz, .columnInnerLoop
|
||||
dec de ; skip last 4 rows of new column
|
||||
dec de
|
||||
|
|
|
@ -5,8 +5,8 @@ _ScrollTrainerPicAfterBattle:
|
|||
ld [wEnemyMonSpecies2], a
|
||||
ld b, SET_PAL_BATTLE
|
||||
call RunPaletteCommand
|
||||
callab _LoadTrainerPic
|
||||
coord hl, 19, 0
|
||||
callfar _LoadTrainerPic
|
||||
hlcoord 19, 0
|
||||
ld c, $0
|
||||
.scrollLoop
|
||||
inc c
|
||||
|
|
|
@ -204,7 +204,7 @@ AIMoveChoiceModification3:
|
|||
push hl
|
||||
push bc
|
||||
push de
|
||||
callab AIGetTypeEffectiveness
|
||||
callfar AIGetTypeEffectiveness
|
||||
pop de
|
||||
pop bc
|
||||
pop hl
|
||||
|
@ -542,7 +542,7 @@ AIRecoverHP:
|
|||
|
||||
AIPrintItemUseAndUpdateHPBar:
|
||||
call AIPrintItemUse_
|
||||
coord hl, 2, 2
|
||||
hlcoord 2, 2
|
||||
xor a
|
||||
ld [wHPBarType], a
|
||||
predef UpdateHPBar2
|
||||
|
@ -599,7 +599,7 @@ SwitchEnemyMon:
|
|||
; switching in a new mon in response to this switch.
|
||||
ld a, 1
|
||||
ld [wFirstMonsNotOutYet], a
|
||||
callab EnemySendOut
|
||||
callfar EnemySendOut
|
||||
xor a
|
||||
ld [wFirstMonsNotOutYet], a
|
||||
|
||||
|
@ -655,17 +655,17 @@ AIUseDireHit: ; unused
|
|||
|
||||
AICheckIfHPBelowFraction:
|
||||
; 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 a, [hli]
|
||||
ld [hDividend], a
|
||||
ldh [hDividend], a
|
||||
ld a, [hl]
|
||||
ld [hDividend + 1], a
|
||||
ldh [hDividend + 1], a
|
||||
ld b, 2
|
||||
call Divide
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
ld c, a
|
||||
ld a, [hQuotient + 2]
|
||||
ldh a, [hQuotient + 2]
|
||||
ld b, a
|
||||
ld hl, wEnemyMonHP + 1
|
||||
ld a, [hld]
|
||||
|
@ -713,7 +713,7 @@ AIIncreaseStat:
|
|||
ld a, ANIM_AF
|
||||
ld [hli], a
|
||||
ld [hl], b
|
||||
callab StatModifierUpEffect
|
||||
callfar StatModifierUpEffect
|
||||
pop hl
|
||||
pop af
|
||||
ld [hli], a
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; does nothing since no stats are ever selected (barring glitches)
|
||||
DoubleSelectedStats:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerStatsToDouble]
|
||||
ld hl, wBattleMonAttack + 1
|
||||
|
@ -30,7 +30,7 @@ DoubleSelectedStats:
|
|||
|
||||
; does nothing since no stats are ever selected (barring glitches)
|
||||
HalveSelectedStats:
|
||||
ld a, [hWhoseTurn]
|
||||
ldh a, [hWhoseTurn]
|
||||
and a
|
||||
ld a, [wPlayerStatsToHalve]
|
||||
ld hl, wBattleMonAttack
|
||||
|
|
|
@ -7,14 +7,14 @@ TryDoWildEncounter:
|
|||
ld a, [wd736]
|
||||
and a
|
||||
ret nz
|
||||
callab IsPlayerStandingOnDoorTileOrWarpTile
|
||||
callfar IsPlayerStandingOnDoorTileOrWarpTile
|
||||
jr nc, .notStandingOnDoorOrWarpTile
|
||||
.CantEncounter
|
||||
ld a, $1
|
||||
and a
|
||||
ret
|
||||
.notStandingOnDoorOrWarpTile
|
||||
callab IsPlayerJustOutsideMap
|
||||
callfar IsPlayerJustOutsideMap
|
||||
jr z, .CantEncounter
|
||||
ld a, [wRepelRemainingSteps]
|
||||
and a
|
||||
|
@ -25,7 +25,7 @@ TryDoWildEncounter:
|
|||
.next
|
||||
; 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?
|
||||
coord hl, 9, 9
|
||||
hlcoord 9, 9
|
||||
ld c, [hl]
|
||||
ld a, [wGrassTile]
|
||||
cp c
|
||||
|
@ -48,10 +48,10 @@ TryDoWildEncounter:
|
|||
.CanEncounter
|
||||
; compare encounter chance with a random number to determine if there will be an encounter
|
||||
ld b, a
|
||||
ld a, [hRandomAdd]
|
||||
ldh a, [hRandomAdd]
|
||||
cp b
|
||||
jr nc, .CantEncounter2
|
||||
ld a, [hRandomSub]
|
||||
ldh a, [hRandomSub]
|
||||
ld b, a
|
||||
ld hl, WildMonEncounterSlotChances
|
||||
.determineEncounterSlot
|
||||
|
@ -64,7 +64,7 @@ TryDoWildEncounter:
|
|||
; determine which wild pokemon (grass or water) can appear in the half-block we're standing in
|
||||
ld c, [hl]
|
||||
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?
|
||||
jr nz, .gotWildEncounterType ; else, it's treated as a grass tile by default
|
||||
ld hl, wWaterMons
|
||||
|
@ -90,7 +90,7 @@ TryDoWildEncounter:
|
|||
.lastRepelStep
|
||||
ld [wRepelRemainingSteps], a
|
||||
ld a, TEXT_REPEL_WORE_OFF
|
||||
ld [hSpriteIndexOrTextID], a
|
||||
ldh [hSpriteIndexOrTextID], a
|
||||
call EnableAutoTextBoxDrawing
|
||||
call DisplayTextID
|
||||
.CantEncounter2
|
||||
|
|
|
@ -41,5 +41,5 @@ TestBattle:
|
|||
; do it all again.
|
||||
ld a, 1
|
||||
ld [wUpdateSpritesEnabled], a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
jr .loop
|
||||
|
|
|
@ -6,34 +6,34 @@ ResetStatusAndHalveMoneyOnBlackout::
|
|||
ld [wIsInBattle], a
|
||||
ld [wMapPalOffset], a
|
||||
ld [wNPCMovementScriptFunctionNum], a
|
||||
ld [hJoyHeld], a
|
||||
ldh [hJoyHeld], a
|
||||
ld [wNPCMovementScriptPointerTableNum], a
|
||||
ld [wFlags_0xcd60], a
|
||||
|
||||
ld [hMoney], a
|
||||
ld [hMoney + 1], a
|
||||
ld [hMoney + 2], a
|
||||
ldh [hMoney], a
|
||||
ldh [hMoney + 1], a
|
||||
ldh [hMoney + 2], a
|
||||
call HasEnoughMoney
|
||||
jr c, .lostmoney ; never happens
|
||||
|
||||
; Halve the player's money.
|
||||
ld a, [wPlayerMoney]
|
||||
ld [hMoney], a
|
||||
ldh [hMoney], a
|
||||
ld a, [wPlayerMoney + 1]
|
||||
ld [hMoney + 1], a
|
||||
ldh [hMoney + 1], a
|
||||
ld a, [wPlayerMoney + 2]
|
||||
ld [hMoney + 2], a
|
||||
ldh [hMoney + 2], a
|
||||
xor a
|
||||
ld [hDivideBCDDivisor], a
|
||||
ld [hDivideBCDDivisor + 1], a
|
||||
ldh [hDivideBCDDivisor], a
|
||||
ldh [hDivideBCDDivisor + 1], a
|
||||
ld a, 2
|
||||
ld [hDivideBCDDivisor + 2], a
|
||||
ldh [hDivideBCDDivisor + 2], a
|
||||
predef DivideBCDPredef3
|
||||
ld a, [hDivideBCDQuotient]
|
||||
ldh a, [hDivideBCDQuotient]
|
||||
ld [wPlayerMoney], a
|
||||
ld a, [hDivideBCDQuotient + 1]
|
||||
ldh a, [hDivideBCDQuotient + 1]
|
||||
ld [wPlayerMoney + 1], a
|
||||
ld a, [hDivideBCDQuotient + 2]
|
||||
ldh a, [hDivideBCDQuotient + 2]
|
||||
ld [wPlayerMoney + 2], a
|
||||
|
||||
.lostmoney
|
||||
|
|
|
@ -28,7 +28,7 @@ PrintCardKeyText:
|
|||
call GetCoordsInFrontOfPlayer
|
||||
push de
|
||||
tx_pre_id CardKeySuccessText
|
||||
ld [hSpriteIndexOrTextID], a
|
||||
ldh [hSpriteIndexOrTextID], a
|
||||
call PrintPredefTextID
|
||||
pop de
|
||||
srl d
|
||||
|
@ -55,7 +55,7 @@ PrintCardKeyText:
|
|||
jp PlaySound
|
||||
.noCardKey
|
||||
tx_pre_id CardKeyFailText
|
||||
ld [hSpriteIndexOrTextID], a
|
||||
ldh [hSpriteIndexOrTextID], a
|
||||
jp PrintPredefTextID
|
||||
|
||||
SilphCoMapList:
|
||||
|
|
|
@ -20,7 +20,7 @@ GiveFossilToCinnabarLab::
|
|||
dec l
|
||||
ld b, l
|
||||
ld c, $d
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
call TextBoxBorder
|
||||
call UpdateSprites
|
||||
call PrintFossilsInBag
|
||||
|
@ -35,7 +35,7 @@ GiveFossilToCinnabarLab::
|
|||
ld e, a
|
||||
add hl, de
|
||||
ld a, [hl]
|
||||
ld [hItemToRemoveID], a
|
||||
ldh [hItemToRemoveID], a
|
||||
cp DOME_FOSSIL
|
||||
jr z, .choseDomeFossil
|
||||
cp HELIX_FOSSIL
|
||||
|
@ -61,8 +61,8 @@ GiveFossilToCinnabarLab::
|
|||
ld hl, LabFossil_610b3
|
||||
call PrintText
|
||||
ld a, [wFossilItem]
|
||||
ld [hItemToRemoveID], a
|
||||
callba RemoveItemByID
|
||||
ldh [hItemToRemoveID], a
|
||||
farcall RemoveItemByID
|
||||
ld hl, LabFossil_610b8
|
||||
call PrintText
|
||||
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.
|
||||
ld hl, wFilteredBagItems
|
||||
xor a
|
||||
ld [hItemCounter], a
|
||||
ldh [hItemCounter], a
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp $ff
|
||||
|
@ -100,8 +100,8 @@ PrintFossilsInBag:
|
|||
push hl
|
||||
ld [wd11e], a
|
||||
call GetItemName
|
||||
coord hl, 2, 2
|
||||
ld a, [hItemCounter]
|
||||
hlcoord 2, 2
|
||||
ldh a, [hItemCounter]
|
||||
ld bc, SCREEN_WIDTH * 2
|
||||
call AddNTimes
|
||||
ld de, wcd6d
|
||||
|
|
|
@ -10,11 +10,11 @@ DisplayDiploma::
|
|||
set 6, [hl]
|
||||
call DisableLCD
|
||||
ld hl, CircleTile
|
||||
ld de, vChars2 + CIRCLE_TILE_ID * $10
|
||||
ld de, vChars2 tile CIRCLE_TILE_ID
|
||||
ld bc, $10
|
||||
ld a, BANK(CircleTile)
|
||||
call FarCopyData2
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
lb bc, 16, 18
|
||||
predef Diploma_TextBoxBorder
|
||||
ld hl, DiplomaTextPointersAndCoords
|
||||
|
@ -35,10 +35,10 @@ DisplayDiploma::
|
|||
pop bc
|
||||
dec c
|
||||
jr nz, .asm_56715
|
||||
coord hl, 10, 4
|
||||
hlcoord 10, 4
|
||||
ld de, wPlayerName
|
||||
call PlaceString
|
||||
callba DrawPlayerCharacter
|
||||
farcall DrawPlayerCharacter
|
||||
|
||||
; Move the player 33 pixels right and set the priority bit so he appears
|
||||
; behind the background layer.
|
||||
|
@ -56,13 +56,13 @@ DisplayDiploma::
|
|||
jr nz, .adjustPlayerGfxLoop
|
||||
|
||||
call EnableLCD
|
||||
callba LoadTrainerInfoTextBoxTiles
|
||||
farcall LoadTrainerInfoTextBoxTiles
|
||||
ld b, SET_PAL_GENERIC
|
||||
call RunPaletteCommand
|
||||
call Delay3
|
||||
call GBPalNormal
|
||||
ld a, $90
|
||||
ld [rOBP0], a
|
||||
ldh [rOBP0], a
|
||||
call WaitForTextScrollButtonPress
|
||||
ld hl, wd730
|
||||
res 6, [hl]
|
||||
|
@ -85,15 +85,15 @@ UnusedPlayerNameLengthFunc:
|
|||
|
||||
DiplomaTextPointersAndCoords:
|
||||
dw DiplomaText
|
||||
dwCoord 5, 2
|
||||
dwcoord 5, 2
|
||||
dw DiplomaPlayer
|
||||
dwCoord 3, 4
|
||||
dwcoord 3, 4
|
||||
dw DiplomaEmptyText
|
||||
dwCoord 15, 4
|
||||
dwcoord 15, 4
|
||||
dw DiplomaCongrats
|
||||
dwCoord 2, 6
|
||||
dwcoord 2, 6
|
||||
dw DiplomaGameFreak
|
||||
dwCoord 9, 16
|
||||
dwcoord 9, 16
|
||||
|
||||
DiplomaText:
|
||||
db CIRCLE_TILE_ID, "Diploma", CIRCLE_TILE_ID, "@"
|
||||
|
|
|
@ -38,7 +38,7 @@ EvolveTradeMon:
|
|||
ld [wForceEvolution], a
|
||||
ld a, LINK_STATE_TRADING
|
||||
ld [wLinkState], a
|
||||
callab TryEvolvingMon
|
||||
callfar TryEvolvingMon
|
||||
xor a ; LINK_STATE_NONE
|
||||
ld [wLinkState], a
|
||||
jp PlayDefaultMusic
|
||||
|
|
|
@ -15,9 +15,9 @@ _GivePokemon::
|
|||
ld [wEnemyBattleStatus3], a
|
||||
ld a, [wcf91]
|
||||
ld [wEnemyMonSpecies2], a
|
||||
callab LoadEnemyMonData
|
||||
callfar LoadEnemyMonData
|
||||
call SetPokedexOwnedFlag
|
||||
callab SendNewMonToBox
|
||||
callfar SendNewMonToBox
|
||||
ld hl, wcf4b
|
||||
ld a, [wCurrentBoxNum]
|
||||
and $7f
|
||||
|
|
|
@ -67,9 +67,9 @@ HiddenCoins:
|
|||
and a
|
||||
ret nz
|
||||
xor a
|
||||
ld [hUnusedCoinsByte], a
|
||||
ld [hCoins], a
|
||||
ld [hCoins + 1], a
|
||||
ldh [hUnusedCoinsByte], a
|
||||
ldh [hCoins], a
|
||||
ldh [hCoins + 1], a
|
||||
ld a, [wHiddenObjectFunctionArgument]
|
||||
sub COIN
|
||||
cp 10
|
||||
|
@ -81,19 +81,19 @@ HiddenCoins:
|
|||
jr .bcd100
|
||||
.bcd10
|
||||
ld a, $10
|
||||
ld [hCoins + 1], a
|
||||
ldh [hCoins + 1], a
|
||||
jr .bcdDone
|
||||
.bcd20
|
||||
ld a, $20
|
||||
ld [hCoins + 1], a
|
||||
ldh [hCoins + 1], a
|
||||
jr .bcdDone
|
||||
.bcd40 ; due to a typo, this is never used
|
||||
ld a, $40
|
||||
ld [hCoins + 1], a
|
||||
ldh [hCoins + 1], a
|
||||
jr .bcdDone
|
||||
.bcd100
|
||||
ld a, $1
|
||||
ld [hCoins], a
|
||||
ldh [hCoins], a
|
||||
.bcdDone
|
||||
ld de, wPlayerCoins + 1
|
||||
ld hl, hCoins + 1
|
||||
|
|
|
@ -84,11 +84,11 @@ BillsHousePokemonList::
|
|||
.billsPokemonLoop
|
||||
ld hl, wd730
|
||||
set 6, [hl]
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
ld b, 10
|
||||
ld c, 9
|
||||
call TextBoxBorder
|
||||
coord hl, 2, 2
|
||||
hlcoord 2, 2
|
||||
ld de, BillsMonListText
|
||||
call PlaceString
|
||||
ld hl, BillsHousePokemonListText2
|
||||
|
|
|
@ -4,7 +4,7 @@ BookOrSculptureText::
|
|||
ld a, [wCurMapTileset]
|
||||
cp MANSION ; Celadon Mansion tileset
|
||||
jr nz, .ok
|
||||
aCoord 8, 6
|
||||
lda_coord 8, 6
|
||||
cp $38
|
||||
jr nz, .ok
|
||||
ld hl, DiglettSculptureText
|
||||
|
|
|
@ -6,7 +6,7 @@ PrintBookshelfText::
|
|||
; facing up
|
||||
ld a, [wCurMapTileset]
|
||||
ld b, a
|
||||
aCoord 8, 7
|
||||
lda_coord 8, 7
|
||||
ld c, a
|
||||
ld hl, BookshelfTileIDs
|
||||
.loop
|
||||
|
@ -24,7 +24,7 @@ PrintBookshelfText::
|
|||
pop af
|
||||
call PrintPredefTextID
|
||||
xor a
|
||||
ld [hFFDB], a
|
||||
ldh [hFFDB], a
|
||||
ret
|
||||
.nextBookshelfEntry1
|
||||
inc hl
|
||||
|
@ -33,7 +33,7 @@ PrintBookshelfText::
|
|||
jr .loop
|
||||
.noMatch
|
||||
ld a, $ff
|
||||
ld [hFFDB], a
|
||||
jpba PrintCardKeyText
|
||||
ldh [hFFDB], a
|
||||
farjp PrintCardKeyText
|
||||
|
||||
INCLUDE "data/tilesets/bookshelf_tile_ids.asm"
|
||||
|
|
|
@ -12,14 +12,14 @@ CinnabarGymQuiz::
|
|||
ld a, [wHiddenObjectFunctionArgument]
|
||||
push af
|
||||
and $f
|
||||
ld [hGymGateIndex], a
|
||||
ldh [hGymGateIndex], a
|
||||
pop af
|
||||
and $f0
|
||||
swap a
|
||||
ld [hGymGateAnswer], a
|
||||
ldh [hGymGateAnswer], a
|
||||
ld hl, CinnabarGymQuizIntroText
|
||||
call PrintText
|
||||
ld a, [hGymGateIndex]
|
||||
ldh a, [hGymGateIndex]
|
||||
dec a
|
||||
add a
|
||||
ld d, 0
|
||||
|
@ -77,18 +77,18 @@ CinnabarGymGateFlagAction:
|
|||
|
||||
CinnabarGymQuiz_1ea92:
|
||||
call YesNoChoice
|
||||
ld a, [hGymGateAnswer]
|
||||
ldh a, [hGymGateAnswer]
|
||||
ld c, a
|
||||
ld a, [wCurrentMenuItem]
|
||||
cp c
|
||||
jr nz, .wrongAnswer
|
||||
ld hl, wCurrentMapScriptFlags
|
||||
set 5, [hl]
|
||||
ld a, [hGymGateIndex]
|
||||
ld [hBackupGymGateIndex], a
|
||||
ldh a, [hGymGateIndex]
|
||||
ldh [hBackupGymGateIndex], a
|
||||
ld hl, CinnabarGymQuizCorrectText
|
||||
call PrintText
|
||||
ld a, [hBackupGymGateIndex]
|
||||
ldh a, [hBackupGymGateIndex]
|
||||
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
|
||||
ld c, a
|
||||
ld b, FLAG_SET
|
||||
|
@ -101,7 +101,7 @@ CinnabarGymQuiz_1ea92:
|
|||
call WaitForSoundToFinish
|
||||
ld hl, CinnabarGymQuizIncorrectText
|
||||
call PrintText
|
||||
ld a, [hGymGateIndex]
|
||||
ldh a, [hGymGateIndex]
|
||||
add $2
|
||||
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
|
||||
ld c, a
|
||||
|
@ -111,7 +111,7 @@ CinnabarGymQuiz_1ea92:
|
|||
ld a, c
|
||||
and a
|
||||
ret nz
|
||||
ld a, [hGymGateIndex]
|
||||
ldh a, [hGymGateIndex]
|
||||
add $2
|
||||
ld [wOpponentAfterWrongAnswer], a
|
||||
ret
|
||||
|
@ -122,7 +122,7 @@ CinnabarGymQuizCorrectText:
|
|||
text_promptbutton
|
||||
text_asm
|
||||
|
||||
ld a, [hBackupGymGateIndex]
|
||||
ldh a, [hBackupGymGateIndex]
|
||||
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
|
||||
ld c, a
|
||||
ld b, FLAG_TEST
|
||||
|
@ -144,9 +144,9 @@ UpdateCinnabarGymGateTileBlocks_::
|
|||
; Update the overworld map with open floor blocks or locked gate blocks
|
||||
; depending on event flags.
|
||||
ld a, 6
|
||||
ld [hGymGateIndex], a
|
||||
ldh [hGymGateIndex], a
|
||||
.loop
|
||||
ld a, [hGymGateIndex]
|
||||
ldh a, [hGymGateIndex]
|
||||
dec a
|
||||
add a
|
||||
add a
|
||||
|
@ -161,8 +161,8 @@ UpdateCinnabarGymGateTileBlocks_::
|
|||
ld a, [hl]
|
||||
ld [wGymGateTileBlock], a
|
||||
push bc
|
||||
ld a, [hGymGateIndex]
|
||||
ld [hBackupGymGateIndex], a
|
||||
ldh a, [hGymGateIndex]
|
||||
ldh [hBackupGymGateIndex], a
|
||||
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
|
||||
ld c, a
|
||||
ld b, FLAG_TEST
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
GymStatues:
|
||||
; if in a gym and have the corresponding badge, a = GymStatueText2_id and jp PrintPredefTextID
|
||||
; if in a gym and don’t 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
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld a, [wSpritePlayerStateData1FacingDirection]
|
||||
|
|
|
@ -26,10 +26,10 @@ DisplayMonFrontSpriteInBox:
|
|||
; Displays a pokemon's front sprite in a pop-up window.
|
||||
; [wcf91] = pokemon internal id number
|
||||
ld a, 1
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
call Delay3
|
||||
xor a
|
||||
ld [hWY], a
|
||||
ldh [hWY], a
|
||||
call SaveScreenTilesToBuffer1
|
||||
ld a, MON_SPRITE_POPUP
|
||||
ld [wTextBoxID], a
|
||||
|
@ -38,15 +38,15 @@ DisplayMonFrontSpriteInBox:
|
|||
ld a, [wcf91]
|
||||
ld [wd0b5], a
|
||||
call GetMonHeader
|
||||
ld de, vChars1 + $310
|
||||
ld de, vChars1 tile $31
|
||||
call LoadMonFrontSprite
|
||||
ld a, $80
|
||||
ld [hStartTileID], a
|
||||
coord hl, 10, 11
|
||||
ldh [hStartTileID], a
|
||||
hlcoord 10, 11
|
||||
predef AnimateSendingOutMon
|
||||
call WaitForTextScrollButtonPress
|
||||
call LoadScreenTilesFromBuffer1
|
||||
call Delay3
|
||||
ld a, $90
|
||||
ld [hWY], a
|
||||
ldh [hWY], a
|
||||
ret
|
||||
|
|
|
@ -37,12 +37,12 @@ SafariZoneGameOver:
|
|||
cp SFX_SAFARI_ZONE_PA
|
||||
jr nz, .waitForMusicToPlay
|
||||
ld a, TEXT_SAFARI_GAME_OVER
|
||||
ld [hSpriteIndexOrTextID], a
|
||||
ldh [hSpriteIndexOrTextID], a
|
||||
call DisplayTextID
|
||||
xor a
|
||||
ld [wPlayerMovingDirection], a
|
||||
ld a, SAFARI_ZONE_GATE
|
||||
ld [hWarpDestinationMap], a
|
||||
ldh [hWarpDestinationMap], a
|
||||
ld a, $3
|
||||
ld [wDestinationWarpID], a
|
||||
ld a, $5
|
||||
|
|
|
@ -26,11 +26,11 @@ LinkCableHelp::
|
|||
.linkHelpLoop
|
||||
ld hl, wd730
|
||||
set 6, [hl]
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
ld b, 8
|
||||
ld c, 13
|
||||
call TextBoxBorder
|
||||
coord hl, 2, 2
|
||||
hlcoord 2, 2
|
||||
ld de, HowToLinkText
|
||||
call PlaceString
|
||||
ld hl, LinkCableHelpText2
|
||||
|
@ -110,13 +110,13 @@ ViridianSchoolBlackboard::
|
|||
.blackboardLoop
|
||||
ld hl, wd730
|
||||
set 6, [hl]
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
lb bc, 6, 10
|
||||
call TextBoxBorder
|
||||
coord hl, 1, 2
|
||||
hlcoord 1, 2
|
||||
ld de, StatusAilmentText1
|
||||
call PlaceString
|
||||
coord hl, 6, 2
|
||||
hlcoord 6, 2
|
||||
ld de, StatusAilmentText2
|
||||
call PlaceString
|
||||
ld hl, ViridianSchoolBlackboardText2
|
||||
|
|
|
@ -8,15 +8,15 @@ TownMapText::
|
|||
set 6, [hl]
|
||||
call GBPalWhiteOutWithDelay3
|
||||
xor a
|
||||
ld [hWY], a
|
||||
ldh [hWY], a
|
||||
inc a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
call LoadFontTilePatterns
|
||||
callba DisplayTownMap
|
||||
farcall DisplayTownMap
|
||||
ld hl, wd730
|
||||
res 6, [hl]
|
||||
ld de, TextScriptEnd
|
||||
push de
|
||||
ld a, [hLoadedROMBank]
|
||||
ldh a, [hLoadedROMBank]
|
||||
push af
|
||||
jp CloseTextDisplay
|
||||
|
|
|
@ -56,12 +56,12 @@ GymTrashScript:
|
|||
; 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.
|
||||
|
||||
ld [hGymTrashCanRandNumMask], a
|
||||
ldh [hGymTrashCanRandNumMask], a
|
||||
push hl
|
||||
call Random
|
||||
swap a
|
||||
ld b, a
|
||||
ld a, [hGymTrashCanRandNumMask]
|
||||
ldh a, [hGymTrashCanRandNumMask]
|
||||
and b
|
||||
dec a
|
||||
pop hl
|
||||
|
|
|
@ -137,10 +137,10 @@ InGameTrade_DoTrade:
|
|||
ld [wMonDataLocation], a
|
||||
call AddPartyMon
|
||||
call InGameTrade_CopyDataToReceivedMon
|
||||
callab EvolveTradeMon
|
||||
callfar EvolveTradeMon
|
||||
call ClearScreen
|
||||
call InGameTrade_RestoreScreen
|
||||
callba RedrawMapView
|
||||
farcall RedrawMapView
|
||||
and a
|
||||
ld a, $3
|
||||
jr .tradeSucceeded
|
||||
|
@ -159,7 +159,7 @@ InGameTrade_RestoreScreen:
|
|||
call LoadGBPal
|
||||
ld c, 10
|
||||
call DelayFrames
|
||||
jpba LoadWildData
|
||||
farjp LoadWildData
|
||||
|
||||
InGameTrade_PrepareTradeData:
|
||||
ld hl, wTradedPlayerMonSpecies
|
||||
|
|
|
@ -9,16 +9,16 @@ OaksAideScript:
|
|||
ld b, wPokedexOwnedEnd - wPokedexOwned
|
||||
call CountSetBits
|
||||
ld a, [wNumSetBits]
|
||||
ld [hOaksAideNumMonsOwned], a
|
||||
ldh [hOaksAideNumMonsOwned], a
|
||||
ld b, a
|
||||
ld a, [hOaksAideRequirement]
|
||||
ldh a, [hOaksAideRequirement]
|
||||
cp b
|
||||
jr z, .giveItem
|
||||
jr nc, .notEnoughOwnedMons
|
||||
.giveItem
|
||||
ld hl, OaksAideHereYouGoText
|
||||
call PrintText
|
||||
ld a, [hOaksAideRewardItem]
|
||||
ldh a, [hOaksAideRewardItem]
|
||||
ld b, a
|
||||
ld c, 1
|
||||
call GiveItem
|
||||
|
@ -42,7 +42,7 @@ OaksAideScript:
|
|||
call PrintText
|
||||
ld a, $ff
|
||||
.done
|
||||
ld [hOaksAideResult], a
|
||||
ldh [hOaksAideResult], a
|
||||
ret
|
||||
|
||||
OaksAideHiText:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
PickUpItem:
|
||||
call EnableAutoTextBoxDrawing
|
||||
|
||||
ld a, [hSpriteIndexOrTextID]
|
||||
ldh a, [hSpriteIndexOrTextID]
|
||||
ld b, a
|
||||
ld hl, wMissableObjectList
|
||||
.missableObjectsListLoop
|
||||
|
@ -15,10 +15,10 @@ PickUpItem:
|
|||
|
||||
.isMissable
|
||||
ld a, [hl]
|
||||
ld [hMissableObjectIndex], a
|
||||
ldh [hMissableObjectIndex], a
|
||||
|
||||
ld hl, wMapSpriteExtraData
|
||||
ld a, [hSpriteIndexOrTextID]
|
||||
ldh a, [hSpriteIndexOrTextID]
|
||||
dec a
|
||||
add a
|
||||
ld d, 0
|
||||
|
@ -30,7 +30,7 @@ PickUpItem:
|
|||
call GiveItem
|
||||
jr nc, .BagFull
|
||||
|
||||
ld a, [hMissableObjectIndex]
|
||||
ldh a, [hMissableObjectIndex]
|
||||
ld [wMissableObjectIndex], a
|
||||
predef HideObject
|
||||
ld a, 1
|
||||
|
|
|
@ -52,7 +52,7 @@ ApplyOutOfBattlePoisonDamage:
|
|||
ld [wJoyIgnore], a
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld a, TEXT_MON_FAINTED
|
||||
ld [hSpriteIndexOrTextID], a
|
||||
ldh [hSpriteIndexOrTextID], a
|
||||
call DisplayTextID
|
||||
pop de
|
||||
pop hl
|
||||
|
@ -99,7 +99,7 @@ ApplyOutOfBattlePoisonDamage:
|
|||
jr nz, .noBlackOut
|
||||
call EnableAutoTextBoxDrawing
|
||||
ld a, TEXT_BLACKED_OUT
|
||||
ld [hSpriteIndexOrTextID], a
|
||||
ldh [hSpriteIndexOrTextID], a
|
||||
call DisplayTextID
|
||||
ld hl, wd72e
|
||||
set 5, [hl]
|
||||
|
|
|
@ -22,7 +22,7 @@ DisplayPokemonCenterDialogue_::
|
|||
ld [wSprite01StateData1ImageIndex], a ; make the nurse turn to face the machine
|
||||
call Delay3
|
||||
predef HealParty
|
||||
callba AnimateHealingMachine ; do the healing machine animation
|
||||
farcall AnimateHealingMachine ; do the healing machine animation
|
||||
xor a
|
||||
ld [wAudioFadeOutControl], a
|
||||
ld a, [wAudioSavedROMBank]
|
||||
|
|
|
@ -3,17 +3,17 @@ DisplayDexRating:
|
|||
ld b, wPokedexSeenEnd - wPokedexSeen
|
||||
call CountSetBits
|
||||
ld a, [wNumSetBits]
|
||||
ld [hDexRatingNumMonsSeen], a
|
||||
ldh [hDexRatingNumMonsSeen], a
|
||||
ld hl, wPokedexOwned
|
||||
ld b, wPokedexOwnedEnd - wPokedexOwned
|
||||
call CountSetBits
|
||||
ld a, [wNumSetBits]
|
||||
ld [hDexRatingNumMonsOwned], a
|
||||
ldh [hDexRatingNumMonsOwned], a
|
||||
ld hl, DexRatingsTable
|
||||
.findRating
|
||||
ld a, [hli]
|
||||
ld b, a
|
||||
ld a, [hDexRatingNumMonsOwned]
|
||||
ldh a, [hDexRatingNumMonsOwned]
|
||||
cp b
|
||||
jr c, .foundRating
|
||||
inc hl
|
||||
|
@ -30,14 +30,14 @@ DisplayDexRating:
|
|||
call PrintText
|
||||
pop hl
|
||||
call PrintText
|
||||
callba PlayPokedexRatingSfx
|
||||
farcall PlayPokedexRatingSfx
|
||||
jp WaitForTextScrollButtonPress
|
||||
.hallOfFame
|
||||
ld de, wDexRatingNumMonsSeen
|
||||
ld a, [hDexRatingNumMonsSeen]
|
||||
ldh a, [hDexRatingNumMonsSeen]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hDexRatingNumMonsOwned]
|
||||
ldh a, [hDexRatingNumMonsOwned]
|
||||
ld [de], a
|
||||
inc de
|
||||
.copyRatingTextLoop
|
||||
|
|
|
@ -42,7 +42,7 @@ DisplayPokemartDialogue_::
|
|||
ld [wPrintItemPrices], a
|
||||
ld a, INIT_BAG_ITEM_LIST
|
||||
ld [wInitListType], a
|
||||
callab InitList
|
||||
callfar InitList
|
||||
|
||||
ld a, [wNumBagItems]
|
||||
and a
|
||||
|
@ -77,14 +77,14 @@ DisplayPokemartDialogue_::
|
|||
jr c, .unsellableItem
|
||||
ld a, PRICEDITEMLISTMENU
|
||||
ld [wListMenuID], a
|
||||
ld [hHalveItemPrices], a ; halve prices when selling
|
||||
ldh [hHalveItemPrices], a ; halve prices when selling
|
||||
call DisplayChooseQuantityMenu
|
||||
inc a
|
||||
jr z, .sellMenuLoop ; if the player closed the choose quantity menu with the B button
|
||||
ld hl, PokemartTellSellPriceText
|
||||
lb bc, 14, 1 ; location that PrintText always prints to, this is useless
|
||||
call PrintText
|
||||
coord hl, 14, 7
|
||||
hlcoord 14, 7
|
||||
lb bc, 8, 15
|
||||
ld a, TWO_OPTION_MENU
|
||||
ld [wTextBoxID], a
|
||||
|
@ -126,7 +126,7 @@ DisplayPokemartDialogue_::
|
|||
ld [wPrintItemPrices], a
|
||||
ld a, INIT_OTHER_ITEM_LIST
|
||||
ld [wInitListType], a
|
||||
callab InitList
|
||||
callfar InitList
|
||||
|
||||
ld hl, PokemartBuyingGreetingText
|
||||
call PrintText
|
||||
|
@ -152,7 +152,7 @@ DisplayPokemartDialogue_::
|
|||
ld a, 99
|
||||
ld [wMaxItemQuantity], 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
|
||||
inc a
|
||||
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
|
||||
ld hl, PokemartTellBuyPriceText
|
||||
call PrintText
|
||||
coord hl, 14, 7
|
||||
hlcoord 14, 7
|
||||
lb bc, 8, 15
|
||||
ld a, TWO_OPTION_MENU
|
||||
ld [wTextBoxID], a
|
||||
|
|
|
@ -22,7 +22,7 @@ CeladonPrizeMenu::
|
|||
ld a, $01
|
||||
ld [wTopMenuItemX], a
|
||||
call PrintPrizePrice
|
||||
coord hl, 0, 2
|
||||
hlcoord 0, 2
|
||||
ld b, 8
|
||||
ld c, 16
|
||||
call TextBoxBorder
|
||||
|
@ -64,7 +64,7 @@ GetPrizeMenuId:
|
|||
; display the three prizes' names
|
||||
; (distinguishing between Pokemon names
|
||||
; and Items (specifically TMs) names)
|
||||
ld a, [hSpriteIndexOrTextID]
|
||||
ldh a, [hSpriteIndexOrTextID]
|
||||
sub 3 ; prize-texts' id are 3, 4 and 5
|
||||
ld [wWhichPrizeWindow], a ; prize-texts' id (relative, i.e. 0, 1 or 2)
|
||||
add a
|
||||
|
@ -93,71 +93,71 @@ GetPrizeMenuId:
|
|||
ld a, [wPrize1]
|
||||
ld [wd11e], a
|
||||
call GetItemName
|
||||
coord hl, 2, 4
|
||||
hlcoord 2, 4
|
||||
call PlaceString
|
||||
ld a, [wPrize2]
|
||||
ld [wd11e], a
|
||||
call GetItemName
|
||||
coord hl, 2, 6
|
||||
hlcoord 2, 6
|
||||
call PlaceString
|
||||
ld a, [wPrize3]
|
||||
ld [wd11e], a
|
||||
call GetItemName
|
||||
coord hl, 2, 8
|
||||
hlcoord 2, 8
|
||||
call PlaceString
|
||||
jr .putNoThanksText
|
||||
.putMonName
|
||||
ld a, [wPrize1]
|
||||
ld [wd11e], a
|
||||
call GetMonName
|
||||
coord hl, 2, 4
|
||||
hlcoord 2, 4
|
||||
call PlaceString
|
||||
ld a, [wPrize2]
|
||||
ld [wd11e], a
|
||||
call GetMonName
|
||||
coord hl, 2, 6
|
||||
hlcoord 2, 6
|
||||
call PlaceString
|
||||
ld a, [wPrize3]
|
||||
ld [wd11e], a
|
||||
call GetMonName
|
||||
coord hl, 2, 8
|
||||
hlcoord 2, 8
|
||||
call PlaceString
|
||||
.putNoThanksText
|
||||
coord hl, 2, 10
|
||||
hlcoord 2, 10
|
||||
ld de, NoThanksText
|
||||
call PlaceString
|
||||
; put prices on the right side of the textbox
|
||||
ld de, wPrize1Price
|
||||
coord hl, 13, 5
|
||||
hlcoord 13, 5
|
||||
; reg. c:
|
||||
; [low nybble] number of bytes
|
||||
; [bits 765 = %100] space-padding (not zero-padding)
|
||||
ld c, (1 << 7 | 2)
|
||||
call PrintBCDNumber
|
||||
ld de, wPrize2Price
|
||||
coord hl, 13, 7
|
||||
hlcoord 13, 7
|
||||
ld c, (1 << 7 | 2)
|
||||
call PrintBCDNumber
|
||||
ld de, wPrize3Price
|
||||
coord hl, 13, 9
|
||||
hlcoord 13, 9
|
||||
ld c, (1 << 7 | 2)
|
||||
jp PrintBCDNumber
|
||||
|
||||
INCLUDE "data/events/prizes.asm"
|
||||
|
||||
PrintPrizePrice:
|
||||
coord hl, 11, 0
|
||||
hlcoord 11, 0
|
||||
ld b, 1
|
||||
ld c, 7
|
||||
call TextBoxBorder
|
||||
call UpdateSprites
|
||||
coord hl, 12, 0
|
||||
hlcoord 12, 0
|
||||
ld de, .CoinString
|
||||
call PlaceString
|
||||
coord hl, 13, 1
|
||||
hlcoord 13, 1
|
||||
ld de, .SixSpacesString
|
||||
call PlaceString
|
||||
coord hl, 13, 1
|
||||
hlcoord 13, 1
|
||||
ld de, wPlayerCoins
|
||||
ld c, %10000010
|
||||
call PrintBCDNumber
|
||||
|
@ -177,11 +177,11 @@ LoadCoinsToSubtract:
|
|||
ld hl, wPrize1Price
|
||||
add hl, de ; get selected prize's price
|
||||
xor a
|
||||
ld [hUnusedCoinsByte], a
|
||||
ldh [hUnusedCoinsByte], a
|
||||
ld a, [hli]
|
||||
ld [hCoins], a
|
||||
ldh [hCoins], a
|
||||
ld a, [hl]
|
||||
ld [hCoins + 1], a
|
||||
ldh [hCoins + 1], a
|
||||
ret
|
||||
|
||||
HandlePrizeChoice:
|
||||
|
|
|
@ -2,7 +2,7 @@ RemoveGuardDrink::
|
|||
ld hl, GuardDrinksList
|
||||
.drinkLoop
|
||||
ld a, [hli]
|
||||
ld [hItemToRemoveID], a
|
||||
ldh [hItemToRemoveID], a
|
||||
and a
|
||||
ret z
|
||||
push hl
|
||||
|
@ -10,6 +10,6 @@ RemoveGuardDrink::
|
|||
call IsItemInBag
|
||||
pop hl
|
||||
jr z, .drinkLoop
|
||||
jpba RemoveItemByID
|
||||
farjp RemoveItemByID
|
||||
|
||||
INCLUDE "data/items/guard_drink_items.asm"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
; this function temporarily makes the starters (and Ivysaur) seen
|
||||
; so that the full Pokedex information gets displayed in Oak's lab
|
||||
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
|
||||
predef ShowPokedexData
|
||||
xor a ; unset starter flags
|
||||
xor a
|
||||
ld [wPokedexOwned], a
|
||||
ret
|
||||
|
|
|
@ -17,15 +17,15 @@ VendingMachineMenu::
|
|||
ld [wTopMenuItemX], a
|
||||
ld hl, wd730
|
||||
set 6, [hl]
|
||||
coord hl, 0, 3
|
||||
hlcoord 0, 3
|
||||
ld b, 8
|
||||
ld c, 12
|
||||
call TextBoxBorder
|
||||
call UpdateSprites
|
||||
coord hl, 2, 5
|
||||
hlcoord 2, 5
|
||||
ld de, DrinkText
|
||||
call PlaceString
|
||||
coord hl, 9, 6
|
||||
hlcoord 9, 6
|
||||
ld de, DrinkPriceText
|
||||
call PlaceString
|
||||
ld hl, wd730
|
||||
|
@ -37,17 +37,17 @@ VendingMachineMenu::
|
|||
cp 3 ; chose Cancel?
|
||||
jr z, .notThirsty
|
||||
xor a
|
||||
ld [hMoney], a
|
||||
ld [hMoney + 2], a
|
||||
ldh [hMoney], a
|
||||
ldh [hMoney + 2], a
|
||||
ld a, $2
|
||||
ld [hMoney + 1], a
|
||||
ldh [hMoney + 1], a
|
||||
call HasEnoughMoney
|
||||
jr nc, .enoughMoney
|
||||
ld hl, VendingMachineText4
|
||||
jp PrintText
|
||||
.enoughMoney
|
||||
call LoadVendingMachineItem
|
||||
ld a, [hVendingMachineItem]
|
||||
ldh a, [hVendingMachineItem]
|
||||
ld b, a
|
||||
ld c, 1
|
||||
call GiveItem
|
||||
|
@ -121,13 +121,13 @@ LoadVendingMachineItem:
|
|||
ld e, a
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld [hVendingMachineItem], a
|
||||
ldh [hVendingMachineItem], a
|
||||
ld a, [hli]
|
||||
ld [hVendingMachinePrice], a
|
||||
ldh [hVendingMachinePrice], a
|
||||
ld a, [hli]
|
||||
ld [hVendingMachinePrice + 1], a
|
||||
ldh [hVendingMachinePrice + 1], a
|
||||
ld a, [hl]
|
||||
ld [hVendingMachinePrice + 2], a
|
||||
ldh [hVendingMachinePrice + 2], a
|
||||
ret
|
||||
|
||||
INCLUDE "data/items/vending_prices.asm"
|
||||
|
|
|
@ -21,22 +21,22 @@ GetHPBarLength:
|
|||
rr e
|
||||
srl d
|
||||
rr e
|
||||
ld a, [hMultiplicand+1]
|
||||
ldh a, [hMultiplicand+1]
|
||||
ld b, a
|
||||
ld a, [hMultiplicand+2]
|
||||
ldh a, [hMultiplicand+2]
|
||||
srl b ; divide multiplication result as well
|
||||
rr a
|
||||
srl b
|
||||
rr a
|
||||
ld [hMultiplicand+2], a
|
||||
ldh [hMultiplicand+2], a
|
||||
ld a, b
|
||||
ld [hMultiplicand+1], a
|
||||
ldh [hMultiplicand+1], a
|
||||
.maxHPSmaller256
|
||||
ld a, e
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, $4
|
||||
call Divide
|
||||
ld a, [hMultiplicand+2]
|
||||
ldh a, [hMultiplicand+2]
|
||||
ld e, a ; e = bc * 48 / de (num of pixels of HP bar)
|
||||
pop hl
|
||||
and a
|
||||
|
@ -213,7 +213,7 @@ UpdateHPBar_PrintHPNumber:
|
|||
ld a, [wHPBarOldHP + 1]
|
||||
ld [wHPBarTempHP], a
|
||||
push hl
|
||||
ld a, [hFlagsFFF6]
|
||||
ldh a, [hFlagsFFF6]
|
||||
bit 0, a
|
||||
jr z, .asm_fb15
|
||||
ld de, $9
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
LoadPokedexTilePatterns:
|
||||
call LoadHpBarAndStatusTilePatterns
|
||||
ld de, PokedexTileGraphics
|
||||
ld hl, vChars2 + $600
|
||||
ld hl, vChars2 tile $60
|
||||
lb bc, BANK(PokedexTileGraphics), (PokedexTileGraphicsEnd - PokedexTileGraphics) / $10
|
||||
call CopyVideoData
|
||||
ld de, PokeballTileGraphics
|
||||
ld hl, vChars2 + $720
|
||||
lb bc, BANK(PokeballTileGraphics), $01
|
||||
ld hl, vChars2 tile $72
|
||||
lb bc, BANK(PokeballTileGraphics), 1
|
||||
jp CopyVideoData ; load pokeball tile for marking caught mons
|
||||
|
|
|
@ -169,7 +169,7 @@ WriteMonPartySpriteOAMByPartyIndex:
|
|||
push hl
|
||||
push de
|
||||
push bc
|
||||
ld a, [hPartyMonIndex]
|
||||
ldh a, [hPartyMonIndex]
|
||||
ld hl, wPartySpecies
|
||||
ld e, a
|
||||
ld d, 0
|
||||
|
@ -187,7 +187,7 @@ WriteMonPartySpriteOAMBySpecies:
|
|||
; Write OAM blocks for the party sprite of the species in
|
||||
; [wMonPartySpriteSpecies].
|
||||
xor a
|
||||
ld [hPartyMonIndex], a
|
||||
ldh [hPartyMonIndex], a
|
||||
ld a, [wMonPartySpriteSpecies]
|
||||
call GetPartyMonSpriteID
|
||||
ld [wOAMBaseTile], a
|
||||
|
@ -201,11 +201,11 @@ UnusedPartyMonSpriteFunction:
|
|||
ld a, [wcf91]
|
||||
call GetPartyMonSpriteID
|
||||
push af
|
||||
ld hl, vSprites
|
||||
ld hl, vSprites tile $00
|
||||
call .LoadTilePatterns
|
||||
pop af
|
||||
add $54
|
||||
ld hl, vSprites + $40
|
||||
ld hl, vSprites tile $04
|
||||
call .LoadTilePatterns
|
||||
xor a
|
||||
ld [wMonPartySpriteSpecies], a
|
||||
|
@ -236,8 +236,8 @@ WriteMonPartySpriteOAM:
|
|||
; make a copy at wMonPartySpritesSavedOAM.
|
||||
push af
|
||||
ld c, $10
|
||||
ld h, wOAMBuffer / $100
|
||||
ld a, [hPartyMonIndex]
|
||||
ld h, HIGH(wOAMBuffer)
|
||||
ldh a, [hPartyMonIndex]
|
||||
swap a
|
||||
ld l, a
|
||||
add $10
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
WriteDMACodeToHRAM::
|
||||
; Since no other memory is available during OAM DMA,
|
||||
; DMARoutine is copied to HRAM and executed there.
|
||||
ld c, hDMARoutine % $100
|
||||
ld c, LOW(hDMARoutine)
|
||||
ld b, DMARoutineEnd - DMARoutine
|
||||
ld hl, DMARoutine
|
||||
.copy
|
||||
|
@ -14,8 +14,8 @@ WriteDMACodeToHRAM::
|
|||
|
||||
DMARoutine:
|
||||
; initiate DMA
|
||||
ld a, wOAMBuffer / $100
|
||||
ld [rDMA], a
|
||||
ld a, HIGH(wOAMBuffer)
|
||||
ldh [rDMA], a
|
||||
|
||||
; wait for DMA to finish
|
||||
ld a, $28
|
||||
|
|
|
@ -335,13 +335,13 @@ SendSGBPacket:
|
|||
push bc
|
||||
; disable ReadJoypad to prevent it from interfering with sending the packet
|
||||
ld a, 1
|
||||
ld [hDisableJoypadPolling], a
|
||||
ldh [hDisableJoypadPolling], a
|
||||
; send RESET signal (P14=LOW, P15=LOW)
|
||||
xor a
|
||||
ld [rJOYP], a
|
||||
ldh [rJOYP], a
|
||||
; set P14=HIGH, P15=HIGH
|
||||
ld a, $30
|
||||
ld [rJOYP], a
|
||||
ldh [rJOYP], a
|
||||
;load length of packets (16 bytes)
|
||||
ld b, $10
|
||||
.nextByte
|
||||
|
@ -358,10 +358,10 @@ SendSGBPacket:
|
|||
; else (if 0th bit is zero) set P14=LOW,P15=HIGH (send bit 0)
|
||||
ld a, $20
|
||||
.next0
|
||||
ld [rJOYP], a
|
||||
ldh [rJOYP], a
|
||||
; must set P14=HIGH,P15=HIGH between each "pulse"
|
||||
ld a, $30
|
||||
ld [rJOYP], a
|
||||
ldh [rJOYP], a
|
||||
; 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)
|
||||
rr d
|
||||
|
@ -372,12 +372,12 @@ SendSGBPacket:
|
|||
jr nz, .nextByte
|
||||
; send bit 1 as a "stop bit" (end of parameter data)
|
||||
ld a, $20
|
||||
ld [rJOYP], a
|
||||
ldh [rJOYP], a
|
||||
; set P14=HIGH,P15=HIGH
|
||||
ld a, $30
|
||||
ld [rJOYP], a
|
||||
ldh [rJOYP], a
|
||||
xor a
|
||||
ld [hDisableJoypadPolling], a
|
||||
ldh [hDisableJoypadPolling], a
|
||||
; wait for about 70000 cycles
|
||||
call Wait7000
|
||||
; restore (previously pushed) number of packets
|
||||
|
@ -457,41 +457,41 @@ CheckSGB:
|
|||
di
|
||||
call SendSGBPacket
|
||||
ld a, 1
|
||||
ld [hDisableJoypadPolling], a
|
||||
ldh [hDisableJoypadPolling], a
|
||||
ei
|
||||
call Wait7000
|
||||
ld a, [rJOYP]
|
||||
ldh a, [rJOYP]
|
||||
and $3
|
||||
cp $3
|
||||
jr nz, .isSGB
|
||||
ld a, $20
|
||||
ld [rJOYP], a
|
||||
ld a, [rJOYP]
|
||||
ld a, [rJOYP]
|
||||
ldh [rJOYP], a
|
||||
ldh a, [rJOYP]
|
||||
ldh a, [rJOYP]
|
||||
call Wait7000
|
||||
call Wait7000
|
||||
ld a, $30
|
||||
ld [rJOYP], a
|
||||
ldh [rJOYP], a
|
||||
call Wait7000
|
||||
call Wait7000
|
||||
ld a, $10
|
||||
ld [rJOYP], a
|
||||
ld a, [rJOYP]
|
||||
ld a, [rJOYP]
|
||||
ld a, [rJOYP]
|
||||
ld a, [rJOYP]
|
||||
ld a, [rJOYP]
|
||||
ld a, [rJOYP]
|
||||
ldh [rJOYP], a
|
||||
ldh a, [rJOYP]
|
||||
ldh a, [rJOYP]
|
||||
ldh a, [rJOYP]
|
||||
ldh a, [rJOYP]
|
||||
ldh a, [rJOYP]
|
||||
ldh a, [rJOYP]
|
||||
call Wait7000
|
||||
call Wait7000
|
||||
ld a, $30
|
||||
ld [rJOYP], a
|
||||
ld a, [rJOYP]
|
||||
ld a, [rJOYP]
|
||||
ld a, [rJOYP]
|
||||
ldh [rJOYP], a
|
||||
ldh a, [rJOYP]
|
||||
ldh a, [rJOYP]
|
||||
ldh a, [rJOYP]
|
||||
call Wait7000
|
||||
call Wait7000
|
||||
ld a, [rJOYP]
|
||||
ldh a, [rJOYP]
|
||||
and $3
|
||||
cp $3
|
||||
jr nz, .isSGB
|
||||
|
@ -513,7 +513,7 @@ CopyGfxToSuperNintendoVRAM:
|
|||
push de
|
||||
call DisableLCD
|
||||
ld a, $e4
|
||||
ld [rBGP], a
|
||||
ldh [rBGP], a
|
||||
ld de, vChars1
|
||||
ld a, [wCopyingSGBTileData]
|
||||
and a
|
||||
|
@ -539,11 +539,11 @@ CopyGfxToSuperNintendoVRAM:
|
|||
dec c
|
||||
jr nz, .loop
|
||||
ld a, $e3
|
||||
ld [rLCDC], a
|
||||
ldh [rLCDC], a
|
||||
pop hl
|
||||
call SendSGBPacket
|
||||
xor a
|
||||
ld [rBGP], a
|
||||
ldh [rBGP], a
|
||||
ei
|
||||
ret
|
||||
|
||||
|
@ -577,7 +577,7 @@ SendSGBPackets:
|
|||
|
||||
InitGBCPalettes:
|
||||
ld a, $80 ; index 0 with auto-increment
|
||||
ld [rBGPI], a
|
||||
ldh [rBGPI], a
|
||||
inc hl
|
||||
ld c, $20
|
||||
.loop
|
||||
|
@ -592,7 +592,7 @@ InitGBCPalettes:
|
|||
inc d
|
||||
.noCarry
|
||||
ld a, [de]
|
||||
ld [rBGPD], a
|
||||
ldh [rBGPD], a
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
; b = new colour for BG colour 0 (usually white) for 4 frames
|
||||
ChangeBGPalColor0_4Frames:
|
||||
call GetPredefRegisters
|
||||
ld a, [rBGP]
|
||||
ldh a, [rBGP]
|
||||
or b
|
||||
ld [rBGP], a
|
||||
ldh [rBGP], a
|
||||
ld c, 4
|
||||
call DelayFrames
|
||||
ld a, [rBGP]
|
||||
ldh a, [rBGP]
|
||||
and %11111100
|
||||
ld [rBGP], a
|
||||
ldh [rBGP], a
|
||||
ret
|
||||
|
||||
PredefShakeScreenVertically:
|
||||
|
@ -19,7 +19,7 @@ PredefShakeScreenVertically:
|
|||
ld [wDisableVBlankWYUpdate], a
|
||||
xor a
|
||||
.loop
|
||||
ld [hMutateWY], a
|
||||
ldh [hMutateWY], a
|
||||
call .MutateWY
|
||||
call .MutateWY
|
||||
dec b
|
||||
|
@ -30,10 +30,10 @@ PredefShakeScreenVertically:
|
|||
ret
|
||||
|
||||
.MutateWY
|
||||
ld a, [hMutateWY]
|
||||
ldh a, [hMutateWY]
|
||||
xor b
|
||||
ld [hMutateWY], a
|
||||
ld [rWY], a
|
||||
ldh [hMutateWY], a
|
||||
ldh [rWY], a
|
||||
ld c, 3
|
||||
jp DelayFrames
|
||||
|
||||
|
@ -43,7 +43,7 @@ PredefShakeScreenHorizontally:
|
|||
call GetPredefRegisters
|
||||
xor a
|
||||
.loop
|
||||
ld [hMutateWX], a
|
||||
ldh [hMutateWX], a
|
||||
call .MutateWX
|
||||
ld c, 1
|
||||
call DelayFrames
|
||||
|
@ -54,18 +54,18 @@ PredefShakeScreenHorizontally:
|
|||
|
||||
; restore normal WX
|
||||
ld a, 7
|
||||
ld [rWX], a
|
||||
ldh [rWX], a
|
||||
ret
|
||||
|
||||
.MutateWX
|
||||
ld a, [hMutateWX]
|
||||
ldh a, [hMutateWX]
|
||||
xor b
|
||||
ld [hMutateWX], a
|
||||
ldh [hMutateWX], a
|
||||
bit 7, a
|
||||
jr z, .skipZeroing
|
||||
xor a ; zero a if it's negative
|
||||
.skipZeroing
|
||||
add 7
|
||||
ld [rWX], a
|
||||
ldh [rWX], a
|
||||
ld c, 4
|
||||
jp DelayFrames
|
||||
|
|
|
@ -13,21 +13,21 @@ PrepareOAMData::
|
|||
|
||||
.updateEnabled
|
||||
xor a
|
||||
ld [hOAMBufferOffset], a
|
||||
ldh [hOAMBufferOffset], a
|
||||
|
||||
.spriteLoop
|
||||
ld [hSpriteOffset2], a
|
||||
ldh [hSpriteOffset2], a
|
||||
|
||||
ld d, wSpriteStateData1 / $100
|
||||
ld a, [hSpriteOffset2]
|
||||
ld d, HIGH(wSpriteStateData1)
|
||||
ldh a, [hSpriteOffset2]
|
||||
ld e, a
|
||||
ld a, [de] ; c1x0
|
||||
ld a, [de] ; [x#SPRITESTATEDATA1_PICTUREID]
|
||||
and a
|
||||
jp z, .nextSprite
|
||||
|
||||
inc e
|
||||
inc e
|
||||
ld a, [de] ; c1x2 (facing/anim)
|
||||
ld a, [de] ; [x#SPRITESTATEDATA1_IMAGEINDEX]
|
||||
ld [wd5cd], a
|
||||
cp $ff ; off-screen (don't draw)
|
||||
jr nz, .visible
|
||||
|
@ -56,9 +56,9 @@ PrepareOAMData::
|
|||
ld a, e
|
||||
add $5
|
||||
ld e, a
|
||||
ld a, [de] ; c2x7
|
||||
ld a, [de] ; [x#SPRITESTATEDATA2_GRASSPRIORITY]
|
||||
and $80
|
||||
ld [hSpritePriority], a ; temp store sprite priority
|
||||
ldh [hSpritePriority], a ; temp store sprite priority
|
||||
pop de
|
||||
|
||||
; read the entry from the table
|
||||
|
@ -77,17 +77,17 @@ PrepareOAMData::
|
|||
|
||||
call GetSpriteScreenXY
|
||||
|
||||
ld a, [hOAMBufferOffset]
|
||||
ldh a, [hOAMBufferOffset]
|
||||
ld e, a
|
||||
ld d, wOAMBuffer / $100
|
||||
ld d, HIGH(wOAMBuffer)
|
||||
|
||||
.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 [hl] ; add Y offset from table
|
||||
ld [de], a ; write new sprite OAM Y position
|
||||
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 [hl] ; add X offset from table
|
||||
inc e
|
||||
|
@ -98,7 +98,7 @@ PrepareOAMData::
|
|||
push bc
|
||||
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)
|
||||
and $f
|
||||
|
||||
|
@ -126,7 +126,7 @@ PrepareOAMData::
|
|||
ld a, [hl]
|
||||
bit 1, a ; is the tile allowed to set the sprite priority bit?
|
||||
jr z, .skipPriority
|
||||
ld a, [hSpritePriority]
|
||||
ldh a, [hSpritePriority]
|
||||
or [hl]
|
||||
.skipPriority
|
||||
inc hl
|
||||
|
@ -136,18 +136,18 @@ PrepareOAMData::
|
|||
jr z, .tileLoop
|
||||
|
||||
ld a, e
|
||||
ld [hOAMBufferOffset], a
|
||||
ldh [hOAMBufferOffset], a
|
||||
|
||||
.nextSprite
|
||||
ld a, [hSpriteOffset2]
|
||||
ldh a, [hSpriteOffset2]
|
||||
add $10
|
||||
cp $100 % $100
|
||||
cp LOW($100)
|
||||
jp nz, .spriteLoop
|
||||
|
||||
; Clear unused OAM.
|
||||
ld a, [hOAMBufferOffset]
|
||||
ldh a, [hOAMBufferOffset]
|
||||
ld l, a
|
||||
ld h, wOAMBuffer / $100
|
||||
ld h, HIGH(wOAMBuffer)
|
||||
ld de, $4
|
||||
ld b, $a0
|
||||
ld a, [wd736]
|
||||
|
@ -169,21 +169,21 @@ PrepareOAMData::
|
|||
GetSpriteScreenXY:
|
||||
inc e
|
||||
inc e
|
||||
ld a, [de] ; c1x4
|
||||
ld [hSpriteScreenY], a
|
||||
ld a, [de] ; [x#SPRITESTATEDATA1_YPIXELS]
|
||||
ldh [hSpriteScreenY], a
|
||||
inc e
|
||||
inc e
|
||||
ld a, [de] ; c1x6
|
||||
ld [hSpriteScreenX], a
|
||||
ld a, [de] ; [x#SPRITESTATEDATA1_XPIXELS]
|
||||
ldh [hSpriteScreenX], a
|
||||
ld a, 4
|
||||
add e
|
||||
ld e, a
|
||||
ld a, [hSpriteScreenY]
|
||||
ldh a, [hSpriteScreenY]
|
||||
add 4
|
||||
and $f0
|
||||
ld [de], a ; c1xa (y)
|
||||
ld [de], a ; [x#SPRITESTATEDATA1_YADJUSTED]
|
||||
inc e
|
||||
ld a, [hSpriteScreenX]
|
||||
ldh a, [hSpriteScreenX]
|
||||
and $f0
|
||||
ld [de], a ; c1xb (x)
|
||||
ld [de], a ; [x#SPRITESTATEDATA1_XADJUSTED]
|
||||
ret
|
||||
|
|
|
@ -12,10 +12,10 @@ AddItemToInventory_::
|
|||
push hl
|
||||
push hl
|
||||
ld d, PC_ITEM_CAPACITY ; how many items the PC can hold
|
||||
ld a, wNumBagItems & $FF
|
||||
ld a, LOW(wNumBagItems)
|
||||
cp l
|
||||
jr nz, .checkIfInventoryFull
|
||||
ld a, wNumBagItems >> 8
|
||||
ld a, HIGH(wNumBagItems)
|
||||
cp h
|
||||
jr nz, .checkIfInventoryFull
|
||||
; if the destination is the bag
|
||||
|
|
|
@ -147,7 +147,7 @@ ItemUseBall:
|
|||
|
||||
; 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.
|
||||
callab IsGhostBattle
|
||||
callfar IsGhostBattle
|
||||
ld b, $10 ; can't be caught value
|
||||
jp z, .setAnimData
|
||||
|
||||
|
@ -239,14 +239,14 @@ ItemUseBall:
|
|||
|
||||
; Calculate MaxHP * 255.
|
||||
xor a
|
||||
ld [hMultiplicand], a
|
||||
ldh [hMultiplicand], a
|
||||
ld hl, wEnemyMonMaxHP
|
||||
ld a, [hli]
|
||||
ld [hMultiplicand + 1], a
|
||||
ldh [hMultiplicand + 1], a
|
||||
ld a, [hl]
|
||||
ld [hMultiplicand + 2], a
|
||||
ldh [hMultiplicand + 2], a
|
||||
ld a, 255
|
||||
ld [hMultiplier], a
|
||||
ldh [hMultiplier], a
|
||||
call Multiply
|
||||
|
||||
; 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.
|
||||
|
||||
; Calculate (MaxHP * 255) / BallFactor.
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, 4 ; number of bytes in dividend
|
||||
call Divide
|
||||
|
||||
|
@ -281,17 +281,17 @@ ItemUseBall:
|
|||
|
||||
.skip2
|
||||
; Let W = ((MaxHP * 255) / BallFactor) / max(HP / 4, 1). Calculate W.
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, 4
|
||||
call Divide
|
||||
|
||||
; If W > 255, store 255 in [hQuotient + 3].
|
||||
; Let X = min(W, 255) = [hQuotient + 3].
|
||||
ld a, [hQuotient + 2]
|
||||
ldh a, [hQuotient + 2]
|
||||
and a
|
||||
jr z, .skip3
|
||||
ld a, 255
|
||||
ld [hQuotient + 3], a
|
||||
ldh [hQuotient + 3], a
|
||||
|
||||
.skip3
|
||||
pop bc ; b = Rand1 - Status
|
||||
|
@ -302,7 +302,7 @@ ItemUseBall:
|
|||
jr c, .failedToCapture
|
||||
|
||||
; If W > 255, the ball captures the Pokémon.
|
||||
ld a, [hQuotient + 2]
|
||||
ldh a, [hQuotient + 2]
|
||||
and a
|
||||
jr nz, .captured
|
||||
|
||||
|
@ -310,7 +310,7 @@ ItemUseBall:
|
|||
|
||||
; If Rand2 > X, the ball fails to capture the Pokémon.
|
||||
ld b, a
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
cp b
|
||||
jr c, .failedToCapture
|
||||
|
||||
|
@ -318,17 +318,17 @@ ItemUseBall:
|
|||
jr .skipShakeCalculations
|
||||
|
||||
.failedToCapture
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
ld [wPokeBallCaptureCalcTemp], a ; Save X.
|
||||
|
||||
; Calculate CatchRate * 100.
|
||||
xor a
|
||||
ld [hMultiplicand], a
|
||||
ld [hMultiplicand + 1], a
|
||||
ldh [hMultiplicand], a
|
||||
ldh [hMultiplicand + 1], a
|
||||
ld a, [wEnemyMonActualCatchRate]
|
||||
ld [hMultiplicand + 2], a
|
||||
ldh [hMultiplicand + 2], a
|
||||
ld a, 100
|
||||
ld [hMultiplier], a
|
||||
ldh [hMultiplier], a
|
||||
call Multiply
|
||||
|
||||
; Determine BallFactor2.
|
||||
|
@ -349,26 +349,26 @@ ItemUseBall:
|
|||
.skip4
|
||||
; Let Y = (CatchRate * 100) / BallFactor2. Calculate Y.
|
||||
ld a, b
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, 4
|
||||
call Divide
|
||||
|
||||
; If Y > 255, there are 3 shakes.
|
||||
; Note that this shouldn't be possible.
|
||||
; The maximum value of Y is (255 * 100) / 150 = 170.
|
||||
ld a, [hQuotient + 2]
|
||||
ldh a, [hQuotient + 2]
|
||||
and a
|
||||
ld b, $63 ; 3 shakes
|
||||
jr nz, .setAnimData
|
||||
|
||||
; Calculate X * Y.
|
||||
ld a, [wPokeBallCaptureCalcTemp]
|
||||
ld [hMultiplier], a
|
||||
ldh [hMultiplier], a
|
||||
call Multiply
|
||||
|
||||
; Calculate (X * Y) / 255.
|
||||
ld a, 255
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, 4
|
||||
call Divide
|
||||
|
||||
|
@ -386,9 +386,9 @@ ItemUseBall:
|
|||
|
||||
.addAilmentValue
|
||||
; If the Pokémon has a status ailment, add Status2.
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
add b
|
||||
ld [hQuotient + 3], a
|
||||
ldh [hQuotient + 3], a
|
||||
|
||||
.skip5
|
||||
; Finally determine the number of shakes.
|
||||
|
@ -398,7 +398,7 @@ ItemUseBall:
|
|||
; 10 ≤ Z < 30: 1 shake
|
||||
; 30 ≤ Z < 70: 2 shakes
|
||||
; 70 ≤ Z: 3 shakes
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
cp 10
|
||||
ld b, $20
|
||||
jr c, .setAnimData
|
||||
|
@ -422,7 +422,7 @@ ItemUseBall:
|
|||
ld a, TOSS_ANIM
|
||||
ld [wAnimationID], a
|
||||
xor a
|
||||
ld [hWhoseTurn], a
|
||||
ldh [hWhoseTurn], a
|
||||
ld [wAnimationType], a
|
||||
ld [wDamageMultipliers], a
|
||||
ld a, [wWhichPokemon]
|
||||
|
@ -495,7 +495,7 @@ ItemUseBall:
|
|||
ld [wcf91], a
|
||||
ld a, [wEnemyMonLevel]
|
||||
ld [wCurEnemyLVL], a
|
||||
callab LoadEnemyMonData
|
||||
callfar LoadEnemyMonData
|
||||
pop af
|
||||
ld [wcf91], a
|
||||
pop hl
|
||||
|
@ -632,7 +632,7 @@ ItemUseTownMap:
|
|||
ld a, [wIsInBattle]
|
||||
and a
|
||||
jp nz, ItemUseNotTime
|
||||
jpba DisplayTownMap
|
||||
farjp DisplayTownMap
|
||||
|
||||
ItemUseBicycle:
|
||||
ld a, [wIsInBattle]
|
||||
|
@ -656,7 +656,7 @@ ItemUseBicycle:
|
|||
jp nc, NoCyclingAllowedHere
|
||||
call ItemUseReloadOverworldData
|
||||
xor a ; no keys pressed
|
||||
ld [hJoyHeld], a ; current joypad state
|
||||
ldh [hJoyHeld], a ; current joypad state
|
||||
inc a
|
||||
ld [wWalkBikeSurfState], a ; change player state to bicycling
|
||||
ld hl, GotOnBicycleText
|
||||
|
@ -687,11 +687,11 @@ ItemUseSurfboard:
|
|||
jp PrintText
|
||||
.tryToStopSurfing
|
||||
xor a
|
||||
ld [hSpriteIndexOrTextID], a
|
||||
ldh [hSpriteIndexOrTextID], a
|
||||
ld d, 16 ; talking range in pixels (normal range)
|
||||
call IsSpriteInFrontOfPlayer2
|
||||
res 7, [hl]
|
||||
ld a, [hSpriteIndexOrTextID]
|
||||
ldh a, [hSpriteIndexOrTextID]
|
||||
and a ; is there a sprite in the way?
|
||||
jr nz, .cannotStopSurfing
|
||||
ld hl, TilePairCollisionsWater
|
||||
|
@ -778,7 +778,7 @@ ItemUseEvoStone:
|
|||
ld a, SFX_HEAL_AILMENT
|
||||
call PlaySoundWaitForCurrent
|
||||
call WaitForSoundToFinish
|
||||
callab TryEvolvingMon ; try to evolve pokemon
|
||||
callfar TryEvolvingMon ; try to evolve pokemon
|
||||
ld a, [wEvolutionOccurred]
|
||||
and a
|
||||
jr z, .noEffect
|
||||
|
@ -1018,18 +1018,18 @@ ItemUseMedicine:
|
|||
call AddNTimes
|
||||
ld a, [hli]
|
||||
ld [wHPBarMaxHP + 1], a
|
||||
ld [hDividend], a
|
||||
ldh [hDividend], a
|
||||
ld a, [hl]
|
||||
ld [wHPBarMaxHP], a
|
||||
ld [hDividend + 1], a
|
||||
ldh [hDividend + 1], a
|
||||
ld a, 5
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, 2 ; number of bytes
|
||||
call Divide ; get 1/5 of max HP of pokemon that used Softboiled
|
||||
ld bc, (wPartyMon1HP + 1) - (wPartyMon1MaxHP + 1)
|
||||
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
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
push af
|
||||
ld b, a
|
||||
ld a, [hl]
|
||||
|
@ -1037,28 +1037,28 @@ ItemUseMedicine:
|
|||
sub b
|
||||
ld [hld], a
|
||||
ld [wHPBarNewHP], a
|
||||
ld a, [hQuotient + 2]
|
||||
ldh a, [hQuotient + 2]
|
||||
ld b, a
|
||||
ld a, [hl]
|
||||
ld [wHPBarOldHP+1], a
|
||||
sbc b
|
||||
ld [hl], a
|
||||
ld [wHPBarNewHP+1], a
|
||||
coord hl, 4, 1
|
||||
hlcoord 4, 1
|
||||
ld a, [wWhichPokemon]
|
||||
ld bc, 2 * SCREEN_WIDTH
|
||||
call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled
|
||||
ld a, SFX_HEAL_HP
|
||||
call PlaySoundWaitForCurrent
|
||||
ld a, [hFlagsFFF6]
|
||||
ldh a, [hFlagsFFF6]
|
||||
set 0, a
|
||||
ld [hFlagsFFF6], a
|
||||
ldh [hFlagsFFF6], a
|
||||
ld a, $02
|
||||
ld [wHPBarType], a
|
||||
predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled
|
||||
ld a, [hFlagsFFF6]
|
||||
ldh a, [hFlagsFFF6]
|
||||
res 0, a
|
||||
ld [hFlagsFFF6], a
|
||||
ldh [hFlagsFFF6], a
|
||||
pop af
|
||||
ld b, a ; store heal amount (1/5 of max HP)
|
||||
ld hl, wHPBarOldHP + 1
|
||||
|
@ -1200,15 +1200,15 @@ ItemUseMedicine:
|
|||
jr z, .playStatusAilmentCuringSound
|
||||
ld a, SFX_HEAL_HP
|
||||
call PlaySoundWaitForCurrent
|
||||
ld a, [hFlagsFFF6]
|
||||
ldh a, [hFlagsFFF6]
|
||||
set 0, a
|
||||
ld [hFlagsFFF6], a
|
||||
ldh [hFlagsFFF6], a
|
||||
ld a, $02
|
||||
ld [wHPBarType], a
|
||||
predef UpdateHPBar2 ; animate the HP bar lengthening
|
||||
ld a, [hFlagsFFF6]
|
||||
ldh a, [hFlagsFFF6]
|
||||
res 0, a
|
||||
ld [hFlagsFFF6], a
|
||||
ldh [hFlagsFFF6], a
|
||||
ld a, REVIVE_MSG
|
||||
ld [wPartyMenuTypeOrMessageID], a
|
||||
ld a, [wcf91]
|
||||
|
@ -1224,13 +1224,13 @@ ItemUseMedicine:
|
|||
call PlaySoundWaitForCurrent
|
||||
.showHealingItemMessage
|
||||
xor a
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
call ClearScreen
|
||||
dec a
|
||||
ld [wUpdateSpritesEnabled], a
|
||||
call RedrawPartyMenu ; redraws the party menu and displays the message
|
||||
ld a, 1
|
||||
ld [hAutoBGTransferEnabled], a
|
||||
ldh [hAutoBGTransferEnabled], a
|
||||
ld c, 50
|
||||
call DelayFrames
|
||||
call WaitForTextScrollButtonPress
|
||||
|
@ -1341,17 +1341,17 @@ ItemUseMedicine:
|
|||
push hl
|
||||
push de
|
||||
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 hl
|
||||
ld bc, wPartyMon1Exp - wPartyMon1Level
|
||||
add hl, bc ; hl now points to MSB of experience
|
||||
; update experience to minimum for new level
|
||||
ld a, [hExperience]
|
||||
ldh a, [hExperience]
|
||||
ld [hli], a
|
||||
ld a, [hExperience + 1]
|
||||
ldh a, [hExperience + 1]
|
||||
ld [hli], a
|
||||
ld a, [hExperience + 2]
|
||||
ldh a, [hExperience + 2]
|
||||
ld [hl], a
|
||||
pop hl
|
||||
ld a, [wWhichPokemon]
|
||||
|
@ -1400,14 +1400,14 @@ ItemUseMedicine:
|
|||
ld [wMonDataLocation], a
|
||||
call LoadMonData
|
||||
ld d, $01
|
||||
callab PrintStatsBox ; display new stats text box
|
||||
callfar PrintStatsBox ; display new stats text box
|
||||
call WaitForTextScrollButtonPress ; wait for button press
|
||||
xor a ; PLAYER_PARTY_DATA
|
||||
ld [wMonDataLocation], a
|
||||
predef LearnMoveFromLevelUp ; learn level up move, if any
|
||||
xor a
|
||||
ld [wForceEvolution], a
|
||||
callab TryEvolvingMon ; evolve pokemon, if appropriate
|
||||
callfar TryEvolvingMon ; evolve pokemon, if appropriate
|
||||
ld a, $01
|
||||
ld [wUpdateSpritesEnabled], a
|
||||
pop af
|
||||
|
@ -1459,7 +1459,7 @@ BaitRockCommon:
|
|||
ld [wAnimationID], a
|
||||
xor a
|
||||
ld [wAnimationType], a
|
||||
ld [hWhoseTurn], a
|
||||
ldh [hWhoseTurn], a
|
||||
ld [de], a ; zero escape factor (for bait), zero bait factor (for rock)
|
||||
.randomLoop ; loop until a random number less than 5 is generated
|
||||
call Random
|
||||
|
@ -1698,8 +1698,8 @@ ItemUseXStat:
|
|||
call LoadScreenTilesFromBuffer1 ; restore saved screen
|
||||
call Delay3
|
||||
xor a
|
||||
ld [hWhoseTurn], a ; set turn to player's turn
|
||||
callba StatModifierUpEffect ; do stat increase move
|
||||
ldh [hWhoseTurn], a ; set turn to player's turn
|
||||
farcall StatModifierUpEffect ; do stat increase move
|
||||
pop hl
|
||||
pop af
|
||||
ld [hld], a ; restore [wPlayerMoveEffect]
|
||||
|
@ -1775,7 +1775,7 @@ ItemUsePokeflute:
|
|||
and $80
|
||||
jr nz, .skipMusic
|
||||
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
|
||||
ld a, [wChannelSoundIDs + Ch7]
|
||||
and a ; music off?
|
||||
|
@ -1927,7 +1927,7 @@ RodResponse:
|
|||
push af
|
||||
push hl
|
||||
ld [hl], 0
|
||||
callba FishingAnim
|
||||
farcall FishingAnim
|
||||
pop hl
|
||||
pop af
|
||||
ld [hl], a
|
||||
|
@ -1968,7 +1968,7 @@ ItemUseItemfinder:
|
|||
and a
|
||||
jp nz, ItemUseNotTime
|
||||
call ItemUseReloadOverworldData
|
||||
callba HiddenItemNear ; check for hidden items
|
||||
farcall HiddenItemNear ; check for hidden items
|
||||
ld hl, ItemfinderFoundNothingText
|
||||
jr nc, .printText ; if no hidden items
|
||||
ld c, 4
|
||||
|
@ -2024,7 +2024,7 @@ ItemUsePPRestore:
|
|||
call PrintText
|
||||
xor a
|
||||
ld [wPlayerMoveListIndex], a
|
||||
callab MoveSelectionMenu ; move selection menu
|
||||
callfar MoveSelectionMenu ; move selection menu
|
||||
ld a, 0
|
||||
ld [wPlayerMoveListIndex], a
|
||||
jr nz, .chooseMon
|
||||
|
@ -2221,7 +2221,7 @@ ItemUseTMHM:
|
|||
call PrintText
|
||||
ld hl, TeachMachineMoveText
|
||||
call PrintText
|
||||
coord hl, 14, 7
|
||||
hlcoord 14, 7
|
||||
lb bc, 8, 15
|
||||
ld a, TWO_OPTION_MENU
|
||||
ld [wTextBoxID], a
|
||||
|
@ -2278,7 +2278,7 @@ ItemUseTMHM:
|
|||
call PrintText
|
||||
jr .chooseMon
|
||||
.checkIfAlreadyLearnedMove
|
||||
callab CheckIfMoveIsKnown ; check if the pokemon already knows the move
|
||||
callfar CheckIfMoveIsKnown ; check if the pokemon already knows the move
|
||||
jr c, .chooseMon
|
||||
predef LearnMove ; teach move
|
||||
pop af
|
||||
|
@ -2463,13 +2463,13 @@ RestoreBonusPP:
|
|||
AddBonusPP:
|
||||
push bc
|
||||
ld a, [de] ; normal max PP of move
|
||||
ld [hDividend + 3], a
|
||||
ldh [hDividend + 3], a
|
||||
xor a
|
||||
ld [hDividend], a
|
||||
ld [hDividend + 1], a
|
||||
ld [hDividend + 2], a
|
||||
ldh [hDividend], a
|
||||
ldh [hDividend + 1], a
|
||||
ldh [hDividend + 2], a
|
||||
ld a, 5
|
||||
ld [hDivisor], a
|
||||
ldh [hDivisor], a
|
||||
ld b, 4
|
||||
call Divide
|
||||
ld a, [hl] ; move PP
|
||||
|
@ -2480,7 +2480,7 @@ AddBonusPP:
|
|||
srl a
|
||||
ld c, a ; c = number of PP Ups used
|
||||
.loop
|
||||
ld a, [hQuotient + 3]
|
||||
ldh a, [hQuotient + 3]
|
||||
cp 8 ; is the amount greater than or equal to 8?
|
||||
jr c, .addAmount
|
||||
ld a, 7 ; cap the amount at 7
|
||||
|
@ -2607,7 +2607,7 @@ TossItem_::
|
|||
call CopyStringToCF4B ; copy name to wcf4b
|
||||
ld hl, IsItOKToTossItemText
|
||||
call PrintText
|
||||
coord hl, 14, 7
|
||||
hlcoord 14, 7
|
||||
lb bc, 8, 15
|
||||
ld a, TWO_OPTION_MENU
|
||||
ld [wTextBoxID], a
|
||||
|
@ -2820,15 +2820,15 @@ SendNewMonToBox:
|
|||
push de
|
||||
ld a, [wCurEnemyLVL]
|
||||
ld d, a
|
||||
callab CalcExperience
|
||||
callfar CalcExperience
|
||||
pop de
|
||||
ld a, [hExperience]
|
||||
ldh a, [hExperience]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hExperience + 1]
|
||||
ldh a, [hExperience + 1]
|
||||
ld [de], a
|
||||
inc de
|
||||
ld a, [hExperience + 2]
|
||||
ldh a, [hExperience + 2]
|
||||
ld [de], a
|
||||
inc de
|
||||
xor a
|
||||
|
|
|
@ -16,10 +16,10 @@ GetMachinePrice::
|
|||
swap a
|
||||
.highNybbleIsPrice
|
||||
and $f0
|
||||
ld [hItemPrice + 1], a
|
||||
ldh [hItemPrice + 1], a
|
||||
xor a
|
||||
ld [hItemPrice], a
|
||||
ld [hItemPrice + 2], a
|
||||
ldh [hItemPrice], a
|
||||
ldh [hItemPrice + 2], a
|
||||
ret
|
||||
|
||||
INCLUDE "data/items/tm_prices.asm"
|
||||
|
|
|
@ -6,19 +6,19 @@ DisplayTownMap:
|
|||
ld [hl], $ff
|
||||
push hl
|
||||
ld a, $1
|
||||
ld [hJoy7], a
|
||||
ldh [hJoy7], a
|
||||
ld a, [wCurMap]
|
||||
push af
|
||||
ld b, $0
|
||||
call DrawPlayerOrBirdSprite ; player sprite
|
||||
coord hl, 1, 0
|
||||
hlcoord 1, 0
|
||||
ld de, wcd6d
|
||||
call PlaceString
|
||||
ld hl, wOAMBuffer
|
||||
ld de, wTileMapBackup
|
||||
ld bc, $10
|
||||
call CopyData
|
||||
ld hl, vSprites + $40
|
||||
ld hl, vSprites tile $04
|
||||
ld de, TownMapCursor
|
||||
lb bc, BANK(TownMapCursor), (TownMapCursorEnd - TownMapCursor) / $8
|
||||
call CopyVideoDataDouble
|
||||
|
@ -28,7 +28,7 @@ DisplayTownMap:
|
|||
jr .enterLoop
|
||||
|
||||
.townMapLoop
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
lb bc, 1, 20
|
||||
call ClearScreenArea
|
||||
ld hl, TownMapOrder
|
||||
|
@ -55,7 +55,7 @@ DisplayTownMap:
|
|||
inc de
|
||||
cp $50
|
||||
jr nz, .copyMapName
|
||||
coord hl, 1, 0
|
||||
hlcoord 1, 0
|
||||
ld de, wcd6d
|
||||
call PlaceString
|
||||
ld hl, wOAMBuffer + $10
|
||||
|
@ -65,7 +65,7 @@ DisplayTownMap:
|
|||
.inputLoop
|
||||
call TownMapSpriteBlinkingAnimation
|
||||
call JoypadLowSensitivity
|
||||
ld a, [hJoy5]
|
||||
ldh a, [hJoy5]
|
||||
ld b, a
|
||||
and A_BUTTON | B_BUTTON | D_UP | D_DOWN
|
||||
jr z, .inputLoop
|
||||
|
@ -77,7 +77,7 @@ DisplayTownMap:
|
|||
jr nz, .pressedDown
|
||||
xor a
|
||||
ld [wTownMapSpriteBlinkingEnabled], a
|
||||
ld [hJoy7], a
|
||||
ldh [hJoy7], a
|
||||
ld [wAnimCounter], a
|
||||
call ExitTownMap
|
||||
pop hl
|
||||
|
@ -118,7 +118,7 @@ LoadTownMap_Nest:
|
|||
push hl
|
||||
call DisplayWildLocations
|
||||
call GetMonName
|
||||
coord hl, 1, 0
|
||||
hlcoord 1, 0
|
||||
call PlaceString
|
||||
ld h, b
|
||||
ld l, c
|
||||
|
@ -140,11 +140,11 @@ LoadTownMap_Fly::
|
|||
call LoadPlayerSpriteGraphics
|
||||
call LoadFontTilePatterns
|
||||
ld de, BirdSprite
|
||||
ld hl, vSprites + $40
|
||||
lb bc, BANK(BirdSprite), $c
|
||||
ld hl, vSprites tile $04
|
||||
lb bc, BANK(BirdSprite), 12
|
||||
call CopyVideoData
|
||||
ld de, TownMapUpArrow
|
||||
ld hl, vChars1 + $6d0
|
||||
ld hl, vChars1 tile $6d
|
||||
lb bc, BANK(TownMapUpArrow), (TownMapUpArrowEnd - TownMapUpArrow) / $8
|
||||
call CopyVideoDataDouble
|
||||
call BuildFlyLocationsList
|
||||
|
@ -153,41 +153,41 @@ LoadTownMap_Fly::
|
|||
push af
|
||||
ld [hl], $ff
|
||||
push hl
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
ld de, ToText
|
||||
call PlaceString
|
||||
ld a, [wCurMap]
|
||||
ld b, $0
|
||||
call DrawPlayerOrBirdSprite
|
||||
ld hl, wFlyLocationsList
|
||||
coord de, 18, 0
|
||||
decoord 18, 0
|
||||
.townMapFlyLoop
|
||||
ld a, " "
|
||||
ld [de], a
|
||||
push hl
|
||||
push hl
|
||||
coord hl, 3, 0
|
||||
hlcoord 3, 0
|
||||
lb bc, 1, 15
|
||||
call ClearScreenArea
|
||||
pop hl
|
||||
ld a, [hl]
|
||||
ld b, $4
|
||||
call DrawPlayerOrBirdSprite ; draw bird sprite
|
||||
coord hl, 3, 0
|
||||
hlcoord 3, 0
|
||||
ld de, wcd6d
|
||||
call PlaceString
|
||||
ld c, 15
|
||||
call DelayFrames
|
||||
coord hl, 18, 0
|
||||
hlcoord 18, 0
|
||||
ld [hl], "▲"
|
||||
coord hl, 19, 0
|
||||
hlcoord 19, 0
|
||||
ld [hl], "▼"
|
||||
pop hl
|
||||
.inputLoop
|
||||
push hl
|
||||
call DelayFrame
|
||||
call JoypadLowSensitivity
|
||||
ld a, [hJoy5]
|
||||
ldh a, [hJoy5]
|
||||
ld b, a
|
||||
pop hl
|
||||
and A_BUTTON | B_BUTTON | D_UP | D_DOWN
|
||||
|
@ -219,7 +219,7 @@ LoadTownMap_Fly::
|
|||
ld [hl], a
|
||||
ret
|
||||
.pressedUp
|
||||
coord de, 18, 0
|
||||
decoord 18, 0
|
||||
inc hl
|
||||
ld a, [hl]
|
||||
cp $ff
|
||||
|
@ -231,7 +231,7 @@ LoadTownMap_Fly::
|
|||
ld hl, wFlyLocationsList
|
||||
jp .townMapFlyLoop
|
||||
.pressedDown
|
||||
coord de, 19, 0
|
||||
decoord 19, 0
|
||||
dec hl
|
||||
ld a, [hl]
|
||||
cp $ff
|
||||
|
@ -278,22 +278,22 @@ LoadTownMap:
|
|||
call GBPalWhiteOutWithDelay3
|
||||
call ClearScreen
|
||||
call UpdateSprites
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
ld b, $12
|
||||
ld c, $12
|
||||
call TextBoxBorder
|
||||
call DisableLCD
|
||||
ld hl, WorldMapTileGraphics
|
||||
ld de, vChars2 + $600
|
||||
ld de, vChars2 tile $60
|
||||
ld bc, WorldMapTileGraphicsEnd - WorldMapTileGraphics
|
||||
ld a, BANK(WorldMapTileGraphics)
|
||||
call FarCopyData2
|
||||
ld hl, MonNestIcon
|
||||
ld de, vSprites + $40
|
||||
ld de, vSprites tile $04
|
||||
ld bc, MonNestIconEnd - MonNestIcon
|
||||
ld a, BANK(MonNestIcon)
|
||||
call FarCopyDataDouble
|
||||
coord hl, 0, 0
|
||||
hlcoord 0, 0
|
||||
ld de, CompressedMap
|
||||
.nextTile
|
||||
ld a, [de]
|
||||
|
@ -366,7 +366,7 @@ DrawPlayerOrBirdSprite:
|
|||
jp CopyData
|
||||
|
||||
DisplayWildLocations:
|
||||
callba FindWildLocationsOfMon
|
||||
farcall FindWildLocationsOfMon
|
||||
call ZeroOutDuplicatesInList
|
||||
ld hl, wOAMBuffer
|
||||
ld de, wTownMapCoords
|
||||
|
@ -395,11 +395,11 @@ DisplayWildLocations:
|
|||
and a ; were any OAM entries written?
|
||||
jr nz, .drawPlayerSprite
|
||||
; if no OAM entries were written, print area unknown text
|
||||
coord hl, 1, 7
|
||||
hlcoord 1, 7
|
||||
ld b, 2
|
||||
ld c, 15
|
||||
call TextBoxBorder
|
||||
coord hl, 2, 9
|
||||
hlcoord 2, 9
|
||||
ld de, AreaUnknownText
|
||||
call PlaceString
|
||||
jr .done
|
||||
|
|
|
@ -2,29 +2,29 @@ _Joypad::
|
|||
; hJoyReleased: (hJoyLast ^ hJoyInput) & hJoyLast
|
||||
; hJoyPressed: (hJoyLast ^ hJoyInput) & hJoyInput
|
||||
|
||||
ld a, [hJoyInput]
|
||||
ldh a, [hJoyInput]
|
||||
cp A_BUTTON + B_BUTTON + SELECT + START ; soft reset
|
||||
jp z, TrySoftReset
|
||||
|
||||
ld b, a
|
||||
ld a, [hJoyLast]
|
||||
ldh a, [hJoyLast]
|
||||
ld e, a
|
||||
xor b
|
||||
ld d, a
|
||||
and e
|
||||
ld [hJoyReleased], a
|
||||
ldh [hJoyReleased], a
|
||||
ld a, d
|
||||
and b
|
||||
ld [hJoyPressed], a
|
||||
ldh [hJoyPressed], a
|
||||
ld a, b
|
||||
ld [hJoyLast], a
|
||||
ldh [hJoyLast], a
|
||||
|
||||
ld a, [wd730]
|
||||
bit 5, a
|
||||
jr nz, DiscardButtonPresses
|
||||
|
||||
ld a, [hJoyLast]
|
||||
ld [hJoyHeld], a
|
||||
ldh a, [hJoyLast]
|
||||
ldh [hJoyHeld], a
|
||||
|
||||
ld a, [wJoyIgnore]
|
||||
and a
|
||||
|
@ -32,19 +32,19 @@ _Joypad::
|
|||
|
||||
cpl
|
||||
ld b, a
|
||||
ld a, [hJoyHeld]
|
||||
ldh a, [hJoyHeld]
|
||||
and b
|
||||
ld [hJoyHeld], a
|
||||
ld a, [hJoyPressed]
|
||||
ldh [hJoyHeld], a
|
||||
ldh a, [hJoyPressed]
|
||||
and b
|
||||
ld [hJoyPressed], a
|
||||
ldh [hJoyPressed], a
|
||||
ret
|
||||
|
||||
DiscardButtonPresses:
|
||||
xor a
|
||||
ld [hJoyHeld], a
|
||||
ld [hJoyPressed], a
|
||||
ld [hJoyReleased], a
|
||||
ldh [hJoyHeld], a
|
||||
ldh [hJoyPressed], a
|
||||
ldh [hJoyReleased], a
|
||||
ret
|
||||
|
||||
TrySoftReset:
|
||||
|
@ -52,7 +52,7 @@ TrySoftReset:
|
|||
|
||||
; deselect (redundant)
|
||||
ld a, $30
|
||||
ld [rJOYP], a
|
||||
ldh [rJOYP], a
|
||||
|
||||
ld hl, hSoftReset
|
||||
dec [hl]
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue