[Scummvm-cvs-logs] CVS: residual TODO,1.47,1.48 actor.cpp,1.50,1.51 actor.h,1.23,1.24 engine.cpp,1.69,1.70 localize.cpp,1.10,1.11 lua.cpp,1.115,1.116 textobject.cpp,1.22,1.23 textobject.h,1.11,1.12

Pawel Kolodziejski aquadran at users.sourceforge.net
Sun Apr 3 04:33:44 CEST 2005


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

Modified Files:
	TODO actor.cpp actor.h engine.cpp localize.cpp lua.cpp 
	textobject.cpp textobject.h 
Log Message:
patch fixes from Erich Hoover:
subtitles fixes

Thanks

Index: TODO
===================================================================
RCS file: /cvsroot/scummvm/residual/TODO,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- TODO	18 Jan 2005 17:24:52 -0000	1.47
+++ TODO	3 Apr 2005 11:33:28 -0000	1.48
@@ -1,7 +1,7 @@
 Residual TODO list (in rough order of priority):
 ------------------------------------------------
 Assigned tasks:
- * Add LAF font and text drawing support (ender)
+ * 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)
@@ -11,8 +11,7 @@
  * 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)
- * Implement 2D primitives 
+ * Implement 2D primitives
  * Proper vsscanf implementation in textsplit.cpp for platforms without it (MSVC, etc)
- * Fix drawEmergString() to work with Mesa
  * Make SMUSH work on Linux/PPC (whats wrong with it, exactly? - ender :)
  * Finish panning in 3d position code

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/actor.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- actor.cpp	3 Apr 2005 10:41:57 -0000	1.50
+++ actor.cpp	3 Apr 2005 11:33:28 -0000	1.51
@@ -266,8 +266,16 @@
 	assert(msg);
 	assert(msgId);
 
-	if (msg[0] == '/' || msg[0] == 0 || msgId[0] == 0)
+	std::string textName = msgId;
+	textName += ".txt";
+
+	if (msg[0] != '/')
+		warning("Actor::sayLine: Invalid source message (should be an ID)!");
+
+	if (msgId[0] == 0) {
+		error("Actor::sayLine: No message ID for text!");
 		return;
+	}
 
 	// During movies, SayLine is called for text display only
 	if (!g_smush->isPlaying()) {
@@ -283,19 +291,23 @@
 		if (g_imuse->getSoundStatus(_talkSoundName.c_str()))
 			shutUp();
 
-		// Sometimes actors speak offscreen before they, including their
-		// talk chores are initialized.
-		// For example, when reading the work order (a LIP file exists for no reason).
-		// Also, some lip synch files have no entries
-		// In these cases, revert to using the mumble chore.
-		_lipSynch = g_resourceloader->loadLipSynch(soundLip.c_str());
-
 		_talkSoundName = soundName;
 		g_imuse->startVoice(_talkSoundName.c_str());
 		if (g_engine->currScene()) {
 			g_engine->currScene()->setSoundPosition(_talkSoundName.c_str(), pos());
 		}
-		_talkAnim = -1;
+
+		// If the actor is clearly not visible then don't try to play the lip synch
+		if (visible()) {
+			// Sometimes actors speak offscreen before they, including their
+			// talk chores are initialized.
+			// For example, when reading the work order (a LIP file exists for no reason).
+			// Also, some lip synch files have no entries
+			// In these cases, revert to using the mumble chore.
+			_lipSynch = g_resourceloader->loadLipSynch(soundLip.c_str());
+
+			_talkAnim = -1;
+		}
 	}
 
 	if (_sayLineText) {
@@ -478,12 +490,6 @@
 		}
 	}
 
-	if (!talking())
-		shutUp();
-
-	if (!g_imuse->isVoicePlaying())
-		shutUp();
-
 	for (std::list<Costume *>::iterator i = _costumeStack.begin(); i != _costumeStack.end(); i++) {
 		(*i)->setPosRotate(_pos, _pitch, _yaw, _roll);
 		(*i)->update();
@@ -504,3 +510,9 @@
 		g_driver->finishActorDraw();
 	}
 }
+
+// "Undraw objects" (handle objects for actors that may not be on screen)
+void Actor::undraw(bool visible) {
+	if (!talking() || !g_imuse->isVoicePlaying())
+		shutUp();
+}

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/residual/actor.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- actor.h	28 Mar 2005 01:56:40 -0000	1.23
+++ actor.h	3 Apr 2005 11:33:28 -0000	1.24
@@ -99,6 +99,7 @@
 	}
 	void update();
 	void draw();
+	void undraw(bool);
 
 	bool isLookAtVectorZero() {
 		return _lookAtVector.isZero();

Index: engine.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/engine.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- engine.cpp	28 Mar 2005 01:54:21 -0000	1.69
+++ engine.cpp	3 Apr 2005 11:33:28 -0000	1.70
@@ -210,6 +210,8 @@
 				Actor *a = *i;
 				if (_currScene != NULL && a->inSet(_currScene->name()) && a->visible())
 					a->draw();
+				if (_currScene != NULL)
+					a->undraw(a->inSet(_currScene->name()) && a->visible());
 			}
 		}
 

