[Scummvm-cvs-logs] CVS: scummvm/saga animation.cpp,1.30,1.31 animation.h,1.15,1.16 events.cpp,1.35,1.36 script.h,1.36,1.37 sfuncs.cpp,1.54,1.55
Eugene Sandulenko
sev at users.sourceforge.net
Mon Dec 27 20:10:01 CET 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga animation.cpp,1.29,1.30 animation.h,1.14,1.15 ihnm_introproc.cpp,1.32,1.33 ite_introproc.cpp,1.35,1.36 saga.h,1.56,1.57 scene.cpp,1.62,1.63 script.h,1.35,1.36 sfuncs.cpp,1.53,1.54
- Next message: [Scummvm-cvs-logs] CVS: residual/dists/msvc8 residual.vcproj,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13661
Modified Files:
animation.cpp animation.h events.cpp script.h sfuncs.cpp
Log Message:
Implement rest of animation-related opcodes.
Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- animation.cpp 28 Dec 2004 03:44:00 -0000 1.30
+++ animation.cpp 28 Dec 2004 04:09:10 -0000 1.31
@@ -118,7 +118,7 @@
new_anim->frame_time = DEFAULT_FRAME_TIME;
new_anim->flags = 0;
new_anim->link_id = -1;
- new_anim->playing = false;
+ new_anim->state = ANIM_PAUSE;
_anim_tbl[anim_id] = new_anim;
@@ -197,9 +197,9 @@
}
if (playing)
- anim->playing = true;
+ anim->state = ANIM_PLAYING;
- if (anim->flags & ANIM_PAUSE)
+ if (anim->state == ANIM_PAUSE)
return SUCCESS;
if (anim->completed < anim->cycles) {
@@ -210,7 +210,7 @@
disp_info.logical_w * disp_info.logical_h);
if (result != SUCCESS) {
warning("Anim::play: Error decoding frame %u", anim->current_frame);
- anim->playing = false;
+ anim->state = ANIM_PAUSE;
return FAILURE;
}
} else {
@@ -223,7 +223,7 @@
anim->cur_frame_p, anim->cur_frame_len, &nextf_p, &nextf_len);
if (result != SUCCESS) {
warning("Anim::play: Error decoding frame %u", anim->current_frame);
- anim->playing = false;
+ anim->state = ANIM_PAUSE;
return FAILURE;
}
@@ -240,8 +240,8 @@
anim->cur_frame_p = anim->resdata + SAGA_FRAME_HEADER_LEN;
anim->cur_frame_len = anim->resdata_len - SAGA_FRAME_HEADER_LEN;
- if (anim->current_frame == -1)
- anim->playing = false;
+ if (anim->flags & ANIM_STOPPING || anim->current_frame == -1)
+ anim->state = ANIM_PAUSE;
}
} else {
@@ -249,21 +249,21 @@
if (anim->link_id != -1) {
// If this animation has a link, follow it
anim->current_frame = 0;
- anim->playing = false;
+ anim->state = ANIM_PAUSE;
link_anim_id = anim->link_id;
link_anim = _anim_tbl[link_anim_id];
if (link_anim != NULL) {
link_anim->current_frame = 0;
- link_anim->playing = true;
+ link_anim->state = ANIM_PLAYING;
}
anim_id = link_anim_id;
} else {
// No link, stop playing
anim->current_frame = anim->n_frames - 1;
- anim->playing = false;
+ anim->state = ANIM_PAUSE;
if (anim->flags & ANIM_ENDSCENE) {
// This animation ends the scene
@@ -277,14 +277,14 @@
}
}
- if (!anim->playing && anim->link_id != -1) {
+ if (anim->state == ANIM_PAUSE && anim->link_id != -1) {
// If this animation has a link, follow it
link_anim_id = anim->link_id;
link_anim = _anim_tbl[link_anim_id];
if (link_anim != NULL) {
link_anim->current_frame = 0;
- link_anim->playing = true;
+ link_anim->state = ANIM_PLAYING;
}
anim_id = link_anim_id;
}
@@ -306,8 +306,26 @@
return;
}
- _anim_tbl[animId]->playing = false;
- _anim_tbl[animId]->flags |= ANIM_PAUSE;
+ _anim_tbl[animId]->state = ANIM_PAUSE;
+}
+
+void Anim::finish(uint16 animId) {
+ if (animId >= _anim_count) {
+ warning("Anim::finish(): wrong animation number (%d)", animId);
+ return;
+ }
+
+ _anim_tbl[animId]->state = ANIM_STOPPING;
+}
+
+void Anim::resume(uint16 animId, int cycles) {
+ if (animId >= _anim_count) {
+ warning("Anim::resume(): wrong animation number (%d)", animId);
+ return;
+ }
+
+ _anim_tbl[animId]->cycles += cycles;
+ play(animId, 0, true);
}
int Anim::reset() {
Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/animation.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- animation.h 28 Dec 2004 03:44:07 -0000 1.15
+++ animation.h 28 Dec 2004 04:09:10 -0000 1.16
@@ -90,14 +90,15 @@
size_t cur_frame_len;
int frame_time;
- bool playing;
+ int state;
int16 link_id;
uint16 flags;
};
enum ANIM_FLAGS {
- ANIM_LOOP = 0x01,
+ ANIM_PLAYING = 0x01,
ANIM_PAUSE = 0x02,
+ ANIM_STOPPING = 0x04,
ANIM_ENDSCENE = 0x80 // When animation ends, dispatch scene end event
};
@@ -117,6 +118,8 @@
void animInfo(void);
void setCycles(uint animId, int cycles);
void stop(uint16 animId);
+ void finish(uint16 animId);
+ void resume(uint16 animId, int cycles);
private:
int ITE_DecodeFrame(const byte *anim_resource, size_t anim_resource_len, size_t frame_offset, byte *buf, size_t buf_len);
Index: events.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/events.cpp,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- events.cpp 24 Dec 2004 12:47:16 -0000 1.35
+++ events.cpp 28 Dec 2004 04:09:10 -0000 1.36
@@ -327,7 +327,7 @@
case ANIM_EVENT:
switch (event->op) {
case EVENT_FRAME:
- _vm->_anim->play(event->param, event->time);
+ _vm->_anim->play(event->param, event->time, false);
break;
case EVENT_SETFLAG:
_vm->_anim->setFlag(event->param, event->param2);
Index: script.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/script.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- script.h 28 Dec 2004 03:44:07 -0000 1.36
+++ script.h 28 Dec 2004 04:09:10 -0000 1.37
@@ -331,7 +331,7 @@
int scriptMoveTo(SCRIPTFUNC_PARAMS);
int SF_sceneEq(SCRIPTFUNC_PARAMS);
int SF_dropObject(SCRIPTFUNC_PARAMS);
- int SF_finishBgdAnim(SCRIPTFUNC_PARAMS);
+ int sfFinishBgdAnim(SCRIPTFUNC_PARAMS);
int sfSwapActors(SCRIPTFUNC_PARAMS);
int sfSimulSpeech(SCRIPTFUNC_PARAMS);
int SF_actorWalk(SCRIPTFUNC_PARAMS);
@@ -349,7 +349,7 @@
int SF_placard(SCRIPTFUNC_PARAMS);
int SF_placardOff(SCRIPTFUNC_PARAMS);
int SF_setProtagState(SCRIPTFUNC_PARAMS);
- int SF_resumeBgdAnim(SCRIPTFUNC_PARAMS);
+ int sfResumeBgdAnim(SCRIPTFUNC_PARAMS);
int SF_throwActor(SCRIPTFUNC_PARAMS);
int SF_waitWalk(SCRIPTFUNC_PARAMS);
int SF_sceneID(SCRIPTFUNC_PARAMS);
Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- sfuncs.cpp 28 Dec 2004 03:44:07 -0000 1.54
+++ sfuncs.cpp 28 Dec 2004 04:09:10 -0000 1.55
@@ -78,7 +78,7 @@
OPCODE(scriptMoveTo),
OPCODE(SF_sceneEq),
OPCODE(SF_dropObject),
- OPCODE(SF_finishBgdAnim),
+ OPCODE(sfFinishBgdAnim),
OPCODE(sfSwapActors),
OPCODE(sfSimulSpeech),
OPCODE(SF_actorWalk),
@@ -96,7 +96,7 @@
OPCODE(SF_placard),
OPCODE(SF_placardOff),
OPCODE(SF_setProtagState),
- OPCODE(SF_resumeBgdAnim),
+ OPCODE(sfResumeBgdAnim),
OPCODE(SF_throwActor),
OPCODE(SF_waitWalk),
OPCODE(SF_sceneID),
@@ -264,7 +264,7 @@
// Script function #10 (0x0A)
int Script::sfStopBgdAnim(SCRIPTFUNC_PARAMS) {
- ScriptDataWord animId = thread->pop();
+ ScriptDataWord animId = getSWord(thread->pop());
_vm->_anim->stop(animId);
@@ -578,10 +578,12 @@
}
// Script function #33 (0x21)
-int Script::SF_finishBgdAnim(SCRIPTFUNC_PARAMS) {
- ScriptDataWord param = thread->pop();
+int Script::sfFinishBgdAnim(SCRIPTFUNC_PARAMS) {
+ ScriptDataWord animId = getSWord(thread->pop());
- debug(1, "stub: SF_finishBgdAnim(%d)", param);
+ _vm->_anim->finish(animId);
+
+ debug(1, "sfFinishBgdAnim(%d)", animId);
return SUCCESS;
}
@@ -926,11 +928,13 @@
}
// Script function #51 (0x33)
-int Script::SF_resumeBgdAnim(SCRIPTFUNC_PARAMS) {
- for (int i = 0; i < nArgs; i++)
- thread->pop();
+int Script::sfResumeBgdAnim(SCRIPTFUNC_PARAMS) {
+ int animId = getSWord(thread->pop());
+ int cycles = getSWord(thread->pop());
+
+ _vm->_anim->resume(animId, cycles);
+ debug(1, "sfResumeBgdAnimSpeed(%d, %d)", animId, cycles);
- debug(1, "stub: SF_resumeBgdAnim(), %d args", nArgs);
return SUCCESS;
}
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga animation.cpp,1.29,1.30 animation.h,1.14,1.15 ihnm_introproc.cpp,1.32,1.33 ite_introproc.cpp,1.35,1.36 saga.h,1.56,1.57 scene.cpp,1.62,1.63 script.h,1.35,1.36 sfuncs.cpp,1.53,1.54
- Next message: [Scummvm-cvs-logs] CVS: residual/dists/msvc8 residual.vcproj,1.3,1.4
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list