[Scummvm-cvs-logs] scummvm master -> 3c287aad182d7769f50642e9035f8dad1101d8d3
clone2727
clone2727 at gmail.com
Mon Jun 2 04:09:14 CEST 2014
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5d4fd2e154 GROOVIE: Remove groovie2 8bpp mode
3638f1191c GROOVIE: Switch roq decoding to do YUV decoding on codebook load
c0a172bc71 GROOVIE: Fix various roq glitches
3c287aad18 GROOVIE: Switch to 32bpp only in groovie2
Commit: 5d4fd2e1540ae9ced60b68c3253d3b5b04254403
https://github.com/scummvm/scummvm/commit/5d4fd2e1540ae9ced60b68c3253d3b5b04254403
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2014-06-01T22:08:28-04:00
Commit Message:
GROOVIE: Remove groovie2 8bpp mode
It didn't work properly, it's not what the original did, and spooky mode needs to be implemented completely differently
Changed paths:
engines/groovie/configure.engine
engines/groovie/groovie.cpp
engines/groovie/groovie.h
engines/groovie/roq.cpp
diff --git a/engines/groovie/configure.engine b/engines/groovie/configure.engine
index 84e95a7..212a49b 100644
--- a/engines/groovie/configure.engine
+++ b/engines/groovie/configure.engine
@@ -1,4 +1,4 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
add_engine groovie "Groovie" yes "groovie2" "7th Guest"
-add_engine groovie2 "Groovie 2 games" no "" "" "jpeg"
+add_engine groovie2 "Groovie 2 games" no "" "" "jpeg 16bit"
diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp
index e65031e..f280188 100644
--- a/engines/groovie/groovie.cpp
+++ b/engines/groovie/groovie.cpp
@@ -50,7 +50,8 @@ namespace Groovie {
GroovieEngine::GroovieEngine(OSystem *syst, const GroovieGameDescription *gd) :
Engine(syst), _gameDescription(gd), _debugger(NULL), _script(NULL),
_resMan(NULL), _grvCursorMan(NULL), _videoPlayer(NULL), _musicPlayer(NULL),
- _graphicsMan(NULL), _macResFork(NULL), _waitingForInput(false), _font(NULL) {
+ _graphicsMan(NULL), _macResFork(NULL), _waitingForInput(false), _font(NULL),
+ _spookyMode(false) {
// Adding the default directories
const Common::FSNode gameDataDir(ConfMan.get("path"));
@@ -107,9 +108,13 @@ Common::Error GroovieEngine::run() {
// Request the mode with the highest precision available
initGraphics(640, 480, true, NULL);
- // Save the enabled mode as it can be both an RGB mode or CLUT8
+ // Save the enabled mode
_pixelFormat = _system->getScreenFormat();
- _mode8bit = (_pixelFormat == Graphics::PixelFormat::createFormatCLUT8());
+
+ // TODO: Eventually drop 16bpp mode
+ if (_pixelFormat.bytesPerPixel == 1)
+ return Common::kUnsupportedColorMode;
+
break;
case kGroovieT7G:
initGraphics(640, 480, true);
diff --git a/engines/groovie/groovie.h b/engines/groovie/groovie.h
index c3d3146..9fe6b0c 100644
--- a/engines/groovie/groovie.h
+++ b/engines/groovie/groovie.h
@@ -110,7 +110,7 @@ public:
void waitForInput();
Graphics::PixelFormat _pixelFormat;
- bool _mode8bit;
+ bool _spookyMode;
Script *_script;
ResMan *_resMan;
GrvCursorMan *_grvCursorMan;
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 2776a04..5eebc6a 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -50,19 +50,6 @@ ROQPlayer::ROQPlayer(GroovieEngine *vm) :
// Create the work surfaces
_currBuf = new Graphics::Surface();
_prevBuf = new Graphics::Surface();
-
- if (_vm->_mode8bit) {
- byte pal[256 * 3];
-
- // Set a grayscale palette
- for (int i = 0; i < 256; i++) {
- pal[(i * 3) + 0] = i;
- pal[(i * 3) + 1] = i;
- pal[(i * 3) + 2] = i;
- }
-
- _syst->getPaletteManager()->setPalette(pal, 0, 256);
- }
}
ROQPlayer::~ROQPlayer() {
@@ -118,18 +105,11 @@ void ROQPlayer::buildShowBuf() {
byte *out = (byte *)_bg->getBasePtr(0, line);
byte *in = (byte *)_currBuf->getBasePtr(0, line / _scaleY);
for (int x = 0; x < _bg->w; x++) {
- if (_vm->_mode8bit) {
- // Just use the luminancy component
- *out = *in;
-#ifdef USE_RGB_COLOR
- } else {
- // Do the format conversion (YUV -> RGB -> Screen format)
- byte r, g, b;
- Graphics::YUV2RGB(*in, *(in + 1), *(in + 2), r, g, b);
- // FIXME: this is fixed to 16bit
- *(uint16 *)out = (uint16)_vm->_pixelFormat.RGBToColor(r, g, b);
-#endif // USE_RGB_COLOR
- }
+ // Do the format conversion (YUV -> RGB -> Screen format)
+ byte r, g, b;
+ Graphics::YUV2RGB(*in, *(in + 1), *(in + 2), r, g, b);
+ // FIXME: this is fixed to 16bit
+ *(uint16 *)out = _vm->_pixelFormat.RGBToColor(r, g, b);
// Skip to the next pixel
out += _vm->_pixelFormat.bytesPerPixel;
Commit: 3638f1191cda18f47939aa36eae7a695fbe727c6
https://github.com/scummvm/scummvm/commit/3638f1191cda18f47939aa36eae7a695fbe727c6
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2014-06-01T22:08:28-04:00
Commit Message:
GROOVIE: Switch roq decoding to do YUV decoding on codebook load
Changed paths:
engines/groovie/roq.cpp
engines/groovie/roq.h
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 5eebc6a..118b77e 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -28,6 +28,7 @@
#include "groovie/groovie.h"
#include "common/debug.h"
+#include "common/rect.h"
#include "common/substream.h"
#include "common/textconsole.h"
@@ -104,12 +105,10 @@ 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);
+
for (int x = 0; x < _bg->w; x++) {
- // Do the format conversion (YUV -> RGB -> Screen format)
- byte r, g, b;
- Graphics::YUV2RGB(*in, *(in + 1), *(in + 2), r, g, b);
- // FIXME: this is fixed to 16bit
- *(uint16 *)out = _vm->_pixelFormat.RGBToColor(r, g, b);
+ // Copy a pixel
+ memcpy(out, in, _vm->_pixelFormat.bytesPerPixel);
// Skip to the next pixel
out += _vm->_pixelFormat.bytesPerPixel;
@@ -262,27 +261,14 @@ bool ROQPlayer::processBlockInfo(ROQBlockHeader &blockHeader) {
_prevBuf->free();
// Allocate new buffers
- // These buffers use YUV data, since we can not describe it with a
- // PixelFormat struct we just add some dummy PixelFormat with the
- // correct bytes per pixel value. Since the surfaces are only used
- // internally and no code assuming RGB data is present is used on
- // them it should be just fine.
- _currBuf->create(width, height, Graphics::PixelFormat(3, 0, 0, 0, 0, 0, 0, 0, 0));
- _prevBuf->create(width, height, Graphics::PixelFormat(3, 0, 0, 0, 0, 0, 0, 0, 0));
- }
-
- // Clear the buffers with black YUV values
- byte *ptr1 = (byte *)_currBuf->getPixels();
- byte *ptr2 = (byte *)_prevBuf->getPixels();
- for (int i = 0; i < width * height; i++) {
- *ptr1++ = 0;
- *ptr1++ = 128;
- *ptr1++ = 128;
- *ptr2++ = 0;
- *ptr2++ = 128;
- *ptr2++ = 128;
+ _currBuf->create(width, height, _vm->_pixelFormat);
+ _prevBuf->create(width, height, _vm->_pixelFormat);
}
+ // Clear the buffers with black
+ _currBuf->fillRect(Common::Rect(width, height), _vm->_pixelFormat.RGBToColor(0, 0, 0));
+ _prevBuf->fillRect(Common::Rect(width, height), _vm->_pixelFormat.RGBToColor(0, 0, 0));
+
return true;
}
@@ -304,15 +290,28 @@ bool ROQPlayer::processBlockQuadCodebook(ROQBlockHeader &blockHeader) {
}
// Read the 2x2 codebook
+ uint32 *codebook = _codebook2;
+
for (int i = 0; i < newNum2blocks; i++) {
// Read the 4 Y components and their alpha channel
+ byte y[4];
+ byte a[4];
+
for (int j = 0; j < 4; j++) {
- _codebook2[i * 10 + j * 2] = _file->readByte();
- _codebook2[i * 10 + j * 2 + 1] = _alpha ? _file->readByte() : 255;
+ y[j] = _file->readByte();
+ a[j] = _alpha ? _file->readByte() : 255;
}
// Read the subsampled Cb and Cr
- _file->read(&_codebook2[i * 10 + 8], 2);
+ byte u = _file->readByte();
+ byte v = _file->readByte();
+
+ // Convert the codebook to RGB right here
+ for (int j = 0; j < 4; j++) {
+ byte r, g, b;
+ Graphics::YUV2RGB(y[j], u, v, r, g, b);
+ *codebook++ = _vm->_pixelFormat.ARGBToColor(a[j], r, g, b);
+ }
}
// Read the 4x4 codebook
@@ -416,16 +415,15 @@ bool ROQPlayer::processBlockStill(ROQBlockHeader &blockHeader) {
warning("Groovie::ROQ: JPEG frame (unfinished)");
Image::JPEGDecoder jpg;
- jpg.setOutputColorSpace(Image::JPEGDecoder::kColorSpaceYUV);
uint32 startPos = _file->pos();
Common::SeekableSubReadStream subStream(_file, startPos, startPos + blockHeader.size, DisposeAfterUse::NO);
jpg.loadStream(subStream);
const Graphics::Surface *srcSurf = jpg.getSurface();
- const byte *src = (const byte *)srcSurf->getPixels();
- byte *ptr = (byte *)_currBuf->getPixels();
- memcpy(ptr, src, _currBuf->w * _currBuf->h * srcSurf->format.bytesPerPixel);
+ _currBuf->free();
+ delete _currBuf;
+ _currBuf = srcSurf->convertTo(_vm->_pixelFormat);
_file->seek(startPos + blockHeader.size);
return true;
@@ -551,24 +549,17 @@ void ROQPlayer::paint2(byte i, int destx, int desty) {
error("Groovie::ROQ: Invalid 2x2 block %d (%d available)", i, _num2blocks);
}
- byte *block = &_codebook2[i * 10];
- byte u = block[8];
- byte v = block[9];
+ uint32 *block = _codebook2 + i * 4;
- byte *ptr = (byte *)_currBuf->getBasePtr(destx, desty);
for (int y = 0; y < 2; y++) {
for (int x = 0; x < 2; x++) {
- // Basic alpha test
- // TODO: Blending
- if (*(block + 1) > 128) {
- *ptr = *block;
- *(ptr + 1) = u;
- *(ptr + 2) = v;
- }
- ptr += 3;
- block += 2;
+ if (_vm->_pixelFormat.bytesPerPixel == 2)
+ *((uint16 *)_currBuf->getBasePtr(destx + x, desty + y)) = *block;
+ else
+ *((uint32 *)_currBuf->getBasePtr(destx + x, desty + y)) = *block;
+
+ block++;
}
- ptr += _currBuf->pitch - 6;
}
}
@@ -594,25 +585,20 @@ void ROQPlayer::paint8(byte i, int destx, int desty) {
byte *block4 = &_codebook4[i * 4];
for (int y4 = 0; y4 < 2; y4++) {
for (int x4 = 0; x4 < 2; x4++) {
- byte *block2 = &_codebook2[(*block4) * 10];
- byte u = block2[8];
- byte v = block2[9];
- block4++;
+ uint32 *block2 = _codebook2 + *block4++ * 4;
+
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++) {
- // Basic alpha test
- // TODO: Blending
- if (*(block2 + 1) > 128) {
- byte *ptr = (byte *)_currBuf->getBasePtr(destx + x4*4 + x2*2 + repx, desty + y4*4 + y2*2 + repy);
- *ptr = *block2;
- *(ptr + 1) = u;
- *(ptr + 2) = v;
- }
+ 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 += 2;
+
+ block2++;
}
}
}
@@ -633,7 +619,7 @@ void ROQPlayer::copy(byte size, int destx, int desty, int offx, int offy) {
// Move to the beginning of the next line
dst += _currBuf->pitch;
- src += _currBuf->pitch;
+ src += _prevBuf->pitch;
}
}
diff --git a/engines/groovie/roq.h b/engines/groovie/roq.h
index cd5e91c..af68d6c 100644
--- a/engines/groovie/roq.h
+++ b/engines/groovie/roq.h
@@ -71,7 +71,7 @@ private:
// Codebooks
uint16 _num2blocks;
uint16 _num4blocks;
- byte _codebook2[256 * 10];
+ uint32 _codebook2[256 * 4];
byte _codebook4[256 * 4];
// Buffers
Commit: c0a172bc71adeaed22fa53c539c5e3743fb87191
https://github.com/scummvm/scummvm/commit/c0a172bc71adeaed22fa53c539c5e3743fb87191
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2014-06-01T22:08:28-04:00
Commit Message:
GROOVIE: Fix various roq glitches
They should now all decode correctly
Changed paths:
engines/groovie/roq.cpp
engines/groovie/roq.h
diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp
index 118b77e..c7c8831 100644
--- a/engines/groovie/roq.cpp
+++ b/engines/groovie/roq.cpp
@@ -46,7 +46,8 @@ namespace Groovie {
ROQPlayer::ROQPlayer(GroovieEngine *vm) :
VideoPlayer(vm), _codingTypeCount(0),
- _bg(&_vm->_graphicsMan->_background) {
+ _bg(&_vm->_graphicsMan->_background),
+ _firstFrame(true) {
// Create the work surfaces
_currBuf = new Graphics::Surface();
@@ -83,6 +84,9 @@ uint16 ROQPlayer::loadInternal() {
_num2blocks = 0;
_num4blocks = 0;
+ // Reset the first frame flag
+ _firstFrame = true;
+
if ((blockHeader.size == 0) && (blockHeader.param == 0)) {
// Set the offset scaling to 2
_offScale = 2;
@@ -117,6 +121,12 @@ void ROQPlayer::buildShowBuf() {
}
}
+ // On the first frame, copy from the current buffer to the prev buffer
+ if (_firstFrame) {
+ _prevBuf->copyFrom(*_currBuf);
+ _firstFrame = false;
+ }
+
// Swap buffers
SWAP(_prevBuf, _currBuf);
}
@@ -237,6 +247,9 @@ bool ROQPlayer::processBlockInfo(ROQBlockHeader &blockHeader) {
return false;
}
+ // Reset the first frame flag
+ _firstFrame = true;
+
// Save the alpha channel size
_alpha = blockHeader.param;
@@ -412,8 +425,6 @@ void ROQPlayer::processBlockQuadVectorBlockSub(int baseX, int baseY, int8 Mx, in
bool ROQPlayer::processBlockStill(ROQBlockHeader &blockHeader) {
debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing still (JPEG) block");
- warning("Groovie::ROQ: JPEG frame (unfinished)");
-
Image::JPEGDecoder jpg;
uint32 startPos = _file->pos();
diff --git a/engines/groovie/roq.h b/engines/groovie/roq.h
index af68d6c..7e7d385 100644
--- a/engines/groovie/roq.h
+++ b/engines/groovie/roq.h
@@ -82,7 +82,7 @@ private:
byte _offScale;
bool _dirty;
byte _alpha;
-
+ bool _firstFrame;
};
} // End of Groovie namespace
Commit: 3c287aad182d7769f50642e9035f8dad1101d8d3
https://github.com/scummvm/scummvm/commit/3c287aad182d7769f50642e9035f8dad1101d8d3
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2014-06-01T22:08:28-04:00
Commit Message:
GROOVIE: Switch to 32bpp only in groovie2
Needed for alpha
Changed paths:
engines/groovie/cursor.cpp
engines/groovie/groovie.cpp
engines/groovie/roq.cpp
diff --git a/engines/groovie/cursor.cpp b/engines/groovie/cursor.cpp
index 080463a..65f3e10 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 f280188..8ba193e 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 c7c8831..3b82543 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;
}
}
}
More information about the Scummvm-git-logs
mailing list