Merge pull request #409 from roukaour/master

Document constants with comments, actual names, and more thorough usage
This commit is contained in:
yenatch
2017-12-10 01:47:10 -05:00
committed by GitHub
255 changed files with 4844 additions and 4679 deletions

View File

@@ -58,7 +58,7 @@ In the installer, select the following packages:
- `gcc-core` - `gcc-core`
Then download [**rgbds**](https://github.com/rednex/rgbds/releases/). Then download [**rgbds**](https://github.com/rednex/rgbds/releases/).
Extract the archive and put all the `exe` and `dll` files individually in `C:\cygwin64\usr\local\bin`. Extract rgbds-0.3.3-win64.tar.gz and put all the `exe` and `dll` files individually in **C:\Cygwin64\usr\local\bin**. If you are using 32-bit Windows and Cygwin, extract **rgbds-0.3.3-win32.tar.gz** to **C:\Cygwin\usr\local\bin**.
**Note: If you have an older rgbds, you will need to update to 0.3.3 or newer.** Ignore this if you have never installed rgbds before. **Note: If you have an older rgbds, you will need to update to 0.3.3 or newer.** Ignore this if you have never installed rgbds before.

View File

@@ -140,8 +140,8 @@ gfx/pics/%/front.animated.tilemap: gfx/pics/%/front.2bpp gfx/pics/%/front.dimens
### Misc file-specific graphics rules ### Misc file-specific graphics rules
gfx/shrink1.2bpp: rgbgfx += -h gfx/shrink/shrink1.2bpp: rgbgfx += -h
gfx/shrink2.2bpp: rgbgfx += -h gfx/shrink/shrink2.2bpp: rgbgfx += -h
gfx/trainers/%.2bpp: rgbgfx += -h gfx/trainers/%.2bpp: rgbgfx += -h
gfx/trainers/%.pal: gfx/trainers/%.gbcpal gfx/trainers/%.pal: gfx/trainers/%.gbcpal
@@ -153,7 +153,9 @@ gfx/mail/0b9d86.1bpp: tools/gfx += --remove-whitespace
gfx/mail/0b9dc6.1bpp: tools/gfx += --remove-whitespace gfx/mail/0b9dc6.1bpp: tools/gfx += --remove-whitespace
gfx/mail/0b9cfe.1bpp: tools/gfx += --remove-whitespace gfx/mail/0b9cfe.1bpp: tools/gfx += --remove-whitespace
gfx/pokedex/%.2bpp: tools/gfx += --trim-whitespace gfx/pokedex/pokedex.2bpp: tools/gfx += --trim-whitespace
gfx/pokedex/sgb.2bpp: tools/gfx += --trim-whitespace
gfx/pokedex/slowpoke.2bpp: tools/gfx += --trim-whitespace
gfx/title/crystal.2bpp: tools/gfx += --interleave --png=$< gfx/title/crystal.2bpp: tools/gfx += --interleave --png=$<
gfx/title/old_fg.2bpp: tools/gfx += --interleave --png=$< gfx/title/old_fg.2bpp: tools/gfx += --interleave --png=$<
@@ -162,10 +164,10 @@ gfx/title/logo.2bpp: rgbgfx += -x 4
gfx/trade/ball.2bpp: tools/gfx += --remove-whitespace gfx/trade/ball.2bpp: tools/gfx += --remove-whitespace
gfx/trade/game_boy_n64.2bpp: tools/gfx += --trim-whitespace gfx/trade/game_boy_n64.2bpp: tools/gfx += --trim-whitespace
gfx/slots_2.2bpp: tools/gfx += --interleave --png=$< gfx/slots/slots_2.2bpp: tools/gfx += --interleave --png=$<
gfx/slots_3.2bpp: tools/gfx += --interleave --png=$< --remove-duplicates --keep-whitespace --remove-xflip gfx/slots/slots_3.2bpp: tools/gfx += --interleave --png=$< --remove-duplicates --keep-whitespace --remove-xflip
gfx/slots_3a.2bpp: tools/gfx += --interleave --png=$<
gfx/slots_3b.2bpp: tools/gfx += --interleave --png=$< --remove-duplicates --keep-whitespace --remove-xflip gfx/card_flip/card_flip_2.2bpp: tools/gfx += --remove-whitespace
gfx/fx/angels.2bpp: tools/gfx += --trim-whitespace gfx/fx/angels.2bpp: tools/gfx += --trim-whitespace
gfx/fx/beam.2bpp: tools/gfx += --remove-xflip --remove-yflip --remove-whitespace gfx/fx/beam.2bpp: tools/gfx += --remove-xflip --remove-yflip --remove-whitespace
@@ -185,18 +187,21 @@ gfx/fx/rocks.2bpp: tools/gfx += --remove-whitespace
gfx/fx/skyattack.2bpp: tools/gfx += --remove-whitespace gfx/fx/skyattack.2bpp: tools/gfx += --remove-whitespace
gfx/fx/status.2bpp: tools/gfx += --remove-whitespace gfx/fx/status.2bpp: tools/gfx += --remove-whitespace
gfx/misc/chris.2bpp: rgbgfx += -h gfx/player/chris.2bpp: rgbgfx += -h
gfx/misc/chris_card.2bpp: rgbgfx += -h gfx/player/chris_back.2bpp: rgbgfx += -h
gfx/misc/kris.2bpp: rgbgfx += -h gfx/player/kris.2bpp: rgbgfx += -h
gfx/misc/kris_card.2bpp: rgbgfx += -h gfx/player/kris_back.2bpp: rgbgfx += -h
gfx/misc/kris_back.2bpp: rgbgfx += -h
gfx/misc/dude.2bpp: rgbgfx += -h gfx/trainer_card/chris_card.2bpp: rgbgfx += -h
gfx/misc/unknown_egg.2bpp: rgbgfx += -h gfx/trainer_card/kris_card.2bpp: rgbgfx += -h
gfx/misc/player.2bpp: rgbgfx += -h
gfx/misc/pokegear.2bpp: rgbgfx += -x2 gfx/battle/dude.2bpp: rgbgfx += -h
gfx/misc/pokegear_sprites.2bpp: tools/gfx += --trim-whitespace
gfx/misc/unknown_egg.2bpp: rgbgfx += -h
gfx/pokegear/pokegear.2bpp: rgbgfx += -x2
gfx/pokegear/pokegear_sprites.2bpp: tools/gfx += --trim-whitespace
gfx/unknown/0e0ea8.2bpp: tools/gfx += --remove-whitespace
gfx/unknown/0f8f34.1bpp: tools/gfx += --trim-whitespace gfx/unknown/0f8f34.1bpp: tools/gfx += --trim-whitespace
gfx/unknown/16c173.2bpp: tools/gfx += --remove-duplicates --remove-xflip gfx/unknown/16c173.2bpp: tools/gfx += --remove-duplicates --remove-xflip
gfx/unknown/170d16.2bpp: tools/gfx += --trim-whitespace gfx/unknown/170d16.2bpp: tools/gfx += --trim-whitespace

View File

@@ -22,7 +22,7 @@ _MapSetup_Sound_Off:: ; e8000
ld [hli], a ; ff26 ; music channels ld [hli], a ; ff26 ; music channels
ld hl, rNR10 ; sound channel registers ld hl, rNR10 ; sound channel registers
ld e, $4 ; number of channels ld e, NUM_MUSIC_CHANS
.clearsound .clearsound
; sound channel 1 2 3 4 ; sound channel 1 2 3 4
xor a xor a
@@ -47,7 +47,7 @@ _MapSetup_Sound_Off:: ; e8000
ld a, e ld a, e
or d or d
jr nz, .clearchannels jr nz, .clearchannels
ld a, $77 ; max ld a, MAX_VOLUME
ld [Volume], a ld [Volume], a
call MusicOn call MusicOn
pop af pop af
@@ -60,15 +60,15 @@ _MapSetup_Sound_Off:: ; e8000
MusicFadeRestart: ; e803d MusicFadeRestart: ; e803d
; restart but keep the music id to fade in to ; restart but keep the music id to fade in to
ld a, [MusicFadeIDHi] ld a, [MusicFadeID + 1]
push af push af
ld a, [MusicFadeIDLo] ld a, [MusicFadeID]
push af push af
call _MapSetup_Sound_Off call _MapSetup_Sound_Off
pop af pop af
ld [MusicFadeIDLo], a ld [MusicFadeID], a
pop af pop af
ld [MusicFadeIDHi], a ld [MusicFadeID + 1], a
ret ret
; e8051 ; e8051
@@ -151,7 +151,7 @@ _UpdateSound:: ; e805c
jr z, .next jr z, .next
; are we in a sfx channel right now? ; are we in a sfx channel right now?
ld a, [CurChannel] ld a, [CurChannel]
cp $4 cp CHAN5
jr nc, .next jr nc, .next
; are any sfx channels active? ; are any sfx channels active?
; if so, mute ; if so, mute
@@ -174,7 +174,7 @@ _UpdateSound:: ; e805c
.next .next
; are we in a sfx channel right now? ; are we in a sfx channel right now?
ld a, [CurChannel] ld a, [CurChannel]
cp $4 ; sfx cp CHAN5
jr nc, .sfx_channel jr nc, .sfx_channel
ld hl, Channel5Flags - Channel1 ld hl, Channel5Flags - Channel1
add hl, bc add hl, bc
@@ -654,11 +654,11 @@ FadeMusic: ; e8358
; restart sound ; restart sound
call MusicFadeRestart call MusicFadeRestart
; get new song id ; get new song id
ld a, [MusicFadeIDLo] ld a, [MusicFadeID]
and a and a
jr z, .quit ; this assumes there are fewer than 256 songs! jr z, .quit ; this assumes there are fewer than 256 songs!
ld e, a ld e, a
ld a, [MusicFadeIDHi] ld a, [MusicFadeID + 1]
ld d, a ld d, a
; load new song ; load new song
call _PlayMusic call _PlayMusic
@@ -679,9 +679,9 @@ FadeMusic: ; e8358
xor a xor a
ld [Volume], a ld [Volume], a
; get new song id ; get new song id
ld a, [MusicFadeIDLo] ld a, [MusicFadeID]
ld e, a ld e, a
ld a, [MusicFadeIDHi] ld a, [MusicFadeID + 1]
ld d, a ld d, a
; load new song ; load new song
call _PlayMusic call _PlayMusic
@@ -744,7 +744,7 @@ LoadNote: ; e83d1
sub [hl] sub [hl]
ld e, a ld e, a
ld a, d ld a, d
sbc a, 0 sbc 0
ld d, a ld d, a
ld hl, Channel1PitchWheelTarget + 1 - Channel1 ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc add hl, bc
@@ -766,7 +766,7 @@ LoadNote: ; e83d1
sub e sub e
ld e, a ld e, a
ld a, d ld a, d
sbc a, 0 sbc 0
ld d, a ld d, a
; ???? ; ????
ld hl, Channel1PitchWheelTarget + 1 - Channel1 ld hl, Channel1PitchWheelTarget + 1 - Channel1
@@ -793,7 +793,7 @@ LoadNote: ; e83d1
sub [hl] sub [hl]
ld e, a ld e, a
ld a, d ld a, d
sbc a, 0 sbc 0
ld d, a ld d, a
ld hl, Channel1PitchWheelTarget + 1 - Channel1 ld hl, Channel1PitchWheelTarget + 1 - Channel1
add hl, bc add hl, bc
@@ -1021,7 +1021,7 @@ ApplyPitchWheel: ; e84f9
sub e sub e
ld e, a ld e, a
ld a, d ld a, d
sbc a, 0 sbc 0
ld d, a ld d, a
; [Channel*Field0x25] *= 2 ; [Channel*Field0x25] *= 2
; if rollover: Frequency -= 1 ; if rollover: Frequency -= 1
@@ -1031,10 +1031,10 @@ ApplyPitchWheel: ; e84f9
add a add a
ld [hl], a ld [hl], a
ld a, e ld a, e
sbc a, 0 sbc 0
ld e, a ld e, a
ld a, d ld a, d
sbc a, 0 sbc 0
ld d, a ld d, a
; Compare the dw at [Channel*PitchWheelTarget] to de. ; Compare the dw at [Channel*PitchWheelTarget] to de.
; If frequency is lower, we're finished. ; If frequency is lower, we're finished.
@@ -1223,7 +1223,7 @@ ParseMusic: ; e85e1
bit SOUND_SUBROUTINE, [hl] ; in a subroutine? bit SOUND_SUBROUTINE, [hl] ; in a subroutine?
jr nz, .readcommand ; execute jr nz, .readcommand ; execute
ld a, [CurChannel] ld a, [CurChannel]
cp $4 ; channels 0-3? cp CHAN5
jr nc, .chan_5to8 jr nc, .chan_5to8
; ???? ; ????
ld hl, Channel5Flags - Channel1 ld hl, Channel5Flags - Channel1
@@ -1237,7 +1237,7 @@ ParseMusic: ; e85e1
call nz, RestoreVolume call nz, RestoreVolume
; end music ; end music
ld a, [CurChannel] ld a, [CurChannel]
cp $4 ; channel 5? cp CHAN5
jr nz, .ok jr nz, .ok
; ???? ; ????
xor a xor a
@@ -1266,7 +1266,7 @@ ParseMusic: ; e85e1
RestoreVolume: ; e8679 RestoreVolume: ; e8679
; ch5 only ; ch5 only
ld a, [CurChannel] ld a, [CurChannel]
cp $4 cp CHAN5
ret nz ret nz
xor a xor a
ld hl, Channel6CryPitch ld hl, Channel6CryPitch
@@ -1364,9 +1364,9 @@ GetNoiseSample: ; e86c5
add hl, de add hl, de
; load sample pointer into NoiseSampleAddress ; load sample pointer into NoiseSampleAddress
ld a, [hli] ld a, [hli]
ld [NoiseSampleAddressLo], a ld [NoiseSampleAddress], a
ld a, [hl] ld a, [hl]
ld [NoiseSampleAddressHi], a ld [NoiseSampleAddress + 1], a
; clear ???? ; clear ????
xor a xor a
ld [wNoiseSampleDelay], a ld [wNoiseSampleDelay], a
@@ -1378,7 +1378,7 @@ ParseMusicCommand: ; e870f
; reload command ; reload command
ld a, [CurMusicByte] ld a, [CurMusicByte]
; get command # ; get command #
sub a, $d0 ; first command sub $d0 ; first command
ld e, a ld e, a
ld d, 0 ld d, 0
; seek command pointer ; seek command pointer
@@ -1968,7 +1968,7 @@ Music_NoteType: ; e8963
ld [hl], a ld [hl], a
ld a, [CurChannel] ld a, [CurChannel]
and $3 and $3
cp CHAN4 ; CHAN8 & $3 cp CHAN8 & $3
ret z ret z
; intensity ; intensity
call Music_Intensity call Music_Intensity
@@ -2063,7 +2063,7 @@ Music_StereoPanning: ; e89ba
; params: 1 ; params: 1
; stereo on? ; stereo on?
ld a, [Options] ld a, [Options]
bit 5, a ; stereo bit STEREO, a
jr nz, Music_Panning jr nz, Music_Panning
; skip param ; skip param
call GetMusicByte call GetMusicByte
@@ -2160,9 +2160,9 @@ Music_RestartChannel: ; e8a08
ld hl, Channel1MusicID - Channel1 ld hl, Channel1MusicID - Channel1
add hl, bc add hl, bc
ld a, [hli] ld a, [hli]
ld [MusicIDLo], a ld [MusicID], a
ld a, [hl] ld a, [hl]
ld [MusicIDHi], a ld [MusicID + 1], a
; update music bank ; update music bank
ld hl, Channel1MusicBank - Channel1 ld hl, Channel1MusicBank - Channel1
add hl, bc add hl, bc
@@ -2437,7 +2437,7 @@ _PlayMusic:: ; e8b30
ld hl, MusicID ld hl, MusicID
ld [hl], e ; song number ld [hl], e ; song number
inc hl inc hl
ld [hl], d ; MusicIDHi (always $) ld [hl], d ; (always 0)
ld hl, Music ld hl, Music
add hl, de ; three add hl, de ; three
add hl, de ; byte add hl, de ; byte
@@ -2466,8 +2466,8 @@ _PlayMusic:: ; e8b30
ld [Channel2JumpCondition], a ld [Channel2JumpCondition], a
ld [Channel3JumpCondition], a ld [Channel3JumpCondition], a
ld [Channel4JumpCondition], a ld [Channel4JumpCondition], a
ld [NoiseSampleAddressLo], a ld [NoiseSampleAddress], a
ld [NoiseSampleAddressHi], a ld [NoiseSampleAddress + 1], a
ld [wNoiseSampleDelay], a ld [wNoiseSampleDelay], a
ld [MusicNoiseSampleSet], a ld [MusicNoiseSampleSet], a
call MusicOn call MusicOn
@@ -2552,7 +2552,7 @@ _PlayCryHeader:: ; e8b79
; This only applies in-battle. ; This only applies in-battle.
ld a, [Options] ld a, [Options]
bit 5, a ; stereo bit STEREO, a
jr z, .next jr z, .next
; [Tracks] &= [CryTracks] ; [Tracks] &= [CryTracks]
@@ -2577,7 +2577,7 @@ _PlayCryHeader:: ; e8b79
ld a, [Volume] ld a, [Volume]
ld [LastVolume], a ld [LastVolume], a
ld a, $77 ld a, MAX_VOLUME
ld [Volume], a ld [Volume], a
.end .end
@@ -2647,8 +2647,8 @@ _PlaySFX:: ; e8c04
ld a, $80 ld a, $80
ld [rNR44], a ; restart sound (freq hi = 0) ld [rNR44], a ; restart sound (freq hi = 0)
xor a xor a
ld [NoiseSampleAddressLo], a ld [NoiseSampleAddress], a
ld [NoiseSampleAddressHi], a ld [NoiseSampleAddress + 1], a
.chscleared .chscleared
; start reading sfx header for # chs ; start reading sfx header for # chs
ld hl, MusicID ld hl, MusicID
@@ -2696,7 +2696,7 @@ PlayStereoSFX:: ; e8ca6
; standard procedure if stereo's off ; standard procedure if stereo's off
ld a, [Options] ld a, [Options]
bit 5, a bit STEREO, a
jp z, _PlaySFX jp z, _PlaySFX
; else, let's go ahead with this ; else, let's go ahead with this
@@ -2825,9 +2825,9 @@ LoadChannel: ; e8d1b
; load music id ; load music id
ld hl, Channel1MusicID - Channel1 ld hl, Channel1MusicID - Channel1
add hl, bc add hl, bc
ld a, [MusicIDLo] ld a, [MusicID]
ld [hli], a ld [hli], a
ld a, [MusicIDHi] ld a, [MusicID + 1]
ld [hl], a ld [hl], a
; load music bank ; load music bank
ld hl, Channel1MusicBank - Channel1 ld hl, Channel1MusicBank - Channel1
@@ -3231,7 +3231,7 @@ GetLRTracks: ; e8fc2
; gets the default sound l/r channels ; gets the default sound l/r channels
; stores mono/stereo table in hl ; stores mono/stereo table in hl
ld a, [Options] ld a, [Options]
bit 5, a ; stereo bit STEREO, a
; made redundant, could have had a purpose in gold ; made redundant, could have had a purpose in gold
jr nz, .stereo jr nz, .stereo
ld hl, MonoTracks ld hl, MonoTracks
@@ -3279,7 +3279,7 @@ ClearChannels:: ; e8fe9
ld a, $80 ld a, $80
ld [hli], a ld [hli], a
ld hl, rNR10 ld hl, rNR10
ld e, $4 ld e, NUM_MUSIC_CHANS
.loop .loop
call ClearChannel call ClearChannel
dec e dec e

View File

@@ -27,7 +27,7 @@ AI_SwitchOrTryItem: ; 38000
ld a, [TrainerClass] ld a, [TrainerClass]
dec a dec a
ld bc, 7 ld bc, NUM_TRAINER_ATTRIBUTES
call AddNTimes call AddNTimes
.ok .ok
bit SWITCH_OFTEN_F, [hl] bit SWITCH_OFTEN_F, [hl]
@@ -174,8 +174,8 @@ AI_TryItem: ; 38105
ld a, [TrainerClass] ld a, [TrainerClass]
dec a dec a
ld hl, TrainerClassAttributes + 5 ld hl, TrainerClassAttributes + TRNATTR_AI_ITEM_SWITCH
ld bc, 7 ld bc, NUM_TRAINER_ATTRIBUTES
call AddNTimes call AddNTimes
ld b, h ld b, h
ld c, l ld c, l

View File

@@ -57,7 +57,7 @@ _PlayBattleAnim: ; cc0e4
BattleAnimRunScript: ; cc11c BattleAnimRunScript: ; cc11c
ld a, [FXAnimIDHi] ld a, [FXAnimID + 1]
and a and a
jr nz, .hi_byte jr nz, .hi_byte
@@ -86,9 +86,9 @@ BattleAnimRunScript: ; cc11c
ld de, ANIM_MISS ld de, ANIM_MISS
add hl, de add hl, de
ld a, l ld a, l
ld [FXAnimIDLo], a ld [FXAnimID], a
ld a, h ld a, h
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
.hi_byte .hi_byte
call WaitSFX call WaitSFX
@@ -112,11 +112,11 @@ RunBattleAnimScript: ; cc163
call BattleAnimRequestPals call BattleAnimRequestPals
; Speed up Rollout's animation. ; Speed up Rollout's animation.
ld a, [FXAnimIDHi] ld a, [FXAnimID + 1]
or a or a
jr nz, .not_rollout jr nz, .not_rollout
ld a, [FXAnimIDLo] ld a, [FXAnimID]
cp ROLLOUT cp ROLLOUT
jr nz, .not_rollout jr nz, .not_rollout
@@ -1393,7 +1393,7 @@ ClearBattleAnims: ; cc8d3
or b or b
jr nz, .loop jr nz, .loop
ld hl, FXAnimIDLo ld hl, FXAnimID
ld e, [hl] ld e, [hl]
inc hl inc hl
ld d, [hl] ld d, [hl]

View File

@@ -868,7 +868,7 @@ BattleBGEffect_RunPicResizeScript: ; c83ed (32:43ed)
.BGSquares: .BGSquares:
bgsquare: MACRO bgsquare: MACRO
dn \1,\2 dn \1, \2
dw \3 dw \3
endm endm
@@ -1538,10 +1538,10 @@ Tackle_BGEffect25_2d_two:
Functionc88a5: ; c88a5 (32:48a5) Functionc88a5: ; c88a5 (32:48a5)
push af push af
ld a, [FXAnimIDHi] ; FXAnimIDHi ld a, [FXAnimID + 1] ; FXAnimID + 1
or a or a
jr nz, .not_rollout jr nz, .not_rollout
ld a, [FXAnimIDLo] ; FXAnimID ld a, [FXAnimID] ; FXAnimID
cp ROLLOUT cp ROLLOUT
jr z, .rollout jr z, .rollout
.not_rollout .not_rollout
@@ -2581,8 +2581,8 @@ BGEffects_LoadBGPal0_OBPal1: ; c8e52 (32:4e52)
ld a, h ld a, h
push bc push bc
push af push af
ld hl, BGPals ; BGPals ld hl, BGPals
ld de, UnknBGPals ; wd000 ld de, UnknBGPals
ld b, a ld b, a
ld c, $1 ld c, $1
call CopyPals call CopyPals

View File

@@ -633,7 +633,7 @@ ParsePlayerAction: ; 3c434
xor a xor a
ld [wMoveSelectionMenuType], a ld [wMoveSelectionMenuType], a
inc a ; POUND inc a ; POUND
ld [FXAnimIDLo], a ld [FXAnimID], a
call MoveSelectionScreen call MoveSelectionScreen
push af push af
call Call_LoadTempTileMapToTileMap call Call_LoadTempTileMapToTileMap
@@ -1305,7 +1305,7 @@ HandleWrap: ; 3c874
ld a, [de] ld a, [de]
ld [wd265], a ld [wd265], a
ld [FXAnimIDLo], a ld [FXAnimID], a
call GetMoveName call GetMoveName
dec [hl] dec [hl]
jr z, .release_from_bounds jr z, .release_from_bounds
@@ -1318,7 +1318,7 @@ HandleWrap: ; 3c874
call SwitchTurnCore call SwitchTurnCore
xor a xor a
ld [wNumHits], a ld [wNumHits], a
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
predef PlayBattleAnim predef PlayBattleAnim
call SwitchTurnCore call SwitchTurnCore
@@ -4213,7 +4213,7 @@ SendOutPlayerMon: ; 3db5f
call GetMonBackpic call GetMonBackpic
xor a xor a
ld [hGraphicStartTile], a ld [hGraphicStartTile], a
ld [wd0d2], a ld [wBattleMenuCursorBuffer], a
ld [CurMoveNum], a ld [CurMoveNum], a
ld [TypeModifier], a ld [TypeModifier], a
ld [wPlayerMoveStruct + MOVE_ANIM], a ld [wPlayerMoveStruct + MOVE_ANIM], a
@@ -4551,11 +4551,11 @@ ItemRecoveryAnim: ; 3ddc8
push bc push bc
call EmptyBattleTextBox call EmptyBattleTextBox
ld a, RECOVER ld a, RECOVER
ld [FXAnimIDLo], a ld [FXAnimID], a
call SwitchTurnCore call SwitchTurnCore
xor a xor a
ld [wNumHits], a ld [wNumHits], a
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
predef PlayBattleAnim predef PlayBattleAnim
call SwitchTurnCore call SwitchTurnCore
pop bc pop bc
@@ -5130,7 +5130,7 @@ BattleMenu: ; 3e139
.next .next
ld a, $1 ld a, $1
ld [hBGMapMode], a ld [hBGMapMode], a
ld a, [wd0d2] ld a, [wBattleMenuCursorBuffer]
cp $1 cp $1
jp z, BattleMenu_Fight jp z, BattleMenu_Fight
cp $3 cp $3
@@ -6267,13 +6267,13 @@ LoadEnemyMon: ; 3e8eb
; 25% chance of getting an item ; 25% chance of getting an item
call BattleRandom call BattleRandom
cp a, 1 + (75 percent) cp 1 + (75 percent)
ld a, NO_ITEM ld a, NO_ITEM
jr c, .UpdateItem jr c, .UpdateItem
; From there, an 8% chance for Item2 ; From there, an 8% chance for Item2
call BattleRandom call BattleRandom
cp a, 8 percent ; 8% of 25% = 2% Item2 cp 8 percent ; 8% of 25% = 2% Item2
ld a, [BaseItems] ld a, [BaseItems]
jr nc, .UpdateItem jr nc, .UpdateItem
ld a, [BaseItems+1] ld a, [BaseItems+1]
@@ -6320,7 +6320,7 @@ LoadEnemyMon: ; 3e8eb
; Roaming monsters (Entei, Raikou) work differently ; Roaming monsters (Entei, Raikou) work differently
; They have their own structs, which are shorter than normal ; They have their own structs, which are shorter than normal
ld a, [BattleType] ld a, [BattleType]
cp a, BATTLETYPE_ROAMING cp BATTLETYPE_ROAMING
jr nz, .NotRoaming jr nz, .NotRoaming
; Grab HP ; Grab HP
@@ -6361,7 +6361,7 @@ LoadEnemyMon: ; 3e8eb
; Forced shiny battle type ; Forced shiny battle type
; Used by Red Gyarados at Lake of Rage ; Used by Red Gyarados at Lake of Rage
cp a, BATTLETYPE_SHINY cp BATTLETYPE_SHINY
jr nz, .GenerateDVs jr nz, .GenerateDVs
ld b, ATKDEFDV_SHINY ; $ea ld b, ATKDEFDV_SHINY ; $ea
@@ -6391,7 +6391,7 @@ LoadEnemyMon: ; 3e8eb
; Unown ; Unown
ld a, [TempEnemyMonSpecies] ld a, [TempEnemyMonSpecies]
cp a, UNOWN cp UNOWN
jr nz, .Magikarp jr nz, .Magikarp
; Get letter based on DVs ; Get letter based on DVs
@@ -6406,7 +6406,7 @@ LoadEnemyMon: ; 3e8eb
; Skimming this part recommended ; Skimming this part recommended
ld a, [TempEnemyMonSpecies] ld a, [TempEnemyMonSpecies]
cp a, MAGIKARP cp MAGIKARP
jr nz, .Happiness jr nz, .Happiness
; Get Magikarp's length ; Get Magikarp's length
@@ -6415,26 +6415,26 @@ LoadEnemyMon: ; 3e8eb
callab CalcMagikarpLength callab CalcMagikarpLength
; We're clear if the length is < 1536 ; We're clear if the length is < 1536
ld a, [MagikarpLength] ld a, [wMagikarpLength]
cp a, $06 ; $600 = 1536 cp $06 ; $600 = 1536
jr nz, .CheckMagikarpArea jr nz, .CheckMagikarpArea
; 5% chance of skipping size checks ; 5% chance of skipping size checks
call Random call Random
cp a, $0c ; / $100 cp $0c ; / $100
jr c, .CheckMagikarpArea jr c, .CheckMagikarpArea
; Try again if > 1614 ; Try again if > 1614
ld a, [MagikarpLength + 1] ld a, [wMagikarpLength + 1]
cp a, $50 cp $50
jr nc, .GenerateDVs jr nc, .GenerateDVs
; 20% chance of skipping this check ; 20% chance of skipping this check
call Random call Random
cp a, $32 ; / $100 cp $32 ; / $100
jr c, .CheckMagikarpArea jr c, .CheckMagikarpArea
; Try again if > 1598 ; Try again if > 1598
ld a, [MagikarpLength + 1] ld a, [wMagikarpLength + 1]
cp a, $40 cp $40
jr nc, .GenerateDVs jr nc, .GenerateDVs
.CheckMagikarpArea: .CheckMagikarpArea:
@@ -6448,18 +6448,18 @@ LoadEnemyMon: ; 3e8eb
; Intended behavior enforces a minimum size at Lake of Rage ; Intended behavior enforces a minimum size at Lake of Rage
; The real behavior prevents size flooring in the Lake of Rage area ; The real behavior prevents size flooring in the Lake of Rage area
ld a, [MapGroup] ld a, [MapGroup]
cp a, GROUP_LAKE_OF_RAGE cp GROUP_LAKE_OF_RAGE
jr z, .Happiness jr z, .Happiness
ld a, [MapNumber] ld a, [MapNumber]
cp a, MAP_LAKE_OF_RAGE cp MAP_LAKE_OF_RAGE
jr z, .Happiness jr z, .Happiness
; 40% chance of not flooring ; 40% chance of not flooring
call Random call Random
cp a, $64 ; / $100 cp $64 ; / $100
jr c, .Happiness jr c, .Happiness
; Floor at length 1024 ; Floor at length 1024
ld a, [MagikarpLength] ld a, [wMagikarpLength]
cp a, 1024 >> 8 cp 1024 >> 8
jr c, .GenerateDVs ; try again jr c, .GenerateDVs ; try again
; Finally done with DVs ; Finally done with DVs
@@ -6480,7 +6480,7 @@ LoadEnemyMon: ; 3e8eb
; If we're in a trainer battle, ; If we're in a trainer battle,
; get the rest of the parameters from the party struct ; get the rest of the parameters from the party struct
ld a, [wBattleMode] ld a, [wBattleMode]
cp a, TRAINER_BATTLE cp TRAINER_BATTLE
jr z, .OpponentParty jr z, .OpponentParty
; If we're in a wild battle, check wild-specific stuff ; If we're in a wild battle, check wild-specific stuff
@@ -6515,7 +6515,7 @@ LoadEnemyMon: ; 3e8eb
; ..unless it's a RoamMon ; ..unless it's a RoamMon
ld a, [BattleType] ld a, [BattleType]
cp a, BATTLETYPE_ROAMING cp BATTLETYPE_ROAMING
jr nz, .Moves jr nz, .Moves
; Grab HP ; Grab HP
@@ -6568,7 +6568,7 @@ LoadEnemyMon: ; 3e8eb
ld de, EnemyMonMoves ld de, EnemyMonMoves
; Are we in a trainer battle? ; Are we in a trainer battle?
ld a, [wBattleMode] ld a, [wBattleMode]
cp a, TRAINER_BATTLE cp TRAINER_BATTLE
jr nz, .WildMoves jr nz, .WildMoves
; Then copy moves from the party struct ; Then copy moves from the party struct
ld hl, OTPartyMon1Moves ld hl, OTPartyMon1Moves
@@ -6588,14 +6588,14 @@ LoadEnemyMon: ; 3e8eb
ld [hli], a ld [hli], a
ld [hl], a ld [hl], a
; Make sure the predef knows this isn't a partymon ; Make sure the predef knows this isn't a partymon
ld [MagikarpLength], a ld [wEvolutionOldSpecies], a
; Fill moves based on level ; Fill moves based on level
predef FillMoves predef FillMoves
.PP: .PP:
; Trainer battle? ; Trainer battle?
ld a, [wBattleMode] ld a, [wBattleMode]
cp a, TRAINER_BATTLE cp TRAINER_BATTLE
jr z, .TrainerPP jr z, .TrainerPP
; Fill wild PP ; Fill wild PP
@@ -6670,13 +6670,13 @@ CheckSleepingTreeMon: ; 3eb38
; Don't do anything if this isn't a tree encounter ; Don't do anything if this isn't a tree encounter
ld a, [BattleType] ld a, [BattleType]
cp a, BATTLETYPE_TREE cp BATTLETYPE_TREE
jr nz, .NotSleeping jr nz, .NotSleeping
; Get list for the time of day ; Get list for the time of day
ld hl, .Morn ld hl, .Morn
ld a, [TimeOfDay] ld a, [TimeOfDay]
cp a, DAY cp DAY
jr c, .Check jr c, .Check
ld hl, .Day ld hl, .Day
jr z, .Check jr z, .Check
@@ -6759,7 +6759,7 @@ CheckUnownLetter: ; 3eb75
inc e inc e
inc e inc e
ld a, e ld a, e
cp a, .Set1 - .LetterSets cp .Set1 - .LetterSets
jr c, .loop jr c, .loop
; Hasn't been unlocked, or the letter is invalid ; Hasn't been unlocked, or the letter is invalid
@@ -7285,9 +7285,9 @@ Call_PlayBattleAnim_OnlyIfVisible: ; 3ee0f
Call_PlayBattleAnim: ; 3ee17 Call_PlayBattleAnim: ; 3ee17
ld a, e ld a, e
ld [FXAnimIDLo], a ld [FXAnimID], a
ld a, d ld a, d
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
call WaitBGMap call WaitBGMap
predef_jump PlayBattleAnim predef_jump PlayBattleAnim
; 3ee27 ; 3ee27
@@ -8405,7 +8405,7 @@ BattleIntro: ; 3f4dd
call LoadTrainerOrWildMonPic call LoadTrainerOrWildMonPic
xor a xor a
ld [TempBattleMonSpecies], a ld [TempBattleMonSpecies], a
ld [wd0d2], a ld [wBattleMenuCursorBuffer], a
xor a xor a
ld [hMapAnims], a ld [hMapAnims], a
callba PlayBattleMusic callba PlayBattleMusic
@@ -8670,7 +8670,7 @@ CleanUpBattleRAM: ; 3f6d0
ld [wPartyMenuCursor], a ld [wPartyMenuCursor], a
ld [wKeyItemsPocketCursor], a ld [wKeyItemsPocketCursor], a
ld [wItemsPocketCursor], a ld [wItemsPocketCursor], a
ld [wd0d2], a ld [wBattleMenuCursorBuffer], a
ld [CurMoveNum], a ld [CurMoveNum], a
ld [wBallsPocketCursor], a ld [wBallsPocketCursor], a
ld [wLastPocket], a ld [wLastPocket], a

View File

@@ -70,25 +70,25 @@ DoMove: ; 3402c
; Start at the first command. ; Start at the first command.
ld hl, BattleScriptBuffer ld hl, BattleScriptBuffer
ld a, l ld a, l
ld [BattleScriptBufferLoc], a ld [BattleScriptBufferAddress], a
ld a, h ld a, h
ld [BattleScriptBufferLoc + 1], a ld [BattleScriptBufferAddress + 1], a
.ReadMoveEffectCommand: .ReadMoveEffectCommand:
; ld a, [BattleScriptBufferLoc++] ; ld a, [BattleScriptBufferAddress++]
ld a, [BattleScriptBufferLoc] ld a, [BattleScriptBufferAddress]
ld l, a ld l, a
ld a, [BattleScriptBufferLoc + 1] ld a, [BattleScriptBufferAddress + 1]
ld h, a ld h, a
ld a, [hli] ld a, [hli]
push af push af
ld a, l ld a, l
ld [BattleScriptBufferLoc], a ld [BattleScriptBufferAddress], a
ld a, h ld a, h
ld [BattleScriptBufferLoc + 1], a ld [BattleScriptBufferAddress + 1], a
pop af pop af
; endturn_command (-2) is used to terminate branches without ending the read cycle. ; endturn_command (-2) is used to terminate branches without ending the read cycle.
@@ -2103,7 +2103,7 @@ BattleCommand_LowerSub: ; 34eee
xor a xor a
ld [wNumHits], a ld [wNumHits], a
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
inc a inc a
ld [wKickCounter], a ld [wKickCounter], a
ld a, SUBSTITUTE ld a, SUBSTITUTE
@@ -2280,7 +2280,7 @@ BattleCommand_RaiseSub: ; 35004
xor a xor a
ld [wNumHits], a ld [wNumHits], a
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
ld a, $2 ld a, $2
ld [wKickCounter], a ld [wKickCounter], a
ld a, SUBSTITUTE ld a, SUBSTITUTE
@@ -2645,7 +2645,7 @@ BattleCommand_CheckDestinyBond: ; 351c0
call BattleCommand_SwitchTurn call BattleCommand_SwitchTurn
xor a xor a
ld [wNumHits], a ld [wNumHits], a
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
inc a inc a
ld [wKickCounter], a ld [wKickCounter], a
ld a, DESTINY_BOND ld a, DESTINY_BOND
@@ -2743,9 +2743,9 @@ BattleCommand_RageDamage: ; 3527b
EndMoveEffect: ; 352a3 EndMoveEffect: ; 352a3
ld a, [BattleScriptBufferLoc] ld a, [BattleScriptBufferAddress]
ld l, a ld l, a
ld a, [BattleScriptBufferLoc + 1] ld a, [BattleScriptBufferAddress + 1]
ld h, a ld h, a
ld a, $ff ld a, $ff
ld [hli], a ld [hli], a
@@ -4738,9 +4738,9 @@ FarPlayBattleAnimation: ; 35d00
PlayFXAnimID: ; 35d08 PlayFXAnimID: ; 35d08
ld a, e ld a, e
ld [FXAnimIDLo], a ld [FXAnimID], a
ld a, d ld a, d
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
ld c, 3 ld c, 3
call DelayFrames call DelayFrames
@@ -7097,9 +7097,9 @@ BattleCommand_EndLoop: ; 369b6
; Loop back to the command before 'critical'. ; Loop back to the command before 'critical'.
.loop_back_to_critical .loop_back_to_critical
ld a, [BattleScriptBufferLoc + 1] ld a, [BattleScriptBufferAddress + 1]
ld h, a ld h, a
ld a, [BattleScriptBufferLoc] ld a, [BattleScriptBufferAddress]
ld l, a ld l, a
.not_critical .not_critical
ld a, [hld] ld a, [hld]
@@ -7107,9 +7107,9 @@ BattleCommand_EndLoop: ; 369b6
jr nz, .not_critical jr nz, .not_critical
inc hl inc hl
ld a, h ld a, h
ld [BattleScriptBufferLoc + 1], a ld [BattleScriptBufferAddress + 1], a
ld a, l ld a, l
ld [BattleScriptBufferLoc], a ld [BattleScriptBufferAddress], a
ret ret
; 36a82 ; 36a82
@@ -7882,7 +7882,7 @@ BattleCommand_Substitute: ; 36e7c
xor a xor a
ld [wNumHits], a ld [wNumHits], a
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
ld [wKickCounter], a ld [wKickCounter], a
ld a, SUBSTITUTE ld a, SUBSTITUTE
call LoadAnim call LoadAnim
@@ -9862,14 +9862,14 @@ AnimateCurrentMove: ; 37e01
PlayDamageAnim: ; 37e19 PlayDamageAnim: ; 37e19
xor a xor a
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
ld a, BATTLE_VARS_MOVE_ANIM ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar call GetBattleVar
and a and a
ret z ret z
ld [FXAnimIDLo], a ld [FXAnimID], a
ld a, [hBattleTurn] ld a, [hBattleTurn]
and a and a
@@ -9888,7 +9888,7 @@ PlayDamageAnim: ; 37e19
LoadMoveAnim: ; 37e36 LoadMoveAnim: ; 37e36
xor a xor a
ld [wNumHits], a ld [wNumHits], a
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
ld a, BATTLE_VARS_MOVE_ANIM ld a, BATTLE_VARS_MOVE_ANIM
call GetBattleVar call GetBattleVar
@@ -9901,7 +9901,7 @@ LoadMoveAnim: ; 37e36
LoadAnim: ; 37e44 LoadAnim: ; 37e44
ld [FXAnimIDLo], a ld [FXAnimID], a
; fallthrough ; fallthrough
; 37e47 ; 37e47
@@ -9922,9 +9922,9 @@ PlayUserBattleAnim: ; 37e47
PlayOpponentBattleAnim: ; 37e54 PlayOpponentBattleAnim: ; 37e54
ld a, e ld a, e
ld [FXAnimIDLo], a ld [FXAnimID], a
ld a, d ld a, d
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
xor a xor a
ld [wNumHits], a ld [wNumHits], a
@@ -9983,9 +9983,9 @@ BattleCommand_ClearText: ; 37e85
SkipToBattleCommand: ; 37e8c SkipToBattleCommand: ; 37e8c
; Skip over commands until reaching command b. ; Skip over commands until reaching command b.
ld a, [BattleScriptBufferLoc + 1] ld a, [BattleScriptBufferAddress + 1]
ld h, a ld h, a
ld a, [BattleScriptBufferLoc] ld a, [BattleScriptBufferAddress]
ld l, a ld l, a
.loop .loop
ld a, [hli] ld a, [hli]
@@ -9993,9 +9993,9 @@ SkipToBattleCommand: ; 37e8c
jr nz, .loop jr nz, .loop
ld a, h ld a, h
ld [BattleScriptBufferLoc + 1], a ld [BattleScriptBufferAddress + 1], a
ld a, l ld a, l
ld [BattleScriptBufferLoc], a ld [BattleScriptBufferAddress], a
ret ret
; 37ea1 ; 37ea1

View File

@@ -11,7 +11,7 @@ BattleCommand_Transform: ; 371cd
jp nz, BattleEffect_ButItFailed jp nz, BattleEffect_ButItFailed
xor a xor a
ld [wNumHits], a ld [wNumHits], a
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
ld a, $1 ld a, $1
ld [wKickCounter], a ld [wKickCounter], a
ld a, BATTLE_VARS_SUBSTATUS4 ld a, BATTLE_VARS_SUBSTATUS4
@@ -129,7 +129,7 @@ BattleCommand_Transform: ; 371cd
.after_anim .after_anim
xor a xor a
ld [wNumHits], a ld [wNumHits], a
ld [FXAnimIDHi], a ld [FXAnimID + 1], a
ld a, $2 ld a, $2
ld [wKickCounter], a ld [wKickCounter], a
pop af pop af

View File

@@ -1,5 +1,5 @@
CalcMagikarpLength: ; fbbfc CalcMagikarpLength: ; fbbfc
; Return Magikarp's length (in mm) at MagikarpLength (big endian). ; Return Magikarp's length (in mm) at wMagikarpLength (big endian).
; ;
; input: ; input:
; de: EnemyMonDVs ; de: EnemyMonDVs
@@ -16,9 +16,9 @@ CalcMagikarpLength: ; fbbfc
; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id) ; bc = rrc(dv[0]) ++ rrc(dv[1]) ^ rrc(id)
; if bc < 10: [MagikarpLength] = c + 190 ; if bc < 10: [wMagikarpLength] = c + 190
; if bc >= $ff00: [MagikarpLength] = c + 1370 ; if bc >= $ff00: [wMagikarpLength] = c + 1370
; else: [MagikarpLength] = z * 100 + (bc - x) / y ; else: [wMagikarpLength] = z * 100 + (bc - x) / y
; X, Y, and Z depend on the value of b as follows: ; X, Y, and Z depend on the value of b as follows:
@@ -165,7 +165,7 @@ CalcMagikarpLength: ; fbbfc
.ok .ok
ld e, a ld e, a
ld hl, MagikarpLength ld hl, wMagikarpLength
ld [hl], d ld [hl], d
inc hl inc hl
ld [hl], e ld [hl], e

