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
.ChannelFunctions:
table_width 2, UpdateChannels.ChannelFunctions
; music channels
dw .Channel1
dw .Channel2
dw .Channel3
dw .Channel4
; sfx ch ptrs are identical to music chs
; ..except 5
assert_table_length NUM_MUSIC_CHANS
; 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 .Channel6
dw .Channel7
dw .Channel8
assert_table_length NUM_CHANNELS
.Channel1:
ld a, [wLowHealthAlarm]
@ -2777,16 +2782,19 @@ StereoTracks:
db $11, $22, $44, $88
ChannelPointers:
table_width 2, ChannelPointers
; music channels
dw wChannel1
dw wChannel2
dw wChannel3
dw wChannel4
assert_table_length NUM_MUSIC_CHANS
; sfx channels
dw wChannel5
dw wChannel6
dw wChannel7
dw wChannel8
assert_table_length NUM_CHANNELS
ClearChannels::
; 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_BOX_FULL EQU 7
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 BALL ; 3
const TM_HM ; 4
NUM_ITEM_TYPES EQU const_value - 1
; item menu types
; UseItem.dw indexes (see engine/items/pack.asm)

View File

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

View File

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

View File

@ -11,9 +11,11 @@ ENDM
GrowthRates:
; 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 3, 4, 10, 0, 30 ; Slightly Fast
growth_rate 3, 4, 20, 0, 70 ; Slightly Slow
growth_rate 6, 5, -15, 100, 140 ; Medium Slow
growth_rate 4, 5, 0, 0, 0 ; Fast
growth_rate 5, 4, 0, 0, 0 ; Slow
assert_table_length NUM_GROWTH_RATES

View File

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

View File

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

View File

@ -13,7 +13,7 @@ BuenasPasswordTable:
dw .RadioStations
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
.Beverages: db BUENA_ITEM, 12, FRESH_WATER, SODA_POP, LEMONADE
.HealingItems: db BUENA_ITEM, 12, POTION, ANTIDOTE, PARLYZ_HEAL

View File

@ -298,12 +298,12 @@ SpriteMovementData::
db 0 ; flags2
db SWIMMING ; palette flags
; 25
assert_table_length NUM_SPRITEMOVEDATA
; unused
db SPRITEMOVEFN_00 ; movement function
db DOWN ; facing
db OBJECT_ACTION_STAND ; action
db 0 ; flags1
db 0 ; flags2
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
; chance, old rod, good rod, super rod
dbwww \1, \2, \3, \4
db \1
dw \2, \3, \4
ENDM
FishGroups:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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