aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-10-04 18:19:14 +0000
committerTorbjörn Andersson2005-10-04 18:19:14 +0000
commit0719a4e6c27a10af41303aa961812b3dde333045 (patch)
tree7f0f3c5a42832d9399baad024939ffc558737d51
parentba306c80f4a59b73f7cf4dc51e90c1bf37e223ff (diff)
downloadscummvm-rg350-0719a4e6c27a10af41303aa961812b3dde333045.tar.gz
scummvm-rg350-0719a4e6c27a10af41303aa961812b3dde333045.tar.bz2
scummvm-rg350-0719a4e6c27a10af41303aa961812b3dde333045.zip
I misunderstood sev on how sf75() should work. Perhaps this is better?
svn-id: r18932
-rw-r--r--saga/gfx.cpp28
-rw-r--r--saga/interface.cpp14
-rw-r--r--saga/interface.h8
-rw-r--r--saga/sfuncs.cpp2
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) {