[Scummvm-git-logs] scummvm master -> cf4cba9c20378bf707da2053ee6cf06857165f0e
mgerhardy
martin.gerhardy at gmail.com
Sat Jan 2 13:02:30 UTC 2021
This automated email contains information about 11 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
49deb7e210 TWINE: made constant a member var
d6dbbe7b24 TWINE: allow higher resolutions for fullscreen texts
ca31756744 TWINE: use Common::fill
20c63c3a8e TWINE: reduced scope
a4f8fbd0d8 TWINE: reduced scope
537613a4d1 TWINE: fla code cleanup and minor optimizations
ec24f6a61e TWINE: minor cleanup
67f5c751ef TWINE: minor loop cleanup to unify keyframe and deltaframe code
3ac47eaba1 TWINE: allow different resolutions for fla videos
c20e270817 TWINE: activate pcx 'cutscenes'
cf4cba9c20 TWINE: plasma effect for higher resolutions
Commit: 49deb7e21099a6aa1d2578d35a5b2dd5dbb140ad
https://github.com/scummvm/scummvm/commit/49deb7e21099a6aa1d2578d35a5b2dd5dbb140ad
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T14:02:00+01:00
Commit Message:
TWINE: made constant a member var
Changed paths:
engines/twine/text.cpp
engines/twine/text.h
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index 8f3f0467d6..3f17680c86 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -569,8 +569,7 @@ ProgressiveTextState Text::updateProgressiveText() {
// reached a new line that is about get faded in
_dialTextBoxCurrentLine++;
- const int32 lineHeight = 38;
- _dialTextYPos += lineHeight;
+ _dialTextYPos += _lineHeight;
_dialTextXPos = _dialTextBox.left + 8;
if (_dialTextBoxCurrentLine >= _dialTextBoxLines) {
diff --git a/engines/twine/text.h b/engines/twine/text.h
index fd0a44e019..d02e5a69ff 100644
--- a/engines/twine/text.h
+++ b/engines/twine/text.h
@@ -196,6 +196,7 @@ private:
char *_currDialTextPtr = nullptr;
/** Current dialogue text size */
int32 _currDialTextSize = 0;
+ static const int32 _lineHeight = 38;
char currMenuTextBuffer[256];
int32 currMenuTextBank = TextBankId::None;
Commit: d6dbbe7b24f0194e3952ca39ad381c12a3d38bac
https://github.com/scummvm/scummvm/commit/d6dbbe7b24f0194e3952ca39ad381c12a3d38bac
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T14:02:00+01:00
Commit Message:
TWINE: allow higher resolutions for fullscreen texts
Changed paths:
engines/twine/text.cpp
diff --git a/engines/twine/text.cpp b/engines/twine/text.cpp
index 3f17680c86..a175174f25 100644
--- a/engines/twine/text.cpp
+++ b/engines/twine/text.cpp
@@ -736,25 +736,29 @@ bool Text::getMenuText(int32 index, char *text, uint32 textSize) {
}
void Text::textClipFull() {
- const int padding = 9;
- _dialTextBox.left = padding - 1;
- _dialTextBox.top = padding - 1;
- _dialTextBox.right = SCREEN_WIDTH - padding;
- _dialTextBox.bottom = SCREEN_HEIGHT - padding;
+ const int32 margin = 8;
+ const int32 padding = 8;
+ _dialTextBox.left = margin;
+ _dialTextBox.top = margin;
+ _dialTextBox.right = SCREEN_WIDTH - margin;
+ _dialTextBox.bottom = SCREEN_HEIGHT - margin;
- _dialTextBoxLines = 11;
- _dialTextBoxMaxX = SCREEN_WIDTH - 33;
+ _dialTextBoxLines = (int32)(_dialTextBox.height() / _lineHeight) - 1;
+ _dialTextBoxMaxX = SCREEN_WIDTH - 2 * margin - 2 * padding;
}
void Text::textClipSmall() {
- const int padding = 17;
- _dialTextBox.left = padding - 1;
- _dialTextBox.top = SCREEN_HEIGHT - 146;
- _dialTextBox.right = SCREEN_WIDTH - padding;
- _dialTextBox.bottom = SCREEN_HEIGHT - padding;
-
+ const int32 margin = 16;
+ const int32 padding = 8;
_dialTextBoxLines = 3;
- _dialTextBoxMaxX = SCREEN_WIDTH - 49;
+ const int32 textHeight = _dialTextBoxLines * _lineHeight;
+
+ _dialTextBox.left = margin;
+ _dialTextBox.top = SCREEN_HEIGHT - textHeight - margin - padding;
+ _dialTextBox.right = SCREEN_WIDTH - margin;
+ _dialTextBox.bottom = SCREEN_HEIGHT - margin;
+
+ _dialTextBoxMaxX = SCREEN_WIDTH - 2 * margin + 2 * padding;
}
void Text::drawAskQuestion(int32 index) {
Commit: ca31756744f0772be45a5d3f2d980473699ac56e
https://github.com/scummvm/scummvm/commit/ca31756744f0772be45a5d3f2d980473699ac56e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T14:02:00+01:00
Commit Message:
TWINE: use Common::fill
Changed paths:
engines/twine/flamovies.cpp
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index 2fa6b966bb..dc5527d576 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -136,15 +136,14 @@ void FlaMovies::scaleFla2x() {
uint8 *dest = (uint8 *)_engine->workVideoBuffer.getPixels();
if (_engine->cfgfile.Movie == CONF_MOVIE_FLAWIDE) {
- for (uint32 i = 0; i < SCREEN_WIDTH * 40; i++) {
- *(dest++) = 0x00;
- }
+ Common::fill(&dest[0], &dest[SCREEN_WIDTH * 40], 0x00);
+ dest += SCREEN_WIDTH * 40;
}
for (int32 i = 0; i < FLASCREEN_HEIGHT; i++) {
for (int32 j = 0; j < FLASCREEN_WIDTH; j++) {
- *(dest++) = *(source);
- *(dest++) = *(source++);
+ *dest++ = *source;
+ *dest++ = *source++;
}
if (_engine->cfgfile.Movie == CONF_MOVIE_FLAWIDE) { // include wide bars
memcpy(dest, dest - SCREEN_WIDTH, FLASCREEN_WIDTH * 2);
@@ -162,9 +161,7 @@ void FlaMovies::scaleFla2x() {
}
if (_engine->cfgfile.Movie == CONF_MOVIE_FLAWIDE) {
- for (int32 i = 0; i < SCREEN_WIDTH * 40; i++) {
- *(dest++) = 0x00;
- }
+ Common::fill(&dest[0], &dest[SCREEN_WIDTH * 40], 0x00);
}
}
Commit: 20c63c3a8eae6c901ec9161c5c9e330e4f43824a
https://github.com/scummvm/scummvm/commit/20c63c3a8eae6c901ec9161c5c9e330e4f43824a
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T14:02:00+01:00
Commit Message:
TWINE: reduced scope
Changed paths:
engines/twine/flamovies.cpp
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index dc5527d576..0de917b02e 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -167,7 +167,6 @@ void FlaMovies::scaleFla2x() {
void FlaMovies::processFrame() {
FLASampleStruct sample;
- uint32 opcodeBlockSize;
int32 aux = 0;
file.read(&frameData.videoSize, 1);
@@ -187,9 +186,9 @@ void FlaMovies::processFrame() {
Common::MemoryReadStream stream(outBuf, frameData.frameVar0);
do {
- uint8 opcode = stream.readByte();
+ const uint8 opcode = stream.readByte();
stream.skip(1);
- opcodeBlockSize = stream.readUint16LE();
+ const uint32 opcodeBlockSize = stream.readUint16LE();
const int32 pos = stream.pos();
switch (opcode - 1) {
@@ -241,9 +240,7 @@ void FlaMovies::processFrame() {
aux++;
stream.seek(pos + opcodeBlockSize);
-
} while (aux < (int32)frameData.videoSize);
- //free(workVideoBufferCopy);
}
/** Play FLA PCX Screens
Commit: a4f8fbd0d827b694de2504e04896f7bb11c6579b
https://github.com/scummvm/scummvm/commit/a4f8fbd0d827b694de2504e04896f7bb11c6579b
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T14:02:01+01:00
Commit Message:
TWINE: reduced scope
Changed paths:
engines/twine/flamovies.cpp
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index 0de917b02e..2f08c1a5ec 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -90,29 +90,20 @@ void FlaMovies::drawKeyFrame(Common::MemoryReadStream &stream, int32 width, int3
}
void FlaMovies::drawDeltaFrame(Common::MemoryReadStream &stream, int32 width) {
- int32 a, b;
- uint16 skip;
- uint8 *destPtr;
- uint8 *startOfLine;
- int32 height;
-
- int8 flag1;
- int8 flag2;
-
- skip = stream.readUint16LE();
- skip *= width;
- startOfLine = destPtr = (uint8 *)flaBuffer + skip;
- height = stream.readSint16LE();
+ uint16 skip = stream.readUint16LE() * width;
+ uint8 *destPtr = (uint8 *)flaBuffer + skip;
+ uint8 *startOfLine = destPtr;
+ int32 height = stream.readSint16LE();
- do {
- flag1 = stream.readByte();
+ for (int32 y = 0; y < height; ++y) {
+ const int8 flag1 = stream.readByte();
- for (a = 0; a < flag1; a++) {
+ for (int32 a = 0; a < flag1; a++) {
destPtr += stream.readByte();
- flag2 = stream.readByte();
+ int8 flag2 = stream.readByte();
if (flag2 > 0) {
- for (b = 0; b < flag2; b++) {
+ for (int32 b = 0; b < flag2; b++) {
*(destPtr++) = stream.readByte();
}
} else {
@@ -121,14 +112,14 @@ void FlaMovies::drawDeltaFrame(Common::MemoryReadStream &stream, int32 width) {
colorFill = stream.readByte();
- for (b = 0; b < flag2; b++) {
+ for (int32 b = 0; b < flag2; b++) {
*(destPtr++) = colorFill;
}
}
}
startOfLine = destPtr = startOfLine + width;
- } while (--height);
+ }
}
void FlaMovies::scaleFla2x() {
Commit: 537613a4d16897c53f929e718b8ca07d27bf705b
https://github.com/scummvm/scummvm/commit/537613a4d16897c53f929e718b8ca07d27bf705b
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T14:02:01+01:00
Commit Message:
TWINE: fla code cleanup and minor optimizations
Changed paths:
engines/twine/flamovies.cpp
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index 2f08c1a5ec..13ca0e7b4d 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -90,31 +90,27 @@ void FlaMovies::drawKeyFrame(Common::MemoryReadStream &stream, int32 width, int3
}
void FlaMovies::drawDeltaFrame(Common::MemoryReadStream &stream, int32 width) {
- uint16 skip = stream.readUint16LE() * width;
+ const uint16 skip = stream.readUint16LE() * width;
+ const int32 height = stream.readSint16LE();
+
uint8 *destPtr = (uint8 *)flaBuffer + skip;
uint8 *startOfLine = destPtr;
- int32 height = stream.readSint16LE();
-
for (int32 y = 0; y < height; ++y) {
- const int8 flag1 = stream.readByte();
+ const int8 lineEntryCount = stream.readByte();
- for (int32 a = 0; a < flag1; a++) {
+ for (int8 a = 0; a < lineEntryCount; ++a) {
destPtr += stream.readByte();
- int8 flag2 = stream.readByte();
+ const int8 rleFlag = stream.readByte();
- if (flag2 > 0) {
- for (int32 b = 0; b < flag2; b++) {
- *(destPtr++) = stream.readByte();
+ if (rleFlag > 0) {
+ for (int8 b = 0; b < rleFlag; ++b) {
+ *destPtr++ = stream.readByte();
}
} else {
- char colorFill;
- flag2 = -flag2;
-
- colorFill = stream.readByte();
-
- for (int32 b = 0; b < flag2; b++) {
- *(destPtr++) = colorFill;
- }
+ const char colorFill = stream.readByte();
+ const int8 rleCnt = ABS(rleFlag);
+ Common::fill(&destPtr[0], &destPtr[rleCnt], colorFill);
+ destPtr += rleCnt;
}
}
Commit: ec24f6a61e39d38ccd08fe15fc0e45087a2d09ac
https://github.com/scummvm/scummvm/commit/ec24f6a61e39d38ccd08fe15fc0e45087a2d09ac
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T14:02:01+01:00
Commit Message:
TWINE: minor cleanup
Changed paths:
engines/twine/flamovies.cpp
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index 13ca0e7b4d..1510f702dc 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -154,7 +154,6 @@ void FlaMovies::scaleFla2x() {
void FlaMovies::processFrame() {
FLASampleStruct sample;
- int32 aux = 0;
file.read(&frameData.videoSize, 1);
file.read(&frameData.dummy, 1);
@@ -172,7 +171,7 @@ void FlaMovies::processFrame() {
}
Common::MemoryReadStream stream(outBuf, frameData.frameVar0);
- do {
+ for (int32 frame = 0; frame < frameData.videoSize; ++frame) {
const uint8 opcode = stream.readByte();
stream.skip(1);
const uint32 opcodeBlockSize = stream.readUint16LE();
@@ -212,8 +211,9 @@ void FlaMovies::processFrame() {
}
case kDeltaFrame: {
drawDeltaFrame(stream, FLASCREEN_WIDTH);
- if (_fadeOut == 1)
- fadeOutFrames++;
+ if (_fadeOut == 1) {
+ ++fadeOutFrames;
+ }
break;
}
case kKeyFrame: {
@@ -225,9 +225,8 @@ void FlaMovies::processFrame() {
}
}
- aux++;
stream.seek(pos + opcodeBlockSize);
- } while (aux < (int32)frameData.videoSize);
+ }
}
/** Play FLA PCX Screens
Commit: 67f5c751ef48d3e28f83dbbb88190f04b97378a9
https://github.com/scummvm/scummvm/commit/67f5c751ef48d3e28f83dbbb88190f04b97378a9
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T14:02:01+01:00
Commit Message:
TWINE: minor loop cleanup to unify keyframe and deltaframe code
Changed paths:
engines/twine/flamovies.cpp
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index 1510f702dc..541e63230f 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -65,28 +65,26 @@ void FlaMovies::drawKeyFrame(Common::MemoryReadStream &stream, int32 width, int3
uint8 *destPtr = (uint8 *)flaBuffer;
uint8 *startOfLine = destPtr;
- do {
- int8 flag1 = stream.readByte();
+ for (int32 y = 0; y < height; ++y) {
+ const int8 lineEntryCount = stream.readByte();
- for (int8 a = 0; a < flag1; a++) {
- int8 flag2 = stream.readByte();
+ for (int8 a = 0; a < lineEntryCount; a++) {
+ const int8 rleFlag = stream.readByte();
- if (flag2 < 0) {
- flag2 = -flag2;
- for (int8 b = 0; b < flag2; b++) {
- *(destPtr++) = stream.readByte();
+ if (rleFlag < 0) {
+ const int8 rleCnt = ABS(rleFlag);
+ for (int8 b = 0; b < rleCnt; ++b) {
+ *destPtr++ = stream.readByte();
}
} else {
- char colorFill = stream.readByte();
-
- for (int8 b = 0; b < flag2; b++) {
- *(destPtr++) = colorFill;
- }
+ const char colorFill = stream.readByte();
+ Common::fill(&destPtr[0], &destPtr[rleFlag], colorFill);
+ destPtr += rleFlag;
}
}
startOfLine = destPtr = startOfLine + width;
- } while (--height);
+ }
}
void FlaMovies::drawDeltaFrame(Common::MemoryReadStream &stream, int32 width) {
Commit: 3ac47eaba1d3290ef8c16a6e63fa9b6702b1aa0c
https://github.com/scummvm/scummvm/commit/3ac47eaba1d3290ef8c16a6e63fa9b6702b1aa0c
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T14:02:01+01:00
Commit Message:
TWINE: allow different resolutions for fla videos
Changed paths:
engines/twine/flamovies.cpp
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index 541e63230f..cb4fe53048 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -118,11 +118,11 @@ void FlaMovies::drawDeltaFrame(Common::MemoryReadStream &stream, int32 width) {
void FlaMovies::scaleFla2x() {
uint8 *source = (uint8 *)flaBuffer;
- uint8 *dest = (uint8 *)_engine->workVideoBuffer.getPixels();
+ uint8 *dest = (uint8 *)_engine->imageBuffer.getPixels();
if (_engine->cfgfile.Movie == CONF_MOVIE_FLAWIDE) {
- Common::fill(&dest[0], &dest[SCREEN_WIDTH * 40], 0x00);
- dest += SCREEN_WIDTH * 40;
+ Common::fill(&dest[0], &dest[_engine->imageBuffer.w * 40], 0x00);
+ dest += _engine->imageBuffer.w * 40;
}
for (int32 i = 0; i < FLASCREEN_HEIGHT; i++) {
@@ -131,22 +131,22 @@ void FlaMovies::scaleFla2x() {
*dest++ = *source++;
}
if (_engine->cfgfile.Movie == CONF_MOVIE_FLAWIDE) { // include wide bars
- memcpy(dest, dest - SCREEN_WIDTH, FLASCREEN_WIDTH * 2);
+ memcpy(dest, dest - _engine->imageBuffer.w, FLASCREEN_WIDTH * 2);
dest += FLASCREEN_WIDTH * 2;
} else { // stretch the movie like original game.
if (i % 2) {
- memcpy(dest, dest - SCREEN_WIDTH, FLASCREEN_WIDTH * 2);
+ memcpy(dest, dest - _engine->imageBuffer.w, FLASCREEN_WIDTH * 2);
dest += FLASCREEN_WIDTH * 2;
}
if (i % 10) {
- memcpy(dest, dest - SCREEN_WIDTH, FLASCREEN_WIDTH * 2);
+ memcpy(dest, dest - _engine->imageBuffer.w, FLASCREEN_WIDTH * 2);
dest += FLASCREEN_WIDTH * 2;
}
}
}
if (_engine->cfgfile.Movie == CONF_MOVIE_FLAWIDE) {
- Common::fill(&dest[0], &dest[SCREEN_WIDTH * 40], 0x00);
+ Common::fill(&dest[0], &dest[_engine->imageBuffer.w * 40], 0x00);
}
}
@@ -156,12 +156,12 @@ void FlaMovies::processFrame() {
file.read(&frameData.videoSize, 1);
file.read(&frameData.dummy, 1);
file.read(&frameData.frameVar0, 4);
- if (frameData.frameVar0 > _engine->workVideoBuffer.w * _engine->workVideoBuffer.h) {
+ if (frameData.frameVar0 > _engine->imageBuffer.w * _engine->imageBuffer.h) {
warning("Skipping video frame - it would exceed the screen buffer: %i", frameData.frameVar0);
return;
}
- uint8 *outBuf = (uint8 *)_engine->workVideoBuffer.getPixels();
+ uint8 *outBuf = (uint8 *)_engine->imageBuffer.getPixels();
file.read(outBuf, frameData.frameVar0);
if ((int32)frameData.videoSize <= 0) {
@@ -292,15 +292,17 @@ void FlaMovies::playFlaMovie(const char *flaName) {
}
processFrame();
scaleFla2x();
- _engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
+ _engine->frontVideoBuffer.transBlitFrom(_engine->imageBuffer, _engine->imageBuffer.getBounds(), _engine->frontVideoBuffer.getBounds());
// Only blit to screen if isn't a fade
if (_fadeOut == -1) {
_engine->_screens->convertPalToRGBA(_engine->_screens->palette, _engine->_screens->paletteRGBACustom);
- if (!currentFrame) // fade in the first frame
+ if (!currentFrame) {
+ // fade in the first frame
_engine->_screens->fadeIn(_engine->_screens->paletteRGBACustom);
- else
+ } else {
_engine->setPalette(_engine->_screens->paletteRGBACustom);
+ }
}
// TRICKY: fade in tricky
Commit: c20e2708174e81fc6d40ba9ef817432d68a6fc04
https://github.com/scummvm/scummvm/commit/c20e2708174e81fc6d40ba9ef817432d68a6fc04
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T14:02:01+01:00
Commit Message:
TWINE: activate pcx 'cutscenes'
Changed paths:
engines/twine/flamovies.cpp
engines/twine/flamovies.h
diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index cb4fe53048..d71a977d74 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -23,11 +23,14 @@
#include "twine/flamovies.h"
#include "common/file.h"
#include "common/system.h"
+#include "image/pcx.h"
#include "twine/audio/music.h"
#include "twine/audio/sound.h"
-#include "twine/scene/grid.h"
#include "twine/input.h"
#include "twine/renderer/screens.h"
+#include "twine/resources/hqr.h"
+#include "twine/resources/resources.h"
+#include "twine/scene/grid.h"
#include "twine/twine.h"
namespace TwinE {
@@ -227,20 +230,89 @@ void FlaMovies::processFrame() {
}
}
-/** Play FLA PCX Screens
- @param flaName FLA movie name */
-static void fla_pcxList(const char *flaName) {
- // TODO if is using FLA PCX than show the images instead
+FlaMovies::FlaMovies(TwinEEngine *engine) : _engine(engine) {}
+
+void FlaMovies::preparePCX(int index) {
+ Image::PCXDecoder pcxDecoder;
+ Common::SeekableReadStream *stream = HQR::makeReadStream("FLA_PCX.HQR", index);
+ if (stream != nullptr) {
+ if (!pcxDecoder.loadStream(*stream)) {
+ delete stream;
+ return;
+ }
+ }
+ const Graphics::Surface *surface = pcxDecoder.getSurface();
+ if (surface != nullptr) {
+ const Common::Rect srect(0, 0, surface->w, surface->h);
+ _engine->frontVideoBuffer.transBlitFrom(*surface, srect, _engine->frontVideoBuffer.getBounds());
+ }
+ delete stream;
+ // TODO FLA_GIF.HQR
}
-FlaMovies::FlaMovies(TwinEEngine *engine) : _engine(engine) {}
+void FlaMovies::playPCXMovie(const char *flaName) {
+ if (!Common::File::exists("FLA_PCX.HQR") || !Common::File::exists("FLA_GIF.HQR")) {
+ warning("FLA_PCX file doesn't exist!");
+ return;
+ }
+
+ // TODO: use the HQR 23th entry (movies informations)
+ if (!strcmp(flaName, FLA_INTROD)) {
+ preparePCX(1);
+ g_system->delayMillis(5000);
+ preparePCX(2);
+ g_system->delayMillis(5000);
+ preparePCX(3);
+ g_system->delayMillis(5000);
+ preparePCX(4);
+ g_system->delayMillis(5000);
+ preparePCX(5);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "BAFFE") || !strcmp(flaName, "BAFFE2") || !strcmp(flaName, "BAFFE3") || !strcmp(flaName, "BAFFE4")) {
+ preparePCX(6);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "bateau") || !strcmp(flaName, "bateau2")) {
+ preparePCX(7);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "flute2")) {
+ preparePCX(8);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "navette")) {
+ preparePCX(15);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "templebu")) {
+ preparePCX(12);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "glass2")) {
+ preparePCX(8);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "surf")) {
+ preparePCX(9);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "verser") || !strcmp(flaName, "verser2")) {
+ preparePCX(10);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "capture")) {
+ preparePCX(14);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "neige2")) {
+ preparePCX(11);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "sendel")) {
+ preparePCX(14);
+ g_system->delayMillis(5000);
+ } else if (!strcmp(flaName, "sendel2")) {
+ preparePCX(17);
+ g_system->delayMillis(5000);
+ }
+}
void FlaMovies::playFlaMovie(const char *flaName) {
_engine->_sound->stopSamples();
// Play FLA PCX instead of movies
if (_engine->cfgfile.Movie == CONF_MOVIE_FLAPCX) {
- fla_pcxList(flaName);
+ playPCXMovie(flaName);
return;
}
@@ -297,7 +369,7 @@ void FlaMovies::playFlaMovie(const char *flaName) {
// Only blit to screen if isn't a fade
if (_fadeOut == -1) {
_engine->_screens->convertPalToRGBA(_engine->_screens->palette, _engine->_screens->paletteRGBACustom);
- if (!currentFrame) {
+ if (currentFrame == 0) {
// fade in the first frame
_engine->_screens->fadeIn(_engine->_screens->paletteRGBACustom);
} else {
@@ -327,108 +399,4 @@ void FlaMovies::playFlaMovie(const char *flaName) {
_engine->_sound->stopSamples();
}
-/*
-void fla_pcxList(char *flaName)
-{
- // check if FLAPCX file exist
-// if(!checkIfFileExist("FLA_PCX.HQR") || !checkIfFileExist("FLA_GIF.HQR")){
-// printf("FLA_PCX file doesn't exist!");
- //return;
- //}
-
- // TODO: done this with the HQR 23th entry (movies informations)
- if(!strcmp(flaName,"INTROD"))
- {
- prepareFlaPCX(1);
- WaitTime(5000);
- prepareFlaPCX(2);
- WaitTime(5000);
- prepareFlaPCX(3);
- WaitTime(5000);
- prepareFlaPCX(4);
- WaitTime(5000);
- prepareFlaPCX(5);
- WaitTime(5000);
-
- }
- else if(!strcmp(flaName,"BAFFE") || !strcmp(flaName,"BAFFE2") || !strcmp(flaName,"BAFFE3") || !strcmp(flaName,"BAFFE4"))
- {
- prepareFlaPCX(6);
- WaitTime(5000);
- }
- else if(!strcmp(flaName,"bateau") || !strcmp(flaName,"bateau2"))
- {
- prepareFlaPCX(7);
- WaitTime(5000);
- }
- else if(!strcmp(flaName,"flute2"))
- {
- prepareFlaPCX(8);
- WaitTime(5000);
- }
- else if(!strcmp(flaName,"navette"))
- {
- prepareFlaPCX(15);
- WaitTime(5000);
- }
- else if(!strcmp(flaName,"templebu"))
- {
- prepareFlaPCX(12);
- WaitTime(5000);
- }
- else if(!strcmp(flaName,"glass2"))
- {
- prepareFlaPCX(8);
- WaitTime(5000);
- }
- else if(!strcmp(flaName,"surf"))
- {
- prepareFlaPCX(9);
- WaitTime(5000);
- }
- else if(!strcmp(flaName,"verser") || !strcmp(flaName,"verser2"))
- {
- prepareFlaPCX(10);
- WaitTime(5000);
- }
- else if(!strcmp(flaName,"capture"))
- {
- prepareFlaPCX(14);
- WaitTime(5000);
- }
- else if(!strcmp(flaName,"neige2"))
- {
- prepareFlaPCX(11);
- WaitTime(5000);
- }
- else if(!strcmp(flaName,"sendel"))
- {
- prepareFlaPCX(14);
- WaitTime(5000);
- }
- else if(!strcmp(flaName,"sendel2"))
- {
- prepareFlaPCX(17);
- WaitTime(5000);
- }
-}
-
-void prepareFlaPCX(int index)
-{
- int i;
- SDL_Surface *image;
-
- // TODO: Done this without SDL_Image Library
- if(checkIfFileExist("FLA_PCX.HQR"))
- image = IMG_LoadPCX_RW(SDL_RWFromMem(HQR_Get(HQR_FlaPCX,index), Size_HQR("FLA_PCX.HQR", index))); // rwop
- else if(checkIfFileExist("FLA_GIF.HQR"))
- image = IMG_LoadGIF_RW(SDL_RWFromMem(HQR_Get(HQR_FlaGIF,index), Size_HQR("fla_gif.hqr", index))); // rwop
-
- if(!image) {
- printf("Can't load FLA PCX: %s\n", IMG_GetError());
- }
-
- osystem_FlaPCXCrossFade(image);
-}*/
-
} // namespace TwinE
diff --git a/engines/twine/flamovies.h b/engines/twine/flamovies.h
index 5bc985970e..9b92477795 100644
--- a/engines/twine/flamovies.h
+++ b/engines/twine/flamovies.h
@@ -93,6 +93,9 @@ private:
void scaleFla2x();
void processFrame();
+ void preparePCX(int index);
+ void playPCXMovie(const char *flaName);
+
public:
FlaMovies(TwinEEngine *engine);
Commit: cf4cba9c20378bf707da2053ee6cf06857165f0e
https://github.com/scummvm/scummvm/commit/cf4cba9c20378bf707da2053ee6cf06857165f0e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-01-02T14:02:01+01:00
Commit Message:
TWINE: plasma effect for higher resolutions
Changed paths:
engines/twine/debugger/debug.cpp
engines/twine/menu/menu.cpp
engines/twine/menu/menu.h
engines/twine/menu/menuoptions.cpp
diff --git a/engines/twine/debugger/debug.cpp b/engines/twine/debugger/debug.cpp
index 48dc983144..ddc47a274f 100644
--- a/engines/twine/debugger/debug.cpp
+++ b/engines/twine/debugger/debug.cpp
@@ -401,7 +401,7 @@ int32 Debug::debugProcessButton(int32 x, int32 y) {
}
void Debug::debugPlasmaWindow(const char *text, int32 color) {
- _engine->_menu->processPlasmaEffect(0, 5, color);
+ _engine->_menu->processPlasmaEffect(Common::Rect(0, 0, PLASMA_WIDTH, PLASMA_HEIGHT), color);
if (!(_engine->getRandomNumber() % 5)) {
_engine->_menu->plasmaEffectPtr[_engine->getRandomNumber() % PLASMA_WIDTH * 10 + 6400] = 255;
}
diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index ea70f1c276..18e5566d36 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -209,16 +209,16 @@ void Menu::plasmaEffectRenderFrame() {
memcpy(plasmaEffectPtr, src, PLASMA_HEIGHT * PLASMA_WIDTH);
}
-void Menu::processPlasmaEffect(int32 left, int32 top, int32 color) {
+void Menu::processPlasmaEffect(const Common::Rect &rect, int32 color) {
const int32 max_value = color + 15;
plasmaEffectRenderFrame();
const uint8 *in = plasmaEffectPtr + 5 * PLASMA_WIDTH;
- uint8 *out = (uint8 *)_engine->frontVideoBuffer.getBasePtr(left, top);
+ uint8 *out = (uint8 *)_engine->imageBuffer.getBasePtr(0, 0);
for (int32 y = 0; y < PLASMA_HEIGHT / 2; y++) {
- int32 yOffset = y * SCREEN_WIDTH;
+ int32 yOffset = y * _engine->imageBuffer.w;
const uint8 *colPtr = &in[y * PLASMA_WIDTH];
for (int32 x = 0; x < PLASMA_WIDTH; x++) {
const uint8 c = MIN(*colPtr / 2 + color, max_value);
@@ -226,12 +226,14 @@ void Menu::processPlasmaEffect(int32 left, int32 top, int32 color) {
const int32 target = 2 * yOffset;
out[target + 0] = c;
out[target + 1] = c;
- out[target + SCREEN_WIDTH + 0] = c;
- out[target + SCREEN_WIDTH + 1] = c;
+ out[target + _engine->imageBuffer.w + 0] = c;
+ out[target + _engine->imageBuffer.w + 1] = c;
++colPtr;
++yOffset;
}
}
+ const Common::Rect prect(0, 0, PLASMA_WIDTH, PLASMA_HEIGHT);
+ _engine->frontVideoBuffer.transBlitFrom(_engine->imageBuffer, prect, rect);
}
void Menu::drawBox(const Common::Rect &rect) {
@@ -277,13 +279,13 @@ void Menu::drawButtonGfx(const MenuSettings *menuSettings, const Common::Rect &r
}
}
- processPlasmaEffect(rect.left, rect.top, 80);
+ processPlasmaEffect(rect, 80);
if (!(_engine->getRandomNumber() % 5)) {
plasmaEffectPtr[_engine->getRandomNumber() % 140 * 10 + 1900] = 255;
}
_engine->_interface->drawSplittedBox(Common::Rect(newWidth, rect.top, rect.right, rect.bottom), 68);
} else {
- processPlasmaEffect(rect.left, rect.top, 64);
+ processPlasmaEffect(rect, 64);
if (!(_engine->getRandomNumber() % 5)) {
plasmaEffectPtr[_engine->getRandomNumber() % 320 * 10 + 6400] = 255;
}
diff --git a/engines/twine/menu/menu.h b/engines/twine/menu/menu.h
index 699122a43d..b6bdb35cfa 100644
--- a/engines/twine/menu/menu.h
+++ b/engines/twine/menu/menu.h
@@ -30,7 +30,7 @@
namespace TwinE {
#define MAX_BUTTONS 10
-#define PLASMA_WIDTH (SCREEN_WIDTH / 2)
+#define PLASMA_WIDTH 320
#define PLASMA_HEIGHT 50
#define kQuitEngine 9998
@@ -203,10 +203,9 @@ public:
/**
* Process the plasma effect
- * @param top top height where the effect will be draw in the front buffer
* @param color plasma effect start color
*/
- void processPlasmaEffect(int32 left, int32 top, int32 color);
+ void processPlasmaEffect(const Common::Rect &rect, int32 color);
/**
* Draw the entire button box
diff --git a/engines/twine/menu/menuoptions.cpp b/engines/twine/menu/menuoptions.cpp
index 7d544a9425..00f3c288cc 100644
--- a/engines/twine/menu/menuoptions.cpp
+++ b/engines/twine/menu/menuoptions.cpp
@@ -212,13 +212,13 @@ void MenuOptions::drawSelectableCharacters() {
void MenuOptions::drawPlayerName(int32 centerx, int32 top, int32 type) {
const int32 left = 10;
- if (type == 1) {
- _engine->_menu->processPlasmaEffect(left, top, 32);
- }
-
const int right = SCREEN_WIDTH - left;
const int bottom = top + PLASMA_HEIGHT;
const Common::Rect rect(left, top, right, bottom);
+ if (type == 1) {
+ _engine->_menu->processPlasmaEffect(rect, 32);
+ }
+
Common::Rect rectBox(rect);
rectBox.grow(-1);
_engine->_menu->drawBox(rect);
More information about the Scummvm-git-logs
mailing list