[Scummvm-cvs-logs] CVS: scummvm/sky logic.cpp,1.77,1.78 screen.cpp,1.21,1.22 sky.cpp,1.50,1.51 sound.cpp,1.12,1.13 sound.h,1.6,1.7

Robert G?ffringmann lavosspawn at users.sourceforge.net
Sun Jun 1 20:31:05 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv6851/sky

Modified Files:
	logic.cpp screen.cpp sky.cpp sound.cpp sound.h 
Log Message:
fixed sprite animation bug in stdSpeak, cleaned fnTalk and made text timing in cd version depending on the end of the voc files being reached.

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- logic.cpp	1 Jun 2003 21:21:08 -0000	1.77
+++ logic.cpp	2 Jun 2003 03:30:40 -0000	1.78
@@ -496,9 +496,8 @@
 
 	// If speech is allowed then check for it to finish before finishing animations
 
-	if ((SkyState::_systemVars.systemFlags & SF_PLAY_VOCS) && // sblaster?
-		(_compact->extCompact->spTextId == 0xFFFF) && // is this a voc file?
-		(!(SkyState::_systemVars.systemFlags & SF_VOC_PLAYING))) { // finished?
+	if ((_compact->extCompact->spTextId == 0xFFFF) && // is this a voc file?
+		(_skySound->speechFinished())) { // finished?
 
 		_compact->logic = L_SCRIPT; // restart character control
 
@@ -517,41 +516,33 @@
 			// we will force the animation to finish 3 game cycles
 			// before the speech actually finishes - because it looks good.
 
-			if (_compact->extCompact->spTime != 3) {
+			if ((_compact->extCompact->spTime != 3) || (!_skySound->speechFinished())) {
 				_compact->frame = *(graphixProg + 2) + _compact->offset;
 				graphixProg += 3;
 				_compact->grafixProg = graphixProg;
-				goto past_speech_anim;
-			}
-
-			if (SkyState::_systemVars.systemFlags & SF_VOC_PLAYING) {
-				_compact->extCompact->spTime++;
-				return;
 			}
+		} else {
+			// we ran out of frames, let actor stand still.
+			// TODO: we should improve this and simply restart animation.
+			_compact->frame = _compact->getToFlag;
+			_compact->grafixProg = 0;
 		}
-
-		_compact->frame = _compact->getToFlag;
-		_compact->grafixProg = 0;
 	}
 
-past_speech_anim:
-	if (--(_compact->extCompact->spTime))
-		return;
+	if (_skySound->speechFinished()) _compact->extCompact->spTime--;
 
-	// ok, speech has finished
+	if (_compact->extCompact->spTime == 0) {
 
-	if (SkyState::_systemVars.systemFlags & SF_VOC_PLAYING) {
-		_compact->extCompact->spTime++;
-		return;
-	}
+		// ok, speech has finished
 
-	if (_compact->extCompact->spTextId) {
-		Compact *cpt = SkyState::fetchCompact(_compact->extCompact->spTextId); // get text id to kill
-		cpt->status = 0; // kill the text
-	}
+		if (_compact->extCompact->spTextId) {
+			Compact *cpt = SkyState::fetchCompact(_compact->extCompact->spTextId); // get text id to kill
+			cpt->status = 0; // kill the text
+		}
 
-	_compact->logic = L_SCRIPT;
-	logicScript();
+		_compact->logic = L_SCRIPT;
+		logicScript();
+	}
 }
 
 void SkyLogic::listen() {
@@ -2198,24 +2189,16 @@
 }
 
 void SkyLogic::stdSpeak(Compact *target, uint32 textNum, uint32 animNum, uint32 base) {
-	//animNum == -1 (0x??FF) means directional
-	
-	uint8 offset = (uint8)(target->extCompact->megaSet / NEXT_MEGA_SET);
-	uint16 *animPtr = 0;
-	
-	if (animNum > 0xFF)
-		warning("animNum > 255! - tell joostp when/where this happens");
-	
-	//FIXME: Is this correct?
-	if (animNum >= 0xFF)
-		offset += -1;
-	else
-		offset += (uint8)(animNum & 0xFF);   //get correct anim no
 
-	if (SkyTalkAnims::animTalkTableIsPointer[offset]) //is it a pointer?
-		animPtr = (uint16 *)SkyTalkAnims::animTalkTablePtr[offset];
-	else  	//then it must be a value
-		animPtr = (uint16 *)SkyState::fetchCompact(SkyTalkAnims::animTalkTableVal[offset]);
+	uint16 *animPtr;
+
+	animNum += target->extCompact->megaSet / NEXT_MEGA_SET;
+	animNum &= 0xFF;
+
+	if (SkyTalkAnims::animTalkTableIsPointer[animNum]) //is it a pointer? 
+		animPtr = (uint16 *)SkyTalkAnims::animTalkTablePtr[animNum];
+	else 	//then it must be a value
+		animPtr = (uint16 *)SkyState::fetchCompact(SkyTalkAnims::animTalkTableVal[animNum]);
 	
 	target->offset = *animPtr++;
 	target->getToFlag = *animPtr++;
@@ -2268,8 +2251,11 @@
 		_compact->status = 0;	//don't display text
 		//_logicTalkButtonRelease = 1; 
 	}
