src/sgp/VObject_Blitters.cc
void Blt8BPPDataTo16BPPBufferTransShadowZ(UINT16* pBuffer, UINT32 uiDestPitchBYTES, UINT16* pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, const UINT16* p16BPPPalette)
{
	UINT8  *DestPtr, *ZPtr;
	UINT32 LineSkip;

	// Assertions
	Assert( hSrcVObject != NULL );
	Assert( pBuffer != NULL );

	// Get Offsets from Index into structure
	ETRLEObject const& pTrav = hSrcVObject->SubregionProperties(usIndex);
	UINT32          usHeight = pTrav.usHeight;
	UINT32    const usWidth  = pTrav.usWidth;

	// Add to start position of dest buffer
	INT32 const iTempX = iX + pTrav.sOffsetX;
	INT32 const iTempY = iY + pTrav.sOffsetY;

	// Validations
	CHECKV(iTempX >= 0);
	CHECKV(iTempY >= 0);

	UINT8 const* SrcPtr = hSrcVObject->PixData(pTrav);
	DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX*2);
	ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*iTempY) + (iTempX*2);
	LineSkip=(uiDestPitchBYTES-(usWidth*2));

	do
	{
		for (;;)
		{
			UINT8 data = *SrcPtr++;

			if (data == 0) break;
			if (data & 0x80)
			{
				data &= 0x7F;
				DestPtr += 2 * data;
			}
			else
			{
				do
				{
					UINT8 px = *SrcPtr++;

					if (px == 254)
					{
						if (*(UINT16*)ZPtr < usZValue)
						{
							*(UINT16*)DestPtr = ShadeTable[2 * (*(UINT16*)DestPtr)];
						}
					}
					else
					{
						if (*(UINT16*)ZPtr <= usZValue)
						{
							*(UINT16*)DestPtr = p16BPPPalette[2 * px];
						}
					}
					DestPtr += 2;
				}
				while (--data > 0);
			}
		}
		DestPtr += LineSkip;
	}
	while (--usHeight > 0);
}
/**********************************************************************************************
Blt8BPPDataTo16BPPBufferTransShadowZ

	Blits 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
	updated to the current value,	for any non-transparent pixels. If the source pixel is 254,
	it is considered a shadow, and the destination buffer is darkened rather than blitted on.
	The Z-buffer is 16 bit, and	must be the same dimensions (including Pitch) as the destination.

**********************************************************************************************/
Blt8BPPDataTo16BPPBufferTransShadowZ
Blits 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
updated to the current value,   for any non-transparent pixels. If the source pixel is 254,
it is considered a shadow, and the destination buffer is darkened rather than blitted on.
The Z-buffer is 16 bit, and     must be the same dimensions (including Pitch) as the destination.
Blt8BPPDataTo16BPPBufferTransShadowZ Blits 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 updated to the current value for any non - transparent pixels . If the source pixel is 254 it is considered a shadow and the destination buffer is darkened rather than blitted on . The Z - buffer is 16 bit and must be the same dimensions ( including Pitch ) as the destination .
void Blt8BPPDataTo16BPPBufferTransShadowZ(UINT16* pBuffer, UINT32 uiDestPitchBYTES, UINT16* pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, const UINT16* p16BPPPalette)
{
	UINT8  *DestPtr, *ZPtr;
	UINT32 LineSkip;
	Assert( hSrcVObject != NULL );
	Assert( pBuffer != NULL );
	ETRLEObject const& pTrav = hSrcVObject->SubregionProperties(usIndex);
	UINT32          usHeight = pTrav.usHeight;
	UINT32    const usWidth  = pTrav.usWidth;
	INT32 const iTempX = iX + pTrav.sOffsetX;
	INT32 const iTempY = iY + pTrav.sOffsetY;
	CHECKV(iTempX >= 0);
	CHECKV(iTempY >= 0);
	UINT8 const* SrcPtr = hSrcVObject->PixData(pTrav);
	DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX*2);
	ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*iTempY) + (iTempX*2);
	LineSkip=(uiDestPitchBYTES-(usWidth*2));
	do
	{
		for (;;)
		{
			UINT8 data = *SrcPtr++;
			if (data == 0) break;
			if (data & 0x80)
			{
				data &= 0x7F;
				DestPtr += 2 * data;
			}
			else
			{
				do
				{
					UINT8 px = *SrcPtr++;
					if (px == 254)
					{
						if (*(UINT16*)ZPtr < usZValue)
						{
							*(UINT16*)DestPtr = ShadeTable[2 * (*(UINT16*)DestPtr)];
						}
					}
					else
					{
						if (*(UINT16*)ZPtr <= usZValue)
						{
							*(UINT16*)DestPtr = p16BPPPalette[2 * px];
						}
					}
					DestPtr += 2;
				}
				while (--data > 0);
			}
		}
		DestPtr += LineSkip;
	}
	while (--usHeight > 0);
}
void Blt8BPPDataTo16BPPBufferTransShadowZ ( UINT16 * pBuffer , UINT32 uiDestPitchBYTES , UINT16 * pZBuffer , UINT16 usZValue , HVOBJECT hSrcVObject , INT32 iX , INT32 iY , UINT16 usIndex , const UINT16 * p16BPPPalette ) { UINT8 * DestPtr , * ZPtr ; UINT32 LineSkip ; Assert ( hSrcVObject != NULL ) ; Assert ( pBuffer != NULL ) ; ETRLEObject const & pTrav = hSrcVObject -> SubregionProperties ( usIndex ) ; UINT32 usHeight = pTrav . usHeight ; UINT32 const usWidth = pTrav . usWidth ; INT32 const iTempX = iX + pTrav . sOffsetX ; INT32 const iTempY = iY + pTrav . sOffsetY ; CHECKV ( iTempX >= 0 ) ; CHECKV ( iTempY >= 0 ) ; UINT8 const * SrcPtr = hSrcVObject -> PixData ( pTrav ) ; DestPtr = ( UINT8 * ) pBuffer + ( uiDestPitchBYTES * iTempY ) + ( iTempX * 2 ) ; ZPtr = ( UINT8 * ) pZBuffer + ( uiDestPitchBYTES * iTempY ) + ( iTempX * 2 ) ; LineSkip = ( uiDestPitchBYTES - ( usWidth * 2 ) ) ; do { for ( ; ; ) { UINT8 data = * SrcPtr ++ ; if ( data == 0 ) break ; if ( data & 0x80 ) { data &= 0x7F ; DestPtr += 2 * data ; } else { do { UINT8 px = * SrcPtr ++ ; if ( px == 254 ) { if ( * ( UINT16 * ) ZPtr < usZValue ) { * ( UINT16 * ) DestPtr = ShadeTable [ 2 * ( * ( UINT16 * ) DestPtr ) ] ; } } else { if ( * ( UINT16 * ) ZPtr <= usZValue ) { * ( UINT16 * ) DestPtr = p16BPPPalette [ 2 * px ] ; } } DestPtr += 2 ; } while ( -- data > 0 ) ; } } DestPtr += LineSkip ; } while ( -- usHeight > 0 ) ; }
Blt8BPPDataTo16BPPBufferTransShadowZ
Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit
buffer as a destination.
Blt8BPPDataTo16BPPBufferTransShadowZ Blits an image into the destination buffer using an ETRLE brush as a source and a 16 - bit buffer as a destination .
// Assertions // Get Offsets from Index into structure // Add to start position of dest buffer // Validations