View File

@@ -1,11 +1,11 @@
LoadBattleMenu: ; 24ef2 LoadBattleMenu: ; 24ef2
ld hl, BattleMenuDataHeader ld hl, BattleMenuDataHeader
call LoadMenuDataHeader call LoadMenuDataHeader
ld a, [wd0d2] ld a, [wBattleMenuCursorBuffer]
ld [wMenuCursorBuffer], a ld [wMenuCursorBuffer], a
call InterpretBattleMenu call InterpretBattleMenu
ld a, [wMenuCursorBuffer] ld a, [wMenuCursorBuffer]
ld [wd0d2], a ld [wBattleMenuCursorBuffer], a
call ExitMenu call ExitMenu
ret ret
; 24f0b ; 24f0b
@@ -23,11 +23,11 @@ ContestBattleMenu: ; 24f13
; 24f19 ; 24f19
Function24f19: ; 24f19 Function24f19: ; 24f19
ld a, [wd0d2] ld a, [wBattleMenuCursorBuffer]
ld [wMenuCursorBuffer], a ld [wMenuCursorBuffer], a
call _2DMenu call _2DMenu
ld a, [wMenuCursorBuffer] ld a, [wMenuCursorBuffer]
ld [wd0d2], a ld [wBattleMenuCursorBuffer], a
call ExitMenu call ExitMenu
ret ret
; 24f2c ; 24f2c

