aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2013-07-28 18:50:46 +0200
committeruruk2013-07-28 18:50:46 +0200
commit9474e2dc61c25abab1b069de3d94b49ef25b655b (patch)
tree25de554c97eb19ea4da3630338574eb78e88b7dd /engines
parent17b2fb02c0cff674edeb4eeb0640e1739f71c457 (diff)
downloadscummvm-rg350-9474e2dc61c25abab1b069de3d94b49ef25b655b.tar.gz
scummvm-rg350-9474e2dc61c25abab1b069de3d94b49ef25b655b.tar.bz2
scummvm-rg350-9474e2dc61c25abab1b069de3d94b49ef25b655b.zip
AVALANCHE: Revisions in acci2.h and lucerna2.cpp, partially implement Acci::parse() and functions connected to it.
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/acci2.cpp36
-rw-r--r--engines/avalanche/acci2.h108
-rw-r--r--engines/avalanche/lucerna2.cpp2
3 files changed, 78 insertions, 68 deletions
diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp
index 6f03d7f32c..1716b60d51 100644
--- a/engines/avalanche/acci2.cpp
+++ b/engines/avalanche/acci2.cpp
@@ -235,10 +235,10 @@ void Acci::clearwords() {
byte Acci::wordnum(Common::String x) {
if (x.empty())
return 0;
-
+
byte whatsit = pardon;
bool gotcha = false;
- for (uint16 fv = 0; fv < nowords; fv++) {
+ for (int32 fv = nowords - 1; fv >= 0; fv--) {
if ((words[fv].w == x) || ((Common::String(words[fv].w.c_str(), x.size()) == x) && !gotcha))
whatsit = words[fv].n;
if (words[fv].w == x)
@@ -388,12 +388,13 @@ int16 Acci::pos(const Common::String &crit, const Common::String &src) {
void Acci::parse() {
byte n, fv, ff;
Common::String c, cc, thisword;
- Common::String answer;
+ byte answer;
bool notfound;
// First parsing - word identification
- thats = "";
+ if (!thats.empty())
+ thats.clear();
c = _vm->_parser->_inputText + ' ';
n = 0;
polite = false;
@@ -410,7 +411,6 @@ void Acci::parse() {
} // Not our department! Otherwise...
// Are we being interrogated right now?
-
if (_vm->_gyro->interrogation > 0) {
store_interrogation(_vm->_gyro->interrogation);
_vm->_gyro->weirdword = true;
@@ -437,9 +437,11 @@ void Acci::parse() {
punctustrip(c);
notfound = true;
+
+ // Check also first, which conatins words about the actual room.
if (!thisword.empty()) {
- for (ff = 0; ff < 31; ff++) { // Check Also, FIRST!
- if (pos(',' + thisword, *_vm->_gyro->also[ff][0]) > -1) {
+ for (ff = 0; ff < 31; ff++) {
+ if ((_vm->_gyro->also[ff][0] != 0) && (pos(',' + thisword, *_vm->_gyro->also[ff][0]) > -1)) {
thats = thats + Common::String(99 + ff);
notfound = false;
}
@@ -448,7 +450,7 @@ void Acci::parse() {
if (notfound) {
answer = wordnum(thisword);
- if (answer[0] == pardon) {
+ if (answer == pardon) {
notfound = true;
thats = thats + pardon;
} else
@@ -456,12 +458,22 @@ void Acci::parse() {
n++;
}
- c.deleteChar(pos(c, Common::String(' ')));
- cc.deleteChar(pos(cc, Common::String(' ')));
+ int16 spacePos = pos(Common::String(' '), c);
+ if (spacePos > -1)
+ for (byte i = 0; i <= spacePos; i++)
+ c.deleteChar(0);
+ spacePos = pos(Common::String(' '), cc);
+ if (spacePos > -1)
+ for (byte i = 0; i <= spacePos; i++)
+ cc.deleteChar(0);
}
- //if (pos("\376", thats) > 0) unknown = realwords[pos("\376", thats)];
- //else unknown = "";
+ if (pos(Common::String(254), thats) > -1)
+ unknown = realwords[pos("\376", thats)];
+ else
+ if (!unknown.empty())
+ unknown.clear();
+
//replace("\377", ""); /* zap noise words */
//replace(string('\15') + '\342', "\1"); /* "look at" = "examine" */
//replace(string('\15') + '\344', "\1"); /* "look in" = "examine" */
diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h
index dbc96f479b..bb55dac570 100644
--- a/engines/avalanche/acci2.h
+++ b/engines/avalanche/acci2.h
@@ -39,62 +39,62 @@ class AvalancheEngine;
class Acci {
public:
/* verb codes */
- static const char vb_exam = 1;
- static const char vb_open = 2;
- static const char vb_pause = 3;
- static const char vb_get = 4;
- static const char vb_drop = 5;
- static const char vb_inv = 6;
- static const char vb_talk = 7;
- static const char vb_give = 8;
- static const char vb_drink = 9;
- static const char vb_load = 10;
- static const char vb_save = 11;
- static const char vb_pay = 12;
- static const char vb_look = 13;
- static const char vb_break = 14;
- static const char vb_quit = 15;
- static const char vb_sit = 16;
- static const char vb_stand = 17;
- static const char vb_go = 18;
- static const char vb_info = 19;
- static const char vb_undress = 20;
- static const char vb_wear = 21;
- static const char vb_play = 22;
- static const char vb_ring = 23;
- static const char vb_help = 24;
- static const char vb_larrypass = 25;
- static const char vb_phaon = 26;
- static const char vb_boss = 27;
- static const char vb_pee = 28;
- static const char vb_cheat = 29;
- static const char vb_magic = 30;
- static const char vb_restart = 31;
- static const char vb_eat = 32;
- static const char vb_listen = 33;
- static const char vb_buy = 34;
- static const char vb_attack = 35;
- static const char vb_password = 36;
- static const char vb_dir = 37;
- static const char vb_die = 38;
- static const char vb_score = 39;
- static const char vb_put = 40;
- static const char vb_kiss = 41;
- static const char vb_climb = 42;
- static const char vb_jump = 43;
- static const char vb_highscores = 44;
- static const char vb_wake = 45;
- static const char vb_hello = 46;
- static const char vb_thanks = 47;
-
- static const char vb_smartalec = 249;
- static const char vb_expletive = 253;
-
- static const char pardon = 254; /* =didn't understand / wasn't given. */
+ static const byte vb_exam = 1;
+ static const byte vb_open = 2;
+ static const byte vb_pause = 3;
+ static const byte vb_get = 4;
+ static const byte vb_drop = 5;
+ static const byte vb_inv = 6;
+ static const byte vb_talk = 7;
+ static const byte vb_give = 8;
+ static const byte vb_drink = 9;
+ static const byte vb_load = 10;
+ static const byte vb_save = 11;
+ static const byte vb_pay = 12;
+ static const byte vb_look = 13;
+ static const byte vb_break = 14;
+ static const byte vb_quit = 15;
+ static const byte vb_sit = 16;
+ static const byte vb_stand = 17;
+ static const byte vb_go = 18;
+ static const byte vb_info = 19;
+ static const byte vb_undress = 20;
+ static const byte vb_wear = 21;
+ static const byte vb_play = 22;
+ static const byte vb_ring = 23;
+ static const byte vb_help = 24;
+ static const byte vb_larrypass = 25;
+ static const byte vb_phaon = 26;
+ static const byte vb_boss = 27;
+ static const byte vb_pee = 28;
+ static const byte vb_cheat = 29;
+ static const byte vb_magic = 30;
+ static const byte vb_restart = 31;
+ static const byte vb_eat = 32;
+ static const byte vb_listen = 33;
+ static const byte vb_buy = 34;
+ static const byte vb_attack = 35;
+ static const byte vb_password = 36;
+ static const byte vb_dir = 37;
+ static const byte vb_die = 38;
+ static const byte vb_score = 39;
+ static const byte vb_put = 40;
+ static const byte vb_kiss = 41;
+ static const byte vb_climb = 42;
+ static const byte vb_jump = 43;
+ static const byte vb_highscores = 44;
+ static const byte vb_wake = 45;
+ static const byte vb_hello = 46;
+ static const byte vb_thanks = 47;
+
+ static const byte vb_smartalec = 249;
+ static const byte vb_expletive = 253;
+
+ static const byte pardon = 254; /* =didn't understand / wasn't given. */
static const int16 nowords = 277; /* how many words does the parser know? */
- static const char nowt = 372;
- static const char moved = 0; /* This word was moved. (Usually because it was the subject of
+ static const byte nowt = 372;
+ static const byte moved = 0; /* This word was moved. (Usually because it was the subject of
conversation.) */
static const int16 first_password = 89; /* Words[first_password] should equal "TIROS". */
diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp
index 7fe24cecc8..eb5f5094c9 100644
--- a/engines/avalanche/lucerna2.cpp
+++ b/engines/avalanche/lucerna2.cpp
@@ -110,8 +110,6 @@ void Lucerna::unscramble() {
scram1(*_vm->_gyro->also[fv][ff]);
scram1(_vm->_gyro->listen);
scram1(_vm->_gyro->flags);
- /* for fz:=1 to length(also[fv,ff]^) do
- also[fv,ff]^[fz]:=chr(ord(also[fv,ff]^[fz]) xor 177);*/
}
void Lucerna::load_also(Common::String n) {