Miscellaneous cleanup

This commit is contained in:
Rangi 2021-03-22 16:41:17 -04:00
parent 8daf8fe19c
commit dbe2360ecd
17 changed files with 65 additions and 46 deletions

View File

@ -223,16 +223,21 @@ UpdateChannels:
jp hl jp hl
.ChannelFunctions: .ChannelFunctions:
table_width 2, UpdateChannels.ChannelFunctions
; music channels
dw .Channel1 dw .Channel1
dw .Channel2 dw .Channel2
dw .Channel3 dw .Channel3
dw .Channel4 dw .Channel4
; sfx ch ptrs are identical to music chs assert_table_length NUM_MUSIC_CHANS
; ..except 5 ; sfx channels
; identical to music channels, except .Channel5 is not disabled by the low-HP danger sound
; (instead, PlayDanger does not play the danger sound if sfx is playing)
dw .Channel5 dw .Channel5
dw .Channel6 dw .Channel6
dw .Channel7 dw .Channel7
dw .Channel8 dw .Channel8
assert_table_length NUM_CHANNELS
.Channel1: .Channel1:
ld a, [wLowHealthAlarm] ld a, [wLowHealthAlarm]
@ -2777,16 +2782,19 @@ StereoTracks:
db $11, $22, $44, $88 db $11, $22, $44, $88
ChannelPointers: ChannelPointers:
table_width 2, ChannelPointers
; music channels ; music channels
dw wChannel1 dw wChannel1
dw wChannel2 dw wChannel2
dw wChannel3 dw wChannel3
dw wChannel4 dw wChannel4
assert_table_length NUM_MUSIC_CHANS
; sfx channels ; sfx channels
dw wChannel5 dw wChannel5
dw wChannel6 dw wChannel6
dw wChannel7 dw wChannel7
dw wChannel8 dw wChannel8
assert_table_length NUM_CHANNELS
ClearChannels:: ClearChannels::
; runs ClearChannel for all 4 channels ; runs ClearChannel for all 4 channels

View File

@ -263,3 +263,7 @@ ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP
BATTLERESULT_CAUGHT_CELEBI EQU 6 BATTLERESULT_CAUGHT_CELEBI EQU 6
BATTLERESULT_BOX_FULL EQU 7 BATTLERESULT_BOX_FULL EQU 7
BATTLERESULT_BITMASK EQU (1 << BATTLERESULT_CAUGHT_CELEBI) | (1 << BATTLERESULT_BOX_FULL) BATTLERESULT_BITMASK EQU (1 << BATTLERESULT_CAUGHT_CELEBI) | (1 << BATTLERESULT_BOX_FULL)
; link_battle_record struct
LINK_BATTLE_RECORD_LENGTH EQU 2 + (NAME_LENGTH - 1) + 2 * 3
NUM_LINK_BATTLE_RECORDS EQU 5

View File

@ -17,6 +17,7 @@ ITEMATTR_STRUCT_LENGTH EQU _RS
const KEY_ITEM ; 2 const KEY_ITEM ; 2
const BALL ; 3 const BALL ; 3
const TM_HM ; 4 const TM_HM ; 4
NUM_ITEM_TYPES EQU const_value - 1
; item menu types ; item menu types
; UseItem.dw indexes (see engine/items/pack.asm) ; UseItem.dw indexes (see engine/items/pack.asm)

View File

@ -49,6 +49,7 @@ GENDER_UNKNOWN EQU -1
const GROWTH_MEDIUM_SLOW const GROWTH_MEDIUM_SLOW
const GROWTH_FAST const GROWTH_FAST
const GROWTH_SLOW const GROWTH_SLOW
NUM_GROWTH_RATES EQU const_value
; wBaseEggGroups values ; wBaseEggGroups values
const_def 1 const_def 1

View File

@ -47,6 +47,7 @@ DecorationIDs:
db DECO_GEODUDE_DOLL ; 30 db DECO_GEODUDE_DOLL ; 30
db DECO_MACHOP_DOLL ; 31 db DECO_MACHOP_DOLL ; 31
db DECO_TENTACOOL_DOLL ; 32 db DECO_TENTACOOL_DOLL ; 32
db DECO_BIG_SNORLAX_DOLL ; 1a db DECO_BIG_SNORLAX_DOLL ; 1a
db DECO_BIG_ONIX_DOLL ; 1b db DECO_BIG_ONIX_DOLL ; 1b
db DECO_BIG_LAPRAS_DOLL ; 1c db DECO_BIG_LAPRAS_DOLL ; 1c

View File

