[Scummvm-git-logs] scummvm branch-2-7 -> 25c1630d5e964f972ca7faf014282de1f01e869d

neuromancer noreply at scummvm.org
Wed Mar 22 07:58:54 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:
41d6e07be4 FREESCAPE: restored and refactored c64 code for driller
de83ef51d8 FREESCAPE: make sure game can end when disable demo mode in driller demos
25c1630d5e FREESCAPE: implemented basic on screen controlls for driller amiga/atari


Commit: 41d6e07be41e75a531131b29927f1f07b7019ec5
    https://github.com/scummvm/scummvm/commit/41d6e07be41e75a531131b29927f1f07b7019ec5
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-22T08:59:17+01:00

Commit Message:
FREESCAPE: restored and refactored c64 code for driller

Changed paths:
  A engines/freescape/games/driller/c64.cpp
    engines/freescape/assets.cpp
    engines/freescape/freescape.h
    engines/freescape/games/driller/driller.cpp
    engines/freescape/module.mk


diff --git a/engines/freescape/assets.cpp b/engines/freescape/assets.cpp
index 813dfb45683..309c30a424a 100644
--- a/engines/freescape/assets.cpp
+++ b/engines/freescape/assets.cpp
@@ -46,7 +46,7 @@ void FreescapeEngine::loadAssetsFullGame() {
 	} else if (isCPC()) {
 		loadAssetsCPCFullGame();
 	} else if (isC64()) {
-		//loadAssetsC64FullGame();
+		loadAssetsC64FullGame();
 	} else if (isDOS()) {
 		loadAssetsDOSFullGame();
 	} else
