[Scummvm-cvs-logs] scummvm master -> 272c1d87e49bc77e5e1a451fa81ea3463fff7d2a

Littleboy littleboy22 at gmail.com
Wed Aug 1 23:58:17 CEST 2012


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:
7f05e1413c LASTEXPRESS: Remove use of skip from savegame functions when loading
4ad7d48fe9 LASTEXPRESS: Remove unused code and move functor definition to only file using it
272c1d87e4 LASTEXPRESS: Fix typo preventing playing NIS animations from the debugger


Commit: 7f05e1413c8b7b3913f64ddb29622dcdf40b2c65
    https://github.com/scummvm/scummvm/commit/7f05e1413c8b7b3913f64ddb29622dcdf40b2c65
Author: Littleboy (littleboy at scummvm.org)
Date: 2012-07-31T23:58:55-07:00

Commit Message:
LASTEXPRESS: Remove use of skip from savegame functions when loading

We cannot accurately skip over compressed data as it is not know before decoding how much data will be used

Changed paths:
    engines/lastexpress/entities/entity.cpp
    engines/lastexpress/game/savepoint.cpp
    engines/lastexpress/sound/queue.cpp



diff --git a/engines/lastexpress/entities/entity.cpp b/engines/lastexpress/entities/entity.cpp
index 4b1fda9..2deca29 100644
--- a/engines/lastexpress/entities/entity.cpp
+++ b/engines/lastexpress/entities/entity.cpp
@@ -88,7 +88,13 @@ void EntityData::EntityCallData::saveLoadWithSerializer(Common::Serializer &s) {
 	syncString(s, sequenceNameCopy, 13);
 
 	// Skip pointers to frame & sequences
-	s.skip(5 * 4);
+	// (we are using a compressed stream, so we cannot seek on load)
+	if (s.isLoading()) {
+		byte empty[5 * 4];
+		s.syncBytes(empty, 5 * 4);
+	} else {
+		s.skip(5 * 4);
+	}
 }
 
 //////////////////////////////////////////////////////////////////////////
diff --git a/engines/lastexpress/game/savepoint.cpp b/engines/lastexpress/game/savepoint.cpp
index 557468e..6b2dfc5 100644
--- a/engines/lastexpress/game/savepoint.cpp
+++ b/engines/lastexpress/game/savepoint.cpp
@@ -242,7 +242,15 @@ void SavePoints::saveLoadWithSerializer(Common::Serializer &s) {
 	}
 
 	// Skip uninitialized data if any
-	s.skip((_savePointsMaxSize - dataSize) * 16);
+	// (we are using a compressed stream, so we cannot seek on load)
+	uint32 unusedDataSize = (_savePointsMaxSize - dataSize) * 16;
+	if (s.isLoading()) {
+		byte *empty = (byte *)malloc(unusedDataSize);
+		s.syncBytes(empty, unusedDataSize);
+		free(empty);
+	} else {
+		s.skip(unusedDataSize);
+	}
 
 	// Number of savepoints
 	uint32 numSavepoints = _savepoints.size();
diff --git a/engines/lastexpress/sound/queue.cpp b/engines/lastexpress/sound/queue.cpp
index 7b3dbcf..d72acfd 100644
--- a/engines/lastexpress/sound/queue.cpp
+++ b/engines/lastexpress/sound/queue.cpp
@@ -372,7 +372,15 @@ void SoundQueue::saveLoadWithSerializer(Common::Serializer &s) {
 			(*i)->saveLoadWithSerializer(s);
 	} else {
 		warning("[Sound::saveLoadWithSerializer] Loading not implemented");
-		s.skip(numEntries * 64);
+
+		uint32 unusedDataSize = numEntries * 64;
+		if (s.isLoading()) {
+			byte *empty = (byte *)malloc(unusedDataSize);
+			s.syncBytes(empty, unusedDataSize);
+			free(empty);
+		} else {
+			s.skip(unusedDataSize);
+		}
 	}
 }
 


Commit: 4ad7d48fe9b306192963398668feb6332a664830
    https://github.com/scummvm/scummvm/commit/4ad7d48fe9b306192963398668feb6332a664830
Author: Littleboy (littleboy at scummvm.org)
Date: 2012-08-01T10:55:55-07:00

Commit Message:
LASTEXPRESS: Remove unused code and move functor definition to only file using it

Changed paths:
    engines/lastexpress/game/action.cpp
    engines/lastexpress/shared.h



diff --git a/engines/lastexpress/game/action.cpp b/engines/lastexpress/game/action.cpp
index 4d1c786..60a3095 100644
--- a/engines/lastexpress/game/action.cpp
+++ b/engines/lastexpress/game/action.cpp
@@ -329,6 +329,22 @@ static const struct {
 	{"8042A",   600}
 };
 
