src/sgp/VObject_Blitters.cc
void Blt8BPPDataTo16BPPBufferTransZNBTranslucent(UINT16* const buf, UINT32 const uiDestPitchBYTES, UINT16* const zbuf, UINT16 const zval, HVOBJECT const hSrcVObject, INT32 const iX, INT32 const iY, UINT16 const usIndex)
{
	Assert(hSrcVObject);
	Assert(buf);

	// Get offsets from index into structure.
	ETRLEObject const& e      = hSrcVObject->SubregionProperties(usIndex);
	UINT32             height = e.usHeight;
	UINT32      const  width  = e.usWidth;

	// Add to start position of dest buffer.
	INT32 const x = iX + e.sOffsetX;
	INT32 const y = iY + e.sOffsetY;

	CHECKV(x >= 0);
	CHECKV(y >= 0);

	UINT32         const pitch     = uiDestPitchBYTES / 2;
	UINT8   const*       src       = hSrcVObject->PixData(e);
	UINT16*              dst       = buf  + pitch * y + x;
	UINT16  const*       zdst      = zbuf + pitch * y + x;
	UINT16  const* const pal       = hSrcVObject->CurrentShade();
	UINT32               line_skip = pitch - width;

	UINT32 const translucent_mask = guiTranslucentMask;
	do
	{
		for (;;)
		{
			UINT8 data = *src++;

			if (data == 0) break;
			if (data & 0x80)
			{
				data &= 0x7F;
				dst  += data;
				zdst += data;
			}
			else
			{
				do
				{
					if (*zdst > zval) continue;
					*dst =
						((pal[*src] >> 1) & translucent_mask) +
						((*dst      >> 1) & translucent_mask);
				}
				while (++src, ++dst, ++zdst, --data > 0);
			}
		}
		dst  += line_skip;
		zdst += line_skip;
	}
	while (--height > 0);
}
/* Blit an image into the destination buffer, using an ETRLE brush as a source,
 * and a 16-bit buffer as a destination. As it is blitting, it checks the Z
 * value of the ZBuffer, and if the pixel's Z level is below that of the current
 * pixel, it is written on, and the Z value is NOT updated to the current value,
 * for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same
 * dimensions (including pitch) as the destination.
 * Blits every second pixel ("Translucents"). */
Blit an image into the destination buffer, using an ETRLE brush as a source,
and a 16-bit buffer as a destination. As it is blitting, it checks the Z
value of the ZBuffer, and if the pixel's Z level is below that of the current
pixel, it is written on, and the Z value is NOT updated to the current value,
for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same
dimensions (including pitch) as the destination.
Blits every second pixel ("Translucents").
Blit an image into the destination buffer using an ETRLE brush as a source and a 16 - bit buffer as a destination . As it is blitting it checks the Z value of the ZBuffer and if the pixel ' s Z level is below that of the current pixel it is written on and the Z value is NOT updated to the current value for any non - transparent pixels . The Z - buffer is 16 bit and must be the same dimensions ( including pitch ) as the destination . Blits every second pixel ( " Translucents " ) .
void Blt8BPPDataTo16BPPBufferTransZNBTranslucent(UINT16* const buf, UINT32 const uiDestPitchBYTES, UINT16* const zbuf, UINT16 const zval, HVOBJECT const hSrcVObject, INT32 const iX, INT32 const iY, UINT16 const usIndex)
{
	Assert(hSrcVObject);
	Assert(buf);
	ETRLEObject const& e      = hSrcVObject->SubregionProperties(usIndex);
	UINT32             height = e.usHeight;
	UINT32      const  width  = e.usWidth;
	INT32 const x = iX + e.sOffsetX;
	INT32 const y = iY + e.sOffsetY;
	CHECKV(x >= 0);
	CHECKV(y >= 0);
	UINT32         const pitch     = uiDestPitchBYTES / 2;
	UINT8   const*       src       = hSrcVObject->PixData(e);
	UINT16*              dst       = buf  + pitch * y + x;
	UINT16  const*       zdst      = zbuf + pitch * y + x;
	UINT16  const* const pal       = hSrcVObject->CurrentShade();
	UINT32               line_skip = pitch - width;
	UINT32 const translucent_mask = guiTranslucentMask;
	do
	{
		for (;;)
		{
			UINT8 data = *src++;
			if (data == 0) break;
			if (data & 0x80)
			{
				data &= 0x7F;
				dst  += data;
				zdst += data;
			}
			else
			{
				do
				{
					if (*zdst > zval) continue;
					*dst =
						((pal[*src] >> 1) & translucent_mask) +
						((*dst      >> 1) & translucent_mask);
				}
				while (++src, ++dst, ++zdst, --data > 0);
			}
		}
		dst  += line_skip;
		zdst += line_skip;
	}
	while (--height > 0);
}
void Blt8BPPDataTo16BPPBufferTransZNBTranslucent ( UINT16 * const buf , UINT32 const uiDestPitchBYTES , UINT16 * const zbuf , UINT16 const zval , HVOBJECT const hSrcVObject , INT32 const iX , INT32 const iY , UINT16 const usIndex ) { Assert ( hSrcVObject ) ; Assert ( buf ) ; ETRLEObject const & e = hSrcVObject -> SubregionProperties ( usIndex ) ; UINT32 height = e . usHeight ; UINT32 const width = e . usWidth ; INT32 const x = iX + e . sOffsetX ; INT32 const y = iY + e . sOffsetY ; CHECKV ( x >= 0 ) ; CHECKV ( y >= 0 ) ; UINT32 const pitch = uiDestPitchBYTES / 2 ; UINT8 const * src = hSrcVObject -> PixData ( e ) ; UINT16 * dst = buf + pitch * y + x ; UINT16 const * zdst = zbuf + pitch * y + x ; UINT16 const * const pal = hSrcVObject -> CurrentShade ( ) ; UINT32 line_skip = pitch - width ; UINT32 const translucent_mask = guiTranslucentMask ; do { for ( ; ; ) { UINT8 data = * src ++ ; if ( data == 0 ) break ; if ( data & 0x80 ) { data &= 0x7F ; dst += data ; zdst += data ; } else { do { if ( * zdst > zval ) continue ; * dst = ( ( pal [ * src ] >> 1 ) & translucent_mask ) + ( ( * dst >> 1 ) & translucent_mask ) ; } while ( ++ src , ++ dst , ++ zdst , -- data > 0 ) ; } } dst += line_skip ; zdst += line_skip ; } while ( -- height > 0 ) ; }
Blit an image into the destination buffer, using an ETRLE brush as a source,
 and a 16-bit buffer as a destination.
Blit an image into the destination buffer using an ETRLE brush as a source and a 16 - bit buffer as a destination .
// Get offsets from index into structure. // Add to start position of dest buffer.