[Scummvm-git-logs] scummvm master -> a9375754128df2b8b5f20d14acd55d0300771056

alxpnv a04198622 at gmail.com
Mon Sep 20 13:04:39 UTC 2021


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

Summary:
0fbe223f8a ASYLUM: disable saving in demo versions
377ffb92be ASYLUM: add support for loading during startup
eed6789af2 ASYLUM: fix buffer overrun
f1012335f7 ASYLUM: fix uninitialized variable
e3af0aa2d1 ASYLUM: add missing va_end
8222dee141 ASYLUM: fix uninitialized class members
b8cfb363a3 ASYLUM: fix buffer overruns in Actor::getStride()
69b545a8d0 ASYLUM: remove unused class member
f6ca392be7 ASYLUM: use strlcpy
a937575412 ASYLUM: (Pipes puzzle) fix uninitialized class members


Commit: 0fbe223f8a2a92e5531fabb030f8dbc51ed3f18d
    https://github.com/scummvm/scummvm/commit/0fbe223f8a2a92e5531fabb030f8dbc51ed3f18d
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-20T11:14:54+03:00

Commit Message:
ASYLUM: disable saving in demo versions

Changed paths:
    engines/asylum/asylum.cpp


diff --git a/engines/asylum/asylum.cpp b/engines/asylum/asylum.cpp
index f8c96c4b54..eedac1e7bf 100644
--- a/engines/asylum/asylum.cpp
+++ b/engines/asylum/asylum.cpp
@@ -641,11 +641,15 @@ void AsylumEngine::checkAchievements() {
 // Save/Load
 //////////////////////////////////////////////////////////////////////////
 bool AsylumEngine::canLoadGameStateCurrently() {
-	return _handler == _scene || _handler == _menu;
+	return (!checkGameVersion("Demo")
+		&& (_handler == _scene || _handler == _menu)
+		&& !speech()->getSoundResourceId());
 }
 
 bool AsylumEngine::canSaveGameStateCurrently() {
-	return _handler == _scene;
+	return (!checkGameVersion("Demo")
+		&& (_handler == _scene)
+		&& !speech()->getSoundResourceId());
 }
 
 Common::Error AsylumEngine::loadGameState(int slot) {


Commit: 377ffb92bea93a1eb41fed0dfec59633d82e46b9
    https://github.com/scummvm/scummvm/commit/377ffb92bea93a1eb41fed0dfec59633d82e46b9
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-20T12:03:40+03:00

Commit Message:
ASYLUM: add support for loading during startup

Changed paths:
    engines/asylum/asylum.cpp


diff --git a/engines/asylum/asylum.cpp b/engines/asylum/asylum.cpp
index eedac1e7bf..5cac55169e 100644
--- a/engines/asylum/asylum.cpp
+++ b/engines/asylum/asylum.cpp
@@ -145,7 +145,18 @@ Common::Error AsylumEngine::run() {
 			_video->play(0, NULL);
 		restart();
 	} else {
-		_handler = _menu;
+		int saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
+		bool noError = false;
+
+		if (saveSlot >= 0 && saveSlot < SAVEGAME_COUNT) {
+			if (loadGameState(saveSlot).getCode() != Common::kNoError)
+				warning("[AsylumEngine::run] Could not load savegame in slot %d", saveSlot);
+			else
+				noError = true;
+		}
+
+		if (!noError)
+			_handler = _menu;
 
 		// Load config
 		Config.read();
@@ -655,7 +666,10 @@ bool AsylumEngine::canSaveGameStateCurrently() {
 Common::Error AsylumEngine::loadGameState(int slot) {
 	savegame()->loadList();
 	savegame()->setIndex(slot);
-	startGame(savegame()->getScenePack(), AsylumEngine::kStartGameLoad);
+	if (savegame()->hasSavegame(slot))
+		startGame(savegame()->getScenePack(), AsylumEngine::kStartGameLoad);
+	else
+		return Common::kReadingFailed;
 
 	return Common::kNoError;
 }


Commit: eed6789af2f9c88929de73a101d79b897c4e4d03
    https://github.com/scummvm/scummvm/commit/eed6789af2f9c88929de73a101d79b897c4e4d03
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-20T12:15:35+03:00

Commit Message:
ASYLUM: fix buffer overrun

CID 1453215

Changed paths:
    engines/asylum/system/screen.cpp


diff --git a/engines/asylum/system/screen.cpp b/engines/asylum/system/screen.cpp
index 1e07018b1e..8e54073fa0 100644
--- a/engines/asylum/system/screen.cpp
+++ b/engines/asylum/system/screen.cpp
@@ -390,15 +390,10 @@ void Screen::startPaletteFade(ResourceId resourceId, int32 ticksWait, int32 delt
 
 void Screen::stopPaletteFade(char red, char green, char blue) {
 	// Setup main palette
-	byte *palette = (byte *)&_mainPalette;
-	palette += 4;
-
-	for (uint32 i = 0; i < ARRAYSIZE(_mainPalette) - 3; i += 3) {
-		palette[0] = (byte)red;
-		palette[1] = (byte)green;
-		palette[2] = (byte)blue;
-
-		palette += 3;
+	for (uint i = 3; i < ARRAYSIZE(_mainPalette) - 3; i += 3) {
+		_mainPalette[i]     = (byte)red;
+		_mainPalette[i + 1] = (byte)green;
+		_mainPalette[i + 2] = (byte)blue;
 	}
 
 	stopPaletteFadeTimer();


Commit: f1012335f760c048e5e9baa5d190ebd95e6a9acd
    https://github.com/scummvm/scummvm/commit/f1012335f760c048e5e9baa5d190ebd95e6a9acd
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-20T12:22:37+03:00

Commit Message:
ASYLUM: fix uninitialized variable

CID 1453219

Changed paths:
    engines/asylum/system/graphics.h


diff --git a/engines/asylum/system/graphics.h b/engines/asylum/system/graphics.h
index ac1f18706d..ee11725623 100644
--- a/engines/asylum/system/graphics.h
+++ b/engines/asylum/system/graphics.h
@@ -45,6 +45,11 @@ struct GraphicFrame {
 	uint16 getWidth() { return surface.w; }
 	uint16 getHeight() { return surface.h; }
 
+	GraphicFrame() {
+		size = offset = 0;
+		x = y = 0;
+	}
+
 	Common::Rect getRect() {
 		return Common::Rect(x, y, x + getWidth(), y + getHeight());
 	}


Commit: e3af0aa2d1d9b10f343a32b0c50ce47dd417cac2
    https://github.com/scummvm/scummvm/commit/e3af0aa2d1d9b10f343a32b0c50ce47dd417cac2
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-20T14:10:48+03:00

Commit Message:
ASYLUM: add missing va_end

CID 1453214

Changed paths:
    engines/asylum/system/screen.cpp


diff --git a/engines/asylum/system/screen.cpp b/engines/asylum/system/screen.cpp
index 8e54073fa0..1596af3e4e 100644
--- a/engines/asylum/system/screen.cpp
+++ b/engines/asylum/system/screen.cpp
@@ -589,6 +589,8 @@ void Screen::setupTransTables(uint32 count, ...) {
 		memcpy(&_transTableBuffer[index], getResource()->get(id)->data, TRANSPARENCY_TABLE_SIZE);
 		index += TRANSPARENCY_TABLE_SIZE;
 	}
+
+	va_end(va);
 }
 
 void Screen::clearTransTables() {


Commit: 8222dee141383479dcab6db8071fe9bfd1f108f0
    https://github.com/scummvm/scummvm/commit/8222dee141383479dcab6db8071fe9bfd1f108f0
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-20T15:07:26+03:00

Commit Message:
ASYLUM: fix uninitialized class members

CID 1453223

Changed paths:
    engines/asylum/system/config.cpp


diff --git a/engines/asylum/system/config.cpp b/engines/asylum/system/config.cpp
index 836a86eeef..e88eab9c16 100644
--- a/engines/asylum/system/config.cpp
+++ b/engines/asylum/system/config.cpp
@@ -68,6 +68,8 @@ ConfigurationManager::ConfigurationManager() {
 
 	showMovieSubtitles = false;
 	showEncounterSubtitles = true;
+	showSceneLoading = true;
+	showIntro = true;
 
 	gammaLevel = 0;
 	performance = 0;


Commit: b8cfb363a3e2cbae4131825ef7fb6ba8bb5bfd74
    https://github.com/scummvm/scummvm/commit/b8cfb363a3e2cbae4131825ef7fb6ba8bb5bfd74
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-20T15:36:45+03:00

Commit Message:
ASYLUM: fix buffer overruns in Actor::getStride()

CIDs 1457938 and 1457990

Changed paths:
    engines/asylum/resources/actor.cpp


diff --git a/engines/asylum/resources/actor.cpp b/engines/asylum/resources/actor.cpp
index e21bc1badf..3a58e9edff 100644
--- a/engines/asylum/resources/actor.cpp
+++ b/engines/asylum/resources/actor.cpp
@@ -3786,8 +3786,10 @@ DrawFlags Actor::getGraphicsFlags() {
 }
 
 int32 Actor::getStride(ActorDirection dir, uint32 frameIndex) const {
+	// WORKAROUND: It seems that the original allows frameIndex to be out of range
+	uint32 index = MIN<uint32>(frameIndex, 19);
 	if (frameIndex >= ARRAYSIZE(_distancesNS))
-		debugC(kDebugLevelMain, "[Actor::getStride] Invalid frame index (was: %d, max: %d)", _frameIndex, ARRAYSIZE(_distancesNS) - 1);
+		debugC(kDebugLevelMain, "[Actor::getStride] Invalid frame index %d for actor '%s' with direction %d", frameIndex, _name, dir);
 
 	switch (dir) {
 	default:
@@ -3795,18 +3797,17 @@ int32 Actor::getStride(ActorDirection dir, uint32 frameIndex) const {
 
 	case kDirectionN:
 	case kDirectionS:
-		// XXX it seems that the original allows frameIndex to be out of range
-		return (frameIndex < ARRAYSIZE(_distancesNS) ? _distancesNS[frameIndex] : _distancesNSEO[frameIndex % ARRAYSIZE(_distancesNS)]);
+		return _distancesNS[index];
 
 	case kDirectionNW:
 	case kDirectionSW:
 	case kDirectionSE:
 	case kDirectionNE:
-		return _distancesNSEO[frameIndex];
+		return _distancesNSEO[index];
 
 	case kDirectionW:
 	case kDirectionE:
-		return _distancesEO[frameIndex];
+		return _distancesEO[index];
 	}
 }
 


Commit: 69b545a8d036522a8796db3cd57f8484b859d4d7
    https://github.com/scummvm/scummvm/commit/69b545a8d036522a8796db3cd57f8484b859d4d7
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-20T15:41:39+03:00

Commit Message:
ASYLUM: remove unused class member

CID 1453227

Changed paths:
    engines/asylum/resources/encounters.h


diff --git a/engines/asylum/resources/encounters.h b/engines/asylum/resources/encounters.h
index d146c050b6..c5bb51d3e9 100644
--- a/engines/asylum/resources/encounters.h
+++ b/engines/asylum/resources/encounters.h
@@ -195,8 +195,6 @@ private:
 	uint32 _keywordStartIndex;
 	uint32 _keywordsOffset;
 
-	EventHandler *_previousEventHandler;
-
 	// Internal flags
 	bool _shouldEnablePlayer;
 	bool _wasPlayerDisabled;


Commit: f6ca392be75226d95ed33fe4a665023e6d821a51
    https://github.com/scummvm/scummvm/commit/f6ca392be75226d95ed33fe4a665023e6d821a51
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-20T15:46:44+03:00

Commit Message:
ASYLUM: use strlcpy

CID 1453210

Changed paths:
    engines/asylum/views/menu.cpp


diff --git a/engines/asylum/views/menu.cpp b/engines/asylum/views/menu.cpp
index 04f6aa095f..5a823f9f7c 100644
--- a/engines/asylum/views/menu.cpp
+++ b/engines/asylum/views/menu.cpp
@@ -1228,7 +1228,7 @@ void Menu::updateViewMovies() {
 	snprintf((char *)&text2, sizeof(text2), getText()->get(MAKE_RESOURCE(kResourcePackText, 1357)), getSharedData()->cdNumber);
 	getText()->drawCentered(Common::Point(10, 100), 620, text2);
 
-	strcpy((char *)&text, getText()->get(MAKE_RESOURCE(kResourcePackText, 1359 + _movieIndex)));
+	Common::strlcpy((char *)&text, getText()->get(MAKE_RESOURCE(kResourcePackText, 1359 + _movieIndex)), sizeof(text));
 	snprintf((char *)&text2, sizeof(text2), getText()->get(MAKE_RESOURCE(kResourcePackText, 1356)), moviesCd[_movieIndex]);
 	strcat((char *)&text, (char *)&text2);
 	getText()->drawCentered(Common::Point(10, 134), 620, text);


Commit: a9375754128df2b8b5f20d14acd55d0300771056
    https://github.com/scummvm/scummvm/commit/a9375754128df2b8b5f20d14acd55d0300771056
Author: alxpnv (alxpnv22 at yahoo.com)
Date: 2021-09-20T16:04:29+03:00

Commit Message:
ASYLUM: (Pipes puzzle) fix uninitialized class members

CIDs 1453211 and 1453229

Changed paths:
    engines/asylum/puzzles/pipes.cpp
    engines/asylum/puzzles/pipes.h


diff --git a/engines/asylum/puzzles/pipes.cpp b/engines/asylum/puzzles/pipes.cpp
index d89dc41871..7f3ea5f377 100644
--- a/engines/asylum/puzzles/pipes.cpp
+++ b/engines/asylum/puzzles/pipes.cpp
@@ -96,6 +96,17 @@ void Peephole::startUpWater(bool flag) {
 //////////////////////////////////////////////////////////////////////////
 // Connector
 //////////////////////////////////////////////////////////////////////////
+Connector::Connector() :
+	_id(0),
+	_position(NULL),
+	_state(kBinNum0000),
+	_isConnected(false),
+	_nextConnector(NULL),
+	_type(kConnectorTypeI),
+	_nextConnectorPosition(kDirectionNowhere) {
+	memset(_nodes, 0, sizeof(_nodes));
+}
+
 void Connector::init(Peephole *n, Peephole *e, Peephole *s, Peephole *w, uint32 pos, ConnectorType type, Connector *nextConnector, Direction nextConnectorPosition) {
 	_nodes[0] = n;
 	_nodes[1] = e;
diff --git a/engines/asylum/puzzles/pipes.h b/engines/asylum/puzzles/pipes.h
index 7221fd249e..761cca9bfc 100644
--- a/engines/asylum/puzzles/pipes.h
+++ b/engines/asylum/puzzles/pipes.h
@@ -73,7 +73,7 @@ enum Direction {
 
 class Peephole {
 public:
-	Peephole() {}
+	Peephole() : _id(0) {}
 	~Peephole() {}
 
 	static bool marks[peepholesCount];
@@ -98,7 +98,7 @@ private:
 
 class Connector {
 public:
-	Connector() {}
+	Connector();
 	~Connector() {}
 
 	uint32 getId() { return _id; }




More information about the Scummvm-git-logs mailing list