@@ -83,6 +83,10 @@ void FreescapeEngine::loadAssetsZXDemo() {
 void FreescapeEngine::loadAssetsCPCDemo() {
 }
 
+void FreescapeEngine::loadAssetsC64Demo() {
+}
+
+
 void FreescapeEngine::loadAssetsAtariFullGame() {
 }
 
@@ -98,4 +102,7 @@ void FreescapeEngine::loadAssetsZXFullGame() {
 void FreescapeEngine::loadAssetsCPCFullGame() {
 }
 
+void FreescapeEngine::loadAssetsC64FullGame() {
+}
+
 } // End of namespace Freescape
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 46d817799cb..4837b86b730 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -154,6 +154,9 @@ public:
 	virtual void loadAssetsCPCFullGame();
 	virtual void loadAssetsCPCDemo();
 
+	virtual void loadAssetsC64FullGame();
+	virtual void loadAssetsC64Demo();
+
 	virtual void drawDOSUI(Graphics::Surface *surface);
 	virtual void drawZXUI(Graphics::Surface *surface);
 	virtual void drawCPCUI(Graphics::Surface *surface);
@@ -474,6 +477,8 @@ private:
 
 	void loadAssetsCPCFullGame() override;
 
+	void loadAssetsC64FullGame() override;
+
 	void drawDOSUI(Graphics::Surface *surface) override;
 	void drawZXUI(Graphics::Surface *surface) override;
 	void drawCPCUI(Graphics::Surface *surface) override;
diff --git a/engines/freescape/games/driller/c64.cpp b/engines/freescape/games/driller/c64.cpp
new file mode 100644
index 00000000000..fc9f11c2395
--- /dev/null
+++ b/engines/freescape/games/driller/c64.cpp
@@ -0,0 +1,121 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/file.h"
+
+#include "freescape/freescape.h"
+#include "freescape/language/8bitDetokeniser.h"
+
+namespace Freescape {
+
+void DrillerEngine::loadAssetsC64FullGame() {
+	Common::File file;
+	if (_targetName.hasPrefix("spacestationoblivion")) {
+		loadBundledImages();
+		file.open("spacestationoblivion.c64.data");
+		loadMessagesFixedSize(&file, 0x167a, 14, 20);
+		//loadFonts(&file, 0xae54);
+		load8bitBinary(&file, 0x8e02, 4);
+		loadGlobalObjects(&file, 0x1855);
+	} else if (_targetName.hasPrefix("driller")) {
+		file.open("driller.c64.data");
+		loadMessagesFixedSize(&file, 0x167a - 0x400, 14, 20);
+		//loadFonts(&file, 0xae54);
+		load8bitBinary(&file, 0x8e02 - 0x400, 4);
+		loadGlobalObjects(&file, 0x1855 - 0x400);
+	} else
+		error("Unknown C64 release");
+}
+
+
+void DrillerEngine::drawC64UI(Graphics::Surface *surface) {
+	uint32 color = 1;
+	uint8 r, g, b;
+
+	_gfx->selectColorFromFourColorPalette(color, r, g, b);
+	uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+	color = 0;
+	if (_gfx->_colorRemaps && _gfx->_colorRemaps->contains(color)) {
+		color = (*_gfx->_colorRemaps)[color];
+	}
+
+	_gfx->readFromPalette(color, r, g, b);
+	uint32 back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
+
+	int score = _gameStateVars[k8bitVariableScore];
+	drawStringInSurface(_currentArea->_name, 200, 188, front, back, surface);
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.x())), 149, 148, front, back, surface);
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.z())), 149, 156, front, back, surface);
+	drawStringInSurface(Common::String::format("%04d", int(2 * _position.y())), 149, 164, front, back, surface);
+	if (_playerHeightNumber >= 0)
+		drawStringInSurface(Common::String::format("%d", _playerHeightNumber), 54, 164, front, back, surface);
+	else
+		drawStringInSurface(Common::String::format("%s", "J"), 54, 164, front, back, surface);
+
+	drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 46, 148, front, back, surface);
+	drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 44, 156, front, back, surface);
+	drawStringInSurface(Common::String::format("%07d", score), 240, 128, front, back, surface);
+
+	int seconds, minutes, hours;
+	getTimeFromCountdown(seconds, minutes, hours);
+	drawStringInSurface(Common::String::format("%02d", hours), 209, 11, front, back, surface);
+	drawStringInSurface(Common::String::format("%02d", minutes), 232, 11, front, back, surface);
+	drawStringInSurface(Common::String::format("%02d", seconds), 254, 11, front, back, surface);
+
+	Common::String message;
+	int deadline;
+	getLatestMessages(message, deadline);
+	if (deadline <= _countdown) {
+		drawStringInSurface(message, 191, 180, back, front, surface);
+		_temporaryMessages.push_back(message);
+		_temporaryMessageDeadlines.push_back(deadline);
+	} else {
+		if (_currentArea->_gasPocketRadius == 0)
+			message = _messagesList[2];
+		else if (_drillStatusByArea[_currentArea->getAreaID()])
+			message = _messagesList[0];
+		else
+			message = _messagesList[1];
+
+		drawStringInSurface(message, 191, 180, front, back, surface);
+	}
+
+	int energy = _gameStateVars[k8bitVariableEnergy];
+	int shield = _gameStateVars[k8bitVariableShield];
+
+	if (energy >= 0) {
+		Common::Rect backBar(25, 187, 89 - energy, 194);
+		surface->fillRect(backBar, back);
+		Common::Rect energyBar(88 - energy, 187, 88, 194);
+		surface->fillRect(energyBar, front);
+	}
+
+	if (shield >= 0) {
+		Common::Rect backBar(25, 180, 89 - shield, 186);
+		surface->fillRect(backBar, back);
+
+		Common::Rect shieldBar(88 - shield, 180, 88, 186);
+		surface->fillRect(shieldBar, front);
+	}
+}
+
+} // End of namespace Freescape
\ No newline at end of file
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index 72e7f9e05a6..c200b53ead3 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -236,78 +236,6 @@ void DrillerEngine::processBorder() {
 	FreescapeEngine::processBorder();
 }
 
