mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
Move crysaudio ram from sram to wram
This commit is contained in:
parent
baf447a260
commit
5f87413b23
|
@ -48,6 +48,28 @@ _InitSound::
|
|||
or d
|
||||
jr nz, .clearaudio
|
||||
|
||||
; channels 5 and 6
|
||||
ld hl, wChannel5
|
||||
ld de, CHANNEL_STRUCT_LENGTH * 2
|
||||
.clearaudio2
|
||||
xor a
|
||||
ld [hli], a
|
||||
dec de
|
||||
ld a, e
|
||||
or d
|
||||
jr nz, .clearaudio2
|
||||
|
||||
; channels 7 and 8
|
||||
ld hl, wChannel7
|
||||
ld de, CHANNEL_STRUCT_LENGTH * 2
|
||||
.clearaudio3
|
||||
xor a
|
||||
ld [hli], a
|
||||
dec de
|
||||
ld a, e
|
||||
or d
|
||||
jr nz, .clearaudio3
|
||||
|
||||
ld a, MAX_VOLUME
|
||||
ld [wVolume], a
|
||||
call MusicOn
|
||||
|
@ -81,7 +103,6 @@ MusicOff:
|
|||
ret
|
||||
|
||||
_UpdateSound::
|
||||
call OpenSRAMForSound
|
||||
; called once per frame
|
||||
; no use updating audio if it's not playing
|
||||
ld a, [wMusicPlaying]
|
||||
|
@ -170,8 +191,25 @@ _UpdateSound::
|
|||
ld a, [wCurChannel]
|
||||
cp NUM_MUSIC_CHANS
|
||||
jr nc, .sfx_channel
|
||||
ld hl, CHANNEL_STRUCT_LENGTH * NUM_MUSIC_CHANS + CHANNEL_FLAGS1
|
||||
|
||||
push af
|
||||
push bc
|
||||
add 4 ; corresponding sfx channel
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, ChannelPointers
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
ld c, [hl]
|
||||
inc hl
|
||||
ld b, [hl] ; bc = channel pointer
|
||||
ld hl, CHANNEL_FLAGS1
|
||||
add hl, bc
|
||||
pop bc
|
||||
pop af
|
||||
; ld hl, CHANNEL_STRUCT_LENGTH * NUM_MUSIC_CHANS + CHANNEL_FLAGS1
|
||||
; add hl, bc
|
||||
|
||||
bit SOUND_CHANNEL_ON, [hl]
|
||||
jr nz, .sound_channel_on
|
||||
.sfx_channel
|
||||
|
@ -189,12 +227,22 @@ _UpdateSound::
|
|||
ld [hl], a
|
||||
.nextchannel
|
||||
; next channel
|
||||
ld hl, CHANNEL_STRUCT_LENGTH
|
||||
add hl, bc
|
||||
ld c, l
|
||||
ld b, h
|
||||
; ld hl, CHANNEL_STRUCT_LENGTH
|
||||
; add hl, bc
|
||||
; ld c, l
|
||||
; ld b, h
|
||||
ld a, [wCurChannel]
|
||||
inc a
|
||||
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, ChannelPointers
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
ld c, [hl]
|
||||
inc hl
|
||||
ld b, [hl] ; bc = channel pointer
|
||||
|
||||
ld [wCurChannel], a
|
||||
cp NUM_CHANNELS ; are we done?
|
||||
jp nz, .loop ; do it all again
|
||||
|
@ -1210,8 +1258,25 @@ ParseMusic:
|
|||
cp CHAN5
|
||||
jr nc, .chan_5to8
|
||||
; ????
|
||||
ld hl, CHANNEL_STRUCT_LENGTH * NUM_MUSIC_CHANS + CHANNEL_FLAGS1
|
||||
|
||||
push af
|
||||
push bc
|
||||
add 4 ; corresponding sfx channel
|
||||
ld c, a
|
||||
ld b, 0
|
||||
ld hl, ChannelPointers
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
ld c, [hl]
|
||||
inc hl
|
||||
ld b, [hl] ; bc = channel pointer
|
||||
ld hl, CHANNEL_FLAGS1
|
||||
add hl, bc
|
||||
pop bc
|
||||
pop af
|
||||
; ld hl, CHANNEL_STRUCT_LENGTH * NUM_MUSIC_CHANS + CHANNEL_FLAGS1
|
||||
; add hl, bc
|
||||
|
||||
bit SOUND_CHANNEL_ON, [hl]
|
||||
jr nz, .ok
|
||||
.chan_5to8
|
||||
|
@ -2377,7 +2442,6 @@ SetLRTracks:
|
|||
ret
|
||||
|
||||
_PlayMusic::
|
||||
call OpenSRAMForSound
|
||||
cp NUM_SONGS
|
||||
ret nc ; sfx
|
||||
; load music
|
||||
|
|
|
@ -781,10 +781,10 @@ FaintEnemyPokemon:
|
|||
ld [wTempoModifier], a
|
||||
ld a, SFX_FAINT_FALL
|
||||
call PlaySoundWaitForCurrent
|
||||
.sfxwait
|
||||
ld a, [wChannelSoundIDs + Ch5]
|
||||
cp SFX_FAINT_FALL
|
||||
jr z, .sfxwait
|
||||
;.sfxwait
|
||||
; ld a, [wChannelSoundIDs + Ch5]
|
||||
; cp SFX_FAINT_FALL
|
||||
; jr z, .sfxwait
|
||||
ld a, SFX_FAINT_THUD
|
||||
call PlaySound
|
||||
call WaitForSoundToFinish
|
||||
|
@ -866,7 +866,7 @@ EndLowHealthAlarm:
|
|||
; the low health alarm and prevents it from reactivating until the next battle.
|
||||
xor a
|
||||
ld [wLowHealthAlarm], a ; turn off low health alarm
|
||||
ld [wChannelSoundIDs + Ch5], a
|
||||
; ld [wChannelSoundIDs + Ch5], a
|
||||
inc a
|
||||
ld [wLowHealthAlarmDisabled], a ; prevent it from reactivating
|
||||
ret
|
||||
|
@ -1864,7 +1864,7 @@ DrawPlayerHUDAndHPBar:
|
|||
ld [hl], $0
|
||||
ret z
|
||||
xor a
|
||||
ld [wChannelSoundIDs + Ch5], a
|
||||
; ld [wChannelSoundIDs + Ch5], a
|
||||
ret
|
||||
.setLowHealthAlarm
|
||||
ld hl, wLowHealthAlarm
|
||||
|
|
|
@ -46,7 +46,7 @@ EndOfBattle:
|
|||
.resetVariables
|
||||
xor a
|
||||
ld [wLowHealthAlarm], a ;disable low health alarm
|
||||
ld [wChannelSoundIDs + Ch5], a
|
||||
; ld [wChannelSoundIDs + Ch5], a
|
||||
ld [wIsInBattle], a
|
||||
ld [wBattleType], a
|
||||
ld [wMoveMissed], a
|
||||
|
|
|
@ -991,7 +991,7 @@ ItemUseMedicine:
|
|||
.notFullHP ; if the pokemon's current HP doesn't equal its max HP
|
||||
xor a
|
||||
ld [wLowHealthAlarm], a ;disable low health alarm
|
||||
ld [wChannelSoundIDs + Ch5], a
|
||||
; ld [wChannelSoundIDs + Ch5], a
|
||||
push hl
|
||||
push de
|
||||
ld bc, wPartyMon1MaxHP - (wPartyMon1HP + 1)
|
||||
|
@ -1736,10 +1736,10 @@ ItemUsePokeflute:
|
|||
jr nz, .skipMusic
|
||||
call WaitForSoundToFinish ; wait for sound to end
|
||||
;farcall Music_PokeFluteInBattle ; play in-battle pokeflute music ; XXX
|
||||
.musicWaitLoop ; wait for music to finish playing
|
||||
ld a, [wChannelSoundIDs + Ch7]
|
||||
and a ; music off?
|
||||
jr nz, .musicWaitLoop
|
||||
;.musicWaitLoop ; wait for music to finish playing
|
||||
; ld a, [wChannelSoundIDs + Ch7]
|
||||
; and a ; music off?
|
||||
; jr nz, .musicWaitLoop
|
||||
.skipMusic
|
||||
ld hl, FluteWokeUpText
|
||||
jp PrintText
|
||||
|
|
|
@ -4,10 +4,6 @@ LoadSAV:
|
|||
call ClearScreen
|
||||
call LoadFontTilePatterns
|
||||
call LoadTextBoxTilePatterns
|
||||
|
||||
ld a, 1
|
||||
ld [wHaltAudio], a
|
||||
|
||||
call LoadSAV0
|
||||
jr c, .badsum
|
||||
call LoadSAV1
|
||||
|
@ -29,9 +25,6 @@ LoadSAV:
|
|||
ld a, $1 ; bad checksum
|
||||
.goodsum
|
||||
ld [wSaveFileStatus], a
|
||||
|
||||
ld a, 0
|
||||
ld [wHaltAudio], a
|
||||
ret
|
||||
|
||||
FileDataDestroyedText:
|
||||
|
@ -281,18 +274,9 @@ SaveSAVtoSRAM2:
|
|||
SaveSAVtoSRAM::
|
||||
ld a, $2
|
||||
ld [wSaveFileStatus], a
|
||||
|
||||
ld a, 1
|
||||
ld [wHaltAudio], a
|
||||
|
||||
call SaveSAVtoSRAM0
|
||||
call SaveSAVtoSRAM1
|
||||
call SaveSAVtoSRAM2
|
||||
|
||||
ld a, 0
|
||||
ld [wHaltAudio], a
|
||||
|
||||
ret
|
||||
jp SaveSAVtoSRAM2
|
||||
|
||||
SAVCheckSum:
|
||||
;Check Sum (result[1 byte] is complemented)
|
||||
|
@ -407,9 +391,6 @@ WhenYouChangeBoxText:
|
|||
|
||||
CopyBoxToOrFromSRAM:
|
||||
; copy an entire box from hl to de with b as the SRAM bank
|
||||
ld a, 1
|
||||
ld [wHaltAudio], a
|
||||
|
||||
push hl
|
||||
ld a, SRAM_ENABLE
|
||||
ld [MBC1SRamEnable], a
|
||||
|
@ -435,9 +416,6 @@ CopyBoxToOrFromSRAM:
|
|||
xor a
|
||||
ld [MBC1SRamBankingMode], a
|
||||
ld [MBC1SRamEnable], a
|
||||
|
||||
xor a
|
||||
ld [wHaltAudio], a
|
||||
ret
|
||||
|
||||
DisplayChangeBoxMenu:
|
||||
|
@ -535,9 +513,6 @@ BoxNoText:
|
|||
EmptyAllSRAMBoxes:
|
||||
; marks all boxes in SRAM as empty (initialisation for the first time the
|
||||
; player changes the box)
|
||||
ld a, 1
|
||||
ld [wHaltAudio], a
|
||||
|
||||
ld a, SRAM_ENABLE
|
||||
ld [MBC1SRamEnable], a
|
||||
ld a, $1
|
||||
|
@ -551,9 +526,6 @@ EmptyAllSRAMBoxes:
|
|||
xor a
|
||||
ld [MBC1SRamBankingMode], a
|
||||
ld [MBC1SRamEnable], a
|
||||
|
||||
xor a
|
||||
ld [wHaltAudio], a
|
||||
ret
|
||||
|
||||
EmptySRAMBoxesInBank:
|
||||
|
@ -585,9 +557,6 @@ EmptySRAMBox:
|
|||
ret
|
||||
|
||||
GetMonCountsForAllBoxes:
|
||||
ld a, 1
|
||||
ld [wHaltAudio], a
|
||||
|
||||
ld hl, wBoxMonCounts
|
||||
push hl
|
||||
ld a, SRAM_ENABLE
|
||||
|
@ -614,8 +583,6 @@ GetMonCountsForAllBoxes:
|
|||
ld a, [wNumInBox]
|
||||
ld [hl], a
|
||||
|
||||
xor a
|
||||
ld [wHaltAudio], a
|
||||
ret
|
||||
|
||||
GetMonCountsForBoxesInBank:
|
||||
|
@ -637,9 +604,6 @@ SAVCheckRandomID:
|
|||
; checks if Sav file is the same by checking player's name 1st letter
|
||||
; and the two random numbers generated at game beginning
|
||||
; (which are stored at wPlayerID)s
|
||||
ld a, 1
|
||||
ld [wHaltAudio], a
|
||||
|
||||
ld a, $0a
|
||||
ld [MBC1SRamEnable], a
|
||||
ld a, $01
|
||||
|
@ -668,9 +632,6 @@ SAVCheckRandomID:
|
|||
ld a, $00
|
||||
ld [MBC1SRamBankingMode], a
|
||||
ld [MBC1SRamEnable], a
|
||||
|
||||
xor a
|
||||
ld [wHaltAudio], a
|
||||
ret
|
||||
|
||||
SaveHallOfFameTeams:
|
||||
|
@ -709,9 +670,6 @@ LoadHallOfFameTeams:
|
|||
; fallthrough
|
||||
|
||||
HallOfFame_Copy:
|
||||
ld a, 1
|
||||
ld [wHaltAudio], a
|
||||
|
||||
ld a, SRAM_ENABLE
|
||||
ld [MBC1SRamEnable], a
|
||||
ld a, $1
|
||||
|
@ -722,15 +680,9 @@ HallOfFame_Copy:
|
|||
xor a
|
||||
ld [MBC1SRamBankingMode], a
|
||||
ld [MBC1SRamEnable], a
|
||||
|
||||
xor a
|
||||
ld [wHaltAudio], a
|
||||
ret
|
||||
|
||||
ClearSAV:
|
||||
ld a, 1
|
||||
ld [wHaltAudio], a
|
||||
|
||||
ld a, SRAM_ENABLE
|
||||
ld [MBC1SRamEnable], a
|
||||
ld a, $1
|
||||
|
@ -746,9 +698,6 @@ ClearSAV:
|
|||
xor a
|
||||
ld [MBC1SRamBankingMode], a
|
||||
ld [MBC1SRamEnable], a
|
||||
|
||||
xor a
|
||||
ld [wHaltAudio], a
|
||||
ret
|
||||
|
||||
PadSRAM_FF:
|
||||
|
|
|
@ -8,7 +8,7 @@ EvolveMon:
|
|||
push af
|
||||
xor a
|
||||
ld [wLowHealthAlarm], a
|
||||
ld [wChannelSoundIDs + Ch5], a
|
||||
; ld [wChannelSoundIDs + Ch5], a
|
||||
dec a ; SFX_STOP_ALL_MUSIC
|
||||
ld [wNewSoundID], a
|
||||
call PlaySound
|
||||
|
|
|
@ -32,10 +32,10 @@ ShakeElevator::
|
|||
ld c, 0 ; BANK(SFX_Safari_Zone_PA)
|
||||
ld a, SFX_SAFARI_ZONE_PA
|
||||
call PlaySound
|
||||
.musicLoop
|
||||
ld a, [wChannelSoundIDs + Ch5]
|
||||
cp SFX_SAFARI_ZONE_PA
|
||||
jr z, .musicLoop
|
||||
;.musicLoop
|
||||
; ld a, [wChannelSoundIDs + Ch5]
|
||||
; cp SFX_SAFARI_ZONE_PA
|
||||
; jr z, .musicLoop
|
||||
call UpdateSprites
|
||||
jp PlayDefaultMusic
|
||||
|
||||
|
|
|
@ -411,7 +411,7 @@ SlotMachine_CheckForMatches:
|
|||
call PrintText
|
||||
.done
|
||||
xor a
|
||||
ld [wMuteAudioAndPauseMusic], a
|
||||
; ld [wMuteAudioAndPauseMusic], a
|
||||
ret
|
||||
.rollWheel3DownByOneSymbol
|
||||
call SlotMachine_AnimWheel3
|
||||
|
@ -655,7 +655,7 @@ SlotMachine_PrintPayoutCoins:
|
|||
|
||||
SlotMachine_PayCoinsToPlayer:
|
||||
ld a, $1
|
||||
ld [wMuteAudioAndPauseMusic], a
|
||||
; ld [wMuteAudioAndPauseMusic], a
|
||||
call WaitForSoundToFinish
|
||||
|
||||
; Put 1 in the temp coins variable. This value is added to the player's coins
|
||||
|
|
|
@ -92,22 +92,12 @@ PlaySound::
|
|||
pop de
|
||||
ret
|
||||
|
||||
OpenSRAMForSound::
|
||||
ld a, SRAM_ENABLE
|
||||
ld [MBC1SRamEnable], a
|
||||
xor a
|
||||
ld [MBC1SRamBankingMode], a
|
||||
ld [MBC1SRamBank], a
|
||||
ret
|
||||
|
||||
;InitSound::
|
||||
; push hl
|
||||
; push de
|
||||
; push bc
|
||||
; push af
|
||||
;
|
||||
; call OpenSRAMForSound
|
||||
;
|
||||
; ldh a, [hLoadedROMBank]
|
||||
; push af
|
||||
; ld a, BANK(_InitSound)
|
||||
|
@ -132,10 +122,6 @@ UpdateSound::
|
|||
; push bc
|
||||
; push af
|
||||
|
||||
ld a, [wHaltAudio]
|
||||
and a
|
||||
ret nz
|
||||
|
||||
ldh a, [hLoadedROMBank]
|
||||
push af
|
||||
ld a, BANK(_UpdateSound)
|
||||
|
|
|
@ -126,8 +126,6 @@ ClearVram::
|
|||
|
||||
|
||||
StopAllSounds::
|
||||
call OpenSRAMForSound
|
||||
|
||||
ld a, 0 ; BANK("Audio Engine 1")
|
||||
ld [wAudioROMBank], a
|
||||
ld [wAudioSavedROMBank], a
|
||||
|
|
|
@ -95,3 +95,47 @@ spritestatedata2: MACRO
|
|||
ds 1
|
||||
\1End::
|
||||
ENDM
|
||||
|
||||
channel_struct: MACRO
|
||||
\1MusicID:: dw
|
||||
\1MusicBank:: db
|
||||
\1Flags1:: db ; 0:on/off 1:subroutine 2:looping 3:sfx 4:noise 5:rest
|
||||
\1Flags2:: db ; 0:vibrato on/off 1:pitch slide 2:duty cycle pattern 4:pitch offset
|
||||
\1Flags3:: db ; 0:vibrato up/down 1:pitch slide direction
|
||||
\1MusicAddress:: dw
|
||||
\1LastMusicAddress:: dw
|
||||
dw
|
||||
\1NoteFlags:: db ; 5:rest
|
||||
\1Condition:: db ; conditional jumps
|
||||
\1DutyCycle:: db ; bits 6-7 (0:12.5% 1:25% 2:50% 3:75%)
|
||||
\1VolumeEnvelope:: db ; hi:volume lo:fade
|
||||
\1Frequency:: dw ; 11 bits
|
||||
\1Pitch:: db ; 0:rest 1-c:note
|
||||
\1Octave:: db ; 7-0 (0 is highest)
|
||||
\1Transposition:: db ; raises existing octaves (to repeat phrases)
|
||||
\1NoteDuration:: db ; frames remaining for the current note
|
||||
\1Field16:: ds 1
|
||||
ds 1
|
||||
\1LoopCount:: db
|
||||
\1Tempo:: dw
|
||||
\1Tracks:: db ; hi:left lo:right
|
||||
\1DutyCyclePattern:: db
|
||||
\1VibratoDelayCount:: db ; initialized by \1VibratoDelay
|
||||
\1VibratoDelay:: db ; number of frames a note plays until vibrato starts
|
||||
\1VibratoExtent:: db
|
||||
\1VibratoRate:: db ; hi:frames for each alt lo:frames to the next alt
|
||||
\1PitchSlideTarget:: dw ; frequency endpoint for pitch slide
|
||||
\1PitchSlideAmount:: db
|
||||
\1PitchSlideAmountFraction:: db
|
||||
\1Field25:: db
|
||||
ds 1
|
||||
\1PitchOffset:: dw
|
||||
\1Field29:: ds 1
|
||||
\1Field2a:: ds 2
|
||||
\1Field2c:: ds 1
|
||||
\1NoteLength:: db ; frames per 16th note
|
||||
\1Field2e:: ds 1
|
||||
\1Field2f:: ds 1
|
||||
\1Field30:: ds 1
|
||||
ds 1
|
||||
ENDM
|
||||
|
|
401
wram.asm
401
wram.asm
|
@ -8,130 +8,6 @@ INCLUDE "vram.asm"
|
|||
|
||||
SECTION "WRAM", WRAM0
|
||||
|
||||
wUnusedC000::
|
||||
ds 1
|
||||
|
||||
wSoundID::
|
||||
ds 1
|
||||
|
||||
wMuteAudioAndPauseMusic::
|
||||
; bit 7: whether sound has been muted
|
||||
; all bits: whether the effective is active
|
||||
; Store 1 to activate effect (any value in the range [1, 127] works).
|
||||
; All audio is muted and music is paused. Sfx continues playing until it
|
||||
; ends normally.
|
||||
; Store 0 to resume music.
|
||||
ds 1
|
||||
|
||||
wDisableChannelOutputWhenSfxEnds::
|
||||
ds 1
|
||||
|
||||
wStereoPanning::
|
||||
ds 1
|
||||
|
||||
wSavedVolume::
|
||||
ds 1
|
||||
|
||||
wChannelCommandPointers::
|
||||
ds 16
|
||||
|
||||
wChannelReturnAddresses::
|
||||
ds 16
|
||||
|
||||
wChannelSoundIDs::
|
||||
ds 8
|
||||
|
||||
wChannelFlags1::
|
||||
ds 8
|
||||
|
||||
wChannelFlags2::
|
||||
ds 8
|
||||
|
||||
wChannelDutyCycles::
|
||||
ds 8
|
||||
|
||||
wChannelDutyCyclePatterns::
|
||||
ds 8
|
||||
|
||||
wChannelVibratoDelayCounters::
|
||||
; reloaded at the beginning of a note. counts down until the vibrato begins.
|
||||
ds 8
|
||||
|
||||
wChannelVibratoExtents::
|
||||
ds 8
|
||||
|
||||
wChannelVibratoRates::
|
||||
; high nybble is rate (counter reload value) and low nybble is counter.
|
||||
; time between applications of vibrato.
|
||||
ds 8
|
||||
|
||||
wChannelFrequencyLowBytes::
|
||||
ds 8
|
||||
|
||||
wChannelVibratoDelayCounterReloadValues::
|
||||
; delay of the beginning of the vibrato from the start of the note
|
||||
ds 8
|
||||
|
||||
wChannelPitchSlideLengthModifiers::
|
||||
ds 8
|
||||
|
||||
wChannelPitchSlideFrequencySteps::
|
||||
ds 8
|
||||
|
||||
wChannelPitchSlideFrequencyStepsFractionalPart::
|
||||
ds 8
|
||||
|
||||
wChannelPitchSlideCurrentFrequencyFractionalPart::
|
||||
ds 8
|
||||
|
||||
wChannelPitchSlideCurrentFrequencyHighBytes::
|
||||
ds 8
|
||||
|
||||
wChannelPitchSlideCurrentFrequencyLowBytes::
|
||||
ds 8
|
||||
|
||||
wChannelPitchSlideTargetFrequencyHighBytes::
|
||||
ds 8
|
||||
|
||||
wChannelPitchSlideTargetFrequencyLowBytes::
|
||||
ds 8
|
||||
|
||||
wChannelNoteDelayCounters::
|
||||
; Note delays are stored as 16-bit fixed-point numbers where the integer part
|
||||
; is 8 bits and the fractional part is 8 bits.
|
||||
ds 8
|
||||
|
||||
wChannelLoopCounters::
|
||||
ds 8
|
||||
|
||||
wChannelNoteSpeeds::
|
||||
ds 8
|
||||
|
||||
wChannelNoteDelayCountersFractionalPart::
|
||||
ds 8
|
||||
|
||||
wChannelOctaves::
|
||||
ds 8
|
||||
|
||||
wChannelVolumes::
|
||||
; also includes fade for hardware channels that support it
|
||||
ds 8
|
||||
|
||||
wMusicWaveInstrument::
|
||||
ds 1
|
||||
|
||||
wSfxWaveInstrument::
|
||||
ds 1
|
||||
|
||||
wMusicTempo::
|
||||
ds 2
|
||||
|
||||
wSfxTempo::
|
||||
ds 2
|
||||
|
||||
wSfxHeaderPointer::
|
||||
ds 2
|
||||
|
||||
wNewSoundID::
|
||||
ds 1
|
||||
|
||||
|
@ -147,11 +23,112 @@ wFrequencyModifier::
|
|||
wTempoModifier::
|
||||
ds 1
|
||||
|
||||
ds 11
|
||||
|
||||
wHaltAudio:: ds 1
|
||||
wSFXDontWait:: ds 1
|
||||
|
||||
wMusic::
|
||||
|
||||
; nonzero if playing
|
||||
wMusicPlaying:: db
|
||||
|
||||
wAudio::
|
||||
wChannel1:: channel_struct wChannel1
|
||||
wChannel2:: channel_struct wChannel2
|
||||
wChannel3:: channel_struct wChannel3
|
||||
wChannel4:: channel_struct wChannel4
|
||||
|
||||
ds 1
|
||||
|
||||
wCurTrackDuty:: db
|
||||
wCurTrackVolumeEnvelope:: db
|
||||
wCurTrackFrequency:: dw
|
||||
wUnusedBCDNumber:: db ; BCD value, dummied out
|
||||
wCurNoteDuration:: db ; used in MusicE0 and LoadNote
|
||||
|
||||
wCurMusicByte:: db
|
||||
wCurChannel:: db
|
||||
wVolume::
|
||||
; corresponds to rNR50
|
||||
; Channel control / ON-OFF / Volume (R/W)
|
||||
; bit 7 - Vin->SO2 ON/OFF
|
||||
; bit 6-4 - SO2 output level (volume) (# 0-7)
|
||||
; bit 3 - Vin->SO1 ON/OFF
|
||||
; bit 2-0 - SO1 output level (volume) (# 0-7)
|
||||
db
|
||||
wSoundOutput::
|
||||
; corresponds to rNR51
|
||||
; bit 4-7: ch1-4 so2 on/off
|
||||
; bit 0-3: ch1-4 so1 on/off
|
||||
db
|
||||
wPitchSweep::
|
||||
; corresponds to rNR10
|
||||
; bit 7: unused
|
||||
; bit 4-6: sweep time
|
||||
; bit 3: sweep direction
|
||||
; but 0-2: sweep shift
|
||||
db
|
||||
|
||||
wMusicID:: dw
|
||||
wMusicBank:: db
|
||||
wNoiseSampleAddress:: dw
|
||||
wNoiseSampleDelay:: db
|
||||
ds 1
|
||||
wMusicNoiseSampleSet:: db
|
||||
wSFXNoiseSampleSet:: db
|
||||
|
||||
wLowHealthAlarm::
|
||||
; bit 7: on/off
|
||||
; bit 4: pitch
|
||||
; bit 0-3: counter
|
||||
db
|
||||
|
||||
wMusicFade::
|
||||
; fades volume over x frames
|
||||
; bit 7: fade in/out
|
||||
; bit 0-5: number of frames for each volume level
|
||||
; $00 = none (default)
|
||||
db
|
||||
wMusicFadeCount:: db
|
||||
wMusicFadeID:: dw
|
||||
|
||||
ds 5
|
||||
|
||||
wCryPitch:: dw
|
||||
wCryLength:: dw
|
||||
|
||||
wLastVolume:: db
|
||||
wUnusedMusicF9Flag:: db
|
||||
|
||||
wSFXPriority::
|
||||
; if nonzero, turn off music when playing sfx
|
||||
db
|
||||
|
||||
ds 1
|
||||
|
||||
wChannel1JumpCondition:: db
|
||||
wChannel2JumpCondition:: db
|
||||
wChannel3JumpCondition:: db
|
||||
wChannel4JumpCondition:: db
|
||||
|
||||
wStereoPanningMask:: db
|
||||
|
||||
wCryTracks::
|
||||
; plays only in left or right track depending on what side the monster is on
|
||||
; both tracks active outside of battle
|
||||
db
|
||||
|
||||
wSFXDuration:: db
|
||||
wCurSFX::
|
||||
; id of sfx currently playing
|
||||
db
|
||||
|
||||
wAudioEnd::
|
||||
|
||||
wMapMusic:: db
|
||||
|
||||
;wDontPlayMapMusicOnReload:: db
|
||||
wMusicEnd::
|
||||
|
||||
|
||||
SECTION "Sprite State Data", WRAM0
|
||||
|
||||
wSpriteDataStart::
|
||||
|
@ -2485,7 +2462,12 @@ wDestinationWarpID::
|
|||
; if $ff, the player's coordinates are not updated when entering the map
|
||||
ds 1
|
||||
|
||||
UNION
|
||||
ds 128
|
||||
NEXTU
|
||||
wChannel5:: channel_struct wChannel5
|
||||
wChannel6:: channel_struct wChannel6
|
||||
ENDU
|
||||
|
||||
wNumSigns::
|
||||
; number of signs in the current map (up to 16)
|
||||
|
@ -2609,7 +2591,7 @@ wMissableObjectList::
|
|||
ds 17 * 2
|
||||
|
||||
wGameProgressFlags::
|
||||
; $c8 bytes
|
||||
; $80 bytes
|
||||
wOaksLabCurScript::
|
||||
ds 1
|
||||
wPalletTownCurScript::
|
||||
|
@ -2819,10 +2801,15 @@ wSeafoamIslandsB4FCurScript::
|
|||
wRoute18Gate1FCurScript::
|
||||
ds 1
|
||||
|
||||
ds 78
|
||||
ds 6
|
||||
wGameProgressFlagsEnd::
|
||||
|
||||
ds 56
|
||||
UNION
|
||||
ds 128
|
||||
NEXTU
|
||||
wChannel7:: channel_struct wChannel7
|
||||
wChannel8:: channel_struct wChannel8
|
||||
ENDU
|
||||
|
||||
wObtainedHiddenItemsFlags::
|
||||
ds 14
|
||||
|
@ -3152,157 +3139,3 @@ wStack::
|
|||
INCLUDE "sram.asm"
|
||||
|
||||
INCLUDE "hram.asm"
|
||||
|
||||
|
||||
SECTION "crysaudio", SRAM, BANK[0]
|
||||
|
||||
channel_struct: MACRO
|
||||
\1MusicID:: dw
|
||||
\1MusicBank:: db
|
||||
\1Flags1:: db ; 0:on/off 1:subroutine 2:looping 3:sfx 4:noise 5:rest
|
||||
\1Flags2:: db ; 0:vibrato on/off 1:pitch slide 2:duty cycle pattern 4:pitch offset
|
||||
\1Flags3:: db ; 0:vibrato up/down 1:pitch slide direction
|
||||
\1MusicAddress:: dw
|
||||
\1LastMusicAddress:: dw
|
||||
dw
|
||||
\1NoteFlags:: db ; 5:rest
|
||||
\1Condition:: db ; conditional jumps
|
||||
\1DutyCycle:: db ; bits 6-7 (0:12.5% 1:25% 2:50% 3:75%)
|
||||
\1VolumeEnvelope:: db ; hi:volume lo:fade
|
||||
\1Frequency:: dw ; 11 bits
|
||||
\1Pitch:: db ; 0:rest 1-c:note
|
||||
\1Octave:: db ; 7-0 (0 is highest)
|
||||
\1Transposition:: db ; raises existing octaves (to repeat phrases)
|
||||
\1NoteDuration:: db ; frames remaining for the current note
|
||||
\1Field16:: ds 1
|
||||
ds 1
|
||||
\1LoopCount:: db
|
||||
\1Tempo:: dw
|
||||
\1Tracks:: db ; hi:left lo:right
|
||||
\1DutyCyclePattern:: db
|
||||
\1VibratoDelayCount:: db ; initialized by \1VibratoDelay
|
||||
\1VibratoDelay:: db ; number of frames a note plays until vibrato starts
|
||||
\1VibratoExtent:: db
|
||||
\1VibratoRate:: db ; hi:frames for each alt lo:frames to the next alt
|
||||
\1PitchSlideTarget:: dw ; frequency endpoint for pitch slide
|
||||
\1PitchSlideAmount:: db
|
||||
\1PitchSlideAmountFraction:: db
|
||||
\1Field25:: db
|
||||
ds 1
|
||||
\1PitchOffset:: dw
|
||||
\1Field29:: ds 1
|
||||
\1Field2a:: ds 2
|
||||
\1Field2c:: ds 1
|
||||
\1NoteLength:: db ; frames per 16th note
|
||||
\1Field2e:: ds 1
|
||||
\1Field2f:: ds 1
|
||||
\1Field30:: ds 1
|
||||
ds 1
|
||||
ENDM
|
||||
|
||||
wMusic::
|
||||
|
||||
; nonzero if playing
|
||||
wMusicPlaying:: db
|
||||
|
||||
wAudio::
|
||||
wChannel1:: channel_struct wChannel1
|
||||
wChannel2:: channel_struct wChannel2
|
||||
wChannel3:: channel_struct wChannel3
|
||||
wChannel4:: channel_struct wChannel4
|
||||
wChannel5:: channel_struct wChannel5
|
||||
wChannel6:: channel_struct wChannel6
|
||||
wChannel7:: channel_struct wChannel7
|
||||
wChannel8:: channel_struct wChannel8
|
||||
|
||||
ds 1
|
||||
|
||||
wCurTrackDuty:: db
|
||||
wCurTrackVolumeEnvelope:: db
|
||||
wCurTrackFrequency:: dw
|
||||
wUnusedBCDNumber:: db ; BCD value, dummied out
|
||||
wCurNoteDuration:: db ; used in MusicE0 and LoadNote
|
||||
|
||||
wCurMusicByte:: db
|
||||
wCurChannel:: db
|
||||
wVolume::
|
||||
; corresponds to rNR50
|
||||
; Channel control / ON-OFF / Volume (R/W)
|
||||
; bit 7 - Vin->SO2 ON/OFF
|
||||
; bit 6-4 - SO2 output level (volume) (# 0-7)
|
||||
; bit 3 - Vin->SO1 ON/OFF
|
||||
; bit 2-0 - SO1 output level (volume) (# 0-7)
|
||||
db
|
||||
wSoundOutput::
|
||||
; corresponds to rNR51
|
||||
; bit 4-7: ch1-4 so2 on/off
|
||||
; bit 0-3: ch1-4 so1 on/off
|
||||
db
|
||||
wPitchSweep::
|
||||
; corresponds to rNR10
|
||||
; bit 7: unused
|
||||
; bit 4-6: sweep time
|
||||
; bit 3: sweep direction
|
||||
; but 0-2: sweep shift
|
||||
db
|
||||
|
||||
wMusicID:: dw
|
||||
wMusicBank:: db
|
||||
wNoiseSampleAddress:: dw
|
||||
wNoiseSampleDelay:: db
|
||||
ds 1
|
||||
wMusicNoiseSampleSet:: db
|
||||
wSFXNoiseSampleSet:: db
|
||||
|
||||
wLowHealthAlarm::
|
||||
; bit 7: on/off
|
||||
; bit 4: pitch
|
||||
; bit 0-3: counter
|
||||
db
|
||||
|
||||
wMusicFade::
|
||||
; fades volume over x frames
|
||||
; bit 7: fade in/out
|
||||
; bit 0-5: number of frames for each volume level
|
||||
; $00 = none (default)
|
||||
db
|
||||
wMusicFadeCount:: db
|
||||
wMusicFadeID:: dw
|
||||
|
||||
ds 5
|
||||
|
||||
wCryPitch:: dw
|
||||
wCryLength:: dw
|
||||
|
||||
wLastVolume:: db
|
||||
wUnusedMusicF9Flag:: db
|
||||
|
||||
wSFXPriority::
|
||||
; if nonzero, turn off music when playing sfx
|
||||
db
|
||||
|
||||
ds 1
|
||||
|
||||
wChannel1JumpCondition:: db
|
||||
wChannel2JumpCondition:: db
|
||||
wChannel3JumpCondition:: db
|
||||
wChannel4JumpCondition:: db
|
||||
|
||||
wStereoPanningMask:: db
|
||||
|
||||
wCryTracks::
|
||||
; plays only in left or right track depending on what side the monster is on
|
||||
; both tracks active outside of battle
|
||||
db
|
||||
|
||||
wSFXDuration:: db
|
||||
wCurSFX::
|
||||
; id of sfx currently playing
|
||||
db
|
||||
|
||||
wAudioEnd::
|
||||
|
||||
wMapMusic:: db
|
||||
|
||||
;wDontPlayMapMusicOnReload:: db
|
||||
wMusicEnd::
|
||||
|
|
Loading…
Reference in a new issue