Identify more bit flags (#120)
Some checks are pending
CI / build (push) Waiting to run

This commit is contained in:
Sylvie 2024-11-28 14:50:00 -05:00 committed by GitHub
parent 8e9706d8a4
commit 7ebc4324db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
71 changed files with 487 additions and 429 deletions

View File

@ -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

View File

@ -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
@ -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

View File

@ -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
@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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"

View File

@ -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

View File

@ -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
@ -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
@ -118,21 +125,23 @@ DEF INIT_OTHER_ITEM_LIST EQU 3
DEF INIT_PLAYEROT_LIST EQU 4
DEF INIT_MON_LIST EQU 5
; wUnusedReanchorBGMapFlags::
DEF UNUSED_REANCHOR_BG_MAP_2 EQU 2
DEF UNUSED_REANCHOR_BG_MAP_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
@ -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
@ -163,7 +176,20 @@ DEF PLAYERSPRITESETUP_RESET_ACTION_F EQU 7
const MAPEVENTS_OFF ; 1
; wScriptFlags::
DEF SCRIPT_RUNNING EQU 2
const_def
const UNUSED_SCRIPT_FLAG_0 ; 0
const UNUSED_SCRIPT_FLAG_1 ; 1
const SCRIPT_RUNNING ; 2
const RUN_DEFERRED_SCRIPT ; 3
; wEnabledPlayerEvents::
const_def
const PLAYEREVENTS_COUNT_STEPS ; 0
const PLAYEREVENTS_COORD_EVENTS ; 1
const PLAYEREVENTS_WARPS_AND_CONNECTIONS ; 2
const_skip
const PLAYEREVENTS_WILD_ENCOUNTERS ; 4
const PLAYEREVENTS_UNUSED ; 5
; wScriptMode::
const_def
@ -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
@ -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 ; 5
shift_const RTC_DAYS_EXCEED_255 ; 6
shift_const RTC_RESET ; 7
; hVBlank::
; VBlankHandlers indexes (see home/vblank.asm)
const_def

View File

@ -33,16 +33,11 @@ DEF TEXTBOX_INNERY EQU TEXTBOX_Y + 2
; see gfx/frames/*.png
DEF TEXTBOX_FRAME_TILES EQU 6
; PrintNum bit flags
; PrintNum bit flags (see engine/math/print_num.asm)
const_def 5
const PRINTNUM_MONEY_F ; 5
const PRINTNUM_LEFTALIGN_F ; 6
const PRINTNUM_LEADINGZEROS_F ; 7
; PrintNum arguments (see engine/math/print_num.asm)
DEF PRINTNUM_MONEY EQU 1 << PRINTNUM_MONEY_F
DEF PRINTNUM_LEFTALIGN EQU 1 << PRINTNUM_LEFTALIGN_F
DEF PRINTNUM_LEADINGZEROS EQU 1 << PRINTNUM_LEADINGZEROS_F
shift_const PRINTNUM_MONEY ; 5
shift_const PRINTNUM_LEFTALIGN ; 6
shift_const PRINTNUM_LEADINGZEROS ; 7
; character sets (see charmap.asm)
DEF FIRST_REGULAR_TEXT_CHAR EQU $60

View File

@ -24,20 +24,13 @@ DEF NO_AI EQU 0
; TRNATTR_AI_ITEM_SWITCH bit flags
const_def
const SWITCH_OFTEN_F ; 0
const SWITCH_RARELY_F ; 1
const SWITCH_SOMETIMES_F ; 2
const_skip ; 3
const ALWAYS_USE_F ; 4
const UNKNOWN_USE_F ; 5
const CONTEXT_USE_F ; 6
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
shift_const SWITCH_OFTEN ; 0
shift_const SWITCH_RARELY ; 1
shift_const SWITCH_SOMETIMES ; 2
const_skip ; 3
shift_const ALWAYS_USE ; 4
shift_const UNKNOWN_USE ; 5
shift_const CONTEXT_USE ; 6
; TrainerTypes indexes (see engine/battle/read_trainer_party.asm)
const_def

View File

@ -1,6 +1,14 @@
MACRO add_mapsetup
\1_MapSetupCmd:
dba \1
; A second argument of TRUE indicates taking a parameter.
if _NARG < 2
dba \1
elif \2
db (1 << MAPSETUPSCRIPT_HAS_PARAM_F) | BANK(\1)
dw \1
else
dba \1
endc
ENDM
MapSetupCommands:

View File

@ -17,6 +17,10 @@ MapSetupScripts:
; valid commands are listed in MapSetupCommands (see data/maps/setup_script_pointers.asm)
MACRO mapsetup
db (\1_MapSetupCmd - MapSetupCommands) / 3
; `mapsetup` takes a parameter if `add_mapsetup` indicates taking one.
if _NARG == 2
db \2 ; param
endc
ENDM
MapSetupScript_Teleport:

View File

@ -178,7 +178,7 @@ AI_Redundant:
.FutureSight:
; BUG: AI does not discourage Future Sight when it's already been used (see docs/bugs_and_glitches.md)
ld a, [wEnemyScreens]
bit 5, a
bit SCREENS_UNUSED, a
ret
.Heal:

View File

@ -1288,7 +1288,7 @@ BattleCommand_Stab:
ld [wCurDamage + 1], a
ld hl, wTypeModifier
set 7, [hl]
set STAB_DAMAGE_F, [hl]
.SkipStab:
ld a, BATTLE_VARS_MOVE_TYPE
@ -1327,7 +1327,7 @@ BattleCommand_Stab:
push bc
inc hl
ld a, [wTypeModifier]
and %10000000
and STAB_DAMAGE
ld b, a
; If the target is immune to the move, treat it as a miss and calculate the damage as 0
ld a, [hl]
@ -1393,7 +1393,7 @@ BattleCommand_Stab:
ld a, [wTypeMatchup]
ld b, a
ld a, [wTypeModifier]
and %10000000
and STAB_DAMAGE
or b
ld [wTypeModifier], a
ret
@ -2210,7 +2210,7 @@ GetFailureResultText:
ld hl, DoesntAffectText
ld de, DoesntAffectText
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
jr z, .got_text
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
@ -2235,7 +2235,7 @@ GetFailureResultText:
ret nz
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
ret z
ld hl, wCurDamage
@ -2280,7 +2280,7 @@ BattleCommand_BideFailText:
ret z
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
jp z, PrintDoesntAffect
jp PrintButItFailed
@ -2335,7 +2335,7 @@ BattleCommand_SuperEffectiveLoopText:
BattleCommand_SuperEffectiveText:
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
cp EFFECTIVE
ret z
ld hl, SuperEffectiveText
@ -3644,7 +3644,7 @@ BattleCommand_PoisonTarget:
and a
ret nz
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
ret z
call CheckIfTargetIsPoisonType
ret z
@ -3672,7 +3672,7 @@ BattleCommand_PoisonTarget:
BattleCommand_Poison:
ld hl, DoesntAffectText
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
jp z, .failed
call CheckIfTargetIsPoisonType
@ -3902,7 +3902,7 @@ BattleCommand_BurnTarget:
and a
jp nz, Defrost
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
ret z
call CheckMoveTypeMatchesTarget ; Don't burn a Fire-type
ret z
@ -3966,7 +3966,7 @@ BattleCommand_FreezeTarget:
and a
ret nz
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
ret z
ld a, [wBattleWeather]
cp WEATHER_SUN
@ -4017,7 +4017,7 @@ BattleCommand_ParalyzeTarget:
and a
ret nz
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
ret z
call GetOpponentItem
ld a, b
@ -5377,7 +5377,7 @@ BattleCommand_HeldFlinch:
BattleCommand_OHKO:
call ResetDamage
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
jr z, .no_effect
ld hl, wEnemyMonLevel
ld de, wBattleMonLevel
@ -5791,7 +5791,7 @@ BattleCommand_Paralyze:
bit PAR, a
jr nz, .paralyzed
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
jr z, .didnt_affect
call GetOpponentItem
ld a, b

View File

@ -46,7 +46,7 @@ BattleCommand_RolloutPower:
ld a, BATTLE_VARS_SUBSTATUS1
call GetBattleVarAddr
res 6, [hl]
res SUBSTATUS_ROLLOUT, [hl]
ret
.hit

View File

@ -36,7 +36,7 @@ BattleAnimRunScript:
jr nz, .hi_byte
ld a, [wOptions]
bit 7, a
bit BATTLE_SCENE, a
jr nz, .disabled
vc_hook Reduce_move_anim_flashing
@ -1206,7 +1206,7 @@ PlayHitSound:
.okay
ld a, [wTypeModifier]
and $7f
and EFFECTIVENESS_MASK
ret z
cp EFFECTIVE

View File

@ -236,7 +236,7 @@ InitBattleAnimBuffer:
add hl, bc
ld a, [hl]
ld [wBattleAnimTempOAMFlags], a
bit 0, [hl]
bit BATTLEANIMSTRUCT_OAMFLAGS_FIX_COORDS_F, [hl]
ret z
ld hl, BATTLEANIMSTRUCT_XCOORD

View File

@ -807,6 +807,9 @@ BattleAnimFunction_FireBlast:
ret
BattleAnimFunction_RazorLeaf:
; Object moves at an arc
; Obj Param: Bit 6 defines offset from base frameset BATTLE_ANIM_FRAMESET_RAZOR_LEAF_2
; Rest defines arc radius
call BattleAnim_AnonJumptable
.anon_dw
dw .zero
@ -935,7 +938,7 @@ BattleAnimFunction_RazorLeaf:
call ReinitBattleAnimFrameset
ld hl, BATTLEANIMSTRUCT_OAMFLAGS
add hl, bc
res 5, [hl]
res OAM_X_FLIP, [hl]
.four
.five
.six
@ -995,7 +998,7 @@ BattleAnim_ScatterHorizontal:
BattleAnimFunction_RockSmash:
; Object moves at an arc
; Obj Param: Bit 7 makes arc flip horizontally
; Bit 6 defines offset from base frameset FRAMESET_19
; Bit 6 defines offset from base frameset BATTLE_ANIM_FRAMESET_BIG_ROCK
; Rest defines arc radius
call BattleAnim_AnonJumptable
.anon_dw
@ -1308,7 +1311,7 @@ BattleAnimFunction_WaterGun:
ld hl, BATTLEANIMSTRUCT_OAMFLAGS
add hl, bc
ld a, [hl]
and $1
and 1 << BATTLEANIMSTRUCT_OAMFLAGS_FIX_COORDS_F
ld [hl], a
.two
ld hl, BATTLEANIMSTRUCT_YOFFSET
@ -2026,7 +2029,7 @@ BattleAnimFunction_Kick:
inc [hl]
ld hl, BATTLEANIMSTRUCT_OAMFLAGS
add hl, bc
set 0, [hl]
set BATTLEANIMSTRUCT_OAMFLAGS_FIX_COORDS_F, [hl]
ld hl, BATTLEANIMSTRUCT_FIX_Y
add hl, bc
ld [hl], $90

View File

@ -329,7 +329,7 @@ DebugRoomMenu_TimerReset:
ld a, BANK(sRTCStatusFlags)
call OpenSRAM
ld hl, sRTCStatusFlags
set 7, [hl]
set RTC_RESET_F, [hl]
call CloseSRAM
ret
@ -426,7 +426,7 @@ DebugRoom_EditPagedValues:
call DelayFrame
call JoyTextDelay
ldh a, [hJoyLast]
bit 1, a
bit B_BUTTON_F, a
jr nz, .done
ld hl, .continue
push hl

View File

@ -227,17 +227,21 @@ Cut_SpawnLeaf:
pop de
ret
; cut leaf spawn coords table bits
DEF CUT_LEAF_SPAWN_RIGHT_F EQU 0
DEF CUT_LEAF_SPAWN_BOTTOM_F EQU 1
Cut_GetLeafSpawnCoords:
ld de, 0
ld a, [wPlayerMetatileX]
bit 0, a
bit 0, a ; even or odd?
jr z, .left_side
set 0, e
set CUT_LEAF_SPAWN_RIGHT_F, e
.left_side
ld a, [wPlayerMetatileY]
bit 0, a
bit 0, a ; even or odd?
jr z, .top_side
set 1, e
set CUT_LEAF_SPAWN_BOTTOM_F, e
.top_side
ld a, [wPlayerDirection]
and %00001100

View File

@ -284,7 +284,7 @@ BankOfMom:
DSTChecks:
; check the time; avoid changing DST if doing so would change the current day
ld a, [wDST]
bit 7, a
bit DST_F, a
ldh a, [hHours]
jr z, .NotDST
and a ; within one hour of 00:00?
@ -313,14 +313,14 @@ DSTChecks:
call .ClearBox
bccoord 1, 14
ld a, [wDST]
bit 7, a
bit DST_F, a
jr z, .SetDST
ld hl, .TimesetAskNotDSTText
call PrintTextboxTextAt
call YesNoBox
ret c
ld a, [wDST]
res 7, a
res DST_F, a
ld [wDST], a
call .SetClockBack
predef UpdateTimePredef
@ -336,7 +336,7 @@ DSTChecks:
call YesNoBox
ret c
ld a, [wDST]
set 7, a
set DST_F, a
ld [wDST], a
call .SetClockForward
predef UpdateTimePredef

View File

@ -605,7 +605,7 @@ FlyFunction:
callasm FlyToAnim
special WaitSFX
special UpdatePlayerSprite
callasm _ClearSprites
callasm LoadWalkingSpritesGFX
end
WaterfallFunction:

View File

@ -71,7 +71,7 @@ _CardFlip:
call WaitSFX
call ClearBGPalettes
ld hl, wOptions
res 4, [hl]
res NO_TEXT_SCROLL, [hl]
ret
.CardFlip:

View File

@ -223,7 +223,7 @@ TMHM_JoypadLoop:
xor a
ldh [hBGMapMode], a
ld a, [w2DMenuFlags2]
bit 7, a
bit _2DMENU_EXITING_F, a
jp nz, TMHM_ScrollPocket
ld a, b
ld [wMenuJoypad], a
@ -299,8 +299,8 @@ TMHM_ExitPocket:
TMHM_ScrollPocket:
ld a, b
bit 7, a
jr nz, .skip
bit D_DOWN_F, a
jr nz, .down
ld hl, wTMHMPocketScrollPosition
ld a, [hl]
and a
@ -309,7 +309,7 @@ TMHM_ScrollPocket:
call TMHM_DisplayPocketItems
jp TMHM_ShowTMMoveDescription
.skip
.down
call TMHM_GetCurrentPocketPosition
ld b, 5
.loop

View File

@ -1188,7 +1188,7 @@ LinkTrade_OTPartyMenu:
ld [wMenuCursorX], a
ln a, 1, 0
ld [w2DMenuCursorOffsets], a
ld a, MENU_UNUSED_3
ld a, MENU_UNUSED
ld [w2DMenuFlags1], a
xor a
ld [w2DMenuFlags2], a
@ -1243,7 +1243,7 @@ LinkTrade_PlayerPartyMenu:
ld [wMenuCursorX], a
ln a, 1, 0
ld [w2DMenuCursorOffsets], a
ld a, MENU_UNUSED_3
ld a, MENU_UNUSED
ld [w2DMenuFlags1], a
xor a
ld [w2DMenuFlags2], a
@ -1607,7 +1607,7 @@ LinkTrade:
push af
call SafeLoadTempTilemapToTilemap
pop af
bit 1, a
bit B_BUTTON_F, a
jr nz, .canceled
ld a, [wMenuCursorY]
dec a

View File

@ -1102,7 +1102,7 @@ ReceiveEmptyIRDataBlock:
MysteryGift_UpdateJoypad:
; We can only get four inputs at a time.
; We take d-pad first for no particular reason.
ld a, R_DPAD
ld a, 1 << rJOYP_DPAD
ldh [rJOYP], a
; Read twice to give the request time to take.
ldh a, [rJOYP]
@ -1119,7 +1119,7 @@ MysteryGift_UpdateJoypad:
; Buttons make 8 total inputs (A, B, Select, Start).
; We can fit this into one byte.
ld a, R_BUTTONS
ld a, 1 << rJOYP_BUTTONS
ldh [rJOYP], a
; Wait for input to stabilize.
rept 6

View File

@ -327,7 +327,7 @@ ConfirmContinue:
Continue_CheckRTC_RestartClock:
call CheckRTCStatus
and %10000000 ; Day count exceeded 16383
and RTC_RESET
jr z, .pass
farcall RestartClock
ld a, c
@ -358,7 +358,7 @@ FinishContinueFunction:
DisplaySaveInfoOnContinue:
call CheckRTCStatus
and %10000000
and RTC_RESET
jr z, .clock_ok
lb de, 4, 8
call DisplayContinueDataWithRTCError
@ -1071,7 +1071,7 @@ ResetClock:
jp Init
UpdateTitleTrailSprite:
; If bit 0 or 1 of [wTitleScreenTimer] is set, we don't need to be here.
; Only update every 4 seconds, when the low 2 bits of [wTitleScreenTimer] are 0.
ld a, [wTitleScreenTimer]
and %00000011
ret nz
@ -1085,7 +1085,7 @@ IF DEF(_GOLD)
add hl, hl
ld de, .TitleTrailCoords
add hl, de
; If bit 2 of [wTitleScreenTimer] is set, get the second coords; else, get the first coords
; Every 8 seconds (i.e. every other update), get the second coords; else, get the first coords
ld a, [wTitleScreenTimer]
and %00000100
srl a

View File

@ -180,7 +180,7 @@ MainMenu_PrintCurrentTimeAndDay:
.PlaceBox:
call CheckRTCStatus
and $80
and RTC_RESET
jr nz, .TimeFail
hlcoord 0, 12
ld b, 4
@ -197,7 +197,7 @@ MainMenu_PrintCurrentTimeAndDay:
and a
ret z
call CheckRTCStatus
and %10000000 ; Day count exceeded 16383
and RTC_RESET
jp nz, .PrintTimeNotSet
call UpdateTime
hlcoord 1, 13

View File

@ -9,7 +9,7 @@ _2DMenu_::
call StaticMenuJoypad
call MenuClickSound
ld a, [wMenuDataFlags]
bit 1, a
bit STATICMENU_ENABLE_SELECT_F, a
jr z, .skip
call GetMenuJoypad
bit SELECT_F, a
@ -17,7 +17,7 @@ _2DMenu_::
.skip
ld a, [wMenuDataFlags]
bit 0, a
bit STATICMENU_DISABLE_B_F, a
jr nz, .skip2
call GetMenuJoypad
bit B_BUTTON_F, a
@ -159,10 +159,10 @@ Init2DMenuCursorPosition:
ld [hli], a
ld [hld], a
ld a, [wMenuDataFlags]
bit 5, a
bit STATICMENU_WRAP_F, a
ret z
set 5, [hl]
set 4, [hl]
set _2DMENU_WRAP_UP_DOWN_F, [hl]
set _2DMENU_WRAP_LEFT_RIGHT_F, [hl]
ret
.InitFlags_b:
@ -174,11 +174,11 @@ Init2DMenuCursorPosition:
.InitFlags_c:
ld hl, wMenuDataFlags
ld a, A_BUTTON
bit 0, [hl]
bit STATICMENU_DISABLE_B_F, [hl]
jr nz, .skip
or B_BUTTON
.skip
bit 1, [hl]
bit STATICMENU_ENABLE_SELECT_F, [hl]
jr z, .skip2
or SELECT
.skip2
@ -189,7 +189,7 @@ _StaticMenuJoypad::
call Place2DMenuCursor
_ScrollingMenuJoypad::
ld hl, w2DMenuFlags2
res 7, [hl]
res _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
ldh a, [hBGMapMode]
push af
@ -210,7 +210,7 @@ _ScrollingMenuJoypad::
call Menu_WasButtonPressed
jr c, .pressed
ld a, [w2DMenuFlags1]
bit 7, a
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, a
jp nz, .done
jr .loopRTC
@ -219,7 +219,7 @@ _ScrollingMenuJoypad::
call _2DMenuInterpretJoypad
jp c, .done
ld a, [w2DMenuFlags1]
bit 7, a
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, a
jr nz, .done
call GetMenuJoypad
ld b, a
@ -235,7 +235,7 @@ _ScrollingMenuJoypad::
Menu_WasButtonPressed:
ld a, [w2DMenuFlags1]
bit 6, a
bit _2DMENU_ENABLE_SPRITE_ANIMS_F, a
jr z, .skip_to_joypad
callfar PlaySpriteAnimationsAndDelayFrame
@ -271,7 +271,7 @@ _2DMenuInterpretJoypad:
.set_bit_7
ld hl, w2DMenuFlags2
set 7, [hl]
set _2DMENU_EXITING_F, [hl]
scf
ret
@ -286,9 +286,9 @@ _2DMenuInterpretJoypad:
.check_wrap_around_down
ld a, [w2DMenuFlags1]
bit 5, a
bit _2DMENU_WRAP_UP_DOWN_F, a
jr nz, .wrap_around_down
bit 3, a
bit _2DMENU_EXIT_DOWN_F, a
jp nz, .set_bit_7
xor a
ret
@ -309,9 +309,9 @@ _2DMenuInterpretJoypad:
.check_wrap_around_up
ld a, [w2DMenuFlags1]
bit 5, a
bit _2DMENU_WRAP_UP_DOWN_F, a
jr nz, .wrap_around_up
bit 2, a
bit _2DMENU_EXIT_UP_F, a
jp nz, .set_bit_7
xor a
ret
@ -333,9 +333,9 @@ _2DMenuInterpretJoypad:
.check_wrap_around_left
ld a, [w2DMenuFlags1]
bit 4, a
bit _2DMENU_WRAP_LEFT_RIGHT_F, a
jr nz, .wrap_around_left
bit 1, a
bit _2DMENU_EXIT_LEFT_F, a
jp nz, .set_bit_7
xor a
ret
@ -357,9 +357,9 @@ _2DMenuInterpretJoypad:
.check_wrap_around_right
ld a, [w2DMenuFlags1]
bit 4, a
bit _2DMENU_WRAP_LEFT_RIGHT_F, a
jr nz, .wrap_around_right
bit 0, a
bit _2DMENU_EXIT_RIGHT_F, a
jp nz, .set_bit_7
xor a
ret
@ -454,21 +454,22 @@ _PushWindow::
dec b
jr nz, .loop
; If bit 6 or 7 of the menu flags is set, set bit 0 of the address
; at 7:[wWindowStackPointer], and draw the menu using the coordinates from the header.
; Otherwise, reset bit 0 of 7:[wWindowStackPointer].
; If bit MENU_BACKUP_TILES_F or MENU_BACKUP_TILES_2_F of the menu flags is set,
; also set bit MENU_RESTORE_TILES_F of the address at 7:[wWindowStackPointer],
; and draw the menu using the coordinates from the header.
; Otherwise, reset bit MENU_RESTORE_TILES_F of 7:[wWindowStackPointer].
ld a, [wMenuFlags]
bit 6, a
jr nz, .bit_6
bit 7, a
jr z, .not_bit_7
bit MENU_BACKUP_TILES_F, a
jr nz, .backup_tiles
bit MENU_BACKUP_TILES_2_F, a
jr z, .no_backup_tiles
.bit_6
.backup_tiles
ld hl, wWindowStackPointer
ld a, [hli]
ld h, [hl]
ld l, a
set 0, [hl]
set MENU_RESTORE_TILES_F, [hl]
call MenuBoxCoord2Tile
call GetMenuBoxDims
inc b
@ -494,13 +495,13 @@ _PushWindow::
jr nz, .row
jr .done
.not_bit_7
.no_backup_tiles
pop hl ; last-pushed register was de
push hl
ld a, [hld]
ld l, [hl]
ld h, a
res 0, [hl]
res MENU_RESTORE_TILES_F, [hl]
.done
pop hl
@ -541,7 +542,7 @@ _ExitMenu::
ld [wWindowStackPointer + 1], a
call PopWindow
ld a, [wMenuFlags]
bit 0, a
bit MENU_RESTORE_TILES_F, a
jr z, .loop
ld d, h
ld e, l
@ -614,7 +615,7 @@ _InitVerticalMenuCursor::
ld hl, w2DMenuCursorInitY
ld a, [wMenuBorderTopCoord]
inc a
bit 6, b
bit STATICMENU_NO_TOP_SPACING_F, b
jr nz, .skip_offset
inc a
.skip_offset
@ -630,15 +631,15 @@ _InitVerticalMenuCursor::
ld a, 1
ld [hli], a
; w2DMenuFlags1
ld [hl], $0
bit 5, b
ld [hl], 0
bit STATICMENU_WRAP_F, b
jr z, .skip_bit_5
set 5, [hl]
set _2DMENU_WRAP_UP_DOWN_F, [hl]
.skip_bit_5
ld a, [wMenuFlags]
bit 4, a
bit MENU_SPRITE_ANIMS_F, a
jr z, .skip_bit_6
set 6, [hl]
set _2DMENU_ENABLE_SPRITE_ANIMS_F, [hl]
.skip_bit_6
inc hl
; w2DMenuFlags2
@ -649,7 +650,7 @@ _InitVerticalMenuCursor::
ld [hli], a
; wMenuJoypadFilter
ld a, A_BUTTON
bit 0, b
bit STATICMENU_DISABLE_B_F, b
jr nz, .skip_bit_1
add B_BUTTON
.skip_bit_1

View File

@ -110,7 +110,7 @@ ScrollingMenuJoyAction:
.select
ld a, [wMenuDataFlags]
bit 7, a
bit SCROLLINGMENU_ENABLE_SELECT_F, a
jp z, xor_a_dec_a
ld a, [wMenuCursorY]
dec a
@ -127,7 +127,7 @@ ScrollingMenuJoyAction:
.start
ld a, [wMenuDataFlags]
bit 6, a
bit SCROLLINGMENU_ENABLE_START_F, a
jp z, xor_a_dec_a
ld a, START
scf
@ -135,10 +135,10 @@ ScrollingMenuJoyAction:
.d_left
ld hl, w2DMenuFlags2
bit 7, [hl]
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
jp z, xor_a_dec_a
ld a, [wMenuDataFlags]
bit 3, a
bit SCROLLINGMENU_ENABLE_LEFT_F, a
jp z, xor_a_dec_a
ld a, D_LEFT
scf
@ -146,10 +146,10 @@ ScrollingMenuJoyAction:
.d_right
ld hl, w2DMenuFlags2
bit 7, [hl]
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
jp z, xor_a_dec_a
ld a, [wMenuDataFlags]
bit 2, a
bit SCROLLINGMENU_ENABLE_RIGHT_F, a
jp z, xor_a_dec_a
ld a, D_RIGHT
scf
@ -157,7 +157,7 @@ ScrollingMenuJoyAction:
.d_up
ld hl, w2DMenuFlags2
bit 7, [hl]
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
jp z, xor_a
ld hl, wMenuScrollPosition
ld a, [hl]
@ -171,7 +171,7 @@ ScrollingMenuJoyAction:
.d_down
ld hl, w2DMenuFlags2
bit 7, [hl]
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
jp z, xor_a
ld hl, wMenuScrollPosition
ld a, [wMenuData_ScrollingMenuHeight]
@ -277,15 +277,15 @@ ScrollingMenu_InitFlags:
ld [w2DMenuNumRows], a
ld a, 1
ld [w2DMenuNumCols], a
ld a, $8c
bit 2, c
ld a, _2DMENU_EXIT_UP | _2DMENU_EXIT_DOWN | _2DMENU_DISABLE_JOYPAD_FILTER
bit SCROLLINGMENU_ENABLE_RIGHT_F, c
jr z, .skip_set_0
set 0, a
set _2DMENU_EXIT_RIGHT_F, a
.skip_set_0
bit 3, c
bit SCROLLINGMENU_ENABLE_LEFT_F, c
jr z, .skip_set_1
set 1, a
set _2DMENU_EXIT_LEFT_F, a
.skip_set_1
ld [w2DMenuFlags1], a
@ -294,12 +294,12 @@ ScrollingMenu_InitFlags:
ld a, $20
ld [w2DMenuCursorOffsets], a
ld a, A_BUTTON | B_BUTTON | D_UP | D_DOWN
bit 7, c
bit SCROLLINGMENU_ENABLE_SELECT_F, c
jr z, .disallow_select
add SELECT
.disallow_select
bit 6, c
bit SCROLLINGMENU_ENABLE_START_F, c
jr z, .disallow_start
add START
@ -345,7 +345,7 @@ ScrollingMenu_ValidateSwitchItem:
ScrollingMenu_UpdateDisplay:
call ClearWholeMenuBox
ld a, [wMenuDataFlags]
bit 4, a ; place arrows
bit SCROLLINGMENU_DISPLAY_ARROWS_F, a
jr z, .okay
ld a, [wMenuScrollPosition]
and a
@ -385,7 +385,7 @@ ScrollingMenu_UpdateDisplay:
cp b
jr nz, .loop
ld a, [wMenuDataFlags]
bit 4, a ; place arrows
bit SCROLLINGMENU_DISPLAY_ARROWS_F, a
jr z, .done
ld a, [wMenuBorderBottomCoord]
ld b, a
@ -399,7 +399,7 @@ ScrollingMenu_UpdateDisplay:
.cancel
ld a, [wMenuDataFlags]
bit 0, a ; call function on cancel
bit SCROLLINGMENU_CALL_FUNCTION1_CANCEL_F, a
jr nz, .call_function
ld de, .CancelString
call PlaceString
@ -468,9 +468,9 @@ ScrollingMenu_PlaceCursor:
ScrollingMenu_CheckCallFunction3:
ld a, [wMenuDataFlags]
bit 5, a ; call function 3
bit SCROLLINGMENU_ENABLE_FUNCTION3_F, a
ret z
bit 1, a ; call function 3 if not switching items
bit SCROLLINGMENU_CALL_FUNCTION3_NO_SWITCH_F, a
jr z, .call
ld a, [wSwitchItem]
and a

View File

@ -1,11 +1,15 @@
DEF ALLOW_SKIPPING_CREDITS_F EQU 6
SECTION "Credits", ROMX
Credits::
; Don't allow skipping credits the first time they're viewed in the Hall of Fame
ld b, a
bit 6, b ; Hall Of Fame
ld a, $0
bit STATUSFLAGS_HALL_OF_FAME_F, b
ld a, 0
jr z, .okay
ld a, $40
ld a, 1 << ALLOW_SKIPPING_CREDITS_F
.okay
ld [wJumptableIndex], a
@ -113,7 +117,7 @@ Credits_HandleBButton:
and B_BUTTON
ret z
ld a, [wJumptableIndex]
bit 6, a
bit ALLOW_SKIPPING_CREDITS_F, a
ret z
ld hl, wCreditsPos
ld a, [hli]

View File

@ -1,3 +1,5 @@
DEF SKIP_SPLASH_F EQU 6
SplashScreen:
; Play the copyright screen and GameFreak Presents sequence.
; Return carry if user cancels animation by pressing a button.
@ -37,7 +39,7 @@ SplashScreen:
; high bits of wJumptableIndex are recycled for some flags
; this was set if user canceled by pressing a button
ld a, [wJumptableIndex]
bit 6, a
bit SKIP_SPLASH_F, a
jr nz, .canceled
; clear carry flag from GameFreakPresents_PlayFrame
@ -107,7 +109,7 @@ GameFreakPresentsFrame:
.pressed_button
; high bits of wJumptableIndex are recycled for some flags
ld hl, wJumptableIndex
set 6, [hl]
set SKIP_SPLASH_F, [hl]
.finish
callfar ClearSpriteAnims

View File

@ -32,67 +32,67 @@ EnableEvents::
CheckEnabledMapEventsBit5:
ld hl, wEnabledPlayerEvents
bit 5, [hl]
bit PLAYEREVENTS_UNUSED, [hl]
ret
DisableWarpsConnections: ; unreferenced
ld hl, wEnabledPlayerEvents
res 2, [hl]
res PLAYEREVENTS_WARPS_AND_CONNECTIONS, [hl]
ret
DisableCoordEvents: ; unreferenced
ld hl, wEnabledPlayerEvents
res 1, [hl]
res PLAYEREVENTS_COORD_EVENTS, [hl]
ret
DisableStepCount: ; unreferenced
ld hl, wEnabledPlayerEvents
res 0, [hl]
res PLAYEREVENTS_COUNT_STEPS, [hl]
ret
DisableWildEncounters: ; unreferenced
ld hl, wEnabledPlayerEvents
res 4, [hl]
res PLAYEREVENTS_WILD_ENCOUNTERS, [hl]
ret
EnableWarpsConnections: ; unreferenced
ld hl, wEnabledPlayerEvents
set 2, [hl]
set PLAYEREVENTS_WARPS_AND_CONNECTIONS, [hl]
ret
EnableCoordEvents: ; unreferenced
ld hl, wEnabledPlayerEvents
set 1, [hl]
set PLAYEREVENTS_COORD_EVENTS, [hl]
ret
EnableStepCount: ; unreferenced
ld hl, wEnabledPlayerEvents
set 0, [hl]
set PLAYEREVENTS_COUNT_STEPS, [hl]
ret
EnableWildEncounters:
ld hl, wEnabledPlayerEvents
set 4, [hl]
set PLAYEREVENTS_WILD_ENCOUNTERS, [hl]
ret
CheckWarpConnectionsEnabled:
ld hl, wEnabledPlayerEvents
bit 2, [hl]
bit PLAYEREVENTS_WARPS_AND_CONNECTIONS, [hl]
ret
CheckCoordEventsEnabled:
ld hl, wEnabledPlayerEvents
bit 1, [hl]
bit PLAYEREVENTS_COORD_EVENTS, [hl]
ret
CheckStepCountEnabled:
ld hl, wEnabledPlayerEvents
bit 0, [hl]
bit PLAYEREVENTS_COUNT_STEPS, [hl]
ret
CheckWildEncountersEnabled:
ld hl, wEnabledPlayerEvents
bit 4, [hl]
bit PLAYEREVENTS_WILD_ENCOUNTERS, [hl]
ret
StartMap:
@ -411,13 +411,13 @@ endr
call CallScript
ld hl, wScriptFlags
res 3, [hl]
res RUN_DEFERRED_SCRIPT, [hl]
farcall EnableScriptMode
farcall ScriptEvents
ld hl, wScriptFlags
bit 3, [hl]
bit RUN_DEFERRED_SCRIPT, [hl]
jr z, .nope
ld hl, wDeferredScriptAddr

View File

@ -22,9 +22,9 @@ ReanchorBGMap_NoOAMUpdate::
xor a
ldh [hLCDCPointer], a
ldh [hBGMapMode], a
ld hl, wEnteredMapFromContinue
set 7, [hl]
res 2, [hl]
ld hl, wUnusedReanchorBGMapFlags
set UNUSED_REANCHOR_BG_MAP_7, [hl]
res UNUSED_REANCHOR_BG_MAP_2, [hl]
ld a, $90
ldh [hWY], a
call LoadOverworldTilemapAndAttrmapPals

View File

@ -36,7 +36,7 @@ HandleObjectStep:
CheckObjectStillVisible:
ld hl, OBJECT_FLAGS2
add hl, bc
res OBJ_FLAGS2_6, [hl]
res OFF_SCREEN_F, [hl]
ld a, [wXCoord]
ld e, a
ld hl, OBJECT_MAP_X
@ -62,7 +62,7 @@ CheckObjectStillVisible:
.ok
ld hl, OBJECT_FLAGS2
add hl, bc
set OBJ_FLAGS2_6, [hl]
set OFF_SCREEN_F, [hl]
ld a, [wXCoord]
ld e, a
ld hl, OBJECT_INIT_X
@ -99,7 +99,7 @@ CheckObjectStillVisible:
.yes2
ld hl, OBJECT_FLAGS2
add hl, bc
set OBJ_FLAGS2_6, [hl]
set OFF_SCREEN_F, [hl]
and a
ret
@ -147,7 +147,7 @@ HandleObjectAction:
jr nz, SetFacingStanding
ld hl, OBJECT_FLAGS2
add hl, bc
bit OBJ_FLAGS2_6, [hl]
bit OFF_SCREEN_F, [hl]
jr nz, SetFacingStanding
bit FROZEN_F, [hl]
jr nz, _CallFrozenObjectAction
@ -663,8 +663,8 @@ MovementFunction_Strength:
jr z, .on_pit
ld hl, OBJECT_FLAGS2
add hl, bc
bit OBJ_FLAGS2_2, [hl]
res OBJ_FLAGS2_2, [hl]
bit BOULDER_MOVING_F, [hl]
res BOULDER_MOVING_F, [hl]
jr z, .ok
ld hl, OBJECT_RANGE
add hl, bc
@ -1666,7 +1666,7 @@ StepFunction_StrengthBoulder:
pop bc
ld hl, OBJECT_FLAGS2
add hl, bc
res OBJ_FLAGS2_2, [hl]
res BOULDER_MOVING_F, [hl]
call CopyCoordsTileToLastCoordsTile
ld hl, OBJECT_WALKING
add hl, bc
@ -2162,7 +2162,7 @@ RespawnPlayerAndOpponent:
ld a, PLAYER
call RespawnObject
ld a, [wBattleScriptFlags]
bit 7, a
bit BATTLESCRIPT_SCRIPTED_F, a
jr z, .skip_opponent
ldh a, [hLastTalked]
and a
@ -2831,7 +2831,7 @@ InitSprites:
ld hl, OBJECT_FLAGS2
add hl, bc
ld e, [hl]
bit OBJ_FLAGS2_7, e
bit OBJ_FLAGS2_7_F, e
jr z, .not_priority
or PRIORITY
.not_priority

View File

@ -41,7 +41,7 @@ ReadMapSetupScript:
; Bit 7 of the bank indicates a parameter.
; This is left unused.
bit 7, b
bit MAPSETUPSCRIPT_HAS_PARAM_F, b
jr z, .go
pop de

View File

@ -321,7 +321,7 @@ IsNPCAtCoord:
ld hl, OBJECT_FLAGS1
add hl, bc
bit 7, [hl]
bit EMOTE_OBJECT_F, [hl]
jr nz, .next
ld hl, OBJECT_PALETTE

View File

@ -7,23 +7,23 @@ _UpdatePlayerSprite::
call GetUsedSprite
ret
_RefreshSprites::
LoadStandingSpritesGFX::
ld hl, wSpriteFlags
ld a, [hl]
push af
res 7, [hl]
set 6, [hl]
res SPRITES_SKIP_STANDING_GFX_F, [hl]
set SPRITES_SKIP_WALKING_GFX_F, [hl]
call LoadUsedSpritesGFX
pop af
ld [wSpriteFlags], a
ret
_ClearSprites::
LoadWalkingSpritesGFX::
ld hl, wSpriteFlags
ld a, [hl]
push af
set 7, [hl]
res 6, [hl]
set SPRITES_SKIP_STANDING_GFX_F, [hl]
res SPRITES_SKIP_WALKING_GFX_F, [hl]
call LoadUsedSpritesGFX
pop af
ld [wSpriteFlags], a
@ -237,7 +237,7 @@ LoadStillSpriteTiles:
LoadMiscTiles:
ld a, [wSpriteFlags]
bit 6, a
bit SPRITES_SKIP_WALKING_GFX_F, a
ret nz
ld c, EMOTE_SHADOW
@ -401,7 +401,7 @@ endr
push de
push bc
ld a, [wSpriteFlags]
bit 7, a
bit SPRITES_SKIP_STANDING_GFX_F, a
jr nz, .skip
call Get2bpp
@ -425,7 +425,7 @@ endr
jr c, .done
ld a, [wSpriteFlags]
bit 6, a
bit SPRITES_SKIP_WALKING_GFX_F, a
jr nz, .done
call Get2bpp

View File

@ -665,7 +665,7 @@ ENDM
ld hl, OBJECT_FLAGS2
add hl, bc
set 2, [hl]
set BOULDER_MOVING_F, [hl]
ld a, [wWalkingDirection]
ld d, a

View File

@ -155,7 +155,7 @@ CopyObjectStruct::
ld hl, OBJECT_FLAGS2
add hl, de
set 5, [hl]
set FROZEN_F, [hl]
ret
CopyMapObjectToObjectStruct:

View File

@ -1090,7 +1090,7 @@ Script_reloadmapafterbattle:
jp ScriptJump
.notblackedout
bit 0, d
bit BATTLESCRIPT_WILD_F, d
jr z, .was_wild
farcall MomTriesToBuySomething
jr .done
@ -1299,7 +1299,7 @@ Script_sdefer:
call GetScriptByte
ld [wDeferredScriptAddr + 1], a
ld hl, wScriptFlags
set 3, [hl]
set RUN_DEFERRED_SCRIPT, [hl]
ret
Script_checkscene:
@ -2150,7 +2150,7 @@ Script_end:
ld a, SCRIPT_OFF
ld [wScriptMode], a
ld hl, wScriptFlags
res 0, [hl]
res UNUSED_SCRIPT_FLAG_0, [hl]
call StopScript
ret
@ -2159,7 +2159,7 @@ Script_endcallback:
jr c, .dummy
.dummy
ld hl, wScriptFlags
res 0, [hl]
res UNUSED_SCRIPT_FLAG_0, [hl]
call StopScript
ret
@ -2200,7 +2200,7 @@ Script_endall:
ld a, SCRIPT_OFF
ld [wScriptMode], a
ld hl, wScriptFlags
res 0, [hl]
res UNUSED_SCRIPT_FLAG_0, [hl]
call StopScript
ret

View File

@ -1896,6 +1896,10 @@ ReleasePKMN_ByePKMN:
call DelayFrames
ret
; move pkmn w/o mail jumptable bits
DEF MOVE_MON_FROM_PARTY_F EQU 0
DEF MOVE_MON_TO_PARTY_F EQU 1
MovePKMNWitoutMail_InsertMon:
push hl
push de
@ -1919,13 +1923,13 @@ MovePKMNWitoutMail_InsertMon:
ld a, [wBillsPC_BackupLoadedBox]
and a
jr nz, .moving_from_box
set 0, c
set MOVE_MON_FROM_PARTY_F, c
.moving_from_box
ld a, [wBillsPC_LoadedBox]
and a
jr nz, .moving_to_box
set 1, c
set MOVE_MON_TO_PARTY_F, c
.moving_to_box
ld hl, .Jumptable

View File

@ -169,7 +169,7 @@ ForgetMove:
call SafeLoadTempTilemapToTilemap
pop af
pop hl
bit 1, a
bit B_BUTTON_F, a
jr nz, .cancel
push hl
ld a, [wMenuCursorY]

View File

@ -177,7 +177,7 @@ SwitchPartyMons:
call DelayFrame
farcall PartyMenuSelect
bit 1, b
bit B_BUTTON_F, b
jr c, .DontSwitch
farcall _SwitchPartyMons
@ -814,7 +814,7 @@ ChooseMoveToDelete:
call Load2DMenuData
call SetUpMoveList
ld hl, w2DMenuFlags1
set 6, [hl]
set _2DMENU_ENABLE_SPRITE_ANIMS_F, [hl]
jr .enter_loop
.loop
@ -841,7 +841,7 @@ ChooseMoveToDelete:
xor a
ld [wSwitchMon], a
ld hl, w2DMenuFlags1
res 6, [hl]
res _2DMENU_ENABLE_SPRITE_ANIMS_F, [hl]
call ClearSprites
call ClearTilemap
pop af
@ -850,7 +850,8 @@ ChooseMoveToDelete:
DeleteMoveScreen2DMenuData:
db 3, 1 ; cursor start y, x
db 3, 1 ; rows, columns
db $40, $00 ; flags
db _2DMENU_ENABLE_SPRITE_ANIMS ; flags 1
db 0 ; flags 2
dn 2, 0 ; cursor offset
db D_UP | D_DOWN | A_BUTTON | B_BUTTON ; accepted buttons
@ -882,18 +883,18 @@ MoveScreenLoop:
.loop
call SetUpMoveList
ld hl, w2DMenuFlags1
set 6, [hl]
set _2DMENU_ENABLE_SPRITE_ANIMS_F, [hl]
jr .skip_joy
.joy_loop
call ScrollingMenuJoypad
bit 1, a
bit B_BUTTON_F, a
jp nz, .b_button
bit 0, a
bit A_BUTTON_F, a
jp nz, .a_button
bit 4, a
bit D_RIGHT_F, a
jp nz, .d_right
bit 5, a
bit D_LEFT_F, a
jp nz, .d_left
.skip_joy
@ -1072,14 +1073,15 @@ MoveScreenLoop:
xor a
ld [wSwappingMove], a
ld hl, w2DMenuFlags1
res 6, [hl]
res _2DMENU_ENABLE_SPRITE_ANIMS_F, [hl]
call ClearSprites
jp ClearTilemap
MoveScreen2DMenuData:
db 3, 1 ; cursor start y, x
db 3, 1 ; rows, columns
db $40, $00 ; flags
db _2DMENU_ENABLE_SPRITE_ANIMS ; flags 1
db 0 ; flags 2
dn 2, 0 ; cursor offsets
db D_UP | D_DOWN | D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON ; accepted buttons

View File

@ -39,13 +39,13 @@ MonSubmenu:
MonMenuLoop:
.loop
ld a, MENU_UNUSED_3 | MENU_BACKUP_TILES_2 ; flags
ld a, MENU_UNUSED | MENU_BACKUP_TILES_2 ; flags
ld [wMenuDataFlags], a
ld a, [wMonSubmenuCount]
ld [wMenuDataItems], a
call InitVerticalMenuCursor
ld hl, w2DMenuFlags1
set 6, [hl]
set _2DMENU_ENABLE_SPRITE_ANIMS_F, [hl]
call StaticMenuJoypad
ld de, SFX_READ_TEXT_2
call PlaySFX
@ -255,11 +255,11 @@ BattleMonMenu:
call WaitBGMap
call CopyMenuData
ld a, [wMenuDataFlags]
bit 7, a
bit STATICMENU_CURSOR_F, a
jr z, .set_carry
call InitVerticalMenuCursor
ld hl, w2DMenuFlags1
set 6, [hl]
set _2DMENU_ENABLE_SPRITE_ANIMS_F, [hl]
call StaticMenuJoypad
ld de, SFX_READ_TEXT_2
call PlaySFX

View File

@ -583,7 +583,8 @@ InitPartyMenuNoCancel:
PartyMenu2DMenuData:
db 1, 0 ; cursor start y, x
db 0, 1 ; rows, columns
db $60, $00 ; flags
db _2DMENU_WRAP_UP_DOWN | _2DMENU_ENABLE_SPRITE_ANIMS ; flags 1
db 0 ; flags 2
dn 2, 0 ; cursor offset
db 0 ; accepted buttons

View File

@ -520,12 +520,12 @@ CheckPrinterStatus:
jr z, .error_2
.printer_connected
ld a, [wPrinterStatusFlags]
and %11100000
and PRINTER_STATUS_ERROR_3 | PRINTER_STATUS_ERROR_4 | PRINTER_STATUS_ERROR_1
ret z ; no error
bit 7, a
bit PRINTER_STATUS_ERROR_1_F, a
jr nz, .error_1
bit 6, a
bit PRINTER_STATUS_ERROR_4_F, a
jr nz, .error_4
; paper error
ld a, PRINTER_ERROR_3

View File

@ -8,7 +8,7 @@ Printer_StartTransmission:
ldh [rSC], a
ld [wPrinterOpcode], a
ld hl, wPrinterConnectionOpen
set 0, [hl]
set PRINTER_CONNECTION_OPEN, [hl]
ld a, [wGBPrinterBrightness]
ld [wPrinterExposureTime], a
xor a
@ -199,7 +199,7 @@ Printer_CheckConnectionStatus:
cp $0
jr nz, .printer_error
ld hl, wPrinterConnectionOpen
set 1, [hl]
set PRINTER_CONNECTION_SUCCESS, [hl]
ld a, $5
ld [wHandshakeFrameDelay], a
call _Printer_NextSection

View File

@ -18,7 +18,7 @@ _ResetClock:
jr c, .wrongpassword
ld a, BANK(sRTCStatusFlags)
call OpenSRAM
ld a, $80
ld a, RTC_RESET
ld [sRTCStatusFlags], a
call CloseSRAM
ld hl, .PasswordAskResetText

View File

@ -121,17 +121,17 @@ RestartClock:
push af
call .PrintTime
pop af
bit 0, a
bit A_BUTTON_F, a
jr nz, .press_A
bit 1, a
bit B_BUTTON_F, a
jr nz, .press_B
bit 6, a
bit D_UP_F, a
jr nz, .pressed_up
bit 7, a
bit D_DOWN_F, a
jr nz, .pressed_down
bit 5, a
bit D_LEFT_F, a
jr nz, .pressed_left
bit 4, a
bit D_RIGHT_F, a
jr nz, .pressed_right
jr .joy_loop

View File

@ -5,7 +5,7 @@ StopRTC: ; unreferenced
ld a, RTC_DH
ld [MBC3SRamBank], a
ld a, [MBC3RTC]
set 6, a ; halt
set RTC_DH_HALT, a
ld [MBC3RTC], a
call CloseSRAM
ret
@ -17,7 +17,7 @@ StartRTC:
ld a, RTC_DH
ld [MBC3SRamBank], a
ld a, [MBC3RTC]
res 6, a ; halt
res RTC_DH_HALT, a
ld [MBC3RTC], a
call CloseSRAM
ret
@ -80,7 +80,7 @@ SaveRTC:
ld hl, MBC3RTC
ld a, RTC_DH
ld [MBC3SRamBank], a
res 7, [hl]
res RTC_DH_OVERFLOW, [hl]
ld a, BANK(sRTCStatusFlags)
ld [MBC3SRamBank], a
xor a
@ -94,9 +94,7 @@ StartClock::
call _FixDays
call FixDays
jr nc, .skip_set
; bit 5: Day count exceeds 139
; bit 6: Day count exceeds 255
call RecordRTCStatus ; set flag on sRTCStatusFlags
call RecordRTCStatus
.skip_set
call StartRTC
@ -104,17 +102,16 @@ StartClock::
_FixDays:
ld hl, hRTCDayHi
bit 7, [hl]
jr nz, .set_bit_7
bit 6, [hl]
jr nz, .set_bit_7
bit RTC_DH_OVERFLOW, [hl]
jr nz, .reset_rtc
bit RTC_DH_HALT, [hl]
jr nz, .reset_rtc
xor a
ret
.set_bit_7
; Day count exceeds 16383
ld a, %10000000
call RecordRTCStatus ; set bit 7 on sRTCStatusFlags
.reset_rtc
ld a, RTC_RESET
call RecordRTCStatus
ret
_GetClock:
@ -127,7 +124,7 @@ _GetClock:
push af
call CloseSRAM
pop af
bit 6, a ; halt
bit RTC_DH_HALT, a
ret z
ld a, BANK(sRTCHaltCheckValue)
@ -142,11 +139,11 @@ _GetClock:
ClockContinue:
call CheckRTCStatus
ld c, a
and %11000000 ; Day count exceeded 255 or 16383
and RTC_RESET | RTC_DAYS_EXCEED_255
jr nz, .time_overflow
ld a, c
and %00100000 ; Day count exceeded 139
and RTC_DAYS_EXCEED_139
jr z, .dont_update
call UpdateTime

View File

@ -536,7 +536,7 @@ SetDayOfWeek:
InitialSetDSTFlag:
ld a, [wDST]
set 7, a
set DST_F, a
ld [wDST], a
predef UpdateTimePredef
hlcoord 1, 14
@ -564,7 +564,7 @@ InitialSetDSTFlag:
InitialClearDSTFlag:
ld a, [wDST]
res 7, a
res DST_F, a
ld [wDST], a
predef UpdateTimePredef
hlcoord 1, 14
@ -628,7 +628,7 @@ MrChrono:
inc hl
ld a, [wDST]
bit 7, a
bit DST_F, a
jr z, .off
ld [hl], "O"

View File

@ -20,7 +20,7 @@ _LoadOverworldAttrmapPals::
ld h, a
ld a, [hl]
and $f
bit 3, a
bit OAM_TILE_BANK, a
jr z, .next
jr .by_map_group
@ -34,7 +34,7 @@ _LoadOverworldAttrmapPals::
ld a, [hl]
swap a
and $f
bit 3, a
bit OAM_TILE_BANK, a
jr z, .next
.by_map_group
@ -76,7 +76,7 @@ _ScrollBGMapPalettes::
ld h, a
ld a, [hl]
and $f
bit 3, a
bit OAM_TILE_BANK, a
jr z, .next
jr .by_map_group
@ -90,7 +90,7 @@ _ScrollBGMapPalettes::
ld a, [hl]
swap a
and $f
bit 3, a
bit OAM_TILE_BANK, a
jr z, .next
.by_map_group

View File

@ -15,7 +15,7 @@ _TimeOfDayPals::
; forced pals?
ld hl, wTimeOfDayPalFlags
bit 7, [hl]
bit FORCED_PALSET_F, [hl]
jr nz, .dontchange
; do we need to bother updating?

View File

@ -229,16 +229,16 @@ WaitSFX::
.wait
ld hl, wChannel5Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .wait
ld hl, wChannel6Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .wait
ld hl, wChannel7Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .wait
ld hl, wChannel8Flags1
bit 0, [hl]
bit SOUND_CHANNEL_ON, [hl]
jr nz, .wait
pop hl
@ -477,16 +477,16 @@ PlaceBCDNumberSprite:: ; unreferenced
CheckSFX::
; Return carry if any SFX channels are active.
ld a, [wChannel5Flags1]
bit 0, a
bit SOUND_CHANNEL_ON, a
jr nz, .playing
ld a, [wChannel6Flags1]
bit 0, a
bit SOUND_CHANNEL_ON, a
jr nz, .playing
ld a, [wChannel7Flags1]
bit 0, a
bit SOUND_CHANNEL_ON, a
jr nz, .playing
ld a, [wChannel8Flags1]
bit 0, a
bit SOUND_CHANNEL_ON, a
jr nz, .playing
and a
ret

View File

@ -26,7 +26,7 @@ GameTimer::
; Is the timer already capped?
ld hl, wGameTimeCap
bit 0, [hl]
bit GAME_TIME_CAPPED, [hl]
ret nz
; +1 frame
@ -91,7 +91,7 @@ GameTimer::
jr c, .ok
ld hl, wGameTimeCap
set 0, [hl]
set GAME_TIME_CAPPED, [hl]
ld a, 59 ; 999:59:59.00
ld [wGameTimeMinutes], a

View File

@ -38,7 +38,7 @@ UpdateJoypad::
; We can only get four inputs at a time.
; We take d-pad first for no particular reason.
ld a, R_DPAD
ld a, 1 << rJOYP_DPAD
ldh [rJOYP], a
; Read twice to give the request time to take.
ldh a, [rJOYP]
@ -55,7 +55,7 @@ UpdateJoypad::
; Buttons make 8 total inputs (A, B, Select, Start).
; We can fit this into one byte.
ld a, R_BUTTONS
ld a, 1 << rJOYP_BUTTONS
ldh [rJOYP], a
; Wait for input to stabilize.
rept 6
@ -427,7 +427,7 @@ PromptButton::
.blink_cursor
ldh a, [hVBlankCounter]
and %00010000 ; bit 4, a
and 1 << 4 ; blink every 2**4 = 16 frames
jr z, .cursor_off
ld a, "▼"
jr .load_cursor_state

View File

@ -1065,7 +1065,7 @@ endr
GetMapScreenCoords::
ld hl, wOverworldMapBlocks
ld a, [wXCoord]
bit 0, a
bit 0, a ; even or odd?
jr nz, .odd_x
; even x
srl a
@ -1083,7 +1083,7 @@ GetMapScreenCoords::
ld c, a
ld b, 0
ld a, [wYCoord]
bit 0, a
bit 0, a ; even or odd?
jr nz, .odd_y
; even y
srl a
@ -1418,7 +1418,7 @@ ExecuteCallbackScript::
ld hl, wScriptFlags
ld a, [hl]
push af
set 1, [hl]
set UNUSED_SCRIPT_FLAG_1, [hl]
farcall EnableScriptMode
farcall ScriptEvents
pop af
@ -1957,7 +1957,7 @@ GetMovementPermissions::
.ok_down
ld hl, wTilePermissions
set 3, [hl]
set RIGHT, [hl]
ret
.Up:
@ -1974,7 +1974,7 @@ GetMovementPermissions::
.ok_up
ld hl, wTilePermissions
set 3, [hl]
set RIGHT, [hl]
ret
.Right:
@ -1991,7 +1991,7 @@ GetMovementPermissions::
.ok_right
ld hl, wTilePermissions
set 3, [hl]
set RIGHT, [hl]
ret
.Left:
@ -2008,7 +2008,7 @@ GetMovementPermissions::
.ok_left
ld hl, wTilePermissions
set 3, [hl]
set RIGHT, [hl]
ret
.CheckHiNybble:
@ -2318,7 +2318,7 @@ ReturnToMapWithSpeechTextbox::
ReloadTilesetAndPalettes::
call DisableLCD
call ClearSprites
farcall _RefreshSprites
farcall LoadStandingSpritesGFX
call LoadStandardFont
call LoadFontsExtra
ldh a, [hROMBank]

View File

@ -187,7 +187,7 @@ PlaceVerticalMenuItems::
jr nz, .loop
ld a, [wMenuDataFlags]
bit 4, a
bit STATICMENU_PLACE_TITLE_F, a
ret z
call MenuBoxCoord2Tile
@ -212,20 +212,20 @@ GetMenuTextStartCoord::
ld a, [wMenuBorderLeftCoord]
ld c, a
inc c
; bit 6: if not set, leave extra room on top
; if not set, leave extra room on top
ld a, [wMenuDataFlags]
bit 6, a
jr nz, .bit_6_set
bit STATICMENU_NO_TOP_SPACING_F, a
jr nz, .no_top_spacing
inc b
.bit_6_set
; bit 7: if set, leave extra room on the left
.no_top_spacing
; if set, leave extra room on the left
ld a, [wMenuDataFlags]
bit 7, a
jr z, .bit_7_clear
bit STATICMENU_CURSOR_F, a
jr z, .no_cursor
inc c
.bit_7_clear
.no_cursor
ret
ClearMenuBoxInterior::
@ -338,12 +338,12 @@ VerticalMenu::
call ApplyTilemap
call CopyMenuData
ld a, [wMenuDataFlags]
bit 7, a
bit STATICMENU_CURSOR_F, a
jr z, .cancel
call InitVerticalMenuCursor
call StaticMenuJoypad
call MenuClickSound
bit 1, a
bit B_BUTTON_F, a
jr z, .okay
.cancel
scf
@ -481,7 +481,7 @@ SetUpMenu::
call MenuWriteText
call InitMenuCursorAndButtonPermissions
ld hl, w2DMenuFlags1
set 7, [hl]
set _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
ret
DrawVariableLengthMenuBox::
@ -577,13 +577,13 @@ InitMenuCursorAndButtonPermissions::
call InitVerticalMenuCursor
ld hl, wMenuJoypadFilter
ld a, [wMenuDataFlags]
bit 3, a
jr z, .disallow_select
bit STATICMENU_ENABLE_START_F, a
jr z, .disallow_start
set START_F, [hl]
.disallow_select
.disallow_start
ld a, [wMenuDataFlags]
bit 2, a
bit STATICMENU_ENABLE_LEFT_RIGHT_F, a
jr z, .disallow_left_right
set D_LEFT_F, [hl]
set D_RIGHT_F, [hl]
@ -748,7 +748,7 @@ MenuClickSound::
and A_BUTTON | B_BUTTON
jr z, .nosound
ld hl, wMenuFlags
bit 3, a
bit MENU_NO_CLICK_SFX_F, a
jr nz, .nosound
call PlayClickSFX
.nosound

View File

@ -11,17 +11,17 @@ PrintNum::
push bc
bit 5, b
bit PRINTNUM_MONEY_F, b
jr z, .main
bit 7, b
bit PRINTNUM_LEADINGZEROS_F, b
jr nz, .moneyflag
bit 6, b
bit PRINTNUM_LEFTALIGN_F, b
jr z, .main
.moneyflag ; 101xxxxx or 011xxxxx
ld a, "¥"
ld [hli], a
res 5, b ; 100xxxxx or 010xxxxx
res PRINTNUM_MONEY_F, b ; 100xxxxx or 010xxxxx
.main
xor a
@ -184,11 +184,11 @@ PrintNum::
ldh a, [hPrintNumBuffer + 0]
and a
jr nz, .stop
bit 5, d
bit PRINTNUM_MONEY_F, d
jr z, .stop
ld a, "¥"
ld [hli], a
res 5, d
res PRINTNUM_MONEY_F, d
.stop
pop af
@ -262,11 +262,11 @@ PrintNum::
ldh a, [hPrintNumBuffer + 0]
and a
jr nz, .done
bit 5, d
bit PRINTNUM_MONEY_F, d
jr z, .done
ld a, "¥"
ld [hli], a
res 5, d
res PRINTNUM_MONEY_F, d
.done
ld a, "0"
add c
@ -281,7 +281,7 @@ PrintNum::
.PrintLeadingZero:
; prints a leading zero unless they are turned off in the flags
bit 7, d ; print leading zeroes?
bit PRINTNUM_LEADINGZEROS_F, d
ret z
ld [hl], "0"
ret
@ -289,9 +289,9 @@ PrintNum::
.AdvancePointer:
; increments the pointer unless leading zeroes are not being printed,
; the number is left-aligned, and no nonzero digits have been printed yet
bit 7, d ; print leading zeroes?
bit PRINTNUM_LEADINGZEROS_F, d
jr nz, .inc
bit 6, d ; left alignment or right alignment?
bit PRINTNUM_LEFTALIGN_F, d
jr z, .inc
ldh a, [hPrintNumBuffer + 0]
and a

View File

@ -5,7 +5,7 @@ PrinterReceive::
AskSerial::
; send out a handshake while serial int is off
ld a, [wPrinterConnectionOpen]
bit 0, a
bit PRINTER_CONNECTION_OPEN, a
ret z
; if we're still interpreting data, don't try to receive

View File

@ -7,7 +7,7 @@ Serial::
push hl
ld a, [wPrinterConnectionOpen]
bit 0, a
bit PRINTER_CONNECTION_OPEN, a
jr nz, .printer
ldh a, [hSerialConnectionStatus]
@ -54,7 +54,7 @@ Serial::
ldh [rDIV], a
.delay_loop
ldh a, [rDIV]
bit 7, a
bit 7, a ; wait until rDIV has incremented from 3 to $80 or more
jr nz, .delay_loop
ld a, (0 << rSC_ON) | (0 << rSC_CLOCK)

View File

@ -64,10 +64,10 @@ FixDays::
; check if day count > 255 (bit 8 set)
ldh a, [hRTCDayHi] ; DH
bit 0, a
bit RTC_DH_HI, a
jr z, .daylo
; reset dh (bit 8)
res 0, a
res RTC_DH_HI, a
ldh [hRTCDayHi], a
; mod 140
@ -85,7 +85,7 @@ FixDays::
ldh [hRTCDayLo], a
; flag for sRTCStatusFlags
ld a, %01000000
ld a, RTC_DAYS_EXCEED_255
jr .set
.daylo
@ -104,7 +104,7 @@ FixDays::
ldh [hRTCDayLo], a
; flag for sRTCStatusFlags
ld a, %00100000
ld a, RTC_DAYS_EXCEED_139
.set
; update clock with modded day value
@ -220,7 +220,7 @@ SetClock::
; this block is totally pointless
ld [hl], RTC_DH
ld a, [de]
bit 6, a ; halt
bit RTC_DH_HALT, a
ld [de], a
; seconds
@ -242,7 +242,7 @@ SetClock::
; day hi
ld [hl], RTC_DH
ldh a, [hRTCDayHi]
res 6, a ; make sure timer is active
res RTC_DH_HALT, a ; make sure timer is active
ld [de], a
; cleanup

View File

@ -390,7 +390,7 @@ Video_DummyFunction:: ; unreferenced
EnableSpriteDisplay:: ; unreferenced
ld hl, rLCDC
set 1, [hl]
set rLCDC_SPRITES_ENABLE, [hl]
ret
FillBGMap0WithBlack::

View File

@ -36,10 +36,10 @@ CloseText::
call SafeUpdateSprites
ld a, $90
ldh [hWY], a
farcall _ClearSprites
farcall LoadWalkingSpritesGFX
call UpdatePlayerSprite
ld hl, wEnteredMapFromContinue
res 7, [hl]
ld hl, wUnusedReanchorBGMapFlags
res UNUSED_REANCHOR_BG_MAP_7, [hl]
call ResetBGWindow
ret

View File

@ -20,7 +20,7 @@ ENDM
MACRO shift_const
DEF \1 EQU (1 << const_value)
DEF const_value += const_inc
const \1_F
ENDM
MACRO const_skip

View File

@ -922,6 +922,7 @@ wAlreadyFailed:: db
wBattleParticipantsIncludingFainted:: db
wBattleLowHealthAlarm:: db
wPlayerMinimized:: db
wPlayerScreens::
; bit
; 0 spikes
@ -2212,6 +2213,7 @@ wMapStatus:: db
wMapEventStatus:: db
wScriptFlags::
; bit 2: running script
; bit 3: run deferred script
db
ds 1
@ -2388,7 +2390,7 @@ wObjectMasks:: ds NUM_OBJECTS
wVariableSprites:: ds $100 - SPRITE_VARS
wEnteredMapFromContinue:: db
wUnusedReanchorBGMapFlags:: db
ds 2
wTimeOfDayPal:: db
ds 4