-
Notifications
You must be signed in to change notification settings - Fork 991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Name the unnamed hram variables and one wram label #438
Conversation
hFFDC goes completely unused so does it even needed to be declared?
@@ -80,7 +80,7 @@ DetectCollisionBetweenSprites: | |||
and $f0 | |||
or c | |||
|
|||
ldh [hFF90], a ; store Y coordinate adjusted for direction of movement | |||
ldh [hSpriteCollisionsTempYStore], a ; store Y coordinate adjusted for direction of movement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete comments when labels make them obsolete.
ldh [hSpriteCollisionsTempYStore], a ; store Y coordinate adjusted for direction of movement | |
ldh [hSpriteCollisionsTempYStore], a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these y coord and x coord stores are used for 2 purposes
- storing y or x coord adjusted for direction of movement
- storing the distance between the two sprites' adjusted y or x values
so I figured these comments would help distinguish, since wSpriteCollisionsTempYCoordOrDistanceBetweenSpriteAdjustedYValue
would be a bit much...hence why I named it hSpriteCollisionsTempYStore
initially, due to multiple purposes, all being dealing with Y or X values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I should make them into two?
hSpriteCollisionsTempYCoord::
hSpriteCollisionsDistanceBetweenAdjustedYValues:: db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I posted some more label suggestions after reading the file more carefully. Thanks for your patience with all the feedback.
Co-authored-by: Rangi <[email protected]>
ram/hram.asm
Outdated
@@ -330,8 +330,7 @@ hGymTrashCanRandNumMask:: | |||
db | |||
|
|||
NEXTU | |||
hFFDB:: db | |||
hFFDC:: db | |||
hInteractedWithBookshelf:: db ; set to 0 if you interacted with a bookshelf, $FF if not when attempting to interact with a hidden object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hInteractedWithBookshelf:: db ; set to 0 if you interacted with a bookshelf, $FF if not when attempting to interact with a hidden object | |
; when attempting to interact with a hidden object, | |
; set to 0 if you interacted with a bookshelf, $FF if not | |
hInteractedWithBookshelf:: db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also since hFFDC
is gone now, this can merge with the union above it (and I think we don't need the comment after all):
NEXTU
hItemCounter::
hSavedCoordIndex::
hMissableObjectIndex::
hInteractedWithBookshelf::
hGymTrashCanRandNumMask::
db
ENDU
@@ -296,7 +296,7 @@ DetectCollisionBetweenSprites: | |||
; to indicate which sprite the collision occurred with | |||
inc l | |||
inc l | |||
ldh a, [hFF8F] ; a = loop counter | |||
ldh a, [hSpriteCollisionsLoopCounter] | |||
ld de, SpriteCollisionBitTable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The data for SpriteCollisionBitTable
should use a loop:
SpriteCollisionBitTable:
FOR n, 16
bigdw 1 << n
ENDR
(The bigdw
macro will need porting from pokecrystal.)
ram/hram.asm
Outdated
hFF90:: db | ||
hFF91:: db | ||
hFF92:: db | ||
hSpriteCollisionsLoopCounter:: db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used as a 0-15 offset into SpriteCollisionBitTable
for the sprite being collision-tested with the "current sprite" (whose corresponding offset is already named hCurrentSpriteOffset
).
hSpriteCollisionsLoopCounter:: db | |
hCollidingSpriteOffset:: db |
ram/hram.asm
Outdated
hFF91:: db | ||
hFF92:: db | ||
hSpriteCollisionsLoopCounter:: db | ||
hSpriteCollisionsTempYCoord:: db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First this is initialized to [i#SPRITESTATEDATA1_YPIXELS]
with some +/-7 adjustment, and stored in [i#SPRITESTATEDATA1_YADJUSTED]
. Then the absolute difference between [i#SPRITESTATEDATA1_YADJUSTED]
and [j#SPRITESTATEDATA1_YADJUSTED]
is stored in it , and used to calculate hSpriteCollisionsAdjustedDistance
. It also has a "7 or 9 depending on sprite i's delta Y". I think it has enough overlapping purposes in the collision code that it can be thought of as a generic "Y-related temp value".
hSpriteCollisionsTempYCoord:: db | |
hCollidingSpriteTempYValue:: db |
ram/hram.asm
Outdated
hFF92:: db | ||
hSpriteCollisionsLoopCounter:: db | ||
hSpriteCollisionsTempYCoord:: db | ||
hSpriteCollisionsTempXCoord:: db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hSpriteCollisionsTempXCoord:: db | |
hCollidingSpriteTempXValue:: db |
ram/hram.asm
Outdated
hSpriteCollisionsLoopCounter:: db | ||
hSpriteCollisionsTempYCoord:: db | ||
hSpriteCollisionsTempXCoord:: db | ||
hSpriteCollisionsAdjustedDistance:: db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used for both the Y and X distance, so:
hSpriteCollisionsAdjustedDistance:: db | |
hCollidingSpriteAdjustedDistance:: db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! Getting closer to 100% :D
hFFDC goes completely unused so does it even need to be declared in the union?