diff options
author | Gregory Montoir | 2007-12-08 09:10:08 +0000 |
---|---|---|
committer | Gregory Montoir | 2007-12-08 09:10:08 +0000 |
commit | c271093fbbd9cf40622f203b50e998230de6cfb9 (patch) | |
tree | 3aeca6c9e0445deb139abc6e683596ea8ad7cb0b /engines | |
parent | 6b68c156ae509577756259988c04ff8ef0d0a3d2 (diff) | |
download | scummvm-rg350-c271093fbbd9cf40622f203b50e998230de6cfb9.tar.gz scummvm-rg350-c271093fbbd9cf40622f203b50e998230de6cfb9.tar.bz2 scummvm-rg350-c271093fbbd9cf40622f203b50e998230de6cfb9.zip |
simplified gfxConvertSpriteToRaw, some renaming
svn-id: r29758
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cine/gfx.cpp | 46 | ||||
-rw-r--r-- | engines/cine/gfx.h | 10 | ||||
-rw-r--r-- | engines/cine/various.cpp | 6 |
3 files changed, 23 insertions, 39 deletions
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index ffe6439d04..a7281e8591 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -27,6 +27,7 @@ #include "cine/bg.h" #include "cine/various.h" +#include "common/endian.h" #include "common/system.h" #include "graphics/cursorman.h" @@ -99,7 +100,7 @@ void gfxInit() { memset(page1Raw, 0, 320 * 200); memset(page2Raw, 0, 320 * 200); memset(page3Raw, 0, 320 * 200); - + memset(additionalBgTable, 0, sizeof(additionalBgTable)); additionalBgTable[0] = page2Raw; additionalBgTable[8] = page3Raw; @@ -192,8 +193,7 @@ void gfxFillSprite(byte *spritePtr, uint16 width, uint16 height, byte *page, int } } -// gfxDrawMaskedSprite -void gfxSpriteFunc1(byte *spritePtr, byte *maskPtr, uint16 width, uint16 height, byte *page, int16 x, int16 y) { +void gfxDrawMaskedSprite(byte *spritePtr, byte *maskPtr, uint16 width, uint16 height, byte *page, int16 x, int16 y) { int16 i, j; for (i = 0; i < height; i++) { @@ -211,11 +211,10 @@ void gfxSpriteFunc1(byte *spritePtr, byte *maskPtr, uint16 width, uint16 height, } } -// gfxUpdateSpriteMask -void gfxSpriteFunc2(byte *spritePtr, byte *spriteMskPtr, int16 width, int16 height, byte *maskPtr, +void gfxUpdateSpriteMask(byte *spritePtr, byte *spriteMskPtr, int16 width, int16 height, byte *maskPtr, int16 maskWidth, int16 maskHeight, byte *bufferSprPtr, byte *bufferMskPtr, int16 xs, int16 ys, int16 xm, int16 ym, byte maskIdx) { int16 i, j, d, spritePitch, maskPitch; - + width *= 8; maskWidth *= 8; @@ -226,7 +225,7 @@ void gfxSpriteFunc2(byte *spritePtr, byte *spriteMskPtr, int16 width, int16 heig memcpy(bufferSprPtr, spritePtr, spritePitch * height); memcpy(bufferMskPtr, spriteMskPtr, spritePitch * height); } - + if (ys > ym) { d = ys - ym; maskPtr += d * maskPitch; @@ -331,32 +330,19 @@ void gfxResetRawPage(byte *pageRaw) { memset(pageRaw, 0, 320 * 200); } -void gfxConvertSpriteToRaw(byte *dst, byte *src, uint16 width, uint16 height) { - int x, y, d, bit, plane; - - width >>= 3; - for (y = 0; y < height; y++) { - for (x = 0; x < width; x++) { - byte data[2][4]; - data[0][0] = *src++; - data[1][0] = *src++; - data[0][1] = *src++; - data[1][1] = *src++; - data[0][2] = *src++; - data[1][2] = *src++; - data[0][3] = *src++; - data[1][3] = *src++; - for (d = 0; d < 2; ++d) { - for (bit = 0; bit < 8; ++bit) { - byte color = 0; - for (plane = 0; plane < 4; ++plane) { - if (data[d][plane] & (1 << (7 - bit))) { - color |= 1 << plane; - } +void gfxConvertSpriteToRaw(byte *dst, const byte *src, uint16 w, uint16 h) { + for (int y = 0; y < h; ++y) { + for (int x = 0; x < w / 8; ++x) { + for (int bit = 0; bit < 16; ++bit) { + uint8 color = 0; + for (int p = 0; p < 4; ++p) { + if (READ_BE_UINT16(src + p * 2) & (1 << (15 - bit))) { + color |= 1 << p; } - *dst++ = color; } + *dst++ = color; } + src += 8; } } } diff --git a/engines/cine/gfx.h b/engines/cine/gfx.h index 049e17d127..72f01124fc 100644 --- a/engines/cine/gfx.h +++ b/engines/cine/gfx.h @@ -38,17 +38,15 @@ extern uint16 c_palette[256]; void gfxInit(); void setMouseCursor(int cursor); -void convertGfx(byte *source, byte *dest, const uint16 width, const uint16 height); -void convertGfx2(byte *source, byte *dest, const uint16 width, const uint16 height); void gfxCopyPage(byte *source, byte *dest); void transformPaletteRange(byte startColor, byte numColor, int8 r, int8 g, int8 b); void gfxFlipPage(void); -void gfxSpriteFunc1(byte *ptr, byte *msk, uint16 width, uint16 height, byte *page, int16 x, int16 y); +void gfxDrawMaskedSprite(byte *ptr, byte *msk, uint16 width, uint16 height, byte *page, int16 x, int16 y); void gfxFillSprite(byte *src4, uint16 sw, uint16 sh, byte *dst4, int16 sx, int16 sy, uint8 fillColor = 0); -void gfxSpriteFunc2(byte *spritePtr, byte *spriteMskPtr, int16 width, int16 height, byte *maskPtr, +void gfxUpdateSpriteMask(byte *spritePtr, byte *spriteMskPtr, int16 width, int16 height, byte *maskPtr, int16 maskWidth, int16 maskHeight, byte *bufferSprPtr, byte *bufferMskPtr, int16 xs, int16 ys, int16 xm, int16 ym, byte maskIdx); void gfxDrawLine(int16 x1, int16 y1, int16 x2, int16 y2, byte color, byte *page); @@ -59,7 +57,7 @@ void gfxResetPage(byte *pagePtr); int16 gfxGetBit(int16 x, int16 y, byte *ptr, int16 width); void gfxResetRawPage(byte *pageRaw); -void gfxConvertSpriteToRaw(byte *dest, byte *source, uint16 width, uint16 height); +void gfxConvertSpriteToRaw(byte *dst, const byte *src, uint16 w, uint16 h); void gfxCopyRawPage(byte *source, byte * dest); void gfxFlipRawPage(byte *frontBuffer); void drawSpriteRaw(byte *spritePtr, byte *maskPtr, int16 width, int16 height, byte *page, int16 x, int16 y); @@ -68,7 +66,7 @@ void drawSpriteRaw2(byte *spritePtr, byte transColor, int16 width, int16 height, void fadeToBlack(void); -void gfxFuncGen1(byte *param1, byte *param2, byte *param3, byte *param4, int16 param5); +void gfxDrawMaskedSprite(byte *param1, byte *param2, byte *param3, byte *param4, int16 param5); void ptrGfxFunc13(void); void gfxFuncGen2(void); diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index fe9cc30fef..c6508cc211 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -2181,7 +2181,7 @@ void drawSprite(overlayHeadElement *currentOverlay, byte *spritePtr, maskWidth = animDataTable[maskSpriteIdx].width / 2; maskHeight = animDataTable[maskSpriteIdx].height; - gfxSpriteFunc2(spritePtr, maskPtr, width, height, animDataTable[maskSpriteIdx].ptr1, maskWidth, maskHeight, ptr, msk, x, y, maskX, maskY, i++); + gfxUpdateSpriteMask(spritePtr, maskPtr, width, height, animDataTable[maskSpriteIdx].ptr1, maskWidth, maskHeight, ptr, msk, x, y, maskX, maskY, i++); #ifdef DEBUG_SPRITE_MASK gfxFillSprite(animDataTable[maskSpriteIdx].ptr1, maskWidth, maskHeight, page, maskX, maskY, 1); #endif @@ -2191,11 +2191,11 @@ void drawSprite(overlayHeadElement *currentOverlay, byte *spritePtr, } if (si) { - gfxSpriteFunc1(ptr, msk, width, height, page, x, y); + gfxDrawMaskedSprite(ptr, msk, width, height, page, x, y); free(ptr); free(msk); } else { - gfxSpriteFunc1(spritePtr, maskPtr, width, height, page, x, y); + gfxDrawMaskedSprite(spritePtr, maskPtr, width, height, page, x, y); } } |