[Scummvm-git-logs] scummvm master -> 3fd0858e84f7fde317ebbb0a1620e0b3c6520e71

sev- sev at scummvm.org
Sun May 3 18:25:46 UTC 2020


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

Summary:
366e9a3147 DIRECTOR: LINGO: Passing channels Id for immediate scripts
292c43c610 DIRECTOR: LINGO: Use channelId for immediate actions
4a49d9d538 GRAPHICS: MACGUI: Fixed crash when removing all text in editable text
45b6441d71 GRAPHICS: MACGUI: Fixed adding text to end of line in editable text
d1359478c0 GRAPHICS: MACGUI: More fixes for edge cases
8d09581e5f DIRECTOR: LINGO: Fixed execution of moveableSprite
3fd0858e84 DIRECTOR: LINGO: Implement 'the text of cast <xx>'


Commit: 366e9a314754ebc69ea7a4d1b52763b1e660a15c
    https://github.com/scummvm/scummvm/commit/366e9a314754ebc69ea7a4d1b52763b1e660a15c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-03T19:27:18+02:00

Commit Message:
DIRECTOR: LINGO: Passing channels Id for immediate scripts

Changed paths:
    engines/director/lingo/lingo-events.cpp
    engines/director/lingo/lingo.cpp
    engines/director/lingo/lingo.h


diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index c3f7840742..01068a4359 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -303,7 +303,7 @@ void Lingo::processEvent(LEvent event) {
 	_dontPassEvent = false;
 }
 
