From 1bc636aaa676839c6e8fe2d8cc1405f2c3b2393c Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 2 Jan 2005 14:36:00 +0000 Subject: 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 --- saga/events.cpp | 3 +++ saga/events.h | 7 +++--- saga/ihnm_introproc.cpp | 60 ++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 56 insertions(+), 14 deletions(-) diff --git a/saga/events.cpp b/saga/events.cpp index 83ca2961b2..a9643fc98c 100644 --- a/saga/events.cpp +++ b/saga/events.cpp @@ -326,6 +326,9 @@ int Events::handleOneShot(EVENT *event) { break; case ANIM_EVENT: switch (event->op) { + case EVENT_PLAY: + _vm->_anim->play(event->param, event->time, true); + break; case EVENT_FRAME: _vm->_anim->play(event->param, event->time, false); break; diff --git a/saga/events.h b/saga/events.h index cd502f153b..0ef5ce0782 100644 --- a/saga/events.h +++ b/saga/events.h @@ -64,9 +64,10 @@ enum EVENT_OPS { // BG events EVENT_DISPLAY = 1, // ANIM events - EVENT_FRAME = 1, - EVENT_SETFLAG = 2, - EVENT_CLEARFLAG = 3, + // EVENT_PLAY = 1, // reused + EVENT_FRAME = 2, + EVENT_SETFLAG = 3, + EVENT_CLEARFLAG = 4, // MUISC & SOUND events EVENT_PLAY = 1, EVENT_STOP = 2, diff --git a/saga/ihnm_introproc.cpp b/saga/ihnm_introproc.cpp index e09c7e569e..c14dd174ce 100644 --- a/saga/ihnm_introproc.cpp +++ b/saga/ihnm_introproc.cpp @@ -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) { EVENT event; + EVENT *q_event; switch (param) { case SCENE_BEGIN: @@ -134,7 +135,9 @@ int Scene::IHNMIntroMovieProc1(int param, SCENE_INFO *scene_info) { event.op = EVENT_DISPLAY; event.param = SET_PALETTE; event.time = 0; - _vm->_events->queue(&event); + + q_event = _vm->_events->queue(&event); + _vm->_anim->setFrameTime(0, IHNM_INTRO_FRAMETIME); _vm->_anim->setFlag(0, ANIM_ENDSCENE); _vm->_anim->play(0, 0); @@ -156,8 +159,8 @@ int Scene::IHNMIntroMovieProc2(int param, SCENE_INFO *scene_info) { PALENTRY *pal; static PALENTRY current_pal[PAL_ENTRIES]; - switch (param) { + switch (param) { case SCENE_BEGIN: // Fade to black out of the intro CyberDreams logo anim _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); + _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 _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); - _vm->_anim->setCycles(0, -1); - _vm->_anim->play(0, IHNM_PALFADE_TIME * 2); + // Fade to black after looping animation for a while + 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; + + q_event = _vm->_events->chain(q_event, &event); - // Queue end of scene after looping animation for a while + // Queue end of scene event.type = ONESHOT_EVENT; event.code = SCENE_EVENT; event.op = EVENT_END; - event.time = IHNM_DGLOGO_TIME; + event.time = 0; q_event = _vm->_events->chain(q_event, &event); break; @@ -302,7 +330,17 @@ int Scene::IHNMHateProc(int param, SCENE_INFO *scene_info) { switch (param) { case SCENE_BEGIN: _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 event.type = ONESHOT_EVENT; @@ -312,7 +350,7 @@ int Scene::IHNMHateProc(int param, SCENE_INFO *scene_info) { event.op = EVENT_PLAY; 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 // 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.time = 0; - q_event = _vm->_events->queue(&event); + q_event = _vm->_events->chain(q_event, &event); // Play voice event.type = ONESHOT_EVENT; @@ -331,7 +369,7 @@ int Scene::IHNMHateProc(int param, SCENE_INFO *scene_info) { event.param = 0; event.time = 0; - q_event = _vm->_events->queue(&event); + q_event = _vm->_events->chain(q_event, &event); // Background sound event.type = ONESHOT_EVENT; @@ -342,7 +380,7 @@ int Scene::IHNMHateProc(int param, SCENE_INFO *scene_info) { event.param3 = SOUND_LOOP; 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 event.type = ONESHOT_EVENT; -- cgit v1.2.3