aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorAndrew Kurushin2004-12-24 12:47:16 +0000
committerAndrew Kurushin2004-12-24 12:47:16 +0000
commit241155c882248b50e7feda208d6ac7787eb7c70a (patch)
tree092a55e96beea297861e753c66ee5e6d19a7ca2a /saga
parent573da1e79cca48c0140e0b1a6e6463373a481715 (diff)
downloadscummvm-rg350-241155c882248b50e7feda208d6ac7787eb7c70a.tar.gz
scummvm-rg350-241155c882248b50e7feda208d6ac7787eb7c70a.tar.bz2
scummvm-rg350-241155c882248b50e7feda208d6ac7787eb7c70a.zip
- aninamation cycle now approach to original
svn-id: r16290
Diffstat (limited to 'saga')
-rw-r--r--saga/actor.cpp19
-rw-r--r--saga/actor.h3
-rw-r--r--saga/events.cpp3
-rw-r--r--saga/sndres.cpp6
4 files changed, 20 insertions, 11 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index c4c1b2af3b..a095d64ce8 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -77,7 +77,7 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) {
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 @@ void Actor::handleSpeech(int msec) {
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 @@ void Actor::handleActions(int msec, bool setup) {
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 @@ void Actor::handleActions(int msec, bool setup) {
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 @@ int Actor::direct(int msec) {
}
}
}
-*/
-//process actions
- handleActions(msec, false);
+*/
+ _lastTickMsec += msec;
+
+ if (_lastTickMsec > ticksToMSec(6)) { // fixme
+ _lastTickMsec = 0;
+ //process actions
+ handleActions(msec, false);
+ }
//process speech
handleSpeech(msec);
diff --git a/saga/actor.h b/saga/actor.h
index 8bdf921812..80722baf14 100644
--- a/saga/actor.h
+++ b/saga/actor.h
@@ -405,7 +405,8 @@ private:
void createDrawOrderList();
void handleSpeech(int msec);
void handleActions(int msec, bool setup);
-
+
+ int _lastTickMsec;
SagaEngine *_vm;
RSCFILE_CONTEXT *_actorContext;
ActorOrderList _drawOrderList;
diff --git a/saga/events.cpp b/saga/events.cpp
index 184d53bc99..0e95f03751 100644
--- a/saga/events.cpp
+++ b/saga/events.cpp
@@ -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 @@ int Events::handleOneShot(EVENT *event) {
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");
diff --git a/saga/sndres.cpp b/saga/sndres.cpp
index 89154c7d84..21e18a1c5b 100644
--- a/saga/sndres.cpp
+++ b/saga/sndres.cpp
@@ -141,7 +141,7 @@ int SndRes::load(RSCFILE_CONTEXT *snd_ctxt, uint32 snd_rn, SOUNDBUFFER *snd_buf_
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 @@ int SndRes::loadVocSound(byte *snd_res, size_t snd_res_len, SOUNDBUFFER *snd_buf
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 @@ int SndRes::getVoiceLength(uint32 voice_rn) {
} 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;