Fixed a few things in the IHNM intro. Most noticeably I've added an event

for starting animations, which I use to prevent the first animation frame
from being drawn too early.

svn-id: r16407
This commit is contained in:
Torbjörn Andersson 2005-01-02 14:36:00 +00:00
parent 9678589779
commit 1bc636aaa6
3 changed files with 56 additions and 14 deletions

View File

@ -326,6 +326,9 @@ int Events::handleOneShot(EVENT *event) {
break; break;
case ANIM_EVENT: case ANIM_EVENT:
switch (event->op) { switch (event->op) {
case EVENT_PLAY:
_vm->_anim->play(event->param, event->time, true);
break;
case EVENT_FRAME: case EVENT_FRAME:
_vm->_anim->play(event->param, event->time, false); _vm->_anim->play(event->param, event->time, false);
break; break;

View File

@ -64,9 +64,10 @@ enum EVENT_OPS {
// BG events // BG events
EVENT_DISPLAY = 1, EVENT_DISPLAY = 1,
// ANIM events // ANIM events
EVENT_FRAME = 1, // EVENT_PLAY = 1, // reused
EVENT_SETFLAG = 2, EVENT_FRAME = 2,
EVENT_CLEARFLAG = 3, EVENT_SETFLAG = 3,
EVENT_CLEARFLAG = 4,
// MUISC & SOUND events // MUISC & SOUND events
EVENT_PLAY = 1, EVENT_PLAY = 1,
EVENT_STOP = 2, EVENT_STOP = 2,

View File

@ -124,6 +124,7 @@ int Scene::SC_IHNMIntroMovieProc1(int param, SCENE_INFO *scene_info, void *refCo
int Scene::IHNMIntroMovieProc1(int param, SCENE_INFO *scene_info) { int Scene::IHNMIntroMovieProc1(int param, SCENE_INFO *scene_info) {
EVENT event; EVENT event;
EVENT *q_event;
switch (param) { switch (param) {
case SCENE_BEGIN: case SCENE_BEGIN:
@ -134,7 +135,9 @@ int Scene::IHNMIntroMovieProc1(int param, SCENE_INFO *scene_info) {
event.op = EVENT_DISPLAY; event.op = EVENT_DISPLAY;
event.param = SET_PALETTE; event.param = SET_PALETTE;
event.time = 0; event.time = 0;
_vm->_events->queue(&event);
q_event = _vm->_events->queue(&event);
_vm->_anim->setFrameTime(0, IHNM_INTRO_FRAMETIME); _vm->_anim->setFrameTime(0, IHNM_INTRO_FRAMETIME);
_vm->_anim->setFlag(0, ANIM_ENDSCENE); _vm->_anim->setFlag(0, ANIM_ENDSCENE);
_vm->_anim->play(0, 0); _vm->_anim->play(0, 0);
@ -156,8 +159,8 @@ int Scene::IHNMIntroMovieProc2(int param, SCENE_INFO *scene_info) {
PALENTRY *pal; PALENTRY *pal;
static PALENTRY current_pal[PAL_ENTRIES]; static PALENTRY current_pal[PAL_ENTRIES];
switch (param) {
switch (param) {
case SCENE_BEGIN: case SCENE_BEGIN:
// Fade to black out of the intro CyberDreams logo anim // Fade to black out of the intro CyberDreams logo anim
_vm->_gfx->getCurrentPal(current_pal); _vm->_gfx->getCurrentPal(current_pal);
@ -181,6 +184,24 @@ int Scene::IHNMIntroMovieProc2(int param, SCENE_INFO *scene_info) {
q_event = _vm->_events->chain(q_event, &event); q_event = _vm->_events->chain(q_event, &event);
_vm->_anim->setCycles(0, -1);
// The "Dreamer's Guild" animation has to be started by an
// event, or the first frame will be drawn before the palette
// fades down.
//
// Unlike the original, we keep the logo spinning during the
// palette fades. We don't have to, but I think it looks better
// that way.
event.type = ONESHOT_EVENT;
event.code = ANIM_EVENT;
event.op = EVENT_PLAY;
event.param = 0;
event.time = 0;
q_event = _vm->_events->chain(q_event, &event);
// Fade in from black to the scene background palette // Fade in from black to the scene background palette
_vm->_scene->getBGPal(&pal); _vm->_scene->getBGPal(&pal);
@ -193,14 +214,21 @@ int Scene::IHNMIntroMovieProc2(int param, SCENE_INFO *scene_info) {
q_event = _vm->_events->chain(q_event, &event); q_event = _vm->_events->chain(q_event, &event);
_vm->_anim->setCycles(0, -1); // Fade to black after looping animation for a while
_vm->_anim->play(0, IHNM_PALFADE_TIME * 2); event.type = CONTINUOUS_EVENT;
event.code = PAL_EVENT;
event.op = EVENT_PALTOBLACK;
event.time = IHNM_DGLOGO_TIME;
event.duration = IHNM_PALFADE_TIME;
event.data = pal;
// Queue end of scene after looping animation for a while q_event = _vm->_events->chain(q_event, &event);
// Queue end of scene
event.type = ONESHOT_EVENT; event.type = ONESHOT_EVENT;
event.code = SCENE_EVENT; event.code = SCENE_EVENT;
event.op = EVENT_END; event.op = EVENT_END;
event.time = IHNM_DGLOGO_TIME; event.time = 0;
q_event = _vm->_events->chain(q_event, &event); q_event = _vm->_events->chain(q_event, &event);
break; break;
@ -302,7 +330,17 @@ int Scene::IHNMHateProc(int param, SCENE_INFO *scene_info) {
switch (param) { switch (param) {
case SCENE_BEGIN: case SCENE_BEGIN:
_vm->_anim->setCycles(0, -1); _vm->_anim->setCycles(0, -1);
_vm->_anim->play(0, 0);
// The "hate" animation also needs to be started from an event,
// or the first frame will be drawn too early.
event.type = ONESHOT_EVENT;
event.code = ANIM_EVENT;
event.op = EVENT_PLAY;
event.param = 0;
event.time = 0;
q_event = _vm->_events->queue(&event);
// More music // More music
event.type = ONESHOT_EVENT; event.type = ONESHOT_EVENT;
@ -312,7 +350,7 @@ int Scene::IHNMHateProc(int param, SCENE_INFO *scene_info) {
event.op = EVENT_PLAY; event.op = EVENT_PLAY;
event.time = 0; event.time = 0;
q_event = _vm->_events->queue(&event); q_event = _vm->_events->chain(q_event, &event);
// Background for intro scene is the first frame of the // Background for intro scene is the first frame of the
// intro animation; display it and set the palette // intro animation; display it and set the palette
@ -322,7 +360,7 @@ int Scene::IHNMHateProc(int param, SCENE_INFO *scene_info) {
event.param = SET_PALETTE; event.param = SET_PALETTE;
event.time = 0; event.time = 0;
q_event = _vm->_events->queue(&event); q_event = _vm->_events->chain(q_event, &event);
// Play voice // Play voice
event.type = ONESHOT_EVENT; event.type = ONESHOT_EVENT;
@ -331,7 +369,7 @@ int Scene::IHNMHateProc(int param, SCENE_INFO *scene_info) {
event.param = 0; event.param = 0;
event.time = 0; event.time = 0;
q_event = _vm->_events->queue(&event); q_event = _vm->_events->chain(q_event, &event);
// Background sound // Background sound
event.type = ONESHOT_EVENT; event.type = ONESHOT_EVENT;
@ -342,7 +380,7 @@ int Scene::IHNMHateProc(int param, SCENE_INFO *scene_info) {
event.param3 = SOUND_LOOP; event.param3 = SOUND_LOOP;
event.time = 0; event.time = 0;
q_event = _vm->_events->queue(&event); q_event = _vm->_events->chain(q_event, &event);
// End background sound after the voice has finished // End background sound after the voice has finished
event.type = ONESHOT_EVENT; event.type = ONESHOT_EVENT;