[Scummvm-cvs-logs] scummvm master -> 702b66a49d27bb683e43083e6bf5efacf7cdd996

m-kiewitz m_kiewitz at users.sourceforge.net
Wed Feb 3 01:41:54 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
702b66a49d AGI: Make inner loop handlers consistent


Commit: 702b66a49d27bb683e43083e6bf5efacf7cdd996
    https://github.com/scummvm/scummvm/commit/702b66a49d27bb683e43083e6bf5efacf7cdd996
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-03T01:41:32+01:00

Commit Message:
AGI: Make inner loop handlers consistent

Changed paths:
    engines/agi/cycle.cpp
    engines/agi/inv.cpp
    engines/agi/inv.h
    engines/agi/menu.cpp
    engines/agi/menu.h
    engines/agi/systemui.cpp
    engines/agi/systemui.h
    engines/agi/text.cpp
    engines/agi/text.h



diff --git a/engines/agi/cycle.cpp b/engines/agi/cycle.cpp
index 29c97ba..3887999 100644
--- a/engines/agi/cycle.cpp
+++ b/engines/agi/cycle.cpp
@@ -228,7 +228,7 @@ int AgiEngine::mainCycle(bool onlyCheckForEvents) {
 			if (!handleController(key)) {
 				if (key) {
 					if (_text->promptIsEnabled()) {
-						_text->promptCharPress(key);
+						_text->promptKeyPress(key);
 					}
 				}
 			}
@@ -241,19 +241,19 @@ int AgiEngine::mainCycle(bool onlyCheckForEvents) {
 		case CYCLE_INNERLOOP_GETSTRING: // loop called from TextMgr::stringEdit()
 		case CYCLE_INNERLOOP_GETNUMBER:
 			if (key) {
-				_text->stringCharPress(key);
+				_text->stringKeyPress(key);
 			}
 			break;
 
 		case CYCLE_INNERLOOP_INVENTORY: // loop called from InventoryMgr::show()
 			if (key) {
-				_inventory->charPress(key);
+				_inventory->keyPress(key);
 			}
 			break;
 
 		case CYCLE_INNERLOOP_MENU_VIA_KEYBOARD:
 			if (key) {
-				_menu->charPress(key);
+				_menu->keyPress(key);
 			}
 			return false;
 
@@ -263,13 +263,13 @@ int AgiEngine::mainCycle(bool onlyCheckForEvents) {
 
 		case CYCLE_INNERLOOP_SYSTEMUI_SELECTSAVEDGAMESLOT:
 			if (key) {
-				_systemUI->savedGameSlot_CharPress(key);
+				_systemUI->savedGameSlot_KeyPress(key);
 			}
 			break;
 
 		case CYCLE_INNERLOOP_MESSAGEBOX:
 			if (key) {
-				_text->messageBox_CharPress(key);
+				_text->messageBox_KeyPress(key);
 			}
 			break;
 
diff --git a/engines/agi/inv.cpp b/engines/agi/inv.cpp
index 5bf8727..08dba9b 100644
--- a/engines/agi/inv.cpp
+++ b/engines/agi/inv.cpp
@@ -165,8 +165,8 @@ void InventoryMgr::show() {
 	}
 }
 
-void InventoryMgr::charPress(int16 newChar) {
-	switch (newChar) {
+void InventoryMgr::keyPress(uint16 newKey) {
+	switch (newKey) {
 	case AGI_KEY_ENTER: {
 		_vm->cycleInnerLoopInactive(); // exit show-loop
 		break;
diff --git a/engines/agi/inv.h b/engines/agi/inv.h
index 0c89275..4cdb490 100644
--- a/engines/agi/inv.h
+++ b/engines/agi/inv.h
@@ -52,7 +52,7 @@ public:
 	void drawItem(int16 itemNr);
 	void show();
 
-	void charPress(int16 newChar);
+	void keyPress(uint16 newKey);
 	void changeActiveItem(int16 direction);
 };
 
diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp
index 9ecf9c5..f7c7162 100644
--- a/engines/agi/menu.cpp
+++ b/engines/agi/menu.cpp
@@ -433,13 +433,13 @@ void GfxMenu::removeActiveMenu(int16 selectedMenuNr) {
 	_gfx->render_Block(_drawnMenuColumn, _drawnMenuRow, _drawnMenuWidth, _drawnMenuHeight);
 }
 
-void GfxMenu::charPress(uint16 newChar) {
+void GfxMenu::keyPress(uint16 newKey) {
 	GuiMenuEntry *menuEntry = _array[_drawnMenuNr];
 	GuiMenuItemEntry *itemEntry = _itemArray[menuEntry->selectedItemNr];
 	int16 newMenuNr = _drawnMenuNr;
 	int16 newItemNr = menuEntry->selectedItemNr;
 
-	switch (newChar) {
+	switch (newKey) {
 	case AGI_KEY_ENTER:
 		// check, if current item is actually enabled
 		if (!itemEntry->enabled)
@@ -529,7 +529,7 @@ void GfxMenu::charPress(uint16 newChar) {
 // During "via keyboard" mode in case user actively clicks on something
 // During "via mouse" mode all the time, so that current mouse cursor position modifies active selection
 // In "via mouse" mode, we check if user let go of the left mouse button and then select the item that way
-void GfxMenu::mouseEvent(uint16 newChar) {
+void GfxMenu::mouseEvent(uint16 newKey) {
 	// Find out, where current mouse cursor actually is
 	int16 mouseRow = _vm->_mouse.pos.y / FONT_DISPLAY_HEIGHT;
 	int16 mouseColumn = _vm->_mouse.pos.x / FONT_DISPLAY_WIDTH;
@@ -537,7 +537,7 @@ void GfxMenu::mouseEvent(uint16 newChar) {
 	int16 activeMenuNr, activeItemNr;
 	mouseFindMenuSelection(mouseRow, mouseColumn, activeMenuNr, activeItemNr);
 
-	switch (newChar) {
+	switch (newKey) {
 	case AGI_MOUSE_BUTTON_LEFT:
 		// User clicked somewhere, in this case check if user clicked on status bar or on one of the currently shown menu items
 		// Happens in "via keyboard" mode only
diff --git a/engines/agi/menu.h b/engines/agi/menu.h
index 3daeb74..a621d7f 100644
--- a/engines/agi/menu.h
+++ b/engines/agi/menu.h
@@ -65,8 +65,8 @@ public:
 	void itemDisable(uint16 controllerSlot);
 	void itemEnableAll();
 
-	void charPress(uint16 newChar);
-	void mouseEvent(uint16 newChar);
+	void keyPress(uint16 newKey);
+	void mouseEvent(uint16 newKey);
 
 	bool isAvailable();
 
diff --git a/engines/agi/systemui.cpp b/engines/agi/systemui.cpp
index ee0a450..aa1b2e4 100644
--- a/engines/agi/systemui.cpp
+++ b/engines/agi/systemui.cpp
@@ -295,13 +295,13 @@ int16 SystemUI::askForSavedGameSlot(const char *slotListText) {
 	return _savedGameSelectedSlotNr;
 }
 
-void SystemUI::savedGameSlot_CharPress(int16 newChar) {
+void SystemUI::savedGameSlot_KeyPress(uint16 newKey) {
 	int16 slotCount = _savedGameArray.size();
 	int16 newUpmostSlotNr = _savedGameUpmostSlotNr;
 	int16 newSelectedSlotNr = _savedGameSelectedSlotNr;
 	bool  slotsScrolled = false;
 
-	switch (newChar) {
+	switch (newKey) {
 	case AGI_KEY_ENTER:
 		_vm->cycleInnerLoopInactive(); // exit savedGameSlot-loop
 		return;
diff --git a/engines/agi/systemui.h b/engines/agi/systemui.h
index d399f35..2792d73 100644
--- a/engines/agi/systemui.h
+++ b/engines/agi/systemui.h
@@ -71,7 +71,7 @@ public:
 	int16 askForRestoreGameSlot();
 	bool  askForSaveGameDescription(int16 slotId, Common::String &newDescription);
 
-	void  savedGameSlot_CharPress(int16 newChar);
+	void  savedGameSlot_KeyPress(uint16 newKey);
 
 private:
 	int16 askForSavedGameSlot(const char *slotListText);
diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp
index 45c5fb0..ceca678 100644
--- a/engines/agi/text.cpp
+++ b/engines/agi/text.cpp
@@ -383,7 +383,7 @@ bool TextMgr::messageBox(const char *textPtr) {
 	return true;
 }
 
-void TextMgr::messageBox_CharPress(uint16 newKey) {
+void TextMgr::messageBox_KeyPress(uint16 newKey) {
 	switch (newKey) {
 	case AGI_KEY_ENTER:
 		_vm->cycleInnerLoopInactive(); // exit messagebox-loop
@@ -616,7 +616,7 @@ bool TextMgr::promptIsEnabled() {
 	return _promptEnabled;
 }
 
-void TextMgr::promptCharPress(int16 newChar) {
+void TextMgr::promptKeyPress(uint16 newKey) {
 	int16 maxChars = 0;
 	int16 scriptsInputLen = _vm->getVar(VM_VAR_MAX_INPUT_CHARACTERS);
 
@@ -634,12 +634,12 @@ void TextMgr::promptCharPress(int16 newChar) {
 
 	inputEditOn();
 
-	switch (newChar) {
+	switch (newKey) {
 	case AGI_KEY_BACKSPACE: {
 		if (_promptCursorPos) {
 			_promptCursorPos--;
 			_prompt[_promptCursorPos] = 0;
-			displayCharacter(newChar);
+			displayCharacter(newKey);
 
 			promptRememberForAutoComplete();
 		}
@@ -671,20 +671,20 @@ void TextMgr::promptCharPress(int16 newChar) {
 			// but as soon as invalid characters were used in graphics mode they weren't properly shown
 			switch (_vm->getLanguage()) {
 			case Common::RU_RUS:
-				if (newChar >= 0x20)
+				if (newKey >= 0x20)
 					acceptableInput = true;
 				break;
 			default:
-				if ((newChar >= 0x20) && (newChar <= 0x7f))
+				if ((newKey >= 0x20) && (newKey <= 0x7f))
 					acceptableInput = true;
 				break;
 			}
 
 			if (acceptableInput) {
-				_prompt[_promptCursorPos] = newChar;
+				_prompt[_promptCursorPos] = newKey;
 				_promptCursorPos++;
 				_prompt[_promptCursorPos] = 0;
-				displayCharacter(newChar);
+				displayCharacter(newKey);
 
 				promptRememberForAutoComplete();
 			}
@@ -697,7 +697,7 @@ void TextMgr::promptCharPress(int16 newChar) {
 
 void TextMgr::promptCancelLine() {
 	while (_promptCursorPos) {
-		promptCharPress(0x08); // Backspace until prompt is empty
+		promptKeyPress(0x08); // Backspace until prompt is empty
 	}
 }
 
@@ -708,7 +708,7 @@ void TextMgr::promptEchoLine() {
 		inputEditOn();
 
 		while (_promptPrevious[_promptCursorPos]) {
-			promptCharPress(_promptPrevious[_promptCursorPos]);
+			promptKeyPress(_promptPrevious[_promptCursorPos]);
 		}
 		promptRememberForAutoComplete();
 
@@ -795,10 +795,10 @@ void TextMgr::stringEdit(int16 stringMaxLen) {
 	_vm->nonBlockingText_Forget();
 }
 
-void TextMgr::stringCharPress(int16 newChar) {
+void TextMgr::stringKeyPress(uint16 newKey) {
 	inputEditOn();
 
-	switch (newChar) {
+	switch (newKey) {
 	case 0x3:       // ctrl-c
 	case 0x18: {    // ctrl-x
 		// clear string
@@ -814,7 +814,7 @@ void TextMgr::stringCharPress(int16 newChar) {
 		if (_inputStringCursorPos) {
 			_inputStringCursorPos--;
 			_inputString[_inputStringCursorPos] = 0;
-			displayCharacter(newChar);
+			displayCharacter(newKey);
 
 			stringRememberForAutoComplete();
 		}
@@ -848,23 +848,23 @@ void TextMgr::stringCharPress(int16 newChar) {
 			// but as soon as invalid characters were used in graphics mode they weren't properly shown
 			switch (_vm->getLanguage()) {
 			case Common::RU_RUS:
-				if (newChar >= 0x20)
+				if (newKey >= 0x20)
 					acceptableInput = true;
 				break;
 			default:
-				if ((newChar >= 0x20) && (newChar <= 0x7f))
+				if ((newKey >= 0x20) && (newKey <= 0x7f))
 					acceptableInput = true;
 				break;
 			}
 
 			if (acceptableInput) {
-				if ((_vm->_game.cycleInnerLoopType == CYCLE_INNERLOOP_GETSTRING) || ((newChar >= '0') && (newChar <= '9'))) {
+				if ((_vm->_game.cycleInnerLoopType == CYCLE_INNERLOOP_GETSTRING) || ((newKey >= '0') && (newKey <= '9'))) {
 					// Additionally check for GETNUMBER-mode, if character is a number
 					// Sierra also did not do this
-					_inputString[_inputStringCursorPos] = newChar;
+					_inputString[_inputStringCursorPos] = newKey;
 					_inputStringCursorPos++;
 					_inputString[_inputStringCursorPos] = 0;
-					displayCharacter(newChar);
+					displayCharacter(newKey);
 
 					stringRememberForAutoComplete();
 				}
diff --git a/engines/agi/text.h b/engines/agi/text.h
index 1de82e5..1e9b971 100644
--- a/engines/agi/text.h
+++ b/engines/agi/text.h
@@ -132,7 +132,7 @@ public:
 	void print(int16 textNr);
 
 	bool messageBox(const char *textPtr);
-	void messageBox_CharPress(uint16 newKey);
+	void messageBox_KeyPress(uint16 newKey);
 
 	bool _messageBoxCancelled;
 
@@ -180,7 +180,7 @@ public:
 
 	void promptRow_Set(int16 row);
 	int16 promptRow_Get();
-	void promptCharPress(int16 newChar);
+	void promptKeyPress(uint16 newKey);
 	void promptCancelLine();
 	void promptEchoLine();
 	void promptRedraw();
@@ -199,7 +199,7 @@ public:
 	int16 stringGetMaxLen();
 	void stringSet(const char *text);
 	void stringEdit(int16 stringMaxLen);
-	void stringCharPress(int16 newChar);
+	void stringKeyPress(uint16 newKey);
 	void stringRememberForAutoComplete(bool entered = false); // for auto-completion
 
 	char *stringPrintf(const char *originalText);






More information about the Scummvm-git-logs mailing list