diff options
author | David Corrales | 2007-06-23 18:51:33 +0000 |
---|---|---|
committer | David Corrales | 2007-06-23 18:51:33 +0000 |
commit | cacd7a28fd51d960947de88abbf30c487e66529d (patch) | |
tree | f3baa59853bfb307e452b86b9d93c4737b1fa6ab /engines/sword2 | |
parent | 0ac96302fe9c04df79cb01a77d19535b45fe2db0 (diff) | |
parent | 90c2210dae8c91fa8babc6b05564e15c9d445d18 (diff) | |
download | scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.tar.gz scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.tar.bz2 scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.zip |
Merged the FSNode branch with trunk r27031:27680
svn-id: r27681
Diffstat (limited to 'engines/sword2')
-rw-r--r-- | engines/sword2/animation.cpp | 4 | ||||
-rw-r--r-- | engines/sword2/controls.cpp | 17 | ||||
-rw-r--r-- | engines/sword2/screen.cpp | 3 | ||||
-rw-r--r-- | engines/sword2/sword2.cpp | 18 | ||||
-rw-r--r-- | engines/sword2/sword2.h | 5 |
5 files changed, 23 insertions, 24 deletions
diff --git a/engines/sword2/animation.cpp b/engines/sword2/animation.cpp index 2eb24430c7..12998e5e6d 100644 --- a/engines/sword2/animation.cpp +++ b/engines/sword2/animation.cpp @@ -429,7 +429,7 @@ void MoviePlayer::play(SequenceTextInfo *textList, uint32 numLines, int32 leadIn terminate = true; break; case Common::EVENT_KEYDOWN: - if (event.kbd.keycode == 27) + if (event.kbd.keycode == Common::KEYCODE_ESCAPE) terminate = true; break; default: @@ -518,7 +518,7 @@ bool MoviePlayerDXA::load() { if (loadFile(filename)) { // The Broken Sword games always use external audio tracks. - if (_fd.readUint32BE() != MKID_BE('NULL')) + if (_fd->readUint32BE() != MKID_BE('NULL')) return false; _frameBuffer = _vm->_screen->getScreen(); diff --git a/engines/sword2/controls.cpp b/engines/sword2/controls.cpp index 277ea108d9..84580c7520 100644 --- a/engines/sword2/controls.cpp +++ b/engines/sword2/controls.cpp @@ -26,6 +26,7 @@ */ #include "common/stdafx.h" +#include "common/events.h" #include "common/rect.h" #include "common/config-manager.h" #include "common/system.h" @@ -317,9 +318,9 @@ int Dialog::runModal() { KeyboardEvent *ke = _vm->keyboardEvent(); if (ke) { - if (ke->keycode == 27) + if (ke->kbd.keycode == Common::KEYCODE_ESCAPE) setResult(0); - else if (ke->keycode == '\n' || ke->keycode == '\r') + else if (ke->kbd.keycode == Common::KEYCODE_RETURN || ke->kbd.keycode == Common::KEYCODE_KP_ENTER) setResult(1); } @@ -1130,13 +1131,13 @@ public: virtual void onKey(KeyboardEvent *ke) { if (_editable) { - if (ke->keycode == 8) - _parent->onAction(this, 8); - else if (ke->ascii >= ' ' && ke->ascii <= 255) { + if (ke->kbd.keycode == Common::KEYCODE_BACKSPACE) + _parent->onAction(this, Common::KEYCODE_BACKSPACE); + else if (ke->kbd.ascii >= ' ' && ke->kbd.ascii <= 255) { // Accept the character if the font renderer // has what looks like a valid glyph for it. - if (_fr->getCharWidth(ke->ascii)) - _parent->onAction(this, ke->ascii); + if (_fr->getCharWidth(ke->kbd.ascii)) + _parent->onAction(this, ke->kbd.ascii); } } } @@ -1354,7 +1355,7 @@ void SaveRestoreDialog::onAction(Widget *widget, int result) { drawEditBuffer(slot); } break; - case 8: + case Common::KEYCODE_BACKSPACE: if (_editPos > _firstPos) { _editBuffer[_editPos - 1] = _editBuffer[_editPos]; _editBuffer[_editPos--] = 0; diff --git a/engines/sword2/screen.cpp b/engines/sword2/screen.cpp index a31d2a46c9..0a1b45d2de 100644 --- a/engines/sword2/screen.cpp +++ b/engines/sword2/screen.cpp @@ -31,6 +31,7 @@ #include "common/stdafx.h" #include "common/system.h" +#include "common/events.h" #include "sword2/sword2.h" #include "sword2/defs.h" @@ -1091,7 +1092,7 @@ void Screen::rollCredits() { KeyboardEvent *ke = _vm->keyboardEvent(); - if (ke && ke->keycode == 27) { + if (ke && ke->kbd.keycode == Common::KEYCODE_ESCAPE) { if (!abortCredits) { abortCredits = true; fadeDown(); diff --git a/engines/sword2/sword2.cpp b/engines/sword2/sword2.cpp index be240e5956..6bbd58ff3c 100644 --- a/engines/sword2/sword2.cpp +++ b/engines/sword2/sword2.cpp @@ -381,17 +381,17 @@ int Sword2Engine::go() { KeyboardEvent *ke = keyboardEvent(); if (ke) { - if ((ke->modifiers == Common::KBD_CTRL && ke->keycode == 'd') || ke->ascii == '#' || ke->ascii == '~') { + if ((ke->kbd.flags == Common::KBD_CTRL && ke->kbd.keycode == Common::KEYCODE_d) || ke->kbd.ascii == '#' || ke->kbd.ascii == '~') { _debugger->attach(); - } else if (ke->modifiers == 0 || ke->modifiers == Common::KBD_SHIFT) { - switch (ke->keycode) { - case 'p': + } else if (ke->kbd.flags == 0 || ke->kbd.flags == Common::KBD_SHIFT) { + switch (ke->kbd.keycode) { + case Common::KEYCODE_p: if (_gamePaused) unpauseGame(); else pauseGame(); break; - case 'c': + case Common::KEYCODE_c: if (!_logic->readVar(DEMO) && !_mouse->isChoosing()) { ScreenInfo *screenInfo = _screen->getScreenInfo(); _logic->fnPlayCredits(NULL); @@ -399,13 +399,13 @@ int Sword2Engine::go() { } break; #ifdef SWORD2_DEBUG - case ' ': + case Common::KEYCODE_SPACE: if (_gamePaused) { _stepOneCycle = true; unpauseGame(); } break; - case 's': + case Common::KEYCODE_s: _renderSkip = !_renderSkip; break; #endif @@ -553,9 +553,7 @@ void Sword2Engine::parseInputEvents() { } if (!(_inputEventFilter & RD_KEYDOWN)) { _keyboardEvent.pending = true; - _keyboardEvent.ascii = event.kbd.ascii; - _keyboardEvent.keycode = event.kbd.keycode; - _keyboardEvent.modifiers = event.kbd.flags; + _keyboardEvent.kbd = event.kbd; } break; case Common::EVENT_LBUTTONDOWN: diff --git a/engines/sword2/sword2.h b/engines/sword2/sword2.h index b6d6c331f9..a9a1e21875 100644 --- a/engines/sword2/sword2.h +++ b/engines/sword2/sword2.h @@ -39,6 +39,7 @@ #include "engines/engine.h" +#include "common/events.h" #include "common/util.h" #define MAX_starts 100 @@ -79,9 +80,7 @@ struct MouseEvent { struct KeyboardEvent { bool pending; - uint16 ascii; - int keycode; - int modifiers; + Common::KeyState kbd; }; struct StartUp { |