aboutsummaryrefslogtreecommitdiff
path: root/engines/made/pmvplayer.cpp
diff options
context:
space:
mode:
authorTorbjörn Andersson2008-04-20 15:36:40 +0000
committerTorbjörn Andersson2008-04-20 15:36:40 +0000
commit7e07dd5ec720905e09c5aac37a80941c6053e132 (patch)
treec547330503a3d8de2b15c596a406fd11485fd0ae /engines/made/pmvplayer.cpp
parent84a7cd33876eabfcc1fedd0b126f77039647edaf (diff)
downloadscummvm-rg350-7e07dd5ec720905e09c5aac37a80941c6053e132.tar.gz
scummvm-rg350-7e07dd5ec720905e09c5aac37a80941c6053e132.tar.bz2
scummvm-rg350-7e07dd5ec720905e09c5aac37a80941c6053e132.zip
Changed spaces to tabs.
svn-id: r31610
Diffstat (limited to 'engines/made/pmvplayer.cpp')
-rw-r--r--engines/made/pmvplayer.cpp134
1 files changed, 67 insertions, 67 deletions
diff --git a/engines/made/pmvplayer.cpp b/engines/made/pmvplayer.cpp
index 704947132e..bd5252c601 100644
--- a/engines/made/pmvplayer.cpp
+++ b/engines/made/pmvplayer.cpp
@@ -10,19 +10,19 @@ PmvPlayer::~PmvPlayer() {
void PmvPlayer::play(const char *filename) {
- _abort = false;
- _surface = NULL;
+ _abort = false;
+ _surface = NULL;
- _fd = new Common::File();
- _fd->open(filename);
+ _fd = new Common::File();
+ _fd->open(filename);
- uint32 chunkType, chunkSize;
+ uint32 chunkType, chunkSize;
readChunk(chunkType, chunkSize); // "MOVE"
- readChunk(chunkType, chunkSize); // "MHED"
+ readChunk(chunkType, chunkSize); // "MHED"
- // TODO: Evaluate header
- //_fd->skip(0x3A);
+ // TODO: Evaluate header
+ //_fd->skip(0x3A);
uint frameDelay = _fd->readUint16LE();
_fd->skip(10);
@@ -39,26 +39,26 @@ void PmvPlayer::play(const char *filename) {
}
debug(2, "\n");
- _mixer->stopAll();
+ _mixer->stopAll();
- _audioStream = Audio::makeAppendableAudioStream(soundFreq, Audio::Mixer::FLAG_UNSIGNED);
+ _audioStream = Audio::makeAppendableAudioStream(soundFreq, Audio::Mixer::FLAG_UNSIGNED);
_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle, _audioStream);
- // Read palette
- _fd->read(_palette, 768);
- updatePalette();
+ // Read palette
+ _fd->read(_palette, 768);
+ updatePalette();
//FILE *raw = fopen("track.raw", "wb");
- while (!_abort && !_fd->eof()) {
+ while (!_abort && !_fd->eof()) {
- readChunk(chunkType, chunkSize);
+ readChunk(chunkType, chunkSize);
if (_fd->eof())
break;
- byte *frameData = new byte[chunkSize];
- _fd->read(frameData, chunkSize);
+ byte *frameData = new byte[chunkSize];
+ _fd->read(frameData, chunkSize);
byte *audioData = frameData + READ_LE_UINT32(frameData + 8) - 8;
uint16 chunkSize = READ_LE_UINT16(audioData + 4);
@@ -69,84 +69,84 @@ void PmvPlayer::play(const char *filename) {
debug(2, "chunkCount = %d; chunkSize = %d\n", chunkCount, chunkSize);
uint32 soundSize = chunkCount * chunkSize;
- byte *soundData = new byte[soundSize];
- decompressSound(audioData + 8, soundData, chunkSize, chunkCount);
- _audioStream->queueBuffer(soundData, soundSize);
-
- //fwrite(soundData, soundSize, 1, raw);
-
- byte *imageData = frameData + READ_LE_UINT32(frameData + 12) - 8;
-
- uint32 frameNum = READ_LE_UINT32(frameData);
- uint16 width = READ_LE_UINT16(imageData + 8);
- uint16 height = READ_LE_UINT16(imageData + 10);
- uint16 cmdOffs = READ_LE_UINT16(imageData + 12);
- uint16 pixelOffs = READ_LE_UINT16(imageData + 16);
- uint16 maskOffs = READ_LE_UINT16(imageData + 20);
- uint16 lineSize = READ_LE_UINT16(imageData + 24);
-
- debug(2, "width = %d; height = %d; cmdOffs = %04X; pixelOffs = %04X; maskOffs = %04X; lineSize = %d\n",
- width, height, cmdOffs, pixelOffs, maskOffs, lineSize);
-
- if (!_surface) {
- _surface = new Graphics::Surface();
- _surface->create(width, height, 1);
- }
+ byte *soundData = new byte[soundSize];
+ decompressSound(audioData + 8, soundData, chunkSize, chunkCount);
+ _audioStream->queueBuffer(soundData, soundSize);
+
+ //fwrite(soundData, soundSize, 1, raw);
+
+ byte *imageData = frameData + READ_LE_UINT32(frameData + 12) - 8;
+
+ uint32 frameNum = READ_LE_UINT32(frameData);
+ uint16 width = READ_LE_UINT16(imageData + 8);
+ uint16 height = READ_LE_UINT16(imageData + 10);
+ uint16 cmdOffs = READ_LE_UINT16(imageData + 12);
+ uint16 pixelOffs = READ_LE_UINT16(imageData + 16);
+ uint16 maskOffs = READ_LE_UINT16(imageData + 20);
+ uint16 lineSize = READ_LE_UINT16(imageData + 24);
+
+ debug(2, "width = %d; height = %d; cmdOffs = %04X; pixelOffs = %04X; maskOffs = %04X; lineSize = %d\n",
+ width, height, cmdOffs, pixelOffs, maskOffs, lineSize);
+
+ if (!_surface) {
+ _surface = new Graphics::Surface();
+ _surface->create(width, height, 1);
+ }
- decompressImage(imageData, *_surface, cmdOffs, pixelOffs, maskOffs, lineSize, frameNum > 0);
+ decompressImage(imageData, *_surface, cmdOffs, pixelOffs, maskOffs, lineSize, frameNum > 0);
handleEvents();
- updateScreen();
+ updateScreen();
- delete[] frameData;
+ delete[] frameData;
_system->delayMillis(frameDelay);
- }
+ }
- _audioStream->finish();
- _mixer->stopAll();
-
- //delete _audioStream;
- delete _fd;
- delete _surface;
+ _audioStream->finish();
+ _mixer->stopAll();
+
+ //delete _audioStream;
+ delete _fd;
+ delete _surface;
//fclose(raw);
}
void PmvPlayer::readChunk(uint32 &chunkType, uint32 &chunkSize) {
- chunkType = _fd->readUint32BE();
- chunkSize = _fd->readUint32LE();
+ chunkType = _fd->readUint32BE();
+ chunkSize = _fd->readUint32LE();
- debug(2, "chunkType = %c%c%c%c; chunkSize = %d\n",
- (chunkType >> 24) & 0xFF, (chunkType >> 16) & 0xFF, (chunkType >> 8) & 0xFF, chunkType & 0xFF,
- chunkSize);
+ debug(2, "chunkType = %c%c%c%c; chunkSize = %d\n",
+ (chunkType >> 24) & 0xFF, (chunkType >> 16) & 0xFF, (chunkType >> 8) & 0xFF, chunkType & 0xFF,
+ chunkSize);
}
void PmvPlayer::handleEvents() {
Common::Event event;
while (_system->getEventManager()->pollEvent(event)) {
- if (event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
- _abort = true;
+ if (event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) {
+ _abort = true;
}
}
}
void PmvPlayer::updatePalette() {
- byte colors[1024];
- for (int i = 0; i < 256; i++) {
- colors[i * 4 + 0] = _palette[i * 3 + 0];
- colors[i * 4 + 1] = _palette[i * 3 + 1];
- colors[i * 4 + 2] = _palette[i * 3 + 2];
- colors[i * 4 + 3] = 0;
- }
- _system->setPalette(colors, 0, 256);
+ byte colors[1024];
+ for (int i = 0; i < 256; i++) {
+ colors[i * 4 + 0] = _palette[i * 3 + 0];
+ colors[i * 4 + 1] = _palette[i * 3 + 1];
+ colors[i * 4 + 2] = _palette[i * 3 + 2];
+ colors[i * 4 + 3] = 0;
+ }
+ _system->setPalette(colors, 0, 256);
}
void PmvPlayer::updateScreen() {
- _system->copyRectToScreen((const byte*)_surface->pixels, _surface->pitch, 0, 0, _surface->w, _surface->h);
- _system->updateScreen();
+ _system->copyRectToScreen((const byte*)_surface->pixels, _surface->pitch, 0, 0, _surface->w, _surface->h);
+ _system->updateScreen();
}
}