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 hl, rNR10 ; sound channel registers
ld e, $4 ; number of channels
ld e, NUM_MUSIC_CHANS
.clearsound
; sound channel 1 2 3 4
xor a
@ -47,7 +47,7 @@ _MapSetup_Sound_Off:: ; e8000
ld a, e
or d
jr nz, .clearchannels
ld a, $77 ; max
ld a, MAX_VOLUME
ld [Volume], a
call MusicOn
pop af
@ -151,7 +151,7 @@ _UpdateSound:: ; e805c
jr z, .next
; are we in a sfx channel right now?
ld a, [CurChannel]
cp $4
cp CHAN5
jr nc, .next
; are any sfx channels active?
; if so, mute
@ -174,7 +174,7 @@ _UpdateSound:: ; e805c
.next
; are we in a sfx channel right now?
ld a, [CurChannel]
cp $4 ; sfx
cp CHAN5
jr nc, .sfx_channel
ld hl, Channel5Flags - Channel1
add hl, bc
@ -1223,7 +1223,7 @@ ParseMusic: ; e85e1
bit SOUND_SUBROUTINE, [hl] ; in a subroutine?
jr nz, .readcommand ; execute
ld a, [CurChannel]
cp $4 ; channels 0-3?
cp CHAN5
jr nc, .chan_5to8
; ????
ld hl, Channel5Flags - Channel1
@ -1237,7 +1237,7 @@ ParseMusic: ; e85e1
call nz, RestoreVolume
; end music
ld a, [CurChannel]
cp $4 ; channel 5?
cp CHAN5
jr nz, .ok
; ????
xor a
@ -1266,7 +1266,7 @@ ParseMusic: ; e85e1
RestoreVolume: ; e8679
; ch5 only
ld a, [CurChannel]
cp $4
cp CHAN5
ret nz
xor a
ld hl, Channel6CryPitch
@ -1968,7 +1968,7 @@ Music_NoteType: ; e8963
ld [hl], a
ld a, [CurChannel]
and $3
cp CHAN4 ; CHAN8 & $3
cp CHAN8 & $3
ret z
; intensity
call Music_Intensity
@ -2063,7 +2063,7 @@ Music_StereoPanning: ; e89ba
; params: 1
; stereo on?
ld a, [Options]
bit 5, a ; stereo
bit STEREO, a
jr nz, Music_Panning
; skip param
call GetMusicByte
@ -2552,7 +2552,7 @@ _PlayCryHeader:: ; e8b79
; This only applies in-battle.
ld a, [Options]
bit 5, a ; stereo
bit STEREO, a
jr z, .next
; [Tracks] &= [CryTracks]
@ -2577,7 +2577,7 @@ _PlayCryHeader:: ; e8b79
ld a, [Volume]
ld [LastVolume], a
ld a, $77
ld a, MAX_VOLUME
ld [Volume], a
.end
@ -2696,7 +2696,7 @@ PlayStereoSFX:: ; e8ca6
; standard procedure if stereo's off
ld a, [Options]
bit 5, a
bit STEREO, a
jp z, _PlaySFX
; else, let's go ahead with this
@ -3231,7 +3231,7 @@ GetLRTracks: ; e8fc2
; gets the default sound l/r channels
; stores mono/stereo table in hl
ld a, [Options]
bit 5, a ; stereo
bit STEREO, a
; made redundant, could have had a purpose in gold
jr nz, .stereo
ld hl, MonoTracks
@ -3279,7 +3279,7 @@ ClearChannels:: ; e8fe9
ld a, $80
ld [hli], a
ld hl, rNR10
ld e, $4
ld e, NUM_MUSIC_CHANS
.loop
call ClearChannel
dec e

View File

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

View File

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

View File

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

View File

@ -29,38 +29,37 @@ add_mt: MACRO
enum \1_TMNUM
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
x = 0
y = 0
w = 0
tms1 = 0
tms2 = 0
tms3 = 0
rept _NARG
if def(\1_TMNUM)
if \1_TMNUM < 25
x = x | (1 << ((\1_TMNUM) - 1))
if \1_TMNUM < 24 + 1
tms1 = tms1 | (1 << ((\1_TMNUM) - 1))
elif \1_TMNUM < 48 + 1
tms2 = tms2 | (1 << ((\1_TMNUM) - 1 - 24))
else
if \1_TMNUM < 49
y = y | (1 << ((\1_TMNUM) - 1 - 24))
else
w = w | (1 << ((\1_TMNUM) - 1 - 48))
endc
tms3 = tms3 | (1 << ((\1_TMNUM) - 1 - 48))
endc
else
fail "\1 is not a TM, HM, or move tutor move"
endc
shift
endr
rept 3
db x & $ff
x = x >> 8
db tms1 & $ff
tms1 = tms1 >> 8
endr
rept 3
db y & $ff
y = y >> 8
db tms2 & $ff
tms2 = tms2 >> 8
endr
rept 2
db w & $ff
w = w >> 8
db tms3 & $ff
tms3 = tms3 >> 8
endr
ENDM

View File

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