Skip to content

Commit

Permalink
Add asserts to tables
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectroDeoxys authored and steven.silva committed Feb 19, 2024
1 parent b76965e commit 693e13d
Show file tree
Hide file tree
Showing 30 changed files with 403 additions and 131 deletions.
2 changes: 2 additions & 0 deletions src/audio/level_music.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ENDR
ENDM

LevelMusic::
table_width 8 * 2, LevelMusic
; day night
level_music MUSIC_OUT_OF_THE_WOODS_DAY, MUSIC_OUT_OF_THE_WOODS_NIGHT ; OUT_OF_THE_WOODS
level_music MUSIC_THE_PEACEFUL_VILLAGE_DAY, MUSIC_THE_PEACEFUL_VILLAGE_NIGHT ; THE_PEACEFUL_VILLAGE
Expand All @@ -34,3 +35,4 @@ LevelMusic::
level_music MUSIC_THE_WARPED_VOID, MUSIC_THE_WARPED_VOID ; THE_WARPED_VOID
level_music MUSIC_THE_WEST_CRATER, MUSIC_THE_WEST_CRATER ; THE_EAST_CRATER
level_music MUSIC_FOREST_OF_FEAR, MUSIC_FOREST_OF_FEAR ; FOREST_OF_FEAR
assert_table_length NUM_LEVELS
3 changes: 3 additions & 0 deletions src/audio/sound_headers.asm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ENDR
ENDM

SoundHeaders:
table_width 8, SoundHeaders
music Music_OutOfTheWoodsDay, $00, 100, CHAN1_F, 4 ; MUSIC_OUT_OF_THE_WOODS_DAY
music Music_OutOfTheWoodsNight, $00, 100, CHAN1_F, 3 ; MUSIC_OUT_OF_THE_WOODS_NIGHT
music Music_ForestOfFear, $00, 100, CHAN1_F, 2 ; MUSIC_FOREST_OF_FEAR
Expand Down Expand Up @@ -85,6 +86,8 @@ SoundHeaders:
music Music_Epilogue, $00, 100, CHAN1_F, 3 ; MUSIC_EPILOGUE
music Music_HiddenFigureReveal, $00, 100, CHAN1_F, 3 ; MUSIC_HIDDEN_FIGURE_REVEAL
music Music_HiddenFigureBattle2, $00, 100, CHAN1_F, 4 ; MUSIC_HIDDEN_FIGURE_BATTLE_2
assert_table_length NUM_MUSICS

filler_sounds 198

sfx Sfx_Jump, $00, 220, CHAN5_F, 1 ; SFX_JUMP
Expand Down
22 changes: 12 additions & 10 deletions src/audio/transformation_music.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
TransformationMusicIDs::
dw NULL
table_width 2, TransformationMusicIDs
dw NULL ; TRANSFORMATION_NONE_ID
dw MUSIC_HOT_WARIO ; TRANSFORMATION_HOT_WARIO_ID
dw MUSIC_FLAT_WARIO ; TRANSFORMATION_FLAT_WARIO_ID
dw MUSIC_BALL_O_STRING_WARIO ; TRANSFORMATION_BALL_O_STRING_WARIO_ID
Expand All @@ -22,12 +23,13 @@ TransformationMusicIDs::
dw NULL ; TRANSFORMATION_LAUNCHED_ID
dw NULL ; TRANSFORMATION_MAGIC_ID
dw NULL ; TRANSFORMATION_BALL_ID
dw NULL
dw NULL
dw NULL
dw NULL
dw NULL
dw NULL
dw NULL
dw NULL
dw NULL
dw NULL ; TRANSFORMATION_UNUSED_17_ID
dw NULL ; TRANSFORMATION_UNUSED_18_ID
dw NULL ; TRANSFORMATION_UNUSED_19_ID
dw NULL ; TRANSFORMATION_UNUSED_1A_ID
dw NULL ; TRANSFORMATION_UNUSED_1B_ID
dw NULL ; TRANSFORMATION_UNUSED_1C_ID
dw NULL ; TRANSFORMATION_UNUSED_1D_ID
dw NULL ; TRANSFORMATION_UNUSED_1E_ID
dw NULL ; TRANSFORMATION_UNUSED_1F_ID
assert_table_length NUM_TRANSFORMATIONS
4 changes: 4 additions & 0 deletions src/audio/waves.asm
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Waves:
table_width 6, Waves
db WAVEFORM_SQUARE_1_2_SAWTOOTH, 0, NO_SWEEP, $ff, $ff, $3c ; WAVE_00
db RECT_TRACK1 | RECTWAVE_1_8, 0, NO_SWEEP, $fb, $28, $3c ; WAVE_01
db RECT_TRACK1 | RECTWAVE_1_8, 0, NO_SWEEP, $f0, $10, $3c ; WAVE_02
Expand Down Expand Up @@ -122,10 +123,12 @@ Waves:
db WAVEFORM_SQUARE_4_8, 0, NO_SWEEP, $fa, $6c, $3c ; WAVE_78
db WAVEFORM_SPIKY, 0, NO_SWEEP, $fa, $4c, $3c ; WAVE_79
db WAVEFORM_SQUARE_1_8, 0, NO_SWEEP, $ff, $ff, $3c ; WAVE_7A
assert_table_length NUM_WAVES