-void Lingo::processEvent(LEvent event, ScriptType st, int entityId) {
+void Lingo::processEvent(LEvent event, ScriptType st, int entityId, int channelId) {
 	if (entityId < 0)
 		return;
 
@@ -313,6 +313,7 @@ void Lingo::processEvent(LEvent event, ScriptType st, int entityId) {
 	debugC(9, kDebugEvents, "Lingo::processEvent(%s, %s, %d)", _eventHandlerTypes[event], scriptType2str(st), entityId);
 
 	_currentEntityId = entityId;
+	_currentChannelId = channelId;
 
 	if (!_eventHandlerTypes.contains(event))
 		error("processEvent: Unknown event %d for entity %d", event, entityId);
diff --git a/engines/director/lingo/lingo.cpp b/engines/director/lingo/lingo.cpp
index 477589810c..1372bd40c0 100644
--- a/engines/director/lingo/lingo.cpp
+++ b/engines/director/lingo/lingo.cpp
@@ -74,6 +74,7 @@ Lingo::Lingo(DirectorEngine *vm) : _vm(vm) {
 	_currentScriptFunction = 0;
 
 	_currentEntityId = 0;
+	_currentChannelId = -1;
 	_pc = 0;
 	_returning = false;
 	_nextRepeat = false;
@@ -694,9 +695,9 @@ void Lingo::executeImmediateScripts(Frame *frame) {
 			// From D5 only explicit event handlers are processed
 			// Before that you could specify commands which will be executed on mouse up
 			if (_vm->getVersion() < 5)
-				g_lingo->processEvent(kEventNone, kFrameScript, frame->_sprites[i]->_scriptId);
+				g_lingo->processEvent(kEventNone, kFrameScript, frame->_sprites[i]->_scriptId, i);
 			else
-				g_lingo->processEvent(kEventMouseUp, kFrameScript, frame->_sprites[i]->_scriptId);
+				g_lingo->processEvent(kEventMouseUp, kFrameScript, frame->_sprites[i]->_scriptId, i);
 		}
 	}
 }
diff --git a/engines/director/lingo/lingo.h b/engines/director/lingo/lingo.h
index 44cccd75d7..74bf83d7cd 100644
--- a/engines/director/lingo/lingo.h
+++ b/engines/director/lingo/lingo.h
@@ -202,7 +202,7 @@ private:
 	void processGenericEvent(LEvent event);
 	void runMovieScript(LEvent event);
 	void processSpriteEvent(LEvent event);
-	void processEvent(LEvent event, ScriptType st, int entityId);
+	void processEvent(LEvent event, ScriptType st, int entityId, int channelId = -1);
 
 public:
 	ScriptContext *getScriptContext(ScriptType type, uint16 id);
@@ -311,6 +311,7 @@ public:
 public:
 	ScriptType _currentScriptType;
 	uint16 _currentEntityId;
+	int _currentChannelId;
 	ScriptContext *_currentScriptContext;
 	uint16 _currentScriptFunction;
 	ScriptData *_currentScript;


Commit: 292c43c61043f41085a804184384acd0ff377c41
    https://github.com/scummvm/scummvm/commit/292c43c61043f41085a804184384acd0ff377c41
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-03T19:27:54+02:00

Commit Message:
DIRECTOR: LINGO: Use channelId for immediate actions

Changed paths:
    engines/director/lingo/lingo-builtins.cpp


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index 4d05d2d9b6..ded85d14e0 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1510,7 +1510,13 @@ void LB::b_duplicate(int nargs) {
 }
 
 void LB::b_editableText(int nargs) {
-	warning("STUB: b_editableText");
+	Frame *frame = g_director->getCurrentScore()->_frames[g_director->getCurrentScore()->getCurrentFrame()];
+
+	if (g_lingo->_currentChannelId == -1) {
+		warning("b_editableText: channel Id is missing");
+		return;
+	}
+	frame->_sprites[g_lingo->_currentChannelId]->_editable = true;
 }
 
 void LB::b_erase(int nargs) {
@@ -1698,7 +1704,12 @@ void LB::b_move(int nargs) {
 void LB::b_moveableSprite(int nargs) {
 	Frame *frame = g_director->getCurrentScore()->_frames[g_director->getCurrentScore()->getCurrentFrame()];
 
-	frame->_sprites[g_lingo->_currentEntityId]->_moveable = true;
+	if (g_lingo->_currentChannelId == -1) {
+		warning("b_editableText: channel Id is missing");
+		return;
+	}
+
+	frame->_sprites[g_lingo->_currentChannelId]->_moveable = true;
 }
 
 void LB::b_pasteClipBoardInto(int nargs) {


Commit: 4a49d9d538bd04f87ec58cdb2eb906556cd846d8
    https://github.com/scummvm/scummvm/commit/4a49d9d538bd04f87ec58cdb2eb906556cd846d8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-03T19:38:04+02:00

Commit Message:
GRAPHICS: MACGUI: Fixed crash when removing all text in editable text

Changed paths:
    graphics/macgui/maceditabletext.cpp
    graphics/macgui/mactext.cpp


diff --git a/graphics/macgui/maceditabletext.cpp b/graphics/macgui/maceditabletext.cpp
index ee201ce3be..ffb2fbcddb 100644
--- a/graphics/macgui/maceditabletext.cpp
+++ b/graphics/macgui/maceditabletext.cpp
@@ -515,8 +515,12 @@ static void cursorTimerHandler(void *refCon) {
 }
 
 void MacEditableText::updateCursorPos() {
-	_cursorY = _textLines[_cursorRow].y;
-	_cursorX = getLineWidth(_cursorRow, false, _cursorCol);
+	if (_textLines.empty()) {
+		_cursorX = _cursorY = 0;
+	} else {
+		_cursorY = _textLines[_cursorRow].y;
+		_cursorX = getLineWidth(_cursorRow, false, _cursorCol);
+	}
 
 	_cursorDirty = true;
 }
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index e8cab1d656..c673826de2 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -864,6 +864,13 @@ Common::U32String MacText::getTextChunk(int startRow, int startCol, int endRow,
 //////////////////
 // Text editing
 void MacText::insertChar(byte c, int *row, int *col) {
+	if (_textLines.empty()) {
+		appendTextDefault(Common::String(c));
+		(*col)++;
+
+		return;
+	}
+
 	MacTextLine *line = &_textLines[*row];
 	int pos = *col;
 	uint ch = line->getChunkNum(&pos);


Commit: 45b6441d7167984bd78be5f643f452cc7d168b18
    https://github.com/scummvm/scummvm/commit/45b6441d7167984bd78be5f643f452cc7d168b18
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-03T19:46:10+02:00

Commit Message:
GRAPHICS: MACGUI: Fixed adding text to end of line in editable text

Changed paths:
    graphics/macgui/mactext.cpp


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index c673826de2..7a710723e8 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -69,7 +69,7 @@ uint MacTextLine::getChunkNum(int *col) {
 
 	if (i == chunks.size()) {
 		i--;	// touch the last chunk
-		pos = chunks[i].text.size() - 1;
+		pos = chunks[i].text.size();
 	}
 
 	*col = pos;
@@ -876,7 +876,11 @@ void MacText::insertChar(byte c, int *row, int *col) {
 	uint ch = line->getChunkNum(&pos);
 
 	Common::U32String newchunk(line->chunks[ch].text);
-	newchunk.insertChar(c, pos);
+
+	if (pos >= newchunk.size())
+		newchunk += c;
+	else
+		newchunk.insertChar(c, pos);
 	int chunkw = line->chunks[ch].getFont()->getStringWidth(newchunk);
 	int oldw = line->chunks[ch].getFont()->getStringWidth(line->chunks[ch].text);
 


Commit: d1359478c0ea4b8f04ac482b2a2a073ec9d9d606
    https://github.com/scummvm/scummvm/commit/d1359478c0ea4b8f04ac482b2a2a073ec9d9d606
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-03T19:54:28+02:00

Commit Message:
GRAPHICS: MACGUI: More fixes for edge cases

Changed paths:
    graphics/macgui/maceditabletext.cpp
    graphics/macgui/mactext.cpp


diff --git a/graphics/macgui/maceditabletext.cpp b/graphics/macgui/maceditabletext.cpp
index ffb2fbcddb..4a6ae664da 100644
--- a/graphics/macgui/maceditabletext.cpp
+++ b/graphics/macgui/maceditabletext.cpp
@@ -518,6 +518,8 @@ void MacEditableText::updateCursorPos() {
 	if (_textLines.empty()) {
 		_cursorX = _cursorY = 0;
 	} else {
+		_cursorRow = MIN<int>(_cursorRow, _textLines.size() - 1);
+
 		_cursorY = _textLines[_cursorRow].y;
 		_cursorX = getLineWidth(_cursorRow, false, _cursorCol);
 	}
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 7a710723e8..b535757682 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -908,7 +908,7 @@ void MacText::deletePreviousChar(int *row, int *col) {
 		*col = getLineCharWidth(*row - 1);
 		(*row)--;
 
-		 // formatting matches, glue texts as normal
+		// formatting matches, glue texts as normal
 		if (_textLines[*row].lastChunk().equals(_textLines[*row + 1].firstChunk())) {
 			_textLines[*row].lastChunk().text += _textLines[*row + 1].firstChunk().text;
 			_textLines[*row + 1].firstChunk().text.clear();
@@ -941,6 +941,13 @@ void MacText::deletePreviousChar(int *row, int *col) {
 }
 
 void MacText::addNewLine(int *row, int *col) {
+	if (_textLines.empty()) {
+		appendTextDefault(Common::String("\n"));
+		(*row)++;
+
+		return;
+	}
+
 	MacTextLine *line = &_textLines[*row];
 	int pos = *col;
 	uint ch = line->getChunkNum(&pos);


Commit: 8d09581e5f6631c32e5be04242f742859fc9aa3a
    https://github.com/scummvm/scummvm/commit/8d09581e5f6631c32e5be04242f742859fc9aa3a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-03T20:10:44+02:00

Commit Message:
DIRECTOR: LINGO: Fixed execution of moveableSprite

Changed paths:
    engines/director/lingo/lingo-builtins.cpp
    engines/director/lingo/lingo-events.cpp


diff --git a/engines/director/lingo/lingo-builtins.cpp b/engines/director/lingo/lingo-builtins.cpp
index ded85d14e0..24d2463fd5 100644
--- a/engines/director/lingo/lingo-builtins.cpp
+++ b/engines/director/lingo/lingo-builtins.cpp
@@ -1705,7 +1705,8 @@ void LB::b_moveableSprite(int nargs) {
 	Frame *frame = g_director->getCurrentScore()->_frames[g_director->getCurrentScore()->getCurrentFrame()];
 
 	if (g_lingo->_currentChannelId == -1) {
-		warning("b_editableText: channel Id is missing");
+		warning("b_moveableSprite: channel Id is missing");
+		assert(0);
 		return;
 	}
 
diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index 01068a4359..bd155e5aac 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -180,7 +180,7 @@ void Lingo::processInputEvent(LEvent event) {
 			processEvent(kEventNone, kSpriteScript, currentFrame->_sprites[spriteId]->_castId + score->_castIDoffset);
 			processEvent(event, kSpriteScript, currentFrame->_sprites[spriteId]->_castId + score->_castIDoffset);
 		} else {
-			processEvent(kEventNone, kFrameScript, currentFrame->_sprites[spriteId]->_scriptId);
+			processEvent(kEventNone, kFrameScript, currentFrame->_sprites[spriteId]->_scriptId, spriteId);
 		}
 	} else if (event == kEventMouseDown) {
 		processEvent(event, kSpriteScript, currentFrame->_sprites[spriteId]->_castId + score->_castIDoffset);


Commit: 3fd0858e84f7fde317ebbb0a1620e0b3c6520e71
    https://github.com/scummvm/scummvm/commit/3fd0858e84f7fde317ebbb0a1620e0b3c6520e71
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-05-03T20:25:26+02:00

Commit Message:
DIRECTOR: LINGO: Implement 'the text of cast <xx>'

Changed paths:
    engines/director/lingo/lingo-the.cpp


diff --git a/engines/director/lingo/lingo-the.cpp b/engines/director/lingo/lingo-the.cpp
index d5baf615c8..8d30a3c664 100644
--- a/engines/director/lingo/lingo-the.cpp
+++ b/engines/director/lingo/lingo-the.cpp
@@ -814,6 +814,19 @@ Datum Lingo::getTheCast(Datum &id1, int field) {
 		d.makeString();
 		d.u.s = &castInfo->script;
 		break;
+	case kTheText:
+		d.makeString();
+		*d.u.s = "";
+		if (castType == kCastText) {
+			if (score->_loadedCast->contains(id) && score->_loadedCast->getVal(id)->_type == kCastText) {
+				*d.u.s = ((TextCast *)score->_loadedCast->getVal(id))->getText();
+			} else {
+				warning("Lingo::getTheCast(): Unknown STXT cast id %d", id);
+			}
+		} else {
+			warning("Lingo::getTheCast(): Unprocessed getting text of cast %d type %d", id, castType);
+		}
+		break;
 	case kTheWidth:
 		d.u.i = score->getCastMemberInitialRect(id).width();
 		break;




More information about the Scummvm-git-logs mailing list