diff options
-rw-r--r-- | common/savefile.cpp | 16 | ||||
-rw-r--r-- | common/stream.h | 52 | ||||
-rw-r--r-- | scumm/util.cpp | 10 | ||||
-rw-r--r-- | scumm/util.h | 12 | ||||
-rw-r--r-- | sound/mixer.h | 2 | ||||
-rw-r--r-- | sword2/driver/d_sound.cpp | 16 |
6 files changed, 55 insertions, 53 deletions
diff --git a/common/savefile.cpp b/common/savefile.cpp index aa6e54b9f1..8f24db7686 100644 --- a/common/savefile.cpp +++ b/common/savefile.cpp @@ -79,11 +79,11 @@ public: bool isOpen() const { return fh != 0; } - uint32 read(void *buf, uint32 cnt) { - return ::fread(buf, 1, cnt, fh); + uint32 read(void *dataPtr, uint32 dataSize) { + return ::fread(dataPtr, 1, dataSize, fh); } - uint32 write(const void *buf, uint32 cnt) { - return ::fwrite(buf, 1, cnt, fh); + uint32 write(const void *dataPtr, uint32 dataSize) { + return ::fwrite(dataPtr, 1, dataSize, fh); } }; @@ -109,13 +109,13 @@ public: bool isOpen() const { return fh != 0; } - uint32 read(void *buf, uint32 cnt) { - int ret = ::gzread(fh, buf, cnt); + uint32 read(void *dataPtr, uint32 dataSize) { + int ret = ::gzread(fh, dataPtr, dataSize); if (ret <= -1) _ioError = true; return ret; } - uint32 write(const void *buf, uint32 cnt) { + uint32 write(const void *dataPtr, uint32 dataSize) { // Due to a "bug" in the zlib headers (or maybe I should say, // a bug in the C++ spec? Whatever <g>) we have to be a bit // hackish here and remove the const qualifier. @@ -123,7 +123,7 @@ public: // which you might think is the same as "const void *" but it // is not - rather it is equal to "void const *" which is the // same as "void *". Hrmpf - int ret = ::gzwrite(fh, const_cast<void *>(buf), cnt); + int ret = ::gzwrite(fh, const_cast<void *>(dataPtr), dataSize); if (ret <= 0) _ioError = true; return ret; diff --git a/common/stream.h b/common/stream.h index 86287e482f..b9b64bbfd7 100644 --- a/common/stream.h +++ b/common/stream.h @@ -60,11 +60,11 @@ public: * Write data into the stream. Subclasses must implement this * method; all other write methods are implemented using it. * - * @param ptr pointer to the data to be written - * @param size number of bytes to be written + * @param dataPtr pointer to the data to be written + * @param dataSize number of bytes to be written * @return the number of bytes which were actually written. */ - virtual uint32 write(const void *ptr, uint32 size) = 0; + virtual uint32 write(const void *dataPtr, uint32 dataSize) = 0; // The remaining methods all have default implementations; subclasses @@ -132,11 +132,11 @@ public: * Read data from the stream. Subclasses must implement this * method; all other read methods are implemented using it. * - * @param ptr pointer to a buffer into which the data is read - * @param size number of bytes to be read + * @param dataPtr pointer to a buffer into which the data is read + * @param dataSize number of bytes to be read * @return the number of bytes which were actually read. */ - virtual uint32 read(void *ptr, uint32 size) = 0; + virtual uint32 read(void *dataPtr, uint32 dataSize) = 0; // The remaining methods all have default implementations; subclasses @@ -215,7 +215,7 @@ public: * This method is a rough analog of the (f)gets function. * * @param buf the buffer to store into - * @param size the size of the buffer + * @param bufSize the size of the buffer * @return a pointer to the read string, or NULL if an error occured * @note The line terminator (CR or CR/LF) is stripped and not inserted * into the buffer. @@ -245,11 +245,11 @@ public: virtual bool ioFailed() const { return _realStream->ioFailed(); } virtual void clearIOFailed() { _realStream->clearIOFailed(); } - uint32 read(void *ptr, uint32 size) { + uint32 read(void *dataPtr, uint32 dataSize) { assert(_realStream); - uint32 len = _realStream->read(ptr, size); + uint32 len = _realStream->read(dataPtr, dataSize); if (_encbyte) { - byte *p = (byte *)ptr; + byte *p = (byte *)dataPtr; byte *end = p + len; while (p < end) *p++ ^= _encbyte; @@ -275,23 +275,23 @@ public: void setEnc(byte value) { _encbyte = value; } - uint32 read(void *ptr, uint32 len) { + uint32 read(void *dataPtr, uint32 dataSize) { // Read at most as many bytes as are still available... - if (len > _bufSize - _pos) - len = _bufSize - _pos; - memcpy(ptr, _ptr, len); + if (dataSize > _bufSize - _pos) + dataSize = _bufSize - _pos; + memcpy(dataPtr, _ptr, dataSize); if (_encbyte) { - byte *p = (byte *)ptr; - byte *end = p + len; + byte *p = (byte *)dataPtr; + byte *end = p + dataSize; while (p < end) *p++ ^= _encbyte; } - _ptr += len; - _pos += len; + _ptr += dataSize; + _pos += dataSize; - return len; + return dataSize; } bool eos() const { return _pos == _bufSize; } @@ -314,14 +314,14 @@ private: public: MemoryWriteStream(byte *buf, uint32 len) : _ptr(buf), _ptrOrig(buf), _bufSize(len), _pos(0) {} - uint32 write(const void *ptr, uint32 len) { + uint32 write(const void *dataPtr, uint32 dataSize) { // Write at most as many bytes as are still available... - if (len > _bufSize - _pos) - len = _bufSize - _pos; - memcpy(_ptr, ptr, len); - _ptr += len; - _pos += len; - return len; + if (dataSize > _bufSize - _pos) + dataSize = _bufSize - _pos; + memcpy(_ptr, dataPtr, dataSize); + _ptr += dataSize; + _pos += dataSize; + return dataSize; } bool eos() const { return _pos == _bufSize; } diff --git a/scumm/util.cpp b/scumm/util.cpp index 2df1c8193b..aa8b9d0a45 100644 --- a/scumm/util.cpp +++ b/scumm/util.cpp @@ -151,28 +151,28 @@ void ScummFile::seek(int32 offs, int whence) { File::seek(offs, whence); } -uint32 ScummFile::read(void *ptr, uint32 len) { +uint32 ScummFile::read(void *dataPtr, uint32 dataSize) { uint32 realLen; if (_subFileLen) { // Limit the amount we read by the subfile boundaries. const uint32 curPos = pos(); assert(_subFileLen >= curPos); - uint32 newPos = curPos + len; + uint32 newPos = curPos + dataSize; if (newPos > _subFileLen) { - len = _subFileLen - curPos; + dataSize = _subFileLen - curPos; _ioFailed = true; } } - realLen = File::read(ptr, len); + realLen = File::read(dataPtr, dataSize); // If an encryption byte was specified, XOR the data we just read by it. // This simple kind of "encryption" was used by some of the older SCUMM // games. if (_encbyte) { - byte *p = (byte *)ptr; + byte *p = (byte *)dataPtr; byte *end = p + realLen; while (p < end) *p++ ^= _encbyte; diff --git a/scumm/util.h b/scumm/util.h index c2d3af92cb..7fbf4035dd 100644 --- a/scumm/util.h +++ b/scumm/util.h @@ -38,8 +38,8 @@ public: virtual uint32 pos() = 0; virtual uint32 size() = 0; virtual void seek(int32 offs, int whence = SEEK_SET) = 0; - virtual uint32 read(void *ptr, uint32 size) = 0; - virtual uint32 write(const void *ptr, uint32 size) = 0; + virtual uint32 read(void *dataPtr, uint32 dataSize) = 0; + virtual uint32 write(const void *dataPtr, uint32 dataSize) = 0; }; class ScummFile : public BaseScummFile { @@ -61,8 +61,8 @@ public: uint32 pos(); uint32 size(); void seek(int32 offs, int whence = SEEK_SET); - uint32 read(void *ptr, uint32 size); - uint32 write(const void *ptr, uint32 size); + uint32 read(void *dataPtr, uint32 dataSize); + uint32 write(const void *dataPtr, uint32 dataSize); }; class ScummNESFile : public BaseScummFile { @@ -104,8 +104,8 @@ public: uint32 pos() { return _stream->pos(); } uint32 size() { return _stream->size(); } void seek(int32 offs, int whence = SEEK_SET) { _stream->seek(offs, whence); } - uint32 read(void *ptr, uint32 len) { return _stream->read(ptr, len); } - uint32 write(const void *ptr, uint32 size); + uint32 read(void *dataPtr, uint32 dataSize) { return _stream->read(dataPtr, dataSize); } + uint32 write(const void *dataPtr, uint32 dataSize); }; diff --git a/sound/mixer.h b/sound/mixer.h index 39daad86ca..4d9dac8b1b 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -269,6 +269,7 @@ public: /** * Set the volume for the given sound type. * + * @param type the sound type * @param volume the new global volume, 0-kMaxMixerVolume */ void setVolumeForSoundType(SoundType type, int volume); @@ -276,6 +277,7 @@ public: /** * Query the global volume. * + * @param type the sound type * @return the global music volume, 0-kMaxMixerVolume */ int getVolumeForSoundType(SoundType type) const; diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 94afd8ba35..1432c14a31 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -525,7 +525,7 @@ void Sound::stopMusic(bool immediately) { /** * Streams music from a cluster file. * @param musicId the id of the music to stream - * @param looping true if the music is to loop back to the start + * @param loop true if the music is to loop back to the start * @return RD_OK or an error code */ int32 Sound::streamCompMusic(uint32 musicId, bool loop) { @@ -803,25 +803,25 @@ void Sound::muteFx(bool mute) { * @param pan panning */ -int32 Sound::setFxIdVolumePan(int32 i, int vol, int pan) { - if (!_fxQueue[i].resource) +int32 Sound::setFxIdVolumePan(int32 id, int vol, int pan) { + if (!_fxQueue[id].resource) return RDERR_FXNOTOPEN; if (vol > 16) vol = 16; - _fxQueue[i].volume = (vol * SoundMixer::kMaxChannelVolume) / 16; + _fxQueue[id].volume = (vol * SoundMixer::kMaxChannelVolume) / 16; if (pan != 255) { if (isReverseStereo()) pan = -pan; - _fxQueue[i].pan = (pan * 127) / 16; + _fxQueue[id].pan = (pan * 127) / 16; } - if (!_fxMuted && _vm->_mixer->isSoundHandleActive(_fxQueue[i].handle)) { - _vm->_mixer->setChannelVolume(_fxQueue[i].handle, _fxQueue[i].volume); + if (!_fxMuted && _vm->_mixer->isSoundHandleActive(_fxQueue[id].handle)) { + _vm->_mixer->setChannelVolume(_fxQueue[id].handle, _fxQueue[id].volume); if (pan != -1) - _vm->_mixer->setChannelBalance(_fxQueue[i].handle, _fxQueue[i].pan); + _vm->_mixer->setChannelBalance(_fxQueue[id].handle, _fxQueue[id].pan); } return RD_OK; |