diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-03 22:11:35 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-07-03 22:22:09 -0400 |
commit | 6ef36800b0dcb86100a7c716172015667e60dc99 (patch) | |
tree | 7e381171a7f42cadb6e619c839bfc4d3eb88e7d1 /engine | |
parent | 35deb771130a9012ee4494b1db097761f2fe2919 (diff) |
Replace raw hex values with HRAM constants
To do: turn constants into labels and use ldh
Diffstat (limited to 'engine')
25 files changed, 106 insertions, 106 deletions
diff --git a/engine/battle/animations.asm b/engine/battle/animations.asm index c16fa3ec..d858e066 100755 --- a/engine/battle/animations.asm +++ b/engine/battle/animations.asm @@ -163,7 +163,7 @@ DrawFrameBlock: PlayAnimation: xor a - ld [$FF8B], a ; it looks like nothing reads this + ld [hROMBankTemp], a ; it looks like nothing reads this ld [wSubAnimTransform], a ld a, [wAnimationID] ; get animation number dec a diff --git a/engine/battle/core.asm b/engine/battle/core.asm index e503243d..00852b2b 100755 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6870,9 +6870,9 @@ _LoadTrainerPic: ld d, a ; de contains pointer to trainer pic ld a, [wLinkState] and a - ld a, Bank(TrainerPics) ; this is where all the trainer pics are (not counting Red's) + ld a, BANK(TrainerPics) ; this is where all the trainer pics are (not counting Red's) jr z, .loadSprite - ld a, Bank(RedPicFront) + ld a, BANK(RedPicFront) .loadSprite call UncompressSpriteFromDE ld de, vFrontPic diff --git a/engine/battle/scale_sprites.asm b/engine/battle/scale_sprites.asm index 1774f7c5..11967ba1 100644 --- a/engine/battle/scale_sprites.asm +++ b/engine/battle/scale_sprites.asm @@ -17,7 +17,7 @@ ScaleFirstThreeSpriteColumnsByTwo: .columnInnerLoop push bc ld a, [de] - ld bc, -(7*8)+1 ; $ffc9, scale lower nybble and seek to previous output column + ld bc, -(7*8)+1 ; -$37, scale lower nybble and seek to previous output column call ScalePixelsByTwo ld a, [de] dec de @@ -32,7 +32,7 @@ ScaleFirstThreeSpriteColumnsByTwo: dec de dec de ld a, b - ld bc, -7*8 ; $ffc8, skip one output column (which has already been written along with the current one) + ld bc, -7*8 ; -$38, skip one output column (which has already been written along with the current one) add hl, bc ld b, a dec b diff --git a/engine/events/cinnabar_lab.asm b/engine/events/cinnabar_lab.asm index e642840d..e1598f98 100755 --- a/engine/events/cinnabar_lab.asm +++ b/engine/events/cinnabar_lab.asm @@ -35,7 +35,7 @@ GiveFossilToCinnabarLab:: ld e, a add hl, de ld a, [hl] - ld [$ffdb], a + ld [hItemToRemoveID], a cp DOME_FOSSIL jr z, .choseDomeFossil cp HELIX_FOSSIL diff --git a/engine/events/diploma.asm b/engine/events/diploma.asm index e53ef58f..24bd2f22 100755 --- a/engine/events/diploma.asm +++ b/engine/events/diploma.asm @@ -73,7 +73,7 @@ UnusedPlayerNameLengthFunc: ; Unused function that does a calculation involving the length of the player's ; name. ld hl, wPlayerName - ld bc, $ff00 + lb bc, $ff, $00 .loop ld a, [hli] cp "@" diff --git a/engine/events/hidden_objects/bookshelves.asm b/engine/events/hidden_objects/bookshelves.asm index 82cd8843..eaf744ff 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 - ld [$ffdb], a + ld [hFFDB], a ret .nextBookshelfEntry1 inc hl @@ -33,7 +33,7 @@ PrintBookshelfText:: jr .loop .noMatch ld a, $ff - ld [$ffdb], a + ld [hFFDB], a jpba PrintCardKeyText INCLUDE "data/tilesets/bookshelf_tile_ids.asm" diff --git a/engine/events/hidden_objects/cinnabar_gym_quiz.asm b/engine/events/hidden_objects/cinnabar_gym_quiz.asm index 9f549eea..6404717e 100644 --- a/engine/events/hidden_objects/cinnabar_gym_quiz.asm +++ b/engine/events/hidden_objects/cinnabar_gym_quiz.asm @@ -16,7 +16,7 @@ CinnabarGymQuiz:: pop af and $f0 swap a - ld [$ffdc], a + ld [hGymGateAnswer], a ld hl, CinnabarGymQuizIntroText call PrintText ld a, [hGymGateIndex] @@ -77,7 +77,7 @@ CinnabarGymGateFlagAction: CinnabarGymQuiz_1ea92: call YesNoChoice - ld a, [$ffdc] + ld a, [hGymGateAnswer] ld c, a ld a, [wCurrentMenuItem] cp c @@ -85,10 +85,10 @@ CinnabarGymQuiz_1ea92: ld hl, wCurrentMapScriptFlags set 5, [hl] ld a, [hGymGateIndex] - ld [$ffe0], a + ld [hBackupGymGateIndex], a ld hl, CinnabarGymQuizCorrectText call PrintText - ld a, [$ffe0] + ld a, [hBackupGymGateIndex] AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 ld c, a ld b, FLAG_SET @@ -122,7 +122,7 @@ CinnabarGymQuizCorrectText: TX_BLINK TX_ASM - ld a, [$ffe0] + ld a, [hBackupGymGateIndex] AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 ld c, a ld b, FLAG_TEST @@ -162,7 +162,7 @@ UpdateCinnabarGymGateTileBlocks_:: ld [wGymGateTileBlock], a push bc ld a, [hGymGateIndex] - ld [$ffe0], a + ld [hBackupGymGateIndex], a AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0 ld c, a ld b, FLAG_TEST diff --git a/engine/events/pick_up_item.asm b/engine/events/pick_up_item.asm index 9f19100a..5a658f22 100644 --- a/engine/events/pick_up_item.asm +++ b/engine/events/pick_up_item.asm @@ -15,7 +15,7 @@ PickUpItem: .isMissable ld a, [hl] - ld [$ffdb], a + ld [hMissableObjectIndex], a ld hl, wMapSpriteExtraData ld a, [hSpriteIndexOrTextID] @@ -30,7 +30,7 @@ PickUpItem: call GiveItem jr nc, .BagFull - ld a, [$ffdb] + ld a, [hMissableObjectIndex] ld [wMissableObjectIndex], a predef HideObject ld a, 1 diff --git a/engine/events/saffron_guards.asm b/engine/events/saffron_guards.asm index 02ab92ea..59c2725c 100755 --- a/engine/events/saffron_guards.asm +++ b/engine/events/saffron_guards.asm @@ -2,7 +2,7 @@ RemoveGuardDrink:: ld hl, GuardDrinksList .drinkLoop ld a, [hli] - ld [$ffdb], a + ld [hItemToRemoveID], a and a ret z push hl diff --git a/engine/gfx/oam_dma.asm b/engine/gfx/oam_dma.asm index b0d64675..aeea4c01 100644 --- a/engine/gfx/oam_dma.asm +++ b/engine/gfx/oam_dma.asm @@ -1,12 +1,12 @@ WriteDMACodeToHRAM:: ; Since no other memory is available during OAM DMA, ; DMARoutine is copied to HRAM and executed there. - ld c, $ff80 % $100 + ld c, hDMARoutine % $100 ld b, DMARoutineEnd - DMARoutine ld hl, DMARoutine .copy ld a, [hli] - ld [$ff00+c], a + ldh [c], a inc c dec b jr nz, .copy diff --git a/engine/gfx/screen_effects.asm b/engine/gfx/screen_effects.asm index 95f0ea25..0d3806c1 100755 --- a/engine/gfx/screen_effects.asm +++ b/engine/gfx/screen_effects.asm @@ -19,7 +19,7 @@ PredefShakeScreenVertically: ld [wDisableVBlankWYUpdate], a xor a .loop - ld [$ff96], a + ld [hMutateWY], a call .MutateWY call .MutateWY dec b @@ -30,9 +30,9 @@ PredefShakeScreenVertically: ret .MutateWY - ld a, [$ff96] + ld a, [hMutateWY] xor b - ld [$ff96], a + ld [hMutateWY], a ld [rWY], a ld c, 3 jp DelayFrames @@ -43,7 +43,7 @@ PredefShakeScreenHorizontally: call GetPredefRegisters xor a .loop - ld [$ff97], a + ld [hMutateWX], a call .MutateWX ld c, 1 call DelayFrames @@ -58,9 +58,9 @@ PredefShakeScreenHorizontally: ret .MutateWX - ld a, [$ff97] + ld a, [hMutateWX] xor b - ld [$ff97], a + ld [hMutateWX], a bit 7, a jr z, .skipZeroing xor a ; zero a if it's negative diff --git a/engine/items/item_effects.asm b/engine/items/item_effects.asm index a793ae00..7e2aa227 100755 --- a/engine/items/item_effects.asm +++ b/engine/items/item_effects.asm @@ -1341,7 +1341,7 @@ ItemUseMedicine: push hl push de ld d, a - callab CalcExperience ; calculate experience for next level and store it at $ff96 + callab CalcExperience ; calculate experience for next level and store it at hExperience pop de pop hl ld bc, wPartyMon1Exp - wPartyMon1Level diff --git a/engine/link/cable_club.asm b/engine/link/cable_club.asm index 13b92e71..58008a94 100755 --- a/engine/link/cable_club.asm +++ b/engine/link/cable_club.asm @@ -663,7 +663,7 @@ TradeCenter_PrintPartyListNames: push de push hl ld a, c - ld [$ff95], a + ld [hPastLeadingZeros], a call GetMonName pop hl call PlaceString @@ -903,7 +903,7 @@ CableClub_Run: ld [wTilesetGfxPtr + 1], a ld a, l ld [wTilesetGfxPtr], a - ld a, Bank(Club_GFX) + ld a, BANK(Club_GFX) ld [wTilesetBank], a ld hl, Club_Coll ld a, h diff --git a/engine/menus/pokedex.asm b/engine/menus/pokedex.asm index 0b7fb83c..baf656b6 100755 --- a/engine/menus/pokedex.asm +++ b/engine/menus/pokedex.asm @@ -566,11 +566,11 @@ ShowPokedexDataInternal: pop hl inc hl ; hl = address of pokedex description text coord bc, 1, 11 - ld a, 2 - ld [$fff4], a + ld a, %10 + ld [hClearLetterPrintingDelayFlags], a call TextCommandProcessor ; print pokedex description text xor a - ld [$fff4], a + ld [hClearLetterPrintingDelayFlags], a .waitForButtonPress call JoypadLowSensitivity ld a, [hJoy5] diff --git a/engine/menus/save.asm b/engine/menus/save.asm index 5aec7bd0..f2ecc3aa 100755 --- a/engine/menus/save.asm +++ b/engine/menus/save.asm @@ -601,9 +601,9 @@ GetMonCountsForBoxesInBank: ret SAVCheckRandomID: -;checks if Sav file is the same by checking player's name 1st letter ($a598) +; checks if Sav file is the same by checking player's name 1st letter ; and the two random numbers generated at game beginning -;(which are stored at wPlayerID)s +; (which are stored at wPlayerID)s ld a, $0a ld [MBC1SRamEnable], a ld a, $01 @@ -702,7 +702,7 @@ ClearSAV: PadSRAM_FF: ld [MBC1SRamBank], a - ld hl, $a000 - ld bc, $2000 + ld hl, $a000 ; start of SRAM + ld bc, $2000 ; size of SRAM ld a, $ff jp FillMemory diff --git a/engine/menus/swap_items.asm b/engine/menus/swap_items.asm index 826fe60b..8b793ea1 100644 --- a/engine/menus/swap_items.asm +++ b/engine/menus/swap_items.asm @@ -77,18 +77,18 @@ HandleItemListSwapping:: cp b jr z, .swapSameItemType .swapDifferentItems - ld [$ff95], a ; [$ff95] = second item ID + ld [hSwapItemID], a ; save second item ID ld a, [hld] - ld [$ff96], a ; [$ff96] = second item quantity + ld [hSwapItemQuantity], a ; save second item quantity ld a, [de] ld [hli], a ; put first item ID in second item slot inc de ld a, [de] ld [hl], a ; put first item quantity in second item slot - ld a, [$ff96] + ld a, [hSwapItemQuantity] ld [de], a ; put second item quantity in first item slot dec de - ld a, [$ff95] + ld a, [hSwapItemID] ld [de], a ; put second item ID in first item slot xor a ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped diff --git a/engine/movie/oak_speech/oak_speech.asm b/engine/movie/oak_speech/oak_speech.asm index ea7b84d8..578cf3b2 100755 --- a/engine/movie/oak_speech/oak_speech.asm +++ b/engine/movie/oak_speech/oak_speech.asm @@ -57,7 +57,7 @@ OakSpeech: bit 1, a ; possibly a debug mode bit jp nz, .skipChoosingNames ld de, ProfOakPic - lb bc, Bank(ProfOakPic), $00 + lb bc, BANK(ProfOakPic), $00 call IntroDisplayPicCenteredOrUpperRight call FadeInIntroPic ld hl, OakSpeechText1 @@ -76,7 +76,7 @@ OakSpeech: call GBFadeOutToWhite call ClearScreen ld de, RedPicFront - lb bc, Bank(RedPicFront), $00 + lb bc, BANK(RedPicFront), $00 call IntroDisplayPicCenteredOrUpperRight call MovePicLeft ld hl, IntroducePlayerText @@ -85,7 +85,7 @@ OakSpeech: call GBFadeOutToWhite call ClearScreen ld de, Rival1Pic - lb bc, Bank(Rival1Pic), $00 + lb bc, BANK(Rival1Pic), $00 call IntroDisplayPicCenteredOrUpperRight call FadeInIntroPic ld hl, IntroduceRivalText @@ -95,7 +95,7 @@ OakSpeech: call GBFadeOutToWhite call ClearScreen ld de, RedPicFront - lb bc, Bank(RedPicFront), $00 + lb bc, BANK(RedPicFront), $00 call IntroDisplayPicCenteredOrUpperRight call GBFadeInFromWhite ld a, [wd72d] diff --git a/engine/overworld/hidden_objects.asm b/engine/overworld/hidden_objects.asm index 5887660e..a19694e0 100755 --- a/engine/overworld/hidden_objects.asm +++ b/engine/overworld/hidden_objects.asm @@ -14,14 +14,14 @@ IsPlayerOnDungeonWarp:: set 4, [hl] ret -; if a hidden object was found, stores $00 in [$ffee], else stores $ff +; if a hidden object was found, stores $00 in [hFoundHiddenObject], else stores $ff CheckForHiddenObject:: - ld hl, $ffeb + ld hl, hFoundHiddenObjectOrBookshelf xor a - ld [hli], a - ld [hli], a - ld [hli], a - ld [hl], a + ld [hli], a ; [hFoundHiddenObjectOrBookshelf] + ld [hli], a ; [hSavedMapTextPtr] + ld [hli], a ; [hSavedMapTextPtr + 1] + ld [hl], a ; [hFoundHiddenObject] ld de, $0 ld hl, HiddenObjectMaps .hiddenMapLoop @@ -81,7 +81,7 @@ CheckForHiddenObject:: ret .noMatch ld a, $ff - ld [$ffee], a + ld [hFoundHiddenObject], a ret ; checks if the coordinates in front of the player's sprite match Y in b and X in c diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm index 6d365715..a89fcb54 100644 --- a/engine/overworld/missable_objects.asm +++ b/engine/overworld/missable_objects.asm @@ -120,7 +120,7 @@ IsObjectHidden: .notHidden xor a .hidden - ld [$ffe5], a + ld [hIsHiddenMissableObject], a ret ; adds missable object (items, leg. pokemon, etc.) to the map diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 432ae5ca..6c354779 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -475,7 +475,7 @@ InitializeSpriteScreenPosition: ; tests if sprite is off screen or otherwise unable to do anything CheckSpriteAvailability: predef IsObjectHidden - ld a, [$ffe5] + ld a, [hIsHiddenMissableObject] and a jp nz, .spriteInvisible ld h, wSpriteStateData2 / $100 @@ -564,7 +564,7 @@ UpdateSpriteImage: ld a, [hl] ; c1x9: facing direction add b ld b, a - ld a, [$ff93] ; current sprite offset + ld a, [hTilePlayerStandingOn] add b ld b, a ld a, [hCurrentSpriteOffset] diff --git a/engine/overworld/player_state.asm b/engine/overworld/player_state.asm index 69b9201f..ea24fdc1 100644 --- a/engine/overworld/player_state.asm +++ b/engine/overworld/player_state.asm @@ -297,7 +297,7 @@ _GetTileAndCoordsInFrontOfPlayer: GetTileTwoStepsInFrontOfPlayer: xor a - ld [$ffdb], a + ld [hPlayerFacing], a ld hl, wYCoord ld a, [hli] ld d, a @@ -306,7 +306,7 @@ GetTileTwoStepsInFrontOfPlayer: and a ; cp SPRITE_FACING_DOWN jr nz, .notFacingDown ; facing down - ld hl, $ffdb + ld hl, hPlayerFacing set 0, [hl] aCoord 8, 13 inc d @@ -315,7 +315,7 @@ GetTileTwoStepsInFrontOfPlayer: cp SPRITE_FACING_UP jr nz, .notFacingUp ; facing up - ld hl, $ffdb + ld hl, hPlayerFacing set 1, [hl] aCoord 8, 5 dec d @@ -324,7 +324,7 @@ GetTileTwoStepsInFrontOfPlayer: cp SPRITE_FACING_LEFT jr nz, .notFacingLeft ; facing left - ld hl, $ffdb + ld hl, hPlayerFacing set 2, [hl] aCoord 4, 9 dec e @@ -333,7 +333,7 @@ GetTileTwoStepsInFrontOfPlayer: cp SPRITE_FACING_RIGHT jr nz, .storeTile ; facing right - ld hl, $ffdb + ld hl, hPlayerFacing set 3, [hl] aCoord 12, 9 inc e @@ -378,33 +378,33 @@ CheckForBoulderCollisionWithSprites: ld hl, wSpriteStateData2 + $14 add hl, de ld a, [hli] ; map Y position - ld [$ffdc], a + ld [hPlayerYCoord], a ld a, [hl] ; map X position - ld [$ffdd], a + ld [hPlayerXCoord], a ld a, [wNumSprites] ld c, a ld de, $f ld hl, wSpriteStateData2 + $14 - ld a, [$ffdb] + ld a, [hPlayerFacing] and $3 ; facing up or down? jr z, .pushingHorizontallyLoop .pushingVerticallyLoop inc hl - ld a, [$ffdd] + ld a, [hPlayerXCoord] cp [hl] jr nz, .nextSprite1 ; if X coordinates don't match dec hl ld a, [hli] ld b, a - ld a, [$ffdb] + ld a, [hPlayerFacing] rrca jr c, .pushingDown ; pushing up - ld a, [$ffdc] + ld a, [hPlayerYCoord] dec a jr .compareYCoords .pushingDown - ld a, [$ffdc] + ld a, [hPlayerYCoord] inc a .compareYCoords cp b @@ -417,19 +417,19 @@ CheckForBoulderCollisionWithSprites: .pushingHorizontallyLoop ld a, [hli] ld b, a - ld a, [$ffdc] + ld a, [hPlayerYCoord] cp b jr nz, .nextSprite2 ld b, [hl] - ld a, [$ffdb] + ld a, [hPlayerFacing] bit 2, a jr nz, .pushingLeft ; pushing right - ld a, [$ffdd] + ld a, [hPlayerXCoord] inc a jr .compareXCoords .pushingLeft - ld a, [$ffdd] + ld a, [hPlayerXCoord] dec a .compareXCoords cp b diff --git a/engine/overworld/sprite_collisions.asm b/engine/overworld/sprite_collisions.asm index 43d1759c..c5ff8ebb 100644 --- a/engine/overworld/sprite_collisions.asm +++ b/engine/overworld/sprite_collisions.asm @@ -31,7 +31,7 @@ _UpdateSprites:: UpdateNonPlayerSprite: dec a swap a - ld [$ff93], a ; $10 * sprite# + ld [hTilePlayerStandingOn], a ; $10 * sprite# ld a, [wNPCMovementScriptSpriteOffset] ; some sprite offset? ld b, a ld a, [hCurrentSpriteOffset] @@ -79,7 +79,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ld [$ff90], a ; store Y coordinate adjusted for direction of movement + ld [hFF90], a ; store Y coordinate adjusted for direction of movement ld a, [hli] ; a = [$c1i5] (delta X) (-1, 0, or 1) call SetSpriteCollisionValues @@ -92,7 +92,7 @@ DetectCollisionBetweenSprites: and $f0 or c - ld [$ff91], a ; store X coordinate adjusted for direction of movement + ld [hFF91], a ; store X coordinate adjusted for direction of movement ld a, l add 7 @@ -102,15 +102,15 @@ DetectCollisionBetweenSprites: ld [hld], a ; zero [$c1id] XXX what's [$c1id] for? ld [hld], a ; zero [$c1ic] (directions in which collisions occurred) - ld a, [$ff91] + ld a, [hFF91] ld [hld], a ; [$c1ib] = adjusted X coordinate - ld a, [$ff90] + ld a, [hFF90] ld [hl], a ; [$c1ia] = adjusted Y coordinate xor a ; zero the loop counter .loop - ld [$ff8f], a ; store loop counter + ld [hFF8F], a ; store loop counter swap a ld e, a ld a, [hCurrentSpriteOffset] @@ -154,7 +154,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry1 - ld [$ff90], a ; store the distance between the two sprites' adjusted Y values + ld [hFF90], 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 ; Y coordinate is larger. This information is used later to set [$c1ic], @@ -176,11 +176,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next1 - ld a, [$ff90] ; a = distance between adjusted Y coordinates + ld a, [hFF90] ; a = distance between adjusted Y coordinates sub b - ld [$ff92], a ; store distance adjusted using sprite i's direction + ld [hFF92], a ; store distance adjusted using sprite i's direction ld a, b - ld [$ff90], a ; store 7 or 9 depending on sprite i's delta Y + ld [hFF90], a ; store 7 or 9 depending on sprite i's delta Y jr c, .checkXDistance ; If sprite j's delta Y is 0, then b = 7, else b = 9. @@ -193,7 +193,7 @@ DetectCollisionBetweenSprites: ld b, 9 .next2 - ld a, [$ff92] ; a = distance adjusted using sprite i's direction + ld a, [hFF92] ; a = distance adjusted using sprite i's direction 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 @@ -225,7 +225,7 @@ DetectCollisionBetweenSprites: cpl inc a .noCarry2 - ld [$ff91], a ; store the distance between the two sprites' adjusted X values + ld [hFF91], 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 ; X coordinate is larger. This information is used later to set [$c1ic], @@ -247,11 +247,11 @@ DetectCollisionBetweenSprites: ld b, 9 .next3 - ld a, [$ff91] ; a = distance between adjusted X coordinates + ld a, [hFF91] ; a = distance between adjusted X coordinates sub b - ld [$ff92], a ; store distance adjusted using sprite i's direction + ld [hFF92], a ; store distance adjusted using sprite i's direction ld a, b - ld [$ff91], a ; store 7 or 9 depending on sprite i's delta X + ld [hFF91], a ; store 7 or 9 depending on sprite i's delta X jr c, .collision ; If sprite j's delta X is 0, then b = 7, else b = 9. @@ -264,15 +264,15 @@ DetectCollisionBetweenSprites: ld b, 9 .next4 - ld a, [$ff92] ; a = distance adjusted using sprite i's direction + ld a, [hFF92] ; a = distance adjusted using sprite i's direction 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 .collision - ld a, [$ff91] ; a = 7 or 9 depending on sprite i's delta X + ld a, [hFF91] ; a = 7 or 9 depending on sprite i's delta X ld b, a - ld a, [$ff90] ; a = 7 or 9 depending on sprite i's delta Y + ld a, [hFF90] ; a = 7 or 9 depending on sprite i's delta Y inc l ; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100. @@ -294,7 +294,7 @@ DetectCollisionBetweenSprites: ; set bit in [$c1ie] or [$c1if] to indicate which sprite the collision occurred with inc l inc l - ld a, [$ff8f] ; a = loop counter + ld a, [hFF8F] ; a = loop counter ld de, SpriteCollisionBitTable add a add e @@ -311,7 +311,7 @@ DetectCollisionBetweenSprites: ld [hl], a .next - ld a, [$ff8f] ; a = loop counter + ld a, [hFF8F] ; a = loop counter inc a cp $10 jp nz, .loop diff --git a/engine/overworld/tilesets.asm b/engine/overworld/tilesets.asm index d6b8221c..88147233 100644 --- a/engine/overworld/tilesets.asm +++ b/engine/overworld/tilesets.asm @@ -25,7 +25,7 @@ LoadTilesetHeader: ld a, [hl] ld [hTilesetType], a xor a - ld [$ffd8], a + ld [hMovingBGTilesCounter1], a pop hl ld a, [wCurMapTileset] push hl diff --git a/engine/overworld/trainer_sight.asm b/engine/overworld/trainer_sight.asm index f0ea7266..81978c35 100755 --- a/engine/overworld/trainer_sight.asm +++ b/engine/overworld/trainer_sight.asm @@ -5,16 +5,16 @@ _GetSpritePosition1:: ld [hSpriteIndex], a call GetSpriteDataPointer ld a, [hli] ; c1x4 (screen Y pos) - ld [$ffeb], a + ld [hSpriteScreenYCoord], a inc hl ld a, [hl] ; c1x6 (screen X pos) - ld [$ffec], a + ld [hSpriteScreenXCoord], a ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de ld a, [hli] ; c2x4 (map Y pos) - ld [$ffed], a + ld [hSpriteMapYCoord], a ld a, [hl] ; c2x5 (map X pos) - ld [$ffee], a + ld [hSpriteMapXCoord], a ret _GetSpritePosition2:: @@ -42,16 +42,16 @@ _SetSpritePosition1:: ld a, [wSpriteIndex] ld [hSpriteIndex], a call GetSpriteDataPointer - ld a, [$ffeb] ; c1x4 (screen Y pos) + ld a, [hSpriteScreenYCoord] ; c1x4 (screen Y pos) ld [hli], a inc hl - ld a, [$ffec] ; c1x6 (screen X pos) + ld a, [hSpriteScreenXCoord] ; c1x6 (screen X pos) ld [hl], a ld de, (wSpriteStateData2 + $4) - (wSpriteStateData1 + $6) add hl, de - ld a, [$ffed] ; c2x4 (map Y pos) + ld a, [hSpriteMapYCoord] ; c2x4 (map Y pos) ld [hli], a - ld a, [$ffee] ; c2x5 (map X pos) + ld a, [hSpriteMapXCoord] ; c2x5 (map X pos) ld [hl], a ret diff --git a/engine/overworld/update_map.asm b/engine/overworld/update_map.asm index c494065c..92ae2b10 100644 --- a/engine/overworld/update_map.asm +++ b/engine/overworld/update_map.asm @@ -63,7 +63,7 @@ RedrawMapView: ld a, [hli] ld h, [hl] ld l, a - ld de, -2 * 32 + ld de, -2 * BG_MAP_WIDTH add hl, de ld a, h and $3 @@ -73,23 +73,23 @@ RedrawMapView: ld a, h ld [wBuffer + 1], a ; this copy of the address is not used ld a, 2 - ld [$ffbe], a - ld c, 9 ; number of rows of 2x2 tiles (this covers the whole screen) + ld [hRedrawMapViewRowOffset], a + ld c, SCREEN_HEIGHT / 2 ; number of rows of 2x2 tiles (this covers the whole screen) .redrawRowLoop push bc push hl push hl ld hl, wTileMap - 2 * SCREEN_WIDTH ld de, SCREEN_WIDTH - ld a, [$ffbe] + ld a, [hRedrawMapViewRowOffset] .calcWRAMAddrLoop add hl, de dec a jr nz, .calcWRAMAddrLoop call CopyToRedrawRowOrColumnSrcTiles pop hl - ld de, $20 - ld a, [$ffbe] + ld de, BG_MAP_WIDTH + ld a, [hRedrawMapViewRowOffset] ld c, a .calcVRAMAddrLoop add hl, de @@ -104,7 +104,7 @@ RedrawMapView: ld a, REDRAW_ROW ld [hRedrawRowOrColumnMode], a call DelayFrame - ld hl, $ffbe + ld hl, hRedrawMapViewRowOffset inc [hl] inc [hl] pop hl |