@ -11,9 +11,11 @@ ENDM
GrowthRates: GrowthRates:
; entries correspond to GROWTH_* (see constants/pokemon_data_constants.asm) ; entries correspond to GROWTH_* (see constants/pokemon_data_constants.asm)
table_width 4, GrowthRates
growth_rate 1, 1, 0, 0, 0 ; Medium Fast growth_rate 1, 1, 0, 0, 0 ; Medium Fast
growth_rate 3, 4, 10, 0, 30 ; Slightly Fast growth_rate 3, 4, 10, 0, 30 ; Slightly Fast
growth_rate 3, 4, 20, 0, 70 ; Slightly Slow growth_rate 3, 4, 20, 0, 70 ; Slightly Slow
growth_rate 6, 5, -15, 100, 140 ; Medium Slow growth_rate 6, 5, -15, 100, 140 ; Medium Slow
growth_rate 4, 5, 0, 0, 0 ; Fast growth_rate 4, 5, 0, 0, 0 ; Fast
growth_rate 5, 4, 0, 0, 0 ; Slow growth_rate 5, 4, 0, 0, 0 ; Slow
assert_table_length NUM_GROWTH_RATES

View File

@ -1,9 +1,11 @@
ItemPocketNames: ItemPocketNames:
; entries correspond to item type constants ; entries correspond to item type constants
table_width 2, ItemPocketNames
dw .Item dw .Item
dw .Key dw .Key
dw .Ball dw .Ball
dw .TM dw .TM
assert_table_length NUM_ITEM_TYPES
.Item: db "ITEM POCKET@" .Item: db "ITEM POCKET@"
.Key: db "KEY POCKET@" .Key: db "KEY POCKET@"

View File

@ -17,6 +17,7 @@ endc
PURGE MOVE_FOR_TM PURGE MOVE_FOR_TM
n = n + 1 n = n + 1
endr endr
assert_table_length NUM_TMS
; HMs ; HMs
n = 1 n = 1
@ -30,6 +31,7 @@ endc
PURGE MOVE_FOR_HM PURGE MOVE_FOR_HM
n = n + 1 n = n + 1
endr endr
assert_table_length NUM_TMS + NUM_HMS
; Move tutor ; Move tutor
n = 1 n = 1
@ -43,7 +45,6 @@ endc
PURGE MOVE_FOR_MT PURGE MOVE_FOR_MT
n = n + 1 n = n + 1
endr endr
assert_table_length NUM_TM_HM_TUTOR assert_table_length NUM_TM_HM_TUTOR
db 0 ; end db 0 ; end

View File

@ -13,7 +13,7 @@ BuenasPasswordTable:
dw .RadioStations dw .RadioStations
assert_table_length NUM_PASSWORD_CATEGORIES assert_table_length NUM_PASSWORD_CATEGORIES
; string type, points, option 1, option 2, option 3 ; string type, points, option 1, option 2, option 3
.JohtoStarters: db BUENA_MON, 10, CYNDAQUIL, TOTODILE, CHIKORITA .JohtoStarters: db BUENA_MON, 10, CYNDAQUIL, TOTODILE, CHIKORITA
.Beverages: db BUENA_ITEM, 12, FRESH_WATER, SODA_POP, LEMONADE .Beverages: db BUENA_ITEM, 12, FRESH_WATER, SODA_POP, LEMONADE
.HealingItems: db BUENA_ITEM, 12, POTION, ANTIDOTE, PARLYZ_HEAL .HealingItems: db BUENA_ITEM, 12, POTION, ANTIDOTE, PARLYZ_HEAL

View File

@ -298,12 +298,12 @@ SpriteMovementData::
db 0 ; flags2 db 0 ; flags2
db SWIMMING ; palette flags db SWIMMING ; palette flags
; 25 assert_table_length NUM_SPRITEMOVEDATA
; unused
db SPRITEMOVEFN_00 ; movement function db SPRITEMOVEFN_00 ; movement function
db DOWN ; facing db DOWN ; facing
db OBJECT_ACTION_STAND ; action db OBJECT_ACTION_STAND ; action
db 0 ; flags1 db 0 ; flags1
db 0 ; flags2 db 0 ; flags2
db 0 ; palette flags db 0 ; palette flags
assert_table_length NUM_SPRITEMOVEDATA + 1

View File

@ -2,7 +2,8 @@ time_group EQUS "0," ; use the nth TimeFishGroups entry
fishgroup: MACRO fishgroup: MACRO
; chance, old rod, good rod, super rod ; chance, old rod, good rod, super rod
dbwww \1, \2, \3, \4 db \1
dw \2, \3, \4
ENDM ENDM
FishGroups: FishGroups:

