aboutsummaryrefslogtreecommitdiff
path: root/sword2/driver
diff options
context:
space:
mode:
authorTorbjörn Andersson2003-10-05 15:28:15 +0000
committerTorbjörn Andersson2003-10-05 15:28:15 +0000
commit7174a32c8e877627c51da50b657083873aeef1e6 (patch)
tree09bc861d2ea952121279117bd1bb3b842d79ac1c /sword2/driver
parent2e27e74fb42847c781e61f8acf29f6658a34f292 (diff)
downloadscummvm-rg350-7174a32c8e877627c51da50b657083873aeef1e6.tar.gz
scummvm-rg350-7174a32c8e877627c51da50b657083873aeef1e6.tar.bz2
scummvm-rg350-7174a32c8e877627c51da50b657083873aeef1e6.zip
Made a separate class for the cutscene functions, removed some unused code
and made some other minor cleanups. svn-id: r10614
Diffstat (limited to 'sword2/driver')
-rw-r--r--sword2/driver/d_draw.cpp78
-rw-r--r--sword2/driver/d_draw.h12
-rw-r--r--sword2/driver/driver96.h1
-rw-r--r--sword2/driver/render.cpp14
4 files changed, 26 insertions, 79 deletions
diff --git a/sword2/driver/d_draw.cpp b/sword2/driver/d_draw.cpp
index cba4bb1e6d..2cf7959db4 100644
--- a/sword2/driver/d_draw.cpp
+++ b/sword2/driver/d_draw.cpp
@@ -43,47 +43,6 @@ int16 scrolly;
int32 renderCaps = 0;
-int32 PlotDots(int16 x, int16 y, int16 count) {
-
- warning("stub PlotDots( %d, %d, %d )", x, y, count);
-/*
- int16 i;
- uint8 *dst;
-
- DDSURFACEDESC ddDescription;
- HRESULT hr;
-
- ddDescription.dwSize = sizeof(ddDescription);
-
- hr = IDirectDrawSurface2_Lock(lpBackBuffer, NULL, &ddDescription, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
- if (hr != DD_OK)
- {
- hr = IDirectDrawSurface2_Lock(lpBackBuffer, NULL, &ddDescription, DDLOCK_SURFACEMEMORYPTR | DDLOCK_WAIT, NULL);
- }
-
- if (hr == DD_OK)
- {
-
- dst = (uint8 *) ddDescription.lpSurface + y * ddDescription.lPitch + x;
-
- for (i=0; i<=count; i++)
- {
- *dst = 184;
- dst += 2;
- }
- dst = (uint8 *) ddDescription.lpSurface + (y+1) * ddDescription.lPitch + x;
- for (i=0; i<=count/10; i++)
- {
- *dst = 184;
- dst += 20;
- }
- IDirectDrawSurface2_Unlock(lpBackBuffer, ddDescription.lpSurface);
- }
-*/
-
- return RD_OK;
-}
-
/**
* Initialise the display with the sizes passed in.
* @return RD_OK, or an error code if the display cannot be set up.
@@ -168,30 +127,21 @@ int32 EraseBackBuffer( void ) {
return RD_OK;
}
-
-int32 NextSmackerFrame(void) {
- warning("stub NextSmackerFrame");
- return RD_OK;
-}
-
-
-static uint8 *textSurface = NULL;
-
-void OpenTextObject(_movieTextObject *obj) {
+void MoviePlayer::openTextObject(_movieTextObject *obj) {
if (obj->textSprite)
- CreateSurface(obj->textSprite, &textSurface);
+ CreateSurface(obj->textSprite, &_textSurface);
}
-void CloseTextObject(_movieTextObject *obj) {
- if (textSurface) {
- DeleteSurface(textSurface);
- textSurface = 0;
+void MoviePlayer::closeTextObject(_movieTextObject *obj) {
+ if (_textSurface) {
+ DeleteSurface(_textSurface);
+ _textSurface = NULL;
}
}
-void DrawTextObject(_movieTextObject *obj) {
- if (obj->textSprite && textSurface)
- DrawSurface(obj->textSprite, textSurface);
+void MoviePlayer::drawTextObject(_movieTextObject *obj) {
+ if (obj->textSprite && _textSurface)
+ DrawSurface(obj->textSprite, _textSurface);
}
/**
@@ -201,7 +151,7 @@ void DrawTextObject(_movieTextObject *obj) {
* @param musicOut lead-out music
*/
-int32 PlaySmacker(char *filename, _movieTextObject *text[], uint8 *musicOut) {
+int32 MoviePlayer::play(char *filename, _movieTextObject *text[], uint8 *musicOut) {
warning("semi-stub PlaySmacker %s", filename);
// WORKAROUND: For now, we just do the voice-over parts of the
@@ -268,15 +218,15 @@ int32 PlaySmacker(char *filename, _movieTextObject *text[], uint8 *musicOut) {
if (frameCounter == text[textCounter]->startFrame) {
EraseBackBuffer();
- OpenTextObject(text[textCounter]);
- DrawTextObject(text[textCounter]);
+ openTextObject(text[textCounter]);
+ drawTextObject(text[textCounter]);
if (text[textCounter]->speech) {
g_sword2->_mixer->playRaw(&handle, text[textCounter]->speech, text[textCounter]->speechBufferSize, 22050, SoundMixer::FLAG_16BITS);
}
}
if (frameCounter == text[textCounter]->endFrame) {
- CloseTextObject(text[textCounter]);
+ closeTextObject(text[textCounter]);
EraseBackBuffer();
textCounter++;
}
@@ -300,7 +250,7 @@ int32 PlaySmacker(char *filename, _movieTextObject *text[], uint8 *musicOut) {
g_system->delay_msecs(90);
}
- CloseTextObject(text[textCounter]);
+ closeTextObject(text[textCounter]);
EraseBackBuffer();
SetNeedRedraw();
diff --git a/sword2/driver/d_draw.h b/sword2/driver/d_draw.h
index 7c24266677..a169b922e2 100644
--- a/sword2/driver/d_draw.h
+++ b/sword2/driver/d_draw.h
@@ -26,6 +26,18 @@ namespace Sword2 {
extern byte *lpBackBuffer;
+class MoviePlayer {
+private:
+ uint8 *_textSurface;
+ void openTextObject(_movieTextObject *obj);
+ void closeTextObject(_movieTextObject *obj);
+ void drawTextObject(_movieTextObject *obj);
+
+public:
+ MoviePlayer() : _textSurface(NULL) {}
+ int32 play(char *filename, _movieTextObject *text[], uint8 *musicOut);
+};
+
} // End of namespace Sword2
#endif
diff --git a/sword2/driver/driver96.h b/sword2/driver/driver96.h
index 13bbdcbbb1..f27adae736 100644
--- a/sword2/driver/driver96.h
+++ b/sword2/driver/driver96.h
@@ -361,7 +361,6 @@ extern int32 PlotPoint(uint16 x, uint16 y, uint8 colour);
extern int32 DrawLine(int16 x1, int16 y1, int16 x2, int16 y2, uint8 colour);
extern int32 InitialiseBackgroundLayer(_parallax *p);
extern int32 CloseBackgroundLayer(void);
-extern int32 PlotDots(int16 x, int16 y, int16 count);
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
diff --git a/sword2/driver/render.cpp b/sword2/driver/render.cpp
index 36b36b0c47..ffae9d5518 100644
--- a/sword2/driver/render.cpp
+++ b/sword2/driver/render.cpp
@@ -782,20 +782,6 @@ int32 StartRenderCycle(void) {
return RD_OK;
}
-// FIXME: Move this to some better place?
-
-void sleepUntil(int32 time) {
- while ((int32) SVM_timeGetTime() < time) {
- g_sword2->parseEvents();
-
- // Make sure menu animations and fades don't suffer
- ProcessMenu();
- ServiceWindows();
-
- g_system->delay_msecs(10);
- }
-}
-
/**
* This function should be called at the end of the render cycle.
* @param end the function sets this to true if the render cycle is to be