From ae1f189370883a6fdda01876b7679f2758b84e63 Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 2 Jul 2013 15:10:16 +0200 Subject: AVALANCHE: Change constructor of Scrolls, repair string handling in Lucerna and Scrolls. --- engines/avalanche/avalanche.cpp | 7 +++---- engines/avalanche/avalot.cpp | 2 +- engines/avalanche/avalot.h | 4 ++-- engines/avalanche/lucerna2.cpp | 9 ++++----- engines/avalanche/scrolls2.cpp | 13 ++++++------- engines/avalanche/scrolls2.h | 2 +- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index a55ab3eefa..6c559d84f2 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -47,12 +47,11 @@ namespace Avalanche { _console = new AvalancheConsole(this); _rnd = 0; - _avalot.setParent(this); _gyro.setParent(this); _enhanced.setParent(this); _logger.setParent(this); _pingo.setParent(this); - _scrolls.setParent(this); + _scrolls.setParent(this); _scrolls.init(); _visa.setParent(this); _lucerna.setParent(this); _lucerna.init(); _enid.setParent(this); @@ -64,6 +63,7 @@ namespace Avalanche { _basher.setParent(this); _dropdown.setParent(this); _closing.setParent(this); + _avalot.setParent(this); _avalot.init(); } AvalancheEngine::~AvalancheEngine() { @@ -229,8 +229,7 @@ namespace Avalanche { void AvalancheEngine::run_avalot() { bflight_on(); - Avalot ava; - ava.run(Common::String(runcodes[first_time]) + arguments); // TODO: Check if parameteres are ever use and eventually remove them + _avalot.run(Common::String(runcodes[first_time]) + arguments); // TODO: Check if parameteres are ever use and eventually remove them // If there's an error initalizing avalot, i'll handle it in there, not here first_time = false; } diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index b4214c22bc..5172e3074e 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -50,7 +50,7 @@ namespace Avalanche { -Avalot::Avalot() { +void Avalot::init() { int16 gd, gm; checkbreak = false; diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index 4c428b6172..5881108cfc 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -35,10 +35,10 @@ class AvalancheEngine; class Avalot { public: - Avalot(); - void setParent(AvalancheEngine *vm); + void init(); + void run(Common::String arg); private: diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index d343923249..48ccd3a317 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -100,8 +100,7 @@ Common::String Lucerna::nextstring() { } void Lucerna::scram1(Common::String &x) { - byte fz; - for (fz = 1; fz <= x.size(); fz ++) + for (int fz = 0; fz < x.size(); fz ++) x.setChar(x[fz] ^ 177, fz); } @@ -637,9 +636,9 @@ void Lucerna::inkey() { _vm->_enhanced.extd = '#'; /* alt-spacebar = alt-H */ } } else { - if (_vm->_gyro.mousetext[1] == '`') - _vm->_gyro.mousetext.setChar(13,1); /* Backquote = return in a macro */ - _vm->_enhanced.inchar = _vm->_gyro.mousetext[1]; + if (_vm->_gyro.mousetext[0] == '`') + _vm->_gyro.mousetext.setChar(13,0); /* Backquote = return in a macro */ + _vm->_enhanced.inchar = _vm->_gyro.mousetext[0]; _vm->_gyro.mousetext = Common::String(_vm->_gyro.mousetext.c_str() + 2, 253); } } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index a9c94b5d95..cefb4a2882 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -44,16 +44,15 @@ namespace Avalanche { -Scrolls::Scrolls() { - loadfont(); - resetscrolldriver(); - -} - void Scrolls::setParent(AvalancheEngine *vm) { _vm = vm; } +void Scrolls::init() { + loadfont(); + resetscrolldriver(); +} + void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ warning("STUB: Scrolls::state()"); } @@ -156,7 +155,7 @@ bool Scrolls::ask(Common::String question) { void Scrolls::resetscroll() { _vm->_gyro.scrolln = 1; for (int j = 0; j < 15; j ++) - for (int i = 0; i < sizeof(_vm->_gyro.scroll); i++) + for (int i = 0; i < _vm->_gyro.scroll[j].size(); i++) _vm->_gyro.scroll[j].setChar(0, i); } diff --git a/engines/avalanche/scrolls2.h b/engines/avalanche/scrolls2.h index f946b8f578..e343309c51 100644 --- a/engines/avalanche/scrolls2.h +++ b/engines/avalanche/scrolls2.h @@ -43,7 +43,7 @@ public: - Scrolls(); + void init(); void setParent(AvalancheEngine *vm); -- cgit v1.2.3