Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identify more bit flags #1153

Merged
merged 1 commit into from
Nov 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions constants/battle_anim_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ DEF BATTLEANIMSTRUCT_VAR2 rb ; 10
DEF BATTLEANIMSTRUCT_LENGTH EQU _RS
DEF NUM_BATTLE_ANIM_STRUCTS EQU 10 ; see wActiveAnimObjects

DEF BATTLEANIMSTRUCT_OAMFLAGS_FIX_COORDS_F EQU 0

; wBattleAnimTileDict size (see wram.asm)
DEF NUM_BATTLEANIMTILEDICT_ENTRIES EQU 5

Expand Down
6 changes: 6 additions & 0 deletions constants/battle_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ DEF EFFECTIVE EQU 10
DEF NOT_VERY_EFFECTIVE EQU 05
DEF NO_EFFECT EQU 00

; wTypeModifier
DEF EFFECTIVENESS_MASK EQU %01111111
const_def 7
shift_const STAB_DAMAGE

; enemy AI behavior
DEF BASE_AI_SWITCH_SCORE EQU 10

Expand Down Expand Up @@ -218,6 +223,7 @@ DEF ALL_STATUS EQU (1 << PSN) | (1 << BRN) | (1 << FRZ) | (1 << PAR) | SLP_MASK
const SCREENS_SAFEGUARD
const SCREENS_LIGHT_SCREEN
const SCREENS_REFLECT
const SCREENS_UNUSED

; values in wBattleWeather
const_def
Expand Down
10 changes: 7 additions & 3 deletions constants/hardware_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ 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)
DEF RTC_DH_HI EQU 0 ; Most significant bit of Day Counter (Bit 8)
DEF RTC_DH_HALT EQU 6 ; Halt (0=Active, 1=Stop Timer)
DEF RTC_DH_OVERFLOW EQU 7 ; Day Counter Carry Bit (1=Counter Overflow)

; interrupt flags
DEF VBLANK EQU 0
Expand All @@ -49,6 +49,8 @@ DEF PRIORITY EQU 1 << OAM_PRIORITY ; $80

; Hardware registers
DEF rJOYP EQU $ff00 ; Joypad (R/W)
DEF rJOYP_BUTTONS EQU 4
DEF rJOYP_DPAD EQU 5
DEF rSB EQU $ff01 ; Serial transfer data (R/W)
DEF rSC EQU $ff02 ; Serial Transfer Control (R/W)
DEF rSC_ON EQU 7
Expand Down Expand Up @@ -125,6 +127,8 @@ 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 KEY1_PREPARE EQU 0 ; 0=No, 1=Prepare (R/W)
DEF KEY1_DBLSPEED EQU 7 ; 0=Normal Speed, 1=Double Speed (R)
DEF rVBK EQU $ff4f ; CGB Mode Only - VRAM Bank
DEF rBLCK EQU $ff50
DEF rHDMA1 EQU $ff51 ; CGB Mode Only - New DMA Source, High
Expand Down
33 changes: 11 additions & 22 deletions constants/input_constants.asm
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
; joypad buttons
const_def
const A_BUTTON_F ; 0
const B_BUTTON_F ; 1
const SELECT_F ; 2
const START_F ; 3
const D_RIGHT_F ; 4
const D_LEFT_F ; 5
const D_UP_F ; 6
const D_DOWN_F ; 7
shift_const A_BUTTON ; 0
shift_const B_BUTTON ; 1
shift_const SELECT ; 2
shift_const START ; 3
shift_const D_RIGHT ; 4
shift_const D_LEFT ; 5
shift_const D_UP ; 6
shift_const D_DOWN ; 7

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
DEF NO_INPUT EQU %00000000

DEF BUTTONS EQU A_BUTTON | B_BUTTON | SELECT | START
DEF D_PAD EQU D_RIGHT | D_LEFT | D_UP | D_DOWN

