aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2004-08-10 23:04:52 +0000
committerEugene Sandulenko2004-08-10 23:04:52 +0000
commitb13fc9f366d45736c3edd04399d2590aa2fb0cf5 (patch)
tree3e565d7af4fea4032fc69cf9291f5e7afb218a1f
parent9956666a7a3740d2732bb1bb76089eb66051073f (diff)
downloadscummvm-rg350-b13fc9f366d45736c3edd04399d2590aa2fb0cf5.tar.gz
scummvm-rg350-b13fc9f366d45736c3edd04399d2590aa2fb0cf5.tar.bz2
scummvm-rg350-b13fc9f366d45736c3edd04399d2590aa2fb0cf5.zip
Improved intro. Now it correctly shows game title.
svn-id: r14544
-rw-r--r--saga/animation.cpp20
-rw-r--r--saga/animation.h2
-rw-r--r--saga/events.cpp22
-rw-r--r--saga/events.h5
-rw-r--r--saga/ite_introproc.cpp61
-rw-r--r--saga/ite_introproc.h1
-rw-r--r--saga/saga.h5
-rw-r--r--saga/transitions.cpp20
-rw-r--r--saga/xref.txt34
9 files changed, 156 insertions, 14 deletions
diff --git a/saga/animation.cpp b/saga/animation.cpp
index 4c71dede4c..fd59630aa8 100644
--- a/saga/animation.cpp
+++ b/saga/animation.cpp
@@ -193,6 +193,9 @@ int Anim::play(uint16 anim_id, int vector_time) {
return R_FAILURE;
}
+ if (anim->flags & ANIM_PAUSE)
+ return R_SUCCESS;
+
if (anim->play_flag) {
frame = anim->current_frame;
if (GAME_GetGameType() == R_GAMETYPE_ITE) {
@@ -304,6 +307,23 @@ int Anim::setFlag(uint16 anim_id, uint16 flag) {
return R_SUCCESS;
}
+int Anim::clearFlag(uint16 anim_id, uint16 flag) {
+ R_ANIMATION *anim;
+
+ if (anim_id > _anim_count) {
+ return R_FAILURE;
+ }
+
+ anim = _anim_tbl[anim_id];
+ if (anim == NULL) {
+ return R_FAILURE;
+ }
+
+ anim->flags &= ~flag;
+
+ return R_SUCCESS;
+}
+
int Anim::setFrameTime(uint16 anim_id, int time) {
R_ANIMATION *anim;
diff --git a/saga/animation.h b/saga/animation.h
index d96ace971c..52ba1c2937 100644
--- a/saga/animation.h
+++ b/saga/animation.h
@@ -88,6 +88,7 @@ struct R_ANIMATION {
enum ANIM_FLAGS {
ANIM_LOOP = 0x01,
+ ANIM_PAUSE = 0x02,
ANIM_ENDSCENE = 0x80 // When animation ends, dispatch scene end event
};
@@ -101,6 +102,7 @@ public:
int play(uint16 anim_id, int vector_time);
int link(uint16 anim_id1, uint16 anim_id2);
int setFlag(uint16 anim_id, uint16 flag);
+ int clearFlag(uint16 anim_id, uint16 flag);
int setFrameTime(uint16 anim_id, int time);
int reset(void);
void animInfo(int argc, char *argv[]);
diff --git a/saga/events.cpp b/saga/events.cpp
index 515fcc16bc..9b4338c95c 100644
--- a/saga/events.cpp
+++ b/saga/events.cpp
@@ -174,7 +174,21 @@ int Events::handleContinuous(R_EVENT *event) {
_vm->_render->getBufferInfo(&buf_info);
_vm->_scene->getBGInfo(&bg_info);
TRANSITION_Dissolve(buf_info.r_bg_buf, buf_info.r_bg_buf_w, buf_info.r_bg_buf_h,
- buf_info.r_bg_buf_w, bg_info.bg_buf, bg_info.bg_p, 0, event_pc);
+ buf_info.r_bg_buf_w, bg_info.bg_buf, bg_info.bg_w,
+ bg_info.bg_h, bg_info.bg_p, 0, 0, 0, event_pc);
+ break;
+ case EVENT_DISSOLVE_BGMASK:
+ // we dissolve it centered.
+ // set flag of Dissolve to 1. It is a hack to simulate zero masking.
+ int w, h;
+ byte *mask_buf;
+ size_t len;
+
+ _vm->_render->getBufferInfo(&buf_info);
+ _vm->_scene->getBGMaskInfo(&w, &h, &mask_buf, &len);
+ TRANSITION_Dissolve(buf_info.r_bg_buf, buf_info.r_bg_buf_w, buf_info.r_bg_buf_h,
+ buf_info.r_bg_buf_w, mask_buf, w, h, 0, 1, (320 - w) / 2,
+ (200 - h) / 2, event_pc);
break;
default:
break;
@@ -269,6 +283,12 @@ int Events::handleOneShot(R_EVENT *event) {
case EVENT_FRAME:
_vm->_anim->play(event->param, event->time);
break;
+ case EVENT_SETFLAG:
+ _vm->_anim->setFlag(event->param, event->param2);
+ break;
+ case EVENT_CLEARFLAG:
+ _vm->_anim->clearFlag(event->param, event->param2);
+ break;
default:
break;
}
diff --git a/saga/events.h b/saga/events.h
index c2427d6f28..06cc3095fe 100644
--- a/saga/events.h
+++ b/saga/events.h
@@ -60,6 +60,8 @@ enum R_EVENT_OPS {
EVENT_DISPLAY = 1,
// ANIM events
EVENT_FRAME = 1,
+ EVENT_SETFLAG = 2,
+ EVENT_CLEARFLAG = 3,
// MUISC & SOUND events
EVENT_PLAY = 1,
EVENT_STOP = 2,
@@ -82,7 +84,8 @@ enum R_EVENT_OPS {
EVENT_PALTOBLACK = 1,
EVENT_BLACKTOPAL = 2,
// TRANSITION events
- EVENT_DISSOLVE = 1
+ EVENT_DISSOLVE = 1,
+ EVENT_DISSOLVE_BGMASK = 2
};
enum R_EVENT_PARAMS {
diff --git a/saga/ite_introproc.cpp b/saga/ite_introproc.cpp
index 830412f6d1..e9f220cae2 100644
--- a/saga/ite_introproc.cpp
+++ b/saga/ite_introproc.cpp
@@ -124,12 +124,13 @@ static R_INTRO_DIALOGUE IntroDiag[] = {
};
R_SCENE_QUEUE ITE_IntroList[] = {
+ {ITE_VALLEY_SCENE, NULL, BY_RESOURCE, ITE_IntroValleyProc, 0}, // HACK
{ITE_INTRO_ANIM_SCENE, NULL, BY_RESOURCE, ITE_IntroAnimProc, 0},
{ITE_CAVE_SCENE_1, NULL, BY_RESOURCE, ITE_IntroCave1Proc, 1},
{ITE_CAVE_SCENE_2, NULL, BY_RESOURCE, ITE_IntroCave2Proc, 0},
{ITE_CAVE_SCENE_3, NULL, BY_RESOURCE, ITE_IntroCave3Proc, 0},
{ITE_CAVE_SCENE_4, NULL, BY_RESOURCE, ITE_IntroCave4Proc, 0},
- {ITE_VALLEY_SCENE, NULL, BY_RESOURCE, ITE_IntroValleyProc, 0},
+ // {ITE_VALLEY_SCENE, NULL, BY_RESOURCE, ITE_IntroValleyProc, 0},
{ITE_TREEHOUSE_SCENE, NULL, BY_RESOURCE, ITE_IntroTreeHouseProc, 0},
{ITE_FAIREPATH_SCENE, NULL, BY_RESOURCE, ITE_IntroFairePathProc, 0},
{ITE_FAIRETENT_SCENE, NULL, BY_RESOURCE, ITE_IntroFaireTentProc, 0}
@@ -680,12 +681,6 @@ int ITE_IntroValleyProc(int param, R_SCENE_INFO *scene_info) {
q_event = _vm->_events->queue(&event);
- debug(0, "Beginning animation playback.");
-
- // Begin title screen background animation
- _vm->_anim->setFlag(0, ANIM_LOOP);
- _vm->_anim->play(0, 0);
-
// Begin ITE title theme music
_vm->_music->stop();
@@ -696,6 +691,58 @@ int ITE_IntroValleyProc(int param, R_SCENE_INFO *scene_info) {
event.time = 0;
q_event = _vm->_events->chain(q_event, &event);
+
+ // Pause animation before logo
+ event.type = R_ONESHOT_EVENT;
+ event.code = R_ANIM_EVENT;
+ event.op = EVENT_SETFLAG;
+ event.param = 0;
+ event.param2 = ANIM_PAUSE;
+ event.time = 3000;
+
+ q_event = _vm->_events->queue(&event);
+
+ // Display logo
+ event.type = R_CONTINUOUS_EVENT;
+ event.code = R_TRANSITION_EVENT;
+ event.op = EVENT_DISSOLVE_BGMASK;
+ event.time = 3000;
+ event.duration = LOGO_DISSOLVE_DURATION;
+
+ q_event = _vm->_events->queue(&event);
+
+ // Remove logo
+ event.type = R_CONTINUOUS_EVENT;
+ event.code = R_TRANSITION_EVENT;
+ event.op = EVENT_DISSOLVE;
+ event.time = 6000;
+ event.duration = LOGO_DISSOLVE_DURATION;
+
+ q_event = _vm->_events->queue(&event);
+
+ // Unpause animation before logo
+ event.type = R_ONESHOT_EVENT;
+ event.code = R_ANIM_EVENT;
+ event.op = EVENT_CLEARFLAG;
+ event.param = 0;
+ event.param2 = ANIM_PAUSE;
+ event.time = 6000 + LOGO_DISSOLVE_DURATION;
+
+ q_event = _vm->_events->queue(&event);
+
+ event.type = R_ONESHOT_EVENT;
+ event.code = R_ANIM_EVENT;
+ event.op = EVENT_FRAME;
+ event.param = 0;
+ event.time = 6000 + LOGO_DISSOLVE_DURATION;
+
+ q_event = _vm->_events->queue(&event);
+
+ debug(0, "Beginning animation playback.");
+
+ // Begin title screen background animation
+ _vm->_anim->setFlag(0, ANIM_LOOP);
+ _vm->_anim->play(0, 0);
// Queue game credits list
text_entry.color = 255;
diff --git a/saga/ite_introproc.h b/saga/ite_introproc.h
index d919d91ced..b9e9c93bc7 100644
--- a/saga/ite_introproc.h
+++ b/saga/ite_introproc.h
@@ -38,6 +38,7 @@ namespace Saga {
#define PALETTE_FADE_DURATION 1000
#define DISSOLVE_DURATION 3000
+#define LOGO_DISSOLVE_DURATION 1000
#define CREDIT_DURATION1 4000
diff --git a/saga/saga.h b/saga/saga.h
index e1d72f77b7..35c33ca637 100644
--- a/saga/saga.h
+++ b/saga/saga.h
@@ -80,8 +80,9 @@ enum SAGAGameId {
GID_IHNM
};
-int TRANSITION_Dissolve(byte *dst_img, int dst_w, int dst_h,
- int dst_p, const byte *src_img, int src_p, int flags, double percent);
+int TRANSITION_Dissolve(byte *dst_img, int dst_w, int dst_h, int dst_p, const byte *src_img,
+ int src_w, int src_h, int src_p, int flags, int x, int y,
+ double percent);
int SYSINPUT_ProcessInput(void);
R_POINT SYSINPUT_GetMousePos();
diff --git a/saga/transitions.cpp b/saga/transitions.cpp
index 93daa18282..c366e1289d 100644
--- a/saga/transitions.cpp
+++ b/saga/transitions.cpp
@@ -26,13 +26,20 @@
namespace Saga {
+/*! @brief dissolve one image with another
+
+ @param flag if set to 1, do zero masking
+*/
int TRANSITION_Dissolve(byte *dst_img, int dst_w, int dst_h, int dst_p, const byte *src_img,
- int src_p, int flags, double percent) {
+ int src_w, int src_h, int src_p, int flags, int x, int y,
+ double percent) {
#define XOR_MASK 0xB400;
int pixelcount = dst_w * dst_h;
int seqlimit = (int)(65535 * percent);
int seq = 1;
- int i;
+ int i, x1, y1;
+ Common::Rect clip(x, y, x+src_w, y+src_h);
+ byte color;
for (i = 0; i < seqlimit; i++) {
if (seq & 1) {
@@ -48,7 +55,14 @@ int TRANSITION_Dissolve(byte *dst_img, int dst_w, int dst_h, int dst_p, const by
if (seq >= pixelcount) {
continue;
} else {
- dst_img[seq] = src_img[seq];
+ x1 = seq % dst_w;
+ y1 = seq / dst_w;
+
+ if (clip.contains(x1, y1)) {
+ color = src_img[(x1-x)+src_w*(y1-y)];
+ if (flags == 0 || color)
+ dst_img[seq] = color;
+ }
}
}
diff --git a/saga/xref.txt b/saga/xref.txt
index 2e02774a5f..be00667c3e 100644
--- a/saga/xref.txt
+++ b/saga/xref.txt
@@ -4,3 +4,37 @@ Cross-reference for functions and variables for the original source code and
the ScummVM implementation.
+Sceneres.h
+==========
+ LOADREQ_FIGURE
+ LOADREQ_OBJECT
+ LOADREQ_BACKGROUND SAGA_BG_IMAGE
+ LOADREQ_ZBUF SAGA_BG_MASK
+ LOADREQ_SCENE_SCRIPT
+ LOADREQ_STRINGS SAGA_OBJECT_NAME_LIST
+ LOADREQ_HITZONES SAGA_OBJECT_MAP
+ LOADREQ_STEPZONES SAGA_ACTION_MAP
+ LOADREQ_TILE_IMAGES SAGA_ISO_TILESET
+ LOADREQ_TILE_MAP SAGA_ISO_METAMAP
+ LOADREQ_TILE_PLATFORMS SAGA_ISO_METATILESET
+ LOADREQ_TILE_METATILES
+ LOADREQ_ENTRY
+ LOADREQ_FRAMELIST
+
+ LOADREQ_ANIM_0 SAGA_ANIM_1
+ LOADREQ_ANIM_1 SAGA_ANIM_2
+ LOADREQ_ANIM_2 SAGA_ANIM_3
+ LOADREQ_ANIM_3 SAGA_ANIM_4
+ LOADREQ_ANIM_4 SAGA_ANIM_5
+ LOADREQ_ANIM_5 SAGA_ANIM_6
+ LOADREQ_ANIM_6 SAGA_ANIM_7
+ LOADREQ_ANIM_7
+
+ LOADREQ_TILE_MULTI
+ LOADREQ_CYCLES SAGA_PAL_ANIM
+ LOADREQ_FACES
+ LOADREQ_PALETTE
+
+Scene.c
+=======
+ ResToImage() _vm->decodeBGImage()