diff options
author | Bendegúz Nagy | 2016-08-11 16:06:06 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 94ba2fdb2bec8c0a9bf58ded78fd40f6b95aa28c (patch) | |
tree | bd23c56c747ce293f20a8c4f793c93db9d9c4641 | |
parent | 37db95c33646a60218f8ed2c897473310a1c582b (diff) | |
download | scummvm-rg350-94ba2fdb2bec8c0a9bf58ded78fd40f6b95aa28c.tar.gz scummvm-rg350-94ba2fdb2bec8c0a9bf58ded78fd40f6b95aa28c.tar.bz2 scummvm-rg350-94ba2fdb2bec8c0a9bf58ded78fd40f6b95aa28c.zip |
DM: Add partial fix of color palette
-rw-r--r-- | engines/dm/dm.cpp | 6 | ||||
-rw-r--r-- | engines/dm/gfx.cpp | 36 | ||||
-rw-r--r-- | engines/dm/gfx.h | 3 |
3 files changed, 34 insertions, 11 deletions
diff --git a/engines/dm/dm.cpp b/engines/dm/dm.cpp index 51be9d8167..59151a9a99 100644 --- a/engines/dm/dm.cpp +++ b/engines/dm/dm.cpp @@ -246,10 +246,9 @@ uint16 DMEngine::f30_getScaledProduct(uint16 val, uint16 scale, uint16 vale2) { } void DMEngine::f463_initializeGame() { + f448_initMemoryManager(); _displayMan->f479_loadGraphics(); _displayMan->f460_initializeGraphicData(); - warning(false, "Dummy code in f463_initializeGame, setting palette"); - _displayMan->loadPalette(g21_PalDungeonView[0]); _displayMan->f94_loadFloorSet(k0_FloorSetStone); _displayMan->f95_loadWallSet(k0_WallSetStone); @@ -279,6 +278,7 @@ void DMEngine::f463_initializeGame() { void DMEngine::f448_initMemoryManager() { warning(false, "STUB METHOD: f448_initMemoryManager"); + _displayMan->f508_buildPaletteChangeCopperList(gK57_PalSwoosh, gK57_PalSwoosh); for (uint16 i = 0; i < 16; ++i) _displayMan->_g347_paletteTopAndBottomScreen[i] = g21_PalDungeonView[0][i]; } @@ -319,7 +319,7 @@ void DMEngine::f462_startGame() { _displayMan->D24_fillScreenBox(boxScreenBottom, k0_ColorBlack); } - warning(false, "TODO: build copper"); + _displayMan->f508_buildPaletteChangeCopperList(g21_PalDungeonView[0], _displayMan->_g347_paletteTopAndBottomScreen); _menuMan->f395_drawMovementArrows(); _championMan->f278_resetDataToStartGame(); _g301_gameTimeTicking = true; diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index 41fb147a1b..832b336e91 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -728,6 +728,10 @@ DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) { for (uint16 i = 0; i < 32; i++) _g345_aui_BlankBuffer[i] = 0; + + // HACK + memcpy(_g346_paletteMiddleScreen, g20_PalEntrance, sizeof(uint16) * 16); + memcpy(_g347_paletteTopAndBottomScreen, g20_PalEntrance, sizeof(uint16) * 16); } DisplayMan::~DisplayMan() { @@ -1210,7 +1214,13 @@ byte* DisplayMan::f114_getExplosionBitmap(uint16 explosionAspIndex, uint16 scale void DisplayMan::updateScreen() { + // apply copper + warning(false, "Top of the screen color is offset as well"); // loop should start from 320 * 30 + for (uint32 i = 0; i < 320 * 170; ++i) + _g348_bitmapScreen[i] += 16; _vm->_system->copyRectToScreen(_g348_bitmapScreen, _screenWidth, 0, 0, _screenWidth, _screenHeight); + for (uint32 i = 0; i < 320 * 170; ++i) // loop should start from 320 * 30 + _g348_bitmapScreen[i] -= 16; _vm->_console->onFrame(); _vm->_system->updateScreen(); } @@ -1719,7 +1729,7 @@ void DisplayMan::f119_drawSquareD2L(Direction dir, int16 posX, int16 posY) { goto T0119020; case k2_ElementTypePit: f104_drawFloorPitOrStairsBitmap(squareAspect[k2_PitInvisibleAspect] ? k57_FloorPir_Invisible_D2L_GraphicIndice : k51_FloorPit_D2L_GraphicIndice, - g143_FrameFloorPit_D2L); + g143_FrameFloorPit_D2L); case k5_ElementTypeTeleporter: case k1_CorridorElemType: T0119018: @@ -1786,7 +1796,7 @@ void DisplayMan::f120_drawSquareD2R(Direction dir, int16 posX, int16 posY) { goto T0120029; case k2_ElementTypePit: f105_drawFloorPitOrStairsBitmapFlippedHorizontally(squareAspect[k2_PitInvisibleAspect] - ? k57_FloorPir_Invisible_D2L_GraphicIndice : k51_FloorPit_D2L_GraphicIndice, g145_FrameFloorPit_D2R); + ? k57_FloorPir_Invisible_D2L_GraphicIndice : k51_FloorPit_D2L_GraphicIndice, g145_FrameFloorPit_D2R); case k5_ElementTypeTeleporter: case k1_CorridorElemType: T0120027: @@ -2157,9 +2167,6 @@ void DisplayMan::f127_drawSquareD0C(Direction dir, int16 posX, int16 posY) { } void DisplayMan::f128_drawDungeon(Direction dir, int16 posX, int16 posY) { - loadPalette(g20_PalEntrance); // dummy code - - if (_g297_drawFloorAndCeilingRequested) f98_drawFloorAndCeiling(); _g578_useByteBoxCoordinates = true; @@ -2896,7 +2903,7 @@ void DisplayMan::f115_cthulhu(Thing thingParam, Direction directionParam, int16 byte* paletteChanges; byte* bitmapGreenAnt; byte* coordinateSet; - int16 derivedBitmapIndex = - 1; + int16 derivedBitmapIndex = -1; bool L0135_B_DrawAlcoveObjects; int16 byteWidth; int16 heightRedEagle; @@ -3675,4 +3682,21 @@ uint16 DisplayMan::f431_getDarkenedColor(uint16 RGBcolor) { return RGBcolor; } +void DisplayMan::f508_buildPaletteChangeCopperList(uint16* middleScreen, uint16* topAndBottom) { + // memcpy(_g347_paletteTopAndBottomScreen, topAndBottom, sizeof(uint16) * 16); + // memcpy(_g346_paletteMiddleScreen, middleScreen, sizeof(uint16) * 16); + byte colorPalette[32 * 3]; + for (int i = 0; i < 16; ++i) { + colorPalette[i * 3] = (topAndBottom[i] >> 8) * (256 / 16); + colorPalette[i * 3 + 1] = (topAndBottom[i] >> 4) * (256 / 16); + colorPalette[i * 3 + 2] = topAndBottom[i] * (256 / 16); + } + for (int i = 16; i < 32; ++i) { + colorPalette[i * 3] = (middleScreen[i] >> 8) * (256 / 16); + colorPalette[i * 3 + 1] = (middleScreen[i] >> 4) * (256 / 16); + colorPalette[i * 3 + 2] = middleScreen[i] * (256 / 16); + } + _vm->_system->getPaletteManager()->setPalette(colorPalette, 0, 32); +} + } diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index 9e66455226..564bfb6ba8 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -526,7 +526,6 @@ class DisplayMan { DMEngine *_vm; - /// Related to graphics.dat file uint16 _grapItemCount; // @ G0632_ui_GraphicCount uint32 *_packedItemPos; byte *_packedBitmaps; @@ -751,7 +750,7 @@ public: void f480_releaseBlock(uint16 index); // @ F0480_CACHE_ReleaseBlock uint16 f431_getDarkenedColor(uint16 RGBcolor); void f436_STARTEND_FadeToPalette(uint16 *P0849_pui_Palette) { warning(false, "STUB METHOD: f436_STARTEND_FadeToPalette"); } - void f508_buildPaletteChangeCopperList(uint16* middleScreen, uint16* topAndBottom) { warning(false, "STUB METHOD: f508_buildPaletteChangeCopperList"); }// @ F0508_AMIGA_BuildPaletteChangeCopperList + void f508_buildPaletteChangeCopperList(uint16* middleScreen, uint16* topAndBottom); void f136_shadeScreenBox(Box* box, Color color) { warning(false, "STUB METHOD: f136_shadeScreenBox"); } // @ F0136_VIDEO_ShadeScreenBox }; |