Index: localize.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/localize.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- localize.cpp	2 Jan 2005 13:34:50 -0000	1.10
+++ localize.cpp	3 Apr 2005 11:33:28 -0000	1.11
@@ -37,8 +37,10 @@
 		if (f != NULL)
 			break;
 	}
-	if (f == NULL)
+	if (f == NULL) {
+		error("Localizer::Localizer: Unable to find localization information (grim.tab)!");
 		return;
+	}
 
 	// Get the file size
 	std::fseek(f, 0, SEEK_END);

Index: lua.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/lua.cpp,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- lua.cpp	28 Mar 2005 05:15:11 -0000	1.115
+++ lua.cpp	3 Apr 2005 11:33:28 -0000	1.116
@@ -768,19 +768,18 @@
 }
 
 static void SayLine() {
-	char msgId[32];
+	char msgId[32], *str;
 	int pan = 64;
 
 	Actor *act = check_actor(1);
 
 	int param_number = 2;
 	lua_Object param2 = lua_getparam(param_number++);
-	std::string msg;
 	if (!lua_isnil(param2)) {
 		do {
 			if (lua_isstring(param2)) {
-				char *str = lua_getstring(param2);
-				msg = parseMsgText(str, msgId);
+				str = lua_getstring(param2);
+				parseMsgText(str, msgId);
 			} else if (lua_isnumber(param2)) {
 				pan = 64;
 			} else if (lua_istable(param2)) {
@@ -789,7 +788,7 @@
 			}
 			param2 = lua_getparam(param_number++);
 		} while (!lua_isnil(param2));
-		act->sayLine(msg.c_str(), msgId);
+		act->sayLine(str, msgId);
 	}
 }
 
@@ -1252,8 +1251,8 @@
 static void ChangeTextObject() {
 	TextObject *textObject = check_textobject(1);
 	lua_Object tableObj = lua_getparam(2);
-
 	TextObject *modifyObject = NULL;
+
 	for (Engine::TextListType::const_iterator i = g_engine->textsBegin(); i != g_engine->textsEnd(); i++) {
 		TextObject *textO = *i;
 
@@ -1262,18 +1261,16 @@
 			break;
 		}
 	}
-
 	if (!modifyObject)
 		error("ChangeTextObject(): Cannot find active text object");
 
 	modifyObject->destroyBitmap();
 
-	textObject->setDefaults(&textObjectDefaults);
+//	textObject->setDefaults(&textObjectDefaults);
 	if (lua_istable(tableObj))
 		getTextObjectParams(modifyObject, tableObj);
 
 	modifyObject->createBitmap();
-	g_engine->registerTextObject(modifyObject);
 
 	lua_pushnumber(modifyObject->getBitmapWidth());
 	lua_pushnumber(modifyObject->getBitmapHeight());

Index: textobject.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/textobject.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- textobject.cpp	20 Mar 2005 16:48:26 -0000	1.22
+++ textobject.cpp	3 Apr 2005 11:33:28 -0000	1.23
@@ -29,9 +29,9 @@
 
 TextObject::TextObject() :
 		_created(false), _x(0), _y(0), _width(0), _height(0), _justify(0),
-		_font(NULL), _text(NULL), _textBitmap(NULL), _bitmapWidth(0),
+		_font(NULL), _textBitmap(NULL), _bitmapWidth(0),
 		_bitmapHeight(0), _textObjectHandle(NULL) {
-	memset(_textID, 0, 10);
+	memset(_textID, 0, sizeof(_textID));
 	_fgColor._vals[0] = 0;
 	_fgColor._vals[1] = 0;
 	_fgColor._vals[2] = 0;
@@ -55,9 +55,7 @@
 	if (_created)
 		destroyBitmap();
 
-	strcpy(_textID, _text);
-	char msgId[32];
-	std::string msg = parseMsgText(_textID, msgId);
+	std::string msg = parseMsgText(_textID, NULL);
 
 	_bitmapWidth = 0;
 	_bitmapHeight = 0;
@@ -85,7 +83,7 @@
 			uint8 startingLine = _font->getCharStartingLine(msg[c]);
 
 			if (startingLine < line + 1 && _font->getCharHeight(msg[c]) + startingLine > line) {
-				memcpy(_textBitmap + offset + startingCol,
+				memcpy(&_textBitmap[offset + startingCol],
 					_font->getCharData(msg[c]) + charWidth * (line - startingLine), charWidth);
 			}
 

Index: textobject.h
===================================================================
RCS file: /cvsroot/scummvm/residual/textobject.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- textobject.h	20 Mar 2005 16:48:26 -0000	1.11
+++ textobject.h	3 Apr 2005 11:33:28 -0000	1.12
@@ -45,7 +45,7 @@
 	void createBitmap();
 	void destroyBitmap();
 	void setDefaults(TextObjectDefaults *defaults);
-	void setText(char *text) { _text = text; }
+	void setText(char *text) { strcpy(_textID, text); }
 	void setX(int x) { _x = x; }
 	void setY(int y) { _y = y; }
 	void setWidth(int width) { _width = width; }
@@ -72,7 +72,6 @@
 	uint _width, _height;
 	int _justify;
 	Font *_font;
-	char *_text;
 	char _textID[32];
 	uint8 *_textBitmap;
 	uint _bitmapWidth, _bitmapHeight;





More information about the Scummvm-git-logs mailing list