diff --git a/Source/control.cpp b/Source/control.cpp index 94e80fc09..70b863c8c 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -485,36 +485,14 @@ void DrawPanelBox(int x, int y, int w, int h, int sx, int sy) nSrcOff = x + PANEL_WIDTH * y; nDstOff = sx + BUFFER_WIDTH * sy + (SCREEN_WIDTH - PANEL_WIDTH) / 2; - int wdt, hgt; + int hgt; BYTE *src, *dst; src = &pBtmBuff[nSrcOff]; dst = &gpBuffer[nDstOff]; - for (hgt = h; hgt; hgt--, src += PANEL_WIDTH - w, dst += BUFFER_WIDTH - w) { - wdt = w; - if (wdt & 1) { - dst[0] = src[0]; - src++; - dst++; - } - wdt >>= 1; - if (wdt & 1) { - dst[0] = src[0]; - dst[1] = src[1]; - src += 2; - dst += 2; - } - wdt >>= 1; - while (wdt) { - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = src[2]; - dst[3] = src[3]; - src += 4; - dst += 4; - wdt--; - } + for (hgt = h; hgt; hgt--, src += PANEL_WIDTH, dst += BUFFER_WIDTH) { + memcpy(dst, src, w); } } diff --git a/Source/engine.cpp b/Source/engine.cpp index da9011d42..829fb9930 100644 --- a/Source/engine.cpp +++ b/Source/engine.cpp @@ -179,31 +179,10 @@ void CelBlitSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidth) if (!(width & 0x80)) { i -= width; if (dst < gpBufEnd && dst > gpBufStart) { - if (width & 1) { - dst[0] = src[0]; - src++; - dst++; - } - width >>= 1; - if (width & 1) { - dst[0] = src[0]; - dst[1] = src[1]; - src += 2; - dst += 2; - } - width >>= 1; - for (; width; width--) { - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = src[2]; - dst[3] = src[3]; - src += 4; - dst += 4; - } - } else { - src += width; - dst += width; + memcpy(dst, src, width); } + src += width; + dst += width; } else { width = -(char)width; dst += width; @@ -267,31 +246,10 @@ void CelBlitLightSafe(BYTE *pDecodeTo, BYTE *pRLEBytes, int nDataSize, int nWidt if (!(width & 0x80)) { i -= width; if (dst < gpBufEnd && dst > gpBufStart) { - if (width & 1) { - dst[0] = tbl[src[0]]; - src++; - dst++; - } - width >>= 1; - if (width & 1) { - dst[0] = tbl[src[0]]; - dst[1] = tbl[src[1]]; - src += 2; - dst += 2; - } - width >>= 1; - for (; width; width--) { - dst[0] = tbl[src[0]]; - dst[1] = tbl[src[1]]; - dst[2] = tbl[src[2]]; - dst[3] = tbl[src[3]]; - src += 4; - dst += 4; - } - } else { - src += width; - dst += width; + memcpy(dst, src, width); } + src += width; + dst += width; } else { width = -(char)width; dst += width; @@ -492,28 +450,9 @@ void CelBlitWidth(BYTE *pBuff, int x, int y, int wdt, BYTE *pCelBuff, int nCel, width = *pRLEBytes++; if (!(width & 0x80)) { i -= width; - if (width & 1) { - dst[0] = pRLEBytes[0]; - pRLEBytes++; - dst++; - } - width >>= 1; - if (width & 1) { - dst[0] = pRLEBytes[0]; - dst[1] = pRLEBytes[1]; - pRLEBytes += 2; - dst += 2; - } - width >>= 1; - while (width) { - dst[0] = pRLEBytes[0]; - dst[1] = pRLEBytes[1]; - dst[2] = pRLEBytes[2]; - dst[3] = pRLEBytes[3]; - pRLEBytes += 4; - dst += 4; - width--; - } + memcpy(dst, pRLEBytes, width); + dst += width; + pRLEBytes += width; } else { width = -(char)width; dst += width;