DEF R_DPAD EQU %00100000
DEF R_BUTTONS EQU %00010000
DEF BUTTONS EQU A_BUTTON | B_BUTTON | SELECT | START
DEF D_PAD EQU D_RIGHT | D_LEFT | D_UP | D_DOWN
9 changes: 4 additions & 5 deletions constants/item_data_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ DEF NUM_ITEM_TYPES EQU const_value - 1
const ITEMMENU_CLOSE ; 6

; item actions
DEF CANT_SELECT_F EQU 6
DEF CANT_TOSS_F EQU 7
const_def 6
shift_const CANT_SELECT ; 6
shift_const CANT_TOSS ; 7

DEF NO_LIMITS EQU 0
DEF CANT_SELECT EQU 1 << CANT_SELECT_F
DEF CANT_TOSS EQU 1 << CANT_TOSS_F
DEF NO_LIMITS EQU 0

; pack pockets
const_def
Expand Down
8 changes: 1 addition & 7 deletions constants/map_data_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,8 @@ DEF NUM_MAP_PALETTES EQU const_value
const FISHGROUP_QWILFISH_NO_SWARM
DEF NUM_FISHGROUPS EQU const_value - 1

; connection directions (see data/maps/data.asm)
const_def
const EAST_F
const WEST_F
const SOUTH_F
const NORTH_F

; wMapConnections
; connection directions (see data/maps/data.asm)
const_def
shift_const EAST
shift_const WEST
Expand Down
64 changes: 22 additions & 42 deletions constants/map_object_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -45,56 +45,36 @@ DEF OW_RIGHT EQU RIGHT << 2

; object_struct OBJECT_FLAGS1 bit flags
const_def
const INVISIBLE_F ; 0
const WONT_DELETE_F ; 1
const FIXED_FACING_F ; 2
const SLIDING_F ; 3
const NOCLIP_TILES_F ; 4
const MOVE_ANYWHERE_F ; 5
const NOCLIP_OBJS_F ; 6
const EMOTE_OBJECT_F ; 7

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
shift_const INVISIBLE ; 0
shift_const WONT_DELETE ; 1
shift_const FIXED_FACING ; 2
shift_const SLIDING ; 3
shift_const NOCLIP_TILES ; 4
shift_const MOVE_ANYWHERE ; 5
shift_const NOCLIP_OBJS ; 6
shift_const EMOTE_OBJECT ; 7

; object_struct OBJECT_FLAGS2 bit flags
const_def
const LOW_PRIORITY_F ; 0
const HIGH_PRIORITY_F ; 1
const OBJ_FLAGS2_2 ; 2
const OVERHEAD_F ; 3
const USE_OBP1_F ; 4
const FROZEN_F ; 5
const OBJ_FLAGS2_6 ; 6
const OBJ_FLAGS2_7 ; 7

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
shift_const LOW_PRIORITY ; 0
shift_const HIGH_PRIORITY ; 1
shift_const BOULDER_MOVING ; 2
shift_const OVERHEAD ; 3
shift_const USE_OBP1 ; 4
shift_const FROZEN ; 5
shift_const OFF_SCREEN ; 6
shift_const OBJ_FLAGS2_7 ; 7

; object_struct OBJECT_PALETTE bit flags
const_def 5
const SWIMMING_F ; 5
const STRENGTH_BOULDER_F ; 6
const BIG_OBJECT_F ; 7

DEF SWIMMING EQU 1 << SWIMMING_F
DEF STRENGTH_BOULDER EQU 1 << STRENGTH_BOULDER_F
DEF BIG_OBJECT EQU 1 << BIG_OBJECT_F
shift_const SWIMMING ; 5
shift_const STRENGTH_BOULDER ; 6
shift_const BIG_OBJECT ; 7

; facing attribute bit flags
DEF RELATIVE_ATTRIBUTES_F EQU 1
DEF ABSOLUTE_TILE_ID_F EQU 2

DEF RELATIVE_ATTRIBUTES EQU 1 << RELATIVE_ATTRIBUTES_F
DEF ABSOLUTE_TILE_ID EQU 1 << ABSOLUTE_TILE_ID_F
const_def 1
shift_const RELATIVE_ATTRIBUTES ; 1
shift_const ABSOLUTE_TILE_ID ; 2

