aboutsummaryrefslogtreecommitdiff
path: root/sword2/driver
diff options
context:
space:
mode:
Diffstat (limited to 'sword2/driver')
-rw-r--r--sword2/driver/d_draw.cpp67
-rw-r--r--sword2/driver/sprite.cpp10
2 files changed, 72 insertions, 5 deletions
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;