-void DrillerEngine::drawC64UI(Graphics::Surface *surface) {
-	uint32 color = 1;
-	uint8 r, g, b;
-
-	_gfx->selectColorFromFourColorPalette(color, r, g, b);
-	uint32 front = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
-
-	color = 0;
-	if (_gfx->_colorRemaps && _gfx->_colorRemaps->contains(color)) {
-		color = (*_gfx->_colorRemaps)[color];
-	}
-
-	_gfx->readFromPalette(color, r, g, b);
-	uint32 back = _gfx->_texturePixelFormat.ARGBToColor(0xFF, r, g, b);
-
-	int score = _gameStateVars[k8bitVariableScore];
-	drawStringInSurface(_currentArea->_name, 200, 188, front, back, surface);
-	drawStringInSurface(Common::String::format("%04d", int(2 * _position.x())), 149, 148, front, back, surface);
-	drawStringInSurface(Common::String::format("%04d", int(2 * _position.z())), 149, 156, front, back, surface);
-	drawStringInSurface(Common::String::format("%04d", int(2 * _position.y())), 149, 164, front, back, surface);
-	if (_playerHeightNumber >= 0)
-		drawStringInSurface(Common::String::format("%d", _playerHeightNumber), 54, 164, front, back, surface);
-	else
-		drawStringInSurface(Common::String::format("%s", "J"), 54, 164, front, back, surface);
-
-	drawStringInSurface(Common::String::format("%02d", int(_angleRotations[_angleRotationIndex])), 46, 148, front, back, surface);
-	drawStringInSurface(Common::String::format("%3d", _playerSteps[_playerStepIndex]), 44, 156, front, back, surface);
-	drawStringInSurface(Common::String::format("%07d", score), 240, 128, front, back, surface);
-
-	int seconds, minutes, hours;
-	getTimeFromCountdown(seconds, minutes, hours);
-	drawStringInSurface(Common::String::format("%02d", hours), 209, 11, front, back, surface);
-	drawStringInSurface(Common::String::format("%02d", minutes), 232, 11, front, back, surface);
-	drawStringInSurface(Common::String::format("%02d", seconds), 254, 11, front, back, surface);
-
-	Common::String message;
-	int deadline;
-	getLatestMessages(message, deadline);
-	if (deadline <= _countdown) {
-		drawStringInSurface(message, 191, 180, back, front, surface);
-		_temporaryMessages.push_back(message);
-		_temporaryMessageDeadlines.push_back(deadline);
-	} else {
-		if (_currentArea->_gasPocketRadius == 0)
-			message = _messagesList[2];
-		else if (_drillStatusByArea[_currentArea->getAreaID()])
-			message = _messagesList[0];
-		else
-			message = _messagesList[1];
-
-		drawStringInSurface(message, 191, 180, front, back, surface);
-	}
-
-	int energy = _gameStateVars[k8bitVariableEnergy];
-	int shield = _gameStateVars[k8bitVariableShield];
-
-	if (energy >= 0) {
-		Common::Rect backBar(25, 187, 89 - energy, 194);
-		surface->fillRect(backBar, back);
-		Common::Rect energyBar(88 - energy, 187, 88, 194);
-		surface->fillRect(energyBar, front);
-	}
-
-	if (shield >= 0) {
-		Common::Rect backBar(25, 180, 89 - shield, 186);
-		surface->fillRect(backBar, back);
-
-		Common::Rect shieldBar(88 - shield, 180, 88, 186);
-		surface->fillRect(shieldBar, front);
-	}
-}
-
 void DrillerEngine::drawInfoMenu() {
 	_savedScreen = _gfx->getScreenshot();
 
diff --git a/engines/freescape/module.mk b/engines/freescape/module.mk
index f157394ca05..0695e5501b3 100644
--- a/engines/freescape/module.mk
+++ b/engines/freescape/module.mk
@@ -10,6 +10,7 @@ MODULE_OBJS := \
 	games/dark/dos.o \
 	games/driller/amiga.o \
 	games/driller/atari.o \
+	games/driller/c64.o \
 	games/driller/cpc.o \
 	games/driller/dos.o \
 	games/driller/driller.o \


Commit: de83ef51d8300bfc260a919bea1b0eb428cf6b6c
    https://github.com/scummvm/scummvm/commit/de83ef51d8300bfc260a919bea1b0eb428cf6b6c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-22T08:59:26+01:00

Commit Message:
FREESCAPE: make sure game can end when disable demo mode in driller demos

Changed paths:
    engines/freescape/games/driller/driller.cpp


diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index c200b53ead3..86a98f1682e 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -758,7 +758,7 @@ void DrillerEngine::initGameState() {
 }
 
 bool DrillerEngine::checkIfGameEnded() {
-	if (isDemo())
+	if (isDemo() && _demoMode)
 		return (_demoData[_demoIndex + 1] == 0x5f);
 
 	if (_countdown <= 0) {


Commit: 25c1630d5e964f972ca7faf014282de1f01e869d
    https://github.com/scummvm/scummvm/commit/25c1630d5e964f972ca7faf014282de1f01e869d
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2023-03-22T08:59:34+01:00

Commit Message:
FREESCAPE: implemented basic on screen controlls for driller amiga/atari

Changed paths:
    engines/freescape/freescape.cpp
    engines/freescape/freescape.h
    engines/freescape/games/driller/driller.cpp


diff --git a/engines/freescape/freescape.cpp b/engines/freescape/freescape.cpp
index 50df8756748..4911e723dd5 100644
--- a/engines/freescape/freescape.cpp
+++ b/engines/freescape/freescape.cpp
@@ -501,7 +501,10 @@ void FreescapeEngine::processInput() {
 		case Common::EVENT_LBUTTONDOWN:
 			if (_hasFallen)
 				break;
-			shoot();
+			if (_viewArea.contains(_crossairPosition))
+				shoot();
+			else
+				onScreenControls(_crossairPosition);
 			break;
 
 		default:
@@ -510,6 +513,9 @@ void FreescapeEngine::processInput() {
 	}
 }
 
+void FreescapeEngine::onScreenControls(Common::Point mouse) {
+}
+
 void FreescapeEngine::executeMovementConditions() {
 	// Only execute "on collision" room/global conditions
 	executeLocalGlobalConditions(false, true);
diff --git a/engines/freescape/freescape.h b/engines/freescape/freescape.h
index 4837b86b730..80f604f29db 100644
--- a/engines/freescape/freescape.h
+++ b/engines/freescape/freescape.h
@@ -221,6 +221,7 @@ public:
 	void resetInput();
 	void generateDemoInput();
 	virtual void pressedKey(const int keycode);
+	virtual void onScreenControls(Common::Point mouse);
 	void move(CameraMovement direction, uint8 scale, float deltaTime);
 	virtual void checkIfStillInArea();
 	void changePlayerHeight(int index);
@@ -484,6 +485,7 @@ private:
 	void drawCPCUI(Graphics::Surface *surface) override;
 	void drawC64UI(Graphics::Surface *surface) override;
 	void drawAmigaAtariSTUI(Graphics::Surface *surface) override;
+	void onScreenControls(Common::Point mouse) override;
 
 	Graphics::ManagedSurface *load8bitTitleImage(Common::SeekableReadStream *file, int offset);
 	Graphics::ManagedSurface *load8bitDemoImage(Common::SeekableReadStream *file, int offset);
diff --git a/engines/freescape/games/driller/driller.cpp b/engines/freescape/games/driller/driller.cpp
index 86a98f1682e..088f353b997 100644
--- a/engines/freescape/games/driller/driller.cpp
+++ b/engines/freescape/games/driller/driller.cpp
@@ -825,6 +825,49 @@ bool DrillerEngine::checkIfGameEnded() {
 	return false;
 }
 
+void DrillerEngine::onScreenControls(Common::Point mouse) {
+
+	if (isAmiga() || isAtariST()) {
+		Common::Rect arrowFoward(184, 125, 199, 144);
+		Common::Rect arrowLeft(161, 145, 174, 164);
+		Common::Rect arrowRight(207, 145, 222, 164);
+		Common::Rect arrowBack(184, 152, 199, 171);
+		Common::Rect arrowUp(231, 145, 246, 164);
+		Common::Rect arrowDown(254, 145, 269, 164);
+		Common::Rect deployDrill(284, 145, 299, 166);
+		Common::Rect infoScreen(125, 172, 152, 197);
+		Common::Rect saveGame(9, 145, 39, 154);
+		Common::Rect loadGame(9, 156, 39, 164);
+
+		if (arrowFoward.contains(mouse))
+			move(kForwardMovement, _scaleVector.x(), 20.0);
+		else if (arrowLeft.contains(mouse))
+			move(kLeftMovement, _scaleVector.y(), 20.0);
+		else if (arrowRight.contains(mouse))
+			move(kRightMovement, _scaleVector.y(), 20.0);
+		else if (arrowBack.contains(mouse))
+			move(kBackwardMovement, _scaleVector.x(), 20.0);
+		else if (arrowUp.contains(mouse))
+			rise();
+		else if (arrowDown.contains(mouse))
+			lower();
+		else if (deployDrill.contains(mouse))
+			pressedKey(Common::KEYCODE_d);
+		else if (infoScreen.contains(mouse))
+			drawInfoMenu();
+		else if (saveGame.contains(mouse)) {
+			_gfx->setViewport(_fullscreenViewArea);
+			saveGameDialog();
+			_gfx->setViewport(_viewArea);
+		} else if (loadGame.contains(mouse)) {
+			_gfx->setViewport(_fullscreenViewArea);
+			loadGameDialog();
+			_gfx->setViewport(_viewArea);
+		}
+	}
+}
+
+
 Common::Error DrillerEngine::saveGameStreamExtended(Common::WriteStream *stream, bool isAutosave) {
 	for (auto &it : _areaMap) { // All but skip area 255
 		if (it._key == 255)




More information about the Scummvm-git-logs mailing list