diff options
author | Filippos Karapetis | 2017-02-12 00:53:23 +0200 |
---|---|---|
committer | Filippos Karapetis | 2017-02-12 00:54:39 +0200 |
commit | a7d681764f4a9d499cf08b253aea0c1813ec6e05 (patch) | |
tree | da75a04191e5161efb99afb51ef1285596af41cd /engines/cryo | |
parent | d3d5ff2a888e7134b299db7fcb928735089f908e (diff) | |
download | scummvm-rg350-a7d681764f4a9d499cf08b253aea0c1813ec6e05.tar.gz scummvm-rg350-a7d681764f4a9d499cf08b253aea0c1813ec6e05.tar.bz2 scummvm-rg350-a7d681764f4a9d499cf08b253aea0c1813ec6e05.zip |
CRYO: Merge spriteOnSubtitle() into drawSprite()
Diffstat (limited to 'engines/cryo')
-rw-r--r-- | engines/cryo/eden.cpp | 82 | ||||
-rw-r--r-- | engines/cryo/eden.h | 3 | ||||
-rw-r--r-- | engines/cryo/graphics.cpp | 14 |
3 files changed, 11 insertions, 88 deletions
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index 0d4cb7478a..2e3d44fd2c 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -1115,84 +1115,6 @@ void EdenGame::readPalette(byte *ptr) { } } -// Original name: spritesurbulle -void EdenGame::spriteOnSubtitle(int16 index, int16 x, int16 y) { - byte *pix = _bankData; - byte *scr = _subtitlesViewBuf + x + y * _subtitlesXWidth; - if ((_curBankNum != 117) && (READ_LE_UINT16(pix) > 2)) - readPalette(pix + 2); - - pix += READ_LE_UINT16(pix); - pix += READ_LE_UINT16(pix + index * 2); - // int16 height:9 - // int16 pad:6; - // int16 flag:1; - byte h0 = *pix++; - byte h1 = *pix++; - int16 w = ((h1 & 1) << 8) | h0; - int16 h = *pix++; - byte mode = *pix++; - if (mode != 0xFF && mode != 0xFE) - return; - if (h1 & 0x80) { - // compressed - for (; h-- > 0;) { - for (int16 ww = w; ww > 0;) { - byte c = *pix++; - if (c >= 0x80) { - if (c == 0x80) { - byte fill = *pix++; - if (fill == 0) { - scr += 128 + 1; - ww -= 128 + 1; - } else { - byte runVal; - *scr++ = fill; //TODO: wha? - *scr++ = fill; - ww -= 128 + 1; - for (runVal = 127; runVal--;) - *scr++ = fill; - } - } else { - byte fill = *pix++; - byte runVal = 255 - c + 2; - ww -= runVal; - if (fill == 0) - scr += runVal; - else { - for (; runVal--;) - *scr++ = fill; - } - } - } else { - byte runVal = c + 1; - ww -= runVal; - for (; runVal--;) { - byte p = *pix++; - if (p == 0) - scr++; - else - *scr++ = p; - } - } - } - scr += _subtitlesXWidth - w; - } - } else { - // uncompressed - for (; h--;) { - for (int16 ww = w; ww--;) { - byte p = *pix++; - if (p == 0) - scr++; - else - *scr++ = p; - } - scr += _subtitlesXWidth - w; - } - } -} - // Original name: sauvefondbouche void EdenGame::saveMouthBackground() { rect_src.left = _curCharacterRect->left; @@ -2484,8 +2406,8 @@ void EdenGame::my_bulle() { byte x = *icons++; byte y = *icons++; byte s = *icons++; - spriteOnSubtitle(52, x + _subtitlesXCenter, y - 1); - spriteOnSubtitle(s + 9, x + _subtitlesXCenter + 1, y); + drawSprite(52, x + _subtitlesXCenter, y - 1, false, true); + drawSprite(s + 9, x + _subtitlesXCenter + 1, y, false, true); } } diff --git a/engines/cryo/eden.h b/engines/cryo/eden.h index 3e838a622e..c8743caf43 100644 --- a/engines/cryo/eden.h +++ b/engines/cryo/eden.h @@ -121,12 +121,11 @@ private: void useBank(int16 bank); void sundcurs(int16 x, int16 y); void rundcurs(); - void drawSprite(int16 index, int16 x, int16 y, bool withBlack = false); + void drawSprite(int16 index, int16 x, int16 y, bool withBlack = false, bool onSubtitle = false); void getglow(int16 x, int16 y, int16 w, int16 h); void unglow(); void glow(int16 index); void readPalette(byte *ptr); - void spriteOnSubtitle(int16 index, int16 x, int16 y); void hideBars(); void showBars(); void saveMouthBackground(); diff --git a/engines/cryo/graphics.cpp b/engines/cryo/graphics.cpp index 29ebffc7a6..bfbce13949 100644 --- a/engines/cryo/graphics.cpp +++ b/engines/cryo/graphics.cpp @@ -30,10 +30,12 @@ namespace Cryo { // Original name: noclipax -void EdenGame::drawSprite(int16 index, int16 x, int16 y, bool withBlack) { +void EdenGame::drawSprite(int16 index, int16 x, int16 y, bool withBlack, bool onSubtitle) { + uint16 width = (!onSubtitle) ? 640 : _subtitlesXWidth; byte *pix = _bankData; - byte *scr = _mainViewBuf + x + y * 640; - if (_curBankNum != 117 && (!_noPalette || withBlack)) { + byte *buf = (!onSubtitle) ? _mainViewBuf : _subtitlesViewBuf; + byte *scr = buf + x + y * width; + if (_curBankNum != 117 && (!_noPalette || withBlack || onSubtitle)) { if (READ_LE_UINT16(pix) > 2) readPalette(pix + 2); } @@ -49,7 +51,7 @@ void EdenGame::drawSprite(int16 index, int16 x, int16 y, bool withBlack) { byte mode = *pix++; if (mode != 0xFF && mode != 0xFE) return; - if (y + h > 200) + if (y + h > 200 && !onSubtitle) h -= (y + h - 200); if (h1 & 0x80) { // compressed @@ -95,7 +97,7 @@ void EdenGame::drawSprite(int16 index, int16 x, int16 y, bool withBlack) { } } } - scr += 640 - w; + scr += width - w; } } else { @@ -108,7 +110,7 @@ void EdenGame::drawSprite(int16 index, int16 x, int16 y, bool withBlack) { else *scr++ = p; } - scr += 640 - w; + scr += width - w; } } } |