Skip to content

Commit

Permalink
Identify more bit flags (#119)
Browse files Browse the repository at this point in the history
* Identify more bit flags

* Bit serves dual use in debug mode
  • Loading branch information
Rangi42 authored Sep 29, 2024
1 parent a02a98e commit 7d9858f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions constants/gfx_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ DEF REDRAW_ROW EQU 2
const BIT_PARTY_MENU_HP_BAR ; 0
const BIT_DOUBLE_SPACED_MENU ; 1
const BIT_SINGLE_SPACED_LINES ; 2
const BIT_PAGE_CHAR_IS_NEXT ; 3

; tile list ids
; TileIDListPointerTable indexes (see data/tilemaps.asm)
Expand Down
5 changes: 4 additions & 1 deletion engine/battle/core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2820,7 +2820,10 @@ SelectMenuItem_CursorDown:
jp SelectMenuItem

Func_3d4f5:
bit 3, a
IF DEF(_DEBUG)
ASSERT BIT_START == BIT_TRAINER_BATTLE
ENDC
bit BIT_TRAINER_BATTLE, a
ld a, $0
jr nz, .asm_3d4fd
ld a, $1
Expand Down
4 changes: 2 additions & 2 deletions engine/debug/debug_menu.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1558,15 +1558,15 @@ Func_ff295:
call Func_ff2f3
pop de
ld a, d
set 7, a
set BIT_HAS_CHANGED_BOXES, a
ld [wCurrentBoxNum], a
push de
call Func_ff2d1
ld de, wBoxCount
call Func_ff2f3
ld a, [wLetterPrintingDelayFlags]
push af
ld a, 1
ld a, 1 << BIT_FAST_TEXT_DELAY
ld [wLetterPrintingDelayFlags], a
callfar SaveSAVtoSRAM
pop af
Expand Down
12 changes: 6 additions & 6 deletions engine/gfx/animated_objects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ GetCurrentAnimatedObjectTileYCoordinate:
push hl
ld a, [hl]
ld hl, wCurAnimatedObjectOAMAttributes
bit 6, [hl]
bit OAM_Y_FLIP, [hl]
jr z, .no_flip
add $8
xor $ff
Expand All @@ -240,7 +240,7 @@ GetCurrentAnimatedObjectTileXCoordinate:
push hl
ld a, [hl]
ld hl, wCurAnimatedObjectOAMAttributes
bit 5, [hl]
bit OAM_X_FLIP, [hl]
jr z, .no_flip
add $8
xor $ff
Expand All @@ -254,14 +254,14 @@ SetCurrentAnimatedObjectOAMAttributes:
ld b, a
ld a, [hl]
xor b
and $e0
and OAM_HFLIP | OAM_VFLIP | OAM_BEHIND_BG
ld b, a
ld a, [hl]
and $10
and OAM_OBP1
or b
bit 4, a
bit OAM_OBP_NUM, a
ret z
or $4
or OAM_HIGH_PALS
ret

GetCurrentAnimatedObjectOAMDataPointer:
Expand Down
4 changes: 2 additions & 2 deletions engine/menus/pokedex.asm
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,11 @@ Pokedex_PrepareDexEntryForPrinting:
ld h, a
bccoord 1, 1
ldh a, [hUILayoutFlags]
set 3, a
set BIT_PAGE_CHAR_IS_NEXT, a
ldh [hUILayoutFlags], a
call Pokedex_PrintFlavorTextAtBC
ldh a, [hUILayoutFlags]
res 3, a
res BIT_PAGE_CHAR_IS_NEXT, a
ldh [hUILayoutFlags], a
ret

Expand Down
2 changes: 1 addition & 1 deletion home/overworld.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ CollisionCheckOnLand::
ldh [hTextID], a
call IsSpriteInFrontOfPlayer ; check for sprite collisions again? when does the above check fail to detect a sprite collision?
jr nc, .asm_0a5c
res 7, [hl]
res BIT_FACE_PLAYER, [hl]
ldh a, [hTextID]
and a ; was there a sprite collision?
jr z, .asm_0a5c
Expand Down
2 changes: 1 addition & 1 deletion home/text.asm
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ Paragraph::

PageChar::
ldh a, [hUILayoutFlags]
bit 3, a
bit BIT_PAGE_CHAR_IS_NEXT, a
jr z, .pageChar
ld a, "<NEXT>"
jp PlaceNextChar.NotTerminator
Expand Down
2 changes: 1 addition & 1 deletion scripts/VermilionCity_2.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ VermilionCityPrintOfficerJennyText::
CheckEvent EVENT_GOT_SQUIRTLE_FROM_OFFICER_JENNY
jr nz, .asm_f1a69
ld a, [wBeatGymFlags]
bit 2, a ; THUNDERBADGE
bit BIT_THUNDERBADGE, a
jr nz, .asm_f1a24
ld hl, OfficerJennyText1
call PrintText
Expand Down

0 comments on commit 7d9858f

Please sign in to comment.