diff options
author | WinterGrascph | 2016-05-04 12:50:06 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 4a8b34e993729dd90d12b1717977d8c4945e9325 (patch) | |
tree | 1cc5f883e5ad412515b6089052f57439504aaf84 | |
parent | 66c55db9f056a1c5c74e82e84650ac7fbbe4d899 (diff) | |
download | scummvm-rg350-4a8b34e993729dd90d12b1717977d8c4945e9325.tar.gz scummvm-rg350-4a8b34e993729dd90d12b1717977d8c4945e9325.tar.bz2 scummvm-rg350-4a8b34e993729dd90d12b1717977d8c4945e9325.zip |
DM: Add the original palettes, edit palette loading accordingly
-rw-r--r-- | engines/dm/dm.cpp | 31 | ||||
-rw-r--r-- | engines/dm/dm.h | 1 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 32 | ||||
-rw-r--r-- | engines/dm/gfx.h | 18 |
4 files changed, 48 insertions, 34 deletions
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index aac8336581..53ed3de574 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -16,6 +16,7 @@ namespace DM { + DMEngine::DMEngine(OSystem *syst) : Engine(syst), _console(nullptr) { // Do not load data files // Do not initialize graphics here @@ -56,38 +57,20 @@ Common::Error DMEngine::run() { _displayMan->loadGraphics(); _dungeonMan->loadDungeonFile(); + _displayMan->loadPalette(palCredits); - - - byte *palette = new byte[256 * 3]; - for (int i = 0; i < 16; ++i) - palette[i * 3] = palette[i * 3 + 1] = palette[i * 3 + 2] = i * 16; - - _displayMan->setPalette(palette, 16); - - byte *buffer = new byte[320 * 200]; - for (int i = 0; i < 320 * 100; ++i) - buffer[i] = 4; - for (int i = 320 * 100; i < 320 * 200; ++i) - buffer[i] = 6; - - _system->copyRectToScreen(buffer, 320, 0, 0, 320, 200); - _system->updateScreen(); - - - uint16 width = _displayMan->getImageWidth(75); - uint16 height = _displayMan->getImageHeight(75); + uint16 width = _displayMan->getImageWidth(1); + uint16 height = _displayMan->getImageHeight(1); byte *cleanByteImg0Data = new byte[width * height]; - _displayMan->loadIntoBitmap(75, cleanByteImg0Data); - _displayMan->blitToScreen(cleanByteImg0Data, width, height, 30, 30); + _displayMan->loadIntoBitmap(1, cleanByteImg0Data); + _displayMan->blitToScreen(cleanByteImg0Data, width, height, 0, 0); while (true) { _displayMan->updateScreen(); + _system->delayMillis(10); } - - delete[] buffer; delete[] cleanByteImg0Data; return Common::kNoError; diff --git a/engines/dm/dm.h b/engines/dm/dm.h index 705939cc63..35f6493129 100644 --- a/engines/dm/dm.h +++ b/engines/dm/dm.h @@ -23,7 +23,6 @@ public: ~DMEngine(); virtual Common::Error run(); - Common::Error go(); private: Console *_console; diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 577251cf21..846f4bc931 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -7,21 +7,35 @@ using namespace DM; +// this is for the Amiga version, later when we add support for more versions, this will have to be renamed +uint16 dmPalettes[10][16] = { + {0x000, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0xFFF, 0x000, 0xFFF, 0xAAA, 0xFFF, 0xAAA, 0x444, 0xFF0, 0xFF0}, + {0x000, 0x666, 0x888, 0x620, 0x0CC, 0x840, 0x080, 0x0C0, 0xF00, 0xFA0, 0xC86, 0xFF0, 0x000, 0xAAA, 0x00F, 0xFFF}, + {0x006, 0x0AA, 0xFF6, 0x840, 0xFF8, 0x000, 0x080, 0xA00, 0xC84, 0xFFA, 0xF84, 0xFC0, 0xFA0, 0x000, 0x620, 0xFFC}, + {0x000, 0x666, 0x888, 0x840, 0xCA8, 0x0C0, 0x080, 0x0A0, 0x864, 0xF00, 0xA86, 0x642, 0x444, 0xAAA, 0x620, 0xFFF}, + {0x000, 0x666, 0x888, 0x620, 0x0CC, 0x840, 0x080, 0x0C0, 0xF00, 0xFA0, 0xC86, 0xFF0, 0x444, 0xAAA, 0x00F, 0xFFF}, + {0x000, 0x444, 0x666, 0x620, 0x0CC, 0x820, 0x060, 0x0A0, 0xC00, 0x000, 0x000, 0xFC0, 0x222, 0x888, 0x00C, 0xCCC}, + {0x000, 0x222, 0x444, 0x420, 0x0CC, 0x620, 0x040, 0x080, 0xA00, 0x000, 0x000, 0xFA0, 0x000, 0x666, 0x00A, 0xAAA}, + {0x000, 0x000, 0x222, 0x200, 0x0CC, 0x420, 0x020, 0x060, 0x800, 0x000, 0x000, 0xC80, 0x000, 0x444, 0x008, 0x888}, + {0x000, 0x000, 0x000, 0x000, 0x0CC, 0x200, 0x000, 0x040, 0x600, 0x000, 0x000, 0xA60, 0x000, 0x222, 0x006, 0x666}, + {0x000, 0x000, 0x000, 0x000, 0x0CC, 0x000, 0x000, 0x020, 0x400, 0x000, 0x000, 0x640, 0x000, 0x000, 0x004, 0x444} +}; + + DisplayMan::DisplayMan(DMEngine *dmEngine) : - _vm(dmEngine), _currPalette(NULL), _screenWidth(0), _screenHeight(0), + _vm(dmEngine), _currPalette(palSwoosh), _screenWidth(0), _screenHeight(0), _vgaBuffer(0), _itemCount(0), _indexBytePos(NULL), _compressedData(NULL) {} DisplayMan::~DisplayMan() { delete[] _compressedData; delete[] _indexBytePos; - delete[] _currPalette; delete[] _vgaBuffer; } void DisplayMan::setUpScreens(uint16 width, uint16 height) { - _currPalette = new byte[256 * 3]; _screenWidth = width; _screenHeight = height; + loadPalette(palSwoosh); _vgaBuffer = new byte[_screenWidth * _screenHeight]; memset(_vgaBuffer, 0, width * height); } @@ -45,9 +59,14 @@ void DisplayMan::loadGraphics() { f.close(); } -void DisplayMan::setPalette(byte *buff, uint16 colorCount) { - memcpy(_currPalette, buff, sizeof(byte) * colorCount * 3); - _vm->_system->getPaletteManager()->setPalette(buff, 0, colorCount); +void DisplayMan::loadPalette(dmPaletteEnum palette) { + byte colorPalette[16 * 3]; + for (int i = 0; i < 16; ++i) { + colorPalette[i * 3] = (dmPalettes[palette][i] >> 8) * (256 / 16); + colorPalette[i * 3 + 1] = (dmPalettes[palette][i] >> 4) * (256 / 16); + colorPalette[i * 3 + 2] = dmPalettes[palette][i] * (256 / 16); + } + _vm->_system->getPaletteManager()->setPalette(colorPalette, 0, 16); } #define TOBE2(byte1, byte2) ((((uint16)(byte1)) << 8) | (uint16)(byte2)) @@ -103,7 +122,6 @@ void DisplayMan::loadIntoBitmap(uint16 index, byte *destBitmap) { void DisplayMan::blitToScreen(byte *srcBitmap, uint16 srcWidth, uint16 srcHeight, uint16 destX, uint16 destY) { for (uint16 y = 0; y < srcHeight; ++y) memcpy(getCurrentVgaBuffer() + ((y + destY) * _screenWidth + destX), srcBitmap + y * srcWidth, srcWidth * sizeof(byte)); - } void DisplayMan::updateScreen() { diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 98d035be2c..acdabfa77c 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -6,9 +6,23 @@ namespace DM { +enum dmPaletteEnum { + palSwoosh = 0, + palMousePointer = 1, + palCredits = 2, + palEntrance = 3, + palDungeonView0 = 4, + palDungeonView1 = 5, + palDungeonView2 = 6, + palDungeonView3 = 7, + palDungeonView4 = 8, + palDungeonView5 = 9, +}; + + class DisplayMan { DMEngine *_vm; - byte *_currPalette; + dmPaletteEnum _currPalette; uint16 _screenWidth; uint16 _screenHeight; byte *_vgaBuffer; @@ -22,7 +36,7 @@ public: ~DisplayMan(); void setUpScreens(uint16 width, uint16 height); void loadGraphics(); - void setPalette(byte *buff, uint16 colorCount); + void loadPalette(dmPaletteEnum palette); void loadIntoBitmap(uint16 index, byte *destBitmap); uint16 getImageWidth(uint16 index); uint16 getImageHeight(uint16 index); |