mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
Identify wSpriteStateData1 and wSpriteStateData2 offsets, like pokeyellow
This commit is contained in:
parent
7ab43f4d17
commit
2b2ed54bbf
62 changed files with 182 additions and 179 deletions
|
|
@ -12,8 +12,8 @@ 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)
|
||||
ld hl, wSpriteStateData1
|
||||
ld de, wSpriteStateData2 + $0d
|
||||
ld hl, wSpritePlayerStateData1PictureID
|
||||
ld de, wSpritePlayerStateData2PictureID
|
||||
; Loop to copy picture ID's from $C1X0 to $C2XD for LoadMapSpriteTilePatterns.
|
||||
.copyPictureIDLoop
|
||||
ld a, [hl] ; $C1X0 (picture ID)
|
||||
|
|
@ -37,7 +37,7 @@ LoadMapSpriteTilePatterns:
|
|||
.spritesExist
|
||||
ld c, a ; c = [wNumSprites]
|
||||
ld b, $10 ; number of sprite slots
|
||||
ld hl, wSpriteStateData2 + $0d
|
||||
ld hl, wSpritePlayerStateData2PictureID
|
||||
xor a
|
||||
ld [hFourTileSpriteCount], a
|
||||
.copyPictureIDLoop ; loop to copy picture ID from $C2XD to $C2XE
|
||||
|
|
@ -48,9 +48,9 @@ LoadMapSpriteTilePatterns:
|
|||
ld l, a
|
||||
dec b
|
||||
jr nz, .copyPictureIDLoop
|
||||
ld hl, wSpriteStateData2 + $1e
|
||||
ld hl, wSprite01StateData2ImageBaseOffset
|
||||
.loadTilePatternLoop
|
||||
ld de, wSpriteStateData2 + $1d
|
||||
ld de, wSprite01StateData2PictureID
|
||||
; Check if the current picture ID has already had its tile patterns loaded.
|
||||
; This done by looping through the previous sprite slots and seeing if any of
|
||||
; their picture ID's match that of the current sprite slot.
|
||||
|
|
@ -70,7 +70,7 @@ LoadMapSpriteTilePatterns:
|
|||
ld e, a
|
||||
jr .checkIfAlreadyLoadedLoop
|
||||
.notAlreadyLoaded
|
||||
ld de, wSpriteStateData2 + $0e
|
||||
ld de, wSpritePlayerStateData2ImageBaseOffset
|
||||
ld b, $01
|
||||
; loop to find the highest tile pattern VRAM slot (among the first 10 slots) used by a previous sprite slot
|
||||
; this is done in order to find the first free VRAM slot available
|
||||
|
|
@ -215,7 +215,7 @@ LoadMapSpriteTilePatterns:
|
|||
ld l, a
|
||||
dec c
|
||||
jp nz, .loadTilePatternLoop
|
||||
ld hl, wSpriteStateData2 + $0d
|
||||
ld hl, wSpritePlayerStateData2PictureID
|
||||
ld b, $10
|
||||
; the pictures ID's stored at $C2XD are no longer needed, so zero them
|
||||
.zeroStoredPictureIDLoop
|
||||
|
|
@ -287,7 +287,7 @@ InitOutsideMapSprites:
|
|||
jr nc, .noCarry2
|
||||
inc d
|
||||
.noCarry2
|
||||
ld hl, wSpriteStateData2 + $0d
|
||||
ld hl, wSpritePlayerStateData2PictureID
|
||||
ld a, SPRITE_RED
|
||||
ld [hl], a
|
||||
ld bc, wSpriteSet
|
||||
|
|
@ -323,7 +323,7 @@ InitOutsideMapSprites:
|
|||
call LoadMapSpriteTilePatterns
|
||||
pop af
|
||||
ld [wNumSprites], a ; restore number of sprites
|
||||
ld hl, wSpriteStateData2 + $1e
|
||||
ld hl, wSprite01StateData2ImageBaseOffset
|
||||
ld b, $0f
|
||||
; 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
|
||||
|
|
@ -337,7 +337,7 @@ InitOutsideMapSprites:
|
|||
dec b
|
||||
jr nz, .zeroVRAMSlotsLoop
|
||||
.skipLoadingSpriteSet
|
||||
ld hl, wSpriteStateData1 + $10
|
||||
ld hl, wSprite01StateData1
|
||||
; This loop stores the correct VRAM tile pattern slots according the sprite
|
||||
; data from the map's header. Since the VRAM tile pattern slots are filled in
|
||||
; the order of the sprite set, in order to find the VRAM tile pattern slot
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue