[Scummvm-git-logs] scummvm master -> a6bee101659a6252791b2305e8a2b342ffe528a1
bluegr
noreply at scummvm.org
Tue Dec 28 13:02:19 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
a6bee10165 BURIED: Add support and game option for video skipping - FR #12891
Commit: a6bee101659a6252791b2305e8a2b342ffe528a1
https://github.com/scummvm/scummvm/commit/a6bee101659a6252791b2305e8a2b342ffe528a1
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2021-12-28T15:01:37+02:00
Commit Message:
BURIED: Add support and game option for video skipping - FR #12891
Video skipping is done with the escape key and is enabled by default,
but can be disabled with the new "skip support" game option to keep
the original game behavior where video skipping isn't possible
Changed paths:
engines/buried/buried.cpp
engines/buried/buried.h
engines/buried/detection.cpp
engines/buried/detection_tables.h
engines/buried/video_window.cpp
engines/buried/video_window.h
diff --git a/engines/buried/buried.cpp b/engines/buried/buried.cpp
index d5db784eee1..0464301b4d6 100644
--- a/engines/buried/buried.cpp
+++ b/engines/buried/buried.cpp
@@ -60,6 +60,7 @@ BuriedEngine::BuriedEngine(OSystem *syst, const ADGameDescription *gameDesc) : E
_captureWindow = nullptr;
_pauseStartTime = 0;
_yielding = false;
+ _allowVideoSkip = true;
const Common::FSNode gameDataDir(ConfMan.get("path"));
SearchMan.addSubDirectoryMatching(gameDataDir, "WIN31/MANUAL", 0, 2); // v1.05 era
@@ -84,6 +85,9 @@ BuriedEngine::~BuriedEngine() {
Common::Error BuriedEngine::run() {
setDebugger(new BuriedConsole(this));
+ ConfMan.registerDefault("skip_support", true);
+ _allowVideoSkip = ConfMan.getBool("skip_support");
+
if (isTrueColor()) {
initGraphics(640, 480, nullptr);
@@ -310,6 +314,36 @@ void BuriedEngine::postMessageToWindow(Window *dest, Message *message) {
_messageQueue.push_back(msg);
}
+void BuriedEngine::processVideoSkipMessages() {
+ for (MessageQueue::iterator it = _messageQueue.begin(); it != _messageQueue.end();) {
+ MessageType messageType = it->message->getMessageType();
+
+ if (messageType == kMessageTypeKeyUp) {
+ Common::KeyState keyState = ((KeyUpMessage *)it->message)->getKeyState();
+
+ // Send any skip video keyup events to the video player
+ if (keyState.keycode == Common::KEYCODE_ESCAPE) {
+ for (VideoList::iterator it2 = _videos.begin(); it2 != _videos.end(); ++it2) {
+ (*it2)->onKeyUp(keyState, ((KeyUpMessage *)it->message)->getFlags());
+ }
+ delete it->message;
+ it = _messageQueue.erase(it);
+ }
+ } else if (messageType == kMessageTypeKeyDown) {
+ Common::KeyState keyState = ((KeyDownMessage *)it->message)->getKeyState();
+
+ // Erase any skip video keydown events from the queue, to avoid
+ // interpreting them as game quit events after the video ends
+ if (keyState.keycode == Common::KEYCODE_ESCAPE) {
+ delete it->message;
+ it = _messageQueue.erase(it);
+ }
+ } else {
+ ++it;
+ }
+ }
+}
+
void BuriedEngine::sendAllMessages() {
while (!shouldQuit() && !_messageQueue.empty()) {
MessageInfo msg = _messageQueue.front();
@@ -397,8 +431,10 @@ void BuriedEngine::yield() {
pollForEvents();
- // We don't send messages any messages from here. Otherwise, this is the same
+ // We only send video skipping messages from here. Otherwise, this is the same
// as our main loop.
+ if (_allowVideoSkip)
+ processVideoSkipMessages();
_gfx->updateScreen();
_system->delayMillis(10);
diff --git a/engines/buried/buried.h b/engines/buried/buried.h
index 268f649708c..616dd553977 100644
--- a/engines/buried/buried.h
+++ b/engines/buried/buried.h
@@ -124,6 +124,7 @@ public:
// Messaging
void postMessageToWindow(Window *dest, Message *message);
void sendAllMessages();
+ void processVideoSkipMessages();
void removeKeyboardMessages(Window *window);
void removeMouseMessages(Window *window);
void removeAllMessages(Window *window);
@@ -167,6 +168,7 @@ private:
VideoList _videos;
bool _yielding;
+ bool _allowVideoSkip;
struct MessageInfo { // I did think about calling this "Envelope"
Window *dest;
diff --git a/engines/buried/detection.cpp b/engines/buried/detection.cpp
index 15d205db640..03ec13670bc 100644
--- a/engines/buried/detection.cpp
+++ b/engines/buried/detection.cpp
@@ -26,6 +26,7 @@
#include "common/file.h"
#include "common/savefile.h"
#include "common/system.h"
+#include "common/translation.h"
#include "buried/buried.h"
@@ -44,12 +45,29 @@ static const char *directoryGlobs[] = {
nullptr
};
+static const ADExtraGuiOptionsMap optionsList[] = {
+ {
+ GAMEOPTION_ALLOW_SKIP,
+ {
+ // I18N: This option allows the user to skip cutscenes.
+ _s("Skip support"),
+ _s("Allow cutscenes to be skipped"),
+ "skip_support",
+ true
+ }
+ },
+ AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
} // End of namespace Buried
class BuriedMetaEngineDetection : public AdvancedMetaEngineDetection {
public:
- BuriedMetaEngineDetection() : AdvancedMetaEngineDetection(Buried::gameDescriptions, sizeof(ADGameDescription), buriedGames) {
+ BuriedMetaEngineDetection() : AdvancedMetaEngineDetection(
+ Buried::gameDescriptions,
+ sizeof(ADGameDescription),
+ buriedGames,
+ Buried::optionsList) {
_flags = kADFlagUseExtraAsHint;
_maxScanDepth = 3;
_directoryGlobs = Buried::directoryGlobs;
diff --git a/engines/buried/detection_tables.h b/engines/buried/detection_tables.h
index dfe0b79ed8d..c5725cfa52b 100644
--- a/engines/buried/detection_tables.h
+++ b/engines/buried/detection_tables.h
@@ -19,6 +19,8 @@
*
*/
+#define GAMEOPTION_ALLOW_SKIP GUIO_GAMEOPTIONS1
+
namespace Buried {
static const ADGameDescription gameDescriptions[] = {
@@ -33,7 +35,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 3.11 24BPP
@@ -47,7 +49,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_TRUECOLOR,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 3.11 8BPP
@@ -61,7 +63,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 3.11 24BPP
@@ -75,7 +77,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_TRUECOLOR,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// Japanese Windows 3.11 8BPP
@@ -89,7 +91,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::JA_JPN,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// Japanese Windows 3.11 24BPP
@@ -103,7 +105,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::JA_JPN,
Common::kPlatformWindows,
GF_TRUECOLOR,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 3.11 8BPP
@@ -117,7 +119,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_COMPRESSED,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 3.11 24BPP
@@ -131,7 +133,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_COMPRESSED | GF_TRUECOLOR,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 3.11 8BPP
@@ -145,7 +147,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_COMPRESSED,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 3.11 24BPP
@@ -159,7 +161,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_COMPRESSED | GF_TRUECOLOR,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 3.11 8BPP
@@ -173,7 +175,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 3.11 24BPP
@@ -187,7 +189,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_TRUECOLOR,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// German Windows 3.11 8BPP
@@ -201,7 +203,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// German Windows 3.11 24BPP
@@ -215,7 +217,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::DE_DEU,
Common::kPlatformWindows,
GF_TRUECOLOR,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// French Windows 3.11 8BPP
@@ -229,7 +231,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// French Windows 3.11 24BPP
@@ -243,7 +245,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::FR_FRA,
Common::kPlatformWindows,
GF_TRUECOLOR,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// Italian Windows 3.11 8BPP
@@ -257,7 +259,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// Italian Windows 3.11 24BPP
@@ -271,7 +273,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::IT_ITA,
Common::kPlatformWindows,
GF_TRUECOLOR,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// Spanish Windows 3.11 8BPP
@@ -285,7 +287,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformWindows,
ADGF_NO_FLAGS,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// Spanish Windows 3.11 24BPP
@@ -299,7 +301,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::ES_ESP,
Common::kPlatformWindows,
GF_TRUECOLOR,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 95 8BPP
@@ -312,7 +314,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_WIN95,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 95 24BPP
@@ -325,7 +327,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
GF_TRUECOLOR | GF_WIN95,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows Demo 8BPP
@@ -404,7 +406,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | GF_TRIAL,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
// English Windows 3.11 Trial 24BPP
@@ -417,7 +419,7 @@ static const ADGameDescription gameDescriptions[] = {
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DEMO | GF_TRUECOLOR | GF_TRIAL,
- GUIO0()
+ GUIO1(GAMEOPTION_ALLOW_SKIP)
},
AD_TABLE_END_MARKER
diff --git a/engines/buried/video_window.cpp b/engines/buried/video_window.cpp
index 847590f8ea5..2a735bff6cc 100644
--- a/engines/buried/video_window.cpp
+++ b/engines/buried/video_window.cpp
@@ -24,6 +24,7 @@
#include "buried/video_window.h"
#include "common/system.h"
+#include "common/keyboard.h"
#include "graphics/surface.h"
#include "video/avi_decoder.h"
@@ -191,6 +192,11 @@ void VideoWindow::onPaint() {
}
}
+void VideoWindow::onKeyUp(const Common::KeyState &key, uint flags) {
+ if (key.keycode == Common::KEYCODE_ESCAPE)
+ stopVideo();
+}
+
void VideoWindow::setSourceRect(const Common::Rect &srcRect) {
_srcRect = srcRect;
}
diff --git a/engines/buried/video_window.h b/engines/buried/video_window.h
index 27193f43b6f..9fa5a860f5e 100644
--- a/engines/buried/video_window.h
+++ b/engines/buried/video_window.h
@@ -71,6 +71,7 @@ public:
// Window interface
void onPaint();
+ void onKeyUp(const Common::KeyState &key, uint flags);
private:
Video::VideoDecoder *_video;
More information about the Scummvm-git-logs
mailing list