mirror of
https://github.com/pret/pokered.git
synced 2024-10-22 22:55:31 +00:00
Identify the unnamed HRAM variables and one WRAM label (#438)
This commit is contained in:
parent
3bbd38aa15
commit
7a7a6d689c
6 changed files with 30 additions and 33 deletions
|
@ -24,7 +24,7 @@ PrintBookshelfText::
|
||||||
pop af
|
pop af
|
||||||
call PrintPredefTextID
|
call PrintPredefTextID
|
||||||
xor a
|
xor a
|
||||||
ldh [hFFDB], a
|
ldh [hInteractedWithBookshelf], a
|
||||||
ret
|
ret
|
||||||
.nextBookshelfEntry1
|
.nextBookshelfEntry1
|
||||||
inc hl
|
inc hl
|
||||||
|
@ -33,7 +33,7 @@ PrintBookshelfText::
|
||||||
jr .loop
|
jr .loop
|
||||||
.noMatch
|
.noMatch
|
||||||
ld a, $ff
|
ld a, $ff
|
||||||
ldh [hFFDB], a
|
ldh [hInteractedWithBookshelf], a
|
||||||
farjp PrintCardKeyText
|
farjp PrintCardKeyText
|
||||||
|
|
||||||
INCLUDE "data/tilesets/bookshelf_tile_ids.asm"
|
INCLUDE "data/tilesets/bookshelf_tile_ids.asm"
|
||||||
|
|
|
@ -28,7 +28,7 @@ PrepareOAMData::
|
||||||
inc e
|
inc e
|
||||||
inc e
|
inc e
|
||||||
ld a, [de] ; [x#SPRITESTATEDATA1_IMAGEINDEX]
|
ld a, [de] ; [x#SPRITESTATEDATA1_IMAGEINDEX]
|
||||||
ld [wd5cd], a
|
ld [wSpriteImageIndexBackup], a
|
||||||
cp $ff ; off-screen (don't draw)
|
cp $ff ; off-screen (don't draw)
|
||||||
jr nz, .visible
|
jr nz, .visible
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ PrepareOAMData::
|
||||||
push bc
|
push bc
|
||||||
ld b, a
|
ld b, a
|
||||||
|
|
||||||
ld a, [wd5cd] ; 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)
|
swap a ; high nybble determines sprite used (0 is always player sprite, next are some npcs)
|
||||||
and $f
|
and $f
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ DetectCollisionBetweenSprites:
|
||||||
and $f0
|
and $f0
|
||||||
or c
|
or c
|
||||||
|
|
||||||
ldh [hFF90], a ; store Y coordinate adjusted for direction of movement
|
ldh [hCollidingSpriteTempYValue], a ; y adjusted for direction of movement
|
||||||
|
|
||||||
ld a, [hli] ; a = [i#SPRITESTATEDATA1_XSTEPVECTOR] (-1, 0, or 1)
|
ld a, [hli] ; a = [i#SPRITESTATEDATA1_XSTEPVECTOR] (-1, 0, or 1)
|
||||||
call SetSpriteCollisionValues
|
call SetSpriteCollisionValues
|
||||||
|
@ -93,7 +93,7 @@ DetectCollisionBetweenSprites:
|
||||||
and $f0
|
and $f0
|
||||||
or c
|
or c
|
||||||
|
|
||||||
ldh [hFF91], a ; store X coordinate adjusted for direction of movement
|
ldh [hCollidingSpriteTempXValue], a ; x adjusted for direction of movement
|
||||||
|
|
||||||
ld a, l
|
ld a, l
|
||||||
add 7
|
add 7
|
||||||
|
@ -103,15 +103,15 @@ DetectCollisionBetweenSprites:
|
||||||
ld [hld], a ; zero [i#SPRITESTATEDATA1_0D] XXX what's this for?
|
ld [hld], a ; zero [i#SPRITESTATEDATA1_0D] XXX what's this for?
|
||||||
ld [hld], a ; zero [i#SPRITESTATEDATA1_COLLISIONDATA]
|
ld [hld], a ; zero [i#SPRITESTATEDATA1_COLLISIONDATA]
|
||||||
|
|
||||||
ldh a, [hFF91]
|
ldh a, [hCollidingSpriteTempXValue]
|
||||||
ld [hld], a ; [i#SPRITESTATEDATA1_XADJUSTED]
|
ld [hld], a ; [i#SPRITESTATEDATA1_XADJUSTED]
|
||||||
ldh a, [hFF90]
|
ldh a, [hCollidingSpriteTempYValue]
|
||||||
ld [hl], a ; [i#SPRITESTATEDATA1_YADJUSTED]
|
ld [hl], a ; [i#SPRITESTATEDATA1_YADJUSTED]
|
||||||
|
|
||||||
xor a ; zero the loop counter
|
xor a ; zero the loop counter
|
||||||
|
|
||||||
.loop
|
.loop
|
||||||
ldh [hFF8F], a ; store loop counter
|
ldh [hCollidingSpriteOffset], a
|
||||||
swap a
|
swap a
|
||||||
ld e, a
|
ld e, a
|
||||||
ldh a, [hCurrentSpriteOffset]
|
ldh a, [hCurrentSpriteOffset]
|
||||||
|
@ -155,7 +155,7 @@ DetectCollisionBetweenSprites:
|
||||||
cpl
|
cpl
|
||||||
inc a
|
inc a
|
||||||
.noCarry1
|
.noCarry1
|
||||||
ldh [hFF90], a ; store the distance between the two sprites' adjusted Y values
|
ldh [hCollidingSpriteTempYValue], a ; store the distance between the two sprites' adjusted Y values
|
||||||
|
|
||||||
; Use the carry flag set by the above subtraction to determine which sprite's
|
; Use the carry flag set by the above subtraction to determine which sprite's
|
||||||
; Y coordinate is larger. This information is used later to set
|
; Y coordinate is larger. This information is used later to set
|
||||||
|
@ -177,11 +177,11 @@ DetectCollisionBetweenSprites:
|
||||||
ld b, 9
|
ld b, 9
|
||||||
|
|
||||||
.next1
|
.next1
|
||||||
ldh a, [hFF90] ; a = distance between adjusted Y coordinates
|
ldh a, [hCollidingSpriteTempYValue] ; a = distance between adjusted Y coordinates
|
||||||
sub b
|
sub b
|
||||||
ldh [hFF92], a ; store distance adjusted using sprite i's direction
|
ldh [hCollidingSpriteAdjustedDistance], a
|
||||||
ld a, b
|
ld a, b
|
||||||
ldh [hFF90], a ; store 7 or 9 depending on sprite i's delta Y
|
ldh [hCollidingSpriteTempYValue], a ; store 7 or 9 depending on sprite i's delta Y
|
||||||
jr c, .checkXDistance
|
jr c, .checkXDistance
|
||||||
|
|
||||||
; If sprite j's delta Y is 0, then b = 7, else b = 9.
|
; If sprite j's delta Y is 0, then b = 7, else b = 9.
|
||||||
|
@ -194,7 +194,7 @@ DetectCollisionBetweenSprites:
|
||||||
ld b, 9
|
ld b, 9
|
||||||
|
|
||||||
.next2
|
.next2
|
||||||
ldh a, [hFF92] ; a = distance adjusted using sprite i's direction
|
ldh a, [hCollidingSpriteAdjustedDistance]
|
||||||
sub b ; adjust distance using sprite j's direction
|
sub b ; adjust distance using sprite j's direction
|
||||||
jr z, .checkXDistance
|
jr z, .checkXDistance
|
||||||
jr nc, .next ; go to next sprite if distance is still positive after both adjustments
|
jr nc, .next ; go to next sprite if distance is still positive after both adjustments
|
||||||
|
@ -226,7 +226,7 @@ DetectCollisionBetweenSprites:
|
||||||
cpl
|
cpl
|
||||||
inc a
|
inc a
|
||||||
.noCarry2
|
.noCarry2
|
||||||
ldh [hFF91], a ; store the distance between the two sprites' adjusted X values
|
ldh [hCollidingSpriteTempXValue], a ; store the distance between the two sprites' adjusted X values
|
||||||
|
|
||||||
; Use the carry flag set by the above subtraction to determine which sprite's
|
; Use the carry flag set by the above subtraction to determine which sprite's
|
||||||
; X coordinate is larger. This information is used later to set
|
; X coordinate is larger. This information is used later to set
|
||||||
|
@ -248,11 +248,11 @@ DetectCollisionBetweenSprites:
|
||||||
ld b, 9
|
ld b, 9
|
||||||
|
|
||||||
.next3
|
.next3
|
||||||
ldh a, [hFF91] ; a = distance between adjusted X coordinates
|
ldh a, [hCollidingSpriteTempXValue] ; a = distance between adjusted X coordinates
|
||||||
sub b
|
sub b
|
||||||
ldh [hFF92], a ; store distance adjusted using sprite i's direction
|
ldh [hCollidingSpriteAdjustedDistance], a
|
||||||
ld a, b
|
ld a, b
|
||||||
ldh [hFF91], a ; store 7 or 9 depending on sprite i's delta X
|
ldh [hCollidingSpriteTempXValue], a ; store 7 or 9 depending on sprite i's delta X
|
||||||
jr c, .collision
|
jr c, .collision
|
||||||
|
|
||||||
; If sprite j's delta X is 0, then b = 7, else b = 9.
|
; If sprite j's delta X is 0, then b = 7, else b = 9.
|
||||||
|
@ -265,15 +265,15 @@ DetectCollisionBetweenSprites:
|
||||||
ld b, 9
|
ld b, 9
|
||||||
|
|
||||||
.next4
|
.next4
|
||||||
ldh a, [hFF92] ; a = distance adjusted using sprite i's direction
|
ldh a, [hCollidingSpriteAdjustedDistance]
|
||||||
sub b ; adjust distance using sprite j's direction
|
sub b ; adjust distance using sprite j's direction
|
||||||
jr z, .collision
|
jr z, .collision
|
||||||
jr nc, .next ; go to next sprite if distance is still positive after both adjustments
|
jr nc, .next ; go to next sprite if distance is still positive after both adjustments
|
||||||
|
|
||||||
.collision
|
.collision
|
||||||
ldh a, [hFF91] ; a = 7 or 9 depending on sprite i's delta X
|
ldh a, [hCollidingSpriteTempXValue] ; a = 7 or 9 depending on sprite i's delta X
|
||||||
ld b, a
|
ld b, a
|
||||||
ldh a, [hFF90] ; a = 7 or 9 depending on sprite i's delta Y
|
ldh a, [hCollidingSpriteTempYValue] ; a = 7 or 9 depending on sprite i's delta Y
|
||||||
inc l
|
inc l
|
||||||
|
|
||||||
; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100.
|
; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100.
|
||||||
|
@ -296,7 +296,7 @@ DetectCollisionBetweenSprites:
|
||||||
; to indicate which sprite the collision occurred with
|
; to indicate which sprite the collision occurred with
|
||||||
inc l
|
inc l
|
||||||
inc l
|
inc l
|
||||||
ldh a, [hFF8F] ; a = loop counter
|
ldh a, [hCollidingSpriteOffset]
|
||||||
ld de, SpriteCollisionBitTable
|
ld de, SpriteCollisionBitTable
|
||||||
add a
|
add a
|
||||||
add e
|
add e
|
||||||
|
@ -313,7 +313,7 @@ DetectCollisionBetweenSprites:
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
|
||||||
.next
|
.next
|
||||||
ldh a, [hFF8F] ; a = loop counter
|
ldh a, [hCollidingSpriteOffset]
|
||||||
inc a
|
inc a
|
||||||
cp $10
|
cp $10
|
||||||
jp nz, .loop
|
jp nz, .loop
|
||||||
|
|
|
@ -26,7 +26,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor::
|
||||||
jr .done
|
jr .done
|
||||||
.hiddenObjectNotFound
|
.hiddenObjectNotFound
|
||||||
farcall PrintBookshelfText
|
farcall PrintBookshelfText
|
||||||
ldh a, [hFFDB]
|
ldh a, [hInteractedWithBookshelf]
|
||||||
and a
|
and a
|
||||||
jr z, .done
|
jr z, .done
|
||||||
.nothingFound
|
.nothingFound
|
||||||
|
|
13
ram/hram.asm
13
ram/hram.asm
|
@ -85,10 +85,10 @@ hSpriteScreenX:: db
|
||||||
hSpriteScreenY:: db
|
hSpriteScreenY:: db
|
||||||
|
|
||||||
NEXTU
|
NEXTU
|
||||||
hFF8F:: db
|
hCollidingSpriteOffset:: db
|
||||||
hFF90:: db
|
hCollidingSpriteTempYValue:: db
|
||||||
hFF91:: db
|
hCollidingSpriteTempXValue:: db
|
||||||
hFF92:: db
|
hCollidingSpriteAdjustedDistance:: db
|
||||||
ENDU
|
ENDU
|
||||||
|
|
||||||
hTilePlayerStandingOn:: db
|
hTilePlayerStandingOn:: db
|
||||||
|
@ -327,11 +327,8 @@ hItemCounter::
|
||||||
hSavedCoordIndex::
|
hSavedCoordIndex::
|
||||||
hMissableObjectIndex::
|
hMissableObjectIndex::
|
||||||
hGymTrashCanRandNumMask::
|
hGymTrashCanRandNumMask::
|
||||||
|
hInteractedWithBookshelf::
|
||||||
db
|
db
|
||||||
|
|
||||||
NEXTU
|
|
||||||
hFFDB:: db
|
|
||||||
hFFDC:: db
|
|
||||||
ENDU
|
ENDU
|
||||||
|
|
||||||
ds 1
|
ds 1
|
||||||
|
|
|
@ -1914,7 +1914,7 @@ wMissableObjectFlagsEnd::
|
||||||
ds 7
|
ds 7
|
||||||
|
|
||||||
; temp copy of SPRITESTATEDATA1_IMAGEINDEX (used for sprite facing/anim)
|
; temp copy of SPRITESTATEDATA1_IMAGEINDEX (used for sprite facing/anim)
|
||||||
wd5cd:: db
|
wSpriteImageIndexBackup:: db
|
||||||
|
|
||||||
; each entry consists of 2 bytes
|
; each entry consists of 2 bytes
|
||||||
; * the sprite ID (depending on the current map)
|
; * the sprite ID (depending on the current map)
|
||||||
|
|
Loading…
Reference in a new issue