[Scummvm-cvs-logs] CVS: residual README,1.25,1.26 TODO,1.49,1.50 actor.cpp,1.54,1.55 costume.cpp,1.30,1.31 costume.h,1.16,1.17 engine.cpp,1.79,1.80 lua.cpp,1.142,1.143 model.cpp,1.28,1.29 model.h,1.10,1.11 smush.cpp,1.62,1.63 smush.h,1.25,1.26

Erich Edgar Hoover compholio at users.sourceforge.net
Thu Jul 21 08:18:33 CEST 2005


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10421

Modified Files:
	README TODO actor.cpp costume.cpp costume.h engine.cpp lua.cpp 
	model.cpp model.h smush.cpp smush.h 
Log Message:
Fix for scene changing bug (task cleanup problem) - better SMUSH looping - actor choring now allowed when actor not visible.  commit from wrong folder, here's the rest.

Index: README
===================================================================
RCS file: /cvsroot/scummvm/residual/README,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- README	17 Jul 2005 23:40:21 -0000	1.25
+++ README	21 Jul 2005 15:16:33 -0000	1.26
@@ -1,5 +1,5 @@
 Residual: A LucasArts 3D game interpreter           Version:      0.04-CVS
-(C) 2003-2005 The ScummVM-Residual team             Last Updated: 17 Jul 2005
+(C) 2003-2005 The ScummVM-Residual team             Last Updated: 20 Jul 2005
 ------------------------------------------------------------------------------
 
 What is Residual?
@@ -59,11 +59,10 @@
 to save/load, lighting, etc. Crashes are likely.
 
 Game currently playable to:
-	Manny reaps Meche (Mercedes Colomar)
+	Manny gives Glottis back his heart in the Petrified Forest
 Caveats:
-1) Random crash leaving the scene with the balloon handler
-2) Must press "Esc" after listening to Meche, conversation doesn't
-   continue on its own
+1) When Manny goes onto the DOD roof for the pigeon eggs you must not
+   forget to use a balloon with the bread or else the game will hang
 
 What are the default keys?
 --------------------------

Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/residual/TODO,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -d -r1.49 -r1.50
--- TODO	17 Jul 2005 23:40:21 -0000	1.49
+++ TODO	21 Jul 2005 15:16:33 -0000	1.50
@@ -1,18 +1,16 @@
 Residual TODO list (in rough order of priority):
 ------------------------------------------------
 Assigned tasks:
- * Make game playable to the petrified forest (compholio)
  * Finish text drawing support (salty-horse, aquadran)
  * Cross platform GUI for debug input dialogs and path selection (ender)
  * Improved walk box code (frob)
  * Implement FadeInChore and FadeOutChore (frob)
  * Implement texture mapping with light shading in TinyGL (aquadran)
- * Improve menu support (compholio)
+ * Fix bug with pigeons, likely actor rotating/turning not being implemented (compholio)
  * Improve SMUSH looping support (compholio)
+ * Improve menu support (compholio)
 
 Unassigned (help wanted):
- * Fix random problem with Manny changing between scenes, switching between
-   fe.set and st.set is a good example of where it happens a lot
  * Add configure script (Custom ala main ScummVM, NOT autoconf)
  * Proper light setup in drivers
  * Finish Save/Load support for rest of Engine (Lua and iMuse done)

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/actor.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- actor.cpp	17 Jul 2005 23:40:21 -0000	1.54
+++ actor.cpp	21 Jul 2005 15:16:33 -0000	1.55
@@ -271,7 +271,7 @@
 	textName += ".txt";
 
 	if (msg[0] != '/')
-		warning("Actor::sayLine: Invalid source message (should be an ID)!");
+		warning("Actor::sayLine: Invalid source message (should be /xxxx/, is: %s)!", msg);
 
 	if (msgId[0] == 0) {
 		error("Actor::sayLine: No message ID for text!");

Index: costume.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/costume.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- costume.cpp	17 Jul 2005 23:40:21 -0000	1.30
+++ costume.cpp	21 Jul 2005 15:16:33 -0000	1.31
@@ -208,6 +208,18 @@
 ModelComponent::ModelComponent(Costume::Component *parent, int parentID, const char *filename, char *tag) :
 		Costume::Component(parent, parentID, tag), _filename(filename), _obj(NULL), _cmap(NULL),
 		_colormap(DEFAULT_COLORMAP), _hier(NULL) {
+	const char *comma = std::strchr(filename, ',');
+	
+	// Can be called with a comma and a numeric parameter afterward, but
+	// the use for this parameter is currently unknown
+	// Example: At the "scrimshaw parlor" in Rubacava the object
+	// "manny_cafe.3do,1" is requested
+	if (comma != NULL) {
+		_filename = std::string(filename, comma);
+		warning("Comma in model components not supported: %s", filename);
+	} else {
+		_filename = filename;
+	}
 }
 
 void ModelComponent::init() {
@@ -716,6 +728,10 @@
 	}
 }
 
