More constants

This commit is contained in:
Remy Oukaour 2017-12-09 13:28:23 -05:00
parent 55d19b6dca
commit 0b7d8d44ad
7 changed files with 128 additions and 112 deletions

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
@ -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
@ -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
@ -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
@ -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
@ -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
@ -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

@ -1,60 +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
SOUND_VIBRATO EQU 0 const_def
SOUND_PITCH_WHEEL EQU 1 const SOUND_VIBRATO ; 0
SOUND_DUTY EQU 2 const SOUND_PITCH_WHEEL ; 1
SOUND_UNKN_0B EQU 3 const SOUND_DUTY ; 2
SOUND_CRY_PITCH EQU 4 const SOUND_UNKN_0B ; 3
SOUND_UNKN_0D EQU 5 const SOUND_CRY_PITCH ; 4
SOUND_UNKN_0E EQU 6 const SOUND_UNKN_0D ; 5
SOUND_UNKN_0F EQU 7 const SOUND_UNKN_0E ; 6
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

@ -264,6 +264,7 @@ NUM_HMS = const_value - HM01
add_mt FLAMETHROWER add_mt FLAMETHROWER
add_mt THUNDERBOLT add_mt THUNDERBOLT
add_mt ICE_BEAM add_mt ICE_BEAM
NUM_TM_HM_TUTOR = __enum__ +- 1
ITEM_FROM_MEM EQU $FF ITEM_FROM_MEM EQU $FF

View File

@ -1,22 +1,26 @@
; MonType: ; cf5f ; MonType: ; cf5f
PARTYMON EQU 0 const_def
OTPARTYMON EQU 1 const PARTYMON ; 0
BOXMON EQU 2 const OTPARTYMON ; 1
TEMPMON EQU 3 const BOXMON ; 2
WILDMON EQU 4 const TEMPMON ; 3
const WILDMON ; 4
; Options: ; cfcc ; Options: (bits) ; cfcc
const_value SET 5
const STEREO ; 5
const BATTLE_SHIFT ; 6
const BATTLE_SCENE ; 7
; Options: (bits 0-2 values) ; cfcc
FAST_TEXT EQU 0 FAST_TEXT EQU 0
MED_TEXT EQU 1 MED_TEXT EQU 1
SLOW_TEXT EQU 2 SLOW_TEXT EQU 2
NO_TEXT_SCROLL EQU 4 NO_TEXT_SCROLL EQU 4
; bits
STEREO EQU 5
BATTLE_SHIFT EQU 6
BATTLE_SCENE EQU 7
; Options2: ; Options2:
MENU_ACCOUNT EQU 0 const_def
const MENU_ACCOUNT ; 0
; GBPrinter: ; GBPrinter:
PRINT_LIGHTEST EQU $00 PRINT_LIGHTEST EQU $00
@ -26,11 +30,12 @@ PRINT_DARKER EQU $60
PRINT_DARKEST EQU $7f PRINT_DARKEST EQU $7f
; WalkingDirection: ; d043 ; WalkingDirection: ; d043
STANDING EQU -1 const_value SET -1
DOWN EQU 0 const STANDING ; -1
UP EQU 1 const DOWN ; 0
LEFT EQU 2 const UP ; 1
RIGHT EQU 3 const LEFT ; 2
const RIGHT ; 3
; FacingDirection: ; d044 ; FacingDirection: ; d044
FACE_CURRENT EQU 0 FACE_CURRENT EQU 0
@ -40,10 +45,11 @@ FACE_LEFT EQU 2
FACE_RIGHT EQU 1 FACE_RIGHT EQU 1
; TimeOfDay: ; d269 ; TimeOfDay: ; d269
MORN EQU 0 const_def
DAY EQU 1 const MORN ; 0
NITE EQU 2 const DAY ; 1
DARKNESS EQU 3 const NITE ; 2
const DARKNESS ; 3
; ScriptFlags: ; d434 ; ScriptFlags: ; d434
SCRIPT_RUNNING EQU 2 SCRIPT_RUNNING EQU 2
@ -55,13 +61,14 @@ SCRIPT_WAIT_MOVEMENT EQU 2
SCRIPT_WAIT EQU 3 SCRIPT_WAIT EQU 3
; CurDay: ; d4cb ; CurDay: ; d4cb
SUNDAY EQU 0 const_def
MONDAY EQU 1 const SUNDAY ; 0
TUESDAY EQU 2 const MONDAY ; 1
WEDNESDAY EQU 3 const TUESDAY ; 2
THURSDAY EQU 4 const WEDNESDAY ; 3
FRIDAY EQU 5 const THURSDAY ; 4
SATURDAY EQU 6 const FRIDAY ; 5
const SATURDAY ; 6
; MapObjects: ; d71e ; MapObjects: ; d71e

View File

@ -295,7 +295,7 @@ IsSFXPlaying:: ; 3c74
; 3c97 ; 3c97
MaxVolume:: ; 3c97 MaxVolume:: ; 3c97
ld a, $77 ; max ld a, MAX_VOLUME
ld [Volume], a ld [Volume], a
ret ret
; 3c9d ; 3c9d

View File

@ -29,38 +29,37 @@ add_mt: MACRO
enum \1_TMNUM enum \1_TMNUM
ENDM ENDM
; N TMs/HMs need (N+7)/8 bytes for their bit flags.
; The rgbasm integers tms1, tms2, tms3 each hold 3 bytes, or 24 bits.
tmhm: MACRO tmhm: MACRO
x = 0 tms1 = 0
y = 0 tms2 = 0
w = 0 tms3 = 0
rept _NARG rept _NARG
if def(\1_TMNUM) if def(\1_TMNUM)
if \1_TMNUM < 25 if \1_TMNUM < 24 + 1
x = x | (1 << ((\1_TMNUM) - 1)) tms1 = tms1 | (1 << ((\1_TMNUM) - 1))
elif \1_TMNUM < 48 + 1
tms2 = tms2 | (1 << ((\1_TMNUM) - 1 - 24))
else else
if \1_TMNUM < 49 tms3 = tms3 | (1 << ((\1_TMNUM) - 1 - 48))
y = y | (1 << ((\1_TMNUM) - 1 - 24))
else
w = w | (1 << ((\1_TMNUM) - 1 - 48))
endc
endc endc
else else
fail "\1 is not a TM, HM, or move tutor move" fail "\1 is not a TM, HM, or move tutor move"
endc endc
shift shift
endr endr
rept 3 rept 3
db x & $ff db tms1 & $ff
x = x >> 8 tms1 = tms1 >> 8
endr endr
rept 3 rept 3
db y & $ff db tms2 & $ff
y = y >> 8 tms2 = tms2 >> 8
endr endr
rept 2 rept 2
db w & $ff db tms3 & $ff
w = w >> 8 tms3 = tms3 >> 8
endr endr
ENDM ENDM

View File

@ -2212,7 +2212,7 @@ BaseGrowthRate:: ; d24c
BaseEggGroups:: ; d24d BaseEggGroups:: ; d24d
ds 1 ds 1
BaseTMHM:: ; d24e BaseTMHM:: ; d24e
ds 8 flag_array NUM_TM_HM_TUTOR
CurDamage:: ; d256 CurDamage:: ; d256