diff --git a/STYLE.md b/STYLE.md index becfc5044..c3106893a 100644 --- a/STYLE.md +++ b/STYLE.md @@ -79,19 +79,19 @@ hPascalCase: ; hram PascalCase: ; rom ; Some constants are also prefixed -rBGP EQU $ff47 ; hardware register +DEF rBGP EQU $ff47 ; hardware register ; Most other constants should be upper case -UPPER_CASE EQU 1 +DEF UPPER_CASE EQU 1 ; Long lists of constants should be aligned -SHORT_CONSTANT EQU 1 -LONGER_CONSTANT EQU 2 -PRETTY_LONG_CONSTANT EQU 3 -TINY EQU 4 +DEF SHORT_CONSTANT EQU 1 +DEF LONGER_CONSTANT EQU 2 +DEF PRETTY_LONG_CONSTANT EQU 3 +DEF TINY EQU 4 -BUT_ONLY_RELATED_CONSTANTS EQU 5 +DEF BUT_ONLY_RELATED_CONSTANTS EQU 5 ``` @@ -103,12 +103,12 @@ BUT_ONLY_RELATED_CONSTANTS EQU 5 SECTION "section", ROMX INCLUDE "filename" INCBIN "filename" -my_macro: MACRO +MACRO my_macro nop ENDM -TEST EQUS "test" +DEF TEST EQUS "test" PURGE TEST -TEST EQU 2 +DEF TEST EQU 2 ; data macros should be lowercase db 1 @@ -135,7 +135,7 @@ endr ```asm -when_in_doubt_lowercase: MACRO +MACRO when_in_doubt_lowercase ; only shift if it's required or more readable @@ -158,7 +158,7 @@ endr ENDM -UPPER_CASE_IS_OK_SOMETIMES: MACRO +MACRO UPPER_CASE_IS_OK_SOMETIMES ; but I can't think of any examples besides ACRONYMS diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm index 7d0989434..b1fba292c 100644 --- a/constants/audio_constants.asm +++ b/constants/audio_constants.asm @@ -13,7 +13,7 @@ const A_ ; a const A# ; b const B_ ; c -NUM_NOTES EQU const_value - 1 +DEF NUM_NOTES EQU const_value - 1 ; channel ; ChannelPointers indexes (see audio/engine.asm) @@ -22,60 +22,60 @@ NUM_NOTES EQU const_value - 1 const CHAN2 ; 1 const CHAN3 ; 2 const CHAN4 ; 3 -NUM_MUSIC_CHANS EQU const_value +DEF NUM_MUSIC_CHANS EQU const_value const CHAN5 ; 4 const CHAN6 ; 5 const CHAN7 ; 6 const CHAN8 ; 7 -NUM_NOISE_CHANS EQU const_value - NUM_MUSIC_CHANS -NUM_CHANNELS EQU const_value +DEF NUM_NOISE_CHANS EQU const_value - NUM_MUSIC_CHANS +DEF NUM_CHANNELS EQU const_value ; channel_struct members (see macros/wram.asm) rsreset -CHANNEL_MUSIC_ID rw -CHANNEL_MUSIC_BANK rb -CHANNEL_FLAGS1 rb -CHANNEL_FLAGS2 rb -CHANNEL_FLAGS3 rb -CHANNEL_MUSIC_ADDRESS rw -CHANNEL_LAST_MUSIC_ADDRESS rw - rb_skip 2 -CHANNEL_NOTE_FLAGS rb -CHANNEL_CONDITION rb -CHANNEL_DUTY_CYCLE rb -CHANNEL_VOLUME_ENVELOPE rb -CHANNEL_FREQUENCY rw -CHANNEL_PITCH rb -CHANNEL_OCTAVE rb -CHANNEL_TRANSPOSITION rb -CHANNEL_NOTE_DURATION rb -CHANNEL_FIELD16 rb - rb_skip -CHANNEL_LOOP_COUNT rb -CHANNEL_TEMPO rw -CHANNEL_TRACKS rb -CHANNEL_DUTY_CYCLE_PATTERN rb -CHANNEL_VIBRATO_DELAY_COUNT rb -CHANNEL_VIBRATO_DELAY rb -CHANNEL_VIBRATO_EXTENT rb -CHANNEL_VIBRATO_RATE rb -CHANNEL_PITCH_SLIDE_TARGET rw -CHANNEL_PITCH_SLIDE_AMOUNT rb -CHANNEL_PITCH_SLIDE_AMOUNT_FRACTION rb -CHANNEL_FIELD25 rb - rb_skip -CHANNEL_PITCH_OFFSET rw -CHANNEL_FIELD29 rb -CHANNEL_FIELD2A rw -CHANNEL_FIELD2C rb -CHANNEL_NOTE_LENGTH rb -CHANNEL_FIELD2E rb -CHANNEL_FIELD2F rb -CHANNEL_FIELD30 rb - rb_skip -CHANNEL_STRUCT_LENGTH EQU _RS +DEF CHANNEL_MUSIC_ID rw +DEF CHANNEL_MUSIC_BANK rb +DEF CHANNEL_FLAGS1 rb +DEF CHANNEL_FLAGS2 rb +DEF CHANNEL_FLAGS3 rb +DEF CHANNEL_MUSIC_ADDRESS rw +DEF CHANNEL_LAST_MUSIC_ADDRESS rw + rb_skip 2 +DEF CHANNEL_NOTE_FLAGS rb +DEF CHANNEL_CONDITION rb +DEF CHANNEL_DUTY_CYCLE rb +DEF CHANNEL_VOLUME_ENVELOPE rb +DEF CHANNEL_FREQUENCY rw +DEF CHANNEL_PITCH rb +DEF CHANNEL_OCTAVE rb +DEF CHANNEL_TRANSPOSITION rb +DEF CHANNEL_NOTE_DURATION rb +DEF CHANNEL_FIELD16 rb + rb_skip +DEF CHANNEL_LOOP_COUNT rb +DEF CHANNEL_TEMPO rw +DEF CHANNEL_TRACKS rb +DEF CHANNEL_DUTY_CYCLE_PATTERN rb +DEF CHANNEL_VIBRATO_DELAY_COUNT rb +DEF CHANNEL_VIBRATO_DELAY rb +DEF CHANNEL_VIBRATO_EXTENT rb +DEF CHANNEL_VIBRATO_RATE rb +DEF CHANNEL_PITCH_SLIDE_TARGET rw +DEF CHANNEL_PITCH_SLIDE_AMOUNT rb +DEF CHANNEL_PITCH_SLIDE_AMOUNT_FRACTION rb +DEF CHANNEL_FIELD25 rb + rb_skip +DEF CHANNEL_PITCH_OFFSET rw +DEF CHANNEL_FIELD29 rb +DEF CHANNEL_FIELD2A rw +DEF CHANNEL_FIELD2C rb +DEF CHANNEL_NOTE_LENGTH rb +DEF CHANNEL_FIELD2E rb +DEF CHANNEL_FIELD2F rb +DEF CHANNEL_FIELD30 rb + rb_skip +DEF CHANNEL_STRUCT_LENGTH EQU _RS -NOISE_CHAN_F EQU 2 ; bit set in CHAN5-CHAN7 +DEF NOISE_CHAN_F EQU 2 ; bit set in CHAN5-CHAN7 ; Flags1 const_def @@ -113,22 +113,22 @@ NOISE_CHAN_F EQU 2 ; bit set in CHAN5-CHAN7 const NOTE_VIBRATO_OVERRIDE ; 6 ; wVolume -VOLUME_SO1_F EQU 3 -VOLUME_SO2_F EQU 7 -VOLUME_SO1_LEVEL EQU %00000111 -VOLUME_SO2_LEVEL EQU %01110000 -MAX_VOLUME EQU $77 +DEF VOLUME_SO1_F EQU 3 +DEF VOLUME_SO2_F EQU 7 +DEF VOLUME_SO1_LEVEL EQU %00000111 +DEF VOLUME_SO2_LEVEL EQU %01110000 +DEF MAX_VOLUME EQU $77 ; wSoundInput -SOUND_INPUT_CH1_F EQU 0 -SOUND_INPUT_CH2_F EQU 1 -SOUND_INPUT_CH3_F EQU 2 -SOUND_INPUT_CH4_F EQU 3 -SOUND_INPUT_GLOBAL_F EQU 7 +DEF SOUND_INPUT_CH1_F EQU 0 +DEF SOUND_INPUT_CH2_F EQU 1 +DEF SOUND_INPUT_CH3_F EQU 2 +DEF SOUND_INPUT_CH4_F EQU 3 +DEF SOUND_INPUT_GLOBAL_F EQU 7 ; wLowHealthAlarm -DANGER_PITCH_F EQU 4 -DANGER_ON_F EQU 7 +DEF DANGER_PITCH_F EQU 4 +DEF DANGER_ON_F EQU 7 ; wMusicFade -MUSIC_FADE_IN_F EQU 7 +DEF MUSIC_FADE_IN_F EQU 7 diff --git a/constants/battle_anim_constants.asm b/constants/battle_anim_constants.asm index f0eaec914..8104ba041 100644 --- a/constants/battle_anim_constants.asm +++ b/constants/battle_anim_constants.asm @@ -1,32 +1,32 @@ ; battle_anim_struct members (see macros/wram.asm) rsreset -BATTLEANIMSTRUCT_INDEX rb -BATTLEANIMSTRUCT_OAMFLAGS rb -BATTLEANIMSTRUCT_FIX_Y rb -BATTLEANIMSTRUCT_FRAMESET_ID rb -BATTLEANIMSTRUCT_FUNCTION rb -BATTLEANIMSTRUCT_PALETTE rb -BATTLEANIMSTRUCT_TILEID rb -BATTLEANIMOBJ_LENGTH EQU _RS - 1 ; discount BATTLEANIMSTRUCT_INDEX -BATTLEANIMSTRUCT_XCOORD rb -BATTLEANIMSTRUCT_YCOORD rb -BATTLEANIMSTRUCT_XOFFSET rb -BATTLEANIMSTRUCT_YOFFSET rb -BATTLEANIMSTRUCT_PARAM rb -BATTLEANIMSTRUCT_DURATION rb -BATTLEANIMSTRUCT_FRAME rb -BATTLEANIMSTRUCT_JUMPTABLE_INDEX rb -BATTLEANIMSTRUCT_VAR1 rb -BATTLEANIMSTRUCT_VAR2 rb - rb_skip 7 -BATTLEANIMSTRUCT_LENGTH EQU _RS -NUM_ANIM_OBJECTS EQU 10 ; see wActiveAnimObjects +DEF BATTLEANIMSTRUCT_INDEX rb +DEF BATTLEANIMSTRUCT_OAMFLAGS rb +DEF BATTLEANIMSTRUCT_FIX_Y rb +DEF BATTLEANIMSTRUCT_FRAMESET_ID rb +DEF BATTLEANIMSTRUCT_FUNCTION rb +DEF BATTLEANIMSTRUCT_PALETTE rb +DEF BATTLEANIMSTRUCT_TILEID rb +DEF BATTLEANIMOBJ_LENGTH EQU _RS - 1 ; discount BATTLEANIMSTRUCT_INDEX +DEF BATTLEANIMSTRUCT_XCOORD rb +DEF BATTLEANIMSTRUCT_YCOORD rb +DEF BATTLEANIMSTRUCT_XOFFSET rb +DEF BATTLEANIMSTRUCT_YOFFSET rb +DEF BATTLEANIMSTRUCT_PARAM rb +DEF BATTLEANIMSTRUCT_DURATION rb +DEF BATTLEANIMSTRUCT_FRAME rb +DEF BATTLEANIMSTRUCT_JUMPTABLE_INDEX rb +DEF BATTLEANIMSTRUCT_VAR1 rb +DEF BATTLEANIMSTRUCT_VAR2 rb + rb_skip 7 +DEF BATTLEANIMSTRUCT_LENGTH EQU _RS +DEF NUM_ANIM_OBJECTS EQU 10 ; see wActiveAnimObjects ; wBattleAnimTileDict size (see wram.asm) -NUM_BATTLEANIMTILEDICT_ENTRIES EQU 5 +DEF NUM_BATTLEANIMTILEDICT_ENTRIES EQU 5 ; Start tile for battle animation graphics -BATTLEANIM_BASE_TILE EQU 7 * 7 ; Maximum size of a pokemon picture +DEF BATTLEANIM_BASE_TILE EQU 7 * 7 ; Maximum size of a pokemon picture ; BattleAnimObjects indexes (see data/battle_anims/objects.asm) const_def @@ -218,7 +218,7 @@ BATTLEANIM_BASE_TILE EQU 7 * 7 ; Maximum size of a pokemon picture const ANIM_OBJ_PLAYERHEAD_1ROW const ANIM_OBJ_ENEMYFEET_2ROW const ANIM_OBJ_PLAYERHEAD_2ROW -NUM_ANIM_OBJS EQU const_value +DEF NUM_ANIM_OBJS EQU const_value ; DoBattleAnimFrame arguments (see engine/battle_anims/functions.asm) const_def @@ -302,7 +302,7 @@ NUM_ANIM_OBJS EQU const_value const BATTLEANIMFUNC_ANCIENT_POWER const BATTLEANIMFUNC_ROCK_SMASH const BATTLEANIMFUNC_COTTON -NUM_BATTLEANIMFUNCS EQU const_value +DEF NUM_BATTLEANIMFUNCS EQU const_value ; BattleAnimFrameData indexes (see data/battle_anims/framesets.asm) const_def @@ -491,7 +491,7 @@ NUM_BATTLEANIMFUNCS EQU const_value const BATTLEANIMFRAMESET_B6 const BATTLEANIMFRAMESET_B7 const BATTLEANIMFRAMESET_B8 -NUM_BATTLEANIMFRAMESETS EQU const_value +DEF NUM_BATTLEANIMFRAMESETS EQU const_value ; BattleAnimOAMData indexes (see data/battle_anims/oam.asm) const_def @@ -711,7 +711,7 @@ NUM_BATTLEANIMFRAMESETS EQU const_value const BATTLEANIMOAMSET_D5 const BATTLEANIMOAMSET_D6 const BATTLEANIMOAMSET_D7 -NUM_BATTLEANIMOAMSETS EQU const_value +DEF NUM_BATTLEANIMOAMSETS EQU const_value ; BattleBGEffects indexes (see engine/battle_anims/bg_effects.asm) const_def 1 @@ -768,7 +768,7 @@ NUM_BATTLEANIMOAMSETS EQU const_value const ANIM_BG_VIBRATE_MON const ANIM_BG_WOBBLE_PLAYER const ANIM_BG_WOBBLE_SCREEN -NUM_ANIM_BGS EQU const_value - 1 +DEF NUM_ANIM_BGS EQU const_value - 1 ; wBattleAnimTileDict keys (see wram.asm) ; AnimObjGFX indexes (see data/battle_anims/object_gfx.asm) @@ -814,16 +814,16 @@ NUM_ANIM_BGS EQU const_value - 1 const ANIM_GFX_AEROBLAST const ANIM_GFX_PLAYERHEAD const ANIM_GFX_ENEMYFEET -NUM_ANIM_GFX EQU const_value - 1 +DEF NUM_ANIM_GFX EQU const_value - 1 ; battle_bg_effect struct members (see macros/wram.asm) rsreset -BG_EFFECT_STRUCT_FUNCTION rb -BG_EFFECT_STRUCT_JT_INDEX rb -BG_EFFECT_STRUCT_BATTLE_TURN rb -BG_EFFECT_STRUCT_PARAM rb -BG_EFFECT_STRUCT_LENGTH EQU _RS -NUM_BG_EFFECTS EQU 5 ; see wActiveBGEffects +DEF BG_EFFECT_STRUCT_FUNCTION rb +DEF BG_EFFECT_STRUCT_JT_INDEX rb +DEF BG_EFFECT_STRUCT_BATTLE_TURN rb +DEF BG_EFFECT_STRUCT_PARAM rb +DEF BG_EFFECT_STRUCT_LENGTH EQU _RS +DEF NUM_BG_EFFECTS EQU 5 ; see wActiveBGEffects ; anim_bgeffect battle turn values for some effects const_def diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index d39b45381..91a5cdf9f 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -1,31 +1,31 @@ ; significant level values -MAX_LEVEL EQU 100 -MIN_LEVEL EQU 2 -EGG_LEVEL EQU 5 +DEF MAX_LEVEL EQU 100 +DEF MIN_LEVEL EQU 2 +DEF EGG_LEVEL EQU 5 ; maximum moves known per mon -NUM_MOVES EQU 4 +DEF NUM_MOVES EQU 4 ; significant stat values -BASE_STAT_LEVEL EQU 7 -MAX_STAT_LEVEL EQU 13 +DEF BASE_STAT_LEVEL EQU 7 +DEF MAX_STAT_LEVEL EQU 13 ; turns that sleep lasts -REST_SLEEP_TURNS EQU 2 -TREEMON_SLEEP_TURNS EQU 7 +DEF REST_SLEEP_TURNS EQU 2 +DEF TREEMON_SLEEP_TURNS EQU 7 ; default move priority -BASE_PRIORITY EQU 1 +DEF BASE_PRIORITY EQU 1 ; type effectiveness factors, scaled by 10 -SUPER_EFFECTIVE EQU 20 -MORE_EFFECTIVE EQU 15 -EFFECTIVE EQU 10 -NOT_VERY_EFFECTIVE EQU 05 -NO_EFFECT EQU 00 +DEF SUPER_EFFECTIVE EQU 20 +DEF MORE_EFFECTIVE EQU 15 +DEF EFFECTIVE EQU 10 +DEF NOT_VERY_EFFECTIVE EQU 05 +DEF NO_EFFECT EQU 00 ; enemy AI behavior -BASE_AI_SWITCH_SCORE EQU 10 +DEF BASE_AI_SWITCH_SCORE EQU 10 ; wPlayerStatLevels and wEnemyStatLevels indexes (see wram.asm) ; GetStatName arguments (see data/battle/stat_names.asm) @@ -38,18 +38,18 @@ BASE_AI_SWITCH_SCORE EQU 10 const ACCURACY const EVASION const ABILITY ; used for BattleCommand_Curse -NUM_LEVEL_STATS EQU const_value +DEF NUM_LEVEL_STATS EQU const_value ; move struct members (see data/moves/moves.asm) rsreset -MOVE_ANIM rb ; 0 -MOVE_EFFECT rb ; 1 -MOVE_POWER rb ; 2 -MOVE_TYPE rb ; 3 -MOVE_ACC rb ; 4 -MOVE_PP rb ; 5 -MOVE_CHANCE rb ; 6 -MOVE_LENGTH EQU _RS +DEF MOVE_ANIM rb ; 0 +DEF MOVE_EFFECT rb ; 1 +DEF MOVE_POWER rb ; 2 +DEF MOVE_TYPE rb ; 3 +DEF MOVE_ACC rb ; 4 +DEF MOVE_PP rb ; 5 +DEF MOVE_CHANCE rb ; 6 +DEF MOVE_LENGTH EQU _RS ; stat constants ; indexes for: @@ -61,20 +61,20 @@ MOVE_LENGTH EQU _RS const STAT_DEF const STAT_SPD const STAT_SATK -NUM_EXP_STATS EQU const_value - 1 +DEF NUM_EXP_STATS EQU const_value - 1 const STAT_SDEF -NUM_STATS EQU const_value - 1 -NUM_BATTLE_STATS EQU NUM_STATS - 1 ; don't count HP +DEF NUM_STATS EQU const_value - 1 +DEF NUM_BATTLE_STATS EQU NUM_STATS - 1 ; don't count HP ; stat formula constants -STAT_MIN_NORMAL EQU 5 -STAT_MIN_HP EQU 10 +DEF STAT_MIN_NORMAL EQU 5 +DEF STAT_MIN_HP EQU 10 -MAX_STAT_VALUE EQU 999 +DEF MAX_STAT_VALUE EQU 999 ; shiny dvs -ATKDEFDV_SHINY EQU $EA -SPDSPCDV_SHINY EQU $AA +DEF ATKDEFDV_SHINY EQU $EA +DEF SPDSPCDV_SHINY EQU $AA ; battle classes (wBattleMode values) const_def 1 @@ -120,7 +120,7 @@ SPDSPCDV_SHINY EQU $AA const BATTLE_VARS_LAST_COUNTER_MOVE_OPP const BATTLE_VARS_LAST_MOVE const BATTLE_VARS_LAST_MOVE_OPP -NUM_BATTLE_VARS EQU const_value +DEF NUM_BATTLE_VARS EQU const_value ; BattleVarLocations indexes (see home/battle_vars.asm) const_def @@ -151,17 +151,17 @@ NUM_BATTLE_VARS EQU const_value const PLAYER_LAST_MOVE const ENEMY_LAST_MOVE assert const_value % 2 == 0 -NUM_BATTLE_VAR_LOCATION_PAIRS EQU const_value / 2 +DEF NUM_BATTLE_VAR_LOCATION_PAIRS EQU const_value / 2 ; status condition bit flags -SLP EQU %111 ; 0-7 turns +DEF SLP EQU %111 ; 0-7 turns const_def 3 const PSN const BRN const FRZ const PAR -ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP +DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP ; wPlayerSubStatus1 or wEnemySubStatus1 bit flags const_def @@ -260,10 +260,10 @@ ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP const LOSE const DRAW -BATTLERESULT_CAUGHT_CELEBI EQU 6 -BATTLERESULT_BOX_FULL EQU 7 -BATTLERESULT_BITMASK EQU (1 << BATTLERESULT_CAUGHT_CELEBI) | (1 << BATTLERESULT_BOX_FULL) +DEF BATTLERESULT_CAUGHT_CELEBI EQU 6 +DEF BATTLERESULT_BOX_FULL EQU 7 +DEF 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 +DEF LINK_BATTLE_RECORD_LENGTH EQU 2 + (NAME_LENGTH - 1) + 2 * 3 +DEF NUM_LINK_BATTLE_RECORDS EQU 5 diff --git a/constants/battle_tower_constants.asm b/constants/battle_tower_constants.asm index 844a38bbf..ca21172b4 100644 --- a/constants/battle_tower_constants.asm +++ b/constants/battle_tower_constants.asm @@ -1,11 +1,11 @@ -BATTLETOWER_PARTY_LENGTH EQU 3 -BATTLETOWER_STREAK_LENGTH EQU 7 +DEF BATTLETOWER_PARTY_LENGTH EQU 3 +DEF BATTLETOWER_STREAK_LENGTH EQU 7 -BATTLETOWER_NUM_UNIQUE_MON EQU 21 -BATTLETOWER_NUM_UNIQUE_TRAINERS EQU 70 +DEF BATTLETOWER_NUM_UNIQUE_MON EQU 21 +DEF BATTLETOWER_NUM_UNIQUE_TRAINERS EQU 70 -BATTLETOWER_TRAINERDATALENGTH EQU 18 * 2 ; $24 -BATTLE_TOWER_STRUCT_LENGTH EQU NAME_LENGTH + BATTLETOWER_PARTY_LENGTH * NICKNAMED_MON_STRUCT_LENGTH + BATTLETOWER_TRAINERDATALENGTH ; $e0 +DEF BATTLETOWER_TRAINERDATALENGTH EQU 18 * 2 ; $24 +DEF BATTLE_TOWER_STRUCT_LENGTH EQU NAME_LENGTH + BATTLETOWER_PARTY_LENGTH * NICKNAMED_MON_STRUCT_LENGTH + BATTLETOWER_TRAINERDATALENGTH ; $e0 ; BattleTowerAction setval arguments (see engine/events/battle_tower/battle_tower.asm) const_def @@ -44,7 +44,7 @@ BATTLE_TOWER_STRUCT_LENGTH EQU NAME_LENGTH + BATTLETOWER_PARTY_LENGTH * NICKNAME ; BattleTowerAction return values ; - from BATTLETOWERACTION_CHECKMOBILEEVENT -MOBILE_EVENT_OBJECT_GS_BALL EQU $b +DEF MOBILE_EVENT_OBJECT_GS_BALL EQU $b ; BattleTowerText arguments (see engine/events/battle_tower/trainer_text.asm) const_def 1 diff --git a/constants/collision_constants.asm b/constants/collision_constants.asm index 226f1a1fa..a183e8ca5 100644 --- a/constants/collision_constants.asm +++ b/constants/collision_constants.asm @@ -1,129 +1,129 @@ ; collision permissions (see data/collision/collision_permissions.asm) -LAND_TILE EQU $00 -WATER_TILE EQU $01 -WALL_TILE EQU $0f -TALK EQU $10 +DEF LAND_TILE EQU $00 +DEF WATER_TILE EQU $01 +DEF WALL_TILE EQU $0f +DEF TALK EQU $10 ; collision data types (see data/tilesets/*_collision.asm) ; TileCollisionTable indexes (see data/collision/collision_permissions.asm) -COLL_FLOOR EQU $00 -COLL_01 EQU $01 ; garbage -COLL_03 EQU $03 ; garbage -COLL_04 EQU $04 ; garbage -COLL_WALL EQU $07 -COLL_CUT_08 EQU $08 ; unused -COLL_TALL_GRASS_10 EQU $10 ; unused -COLL_CUT_TREE EQU $12 -COLL_LONG_GRASS EQU $14 -COLL_HEADBUTT_TREE EQU $15 -COLL_TALL_GRASS EQU $18 -COLL_CUT_TREE_1A EQU $1a ; unused -COLL_LONG_GRASS_1C EQU $1c ; unused -COLL_HEADBUTT_TREE_1D EQU $1d ; unused -COLL_WATER_21 EQU $21 ; unused -COLL_ICE EQU $23 -COLL_WHIRLPOOL EQU $24 -COLL_BUOY EQU $27 -COLL_CUT_28 EQU $28 ; garbage -COLL_WATER EQU $29 -COLL_ICE_2B EQU $2b ; unused -COLL_WHIRLPOOL_2C EQU $2c ; unused -COLL_WATERFALL_RIGHT EQU $30 ; unused -COLL_WATERFALL_LEFT EQU $31 ; unused -COLL_WATERFALL_UP EQU $32 ; unused -COLL_WATERFALL EQU $33 -COLL_CURRENT_RIGHT EQU $38 ; unused -COLL_CURRENT_LEFT EQU $39 ; unused -COLL_CURRENT_UP EQU $3a ; unused -COLL_CURRENT_DOWN EQU $3b ; unused -COLL_BRAKE EQU $40 ; unused -COLL_WALK_RIGHT EQU $41 ; unused -COLL_WALK_LEFT EQU $42 ; unused -COLL_WALK_UP EQU $43 ; unused -COLL_WALK_DOWN EQU $44 ; unused -COLL_BRAKE_45 EQU $45 ; garbage -COLL_BRAKE_46 EQU $46 ; unused -COLL_BRAKE_47 EQU $47 ; unused -COLL_GRASS_48 EQU $48 ; unused -COLL_GRASS_49 EQU $49 ; unused -COLL_GRASS_4A EQU $4a ; garbage -COLL_GRASS_4B EQU $4b ; garbage -COLL_GRASS_4C EQU $4c ; unused -COLL_WALK_RIGHT_ALT EQU $50 ; unused -COLL_WALK_LEFT_ALT EQU $51 ; unused -COLL_WALK_UP_ALT EQU $52 ; unused -COLL_WALK_DOWN_ALT EQU $53 ; unused -COLL_BRAKE_ALT EQU $54 ; unused -COLL_BRAKE_55 EQU $55 ; unused -COLL_BRAKE_56 EQU $56 ; unused -COLL_BRAKE_57 EQU $57 ; unused -COLL_5B EQU $5b ; garbage -COLL_PIT EQU $60 -COLL_VIRTUAL_BOY EQU $61 ; garbage -COLL_64 EQU $64 ; garbage -COLL_65 EQU $65 ; garbage -COLL_PIT_68 EQU $68 ; unused -COLL_WARP_CARPET_DOWN EQU $70 -COLL_DOOR EQU $71 -COLL_LADDER EQU $72 -COLL_STAIRCASE_73 EQU $73 ; unused -COLL_CAVE_74 EQU $74 ; unused -COLL_DOOR_75 EQU $75 ; unused -COLL_WARP_CARPET_LEFT EQU $76 -COLL_WARP_77 EQU $77 ; unused -COLL_WARP_CARPET_UP EQU $78 -COLL_DOOR_79 EQU $79 ; unused -COLL_STAIRCASE EQU $7a -COLL_CAVE EQU $7b -COLL_WARP_PANEL EQU $7c -COLL_DOOR_7D EQU $7d ; unused -COLL_WARP_CARPET_RIGHT EQU $7e -COLL_WARP_7F EQU $7f ; unused -COLL_COUNTER EQU $90 -COLL_BOOKSHELF EQU $91 -COLL_PC EQU $93 -COLL_RADIO EQU $94 -COLL_TOWN_MAP EQU $95 -COLL_MART_SHELF EQU $96 -COLL_TV EQU $97 -COLL_COUNTER_98 EQU $98 ; unused -COLL_9C EQU $9c ; garbage -COLL_WINDOW EQU $9d -COLL_INCENSE_BURNER EQU $9f -COLL_HOP_RIGHT EQU $a0 -COLL_HOP_LEFT EQU $a1 -COLL_HOP_UP EQU $a2 ; unused -COLL_HOP_DOWN EQU $a3 -COLL_HOP_DOWN_RIGHT EQU $a4 -COLL_HOP_DOWN_LEFT EQU $a5 -COLL_HOP_UP_RIGHT EQU $a6 ; unused -COLL_HOP_UP_LEFT EQU $a7 ; unused -COLL_RIGHT_WALL EQU $b0 -COLL_LEFT_WALL EQU $b1 -COLL_UP_WALL EQU $b2 -COLL_DOWN_WALL EQU $b3 ; unused -COLL_DOWN_RIGHT_WALL EQU $b4 ; unused -COLL_DOWN_LEFT_WALL EQU $b5 ; unused -COLL_UP_RIGHT_WALL EQU $b6 ; unused -COLL_UP_LEFT_WALL EQU $b7 ; unused -COLL_RIGHT_BUOY EQU $c0 ; unused -COLL_LEFT_BUOY EQU $c1 ; unused -COLL_UP_BUOY EQU $c2 ; unused -COLL_DOWN_BUOY EQU $c3 ; unused -COLL_DOWN_RIGHT_BUOY EQU $c4 ; unused -COLL_DOWN_LEFT_BUOY EQU $c5 ; unused -COLL_UP_RIGHT_BUOY EQU $c6 ; unused -COLL_UP_LEFT_BUOY EQU $c7 ; unused -COLL_FF EQU $ff ; garbage +DEF COLL_FLOOR EQU $00 +DEF COLL_01 EQU $01 ; garbage +DEF COLL_03 EQU $03 ; garbage +DEF COLL_04 EQU $04 ; garbage +DEF COLL_WALL EQU $07 +DEF COLL_CUT_08 EQU $08 ; unused +DEF COLL_TALL_GRASS_10 EQU $10 ; unused +DEF COLL_CUT_TREE EQU $12 +DEF COLL_LONG_GRASS EQU $14 +DEF COLL_HEADBUTT_TREE EQU $15 +DEF COLL_TALL_GRASS EQU $18 +DEF COLL_CUT_TREE_1A EQU $1a ; unused +DEF COLL_LONG_GRASS_1C EQU $1c ; unused +DEF COLL_HEADBUTT_TREE_1D EQU $1d ; unused +DEF COLL_WATER_21 EQU $21 ; unused +DEF COLL_ICE EQU $23 +DEF COLL_WHIRLPOOL EQU $24 +DEF COLL_BUOY EQU $27 +DEF COLL_CUT_28 EQU $28 ; garbage +DEF COLL_WATER EQU $29 +DEF COLL_ICE_2B EQU $2b ; unused +DEF COLL_WHIRLPOOL_2C EQU $2c ; unused +DEF COLL_WATERFALL_RIGHT EQU $30 ; unused +DEF COLL_WATERFALL_LEFT EQU $31 ; unused +DEF COLL_WATERFALL_UP EQU $32 ; unused +DEF COLL_WATERFALL EQU $33 +DEF COLL_CURRENT_RIGHT EQU $38 ; unused +DEF COLL_CURRENT_LEFT EQU $39 ; unused +DEF COLL_CURRENT_UP EQU $3a ; unused +DEF COLL_CURRENT_DOWN EQU $3b ; unused +DEF COLL_BRAKE EQU $40 ; unused +DEF COLL_WALK_RIGHT EQU $41 ; unused +DEF COLL_WALK_LEFT EQU $42 ; unused +DEF COLL_WALK_UP EQU $43 ; unused +DEF COLL_WALK_DOWN EQU $44 ; unused +DEF COLL_BRAKE_45 EQU $45 ; garbage +DEF COLL_BRAKE_46 EQU $46 ; unused +DEF COLL_BRAKE_47 EQU $47 ; unused +DEF COLL_GRASS_48 EQU $48 ; unused +DEF COLL_GRASS_49 EQU $49 ; unused +DEF COLL_GRASS_4A EQU $4a ; garbage +DEF COLL_GRASS_4B EQU $4b ; garbage +DEF COLL_GRASS_4C EQU $4c ; unused +DEF COLL_WALK_RIGHT_ALT EQU $50 ; unused +DEF COLL_WALK_LEFT_ALT EQU $51 ; unused +DEF COLL_WALK_UP_ALT EQU $52 ; unused +DEF COLL_WALK_DOWN_ALT EQU $53 ; unused +DEF COLL_BRAKE_ALT EQU $54 ; unused +DEF COLL_BRAKE_55 EQU $55 ; unused +DEF COLL_BRAKE_56 EQU $56 ; unused +DEF COLL_BRAKE_57 EQU $57 ; unused +DEF COLL_5B EQU $5b ; garbage +DEF COLL_PIT EQU $60 +DEF COLL_VIRTUAL_BOY EQU $61 ; garbage +DEF COLL_64 EQU $64 ; garbage +DEF COLL_65 EQU $65 ; garbage +DEF COLL_PIT_68 EQU $68 ; unused +DEF COLL_WARP_CARPET_DOWN EQU $70 +DEF COLL_DOOR EQU $71 +DEF COLL_LADDER EQU $72 +DEF COLL_STAIRCASE_73 EQU $73 ; unused +DEF COLL_CAVE_74 EQU $74 ; unused +DEF COLL_DOOR_75 EQU $75 ; unused +DEF COLL_WARP_CARPET_LEFT EQU $76 +DEF COLL_WARP_77 EQU $77 ; unused +DEF COLL_WARP_CARPET_UP EQU $78 +DEF COLL_DOOR_79 EQU $79 ; unused +DEF COLL_STAIRCASE EQU $7a +DEF COLL_CAVE EQU $7b +DEF COLL_WARP_PANEL EQU $7c +DEF COLL_DOOR_7D EQU $7d ; unused +DEF COLL_WARP_CARPET_RIGHT EQU $7e +DEF COLL_WARP_7F EQU $7f ; unused +DEF COLL_COUNTER EQU $90 +DEF COLL_BOOKSHELF EQU $91 +DEF COLL_PC EQU $93 +DEF COLL_RADIO EQU $94 +DEF COLL_TOWN_MAP EQU $95 +DEF COLL_MART_SHELF EQU $96 +DEF COLL_TV EQU $97 +DEF COLL_COUNTER_98 EQU $98 ; unused +DEF COLL_9C EQU $9c ; garbage +DEF COLL_WINDOW EQU $9d +DEF COLL_INCENSE_BURNER EQU $9f +DEF COLL_HOP_RIGHT EQU $a0 +DEF COLL_HOP_LEFT EQU $a1 +DEF COLL_HOP_UP EQU $a2 ; unused +DEF COLL_HOP_DOWN EQU $a3 +DEF COLL_HOP_DOWN_RIGHT EQU $a4 +DEF COLL_HOP_DOWN_LEFT EQU $a5 +DEF COLL_HOP_UP_RIGHT EQU $a6 ; unused +DEF COLL_HOP_UP_LEFT EQU $a7 ; unused +DEF COLL_RIGHT_WALL EQU $b0 +DEF COLL_LEFT_WALL EQU $b1 +DEF COLL_UP_WALL EQU $b2 +DEF COLL_DOWN_WALL EQU $b3 ; unused +DEF COLL_DOWN_RIGHT_WALL EQU $b4 ; unused +DEF COLL_DOWN_LEFT_WALL EQU $b5 ; unused +DEF COLL_UP_RIGHT_WALL EQU $b6 ; unused +DEF COLL_UP_LEFT_WALL EQU $b7 ; unused +DEF COLL_RIGHT_BUOY EQU $c0 ; unused +DEF COLL_LEFT_BUOY EQU $c1 ; unused +DEF COLL_UP_BUOY EQU $c2 ; unused +DEF COLL_DOWN_BUOY EQU $c3 ; unused +DEF COLL_DOWN_RIGHT_BUOY EQU $c4 ; unused +DEF COLL_DOWN_LEFT_BUOY EQU $c5 ; unused +DEF COLL_UP_RIGHT_BUOY EQU $c6 ; unused +DEF COLL_UP_LEFT_BUOY EQU $c7 ; unused +DEF COLL_FF EQU $ff ; garbage ; collision data type nybbles -LO_NYBBLE_GRASS EQU $07 -HI_NYBBLE_TALL_GRASS EQU $10 -HI_NYBBLE_WATER EQU $20 -HI_NYBBLE_CURRENT EQU $30 -HI_NYBBLE_WALK EQU $40 -HI_NYBBLE_WALK_ALT EQU $50 -HI_NYBBLE_WARPS EQU $70 -HI_NYBBLE_LEDGES EQU $a0 -HI_NYBBLE_SIDE_WALLS EQU $b0 -HI_NYBBLE_SIDE_BUOYS EQU $c0 +DEF LO_NYBBLE_GRASS EQU $07 +DEF HI_NYBBLE_TALL_GRASS EQU $10 +DEF HI_NYBBLE_WATER EQU $20 +DEF HI_NYBBLE_CURRENT EQU $30 +DEF HI_NYBBLE_WALK EQU $40 +DEF HI_NYBBLE_WALK_ALT EQU $50 +DEF HI_NYBBLE_WARPS EQU $70 +DEF HI_NYBBLE_LEDGES EQU $a0 +DEF HI_NYBBLE_SIDE_WALLS EQU $b0 +DEF HI_NYBBLE_SIDE_BUOYS EQU $c0 diff --git a/constants/credits_constants.asm b/constants/credits_constants.asm index 8be909a85..0fed374ea 100644 --- a/constants/credits_constants.asm +++ b/constants/credits_constants.asm @@ -103,7 +103,7 @@ const US_COORDINATION const TEXT_TRANSLATION const PAAD_TESTING -NUM_CREDITS_STRINGS EQU const_value +DEF NUM_CREDITS_STRINGS EQU const_value ; CreditsScript indexes (see data/credits_script.asm) const_def -1, -1 diff --git a/constants/cry_constants.asm b/constants/cry_constants.asm index 94db303a6..6b5aba63d 100644 --- a/constants/cry_constants.asm +++ b/constants/cry_constants.asm @@ -73,4 +73,4 @@ const CRY_DUNSPARCE const CRY_DONPHAN -NUM_CRIES EQU const_value +DEF NUM_CRIES EQU const_value diff --git a/constants/deco_constants.asm b/constants/deco_constants.asm index ce518e0ac..f877276f6 100644 --- a/constants/deco_constants.asm +++ b/constants/deco_constants.asm @@ -1,11 +1,11 @@ ; decoration attributes rsreset -DECOATTR_TYPE rb -DECOATTR_NAME rb -DECOATTR_ACTION rb -DECOATTR_EVENT_FLAG rw -DECOATTR_SPRITE rb -DECOATTR_STRUCT_LENGTH EQU _RS +DEF DECOATTR_TYPE rb +DEF DECOATTR_NAME rb +DEF DECOATTR_ACTION rb +DEF DECOATTR_EVENT_FLAG rw +DEF DECOATTR_SPRITE rb +DEF DECOATTR_STRUCT_LENGTH EQU _RS ; decoration types const_def 1 @@ -15,7 +15,7 @@ DECOATTR_STRUCT_LENGTH EQU _RS const DECO_POSTER const DECO_DOLL const DECO_BIGDOLL -NUM_DECO_TYPES EQU const_value - 1 +DEF NUM_DECO_TYPES EQU const_value - 1 ; DecorationNames indexes (see data/decorations/names.asm) const_def @@ -45,7 +45,7 @@ NUM_DECO_TYPES EQU const_value - 1 const BLUE_CARPET const YELLOW_CARPET const GREEN_CARPET -NUM_DECO_NAMES EQU const_value +DEF NUM_DECO_NAMES EQU const_value ; DoDecorationAction2.DecoActions indexes (see engine/overworld/decorations.asm) const_def 1 @@ -63,14 +63,14 @@ NUM_DECO_NAMES EQU const_value const PUT_AWAY_BIG_DOLL const SET_UP_DOLL const PUT_AWAY_DOLL -NUM_DECO_ACTIONS EQU const_value - 1 +DEF NUM_DECO_ACTIONS EQU const_value - 1 -__deco_value__ = 0 +DEF __deco_value__ = 0 -deco: MACRO +MACRO deco const DECO_\1 -DECOFLAG_\1 EQU __deco_value__ -__deco_value__ += 1 + DEF DECOFLAG_\1 EQU __deco_value__ + DEF __deco_value__ += 1 ENDM ; decorations: @@ -134,8 +134,8 @@ ENDM deco GEODUDE_DOLL deco MACHOP_DOLL deco TENTACOOL_DOLL -NUM_NON_TROPHY_DECOS EQU __deco_value__ +DEF NUM_NON_TROPHY_DECOS EQU __deco_value__ deco GOLD_TROPHY_DOLL deco SILVER_TROPHY_DOLL -NUM_DECOS EQU __deco_value__ -NUM_DECO_CATEGORIES EQU const_value - 1 - NUM_DECOS +DEF NUM_DECOS EQU __deco_value__ +DEF NUM_DECO_CATEGORIES EQU const_value - 1 - NUM_DECOS diff --git a/constants/engine_flags.asm b/constants/engine_flags.asm index a93e58121..bc029d5cd 100644 --- a/constants/engine_flags.asm +++ b/constants/engine_flags.asm @@ -187,4 +187,4 @@ ; wSwarmFlags const ENGINE_DUNSPARCE_SWARM const ENGINE_YANMA_SWARM -NUM_ENGINE_FLAGS EQU const_value +DEF NUM_ENGINE_FLAGS EQU const_value diff --git a/constants/event_flags.asm b/constants/event_flags.asm index f4541e46f..f4428ec1f 100644 --- a/constants/event_flags.asm +++ b/constants/event_flags.asm @@ -1459,4 +1459,4 @@ ; Unused: next 48 events const_next 2048 -NUM_EVENTS EQU const_value ; 800 +DEF NUM_EVENTS EQU const_value ; 800 diff --git a/constants/gfx_constants.asm b/constants/gfx_constants.asm index 7785d18f9..2fdc15a9a 100644 --- a/constants/gfx_constants.asm +++ b/constants/gfx_constants.asm @@ -1,48 +1,48 @@ -TILE_WIDTH EQU 8 ; pixels -LEN_1BPP_TILE EQU 1 * TILE_WIDTH ; bytes -LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes +DEF TILE_WIDTH EQU 8 ; pixels +DEF LEN_1BPP_TILE EQU 1 * TILE_WIDTH ; bytes +DEF LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes -NUM_PAL_COLORS EQU 4 -PAL_COLOR_SIZE EQU 2 -PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE +DEF NUM_PAL_COLORS EQU 4 +DEF PAL_COLOR_SIZE EQU 2 +DEF PALETTE_SIZE EQU NUM_PAL_COLORS * PAL_COLOR_SIZE -PALRGB_WHITE EQU palred 31 + palgreen 31 + palblue 31 ; $7fff +DEF PALRGB_WHITE EQU palred 31 + palgreen 31 + palblue 31 ; $7fff -SCREEN_WIDTH EQU 20 ; tiles -SCREEN_HEIGHT EQU 18 ; tiles -SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels -SCREEN_HEIGHT_PX EQU SCREEN_HEIGHT * TILE_WIDTH ; pixels +DEF SCREEN_WIDTH EQU 20 ; tiles +DEF SCREEN_HEIGHT EQU 18 ; tiles +DEF SCREEN_WIDTH_PX EQU SCREEN_WIDTH * TILE_WIDTH ; pixels +DEF SCREEN_HEIGHT_PX EQU SCREEN_HEIGHT * TILE_WIDTH ; pixels -BG_MAP_WIDTH EQU 32 ; tiles -BG_MAP_HEIGHT EQU 32 ; tiles +DEF BG_MAP_WIDTH EQU 32 ; tiles +DEF BG_MAP_HEIGHT EQU 32 ; tiles -METATILE_WIDTH EQU 4 ; tiles -SCREEN_META_WIDTH EQU 6 ; metatiles -SCREEN_META_HEIGHT EQU 5 ; metatiles -SURROUNDING_WIDTH EQU SCREEN_META_WIDTH * METATILE_WIDTH ; tiles -SURROUNDING_HEIGHT EQU SCREEN_META_HEIGHT * METATILE_WIDTH ; tiles -MAP_CONNECTION_PADDING_WIDTH EQU 3 ; metatiles +DEF METATILE_WIDTH EQU 4 ; tiles +DEF SCREEN_META_WIDTH EQU 6 ; metatiles +DEF SCREEN_META_HEIGHT EQU 5 ; metatiles +DEF SURROUNDING_WIDTH EQU SCREEN_META_WIDTH * METATILE_WIDTH ; tiles +DEF SURROUNDING_HEIGHT EQU SCREEN_META_HEIGHT * METATILE_WIDTH ; tiles +DEF MAP_CONNECTION_PADDING_WIDTH EQU 3 ; metatiles -HP_BAR_LENGTH EQU 6 ; tiles -EXP_BAR_LENGTH EQU 8 ; tiles -HP_BAR_LENGTH_PX EQU HP_BAR_LENGTH * TILE_WIDTH ; pixels -EXP_BAR_LENGTH_PX EQU EXP_BAR_LENGTH * TILE_WIDTH ; pixels +DEF HP_BAR_LENGTH EQU 6 ; tiles +DEF EXP_BAR_LENGTH EQU 8 ; tiles +DEF HP_BAR_LENGTH_PX EQU HP_BAR_LENGTH * TILE_WIDTH ; pixels +DEF EXP_BAR_LENGTH_PX EQU EXP_BAR_LENGTH * TILE_WIDTH ; pixels ; GetHPPal return values (see home/tilemap.asm) -HP_GREEN EQU 0 -HP_YELLOW EQU 1 -HP_RED EQU 2 +DEF HP_GREEN EQU 0 +DEF HP_YELLOW EQU 1 +DEF HP_RED EQU 2 ; sprite_oam_struct members (see macros/wram.asm) rsreset -SPRITEOAMSTRUCT_YCOORD rb ; 0 -SPRITEOAMSTRUCT_XCOORD rb ; 1 -SPRITEOAMSTRUCT_TILE_ID rb ; 2 -SPRITEOAMSTRUCT_ATTRIBUTES rb ; 3 -SPRITEOAMSTRUCT_LENGTH EQU _RS -NUM_SPRITE_OAM_STRUCTS EQU 40 ; see wVirtualOAM +DEF SPRITEOAMSTRUCT_YCOORD rb ; 0 +DEF SPRITEOAMSTRUCT_XCOORD rb ; 1 +DEF SPRITEOAMSTRUCT_TILE_ID rb ; 2 +DEF SPRITEOAMSTRUCT_ATTRIBUTES rb ; 3 +DEF SPRITEOAMSTRUCT_LENGTH EQU _RS +DEF NUM_SPRITE_OAM_STRUCTS EQU 40 ; see wVirtualOAM -SPRITE_GFX_LIST_CAPACITY EQU 32 ; see wUsedSprites +DEF SPRITE_GFX_LIST_CAPACITY EQU 32 ; see wUsedSprites ; PokeAnims indexes (see engine/gfx/pic_animation.asm) const_def diff --git a/constants/hardware_constants.asm b/constants/hardware_constants.asm index 634bebfcf..73acb10f3 100644 --- a/constants/hardware_constants.asm +++ b/constants/hardware_constants.asm @@ -4,165 +4,165 @@ ; http://gameboy.mongenel.com/dmg/asmmemmap.html ; memory map -VRAM_Begin EQU $8000 -VRAM_End EQU $a000 -SRAM_Begin EQU $a000 -SRAM_End EQU $c000 -WRAM0_Begin EQU $c000 -WRAM0_End EQU $d000 -WRAM1_Begin EQU $d000 -WRAM1_End EQU $e000 +DEF VRAM_Begin EQU $8000 +DEF VRAM_End EQU $a000 +DEF SRAM_Begin EQU $a000 +DEF SRAM_End EQU $c000 +DEF WRAM0_Begin EQU $c000 +DEF WRAM0_End EQU $d000 +DEF WRAM1_Begin EQU $d000 +DEF WRAM1_End EQU $e000 ; hardware registers $ff00-$ff80 (see below) -HRAM_Begin EQU $ff80 -HRAM_End EQU $ffff +DEF HRAM_Begin EQU $ff80 +DEF HRAM_End EQU $ffff ; MBC3 -MBC3SRamEnable EQU $0000 -MBC3RomBank EQU $2000 -MBC3SRamBank EQU $4000 -MBC3LatchClock EQU $6000 -MBC3RTC EQU $a000 +DEF MBC3SRamEnable EQU $0000 +DEF MBC3RomBank EQU $2000 +DEF MBC3SRamBank EQU $4000 +DEF MBC3LatchClock EQU $6000 +DEF MBC3RTC EQU $a000 -SRAM_DISABLE EQU $00 -SRAM_ENABLE EQU $0a +DEF SRAM_DISABLE EQU $00 +DEF SRAM_ENABLE EQU $0a -NUM_SRAM_BANKS EQU 4 +DEF NUM_SRAM_BANKS EQU 4 -RTC_S EQU $08 ; Seconds 0-59 (0-3Bh) -RTC_M EQU $09 ; Minutes 0-59 (0-3Bh) -RTC_H EQU $0a ; Hours 0-23 (0-17h) -RTC_DL EQU $0b ; Lower 8 bits of Day Counter (0-FFh) -RTC_DH EQU $0c ; Upper 1 bit of Day Counter, Carry Bit, Halt Flag - ; Bit 0 Most significant bit of Day Counter (Bit 8) - ; Bit 6 Halt (0=Active, 1=Stop Timer) - ; Bit 7 Day Counter Carry Bit (1=Counter Overflow) +DEF RTC_S EQU $08 ; Seconds 0-59 (0-3Bh) +DEF RTC_M EQU $09 ; Minutes 0-59 (0-3Bh) +DEF RTC_H EQU $0a ; Hours 0-23 (0-17h) +DEF RTC_DL EQU $0b ; Lower 8 bits of Day Counter (0-FFh) +DEF RTC_DH EQU $0c ; Upper 1 bit of Day Counter, Carry Bit, Halt Flag + ; Bit 0 Most significant bit of Day Counter (Bit 8) + ; Bit 6 Halt (0=Active, 1=Stop Timer) + ; Bit 7 Day Counter Carry Bit (1=Counter Overflow) ; interrupt flags -VBLANK EQU 0 -LCD_STAT EQU 1 -TIMER EQU 2 -SERIAL EQU 3 -JOYPAD EQU 4 -IE_DEFAULT EQU (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) +DEF VBLANK EQU 0 +DEF LCD_STAT EQU 1 +DEF TIMER EQU 2 +DEF SERIAL EQU 3 +DEF JOYPAD EQU 4 +DEF IE_DEFAULT EQU (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) ; OAM attribute flags -OAM_TILE_BANK EQU 3 -OAM_OBP_NUM EQU 4 ; non CGB Mode Only -OAM_X_FLIP EQU 5 -OAM_Y_FLIP EQU 6 -OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) +DEF OAM_TILE_BANK EQU 3 +DEF OAM_OBP_NUM EQU 4 ; non CGB Mode Only +DEF OAM_X_FLIP EQU 5 +DEF OAM_Y_FLIP EQU 6 +DEF OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3) ; BG Map attribute flags -PALETTE_MASK EQU %111 -VRAM_BANK_1 EQU 1 << OAM_TILE_BANK ; $08 -OBP_NUM EQU 1 << OAM_OBP_NUM ; $10 -X_FLIP EQU 1 << OAM_X_FLIP ; $20 -Y_FLIP EQU 1 << OAM_Y_FLIP ; $40 -PRIORITY EQU 1 << OAM_PRIORITY ; $80 +DEF PALETTE_MASK EQU %111 +DEF VRAM_BANK_1 EQU 1 << OAM_TILE_BANK ; $08 +DEF OBP_NUM EQU 1 << OAM_OBP_NUM ; $10 +DEF X_FLIP EQU 1 << OAM_X_FLIP ; $20 +DEF Y_FLIP EQU 1 << OAM_Y_FLIP ; $40 +DEF PRIORITY EQU 1 << OAM_PRIORITY ; $80 ; Hardware registers -rJOYP EQU $ff00 ; Joypad (R/W) -rSB EQU $ff01 ; Serial transfer data (R/W) -rSC EQU $ff02 ; Serial Transfer Control (R/W) -rSC_ON EQU 7 -rSC_CGB EQU 1 -rSC_CLOCK EQU 0 -rDIV EQU $ff04 ; Divider Register (R/W) -rTIMA EQU $ff05 ; Timer counter (R/W) -rTMA EQU $ff06 ; Timer Modulo (R/W) -rTAC EQU $ff07 ; Timer Control (R/W) -rTAC_ON EQU 2 -rTAC_4096_HZ EQU %00 -rTAC_262144_HZ EQU %01 -rTAC_65536_HZ EQU %10 -rTAC_16384_HZ EQU %11 -rIF EQU $ff0f ; Interrupt Flag (R/W) -rNR10 EQU $ff10 ; Channel 1 Sweep register (R/W) -rNR11 EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W) -rNR12 EQU $ff12 ; Channel 1 Volume Envelope (R/W) -rNR13 EQU $ff13 ; Channel 1 Frequency lo (Write Only) -rNR14 EQU $ff14 ; Channel 1 Frequency hi (R/W) -rNR20 EQU $ff15 ; Channel 2 Sweep register (R/W) -rNR21 EQU $ff16 ; Channel 2 Sound Length/Wave Pattern Duty (R/W) -rNR22 EQU $ff17 ; Channel 2 Volume Envelope (R/W) -rNR23 EQU $ff18 ; Channel 2 Frequency lo data (W) -rNR24 EQU $ff19 ; Channel 2 Frequency hi data (R/W) -rNR30 EQU $ff1a ; Channel 3 Sound on/off (R/W) -rNR31 EQU $ff1b ; Channel 3 Sound Length -rNR32 EQU $ff1c ; Channel 3 Select output level (R/W) -rNR33 EQU $ff1d ; Channel 3 Frequency's lower data (W) -rNR34 EQU $ff1e ; Channel 3 Frequency's higher data (R/W) -rNR40 EQU $ff1f ; Channel 4 Sweep register (R/W) -rNR41 EQU $ff20 ; Channel 4 Sound Length (R/W) -rNR42 EQU $ff21 ; Channel 4 Volume Envelope (R/W) -rNR43 EQU $ff22 ; Channel 4 Polynomial Counter (R/W) -rNR44 EQU $ff23 ; Channel 4 Counter/consecutive; Inital (R/W) -rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W) -rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W) -rNR52 EQU $ff26 ; Sound on/off -rWave_0 EQU $ff30 -rWave_1 EQU $ff31 -rWave_2 EQU $ff32 -rWave_3 EQU $ff33 -rWave_4 EQU $ff34 -rWave_5 EQU $ff35 -rWave_6 EQU $ff36 -rWave_7 EQU $ff37 -rWave_8 EQU $ff38 -rWave_9 EQU $ff39 -rWave_a EQU $ff3a -rWave_b EQU $ff3b -rWave_c EQU $ff3c -rWave_d EQU $ff3d -rWave_e EQU $ff3e -rWave_f EQU $ff3f -rLCDC EQU $ff40 ; LCD Control (R/W) -rLCDC_BG_PRIORITY EQU 0 ; 0=Off, 1=On -rLCDC_SPRITES_ENABLE EQU 1 ; 0=Off, 1=On -rLCDC_SPRITE_SIZE EQU 2 ; 0=8x8, 1=8x16 -rLCDC_BG_TILEMAP EQU 3 ; 0=9800-9BFF, 1=9C00-9FFF -rLCDC_TILE_DATA EQU 4 ; 0=8800-97FF, 1=8000-8FFF -rLCDC_WINDOW_ENABLE EQU 5 ; 0=Off, 1=On -rLCDC_WINDOW_TILEMAP EQU 6 ; 0=9800-9BFF, 1=9C00-9FFF -rLCDC_ENABLE EQU 7 ; 0=Off, 1=On -LCDC_DEFAULT EQU (1 << rLCDC_ENABLE) | (1 << rLCDC_WINDOW_TILEMAP) | (1 << rLCDC_WINDOW_ENABLE) | (1 << rLCDC_SPRITES_ENABLE) | (1 << rLCDC_BG_PRIORITY) -rSTAT EQU $ff41 ; LCDC Status (R/W) -rSCY EQU $ff42 ; Scroll Y (R/W) -rSCX EQU $ff43 ; Scroll X (R/W) -rLY EQU $ff44 ; LCDC Y-Coordinate (R) -LY_VBLANK EQU 144 -rLYC EQU $ff45 ; LY Compare (R/W) -rDMA EQU $ff46 ; DMA Transfer and Start Address (W) -rBGP EQU $ff47 ; BG Palette Data (R/W) - Non CGB Mode Only -rOBP0 EQU $ff48 ; Object Palette 0 Data (R/W) - Non CGB Mode Only -rOBP1 EQU $ff49 ; Object Palette 1 Data (R/W) - Non CGB Mode Only -rWY EQU $ff4a ; Window Y Position (R/W) -rWX EQU $ff4b ; Window X Position minus 7 (R/W) -rLCDMODE EQU $ff4c -rKEY1 EQU $ff4d ; CGB Mode Only - Prepare Speed Switch -rVBK EQU $ff4f ; CGB Mode Only - VRAM Bank -rBLCK EQU $ff50 -rHDMA1 EQU $ff51 ; CGB Mode Only - New DMA Source, High -rHDMA2 EQU $ff52 ; CGB Mode Only - New DMA Source, Low -rHDMA3 EQU $ff53 ; CGB Mode Only - New DMA Destination, High -rHDMA4 EQU $ff54 ; CGB Mode Only - New DMA Destination, Low -rHDMA5 EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start -rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port -rRP_LED_ON EQU 0 -rRP_RECEIVING EQU 1 -rRP_ENABLE_READ_MASK EQU %11000000 -rBGPI EQU $ff68 ; CGB Mode Only - Background Palette Index -rBGPI_AUTO_INCREMENT EQU 7 ; increment rBGPI after write to rBGPD -rBGPD EQU $ff69 ; CGB Mode Only - Background Palette Data -rOBPI EQU $ff6a ; CGB Mode Only - Sprite Palette Index -rOBPI_AUTO_INCREMENT EQU 7 ; increment rOBPI after write to rOBPD -rOBPD EQU $ff6b ; CGB Mode Only - Sprite Palette Data -rUNKNOWN1 EQU $ff6c ; (FEh) Bit 0 (Read/Write) - CGB Mode Only -rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank -rUNKNOWN2 EQU $ff72 ; (00h) - Bit 0-7 (Read/Write) -rUNKNOWN3 EQU $ff73 ; (00h) - Bit 0-7 (Read/Write) -rUNKNOWN4 EQU $ff74 ; (00h) - Bit 0-7 (Read/Write) - CGB Mode Only -rUNKNOWN5 EQU $ff75 ; (8Fh) - Bit 4-6 (Read/Write) -rUNKNOWN6 EQU $ff76 ; (00h) - Always 00h (Read Only) -rUNKNOWN7 EQU $ff77 ; (00h) - Always 00h (Read Only) -rIE EQU $ffff ; Interrupt Enable (R/W) +DEF rJOYP EQU $ff00 ; Joypad (R/W) +DEF rSB EQU $ff01 ; Serial transfer data (R/W) +DEF rSC EQU $ff02 ; Serial Transfer Control (R/W) +DEF rSC_ON EQU 7 +DEF rSC_CGB EQU 1 +DEF rSC_CLOCK EQU 0 +DEF rDIV EQU $ff04 ; Divider Register (R/W) +DEF rTIMA EQU $ff05 ; Timer counter (R/W) +DEF rTMA EQU $ff06 ; Timer Modulo (R/W) +DEF rTAC EQU $ff07 ; Timer Control (R/W) +DEF rTAC_ON EQU 2 +DEF rTAC_4096_HZ EQU %00 +DEF rTAC_262144_HZ EQU %01 +DEF rTAC_65536_HZ EQU %10 +DEF rTAC_16384_HZ EQU %11 +DEF rIF EQU $ff0f ; Interrupt Flag (R/W) +DEF rNR10 EQU $ff10 ; Channel 1 Sweep register (R/W) +DEF rNR11 EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W) +DEF rNR12 EQU $ff12 ; Channel 1 Volume Envelope (R/W) +DEF rNR13 EQU $ff13 ; Channel 1 Frequency lo (Write Only) +DEF rNR14 EQU $ff14 ; Channel 1 Frequency hi (R/W) +DEF rNR20 EQU $ff15 ; Channel 2 Sweep register (R/W) +DEF rNR21 EQU $ff16 ; Channel 2 Sound Length/Wave Pattern Duty (R/W) +DEF rNR22 EQU $ff17 ; Channel 2 Volume Envelope (R/W) +DEF rNR23 EQU $ff18 ; Channel 2 Frequency lo data (W) +DEF rNR24 EQU $ff19 ; Channel 2 Frequency hi data (R/W) +DEF rNR30 EQU $ff1a ; Channel 3 Sound on/off (R/W) +DEF rNR31 EQU $ff1b ; Channel 3 Sound Length +DEF rNR32 EQU $ff1c ; Channel 3 Select output level (R/W) +DEF rNR33 EQU $ff1d ; Channel 3 Frequency's lower data (W) +DEF rNR34 EQU $ff1e ; Channel 3 Frequency's higher data (R/W) +DEF rNR40 EQU $ff1f ; Channel 4 Sweep register (R/W) +DEF rNR41 EQU $ff20 ; Channel 4 Sound Length (R/W) +DEF rNR42 EQU $ff21 ; Channel 4 Volume Envelope (R/W) +DEF rNR43 EQU $ff22 ; Channel 4 Polynomial Counter (R/W) +DEF rNR44 EQU $ff23 ; Channel 4 Counter/consecutive; Inital (R/W) +DEF rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W) +DEF rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W) +DEF rNR52 EQU $ff26 ; Sound on/off +DEF rWave_0 EQU $ff30 +DEF rWave_1 EQU $ff31 +DEF rWave_2 EQU $ff32 +DEF rWave_3 EQU $ff33 +DEF rWave_4 EQU $ff34 +DEF rWave_5 EQU $ff35 +DEF rWave_6 EQU $ff36 +DEF rWave_7 EQU $ff37 +DEF rWave_8 EQU $ff38 +DEF rWave_9 EQU $ff39 +DEF rWave_a EQU $ff3a +DEF rWave_b EQU $ff3b +DEF rWave_c EQU $ff3c +DEF rWave_d EQU $ff3d +DEF rWave_e EQU $ff3e +DEF rWave_f EQU $ff3f +DEF rLCDC EQU $ff40 ; LCD Control (R/W) +DEF rLCDC_BG_PRIORITY EQU 0 ; 0=Off, 1=On +DEF rLCDC_SPRITES_ENABLE EQU 1 ; 0=Off, 1=On +DEF rLCDC_SPRITE_SIZE EQU 2 ; 0=8x8, 1=8x16 +DEF rLCDC_BG_TILEMAP EQU 3 ; 0=9800-9BFF, 1=9C00-9FFF +DEF rLCDC_TILE_DATA EQU 4 ; 0=8800-97FF, 1=8000-8FFF +DEF rLCDC_WINDOW_ENABLE EQU 5 ; 0=Off, 1=On +DEF rLCDC_WINDOW_TILEMAP EQU 6 ; 0=9800-9BFF, 1=9C00-9FFF +DEF rLCDC_ENABLE EQU 7 ; 0=Off, 1=On +DEF LCDC_DEFAULT EQU (1 << rLCDC_ENABLE) | (1 << rLCDC_WINDOW_TILEMAP) | (1 << rLCDC_WINDOW_ENABLE) | (1 << rLCDC_SPRITES_ENABLE) | (1 << rLCDC_BG_PRIORITY) +DEF rSTAT EQU $ff41 ; LCDC Status (R/W) +DEF rSCY EQU $ff42 ; Scroll Y (R/W) +DEF rSCX EQU $ff43 ; Scroll X (R/W) +DEF rLY EQU $ff44 ; LCDC Y-Coordinate (R) +DEF LY_VBLANK EQU 144 +DEF rLYC EQU $ff45 ; LY Compare (R/W) +DEF rDMA EQU $ff46 ; DMA Transfer and Start Address (W) +DEF rBGP EQU $ff47 ; BG Palette Data (R/W) - Non CGB Mode Only +DEF rOBP0 EQU $ff48 ; Object Palette 0 Data (R/W) - Non CGB Mode Only +DEF rOBP1 EQU $ff49 ; Object Palette 1 Data (R/W) - Non CGB Mode Only +DEF rWY EQU $ff4a ; Window Y Position (R/W) +DEF rWX EQU $ff4b ; Window X Position minus 7 (R/W) +DEF rLCDMODE EQU $ff4c +DEF rKEY1 EQU $ff4d ; CGB Mode Only - Prepare Speed Switch +DEF rVBK EQU $ff4f ; CGB Mode Only - VRAM Bank +DEF rBLCK EQU $ff50 +DEF rHDMA1 EQU $ff51 ; CGB Mode Only - New DMA Source, High +DEF rHDMA2 EQU $ff52 ; CGB Mode Only - New DMA Source, Low +DEF rHDMA3 EQU $ff53 ; CGB Mode Only - New DMA Destination, High +DEF rHDMA4 EQU $ff54 ; CGB Mode Only - New DMA Destination, Low +DEF rHDMA5 EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start +DEF rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port +DEF rRP_LED_ON EQU 0 +DEF rRP_RECEIVING EQU 1 +DEF rRP_ENABLE_READ_MASK EQU %11000000 +DEF rBGPI EQU $ff68 ; CGB Mode Only - Background Palette Index +DEF rBGPI_AUTO_INCREMENT EQU 7 ; increment rBGPI after write to rBGPD +DEF rBGPD EQU $ff69 ; CGB Mode Only - Background Palette Data +DEF rOBPI EQU $ff6a ; CGB Mode Only - Sprite Palette Index +DEF rOBPI_AUTO_INCREMENT EQU 7 ; increment rOBPI after write to rOBPD +DEF rOBPD EQU $ff6b ; CGB Mode Only - Sprite Palette Data +DEF rUNKNOWN1 EQU $ff6c ; (FEh) Bit 0 (Read/Write) - CGB Mode Only +DEF rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank +DEF rUNKNOWN2 EQU $ff72 ; (00h) - Bit 0-7 (Read/Write) +DEF rUNKNOWN3 EQU $ff73 ; (00h) - Bit 0-7 (Read/Write) +DEF rUNKNOWN4 EQU $ff74 ; (00h) - Bit 0-7 (Read/Write) - CGB Mode Only +DEF rUNKNOWN5 EQU $ff75 ; (8Fh) - Bit 4-6 (Read/Write) +DEF rUNKNOWN6 EQU $ff76 ; (00h) - Always 00h (Read Only) +DEF rUNKNOWN7 EQU $ff77 ; (00h) - Always 00h (Read Only) +DEF rIE EQU $ffff ; Interrupt Enable (R/W) diff --git a/constants/icon_constants.asm b/constants/icon_constants.asm index d4fbf28c0..8877c8bd3 100644 --- a/constants/icon_constants.asm +++ b/constants/icon_constants.asm @@ -39,7 +39,7 @@ const ICON_SLOWPOKE const ICON_SUDOWOODO const ICON_BIGMON -NUM_ICONS EQU const_value - 1 +DEF NUM_ICONS EQU const_value - 1 ; LoadMenuMonIcon.Jumptable indexes (see engine/gfx/mon_icons.asm) const_def diff --git a/constants/input_constants.asm b/constants/input_constants.asm index 3042c3f89..531975832 100644 --- a/constants/input_constants.asm +++ b/constants/input_constants.asm @@ -9,18 +9,18 @@ const D_UP_F ; 6 const D_DOWN_F ; 7 -NO_INPUT EQU %00000000 -A_BUTTON EQU 1 << A_BUTTON_F -B_BUTTON EQU 1 << B_BUTTON_F -SELECT EQU 1 << SELECT_F -START EQU 1 << START_F -D_RIGHT EQU 1 << D_RIGHT_F -D_LEFT EQU 1 << D_LEFT_F -D_UP EQU 1 << D_UP_F -D_DOWN EQU 1 << D_DOWN_F +DEF NO_INPUT EQU %00000000 +DEF A_BUTTON EQU 1 << A_BUTTON_F +DEF B_BUTTON EQU 1 << B_BUTTON_F +DEF SELECT EQU 1 << SELECT_F +DEF START EQU 1 << START_F +DEF D_RIGHT EQU 1 << D_RIGHT_F +DEF D_LEFT EQU 1 << D_LEFT_F +DEF D_UP EQU 1 << D_UP_F +DEF D_DOWN EQU 1 << D_DOWN_F -BUTTONS EQU A_BUTTON | B_BUTTON | SELECT | START -D_PAD EQU D_RIGHT | D_LEFT | D_UP | D_DOWN +DEF BUTTONS EQU A_BUTTON | B_BUTTON | SELECT | START +DEF D_PAD EQU D_RIGHT | D_LEFT | D_UP | D_DOWN -R_DPAD EQU %00100000 -R_BUTTONS EQU %00010000 +DEF R_DPAD EQU %00100000 +DEF R_BUTTONS EQU %00010000 diff --git a/constants/item_constants.asm b/constants/item_constants.asm index f3c3ea784..5b6159272 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -196,16 +196,16 @@ const MUSIC_MAIL ; bc const MIRAGE_MAIL ; bd const ITEM_BE ; be -NUM_ITEMS EQU const_value - 1 +DEF NUM_ITEMS EQU const_value - 1 -__tmhm_value__ = 1 +DEF __tmhm_value__ = 1 -add_tmnum: MACRO -\1_TMNUM EQU __tmhm_value__ -__tmhm_value__ += 1 +MACRO add_tmnum + DEF \1_TMNUM EQU __tmhm_value__ + DEF __tmhm_value__ += 1 ENDM -add_tm: MACRO +MACRO add_tm ; Defines three constants: ; - TM_\1: the item id, starting at $bf ; - \1_TMNUM: the learnable TM/HM flag, starting at 1 @@ -216,7 +216,7 @@ TM{02d:__tmhm_value__}_MOVE = \1 ENDM ; see data/moves/tmhm_moves.asm for moves -TM01 EQU const_value +DEF TM01 EQU const_value add_tm DYNAMICPUNCH ; bf add_tm HEADBUTT ; c0 add_tm CURSE ; c1 @@ -269,20 +269,20 @@ TM01 EQU const_value add_tm FIRE_PUNCH ; f0 add_tm FURY_CUTTER ; f1 add_tm NIGHTMARE ; f2 -NUM_TMS EQU __tmhm_value__ - 1 +DEF NUM_TMS EQU __tmhm_value__ - 1 -add_hm: MACRO +MACRO add_hm ; Defines three constants: ; - HM_\1: the item id, starting at $f3 ; - \1_TMNUM: the learnable TM/HM flag, starting at 51 ; - HM##_MOVE: alias for the move id, equal to the value of \1 const HM_\1 -HM_VALUE = __tmhm_value__ - NUM_TMS -HM{02d:HM_VALUE}_MOVE = \1 + DEF HM_VALUE = __tmhm_value__ - NUM_TMS + DEF HM{02d:HM_VALUE}_MOVE = \1 add_tmnum \1 ENDM -HM01 EQU const_value +DEF HM01 EQU const_value add_hm CUT ; f3 add_hm FLY ; f4 add_hm SURF ; f5 @@ -290,31 +290,31 @@ HM01 EQU const_value add_hm FLASH ; f7 add_hm WHIRLPOOL ; f8 add_hm WATERFALL ; f9 -NUM_HMS EQU __tmhm_value__ - NUM_TMS - 1 +DEF NUM_HMS EQU __tmhm_value__ - NUM_TMS - 1 -add_mt: MACRO +MACRO add_mt ; Defines two constants: ; - \1_TMNUM: the learnable TM/HM flag, starting at 58 ; - MT##_MOVE: alias for the move id, equal to the value of \1 -MT_VALUE = __tmhm_value__ - NUM_TMS - NUM_HMS -MT{02d:MT_VALUE}_MOVE = \1 + DEF MT_VALUE = __tmhm_value__ - NUM_TMS - NUM_HMS + DEF MT{02d:MT_VALUE}_MOVE = \1 add_tmnum \1 ENDM -MT01 EQU const_value +DEF MT01 EQU const_value add_mt FLAMETHROWER add_mt THUNDERBOLT add_mt ICE_BEAM -NUM_TUTORS = __tmhm_value__ - NUM_TMS - NUM_HMS - 1 +DEF NUM_TUTORS = __tmhm_value__ - NUM_TMS - NUM_HMS - 1 -NUM_TM_HM_TUTOR EQU NUM_TMS + NUM_HMS + NUM_TUTORS +DEF NUM_TM_HM_TUTOR EQU NUM_TMS + NUM_HMS + NUM_TUTORS const ITEM_FA ; fa -USE_SCRIPT_VAR EQU $00 -ITEM_FROM_MEM EQU $ff +DEF USE_SCRIPT_VAR EQU $00 +DEF ITEM_FROM_MEM EQU $ff ; leftovers from red -SAFARI_BALL EQU $08 ; MOON_STONE -MOON_STONE_RED EQU $0a ; BURN_HEAL -FULL_HEAL_RED EQU $34 ; X_SPEED +DEF SAFARI_BALL EQU $08 ; MOON_STONE +DEF MOON_STONE_RED EQU $0a ; BURN_HEAL +DEF FULL_HEAL_RED EQU $34 ; X_SPEED diff --git a/constants/item_data_constants.asm b/constants/item_data_constants.asm index 2d955c17e..4f466d411 100644 --- a/constants/item_data_constants.asm +++ b/constants/item_data_constants.asm @@ -1,15 +1,15 @@ ; item_attributes struct members (see data/items/attributes.asm) rsreset -ITEMATTR_PRICE rw +DEF ITEMATTR_PRICE rw rsset ITEMATTR_PRICE -ITEMATTR_PRICE_LO rb -ITEMATTR_PRICE_HI rb -ITEMATTR_EFFECT rb -ITEMATTR_PARAM rb -ITEMATTR_PERMISSIONS rb -ITEMATTR_POCKET rb -ITEMATTR_HELP rb -ITEMATTR_STRUCT_LENGTH EQU _RS +DEF ITEMATTR_PRICE_LO rb +DEF ITEMATTR_PRICE_HI rb +DEF ITEMATTR_EFFECT rb +DEF ITEMATTR_PARAM rb +DEF ITEMATTR_PERMISSIONS rb +DEF ITEMATTR_POCKET rb +DEF ITEMATTR_HELP rb +DEF ITEMATTR_STRUCT_LENGTH EQU _RS ; item types const_def 1 @@ -17,7 +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 +DEF NUM_ITEM_TYPES EQU const_value - 1 ; item menu types ; UseItem.dw indexes (see engine/items/pack.asm) @@ -30,12 +30,12 @@ NUM_ITEM_TYPES EQU const_value - 1 const ITEMMENU_CLOSE ; 6 ; item actions -CANT_SELECT_F EQU 6 -CANT_TOSS_F EQU 7 +DEF CANT_SELECT_F EQU 6 +DEF CANT_TOSS_F EQU 7 -NO_LIMITS EQU 0 -CANT_SELECT EQU 1 << CANT_SELECT_F -CANT_TOSS EQU 1 << CANT_TOSS_F +DEF NO_LIMITS EQU 0 +DEF CANT_SELECT EQU 1 << CANT_SELECT_F +DEF CANT_TOSS EQU 1 << CANT_TOSS_F ; pack pockets const_def @@ -43,20 +43,20 @@ CANT_TOSS EQU 1 << CANT_TOSS_F const BALL_POCKET ; 1 const KEY_ITEM_POCKET ; 2 const TM_HM_POCKET ; 3 -NUM_POCKETS EQU const_value +DEF NUM_POCKETS EQU const_value -MAX_ITEMS EQU 20 -MAX_BALLS EQU 12 -MAX_KEY_ITEMS EQU 25 -MAX_PC_ITEMS EQU 50 +DEF MAX_ITEMS EQU 20 +DEF MAX_BALLS EQU 12 +DEF MAX_KEY_ITEMS EQU 25 +DEF MAX_PC_ITEMS EQU 50 -MAX_ITEM_STACK EQU 99 +DEF MAX_ITEM_STACK EQU 99 ; mail -MAIL_LINE_LENGTH EQU $10 -MAIL_MSG_LENGTH EQU $20 -MAILBOX_CAPACITY EQU 10 -MAIL_STRUCT_LENGTH EQU $2f ; mailmsg struct +DEF MAIL_LINE_LENGTH EQU $10 +DEF MAIL_MSG_LENGTH EQU $20 +DEF MAILBOX_CAPACITY EQU 10 +DEF MAIL_STRUCT_LENGTH EQU $2f ; mailmsg struct ; held item effects const_def diff --git a/constants/landmark_constants.asm b/constants/landmark_constants.asm index bd2d171eb..058b70c22 100644 --- a/constants/landmark_constants.asm +++ b/constants/landmark_constants.asm @@ -48,7 +48,7 @@ const LANDMARK_DARK_CAVE ; 2c const LANDMARK_ROUTE_46 ; 2d const LANDMARK_SILVER_CAVE ; 2e -KANTO_LANDMARK EQU const_value +DEF KANTO_LANDMARK EQU const_value const LANDMARK_PALLET_TOWN ; 2f const LANDMARK_ROUTE_1 ; 30 const LANDMARK_VIRIDIAN_CITY ; 31 @@ -98,7 +98,7 @@ KANTO_LANDMARK EQU const_value const LANDMARK_TOHJO_FALLS ; 5d const LANDMARK_ROUTE_28 ; 5e const LANDMARK_FAST_SHIP ; 5f -NUM_LANDMARKS EQU const_value +DEF NUM_LANDMARKS EQU const_value ; used in CaughtData const_def $7f, -1 @@ -109,4 +109,4 @@ NUM_LANDMARKS EQU const_value const_def const JOHTO_REGION ; 0 const KANTO_REGION ; 1 -NUM_REGIONS EQU const_value +DEF NUM_REGIONS EQU const_value diff --git a/constants/map_constants.asm b/constants/map_constants.asm index aacffb96f..ace768113 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -1,25 +1,25 @@ -newgroup: MACRO +MACRO newgroup ;\1: group id const_skip -MAPGROUP_\1 EQU const_value -CURRENT_NUM_MAPGROUP_MAPS EQUS "NUM_\1_MAPS" -__map_value__ = 1 + DEF MAPGROUP_\1 EQU const_value + DEF CURRENT_NUM_MAPGROUP_MAPS EQUS "NUM_\1_MAPS" + DEF __map_value__ = 1 ENDM -map_const: MACRO +MACRO map_const ;\1: map id ;\2: width: in blocks ;\3: height: in blocks -GROUP_\1 EQU const_value -MAP_\1 EQU __map_value__ -__map_value__ += 1 -\1_WIDTH EQU \2 -\1_HEIGHT EQU \3 + DEF GROUP_\1 EQU const_value + DEF MAP_\1 EQU __map_value__ + DEF __map_value__ += 1 + DEF \1_WIDTH EQU \2 + DEF \1_HEIGHT EQU \3 ENDM -endgroup: MACRO -{CURRENT_NUM_MAPGROUP_MAPS} EQU __map_value__ - 1 -PURGE CURRENT_NUM_MAPGROUP_MAPS +MACRO endgroup + DEF {CURRENT_NUM_MAPGROUP_MAPS} EQU __map_value__ - 1 + PURGE CURRENT_NUM_MAPGROUP_MAPS ENDM ; map group ids @@ -501,4 +501,4 @@ ENDM map_const ROUTE_31_VIOLET_GATE, 5, 4 ; 11 endgroup -NUM_MAP_GROUPS EQU const_value ; 26 +DEF NUM_MAP_GROUPS EQU const_value ; 26 diff --git a/constants/map_data_constants.asm b/constants/map_data_constants.asm index 79e4ee87c..5d18ce3fb 100644 --- a/constants/map_data_constants.asm +++ b/constants/map_data_constants.asm @@ -1,21 +1,21 @@ -MAPGROUP_N_A EQU -1 -GROUP_N_A EQU -1 -MAP_N_A EQU -1 -MAPGROUP_NONE EQU 0 -GROUP_NONE EQU 0 -MAP_NONE EQU 0 +DEF MAPGROUP_N_A EQU -1 +DEF GROUP_N_A EQU -1 +DEF MAP_N_A EQU -1 +DEF MAPGROUP_NONE EQU 0 +DEF GROUP_NONE EQU 0 +DEF MAP_NONE EQU 0 ; map struct members (see data/maps/maps.asm) rsreset -MAP_MAPATTRIBUTES_BANK rb ; 0 -MAP_TILESET rb ; 1 -MAP_ENVIRONMENT rb ; 2 -MAP_MAPATTRIBUTES rw ; 3 -MAP_LOCATION rb ; 5 -MAP_MUSIC rb ; 6 -MAP_PALETTE rb ; 7 -MAP_FISHGROUP rb ; 8 -MAP_LENGTH EQU _RS +DEF MAP_MAPATTRIBUTES_BANK rb ; 0 +DEF MAP_TILESET rb ; 1 +DEF MAP_ENVIRONMENT rb ; 2 +DEF MAP_MAPATTRIBUTES rw ; 3 +DEF MAP_LOCATION rb ; 5 +DEF MAP_MUSIC rb ; 6 +DEF MAP_PALETTE rb ; 7 +DEF MAP_FISHGROUP rb ; 8 +DEF MAP_LENGTH EQU _RS ; map environments (wEnvironment) ; EnvironmentColorsPointers indexes (see data/maps/environment_colors.asm) @@ -27,7 +27,7 @@ MAP_LENGTH EQU _RS const ENVIRONMENT_5 const GATE const DUNGEON -NUM_ENVIRONMENTS EQU const_value - 1 +DEF NUM_ENVIRONMENTS EQU const_value - 1 ; map palettes (wEnvironment) const_def @@ -36,7 +36,7 @@ NUM_ENVIRONMENTS EQU const_value - 1 const PALETTE_NITE const PALETTE_MORN const PALETTE_DARK -NUM_MAP_PALETTES EQU const_value +DEF NUM_MAP_PALETTES EQU const_value ; FishGroups indexes (see data/wild/fish.asm) const_def @@ -54,7 +54,7 @@ NUM_MAP_PALETTES EQU const_value const FISHGROUP_QWILFISH const FISHGROUP_REMORAID const FISHGROUP_QWILFISH_NO_SWARM -NUM_FISHGROUPS EQU const_value - 1 +DEF NUM_FISHGROUPS EQU const_value - 1 ; connection directions (see data/maps/data.asm) const_def @@ -102,14 +102,14 @@ NUM_FISHGROUPS EQU const_value - 1 const SPAWN_BLACKTHORN const SPAWN_MT_SILVER const SPAWN_FAST_SHIP -NUM_SPAWNS EQU const_value +DEF NUM_SPAWNS EQU const_value -SPAWN_N_A EQU -1 +DEF SPAWN_N_A EQU -1 ; Flypoints indexes (see data/maps/flypoints.asm) const_def ; johto -JOHTO_FLYPOINT EQU const_value +DEF JOHTO_FLYPOINT EQU const_value const FLY_NEW_BARK const FLY_CHERRYGROVE const FLY_VIOLET @@ -123,7 +123,7 @@ JOHTO_FLYPOINT EQU const_value const FLY_BLACKTHORN const FLY_MT_SILVER ; kanto -KANTO_FLYPOINT EQU const_value +DEF KANTO_FLYPOINT EQU const_value const FLY_PALLET const FLY_VIRIDIAN const FLY_PEWTER @@ -136,6 +136,6 @@ KANTO_FLYPOINT EQU const_value const FLY_FUCHSIA const FLY_CINNABAR const FLY_INDIGO -NUM_FLYPOINTS EQU const_value +DEF NUM_FLYPOINTS EQU const_value -MAX_OUTDOOR_SPRITES EQU 23 ; see engine/overworld/overworld.asm +DEF MAX_OUTDOOR_SPRITES EQU 23 ; see engine/overworld/overworld.asm diff --git a/constants/map_object_constants.asm b/constants/map_object_constants.asm index c6d90bd62..863435fd1 100644 --- a/constants/map_object_constants.asm +++ b/constants/map_object_constants.asm @@ -1,47 +1,47 @@ ; object_struct members (see macros/wram.asm) rsreset -OBJECT_SPRITE rb ; 00 -OBJECT_MAP_OBJECT_INDEX rb ; 01 -OBJECT_SPRITE_TILE rb ; 02 -OBJECT_MOVEMENTTYPE rb ; 03 -OBJECT_FLAGS1 rb ; 04 -OBJECT_FLAGS2 rb ; 05 -OBJECT_PALETTE rb ; 06 -OBJECT_DIRECTION_WALKING rb ; 07 -OBJECT_FACING rb ; 08 -OBJECT_STEP_TYPE rb ; 09 -OBJECT_STEP_DURATION rb ; 0a -OBJECT_ACTION rb ; 0b -OBJECT_STEP_FRAME rb ; 0c -OBJECT_FACING_STEP rb ; 0d -OBJECT_NEXT_TILE rb ; 0e -OBJECT_STANDING_TILE rb ; 0f -OBJECT_NEXT_MAP_X rb ; 10 -OBJECT_NEXT_MAP_Y rb ; 11 -OBJECT_MAP_X rb ; 12 -OBJECT_MAP_Y rb ; 13 -OBJECT_INIT_X rb ; 14 -OBJECT_INIT_Y rb ; 15 -OBJECT_RADIUS rb ; 16 -OBJECT_SPRITE_X rb ; 17 -OBJECT_SPRITE_Y rb ; 18 -OBJECT_SPRITE_X_OFFSET rb ; 19 -OBJECT_SPRITE_Y_OFFSET rb ; 1a -OBJECT_MOVEMENT_BYTE_INDEX rb ; 1b -OBJECT_1C rb ; 1c -OBJECT_1D rb ; 1d -OBJECT_1E rb ; 1e -OBJECT_1F rb ; 1f -OBJECT_RANGE rb ; 20 - rb_skip 7 -OBJECT_LENGTH EQU _RS -NUM_OBJECT_STRUCTS EQU 13 ; see wObjectStructs +DEF OBJECT_SPRITE rb ; 00 +DEF OBJECT_MAP_OBJECT_INDEX rb ; 01 +DEF OBJECT_SPRITE_TILE rb ; 02 +DEF OBJECT_MOVEMENTTYPE rb ; 03 +DEF OBJECT_FLAGS1 rb ; 04 +DEF OBJECT_FLAGS2 rb ; 05 +DEF OBJECT_PALETTE rb ; 06 +DEF OBJECT_DIRECTION_WALKING rb ; 07 +DEF OBJECT_FACING rb ; 08 +DEF OBJECT_STEP_TYPE rb ; 09 +DEF OBJECT_STEP_DURATION rb ; 0a +DEF OBJECT_ACTION rb ; 0b +DEF OBJECT_STEP_FRAME rb ; 0c +DEF OBJECT_FACING_STEP rb ; 0d +DEF OBJECT_NEXT_TILE rb ; 0e +DEF OBJECT_STANDING_TILE rb ; 0f +DEF OBJECT_NEXT_MAP_X rb ; 10 +DEF OBJECT_NEXT_MAP_Y rb ; 11 +DEF OBJECT_MAP_X rb ; 12 +DEF OBJECT_MAP_Y rb ; 13 +DEF OBJECT_INIT_X rb ; 14 +DEF OBJECT_INIT_Y rb ; 15 +DEF OBJECT_RADIUS rb ; 16 +DEF OBJECT_SPRITE_X rb ; 17 +DEF OBJECT_SPRITE_Y rb ; 18 +DEF OBJECT_SPRITE_X_OFFSET rb ; 19 +DEF OBJECT_SPRITE_Y_OFFSET rb ; 1a +DEF OBJECT_MOVEMENT_BYTE_INDEX rb ; 1b +DEF OBJECT_1C rb ; 1c +DEF OBJECT_1D rb ; 1d +DEF OBJECT_1E rb ; 1e +DEF OBJECT_1F rb ; 1f +DEF OBJECT_RANGE rb ; 20 + rb_skip 7 +DEF OBJECT_LENGTH EQU _RS +DEF NUM_OBJECT_STRUCTS EQU 13 ; see wObjectStructs ; object_struct OBJECT_FACING values -OW_DOWN EQU DOWN << 2 -OW_UP EQU UP << 2 -OW_LEFT EQU LEFT << 2 -OW_RIGHT EQU RIGHT << 2 +DEF OW_DOWN EQU DOWN << 2 +DEF OW_UP EQU UP << 2 +DEF OW_LEFT EQU LEFT << 2 +DEF OW_RIGHT EQU RIGHT << 2 ; object_struct OBJECT_FLAGS1 bit flags const_def @@ -54,14 +54,14 @@ OW_RIGHT EQU RIGHT << 2 const NOCLIP_OBJS_F ; 6 const EMOTE_OBJECT_F ; 7 -INVISIBLE EQU 1 << INVISIBLE_F -WONT_DELETE EQU 1 << WONT_DELETE_F -FIXED_FACING EQU 1 << FIXED_FACING_F -SLIDING EQU 1 << SLIDING_F -NOCLIP_TILES EQU 1 << NOCLIP_TILES_F -MOVE_ANYWHERE EQU 1 << MOVE_ANYWHERE_F -NOCLIP_OBJS EQU 1 << NOCLIP_OBJS_F -EMOTE_OBJECT EQU 1 << EMOTE_OBJECT_F +DEF INVISIBLE EQU 1 << INVISIBLE_F +DEF WONT_DELETE EQU 1 << WONT_DELETE_F +DEF FIXED_FACING EQU 1 << FIXED_FACING_F +DEF SLIDING EQU 1 << SLIDING_F +DEF NOCLIP_TILES EQU 1 << NOCLIP_TILES_F +DEF MOVE_ANYWHERE EQU 1 << MOVE_ANYWHERE_F +DEF NOCLIP_OBJS EQU 1 << NOCLIP_OBJS_F +DEF EMOTE_OBJECT EQU 1 << EMOTE_OBJECT_F ; object_struct OBJECT_FLAGS2 bit flags const_def @@ -74,10 +74,10 @@ EMOTE_OBJECT EQU 1 << EMOTE_OBJECT_F const OBJ_FLAGS2_6 ; 6 const OBJ_FLAGS2_7 ; 7 -LOW_PRIORITY EQU 1 << LOW_PRIORITY_F -HIGH_PRIORITY EQU 1 << HIGH_PRIORITY_F -OVERHEAD EQU 1 << OVERHEAD_F -USE_OBP1 EQU 1 << USE_OBP1_F +DEF LOW_PRIORITY EQU 1 << LOW_PRIORITY_F +DEF HIGH_PRIORITY EQU 1 << HIGH_PRIORITY_F +DEF OVERHEAD EQU 1 << OVERHEAD_F +DEF USE_OBP1 EQU 1 << USE_OBP1_F ; object_struct OBJECT_PALETTE bit flags const_def 5 @@ -85,48 +85,48 @@ USE_OBP1 EQU 1 << USE_OBP1_F const STRENGTH_BOULDER_F ; 6 const BIG_OBJECT_F ; 7 -SWIMMING EQU 1 << SWIMMING_F -STRENGTH_BOULDER EQU 1 << STRENGTH_BOULDER_F -BIG_OBJECT EQU 1 << BIG_OBJECT_F +DEF SWIMMING EQU 1 << SWIMMING_F +DEF STRENGTH_BOULDER EQU 1 << STRENGTH_BOULDER_F +DEF BIG_OBJECT EQU 1 << BIG_OBJECT_F ; facing attribute bit flags -RELATIVE_ATTRIBUTES_F EQU 1 -ABSOLUTE_TILE_ID_F EQU 2 +DEF RELATIVE_ATTRIBUTES_F EQU 1 +DEF ABSOLUTE_TILE_ID_F EQU 2 -RELATIVE_ATTRIBUTES EQU 1 << RELATIVE_ATTRIBUTES_F -ABSOLUTE_TILE_ID EQU 1 << ABSOLUTE_TILE_ID_F +DEF RELATIVE_ATTRIBUTES EQU 1 << RELATIVE_ATTRIBUTES_F +DEF ABSOLUTE_TILE_ID EQU 1 << ABSOLUTE_TILE_ID_F ; map_object struct members (see macros/wram.asm) rsreset -MAPOBJECT_OBJECT_STRUCT_ID rb ; 0 -MAPOBJECT_SPRITE rb ; 1 -MAPOBJECT_Y_COORD rb ; 2 -MAPOBJECT_X_COORD rb ; 3 -MAPOBJECT_MOVEMENT rb ; 4 -MAPOBJECT_RADIUS rb ; 5 -MAPOBJECT_HOUR rb ; 6 -MAPOBJECT_TIMEOFDAY rb ; 7 -MAPOBJECT_COLOR rb ; 8 -MAPOBJECT_RANGE rb ; 9 -MAPOBJECT_SCRIPT_POINTER rw ; a -MAPOBJECT_EVENT_FLAG rw ; c - rb_skip 2 -MAPOBJECT_LENGTH EQU _RS -NUM_OBJECTS EQU 16 -PLAYER_OBJECT EQU 0 +DEF MAPOBJECT_OBJECT_STRUCT_ID rb ; 0 +DEF MAPOBJECT_SPRITE rb ; 1 +DEF MAPOBJECT_Y_COORD rb ; 2 +DEF MAPOBJECT_X_COORD rb ; 3 +DEF MAPOBJECT_MOVEMENT rb ; 4 +DEF MAPOBJECT_RADIUS rb ; 5 +DEF MAPOBJECT_HOUR rb ; 6 +DEF MAPOBJECT_TIMEOFDAY rb ; 7 +DEF MAPOBJECT_COLOR rb ; 8 +DEF MAPOBJECT_RANGE rb ; 9 +DEF MAPOBJECT_SCRIPT_POINTER rw ; a +DEF MAPOBJECT_EVENT_FLAG rw ; c + rb_skip 2 +DEF MAPOBJECT_LENGTH EQU _RS +DEF NUM_OBJECTS EQU 16 +DEF PLAYER_OBJECT EQU 0 ; SpriteMovementData struct members (see data/sprites/map_objects.asm) rsreset -SPRITEMOVEATTR_MOVEMENT rb ; 0 -SPRITEMOVEATTR_FACING rb ; 1 -SPRITEMOVEATTR_ACTION rb ; 2 -SPRITEMOVEATTR_FLAGS1 rb ; 3 -SPRITEMOVEATTR_FLAGS2 rb ; 4 -SPRITEMOVEATTR_PALFLAGS rb ; 5 -NUM_SPRITEMOVEDATA_FIELDS EQU _RS +DEF SPRITEMOVEATTR_MOVEMENT rb ; 0 +DEF SPRITEMOVEATTR_FACING rb ; 1 +DEF SPRITEMOVEATTR_ACTION rb ; 2 +DEF SPRITEMOVEATTR_FLAGS1 rb ; 3 +DEF SPRITEMOVEATTR_FLAGS2 rb ; 4 +DEF SPRITEMOVEATTR_PALFLAGS rb ; 5 +DEF NUM_SPRITEMOVEDATA_FIELDS EQU _RS -MAPOBJECT_SCREEN_WIDTH EQU (SCREEN_WIDTH / 2) + 2 -MAPOBJECT_SCREEN_HEIGHT EQU (SCREEN_HEIGHT / 2) + 2 +DEF MAPOBJECT_SCREEN_WIDTH EQU (SCREEN_WIDTH / 2) + 2 +DEF MAPOBJECT_SCREEN_HEIGHT EQU (SCREEN_HEIGHT / 2) + 2 ; SpriteMovementData indexes (see data/sprites/map_objects.asm) const_def @@ -167,7 +167,7 @@ MAPOBJECT_SCREEN_HEIGHT EQU (SCREEN_HEIGHT / 2) + 2 const SPRITEMOVEDATA_BOULDERDUST ; 22 const SPRITEMOVEDATA_GRASS ; 23 const SPRITEMOVEDATA_SWIM_WANDER ; 24 -NUM_SPRITEMOVEDATA EQU const_value +DEF NUM_SPRITEMOVEDATA EQU const_value ; StepFunction_FromMovement.Pointers indexes (see engine/overworld/map_objects.asm) const_def @@ -199,7 +199,7 @@ NUM_SPRITEMOVEDATA EQU const_value const SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE ; 19 const SPRITEMOVEFN_BOULDERDUST ; 1a const SPRITEMOVEFN_GRASS ; 1b -NUM_SPRITEMOVEFN EQU const_value +DEF NUM_SPRITEMOVEFN EQU const_value ; StepTypesJumptable indexes (see engine/overworld/map_objects.asm) const_def @@ -229,7 +229,7 @@ NUM_SPRITEMOVEFN EQU const_value const STEP_TYPE_17 ; 17 const STEP_TYPE_DELETE ; 18 const STEP_TYPE_SKYFALL_TOP ; 19 -NUM_STEP_TYPES EQU const_value +DEF NUM_STEP_TYPES EQU const_value ; ObjectActionPairPointers indexes (see engine/overworld/map_object_action.asm) const_def @@ -250,7 +250,7 @@ NUM_STEP_TYPES EQU const_value const OBJECT_ACTION_BOULDER_DUST ; 0e const OBJECT_ACTION_GRASS_SHAKE ; 0f const OBJECT_ACTION_SKYFALL ; 10 -NUM_OBJECT_ACTIONS EQU const_value +DEF NUM_OBJECT_ACTIONS EQU const_value ; Facings indexes (see data/sprites/facings.asm) const_def @@ -286,7 +286,7 @@ NUM_OBJECT_ACTIONS EQU const_value const FACING_BOULDER_DUST_2 ; 1d const FACING_GRASS_1 ; 1e const FACING_GRASS_2 ; 1f -NUM_FACINGS EQU const_value +DEF NUM_FACINGS EQU const_value ; DoPlayerMovement.DoStep arguments (see engine/overworld/player_movement.asm) const_def @@ -298,4 +298,4 @@ NUM_FACINGS EQU const_value const STEP_TURN ; 5 const STEP_BACK_LEDGE ; 6 const STEP_WALK_IN_PLACE ; 7 -NUM_STEPS EQU const_value +DEF NUM_STEPS EQU const_value diff --git a/constants/map_setup_constants.asm b/constants/map_setup_constants.asm index 14a7f30d5..42d806a4b 100644 --- a/constants/map_setup_constants.asm +++ b/constants/map_setup_constants.asm @@ -13,7 +13,7 @@ const MAPSETUP_SUBMENU ; fa const MAPSETUP_BADWARP ; fb const MAPSETUP_FLY ; fc -NUM_MAPSETUP_SCRIPTS EQU const_value - $f1 +DEF NUM_MAPSETUP_SCRIPTS EQU const_value - $f1 ; callback types const_def 1 diff --git a/constants/mart_constants.asm b/constants/mart_constants.asm index 957211427..1a2d08fef 100644 --- a/constants/mart_constants.asm +++ b/constants/mart_constants.asm @@ -42,4 +42,4 @@ const MART_MT_MOON const MART_INDIGO_PLATEAU const MART_UNDERGROUND -NUM_MARTS EQU const_value +DEF NUM_MARTS EQU const_value diff --git a/constants/menu_constants.asm b/constants/menu_constants.asm index 060bfc453..63b0f5d7e 100644 --- a/constants/menu_constants.asm +++ b/constants/menu_constants.asm @@ -63,17 +63,17 @@ const MONMENUITEM_MOVE ; 19 const MONMENUITEM_MAIL ; 20 const MONMENUITEM_ERROR ; 21 -NUM_MONMENUITEMS EQU const_value - 1 +DEF NUM_MONMENUITEMS EQU const_value - 1 ; MonMenuOptions categories -MONMENU_FIELD_MOVE EQU 0 -MONMENU_MENUOPTION EQU 1 +DEF MONMENU_FIELD_MOVE EQU 0 +DEF MONMENU_MENUOPTION EQU 1 -NUM_MONMENU_ITEMS EQU 8 +DEF NUM_MONMENU_ITEMS EQU 8 ; start/select menu return values -HMENURETURN_SCRIPT EQU %10000000 -HMENURETURN_ASM EQU %11111111 +DEF HMENURETURN_SCRIPT EQU %10000000 +DEF HMENURETURN_ASM EQU %11111111 ; PartyMenuQualityPointers indexes (see data/party_menu_qualities.asm) const_def @@ -87,7 +87,7 @@ HMENURETURN_ASM EQU %11111111 const PARTYMENUACTION_GIVE_MON_FEMALE ; unused const PARTYMENUACTION_GIVE_ITEM const PARTYMENUACTION_MOBILE ; mobile -NUM_PARTYMENUACTIONS EQU const_value +DEF NUM_PARTYMENUACTIONS EQU const_value ; PrintPartyMenuActionText arguments (see engine/pokemon/party_menu.asm) const_next $f0 const PARTYMENUTEXT_HEAL_PSN @@ -111,4 +111,4 @@ NUM_PARTYMENUACTIONS EQU const_value const NAME_FRIEND const NAME_6 ; duplicate of NAME_MON const NAME_7 ; duplicate of NAME_MON -NUM_NAME_TYPES EQU const_value +DEF NUM_NAME_TYPES EQU const_value diff --git a/constants/misc_constants.asm b/constants/misc_constants.asm index 171b16e39..b909d57c7 100644 --- a/constants/misc_constants.asm +++ b/constants/misc_constants.asm @@ -1,10 +1,10 @@ ; Boolean checks -FALSE EQU 0 -TRUE EQU 1 +DEF FALSE EQU 0 +DEF TRUE EQU 1 ; genders -MALE EQU 0 -FEMALE EQU 1 +DEF MALE EQU 0 +DEF FEMALE EQU 1 ; FlagAction arguments (see home/flag.asm) const_def @@ -14,36 +14,36 @@ FEMALE EQU 1 ; G/S version ID: 0 = Gold, 1 = Silver (used by checkver) ; Mystery Gift uses incremented values 1 and 2 -GS_VERSION EQU 0 +DEF GS_VERSION EQU 0 ; Pokémon Pikachu 2, a step counter / virtual pet device (used by Mystery Gift) -POKEMON_PIKACHU_2_VERSION EQU 3 -RESERVED_GAME_VERSION EQU 4 +DEF POKEMON_PIKACHU_2_VERSION EQU 3 +DEF RESERVED_GAME_VERSION EQU 4 ; save file corruption check values -SAVE_CHECK_VALUE_1 EQU 99 -SAVE_CHECK_VALUE_2 EQU 127 +DEF SAVE_CHECK_VALUE_1 EQU 99 +DEF SAVE_CHECK_VALUE_2 EQU 127 ; RTC halted check value -RTC_HALT_VALUE EQU $1234 +DEF RTC_HALT_VALUE EQU $1234 ; time of day boundaries -MORN_HOUR EQU 4 ; 4 AM -DAY_HOUR EQU 10 ; 10 AM -NITE_HOUR EQU 18 ; 6 PM -NOON_HOUR EQU 12 ; 12 PM -MAX_HOUR EQU 24 ; 12 AM +DEF MORN_HOUR EQU 4 ; 4 AM +DEF DAY_HOUR EQU 10 ; 10 AM +DEF NITE_HOUR EQU 18 ; 6 PM +DEF NOON_HOUR EQU 12 ; 12 PM +DEF MAX_HOUR EQU 24 ; 12 AM ; significant money values -START_MONEY EQU 3000 -MOM_MONEY EQU 2300 -MAX_MONEY EQU 999999 -MAX_COINS EQU 9999 +DEF START_MONEY EQU 3000 +DEF MOM_MONEY EQU 2300 +DEF MAX_MONEY EQU 999999 +DEF MAX_COINS EQU 9999 ; link record -MAX_LINK_RECORD EQU 9999 +DEF MAX_LINK_RECORD EQU 9999 ; day-care -MAX_DAY_CARE_EXP EQU $500000 +DEF MAX_DAY_CARE_EXP EQU $500000 ; hall of fame -HOF_MASTER_COUNT EQU 200 +DEF HOF_MASTER_COUNT EQU 200 diff --git a/constants/mobile_constants.asm b/constants/mobile_constants.asm index 220e0957c..4adf151a6 100644 --- a/constants/mobile_constants.asm +++ b/constants/mobile_constants.asm @@ -53,11 +53,11 @@ const EZCHAT_FAREWELLS const EZCHAT_THISANDTHAT -NUM_KANA EQU 45 ; length of SortedPokemon table (see mobile/fixed_words.asm) +DEF NUM_KANA EQU 45 ; length of SortedPokemon table (see mobile/fixed_words.asm) -MOBILE_LOGIN_PASSWORD_LENGTH EQU 17 -MOBILE_PHONE_NUMBER_LENGTH EQU 20 +DEF MOBILE_LOGIN_PASSWORD_LENGTH EQU 17 +DEF MOBILE_PHONE_NUMBER_LENGTH EQU 20 ; Maximum amount of time allowed for mobile battles each day -MOBILE_BATTLE_ALLOWED_SECONDS EQU 0 -MOBILE_BATTLE_ALLOWED_MINUTES EQU 10 +DEF MOBILE_BATTLE_ALLOWED_SECONDS EQU 0 +DEF MOBILE_BATTLE_ALLOWED_MINUTES EQU 10 diff --git a/constants/move_constants.asm b/constants/move_constants.asm index 5f6bff0cb..6112966cb 100644 --- a/constants/move_constants.asm +++ b/constants/move_constants.asm @@ -257,7 +257,7 @@ const ROCK_SMASH ; f9 const WHIRLPOOL ; fa const BEAT_UP ; fb -NUM_ATTACKS EQU const_value - 1 +DEF NUM_ATTACKS EQU const_value - 1 ; Battle animations use the same constants as the moves up to this point const_next $ff @@ -285,7 +285,7 @@ NUM_ATTACKS EQU const_value - 1 const ANIM_WOBBLE ; 113 const ANIM_SHAKE ; 114 const ANIM_HIT_CONFUSION ; 115 -NUM_BATTLE_ANIMS EQU const_value - 1 +DEF NUM_BATTLE_ANIMS EQU const_value - 1 ; wNumHits uses offsets from ANIM_MISS const_def diff --git a/constants/move_effect_constants.asm b/constants/move_effect_constants.asm index 79babcf74..3432cfbfc 100644 --- a/constants/move_effect_constants.asm +++ b/constants/move_effect_constants.asm @@ -157,4 +157,4 @@ const EFFECT_BEAT_UP const EFFECT_FLY const EFFECT_DEFENSE_CURL -NUM_MOVE_EFECTS EQU const_value +DEF NUM_MOVE_EFECTS EQU const_value diff --git a/constants/music_constants.asm b/constants/music_constants.asm index 4344d3773..d64fa5761 100644 --- a/constants/music_constants.asm +++ b/constants/music_constants.asm @@ -105,15 +105,15 @@ const MUSIC_SUICUNE_BATTLE ; 64 const MUSIC_BATTLE_TOWER_LOBBY ; 65 const MUSIC_MOBILE_CENTER ; 66 -NUM_MUSIC_SONGS EQU const_value +DEF NUM_MUSIC_SONGS EQU const_value ; GetMapMusic picks music for this value (see home/map.asm) -MUSIC_MAHOGANY_MART EQU $64 +DEF MUSIC_MAHOGANY_MART EQU $64 ; ExitPokegearRadio_HandleMusic uses these values -RESTART_MAP_MUSIC EQU $fe -ENTER_MAP_MUSIC EQU $ff +DEF RESTART_MAP_MUSIC EQU $fe +DEF ENTER_MAP_MUSIC EQU $ff ; GetMapMusic picks music for this bit flag -RADIO_TOWER_MUSIC_F EQU 7 -RADIO_TOWER_MUSIC EQU 1 << RADIO_TOWER_MUSIC_F +DEF RADIO_TOWER_MUSIC_F EQU 7 +DEF RADIO_TOWER_MUSIC EQU 1 << RADIO_TOWER_MUSIC_F diff --git a/constants/npc_trade_constants.asm b/constants/npc_trade_constants.asm index fba430323..044b2e4fa 100644 --- a/constants/npc_trade_constants.asm +++ b/constants/npc_trade_constants.asm @@ -1,16 +1,16 @@ ; npctrade struct members (see data/events/npc_trades.asm) rsreset -NPCTRADE_DIALOG rb -NPCTRADE_GIVEMON rb -NPCTRADE_GETMON rb -NPCTRADE_NICKNAME rb MON_NAME_LENGTH -NPCTRADE_DVS rw -NPCTRADE_ITEM rb -NPCTRADE_OT_ID rw -NPCTRADE_OT_NAME rb NAME_LENGTH -NPCTRADE_GENDER rb - rb_skip -NPCTRADE_STRUCT_LENGTH EQU _RS +DEF NPCTRADE_DIALOG rb +DEF NPCTRADE_GIVEMON rb +DEF NPCTRADE_GETMON rb +DEF NPCTRADE_NICKNAME rb MON_NAME_LENGTH +DEF NPCTRADE_DVS rw +DEF NPCTRADE_ITEM rb +DEF NPCTRADE_OT_ID rw +DEF NPCTRADE_OT_NAME rb NAME_LENGTH +DEF NPCTRADE_GENDER rb + rb_skip +DEF NPCTRADE_STRUCT_LENGTH EQU _RS ; NPCTrades indexes (see data/events/npc_trades.asm) const_def @@ -21,7 +21,7 @@ NPCTRADE_STRUCT_LENGTH EQU _RS const NPC_TRADE_CHRIS ; 4 const NPC_TRADE_KIM ; 5 const NPC_TRADE_FOREST ; 6 -NUM_NPC_TRADES EQU const_value +DEF NUM_NPC_TRADES EQU const_value ; trade gender limits const_def diff --git a/constants/phone_constants.asm b/constants/phone_constants.asm index 2dd67bb52..0600dc275 100644 --- a/constants/phone_constants.asm +++ b/constants/phone_constants.asm @@ -38,7 +38,7 @@ const PHONE_HIKER_PARRY const PHONE_PICNICKER_ERIN const PHONE_BUENA -NUM_PHONE_CONTACTS EQU const_value - 1 +DEF NUM_PHONE_CONTACTS EQU const_value - 1 ; SpecialPhoneCallList indexes (see data/phone/special_calls.asm) const_def @@ -51,22 +51,22 @@ NUM_PHONE_CONTACTS EQU const_value - 1 const SPECIALCALL_BIKESHOP const SPECIALCALL_WORRIED const SPECIALCALL_MASTERBALL -NUM_SPECIALCALLS EQU const_value - 1 -SPECIALCALL_SIZE EQU 6 +DEF NUM_SPECIALCALLS EQU const_value - 1 +DEF SPECIALCALL_SIZE EQU 6 ; phone struct members rsreset -PHONE_CONTACT_TRAINER_CLASS rb -PHONE_CONTACT_TRAINER_NUMBER rb -PHONE_CONTACT_MAP_GROUP rb -PHONE_CONTACT_MAP_NUMBER rb -PHONE_CONTACT_SCRIPT1_TIME rb -PHONE_CONTACT_SCRIPT1_BANK rb -PHONE_CONTACT_SCRIPT1_ADDR rw -PHONE_CONTACT_SCRIPT2_TIME rb -PHONE_CONTACT_SCRIPT2_BANK rb -PHONE_CONTACT_SCRIPT2_ADDR rw -PHONE_CONTACT_SIZE EQU _RS +DEF PHONE_CONTACT_TRAINER_CLASS rb +DEF PHONE_CONTACT_TRAINER_NUMBER rb +DEF PHONE_CONTACT_MAP_GROUP rb +DEF PHONE_CONTACT_MAP_NUMBER rb +DEF PHONE_CONTACT_SCRIPT1_TIME rb +DEF PHONE_CONTACT_SCRIPT1_BANK rb +DEF PHONE_CONTACT_SCRIPT1_ADDR rw +DEF PHONE_CONTACT_SCRIPT2_TIME rb +DEF PHONE_CONTACT_SCRIPT2_BANK rb +DEF PHONE_CONTACT_SCRIPT2_ADDR rw +DEF PHONE_CONTACT_SIZE EQU _RS ; maximum number of pokegear contacts -CONTACT_LIST_SIZE EQU 10 +DEF CONTACT_LIST_SIZE EQU 10 diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm index 6f38f20c7..36c4172f4 100644 --- a/constants/pokemon_constants.asm +++ b/constants/pokemon_constants.asm @@ -170,7 +170,7 @@ const DRAGONITE ; 95 const MEWTWO ; 96 const MEW ; 97 -JOHTO_POKEMON EQU const_value +DEF JOHTO_POKEMON EQU const_value const CHIKORITA ; 98 const BAYLEEF ; 99 const MEGANIUM ; 9a @@ -271,7 +271,7 @@ JOHTO_POKEMON EQU const_value const LUGIA ; f9 const HO_OH ; fa const CELEBI ; fb -NUM_POKEMON EQU const_value - 1 +DEF NUM_POKEMON EQU const_value - 1 const_skip ; fc const EGG ; fd @@ -310,4 +310,4 @@ NUM_POKEMON EQU const_value - 1 const UNOWN_X ; 24 const UNOWN_Y ; 25 const UNOWN_Z ; 26 -NUM_UNOWN EQU const_value - 1 ; 26 +DEF NUM_UNOWN EQU const_value - 1 ; 26 diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index 5118e6e80..ee0e6be03 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -1,44 +1,44 @@ ; base data struct members (see data/pokemon/base_stats/*.asm) rsreset -BASE_DEX_NO rb -BASE_STATS rb NUM_STATS +DEF BASE_DEX_NO rb +DEF BASE_STATS rb NUM_STATS rsset BASE_STATS -BASE_HP rb -BASE_ATK rb -BASE_DEF rb -BASE_SPD rb -BASE_SAT rb -BASE_SDF rb -BASE_TYPES rw +DEF BASE_HP rb +DEF BASE_ATK rb +DEF BASE_DEF rb +DEF BASE_SPD rb +DEF BASE_SAT rb +DEF BASE_SDF rb +DEF BASE_TYPES rw rsset BASE_TYPES -BASE_TYPE_1 rb -BASE_TYPE_2 rb -BASE_CATCH_RATE rb -BASE_EXP rb -BASE_ITEMS rw +DEF BASE_TYPE_1 rb +DEF BASE_TYPE_2 rb +DEF BASE_CATCH_RATE rb +DEF BASE_EXP rb +DEF BASE_ITEMS rw rsset BASE_ITEMS -BASE_ITEM_1 rb -BASE_ITEM_2 rb -BASE_GENDER rb - rb_skip -BASE_EGG_STEPS rb - rb_skip -BASE_PIC_SIZE rb -BASE_FRONTPIC rw -BASE_BACKPIC rw -BASE_GROWTH_RATE rb -BASE_EGG_GROUPS rb -BASE_TMHM rb (NUM_TM_HM_TUTOR + 7) / 8 -BASE_DATA_SIZE EQU _RS +DEF BASE_ITEM_1 rb +DEF BASE_ITEM_2 rb +DEF BASE_GENDER rb + rb_skip +DEF BASE_EGG_STEPS rb + rb_skip +DEF BASE_PIC_SIZE rb +DEF BASE_FRONTPIC rw +DEF BASE_BACKPIC rw +DEF BASE_GROWTH_RATE rb +DEF BASE_EGG_GROUPS rb +DEF BASE_TMHM rb (NUM_TM_HM_TUTOR + 7) / 8 +DEF BASE_DATA_SIZE EQU _RS ; gender ratio constants -GENDER_F0 EQU 0 percent -GENDER_F12_5 EQU 12 percent + 1 -GENDER_F25 EQU 25 percent -GENDER_F50 EQU 50 percent -GENDER_F75 EQU 75 percent -GENDER_F100 EQU 100 percent - 1 -GENDER_UNKNOWN EQU -1 +DEF GENDER_F0 EQU 0 percent +DEF GENDER_F12_5 EQU 12 percent + 1 +DEF GENDER_F25 EQU 25 percent +DEF GENDER_F50 EQU 50 percent +DEF GENDER_F75 EQU 75 percent +DEF GENDER_F100 EQU 100 percent - 1 +DEF GENDER_UNKNOWN EQU -1 ; wBaseGrowthRate values ; GrowthRates indexes (see data/growth_rates.asm) @@ -49,7 +49,7 @@ GENDER_UNKNOWN EQU -1 const GROWTH_MEDIUM_SLOW const GROWTH_FAST const GROWTH_SLOW -NUM_GROWTH_RATES EQU const_value +DEF NUM_GROWTH_RATES EQU const_value ; wBaseEggGroups values const_def 1 @@ -70,82 +70,82 @@ NUM_GROWTH_RATES EQU const_value const EGG_NONE ; f (Undiscovered) ; pokedex entries (see data/pokemon/dex_entries.asm) -NUM_DEX_ENTRY_BANKS EQU 4 +DEF NUM_DEX_ENTRY_BANKS EQU 4 ; party_struct members (see macros/wram.asm) rsreset -MON_SPECIES rb -MON_ITEM rb -MON_MOVES rb NUM_MOVES -MON_ID rw -MON_EXP rb 3 -MON_STAT_EXP rw NUM_EXP_STATS +DEF MON_SPECIES rb +DEF MON_ITEM rb +DEF MON_MOVES rb NUM_MOVES +DEF MON_ID rw +DEF MON_EXP rb 3 +DEF MON_STAT_EXP rw NUM_EXP_STATS rsset MON_STAT_EXP -MON_HP_EXP rw -MON_ATK_EXP rw -MON_DEF_EXP rw -MON_SPD_EXP rw -MON_SPC_EXP rw -MON_DVS rw -MON_PP rb NUM_MOVES -MON_HAPPINESS rb -MON_POKERUS rb -MON_CAUGHTDATA rw +DEF MON_HP_EXP rw +DEF MON_ATK_EXP rw +DEF MON_DEF_EXP rw +DEF MON_SPD_EXP rw +DEF MON_SPC_EXP rw +DEF MON_DVS rw +DEF MON_PP rb NUM_MOVES +DEF MON_HAPPINESS rb +DEF MON_POKERUS rb +DEF MON_CAUGHTDATA rw rsset MON_CAUGHTDATA -MON_CAUGHTTIME rb -MON_CAUGHTGENDER rb +DEF MON_CAUGHTTIME rb +DEF MON_CAUGHTGENDER rb rsset MON_CAUGHTDATA -MON_CAUGHTLEVEL rb -MON_CAUGHTLOCATION rb -MON_LEVEL rb -BOXMON_STRUCT_LENGTH EQU _RS -MON_STATUS rb - rb_skip -MON_HP rw -MON_MAXHP rw -MON_STATS rw NUM_BATTLE_STATS +DEF MON_CAUGHTLEVEL rb +DEF MON_CAUGHTLOCATION rb +DEF MON_LEVEL rb +DEF BOXMON_STRUCT_LENGTH EQU _RS +DEF MON_STATUS rb + rb_skip +DEF MON_HP rw +DEF MON_MAXHP rw +DEF MON_STATS rw NUM_BATTLE_STATS rsset MON_STATS -MON_ATK rw -MON_DEF rw -MON_SPD rw -MON_SAT rw -MON_SDF rw -PARTYMON_STRUCT_LENGTH EQU _RS +DEF MON_ATK rw +DEF MON_DEF rw +DEF MON_SPD rw +DEF MON_SAT rw +DEF MON_SDF rw +DEF PARTYMON_STRUCT_LENGTH EQU _RS -NICKNAMED_MON_STRUCT_LENGTH EQU PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH -REDMON_STRUCT_LENGTH EQU 44 +DEF NICKNAMED_MON_STRUCT_LENGTH EQU PARTYMON_STRUCT_LENGTH + MON_NAME_LENGTH +DEF REDMON_STRUCT_LENGTH EQU 44 ; caught data -CAUGHT_TIME_MASK EQU %11000000 -CAUGHT_LEVEL_MASK EQU %00111111 +DEF CAUGHT_TIME_MASK EQU %11000000 +DEF CAUGHT_LEVEL_MASK EQU %00111111 -CAUGHT_GENDER_MASK EQU %10000000 -CAUGHT_LOCATION_MASK EQU %01111111 +DEF CAUGHT_GENDER_MASK EQU %10000000 +DEF CAUGHT_LOCATION_MASK EQU %01111111 -CAUGHT_BY_UNKNOWN EQU 0 -CAUGHT_BY_GIRL EQU 1 -CAUGHT_BY_BOY EQU 2 +DEF CAUGHT_BY_UNKNOWN EQU 0 +DEF CAUGHT_BY_GIRL EQU 1 +DEF CAUGHT_BY_BOY EQU 2 -CAUGHT_EGG_LEVEL EQU 1 +DEF CAUGHT_EGG_LEVEL EQU 1 -MON_CRY_LENGTH EQU 6 +DEF MON_CRY_LENGTH EQU 6 ; maximum number of party pokemon -PARTY_LENGTH EQU 6 +DEF PARTY_LENGTH EQU 6 ; boxes -MONS_PER_BOX EQU 20 +DEF MONS_PER_BOX EQU 20 ; box: count, species, mons, OTs, nicknames, padding -BOX_LENGTH EQU 1 + MONS_PER_BOX + 1 + (BOXMON_STRUCT_LENGTH + NAME_LENGTH + MON_NAME_LENGTH) * MONS_PER_BOX + 2 ; $450 -NUM_BOXES EQU 14 +DEF BOX_LENGTH EQU 1 + MONS_PER_BOX + 1 + (BOXMON_STRUCT_LENGTH + NAME_LENGTH + MON_NAME_LENGTH) * MONS_PER_BOX + 2 ; $450 +DEF NUM_BOXES EQU 14 ; hall of fame ; hof_mon: species, id, dvs, level, nicknames -HOF_MON_LENGTH EQU 1 + 2 + 2 + 1 + (MON_NAME_LENGTH - 1) ; $10 +DEF HOF_MON_LENGTH EQU 1 + 2 + 2 + 1 + (MON_NAME_LENGTH - 1) ; $10 ; hall_of_fame: win count, party, terminator -HOF_LENGTH EQU 1 + HOF_MON_LENGTH * PARTY_LENGTH + 1 ; $62 -NUM_HOF_TEAMS EQU 30 +DEF HOF_LENGTH EQU 1 + HOF_MON_LENGTH * PARTY_LENGTH + 1 ; $62 +DEF NUM_HOF_TEAMS EQU 30 ; evolution types (used in data/pokemon/evos_attacks.asm) const_def 1 @@ -169,14 +169,14 @@ NUM_HOF_TEAMS EQU 30 ; wild data -NUM_GRASSMON EQU 7 ; data/wild/*_grass.asm table size -NUM_WATERMON EQU 3 ; data/wild/*_water.asm table size +DEF NUM_GRASSMON EQU 7 ; data/wild/*_grass.asm table size +DEF NUM_WATERMON EQU 3 ; data/wild/*_water.asm table size -GRASS_WILDDATA_LENGTH EQU 2 + 3 + NUM_GRASSMON * 2 * 3 -WATER_WILDDATA_LENGTH EQU 2 + 1 + NUM_WATERMON * 2 -FISHGROUP_DATA_LENGTH EQU 1 + 2 * 3 +DEF GRASS_WILDDATA_LENGTH EQU 2 + 3 + NUM_GRASSMON * 2 * 3 +DEF WATER_WILDDATA_LENGTH EQU 2 + 1 + NUM_WATERMON * 2 +DEF FISHGROUP_DATA_LENGTH EQU 1 + 2 * 3 -NUM_ROAMMON_MAPS EQU 16 ; RoamMaps table size (see data/wild/roammon_maps.asm) +DEF NUM_ROAMMON_MAPS EQU 16 ; RoamMaps table size (see data/wild/roammon_maps.asm) ; treemon sets ; TreeMons indexes (see data/wild/treemons.asm) @@ -189,7 +189,7 @@ NUM_ROAMMON_MAPS EQU 16 ; RoamMaps table size (see data/wild/roammon_maps.asm) const TREEMON_SET_LAKE const TREEMON_SET_FOREST const TREEMON_SET_ROCK -NUM_TREEMON_SETS EQU const_value +DEF NUM_TREEMON_SETS EQU const_value ; treemon scores const_def @@ -218,16 +218,16 @@ NUM_TREEMON_SETS EQU const_value const HAPPINESS_REVIVALHERB ; 11 const HAPPINESS_GROOMING ; 12 const HAPPINESS_GAINLEVELATHOME ; 13 -NUM_HAPPINESS_CHANGES EQU const_value - 1 +DEF NUM_HAPPINESS_CHANGES EQU const_value - 1 ; significant happiness values -BASE_HAPPINESS EQU 70 -FRIEND_BALL_HAPPINESS EQU 200 -HAPPINESS_TO_EVOLVE EQU 220 -HAPPINESS_THRESHOLD_1 EQU 100 -HAPPINESS_THRESHOLD_2 EQU 200 +DEF BASE_HAPPINESS EQU 70 +DEF FRIEND_BALL_HAPPINESS EQU 200 +DEF HAPPINESS_TO_EVOLVE EQU 220 +DEF HAPPINESS_THRESHOLD_1 EQU 100 +DEF HAPPINESS_THRESHOLD_2 EQU 200 ; PP -PP_UP_MASK EQU %11000000 -PP_UP_ONE EQU %01000000 -PP_MASK EQU %00111111 +DEF PP_UP_MASK EQU %11000000 +DEF PP_UP_ONE EQU %01000000 +DEF PP_MASK EQU %00111111 diff --git a/constants/radio_constants.asm b/constants/radio_constants.asm index f0899e071..f719f2db1 100644 --- a/constants/radio_constants.asm +++ b/constants/radio_constants.asm @@ -15,7 +15,7 @@ const POKE_FLUTE_RADIO ; 08 const UNOWN_RADIO ; 09 const EVOLUTION_RADIO ; 0a -NUM_RADIO_CHANNELS EQU const_value +DEF NUM_RADIO_CHANNELS EQU const_value ; internal indexes for channel segments const OAKS_POKEMON_TALK_2 ; 0b const OAKS_POKEMON_TALK_3 ; 0c @@ -94,7 +94,7 @@ NUM_RADIO_CHANNELS EQU const_value const POKEDEX_SHOW_6 ; 55 const POKEDEX_SHOW_7 ; 56 const POKEDEX_SHOW_8 ; 57 -NUM_RADIO_SEGMENTS EQU const_value +DEF NUM_RADIO_SEGMENTS EQU const_value ; PlayRadioStationPointers indexes (see engine/pokegear/pokegear.asm) const_def @@ -107,21 +107,21 @@ NUM_RADIO_SEGMENTS EQU const_value const MAPRADIO_PLACES_PEOPLE const MAPRADIO_LETS_ALL_SING const MAPRADIO_ROCKET -NUM_MAP_RADIO_STATIONS EQU const_value +DEF NUM_MAP_RADIO_STATIONS EQU const_value ; These tables in engine/pokegear/radio.asm are all sized to a power of 2 ; so there's no need for a rejection sampling loop -NUM_OAKS_POKEMON_TALK_ADVERBS EQU 16 ; OaksPKMNTalk8.Adverbs -NUM_OAKS_POKEMON_TALK_ADJECTIVES EQU 16 ; OaksPKMNTalk9.Adjectives -NUM_PNP_PEOPLE_ADJECTIVES EQU 16 ; PeoplePlaces5.Adjectives -NUM_PNP_PLACES_ADJECTIVES EQU 16 ; PeoplePlaces7.Adjectives +DEF NUM_OAKS_POKEMON_TALK_ADVERBS EQU 16 ; OaksPKMNTalk8.Adverbs +DEF NUM_OAKS_POKEMON_TALK_ADJECTIVES EQU 16 ; OaksPKMNTalk9.Adjectives +DEF NUM_PNP_PEOPLE_ADJECTIVES EQU 16 ; PeoplePlaces5.Adjectives +DEF NUM_PNP_PLACES_ADJECTIVES EQU 16 ; PeoplePlaces7.Adjectives ; BuenasPasswordTable sizes (see data/radio/buenas_passwords.asm) -NUM_PASSWORD_CATEGORIES EQU 11 -NUM_PASSWORDS_PER_CATEGORY EQU 3 +DEF NUM_PASSWORD_CATEGORIES EQU 11 +DEF NUM_PASSWORDS_PER_CATEGORY EQU 3 ; BuenaPrizeItems size (see data/items/buena_prizes.asm) -NUM_BUENA_PRIZES EQU 9 +DEF NUM_BUENA_PRIZES EQU 9 ; GetBuenasPassword.StringFunctionJumpTable indexes (see engine/pokegear/radio.asm) const_def @@ -129,4 +129,4 @@ NUM_BUENA_PRIZES EQU 9 const BUENA_ITEM const BUENA_MOVE const BUENA_STRING -NUM_BUENA_FUNCTIONS EQU const_value +DEF NUM_BUENA_FUNCTIONS EQU const_value diff --git a/constants/scene_constants.asm b/constants/scene_constants.asm index 6039d69b5..5c4f47428 100644 --- a/constants/scene_constants.asm +++ b/constants/scene_constants.asm @@ -2,13 +2,13 @@ ; Each scene_script and coord_event is associated with a current scene ID. ; Scene variables default to 0. -SCENE_DEFAULT EQU 0 +DEF SCENE_DEFAULT EQU 0 ; Often a map will have a one-time default event for scene 0, and switch to a ; do-nothing scene 1 when the event finishes. -SCENE_FINISHED EQU 1 +DEF SCENE_FINISHED EQU 1 ; A coord_event for scene -1 will always activate, regardless of the map's ; scene variable value. -SCENE_ALWAYS EQU -1 +DEF SCENE_ALWAYS EQU -1 ; wPokecenter2FSceneID const_def 1 diff --git a/constants/scgb_constants.asm b/constants/scgb_constants.asm index 0e923342c..449be751a 100644 --- a/constants/scgb_constants.asm +++ b/constants/scgb_constants.asm @@ -32,10 +32,10 @@ const SCGB_TRAINER_OR_MON_FRONTPIC_PALS const SCGB_MYSTERY_GIFT const SCGB_1E -NUM_SCGB_LAYOUTS EQU const_value +DEF NUM_SCGB_LAYOUTS EQU const_value -SCGB_PARTY_MENU_HP_BARS EQU $fc -SCGB_DEFAULT EQU $ff +DEF SCGB_PARTY_MENU_HP_BARS EQU $fc +DEF SCGB_DEFAULT EQU $ff ; GetCrystalCGBLayout arguments (see engine/gfx/crystal_layouts.asm) const_def @@ -125,7 +125,7 @@ SCGB_DEFAULT EQU $ff const PREDEFPAL_UNOWN_PUZZLE const PREDEFPAL_GAMEFREAK_LOGO_OB const PREDEFPAL_GAMEFREAK_LOGO_BG -NUM_PREDEF_PALS EQU const_value +DEF NUM_PREDEF_PALS EQU const_value ; SGB system command codes ; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_System_Command_Table @@ -156,4 +156,4 @@ NUM_PREDEF_PALS EQU const_value const SGB_MASK_EN const SGB_OBJ_TRN -PALPACKET_LENGTH EQU $10 +DEF PALPACKET_LENGTH EQU $10 diff --git a/constants/script_constants.asm b/constants/script_constants.asm index 7e1de6a7c..9bf64a804 100644 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -1,15 +1,15 @@ ; object constants -PLAYER EQU 0 -LAST_TALKED EQU -2 +DEF PLAYER EQU 0 +DEF LAST_TALKED EQU -2 ; string buffer constants const_def const STRING_BUFFER_3 ; use wStringBuffer3 const STRING_BUFFER_4 ; use wStringBuffer4 const STRING_BUFFER_5 ; use wStringBuffer5 -NUM_STRING_BUFFERS EQU const_value +DEF NUM_STRING_BUFFERS EQU const_value -STRING_BUFFER_LENGTH EQU 19 +DEF STRING_BUFFER_LENGTH EQU 19 ; checkmoney/takemoney accounts const_def @@ -72,12 +72,12 @@ STRING_BUFFER_LENGTH EQU 19 const VAR_BLUECARDBALANCE ; 18 const VAR_BUENASPASSWORD ; 19 const VAR_KENJI_BREAK ; 1a -NUM_VARS EQU const_value ; 1b +DEF NUM_VARS EQU const_value ; variable action types -RETVAR_STRBUF2 EQU 0 << 6 -RETVAR_ADDR_DE EQU 1 << 6 -RETVAR_EXECUTE EQU 2 << 6 +DEF RETVAR_STRBUF2 EQU 0 << 6 +DEF RETVAR_ADDR_DE EQU 1 << 6 +DEF RETVAR_EXECUTE EQU 2 << 6 ; PlayerEventScriptPointers indexes (see engine/overworld/events.asm) const_def -1 @@ -92,7 +92,7 @@ RETVAR_EXECUTE EQU 2 << 6 const PLAYEREVENT_WHITEOUT const PLAYEREVENT_HATCH const PLAYEREVENT_JOYCHANGEFACING -NUM_PLAYER_EVENTS EQU const_value +DEF NUM_PLAYER_EVENTS EQU const_value ; PlayerMovementPointers indexes (see engine/overworld/events.asm) const_def @@ -104,15 +104,15 @@ NUM_PLAYER_EVENTS EQU const_value const PLAYERMOVEMENT_CONTINUE const PLAYERMOVEMENT_EXIT_WATER const PLAYERMOVEMENT_JUMP -NUM_PLAYER_MOVEMENTS EQU const_value +DEF NUM_PLAYER_MOVEMENTS EQU const_value ; script data sizes (see macros/scripts/maps.asm) -SCENE_SCRIPT_SIZE EQU 4 ; scene_script -CALLBACK_SIZE EQU 3 ; callback -WARP_EVENT_SIZE EQU 5 ; warp_event -COORD_EVENT_SIZE EQU 8 ; coord_event -BG_EVENT_SIZE EQU 5 ; bg_event -OBJECT_EVENT_SIZE EQU 13 ; object_event +DEF SCENE_SCRIPT_SIZE EQU 4 ; scene_script +DEF CALLBACK_SIZE EQU 3 ; callback +DEF WARP_EVENT_SIZE EQU 5 ; warp_event +DEF COORD_EVENT_SIZE EQU 8 ; coord_event +DEF BG_EVENT_SIZE EQU 5 ; bg_event +DEF OBJECT_EVENT_SIZE EQU 13 ; object_event ; bg_event types ; BGEventJumptable indexes (see engine/overworld/events.asm) @@ -126,7 +126,7 @@ OBJECT_EVENT_SIZE EQU 13 ; object_event const BGEVENT_IFNOTSET const BGEVENT_ITEM const BGEVENT_COPY -NUM_BGEVENTS EQU const_value +DEF NUM_BGEVENTS EQU const_value ; object_event types ; ObjectEventTypeArray indexes (see engine/overworld/events.asm) @@ -138,17 +138,17 @@ NUM_BGEVENTS EQU const_value const OBJECTTYPE_4 const OBJECTTYPE_5 const OBJECTTYPE_6 -NUM_OBJECT_TYPES EQU const_value +DEF NUM_OBJECT_TYPES EQU const_value ; command queue members -CMDQUEUE_TYPE EQU 0 -CMDQUEUE_ADDR EQU 1 -CMDQUEUE_02 EQU 2 -CMDQUEUE_03 EQU 3 -CMDQUEUE_04 EQU 4 -CMDQUEUE_05 EQU 5 -CMDQUEUE_ENTRY_SIZE EQU 6 -CMDQUEUE_CAPACITY EQU 4 +DEF CMDQUEUE_TYPE EQU 0 +DEF CMDQUEUE_ADDR EQU 1 +DEF CMDQUEUE_02 EQU 2 +DEF CMDQUEUE_03 EQU 3 +DEF CMDQUEUE_04 EQU 4 +DEF CMDQUEUE_05 EQU 5 +DEF CMDQUEUE_ENTRY_SIZE EQU 6 +DEF CMDQUEUE_CAPACITY EQU 4 ; HandleQueuedCommand.Jumptable indexes (see engine/overworld/events.asm) const_def @@ -157,7 +157,7 @@ CMDQUEUE_CAPACITY EQU 4 const CMDQUEUE_STONETABLE const CMDQUEUE_TYPE3 const CMDQUEUE_TYPE4 -NUM_CMDQUEUE_TYPES EQU const_value +DEF NUM_CMDQUEUE_TYPES EQU const_value ; elevfloor macro values ; ElevatorFloorNames indexes (see data/events/elevator_floors.asm) @@ -178,7 +178,7 @@ NUM_CMDQUEUE_TYPES EQU const_value const FLOOR_10F const FLOOR_11F const FLOOR_ROOF -NUM_FLOORS EQU const_value +DEF NUM_FLOORS EQU const_value ; showemote arguments ; Emotes indexes (see data/sprites/emotes.asm) @@ -195,9 +195,9 @@ NUM_FLOORS EQU const_value const EMOTE_ROD const EMOTE_BOULDER_DUST const EMOTE_GRASS_RUSTLE -NUM_EMOTES EQU const_value -EMOTE_FROM_MEM EQU -1 -EMOTE_LENGTH EQU 6 +DEF NUM_EMOTES EQU const_value +DEF EMOTE_FROM_MEM EQU -1 +DEF EMOTE_LENGTH EQU 6 ; fruittree arguments ; FruitTreeItems indexes (see data/items/fruit_trees.asm) @@ -232,7 +232,7 @@ EMOTE_LENGTH EQU 6 const FRUITTREE_PEWTER_CITY_1 ; 1c const FRUITTREE_PEWTER_CITY_2 ; 1d const FRUITTREE_FUCHSIA_CITY ; 1e -NUM_FRUIT_TREES EQU const_value - 1 +DEF NUM_FRUIT_TREES EQU const_value - 1 ; describedecoration arguments ; DescribeDecoration.JumpTable indexes (see engine/overworld/decorations.asm) @@ -242,7 +242,7 @@ NUM_FRUIT_TREES EQU const_value - 1 const DECODESC_RIGHT_DOLL ; 2 const DECODESC_BIG_DOLL ; 3 const DECODESC_CONSOLE ; 4 -NUM_DECODESCS EQU const_value +DEF NUM_DECODESCS EQU const_value ; swarm arguments ; StoreSwarmMapIndices arguments @@ -284,12 +284,12 @@ NUM_DECODESCS EQU const_value const BUGCONTEST_NO_CATCH ; 2 ; Bug-Catching Contest values -BUG_CONTEST_BALLS EQU 20 -BUG_CONTEST_MINUTES EQU 20 -BUG_CONTEST_SECONDS EQU 0 -BUG_CONTEST_PLAYER EQU 1 -NUM_BUG_CONTESTANTS EQU 10 ; not counting the player -BUG_CONTESTANT_SIZE EQU 4 +DEF BUG_CONTEST_BALLS EQU 20 +DEF BUG_CONTEST_MINUTES EQU 20 +DEF BUG_CONTEST_SECONDS EQU 0 +DEF BUG_CONTEST_PLAYER EQU 1 +DEF NUM_BUG_CONTESTANTS EQU 10 ; not counting the player +DEF BUG_CONTESTANT_SIZE EQU 4 ; HealMachineAnim setval arguments ; HealMachineAnim.Pointers indexes (see engine/events/heal_machine_anim.asm) @@ -305,7 +305,7 @@ BUG_CONTESTANT_SIZE EQU 4 const UNOWNPUZZLE_OMANYTE ; 1 const UNOWNPUZZLE_AERODACTYL ; 2 const UNOWNPUZZLE_HO_OH ; 3 -NUM_UNOWN_PUZZLES EQU const_value +DEF NUM_UNOWN_PUZZLES EQU const_value ; DisplayUnownWords setval arguments ; UnownWalls and MenuHeaders_UnownWalls indexes (see data/events/unown_walls.asm) diff --git a/constants/serial_constants.asm b/constants/serial_constants.asm index e8e6929bb..97b176c58 100644 --- a/constants/serial_constants.asm +++ b/constants/serial_constants.asm @@ -7,41 +7,41 @@ const LINK_MOBILE ; 4 ; hSerialReceive high nybbles -SERIAL_TIMECAPSULE EQU $60 -SERIAL_TRADECENTER EQU $70 -SERIAL_BATTLE EQU $80 +DEF SERIAL_TIMECAPSULE EQU $60 +DEF SERIAL_TRADECENTER EQU $70 +DEF SERIAL_BATTLE EQU $80 -ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 -ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK EQU $02 +DEF ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK EQU $01 +DEF ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK EQU $02 -START_TRANSFER_EXTERNAL_CLOCK EQU $80 ; 1 << rSC_ON -START_TRANSFER_INTERNAL_CLOCK EQU $81 ; (1 << rSC_ON) | 1 +DEF START_TRANSFER_EXTERNAL_CLOCK EQU $80 ; 1 << rSC_ON +DEF START_TRANSFER_INTERNAL_CLOCK EQU $81 ; (1 << rSC_ON) | 1 ; hSerialConnectionStatus -USING_EXTERNAL_CLOCK EQU $01 -USING_INTERNAL_CLOCK EQU $02 -CONNECTION_NOT_ESTABLISHED EQU $ff +DEF USING_EXTERNAL_CLOCK EQU $01 +DEF USING_INTERNAL_CLOCK EQU $02 +DEF CONNECTION_NOT_ESTABLISHED EQU $ff ; length of a patch list (less than any of the signal bytes) -SERIAL_PATCH_LIST_LENGTH EQU $fc +DEF SERIAL_PATCH_LIST_LENGTH EQU $fc ; signals the start of an array of bytes transferred over the link cable -SERIAL_PREAMBLE_BYTE EQU $fd +DEF SERIAL_PREAMBLE_BYTE EQU $fd ; this byte is used when there is no data to send -SERIAL_NO_DATA_BYTE EQU $fe +DEF SERIAL_NO_DATA_BYTE EQU $fe ; signals the end of one part of a patch list (there are two parts) for player/enemy party data -SERIAL_PATCH_LIST_PART_TERMINATOR EQU $ff +DEF SERIAL_PATCH_LIST_PART_TERMINATOR EQU $ff ; used to replace SERIAL_NO_DATA_BYTE -SERIAL_PATCH_REPLACEMENT_BYTE EQU $ff +DEF SERIAL_PATCH_REPLACEMENT_BYTE EQU $ff -SERIAL_PREAMBLE_LENGTH EQU 6 -SERIAL_RN_PREAMBLE_LENGTH EQU 7 -SERIAL_RNS_LENGTH EQU 10 +DEF SERIAL_PREAMBLE_LENGTH EQU 6 +DEF SERIAL_RN_PREAMBLE_LENGTH EQU 7 +DEF SERIAL_RNS_LENGTH EQU 10 -SERIAL_MAIL_PREAMBLE_BYTE EQU $20 -SERIAL_MAIL_REPLACEMENT_BYTE EQU $21 -SERIAL_MAIL_PREAMBLE_LENGTH EQU 5 +DEF SERIAL_MAIL_PREAMBLE_BYTE EQU $20 +DEF SERIAL_MAIL_REPLACEMENT_BYTE EQU $21 +DEF SERIAL_MAIL_PREAMBLE_LENGTH EQU 5 ; timeout duration after exchanging a byte -SERIAL_LINK_BYTE_TIMEOUT EQU $5000 +DEF SERIAL_LINK_BYTE_TIMEOUT EQU $5000 -MAX_MYSTERY_GIFT_PARTNERS EQU 5 +DEF MAX_MYSTERY_GIFT_PARTNERS EQU 5 diff --git a/constants/sfx_constants.asm b/constants/sfx_constants.asm index 56ee0b55f..b51e6ddb1 100644 --- a/constants/sfx_constants.asm +++ b/constants/sfx_constants.asm @@ -208,4 +208,4 @@ const SFX_TWO_PC_BEEPS ; cc const SFX_4_NOTE_DITTY ; cd const SFX_TWINKLE ; ce -NUM_SFX EQU const_value +DEF NUM_SFX EQU const_value diff --git a/constants/sprite_anim_constants.asm b/constants/sprite_anim_constants.asm index c14214274..41b113a4b 100644 --- a/constants/sprite_anim_constants.asm +++ b/constants/sprite_anim_constants.asm @@ -1,23 +1,23 @@ ; sprite_anim_struct members (see macros/wram.asm) rsreset -SPRITEANIMSTRUCT_INDEX rb ; 0 -SPRITEANIMSTRUCT_FRAMESET_ID rb ; 1 -SPRITEANIMSTRUCT_ANIM_SEQ_ID rb ; 2 -SPRITEANIMSTRUCT_TILE_ID rb ; 3 -SPRITEANIMSTRUCT_XCOORD rb ; 4 -SPRITEANIMSTRUCT_YCOORD rb ; 5 -SPRITEANIMSTRUCT_XOFFSET rb ; 6 -SPRITEANIMSTRUCT_YOFFSET rb ; 7 -SPRITEANIMSTRUCT_DURATION rb ; 8 -SPRITEANIMSTRUCT_DURATIONOFFSET rb ; 9 -SPRITEANIMSTRUCT_FRAME rb ; a -SPRITEANIMSTRUCT_JUMPTABLE_INDEX rb ; b -SPRITEANIMSTRUCT_VAR1 rb ; c -SPRITEANIMSTRUCT_VAR2 rb ; d -SPRITEANIMSTRUCT_VAR3 rb ; e -SPRITEANIMSTRUCT_VAR4 rb ; f -SPRITEANIMSTRUCT_LENGTH EQU _RS -NUM_SPRITE_ANIM_STRUCTS EQU 10 ; see wSpriteAnimationStructs +DEF SPRITEANIMSTRUCT_INDEX rb ; 0 +DEF SPRITEANIMSTRUCT_FRAMESET_ID rb ; 1 +DEF SPRITEANIMSTRUCT_ANIM_SEQ_ID rb ; 2 +DEF SPRITEANIMSTRUCT_TILE_ID rb ; 3 +DEF SPRITEANIMSTRUCT_XCOORD rb ; 4 +DEF SPRITEANIMSTRUCT_YCOORD rb ; 5 +DEF SPRITEANIMSTRUCT_XOFFSET rb ; 6 +DEF SPRITEANIMSTRUCT_YOFFSET rb ; 7 +DEF SPRITEANIMSTRUCT_DURATION rb ; 8 +DEF SPRITEANIMSTRUCT_DURATIONOFFSET rb ; 9 +DEF SPRITEANIMSTRUCT_FRAME rb ; a +DEF SPRITEANIMSTRUCT_JUMPTABLE_INDEX rb ; b +DEF SPRITEANIMSTRUCT_VAR1 rb ; c +DEF SPRITEANIMSTRUCT_VAR2 rb ; d +DEF SPRITEANIMSTRUCT_VAR3 rb ; e +DEF SPRITEANIMSTRUCT_VAR4 rb ; f +DEF SPRITEANIMSTRUCT_LENGTH EQU _RS +DEF NUM_SPRITE_ANIM_STRUCTS EQU 10 ; see wSpriteAnimationStructs ; wSpriteAnimDict keys (see wram.asm) ; UnusedSpriteAnimGFX indexes (see data/sprite_anims/unused_gfx.asm) @@ -28,10 +28,10 @@ NUM_SPRITE_ANIM_STRUCTS EQU 10 ; see wSpriteAnimationStructs const SPRITE_ANIM_DICT_GS_SPLASH ; 6 const SPRITE_ANIM_DICT_SLOTS ; 7 const SPRITE_ANIM_DICT_ARROW_CURSOR ; 8 -NUM_SPRITE_ANIM_GFX EQU const_value +DEF NUM_SPRITE_ANIM_GFX EQU const_value ; wSpriteAnimDict size (see wram.asm) -NUM_SPRITEANIMDICT_ENTRIES EQU 10 +DEF NUM_SPRITEANIMDICT_ENTRIES EQU 10 ; SpriteAnimSeqData indexes (see data/sprite_anims/sequences.asm) const_def @@ -80,7 +80,7 @@ NUM_SPRITEANIMDICT_ENTRIES EQU 10 const SPRITE_ANIM_INDEX_INTRO_UNOWN_F ; 2a const SPRITE_ANIM_INDEX_INTRO_SUICUNE_AWAY ; 2b const SPRITE_ANIM_INDEX_CELEBI ; 2c -NUM_SPRITE_ANIM_INDEXES EQU const_value +DEF NUM_SPRITE_ANIM_INDEXES EQU const_value ; DoAnimFrame.Jumptable indexes (see engine/gfx/sprite_anims.asm) const_def @@ -119,7 +119,7 @@ NUM_SPRITE_ANIM_INDEXES EQU const_value const SPRITE_ANIM_SEQ_INTRO_UNOWN ; 20 const SPRITE_ANIM_SEQ_INTRO_UNOWN_F ; 21 const SPRITE_ANIM_SEQ_INTRO_SUICUNE_AWAY ; 22 -NUM_SPRITE_ANIM_SEQS EQU const_value +DEF NUM_SPRITE_ANIM_SEQS EQU const_value ; SpriteAnimFrameData indexes (see data/sprite_anims/framesets.asm) const_def @@ -189,7 +189,7 @@ NUM_SPRITE_ANIM_SEQS EQU const_value const SPRITE_ANIM_FRAMESET_INTRO_UNOWN_F ; 3f const SPRITE_ANIM_FRAMESET_CELEBI_LEFT ; 40 const SPRITE_ANIM_FRAMESET_CELEBI_RIGHT ; 41 -NUM_SPRITE_ANIM_FRAMESETS EQU const_value +DEF NUM_SPRITE_ANIM_FRAMESETS EQU const_value ; SpriteAnimOAMData indexes (see data/sprite_anims/oam.asm) const_def @@ -333,4 +333,4 @@ NUM_SPRITE_ANIM_FRAMESETS EQU const_value const SPRITE_ANIM_OAMSET_GAMEFREAK_LOGO_9 ; 89 const SPRITE_ANIM_OAMSET_GAMEFREAK_LOGO_10 ; 8a const SPRITE_ANIM_OAMSET_GAMEFREAK_LOGO_11 ; 8b -NUM_SPRITE_ANIM_OAMSETS EQU const_value +DEF NUM_SPRITE_ANIM_OAMSETS EQU const_value diff --git a/constants/sprite_constants.asm b/constants/sprite_constants.asm index 288f2e9a8..07e74f550 100644 --- a/constants/sprite_constants.asm +++ b/constants/sprite_constants.asm @@ -104,11 +104,11 @@ const SPRITE_ENTEI ; 64 const SPRITE_RAIKOU ; 65 const SPRITE_STANDING_YOUNGSTER ; 66 -NUM_OVERWORLD_SPRITES EQU const_value - 1 +DEF NUM_OVERWORLD_SPRITES EQU const_value - 1 ; SpriteMons indexes (see data/sprites/sprite_mons.asm) const_next $80 -SPRITE_POKEMON EQU const_value +DEF SPRITE_POKEMON EQU const_value const SPRITE_UNOWN ; 80 const SPRITE_GEODUDE ; 81 const SPRITE_GROWLITHE ; 82 @@ -144,7 +144,7 @@ SPRITE_POKEMON EQU const_value const SPRITE_GYARADOS ; a0 const SPRITE_LUGIA ; a1 const SPRITE_HO_OH ; a2 -NUM_POKEMON_SPRITES EQU const_value - SPRITE_POKEMON +DEF NUM_POKEMON_SPRITES EQU const_value - SPRITE_POKEMON ; special GetMonSprite values (see engine/overworld/overworld.asm) const_next $e0 @@ -153,7 +153,7 @@ NUM_POKEMON_SPRITES EQU const_value - SPRITE_POKEMON ; wVariableSprites indexes (see wram.asm) const_next $f0 -SPRITE_VARS EQU const_value +DEF SPRITE_VARS EQU const_value const SPRITE_CONSOLE ; f0 const SPRITE_DOLL_1 ; f1 const SPRITE_DOLL_2 ; f2 diff --git a/constants/sprite_data_constants.asm b/constants/sprite_data_constants.asm index 64ff9c838..407252bed 100644 --- a/constants/sprite_data_constants.asm +++ b/constants/sprite_data_constants.asm @@ -1,11 +1,11 @@ ; overworld_sprite struct members (see data/sprites/sprites.asm) rsreset -SPRITEDATA_ADDR rw ; 0 -SPRITEDATA_SIZE rb ; 2 -SPRITEDATA_BANK rb ; 3 -SPRITEDATA_TYPE rb ; 4 -SPRITEDATA_PALETTE rb ; 5 -NUM_SPRITEDATA_FIELDS EQU _RS +DEF SPRITEDATA_ADDR rw ; 0 +DEF SPRITEDATA_SIZE rb ; 2 +DEF SPRITEDATA_BANK rb ; 3 +DEF SPRITEDATA_TYPE rb ; 4 +DEF SPRITEDATA_PALETTE rb ; 5 +DEF NUM_SPRITEDATA_FIELDS EQU _RS ; sprite types const_def 1 diff --git a/constants/text_constants.asm b/constants/text_constants.asm index a42835f25..67ed07ef2 100644 --- a/constants/text_constants.asm +++ b/constants/text_constants.asm @@ -1,12 +1,12 @@ ; name lengths -NAME_LENGTH EQU 11 -PLAYER_NAME_LENGTH EQU 8 -BOX_NAME_LENGTH EQU 9 -MON_NAME_LENGTH EQU 11 -MOVE_NAME_LENGTH EQU 13 -ITEM_NAME_LENGTH EQU 13 -TRAINER_CLASS_NAME_LENGTH EQU 13 -NAME_LENGTH_JAPANESE EQU 6 +DEF NAME_LENGTH EQU 11 +DEF PLAYER_NAME_LENGTH EQU 8 +DEF BOX_NAME_LENGTH EQU 9 +DEF MON_NAME_LENGTH EQU 11 +DEF MOVE_NAME_LENGTH EQU 13 +DEF ITEM_NAME_LENGTH EQU 13 +DEF TRAINER_CLASS_NAME_LENGTH EQU 13 +DEF NAME_LENGTH_JAPANESE EQU 6 ; GetName types (see home/names.asm) const_def 1 @@ -20,18 +20,18 @@ NAME_LENGTH_JAPANESE EQU 6 const MOVE_DESC_NAME_BROKEN ; 8 ; see home/text.asm -BORDER_WIDTH EQU 2 -TEXTBOX_WIDTH EQU SCREEN_WIDTH -TEXTBOX_INNERW EQU TEXTBOX_WIDTH - BORDER_WIDTH -TEXTBOX_HEIGHT EQU 6 -TEXTBOX_INNERH EQU TEXTBOX_HEIGHT - BORDER_WIDTH -TEXTBOX_X EQU 0 -TEXTBOX_INNERX EQU TEXTBOX_X + 1 -TEXTBOX_Y EQU SCREEN_HEIGHT - TEXTBOX_HEIGHT -TEXTBOX_INNERY EQU TEXTBOX_Y + 2 +DEF BORDER_WIDTH EQU 2 +DEF TEXTBOX_WIDTH EQU SCREEN_WIDTH +DEF TEXTBOX_INNERW EQU TEXTBOX_WIDTH - BORDER_WIDTH +DEF TEXTBOX_HEIGHT EQU 6 +DEF TEXTBOX_INNERH EQU TEXTBOX_HEIGHT - BORDER_WIDTH +DEF TEXTBOX_X EQU 0 +DEF TEXTBOX_INNERX EQU TEXTBOX_X + 1 +DEF TEXTBOX_Y EQU SCREEN_HEIGHT - TEXTBOX_HEIGHT +DEF TEXTBOX_INNERY EQU TEXTBOX_Y + 2 ; see gfx/frames/*.png -TEXTBOX_FRAME_TILES EQU 6 +DEF TEXTBOX_FRAME_TILES EQU 6 ; PrintNum bit flags const_def 5 @@ -40,13 +40,13 @@ TEXTBOX_FRAME_TILES EQU 6 const PRINTNUM_LEADINGZEROS_F ; 7 ; PrintNum arguments (see engine/math/print_num.asm) -PRINTNUM_MONEY EQU 1 << PRINTNUM_MONEY_F -PRINTNUM_LEFTALIGN EQU 1 << PRINTNUM_LEFTALIGN_F -PRINTNUM_LEADINGZEROS EQU 1 << PRINTNUM_LEADINGZEROS_F +DEF PRINTNUM_MONEY EQU 1 << PRINTNUM_MONEY_F +DEF PRINTNUM_LEFTALIGN EQU 1 << PRINTNUM_LEFTALIGN_F +DEF PRINTNUM_LEADINGZEROS EQU 1 << PRINTNUM_LEADINGZEROS_F ; character sets (see charmap.asm) -FIRST_REGULAR_TEXT_CHAR EQU $60 -FIRST_HIRAGANA_DAKUTEN_CHAR EQU $20 +DEF FIRST_REGULAR_TEXT_CHAR EQU $60 +DEF FIRST_HIRAGANA_DAKUTEN_CHAR EQU $20 ; gfx/font/unown_font.png -FIRST_UNOWN_CHAR EQU $40 +DEF FIRST_UNOWN_CHAR EQU $40 diff --git a/constants/tileset_constants.asm b/constants/tileset_constants.asm index a77b26587..2b4f9769d 100644 --- a/constants/tileset_constants.asm +++ b/constants/tileset_constants.asm @@ -36,13 +36,13 @@ const TILESET_KABUTO_WORD_ROOM ; 22 const TILESET_OMANYTE_WORD_ROOM ; 23 const TILESET_AERODACTYL_WORD_ROOM ; 24 -NUM_TILESETS EQU const_value - 1 +DEF NUM_TILESETS EQU const_value - 1 ; wTileset struct size -TILESET_LENGTH EQU 15 +DEF TILESET_LENGTH EQU 15 ; roof length (see gfx/tilesets/roofs) -ROOF_LENGTH EQU 9 +DEF ROOF_LENGTH EQU 9 ; bg palette values (see gfx/tilesets/*_palette_map.asm) ; TilesetBGPalette indexes (see gfx/tilesets/bg_tiles.pal) diff --git a/constants/trainer_constants.asm b/constants/trainer_constants.asm index 0def00858..a56ab82d4 100644 --- a/constants/trainer_constants.asm +++ b/constants/trainer_constants.asm @@ -1,8 +1,8 @@ -__trainer_class__ = 0 +DEF __trainer_class__ = 0 -trainerclass: MACRO -\1 EQU __trainer_class__ -__trainer_class__ += 1 +MACRO trainerclass + DEF \1 EQU __trainer_class__ + DEF __trainer_class__ += 1 const_def 1 ENDM @@ -18,16 +18,16 @@ ENDM ; - BTTrainerClassSprites (see data/trainers/sprites.asm) ; - BTTrainerClassGenders (see data/trainers/genders.asm) ; trainer constants are Trainers indexes, for the sub-tables of TrainerGroups (see data/trainers/parties.asm) -CHRIS EQU __trainer_class__ +DEF CHRIS EQU __trainer_class__ trainerclass TRAINER_NONE ; 0 const PHONECONTACT_MOM const PHONECONTACT_BIKESHOP const PHONECONTACT_BILL const PHONECONTACT_ELM const PHONECONTACT_BUENA -NUM_NONTRAINER_PHONECONTACTS EQU const_value - 1 +DEF NUM_NONTRAINER_PHONECONTACTS EQU const_value - 1 -KRIS EQU __trainer_class__ +DEF KRIS EQU __trainer_class__ trainerclass FALKNER ; 1 const FALKNER1 @@ -703,4 +703,4 @@ KRIS EQU __trainer_class__ trainerclass MYSTICALMAN ; 43 const EUSINE -NUM_TRAINER_CLASSES EQU __trainer_class__ - 1 +DEF NUM_TRAINER_CLASSES EQU __trainer_class__ - 1 diff --git a/constants/trainer_data_constants.asm b/constants/trainer_data_constants.asm index fd081b7c4..b08de9deb 100644 --- a/constants/trainer_data_constants.asm +++ b/constants/trainer_data_constants.asm @@ -1,11 +1,11 @@ ; TrainerClassAttributes struct members (see data/trainers/attributes.asm) rsreset -TRNATTR_ITEM1 rb ; 0 -TRNATTR_ITEM2 rb ; 1 -TRNATTR_BASEMONEY rb ; 2 -TRNATTR_AI_MOVE_WEIGHTS rw ; 3 -TRNATTR_AI_ITEM_SWITCH rw ; 5 -NUM_TRAINER_ATTRIBUTES EQU _RS +DEF TRNATTR_ITEM1 rb ; 0 +DEF TRNATTR_ITEM2 rb ; 1 +DEF TRNATTR_BASEMONEY rb ; 2 +DEF TRNATTR_AI_MOVE_WEIGHTS rw ; 3 +DEF TRNATTR_AI_ITEM_SWITCH rw ; 5 +DEF NUM_TRAINER_ATTRIBUTES EQU _RS ; TRNATTR_AI_MOVE_WEIGHTS bit flags (wEnemyTrainerAIFlags) ; AIScoringPointers indexes (see engine/battle/ai/move.asm) @@ -20,7 +20,7 @@ NUM_TRAINER_ATTRIBUTES EQU _RS shift_const AI_CAUTIOUS shift_const AI_STATUS shift_const AI_RISKY -NO_AI EQU 0 +DEF NO_AI EQU 0 ; TRNATTR_AI_ITEM_SWITCH bit flags const_def @@ -32,12 +32,12 @@ NO_AI EQU 0 const UNKNOWN_USE_F ; 5 const CONTEXT_USE_F ; 6 -SWITCH_OFTEN EQU 1 << SWITCH_OFTEN_F -SWITCH_RARELY EQU 1 << SWITCH_RARELY_F -SWITCH_SOMETIMES EQU 1 << SWITCH_SOMETIMES_F -ALWAYS_USE EQU 1 << ALWAYS_USE_F -UNKNOWN_USE EQU 1 << UNKNOWN_USE_F -CONTEXT_USE EQU 1 << CONTEXT_USE_F +DEF SWITCH_OFTEN EQU 1 << SWITCH_OFTEN_F +DEF SWITCH_RARELY EQU 1 << SWITCH_RARELY_F +DEF SWITCH_SOMETIMES EQU 1 << SWITCH_SOMETIMES_F +DEF ALWAYS_USE EQU 1 << ALWAYS_USE_F +DEF UNKNOWN_USE EQU 1 << UNKNOWN_USE_F +DEF CONTEXT_USE EQU 1 << CONTEXT_USE_F ; TrainerTypes indexes (see engine/battle/read_trainer_party.asm) const_def diff --git a/constants/type_constants.asm b/constants/type_constants.asm index 5bce009d5..49fa661d8 100644 --- a/constants/type_constants.asm +++ b/constants/type_constants.asm @@ -6,7 +6,7 @@ ; - TypeBoostItems (see data/types/type_boost_items.asm) const_def -PHYSICAL EQU const_value +DEF PHYSICAL EQU const_value const NORMAL const FIGHTING const FLYING @@ -18,12 +18,12 @@ PHYSICAL EQU const_value const GHOST const STEEL -UNUSED_TYPES EQU const_value +DEF UNUSED_TYPES EQU const_value const_next 19 const CURSE_TYPE -UNUSED_TYPES_END EQU const_value +DEF UNUSED_TYPES_END EQU const_value -SPECIAL EQU const_value +DEF SPECIAL EQU const_value const FIRE const WATER const GRASS @@ -32,8 +32,8 @@ SPECIAL EQU const_value const ICE const DRAGON const DARK -TYPES_END EQU const_value +DEF TYPES_END EQU const_value -NUM_TYPES EQU TYPES_END + UNUSED_TYPES - UNUSED_TYPES_END - 1 ; discount BIRD +DEF NUM_TYPES EQU TYPES_END + UNUSED_TYPES - UNUSED_TYPES_END - 1 ; discount BIRD -POKEDEX_TYPE_STRING_LENGTH EQU 9 +DEF POKEDEX_TYPE_STRING_LENGTH EQU 9 diff --git a/constants/wram_constants.asm b/constants/wram_constants.asm index 9b72d346a..6cd206a8c 100644 --- a/constants/wram_constants.asm +++ b/constants/wram_constants.asm @@ -1,5 +1,5 @@ ; wInputType:: -AUTO_INPUT EQU $ff +DEF AUTO_INPUT EQU $ff ; wDebugFlags:: const_def @@ -22,24 +22,24 @@ AUTO_INPUT EQU $ff const WILDMON ; 4 ; wGameTimerPaused:: -GAME_TIMER_PAUSED_F EQU 0 -GAME_TIMER_MOBILE_F EQU 7 +DEF GAME_TIMER_PAUSED_F EQU 0 +DEF GAME_TIMER_MOBILE_F EQU 7 ; wJoypadDisable:: -JOYPAD_DISABLE_MON_FAINT_F EQU 6 -JOYPAD_DISABLE_SGB_TRANSFER_F EQU 7 +DEF JOYPAD_DISABLE_MON_FAINT_F EQU 6 +DEF JOYPAD_DISABLE_SGB_TRANSFER_F EQU 7 ; wOptions1:: -TEXT_DELAY_MASK EQU %111 +DEF TEXT_DELAY_MASK EQU %111 const_def 4 const NO_TEXT_SCROLL ; 4 const STEREO ; 5 const BATTLE_SHIFT ; 6 const BATTLE_SCENE ; 7 -TEXT_DELAY_FAST EQU %001 ; 1 -TEXT_DELAY_MED EQU %011 ; 3 -TEXT_DELAY_SLOW EQU %101 ; 5 +DEF TEXT_DELAY_FAST EQU %001 ; 1 +DEF TEXT_DELAY_MED EQU %011 ; 3 +DEF TEXT_DELAY_SLOW EQU %101 ; 5 ; wTextboxFrame:: const_def @@ -51,7 +51,7 @@ TEXT_DELAY_SLOW EQU %101 ; 5 const FRAME_6 ; 5 const FRAME_7 ; 6 const FRAME_8 ; 7 -NUM_FRAMES EQU const_value +DEF NUM_FRAMES EQU const_value ; wTextboxFlags:: const_def @@ -59,11 +59,11 @@ NUM_FRAMES EQU const_value const NO_TEXT_DELAY_F ; 1 ; wGBPrinterBrightness:: -GBPRINTER_LIGHTEST EQU $00 -GBPRINTER_LIGHTER EQU $20 -GBPRINTER_NORMAL EQU $40 -GBPRINTER_DARKER EQU $60 -GBPRINTER_DARKEST EQU $7f +DEF GBPRINTER_LIGHTEST EQU $00 +DEF GBPRINTER_LIGHTER EQU $20 +DEF GBPRINTER_NORMAL EQU $40 +DEF GBPRINTER_DARKER EQU $60 +DEF GBPRINTER_DARKEST EQU $7f ; wOptions2:: const_def @@ -76,12 +76,12 @@ GBPRINTER_DARKEST EQU $7f const UP ; 1 const LEFT ; 2 const RIGHT ; 3 -NUM_DIRECTIONS EQU const_value +DEF NUM_DIRECTIONS EQU const_value -DOWN_MASK EQU 1 << DOWN -UP_MASK EQU 1 << UP -LEFT_MASK EQU 1 << LEFT -RIGHT_MASK EQU 1 << RIGHT +DEF DOWN_MASK EQU 1 << DOWN +DEF UP_MASK EQU 1 << UP +DEF LEFT_MASK EQU 1 << LEFT +DEF RIGHT_MASK EQU 1 << RIGHT ; wFacingDirection:: const_def NUM_DIRECTIONS - 1, -1 @@ -89,15 +89,15 @@ RIGHT_MASK EQU 1 << RIGHT shift_const FACE_UP ; 4 shift_const FACE_LEFT ; 2 shift_const FACE_RIGHT ; 1 -FACE_CURRENT EQU 0 +DEF FACE_CURRENT EQU 0 ; wPokemonWithdrawDepositParameter:: -PC_WITHDRAW EQU 0 -PC_DEPOSIT EQU 1 -REMOVE_PARTY EQU 0 -REMOVE_BOX EQU 1 -DAY_CARE_WITHDRAW EQU 2 -DAY_CARE_DEPOSIT EQU 3 +DEF PC_WITHDRAW EQU 0 +DEF PC_DEPOSIT EQU 1 +DEF REMOVE_PARTY EQU 0 +DEF REMOVE_BOX EQU 1 +DEF DAY_CARE_WITHDRAW EQU 2 +DEF DAY_CARE_DEPOSIT EQU 3 ; wPlayerStepFlags:: const_def 4 @@ -107,11 +107,11 @@ DAY_CARE_DEPOSIT EQU 3 const PLAYERSTEP_START_F ; 7 ; wInitListType:: -INIT_ENEMYOT_LIST EQU 1 -INIT_BAG_ITEM_LIST EQU 2 -INIT_OTHER_ITEM_LIST EQU 3 -INIT_PLAYEROT_LIST EQU 4 -INIT_MON_LIST EQU 5 +DEF INIT_ENEMYOT_LIST EQU 1 +DEF INIT_BAG_ITEM_LIST EQU 2 +DEF INIT_OTHER_ITEM_LIST EQU 3 +DEF INIT_PLAYEROT_LIST EQU 4 +DEF INIT_MON_LIST EQU 5 ; wTimeOfDay:: const_def @@ -119,17 +119,17 @@ INIT_MON_LIST EQU 5 const DAY_F ; 1 const NITE_F ; 2 const DARKNESS_F ; 3 -NUM_DAYTIMES EQU const_value +DEF NUM_DAYTIMES EQU const_value -MORN EQU 1 << MORN_F -DAY EQU 1 << DAY_F -NITE EQU 1 << NITE_F -DARKNESS EQU 1 << DARKNESS_F +DEF MORN EQU 1 << MORN_F +DEF DAY EQU 1 << DAY_F +DEF NITE EQU 1 << NITE_F +DEF DARKNESS EQU 1 << DARKNESS_F -ANYTIME EQU MORN | DAY | NITE +DEF ANYTIME EQU MORN | DAY | NITE ; wTimeOfDayPalset:: -DARKNESS_PALSET EQU (DARKNESS_F << 6) | (DARKNESS_F << 4) | (DARKNESS_F << 2) | DARKNESS_F +DEF DARKNESS_PALSET EQU (DARKNESS_F << 6) | (DARKNESS_F << 4) | (DARKNESS_F << 2) | DARKNESS_F ; wBattleAnimFlags:: const_def @@ -139,14 +139,14 @@ DARKNESS_PALSET EQU (DARKNESS_F << 6) | (DARKNESS_F << 4) | (DARKNESS_F << 2) | const BATTLEANIM_KEEPSPRITES_F ; 3 ; wPlayerSpriteSetupFlags:: -PLAYERSPRITESETUP_FACING_MASK EQU %11 -PLAYERSPRITESETUP_FEMALE_TO_MALE_F EQU 2 -PLAYERSPRITESETUP_CUSTOM_FACING_F EQU 5 -PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F EQU 6 -PLAYERSPRITESETUP_RESET_ACTION_F EQU 7 +DEF PLAYERSPRITESETUP_FACING_MASK EQU %11 +DEF PLAYERSPRITESETUP_FEMALE_TO_MALE_F EQU 2 +DEF PLAYERSPRITESETUP_CUSTOM_FACING_F EQU 5 +DEF PLAYERSPRITESETUP_SKIP_RELOAD_GFX_F EQU 6 +DEF PLAYERSPRITESETUP_RESET_ACTION_F EQU 7 ; wPlayerGender:: -PLAYERGENDER_FEMALE_F EQU 0 +DEF PLAYERGENDER_FEMALE_F EQU 0 ; wMapStatus:: const_def @@ -161,7 +161,7 @@ PLAYERGENDER_FEMALE_F EQU 0 const MAPEVENTS_OFF ; 1 ; wScriptFlags:: -SCRIPT_RUNNING EQU 2 +DEF SCRIPT_RUNNING EQU 2 ; wScriptMode:: const_def @@ -171,8 +171,8 @@ SCRIPT_RUNNING EQU 2 const SCRIPT_WAIT ; wSpawnAfterChampion:: -SPAWN_LANCE EQU 1 -SPAWN_RED EQU 2 +DEF SPAWN_LANCE EQU 1 +DEF SPAWN_RED EQU 2 ; wCurDay:: const_def @@ -207,12 +207,12 @@ SPAWN_RED EQU 2 const STATUSFLAGS2_ROCKETS_IN_MAHOGANY_F ; 7 ; wMomSavingMoney:: -MOM_SAVING_SOME_MONEY_F EQU 0 -MOM_SAVING_HALF_MONEY_F EQU 1 -MOM_SAVING_ALL_MONEY_F EQU 2 -MOM_ACTIVE_F EQU 7 +DEF MOM_SAVING_SOME_MONEY_F EQU 0 +DEF MOM_SAVING_HALF_MONEY_F EQU 1 +DEF MOM_SAVING_ALL_MONEY_F EQU 2 +DEF MOM_ACTIVE_F EQU 7 -MOM_SAVING_MONEY_MASK EQU (1 << MOM_SAVING_SOME_MONEY_F) | (1 << MOM_SAVING_HALF_MONEY_F) | (1 << MOM_SAVING_ALL_MONEY_F) +DEF MOM_SAVING_MONEY_MASK EQU (1 << MOM_SAVING_SOME_MONEY_F) | (1 << MOM_SAVING_HALF_MONEY_F) | (1 << MOM_SAVING_ALL_MONEY_F) ; wJohtoBadges:: const_def @@ -224,7 +224,7 @@ MOM_SAVING_MONEY_MASK EQU (1 << MOM_SAVING_SOME_MONEY_F) | (1 << MOM_SAVING_HALF const STORMBADGE const GLACIERBADGE const RISINGBADGE -NUM_JOHTO_BADGES EQU const_value +DEF NUM_JOHTO_BADGES EQU const_value ; wKantoBadges:: const_def @@ -236,8 +236,8 @@ NUM_JOHTO_BADGES EQU const_value const MARSHBADGE const VOLCANOBADGE const EARTHBADGE -NUM_KANTO_BADGES EQU const_value -NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES +DEF NUM_KANTO_BADGES EQU const_value +DEF NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES ; wPokegearFlags:: const_def @@ -249,18 +249,18 @@ NUM_BADGES EQU NUM_JOHTO_BADGES + NUM_KANTO_BADGES const POKEGEAR_OBTAINED_F ; 7 ; wWhichRegisteredItem:: -REGISTERED_POCKET EQU %11000000 -REGISTERED_NUMBER EQU %00111111 +DEF REGISTERED_POCKET EQU %11000000 +DEF REGISTERED_NUMBER EQU %00111111 ; wPlayerState:: -PLAYER_NORMAL EQU 0 -PLAYER_BIKE EQU 1 -PLAYER_SKATE EQU 2 -PLAYER_SURF EQU 4 -PLAYER_SURF_PIKA EQU 8 +DEF PLAYER_NORMAL EQU 0 +DEF PLAYER_BIKE EQU 1 +DEF PLAYER_SKATE EQU 2 +DEF PLAYER_SURF EQU 4 +DEF PLAYER_SURF_PIKA EQU 8 ; wCelebiEvent:: -CELEBIEVENT_FOREST_IS_RESTLESS_F EQU 2 +DEF CELEBIEVENT_FOREST_IS_RESTLESS_F EQU 2 ; wBikeFlags:: const_def @@ -299,14 +299,14 @@ CELEBIEVENT_FOREST_IS_RESTLESS_F EQU 2 const SWARMFLAGS_MOBILE_4_F ; 4 ; wLuckyNumberShowFlag:: -LUCKYNUMBERSHOW_GAME_OVER_F EQU 0 +DEF LUCKYNUMBERSHOW_GAME_OVER_F EQU 0 ; wDayCareMan:: -DAYCAREMAN_HAS_MON_F EQU 0 -DAYCAREMAN_MONS_COMPATIBLE_F EQU 5 -DAYCAREMAN_HAS_EGG_F EQU 6 -DAYCAREMAN_ACTIVE_F EQU 7 +DEF DAYCAREMAN_HAS_MON_F EQU 0 +DEF DAYCAREMAN_MONS_COMPATIBLE_F EQU 5 +DEF DAYCAREMAN_HAS_EGG_F EQU 6 +DEF DAYCAREMAN_ACTIVE_F EQU 7 ; wDayCareLady:: -DAYCARELADY_HAS_MON_F EQU 0 -DAYCARELADY_ACTIVE_F EQU 7 +DEF DAYCARELADY_HAS_MON_F EQU 0 +DEF DAYCARELADY_ACTIVE_F EQU 7 diff --git a/data/battle_anims/oam.asm b/data/battle_anims/oam.asm index 1cdf28475..da80a966e 100644 --- a/data/battle_anims/oam.asm +++ b/data/battle_anims/oam.asm @@ -1,4 +1,4 @@ -battleanimoam: MACRO +MACRO battleanimoam ; vtile offset, data length, data pointer db \1, \2 dw \3 diff --git a/data/battle_anims/object_gfx.asm b/data/battle_anims/object_gfx.asm index 103b97ebe..0d20f5a8e 100644 --- a/data/battle_anims/object_gfx.asm +++ b/data/battle_anims/object_gfx.asm @@ -1,4 +1,4 @@ -anim_obj_gfx: MACRO +MACRO anim_obj_gfx ; # tiles, gfx pointer db \1 dba \2 diff --git a/data/battle_anims/objects.asm b/data/battle_anims/objects.asm index 1f7d7b4ab..84ea63841 100644 --- a/data/battle_anims/objects.asm +++ b/data/battle_anims/objects.asm @@ -1,7 +1,7 @@ -ABSOLUTE_X EQU $00 -RELATIVE_X EQU $01 +DEF ABSOLUTE_X EQU $00 +DEF RELATIVE_X EQU $01 -battleanimobj: MACRO +MACRO battleanimobj db \1 ; flags ; bit 7: priority ; bit 6: y flip (for enemy) diff --git a/data/collision/collision_stdscripts.asm b/data/collision/collision_stdscripts.asm index 5c94c62f9..77b4277a0 100644 --- a/data/collision/collision_stdscripts.asm +++ b/data/collision/collision_stdscripts.asm @@ -1,6 +1,6 @@ ; std scripts associated with tile collisions -stdcoll: MACRO +MACRO stdcoll db \1 dw (\2StdScript - StdScripts) / 3 ENDM diff --git a/data/decorations/attributes.asm b/data/decorations/attributes.asm index 5e62c3a11..88f6dc212 100644 --- a/data/decorations/attributes.asm +++ b/data/decorations/attributes.asm @@ -1,4 +1,4 @@ -decoration: MACRO +MACRO decoration ; type, name, action, event flag, tile/sprite db \1, \2, \3 dw \4 diff --git a/data/events/engine_flags.asm b/data/events/engine_flags.asm index 8b5d6b89e..a5e435b55 100644 --- a/data/events/engine_flags.asm +++ b/data/events/engine_flags.asm @@ -1,4 +1,4 @@ -engine_flag: MACRO +MACRO engine_flag ; location, bit ; (all locations are in WRAM bank 1) dwb \1 + (\2 / 8), 1 << (\2 % 8) diff --git a/data/events/npc_trades.asm b/data/events/npc_trades.asm index c97e4ea4a..ccd9fec01 100644 --- a/data/events/npc_trades.asm +++ b/data/events/npc_trades.asm @@ -1,4 +1,4 @@ -npctrade: MACRO +MACRO npctrade ; dialog set, requested mon, offered mon, nickname, dvs, item, OT ID, OT name, gender requested db \1, \2, \3, \4, \5, \6, \7 dw \8 diff --git a/data/events/odd_eggs.asm b/data/events/odd_eggs.asm index 60e962e41..c79d29666 100644 --- a/data/events/odd_eggs.asm +++ b/data/events/odd_eggs.asm @@ -1,14 +1,14 @@ -NUM_ODD_EGGS EQU 14 +DEF NUM_ODD_EGGS EQU 14 -prob: MACRO -prob_total += \1 +MACRO prob + DEF prob_total += \1 dw prob_total * $ffff / 100 ENDM OddEggProbabilities: ; entries correspond to OddEggs (below) table_width 2, OddEggProbabilities -prob_total = 0 +DEF prob_total = 0 ; Pichu prob 8 prob 1 diff --git a/data/events/pokedex_ratings.asm b/data/events/pokedex_ratings.asm index 3ac7a0da9..3b1eaf5bd 100644 --- a/data/events/pokedex_ratings.asm +++ b/data/events/pokedex_ratings.asm @@ -1,4 +1,4 @@ -rating: MACRO +MACRO rating ; count, sfx, text db \1 dw \2, \3 diff --git a/data/events/special_pointers.asm b/data/events/special_pointers.asm index b0f78b3b0..d727e4bd2 100644 --- a/data/events/special_pointers.asm +++ b/data/events/special_pointers.asm @@ -1,7 +1,7 @@ ; Special routines can be used with the "special" map script command. ; They often use wScriptVar for arguments and return values. -add_special: MACRO +MACRO add_special \1Special:: dba \1 ENDM diff --git a/data/events/unown_walls.asm b/data/events/unown_walls.asm index e19765831..6e28b5f1c 100644 --- a/data/events/unown_walls.asm +++ b/data/events/unown_walls.asm @@ -1,18 +1,18 @@ -unownwall: MACRO -for n, CHARLEN(\1) -x = CHARSUB(\1, n + 1) -if x == "-" - db $64 -elif x >= "Y" - db 2 * (x - "Y") + $60 -elif x >= "Q" - db 2 * (x - "Q") + $40 -elif x >= "I" - db 2 * (x - "I") + $20 -else - db 2 * (x - "A") -endc -endr +MACRO unownwall + for n, CHARLEN(\1) + DEF x = CHARSUB(\1, n + 1) + if x == "-" + db $64 + elif x >= "Y" + db 2 * (x - "Y") + $60 + elif x >= "Q" + db 2 * (x - "Q") + $40 + elif x >= "I" + db 2 * (x - "I") + $20 + else + db 2 * (x - "A") + endc + endr db -1 ; end ENDM diff --git a/data/growth_rates.asm b/data/growth_rates.asm index cd07fc130..dfbb5ffa5 100644 --- a/data/growth_rates.asm +++ b/data/growth_rates.asm @@ -1,4 +1,4 @@ -growth_rate: MACRO +MACRO growth_rate ; [1]/[2]*n**3 + [3]*n**2 + [4]*n - [5] dn \1, \2 if \3 < 0 diff --git a/data/items/attributes.asm b/data/items/attributes.asm index 459212835..3d264d1f3 100644 --- a/data/items/attributes.asm +++ b/data/items/attributes.asm @@ -1,4 +1,4 @@ -item_attribute: MACRO +MACRO item_attribute ; price, held effect, parameter, property, pocket, field menu, battle menu dw \1 db \2, \3, \4, \5 diff --git a/data/items/mom_phone.asm b/data/items/mom_phone.asm index 27b795f2c..6e891ef02 100644 --- a/data/items/mom_phone.asm +++ b/data/items/mom_phone.asm @@ -1,4 +1,4 @@ -momitem: MACRO +MACRO momitem ; money to trigger, cost, kind, item dt \1 dt \2 diff --git a/data/maps/attributes.asm b/data/maps/attributes.asm index e67eb3742..c1631c307 100644 --- a/data/maps/attributes.asm +++ b/data/maps/attributes.asm @@ -1,10 +1,10 @@ -map_attributes: MACRO +MACRO map_attributes ;\1: map name ;\2: map id ;\3: border block ;\4: connections: combo of NORTH, SOUTH, WEST, and/or EAST, or 0 for none -CURRENT_MAP_WIDTH = \2_WIDTH -CURRENT_MAP_HEIGHT = \2_HEIGHT + DEF CURRENT_MAP_WIDTH = \2_WIDTH + DEF CURRENT_MAP_HEIGHT = \2_HEIGHT \1_MapAttributes:: db \3 db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH @@ -17,73 +17,73 @@ CURRENT_MAP_HEIGHT = \2_HEIGHT ENDM ; Connections go in order: north, south, west, east -connection: MACRO +MACRO connection ;\1: direction ;\2: map name ;\3: map id ;\4: offset of the target map relative to the current map ; (x offset for east/west, y offset for north/south) -; LEGACY: Support for old connection macro -if _NARG == 6 - connection \1, \2, \3, (\4) - (\5) -else + ; LEGACY: Support for old connection macro + if _NARG == 6 + connection \1, \2, \3, (\4) - (\5) + else -; Calculate tile offsets for source (current) and target maps -_src = 0 -_tgt = (\4) + 3 -if _tgt < 0 -_src = -_tgt -_tgt = 0 -endc + ; Calculate tile offsets for source (current) and target maps + DEF _src = 0 + DEF _tgt = (\4) + 3 + if _tgt < 0 + DEF _src = -_tgt + DEF _tgt = 0 + endc -if !STRCMP("\1", "north") -_blk = \3_WIDTH * (\3_HEIGHT - 3) + _src -_map = _tgt -_win = (\3_WIDTH + 6) * \3_HEIGHT + 1 -_y = \3_HEIGHT * 2 - 1 -_x = (\4) * -2 -_len = CURRENT_MAP_WIDTH + 3 - (\4) -if _len > \3_WIDTH -_len = \3_WIDTH -endc + if !STRCMP("\1", "north") + DEF _blk = \3_WIDTH * (\3_HEIGHT - 3) + _src + DEF _map = _tgt + DEF _win = (\3_WIDTH + 6) * \3_HEIGHT + 1 + DEF _y = \3_HEIGHT * 2 - 1 + DEF _x = (\4) * -2 + DEF _len = CURRENT_MAP_WIDTH + 3 - (\4) + if _len > \3_WIDTH + DEF _len = \3_WIDTH + endc -elif !STRCMP("\1", "south") -_blk = _src -_map = (CURRENT_MAP_WIDTH + 6) * (CURRENT_MAP_HEIGHT + 3) + _tgt -_win = \3_WIDTH + 7 -_y = 0 -_x = (\4) * -2 -_len = CURRENT_MAP_WIDTH + 3 - (\4) -if _len > \3_WIDTH -_len = \3_WIDTH -endc + elif !STRCMP("\1", "south") + DEF _blk = _src + DEF _map = (CURRENT_MAP_WIDTH + 6) * (CURRENT_MAP_HEIGHT + 3) + _tgt + DEF _win = \3_WIDTH + 7 + DEF _y = 0 + DEF _x = (\4) * -2 + DEF _len = CURRENT_MAP_WIDTH + 3 - (\4) + if _len > \3_WIDTH + DEF _len = \3_WIDTH + endc -elif !STRCMP("\1", "west") -_blk = (\3_WIDTH * _src) + \3_WIDTH - 3 -_map = (CURRENT_MAP_WIDTH + 6) * _tgt -_win = (\3_WIDTH + 6) * 2 - 6 -_y = (\4) * -2 -_x = \3_WIDTH * 2 - 1 -_len = CURRENT_MAP_HEIGHT + 3 - (\4) -if _len > \3_HEIGHT -_len = \3_HEIGHT -endc + elif !STRCMP("\1", "west") + DEF _blk = (\3_WIDTH * _src) + \3_WIDTH - 3 + DEF _map = (CURRENT_MAP_WIDTH + 6) * _tgt + DEF _win = (\3_WIDTH + 6) * 2 - 6 + DEF _y = (\4) * -2 + DEF _x = \3_WIDTH * 2 - 1 + DEF _len = CURRENT_MAP_HEIGHT + 3 - (\4) + if _len > \3_HEIGHT + DEF _len = \3_HEIGHT + endc -elif !STRCMP("\1", "east") -_blk = (\3_WIDTH * _src) -_map = (CURRENT_MAP_WIDTH + 6) * _tgt + CURRENT_MAP_WIDTH + 3 -_win = \3_WIDTH + 7 -_y = (\4) * -2 -_x = 0 -_len = CURRENT_MAP_HEIGHT + 3 - (\4) -if _len > \3_HEIGHT -_len = \3_HEIGHT -endc + elif !STRCMP("\1", "east") + DEF _blk = (\3_WIDTH * _src) + DEF _map = (CURRENT_MAP_WIDTH + 6) * _tgt + CURRENT_MAP_WIDTH + 3 + DEF _win = \3_WIDTH + 7 + DEF _y = (\4) * -2 + DEF _x = 0 + DEF _len = CURRENT_MAP_HEIGHT + 3 - (\4) + if _len > \3_HEIGHT + DEF _len = \3_HEIGHT + endc -else -fail "Invalid direction for 'connection'." -endc + else + fail "Invalid direction for 'connection'." + endc map_id \3 dw \2_Blocks + _blk @@ -92,7 +92,8 @@ endc db \3_WIDTH db _y, _x dw wOverworldMapBlocks + _win -endc + + endc ENDM diff --git a/data/maps/landmarks.asm b/data/maps/landmarks.asm index 740365fc7..173d11b76 100644 --- a/data/maps/landmarks.asm +++ b/data/maps/landmarks.asm @@ -1,4 +1,4 @@ -landmark: MACRO +MACRO landmark ; x, y, name db \1 + 8, \2 + 16 dw \3 diff --git a/data/maps/maps.asm b/data/maps/maps.asm index 505f8e11d..122ff054c 100644 --- a/data/maps/maps.asm +++ b/data/maps/maps.asm @@ -1,4 +1,4 @@ -map: MACRO +MACRO map ;\1: map name: for the MapAttributes pointer (see data/maps/attributes.asm) ;\2: tileset: a TILESET_* constant ;\3: environment: TOWN, ROUTE, INDOOR, CAVE, ENVIRONMENT_5, GATE, or DUNGEON diff --git a/data/maps/roofs.asm b/data/maps/roofs.asm index fd79fe008..bcc49f182 100644 --- a/data/maps/roofs.asm +++ b/data/maps/roofs.asm @@ -5,7 +5,7 @@ const ROOF_AZALEA ; 2 const ROOF_OLIVINE ; 3 const ROOF_GOLDENROD ; 4 -NUM_ROOFS EQU const_value +DEF NUM_ROOFS EQU const_value MapGroupRoofs: ; entries correspond to MAPGROUP_* constants diff --git a/data/maps/scenes.asm b/data/maps/scenes.asm index 0c8f6b750..906652038 100644 --- a/data/maps/scenes.asm +++ b/data/maps/scenes.asm @@ -1,4 +1,4 @@ -scene_var: MACRO +MACRO scene_var ; map, variable map_id \1 dw \2 diff --git a/data/maps/setup_script_pointers.asm b/data/maps/setup_script_pointers.asm index 6bbcd62bd..b32be8d8f 100644 --- a/data/maps/setup_script_pointers.asm +++ b/data/maps/setup_script_pointers.asm @@ -1,4 +1,4 @@ -add_mapsetup: MACRO +MACRO add_mapsetup \1_MapSetupCmd: dba \1 ENDM diff --git a/data/maps/setup_scripts.asm b/data/maps/setup_scripts.asm index 86326deb4..5ad24be6e 100644 --- a/data/maps/setup_scripts.asm +++ b/data/maps/setup_scripts.asm @@ -16,7 +16,7 @@ MapSetupScripts: assert_table_length NUM_MAPSETUP_SCRIPTS ; valid commands are listed in MapSetupCommands (see data/maps/setup_script_pointers.asm) -mapsetup: MACRO +MACRO mapsetup db (\1_MapSetupCmd - MapSetupCommands) / 3 ENDM diff --git a/data/maps/spawn_points.asm b/data/maps/spawn_points.asm index 326995485..61938cd4d 100644 --- a/data/maps/spawn_points.asm +++ b/data/maps/spawn_points.asm @@ -1,4 +1,4 @@ -spawn: MACRO +MACRO spawn ; map, x, y map_id \1 db \2, \3 diff --git a/data/mon_menu.asm b/data/mon_menu.asm index 59535cad1..318262f7f 100644 --- a/data/mon_menu.asm +++ b/data/mon_menu.asm @@ -7,7 +7,7 @@ const MONMENUVALUE_MOVE ; 5 const MONMENUVALUE_MAIL ; 6 const MONMENUVALUE_ERROR ; 7 -NUM_MONMENUVALUES EQU const_value - 1 +DEF NUM_MONMENUVALUES EQU const_value - 1 MonMenuOptionStrings: ; entries correspond to MONMENUVALUE_* constants diff --git a/data/moves/moves.asm b/data/moves/moves.asm index 31f9d27d0..c95e9d125 100644 --- a/data/moves/moves.asm +++ b/data/moves/moves.asm @@ -1,6 +1,6 @@ ; Characteristics of each move. -move: MACRO +MACRO move db \1 ; animation db \2 ; effect db \3 ; power diff --git a/data/moves/tmhm_moves.asm b/data/moves/tmhm_moves.asm index bc3d5b685..a26276d4f 100644 --- a/data/moves/tmhm_moves.asm +++ b/data/moves/tmhm_moves.asm @@ -18,7 +18,7 @@ endr assert_table_length NUM_TMS + NUM_HMS ; Move tutors -n = 1 +DEF n = 1 for n, 1, NUM_TUTORS + 1 db MT{02d:n}_MOVE endr diff --git a/data/party_menu_qualities.asm b/data/party_menu_qualities.asm index a89e6beef..01141236a 100644 --- a/data/party_menu_qualities.asm +++ b/data/party_menu_qualities.asm @@ -10,11 +10,11 @@ const PARTYMENUQUALITY_GENDER const PARTYMENUQUALITY_MOBILE_SELECTION -partymenuqualities: MACRO -rept _NARG - db PARTYMENUQUALITY_\1 - shift -endr +MACRO partymenuqualities + rept _NARG + db PARTYMENUQUALITY_\1 + shift + endr db -1 ; end ENDM diff --git a/data/phone/phone_contacts.asm b/data/phone/phone_contacts.asm index aad39ae23..ae6640eef 100644 --- a/data/phone/phone_contacts.asm +++ b/data/phone/phone_contacts.asm @@ -1,4 +1,4 @@ -phone: MACRO +MACRO phone ; trainer class, trainer id, map, callee time, callee script, caller time, caller script db \1, \2 map_id \3 diff --git a/data/phone/special_calls.asm b/data/phone/special_calls.asm index a516e5957..55c157d8e 100644 --- a/data/phone/special_calls.asm +++ b/data/phone/special_calls.asm @@ -1,4 +1,4 @@ -specialcall: MACRO +MACRO specialcall ; condition, contact, script dw \1 db \2 diff --git a/data/pokemon/base_stats.asm b/data/pokemon/base_stats.asm index fdae2c020..093a002ab 100644 --- a/data/pokemon/base_stats.asm +++ b/data/pokemon/base_stats.asm @@ -1,24 +1,24 @@ ; used in data/pokemon/base_stats/*.asm -tmhm: MACRO -; initialize bytes to 0 -for n, (NUM_TM_HM_TUTOR + 7) / 8 -_tm{d:n} = 0 -endr -; set bits of bytes -rept _NARG - if DEF(\1_TMNUM) -n = (\1_TMNUM - 1) / 8 -i = (\1_TMNUM - 1) % 8 -_tm{d:n} |= 1 << i - else - fail "\1 is not a TM, HM, or tutor move" - endc - shift -endr -; output bytes -for n, (NUM_TM_HM_TUTOR + 7) / 8 - db _tm{d:n} -endr +MACRO tmhm + ; initialize bytes to 0 + for n, (NUM_TM_HM_TUTOR + 7) / 8 + DEF _tm{d:n} = 0 + endr + ; set bits of bytes + rept _NARG + if DEF(\1_TMNUM) + DEF n = (\1_TMNUM - 1) / 8 + DEF i = (\1_TMNUM - 1) % 8 + DEF _tm{d:n} |= 1 << i + else + fail "\1 is not a TM, HM, or tutor move" + endc + shift + endr + ; output bytes + for n, (NUM_TM_HM_TUTOR + 7) / 8 + db _tm{d:n} + endr ENDM BaseData:: diff --git a/data/pokemon/cries.asm b/data/pokemon/cries.asm index dc0d08df9..b52418b5a 100644 --- a/data/pokemon/cries.asm +++ b/data/pokemon/cries.asm @@ -1,4 +1,4 @@ -mon_cry: MACRO +MACRO mon_cry ; index, pitch, length dw \1, \2, \3 ENDM diff --git a/data/pokemon/unown_words.asm b/data/pokemon/unown_words.asm index 11ddd46b0..f6acb4a97 100644 --- a/data/pokemon/unown_words.asm +++ b/data/pokemon/unown_words.asm @@ -1,4 +1,4 @@ -unownword: MACRO +MACRO unownword for n, CHARLEN(\1) db CHARSUB(\1, n + 1) - "A" + FIRST_UNOWN_CHAR endr diff --git a/data/predef_pointers.asm b/data/predef_pointers.asm index d96e01927..fad3a4a36 100644 --- a/data/predef_pointers.asm +++ b/data/predef_pointers.asm @@ -1,7 +1,7 @@ ; Predef routines can be used with the "predef" and "predef_jump" macros. ; This preserves registers bc, de, hl and f. -add_predef: MACRO +MACRO add_predef \1Predef:: dab \1 ENDM diff --git a/data/sgb_ctrl_packets.asm b/data/sgb_ctrl_packets.asm index 3fd809903..fa3ce5e25 100644 --- a/data/sgb_ctrl_packets.asm +++ b/data/sgb_ctrl_packets.asm @@ -2,35 +2,35 @@ ; names taken from pandocs ; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_Palette_Commands -sgb_pal_trn: MACRO +MACRO sgb_pal_trn db (SGB_PAL_TRN << 3) + 1 ds 15 ENDM -sgb_mlt_req: MACRO +MACRO sgb_mlt_req db (SGB_MLT_REQ << 3) + 1 db \1 - 1 ds 14 ENDM -sgb_chr_trn: MACRO +MACRO sgb_chr_trn db (SGB_CHR_TRN << 3) + 1 db \1 + (\2 << 1) ds 14 ENDM -sgb_pct_trn: MACRO +MACRO sgb_pct_trn db (SGB_PCT_TRN << 3) + 1 ds 15 ENDM -sgb_mask_en: MACRO +MACRO sgb_mask_en db (SGB_MASK_EN << 3) + 1 db \1 ds 14 ENDM -sgb_data_snd: MACRO +MACRO sgb_data_snd db (SGB_DATA_SND << 3) + 1 dw \1 ; address db \2 ; bank diff --git a/data/sprite_anims/unused_gfx.asm b/data/sprite_anims/unused_gfx.asm index 410d04fe1..9dae35b26 100644 --- a/data/sprite_anims/unused_gfx.asm +++ b/data/sprite_anims/unused_gfx.asm @@ -1,4 +1,4 @@ -sprite_anim_obj_gfx: MACRO +MACRO sprite_anim_obj_gfx ; # tiles, gfx pointer db \1 dbw \2, \3 diff --git a/data/sprites/emotes.asm b/data/sprites/emotes.asm index 32f4c2598..ef4485bda 100644 --- a/data/sprites/emotes.asm +++ b/data/sprites/emotes.asm @@ -1,4 +1,4 @@ -emote: MACRO +MACRO emote ; graphics pointer, length, starting tile dw \1 db \2 tiles, BANK(\1) diff --git a/data/sprites/sprites.asm b/data/sprites/sprites.asm index 0839ec971..d74a831cb 100644 --- a/data/sprites/sprites.asm +++ b/data/sprites/sprites.asm @@ -1,4 +1,4 @@ -overworld_sprite: MACRO +MACRO overworld_sprite ; pointer, length, type, palette dw \1 db \2 tiles, BANK(\1), \3, \4 diff --git a/data/tilesets.asm b/data/tilesets.asm index 9d8f62382..fd1992886 100644 --- a/data/tilesets.asm +++ b/data/tilesets.asm @@ -1,4 +1,4 @@ -tileset: MACRO +MACRO tileset dba \1GFX, \1Meta, \1Coll dw \1Anim dw NULL diff --git a/data/wild/fish.asm b/data/wild/fish.asm index 5795dd80e..3833c4fe5 100644 --- a/data/wild/fish.asm +++ b/data/wild/fish.asm @@ -1,6 +1,6 @@ -time_group EQUS "0," ; use the nth TimeFishGroups entry +DEF time_group EQUS "0," ; use the nth TimeFishGroups entry -fishgroup: MACRO +MACRO fishgroup ; chance, old rod, good rod, super rod db \1 dw \2, \3, \4 diff --git a/data/wild/probabilities.asm b/data/wild/probabilities.asm index f3f44e0af..4ce027910 100644 --- a/data/wild/probabilities.asm +++ b/data/wild/probabilities.asm @@ -1,4 +1,4 @@ -mon_prob: MACRO +MACRO mon_prob ; percent, index db \1, \2 * 2 ENDM diff --git a/data/wild/roammon_maps.asm b/data/wild/roammon_maps.asm index 6552e041f..d473e31ac 100644 --- a/data/wild/roammon_maps.asm +++ b/data/wild/roammon_maps.asm @@ -1,15 +1,15 @@ ; Maps that roaming monsters can be on, and possible maps they can jump to. ; Notably missing are Route 40 and Route 41, which are water routes. -roam_map: MACRO +MACRO roam_map map_id \1 db _NARG - 1 -rept _NARG - 1 - map_id \2 - shift -endr + rept _NARG - 1 + map_id \2 + shift + endr db 0 -list_index += 1 + DEF list_index += 1 ENDM RoamMaps: diff --git a/data/wild/treemon_maps.asm b/data/wild/treemon_maps.asm index b85962399..2fbb93cf5 100644 --- a/data/wild/treemon_maps.asm +++ b/data/wild/treemon_maps.asm @@ -1,4 +1,4 @@ -treemon_map: MACRO +MACRO treemon_map map_id \1 db \2 ; treemon set ENDM diff --git a/data/wild/unlocked_unowns.asm b/data/wild/unlocked_unowns.asm index d09064c4b..8e38581ef 100644 --- a/data/wild/unlocked_unowns.asm +++ b/data/wild/unlocked_unowns.asm @@ -1,4 +1,4 @@ -unown_set: MACRO +MACRO unown_set rept _NARG db UNOWN_\1 shift diff --git a/docs/design_flaws.md b/docs/design_flaws.md index 0bbf152a3..d11fad222 100644 --- a/docs/design_flaws.md +++ b/docs/design_flaws.md @@ -20,7 +20,7 @@ These are parts of the code that do not work *incorrectly*, like [bugs and glitc [data/pokemon/pic_pointers.asm](https://github.com/pret/pokecrystal/blob/master/data/pokemon/pic_pointers.asm), [data/pokemon/unown_pic_pointers.asm](https://github.com/pret/pokecrystal/blob/master/data/pokemon/unown_pic_pointers.asm), and [data/trainers/pic_pointers.asm](https://github.com/pret/pokecrystal/blob/master/data/trainers/pic_pointers.asm) all have to use `dba_pic` instead of `dba`. This is a macro in [macros/data.asm](https://github.com/pret/pokecrystal/blob/master/macros/data.asm) that offsets banks by `PICS_FIX`: ```asm -dba_pic: MACRO ; dbw bank, address +MACRO dba_pic ; dbw bank, address db BANK(\1) - PICS_FIX dw \1 ENDM @@ -32,7 +32,7 @@ The offset is translated into a correct bank by `FixPicBank` in [engine/gfx/load FixPicBank: ; This is a thing for some reason. -PICS_FIX EQU $36 +DEF PICS_FIX EQU $36 GLOBAL PICS_FIX push hl @@ -148,8 +148,8 @@ In [gfx/footprints.asm](https://github.com/pret/pokecrystal/blob/master/gfx/foot ; then a row of the bottom two tiles for those eight footprints. ; These macros help extract the first and the last two tiles, respectively. -footprint_top EQUS "0, 2 * LEN_1BPP_TILE" -footprint_bottom EQUS "2 * LEN_1BPP_TILE, 2 * LEN_1BPP_TILE" +DEF footprint_top EQUS "0, 2 * LEN_1BPP_TILE" +DEF footprint_bottom EQUS "2 * LEN_1BPP_TILE, 2 * LEN_1BPP_TILE" ; Entries correspond to Pokémon species, two apiece, 8 tops then 8 bottoms @@ -322,7 +322,7 @@ Edit `GetMapMusic`: add_tm PSYCHIC_M ; dd ... add_tm NIGHTMARE ; f2 -NUM_TMS EQU const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC +DEF NUM_TMS EQU const_value - TM01 - 2 ; discount ITEM_C3 and ITEM_DC ``` `GetTMHMNumber` and `GetNumberedTMHM` in [engine/items/items.asm](https://github.com/pret/pokecrystal/blob/master/engine/items/items.asm) have to compensate for this. @@ -671,7 +671,7 @@ CelebiEvent_Cosine: They all rely on `calc_sine_wave` in [macros/code.asm](https://github.com/pret/pokecrystal/blob/master/macros/code.asm): ```asm -calc_sine_wave: MACRO +MACRO calc_sine_wave ; input: a = a signed 6-bit value ; output: a = d * sin(a * pi/32) and %111111 @@ -722,13 +722,13 @@ ENDM And on `sine_table` in [macros/data.asm](https://github.com/pret/pokecrystal/blob/master/macros/data.asm): ```asm -sine_table: MACRO +MACRO sine_table ; \1 samples of sin(x) from x=0 to x<32768 (pi radians) -x = 0 -rept \1 - dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up -x += DIV(32768, \1) ; a circle has 65536 "degrees" -endr + DEF x = 0 + rept \1 + dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up + DEF x += DIV(32768, \1) ; a circle has 65536 "degrees" + endr ENDM ``` diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index 816426997..f5efab43b 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -1,13 +1,13 @@ ; BattleTransitionJumptable.Jumptable indexes -BATTLETRANSITION_CAVE EQU $01 -BATTLETRANSITION_CAVE_STRONGER EQU $09 -BATTLETRANSITION_NO_CAVE EQU $10 -BATTLETRANSITION_NO_CAVE_STRONGER EQU $18 -BATTLETRANSITION_FINISH EQU $20 -BATTLETRANSITION_END EQU $80 +DEF BATTLETRANSITION_CAVE EQU $01 +DEF BATTLETRANSITION_CAVE_STRONGER EQU $09 +DEF BATTLETRANSITION_NO_CAVE EQU $10 +DEF BATTLETRANSITION_NO_CAVE_STRONGER EQU $18 +DEF BATTLETRANSITION_FINISH EQU $20 +DEF BATTLETRANSITION_END EQU $80 -BATTLETRANSITION_SQUARE EQU "8" ; $fe -BATTLETRANSITION_BLACK EQU "9" ; $ff +DEF BATTLETRANSITION_SQUARE EQU "8" ; $fe +DEF BATTLETRANSITION_BLACK EQU "9" ; $ff DoBattleTransition: call .InitGFX @@ -208,8 +208,8 @@ BattleTransitionJumptable: const TRANS_NO_CAVE_STRONGER ; transition animation bits -TRANS_STRONGER_F EQU 0 ; bit set in TRANS_CAVE_STRONGER and TRANS_NO_CAVE_STRONGER -TRANS_NO_CAVE_F EQU 1 ; bit set in TRANS_NO_CAVE and TRANS_NO_CAVE_STRONGER +DEF TRANS_STRONGER_F EQU 0 ; bit set in TRANS_CAVE_STRONGER and TRANS_NO_CAVE_STRONGER +DEF TRANS_NO_CAVE_F EQU 1 ; bit set in TRANS_NO_CAVE and TRANS_NO_CAVE_STRONGER StartTrainerBattle_DetermineWhichAnimation: ; The screen flashes a different number of times depending on the level of @@ -422,11 +422,11 @@ endr const LOWER_RIGHT ; quadrant bits -RIGHT_QUADRANT_F EQU 0 ; bit set in UPPER_RIGHT and LOWER_RIGHT -LOWER_QUADRANT_F EQU 1 ; bit set in LOWER_LEFT and LOWER_RIGHT +DEF RIGHT_QUADRANT_F EQU 0 ; bit set in UPPER_RIGHT and LOWER_RIGHT +DEF LOWER_QUADRANT_F EQU 1 ; bit set in LOWER_LEFT and LOWER_RIGHT .spin_quadrants: -spin_quadrant: MACRO +MACRO spin_quadrant db \1 dw \2 dwcoord \3, \4 @@ -799,7 +799,7 @@ StartTrainerBattle_ZoomToBlack: ret .boxes -zoombox: MACRO +MACRO zoombox ; width, height, start y, start x db \1, \2 dwcoord \3, \4 diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm index de1247abf..76212d5e7 100644 --- a/engine/battle/effect_commands.asm +++ b/engine/battle/effect_commands.asm @@ -3067,9 +3067,9 @@ BattleCommand_DamageCalc: call .CriticalMultiplier ; Update wCurDamage. Max 999 (capped at 997, then add 2). -MAX_DAMAGE EQU 999 -MIN_DAMAGE EQU 2 -DAMAGE_CAP EQU MAX_DAMAGE - MIN_DAMAGE +DEF MAX_DAMAGE EQU 999 +DEF MIN_DAMAGE EQU 2 +DEF DAMAGE_CAP EQU MAX_DAMAGE - MIN_DAMAGE ld hl, wCurDamage ld b, [hl] diff --git a/engine/battle/move_effects/rollout.asm b/engine/battle/move_effects/rollout.asm index 64d66ad62..8249bce89 100644 --- a/engine/battle/move_effects/rollout.asm +++ b/engine/battle/move_effects/rollout.asm @@ -1,4 +1,4 @@ -MAX_ROLLOUT_COUNT EQU 5 +DEF MAX_ROLLOUT_COUNT EQU 5 BattleCommand_CheckCurl: ; checkcurl diff --git a/engine/battle_anims/bg_effects.asm b/engine/battle_anims/bg_effects.asm index e334a7982..1b8e279a2 100644 --- a/engine/battle_anims/bg_effects.asm +++ b/engine/battle_anims/bg_effects.asm @@ -852,7 +852,7 @@ BattleBGEffect_RunPicResizeScript: dwcoord 14, 4 .BGSquares: -bgsquare: MACRO +MACRO bgsquare dn \1, \2 dw \3 ENDM diff --git a/engine/debug/debug_room.asm b/engine/debug/debug_room.asm index 9f2b9287d..f464d7ada 100644 --- a/engine/debug/debug_room.asm +++ b/engine/debug/debug_room.asm @@ -3,7 +3,7 @@ const DEBUGROOMMENU_PAGE_1 ; 0 const DEBUGROOMMENU_PAGE_2 ; 1 const DEBUGROOMMENU_PAGE_3 ; 2 -DEBUGROOMMENU_NUM_PAGES EQU const_value +DEF DEBUGROOMMENU_NUM_PAGES EQU const_value ; _DebugRoom.Strings and _DebugRoom.Jumptable indexes const_def @@ -538,7 +538,7 @@ DebugRoomMenu_DecorateAll: call DebugRoom_SaveChecksum ret -paged_value: MACRO +MACRO paged_value dw \1 ; value address db \2 ; min value db \3 ; max value @@ -548,7 +548,7 @@ paged_value: MACRO db \7 ; is hex value? ENDM -PAGED_VALUE_SIZE EQU 10 +DEF PAGED_VALUE_SIZE EQU 10 DebugRoom_EditPagedValues: xor a diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index 6a2d16dfc..7e9108c2a 100644 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -1,4 +1,4 @@ -SPECIALCELEBIEVENT_CELEBI EQU $84 +DEF SPECIALCELEBIEVENT_CELEBI EQU $84 UnusedForestTreeFrames: ; unreferenced INCBIN "gfx/tilesets/forest-tree/1.2bpp" diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index 130ec411d..b10e7cb48 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -1,6 +1,6 @@ -FIELDMOVE_GRASS EQU $80 -FIELDMOVE_TREE EQU $84 -FIELDMOVE_FLY EQU $84 +DEF FIELDMOVE_GRASS EQU $80 +DEF FIELDMOVE_TREE EQU $84 +DEF FIELDMOVE_FLY EQU $84 PlayWhirlpoolSound: call WaitSFX diff --git a/engine/events/halloffame.asm b/engine/events/halloffame.asm index 45eb7ade5..571023eee 100644 --- a/engine/events/halloffame.asm +++ b/engine/events/halloffame.asm @@ -1,4 +1,4 @@ -HALLOFFAME_COLON EQU $63 +DEF HALLOFFAME_COLON EQU $63 HallOfFame:: call HallOfFame_FadeOutMusic diff --git a/engine/events/heal_machine_anim.asm b/engine/events/heal_machine_anim.asm index 6de8c5775..0e60b00a2 100644 --- a/engine/events/heal_machine_anim.asm +++ b/engine/events/heal_machine_anim.asm @@ -59,11 +59,11 @@ HealMachineAnim: dw .ElmsLab dw .HallOfFame -healmachineanimseq: MACRO -rept _NARG - db HEALMACHINESTATE_\1 - shift -endr +MACRO healmachineanimseq + rept _NARG + db HEALMACHINESTATE_\1 + shift + endr ENDM .Pokecenter: diff --git a/engine/events/map_name_sign.asm b/engine/events/map_name_sign.asm index ec39619f3..3bf9e3863 100644 --- a/engine/events/map_name_sign.asm +++ b/engine/events/map_name_sign.asm @@ -1,4 +1,4 @@ -MAP_NAME_SIGN_START EQU $60 +DEF MAP_NAME_SIGN_START EQU $60 InitMapNameSign:: xor a diff --git a/engine/events/mom_phone.asm b/engine/events/mom_phone.asm index 9fde8afbd..c8408ba23 100644 --- a/engine/events/mom_phone.asm +++ b/engine/events/mom_phone.asm @@ -1,5 +1,5 @@ -NUM_MOM_ITEMS_1 EQUS "((MomItems_1.End - MomItems_1) / 8)" -NUM_MOM_ITEMS_2 EQUS "((MomItems_2.End - MomItems_2) / 8)" +DEF NUM_MOM_ITEMS_1 EQUS "((MomItems_1.End - MomItems_1) / 8)" +DEF NUM_MOM_ITEMS_2 EQUS "((MomItems_2.End - MomItems_2) / 8)" const_def 1 const MOM_ITEM diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index d7922b153..c9ba2a8ee 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -1,5 +1,5 @@ -UNOWNSTAMP_BOLD_A EQU "♂" ; $ef -UNOWNSTAMP_BOLD_B EQU "♀" ; $f5 +DEF UNOWNSTAMP_BOLD_A EQU "♂" ; $ef +DEF UNOWNSTAMP_BOLD_B EQU "♀" ; $f5 _UnownPrinter: ld a, [wUnownDex] diff --git a/engine/events/shuckle.asm b/engine/events/shuckle.asm index 3e0e8b27f..9b98c1dae 100644 --- a/engine/events/shuckle.asm +++ b/engine/events/shuckle.asm @@ -1,4 +1,4 @@ -MANIA_OT_ID EQU 00518 +DEF MANIA_OT_ID EQU 00518 GiveShuckle: ; Adding to the party. diff --git a/engine/events/std_scripts.asm b/engine/events/std_scripts.asm index 597ac9df0..c551a00d3 100644 --- a/engine/events/std_scripts.asm +++ b/engine/events/std_scripts.asm @@ -1,4 +1,4 @@ -add_stdscript: MACRO +MACRO add_stdscript \1StdScript:: dba \1 ENDM diff --git a/engine/games/card_flip.asm b/engine/games/card_flip.asm index 2b4c0f0b2..d9e07279e 100644 --- a/engine/games/card_flip.asm +++ b/engine/games/card_flip.asm @@ -1,7 +1,7 @@ -CARDFLIP_LIGHT_OFF EQU "♂" ; $ef -CARDFLIP_LIGHT_ON EQU "♀" ; $f5 +DEF CARDFLIP_LIGHT_OFF EQU "♂" ; $ef +DEF CARDFLIP_LIGHT_ON EQU "♀" ; $f5 -CARDFLIP_DECK_SIZE EQUS "(wDeckEnd - wDeck)" +DEF CARDFLIP_DECK_SIZE EQUS "(wDeckEnd - wDeck)" assert wDiscardPileEnd - wDiscardPile == wDeckEnd - wDeck MemoryGameGFX: @@ -1337,14 +1337,14 @@ CardFlip_UpdateCursorOAM: ret .OAMData: -cardflip_cursor: MACRO -if _NARG >= 5 - dbpixel \1, \2, \3, \4 - dw \5 -else - dbpixel \1, \2 - dw \3 -endc +MACRO cardflip_cursor + if _NARG >= 5 + dbpixel \1, \2, \3, \4 + dw \5 + else + dbpixel \1, \2 + dw \3 + endc ENDM cardflip_cursor 11, 2, .Impossible diff --git a/engine/games/slot_machine.asm b/engine/games/slot_machine.asm index ae81cf699..5e9cfa3f1 100644 --- a/engine/games/slot_machine.asm +++ b/engine/games/slot_machine.asm @@ -6,26 +6,26 @@ const SLOTS_PIKACHU ; $0c const SLOTS_SQUIRTLE ; $10 const SLOTS_STARYU ; $14 -NUM_SLOT_REELS EQU const_value / 4 ; 6 -SLOTS_NO_MATCH EQU -1 +DEF NUM_SLOT_REELS EQU const_value / 4 ; 6 +DEF SLOTS_NO_MATCH EQU -1 ; wSlotBias values -SLOTS_NO_BIAS EQU -1 +DEF SLOTS_NO_BIAS EQU -1 -REEL_SIZE EQU 15 +DEF REEL_SIZE EQU 15 ; Constants for slot_reel offsets (see macros/wram.asm) -REEL_ACTION EQUS "(wReel1ReelAction - wReel1)" -REEL_TILEMAP_ADDR EQUS "(wReel1TilemapAddr - wReel1)" -REEL_POSITION EQUS "(wReel1Position - wReel1)" -REEL_SPIN_DISTANCE EQUS "(wReel1SpinDistance - wReel1)" -REEL_SPIN_RATE EQUS "(wReel1SpinRate - wReel1)" -REEL_OAM_ADDR EQUS "(wReel1OAMAddr - wReel1)" -REEL_X_COORD EQUS "(wReel1XCoord - wReel1)" -REEL_MANIP_COUNTER EQUS "(wReel1ManipCounter - wReel1)" -REEL_MANIP_DELAY EQUS "(wReel1ManipDelay - wReel1)" -REEL_FIELD_0B EQUS "(wReel1Field0b - wReel1)" -REEL_STOP_DELAY EQUS "(wReel1StopDelay - wReel1)" +DEF REEL_ACTION EQUS "(wReel1ReelAction - wReel1)" +DEF REEL_TILEMAP_ADDR EQUS "(wReel1TilemapAddr - wReel1)" +DEF REEL_POSITION EQUS "(wReel1Position - wReel1)" +DEF REEL_SPIN_DISTANCE EQUS "(wReel1SpinDistance - wReel1)" +DEF REEL_SPIN_RATE EQUS "(wReel1SpinRate - wReel1)" +DEF REEL_OAM_ADDR EQUS "(wReel1OAMAddr - wReel1)" +DEF REEL_X_COORD EQUS "(wReel1XCoord - wReel1)" +DEF REEL_MANIP_COUNTER EQUS "(wReel1ManipCounter - wReel1)" +DEF REEL_MANIP_DELAY EQUS "(wReel1ManipDelay - wReel1)" +DEF REEL_FIELD_0B EQUS "(wReel1Field0b - wReel1)" +DEF REEL_STOP_DELAY EQUS "(wReel1StopDelay - wReel1)" ; SlotsJumptable constants const_def @@ -48,7 +48,7 @@ REEL_STOP_DELAY EQUS "(wReel1StopDelay - wReel1)" const SLOTS_PAYOUT_ANIM const SLOTS_RESTART_OF_QUIT const SLOTS_QUIT -SLOTS_END_LOOP_F EQU 7 +DEF SLOTS_END_LOOP_F EQU 7 ; ReelActionJumptable constants const_def diff --git a/engine/games/unown_puzzle.asm b/engine/games/unown_puzzle.asm index 41b330552..8e5a4d820 100644 --- a/engine/games/unown_puzzle.asm +++ b/engine/games/unown_puzzle.asm @@ -1,7 +1,7 @@ -PUZZLE_BORDER EQU $ee -PUZZLE_VOID EQU $ef +DEF PUZZLE_BORDER EQU $ee +DEF PUZZLE_VOID EQU $ef -puzcoord EQUS "* 6 +" +DEF puzcoord EQUS "* 6 +" _UnownPuzzle: ldh a, [hInMenu] @@ -112,11 +112,11 @@ InitUnownPuzzlePiecePositions: ret .PuzzlePieceInitialPositions: -initpuzcoord: MACRO -rept _NARG / 2 - db \1 puzcoord \2 - shift 2 -endr +MACRO initpuzcoord + rept _NARG / 2 + db \1 puzcoord \2 + shift 2 + endr ENDM initpuzcoord 0,0, 0,1, 0,2, 0,3, 0,4, 0,5 initpuzcoord 1,0, 1,5 @@ -568,7 +568,7 @@ RedrawUnownPuzzlePieces: UnownPuzzleCoordData: -puzzle_coords: MACRO +MACRO puzzle_coords dbpixel \1, \2, \3, \4 dwcoord \5, \6 db \7, \8 diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index b8d204346..cf442dfcb 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -1,9 +1,9 @@ INCLUDE "engine/gfx/sgb_layouts.asm" -SHINY_ATK_BIT EQU 5 -SHINY_DEF_VAL EQU 10 -SHINY_SPD_VAL EQU 10 -SHINY_SPC_VAL EQU 10 +DEF SHINY_ATK_BIT EQU 5 +DEF SHINY_DEF_VAL EQU 10 +DEF SHINY_SPD_VAL EQU 10 +DEF SHINY_SPC_VAL EQU 10 CheckShininess: ; Check if a mon is shiny by DVs at bc. diff --git a/engine/gfx/load_pics.asm b/engine/gfx/load_pics.asm index 4e42db48d..c4b869783 100644 --- a/engine/gfx/load_pics.asm +++ b/engine/gfx/load_pics.asm @@ -247,7 +247,7 @@ GetMonBackpic: FixPicBank: ; This is a thing for some reason. -PICS_FIX EQU $36 +DEF PICS_FIX EQU $36 EXPORT PICS_FIX push hl diff --git a/engine/gfx/pic_animation.asm b/engine/gfx/pic_animation.asm index c3ac84b1c..ba8e90fcb 100644 --- a/engine/gfx/pic_animation.asm +++ b/engine/gfx/pic_animation.asm @@ -46,11 +46,11 @@ AnimateMon_HOF: call AnimateFrontpic ret -pokeanim: MACRO -rept _NARG - db (PokeAnim_\1_SetupCommand - PokeAnim_SetupCommands) / 2 - shift -endr +MACRO pokeanim + rept _NARG + db (PokeAnim_\1_SetupCommand - PokeAnim_SetupCommands) / 2 + shift + endr db (PokeAnim_Finish_SetupCommand - PokeAnim_SetupCommands) / 2 ENDM @@ -128,7 +128,7 @@ SetUpPokeAnim: scf ret -add_setup_command: MACRO +MACRO add_setup_command \1_SetupCommand: dw \1 ENDM @@ -533,12 +533,12 @@ PokeAnim_CopyBitmaskToBuffer: .Sizes: db 4, 5, 7 -poke_anim_box: MACRO -for y, 1, \1 + 1 -for x, 7 - \1, 7 - db y * 7 + x -endr -endr +MACRO poke_anim_box + for y, 1, \1 + 1 + for x, 7 - \1, 7 + db y * 7 + x + endr + endr ENDM PokeAnim_ConvertAndApplyBitmask: diff --git a/engine/items/mart.asm b/engine/items/mart.asm index d7523cab6..8149fd709 100644 --- a/engine/items/mart.asm +++ b/engine/items/mart.asm @@ -139,7 +139,7 @@ GetMart: const STANDARDMART_QUIT ; 4 const STANDARDMART_ANYTHINGELSE ; 5 -STANDARDMART_EXIT EQU -1 +DEF STANDARDMART_EXIT EQU -1 StandardMart: .loop diff --git a/engine/link/mystery_gift.asm b/engine/link/mystery_gift.asm index 313ac3388..0b7b72d9c 100644 --- a/engine/link/mystery_gift.asm +++ b/engine/link/mystery_gift.asm @@ -1,28 +1,28 @@ ; hMGRole values -IR_RECEIVER EQU 1 -IR_SENDER EQU 2 +DEF IR_RECEIVER EQU 1 +DEF IR_SENDER EQU 2 ; hMGStatusFlags error bits -MG_WRONG_CHECKSUM_F EQU 0 -MG_TIMED_OUT_F EQU 1 -MG_CANCELED_F EQU 4 -MG_WRONG_PREFIX_F EQU 7 +DEF MG_WRONG_CHECKSUM_F EQU 0 +DEF MG_TIMED_OUT_F EQU 1 +DEF MG_CANCELED_F EQU 4 +DEF MG_WRONG_PREFIX_F EQU 7 ; hMGStatusFlags values -MG_WRONG_CHECKSUM EQU 1 << MG_WRONG_CHECKSUM_F -MG_TIMED_OUT EQU 1 << MG_TIMED_OUT_F -MG_CANCELED EQU 1 << MG_CANCELED_F -MG_WRONG_PREFIX EQU 1 << MG_WRONG_PREFIX_F -MG_NOT_OKAY EQU MG_WRONG_CHECKSUM | MG_TIMED_OUT | MG_CANCELED | MG_WRONG_PREFIX -MG_OKAY EQU ~MG_NOT_OKAY -MG_START_END EQU %11111111 +DEF MG_WRONG_CHECKSUM EQU 1 << MG_WRONG_CHECKSUM_F +DEF MG_TIMED_OUT EQU 1 << MG_TIMED_OUT_F +DEF MG_CANCELED EQU 1 << MG_CANCELED_F +DEF MG_WRONG_PREFIX EQU 1 << MG_WRONG_PREFIX_F +DEF MG_NOT_OKAY EQU MG_WRONG_CHECKSUM | MG_TIMED_OUT | MG_CANCELED | MG_WRONG_PREFIX +DEF MG_OKAY EQU ~MG_NOT_OKAY +DEF MG_START_END EQU %11111111 -REGION_PREFIX EQU $96 -REGION_CODE EQU $90 ; USA +DEF REGION_PREFIX EQU $96 +DEF REGION_CODE EQU $90 ; USA -MESSAGE_PREFIX EQU $5a +DEF MESSAGE_PREFIX EQU $5a -NAME_CARD_PREFIX EQU $3c +DEF NAME_CARD_PREFIX EQU $3c DoMysteryGift: call ClearTilemap diff --git a/engine/math/get_square_root.asm b/engine/math/get_square_root.asm index e63768547..5a4dd3f82 100644 --- a/engine/math/get_square_root.asm +++ b/engine/math/get_square_root.asm @@ -1,4 +1,4 @@ -NUM_SQUARE_ROOTS EQU 255 +DEF NUM_SQUARE_ROOTS EQU 255 GetSquareRoot: ; Return the square root of de in b. diff --git a/engine/menus/intro_menu.asm b/engine/menus/intro_menu.asm index 4c0354673..ac924c33b 100644 --- a/engine/menus/intro_menu.asm +++ b/engine/menus/intro_menu.asm @@ -967,7 +967,7 @@ Intro_PlacePlayerSprite: const TITLESCREENOPTION_RESTART const TITLESCREENOPTION_UNUSED const TITLESCREENOPTION_RESET_CLOCK -NUM_TITLESCREENOPTIONS EQU const_value +DEF NUM_TITLESCREENOPTIONS EQU const_value IntroSequence: callfar SplashScreen @@ -1302,15 +1302,15 @@ UpdateTitleTrailSprite: ; unreferenced ret .TitleTrailCoords: -trail_coords: MACRO -rept _NARG / 2 -_dx = 4 -if \1 == 0 && \2 == 0 -_dx = 0 -endc - dbpixel \1, \2, _dx, 0 - shift 2 -endr +MACRO trail_coords + rept _NARG / 2 + DEF _dx = 4 + if \1 == 0 && \2 == 0 + DEF _dx = 0 + endc + dbpixel \1, \2, _dx, 0 + shift 2 + endr ENDM ; frame 0 y, x; frame 1 y, x trail_coords 11, 10, 0, 0 diff --git a/engine/menus/naming_screen.asm b/engine/menus/naming_screen.asm index ee1fe7fec..ffdcbcf9f 100644 --- a/engine/menus/naming_screen.asm +++ b/engine/menus/naming_screen.asm @@ -1,8 +1,8 @@ -NAMINGSCREEN_CURSOR EQU $7e +DEF NAMINGSCREEN_CURSOR EQU $7e -NAMINGSCREEN_BORDER EQU "■" ; $60 -NAMINGSCREEN_MIDDLELINE EQU "→" ; $eb -NAMINGSCREEN_UNDERLINE EQU "" ; $f2 +DEF NAMINGSCREEN_BORDER EQU "■" ; $60 +DEF NAMINGSCREEN_MIDDLELINE EQU "→" ; $eb +DEF NAMINGSCREEN_UNDERLINE EQU "" ; $f2 _NamingScreen: call DisableSpriteUpdates diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm index 4ceb24a24..edaba2359 100644 --- a/engine/menus/options_menu.asm +++ b/engine/menus/options_menu.asm @@ -8,7 +8,7 @@ const OPT_MENU_ACCOUNT ; 5 const OPT_FRAME ; 6 const OPT_CANCEL ; 7 -NUM_OPTIONS EQU const_value ; 8 +DEF NUM_OPTIONS EQU const_value ; 8 _Option: ld hl, hInMenu diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 026790b51..5057f427e 100644 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -1068,7 +1068,7 @@ EraseBoxes: jr nz, .next ret -box_address: MACRO +MACRO box_address assert BANK(\1) == BANK(\2) db BANK(\1) dw \1, \2 diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm index 0d6e6f1bc..caad2971b 100644 --- a/engine/movie/intro.asm +++ b/engine/movie/intro.asm @@ -1438,19 +1438,19 @@ endr ret .FastFadePalettes: -hue = 31 +DEF hue = 31 rept 8 RGB hue, hue, hue -hue -= 1 + DEF hue -= 1 RGB hue, hue, hue -hue -= 2 + DEF hue -= 2 endr .SlowFadePalettes: -hue = 31 +DEF hue = 31 rept 16 RGB hue, hue, hue -hue -= 1 + DEF hue -= 1 endr Intro_LoadTilemap: diff --git a/engine/movie/trade_animation.asm b/engine/movie/trade_animation.asm index d68096668..5f9295442 100644 --- a/engine/movie/trade_animation.asm +++ b/engine/movie/trade_animation.asm @@ -1,5 +1,5 @@ -TRADEANIM_RIGHT_ARROW EQU "▶" ; $ed -TRADEANIM_LEFT_ARROW EQU "▼" ; $ee +DEF TRADEANIM_RIGHT_ARROW EQU "▶" ; $ed +DEF TRADEANIM_LEFT_ARROW EQU "▼" ; $ee ; TradeAnim_TubeAnimJumptable.Jumptable indexes const_def @@ -7,14 +7,14 @@ TRADEANIM_LEFT_ARROW EQU "▼" ; $ee const TRADEANIMSTATE_1 ; 1 const TRADEANIMSTATE_2 ; 2 const TRADEANIMSTATE_3 ; 3 -TRADEANIMJUMPTABLE_LENGTH EQU const_value +DEF TRADEANIMJUMPTABLE_LENGTH EQU const_value -add_tradeanim: MACRO +MACRO add_tradeanim \1_TradeCmd: dw \1 ENDM -tradeanim: MACRO +MACRO tradeanim db (\1_TradeCmd - DoTradeAnimation.Jumptable) / 2 ENDM @@ -1428,7 +1428,7 @@ DebugTrade: ; unreferenced jr nz, .loop2 ret -debugtrade: MACRO +MACRO debugtrade ; species, ot name, ot id db \1, \2 dw \3 diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 814e763f1..deec4b3d1 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -2805,9 +2805,9 @@ ApplyBGMapAnchorToObjects: pop hl ret -PRIORITY_LOW EQU $10 -PRIORITY_NORM EQU $20 -PRIORITY_HIGH EQU $30 +DEF PRIORITY_LOW EQU $10 +DEF PRIORITY_NORM EQU $20 +DEF PRIORITY_HIGH EQU $30 InitSprites: call .DeterminePriorities diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index 7fb321dcf..c8f3784b7 100644 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -601,7 +601,7 @@ DoPlayerMovement:: ld [wWalkingTile], a ret -player_action: MACRO +MACRO player_action ; walk direction, facing, x movement, y movement, tile collision pointer db \1, \2, \3, \4 dw \5 diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm index bd995c291..580de100c 100644 --- a/engine/pokedex/pokedex.asm +++ b/engine/pokedex/pokedex.asm @@ -15,7 +15,7 @@ const DEXSTATE_UPDATE_UNOWN_MODE const DEXSTATE_EXIT -POKEDEX_SCX EQU 5 +DEF POKEDEX_SCX EQU 5 EXPORT POKEDEX_SCX Pokedex: diff --git a/engine/pokegear/pokegear.asm b/engine/pokegear/pokegear.asm index 5fa3a1ff0..c1c02753e 100644 --- a/engine/pokegear/pokegear.asm +++ b/engine/pokegear/pokegear.asm @@ -4,9 +4,9 @@ const POKEGEARCARD_MAP ; 1 const POKEGEARCARD_PHONE ; 2 const POKEGEARCARD_RADIO ; 3 -NUM_POKEGEAR_CARDS EQU const_value +DEF NUM_POKEGEAR_CARDS EQU const_value -PHONE_DISPLAY_HEIGHT EQU 4 +DEF PHONE_DISPLAY_HEIGHT EQU 4 ; PokegearJumptable.Jumptable indexes const_def diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index 2d17cdb58..cf7b9a17c 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -1370,7 +1370,7 @@ BillsPC_RefreshTextboxes: .Placeholder: db "-----@" -copy_box_data: MACRO +MACRO copy_box_data .loop\@ ld a, [hl] cp -1 @@ -1394,9 +1394,9 @@ copy_box_data: MACRO jr .loop\@ .done\@ -if \1 - call CloseSRAM -endc + if \1 + call CloseSRAM + endc ld a, -1 ld [de], a ld a, [wBillsPCTempBoxCount] diff --git a/engine/pokemon/breeding.asm b/engine/pokemon/breeding.asm index cda397179..7ab706319 100644 --- a/engine/pokemon/breeding.asm +++ b/engine/pokemon/breeding.asm @@ -835,7 +835,7 @@ Hatch_InitShellFragments: call EggHatch_DoAnimFrame ret -shell_fragment: MACRO +MACRO shell_fragment ; y tile, y pxl, x tile, x pxl, frameset offset, ??? db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5 - SPRITE_ANIM_FRAMESET_EGG_HATCH_1, \6 ENDM diff --git a/engine/pokemon/mail_2.asm b/engine/pokemon/mail_2.asm index 1ec8afa46..59c42715b 100644 --- a/engine/pokemon/mail_2.asm +++ b/engine/pokemon/mail_2.asm @@ -11,7 +11,7 @@ const BLUESKY_MAIL_INDEX ; 7 const MUSIC_MAIL_INDEX ; 8 const MIRAGE_MAIL_INDEX ; 9 -NUM_MAIL EQU const_value +DEF NUM_MAIL EQU const_value ReadPartyMonMail: ld a, [wCurPartyMon] diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm index 2958b5e99..dad2bc7d8 100644 --- a/engine/pokemon/move_mon.asm +++ b/engine/pokemon/move_mon.asm @@ -1,4 +1,4 @@ -RANDY_OT_ID EQU 01001 +DEF RANDY_OT_ID EQU 01001 TryAddMonToParty: ; Check if to copy wild mon or generate a new one diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm index 33e2d1195..a56cde835 100644 --- a/engine/pokemon/stats_screen.asm +++ b/engine/pokemon/stats_screen.asm @@ -2,9 +2,9 @@ const PINK_PAGE ; 1 const GREEN_PAGE ; 2 const BLUE_PAGE ; 3 -NUM_STAT_PAGES EQU const_value - 1 +DEF NUM_STAT_PAGES EQU const_value - 1 -STAT_PAGE_MASK EQU %00000011 +DEF STAT_PAGE_MASK EQU %00000011 BattleStatsScreenInit: ld a, [wLinkMode] diff --git a/engine/printer/print_party.asm b/engine/printer/print_party.asm index 3561079a3..651d13096 100644 --- a/engine/printer/print_party.asm +++ b/engine/printer/print_party.asm @@ -1,4 +1,4 @@ -PRINTPARTY_HP EQU "◀" ; $71 +DEF PRINTPARTY_HP EQU "◀" ; $71 PrintPage1: hlcoord 0, 0 diff --git a/engine/rtc/restart_clock.asm b/engine/rtc/restart_clock.asm index ddec83567..450d89a81 100644 --- a/engine/rtc/restart_clock.asm +++ b/engine/rtc/restart_clock.asm @@ -3,7 +3,7 @@ const RESTART_CLOCK_DAY const RESTART_CLOCK_HOUR const RESTART_CLOCK_MIN -NUM_RESTART_CLOCK_DIVISIONS EQU const_value - 1 +DEF NUM_RESTART_CLOCK_DIVISIONS EQU const_value - 1 RestartClock_GetWraparoundTime: push hl @@ -26,7 +26,7 @@ endr .WrapAroundTimes: ; entries correspond to RESTART_CLOCK_* constants -wraparound_time: MACRO +MACRO wraparound_time dw \1 ; value pointer db \2 ; maximum value db \3 ; up/down arrow x coord (pairs with wRestartClockUpArrowYCoord) diff --git a/engine/rtc/timeset.asm b/engine/rtc/timeset.asm index 476236b23..149469354 100644 --- a/engine/rtc/timeset.asm +++ b/engine/rtc/timeset.asm @@ -1,5 +1,5 @@ -TIMESET_UP_ARROW EQU "♂" ; $ef -TIMESET_DOWN_ARROW EQU "♀" ; $f5 +DEF TIMESET_UP_ARROW EQU "♂" ; $ef +DEF TIMESET_DOWN_ARROW EQU "♀" ; $f5 InitClock: ; Ask the player to set the time. diff --git a/gfx/footprints.asm b/gfx/footprints.asm index 7acf1c74e..a35114d2d 100644 --- a/gfx/footprints.asm +++ b/gfx/footprints.asm @@ -4,8 +4,8 @@ ; then a row of the bottom two tiles for those eight footprints. ; These macros help extract the first and the last two tiles, respectively. -footprint_top EQUS "0, 2 * LEN_1BPP_TILE" -footprint_bottom EQUS "2 * LEN_1BPP_TILE, 2 * LEN_1BPP_TILE" +DEF footprint_top EQUS "0, 2 * LEN_1BPP_TILE" +DEF footprint_bottom EQUS "2 * LEN_1BPP_TILE, 2 * LEN_1BPP_TILE" Footprints: ; Entries correspond to Pokémon species, two apiece, 8 tops then 8 bottoms diff --git a/gfx/pokegear/town_map_palette_map.asm b/gfx/pokegear/town_map_palette_map.asm index 3224ec35b..dc70c6da5 100644 --- a/gfx/pokegear/town_map_palette_map.asm +++ b/gfx/pokegear/town_map_palette_map.asm @@ -6,11 +6,11 @@ const PAL_TOWNMAP_POI ; 4 const PAL_TOWNMAP_POI_MTN ; 5 -townmappals: MACRO -rept _NARG / 2 - dn PAL_TOWNMAP_\2, PAL_TOWNMAP_\1 - shift 2 -endr +MACRO townmappals + rept _NARG / 2 + dn PAL_TOWNMAP_\2, PAL_TOWNMAP_\1 + shift 2 + endr ENDM ; gfx/pokegear/town_map.png diff --git a/gfx/sgb/blk_packets.asm b/gfx/sgb/blk_packets.asm index f5562acfb..9dbcf046b 100644 --- a/gfx/sgb/blk_packets.asm +++ b/gfx/sgb/blk_packets.asm @@ -2,12 +2,12 @@ ; names taken from pandocs ; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_Palette_Commands -attr_blk: MACRO +MACRO attr_blk db (SGB_ATTR_BLK << 3) + ((\1 * 6) / 16 + 1) db \1 ENDM -attr_blk_data: MACRO +MACRO attr_blk_data db \1 ; which regions are affected db \2 + (\3 << 2) + (\4 << 4) ; palette for each region db \5, \6, \7, \8 ; x1, y1, x2, y2 diff --git a/gfx/sgb/pal_packets.asm b/gfx/sgb/pal_packets.asm index b031e969c..b54e6f89b 100644 --- a/gfx/sgb/pal_packets.asm +++ b/gfx/sgb/pal_packets.asm @@ -2,17 +2,17 @@ ; names taken from pandocs ; http://gbdev.gg8.se/wiki/articles/SGB_Functions#SGB_Palette_Commands -sgb_pal_set: MACRO +MACRO sgb_pal_set db (SGB_PAL_SET << 3) + 1 dw PREDEFPAL_\1, PREDEFPAL_\2, PREDEFPAL_\3, PREDEFPAL_\4 ds 7, 0 ENDM -sgb_pal01: MACRO +MACRO sgb_pal01 db (SGB_PAL01 << 3) + 1 ENDM -sgb_pal23: MACRO +MACRO sgb_pal23 db (SGB_PAL23 << 3) + 1 ENDM diff --git a/gfx/tileset_palette_maps.asm b/gfx/tileset_palette_maps.asm index 888b09dee..678eb1837 100644 --- a/gfx/tileset_palette_maps.asm +++ b/gfx/tileset_palette_maps.asm @@ -1,11 +1,11 @@ -tilepal: MACRO +MACRO tilepal ; used in gfx/tilesets/*_palette_map.asm ; vram bank, pals -x = \1 << OAM_TILE_BANK -rept (_NARG - 1) / 2 - dn (x | PAL_BG_\3), (x | PAL_BG_\2) - shift 2 -endr + DEF x = \1 << OAM_TILE_BANK + rept (_NARG - 1) / 2 + dn (x | PAL_BG_\3), (x | PAL_BG_\2) + shift 2 + endr ENDM TilesetKantoPalMap: diff --git a/gfx/tilesets.asm b/gfx/tilesets.asm index 54dd4a48a..fb7494ba7 100644 --- a/gfx/tilesets.asm +++ b/gfx/tilesets.asm @@ -1,6 +1,6 @@ INCLUDE "constants.asm" -tilecoll: MACRO +MACRO tilecoll ; used in data/tilesets/*_collision.asm db COLL_\1, COLL_\2, COLL_\3, COLL_\4 ENDM diff --git a/home/decompress.asm b/home/decompress.asm index 5284753d7..15e31f5c2 100644 --- a/home/decompress.asm +++ b/home/decompress.asm @@ -19,42 +19,42 @@ Decompress:: ; This function decompresses lz-compressed data from hl to de. -LZ_END EQU $ff ; Compressed data is terminated with $ff. +DEF LZ_END EQU $ff ; Compressed data is terminated with $ff. ; A typical control command consists of: -LZ_CMD EQU %11100000 ; command id (bits 5-7) -LZ_LEN EQU %00011111 ; length n (bits 0-4) +DEF LZ_CMD EQU %11100000 ; command id (bits 5-7) +DEF LZ_LEN EQU %00011111 ; length n (bits 0-4) ; Additional parameters are read during command execution. ; Commands: -LZ_LITERAL EQU 0 << 5 ; Read literal data for n bytes. -LZ_ITERATE EQU 1 << 5 ; Write the same byte for n bytes. -LZ_ALTERNATE EQU 2 << 5 ; Alternate two bytes for n bytes. -LZ_ZERO EQU 3 << 5 ; Write 0 for n bytes. +DEF LZ_LITERAL EQU 0 << 5 ; Read literal data for n bytes. +DEF LZ_ITERATE EQU 1 << 5 ; Write the same byte for n bytes. +DEF LZ_ALTERNATE EQU 2 << 5 ; Alternate two bytes for n bytes. +DEF LZ_ZERO EQU 3 << 5 ; Write 0 for n bytes. ; Another class of commands reuses data from the decompressed output. -LZ_RW EQU 2 + 5 ; bit +DEF LZ_RW EQU 2 + 5 ; bit ; These commands take a signed offset to start copying from. ; Wraparound is simulated. ; Positive offsets (15-bit) are added to the start address. ; Negative offsets (7-bit) are subtracted from the current position. -LZ_REPEAT EQU 4 << 5 ; Repeat n bytes from the offset. -LZ_FLIP EQU 5 << 5 ; Repeat n bitflipped bytes. -LZ_REVERSE EQU 6 << 5 ; Repeat n bytes in reverse. +DEF LZ_REPEAT EQU 4 << 5 ; Repeat n bytes from the offset. +DEF LZ_FLIP EQU 5 << 5 ; Repeat n bitflipped bytes. +DEF LZ_REVERSE EQU 6 << 5 ; Repeat n bytes in reverse. ; If the value in the count needs to be larger than 5 bits, ; LZ_LONG can be used to expand the count to 10 bits. -LZ_LONG EQU 7 << 5 +DEF LZ_LONG EQU 7 << 5 ; A new control command is read in bits 2-4. ; The top two bits of the length are bits 0-1. ; Another byte is read containing the bottom 8 bits. -LZ_LONG_HI EQU %00000011 +DEF LZ_LONG_HI EQU %00000011 ; In other words, the structure of the command becomes ; 111xxxyy yyyyyyyy diff --git a/home/gfx.asm b/home/gfx.asm index 50c2e98b7..339f5c3d7 100644 --- a/home/gfx.asm +++ b/home/gfx.asm @@ -1,5 +1,5 @@ -TILES_PER_CYCLE EQU 8 -MOBILE_TILES_PER_CYCLE EQU 6 +DEF TILES_PER_CYCLE EQU 8 +DEF MOBILE_TILES_PER_CYCLE EQU 6 Get2bppViaHDMA:: ldh a, [rLCDC] diff --git a/home/text.asm b/home/text.asm index 18eb1743c..6da8ee0d9 100644 --- a/home/text.asm +++ b/home/text.asm @@ -186,24 +186,24 @@ NextChar:: jp PlaceNextChar CheckDict:: -dict: MACRO -assert CHARLEN(\1) == 1 -if \1 == 0 - and a -else - cp \1 -endc -if ISCONST(\2) - ; Replace a character with another one - jr nz, .not\@ - ld a, \2 -.not\@: -elif STRSUB("\2", 1, 1) == "." - ; Locals can use a short jump - jr z, \2 -else - jp z, \2 -endc +MACRO dict + assert CHARLEN(\1) == 1 + if \1 == 0 + and a + else + cp \1 + endc + if ISCONST(\2) + ; Replace a character with another one + jr nz, .not\@ + ld a, \2 + .not\@: + elif STRSUB("\2", 1, 1) == "." + ; Locals can use a short jump + jr z, \2 + else + jp z, \2 + endc ENDM dict "", MobileScriptChar @@ -295,7 +295,7 @@ MobileScriptChar:: farcall RunMobileScript jp PlaceNextChar -print_name: MACRO +MACRO print_name push de ld de, \1 jp PlaceCommandCharacter diff --git a/home/video.asm b/home/video.asm index 8bfbbe551..8cda11d71 100644 --- a/home/video.asm +++ b/home/video.asm @@ -182,7 +182,7 @@ UpdateBGMap:: jr z, .middle ; 2 -THIRD_HEIGHT EQU SCREEN_HEIGHT / 3 +DEF THIRD_HEIGHT EQU SCREEN_HEIGHT / 3 ; bottom ld de, 2 * THIRD_HEIGHT * SCREEN_WIDTH diff --git a/lib/mobile/main.asm b/lib/mobile/main.asm index a2d7b8f7f..5d40eab1a 100644 --- a/lib/mobile/main.asm +++ b/lib/mobile/main.asm @@ -5,22 +5,22 @@ INCLUDE "constants/hardware_constants.asm" INCLUDE "constants/mobile_constants.asm" ; Mobile Adapter protocol commands -MOBILE_COMMAND_BEGIN_SESSION EQU $10 -MOBILE_COMMAND_END_SESSION EQU $11 -MOBILE_COMMAND_DIAL_TELEPHONE EQU $12 -MOBILE_COMMAND_HANG_UP_TELEPHONE EQU $13 -MOBILE_COMMAND_WAIT_FOR_TELEPHONE_CALL EQU $14 -MOBILE_COMMAND_TRANSFER_DATA EQU $15 -MOBILE_COMMAND_TELEPHONE_STATUS EQU $17 -MOBILE_COMMAND_READ_CONFIGURATION_DATA EQU $19 -MOBILE_COMMAND_WRITE_CONFIGURATION_DATA EQU $1a -MOBILE_COMMAND_TRANSFER_DATA_END EQU $1f -MOBILE_COMMAND_ISP_LOGIN EQU $21 -MOBILE_COMMAND_ISP_LOGOUT EQU $22 -MOBILE_COMMAND_OPEN_TCP_CONNECTION EQU $23 -MOBILE_COMMAND_CLOSE_TCP_CONNECTION EQU $24 -MOBILE_COMMAND_DNS_QUERY EQU $28 -MOBILE_COMMAND_ERROR EQU $6e +DEF MOBILE_COMMAND_BEGIN_SESSION EQU $10 +DEF MOBILE_COMMAND_END_SESSION EQU $11 +DEF MOBILE_COMMAND_DIAL_TELEPHONE EQU $12 +DEF MOBILE_COMMAND_HANG_UP_TELEPHONE EQU $13 +DEF MOBILE_COMMAND_WAIT_FOR_TELEPHONE_CALL EQU $14 +DEF MOBILE_COMMAND_TRANSFER_DATA EQU $15 +DEF MOBILE_COMMAND_TELEPHONE_STATUS EQU $17 +DEF MOBILE_COMMAND_READ_CONFIGURATION_DATA EQU $19 +DEF MOBILE_COMMAND_WRITE_CONFIGURATION_DATA EQU $1a +DEF MOBILE_COMMAND_TRANSFER_DATA_END EQU $1f +DEF MOBILE_COMMAND_ISP_LOGIN EQU $21 +DEF MOBILE_COMMAND_ISP_LOGOUT EQU $22 +DEF MOBILE_COMMAND_OPEN_TCP_CONNECTION EQU $23 +DEF MOBILE_COMMAND_CLOSE_TCP_CONNECTION EQU $24 +DEF MOBILE_COMMAND_DNS_QUERY EQU $28 +DEF MOBILE_COMMAND_ERROR EQU $6e SECTION "Mobile Adapter SDK", ROMX diff --git a/macros/asserts.asm b/macros/asserts.asm index e04ed0dc6..f0fa52a96 100644 --- a/macros/asserts.asm +++ b/macros/asserts.asm @@ -1,65 +1,65 @@ ; Macros to verify assumptions about the data or code -table_width: MACRO -CURRENT_TABLE_WIDTH = \1 -if _NARG == 2 -REDEF CURRENT_TABLE_START EQUS "\2" -else -REDEF CURRENT_TABLE_START EQUS "._table_width\@" -{CURRENT_TABLE_START}: -endc +MACRO table_width + DEF CURRENT_TABLE_WIDTH = \1 + if _NARG == 2 + REDEF CURRENT_TABLE_START EQUS "\2" + else + REDEF CURRENT_TABLE_START EQUS "._table_width\@" + {CURRENT_TABLE_START}: + endc ENDM -assert_table_length: MACRO -x = \1 +MACRO assert_table_length + DEF x = \1 assert x * CURRENT_TABLE_WIDTH == @ - {CURRENT_TABLE_START}, \ "{CURRENT_TABLE_START}: expected {d:x} entries, each {d:CURRENT_TABLE_WIDTH} bytes" ENDM -list_start: MACRO -list_index = 0 -if _NARG == 1 -REDEF CURRENT_LIST_START EQUS "\1" -else -REDEF CURRENT_LIST_START EQUS "._list_start\@" -{CURRENT_LIST_START}: -endc +MACRO list_start + DEF list_index = 0 + if _NARG == 1 + REDEF CURRENT_LIST_START EQUS "\1" + else + REDEF CURRENT_LIST_START EQUS "._list_start\@" + {CURRENT_LIST_START}: + endc ENDM -li: MACRO +MACRO li assert !STRIN(\1, "@"), STRCAT("String terminator \"@\" in list entry: ", \1) db \1, "@" -list_index += 1 + DEF list_index += 1 ENDM -assert_list_length: MACRO -x = \1 +MACRO assert_list_length + DEF x = \1 assert x == list_index, \ "{CURRENT_LIST_START}: expected {d:x} entries, got {d:list_index}" ENDM -def_grass_wildmons: MACRO +MACRO def_grass_wildmons ;\1: map id -REDEF CURRENT_GRASS_WILDMONS_MAP EQUS "\1" -REDEF CURRENT_GRASS_WILDMONS_LABEL EQUS "._def_grass_wildmons_\1" + REDEF CURRENT_GRASS_WILDMONS_MAP EQUS "\1" + REDEF CURRENT_GRASS_WILDMONS_LABEL EQUS "._def_grass_wildmons_\1" {CURRENT_GRASS_WILDMONS_LABEL}: map_id \1 ENDM -end_grass_wildmons: MACRO +MACRO end_grass_wildmons assert GRASS_WILDDATA_LENGTH == @ - {CURRENT_GRASS_WILDMONS_LABEL}, \ "def_grass_wildmons {CURRENT_GRASS_WILDMONS_MAP}: expected {d:GRASS_WILDDATA_LENGTH} bytes" ENDM -def_water_wildmons: MACRO +MACRO def_water_wildmons ;\1: map id -REDEF CURRENT_WATER_WILDMONS_MAP EQUS "\1" -REDEF CURRENT_WATER_WILDMONS_LABEL EQUS "._def_water_wildmons_\1" + REDEF CURRENT_WATER_WILDMONS_MAP EQUS "\1" + REDEF CURRENT_WATER_WILDMONS_LABEL EQUS "._def_water_wildmons_\1" {CURRENT_WATER_WILDMONS_LABEL}: map_id \1 ENDM -end_water_wildmons: MACRO +MACRO end_water_wildmons assert WATER_WILDDATA_LENGTH == @ - {CURRENT_WATER_WILDMONS_LABEL}, \ "def_water_wildmons {CURRENT_WATER_WILDMONS_MAP}: expected {d:WATER_WILDDATA_LENGTH} bytes" ENDM diff --git a/macros/code.asm b/macros/code.asm index 6e76febb8..6856b1dcb 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -1,16 +1,16 @@ ; Syntactic sugar macros -lb: MACRO ; r, hi, lo +MACRO lb ; r, hi, lo ld \1, ((\2) & $ff) << 8 | ((\3) & $ff) ENDM -ln: MACRO ; r, hi, lo +MACRO ln ; r, hi, lo ld \1, ((\2) & $f) << 4 | ((\3) & $f) ENDM ; Design patterns -jumptable: MACRO +MACRO jumptable ld a, [\2] ld e, a ld d, 0 @@ -23,7 +23,7 @@ jumptable: MACRO jp hl ENDM -maskbits: MACRO +MACRO maskbits ; masks just enough bits to cover values 0 to \1 - 1 ; \2 is an optional shift amount ; e.g. "maskbits 26" becomes "and %00011111" (since 26 - 1 = %00011001) @@ -35,20 +35,20 @@ maskbits: MACRO ; cp 26 ; jr nc, .loop assert 0 < (\1) && (\1) <= $100, "bitmask must be 8-bit" -x = 1 -rept 8 -if x + 1 < (\1) -x = (x << 1) | 1 -endc -endr -if _NARG == 2 - and x << (\2) -else - and x -endc + DEF x = 1 + rept 8 + if x + 1 < (\1) + DEF x = (x << 1) | 1 + endc + endr + if _NARG == 2 + and x << (\2) + else + and x + endc ENDM -calc_sine_wave: MACRO +MACRO calc_sine_wave ; input: a = a signed 6-bit value ; output: a = d * sin(a * pi/32) and %111111 diff --git a/macros/const.asm b/macros/const.asm index aed8bde4a..4b7acdda1 100644 --- a/macros/const.asm +++ b/macros/const.asm @@ -1,48 +1,48 @@ ; Enumerate constants -const_def: MACRO -if _NARG >= 1 -const_value = \1 -else -const_value = 0 -endc -if _NARG >= 2 -const_inc = \2 -else -const_inc = 1 -endc +MACRO const_def + if _NARG >= 1 + DEF const_value = \1 + else + DEF const_value = 0 + endc + if _NARG >= 2 + DEF const_inc = \2 + else + DEF const_inc = 1 + endc ENDM -const: MACRO -\1 EQU const_value -const_value += const_inc +MACRO const + DEF \1 EQU const_value + DEF const_value += const_inc ENDM -shift_const: MACRO -\1 EQU 1 << const_value -const_value += const_inc +MACRO shift_const + DEF \1 EQU 1 << const_value + DEF const_value += const_inc ENDM -const_skip: MACRO -if _NARG >= 1 -const_value += const_inc * (\1) -else -const_value += const_inc -endc +MACRO const_skip + if _NARG >= 1 + DEF const_value += const_inc * (\1) + else + DEF const_value += const_inc + endc ENDM -const_next: MACRO -if (const_value > 0 && \1 < const_value) || (const_value < 0 && \1 > const_value) -fail "const_next cannot go backwards from {const_value} to \1" -else -const_value = \1 -endc +MACRO const_next + if (const_value > 0 && \1 < const_value) || (const_value < 0 && \1 > const_value) + fail "const_next cannot go backwards from {const_value} to \1" + else + DEF const_value = \1 + endc ENDM -rb_skip: MACRO -if _NARG == 1 -rsset _RS + \1 -else -rsset _RS + 1 -endc +MACRO rb_skip + if _NARG == 1 + rsset _RS + \1 + else + rsset _RS + 1 + endc ENDM diff --git a/macros/coords.asm b/macros/coords.asm index 5a87e1d3d..228afca95 100644 --- a/macros/coords.asm +++ b/macros/coords.asm @@ -1,56 +1,56 @@ -hlcoord EQUS "coord hl," -bccoord EQUS "coord bc," -decoord EQUS "coord de," +DEF hlcoord EQUS "coord hl," +DEF bccoord EQUS "coord bc," +DEF decoord EQUS "coord de," -coord: MACRO +MACRO coord ; register, x, y[, origin] if _NARG < 4 - ld \1, (\3) * SCREEN_WIDTH + (\2) + wTilemap + ld \1, (\3) * SCREEN_WIDTH + (\2) + wTilemap else - ld \1, (\3) * SCREEN_WIDTH + (\2) + \4 + ld \1, (\3) * SCREEN_WIDTH + (\2) + \4 endc ENDM -hlbgcoord EQUS "bgcoord hl," -bcbgcoord EQUS "bgcoord bc," -debgcoord EQUS "bgcoord de," +DEF hlbgcoord EQUS "bgcoord hl," +DEF bcbgcoord EQUS "bgcoord bc," +DEF debgcoord EQUS "bgcoord de," -bgcoord: MACRO +MACRO bgcoord ; register, x, y[, origin] if _NARG < 4 - ld \1, (\3) * BG_MAP_WIDTH + (\2) + vBGMap0 + ld \1, (\3) * BG_MAP_WIDTH + (\2) + vBGMap0 else - ld \1, (\3) * BG_MAP_WIDTH + (\2) + \4 + ld \1, (\3) * BG_MAP_WIDTH + (\2) + \4 endc ENDM -dwcoord: MACRO +MACRO dwcoord ; x, y -rept _NARG / 2 - dw (\2) * SCREEN_WIDTH + (\1) + wTilemap - shift 2 -endr + rept _NARG / 2 + dw (\2) * SCREEN_WIDTH + (\1) + wTilemap + shift 2 + endr ENDM -ldcoord_a: MACRO +MACRO ldcoord_a ; x, y[, origin] if _NARG < 3 - ld [(\2) * SCREEN_WIDTH + (\1) + wTilemap], a + ld [(\2) * SCREEN_WIDTH + (\1) + wTilemap], a else - ld [(\2) * SCREEN_WIDTH + (\1) + \3], a + ld [(\2) * SCREEN_WIDTH + (\1) + \3], a endc ENDM -lda_coord: MACRO +MACRO lda_coord ; x, y[, origin] if _NARG < 3 - ld a, [(\2) * SCREEN_WIDTH + (\1) + wTilemap] + ld a, [(\2) * SCREEN_WIDTH + (\1) + wTilemap] else - ld a, [(\2) * SCREEN_WIDTH + (\1) + \3] + ld a, [(\2) * SCREEN_WIDTH + (\1) + \3] endc ENDM -menu_coords: MACRO +MACRO menu_coords ; x1, y1, x2, y2 db \2, \1 ; start coords db \4, \3 ; end coords diff --git a/macros/data.asm b/macros/data.asm index e5ebf1e64..c2686c9f4 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -20,84 +20,84 @@ ; - 180 = 71 percent - 1 = 70 percent + 2 ; - 200 = 79 percent - 1 ; - 230 = 90 percent + 1 -percent EQUS "* $ff / 100" +DEF percent EQUS "* $ff / 100" ; e.g. 1 out_of 2 == 50 percent + 1 == $80 -out_of EQUS "* $100 /" +DEF out_of EQUS "* $100 /" -assert_power_of_2: MACRO +MACRO assert_power_of_2 assert (\1) & ((\1) - 1) == 0, "\1 must be a power of 2" ENDM ; Constant data (db, dw, dl) macros -dwb: MACRO +MACRO dwb dw \1 db \2 ENDM -dbw: MACRO +MACRO dbw db \1 dw \2 ENDM -dn: MACRO ; nybbles -rept _NARG / 2 - db ((\1) << 4) | (\2) - shift 2 -endr +MACRO dn ; nybbles + rept _NARG / 2 + db ((\1) << 4) | (\2) + shift 2 + endr ENDM -dc: MACRO ; "crumbs" -rept _NARG / 4 - db ((\1) << 6) | ((\2) << 4) | ((\3) << 2) | (\4) - shift 4 -endr +MACRO dc ; "crumbs" + rept _NARG / 4 + db ((\1) << 6) | ((\2) << 4) | ((\3) << 2) | (\4) + shift 4 + endr ENDM -dt: MACRO ; three-byte (big-endian) +MACRO dt ; three-byte (big-endian) db LOW((\1) >> 16), HIGH(\1), LOW(\1) ENDM -dd: MACRO ; four-byte (big-endian) +MACRO dd ; four-byte (big-endian) db HIGH((\1) >> 16), LOW((\1) >> 16), HIGH(\1), LOW(\1) ENDM -bigdw: MACRO ; big-endian word +MACRO bigdw ; big-endian word db HIGH(\1), LOW(\1) ENDM -dba: MACRO ; dbw bank, address -rept _NARG - dbw BANK(\1), \1 - shift -endr +MACRO dba ; dbw bank, address + rept _NARG + dbw BANK(\1), \1 + shift + endr ENDM -dab: MACRO ; dwb address, bank -rept _NARG - dwb \1, BANK(\1) - shift -endr +MACRO dab ; dwb address, bank + rept _NARG + dwb \1, BANK(\1) + shift + endr ENDM -dba_pic: MACRO ; dbw bank, address +MACRO dba_pic ; dbw bank, address db BANK(\1) - PICS_FIX dw \1 ENDM -bcd: MACRO -rept _NARG - dn ((\1) % 100) / 10, (\1) % 10 - shift -endr +MACRO bcd + rept _NARG + dn ((\1) % 100) / 10, (\1) % 10 + shift + endr ENDM -sine_table: MACRO +MACRO sine_table ; \1 samples of sin(x) from x=0 to x<32768 (pi radians) -x = 0 -rept \1 - dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up -x += DIV(32768, \1) ; a circle has 65536 "degrees" -endr + DEF x = 0 + rept \1 + dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up + DEF x += DIV(32768, \1) ; a circle has 65536 "degrees" + endr ENDM diff --git a/macros/gfx.asm b/macros/gfx.asm index b42b1440b..7c94ea157 100644 --- a/macros/gfx.asm +++ b/macros/gfx.asm @@ -1,58 +1,58 @@ -assert_valid_rgb: MACRO -rept _NARG - assert 0 <= (\1) && (\1) <= 31, "RGB channel must be 0-31" - shift -endr +MACRO assert_valid_rgb + rept _NARG + assert 0 <= (\1) && (\1) <= 31, "RGB channel must be 0-31" + shift + endr ENDM -RGB: MACRO -rept _NARG / 3 - assert_valid_rgb \1, \2, \3 - dw palred (\1) + palgreen (\2) + palblue (\3) - shift 3 -endr +MACRO RGB + rept _NARG / 3 + assert_valid_rgb \1, \2, \3 + dw palred (\1) + palgreen (\2) + palblue (\3) + shift 3 + endr ENDM -palred EQUS "(1 << 0) *" -palgreen EQUS "(1 << 5) *" -palblue EQUS "(1 << 10) *" +DEF palred EQUS "(1 << 0) *" +DEF palgreen EQUS "(1 << 5) *" +DEF palblue EQUS "(1 << 10) *" -palettes EQUS "* PALETTE_SIZE" -palette EQUS "+ PALETTE_SIZE *" -color EQUS "+ PAL_COLOR_SIZE *" +DEF palettes EQUS "* PALETTE_SIZE" +DEF palette EQUS "+ PALETTE_SIZE *" +DEF color EQUS "+ PAL_COLOR_SIZE *" -tiles EQUS "* LEN_2BPP_TILE" -tile EQUS "+ LEN_2BPP_TILE *" +DEF tiles EQUS "* LEN_2BPP_TILE" +DEF tile EQUS "+ LEN_2BPP_TILE *" ; extracts the middle two colors from a 2bpp binary palette ; example usage: ; INCBIN "foo.gbcpal", middle_colors -middle_colors EQUS "PAL_COLOR_SIZE, PAL_COLOR_SIZE * 2" +DEF middle_colors EQUS "PAL_COLOR_SIZE, PAL_COLOR_SIZE * 2" -dbpixel: MACRO -if _NARG >= 4 -; x tile, y tile, x pixel, y pixel - db \1 * TILE_WIDTH + \3, \2 * TILE_WIDTH + \4 -else -; x tile, y tile - db \1 * TILE_WIDTH, \2 * TILE_WIDTH -endc +MACRO dbpixel + if _NARG >= 4 + ; x tile, y tile, x pixel, y pixel + db \1 * TILE_WIDTH + \3, \2 * TILE_WIDTH + \4 + else + ; x tile, y tile + db \1 * TILE_WIDTH, \2 * TILE_WIDTH + endc ENDM -ldpixel: MACRO -if _NARG >= 5 -; register, x tile, y tile, x pixel, y pixel - lb \1, \2 * TILE_WIDTH + \4, \3 * TILE_WIDTH + \5 -else -; register, x tile, y tile - lb \1, \2 * TILE_WIDTH, \3 * TILE_WIDTH -endc +MACRO ldpixel + if _NARG >= 5 + ; register, x tile, y tile, x pixel, y pixel + lb \1, \2 * TILE_WIDTH + \4, \3 * TILE_WIDTH + \5 + else + ; register, x tile, y tile + lb \1, \2 * TILE_WIDTH, \3 * TILE_WIDTH + endc ENDM -depixel EQUS "ldpixel de," -bcpixel EQUS "ldpixel bc," +DEF depixel EQUS "ldpixel de," +DEF bcpixel EQUS "ldpixel bc," -dbsprite: MACRO +MACRO dbsprite ; x tile, y tile, x pixel, y pixel, vtile offset, attributes db (\2 * TILE_WIDTH) % $100 + \4, (\1 * TILE_WIDTH) % $100 + \3, \5, \6 ENDM diff --git a/macros/legacy.asm b/macros/legacy.asm index e23b5f88f..acff5200d 100644 --- a/macros/legacy.asm +++ b/macros/legacy.asm @@ -3,394 +3,394 @@ ; Legacy support not in this file can be found by looking for the keyword: "LEGACY" ; macros/rst.asm -callba EQUS "farcall" -callab EQUS "callfar" +DEF callba EQUS "farcall" +DEF callab EQUS "callfar" ; macros/gfx.asm -dsprite: MACRO +MACRO dsprite dbsprite \2, \4, \1, \3, \5, \6 ENDM ; macros/data.asm -dbbw: MACRO +MACRO dbbw db \1, \2 dw \3 ENDM -dbww: MACRO +MACRO dbww db \1 dw \2, \3 ENDM -dbwww: MACRO +MACRO dbwww db \1 dw \2, \3, \4 ENDM ; macros/scripts/audio.asm -__ EQU 0 -CC EQU 13 +DEF __ EQU 0 +DEF CC EQU 13 -musicheader: MACRO +MACRO musicheader channel_count \1 channel \2, \3 ENDM -sound: MACRO +MACRO sound note \1, \2 db \3 dw \4 ENDM -noise: MACRO +MACRO noise note \1, \2 db \3 db \4 ENDM -notetype: MACRO -if _NARG >= 2 - note_type \1, \2 >> 4, \2 & $0f -else - note_type \1 -endc +MACRO notetype + if _NARG >= 2 + note_type \1, \2 >> 4, \2 & $0f + else + note_type \1 + endc ENDM -pitchoffset: MACRO +MACRO pitchoffset transpose \1, \2 - 1 ENDM -dutycycle EQUS "duty_cycle" +DEF dutycycle EQUS "duty_cycle" -intensity: MACRO +MACRO intensity volume_envelope \1 >> 4, \1 & $0f ENDM -soundinput: MACRO +MACRO soundinput pitch_sweep \1 >> 4, \1 & $0f ENDM -unknownmusic0xde EQUS "sound_duty" -sound_duty: MACRO +DEF unknownmusic0xde EQUS "sound_duty" +MACRO sound_duty db duty_cycle_pattern_cmd -if _NARG == 4 - db \1 | (\2 << 2) | (\3 << 4) | (\4 << 6) -else - db \1 -endc + if _NARG == 4 + db \1 | (\2 << 2) | (\3 << 4) | (\4 << 6) + else + db \1 + endc ENDM -togglesfx EQUS "toggle_sfx" +DEF togglesfx EQUS "toggle_sfx" -slidepitchto: MACRO +MACRO slidepitchto pitch_slide \1, (8 - \2), \3 ENDM -togglenoise EQUS "toggle_noise" +DEF togglenoise EQUS "toggle_noise" -panning: MACRO +MACRO panning force_stereo_panning ((\1 >> 4) & 1), (\1 & 1) ENDM -tone EQUS "pitch_offset" -restartchannel EQUS "restart_channel" -newsong EQUS "new_song" -sfxpriorityon EQUS "sfx_priority_on" -sfxpriorityoff EQUS "sfx_priority_off" +DEF tone EQUS "pitch_offset" +DEF restartchannel EQUS "restart_channel" +DEF newsong EQUS "new_song" +DEF sfxpriorityon EQUS "sfx_priority_on" +DEF sfxpriorityoff EQUS "sfx_priority_off" -stereopanning: MACRO +MACRO stereopanning stereo_panning ((\1 >> 4) & 1), (\1 & 1) ENDM -sfxtogglenoise EQUS "sfx_toggle_noise" -setcondition EQUS "set_condition" -jumpif EQUS "sound_jump_if" -jumpchannel EQUS "sound_jump" -loopchannel EQUS "sound_loop" -callchannel EQUS "sound_call" -endchannel EQUS "sound_ret" +DEF sfxtogglenoise EQUS "sfx_toggle_noise" +DEF setcondition EQUS "set_condition" +DEF jumpif EQUS "sound_jump_if" +DEF jumpchannel EQUS "sound_jump" +DEF loopchannel EQUS "sound_loop" +DEF callchannel EQUS "sound_call" +DEF endchannel EQUS "sound_ret" ; macros/scripts/events.asm -checkmorn EQUS "checktime MORN" -checkday EQUS "checktime DAY" -checknite EQUS "checktime NITE" +DEF checkmorn EQUS "checktime MORN" +DEF checkday EQUS "checktime DAY" +DEF checknite EQUS "checktime NITE" -jump EQUS "sjump" -farjump EQUS "farsjump" -priorityjump EQUS "sdefer" -prioritysjump EQUS "sdefer" -ptcall EQUS "memcall" -ptjump EQUS "memjump" -ptpriorityjump EQUS "stopandsjump" -ptcallasm EQUS "memcallasm" +DEF jump EQUS "sjump" +DEF farjump EQUS "farsjump" +DEF priorityjump EQUS "sdefer" +DEF prioritysjump EQUS "sdefer" +DEF ptcall EQUS "memcall" +DEF ptjump EQUS "memjump" +DEF ptpriorityjump EQUS "stopandsjump" +DEF ptcallasm EQUS "memcallasm" -if_equal EQUS "ifequal" -if_not_equal EQUS "ifnotequal" -if_greater_than EQUS "ifgreater" -if_less_than EQUS "ifless" -end_all EQUS "endall" -return EQUS "endcallback" -reloadandreturn EQUS "reloadend" +DEF if_equal EQUS "ifequal" +DEF if_not_equal EQUS "ifnotequal" +DEF if_greater_than EQUS "ifgreater" +DEF if_less_than EQUS "ifless" +DEF end_all EQUS "endall" +DEF return EQUS "endcallback" +DEF reloadandreturn EQUS "reloadend" -checkmaptriggers EQUS "checkmapscene" -domaptrigger EQUS "setmapscene" -checktriggers EQUS "checkscene" -dotrigger EQUS "setscene" +DEF checkmaptriggers EQUS "checkmapscene" +DEF domaptrigger EQUS "setmapscene" +DEF checktriggers EQUS "checkscene" +DEF dotrigger EQUS "setscene" -faceperson EQUS "faceobject" -moveperson EQUS "moveobject" -writepersonxy EQUS "writeobjectxy" -spriteface EQUS "turnobject" -objectface EQUS "turnobject" -applymovement2 EQUS "applymovementlasttalked" +DEF faceperson EQUS "faceobject" +DEF moveperson EQUS "moveobject" +DEF writepersonxy EQUS "writeobjectxy" +DEF spriteface EQUS "turnobject" +DEF objectface EQUS "turnobject" +DEF applymovement2 EQUS "applymovementlasttalked" -writebyte EQUS "setval" -addvar EQUS "addval" -copybytetovar EQUS "readmem" -copyvartobyte EQUS "writemem" -checkcode EQUS "readvar" -writevarcode EQUS "writevar" -writecode EQUS "loadvar" +DEF writebyte EQUS "setval" +DEF addvar EQUS "addval" +DEF copybytetovar EQUS "readmem" +DEF copyvartobyte EQUS "writemem" +DEF checkcode EQUS "readvar" +DEF writevarcode EQUS "writevar" +DEF writecode EQUS "loadvar" -MEM_BUFFER_0 EQUS "STRING_BUFFER_3" -MEM_BUFFER_1 EQUS "STRING_BUFFER_4" -MEM_BUFFER_2 EQUS "STRING_BUFFER_5" +DEF MEM_BUFFER_0 EQUS "STRING_BUFFER_3" +DEF MEM_BUFFER_1 EQUS "STRING_BUFFER_4" +DEF MEM_BUFFER_2 EQUS "STRING_BUFFER_5" -vartomem EQUS "getnum" -mapnametotext EQUS "getcurlandmarkname" -readcoins EQUS "getcoins" +DEF vartomem EQUS "getnum" +DEF mapnametotext EQUS "getcurlandmarkname" +DEF readcoins EQUS "getcoins" -pokenamemem: MACRO +MACRO pokenamemem getmonname \2, \1 ENDM -itemtotext: MACRO +MACRO itemtotext getitemname \2, \1 ENDM -landmarktotext: MACRO +MACRO landmarktotext getlandmarkname \2, \1 ENDM -trainertotext: MACRO +MACRO trainertotext gettrainername \3, \1, \2 ENDM -trainerclassname: MACRO +MACRO trainerclassname gettrainerclassname \2, \1 ENDM -name: MACRO +MACRO name getname \3, \1, \2 ENDM -stringtotext: MACRO +MACRO stringtotext getstring \2, \1 ENDM -readmoney: MACRO +MACRO readmoney getmoney \2, \1 ENDM -RAM2MEM EQUS "getnum" -loadfont EQUS "opentext" -loadmenudata EQUS "loadmenu" -loadmenuheader EQUS "loadmenu" -writebackup EQUS "closewindow" -interpretmenu EQUS "_2dmenu" -interpretmenu2 EQUS "verticalmenu" -buttonsound EQUS "promptbutton" -battlecheck EQUS "randomwildmon" -loadtrainerdata EQUS "loadtemptrainer" -loadpokedata EQUS "loadwildmon" -returnafterbattle EQUS "reloadmapafterbattle" -trainerstatus EQUS "trainerflagaction" -talkaftercancel EQUS "endifjustbattled" -talkaftercheck EQUS "checkjustbattled" -playrammusic EQUS "encountermusic" -reloadmapmusic EQUS "dontrestartmapmusic" -resetfuncs EQUS "endall" -storetext EQUS "battletowertext" -displaylocation EQUS "landmarktotext" -givepokeitem EQUS "givepokemail" -checkpokeitem EQUS "checkpokemail" -passtoengine EQUS "autoinput" -verbosegiveitem2 EQUS "verbosegiveitemvar" -loadbytec2cf EQUS "writeunusedbyte" -writeunusedbytebuffer EQUS "writeunusedbyte" +DEF RAM2MEM EQUS "getnum" +DEF loadfont EQUS "opentext" +DEF loadmenudata EQUS "loadmenu" +DEF loadmenuheader EQUS "loadmenu" +DEF writebackup EQUS "closewindow" +DEF interpretmenu EQUS "_2dmenu" +DEF interpretmenu2 EQUS "verticalmenu" +DEF buttonsound EQUS "promptbutton" +DEF battlecheck EQUS "randomwildmon" +DEF loadtrainerdata EQUS "loadtemptrainer" +DEF loadpokedata EQUS "loadwildmon" +DEF returnafterbattle EQUS "reloadmapafterbattle" +DEF trainerstatus EQUS "trainerflagaction" +DEF talkaftercancel EQUS "endifjustbattled" +DEF talkaftercheck EQUS "checkjustbattled" +DEF playrammusic EQUS "encountermusic" +DEF reloadmapmusic EQUS "dontrestartmapmusic" +DEF resetfuncs EQUS "endall" +DEF storetext EQUS "battletowertext" +DEF displaylocation EQUS "landmarktotext" +DEF givepokeitem EQUS "givepokemail" +DEF checkpokeitem EQUS "checkpokemail" +DEF passtoengine EQUS "autoinput" +DEF verbosegiveitem2 EQUS "verbosegiveitemvar" +DEF loadbytec2cf EQUS "writeunusedbyte" +DEF writeunusedbytebuffer EQUS "writeunusedbyte" ; macros/scripts/maps.asm -mapconst: MACRO +MACRO mapconst map_const \1, \3, \2 ENDM -maptrigger EQUS "scene_script" +DEF maptrigger EQUS "scene_script" -warp_def: MACRO +MACRO warp_def warp_event \2, \1, \4, \3 ENDM -xy_trigger: MACRO +MACRO xy_trigger coord_event \3, \2, \1, \5 ENDM -signpost: MACRO +MACRO signpost bg_event \2, \1, \3, \4 ENDM -person_event: MACRO +MACRO person_event object_event \3, \2, \1, \4, \5, \6, \7, \8, \9, \<10>, \<11>, \<12>, \<13> ENDM -PERSONTYPE_SCRIPT EQUS "OBJECTTYPE_SCRIPT" -PERSONTYPE_ITEMBALL EQUS "OBJECTTYPE_ITEMBALL" -PERSONTYPE_TRAINER EQUS "OBJECTTYPE_TRAINER" +DEF PERSONTYPE_SCRIPT EQUS "OBJECTTYPE_SCRIPT" +DEF PERSONTYPE_ITEMBALL EQUS "OBJECTTYPE_ITEMBALL" +DEF PERSONTYPE_TRAINER EQUS "OBJECTTYPE_TRAINER" ; macros/scripts/movement.asm -show_person EQUS "show_object" -hide_person EQUS "hide_object" -remove_person EQUS "remove_object" +DEF show_person EQUS "show_object" +DEF hide_person EQUS "hide_object" +DEF remove_person EQUS "remove_object" -turn_head_down EQUS "turn_head DOWN" -turn_head_up EQUS "turn_head UP" -turn_head_left EQUS "turn_head LEFT" -turn_head_right EQUS "turn_head RIGHT" -turn_step_down EQUS "turn_step DOWN" -turn_step_up EQUS "turn_step UP" -turn_step_left EQUS "turn_step LEFT" -turn_step_right EQUS "turn_step RIGHT" -slow_step_down EQUS "slow_step DOWN" -slow_step_up EQUS "slow_step UP" -slow_step_left EQUS "slow_step LEFT" -slow_step_right EQUS "slow_step RIGHT" -step_down EQUS "step DOWN" -step_up EQUS "step UP" -step_left EQUS "step LEFT" -step_right EQUS "step RIGHT" -big_step_down EQUS "big_step DOWN" -big_step_up EQUS "big_step UP" -big_step_left EQUS "big_step LEFT" -big_step_right EQUS "big_step RIGHT" -slow_slide_step_down EQUS "slow_slide_step DOWN" -slow_slide_step_up EQUS "slow_slide_step UP" -slow_slide_step_left EQUS "slow_slide_step LEFT" -slow_slide_step_right EQUS "slow_slide_step RIGHT" -slide_step_down EQUS "slide_step DOWN" -slide_step_up EQUS "slide_step UP" -slide_step_left EQUS "slide_step LEFT" -slide_step_right EQUS "slide_step RIGHT" -fast_slide_step_down EQUS "fast_slide_step DOWN" -fast_slide_step_up EQUS "fast_slide_step UP" -fast_slide_step_left EQUS "fast_slide_step LEFT" -fast_slide_step_right EQUS "fast_slide_step RIGHT" -turn_away_down EQUS "turn_away DOWN" -turn_away_up EQUS "turn_away UP" -turn_away_left EQUS "turn_away LEFT" -turn_away_right EQUS "turn_away RIGHT" -turn_in_down EQUS "turn_in DOWN" -turn_in_up EQUS "turn_in UP" -turn_in_left EQUS "turn_in LEFT" -turn_in_right EQUS "turn_in RIGHT" -turn_waterfall_down EQUS "turn_waterfall DOWN" -turn_waterfall_up EQUS "turn_waterfall UP" -turn_waterfall_left EQUS "turn_waterfall LEFT" -turn_waterfall_right EQUS "turn_waterfall RIGHT" -slow_jump_step_down EQUS "slow_jump_step DOWN" -slow_jump_step_up EQUS "slow_jump_step UP" -slow_jump_step_left EQUS "slow_jump_step LEFT" -slow_jump_step_right EQUS "slow_jump_step RIGHT" -jump_step_down EQUS "jump_step DOWN" -jump_step_up EQUS "jump_step UP" -jump_step_left EQUS "jump_step LEFT" -jump_step_right EQUS "jump_step RIGHT" -fast_jump_step_down EQUS "fast_jump_step DOWN" -fast_jump_step_up EQUS "fast_jump_step UP" -fast_jump_step_left EQUS "fast_jump_step LEFT" -fast_jump_step_right EQUS "fast_jump_step RIGHT" +DEF turn_head_down EQUS "turn_head DOWN" +DEF turn_head_up EQUS "turn_head UP" +DEF turn_head_left EQUS "turn_head LEFT" +DEF turn_head_right EQUS "turn_head RIGHT" +DEF turn_step_down EQUS "turn_step DOWN" +DEF turn_step_up EQUS "turn_step UP" +DEF turn_step_left EQUS "turn_step LEFT" +DEF turn_step_right EQUS "turn_step RIGHT" +DEF slow_step_down EQUS "slow_step DOWN" +DEF slow_step_up EQUS "slow_step UP" +DEF slow_step_left EQUS "slow_step LEFT" +DEF slow_step_right EQUS "slow_step RIGHT" +DEF step_down EQUS "step DOWN" +DEF step_up EQUS "step UP" +DEF step_left EQUS "step LEFT" +DEF step_right EQUS "step RIGHT" +DEF big_step_down EQUS "big_step DOWN" +DEF big_step_up EQUS "big_step UP" +DEF big_step_left EQUS "big_step LEFT" +DEF big_step_right EQUS "big_step RIGHT" +DEF slow_slide_step_down EQUS "slow_slide_step DOWN" +DEF slow_slide_step_up EQUS "slow_slide_step UP" +DEF slow_slide_step_left EQUS "slow_slide_step LEFT" +DEF slow_slide_step_right EQUS "slow_slide_step RIGHT" +DEF slide_step_down EQUS "slide_step DOWN" +DEF slide_step_up EQUS "slide_step UP" +DEF slide_step_left EQUS "slide_step LEFT" +DEF slide_step_right EQUS "slide_step RIGHT" +DEF fast_slide_step_down EQUS "fast_slide_step DOWN" +DEF fast_slide_step_up EQUS "fast_slide_step UP" +DEF fast_slide_step_left EQUS "fast_slide_step LEFT" +DEF fast_slide_step_right EQUS "fast_slide_step RIGHT" +DEF turn_away_down EQUS "turn_away DOWN" +DEF turn_away_up EQUS "turn_away UP" +DEF turn_away_left EQUS "turn_away LEFT" +DEF turn_away_right EQUS "turn_away RIGHT" +DEF turn_in_down EQUS "turn_in DOWN" +DEF turn_in_up EQUS "turn_in UP" +DEF turn_in_left EQUS "turn_in LEFT" +DEF turn_in_right EQUS "turn_in RIGHT" +DEF turn_waterfall_down EQUS "turn_waterfall DOWN" +DEF turn_waterfall_up EQUS "turn_waterfall UP" +DEF turn_waterfall_left EQUS "turn_waterfall LEFT" +DEF turn_waterfall_right EQUS "turn_waterfall RIGHT" +DEF slow_jump_step_down EQUS "slow_jump_step DOWN" +DEF slow_jump_step_up EQUS "slow_jump_step UP" +DEF slow_jump_step_left EQUS "slow_jump_step LEFT" +DEF slow_jump_step_right EQUS "slow_jump_step RIGHT" +DEF jump_step_down EQUS "jump_step DOWN" +DEF jump_step_up EQUS "jump_step UP" +DEF jump_step_left EQUS "jump_step LEFT" +DEF jump_step_right EQUS "jump_step RIGHT" +DEF fast_jump_step_down EQUS "fast_jump_step DOWN" +DEF fast_jump_step_up EQUS "fast_jump_step UP" +DEF fast_jump_step_left EQUS "fast_jump_step LEFT" +DEF fast_jump_step_right EQUS "fast_jump_step RIGHT" -step_sleep_1 EQUS "step_sleep 1" -step_sleep_2 EQUS "step_sleep 2" -step_sleep_3 EQUS "step_sleep 3" -step_sleep_4 EQUS "step_sleep 4" -step_sleep_5 EQUS "step_sleep 5" -step_sleep_6 EQUS "step_sleep 6" -step_sleep_7 EQUS "step_sleep 7" -step_sleep_8 EQUS "step_sleep 8" +DEF step_sleep_1 EQUS "step_sleep 1" +DEF step_sleep_2 EQUS "step_sleep 2" +DEF step_sleep_3 EQUS "step_sleep 3" +DEF step_sleep_4 EQUS "step_sleep 4" +DEF step_sleep_5 EQUS "step_sleep 5" +DEF step_sleep_6 EQUS "step_sleep 6" +DEF step_sleep_7 EQUS "step_sleep 7" +DEF step_sleep_8 EQUS "step_sleep 8" ; macros/scripts/text.asm -text_from_ram EQUS "text_ram" -start_asm EQUS "text_asm" -deciram EQUS "text_decimal" -interpret_data EQUS "text_pause" -limited_interpret_data EQUS "text_dots" -link_wait_button EQUS "text_waitbutton" -text_linkwaitbutton EQUS "text_waitbutton" -text_linkpromptbutton EQUS "text_waitbutton" -current_day EQUS "text_today" -text_jump EQUS "text_far" +DEF text_from_ram EQUS "text_ram" +DEF start_asm EQUS "text_asm" +DEF deciram EQUS "text_decimal" +DEF interpret_data EQUS "text_pause" +DEF limited_interpret_data EQUS "text_dots" +DEF link_wait_button EQUS "text_waitbutton" +DEF text_linkwaitbutton EQUS "text_waitbutton" +DEF text_linkpromptbutton EQUS "text_waitbutton" +DEF current_day EQUS "text_today" +DEF text_jump EQUS "text_far" ; macros/scripts/battle_anims.asm -anim_enemyfeetobj EQUS "anim_battlergfx_2row" -anim_playerheadobj EQUS "anim_battlergfx_1row" -anim_clearsprites EQUS "anim_keepsprites" +DEF anim_enemyfeetobj EQUS "anim_battlergfx_2row" +DEF anim_playerheadobj EQUS "anim_battlergfx_1row" +DEF anim_clearsprites EQUS "anim_keepsprites" ; engine/events/std_scripts.asm -pokecenternurse EQUS "PokecenterNurseScript" -difficultbookshelf EQUS "DifficultBookshelfScript" -picturebookshelf EQUS "PictureBookshelfScript" -magazinebookshelf EQUS "MagazineBookshelfScript" -teamrocketoath EQUS "TeamRocketOathScript" -incenseburner EQUS "IncenseBurnerScript" -merchandiseshelf EQUS "MerchandiseShelfScript" -townmap EQUS "TownMapScript" -window EQUS "WindowScript" -tv EQUS "TVScript" -homepage EQUS "HomepageScript" -radio1 EQUS "Radio1Script" -radio2 EQUS "Radio2Script" -trashcan EQUS "TrashCanScript" -strengthboulder EQUS "StrengthBoulderScript" -smashrock EQUS "SmashRockScript" -pokecentersign EQUS "PokecenterSignScript" -martsign EQUS "MartSignScript" -goldenrodrockets EQUS "GoldenrodRocketsScript" -radiotowerrockets EQUS "RadioTowerRocketsScript" -elevatorbutton EQUS "ElevatorButtonScript" -daytotext EQUS "DayToTextScript" -bugcontestresultswarp EQUS "BugContestResultsWarpScript" -bugcontestresults EQUS "BugContestResultsScript" -initializeevents EQUS "InitializeEventsScript" -asknumber1m EQUS "AskNumber1MScript" -asknumber2m EQUS "AskNumber2MScript" -registerednumberm EQUS "RegisteredNumberMScript" -numberacceptedm EQUS "NumberAcceptedMScript" -numberdeclinedm EQUS "NumberDeclinedMScript" -phonefullm EQUS "PhoneFullMScript" -rematchm EQUS "RematchMScript" -giftm EQUS "GiftMScript" -packfullm EQUS "PackFullMScript" -rematchgiftm EQUS "RematchGiftMScript" -asknumber1f EQUS "AskNumber1FScript" -asknumber2f EQUS "AskNumber2FScript" -registerednumberf EQUS "RegisteredNumberFScript" -numberacceptedf EQUS "NumberAcceptedFScript" -numberdeclinedf EQUS "NumberDeclinedFScript" -phonefullf EQUS "PhoneFullFScript" -rematchf EQUS "RematchFScript" -giftf EQUS "GiftFScript" -packfullf EQUS "PackFullFScript" -rematchgiftf EQUS "RematchGiftFScript" -gymstatue1 EQUS "GymStatue1Script" -gymstatue2 EQUS "GymStatue2Script" -receiveitem EQUS "ReceiveItemScript" -receivetogepiegg EQUS "ReceiveTogepiEggScript" -pcscript EQUS "PCScript" -gamecornercoinvendor EQUS "GameCornerCoinVendorScript" -happinesschecknpc EQUS "HappinessCheckScript" +DEF pokecenternurse EQUS "PokecenterNurseScript" +DEF difficultbookshelf EQUS "DifficultBookshelfScript" +DEF picturebookshelf EQUS "PictureBookshelfScript" +DEF magazinebookshelf EQUS "MagazineBookshelfScript" +DEF teamrocketoath EQUS "TeamRocketOathScript" +DEF incenseburner EQUS "IncenseBurnerScript" +DEF merchandiseshelf EQUS "MerchandiseShelfScript" +DEF townmap EQUS "TownMapScript" +DEF window EQUS "WindowScript" +DEF tv EQUS "TVScript" +DEF homepage EQUS "HomepageScript" +DEF radio1 EQUS "Radio1Script" +DEF radio2 EQUS "Radio2Script" +DEF trashcan EQUS "TrashCanScript" +DEF strengthboulder EQUS "StrengthBoulderScript" +DEF smashrock EQUS "SmashRockScript" +DEF pokecentersign EQUS "PokecenterSignScript" +DEF martsign EQUS "MartSignScript" +DEF goldenrodrockets EQUS "GoldenrodRocketsScript" +DEF radiotowerrockets EQUS "RadioTowerRocketsScript" +DEF elevatorbutton EQUS "ElevatorButtonScript" +DEF daytotext EQUS "DayToTextScript" +DEF bugcontestresultswarp EQUS "BugContestResultsWarpScript" +DEF bugcontestresults EQUS "BugContestResultsScript" +DEF initializeevents EQUS "InitializeEventsScript" +DEF asknumber1m EQUS "AskNumber1MScript" +DEF asknumber2m EQUS "AskNumber2MScript" +DEF registerednumberm EQUS "RegisteredNumberMScript" +DEF numberacceptedm EQUS "NumberAcceptedMScript" +DEF numberdeclinedm EQUS "NumberDeclinedMScript" +DEF phonefullm EQUS "PhoneFullMScript" +DEF rematchm EQUS "RematchMScript" +DEF giftm EQUS "GiftMScript" +DEF packfullm EQUS "PackFullMScript" +DEF rematchgiftm EQUS "RematchGiftMScript" +DEF asknumber1f EQUS "AskNumber1FScript" +DEF asknumber2f EQUS "AskNumber2FScript" +DEF registerednumberf EQUS "RegisteredNumberFScript" +DEF numberacceptedf EQUS "NumberAcceptedFScript" +DEF numberdeclinedf EQUS "NumberDeclinedFScript" +DEF phonefullf EQUS "PhoneFullFScript" +DEF rematchf EQUS "RematchFScript" +DEF giftf EQUS "GiftFScript" +DEF packfullf EQUS "PackFullFScript" +DEF rematchgiftf EQUS "RematchGiftFScript" +DEF gymstatue1 EQUS "GymStatue1Script" +DEF gymstatue2 EQUS "GymStatue2Script" +DEF receiveitem EQUS "ReceiveItemScript" +DEF receivetogepiegg EQUS "ReceiveTogepiEggScript" +DEF pcscript EQUS "PCScript" +DEF gamecornercoinvendor EQUS "GameCornerCoinVendorScript" +DEF happinesschecknpc EQUS "HappinessCheckScript" ; constants/sprite_constants.asm -SPRITE_BUENA EQUS "SPRITE_BEAUTY" +DEF SPRITE_BUENA EQUS "SPRITE_BEAUTY" diff --git a/macros/predef.asm b/macros/predef.asm index a1c43bb51..bd101806f 100644 --- a/macros/predef.asm +++ b/macros/predef.asm @@ -1,15 +1,15 @@ -lda_predef: MACRO +MACRO lda_predef ; Some functions load the predef id ; without immediately calling Predef. ld a, (\1Predef - PredefPointers) / 3 ENDM -predef: MACRO +MACRO predef lda_predef \1 call Predef ENDM -predef_jump: MACRO +MACRO predef_jump lda_predef \1 jp Predef ENDM diff --git a/macros/rst.asm b/macros/rst.asm index c8b80aab2..5ae20ea55 100644 --- a/macros/rst.asm +++ b/macros/rst.asm @@ -1,16 +1,16 @@ -farcall: MACRO ; bank, address +MACRO farcall ; bank, address ld a, BANK(\1) ld hl, \1 rst FarCall ENDM -callfar: MACRO ; address, bank +MACRO callfar ; address, bank ld hl, \1 ld a, BANK(\1) rst FarCall ENDM -homecall: MACRO +MACRO homecall ldh a, [hROMBank] push af ld a, BANK(\1) diff --git a/macros/scripts/audio.asm b/macros/scripts/audio.asm index 9997fb6b1..7ecb803c7 100644 --- a/macros/scripts/audio.asm +++ b/macros/scripts/audio.asm @@ -1,30 +1,30 @@ -channel_count: MACRO +MACRO channel_count assert 0 < (\1) && (\1) <= NUM_MUSIC_CHANS, \ "channel_count must be 1-{d:NUM_MUSIC_CHANS}" -_num_channels = \1 - 1 + DEF _num_channels = \1 - 1 ENDM -channel: MACRO +MACRO channel assert 0 < (\1) && (\1) <= NUM_CHANNELS, \ "channel id must be 1-{d:NUM_CHANNELS}" dn (_num_channels << 2), \1 - 1 ; channel id dw \2 ; address -_num_channels = 0 + DEF _num_channels = 0 ENDM -note: MACRO +MACRO note dn (\1), (\2) - 1 ; pitch, length ENDM -drum_note: MACRO +MACRO drum_note note \1, \2 ; drum instrument, length ENDM -rest: MACRO +MACRO rest note 0, \1 ; length ENDM -square_note: MACRO +MACRO square_note db \1 ; length if \3 < 0 dn \2, %1000 | (\3 * -1) ; volume envelope @@ -34,7 +34,7 @@ square_note: MACRO dw \4 ; frequency ENDM -noise_note: MACRO +MACRO noise_note db \1 ; length if \3 < 0 dn \2, %1000 | (\3 * -1) ; volume envelope @@ -46,10 +46,10 @@ ENDM ; MusicCommands indexes (see audio/engine.asm) const_def $d0 -FIRST_MUSIC_CMD EQU const_value +DEF FIRST_MUSIC_CMD EQU const_value const octave_cmd ; $d0 -octave: MACRO +MACRO octave assert 1 <= (\1) && (\1) <= 8, "octave must be 1-8" db octave_cmd + 8 - (\1) ; octave ENDM @@ -57,7 +57,7 @@ ENDM const_skip 7 ; all octave values const note_type_cmd ; $d8 -note_type: MACRO +MACRO note_type db note_type_cmd db \1 ; note length if _NARG >= 2 @@ -70,30 +70,30 @@ note_type: MACRO ENDM ; only valid on the noise channel -drum_speed: MACRO +MACRO drum_speed note_type \1 ; note length ENDM const transpose_cmd ; $d9 -transpose: MACRO +MACRO transpose db transpose_cmd dn \1, \2 ; num octaves, num pitches ENDM const tempo_cmd ; $da -tempo: MACRO +MACRO tempo db tempo_cmd bigdw \1 ; tempo ENDM const duty_cycle_cmd ; $db -duty_cycle: MACRO +MACRO duty_cycle db duty_cycle_cmd db \1 ; duty cycle ENDM const volume_envelope_cmd ; $dc -volume_envelope: MACRO +MACRO volume_envelope db volume_envelope_cmd if \2 < 0 dn \1, %1000 | (\2 * -1) ; volume envelope @@ -103,7 +103,7 @@ volume_envelope: MACRO ENDM const pitch_sweep_cmd ; $dd -pitch_sweep: MACRO +MACRO pitch_sweep db pitch_sweep_cmd if \2 < 0 dn \1, %1000 | (\2 * -1) ; pitch sweep @@ -113,25 +113,25 @@ pitch_sweep: MACRO ENDM const duty_cycle_pattern_cmd ; $de -duty_cycle_pattern: MACRO +MACRO duty_cycle_pattern db duty_cycle_pattern_cmd db (\1 << 6) | (\2 << 4) | (\3 << 2) | (\4 << 0) ; duty cycle pattern ENDM const toggle_sfx_cmd ; $df -toggle_sfx: MACRO +MACRO toggle_sfx db toggle_sfx_cmd ENDM const pitch_slide_cmd ; $e0 -pitch_slide: MACRO +MACRO pitch_slide db pitch_slide_cmd db \1 - 1 ; duration dn 8 - \2, \3 % 12 ; octave, pitch ENDM const vibrato_cmd ; $e1 -vibrato: MACRO +MACRO vibrato db vibrato_cmd db \1 ; delay if _NARG > 2 @@ -142,13 +142,13 @@ vibrato: MACRO ENDM const unknownmusic0xe2_cmd ; $e2 -unknownmusic0xe2: MACRO +MACRO unknownmusic0xe2 db unknownmusic0xe2_cmd db \1 ; unknown ENDM const toggle_noise_cmd ; $e3 -toggle_noise: MACRO +MACRO toggle_noise db toggle_noise_cmd if _NARG > 0 db \1 ; drum kit @@ -156,13 +156,13 @@ toggle_noise: MACRO ENDM const force_stereo_panning_cmd ; $e4 -force_stereo_panning: MACRO +MACRO force_stereo_panning db force_stereo_panning_cmd dn %1111 * (1 && \1), %1111 * (1 && \2) ; left enable, right enable ENDM const volume_cmd ; $e5 -volume: MACRO +MACRO volume db volume_cmd if _NARG > 1 dn \1, \2 ; left volume, right volume @@ -172,65 +172,65 @@ volume: MACRO ENDM const pitch_offset_cmd ; $e6 -pitch_offset: MACRO +MACRO pitch_offset db pitch_offset_cmd bigdw \1 ; pitch offset ENDM const unknownmusic0xe7_cmd ; $e7 -unknownmusic0xe7: MACRO +MACRO unknownmusic0xe7 db unknownmusic0xe7_cmd db \1 ; unknown ENDM const unknownmusic0xe8_cmd ; $e8 -unknownmusic0xe8: MACRO +MACRO unknownmusic0xe8 db unknownmusic0xe8_cmd db \1 ; unknown ENDM const tempo_relative_cmd ; $e9 -tempo_relative: MACRO +MACRO tempo_relative db tempo_relative_cmd bigdw \1 ; tempo adjustment ENDM const restart_channel_cmd ; $ea -restart_channel: MACRO +MACRO restart_channel db restart_channel_cmd dw \1 ; address ENDM const new_song_cmd ; $eb -new_song: MACRO +MACRO new_song db new_song_cmd bigdw \1 ; id ENDM const sfx_priority_on_cmd ; $ec -sfx_priority_on: MACRO +MACRO sfx_priority_on db sfx_priority_on_cmd ENDM const sfx_priority_off_cmd ; $ed -sfx_priority_off: MACRO +MACRO sfx_priority_off db sfx_priority_off_cmd ENDM const unknownmusic0xee_cmd ; $ee -unknownmusic0xee: MACRO +MACRO unknownmusic0xee db unknownmusic0xee_cmd dw \1 ; address ENDM const stereo_panning_cmd ; $ef -stereo_panning: MACRO +MACRO stereo_panning db stereo_panning_cmd dn %1111 * (1 && \1), %1111 * (1 && \2) ; left enable, right enable ENDM const sfx_toggle_noise_cmd ; $f0 -sfx_toggle_noise: MACRO +MACRO sfx_toggle_noise db sfx_toggle_noise_cmd if _NARG > 0 db \1 ; drum kit @@ -238,83 +238,83 @@ sfx_toggle_noise: MACRO ENDM const music0xf1_cmd ; $f1 -music0xf1: MACRO +MACRO music0xf1 db music0xf1_cmd ENDM const music0xf2_cmd ; $f2 -music0xf2: MACRO +MACRO music0xf2 db music0xf2_cmd ENDM const music0xf3_cmd ; $f3 -music0xf3: MACRO +MACRO music0xf3 db music0xf3_cmd ENDM const music0xf4_cmd ; $f4 -music0xf4: MACRO +MACRO music0xf4 db music0xf4_cmd ENDM const music0xf5_cmd ; $f5 -music0xf5: MACRO +MACRO music0xf5 db music0xf5_cmd ENDM const music0xf6_cmd ; $f6 -music0xf6: MACRO +MACRO music0xf6 db music0xf6_cmd ENDM const music0xf7_cmd ; $f7 -music0xf7: MACRO +MACRO music0xf7 db music0xf7_cmd ENDM const music0xf8_cmd ; $f8 -music0xf8: MACRO +MACRO music0xf8 db music0xf8_cmd ENDM const unknownmusic0xf9_cmd ; $f9 -unknownmusic0xf9: MACRO +MACRO unknownmusic0xf9 db unknownmusic0xf9_cmd ENDM const set_condition_cmd ; $fa -set_condition: MACRO +MACRO set_condition db set_condition_cmd db \1 ; condition ENDM const sound_jump_if_cmd ; $fb -sound_jump_if: MACRO +MACRO sound_jump_if db sound_jump_if_cmd db \1 ; condition dw \2 ; address ENDM const sound_jump_cmd ; $fc -sound_jump: MACRO +MACRO sound_jump db sound_jump_cmd dw \1 ; address ENDM const sound_loop_cmd ; $fd -sound_loop: MACRO +MACRO sound_loop db sound_loop_cmd db \1 ; count dw \2 ; address ENDM const sound_call_cmd ; $fe -sound_call: MACRO +MACRO sound_call db sound_call_cmd dw \1 ; address ENDM const sound_ret_cmd ; $ff -sound_ret: MACRO +MACRO sound_ret db sound_ret_cmd ENDM diff --git a/macros/scripts/battle_anims.asm b/macros/scripts/battle_anims.asm index 9754574f7..d944b5ec3 100644 --- a/macros/scripts/battle_anims.asm +++ b/macros/scripts/battle_anims.asm @@ -1,44 +1,44 @@ ; BattleAnimCommands indexes (see engine/battle_anims/anim_commands.asm) const_def $d0 -FIRST_BATTLE_ANIM_CMD EQU const_value +DEF FIRST_BATTLE_ANIM_CMD EQU const_value -anim_wait: MACRO +MACRO anim_wait assert (\1) < FIRST_BATTLE_ANIM_CMD, "anim_wait argument must be less than {FIRST_BATTLE_ANIM_CMD}" db \1 ENDM const anim_obj_command ; $d0 -anim_obj: MACRO +MACRO anim_obj db anim_obj_command -if _NARG <= 4 - db \1 ; object - db \2 ; x - db \3 ; y - db \4 ; param -else -; LEGACY: Support the tile+offset format - db \1 ; object - db (\2) * 8 + (\3) ; x_tile, x - db (\4) * 8 + (\5) ; y_tile, y - db \6 ; param -endc + if _NARG <= 4 + db \1 ; object + db \2 ; x + db \3 ; y + db \4 ; param + else + ; LEGACY: Support the tile+offset format + db \1 ; object + db (\2) * 8 + (\3) ; x_tile, x + db (\4) * 8 + (\5) ; y_tile, y + db \6 ; param + endc ENDM const anim_1gfx_command ; $d1 -anim_1gfx: MACRO +MACRO anim_1gfx db anim_1gfx_command db \1 ; gfx1 ENDM const anim_2gfx_command ; $d2 -anim_2gfx: MACRO +MACRO anim_2gfx db anim_2gfx_command db \1 ; gfx1 db \2 ; gfx2 ENDM const anim_3gfx_command ; $d3 -anim_3gfx: MACRO +MACRO anim_3gfx db anim_3gfx_command db \1 ; gfx1 db \2 ; gfx2 @@ -46,7 +46,7 @@ anim_3gfx: MACRO ENDM const anim_4gfx_command ; $d4 -anim_4gfx: MACRO +MACRO anim_4gfx db anim_4gfx_command db \1 ; gfx1 db \2 ; gfx2 @@ -55,7 +55,7 @@ anim_4gfx: MACRO ENDM const anim_5gfx_command ; $d5 -anim_5gfx: MACRO +MACRO anim_5gfx db anim_5gfx_command db \1 ; gfx1 db \2 ; gfx2 @@ -65,147 +65,147 @@ anim_5gfx: MACRO ENDM const anim_incobj_command ; $d6 -anim_incobj: MACRO +MACRO anim_incobj db anim_incobj_command db \1 ; object_id ENDM const anim_setobj_command ; $d7 -anim_setobj: MACRO +MACRO anim_setobj db anim_setobj_command db \1 ; object_id db \2 ; value ENDM const anim_incbgeffect_command ; $d8 -anim_incbgeffect: MACRO +MACRO anim_incbgeffect db anim_incbgeffect_command db \1 ; effect ENDM const anim_battlergfx_2row_command ; $d9 -anim_battlergfx_2row: MACRO +MACRO anim_battlergfx_2row db anim_battlergfx_2row_command ENDM const anim_battlergfx_1row_command ; $da -anim_battlergfx_1row: MACRO +MACRO anim_battlergfx_1row db anim_battlergfx_1row_command ENDM const anim_checkpokeball_command ; $db -anim_checkpokeball: MACRO +MACRO anim_checkpokeball db anim_checkpokeball_command ENDM const anim_transform_command ; $dc -anim_transform: MACRO +MACRO anim_transform db anim_transform_command ENDM const anim_raisesub_command ; $dd -anim_raisesub: MACRO +MACRO anim_raisesub db anim_raisesub_command ENDM const anim_dropsub_command ; $de -anim_dropsub: MACRO +MACRO anim_dropsub db anim_dropsub_command ENDM const anim_resetobp0_command ; $df -anim_resetobp0: MACRO +MACRO anim_resetobp0 db anim_resetobp0_command ENDM const anim_sound_command ; $e0 -anim_sound: MACRO +MACRO anim_sound db anim_sound_command db (\1 << 2) | \2 ; duration, tracks db \3 ; sound_id ENDM const anim_cry_command ; $e1 -anim_cry: MACRO +MACRO anim_cry db anim_cry_command db \1 ; pitch ENDM const anim_minimizeopp_command ; $e2 -anim_minimizeopp: MACRO +MACRO anim_minimizeopp db anim_minimizeopp_command ENDM const anim_oamon_command ; $e3 -anim_oamon: MACRO +MACRO anim_oamon db anim_oamon_command ENDM const anim_oamoff_command ; $e4 -anim_oamoff: MACRO +MACRO anim_oamoff db anim_oamoff_command ENDM const anim_clearobjs_command ; $e5 -anim_clearobjs: MACRO +MACRO anim_clearobjs db anim_clearobjs_command ENDM const anim_beatup_command ; $e6 -anim_beatup: MACRO +MACRO anim_beatup db anim_beatup_command ENDM const anim_0xe7_command ; $e7 -anim_0xe7: MACRO +MACRO anim_0xe7 db anim_0xe7_command ENDM const anim_updateactorpic_command ; $e8 -anim_updateactorpic: MACRO +MACRO anim_updateactorpic db anim_updateactorpic_command ENDM const anim_minimize_command ; $e9 -anim_minimize: MACRO +MACRO anim_minimize db anim_minimize_command ENDM const anim_0xea_command ; $ea -anim_0xea: MACRO +MACRO anim_0xea db anim_0xea_command ENDM const anim_0xeb_command ; $eb -anim_0xeb: MACRO +MACRO anim_0xeb db anim_0xeb_command ENDM const anim_0xec_command ; $ec -anim_0xec: MACRO +MACRO anim_0xec db anim_0xec_command ENDM const anim_0xed_command ; $ed -anim_0xed: MACRO +MACRO anim_0xed db anim_0xed_command ENDM const anim_if_param_and_command ; $ee -anim_if_param_and: MACRO +MACRO anim_if_param_and db anim_if_param_and_command db \1 ; value dw \2 ; address ENDM const anim_jumpuntil_command ; $ef -anim_jumpuntil: MACRO +MACRO anim_jumpuntil db anim_jumpuntil_command dw \1 ; address ENDM const anim_bgeffect_command ; $f0 -anim_bgeffect: MACRO +MACRO anim_bgeffect db anim_bgeffect_command db \1 ; effect db \2 ; jumptable index @@ -214,88 +214,88 @@ anim_bgeffect: MACRO ENDM const anim_bgp_command ; $f1 -anim_bgp: MACRO +MACRO anim_bgp db anim_bgp_command db \1 ; colors ENDM const anim_obp0_command ; $f2 -anim_obp0: MACRO +MACRO anim_obp0 db anim_obp0_command db \1 ; colors ENDM const anim_obp1_command ; $f3 -anim_obp1: MACRO +MACRO anim_obp1 db anim_obp1_command db \1 ; colors ENDM const anim_keepsprites_command ; $f4 -anim_keepsprites: MACRO +MACRO anim_keepsprites db anim_keepsprites_command ENDM const anim_0xf5_command ; $f5 -anim_0xf5: MACRO +MACRO anim_0xf5 db anim_0xf5_command ENDM const anim_0xf6_command ; $f6 -anim_0xf6: MACRO +MACRO anim_0xf6 db anim_0xf6_command ENDM const anim_0xf7_command ; $f7 -anim_0xf7: MACRO +MACRO anim_0xf7 db anim_0xf7_command ENDM const anim_if_param_equal_command ; $f8 -anim_if_param_equal: MACRO +MACRO anim_if_param_equal db anim_if_param_equal_command db \1 ; value dw \2 ; address ENDM const anim_setvar_command ; $f9 -anim_setvar: MACRO +MACRO anim_setvar db anim_setvar_command db \1 ; value ENDM const anim_incvar_command ; $fa -anim_incvar: MACRO +MACRO anim_incvar db anim_incvar_command ENDM const anim_if_var_equal_command ; $fb -anim_if_var_equal: MACRO +MACRO anim_if_var_equal db anim_if_var_equal_command db \1 ; value dw \2 ; address ENDM const anim_jump_command ; $fc -anim_jump: MACRO +MACRO anim_jump db anim_jump_command dw \1 ; address ENDM const anim_loop_command ; $fd -anim_loop: MACRO +MACRO anim_loop db anim_loop_command db \1 ; count dw \2 ; address ENDM const anim_call_command ; $fe -anim_call: MACRO +MACRO anim_call db anim_call_command dw \1 ; address ENDM const anim_ret_command ; $ff -anim_ret: MACRO +MACRO anim_ret db anim_ret_command ENDM diff --git a/macros/scripts/battle_commands.asm b/macros/scripts/battle_commands.asm index 3e5046154..180ff8575 100644 --- a/macros/scripts/battle_commands.asm +++ b/macros/scripts/battle_commands.asm @@ -1,6 +1,6 @@ -command: MACRO +MACRO command const \1_command -\1 EQUS "db \1_command" + DEF \1 EQUS "db \1_command" ENDM ; BattleCommandPointers indexes (see data/battle/effect_command_pointers.asm) @@ -180,7 +180,7 @@ ENDM command supereffectivelooptext ; ad command startloop ; ae command curl ; af -NUM_EFFECT_COMMANDS EQU const_value - 1 +DEF NUM_EFFECT_COMMANDS EQU const_value - 1 const_def -1, -1 command endmove ; ff diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm index c260a3a81..f22df1827 100644 --- a/macros/scripts/events.asm +++ b/macros/scripts/events.asm @@ -2,405 +2,405 @@ const_def const scall_command ; $00 -scall: MACRO +MACRO scall db scall_command dw \1 ; pointer ENDM const farscall_command ; $01 -farscall: MACRO +MACRO farscall db farscall_command dba \1 ENDM const memcall_command ; $02 -memcall: MACRO +MACRO memcall db memcall_command dw \1 ; pointer ENDM const sjump_command ; $03 -sjump: MACRO +MACRO sjump db sjump_command dw \1 ; pointer ENDM const farsjump_command ; $04 -farsjump: MACRO +MACRO farsjump db farsjump_command dba \1 ENDM const memjump_command ; $05 -memjump: MACRO +MACRO memjump db memjump_command dw \1 ; pointer ENDM const ifequal_command ; $06 -ifequal: MACRO +MACRO ifequal db ifequal_command db \1 ; byte dw \2 ; pointer ENDM const ifnotequal_command ; $07 -ifnotequal: MACRO +MACRO ifnotequal db ifnotequal_command db \1 ; byte dw \2 ; pointer ENDM const iffalse_command ; $08 -iffalse: MACRO +MACRO iffalse db iffalse_command dw \1 ; pointer ENDM const iftrue_command ; $09 -iftrue: MACRO +MACRO iftrue db iftrue_command dw \1 ; pointer ENDM const ifgreater_command ; $0a -ifgreater: MACRO +MACRO ifgreater db ifgreater_command db \1 ; byte dw \2 ; pointer ENDM const ifless_command ; $0b -ifless: MACRO +MACRO ifless db ifless_command db \1 ; byte dw \2 ; pointer ENDM const jumpstd_command ; $0c -jumpstd: MACRO +MACRO jumpstd db jumpstd_command dw (\1StdScript - StdScripts) / 3 ENDM const callstd_command ; $0d -callstd: MACRO +MACRO callstd db callstd_command dw (\1StdScript - StdScripts) / 3 ENDM const callasm_command ; $0e -callasm: MACRO +MACRO callasm db callasm_command dba \1 ENDM const special_command ; $0f -special: MACRO +MACRO special db special_command dw (\1Special - SpecialsPointers) / 3 ENDM const memcallasm_command ; $10 -memcallasm: MACRO +MACRO memcallasm db memcallasm_command dw \1 ; asm ENDM const checkmapscene_command ; $11 -checkmapscene: MACRO +MACRO checkmapscene db checkmapscene_command map_id \1 ; map ENDM const setmapscene_command ; $12 -setmapscene: MACRO +MACRO setmapscene db setmapscene_command map_id \1 ; map db \2 ; scene_id ENDM const checkscene_command ; $13 -checkscene: MACRO +MACRO checkscene db checkscene_command ENDM const setscene_command ; $14 -setscene: MACRO +MACRO setscene db setscene_command db \1 ; scene_id ENDM const setval_command ; $15 -setval: MACRO +MACRO setval db setval_command db \1 ; value ENDM const addval_command ; $16 -addval: MACRO +MACRO addval db addval_command db \1 ; value ENDM const random_command ; $17 -random: MACRO +MACRO random db random_command db \1 ; input ENDM const checkver_command ; $18 -checkver: MACRO +MACRO checkver db checkver_command ENDM const readmem_command ; $19 -readmem: MACRO +MACRO readmem db readmem_command dw \1 ; address ENDM const writemem_command ; $1a -writemem: MACRO +MACRO writemem db writemem_command dw \1 ; address ENDM const loadmem_command ; $1b -loadmem: MACRO +MACRO loadmem db loadmem_command dw \1 ; address db \2 ; value ENDM const readvar_command ; $1c -readvar: MACRO +MACRO readvar db readvar_command db \1 ; variable_id ENDM const writevar_command ; $1d -writevar: MACRO +MACRO writevar db writevar_command db \1 ; variable_id ENDM const loadvar_command ; $1e -loadvar: MACRO -if STRIN("\1", "VAR_") != 1 -; LEGACY: Support for the old name of "loadmem" - loadmem \1, \2 -else - db loadvar_command - db \1 ; variable_id - db \2 ; value -endc +MACRO loadvar + if STRIN("\1", "VAR_") != 1 + ; LEGACY: Support for the old name of "loadmem" + loadmem \1, \2 + else + db loadvar_command + db \1 ; variable_id + db \2 ; value + endc ENDM const giveitem_command ; $1f -giveitem: MACRO -if _NARG == 1 - giveitem \1, 1 -else - db giveitem_command - db \1 ; item - db \2 ; quantity -endc +MACRO giveitem + if _NARG == 1 + giveitem \1, 1 + else + db giveitem_command + db \1 ; item + db \2 ; quantity + endc ENDM const takeitem_command ; $20 -takeitem: MACRO -if _NARG == 1 - takeitem \1, 1 -else - db takeitem_command - db \1 ; item - db \2 ; quantity -endc +MACRO takeitem + if _NARG == 1 + takeitem \1, 1 + else + db takeitem_command + db \1 ; item + db \2 ; quantity + endc ENDM const checkitem_command ; $21 -checkitem: MACRO +MACRO checkitem db checkitem_command db \1 ; item ENDM const givemoney_command ; $22 -givemoney: MACRO +MACRO givemoney db givemoney_command db \1 ; account dt \2 ; money ENDM const takemoney_command ; $23 -takemoney: MACRO +MACRO takemoney db takemoney_command db \1 ; account dt \2 ; money ENDM const checkmoney_command ; $24 -checkmoney: MACRO +MACRO checkmoney db checkmoney_command db \1 ; account dt \2 ; money ENDM const givecoins_command ; $25 -givecoins: MACRO +MACRO givecoins db givecoins_command dw \1 ; coins ENDM const takecoins_command ; $26 -takecoins: MACRO +MACRO takecoins db takecoins_command dw \1 ; coins ENDM const checkcoins_command ; $27 -checkcoins: MACRO +MACRO checkcoins db checkcoins_command dw \1 ; coins ENDM const addcellnum_command ; $28 -addcellnum: MACRO +MACRO addcellnum db addcellnum_command db \1 ; person ENDM const delcellnum_command ; $29 -delcellnum: MACRO +MACRO delcellnum db delcellnum_command db \1 ; person ENDM const checkcellnum_command ; $2a -checkcellnum: MACRO +MACRO checkcellnum db checkcellnum_command db \1 ; person ENDM const checktime_command ; $2b -checktime: MACRO +MACRO checktime db checktime_command db \1 ; time ENDM const checkpoke_command ; $2c -checkpoke: MACRO +MACRO checkpoke db checkpoke_command db \1 ; pkmn ENDM const givepoke_command ; $2d -givepoke: MACRO -if _NARG == 2 - givepoke \1, \2, NO_ITEM, FALSE -elif _NARG == 3 - givepoke \1, \2, \3, FALSE -elif _NARG == 5 - givepoke \1, \2, \3, TRUE, \4, \5 -else - db givepoke_command - db \1 ; pokemon - db \2 ; level - db \3 ; item - db \4 ; trainer -if \4 - dw \5 ; nickname_pointer - dw \6 ; ot_name_pointer -endc -endc +MACRO givepoke + if _NARG == 2 + givepoke \1, \2, NO_ITEM, FALSE + elif _NARG == 3 + givepoke \1, \2, \3, FALSE + elif _NARG == 5 + givepoke \1, \2, \3, TRUE, \4, \5 + else + db givepoke_command + db \1 ; pokemon + db \2 ; level + db \3 ; item + db \4 ; trainer + if \4 + dw \5 ; nickname_pointer + dw \6 ; ot_name_pointer + endc + endc ENDM const giveegg_command ; $2e -giveegg: MACRO +MACRO giveegg db giveegg_command db \1 ; pkmn db \2 ; level ENDM const givepokemail_command ; $2f -givepokemail: MACRO +MACRO givepokemail db givepokemail_command dw \1 ; pointer ENDM const checkpokemail_command ; $30 -checkpokemail: MACRO +MACRO checkpokemail db checkpokemail_command dw \1 ; pointer ENDM const checkevent_command ; $31 -checkevent: MACRO +MACRO checkevent db checkevent_command dw \1 ; event_flag ENDM const clearevent_command ; $32 -clearevent: MACRO +MACRO clearevent db clearevent_command dw \1 ; event_flag ENDM const setevent_command ; $33 -setevent: MACRO +MACRO setevent db setevent_command dw \1 ; event_flag ENDM const checkflag_command ; $34 -checkflag: MACRO +MACRO checkflag db checkflag_command dw \1 ; engine_flag ENDM const clearflag_command ; $35 -clearflag: MACRO +MACRO clearflag db clearflag_command dw \1 ; engine_flag ENDM const setflag_command ; $36 -setflag: MACRO +MACRO setflag db setflag_command dw \1 ; engine_flag ENDM const wildon_command ; $37 -wildon: MACRO +MACRO wildon db wildon_command ENDM const wildoff_command ; $38 -wildoff: MACRO +MACRO wildoff db wildoff_command ENDM const xycompare_command ; $39 -xycompare: MACRO +MACRO xycompare db xycompare_command dw \1 ; pointer ENDM const warpmod_command ; $3a -warpmod: MACRO +MACRO warpmod db warpmod_command db \1 ; warp_id map_id \2 ; map ENDM const blackoutmod_command ; $3b -blackoutmod: MACRO +MACRO blackoutmod db blackoutmod_command map_id \1 ; map ENDM const warp_command ; $3c -warp: MACRO +MACRO warp db warp_command map_id \1 ; map db \2 ; x @@ -408,46 +408,46 @@ warp: MACRO ENDM const getmoney_command ; $3d -getmoney: MACRO +MACRO getmoney db getmoney_command db \2 ; account db \1 ; string_buffer ENDM const getcoins_command ; $3e -getcoins: MACRO +MACRO getcoins db getcoins_command db \1 ; string_buffer ENDM const getnum_command ; $3f -getnum: MACRO +MACRO getnum db getnum_command db \1 ; string_buffer ENDM const getmonname_command ; $40 -getmonname: MACRO +MACRO getmonname db getmonname_command db \2 ; pokemon db \1 ; string_buffer ENDM const getitemname_command ; $41 -getitemname: MACRO +MACRO getitemname db getitemname_command db \2 ; item db \1 ; string_buffer ENDM const getcurlandmarkname_command ; $42 -getcurlandmarkname: MACRO +MACRO getcurlandmarkname db getcurlandmarkname_command db \1 ; string_buffer ENDM const gettrainername_command ; $43 -gettrainername: MACRO +MACRO gettrainername db gettrainername_command db \2 ; trainer_group db \3 ; trainer_id @@ -455,275 +455,275 @@ gettrainername: MACRO ENDM const getstring_command ; $44 -getstring: MACRO +MACRO getstring db getstring_command dw \2 ; text_pointer db \1 ; string_buffer ENDM const itemnotify_command ; $45 -itemnotify: MACRO +MACRO itemnotify db itemnotify_command ENDM const pocketisfull_command ; $46 -pocketisfull: MACRO +MACRO pocketisfull db pocketisfull_command ENDM const opentext_command ; $47 -opentext: MACRO +MACRO opentext db opentext_command ENDM const refreshscreen_command ; $48 -refreshscreen: MACRO -if _NARG == 0 - refreshscreen 0 -else - db refreshscreen_command - db \1 ; dummy -endc +MACRO refreshscreen + if _NARG == 0 + refreshscreen 0 + else + db refreshscreen_command + db \1 ; dummy + endc ENDM const closetext_command ; $49 -closetext: MACRO +MACRO closetext db closetext_command ENDM const writeunusedbyte_command ; $4a -writeunusedbyte: MACRO +MACRO writeunusedbyte db writeunusedbyte_command db \1 ; byte ENDM const farwritetext_command ; $4b -farwritetext: MACRO +MACRO farwritetext db farwritetext_command dba \1 ENDM const writetext_command ; $4c -writetext: MACRO +MACRO writetext db writetext_command dw \1 ; text_pointer ENDM const repeattext_command ; $4d -repeattext: MACRO +MACRO repeattext db repeattext_command db \1 ; byte db \2 ; byte ENDM const yesorno_command ; $4e -yesorno: MACRO +MACRO yesorno db yesorno_command ENDM const loadmenu_command ; $4f -loadmenu: MACRO +MACRO loadmenu db loadmenu_command dw \1 ; menu_header ENDM const closewindow_command ; $50 -closewindow: MACRO +MACRO closewindow db closewindow_command ENDM const jumptextfaceplayer_command ; $51 -jumptextfaceplayer: MACRO +MACRO jumptextfaceplayer db jumptextfaceplayer_command dw \1 ; text_pointer ENDM const farjumptext_command ; $52 -farjumptext: MACRO +MACRO farjumptext db farjumptext_command dba \1 ENDM const jumptext_command ; $53 -jumptext: MACRO +MACRO jumptext db jumptext_command dw \1 ; text_pointer ENDM const waitbutton_command ; $54 -waitbutton: MACRO +MACRO waitbutton db waitbutton_command ENDM const promptbutton_command ; $55 -promptbutton: MACRO +MACRO promptbutton db promptbutton_command ENDM const pokepic_command ; $56 -pokepic: MACRO +MACRO pokepic db pokepic_command db \1 ; pokemon ENDM const closepokepic_command ; $57 -closepokepic: MACRO +MACRO closepokepic db closepokepic_command ENDM const _2dmenu_command ; $58 -_2dmenu: MACRO +MACRO _2dmenu db _2dmenu_command ENDM const verticalmenu_command ; $59 -verticalmenu: MACRO +MACRO verticalmenu db verticalmenu_command ENDM const loadpikachudata_command ; $5a -loadpikachudata: MACRO +MACRO loadpikachudata db loadpikachudata_command ENDM const randomwildmon_command ; $5b -randomwildmon: MACRO +MACRO randomwildmon db randomwildmon_command ENDM const loadtemptrainer_command ; $5c -loadtemptrainer: MACRO +MACRO loadtemptrainer db loadtemptrainer_command ENDM const loadwildmon_command ; $5d -loadwildmon: MACRO +MACRO loadwildmon db loadwildmon_command db \1 ; pokemon db \2 ; level ENDM const loadtrainer_command ; $5e -loadtrainer: MACRO +MACRO loadtrainer db loadtrainer_command db \1 ; trainer_group db \2 ; trainer_id ENDM const startbattle_command ; $5f -startbattle: MACRO +MACRO startbattle db startbattle_command ENDM const reloadmapafterbattle_command ; $60 -reloadmapafterbattle: MACRO +MACRO reloadmapafterbattle db reloadmapafterbattle_command ENDM const catchtutorial_command ; $61 -catchtutorial: MACRO +MACRO catchtutorial db catchtutorial_command db \1 ; byte ENDM const trainertext_command ; $62 -trainertext: MACRO +MACRO trainertext db trainertext_command db \1 ; text_id ENDM const trainerflagaction_command ; $63 -trainerflagaction: MACRO +MACRO trainerflagaction db trainerflagaction_command db \1 ; action ENDM const winlosstext_command ; $64 -winlosstext: MACRO +MACRO winlosstext db winlosstext_command dw \1 ; win_text_pointer dw \2 ; loss_text_pointer ENDM const scripttalkafter_command ; $65 -scripttalkafter: MACRO +MACRO scripttalkafter db scripttalkafter_command ENDM const endifjustbattled_command ; $66 -endifjustbattled: MACRO +MACRO endifjustbattled db endifjustbattled_command ENDM const checkjustbattled_command ; $67 -checkjustbattled: MACRO +MACRO checkjustbattled db checkjustbattled_command ENDM const setlasttalked_command ; $68 -setlasttalked: MACRO +MACRO setlasttalked db setlasttalked_command db \1 ; object id ENDM const applymovement_command ; $69 -applymovement: MACRO +MACRO applymovement db applymovement_command db \1 ; object id dw \2 ; data ENDM const applymovementlasttalked_command ; $6a -applymovementlasttalked: MACRO +MACRO applymovementlasttalked db applymovementlasttalked_command dw \1 ; data ENDM const faceplayer_command ; $6b -faceplayer: MACRO +MACRO faceplayer db faceplayer_command ENDM const faceobject_command ; $6c -faceobject: MACRO +MACRO faceobject db faceobject_command db \1 ; object1 db \2 ; object2 ENDM const variablesprite_command ; $6d -variablesprite: MACRO +MACRO variablesprite db variablesprite_command db \1 - SPRITE_VARS ; byte db \2 ; sprite ENDM const disappear_command ; $6e -disappear: MACRO +MACRO disappear db disappear_command db \1 ; object id ENDM const appear_command ; $6f -appear: MACRO +MACRO appear db appear_command db \1 ; object id ENDM const follow_command ; $70 -follow: MACRO +MACRO follow db follow_command db \1 ; object2 db \2 ; object1 ENDM const stopfollow_command ; $71 -stopfollow: MACRO +MACRO stopfollow db stopfollow_command ENDM const moveobject_command ; $72 -moveobject: MACRO +MACRO moveobject db moveobject_command db \1 ; object id db \2 ; x @@ -731,19 +731,19 @@ moveobject: MACRO ENDM const writeobjectxy_command ; $73 -writeobjectxy: MACRO +MACRO writeobjectxy db writeobjectxy_command db \1 ; object id ENDM const loademote_command ; $74 -loademote: MACRO +MACRO loademote db loademote_command db \1 ; bubble ENDM const showemote_command ; $75 -showemote: MACRO +MACRO showemote db showemote_command db \1 ; bubble db \2 ; object id @@ -751,33 +751,33 @@ showemote: MACRO ENDM const turnobject_command ; $76 -turnobject: MACRO +MACRO turnobject db turnobject_command db \1 ; object id db \2 ; facing ENDM const follownotexact_command ; $77 -follownotexact: MACRO +MACRO follownotexact db follownotexact_command db \1 ; object2 db \2 ; object1 ENDM const earthquake_command ; $78 -earthquake: MACRO +MACRO earthquake db earthquake_command db \1 ; param ENDM const changemapblocks_command ; $79 -changemapblocks: MACRO +MACRO changemapblocks db changemapblocks_command dba \1 ; map_data_pointer ENDM const changeblock_command ; $7a -changeblock: MACRO +MACRO changeblock db changeblock_command db \1 ; x db \2 ; y @@ -785,240 +785,240 @@ changeblock: MACRO ENDM const reloadmap_command ; $7b -reloadmap: MACRO +MACRO reloadmap db reloadmap_command ENDM const reloadmappart_command ; $7c -reloadmappart: MACRO +MACRO reloadmappart db reloadmappart_command ENDM const writecmdqueue_command ; $7d -writecmdqueue: MACRO +MACRO writecmdqueue db writecmdqueue_command dw \1 ; queue_pointer ENDM const delcmdqueue_command ; $7e -delcmdqueue: MACRO +MACRO delcmdqueue db delcmdqueue_command db \1 ; byte ENDM const playmusic_command ; $7f -playmusic: MACRO +MACRO playmusic db playmusic_command dw \1 ; music_pointer ENDM const encountermusic_command ; $80 -encountermusic: MACRO +MACRO encountermusic db encountermusic_command ENDM const musicfadeout_command ; $81 -musicfadeout: MACRO +MACRO musicfadeout db musicfadeout_command dw \1 ; music db \2 ; fadetime ENDM const playmapmusic_command ; $82 -playmapmusic: MACRO +MACRO playmapmusic db playmapmusic_command ENDM const dontrestartmapmusic_command ; $83 -dontrestartmapmusic: MACRO +MACRO dontrestartmapmusic db dontrestartmapmusic_command ENDM const cry_command ; $84 -cry: MACRO +MACRO cry db cry_command dw \1 ; cry_id ENDM const playsound_command ; $85 -playsound: MACRO +MACRO playsound db playsound_command dw \1 ; sound_pointer ENDM const waitsfx_command ; $86 -waitsfx: MACRO +MACRO waitsfx db waitsfx_command ENDM const warpsound_command ; $87 -warpsound: MACRO +MACRO warpsound db warpsound_command ENDM const specialsound_command ; $88 -specialsound: MACRO +MACRO specialsound db specialsound_command ENDM const autoinput_command ; $89 -autoinput: MACRO +MACRO autoinput db autoinput_command dba \1 ENDM const newloadmap_command ; $8a -newloadmap: MACRO +MACRO newloadmap db newloadmap_command db \1 ; which_method ENDM const pause_command ; $8b -pause: MACRO +MACRO pause db pause_command db \1 ; length ENDM const deactivatefacing_command ; $8c -deactivatefacing: MACRO +MACRO deactivatefacing db deactivatefacing_command db \1 ; time ENDM const sdefer_command ; $8d -sdefer: MACRO +MACRO sdefer db sdefer_command dw \1 ; pointer ENDM const warpcheck_command ; $8e -warpcheck: MACRO +MACRO warpcheck db warpcheck_command ENDM const stopandsjump_command ; $8f -stopandsjump: MACRO +MACRO stopandsjump db stopandsjump_command dw \1 ; pointer ENDM const endcallback_command ; $90 -endcallback: MACRO +MACRO endcallback db endcallback_command ENDM const end_command ; $91 -end: MACRO +MACRO end db end_command ENDM const reloadend_command ; $92 -reloadend: MACRO +MACRO reloadend db reloadend_command db \1 ; which_method ENDM const endall_command ; $93 -endall: MACRO +MACRO endall db endall_command ENDM const pokemart_command ; $94 -pokemart: MACRO +MACRO pokemart db pokemart_command db \1 ; dialog_id dw \2 ; mart_id ENDM const elevator_command ; $95 -elevator: MACRO +MACRO elevator db elevator_command dw \1 ; floor_list_pointer ENDM const trade_command ; $96 -trade: MACRO +MACRO trade db trade_command db \1 ; trade_id ENDM const askforphonenumber_command ; $97 -askforphonenumber: MACRO +MACRO askforphonenumber db askforphonenumber_command db \1 ; number ENDM const phonecall_command ; $98 -phonecall: MACRO +MACRO phonecall db phonecall_command dw \1 ; caller_name ENDM const hangup_command ; $99 -hangup: MACRO +MACRO hangup db hangup_command ENDM const describedecoration_command ; $9a -describedecoration: MACRO +MACRO describedecoration db describedecoration_command db \1 ; byte ENDM const fruittree_command ; $9b -fruittree: MACRO +MACRO fruittree db fruittree_command db \1 ; tree_id ENDM const specialphonecall_command ; $9c -specialphonecall: MACRO +MACRO specialphonecall db specialphonecall_command dw \1 ; call_id ENDM const checkphonecall_command ; $9d -checkphonecall: MACRO +MACRO checkphonecall db checkphonecall_command ENDM const verbosegiveitem_command ; $9e -verbosegiveitem: MACRO -if _NARG == 1 - verbosegiveitem \1, 1 -else - db verbosegiveitem_command - db \1 ; item - db \2 ; quantity -endc +MACRO verbosegiveitem + if _NARG == 1 + verbosegiveitem \1, 1 + else + db verbosegiveitem_command + db \1 ; item + db \2 ; quantity + endc ENDM const verbosegiveitemvar_command ; $9f -verbosegiveitemvar: MACRO +MACRO verbosegiveitemvar db verbosegiveitemvar_command db \1 ; item db \2 ; var ENDM const swarm_command ; $a0 -swarm: MACRO +MACRO swarm db swarm_command db \1 ; flag map_id \2 ; map ENDM const halloffame_command ; $a1 -halloffame: MACRO +MACRO halloffame db halloffame_command ENDM const credits_command ; $a2 -credits: MACRO +MACRO credits db credits_command ENDM const warpfacing_command ; $a3 -warpfacing: MACRO +MACRO warpfacing db warpfacing_command db \1 ; facing map_id \2 ; map @@ -1027,27 +1027,27 @@ warpfacing: MACRO ENDM const battletowertext_command ; $a4 -battletowertext: MACRO +MACRO battletowertext db battletowertext_command db \1 ; bttext_id ENDM const getlandmarkname_command ; $a5 -getlandmarkname: MACRO +MACRO getlandmarkname db getlandmarkname_command db \2 ; landmark_id db \1 ; string_buffer ENDM const gettrainerclassname_command ; $a6 -gettrainerclassname: MACRO +MACRO gettrainerclassname db gettrainerclassname_command db \2 ; trainer_group db \1 ; string_buffer ENDM const getname_command ; $a7 -getname: MACRO +MACRO getname db getname_command db \2 ; type db \3 ; id @@ -1055,14 +1055,14 @@ getname: MACRO ENDM const wait_command ; $a8 -wait: MACRO +MACRO wait db wait_command db \1 ; duration ENDM const checksave_command ; $a9 -checksave: MACRO +MACRO checksave db checksave_command ENDM -NUM_EVENT_COMMANDS EQU const_value +DEF NUM_EVENT_COMMANDS EQU const_value diff --git a/macros/scripts/gfx_anims.asm b/macros/scripts/gfx_anims.asm index 2c4c267b3..f3086046f 100644 --- a/macros/scripts/gfx_anims.asm +++ b/macros/scripts/gfx_anims.asm @@ -1,37 +1,37 @@ ; pic + oam animations -frame: MACRO +MACRO frame db \1 -x = \2 -if _NARG > 2 -rept _NARG - 2 -x |= 1 << (\3 + 1) - shift -endr -endc + DEF x = \2 + if _NARG > 2 + rept _NARG - 2 + DEF x |= 1 << (\3 + 1) + shift + endr + endc db x ENDM const_def -1, -1 const endanim_command ; $ff -endanim: MACRO +MACRO endanim db endanim_command ENDM const dorestart_command ; $fe -dorestart: MACRO +MACRO dorestart db dorestart_command ENDM const dowait_command ; $fd -dowait: MACRO +MACRO dowait db dowait_command db \1 ; frames ENDM const delanim_command ; $fc -delanim: MACRO +MACRO delanim ; Removes the object from the screen, as opposed to `endanim` which just stops all motion db delanim_command ENDM @@ -41,13 +41,13 @@ ENDM const_def -2, -1 const setrepeat_command ; $fe -setrepeat: MACRO +MACRO setrepeat db setrepeat_command db \1 ; amount of times to repeat ENDM const dorepeat_command ; $fd -dorepeat: MACRO +MACRO dorepeat db dorepeat_command db \1 ; command offset to jump to ENDM diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index 0621277ba..33b22d59a 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -1,61 +1,61 @@ -map_id: MACRO +MACRO map_id ;\1: map id assert DEF(GROUP_\1) && DEF(MAP_\1), \ "Missing 'map_const \1' in constants/map_constants.asm" db GROUP_\1, MAP_\1 ENDM -object_const_def EQUS "const_def 2" +DEF object_const_def EQUS "const_def 2" -def_scene_scripts: MACRO -REDEF _NUM_SCENE_SCRIPTS EQUS "_NUM_SCENE_SCRIPTS_\@" +MACRO def_scene_scripts + REDEF _NUM_SCENE_SCRIPTS EQUS "_NUM_SCENE_SCRIPTS_\@" db {_NUM_SCENE_SCRIPTS} -{_NUM_SCENE_SCRIPTS} = 0 + DEF {_NUM_SCENE_SCRIPTS} = 0 ENDM -scene_script: MACRO +MACRO scene_script ;\1: script pointer dw \1 dw 0 ; filler -{_NUM_SCENE_SCRIPTS} += 1 + DEF {_NUM_SCENE_SCRIPTS} += 1 ENDM -def_callbacks: MACRO -REDEF _NUM_CALLBACKS EQUS "_NUM_CALLBACKS_\@" +MACRO def_callbacks + REDEF _NUM_CALLBACKS EQUS "_NUM_CALLBACKS_\@" db {_NUM_CALLBACKS} -{_NUM_CALLBACKS} = 0 + DEF {_NUM_CALLBACKS} = 0 ENDM -callback: MACRO +MACRO callback ;\1: type: a MAPCALLBACK_* constant ;\2: script pointer dbw \1, \2 -{_NUM_CALLBACKS} += 1 + DEF {_NUM_CALLBACKS} += 1 ENDM -def_warp_events: MACRO -REDEF _NUM_WARP_EVENTS EQUS "_NUM_WARP_EVENTS_\@" +MACRO def_warp_events + REDEF _NUM_WARP_EVENTS EQUS "_NUM_WARP_EVENTS_\@" db {_NUM_WARP_EVENTS} -{_NUM_WARP_EVENTS} = 0 + DEF {_NUM_WARP_EVENTS} = 0 ENDM -warp_event: MACRO +MACRO warp_event ;\1: x: left to right, starts at 0 ;\2: y: top to bottom, starts at 0 ;\3: map id: from constants/map_constants.asm ;\4: warp destination: starts at 1 db \2, \1, \4 map_id \3 -{_NUM_WARP_EVENTS} += 1 + DEF {_NUM_WARP_EVENTS} += 1 ENDM -def_coord_events: MACRO -REDEF _NUM_COORD_EVENTS EQUS "_NUM_COORD_EVENTS_\@" +MACRO def_coord_events + REDEF _NUM_COORD_EVENTS EQUS "_NUM_COORD_EVENTS_\@" db {_NUM_COORD_EVENTS} -{_NUM_COORD_EVENTS} = 0 + DEF {_NUM_COORD_EVENTS} = 0 ENDM -coord_event: MACRO +MACRO coord_event ;\1: x: left to right, starts at 0 ;\2: y: top to bottom, starts at 0 ;\3: scene id: a SCENE_* constant; controlled by setscene/setmapscene @@ -64,32 +64,32 @@ coord_event: MACRO db 0 ; filler dw \4 dw 0 ; filler -{_NUM_COORD_EVENTS} += 1 + DEF {_NUM_COORD_EVENTS} += 1 ENDM -def_bg_events: MACRO -REDEF _NUM_BG_EVENTS EQUS "_NUM_BG_EVENTS_\@" +MACRO def_bg_events + REDEF _NUM_BG_EVENTS EQUS "_NUM_BG_EVENTS_\@" db {_NUM_BG_EVENTS} -{_NUM_BG_EVENTS} = 0 + DEF {_NUM_BG_EVENTS} = 0 ENDM -bg_event: MACRO +MACRO bg_event ;\1: x: left to right, starts at 0 ;\2: y: top to bottom, starts at 0 ;\3: function: a BGEVENT_* constant ;\4: script pointer db \2, \1, \3 dw \4 -{_NUM_BG_EVENTS} += 1 + DEF {_NUM_BG_EVENTS} += 1 ENDM -def_object_events: MACRO -REDEF _NUM_OBJECT_EVENTS EQUS "_NUM_OBJECT_EVENTS_\@" +MACRO def_object_events + REDEF _NUM_OBJECT_EVENTS EQUS "_NUM_OBJECT_EVENTS_\@" db {_NUM_OBJECT_EVENTS} -{_NUM_OBJECT_EVENTS} = 0 + DEF {_NUM_OBJECT_EVENTS} = 0 ENDM -object_event: MACRO +MACRO object_event ;\1: x: left to right, starts at 0 ;\2: y: top to bottom, starts at 0 ;\3: sprite: a SPRITE_* constant @@ -112,13 +112,13 @@ object_event: MACRO dn \9, \<10> db \<11> dw \<12>, \<13> -; the dummy PlayerObjectTemplate object_event has no def_object_events -if DEF(_NUM_OBJECT_EVENTS) -{_NUM_OBJECT_EVENTS} += 1 -endc + ; the dummy PlayerObjectTemplate object_event has no def_object_events + if DEF(_NUM_OBJECT_EVENTS) + DEF {_NUM_OBJECT_EVENTS} += 1 + endc ENDM -trainer: MACRO +MACRO trainer ;\1: trainer group ;\2: trainer id ;\3: flag: an EVENT_BEAT_* constant @@ -131,23 +131,23 @@ trainer: MACRO dw \4, \5, \6, \7 ENDM -itemball: MACRO +MACRO itemball ;\1: item: from constants/item_constants.asm ;\2: quantity: default 1 -if _NARG == 1 - itemball \1, 1 -else - db \1, \2 -endc + if _NARG == 1 + itemball \1, 1 + else + db \1, \2 + endc ENDM -hiddenitem: MACRO +MACRO hiddenitem ;\1: item: from constants/item_constants.asm ;\2: flag: an EVENT_* constant dwb \2, \1 ENDM -elevfloor: MACRO +MACRO elevfloor ;\1: floor: a FLOOR_* constant ;\2: warp destination: starts at 1 ;\3: map id @@ -155,20 +155,20 @@ elevfloor: MACRO map_id \3 ENDM -conditional_event: MACRO +MACRO conditional_event ;\1: flag: an EVENT_* constant ;\2: script pointer dw \1, \2 ENDM -cmdqueue: MACRO +MACRO cmdqueue ;\1: type: a CMDQUEUE_* constant ;\2: data pointer dbw \1, \2 dw 0 ; filler ENDM -stonetable: MACRO +MACRO stonetable ;\1: warp id ;\2: object_event id ;\3: script pointer diff --git a/macros/scripts/movement.asm b/macros/scripts/movement.asm index 6501454c5..b5fc59bc4 100644 --- a/macros/scripts/movement.asm +++ b/macros/scripts/movement.asm @@ -4,219 +4,219 @@ ; Directional movements const movement_turn_head ; $00 -turn_head: MACRO +MACRO turn_head db movement_turn_head | \1 ENDM const movement_turn_step ; $04 -turn_step: MACRO +MACRO turn_step db movement_turn_step | \1 ENDM const movement_slow_step ; $08 -slow_step: MACRO +MACRO slow_step db movement_slow_step | \1 ENDM const movement_step ; $0c -step: MACRO +MACRO step db movement_step | \1 ENDM const movement_big_step ; $10 -big_step: MACRO +MACRO big_step db movement_big_step | \1 ENDM const movement_slow_slide_step ; $14 -slow_slide_step: MACRO +MACRO slow_slide_step db movement_slow_slide_step | \1 ENDM const movement_slide_step ; $18 -slide_step: MACRO +MACRO slide_step db movement_slide_step | \1 ENDM const movement_fast_slide_step ; $1c -fast_slide_step: MACRO +MACRO fast_slide_step db movement_fast_slide_step | \1 ENDM const movement_turn_away ; $20 -turn_away: MACRO +MACRO turn_away db movement_turn_away | \1 ENDM const movement_turn_in ; $24 -turn_in: MACRO +MACRO turn_in db movement_turn_in | \1 ENDM const movement_turn_waterfall ; $28 -turn_waterfall: MACRO +MACRO turn_waterfall db movement_turn_waterfall | \1 ENDM const movement_slow_jump_step ; $2c -slow_jump_step: MACRO +MACRO slow_jump_step db movement_slow_jump_step | \1 ENDM const movement_jump_step ; $30 -jump_step: MACRO +MACRO jump_step db movement_jump_step | \1 ENDM const movement_fast_jump_step ; $34 -fast_jump_step: MACRO +MACRO fast_jump_step db movement_fast_jump_step | \1 ENDM -const_inc = 1 +DEF const_inc = 1 ; Control const movement_remove_sliding ; $38 -remove_sliding: MACRO +MACRO remove_sliding db movement_remove_sliding ENDM const movement_set_sliding ; $39 -set_sliding: MACRO +MACRO set_sliding db movement_set_sliding ENDM const movement_remove_fixed_facing ; $3a -remove_fixed_facing: MACRO +MACRO remove_fixed_facing db movement_remove_fixed_facing ENDM const movement_fix_facing ; $3b -fix_facing: MACRO +MACRO fix_facing db movement_fix_facing ENDM const movement_show_object ; $3c -show_object: MACRO +MACRO show_object db movement_show_object ENDM const movement_hide_object ; $3d -hide_object: MACRO +MACRO hide_object db movement_hide_object ENDM ; Sleep const movement_step_sleep ; $3e -step_sleep: MACRO -if \1 <= 8 - db movement_step_sleep + \1 - 1 -else - db movement_step_sleep + 8, \1 -endc +MACRO step_sleep + if \1 <= 8 + db movement_step_sleep + \1 - 1 + else + db movement_step_sleep + 8, \1 + endc ENDM const_skip 8 ; all step_sleep values const movement_step_end ; $47 -step_end: MACRO +MACRO step_end db movement_step_end ENDM const movement_step_48 ; $48 -step_48: MACRO +MACRO step_48 db movement_step_48 db \1 ; ??? ENDM const movement_remove_object ; $49 -remove_object: MACRO +MACRO remove_object db movement_remove_object ENDM const movement_step_loop ; $4a -step_loop: MACRO +MACRO step_loop db movement_step_loop ENDM const movement_step_4b ; $4b -step_4b: MACRO +MACRO step_4b db movement_step_4b ENDM const movement_teleport_from ; $4c -teleport_from: MACRO +MACRO teleport_from db movement_teleport_from ENDM const movement_teleport_to ; $4d -teleport_to: MACRO +MACRO teleport_to db movement_teleport_to ENDM const movement_skyfall ; $4e -skyfall: MACRO +MACRO skyfall db movement_skyfall ENDM const movement_step_dig ; $4f -step_dig: MACRO +MACRO step_dig db movement_step_dig db \1 ; length ENDM const movement_step_bump ; $50 -step_bump: MACRO +MACRO step_bump db movement_step_bump ENDM const movement_fish_got_bite ; $51 -fish_got_bite: MACRO +MACRO fish_got_bite db movement_fish_got_bite ENDM const movement_fish_cast_rod ; $52 -fish_cast_rod: MACRO +MACRO fish_cast_rod db movement_fish_cast_rod ENDM const movement_hide_emote ; $53 -hide_emote: MACRO +MACRO hide_emote db movement_hide_emote ENDM const movement_show_emote ; $54 -show_emote: MACRO +MACRO show_emote db movement_show_emote ENDM const movement_step_shake ; $55 -step_shake: MACRO +MACRO step_shake db movement_step_shake db \1 ; displacement ENDM const movement_tree_shake ; $56 -tree_shake: MACRO +MACRO tree_shake db movement_tree_shake ENDM const movement_rock_smash ; $57 -rock_smash: MACRO +MACRO rock_smash db movement_rock_smash db \1 ; length ENDM const movement_return_dig ; $58 -return_dig: MACRO +MACRO return_dig db movement_return_dig db \1 ; length ENDM const movement_skyfall_top ; $59 -skyfall_top: MACRO +MACRO skyfall_top db movement_skyfall_top ENDM -NUM_MOVEMENT_CMDS EQU const_value +DEF NUM_MOVEMENT_CMDS EQU const_value diff --git a/macros/scripts/text.asm b/macros/scripts/text.asm index 252481ff4..fac922b98 100644 --- a/macros/scripts/text.asm +++ b/macros/scripts/text.asm @@ -1,147 +1,147 @@ -text EQUS "db TX_START," ; Start writing text. -next EQUS "db \"\"," ; Move a line down. -line EQUS "db \"\"," ; Start writing at the bottom line. -page EQUS "db \"@\"," ; Start a new Pokédex page. -para EQUS "db \"\"," ; Start a new paragraph. -cont EQUS "db \"\"," ; Scroll to the next line. -done EQUS "db \"\"" ; End a text box. -prompt EQUS "db \"\"" ; Prompt the player to end a text box (initiating some other event). +DEF text EQUS "db TX_START," ; Start writing text. +DEF next EQUS "db \"\"," ; Move a line down. +DEF line EQUS "db \"\"," ; Start writing at the bottom line. +DEF page EQUS "db \"@\"," ; Start a new Pokédex page. +DEF para EQUS "db \"\"," ; Start a new paragraph. +DEF cont EQUS "db \"\"," ; Scroll to the next line. +DEF done EQUS "db \"\"" ; End a text box. +DEF prompt EQUS "db \"\"" ; Prompt the player to end a text box (initiating some other event). ; TextCommands indexes (see home/text.asm) const_def const TX_START ; $00 -text_start: MACRO +MACRO text_start db TX_START ENDM const TX_RAM ; $01 -text_ram: MACRO +MACRO text_ram db TX_RAM dw \1 ENDM const TX_BCD ; $02 -text_bcd: MACRO +MACRO text_bcd db TX_BCD dw \1 db \2 ENDM const TX_MOVE ; $03 -text_move: MACRO +MACRO text_move db TX_MOVE dw \1 ENDM const TX_BOX ; $04 -text_box: MACRO +MACRO text_box db TX_BOX dw \1 db \2, \3 ENDM const TX_LOW ; $05 -text_low: MACRO +MACRO text_low db TX_LOW ENDM const TX_PROMPT_BUTTON ; $06 -text_promptbutton: MACRO +MACRO text_promptbutton db TX_PROMPT_BUTTON ENDM const TX_SCROLL ; $07 -text_scroll: MACRO +MACRO text_scroll db TX_SCROLL ENDM const TX_START_ASM ; $08 -text_asm: MACRO +MACRO text_asm db TX_START_ASM ENDM const TX_DECIMAL ; $09 -text_decimal: MACRO +MACRO text_decimal db TX_DECIMAL dw \1 ; address dn \2, \3 ; bytes, digits ENDM const TX_PAUSE ; $0a -text_pause: MACRO +MACRO text_pause db TX_PAUSE ENDM const TX_SOUND_DEX_FANFARE_50_79 ; $0b -sound_dex_fanfare_50_79: MACRO +MACRO sound_dex_fanfare_50_79 db TX_SOUND_DEX_FANFARE_50_79 ENDM const TX_DOTS ; $0c -text_dots: MACRO +MACRO text_dots db TX_DOTS db \1 ENDM const TX_WAIT_BUTTON ; $0d -text_waitbutton: MACRO +MACRO text_waitbutton db TX_WAIT_BUTTON ENDM const TX_SOUND_DEX_FANFARE_20_49 ; $0e -sound_dex_fanfare_20_49: MACRO +MACRO sound_dex_fanfare_20_49 db TX_SOUND_DEX_FANFARE_20_49 ENDM const TX_SOUND_ITEM ; $0f -sound_item: MACRO +MACRO sound_item db TX_SOUND_ITEM ENDM const TX_SOUND_CAUGHT_MON ; $10 -sound_caught_mon: MACRO +MACRO sound_caught_mon db TX_SOUND_CAUGHT_MON ENDM const TX_SOUND_DEX_FANFARE_80_109 ; $11 -sound_dex_fanfare_80_109: MACRO +MACRO sound_dex_fanfare_80_109 db TX_SOUND_DEX_FANFARE_80_109 ENDM const TX_SOUND_FANFARE ; $12 -sound_fanfare: MACRO +MACRO sound_fanfare db TX_SOUND_FANFARE ENDM const TX_SOUND_SLOT_MACHINE_START ; $13 -sound_slot_machine_start: MACRO +MACRO sound_slot_machine_start db TX_SOUND_SLOT_MACHINE_START ENDM const TX_STRINGBUFFER ; $14 -text_buffer: MACRO +MACRO text_buffer db TX_STRINGBUFFER db \1 ENDM const TX_DAY ; $15 -text_today: MACRO +MACRO text_today db TX_DAY ENDM const TX_FAR ; $16 -text_far: MACRO +MACRO text_far db TX_FAR dw \1 db BANK(\1) ENDM -NUM_TEXT_CMDS EQU const_value +DEF NUM_TEXT_CMDS EQU const_value const_next $50 const TX_END ; $50 -text_end: MACRO +MACRO text_end db TX_END ENDM diff --git a/macros/vc.asm b/macros/vc.asm index 27cdb88b3..639288aa4 100644 --- a/macros/vc.asm +++ b/macros/vc.asm @@ -1,27 +1,27 @@ -vc_hook: MACRO -if DEF(_CRYSTAL11_VC) -.VC_\1:: -endc +MACRO vc_hook + if DEF(_CRYSTAL11_VC) + .VC_\1:: + endc ENDM -vc_patch: MACRO -if DEF(_CRYSTAL11_VC) - assert !DEF(CURRENT_VC_PATCH), "Already started a vc_patch" -CURRENT_VC_PATCH EQUS "\1" -.VC_{CURRENT_VC_PATCH}:: -endc +MACRO vc_patch + if DEF(_CRYSTAL11_VC) + assert !DEF(CURRENT_VC_PATCH), "Already started a vc_patch" + DEF CURRENT_VC_PATCH EQUS "\1" + .VC_{CURRENT_VC_PATCH}:: + endc ENDM -vc_patch_end: MACRO -if DEF(_CRYSTAL11_VC) - assert DEF(CURRENT_VC_PATCH), "No vc_patch started" -.VC_{CURRENT_VC_PATCH}_End:: - PURGE CURRENT_VC_PATCH -endc +MACRO vc_patch_end + if DEF(_CRYSTAL11_VC) + assert DEF(CURRENT_VC_PATCH), "No vc_patch started" + .VC_{CURRENT_VC_PATCH}_End:: + PURGE CURRENT_VC_PATCH + endc ENDM -vc_assert: MACRO -if DEF(_CRYSTAL11_VC) - assert \# -endc +MACRO vc_assert + if DEF(_CRYSTAL11_VC) + assert \# + endc ENDM diff --git a/macros/wram.asm b/macros/wram.asm index 9fd997ac0..8c099f88e 100644 --- a/macros/wram.asm +++ b/macros/wram.asm @@ -1,10 +1,10 @@ ; Used in wram.asm -flag_array: MACRO +MACRO flag_array ds ((\1) + 7) / 8 ENDM -box_struct: MACRO +MACRO box_struct \1Species:: db \1Item:: db \1Moves:: ds NUM_MOVES @@ -29,7 +29,7 @@ box_struct: MACRO \1BoxEnd:: ENDM -party_struct: MACRO +MACRO party_struct box_struct \1 \1Status:: db \1Unused:: db @@ -44,7 +44,7 @@ party_struct: MACRO \1StructEnd:: ENDM -red_box_struct: MACRO +MACRO red_box_struct \1Species:: db \1HP:: dw \1BoxLevel:: db @@ -65,7 +65,7 @@ red_box_struct: MACRO \1PP:: ds NUM_MOVES ENDM -red_party_struct: MACRO +MACRO red_party_struct red_box_struct \1 \1Level:: db \1Stats:: @@ -76,7 +76,7 @@ red_party_struct: MACRO \1Special:: dw ENDM -battle_struct: MACRO +MACRO battle_struct \1Species:: db \1Item:: db \1Moves:: ds NUM_MOVES @@ -99,30 +99,30 @@ battle_struct: MACRO \1StructEnd:: ENDM -box: MACRO +MACRO box \1Count:: db \1Species:: ds MONS_PER_BOX + 1 \1Mons:: -; \1Mon1 - \1Mon20 -for n, 1, MONS_PER_BOX + 1 -\1Mon{d:n}:: box_struct \1Mon{d:n} -endr + ; \1Mon1 - \1Mon20 + for n, 1, MONS_PER_BOX + 1 + \1Mon{d:n}:: box_struct \1Mon{d:n} + endr \1MonOTs:: -; \1Mon1OT - \1Mon20OT -for n, 1, MONS_PER_BOX + 1 -\1Mon{d:n}OT:: ds NAME_LENGTH -endr + ; \1Mon1OT - \1Mon20OT + for n, 1, MONS_PER_BOX + 1 + \1Mon{d:n}OT:: ds NAME_LENGTH + endr \1MonNicknames:: -; \1Mon1Nickname - \1Mon20Nickname -for n, 1, MONS_PER_BOX + 1 -\1Mon{d:n}Nickname:: ds MON_NAME_LENGTH -endr + ; \1Mon1Nickname - \1Mon20Nickname + for n, 1, MONS_PER_BOX + 1 + \1Mon{d:n}Nickname:: ds MON_NAME_LENGTH + endr \1MonNicknamesEnd:: \1End:: ds 2 ; padding ENDM -map_connection_struct: MACRO +MACRO map_connection_struct \1ConnectedMapGroup:: db \1ConnectedMapNumber:: db \1ConnectionStripPointer:: dw @@ -134,7 +134,7 @@ map_connection_struct: MACRO \1ConnectionWindow:: dw ENDM -channel_struct: MACRO +MACRO channel_struct \1MusicID:: dw \1MusicBank:: db \1Flags1:: db ; 0:on/off 1:subroutine 2:looping 3:sfx 4:noise 5:rest @@ -178,19 +178,19 @@ channel_struct: MACRO ds 1 ENDM -battle_tower_struct: MACRO +MACRO battle_tower_struct \1Name:: ds NAME_LENGTH - 1 \1TrainerClass:: db -; \1Mon1 - \1Mon3 and \1Mon1Name - \1Mon3Name -for n, 1, BATTLETOWER_PARTY_LENGTH + 1 -\1Mon{d:n}:: party_struct \1Mon{d:n} -\1Mon{d:n}Name:: ds MON_NAME_LENGTH -endr + ; \1Mon1 - \1Mon3 and \1Mon1Name - \1Mon3Name + for n, 1, BATTLETOWER_PARTY_LENGTH + 1 + \1Mon{d:n}:: party_struct \1Mon{d:n} + \1Mon{d:n}Name:: ds MON_NAME_LENGTH + endr \1TrainerData:: ds BATTLETOWER_TRAINERDATALENGTH \1TrainerEnd:: ENDM -mailmsg: MACRO +MACRO mailmsg \1Message:: ds MAIL_MSG_LENGTH \1MessageEnd:: db \1Author:: ds PLAYER_NAME_LENGTH @@ -201,7 +201,7 @@ mailmsg: MACRO \1End:: ENDM -roam_struct: MACRO +MACRO roam_struct \1Species:: db \1Level:: db \1MapGroup:: db @@ -210,13 +210,13 @@ roam_struct: MACRO \1DVs:: dw ENDM -bugcontestwinner: MACRO +MACRO bugcontestwinner \1WinnerID:: db \1Mon:: db \1Score:: dw ENDM -hof_mon: MACRO +MACRO hof_mon \1Species:: db \1ID:: dw \1DVs:: dw @@ -225,16 +225,16 @@ hof_mon: MACRO \1End:: ENDM -hall_of_fame: MACRO +MACRO hall_of_fame \1WinCount:: db -; \1Mon1 - \1Mon6 -for n, 1, PARTY_LENGTH + 1 -\1Mon{d:n}:: hof_mon \1Mon{d:n} -endr + ; \1Mon1 - \1Mon6 + for n, 1, PARTY_LENGTH + 1 + \1Mon{d:n}:: hof_mon \1Mon{d:n} + endr \1End:: db ENDM -link_battle_record: MACRO +MACRO link_battle_record \1ID:: dw \1Name:: ds NAME_LENGTH - 1 \1Wins:: dw @@ -243,7 +243,7 @@ link_battle_record: MACRO \1End:: ENDM -trademon: MACRO +MACRO trademon \1Species:: db \1SpeciesName:: ds MON_NAME_LENGTH \1Nickname:: ds MON_NAME_LENGTH @@ -255,7 +255,7 @@ trademon: MACRO \1End:: ENDM -move_struct: MACRO +MACRO move_struct \1Animation:: db \1Effect:: db \1Power:: db @@ -265,7 +265,7 @@ move_struct: MACRO \1EffectChance:: db ENDM -slot_reel: MACRO +MACRO slot_reel \1ReelAction:: db \1TilemapAddr:: dw \1Position:: db @@ -282,7 +282,7 @@ slot_reel: MACRO \1StopDelay:: db ENDM -object_struct: MACRO +MACRO object_struct \1Sprite:: db \1MapObjectIndex:: db \1SpriteTile:: db @@ -319,7 +319,7 @@ object_struct: MACRO \1StructEnd:: ENDM -map_object: MACRO +MACRO map_object \1ObjectStructID:: db \1ObjectSprite:: db \1ObjectYCoord:: db @@ -335,7 +335,7 @@ map_object: MACRO ds 2 ENDM -sprite_oam_struct: MACRO +MACRO sprite_oam_struct \1YCoord:: db \1XCoord:: db \1TileID:: db @@ -348,7 +348,7 @@ sprite_oam_struct: MACRO ; bit 2-0: pal # (cgb only) ENDM -sprite_anim_struct: MACRO +MACRO sprite_anim_struct \1Index:: db \1FramesetID:: db \1AnimSeqID:: db @@ -367,7 +367,7 @@ sprite_anim_struct: MACRO \1Var4:: ds 1 ENDM -battle_anim_struct: MACRO +MACRO battle_anim_struct \1Index:: db \1OAMFlags:: db \1FixY:: db @@ -388,7 +388,7 @@ battle_anim_struct: MACRO ds 7 ENDM -battle_bg_effect: MACRO +MACRO battle_bg_effect \1Function:: db \1JumptableIndex:: db \1BattleTurn:: db diff --git a/maps/CeladonDeptStore6F.asm b/maps/CeladonDeptStore6F.asm index 3e9866b2b..14f92b22e 100644 --- a/maps/CeladonDeptStore6F.asm +++ b/maps/CeladonDeptStore6F.asm @@ -1,6 +1,6 @@ -CELADONDEPTSTORE6F_FRESH_WATER_PRICE EQU 200 -CELADONDEPTSTORE6F_SODA_POP_PRICE EQU 300 -CELADONDEPTSTORE6F_LEMONADE_PRICE EQU 350 +DEF CELADONDEPTSTORE6F_FRESH_WATER_PRICE EQU 200 +DEF CELADONDEPTSTORE6F_SODA_POP_PRICE EQU 300 +DEF CELADONDEPTSTORE6F_LEMONADE_PRICE EQU 350 object_const_def const CELADONDEPTSTORE6F_SUPER_NERD diff --git a/maps/CeladonGameCornerPrizeRoom.asm b/maps/CeladonGameCornerPrizeRoom.asm index 6d5415d9c..fd1c90a2d 100644 --- a/maps/CeladonGameCornerPrizeRoom.asm +++ b/maps/CeladonGameCornerPrizeRoom.asm @@ -1,9 +1,9 @@ -CELADONGAMECORNERPRIZEROOM_TM32_COINS EQU 1500 -CELADONGAMECORNERPRIZEROOM_TM29_COINS EQU 3500 -CELADONGAMECORNERPRIZEROOM_TM15_COINS EQU 7500 -CELADONGAMECORNERPRIZEROOM_PIKACHU_COINS EQU 2222 -CELADONGAMECORNERPRIZEROOM_PORYGON_COINS EQU 5555 -CELADONGAMECORNERPRIZEROOM_LARVITAR_COINS EQU 8888 +DEF CELADONGAMECORNERPRIZEROOM_TM32_COINS EQU 1500 +DEF CELADONGAMECORNERPRIZEROOM_TM29_COINS EQU 3500 +DEF CELADONGAMECORNERPRIZEROOM_TM15_COINS EQU 7500 +DEF CELADONGAMECORNERPRIZEROOM_PIKACHU_COINS EQU 2222 +DEF CELADONGAMECORNERPRIZEROOM_PORYGON_COINS EQU 5555 +DEF CELADONGAMECORNERPRIZEROOM_LARVITAR_COINS EQU 8888 object_const_def const CELADONGAMECORNERPRIZEROOM_GENTLEMAN diff --git a/maps/GoldenrodDeptStore6F.asm b/maps/GoldenrodDeptStore6F.asm index 17b90e76a..b31db370f 100644 --- a/maps/GoldenrodDeptStore6F.asm +++ b/maps/GoldenrodDeptStore6F.asm @@ -1,6 +1,6 @@ -GOLDENRODDEPTSTORE6F_FRESH_WATER_PRICE EQU 200 -GOLDENRODDEPTSTORE6F_SODA_POP_PRICE EQU 300 -GOLDENRODDEPTSTORE6F_LEMONADE_PRICE EQU 350 +DEF GOLDENRODDEPTSTORE6F_FRESH_WATER_PRICE EQU 200 +DEF GOLDENRODDEPTSTORE6F_SODA_POP_PRICE EQU 300 +DEF GOLDENRODDEPTSTORE6F_LEMONADE_PRICE EQU 350 object_const_def const GOLDENRODDEPTSTORE6F_LASS diff --git a/maps/GoldenrodGameCorner.asm b/maps/GoldenrodGameCorner.asm index 19689a706..664dddfb0 100644 --- a/maps/GoldenrodGameCorner.asm +++ b/maps/GoldenrodGameCorner.asm @@ -1,9 +1,9 @@ -GOLDENRODGAMECORNER_TM25_COINS EQU 5500 -GOLDENRODGAMECORNER_TM14_COINS EQU 5500 -GOLDENRODGAMECORNER_TM38_COINS EQU 5500 -GOLDENRODGAMECORNER_ABRA_COINS EQU 100 -GOLDENRODGAMECORNER_CUBONE_COINS EQU 800 -GOLDENRODGAMECORNER_WOBBUFFET_COINS EQU 1500 +DEF GOLDENRODGAMECORNER_TM25_COINS EQU 5500 +DEF GOLDENRODGAMECORNER_TM14_COINS EQU 5500 +DEF GOLDENRODGAMECORNER_TM38_COINS EQU 5500 +DEF GOLDENRODGAMECORNER_ABRA_COINS EQU 100 +DEF GOLDENRODGAMECORNER_CUBONE_COINS EQU 800 +DEF GOLDENRODGAMECORNER_WOBBUFFET_COINS EQU 1500 object_const_def const GOLDENRODGAMECORNER_CLERK diff --git a/maps/GoldenrodUnderground.asm b/maps/GoldenrodUnderground.asm index d15b52390..88732f75b 100644 --- a/maps/GoldenrodUnderground.asm +++ b/maps/GoldenrodUnderground.asm @@ -1,5 +1,5 @@ -GOLDENRODUNDERGROUND_OLDER_HAIRCUT_PRICE EQU 500 -GOLDENRODUNDERGROUND_YOUNGER_HAIRCUT_PRICE EQU 300 +DEF GOLDENRODUNDERGROUND_OLDER_HAIRCUT_PRICE EQU 500 +DEF GOLDENRODUNDERGROUND_YOUNGER_HAIRCUT_PRICE EQU 300 object_const_def const GOLDENRODUNDERGROUND_SUPER_NERD1 diff --git a/maps/GoldenrodUndergroundSwitchRoomEntrances.asm b/maps/GoldenrodUndergroundSwitchRoomEntrances.asm index 8626101a9..cfd6e07c8 100644 --- a/maps/GoldenrodUndergroundSwitchRoomEntrances.asm +++ b/maps/GoldenrodUndergroundSwitchRoomEntrances.asm @@ -1,13 +1,13 @@ ; block ids -UNDERGROUND_DOOR_CLOSED1 EQU $2a -UNDERGROUND_DOOR_CLOSED2 EQU $3e -UNDERGROUND_DOOR_CLOSED3 EQU $3f -UNDERGROUND_DOOR_OPEN1 EQU $2d -UNDERGROUND_DOOR_OPEN2 EQU $3d +DEF UNDERGROUND_DOOR_CLOSED1 EQU $2a +DEF UNDERGROUND_DOOR_CLOSED2 EQU $3e +DEF UNDERGROUND_DOOR_CLOSED3 EQU $3f +DEF UNDERGROUND_DOOR_OPEN1 EQU $2d +DEF UNDERGROUND_DOOR_OPEN2 EQU $3d -ugdoor: MACRO -UGDOOR_\1_XCOORD EQU \2 -UGDOOR_\1_YCOORD EQU \3 +MACRO ugdoor + DEF UGDOOR_\1_XCOORD EQU \2 + DEF UGDOOR_\1_YCOORD EQU \3 ENDM ; id, x, y @@ -28,7 +28,7 @@ ENDM ugdoor 15, 10, 18 ugdoor 16, 12, 18 -doorstate: MACRO +MACRO doorstate changeblock UGDOOR_\1_YCOORD, UGDOOR_\1_XCOORD, UNDERGROUND_DOOR_\2 ENDM diff --git a/maps/MahoganyTown.asm b/maps/MahoganyTown.asm index 00663b10d..0fc230f88 100644 --- a/maps/MahoganyTown.asm +++ b/maps/MahoganyTown.asm @@ -1,4 +1,4 @@ -MAHOGANYTOWN_RAGECANDYBAR_PRICE EQU 300 +DEF MAHOGANYTOWN_RAGECANDYBAR_PRICE EQU 300 object_const_def const MAHOGANYTOWN_POKEFAN_M diff --git a/maps/RadioTower2F.asm b/maps/RadioTower2F.asm index af95b9e1e..eb07fe466 100644 --- a/maps/RadioTower2F.asm +++ b/maps/RadioTower2F.asm @@ -1,4 +1,4 @@ -BLUE_CARD_POINT_CAP EQU 30 +DEF BLUE_CARD_POINT_CAP EQU 30 object_const_def const RADIOTOWER2F_SUPER_NERD diff --git a/maps/Route39Farmhouse.asm b/maps/Route39Farmhouse.asm index e5c5d4baa..3a0367c03 100644 --- a/maps/Route39Farmhouse.asm +++ b/maps/Route39Farmhouse.asm @@ -1,4 +1,4 @@ -ROUTE39FARMHOUSE_MILK_PRICE EQU 500 +DEF ROUTE39FARMHOUSE_MILK_PRICE EQU 500 object_const_def const ROUTE39FARMHOUSE_POKEFAN_M diff --git a/maps/Route43Gate.asm b/maps/Route43Gate.asm index 8ec6a9cd1..9f1a9938a 100644 --- a/maps/Route43Gate.asm +++ b/maps/Route43Gate.asm @@ -1,4 +1,4 @@ -ROUTE43GATE_TOLL EQU 1000 +DEF ROUTE43GATE_TOLL EQU 1000 object_const_def const ROUTE43GATE_OFFICER diff --git a/mobile/fixed_words.asm b/mobile/fixed_words.asm index 0a8bfad27..b60b2592a 100644 --- a/mobile/fixed_words.asm +++ b/mobile/fixed_words.asm @@ -4044,7 +4044,7 @@ MobileEZChatCategoryPointers: db "なんの@@", $2, $4, $0 MobileEZChatData_WordAndPageCounts: -macro_11f220: MACRO +MACRO macro_11f220 ; parameter: number of words db \1 ; 12 words per page (0-based indexing) @@ -4071,11 +4071,11 @@ EZChat_SortedWords: ; allocated size for each. ; These arrays are expanded dynamically to accomodate ; any Pokemon you've seen that starts with each kana. -macro_11f23c: MACRO +MACRO macro_11f23c dw w3_d012 - w3_d000 + x, \1 -x += 2 * \1 + DEF x += 2 * \1 ENDM -x = 0 +DEF x = 0 macro_11f23c $2f ; a macro_11f23c $1e ; i macro_11f23c $11 ; u diff --git a/mobile/mobile_40.asm b/mobile/mobile_40.asm index 6ffa58a21..93b7e1b4f 100644 --- a/mobile/mobile_40.asm +++ b/mobile/mobile_40.asm @@ -2395,7 +2395,7 @@ Function100f8d: call CloseSRAM ret -macro_100fc0: MACRO +MACRO macro_100fc0 ; first byte: ; Bit 7 set: Not SRAM ; Lower 7 bits: Bank if SRAM diff --git a/mobile/mobile_42.asm b/mobile/mobile_42.asm index 1e6447b17..87b85814a 100644 --- a/mobile/mobile_42.asm +++ b/mobile/mobile_42.asm @@ -1,9 +1,9 @@ -add_mobiletradeanim: MACRO +MACRO add_mobiletradeanim \1_MobileTradeCmd: dw \1 ENDM -mobiletradeanim: MACRO +MACRO mobiletradeanim db (\1_MobileTradeCmd - MobileTradeAnim_JumptableLoop.Jumptable) / 2 ENDM diff --git a/mobile/mobile_5f.asm b/mobile/mobile_5f.asm index f37f7c7f8..8bc03e2a5 100644 --- a/mobile/mobile_5f.asm +++ b/mobile/mobile_5f.asm @@ -2946,17 +2946,17 @@ Function17e349: call CloseSRAM ret -inc_crash_check_pointer_farcall: MACRO +MACRO inc_crash_check_pointer_farcall call IncCrashCheckPointer call HlToCrashCheckPointer ; redundant ldh a, [rSVBK] push af ld a, $1 ldh [rSVBK], a -rept _NARG - farcall \1 - shift -endr + rept _NARG + farcall \1 + shift + endr pop af ldh [rSVBK], a ret diff --git a/rgbdscheck.asm b/rgbdscheck.asm index 92777111a..7f388e4af 100644 --- a/rgbdscheck.asm +++ b/rgbdscheck.asm @@ -1,8 +1,8 @@ -MAJOR EQU 0 -MINOR EQU 5 -PATCH EQU 2 +DEF MAJOR EQU 0 +DEF MINOR EQU 5 +DEF PATCH EQU 2 -wrong_rgbds: MACRO +MACRO wrong_rgbds fail "pokecrystal requires rgbds v0.5.2 or newer." ENDM diff --git a/sram.asm b/sram.asm index 420d34743..93dab7c43 100644 --- a/sram.asm +++ b/sram.asm @@ -174,12 +174,12 @@ endr ; The PC boxes will not fit into one SRAM bank, ; so they use multiple SECTIONs -box_n = 0 -boxes: MACRO -rept \1 -box_n += 1 -sBox{d:box_n}:: box sBox{d:box_n} -endr +DEF box_n = 0 +MACRO boxes + rept \1 + DEF box_n += 1 + sBox{d:box_n}:: box sBox{d:box_n} + endr ENDM SECTION "Boxes 1-7", SRAM diff --git a/vc/pokecrystal11.constants.asm b/vc/pokecrystal11.constants.asm index 48aa45ac7..897be7f84 100644 --- a/vc/pokecrystal11.constants.asm +++ b/vc/pokecrystal11.constants.asm @@ -2,8 +2,8 @@ INCLUDE "constants.asm" ; These are all the asm constants needed to make the crystal11_vc patch. -vc_const: MACRO -x = \1 +MACRO vc_const + DEF x = \1 println "00:{04x:x} \1" ; same format as rgblink's .sym file ENDM