[Scummvm-cvs-logs] CVS: scummvm/saga animation.cpp,1.40,1.41 animation.h,1.20,1.21 objectmap.h,1.20,1.21 script.h,1.73,1.74 sfuncs.cpp,1.98,1.99

Eugene Sandulenko sev at users.sourceforge.net
Sat Apr 16 13:59:43 CEST 2005


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

Modified Files:
	animation.cpp animation.h objectmap.h script.h sfuncs.cpp 
Log Message:
Implement sfGetDeltaFrame and sfEnableZone. Fixes freeze when sanctuary
gates open and also used in world map.

Spelling and indentation fixes here and there.


Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- animation.cpp	12 Jan 2005 12:51:56 -0000	1.40
+++ animation.cpp	16 Apr 2005 20:59:24 -0000	1.41
@@ -157,7 +157,7 @@
 
 void Anim::setCycles(uint animId, int cycles) {
 	if (animId >= _anim_count) {
-		warning("Anim::setStopFrame(): wrong animation number (%d)", animId);
+		warning("Anim::setCycles(): wrong animation number (%d)", animId);
 		return;
 	}
 	
@@ -393,6 +393,15 @@
 	return SUCCESS;
 }
 
+int16 Anim::getCurrentFrame(uint16 animId) {
+	if (animId >= _anim_count) {
+		warning("Anim::stop(): wrong animation number (%d)", animId);
+		return 0;
+	}
+	
+	return _anim_tbl[animId]->current_frame;
+}
+
 int Anim::freeId(uint16 anim_id) {
 	ANIMATION *anim;
 

Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- animation.h	11 Jan 2005 21:10:19 -0000	1.20
+++ animation.h	16 Apr 2005 20:59:24 -0000	1.21
@@ -120,6 +120,7 @@
 	void stop(uint16 animId);
 	void finish(uint16 animId);
 	void resume(uint16 animId, int cycles);
+	int16 getCurrentFrame(uint16 anim_id);
 
 private:
 	int ITE_DecodeFrame(const byte *anim_resource, size_t anim_resource_len, size_t frame_offset, byte *buf, size_t buf_len);

Index: objectmap.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- objectmap.h	18 Jan 2005 15:01:21 -0000	1.20
+++ objectmap.h	16 Apr 2005 20:59:24 -0000	1.21
@@ -37,8 +37,8 @@
 		int pointsCount;
 		Point *points;
 	};
+
 public:
-	
 	HitZone(MemoryReadStreamEndian *readStream, int index);
 	~HitZone();
 	
@@ -60,6 +60,12 @@
 	int getFlags() const {
 		return _flags;
 	}
+	void setFlag(HitZoneFlags flag) {
+		_flags |= flag;
+	}
+	void clearFlag(HitZoneFlags flag) {
+		_flags &= ~flag;
+	}
 	int getDirection() const {
 		return ((_flags >> 4) & 0xF);
 	}
@@ -72,6 +78,7 @@
 	bool getSpecialPoint(Point &specialPoint) const;
 	void draw(SURFACE *ds, int color);	
 	bool hitTest(const Point &testPoint);
+
 private:
 	int _flags;				// Saga::HitZoneFlags 
 	int _clickAreasCount;
@@ -99,7 +106,7 @@
 
 	void draw(SURFACE *drawSurface, const Point& testPoint, int color, int color2);
 	int hitTest(const Point& testPoint);
