MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / HeliIntro_BlitMaskedAlignedX

Method HeliIntro_BlitMaskedAlignedX

Source/PC/Graphics_PC.cpp:814–879  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

812}
813
814void cGraphics_PC::HeliIntro_BlitMaskedAlignedX(tSharedBuffer pSource, int16 pCx)
815{
816 uint8* pDs = pSource->data();
817 uint8* pDsEnd = pSource->data() + pSource->size();
818
819 // Original works in 4-pixel groups
820 const int16 groupX = (pCx >> 2);
821 int16 ax = groupX;
822 int16 dx = ax;
823
824 ax -= 80;
825 int16 word_4285F = -ax;
826
827 const int planeShift = (pCx & 3); // <-- sub-pixel (0..3)
828
829 // first 4-pixel group for pCx
830 uint8* base = mSurface->GetSurfaceBuffer() + mMission_Intro_DrawY + (dx * 4);
831
832 ++dx;
833
834 // Loop the 4 source planes, but map them to dest planes with shift
835 for (uint8 srcPlane = 0; srcPlane < 4; ++srcPlane)
836 {
837 const int dstPlane = (srcPlane + planeShift) & 3;
838 const int groupCarry = ((srcPlane + planeShift) >> 2) & 1;
839
840 uint8* destPtr = base + (groupCarry * 4) + dstPlane;
841 uint8* di = destPtr;
842
843 for (int16 bx = mMission_Intro_DrawX; bx > 0; --bx)
844 {
845 int16 cx;
846
847 for (cx = word_4285F; cx > 0; --cx)
848 {
849 if (pDs >= pDsEnd)
850 return;
851
852 uint8 al = *pDs;
853 if (al)
854 *di = al;
855
856 ++pDs;
857 di += 4;
858 }
859
860 di -= mSurface->GetWidth() - 12 - 16;
861 --pDs;
862
863 for (cx = dx; cx > 0; --cx)
864 {
865 if (pDs >= pDsEnd)
866 return;
867
868 uint8 al = *pDs;
869 if (al)
870 *di = al;
871

Callers

nothing calls this directly

Calls 3

GetSurfaceBufferMethod · 0.80
GetWidthMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected