Skip to content

Commit

Permalink
Identify more bit flags
Browse files Browse the repository at this point in the history
  • Loading branch information
Rangi42 committed Oct 18, 2024
1 parent 80d17e1 commit 7ebd646
Show file tree
Hide file tree
Showing 71 changed files with 445 additions and 388 deletions.
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 @@ -216,6 +221,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
8 changes: 5 additions & 3 deletions constants/hardware_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,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 @@ -62,6 +62,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
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 @@ -21,3 +21,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
23 changes: 19 additions & 4 deletions constants/menu_constants.asm
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
; 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
const_skip 2
shift_const MENU_NO_CLICK_SFX
shift_const MENU_SPRITE_ANIMS
shift_const MENU_UNUSED_3
shift_const MENU_UNUSED
shift_const MENU_BACKUP_TILES
shift_const MENU_BACKUP_TILES_2

Expand All @@ -25,8 +24,8 @@
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_ENABLE_LEFT
shift_const SCROLLINGMENU_DISPLAY_ARROWS
shift_const SCROLLINGMENU_ENABLE_FUNCTION3
shift_const SCROLLINGMENU_ENABLE_START
Expand All @@ -37,6 +36,22 @@
const SCROLLINGMENU_ITEMS_NORMAL
const SCROLLINGMENU_ITEMS_QUANTITY

; _2DMenu more flags
const_def
shift_const _2DMENU_EXIT_RIGHT
shift_const _2DMENU_EXIT_LEFT
shift_const _2DMENU_EXIT_UP
shift_const _2DMENU_EXIT_DOWN
shift_const _2DMENU_WRAP_LEFT_RIGHT
shift_const _2DMENU_WRAP_UP_DOWN
shift_const _2DMENU_ENABLE_SPRITE_ANIMS
shift_const _2DMENU_DISABLE_JOYPAD_FILTER

; _2DMenu more flags 2
const_def
const_skip 7
shift_const _2DMENU_EXITING

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

; GetMapMusic picks music for this value (see home/map.asm)
DEF MUSIC_MAHOGANY_MART EQU $64
DEF MUSIC_MAHOGANY_MART EQU 100
assert NUM_MUSIC_SONGS <= MUSIC_MAHOGANY_MART, "song IDs overlap MUSIC_MAHOGANY_MART"

; 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"
11 changes: 11 additions & 0 deletions constants/printer_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@
const PRINTER_ERROR_2
const PRINTER_ERROR_3
const PRINTER_ERROR_4

; wPrinterStatusFlags
const_def 5
shift_const PRINTER_STATUS_ERROR_3
shift_const PRINTER_STATUS_ERROR_4
shift_const PRINTER_STATUS_ERROR_1

; wPrinterConnectionOpen
const_def
const PRINTER_CONNECTION_OPEN
const PRINTER_CONNECTION_SUCCESS
55 changes: 45 additions & 10 deletions constants/ram_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ DEF GBPRINTER_DARKEST EQU $7f
const_def
const MENU_ACCOUNT ; 0

; wDST::
DEF DST_F EQU 7

; wWalkingDirection::
const_def -1
const STANDING ; -1
Expand Down Expand Up @@ -96,6 +99,10 @@ DEF LAST_12_SPRITE_OAM_STRUCTS_RESERVED_F EQU 1
DEF TEXT_STATE_F EQU 6
DEF SCRIPTED_MOVEMENT_STATE_F EQU 7

; wSpriteFlags::
DEF SPRITES_SKIP_WALKING_GFX_F EQU 6
DEF SPRITES_SKIP_STANDING_GFX_F EQU 7

; wPokemonWithdrawDepositParameter::
DEF PC_WITHDRAW EQU 0
DEF PC_DEPOSIT EQU 1
Expand All @@ -118,21 +125,23 @@ DEF INIT_OTHER_ITEM_LIST EQU 3
DEF INIT_PLAYEROT_LIST EQU 4
DEF INIT_MON_LIST EQU 5

; wEnteredMapFromContinue::
DEF ENTERED_MAP_FROM_CONTINUE_2 EQU 2
DEF ENTERED_MAP_FROM_CONTINUE_7 EQU 7

; wTimeOfDay::
const_def
const MORN_F ; 0
const DAY_F ; 1
const NITE_F ; 2
const DARKNESS_F ; 3
shift_const MORN ; 0
shift_const DAY ; 1
shift_const NITE ; 2
shift_const DARKNESS ; 3
DEF NUM_DAYTIMES EQU const_value

DEF MORN EQU 1 << MORN_F
DEF DAY EQU 1 << DAY_F
DEF NITE EQU 1 << NITE_F
DEF DARKNESS EQU 1 << DARKNESS_F

DEF ANYTIME EQU MORN | DAY | NITE

; wTimeOfDayPalFlags
DEF FORCED_PALSET_F EQU 7

; wTimeOfDayPalset::
DEF DARKNESS_PALSET EQU (DARKNESS_F << 6) | (DARKNESS_F << 4) | (DARKNESS_F << 2) | DARKNESS_F

Expand All @@ -143,6 +152,10 @@ DEF DARKNESS_PALSET EQU (DARKNESS_F << 6) | (DARKNESS_F << 4) | (DARKNESS_F << 2
const BATTLEANIM_IN_LOOP_F ; 2
const BATTLEANIM_KEEPSPRITES_F ; 3

; wBattleScriptFlags::
DEF BATTLESCRIPT_WILD_F EQU 0
DEF BATTLESCRIPT_SCRIPTED_F EQU 7

; wPlayerSpriteSetupFlags::
DEF PLAYERSPRITESETUP_FACING_MASK EQU %11
DEF PLAYERSPRITESETUP_FEMALE_TO_MALE_F EQU 2
Expand All @@ -163,7 +176,20 @@ DEF PLAYERSPRITESETUP_RESET_ACTION_F EQU 7
const MAPEVENTS_OFF ; 1

; wScriptFlags::
DEF SCRIPT_RUNNING EQU 2
const_def
const SCRIPT_FLAG_0
const SCRIPT_FLAG_1
const SCRIPT_RUNNING
const RUN_DEFERRED_SCRIPT

; wEnabledPlayerEvents::
const_def
const PLAYEREVENTS_COUNT_STEPS
const PLAYEREVENTS_COORD_EVENTS
const PLAYEREVENTS_WARPS_AND_CONNECTIONS
const_skip
const PLAYEREVENTS_WILD_ENCOUNTERS
const PLAYEREVENTS_5

; wScriptMode::
const_def
Expand All @@ -176,6 +202,9 @@ DEF SCRIPT_RUNNING EQU 2
DEF SPAWN_LANCE EQU 1
DEF SPAWN_RED EQU 2

; wGameTimeCap::
DEF GAME_TIME_CAPPED EQU 0

; wCurDay::
const_def
const SUNDAY ; 0
Expand Down Expand Up @@ -300,6 +329,12 @@ DEF DAYCARELADY_HAS_MON_F EQU 0
; shared flag between wDayCareMan and wDayCareLady
DEF DAYCARE_INTRO_SEEN_F EQU 7

; sRTCStatusFlags::
const_def 5
shift_const RTC_DAYS_EXCEED_139
shift_const RTC_DAYS_EXCEED_255
shift_const RTC_RESET

; hVBlank::
; VBlankHandlers indexes (see home/vblank.asm)
const_def
Expand Down
Loading

0 comments on commit 7ebd646

Please sign in to comment.