File diff suppressed because it is too large Load Diff

View File

@@ -249,10 +249,10 @@ InitBattleAnimBuffer: ; ccaaa
.check_kinesis_softboiled_milkdrink .check_kinesis_softboiled_milkdrink
sub d sub d
push af push af
ld a, [FXAnimIDHi] ld a, [FXAnimID + 1]
or a or a
jr nz, .no_sub jr nz, .no_sub
ld a, [FXAnimIDLo] ld a, [FXAnimID]
cp KINESIS cp KINESIS
jr z, .kinesis jr z, .kinesis
cp SOFTBOILED cp SOFTBOILED

View File

@@ -451,18 +451,18 @@ GetBallAnimPal: ; cd249 (33:5249)
; cd26c (33:526c) ; cd26c (33:526c)
.balls .balls
db MASTER_BALL, 5 db MASTER_BALL, PAL_BATTLE_GREEN
db ULTRA_BALL, 3 db ULTRA_BALL, PAL_BATTLE_YELLOW
db GREAT_BALL, 6 db GREAT_BALL, PAL_BATTLE_BLUE
db POKE_BALL, 4 db POKE_BALL, PAL_BATTLE_RED
db HEAVY_BALL, 2 db HEAVY_BALL, PAL_BATTLE_GRAY
db LEVEL_BALL, 7 db LEVEL_BALL, PAL_BATTLE_BROWN
db LURE_BALL, 6 db LURE_BALL, PAL_BATTLE_BLUE
db FAST_BALL, 6 db FAST_BALL, PAL_BATTLE_BLUE
db FRIEND_BALL, 3 db FRIEND_BALL, PAL_BATTLE_YELLOW
db MOON_BALL, 2 db MOON_BALL, PAL_BATTLE_GRAY
db LOVE_BALL, 4 db LOVE_BALL, PAL_BATTLE_RED
db -1, 2 db -1, PAL_BATTLE_GRAY
; cd284 ; cd284
BattleAnimFunction_10: ; cd284 (33:5284) BattleAnimFunction_10: ; cd284 (33:5284)
call BattleAnim_AnonJumptable call BattleAnim_AnonJumptable

