diff options
author | uruk | 2013-09-04 18:22:55 +0200 |
---|---|---|
committer | uruk | 2013-09-04 18:22:55 +0200 |
commit | 8cb9c3825f58e20f5851477173945e204e0ecb14 (patch) | |
tree | e9fbf08022fea9c6417e7067fd8c6867373457ba /engines | |
parent | d77eafb0dbbb2c797d014fcf84c908cf6914b184 (diff) | |
parent | ad5529b5d27748f34cbd978eb3c0040e3a2d266f (diff) | |
download | scummvm-rg350-8cb9c3825f58e20f5851477173945e204e0ecb14.tar.gz scummvm-rg350-8cb9c3825f58e20f5851477173945e204e0ecb14.tar.bz2 scummvm-rg350-8cb9c3825f58e20f5851477173945e204e0ecb14.zip |
Merge branch 'avalanche' of https://github.com/urukgit/scummvm into avalanche
Conflicts:
engines/avalanche/dropdown2.cpp
engines/avalanche/dropdown2.h
Diffstat (limited to 'engines')
-rw-r--r-- | engines/avalanche/acci2.cpp | 407 | ||||
-rw-r--r-- | engines/avalanche/acci2.h | 123 | ||||
-rw-r--r-- | engines/avalanche/avalanche.cpp | 31 | ||||
-rw-r--r-- | engines/avalanche/avalanche.h | 2 | ||||
-rw-r--r-- | engines/avalanche/avalot.cpp | 5 | ||||
-rw-r--r-- | engines/avalanche/celer2.cpp | 216 | ||||
-rw-r--r-- | engines/avalanche/celer2.h | 14 | ||||
-rw-r--r-- | engines/avalanche/closing2.h | 2 | ||||
-rw-r--r-- | engines/avalanche/enid2.cpp | 4 | ||||
-rw-r--r-- | engines/avalanche/graphics.cpp | 8 | ||||
-rw-r--r-- | engines/avalanche/graphics.h | 2 | ||||
-rw-r--r-- | engines/avalanche/gyro2.cpp | 18 | ||||
-rw-r--r-- | engines/avalanche/gyro2.h | 25 | ||||
-rw-r--r-- | engines/avalanche/logger2.cpp | 289 | ||||
-rw-r--r-- | engines/avalanche/logger2.h | 92 | ||||
-rw-r--r-- | engines/avalanche/lucerna2.cpp | 123 | ||||
-rw-r--r-- | engines/avalanche/lucerna2.h | 2 | ||||
-rw-r--r-- | engines/avalanche/module.mk | 1 | ||||
-rw-r--r-- | engines/avalanche/parser.cpp | 6 | ||||
-rw-r--r-- | engines/avalanche/pingo2.cpp | 7 | ||||
-rw-r--r-- | engines/avalanche/scrolls2.cpp | 75 | ||||
-rw-r--r-- | engines/avalanche/sequence2.cpp | 4 | ||||
-rw-r--r-- | engines/avalanche/trip6.cpp | 65 | ||||
-rw-r--r-- | engines/avalanche/trip6.h | 10 |
24 files changed, 487 insertions, 1044 deletions
diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp index 72653b276d..9ce3180a41 100644 --- a/engines/avalanche/acci2.cpp +++ b/engines/avalanche/acci2.cpp @@ -214,23 +214,26 @@ void Acci::init() { } void Acci::clearWords() { - for (byte i = 0; i < 11; i++) + for (byte i = 0; i < 11; i++) { if (!_realWords[i].empty()) _realWords[i].clear(); + } } byte Acci::wordNum(Common::String word) { if (word.empty()) return 0; - for (int32 i = kParserWordsNum - 1; i >= 0; i--) + for (int32 i = kParserWordsNum - 1; i >= 0; i--) { if (kVocabulary[i]._word == word) return kVocabulary[i]._number; + } // If not found as a whole, we look for it as a substring. - for (int32 i = kParserWordsNum - 1; i >= 0; i--) + for (int32 i = kParserWordsNum - 1; i >= 0; i--) { if (Common::String(kVocabulary[i]._word.c_str(), word.size()) == word) return kVocabulary[i]._number; + } return kPardon; } @@ -281,18 +284,11 @@ Common::String Acci::totalTime() { return result + _vm->_gyro->strf(s) + " seconds."; } - - -void Acci::number(Common::String &codes) { - warning("STUB: Acci::number()"); -} - void Acci::cheatParse(Common::String codes) { - uint16 num; - int16 e; - - char cmd; - int16 se, sx, sy; +// uint16 num; +// int16 e; +// char cmd; +// int16 se, sx, sy; warning("STUB: Acci::cheatParse()"); } @@ -302,13 +298,14 @@ void Acci::cheatParse(Common::String codes) { void Acci::stripPunctuation(Common::String &word) { const char punct[] = "~`!@#$%^&*()_+-={}[]:\"|;'\\,./<>?"; - for (byte i = 0; i < 32; i++) - do { + for (byte i = 0; i < 32; i++) { + for (;;) { int16 pos = _vm->_parser->pos(Common::String(punct[i]), word); if (pos == -1) break; word.deleteChar(pos); - } while (true); + } + } } @@ -364,9 +361,11 @@ void Acci::properNouns() { _vm->_parser->_inputText.toLowercase(); // We set every word's first character to uppercase. - for (byte i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) + for (byte i = 1; i < (_vm->_parser->_inputText.size() - 1); i++) { if (_vm->_parser->_inputText[i] == ' ') _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[i + 1]), i + 1); + } + // And the first character as well. _vm->_parser->_inputText.setChar(toupper(_vm->_parser->_inputText[0]), 0); } @@ -391,39 +390,35 @@ void Acci::storeInterrogation(byte interrogation) { _vm->_timeout->lose_timer(_vm->_timeout->reason_cardiffsurvey); // If you want to use any other timer, put this into the case statement. switch (interrogation) { - case 1: { - _vm->_parser->_inputText.toLowercase(); - sayIt(); - _vm->_gyro->dna.like2drink = _vm->_parser->_inputText; - _vm->_gyro->dna.cardiff_things = 2; - } - break; - case 2: { - properNouns(); - sayIt(); - _vm->_gyro->dna.favourite_song = _vm->_parser->_inputText; - _vm->_gyro->dna.cardiff_things = 3; - } - break; - case 3: { - properNouns(); - sayIt(); - _vm->_gyro->dna.worst_place_on_earth = _vm->_parser->_inputText; - _vm->_gyro->dna.cardiff_things = 4; - } - break; - case 4: { - _vm->_parser->_inputText.toLowercase(); - sayIt(); - if (!_vm->_gyro->dna.spare_evening.empty()) - _vm->_gyro->dna.spare_evening.clear(); - _vm->_gyro->dna.spare_evening = _vm->_parser->_inputText; - _vm->_visa->dixi('z', 5); /* His closing statement... */ - _vm->_trip->tr[1].walkto(4); /* The end of the drawbridge */ - _vm->_trip->tr[1].vanishifstill = true; /* Then go away! */ - _vm->_gyro->magics[1].op = _vm->_gyro->nix; - _vm->_gyro->dna.cardiff_things = 5; - } + case 1: + _vm->_parser->_inputText.toLowercase(); + sayIt(); + _vm->_gyro->dna.like2drink = _vm->_parser->_inputText; + _vm->_gyro->dna.cardiff_things = 2; + break; + case 2: + properNouns(); + sayIt(); + _vm->_gyro->dna.favourite_song = _vm->_parser->_inputText; + _vm->_gyro->dna.cardiff_things = 3; + break; + case 3: + properNouns(); + sayIt(); + _vm->_gyro->dna.worst_place_on_earth = _vm->_parser->_inputText; + _vm->_gyro->dna.cardiff_things = 4; + break; + case 4: + _vm->_parser->_inputText.toLowercase(); + sayIt(); + if (!_vm->_gyro->dna.spare_evening.empty()) + _vm->_gyro->dna.spare_evening.clear(); + _vm->_gyro->dna.spare_evening = _vm->_parser->_inputText; + _vm->_visa->dixi('z', 5); /* His closing statement... */ + _vm->_trip->tr[1].walkto(4); /* The end of the drawbridge */ + _vm->_trip->tr[1].vanishifstill = true; /* Then go away! */ + _vm->_gyro->magics[1].op = _vm->_gyro->nix; + _vm->_gyro->dna.cardiff_things = 5; break; case 99: //store_high(_vm->_parser->_inputText); @@ -513,48 +508,51 @@ void Acci::parse() { // Delete words we already processed. int16 spacePos = _vm->_parser->pos(Common::String(' '), inputTextUpper); - if (spacePos > -1) + if (spacePos > -1) { for (byte i = 0; i <= spacePos; i++) inputTextUpper.deleteChar(0); + } + spacePos = _vm->_parser->pos(Common::String(' '), inputText); - if (spacePos > -1) + if (spacePos > -1) { for (byte i = 0; i <= spacePos; i++) inputText.deleteChar(0); + } } - if (_vm->_parser->pos(Common::String(254), _thats) > -1) - _unknown = _realWords[_vm->_parser->pos(Common::String(254), _thats)]; - else + if (_vm->_parser->pos(Common::String('\xFE'), _thats) > -1) + _unknown = _realWords[_vm->_parser->pos(Common::String('\xFE'), _thats)]; + else { if (!_unknown.empty()) _unknown.clear(); - + } // Replace words' codes that mean the same. - replace(Common::String(255), 0); /* zap noise words */ - replace(Common::String(13) + 226, 1); // "look at" = "examine" - replace(Common::String(13) + 228, 1); // "look in" = "examine" - replace(Common::String(4) + 230, 17); // "get up" = "stand" - replace(Common::String(4) + 231, 17); // "get down" = "stand"... well, why not? - replace(Common::String(18) + 228, 2); // "go in" = "open [door]" - replace(Common::String(28) + 229, 253); // "P' off" is a swear word - replace(Common::String(4) + 6, 6); // "Take inventory" (remember Colossal Adventure?) - replace(Common::String(40) + 232, 21); // "put on" = "don" - replace(Common::String(4) + 229, 20); // "take off" = "doff" + replace(Common::String('\xFF'), 0); /* zap noise words */ + replace(Common::String('\xD') + '\xE2', 1); // "look at" = "examine" + replace(Common::String('\xD') + '\xE4', 1); // "look in" = "examine" + replace(Common::String('\x4') + '\xE6', 17); // "get up" = "stand" + replace(Common::String('\x4') + '\xE7', 17); // "get down" = "stand"... well, why not? + replace(Common::String('\x12') + '\xE4', 2); // "go in" = "open [door]" + replace(Common::String('\x1C') + '\xE5', 253); // "P' off" is a swear word + replace(Common::String('\x4') + '\x6' , 6); // "Take inventory" (remember Colossal Adventure?) + replace(Common::String('\x28') + '\xE8', 21); // "put on" = "don" + replace(Common::String('\x4') + '\xE5', 20); // "take off" = "doff" // Words that could mean more than one _person if (_vm->_gyro->dna.room == r__nottspub) - replace(Common::String(204), 164); // Barman = Port + replace(Common::String('\xCC'), 164); // Barman = Port else - replace(Common::String(204), 154); // Barman = Malagauche + replace(Common::String('\xCC'), 154); // Barman = Malagauche switch (_vm->_gyro->dna.room) { case r__aylesoffice: - replace(Common::String(203), 163); // Monk = Ayles + replace(Common::String('\xCB'), 163); // Monk = Ayles break; case r__musicroom: - replace(Common::String(203), 166); // Monk = Jacques + replace(Common::String('\xCB'), 166); // Monk = Jacques break; default: - replace(Common::String(203), 162); // Monk = Ibythneth + replace(Common::String('\xCB'), 162); // Monk = Ibythneth } if (doPronouns()) { @@ -578,24 +576,28 @@ void Acci::parse() { i++; } - if ((_vm->_gyro->subjnumber == 0) && !_thats.empty()) // Still not found. - for (i = 0; i < _thats.size() - 1; i++) + if ((_vm->_gyro->subjnumber == 0) && !_thats.empty()) { // Still not found. + for (i = 0; i < _thats.size() - 1; i++) { if ((byte)_thats[i] == 252) { // The word is "about", or something similar. _vm->_gyro->subjnumber = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } + } + } - if ((_vm->_gyro->subjnumber == 0) && !_thats.empty())// STILL not found! Must be the word after "say". - for (i = 0; i < _thats.size() - 1; i++) + if ((_vm->_gyro->subjnumber == 0) && !_thats.empty()) { // STILL not found! Must be the word after "say". + for (i = 0; i < _thats.size() - 1; i++) { if (((byte)_thats[i] == 7) && ((byte)_thats[i + 1] != 0) && !((225 <= (byte)_thats[i + 1]) && ((byte)_thats[i + 1] <= 229))) { // SAY not followed by a preposition _vm->_gyro->subjnumber = (byte)_thats[i + 1]; _thats.setChar(0, i + 1); break; } + } + } - for (int8 i = _thats.size() - 1; i >= 0; i--) // Reverse order, so first will be used. + for (int8 i = _thats.size() - 1; i >= 0; i--) { // Reverse order, so first will be used. if (((byte)_thats[i] == 253) || ((byte)_thats[i] == 249) || ((1 <= (byte)_thats[i]) && ((byte)_thats[i] <= 49))) _verb = (byte)_thats[i]; else if ((50 <= (byte)_thats[i]) && ((byte)_thats[i] <= 149)) { @@ -605,12 +607,13 @@ void Acci::parse() { _person = (byte)_thats[i]; else if ((byte)_thats[i] == 251) _polite = true; + } - if ((!_unknown.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { - _vm->_scrolls->display(Common::String("Sorry, but I have no idea kWhat \"") + _unknown + "\" means. Can you rephrase it?"); - _vm->_gyro->weirdword = true; - } else - _vm->_gyro->weirdword = false; + if ((!_unknown.empty()) && (_verb != kVerbCodeExam) && (_verb != kVerbCodeTalk) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeLoad) && (_verb != kVerbCodeDir)) { + _vm->_scrolls->display(Common::String("Sorry, but I have no idea kWhat \"") + _unknown + "\" means. Can you rephrase it?"); + _vm->_gyro->weirdword = true; + } else + _vm->_gyro->weirdword = false; if (_thats.empty()) _thats = kNothing; @@ -618,11 +621,12 @@ void Acci::parse() { if (_thing != kPardon) _vm->_gyro->it = _thing; - if (_person != kPardon) + if (_person != kPardon) { if (_person < 175) _vm->_gyro->him = _person; else _vm->_gyro->her = _person; + } } void Acci::examineObject() { @@ -710,8 +714,6 @@ bool Acci::holding() { return holdingResult; } - - void Acci::openBox(bool isOpening) { if ((_vm->_gyro->dna.room == r__yours) && (_thing == 54)) { _vm->_celer->drawBackgroundSprite(-1, -1, 5); @@ -746,30 +748,29 @@ void Acci::examine() { } } else if (_person != kPardon) exampers(); - else _vm->_scrolls->display("It's just as it looks on the picture."); // Don't know: guess. + else + _vm->_scrolls->display("It's just as it looks on the picture."); // Don't know: guess. } - - void Acci::inventory() { byte itemNum = 0; _vm->_scrolls->display(Common::String("You're carrying ") + _vm->_scrolls->kControlToBuffer); - { - for (byte i = 0; i < numobjs; i++) - if (_vm->_gyro->dna.obj[i]) { - itemNum++; - if (itemNum == _vm->_gyro->dna.carrying) - _vm->_scrolls->display(Common::String("and ") + _vm->_scrolls->kControlToBuffer); - _vm->_scrolls->display(_vm->_gyro->get_better(i + 1) + _vm->_scrolls->kControlToBuffer); - if ((i + 1) == _vm->_gyro->dna.wearing) - _vm->_scrolls->display(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer); - if (itemNum < _vm->_gyro->dna.carrying) - _vm->_scrolls->display(Common::String(", ") + _vm->_scrolls->kControlToBuffer); - } - if (_vm->_gyro->dna.wearing == kNothing) - _vm->_scrolls->display(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); - else - _vm->_scrolls->display("."); + + for (byte i = 0; i < numobjs; i++) { + if (_vm->_gyro->dna.obj[i]) { + itemNum++; + if (itemNum == _vm->_gyro->dna.carrying) + _vm->_scrolls->display(Common::String("and ") + _vm->_scrolls->kControlToBuffer); + _vm->_scrolls->display(_vm->_gyro->get_better(i + 1) + _vm->_scrolls->kControlToBuffer); + if ((i + 1) == _vm->_gyro->dna.wearing) + _vm->_scrolls->display(Common::String(", which you're wearing") + _vm->_scrolls->kControlToBuffer); + if (itemNum < _vm->_gyro->dna.carrying) + _vm->_scrolls->display(Common::String(", ") + _vm->_scrolls->kControlToBuffer); + } + if (_vm->_gyro->dna.wearing == kNothing) + _vm->_scrolls->display(Common::String("...") + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "...and you're stark naked!"); + else + _vm->_scrolls->display("."); } } @@ -777,18 +778,17 @@ void Acci::swallow() { /* Eat something. */ switch (_thing) { case Gyro::wine: switch (_vm->_gyro->dna.winestate) { /* 4 is perfect */ - case 1: { - if (_vm->_gyro->dna.teetotal) { - _vm->_visa->dixi('D', 6); - return; - } - _vm->_visa->dixi('U', 1); - _vm->_pingo->wobble(); - _vm->_visa->dixi('U', 2); - _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; - _vm->_lucerna->objectlist(); - drink(); + case 1: + if (_vm->_gyro->dna.teetotal) { + _vm->_visa->dixi('D', 6); + return; } + _vm->_visa->dixi('U', 1); + _vm->_pingo->wobble(); + _vm->_visa->dixi('U', 2); + _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; + _vm->_lucerna->objectlist(); + drink(); break; case 2: case 3: @@ -796,12 +796,11 @@ void Acci::swallow() { /* Eat something. */ break; /* You can't drink it! */ } break; - case Gyro::potion: { - _vm->_gyro->background(4); - _vm->_visa->dixi('U', 3); - _vm->_lucerna->gameover(); - _vm->_gyro->background(0); - } + case Gyro::potion: + _vm->_gyro->background(4); + _vm->_visa->dixi('U', 3); + _vm->_lucerna->gameover(); + _vm->_gyro->background(0); break; case Gyro::ink: _vm->_visa->dixi('U', 4); @@ -809,10 +808,9 @@ void Acci::swallow() { /* Eat something. */ case Gyro::chastity: _vm->_visa->dixi('U', 5); break; - case Gyro::mushroom: { - _vm->_visa->dixi('U', 6); - _vm->_lucerna->gameover(); - } + case Gyro::mushroom: + _vm->_visa->dixi('U', 6); + _vm->_lucerna->gameover(); break; case Gyro::onion: if (_vm->_gyro->dna.rotten_onion) @@ -834,15 +832,16 @@ void Acci::swallow() { /* Eat something. */ void Acci::peopleInRoom() { byte numPeople = 0; // Number of people in the room. - for (byte i = 1; i < 29; i++) // Start at 1 so we don't list Avvy himself! + for (byte i = 1; i < 29; i++) { // Start at 1 so we don't list Avvy himself! if (_vm->_gyro->whereis[i] == _vm->_gyro->dna.room) numPeople++; + } if (numPeople == 0) // If nobody's here, we can cut out straight away. return; byte actPerson = 0; // Actually listed people. - for (byte i = 1; i < 29; i++) + for (byte i = 1; i < 29; i++) { if (_vm->_gyro->whereis[i] == _vm->_gyro->dna.room) { actPerson++; if (actPerson == 1) // First on the list. @@ -852,6 +851,7 @@ void Acci::peopleInRoom() { else // The end. _vm->_scrolls->display(Common::String(" and ") + _vm->_gyro->getname(i + 150) + _vm->_scrolls->kControlToBuffer); } + } if (numPeople == 1) _vm->_scrolls->display(Common::String(" is") + _vm->_scrolls->kControlToBuffer); @@ -866,34 +866,34 @@ void Acci::lookAround() { switch (_vm->_gyro->dna.room) { case r__spludwicks: if (_vm->_gyro->dna.avaricius_talk > 0) - _vm->_visa->dixi('pos', 23); + _vm->_visa->dixi('q', 23); else peopleInRoom(); break; case r__robins: if (_vm->_gyro->dna.tied_up) - _vm->_visa->dixi('pos', 38); + _vm->_visa->dixi('q', 38); if (_vm->_gyro->dna.mushroom_growing) - _vm->_visa->dixi('pos', 55); + _vm->_visa->dixi('q', 55); break; case r__insidecardiffcastle: if (!_vm->_gyro->dna.taken_pen) - _vm->_visa->dixi('pos', 49); + _vm->_visa->dixi('q', 49); break; case r__lustiesroom: if (_vm->_gyro->dna.lustie_is_asleep) - _vm->_visa->dixi('pos', 65); + _vm->_visa->dixi('q', 65); break; case r__catacombs: switch (_vm->_gyro->dna.cat_y * 256 + _vm->_gyro->dna.cat_x) { case 258 : - _vm->_visa->dixi('pos', 80); // Inside art gallery. + _vm->_visa->dixi('q', 80); // Inside art gallery. break; case 514 : - _vm->_visa->dixi('pos', 81); // Outside ditto. + _vm->_visa->dixi('q', 81); // Outside ditto. break; case 260 : - _vm->_visa->dixi('pos', 82); // Outside Geida's room. + _vm->_visa->dixi('q', 82); // Outside Geida's room. break; } break; @@ -916,24 +916,23 @@ void Acci::openDoor() { break; case r__spludwicks: if (_thing == 61) { - _vm->_visa->dixi('pos', 85); + _vm->_visa->dixi('q', 85); return; } break; } - if ((!_vm->_gyro->dna.user_moves_avvy) && (_vm->_gyro->dna.room != r__lusties)) return; // No doors can open if you can't move Avvy. - for (byte fv = 8; fv < 15; fv++) + for (byte fv = 8; fv < 15; fv++) { if (_vm->_trip->infield(fv + 1)) { fv -= 8; switch (_vm->_gyro->portals[fv].op) { case Gyro::exclaim: _vm->_trip->tr[0].bounce(); - _vm->_visa->dixi('word', _vm->_gyro->portals[fv].data); + _vm->_visa->dixi('x', _vm->_gyro->portals[fv].data); break; case Gyro::transport: _vm->_trip->fliproom((_vm->_gyro->portals[fv].data) >> 8 /*High byte*/, (_vm->_gyro->portals[fv].data) & 0x0F /*Low byte*/); @@ -952,11 +951,11 @@ void Acci::openDoor() { return; } + } if (_vm->_gyro->dna.room == r__map) _vm->_scrolls->display(Common::String("Avvy, you can complete the whole game without ever going " - "to anywhere other than Argent, Birmingham, Cardiff, " - "Nottingham and Norwich.")); + "to anywhere other than Argent, Birmingham, Cardiff, Nottingham and Norwich.")); else _vm->_scrolls->display("Door? What door?"); } @@ -1054,6 +1053,10 @@ void Acci::goToCauldron() { _vm->_trip->tr[1].walkto(2); } +/** + * Check is it's possible to give something to Spludwick + * @remarks Originally called 'give2spludwick' + */ bool Acci::giveToSpludwick() { if (_vm->_gyro->spludwick_order[_vm->_gyro->dna.given2spludwick] != _thing) { notInOrder(); @@ -1064,10 +1067,10 @@ bool Acci::giveToSpludwick() { case Gyro::onion: _vm->_gyro->dna.obj[_vm->_gyro->onion - 1] = false; if (_vm->_gyro->dna.rotten_onion) - _vm->_visa->dixi('pos', 22); + _vm->_visa->dixi('q', 22); else { _vm->_gyro->dna.given2spludwick++; - _vm->_visa->dixi('pos', 20); + _vm->_visa->dixi('q', 20); goToCauldron(); _vm->_lucerna->points(3); } @@ -1077,13 +1080,13 @@ bool Acci::giveToSpludwick() { _vm->_gyro->dna.obj[_vm->_gyro->ink - 1] = false; _vm->_lucerna->objectlist(); _vm->_gyro->dna.given2spludwick++; - _vm->_visa->dixi('pos', 24); + _vm->_visa->dixi('q', 24); goToCauldron(); _vm->_lucerna->points(3); break; case Gyro::mushroom: _vm->_gyro->dna.obj[_vm->_gyro->mushroom - 1] = false; - _vm->_visa->dixi('pos', 25); + _vm->_visa->dixi('q', 25); _vm->_lucerna->points(5); _vm->_gyro->dna.given2spludwick++; goToCauldron(); @@ -1093,6 +1096,8 @@ bool Acci::giveToSpludwick() { default: return true; } + + return false; } void Acci::drink() { @@ -1126,8 +1131,6 @@ void Acci::cardiffClimbing() { } } - - void Acci::already() { _vm->_scrolls->display("You're already standing!"); } @@ -1188,7 +1191,7 @@ void Acci::getProc(char thing) { } else _vm->_scrolls->display(Common::String("I can't see ") + _vm->_gyro->get_better(thing) + " in the box."); } else - _vm->_visa->dixi('pos', 57); + _vm->_visa->dixi('q', 57); break; case r__insidecardiffcastle: switch (thing) { @@ -1206,15 +1209,15 @@ void Acci::getProc(char thing) { _vm->_scrolls->display("Taken."); } } else if (_vm->_gyro->dna.standing_on_dais) - _vm->_visa->dixi('pos', 53); + _vm->_visa->dixi('q', 53); else - _vm->_visa->dixi('pos', 51); + _vm->_visa->dixi('q', 51); break; case Gyro::bolt: - _vm->_visa->dixi('pos', 52); + _vm->_visa->dixi('q', 52); break; default: - _vm->_visa->dixi('pos', 57); + _vm->_visa->dixi('q', 57); } break; case r__robins: @@ -1227,13 +1230,17 @@ void Acci::getProc(char thing) { _vm->_lucerna->objectlist(); _vm->_lucerna->points(3); } else - _vm->_visa->dixi('pos', 57); + _vm->_visa->dixi('q', 57); break; default: - _vm->_visa->dixi('pos', 57); + _vm->_visa->dixi('q', 57); } } +/** + * Give the lute to Geida + * @remarks Originally called 'give_Geida_the_lute' + */ void Acci::giveGeidaTheLute() { if (_vm->_gyro->dna.room != r__lustiesroom) { _vm->_scrolls->display(Common::String("Not yet. Try later!") + _vm->_scrolls->kControlRegister + '2' + _vm->_scrolls->kControlSpeechBubble); @@ -1241,7 +1248,7 @@ void Acci::giveGeidaTheLute() { } _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = false; _vm->_lucerna->objectlist(); - _vm->_visa->dixi('pos', 64); // She plays it. + _vm->_visa->dixi('q', 64); // She plays it. _vm->_timeout->set_up_timer(1, _vm->_timeout->procgive_lute_to_geida, _vm->_timeout->reason_geida_sings); _vm->_enid->back_to_bootstrap(4); @@ -1255,7 +1262,7 @@ void Acci::playHarp() { } void Acci::winSequence() { - _vm->_visa->dixi('pos', 78); + _vm->_visa->dixi('q', 78); _vm->_sequence->first_show(7); _vm->_sequence->then_show(8); _vm->_sequence->then_show(9); @@ -1264,11 +1271,12 @@ void Acci::winSequence() { } void Acci::personSpeaks() { - if ((_person == kPardon) || (_person == 0)) + if ((_person == kPardon) || (_person == 0)) { if ((_vm->_gyro->him == kPardon) || (_vm->_gyro->whereis[_vm->_gyro->him - 150] != _vm->_gyro->dna.room)) _person = _vm->_gyro->her; else _person = _vm->_gyro->him; + } if (_vm->_gyro->whereis[_person - 150] != _vm->_gyro->dna.room) { _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + '1' + _vm->_scrolls->kControlToBuffer); // Avvy himself! @@ -1284,18 +1292,22 @@ void Acci::personSpeaks() { } } - if (!found) - for (byte i = 0; i < 16; i++) + if (!found) { + for (byte i = 0; i < 16; i++) { if ((_vm->_gyro->quasipeds[i].who == _person) && (_vm->_gyro->quasipeds[i].room == _vm->_gyro->dna.room)) _vm->_scrolls->display(Common::String(_vm->_scrolls->kControlRegister) + byte(i + 65) + _vm->_scrolls->kControlToBuffer); + } + } } - void Acci::heyThanks() { personSpeaks(); _vm->_scrolls->display(Common::String("Hey, thanks!") + _vm->_scrolls->kControlSpeechBubble + "(But now, you've lost it!)"); _vm->_gyro->dna.obj[_thing - 1] = false; } +/** + * @remarks Originally called 'do_that' + */ void Acci::doThat() { const Common::String booze[] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; @@ -1313,16 +1325,16 @@ void Acci::doThat() { if ((_verb != kVerbCodeLoad) && (_verb != kVerbCodeSave) && (_verb != kVerbCodeQuit) && (_verb != kVerbCodeInfo) && (_verb != kVerbCodeHelp) - && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) - && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHighscores) && (_verb != kVerbCodeSmartAlec)) { - if (!_vm->_gyro->alive) { - _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); - return; - } - if (!_vm->_gyro->dna.avvy_is_awake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { - _vm->_scrolls->display("Talking in your sleep? Try waking up!"); - return; - } + && (_verb != kVerbCodeLarrypass) && (_verb != kVerbCodePhaon) && (_verb != kVerbCodeBoss) && (_verb != kVerbCodeCheat) && (_verb != kVerbCodeRestart) && (_verb != kVerbCodeDir) + && (_verb != kVerbCodeScore) && (_verb != kVerbCodeHiscores) && (_verb != kVerbCodeSmartAlec)) { + if (!_vm->_gyro->alive) { + _vm->_scrolls->display(Common::String("You're dead, so don't talk. What are you, a ghost or something? Try restarting, or restoring a saved game!")); + return; + } + if (!_vm->_gyro->dna.avvy_is_awake && (_verb != kVerbCodeDie) && (_verb != kVerbCodeExpletive) && (_verb != kVerbCodeWake)) { + _vm->_scrolls->display("Talking in your sleep? Try waking up!"); + return; + } } switch (_verb) { @@ -1418,7 +1430,7 @@ void Acci::doThat() { break; case Gyro::pibythneth: if (_thing == _vm->_gyro->badge) { - _vm->_visa->dixi('pos', 32); // Thanks! Wow! + _vm->_visa->dixi('q', 32); // Thanks! Wow! _vm->_lucerna->points(3); _vm->_gyro->dna.obj[_vm->_gyro->badge - 1] = false; _vm->_gyro->dna.obj[_vm->_gyro->habit - 1] = true; @@ -1432,7 +1444,7 @@ void Acci::doThat() { if (_vm->_gyro->dna.ayles_is_awake) { if (_thing == _vm->_gyro->pen) { _vm->_gyro->dna.obj[_vm->_gyro->pen - 1] = false; - _vm->_visa->dixi('pos', 54); + _vm->_visa->dixi('q', 54); _vm->_gyro->dna.obj[_vm->_gyro->ink - 1] = true; _vm->_gyro->dna.given_pen_to_ayles = true; _vm->_lucerna->objectlist(); @@ -1464,7 +1476,7 @@ void Acci::doThat() { if (_vm->_gyro->dna.geida_given_potion) winSequence(); else - _vm->_visa->dixi('pos', 77); // That Geida woman! + _vm->_visa->dixi('q', 77); // That Geida woman! break; default: heyThanks(); @@ -1516,19 +1528,18 @@ void Acci::doThat() { _vm->_scrolls->display("Just use the arrow keys to walk there."); break; case kVerbCodeInfo: { - _vm->_scrolls->aboutscroll = true; - - Common::String toDisplay; - for (byte i = 0; i < 7; i++) - toDisplay += _vm->_scrolls->kControlNewLine; - toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine - + "The medi‘val descendant of" + _vm->_scrolls->kControlNewLine - + "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine - + "version " + _vm->_gyro->vernum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright ï " - + _vm->_gyro->copyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; - _vm->_scrolls->display(toDisplay); - - _vm->_scrolls->aboutscroll = false; + _vm->_scrolls->aboutscroll = true; + + Common::String toDisplay; + for (byte i = 0; i < 7; i++) + toDisplay += _vm->_scrolls->kControlNewLine; + toDisplay = toDisplay + "LORD AVALOT D'ARGENT" + _vm->_scrolls->kControlCenter + _vm->_scrolls->kControlNewLine + + "The medi‘val descendant of" + _vm->_scrolls->kControlNewLine + + "Denarius Avaricius Sextus" + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + + "version " + _vm->_gyro->vernum + _vm->_scrolls->kControlNewLine + _vm->_scrolls->kControlNewLine + "Copyright ï " + + _vm->_gyro->copyright + ", Mark, Mike and Thomas Thurman." + _vm->_scrolls->kControlRegister + 'Y' + _vm->_scrolls->kControlIcon; + _vm->_scrolls->display(toDisplay); + _vm->_scrolls->aboutscroll = false; } break; case kVerbCodeUndress: @@ -1545,7 +1556,8 @@ void Acci::doThat() { if (holding()) { // Wear something. switch (_thing) { case Gyro::chastity: - _vm->_scrolls->display("Hey, kWhat kind of a weirdo are you??!"); + // \? are used to avoid that ??! is parsed as a trigraph + _vm->_scrolls->display("Hey, kWhat kind of a weirdo are you\?\?!"); break; case Gyro::clothes: case Gyro::habit: { /* Change this! */ @@ -1595,7 +1607,7 @@ void Acci::doThat() { } if (!_vm->_gyro->dna.asked_dogfood_about_nim) { - _vm->_visa->dixi('pos', 84); + _vm->_visa->dixi('q', 84); return; } @@ -1603,7 +1615,6 @@ void Acci::doThat() { _vm->_gyro->dna.playednim++; // You won - strange! - _vm->_logger->log_aside("You won."); _vm->_visa->dixi('Q', 7); // You won! Give us a lute! _vm->_gyro->dna.obj[_vm->_gyro->lute - 1] = true; _vm->_lucerna->objectlist(); @@ -1625,7 +1636,7 @@ void Acci::doThat() { } } else if (holding()) { switch (_thing) { - case Gyro::lute : { + case Gyro::lute : _vm->_visa->dixi('U', 7); if (_vm->_gyro->whereis[_vm->_gyro->pcwytalot - 150] == _vm->_gyro->dna.room) @@ -1633,7 +1644,6 @@ void Acci::doThat() { if (_vm->_gyro->whereis[_vm->_gyro->pdulustie - 150] == _vm->_gyro->dna.room) _vm->_visa->dixi('U', 15); - } break; case 52: if (_vm->_gyro->dna.room == r__musicroom) @@ -1658,7 +1668,8 @@ void Acci::doThat() { if (_thing == _vm->_gyro->bell) { _vm->_scrolls->display("Ding, dong, ding, dong, ding, dong, ding, dong..."); if ((_vm->_gyro->dna.ringing_bells) & (_vm->_gyro->flagset('B'))) - _vm->_scrolls->display("(Are you trying to join in, Avvy??!)"); + // \? are used to avoid that ??! is parsed as a trigraph + _vm->_scrolls->display("(Are you trying to join in, Avvy\?\?!)"); } else _vm->_scrolls->display(kWhat); } @@ -1691,12 +1702,12 @@ void Acci::doThat() { break; case kVerbCodeMagic: if (_vm->_gyro->dna.avaricius_talk > 0) - _vm->_visa->dixi('pos', 19); + _vm->_visa->dixi('q', 19); else { if ((_vm->_gyro->dna.room == 12) & (_vm->_trip->infield(2))) { // Avaricius appears! - _vm->_visa->dixi('pos', 17); + _vm->_visa->dixi('q', 17); if (_vm->_gyro->whereis[1] == 12) - _vm->_visa->dixi('pos', 18); + _vm->_visa->dixi('q', 18); else { _vm->_trip->tr[1].init(1, false, _vm->_trip); // Avaricius _vm->_trip->apped(2, 4); @@ -1870,7 +1881,7 @@ void Acci::doThat() { } else _vm->_visa->dixi('Q', 10); break; - case kVerbCodePassword: + case kVerbCodePasswd: if (_vm->_gyro->dna.room != r__bridge) _vm->_visa->dixi('Q', 12); else { @@ -1944,7 +1955,7 @@ void Acci::doThat() { _vm->_timeout->set_up_timer(1, _vm->_timeout->procjump, _vm->_timeout->reason_jumping); _vm->_gyro->dna.user_moves_avvy = false; break; - case kVerbCodeHighscores: + case kVerbCodeHiscores: // show_highs(); warning("STUB: Acci::doThat() - case kVerbCodehighscores"); break; @@ -2018,7 +2029,7 @@ void Acci::verbOpt(byte verb, Common::String &answer, char &ansKey) { switch (verb) { case kVerbCodeExam: answer = "Examine"; - ansKey = 'word'; + ansKey = 'x'; break; // The ubiqutous one. // kVerbCodegive isn't dealt with by this procedure, but by ddm__with. case kVerbCodeDrink: diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h index e09c72ec22..d881eab222 100644 --- a/engines/avalanche/acci2.h +++ b/engines/avalanche/acci2.h @@ -41,67 +41,24 @@ class AvalancheEngine; class Acci { public: enum VerbCode { - kVerbCodeExam = 1, - kVerbCodeOpen = 2, - kVerbCodePause = 3, - kVerbCodeGet = 4, - kVerbCodeDrop = 5, - kVerbCodeInv = 6, - kVerbCodeTalk = 7, - kVerbCodeGive = 8, - kVerbCodeDrink = 9, - kVerbCodeLoad = 10, - kVerbCodeSave = 11, - kVerbCodePay = 12, - kVerbCodeLook = 13, - kVerbCodeBreak = 14, - kVerbCodeQuit = 15, - kVerbCodeSit = 16, - kVerbCodeStand = 17, - kVerbCodeGo = 18, - kVerbCodeInfo = 19, - kVerbCodeUndress = 20, - kVerbCodeWear = 21, - kVerbCodePlay = 22, - kVerbCodeRing = 23, - kVerbCodeHelp = 24, - kVerbCodeLarrypass = 25, - kVerbCodePhaon = 26, - kVerbCodeBoss = 27, - kVerbCodePee = 28, - kVerbCodeCheat = 29, - kVerbCodeMagic = 30, - kVerbCodeRestart = 31, - kVerbCodeEat = 32, - kVerbCodeListen = 33, - kVerbCodeBuy = 34, - kVerbCodeAttack = 35, - kVerbCodePassword = 36, - kVerbCodeDir = 37, - kVerbCodeDie = 38, - kVerbCodeScore = 39, - kVerbCodePut = 40, - kVerbCodeKiss = 41, - kVerbCodeClimb = 42, - kVerbCodeJump = 43, - kVerbCodeHighscores = 44, - kVerbCodeWake = 45, - kVerbCodeHello = 46, - kVerbCodeThanks = 47, - kVerbCodeSmartAlec = 249, - kVerbCodeExpletive = 253, + kVerbCodeExam = 1, kVerbCodeOpen = 2, kVerbCodePause = 3, kVerbCodeGet = 4, kVerbCodeDrop = 5, + kVerbCodeInv = 6, kVerbCodeTalk = 7, kVerbCodeGive = 8, kVerbCodeDrink = 9, kVerbCodeLoad = 10, + kVerbCodeSave = 11, kVerbCodePay = 12, kVerbCodeLook = 13, kVerbCodeBreak = 14, kVerbCodeQuit = 15, + kVerbCodeSit = 16, kVerbCodeStand = 17, kVerbCodeGo = 18, kVerbCodeInfo = 19, kVerbCodeUndress = 20, + kVerbCodeWear = 21, kVerbCodePlay = 22, kVerbCodeRing = 23, kVerbCodeHelp = 24, kVerbCodeLarrypass = 25, + kVerbCodePhaon = 26, kVerbCodeBoss = 27, kVerbCodePee = 28, kVerbCodeCheat = 29, kVerbCodeMagic = 30, + kVerbCodeRestart = 31, kVerbCodeEat = 32, kVerbCodeListen = 33, kVerbCodeBuy = 34, kVerbCodeAttack = 35, + kVerbCodePasswd = 36, kVerbCodeDir = 37, kVerbCodeDie = 38, kVerbCodeScore = 39, kVerbCodePut = 40, + kVerbCodeKiss = 41, kVerbCodeClimb = 42, kVerbCodeJump = 43, kVerbCodeHiscores = 44, kVerbCodeWake = 45, + kVerbCodeHello = 46, kVerbCodeThanks = 47, kVerbCodeSmartAlec = 249, kVerbCodeExpletive = 253 }; static const byte kPardon = 254; // Didn't understand / wasn't given. - static const int16 kParserWordsNum = 277; // How many words does the parser know? static const byte kNothing = 250; static const byte kMoved = 0; // This word was moved. (Usually because it was the subject of conversation.) - static const int16 kFirstPassword = 88; // words[kFirstPassword] should equal "TIROS". - - struct VocabEntry { byte _number; Common::String _word; @@ -109,102 +66,72 @@ public: static const VocabEntry kVocabulary[kParserWordsNum]; - static const char kWhat[]; + Common::String _realWords[11]; + byte _verb, _person, _thing; + bool _polite; + Acci(AvalancheEngine *vm); + void init(); + void parse(); + void doThat(); + void verbOpt(byte verb, Common::String &answer, char &ansKey); + void drink(); +private: struct RankType { uint16 _score; Common::String _title; }; static const RankType kRanks[9]; - - + static const char kWhat[]; Common::String _thats; Common::String _unknown; - Common::String _realWords[11]; - byte _verb, _person, _thing, _thing2; - bool _polite; + byte _thing2; - - - Acci(AvalancheEngine *vm); - - void init(); - - void clearWords(); - void parse(); - void lookAround(); // This is called when you say "look". - void openDoor(); - void doThat(); - void verbOpt(byte verb, Common::String &answer, char &ansKey); - void drink(); - -private: AvalancheEngine *_vm; - byte fv; - byte wordNum(Common::String word); void replace(Common::String oldChars, byte newChar); Common::String rank(); Common::String totalTime(); - void number(Common::String &codes); + void clearWords(); void cheatParse(Common::String codes); - void stripPunctuation(Common::String &word); // Strips punctuation from word. - void displayWhat(byte target, bool animate, bool &ambiguous); // << It's an adjective! bool doPronouns(); - void properNouns(); + void lookAround(); // This is called when you say "look". void sayIt(); // This makes Avalot say the response. + void openDoor(); void storeInterrogation(byte interrogation); - void examineObject(); // Examine a standard object-thing - bool isPersonHere(); - void exampers(); - bool holding(); - void openBox(bool isOpening); void examine(); - void inventory(); - void swallow(); - void peopleInRoom(); // This lists the other people in the room. - void silly(); void putProc(); // Called when you call kVerbCodeput. - void notInOrder(); void goToCauldron(); bool giveToSpludwick(); // The result of this fn is whether or not he says "Hey, thanks!". - void cardiffClimbing(); - void already(); void standUp(); // Called when you ask Avvy to stand. - void getProc(char thing); - void giveGeidaTheLute(); - void playHarp(); - void winSequence(); - void personSpeaks(); - void heyThanks(); }; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index a36ea300eb..c82c83948a 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -66,7 +66,6 @@ AvalancheEngine::~AvalancheEngine() { delete _avalot; delete _gyro; delete _enhanced; - delete _logger; delete _pingo; delete _scrolls; delete _visa; @@ -88,7 +87,6 @@ Common::ErrorCode AvalancheEngine::initialize() { _avalot = new Avalot(this); _gyro = new Gyro(this); _enhanced = new Enhanced(this); - _logger = new Logger(this); _pingo = new Pingo(this); _scrolls = new Scrolls(this); _visa = new Visa(this); @@ -209,40 +207,37 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { } else { if (!_gyro->dna.like2drink.empty()) _gyro->dna.like2drink.clear(); - uint16 like2drinkSize; + uint16 like2drinkSize = 0; + char actChr = ' '; sz.syncAsUint16LE(like2drinkSize); for (uint16 i = 0; i < like2drinkSize; i++) { - char actChr; sz.syncAsByte(actChr); _gyro->dna.like2drink += actChr; } if (!_gyro->dna.favourite_song.empty()) _gyro->dna.favourite_song.clear(); - uint16 favourite_songSize; + uint16 favourite_songSize = 0; sz.syncAsUint16LE(favourite_songSize); for (uint16 i = 0; i < favourite_songSize; i++) { - char actChr; sz.syncAsByte(actChr); _gyro->dna.favourite_song += actChr; } if (!_gyro->dna.worst_place_on_earth.empty()) _gyro->dna.worst_place_on_earth.clear(); - uint16 worst_place_on_earthSize; + uint16 worst_place_on_earthSize = 0; sz.syncAsUint16LE(worst_place_on_earthSize); for (uint16 i = 0; i < worst_place_on_earthSize; i++) { - char actChr; sz.syncAsByte(actChr); _gyro->dna.worst_place_on_earth += actChr; } if (!_gyro->dna.spare_evening.empty()) _gyro->dna.spare_evening.clear(); - uint16 spare_eveningSize; + uint16 spare_eveningSize = 0; sz.syncAsUint16LE(spare_eveningSize); for (uint16 i = 0; i < spare_eveningSize; i++) { - char actChr; sz.syncAsByte(actChr); _gyro->dna.spare_evening += actChr; } @@ -280,27 +275,28 @@ void AvalancheEngine::synchronize(Common::Serializer &sz) { sz.syncAsByte(_gyro->dna.asked_dogfood_about_nim); - //for (byte groi = 0; groi < numtr; groi ++) { + //for (byte groi = 0; groi < numtr; groi++) { // if (tr[groi].quick) { // blockwrite(f, groi, 1); // tr[groi].savedata(f); // } //} - byte spriteNum; + byte spriteNum = 0; if (sz.isSaving()) { - spriteNum = 0; - for (byte i = 0; i < _trip->numtr; i++) + for (byte i = 0; i < _trip->numtr; i++) { if (_trip->tr[i].quick) spriteNum++; + } } sz.syncAsByte(spriteNum); - if (sz.isLoading()) + if (sz.isLoading()) { for (byte i = 0; i < _trip->numtr; i++) { // Deallocate sprites. if (_trip->tr[i].quick) _trip->tr[i].done(); } + } for (byte i = 0; i < spriteNum; i++) { sz.syncAsByte(_trip->tr[i].whichsprite); @@ -366,7 +362,7 @@ bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) { return false; } - char *signature = "AVAL"; + const char *signature = "AVAL"; f->write(signature, 4); // Write version. We can't restore from obsolete versions. @@ -538,6 +534,9 @@ void AvalancheEngine::updateEvents() { break; case Common::EVENT_KEYDOWN: _avalot->handleKeyDown(event); + break; + default: + break; } } } diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 3ef5bcf935..63f654f550 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -36,7 +36,6 @@ #include "avalanche/avalot.h" #include "avalanche/gyro2.h" #include "avalanche/enhanced2.h" -#include "avalanche/logger2.h" #include "avalanche/pingo2.h" #include "avalanche/scrolls2.h" #include "avalanche/visa2.h" @@ -77,7 +76,6 @@ public: Avalot *_avalot; Gyro *_gyro; Enhanced *_enhanced; - Logger *_logger; Pingo *_pingo; Scrolls *_scrolls; Visa *_visa; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index 14ff7e5641..3248629268 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -38,7 +38,6 @@ #include "avalanche/scrolls2.h" #include "avalanche/dropdown2.h" #include "avalanche/pingo2.h" -#include "avalanche/logger2.h" #include "avalanche/timeout2.h" #include "avalanche/celer2.h" #include "avalanche/enid2.h" @@ -98,6 +97,8 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_KP1: event.kbd.keycode = Common::KEYCODE_END; break; + default: + break; } switch (event.kbd.keycode) { @@ -121,6 +122,8 @@ void Avalot::handleKeyDown(Common::Event &event) { case Common::KEYCODE_RETURN: _vm->_parser->handleReturn(); break; + default: + break; } _vm->_lucerna->showrw(); diff --git a/engines/avalanche/celer2.cpp b/engines/avalanche/celer2.cpp index ababd4a86d..d7f318f863 100644 --- a/engines/avalanche/celer2.cpp +++ b/engines/avalanche/celer2.cpp @@ -37,14 +37,10 @@ #include "common/textconsole.h" - - namespace Avalanche { const int16 Celer::kOnDisk = -1; - - Celer::Celer(AvalancheEngine *vm) { _vm = vm; _spriteNum = 0; @@ -54,8 +50,9 @@ Celer::~Celer() { forgetBackgroundSprites(); } - - +/** + * @remarks Originally called 'pics_link' + */ void Celer::updateBackgroundSprites() { if (_vm->_gyro->ddmnow) return; // No animation when the menus are up. @@ -77,61 +74,60 @@ void Celer::updateBackgroundSprites() { if ((!_vm->_gyro->dna.avvy_is_awake) && ((_vm->_gyro->roomtime % 4) == 0)) drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 12) % 2); break; - case r__argentpub: { - if (((_vm->_gyro->roomtime % 7) == 1) && (_vm->_gyro->dna.malagauche != 177)) { - // Malagauche cycle. - _vm->_gyro->dna.malagauche += 1; - switch (_vm->_gyro->dna.malagauche) { - case 1: - case 11: - case 21: - drawBackgroundSprite(-1, -1, 12); // Looks forwards. - break; - case 8: - case 18: - case 28: - case 32: - drawBackgroundSprite(-1, -1, 11); // Looks at you. - break; - case 30: - drawBackgroundSprite(-1, -1, 13); // Winks. - break; - case 33: - _vm->_gyro->dna.malagauche = 0; - break; - } - } - - switch (_vm->_gyro->roomtime % 200) { - case 179: - case 197: - drawBackgroundSprite(-1, -1, 5); // Dogfood's drinking cycle. + case r__argentpub: + if (((_vm->_gyro->roomtime % 7) == 1) && (_vm->_gyro->dna.malagauche != 177)) { + // Malagauche cycle. + _vm->_gyro->dna.malagauche += 1; + switch (_vm->_gyro->dna.malagauche) { + case 1: + case 11: + case 21: + drawBackgroundSprite(-1, -1, 12); // Looks forwards. break; - case 182: - case 194: - drawBackgroundSprite(-1, -1, 6); - break; - case 185: - drawBackgroundSprite(-1, -1, 7); - break; - case 199: - _vm->_gyro->dna.dogfoodpos = 177; // Impossible value for this. + case 8: + case 18: + case 28: + case 32: + drawBackgroundSprite(-1, -1, 11); // Looks at you. + break; + case 30: + drawBackgroundSprite(-1, -1, 13); // Winks. break; + case 33: + _vm->_gyro->dna.malagauche = 0; + break; } + } - byte direction; - if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { // Normally. - if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) - direction = 3; - else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357)) - direction = 2; - else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) - direction = 4; - - if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. - drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->dna.dogfoodpos = direction; - } + switch (_vm->_gyro->roomtime % 200) { + case 179: + case 197: + drawBackgroundSprite(-1, -1, 5); // Dogfood's drinking cycle. + break; + case 182: + case 194: + drawBackgroundSprite(-1, -1, 6); + break; + case 185: + drawBackgroundSprite(-1, -1, 7); + break; + case 199: + _vm->_gyro->dna.dogfoodpos = 177; // Impossible value for this. + break; + } + + if ((_vm->_gyro->roomtime % 200 >= 0) && (_vm->_gyro->roomtime % 200 <= 178)) { // Normally. + byte direction = 0; + if (((_vm->_lucerna->bearing(2) >= 1) && (_vm->_lucerna->bearing(2) <= 90)) || ((_vm->_lucerna->bearing(2) >= 358) && (_vm->_lucerna->bearing(2) <= 360))) + direction = 3; + else if ((_vm->_lucerna->bearing(2) >= 293) && (_vm->_lucerna->bearing(2) <= 357)) + direction = 2; + else if ((_vm->_lucerna->bearing(2) >= 271) && (_vm->_lucerna->bearing(2) <= 292)) + direction = 4; + + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; } } break; @@ -155,7 +151,7 @@ void Celer::updateBackgroundSprites() { break; case r__lustiesroom: if (!(_vm->_gyro->dna.lustie_is_asleep)) { - byte direction; + byte direction = 0; if ((_vm->_gyro->roomtime % 45) > 42) direction = 4; // du Lustie blinks. // Bearing of Avvy from du Lustie. @@ -197,55 +193,55 @@ void Celer::updateBackgroundSprites() { } break; case r__nottspub: { - // Bearing of Avvy from Port. - byte direction; - if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360))) - direction = 2; // Middle. - else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180)) - direction = 6; // Left. - else if ((_vm->_lucerna->bearing(5) >= 181) && (_vm->_lucerna->bearing(5) <= 314)) - direction = 8; // Right. - - if ((_vm->_gyro->roomtime % 60) > 57) - direction--; // Blinks. - - if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. - drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? - } + // Bearing of Avvy from Port. + byte direction = 0; + if (((_vm->_lucerna->bearing(5) >= 0) && (_vm->_lucerna->bearing(5) <= 45)) || ((_vm->_lucerna->bearing(5) >= 315) && (_vm->_lucerna->bearing(5) <= 360))) + direction = 2; // Middle. + else if ((_vm->_lucerna->bearing(5) >= 45) && (_vm->_lucerna->bearing(5) <= 180)) + direction = 6; // Left. + else if ((_vm->_lucerna->bearing(5) >= 181) && (_vm->_lucerna->bearing(5) <= 314)) + direction = 8; // Right. + + if ((_vm->_gyro->roomtime % 60) > 57) + direction--; // Blinks. + + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? + } - switch (_vm->_gyro->roomtime % 50) { - case 45 : - drawBackgroundSprite(-1, -1, 9); // Spurge blinks. - break; - case 49 : - drawBackgroundSprite(-1, -1, 10); - break; - } + switch (_vm->_gyro->roomtime % 50) { + case 45 : + drawBackgroundSprite(-1, -1, 9); // Spurge blinks. + break; + case 49 : + drawBackgroundSprite(-1, -1, 10); + break; } break; + } case r__ducks: { - if ((_vm->_gyro->roomtime % 3) == 0) // The fire flickers. - drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3); - - // Bearing of Avvy from Duck. - byte direction; - if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) - direction = 4; // Middle. - else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) - direction = 6; // Left. - else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) - direction = 8; // Right. - - if ((_vm->_gyro->roomtime % 45) > 42) - direction++; // Duck blinks. - - if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. - drawBackgroundSprite(-1, -1, direction); - _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? - } + if ((_vm->_gyro->roomtime % 3) == 0) // The fire flickers. + drawBackgroundSprite(-1, -1, 1 + (_vm->_gyro->roomtime / 3) % 3); + + // Bearing of Avvy from Duck. + byte direction = 0; + if (((_vm->_lucerna->bearing(2) >= 0) && (_vm->_lucerna->bearing(2) <= 45)) || ((_vm->_lucerna->bearing(2) >= 315) && (_vm->_lucerna->bearing(2) <= 360))) + direction = 4; // Middle. + else if ((_vm->_lucerna->bearing(2) >= 45) && (_vm->_lucerna->bearing(2) <= 180)) + direction = 6; // Left. + else if ((_vm->_lucerna->bearing(2) >= 181) && (_vm->_lucerna->bearing(2) <= 314)) + direction = 8; // Right. + + if ((_vm->_gyro->roomtime % 45) > 42) + direction++; // Duck blinks. + + if (direction != _vm->_gyro->dna.dogfoodpos) { // Only if it's changed. + drawBackgroundSprite(-1, -1, direction); + _vm->_gyro->dna.dogfoodpos = direction; // We use DogfoodPos here too - why not? } break; + } } if ((_vm->_gyro->dna.ringing_bells) && (_vm->_gyro->flagset('B'))) { @@ -259,7 +255,7 @@ void Celer::updateBackgroundSprites() { break; case 2: //nosound(); - warning("STUB: Celer::pics_link()"); + updateBackgroundSprites(); break; } } @@ -289,9 +285,9 @@ void Celer::loadBackgroundSprites(byte number) { sprite._yl = f.readSint16LE(); sprite._size = f.readSint32LE(); bool natural = f.readByte(); - bool memorise = f.readByte(); + bool memorize = f.readByte(); - if (memorise) { + if (memorize) { _sprites[i]._x = sprite._x; _sprites[i]._xl = sprite._xl; _sprites[i]._y = sprite._y; @@ -303,9 +299,10 @@ void Celer::loadBackgroundSprites(byte number) { _sprites[i]._size = _sprites[i]._xl * 8 * _sprites[i]._yl + 1; _sprites[i]._picture.create(_sprites[i]._xl * 8, _sprites[i]._yl + 1, ::Graphics::PixelFormat::createFormatCLUT8()); - for (uint16 y = 0; y < _sprites[i]._yl + 1; y++) + for (uint16 y = 0; y < _sprites[i]._yl + 1; y++) { for (uint16 x = 0; x < _sprites[i]._xl * 8; x++) *(byte *)_sprites[i]._picture.getBasePtr(x, y) = *_vm->_graphics->getPixel(_sprites[i]._x * 8 + x, _sprites[i]._y + y); + } } else { _sprites[i]._size = sprite._size; _sprites[i]._picture = _vm->_graphics->loadPictureRow(f, _sprites[i]._xl * 8, _sprites[i]._yl + 1); @@ -317,9 +314,10 @@ void Celer::loadBackgroundSprites(byte number) { } void Celer::forgetBackgroundSprites() { - for (byte i = 0; i < _spriteNum; i ++) + for (byte i = 0; i < _spriteNum; i++) { if (_sprites[i]._x > kOnDisk) _sprites[i]._picture.free(); + } } void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { @@ -349,7 +347,7 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { sprite._xl = f.readSint16LE(); sprite._yl = f.readSint16LE(); sprite._size = f.readSint32LE(); - f.skip(2); // For the now not existing natural and memorise data members of the SpriteType (called chunkblocktype in the original). + f.skip(2); // For the now not existing natural and memorize data members of the SpriteType (called chunkblocktype in the original). sprite._picture = _vm->_graphics->loadPictureRow(f, sprite._xl * 8, sprite._yl + 1); if (destX < 0) { @@ -364,7 +362,7 @@ void Celer::drawBackgroundSprite(int16 destX, int16 destY, byte which) { //setactivepage(1 - cp); warning("STUB: Celer::show_one()"); - for (byte i = 0; i < 2; i ++) + for (byte i = 0; i < 2; i++) _vm->_trip->getset[i].remember(_r); } @@ -376,7 +374,7 @@ void Celer::drawSprite(int16 x, int16 y, const SpriteType &sprite) { _r.y2 = y + sprite._yl; switch (sprite._type) { - case kNaturalImage: // Allow fallthorugh on purpose. + case kNaturalImage: // Allow fallthrough on purpose. case kBgi: _r.x2 = x + sprite._xl + 1; break; diff --git a/engines/avalanche/celer2.h b/engines/avalanche/celer2.h index 56c5f22d09..fe38ebe917 100644 --- a/engines/avalanche/celer2.h +++ b/engines/avalanche/celer2.h @@ -36,23 +36,16 @@ #include "graphics/surface.h" - - namespace Avalanche { class AvalancheEngine; class Celer { public: Celer(AvalancheEngine *vm); - ~Celer(); - - void updateBackgroundSprites(); - void loadBackgroundSprites(byte number); - void forgetBackgroundSprites(); // Setting the destination to negative coordinates means the picture should be drawn to it's original position. @@ -71,8 +64,6 @@ private: ::Graphics::Surface _picture; }; - - AvalancheEngine *_vm; int32 _offsets[40]; @@ -80,13 +71,8 @@ private: SpriteType _sprites[40]; bytefield _r; Common::String _filename; - - - static const int16 kOnDisk; /* Value of memos[fv].x when it's not in memory. */ - - void drawSprite(int16 x, int16 y, const SpriteType &sprite); }; diff --git a/engines/avalanche/closing2.h b/engines/avalanche/closing2.h index 14cf54bbf3..89e2d7358a 100644 --- a/engines/avalanche/closing2.h +++ b/engines/avalanche/closing2.h @@ -49,7 +49,7 @@ private: kScreenBugAlert = 1, kScreenRamCram = 2, kScreenNagScreen = 3, - kScreenTwoCopies = 5, + kScreenTwoCopies = 5 }; AvalancheEngine *_vm; diff --git a/engines/avalanche/enid2.cpp b/engines/avalanche/enid2.cpp index 9841fa02e7..1e7c816947 100644 --- a/engines/avalanche/enid2.cpp +++ b/engines/avalanche/enid2.cpp @@ -263,8 +263,8 @@ void Enid::from_sundry(sundry sund) { } void Enid::restore_dna() { - uint16 here, fv; - sundry sund; +// uint16 here, fv; +// sundry sund; warning("STUB: Enid::restore_dna()"); } diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index b6dbe16c61..35ccd5ff2e 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -77,7 +77,7 @@ Graphics::~Graphics() { } -void Graphics::flesh_colours() +void Graphics::flesh_colors() { g_system->getPaletteManager()->setPalette(_egaPalette[39], 13, 1); g_system->getPaletteManager()->setPalette(_egaPalette[28], 5, 1); @@ -126,9 +126,9 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int32 yRadius = radius * kScreenWidth / (8 * kScreenHeight); // Just don't ask why... if (xRadius == 0) - xRadius ++; + xRadius++; if (yRadius == 0) - yRadius ++; + yRadius++; // Check for an ellipse with negligable x and y radius. if ((xRadius <= 1) && (yRadius <= 1)) @@ -177,7 +177,7 @@ Common::Point Graphics::drawArc(::Graphics::Surface &surface, int16 x, int16 y, int16 xTemp = xNext; int16 yTemp = yNext; // This is used by both sin and cos. - double tempTerm = (j+delta)*convfac; + tempTerm = (j + delta) * convfac; xNext = floor(xRadius*cos(tempTerm) + 0.5); yNext = floor(yRadius*sin(tempTerm + pi) + 0.5); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index ca28772156..7f27186bac 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -84,7 +84,7 @@ public: ~Graphics(); - void flesh_colours(); + void flesh_colors(); byte *getPixel(int16 x, int16 y); diff --git a/engines/avalanche/gyro2.cpp b/engines/avalanche/gyro2.cpp index 1d6ac7e0a3..ae954d8e3c 100644 --- a/engines/avalanche/gyro2.cpp +++ b/engines/avalanche/gyro2.cpp @@ -267,12 +267,12 @@ Common::String Gyro::strf(int32 x) { return q; } -void Gyro::newpointer(byte m) { - if (m == cmp) +void Gyro::newpointer(byte id) { + if (id == cmp) return; - cmp = m; + cmp = id; - load_a_mouse(m); + load_a_mouse(id); } void Gyro::wait() { @@ -312,7 +312,7 @@ void Gyro::shbox(int16 x1, int16 y1, int16 x2, int16 y2, Common::String t) { } void Gyro::newgame() { - for (byte gm = 0; gm < numtr; gm ++) { + for (byte gm = 0; gm < numtr; gm++) { if (_vm->_trip->tr[gm].quick) _vm->_trip->tr[gm].done(); } @@ -343,7 +343,7 @@ void Gyro::newgame() { ppos[0][1] = -177; _vm->_trip->tr[0].appear(300,117,right); // Needed to initialize Avalot. - //for (gd = 0; gd <= 30; gd ++) for (gm = 0; gm <= 1; gm ++) also[gd][gm] = nil; + //for (gd = 0; gd <= 30; gd++) for (gm = 0; gm <= 1; gm++) also[gd][gm] = nil; /* fillchar(previous^,sizeof(previous^),#0); { blank out array } */ him = 254; her = 254; @@ -356,7 +356,7 @@ void Gyro::newgame() { dna.avvy_in_bed = true; enid_filename = ""; - for (byte gd = 0; gd <= 1; gd ++) { + for (byte gd = 0; gd <= 1; gd++) { cp = 1 - cp; _vm->_trip->getback(); } @@ -388,8 +388,8 @@ bool Gyro::flagset(char x) { } void Gyro::force_numlock() { - if ((locks & num) > 0) - locks -= num; + if ((locks & numlockCode) > 0) + locks -= numlockCode; } bool Gyro::pennycheck(uint16 howmuchby) { diff --git a/engines/avalanche/gyro2.h b/engines/avalanche/gyro2.h index 967034a7ed..971fbbdfc0 100644 --- a/engines/avalanche/gyro2.h +++ b/engines/avalanche/gyro2.h @@ -45,16 +45,10 @@ class AvalancheEngine; static const char numobjs = 18; /* always preface with a # */ static const int16 maxobjs = 12; /* carry limit */ -static const byte howlong = 1/*8*/; /* 18 ticks. */ - -static const int16 num = 32; /* Code for Num Lock */ +static const int16 numlockCode = 32; /* Code for Num Lock */ static const int16 mouse_size = 134; - - -typedef void (*proc)(); - struct postype { uint16 x, y, datapos; byte length; @@ -282,17 +276,6 @@ struct ednahead { /* Edna header */ /* DNA values follow, then footer (which is ignored) */ }; -/* Possible values of edhead.os: - 1 = DOS 4 = Mac - 2 = Windows 5 = Amiga - 3 = OS/2 6 = ST - 7 = Archimedes */ - - - - - - class Gyro { public: static const char *vernum; @@ -535,7 +518,7 @@ public: Common::String flags; Common::String listen; - uint16 oh, onh, om, h, m, s, s1; + uint16 oh, onh, om, hour, minutes, seconds; Common::String atkey; /* For XTs, set to "alt-". For ATs, set to "f1". */ @@ -559,7 +542,7 @@ public: Common::String roomname; /* Name of this room */ //text logfile; // http://wiki.freepascal.org/Text - bool logging, log_epson; + bool log_epson; bool cl_override; @@ -612,7 +595,7 @@ public: Common::String strf(int32 x); - void newpointer(byte m); + void newpointer(byte id); void wait(); // Makes hourglass. diff --git a/engines/avalanche/logger2.cpp b/engines/avalanche/logger2.cpp deleted file mode 100644 index 24c6d55fe9..0000000000 --- a/engines/avalanche/logger2.cpp +++ /dev/null @@ -1,289 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* LOGGER Handles the logging. */ - -#include "avalanche/avalanche.h" - -#include "avalanche/logger2.h" -#include "avalanche/gyro2.h" -#include "avalanche/trip6.h" - -#include "common/textconsole.h" - -namespace Avalanche { -const char Logger::divide[] = "--- oOo ---"; - -/* Epson codes: - - startwith=''; - endwith=''; - double_width = #14; { shift out (SO) } - double_off = #20; { device control 4 (DC4) } - italic = #27+'4'; { switches italics on... } - italic_off = #27+'5'; { and off. } - emph_on = #27+#69; - emph_off = #27+#70; - divide_indent = 15; - -*/ - -/* L'jet codes: */ - -// Not sure if these will be needed at all... - -const Common::String startwith = Common::String(33) + 50 + "10J" + 130; -const Common::String endwith = Common::String(33) + 105; -const Common::String italic = Common::String(33) + 50 + 163 + 61 + 123; /* switches italics on... */ -const Common::String italic_off = Common::String(33) + 50 + 163 + 60 + 123; /* and off. */ -const Common::String emph_on = Common::String(33) + 50 + 163 + 63 + 102; -const Common::String emph_off = Common::String(33) + 50 + 163 + 60 + 102; - -const Common::String double_width = emph_on; /* There IS no double-width. */ -const Common::String double_off = emph_off; /* So we'll have to use bold. */ - - - -const Common::String Logger::quote = "ª"; -const Common::String Logger::unquote = "º"; -const Common::String Logger::copyright = "(c)"; -const int16 Logger::divide_indent = 30; - - - -Logger::Logger(AvalancheEngine *vm) { - _vm = vm; -} - -void Logger::centre(byte size, byte x) { /* Prints req'd number of spaces. */ - byte fv; - - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::centre()"); - /*for (fv = 1; fv <= size - (x / 2); fv++) - output << logfile << ' ';*/ -} - -void Logger::log_setup(Common::String name, bool printing) { /* Sets up. */ - - warning("STUB: Logger::log_setup()"); - - /* assign(logfile, name); - rewrite(logfile); - output << logfile << startwith; - log_epson = printing; - logging = true; - - if (!printing) { - quote = '"'; - unquote = '"'; - copyright = "(c)"; - }*/ -} - -void Logger::log_divider() { /* Prints the divider sign. */ - byte fv; - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_divider()"); - - /* - if (_vm->_gyro->log_epson) { - output << logfile << Common::String(' ') + double_width; - for (fv = 1; fv <= divide_indent; fv++) - output << logfile << ' '; - output << logfile << Common::String(' ') + double_off; - } else { - for (fv = 1; fv <= 36; fv++) - output << logfile << ' '; - } - output << logfile << divide << NL; - */ -} - -void Logger::log_command(Common::String x) { /* Prints a command */ - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_command()"); - - /*if (_vm->_gyro->log_epson) - output << logfile << double_width + '>' + double_off + ' ' + italic + x + italic_off << NL; - else - output << logfile << Common::String("> ") + x << NL;*/ -} - -void Logger::log_addstuff(Common::String x) { - if (!_vm->_gyro->logging) - return; - - scroll_line += x; -} - -void Logger::log_scrollchar(Common::String x) { /* print one character */ - Common::String z; - if (!_vm->_gyro->logging) - return; - - switch (x[0]) { - case '\'': - z = quote; - break; /* Open quotes: "66" */ - case '\"': - z = unquote; - break; /* Close quotes: "99" */ - case 239: - z = copyright; - break; /* Copyright sign. */ - default: - z = x; - } - log_addstuff(z); - scroll_line_length += z.size(); -} - -void Logger::log_italic() { - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_italic()"); - - /*if (_vm->_gyro->log_epson) - log_addstuff(italic); - else - log_addstuff("*");*/ -} - -void Logger::log_roman() { - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_roman()"); - - /* if (_vm->_gyro->log_epson) - log_addstuff(italic_off); - else - log_addstuff("*");*/ -} - -void Logger::log_epsonroman() { /* This only sends the Roman code if you're on Epson.*/ - if (!_vm->_gyro->logging) - return; - - if (_vm->_gyro->log_epson) - log_addstuff(italic_off); -} - -void Logger::log_scrollline() { /* Set up a line for the scroll driver */ - scroll_line_length = 0; - scroll_line = ""; -} - -void Logger::log_scrollendline(bool centred) { - byte x, fv; - if (!_vm->_gyro->logging) - return; - x = 17; - if (centred) - x += (50 - scroll_line_length) / 2; - - warning("STUB: Logger::log_scrollendline()"); - - /*for (fv = 1; fv <= x; fv++) - output << logfile << ' '; - output << logfile << scroll_line << NL;*/ -} - -void Logger::log_bubbleline(byte linenum, byte whom, Common::String x) { - byte fv; - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_bubbleline()"); - - /*if (linenum == 1) { - for (fv = 1; fv <= 15; fv++) - output << logfile << ' '; - output << logfile << italic + tr[whom].a.name + ": " + italic_off + x << NL; - } else { - for (fv = 1; fv <= 17; fv++) - output << logfile << ' '; - output << logfile << x << NL; - }*/ -} - -void Logger::log_newline() { - warning("STUB: Logger::log_newline()"); - - //if (_vm->_gyro->logging) - // output << logfile << NL; -} - -void Logger::log_newroom(Common::String where) { - byte fv; - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_newroom()"); - - /*for (fv = 1; fv <= 20; fv++) - output << logfile << ' '; - if (_vm->_gyro->log_epson) - output << logfile << emph_on; - output << logfile << Common::String('(') + where + ')'; - if (_vm->_gyro->log_epson) - output << logfile << emph_off; - output << logfile << NL;*/ -} - -void Logger::log_aside(Common::String what) { -/* This writes "asides" to the printer. For example, moves in Nim. */ - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_aside()"); - - //output << logfile << " (" << italic << what << italic_off << ')' << NL; - /* "What" is what to write. */ -} - -void Logger::log_score(uint16 credit, uint16 now) { - byte fv; - if (!_vm->_gyro->logging) - return; - - warning("STUB: Logger::log_score()"); - - /*for (fv = 1; fv <= 50; fv++) - output << logfile << ' '; - output << logfile << "Score " << italic << "credit : " << credit << italic_off << " total : " << now << NL;*/ -} - -} // End of namespace Avalanche diff --git a/engines/avalanche/logger2.h b/engines/avalanche/logger2.h deleted file mode 100644 index 95e5ea849d..0000000000 --- a/engines/avalanche/logger2.h +++ /dev/null @@ -1,92 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - * This code is based on the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* LOGGER Handles the logging. */ - -#ifndef LOGGER2_H -#define LOGGER2_H - -#include "common/scummsys.h" -#include "common/str.h" - -namespace Avalanche { -class AvalancheEngine; - -class Logger { -public: - Logger(AvalancheEngine *vm); - - void log_setup(Common::String name, bool printing); - - void log_divider(); /* Prints the divider sign. */ - - void log_command(Common::String x); /* Prints a command */ - - void log_scrollchar(Common::String x); /* print one character */ - - void log_italic(); - - void log_roman(); - - void log_epsonroman(); - - void log_scrollline(); /* Set up a line for the scroll driver */ - - void log_scrollendline(bool centred); - - void log_bubbleline(byte linenum, byte whom, Common::String x); - - void log_newline(); - - void log_newroom(Common::String where); - - void log_aside(Common::String what); - - void log_score(uint16 credit, uint16 now); - -private: - AvalancheEngine *_vm; - - static const char divide[]; - - static const Common::String quote; - static const Common::String unquote; - static const Common::String copyright; - static const int16 divide_indent; - - Common::String scroll_line; - byte scroll_line_length; - - void centre(byte size, byte x); - - void log_addstuff(Common::String x); - -}; - -} // End of namespace Avalanche - -#endif // LOGGER2_H diff --git a/engines/avalanche/lucerna2.cpp b/engines/avalanche/lucerna2.cpp index 8100c5a829..883cf20233 100644 --- a/engines/avalanche/lucerna2.cpp +++ b/engines/avalanche/lucerna2.cpp @@ -32,7 +32,6 @@ #include "avalanche/lucerna2.h" #include "avalanche/gyro2.h" #include "avalanche/scrolls2.h" -#include "avalanche/logger2.h" #include "avalanche/enhanced2.h" #include "avalanche/visa2.h" #include "avalanche/timeout2.h" @@ -62,8 +61,10 @@ Lucerna::Lucerna(AvalancheEngine *vm) : fxhidden(false) { void Lucerna::init() { _vm->_gyro->oh = 17717; _vm->_gyro->om = 17717; - if (_vm->_enhanced->atbios) _vm->_gyro->atkey = "f1"; - else _vm->_gyro->atkey = "alt-"; + if (_vm->_enhanced->atbios) + _vm->_gyro->atkey = "f1"; + else + _vm->_gyro->atkey = "alt-"; } void Lucerna::callverb(byte n) { @@ -82,20 +83,19 @@ void Lucerna::callverb(byte n) { void Lucerna::draw_also_lines() { byte ff; - byte squeaky_code; - CursorMan.showMouse(false); _vm->_graphics->_magics.fillRect(Common::Rect(0, 0, 640, 200), 0); _vm->_graphics->_magics.frameRect(Common::Rect(0, 45, 640, 161), 15); - for (ff = 0; ff < _vm->_gyro->lineNum; ff++) + for (ff = 0; ff < _vm->_gyro->lineNum; ff++) { // We had to check if the lines are within the borders of the screen. if ((_vm->_gyro->lines[ff].x1 >= 0) && (_vm->_gyro->lines[ff].x1 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y1 >= 0) && (_vm->_gyro->lines[ff].y1 < _vm->_graphics->kScreenHeight) - && (_vm->_gyro->lines[ff].x2 >= 0) && (_vm->_gyro->lines[ff].x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y2 >= 0) && (_vm->_gyro->lines[ff].y2 < _vm->_graphics->kScreenHeight)) - _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); - + && (_vm->_gyro->lines[ff].x2 >= 0) && (_vm->_gyro->lines[ff].x2 < _vm->_graphics->kScreenWidth) && (_vm->_gyro->lines[ff].y2 >= 0) && (_vm->_gyro->lines[ff].y2 < _vm->_graphics->kScreenHeight)) + _vm->_graphics->_magics.drawLine(_vm->_gyro->lines[ff].x1, _vm->_gyro->lines[ff].y1, _vm->_gyro->lines[ff].x2, _vm->_gyro->lines[ff].y2, _vm->_gyro->lines[ff].col); + } + CursorMan.showMouse(true); } @@ -112,13 +112,13 @@ Common::String Lucerna::nextstring() { } void Lucerna::scram1(Common::String &x) { - for (int fz = 0; fz < x.size(); fz ++) + for (uint fz = 0; fz < x.size(); fz++) x.setChar(x[fz] ^ 177, fz); } void Lucerna::unscramble() { - for (byte fv = 0; fv < 31; fv ++) - for (byte ff = 0; ff < 2; ff ++) + for (byte fv = 0; fv < 31; fv++) + for (byte ff = 0; ff < 2; ff++) if (_vm->_gyro->also[fv][ff] != 0) scram1(*_vm->_gyro->also[fv][ff]); scram1(_vm->_gyro->listen); @@ -150,7 +150,7 @@ void Lucerna::load_also(Common::String n) { _vm->_gyro->also[fv][ff] = new Common::String; *_vm->_gyro->also[fv][ff] = nextstring(); } - *_vm->_gyro->also[fv][0] = Common::String(157) + *_vm->_gyro->also[fv][0] + 157; + *_vm->_gyro->also[fv][0] = Common::String('\x9D') + *_vm->_gyro->also[fv][0] + Common::String('\x9D'); } memset(_vm->_gyro->lines, 0xFF, sizeof(_vm->_gyro->lines)); @@ -212,14 +212,12 @@ void Lucerna::load_also(Common::String n) { } void Lucerna::load(byte n) { /* Load2, actually */ - byte a0; /*absolute $A000:800;*/ - byte a1; /*absolute $A000:17184;*/ byte bit; Common::String xx; CursorMan.showMouse(false); - _vm->_graphics->flesh_colours(); + _vm->_graphics->flesh_colors(); xx = _vm->_gyro->strf(n); Common::String filename; @@ -241,41 +239,22 @@ void Lucerna::load(byte n) { /* Load2, actually */ f.seek(177); - /*for (bit = 0; bit <= 3; bit++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, a0, 12080); - move(a0, a1, 12080); - }*/ - - - _vm->_graphics->_background = _vm->_graphics->loadPictureRow(f, _vm->_graphics->kBackgroundWidth, _vm->_graphics->kBackgroundHeight); - _vm->_graphics->refreshBackground(); f.close(); - - load_also(xx); - _vm->_celer->loadBackgroundSprites(n); - bit = *_vm->_graphics->getPixel(0,0); - - _vm->_logger->log_newroom(_vm->_gyro->roomname); - CursorMan.showMouse(true); } void Lucerna::zoomout(int16 x, int16 y) { - int16 x1, y1, x2, y2; - byte fv; +// int16 x1, y1, x2, y2; +// byte fv; warning("STUB: Lucerna::zoomout()"); } @@ -561,7 +540,6 @@ void Lucerna::enterroom(byte x, byte ped) { //setactivepage(1 - cp); { - dnatype &with = _vm->_gyro->dna; if ((_vm->_gyro->dna.obj[_vm->_gyro->wine - 1]) && (_vm->_gyro->dna.winestate != 3)) { _vm->_visa->dixi('q', 9); /* Don't want to waste the wine! */ _vm->_gyro->dna.obj[_vm->_gyro->wine - 1] = false; @@ -839,7 +817,7 @@ void Lucerna::thinkabout(byte z, bool th) { /* Hey!!! Get it and put it!!! * putimage(x, y, p, 0); setactivepage(1 - cp);*/ - for (byte fv = 0; fv <= 1; fv ++) + for (byte fv = 0; fv <= 1; fv++) _vm->_trip->getset[fv].remember(thinkspace); CursorMan.showMouse(true); @@ -855,14 +833,14 @@ void Lucerna::load_digits() { /* Load the scoring digits & rwlites */ return; } - for (byte fv = 0; fv < 10; fv ++) { + for (byte fv = 0; fv < 10; fv++) { f.seek(fv * digitsize); /*_vm->_gyro->digit[fv] = new byte[digitsize]; f.read(_vm->_gyro->digit[fv], digitsize);*/ _vm->_gyro->digit[fv] = _vm->_graphics->loadPictureGraphic(f); } - for (byte ff = 0; ff < 9; ff ++) { + for (byte ff = 0; ff < 9; ff++) { f.seek(10 * digitsize + ff * rwlitesize); /*_vm->_gyro->rwlite[ff] = new byte[rwlitesize]; f.read(_vm->_gyro->rwlite[ff], rwlitesize);*/ @@ -918,11 +896,11 @@ void Lucerna::showscore() { //setactivepage(3); - for (byte fv = 0; fv < 3; fv ++) + for (byte fv = 0; fv < 3; fv++) if (_vm->_gyro->lastscore[fv] != numbers[fv]) _vm->_graphics->drawPicture(_vm->_graphics->_surface, _vm->_gyro->digit[numbers[fv]], 250 + (fv + 1) * 15, 177); - for (byte fv = 0; fv < 2; fv ++) + for (byte fv = 0; fv < 2; fv++) _vm->_trip->getset[fv].remember(scorespace); //setactivepage(1 - cp); @@ -933,16 +911,15 @@ void Lucerna::showscore() { } void Lucerna::points(byte num) { /* Add on no. of points */ - for (byte q = 1; q <= num; q ++) { + for (byte q = 1; q <= num; q++) { _vm->_gyro->dna.score++; /*if (soundfx) - for (byte fv = 1; fv <= 97; fv ++) + for (byte fv = 1; fv <= 97; fv++) sound(177 + dna.score * 3); nosound;*/ } warning("STUB: Lucerna::points()"); - _vm->_logger->log_score(num, _vm->_gyro->dna.score); showscore(); } @@ -990,9 +967,6 @@ void Lucerna::mouseway(const Common::Point &cursorPos) { } void Lucerna::inkey() { - char r; - - if (_vm->_gyro->demo) return; /* Demo handles this itself. */ @@ -1171,9 +1145,13 @@ int8 Lucerna::fades(int8 x) { x = x % 16; byte g = x / 4; byte b = x % 4; - if (r > 0) r --; - if (g > 0) g --; - if (b > 0) b --; + if (r > 0) + r--; + if (g > 0) + g--; + if (b > 0) + b--; + return (16 * r + 4 * g + b); /* fades:=x-1;*/ } @@ -1208,7 +1186,7 @@ void Lucerna::showrw() { // It's data is loaded in load_digits(). _vm->_gyro->oldrw = _vm->_gyro->dna.rw; CursorMan.showMouse(false); - /* for (byte page_ = 0; page_ <= 1; page_ ++) { + /* for (byte page_ = 0; page_ <= 1; page_++) { setactivepage(page_); putimage(0, 161, rwlite[with.rw], 0); }*/ @@ -1258,7 +1236,7 @@ void Lucerna::plothands() { hand(am, brown); calchand(nh, 14, ah, brown); - calchand(_vm->_gyro->m * 6, 17, am, brown); + calchand(_vm->_gyro->minutes * 6, 17, am, brown); hand(ah, yellow); hand(am, yellow); @@ -1277,50 +1255,45 @@ void Lucerna::clock_lucerna() { /* ...Clock. */ TimeDate t; _vm->_system->getTimeAndDate(t); - _vm->_gyro->h = t.tm_hour; - _vm->_gyro->m = t.tm_min; - _vm->_gyro->s = t.tm_sec; + _vm->_gyro->hour = t.tm_hour; + _vm->_gyro->minutes = t.tm_min; + _vm->_gyro->seconds = t.tm_sec; - nh = (_vm->_gyro->h % 12) * 30 + _vm->_gyro->m / 2; + nh = (_vm->_gyro->hour % 12) * 30 + _vm->_gyro->minutes / 2; - if (_vm->_gyro->oh != _vm->_gyro->h) { + if (_vm->_gyro->oh != _vm->_gyro->hour) { plothands(); chime(); } - if (_vm->_gyro->om != _vm->_gyro->m) + if (_vm->_gyro->om != _vm->_gyro->minutes) plothands(); - if ((_vm->_gyro->h == 0) && (_vm->_gyro->oh != 0) && (_vm->_gyro->oh != 17717)) + if ((_vm->_gyro->hour == 0) && (_vm->_gyro->oh != 0) && (_vm->_gyro->oh != 17717)) _vm->_scrolls->display(Common::String("Good morning!") + 13 + 13 + "Yes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much!"); - _vm->_gyro->oh = _vm->_gyro->h; + _vm->_gyro->oh = _vm->_gyro->hour; _vm->_gyro->onh = nh; - _vm->_gyro->om = _vm->_gyro->m; + _vm->_gyro->om = _vm->_gyro->minutes; } void Lucerna::delavvy() { - byte page_; - CursorMan.showMouse(false); - triptype &with = _vm->_trip->tr[0]; - /*for (page_ = 0; page_ <= 1; page_ ++) - mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_);*/ +// triptype &with = _vm->_trip->tr[0]; +// for (byte page_ = 0; page_ <= 1; page_++) +// mblit(with.x / 8, with.y, (with.x + with._info.xl) / 8 + 1, with.y + with._info.yl, 3, page_); CursorMan.showMouse(true); } void Lucerna::gameover() { - byte fv; - int16 sx, sy; - _vm->_gyro->dna.user_moves_avvy = false; - sx = _vm->_trip->tr[0].x; - sy = _vm->_trip->tr[0].y; + int16 sx = _vm->_trip->tr[0].x; + int16 sy = _vm->_trip->tr[0].y; _vm->_trip->tr[0].done(); _vm->_trip->tr[0].init(12, true, _vm->_trip); // 12 = Avalot falls @@ -1340,7 +1313,7 @@ void Lucerna::minor_redraw() { enterroom(_vm->_gyro->dna.room, 0); /* Ped unknown or non-existant. */ - for (byte fv = 0; fv <= 1; fv ++) { + for (byte fv = 0; fv <= 1; fv++) { _vm->_gyro->cp = 1 - _vm->_gyro->cp; _vm->_trip->getback(); } @@ -1377,8 +1350,6 @@ void Lucerna::sprite_run() { sprites are still. It performs two fast cycles, only using a few of the links usually used, and without any extra animation. This should make the sprites the same on both pages. */ - byte fv; - _vm->_gyro->doing_sprite_run = true; _vm->_trip->get_back_loretta(); diff --git a/engines/avalanche/lucerna2.h b/engines/avalanche/lucerna2.h index 8c497212b4..db9e43191f 100644 --- a/engines/avalanche/lucerna2.h +++ b/engines/avalanche/lucerna2.h @@ -102,7 +102,7 @@ public: uint16 bearing(byte whichped); // Returns the bearing from ped Whichped to Avvy, in degrees. - void flesh_colours(); + void flesh_colors(); void sprite_run(); diff --git a/engines/avalanche/module.mk b/engines/avalanche/module.mk index dbaa5460c6..9698025280 100644 --- a/engines/avalanche/module.mk +++ b/engines/avalanche/module.mk @@ -9,7 +9,6 @@ MODULE_OBJS = \ detection.o \ gyro2.o \ enhanced2.o \ - logger2.o \ pingo2.o \ scrolls2.o \ visa2.o \ diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index bd7064877b..e6cbdabce8 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -80,8 +80,6 @@ void Parser::handleReturn() { if (_vm->_dropdown->_activeMenuItem._activeNow) _vm->_parser->tryDropdown(); else { - _vm->_logger->log_command(_inputText); - if (!_inputText.empty()) { _inputTextBackup = _inputText; _vm->_acci->parse(); @@ -103,6 +101,8 @@ void Parser::handleFunctionKey(const Common::Event &event) { case Common::KEYCODE_F7: _vm->_lucerna->callverb(_vm->_acci->kVerbCodeOpen); break; + default: + break; } } @@ -155,7 +155,7 @@ void Parser::drawCursor() { bf.x2 = _inputTextPos + 2; bf.y1 = 168; bf.y2 = 168; - for (byte fv = 0; fv <= 1; fv ++) + for (byte fv = 0; fv <= 1; fv++) _vm->_trip->getset[fv].remember(bf); } diff --git a/engines/avalanche/pingo2.cpp b/engines/avalanche/pingo2.cpp index 4f3d17192b..777a1c7cb6 100644 --- a/engines/avalanche/pingo2.cpp +++ b/engines/avalanche/pingo2.cpp @@ -109,8 +109,6 @@ void Pingo::zonk() { void Pingo::winning_pic() { Common::File f; - char r; - _vm->_lucerna->dusk(); if (!f.open("finale.avd")) { @@ -118,7 +116,7 @@ void Pingo::winning_pic() { return; } - /*for (byte bit = 0; bit <= 3; bit ++) { + /*for (byte bit = 0; bit <= 3; bit++) { port[0x3c4] = 2; port[0x3ce] = 4; port[0x3c5] = 1 << bit; @@ -137,7 +135,8 @@ void Pingo::winning_pic() { /*do { _vm->_gyro->check(); } while (!(keypressed() || (mrelease > 0))); - while (keypressed()) r = readkey(); + while (keypressed()) + char r = readkey(); major_redraw();*/ warning("STUB: Pingo::winning_pic()"); } diff --git a/engines/avalanche/scrolls2.cpp b/engines/avalanche/scrolls2.cpp index 300d275346..51d47a9e4d 100644 --- a/engines/avalanche/scrolls2.cpp +++ b/engines/avalanche/scrolls2.cpp @@ -31,7 +31,6 @@ #include "avalanche/scrolls2.h" #include "avalanche/gyro2.h" -#include "avalanche/logger2.h" #include "avalanche/enhanced2.h" #include "avalanche/lucerna2.h" #include "avalanche/trip6.h" @@ -56,12 +55,10 @@ void Scrolls::init() { } void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ - byte page_; - if (_vm->_gyro->ledstatus == x) return; /* Already like that! */ - byte color; + byte color = black; switch (x) { case 0: color = black; @@ -72,21 +69,6 @@ void Scrolls::state(byte x) { /* Sets "Ready" light to whatever */ color = green; break; /* Hit a key */ } - - //switch (x) { - //case 0: - // setfillstyle(1, black); - // break; /* Off */ - //case 1: - // setfillstyle(9, green); - // break; /* Half-on (menus) */ - //case 2: - // setfillstyle(1, green); - // break; /* On (kbd) */ - //case 3: - // setfillstyle(6, green); - // break; /* Hit a key */ - //} warning("STUB: Scrolls::state()"); CursorMan.showMouse(false); @@ -105,8 +87,6 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit fontType itw; byte lz = z.size(); - _vm->_logger->log_scrollline(); - bool offset = x % 8 == 4; x = x / 8; y++; @@ -115,12 +95,10 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit switch (z[xx]) { case kControlRoman: { cfont = roman; - _vm->_logger->log_roman(); } break; case kControlItalic: { cfont = italic; - _vm->_logger->log_italic(); } break; default: { @@ -131,8 +109,6 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit i++; Common::String chr(z[xx]); _vm->_graphics->drawText(_vm->_graphics->_scrolls, chr, itw, 12, (x - 1) * 8 + offset * 4 + i * 8, y, black); - - _vm->_logger->log_scrollchar(Common::String(z[xx])); } } } @@ -143,8 +119,6 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { /* Fancy FAST screenwrit void Scrolls::normscroll() { Common::String egg = Common::String(kControlParagraph) + kControlLeftJustified + kControlNegative + kControlBell + kControlBackspace + "***"; Common::String e = "(c) 1994"; - char r; - bool oktoexit; state(3); _vm->_gyro->seescroll = true; @@ -172,6 +146,8 @@ void Scrolls::normscroll() { +// char r; +// bool oktoexit; // do { // do { // _vm->_gyro->check(); /* was "checkclick;" */ @@ -231,7 +207,7 @@ bool Scrolls::they_match(tunetype &played) { mistakes = 0; - for (fv = 1; fv <= sizeof(played); fv ++) + for (fv = 1; fv <= sizeof(played); fv++) if (played[fv] != _vm->_gyro->tune[fv]) { mistakes += 1; } @@ -269,7 +245,6 @@ void Scrolls::music_scroll() { void Scrolls::resetscrolldriver() { /* phew */ _vm->_gyro->scrollbells = 0; cfont = roman; - _vm->_logger->log_epsonroman(); use_icon = 0; _vm->_gyro->interrogation = 0; /* always reset after a scroll comes up. */ } @@ -316,8 +291,6 @@ void Scrolls::geticon(int16 x, int16 y, byte which) { void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { Common::File f; - byte bit; - int16 fv; uint16 st; st = (y - 1) * 80 + (40 - xl / 2) + ((1 - _vm->_gyro->cp) * _vm->_gyro->pagetop); @@ -329,14 +302,15 @@ void Scrolls::block_drop(Common::String fn, int16 xl, int16 yl, int16 y) { return; } - /*for (fv = 1; fv <= yl; fv ++) - for (bit = 0; bit <= 3; bit ++) { - port[0x3c4] = 2; - port[0x3ce] = 4; - port[0x3c5] = 1 << bit; - port[0x3cf] = bit; - blockread(f, mem[0xa000 * st + (fv * 80)], xl); - } + /*byte bit; + for (uint16 fv = 1; fv <= yl; fv++) + for (bit = 0; bit <= 3; bit++) { + port[0x3c4] = 2; + port[0x3ce] = 4; + port[0x3c5] = 1 << bit; + port[0x3cf] = bit; + blockread(f, mem[0xa000 * st + (fv * 80)], xl); + } bit = getpixel(0, 0);*/ warning("STUB: Scrolls::block_drop()"); @@ -353,7 +327,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t //setvisualpage(cp); //setactivepage(1 - cp); _vm->_gyro->oncandopageswap = false; /* On can now no longer swap pages. So we can do what we want without its interference! */ - _vm->_logger->log_epsonroman(); /* Scrolls always START with Roman. */ lx = 0; ly = (_vm->_gyro->scrolln) * 6; @@ -459,7 +432,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t else say(mx + icon_indent, my, _vm->_gyro->scroll[b]); - _vm->_logger->log_scrollendline(centre); my += 12; } @@ -474,7 +446,6 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t undodgem(); _vm->_gyro->dropsok = true; - _vm->_logger->log_divider(); //setvisualpage(cp); //mousepage(cp); CursorMan.showMouse(false); @@ -493,9 +464,8 @@ void Scrolls::drawscroll(func2 gotoit) { // This is one of the oldest procs in t void Scrolls::bubble(func2 gotoit) { int16 xl, yl, my, xw, yw; - byte fv; Common::Point p[3]; - byte *rp1, *rp2; /* replace: 1=bubble, 2=pointer */ +// byte *rp1, *rp2; /* replace: 1=bubble, 2=pointer */ int16 xc; /* x correction */ /*setvisualpage(cp); @@ -507,7 +477,7 @@ void Scrolls::bubble(func2 gotoit) { xl = 0; yl = _vm->_gyro->scrolln * 5; - for (int8 fv = 0; fv < _vm->_gyro->scrolln; fv++) { + for (byte fv = 0; fv < _vm->_gyro->scrolln; fv++) { uint16 textWidth = _vm->_gyro->scroll[fv].size() * 8; if (textWidth > xl) xl = textWidth; @@ -556,17 +526,12 @@ void Scrolls::bubble(func2 gotoit) { // Draw the text of the bubble. The centering of the text was improved here compared to Pascal's settextjustify(). // The font is not the same that outtextxy() uses in Pascal. I don't have that, so I used Gyro::characters instead. // It's almost the same, only notable differences are '?', '!', etc. - for (fv = 0; fv < _vm->_gyro->scrolln; fv++) { + for (byte fv = 0; fv < _vm->_gyro->scrolln; fv++) { int16 x = xc + _vm->_gyro->talkx - _vm->_gyro->scroll[fv].size() / 2 * 8; bool offset = _vm->_gyro->scroll[fv].size() % 2; _vm->_graphics->drawText(_vm->_graphics->_scrolls, _vm->_gyro->scroll[fv], _vm->_gyro->characters, 8, x - offset * 4, (fv * 10) + 12, _vm->_gyro->talkf); } - for (fv = 0; fv < _vm->_gyro->scrolln; fv++) /* These should be separate loops. */ - _vm->_logger->log_bubbleline(fv, param, _vm->_gyro->scroll[fv]); - - _vm->_logger->log_divider(); - //setvisualpage(1 - cp); dingdongbell(); _vm->_gyro->oncandopageswap = false; @@ -594,7 +559,7 @@ bool Scrolls::ask(Common::String question) { void Scrolls::resetscroll() { _vm->_gyro->scrolln = 1; - for (int j = 0; j < 15; j ++) + for (int j = 0; j < 15; j++) if (!_vm->_gyro->scroll[j].empty()) _vm->_gyro->scroll[j].clear(); } @@ -654,7 +619,7 @@ void Scrolls::calldrivers() { char nnn; bool mouthnext; bool call_spriterun; // Only call sprite_run the FIRST time. - bool was_virtual; // Was the mouse cursor virtual on entry to this proc? +// bool was_virtual; // Was the mouse cursor virtual on entry to this proc? //nosound(); @@ -736,7 +701,7 @@ void Scrolls::calldrivers() { _vm->_gyro->talky = _vm->_gyro->peds[_vm->_gyro->quasipeds[param - 10].whichped - 1].y; // Position. _vm->_gyro->talkf = _vm->_gyro->quasipeds[param - 10].fgc; - _vm->_gyro->talkb = _vm->_gyro->quasipeds[param - 10].bgc; // Colours. + _vm->_gyro->talkb = _vm->_gyro->quasipeds[param - 10].bgc; // Colors. } else { _vm->_lucerna->errorled(); // Not valid. natural(); @@ -794,7 +759,7 @@ void Scrolls::calldrivers() { nn = 1; for (nnn = 0; nnn < numobjs; nnn++) if (_vm->_gyro->dna.obj[nnn]) { - nn ++; + nn++; display(_vm->_gyro->get_better(nnn) + ", " + kControlToBuffer); } } diff --git a/engines/avalanche/sequence2.cpp b/engines/avalanche/sequence2.cpp index 68a8ea33e3..d5983c8784 100644 --- a/engines/avalanche/sequence2.cpp +++ b/engines/avalanche/sequence2.cpp @@ -45,7 +45,7 @@ Sequence::Sequence(AvalancheEngine *vm) { void Sequence::first_show(byte what) { /* First, we need to blank out the entire array. */ - for (int i = 0; i < sizeof(seq); i++) + for (uint i = 0; i < sizeof(seq); i++) seq[i] = 0; /* Then it's just the same as then_show. */ @@ -54,7 +54,7 @@ void Sequence::first_show(byte what) { } void Sequence::then_show(byte what) { - for (byte fv = 0; fv < seq_length; fv++) { + for (int16 fv = 0; fv < seq_length; fv++) { if (seq[fv] == 0) { seq[fv] = what; return; diff --git a/engines/avalanche/trip6.cpp b/engines/avalanche/trip6.cpp index f25a313095..9f494db175 100644 --- a/engines/avalanche/trip6.cpp +++ b/engines/avalanche/trip6.cpp @@ -53,8 +53,7 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { _tr = tr; const int32 idshould = -1317732048; - int16 gd, gm; - byte fv/*,nds*/; + byte fv; int32 id; Common::File inf; @@ -111,7 +110,7 @@ void triptype::init(byte spritenum, bool do_check, Trip *tr) { //getmem(sil[totalnum-1], 11 * (a.yl + 1)); _info.mani[totalnum] = new manitype[_info.size - 6]; //getmem(mani[totalnum-1], a.size - 6); - for (fv = 0; fv <= _info.yl; fv ++) + for (fv = 0; fv <= _info.yl; fv++) inf.read((*_info.sil[totalnum])[fv], _info.xw); //blockread(inf, (*sil[totalnum-1])[fv], xw); inf.read(*_info.mani[totalnum], _info.size - 6); @@ -272,10 +271,10 @@ void triptype::bounce() { _tr->_vm->_gyro->oncandopageswap = true; } -int8 triptype::sgn(int16 x) { - if (x > 0) +int8 triptype::sgn(int16 val) { + if (val > 0) return 1; - else if (x < 0) + else if (val < 0) return -1; else return 0; @@ -418,22 +417,17 @@ void triptype::load_data_from_mem(uint16 &where) { } triptype *triptype::done() { - int16 gd, gm; Common::String xx; - byte fv/*,nds*/; - byte aa, bb; - int32 id; - uint16 soa; /* nds:=num div seq;*/ totalnum--; _info.xw = _info.xl / 8; if ((_info.xl % 8) > 0) _info.xw++; - for (aa = 0; aa < /*nds*seq*/ a.num; aa++) { + for (byte aa = 0; aa < /*nds*seq*/ a.num; aa++) { totalnum--; - delete _info.mani[totalnum]; - delete _info.sil[totalnum]; + delete[] _info.mani[totalnum]; + delete[] _info.sil[totalnum]; } quick = false; @@ -441,13 +435,8 @@ triptype *triptype::done() { return this; } - - - - - getsettype *getsettype::init() { - numleft = 0; /* initialise array pointer */ + numleft = 0; /* initialize array pointer */ return this; } @@ -476,12 +465,10 @@ Trip::Trip(AvalancheEngine *vm) { } void Trip::loadtrip() { - byte gm; - - for (gm = 0; gm < numtr; gm++) + for (int16 gm = 0; gm < numtr; gm++) tr[gm].original(); - for (int i = 0; i < sizeof(aa); i++) + for (uint16 i = 0; i < sizeof(aa); i++) aa[i] = 0; } @@ -528,6 +515,8 @@ byte Trip::geida_ped(byte which) { return 9; case 4: return 10; + default: + return 0; } } @@ -538,7 +527,7 @@ void Trip::catamove(byte ped) { int32 here; uint16 xy_uint16; - byte fv, ff; + byte fv; /* XY_uint16 is cat_x+cat_y*256. Thus, every room in the catacombs has a different number for it. */ @@ -954,7 +943,7 @@ void Trip::call_special(uint16 which) { } } _vm->_lucerna->dusk(); - _vm->_gyro->dna.cat_y --; + _vm->_gyro->dna.cat_y--; catamove(4); if (_vm->_gyro->dna.room != r__catacombs) return; @@ -1088,13 +1077,13 @@ void Trip::newspeed() { //setactivepage(1 - cp); - for (page_ = 0; page_ <= 1; page_ ++) + for (page_ = 0; page_ <= 1; page_++) getset[page_].remember(lightspace); } -void Trip::rwsp(byte t, byte r) { - switch (r) { +void Trip::rwsp(byte t, byte dir) { + switch (dir) { case up: tr[t].speed(0, -tr[t].ys); break; @@ -1145,7 +1134,6 @@ bool Trip::overlaps_with_mouse() { } void Trip::getback() { - byte fv; bool endangered; @@ -1213,8 +1201,6 @@ void Trip::face_avvy(byte tripnum) { } void Trip::arrow_procs(byte tripnum) { - byte fv; - if (tr[tripnum].homing) { /* Arrow is still in flight. */ /* We must check whether or not the arrow has collided tr[tripnum] Avvy's head. @@ -1232,7 +1218,7 @@ void Trip::arrow_procs(byte tripnum) { /* tr[1].done; { Deallocate normal pic of Avvy. } off; - for fv:=0 to 1 do + for byte fv:=0 to 1 do begin cp:=1-cp; getback; @@ -1267,11 +1253,8 @@ begin end;*/ void Trip::grab_avvy(byte tripnum) { /* For Friar Tuck, in Nottingham. */ - byte fv; - int16 tox, toy; - - tox = tr[0].x + 17; - toy = tr[0].y - 1; + int16 tox = tr[0].x + 17; + int16 toy = tr[0].y - 1; if ((tr[tripnum].x == tox) && (tr[tripnum].y == toy)) { tr[tripnum].call_eachstep = false; tr[tripnum].face = left; @@ -1319,7 +1302,7 @@ void Trip::spin(byte whichway, byte &tripnum) { void Trip::geida_procs(byte tripnum) { if (_vm->_gyro->dna.geida_time > 0) { - _vm->_gyro->dna.geida_time --; + _vm->_gyro->dna.geida_time--; if (_vm->_gyro->dna.geida_time == 0) _vm->_gyro->dna.geida_spin = 0; } @@ -1471,7 +1454,7 @@ void Trip::getsetclear() { } void Trip::hide_in_the_cupboard() { - const char nowt = 250; /* As in Acci. */ + const char nowt = '\xFA'; /* As in Acci. */ if (_vm->_gyro->dna.avvys_in_the_cupboard) { if (_vm->_gyro->dna.wearing == nowt) @@ -1661,6 +1644,8 @@ void Trip::handleMoveKey(const Common::Event &event) { case Common::KEYCODE_KP5: stopwalking(); break; + default: + break; } } diff --git a/engines/avalanche/trip6.h b/engines/avalanche/trip6.h index cc13c9bf75..1f2b83d009 100644 --- a/engines/avalanche/trip6.h +++ b/engines/avalanche/trip6.h @@ -44,7 +44,7 @@ struct adxtype { /* Second revision of ADX type */ Common::String comment/*[17]*/; /* comment */ // uruk: Same here, but 16. byte num; /* number of pictures */ byte seq; /* how many in one stride */ - byte fgc, bgc; /* foreground & background bubble colours */ + byte fgc, bgc; /* foreground & background bubble colors */ byte accinum; /* the number according to Acci (1=Avvy, etc.) */ }; @@ -121,7 +121,7 @@ private: bool collision_check(); - int8 sgn(int16 x); + int8 sgn(int16 val); }; @@ -145,8 +145,8 @@ public: class Trip { public: - friend triptype; - friend getsettype; + friend class triptype; + friend class getsettype; @@ -198,7 +198,7 @@ public: void tripkey(char dir); - void rwsp(byte t, byte r); + void rwsp(byte t, byte dir); void apped(byte trn, byte np); |