aboutsummaryrefslogtreecommitdiff
path: root/engines/groovie
diff options
context:
space:
mode:
authorMatthew Hoops2014-01-14 22:13:26 -0500
committerMatthew Hoops2014-06-01 22:08:28 -0400
commit3c287aad182d7769f50642e9035f8dad1101d8d3 (patch)
tree079a286b8866f7461a8e46daec09b50072d1078c /engines/groovie
parentc0a172bc71adeaed22fa53c539c5e3743fb87191 (diff)
downloadscummvm-rg350-3c287aad182d7769f50642e9035f8dad1101d8d3.tar.gz
scummvm-rg350-3c287aad182d7769f50642e9035f8dad1101d8d3.tar.bz2
scummvm-rg350-3c287aad182d7769f50642e9035f8dad1101d8d3.zip
GROOVIE: Switch to 32bpp only in groovie2
Needed for alpha
Diffstat (limited to 'engines/groovie')
-rw-r--r--engines/groovie/cursor.cpp14
-rw-r--r--engines/groovie/groovie.cpp14
-rw-r--r--engines/groovie/roq.cpp39
3 files changed, 28 insertions, 39 deletions
diff --git a/engines/groovie/cursor.cpp b/engines/groovie/cursor.cpp
index 080463a8b3..65f3e108b8 100644
--- a/engines/groovie/cursor.cpp
+++ b/engines/groovie/cursor.cpp
@@ -260,7 +260,7 @@ Cursor_v2::Cursor_v2(Common::File &file) {
_width = file.readUint16LE();
_height = file.readUint16LE();
- _img = new byte[_width * _height * _numFrames * 2];
+ _img = new byte[_width * _height * _numFrames * 4];
debugC(1, kGroovieDebugCursor | kGroovieDebugAll, "Groovie::Cursor: width: %d, height: %d, frames:%d", _width, _height, _numFrames);
@@ -285,7 +285,7 @@ Cursor_v2::Cursor_v2(Common::File &file) {
byte *data = new byte[tmp32];
file.read(data, tmp32);
- decodeFrame(pal, data, _img + (f * _width * _height * 2));
+ decodeFrame(pal, data, _img + (f * _width * _height * 4));
delete[] data;
}
@@ -364,16 +364,16 @@ void Cursor_v2::decodeFrame(byte *pal, byte *data, byte *dest) {
}
// Convert to screen format
- // NOTE: Currently locked to 16bit
+ // NOTE: Currently locked to 32bpp
ptr = tmp;
for (int y = 0; y < _height; y++) {
for (int x = 0; x < _width; x++) {
if (*ptr == 1) {
- *(uint16 *)dest = (uint16)_format.RGBToColor(*(ptr + 1), *(ptr + 2), *(ptr + 3));
+ *(uint32 *)dest = _format.RGBToColor(*(ptr + 1), *(ptr + 2), *(ptr + 3));
} else {
- *(uint16 *)dest = 0;
+ *(uint32 *)dest = 0;
}
- dest += 2;
+ dest += 4;
ptr += 4;
}
}
@@ -385,7 +385,7 @@ void Cursor_v2::enable() {
}
void Cursor_v2::showFrame(uint16 frame) {
- int offset = _width * _height * frame * 2;
+ int offset = _width * _height * frame * 4;
CursorMan.replaceCursor((const byte *)(_img + offset), _width, _height, _width >> 1, _height >> 1, 0, false, &_format);
}
diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp
index f2801881f1..8ba193e0e9 100644
--- a/engines/groovie/groovie.cpp
+++ b/engines/groovie/groovie.cpp
@@ -104,18 +104,18 @@ Common::Error GroovieEngine::run() {
// Initialize the graphics
switch (_gameDescription->version) {
- case kGroovieV2:
+ case kGroovieV2: {
// Request the mode with the highest precision available
- initGraphics(640, 480, true, NULL);
-
- // Save the enabled mode
- _pixelFormat = _system->getScreenFormat();
+ Graphics::PixelFormat format(4, 8, 8, 8, 8, 24, 16, 8, 0);
+ initGraphics(640, 480, true, &format);
- // TODO: Eventually drop 16bpp mode
- if (_pixelFormat.bytesPerPixel == 1)
+ if (_system->getScreenFormat() != format)
return Common::kUnsupportedColorMode;
+ // Save the enabled mode
+ _pixelFormat = format;
break;
+ }
case kGroovieT7G:
initGraphics(640, 480, true);
_pixelFormat = Graphics::PixelFormat::createFormatCLUT8();
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index c7c8831c34..3b82543695 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -107,17 +107,16 @@ uint16 ROQPlayer::loadInternal() {
void ROQPlayer::buildShowBuf() {
for (int line = 0; line < _bg->h; line++) {
- byte *out = (byte *)_bg->getBasePtr(0, line);
- byte *in = (byte *)_currBuf->getBasePtr(0, line / _scaleY);
+ uint32 *out = (uint32 *)_bg->getBasePtr(0, line);
+ uint32 *in = (uint32 *)_currBuf->getBasePtr(0, line / _scaleY);
for (int x = 0; x < _bg->w; x++) {
// Copy a pixel
- memcpy(out, in, _vm->_pixelFormat.bytesPerPixel);
+ *out++ = *in;
// Skip to the next pixel
- out += _vm->_pixelFormat.bytesPerPixel;
if (!(x % _scaleX))
- in += _currBuf->format.bytesPerPixel;
+ in++;
}
}
@@ -561,17 +560,13 @@ void ROQPlayer::paint2(byte i, int destx, int desty) {
}
uint32 *block = _codebook2 + i * 4;
+ uint32 *ptr = (uint32 *)_currBuf->getBasePtr(destx, desty);
+ uint32 pitch = _currBuf->pitch / 4;
- for (int y = 0; y < 2; y++) {
- for (int x = 0; x < 2; x++) {
- if (_vm->_pixelFormat.bytesPerPixel == 2)
- *((uint16 *)_currBuf->getBasePtr(destx + x, desty + y)) = *block;
- else
- *((uint32 *)_currBuf->getBasePtr(destx + x, desty + y)) = *block;
-
- block++;
- }
- }
+ ptr[0] = block[0];
+ ptr[1] = block[1];
+ ptr[pitch] = block[2];
+ ptr[pitch + 1] = block[3];
}
void ROQPlayer::paint4(byte i, int destx, int desty) {
@@ -600,16 +595,10 @@ void ROQPlayer::paint8(byte i, int destx, int desty) {
for (int y2 = 0; y2 < 2; y2++) {
for (int x2 = 0; x2 < 2; x2++) {
- for (int repy = 0; repy < 2; repy++) {
- for (int repx = 0; repx < 2; repx++) {
- if (_vm->_pixelFormat.bytesPerPixel == 2)
- *((uint16 *)_currBuf->getBasePtr(destx + x4 * 4 + x2 * 2 + repx, desty + y4 * 4 + y2 * 2 + repy)) = *block2;
- else
- *((uint32 *)_currBuf->getBasePtr(destx + x4 * 4 + x2 * 2 + repx, desty + y4 * 4 + y2 * 2 + repy)) = *block2;
- }
- }
-
- block2++;
+ uint32 *ptr = (uint32 *)_currBuf->getBasePtr(destx + x4 * 4 + x2 * 2, desty + y4 * 4 + y2 * 2);
+ uint32 pitch = _currBuf->pitch / 4;
+ uint32 color = *block2++;
+ ptr[0] = ptr[1] = ptr[pitch] = ptr[pitch + 1] = color;
}
}
}