View File

@@ -256,9 +256,9 @@ _ShowLinkBattleParticipants: ; 2c1b2
ld de, OTPlayerName ld de, OTPlayerName
call PlaceString call PlaceString
hlcoord 9, 8 hlcoord 9, 8
ld a, $69 ; "V" ld a, "<BOLD_V>"
ld [hli], a ld [hli], a
ld [hl], $6a ; "S" ld [hl], "<BOLD_S>"
callba LinkBattle_TrainerHuds ; no need to callba callba LinkBattle_TrainerHuds ; no need to callba
ld b, SCGB_DIPLOMA ld b, SCGB_DIPLOMA
call GetSGBLayout call GetSGBLayout

View File

@@ -22,6 +22,7 @@ INCLUDE "constants/animation_constants.asm"
INCLUDE "constants/phone_constants.asm" INCLUDE "constants/phone_constants.asm"
INCLUDE "constants/gfx_constants.asm" INCLUDE "constants/gfx_constants.asm"
INCLUDE "constants/pokemon_data_constants.asm" INCLUDE "constants/pokemon_data_constants.asm"
INCLUDE "constants/mobile_constants.asm"
INCLUDE "constants/misc_constants.asm" INCLUDE "constants/misc_constants.asm"
INCLUDE "constants/std_constants.asm" INCLUDE "constants/std_constants.asm"
INCLUDE "constants/deco_constants.asm" INCLUDE "constants/deco_constants.asm"

