diff --git a/engine/events/hidden_objects/bookshelves.asm b/engine/events/hidden_objects/bookshelves.asm index a2cfb648a0..813cfc49a4 100644 --- a/engine/events/hidden_objects/bookshelves.asm +++ b/engine/events/hidden_objects/bookshelves.asm @@ -24,7 +24,7 @@ PrintBookshelfText:: pop af call PrintPredefTextID xor a - ldh [hWasBookShelfTextFound], a + ldh [hInteractedWithBookshelf], a ret .nextBookshelfEntry1 inc hl @@ -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" diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm index 2049002cfd..4a31ab5e4d 100644 --- a/engine/gfx/sprite_oam.asm +++ b/engine/gfx/sprite_oam.asm @@ -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 @@ -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 diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index 9fc9f93a77..92106829e7 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -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 @@ -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 @@ -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] @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/home/hidden_objects.asm b/home/hidden_objects.asm index 723e3056b6..2e3510b04b 100644 --- a/home/hidden_objects.asm +++ b/home/hidden_objects.asm @@ -26,7 +26,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: jr .done .hiddenObjectNotFound farcall PrintBookshelfText - ldh a, [hWasBookShelfTextFound] + ldh a, [hInteractedWithBookshelf] and a jr z, .done .nothingFound diff --git a/ram/hram.asm b/ram/hram.asm index 9b8a5abc6c..ea2c981e13 100644 --- a/ram/hram.asm +++ b/ram/hram.asm @@ -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 diff --git a/ram/wram.asm b/ram/wram.asm index c00d5445cb..8c246b8a6d 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -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)