[Scummvm-cvs-logs] CVS: scummvm/saga gfx.cpp,1.60,1.61 interface.cpp,1.138,1.139 interface.h,1.73,1.74 sfuncs.cpp,1.168,1.169

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Tue Oct 4 11:24:12 CEST 2005


Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25202

Modified Files:
	gfx.cpp interface.cpp interface.h sfuncs.cpp 
Log Message:
I misunderstood sev on how sf75() should work. Perhaps this is better?


Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/gfx.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- gfx.cpp	4 Oct 2005 17:44:41 -0000	1.60
+++ gfx.cpp	4 Oct 2005 18:19:14 -0000	1.61
@@ -182,12 +182,30 @@
 }
 
 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) {

Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -d -r1.138 -r1.139
--- interface.cpp	28 Sep 2005 15:41:21 -0000	1.138
+++ interface.cpp	4 Oct 2005 18:19:14 -0000	1.139
@@ -76,7 +76,6 @@
 	size_t resourceLength;
 	int i;
 
-
 	// Load interface module resource file context
 	_interfaceContext = _vm->_resource->getContext(GAME_RESOURCEFILE);
 	if (_interfaceContext == NULL) {
@@ -127,13 +126,14 @@
 		// 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 @@
 		case '4':
 			converseSetPos(ascii);
 			break;
-
 		}
 		break;
 	case kPanelMap:
@@ -591,6 +590,13 @@
 		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 @@
 		return;
 	}
 
-
 	// Erase background of status bar
 	rect.left = _vm->getDisplayInfo().statusXOffset;
 	rect.top = _vm->getDisplayInfo().statusYOffset;
@@ -1566,7 +1571,6 @@
 	if (changed) {
 		draw();
 	}
-
 }
 
 //inventory stuff

Index: interface.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.h,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- interface.h	29 Sep 2005 15:57:41 -0000	1.73
+++ interface.h	4 Oct 2005 18:19:14 -0000	1.74
@@ -187,7 +187,6 @@
 
 class Interface {
 public:
-
 	Interface(SagaEngine *vm);
 	~Interface(void);
 
@@ -223,6 +222,11 @@
 		_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 @@
 		_statusTextInputString[0] = 0;
 		setStatusText(_statusTextInputString);
 	}
+
 private:
 	static void textInputRepeatCallback(void *refCon);
 
@@ -415,6 +420,7 @@
 	int _statusOnceColor;
 	int _leftPortrait;
 	int _rightPortrait;
+	PalEntry _portraitBgColor;
 
 	Point _lastMousePoint;
 

Index: sfuncs.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sfuncs.cpp,v
retrieving revision 1.168
retrieving revision 1.169
diff -u -d -r1.168 -r1.169
--- sfuncs.cpp	4 Oct 2005 17:44:41 -0000	1.168
+++ sfuncs.cpp	4 Oct 2005 18:19:14 -0000	1.169
@@ -1849,7 +1849,7 @@
 	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) {





More information about the Scummvm-git-logs mailing list