Skip to content

Commit

Permalink
Tweak naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortyne committed Nov 20, 2023
1 parent e21079d commit f382da0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions engine/events/hidden_objects/bookshelves.asm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PrintBookshelfText::
pop af
call PrintPredefTextID
xor a
ldh [hWasBookShelfTextFound], a
ldh [hInteractedWithBookshelf], a
ret
.nextBookshelfEntry1
inc hl
Expand All @@ -33,7 +33,7 @@ PrintBookshelfText::
jr .loop
.noMatch
ld a, $ff
ldh [hWasBookShelfTextFound], a
ldh [hInteractedWithBookshelf], a
farjp PrintCardKeyText

INCLUDE "data/tilesets/bookshelf_tile_ids.asm"
4 changes: 2 additions & 2 deletions engine/gfx/sprite_oam.asm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ PrepareOAMData::
inc e
inc e
ld a, [de] ; [x#SPRITESTATEDATA1_IMAGEINDEX]
ld [wSpriteImageIndexTempCopy], a
ld [wSpriteImageIndexBackup], a
cp $ff ; off-screen (don't draw)
jr nz, .visible

Expand Down Expand Up @@ -98,7 +98,7 @@ PrepareOAMData::
push bc
ld b, a

ld a, [wSpriteImageIndexTempCopy] ; temp copy of [x#SPRITESTATEDATA1_IMAGEINDEX]
ld a, [wSpriteImageIndexBackup]
swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs)
and $f

Expand Down
18 changes: 9 additions & 9 deletions engine/overworld/sprite_collisions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ DetectCollisionBetweenSprites:
and $f0
or c

ldh [hSpriteCollisionsTempYCoord], a ; store Y coordinate adjusted for direction of movement
ldh [hSpriteCollisionsTempYCoord], a ; y adjusted for direction of movement

ld a, [hli] ; a = [i#SPRITESTATEDATA1_XSTEPVECTOR] (-1, 0, or 1)
call SetSpriteCollisionValues
Expand All @@ -93,7 +93,7 @@ DetectCollisionBetweenSprites:
and $f0
or c

ldh [hSpriteCollisionsTempXCoord], a ; store X coordinate adjusted for direction of movement
ldh [hSpriteCollisionsTempXCoord], a ; x adjusted for direction of movement

ld a, l
add 7
Expand All @@ -111,7 +111,7 @@ DetectCollisionBetweenSprites:
xor a ; zero the loop counter

.loop
ldh [hSpriteCollisionsLoopCounter], a ; store loop counter
ldh [hSpriteCollisionsLoopCounter], a
swap a
ld e, a
ldh a, [hCurrentSpriteOffset]
Expand Down Expand Up @@ -179,7 +179,7 @@ DetectCollisionBetweenSprites:
.next1
ldh a, [hSpriteCollisionsTempYCoord] ; a = distance between adjusted Y coordinates
sub b
ldh [hSpriteCollisionsAdjustedDistance], a ; store distance adjusted using sprite i's direction
ldh [hSpriteCollisionsAdjustedDistance], a
ld a, b
ldh [hSpriteCollisionsTempYCoord], a ; store 7 or 9 depending on sprite i's delta Y
jr c, .checkXDistance
Expand All @@ -194,7 +194,7 @@ DetectCollisionBetweenSprites:
ld b, 9

.next2
ldh a, [hSpriteCollisionsAdjustedDistance] ; a = distance adjusted using sprite i's direction
ldh a, [hSpriteCollisionsAdjustedDistance]
sub b ; adjust distance using sprite j's direction
jr z, .checkXDistance
jr nc, .next ; go to next sprite if distance is still positive after both adjustments
Expand Down Expand Up @@ -250,7 +250,7 @@ DetectCollisionBetweenSprites:
.next3
ldh a, [hSpriteCollisionsTempXCoord] ; a = distance between adjusted X coordinates
sub b
ldh [hSpriteCollisionsAdjustedDistance], a ; store distance adjusted using sprite i's direction
ldh [hSpriteCollisionsAdjustedDistance], a
ld a, b
ldh [hSpriteCollisionsTempXCoord], a ; store 7 or 9 depending on sprite i's delta X
jr c, .collision
Expand All @@ -265,7 +265,7 @@ DetectCollisionBetweenSprites:
ld b, 9

.next4
ldh a, [hSpriteCollisionsAdjustedDistance] ; a = distance adjusted using sprite i's direction
ldh a, [hSpriteCollisionsAdjustedDistance]
sub b ; adjust distance using sprite j's direction
jr z, .collision
jr nc, .next ; go to next sprite if distance is still positive after both adjustments
Expand Down Expand Up @@ -296,7 +296,7 @@ DetectCollisionBetweenSprites:
; to indicate which sprite the collision occurred with
inc l
inc l
ldh a, [hSpriteCollisionsLoopCounter] ; a = loop counter
ldh a, [hSpriteCollisionsLoopCounter]
ld de, SpriteCollisionBitTable
add a
add e
Expand All @@ -313,7 +313,7 @@ DetectCollisionBetweenSprites:
ld [hl], a

.next
ldh a, [hSpriteCollisionsLoopCounter] ; a = loop counter
ldh a, [hSpriteCollisionsLoopCounter]
inc a
cp $10
jp nz, .loop
Expand Down
2 changes: 1 addition & 1 deletion home/hidden_objects.asm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor::
jr .done
.hiddenObjectNotFound
farcall PrintBookshelfText
ldh a, [hWasBookShelfTextFound]
ldh a, [hInteractedWithBookshelf]
and a
jr z, .done
.nothingFound
Expand Down
2 changes: 1 addition & 1 deletion ram/hram.asm
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ hGymTrashCanRandNumMask::
db

NEXTU
hWasBookShelfTextFound:: db ; set to 0 if found, $FF if not found when attempting to interact with a hidden object
hInteractedWithBookshelf:: db ; set to 0 if you interacted with a bookshelf, $FF if not when attempting to interact with a hidden object
ENDU

ds 1
Expand Down
2 changes: 1 addition & 1 deletion ram/wram.asm
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ wMissableObjectFlagsEnd::
ds 7

; temp copy of SPRITESTATEDATA1_IMAGEINDEX (used for sprite facing/anim)
wSpriteImageIndexTempCopy:: db
wSpriteImageIndexBackup:: db

; each entry consists of 2 bytes
; * the sprite ID (depending on the current map)
Expand Down

0 comments on commit f382da0

Please sign in to comment.