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

bluegr bluegr at gmail.com
Sun Jan 13 15:31:29 CET 2013


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

Summary:
1302f62b9f TOLTECS: Whitespace fixes
b7bfff1bfa TOLTECS: Fix bug #3599370 - "TOLTECS: Text on intro video not shown as per original"
e45950b966 TOLTECS: Whitespace fixes
981bc20337 TOLTECS: Replace a magic value with its appropriate enum
bbec4acff5 TOLTECS: Fix bug #3600166 - "TOLTECS: Parrot speech cuts off Fenimore's in Cemetery"


Commit: 1302f62b9f60f836b7323ce1448a1c428af0ddcb
    https://github.com/scummvm/scummvm/commit/1302f62b9f60f836b7323ce1448a1c428af0ddcb
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-01-13T05:23:55-08:00

Commit Message:
TOLTECS: Whitespace fixes

Changed paths:
    engines/toltecs/screen.cpp



diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp
index e970d9a..1f3ab6b 100644
--- a/engines/toltecs/screen.cpp
+++ b/engines/toltecs/screen.cpp
@@ -33,7 +33,6 @@
 namespace Toltecs {
 
 Screen::Screen(ToltecsEngine *vm) : _vm(vm) {
-
 	_frontScreen = new byte[268800];
 	_backScreen = new byte[870400];
 
@@ -68,16 +67,13 @@ Screen::Screen(ToltecsEngine *vm) : _vm(vm) {
 	_renderQueue = new RenderQueue(_vm);
 	_fullRefresh = false;
 	_guiRefresh = false;
-
 }
 
 Screen::~Screen() {
-
 	delete[] _frontScreen;
 	delete[] _backScreen;
 
 	delete _renderQueue;
-
 }
 
 void Screen::unpackRle(byte *source, byte *dest, uint16 width, uint16 height) {
@@ -120,7 +116,6 @@ void Screen::loadMouseCursor(uint resIndex) {
 }
 
 void Screen::drawGuiImage(int16 x, int16 y, uint resIndex) {
-
 	byte *imageData = _vm->_res->load(resIndex)->data;
 	int16 headerSize = READ_LE_UINT16(imageData);
 	int16 width = imageData[2];
@@ -153,7 +148,6 @@ void Screen::drawGuiImage(int16 x, int16 y, uint resIndex) {
 	}
 
 	_guiRefresh = true;
-
 }
 
 void Screen::startShakeScreen(int16 shakeCounter) {
@@ -185,7 +179,6 @@ bool Screen::updateShakeScreen() {
 }
 
 void Screen::addStaticSprite(byte *spriteItem) {
-
 	DrawRequest drawRequest;
 	memset(&drawRequest, 0, sizeof(drawRequest));
 
@@ -200,11 +193,9 @@ void Screen::addStaticSprite(byte *spriteItem) {
 	debug(0, "Screen::addStaticSprite() x = %d; y = %d; baseColor = %d; resIndex = %d; flags = %04X", drawRequest.x, drawRequest.y, drawRequest.baseColor, drawRequest.resIndex, drawRequest.flags);
 
 	addDrawRequest(drawRequest);
-
 }
 
 void Screen::addAnimatedSprite(int16 x, int16 y, int16 fragmentId, byte *data, int16 *spriteArray, bool loop, int mode) {
-
 	//debug(0, "Screen::addAnimatedSprite(%d, %d, %d)", x, y, fragmentId);
 
 	DrawRequest drawRequest;
@@ -257,9 +248,7 @@ void Screen::addAnimatedSprite(int16 x, int16 y, int16 fragmentId, byte *data, i
 
 		WRITE_LE_UINT16(spriteItem + 0, loopNum);
 		WRITE_LE_UINT16(spriteItem + 4, frameNum);
-
 	}
-
 }
 
 void Screen::clearSprites() {
@@ -267,7 +256,6 @@ void Screen::clearSprites() {
 }
 
 void Screen::blastSprite(int16 x, int16 y, int16 fragmentId, int16 resIndex, uint16 flags) {
-
 	DrawRequest drawRequest;
 	SpriteDrawItem sprite;
 
@@ -283,7 +271,6 @@ void Screen::blastSprite(int16 x, int16 y, int16 fragmentId, int16 resIndex, uin
 		sprite.y -= _vm->_cameraY;
 		drawSprite(sprite);
 	}
-
 }
 
 void Screen::updateVerbLine(int16 slotIndex, int16 slotOffset) {
@@ -356,11 +343,9 @@ void Screen::updateVerbLine(int16 slotIndex, int16 slotOffset) {
 	drawGuiText(_verbLineX - 1 - (wrapState.width / 2), y - 1, 0xF9, 0xFF, _fontResIndexArray[0], wrapState);
 
 	_guiRefresh = true;
-
 }
 
 void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) {
-
 	int16 x, y, maxWidth, width, length;
 	byte durationModifier = 1;
 	byte *textData = _vm->_script->getSlotData(slotIndex) + slotOffset;
@@ -454,11 +439,9 @@ void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) {
 		textDurationMultiplier += 100;
 	}
 	item->duration = 4 * textDurationMultiplier * durationModifier;
-
 }
 
 void Screen::addTalkTextRect(Font &font, int16 x, int16 &y, int16 length, int16 width, TalkTextItem *item) {
-
 	if (width > 0) {
 		TextRect *textRect = &item->lines[item->lineCount];
 		width = width + 1 - font.getSpacing();
@@ -471,7 +454,6 @@ void Screen::addTalkTextRect(Font &font, int16 x, int16 &y, int16 length, int16
 	}
 
 	y += font.getHeight() - 1;
-
 }
 
 void Screen::addTalkTextItemsToRenderQueue() {
@@ -523,7 +505,6 @@ void Screen::registerFont(uint fontIndex, uint resIndex) {
 }
 
 void Screen::drawGuiTextMulti(byte *textData) {
-
 	int16 x = 0, y = 0;
 
 	// Really strange stuff.
@@ -558,7 +539,6 @@ void Screen::drawGuiTextMulti(byte *textData) {
 	} while (*wrapState.sourceString != 0xFF);
 
 	_guiRefresh = true;
-
 }
 
 int16 Screen::wrapGuiText(uint fontResIndex, int maxWidth, GuiTextWrapState &wrapState) {
@@ -581,7 +561,6 @@ int16 Screen::wrapGuiText(uint fontResIndex, int maxWidth, GuiTextWrapState &wra
 	}
 
 	return len;
-
 }
 
 void Screen::drawGuiText(int16 x, int16 y, byte fontColor1, byte fontColor2, uint fontResIndex, GuiTextWrapState &wrapState) {
@@ -595,7 +574,6 @@ void Screen::drawGuiText(int16 x, int16 y, byte fontColor1, byte fontColor2, uin
 }
 
 int16 Screen::drawString(int16 x, int16 y, byte color, uint fontResIndex, const byte *text, int len, int16 *ywobble, bool outline) {
-
 	//debug(0, "Screen::drawString(%d, %d, %d, %d)", x, y, color, fontResIndex);
 
 	Font font(_vm->_res->load(fontResIndex)->data);
@@ -622,11 +600,9 @@ int16 Screen::drawString(int16 x, int16 y, byte color, uint fontResIndex, const
 		*ywobble = yadd;
 
 	return x;
-
 }
 
 void Screen::drawChar(const Font &font, byte *dest, int16 x, int16 y, byte ch, byte color, bool outline) {
-
 	int16 charWidth, charHeight;
 	byte *charData;
 
@@ -655,11 +631,9 @@ void Screen::drawChar(const Font &font, byte *dest, int16 x, int16 y, byte ch, b
 		}
 		dest += 640 - charWidth;
 	}
-
 }
 
 void Screen::drawSurface(int16 x, int16 y, Graphics::Surface *surface) {
-
 	int16 skipX = 0;
 	int16 width = surface->w;
 	int16 height = surface->h;
@@ -704,11 +678,9 @@ void Screen::drawSurface(int16 x, int16 y, Graphics::Surface *surface) {
 		frontScreen += 640 - width;
 		surfacePixels += surface->w - width - skipX;
 	}
-
 }
 
 void Screen::saveState(Common::WriteStream *out) {
-
 	// Save verb line
 	out->writeUint16LE(_verbLineNum);
 	out->writeUint16LE(_verbLineX);
@@ -755,11 +727,9 @@ void Screen::saveState(Common::WriteStream *out) {
 		out->writeUint32LE(_fontResIndexArray[i]);
 	out->writeByte(_fontColor1);
 	out->writeByte(_fontColor2);
-
 }
 
 void Screen::loadState(Common::ReadStream *in) {
-
 	// Load verb line
 	_verbLineNum = in->readUint16LE();
 	_verbLineX = in->readUint16LE();
@@ -807,7 +777,6 @@ void Screen::loadState(Common::ReadStream *in) {
 		_fontResIndexArray[i] = in->readUint32LE();
 	_fontColor1 = in->readByte();
 	_fontColor2 = in->readByte();
-
 }
 
 } // End of namespace Toltecs


Commit: b7bfff1bfaac86d53958b34b9dfcdfb8a1f2e55e
    https://github.com/scummvm/scummvm/commit/b7bfff1bfaac86d53958b34b9dfcdfb8a1f2e55e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-01-13T05:39:00-08:00

Commit Message:
TOLTECS: Fix bug #3599370 - "TOLTECS: Text on intro video not shown as per original"

Changed paths:
    engines/toltecs/movie.cpp
    engines/toltecs/screen.cpp
    engines/toltecs/screen.h
    engines/toltecs/toltecs.cpp



diff --git a/engines/toltecs/movie.cpp b/engines/toltecs/movie.cpp
index 45711ad..201a0d6 100644
--- a/engines/toltecs/movie.cpp
+++ b/engines/toltecs/movie.cpp
@@ -156,10 +156,11 @@ void MoviePlayer::playMovie(uint resIndex) {
 			// Already processed
 			break;
 		case kChunkShowSubtitle:
-			if (_vm->_cfgText) {
-				memcpy(_vm->_script->getSlotData(subtitleSlot), chunkBuffer, chunkSize);
-				_vm->_screen->updateTalkText(subtitleSlot, 0);
-			}
+			memcpy(_vm->_script->getSlotData(subtitleSlot), chunkBuffer, chunkSize);
+			// The last character of the subtitle determines if it should
+			// always be displayed or not. If it's 0xFF, it should always be
+			// displayed, otherwise, if it's 0xFE, it can be toggled.
+			_vm->_screen->updateTalkText(subtitleSlot, 0, (chunkBuffer[chunkSize - 1] == 0xFF));
 			break;
 		case kChunkShakeScreen: // start/stop shakescreen effect
 			if (chunkBuffer[0] == 0xFF)
diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp
index 1f3ab6b..2f16c29 100644
--- a/engines/toltecs/screen.cpp
+++ b/engines/toltecs/screen.cpp
@@ -345,7 +345,7 @@ void Screen::updateVerbLine(int16 slotIndex, int16 slotOffset) {
 	_guiRefresh = true;
 }
 
-void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) {
+void Screen::updateTalkText(int16 slotIndex, int16 slotOffset, bool alwaysDisplayed) {
 	int16 x, y, maxWidth, width, length;
 	byte durationModifier = 1;
 	byte *textData = _vm->_script->getSlotData(slotIndex) + slotOffset;
@@ -354,6 +354,7 @@ void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) {
 
 	item->fontNum = 0;
 	item->color = _talkTextFontColor;
+	item->alwaysDisplayed = alwaysDisplayed;
 
 	x = CLIP<int16>(_talkTextX - _vm->_cameraX, 120, _talkTextMaxWidth);
 	y = CLIP<int16>(_talkTextY - _vm->_cameraY, 4, _vm->_cameraHeight - 16);
@@ -469,7 +470,7 @@ void Screen::addTalkTextItemsToRenderQueue() {
 		if (item->duration < 0)
 			item->duration = 0;
 
-		if (!_vm->_cfgText)
+		if (!_vm->_cfgText && !item->alwaysDisplayed)
 			return;
 
 		for (byte j = 0; j < item->lineCount; j++) {
@@ -754,6 +755,7 @@ void Screen::loadState(Common::ReadStream *in) {
 		_talkTextItems[i].fontNum = in->readUint16LE();
 		_talkTextItems[i].color = in->readByte();
 		_talkTextItems[i].lineCount = in->readByte();
+		_talkTextItems[i].alwaysDisplayed = false;
 		for (int j = 0; j < _talkTextItems[i].lineCount; j++) {
 			_talkTextItems[i].lines[j].x = in->readUint16LE();
 			_talkTextItems[i].lines[j].y = in->readUint16LE();
diff --git a/engines/toltecs/screen.h b/engines/toltecs/screen.h
index 788cde5..f4ecd2c 100644
--- a/engines/toltecs/screen.h
+++ b/engines/toltecs/screen.h
@@ -136,6 +136,7 @@ struct TalkTextItem {
 	byte color;
 	byte lineCount;
 	TextRect lines[15];
+	bool alwaysDisplayed;
 };
 
 struct GuiTextWrapState {
@@ -177,7 +178,7 @@ public:
 	void updateVerbLine(int16 slotIndex, int16 slotOffset);
 
 	// Talk text
-	void updateTalkText(int16 slotIndex, int16 slotOffset);
+	void updateTalkText(int16 slotIndex, int16 slotOffset, bool alwaysDisplayed);
 	void addTalkTextRect(Font &font, int16 x, int16 &y, int16 length, int16 width, TalkTextItem *item);
 	void addTalkTextItemsToRenderQueue();
 	int16 getTalkTextDuration();
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
index f6a2dfe..3b7b82d 100644
--- a/engines/toltecs/toltecs.cpp
+++ b/engines/toltecs/toltecs.cpp
@@ -515,12 +515,12 @@ void ToltecsEngine::talk(int16 slotIndex, int16 slotOffset) {
 			_sound->playSpeech(resIndex);
 		}
 		if (_doText) {
-			_screen->updateTalkText(slotIndex, slotOffset);
+			_screen->updateTalkText(slotIndex, slotOffset, false);
 		} else {
 			_screen->keepTalkTextItemsAlive();
 		}
 	} else {
-		_screen->updateTalkText(slotIndex, slotOffset);
+		_screen->updateTalkText(slotIndex, slotOffset, true);
 	}
 }
 


Commit: e45950b966ea6d03366b4238729ee76f4d84957f
    https://github.com/scummvm/scummvm/commit/e45950b966ea6d03366b4238729ee76f4d84957f
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-01-13T05:51:52-08:00

Commit Message:
TOLTECS: Whitespace fixes

Changed paths:
    engines/toltecs/sound.cpp
    engines/toltecs/toltecs.cpp



diff --git a/engines/toltecs/sound.cpp b/engines/toltecs/sound.cpp
index 4b28139..922ed05 100644
--- a/engines/toltecs/sound.cpp
+++ b/engines/toltecs/sound.cpp
@@ -103,7 +103,6 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa
 			}
 		}
 	} else {
-
 		if (type == -3) {
 			// Stop speech and play new sound
 			stopSpeech();
@@ -137,10 +136,8 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa
 
 			_vm->_mixer->playStream(soundType, &channels[freeChannel].handle,
 			                        stream, -1, volume, panning);
-		}
-
-	}
-
+		}	// if (freeChannel >= 0)
+	}	// resIndex
 }
 
 void Sound::updateSpeech() {
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
index 3b7b82d..02a0e33 100644
--- a/engines/toltecs/toltecs.cpp
+++ b/engines/toltecs/toltecs.cpp
@@ -514,6 +514,7 @@ void ToltecsEngine::talk(int16 slotIndex, int16 slotOffset) {
 			debug(0, "ToltecsEngine::talk() playSound(resIndex: %d)", resIndex);
 			_sound->playSpeech(resIndex);
 		}
+
 		if (_doText) {
 			_screen->updateTalkText(slotIndex, slotOffset, false);
 		} else {


Commit: 981bc20337d0a1d083473ba384398ef8777443e3
    https://github.com/scummvm/scummvm/commit/981bc20337d0a1d083473ba384398ef8777443e3
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-01-13T06:11:04-08:00

Commit Message:
TOLTECS: Replace a magic value with its appropriate enum

Changed paths:
    engines/toltecs/sound.cpp



diff --git a/engines/toltecs/sound.cpp b/engines/toltecs/sound.cpp
index 922ed05..8afc0e7 100644
--- a/engines/toltecs/sound.cpp
+++ b/engines/toltecs/sound.cpp
@@ -103,7 +103,7 @@ void Sound::internalPlaySound(int16 resIndex, int16 type, int16 volume, int16 pa
 			}
 		}
 	} else {
-		if (type == -3) {
+		if (type == kChannelTypeSpeech) {
 			// Stop speech and play new sound
 			stopSpeech();
 		}


Commit: bbec4acff5ab800445095d826f7a391f46aaf6a8
    https://github.com/scummvm/scummvm/commit/bbec4acff5ab800445095d826f7a391f46aaf6a8
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-01-13T06:29:25-08:00

Commit Message:
TOLTECS: Fix bug #3600166 - "TOLTECS: Parrot speech cuts off Fenimore's in Cemetery"

Changed paths:
    engines/toltecs/screen.cpp
    engines/toltecs/screen.h
    engines/toltecs/toltecs.cpp



diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp
index 2f16c29..be91130 100644
--- a/engines/toltecs/screen.cpp
+++ b/engines/toltecs/screen.cpp
@@ -481,6 +481,15 @@ void Screen::addTalkTextItemsToRenderQueue() {
 	}
 }
 
+bool Screen::isTalkTextActive(int16 slotIndex) {
+	for (int16 i = 0; i <= _talkTextItemNum; i++) {
+		if (_talkTextItems[i].slotIndex == slotIndex && _talkTextItems[i].duration > 0)
+			return true;
+	}
+
+	return false;
+}
+
 int16 Screen::getTalkTextDuration() {
 	return _talkTextItems[_talkTextItemNum].duration;
 }
diff --git a/engines/toltecs/screen.h b/engines/toltecs/screen.h
index f4ecd2c..ee565e1 100644
--- a/engines/toltecs/screen.h
+++ b/engines/toltecs/screen.h
@@ -182,6 +182,7 @@ public:
 	void addTalkTextRect(Font &font, int16 x, int16 &y, int16 length, int16 width, TalkTextItem *item);
 	void addTalkTextItemsToRenderQueue();
 	int16 getTalkTextDuration();
+	bool isTalkTextActive(int16 slotIndex);
 	void finishTalkTextItems();
 	void keepTalkTextItemsAlive();
 
diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp
index 02a0e33..1a399da 100644
--- a/engines/toltecs/toltecs.cpp
+++ b/engines/toltecs/toltecs.cpp
@@ -495,6 +495,11 @@ void ToltecsEngine::updateCamera() {
 void ToltecsEngine::talk(int16 slotIndex, int16 slotOffset) {
 	byte *scanData = _script->getSlotData(slotIndex) + slotOffset;
 
+	// If there's another talk text at the requested slot and it's still
+	// active, don't overwrite it. Fixes bug #3600166.
+	if (_screen->isTalkTextActive(slotIndex))
+		return;
+
 	while (*scanData < 0xF0) {
 		if (*scanData == 0x19) {
 			scanData++;






More information about the Scummvm-git-logs mailing list