[Scummvm-cvs-logs] CVS: scummvm/saga animation.cpp,1.56,1.57 animation.h,1.31,1.32 sfuncs.cpp,1.157,1.158

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sat Sep 24 03:14:37 CEST 2005


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8589

Modified Files:
	animation.cpp animation.h sfuncs.cpp 
Log Message:
Some more preliminary cutaway work. The backgrounds are displayed now, but
not the animations themselves. Still, it's enough to make the IHNM intro
look fairly interesting.


Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.cpp,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- animation.cpp	23 Sep 2005 14:29:26 -0000	1.56
+++ animation.cpp	24 Sep 2005 10:13:16 -0000	1.57
@@ -27,7 +27,10 @@
 
 #include "saga/console.h"
 #include "saga/events.h"
+#include "saga/interface.h"
 #include "saga/render.h"
+#include "saga/rscfile.h"
+#include "saga/scene.h"
 
 #include "saga/animation.h"
 
@@ -55,8 +58,8 @@
 	MemoryReadStream cutawayS(resourcePointer, resourceLength);
 
 	for (int i = 0; i < _cutawayListLength; i++) {
-		_cutawayList[i].backgroundID = cutawayS.readUint16LE();
-		_cutawayList[i].frameID = cutawayS.readUint16LE();
+		_cutawayList[i].backgroundResourceId = cutawayS.readUint16LE();
+		_cutawayList[i].animResourceId = cutawayS.readUint16LE();
 		_cutawayList[i].maxFrame = (int16)cutawayS.readUint16LE();
 		_cutawayList[i].frameRate = (int16)cutawayS.readUint16LE();
 	}
@@ -68,6 +71,51 @@
 	_cutawayListLength = 0;
 }
 
+void Anim::playCutaway(int cut, bool fade) {
+	debug(0, "playCutaway(%d, %d)", cut, fade);
+
+	if (fade) {
+		// TODO: Fade down. Is this blocking or non-blocking?
+	}
+
+	// TODO: Stop all other animations
+
+	_vm->_gfx->showCursor(false);
+	_vm->_interface->setStatusText("");
+	_vm->_interface->setSaveReminderState(0);
+
+	// TODO: Hide the inventory. Perhaps by adding a new panel mode?
+
+	// Set the initial background and palette for the cutaway
+
+	ResourceContext *context = _vm->_resource->getContext(GAME_RESOURCEFILE);
+
+	byte *resourceData;
+	size_t resourceDataLength;
+
+	_vm->_resource->loadResource(context, _cutawayList[cut].backgroundResourceId, resourceData, resourceDataLength);
+
+	byte *buf;
+	size_t buflen;
+	int width;
+	int height;
+
+	_vm->decodeBGImage(resourceData, resourceDataLength, &buf, &buflen, &width, &height);
+
+	PalEntry *palette = (PalEntry *)_vm->getImagePal(resourceData, resourceDataLength);
+
+	Surface *bgSurface = _vm->_render->getBackGroundSurface();
+	const Rect rect(width, height);
+
+	bgSurface->blit(rect, buf);
+	_vm->_gfx->setPalette(palette);
+
+	free(buf);
+	free(resourceData);
+
+	// TODO: Start the animation
+}
+
 void Anim::load(uint16 animId, const byte *animResourceData, size_t animResourceLength) {
 	AnimationData *anim;
 	uint16 temp;
@@ -230,7 +278,6 @@
 	event.time = frameTime;
 
 	_vm->_events->queue(&event);
-
 }
 
 void Anim::stop(uint16 animId) {

Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- animation.h	23 Sep 2005 14:29:26 -0000	1.31
+++ animation.h	24 Sep 2005 10:13:17 -0000	1.32
@@ -54,8 +54,8 @@
 // Cutaway info array member. Cutaways are basically animations with a really
 // bad attitude.
 struct Cutaway {
-	uint16 backgroundID;
-	uint16 frameID;
+	uint16 backgroundResourceId;
+	uint16 animResourceId;
 	int16 maxFrame;
 	int16 frameRate;
 };
@@ -109,6 +109,7 @@
 
 	void loadCutawayList(const byte *resourcePointer, size_t resourceLength);
 	void freeCutawayList(void);
+	void playCutaway(int cut, bool fade);
 
 	void load(uint16 animId, const byte *animResourceData, size_t animResourceLength);
 	void freeId(uint16 animId);

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -d -r1.157 -r1.158
--- sfuncs.cpp	21 Sep 2005 10:44:22 -0000	1.157
+++ sfuncs.cpp	24 Sep 2005 10:13:17 -0000	1.158
@@ -1840,7 +1840,14 @@
 }
 
 void Script::sfScriptStartCutAway(SCRIPTFUNC_PARAMS) {
-	SF_stub("sfScriptStartCutAway", thread, nArgs);
+	int16 cut;
+	int16 fade;
+
+	cut = thread->pop();
+	thread->pop();		// Not used
+	fade = thread->pop();
+
+	_vm->_anim->playCutaway(cut, fade != 0);
 }
 
 void Script::sfReturnFromCutAway(SCRIPTFUNC_PARAMS) {





More information about the Scummvm-git-logs mailing list