; map_object struct members (see macros/ram.asm)
; struct initialized by object_event macro (see macros/scripts/maps.asm)
Expand Down
3 changes: 3 additions & 0 deletions constants/map_setup_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ DEF NUM_MAPSETUP_SCRIPTS EQU const_value - $f1
const MAPCALLBACK_CMDQUEUE
const MAPCALLBACK_SPRITES
const MAPCALLBACK_NEWMAP

; see data/maps/setup_script_pointers.asm
DEF MAPSETUPSCRIPT_HAS_PARAM_F EQU 7
67 changes: 41 additions & 26 deletions constants/menu_constants.asm
Original file line number Diff line number Diff line change
@@ -1,41 +1,56 @@
; MenuHeader flags
const_def
shift_const MENU_RESTORE_TILES ; Will be set if MENU_BACKUP_TILES(_2) is set.
shift_const MENU_UNUSED_1
shift_const MENU_UNUSED_2
shift_const MENU_NO_CLICK_SFX
shift_const MENU_SPRITE_ANIMS
shift_const MENU_UNUSED_3
shift_const MENU_BACKUP_TILES
shift_const MENU_BACKUP_TILES_2
shift_const MENU_RESTORE_TILES ; 0
const_skip 2
shift_const MENU_NO_CLICK_SFX ; 3
shift_const MENU_SPRITE_ANIMS ; 4
shift_const MENU_UNUSED ; 5
shift_const MENU_BACKUP_TILES ; 6
shift_const MENU_BACKUP_TILES_2 ; 7

; VerticalMenu/DoNthMenu/SetUpMenu/_2DMenu MenuData flags
; Per flag the comment specifies which menus actually implement it
const_def
shift_const STATICMENU_DISABLE_B ; VerticalMenu/_2DMenu
shift_const STATICMENU_ENABLE_SELECT ; VerticalMenu/_2DMenu
shift_const STATICMENU_ENABLE_LEFT_RIGHT ; DoNthMenu/SetUpMenu
shift_const STATICMENU_ENABLE_START ; DoNthMenu/SetUpMenu
shift_const STATICMENU_PLACE_TITLE ; VerticalMenu
shift_const STATICMENU_WRAP ; All
shift_const STATICMENU_NO_TOP_SPACING ; VerticalMenu/_2DMenu
shift_const STATICMENU_CURSOR ; VerticalMenu/_2DMenu
shift_const STATICMENU_DISABLE_B ; 0 ; VerticalMenu/_2DMenu
shift_const STATICMENU_ENABLE_SELECT ; 1 ; VerticalMenu/_2DMenu
shift_const STATICMENU_ENABLE_LEFT_RIGHT ; 2 ; DoNthMenu/SetUpMenu
shift_const STATICMENU_ENABLE_START ; 3 ; DoNthMenu/SetUpMenu
shift_const STATICMENU_PLACE_TITLE ; 4 ; VerticalMenu
shift_const STATICMENU_WRAP ; 5 ; All
shift_const STATICMENU_NO_TOP_SPACING ; 6 ; VerticalMenu/_2DMenu
shift_const STATICMENU_CURSOR ; 7 ; VerticalMenu/_2DMenu

; ScrollingMenu MenuData flags
const_def
shift_const SCROLLINGMENU_CALL_FUNCTION1_CANCEL
shift_const SCROLLINGMENU_CALL_FUNCTION3_NO_SWITCH
shift_const SCROLLINGMENU_ENABLE_LEFT
shift_const SCROLLINGMENU_ENABLE_RIGHT
shift_const SCROLLINGMENU_DISPLAY_ARROWS
shift_const SCROLLINGMENU_ENABLE_FUNCTION3
shift_const SCROLLINGMENU_ENABLE_START
shift_const SCROLLINGMENU_ENABLE_SELECT
shift_const SCROLLINGMENU_CALL_FUNCTION1_CANCEL ; 0
shift_const SCROLLINGMENU_CALL_FUNCTION3_NO_SWITCH ; 1
shift_const SCROLLINGMENU_ENABLE_RIGHT ; 2
shift_const SCROLLINGMENU_ENABLE_LEFT ; 3
shift_const SCROLLINGMENU_DISPLAY_ARROWS ; 4
shift_const SCROLLINGMENU_ENABLE_FUNCTION3 ; 5
shift_const SCROLLINGMENU_ENABLE_START ; 6
shift_const SCROLLINGMENU_ENABLE_SELECT ; 7

