[Scummvm-cvs-logs] SF.net SVN: scummvm:[53706] scummvm/trunk/engines/toon

sylvaintv at users.sourceforge.net sylvaintv at users.sourceforge.net
Fri Oct 22 22:53:26 CEST 2010


Revision: 53706
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53706&view=rev
Author:   sylvaintv
Date:     2010-10-22 20:53:25 +0000 (Fri, 22 Oct 2010)

Log Message:
-----------
TOON: Fixed Bug #3089974 and #3086015

Bug #3089974: "TOON: Two Drews when exiting King's bedroom"
Bug #3086015: "TOON: Woof doesn't idle correctly"

Most talking animation bugs are fixed with this.
The mouse is now hidden when entering a room.

Modified Paths:
--------------
    scummvm/trunk/engines/toon/character.cpp
    scummvm/trunk/engines/toon/character.h
    scummvm/trunk/engines/toon/script_func.cpp
    scummvm/trunk/engines/toon/toon.cpp
    scummvm/trunk/engines/toon/toon.h

Modified: scummvm/trunk/engines/toon/character.cpp
===================================================================
--- scummvm/trunk/engines/toon/character.cpp	2010-10-22 20:45:00 UTC (rev 53705)
+++ scummvm/trunk/engines/toon/character.cpp	2010-10-22 20:53:25 UTC (rev 53706)
@@ -47,6 +47,7 @@
 	_facing = 0;
 	_flags = 0;
 	_animFlags = 0;
+	_isTalking = false;
 	_id = 0;
 	_scale = 1024;
 	_blockingWalk = false;
@@ -249,8 +250,8 @@
 	if (_animScriptId != -1)
 		_vm->getSceneAnimationScript(_animScriptId)->_frozen = false;
 
-	if (_sceneAnimationId != -1)
-		_animationInstance->setAnimation(_vm->getSceneAnimation(_sceneAnimationId)->_animation);
+	//if (_sceneAnimationId != -1)
+	//	_animationInstance->setAnimation(_vm->getSceneAnimation(_sceneAnimationId)->_animation);
 
 	bool needStandingAnim = (_animFlags & 0x40) != 0;
 
@@ -348,10 +349,12 @@
 
 			if (_animScriptId != -1)
 				_vm->getSceneAnimationScript(_animScriptId)->_frozen = true;
-
+			
+			
 			// TODO setup backup //
 
 			_animFlags |= 0x10;
+			_animationInstance->setAnimation(_specialAnim);
 			_animationInstance->setFrame(0);
 			_time = _vm->getOldMilli() + 8 * _vm->getTickLength();
 		}
@@ -359,14 +362,11 @@
 	}
 
 	if ((_animFlags & 3) == 2) {
-		if (_vm->getCurrentLineToSay() != _lineToSayId || !_vm->getAudioManager()->voiceStillPlaying())  // || (_flags & 8)) && _vm->getAudioManager()->voiceStillPlaying())
+		if ((((_animFlags & 8) == 8) && _vm->getCurrentLineToSay() != _lineToSayId) || !_vm->getAudioManager()->voiceStillPlaying())  // || (_flags & 8)) && _vm->getAudioManager()->voiceStillPlaying())
 			_animFlags |= 1;
 
-// Strangerke - Commented (not used)
-//	} else {
 	}
 
-	// label29 :
 	if (_time > _vm->getOldMilli())
 		return;
 
@@ -439,13 +439,13 @@
 	// skipped all this part.
 
 	//label78
+
+	
 #if 0
 	if (_id == 0)
-		debugC(0, 0xfff, " drew animation flag %d / frame %d", _animFlags, nextFrame);
-
+		printf(" drew animation name %s / flag %d / frame %d \n", _specialAnim->_name, _animFlags, nextFrame);
 	if (_id == 1)
 		debugC(0, 0xfff, " flux animation flag %d / frame %d", _animFlags, nextFrame);
-
 	if (_id == 7)
 		debugC(0, 0xfff, " footman animation flag %d / frame %d", _animFlags, nextFrame);
 #endif
@@ -954,12 +954,9 @@
 	strcat(animName, ".CAF");
 
 
-	if (_animScriptId != -1)
+	if (_animScriptId != -1 && (flags & 8) == 0)
 		_vm->getSceneAnimationScript(_animScriptId)->_frozen = true;
 
-	if (_sceneAnimationId > -1)
-		setAnimationInstance(_vm->getSceneAnimation(_sceneAnimationId)->_animInstance);
-
 	stopSpecialAnim();
 
 	if (flags & 8) {
@@ -968,7 +965,18 @@
 
 		// make the talker busy
 		_flags |= 1;
+
+		// wait for the character to be ready
+		while (_animScriptId != -1 && _animationInstance->getFrame() > 0 && _animationInstance->getAnimation() != _specialAnim) {
+			_vm->simpleUpdate(false);
+		}
 	}
+
+
+	if (_sceneAnimationId > -1)
+		setAnimationInstance(_vm->getSceneAnimation(_sceneAnimationId)->_animInstance);
+
+
 	_animFlags |= flags;
 
 	if (_specialAnim)

Modified: scummvm/trunk/engines/toon/character.h
===================================================================
--- scummvm/trunk/engines/toon/character.h	2010-10-22 20:45:00 UTC (rev 53705)
+++ scummvm/trunk/engines/toon/character.h	2010-10-22 20:53:25 UTC (rev 53706)
@@ -96,6 +96,8 @@
 	virtual void updateIdle();
 	virtual int32 getRandomIdleAnim() { return 0; }
 	virtual void updateTimers(int32 relativeAdd);
