[Scummvm-cvs-logs] CVS: scummvm/saga game.cpp,1.66,1.67 input.cpp,1.41,1.42 interface.cpp,1.94,1.95 interface.h,1.51,1.52 puzzle.cpp,1.3,1.4 saga.h,1.94,1.95 saveload.cpp,1.10,1.11

Andrew Kurushin h00ligan at users.sourceforge.net
Sat May 28 04:07:28 CEST 2005


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

Modified Files:
	game.cpp input.cpp interface.cpp interface.h puzzle.cpp saga.h 
	saveload.cpp 
Log Message:
game options WIP2

Index: game.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/game.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- game.cpp	23 May 2005 18:53:34 -0000	1.66
+++ game.cpp	28 May 2005 11:06:55 -0000	1.67
@@ -74,15 +74,32 @@
 };
 
 static PanelButton ITE_OptionPanelButtons[] = {
-	{kPanelButtonSlider,	284,19, 13,75,	0,'-',0,	0,0,0}, //slider-scroller
-	{kPanelButtonOption,	113,18, 45,17,	13,'r',0,	0,0,0}, //read speed
-	{kPanelButtonOption,	113,37, 45,17,	16,'m',0,	0,0,0}, //music
-	{kPanelButtonOption,	113,56, 45,17,	16,'n',0,	0,0,0}, //sound-noise
-	{kPanelButtonOption,	13,79, 135,17,	12,'q',0,	0,0,0}, //quit
-	{kPanelButtonOption,	13,98, 135,17,	17,'c',0,	0,0,0}, //continue
-	{kPanelButtonOption,	164,98, 57,17,	18,'l',0,	0,0,0}, //load
-	{kPanelButtonOption,	241,98, 57,17,	19,'s',0,	0,0,0},	//save
-	{kPanelButtonOption,	166,20, 112,74,	0,'-',0,	0,0,0},	//slider
+	{kPanelButtonOptionSlider,	284,19, 13,75,	0,'-',0,	0,0,0}, //slider-scroller
+	{kPanelButtonOption,	113,18, 45,17,	kTextReadingSpeed,'r',0,	0,0,0}, //read speed
+	{kPanelButtonOption,	113,37, 45,17,	kTextMusic,'m',0,	0,0,0}, //music
+	{kPanelButtonOption,	113,56, 45,17,	kTextSound,'n',0,	0,0,0}, //sound-noise
+	{kPanelButtonOption,	13,79, 135,17,	kTextQuitGame,'q',0,	0,0,0}, //quit
+	{kPanelButtonOption,	13,98, 135,17,	kTextContinuePlaying,'c',0,	0,0,0}, //continue
+	{kPanelButtonOption,	164,98, 57,17,	kTextLoad,'l',0,	0,0,0}, //load
+	{kPanelButtonOption,	241,98, 57,17,	kTextSave,'s',0,	0,0,0},	//save
+	{kPanelButtonOptionSaveFiles,	166,20, 112,74,	0,'-',0,	0,0,0},	//savefiles
+
+	{kPanelButtonOptionText,114,4, 0,0,	kTextGameOptions,'-',0,	0,0,0},	// text: game options
+	{kPanelButtonOptionText,10,22, 0,0,	kTextReadingSpeed,'-',0, 0,0,0},	// text: read speed
+	{kPanelButtonOptionText,73,41, 0,0,	kTextMusic,'-',0, 0,0,0},	// text: music
+	{kPanelButtonOptionText,69,60, 0,0,	kTextSound,'-',0, 0,0,0},	// text: noise
+};
+
+static PanelButton ITE_QuitPanelButtons[] = {
+	{kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
+};
+
+static PanelButton ITE_LoadPanelButtons[] = {
+	{kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
+};
+
+static PanelButton ITE_SavePanelButtons[] = {
+	{kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
 };
 
 static GameDisplayInfo ITE_DisplayInfo = {
@@ -117,14 +134,27 @@
 	ITE_MainPanelButtons,
 
 	4, 5,			// converse Up & Down button indexies
-
 	0, 149,			// converse panel offsets
 	ARRAYSIZE(ITE_ConversePanelButtons),
 	ITE_ConversePanelButtons,
 	
+	8, 0,			// save file index
+	8,				// optionSaveFileVisible
 	8, 8,			// option panel offsets
 	ARRAYSIZE(ITE_OptionPanelButtons),
-	ITE_OptionPanelButtons
+	ITE_OptionPanelButtons,
+
+	0, 0,			// quit panel offsets
+	ARRAYSIZE(ITE_QuitPanelButtons),
+	ITE_QuitPanelButtons,
+
+	0, 0,			// load panel offsets
+	ARRAYSIZE(ITE_LoadPanelButtons),
+	ITE_LoadPanelButtons,
+
+	0, 0,			// save panel offsets
+	ARRAYSIZE(ITE_SavePanelButtons),
+	ITE_SavePanelButtons
 };
 
 static GameResourceDescription ITE_Resources = {
@@ -254,6 +284,19 @@
 	{kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
 };
 
+static PanelButton IHNM_QuitPanelButtons[] = {
+	{kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
+};
+
+static PanelButton IHNM_LoadPanelButtons[] = {
+	{kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
+};
+
+static PanelButton IHNM_SavePanelButtons[] = {
+	{kPanelButtonArrow, 0,0, 0,0, 0,'-',0, 0,0,0}, //TODO
+};
+
+
 static GameDisplayInfo IHNM_DisplayInfo = { //TODO: fill it all
 	640, 480,	// logical width&height
 	
@@ -291,9 +334,23 @@
 	ARRAYSIZE(IHNM_ConversePanelButtons),
 	IHNM_ConversePanelButtons,
 	
+	-1, -1,		// save file index
+	0,			// optionSaveFileVisible
 	0, 0,		// option panel offsets
 	ARRAYSIZE(IHNM_OptionPanelButtons),
-	IHNM_OptionPanelButtons
+	IHNM_OptionPanelButtons,
+
+	0, 0,			// quit panel offsets
+	ARRAYSIZE(IHNM_QuitPanelButtons),
+	IHNM_QuitPanelButtons,
+
+	0, 0,			// load panel offsets
+	ARRAYSIZE(IHNM_LoadPanelButtons),
+	IHNM_LoadPanelButtons,
+
+	0, 0,			// save panel offsets
+	ARRAYSIZE(IHNM_SavePanelButtons),
+	IHNM_SavePanelButtons
 };
 
 static GameResourceDescription IHNM_Resources = {

Index: input.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/input.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- input.cpp	18 May 2005 18:28:09 -0000	1.41
+++ input.cpp	28 May 2005 11:06:55 -0000	1.42
@@ -104,7 +104,7 @@
 				_render->toggleFlag(RF_RENDERPAUSE);
 				break;
 			default:
-				_interface->processKeyCode(event.kbd.keycode);
+				_interface->processAscii(event.kbd.ascii);
 				break;
 			}
 			break;

Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- interface.cpp	23 May 2005 18:53:35 -0000	1.94
+++ interface.cpp	28 May 2005 11:06:55 -0000	1.95
@@ -148,6 +148,8 @@
 	_optionPanel.x = _vm->getDisplayInfo().optionPanelXOffset;
 	_optionPanel.y = _vm->getDisplayInfo().optionPanelYOffset;
 	_optionPanel.currentButton = NULL;
+	_optionSaveFileSlider = _optionPanel.getButton(_vm->getDisplayInfo().optionSaveFileSliderIndex);
+	_optionSaveFilePanel = _optionPanel.getButton(_vm->getDisplayInfo().optionSaveFilePanelIndex);
 
 	_active = false;
 	_panelMode = _lockedMode = kPanelNull;
@@ -164,6 +166,8 @@
 	_inventorySize = ITE_INVENTORY_SIZE;
 	_saveReminderState = 0;
 
+	_optionSaveFileTop = 0;
+
 	_inventory = (uint16 *)calloc(_inventorySize, sizeof(uint16));
 	if (_inventory == NULL) {
 		error("Interface::Interface(): not enough memory");
@@ -225,7 +229,7 @@
 
 void Interface::setMode(int mode, bool force) {
 	// TODO: Is this where we should hide/show the mouse cursor?
-
+	debug(0, "Interface::setMode %i", mode);
 	if (mode == kPanelMain) {
 		_inMainMode = true;
 		_saveReminderState = 1; //TODO: blinking timeout
@@ -255,6 +259,8 @@
 			if (_panelMode == kPanelOption) {
 				_optionPanel.currentButton = NULL;
 				_vm->fillSaveList();
+				calcOptionSaveSlider();
+				_optionSaveFileTitleNumber = 0;
 			}
 		}		
 	}
@@ -262,12 +268,12 @@
 	draw();
 }
 
-bool Interface::processKeyCode(int keyCode) {
+bool Interface::processAscii(uint16 ascii) {
 	int i;
 	PanelButton *panelButton;
 	switch (_panelMode) {
 	case kPanelNull:
-		if (keyCode == 27) {// Esc
+		if (ascii == 27) {// Esc
 			if (_vm->_scene->isInDemo()) {
 				_vm->_scene->skipScene();
 			} else {
@@ -278,10 +284,13 @@
 		break;
 	case kPanelOption:
 		//TODO: check input dialog keys
+		if (ascii == 27) {// Esc
+			ascii = 'c'; //continue
+		}
 		for (i = 0; i < _optionPanel.buttonsCount; i++) {
 			panelButton = &_optionPanel.buttons[i];
 			if(panelButton->type == kPanelButtonOption) {
-				if (panelButton->keyChar == keyCode) {
+				if (panelButton->ascii == ascii) {
 					setOption(panelButton);				
 					return true;
 				}
@@ -291,7 +300,7 @@
 	case kPanelMain:
 		for (i = 0; i < _mainPanel.buttonsCount; i++) {
 			panelButton = &_mainPanel.buttons[i];
-			if (panelButton->keyChar == keyCode) {
+			if (panelButton->ascii == ascii) {
 				if (panelButton->type == kPanelButtonVerb) {
 					_vm->_script->setVerb(panelButton->id);
 				}			
@@ -301,9 +310,16 @@
 				return true;
 			}
 		}
+		if (ascii == 15) // ctrl-o
+		{
+			if (_saveReminderState > 0) {
+				setMode(kPanelOption);
+				return true;
+			}
+		}
 		break;
 	case kPanelConverse:
-		switch (keyCode) {
+		switch (ascii) {
 		case 'x':
 			setMode(kPanelMain);
 			if (_vm->_puzzle->isActive())
@@ -322,7 +338,7 @@
 		case '2':
 		case '3':
 		case '4':
-			converseSetPos(keyCode);
+			converseSetPos(ascii);
 			break;
 
 		}
@@ -444,10 +460,52 @@
 	drawInventory(backBuffer);
 }
 
+void Interface::calcOptionSaveSlider() {
+	int totalFiles = _vm->getSaveFileNameCount();
+	int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible; 
+	int height = _optionSaveFileSlider->height;
+	int sliderHeight;
+	int pos;
+
+	if (totalFiles < visibleFiles) {
+		totalFiles = visibleFiles;
+	}
+
+	sliderHeight = visibleFiles * height / totalFiles;
+	if (sliderHeight < 7) {
+		sliderHeight = 7;
+	}
+
+	if (totalFiles - visibleFiles <= 0) {
+		pos = 0;
+	} else {
+		pos = _optionSaveFileTop * (height - sliderHeight) / (totalFiles - visibleFiles);
+	}
+	_optionPanel.calcPanelButtonRect(_optionSaveFileSlider, _optionSaveRectTop);
+	_optionSaveRectBottom = _optionSaveRectSlider = _optionSaveRectTop;
+
+	_optionSaveRectTop.bottom = _optionSaveRectTop.top + pos;
+	_optionSaveRectTop.top++;
+	_optionSaveRectTop.right--;
+
+	_optionSaveRectSlider.top = _optionSaveRectTop.bottom;
+	_optionSaveRectSlider.bottom = _optionSaveRectSlider.top + sliderHeight;
+
+	_optionSaveRectBottom.top = _optionSaveRectSlider.bottom;
+	_optionSaveRectBottom.right--;
+}
+
 void Interface::drawOption() {
+	const char *text;
 	SURFACE *backBuffer;
 	int i;
+	int fontHeight;
+	uint j, idx;
+	int fgColor;
+	int bgColor;
 	Point origin;
+	Rect rect;
+	Rect rect2;
 	PanelButton *panelButton;
 
 	backBuffer = _vm->_gfx->getBackBuffer();
@@ -461,20 +519,82 @@
 		if(panelButton->type == kPanelButtonOption) {
 			drawOptionPanelButtonText(backBuffer, panelButton);
 		}		
+		if (panelButton->type == kPanelButtonOptionText) {
+			text = _vm->getTextString(panelButton->id);
+			_optionPanel.calcPanelButtonRect(panelButton, rect);
+			_vm->_font->draw(MEDIUM_FONT_ID, backBuffer, text, 0, rect.left , rect.top,
+				_vm->getDisplayInfo().verbTextColor, _vm->getDisplayInfo().verbTextShadowColor, FONT_SHADOW);	 //TODO: create Option button colors constant	
+		}		
+	}	
+
+	if(_optionSaveRectTop.height() > 0) {
+		drawRect(backBuffer, _optionSaveRectTop, kITEColorDarkGrey);
 	}
+	
+	drawButtonBox(backBuffer, _optionSaveRectSlider, true, _optionSaveFileSlider->state > 0);
+
+	if(_optionSaveRectBottom.height() > 0) {
+		drawRect(backBuffer, _optionSaveRectBottom, kITEColorDarkGrey);
+	}
+
+	_optionPanel.calcPanelButtonRect(_optionSaveFilePanel, rect);
+	rect2 = rect;
+	fontHeight = _vm->_font->getHeight(SMALL_FONT_ID);
+	for (j = 0; j < _vm->getDisplayInfo().optionSaveFileVisible; j++) {
+		bgColor = kITEColorDarkGrey0C;
+		fgColor = kITEColorBrightWhite;
+		
+		idx = j + _optionSaveFileTop;
+		if (idx == _optionSaveFileTitleNumber) {
+			SWAP(bgColor, fgColor);
+		}
+		if (idx < _vm->getSaveFileNameCount()) {
+			rect2.top = rect.top + j * (fontHeight + 1);
+			rect2.bottom = rect2.top + fontHeight;
+			backBuffer->fillRect(rect2, bgColor);
+			text = _vm->getSaveFileName(idx);
+			_vm->_font->draw(SMALL_FONT_ID, backBuffer, text, 0,
+				 rect.left + 1, rect2.top, fgColor, 0, 0);
+		}
+	}
+
 }
 
 void Interface::handleOptionUpdate(const Point& mousePoint) {
 	int i;
+	int16 mouseY;
+	Rect rect;
+	int totalFiles = _vm->getSaveFileNameCount();
+	int visibleFiles = _vm->getDisplayInfo().optionSaveFileVisible; 
+
+	if (_vm->mouseButtonPressed()) {
+		if (_optionSaveFileSlider->state > 0) {
+			_optionPanel.calcPanelButtonRect(_optionSaveFileSlider, rect);
+
+			mouseY = mousePoint.y - rect.top -_optionSaveFileMouseOff;
+
+			if (totalFiles - visibleFiles <= 0) {
+				_optionSaveFileTop = 0;
+			} else {
+				_optionSaveFileTop = mouseY * (totalFiles - visibleFiles) /
+					(_optionSaveFileSlider->height - _optionSaveRectSlider.height());
+			}
+
+			_optionSaveFileTop = clamp(0, _optionSaveFileTop, _vm->getSaveFileNameCount() - _vm->getDisplayInfo().optionSaveFileVisible);
+			calcOptionSaveSlider();
+		}
+	}
+
 	_optionPanel.currentButton = optionHitTest(mousePoint);	
-	bool released = (_optionPanel.currentButton != NULL) && (_optionPanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
+	bool releasedButton = (_optionPanel.currentButton != NULL) && (_optionPanel.currentButton->state > 0) && (!_vm->mouseButtonPressed());
+	
 	if (!_vm->mouseButtonPressed()) {
 		for (i = 0; i < _optionPanel.buttonsCount; i++) {
 			_optionPanel.buttons[i].state = 0;
 		}
 	}
 
-	if (released) {
+	if (releasedButton) {
 		setOption(_optionPanel.currentButton); 
 	}
 
@@ -483,6 +603,7 @@
 
 void Interface::handleOptionClick(const Point& mousePoint) {
 	int i;
+	Rect rect;
 	_optionPanel.currentButton = optionHitTest(mousePoint);
 
 	for (i = 0; i < _optionPanel.buttonsCount; i++) {
@@ -492,18 +613,50 @@
 	if (_optionPanel.currentButton == NULL) {
 		return;
 	}
+	
+	if (_optionPanel.currentButton == _optionSaveFileSlider) {		
+		if ((_optionSaveRectTop.height() > 0) && (mousePoint.y < _optionSaveRectTop.bottom)) {
+			_optionSaveFileTop -= _vm->getDisplayInfo().optionSaveFileVisible;
+		} else {
+			if ((_optionSaveRectBottom.height() > 0) && (mousePoint.y >= _optionSaveRectBottom.top)) {
+				_optionSaveFileTop += _vm->getDisplayInfo().optionSaveFileVisible;
+			} else {
+				if (_vm->getDisplayInfo().optionSaveFileVisible < _vm->getSaveFileNameCount()) {
+					_optionSaveFileMouseOff = mousePoint.y - _optionSaveRectSlider.top;
+					_optionPanel.currentButton->state = 1;
+				}
+			}
+		}
 
-	_optionPanel.currentButton->state = 1;
-
+		_optionSaveFileTop = clamp(0, _optionSaveFileTop, _vm->getSaveFileNameCount() - _vm->getDisplayInfo().optionSaveFileVisible);
+		calcOptionSaveSlider();
+	} else {
+		if (_optionPanel.currentButton == _optionSaveFilePanel) {
+			_optionPanel.calcPanelButtonRect(_optionSaveFilePanel, rect);
+			_optionSaveFileTitleNumber = (mousePoint.y - rect.top) / (_vm->_font->getHeight(SMALL_FONT_ID) + 1);
+			if (_optionSaveFileTitleNumber < 0) {
+				_optionSaveFileTitleNumber = 0;
+			}
+			if (_optionSaveFileTitleNumber >= _vm->getDisplayInfo().optionSaveFileVisible) {
+				_optionSaveFileTitleNumber = _vm->getDisplayInfo().optionSaveFileVisible - 1;
+			}
+			_optionSaveFileTitleNumber += _optionSaveFileTop;
+			if (_optionSaveFileTitleNumber >= _vm->getSaveFileNameCount()) {
+				_optionSaveFileTitleNumber = _vm->getSaveFileNameCount() - 1;
+			}
+		} else {
+			_optionPanel.currentButton->state = 1;
+		}
+	}
 }
 
 
 void Interface::setOption(PanelButton *panelButton) {
-	switch (panelButton->keyChar) {
-		case 'c':
+	switch (panelButton->id) {
+		case kTextContinuePlaying:
 				setMode(kPanelMain);
 				break;
-		case 'q':
+		case kTextQuitGame:
 			_vm->shutDown();
 			break;
 	}
@@ -511,7 +664,7 @@
 
 void Interface::update(const Point& mousePoint, int updateFlag) {
 	
-	if (_vm->_scene->isInDemo() || _panelMode == kPanelFade) {
+	if (_vm->_scene->isInDemo() || _panelMode == kPanelFade || !_active) {
 		return;
 	}
 
@@ -842,11 +995,37 @@
 	draw();
 }
 
-void Interface::drawButtonBox(SURFACE *ds, const Rect& rect, bool down) {
-	byte cornerColor = 0x8b;
-	byte frameColor = 0x0f;
-	byte fillColor = 0x96;
-	byte odl = 0x8a, our = 0x94, idl = 0x97, iur = 0x95;
+void Interface::drawButtonBox(SURFACE *ds, const Rect& rect, bool slider, bool down) {	
+	byte cornerColor;
+	byte frameColor;
+	byte fillColor;
+	byte solidColor;
+	byte odl, our, idl, iur;
+
+	if (slider) {
+		cornerColor = 0x8b;
+		frameColor = kITEColorBlack;
+		fillColor = kITEColorLightBlue96;
+		odl = kITEColorDarkBlue8a;
+		our = kITEColorLightBlue92;
+		idl = 0x89;
+		iur = 0x94;
+		solidColor = down ? kITEColorLightBlue94 : kITEColorLightBlue96;
+	} else {
+		cornerColor = 0x8b;
+		frameColor = kITEColorBlack;
+		solidColor = fillColor = kITEColorLightBlue96;
+		odl = kITEColorDarkBlue8a;
+		our = kITEColorLightBlue94;
+		idl = 0x97;
+		iur = 0x95;
+		if (down) {
+			SWAP(odl, our);
+			SWAP(idl, iur);
+		}
+
+	}
+
 	int x = rect.left;
 	int y = rect.top;
 	int w = rect.width();
@@ -863,10 +1042,6 @@
 	ds->vLine(x, y + 1, y + 1 + h - 2, frameColor);
 	ds->vLine(xe, y + 1, y + 1 + h - 2, frameColor);
 
-	if (down) {
-		SWAP(odl, our);
-		SWAP(idl, iur);
-	}
 	x++;
 	y++;
 	xe--;
@@ -895,19 +1070,31 @@
 	w -= 2; h -= 2;
 
 	Common::Rect fill(x, y, x + w, y + h);
-	ds->fillRect(fill, fillColor);
+	ds->fillRect(fill, solidColor);
 }
 
 void Interface::drawOptionPanelButtonText(SURFACE *ds, PanelButton *panelButton) {
 	const char *text;
+	int textId;
 	int textWidth;
 	int textHeight;
 	Point point;
 	int textColor;
 	Rect rect;
-//TODO: draw box!
 
-	text = _vm->getTextString(panelButton->id);
+	textId = panelButton->id;
+	switch(panelButton->id) {
+		case(kTextReadingSpeed):
+			textId = kTextFast;
+			break;			
+		case(kTextMusic):
+			textId = kTextOn;
+			break;			
+		case(kTextSound):
+			textId = kTextOn;
+			break;			
+	}
+	text = _vm->getTextString(textId);
 
 	textWidth = _vm->_font->getStringWidth(MEDIUM_FONT_ID, text, 0, 0);
 	textHeight = _vm->_font->getHeight(MEDIUM_FONT_ID);
@@ -922,7 +1109,7 @@
 	}
 
 	_optionPanel.calcPanelButtonRect(panelButton, rect);
-	drawButtonBox(ds, rect, panelButton->state > 0);
+	drawButtonBox(ds, rect, false, panelButton->state > 0);
 
 	_vm->_font->draw(MEDIUM_FONT_ID, ds, text, 0, point.x , point.y, textColor, _vm->getDisplayInfo().verbTextShadowColor, FONT_SHADOW);	 //TODO: create Option button colors constant
 }
@@ -1207,7 +1394,7 @@
 	}
 
 	if (_conversePanel.currentButton->type == kPanelButtonConverseText) {
-		converseSetPos(_conversePanel.currentButton->keyChar);
+		converseSetPos(_conversePanel.currentButton->ascii);
 	}
 
 	if (_conversePanel.currentButton->type == kPanelButtonArrow) {

Index: interface.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- interface.h	23 May 2005 18:53:35 -0000	1.51
+++ interface.h	28 May 2005 11:06:55 -0000	1.52
@@ -134,10 +134,16 @@
 	kITEColorLightGrey = 0x04,
 	kITEColorGrey = 0x0a,
 	kITEColorDarkGrey = 0x0b,
+	kITEColorDarkGrey0C = 0x0C,
 	kITEColorGreen = 0xba,
 	kITEColorBlack = 0x0f,
 	kITEColorRed = 0x65,
-	kITEColorBlue = 0x93
+	kITEColorDarkBlue8a = 0x8a,
+	kITEColorBlue89 = 0x89,
+	kITEColorLightBlue92 = 0x92,
+	kITEColorBlue = 0x93,
+	kITEColorLightBlue94 = 0x94,
+	kITEColorLightBlue96 = 0x96
 };
 
 
@@ -175,7 +181,7 @@
 	void drawStatusBar();
 	void setVerbState(int verb, int state);
 
-	bool processKeyCode(int keyCode);
+	bool processAscii(uint16 ascii);
 	
 private:
 	void drawInventory(SURFACE *backBuffer);
@@ -219,7 +225,7 @@
 	void handleConverseClick(const Point& mousePoint);				// converse panel click
 
 	PanelButton *optionHitTest(const Point& mousePoint) {
-		return _optionPanel.hitTest(mousePoint, kPanelAllButtons);
+		return _optionPanel.hitTest(mousePoint, kPanelButtonOptionSaveFiles | kPanelButtonOption | kPanelButtonOptionSlider);
 	}
 	void handleOptionUpdate(const Point& mousePoint);				// option panel update
 	void handleOptionClick(const Point& mousePoint);				// option panel click
@@ -230,11 +236,11 @@
 	void setOption(PanelButton *panelButton);
 
 	void drawOptionPanelButtonText(SURFACE *ds, PanelButton *panelButton);
-	void drawButtonBox(SURFACE *ds, const Rect& rect, bool down);
+	void drawButtonBox(SURFACE *ds, const Rect &rect, bool slider, bool down);
 	void drawPanelButtonArrow(SURFACE *ds, InterfacePanel *panel, PanelButton *panelButton);
 	void drawVerbPanelText(SURFACE *ds, PanelButton *panelButton, int textColor, int textShadowColor);
 	void drawVerbPanel(SURFACE *backBuffer, PanelButton* panelButton);
-
+	void calcOptionSaveSlider();
 public:
 	void converseInit(void);
 	void converseClear(void);
@@ -267,6 +273,8 @@
 	SpriteList _scenePortraits;
 	PanelButton *_verbTypeToPanelButton[kVerbTypesMax];
 	InterfacePanel _optionPanel;
+	PanelButton * _optionSaveFileSlider;
+	PanelButton * _optionSaveFilePanel;
 
 	int _saveReminderState;
 	bool _active;
@@ -296,6 +304,14 @@
 	int _converseStartPos;
 	int _converseEndPos;
 	int _conversePos;
+
+	uint _optionSaveFileTop;
+	uint _optionSaveFileTitleNumber;
+	int16 _optionSaveFileMouseOff;
+	Rect _optionSaveRectTop;
+	Rect _optionSaveRectSlider;
+	Rect _optionSaveRectBottom;
+
 };
 
 } // End of namespace Saga

Index: puzzle.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/puzzle.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- puzzle.cpp	26 May 2005 10:44:42 -0000	1.3
+++ puzzle.cpp	28 May 2005 11:06:55 -0000	1.4
@@ -351,7 +351,7 @@
 	if (_hintCount < 3) {
 		_vm->_actor->nonActorSpeech(&hintStr[_lang][_hintCount], 1, 0 );
 	} else {
-		int piece;
+		int piece = 0;
 
 		for (i = PUZZLE_PIECES - 1; i >= 0; i--) {
 			piece = _piecePriority[i];

Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- saga.h	26 May 2005 09:45:15 -0000	1.94
+++ saga.h	28 May 2005 11:06:55 -0000	1.95
@@ -151,8 +151,13 @@
 	kPanelButtonArrow = 2,
 	kPanelButtonConverseText = 4,
 	kPanelButtonInventory = 8,
+	
 	kPanelButtonOption = 0x10,
-	kPanelButtonSlider = 0x20,
+	kPanelButtonOptionSlider = 0x20,
+	kPanelButtonOptionSaveFiles = 0x40,
+	kPanelButtonOptionText = 0x80,
+
+	kPanelButtonReserved = 0x100,
 	kPanelAllButtons = 0xFFFFF
 };
 
@@ -328,7 +333,7 @@
 	int width;
 	int height;
 	int id;
-	int keyChar;
+	uint16 ascii;
 	int state;
 	int upSpriteNumber;
 	int downSpriteNumber;
@@ -384,10 +389,29 @@
 	int conversePanelButtonsCount;
 	PanelButton *conversePanelButtons;
 
+	int optionSaveFilePanelIndex;
+	int optionSaveFileSliderIndex;
+	uint optionSaveFileVisible;
+
 	int optionPanelXOffset;
 	int optionPanelYOffset;
 	int optionPanelButtonsCount;
 	PanelButton *optionPanelButtons;
+
+	int quitPanelXOffset;
+	int quitPanelYOffset;
+	int quitPanelButtonsCount;
+	PanelButton *quitPanelButtons;
+
+	int loadPanelXOffset;
+	int loadPanelYOffset;
+	int loadPanelButtonsCount;
+	PanelButton *loadPanelButtons;
+
+	int savePanelXOffset;
+	int savePanelYOffset;
+	int savePanelButtonsCount;
+	PanelButton *savePanelButtons;
 };
 
 
@@ -470,6 +494,12 @@
 	void fillSaveList();
 	char *calcSaveFileName(uint slotNumber);
 	char *getSaveFileName(uint idx);
+	bool saveListFull() const {
+		return _saveFileNamesMaxCount == _saveFileNamesCount;
+	}
+	uint getSaveFileNameCount() const {
+		return saveListFull() ? _saveFileNamesCount : _saveFileNamesCount + 1;
+	}
 
 	int _soundEnabled;
 	int _musicEnabled;
@@ -545,6 +575,7 @@
 
  private:
 	Common::String _targetName;
+	uint _saveFileNamesMaxCount;
 	uint _saveFileNamesCount;
 	char _saveFileNames[MAX_SAVES][SAVE_TITLE_SIZE];
 	Point _mousePos;

Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saveload.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- saveload.cpp	23 May 2005 22:09:24 -0000	1.10
+++ saveload.cpp	28 May 2005 11:06:55 -0000	1.11
@@ -48,6 +48,8 @@
 	char name[SAVE_TITLE_SIZE];
 };
 
+static char emptySlot[] = "[New Save Game]";
+
 //TODO: 
 // - delete savegame
 
@@ -61,7 +63,11 @@
 	if (idx >= MAX_SAVES) {
 		error("getSaveFileName wrong idx");
 	}
-	return _saveFileNames[idx];
+	if (saveListFull()) {
+		return _saveFileNames[idx];
+	} else {
+		return (idx == 0) ? emptySlot : _saveFileNames[idx - 1];
+	}	
 }
 
 
@@ -76,11 +82,16 @@
 	name[strlen(name) - 2] = 0;
 	_saveFileMan->listSavefiles(name, marks, MAX_SAVES);
 
+	_saveFileNamesMaxCount = 0;
 	for (i = 0; i < MAX_SAVES; i++) {
+		if (marks[i]) {
+			_saveFileNamesMaxCount++;
+		}
 		_saveFileNames[i][0] = 0;
 	}	
 	
 	_saveFileNamesCount = 0;
+	
 	i = 0;
 	while (i < MAX_SAVES) {
 		if (marks[i]) {
@@ -99,6 +110,13 @@
 		}
 		i++;
 	}
+
+	for (i = 0; i < MAX_SAVES; i++) {
+		sprintf(_saveFileNames[i], "test%i",i);
+	}	
+
+	_saveFileNamesCount = 14;
+
 }
 
 





More information about the Scummvm-git-logs mailing list