aboutsummaryrefslogtreecommitdiffstats
path: root/engine/overworld
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2022-09-24 11:39:39 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2022-09-24 11:39:39 -0400
commitc299cf10675164502a7c487a29014b2927a403c0 (patch)
tree9b86cf7c96cb46e35a38a7f7b018efb032fabbcb /engine/overworld
parentAdd constants and table macros for the map sprite sets (#392) (diff)
downloadpokeyellow-c299cf10675164502a7c487a29014b2927a403c0.tar.gz
pokeyellow-c299cf10675164502a7c487a29014b2927a403c0.tar.xz
pokeyellow-c299cf10675164502a7c487a29014b2927a403c0.zip
Use a SPRITE_SET_LENGTH constant
Diffstat (limited to 'engine/overworld')
-rw-r--r--engine/overworld/map_sprites.asm8
1 files changed, 4 insertions, 4 deletions
diff --git a/engine/overworld/map_sprites.asm b/engine/overworld/map_sprites.asm
index 5a4c27c3..8acbb04f 100644
--- a/engine/overworld/map_sprites.asm
+++ b/engine/overworld/map_sprites.asm
@@ -283,7 +283,7 @@ InitOutsideMapSprites:
sla a
sla a
add c
- add b ; a = (spriteSetID - 1) * 11
+ add b ; a = (spriteSetID - 1) * SPRITE_SET_LENGTH
ld de, SpriteSets
; add a to de to get offset of sprite set
add e
@@ -309,7 +309,7 @@ InitOutsideMapSprites:
inc de
inc bc
ld a, l
- cp $bd ; reached 11th sprite slot?
+ cp 11 * SPRITESTATEDATA2_LENGTH + SPRITESTATEDATA2_PICTUREID ; reached 11th sprite slot?
jr nz, .loadSpriteSetLoop
ld b, 4 ; 4 remaining sprite slots
.zeroRemainingSlotsLoop ; loop to zero the picture ID's of the remaining sprite slots
@@ -322,13 +322,13 @@ InitOutsideMapSprites:
jr nz, .zeroRemainingSlotsLoop
ld a, [wNumSprites]
push af ; save number of sprites
- ld a, 11 ; 11 sprites in sprite set
+ ld a, SPRITE_SET_LENGTH ; 11 sprites in sprite set
ld [wNumSprites], a
call LoadMapSpriteTilePatterns
pop af
ld [wNumSprites], a ; restore number of sprites
ld hl, wSprite01StateData2ImageBaseOffset
- ld b, $0f
+ ld b, NUM_SPRITESTATEDATA_STRUCTS - 1
; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the
; order of the map's sprite set, not the order of the actual sprites loaded
; for the current map. So, they are not needed and are zeroed by this loop.