+	virtual void setTalking(bool talking) { _isTalking = true; }
+	virtual bool isTalking() { return _isTalking; }
 
 	int32 getFacingFromDirection(int32 dx, int32 dy);
 	static const SpecialCharacterAnimation *getSpecialAnimation(int32 characterId, int32 animationId);
@@ -126,6 +128,7 @@
 	int32 _speed;
 	int32 _lastWalkTime;
 	int32 _numPixelToWalk;
+	bool _isTalking;
 
 	AnimationInstance *_animationInstance;
 	AnimationInstance *_shadowAnimationInstance;

Modified: scummvm/trunk/engines/toon/script_func.cpp
===================================================================
--- scummvm/trunk/engines/toon/script_func.cpp	2010-10-22 20:45:00 UTC (rev 53705)
+++ scummvm/trunk/engines/toon/script_func.cpp	2010-10-22 20:53:25 UTC (rev 53706)
@@ -618,7 +618,10 @@
 
 int32 ScriptFunc::sys_Cmd_Character_Talking(EMCState *state) {
 	int32 characterId = stackPos(0);
-	return (_vm->getCurrentCharacterTalking() == characterId);
+	Character *character = _vm->getCharacterById(characterId);
+	if (character)
+		return character->isTalking();
+	return 0;
 }
 
 int32 ScriptFunc::sys_Cmd_Set_Flux_Facing_Point(EMCState *state) {
@@ -963,6 +966,7 @@
 	SceneAnimation *sceneAnim = _vm->getSceneAnimation(animId);
 
 	if (sceneAnim->_active) {
+		sceneAnim->_animInstance->setAnimation(sceneAnim->_animation);
 		sceneAnim->_animInstance->setFrame(frame);
 		sceneAnim->_animInstance->setAnimationRange(frame, frame);
 		sceneAnim->_animInstance->stopAnimation();

Modified: scummvm/trunk/engines/toon/toon.cpp
===================================================================
--- scummvm/trunk/engines/toon/toon.cpp	2010-10-22 20:45:00 UTC (rev 53705)
+++ scummvm/trunk/engines/toon/toon.cpp	2010-10-22 20:53:25 UTC (rev 53706)
@@ -801,21 +801,23 @@
 	_system->setPalette(vmpalette, offset, num);
 }
 
-void ToonEngine::simpleUpdate() {
+void ToonEngine::simpleUpdate(bool waitCharacterToTalk) {
 	int32 elapsedTime = _system->getMillis() - _oldTimer2;
 	_oldTimer2 = _system->getMillis();
 	_oldTimer = _oldTimer2;
 
+	if (!_audioManager->voiceStillPlaying() && !waitCharacterToTalk) {
+		_currentTextLine = 0;
+		_currentTextLineId = -1;
+	}
+
 	updateCharacters(elapsedTime);
 	updateAnimationSceneScripts(elapsedTime);
 	updateTimer(elapsedTime);
 	_animationManager->update(elapsedTime);
 	render();
 
-	if (!_audioManager->voiceStillPlaying()) {
-		_currentTextLine = 0;
-		_currentTextLineId = -1;
-	}
+	
 }
 
 void ToonEngine::fixPaletteEntries(uint8 *palette, int num) {
@@ -1067,8 +1069,8 @@
 	setupGeneralPalette();
 	createShadowLUT();
 
+	state()->_mouseHidden = false;
 
-
 	if (!forGameLoad) {
 
 		_script->start(&_scriptState[0], 0);
@@ -1086,7 +1088,7 @@
 			_gameState->_nextSpecialEnterX = -1;
 			_gameState->_nextSpecialEnterY = -1;
 		}
-
+	
 		_script->start(&_scriptState[0], 3);
 
 		while (_script->run(&_scriptState[0]))
@@ -1098,8 +1100,6 @@
 			waitForScriptStep();
 
 	}
-
-	state()->_mouseHidden = false;
 }
 
 void ToonEngine::setupGeneralPalette() {
@@ -1911,7 +1911,19 @@
 	_currentTextLineId = dialogid;
 
 	if (blocking) {
+		Character *character = getCharacterById(talkerId);
+		if (character)
+			character->setTalking(true);
+
 		playTalkAnimOnCharacter(talkerAnimId, talkerId, true);
+
+		// set once more the values, they may have been overwritten when the engine
+		// waits for the character to be ready.
+		_currentTextLine = myLine;
+		_currentTextLineCharacterId = talkerId;
+		_currentTextLineId = dialogid;
+
+
 	} else {
 		Character *character = getCharacterById(talkerId);
 		if (character)
@@ -1935,6 +1947,10 @@
 		while (_audioManager->voiceStillPlaying() && !_shouldQuit)
 			doFrame();
 		_gameState->_mouseHidden = oldMouseHidden && _gameState->_mouseHidden;
+
+		Character *character = getCharacterById(talkerId);
+		if (character)
+			character->setTalking(false);
 	}
 
 

Modified: scummvm/trunk/engines/toon/toon.h
===================================================================
--- scummvm/trunk/engines/toon/toon.h	2010-10-22 20:45:00 UTC (rev 53705)
+++ scummvm/trunk/engines/toon/toon.h	2010-10-22 20:53:25 UTC (rev 53706)
@@ -144,7 +144,7 @@
 	int32 runConversationCommand(int16 **command);
 	void prepareConversations();
 	void drawConversationIcons();
-	void simpleUpdate();
+	void simpleUpdate(bool waitCharacterToTalk = false);
 	int32 waitTicks(int32 numTicks, bool breakOnMouseClick);
 	void copyToVirtualScreen(bool updateScreen = true);
 	void getMouseEvent();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list