diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/bitstream.h | 9 | ||||
-rw-r--r-- | common/dct.cpp | 14 | ||||
-rw-r--r-- | common/debug-channels.h | 11 | ||||
-rw-r--r-- | common/debug.cpp | 16 | ||||
-rw-r--r-- | common/endian.h | 3 | ||||
-rw-r--r-- | common/math.h | 4 | ||||
-rw-r--r-- | common/rdft.cpp | 14 | ||||
-rw-r--r-- | common/scummsys.h | 5 | ||||
-rw-r--r-- | common/singleton.h | 4 | ||||
-rw-r--r-- | common/util.h | 2 |
10 files changed, 58 insertions, 24 deletions
diff --git a/common/bitstream.h b/common/bitstream.h index 0fe16b5beb..b789f2ac8d 100644 --- a/common/bitstream.h +++ b/common/bitstream.h @@ -52,6 +52,9 @@ public: /** Skip the specified amount of bits. */ virtual void skip(uint32 n) = 0; + /** Skip the bits to closest data value border. */ + virtual void align() = 0; + /** Read a bit from the bit stream. */ virtual uint32 getBit() = 0; @@ -276,6 +279,12 @@ public: getBit(); } + /** Skip the bits to closest data value border. */ + void align() { + while (_inValue) + getBit(); + } + /** Return the stream position in bits. */ uint32 pos() const { if (_stream->pos() == 0) diff --git a/common/dct.cpp b/common/dct.cpp index dea75f4c45..27e0c0bf41 100644 --- a/common/dct.cpp +++ b/common/dct.cpp @@ -73,7 +73,7 @@ void DCT::calc(float *data) { void DCT::calcDCTI(float *data) { int n = 1 << _bits; - float next = -0.5 * (data[0] - data[n]); + float next = -0.5f * (data[0] - data[n]); for (int i = 0; i < (n / 2); i++) { float tmp1 = data[i ]; @@ -87,7 +87,7 @@ void DCT::calcDCTI(float *data) { next += c; - tmp1 = (tmp1 + tmp2) * 0.5; + tmp1 = (tmp1 + tmp2) * 0.5f; data[i ] = tmp1 - s; data[n - i] = tmp1 + s; @@ -113,7 +113,7 @@ void DCT::calcDCTII(float *data) { s *= tmp1 - tmp2; - tmp1 = (tmp1 + tmp2) * 0.5; + tmp1 = (tmp1 + tmp2) * 0.5f; data[i ] = tmp1 + s; data[n - i - 1] = tmp1 - s; @@ -121,7 +121,7 @@ void DCT::calcDCTII(float *data) { _rdft->calc(data); - float next = data[1] * 0.5; + float next = data[1] * 0.5f; data[1] *= -1; @@ -143,7 +143,7 @@ void DCT::calcDCTIII(float *data) { int n = 1 << _bits; float next = data[n - 1]; - float inv_n = 1.0 / n; + float inv_n = 1.0f / n; for (int i = n - 2; i >= 2; i -= 2) { float val1 = data[i ]; @@ -184,7 +184,7 @@ void DCT::calcDSTI(float *data) { float s = SIN(n, 2 * i); s *= tmp1 + tmp2; - tmp1 = (tmp1 - tmp2) * 0.5; + tmp1 = (tmp1 - tmp2) * 0.5f; data[i ] = s + tmp1; data[n - i] = s - tmp1; @@ -194,7 +194,7 @@ void DCT::calcDSTI(float *data) { _rdft->calc(data); - data[0] *= 0.5; + data[0] *= 0.5f; for (int i = 1; i < (n - 2); i += 2) { data[i + 1] += data[i - 1]; diff --git a/common/debug-channels.h b/common/debug-channels.h index 83f416a3b8..1414a1053a 100644 --- a/common/debug-channels.h +++ b/common/debug-channels.h @@ -95,8 +95,6 @@ public: */ bool disableDebugChannel(const String &name); - - typedef List<DebugChannel> DebugChannelList; /** @@ -106,6 +104,15 @@ public: */ DebugChannelList listDebugChannels(); + /** + * Enable all debug channels. + */ + void enableAllDebugChannels(); + + /** + * Disable all debug channels. + */ + void disableAllDebugChannels(); /** * Test whether the given debug channel is enabled. diff --git a/common/debug.cpp b/common/debug.cpp index 58cc0287a8..182b28afdf 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -46,6 +46,11 @@ struct DebugLevelComperator { } // end of anonymous namespace bool DebugManager::addDebugChannel(uint32 channel, const String &name, const String &description) { + if (name.equalsIgnoreCase("all")) { + warning("Debug channel 'all' is reserved for internal use"); + return false; + } + if (gDebugChannels.contains(name)) warning("Duplicate declaration of engine debug channel '%s'", name.c_str()); @@ -85,7 +90,6 @@ bool DebugManager::disableDebugChannel(const String &name) { } } - DebugManager::DebugChannelList DebugManager::listDebugChannels() { DebugChannelList tmp; for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i) @@ -95,6 +99,16 @@ DebugManager::DebugChannelList DebugManager::listDebugChannels() { return tmp; } +void DebugManager::enableAllDebugChannels() { + for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i) + enableDebugChannel(i->_value.name); +} + +void DebugManager::disableAllDebugChannels() { + for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i) + disableDebugChannel(i->_value.name); +} + bool DebugManager::isDebugChannelEnabled(uint32 channel) { // Debug level 11 turns on all special debug level messages if (gDebugLevel == 11) diff --git a/common/endian.h b/common/endian.h index 529e7f5ac0..6d6563f802 100644 --- a/common/endian.h +++ b/common/endian.h @@ -92,8 +92,7 @@ return __builtin_bswap32(a); } -// test for MSVC 7 or newer -#elif defined(_MSC_VER) && _MSC_VER >= 1300 +#elif defined(_MSC_VER) FORCEINLINE uint32 SWAP_BYTES_32(uint32 a) { return _byteswap_ulong(a); diff --git a/common/math.h b/common/math.h index 04a0ba14fc..f91f7a2eec 100644 --- a/common/math.h +++ b/common/math.h @@ -108,11 +108,11 @@ inline int intLog2(uint32 v) { #endif inline float rad2deg(float rad) { - return rad * 180.0 / M_PI; + return rad * 180.0f / (float)M_PI; } inline float deg2rad(float deg) { - return deg * M_PI / 180.0; + return deg * (float)M_PI / 180.0f; } } // End of namespace Common diff --git a/common/rdft.cpp b/common/rdft.cpp index d30fdd55a1..89d39112e6 100644 --- a/common/rdft.cpp +++ b/common/rdft.cpp @@ -29,7 +29,7 @@ namespace Common { RDFT::RDFT(int bits, TransformType trans) : _bits(bits), _sin(bits), _cos(bits), _fft(0) { - assert ((_bits >= 4) && (_bits <= 16)); + assert((_bits >= 4) && (_bits <= 16)); _inverse = trans == IDFT_C2R || trans == DFT_C2R; _signConvention = trans == IDFT_R2C || trans == DFT_C2R ? 1 : -1; @@ -49,12 +49,12 @@ RDFT::~RDFT() { void RDFT::calc(float *data) { const int n = 1 << _bits; - const float k1 = 0.5; - const float k2 = 0.5 - _inverse; + const float k1 = 0.5f; + const float k2 = 0.5f - _inverse; if (!_inverse) { - _fft->permute((Complex *) data); - _fft->calc ((Complex *) data); + _fft->permute((Complex *)data); + _fft->calc ((Complex *)data); } Complex ev, od; @@ -91,8 +91,8 @@ void RDFT::calc(float *data) { data[0] *= k1; data[1] *= k1; - _fft->permute((Complex *) data); - _fft->calc ((Complex *) data); + _fft->permute((Complex *)data); + _fft->calc ((Complex *)data); } } diff --git a/common/scummsys.h b/common/scummsys.h index 1342b0cde6..c30bc4a52a 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -405,8 +405,13 @@ typedef unsigned int uint32; typedef signed int int32; typedef unsigned int uint; + #ifdef __PLAYSTATION2__ + typedef signed long int64; + typedef unsigned long uint64; + #else typedef signed long long int64; typedef unsigned long long uint64; + #endif #endif diff --git a/common/singleton.h b/common/singleton.h index 13bdb0c3a3..9bcd590183 100644 --- a/common/singleton.h +++ b/common/singleton.h @@ -44,8 +44,8 @@ private: * and you specialise makeInstance to return an instance of a subclass. */ //template<class T> -#if defined(_WIN32_WCE) || defined(_MSC_VER) || defined(__WINS__) -//FIXME evc4 and msvc7 doesn't like it as private member +#if defined(__WINS__) +//FIXME verify if __WINS__ needs this still public: #endif static T *makeInstance() { diff --git a/common/util.h b/common/util.h index 1c0e45662e..f51aa00925 100644 --- a/common/util.h +++ b/common/util.h @@ -72,7 +72,7 @@ template<typename T> inline void SWAP(T &a, T &b) { T tmp = a; a = b; b = tmp; } # define SCUMMVM_CURRENT_FUNCTION __PRETTY_FUNCTION__ #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) # define SCUMMVM_CURRENT_FUNCTION __func__ -#elif defined(_MSC_VER) && _MSC_VER >= 1300 +#elif defined(_MSC_VER) # define SCUMMVM_CURRENT_FUNCTION __FUNCTION__ #else # define SCUMMVM_CURRENT_FUNCTION "<unknown>" |