[Scummvm-git-logs] scummvm master -> 9fef247242b9336482d5cc765cf6a44432c3e192

sev- noreply at scummvm.org
Fri May 3 18:03:33 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:
9fef247242 DIRECTOR: DEBUGGER: Implement Start/Stop


Commit: 9fef247242b9336482d5cc765cf6a44432c3e192
    https://github.com/scummvm/scummvm/commit/9fef247242b9336482d5cc765cf6a44432c3e192
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-05-03T20:03:13+02:00

Commit Message:
DIRECTOR: DEBUGGER: Implement Start/Stop

Changed paths:
    engines/director/debugtools.cpp
    engines/director/score.cpp
    engines/director/types.h
    engines/director/window.cpp


diff --git a/engines/director/debugtools.cpp b/engines/director/debugtools.cpp
index 02634894d0a..eaffb9a14e9 100644
--- a/engines/director/debugtools.cpp
+++ b/engines/director/debugtools.cpp
@@ -75,71 +75,102 @@ static void showControlPanel() {
 	ImGui::SetNextWindowSize(ImVec2(200, 55), ImGuiCond_FirstUseEver);
 
 	if (ImGui::Begin("Control Panel", &_state->_showControlPanel)) {
+		Score *score = g_director->getCurrentMovie()->getScore();
 		ImDrawList *dl = ImGui::GetWindowDrawList();
 
 		ImU32 color = ImGui::GetColorU32(ImVec4(0.8f, 0.8f, 0.8f, 1.0f));
+		ImU32 active_color = ImGui::GetColorU32(ImVec4(1.0f, 1.0f, 0.4f, 1.0f));
 		ImU32 bgcolor = ImGui::GetColorU32(ImVec4(0.2f, 0.2f, 1.0f, 1.0f));
 		ImVec2 p = ImGui::GetCursorScreenPos();
 		ImVec2 buttonSize(20, 14);
 		float bgX1 = -4.0f, bgX2 = 21.0f;
 
-		ImGui::InvisibleButton("Rewind", buttonSize);
-		if (ImGui::IsItemClicked(0)) {
+		{ // Rewind
+			ImGui::InvisibleButton("Rewind", buttonSize);
+
+			if (ImGui::IsItemClicked(0)) {
+			}
+
+			if (ImGui::IsItemHovered())
+				dl->AddRectFilled(ImVec2(p.x + bgX1, p.y + bgX1), ImVec2(p.x + bgX2, p.y + bgX2), bgcolor, 3.0f, ImDrawFlags_RoundCornersAll);
+
+			dl->AddTriangleFilled(ImVec2(p.x, p.y + 8), ImVec2(p.x + 8, p.y), ImVec2(p.x + 8, p.y + 16), color);
+			dl->AddTriangleFilled(ImVec2(p.x + 8, p.y + 8), ImVec2(p.x + 16, p.y), ImVec2(p.x + 16, p.y + 16), color);
+
+			ImGui::SetItemTooltip("Rewind");
+			ImGui::SameLine();
 		}
-		if (ImGui::IsItemHovered())
-			dl->AddRectFilled(ImVec2(p.x + bgX1, p.y + bgX1), ImVec2(p.x + bgX2, p.y + bgX2), bgcolor, 3.0f, ImDrawFlags_RoundCornersAll);
 
-		dl->AddTriangleFilled(ImVec2(p.x, p.y + 8), ImVec2(p.x + 8, p.y), ImVec2(p.x + 8, p.y + 16), color);
-		dl->AddTriangleFilled(ImVec2(p.x + 8, p.y + 8), ImVec2(p.x + 16, p.y), ImVec2(p.x + 16, p.y + 16), color);
-		ImGui::SetItemTooltip("Rewind");
-		ImGui::SameLine();
+		{ // Step Back
+			p = ImGui::GetCursorScreenPos();
+			ImGui::InvisibleButton("Step Back", ImVec2(18, 16));
 
-		p = ImGui::GetCursorScreenPos();
-		ImGui::InvisibleButton("Step Back", ImVec2(18, 16));
-		if (ImGui::IsItemClicked(0)) {
+			if (ImGui::IsItemClicked(0)) {
+			}
+
+			if (ImGui::IsItemHovered())
+				dl->AddRectFilled(ImVec2(p.x + bgX1, p.y + bgX1), ImVec2(p.x + bgX2, p.y + bgX2), bgcolor, 3.0f, ImDrawFlags_RoundCornersAll);
+
+			dl->AddTriangleFilled(ImVec2(p.x, p.y + 8), ImVec2(p.x + 9, p.y), ImVec2(p.x + 9, p.y + 16), color);
+			dl->AddRectFilled(ImVec2(p.x + 11, p.y), ImVec2(p.x + 17, p.y + 16), color);
+
+			ImGui::SetItemTooltip("Step Back");
+			ImGui::SameLine();
 		}
-		if (ImGui::IsItemHovered())
-			dl->AddRectFilled(ImVec2(p.x + bgX1, p.y + bgX1), ImVec2(p.x + bgX2, p.y + bgX2), bgcolor, 3.0f, ImDrawFlags_RoundCornersAll);
-		dl->AddTriangleFilled(ImVec2(p.x, p.y + 8), ImVec2(p.x + 9, p.y), ImVec2(p.x + 9, p.y + 16), color);
-		dl->AddRectFilled(ImVec2(p.x + 11, p.y), ImVec2(p.x + 17, p.y + 16), color);
-		ImGui::SetItemTooltip("Step Back");
-		ImGui::SameLine();
 
-		p = ImGui::GetCursorScreenPos();
-		ImGui::InvisibleButton("Stop", buttonSize);
-		if (ImGui::IsItemClicked(0)) {
+		{ // Stop
+			p = ImGui::GetCursorScreenPos();
+			ImGui::InvisibleButton("Stop", buttonSize);
+
+			if (ImGui::IsItemClicked(0))
+				score->_playState = kPlayPaused;
+
+			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;
+			dl->AddRectFilled(ImVec2(p.x, p.y), ImVec2(p.x + 16, p.y + 16), stopColor);
+
+			ImGui::SetItemTooltip("Stop");
+			ImGui::SameLine();
 		}
-		if (ImGui::IsItemHovered())
-			dl->AddRectFilled(ImVec2(p.x + bgX1, p.y + bgX1), ImVec2(p.x + bgX2, p.y + bgX2), bgcolor, 3.0f, ImDrawFlags_RoundCornersAll);
-		dl->AddRectFilled(ImVec2(p.x, p.y), ImVec2(p.x + 16, p.y + 16), color);
-		ImGui::SetItemTooltip("Stop");
-		ImGui::SameLine();
 
-		p = ImGui::GetCursorScreenPos();
-		ImGui::InvisibleButton("Step", buttonSize);
-		if (ImGui::IsItemClicked(0)) {
+		{ // Step
+			p = ImGui::GetCursorScreenPos();
+			ImGui::InvisibleButton("Step", buttonSize);
+
+			if (ImGui::IsItemClicked(0)) {
+			}
+
+			if (ImGui::IsItemHovered())
+				dl->AddRectFilled(ImVec2(p.x + bgX1, p.y + bgX1), ImVec2(p.x + bgX2, p.y + bgX2), bgcolor, 3.0f, ImDrawFlags_RoundCornersAll);
+
+			dl->AddRectFilled(ImVec2(p.x, p.y), ImVec2(p.x + 6, p.y + 16), color);
+			dl->AddTriangleFilled(ImVec2(p.x + 8, p.y + 2), ImVec2(p.x + 8, p.y + 14), ImVec2(p.x + 16, p.y + 8), color);
+
+			ImGui::SetItemTooltip("Step");
+			ImGui::SameLine();
 		}
-		if (ImGui::IsItemHovered())
-			dl->AddRectFilled(ImVec2(p.x + bgX1, p.y + bgX1), ImVec2(p.x + bgX2, p.y + bgX2), bgcolor, 3.0f, ImDrawFlags_RoundCornersAll);
-		dl->AddRectFilled(ImVec2(p.x, p.y), ImVec2(p.x + 6, p.y + 16), color);
-		dl->AddTriangleFilled(ImVec2(p.x + 8, p.y + 2), ImVec2(p.x + 8, p.y + 14), ImVec2(p.x + 16, p.y + 8), color);
-		ImGui::SetItemTooltip("Step");
-		ImGui::SameLine();
 
-		p = ImGui::GetCursorScreenPos();
-		ImGui::InvisibleButton("Play", buttonSize);
-		if (ImGui::IsItemClicked(0)) {
-			warning("Play");
+		{ // Play
+			p = ImGui::GetCursorScreenPos();
+			ImGui::InvisibleButton("Play", buttonSize);
+
+			if (ImGui::IsItemClicked(0))
+				score->_playState = kPlayStarted;
+
+			if (ImGui::IsItemHovered())
+				dl->AddRectFilled(ImVec2(p.x + bgX1, p.y + bgX1), ImVec2(p.x + bgX2, p.y + bgX2), bgcolor, 3.0f, ImDrawFlags_RoundCornersAll);
+
+			dl->AddTriangleFilled(ImVec2(p.x, p.y), ImVec2(p.x, p.y + 16), ImVec2(p.x + 14, p.y + 8), color);
+
+			ImGui::SetItemTooltip("Play");
+			ImGui::SameLine();
 		}
-		if (ImGui::IsItemHovered())
-			dl->AddRectFilled(ImVec2(p.x + bgX1, p.y + bgX1), ImVec2(p.x + bgX2, p.y + bgX2), bgcolor, 3.0f, ImDrawFlags_RoundCornersAll);
-		dl->AddTriangleFilled(ImVec2(p.x, p.y), ImVec2(p.x, p.y + 16), ImVec2(p.x + 14, p.y + 8), color);
-		ImGui::SetItemTooltip("Play");
-		ImGui::SameLine();
 
 		char buf[5];
 
-		snprintf(buf, 5, "%d", g_director->getCurrentMovie()->getScore()->getCurrentFrameNum());
+		snprintf(buf, 5, "%d", score->getCurrentFrameNum());
 
 		ImGui::SetNextItemWidth(30);
 		ImGui::InputText("##frame", buf, 5, ImGuiInputTextFlags_CharsDecimal);
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 88fbfc4167a..384ede43976 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -293,6 +293,9 @@ void Score::startPlay() {
 }
 
 void Score::step() {
+	if (_playState == kPlayPaused)
+		return;
+
 	if (_playState == kPlayStopped)
 		return;
 
diff --git a/engines/director/types.h b/engines/director/types.h
index df478574b06..791191f9067 100644
--- a/engines/director/types.h
+++ b/engines/director/types.h
@@ -320,7 +320,8 @@ enum DirectorCursor {
 enum PlayState {
 	kPlayNotStarted,
 	kPlayStarted,
-	kPlayStopped
+	kPlayStopped,
+	kPlayPaused,
 };
 
 enum SymbolType {
diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index 36e9d2e079e..d1268002f0b 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -554,6 +554,8 @@ bool Window::step() {
 			debugC(5, kDebugEvents, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n");
 			_currentMovie->getScore()->step();
 			return true;
+		case kPlayPaused:
+			return true;
 		default:
 			return false;
 		}




More information about the Scummvm-git-logs mailing list