[Scummvm-cvs-logs] scummvm master -> d23e493b467a24e5d61dcb936b1c2e042c3ae9ce

dreammaster dreammaster at scummvm.org
Tue Mar 10 01:36:32 CET 2015


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

Summary:
d23e493b46 MADS: Fix crash if you talk to intern in gurney room too quickly


Commit: d23e493b467a24e5d61dcb936b1c2e042c3ae9ce
    https://github.com/scummvm/scummvm/commit/d23e493b467a24e5d61dcb936b1c2e042c3ae9ce
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-03-09T20:35:10-04:00

Commit Message:
MADS: Fix crash if you talk to intern in gurney room too quickly

Changed paths:
    engines/mads/nebular/nebular_scenes3.cpp
    engines/mads/sequence.cpp
    engines/mads/sequence.h



diff --git a/engines/mads/nebular/nebular_scenes3.cpp b/engines/mads/nebular/nebular_scenes3.cpp
index 8f07993..0b22aa7 100644
--- a/engines/mads/nebular/nebular_scenes3.cpp
+++ b/engines/mads/nebular/nebular_scenes3.cpp
@@ -2581,6 +2581,12 @@ void Scene318::handleInternDialog(int quoteId, int quoteNum, uint32 timeout) {
 	_scene->_kernelMessages.reset();
 	_internTalkingFl = true;
 
+	// WORKAROUND: In case the player launches multiple talk selections with the
+	// intern before previous ones have finished, take care of removing any
+	int seqIndex;
+	while ((seqIndex = _scene->_sequences.findByTrigger(63)) != -1)
+		_scene->_sequences.remove(seqIndex);
+
 	for (int i = 0; i < quoteNum; i++) {
 		_game._triggerSetupMode = SEQUENCE_TRIGGER_DAEMON;
 		_scene->_sequences.addTimer(180, 63);
diff --git a/engines/mads/sequence.cpp b/engines/mads/sequence.cpp
index 7dbf4cf..744e246 100644
--- a/engines/mads/sequence.cpp
+++ b/engines/mads/sequence.cpp
@@ -144,7 +144,7 @@ int SequenceList::add(int spriteListIndex, bool flipped, int frameIndex, int tri
 	return seqIndex;
 }
 
-int SequenceList::addTimer(int timeout, int abortVal) {
+int SequenceList::addTimer(int timeout, int endTrigger) {
 	Scene &scene = _vm->_game->_scene;
 	uint seqIndex;
 	for (seqIndex = 0; seqIndex < _entries.size(); ++seqIndex) {
@@ -164,7 +164,7 @@ int SequenceList::addTimer(int timeout, int abortVal) {
 	se._entries._count = 0;
 	se._triggerMode = _vm->_game->_triggerSetupMode;
 	se._actionNouns = _vm->_game->_scene._action._activeAction;
-	addSubEntry(seqIndex, SEQUENCE_TRIGGER_EXPIRE, 0, abortVal);
+	addSubEntry(seqIndex, SEQUENCE_TRIGGER_EXPIRE, 0, endTrigger);
 
 	return seqIndex;
 }
@@ -181,6 +181,19 @@ void SequenceList::remove(int seqIndex) {
 	scene._spriteSlots.deleteTimer(seqIndex);
 }
 
+int SequenceList::findByTrigger(int trigger) {
+	for (int idx = 0; idx < _entries.size(); ++idx) {
+		if (_entries[idx]._active) {
+			for (uint subIdx = 0; subIdx < _entries[idx]._entries._count; ++subIdx) {
+				if (_entries[idx]._entries._trigger[subIdx] == trigger)
+					return idx;
+			}
+		}
+	}
+
+	return -1;
+}
+
 void SequenceList::setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot) {
 	Scene &scene = _vm->_game->_scene;
 	SequenceEntry &timerEntry = _entries[seqIndex];
diff --git a/engines/mads/sequence.h b/engines/mads/sequence.h
index 1555232..8b236af 100644
--- a/engines/mads/sequence.h
+++ b/engines/mads/sequence.h
@@ -101,8 +101,9 @@ public:
 		int extraTicks, int numTicks, int msgX, int msgY, bool nonFixed, int scale, int depth,
 		int frameInc, SpriteAnimType animType, int numSprites, int frameStart);
 
-	int addTimer(int timeout, int abortVal);
+	int addTimer(int timeout, int endTrigger);
 	void remove(int seqIndex);
+	int findByTrigger(int trigger);
 	void setSpriteSlot(int seqIndex, SpriteSlot &spriteSlot);
 	bool loadSprites(int seqIndex);
 	void tick();






More information about the Scummvm-git-logs mailing list