View File

@@ -1,3 +1,4 @@
; battle_anim_struct members (see macros/wram.asm)
const_def const_def
const BATTLEANIMSTRUCT_INDEX const BATTLEANIMSTRUCT_INDEX
const BATTLEANIMSTRUCT_01 const BATTLEANIMSTRUCT_01
@@ -25,6 +26,7 @@
const BATTLEANIMSTRUCT_17 const BATTLEANIMSTRUCT_17
BATTLEANIMSTRUCT_LENGTH EQU const_value BATTLEANIMSTRUCT_LENGTH EQU const_value
; BattleAnimObjects indexes (see battle/objects/data.asm)
const_def const_def
const ANIM_OBJ_00 const ANIM_OBJ_00
const ANIM_OBJ_01 const ANIM_OBJ_01
@@ -215,6 +217,7 @@ BATTLEANIMSTRUCT_LENGTH EQU const_value
const ANIM_OBJ_BA const ANIM_OBJ_BA
const ANIM_OBJ_BB const ANIM_OBJ_BB
; DoBattleAnimFrame arguments (see battle/objects/functions.asm)
const_def const_def
const BATTLEANIMFUNC_00 const BATTLEANIMFUNC_00
const BATTLEANIMFUNC_01 const BATTLEANIMFUNC_01
@@ -297,6 +300,7 @@ BATTLEANIMSTRUCT_LENGTH EQU const_value
const BATTLEANIMFUNC_4E const BATTLEANIMFUNC_4E
const BATTLEANIMFUNC_4F const BATTLEANIMFUNC_4F
; BattleAnimFrameData indexes (see battle/objects/framesets.asm)
const_def const_def
const BATTLEANIMFRAMESET_00 const BATTLEANIMFRAMESET_00
const BATTLEANIMFRAMESET_01 const BATTLEANIMFRAMESET_01
@@ -484,6 +488,7 @@ BATTLEANIMSTRUCT_LENGTH EQU const_value
const BATTLEANIMFRAMESET_B7 const BATTLEANIMFRAMESET_B7
const BATTLEANIMFRAMESET_B8 const BATTLEANIMFRAMESET_B8
; BattleAnimOAMData indexes (see battle/objects/oam.asm)
const_def const_def
const BATTLEANIMOAMSET_00 const BATTLEANIMOAMSET_00
const BATTLEANIMOAMSET_01 const BATTLEANIMOAMSET_01
@@ -702,6 +707,7 @@ BATTLEANIMSTRUCT_LENGTH EQU const_value
const BATTLEANIMOAMSET_D6 const BATTLEANIMOAMSET_D6
const BATTLEANIMOAMSET_D7 const BATTLEANIMOAMSET_D7
; BattleBGEffects indexes (see battle/bg_effects.asm)
const_value SET 1 const_value SET 1
const ANIM_BG_FLASH_INVERTED const ANIM_BG_FLASH_INVERTED
const ANIM_BG_FLASH_WHITE const ANIM_BG_FLASH_WHITE
@@ -757,17 +763,19 @@ const_value SET 1
const ANIM_BG_WOBBLE_MON const ANIM_BG_WOBBLE_MON
const ANIM_BG_35 const ANIM_BG_35
; PokeAnims indexes (see gfx/pics/animation.asm)
const_def const_def
const ANIM_MON_SLOW ; 0 const ANIM_MON_SLOW
const ANIM_MON_NORMAL ; 1 const ANIM_MON_NORMAL
const ANIM_MON_MENU ; 2 const ANIM_MON_MENU
const ANIM_MON_TRADE ; 3 const ANIM_MON_TRADE
const ANIM_MON_EVOLVE ; 4 const ANIM_MON_EVOLVE
const ANIM_MON_HATCH ; 5 const ANIM_MON_HATCH
const ANIM_MON_UNUSED ; 6 const ANIM_MON_UNUSED
const ANIM_MON_EGG1 ; 7 const ANIM_MON_EGG1
const ANIM_MON_EGG2 ; 8 const ANIM_MON_EGG2
; AnimObjGFX indexes (see battle/objects/gfx_headers.asm)
const_value SET 1 const_value SET 1
const ANIM_GFX_HIT const ANIM_GFX_HIT
const ANIM_GFX_CUT const ANIM_GFX_CUT
@@ -809,8 +817,20 @@ const_value SET 1
const ANIM_GFX_WAVE const ANIM_GFX_WAVE
const ANIM_GFX_AEROBLAST const ANIM_GFX_AEROBLAST
; battle_bg_effect struct members (see macros/wram.asm)
const_def const_def
const BG_EFFECT_STRUCT_FUNCTION const BG_EFFECT_STRUCT_FUNCTION
const BG_EFFECT_STRUCT_JT_INDEX const BG_EFFECT_STRUCT_JT_INDEX
const BG_EFFECT_STRUCT_BATTLE_TURN const BG_EFFECT_STRUCT_BATTLE_TURN
const BG_EFFECT_STRUCT_03 const BG_EFFECT_STRUCT_03
; animation object palettes
const_def
const PAL_BATTLE_ENEMY ; 0
const PAL_BATTLE_PLAYER ; 1
const PAL_BATTLE_GRAY ; 2
const PAL_BATTLE_YELLOW ; 3
const PAL_BATTLE_RED ; 4
const PAL_BATTLE_GREEN ; 5
const PAL_BATTLE_BLUE ; 6
const PAL_BATTLE_BROWN ; 7