WaveSamples:
; These are streams of 32 nibbles (4-bit values) used as wave patterns.
; Plot them as a line chart to see the wave's shape.
table_width 16, WaveSamples
dn 0, 0, 1, 1, 2, 3, 5, 6, 8, 9, 10, 12, 13, 14, 14, 15, 15, 15, 14, 14, 13, 12, 10, 9, 8, 6, 5, 3, 2, 1, 1, 0 ; WAVEFORM_SINE
dn 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 ; WAVEFORM_TRIANGLE
dn 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0 ; WAVEFORM_SAWTOOTH
Expand All @@ -138,3 +141,4 @@ WaveSamples:
dn 15, 15, 15, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 ; WAVEFORM_SQUARE_1_4_SAWTOOTH
dn 7, 7, 7, 7, 5, 1, 10, 2, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ; WAVEFORM_SPIKY
dn 7, 10, 12, 14, 15, 15, 15, 8, 7, 9, 9, 7, 7, 7, 7, 5, 5, 6, 6, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2, 1, 1, 0 ; WAVEFORM_SQUISHED_SINE
assert_table_length NUM_WAVEFORMS
2 changes: 2 additions & 0 deletions src/constants/audio_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ DEF RECT_TRACK2 EQU (1 << 3)
const WAVEFORM_SQUARE_1_4_SAWTOOTH ; $19 (square & sawtooth)
const WAVEFORM_SPIKY ; $1a (spiky)
const WAVEFORM_SQUISHED_SINE ; $1b (squished sine)
DEF NUM_WAVEFORMS EQU const_value - $10

DEF NOISE_POLYCOUNTER_15 EQU 0
DEF NOISE_POLYCOUNTER_07 EQU 1
Expand Down Expand Up @@ -332,6 +333,7 @@ DEF SWEEP_TIME_7 EQU (%111 << 4) ; 54.7 ms
const WAVE_78 ; $78
const WAVE_79 ; $79
const WAVE_7A ; $7a
DEF NUM_WAVES EQU const_value

const_def $cf
const NOTE_DURATION_0 ; $cf
Expand Down
4 changes: 2 additions & 2 deletions src/constants/cutscene_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
const CUTSCENE_58 ; $58
const CUTSCENE_59 ; $59
const CUTSCENE_5A ; $5a
DEF NUM_CUTSCENES EQU const_value - 1
DEF NUM_CUTSCENES EQU const_value

const_def
; WarioIdleGfx
Expand Down Expand Up @@ -182,7 +182,7 @@ DEF SCENEWARIO_GROUP_12 EQU const_value
; WarioClearGfx
const SCENEWARIO_IDLE_FRONT ; $3c
DEF SCENEWARIO_GROUP_13 EQU const_value
DEF NUM_SCENEWARIO_STATES EQU const_value - 1
DEF NUM_SCENEWARIO_STATES EQU const_value

DEF SCENEWARIO_GROUP_NONE EQU $ff

Expand Down
4 changes: 4 additions & 0 deletions src/constants/level_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,7 @@ DEF COIN_COOLDOWN EQU 100
; number of torches that need to be lit
; to destroy the Flame Block
DEF NUM_FLAME_BLOCK_TORCHES EQU 3

; number of different types of blocks
; that can fit inside a single room
DEF NUM_ROOM_BLOCK_TYPES EQU $80
181 changes: 92 additions & 89 deletions src/constants/object_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -79,95 +79,96 @@ DEF INTERACTION_DOWN EQU (1 << INTERACTION_DOWN_F) ; $80

