diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-03 19:59:41 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-03 19:59:41 -0400 |
commit | 35deb771130a9012ee4494b1db097761f2fe2919 (patch) | |
tree | f47b099cdb4a165dc0a5b0e85f2e24780629680f /engine/overworld | |
parent | 55bb99580eeccc92106437c4ad86edb8ca89ecda (diff) |
H_CONSTANTNAMES -> hConstantNames
Diffstat (limited to 'engine/overworld')
-rwxr-xr-x | engine/overworld/auto_movement.asm | 4 | ||||
-rw-r--r-- | engine/overworld/clear_variables.asm | 2 | ||||
-rw-r--r-- | engine/overworld/missable_objects.asm | 14 | ||||
-rw-r--r-- | engine/overworld/movement.asm | 84 | ||||
-rw-r--r-- | engine/overworld/push_boulder.asm | 2 | ||||
-rw-r--r-- | engine/overworld/sprite_collisions.asm | 12 | ||||
-rwxr-xr-x | engine/overworld/trainer_sight.asm | 12 | ||||
-rwxr-xr-x | engine/overworld/turn_sprite.asm | 6 | ||||
-rw-r--r-- | engine/overworld/update_map.asm | 6 |
9 files changed, 71 insertions, 71 deletions
diff --git a/engine/overworld/auto_movement.asm b/engine/overworld/auto_movement.asm index e478c9ad..421e3180 100755 --- a/engine/overworld/auto_movement.asm +++ b/engine/overworld/auto_movement.asm @@ -66,7 +66,7 @@ PalletMovementScript_OakMoveLeft: call FillMemory ld [hl], $ff ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a ld de, wNPCMovementDirections2 call MoveSprite ld a, $1 @@ -282,7 +282,7 @@ FreezeEnemyTrainerSprite:: jr .loop .notRival ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a jp SetSpriteMovementBytesToFF RivalIDs: diff --git a/engine/overworld/clear_variables.asm b/engine/overworld/clear_variables.asm index 32dc85cd..b5a1f4a0 100644 --- a/engine/overworld/clear_variables.asm +++ b/engine/overworld/clear_variables.asm @@ -3,7 +3,7 @@ ClearVariablesOnEnterMap:: ld [hWY], a ld [rWY], a xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld [wStepCounter], a ld [wLoneAttackNo], a ld [hJoyPressed], a diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm index 7d6de545..6d365715 100644 --- a/engine/overworld/missable_objects.asm +++ b/engine/overworld/missable_objects.asm @@ -31,19 +31,19 @@ LoadMissableObjects: sub d ld h, a ld a, h - ld [H_DIVIDEND], a + ld [hDividend], a ld a, l - ld [H_DIVIDEND+1], a + ld [hDividend+1], a xor a - ld [H_DIVIDEND+2], a - ld [H_DIVIDEND+3], a + ld [hDividend+2], a + ld [hDividend+3], a ld a, $3 - ld [H_DIVISOR], a + ld [hDivisor], a ld b, $2 call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours) ld a, [wCurMap] ld b, a - ld a, [H_DIVIDEND+3] + ld a, [hDividend+3] ld c, a ; store global offset in c ld de, wMissableObjectList pop hl @@ -99,7 +99,7 @@ InitializeMissableObjectsFlags: ; tests if current sprite is a missable object that is hidden/has been removed IsObjectHidden: - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] swap a ld b, a ld hl, wMissableObjectList diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index f272f497..432ae5ca 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -63,7 +63,7 @@ UpdatePlayerSprite: ld a, [wd736] bit 7, a ; is the player sprite spinning due to a spin tile? jr nz, .skipSpriteAnim - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $7 ld l, a ld a, [hl] @@ -103,7 +103,7 @@ UpdatePlayerSprite: UnusedReadSpriteDataFunction: push bc push af - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] ld c, a pop af add c @@ -112,7 +112,7 @@ UnusedReadSpriteDataFunction: ret UpdateNPCSprite: - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] swap a dec a add a @@ -122,7 +122,7 @@ UpdateNPCSprite: ld a, [hl] ; read movement byte 2 ld [wCurSpriteMovement2], a ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] ld l, a inc l ld a, [hl] ; c1x1 @@ -131,7 +131,7 @@ UpdateNPCSprite: call CheckSpriteAvailability ret c ; if sprite is invisible, on tile >=MAP_TILESET_SIZE, in grass or player is currently walking ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] ld l, a inc l ld a, [hl] ; c1x1 @@ -151,7 +151,7 @@ UpdateNPCSprite: ret nz ; don't do anything yet if player is currently moving (redundant, already tested in CheckSpriteAvailability) call InitializeSpriteScreenPosition ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $6 ld l, a ld a, [hl] ; c2x6: movement byte 1 @@ -264,11 +264,11 @@ ChangeFacingDirection: TryWalking: push hl ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $9 ld l, a ld [hl], c ; c1x9 (update facing direction) - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $3 ld l, a ld [hl], d ; c1x3 (update Y movement delta) @@ -282,7 +282,7 @@ TryWalking: pop de ret c ; cannot walk there (reinitialization of delay values already done) ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $4 ld l, a ld a, [hl] ; c2x4: Y position @@ -291,7 +291,7 @@ TryWalking: ld a, [hl] ; c2x5: X position add e ld [hl], a ; update X position - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] ld l, a ld [hl], $10 ; c2x0=16: walk animation counter dec h @@ -301,7 +301,7 @@ TryWalking: ; update the walking animation parameters for a sprite that is currently walking UpdateSpriteInWalkingAnimation: - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $7 ld l, a ld a, [hl] ; c1x7 (counter until next walk animation frame) @@ -317,7 +317,7 @@ UpdateSpriteInWalkingAnimation: and $3 ld [hl], a ; advance to next animation frame every 4 ticks (16 ticks total for one step) .noNextAnimationFrame - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $3 ld l, a ld a, [hli] ; c1x3 (movement Y delta) @@ -330,7 +330,7 @@ UpdateSpriteInWalkingAnimation: ld a, [hl] ; c1x6 (screen X position) add b ld [hl], a ; update screen X position - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] ld l, a inc h ld a, [hl] ; c2x0 (walk animation counter) @@ -343,7 +343,7 @@ UpdateSpriteInWalkingAnimation: ld a, [hl] ; c2x6 (movement byte 1) cp $fe jr nc, .initNextMovementCounter ; values $fe and $ff - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] inc a ld l, a dec h @@ -351,14 +351,14 @@ UpdateSpriteInWalkingAnimation: ret .initNextMovementCounter call Random - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $8 ld l, a ld a, [hRandomAdd] and $7f ld [hl], a ; c2x8: set next movement delay to a random value in [0,$7f] dec h ; note that value 0 actually makes the delay $100 (bug?) - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] inc a ld l, a ld [hl], $2 ; c1x1 = 2 (movement status) @@ -375,7 +375,7 @@ UpdateSpriteInWalkingAnimation: ; update delay value (c2x8) for sprites in the delayed state (c1x1) UpdateSpriteMovementDelay: ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $6 ld l, a ld a, [hl] ; c2x6: movement byte 1 @@ -390,13 +390,13 @@ UpdateSpriteMovementDelay: jr nz, notYetMoving .moving dec h - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] inc a ld l, a ld [hl], $1 ; c1x1 = 1 (mark as ready to move) notYetMoving: ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $8 ld l, a ld [hl], $0 ; c1x8 = 0 (walk animation frame) @@ -429,7 +429,7 @@ MakeNPCFacePlayer: .notFacingRight ld c, SPRITE_FACING_LEFT .facingDirectionDetermined - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $9 ld l, a ld [hl], c ; c1x9: set facing direction @@ -440,7 +440,7 @@ InitializeSpriteStatus: inc l ld [hl], $ff ; $c1x2: set sprite image to $ff (invisible/off screen) inc h - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld a, $8 @@ -451,7 +451,7 @@ InitializeSpriteStatus: ; calculates the sprite's screen position form its map position and the player position InitializeSpriteScreenPosition: ld h, wSpriteStateData2 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $4 ld l, a ld a, [wYCoord] @@ -479,13 +479,13 @@ CheckSpriteAvailability: and a jp nz, .spriteInvisible ld h, wSpriteStateData2 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $6 ld l, a ld a, [hl] ; c2x6: movement byte 1 cp $fe jr c, .skipXVisibilityTest ; movement byte 1 < $fe (i.e. the sprite's movement is scripted) - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $4 ld l, a ld b, [hl] ; c2x4: Y pos (+4) @@ -527,7 +527,7 @@ CheckSpriteAvailability: jr c, .spriteVisible ; standing on tile with ID >=MAP_TILESET_SIZE (top right tile) .spriteInvisible ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld [hl], $ff ; c1x2 @@ -540,7 +540,7 @@ CheckSpriteAvailability: jr nz, .done ; if player is currently walking, we're done call UpdateSpriteImage inc h - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $7 ld l, a ld a, [wGrassTile] @@ -556,7 +556,7 @@ CheckSpriteAvailability: UpdateSpriteImage: ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $8 ld l, a ld a, [hli] ; c1x8: walk animation frame @@ -567,7 +567,7 @@ UpdateSpriteImage: ld a, [$ff93] ; current sprite offset add b ld b, a - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld [hl], b ; c1x2: sprite to display @@ -581,7 +581,7 @@ UpdateSpriteImage: ; set carry on failure, clears carry on success CanWalkOntoTile: ld h, wSpriteStateData2 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $6 ld l, a ld a, [hl] ; c2x6 (movement byte 1) @@ -602,14 +602,14 @@ CanWalkOntoTile: cp c jr nz, .tilePassableLoop ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $6 ld l, a 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 a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $4 ld l, a ld a, [hli] ; c1x4 (screen Y pos) @@ -628,14 +628,14 @@ CanWalkOntoTile: pop bc pop de ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld 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 a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld a, [hli] ; c2x2 (sprite Y displacement, initialized at $8, keep track of where a sprite did go) @@ -666,7 +666,7 @@ CanWalkOntoTile: ret .impassable ld h, $c1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] inc a ld l, a ld [hl], $2 ; c1x1 = 2 (set movement status to delayed) @@ -677,7 +677,7 @@ CanWalkOntoTile: inc l ld [hl], a ; c1x5 = 0 (clear X movement delta) inc h - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $8 ld l, a call Random @@ -692,7 +692,7 @@ CanWalkOntoTile: ; hl: output pointer GetTileSpriteStandsOn: ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $4 ld l, a ld a, [hli] ; c1x4: screen Y position @@ -784,7 +784,7 @@ DoScriptedNPCMovement: ld a, [hl] add b ld [hl], a - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $9 ld l, a ld a, c @@ -817,7 +817,7 @@ GetSpriteScreenXPointer: GetSpriteScreenXYPointerCommon: ld hl, wSpriteStateData1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add l add b ld l, a @@ -825,7 +825,7 @@ GetSpriteScreenXYPointerCommon: AnimScriptedNPCMovement: ld hl, wSpriteStateData2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $e ld l, a ld a, [hl] ; VRAM slot @@ -833,7 +833,7 @@ AnimScriptedNPCMovement: swap a ld b, a ld hl, wSpriteStateData1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $9 ld l, a ld a, [hl] ; facing direction @@ -852,7 +852,7 @@ AnimScriptedNPCMovement: ld [hSpriteVRAMSlotAndFacing], a call AdvanceScriptedNPCAnimFrameCounter ld hl, wSpriteStateData1 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld a, [hSpriteVRAMSlotAndFacing] @@ -863,7 +863,7 @@ AnimScriptedNPCMovement: ret AdvanceScriptedNPCAnimFrameCounter: - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $7 ld l, a ld a, [hl] ; intra-animation frame counter diff --git a/engine/overworld/push_boulder.asm b/engine/overworld/push_boulder.asm index c45554f1..e4dd91cf 100644 --- a/engine/overworld/push_boulder.asm +++ b/engine/overworld/push_boulder.asm @@ -92,7 +92,7 @@ DoBoulderDustAnimation:: call ResetBoulderPushFlags set 7, [hl] ld a, [wBoulderSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call GetSpriteMovementByte2Pointer ld [hl], $10 ld a, SFX_CUT diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index 0e6b2d06..43d1759c 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -6,7 +6,7 @@ _UpdateSprites:: ld l, a sub $e ld c, a - ld [H_CURRENTSPRITEOFFSET], a + ld [hCurrentSpriteOffset], a ld a, [hl] and a jr z, .skipSprite ; tests $c2Xe @@ -34,14 +34,14 @@ UpdateNonPlayerSprite: ld [$ff93], a ; $10 * sprite# ld a, [wNPCMovementScriptSpriteOffset] ; some sprite offset? ld b, a - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] cp b jr nz, .unequal jp DoScriptedNPCMovement .unequal jp UpdateNPCSprite -; This detects if the current sprite (whose offset is at H_CURRENTSPRITEOFFSET) +; This detects if the current sprite (whose offset is at hCurrentSpriteOffset) ; is going to collide with another sprite by looping over the other sprites. ; The current sprite's offset will be labelled with i (e.g. $c1i0). ; The loop sprite's offset will labelled with j (e.g. $c1j0). @@ -54,7 +54,7 @@ DetectCollisionBetweenSprites: nop ld h, wSpriteStateData1 / $100 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add wSpriteStateData1 % $100 ld l, a @@ -113,7 +113,7 @@ DetectCollisionBetweenSprites: ld [$ff8f], a ; store loop counter swap a ld e, a - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] cp e ; does the loop sprite match the current sprite? jp z, .next ; go to the next sprite if they match @@ -128,7 +128,7 @@ DetectCollisionBetweenSprites: inc a jp z, .next ; go the next sprite if offscreen - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add 10 ld l, a diff --git a/engine/overworld/trainer_sight.asm b/engine/overworld/trainer_sight.asm index 5a68b627..f0ea7266 100755 --- a/engine/overworld/trainer_sight.asm +++ b/engine/overworld/trainer_sight.asm @@ -2,7 +2,7 @@ _GetSpritePosition1:: ld hl, wSpriteStateData1 ld de, $4 ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call GetSpriteDataPointer ld a, [hli] ; c1x4 (screen Y pos) ld [$ffeb], a @@ -21,7 +21,7 @@ _GetSpritePosition2:: ld hl, wSpriteStateData1 ld de, $4 ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call GetSpriteDataPointer ld a, [hli] ; c1x4 (screen Y pos) ld [wSavedSpriteScreenY], a @@ -40,7 +40,7 @@ _SetSpritePosition1:: ld hl, wSpriteStateData1 ld de, $4 ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call GetSpriteDataPointer ld a, [$ffeb] ; c1x4 (screen Y pos) ld [hli], a @@ -59,7 +59,7 @@ _SetSpritePosition2:: ld hl, wSpriteStateData1 ld de, 4 ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a call GetSpriteDataPointer ld a, [wSavedSpriteScreenY] ld [hli], a ; c1x4 (screen Y pos) @@ -144,7 +144,7 @@ TrainerWalkUpToPlayer:: call FillMemory ; write the necessary steps to reach player ld [hl], $ff ; write end of list sentinel ld a, [wSpriteIndex] - ld [H_SPRITEINDEX], a + ld [hSpriteIndex], a jp MoveSprite_ ; input: de = offset within sprite entry @@ -152,7 +152,7 @@ TrainerWalkUpToPlayer:: GetSpriteDataPointer: push de add hl, de - ld a, [H_SPRITEINDEX] + ld a, [hSpriteIndex] swap a ld d, $0 ld e, a diff --git a/engine/overworld/turn_sprite.asm b/engine/overworld/turn_sprite.asm index c7f7712b..bef26537 100755 --- a/engine/overworld/turn_sprite.asm +++ b/engine/overworld/turn_sprite.asm @@ -1,12 +1,12 @@ UpdateSpriteFacingOffsetAndDelayMovement:: ld h, $c2 - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $8 ld l, a ld a, $7f ; maximum movement delay ld [hl], a ; c2x8 (movement delay) dec h - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $9 ld l, a ld a, [hld] ; c1x9 (facing direction) @@ -14,7 +14,7 @@ UpdateSpriteFacingOffsetAndDelayMovement:: xor a ld [hld], a ld [hl], a ; c1x8 (walk animation frame) - ld a, [H_CURRENTSPRITEOFFSET] + ld a, [hCurrentSpriteOffset] add $2 ld l, a ld a, [hl] ; c1x2 (facing and animation table offset) diff --git a/engine/overworld/update_map.asm b/engine/overworld/update_map.asm index 8577b9e7..c494065c 100644 --- a/engine/overworld/update_map.asm +++ b/engine/overworld/update_map.asm @@ -50,12 +50,12 @@ RedrawMapView: ld a, [wIsInBattle] inc a ret z - ld a, [H_AUTOBGTRANSFERENABLED] + ld a, [hAutoBGTransferEnabled] push af ld a, [hTilesetType] push af xor a - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ld [hTilesetType], a ; no flower/water BG tile animations call LoadCurrentMapView call RunDefaultPaletteCommand @@ -114,7 +114,7 @@ RedrawMapView: pop af ld [hTilesetType], a pop af - ld [H_AUTOBGTRANSFERENABLED], a + ld [hAutoBGTransferEnabled], a ret CompareHLWithBC: |