aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/lab/anim.cpp57
-rw-r--r--engines/lab/anim.h7
-rw-r--r--engines/lab/readdiff.cpp86
3 files changed, 57 insertions, 93 deletions
diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp
index 44d9eea5e8..689f9038e3 100644
--- a/engines/lab/anim.cpp
+++ b/engines/lab/anim.cpp
@@ -33,7 +33,6 @@
namespace Lab {
-extern uint16 _dataBytesPerRow;
extern BitMap *DrawBitMap;
extern byte **startoffile;
extern BitMap *DispBitMap;
@@ -75,7 +74,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) {
diffwidth = 0;
diffheight = 0;
stopsound = false;
-
+ _dataBytesPerRow = 0;
for (int i = 0; i < 3 * 256; i++)
diffcmap[i] = 0;
@@ -88,7 +87,7 @@ Anim::Anim(LabEngine *vm) : _vm(vm) {
/* Undiffs a piece of memory when header size is a byte, and copy/skip size */
/* is also a byte. */
/*****************************************************************************/
-static void unDIFFByteByte(byte *dest, byte *diff) {
+void Anim::unDIFFByteByte(byte *dest, byte *diff) {
uint16 skip, copy;
while (1) {
@@ -118,7 +117,7 @@ static void unDIFFByteByte(byte *dest, byte *diff) {
/* Undiffs a piece of memory when header size is a byte, and copy/skip size */
/* is a word. */
/*****************************************************************************/
-static void unDIFFByteWord(uint16 *dest, uint16 *diff) {
+void Anim::unDIFFByteWord(uint16 *dest, uint16 *diff) {
uint16 skip, copy;
while (1) {
@@ -193,7 +192,7 @@ bool Anim::unDIFFMemory(byte *dest, byte *diff, uint16 headerSize, uint16 copySi
/* Undiffs a piece of memory when header size is a byte, and copy/skip size */
/* is a byte. */
/*****************************************************************************/
-static void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) {
+void Anim::VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) {
byte *CurPtr;
uint16 skip, copy;
uint16 counter = 0;
@@ -231,7 +230,7 @@ static void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow) {
/* Undiffs a piece of memory when header size is a byte, and copy/skip size */
/* is a word. */
/*****************************************************************************/
-static void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) {
+void Anim::VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) {
uint16 *CurPtr;
uint16 skip, copy;
uint16 counter = 0, wordsperrow;
@@ -272,7 +271,7 @@ static void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow) {
/* Undiffs a piece of memory when header size is a byte, and copy/skip size */
/* is a long. */
/*****************************************************************************/
-static void VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) {
+void Anim::VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow) {
uint32 *CurPtr;
uint16 skip, copy;
uint16 counter = 0, longsperrow;
@@ -725,4 +724,48 @@ bool Anim::readDiff(bool playonce) {
return true;
}
+void Anim::readSound(bool waitTillFinished, Common::File *file) {
+ uint32 magicBytes = file->readUint32LE();
+ if (magicBytes != 1219009121L)
+ return;
+
+ uint32 soundTag = file->readUint32LE();
+ uint32 soundSize = file->readUint32LE();
+
+ if (soundTag == 0)
+ file->skip(soundSize); // skip the header
+ else
+ return;
+
+ while (soundTag != 65535) {
+ g_lab->_music->updateMusic();
+ soundTag = file->readUint32LE();
+ soundSize = file->readUint32LE() - 8;
+
+ if ((soundTag == 30) || (soundTag == 31)) {
+ if (waitTillFinished) {
+ while (g_lab->_music->isSoundEffectActive()) {
+ g_lab->_music->updateMusic();
+ g_lab->waitTOF();
+ }
+ }
+
+ file->skip(4);
+
+ uint16 sampleRate = file->readUint16LE();
+ file->skip(2);
+ byte *soundData = (byte *)malloc(soundSize);
+ file->read(soundData, soundSize);
+ g_lab->_music->playSoundEffect(sampleRate, soundSize, soundData);
+ } else if (soundTag == 65535L) {
+ if (waitTillFinished) {
+ while (g_lab->_music->isSoundEffectActive()) {
+ g_lab->_music->updateMusic();
+ g_lab->waitTOF();
+ }
+ }
+ } else
+ file->skip(soundSize);
+ }
+}
} // End of namespace Lab
diff --git a/engines/lab/anim.h b/engines/lab/anim.h
index 0472a72d7f..62c7e39a83 100644
--- a/engines/lab/anim.h
+++ b/engines/lab/anim.h
@@ -86,6 +86,13 @@ private:
uint32 diffwidth;
uint32 diffheight;
bool stopsound;
+ uint16 _dataBytesPerRow;
+
+ void unDIFFByteByte(byte *dest, byte *diff);
+ void unDIFFByteWord(uint16 *dest, uint16 *diff);
+ void VUnDIFFByteByte(byte *Dest, byte *diff, uint16 bytesperrow);
+ void VUnDIFFByteWord(uint16 *Dest, uint16 *diff, uint16 bytesperrow);
+ void VUnDIFFByteLong(uint32 *Dest, uint32 *diff, uint16 bytesperrow);
public:
Anim(LabEngine *vm);
diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp
deleted file mode 100644
index 43309ffd78..0000000000
--- a/engines/lab/readdiff.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-/*
- * This code is based on Labyrinth of Time code with assistance of
- *
- * Copyright (c) 1993 Terra Nova Development
- * Copyright (c) 2004 The Wyrmkeep Entertainment Co.
- *
- */
-
-#include "lab/lab.h"
-#include "lab/anim.h"
-#include "lab/labfun.h"
-#include "lab/mouse.h"
-
-namespace Lab {
-static byte temp[5];
-
-uint16 _dataBytesPerRow;
-
-void Anim::readSound(bool waitTillFinished, Common::File *file) {
- uint32 magicBytes = file->readUint32LE();
- if (magicBytes != 1219009121L)
- return;
-
- uint32 soundTag = file->readUint32LE();
- uint32 soundSize = file->readUint32LE();
-
- if (soundTag == 0)
- file->skip(soundSize); // skip the header
- else
- return;
-
- while (soundTag != 65535) {
- g_lab->_music->updateMusic();
- soundTag = file->readUint32LE();
- soundSize = file->readUint32LE() - 8;
-
- if ((soundTag == 30) || (soundTag == 31)) {
- if (waitTillFinished) {
- while (g_lab->_music->isSoundEffectActive()) {
- g_lab->_music->updateMusic();
- g_lab->waitTOF();
- }
- }
-
- file->skip(4);
-
- uint16 sampleRate = file->readUint16LE();
- file->skip(2);
- byte *soundData = (byte *)malloc(soundSize);
- file->read(soundData, soundSize);
- g_lab->_music->playSoundEffect(sampleRate, soundSize, soundData);
- } else if (soundTag == 65535L) {
- if (waitTillFinished) {
- while (g_lab->_music->isSoundEffectActive()) {
- g_lab->_music->updateMusic();
- g_lab->waitTOF();
- }
- }
- } else
- file->skip(soundSize);
- }
-}
-
-} // End of namespace Lab