Code: Select all
void redrawForegroundColumn(u16 columnToUpdate)
{
// Calculate where in the tilemap the new row's tiles are located.
const u16* mapDataAddr = fgMap.tilemap + fgRowGroupOffsets[fgCameraTileY >> 3] + fgRowOffsets[fgCameraTileY & 7] + columnToUpdate;
u16 columnBufferIdx = fgCameraTileY;
// Copy the tiles into the buffer.
u16 i;
for (i = VDP_PLANE_TILE_HEIGHT; i != 0; i--)
{
u16 baseTile = TILE_ATTR_FULL(PALLET, 0, 0, 0, fgTilesetStartIdx);
columnBufferIdx &= 0x1F; // columnBufferIdx MOD 32 (VDP_PLANE_TILE_HEIGHT)
fgColumnBuffer[columnBufferIdx] = baseTile + *mapDataAddr;
columnBufferIdx++;
mapDataAddr += fgMap.w;
}
// Queue copying the buffer into VRAM.
DMA_queueDma(DMA_VRAM, (u32) fgColumnBuffer, PLANE_FG + ((columnToUpdate & VDP_PLANE_TILE_WIDTH_MINUS_ONE) << 1), VDP_PLANE_TILE_HEIGHT, VDP_PLANE_TILE_WIDTH_TIMES_TWO);
}
The problem I'm running into is Rescomp as far as I can tell has no provision for loading up maps with more than one pallet. Admittedly I could get around this problem by compiling the resource in a single pallet and then defining which tiles need other pallets later. But this will be a pain to hand define myself but if that's what needs to happen so be it.
However, this still means I have a problem with Rescomp's outputs. it exports images in assembly 16 bit words when the method I have needs 32 bit unsigned integers.
Code: Select all
nightGrass_tileset_tiles:
dc.w 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555
dc.w 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555, 0x5555
Code: Select all
const u32 TILEMAP_TEST_FG_TILES[TILEMAP_TEST_FG_TILE_COUNT][TILE_PIXEL_ROW_COUNT] =
{
{
0x11111111,
0x14444444,
0x14444444,
0x14444444,
0x14444444,
0x14444444,
0x14444444,
0x14444444
},
{
0x11111111,
0x44444441,
0x44444441,
0x44444441,
0x44444441,
0x44444441,
0x44444441,
0x44444441
},
etc.