From fafb90ddb5483a7e75fcf55ac591fe2e36ca1bb2 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 12 Oct 2003 17:33:29 +0000 Subject: code simplification svn-id: r10762 --- scumm/gfx.cpp | 16 ++++++++-------- scumm/resource_v2.cpp | 1 - scumm/resource_v3.cpp | 1 - scumm/saveload.cpp | 2 +- scumm/scumm.h | 2 +- scumm/scummvm.cpp | 11 ++--------- 6 files changed, 12 insertions(+), 21 deletions(-) (limited to 'scumm') diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 0202840b05..a7007e9d91 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -1770,7 +1770,7 @@ void Gdi::unkDecodeA(byte *dst, const byte *src, int height) { int x = 8; do { FILL_BITS; - *dst++ = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; + *dst++ = _vm->_roomPalette[color + _palette_mod]; againPos: if (!READ_BIT) { @@ -1795,7 +1795,7 @@ void Gdi::unkDecodeA(byte *dst, const byte *src, int height) { if (!--height) return; } - *dst++ = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; + *dst++ = _vm->_roomPalette[color + _palette_mod]; } while (--reps); bits >>= 8; bits |= (*src++) << (cl - 8); @@ -1819,7 +1819,7 @@ void Gdi::unkDecodeA_trans(byte *dst, const byte *src, int height) { do { FILL_BITS; if (color != _transparentColor) - *dst = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; + *dst = _vm->_roomPalette[color + _palette_mod]; dst++; againPos: @@ -1846,7 +1846,7 @@ void Gdi::unkDecodeA_trans(byte *dst, const byte *src, int height) { return; } if (color != _transparentColor) - *dst = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; + *dst = _vm->_roomPalette[color + _palette_mod]; dst++; } while (--reps); bits >>= 8; @@ -1870,7 +1870,7 @@ void Gdi::unkDecodeB(byte *dst, const byte *src, int height) { int x = 8; do { FILL_BITS; - *dst++ = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; + *dst++ = _vm->_roomPalette[color + _palette_mod]; if (!READ_BIT) { } else if (!READ_BIT) { FILL_BITS; @@ -1901,7 +1901,7 @@ void Gdi::unkDecodeB_trans(byte *dst, const byte *src, int height) { do { FILL_BITS; if (color != _transparentColor) - *dst = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; + *dst = _vm->_roomPalette[color + _palette_mod]; dst++; if (!READ_BIT) { } else if (!READ_BIT) { @@ -1933,7 +1933,7 @@ void Gdi::unkDecodeC(byte *dst, const byte *src, int height) { int h = height; do { FILL_BITS; - *dst = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; + *dst = _vm->_roomPalette[color + _palette_mod]; dst += _vm->_screenWidth; if (!READ_BIT) { } else if (!READ_BIT) { @@ -1966,7 +1966,7 @@ void Gdi::unkDecodeC_trans(byte *dst, const byte *src, int height) { do { FILL_BITS; if (color != _transparentColor) - *dst = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; + *dst = _vm->_roomPalette[color + _palette_mod]; dst += _vm->_screenWidth; if (!READ_BIT) { } else if (!READ_BIT) { diff --git a/scumm/resource_v2.cpp b/scumm/resource_v2.cpp index 2bfe44d588..36b5110dc9 100644 --- a/scumm/resource_v2.cpp +++ b/scumm/resource_v2.cpp @@ -196,7 +196,6 @@ void ScummEngine_v2::readMAXS() { _shadowPaletteSize = 256; - _roomPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later _shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later allocateArrays(); } diff --git a/scumm/resource_v3.cpp b/scumm/resource_v3.cpp index 308a044ae1..aa03f20ebc 100644 --- a/scumm/resource_v3.cpp +++ b/scumm/resource_v3.cpp @@ -208,7 +208,6 @@ void ScummEngine_v3::readMAXS() { _shadowPaletteSize = 256; - _roomPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later _shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later allocateArrays(); } diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp index a3d727bd7a..142e9417b4 100644 --- a/scumm/saveload.cpp +++ b/scumm/saveload.cpp @@ -615,7 +615,7 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) { s->saveLoadArrayOf(_shadowPalette, _shadowPaletteSize, 1, sleByte); // _roomPalette didn't show up until V21 save games if (savegameVersion >= VER(21) && _version < 5) - s->saveLoadArrayOf (_roomPalette, _shadowPaletteSize, 1, sleByte); + s->saveLoadArrayOf(_roomPalette, sizeof(_roomPalette), 1, sleByte); } // PalManip data was not saved before V10 save games diff --git a/scumm/scumm.h b/scumm/scumm.h index e8827602eb..9f04ddc9f1 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -950,7 +950,7 @@ protected: public: byte _proc_special_palette[256]; - byte *_roomPalette; + byte _roomPalette[256]; byte *_shadowPalette; protected: diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 9bffb621c6..4ce8451d91 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -276,6 +276,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst) // Init all vars - maybe now we can get rid of our custom new/delete operators? _imuse = NULL; _imuseDigital = NULL; + _musicEngine = NULL; _features = 0; _verbs = NULL; _objs = NULL; @@ -429,7 +430,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst) _palManipPalette = NULL; _palManipIntermediatePal = NULL; memset(gfxUsageBits, 0, sizeof(gfxUsageBits)); - _roomPalette = NULL; _shadowPalette = NULL; _shadowPaletteSize = 0; memset(_currentPalette, 0, sizeof(_currentPalette)); @@ -664,9 +664,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst) _mixer->setMusicVolume(kDefaultMusicVolume); // Init iMuse - _imuse = NULL; - _imuseDigital = NULL; - _musicEngine = NULL; if (_features & GF_DIGI_IMUSE) { _musicEngine = _imuseDigital = new IMuseDigital(this); #ifndef __PALM_OS__ @@ -754,8 +751,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst) fp.close(); } } - - _audioNames = NULL; } ScummEngine::~ScummEngine() { @@ -780,7 +775,6 @@ ScummEngine::~ScummEngine() { delete _costumeRenderer; - free(_roomPalette); free(_shadowPalette); freeResources(); @@ -1900,8 +1894,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { if (_version < 7) { for (i = 0; i < 256; i++) { - if (_features & GF_SMALL_HEADER) - _roomPalette[i] = i; + _roomPalette[i] = i; _shadowPalette[i] = i; } if (_features & GF_SMALL_HEADER) -- cgit v1.2.3