aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2015-07-21 22:21:38 +0300
committerEugene Sandulenko2015-12-15 00:05:02 +0100
commite9f161b3aafb971f3682aa8d6a5647283d8239cf (patch)
treeb051e796d306dffc8c2979e62bab00f5b5d315c6 /engines
parentcb4b86cdb8e1a4f42ec87a09863d8e2f9b3a1f1a (diff)
downloadscummvm-rg350-e9f161b3aafb971f3682aa8d6a5647283d8239cf.tar.gz
scummvm-rg350-e9f161b3aafb971f3682aa8d6a5647283d8239cf.tar.bz2
scummvm-rg350-e9f161b3aafb971f3682aa8d6a5647283d8239cf.zip
LAB: Clean up readSound(), readMusic() and longDrawMessage()
Diffstat (limited to 'engines')
-rw-r--r--engines/lab/diff.h2
-rw-r--r--engines/lab/graphics.cpp20
-rw-r--r--engines/lab/intro.cpp3
-rw-r--r--engines/lab/labfun.h12
-rw-r--r--engines/lab/readdiff.cpp16
5 files changed, 22 insertions, 31 deletions
diff --git a/engines/lab/diff.h b/engines/lab/diff.h
index b5c84d3a93..614148e0de 100644
--- a/engines/lab/diff.h
+++ b/engines/lab/diff.h
@@ -74,7 +74,7 @@ void blackAllScreen();
void whiteScreen();
bool readDiff(bool playonce);
void diffNextFrame();
-void readSound();
+void readSound(bool waitTillFinished);
void stopDiff();
void stopDiffEnd();
void stopSound();
diff --git a/engines/lab/graphics.cpp b/engines/lab/graphics.cpp
index e2a221f7f4..049053f470 100644
--- a/engines/lab/graphics.cpp
+++ b/engines/lab/graphics.cpp
@@ -97,17 +97,13 @@ bool readPict(const char *filename, bool PlayOnce) {
/*****************************************************************************/
/* Reads in a music file. Ignores any graphics. */
/*****************************************************************************/
-bool readMusic(const char *filename) {
- byte **file = NULL;
-
- file = g_music->newOpen(filename);
-
- if (file == NULL) {
+bool readMusic(const char *filename, bool waitTillFinished) {
+ byte **file = g_music->newOpen(filename);
+ if (!file)
return false;
- }
DoBlack = false;
- readSound();
+ readSound(waitTillFinished);
return true;
}
@@ -346,14 +342,13 @@ void createBox(uint16 y2) {
-int32 longcharsdrawn = 0L;
bool LastMessageLong = false;
-void longDrawMessage(const char *str) {
+int32 longDrawMessage(const char *str) {
char NewText[512];
if (str == NULL)
- return;
+ return 0;
attachGadgetList(NULL);
mouseHide();
@@ -366,8 +361,9 @@ void longDrawMessage(const char *str) {
}
createBox(198);
- longcharsdrawn = flowText(MsgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str);
mouseShow();
+
+ return flowText(MsgFont, 0, 1, 7, false, true, true, true, VGAScaleX(6), VGAScaleY(155), VGAScaleX(313), VGAScaleY(195), str);
}
diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp
index 16a54ff53f..5d5f6048ec 100644
--- a/engines/lab/intro.cpp
+++ b/engines/lab/intro.cpp
@@ -124,8 +124,7 @@ static void doPictText(const char *Filename, bool isscreen) {
Drawn = flowText(msgfont, (!IsHiRes) * -1, 5, 7, false, false, true, true, VGAScaleX(14), VGAScaleY(11), VGAScaleX(306), VGAScaleY(189), (char *)curplace);
fade(true, 0);
} else {
- longDrawMessage((char *)curplace);
- Drawn = longcharsdrawn;
+ Drawn = longDrawMessage((char *)curplace);
}
curplace += Drawn;
diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h
index 9655c24691..1db04a8c09 100644
--- a/engines/lab/labfun.h
+++ b/engines/lab/labfun.h
@@ -70,7 +70,7 @@ struct SaveGameHeader {
/* Reads in pictures */
bool readPict(const char *filename, bool PlayOnce);
-bool readMusic(const char *filename);
+bool readMusic(const char *filename, bool waitTillFinished);
byte *readPictToMem(const char *filename, uint16 x, uint16 y);
/* Window text stuff */
@@ -98,7 +98,7 @@ uint32 flowTextToMem(Image *DestIm, void *font, /* the TextAttr pointer */
uint16 y1, uint16 x2, uint16 y2, const char *text); /* The text itself */
void drawMessage(const char *text);
-void longDrawMessage(const char *text);
+int32 longDrawMessage(const char *text);
bool readFont(char *filename, void *font, void *data);
/* The Wipes */
@@ -176,17 +176,16 @@ public:
byte **newOpen(const char *name, uint32 &size);
bool initMusic();
void freeMusic();
- void fillUpMusic(bool doit);
void updateMusic();
uint16 getPlayingBufferCount();
- void checkMusic();
void closeMusic();
void setMusic(bool on);
void resumeBackMusic();
void pauseBackMusic();
void changeMusic(const char *newmusic);
+ void checkRoomMusic();
void resetMusic();
-
+ void setMusicReset(bool reset) { _doReset = reset; }
void playSoundEffect(uint16 SampleSpeed, uint32 Length, void *Data);
void stopSoundEffect();
bool isSoundEffectActive() const;
@@ -194,6 +193,9 @@ public:
bool _winmusic, _doNotFilestopSoundEffect;
bool _musicOn;
bool _loopSoundEffect;
+ bool _waitTillFinished;
+ uint16 _lastMusicRoom ;
+ bool _doReset;
private:
void fillbuffer(byte *musicBuffer);
diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp
index f2a39b41aa..ebf3d0793f 100644
--- a/engines/lab/readdiff.cpp
+++ b/engines/lab/readdiff.cpp
@@ -158,7 +158,7 @@ void diffNextFrame() {
if (CurBit >= numchunks) {
mouseShow();
- if (!NoFlip && !IsBM) {
+ if (!IsBM) {
if (headerdata.fps) {
waitForTime(WaitSec, WaitMicros);
addCurTime(0L, DelayMicros, &WaitSec, &WaitMicros);
@@ -451,14 +451,13 @@ void stopDiffEnd() {
StopPlayingEnd = true;
while (IsPlaying) {
- g_music->checkMusic();
+ g_music->updateMusic();
diffNextFrame();
}
}
}
-
/*****************************************************************************/
/* Stops the continuous sound from playing. */
/*****************************************************************************/
@@ -466,8 +465,6 @@ void stopSound() {
stopsound = true;
}
-
-
/*****************************************************************************/
/* Reads in a DIFF file. */
/*****************************************************************************/
@@ -478,16 +475,13 @@ bool readDiff(bool playonce) {
}
-
static byte *mstart;
-void readSound() {
+void readSound(bool waitTillFinished) {
uint32 header_ = 0, size_;
uint16 samplespeed_;
-// uint16 numchunks = 1;
char temp_[5];
-// bool FirstThru = true;
byte *storagefordifffile_, **difffile_ = &storagefordifffile_;
mstart = *startoffile; /* Make a copy of the pointer to the start of the file */
@@ -526,7 +520,7 @@ void readSound() {
swapULong(&size_);
if ((header_ == 30) || (header_ == 31)) {
- if (mwaitForEffect) {
+ if (waitTillFinished) {
while (g_music->isSoundEffectActive()) {
g_music->updateMusic();
waitTOF();
@@ -547,7 +541,7 @@ void readSound() {
g_music->playSoundEffect(samplespeed_, musicsize, music);
} else if (header_ == 65535L) {
- if (mwaitForEffect) {
+ if (waitTillFinished) {
while (g_music->isSoundEffectActive()) {
g_music->updateMusic();
waitTOF();