; ScrollingMenu items structure format
const_def 1
const SCROLLINGMENU_ITEMS_NORMAL
const SCROLLINGMENU_ITEMS_QUANTITY
const SCROLLINGMENU_ITEMS_NORMAL ; 1
const SCROLLINGMENU_ITEMS_QUANTITY ; 2

; _2DMenu more flags
const_def
shift_const _2DMENU_EXIT_RIGHT ; 0
shift_const _2DMENU_EXIT_LEFT ; 1
shift_const _2DMENU_EXIT_UP ; 2
shift_const _2DMENU_EXIT_DOWN ; 3
shift_const _2DMENU_WRAP_LEFT_RIGHT ; 4
shift_const _2DMENU_WRAP_UP_DOWN ; 5
shift_const _2DMENU_ENABLE_SPRITE_ANIMS ; 6
shift_const _2DMENU_DISABLE_JOYPAD_FILTER ; 7

; _2DMenu more flags 2
const_def
const_skip 7
shift_const _2DMENU_EXITING ; 7

; MonMenuOptions indexes (see data/mon_menu.asm)
; used by PokemonActionSubmenu (see engine/pokemon/mon_menu.asm)
Expand Down
8 changes: 5 additions & 3 deletions constants/music_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@
DEF NUM_MUSIC_SONGS EQU const_value

; GetMapMusic picks music for this value (see home/map.asm)
DEF MUSIC_MAHOGANY_MART EQU $64
; this overlaps with a Crystal song ID, but not one that is used for map music
DEF MUSIC_MAHOGANY_MART EQU MUSIC_SUICUNE_BATTLE

; ExitPokegearRadio_HandleMusic uses these values
DEF RESTART_MAP_MUSIC EQU $fe
DEF ENTER_MAP_MUSIC EQU $ff

; GetMapMusic picks music for this bit flag
DEF RADIO_TOWER_MUSIC_F EQU 7
DEF RADIO_TOWER_MUSIC EQU 1 << RADIO_TOWER_MUSIC_F
const_def 7
shift_const RADIO_TOWER_MUSIC
assert NUM_MUSIC_SONGS <= RADIO_TOWER_MUSIC, "song IDs overlap RADIO_TOWER_MUSIC"
25 changes: 18 additions & 7 deletions constants/printer_constants.asm
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
; wPrinterStatus
const_def 1
const PRINTER_STATUS_CHECKING
const PRINTER_STATUS_TRANSMITTING
const PRINTER_STATUS_PRINTING
const PRINTER_ERROR_1
const PRINTER_ERROR_2
const PRINTER_ERROR_3
const PRINTER_ERROR_4
const PRINTER_STATUS_CHECKING ; 1
const PRINTER_STATUS_TRANSMITTING ; 2
const PRINTER_STATUS_PRINTING ; 3
const PRINTER_ERROR_1 ; 4
const PRINTER_ERROR_2 ; 5
const PRINTER_ERROR_3 ; 6
const PRINTER_ERROR_4 ; 7

; wPrinterStatusFlags
const_def 5
shift_const PRINTER_STATUS_ERROR_3 ; 5
shift_const PRINTER_STATUS_ERROR_4 ; 6
shift_const PRINTER_STATUS_ERROR_1 ; 7

; wPrinterConnectionOpen
const_def
const PRINTER_CONNECTION_OPEN
const PRINTER_CONNECTION_SUCCESS
Loading