aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2013-07-28 10:00:14 +0200
committeruruk2013-07-28 10:00:14 +0200
commita1a2fa2da8f54d5c573e45ff553c1440137b8b6a (patch)
tree91883b8f933b33102cba870979d62d38f019ebfc
parent825df596e66587963c59e51da831b938ae9d3886 (diff)
downloadscummvm-rg350-a1a2fa2da8f54d5c573e45ff553c1440137b8b6a.tar.gz
scummvm-rg350-a1a2fa2da8f54d5c573e45ff553c1440137b8b6a.tar.bz2
scummvm-rg350-a1a2fa2da8f54d5c573e45ff553c1440137b8b6a.zip
AVALANCHE: Implement handling of the cursor in Parser.
-rw-r--r--engines/avalanche/avalot.cpp10
-rw-r--r--engines/avalanche/basher2.cpp13
-rw-r--r--engines/avalanche/basher2.h6
-rw-r--r--engines/avalanche/gyro2.h1
-rw-r--r--engines/avalanche/parser.cpp47
-rw-r--r--engines/avalanche/parser.h9
6 files changed, 60 insertions, 26 deletions
diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp
index f553c453a0..e1879e1b56 100644
--- a/engines/avalanche/avalot.cpp
+++ b/engines/avalanche/avalot.cpp
@@ -143,8 +143,8 @@ void Avalot::setup() {
//setcolor(7);
_vm->_gyro->holdthedawn = false;
_vm->_lucerna->dawn();
- _vm->_gyro->cursoron = false;
- _vm->_basher->cursor_on();
+ _vm->_parser->_cursorState = false;
+ _vm->_parser->cursorOn();
_vm->_trip->newspeed();
if (! _vm->_gyro->reloaded)
@@ -171,8 +171,12 @@ void Avalot::handleKeyDown(const Common::Event &event) {
case Common::KEYCODE_KP5:
_vm->_trip->handleMoveKey(event); // Fallthroughs are intended.
break;
- case Common::KEYCODE_BACKSPACE :
+ case Common::KEYCODE_BACKSPACE:
_vm->_parser->handleBackspace();
+ break;
+ case Common::KEYCODE_RETURN:
+ _vm->_parser->handleReturn();
+ break;
}
if ((32 <= event.kbd.ascii) && (event.kbd.ascii <= 128) && (event.kbd.ascii != 47))
diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp
index dcd315839a..8e51abeb96 100644
--- a/engines/avalanche/basher2.cpp
+++ b/engines/avalanche/basher2.cpp
@@ -95,19 +95,6 @@ begin
end else dec(curflash);
end;*/
-void Basher::do_cursor() {
- warning("STUB: Basher::do_cursor()");
-}
-
-void Basher::cursor_on() {
- warning("STUB: Basher::cursor_on()");
-}
-
-void Basher::cursor_off() {
- warning("STUB: Basher::cursor_off()");
-}
-
-
void Basher::get_demorec() {
warning("STUB: Basher::get_demorec()");
}
diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h
index 0c865d43d3..a6d7067945 100644
--- a/engines/avalanche/basher2.h
+++ b/engines/avalanche/basher2.h
@@ -53,14 +53,10 @@ public:
void keyboard_link();
- void cursor_on();
-
void get_demorec();
bool demo_ready();
- void cursor_off();
-
void filename_edit();
void normal_edit();
@@ -76,8 +72,6 @@ private:
void wipetext();
- void do_cursor();
-
char firstchar(Common::String x);
void try_dd();
diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h
index 27a184eb1e..5038e51a08 100644
--- a/engines/avalanche/gyro2.h
+++ b/engines/avalanche/gyro2.h
@@ -479,7 +479,6 @@ public:
- bool cursoron;
/* previous:^previoustype;*/
Common::String last;
dnatype dna;
diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp
index 096aca3e60..14eae449ed 100644
--- a/engines/avalanche/parser.cpp
+++ b/engines/avalanche/parser.cpp
@@ -57,7 +57,7 @@ void Parser::handleInputText(const Common::Event &event) {
}
void Parser::handleBackspace() {
- if (! _vm->_dropdown->ddm_o.menunow) {
+ if (!_vm->_dropdown->ddm_o.menunow) {
if (_inputTextPos > _leftMargin) {
_inputTextPos--;
if ((_inputText[_inputTextPos] == '"') || (_inputText[_inputTextPos] == '`'))
@@ -69,11 +69,14 @@ void Parser::handleBackspace() {
}
}
+void Parser::handleReturn() {
+}
+
void Parser::plotText() {
if (_vm->_gyro->mouse_near_text())
_vm->_gyro->super_off();
- _vm->_basher->cursor_off();
+ cursorOff();
_vm->_graphics->drawBar(24, 161, 640, 169, black); // Black out the line of the text.
@@ -88,8 +91,46 @@ void Parser::plotText() {
}
}
- _vm->_basher->cursor_on();
+ cursorOn();
_vm->_gyro->super_on();
}
+void Parser::cursorOn() {
+ if (_cursorState == true)
+ return;
+ drawCursor();
+ _cursorState = true;
+}
+
+void Parser::cursorOff() {
+ if (_cursorState == false)
+ return;
+ drawCursor();
+ _cursorState = false;
+}
+
+void Parser::drawCursor() {
+ // Draw the '_' character. Similar to plotText().
+ char cursor = '_';
+
+ for (byte j = 0; j < 8; j++) {
+ byte pixel = _vm->_gyro->characters[cursor][j];
+ for (byte bit = 0; bit < 8; bit++) {
+ byte pixelBit = (pixel >> bit) & 1;
+ if (pixelBit != 0)
+ *_vm->_graphics->getPixel(24 + _inputTextPos * 8 + 7 - bit, 161 + j) = white;
+ }
+ }
+
+
+
+ bytefield bf;
+ bf.x1 = _inputTextPos + 1;
+ bf.x2 = _inputTextPos + 2;
+ bf.y1 = 168;
+ bf.y2 = 168;
+ for (byte fv = 0; fv <= 1; fv ++)
+ _vm->_trip->getset[fv].remember(bf);
+}
+
} // End of namespace Avalanche
diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h
index 3dd5d37827..748498816f 100644
--- a/engines/avalanche/parser.h
+++ b/engines/avalanche/parser.h
@@ -39,6 +39,7 @@ public:
byte _inputTextPos;
bool _quote; // 66 or 99 next?
byte _leftMargin;
+ bool _cursorState;
@@ -48,11 +49,19 @@ public:
void handleBackspace();
+ void handleReturn();
+
void plotText();
+ void cursorOn();
+
+ void cursorOff();
+
private:
AvalancheEngine *_vm;
+ void drawCursor();
+
};
} // End of namespace Avalanche