diff options
Diffstat (limited to 'saga')
-rw-r--r-- | saga/gfx.cpp | 28 | ||||
-rw-r--r-- | saga/interface.cpp | 14 | ||||
-rw-r--r-- | saga/interface.h | 8 | ||||
-rw-r--r-- | saga/sfuncs.cpp | 2 |
4 files changed, 40 insertions, 12 deletions
diff --git a/saga/gfx.cpp b/saga/gfx.cpp index 121bd7cb19..c18115e7e9 100644 --- a/saga/gfx.cpp +++ b/saga/gfx.cpp @@ -182,12 +182,30 @@ void Gfx::setPalette(const PalEntry *pal) { } void Gfx::setPaletteColor(int n, int r, int g, int b) { - _currentPal[4 * n + 0] = r; - _currentPal[4 * n + 1] = g; - _currentPal[4 * n + 2] = b; - _currentPal[4 * n + 3] = 0; + bool update = false; - _system->setPalette(_currentPal, n, 1); + // This function may get called a lot. To avoid forcing full-screen + // updates, only update the palette if the color actually changes. + + if (_currentPal[4 * n + 0] != r) { + _currentPal[4 * n + 0] = r; + update = true; + } + if (_currentPal[4 * n + 1] != g) { + _currentPal[4 * n + 1] = g; + update = true; + } + if (_currentPal[4 * n + 2] != b) { + _currentPal[4 * n + 2] = b; + update = true; + } + if (_currentPal[4 * n + 3] != 0) { + _currentPal[4 * n + 3] = 0; + update = true; + } + + if (update) + _system->setPalette(_currentPal, n, 1); } void Gfx::getCurrentPal(PalEntry *src_pal) { diff --git a/saga/interface.cpp b/saga/interface.cpp index 338f95e0ef..63cf221f23 100644 --- a/saga/interface.cpp +++ b/saga/interface.cpp @@ -76,7 +76,6 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { size_t resourceLength; int i; - // Load interface module resource file context _interfaceContext = _vm->_resource->getContext(GAME_RESOURCEFILE); if (_interfaceContext == NULL) { @@ -127,13 +126,14 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) { // TODO } + setPortraitBgColor(0, 0, 0); + _mainPanel.x = _vm->getDisplayInfo().mainPanelXOffset; _mainPanel.y = _vm->getDisplayInfo().mainPanelYOffset; _mainPanel.currentButton = NULL; _inventoryUpButton = _mainPanel.getButton(_vm->getDisplayInfo().inventoryUpButtonIndex); _inventoryDownButton = _mainPanel.getButton(_vm->getDisplayInfo().inventoryDownButtonIndex); - _conversePanel.x = _vm->getDisplayInfo().conversePanelXOffset; _conversePanel.y = _vm->getDisplayInfo().conversePanelYOffset; _conversePanel.currentButton = NULL; @@ -451,7 +451,6 @@ bool Interface::processAscii(uint16 ascii, bool synthetic) { case '4': converseSetPos(ascii); break; - } break; case kPanelMap: @@ -591,6 +590,13 @@ void Interface::draw() { converseDisplayTextLines(backBuffer); } + if (_vm->getGameType() == GType_IHNM) { + _vm->_gfx->setPaletteColor(254, + _portraitBgColor.red, + _portraitBgColor.green, + _portraitBgColor.blue); + } + if (_panelMode == kPanelMain || _panelMode == kPanelConverse || _lockedMode == kPanelMain || _lockedMode == kPanelConverse) { leftPortraitPoint.x = _mainPanel.x + _vm->getDisplayInfo().leftPortraitXOffset; @@ -1444,7 +1450,6 @@ void Interface::drawStatusBar() { return; } - // Erase background of status bar rect.left = _vm->getDisplayInfo().statusXOffset; rect.top = _vm->getDisplayInfo().statusYOffset; @@ -1566,7 +1571,6 @@ void Interface::handleMainUpdate(const Point& mousePoint) { if (changed) { draw(); } - } //inventory stuff diff --git a/saga/interface.h b/saga/interface.h index 21b19300d5..d6cc44c263 100644 --- a/saga/interface.h +++ b/saga/interface.h @@ -187,7 +187,6 @@ enum StatusTextInputState { class Interface { public: - Interface(SagaEngine *vm); ~Interface(void); @@ -223,6 +222,11 @@ public: _rightPortrait = portrait; draw(); } + void setPortraitBgColor(int red, int green, int blue) { + _portraitBgColor.red = red; + _portraitBgColor.green = green; + _portraitBgColor.blue = blue; + } void draw(); void drawOption(); void drawQuit(); @@ -246,6 +250,7 @@ public: _statusTextInputString[0] = 0; setStatusText(_statusTextInputString); } + private: static void textInputRepeatCallback(void *refCon); @@ -415,6 +420,7 @@ private: int _statusOnceColor; int _leftPortrait; int _rightPortrait; + PalEntry _portraitBgColor; Point _lastMousePoint; diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp index f399c5c9cf..9d6040c9d3 100644 --- a/saga/sfuncs.cpp +++ b/saga/sfuncs.cpp @@ -1849,7 +1849,7 @@ void Script::sfSetPortraitBgColor(SCRIPTFUNC_PARAMS) { int16 green = thread->pop(); int16 blue = thread->pop(); - _vm->_gfx->setPaletteColor(254, red, green, blue); + _vm->_interface->setPortraitBgColor(red, green, blue); } void Script::sfScriptStartCutAway(SCRIPTFUNC_PARAMS) { |