; object interaction types
const_def
const OBJ_INTERACTION_00 ; 00
const OBJ_INTERACTION_01 ; 01
const OBJ_INTERACTION_FRONT_STING ; 02
const OBJ_INTERACTION_BACK_STING ; 03
const OBJ_INTERACTION_TOP_STING ; 04
const OBJ_INTERACTION_FULL_STING ; 05
const OBJ_INTERACTION_06 ; 06
const OBJ_INTERACTION_07 ; 07
const OBJ_INTERACTION_08 ; 08
const OBJ_INTERACTION_09 ; 09
const OBJ_INTERACTION_0A ; 0a
const OBJ_INTERACTION_0B ; 0b
const OBJ_INTERACTION_WALKABLE ; 0c
const OBJ_INTERACTION_MUSICAL_COIN ; 0d
const OBJ_INTERACTION_FIRE ; 0e
const OBJ_INTERACTION_RICHTERTOFFEN ; 0f
const OBJ_INTERACTION_GREY_KEY ; 10
const OBJ_INTERACTION_RED_KEY ; 11
const OBJ_INTERACTION_GREEN_KEY ; 12
const OBJ_INTERACTION_BLUE_KEY ; 13
const OBJ_INTERACTION_GREY_TREASURE ; 14
const OBJ_INTERACTION_RED_TREASURE ; 15
const OBJ_INTERACTION_GREEN_TREASURE ; 16
const OBJ_INTERACTION_BLUE_TREASURE ; 17
const OBJ_INTERACTION_18 ; 18
const OBJ_INTERACTION_19 ; 19
const OBJ_INTERACTION_1A ; 1a
const OBJ_INTERACTION_REGULAR_COIN ; 1b
const OBJ_INTERACTION_ELECTRIC ; 1c
const OBJ_INTERACTION_1D ; 1d
const OBJ_INTERACTION_1E ; 1e
const OBJ_INTERACTION_1F ; 1f
const OBJ_INTERACTION_BOUNCY ; 20
const OBJ_INTERACTION_21 ; 21
const OBJ_INTERACTION_SOLID ; 22
const OBJ_INTERACTION_23 ; 23
const OBJ_INTERACTION_24 ; 24
const OBJ_INTERACTION_VAMPIRE ; 25
const OBJ_INTERACTION_BUBBLE ; 26
const OBJ_INTERACTION_ICE ; 27
const OBJ_INTERACTION_OWL ; 28
const OBJ_INTERACTION_RAIL ; 29
const OBJ_INTERACTION_2A ; 2a
const OBJ_INTERACTION_2B ; 2b
const OBJ_INTERACTION_2C ; 2c
const OBJ_INTERACTION_2D ; 2d
const OBJ_INTERACTION_UNLIT_TORCH ; 2e
const OBJ_INTERACTION_STOVE ; 2f
const OBJ_INTERACTION_30 ; 30
const OBJ_INTERACTION_31 ; 31
const OBJ_INTERACTION_32 ; 32
const OBJ_INTERACTION_33 ; 33
const OBJ_INTERACTION_WORMWOULD ; 34
const OBJ_INTERACTION_35 ; 35
const OBJ_INTERACTION_36 ; 36
const OBJ_INTERACTION_37 ; 37
const OBJ_INTERACTION_38 ; 38
const OBJ_INTERACTION_WATER_DROP ; 39
const OBJ_INTERACTION_3A ; 3a
const OBJ_INTERACTION_3B ; 3b
const OBJ_INTERACTION_3C ; 3c
const OBJ_INTERACTION_3D ; 3d
const OBJ_INTERACTION_PRINCE_FROGGY ; 3e
const OBJ_INTERACTION_3F ; 3f
const OBJ_INTERACTION_WATER_TELEPORTING ; 40
const OBJ_INTERACTION_41 ; 41
const OBJ_INTERACTION_42 ; 42
const OBJ_INTERACTION_43 ; 43
const OBJ_INTERACTION_44 ; 44
const OBJ_INTERACTION_45 ; 45
const OBJ_INTERACTION_46 ; 46
const OBJ_INTERACTION_47 ; 47
const OBJ_INTERACTION_48 ; 48
const OBJ_INTERACTION_49 ; 49
const OBJ_INTERACTION_COLOUR_COIN ; 4a
const OBJ_INTERACTION_4B ; 4b
const OBJ_INTERACTION_BOTTOM_STING ; 4c
const OBJ_INTERACTION_4D ; 4d
const OBJ_INTERACTION_4E ; 4e
const OBJ_INTERACTION_4F ; 4f
const OBJ_INTERACTION_50 ; 50
const OBJ_INTERACTION_51 ; 51
const OBJ_INTERACTION_52 ; 52
const OBJ_INTERACTION_UNUSED_1 ; 53
const OBJ_INTERACTION_UNUSED_2 ; 54
const OBJ_INTERACTION_UNUSED_3 ; 55
const OBJ_INTERACTION_UNUSED_4 ; 56
const OBJ_INTERACTION_UNUSED_5 ; 57
const OBJ_INTERACTION_UNUSED_6 ; 58
const OBJ_INTERACTION_00 ; $00
const OBJ_INTERACTION_01 ; $01
const OBJ_INTERACTION_FRONT_STING ; $02
const OBJ_INTERACTION_BACK_STING ; $03
const OBJ_INTERACTION_TOP_STING ; $04
const OBJ_INTERACTION_FULL_STING ; $05
const OBJ_INTERACTION_06 ; $06
const OBJ_INTERACTION_07 ; $07
const OBJ_INTERACTION_08 ; $08
const OBJ_INTERACTION_09 ; $09
const OBJ_INTERACTION_0A ; $0a
const OBJ_INTERACTION_0B ; $0b
const OBJ_INTERACTION_WALKABLE ; $0c
const OBJ_INTERACTION_MUSICAL_COIN ; $0d
const OBJ_INTERACTION_FIRE ; $0e
const OBJ_INTERACTION_RICHTERTOFFEN ; $0f
const OBJ_INTERACTION_GREY_KEY ; $10
const OBJ_INTERACTION_RED_KEY ; $11
const OBJ_INTERACTION_GREEN_KEY ; $12
const OBJ_INTERACTION_BLUE_KEY ; $13
const OBJ_INTERACTION_GREY_TREASURE ; $14
const OBJ_INTERACTION_RED_TREASURE ; $15
const OBJ_INTERACTION_GREEN_TREASURE ; $16
const OBJ_INTERACTION_BLUE_TREASURE ; $17
const OBJ_INTERACTION_18 ; $18
const OBJ_INTERACTION_19 ; $19
const OBJ_INTERACTION_1A ; $1a
const OBJ_INTERACTION_REGULAR_COIN ; $1b
const OBJ_INTERACTION_ELECTRIC ; $1c
const OBJ_INTERACTION_1D ; $1d
const OBJ_INTERACTION_1E ; $1e
const OBJ_INTERACTION_1F ; $1f
const OBJ_INTERACTION_BOUNCY ; $20
const OBJ_INTERACTION_21 ; $21
const OBJ_INTERACTION_SOLID ; $22
const OBJ_INTERACTION_23 ; $23
const OBJ_INTERACTION_24 ; $24
const OBJ_INTERACTION_VAMPIRE ; $25
const OBJ_INTERACTION_BUBBLE ; $26
const OBJ_INTERACTION_ICE ; $27
const OBJ_INTERACTION_OWL ; $28
const OBJ_INTERACTION_RAIL ; $29
const OBJ_INTERACTION_2A ; $2a
const OBJ_INTERACTION_2B ; $2b
const OBJ_INTERACTION_2C ; $2c
const OBJ_INTERACTION_2D ; $2d
const OBJ_INTERACTION_UNLIT_TORCH ; $2e
const OBJ_INTERACTION_STOVE ; $2f
const OBJ_INTERACTION_30 ; $30
const OBJ_INTERACTION_31 ; $31
const OBJ_INTERACTION_32 ; $32
const OBJ_INTERACTION_33 ; $33
const OBJ_INTERACTION_WORMWOULD ; $34
const OBJ_INTERACTION_35 ; $35
const OBJ_INTERACTION_36 ; $36
const OBJ_INTERACTION_37 ; $37
const OBJ_INTERACTION_38 ; $38
const OBJ_INTERACTION_WATER_DROP ; $39
const OBJ_INTERACTION_3A ; $3a
const OBJ_INTERACTION_3B ; $3b
const OBJ_INTERACTION_3C ; $3c
const OBJ_INTERACTION_3D ; $3d
const OBJ_INTERACTION_PRINCE_FROGGY ; $3e
const OBJ_INTERACTION_3F ; $3f
const OBJ_INTERACTION_WATER_TELEPORTING ; $40
const OBJ_INTERACTION_41 ; $41
const OBJ_INTERACTION_42 ; $42
const OBJ_INTERACTION_43 ; $43
const OBJ_INTERACTION_44 ; $44
const OBJ_INTERACTION_45 ; $45
const OBJ_INTERACTION_46 ; $46
const OBJ_INTERACTION_47 ; $47
const OBJ_INTERACTION_48 ; $48
const OBJ_INTERACTION_49 ; $49
const OBJ_INTERACTION_COLOUR_COIN ; $4a
const OBJ_INTERACTION_4B ; $4b
const OBJ_INTERACTION_BOTTOM_STING ; $4c
const OBJ_INTERACTION_4D ; $4d
const OBJ_INTERACTION_4E ; $4e
const OBJ_INTERACTION_4F ; $4f
const OBJ_INTERACTION_50 ; $50
const OBJ_INTERACTION_51 ; $51
const OBJ_INTERACTION_52 ; $52
const OBJ_INTERACTION_UNUSED_1 ; $53
const OBJ_INTERACTION_UNUSED_2 ; $54
const OBJ_INTERACTION_UNUSED_3 ; $55
const OBJ_INTERACTION_UNUSED_4 ; $56
const OBJ_INTERACTION_UNUSED_5 ; $57
const OBJ_INTERACTION_UNUSED_6 ; $58
DEF NUM_OBJ_INTERACTIONS EQU const_value

