aboutsummaryrefslogtreecommitdiff
path: root/sword2
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-09-08 17:18:38 +0000
committerTorbjörn Andersson2003-09-08 17:18:38 +0000
commitc2070e28fa7345e8e6fd7f0369a627b49ba47d1b (patch)
tree8f3bc2767b0a54d7cd50dc676e10a475f97554a2 /sword2
parent6455c819896d58782f9ec195e0b716a1df32c296 (diff)
downloadscummvm-rg350-c2070e28fa7345e8e6fd7f0369a627b49ba47d1b.tar.gz
scummvm-rg350-c2070e28fa7345e8e6fd7f0369a627b49ba47d1b.tar.bz2
scummvm-rg350-c2070e28fa7345e8e6fd7f0369a627b49ba47d1b.zip
Added some code to display the subtitles for the Smacker movies, when
available, since they are separate from the Smacker files themselves. Next step will be to play the voice-over sounds as well, and to make sure subtitles settings etc. are taken into account (if they aren't already). svn-id: r10099
Diffstat (limited to 'sword2')
-rw-r--r--sword2/anims.cpp2
-rw-r--r--sword2/driver/d_draw.cpp67
-rw-r--r--sword2/driver/sprite.cpp10
3 files changed, 73 insertions, 6 deletions
diff --git a/sword2/anims.cpp b/sword2/anims.cpp
index 764113c1f8..996ba9fc9d 100644
--- a/sword2/anims.cpp
+++ b/sword2/anims.cpp
@@ -841,7 +841,7 @@ int32 FN_play_sequence(int32 *params) // James(09apr97)
FN_stop_music(NULL); // don't want to carry on streaming game music when smacker starts!
g_sword2->_sound->PauseFxForSequence(); // pause sfx during sequence, except the one used for lead-in music
- if (sequenceTextLines) // if we have some text to accompany this sequence
+ if (sequenceTextLines && g_sword2->_gameId == GID_SWORD2) // if we have some text to accompany this sequence
rv = PlaySmacker(filename, sequenceSpeechArray, leadOut);
else
rv = PlaySmacker(filename, NULL, leadOut);
diff --git a/sword2/driver/d_draw.cpp b/sword2/driver/d_draw.cpp
index d91eacb503..329680a2db 100644
--- a/sword2/driver/d_draw.cpp
+++ b/sword2/driver/d_draw.cpp
@@ -412,7 +412,8 @@ void CloseTextObject(_movieTextObject *obj) {
}
void DrawTextObject(_movieTextObject *obj) {
- warning("stub DrawTextObject");
+ DrawSurface(obj->textSprite, textSurface);
+
/*
HRESULT hr;
RECT rd, rs;
@@ -529,9 +530,69 @@ void DrawTextObject(_movieTextObject *obj) {
extern uint8 musicMuted;
int32 PlaySmacker(char *filename, _movieTextObject *text[], uint8 *musicOut) {
- warning("stub PlaySmacker %s", filename);
- return(RD_OK);
+ warning("semi-stub PlaySmacker %s", filename);
+
+ // WORKAROUND: For now, we just do the voice-over parts of the
+ // movies, since they're separate from the actual smacker files.
+
+ // TODO: Play the voice-over sounds.
+
+ if (text) {
+ uint8 oldPal[1024];
+ uint8 tmpPal[1024];
+
+ EraseBackBuffer();
+
+ // In case the cutscene has a long lead-in, start just before
+ // the first line of text.
+
+ int frameCounter = text[0]->startFrame - 12;
+ int textCounter = 0;
+
+ // Fake a palette that will hopefully make the text visible.
+ // In the opening cutscene it seems to use colours 1 (black)
+ // and 255 (white).
+
+ memcpy(oldPal, palCopy, 1024);
+ memset(tmpPal, 0, 1024);
+ tmpPal[255 * 4 + 0] = 255;
+ tmpPal[255 * 4 + 1] = 255;
+ tmpPal[255 * 4 + 2] = 255;
+ BS2_SetPalette(0, 256, tmpPal, RDPAL_INSTANT);
+
+ while (1) {
+ if (frameCounter == text[textCounter]->startFrame) {
+ EraseBackBuffer();
+ OpenTextObject(text[textCounter]);
+ DrawTextObject(text[textCounter]);
+ }
+ if (frameCounter == text[textCounter]->endFrame) {
+ CloseTextObject(text[textCounter]);
+ EraseBackBuffer();
+ textCounter++;
+
+ if (text[textCounter] == NULL)
+ break;
+ }
+
+ frameCounter++;
+
+ ServiceWindows();
+
+ char key;
+
+ if (ReadKey(&key) == RD_OK && key == 27)
+ break;
+
+ // Simulate ~12 frames per second.
+ g_system->delay_msecs(80);
+ }
+
+ BS2_SetPalette(0, 256, oldPal, RDPAL_INSTANT);
+ }
+
+ return(RD_OK);
}
void GetDrawStatus(_drvDrawStatus *s)
diff --git a/sword2/driver/sprite.cpp b/sword2/driver/sprite.cpp
index 6a2b6364dc..5432937731 100644
--- a/sword2/driver/sprite.cpp
+++ b/sword2/driver/sprite.cpp
@@ -1249,8 +1249,14 @@ void DrawSurface(_spriteInfo *s, uint8 *surface, ScummVM::Rect *clipRect) {
srcPitch = s->w;
- rd.top = rs.top + s->y - scrolly;
- rd.left = rs.left + s->x - scrollx;
+ if (s->type & RDSPR_DISPLAYALIGN) {
+ rd.top = s->y;
+ rd.left = s->x;
+ } else {
+ rd.top = s->y - scrolly;
+ rd.left = s->x - scrollx;
+ }
+
rd.right = rd.left + rs.right;
rd.bottom = rd.top + rs.bottom;