diff options
| author | Rangi <remy.oukaour+rangi42@gmail.com> | 2022-10-02 22:42:26 -0400 |
|---|---|---|
| committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2022-10-02 22:42:26 -0400 |
| commit | 7dd9d7dc80dcd57ce079d0f365257035e9df4614 (patch) | |
| tree | 3807ecb72443ecf12feb4faa0e4d811bad279458 /engine/overworld/map_sprites.asm | |
| parent | Merge remote-tracking branch 'remotes/pokered/master' (diff) | |
| parent | Require rgbds 0.6.0 (diff) | |
| download | pokeyellow-7dd9d7dc80dcd57ce079d0f365257035e9df4614.tar.gz pokeyellow-7dd9d7dc80dcd57ce079d0f365257035e9df4614.tar.xz pokeyellow-7dd9d7dc80dcd57ce079d0f365257035e9df4614.zip | |
Merge remote-tracking branch 'remotes/pokered/master'
Diffstat (limited to 'engine/overworld/map_sprites.asm')
| -rw-r--r-- | engine/overworld/map_sprites.asm | 68 |
1 files changed, 35 insertions, 33 deletions
diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm index c0fb4863..d1bc7832 100644 --- a/engine/overworld/map_sprites.asm +++ b/engine/overworld/map_sprites.asm @@ -11,7 +11,7 @@ _InitMapSprites:: call InitOutsideMapSprites ret c ; return if the map is an outside map (already handled by above call) -; if the map is an inside map (i.e. mapID >= $25) +; if the map is an inside map (i.e. mapID >= FIRST_INDOOR_MAP) call LoadSpriteSetFromMapHeader call LoadMapSpriteTilePatterns call Func_14150 @@ -38,11 +38,11 @@ InitOutsideMapSprites: dec a ld c, a ld b, 0 - ld a, (wSpriteSetID - wSpriteSet) + ld a, wSpriteSetID - wSpriteSet ld hl, SpriteSets call AddNTimes ; get sprite set offset ld de, wSpriteSet - ld bc, (wSpriteSetID - wSpriteSet) + ld bc, wSpriteSetID - wSpriteSet call CopyData ; copy it to wSpriteSet call LoadMapSpriteTilePatterns .skipLoadingSpriteSet @@ -186,7 +186,7 @@ LoadWalkingTilePattern: ld d, h ld e, l call GetSpriteVRAMAddress - set 3, h ; add $800 to hl + set 3, h ; add $80 tiles to hl call CopyVideoDataAlternate ret @@ -205,19 +205,17 @@ GetSpriteVRAMAddress: ret SpriteVRAMAddresses: -; Equivalent to multiplying $C0 (number of bytes in 12 tiles) times the VRAM -; slot and adding the result to $8000 (the VRAM base address). - dw vChars0 + $0c0 - dw vChars0 + $180 - dw vChars0 + $240 - dw vChars0 + $300 - dw vChars0 + $3c0 - dw vChars0 + $480 - dw vChars0 + $540 - dw vChars0 + $600 - dw vChars0 + $6c0 - dw vChars0 + $780 ; 4-tile sprites - dw vChars0 + $7c0 ; 4-tile sprites + dw vChars0 + (1 * 12) tiles + dw vChars0 + (2 * 12) tiles + dw vChars0 + (3 * 12) tiles + dw vChars0 + (4 * 12) tiles + dw vChars0 + (5 * 12) tiles + dw vChars0 + (6 * 12) tiles + dw vChars0 + (7 * 12) tiles + dw vChars0 + (8 * 12) tiles + dw vChars0 + (9 * 12) tiles + dw vChars0 + (10 * 12) tiles ; 4-tile sprites + dw vChars0 + (10 * 12 + 4) tiles ; 4-tile sprites ReadSpriteSheetData: ldh a, [hVRAMSlot] @@ -263,7 +261,7 @@ Func_14150: jr z, .spriteUnused call Func_14179 push hl - ld de, (wSpritePlayerStateData2ImageBaseOffset) - (wSpriteStateData1) ; $10e + ld de, wSpritePlayerStateData2ImageBaseOffset - wSpriteStateData1 add hl, de ; [x#SPRITESTATEDATA2_IMAGEBASEOFFSET] ld [hl], a ; write offset pop hl @@ -304,11 +302,11 @@ GetSplitMapSpriteSetID: ld hl, MapSpriteSets add hl, de ld a, [hl] ; a = spriteSetID - cp $f0 ; does the map have 2 sprite sets? + cp FIRST_SPLIT_SET - 1 ; does the map have 2 sprite sets? ret c ; Chooses the correct sprite set ID depending on the player's position within ; the map for maps with two sprite sets. - cp $f8 + cp SPLITSET_ROUTE_20 jr z, .route20 ld hl, SplitMapSpriteSets and $0f @@ -320,8 +318,8 @@ GetSplitMapSpriteSetID: jr nc, .noCarry inc h .noCarry - ld a, [hli] ; determines whether the map is split East/West or North/South - cp $01 + ld a, [hli] ; whether the map is split EAST_WEST or NORTH_SOUTH + cp EAST_WEST ld a, [hli] ; position of dividing line ld b, a jr z, .eastWestDivide @@ -333,35 +331,39 @@ GetSplitMapSpriteSetID: .compareCoord cp b jr c, .loadSpriteSetID -; if in the East side or South side +; if in the east side or south side inc hl .loadSpriteSetID ld a, [hl] ret -; Uses sprite set $01 for West side and $0A for East side. +; Uses sprite set SPRITESET_PALLET_VIRIDIAN for west side and SPRITESET_FUCHSIA for east side. ; Route 20 is a special case because the two map sections have a more complex ; shape instead of the map simply being split horizontally or vertically. .route20 ld hl, wXCoord + ; Use SPRITESET_PALLET_VIRIDIAN if X < 43 ld a, [hl] - cp $2b - ld a, $01 + cp 43 + ld a, SPRITESET_PALLET_VIRIDIAN ret c + ; Use SPRITESET_FUCHSIA if X >= 62. ld a, [hl] - cp $3e - ld a, $0a + cp 62 + ld a, SPRITESET_FUCHSIA ret nc + ; If 55 <= X < 62, split Y at 8; else 43 <= X < 55, so split Y at 13 ld a, [hl] - cp $37 - ld b, $08 + cp 55 + ld b, 8 jr nc, .next - ld b, $0d + ld b, 13 .next + ; Use SPRITESET_FUCHSIA if Y < split; else use SPRITESET_PALLET_VIRIDIAN ld a, [wYCoord] cp b - ld a, $0a + ld a, SPRITESET_FUCHSIA ret c - ld a, $01 + ld a, SPRITESET_PALLET_VIRIDIAN ret INCLUDE "data/maps/sprite_sets.asm" |
