[Scummvm-cvs-logs] SF.net SVN: scummvm: [27166] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Jun 7 14:11:34 CEST 2007


Revision: 27166
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27166&view=rev
Author:   thebluegr
Date:     2007-06-07 05:11:33 -0700 (Thu, 07 Jun 2007)

Log Message:
-----------
Implemented video playing for IHNM (still needs work). Also, updated a comment regarding the intro

Modified Paths:
--------------
    scummvm/trunk/engines/saga/animation.cpp
    scummvm/trunk/engines/saga/animation.h
    scummvm/trunk/engines/saga/ihnm_introproc.cpp
    scummvm/trunk/engines/saga/sfuncs.cpp

Modified: scummvm/trunk/engines/saga/animation.cpp
===================================================================
--- scummvm/trunk/engines/saga/animation.cpp	2007-06-07 09:39:47 UTC (rev 27165)
+++ scummvm/trunk/engines/saga/animation.cpp	2007-06-07 12:11:33 UTC (rev 27166)
@@ -80,6 +80,8 @@
 void Anim::playCutaway(int cut, bool fade) {
 	debug(0, "playCutaway(%d, %d)", cut, fade);
 
+	_cutAwayFade = fade;
+
 	if (fade) {
 		Event event;
 		static PalEntry cur_pal[PAL_ENTRIES];
@@ -101,7 +103,10 @@
 		_vm->_interface->setStatusText("");
 		_vm->_interface->setSaveReminderState(0);
 		_vm->_interface->rememberMode();
-		_vm->_interface->setMode(kPanelCutaway);
+		if (_cutAwayMode == kPanelVideo)
+			_vm->_interface->setMode(kPanelVideo);
+		else
+			_vm->_interface->setMode(kPanelCutaway);
 		_cutawayActive = true;
 	}
 
@@ -183,17 +188,23 @@
 		// Note that clearCutaway() sets _cutawayActive to false.
 		clearCutaway();
 
-		warning("TODO: Implement the rest of returnFromCutaway()");
-
 		// Handle fade up, if we previously faded down
-		// TODO
+		if (_cutAwayFade) {
+			Event event;
+			event.type = kEvTImmediate;
+			event.code = kPalEvent;
+			event.op = kEventBlackToPal;
+			event.time = 0;
+			event.duration = kNormalFadeDuration;
+			event.data = saved_pal;
 
+			_vm->_events->queue(&event);
+		}
+
 		// Restore the scene
 		_vm->_scene->restoreScene();
 
 		// Restore the animations
-		// TODO
-
 		for (int i = 0; i < MAX_ANIMATIONS; i++) {
 			if (_animations[i] && _animations[i]->state == ANIM_PLAYING) {
 				resume(i, 0);
@@ -221,34 +232,26 @@
 void Anim::startVideo(int vid, bool fade) {
 	debug(0, "startVideo(%d, %d)", vid, fade);
 
-	// TODO
-	warning(0, "TODO: Anim::startVideo(%d, %d)", vid, fade);
+	Event event;
+	_vm->_gfx->getCurrentPal(saved_pal);
 
-	_videoActive = true;
+	_vm->_interface->setStatusText("");
+
+	playCutaway(vid, fade);
 }
 
 void Anim::endVideo(void) {
 	debug(0, "endVideo()");
 
-	// TODO
-	warning("TODO: Anim::endVideo()");
-
-	_videoActive = false;
+	clearCutaway();
 }
 
 void Anim::returnFromVideo(void) {
 	debug(0, "returnFromVideo()");
 
-	// TODO
-	warning("TODO: Anim::returnFromVideo");
-
-	_videoActive = false;
+	returnFromCutaway();
 }
 
-void Anim::nextVideoFrame(void) {
-	// TODO
-}
-
 void Anim::load(uint16 animId, const byte *animResourceData, size_t animResourceLength) {
 	AnimationData *anim;
 	uint16 temp;
@@ -360,11 +363,17 @@
 		return;
 	}
 
+	// HACK: the animation starts playing before sfwaitframes is called in IHNM, which
+	// causes the game to wait forever. Raise the framecount by 10 to avoid lockup
+	// TODO: remove this hack
+	_vm->_frameCount += 10;
+
 	if (anim->completed < anim->cycles) {
 		frame = anim->currentFrame;
 		// FIXME: if start > 0, then this works incorrectly
 		decodeFrame(anim, anim->frameOffsets[frame], displayBuffer, _vm->getDisplayWidth() * _vm->getDisplayHeight());
 
+		_vm->_frameCount++;	
 		anim->currentFrame++;
 		if (anim->completed != 65535) {
 			anim->completed++;
@@ -535,7 +544,7 @@
 
 
 	// Begin RLE decompression to output buffer
-	do {
+	do {		
 		markByte = readS.readByte();
 		switch (markByte) {
 		case SAGA_FRAME_START:

Modified: scummvm/trunk/engines/saga/animation.h
===================================================================
--- scummvm/trunk/engines/saga/animation.h	2007-06-07 09:39:47 UTC (rev 27165)
+++ scummvm/trunk/engines/saga/animation.h	2007-06-07 12:11:33 UTC (rev 27166)
@@ -123,7 +123,6 @@
 	void startVideo(int vid, bool fade);
 	void endVideo(void);
 	void returnFromVideo(void);
-	void nextVideoFrame(void);
 
 	void load(uint16 animId, const byte *animResourceData, size_t animResourceLength);
 	void freeId(uint16 animId);
@@ -142,8 +141,8 @@
 	bool hasCutaway(void) {
 		return _cutawayActive;
 	}
-	bool hasVideo(void) {
-		return _videoActive;
+	void setCutAwayMode(int mode) {
+		_cutAwayMode = mode;
 	}
 	bool hasAnimation(uint16 animId) {
 		if (animId >= MAX_ANIMATIONS) {
@@ -198,9 +197,11 @@
 	AnimationData *_animations[MAX_ANIMATIONS];
 	AnimationData *_cutawayAnimations[2];
 	Cutaway *_cutawayList;
+	PalEntry saved_pal[PAL_ENTRIES];
 	int _cutawayListLength;
 	bool _cutawayActive;
-	bool _videoActive;
+	int _cutAwayMode;
+	bool _cutAwayFade;
 };
 
 } // End of namespace Saga

Modified: scummvm/trunk/engines/saga/ihnm_introproc.cpp
===================================================================
--- scummvm/trunk/engines/saga/ihnm_introproc.cpp	2007-06-07 09:39:47 UTC (rev 27165)
+++ scummvm/trunk/engines/saga/ihnm_introproc.cpp	2007-06-07 12:11:33 UTC (rev 27166)
@@ -97,7 +97,7 @@
 	// The original used the "play video" mechanism for the first part of
 	// the intro. We just use that panel mode.
 
-	_vm->_interface->setMode(kPanelVideo);
+	_vm->_anim->setCutAwayMode(kPanelVideo);
 
 	n_introscenes = ARRAYSIZE(IHNM_IntroList);
 
@@ -312,9 +312,7 @@
 		q_event = _vm->_events->chain(q_event, &event);
 
 		// Queue end of scene after a while
-		// TODO: I've increased the delay so the speech won't start
-		// until the music has ended. Could someone verify if that's
-		// the correct behaviour?
+		// The delay has been increased so the speech won't start until the music has ended
 		event.type = kEvTOneshot;
 		event.code = kSceneEvent;
 		event.op = kEventEnd;

Modified: scummvm/trunk/engines/saga/sfuncs.cpp
===================================================================
--- scummvm/trunk/engines/saga/sfuncs.cpp	2007-06-07 09:39:47 UTC (rev 27165)
+++ scummvm/trunk/engines/saga/sfuncs.cpp	2007-06-07 12:11:33 UTC (rev 27166)
@@ -1875,6 +1875,7 @@
 	thread->pop();		// Not used
 	fade = thread->pop();
 
+	_vm->_anim->setCutAwayMode(kPanelCutaway);	
 	_vm->_anim->playCutaway(cut, fade != 0);
 }
 
@@ -1932,20 +1933,16 @@
 	vid = thread->pop();
 	fade = thread->pop();
 
-	_vm->_interface->setStatusText("");
+	_vm->_anim->setCutAwayMode(kPanelVideo);
 	_vm->_anim->startVideo(vid, fade != 0);
-	_vm->_interface->rememberMode();
-	_vm->_interface->setMode(kPanelVideo);
 }
 
 void Script::sfScriptReturnFromVideo(SCRIPTFUNC_PARAMS) {
 	_vm->_anim->returnFromVideo();
-	_vm->_interface->restoreMode();
 }
 
 void Script::sfScriptEndVideo(SCRIPTFUNC_PARAMS) {
 	_vm->_anim->endVideo();
-	_vm->_interface->restoreMode();
 }
 
 void Script::sf87(SCRIPTFUNC_PARAMS) {


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