View File

@@ -1,63 +1,69 @@
; pitch ; pitch
const_def const_def
const __ const __ ; 0
const C_ const C_ ; 1
const C# const C# ; 2
const D_ const D_ ; 3
const D# const D# ; 4
const E_ const E_ ; 5
const F_ const F_ ; 6
const F# const F# ; 7
const G_ const G_ ; 8
const G# const G# ; 9
const A_ const A_ ; a
const A# const A# ; b
const B_ const B_ ; c
const CC ; used for pitchoffset const CC ; d (used for pitchoffset)
; channel ; channel
; ChannelPointers indexes (see engine/audio.asm)
const_def const_def
const CHAN1 const CHAN1 ; 0
const CHAN2 const CHAN2 ; 1
const CHAN3 const CHAN3 ; 2
const CHAN4 const CHAN4 ; 3
NUM_MUSIC_CHANS EQU const_value NUM_MUSIC_CHANS EQU const_value
NUM_NOISE_CHANS EQU const_value NUM_NOISE_CHANS EQU const_value
const CHAN5 const CHAN5 ; 4
const CHAN6 const CHAN6 ; 5
const CHAN7 const CHAN7 ; 6
const CHAN8 const CHAN8 ; 7
NUM_CHANNELS EQU const_value NUM_CHANNELS EQU const_value
; Flags1 ; Flags1
SOUND_CHANNEL_ON EQU 0 const_def
SOUND_SUBROUTINE EQU 1 const SOUND_CHANNEL_ON ; 0
SOUND_LOOPING EQU 2 const SOUND_SUBROUTINE ; 1
SOUND_SFX EQU 3 const SOUND_LOOPING ; 2
SOUND_NOISE EQU 4 const SOUND_SFX ; 3
SOUND_REST EQU 5 const SOUND_NOISE ; 4
const SOUND_REST ; 5
; Flags2 ; Flags2
const_def
SOUND_VIBRATO EQU 0 const SOUND_VIBRATO ; 0
SOUND_PITCH_WHEEL EQU 1 const SOUND_PITCH_WHEEL ; 1
SOUND_DUTY EQU 2 const SOUND_DUTY ; 2
SOUND_UNKN_0B EQU 3 const SOUND_UNKN_0B ; 3
SOUND_CRY_PITCH EQU 4 const SOUND_CRY_PITCH ; 4
SOUND_UNKN_0D EQU 5 const SOUND_UNKN_0D ; 5
SOUND_UNKN_0E EQU 6 const SOUND_UNKN_0E ; 6
SOUND_UNKN_0F EQU 7 const SOUND_UNKN_0F ; 7
; Flags3 ; Flags3
SOUND_VIBRATO_DIR EQU 0 const_def
SOUND_PITCH_WHEEL_DIR EQU 1 const SOUND_VIBRATO_DIR ; 0
const SOUND_PITCH_WHEEL_DIR ; 1
; NoteFlags ; NoteFlags
NOTE_DUTY_OVERRIDE EQU 0 const_def
NOTE_FREQ_OVERRIDE EQU 1 const NOTE_DUTY_OVERRIDE ; 0
NOTE_UNKN_3 EQU 3 const NOTE_FREQ_OVERRIDE ; 1
NOTE_NOISE_SAMPLING EQU 4 const NOTE_UNUSED ; 2
NOTE_REST EQU 5 const NOTE_UNKN_3 ; 3
NOTE_VIBRATO_OVERRIDE EQU 6 const NOTE_NOISE_SAMPLING ; 4
const NOTE_REST ; 5
const NOTE_VIBRATO_OVERRIDE ; 6
; Volume:
MAX_VOLUME EQU $77

