Merge pull request #259 from yenatch/cries

Shorten cry defs now that cry parameters are all words.
This commit is contained in:
Bryan Bishop 2014-07-19 14:25:28 -05:00
commit bb5ae04ca5
12 changed files with 456 additions and 1714 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,6 @@
; Notable functions:
; FadeMusic
; PlayStereoSFX
; PlayCry
_SoundRestart:: ; e8000
; restart sound operation
@ -828,7 +827,7 @@ Functione8466: ; e8466
add hl, bc
bit 4, [hl]
jr z, .vibrato
ld hl, $0027
ld hl, Channel1CryPitch - Channel1
add hl, bc
ld e, [hl]
inc hl
@ -1758,7 +1757,7 @@ MusicE6: ; e88e4
ld hl, Channel1Flags2 - Channel1
add hl, bc
set 4, [hl]
ld hl, $0028
ld hl, Channel1CryPitch + 1 - Channel1
add hl, bc
call GetMusicByte
ld [hld], a
@ -2364,10 +2363,9 @@ _PlayMusic:: ; e8b30
ret
; e8b79
PlayCry:: ; e8b79
_PlayCryHeader:: ; e8b79
; Play cry de using parameters:
; CryPitch
; CryEcho
; CryLength
call MusicOff
@ -2416,7 +2414,7 @@ PlayCry:: ; e8b79
add hl, bc
ld a, [CryPitch]
ld [hli], a
ld a, [CryEcho]
ld a, [CryPitch + 1]
ld [hl], a
; No tempo for channel 4

View File

@ -1317,7 +1317,7 @@ BattleAnimCmd_E1: ; cc807 (33:4807)
.asm_cc834
push hl
call Function37f3
call LoadCryHeader
pop hl
jr c, .done
@ -1327,15 +1327,15 @@ BattleAnimCmd_E1: ; cc807 (33:4807)
ld b, a
push hl
ld hl, CryPitch ; $c2b0
ld hl, CryPitch
ld a, [hli]
ld h, [hl]
ld l, a
add hl, bc
ld a, l
ld [CryPitch], a ; $c2b0
ld [CryPitch], a
ld a, h
ld [CryEcho], a ; $c2b1
ld [CryPitch + 1], a
pop hl
ld a, [hli]
@ -1354,7 +1354,7 @@ BattleAnimCmd_E1: ; cc807 (33:4807)
ld a, 1
ld [$c2bc], a
callab PlayCry
callab _PlayCryHeader
.done
pop af
@ -1363,11 +1363,11 @@ BattleAnimCmd_E1: ; cc807 (33:4807)
; cc871 (33:4871)
Datacc871: ; cc871
; +pitch, +echo, +length
db $00, $00, $c0, $00
db $00, $00, $40, $00
db $00, $00, $00, $00
db $00, $00, $00, $00
; +pitch, +length
dw 0, $c0
dw 0, $40
dw 0, $00
dw 0, $00
; cc881

View File

@ -2350,7 +2350,7 @@ Function3cef1: ; 3cef1
ld a, $f0
ld [CryTracks], a
ld a, [BattleMonSpecies]
call Function37b6
call PlayStereoCry
call Function3d43b
hlcoord 9, 7
lb bc, 5, 11
@ -3741,7 +3741,7 @@ Function3d7c7: ; 3d7c7
ld a, $f
ld [CryTracks], a
ld a, [TempEnemyMonSpecies]
call Function37b6
call PlayStereoCry
.asm_3d82c
call UpdateEnemyHUD
@ -4235,7 +4235,7 @@ Function3db5f: ; 3db5f
ld a, $f0
ld [CryTracks], a
ld a, [CurPartySpecies]
call Function37b6
call PlayStereoCry
.asm_3dbd6
call UpdatePlayerHUD
@ -4368,7 +4368,7 @@ Function3dc5b: ; 3dc5b
ld a, $f0
ld [CryTracks], a
ld a, [BattleMonSpecies]
call Function37b6
call PlayStereoCry
ld a, [$c71a]
ld c, a
ld hl, $c664
@ -9490,7 +9490,7 @@ BattleStartMessage: ; 3fc8b
ld a, $0f
ld [CryTracks], a
ld a, [TempEnemyMonSpecies]
call Function37b6
call PlayStereoCry
.asm_3fceb
ld a, [BattleType]

View File

@ -1040,10 +1040,10 @@ Script_cry: ; 0x971d1
call GetScriptByte
pop af
and a
jr nz, .asm_971df ; 0x971da $3
jr nz, .ok
ld a, [ScriptVar]
.asm_971df
call Function37ce
.ok
call PlayCry
ret
; 0x971e3

