You are not logged in.
Pages: 1
Summary: VRAM bank 0 tiles $60 to $6f are unused in my pokecrystal hack. I would like to use them as map tiles. When I edit the metatiles.bin files to do so, some sprites disappear when I talk to them.
pokecrystal's tilesets use the tile IDs $00 to $5f, and then $80 to $df, skipping $60 to $7f. Looking at the VRAM in BGB, it's clear that this is because those 32 tiles are used for textbox frames, location name popups, the phone call icon, and other graphics.
The LoadTileset routine in home/map.asm loads the first $60 tiles to VRAM bank 0, and the next $60 to VRAM bank 1, which is again visible in the BGB screenshot.
LoadTileset:: ; 2821
ld hl, TilesetAddress
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [TilesetBank]
ld e, a
ld a, [rSVBK]
push af
ld a, $6
ld [rSVBK], a
ld a, e
ld de, wDecompressScratch
call FarDecompress
ld hl, wDecompressScratch
ld de, VTiles2
ld bc, $60 tiles
call CopyBytes
ld a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ld hl, w6_d600
ld de, VTiles2
ld bc, $60 tiles
call CopyBytes
pop af
ld [rVBK], a
pop af
ld [rSVBK], a
...
wram.asm:
SECTION "WRAM 6", WRAMX, BANK [6]
wDecompressScratch:: ds $400
wBackupAttrMap:: ds $200
w6_d600:: ds $200
w6_d800::
You can safely change that second "$60 tiles" to "$80 tiles" and use tile IDs $e0 to $ff. Just extend the tileset graphics and the corresponding tilesets/##_palette_map.asm files, and you'll see the new tiles in VRAM bank 1.
I've reorganized things such that bank 0 tiles $60 to $6f are unused, and would like to load tiles in them. My initial approach:
• Change the first "$60 tiles" to "$70 tiles" and the second "$60 tiles" to "$80 tiles".
• Rename w6_d600 to w6_d700 and shift it ahead by $100 bytes.
• Update all the metatiles, shifting tile IDs $80−$8f to $60−6f and $90−$df to $80−$cf.
• Update all the palette maps. Instead of 12 "tilepal 0" lines, 16 filler $ff bytes, and the rest of the "tilepal 1" lines, use 14 "tilepal 0" lines (move the first two "tilepal 1"s) and 8 filler $ff bytes.
The problem: When I do this, talking to certain sprites makes them disappear (and reappear when the textbox is dismissed). For example:
The corrupted tiles are not the problem. The screenshots above have corrupted tiles because I narrowed down the sprite issue to the changed metatiles.bin files, and only made that change. Which means the tile IDs no longer correspond properly to the graphics or the palette map. For instance, the Town Map in the top right used to use tile IDs $8a $8b $9a $9b (you can see in the VRAM that those tile IDs are the Town Map). But I edited the metatiles as described above, so the tile IDs being used are $6a $6b $8a $8b. Of course the bottom half of the map now loads the top half graphics, but the top half is blank. I don't understand why it isn't using the "©1995−2001 Nintendo Crea" tiles that are clearly still left over in VRAM from the title screen. Nor why the sprites disappear. It seems like an overflow error, but which data is overflowing where? All I changed is the tile IDs; I'm not loading more or less tile data, I haven't changed the addresses it's being loaded to.
Edit: window.asm:OpenText calls main.asm:ReanchorBGMap_NoOAMUpdate. This seems to be part of the problem.
Edit: Using IDs $e0 to $ff has the same problem.
Last edited by Rangi (2017-03-05 01:20:40)
My projects on GitHub:
• Polished Map 4.7.1 or 2.7.1++
• Tilemap Studio 4.0.1
• Pokémon Polished Crystal 2.2.0 or 3.0.0 beta
• Pokémon Red★/Blue★: Space World Edition 2020-11-01
Offline
Can anyone help with this? Crystal_ or comet, you're both knowledgable about the details of pokecrystal and the GameBoy. I'd like to be able to use these sixteen tiles. If necessary, I could have multiple tilesets, but they'd be mostly redundant apart from a few area-specific tiles.
My projects on GitHub:
• Polished Map 4.7.1 or 2.7.1++
• Tilemap Studio 4.0.1
• Pokémon Polished Crystal 2.2.0 or 3.0.0 beta
• Pokémon Red★/Blue★: Space World Edition 2020-11-01
Offline
This is finally fixed! Mateo told me he'd encountered a similar bug before, due to text boxes hiding sprites based on the tile IDs they're standing on (not their coordinates, as I expected). I'm not loading any text box graphics in IDs 60−6F any more, but engine/map_objects.asm:Function56cd needed to be informed of that by changing the final $60 to a $70. (IDs F0−FF still can't be stood on, but I may just put impassable tiles in that space instead of refactoring Function56cd.)
My projects on GitHub:
• Polished Map 4.7.1 or 2.7.1++
• Tilemap Studio 4.0.1
• Pokémon Polished Crystal 2.2.0 or 3.0.0 beta
• Pokémon Red★/Blue★: Space World Edition 2020-11-01
Offline
Pages: 1