View File

@@ -1,12 +1,20 @@
; significant level values
MAX_LEVEL EQU 100 MAX_LEVEL EQU 100
MIN_LEVEL EQU 2 MIN_LEVEL EQU 2
EGG_LEVEL EQU 5 EGG_LEVEL EQU 5
; maximum moves known per mon
NUM_MOVES EQU 4 NUM_MOVES EQU 4
REST_TURNS EQU 2 ; significant stat values
MAX_STAT_LEVEL EQU 13
BASE_STAT_LEVEL EQU 7 BASE_STAT_LEVEL EQU 7
MAX_STAT_LEVEL EQU 13
; turns that Rest sleep lasts
REST_TURNS EQU 2
; PlayerStatLevels and EnemyStatLevels indexes
; used for GetStatName
const_def const_def
const ATTACK const ATTACK
const DEFENSE const DEFENSE
@@ -15,10 +23,10 @@ BASE_STAT_LEVEL EQU 7
const SP_DEFENSE const SP_DEFENSE
const ACCURACY const ACCURACY
const EVASION const EVASION
const ABILITY const ABILITY ; used for BattleCommand_Curse
NUM_LEVEL_STATS EQU const_value NUM_LEVEL_STATS EQU const_value
; move struct ; move struct members (see battle/moves/moves.asm)
const_def const_def
const MOVE_ANIM const MOVE_ANIM
const MOVE_EFFECT const MOVE_EFFECT
@@ -30,6 +38,9 @@ NUM_LEVEL_STATS EQU const_value
const MOVE_LENGTH const MOVE_LENGTH
; stat constants ; stat constants
; indexes for:
; - PlayerStats and EnemyStats (see wram.asm)
; - party_struct and battle_struct members (see macros/wram.asm)
const_value SET 1 const_value SET 1
const STAT_HP const STAT_HP
const STAT_ATK const STAT_ATK
@@ -38,6 +49,8 @@ const_value SET 1
const STAT_SATK const STAT_SATK
const STAT_SDEF const STAT_SDEF
NUM_STATS EQU const_value NUM_STATS EQU const_value
; stat formula constants
STAT_MIN_NORMAL EQU 5 STAT_MIN_NORMAL EQU 5
STAT_MIN_HP EQU 10 STAT_MIN_HP EQU 10
@@ -45,12 +58,12 @@ STAT_MIN_HP EQU 10
ATKDEFDV_SHINY EQU $EA ATKDEFDV_SHINY EQU $EA
SPDSPCDV_SHINY EQU $AA SPDSPCDV_SHINY EQU $AA
; battle classes ; battle classes (wBattleMode values)
const_value SET 1 const_value SET 1
const WILD_BATTLE const WILD_BATTLE
const TRAINER_BATTLE const TRAINER_BATTLE
; battle types ; battle types (BattleType values)
const_def const_def
const BATTLETYPE_NORMAL const BATTLETYPE_NORMAL
const BATTLETYPE_CANLOSE const BATTLETYPE_CANLOSE
@@ -66,7 +79,7 @@ const_value SET 1
const BATTLETYPE_CELEBI const BATTLETYPE_CELEBI
const BATTLETYPE_SUICUNE const BATTLETYPE_SUICUNE
; battle variables ; GetBattleVar and GetBattleVarAddr arguments (see home/battle.asm)
const_def const_def
const BATTLE_VARS_SUBSTATUS1 const BATTLE_VARS_SUBSTATUS1
const BATTLE_VARS_SUBSTATUS2 const BATTLE_VARS_SUBSTATUS2
@@ -90,8 +103,37 @@ const_value SET 1
const BATTLE_VARS_LAST_MOVE const BATTLE_VARS_LAST_MOVE
const BATTLE_VARS_LAST_MOVE_OPP const BATTLE_VARS_LAST_MOVE_OPP
; status ; GetBattleVar and GetBattleVarAddr internal indexes (see home/battle.asm)
SLP EQU 7 ; 0-7 turns const_def
const PLAYER_SUBSTATUS_1
const ENEMY_SUBSTATUS_1
const PLAYER_SUBSTATUS_2
const ENEMY_SUBSTATUS_2
const PLAYER_SUBSTATUS_3
const ENEMY_SUBSTATUS_3
const PLAYER_SUBSTATUS_4
const ENEMY_SUBSTATUS_4
const PLAYER_SUBSTATUS_5
const ENEMY_SUBSTATUS_5
const PLAYER_STATUS
const ENEMY_STATUS
const PLAYER_MOVE_ANIMATION
const ENEMY_MOVE_ANIMATION
const PLAYER_MOVE_EFFECT
const ENEMY_MOVE_EFFECT
const PLAYER_MOVE_POWER
const ENEMY_MOVE_POWER
const PLAYER_MOVE_TYPE
const ENEMY_MOVE_TYPE
const PLAYER_CUR_MOVE
const ENEMY_CUR_MOVE
const PLAYER_COUNTER_MOVE
const ENEMY_COUNTER_MOVE
const PLAYER_LAST_MOVE
const ENEMY_LAST_MOVE
; status condition bit flags
SLP EQU %111 ; 0-7 turns
const_value SET 3 const_value SET 3
const PSN const PSN
const BRN const BRN
@@ -100,7 +142,7 @@ const_value SET 3
ALL_STATUS EQU (1 << PSN) + (1 << BRN) + (1 << FRZ) + (1 << PAR) + SLP ALL_STATUS EQU (1 << PSN) + (1 << BRN) + (1 << FRZ) + (1 << PAR) + SLP
; substatus ; PlayerSubStatus1 or EnemySubStatus1 bit flags
enum_start 7, -1 enum_start 7, -1
enum SUBSTATUS_IN_LOVE enum SUBSTATUS_IN_LOVE
enum SUBSTATUS_ROLLOUT enum SUBSTATUS_ROLLOUT
@@ -111,8 +153,10 @@ ALL_STATUS EQU (1 << PSN) + (1 << BRN) + (1 << FRZ) + (1 << PAR) + SLP
enum SUBSTATUS_CURSE enum SUBSTATUS_CURSE
enum SUBSTATUS_NIGHTMARE enum SUBSTATUS_NIGHTMARE
; PlayerSubStatus2 or EnemySubStatus2 bit flags
SUBSTATUS_CURLED EQU 0 SUBSTATUS_CURLED EQU 0
; PlayerSubStatus3 or EnemySubStatus3 bit flags
enum_start 7, -1 enum_start 7, -1
enum SUBSTATUS_CONFUSED enum SUBSTATUS_CONFUSED
enum SUBSTATUS_FLYING enum SUBSTATUS_FLYING
@@ -123,6 +167,7 @@ SUBSTATUS_CURLED EQU 0
enum SUBSTATUS_RAMPAGE enum SUBSTATUS_RAMPAGE
enum SUBSTATUS_BIDE enum SUBSTATUS_BIDE
; PlayerSubStatus4 or EnemySubStatus4 bit flags
enum_start 7, -1 enum_start 7, -1
enum SUBSTATUS_LEECH_SEED enum SUBSTATUS_LEECH_SEED
enum SUBSTATUS_RAGE enum SUBSTATUS_RAGE
@@ -133,6 +178,7 @@ SUBSTATUS_CURLED EQU 0
enum SUBSTATUS_MIST enum SUBSTATUS_MIST
enum SUBSTATUS_X_ACCURACY enum SUBSTATUS_X_ACCURACY
; PlayerSubStatus5 or EnemySubStatus5 bit flags
enum_start 7, -1 enum_start 7, -1
enum SUBSTATUS_CANT_RUN enum SUBSTATUS_CANT_RUN
enum SUBSTATUS_DESTINY_BOND enum SUBSTATUS_DESTINY_BOND
@@ -143,7 +189,7 @@ SUBSTATUS_CURLED EQU 0
enum SUBSTATUS_UNKNOWN_3 enum SUBSTATUS_UNKNOWN_3
enum SUBSTATUS_TOXIC enum SUBSTATUS_TOXIC
; environmental ; PlayerScreens or EnemyScreens bit flags
enum_start 4, -1 enum_start 4, -1
enum SCREENS_REFLECT enum SCREENS_REFLECT
enum SCREENS_LIGHT_SCREEN enum SCREENS_LIGHT_SCREEN
@@ -151,7 +197,7 @@ SUBSTATUS_CURLED EQU 0
enum SCREENS_UNUSED enum SCREENS_UNUSED
enum SCREENS_SPIKES enum SCREENS_SPIKES
; weather ; Weather values
const_def const_def
const WEATHER_NONE const WEATHER_NONE
const WEATHER_RAIN const WEATHER_RAIN
@@ -161,8 +207,7 @@ SUBSTATUS_CURLED EQU 0
const WEATHER_SUN_END const WEATHER_SUN_END
const WEATHER_SANDSTORM_END const WEATHER_SANDSTORM_END
; MoveEffectsPointers indexes (see battle/moves/move_effects_pointers.asm)
; move effects
const_def const_def
const EFFECT_NORMAL_HIT const EFFECT_NORMAL_HIT
const EFFECT_SLEEP const EFFECT_SLEEP
@@ -322,35 +367,6 @@ SUBSTATUS_CURLED EQU 0
const EFFECT_FLY const EFFECT_FLY
const EFFECT_DEFENSE_CURL const EFFECT_DEFENSE_CURL
; Battle vars used in home/battle.asm
const_def
const PLAYER_SUBSTATUS_1
const ENEMY_SUBSTATUS_1
const PLAYER_SUBSTATUS_2
const ENEMY_SUBSTATUS_2
const PLAYER_SUBSTATUS_3
const ENEMY_SUBSTATUS_3
const PLAYER_SUBSTATUS_4
const ENEMY_SUBSTATUS_4
const PLAYER_SUBSTATUS_5
const ENEMY_SUBSTATUS_5
const PLAYER_STATUS
const ENEMY_STATUS
const PLAYER_MOVE_ANIMATION
const ENEMY_MOVE_ANIMATION
const PLAYER_MOVE_EFFECT
const ENEMY_MOVE_EFFECT
const PLAYER_MOVE_POWER
const ENEMY_MOVE_POWER
const PLAYER_MOVE_TYPE
const ENEMY_MOVE_TYPE
const PLAYER_CUR_MOVE
const ENEMY_CUR_MOVE
const PLAYER_COUNTER_MOVE
const ENEMY_COUNTER_MOVE
const PLAYER_LAST_MOVE
const ENEMY_LAST_MOVE
; wBattleAction ; wBattleAction
const_def const_def
const BATTLEACTION_MOVE1 const BATTLEACTION_MOVE1
@@ -370,6 +386,7 @@ SUBSTATUS_CURLED EQU 0
const BATTLEACTION_E const BATTLEACTION_E
const BATTLEACTION_FORFEIT const BATTLEACTION_FORFEIT
; wBattleResult
const_def const_def
const WIN const WIN
const LOSE const LOSE

