aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorTorbjörn Andersson2007-03-17 15:44:26 +0000
committerTorbjörn Andersson2007-03-17 15:44:26 +0000
commit53624376b4d614689695d1ea56c1052cd0e7ad12 (patch)
treec98fc0e637f6634d270ae0b6e5311852e3634811 /engines/saga
parente72455c215a1deebe235d18e7efbe55f76d8f2da (diff)
downloadscummvm-rg350-53624376b4d614689695d1ea56c1052cd0e7ad12.tar.gz
scummvm-rg350-53624376b4d614689695d1ea56c1052cd0e7ad12.tar.bz2
scummvm-rg350-53624376b4d614689695d1ea56c1052cd0e7ad12.zip
Applied my re-revised patch #1487149 ("Simplified keyboard repeat"), with
Fingolfin's blessings. Keyboard repeat is now handled by the event manager, rather than by individual engines. Since this can cause problems with some engines (see the AGI engine), the extra "key down" events are marked as "synthetic", so that they can be ignored if necessary. svn-id: r26170
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/input.cpp3
-rw-r--r--engines/saga/interface.cpp44
-rw-r--r--engines/saga/interface.h10
3 files changed, 2 insertions, 55 deletions
diff --git a/engines/saga/input.cpp b/engines/saga/input.cpp
index ae14a43b9b..fdac5c2fc0 100644
--- a/engines/saga/input.cpp
+++ b/engines/saga/input.cpp
@@ -121,9 +121,6 @@ int SagaEngine::processInput() {
break;
}
break;
- case OSystem::EVENT_KEYUP:
- _interface->processKeyUp(event.kbd.ascii);
- break;
case OSystem::EVENT_LBUTTONUP:
_leftMouseButtonPressed = false;
break;
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index 0ff1396a49..7c37126d59 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -212,7 +212,6 @@ Interface::Interface(SagaEngine *vm) : _vm(vm) {
error("Interface::Interface(): not enough memory");
}
- _textInputRepeatPhase = 0;
_textInput = false;
_statusTextInput = false;
_statusTextInputState = kStatusTextInputFirstRun;
@@ -316,7 +315,6 @@ void Interface::setMode(int mode) {
_textInput = true;
_textInputStringLength = strlen(_textInputString);
_textInputPos = _textInputStringLength + 1;
- _textInputRepeatPhase = 0;
break;
case kPanelMap:
mapPanelShow();
@@ -337,14 +335,13 @@ void Interface::setMode(int mode) {
_textInputString[0] = 0;
_textInputStringLength = 0;
_textInputPos = _textInputStringLength + 1;
- _textInputRepeatPhase = 0;
break;
}
draw();
}
-bool Interface::processAscii(uint16 ascii, bool synthetic) {
+bool Interface::processAscii(uint16 ascii) {
// TODO: Checking for Esc and Enter below is a bit hackish, and
// and probably only works with the English version. Maybe we should
// add a flag to the button so it can indicate if it's the default or
@@ -352,8 +349,6 @@ bool Interface::processAscii(uint16 ascii, bool synthetic) {
int i;
PanelButton *panelButton;
- if (!synthetic)
- _textInputRepeatPhase = 0;
if (_statusTextInput) {
processStatusTextInput(ascii);
return true;
@@ -536,40 +531,6 @@ bool Interface::processAscii(uint16 ascii, bool synthetic) {
return false;
}
-#define KEYBOARD_REPEAT_DELAY1 300000L
-#define KEYBOARD_REPEAT_DELAY2 50000L
-
-void Interface::textInputRepeatCallback(void *refCon) {
- ((Interface *)refCon)->textInputRepeat();
-}
-
-void Interface::textInputStartRepeat(uint16 ascii) {
- if (!_textInputRepeatPhase) {
- _textInputRepeatPhase = 1;
- _vm->_timer->removeTimerProc(&textInputRepeatCallback);
- _vm->_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY1, this);
- }
-
- _textInputRepeatChar = ascii;
-}
-
-void Interface::textInputRepeat() {
- if (_textInputRepeatPhase == 1) {
- _textInputRepeatPhase = 2;
- _vm->_timer->removeTimerProc(&textInputRepeatCallback);
- _vm->_timer->installTimerProc(&textInputRepeatCallback, KEYBOARD_REPEAT_DELAY2, this);
- } else if (_textInputRepeatPhase == 2) {
- processAscii(_textInputRepeatChar, true);
- }
-}
-
-void Interface::processKeyUp(uint16 ascii) {
- if (_textInputRepeatPhase) {
- _vm->_timer->removeTimerProc(&textInputRepeatCallback);
- _textInputRepeatPhase = 0;
- }
-}
-
void Interface::setStatusText(const char *text, int statusColor) {
assert(text != NULL);
assert(strlen(text) < STATUS_TEXT_LEN);
@@ -928,7 +889,6 @@ void Interface::setLoad(PanelButton *panelButton) {
void Interface::processStatusTextInput(uint16 ascii) {
- textInputStartRepeat(ascii);
switch (ascii) {
case 27: // esc
_statusTextInputState = kStatusTextInputAborted;
@@ -968,8 +928,6 @@ bool Interface::processTextInput(uint16 ascii) {
memset(tempString, 0, SAVE_TITLE_SIZE);
ch[1] = 0;
- textInputStartRepeat(ascii);
-
switch (ascii) {
case 13:
return false;
diff --git a/engines/saga/interface.h b/engines/saga/interface.h
index 5f8f0f61e3..6dfaaa4984 100644
--- a/engines/saga/interface.h
+++ b/engines/saga/interface.h
@@ -222,8 +222,7 @@ public:
void drawStatusBar();
void setVerbState(int verb, int state);
- bool processAscii(uint16 ascii, bool synthetic = false);
- void processKeyUp(uint16 ascii);
+ bool processAscii(uint16 ascii);
void keyBoss();
void keyBossExit();
@@ -243,8 +242,6 @@ public:
}
private:
- static void textInputRepeatCallback(void *refCon);
-
void drawInventory(Surface *backBuffer);
void updateInventory(int pos);
void inventoryChangePos(int chg);
@@ -343,8 +340,6 @@ private:
void calcOptionSaveSlider();
bool processTextInput(uint16 ascii);
void processStatusTextInput(uint16 ascii);
- void textInputStartRepeat(uint16 ascii);
- void textInputRepeat(void);
public:
void converseInit(void);
@@ -452,9 +447,6 @@ private:
uint _statusTextInputPos;
- int _textInputRepeatPhase;
- uint16 _textInputRepeatChar;
-
PalEntry _mapSavedPal[PAL_ENTRIES];
bool _mapPanelCrossHairState;