diff options
author | johndoe123 | 2011-09-19 08:25:23 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-05-08 20:39:39 +0200 |
commit | 71ea4d5877a58809b994fb906d81516541c6e8e6 (patch) | |
tree | 44dc756ce329c2b2479be678e3a143ac4ccf1a1a | |
parent | d24907d1bb1650093e4ff7f0d008ce87350226b6 (diff) | |
download | scummvm-rg350-71ea4d5877a58809b994fb906d81516541c6e8e6.tar.gz scummvm-rg350-71ea4d5877a58809b994fb906d81516541c6e8e6.tar.bz2 scummvm-rg350-71ea4d5877a58809b994fb906d81516541c6e8e6.zip |
NEVERHOOD: Merge Palette2 class into Palette
-rw-r--r-- | engines/neverhood/module1000.cpp | 18 | ||||
-rw-r--r-- | engines/neverhood/module1200.cpp | 7 | ||||
-rw-r--r-- | engines/neverhood/module1500.cpp | 11 | ||||
-rw-r--r-- | engines/neverhood/module1700.cpp | 18 | ||||
-rw-r--r-- | engines/neverhood/module2200.cpp | 62 | ||||
-rw-r--r-- | engines/neverhood/module3000.cpp | 19 | ||||
-rw-r--r-- | engines/neverhood/palette.cpp | 110 | ||||
-rw-r--r-- | engines/neverhood/palette.h | 19 |
8 files changed, 103 insertions, 161 deletions
diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp index 77620b89ff..cf215361c9 100644 --- a/engines/neverhood/module1000.cpp +++ b/engines/neverhood/module1000.cpp @@ -1682,7 +1682,6 @@ uint32 AsScene1004TrashCan::handleMessage(int messageNum, const MessageParam &pa Scene1004::Scene1004(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _paletteAreaStatus(-1) { - Palette2 *palette2; Sprite *tempSprite; _surfaceFlag = true; @@ -1693,13 +1692,12 @@ Scene1004::Scene1004(NeverhoodEngine *vm, Module *parentModule, int which) setBackground(0x50C03005); if (getGlobalVar(0x0D0A14D10)) { - palette2 = new Palette2(_vm, 0xA30BA329); - palette2->addBasePalette(0xA30BA329, 0, 256, 0); + _palette = new Palette(_vm, 0xA30BA329); + _palette->addBasePalette(0xA30BA329, 0, 256, 0); } else { - palette2 = new Palette2(_vm, 0x50C03005); - palette2->addBasePalette(0x50C03005, 0, 256, 0); + _palette = new Palette(_vm, 0x50C03005); + _palette->addBasePalette(0x50C03005, 0, 256, 0); } - _palette = palette2; _palette->usePalette(); addEntity(_palette); @@ -1770,14 +1768,14 @@ void Scene1004::updatePaletteArea() { if (_klayman->getY() < 150) { if (_paletteAreaStatus != 0) { _paletteAreaStatus = 0; - ((Palette2*)_palette)->addBasePalette(0x406B0D10, 0, 64, 0); - ((Palette2*)_palette)->startFadeToPalette(12); + _palette->addBasePalette(0x406B0D10, 0, 64, 0); + _palette->startFadeToPalette(12); } } else { if (_paletteAreaStatus != 1) { _paletteAreaStatus = 1; - ((Palette2*)_palette)->addBasePalette(0x24332243, 0, 64, 0); - ((Palette2*)_palette)->startFadeToPalette(12); + _palette->addBasePalette(0x24332243, 0, 64, 0); + _palette->startFadeToPalette(12); } } } diff --git a/engines/neverhood/module1200.cpp b/engines/neverhood/module1200.cpp index 9e198cc67c..3901f83eb9 100644 --- a/engines/neverhood/module1200.cpp +++ b/engines/neverhood/module1200.cpp @@ -1154,8 +1154,6 @@ Scene1202::Scene1202(NeverhoodEngine *vm, Module *parentModule, int which) _soundResource2(vm), _soundResource3(vm), _soundResource4(vm), _flag(true), _soundFlag(false), _counter(0), _index(-1) { - Palette2 *palette2; - SetMessageHandler(&Scene1202::handleMessage453C10); SetUpdateHandler(&Scene1202::update); @@ -1163,9 +1161,8 @@ Scene1202::Scene1202(NeverhoodEngine *vm, Module *parentModule, int which) setBackground(0x60210ED5); - palette2 = new Palette2(_vm, 0x60210ED5); - palette2->usePalette(); - _palette = palette2; + _palette = new Palette(_vm, 0x60210ED5); + _palette->usePalette(); addEntity(_palette); _paletteResource.load(0x60250EB5); diff --git a/engines/neverhood/module1500.cpp b/engines/neverhood/module1500.cpp index 5735f24a46..7c03e9b941 100644 --- a/engines/neverhood/module1500.cpp +++ b/engines/neverhood/module1500.cpp @@ -106,8 +106,6 @@ Scene1501::Scene1501(NeverhoodEngine *vm, Module *parentModule, uint32 backgroun debug("Create Scene1501(%08X, %08X, %d, %d)", backgroundFileHash, soundFileHash, countdown2, countdown3); - Palette2 *palette2; - SetUpdateHandler(&Scene1501::update); SetMessageHandler(&Scene1501::handleMessage); @@ -115,12 +113,11 @@ Scene1501::Scene1501(NeverhoodEngine *vm, Module *parentModule, uint32 backgroun setBackground(backgroundFileHash); - palette2 = new Palette2(_vm); - palette2->usePalette(); - _palette = palette2; + _palette = new Palette(_vm); + _palette->usePalette(); addEntity(_palette); - palette2->addBasePalette(backgroundFileHash, 0, 256, 0); - palette2->startFadeToPalette(12); + _palette->addBasePalette(backgroundFileHash, 0, 256, 0); + _palette->startFadeToPalette(12); /* if (soundFileHash != 0) { diff --git a/engines/neverhood/module1700.cpp b/engines/neverhood/module1700.cpp index baa37d015a..33e690813d 100644 --- a/engines/neverhood/module1700.cpp +++ b/engines/neverhood/module1700.cpp @@ -210,7 +210,6 @@ uint32 Class606::handleMessage(int messageNum, const MessageParam ¶m, Entity Scene1705::Scene1705(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _paletteArea(1) { - Palette2 *palette2; Sprite *tempSprite; setGlobalVar(0xE7498218, 1); @@ -225,11 +224,10 @@ Scene1705::Scene1705(NeverhoodEngine *vm, Module *parentModule, int which) setBackground(0x03118226); - palette2 = new Palette2(_vm, 0x03118226); - palette2->addBasePalette(0x91D3A391, 0, 64, 0); - palette2->copyBasePalette(0, 256, 0); - palette2->usePalette(); - _palette = palette2; + _palette = new Palette(_vm, 0x03118226); + _palette->addBasePalette(0x91D3A391, 0, 64, 0); + _palette->copyBasePalette(0, 256, 0); + _palette->usePalette(); addEntity(_palette); _mouseCursor = addSprite(new Mouse433(_vm, 0x18222039, NULL)); @@ -297,12 +295,12 @@ Scene1705::Scene1705(NeverhoodEngine *vm, Module *parentModule, int which) void Scene1705::update() { Scene::update(); if (_klayman->getX() < 224 && _paletteArea != 0) { - ((Palette2*)_palette)->addBasePalette(0xF2210C15, 0, 64, 0); - ((Palette2*)_palette)->startFadeToPalette(12); + _palette->addBasePalette(0xF2210C15, 0, 64, 0); + _palette->startFadeToPalette(12); _paletteArea = 0; } else if (_klayman->getX() >= 224 && _paletteArea == 0) { - ((Palette2*)_palette)->addBasePalette(0x91D3A391, 0, 64, 0); - ((Palette2*)_palette)->startFadeToPalette(12); + _palette->addBasePalette(0x91D3A391, 0, 64, 0); + _palette->startFadeToPalette(12); _paletteArea = 1; } } diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp index b637a39a05..2219679d06 100644 --- a/engines/neverhood/module2200.cpp +++ b/engines/neverhood/module2200.cpp @@ -1112,8 +1112,6 @@ Scene2202::Scene2202(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _soundResource1(vm), _soundResource2(vm), _isSolved(false), _leaveScene(false), _isTileMoving(false), _movingTileSprite(NULL), _doneMovingTileSprite(NULL) { - Palette2 *palette2; - // TODO initScene2201Vars(); SetMessageHandler(&Scene2202::handleMessage); SetUpdateHandler(&Scene2202::update); @@ -1121,10 +1119,9 @@ Scene2202::Scene2202(NeverhoodEngine *vm, Module *parentModule, int which) _surfaceFlag = true; setBackground(0x08100A0C); - palette2 = new Palette2(_vm, 0x08100A0C); - _palette = palette2; + _palette = new Palette(_vm, 0x08100A0C); _palette->usePalette(); - addEntity(palette2); + addEntity(_palette); _mouseCursor = addSprite(new Mouse435(_vm, 0x00A08089, 20, 620)); //DEBUG! @@ -1506,8 +1503,6 @@ uint32 SsScene2205DoorFrame::handleMessage(int messageNum, const MessageParam &p Scene2205::Scene2205(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true) { - Palette2 *palette2; - SetMessageHandler(&Scene2205::handleMessage); SetUpdateHandler(&Scene2205::update); @@ -1517,26 +1512,24 @@ Scene2205::Scene2205(NeverhoodEngine *vm, Module *parentModule, int which) if (getGlobalVar(0x4D080E54)) { _isLightOn = true; setBackground(0x0008028D); - palette2 = new Palette2(_vm, 0x0008028D); - _palette = palette2; + _palette = new Palette(_vm, 0x0008028D); _palette->usePalette(); - addEntity(palette2); + addEntity(_palette); _mouseCursor = addSprite(new Mouse433(_vm, 0x80289008, NULL)); _ssLightSwitch = new Class426(_vm, this, 0x2D339030, 0x2D309030, 100, 0); addSprite(_ssLightSwitch); } else { _isLightOn = false; setBackground(0xD00A028D); - palette2 = new Palette2(_vm, 0xD00A028D); - _palette = palette2; + _palette = new Palette(_vm, 0xD00A028D); _palette->usePalette(); - addEntity(palette2); + addEntity(_palette); _mouseCursor = addSprite(new Mouse433(_vm, 0xA0289D08, NULL)); _ssLightSwitch = new Class426(_vm, this, 0x2D339030, 0xDAC86E84, 100, 0); addSprite(_ssLightSwitch); } - palette2->addBasePalette(0xD00A028D, 0, 256, 0); + _palette->addBasePalette(0xD00A028D, 0, 256, 0); _ssDoorFrame = addSprite(new SsScene2205DoorFrame(_vm)); @@ -1598,12 +1591,12 @@ void Scene2205::update() { if (!getGlobalVar(0x4D080E54)) { if (_isKlaymanInLight && _klayman->getX() > 85) { - ((Palette2*)_palette)->addBasePalette(0x68033B1C, 0, 65, 0); - ((Palette2*)_palette)->startFadeToPalette(12); + _palette->addBasePalette(0x68033B1C, 0, 65, 0); + _palette->startFadeToPalette(12); _isKlaymanInLight = false; } else if (!_isKlaymanInLight && _klayman->getX() <= 85) { - ((Palette2*)_palette)->addBasePalette(0xD00A028D, 0, 65, 0); - ((Palette2*)_palette)->startFadeToPalette(12); + _palette->addBasePalette(0xD00A028D, 0, 65, 0); + _palette->startFadeToPalette(12); _isKlaymanInLight = true; } } @@ -1772,7 +1765,6 @@ Scene2206::Scene2206(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _soundResource(vm) { uint32 fileHash; - Palette2 *palette2; SetUpdateHandler(&Scene::update); SetMessageHandler(&Scene2206::handleMessage); @@ -1817,12 +1809,11 @@ Scene2206::Scene2206(NeverhoodEngine *vm, Module *parentModule, int which) setBackground(fileHash); - palette2 = new Palette2(_vm, fileHash); - _palette = palette2; + _palette = new Palette(_vm, fileHash); _palette->usePalette(); - addEntity(palette2); + addEntity(_palette); - palette2->addBasePalette(fileHash, 0, 256, 0); + _palette->addBasePalette(fileHash, 0, 256, 0); if (!getGlobalVar(0x4D080E54)) { _palette->addPalette(0x0263D144, 0, 65, 0); @@ -1904,8 +1895,8 @@ uint32 Scene2206::handleMessage(int messageNum, const MessageParam ¶m, Entit void Scene2206::sub481950() { if (getGlobalVar(0x4D080E54)) { - ((Palette2*)_palette)->addBasePalette(0x41983216, 0, 65, 0); - ((Palette2*)_palette)->startFadeToPalette(12); + _palette->addBasePalette(0x41983216, 0, 65, 0); + _palette->startFadeToPalette(12); } setSurfacePriority(_sprite1->getSurface(), 100); setSurfacePriority(_sprite2->getSurface(), 300); @@ -1919,8 +1910,8 @@ void Scene2206::sub481950() { void Scene2206::sub4819D0() { if (!getGlobalVar(0x4D080E54)) { - ((Palette2*)_palette)->addBasePalette(0xB103B604, 0, 65, 0); - ((Palette2*)_palette)->startFadeToPalette(12); + _palette->addBasePalette(0xB103B604, 0, 65, 0); + _palette->startFadeToPalette(12); } setSurfacePriority(_sprite1->getSurface(), 1100); setSurfacePriority(_sprite2->getSurface(), 1300); @@ -2713,8 +2704,6 @@ static const uint32 kScene2242MessageListIds1[] = { Scene2242::Scene2242(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _isKlaymanInLight(false) { - Palette2 *palette2; - _surfaceFlag = true; SetMessageHandler(&Scene2242::handleMessage); SetUpdateHandler(&Scene2242::update); @@ -2727,11 +2716,10 @@ Scene2242::Scene2242(NeverhoodEngine *vm, Module *parentModule, int which) setRectList(0x004B3DC8); } else { setBackground(0x25848E24); - palette2 = new Palette2(_vm, 0x25848E24); - _palette = palette2; + _palette = new Palette(_vm, 0x25848E24); _palette->usePalette(); - addEntity(palette2); - ((Palette2*)_palette)->copyBasePalette(0, 256, 0); + addEntity(_palette); + _palette->copyBasePalette(0, 256, 0); _palette->addPalette(0x68033B1C, 0, 65, 0); _mouseCursor = addSprite(new Mouse433(_vm, 0x48E20250, NULL)); setRectList(0x004B3E18); @@ -2767,12 +2755,12 @@ Scene2242::~Scene2242() { void Scene2242::update() { if (!getGlobalVar(0x4D080E54)) { if (_isKlaymanInLight && _klayman->getX() < 440) { - ((Palette2*)_palette)->addBasePalette(0x68033B1C, 0, 65, 0); - ((Palette2*)_palette)->startFadeToPalette(12); + _palette->addBasePalette(0x68033B1C, 0, 65, 0); + _palette->startFadeToPalette(12); _isKlaymanInLight = false; } else if (!_isKlaymanInLight && _klayman->getX() >= 440) { - ((Palette2*)_palette)->addBasePalette(0x25848E24, 0, 65, 0); - ((Palette2*)_palette)->startFadeToPalette(12); + _palette->addBasePalette(0x25848E24, 0, 65, 0); + _palette->startFadeToPalette(12); _isKlaymanInLight = true; } } diff --git a/engines/neverhood/module3000.cpp b/engines/neverhood/module3000.cpp index 7c4ed1a464..9bcd79a5e8 100644 --- a/engines/neverhood/module3000.cpp +++ b/engines/neverhood/module3000.cpp @@ -1668,8 +1668,6 @@ void AsScene3011Symbol::change(int index, bool flag) { Scene3011::Scene3011(NeverhoodEngine *vm, Module *parentModule, int which) : Scene(vm, parentModule, true), _updateStatus(0), _buttonClicked(false), _index2(0) { - Palette2 *palette2; - _surfaceFlag = true; // TODO _vm->gameModule()->initScene3011Vars(); @@ -1677,10 +1675,9 @@ Scene3011::Scene3011(NeverhoodEngine *vm, Module *parentModule, int which) setBackground(0x92124A04); - palette2 = new Palette2(_vm, 0xA4070114); - addEntity(palette2); - palette2->usePalette(); - _palette = palette2; + _palette = new Palette(_vm, 0xA4070114); + _palette->usePalette(); + addEntity(_palette); _mouseCursor = addSprite(new Mouse435(_vm, 0x24A00929, 20, 620)); @@ -1761,15 +1758,13 @@ uint32 Scene3011::handleMessage(int messageNum, const MessageParam ¶m, Entit } void Scene3011::fadeIn() { - Palette2 *palette2 = (Palette2*)_palette; - palette2->addBasePalette(0x92124A04, 0, 256, 0); - palette2->startFadeToPalette(24); + _palette->addBasePalette(0x92124A04, 0, 256, 0); + _palette->startFadeToPalette(24); } void Scene3011::fadeOut() { - Palette2 *palette2 = (Palette2*)_palette; - palette2->addBasePalette(0xA4070114, 0, 256, 0); - palette2->startFadeToPalette(24); + _palette->addBasePalette(0xA4070114, 0, 256, 0); + _palette->startFadeToPalette(24); } } // End of namespace Neverhood diff --git a/engines/neverhood/palette.cpp b/engines/neverhood/palette.cpp index a060a41870..481e0e5058 100644 --- a/engines/neverhood/palette.cpp +++ b/engines/neverhood/palette.cpp @@ -29,32 +29,28 @@ namespace Neverhood { // Palette Palette::Palette(NeverhoodEngine *vm) : Entity(vm, 0) { - _status = 0; - _palette = new byte[1024]; + init(); memset(_palette, 0, 1024); SetUpdateHandler(&Palette::update); } Palette::Palette(NeverhoodEngine *vm, byte *palette) : Entity(vm, 0) { - _status = 0; - _palette = new byte[1024]; + init(); memcpy(_palette, palette, 1024); SetUpdateHandler(&Palette::update); } Palette::Palette(NeverhoodEngine *vm, const char *filename) : Entity(vm, 0) { PaletteResource paletteResource(_vm); - _status = 0; - _palette = new byte[1024]; - // TODO: paletteResource.load(calcHash(filename)); - // paletteResource.copyPalette(_palette); + init(); + paletteResource.load(calcHash(filename)); + paletteResource.copyPalette(_palette); SetUpdateHandler(&Palette::update); } Palette::Palette(NeverhoodEngine *vm, uint32 fileHash) : Entity(vm, 0) { PaletteResource paletteResource(_vm); - _status = 0; - _palette = new byte[1024]; + init(); paletteResource.load(fileHash); paletteResource.copyPalette(_palette); SetUpdateHandler(&Palette::update); @@ -63,6 +59,13 @@ Palette::Palette(NeverhoodEngine *vm, uint32 fileHash) : Entity(vm, 0) { Palette::~Palette() { _vm->_screen->unsetPaletteData(_palette); delete[] _palette; + delete[] _basePalette; +} + +void Palette::init() { + _status = 0; + _palette = new byte[1024]; + _basePalette = new byte[1024]; } void Palette::usePalette() { @@ -82,6 +85,14 @@ void Palette::addPalette(uint32 fileHash, int toIndex, int count, int fromIndex) _vm->_screen->testPalette(_palette); } +void Palette::addBasePalette(uint32 fileHash, int toIndex, int count, int fromIndex) { + PaletteResource paletteResource(_vm); + if (toIndex + count > 256) + count = 256 - toIndex; + paletteResource.load(fileHash); + memcpy(_basePalette + toIndex * 4, paletteResource.palette() + fromIndex * 4, count * 4); +} + void Palette::copyPalette(const byte *palette, int toIndex, int count, int fromIndex) { if (toIndex + count > 256) count = 256 - toIndex; @@ -89,8 +100,14 @@ void Palette::copyPalette(const byte *palette, int toIndex, int count, int fromI _vm->_screen->testPalette(_palette); } +void Palette::copyBasePalette(int toIndex, int count, int fromIndex) { + if (toIndex + count > 256) + count = 256 - toIndex; + memcpy(_basePalette + toIndex * 4, _palette + fromIndex * 4, count * 4); +} + void Palette::startFadeToBlack(int counter) { - debug("Palette::startFadeToBlack(%d)", counter); + debug(2, "Palette::startFadeToBlack(%d)", counter); if (counter == 0) counter = 1; _fadeToR = 0; @@ -102,7 +119,7 @@ void Palette::startFadeToBlack(int counter) { } void Palette::startFadeToWhite(int counter) { - debug("Palette::startFadeToWhite(%d)", counter); + debug(2, "Palette::startFadeToWhite(%d)", counter); if (counter == 0) counter = 1; _fadeToR = 255; @@ -113,6 +130,15 @@ void Palette::startFadeToWhite(int counter) { _status = 1; } +void Palette::startFadeToPalette(int counter) { + debug(2, "Palette::startFadeToPalette(%d)", counter); + if (counter == 0) + counter = 1; + _palCounter = counter; + _fadeStep = 255 / counter; + _status = 2; +} + void Palette::update() { debug(2, "Palette::update() _status = %d", _status); if (_status == 1) { @@ -126,39 +152,6 @@ void Palette::update() { memset(_palette, 0, 1024); _status = 0; } - } -} - -void Palette::fadeColor(byte *rgb, byte toR, byte toG, byte toB) { - #define FADE(color, toColor) color += _fadeStep < toColor - color ? _fadeStep : (-_fadeStep <= toColor - color ? toColor - color : -_fadeStep) - FADE(rgb[0], toR); - FADE(rgb[1], toG); - FADE(rgb[2], toB); - #undef FADE -} - -// Palette2 - -Palette2::Palette2(NeverhoodEngine *vm) - : Palette(vm) { - _basePalette = new byte[1024]; - SetUpdateHandler(&Palette2::update); -} - -Palette2::Palette2(NeverhoodEngine *vm, uint32 fileHash) - : Palette(vm, fileHash) { - _basePalette = new byte[1024]; - SetUpdateHandler(&Palette2::update); -} - -Palette2::~Palette2() { - delete _basePalette; -} - -void Palette2::update() { - debug("Palette2::update() _status = %d", _status); - if (_status == 1) { - Palette::update(); } else if (_status == 2) { if (_palCounter > 1) { for (int i = 0; i < 256; i++) { @@ -173,27 +166,12 @@ void Palette2::update() { } } -void Palette2::copyBasePalette(int toIndex, int count, int fromIndex) { - if (toIndex + count > 256) - count = 256 - toIndex; - memcpy(_basePalette + toIndex * 4, _palette + fromIndex * 4, count * 4); -} - -void Palette2::addBasePalette(uint32 fileHash, int toIndex, int count, int fromIndex) { - PaletteResource paletteResource(_vm); - if (toIndex + count > 256) - count = 256 - toIndex; - paletteResource.load(fileHash); - memcpy(_basePalette + toIndex * 4, paletteResource.palette() + fromIndex * 4, count * 4); -} - -void Palette2::startFadeToPalette(int counter) { - debug("Palette2::startFadeToPalette(%d)", counter); - if (counter == 0) - counter = 1; - _palCounter = counter; - _fadeStep = 255 / counter; - _status = 2; +void Palette::fadeColor(byte *rgb, byte toR, byte toG, byte toB) { + #define FADE(color, toColor) color += _fadeStep < toColor - color ? _fadeStep : (-_fadeStep <= toColor - color ? toColor - color : -_fadeStep) + FADE(rgb[0], toR); + FADE(rgb[1], toG); + FADE(rgb[2], toB); + #undef FADE } } // End of namespace Neverhood diff --git a/engines/neverhood/palette.h b/engines/neverhood/palette.h index 9d2a7bc1f6..79660130e1 100644 --- a/engines/neverhood/palette.h +++ b/engines/neverhood/palette.h @@ -39,15 +39,20 @@ public: // Create from resource with fileHash Palette(NeverhoodEngine *vm, uint32 fileHash); virtual ~Palette(); + void init(); void usePalette(); void addPalette(const char *filename, int toIndex, int count, int fromIndex); void addPalette(uint32 fileHash, int toIndex, int count, int fromIndex); + void addBasePalette(uint32 fileHash, int toIndex, int count, int fromIndex); void copyPalette(const byte *palette, int toIndex, int count, int fromIndex); + void copyBasePalette(int toIndex, int count, int fromIndex); void startFadeToBlack(int counter); void startFadeToWhite(int counter); + void startFadeToPalette(int counter); protected: int _status; byte *_palette; + byte *_basePalette; int _palCounter; byte _fadeToR, _fadeToG, _fadeToB; int _fadeStep; @@ -55,20 +60,6 @@ protected: void fadeColor(byte *rgb, byte toR, byte toG, byte toB); }; -class Palette2 : public Palette { -public: - Palette2(NeverhoodEngine *vm); - // TODO: Other ctors - Palette2(NeverhoodEngine *vm, uint32 fileHash); - virtual ~Palette2(); - void copyBasePalette(int toIndex, int count, int fromIndex); - void addBasePalette(uint32 fileHash, int toIndex, int count, int fromIndex); - void startFadeToPalette(int counter); -public: - byte *_basePalette; - void update(); -}; - } // End of namespace Neverhood #endif /* NEVERHOOD_PALETTE_H */ |