View File

@ -8448,9 +8448,6 @@ IsMobileBattle2:
cp LINK_MOBILE cp LINK_MOBILE
ret ret
LINK_BATTLE_RECORD_LENGTH EQUS "(sLinkBattleRecord1End - sLinkBattleRecord1)" ; 18
NUM_LINK_BATTLE_RECORDS EQUS "((sLinkBattleStatsEnd - sLinkBattleRecord) / LINK_BATTLE_RECORD_LENGTH)" ; 5
_DisplayLinkRecord: _DisplayLinkRecord:
ld a, BANK(sLinkBattleStats) ld a, BANK(sLinkBattleStats)
call OpenSRAM call OpenSRAM

View File

@ -804,7 +804,6 @@ PlayerMovementPointers:
ld a, BANK(Script_ForcedMovement) ld a, BANK(Script_ForcedMovement)
ld hl, Script_ForcedMovement ld hl, Script_ForcedMovement
call CallScript call CallScript
; ld a, -1
ld c, a ld c, a
scf scf
ret ret

View File

@ -1,7 +1,7 @@
ObjectActionPairPointers: ObjectActionPairPointers:
; entries correspond to OBJECT_ACTION_* constants (see constants/map_object_constants.asm) ; entries correspond to OBJECT_ACTION_* constants (see constants/map_object_constants.asm)
; normal action, frozen action
table_width 2 + 2, ObjectActionPairPointers table_width 2 + 2, ObjectActionPairPointers
; normal action, frozen action
dw SetFacingStanding, SetFacingStanding dw SetFacingStanding, SetFacingStanding
dw SetFacingStandAction, SetFacingCurrent dw SetFacingStandAction, SetFacingCurrent
dw SetFacingStepAction, SetFacingCurrent dw SetFacingStepAction, SetFacingCurrent

View File

@ -33,11 +33,11 @@ noise: MACRO
ENDM ENDM
notetype: MACRO notetype: MACRO
IF _NARG >= 2 if _NARG >= 2
note_type \1, \2 >> 4, \2 & $0f note_type \1, \2 >> 4, \2 & $0f
ELSE else
note_type \1 note_type \1
ENDC endc
ENDM ENDM
pitchoffset: MACRO pitchoffset: MACRO
@ -57,11 +57,11 @@ ENDM
unknownmusic0xde EQUS "sound_duty" unknownmusic0xde EQUS "sound_duty"
sound_duty: MACRO sound_duty: MACRO
db duty_cycle_pattern_cmd db duty_cycle_pattern_cmd
IF _NARG == 4 if _NARG == 4
db \1 | (\2 << 2) | (\3 << 4) | (\4 << 6) db \1 | (\2 << 2) | (\3 << 4) | (\4 << 6)
ELSE else
db \1 db \1
ENDC endc
ENDM ENDM
togglesfx EQUS "toggle_sfx" togglesfx EQUS "toggle_sfx"

View File

