From cb6bb66dc91a7a162f442f3bd81ea2887558ada4 Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 30 Jan 2024 17:24:08 -0600 Subject: [PATCH 1/5] Clean up tileset palette assignments - This saves space by not having to include the same file 2 or 3 tiles for duplicate tilesetes. - This also saves space by not requiring each .asm file to be padded out to the same size for smaller tilesets. - This stops Polished Map from breaking colors, since it automatically trims any "unnecessary" tilepal entries from the end of the file when saving your changes. - Uses a constant to make things easier if a person decides to expand tilesets. --- color/data/map_palette_assignments.asm | 116 +++++++++++++++++++------ color/data/map_palette_sets.asm | 4 + color/loadpalettes.asm | 40 ++++----- color/tilesets/cavern.asm | 5 +- color/tilesets/cemetery.asm | 2 +- color/tilesets/club.asm | 4 +- color/tilesets/house.asm | 2 +- color/tilesets/lab.asm | 2 +- color/tilesets/lobby.asm | 2 +- color/tilesets/mansion.asm | 2 +- color/tilesets/overworld.asm | 2 +- color/tilesets/plateau.asm | 5 +- color/tilesets/reds_house.asm | 3 - color/tilesets/ship.asm | 2 +- color/tilesets/ship_port.asm | 2 +- color/tilesets/underground.asm | 10 +-- 16 files changed, 125 insertions(+), 78 deletions(-) diff --git a/color/data/map_palette_assignments.asm b/color/data/map_palette_assignments.asm index b66cdda99..8ade284d1 100755 --- a/color/data/map_palette_assignments.asm +++ b/color/data/map_palette_assignments.asm @@ -1,31 +1,95 @@ -; $60 bytes for each tileset. Each byte is the palette number for a tile. -; Remaining $a0 tiles aren't part of the tileset and are set to 7 (text palette). +; One byte for each tile in the tileset +; Remaining tiles are set to 7 (text palette). ; Refer to MapPaletteSets for clarification on specific colors ; These use the pokecrystal macro for tileset palettes ; Also, this repo can use Polished Map's "Priority Colors" already ; In the event of Duplicate tilesets, the asm files are named to match the png files MapPaletteAssignments: - INCLUDE "color/tilesets/overworld.asm" ; OVERWORLD - INCLUDE "color/tilesets/reds_house.asm" ; REDS_HOUSE_1 (Duplicate of REDS_HOUSE_2) - INCLUDE "color/tilesets/pokecenter.asm" ; MART (Duplicate of POKECENTER) - INCLUDE "color/tilesets/forest.asm" ; FOREST - INCLUDE "color/tilesets/reds_house.asm" ; REDS_HOUSE_2 (Duplicate of REDS_HOUSE_1) - INCLUDE "color/tilesets/gym.asm" ; DOJO (Duplicate of GYM) - INCLUDE "color/tilesets/pokecenter.asm" ; POKECENTER (Duplicate of MART) - INCLUDE "color/tilesets/gym.asm" ; GYM (Duplicate of DOJO) - INCLUDE "color/tilesets/house.asm" ; HOUSE - INCLUDE "color/tilesets/gate.asm" ; FOREST_GATE (Duplicate of GATE and MUSEUM) - INCLUDE "color/tilesets/gate.asm" ; MUSEUM (Duplicate of GATE and FOREST_GATE) - INCLUDE "color/tilesets/underground.asm" ; UNDERGROUND - INCLUDE "color/tilesets/gate.asm" ; GATE (Duplicate of FOREST_GATE and MUSEUM) - INCLUDE "color/tilesets/ship.asm" ; SHIP - INCLUDE "color/tilesets/ship_port.asm" ; SHIP_PORT - INCLUDE "color/tilesets/cemetery.asm" ; CEMETERY - INCLUDE "color/tilesets/interior.asm" ; INTERIOR - INCLUDE "color/tilesets/cavern.asm" ; CAVERN - INCLUDE "color/tilesets/lobby.asm" ; LOBBY - INCLUDE "color/tilesets/mansion.asm" ; MANSION - INCLUDE "color/tilesets/lab.asm" ; LAB - INCLUDE "color/tilesets/club.asm" ; CLUB - INCLUDE "color/tilesets/facility.asm" ; FACILITY - INCLUDE "color/tilesets/plateau.asm" ; PLATEAU + table_width 2, MapPaletteAssignments + dw OverworldPalMap ; OVERWORLD + dw RedsHouse1PalMap ; REDS_HOUSE_1 + dw MartPalMap ; MART + dw ForestPalMap ; FOREST + dw RedsHouse2PalMap ; REDS_HOUSE_2 + dw DojoPalMap ; DOJO + dw PokecenterPalMap ; POKECENTER + dw GymPalMap ; GYM + dw HousePalMap ; HOUSE + dw ForestGatePalMap ; FOREST_GATE + dw MuseumPalMap ; MUSEUM + dw UndergroundPalMap ; UNDERGROUND + dw GatePalMap ; GATE + dw ShipPalMap ; SHIP + dw ShipPortPalMap ; SHIP_PORT + dw CemeteryPalMap ; CEMETERY + dw InteriorPalMap ; INTERIOR + dw CavernPalMap ; CAVERN + dw LobbyPalMap ; LOBBY + dw MansionPalMap ; MANSION + dw LabPalMap ; LAB + dw ClubPalMap ; CLUB + dw FacilityPalMap ; FACILITY + dw PlateauPalMap ; PLATEAU + assert_table_length NUM_TILESETS + +OverworldPalMap: + INCLUDE "color/tilesets/overworld.asm" + +RedsHouse1PalMap: +RedsHouse2PalMap: + INCLUDE "color/tilesets/reds_house.asm" + +MartPalMap: +PokecenterPalMap: + INCLUDE "color/tilesets/pokecenter.asm" + +ForestPalMap: + INCLUDE "color/tilesets/forest.asm" + +DojoPalMap: +GymPalMap: + INCLUDE "color/tilesets/gym.asm" + +HousePalMap: + INCLUDE "color/tilesets/house.asm" + +GatePalMap: +ForestGatePalMap: +MuseumPalMap: + INCLUDE "color/tilesets/gate.asm" + +UndergroundPalMap: + INCLUDE "color/tilesets/underground.asm" + +ShipPalMap: + INCLUDE "color/tilesets/ship.asm" + +ShipPortPalMap: + INCLUDE "color/tilesets/ship_port.asm" + +CemeteryPalMap: + INCLUDE "color/tilesets/cemetery.asm" + +InteriorPalMap: + INCLUDE "color/tilesets/interior.asm" + +CavernPalMap: + INCLUDE "color/tilesets/cavern.asm" + +LobbyPalMap: + INCLUDE "color/tilesets/lobby.asm" + +MansionPalMap: + INCLUDE "color/tilesets/mansion.asm" + +LabPalMap: + INCLUDE "color/tilesets/lab.asm" + +ClubPalMap: + INCLUDE "color/tilesets/club.asm" + +FacilityPalMap: + INCLUDE "color/tilesets/facility.asm" + +PlateauPalMap: + INCLUDE "color/tilesets/plateau.asm" diff --git a/color/data/map_palette_sets.asm b/color/data/map_palette_sets.asm index 8d193dc21..aa2f6794a 100755 --- a/color/data/map_palette_sets.asm +++ b/color/data/map_palette_sets.asm @@ -1,5 +1,7 @@ ; 8 bytes per tileset for 8 palettes, which are taken from MapPalettes. MapPaletteSets: + table_width 8, MapPaletteSets + ; OVERWORLD db OUTDOOR_GRAY db OUTDOOR_RED @@ -239,3 +241,5 @@ MapPaletteSets: db OUTDOOR_BROWN db OUTDOOR_ROOF db CRYS_TEXTBOX + + assert_table_length NUM_TILESETS diff --git a/color/loadpalettes.asm b/color/loadpalettes.asm index 6718af51a..f3c3be548 100755 --- a/color/loadpalettes.asm +++ b/color/loadpalettes.asm @@ -3,6 +3,8 @@ INCLUDE "color/data/map_palette_sets.asm" INCLUDE "color/data/map_palette_assignments.asm" INCLUDE "color/data/roofpalettes.asm" +DEF TILESET_SIZE EQU $60 + ; Load colors for new map and tile placement LoadTilesetPalette: push bc @@ -64,23 +66,27 @@ LoadTilesetPalette: jr nz, .nextPalette ; Start copying palette assignments + ; start by filling the buffer with the textbox palette + ld hl, W2_TilesetPaletteMap + ld b, $ff + ld a, 7 +.fillLoop + ld [hli], a + dec b + jr nz, .fillLoop + ; fill in the tileset's tile assignments pop af ; Retrieve wCurMapTileset - ld hl, $0000 - cp $00 - jr z, .doneMultiplication + ld hl, MapPaletteAssignments + ld b, 0 ld c, a - ld de, $0060 ; Each palette assignment takes $60 bytes -.addLoop - add hl, de - dec c - jr nz, .addLoop -.doneMultiplication: - ld bc, MapPaletteAssignments add hl, bc - push hl - pop de ; de points to MapPaletteAssignments + add hl, bc + ld a, [hli] + ld e, a + ld a, [hl] + ld d, a ld hl, W2_TilesetPaletteMap - ld b, $60 + ld b, TILESET_SIZE .copyLoop ld a, [de] inc de @@ -88,14 +94,6 @@ LoadTilesetPalette: dec b jr nz, .copyLoop - ; Set the remaining values to 7 for text - ld b, $a0 - ld a, 7 -.fillLoop - ld [hli], a - dec b - jr nz, .fillLoop - ; There used to be special-case code for tile $78 here (pokeball in pc), but now ; it uses palette 7 as well. Those areas still need to load the variant of the ; textbox palette (PC_POKEBALL_PAL). diff --git a/color/tilesets/cavern.asm b/color/tilesets/cavern.asm index e374f564d..8d7df614f 100755 --- a/color/tilesets/cavern.asm +++ b/color/tilesets/cavern.asm @@ -6,7 +6,4 @@ tilepal 0, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN tilepal 0, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN tilepal 0, ROOF, BROWN, BROWN, BROWN, GRAY, BROWN, BROWN, BROWN - tilepal 0, BROWN, BROWN, GRAY, GRAY, GRAY, BROWN, GRAY, GRAY - tilepal 0, BROWN, GRAY, BROWN, GRAY, BROWN, BROWN, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, BROWN, BROWN, GRAY, GRAY + tilepal 0, BROWN, BROWN diff --git a/color/tilesets/cemetery.asm b/color/tilesets/cemetery.asm index 64e8a1070..b2a20fc78 100755 --- a/color/tilesets/cemetery.asm +++ b/color/tilesets/cemetery.asm @@ -9,4 +9,4 @@ tilepal 0, GRAY, GRAY, RED, GRAY, BROWN, BROWN, BROWN, GRAY tilepal 0, BROWN, BROWN, GRAY, GRAY, GRAY, GRAY, WATER, BROWN tilepal 0, GRAY, GRAY, RED, GRAY, GRAY, GRAY, GRAY, BROWN - tilepal 0, GRAY, BROWN, BROWN, BROWN, BROWN, BROWN, GRAY, GRAY + tilepal 0, GRAY, BROWN, BROWN, BROWN diff --git a/color/tilesets/club.asm b/color/tilesets/club.asm index d3171dacb..d0e777e05 100755 --- a/color/tilesets/club.asm +++ b/color/tilesets/club.asm @@ -7,6 +7,4 @@ tilepal 0, RED, RED, RED, RED, RED, RED, BROWN, GRAY tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, ROOF tilepal 0, GRAY, GRAY, ROOF, ROOF, ROOF, ROOF, ROOF, BROWN - tilepal 0, BROWN, BROWN, BROWN, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY + tilepal 0, BROWN, BROWN, BROWN, GRAY diff --git a/color/tilesets/house.asm b/color/tilesets/house.asm index bb84c6126..26be19d4d 100755 --- a/color/tilesets/house.asm +++ b/color/tilesets/house.asm @@ -9,4 +9,4 @@ tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, BROWN, BROWN tilepal 0, WATER, WATER, WATER, WATER, BROWN, BROWN, BROWN, BROWN tilepal 0, BROWN, BROWN, BROWN, BROWN, WATER, WATER, BROWN, BROWN - tilepal 0, WATER, GRAY, WATER, WATER, BROWN, BROWN, BROWN, BROWN + tilepal 0, WATER, GRAY, WATER, WATER, BROWN, BROWN diff --git a/color/tilesets/lab.asm b/color/tilesets/lab.asm index 21a6c0dfe..b3505a280 100755 --- a/color/tilesets/lab.asm +++ b/color/tilesets/lab.asm @@ -9,4 +9,4 @@ tilepal 0, BROWN, BROWN, BROWN, GREEN, GREEN, GRAY, BROWN, ROOF tilepal 0, BROWN, BROWN, GRAY, BROWN, RED, RED, ROOF, GRAY tilepal 0, BROWN, BROWN, BROWN, BROWN, BROWN, GRAY, BROWN, ROOF - tilepal 0, ROOF, ROOF, GRAY, BROWN, GRAY, GRAY, GRAY, GRAY + tilepal 0, ROOF, ROOF, GRAY, BROWN diff --git a/color/tilesets/lobby.asm b/color/tilesets/lobby.asm index ea84cf04a..572fba52e 100755 --- a/color/tilesets/lobby.asm +++ b/color/tilesets/lobby.asm @@ -9,4 +9,4 @@ tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY tilepal 0, ROOF, ROOF, RED, BROWN, BROWN, BROWN, BROWN, BROWN tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, ROOF, ROOF, GRAY, RED, BROWN, BROWN, GRAY, GRAY + tilepal 0, ROOF, ROOF, GRAY, RED, BROWN, BROWN diff --git a/color/tilesets/mansion.asm b/color/tilesets/mansion.asm index 10785c93c..c484f6891 100755 --- a/color/tilesets/mansion.asm +++ b/color/tilesets/mansion.asm @@ -9,4 +9,4 @@ tilepal 0, BROWN, BROWN, BROWN, BROWN, GREEN, GREEN, BROWN, BROWN tilepal 0, WATER, WATER, WATER, WATER, WATER, WATER, WATER, WATER tilepal 0, WATER, GRAY, GRAY, GRAY, GRAY, BROWN, BROWN, BROWN - tilepal 0, WATER, WATER, WATER, WATER, WATER, WATER, BROWN, BROWN + tilepal 0, WATER, WATER, WATER, WATER, WATER, WATER diff --git a/color/tilesets/overworld.asm b/color/tilesets/overworld.asm index 57fddc209..e59f0715c 100755 --- a/color/tilesets/overworld.asm +++ b/color/tilesets/overworld.asm @@ -9,4 +9,4 @@ tilepal 0, GREEN, GREEN, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY tilepal 0, BROWN, BROWN, GRAY, BROWN, ROOF, ROOF, GRAY, GRAY tilepal 0, GREEN, GREEN, GREEN, ROOF, BROWN, BROWN, GRAY, GRAY - tilepal 0, BROWN, BROWN, ROOF, BROWN, ROOF, ROOF, GRAY, GRAY + tilepal 0, BROWN, BROWN, ROOF, BROWN, ROOF, ROOF diff --git a/color/tilesets/plateau.asm b/color/tilesets/plateau.asm index 79acc1311..b23d2ce8f 100755 --- a/color/tilesets/plateau.asm +++ b/color/tilesets/plateau.asm @@ -6,7 +6,4 @@ tilepal 0, BROWN, BROWN, BROWN, BROWN, GREEN, GREEN, GRAY, GRAY tilepal 0, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN tilepal 0, GRAY, BROWN, BROWN, BROWN, BROWN, ROOF, ROOF, ROOF - tilepal 0, ROOF, ROOF, ROOF, ROOF, ROOF, GREEN, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY + tilepal 0, ROOF, ROOF, ROOF, ROOF, ROOF, GREEN diff --git a/color/tilesets/reds_house.asm b/color/tilesets/reds_house.asm index a6e95f3a7..2ad07e54b 100755 --- a/color/tilesets/reds_house.asm +++ b/color/tilesets/reds_house.asm @@ -7,6 +7,3 @@ tilepal 0, BROWN, BROWN, BROWN, BROWN, WATER, WATER, BROWN, BROWN tilepal 0, BROWN, BROWN, BROWN, BROWN, BROWN, GRAY, GRAY, GRAY tilepal 0, GRAY, GRAY, GRAY, GRAY, GREEN, GREEN, BROWN, BROWN - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, BROWN, GRAY, GRAY, GRAY diff --git a/color/tilesets/ship.asm b/color/tilesets/ship.asm index 0c41c09bc..a968e1d01 100755 --- a/color/tilesets/ship.asm +++ b/color/tilesets/ship.asm @@ -9,4 +9,4 @@ tilepal 0, YELLOW, YELLOW, RED, RED, BROWN, BROWN, GRAY, GRAY tilepal 0, RED, RED, BROWN, GRAY, GRAY, GRAY, GRAY, GRAY tilepal 0, YELLOW, YELLOW, GRAY, GRAY, RED, RED, GRAY, GRAY - tilepal 0, RED, RED, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY + tilepal 0, RED, RED diff --git a/color/tilesets/ship_port.asm b/color/tilesets/ship_port.asm index 8b499faca..3c6736216 100755 --- a/color/tilesets/ship_port.asm +++ b/color/tilesets/ship_port.asm @@ -9,4 +9,4 @@ tilepal 0, WATER, GRAY, BROWN, BROWN, GRAY, GRAY, GRAY, GRAY tilepal 0, RED, RED, RED, RED, RED, GRAY, BROWN, BROWN tilepal 0, YELLOW, WATER, GRAY, GRAY, GRAY, GRAY, YELLOW, YELLOW - tilepal 0, RED, RED, GRAY, WATER, GRAY, GRAY, GRAY, GRAY + tilepal 0, RED, RED, GRAY, WATER, GRAY, GRAY diff --git a/color/tilesets/underground.asm b/color/tilesets/underground.asm index 851d3831b..f179f1898 100755 --- a/color/tilesets/underground.asm +++ b/color/tilesets/underground.asm @@ -1,12 +1,4 @@ tilepal 0, GRAY, RED, GRAY, BROWN, BROWN, BROWN, BROWN, BROWN tilepal 0, BROWN, BROWN, BROWN, RED, RED, GRAY, GRAY, GRAY tilepal 0, GRAY, GRAY, GRAY, BROWN, BROWN, RED, GRAY, GRAY - tilepal 0, RED, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY - tilepal 0, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY, GRAY + tilepal 0, RED, GRAY From a62b5e77495c81d34bc620932adf4e2a7324eed9 Mon Sep 17 00:00:00 2001 From: Luna Date: Wed, 31 Jan 2024 07:31:22 -0600 Subject: [PATCH 2/5] LoadTilesetPalette was $100 bytes not $FF --- color/loadpalettes.asm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/color/loadpalettes.asm b/color/loadpalettes.asm index f3c3be548..47e355d29 100755 --- a/color/loadpalettes.asm +++ b/color/loadpalettes.asm @@ -66,15 +66,6 @@ LoadTilesetPalette: jr nz, .nextPalette ; Start copying palette assignments - ; start by filling the buffer with the textbox palette - ld hl, W2_TilesetPaletteMap - ld b, $ff - ld a, 7 -.fillLoop - ld [hli], a - dec b - jr nz, .fillLoop - ; fill in the tileset's tile assignments pop af ; Retrieve wCurMapTileset ld hl, MapPaletteAssignments ld b, 0 @@ -94,6 +85,14 @@ LoadTilesetPalette: dec b jr nz, .copyLoop + ; Set the remaining values to 7 for text + ld b, $100 - TILESET_SIZE + ld a, 7 +.fillLoop + ld [hli], a + dec b + jr nz, .fillLoop + ; There used to be special-case code for tile $78 here (pokeball in pc), but now ; it uses palette 7 as well. Those areas still need to load the variant of the ; textbox palette (PC_POKEBALL_PAL). From a5d389b20848c5b11fe8dce988d8dec11146a169 Mon Sep 17 00:00:00 2001 From: Luna Date: Thu, 1 Feb 2024 12:11:17 -0600 Subject: [PATCH 3/5] Switch Palette Sets to use a pointer table too --- color/data/map_palette_sets.asm | 221 ++++++++------------------------ color/loadpalettes.asm | 16 +-- 2 files changed, 58 insertions(+), 179 deletions(-) diff --git a/color/data/map_palette_sets.asm b/color/data/map_palette_sets.asm index aa2f6794a..473e28ffe 100755 --- a/color/data/map_palette_sets.asm +++ b/color/data/map_palette_sets.asm @@ -1,8 +1,34 @@ ; 8 bytes per tileset for 8 palettes, which are taken from MapPalettes. MapPaletteSets: - table_width 8, MapPaletteSets + table_width 2, MapPaletteSets + dw OverworldPalSet ; OVERWORLD + dw RedsHouse1PalSet ; REDS_HOUSE_1 + dw MartPalSet ; MART + dw ForestPalSet ; FOREST + dw RedsHouse2PalSet ; REDS_HOUSE_2 + dw DojoPalSet ; DOJO + dw PokecenterPalSet ; POKECENTER + dw GymPalSet ; GYM + dw HousePalSet ; HOUSE + dw ForestGatePalSet ; FOREST_GATE + dw MuseumPalSet ; MUSEUM + dw UndergroundPalSet ; UNDERGROUND + dw GatePalSet ; GATE + dw ShipPalSet ; SHIP + dw ShipPortPalSet ; SHIP_PORT + dw CemeteryPalSet ; CEMETERY + dw InteriorPalSet ; INTERIOR + dw CavernPalSet ; CAVERN + dw LobbyPalSet ; LOBBY + dw MansionPalSet ; MANSION + dw LabPalSet ; LAB + dw ClubPalSet ; CLUB + dw FacilityPalSet ; FACILITY + dw PlateauPalSet ; PLATEAU + assert_table_length NUM_TILESETS -; OVERWORLD +OverworldPalSet: +PlateauPalSet: db OUTDOOR_GRAY db OUTDOOR_RED db OUTDOOR_GREEN @@ -12,7 +38,17 @@ MapPaletteSets: db OUTDOOR_ROOF db CRYS_TEXTBOX -; REDS_HOUSE_1 +RedsHouse1PalSet: +RedsHouse2PalSet: +DojoPalSet: +GymPalSet: +HousePalSet: +ForestGatePalSet: +UndergroundPalSet: +ShipPalSet: +ShipPortPalSet: +ClubPalSet: +FacilityPalSet: db INDOOR_GRAY db INDOOR_RED db INDOOR_GREEN @@ -22,7 +58,11 @@ MapPaletteSets: db INDOOR_LIGHT_BLUE db CRYS_TEXTBOX -; MART +MartPalSet: +InteriorPalSet: +LobbyPalSet: +MansionPalSet: +LabPalSet: db INDOOR_GRAY db INDOOR_RED db INDOOR_GREEN @@ -32,7 +72,7 @@ MapPaletteSets: db INDOOR_LIGHT_BLUE db PC_POKEBALL_PAL -; FOREST +ForestPalSet: db OUTDOOR_GRAY db FOREST_ROCKS db OUTDOOR_GREEN @@ -42,27 +82,7 @@ MapPaletteSets: db FOREST_TREES db CRYS_TEXTBOX -; REDS_HOUSE_2 - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db CRYS_TEXTBOX - -; DOJO - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db CRYS_TEXTBOX - -; POKECENTER +PokecenterPalSet: db INDOOR_GRAY db INDOOR_RED db INDOOR_GREEN @@ -72,37 +92,8 @@ MapPaletteSets: db INDOOR_LIGHT_BLUE db PC_POKEBALL_PAL -; GYM - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db CRYS_TEXTBOX - -; HOUSE - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db CRYS_TEXTBOX - -; FOREST_GATE - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db CRYS_TEXTBOX - -; MUSEUM +MuseumPalSet: +GatePalSet: db INDOOR_GRAY db INDOOR_RED db INDOOR_GREEN @@ -112,47 +103,7 @@ MapPaletteSets: db INDOOR_LIGHT_BLUE db ALT_TEXTBOX_PAL ; Uses variant of textbox palette for skeleton pokemon -; UNDERGROUND - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db CRYS_TEXTBOX - -; GATE - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db ALT_TEXTBOX_PAL ; Uses variant of textbox palette for Articuno binoculars - -; SHIP - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db CRYS_TEXTBOX - -; SHIP_PORT - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db CRYS_TEXTBOX - -; CEMETERY +CemeteryPalSet: db INDOOR_GRAY db INDOOR_RED db INDOOR_GREEN @@ -162,17 +113,7 @@ MapPaletteSets: db INDOOR_PURPLE db CRYS_TEXTBOX -; INTERIOR - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db PC_POKEBALL_PAL - -; CAVERN +CavernPalSet: db CAVE_GRAY db CAVE_RED db CAVE_GREEN @@ -181,65 +122,3 @@ MapPaletteSets: db CAVE_BROWN db CAVE_LIGHT_BLUE db CRYS_TEXTBOX - -; LOBBY - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db PC_POKEBALL_PAL - -; MANSION - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db PC_POKEBALL_PAL - -; LAB - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db PC_POKEBALL_PAL - -; CLUB - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db CRYS_TEXTBOX - -; FACILITY - db INDOOR_GRAY - db INDOOR_RED - db INDOOR_GREEN - db INDOOR_BLUE - db INDOOR_YELLOW - db INDOOR_BROWN - db INDOOR_LIGHT_BLUE - db CRYS_TEXTBOX - -; PLATEAU - db OUTDOOR_GRAY - db OUTDOOR_RED - db OUTDOOR_GREEN - db OUTDOOR_BLUE - db OUTDOOR_YELLOW - db OUTDOOR_BROWN - db OUTDOOR_ROOF - db CRYS_TEXTBOX - - assert_table_length NUM_TILESETS diff --git a/color/loadpalettes.asm b/color/loadpalettes.asm index 47e355d29..f2c811da7 100755 --- a/color/loadpalettes.asm +++ b/color/loadpalettes.asm @@ -25,15 +25,15 @@ LoadTilesetPalette: ld a, b ; Get wCurMapTileset push af - ld d, 0 - ld e, a - sla e - sla e - sla e ld hl, MapPaletteSets - add hl, de - ld d, h - ld e, l + ld b, 0 + ld c, a + add hl, bc + add hl, bc + ld a, [hli] + ld e, a + ld a, [hl] + ld d, a ld hl, W2_BgPaletteData ; palette data to be copied to wram at hl ld b, $08 .nextPalette From 5ab4dd8200c6afaff96877b909a14279723b0289 Mon Sep 17 00:00:00 2001 From: Luna Date: Thu, 1 Feb 2024 18:23:49 -0600 Subject: [PATCH 4/5] Add missing asserts in 2 easy-to-miss tables --- color/sprites.asm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/color/sprites.asm b/color/sprites.asm index 20b05352b..4f2f4c910 100755 --- a/color/sprites.asm +++ b/color/sprites.asm @@ -307,6 +307,7 @@ ClearSpritePaletteMap: SpritePaletteAssignments: ; Characters on the overworld + table_width 1, SpritePaletteAssignments ; 0x01: SPRITE_RED db SPR_PAL_ORANGE @@ -523,6 +524,8 @@ SpritePaletteAssignments: ; Characters on the overworld ; 0x48: SPRITE_LYING_OLD_MAN db SPR_PAL_BROWN + assert_table_length NUM_SPRITES + AnimationTileset1Palettes: INCBIN "color/data/animtileset1palettes.bin" @@ -531,6 +534,7 @@ AnimationTileset2Palettes: INCBIN "color/data/animtileset2palettes.bin" TypeColorTable: ; Used for a select few sprites to be colorized based on attack type + table_width 1, TypeColorTable db 0 ; NORMAL EQU $00 db 0 ; FIGHTING EQU $01 db 0 ; FLYING EQU $02 @@ -558,5 +562,6 @@ TypeColorTable: ; Used for a select few sprites to be colorized based on attack db 7 ; PSYCHIC EQU $18 db 6 ; ICE EQU $19 db 1 ; DRAGON EQU $1A + assert_table_length NUM_TYPES INCLUDE "color/data/spritepalettes.asm" From 2d8fa693dd96849cf1c3819764c5ee600f52fb58 Mon Sep 17 00:00:00 2001 From: Luna Date: Tue, 13 Feb 2024 10:50:42 -0600 Subject: [PATCH 5/5] Fix hardcoded bank ID for rival pic in oak_speech2 --- engine/movie/oak_speech/oak_speech2.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/movie/oak_speech/oak_speech2.asm b/engine/movie/oak_speech/oak_speech2.asm index 7288207b7..95ebcabe5 100644 --- a/engine/movie/oak_speech/oak_speech2.asm +++ b/engine/movie/oak_speech/oak_speech2.asm @@ -54,7 +54,7 @@ ChooseRivalName: call ClearScreen call Delay3 ld de, Rival1Pic - ld b, $13 + ld b, BANK(Rival1Pic) call IntroDisplayPicCenteredOrUpperRight .done ld hl, HisNameIsText