diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-07 11:10:29 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-07 11:10:29 -0400 |
commit | 45ed05decf330faab4503fe8fecadc54698c9724 (patch) | |
tree | add3eeda2d09334209abe4e55341b674e64dd117 /engine/overworld | |
parent | bbc257476f9aac8d04d75a8036d412caa8f7d515 (diff) |
Use HIGH() and LOW()
Diffstat (limited to 'engine/overworld')
-rwxr-xr-x | engine/overworld/elevator.asm | 2 | ||||
-rw-r--r-- | engine/overworld/movement.asm | 22 | ||||
-rw-r--r-- | engine/overworld/sprite_collisions.asm | 4 |
3 files changed, 14 insertions, 14 deletions
diff --git a/engine/overworld/elevator.asm b/engine/overworld/elevator.asm index 7a6aca85..fa404602 100755 --- a/engine/overworld/elevator.asm +++ b/engine/overworld/elevator.asm @@ -56,7 +56,7 @@ ShakeElevatorRedrawRow: add hl, de ld a, h and $3 - or vBGMap0 / $100 + or HIGH(vBGMap0) ld d, a ld a, l pop hl diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index ac7e1b46..a20b3174 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -23,7 +23,7 @@ UpdatePlayerSprite: ret .lowerLeftTileIsMapTile call DetectCollisionBetweenSprites - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ld a, [wWalkCounter] and a jr nz, .moving @@ -395,7 +395,7 @@ UpdateSpriteMovementDelay: ld l, a ld [hl], $1 ; c1x1 = 1 (mark as ready to move) notYetMoving: - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData1AnimFrameCounter - wSpritePlayerStateData1 ld l, a @@ -450,7 +450,7 @@ InitializeSpriteStatus: ; calculates the sprite's screen position form its map position and the player position InitializeSpriteScreenPosition: - ld h, wSpriteStateData2 / $100 + ld h, HIGH(wSpriteStateData2) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData2MapY - wSpritePlayerStateData2 ld l, a @@ -478,7 +478,7 @@ CheckSpriteAvailability: ldh a, [hIsHiddenMissableObject] and a jp nz, .spriteInvisible - ld h, wSpriteStateData2 / $100 + ld h, HIGH(wSpriteStateData2) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData2MovementByte1 - wSpritePlayerStateData2 ld l, a @@ -526,7 +526,7 @@ CheckSpriteAvailability: cp d jr c, .spriteVisible ; standing on tile with ID >=MAP_TILESET_SIZE (top right tile) .spriteInvisible - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData1ImageIndex - wSpritePlayerStateData1 ld l, a @@ -580,7 +580,7 @@ UpdateSpriteImage: ; e: X movement delta (-1, 0 or 1) ; set carry on failure, clears carry on success CanWalkOntoTile: - ld h, wSpriteStateData2 / $100 + ld h, HIGH(wSpriteStateData2) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData2MovementByte1 - wSpritePlayerStateData2 ld l, a @@ -608,7 +608,7 @@ CanWalkOntoTile: ld a, [hl] ; $c2x6 (movement byte 1) inc a jr z, .impassable ; if $ff, no movement allowed (however, changing direction is) - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1 ld l, a @@ -627,14 +627,14 @@ CanWalkOntoTile: call DetectCollisionBetweenSprites pop bc pop de - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add $c ld l, a ld a, [hl] ; c1xc (directions in which sprite collision would occur) and b ; check against chosen direction (1,2,4 or 8) jr nz, .impassable ; collision between sprites, don't go there - ld h, wSpriteStateData2 / $100 + ld h, HIGH(wSpriteStateData2) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData2YDisplacement - wSpritePlayerStateData2 ld l, a @@ -665,7 +665,7 @@ CanWalkOntoTile: and a ; clear carry (marking success) ret .impassable - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] inc a ld l, a @@ -691,7 +691,7 @@ CanWalkOntoTile: ; this is always the lower left tile of the 2x2 tile blocks all sprites are snapped to ; hl: output pointer GetTileSpriteStandsOn: - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1 ld l, a diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index e6c415ab..6f8e3c2c 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -53,9 +53,9 @@ UpdateNonPlayerSprite: DetectCollisionBetweenSprites: nop - ld h, wSpriteStateData1 / $100 + ld h, HIGH(wSpriteStateData1) ldh a, [hCurrentSpriteOffset] - add wSpriteStateData1 % $100 + add LOW(wSpriteStateData1) ld l, a ld a, [hl] ; a = [$c1i0] (picture) (0 if slot is unused) |