[Scummvm-cvs-logs] scummvm master -> 715a5f9bbec102c58fd145a65cc2c678813bf4f9

bluegr bluegr at gmail.com
Mon Feb 17 11:11:43 CET 2014


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

Summary:
d80f1adb31 SCI: Provide more accurate error messages for unsupported saved games
d92006188e SCI: Skip some still unsupported robot files in RAMA
474c45fdc6 SCI: Some minor cleanup
9addca7287 SCI: Allow saving without a VERSION file in Jones
ed400d57fc SCI: Fix NS rect calculation in GK1 (and SCI32 in general)
715a5f9bbe SCI: Adapt the segment and offset getters/setters for SCI3


Commit: d80f1adb3144a623fd450652bc94aecb37ea4297
    https://github.com/scummvm/scummvm/commit/d80f1adb3144a623fd450652bc94aecb37ea4297
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-02-17T01:46:24-08:00

Commit Message:
SCI: Provide more accurate error messages for unsupported saved games

Changed paths:
    engines/sci/engine/savegame.cpp



diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index ce9a672..c64d5b6 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -860,16 +860,13 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
 		return;
 	}
 
-	if ((meta.version < MINIMUM_SAVEGAME_VERSION) ||
-	    (meta.version > CURRENT_SAVEGAME_VERSION)) {
-		/*
-		if (meta.version < MINIMUM_SAVEGAME_VERSION)
-			warning("Old savegame version detected, unable to load it");
-		else
-			warning("Savegame version is %d, maximum supported is %0d", meta.version, CURRENT_SAVEGAME_VERSION);
-		*/
-
-		showScummVMDialog("The format of this saved game is obsolete, unable to load it");
+	if ((meta.version < MINIMUM_SAVEGAME_VERSION) || (meta.version > CURRENT_SAVEGAME_VERSION)) {
+		if (meta.version < MINIMUM_SAVEGAME_VERSION) {
+			showScummVMDialog("The format of this saved game is obsolete, unable to load it");
+		} else {
+			Common::String msg = Common::String::format("Savegame version is %d, maximum supported is %0d", meta.version, CURRENT_SAVEGAME_VERSION);
+			showScummVMDialog(msg);
+		}
 
 		s->r_acc = TRUE_REG;	// signal failure
 		return;
@@ -878,8 +875,6 @@ void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
 	if (meta.gameObjectOffset > 0 && meta.script0Size > 0) {
 		Resource *script0 = g_sci->getResMan()->findResource(ResourceId(kResourceTypeScript, 0), false);
 		if (script0->size != meta.script0Size || g_sci->getGameObject().getOffset() != meta.gameObjectOffset) {
-			//warning("This saved game was created with a different version of the game, unable to load it");
-
 			showScummVMDialog("This saved game was created with a different version of the game, unable to load it");
 
 			s->r_acc = TRUE_REG;	// signal failure


Commit: d92006188e470a0c17ff437b10dea643df5b64ef
    https://github.com/scummvm/scummvm/commit/d92006188e470a0c17ff437b10dea643df5b64ef
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-02-17T01:47:16-08:00

Commit Message:
SCI: Skip some still unsupported robot files in RAMA

Changed paths:
    engines/sci/video/robot_decoder.cpp



diff --git a/engines/sci/video/robot_decoder.cpp b/engines/sci/video/robot_decoder.cpp
index a567ece..1984073 100644
--- a/engines/sci/video/robot_decoder.cpp
+++ b/engines/sci/video/robot_decoder.cpp
@@ -116,6 +116,10 @@ bool RobotDecoder::load(GuiResourceId id) {
 	if (g_sci->getGameId() == GID_RAMA && id == 1003)
 		return false;
 
+	// Robots for the options in the RAMA menu
+	if (g_sci->getGameId() == GID_RAMA && (id >= 1004 && id <= 1009))
+		return false;
+
 	// TODO: The robot video in the Lighthouse demo gets stuck
 	if (g_sci->getGameId() == GID_LIGHTHOUSE && id == 16)
 		return false;


Commit: 474c45fdc6326d9f2bebea9fcc7df704e0951173
    https://github.com/scummvm/scummvm/commit/474c45fdc6326d9f2bebea9fcc7df704e0951173
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-02-17T01:48:34-08:00

Commit Message:
SCI: Some minor cleanup

Changed paths:
    engines/sci/sci.cpp



diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index fdc016b..5989ed37 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -581,7 +581,7 @@ bool SciEngine::initGame() {
 
 	// Script 0 should always be at segment 1
 	if (script0Segment != 1) {
-		debug(2, "Failed to instantiate script.000");
+		debug(2, "Failed to instantiate script 0");
 		return false;
 	}
 


Commit: 9addca7287b7e22f22d80ffc04077187a0693ad3
    https://github.com/scummvm/scummvm/commit/9addca7287b7e22f22d80ffc04077187a0693ad3
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-02-17T01:52:49-08:00

Commit Message:
SCI: Allow saving without a VERSION file in Jones

Apparently, the original does the same. Fixes bug #6535

Changed paths:
    engines/sci/engine/kernel_tables.h
    engines/sci/engine/kfile.cpp



diff --git a/engines/sci/engine/kernel_tables.h b/engines/sci/engine/kernel_tables.h
index 39244bd..71f1712 100644
--- a/engines/sci/engine/kernel_tables.h
+++ b/engines/sci/engine/kernel_tables.h
@@ -431,7 +431,7 @@ static SciKernelMapEntry s_kernelMap[] = {
 	{ MAP_CALL(RestartGame),       SIG_EVERYWHERE,           "",                      NULL,            NULL },
 	{ MAP_CALL(RestoreGame),       SIG_EVERYWHERE,           "[r0]i[r0]",             NULL,            NULL },
 	{ MAP_CALL(Said),              SIG_EVERYWHERE,           "[r0]",                  NULL,            NULL },
-	{ MAP_CALL(SaveGame),          SIG_EVERYWHERE,           "[r0]i[r0](r)",          NULL,            NULL },
+	{ MAP_CALL(SaveGame),          SIG_EVERYWHERE,           "[r0]i[r0](r0)",         NULL,            NULL },
 	{ MAP_CALL(ScriptID),          SIG_EVERYWHERE,           "[io](i)",               NULL,            NULL },
 	{ MAP_CALL(SetCursor),         SIG_SCI21, SIGFOR_ALL,    "i(i)([io])(i*)",        NULL,            NULL },
 	// TODO: SCI2.1 may supply an object optionally (mother goose sci21 right on startup) - find out why
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp
index b940eca..71e8ec6 100644
--- a/engines/sci/engine/kfile.cpp
+++ b/engines/sci/engine/kfile.cpp
@@ -743,11 +743,11 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) {
 		savegameId = dialog->runModalWithCurrentTarget();
 		game_description = dialog->getResultString();
 		if (game_description.empty()) {
-			// create our own description for the saved game, the user didnt enter it
+			// create our own description for the saved game, the user didn't enter it
 			game_description = dialog->createDefaultSaveDescription(savegameId);
 		}
 		delete dialog;
-		g_sci->_soundCmd->pauseAll(false); // unpause music ( we can't have it paused during save)
+		g_sci->_soundCmd->pauseAll(false); // unpause music (we can't have it paused during save)
 		if (savegameId < 0)
 			return NULL_REG;
 
@@ -849,8 +849,6 @@ reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
 		}
 		// don't adjust ID of the saved game, it's already correct
 	} else {
-		if (argv[2].isNull())
-			error("kRestoreGame: called with parameter 2 being NULL");
 		if (g_sci->getGameId() == GID_JONES) {
 			// Jones has one save slot only
 			savegameId = 0;
@@ -879,7 +877,6 @@ reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) {
 		in = saveFileMan->openForLoading(filename);
 		if (in) {
 			// found a savegame file
-
 			gamestate_restore(s, in);
 			delete in;
 


Commit: ed400d57fce69a88c9cdaf6dde03c89e22925968
    https://github.com/scummvm/scummvm/commit/ed400d57fce69a88c9cdaf6dde03c89e22925968
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-02-17T02:00:17-08:00

Commit Message:
SCI: Fix NS rect calculation in GK1 (and SCI32 in general)

This fixes the regressions caused by refactoring in SCI32. Thanks to
Timo Korvola for tracking down the issue and providing an initial
patch in bug #6452

Changed paths:
    engines/sci/engine/kgraphics32.cpp
    engines/sci/graphics/compare.cpp
    engines/sci/graphics/compare.h



diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp
index cd735d1..0eb4fa8 100644
--- a/engines/sci/engine/kgraphics32.cpp
+++ b/engines/sci/engine/kgraphics32.cpp
@@ -142,7 +142,15 @@ reg_t kIsOnMe(EngineState *s, int argc, reg_t *argv) {
 	uint16 y = argv[1].toUint16();
 	reg_t targetObject = argv[2];
 	uint16 illegalBits = argv[3].getOffset();
-	Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject, true);
+	Common::Rect nsRect = g_sci->_gfxCompare->getNSRect(targetObject);
+
+	uint16 itemX = readSelectorValue(s->_segMan, targetObject, SELECTOR(x));
+	uint16 itemY = readSelectorValue(s->_segMan, targetObject, SELECTOR(y));
+	// If top and left are negative, we need to adjust coordinates by the item's x and y
+	if (nsRect.left < 0)
+		nsRect.translate(itemX, 0);
+	if (nsRect.top < 0)
+		nsRect.translate(0, itemY);
 
 	// we assume that x, y are local coordinates
 
diff --git a/engines/sci/graphics/compare.cpp b/engines/sci/graphics/compare.cpp
index b42063b..8b89cf4 100644
--- a/engines/sci/graphics/compare.cpp
+++ b/engines/sci/graphics/compare.cpp
@@ -241,21 +241,13 @@ void GfxCompare::kernelBaseSetter(reg_t object) {
 	}
 }
 
-Common::Rect GfxCompare::getNSRect(reg_t object, bool fixRect) {
+Common::Rect GfxCompare::getNSRect(reg_t object) {
 	Common::Rect nsRect;
 	nsRect.top = readSelectorValue(_segMan, object, SELECTOR(nsTop));
 	nsRect.left = readSelectorValue(_segMan, object, SELECTOR(nsLeft));
 	nsRect.bottom = readSelectorValue(_segMan, object, SELECTOR(nsBottom));
 	nsRect.right = readSelectorValue(_segMan, object, SELECTOR(nsRight));
 
-	if (fixRect) {
-		// nsRect top/left may be negative, adjust accordingly
-		if (nsRect.top < 0)
-			nsRect.top = 0;
-		if (nsRect.left < 0)
-			nsRect.left = 0;
-	}
-
 	return nsRect;
 }
 
diff --git a/engines/sci/graphics/compare.h b/engines/sci/graphics/compare.h
index 0080406..48e9e37 100644
--- a/engines/sci/graphics/compare.h
+++ b/engines/sci/graphics/compare.h
@@ -42,7 +42,7 @@ public:
 	reg_t kernelCanBeHere(reg_t curObject, reg_t listReference);
 	bool kernelIsItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo, Common::Point position);
 	void kernelBaseSetter(reg_t object);
-	Common::Rect getNSRect(reg_t object, bool fixRect = false);
+	Common::Rect getNSRect(reg_t object);
 	void setNSRect(reg_t object, Common::Rect nsRect);
 
 private:


Commit: 715a5f9bbec102c58fd145a65cc2c678813bf4f9
    https://github.com/scummvm/scummvm/commit/715a5f9bbec102c58fd145a65cc2c678813bf4f9
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-02-17T02:05:40-08:00

Commit Message:
SCI: Adapt the segment and offset getters/setters for SCI3

This is by no means complete, but it's a good start. It is based on an
earlier discussion on the subject, and it allows us to use the highest
two bits from the segment for offset addresses

Changed paths:
    engines/sci/engine/vm_types.cpp
    engines/sci/engine/vm_types.h



diff --git a/engines/sci/engine/vm_types.cpp b/engines/sci/engine/vm_types.cpp
index 5327dd1..00b55c6 100644
--- a/engines/sci/engine/vm_types.cpp
+++ b/engines/sci/engine/vm_types.cpp
@@ -28,6 +28,43 @@
 
 namespace Sci {
 
+SegmentId reg_t::getSegment() const {
+	if (getSciVersion() <= SCI_VERSION_2_1) {
+		return _segment;
+	} else {
+		// Return the lower 14 bits of the segment
+		return (_segment & 0x3FFF);
+	}
+}
+
+void reg_t::setSegment(SegmentId segment) {
+	if (getSciVersion() <= SCI_VERSION_2_1) {
+		_segment = segment;
+	} else {
+		// Set the lower 14 bits of the segment, and preserve the upper 2 ones for the offset
+		_segment = (_segment & 0xC000) | (segment & 0x3FFF);
+	}
+}
+
+uint32 reg_t::getOffset() const {
+	if (getSciVersion() <= SCI_VERSION_2_1) {
+		return _offset;
+	} else {
+		// Return the lower 16 bits from the offset, and the 17th and 18th bits from the segment
+		return ((_segment & 0xC000) << 2) | _offset;
+	}
+}
+
+void reg_t::setOffset(uint32 offset) {
+	if (getSciVersion() <= SCI_VERSION_2_1) {
+		_offset = offset;
+	} else {
+		// Store the lower 16 bits in the offset, and the 17th and 18th bits in the segment
+		_offset = offset & 0xFFFF;
+		_segment = ((offset & 0x30000) >> 2) | (_segment & 0x3FFF);
+	}
+}
+
 reg_t reg_t::lookForWorkaround(const reg_t right, const char *operation) const {
 	SciTrackOriginReply originReply;
 	SciWorkaroundSolution solution = trackOriginAndFindWorkaround(0, arithmeticWorkarounds, &originReply);
diff --git a/engines/sci/engine/vm_types.h b/engines/sci/engine/vm_types.h
index 22bd8be..a181bf1 100644
--- a/engines/sci/engine/vm_types.h
+++ b/engines/sci/engine/vm_types.h
@@ -35,36 +35,25 @@ struct reg_t {
 	SegmentId _segment;
 	uint16 _offset;
 
-	inline SegmentId getSegment() const {
-		return _segment;
-	}
-
-	inline void setSegment(SegmentId segment) {
-		_segment = segment;
-	}
-
-	inline uint16 getOffset() const {
-		return _offset;
-	}
-
-	inline void setOffset(uint16 offset) {
-		_offset = offset;
-	}
+	SegmentId getSegment() const;
+	void setSegment(SegmentId segment);
+	uint32 getOffset() const;
+	void setOffset(uint32 offset);
 
 	inline void incOffset(int16 offset) {
 		setOffset(getOffset() + offset);
 	}
 
 	inline bool isNull() const {
-		return (_offset | getSegment()) == 0;
+		return (getOffset() | getSegment()) == 0;
 	}
 
 	inline uint16 toUint16() const {
-		return _offset;
+		return (uint16)getOffset();
 	}
 
 	inline int16 toSint16() const {
-		return (int16)_offset;
+		return (int16)getOffset();
 	}
 
 	bool isNumber() const {






More information about the Scummvm-git-logs mailing list