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

Method Map_Tile_Draw

Source/Amiga/Graphics_Amiga.cpp:683–723  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

681}
682
683void cGraphics_Amiga::Map_Tile_Draw(cSurface* pTarget, uint16 pTile, uint16 pX, uint16 pY, uint16 pOffset) {
684 uint8* Target = pTarget->GetSurfaceBuffer();
685
686 pX *= (16 + pOffset);
687
688 Target += (pY * (16 + pOffset)) * pTarget->GetWidth();
689 Target += pX;
690
691 uint8* TilePtr = mBlkData->data() + (pTile << 7);
692
693 uint8* TargetRow = Target;
694
695 // Each bitfield
696 for (uint16 BitField = 0; BitField < 4; ++BitField) {
697
698 // Each Tile Row
699 for (uint16 i = 0; i < 16; ++i) {
700
701 if (TilePtr > mBlkData->data() + mBlkData->size())
702 return;
703
704 uint16 RowData = readBEWord(TilePtr);
705 TilePtr += 2;
706
707 // Each pixel of a Tile Row
708 for (uint16 x = 0; x < 16; ++x) {
709 uint8 Bit = (RowData & 0x8000) ? 1 : 0;
710 RowData <<= 1;
711
712 if (Bit)
713 *(Target + x) |= (Bit << BitField);
714
715 }
716
717 Target += pTarget->GetWidth();
718 }
719
720 // Next Bitfield
721 Target = TargetRow;
722 }
723}
724
725void cGraphics_Amiga::MapTiles_Draw() {
726 mSurface->clearBuffer();

Callers

nothing calls this directly

Calls 4

readBEWordFunction · 0.85
GetSurfaceBufferMethod · 0.80
GetWidthMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected