Identify more bit flags (#1153)

This commit is contained in:
Sylvie
2024-11-29 19:29:30 -05:00
committed by GitHub
parent 8894e29da2
commit 644bd42fb0
78 changed files with 539 additions and 472 deletions

View File

@@ -443,7 +443,7 @@ ConfirmContinue:
Continue_CheckRTC_RestartClock:
call CheckRTCStatus
and %10000000 ; Day count exceeded 16383
and RTC_RESET
jr z, .pass
farcall RestartClock
ld a, c
@@ -464,8 +464,8 @@ FinishContinueFunction:
ld hl, wGameTimerPaused
set GAME_TIMER_COUNTING_F, [hl]
res GAME_TIMER_MOBILE_F, [hl]
ld hl, wEnteredMapFromContinue
set 1, [hl]
ld hl, wMapNameSignFlags
set SHOWN_MAP_NAME_SIGN, [hl]
farcall OverworldLoop
ld a, [wSpawnAfterChampion]
cp SPAWN_RED
@@ -478,7 +478,7 @@ FinishContinueFunction:
DisplaySaveInfoOnContinue:
call CheckRTCStatus
and %10000000
and RTC_RESET
jr z, .clock_ok
lb de, 4, 8
call DisplayContinueDataWithRTCError
@@ -1266,7 +1266,7 @@ ResetClock:
jp Init
UpdateTitleTrailSprite: ; unreferenced
; 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
@@ -1279,7 +1279,7 @@ UpdateTitleTrailSprite: ; unreferenced
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

@@ -242,7 +242,7 @@ MainMenuJoypadLoop:
.loop
call MainMenu_PrintCurrentTimeAndDay
ld a, [w2DMenuFlags1]
set 5, a
set _2DMENU_WRAP_UP_DOWN_F, a
ld [w2DMenuFlags1], a
call GetScrollingMenuJoypad
ld a, [wMenuJoypad]
@@ -281,7 +281,7 @@ MainMenu_PrintCurrentTimeAndDay:
.PlaceBox:
call CheckRTCStatus
and %10000000 ; Day count exceeded 16383
and RTC_RESET
jr nz, .TimeFail
hlcoord 0, 14
ld b, 2
@@ -298,7 +298,7 @@ MainMenu_PrintCurrentTimeAndDay:
and a
ret z
call CheckRTCStatus
and $80
and RTC_RESET
jp nz, .PrintTimeNotSet
call UpdateTime
call GetWeekday

View File

@@ -68,7 +68,7 @@ Get2DMenuSelection:
call MenuClickSound
Mobile_GetMenuSelection:
ld a, [wMenuDataFlags]
bit 1, a
bit STATICMENU_ENABLE_SELECT_F, a
jr z, .skip
call GetMenuJoypad
bit SELECT_F, a
@@ -76,7 +76,7 @@ Mobile_GetMenuSelection:
.skip
ld a, [wMenuDataFlags]
bit 0, a
bit STATICMENU_DISABLE_B_F, a
jr nz, .skip2
call GetMenuJoypad
bit B_BUTTON_F, a
@@ -218,10 +218,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:
@@ -233,11 +233,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
@@ -248,7 +248,7 @@ _StaticMenuJoypad::
call Place2DMenuCursor
_ScrollingMenuJoypad::
ld hl, w2DMenuFlags2
res 7, [hl]
res _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
ldh a, [hBGMapMode]
push af
call MenuJoypadLoop
@@ -258,7 +258,7 @@ _ScrollingMenuJoypad::
MobileMenuJoypad:
ld hl, w2DMenuFlags2
res 7, [hl]
res _2DMENU_DISABLE_JOYPAD_FILTER_F, [hl]
ldh a, [hBGMapMode]
push af
call Move2DMenuCursor
@@ -282,7 +282,7 @@ Function241d5: ; unreferenced
call _2DMenuInterpretJoypad
jr c, .done
ld a, [w2DMenuFlags1]
bit 7, a
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, a
jr nz, .done
call GetMenuJoypad
ld c, a
@@ -303,7 +303,7 @@ Function241d5: ; unreferenced
farcall Function100337
ret c
ld a, [w2DMenuFlags1]
bit 7, a
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, a
jr z, .loop2
and a
ret
@@ -317,7 +317,7 @@ MenuJoypadLoop:
call _2DMenuInterpretJoypad
jr c, .done
ld a, [w2DMenuFlags1]
bit 7, a
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, a
jr nz, .done
call GetMenuJoypad
ld b, a
@@ -346,14 +346,14 @@ Do2DMenuRTCJoypad:
call Menu_WasButtonPressed
ret c
ld a, [w2DMenuFlags1]
bit 7, a
bit _2DMENU_DISABLE_JOYPAD_FILTER_F, a
jr z, .loopRTC
and a
ret
Menu_WasButtonPressed:
ld a, [w2DMenuFlags1]
bit 6, a
bit _2DMENU_ENABLE_SPRITE_ANIMS_F, a
jr z, .skip_to_joypad
callfar PlaySpriteAnimationsAndDelayFrame
@@ -390,7 +390,7 @@ _2DMenuInterpretJoypad:
.set_bit_7
ld hl, w2DMenuFlags2
set 7, [hl]
set _2DMENU_EXITING_F, [hl]
scf
ret
@@ -405,9 +405,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
@@ -428,9 +428,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
@@ -452,9 +452,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
@@ -476,9 +476,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
@@ -575,34 +575,35 @@ _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 .copy
call MenuBoxCoord2Attr
call .copy
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
@@ -672,7 +673,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
@@ -741,7 +742,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
@@ -757,15 +758,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
@@ -776,7 +777,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