mirror of
https://github.com/pret/pokegold-spaceworld.git
synced 2026-09-12 02:47:11 -05:00
Document the animated tilesets (#130)
This commit is contained in:
99
data/tileset_anims.asm
Normal file
99
data/tileset_anims.asm
Normal file
@@ -0,0 +1,99 @@
|
||||
INCLUDE "constants.asm"
|
||||
|
||||
SECTION "data/tileset_anims.asm", ROMX
|
||||
|
||||
MACRO tileframe
|
||||
if _NARG == 2
|
||||
dw \2 ; argument
|
||||
else
|
||||
dw 0
|
||||
endc
|
||||
dw \1 ; function
|
||||
ENDM
|
||||
|
||||
|
||||
TilesetFlowerAnim:
|
||||
; UnusedTilesetAnim1 in pokegold/pokecrystal.
|
||||
; Scrolls tile $03 like cave water, but also has the standard $38 flower tile.
|
||||
tileframe ReadTileToAnimBuffer, vTileset tile $03
|
||||
tileframe ScrollTileRightLeft, wTileAnimBuffer
|
||||
tileframe WriteTileFromAnimBuffer, vTileset tile $03
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe AnimateFlowerTile
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe DoneTileAnimation
|
||||
|
||||
TilesetWaterAnim:
|
||||
; UnusedTilesetAnim2 in pokegold/pokecrystal.
|
||||
; Scrolls tile $03 like cave water.
|
||||
tileframe ReadTileToAnimBuffer, vTileset tile $03
|
||||
tileframe ScrollTileRightLeft, wTileAnimBuffer
|
||||
tileframe WriteTileFromAnimBuffer, vTileset tile $03
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe DoneTileAnimation
|
||||
|
||||
TilesetGenericAnim:
|
||||
; UnusedTilesetAnim3 in pokegold/pokecrystal.
|
||||
; Scrolls tile $53 like a waterfall; scrolls tile $03 like cave water.
|
||||
tileframe ReadTileToAnimBuffer, vTileset tile $53
|
||||
tileframe ScrollTileDown, wTileAnimBuffer
|
||||
tileframe ScrollTileDown, wTileAnimBuffer
|
||||
tileframe WriteTileFromAnimBuffer, vTileset tile $53
|
||||
tileframe ReadTileToAnimBuffer, vTileset tile $03
|
||||
tileframe ScrollTileRightLeft, wTileAnimBuffer
|
||||
tileframe WriteTileFromAnimBuffer, vTileset tile $03
|
||||
tileframe ReadTileToAnimBuffer, vTileset tile $53
|
||||
tileframe ScrollTileDown, wTileAnimBuffer
|
||||
tileframe ScrollTileDown, wTileAnimBuffer
|
||||
tileframe WriteTileFromAnimBuffer, vTileset tile $53
|
||||
tileframe DoneTileAnimation
|
||||
|
||||
TilesetFontAnim:
|
||||
; UnusedTilesetAnim4 in pokegold/pokecrystal.
|
||||
; Scrolls tile $54 like a waterfall; scrolls tile $03 like cave water.
|
||||
tileframe ReadTileToAnimBuffer, vTileset tile $54
|
||||
tileframe ScrollTileDown, wTileAnimBuffer
|
||||
tileframe ScrollTileDown, wTileAnimBuffer
|
||||
tileframe WriteTileFromAnimBuffer, vTileset tile $54
|
||||
tileframe WaitTileAnimation
|
||||
tileframe ReadTileToAnimBuffer, vTileset tile $03
|
||||
tileframe ScrollTileRightLeft, wTileAnimBuffer
|
||||
tileframe WriteTileFromAnimBuffer, vTileset tile $03
|
||||
tileframe WaitTileAnimation
|
||||
tileframe ReadTileToAnimBuffer, vTileset tile $54
|
||||
tileframe ScrollTileDown, wTileAnimBuffer
|
||||
tileframe ScrollTileDown, wTileAnimBuffer
|
||||
tileframe WriteTileFromAnimBuffer, vTileset tile $54
|
||||
tileframe DoneTileAnimation
|
||||
|
||||
TilesetRocketHouseAnim:
|
||||
; UnusedTilesetAnim5 in pokegold/pokecrystal.
|
||||
; Scrolls tile $4f like cave water.
|
||||
tileframe ReadTileToAnimBuffer, vTileset tile $4f
|
||||
tileframe ScrollTileRightLeft, wTileAnimBuffer
|
||||
tileframe WriteTileFromAnimBuffer, vTileset tile $4f
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe DoneTileAnimation
|
||||
|
||||
TilesetNoAnim:
|
||||
; TilesetUndergroundAnim in pokegold/pokecrystal.
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe WaitTileAnimation
|
||||
tileframe DoneTileAnimation
|
||||
@@ -5,37 +5,37 @@ SECTION "data/tileset_headers.asm", ROMX
|
||||
MACRO tileset
|
||||
db BANK(\1_GFX) ; shared bank
|
||||
dw \1_Meta, \1_GFX, \1_Coll
|
||||
db \2, \3, \4 ; counter tiles
|
||||
db \5 ; unknown
|
||||
dw \2, ; animation set
|
||||
dw NULL ; unused
|
||||
ENDM
|
||||
|
||||
Tilesets:
|
||||
; name, 3 counter tiles, unknown
|
||||
tileset Tileset_00, $77, $40, $00, $00
|
||||
tileset Tileset_01, $4b, $40, $00, $00
|
||||
tileset Tileset_02, $1f, $40, $00, $00
|
||||
tileset Tileset_03, $1f, $40, $00, $00
|
||||
tileset Tileset_04, $4b, $40, $00, $00
|
||||
tileset Tileset_05, $a7, $40, $00, $00
|
||||
tileset Tileset_06, $4b, $40, $00, $00
|
||||
tileset Tileset_07, $1f, $40, $00, $00
|
||||
tileset Tileset_08, $4b, $40, $00, $00
|
||||
tileset Tileset_09, $07, $41, $00, $00
|
||||
tileset Tileset_0a, $07, $41, $00, $00
|
||||
tileset Tileset_0b, $07, $41, $00, $00
|
||||
tileset Tileset_0c, $07, $41, $00, $00
|
||||
tileset Tileset_0d, $07, $41, $00, $00
|
||||
tileset Tileset_0e, $07, $41, $00, $00
|
||||
tileset Tileset_0f, $07, $41, $00, $00
|
||||
tileset Tileset_10, $07, $41, $00, $00
|
||||
tileset Tileset_11, $07, $41, $00, $00
|
||||
tileset Tileset_12, $07, $41, $00, $00
|
||||
tileset Tileset_13, $df, $40, $00, $00
|
||||
tileset Tileset_14, $07, $41, $00, $00
|
||||
tileset Tileset_15, $07, $41, $00, $00
|
||||
tileset Tileset_16, $07, $41, $00, $00
|
||||
tileset Tileset_17, $07, $41, $00, $00
|
||||
tileset Tileset_18, $07, $41, $00, $00
|
||||
tileset Tileset_19, $07, $41, $00, $00
|
||||
tileset Tileset_1a, $07, $41, $00, $00
|
||||
tileset Tileset_1b, $77, $40, $00, $00
|
||||
; name, animation set
|
||||
tileset Tileset_00, TilesetGenericAnim
|
||||
tileset Tileset_01, TilesetWaterAnim
|
||||
tileset Tileset_02, TilesetFlowerAnim
|
||||
tileset Tileset_03, TilesetFlowerAnim
|
||||
tileset Tileset_04, TilesetWaterAnim
|
||||
tileset Tileset_05, TilesetFontAnim
|
||||
tileset Tileset_06, TilesetWaterAnim
|
||||
tileset Tileset_07, TilesetFlowerAnim
|
||||
tileset Tileset_08, TilesetWaterAnim
|
||||
tileset Tileset_09, TilesetNoAnim
|
||||
tileset Tileset_0a, TilesetNoAnim
|
||||
tileset Tileset_0b, TilesetNoAnim
|
||||
tileset Tileset_0c, TilesetNoAnim
|
||||
tileset Tileset_0d, TilesetNoAnim
|
||||
tileset Tileset_0e, TilesetNoAnim
|
||||
tileset Tileset_0f, TilesetNoAnim
|
||||
tileset Tileset_10, TilesetNoAnim
|
||||
tileset Tileset_11, TilesetNoAnim
|
||||
tileset Tileset_12, TilesetNoAnim
|
||||
tileset Tileset_13, TilesetRocketHouseAnim
|
||||
tileset Tileset_14, TilesetNoAnim
|
||||
tileset Tileset_15, TilesetNoAnim
|
||||
tileset Tileset_16, TilesetNoAnim
|
||||
tileset Tileset_17, TilesetNoAnim
|
||||
tileset Tileset_18, TilesetNoAnim
|
||||
tileset Tileset_19, TilesetNoAnim
|
||||
tileset Tileset_1a, TilesetNoAnim
|
||||
tileset Tileset_1b, TilesetGenericAnim
|
||||
|
||||
@@ -28,6 +28,185 @@ AnimateTilesetImpl:
|
||||
ld l, a
|
||||
jp hl
|
||||
|
||||
SECTION "engine/dumps/bank23.asm@WaitTileAnimation", ROMX
|
||||
|
||||
WaitTileAnimation:
|
||||
; Do nothing this frame.
|
||||
ret
|
||||
|
||||
DoneTileAnimation:
|
||||
; Reset the animation command loop.
|
||||
xor a
|
||||
ldh [hTileAnimFrame], a
|
||||
jp TransferToolgearRow
|
||||
|
||||
ScrollTileRightLeft:
|
||||
ld a, [wTileAnimationTimer]
|
||||
inc a
|
||||
and %111
|
||||
ld [wTileAnimationTimer], a
|
||||
and %100
|
||||
jr nz, ScrollTileLeft
|
||||
jr ScrollTileRight
|
||||
|
||||
ScrollTileLeft:
|
||||
ld h, d
|
||||
ld l, e
|
||||
ld c, 16 / 4
|
||||
.loop
|
||||
rept 4
|
||||
ld a, [hl]
|
||||
rlca
|
||||
ld [hli], a
|
||||
endr
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
ScrollTileRight:
|
||||
ld h, d
|
||||
ld l, e
|
||||
ld c, 16 / 4
|
||||
.loop
|
||||
rept 4
|
||||
ld a, [hl]
|
||||
rrca
|
||||
ld [hli], a
|
||||
endr
|
||||
dec c
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
ScrollTileUp:
|
||||
ld h, d
|
||||
ld l, e
|
||||
ld d, [hl]
|
||||
inc hl
|
||||
ld e, [hl]
|
||||
ld bc, 16 - 2
|
||||
add hl, bc
|
||||
ld a, 16 / 4
|
||||
.loop
|
||||
ld c, [hl]
|
||||
ld [hl], e
|
||||
dec hl
|
||||
ld b, [hl]
|
||||
ld [hl], d
|
||||
dec hl
|
||||
ld e, [hl]
|
||||
ld [hl], c
|
||||
dec hl
|
||||
ld d, [hl]
|
||||
ld [hl], b
|
||||
dec hl
|
||||
dec a
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
ScrollTileDown:
|
||||
ld h, d
|
||||
ld l, e
|
||||
ld de, 16 - 2
|
||||
push hl
|
||||
add hl, de
|
||||
ld d, [hl]
|
||||
inc hl
|
||||
ld e, [hl]
|
||||
pop hl
|
||||
ld a, 16 / 4
|
||||
.loop
|
||||
ld b, [hl]
|
||||
ld [hl], d
|
||||
inc hl
|
||||
ld c, [hl]
|
||||
ld [hl], e
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
ld [hl], b
|
||||
inc hl
|
||||
ld e, [hl]
|
||||
ld [hl], c
|
||||
inc hl
|
||||
dec a
|
||||
jr nz, .loop
|
||||
ret
|
||||
|
||||
AnimateFlowerTile:
|
||||
; Save the stack pointer in bc for WriteTile to restore
|
||||
ld hl, sp+0
|
||||
ld b, h
|
||||
ld c, l
|
||||
|
||||
; A cycle of 2 frames, updating every other tick
|
||||
ld a, [wTileAnimationTimer]
|
||||
and %10
|
||||
ld hl, FlowerTileFrame1
|
||||
jr nz, .end
|
||||
ld hl, FlowerTileFrame2
|
||||
|
||||
.end
|
||||
; Write the tile graphic from hl (now sp) to tile $38 (now hl)
|
||||
ld sp, hl
|
||||
ld hl, vTileset tile $38
|
||||
jr WriteTile
|
||||
|
||||
FlowerTileFrame1:
|
||||
INCBIN "gfx/tilesets/flower/flower1.2bpp"
|
||||
FlowerTileFrame2:
|
||||
INCBIN "gfx/tilesets/flower/flower2.2bpp"
|
||||
|
||||
WriteTileFromAnimBuffer:
|
||||
; Save the stack pointer in bc for WriteTile to restore
|
||||
ld hl, sp+0
|
||||
ld b, h
|
||||
ld c, l
|
||||
|
||||
; Write the tile graphic from wTileAnimBuffer (now sp) to de (now hl)
|
||||
ld hl, wTileAnimBuffer
|
||||
ld sp, hl
|
||||
ld h, d
|
||||
ld l, e
|
||||
jr WriteTile
|
||||
|
||||
ReadTileToAnimBuffer:
|
||||
; Save the stack pointer in bc for WriteTile to restore
|
||||
ld hl, sp+0
|
||||
ld b, h
|
||||
ld c, l
|
||||
|
||||
; Write the tile graphic from de (now sp) to wTileAnimBuffer (now hl)
|
||||
ld h, d
|
||||
ld l, e
|
||||
ld sp, hl
|
||||
ld hl, wTileAnimBuffer
|
||||
; fallthrough
|
||||
|
||||
WriteTile:
|
||||
; Write one tile from sp to hl.
|
||||
; The stack pointer has been saved in bc.
|
||||
|
||||
; This function cannot be called, only jumped to,
|
||||
; because it relocates the stack pointer to quickly
|
||||
; copy data with a "pop slide".
|
||||
|
||||
pop de
|
||||
ld [hl], e
|
||||
inc hl
|
||||
ld [hl], d
|
||||
rept (16 - 2) / 2
|
||||
pop de
|
||||
inc hl
|
||||
ld [hl], e
|
||||
inc hl
|
||||
ld [hl], d
|
||||
endr
|
||||
|
||||
; Restore the stack pointer from bc
|
||||
ld h, b
|
||||
ld l, c
|
||||
ld sp, hl
|
||||
ret
|
||||
|
||||
SECTION "engine/dumps/bank23.asm@RestoreOverworldMapTiles", ROMX
|
||||
|
||||
RestoreOverworldMapTiles::
|
||||
|
||||
BIN
gfx/tilesets/flower/flower1.png
Normal file
BIN
gfx/tilesets/flower/flower1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 113 B |
BIN
gfx/tilesets/flower/flower2.png
Normal file
BIN
gfx/tilesets/flower/flower2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 113 B |
@@ -381,6 +381,10 @@ ROMX $21
|
||||
ROMX $23
|
||||
org $4000
|
||||
"engine/dumps/bank23.asm@AnimateTilesetImpl"
|
||||
org $401f
|
||||
"data/tileset_anims.asm"
|
||||
org $411b
|
||||
"engine/dumps/bank23.asm@WaitTileAnimation"
|
||||
org $42dc
|
||||
"engine/palettes.asm"
|
||||
org $446d
|
||||
|
||||
@@ -716,6 +716,9 @@ wRedrawFlashlightWidthHeight:: db
|
||||
; in units of two tiles (people event meta tile)
|
||||
ENDU
|
||||
|
||||
SECTION "CB3C", WRAM0[$CB3C]
|
||||
wTileAnimBuffer:: ds 1 tiles
|
||||
|
||||
SECTION "CB56", WRAM0[$CB4C]
|
||||
UNION
|
||||
wOtherPlayerLinkMode:: db
|
||||
@@ -984,6 +987,8 @@ wPlaceBallsY:: db
|
||||
; TODO: Investigate how it actually functions.
|
||||
wLowHealthAlarmBuffer:: db
|
||||
|
||||
wTileAnimationTimer:: db
|
||||
|
||||
SECTION "CCC7", WRAM0[$CCC7]
|
||||
|
||||
wDisableVBlankOAMUpdate:: db
|
||||
|
||||
Reference in New Issue
Block a user