+template<class Arg, class Res, class T>
+class Functor1MemConst : public Common::Functor1<Arg, Res> {
+public:
+	typedef Res (T::*FuncType)(Arg) const;
+
+	Functor1MemConst(T *t, const FuncType &func) : _t(t), _func(func) {}
+
+	bool isValid() const { return _func != 0 && _t != 0; }
+	Res operator()(Arg v1) const {
+		return (_t->*_func)(v1);
+	}
+private:
+	mutable T *_t;
+	const FuncType _func;
+};
+
 Action::Action(LastExpressEngine *engine) : _engine(engine) {
 	ADD_ACTION(dummy);
 	ADD_ACTION(inventory);
diff --git a/engines/lastexpress/shared.h b/engines/lastexpress/shared.h
index bebd149..56cf730 100644
--- a/engines/lastexpress/shared.h
+++ b/engines/lastexpress/shared.h
@@ -1733,62 +1733,6 @@ enum ActionIndex {
 	kActionEnd
 };
 
-//////////////////////////////////////////////////////////////////////////
-// Functors classes used by the engine
-//////////////////////////////////////////////////////////////////////////
-
-// FIXME is this achievable with the existing Functor1Mem function
-template<class Arg, class Res, class T>
-class Functor1MemConst : public Common::Functor1<Arg, Res> {
-public:
-	typedef Res (T::*FuncType)(Arg) const;
-
-	Functor1MemConst(T *t, const FuncType &func) : _t(t), _func(func) {}
-
-	bool isValid() const { return _func != 0 && _t != 0; }
-	Res operator()(Arg v1) const {
-		return (_t->*_func)(v1);
-	}
-private:
-	mutable T *_t;
-	const FuncType _func;
-};
-
-// FIXME move this to existing func.h file
-template<class Arg1, class Arg2, class Arg3, class Arg4, class Result>
-struct QuaternaryFunction {
-	typedef Arg1 FirstArgumentType;
-	typedef Arg2 SecondArgumentType;
-	typedef Arg3 ThirdArgumentType;
-	typedef Arg4 FourthArgumentType;
-	typedef Result ResultType;
-};
-
-template<class Arg1, class Arg2, class Arg3, class Arg4, class Res>
-struct Functor4 : public QuaternaryFunction<Arg1, Arg2, Arg3, Arg4, Res> {
-	virtual ~Functor4() {}
-
-	virtual bool isValid() const = 0;
-	virtual Res operator()(Arg1, Arg2, Arg3, Arg4) const = 0;
-};
-
-template<class Arg1, class Arg2, class Arg3, class Arg4, class Res, class T>
-class Functor4Mem : public Functor4<Arg1, Arg2, Arg3, Arg4, Res> {
-public:
-	typedef Res (T::*FuncType)(Arg1, Arg2, Arg3, Arg4);
-
-	Functor4Mem(T *t, const FuncType &func) : _t(t), _func(func) {}
-
-	bool isValid() const { return _func != 0 && _t != 0; }
-	Res operator()(Arg1 v1, Arg2 v2, Arg3 v3, Arg4 v4) const {
-		return (_t->*_func)(v1, v2, v3, v4);
-	}
-private:
-	mutable T *_t;
-	const FuncType _func;
-};
-
-
 } // End of namespace LastExpress
 
 #endif // LASTEXPRESS_SHARED_H


Commit: 272c1d87e49bc77e5e1a451fa81ea3463fff7d2a
    https://github.com/scummvm/scummvm/commit/272c1d87e49bc77e5e1a451fa81ea3463fff7d2a
Author: Littleboy (littleboy at scummvm.org)
Date: 2012-08-01T14:56:56-07:00

Commit Message:
LASTEXPRESS: Fix typo preventing playing NIS animations from the debugger

Changed paths:
    engines/lastexpress/debug.cpp



diff --git a/engines/lastexpress/debug.cpp b/engines/lastexpress/debug.cpp
index 13a8a77..f89ad8b 100644
--- a/engines/lastexpress/debug.cpp
+++ b/engines/lastexpress/debug.cpp
@@ -609,7 +609,7 @@ bool Debugger::cmdPlayNis(int argc, const char **argv) {
 			loadArchive((ArchiveIndex)getNumber(argv[2]));
 
 		// If we got a nis filename, check that the file exists
-		if (name.contains('.') && _engine->getResourceManager()->hasFile(name)) {
+		if (name.contains('.') && !_engine->getResourceManager()->hasFile(name)) {
 			DebugPrintf("Cannot find file: %s\n", name.c_str());
 			return true;
 		}






More information about the Scummvm-git-logs mailing list