[Scummvm-git-logs] scummvm master -> 1d0e7993f58b232cfb424a3504ff0bd883548b41

sev- noreply at scummvm.org
Sat Jul 1 15:01:57 UTC 2023


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
95dfac0794 DIRECTOR: Remove code duplication in debug draw
587e48cc54 DIRECTOR: Added 'draw all' debug console command, allow 'frameS', 'castS' in the same.
1d0e7993f5 DIRECTOR: Force drawing of frame counter even when there are no other changes


Commit: 95dfac079475e252d55c3a72be03f95b473d7912
    https://github.com/scummvm/scummvm/commit/95dfac079475e252d55c3a72be03f95b473d7912
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-07-01T17:01:40+02:00

Commit Message:
DIRECTOR: Remove code duplication in debug draw

Changed paths:
    engines/director/window.cpp


diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index 0aef5896375..9dac22fef5a 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -172,35 +172,29 @@ bool Window::render(bool forceRedraw, Graphics::ManagedSurface *blitTo) {
 		}
 	}
 
-	if (g_director->_debugDraw & kDebugDrawFrame) {
+	if (g_director->_debugDraw & kDebugDrawCast) {
 		const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
-		Common::String msg = Common::String::format("Frame: %d", g_director->getCurrentMovie()->getScore()->getCurrentFrame());
-		uint32 width = font->getStringWidth(msg);
-
-		blitTo->fillRect(Common::Rect(blitTo->w - 3 - width, 1, blitTo->w - 1, font->getFontHeight() + 1), _wm->_colorBlack);
-		font->drawString(blitTo, msg, blitTo->w - 1 - width, 3, width , _wm->_colorBlack);
-		font->drawString(blitTo, msg, blitTo->w - 2 - width, 2, width , _wm->_colorWhite);
-	}
 
-	if (g_director->_debugDraw & kDebugDrawCast) {
 		for (uint i = 0; i < _currentMovie->getScore()->_channels.size(); i++) {
 			Channel *channel = _currentMovie->getScore()->_channels[i];
 			if (!channel->isEmpty()) {
 				Common::Rect bbox = channel->getBbox();
 				blitTo->frameRect(bbox, g_director->_wm->_colorWhite);
 
-				const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
 				font->drawString(blitTo, Common::String::format("m: %d, ch: %d", channel->_sprite->_castId.member, i), bbox.left + 3, bbox.top + 3, 128, g_director->_wm->_colorBlack);
 				font->drawString(blitTo, Common::String::format("m: %d, ch: %d", channel->_sprite->_castId.member, i), bbox.left + 2, bbox.top + 2, 128, g_director->_wm->_colorWhite);
 			}
 		}
+	}
 
+	if (g_director->_debugDraw & kDebugDrawFrame) {
 		const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
 		Common::String msg = Common::String::format("Frame: %d", g_director->getCurrentMovie()->getScore()->getCurrentFrame());
 		uint32 width = font->getStringWidth(msg);
 
 		blitTo->fillRect(Common::Rect(blitTo->w - 3 - width, 1, blitTo->w - 1, font->getFontHeight() + 1), _wm->_colorBlack);
-		font->drawString(blitTo, msg, blitTo->w - 2 - width, 2, width , _wm->_colorWhite);
+		font->drawString(blitTo, msg, blitTo->w - 1 - width, 3, width, _wm->_colorBlack);
+		font->drawString(blitTo, msg, blitTo->w - 2 - width, 2, width, _wm->_colorWhite);
 	}
 
 	_dirtyRects.clear();


Commit: 587e48cc5415e729cea301f268dc7e3026e28b27
    https://github.com/scummvm/scummvm/commit/587e48cc5415e729cea301f268dc7e3026e28b27
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-07-01T17:01:40+02:00

Commit Message:
DIRECTOR: Added 'draw all' debug console command, allow 'frameS', 'castS' in the same.

Changed paths:
    engines/director/debugger.cpp


diff --git a/engines/director/debugger.cpp b/engines/director/debugger.cpp
index cf2e060a757..7ccab5bad59 100644
--- a/engines/director/debugger.cpp
+++ b/engines/director/debugger.cpp
@@ -856,12 +856,14 @@ bool Debugger::cmdDraw(int argc, const char **argv) {
 		for (int i = 1; i < argc; i++) {
 			if (!scumm_stricmp(argv[i], "off")) {
 				g_director->_debugDraw = 0;
-			} else if (!scumm_stricmp(argv[i], "cast")) {
+			} else if (!strncmp(argv[i], "cast", 4)) { // allow "castS"
 				g_director->_debugDraw |= kDebugDrawCast;
-			} else if (!scumm_stricmp(argv[i], "frame")) {
+			} else if (!strncmp(argv[i], "frame", 5)) { // allow "frameS"
 				g_director->_debugDraw |= kDebugDrawFrame;
+			} else if (!scumm_stricmp(argv[i], "all")) {
+				g_director->_debugDraw |= kDebugDrawCast | kDebugDrawFrame;
 			} else {
-				debugPrintf("Valid parameters are 'cast', 'frame' or 'off'.\n");
+				debugPrintf("Valid parameters are 'cast', 'frame', 'all' or 'off'.\n");
 				return true;
 			}
 		}


Commit: 1d0e7993f58b232cfb424a3504ff0bd883548b41
    https://github.com/scummvm/scummvm/commit/1d0e7993f58b232cfb424a3504ff0bd883548b41
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-07-01T17:01:40+02:00

Commit Message:
DIRECTOR: Force drawing of frame counter even when there are no other changes

Changed paths:
    engines/director/window.cpp
    engines/director/window.h


diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index 9dac22fef5a..a266a377487 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -113,22 +113,40 @@ void Window::invertChannel(Channel *channel, const Common::Rect &destRect) {
 	}
 }
 
+void Window::drawFrameCounter(Graphics::ManagedSurface *blitTo) {
+	const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
+	Common::String msg = Common::String::format("Frame: %d", g_director->getCurrentMovie()->getScore()->getCurrentFrame());
+	uint32 width = font->getStringWidth(msg);
+
+	blitTo->fillRect(Common::Rect(blitTo->w - 3 - width, 1, blitTo->w - 1, font->getFontHeight() + 1), _wm->_colorBlack);
+	font->drawString(blitTo, msg, blitTo->w - 1 - width, 3, width, _wm->_colorBlack);
+	font->drawString(blitTo, msg, blitTo->w - 2 - width, 2, width, _wm->_colorWhite);
+}
+
 bool Window::render(bool forceRedraw, Graphics::ManagedSurface *blitTo) {
 	if (!_currentMovie)
 		return false;
 
+	if (!blitTo)
+		blitTo = _composeSurface;
+
 	if (forceRedraw) {
 		blitTo->clear(_stageColor);
 		markAllDirty();
 	} else {
-		if (_dirtyRects.size() == 0 && _currentMovie->_videoPlayback == false)
+		if (_dirtyRects.size() == 0 && _currentMovie->_videoPlayback == false) {
+			if (g_director->_debugDraw & kDebugDrawFrame) {
+				drawFrameCounter(blitTo);
+
+				_contentIsDirty = true;
+			}
+
 			return false;
+		}
 
 		mergeDirtyRects();
 	}
 
-	if (!blitTo)
-		blitTo = _composeSurface;
 	Channel *hiliteChannel = _currentMovie->getScore()->getChannelById(_currentMovie->_currentHiliteChannelId);
 
 	for (auto &i : _dirtyRects) {
@@ -187,15 +205,8 @@ bool Window::render(bool forceRedraw, Graphics::ManagedSurface *blitTo) {
 		}
 	}
 
-	if (g_director->_debugDraw & kDebugDrawFrame) {
-		const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
-		Common::String msg = Common::String::format("Frame: %d", g_director->getCurrentMovie()->getScore()->getCurrentFrame());
-		uint32 width = font->getStringWidth(msg);
-
-		blitTo->fillRect(Common::Rect(blitTo->w - 3 - width, 1, blitTo->w - 1, font->getFontHeight() + 1), _wm->_colorBlack);
-		font->drawString(blitTo, msg, blitTo->w - 1 - width, 3, width, _wm->_colorBlack);
-		font->drawString(blitTo, msg, blitTo->w - 2 - width, 2, width, _wm->_colorWhite);
-	}
+	if (g_director->_debugDraw & kDebugDrawFrame)
+		drawFrameCounter(blitTo);
 
 	_dirtyRects.clear();
 	_contentIsDirty = true;
diff --git a/engines/director/window.h b/engines/director/window.h
index 69a9965820a..95c0232ac19 100644
--- a/engines/director/window.h
+++ b/engines/director/window.h
@@ -210,8 +210,9 @@ private:
 	bool _isModal;
 
 private:
-
 	void inkBlitFrom(Channel *channel, Common::Rect destRect, Graphics::ManagedSurface *blitTo = nullptr);
+	void drawFrameCounter(Graphics::ManagedSurface *blitTo);
+
 
 };
 




More information about the Scummvm-git-logs mailing list