code simplification

svn-id: r10762
This commit is contained in:
Max Horn 2003-10-12 17:33:29 +00:00
parent 7747ef28d3
commit fafb90ddb5
6 changed files with 12 additions and 21 deletions

View file

@ -1770,7 +1770,7 @@ void Gdi::unkDecodeA(byte *dst, const byte *src, int height) {
int x = 8; int x = 8;
do { do {
FILL_BITS; FILL_BITS;
*dst++ = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; *dst++ = _vm->_roomPalette[color + _palette_mod];
againPos: againPos:
if (!READ_BIT) { if (!READ_BIT) {
@ -1795,7 +1795,7 @@ void Gdi::unkDecodeA(byte *dst, const byte *src, int height) {
if (!--height) if (!--height)
return; return;
} }
*dst++ = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; *dst++ = _vm->_roomPalette[color + _palette_mod];
} while (--reps); } while (--reps);
bits >>= 8; bits >>= 8;
bits |= (*src++) << (cl - 8); bits |= (*src++) << (cl - 8);
@ -1819,7 +1819,7 @@ void Gdi::unkDecodeA_trans(byte *dst, const byte *src, int height) {
do { do {
FILL_BITS; FILL_BITS;
if (color != _transparentColor) if (color != _transparentColor)
*dst = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; *dst = _vm->_roomPalette[color + _palette_mod];
dst++; dst++;
againPos: againPos:
@ -1846,7 +1846,7 @@ void Gdi::unkDecodeA_trans(byte *dst, const byte *src, int height) {
return; return;
} }
if (color != _transparentColor) if (color != _transparentColor)
*dst = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; *dst = _vm->_roomPalette[color + _palette_mod];
dst++; dst++;
} while (--reps); } while (--reps);
bits >>= 8; bits >>= 8;
@ -1870,7 +1870,7 @@ void Gdi::unkDecodeB(byte *dst, const byte *src, int height) {
int x = 8; int x = 8;
do { do {
FILL_BITS; 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) { if (!READ_BIT) {
} else if (!READ_BIT) { } else if (!READ_BIT) {
FILL_BITS; FILL_BITS;
@ -1901,7 +1901,7 @@ void Gdi::unkDecodeB_trans(byte *dst, const byte *src, int height) {
do { do {
FILL_BITS; FILL_BITS;
if (color != _transparentColor) if (color != _transparentColor)
*dst = (_vm->_features & GF_SMALL_HEADER) ? _vm->_roomPalette[color + _palette_mod] : color + _palette_mod; *dst = _vm->_roomPalette[color + _palette_mod];
dst++; dst++;
if (!READ_BIT) { if (!READ_BIT) {
} else if (!READ_BIT) { } else if (!READ_BIT) {
@ -1933,7 +1933,7 @@ void Gdi::unkDecodeC(byte *dst, const byte *src, int height) {
int h = height; int h = height;
do { do {
FILL_BITS; 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; dst += _vm->_screenWidth;
if (!READ_BIT) { if (!READ_BIT) {
} else if (!READ_BIT) { } else if (!READ_BIT) {
@ -1966,7 +1966,7 @@ void Gdi::unkDecodeC_trans(byte *dst, const byte *src, int height) {
do { do {
FILL_BITS; FILL_BITS;
if (color != _transparentColor) 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; dst += _vm->_screenWidth;
if (!READ_BIT) { if (!READ_BIT) {
} else if (!READ_BIT) { } else if (!READ_BIT) {

View file

@ -196,7 +196,6 @@ void ScummEngine_v2::readMAXS() {
_shadowPaletteSize = 256; _shadowPaletteSize = 256;
_roomPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later
_shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later _shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later
allocateArrays(); allocateArrays();
} }

View file

@ -208,7 +208,6 @@ void ScummEngine_v3::readMAXS() {
_shadowPaletteSize = 256; _shadowPaletteSize = 256;
_roomPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later
_shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later _shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later
allocateArrays(); allocateArrays();
} }

View file

@ -615,7 +615,7 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
s->saveLoadArrayOf(_shadowPalette, _shadowPaletteSize, 1, sleByte); s->saveLoadArrayOf(_shadowPalette, _shadowPaletteSize, 1, sleByte);
// _roomPalette didn't show up until V21 save games // _roomPalette didn't show up until V21 save games
if (savegameVersion >= VER(21) && _version < 5) 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 // PalManip data was not saved before V10 save games

View file

@ -950,7 +950,7 @@ protected:
public: public:
byte _proc_special_palette[256]; byte _proc_special_palette[256];
byte *_roomPalette; byte _roomPalette[256];
byte *_shadowPalette; byte *_shadowPalette;
protected: protected:

View file

@ -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? // Init all vars - maybe now we can get rid of our custom new/delete operators?
_imuse = NULL; _imuse = NULL;
_imuseDigital = NULL; _imuseDigital = NULL;
_musicEngine = NULL;
_features = 0; _features = 0;
_verbs = NULL; _verbs = NULL;
_objs = NULL; _objs = NULL;
@ -429,7 +430,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst)
_palManipPalette = NULL; _palManipPalette = NULL;
_palManipIntermediatePal = NULL; _palManipIntermediatePal = NULL;
memset(gfxUsageBits, 0, sizeof(gfxUsageBits)); memset(gfxUsageBits, 0, sizeof(gfxUsageBits));
_roomPalette = NULL;
_shadowPalette = NULL; _shadowPalette = NULL;
_shadowPaletteSize = 0; _shadowPaletteSize = 0;
memset(_currentPalette, 0, sizeof(_currentPalette)); memset(_currentPalette, 0, sizeof(_currentPalette));
@ -664,9 +664,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst)
_mixer->setMusicVolume(kDefaultMusicVolume); _mixer->setMusicVolume(kDefaultMusicVolume);
// Init iMuse // Init iMuse
_imuse = NULL;
_imuseDigital = NULL;
_musicEngine = NULL;
if (_features & GF_DIGI_IMUSE) { if (_features & GF_DIGI_IMUSE) {
_musicEngine = _imuseDigital = new IMuseDigital(this); _musicEngine = _imuseDigital = new IMuseDigital(this);
#ifndef __PALM_OS__ #ifndef __PALM_OS__
@ -754,8 +751,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst)
fp.close(); fp.close();
} }
} }
_audioNames = NULL;
} }
ScummEngine::~ScummEngine() { ScummEngine::~ScummEngine() {
@ -780,7 +775,6 @@ ScummEngine::~ScummEngine() {
delete _costumeRenderer; delete _costumeRenderer;
free(_roomPalette);
free(_shadowPalette); free(_shadowPalette);
freeResources(); freeResources();
@ -1900,8 +1894,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
if (_version < 7) { if (_version < 7) {
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i++) {
if (_features & GF_SMALL_HEADER) _roomPalette[i] = i;
_roomPalette[i] = i;
_shadowPalette[i] = i; _shadowPalette[i] = i;
} }
if (_features & GF_SMALL_HEADER) if (_features & GF_SMALL_HEADER)