+// Should initialize the status variables so the chore can't play unexpectedly
+Costume::Chore::Chore() : _playing(false), _hasPlayed(false), _looping(false), _currTime(-1) {
+}
+
 void Costume::Chore::load(Costume *owner, TextSplitter &ts) {
 	_owner = owner;
 	_tracks = new ChoreTrack[_numTracks];
@@ -876,6 +892,14 @@
 		_chores[i].stop();
 }
 
+int Costume::isChoring(char *name, bool excludeLooping) {
+	for (int i = 0; i < _numChores; i++) {
+		if (!strcmp(_chores[i]._name, name) && _chores[i]._playing && !(excludeLooping && _chores[i]._looping))
+			return i;
+	}
+	return -1;
+}
+
 int Costume::isChoring(int num, bool excludeLooping) {
 	if (_chores[num]._playing && !(excludeLooping && _chores[num]._looping))
 		return num;

Index: costume.h
===================================================================
RCS file: /cvsroot/scummvm/residual/costume.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- costume.h	17 Jul 2005 23:40:21 -0000	1.16
+++ costume.h	21 Jul 2005 15:16:34 -0000	1.17
@@ -56,6 +56,7 @@
 		}
 	}
 	void stopChores();
+	int isChoring(char *name, bool excludeLooping);
 	int isChoring(int num, bool excludeLooping);
 	int isChoring(bool excludeLooping);
 
@@ -122,6 +123,7 @@
 
 	class Chore {
 	public:
+		Chore();
 		void load(Costume *owner, TextSplitter &ts);
 		void play();
 		void playLooping();

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- engine.cpp	17 Jul 2005 23:40:21 -0000	1.79
+++ engine.cpp	21 Jul 2005 15:16:34 -0000	1.80
@@ -254,9 +254,12 @@
 				// instead of inside the lua_runtasks loop, otherwise certain functions
 				// may request a set that was just deactivated
 				a->putInSet();
-				// Update the actor's costumes
+				// Update the actor's costumes & chores
 				g_currentUpdatedActor = *i;
-				if (_currScene != NULL && a->inSet(_currScene->name()) && a->visible())
+				// Note that the actor need not be visible to update chores, for example:
+				// when Manny has just brought Meche back he is offscreen several times
+				// when he needs to perform certain chores
+				if (_currScene != NULL && a->inSet(_currScene->name()))
 					a->update();
 			}
 			g_currentUpdatedActor = NULL;

Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -d -r1.142 -r1.143
--- lua.cpp	17 Jul 2005 23:40:21 -0000	1.142
+++ lua.cpp	21 Jul 2005 15:16:34 -0000	1.143
@@ -140,8 +140,6 @@
 }
 
 static inline double check_double(int num) {
-	double val;
-	
 	// Have found some instances, such as in Rubacava if you jump there,
 	// where doubles of "zero" are called as nil
 	if(lua_isnil(lua_getparam(num)))
@@ -535,6 +533,10 @@
 		act->turnTo(pitch, yaw, roll);
 	else
 		act->setRot(pitch, yaw, roll);
+	// Naranja will cause the game to crash without this
+	lua_pushnumber(pitch);
+	lua_pushnumber(yaw);
+	lua_pushnumber(roll);
 }
 
 static void GetActorRot() {
@@ -985,10 +987,11 @@
 }
 
 static void IsActorChoring() {
-	Actor *act;
 	bool excludeLooping;
+	lua_Object param2;
 	Costume *cost;
-	int result;
+	Actor *act;
+	int result = -1;
 
 	DEBUG_FUNCTION();
 	act = check_actor(1);
@@ -999,10 +1002,21 @@
 		return;
 	}
 
-	if (lua_isnil(lua_getparam(2)))
+	// This function can be called with "nil" to get the current
+	// chore, a number to check to see if that chore ID is
+	// running, or a string that will check to see if the
+	// chore of a particular name is running
+	param2 = lua_getparam(2);
+	if (lua_isnil(param2))
 		result = cost->isChoring(excludeLooping);
-	else
+	else if (lua_isnumber(param2))
 		result = cost->isChoring(check_int(2), excludeLooping);
+	else if (lua_isstring(param2))
+		result = cost->isChoring(lua_getstring(param2), excludeLooping);
+	else {
+		if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
+			warning("IsActorChoring: LUA Parameter 2 is of unhandled type!");
+	}
 
 	if (result < 0)
 		lua_pushnil();