View File

@ -180,7 +180,7 @@ Functiond0171: ; d0171
Functiond017a: ; d017a
ld a, [$d16b]
call Function37e2
call _PlayCry
ld a, [$d168]
inc a
ld [$d168], a
@ -189,7 +189,7 @@ Functiond017a: ; d017a
Functiond0188: ; d0188
ld a, [$d16b]
call Function37d5
call PlayCry2
ld a, [$d168]
inc a
ld [$d168], a
@ -200,7 +200,7 @@ Functiond0196: ; d0196
ld a, $f
ld [CryTracks], a
ld a, [$d16b]
call Function37c4
call PlayStereoCry2
ld a, [$d168]
inc a
ld [$d168], a

103
home.asm
View File

@ -1718,109 +1718,8 @@ Function378b:: ; 378b
ret
; 37b6
Function37b6:: ; 37b6
push af
ld a, $1
ld [$c2bc], a
pop af
call Function37e2
call WaitSFX
ret
; 37c4
Function37c4:: ; 37c4
push af
ld a, $1
ld [$c2bc], a
pop af
jp Function37e2
; 37ce
Function37ce:: ; 37ce
call Function37d5
call WaitSFX
ret
; 37d5
Function37d5:: ; 37d5
push af
xor a
ld [$c2bc], a
ld [CryTracks], a
pop af
call Function37e2
ret
; 37e2
Function37e2:: ; 37e2
push hl
push de
push bc
call Function381e
jr c, .asm_37ef
ld e, c
ld d, b
call PlayCryHeader
.asm_37ef
pop bc
pop de
pop hl
ret
; 37f3
Function37f3:: ; 37f3
call Function381e
ret c
ld a, [hROMBank]
push af
ld a, BANK(CryHeaders)
rst Bankswitch
ld hl, CryHeaders
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
inc hl
ld a, [hli]
ld [CryPitch], a
ld a, [hli]
ld [CryEcho], a
ld a, [hli]
ld [CryLength], a
ld a, [hl]
ld [CryLength + 1], a
pop af
rst Bankswitch
and a
ret
; 381e
Function381e:: ; 381e
and a
jr z, .asm_382b
cp NUM_POKEMON + 1
jr nc, .asm_382b
dec a
ld c, a
ld b, 0
and a
ret
.asm_382b
scf
ret
; 382d
INCLUDE "home/cry.asm"
PrintLevel:: ; 382d

View File

@ -142,7 +142,7 @@ PlayMusic2:: ; 3bbc
PlayCryHeader:: ; 3be3
; Play a cry given parameters at header de
; Play cry header de.
push hl
push de
@ -173,17 +173,17 @@ PlayCryHeader:: ; 3be3
ld a, [hli]
ld [CryPitch], a
ld a, [hli]
ld [CryEcho], a
ld [CryPitch + 1], a
ld a, [hli]
ld [CryLength], a
ld a, [hl]
ld [CryLength + 1], a
ld a, BANK(PlayCry)
ld a, BANK(_PlayCryHeader)
ld [hROMBank], a
ld [MBC3RomBank], a
call PlayCry
call _PlayCryHeader
pop af
ld [hROMBank], a

111
home/cry.asm Normal file
View File

@ -0,0 +1,111 @@
PlayStereoCry:: ; 37b6
push af
ld a, 1
ld [$c2bc], a
pop af
call _PlayCry
call WaitSFX
ret
; 37c4
PlayStereoCry2:: ; 37c4
; Don't wait for the cry to end.
; Used during pic animations.
push af
ld a, 1
ld [$c2bc], a
pop af
jp _PlayCry
; 37ce
PlayCry:: ; 37ce
call PlayCry2
call WaitSFX
ret
; 37d5
PlayCry2:: ; 37d5
; Don't wait for the cry to end.
push af
xor a
ld [$c2bc], a
ld [CryTracks], a
pop af
call _PlayCry
ret
; 37e2
_PlayCry:: ; 37e2
push hl
push de
push bc
call GetCryIndex
jr c, .done
ld e, c
ld d, b
call PlayCryHeader
.done
pop bc
pop de
pop hl
ret
; 37f3
LoadCryHeader:: ; 37f3
; Load cry header bc.
call GetCryIndex
ret c
ld a, [hROMBank]
push af
ld a, BANK(CryHeaders)
rst Bankswitch
ld hl, CryHeaders
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
inc hl
ld a, [hli]
ld [CryPitch], a
ld a, [hli]
ld [CryPitch + 1], a
ld a, [hli]
ld [CryLength], a
ld a, [hl]
ld [CryLength + 1], a
pop af
rst Bankswitch
and a
ret
; 381e
GetCryIndex:: ; 381e
and a
jr z, .no
cp NUM_POKEMON + 1
jr nc, .no
dec a
ld c, a
ld b, 0
and a
ret
.no
scf
ret
; 382d

