Skip to content

Commit

Permalink
GROOVIE: Fix video transparency in V2 games
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Nov 3, 2014
1 parent 35577ab commit 2d42ab8
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion engines/groovie/roq.cpp
Expand Up @@ -28,6 +28,7 @@
#include "groovie/groovie.h"

#include "common/debug.h"
#include "common/debug-channels.h"
#include "common/rect.h"
#include "common/substream.h"
#include "common/textconsole.h"
Expand Down Expand Up @@ -63,6 +64,18 @@ ROQPlayer::~ROQPlayer() {
}

uint16 ROQPlayer::loadInternal() {
if (DebugMan.isDebugChannelEnabled(kDebugVideo)) {
int8 i;
debugN(1, "Groovie::ROQ: New ROQ: bitflags are ");
for (i = 15; i >= 0; i--) {
debugN(1, "%d", _flags & (1 << i)? 1 : 0);
if (i % 4 == 0) {
debugN(1, " ");
}
}
debug(1, " <- 0 ");
}

// Begin reading the file
debugC(1, kDebugVideo, "Groovie::ROQ: Loading video");

Expand Down Expand Up @@ -106,13 +119,18 @@ uint16 ROQPlayer::loadInternal() {
}

void ROQPlayer::buildShowBuf() {
uint32 transparent = _alpha ? 0 : _vm->_pixelFormat.RGBToColor(255, 255, 255);

This comment has been minimized.

Copy link
@clone2727

clone2727 Nov 3, 2014

Contributor

So, in any video without transparency, a white pixel is fully transparent? The skulls menu is now broken.

Why are you checking the whole pixel instead of the alpha component?

This comment has been minimized.

Copy link
@bluegr

bluegr Nov 3, 2014

Author Member

Thanks, I'll check that out tonight


for (int line = 0; line < _bg->h; line++) {
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
*out++ = *in;
if (*in != transparent)
*out++ = *in;
else
out++;

// Skip to the next pixel
if (!(x % _scaleX))
Expand Down

2 comments on commit 2d42ab8

@clone2727
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit is very misleading. It most certainly does not fix transparency. Just take a look at the knights puzzle: You're just drawing over the previous frame with transparency now.

@bluegr
Copy link
Member Author

@bluegr bluegr commented on 2d42ab8 Nov 3, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the book puzzle in the library upstairs has the same issue. I'm still not sure what should be done, and there are two alternatives:

  1. The ROQ player should be able to draw on both the foreground and the background buffers, like the VDX player. The video flags should be implemented for that, if they're used in the same way as in the 7th Guest
  2. The ROQ player should draw with transparency only on the foreground layer. This is probably the correct way to do this now, and I am still working on that, although I'd like to see if this change would break something else in the 11th Hour.

Please sign in to comment.