-	const HitZone * getHitZone(int index) const {
+	HitZone *getHitZone(int16 index) {
 		if ((index < 0) || (index >= _hitZoneListCount)) {
 			error("ObjectMap::getHitZone wrong index 0x%X", index);
 		}

Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- script.h	16 Apr 2005 16:55:35 -0000	1.73
+++ script.h	16 Apr 2005 20:59:24 -0000	1.74
@@ -486,7 +486,7 @@
 	void sfDoCenterActor(SCRIPTFUNC_PARAMS);
 	void sfStartBgdAnimSpeed(SCRIPTFUNC_PARAMS);
 	void sfScriptWalkToAsync(SCRIPTFUNC_PARAMS);
-	void SF_enableZone(SCRIPTFUNC_PARAMS);
+	void sfEnableZone(SCRIPTFUNC_PARAMS);
 	void sfSetActorState(SCRIPTFUNC_PARAMS);
 	void sfScriptMoveTo(SCRIPTFUNC_PARAMS);
 	void SF_sceneEq(SCRIPTFUNC_PARAMS);
@@ -530,7 +530,7 @@
 	void sfEnableEscape(SCRIPTFUNC_PARAMS);
 	void sfPlaySound(SCRIPTFUNC_PARAMS);
 	void SF_playLoopedSound(SCRIPTFUNC_PARAMS);
-	void SF_getDeltaFrame(SCRIPTFUNC_PARAMS);
+	void sfGetDeltaFrame(SCRIPTFUNC_PARAMS);
 	void SF_showProtect(SCRIPTFUNC_PARAMS);
 	void SF_protectResult(SCRIPTFUNC_PARAMS);
 	void sfRand(SCRIPTFUNC_PARAMS);

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -d -r1.98 -r1.99
--- sfuncs.cpp	16 Apr 2005 16:55:35 -0000	1.98
+++ sfuncs.cpp	16 Apr 2005 20:59:24 -0000	1.99
@@ -78,7 +78,7 @@
 		OPCODE(sfDoCenterActor),
 		OPCODE(sfStartBgdAnimSpeed),
 		OPCODE(sfScriptWalkToAsync),
-		OPCODE(SF_enableZone),
+		OPCODE(sfEnableZone),
 		OPCODE(sfSetActorState),
 		OPCODE(sfScriptMoveTo),
 		OPCODE(SF_sceneEq),
@@ -122,7 +122,7 @@
 		OPCODE(sfEnableEscape),
 		OPCODE(sfPlaySound),
 		OPCODE(SF_playLoopedSound),
-		OPCODE(SF_getDeltaFrame),
+		OPCODE(sfGetDeltaFrame),
 		OPCODE(SF_showProtect),
 		OPCODE(SF_protectResult),
 		OPCODE(sfRand),
@@ -610,7 +610,6 @@
 
 	_vm->_anim->setFrameTime(animId, ticksToMSec(speed));
 	debug(1, "sfSetBgdAnimSpeed(%d, %d)", animId, speed);
-
 }
 
 // Script function #24 (0x18)
@@ -665,11 +664,20 @@
 }
 
 // Script function #28 (0x1C)
-void Script::SF_enableZone(SCRIPTFUNC_PARAMS) {
-	for (int i = 0; i < nArgs; i++)
-		thread->pop();
+void Script::sfEnableZone(SCRIPTFUNC_PARAMS) {
+	int16 hitZoneIndex = objectIdToIndex(thread->pop());
+	int16 flag = thread->pop();
+	HitZone *hitZone;
 
-	debug(1, "stub: SF_enableZone(), %d args", nArgs);
+	debug(0, "sfEnableZone(%d, %d)", hitZoneIndex, flag);
+	hitZone = _vm->_scene->_objectMap->getHitZone(hitZoneIndex);
+
+	if (flag) {
+		hitZone->setFlag(kHitZoneEnabled);
+	} else {
+		hitZone->clearFlag(kHitZoneEnabled);
+		_vm->_actor->_protagonist->lastZone = NULL;
+	}
 }
 
 // Script function #29 (0x1D)
@@ -1587,11 +1595,10 @@
 }
 
 // Script function #72 (0x48)
-void Script::SF_getDeltaFrame(SCRIPTFUNC_PARAMS) {
-	for (int i = 0; i < nArgs; i++)
-		thread->pop();
+void Script::sfGetDeltaFrame(SCRIPTFUNC_PARAMS) {
+	uint16 animId = (uint16)thread->pop();
 
-	debug(1, "stub: SF_getDeltaFrame(), %d args", nArgs);
+	thread->_returnValue = _vm->_anim->getCurrentFrame(animId);
 }
 
 // Script function #73 (0x49)





More information about the Scummvm-git-logs mailing list