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
; wTileset struct size
DEF TILESET_LENGTH EQU 13
DEF TILESET_LENGTH EQU 14
; roof length (see gfx/tilesets/roofs)
DEF ROOF_LENGTH EQU 9
@ -55,3 +55,13 @@ DEF ROOF_LENGTH EQU 9
const PAL_BG_BROWN ; 5
const PAL_BG_ROOF ; 6
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
dw \1Anim
dw \1PalMap
db TILESET_VARIABLE_SPACES_\2
ENDM
; Associated data:
; - The *GFX, *Meta, and *Coll are defined in gfx/tilesets.asm
; - The *PalMap are defined in gfx/tileset_palette_maps.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::
; entries correspond to TILESET_* constants (see constants/tileset_constants.asm)
table_width TILESET_LENGTH, Tilesets
tileset Tileset0
tileset TilesetJohto
tileset TilesetJohtoModern
tileset TilesetKanto
tileset TilesetBattleTowerOutside
tileset TilesetHouse
tileset TilesetPlayersHouse
tileset TilesetPokecenter
tileset TilesetGate
tileset TilesetPort
tileset TilesetLab
tileset TilesetFacility
tileset TilesetMart
tileset TilesetMansion
tileset TilesetGameCorner
tileset TilesetEliteFourRoom
tileset TilesetTraditionalHouse
tileset TilesetTrainStation
tileset TilesetChampionsRoom
tileset TilesetLighthouse
tileset TilesetPlayersRoom
tileset TilesetPokeComCenter
tileset TilesetBattleTowerInside
tileset TilesetTower
tileset TilesetCave
tileset TilesetPark
tileset TilesetRuinsOfAlph
tileset TilesetRadioTower
tileset TilesetUnderground
tileset TilesetIcePath
tileset TilesetDarkCave
tileset TilesetForest
tileset TilesetBetaWordRoom
tileset TilesetHoOhWordRoom
tileset TilesetKabutoWordRoom
tileset TilesetOmanyteWordRoom
tileset TilesetAerodactylWordRoom
tileset Tileset0, 1
tileset TilesetJohto, 1
tileset TilesetJohtoModern, 1
tileset TilesetKanto, 1
tileset TilesetBattleTowerOutside, 1
tileset TilesetHouse, 1
tileset TilesetPlayersHouse, 1
tileset TilesetPokecenter, 1
tileset TilesetGate, 1
tileset TilesetPort, 1
tileset TilesetLab, 1
tileset TilesetFacility, 1
tileset TilesetMart, 1
tileset TilesetMansion, 1
tileset TilesetGameCorner, 1
tileset TilesetEliteFourRoom, 1
tileset TilesetTraditionalHouse, 1
tileset TilesetTrainStation, 1
tileset TilesetChampionsRoom, 1
tileset TilesetLighthouse, 1
tileset TilesetPlayersRoom, 1
tileset TilesetPokeComCenter, 1
tileset TilesetBattleTowerInside, 1
tileset TilesetTower, 1
tileset TilesetCave, 1
tileset TilesetPark, 1
tileset TilesetRuinsOfAlph, 1
tileset TilesetRadioTower, 1
tileset TilesetUnderground, 1
tileset TilesetIcePath, 1
tileset TilesetDarkCave, 1
tileset TilesetForest, 1
tileset TilesetBetaWordRoom, 1
tileset TilesetHoOhWordRoom, 1
tileset TilesetKabutoWordRoom, 1
tileset TilesetOmanyteWordRoom, 1
tileset TilesetAerodactylWordRoom, 1
assert_table_length NUM_TILESETS + 1

View File

@ -4,6 +4,21 @@ MACRO tilecoll
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
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 e, a
ld a, [wTilesetVariableSpaces]
ldh [hTilesetVariableSpaces], a
ldh a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
@ -1339,9 +1342,45 @@ LoadTilesetGFX::
ld hl, wDecompressScratch + $80 tiles
ld de, vTiles5
ld bc, $80 tiles
ld bc, $80 tiles - (TILESET_FIXED_SPACES_SIZE + TILESET_VARIABLE_SPACES_SIZE)
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
ldh [rVBK], a
@ -2250,7 +2289,7 @@ LoadMapTileset::
ld a, [wMapTileset]
call AddNTimes
ld de, wTilesetBank
ld de, wTileset
ld bc, TILESET_LENGTH
ld a, BANK(Tilesets)

View File

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

View File

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

View File

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