; enemies with InteractionType with
; this flag set are considered heavy
Expand Down Expand Up @@ -294,6 +295,7 @@ DEF INTERACTION_MASK EQU $ff ^ HEAVY_OBJ
const OBJACTION_11 ; $11
const OBJACTION_12 ; $12
const OBJACTION_13 ; $13
DEF NUM_OBJ_ACTIONS EQU const_value

DEF NO_ACTIONS_F EQU 7
DEF NO_ACTIONS EQU (1 << NO_ACTIONS_F)
Expand Down Expand Up @@ -449,5 +451,6 @@ DEF NO_ACTIONS_FOR EQUS "(1 << NO_ACTIONS_F) |"
const ENEMY_GROUP_143 ; $8f
const ENEMY_GROUP_144 ; $90
const ENEMY_GROUP_145 ; $91
DEF NUM_ENEMY_GROUPS EQU const_value
const_def 240
const ENEMY_GROUP_HIDDEN_FIGURE ; $f0
11 changes: 6 additions & 5 deletions src/constants/particle_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
const PARTICLE_MAGIC_1 ; $10
const PARTICLE_MAGIC_2 ; $11
const PARTICLE_MAGIC_STOP ; $12
const PARTICLE_13 ; $13 (unused)
const PARTICLE_14 ; $14 (unused)
const PARTICLE_15 ; $15 (unused)
const PARTICLE_16 ; $16 (unused)
const PARTICLE_UNUSED_13 ; $13
const PARTICLE_UNUSED_14 ; $14
const PARTICLE_UNUSED_15 ; $15
const PARTICLE_UNUSED_16 ; $16
DEF NUM_PARTICLES EQU const_value

