[Scummvm-git-logs] scummvm master -> 5d9d36f4f239812b31d4e311c8caa0e59268a059
sev-
noreply at scummvm.org
Tue Jun 4 20:31:46 UTC 2024
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:
5d9d36f4f2 DIRECTOR: Implemented paused start and introduce loaded state
Commit: 5d9d36f4f239812b31d4e311c8caa0e59268a059
https://github.com/scummvm/scummvm/commit/5d9d36f4f239812b31d4e311c8caa0e59268a059
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-06-04T22:29:38+02:00
Commit Message:
DIRECTOR: Implemented paused start and introduce loaded state
- Split out "Loaded" state for score
- Added two debugflags: paused, to start in paused mode and
paudeonload, to pause every movie when it is loaded
- Use OSD for reflecting paused state
Changed paths:
engines/director/debugger/dt-controlpanel.cpp
engines/director/detection.cpp
engines/director/director.h
engines/director/types.h
engines/director/window.cpp
diff --git a/engines/director/debugger/dt-controlpanel.cpp b/engines/director/debugger/dt-controlpanel.cpp
index d15080886d2..486b6c869b0 100644
--- a/engines/director/debugger/dt-controlpanel.cpp
+++ b/engines/director/debugger/dt-controlpanel.cpp
@@ -189,12 +189,14 @@ void showControlPanel() {
g_lingo->_exec._state = kPause;
g_lingo->_exec._shouldPause = nullptr;
_state->_dbg._isScriptDirty = true;
+
+ g_system->displayMessageOnOSD(Common::U32String("Paused"));
}
if (ImGui::IsItemHovered())
dl->AddRectFilled(ImVec2(p.x + bgX1, p.y + bgX1), ImVec2(p.x + bgX2, p.y + bgX2), bgcolor, 3.0f, ImDrawFlags_RoundCornersAll);
- ImU32 stopColor = (score->_playState == kPlayPaused) ? active_color : color;
+ ImU32 stopColor = (score->_playState == kPlayPaused || score->_playState == kPlayPausedAfterLoading) ? active_color : color;
dl->AddRectFilled(ImVec2(p.x, p.y), ImVec2(p.x + 16, p.y + 16), stopColor);
ImGui::SetItemTooltip("Stop");
@@ -227,7 +229,11 @@ void showControlPanel() {
ImGui::InvisibleButton("Play", buttonSize);
if (ImGui::IsItemClicked(0)) {
- score->_playState = kPlayStarted;
+ if (score->_playState == kPlayPausedAfterLoading)
+ score->_playState = kPlayLoaded;
+ else
+ score->_playState = kPlayStarted;
+
g_lingo->_exec._state = kRunning;
g_lingo->_exec._shouldPause = nullptr;
}
diff --git a/engines/director/detection.cpp b/engines/director/detection.cpp
index a73c82815e8..d223177b52a 100644
--- a/engines/director/detection.cpp
+++ b/engines/director/detection.cpp
@@ -77,6 +77,8 @@ static const DebugChannelDef debugFlagList[] = {
{Director::kDebugXObj, "xobj", "XObjects"},
{Director::kDebugLingoThe, "lingothe", "Lingo \"the\" entities"},
{Director::kDebugImGui, "imgui", "Show ImGui debug window (if available)"},
+ {Director::kDebugPaused, "paused", "Pause first movie right after start"},
+ {Director::kDebugPauseOnLoad, "pauseonload", "Pause every movie right after loading"},
DEBUG_CHANNEL_END
};
diff --git a/engines/director/director.h b/engines/director/director.h
index d9f516fbbe3..e93e4d16578 100644
--- a/engines/director/director.h
+++ b/engines/director/director.h
@@ -86,6 +86,8 @@ enum {
kDebugXObj,
kDebugLingoThe,
kDebugImGui,
+ kDebugPaused,
+ kDebugPauseOnLoad,
};
enum {
@@ -318,6 +320,8 @@ public:
uint16 _framesRan = 0; // used by kDebugFewFramesOnly
bool _noFatalLingoError = false;
+
+ bool _firstMovie = true;
};
// An extension of MacPlotData for interfacing with inks and patterns without
diff --git a/engines/director/types.h b/engines/director/types.h
index de1e89081a8..0ec907e62ef 100644
--- a/engines/director/types.h
+++ b/engines/director/types.h
@@ -328,9 +328,11 @@ enum DirectorCursor {
enum PlayState {
kPlayNotStarted,
+ kPlayLoaded,
kPlayStarted,
kPlayStopped,
kPlayPaused,
+ kPlayPausedAfterLoading,
};
enum SymbolType {
diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index 480de2eae51..1c8820fb346 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -535,18 +535,35 @@ bool Window::step() {
_nextMovie.frameI = -1;
}
+ if (debugChannelSet(-1, kDebugPauseOnLoad) ||
+ (g_director->_firstMovie && debugChannelSet(-1, kDebugPaused))) {
+ _currentMovie->getScore()->_playState = kPlayPausedAfterLoading;
+ debug(0, "Window::step(): Putting score in paused state as requested");
+ g_system->displayMessageOnOSD(Common::U32String("Paused"));
+
+ g_director->_firstMovie = false;
+ return true;
+ }
- if (!debugChannelSet(-1, kDebugCompileOnly) && goodMovie) {
- debugC(1, kDebugEvents, "Starting playback of movie '%s'", _currentMovie->getMacName().c_str());
- _currentMovie->getScore()->startPlay();
- if (_startFrame != -1) {
- _currentMovie->getScore()->setCurrentFrame(_startFrame);
- _startFrame = -1;
- }
- g_debugger->movieHook();
- } else {
+ if (!goodMovie)
return false;
+
+ _currentMovie->getScore()->_playState = kPlayLoaded;
+
+ return true;
+ }
+
+ case kPlayLoaded:
+ if (!debugChannelSet(-1, kDebugCompileOnly)) {
+ debugC(1, kDebugEvents, "Starting playback of movie '%s'", _currentMovie->getMacName().c_str());
+ _currentMovie->getScore()->startPlay();
+ if (_startFrame != -1) {
+ _currentMovie->getScore()->setCurrentFrame(_startFrame);
+ _startFrame = -1;
}
+ g_debugger->movieHook();
+ } else {
+ return false;
}
// fall through
case kPlayStarted:
@@ -555,6 +572,7 @@ bool Window::step() {
debugC(5, kDebugEvents, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
_currentMovie->getScore()->step();
return true;
+ case kPlayPausedAfterLoading:
case kPlayPaused:
return true;
default:
More information about the Scummvm-git-logs
mailing list