@@ -1257,7 +1271,7 @@
 
 static void SayLine() {
 	int pan = 64, param_number = 2;
-	char msgId[32], *str;
+	char msgId[32], *str = NULL;
 	lua_Object param2;
 	Actor *act;
 	
@@ -1267,8 +1281,15 @@
 	if (!lua_isnil(param2)) {
 		do {
 			if (lua_isstring(param2)) {
-				str = lua_getstring(param2);
-				parseMsgText(str, msgId);
+				char *tmpstr = lua_getstring(param2);
+				
+				// Fix so Police Chief Bogen's text is interpretted correctly,
+				// Bogen has a second text item that's just "1" which previously
+				// over-wrote the actual message
+				if (tmpstr[0] == '/' && tmpstr[strlen(tmpstr)-1] == '/') {
+					parseMsgText(tmpstr, msgId);
+					str = tmpstr;
+				}
 			} else if (lua_isnumber(param2)) {
 				pan = 64;
 			} else if (lua_istable(param2)) {
@@ -1277,6 +1298,12 @@
 			}
 			param2 = lua_getparam(param_number++);
 		} while (!lua_isnil(param2));
+		if (str == NULL) {
+			if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
+				warning("SayLine: Did not find a message ID!");
+			stubWarning("ERROR: SayLine");
+			return;
+		}
 		act->sayLine(str, msgId);
 	}
 }
@@ -1356,6 +1383,8 @@
 		}
 	}
 	lua_pushnil();
+	lua_pushnil();
+	lua_pushnil();
 }
 
 static void MakeSectorActive(void) {
@@ -1461,10 +1490,13 @@
 	
 	DEBUG_FUNCTION();
 	name = luaL_check_string(1);
-	if (std::strcmp(name, g_engine->sceneName()) == 0)
+	if (std::strcmp(name, g_engine->sceneName()) == 0) {
 		lua_pushnumber(g_engine->currScene()->setup());
-	else
+	} else {
+		if (debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
+			warning("GetCurrentSetup() Requested scene (%s) is not the active scene (%s)", name, g_engine->sceneName());
 		lua_pushnil();
+	}
 }
 
 // FIXME: Function only spits back what it's given
@@ -2173,7 +2205,8 @@
 	
 	DEBUG_FUNCTION();
 	if (lua_isnil(lua_getparam(1))) {
-		error("KillTextObject(NULL)");
+		if (debugLevel == DEBUG_ERROR || debugLevel == DEBUG_ALL)
+			error("KillTextObject(NULL)");
 		return;
 	}
 

Index: model.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/model.cpp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- model.cpp	17 Jul 2005 23:40:21 -0000	1.28
+++ model.cpp	21 Jul 2005 15:16:35 -0000	1.29
@@ -233,6 +233,7 @@
 	_meshVisible = true;
 	_hierVisible = true;
 	_totalWeight = 1;
+	_initialized = true;
 }
 
 void Model::draw() const {
@@ -471,6 +472,9 @@
 }
 
 void Model::HierNode::update() {
+	if (!_initialized)
+		return;
+	
 	_localMatrix._pos.set(_animPos.x() / _totalWeight, _animPos.y() / _totalWeight, _animPos.z() / _totalWeight);
 	_localMatrix._rot.buildFromPitchYawRoll(_animPitch / _totalWeight, _animYaw / _totalWeight, _animRoll / _totalWeight);
 

Index: model.h
===================================================================
RCS file: /cvsroot/scummvm/residual/model.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- model.h	10 Jul 2005 18:57:27 -0000	1.10
+++ model.h	21 Jul 2005 15:16:35 -0000	1.11
@@ -42,6 +42,7 @@
 	struct Geoset;
 	struct Mesh;
 	struct HierNode {
+		HierNode() : _initialized(false) { }
 		void loadBinary(const char *&data, HierNode *hierNodes, const Geoset &g);
 		void draw() const;
 		void addChild(HierNode *child);
@@ -60,6 +61,7 @@
 		float _animPitch, _animYaw, _animRoll;
 		bool _meshVisible, _hierVisible;
 		int _priority, _totalWeight;
+		bool _initialized;
 		Matrix4 _matrix;
 		Matrix4 _localMatrix;
 		Matrix4 _pivotMatrix;

Index: smush.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- smush.cpp	17 Jul 2005 23:40:21 -0000	1.62
+++ smush.cpp	21 Jul 2005 15:16:35 -0000	1.63
@@ -133,6 +133,15 @@
 		return;
 	}
 
+	if (_frame == _nbframes) {
+		// If the video has been looping and was previously on the last
+		// frame then reset the frame number and the movie time, this
+		// needs to occur at the beginning so the last frame has time to
+		// render appropriately
+		_frame = 0;
+		_movieTime = 0;
+	}
+
 	tag = _file.readUint32BE();
 	if (tag == MKID_BE('ANNO')) {
 		char *anno;
@@ -151,10 +160,12 @@
 			//  MakeAnim animation type 'Bl16' parameters: 10000;12000;100;1;0;0;0;0;25;0;
 			//  Water in front of the Blue Casket
 			//	MakeAnim animation type 'Bl16' parameters: 20000;25000;100;1;0;0;0;0;25;0;
+			//  Scrimshaw exterior:
+			//  MakeAnim animation type 'Bl16' parameters: 6000;8000;100;0;0;0;0;0;2;0;
 			if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
 				printf("Announcement data: %s\n", anno);
 			sscanf(annoData, "%*d;%*d;%*d;%d;%*d;%*d;%*d;%*d;%*d;%*d;%*d;", &loop);
-			_videoLooping = (bool) loop;
+			_videoLooping = true;
 			_startPos = _file.getPos();
 			if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_NORMAL || debugLevel == DEBUG_ALL)
 				printf("_videoLooping: %d\n", _videoLooping);
@@ -202,10 +213,6 @@
 			g_engine->setMode(ENGINE_MODE_NORMAL);
 			return;
 		}
