diff --git a/Ja2/Fade Screen.cpp b/Ja2/Fade Screen.cpp index f201e7bd..2f44de73 100644 --- a/Ja2/Fade Screen.cpp +++ b/Ja2/Fade Screen.cpp @@ -681,13 +681,9 @@ BOOLEAN UpdateSaveBufferWithBackbuffer(void) pSrcBuf = LockVideoSurface(FRAME_BUFFER, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); - if(gbPixelDepth==16) - { - // BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0, 0, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ); UnLockVideoSurface(FRAME_BUFFER); UnLockVideoSurface(guiSAVEBUFFER); diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index f22cde56..ebff1280 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -9048,12 +9048,8 @@ void RenderMapHighlight( INT16 sMapX, INT16 sMapY, UINT16 usLineColor, BOOLEAN f // clip to view region ClipBlitsToMapViewRegionForRectangleAndABit( uiDestPitchBYTES ); - if(gbPixelDepth==16) - { - // DB Need to add a radar color for 8-bit - RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + UI_MAP.GridSize.iX, sScreenY + UI_MAP.GridSize.iY - 1, usLineColor, pDestBuf ); - InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + UI_MAP.GridSize.iX + 1 + 1, sScreenY + UI_MAP.GridSize.iY + 1 - 1 ); - } + RectangleDraw( TRUE, sScreenX, sScreenY - 1, sScreenX + UI_MAP.GridSize.iX, sScreenY + UI_MAP.GridSize.iY - 1, usLineColor, pDestBuf ); + InvalidateRegion( sScreenX, sScreenY - 2, sScreenX + UI_MAP.GridSize.iX + 1 + 1, sScreenY + UI_MAP.GridSize.iY + 1 - 1 ); RestoreClipRegionToFullScreenForRectangle( uiDestPitchBYTES ); UnLockVideoSurface( FRAME_BUFFER ); diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index cfa3098e..9d0c27db 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -461,14 +461,7 @@ BOOLEAN InitializeTacticalInterface( ) // failing the CHECKF after this will cause you to lose your mouse - if ( GETPIXELDEPTH() == 8 ) - { - strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT_8.pcx" ); - } - else if ( GETPIXELDEPTH() == 16 ) - { - strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT.STI" ); - } + strcpy( vs_desc.ImageFile, "INTERFACE\\IN_TEXT.STI" ); if( !AddVideoSurface( &vs_desc, &guiINTEXT ) ) AssertMsg( 0, "Missing INTERFACE\\In_text.sti"); @@ -3562,10 +3555,7 @@ void DrawBarsInUIBox( SOLDIERTYPE *pSoldier , INT16 sXPos, INT16 sYPos, INT16 sW } if ( pSoldier->ubID == gusSelectedSoldier ) { - if(gbPixelDepth==16) - RectangleDraw( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color16, pDestBuf); - else - RectangleDraw8( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color8, pDestBuf); + RectangleDraw( TRUE, sXPos+1, sYPos-1, sXPos+sWidth+3, sYPos+1+interval*3, color16, pDestBuf); } } @@ -5812,10 +5802,7 @@ void DrawBar( INT32 x, INT32 y, INT32 width, INT32 height, UINT16 color8, UINT16 { for( INT32 i=0; i < height; i++ ) { - if(gbPixelDepth==16) - LineDraw( TRUE, x, y+i, x+width-1, y+i, color16, pDestBuf ); - else if(gbPixelDepth==8) - LineDraw8( TRUE, x, y+i, x+width-1, y+i, color8, pDestBuf ); + LineDraw( TRUE, x, y+i, x+width-1, y+i, color16, pDestBuf ); } } } diff --git a/TileEngine/Radar Screen.cpp b/TileEngine/Radar Screen.cpp index c485d8ca..12877324 100644 --- a/TileEngine/Radar Screen.cpp +++ b/TileEngine/Radar Screen.cpp @@ -493,30 +493,21 @@ void RenderRadarScreen( ) if( !( guiTacticalInterfaceFlags & INTERFACE_MAPSCREEN ) ) { - if(gbPixelDepth==16) + // WANNE: Correct radar rectangle size if it is too large to fit in radar screen [2007-05-14] + if (fAllowRadarMovementHor == FALSE) { - // WANNE: Correct radar rectangle size if it is too large to fit in radar screen [2007-05-14] - if (fAllowRadarMovementHor == FALSE) - { - sRadarTLX = RADAR_WINDOW_TM_X; - sRadarBRX = RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH; - } - - if (fAllowRadarMovementVer == FALSE) - { - sRadarTLY = RADAR_WINDOW_TM_Y; - sRadarBRY = RADAR_WINDOW_TM_Y + RADAR_WINDOW_HEIGHT; - } - - usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); - RectangleDraw( TRUE, sRadarTLX, sRadarTLY, sRadarBRX, sRadarBRY - 1, usLineColor, pDestBuf ); + sRadarTLX = RADAR_WINDOW_TM_X; + sRadarBRX = RADAR_WINDOW_TM_X + RADAR_WINDOW_WIDTH; } - else if(gbPixelDepth==8) + + if (fAllowRadarMovementVer == FALSE) { - // DB Need to change this to a color from the 8-but standard palette - usLineColor = COLOR_GREEN; - RectangleDraw8( TRUE, sRadarTLX + 1, sRadarTLY + 1, sRadarBRX + 1, sRadarBRY + 1, usLineColor, pDestBuf ); + sRadarTLY = RADAR_WINDOW_TM_Y; + sRadarBRY = RADAR_WINDOW_TM_Y + RADAR_WINDOW_HEIGHT; } + + usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); + RectangleDraw( TRUE, sRadarTLX, sRadarTLY, sRadarBRX, sRadarBRY - 1, usLineColor, pDestBuf ); } // Cycle fFlash variable @@ -556,24 +547,20 @@ void RenderRadarScreen( ) sXSoldRadar += RADAR_WINDOW_TM_X; sYSoldRadar += gsRadarY; - // if we are in 16 bit mode....kind of redundant - if(gbPixelDepth==16) + if( ( fFlashHighLightInventoryItemOnradarMap ) ) { - if( ( fFlashHighLightInventoryItemOnradarMap ) ) - { - usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); + usLineColor = Get16BPPColor( FROMRGB( 0, 255, 0 ) ); - } - else - { - // DB Need to add a radar color for 8-bit - usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); - } + } + else + { + // DB Need to add a radar color for 8-bit + usLineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); + } - if( iCurrentlyHighLightedItem == iCounter ) - { - RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar + 1, sYSoldRadar + 1, usLineColor, pDestBuf ); - } + if( iCurrentlyHighLightedItem == iCounter ) + { + RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar + 1, sYSoldRadar + 1, usLineColor, pDestBuf ); } } } @@ -632,77 +619,67 @@ void RenderRadarScreen( ) sXSoldRadar += gsRadarX; sYSoldRadar += gsRadarY; - if(gbPixelDepth==16) - { - // DB Need to add a radar color for 8-bit - // Are we a selected guy? - if ( pSoldier->ubID == gusSelectedSoldier ) + // Are we a selected guy? + if ( pSoldier->ubID == gusSelectedSoldier ) + { + if ( gfRadarCurrentGuyFlash ) { - if ( gfRadarCurrentGuyFlash ) - { - usLineColor = 0; - } - else - { - // If on roof, make darker.... - if ( pSoldier->pathing.bLevel > 0 ) - { - usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); - } - else - { - usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); - } - } + usLineColor = 0; } else { - usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); - - if ( pSoldier->bTeam == CIV_TEAM ) - { - // Override civ team with red if hostile... - if ( pSoldier->bSide != gbPlayerNum && !pSoldier->aiData.bNeutral ) - usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); - // if uncovered, different colour (so the player doesn't have to search for us) - else if ( gGameExternalOptions.fKnownNPCsUseDifferentColour && pSoldier->ubProfile != NO_PROFILE && !zHiddenNames[pSoldier->ubProfile].Hidden ) - usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); - } - - // Flugente 18-04-15: observed an odd bug: if we play with a release build and see a creature for the first time, their overhead/radar map pins do not have the correct colour. - // Bizarrely enough, the issue seems dependent on the colour value (pink, RGB: 255/0/255) itself. - // Saving and reloading solves the issue, but I am not sure why. As a fix we now use a slightly dampened pink. - if ( pSoldier->bTeam == CREATURE_TEAM ) - { - usLineColor = Get16BPPColor( FROMRGB( 247, 0, 247 ) ); - } - - // Flugente: if we are a (still covert) enemy assassin, colour us like militia, so that the player wont notice us - if ( pSoldier->usSoldierFlagMask & SOLDIER_ASSASSIN && pSoldier->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER ) - usLineColor = Get16BPPColor( gTacticalStatus.Team[ MILITIA_TEAM ].RadarColor ); - - // Render different color if an enemy and he's unconscious - if ( pSoldier->bTeam != gbPlayerNum && pSoldier->stats.bLife < OKLIFE ) - { - usLineColor = Get16BPPColor( FROMRGB( 128, 128, 128 ) ); - } - // If on roof, make darker.... - if ( pSoldier->bTeam == gbPlayerNum && pSoldier->pathing.bLevel > 0 ) + if ( pSoldier->pathing.bLevel > 0 ) { usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); } + else + { + usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); + } + } + } + else + { + usLineColor = Get16BPPColor( gTacticalStatus.Team[ pSoldier->bTeam ].RadarColor ); + + if ( pSoldier->bTeam == CIV_TEAM ) + { + // Override civ team with red if hostile... + if ( pSoldier->bSide != gbPlayerNum && !pSoldier->aiData.bNeutral ) + usLineColor = Get16BPPColor( FROMRGB( 255, 0, 0 ) ); + // if uncovered, different colour (so the player doesn't have to search for us) + else if ( gGameExternalOptions.fKnownNPCsUseDifferentColour && pSoldier->ubProfile != NO_PROFILE && !zHiddenNames[pSoldier->ubProfile].Hidden ) + usLineColor = Get16BPPColor( FROMRGB( 0, 0, 255 ) ); } - RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); - } - else if(gbPixelDepth==8) - { - // DB Need to change this to a color from the 8-but standard palette - usLineColor = COLOR_BLUE; - RectangleDraw8( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); + // Flugente 18-04-15: observed an odd bug: if we play with a release build and see a creature for the first time, their overhead/radar map pins do not have the correct colour. + // Bizarrely enough, the issue seems dependent on the colour value (pink, RGB: 255/0/255) itself. + // Saving and reloading solves the issue, but I am not sure why. As a fix we now use a slightly dampened pink. + if ( pSoldier->bTeam == CREATURE_TEAM ) + { + usLineColor = Get16BPPColor( FROMRGB( 247, 0, 247 ) ); + } + + // Flugente: if we are a (still covert) enemy assassin, colour us like militia, so that the player wont notice us + if ( pSoldier->usSoldierFlagMask & SOLDIER_ASSASSIN && pSoldier->usSoldierFlagMask & SOLDIER_COVERT_SOLDIER ) + usLineColor = Get16BPPColor( gTacticalStatus.Team[ MILITIA_TEAM ].RadarColor ); + + // Render different color if an enemy and he's unconscious + if ( pSoldier->bTeam != gbPlayerNum && pSoldier->stats.bLife < OKLIFE ) + { + usLineColor = Get16BPPColor( FROMRGB( 128, 128, 128 ) ); + } + + // If on roof, make darker.... + if ( pSoldier->bTeam == gbPlayerNum && pSoldier->pathing.bLevel > 0 ) + { + usLineColor = Get16BPPColor( FROMRGB( 150, 150, 0 ) ); + } } + + RectangleDraw( TRUE, sXSoldRadar, sYSoldRadar, sXSoldRadar+1, sYSoldRadar+1, usLineColor, pDestBuf ); } } } diff --git a/TileEngine/Render Dirty.cpp b/TileEngine/Render Dirty.cpp index 1e22feb6..8fb82dad 100644 --- a/TileEngine/Render Dirty.cpp +++ b/TileEngine/Render Dirty.cpp @@ -604,20 +604,9 @@ BOOLEAN UpdateSaveBuffer(void) pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); - if(gbPixelDepth==16) - { - // BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, ( gsVIEWPORT_WINDOW_END_Y - gsVIEWPORT_WINDOW_START_Y ) ); - } - else if(gbPixelDepth==8) - { - // BLIT HERE - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, gsVIEWPORT_WINDOW_END_Y ); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + 0, gsVIEWPORT_WINDOW_START_Y, 0, gsVIEWPORT_WINDOW_START_Y, usWidth, ( gsVIEWPORT_WINDOW_END_Y - gsVIEWPORT_WINDOW_START_Y ) ); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); @@ -643,22 +632,11 @@ BOOLEAN RestoreExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT1 pDestBuf = LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface(guiSAVEBUFFER, &uiSrcPitchBYTES); - if(gbPixelDepth==16) - { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } - else if(gbPixelDepth==8) - { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, + sWidth, sHeight); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); @@ -695,22 +673,11 @@ BOOLEAN RestoreExternBackgroundRectGivenID( INT32 iBack ) pDestBuf = LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface(guiSAVEBUFFER, &uiSrcPitchBYTES); - if(gbPixelDepth==16) - { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } - else if(gbPixelDepth==8) - { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, + sWidth, sHeight); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); @@ -730,22 +697,11 @@ BOOLEAN CopyExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 s pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES); - if(gbPixelDepth==16) - { - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } - else if(gbPixelDepth==8) - { - Blt8BPPTo8BPP(pDestBuf, uiDestPitchBYTES, - pSrcBuf, uiSrcPitchBYTES, - sLeft , sTop, - sLeft , sTop, - sWidth, sHeight); - } + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)pSrcBuf, uiSrcPitchBYTES, + sLeft , sTop, + sLeft , sTop, + sWidth, sHeight); UnLockVideoSurface(guiSAVEBUFFER); UnLockVideoSurface(guiRENDERBUFFER); @@ -1342,18 +1298,11 @@ BOOLEAN RestoreShiftedVideoOverlays( INT16 sShiftX, INT16 sShiftY ) usHeight = sBottom - sTop; usWidth = sRight - sLeft; - if(gbPixelDepth==16) - { - - Blt16BPPTo16BPP((UINT16 *)(UINT16 *)pDestBuf, uiDestPitchBYTES, - (UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2, - sLeft, sTop, - uiLeftSkip, uiTopSkip, - usWidth, usHeight ); - } - else if(gbPixelDepth==8) - { - } + Blt16BPPTo16BPP((UINT16 *)(UINT16 *)pDestBuf, uiDestPitchBYTES, + (UINT16 *)gVideoOverlays[uiCount].pSaveArea, gBackSaves[ iBackIndex ].sWidth*2, + sLeft, sTop, + uiLeftSkip, uiTopSkip, + usWidth, usHeight ); // Once done, check for pending deletion if ( gVideoOverlays[uiCount].fDeletionPending ) diff --git a/TileEngine/overhead map.cpp b/TileEngine/overhead map.cpp index 313161c1..b2f7e8e7 100644 --- a/TileEngine/overhead map.cpp +++ b/TileEngine/overhead map.cpp @@ -1367,8 +1367,7 @@ void RenderOverheadMap( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStart GetCurrentVideoSettings(&usWidth, &usHeight, &ubBitDepth); pSrcBuf = LockVideoSurface(guiRENDERBUFFER, &uiSrcPitchBYTES); pDestBuf = LockVideoSurface(guiSAVEBUFFER, &uiDestPitchBYTES); - if(gbPixelDepth == 16)// BLIT HERE - Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0, 0, 0, 0, usWidth, usHeight); + Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES, (UINT16 *)pSrcBuf, uiSrcPitchBYTES, 0, 0, 0, 0, usWidth, usHeight); UnLockVideoSurface(guiRENDERBUFFER); UnLockVideoSurface(guiSAVEBUFFER); } diff --git a/TileEngine/renderworld.cpp b/TileEngine/renderworld.cpp index 85eb7bd9..ce88dc76 100644 --- a/TileEngine/renderworld.cpp +++ b/TileEngine/renderworld.cpp @@ -2398,617 +2398,528 @@ void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT } else { - if (gbPixelDepth == 16) + /*if(fConvertTo16) { - /*if(fConvertTo16) + ConvertVObjectRegionTo16BPP(hVObject, usImageIndex, 4); + if(CheckFor16BPPRegion(hVObject, usImageIndex, 4, &us16BPPIndex)) { - ConvertVObjectRegionTo16BPP(hVObject, usImageIndex, 4); - if(CheckFor16BPPRegion(hVObject, usImageIndex, 4, &us16BPPIndex)) - { - Blt16BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, us16BPPIndex, &gClippingRect); - } - }*/ - - if (fMultiTransShadowZBlitter) - { - if (fZBlitter) - { - if (fObscuredBlitter) - { - if (hVObjectAlpha == NULL) { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - else { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - } - else - { - if (hVObjectAlpha == NULL) { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - else { - Blt8BPPDataTo16BPPBufferTransZTransShadowIncClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); - } - } - } - else - { - //Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect ); - } + Blt16BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, us16BPPIndex, &gClippingRect); } - else if (fMultiZBlitter) + }*/ + + if (fMultiTransShadowZBlitter) + { + if (fZBlitter) { - if (fZBlitter) + if (fObscuredBlitter) { - if (fObscuredBlitter) - { - Blt8BPPDataTo16BPPBufferTransZIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + if (hVObjectAlpha == NULL) { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); } - else - { - if (fWallTile) - { - if (sZStripIndex == -1) - { - Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sZStripIndex); - } - } - else - { - Blt8BPPDataTo16BPPBufferTransZIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } + else { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); } } else { - Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + if (hVObjectAlpha == NULL) { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); + } + else { + Blt8BPPDataTo16BPPBufferTransZTransShadowIncClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, hVObjectAlpha, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable, fIgnoreShadows); + } } } else { - bBlitClipVal = BltIsClippedOrOffScreen(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - if (bBlitClipVal == TRUE) - { - if (fPixelate) - { - if (fTranslucencyType) - { - //if(fZWrite) - // Blt8BPPDataTo16BPPBufferTransZClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - //else - Blt8BPPDataTo16BPPBufferTransZNBClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - //if(fZWrite) - // Blt8BPPDataTo16BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - //else - Blt8BPPDataTo16BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else if (fMerc) - { - if (fZBlitter) - { - if (fZWrite) - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (fObscuredBlitter) - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZNBClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - } - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - - UnLockVideoSurface(guiSAVEBUFFER); - - // Turn it off! - pNode->uiFlags &= (~LEVELNODE_UPDATESAVEBUFFERONCE); - } - - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable, - fIgnoreShadows); - } - } - } - else if (fShadowBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - Blt8BPPDataTo16BPPBufferShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else if (fIntensityBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - Blt8BPPDataTo16BPPBufferIntensityClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else if (fZBlitter) - { - if (fZWrite) - { - if (fObscuredBlitter) - { - Blt8BPPDataTo16BPPBufferTransZClipPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else - { - Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - } - else - { - Blt8BPPDataTo16BPPBufferTransZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - UnLockVideoSurface(guiSAVEBUFFER); - } - - } - else - Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - } - else if (bBlitClipVal == FALSE) - { - if (fPixelate) - { - if (fTranslucencyType) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferTransZTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferTransZNBTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferTransZPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferTransZNBPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - } - else if (fMerc) - { - // Flugente: draw riot shield UNDER the soldier - if ( pSoldier && - pSoldier->bVisible != -1 && - ( pSoldier->ubDirection == NORTH || - pSoldier->ubDirection == NORTHWEST || - pSoldier->ubDirection == WEST ) - && pSoldier->IsRiotShieldEquipped() ) - { - ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); - } - - if (fZBlitter) - { - if (fZWrite) - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (fObscuredBlitter) - { - if (hVObjectAlpha != NULL) { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowZNBAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - } - } - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - - UnLockVideoSurface(guiSAVEBUFFER); - - } - - } - else - { - if (hVObjectAlpha != NULL) - { - Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - else - { - Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pDestBuf, uiDestPitchBYTES, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); - } - - } - - // Flugente: draw riot shield OVER the soldier - if ( pSoldier && - pSoldier->bVisible != -1 && - ( pSoldier->ubDirection == EAST || - pSoldier->ubDirection == SOUTHEAST || - pSoldier->ubDirection == SOUTH || - pSoldier->ubDirection == SOUTHWEST || - pSoldier->ubDirection == NORTHEAST ) - && pSoldier->IsRiotShieldEquipped() ) - { - ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); - } - } - else if (fShadowBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferShadow((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); - } - } - else if (fIntensityBlitter) - { - if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo16BPPBufferIntensityZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - else - Blt8BPPDataTo16BPPBufferIntensityZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferIntensity((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); - } - } - else if (fZBlitter) - { - if (fZWrite) - { - // TEST - //Blt8BPPDataTo16BPPBufferTransZPixelate( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - - if (fObscuredBlitter) - { - Blt8BPPDataTo16BPPBufferTransZPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - else - { - Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - } - } - else - Blt8BPPDataTo16BPPBufferTransZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - - - if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) - { - pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); - - // BLIT HERE - Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); - - UnLockVideoSurface(guiSAVEBUFFER); - } - - } - else - Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); - } + //Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect ); } } - else // 8bpp section + else if (fMultiZBlitter) { - if (fPixelate) + if (fZBlitter) { - if (fZWrite) - Blt8BPPDataTo8BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo8BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - } - else if (BltIsClipped(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect)) - { - if (fMerc) + if (fObscuredBlitter) { - Blt8BPPDataTo8BPPBufferTransShadowZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - &gClippingRect, - pShadeTable); - } - else if (fShadowBlitter) - if (fZWrite) - Blt8BPPDataTo8BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo8BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - - else if (fZBlitter) - { - if (fZWrite) - Blt8BPPDataTo8BPPBufferTransZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - else - Blt8BPPDataTo8BPPBufferTransZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + Blt8BPPDataTo16BPPBufferTransZIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + { + if (fWallTile) + { + if (sZStripIndex == -1) + { + Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sZStripIndex); + } + } + else + { + Blt8BPPDataTo16BPPBufferTransZIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } } else { - if (fMerc) - { + Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } + else + { + bBlitClipVal = BltIsClippedOrOffScreen(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); - // why to 16BPP here?? - if (hVObjectAlpha != NULL) + if (bBlitClipVal == TRUE) + { + if (fPixelate) + { + if (fTranslucencyType) { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - hVObjectAlpha, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); + //if(fZWrite) + // Blt8BPPDataTo16BPPBufferTransZClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + //else + Blt8BPPDataTo16BPPBufferTransZNBClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else { - Blt8BPPDataTo16BPPBufferTransShadowZNBObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - hVObject, - sXPos, sYPos, - usImageIndex, - pShadeTable, - fIgnoreShadows); + //if(fZWrite) + // Blt8BPPDataTo16BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + //else + Blt8BPPDataTo16BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } + } + else if (fMerc) + { + if (fZBlitter) + { + if (fZWrite) + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (fObscuredBlitter) + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZNBClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } + } - // Blt8BPPDataTo8BPPBufferTransShadowZNB( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, - // hVObject, - // sXPos, sYPos, - // usImageIndex, - // pShadeTable); + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + + UnLockVideoSurface(guiSAVEBUFFER); + + // Turn it off! + pNode->uiFlags &= (~LEVELNODE_UPDATESAVEBUFFERONCE); + } + + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowClipAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + &gClippingRect, + pShadeTable, + fIgnoreShadows); + } + } } else if (fShadowBlitter) { - if (fZWrite) - Blt8BPPDataTo8BPPBufferShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + else + Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } else - Blt8BPPDataTo8BPPBufferShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + { + Blt8BPPDataTo16BPPBufferShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } + else if (fIntensityBlitter) + { + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + else + Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + else + { + Blt8BPPDataTo16BPPBufferIntensityClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } } else if (fZBlitter) { if (fZWrite) - Blt8BPPDataTo8BPPBufferTransZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + { + if (fObscuredBlitter) + { + Blt8BPPDataTo16BPPBufferTransZClipPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + else + { + Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + } else - Blt8BPPDataTo8BPPBufferTransZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + { + Blt8BPPDataTo16BPPBufferTransZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + } + + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + + UnLockVideoSurface(guiSAVEBUFFER); + } + } else - Blt8BPPDataTo8BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); + Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); + + } + else if (bBlitClipVal == FALSE) + { + if (fPixelate) + { + if (fTranslucencyType) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferTransZTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferTransZNBTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferTransZPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferTransZNBPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + } + else if (fMerc) + { + // Flugente: draw riot shield UNDER the soldier + if ( pSoldier && + pSoldier->bVisible != -1 && + ( pSoldier->ubDirection == NORTH || + pSoldier->ubDirection == NORTHWEST || + pSoldier->ubDirection == WEST ) + && pSoldier->IsRiotShieldEquipped() ) + { + ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); + } + + if (fZBlitter) + { + if (fZWrite) + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (fObscuredBlitter) + { + if (hVObjectAlpha != NULL) { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else { + Blt8BPPDataTo16BPPBufferTransShadowZNBObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowZNBAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + } + } + + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + + UnLockVideoSurface(guiSAVEBUFFER); + + } + + } + else + { + if (hVObjectAlpha != NULL) + { + Blt8BPPDataTo16BPPBufferTransShadowAlpha((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + hVObjectAlpha, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + else + { + Blt8BPPDataTo16BPPBufferTransShadow((UINT16*)pDestBuf, uiDestPitchBYTES, + hVObject, + sXPos, sYPos, + usImageIndex, + pShadeTable, + fIgnoreShadows); + } + + } + + // Flugente: draw riot shield OVER the soldier + if ( pSoldier && + pSoldier->bVisible != -1 && + ( pSoldier->ubDirection == EAST || + pSoldier->ubDirection == SOUTHEAST || + pSoldier->ubDirection == SOUTH || + pSoldier->ubDirection == SOUTHWEST || + pSoldier->ubDirection == NORTHEAST ) + && pSoldier->IsRiotShieldEquipped() ) + { + ShowRiotShield( pSoldier, (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel ); + } + } + else if (fShadowBlitter) + { + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferShadow((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); + } + } + else if (fIntensityBlitter) + { + if (fZBlitter) + { + if (fZWrite) + Blt8BPPDataTo16BPPBufferIntensityZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + else + Blt8BPPDataTo16BPPBufferIntensityZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferIntensity((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); + } + } + else if (fZBlitter) + { + if (fZWrite) + { + // TEST + //Blt8BPPDataTo16BPPBufferTransZPixelate( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + + if (fObscuredBlitter) + { + Blt8BPPDataTo16BPPBufferTransZPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + else + { + Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + } + } + else + Blt8BPPDataTo16BPPBufferTransZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + + + if ((uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE)) + { + pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES); + + // BLIT HERE + Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); + + UnLockVideoSurface(guiSAVEBUFFER); + } + + } + else + Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); } } diff --git a/Utils/Utilities.cpp b/Utils/Utilities.cpp index a2634b5f..f8ed4476 100644 --- a/Utils/Utilities.cpp +++ b/Utils/Utilities.cpp @@ -15,8 +15,6 @@ extern BOOLEAN GetCDromDriveLetter( STR8 pString ); -#define DATA_8_BIT_DIR "8-Bit\\" - BOOLEAN PerformTimeLimitedCheck(); // WANNE: Given a string, replaces all instances of "oldpiece" with "newpiece" @@ -97,26 +95,7 @@ BOOLEAN PerformTimeLimitedCheck(); //#define TIME_LIMITED_VERSION void FilenameForBPP(STR pFilename, STR pDestination) { -CHAR8 Drive[128], Dir[128], Name[128], Ext[128]; - - if(GETPIXELDEPTH()==16) - { - // no processing for 16 bit names - strcpy(pDestination, pFilename); - } - else - { - _splitpath(pFilename, Drive, Dir, Name, Ext); - - strcat(Name, "_8"); - - strcpy(pDestination, Drive); - //strcat(pDestination, Dir); - strcat(pDestination, DATA_8_BIT_DIR); - strcat(pDestination, Name); - strcat(pDestination, Ext); - } - + strcpy(pDestination, pFilename); } BOOLEAN CreateSGPPaletteFromCOLFile( SGPPaletteEntry *pPalette, SGPFILENAME ColFile ) diff --git a/Utils/Utilities.h b/Utils/Utilities.h index 3ffc30e0..d0d5dda0 100644 --- a/Utils/Utilities.h +++ b/Utils/Utilities.h @@ -5,8 +5,6 @@ #include "sgp.h" -#define GETPIXELDEPTH( ) ( gbPixelDepth ) - // WANNE: Maximum number of characters in german description (German xml files) #define MAXLINE 200 diff --git a/ext/export/src/export/sti/stci_image_utils.h b/ext/export/src/export/sti/stci_image_utils.h index 38c6e7a1..258baec7 100644 --- a/ext/export/src/export/sti/stci_image_utils.h +++ b/ext/export/src/export/sti/stci_image_utils.h @@ -42,10 +42,5 @@ namespace ja2xp UINT32 UnpackETRLEImageToBuffer(UINT8 *pBuffer, image_type *pImage, UINT16 ueETRLEIndex); UINT32 UnpackETRLEImageToRGBABuffer(UINT8 *pBuffer, image_type *pImage, UINT16 ueETRLEIndex); - /** - * NOTE: implemented in msvc inline assembler - * does not work with gcc -> use 'UnpackETRLEImageToBuffer' - */ - BOOLEAN Blt8BPPDataTo8BPPBuffer( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, image_type *hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); }; #endif // _STCI_IMAGE_UTILS_H_ diff --git a/sgp/Button System.cpp b/sgp/Button System.cpp index dd3d5b04..9ccc6bc3 100644 --- a/sgp/Button System.cpp +++ b/sgp/Button System.cpp @@ -794,10 +794,7 @@ BOOLEAN InitializeButtonImageManager(INT32 DefaultBuffer, INT32 DefaultPitch, IN return(FALSE); } - if(GETPIXELDEPTH()==16) - GenericButtonFillColors[0]=GenericButtonOffNormal[0]->p16BPPPalette[Pix]; - else if(GETPIXELDEPTH()==8) - GenericButtonFillColors[0]=COLOR_DKGREY; + GenericButtonFillColors[0]=GenericButtonOffNormal[0]->p16BPPPalette[Pix]; return(TRUE); } @@ -3689,145 +3686,63 @@ void DrawGenericButton(GUI_BUTTON *b) else ImgNum=1; - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - (INT32)b->YLoc, - (UINT16)ImgNum, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - (INT32)b->YLoc, - (UINT16)ImgNum, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)(b->XLoc + (q*iBorderWidth)), + (INT32)b->YLoc, + (UINT16)ImgNum, &ClipRect ); if(q==0) ImgNum=5; else ImgNum=6; - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - cy, (UINT16)ImgNum, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)(b->XLoc + (q*iBorderWidth)), - cy, (UINT16)ImgNum, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)(b->XLoc + (q*iBorderWidth)), + cy, (UINT16)ImgNum, &ClipRect ); } // Blit the right side corners - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)b->YLoc, - 2, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)b->YLoc, - 2, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)b->YLoc, + 2, &ClipRect ); - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, cy, 7, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, cy, 7, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, cy, 7, &ClipRect ); // Draw the vertical members of the button's borders NumChunksHigh--; if(hremain!=0) { q=NumChunksHigh; - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)b->XLoc, - (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 3, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)b->XLoc, - (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 3, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)b->XLoc, + (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), + 3, &ClipRect ); - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 4, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), - 4, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)(b->YLoc + (q*iBorderHeight) - (iBorderHeight-hremain)), + 4, &ClipRect ); } for(q=1;qXLoc, - (INT32)(b->YLoc + (q*iBorderHeight)), - 3, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - (INT32)b->XLoc, - (INT32)(b->YLoc + (q*iBorderHeight)), - 3, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + (INT32)b->XLoc, + (INT32)(b->YLoc + (q*iBorderHeight)), + 3, &ClipRect ); - if(gbPixelDepth==16) - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight)), - 4, &ClipRect ); - } - else if(gbPixelDepth==8) - { - Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, - uiDestPitchBYTES, BPic, - cx, (INT32)(b->YLoc + (q*iBorderHeight)), - 4, &ClipRect ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, + uiDestPitchBYTES, BPic, + cx, (INT32)(b->YLoc + (q*iBorderHeight)), + 4, &ClipRect ); } // Unlock buffer diff --git a/sgp/Font.cpp b/sgp/Font.cpp index 5caa433b..d853c542 100644 --- a/sgp/Font.cpp +++ b/sgp/Font.cpp @@ -1042,15 +1042,7 @@ UINT8 *pDestBuf; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1156,15 +1148,7 @@ UINT8 *pDestBuf; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } - else - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1214,15 +1198,7 @@ UINT8 *pDestBuf; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } - else - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1271,15 +1247,7 @@ CHAR16 string[512]; desty+=GetHeight(FontObjs[FontType], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } - else - { - Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); - } + Blt8BPPDataTo16BPPBufferTransparentClip( (UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion ); destx+=GetWidth(FontObjs[FontType], transletter); } @@ -1323,15 +1291,7 @@ CHAR16 string[512]; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1390,15 +1350,7 @@ UINT16 usOldForeColor; desty+=GetHeight(FontObjs[FontDefault], transletter); } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } @@ -1469,15 +1421,7 @@ UINT8 *pDestBuf; return 0; } - // Blit directly - if ( gbPixelDepth == 8 ) - { - Blt8BPPDataTo8BPPBufferMonoShadowClip(pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground8, FontBackground8); - } - else - { - Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); - } + Blt8BPPDataTo16BPPBufferMonoShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, FontObjs[FontDefault], destx, desty, transletter, &FontDestRegion, FontForeground16, FontBackground16, FontShadow16 ); destx+=GetWidth(FontObjs[FontDefault], transletter); } diff --git a/sgp/line.cpp b/sgp/line.cpp index 76c344f7..b96a7cc1 100644 --- a/sgp/line.cpp +++ b/sgp/line.cpp @@ -30,11 +30,6 @@ void DrawHorizontalRun(UINT8 **ScreenPtr, int XAdvance, int RunLength, void DrawVerticalRun(UINT8 **ScreenPtr, int XAdvance, int RunLength, int Color, int ScreenWidth); -void DrawHorizontalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth); -void DrawVerticalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth); - void SetClippingRegionAndImageWidth( int iImageWidth, @@ -426,258 +421,3 @@ void RectangleDraw( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, shor LineDraw( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr); LineDraw( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr); } - -/*********************************************************************************** -* 8-Bit Versions -* -* -* -* Added by Derek Beland -***********************************************************************************/ - -/* Draws a rectangle between the specified endpoints in color Color. */ -void RectangleDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Color, UINT8 *ScreenPtr) -{ - LineDraw8( fClip, XStart, YStart, XEnd, YStart, Color, ScreenPtr); - LineDraw8( fClip, XStart, YEnd, XEnd, YEnd, Color, ScreenPtr); - LineDraw8( fClip, XStart, YStart, XStart, YEnd, Color, ScreenPtr); - LineDraw8( fClip, XEnd, YStart, XEnd, YEnd, Color, ScreenPtr); -} - -/* Draws a line between the specified endpoints in color Color. */ -void LineDraw8( BOOL fClip, int XStart, int YStart, int XEnd, int YEnd, short Color, UINT8 *ScreenPtr) -{ - int Temp, AdjUp, AdjDown, ErrorTerm, XAdvance, XDelta, YDelta; - int WholeStep, InitialPixelCount, FinalPixelCount, i, RunLength; - int ScreenWidth = giImageWidth; - UINT8 col1 = Color & 0x00FF; - - if ( fClip ) - { - if ( !Clip2D( &XStart, &YStart, &XEnd, &YEnd ) ) - return; - } - - /* We'll always draw top to bottom, to reduce the number of cases we have to - handle, and to make lines between the same endpoints draw the same pixels */ - if (YStart > YEnd) { - Temp = YStart; - YStart = YEnd; - YEnd = Temp; - Temp = XStart; - XStart = XEnd; - XEnd = Temp; - } - - // point to the bitmap address first pixel to draw - ScreenPtr = ScreenPtr + YStart*giImageWidth + XStart; - - /* Figure out whether we're going left or right, and how far we're - going horizontally */ - if ((XDelta = XEnd - XStart) < 0) - { - XAdvance = -1; - XDelta = -XDelta; - } - else - { - XAdvance = 1; - } - /* Figure out how far we're going vertically */ - YDelta = YEnd - YStart; - - /* Special-case horizontal, vertical, and diagonal lines, for speed - and to avoid nasty boundary conditions and division by 0 */ - if (XDelta == 0) - { - /* Vertical line */ - for (i=0; i<=YDelta; i++) - { - *ScreenPtr = col1; - ScreenPtr += giImageWidth; - } - return; - } - if (YDelta == 0) - { - /* Horizontal line */ - for (i=0; i<=XDelta; i++) - { - *ScreenPtr = col1; - ScreenPtr += XAdvance; - } - return; - } - if (XDelta == YDelta) - { - /* Diagonal line */ - for (i=0; i<=XDelta; i++) - { - *ScreenPtr = col1; - ScreenPtr += (XAdvance + giImageWidth); - } - return; - } - - /* Determine whether the line is X or Y major, and handle accordingly */ - if (XDelta >= YDelta) - { - /* X major line */ - /* Minimum # of pixels in a run in this line */ - WholeStep = XDelta / YDelta; - - /* Error term adjust each time Y steps by 1; used to tell when one - extra pixel should be drawn as part of a run, to account for - fractional steps along the X axis per 1-pixel steps along Y */ - AdjUp = (XDelta % YDelta) * 2; - - /* Error term adjust when the error term turns over, used to factor - out the X step made at that time */ - AdjDown = YDelta * 2; - - /* Initial error term; reflects an initial step of 0.5 along the Y - axis */ - ErrorTerm = (XDelta % YDelta) - (YDelta * 2); - - /* The initial and last runs are partial, because Y advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - InitialPixelCount = (WholeStep / 2) + 1; - FinalPixelCount = InitialPixelCount; - - /* If the basic run length is even and there's no fractional - advance, we have one pixel that could go to either the initial - or last partial run, which we'll arbitrarily allocate to the - last run */ - if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) - { - InitialPixelCount--; - } - /* If there're an odd number of pixels per run, we have 1 pixel that can't - be allocated to either the initial or last partial run, so we'll add 0.5 - to error term so this pixel will be handled by the normal full-run loop */ - if ((WholeStep & 0x01) != 0) - { - ErrorTerm += YDelta; - } - /* Draw the first, partial run of pixels */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); - /* Draw all full runs */ - for (i=0; i<(YDelta-1); i++) - { - RunLength = WholeStep; /* run is at least this long */ - /* Advance the error term and add an extra pixel if the error - term so indicates */ - if ((ErrorTerm += AdjUp) > 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); - } - /* Draw the final run of pixels */ - DrawHorizontalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); - return; - } - else - { - /* Y major line */ - - /* Minimum # of pixels in a run in this line */ - WholeStep = YDelta / XDelta; - - /* Error term adjust each time X steps by 1; used to tell when 1 extra - pixel should be drawn as part of a run, to account for - fractional steps along the Y axis per 1-pixel steps along X */ - AdjUp = (YDelta % XDelta) * 2; - - /* Error term adjust when the error term turns over, used to factor - out the Y step made at that time */ - AdjDown = XDelta * 2; - - /* Initial error term; reflects initial step of 0.5 along the X axis */ - ErrorTerm = (YDelta % XDelta) - (XDelta * 2); - - /* The initial and last runs are partial, because X advances only 0.5 - for these runs, rather than 1. Divide one full run, plus the - initial pixel, between the initial and last runs */ - InitialPixelCount = (WholeStep / 2) + 1; - FinalPixelCount = InitialPixelCount; - - /* If the basic run length is even and there's no fractional advance, we - have 1 pixel that could go to either the initial or last partial run, - which we'll arbitrarily allocate to the last run */ - if ((AdjUp == 0) && ((WholeStep & 0x01) == 0)) - { - InitialPixelCount--; - } - /* If there are an odd number of pixels per run, we have one pixel - that can't be allocated to either the initial or last partial - run, so we'll add 0.5 to the error term so this pixel will be - handled by the normal full-run loop */ - if ((WholeStep & 0x01) != 0) - { - ErrorTerm += XDelta; - } - /* Draw the first, partial run of pixels */ - DrawVerticalRun8(&ScreenPtr, XAdvance, InitialPixelCount, Color, ScreenWidth); - - /* Draw all full runs */ - for (i=0; i<(XDelta-1); i++) - { - RunLength = WholeStep; /* run is at least this long */ - /* Advance the error term and add an extra pixel if the error - term so indicates */ - if ((ErrorTerm += AdjUp) > 0) - { - RunLength++; - ErrorTerm -= AdjDown; /* reset the error term */ - } - /* Draw this scan line's run */ - DrawVerticalRun8(&ScreenPtr, XAdvance, RunLength, Color, ScreenWidth); - } - /* Draw the final run of pixels */ - DrawVerticalRun8(&ScreenPtr, XAdvance, FinalPixelCount, Color, ScreenWidth); - return; - } -} - - -/* Draws a horizontal run of pixels, then advances the bitmap pointer to - the first pixel of the next run. */ -void DrawHorizontalRun8(UINT8 **ScreenPtr, int XAdvance, - int RunLength, int Color, int ScreenWidth) -{ - int i; - UINT8 *WorkingScreenPtr = *ScreenPtr; - UINT8 col1 = Color & 0x00FF; - - for (i=0; ipETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - usZLevel=usZValue; -// usZLinesToGo=WORLD_TILE_Y; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZLevel - ja BlitNTL2 - - mov ax, usZLevel - mov [ebx], ax - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - // check for incrementing of z level - dec usZLinesToGo - jnz RSLoop2 - -// mov ax, usZLevel -// add ax, Z_SUBLEVELS -// mov usZLevel, ax - -// mov ax, WORLD_TILE_Y -// mov usZLinesToGo, ax - -RSLoop2: - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - /********************************************************************************************** InitZBuffer @@ -1953,4911 +1676,6 @@ BZR1: - - -//***************************************************************************** -//** 8 Bit Blitters -//** -//***************************************************************************** - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBuffer - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBuffer( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - static UINT32 uiOffset; - static UINT32 usHeight, usWidth; - static UINT8 *SrcPtr, *DestPtr; - static UINT32 LineSkip; - static ETRLEObject *pTrav; - static INT32 iTempX, iTempY; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - LineSkip=(uiDestPitchBYTES-(usWidth)); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - xor ebx, ebx - xor ecx, ecx - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - clc - rcr cl, 1 - jnc BlitNTL2 - - movsb - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - movsw - -BlitNTL3: - - or cl, cl - jz BlitDispatch - - xor ebx, ebx - -//BlitNTL4: - - rep movsd - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - xor al, al - rep stosb - - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferMonoShadow - - Uses a bitmap an 8BPP template for blitting. Anywhere a 1 appears in the bitmap, a shadow - is blitted to the destination (a black pixel). Any other value above zero is considered a - forground color, and zero is background. If the parameter for the background color is zero, - transparency is used for the background. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferMonoShadow( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT8 ubForeground, UINT8 ubBackground) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov al, [esi] - cmp al, 1 - jne BlitNTL6 - - xor al, al - mov [edi], al - jmp BlitNTL5 - -BlitNTL6: - or al, al - jz BlitNTL7 - - mov al, ubForeground - mov [edi], al - jmp BlitNTL5 - -BlitNTL7: - cmp ubBackground, 0 - je BlitNTL5 - - mov al, ubBackground - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - and ecx, 07fH - - mov al, ubBackground - or al, al - jz BlitTrans1 - - rep stosb - jmp BlitDispatch - - -BlitTrans1: - add edi, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferMonoShadowClip - - Uses a bitmap an 8BPP template for blitting. Anywhere a 1 appears in the bitmap, a shadow - is blitted to the destination (a black pixel). Any other value above zero is considered a - forground color, and zero is background. If the parameter for the background color is zero, - transparency is used for the background. - - **********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferMonoShadowClip( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubForeground, UINT8 ubBackground) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - xor eax, eax - mov al, [esi] - cmp al, 1 - jne BlitNTL3 - - // write shadow pixel - xor al, al - mov [edi], al - jmp BlitNTL2 - -BlitNTL3: - or al, al - jz BlitNTL4 - - // write foreground pixel - mov al, ubForeground - mov [edi], al - jmp BlitNTL2 - -BlitNTL4: - cmp ubBackground, 0 - je BlitNTL2 - - //write background pixel - mov al, ubBackground - mov [edi], al - -BlitNTL2: - inc esi - inc edi - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - sub LSCount, ecx - - mov al, ubBackground - or al, al - jz BTrans2 - - rep stosb - jmp BlitDispatch - -BTrans2: - add edi, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZPixelate - - 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. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - uiLineFlag=(iTempY&1); - - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL5 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL5 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - mov ax, usZValue - mov [ebx], ax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - xor uiLineFlag, 1 - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBPixelate - - 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. The Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - uiLineFlag=(iTempY&1); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL5 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL5 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZClipPixelate - - 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. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - uiLineFlag=(iTempY&1); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL2 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL2 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - xor uiLineFlag, 1 - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBClipPixelate - - 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, the Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same - dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT32 uiLineFlag; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP=hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - uiLineFlag=(iTempY&1); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - test uiLineFlag, 1 - jz BlitNTL6 - - test edi, 2 - jz BlitNTL2 - jmp BlitNTL7 - -BlitNTL6: - test edi, 2 - jnz BlitNTL2 - -BlitNTL7: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - xor uiLineFlag, 1 - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - - - - - - - - - - - - - - - - -/****************************************************************************** - Blt8BPPDataTo8BPPBufferTransparentClip - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. Clips the brush. - -*******************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP -// mov edx, pointer to shade table here - xor eax, eax - mov ebx, TopSkip - xor ecx, ecx - - or ebx, ebx // check for nothing clipped on top - jz LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec ebx - jnz TopSkipLoop - - - - -LeftSkipSetup: - - mov Unblitted, 0 - mov ebx, LeftSkip // check for nothing clipped on the left - or ebx, ebx - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, ebx - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, ebx // skip partial run, jump into normal loop for rest - sub ecx, ebx - mov ebx, BlitLength - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub ebx, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, ebx - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, ebx // skip partial run, jump into normal loop for rest - mov ebx, BlitLength - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub ebx, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov ebx, BlitLength - mov Unblitted, 0 - -BlitDispatch: - - or ebx, ebx // Check to see if we're done blitting - jz RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, ebx - jbe BNTrans1 - - sub ecx, ebx - mov Unblitted, ecx - mov ecx, ebx - -BNTrans1: - sub ebx, ecx - - clc - rcr cl, 1 - jnc BlitNTL2 - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - inc esi - inc edi - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - add esi, 2 - add edi, 2 - -BlitNTL3: - - or cl, cl - jz BlitLineEnd - -BlitNTL4: - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - mov al, [esi+2] - mov al, [edx+eax] - mov [edi+2], al - - mov al, [esi+3] - mov al, [edx+eax] - mov [edi+3], al - - add esi, 4 - add edi, 4 - - dec cl - jnz BlitNTL4 - -BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, ebx - jbe BTrans1 - - mov ecx, ebx - -BTrans1: - - sub ebx, ecx - add edi, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransparent - - Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit - buffer as a destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *pPal8BPP; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - LineSkip=(uiDestPitchBYTES-(usWidth)); - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - xor ebx, ebx - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - clc - rcr cl, 1 - jnc BlitNTL2 - -// movsb - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - inc esi - inc edi - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - -// movsw - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - add esi, 2 - add edi, 2 - -BlitNTL3: - - or cl, cl - jz BlitDispatch - -BlitNTL4: - -// rep movsd - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - - mov al, [esi+2] - mov al, [edx+eax] - mov [edi+2], al - - mov al, [esi+3] - mov al, [edx+eax] - mov [edi+3], al - - add esi, 4 - add edi, 4 - - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - add edi, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZ - - 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. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ, uiZComp; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - uiZComp=(UINT32)usZValue; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - clc - rcr cl, 1 - jnc BlitNTL2 - -// do a byte - mov ax, [ebx] - cmp eax, uiZComp - ja BlitNTL4 - - mov eax, uiZComp - mov [ebx], ax - - xor eax, eax - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - - -BlitNTL4: - inc esi - inc ebx - inc edi - inc ebx - -// do a word -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL6 - -// word - first pixel - mov ax, [ebx] - cmp eax, uiZComp - ja BlitNTL3 - - mov eax, uiZComp - mov [ebx], ax - - xor eax, eax - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -// word - second -BlitNTL3: - mov ax, [ebx+2] - cmp eax, uiZComp - ja BlitNTL12 - - mov eax, uiZComp - mov [ebx+2], ax - - xor eax, eax - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - -BlitNTL12: - - inc esi - inc edi - inc esi - inc edi - add ebx, 4 - -// do a dword -BlitNTL6: - or cl, cl - jz BlitDispatch - -BlitNTL7: - -// dword - first pixel - mov ax, [ebx] - cmp eax, uiZComp - ja BlitNTL8 - - mov eax, uiZComp - mov [ebx], ax - - xor eax, eax - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -// dword - second -BlitNTL8: - mov ax, [ebx+2] - cmp eax, uiZComp - ja BlitNTL9 - - mov eax, uiZComp - mov [ebx+2], ax - - xor eax, eax - mov al, [esi+1] - mov al, [edx+eax] - mov [edi+1], al - -BlitNTL9: -// dword - third pixel - mov ax, [ebx+4] - cmp eax, uiZComp - ja BlitNTL10 - - mov eax, uiZComp - mov [ebx+4], ax - - xor eax, eax - mov al, [esi+2] - mov al, [edx+eax] - mov [edi+2], al - -// dword - fourth -BlitNTL10: - mov ax, [ebx+6] - cmp eax, uiZComp - ja BlitNTL11 - - mov eax, uiZComp - mov [ebx+6], ax - - xor eax, eax - mov al, [esi+3] - mov al, [edx+eax] - mov [edi+3], al - - -BlitNTL11: - add esi, 4 - add edi, 4 - add ebx, 8 - dec cl - jnz BlitNTL7 - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNB - - 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. The Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - xor eax, eax - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - xor ah, ah - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBColor - - 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. The Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. Any pixels that fail the Z test - are written to with the specified color. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT8 ubColor) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - xor eax, eax - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL5 - - xor ah, ah - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - jmp BlitNTL6 - -BlitNTL5: - xor ah, ah - mov al, ubColor - mov al, [edx+eax] - mov [edi], al - -BlitNTL6: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZClip - - 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. The Z-buffer is 16 bit, and - must be the same dimensions (including Pitch) as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBClip - - 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, the Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same - dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - xor eax, eax - - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransZNBClipColor - - 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, the Z value is - not updated, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same - dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubColor) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - xor eax, eax - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - ja BlitNTL2 - - xor ah, ah - mov al, [esi] - mov al, [edx+eax] - mov [edi], al - jmp BlitNTL3 - -BlitNTL2: - - xor ah, ah - mov al, ubColor - mov al, [edx+eax] - mov [edi], al - -BlitNTL3: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZ - - Creates a shadow using a brush, but modifies the destination buffer only if the current - Z level is equal to higher than what's in the Z buffer at that pixel location. It - updates the Z buffer with the new Z level. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZNB - - Creates a shadow using a brush, but modifies the destination buffer only if the current - Z level is equal to higher than what's in the Z buffer at that pixel location. - The Z buffer is NOT updated with the new information. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZClip - - 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, the Z value is - updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowZNBClip - - 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, the Z value is - NOT updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - xor eax, eax - mov al, [edi] - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZ - - 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. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL6 - - mov al, [edi] -// mov al, ColorTable[eax] ********************************************* - mov [edi], al - jmp BlitNTL5 - - -BlitNTL6: - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZNB - - 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 - NOT updated, 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. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - UINT8 *pPal8BPP; - - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*iTempY) + (iTempX*2); - LineSkip=(uiDestPitchBYTES-(usWidth)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - -BlitDispatch: - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - -BlitNTL4: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL5 - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL6 - -// mov al, [edi] -// mov al, ColorTable[eax] ********************************************* -// mov [edi], al - jmp BlitNTL5 - - -BlitNTL6: - mov al, [edx+eax] - mov [edi], al - -BlitNTL5: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - - -BlitTransparent: - - and ecx, 07fH - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec usHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZClip - - 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. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. Pixels with a value of - 254 are shaded instead of blitted. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - mov ax, usZValue - mov [ebx], ax - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL3 - - mov al, [edi] -// mov ax, ColorTable[eax] ************************************************ - mov [edi], al - jmp BlitNTL2 - -BlitNTL3: - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferTransShadowZNBClip - - 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 - NOT updated, for any non-transparent pixels. The Z-buffer is 16 bit, and - must be the same dimensions as the destination. Pixels with a value of - 254 are shaded instead of blitted. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ) -{ - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr, *ZPtr; - UINT32 LineSkip, LineSkipZ; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - UINT8 *pPal8BPP; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // check if whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // check if whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*2*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); - LineSkip=(uiDestPitchBYTES-(BlitLength)); - LineSkipZ=LineSkip*2; - pPal8BPP=hSrcVObject->pShade8; - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, ZPtr - xor ecx, ecx - mov edx, pPal8BPP - - cmp TopSkip, 0 // check for nothing clipped on top - je LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec TopSkip - jnz TopSkipLoop - -LeftSkipSetup: - - mov Unblitted, 0 - mov eax, LeftSkip - mov LSCount, eax - or eax, eax - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, LSCount - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, LSCount // skip partial run, jump into normal loop for rest - sub ecx, LSCount - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub LSCount, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, LSCount - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, LSCount // skip partial run, jump into normal loop for rest - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - jmp BlitTransparent - - -LSTrans1: - sub LSCount, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov eax, BlitLength - mov LSCount, eax - mov Unblitted, 0 - -BlitDispatch: - - cmp LSCount, 0 // Check to see if we're done blitting - je RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: // blit non-transparent pixels - - cmp ecx, LSCount - jbe BNTrans1 - - sub ecx, LSCount - mov Unblitted, ecx - mov ecx, LSCount - -BNTrans1: - sub LSCount, ecx - -BlitNTL1: - - mov ax, [ebx] - cmp ax, usZValue - jae BlitNTL2 - - xor eax, eax - mov al, [esi] - cmp al, 254 - jne BlitNTL3 - -// mov al, [edi] -// mov ax, ColorTable[eax] ************************************************ -// mov [edi], al - jmp BlitNTL2 - -BlitNTL3: - mov al, [edx+eax] - mov [edi], al - -BlitNTL2: - inc esi - inc edi - add ebx, 2 - dec cl - jnz BlitNTL1 - -//BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: // skip transparent pixels - - and ecx, 07fH - cmp ecx, LSCount - jbe BTrans1 - - mov ecx, LSCount - -BTrans1: - - sub LSCount, ecx - add edi, ecx -// shl ecx, 1 - add ecx, ecx - add ebx, ecx - jmp BlitDispatch - - -RightSkipLoop: // skip along until we hit and end-of-line marker - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - add ebx, LineSkipZ - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadow - - Modifies the destination buffer. Darkens the destination pixels by 25%, using the source - image as a mask. Any Non-zero index pixels are used to darken destination pixels. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadow( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex) -{ - UINT8 *pPal8BPP; - UINT32 uiOffset; - UINT32 usHeight, usWidth; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - // Validations - CHECKF( iTempX >= 0 ); - CHECKF( iTempY >= 0 ); - - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(usWidth)); - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - xor eax, eax - mov ebx, usHeight - xor ecx, ecx - mov edx, OFFSET ShadeTable - -BlitDispatch: - - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - jz BlitDoneLine - -//BlitNonTransLoop: - - xor eax, eax - - add esi, ecx - - clc - rcr cl, 1 - jnc BlitNTL2 - - mov ax, [edi] - mov ax, [edx+eax*2] - mov [edi], ax - - add edi, 2 - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - mov ax, [edi] - mov ax, [edx+eax*2] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax*2] - mov [edi+2], ax - - add edi, 4 - -BlitNTL3: - - or cl, cl - jz BlitDispatch - -BlitNTL4: - - mov ax, [edi] - mov ax, [edx+eax*2] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax*2] - mov [edi+2], ax - - mov ax, [edi+4] - mov ax, [edx+eax*2] - mov [edi+4], ax - - mov ax, [edi+6] - mov ax, [edx+eax*2] - mov [edi+6], ax - - add edi, 8 - dec cl - jnz BlitNTL4 - - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH -// shl ecx, 1 - add ecx, ecx - add edi, ecx - jmp BlitDispatch - - -BlitDoneLine: - - dec ebx - jz BlitDone - add edi, LineSkip - jmp BlitDispatch - - -BlitDone: - } - - return(TRUE); - -} - -/********************************************************************************************** - Blt8BPPDataTo8BPPBufferShadowClip - - Modifies the destination buffer. Darkens the destination pixels by 25%, using the source - image as a mask. Any Non-zero index pixels are used to darken destination pixels. Blitter - clips brush if it doesn't fit on the viewport. - -**********************************************************************************************/ -BOOLEAN Blt8BPPDataTo8BPPBufferShadowClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) -{ - UINT8 *pPal8BPP; - UINT32 uiOffset; - UINT32 usHeight, usWidth, Unblitted; - UINT8 *SrcPtr, *DestPtr; - UINT32 LineSkip; - ETRLEObject *pTrav; - INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight; - INT32 ClipX1, ClipY1, ClipX2, ClipY2; - - // Assertions - Assert( hSrcVObject != NULL ); - Assert( pBuffer != NULL ); - - // Get Offsets from Index into structure - pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); - usHeight = (UINT32)pTrav->usHeight; - usWidth = (UINT32)pTrav->usWidth; - uiOffset = pTrav->uiDataOffset; - - // Add to start position of dest buffer - iTempX = iX + pTrav->sOffsetX; - iTempY = iY + pTrav->sOffsetY; - - if(clipregion==NULL) - { - ClipX1=ClippingRect.iLeft; - ClipY1=ClippingRect.iTop; - ClipX2=ClippingRect.iRight; - ClipY2=ClippingRect.iBottom; - } - else - { - ClipX1=clipregion->iLeft; - ClipY1=clipregion->iTop; - ClipX2=clipregion->iRight; - ClipY2=clipregion->iBottom; - } - - // Calculate rows hanging off each side of the screen - LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); - RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); - TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); - BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); - - // calculate the remaining rows and columns to blit - BlitLength=((INT32)usWidth-LeftSkip-RightSkip); - BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); - - // whole thing is clipped - if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) - return(TRUE); - - // whole thing is clipped - if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) - return(TRUE); - - SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; - DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)); - pPal8BPP = hSrcVObject->pShade8; - LineSkip=(uiDestPitchBYTES-(BlitLength)); - - - __asm { - - mov esi, SrcPtr - mov edi, DestPtr - mov edx, pPal8BPP - xor eax, eax - mov ebx, TopSkip - xor ecx, ecx - - or ebx, ebx // check for nothing clipped on top - jz LeftSkipSetup - -TopSkipLoop: // Skips the number of lines clipped at the top - - mov cl, [esi] - inc esi - or cl, cl - js TopSkipLoop - jz TSEndLine - - add esi, ecx - jmp TopSkipLoop - -TSEndLine: - dec ebx - jnz TopSkipLoop - - - - -LeftSkipSetup: - - mov Unblitted, 0 - mov ebx, LeftSkip // check for nothing clipped on the left - or ebx, ebx - jz BlitLineSetup - -LeftSkipLoop: - - mov cl, [esi] - inc esi - - or cl, cl - js LSTrans - - cmp ecx, ebx - je LSSkip2 // if equal, skip whole, and start blit with new run - jb LSSkip1 // if less, skip whole thing - - add esi, ebx // skip partial run, jump into normal loop for rest - sub ecx, ebx - mov ebx, BlitLength - mov Unblitted, 0 - jmp BlitNonTransLoop - -LSSkip2: - add esi, ecx // skip whole run, and start blit with new run - jmp BlitLineSetup - - -LSSkip1: - add esi, ecx // skip whole run, continue skipping - sub ebx, ecx - jmp LeftSkipLoop - - -LSTrans: - and ecx, 07fH - cmp ecx, ebx - je BlitLineSetup // if equal, skip whole, and start blit with new run - jb LSTrans1 // if less, skip whole thing - - sub ecx, ebx // skip partial run, jump into normal loop for rest - mov ebx, BlitLength - jmp BlitTransparent - - -LSTrans1: - sub ebx, ecx // skip whole run, continue skipping - jmp LeftSkipLoop - - - - -BlitLineSetup: // Does any actual blitting (trans/non) for the line - mov ebx, BlitLength - mov Unblitted, 0 - -BlitDispatch: - - or ebx, ebx // Check to see if we're done blitting - jz RightSkipLoop - - mov cl, [esi] - inc esi - or cl, cl - js BlitTransparent - -BlitNonTransLoop: - - cmp ecx, ebx - jbe BNTrans1 - - sub ecx, ebx - mov Unblitted, ecx - mov ecx, ebx - -BNTrans1: - sub ebx, ecx - - clc - rcr cl, 1 - jnc BlitNTL2 - - mov ax, [edi] - mov ax, [edx+eax] - mov [edi], ax - - inc esi - add edi, 2 - -BlitNTL2: - clc - rcr cl, 1 - jnc BlitNTL3 - - mov ax, [edi] - mov ax, [edx+eax] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax] - mov [edi+2], ax - - add esi, 2 - add edi, 4 - -BlitNTL3: - - or cl, cl - jz BlitLineEnd - -BlitNTL4: - - mov ax, [edi] - mov ax, [edx+eax] - mov [edi], ax - - mov ax, [edi+2] - mov ax, [edx+eax] - mov [edi+2], ax - - mov ax, [edi+4] - mov ax, [edx+eax] - mov [edi+4], ax - - mov ax, [edi+6] - mov ax, [edx+eax] - mov [edi+6], ax - - add esi, 4 - add edi, 8 - dec cl - jnz BlitNTL4 - -BlitLineEnd: - add esi, Unblitted - jmp BlitDispatch - -BlitTransparent: - - and ecx, 07fH - cmp ecx, ebx - jbe BTrans1 - - mov ecx, ebx - -BTrans1: - - sub ebx, ecx -// shl ecx, 1 - add ecx, ecx - add edi, ecx - jmp BlitDispatch - - -RightSkipLoop: - - -RSLoop1: - mov al, [esi] - inc esi - or al, al - jnz RSLoop1 - - dec BlitHeight - jz BlitDone - add edi, LineSkip - - jmp LeftSkipSetup - - -BlitDone: - } - - return(TRUE); - -} - - - - //***************************************************************************** //** 16 Bit Blitters //** @@ -16788,79 +11606,6 @@ BOOLEAN UpdateBackupSurface( HVOBJECT hVObject ) */ -BOOLEAN FillRect8BPP(UINT8 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT8 color) -{ -INT32 x1real, y1real, x2real, y2real; -UINT32 linelength, lines, lineskip; -UINT8 *startoffset; - - // check parameters - Assert(pBuffer!=NULL); - Assert(uiDestPitchBYTES > 0); - Assert(x2 > x1); - Assert(y2 > y1); - - // clip edges of rect if hanging off screen - - x1real=__max(0, x1); - x2real=__min(639, x2); - y1real=__max(0, y1); - y2real=__min(479, y2); - - startoffset=pBuffer+(y1real*uiDestPitchBYTES)+x1real; - lines=y2real-y1real+1; - linelength=x2real-x1real+1; - lineskip=uiDestPitchBYTES-linelength; - - __asm { - mov edi, startoffset - mov al, color - mov ah, al - shl eax, 16 - mov al, color - mov ah, al - mov edx, lines - mov ebx, linelength - -// edi = destination pointer -// eax = dword of color value -// ebx = line length -// ecx = column counter -// edx = row counter - -LineLoop: - - mov ecx, ebx - - clc - rcr ecx, 1 - jnc FL2 - - mov [edi], al - inc edi - -FL2: - clc - rcr ecx, 1 - jnc FL3 - mov [edi], ax - add edi, 2 - -FL3: - or ecx, ecx - jz FillLineEnd - - rep stosd - -FillLineEnd: - add edi, lineskip - dec edx - jnz LineLoop - - } - return(TRUE); -} - BOOLEAN FillRect16BPP(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color) { INT32 x1real, y1real, x2real, y2real; diff --git a/sgp/vobject_blitters.h b/sgp/vobject_blitters.h index 2f7c1e1c..6a1b81d6 100644 --- a/sgp/vobject_blitters.h +++ b/sgp/vobject_blitters.h @@ -53,50 +53,9 @@ CHAR8 BltIsClippedOrOffScreen( HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 UINT16 *InitZBuffer(UINT32 uiPitch, UINT32 uiHeight); BOOLEAN ShutdownZBuffer(UINT16 *pBuffer); -// 8-Bit to 8-Bit Blitters - -//BOOLEAN Blt8BPPDataTo8BPPBufferTransZIncClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT8 ubColor); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubColor); - -// pixelation blitters -BOOLEAN Blt8BPPDataTo8BPPBufferTransZPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClipPixelate( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - - -BOOLEAN Blt8BPPDataTo8BPPBufferMonoShadowClip( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT8 ubForeground, UINT8 ubBackground); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo16BPPBufferTransMirror( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferTransZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette ); - -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ); -BOOLEAN Blt8BPPDataTo8BPPBufferTransShadowZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 *p16BPPPalette ); - -BOOLEAN Blt8BPPDataTo8BPPBufferShadowClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo8BPPBufferShadow( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo8BPPBuffer( UINT8 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); - // 8-Bit to 16-Bit Blitters +BOOLEAN Blt8BPPDataTo16BPPBufferTransMirror( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 usColor); BOOLEAN Blt8BPPDataTo16BPPBufferTransZNBClipColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, UINT16 usColor); @@ -152,19 +111,13 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadow(UINT16 *pBuffer, UINT32 uiDestPitchB BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowAlpha(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, HVOBJECT hAlphaVObject, INT32 iX, INT32 iY, UINT16 usIndex, UINT16 *p16BPPPalette, BOOLEAN fIgnoreShadows); BOOLEAN Blt8BPPDataTo16BPPBufferShadowClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN DDBlt8BPPDataTo16BPPBufferShadow( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT8 level, COLORVAL maskrgb, UINT16 usX, UINT16 usY, SGPRect *srcRect); BOOLEAN Blt8BPPTo8BPP(UINT8 *pDest, UINT32 uiDestPitch, UINT8 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight); BOOLEAN Blt16BPPTo16BPP(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight); BOOLEAN Blt16BPPTo16BPPTrans(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT16 usTrans); BOOLEAN Blt16BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT16 usTrans); -BOOLEAN Blt16BPPTo16BPPFog(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight, UINT8 *pFog, UINT16 usFogPitch); BOOLEAN Blt16BPPTo16BPPMirror(UINT16 *pDest, UINT32 uiDestPitch, UINT16 *pSrc, UINT32 uiSrcPitch, INT32 iDestXPos, INT32 iDestYPos, INT32 iSrcXPos, INT32 iSrcYPos, UINT32 uiWidth, UINT32 uiHeight); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZNB( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN Blt8BPPDataTo16BPPBufferFogZNBClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); BOOLEAN Blt16BPPBufferPixelateRectWithColor( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, SGPRect *area, UINT8 Pattern[8][8], UINT16 usColor ); BOOLEAN Blt16BPPBufferPixelateRect(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, SGPRect *area, UINT8 Pattern[8][8]); @@ -186,12 +139,6 @@ BOOLEAN Blt8BPPDataSubTo16BPPBuffer( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, H BOOLEAN Blt8BPPDataTo16BPPBufferHalf( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVSURFACE hSrcVSurface, UINT8 *pSrcBuffer, UINT32 uiSrcPitch, INT32 iX, INT32 iY); BOOLEAN Blt8BPPDataTo16BPPBufferHalfRect( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVSURFACE hSrcVSurface, UINT8 *pSrcBuffer, UINT32 uiSrcPitch, INT32 iX, INT32 iY, SGPRect *pRect); -BOOLEAN DDBlt8BPPDataTo16BPPBuffer( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT16 usX, UINT16 usY, SGPRect *srcRect ); -BOOLEAN DDBlt8BPPDataTo16BPPBufferFullTransparent( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT16 usX, UINT16 usY, SGPRect *srcRect ); -BOOLEAN DDFillSurface( HVOBJECT hDestVObject, blt_fx *pBltFx ); -BOOLEAN DDFillSurfaceRect( HVOBJECT hDestVObject, blt_fx *pBltFx ); -BOOLEAN BltVObjectUsingDD( HVOBJECT hDestVObject, HVOBJECT hSrcVObject, UINT32 fBltFlags, INT32 iDestX, INT32 iDestY, RECT *SrcRect ); - BOOLEAN BlitZRect(UINT16 *pZBuffer, UINT32 uiPitch, INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom, UINT16 usZValue); @@ -202,7 +149,6 @@ BOOLEAN Blt32BPPTo16BPPTransShadow(UINT16 *pDest, UINT32 uiDestPitch, UINT32 *pS BOOLEAN Blt16BPPDataTo16BPPBufferTransparentClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); BOOLEAN Blt16BPPDataTo16BPPBufferTransZClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); -BOOLEAN Blt16BPPDataTo16BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); // ATE: New blitters for showing an outline at color 254 BOOLEAN Blt8BPPDataTo16BPPBufferOutline( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, INT16 s16BPPColor, BOOLEAN fDoOutline ); @@ -226,7 +172,6 @@ BOOLEAN Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClipAlpha(UINT16 *pBuffer, BOOLEAN Blt8BPPDataTo16BPPBufferTransZClipPixelateObscured( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion); BOOLEAN Blt8BPPDataTo16BPPBufferTransZPixelateObscured( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ); -BOOLEAN FillRect8BPP(UINT8 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT8 color); BOOLEAN FillRect16BPP(UINT16 *pBuffer, UINT32 uiDestPitchBYTES, INT32 x1, INT32 y1, INT32 x2, INT32 y2, UINT16 color); /*