[Scummvm-cvs-logs] CVS: scummvm/sword1 control.cpp,1.26.2.1,1.26.2.2 control.h,1.12,1.12.2.1 mouse.h,1.12,1.12.2.1

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sun Jul 18 10:10:00 CEST 2004


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

Modified Files:
      Tag: branch-0-6-0
	control.cpp control.h mouse.h 
Log Message:
Backported usability fixes for the save/restore dialog: mouse wheel
support, blinking cursor and numbered savegames.


Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.cpp,v
retrieving revision 1.26.2.1
retrieving revision 1.26.2.2
diff -u -d -r1.26.2.1 -r1.26.2.2
--- control.cpp	2 Mar 2004 19:43:00 -0000	1.26.2.1
+++ control.cpp	18 Jul 2004 17:09:05 -0000	1.26.2.2
@@ -254,6 +254,8 @@
 			fullRefresh = true;
 			destroyButtons();
 			memset(_screenBuf, 0, 640 * 480);
+			if (mode != BUTTON_SAVE_PANEL)
+				_cursorVisible = false;
 		}
 		switch (mode) {
 			case BUTTON_MAIN_PANEL:
@@ -267,8 +269,19 @@
 					_system->property(OSystem::PROP_TOGGLE_VIRTUAL_KEYBOARD, &prop);
 					setupSaveRestorePanel(true);
 				}
-				if (_keyPressed)
-					handleSaveKey(_keyPressed);
+				if (_selectedSavegame < 255) {
+					bool visible = _cursorVisible;
+					if (_cursorTick == 0)
+						_cursorVisible = true;
+					else if (_cursorTick == 3)
+						_cursorVisible = false;
+					if (_keyPressed)
+						handleSaveKey(_keyPressed);
+					else if (_cursorVisible != visible)
+						showSavegameNames();
+					if (++_cursorTick > 5)
+						_cursorTick = 0;
+				}
 				break;
 			case BUTTON_RESTORE_PANEL:
 				if (fullRefresh)
@@ -334,6 +347,16 @@
 		}
 		_selectedButton = 255;
 	}
+	if (_mouseState & BS1_WHEEL_UP) {
+		for (uint8 cnt = 0; cnt < checkButtons; cnt++)
+			if (_buttons[cnt]->_id == BUTTON_SCROLL_UP_SLOW)
+				return handleButtonClick(_buttons[cnt]->_id, mode, retVal);
+	}
+	if (_mouseState & BS1_WHEEL_DOWN) {
+		for (uint8 cnt = 0; cnt < checkButtons; cnt++)
+			if (_buttons[cnt]->_id == BUTTON_SCROLL_DOWN_SLOW)
+				return handleButtonClick(_buttons[cnt]->_id, mode, retVal);
+	}
 	return 0;
 }
 
@@ -714,11 +737,15 @@
 		_buttons[cnt]->draw();
 		uint8 textMode = TEXT_LEFT_ALIGN;
 		uint16 ycoord = _saveButtons[cnt].y + 2;
+		uint8 str[40];
+		sprintf((char*)str, "%d. %s", cnt + _saveScrollPos + 1, _saveNames[cnt + _saveScrollPos]);
 		if (cnt + _saveScrollPos == _selectedSavegame) {
 			textMode |= TEXT_RED_FONT;
 			ycoord += 2;
+			if (_cursorVisible)
+				strcat((char*)str, "_");
 		}
-		renderText(_saveNames[cnt + _saveScrollPos], _saveButtons[cnt].x + 6, ycoord, textMode);
+		renderText(str, _saveButtons[cnt].x + 6, ycoord, textMode);
 	}
 }
 
@@ -741,6 +768,8 @@
 			_oldName[0] = '\0';
 		}
 	}
+	if (_selectedSavegame < 255)
+		_cursorTick = 0;
 	showSavegameNames();
 }
 
@@ -797,9 +826,10 @@
 
 void Control::renderText(const uint8 *str, uint16 x, uint16 y, uint8 mode) {
 	uint8 *font = _font;
-	if (mode & TEXT_RED_FONT)
+	if (mode & TEXT_RED_FONT) {
+		mode &= ~TEXT_RED_FONT;
 		font = _redFont;
-	mode &= ~TEXT_RED_FONT;
+	}
 	
 	if (mode == TEXT_RIGHT_ALIGN) // negative x coordinate means right-aligned.
 		x -= getTextWidth(str);
@@ -975,6 +1005,14 @@
 				_mouseDown = false;
 				_mouseState |= BS1L_BUTTON_UP;
 				break;
+			case OSystem::EVENT_WHEELUP:
+				_mouseDown = false;
+				_mouseState |= BS1_WHEEL_UP;
+				break;
+			case OSystem::EVENT_WHEELDOWN:
+				_mouseDown = false;
+				_mouseState |= BS1_WHEEL_DOWN;
+				break;
 			case OSystem::EVENT_QUIT:
 				_system->quit();
 				break;

Index: control.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.h,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -u -d -r1.12 -r1.12.2.1
--- control.h	11 Jan 2004 15:47:41 -0000	1.12
+++ control.h	18 Jul 2004 17:09:05 -0000	1.12.2.1
@@ -86,6 +86,8 @@
 	uint8 _selectedSavegame;
 	uint8 _saveNames[64][32];
 	uint8 _oldName[32];
+	uint8 _cursorTick;
+	bool _cursorVisible;
 
 	uint8 getClicks(uint8 mode, uint8 *retVal);
 	uint8 handleButtonClick(uint8 id, uint8 mode, uint8 *retVal);

Index: mouse.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/mouse.h,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -u -d -r1.12 -r1.12.2.1
--- mouse.h	11 Jan 2004 15:47:41 -0000	1.12
+++ mouse.h	18 Jul 2004 17:09:05 -0000	1.12.2.1
@@ -36,6 +36,8 @@
 #define BS1L_BUTTON_UP			4
 #define BS1R_BUTTON_DOWN		8
 #define BS1R_BUTTON_UP			16
+#define BS1_WHEEL_UP			32
+#define BS1_WHEEL_DOWN			64
 #define MOUSE_BOTH_BUTTONS		(BS1L_BUTTON_DOWN | BS1R_BUTTON_DOWN)
 #define MOUSE_DOWN_MASK			(BS1L_BUTTON_DOWN | BS1R_BUTTON_DOWN)
 #define MOUSE_UP_MASK			(BS1L_BUTTON_UP | BS1R_BUTTON_UP)





More information about the Scummvm-git-logs mailing list