mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-02-16 17:35:39 +00:00
Further optimization/simplification of the 2D renderer's main loop.
This commit is contained in:
parent
453df4f5f5
commit
c085be59af
|
@ -624,51 +624,26 @@ void CRender2D::DrawTilemaps(UINT32 *destBottom, UINT32 *destTop)
|
||||||
/*
|
/*
|
||||||
* Render and mix each line
|
* Render and mix each line
|
||||||
*/
|
*/
|
||||||
if (clearBottom)
|
if (clearBottom) // no bottom layer
|
||||||
{
|
memset(destBottom, 0, 496*384*sizeof(UINT32));
|
||||||
for (int y = 0; y < 384; y++)
|
|
||||||
{
|
|
||||||
// Draw one scanline from each layer
|
|
||||||
DrawLine(lineBuffer[0], 0, y, nameTableBase[0], pal[0]);
|
|
||||||
DrawLine(lineBuffer[1], 1, y, nameTableBase[1], pal[0]);
|
|
||||||
DrawLine(lineBuffer[2], 2, y, nameTableBase[2], pal[1]);
|
|
||||||
DrawLine(lineBuffer[3], 3, y, nameTableBase[3], pal[1]);
|
|
||||||
|
|
||||||
// No bottom layer
|
|
||||||
memset(destBottom, 0, 496*sizeof(UINT32));
|
|
||||||
|
|
||||||
// Mix the layers in the correct order
|
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
MixLine(dest[i], src[i], sortedLayerNum[i], y, sortedIsBottom[i], sortedHScrollTable[i], maskTableLine, sortedHFullScroll[i], sortedLineScrollMode[i]);
|
|
||||||
dest[i] += 496; // next line
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next line in mask table
|
|
||||||
maskTableLine += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int y = 0; y < 384; y++)
|
|
||||||
{
|
|
||||||
// Draw one scanline from each layer
|
|
||||||
DrawLine(lineBuffer[0], 0, y, nameTableBase[0], pal[0]);
|
|
||||||
DrawLine(lineBuffer[1], 1, y, nameTableBase[1], pal[0]);
|
|
||||||
DrawLine(lineBuffer[2], 2, y, nameTableBase[2], pal[1]);
|
|
||||||
DrawLine(lineBuffer[3], 3, y, nameTableBase[3], pal[1]);
|
|
||||||
|
|
||||||
// Mix the layers in the correct order
|
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
MixLine(dest[i], src[i], sortedLayerNum[i], y, sortedIsBottom[i], sortedHScrollTable[i], maskTableLine, sortedHFullScroll[i], sortedLineScrollMode[i]);
|
|
||||||
dest[i] += 496; // next line
|
|
||||||
}
|
|
||||||
|
|
||||||
// Next line in mask table
|
|
||||||
maskTableLine += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
for (int y = 0; y < 384; y++)
|
||||||
|
{
|
||||||
|
// Draw one scanline from each layer
|
||||||
|
DrawLine(lineBuffer[0], 0, y, nameTableBase[0], pal[0]);
|
||||||
|
DrawLine(lineBuffer[1], 1, y, nameTableBase[1], pal[0]);
|
||||||
|
DrawLine(lineBuffer[2], 2, y, nameTableBase[2], pal[1]);
|
||||||
|
DrawLine(lineBuffer[3], 3, y, nameTableBase[3], pal[1]);
|
||||||
|
|
||||||
|
// Mix the layers in the correct order
|
||||||
|
for (int i = 0; i < 4; i++)
|
||||||
|
{
|
||||||
|
MixLine(dest[i], src[i], sortedLayerNum[i], y, sortedIsBottom[i], sortedHScrollTable[i], maskTableLine, sortedHFullScroll[i], sortedLineScrollMode[i]);
|
||||||
|
dest[i] += 496; // next line
|
||||||
|
}
|
||||||
|
|
||||||
|
// Next line in mask table
|
||||||
|
maskTableLine += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue