From 3652229147389477fe72a530cfeab9130761b35e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 28 Oct 2006 00:45:58 +0000 Subject: SCUMM: Got rid of smush/chunk_type.h svn-id: r24543 --- engines/scumm/insane/insane.cpp | 5 ++- engines/scumm/insane/insane_iact.cpp | 1 - engines/scumm/smush/channel.h | 3 -- engines/scumm/smush/chunk_type.h | 60 ----------------------------------- engines/scumm/smush/imuse_channel.cpp | 20 +++++------- engines/scumm/smush/saud_channel.cpp | 41 ++++++++++-------------- engines/scumm/smush/smush_player.cpp | 53 +++++++++++++++---------------- 7 files changed, 52 insertions(+), 131 deletions(-) delete mode 100644 engines/scumm/smush/chunk_type.h (limited to 'engines') diff --git a/engines/scumm/insane/insane.cpp b/engines/scumm/insane/insane.cpp index bb7b875e06..4d769c4d84 100644 --- a/engines/scumm/insane/insane.cpp +++ b/engines/scumm/insane/insane.cpp @@ -37,7 +37,6 @@ #include "scumm/smush/smush_player.h" #include "scumm/smush/smush_font.h" -#include "scumm/smush/chunk_type.h" #include "scumm/smush/chunk.h" #include "scumm/insane/insane.h" @@ -1320,14 +1319,14 @@ void Insane::procSKIP(Chunk &b) { _player->_skipNext = false; if ((_vm->_game.features & GF_DEMO) && (_vm->_game.platform == Common::kPlatformPC)) { - _player->checkBlock(b, TYPE_SKIP, 2); + _player->checkBlock(b, MKID_BE('SKIP'), 2); par1 = b.getWord(); if (isBitSet(par1)) _player->_skipNext = true; return; } - _player->checkBlock(b, TYPE_SKIP, 4); + _player->checkBlock(b, MKID_BE('SKIP'), 4); par1 = b.getWord(); par2 = b.getWord(); diff --git a/engines/scumm/insane/insane_iact.cpp b/engines/scumm/insane/insane_iact.cpp index 879c4d4987..e4275377f0 100644 --- a/engines/scumm/insane/insane_iact.cpp +++ b/engines/scumm/insane/insane_iact.cpp @@ -28,7 +28,6 @@ #include "scumm/scumm.h" #include "scumm/smush/smush_player.h" -#include "scumm/smush/chunk_type.h" #include "scumm/smush/chunk.h" #include "scumm/insane/insane.h" diff --git a/engines/scumm/smush/channel.h b/engines/scumm/smush/channel.h index 97a0d65488..ff81996e6f 100644 --- a/engines/scumm/smush/channel.h +++ b/engines/scumm/smush/channel.h @@ -80,7 +80,6 @@ protected: public: SaudChannel(int32 track); - virtual ~SaudChannel(); bool isTerminated() const; bool setParameters(int32 duration, int32 flags, int32 vol1, int32 vol2, int32 index); bool checkParameters(int32 index, int32 duration, int32 flags, int32 vol1, int32 vol2); @@ -105,7 +104,6 @@ private: int32 _channels; //!< the number of channels of the original data protected: - int32 decode(int32 size, int32 &ret); void decode(); bool handleMap(Chunk &c); bool handleFormat(Chunk &c); @@ -115,7 +113,6 @@ protected: public: ImuseChannel(int32 track); - virtual ~ImuseChannel(); bool isTerminated() const; bool setParameters(int32 nbframes, int32 size, int32 track_flags, int32 unk1, int32); bool checkParameters(int32 index, int32 nbframes, int32 size, int32 track_flags, int32 unk1); diff --git a/engines/scumm/smush/chunk_type.h b/engines/scumm/smush/chunk_type.h deleted file mode 100644 index 18c49f0dbf..0000000000 --- a/engines/scumm/smush/chunk_type.h +++ /dev/null @@ -1,60 +0,0 @@ -/* ScummVM - Scumm Interpreter - * Copyright (C) 2002-2006 The ScummVM project - * - * 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. - * - * $URL$ - * $Id$ - * - */ - -#ifndef CHUNK_TYPE_H -#define CHUNK_TYPE_H - -#include "common/scummsys.h" -#include "scumm/smush/chunk.h" - -namespace Scumm { - -static const Chunk::type TYPE_ANIM = 'ANIM'; -static const Chunk::type TYPE_AHDR = 'AHDR'; -static const Chunk::type TYPE_FRME = 'FRME'; -static const Chunk::type TYPE_NPAL = 'NPAL'; -static const Chunk::type TYPE_FOBJ = 'FOBJ'; -static const Chunk::type TYPE_ZFOB = 'ZFOB'; -static const Chunk::type TYPE_PSAD = 'PSAD'; -static const Chunk::type TYPE_TRES = 'TRES'; -static const Chunk::type TYPE_XPAL = 'XPAL'; -static const Chunk::type TYPE_IACT = 'IACT'; -static const Chunk::type TYPE_STOR = 'STOR'; -static const Chunk::type TYPE_FTCH = 'FTCH'; -static const Chunk::type TYPE_SKIP = 'SKIP'; -static const Chunk::type TYPE_STRK = 'STRK'; -static const Chunk::type TYPE_SMRK = 'SMRK'; -static const Chunk::type TYPE_SHDR = 'SHDR'; -static const Chunk::type TYPE_SDAT = 'SDAT'; -static const Chunk::type TYPE_SAUD = 'SAUD'; -static const Chunk::type TYPE_iMUS = 'iMUS'; -static const Chunk::type TYPE_FRMT = 'FRMT'; -static const Chunk::type TYPE_TEXT = 'TEXT'; -static const Chunk::type TYPE_REGN = 'REGN'; -static const Chunk::type TYPE_STOP = 'STOP'; -static const Chunk::type TYPE_MAP_ = 'MAP '; -static const Chunk::type TYPE_DATA = 'DATA'; -static const Chunk::type TYPE_ETRS = 'ETRS'; - -} // End of namespace Scumm - -#endif diff --git a/engines/scumm/smush/imuse_channel.cpp b/engines/scumm/smush/imuse_channel.cpp index b9600f36e8..e197fe2ccd 100644 --- a/engines/scumm/smush/imuse_channel.cpp +++ b/engines/scumm/smush/imuse_channel.cpp @@ -27,16 +27,12 @@ #include "scumm/util.h" #include "scumm/smush/channel.h" #include "scumm/smush/chunk.h" -#include "scumm/smush/chunk_type.h" namespace Scumm { ImuseChannel::ImuseChannel(int32 track) : SmushChannel(track) { } -ImuseChannel::~ImuseChannel() { -} - bool ImuseChannel::isTerminated() const { return (_dataSize <= 0 && _sbuffer == 0); } @@ -66,7 +62,7 @@ bool ImuseChannel::appendData(Chunk &b, int32 size) { assert(size > 8); Chunk::type imus_type = b.getDword(); imus_type = SWAP_BYTES_32(imus_type); uint32 imus_size = b.getDword(); imus_size = SWAP_BYTES_32(imus_size); - if (imus_type != TYPE_iMUS) + if (imus_type != MKID_BE('iMUS')) error("Invalid Chunk for imuse_channel"); size -= 8; _tbufferSize = size; @@ -136,15 +132,15 @@ bool ImuseChannel::handleMap(Chunk &map) { while (!map.eof()) { Chunk *sub = map.subBlock(); switch (sub->getType()) { - case TYPE_FRMT: + case MKID_BE('FRMT'): handleFormat(*sub); break; - case TYPE_TEXT: + case MKID_BE('TEXT'): break; - case TYPE_REGN: + case MKID_BE('REGN'): handleRegion(*sub); break; - case TYPE_STOP: + case MKID_BE('STOP'): handleStop(*sub); break; default: @@ -179,7 +175,7 @@ void ImuseChannel::decode() { } } - // FIXME: Code duplication! See decode12BitsSample() in scumm/imuse_digi.cpp + // FIXME: Code duplication! See decode12BitsSample() in imuse_digi/dimuse_codecs.cpp int loop_size = _sbufferSize / 3; int new_size = loop_size * 4; @@ -209,14 +205,14 @@ bool ImuseChannel::handleSubTags(int32 &offset) { uint32 size = READ_BE_UINT32(_tbuffer + offset + 4); uint32 available_size = _tbufferSize - offset; switch (type) { - case TYPE_MAP_: + case MKID_BE('MAP '): _inData = false; if (available_size >= (size + 8)) { MemoryChunk c((byte *)_tbuffer + offset); handleMap(c); } break; - case TYPE_DATA: + case MKID_BE('DATA'): _inData = true; _dataSize = size; offset += 8; diff --git a/engines/scumm/smush/saud_channel.cpp b/engines/scumm/smush/saud_channel.cpp index befeadad91..2c8893d57f 100644 --- a/engines/scumm/smush/saud_channel.cpp +++ b/engines/scumm/smush/saud_channel.cpp @@ -26,10 +26,20 @@ #include "scumm/util.h" #include "scumm/smush/channel.h" #include "scumm/smush/chunk.h" -#include "scumm/smush/chunk_type.h" namespace Scumm { +SaudChannel::SaudChannel(int32 track) : SmushChannel(track), + _nbframes(0), + _markReached(false), + _index(0), + _keepSize(false) { +} + +bool SaudChannel::isTerminated() const { + return (_markReached && _dataSize == 0 && _sbuffer == 0); +} + void SaudChannel::handleStrk(Chunk &b) { int32 size = b.getSize(); if (size != 14 && size != 10) { @@ -54,7 +64,7 @@ bool SaudChannel::handleSubTags(int32 &offset) { uint32 available_size = _tbufferSize - offset; switch (type) { - case TYPE_STRK: + case MKID_BE('STRK'): _inData = false; if (available_size >= (size + 8)) { MemoryChunk c((byte *)_tbuffer + offset); @@ -62,7 +72,7 @@ bool SaudChannel::handleSubTags(int32 &offset) { } else return false; break; - case TYPE_SMRK: + case MKID_BE('SMRK'): _inData = false; if (available_size >= (size + 8)) { MemoryChunk c((byte *)_tbuffer + offset); @@ -70,7 +80,7 @@ bool SaudChannel::handleSubTags(int32 &offset) { } else return false; break; - case TYPE_SHDR: + case MKID_BE('SHDR'): _inData = false; if (available_size >= (size + 8)) { MemoryChunk c((byte *)_tbuffer + offset); @@ -78,7 +88,7 @@ bool SaudChannel::handleSubTags(int32 &offset) { } else return false; break; - case TYPE_SDAT: + case MKID_BE('SDAT'): _inData = true; _dataSize = size; offset += 8; @@ -92,25 +102,6 @@ bool SaudChannel::handleSubTags(int32 &offset) { return false; } -SaudChannel::SaudChannel(int32 track) : SmushChannel(track), - _nbframes(0), - _markReached(false), - _index(0), - _keepSize(false) { -} - -SaudChannel::~SaudChannel() { - _dataSize = 0; - _tbufferSize = 0; - _sbufferSize = 0; - _markReached = true; - _sbuffer = 0; -} - -bool SaudChannel::isTerminated() const { - return (_markReached && _dataSize == 0 && _sbuffer == 0); -} - bool SaudChannel::setParameters(int32 nb, int32 flags, int32 volume, int32 pan, int32 index) { _nbframes = nb; _flags = flags; // bit 7 == IS_VOICE, bit 6 == IS_BACKGROUND_MUSIC, other ?? @@ -146,7 +137,7 @@ bool SaudChannel::appendData(Chunk &b, int32 size) { saud_type = SWAP_BYTES_32(saud_type); uint32 saud_size = b.getDword(); saud_size = SWAP_BYTES_32(saud_size); - if (saud_type != TYPE_SAUD) + if (saud_type != MKID_BE('SAUD')) error("Invalid Chunk for SaudChannel : %X", saud_type); size -= 8; _dataSize = -2; diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp index ae59c63a02..6e51aba652 100644 --- a/engines/scumm/smush/smush_player.cpp +++ b/engines/scumm/smush/smush_player.cpp @@ -40,7 +40,6 @@ #include "scumm/sound.h" #include "scumm/util.h" #include "scumm/smush/channel.h" -#include "scumm/smush/chunk_type.h" #include "scumm/smush/chunk.h" #include "scumm/smush/smush_font.h" #include "scumm/smush/smush_mixer.h" @@ -62,7 +61,7 @@ namespace Scumm { -const int MAX_STRINGS = 200; +static const int MAX_STRINGS = 200; class StringResource { private: @@ -200,7 +199,7 @@ static StringResource *getStrings(ScummEngine *vm, const char *file, bool is_enc assert(length > ETRS_HEADER_LENGTH); Chunk::type type = READ_BE_UINT32(filebuffer); - if (type != TYPE_ETRS) { + if (type != MKID_BE('ETRS')) { delete [] filebuffer; return getStrings(vm, file, false); } @@ -390,7 +389,7 @@ void SmushPlayer::handleSoundBuffer(int32 track_id, int32 index, int32 max_frame } void SmushPlayer::handleSoundFrame(Chunk &b) { - checkBlock(b, TYPE_PSAD); + checkBlock(b, MKID_BE('PSAD')); debugC(DEBUG_SMUSH, "SmushPlayer::handleSoundFrame()"); int32 track_id = b.getWord(); @@ -408,13 +407,13 @@ void SmushPlayer::handleSoundFrame(Chunk &b) { void SmushPlayer::handleStore(Chunk &b) { debugC(DEBUG_SMUSH, "SmushPlayer::handleStore()"); - checkBlock(b, TYPE_STOR, 4); + checkBlock(b, MKID_BE('STOR'), 4); _storeFrame = true; } void SmushPlayer::handleFetch(Chunk &b) { debugC(DEBUG_SMUSH, "SmushPlayer::handleFetch()"); - checkBlock(b, TYPE_FTCH, 6); + checkBlock(b, MKID_BE('FTCH'), 6); if (_frameBuffer != NULL) { memcpy(_dst, _frameBuffer, _width * _height); @@ -422,7 +421,7 @@ void SmushPlayer::handleFetch(Chunk &b) { } void SmushPlayer::handleIACT(Chunk &b) { - checkBlock(b, TYPE_IACT, 8); + checkBlock(b, MKID_BE('IACT'), 8); debugC(DEBUG_SMUSH, "SmushPlayer::IACT()"); int code = b.getWord(); @@ -558,7 +557,7 @@ void SmushPlayer::handleTextResource(Chunk &b) { const char *str; char *string = NULL, *string2 = NULL; - if (b.getType() == TYPE_TEXT) { + if (b.getType() == MKID_BE('TEXT')) { string = (char *)malloc(b.getSize() - 16); str = string; b.read(string, b.getSize() - 16); @@ -743,7 +742,7 @@ static byte delta_color(byte org_color, int16 delta_color) { } void SmushPlayer::handleDeltaPalette(Chunk &b) { - checkBlock(b, TYPE_XPAL); + checkBlock(b, MKID_BE('XPAL')); debugC(DEBUG_SMUSH, "SmushPlayer::handleDeltaPalette()"); if (b.getSize() == 0x300 * 3 + 4) { @@ -772,7 +771,7 @@ void SmushPlayer::handleDeltaPalette(Chunk &b) { } void SmushPlayer::handleNewPalette(Chunk &b) { - checkBlock(b, TYPE_NPAL, 0x300); + checkBlock(b, MKID_BE('NPAL'), 0x300); debugC(DEBUG_SMUSH, "SmushPlayer::handleNewPalette()"); if (_skipPalette) @@ -864,7 +863,7 @@ void SmushPlayer::handleZlibFrameObject(Chunk &b) { #endif void SmushPlayer::handleFrameObject(Chunk &b) { - checkBlock(b, TYPE_FOBJ, 14); + checkBlock(b, MKID_BE('FOBJ'), 14); if (_skipNext) { _skipNext = false; return; @@ -937,7 +936,7 @@ void SmushPlayer::handleFrameObject(Chunk &b) { } void SmushPlayer::handleFrame(Chunk &b) { - checkBlock(b, TYPE_FRME); + checkBlock(b, MKID_BE('FRME')); debugC(DEBUG_SMUSH, "SmushPlayer::handleFrame(%d)", _frame); _skipNext = false; @@ -948,40 +947,40 @@ void SmushPlayer::handleFrame(Chunk &b) { while (!b.eof()) { Chunk *sub = b.subBlock(); switch (sub->getType()) { - case TYPE_NPAL: + case MKID_BE('NPAL'): handleNewPalette(*sub); break; - case TYPE_FOBJ: + case MKID_BE('FOBJ'): handleFrameObject(*sub); break; #ifdef USE_ZLIB - case TYPE_ZFOB: + case MKID_BE('ZFOB'): handleZlibFrameObject(*sub); break; #endif - case TYPE_PSAD: + case MKID_BE('PSAD'): if (!_compressedFileMode) handleSoundFrame(*sub); break; - case TYPE_TRES: + case MKID_BE('TRES'): handleTextResource(*sub); break; - case TYPE_XPAL: + case MKID_BE('XPAL'): handleDeltaPalette(*sub); break; - case TYPE_IACT: + case MKID_BE('IACT'): handleIACT(*sub); break; - case TYPE_STOR: + case MKID_BE('STOR'): handleStore(*sub); break; - case TYPE_FTCH: + case MKID_BE('FTCH'): handleFetch(*sub); break; - case TYPE_SKIP: + case MKID_BE('SKIP'): _vm->_insane->procSKIP(*sub); break; - case TYPE_TEXT: + case MKID_BE('TEXT'): handleTextResource(*sub); break; default: @@ -1015,7 +1014,7 @@ void SmushPlayer::handleFrame(Chunk &b) { } void SmushPlayer::handleAnimHeader(Chunk &b) { - checkBlock(b, TYPE_AHDR, 0x300 + 6); + checkBlock(b, MKID_BE('AHDR'), 0x300 + 6); debugC(DEBUG_SMUSH, "SmushPlayer::handleAnimHeader()"); _version = b.getWord(); @@ -1091,7 +1090,7 @@ void SmushPlayer::parseNextFrame() { assert(_seekPos > 8); // In this case we need to get palette and number of frames sub = _base->subBlock(); - checkBlock(*sub, TYPE_AHDR); + checkBlock(*sub, MKID_BE('AHDR')); handleAnimHeader(*sub); delete sub; @@ -1123,10 +1122,10 @@ void SmushPlayer::parseNextFrame() { sub = _base->subBlock(); switch (sub->getType()) { - case TYPE_AHDR: // FT INSANE may seek file to the beginning + case MKID_BE('AHDR'): // FT INSANE may seek file to the beginning handleAnimHeader(*sub); break; - case TYPE_FRME: + case MKID_BE('FRME'): handleFrame(*sub); break; default: -- cgit v1.2.3