[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.47,1.48 actor.h,1.24,1.25 events.cpp,1.34,1.35 sndres.cpp,1.33,1.34

Andrew Kurushin h00ligan at users.sourceforge.net
Fri Dec 24 04:48:03 CET 2004


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

Modified Files:
	actor.cpp actor.h events.cpp sndres.cpp 
Log Message:
- aninamation cycle now approach to original

Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- actor.cpp	24 Dec 2004 10:22:01 -0000	1.47
+++ actor.cpp	24 Dec 2004 12:47:16 -0000	1.48
@@ -77,7 +77,7 @@
 	debug(9, "Actor::Actor()");
 
 	_centerActor = _protagonist = NULL;
-
+	_lastTickMsec = 0;
 	// Get actor resource file context
 	_actorContext = _vm->getFileContext(GAME_RESOURCEFILE, 0);
 	if (_actorContext == NULL) {
@@ -297,7 +297,7 @@
 			actor = getActor(_activeSpeech.actorIds[0]);
 			if (!(_activeSpeech.speechFlags & kSpeakNoAnimate)) {
 				actor->currentAction = kActionSpeak;
-				//a->actionCycle = rand() % 64; todo
+				actor->actionCycle = rand() % 64; 
 			}
 		}
 		_activeSpeech.playing = true;			
@@ -357,7 +357,8 @@
 				if (actor->flags & kCycle) {
 					frameRange = getActorFrameRange( actor->actorId, kFrameStand);
 					if (frameRange->frameCount > 0) {
-						actor->actionCycle = (++actor->actionCycle) % frameRange->frameCount;
+						actor->actionCycle++;
+						actor->actionCycle = (actor->actionCycle) % frameRange->frameCount;
 					} else {
 						actor->actionCycle = 0;
 					}
@@ -397,6 +398,7 @@
 				if (actor->actionCycle >= frameRange->frameCount) {
 					if (actor->actionCycle & 1) break;
 					frameRange = getActorFrameRange( actor->actorId, kFrameSpeak);
+
 					state = (uint16)rand() % (frameRange->frameCount + 1);
 
 					if (state == 0) {
@@ -546,9 +548,14 @@
 			}
 		}
 	}
-*/
-//process actions
-	handleActions(msec, false);
+*/	
+	_lastTickMsec += msec;
+
+	if (_lastTickMsec > ticksToMSec(6)) { // fixme
+		_lastTickMsec = 0;
+		//process actions
+		handleActions(msec, false);
+	}
 
 //process speech
 	handleSpeech(msec);

Index: actor.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- actor.h	22 Dec 2004 21:04:50 -0000	1.24
+++ actor.h	24 Dec 2004 12:47:16 -0000	1.25
@@ -405,7 +405,8 @@
 	void createDrawOrderList();
 	void handleSpeech(int msec);
 	void handleActions(int msec, bool setup);
-
+	
+	int _lastTickMsec;
 	SagaEngine *_vm;
 	RSCFILE_CONTEXT *_actorContext;
 	ActorOrderList _drawOrderList;

Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/events.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- events.cpp	22 Dec 2004 13:09:46 -0000	1.34
+++ events.cpp	24 Dec 2004 12:47:16 -0000	1.35
@@ -37,6 +37,7 @@
 #include "saga/render.h"
 #include "saga/sndres.h"
 #include "saga/music.h"
+#include "saga/actor.h"
 
 #include "saga/events.h"
 
@@ -371,7 +372,7 @@
 		break;
 	case SCRIPT_EVENT:
 		debug(0, "Starting start script #%d", event->param);
-
+		
 		sthread = _vm->_script->SThreadCreate();
 		if (sthread == NULL) {
 			_vm->_console->DebugPrintf("Thread creation failed.\n");

Index: sndres.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sndres.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- sndres.cpp	22 Dec 2004 13:09:47 -0000	1.33
+++ sndres.cpp	24 Dec 2004 12:47:16 -0000	1.34
@@ -141,7 +141,7 @@
 	if (result != SUCCESS) {
 		return FAILURE;
 	}
-
+	
 	switch (_snd_info.res_type) {
 	case GAME_SOUND_PCM:
 		snd_buf_i->s_freq = _snd_info.freq;
@@ -188,7 +188,7 @@
 
 	snd_buf_i->s_freq = rate;
 	snd_buf_i->s_samplebits = 8;
-			snd_buf_i->s_stereo = 0;
+	snd_buf_i->s_stereo = 0;
 	snd_buf_i->s_signed = 0;
 	snd_buf_i->s_buf = data;
 	snd_buf_i->s_buf_len = len;
@@ -304,7 +304,7 @@
 	} else if (res_type == GAME_SOUND_PCM) {
 		ms_f = (double)length / (_snd_info.sample_size / CHAR_BIT) / (_snd_info.freq) * 1000.0;
 		ms_i = (int)ms_f;
-	} else if (res_type == GAME_SOUND_VOC) {
+	} else if (res_type == GAME_SOUND_VOC) {		
 		// Rough hack, fix this to be accurate
 		ms_f = (double)length / 14705 * 1000.0;
 		ms_i = (int)ms_f;





More information about the Scummvm-git-logs mailing list