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

Method Sidebar_Copy_Sprite_To_ScreenBufPtr

Source/PC/Graphics_PC.cpp:482–520  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480}
481
482void cGraphics_PC::Sidebar_Copy_Sprite_To_ScreenBufPtr(int16 pSpriteType, size_t pX, size_t pY) {
483 const sSpriteSheet_pstuff* SpriteSheet = &mSpriteSheet_PStuff[pSpriteType];
484
485 mFodder->mVideo_Draw_Columns = SpriteSheet->mColumns;
486 mFodder->mVideo_Draw_Rows = SpriteSheet->mRows;
487
488 uint16 Offset = (0xA0 * SpriteSheet->mY) + (SpriteSheet->mX >> 1);
489
490 mFodder->mVideo_Draw_FrameDataPtr = SpriteSheet->GetGraphicsPtr(Offset);
491 mFodder->mVideo_Draw_PaletteIndex = 0xF0;
492
493 uint8* si = mFodder->mVideo_Draw_FrameDataPtr;
494 uint8* di = ((uint8*)mFodder->mSidebar_Screen_BufferPtr) + (48 * pY) + pX;
495
496 mFodder->mDraw_Source_SkipPixelsPerRow = 0xA0 - (mFodder->mVideo_Draw_Columns >> 1);
497 mFodder->mDraw_Dest_SkipPixelsPerRow = 48 - mFodder->mVideo_Draw_Columns;
498
499 for (uint16 dx = mFodder->mVideo_Draw_Rows; dx > 0; --dx) {
500
501 for (uint16 cx = (mFodder->mVideo_Draw_Columns / 2); cx > 0; --cx) {
502
503 uint8 ah = *si;
504
505 uint8 al = ah >> 4;
506 if (al)
507 *di = al | mFodder->mVideo_Draw_PaletteIndex;
508
509 al = ah & 0x0F;
510 if (al)
511 *(di + 1) = al | mFodder->mVideo_Draw_PaletteIndex;
512
513 si++;
514 di += 2;
515 }
516
517 si += mFodder->mDraw_Source_SkipPixelsPerRow;
518 di += mFodder->mDraw_Dest_SkipPixelsPerRow;
519 }
520}
521
522void cGraphics_PC::Sidebar_Copy_ScreenBuffer( uint16 pRow, int16 pRows, int16 pCopyToScreen, uint32*& pBuffer) {
523 pRow += 0x18;

Calls 1

GetGraphicsPtrMethod · 0.80

Tested by

no test coverage detected