AVALANCHE: Add tryDropdown() and _inputTextBackup to Parser, implement handleReturn(), stub tryDropdown() in Parser.

This commit is contained in:
uruk 2013-07-28 10:46:46 +02:00
parent a1a2fa2da8
commit ad7f8add4d
6 changed files with 84 additions and 74 deletions

View file

@ -56,8 +56,8 @@ Basher::Basher(AvalancheEngine *vm) {
void Basher::init() { void Basher::init() {
/* new(previous);*/ /* new(previous);*/
if (!_vm->_gyro->last.empty()) if (!_vm->_parser->_inputTextBackup.empty())
_vm->_gyro->last.clear(); _vm->_parser->_inputTextBackup.clear();
normal_edit(); normal_edit();
@ -140,9 +140,7 @@ char Basher::firstchar(Common::String x) {
} }
void Basher::try_dd() { /* This asks the Parsekey proc in Dropdown if it knows it. */
warning("STUB: Basher::try_dd()");
}
void Basher::typein() { void Basher::typein() {
warning("STUB: Basher::typein()"); warning("STUB: Basher::typein()");

View file

@ -74,8 +74,6 @@ private:
char firstchar(Common::String x); char firstchar(Common::String x);
void try_dd();
void typein(); void typein();
}; };

View file

@ -480,7 +480,6 @@ public:
/* previous:^previoustype;*/ /* previous:^previoustype;*/
Common::String last;
dnatype dna; dnatype dna;
linetype lines[50]; /* For Also. */ linetype lines[50]; /* For Also. */
int16 c; int16 c;

View file

@ -70,6 +70,16 @@ void Parser::handleBackspace() {
} }
void Parser::handleReturn() { void Parser::handleReturn() {
if (_vm->_dropdown->ddm_o.menunow)
_vm->_parser->tryDropdown();
else {
_vm->_logger->log_command(_inputText);
if (!_inputText.empty())
_inputTextBackup = _inputText;
_vm->_acci->parse();
_vm->_acci->do_that();
}
} }
void Parser::plotText() { void Parser::plotText() {
@ -109,6 +119,10 @@ void Parser::cursorOff() {
_cursorState = false; _cursorState = false;
} }
void Parser::tryDropdown() {
warning("STUB: Parser::tryDropdown()"); // TODO: Implement at the same time with Dropdown.
}
void Parser::drawCursor() { void Parser::drawCursor() {
// Draw the '_' character. Similar to plotText(). // Draw the '_' character. Similar to plotText().
char cursor = '_'; char cursor = '_';

View file

@ -36,11 +36,12 @@ class AvalancheEngine;
class Parser { class Parser {
public: public:
Common::String _inputText; Common::String _inputText;
Common::String _inputTextBackup;
byte _inputTextPos; byte _inputTextPos;
bool _quote; // 66 or 99 next? bool _quote; // 66 or 99 next?
byte _leftMargin; byte _leftMargin;
bool _cursorState; bool _cursorState;
Parser(AvalancheEngine *vm); Parser(AvalancheEngine *vm);
@ -57,6 +58,8 @@ public:
void cursorOff(); void cursorOff();
void tryDropdown(); // This asks the parsekey proc in Dropdown if it knows it.
private: private:
AvalancheEngine *_vm; AvalancheEngine *_vm;

View file

@ -1633,72 +1633,70 @@ void Trip::new_game_for_trippancy() { /* Called by gyro.newgame */
void Trip::handleMoveKey(const Common::Event &event) { void Trip::handleMoveKey(const Common::Event &event) {
//if ((_vm->_gyro->ctrl == cjoy) | (!_vm->_gyro->dna.user_moves_avvy)) if (_vm->_dropdown->ddm_o.menunow)
// return; _vm->_parser->tryDropdown();
// else
// We don't mess around with the joystick. switch (event.kbd.keycode) {
case Common::KEYCODE_UP:
switch (event.kbd.keycode) { if (_vm->_gyro->dna.rw != up) {
case Common::KEYCODE_UP: _vm->_gyro->dna.rw = up;
if (_vm->_gyro->dna.rw != up) { rwsp(0, _vm->_gyro->dna.rw);
_vm->_gyro->dna.rw = up; } else
rwsp(0, _vm->_gyro->dna.rw); stopwalking();
} else break;
case Common::KEYCODE_DOWN:
if (_vm->_gyro->dna.rw != down) {
_vm->_gyro->dna.rw = down;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_LEFT:
if (_vm->_gyro->dna.rw != left) {
_vm->_gyro->dna.rw = left;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_RIGHT:
if (_vm->_gyro->dna.rw != right) {
_vm->_gyro->dna.rw = right;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_PAGEUP:
if (_vm->_gyro->dna.rw != ur) {
_vm->_gyro->dna.rw = ur;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_PAGEDOWN:
if (_vm->_gyro->dna.rw != dr) {
_vm->_gyro->dna.rw = dr;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_END:
if (_vm->_gyro->dna.rw != dl) {
_vm->_gyro->dna.rw = dl;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_HOME:
if (_vm->_gyro->dna.rw != ul) {
_vm->_gyro->dna.rw = ul;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_KP5:
stopwalking(); stopwalking();
break; break;
case Common::KEYCODE_DOWN: }
if (_vm->_gyro->dna.rw != down) {
_vm->_gyro->dna.rw = down;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_LEFT:
if (_vm->_gyro->dna.rw != left) {
_vm->_gyro->dna.rw = left;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_RIGHT:
if (_vm->_gyro->dna.rw != right) {
_vm->_gyro->dna.rw = right;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_PAGEUP:
if (_vm->_gyro->dna.rw != ur) {
_vm->_gyro->dna.rw = ur;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_PAGEDOWN:
if (_vm->_gyro->dna.rw != dr) {
_vm->_gyro->dna.rw = dr;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_END:
if (_vm->_gyro->dna.rw != dl) {
_vm->_gyro->dna.rw = dl;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_HOME:
if (_vm->_gyro->dna.rw != ul) {
_vm->_gyro->dna.rw = ul;
rwsp(0, _vm->_gyro->dna.rw);
} else
stopwalking();
break;
case Common::KEYCODE_KP5:
stopwalking();
break;
}
} }