Implement common tileset portion at second half of vTiles5 (#19)

This commit is contained in:
xCrystal 2023-10-03 19:02:36 +02:00
parent 0d016cc8ee
commit adfcd603dd
10 changed files with 110 additions and 41 deletions

View File

@ -39,7 +39,7 @@
DEF NUM_TILESETS EQU const_value - 1 DEF NUM_TILESETS EQU const_value - 1
; wTileset struct size ; wTileset struct size
DEF TILESET_LENGTH EQU 13 DEF TILESET_LENGTH EQU 14
; roof length (see gfx/tilesets/roofs) ; roof length (see gfx/tilesets/roofs)
DEF ROOF_LENGTH EQU 9 DEF ROOF_LENGTH EQU 9
@ -55,3 +55,13 @@ DEF ROOF_LENGTH EQU 9
const PAL_BG_BROWN ; 5 const PAL_BG_BROWN ; 5
const PAL_BG_ROOF ; 6 const PAL_BG_ROOF ; 6
const PAL_BG_TEXT ; 7 const PAL_BG_TEXT ; 7
; variable spaces sets (see gfx/tilesets.asm)
const_def
const TILESET_VARIABLE_SPACES_1 ; 0
; const TILESET_VARIABLE_SPACES_2 ; 1
DEF NUM_VARIABLE_SPACES_SETS EQU const_value
; size of the tileset occupied by space tiles (see LoadTilesetGFX)
DEF TILESET_FIXED_SPACES_SIZE EQU $20 tiles
DEF TILESET_VARIABLE_SPACES_SIZE EQU $20 tiles

View File

@ -2,51 +2,53 @@ MACRO tileset
dba \1GFX, \1Meta, \1Coll dba \1GFX, \1Meta, \1Coll
dw \1Anim dw \1Anim
dw \1PalMap dw \1PalMap
db TILESET_VARIABLE_SPACES_\2
ENDM ENDM
; Associated data: ; Associated data:
; - The *GFX, *Meta, and *Coll are defined in gfx/tilesets.asm ; - The *GFX, *Meta, and *Coll are defined in gfx/tilesets.asm
; - The *PalMap are defined in gfx/tileset_palette_maps.asm ; - The *PalMap are defined in gfx/tileset_palette_maps.asm
; - The *Anim are defined in engine/tilesets/tileset_anims.asm ; - The *Anim are defined in engine/tilesets/tileset_anims.asm
; - TILESET_VARIABLE_SPACES_* points to an entry of TilesetVariableSpacesPointers in gfx/tilesets.asm
Tilesets:: Tilesets::
; entries correspond to TILESET_* constants (see constants/tileset_constants.asm) ; entries correspond to TILESET_* constants (see constants/tileset_constants.asm)
table_width TILESET_LENGTH, Tilesets table_width TILESET_LENGTH, Tilesets
tileset Tileset0 tileset Tileset0, 1
tileset TilesetJohto tileset TilesetJohto, 1
tileset TilesetJohtoModern tileset TilesetJohtoModern, 1
tileset TilesetKanto tileset TilesetKanto, 1
tileset TilesetBattleTowerOutside tileset TilesetBattleTowerOutside, 1
tileset TilesetHouse tileset TilesetHouse, 1
tileset TilesetPlayersHouse tileset TilesetPlayersHouse, 1
tileset TilesetPokecenter tileset TilesetPokecenter, 1
tileset TilesetGate tileset TilesetGate, 1
tileset TilesetPort tileset TilesetPort, 1
tileset TilesetLab tileset TilesetLab, 1
tileset TilesetFacility tileset TilesetFacility, 1
tileset TilesetMart tileset TilesetMart, 1
tileset TilesetMansion tileset TilesetMansion, 1
tileset TilesetGameCorner tileset TilesetGameCorner, 1
tileset TilesetEliteFourRoom tileset TilesetEliteFourRoom, 1
tileset TilesetTraditionalHouse tileset TilesetTraditionalHouse, 1
tileset TilesetTrainStation tileset TilesetTrainStation, 1
tileset TilesetChampionsRoom tileset TilesetChampionsRoom, 1
tileset TilesetLighthouse tileset TilesetLighthouse, 1
tileset TilesetPlayersRoom tileset TilesetPlayersRoom, 1
tileset TilesetPokeComCenter tileset TilesetPokeComCenter, 1
tileset TilesetBattleTowerInside tileset TilesetBattleTowerInside, 1
tileset TilesetTower tileset TilesetTower, 1
tileset TilesetCave tileset TilesetCave, 1
tileset TilesetPark tileset TilesetPark, 1
tileset TilesetRuinsOfAlph tileset TilesetRuinsOfAlph, 1
tileset TilesetRadioTower tileset TilesetRadioTower, 1
tileset TilesetUnderground tileset TilesetUnderground, 1
tileset TilesetIcePath tileset TilesetIcePath, 1
tileset TilesetDarkCave tileset TilesetDarkCave, 1
tileset TilesetForest tileset TilesetForest, 1
tileset TilesetBetaWordRoom tileset TilesetBetaWordRoom, 1
tileset TilesetHoOhWordRoom tileset TilesetHoOhWordRoom, 1
tileset TilesetKabutoWordRoom tileset TilesetKabutoWordRoom, 1
tileset TilesetOmanyteWordRoom tileset TilesetOmanyteWordRoom, 1
tileset TilesetAerodactylWordRoom tileset TilesetAerodactylWordRoom, 1
assert_table_length NUM_TILESETS + 1 assert_table_length NUM_TILESETS + 1

View File

@ -4,6 +4,21 @@ MACRO tilecoll
ENDM ENDM
SECTION "Tileset Spaces", ROMX
TilesetVariableSpacesPointers::
; entries correspond to TILESET_VARIABLE_SPACES_* constants (see constants/tileset_constants.asm)
table_width 2, TilesetVariableSpacesPointers
dw TilesetVariableSpaces1
assert_table_length NUM_VARIABLE_SPACES_SETS
TilesetFixedSpaces::
INCBIN "gfx/tilesets/spaces/fixed_spaces.2bpp.lz"
TilesetVariableSpaces1::
INCBIN "gfx/tilesets/spaces/variable_spaces_1.2bpp.lz"
SECTION "Tileset Data 1", ROMX SECTION "Tileset Data 1", ROMX
TilesetKantoGFX:: TilesetKantoGFX::

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

View File

@ -1318,6 +1318,9 @@ LoadTilesetGFX::
ld a, [wTilesetBank] ld a, [wTilesetBank]
ld e, a ld e, a
ld a, [wTilesetVariableSpaces]
ldh [hTilesetVariableSpaces], a
ldh a, [rSVBK] ldh a, [rSVBK]
push af push af
ld a, BANK(wDecompressScratch) ld a, BANK(wDecompressScratch)
@ -1339,9 +1342,45 @@ LoadTilesetGFX::
ld hl, wDecompressScratch + $80 tiles ld hl, wDecompressScratch + $80 tiles
ld de, vTiles5 ld de, vTiles5
ld bc, $80 tiles ld bc, $80 tiles - (TILESET_FIXED_SPACES_SIZE + TILESET_VARIABLE_SPACES_SIZE)
call CopyBytes call CopyBytes
ldh a, [hROMBank]
push af
ld a, BANK(TilesetFixedSpaces) ; BANK(TilesetVariableSpaces*)
ldh [hROMBank], a
ld [MBC5RomBankLo], a
ld hl, TilesetFixedSpaces
ld de, wDecompressScratch
call Decompress
ld hl, wDecompressScratch
ld de, vTiles5 + $80 tiles - (TILESET_FIXED_SPACES_SIZE + TILESET_VARIABLE_SPACES_SIZE)
ld bc, TILESET_FIXED_SPACES_SIZE
call CopyBytes
ld hl, TilesetVariableSpacesPointers
ldh a, [hTilesetVariableSpaces]
ld c, a
ld b, $0
add hl, bc
add hl, bc
ld a, [hli]
ld h, [hl]
ld l, a
ld de, wDecompressScratch
call Decompress
ld hl, wDecompressScratch
ld de, vTiles5 + $80 tiles - TILESET_VARIABLE_SPACES_SIZE
ld bc, TILESET_VARIABLE_SPACES_SIZE
call CopyBytes
pop af
ldh [hROMBank], a
ld [MBC5RomBankLo], a
pop af pop af
ldh [rVBK], a ldh [rVBK], a
@ -2250,7 +2289,7 @@ LoadMapTileset::
ld a, [wMapTileset] ld a, [wMapTileset]
call AddNTimes call AddNTimes
ld de, wTilesetBank ld de, wTileset
ld bc, TILESET_LENGTH ld bc, TILESET_LENGTH
ld a, BANK(Tilesets) ld a, BANK(Tilesets)

View File

@ -40,6 +40,7 @@ ROMX $04
ROMX $05 ROMX $05
"bank5" "bank5"
ROMX $06 ROMX $06
"Tileset Spaces"
"Tileset Data 1" "Tileset Data 1"
ROMX $07 ROMX $07
"Roofs" "Roofs"

View File

@ -27,7 +27,8 @@ hJoyLast:: db
hInMenu:: db hInMenu:: db
hPrinter:: db hPrinter:: db
hGraphicStartTile:: db hGraphicStartTile::
hTilesetVariableSpaces:: db
hMoveMon:: db hMoveMon:: db
UNION UNION

View File

@ -1870,6 +1870,7 @@ wTilesetCollisionBank:: db
wTilesetCollisionAddress:: dw wTilesetCollisionAddress:: dw
wTilesetAnim:: dw ; bank 3f wTilesetAnim:: dw ; bank 3f
wTilesetPalettes:: dw ; bank 3f wTilesetPalettes:: dw ; bank 3f
wTilesetVariableSpaces:: db
wTilesetEnd:: wTilesetEnd::
assert wTilesetEnd - wTileset == TILESET_LENGTH assert wTilesetEnd - wTileset == TILESET_LENGTH