; the maximum number of active particles
DEF NUM_PARTICLES EQU 4
DEF MAX_NUM_PARTICLES EQU 4

; wObjects structs constants
RSRESET
Expand Down
9 changes: 9 additions & 0 deletions src/constants/room_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,15 @@
const ROOM_152 ; $98
const ROOM_153 ; $99
const ROOM_154 ; $9a
const ROOM_UNUSED_155 ; $9b
const ROOM_UNUSED_156 ; $9c
const ROOM_UNUSED_157 ; $9d
const ROOM_UNUSED_158 ; $9e
const ROOM_UNUSED_159 ; $9f
const ROOM_UNUSED_160 ; $a0
const ROOM_UNUSED_161 ; $a1
const ROOM_UNUSED_162 ; $a2
DEF NUM_ROOMS EQU const_value

const_def
const TILE_MAP_00 ; $00
Expand Down
1 change: 1 addition & 0 deletions src/constants/sound_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
const MUSIC_EPILOGUE ; 038
const MUSIC_HIDDEN_FIGURE_REVEAL ; 039
const MUSIC_HIDDEN_FIGURE_BATTLE_2 ; 03a
DEF NUM_MUSICS EQU const_value - 1

const_def $101
const SFX_JUMP ; 101
Expand Down
2 changes: 1 addition & 1 deletion src/constants/treasure_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
const CRAYON_CYAN_T ; $62
const CRAYON_BLUE_T ; $63
const CRAYON_PINK_T ; $64
DEF NUM_TREASURES EQU const_value - 1
DEF NUM_TREASURES EQU const_value
const TREASURE_DUMMY ; $65
const_def $80
const INVALID_TREASURE ; $80
Expand Down
Loading

0 comments on commit 693e13d

Please sign in to comment.