Porting RS Tile System to Firered
View Single Post
December 30th, 2011 (03:41 PM). Edited December 31st, 2011 by NintendoBoyDX.
Join Date: Jul 2010
Hey everyone, as you may know there are differences between FRLG and RS with the major/minor tilesets. If not here is some info.
tile - a 8x8 pixel piece used to form blocks, there are 1024 tiles in 2 combined (major+minor) tilesets
block - has 2 layers, a top and bottom, each 16x16 pixels, each layer is made of 4 tiles, there are 1024 tiles in a major/minor tileset as well
Major tileset: DIB image size is 128x256 pixels
Minor tileset: DIB image size is 128x256 pixels
Major tileset: block amount is 512
Minor tileset: block amount is anywhere from 1-512
Major tileset: 512 tiles
Minor tileset: 512 tiles
As you can see the minor and majors are the same size in RS. But in FRLG, because gamefreak wanted to imitate RBY, they switched it up a bit.
Major tileset: DIB image size is 128x320 pixels
Minor tileset: DIB image size is 128x192 pixels
Major tileset: block amount is 640
Minor tileset: block amount is anywhere from 1-384
Major tileset: 640 tiles
Minor tileset: 640 tiles
Because I want to use RS's system on Fr I started a "port", but run into some problems. Here's what to do:
To insert the tilesets correctly make 2 small changes to advancemap.ini. Where it says Tilesethoehe*(tileset height), change it from 40 to 32.
And at Teil1Bloecke (amount of blocks in tileset 1) change it from $280 to $200(in decimal that is from 640 to 512). This way the tilesets now insert correctly, and you can have the correct block amounts, 512 and 512.
*Tilesethoehe is the major tileset's amount of vertical tiles. Since one tile is 8 pixels tall you could fit 32 in one column that is 256 pixels in length, and 40 in one that is 320 pixels in length. The width is not changeable it is always 128 pixels, aka 16 tiles. So obviously, there in a frlg major set there are 40*16 = 640 tiles, minor 24*16 = 384, for a total of 1024. And for rs both major and minor have 32*16 = 512 tiles. DO NOT let this fool you - there are 1024 tiles in 2 sets, and 1024 blocks made out of those tiles in 2 sets as well.
Now the remaining problems are with the code. They don't load correctly into VRAM. The thread below by ZDG shows how to do it in FR. Where it creates the 0x280 that later becomes 0x5000 and is added to vram to create the location for tileset 2, I changed it to 0x200 so that it becomes 0x4000 (the offset added to vram start address 0x06000000).
The other routines each of 0x280(640) and 0x180(384) and so I assume them to be the block amounts. I changed them all to 0x200(512). I even took a look at the changes in prime's DNS which alters the tile loading functions, and i've seemingly found them all (there are many spots around the area that use 0x280/27F and 0x180/17F.
My problem now is that the blocks are scrambled. The tilesets inserted correctly and load properly in vram, the blocks are formed correctly, but the problem is the block numbers are all messed up. For example, where I choose block 0x4, block 0x80 would show up. As far as I can tell it is always the same pattern of random blocks that show up - this happens on only the minor tileset, the major is fine.
I tried editing all these places which are part of the map routines:
08059090 area, 08059a50 area, 0805a970 area, 08070040 area, and 08070490 area. All I did was change the creation of the values 0x27F/17F/280/180 to 0x1FF/200, but still am getting that problem with the blocks. Obviously, I'm missing something or going about this the wrong way. Any ideas?
View Public Profile
Send a private message to NintendoBoyDX
Find all posts by NintendoBoyDX
Find threads started by NintendoBoyDX
Ignore Posts by NintendoBoyDX