View File

@ -1108,7 +1108,7 @@ Function1522:: ; 1522
ld e, [hl]
inc hl
ld d, [hl]
call Function37ce
call PlayCry
pop de
pop hl
pop bc

100
main.asm
View File

@ -4426,7 +4426,7 @@ OakSpeech: ; 0x5f99
call Function4b6
call ClearTileMap
ld a, $c2
ld a, WOOPER
ld [CurSpecies], a
ld [CurPartySpecies], a
call GetBaseData
@ -4487,7 +4487,7 @@ OakText2: ; 0x604a
TX_FAR _OakText2
start_asm
ld a,WOOPER
call Function37ce
call PlayCry
call WaitSFX
ld hl,OakText3
ret
@ -8443,7 +8443,7 @@ SpecialSnorlaxAwake: ; 0xc43d
Functionc472: ; c472
ld a, [CurPartySpecies]
jp Function37ce
jp PlayCry
; c478
SpecialGameboyCheck: ; c478
@ -9339,16 +9339,16 @@ Jumptable_c91a: ; c91a (3:491a)
; no known jump sources
Functionc922: ; c922 (3:4922)
ld de, $1e
ld de, ENGINE_FOGBADGE
call CheckBadge
jr c, .asm_c956
ld hl, BikeFlags ; $dbf5
bit 1, [hl]
ld hl, BikeFlags
bit 1, [hl] ; always on bike
jr nz, .asm_c95c
ld a, [PlayerState] ; $d95d
cp $4
ld a, [PlayerState]
cp PLAYER_SURF
jr z, .asm_c959
cp $8
cp PLAYER_SURF_PIKA
jr z, .asm_c959
call GetFacingTileCoord
call GetTileCollision
@ -9422,18 +9422,18 @@ Functionc9a2: ; c9a2
; c9a9
UsedSurfText: ; c9a9
TX_FAR _UsedSurfText ; [MONSTER] used
db "@" ; SURF!
TX_FAR _UsedSurfText
db "@"
; c9ae
CantSurfText: ; c9ae
TX_FAR _CantSurfText ; You can't SURF
db "@" ; here.
TX_FAR _CantSurfText
db "@"
; c9b3
AlreadySurfingText: ; c9b3
TX_FAR _AlreadySurfingText ; You're already
db "@" ; SURFING.
TX_FAR _AlreadySurfingText
db "@"
; c9b8
@ -10143,25 +10143,31 @@ UnknownText_0xcd73: ; 0xcd73
; 0xcd78
Functioncd78: ; cd78
ld d, $46
ld d, STRENGTH
call CheckPartyMove
jr c, .asm_cd92
ld de, $1d
ld de, ENGINE_PLAINBADGE
call CheckEngineFlag
jr c, .asm_cd92
ld hl, BikeFlags ; $dbf5
bit 0, [hl]
jr z, .asm_cd96
ld a, $2
ld a, 2
jr .asm_cd99
.asm_cd92
ld a, $1
ld a, 1
jr .asm_cd99
.asm_cd96
xor a
jr .asm_cd99
.asm_cd99
ld [ScriptVar], a ; $c2dd
ld [ScriptVar], a
ret
; cd9d
@ -10521,7 +10527,7 @@ UnknownText_0xcf77: ; 0xcf77
; 0xcf7c
Functioncf7c: ; cf7c
ld d, $f9
ld d, ROCK_SMASH
call CheckPartyMove
jr nc, .asm_cf87
ld a, $1
@ -28842,7 +28848,7 @@ Function167f6: ; 167f6
ld a, $5
call Function1689b
ld a, [CurPartySpecies]
call Function37ce
call PlayCry
ld a, $9
call Function1689b
ret
@ -28902,7 +28908,7 @@ Function16850: ; 16850
ld a, $d
call Function1689b
ld a, [CurPartySpecies]
call Function37ce
call PlayCry
ld a, $e
call Function1689b
ret
@ -30624,7 +30630,7 @@ Function17421: ; 17421
ld hl, UnknownText_0x17467
call PrintText
ld a, [wBreedMon1Species]
call Function37ce
call PlayCry
ld a, [wDaycareLady]
bit 0, a
jr z, Function1745f
@ -30637,7 +30643,7 @@ Function17440: ; 17440
ld hl, UnknownText_0x17462
call PrintText
ld a, [wBreedMon2Species]
call Function37ce
call PlayCry
ld a, [wDaycareMan]
bit 0, a
jr z, Function1745f
@ -39022,14 +39028,15 @@ Function2942e: ; 2942e
ld a, $e4
call DmgToCgbBGPals
call Function294bb
ld a, [PlayerSDefLevel]
call Function381e
call GetCryIndex
jr c, .asm_2945d
ld e, c
ld d, b
call PlayCryHeader
.asm_2945d
call Function29114
ret
; 29461
@ -44298,7 +44305,7 @@ Function40217: ; 40217 (10:4217)
ld a, $4
call Function41423
ld a, [CurPartySpecies] ; $d108
call Function37ce
call PlayCry
call Function40131
ret
@ -44370,7 +44377,7 @@ Function402aa: ; 402aa (10:42aa)
ld a, $4
call Function41423
ld a, [CurPartySpecies] ; $d108
call Function37ce
call PlayCry
ld hl, $cf63
dec [hl]
ret
@ -44426,7 +44433,7 @@ Function402fa: ; 402fa
Function40340: ; 40340
call Function40bb1
ld a, [$d265]
call Function381e
call GetCryIndex
ld e, c
ld d, b
call PlayCryHeader
@ -46626,7 +46633,7 @@ Function41a7f: ; 41a7f
ld a, $4
call Function41423
ld a, [CurPartySpecies]
call Function37ce
call PlayCry
ret
; 41ad7
@ -56942,7 +56949,7 @@ Function4e226: ; 4e226 (13:6226)
call Function32f9
call Function4e253
ld a, [CurPartySpecies] ; $d108
call Function37d5
call PlayCry2
ret
; known jump sources: 4e23f (13:623f), 4e249 (13:6249)
@ -57469,7 +57476,7 @@ _EvolutionAnimation: ; 4e607
jr c, .asm_4e67c
ld a, [Buffer1]
call Function37ce
call PlayCry
.asm_4e67c
ld de, MUSIC_EVOLUTION
@ -57538,7 +57545,7 @@ _EvolutionAnimation: ; 4e607
ret c
ld a, [PlayerHPPal]
call Function37ce
call PlayCry
ret
; 4e703
@ -95608,7 +95615,7 @@ Functione307c: ; e307c (38:707c)
ld [$d10b], a
callba Functione039
ld a, [CurPartySpecies] ; $d108
call Function37ce
call PlayCry
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $f08
call ClearBox
@ -95663,7 +95670,7 @@ Functione30fa: ; e30fa (38:70fa)
ld [$d10b], a
callba Functione039
ld a, [CurPartySpecies] ; $d108
call Function37ce
call PlayCry
ld hl, TileMap ; $c4a0 (aliases: SpritesEnd)
ld bc, $f08
call ClearBox
@ -95709,14 +95716,16 @@ Functione3180: ; e3180 (38:7180)
hlcoord 0, 15
ld bc, $112
call TextBox
call WaitBGMap
ld a, [CurPartySpecies] ; $d108
call Function381e
call GetCryIndex
jr c, .asm_e31ab
ld e, c
ld d, b
call PlayCryHeader
.asm_e31ab
ld a, [CurPartySpecies] ; $d108
ld [$d265], a
call GetPokemonName
@ -99726,32 +99735,33 @@ INCLUDE "event/name_rater.asm"
Functionfb841: ; fb841
ld a, [ScriptVar]
call Function37f3
jr c, .asm_fb876
call LoadCryHeader
jr c, .done
ld hl, CryPitch
ld a, [hli]
ld h, [hl]
ld l, a
ld bc, $fec0
ld bc, -$140
add hl, bc
ld a, l
ld [CryPitch], a
ld a, h
ld [CryEcho], a
ld [CryPitch + 1], a
ld hl, CryLength
ld a, [hli]
ld h, [hl]
ld l, a
ld bc, $0060
ld bc, $60
add hl, bc
ld a, l
ld [CryLength], a
ld a, h
ld [$c2b3], a
callba PlayCry
ld [CryLength + 1], a
callba _PlayCryHeader
call WaitSFX
.asm_fb876
.done
ret
; fb877

View File

@ -107,8 +107,7 @@ channel_struct: MACRO
ds 1 ; c125
ds 1 ; c126
ds 1 ; c127
\1CryPitch:: db
\1CryEcho:: db
\1CryPitch:: dw
ds 4
\1NoteLength:: db ; frames per 16th note
ds 1 ; c12f
@ -227,9 +226,7 @@ MusicFadeIDHi:: ; c2aa
ds 1
ds 5
CryPitch:: ; c2b0
ds 1
CryEcho:: ; c2b1
ds 1
ds 2
CryLength:: ; c2b2
ds 2
LastVolume:: ; c2b4