MCPcopy Create free account
hub / github.com/diasurgical/devilution / CelBlitWidth

Function CelBlitWidth

Source/engine.cpp:495–524  ·  view source on GitHub ↗

* @brief Blit to a buffer at given coordinates * @param pBuff Target buffer * @param x Cordinate in pBuff buffer * @param y Cordinate in pBuff buffer * @param wdt Width of pBuff * @param pCelBuff Cel data * @param nCel CEL frame number * @param nWidth Width of cel */

Source from the content-addressed store, hash-verified

493 * @param nWidth Width of cel
494 */
495void CelBlitWidth(BYTE *pBuff, int x, int y, int wdt, BYTE *pCelBuff, int nCel, int nWidth)
496{
497 BYTE *pRLEBytes, *dst, *end;
498
499 assert(pCelBuff != NULL);
500 assert(pBuff != NULL);
501
502 int i, nDataSize;
503 BYTE width;
504
505 pRLEBytes = CelGetFrame(pCelBuff, nCel, &nDataSize);
506 end = &pRLEBytes[nDataSize];
507 dst = &pBuff[y * wdt + x];
508
509 for (; pRLEBytes != end; dst -= wdt + nWidth) {
510 for (i = nWidth; i;) {
511 width = *pRLEBytes++;
512 if (!(width & 0x80)) {
513 i -= width;
514 memcpy(dst, pRLEBytes, width);
515 dst += width;
516 pRLEBytes += width;
517 } else {
518 width = -(char)width;
519 dst += width;
520 i -= width;
521 }
522 }
523 }
524}
525
526/**
527 * @brief Blit a solid colder shape one pixel larger then the given sprite shape, to the back buffer at the given coordianates

Callers 1

InitControlPanFunction · 0.85

Calls 1

CelGetFrameFunction · 0.85

Tested by

no test coverage detected