-
-	target->extCompact->spTime = (uint16)_skyText->_dtLetters + 5;
+	// In CD version, we're doing the timing by checking when the VOC has stopped playing.
+	// Setting spTime to 10 thus means that we're doing a pause of 10 gamecycles between
+	// each sentence.
+	if (SkyState::isCDVersion()) target->extCompact->spTime = 10;
+	else target->extCompact->spTime = (uint16)_skyText->_dtLetters + 5;
 	target->logic = L_TALK; 
 }
 

Index: screen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/screen.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- screen.cpp	2 Jun 2003 00:53:31 -0000	1.21
+++ screen.cpp	2 Jun 2003 03:30:40 -0000	1.22
@@ -180,8 +180,8 @@
 	uint8 *screenPos = _currentScreen;
 	uint8 *backPos = _backScreen;
 	uint32 copyX, copyWidth;
+	copyWidth = 0;
 	for (uint8 cnty = 0; cnty < GRID_Y; cnty++) {
-		copyWidth = 0;
 		for (uint8 cntx = 0; cntx < GRID_X; cntx++) {
 			if (_gameGrid[cnty * GRID_X + cntx] & 1) {
 				_gameGrid[cnty * GRID_X + cntx] &= ~1;
@@ -220,7 +220,6 @@
 	recreate();
 	spriteEngine();
 	flip();
-	_system->update_screen();
 	fnFadeUp(palette, scroll);
 }
 

Index: sky.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- sky.cpp	1 Jun 2003 22:53:44 -0000	1.50
+++ sky.cpp	2 Jun 2003 03:30:40 -0000	1.51
@@ -153,6 +153,7 @@
 		_skyScreen->spriteEngine();
 		_skyScreen->flip();
 		_system->update_screen();
+		//if (_skySound->speechFinished()) printf("finsihed\n"); else printf("running\n");
 	}
 }
 
@@ -172,6 +173,7 @@
 		_systemVars.systemFlags |= SF_ROLAND;
 		_skyMusic = new SkyGmMusic(_detector->createMidi(), _skyDisk);
 	}
+	_systemVars.systemFlags |= SF_PLAY_VOCS;
 
 	_skyText = new SkyText(_skyDisk);
 	_skyMouse = new SkyMouse(_system, _skyDisk);

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- sound.cpp	1 Jun 2003 21:21:09 -0000	1.12
+++ sound.cpp	2 Jun 2003 03:30:41 -0000	1.13
@@ -1013,6 +1013,7 @@
 	_effectHandle = 0;
 	_bgSoundHandle = 0;
 	_ingameSound = 0;
+	_ingameSpeech = 0;
 }
 
 SkySound::~SkySound(void) {
@@ -1117,10 +1118,14 @@
 
 	uint8 volume = 0x7f; // start with max vol
 
-	if (SkyState::_systemVars.systemFlags & SF_SBLASTER)
-		volume = roomList[i].adlibVolume;
-	if (SkyState::_systemVars.systemFlags & SF_ROLAND)
-	 	volume = roomList[i].rolandVolume;
+	if (!SkyState::isCDVersion()) {
+		// as long as we can't set the volume for sfx without changing the speech volume,
+		// we're better off not setting it at all.
+		if (SkyState::_systemVars.systemFlags & SF_SBLASTER)
+			volume = roomList[i].adlibVolume;
+		if (SkyState::_systemVars.systemFlags & SF_ROLAND)
+		 	volume = roomList[i].rolandVolume;
+	}
 
 	// Check the flags, the sound may come on after a delay.
 	if (sfx->flags & SFXF_START_DELAY) {

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sound.h	1 Jun 2003 03:44:07 -0000	1.6
+++ sound.h	2 Jun 2003 03:30:41 -0000	1.7
@@ -51,6 +51,7 @@
 	void playSound(uint16 sound, uint16 volume);
 	bool fnStartFx(uint32 sound);
 	void fnStartSpeech(uint16 textNum);
+	bool speechFinished(void) { return _ingameSpeech == 0; };
 
 private:
 	SkyDisk *_skyDisk;





More information about the Scummvm-git-logs mailing list