View File

@@ -1,3 +1,4 @@
; BattleTowerAction arguments (see misc/battle_tower_5c.asm)
const_def const_def
const BATTLETOWERACTION_CHECK_EXPLANATION_READ const BATTLETOWERACTION_CHECK_EXPLANATION_READ
const BATTLETOWERACTION_SET_EXPLANATION_READ const BATTLETOWERACTION_SET_EXPLANATION_READ
@@ -32,8 +33,19 @@
const BATTLETOWERACTION_CHOOSEREWARD ; save options const BATTLETOWERACTION_CHOOSEREWARD ; save options
const BATTLETOWERACTION_SAVEOPTIONS const BATTLETOWERACTION_SAVEOPTIONS
BATTLETOWER_NO_CHALLENGE EQU 0 ; sBattleTowerChallengeState
BATTLETOWER_SAVED_AND_LEFT EQU 1 const_def
BATTLETOWER_CHALLENGE_IN_PROGESS EQU 2 const BATTLETOWER_NO_CHALLENGE
BATTLETOWER_WON_CHALLENGE EQU 3 const BATTLETOWER_SAVED_AND_LEFT
BATTLETOWER_RECEIVED_REWARD EQU 4 const BATTLETOWER_CHALLENGE_IN_PROGESS
const BATTLETOWER_WON_CHALLENGE
const BATTLETOWER_RECEIVED_REWARD
BATTLETOWER_NROFPKMNS EQU 3
BATTLETOWER_TRAINERDATALENGTH EQU $24
BATTLETOWER_NROFTRAINERS EQU 7
BATTLETOWER_NRMONSPERLEVELBRACKET EQU BATTLETOWER_NROFPKMNS * BATTLETOWER_NROFTRAINERS
BATTLE_TOWER_STRUCT_LENGTH EQU $e0 ; NAME_LENGTH + 3 * (PARTYMON_STRUCT_LENGTH + PKMN_NAME_LENGTH) + BATTLETOWER_TRAINERDATALENGTH
; return value from BattleTowerAction(BATTLETOWERACTION_CHECKMOBILEEVENT)
MOBILE_EVENT_OBJECT_GS_BALL EQU $b

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