diff options
Diffstat (limited to 'queen')
-rw-r--r-- | queen/defs.h | 1 | ||||
-rw-r--r-- | queen/input.cpp | 52 | ||||
-rw-r--r-- | queen/input.h | 12 | ||||
-rw-r--r-- | queen/queen.cpp | 2 |
4 files changed, 63 insertions, 4 deletions
diff --git a/queen/defs.h b/queen/defs.h index 2ef66ec5ad..b78c3385e2 100644 --- a/queen/defs.h +++ b/queen/defs.h @@ -86,6 +86,7 @@ enum Language { ENGLISH = 'E', FRENCH = 'F', GERMAN = 'G', + HEBREW = 'H', ITALIAN = 'I', SPANISH = 'S' }; diff --git a/queen/input.cpp b/queen/input.cpp index 2a692d4e9a..ebeb394671 100644 --- a/queen/input.cpp +++ b/queen/input.cpp @@ -26,11 +26,43 @@ namespace Queen { - -Input::Input(OSystem *system) : +const char* Input::_commandKeys[LANGUAGE_COUNT] = { + { "ocmglptu" }, // English + { "osbgpnre" }, // German + { "ofdnepau" }, // French + { "acsdgpqu" }, // Italian + { "ocmglptu" }, // Hebrew + { "acodmthu" } // Spanish +}; + +Input::Input(Language language, OSystem *system) : _system(system), _fastMode(false), _keyVerb(VERB_NONE), _cutawayRunning(false), _cutawayQuit(false), _talkQuit(false), _inKey(0), _mouse_x(0), _mouse_y(0), _mouseButton(0) { + + switch (language) { + case ENGLISH: + _currentCommandKeys = _commandKeys[0]; + break; + case GERMAN: + _currentCommandKeys = _commandKeys[1]; + break; + case FRENCH: + _currentCommandKeys = _commandKeys[2]; + break; + case ITALIAN: + _currentCommandKeys = _commandKeys[3]; + break; + case HEBREW: + _currentCommandKeys = _commandKeys[4]; + break; + case SPANISH: + _currentCommandKeys = _commandKeys[5]; + break; + default: + error("Unknown language"); + break; + } } void Input::delay() { @@ -155,6 +187,22 @@ void Input::checkKeys() { break; default: + if(_inKey == _currentCommandKeys[0]) + _keyVerb = Verb(VERB_OPEN); + else if(_inKey == _currentCommandKeys[1]) + _keyVerb = Verb(VERB_CLOSE); + else if(_inKey == _currentCommandKeys[2]) + _keyVerb = Verb(VERB_MOVE); + else if(_inKey == _currentCommandKeys[3]) + _keyVerb = Verb(VERB_GIVE); + else if(_inKey == _currentCommandKeys[4]) + _keyVerb = Verb(VERB_LOOK_AT); + else if(_inKey == _currentCommandKeys[5]) + _keyVerb = Verb(VERB_PICK_UP); + else if(_inKey == _currentCommandKeys[6]) + _keyVerb = Verb(VERB_TALK_TO); + else if(_inKey == _currentCommandKeys[7]) + _keyVerb = Verb(VERB_USE); break; } diff --git a/queen/input.h b/queen/input.h index 6c9d15b1bc..d82bbd05b4 100644 --- a/queen/input.h +++ b/queen/input.h @@ -45,7 +45,7 @@ class Input { MOUSE_RBUTTON = 2 }; - Input(OSystem *system); + Input(Language language, OSystem *system); //! calls the other delay() with a value adjusted depending on _fastMode void delay(); @@ -96,6 +96,11 @@ class Input { KEY_F1 = 282 }; + + enum + { + LANGUAGE_COUNT = 6 + }; //! Used to get keyboard and mouse events OSystem *_system; @@ -127,6 +132,11 @@ class Input { //! Set by delay(); int _mouseButton; + //! Command keys for current language + const char* _currentCommandKeys; + + //! Command keys for all languages + static const char* _commandKeys[LANGUAGE_COUNT]; }; } // End of namespace Queen diff --git a/queen/queen.cpp b/queen/queen.cpp index 9e1ee37e4c..64fbc80a4b 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -211,7 +211,7 @@ void QueenEngine::go() { void QueenEngine::initialise(void) { _resource = new Resource(_gameDataPath, _detector->_game.detectname); - _input = new Input(_system); + _input = new Input(_resource->getLanguage(), _system); _display = new Display(_system, _input); _graphics = new Graphics(_display, _input, _resource); _sound = Sound::giveSound(_mixer, _input, _resource, _resource->compression()); |