[Scummvm-git-logs] scummvm master -> 34191d12b27f7d1b3a9c3d5e0dab662a769c68f0

neuromancer noreply at scummvm.org
Sat Aug 5 12:45:04 UTC 2023


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

Summary:
a4a3a2bae1 FREESCAPE: added a function to draw several strings line by line
34191d12b2 FREESCAPE: improve mouse handling when reaching on-screen controls


Commit: a4a3a2bae10bee6ab2786b7db66fe83158057b9a
    https://github.com/scummvm/scummvm/commit/a4a3a2bae10bee6ab2786b7db66fe83158057b9a
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-08-05T14:46:59+02:00

Commit Message:
FREESCAPE: added a function to draw several strings line by line

Changed paths:
    engines/freescape/freescape.h
    engines/freescape/ui.cpp


diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 8af6f12cf64..fca316a621a 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -126,6 +126,7 @@ public:
 	void drawBackground();
 	virtual void drawUI();
 	virtual void drawInfoMenu();
+	void drawBorderScreenAndWait(Graphics::Surface *surface);
 
 	virtual void drawCrossair(Graphics::Surface *surface);
 	Graphics::ManagedSurface *_border;
@@ -372,6 +373,7 @@ public:
 	Common::BitArray _font;
 	bool _fontLoaded;
 	void drawStringInSurface(const Common::String &str, int x, int y, uint32 fontColor, uint32 backColor, Graphics::Surface *surface, int offset = 0);
+	Graphics::Surface *drawStringsInSurface(const Common::Array<Common::String> &lines);
 
 	// Game state
 	virtual void initGameState();
diff --git a/engines/freescape/ui.cpp b/engines/freescape/ui.cpp
index d5e94e6fcb2..092afddb927 100644
--- a/engines/freescape/ui.cpp
+++ b/engines/freescape/ui.cpp
@@ -63,10 +63,82 @@ void FreescapeEngine::titleScreen() {
 	_gfx->clear(0, 0, 0, true);
 }
 
+Graphics::Surface *FreescapeEngine::drawStringsInSurface(const Common::Array<Common::String> &lines) {
+	uint32 color = _gfx->_texturePixelFormat.ARGBToColor(0x00, 0x00, 0x00, 0x00);
+	Graphics::Surface *surface = new Graphics::Surface();
+	surface->create(_screenW, _screenH, _gfx->_texturePixelFormat);
+	surface->fillRect(_fullscreenViewArea, color);
+
+	uint32 black = _gfx->_texturePixelFormat.ARGBToColor(0xFF, 0x00, 0x00, 0x00);
+	surface->fillRect(_viewArea, black);
+
+	switch (_renderMode) {
+		case Common::kRenderCGA:
+			color = 1;
+			break;
+		case Common::kRenderZX:
+			color = 6;
+			break;
+		case Common::kRenderCPC:
+			color = _gfx->_underFireBackgroundColor;
+			if (color == uint32(-1))
+				color = 14;
+			break;
+		default:
+			color = 14;
+	}
+	uint8 r, g, b;
+
+	_gfx->readFromPalette(color, r, g, b);
+	if (isAmiga() || isAtariST()) {
+		r = 0xFF;
+		g = 0xFF;
+		b = 0x55;
+	}
+
+	uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+	int x = 50;
+	int y = 32;
+
+	for (int i = 0; i < int(lines.size()); i++) {
+		drawStringInSurface(lines[i], x, y, front, black, surface);
+		y = y + 9;
+	}
+	return surface;
+}
+
 void FreescapeEngine::borderScreen() {
 	if (!_border)
 		return;
 
+	if (isDriller()) {
+		drawBorderScreenAndWait(nullptr);
+
+		if (isAmiga())
+			return;
+	}
+
+	if (isDOS() || isSpectrum()) {
+		Common::Array<Common::String> lines;
+		lines.push_back("     CONFIGURATION MENU");
+		lines.push_back("");
+		lines.push_back("     1: KEYBOARD ONLY      ");
+		lines.push_back("     2: IBM JOYSTICK       ");
+		lines.push_back("     3: AMSTRAD JOYSTICK   ");
+		lines.push_back("");
+		lines.push_back("  SPACEBAR:  BEGIN MISSION");
+		lines.push_back("");
+		lines.push_back("  COPYRIGHT 1988 INCENTIVE");
+		lines.push_back("");
+		Graphics::Surface *surface = drawStringsInSurface(lines);
+		drawBorderScreenAndWait(surface);
+		surface->free();
+		delete surface;
+	}
+}
+
+void FreescapeEngine::drawBorderScreenAndWait(Graphics::Surface *surface) {
 	int maxWait = 6 * 60;
 	for (int i = 0; i < maxWait; i++ ) {
 		Common::Event event;
@@ -95,6 +167,8 @@ void FreescapeEngine::borderScreen() {
 		}
 
 		drawBorder();
+		if (surface)
+			drawFullscreenSurface(surface);
 		_gfx->flipBuffer();
 		g_system->updateScreen();
 		g_system->delayMillis(15); // try to target ~60 FPS


Commit: 34191d12b27f7d1b3a9c3d5e0dab662a769c68f0
    https://github.com/scummvm/scummvm/commit/34191d12b27f7d1b3a9c3d5e0dab662a769c68f0
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-08-05T14:46:59+02:00

Commit Message:
FREESCAPE: improve mouse handling when reaching on-screen controls

Changed paths:
    engines/freescape/freescape.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 4c0651b96cf..ff7e69c913b 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -478,10 +478,17 @@ void FreescapeEngine::processInput() {
 				g_system->warpMouse(mousePos.x, mousePos.y);
 
 			if (_shootMode) {
-				Common::Point resolution(g_system->getWidth(), g_system->getHeight());
-				_crossairPosition.x = _screenW * mousePos.x / resolution.x;
-				_crossairPosition.y = _screenH * mousePos.y / resolution.y;
+				_crossairPosition.x = _screenW * mousePos.x / g_system->getWidth();
+				_crossairPosition.y = _screenH * mousePos.y / g_system->getHeight();
 				break;
+			} else {
+				// Mouse pointer is locked into the the middle of the screen
+				// since we only need the relative movements. This will not affect any touchscreen device
+				// so on-screen controls are still accesible
+				mousePos.x = g_system->getWidth() * ( _viewArea.left + _viewArea.width() / 2) / _screenW;
+				mousePos.y = g_system->getHeight() * (_viewArea.top + _viewArea.height() / 2) / _screenW;
+				g_system->warpMouse(mousePos.x, mousePos.y);
+				g_system->getEventManager()->purgeMouseEvents();
 			}
 
 			rotate(event.relMouse.x * _mouseSensitivity, event.relMouse.y * _mouseSensitivity);
@@ -499,8 +506,11 @@ void FreescapeEngine::processInput() {
 				mousePos.y = _screenH * mousePos.y / resolution.y;
 				touchedScreenControls = onScreenControls(mousePos);
 
-				if (!touchedScreenControls && _viewArea.contains(_crossairPosition))
-					shoot();
+				if (!touchedScreenControls) {
+					if (_viewArea.contains(_shootMode ? _crossairPosition : mousePos))
+						shoot();
+				}
+
 			}
 			break;
 




More information about the Scummvm-git-logs mailing list