-		// If the position change succeeded then reset the frame number
-		// for some reason we need to set it to 1 instead of zero or we
-		// won't render a frame
-		_frame = 1;
 	}
 }
 
@@ -297,15 +304,16 @@
 	close();
 }
 
-struct SAVEPOS *zlibFile::getPos() { 
-	struct SAVEPOS *pos;
+struct SavePos *zlibFile::getPos() { 
+	struct SavePos *pos;
 	long position = std::ftell(_handle);
 	
-	if (position == -1 && debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL) {
-		warning("zlibFile::open() unable to find start position!");
+	if (position == -1) {
+		if (debugLevel == DEBUG_SMUSH || debugLevel == DEBUG_WARN || debugLevel == DEBUG_ALL)
+			warning("zlibFile::open() unable to find start position! %m");
 		return NULL;
 	}
-	pos = (struct SAVEPOS *) malloc(sizeof(struct SAVEPOS));
+	pos = (struct SavePos *) malloc(sizeof(struct SavePos));
 	pos->filePos = position;
 	inflateCopy(&pos->streamBuf, &_stream);
 	pos->tmpBuf = (char *)calloc(1, BUFFER_SIZE);
@@ -313,9 +321,14 @@
 	return pos;
 }
 
-bool zlibFile::setPos(struct SAVEPOS *pos) { 
+bool zlibFile::setPos(struct SavePos *pos) { 
 	int ret;
-	if (_handle == NULL || pos == NULL) {
+	
+	if (pos == NULL) {
+		warning("Unable to rewind SMUSH movie (no position passed)!");
+		return false;
+	}
+	if (_handle == NULL) {
 		warning("Unable to rewind SMUSH movie (invalid handle)!");
 		return false;
 	}
@@ -325,7 +338,10 @@
 		return false;
 	}
 	memcpy(_inBuf, pos->tmpBuf, BUFFER_SIZE);
-	inflateCopy(&_stream, &pos->streamBuf);
+	if (inflateCopy(&_stream, &pos->streamBuf) != Z_OK) {
+		warning("Unable to rewind SMUSH movie (z-lib copy handle failed)!");
+		return false;
+	}
 	_fileDone = false;
 	return true;
 }

Index: smush.h
===================================================================
RCS file: /cvsroot/scummvm/residual/smush.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- smush.h	17 Jul 2005 23:40:21 -0000	1.25
+++ smush.h	21 Jul 2005 15:16:35 -0000	1.26
@@ -29,7 +29,7 @@
 #include <zlib.h>
 #include <cstring>
 
-struct SAVEPOS {
+struct SavePos {
 	long filePos;
 	z_stream streamBuf;
 	char *tmpBuf;
@@ -45,9 +45,9 @@
 public:
 	zlibFile();
 	~zlibFile();
-	bool setPos(struct SAVEPOS *pos);
+	bool setPos(struct SavePos *pos);
 	bool open(const char *filename);
-	struct SAVEPOS *getPos();
+	struct SavePos *getPos();
 	void close();
 	bool isOpen();
 
@@ -76,7 +76,7 @@
 	bool _videoFinished;
 	bool _videoPause;
 	bool _videoLooping;
-	struct SAVEPOS *_startPos;
+	struct SavePos *_startPos;
 	int _x, _y;
 	int _width, _height;
 	byte *_internalBuffer, *_externalBuffer;





More information about the Scummvm-git-logs mailing list