diff options
author | Bendegúz Nagy | 2016-08-11 19:20:10 +0200 |
---|---|---|
committer | Bendegúz Nagy | 2016-08-26 23:02:22 +0200 |
commit | 6113b75ca9ca7d288cc0ea8e171ee6c44ca90e1e (patch) | |
tree | 7ad35ea8771479ddd7f4c6b7639a67eb01b4c557 /engines/dm | |
parent | 181995cff9a521fb659aadc802d6cd65233385f2 (diff) | |
download | scummvm-rg350-6113b75ca9ca7d288cc0ea8e171ee6c44ca90e1e.tar.gz scummvm-rg350-6113b75ca9ca7d288cc0ea8e171ee6c44ca90e1e.tar.bz2 scummvm-rg350-6113b75ca9ca7d288cc0ea8e171ee6c44ca90e1e.zip |
DM: Complete DisplayMan::f436_STARTEND_fadeToPalette
Diffstat (limited to 'engines/dm')
-rw-r--r-- | engines/dm/gfx.cpp | 77 | ||||
-rw-r--r-- | engines/dm/gfx.h | 4 |
2 files changed, 76 insertions, 5 deletions
diff --git a/engines/dm/gfx.cpp b/engines/dm/gfx.cpp index e42e2282a1..f5ecadeb26 100644 --- a/engines/dm/gfx.cpp +++ b/engines/dm/gfx.cpp @@ -704,7 +704,6 @@ DisplayMan::DisplayMan(DMEngine *dmEngine) : _vm(dmEngine) { _g99_bitmapWall_D0R_Native = nullptr; _g322_paletteSwitchingEnabled = false; - warning(false, "DUMMY CODE: setting _g304_dungeonViewPaletteIndex"); _g304_dungeonViewPaletteIndex = 0; g186_doorFrame_D1C = new DoorFrames( // @ G0186_s_Graphic558_Frames_Door_D1C @@ -729,9 +728,7 @@ 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); + _gK17_paletteFadeFrom = nullptr; } DisplayMan::~DisplayMan() { @@ -3670,6 +3667,78 @@ uint16 DisplayMan::f431_getDarkenedColor(uint16 RGBcolor) { return RGBcolor; } +void DisplayMan::f436_STARTEND_FadeToPalette(uint16* P0849_pui_Palette) { + static uint16 K0016_aui_Palette_FadeTemporary[16]; + uint16 L1374_ui_CurrentRGBColor; + int16 L1375_ui_TargetRGBColor; + int16 L1376_i_Color; + int16 L1377_i_Counter; + uint16* L1378_pui_PaletteRegister; + + + L1378_pui_PaletteRegister = K0016_aui_Palette_FadeTemporary; + for (L1376_i_Color = 0; L1376_i_Color < 16; L1376_i_Color++) { + L1378_pui_PaletteRegister[L1376_i_Color] = _gK17_paletteFadeFrom[L1376_i_Color]; + } + for (L1377_i_Counter = 0; L1377_i_Counter < 8; L1377_i_Counter++) { + for (L1376_i_Color = 0, L1378_pui_PaletteRegister = K0016_aui_Palette_FadeTemporary; L1376_i_Color < 16; L1376_i_Color++, L1378_pui_PaletteRegister++) { + L1374_ui_CurrentRGBColor = getFlag(*L1378_pui_PaletteRegister, D12_MASK_BLUE_COMPONENT); + L1375_ui_TargetRGBColor = getFlag(P0849_pui_Palette[L1376_i_Color], D12_MASK_BLUE_COMPONENT); + if (L1374_ui_CurrentRGBColor > L1375_ui_TargetRGBColor) { + if (L1374_ui_CurrentRGBColor > L1375_ui_TargetRGBColor + 1) { + *L1378_pui_PaletteRegister -= 2; + } else { + *L1378_pui_PaletteRegister -= 1; + } + } else { + if (L1374_ui_CurrentRGBColor < L1375_ui_TargetRGBColor) { + if (L1374_ui_CurrentRGBColor < L1375_ui_TargetRGBColor - 1) { + *L1378_pui_PaletteRegister += 2; + } else { + *L1378_pui_PaletteRegister += 1; + } + } + } + L1374_ui_CurrentRGBColor = getFlag(*L1378_pui_PaletteRegister, D11_MASK_GREEN_COMPONENT) >> 4; + L1375_ui_TargetRGBColor = getFlag(P0849_pui_Palette[L1376_i_Color], D11_MASK_GREEN_COMPONENT) >> 4; + if (L1374_ui_CurrentRGBColor > L1375_ui_TargetRGBColor) { + if (L1374_ui_CurrentRGBColor > L1375_ui_TargetRGBColor + 1) { + *L1378_pui_PaletteRegister -= 32; + } else { + *L1378_pui_PaletteRegister -= 16; + } + } else { + if (L1374_ui_CurrentRGBColor < L1375_ui_TargetRGBColor) { + if (L1374_ui_CurrentRGBColor < L1375_ui_TargetRGBColor - 1) { + *L1378_pui_PaletteRegister += 32; + } else { + *L1378_pui_PaletteRegister += 16; + } + } + } + L1374_ui_CurrentRGBColor = getFlag(*L1378_pui_PaletteRegister, D10_MASK_RED_COMPONENT) >> 8; + L1375_ui_TargetRGBColor = getFlag(P0849_pui_Palette[L1376_i_Color], D10_MASK_RED_COMPONENT) >> 8; + if (L1374_ui_CurrentRGBColor > L1375_ui_TargetRGBColor) { + if (L1374_ui_CurrentRGBColor > L1375_ui_TargetRGBColor + 1) { + *L1378_pui_PaletteRegister -= 512; + } else { + *L1378_pui_PaletteRegister -= 256; + } + } else { + if (L1374_ui_CurrentRGBColor < L1375_ui_TargetRGBColor) { + if (L1374_ui_CurrentRGBColor < L1375_ui_TargetRGBColor - 1) { + *L1378_pui_PaletteRegister += 512; + } else { + *L1378_pui_PaletteRegister += 256; + } + } + } + } + _vm->f22_delay(1); + f508_buildPaletteChangeCopperList(K0016_aui_Palette_FadeTemporary, K0016_aui_Palette_FadeTemporary); + } +} + void DisplayMan::f508_buildPaletteChangeCopperList(uint16* middleScreen, uint16* topAndBottom) { // memcpy(_g347_paletteTopAndBottomScreen, topAndBottom, sizeof(uint16) * 16); // memcpy(_g346_paletteMiddleScreen, middleScreen, sizeof(uint16) * 16); diff --git a/engines/dm/gfx.h b/engines/dm/gfx.h index af8b0d3c03..091f40be38 100644 --- a/engines/dm/gfx.h +++ b/engines/dm/gfx.h @@ -629,6 +629,8 @@ private: int16 _g693_doorNativeBitmapIndex_Front_D3LCR[2]; // @ G0693_ai_DoorNativeBitmapIndex_Front_D3LCR int16 _g694_doorNativeBitmapIndex_Front_D2LCR[2]; // @ G0694_ai_DoorNativeBitmapIndex_Front_D2LCR int16 _g695_doorNativeBitmapIndex_Front_D1LCR[2]; // @ G0695_ai_DoorNativeBitmapIndex_Front_D1LCR + + uint16 *_gK17_paletteFadeFrom; // @ K0017_pui_Palette_FadeFrom public: uint16 _screenWidth; @@ -748,8 +750,8 @@ public: void f493_addDerivedBitmap(int16 derivedBitmapIndex); // @ F0493_CACHE_AddDerivedBitmap 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); + void f436_STARTEND_FadeToPalette(uint16 *P0849_pui_Palette); // @ F0436_STARTEND_FadeToPalette void f136_shadeScreenBox(Box* box, Color color) { warning(false, "STUB METHOD: f136_shadeScreenBox"); } // @ F0136_VIDEO_ShadeScreenBox }; |