Skip to content

Instantly share code, notes, and snippets.

@Dwedit
Created March 26, 2019 12:38
Show Gist options
  • Save Dwedit/a6ede4d4270924f70687d3233a46d98d to your computer and use it in GitHub Desktop.
Save Dwedit/a6ede4d4270924f70687d3233a46d98d to your computer and use it in GitHub Desktop.
Snes9x DrawTile16AddS1_2_Normal1x1 Expanded Code
static void DrawTile16AddS1_2_Normal1x1(uint32 Tile, uint32 Offset, uint32 StartLine, uint32 LineCount)
{
uint8 *pCache;
int32 l;
uint8 *bp, Pix;
uint32 TileNumber;
uint32 TileAddr = BG.TileAddress + ((Tile & 0x3ff) << BG.TileShift);
if (Tile & 0x100) TileAddr += BG.NameSelect;
TileAddr &= 0xffff;
TileNumber = TileAddr >> BG.TileShift;
if (Tile & 0x4000) {
pCache = &BG.BufferFlip[TileNumber << 6];
if (!BG.BufferedFlip[TileNumber]) BG.BufferedFlip[TileNumber] = BG.ConvertTileFlip(pCache, TileAddr, Tile & 0x3ff);
}
else {
pCache = &BG.Buffer[TileNumber << 6];
if (!BG.Buffered[TileNumber]) BG.Buffered[TileNumber] = BG.ConvertTile(pCache, TileAddr, Tile & 0x3ff);
};
if ((((Tile & 0x4000) ? BG.BufferedFlip[TileNumber] : BG.Buffered[TileNumber]) == 2)) return;
if (BG.DirectColourMode) {
GFX.RealScreenColors = DirectColourMaps[(Tile >> 10) & 7];
}
else GFX.RealScreenColors = &IPPU.ScreenColors[((Tile >> BG.PaletteShift) & BG.PaletteMask) + BG.StartPalette];
GFX.ScreenColors = GFX.ClipColors ? BlackColourMap : GFX.RealScreenColors;
if (!(Tile & (0x8000 | 0x4000))) {
bp = pCache + StartLine;
;
for (l = LineCount;
l > 0;
l--, bp += 8 * 1, Offset += GFX.PPL) {
if (GFX.Z1 > GFX.DB[Offset + 0] && (Pix = bp[0])) {
GFX.S[Offset + 0] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 0]) & 0x20) ? (GFX.SubScreen[Offset + 0]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 0]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 0])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 0])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 0] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 1] && (Pix = bp[1])) {
GFX.S[Offset + 1] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 1]) & 0x20) ? (GFX.SubScreen[Offset + 1]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 1]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 1])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 1])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 1] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 2] && (Pix = bp[2])) {
GFX.S[Offset + 2] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 2]) & 0x20) ? (GFX.SubScreen[Offset + 2]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 2]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 2])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 2])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 2] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 3] && (Pix = bp[3])) {
GFX.S[Offset + 3] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 3]) & 0x20) ? (GFX.SubScreen[Offset + 3]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 3]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 3])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 3])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 3] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 4] && (Pix = bp[4])) {
GFX.S[Offset + 4] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 4]) & 0x20) ? (GFX.SubScreen[Offset + 4]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 4]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 4])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 4])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 4] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 5] && (Pix = bp[5])) {
GFX.S[Offset + 5] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 5]) & 0x20) ? (GFX.SubScreen[Offset + 5]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 5]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 5])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 5])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 5] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 6] && (Pix = bp[6])) {
GFX.S[Offset + 6] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 6]) & 0x20) ? (GFX.SubScreen[Offset + 6]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 6]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 6])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 6])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 6] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 7] && (Pix = bp[7])) {
GFX.S[Offset + 7] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 7]) & 0x20) ? (GFX.SubScreen[Offset + 7]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 7]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 7])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 7])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 7] = GFX.Z2;
};
}
}
else if (!(Tile & 0x8000)) {
bp = pCache + StartLine;
;
for (l = LineCount;
l > 0;
l--, bp += 8 * 1, Offset += GFX.PPL) {
if (GFX.Z1 > GFX.DB[Offset + 0] && (Pix = bp[7])) {
GFX.S[Offset + 0] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 0]) & 0x20) ? (GFX.SubScreen[Offset + 0]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 0]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 0])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 0])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 0] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 1] && (Pix = bp[6])) {
GFX.S[Offset + 1] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 1]) & 0x20) ? (GFX.SubScreen[Offset + 1]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 1]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 1])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 1])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 1] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 2] && (Pix = bp[5])) {
GFX.S[Offset + 2] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 2]) & 0x20) ? (GFX.SubScreen[Offset + 2]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 2]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 2])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 2])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 2] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 3] && (Pix = bp[4])) {
GFX.S[Offset + 3] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 3]) & 0x20) ? (GFX.SubScreen[Offset + 3]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 3]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 3])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 3])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 3] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 4] && (Pix = bp[3])) {
GFX.S[Offset + 4] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 4]) & 0x20) ? (GFX.SubScreen[Offset + 4]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 4]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 4])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 4])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 4] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 5] && (Pix = bp[2])) {
GFX.S[Offset + 5] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 5]) & 0x20) ? (GFX.SubScreen[Offset + 5]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 5]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 5])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 5])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 5] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 6] && (Pix = bp[1])) {
GFX.S[Offset + 6] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 6]) & 0x20) ? (GFX.SubScreen[Offset + 6]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 6]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 6])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 6])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 6] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 7] && (Pix = bp[0])) {
GFX.S[Offset + 7] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 7]) & 0x20) ? (GFX.SubScreen[Offset + 7]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 7]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 7])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 7])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 7] = GFX.Z2;
};
}
}
else if (!(Tile & 0x4000)) {
bp = pCache + 56 - StartLine;
;
for (l = LineCount;
l > 0;
l--, bp -= 8 * 1, Offset += GFX.PPL) {
if (GFX.Z1 > GFX.DB[Offset + 0] && (Pix = bp[0])) {
GFX.S[Offset + 0] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 0]) & 0x20) ? (GFX.SubScreen[Offset + 0]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 0]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 0])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 0])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 0] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 1] && (Pix = bp[1])) {
GFX.S[Offset + 1] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 1]) & 0x20) ? (GFX.SubScreen[Offset + 1]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 1]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 1])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 1])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 1] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 2] && (Pix = bp[2])) {
GFX.S[Offset + 2] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 2]) & 0x20) ? (GFX.SubScreen[Offset + 2]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 2]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 2])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 2])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 2] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 3] && (Pix = bp[3])) {
GFX.S[Offset + 3] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 3]) & 0x20) ? (GFX.SubScreen[Offset + 3]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 3]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 3])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 3])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 3] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 4] && (Pix = bp[4])) {
GFX.S[Offset + 4] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 4]) & 0x20) ? (GFX.SubScreen[Offset + 4]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 4]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 4])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 4])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 4] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 5] && (Pix = bp[5])) {
GFX.S[Offset + 5] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 5]) & 0x20) ? (GFX.SubScreen[Offset + 5]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 5]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 5])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 5])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 5] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 6] && (Pix = bp[6])) {
GFX.S[Offset + 6] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 6]) & 0x20) ? (GFX.SubScreen[Offset + 6]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 6]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 6])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 6])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 6] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 7] && (Pix = bp[7])) {
GFX.S[Offset + 7] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 7]) & 0x20) ? (GFX.SubScreen[Offset + 7]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 7]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 7])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 7])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 7] = GFX.Z2;
};
}
}
else {
bp = pCache + 56 - StartLine;
;
for (l = LineCount;
l > 0;
l--, bp -= 8 * 1, Offset += GFX.PPL) {
if (GFX.Z1 > GFX.DB[Offset + 0] && (Pix = bp[7])) {
GFX.S[Offset + 0] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 0]) & 0x20) ? (GFX.SubScreen[Offset + 0]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 0]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 0])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 0])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 0] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 1] && (Pix = bp[6])) {
GFX.S[Offset + 1] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 1]) & 0x20) ? (GFX.SubScreen[Offset + 1]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 1]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 1])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 1])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 1] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 2] && (Pix = bp[5])) {
GFX.S[Offset + 2] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 2]) & 0x20) ? (GFX.SubScreen[Offset + 2]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 2]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 2])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 2])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 2] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 3] && (Pix = bp[4])) {
GFX.S[Offset + 3] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 3]) & 0x20) ? (GFX.SubScreen[Offset + 3]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 3]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 3])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 3])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 3] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 4] && (Pix = bp[3])) {
GFX.S[Offset + 4] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 4]) & 0x20) ? (GFX.SubScreen[Offset + 4]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 4]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 4])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 4])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 4] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 5] && (Pix = bp[2])) {
GFX.S[Offset + 5] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 5]) & 0x20) ? (GFX.SubScreen[Offset + 5]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 5]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 5])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 5])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 5] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 6] && (Pix = bp[1])) {
GFX.S[Offset + 6] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 6]) & 0x20) ? (GFX.SubScreen[Offset + 6]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 6]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 6])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 6])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 6] = GFX.Z2;
};
if (GFX.Z1 > GFX.DB[Offset + 7] && (Pix = bp[0])) {
GFX.S[Offset + 7] = (GFX.ClipColors ? (COLOR_ADD((GFX.ScreenColors[Pix]), ((GFX.SubZBuffer[Offset + 7]) & 0x20) ? (GFX.SubScreen[Offset + 7]) : GFX.FixedColour)) : (((GFX.SubZBuffer[Offset + 7]) & 0x20) ? (((((((GFX.ScreenColors[Pix])) & (~(0x0800 | 0x0020 | 0x0001))) + (((GFX.SubScreen[Offset + 7])) & (~(0x0800 | 0x0020 | 0x0001)))) >> 1) + (((GFX.ScreenColors[Pix])) & ((GFX.SubScreen[Offset + 7])) & (0x0800 | 0x0020 | 0x0001))) | 0x0000) : COLOR_ADD((GFX.ScreenColors[Pix]), GFX.FixedColour)));
GFX.DB[Offset + 7] = GFX.Z2;
};
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment