diff options
author | Paweł Kołodziejski | 2003-03-06 08:36:56 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2003-03-06 08:36:56 +0000 |
commit | 6cb48aa77aa968a623324c38a71830afe147f0c8 (patch) | |
tree | 945cee352bc6e345b17b93f0747d7a2c5aa49fbb | |
parent | 7f536134a084fb50957a27345c26fd2e6d529667 (diff) | |
download | scummvm-rg350-6cb48aa77aa968a623324c38a71830afe147f0c8.tar.gz scummvm-rg350-6cb48aa77aa968a623324c38a71830afe147f0c8.tar.bz2 scummvm-rg350-6cb48aa77aa968a623324c38a71830afe147f0c8.zip |
and more pedantic cleanup
svn-id: r6707
-rw-r--r-- | scumm/smush/blitter.cpp | 42 | ||||
-rw-r--r-- | scumm/smush/blitter.h | 6 | ||||
-rw-r--r-- | scumm/smush/brenderer.cpp | 26 | ||||
-rw-r--r-- | scumm/smush/brenderer.h | 18 | ||||
-rw-r--r-- | scumm/smush/channel.h | 34 | ||||
-rw-r--r-- | scumm/smush/chunk.cpp | 52 | ||||
-rw-r--r-- | scumm/smush/chunk.h | 8 | ||||
-rw-r--r-- | scumm/smush/codec1.cpp | 2 | ||||
-rw-r--r-- | scumm/smush/codec37.cpp | 18 | ||||
-rw-r--r-- | scumm/smush/codec37.h | 6 | ||||
-rw-r--r-- | scumm/smush/codec44.cpp | 6 | ||||
-rw-r--r-- | scumm/smush/codec44.h | 2 | ||||
-rw-r--r-- | scumm/smush/codec47.cpp | 80 | ||||
-rw-r--r-- | scumm/smush/codec47.h | 16 | ||||
-rw-r--r-- | scumm/smush/decoder.h | 2 | ||||
-rw-r--r-- | scumm/smush/frenderer.cpp | 62 | ||||
-rw-r--r-- | scumm/smush/frenderer.h | 18 | ||||
-rw-r--r-- | scumm/smush/imuse_channel.cpp | 60 | ||||
-rw-r--r-- | scumm/smush/player.cpp | 165 | ||||
-rw-r--r-- | scumm/smush/player.h | 16 | ||||
-rw-r--r-- | scumm/smush/renderer.h | 6 | ||||
-rw-r--r-- | scumm/smush/saud_channel.cpp | 36 | ||||
-rw-r--r-- | scumm/smush/scumm_renderer.cpp | 31 | ||||
-rw-r--r-- | scumm/smush/scumm_renderer.h | 10 |
24 files changed, 363 insertions, 359 deletions
diff --git a/scumm/smush/blitter.cpp b/scumm/smush/blitter.cpp index 290c97a16d..e7c0af543a 100644 --- a/scumm/smush/blitter.cpp +++ b/scumm/smush/blitter.cpp @@ -27,12 +27,12 @@ #include <assert.h> #include <string.h> // for memcpy -Blitter::Blitter(byte * ptr, const Point & dstsize, const Rect & src) : - _ptr(ptr), - _clip(dstsize), - _src(src), - _cur(src.left(), src.top()), - _outside(false) { +Blitter::Blitter(byte *ptr, const Point &dstsize, const Rect &src) : + _ptr(ptr), + _clip(dstsize), + _src(src), + _cur(src.left(), src.top()), + _outside(false) { #ifdef DEBUG_CLIPPER _clipped = 0; _clippedBlock = 0; @@ -62,7 +62,7 @@ void Blitter::advance(int32 x, int32 y) { _cur.set(_src.left(), _cur.getY()+1); } } - _offset = _ptr + _clip.getX() * _cur.getY() + _cur.getX(); + _offset = _ptr + _clip.getX() * _cur.getY() + _cur.getX(); _outside = ! _src.isInside(_cur); } @@ -76,7 +76,7 @@ void Blitter::put(byte data) { advance(); } #ifdef DEBUG_CLIPPER - else _clipped ++; + else _clipped++; #endif } @@ -95,7 +95,7 @@ void Blitter::put(byte data, uint32 len) { } } -void Blitter::blit(byte * ptr, uint32 len) { +void Blitter::blit(byte *ptr, uint32 len) { while(len) { if(_outside) { #ifdef DEBUG_CLIPPER @@ -111,7 +111,7 @@ void Blitter::blit(byte * ptr, uint32 len) { } } -void Blitter::blit(Chunk & src, uint32 len) { +void Blitter::blit(Chunk &src, uint32 len) { while(len) { if(_outside) { #ifdef DEBUG_CLIPPER @@ -129,7 +129,7 @@ void Blitter::blit(Chunk & src, uint32 len) { void Blitter::putBlock(uint32 data) { if(_cur.getX() + 3 < _src.right() && _cur.getY() + 3 < _src.bottom()) { // This is clipping assert((_clip.getX() & 3) == 0); - uint32 * dst = (uint32 *)_offset; + uint32 *dst = (uint32 *)_offset; int32 line_size = _clip.getX() >> 2; data = TO_LE_32(data); @@ -149,7 +149,7 @@ void Blitter::putBlock(uint32 data) { void Blitter::putBlock(uint32 d1, uint32 d2, uint32 d3, uint32 d4) { if(_cur.getX() + 3 < _src.right() && _cur.getY() + 3 < _src.bottom()) { // This is clipping assert((_clip.getX() & 3) == 0); - uint32 * dst = (uint32 *)_offset; + uint32 *dst = (uint32 *)_offset; int32 line_size = _clip.getX() >> 2; *dst = TO_LE_32(d4); dst += line_size; @@ -159,34 +159,34 @@ void Blitter::putBlock(uint32 d1, uint32 d2, uint32 d3, uint32 d4) { #ifdef DEBUG_CLIPPER } else { - _clippedBlock ++; + _clippedBlock++; #endif } advanceBlock(); } -void Blitter::putBlock(byte * data) { +void Blitter::putBlock(byte *data) { if(_cur.getX() + 3 < _src.right() && _cur.getY() + 3 < _src.bottom()) { // This is clipping assert((_clip.getX() & 3) == 0); - uint32 * dst = (uint32 *)_offset; + uint32 *dst = (uint32 *)_offset; int32 line_size = _clip.getX() >> 2; - uint32 * src = (uint32 *)data; + uint32 *src = (uint32 *)data; *dst = TO_LE_32(*src++); dst += line_size; *dst = TO_LE_32(*src++); dst += line_size; *dst = TO_LE_32(*src++); dst += line_size; *dst = TO_LE_32(*src++); #ifdef DEBUG_CLIPPER } else { - _clippedBlock ++; + _clippedBlock++; #endif } advanceBlock(); } -void Blitter::putBlock(Chunk & src) { +void Blitter::putBlock(Chunk &src) { if(_cur.getX() + 3 < _src.right() && _cur.getY() + 3 < _src.bottom()) { // This is clipping assert((_clip.getX() & 3) == 0); - uint32 * dst = (uint32 *)_offset; + uint32 *dst = (uint32 *)_offset; int32 line_size = _clip.getX() >> 2; *dst = TO_LE_32(src.getDword()); dst += line_size; *dst = TO_LE_32(src.getDword()); dst += line_size; @@ -194,7 +194,7 @@ void Blitter::putBlock(Chunk & src) { *dst = TO_LE_32(src.getDword()); #ifdef DEBUG_CLIPPER } else { - _clippedBlock ++; + _clippedBlock++; #endif } advanceBlock(); @@ -228,7 +228,7 @@ void Blitter::blockCopy(int32 offset) { #endif #ifdef DEBUG_CLIPPER } else { - _clippedBlock ++; + _clippedBlock++; #endif } advanceBlock(); diff --git a/scumm/smush/blitter.h b/scumm/smush/blitter.h index cfed25dd3f..a1b5540139 100644 --- a/scumm/smush/blitter.h +++ b/scumm/smush/blitter.h @@ -47,8 +47,8 @@ class Chunk; */ class Blitter { private: - byte * _ptr; //!< This is the pointer to the start of the frame buffer - byte * _offset; //!< This is the current pointer in the frame buffer + byte *_ptr; //!< This is the pointer to the start of the frame buffer + byte *_offset; //!< This is the current pointer in the frame buffer Point _clip; //!< This is the size of the frame buffer (width/height) Rect _src; //!< This is the size and position of the destination rectangle Point _cur; //!< This is the current position in the destination rectangle @@ -77,7 +77,7 @@ public: void putBlock(byte *); //!< This method allows to blit one block directly from a buffer void putBlock(uint32, uint32, uint32, uint32); //!< This method allows to blit one block from a 4 int32 value void blockCopy(int32); //!< This method allows to copy one block from another separated by the given offset - byte * getPtr() { return _ptr; } + byte *getPtr() { return _ptr; } }; #endif diff --git a/scumm/smush/brenderer.cpp b/scumm/smush/brenderer.cpp index bba35fd3ad..a1fb694c19 100644 --- a/scumm/smush/brenderer.cpp +++ b/scumm/smush/brenderer.cpp @@ -34,19 +34,19 @@ void BaseRenderer::clean() { } } -BaseRenderer::BaseRenderer() : - _data(0), - _frame(0), - _nbframes(0), - _width(0), - _height(0) { +BaseRenderer::BaseRenderer() : + _data(0), + _frame(0), + _nbframes(0), + _width(0), + _height(0) { } -BaseRenderer::~BaseRenderer() { - clean(); +BaseRenderer::~BaseRenderer() { + clean(); } -bool BaseRenderer::initFrame(const Point & p) { +bool BaseRenderer::initFrame(const Point &p) { clean(); _width = p.getX(); _height = p.getY(); @@ -56,7 +56,7 @@ bool BaseRenderer::initFrame(const Point & p) { return true; } -char * BaseRenderer::lockFrame(int32 frame) { +char *BaseRenderer::lockFrame(int32 frame) { _frame = frame; if(!_data) error("no allocated image buffer in lock_frame"); return _data; @@ -66,12 +66,12 @@ bool BaseRenderer::unlockFrame() { return true; } -bool BaseRenderer::flipFrame() { +bool BaseRenderer::flipFrame() { save(); return true; } -bool BaseRenderer::setPalette(const Palette & pal) { - _pal = pal; +bool BaseRenderer::setPalette(const Palette & pal) { + _pal = pal; return true; } diff --git a/scumm/smush/brenderer.h b/scumm/smush/brenderer.h index b5ec15aad7..3f215fa86d 100644 --- a/scumm/smush/brenderer.h +++ b/scumm/smush/brenderer.h @@ -35,21 +35,21 @@ class BaseRenderer : public Renderer { private: Palette _pal; //!< The current palette - char * _data; //!< The current frame buffer + char *_data; //!< The current frame buffer int32 _frame; //!< The current frame number int32 _nbframes; //!< The number of frames in the animation int32 _width; //!< The current frame's width int32 _height; //!< The current frame's height - const char * _fname; //!< The filename of the animation being played + const char *_fname; //!< The filename of the animation being played protected: virtual void save(int32 frame = -1) = 0; protected: - const char * getFilename() const { return _fname; }; //!< accessor for animation filename + const char *getFilename() const { return _fname; }; //!< accessor for animation filename int32 getNbframes() const { return _nbframes; }; //!< accessor for number of frames int32 getWidth() const { return _width; }; //!< accessor for current width int32 getHeight() const { return _height; }; //!< accessor for current height - const char * data() const { return _data; }; //!< accessor for current frame buffer + const char *data() const { return _data; }; //!< accessor for current frame buffer void clean(); //!< memory cleanup (deletes frame buffer) void setFrame(int32 f) { _frame = f; }; //!< allows to change the frame number public: @@ -57,13 +57,13 @@ public: BaseRenderer(); virtual ~BaseRenderer(); - virtual bool initFrame(const Point & size); - virtual char * lockFrame(int32 frame); + virtual bool initFrame(const Point &size); + virtual char *lockFrame(int32 frame); virtual bool unlockFrame(); virtual bool flipFrame(); - virtual bool setPalette(const Palette & pal); - virtual bool startDecode(const char * fname, int32 version, int32 nbframes) { _fname = fname; _nbframes = nbframes; return true; } - virtual Mixer * getMixer() { return 0; }; + virtual bool setPalette(const Palette &pal); + virtual bool startDecode(const char *fname, int32 version, int32 nbframes) { _fname = fname; _nbframes = nbframes; return true; } + virtual Mixer *getMixer() { return 0; }; virtual bool prematureClose() { return false; }; }; diff --git a/scumm/smush/channel.h b/scumm/smush/channel.h index a69df70de4..f169059906 100644 --- a/scumm/smush/channel.h +++ b/scumm/smush/channel.h @@ -46,14 +46,14 @@ class _Channel { public: virtual ~_Channel() {}; // called by the smush_player - virtual bool appendData(Chunk & b, int32 size) = 0; + virtual bool appendData(Chunk &b, int32 size) = 0; virtual bool setParameters(int32, int32, int32, int32) = 0; virtual bool checkParameters(int32, int32, int32, int32, int32) = 0; // called by the mixer virtual bool isTerminated() const = 0; virtual int32 availableSoundData() const = 0; - virtual void getSoundData(int16 * sound_buffer, int32 size) = 0; // size is in sample - virtual void getSoundData(int8 * sound_buffer, int32 size) = 0; + virtual void getSoundData(int16 *sound_buffer, int32 size) = 0; // size is in sample + virtual void getSoundData(int8 *sound_buffer, int32 size) = 0; virtual int32 getRate() = 0; virtual bool getParameters(int32 &rate, bool &stereo, bool &is_16bit) = 0; virtual int32 getTrackIdentifier() const = 0; @@ -72,16 +72,16 @@ private: int32 _balance; //!< the current track balance int32 _index; //!< the current PSAD index (for coherency checking) int16 _voltable[2][256]; //!< the precalculated volume table (stereo 16 bits) - byte * _tbuffer; //!< data temporary buffer + byte *_tbuffer; //!< data temporary buffer int32 _tbufferSize; //!< temporary buffer size - byte * _sbuffer; //!< sound buffer + byte *_sbuffer; //!< sound buffer int32 _sbufferSize; //!< sound buffer size protected: - void handleStrk(Chunk & c); - void handleSmrk(Chunk & c); - void handleShdr(Chunk & c); - bool handleSubTags(int32 & offset); + void handleStrk(Chunk &c); + void handleSmrk(Chunk &c); + void handleShdr(Chunk &c); + bool handleSubTags(int32 &offset); bool processBuffer(); void recalcVolumeTable(); @@ -91,10 +91,10 @@ public: bool isTerminated() const; bool setParameters(int32 duration, int32 flags, int32 vol1, int32 vol2); bool checkParameters(int32 index, int32 duration, int32 flags, int32 vol1, int32 vol2); - bool appendData(Chunk & b, int32 size); + bool appendData(Chunk &b, int32 size); int32 availableSoundData() const; - void getSoundData(int16 * sound_buffer, int32 size); - void getSoundData(int8 * sound_buffer, int32 size) { error("16bit request for SAUD channel should never happen"); }; + void getSoundData(int16 *sound_buffer, int32 size); + void getSoundData(int8 *sound_buffer, int32 size) { error("16bit request for SAUD channel should never happen"); }; int32 getRate() { return _frequency; } bool getParameters(int32 &rate, bool &stereo, bool &is_16bit) { rate = _frequency; @@ -114,9 +114,9 @@ public: class ImuseChannel : public _Channel { private: int32 _track; //!< the track number - byte * _tbuffer; //!< data temporary buffer + byte *_tbuffer; //!< data temporary buffer int32 _tbufferSize; //!< temporary buffer size - byte * _sbuffer; //!< sound buffer + byte *_sbuffer; //!< sound buffer int32 _sbufferSize; //!< sound buffer size int32 _srbufferSize; int32 _frequency; //!< the target frequency of the ::mixer @@ -145,10 +145,10 @@ public: bool isTerminated() const; bool setParameters(int32 nbframes, int32 size, int32 track_flags, int32 unk1); bool checkParameters(int32 index, int32 nbframes, int32 size, int32 track_flags, int32 unk1); - bool appendData(Chunk & b, int32 size); + bool appendData(Chunk &b, int32 size); int32 availableSoundData() const; - void getSoundData(int16 * sound_buffer, int32 size); - void getSoundData(int8 * sound_buffer, int32 size); + void getSoundData(int16 *sound_buffer, int32 size); + void getSoundData(int8 *sound_buffer, int32 size); int32 getRate() { return _rate; } bool getParameters(int32 &rate, bool &stereo, bool &is_16bit) { rate = _frequency; diff --git a/scumm/smush/chunk.cpp b/scumm/smush/chunk.cpp index 3e392c72c5..fa82936896 100644 --- a/scumm/smush/chunk.cpp +++ b/scumm/smush/chunk.cpp @@ -39,7 +39,7 @@ class FilePtr { int32 _refcount; int32 _curPos; public: - FilePtr(const char * fname, const char * directory) : _filename(fname), _refcount(1), _curPos(0) { + FilePtr(const char *fname, const char *directory) : _filename(fname), _refcount(1), _curPos(0) { debug(9, "FilePtr created for %s", fname); _ifs.open(fname, directory); if(_ifs.isOpen() == false) error("FilePtr unable to read file %s", fname); @@ -58,7 +58,7 @@ public: } return true; } - bool read(void * ptr, int32 size) { + bool read(void *ptr, int32 size) { _ifs.read(ptr, size); _curPos += size; return true; @@ -72,7 +72,7 @@ public: } }; -const char * Chunk::ChunkString(Chunk::type t) { +const char *Chunk::ChunkString(Chunk::type t) { static char data[5]; data[0] = (char)((t >> 24) & 0xFF); data[1] = (char)((t >> 16) & 0xFF); @@ -89,7 +89,7 @@ FileChunk::~FileChunk() { if(_data) _data->decRef(); } -FileChunk::FileChunk(const char * fname, const char * directory) { +FileChunk::FileChunk(const char *fname, const char *directory) { _data = new FilePtr(fname, directory); _data->read(&_type, 4); _type = TO_BE_32(_type); @@ -107,8 +107,8 @@ uint32 FileChunk::getSize() const { return _size; } -Chunk * FileChunk::subBlock() { - FileChunk * ptr = new FileChunk; +Chunk *FileChunk::subBlock() { + FileChunk *ptr = new FileChunk; ptr->_data = _data; _data->incRef(); _data->seek(_offset + _curPos); @@ -123,11 +123,11 @@ Chunk * FileChunk::subBlock() { return ptr; } -bool FileChunk::eof() const { +bool FileChunk::eof() const { return _curPos >= _size; } -uint32 FileChunk::tell() const { +uint32 FileChunk::tell() const { return _curPos; } @@ -151,8 +151,9 @@ bool FileChunk::seek(int32 delta, seek_type dir) { return true; } -bool FileChunk::read(void * buffer, uint32 size) { - if(size <= 0 || (_curPos + size) > _size) error("invalid buffer read request"); +bool FileChunk::read(void *buffer, uint32 size) { + if(size <= 0 || (_curPos + size) > _size) + error("invalid buffer read request"); _data->seek(_offset + _curPos); _data->read(buffer, size); _curPos += size; @@ -160,7 +161,8 @@ bool FileChunk::read(void * buffer, uint32 size) { } int8 FileChunk::getChar() { - if(_curPos >= _size) error("invalid char read request"); + if(_curPos >= _size) + error("invalid char read request"); _data->seek(_offset + _curPos); int8 buffer; _data->read(&buffer, sizeof(buffer)); @@ -169,7 +171,8 @@ int8 FileChunk::getChar() { } byte FileChunk::getByte() { - if(_curPos >= _size) error("invalid byte read request"); + if(_curPos >= _size) + error("invalid byte read request"); _data->seek(_offset + _curPos); byte buffer; _data->read(&buffer, sizeof(buffer)); @@ -183,7 +186,8 @@ int16 FileChunk::getShort() { } uint16 FileChunk::getWord() { - if(_curPos >= _size - 1) error("invalid word read request"); + if(_curPos >= _size - 1) + error("invalid word read request"); _data->seek(_offset + _curPos); uint16 buffer; _data->read(&buffer, sizeof(buffer)); @@ -192,7 +196,8 @@ uint16 FileChunk::getWord() { } uint32 FileChunk::getDword() { - if(_curPos >= _size - 3) error("invalid dword read request"); + if(_curPos >= _size - 3) + error("invalid dword read request"); _data->seek(_offset + _curPos); uint32 buffer; _data->read(&buffer, sizeof(buffer)); @@ -200,8 +205,9 @@ uint32 FileChunk::getDword() { return TO_LE_32(buffer); } -ContChunk::ContChunk(byte * data) { - if(data == 0) error("Chunk() called with NULL point32er"); +ContChunk::ContChunk(byte *data) { + if(data == 0) + error("Chunk() called with NULL point32er"); _type = (Chunk::type)READ_BE_UINT32(data); _size = READ_BE_UINT32(data + 4); _data = data + sizeof(Chunk::type) + sizeof(uint32); @@ -216,8 +222,8 @@ uint32 ContChunk::getSize() const { return _size; } -Chunk * ContChunk::subBlock() { - ContChunk * ptr = new ContChunk(_data + _curPos); +Chunk *ContChunk::subBlock() { + ContChunk *ptr = new ContChunk(_data + _curPos); seek(sizeof(Chunk::type) + sizeof(uint32) + ptr->getSize()); return ptr; } @@ -250,7 +256,7 @@ bool ContChunk::seek(int32 delta, seek_type dir) { return true; } -bool ContChunk::read(void * buffer, uint32 size) { +bool ContChunk::read(void *buffer, uint32 size) { if(size <= 0 || (_curPos + size) > _size) error("invalid buffer read request"); memcpy(buffer, _data + _curPos, size); _curPos += size; @@ -264,7 +270,7 @@ int8 ContChunk::getChar() { byte ContChunk::getByte() { if(_curPos >= _size) error("invalid byte read request"); - byte * ptr = (byte *)(_data + _curPos); + byte *ptr = (byte *)(_data + _curPos); _curPos += 1; return *ptr; } @@ -272,19 +278,19 @@ byte ContChunk::getByte() { int16 ContChunk::getShort() { if(_curPos >= _size - 1) error("invalid int16 read request"); int16 buffer = getWord(); - return *((int16*)&buffer); + return *((int16 *)&buffer); } uint16 ContChunk::getWord() { if(_curPos >= _size - 1) error("invalid word read request"); - uint16 * ptr = (uint16 *)(_data + _curPos); + uint16 *ptr = (uint16 *)(_data + _curPos); _curPos += 2; return READ_LE_UINT16(ptr); } uint32 ContChunk::getDword() { if(_curPos >= _size - 3) error("invalid dword read request"); - uint32 * ptr = (uint32 *)(_data + _curPos); + uint32 *ptr = (uint32 *)(_data + _curPos); _curPos += 4; return READ_LE_UINT32(ptr); } diff --git a/scumm/smush/chunk.h b/scumm/smush/chunk.h index b13da2d05d..cf616919de 100644 --- a/scumm/smush/chunk.h +++ b/scumm/smush/chunk.h @@ -98,19 +98,19 @@ public: */ class ContChunk : public Chunk { private: - byte * _data; + byte *_data; Chunk::type _type; uint32 _size; uint32 _curPos; public: - ContChunk(byte * data); + ContChunk(byte *data); Chunk::type getType() const; uint32 getSize() const; - Chunk * subBlock(); + Chunk *subBlock(); bool eof() const; uint32 tell() const; bool seek(int32 delta, seek_type dir = seek_cur); - bool read(void * buffer, uint32 size); + bool read(void *buffer, uint32 size); int8 getChar(); byte getByte(); int16 getShort(); diff --git a/scumm/smush/codec1.cpp b/scumm/smush/codec1.cpp index 538ed8daef..070258450c 100644 --- a/scumm/smush/codec1.cpp +++ b/scumm/smush/codec1.cpp @@ -27,7 +27,7 @@ Codec1Decoder::~Codec1Decoder() { } -bool Codec1Decoder::decode(Blitter & dst, Chunk & src) { +bool Codec1Decoder::decode(Blitter &dst, Chunk &src) { byte val; int32 size_line; int32 code, length; diff --git a/scumm/smush/codec37.cpp b/scumm/smush/codec37.cpp index 0c7b76f209..4d3d346bfa 100644 --- a/scumm/smush/codec37.cpp +++ b/scumm/smush/codec37.cpp @@ -29,11 +29,11 @@ #include <assert.h> #include <string.h> -bool Codec37Decoder::initSize(const Point & p, const Rect & r) { +bool Codec37Decoder::initSize(const Point &p, const Rect &r) { if(r.width() != getRect().width() && r.height() != getRect().height()) { if( - (r.width() != 320 || r.height() != 200) && - (r.width() != 384 || r.height() != 242) && + (r.width() != 320 || r.height() != 200) && + (r.width() != 384 || r.height() != 242) && (r.width() != 640 || r.height() != 480) ) return false; @@ -280,7 +280,6 @@ void Codec37Decoder::bompDecode(byte *dst, byte *src, int32 len) { assert(len == 0); } - #if defined(SCUMM_NEED_ALIGNMENT) #define DECLARE_LITERAL_TEMP(v) \ @@ -315,14 +314,13 @@ void Codec37Decoder::bompDecode(byte *dst, byte *src, int32 len) { } while(0) #define WRITE_4X1_LINE(dst, v) \ - *(uint32*)(dst) = v + *(uint32 *)(dst) = v #define COPY_4X1_LINE(dst, src) \ - *(uint32*)(dst) = *(uint32*)(src) + *(uint32 *)(dst) = *(uint32 *)(src) #endif /* SCUMM_NEED_ALIGNMENT */ - /* Fill a 4x4 pixel block with a literal pixel value */ #define LITERAL_4X4(src, dst, pitch) \ @@ -336,7 +334,6 @@ void Codec37Decoder::bompDecode(byte *dst, byte *src, int32 len) { dst += 4; \ } while(0) - /* Fill four 4x1 pixel blocks with literal pixel values */ #define LITERAL_4X1(src, dst, pitch) \ @@ -350,7 +347,6 @@ void Codec37Decoder::bompDecode(byte *dst, byte *src, int32 len) { dst += 4; \ } while(0) - /* Fill sixteen 1x1 pixel blocks with literal pixel values */ #define LITERAL_1X1(src, dst, pitch) \ @@ -363,7 +359,6 @@ void Codec37Decoder::bompDecode(byte *dst, byte *src, int32 len) { dst += 4; \ } while(0) - /* Copy a 4x4 pixel block from a different place in the framebuffer */ #define COPY_4X4(dst2, dst, pitch) \ @@ -375,7 +370,6 @@ void Codec37Decoder::bompDecode(byte *dst, byte *src, int32 len) { dst += 4; \ } while(0) - void Codec37Decoder::proc3WithFDFE(byte *dst, byte *src, int32 next_offs, int32 bw, int32 bh, int32 pitch, int16 *offset_table) { do { int32 i = bw; @@ -487,7 +481,7 @@ bool Codec37Decoder::decode(Blitter & dst, Chunk & src) { int32 pitch = bw << 2; int32 chunk_size = src.getSize() - 14; - byte * chunk_buffer = (byte*)malloc(chunk_size); + byte *chunk_buffer = (byte *)malloc(chunk_size); src.read(chunk_buffer, chunk_size); int16 seq_nb = READ_LE_UINT16(chunk_buffer + 2); diff --git a/scumm/smush/codec37.h b/scumm/smush/codec37.h index a820aaf689..1e548f882b 100644 --- a/scumm/smush/codec37.h +++ b/scumm/smush/codec37.h @@ -27,9 +27,9 @@ class Codec37Decoder : public Decoder { private: int32 _deltaSize; - byte * _deltaBufs[2]; - byte * _deltaBuf; - int16 * _offsetTable; + byte *_deltaBufs[2]; + byte *_deltaBuf; + int16 *_offsetTable; int32 _curtable; uint16 _prevSeqNb; int32 _tableLastPitch; diff --git a/scumm/smush/codec44.cpp b/scumm/smush/codec44.cpp index ece5faa06f..b79bc3c0d6 100644 --- a/scumm/smush/codec44.cpp +++ b/scumm/smush/codec44.cpp @@ -29,10 +29,10 @@ bool Codec44Decoder::decode(Blitter & dst, Chunk & src) { int32 length = src.getSize() - 14; int32 width = getRect().width(); int32 height = getRect().height(); - byte * src2 = (byte*)malloc(length); - byte * org_src2 = src2; + byte *src2 = (byte *)malloc(length); + byte *org_src2 = src2; src.read(src2, length); - byte * dst2 = _buffer; + byte *dst2 = _buffer; byte val; do { diff --git a/scumm/smush/codec44.h b/scumm/smush/codec44.h index 239c30099b..9efaee5e5d 100644 --- a/scumm/smush/codec44.h +++ b/scumm/smush/codec44.h @@ -28,7 +28,7 @@ class Codec44Decoder : public Decoder { byte _buffer[1000]; public: - bool decode(Blitter & dst, Chunk & src); + bool decode(Blitter &dst, Chunk &src); }; #endif diff --git a/scumm/smush/codec47.cpp b/scumm/smush/codec47.cpp index 04cf3419a0..b18fecd13e 100644 --- a/scumm/smush/codec47.cpp +++ b/scumm/smush/codec47.cpp @@ -228,8 +228,8 @@ void Codec47Decoder::makeTables37(int32 param) { int32 b1, b2; int32 value_table37_1_2, value_table37_1_1, value_table37_2_2, value_table37_2_1; int32 tableSmallBig[64], tmp, s; - int32 * table37_1 = 0, * table37_2 = 0, * ptr_small_big; - byte * ptr; + int32 *table37_1 = 0, *table37_2 = 0, *ptr_small_big; + byte *ptr; int i, x, y; if (param == 8) { @@ -427,7 +427,7 @@ void Codec47Decoder::makeTables47(int32 width) { c += 128; } while (c < 32768); } - + void Codec47Decoder::bompDecode(byte *dst, byte *src, int32 len) { byte code; byte color; @@ -449,36 +449,36 @@ void Codec47Decoder::bompDecode(byte *dst, byte *src, int32 len) { assert(len == 0); } -void Codec47Decoder::level3(byte * d_dst) { +void Codec47Decoder::level3(byte *d_dst) { int32 tmp; byte code = *_d_src++; if (code < 0xF8) { tmp = _table[code] + _offset1; - *(uint16*)(d_dst + (_d_pitch * 0)) = *(uint16*)(d_dst + (_d_pitch * 0) + tmp); - *(uint16*)(d_dst + (_d_pitch * 1)) = *(uint16*)(d_dst + (_d_pitch * 1) + tmp); + *(uint16 *)(d_dst + (_d_pitch * 0)) = *(uint16 *)(d_dst + (_d_pitch * 0) + tmp); + *(uint16 *)(d_dst + (_d_pitch * 1)) = *(uint16 *)(d_dst + (_d_pitch * 1) + tmp); } else if (code == 0xFF) { - *(uint16*)(d_dst + (_d_pitch * 0)) = *(uint16*)(_d_src + 0); - *(uint16*)(d_dst + (_d_pitch * 1)) = *(uint16*)(_d_src + 2); + *(uint16 *)(d_dst + (_d_pitch * 0)) = *(uint16 *)(_d_src + 0); + *(uint16 *)(d_dst + (_d_pitch * 1)) = *(uint16 *)(_d_src + 2); _d_src += 4; } else if (code == 0xFE) { byte t = *_d_src++; tmp = t | t << 8; - *(uint16*)(d_dst + (_d_pitch * 0)) = (uint16)tmp; - *(uint16*)(d_dst + (_d_pitch * 1)) = (uint16)tmp; + *(uint16 *)(d_dst + (_d_pitch * 0)) = (uint16)tmp; + *(uint16 *)(d_dst + (_d_pitch * 1)) = (uint16)tmp; } else if (code == 0xFC) { tmp = _offset2; - *(uint16*)(d_dst + (_d_pitch * 0)) = *(uint16*)(d_dst + (_d_pitch * 0) + tmp); - *(uint16*)(d_dst + (_d_pitch * 1)) = *(uint16*)(d_dst + (_d_pitch * 1) + tmp); + *(uint16 *)(d_dst + (_d_pitch * 0)) = *(uint16 *)(d_dst + (_d_pitch * 0) + tmp); + *(uint16 *)(d_dst + (_d_pitch * 1)) = *(uint16 *)(d_dst + (_d_pitch * 1) + tmp); } else { byte t = _paramPtr[code]; tmp = t | t << 8; - *(uint16*)(d_dst + (_d_pitch * 0)) = (uint16)tmp; - *(uint16*)(d_dst + (_d_pitch * 1)) = (uint16)tmp; + *(uint16 *)(d_dst + (_d_pitch * 0)) = (uint16)tmp; + *(uint16 *)(d_dst + (_d_pitch * 1)) = (uint16)tmp; } } -void Codec47Decoder::level2(byte * d_dst) { +void Codec47Decoder::level2(byte *d_dst) { int32 tmp; byte code = *_d_src++; int i; @@ -486,11 +486,11 @@ void Codec47Decoder::level2(byte * d_dst) { if (code < 0xF8) { tmp = _table[code] + _offset1; for (i = 0; i < 4; i++) { - *(uint32*)(d_dst) = *(uint32*)(d_dst + tmp); + *(uint32 *)(d_dst) = *(uint32 *)(d_dst + tmp); d_dst += _d_pitch; } } else if (code == 0xFF) { - byte * tmp_dst = d_dst; + byte *tmp_dst = d_dst; level3(d_dst); d_dst += 2; level3(d_dst); @@ -503,21 +503,21 @@ void Codec47Decoder::level2(byte * d_dst) { byte t = *_d_src++; uint32 val = t << 24 | t << 16 | t << 8 | t; for (i = 0; i < 4; i++) { - *(uint32*)(d_dst) = val; + *(uint32 *)(d_dst) = val; d_dst += _d_pitch; } } else if (code == 0xFD) { - byte * tmp_ptr = _tableSmall + (*_d_src++ << 7); + byte *tmp_ptr = _tableSmall + (*_d_src++ << 7); int32 l = tmp_ptr[96]; byte val = *_d_src++; - int16 * tmp_ptr2 = (int16*)tmp_ptr; + int16 *tmp_ptr2 = (int16 *)tmp_ptr; while(l--) { *(d_dst + READ_LE_UINT16(tmp_ptr2)) = val; tmp_ptr2++; } l = tmp_ptr[97]; val = *_d_src++; - tmp_ptr2 = (int16*)(tmp_ptr + 32); + tmp_ptr2 = (int16 *)(tmp_ptr + 32); while(l--) { *(d_dst + READ_LE_UINT16(tmp_ptr2)) = val; tmp_ptr2++; @@ -525,20 +525,20 @@ void Codec47Decoder::level2(byte * d_dst) { } else if (code == 0xFC) { tmp = _offset2; for (i = 0; i < 4; i++) { - *(uint32*)(d_dst) = *(uint32*)(d_dst + tmp); + *(uint32 *)(d_dst) = *(uint32 *)(d_dst + tmp); d_dst += _d_pitch; } } else { byte t = _paramPtr[code]; uint32 val = t << 24 | t << 16 | t << 8 | t; for (i = 0; i < 4; i++) { - *(uint32*)(d_dst) = val; + *(uint32 *)(d_dst) = val; d_dst += _d_pitch; } } } -void Codec47Decoder::level1(byte * d_dst) { +void Codec47Decoder::level1(byte *d_dst) { int32 tmp, tmp2; byte code = *_d_src++; int i; @@ -546,12 +546,12 @@ void Codec47Decoder::level1(byte * d_dst) { if (code < 0xF8) { tmp2 = _table[code] + _offset1; for (i = 0; i < 8; i++) { - *(uint32*)(d_dst + 0) = *(uint32*)(d_dst + tmp2); - *(uint32*)(d_dst + 4) = *(uint32*)(d_dst + tmp2 + 4); + *(uint32 *)(d_dst + 0) = *(uint32 *)(d_dst + tmp2); + *(uint32 *)(d_dst + 4) = *(uint32 *)(d_dst + tmp2 + 4); d_dst += _d_pitch; } } else if (code == 0xFF) { - byte * tmp_dst = d_dst; + byte *tmp_dst = d_dst; level2(d_dst); d_dst += 4; level2(d_dst); @@ -564,23 +564,23 @@ void Codec47Decoder::level1(byte * d_dst) { byte t = *_d_src++; int32 val = t << 24 | t << 16 | t << 8 | t; for (i = 0; i < 8; i++) { - *(uint32*)(d_dst) = val; - *(uint32*)(d_dst + 4) = val; + *(uint32 *)(d_dst) = val; + *(uint32 *)(d_dst + 4) = val; d_dst += _d_pitch; } } else if (code == 0xFD) { tmp = *_d_src++; - byte * tmp_ptr = _tableBig + (tmp << 2) + (tmp << 7) + (tmp << 8); + byte *tmp_ptr = _tableBig + (tmp << 2) + (tmp << 7) + (tmp << 8); byte l = tmp_ptr[384]; byte val = *_d_src++; - int16 * tmp_ptr2 = (int16*)tmp_ptr; + int16 *tmp_ptr2 = (int16 *)tmp_ptr; while(l--) { *(d_dst + READ_LE_UINT16(tmp_ptr2)) = val; tmp_ptr2++; } l = tmp_ptr[385]; val = *_d_src++; - tmp_ptr2 = (int16*)(tmp_ptr + 128); + tmp_ptr2 = (int16 *)(tmp_ptr + 128); while(l--) { *(d_dst + READ_LE_UINT16(tmp_ptr2)) = val; tmp_ptr2++; @@ -588,16 +588,16 @@ void Codec47Decoder::level1(byte * d_dst) { } else if (code == 0xFC) { tmp2 = _offset2; for (i = 0; i < 8; i++) { - *(uint32*)(d_dst + 0) = *(uint32*)(d_dst + tmp2); - *(uint32*)(d_dst + 4) = *(uint32*)(d_dst + tmp2 + 4); + *(uint32 *)(d_dst + 0) = *(uint32 *)(d_dst + tmp2); + *(uint32 *)(d_dst + 4) = *(uint32 *)(d_dst + tmp2 + 4); d_dst += _d_pitch; } } else { byte t = _paramPtr[code]; int32 val = t << 24 | t << 16 | t << 8 | t; for (i = 0; i < 8; i++) { - *(uint32*)(d_dst) = val; - *(uint32*)(d_dst + 4) = val; + *(uint32 *)(d_dst) = val; + *(uint32 *)(d_dst + 4) = val; d_dst += _d_pitch; } } @@ -621,7 +621,7 @@ void Codec47Decoder::decode2(byte *dst, byte *src, int32 width, int32 height, by } while (--bh); } -bool Codec47Decoder::initSize(const Point & p, const Rect & r) { +bool Codec47Decoder::initSize(const Point &p, const Rect &r) { if(r.width() != getRect().width() && r.height() != getRect().height()) { if( (r.width() != 640 || r.height() != 480) @@ -664,14 +664,14 @@ Codec47Decoder::~Codec47Decoder() { clean(); } -bool Codec47Decoder::decode(Blitter & dst, Chunk & src) { +bool Codec47Decoder::decode(Blitter &dst, Chunk &src) { int32 width = getRect().width(); int32 height = getRect().height(); _offset1 = _deltaBufs[1] - _curBuf; _offset2 = _deltaBufs[0] - _curBuf; int32 chunk_size = src.getSize() - 14; - byte *chunk_buffer = (byte*)malloc(chunk_size); + byte *chunk_buffer = (byte *)malloc(chunk_size); src.read(chunk_buffer, chunk_size); int32 seq_nb = READ_LE_UINT16(chunk_buffer + 0); @@ -685,7 +685,7 @@ bool Codec47Decoder::decode(Blitter & dst, Chunk & src) { memset(_deltaBufs[1], chunk_buffer[13], width * height); _prevSeqNb = -1; } - + if ((chunk_buffer[4] & 1) != 0) { gfx_data += 32896; } diff --git a/scumm/smush/codec47.h b/scumm/smush/codec47.h index 0f67bef747..0863ac0425 100644 --- a/scumm/smush/codec47.h +++ b/scumm/smush/codec47.h @@ -29,12 +29,12 @@ class Codec47Decoder : public Decoder { private: int32 _deltaSize; - byte * _deltaBufs[2]; - byte * _deltaBuf; - byte * _curBuf; + byte *_deltaBufs[2]; + byte *_deltaBuf; + byte *_curBuf; int32 _prevSeqNb; int32 _lastTableWidth; - byte * _d_src, * _paramPtr; + byte *_d_src, *_paramPtr; int32 _d_pitch; int32 _offset1, _offset2; byte _tableBig[99328]; @@ -44,10 +44,10 @@ private: void makeTables47(int32 width); void makeTables37(int32 param); void bompDecode(byte *dst, byte *src, int32 len); - void level1(byte * d_dst); - void level2(byte * d_dst); - void level3(byte * d_dst); - void decode2(byte * dst, byte * src, int32 width, int32 height, byte * param_ptr); + void level1(byte *d_dst); + void level2(byte *d_dst); + void level3(byte *d_dst); + void decode2(byte *dst, byte *src, int32 width, int32 height, byte *param_ptr); public: Codec47Decoder(); diff --git a/scumm/smush/decoder.h b/scumm/smush/decoder.h index 8e4e9493f3..8bd7debf3b 100644 --- a/scumm/smush/decoder.h +++ b/scumm/smush/decoder.h @@ -46,7 +46,7 @@ protected: public: Decoder() {}; virtual ~Decoder() {}; - virtual bool initSize(const Point & p, const Rect & r) { _p = p; _r = r; return true; }; + virtual bool initSize(const Point &p, const Rect &r) { _p = p; _r = r; return true; }; virtual bool decode(Blitter &, Chunk &) = 0; }; diff --git a/scumm/smush/frenderer.cpp b/scumm/smush/frenderer.cpp index 75cf14aa7b..ec56be1623 100644 --- a/scumm/smush/frenderer.cpp +++ b/scumm/smush/frenderer.cpp @@ -62,7 +62,7 @@ int32 FontRenderer::charHeight(int32 v) const { return _chars[v].height; } -int32 FontRenderer::stringWidth(const char * str) const { +int32 FontRenderer::stringWidth(const char *str) const { int32 ret = 0; while(*str) { @@ -72,7 +72,7 @@ int32 FontRenderer::stringWidth(const char * str) const { return ret; } -int32 FontRenderer::stringHeight(const char * str) const { +int32 FontRenderer::stringHeight(const char *str) const { int32 ret = 0; for(int32 i = 0; str[i] != 0; i++) { @@ -83,11 +83,11 @@ int32 FontRenderer::stringHeight(const char * str) const { return ret; } -int32 FontRenderer::drawChar(char * buffer, const Point & size, int32 x, int32 y, int32 chr) const { +int32 FontRenderer::drawChar(char *buffer, const Point &size, int32 x, int32 y, int32 chr) const { int32 w = _chars[chr].width; int32 h = _chars[chr].height; - char * src = _chars[chr].chr; - char * dst = buffer + size.getX() * y + x; + char *src = _chars[chr].chr; + char *dst = buffer + size.getX() * y + x; if(_original) { for(int32 j = 0; j < h; j++) { @@ -130,10 +130,10 @@ int32 FontRenderer::drawChar(char * buffer, const Point & size, int32 x, int32 y return w; } -static char * * split(const char * str, char sep) { - char * * ret = new char *[62]; +static char **split(const char *str, char sep) { + char **ret = new char *[62]; int32 n = 0; - const char * i = str, * j = strchr(i, sep); + const char *i = str, *j = strchr(i, sep); while(j != NULL) { assert(n < 60); @@ -151,16 +151,16 @@ static char * * split(const char * str, char sep) { return ret; } -void FontRenderer::drawSubstring(const byte * str, char * buffer, const Point & size, int32 x, int32 y) const { +void FontRenderer::drawSubstring(const byte *str, char *buffer, const Point &size, int32 x, int32 y) const { for(int32 i = 0; str[i] != 0; i++) x += drawChar(buffer, size, x, y, str[i]); } -bool FontRenderer::drawStringAbsolute(const char * str, char * buffer, const Point & size, int32 x, int32 y) const { +bool FontRenderer::drawStringAbsolute(const char *str, char *buffer, const Point &size, int32 x, int32 y) const { debug(9, "FontRenderer::drawStringAbsolute(%s, %d, %d)", str, x, y); while(str) { char line[256]; - char * pos = strchr(str, '\n'); + char *pos = strchr(str, '\n'); if(pos) { memcpy(line, str, pos - str - 1); line[pos - str - 1] = 0; @@ -175,31 +175,31 @@ bool FontRenderer::drawStringAbsolute(const char * str, char * buffer, const Poi return true; } -bool FontRenderer::drawStringCentered(const char * str, char * buffer, const Point & size, int32 y, int32 xmin, int32 width, int32 offset) const { +bool FontRenderer::drawStringCentered(const char *str, char *buffer, const Point &size, int32 y, int32 xmin, int32 width, int32 offset) const { debug(9, "FontRenderer::drawStringCentered(%s, %d, %d)", str, xmin, y); if ((strchr(str, '\n') != 0)) { - char * j = strchr(str, '\n'); + char *j = strchr(str, '\n'); *j = 0; } - char * * words = split(str, ' '); + char **words = split(str, ' '); int32 nb_sub = 0; while(words[nb_sub]) nb_sub++; - int32 * sizes = new int32[nb_sub]; + int32 *sizes = new int32[nb_sub]; int32 i = 0, max_width = 0, height = 0, nb_subs = 0; for(i = 0; i < nb_sub; i++) sizes[i] = stringWidth(words[i]); - char * * substrings = new char *[nb_sub]; - int32 * substr_widths = new int32[nb_sub]; + char **substrings = new char *[nb_sub]; + int32 *substr_widths = new int32[nb_sub]; int32 space_width = charWidth(' '); i = 0; while(i < nb_sub) { int32 substr_width = sizes[i]; - char * substr = new char[1000]; + char *substr = new char[1000]; strcpy(substr, words[i]); int32 j = i + 1; @@ -253,10 +253,10 @@ bool FontRenderer::drawStringCentered(const char * str, char * buffer, const Poi return true; } -bool FontRenderer::drawStringWrap(const char * str, char * buffer, const Point & size, int32 x, int32 y, int32 width) const { +bool FontRenderer::drawStringWrap(const char *str, char *buffer, const Point &size, int32 x, int32 y, int32 width) const { debug(9, "FontRenderer::drawStringWrap(%s, %d, %d)", str, x, y); if ((strchr(str, '\n') != 0)) { - char * j = strchr(str, '\n'); + char *j = strchr(str, '\n'); *j = 0; } char * * words = split(str, ' '); @@ -264,20 +264,20 @@ bool FontRenderer::drawStringWrap(const char * str, char * buffer, const Point & while(words[nb_sub]) nb_sub++; - int32 * sizes = new int32[nb_sub]; + int32 *sizes = new int32[nb_sub]; int32 i = 0, max_width = 0, height = 0, nb_subs = 0, left_x; for(i = 0; i < nb_sub; i++) sizes[i] = stringWidth(words[i]); - char * * substrings = new char *[nb_sub]; - int32 * substr_widths = new int32[nb_sub]; + char **substrings = new char *[nb_sub]; + int32 *substr_widths = new int32[nb_sub]; int32 space_width = charWidth(' '); i = 0; while(i < nb_sub) { int32 substr_width = sizes[i]; - char * substr = new char[1000]; + char *substr = new char[1000]; strcpy(substr, words[i]); int32 j = i + 1; @@ -328,33 +328,33 @@ bool FontRenderer::drawStringWrap(const char * str, char * buffer, const Point & return true; } -bool FontRenderer::drawStringWrapCentered(const char * str, char * buffer, const Point & size, int32 x, int32 y, int32 width) const { +bool FontRenderer::drawStringWrapCentered(const char *str, char *buffer, const Point &size, int32 x, int32 y, int32 width) const { int32 max_substr_width = 0; debug(9, "FontRenderer::drawStringWrapCentered(%s, %d, %d)", str, x, y); if ((strchr(str, '\n') != 0)) { - char * j = strchr(str, '\n'); + char *j = strchr(str, '\n'); *j = 0; } - char * * words = split(str, ' '); + char **words = split(str, ' '); int32 nb_sub = 0; while(words[nb_sub]) nb_sub++; - int32 * sizes = new int32[nb_sub]; + int32 *sizes = new int32[nb_sub]; int32 i = 0, height = 0, nb_subs = 0; for(i = 0; i < nb_sub; i++) sizes[i] = stringWidth(words[i]); - char * * substrings = new char *[nb_sub]; - int32 * substr_widths = new int32[nb_sub]; + char **substrings = new char *[nb_sub]; + int32 *substr_widths = new int32[nb_sub]; int32 space_width = charWidth(' '); i = 0; width = MIN(width, size.getX()); while(i < nb_sub) { int32 substr_width = sizes[i]; - char * substr = new char[1000]; + char *substr = new char[1000]; strcpy(substr, words[i]); int32 j = i + 1; diff --git a/scumm/smush/frenderer.h b/scumm/smush/frenderer.h index 8f26c6f887..851dd79309 100644 --- a/scumm/smush/frenderer.h +++ b/scumm/smush/frenderer.h @@ -56,7 +56,7 @@ private: struct { int32 width; int32 height; - char * chr; + char *chr; } _chars[256]; //!< array that contains the size of the different frames (i.e. characters) of the font. public: /*! @brief font_renderer constructor @@ -81,7 +81,7 @@ protected: @return the complete width of the string */ - int32 stringWidth(const char * str) const; + int32 stringWidth(const char *str) const; /*! @brief get the height of a character. @param c the character we want the height from. @@ -95,7 +95,7 @@ protected: @return the complete height of the string */ - int32 stringHeight(const char * str) const; + int32 stringHeight(const char *str) const; /*! @brief draw a character in the given frame buffer. @param buffer the frame buffer to draw into. @@ -108,7 +108,7 @@ protected: @return the width of the character */ - int32 drawChar(char * buffer, const Point & size, int32 x, int32 y, int32 c) const; + int32 drawChar(char *buffer, const Point &size, int32 x, int32 y, int32 c) const; /*! @brief draw a string in the given frame buffer. @param str the string to draw. @@ -119,7 +119,7 @@ protected: @bug This method does not clip. This is not really a bug, as it should always be correctly called, but some asserts would be welcome. */ - void drawSubstring(const byte * str, char * buffer, const Point & size, int32 x, int32 y) const; + void drawSubstring(const byte *str, char *buffer, const Point &size, int32 x, int32 y) const; public: /*! @brief change the programmable color of the font. @@ -147,9 +147,9 @@ public: @return \c true if everything went fine, \c false otherwise */ - bool drawStringCentered(const char * str, char * buffer, const Point & size, int32 y, int32 xmin, int32 width, int32 offset) const; - bool drawStringWrap(const char * str, char * buffer, const Point & size, int32 x, int32 y, int32 width) const; - bool drawStringWrapCentered(const char * str, char * buffer, const Point & size, int32 x, int32 y, int32 width) const; + bool drawStringCentered(const char *str, char *buffer, const Point &size, int32 y, int32 xmin, int32 width, int32 offset) const; + bool drawStringWrap(const char *str, char *buffer, const Point &size, int32 x, int32 y, int32 width) const; + bool drawStringWrapCentered(const char *str, char *buffer, const Point &size, int32 x, int32 y, int32 width) const; /*! @brief draw a string at an absolute position. @param str the string to draw. @@ -160,7 +160,7 @@ public: @return \c true if everything went fine, \c false otherwise */ - bool drawStringAbsolute(const char * str, char * buffer, const Point & size, int32 x, int32 y) const; + bool drawStringAbsolute(const char *str, char *buffer, const Point &size, int32 x, int32 y) const; }; #endif diff --git a/scumm/smush/imuse_channel.cpp b/scumm/smush/imuse_channel.cpp index ef9dfceede..fa532ebffb 100644 --- a/scumm/smush/imuse_channel.cpp +++ b/scumm/smush/imuse_channel.cpp @@ -28,14 +28,14 @@ #include <string.h> ImuseChannel::ImuseChannel(int32 track, int32 freq) : - _track(track), - _tbuffer(0), - _tbufferSize(0), - _sbuffer(0), - _sbufferSize(0), - _frequency(freq), - _dataSize(-1), - _inData(false) { + _track(track), + _tbuffer(0), + _tbufferSize(0), + _sbuffer(0), + _sbufferSize(0), + _frequency(freq), + _dataSize(-1), + _inData(false) { } ImuseChannel::~ImuseChannel() { @@ -72,25 +72,28 @@ bool ImuseChannel::checkParameters(int32 index, int32 nbframes, int32 size, int3 return true; } -bool ImuseChannel::appendData(Chunk & b, int32 size) { +bool ImuseChannel::appendData(Chunk &b, int32 size) { if(_dataSize == -1) { // First call assert(size > 8); Chunk::type imus_type = b.getDword(); imus_type = SWAP_BYTES(imus_type); uint32 imus_size = b.getDword(); imus_size = SWAP_BYTES(imus_size); - if(imus_type != TYPE_iMUS) error("Invalid Chunk for imuse_channel"); + if(imus_type != TYPE_iMUS) + error("Invalid Chunk for imuse_channel"); size -= 8; _tbufferSize = size; assert(_tbufferSize); _tbuffer = new byte[_tbufferSize]; - if(!_tbuffer) error("imuse_channel failed to allocate memory"); + if(!_tbuffer) + error("imuse_channel failed to allocate memory"); b.read(_tbuffer, size); _dataSize = -2; // even if _in_data does not get set, this won't be called again } else { if(_tbuffer) { // remaining from last call - byte * old = _tbuffer; + byte *old = _tbuffer; int32 new_size = size + _tbufferSize; _tbuffer = new byte[new_size]; - if(!_tbuffer) error("imuse_channel failed to allocate memory"); + if(!_tbuffer) + error("imuse_channel failed to allocate memory"); memcpy(_tbuffer, old, _tbufferSize); delete []old; b.read(_tbuffer + _tbufferSize, size); @@ -98,14 +101,15 @@ bool ImuseChannel::appendData(Chunk & b, int32 size) { } else { _tbufferSize = size; _tbuffer = new byte[_tbufferSize]; - if(!_tbuffer) error("imuse_channel failed to allocate memory"); + if(!_tbuffer) + error("imuse_channel failed to allocate memory"); b.read(_tbuffer, size); } } return processBuffer(); } -bool ImuseChannel::handleFormat(Chunk & src) { +bool ImuseChannel::handleFormat(Chunk &src) { if(src.getSize() != 20) error("invalid size for FRMT Chunk"); uint32 imuse_start = src.getDword(); imuse_start = SWAP_BYTES(imuse_start); @@ -120,23 +124,25 @@ bool ImuseChannel::handleFormat(Chunk & src) { return true; } -bool ImuseChannel::handleText(Chunk & src) { +bool ImuseChannel::handleText(Chunk &src) { return true; } -bool ImuseChannel::handleRegion(Chunk & src) { - if(src.getSize() != 8) error("invalid size for REGN Chunk"); +bool ImuseChannel::handleRegion(Chunk &src) { + if(src.getSize() != 8) + error("invalid size for REGN Chunk"); return true; } -bool ImuseChannel::handleStop(Chunk & src) { - if(src.getSize() != 4) error("invalid size for STOP Chunk"); +bool ImuseChannel::handleStop(Chunk &src) { + if(src.getSize() != 4) + error("invalid size for STOP Chunk"); return true; } -bool ImuseChannel::handleMap(Chunk & map) { +bool ImuseChannel::handleMap(Chunk &map) { while(!map.eof()) { - Chunk * sub = map.subBlock(); + Chunk *sub = map.subBlock(); switch(sub->getType()) { case TYPE_FRMT: handleFormat(*sub); @@ -171,7 +177,7 @@ void ImuseChannel::decode() { } else { debug(2, "impossible ! : %p, %d, %d, %p(%d), %p(%d, %d)", this, _dataSize, _inData, _tbuffer, _tbufferSize, _sbuffer, _sbufferSize, _srbufferSize); - byte * old = _tbuffer; + byte *old = _tbuffer; int new_size = remaining_size + _tbufferSize; _tbuffer = new byte[new_size]; if(!_tbuffer) error("imuse_channel failed to allocate memory"); @@ -183,7 +189,7 @@ void ImuseChannel::decode() { } int loop_size = _sbufferSize / 3; int new_size = loop_size * 2; - byte * keep, * decoded; + byte *keep, *decoded; uint32 value; keep = decoded = new byte[new_size * 2]; assert(keep); @@ -204,7 +210,7 @@ void ImuseChannel::decode() { _sbufferSize = new_size * sizeof(int16); } -bool ImuseChannel::handleSubTags(int32 & offset) { +bool ImuseChannel::handleSubTags(int32 &offset) { if(_tbufferSize - offset >= 8) { Chunk::type type = READ_BE_UINT32(_tbuffer + offset); uint32 size = READ_BE_UINT32(_tbuffer + offset + 4); @@ -318,7 +324,7 @@ int32 ImuseChannel::availableSoundData(void) const { return ret; } -void ImuseChannel::getSoundData(int16 * snd, int32 size) { +void ImuseChannel::getSoundData(int16 *snd, int32 size) { if(_dataSize <= 0 || _bitsize <= 8) error("invalid call to imuse_channel::read_sound_data()"); if(_channels == 2) size *= 2; byte * buf = (byte*)snd; @@ -348,7 +354,7 @@ void ImuseChannel::getSoundData(int16 * snd, int32 size) { _dataSize -= _srbufferSize; } -void ImuseChannel::getSoundData(int8 * snd, int32 size) { +void ImuseChannel::getSoundData(int8 *snd, int32 size) { if(_dataSize <= 0 || _bitsize > 8) error("invalid call to imuse_channel::read_sound_data()"); if(_channels == 2) size *= 2; if(_rate == 11025) { diff --git a/scumm/smush/player.cpp b/scumm/smush/player.cpp index 8024704485..918ca67b05 100644 --- a/scumm/smush/player.cpp +++ b/scumm/smush/player.cpp @@ -49,11 +49,11 @@ class StringResource { private: struct { int32 id; - char * string; + char *string; } _strings[MAX_STRINGS]; int32 _nbStrings; int32 _lastId; - char * _lastString; + char *_lastString; public: StringResource() : _nbStrings(0), _lastId(-1) {}; ~StringResource() { @@ -66,16 +66,16 @@ public: #ifdef DEBUG debug(9, "parsing string resources..."); #endif - char * def_start = strchr(buffer, '#'); + char *def_start = strchr(buffer, '#'); while(def_start != NULL) { - char * def_end = strchr(def_start, '\n'); + char *def_end = strchr(def_start, '\n'); assert(def_end != NULL); - char * id_end = def_end; + char *id_end = def_end; while(id_end >= def_start && !isdigit(*(id_end-1))) { id_end--; } assert(id_end > def_start); - char * id_start = id_end; + char *id_start = id_end; while(isdigit(*(id_start - 1))) { id_start--; } @@ -83,12 +83,12 @@ public: memcpy(idstring, id_start, id_end - id_start); idstring[id_end - id_start] = 0; int32 id = atoi(idstring); - char * data_start = def_end; + char *data_start = def_end; while(*data_start == '\n' || *data_start == '\r') { data_start++; } - char * data_end = data_start; + char *data_end = data_start; while(1) { if(data_end[-2] == '\r' && data_end[1] == '\n' && data_end[-1] == '\n' && data_end[0] == '\r') { @@ -103,12 +103,12 @@ public: data_end -= 2; assert(data_end > data_start); - char * value = new char[data_end - data_start + 1]; + char *value = new char[data_end - data_start + 1]; assert(value); memcpy(value, data_start, data_end - data_start); value[data_end - data_start] = 0; - char * line_start = value; - char * line_end; + char *line_start = value; + char *line_end; while ((line_end = strchr(line_start, '\n'))) { line_start = line_end+1; @@ -132,7 +132,7 @@ public: return true; } - const char * get(int32 id) { + const char *get(int32 id) { if(id == _lastId) { return _lastString; } @@ -150,14 +150,14 @@ public: } }; -void SmushPlayer::show(const char * p) { +void SmushPlayer::show(const char *p) { if(strcmp(p, "subtitles") == 0) { _subtitles = true; } else if(strcmp(p, "bgmusic") == 0) { _bgmusic = true; } else if(strcmp(p, "voices") == 0) { _voices = true; - } else { + } else { int id = atoi(p); if(id < 0 || id > 36) { error("invalid parameter to show"); @@ -166,7 +166,7 @@ void SmushPlayer::show(const char * p) { } } -void SmushPlayer::hide(const char * p) { +void SmushPlayer::hide(const char *p) { if(strcmp(p, "subtitles") == 0) { _subtitles = false; } else if(strcmp(p, "bgmusic") == 0) { @@ -183,28 +183,28 @@ void SmushPlayer::hide(const char * p) { } SmushPlayer::SmushPlayer(Renderer * renderer, bool wait, bool sound) : - _version(-1), - _secondaryVersion(0), - _soundFrequency(0), - _nbframes(0), - _mixer(0), - _renderer(renderer), - _strings(0), - _frameSize(-1, -1), - _frame(0), - _outputSound(sound), - _wait(wait), - _alreadyInit(false), - _codec37Called(false), - _skipNext(false), - _subtitles(true), - _bgmusic(true), - _voices(true), - _curBuffer(0), - _IACTchannel(-1), - _IACTpos(0), - _storeFrame(false), - _frameBuffer(NULL) { + _version(-1), + _secondaryVersion(0), + _soundFrequency(0), + _nbframes(0), + _mixer(0), + _renderer(renderer), + _strings(0), + _frameSize(-1, -1), + _frame(0), + _outputSound(sound), + _wait(wait), + _alreadyInit(false), + _codec37Called(false), + _skipNext(false), + _subtitles(true), + _bgmusic(true), + _voices(true), + _curBuffer(0), + _IACTchannel(-1), + _IACTpos(0), + _storeFrame(false), + _frameBuffer(NULL) { _fr[0] = _fr[1] = _fr[2] = _fr[3] = _fr[4] = 0; assert(_renderer != 0); } @@ -231,7 +231,7 @@ void SmushPlayer::clean() { } } -void SmushPlayer::checkBlock(const Chunk & b, Chunk::type type_expected, uint32 min_size) { +void SmushPlayer::checkBlock(const Chunk &b, Chunk::type type_expected, uint32 min_size) { if(type_expected != b.getType()) { error("Chunk type is different from expected : %d != %d", b.getType(), type_expected); } @@ -240,7 +240,7 @@ void SmushPlayer::checkBlock(const Chunk & b, Chunk::type type_expected, uint32 } } -void SmushPlayer::handleSoundBuffer(int32 track_id, int32 index, int32 max_frames, int32 flags, int32 vol, int32 bal, Chunk & b, int32 size) { +void SmushPlayer::handleSoundBuffer(int32 track_id, int32 index, int32 max_frames, int32 flags, int32 vol, int32 bal, Chunk &b, int32 size) { debug(6, "smush_player::handleSoundBuffer(%d)", track_id); if(!_voices && (flags & 128) == 128) { return; @@ -248,7 +248,7 @@ void SmushPlayer::handleSoundBuffer(int32 track_id, int32 index, int32 max_frame if(!_bgmusic && (flags & 64) == 64) { return; } - _Channel * c = _mixer->findChannel(track_id); + _Channel *c = _mixer->findChannel(track_id); if(c == 0) { c = new SaudChannel(track_id, _soundFrequency); _mixer->addChannel(c); @@ -261,7 +261,7 @@ void SmushPlayer::handleSoundBuffer(int32 track_id, int32 index, int32 max_frame c->appendData(b, size); } -void SmushPlayer::handleSoundFrame(Chunk & b) { +void SmushPlayer::handleSoundFrame(Chunk &b) { checkBlock(b, TYPE_PSAD); debug(6, "SmushPlayer::handleSoundFrame()"); if(!_outputSound) { @@ -282,7 +282,7 @@ void SmushPlayer::handleSoundFrame(Chunk & b) { handleSoundBuffer(track_id, index, max_frames, flags, vol, bal, b, size); } -void SmushPlayer::handleSkip(Chunk & b) { +void SmushPlayer::handleSkip(Chunk &b) { checkBlock(b, TYPE_SKIP, 4); int32 code = b.getDword(); debug(6, "SmushPlayer::handleSkip(%d)", code); @@ -292,13 +292,13 @@ void SmushPlayer::handleSkip(Chunk & b) { _skipNext = true; } -void SmushPlayer::handleStore(Chunk & b) { +void SmushPlayer::handleStore(Chunk &b) { checkBlock(b, TYPE_STOR, 4); _storeFrame = true; debug(6, "SmushPlayer::handleStore()"); } -void SmushPlayer::handleFetch(Chunk & b) { +void SmushPlayer::handleFetch(Chunk &b) { checkBlock(b, TYPE_FTCH, 6); debug(6, "SmushPlayer::handleFetch()"); @@ -311,10 +311,10 @@ void SmushPlayer::handleFetch(Chunk & b) { } } -void SmushPlayer::handleImuseBuffer(int32 track_id, int32 index, int32 nbframes, int32 size, int32 unk1, int32 track_flags, Chunk & b, int32 bsize) { +void SmushPlayer::handleImuseBuffer(int32 track_id, int32 index, int32 nbframes, int32 size, int32 unk1, int32 track_flags, Chunk &b, int32 bsize) { int32 track = (track_flags << 16) | track_id; - _Channel * c = _mixer->findChannel(track); + _Channel *c = _mixer->findChannel(track); if(c == 0) { c = new ImuseChannel(track, _soundFrequency); _mixer->addChannel(c); @@ -326,7 +326,7 @@ void SmushPlayer::handleImuseBuffer(int32 track_id, int32 index, int32 nbframes, c->appendData(b, bsize); } -void SmushPlayer::handleImuseAction8(Chunk & b, int32 flags, int32 unknown, int32 track_flags) { +void SmushPlayer::handleImuseAction8(Chunk &b, int32 flags, int32 unknown, int32 track_flags) { assert(flags == 46 && unknown == 0); int32 track_id = b.getWord(); int32 index = b.getWord(); @@ -337,9 +337,9 @@ void SmushPlayer::handleImuseAction8(Chunk & b, int32 flags, int32 unknown, int3 handleImuseBuffer(track_id, index, nbframes, size, unknown, track_flags, b, bsize); } else { byte output_data[4096]; - byte * src = (byte*)malloc(bsize); + byte *src = (byte *)malloc(bsize); b.read(src, bsize); - byte * d_src = src; + byte *d_src = src; byte value; do { @@ -354,8 +354,8 @@ void SmushPlayer::handleImuseAction8(Chunk & b, int32 flags, int32 unknown, int3 bsize = 0; } else { memcpy(_IACToutput + _IACTpos, d_src, len); - byte * dst = output_data; - byte * d_src2 = _IACToutput; + byte *dst = output_data; + byte *d_src2 = _IACToutput; d_src2 += 2; int32 count = 1024; byte variable1 = *d_src2++; @@ -420,7 +420,7 @@ void SmushPlayer::handleImuseAction8(Chunk & b, int32 flags, int32 unknown, int3 } } -void SmushPlayer::handleImuseAction(Chunk & b) { +void SmushPlayer::handleImuseAction(Chunk &b) { checkBlock(b, TYPE_IACT, 8); debug(6, "SmushPlayer::handleImuseAction()"); if(!_outputSound) { @@ -445,7 +445,7 @@ void SmushPlayer::handleImuseAction(Chunk & b) { } } -void SmushPlayer::handleTextResource(Chunk & b) { +void SmushPlayer::handleTextResource(Chunk &b) { int32 pos_x = b.getShort(); int32 pos_y = b.getShort(); int32 flags = b.getShort(); @@ -455,7 +455,7 @@ void SmushPlayer::handleTextResource(Chunk & b) { /*int32 height =*/ b.getShort(); /*int32 unk2 =*/ b.getWord(); - const char * str; + const char *str; char *string = NULL; char *string2 = NULL; if (b.getType() == TYPE_TEXT) { @@ -476,14 +476,14 @@ void SmushPlayer::handleTextResource(Chunk & b) { if((!_subtitles) && ((flags & 8) == 8)) return; - FontRenderer * fr = _fr[0]; + FontRenderer *fr = _fr[0]; int32 color = 15; while(*str == '/') { str++; // For Full Throttle text resources } if (g_scumm->_gameId == GID_CMI) { - g_scumm->translateText((byte*)str - 1, g_scumm->_transText); + g_scumm->translateText((byte *)str - 1, g_scumm->_transText); while(*str++ != '/'); string2 = (char*)g_scumm->_transText; @@ -520,15 +520,14 @@ void SmushPlayer::handleTextResource(Chunk & b) { } if (g_scumm->_gameId != GID_CMI) { - string2 = (char*)str; + string2 = (char *)str; } if (g_scumm->_gameId == GID_CMI) { if (string2[0] == 0) { - string2 = (char*)str; + string2 = (char *)str; } } - // flags: // bit 0 - center 1 // bit 1 - not used 2 @@ -568,13 +567,13 @@ void SmushPlayer::handleTextResource(Chunk & b) { } } -void SmushPlayer::readPalette(Palette & out, Chunk & in) { +void SmushPlayer::readPalette(Palette &out, Chunk &in) { byte buffer[768]; in.read(buffer, 768); out = Palette(buffer); } -void SmushPlayer::handleDeltaPalette(Chunk & b) { +void SmushPlayer::handleDeltaPalette(Chunk &b) { checkBlock(b, TYPE_XPAL); debug(6, "SmushPlayer::handleDeltaPalette()"); if(b.getSize() == 768 * 3 + 4) { @@ -600,29 +599,29 @@ void SmushPlayer::handleDeltaPalette(Chunk & b) { } } -void SmushPlayer::handleNewPalette(Chunk & b) { +void SmushPlayer::handleNewPalette(Chunk &b) { checkBlock(b, TYPE_NPAL, 768); debug(6, "SmushPlayer::handleNewPalette()"); readPalette(_pal, b); updatePalette(); } -void SmushPlayer::decodeCodec(Chunk & b, const Rect & r, Decoder & codec) { +void SmushPlayer::decodeCodec(Chunk &b, const Rect &r, Decoder &codec) { assert(_curBuffer); - Blitter blit((byte*)_curBuffer, _frameSize, r); + Blitter blit((byte *)_curBuffer, _frameSize, r); codec.decode(blit, b); if (_storeFrame == true) { if (_frameBuffer == NULL) { - _frameBuffer = (byte*)malloc(_frameSize.getX() * _frameSize.getY()); + _frameBuffer = (byte *)malloc(_frameSize.getX() * _frameSize.getY()); } memcpy(_frameBuffer, _curBuffer, _frameSize.getX() * _frameSize.getY()); _storeFrame = false; } } -void SmushPlayer::initSize(const Rect & r, bool always, bool transparent) { +void SmushPlayer::initSize(const Rect &r, bool always, bool transparent) { if(_codec37Called) _alreadyInit = true; - + if(!_alreadyInit || _frameSize.getX() < r.right() || _frameSize.getY() < r.bottom() || always) { if(_curBuffer) { _renderer->unlockFrame(); @@ -639,7 +638,7 @@ void SmushPlayer::initSize(const Rect & r, bool always, bool transparent) { _curBuffer = _renderer->lockFrame(_frame); if(!_alreadyInit && transparent) { - memset(_curBuffer, 0, _frameSize.getX()*_frameSize.getY()); + memset(_curBuffer, 0, _frameSize.getX() * _frameSize.getY()); } _codec1.initSize(_frameSize, r); @@ -696,14 +695,14 @@ void SmushPlayer::handleFrameObject(Chunk & b) { } } -void SmushPlayer::handleFrame(Chunk & b) { +void SmushPlayer::handleFrame(Chunk &b) { checkBlock(b, TYPE_FRME); debug(6, "SmushPlayer::handleFrame(%d)", _frame); _alreadyInit = false; _skipNext = false; while(!b.eof()) { - Chunk * sub = b.subBlock(); + Chunk *sub = b.subBlock(); if(sub->getSize() & 1) b.seek(1); switch(sub->getType()) { case TYPE_NPAL: @@ -756,7 +755,7 @@ void SmushPlayer::handleFrame(Chunk & b) { _frame++; } -void SmushPlayer::handleAnimHeader(Chunk & b) { +void SmushPlayer::handleAnimHeader(Chunk &b) { checkBlock(b, TYPE_AHDR, 774); debug(6, "SmushPlayer::handleAnimHeader()"); _version = b.getWord(); @@ -785,7 +784,7 @@ void SmushPlayer::handleAnimHeader(Chunk & b) { } } -static StringResource * getStrings(const char * file, const char * directory, bool is_encoded) { +static StringResource *getStrings(const char *file, const char *directory, bool is_encoded) { debug(7, "trying to read text ressources from %s", file); File theFile; @@ -794,7 +793,7 @@ static StringResource * getStrings(const char * file, const char * directory, bo return 0; } int32 length = theFile.size(); - char * filebuffer = new char [length + 1]; + char *filebuffer = new char [length + 1]; assert(filebuffer); theFile.read(filebuffer, length); filebuffer[length] = 0; @@ -809,7 +808,7 @@ static StringResource * getStrings(const char * file, const char * directory, bo return getStrings(file, directory, false); } - char * old = filebuffer; + char *old = filebuffer; filebuffer = new char[length - ETRS_HEADER_LENGTH + 1]; for(int32 i = ETRS_HEADER_LENGTH; i < length; i++) { filebuffer[i - ETRS_HEADER_LENGTH] = old[i] ^ 0xCC; @@ -818,15 +817,15 @@ static StringResource * getStrings(const char * file, const char * directory, bo delete []old; length -= ETRS_HEADER_LENGTH; } - StringResource * sr = new StringResource; + StringResource *sr = new StringResource; assert(sr); sr->init(filebuffer, length); delete []filebuffer; return sr; } -bool SmushPlayer::readString(const char * file, const char * directory, bool & ft) { - const char * i = strrchr(file, '.'); +bool SmushPlayer::readString(const char *file, const char *directory, bool &ft) { + const char *i = strrchr(file, '.'); if(i == NULL) { error("invalid filename : %s", file); } @@ -845,17 +844,17 @@ bool SmushPlayer::readString(const char * file, const char * directory, bool & f return false; } -static FontRenderer *loadFont(const char * file, const char * directory, bool original = false) { +static FontRenderer *loadFont(const char *file, const char *directory, bool original = false) { #ifdef DEBUG debug(5, "loading font from \"%s\"", file); #endif - FontRenderer * fr = new FontRenderer(original); + FontRenderer *fr = new FontRenderer(original); SmushPlayer p(fr, false, false); p.play(file, directory); return fr; } -bool SmushPlayer::play(const char * file, const char * directory) { +bool SmushPlayer::play(const char *file, const char *directory) { #ifdef DEBUG debug(5, "start of animation : %s", file); #endif @@ -875,7 +874,7 @@ bool SmushPlayer::play(const char * file, const char * directory) { } else { for(int i = 0; i < 4; i++) { char file_font[11]; - sprintf((char*)&file_font, "font%d.nut", i); + sprintf((char *)&file_font, "font%d.nut", i); _fr[i] = loadFont(file_font, directory, i != 0); } } @@ -883,7 +882,7 @@ bool SmushPlayer::play(const char * file, const char * directory) { if(g_scumm->_gameId == GID_CMI) { for(int i = 0; i < 5; i++) { char file_font[11]; - sprintf((char*)&file_font, "font%d.nut", i); + sprintf((char *)&file_font, "font%d.nut", i); _fr[i] = loadFont(file_font, directory, false); } } @@ -902,7 +901,7 @@ bool SmushPlayer::play(const char * file, const char * directory) { checkBlock(base, TYPE_ANIM); while(!base.eof()) { - Chunk * sub = base.subBlock(); + Chunk *sub = base.subBlock(); switch(sub->getType()) { case TYPE_AHDR: handleAnimHeader(*sub); diff --git a/scumm/smush/player.h b/scumm/smush/player.h index 8a5e15d450..869f33874b 100644 --- a/scumm/smush/player.h +++ b/scumm/smush/player.h @@ -43,17 +43,17 @@ class StringResource; */ class SmushPlayer { private: - char * _fname; //!< the name of the animation file being played + char *_fname; //!< the name of the animation file being played int32 _version; //!< the version of the animation file being played int32 _secondaryVersion; //!< the secondary version number of the animation file being played int32 _soundFrequency; //!< the sound frequency of the animation file being played int32 _nbframes; //!< the number of frames in the animation file - Mixer * _mixer; //!< the sound mixer + Mixer *_mixer; //!< the sound mixer Palette _pal; //!< the current palette int16 _deltaPal[768]; //!< the delta palette information set by an xpal - Renderer * _renderer; //!< pointer to the ::renderer - StringResource * _strings; //!< pointer to the string resources associated with the animation - FontRenderer * _fr[5]; //!< pointers to the fonts for the animation + Renderer *_renderer; //!< pointer to the ::renderer + StringResource *_strings; //!< pointer to the string resources associated with the animation + FontRenderer *_fr[5]; //!< pointers to the fonts for the animation Codec1Decoder _codec1; //!< the ::decoder for codec 1 and 3 Codec37Decoder _codec37; //!< the ::decoder for codec 37 Codec47Decoder _codec47; //!< the ::decoder for codec 47 @@ -69,7 +69,7 @@ private: bool _bgmusic; //!< should the player output the background music ? bool _voices; //!< should the player output the voice ? bool _skips[37]; //!< mapping of frame object identifier to show or hide - char * _curBuffer; //!< pointer to the current frame + char *_curBuffer; //!< pointer to the current frame int32 _IACTchannel; byte _IACToutput[4096]; int32 _IACTpos; @@ -79,12 +79,12 @@ private: public: SmushPlayer(Renderer *, bool wait = true, bool output_sound = true); virtual ~SmushPlayer(); - bool play(const char *, const char * directory); + bool play(const char *, const char *directory); void updatePalette(void); void show(const char *); void hide(const char *); protected: - bool readString(const char * file, const char * directory, bool &); + bool readString(const char *file, const char *directory, bool &); void clean(); void checkBlock(const Chunk &, Chunk::type, uint32 = 0); void handleAnimHeader(Chunk &); diff --git a/scumm/smush/renderer.h b/scumm/smush/renderer.h index f9ccc04ac1..c5a2bdc214 100644 --- a/scumm/smush/renderer.h +++ b/scumm/smush/renderer.h @@ -50,7 +50,7 @@ public: @return true if initialisation was ok, false otherwise */ - virtual bool startDecode(const char * fname, int32 version, int32 nbframes) = 0; + virtual bool startDecode(const char *fname, int32 version, int32 nbframes) = 0; /*! @brief start of animation output This is called by the animation player when the frame size is changing. @@ -77,7 +77,7 @@ public: @return a pointer to the frame buffer to output data to. */ - virtual char * lockFrame(int32 frame) = 0; + virtual char *lockFrame(int32 frame) = 0; /*! @brief unlock a frame buffer This is called by the animation player when a frame has been decoded. @@ -114,7 +114,7 @@ public: @return a valid pointer to an uninitialized mixer instance, or null if none is available. */ - virtual Mixer * getMixer() = 0; + virtual Mixer *getMixer() = 0; /*! @brief debugging function : do not use @return true if everything went fine, false otherwise diff --git a/scumm/smush/saud_channel.cpp b/scumm/smush/saud_channel.cpp index d2def835df..7aea4a98b6 100644 --- a/scumm/smush/saud_channel.cpp +++ b/scumm/smush/saud_channel.cpp @@ -28,23 +28,23 @@ #include <assert.h> #include <string.h> -void SaudChannel::handleStrk(Chunk & b) { +void SaudChannel::handleStrk(Chunk &b) { int32 size = b.getSize(); if(size != 14 && size != 10) { error("STRK has a invalid size : %d", size); } } -void SaudChannel::handleSmrk(Chunk & b) { +void SaudChannel::handleSmrk(Chunk &b) { _markReached = true; } -void SaudChannel::handleShdr(Chunk & b) { +void SaudChannel::handleShdr(Chunk &b) { int32 size = b.getSize(); if(size != 4) warning("SMRK has a invalid size : %d", size); } -bool SaudChannel::handleSubTags(int32 & offset) { +bool SaudChannel::handleSubTags(int32 &offset) { if(_tbufferSize - offset >= 8) { Chunk::type type = READ_BE_UINT32(_tbuffer + offset); uint32 size = READ_BE_UINT32(_tbuffer + offset + 4); @@ -147,7 +147,7 @@ bool SaudChannel::processBuffer() { _tbufferSize = 0; } else { if(offset) { // maybe I should assert() this to avoid a lock... - unsigned char * old = _tbuffer; + unsigned char *old = _tbuffer; int32 new_size = _tbufferSize - offset; _tbuffer = new byte[new_size]; if(!_tbuffer) error("SaudChannel failed to allocate memory"); @@ -161,16 +161,16 @@ bool SaudChannel::processBuffer() { } SaudChannel::SaudChannel(int32 track, int32 freq) : - _track(track), - _nbframes(0), - _dataSize(-1), - _frequency(freq), - _inData(false), - _markReached(false), - _tbuffer(0), - _tbufferSize(0), - _sbuffer(0), - _sbufferSize(0) + _track(track), + _nbframes(0), + _dataSize(-1), + _frequency(freq), + _inData(false), + _markReached(false), + _tbuffer(0), + _tbufferSize(0), + _sbuffer(0), + _sbufferSize(0) { } @@ -231,7 +231,7 @@ bool SaudChannel::checkParameters(int32 index, int32 nb, int32 flags, int32 volu return true; } -bool SaudChannel::appendData(Chunk & b, int32 size) { +bool SaudChannel::appendData(Chunk &b, int32 size) { if(_dataSize == -1) { // First call assert(size > 8); Chunk::type saud_type = b.getDword(); saud_type = SWAP_BYTES(saud_type); @@ -241,7 +241,7 @@ bool SaudChannel::appendData(Chunk & b, int32 size) { _dataSize = -2; // We don't get here again... } if(_tbuffer) { - byte * old = _tbuffer; + byte *old = _tbuffer; _tbuffer = new byte[_tbufferSize + size]; if(!_tbuffer) error("saud_channel failed to allocate memory"); memcpy(_tbuffer, old, _tbufferSize); @@ -261,7 +261,7 @@ int32 SaudChannel::availableSoundData(void) const { return _sbufferSize; } -void SaudChannel::getSoundData(int16 * snd, int32 size) { +void SaudChannel::getSoundData(int16 *snd, int32 size) { for(int32 i = 0; i < size; i++) { snd[2 * i] = _voltable[0][_sbuffer[i] ^ 0x80]; snd[2 * i + 1] = _voltable[1][_sbuffer[i] ^ 0x80]; diff --git a/scumm/smush/scumm_renderer.cpp b/scumm/smush/scumm_renderer.cpp index 39836cea23..e26ec6d45d 100644 --- a/scumm/smush/scumm_renderer.cpp +++ b/scumm/smush/scumm_renderer.cpp @@ -32,10 +32,10 @@ class ScummMixer : public Mixer { private: - SoundMixer * _mixer; //!< pointer to the SoundMixer instance + SoundMixer *_mixer; //!< pointer to the SoundMixer instance struct { int id; - _Channel * chan; + _Channel *chan; bool first; int mixer_index; } _channels[SoundMixer::NUM_CHANNELS]; //!< The map of track and channels @@ -44,15 +44,15 @@ public: ScummMixer(SoundMixer *); virtual ~ScummMixer(); bool init(); - _Channel * findChannel(int32 track); - bool addChannel(_Channel * c); + _Channel *findChannel(int32 track); + bool addChannel(_Channel *c); bool handleFrame(); bool stop(); bool update(); bool _silentMixer; }; -ScummMixer::ScummMixer(SoundMixer * m) : _mixer(m), _nextIndex(_mixer->_beginSlots) { +ScummMixer::ScummMixer(SoundMixer *m) : _mixer(m), _nextIndex(_mixer->_beginSlots) { for(int32 i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) { _channels[i].id = -1; _channels[i].chan = 0; @@ -68,7 +68,7 @@ bool ScummMixer::init() { return true; } -_Channel * ScummMixer::findChannel(int32 track) { +_Channel *ScummMixer::findChannel(int32 track) { debug(9, "scumm_mixer::findChannel(%d)", track); for(int32 i = _mixer->_beginSlots; i < SoundMixer::NUM_CHANNELS; i++) { if(_channels[i].id == track) @@ -77,7 +77,7 @@ _Channel * ScummMixer::findChannel(int32 track) { return 0; } -bool ScummMixer::addChannel(_Channel * c) { +bool ScummMixer::addChannel(_Channel *c) { int32 track = c->getTrackIdentifier(); int i; @@ -143,7 +143,7 @@ bool ScummMixer::handleFrame() { if(is_short) { // FIXME this is one more data copy... we could get rid of it... - short * data = new int16[size * (stereo ? 2 : 1) * 2]; + short *data = new int16[size * (stereo ? 2 : 1) * 2]; _channels[i].chan->getSoundData(data, size); if(_channels[i].chan->getRate() == 11025) size *= 2; size *= stereo ? 4 : 2; @@ -161,7 +161,7 @@ bool ScummMixer::handleFrame() { delete []data; } else { - int8 * data = new int8[size * (stereo ? 2 : 1) * 2]; + int8 *data = new int8[size * (stereo ? 2 : 1) * 2]; _channels[i].chan->getSoundData(data, size); if(_channels[i].chan->getRate() == 11025) size *= 2; size *= stereo ? 2 : 1; @@ -196,20 +196,20 @@ bool ScummMixer::stop() { return true; } -ScummRenderer::ScummRenderer(Scumm * scumm, uint32 speed) : +ScummRenderer::ScummRenderer(Scumm *scumm, uint32 speed) : _scumm(scumm), _smixer(0), _insaneSpeed(speed), _pending_updates(0) { } -static ScummRenderer * s_renderer; +static ScummRenderer *s_renderer; -static void smush_handler(void * engine) { +static void smush_handler(void *engine) { s_renderer->update(); } -Mixer * ScummRenderer::getMixer() { +Mixer *ScummRenderer::getMixer() { if(_smixer == 0) { _smixer = new ScummMixer(_scumm->_mixer); if(!_smixer) error("unable to allocate a smush mixer"); @@ -254,7 +254,7 @@ bool ScummRenderer::wait(int32 ms) { return true; } -bool ScummRenderer::startDecode(const char * fname, int32 version, int32 nbframes) { +bool ScummRenderer::startDecode(const char *fname, int32 version, int32 nbframes) { if (_scumm->_imuseDigital) { _scumm->_imuseDigital->pause(true); } @@ -264,7 +264,7 @@ bool ScummRenderer::startDecode(const char * fname, int32 version, int32 nbframe return true; } -bool ScummRenderer::setPalette(const Palette & pal) { +bool ScummRenderer::setPalette(const Palette &pal) { int i; byte palette_colors[1024]; byte *p = palette_colors; @@ -284,7 +284,6 @@ bool ScummRenderer::setPalette(const Palette & pal) { void ScummRenderer::save(int32 frame) { int width = MIN(getWidth(), _scumm->_realWidth); int height = MIN(getHeight(), _scumm->_realHeight); - // In theory, this will always be true. In reality, there may be // several pending updates because the computer wasn't fast enough to diff --git a/scumm/smush/scumm_renderer.h b/scumm/smush/scumm_renderer.h index 48b770dc96..078fbee39b 100644 --- a/scumm/smush/scumm_renderer.h +++ b/scumm/smush/scumm_renderer.h @@ -42,20 +42,20 @@ class Mixer; class ScummRenderer : public BaseRenderer { private: - Scumm * _scumm; - ScummMixer * _smixer; + Scumm *_scumm; + ScummMixer *_smixer; uint32 _insaneSpeed; volatile int _pending_updates; public: - ScummRenderer(Scumm * scumm, uint32 speed); + ScummRenderer(Scumm *scumm, uint32 speed); virtual ~ScummRenderer(); virtual bool wait(int32 ms); bool update(); protected: - virtual bool startDecode(const char * fname, int32 version, int32 nbframes); + virtual bool startDecode(const char *fname, int32 version, int32 nbframes); virtual bool setPalette(const Palette & pal); virtual void save(int32 frame = -1); - virtual Mixer * getMixer(); + virtual Mixer *getMixer(); virtual bool prematureClose(); }; |