mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
Use a SPRITE_SET_LENGTH constant
This commit is contained in:
parent
d2be79adf1
commit
c299cf1067
|
@ -36,3 +36,6 @@ DEF NUM_SPLIT_SETS EQU const_value - FIRST_SPLIT_SET
|
||||||
; split directions
|
; split directions
|
||||||
DEF EAST_WEST EQU 1
|
DEF EAST_WEST EQU 1
|
||||||
DEF NORTH_SOUTH EQU 2
|
DEF NORTH_SOUTH EQU 2
|
||||||
|
|
||||||
|
; each sprite set has 9 walking sprites and 2 still sprites
|
||||||
|
DEF SPRITE_SET_LENGTH EQU 9 + 2
|
||||||
|
|
|
@ -63,8 +63,7 @@ SplitMapSpriteSets:
|
||||||
assert_table_length NUM_SPLIT_SETS
|
assert_table_length NUM_SPLIT_SETS
|
||||||
|
|
||||||
SpriteSets:
|
SpriteSets:
|
||||||
; each sprite set has 9 walking sprites and 2 still sprites
|
table_width SPRITE_SET_LENGTH, SpriteSets
|
||||||
table_width 9 + 2, SpriteSets
|
|
||||||
|
|
||||||
; SPRITESET_PALLET_VIRIDIAN
|
; SPRITESET_PALLET_VIRIDIAN
|
||||||
db SPRITE_BLUE
|
db SPRITE_BLUE
|
||||||
|
|
|
@ -283,7 +283,7 @@ InitOutsideMapSprites:
|
||||||
sla a
|
sla a
|
||||||
sla a
|
sla a
|
||||||
add c
|
add c
|
||||||
add b ; a = (spriteSetID - 1) * 11
|
add b ; a = (spriteSetID - 1) * SPRITE_SET_LENGTH
|
||||||
ld de, SpriteSets
|
ld de, SpriteSets
|
||||||
; add a to de to get offset of sprite set
|
; add a to de to get offset of sprite set
|
||||||
add e
|
add e
|
||||||
|
@ -309,7 +309,7 @@ InitOutsideMapSprites:
|
||||||
inc de
|
inc de
|
||||||
inc bc
|
inc bc
|
||||||
ld a, l
|
ld a, l
|
||||||
cp $bd ; reached 11th sprite slot?
|
cp 11 * SPRITESTATEDATA2_LENGTH + SPRITESTATEDATA2_PICTUREID ; reached 11th sprite slot?
|
||||||
jr nz, .loadSpriteSetLoop
|
jr nz, .loadSpriteSetLoop
|
||||||
ld b, 4 ; 4 remaining sprite slots
|
ld b, 4 ; 4 remaining sprite slots
|
||||||
.zeroRemainingSlotsLoop ; loop to zero the picture ID's of the remaining sprite slots
|
.zeroRemainingSlotsLoop ; loop to zero the picture ID's of the remaining sprite slots
|
||||||
|
@ -322,13 +322,13 @@ InitOutsideMapSprites:
|
||||||
jr nz, .zeroRemainingSlotsLoop
|
jr nz, .zeroRemainingSlotsLoop
|
||||||
ld a, [wNumSprites]
|
ld a, [wNumSprites]
|
||||||
push af ; save number of sprites
|
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
|
ld [wNumSprites], a
|
||||||
call LoadMapSpriteTilePatterns
|
call LoadMapSpriteTilePatterns
|
||||||
pop af
|
pop af
|
||||||
ld [wNumSprites], a ; restore number of sprites
|
ld [wNumSprites], a ; restore number of sprites
|
||||||
ld hl, wSprite01StateData2ImageBaseOffset
|
ld hl, wSprite01StateData2ImageBaseOffset
|
||||||
ld b, $0f
|
ld b, NUM_SPRITESTATEDATA_STRUCTS - 1
|
||||||
; The VRAM tile pattern slots that LoadMapSpriteTilePatterns set are in the
|
; 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
|
; 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.
|
; for the current map. So, they are not needed and are zeroed by this loop.
|
||||||
|
|
Loading…
Reference in a new issue