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
This commit is contained in:
Torbjörn Andersson 2003-09-08 17:18:38 +00:00
parent 6455c81989
commit c2070e28fa
3 changed files with 73 additions and 6 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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;