@ -26,21 +26,21 @@ ENDM
square_note: MACRO square_note: MACRO
db \1 ; length db \1 ; length
IF \3 < 0 if \3 < 0
dn \2, %1000 | (\3 * -1) ; volume envelope dn \2, %1000 | (\3 * -1) ; volume envelope
ELSE else
dn \2, \3 ; volume envelope dn \2, \3 ; volume envelope
ENDC endc
dw \4 ; frequency dw \4 ; frequency
ENDM ENDM
noise_note: MACRO noise_note: MACRO
db \1 ; length db \1 ; length
IF \3 < 0 if \3 < 0
dn \2, %1000 | (\3 * -1) ; volume envelope dn \2, %1000 | (\3 * -1) ; volume envelope
ELSE else
dn \2, \3 ; volume envelope dn \2, \3 ; volume envelope
ENDC endc
db \4 ; frequency db \4 ; frequency
ENDM ENDM
@ -60,13 +60,13 @@ ENDM
note_type: MACRO note_type: MACRO
db note_type_cmd db note_type_cmd
db \1 ; note length db \1 ; note length
IF _NARG >= 2 if _NARG >= 2
IF \3 < 0 if \3 < 0
dn \2, %1000 | (\3 * -1) ; volume envelope dn \2, %1000 | (\3 * -1) ; volume envelope
ELSE else
dn \2, \3 ; volume envelope dn \2, \3 ; volume envelope
ENDC endc
ENDC endc
ENDM ENDM
; only valid on the noise channel ; only valid on the noise channel
@ -95,21 +95,21 @@ ENDM
const volume_envelope_cmd ; $dc const volume_envelope_cmd ; $dc
volume_envelope: MACRO volume_envelope: MACRO
db volume_envelope_cmd db volume_envelope_cmd
IF \2 < 0 if \2 < 0
dn \1, %1000 | (\2 * -1) ; volume envelope dn \1, %1000 | (\2 * -1) ; volume envelope
ELSE else
dn \1, \2 ; volume envelope dn \1, \2 ; volume envelope
ENDC endc
ENDM ENDM
const pitch_sweep_cmd ; $dd const pitch_sweep_cmd ; $dd
pitch_sweep: MACRO pitch_sweep: MACRO
db pitch_sweep_cmd db pitch_sweep_cmd
IF \2 < 0 if \2 < 0
dn \1, %1000 | (\2 * -1) ; pitch sweep dn \1, %1000 | (\2 * -1) ; pitch sweep
ELSE else
dn \1, \2 ; pitch sweep dn \1, \2 ; pitch sweep
ENDC endc
ENDM ENDM
const duty_cycle_pattern_cmd ; $de const duty_cycle_pattern_cmd ; $de
@ -134,11 +134,11 @@ ENDM
vibrato: MACRO vibrato: MACRO
db vibrato_cmd db vibrato_cmd
db \1 ; delay db \1 ; delay
IF _NARG > 2 if _NARG > 2
dn \2, \3 ; extent, rate dn \2, \3 ; extent, rate
ELSE else
db \2 ; LEGACY: Support for 1-arg extent db \2 ; LEGACY: Support for 1-arg extent
ENDC endc
ENDM ENDM
const unknownmusic0xe2_cmd ; $e2 const unknownmusic0xe2_cmd ; $e2
@ -150,9 +150,9 @@ ENDM
const toggle_noise_cmd ; $e3 const toggle_noise_cmd ; $e3
toggle_noise: MACRO toggle_noise: MACRO
db toggle_noise_cmd db toggle_noise_cmd
IF _NARG > 0 if _NARG > 0
db \1 ; drum kit db \1 ; drum kit
ENDC endc
ENDM ENDM
const force_stereo_panning_cmd ; $e4 const force_stereo_panning_cmd ; $e4
@ -164,11 +164,11 @@ ENDM
const volume_cmd ; $e5 const volume_cmd ; $e5
volume: MACRO volume: MACRO
db volume_cmd db volume_cmd
IF _NARG > 1 if _NARG > 1
dn \1, \2 ; left volume, right volume dn \1, \2 ; left volume, right volume
ELSE else
db \1 ; LEGACY: Support for 1-arg volume db \1 ; LEGACY: Support for 1-arg volume
ENDC endc
ENDM ENDM
const pitch_offset_cmd ; $e6 const pitch_offset_cmd ; $e6
@ -232,9 +232,9 @@ ENDM
const sfx_toggle_noise_cmd ; $f0 const sfx_toggle_noise_cmd ; $f0
sfx_toggle_noise: MACRO sfx_toggle_noise: MACRO
db sfx_toggle_noise_cmd db sfx_toggle_noise_cmd
IF _NARG > 0 if _NARG > 0
db \1 ; drum kit db \1 ; drum kit
ENDC endc
ENDM ENDM
const music0xf1_cmd ; $f1 const music0xf1_cmd ; $f1

View File

@ -142,11 +142,13 @@ sLinkBattleLosses:: dw
sLinkBattleDraws:: dw sLinkBattleDraws:: dw
sLinkBattleRecord:: sLinkBattleRecord::
table_width LINK_BATTLE_RECORD_LENGTH, sLinkBattleRecord
sLinkBattleRecord1:: link_battle_record sLinkBattleRecord1 sLinkBattleRecord1:: link_battle_record sLinkBattleRecord1
sLinkBattleRecord2:: link_battle_record sLinkBattleRecord2 sLinkBattleRecord2:: link_battle_record sLinkBattleRecord2
sLinkBattleRecord3:: link_battle_record sLinkBattleRecord3 sLinkBattleRecord3:: link_battle_record sLinkBattleRecord3
sLinkBattleRecord4:: link_battle_record sLinkBattleRecord4 sLinkBattleRecord4:: link_battle_record sLinkBattleRecord4
sLinkBattleRecord5:: link_battle_record sLinkBattleRecord5 sLinkBattleRecord5:: link_battle_record sLinkBattleRecord5
assert_table_length NUM_LINK_BATTLE_RECORDS
sLinkBattleStatsEnd:: sLinkBattleStatsEnd::