diff options
author | Strangerke | 2013-09-16 01:15:47 +0200 |
---|---|---|
committer | Strangerke | 2013-09-16 01:15:47 +0200 |
commit | 9d259d0a07f0aefc4488eb2306560760cc486354 (patch) | |
tree | d7f0cf9fdf243276f7ae2bca79dfe54b713a7864 | |
parent | 23ba373c9145060c3e766d56f845382a3e7c6ea6 (diff) | |
download | scummvm-rg350-9d259d0a07f0aefc4488eb2306560760cc486354.tar.gz scummvm-rg350-9d259d0a07f0aefc4488eb2306560760cc486354.tar.bz2 scummvm-rg350-9d259d0a07f0aefc4488eb2306560760cc486354.zip |
AVALANCHE: fix index in loadMouse, misc cleanup
-rw-r--r-- | engines/avalanche/acci.cpp | 112 | ||||
-rw-r--r-- | engines/avalanche/animation.cpp | 5 | ||||
-rw-r--r-- | engines/avalanche/dropdown.cpp | 71 | ||||
-rw-r--r-- | engines/avalanche/gyro.cpp | 23 | ||||
-rw-r--r-- | engines/avalanche/lucerna.cpp | 20 | ||||
-rw-r--r-- | engines/avalanche/parser.cpp | 3 | ||||
-rw-r--r-- | engines/avalanche/scrolls.cpp | 40 |
7 files changed, 120 insertions, 154 deletions
diff --git a/engines/avalanche/acci.cpp b/engines/avalanche/acci.cpp index 3f78b16cbe..ba8dbbdef9 100644 --- a/engines/avalanche/acci.cpp +++ b/engines/avalanche/acci.cpp @@ -495,20 +495,17 @@ bool Acci::doPronouns() { for (byte i = 0; i < _thats.size(); i++) { byte wordCode = _thats[i]; switch (wordCode) { - case 200: { + case 200: displayWhat(_vm->_gyro->_him, true, ambiguous); _thats.setChar(_vm->_gyro->_him, i); - } break; - case 201: { + case 201: displayWhat(_vm->_gyro->_her, true, ambiguous); _thats.setChar(_vm->_gyro->_her, i); - } break; - case 202: { + case 202: displayWhat(_vm->_gyro->_it, false, ambiguous); _thats.setChar(_vm->_gyro->_it, i); - } break; } } @@ -1735,31 +1732,31 @@ void Acci::doThat() { break; case Gyro::kObjectClothes: case Gyro::kObjectHabit: { // Change this! - if (_vm->_gyro->_wearing != kNothing) { - if (_vm->_gyro->_wearing == _thing) - _vm->_scrolls->displayText("You're already wearing that."); - else - _vm->_scrolls->displayText("You'll be rather warm wearing two sets of clothes!"); - return; - } else - _vm->_gyro->_wearing = _thing; + if (_vm->_gyro->_wearing != kNothing) { + if (_vm->_gyro->_wearing == _thing) + _vm->_scrolls->displayText("You're already wearing that."); + else + _vm->_scrolls->displayText("You'll be rather warm wearing two sets of clothes!"); + return; + } else + _vm->_gyro->_wearing = _thing; - _vm->_lucerna->refreshObjectList(); + _vm->_lucerna->refreshObjectList(); - byte i; - if (_thing == Gyro::kObjectHabit) - i = 3; - else - i = 0; - Avalanche::AnimationType *spr = &_vm->_animation->_sprites[0]; - if (spr->_id != i) { - int16 x = spr->_x; - int16 y = spr->_y; - spr->remove(); - spr->init(i, true, _vm->_animation); - spr->appear(x, y, Animation::kDirLeft); - spr->_visible = false; - } + byte i; + if (_thing == Gyro::kObjectHabit) + i = 3; + else + i = 0; + Avalanche::AnimationType *spr = &_vm->_animation->_sprites[0]; + if (spr->_id != i) { + int16 x = spr->_x; + int16 y = spr->_y; + spr->remove(); + spr->init(i, true, _vm->_animation); + spr->appear(x, y, Animation::kDirLeft); + spr->_visible = false; + } } break; default: @@ -1770,40 +1767,39 @@ void Acci::doThat() { case kVerbCodePlay: if (_thing == kPardon) { switch (_vm->_gyro->_room) { // They just typed "play"... - case kRoomArgentPub: { // ...in the pub, => play Nim. - warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); - // play_nim(); - // The following parts are copied from play_nim(). - // The player automatically wins the game everytime he wins, until I implement the mini-game. - - if (_vm->_gyro->_wonNim) { // Already won the game. - _vm->_scrolls->displayScrollChain('Q', 6); - return; - } + case kRoomArgentPub: // ...in the pub, => play Nim. + warning("STUB: Acci::doThat() - case kVerbCodeplay - play_nim()"); + // play_nim(); + // The following parts are copied from play_nim(). + // The player automatically wins the game everytime he wins, until I implement the mini-game. + + if (_vm->_gyro->_wonNim) { // Already won the game. + _vm->_scrolls->displayScrollChain('Q', 6); + return; + } - if (!_vm->_gyro->_askedDogfoodAboutNim) { - _vm->_scrolls->displayScrollChain('q', 84); - return; - } + if (!_vm->_gyro->_askedDogfoodAboutNim) { + _vm->_scrolls->displayScrollChain('q', 84); + return; + } - _vm->_scrolls->displayScrollChain('Q', 3); - _vm->_gyro->_playedNim++; + _vm->_scrolls->displayScrollChain('Q', 3); + _vm->_gyro->_playedNim++; - // You won - strange! - _vm->_scrolls->displayScrollChain('Q', 7); // You won! Give us a lute! - _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; - _vm->_lucerna->refreshObjectList(); - _vm->_gyro->_wonNim = true; - _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it. - _vm->_lucerna->incScore(7); // 7 points for winning! + // You won - strange! + _vm->_scrolls->displayScrollChain('Q', 7); // You won! Give us a lute! + _vm->_gyro->_objects[Gyro::kObjectLute - 1] = true; + _vm->_lucerna->refreshObjectList(); + _vm->_gyro->_wonNim = true; + _vm->_celer->drawBackgroundSprite(-1, -1, 1); // Show the settle with no lute on it. + _vm->_lucerna->incScore(7); // 7 points for winning! - if (_vm->_gyro->_playedNim == 1) - _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. + if (_vm->_gyro->_playedNim == 1) + _vm->_lucerna->incScore(3); // 3 points for playing your 1st game. - // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! - _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") - + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Peter (uruk)"); - } + // A warning to the player that there should have been a mini-game. TODO: Remove it later!!! + _vm->_scrolls->displayText(Common::String("P.S.: There should have been the mini-game called \"Nim\", but I haven't implemented it yet: you win and get the lute automatically.") + + Scrolls::kControlNewLine + Scrolls::kControlNewLine + "Peter (uruk)"); break; case kRoomMusicRoom: playHarp(); diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 2baa232c56..f3076da63a 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -656,7 +656,7 @@ void Animation::catacombMove(byte ped) { // ARCHWAYS: case 0x7: case 0x8: - case 0x9: { + case 0x9: _vm->_celer->drawBackgroundSprite(-1, -1, 6); if (((here & 0xf000) >> 12) > 0x7) @@ -666,8 +666,7 @@ void Animation::catacombMove(byte ped) { _vm->_gyro->_magics[0]._operation = Gyro::kMagicSpecial; // Middle arch north. _vm->_gyro->_portals[3]._operation = Gyro::kMagicNothing; // Door. - } - break; + break; // DECORATIONS: case 0xd: // No connection + WINDOW _vm->_gyro->_magics[0]._operation = Gyro::kMagicBounce; diff --git a/engines/avalanche/dropdown.cpp b/engines/avalanche/dropdown.cpp index 4c5afe5731..c43a5b0852 100644 --- a/engines/avalanche/dropdown.cpp +++ b/engines/avalanche/dropdown.cpp @@ -399,10 +399,9 @@ void Dropdown::parseKey(char r, char re) { //case 13: // _activeMenuItem.select(_activeMenuItem._highlightNum); // break; - //default: { + //default: // if (_activeMenuItem._activeNow) // _activeMenuItem.parseKey(r); - // } //} warning("STUB: Dropdown::parseKey()"); // To be implemented properly later! Don't remove the comment above! } @@ -467,11 +466,12 @@ void Dropdown::setupMenuPeople() { _activeMenuItem.reset(); - for (byte i = 150; i <= 178; i++) + for (byte i = 150; i <= 178; i++) { if (_vm->_gyro->_whereIs[i - 150] == _vm->_gyro->_room) { _activeMenuItem.setupOption(_vm->_gyro->getName(i), _vm->_gyro->getNameChar(i), "", true); people += i; } + } _activeMenuItem.display(); } @@ -515,16 +515,14 @@ void Dropdown::setupMenuWith() { _vm->_gyro->_verbStr = Common::String(Acci::kVerbCodeExam) + Acci::kVerbCodeTalk; switch (_vm->_gyro->_thinks) { case Gyro::kPeopleGeida: - case Gyro::kPeopleArkata: { + case Gyro::kPeopleArkata: _activeMenuItem.setupOption("Kiss her", 'K', "", true); _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Acci::kVerbCodeKiss; - } - break; - case Gyro::kPeopleDogfood: { + break; + case Gyro::kPeopleDogfood: _activeMenuItem.setupOption("Play his game", 'P', "", !_vm->_gyro->_wonNim); // True if you HAVEN'T won. _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + Acci::kVerbCodePlay; - } - break; + break; case Gyro::kPeopleMalagauche: { bool isSober = !_vm->_gyro->_teetotal; _activeMenuItem.setupOption("Buy some wine", 'w', "", !_vm->_gyro->_objects[Gyro::kObjectWine - 1]); @@ -533,13 +531,12 @@ void Dropdown::setupMenuWith() { _activeMenuItem.setupOption("Buy some cider", 'c', "", isSober); _activeMenuItem.setupOption("Buy some mead", 'm', "", isSober); _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 101 + 100 + 102 + 103 + 104; - } - break; - case Gyro::kPeopleTrader: { + } + break; + case Gyro::kPeopleTrader: _activeMenuItem.setupOption("Buy an onion", 'o', "", !_vm->_gyro->_objects[Gyro::kObjectOnion - 1]); _vm->_gyro->_verbStr = _vm->_gyro->_verbStr + 105; - } - break; + break; } } _activeMenuItem.display(); @@ -572,18 +569,16 @@ void Dropdown::runMenuFile() { case 0: _vm->_lucerna->callVerb(Acci::kVerbCodeRestart); break; - case 1: { + case 1: if (!_vm->_acci->_realWords[1].empty()) _vm->_acci->_realWords[1].clear(); _vm->_lucerna->callVerb(Acci::kVerbCodeLoad); - } - break; - case 2: { + break; + case 2: if (!_vm->_acci->_realWords[1].empty()) _vm->_acci->_realWords[1].clear(); _vm->_lucerna->callVerb(Acci::kVerbCodeSave); - } - break; + break; case 3: //_vm->_basher->filename_edit(); warning("STUB: Dropdown::runMenuFile()"); @@ -601,13 +596,12 @@ void Dropdown::runMenuAction() { Common::String f5Does; // Get up, pause game, open door, look, inventory, walk/run. switch (_activeMenuItem._choiceNum) { - case 0: { + case 0: _vm->_acci->_person = _vm->_acci->kPardon; _vm->_acci->_thing = _vm->_acci->kPardon; f5Does = _vm->_gyro->f5Does(); _vm->_lucerna->callVerb(f5Does[0]); - } - break; + break; case 1: _vm->_acci->_thing = _vm->_acci->kPardon; _vm->_lucerna->callVerb(Acci::kVerbCodePause); @@ -629,8 +623,8 @@ void Dropdown::runMenuAction() { else avvy->_speedX = _vm->_gyro->kWalk; _vm->_animation->updateSpeed(); - } - break; + } + break; } } @@ -657,48 +651,35 @@ void Dropdown::runMenuWith() { } else { switch (_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]) { - case 100: { // Beer + case 100: // Beer _vm->_acci->_thing = 100; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - case 101: { // Wine + case 101: // Wine _vm->_acci->_thing = 50; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - case 102: { // Whisky + case 102: // Whisky _vm->_acci->_thing = 102; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - case 103: { // Cider + case 103: // Cider _vm->_acci->_thing = 103; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - case 104: { // Mead + case 104: // Mead _vm->_acci->_thing = 107; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - case 105: { // Onion (trader) + case 105: // Onion (trader) _vm->_acci->_thing = 67; _vm->_lucerna->callVerb(Acci::kVerbCodeBuy); return; - } - break; - default: { + default: _vm->_acci->_person = _vm->_acci->_thing; _vm->_acci->_thing = Acci::kPardon; _vm->_gyro->_subjectNum = 0; } - } } _vm->_lucerna->callVerb(_vm->_gyro->_verbStr[_activeMenuItem._choiceNum]); } diff --git a/engines/avalanche/gyro.cpp b/engines/avalanche/gyro.cpp index 601adeed4f..a0403c0bb6 100644 --- a/engines/avalanche/gyro.cpp +++ b/engines/avalanche/gyro.cpp @@ -198,7 +198,7 @@ void Gyro::newMouse(byte id) { return; _currentMouse = id; - loadMouse(id); + loadMouse(id - 1); } /** @@ -550,35 +550,40 @@ void Gyro::loadMouse(byte which) { // The AND mask. - f.seek(kMouseSize * 2 * (which - 1) + 134); + f.seek(kMouseSize * 2 * which + 134); ::Graphics::Surface mask = _vm->_graphics->loadPictureGraphic(f); - for (byte j = 0; j < mask.h; j++) - for (byte i = 0; i < mask.w; i++) - for (byte k = 0; k < 2; k++) + for (byte j = 0; j < mask.h; j++) { + for (byte i = 0; i < mask.w; i++) { + for (byte k = 0; k < 2; k++) { if (*(byte *)mask.getBasePtr(i, j) == 0) *(byte *)cursor.getBasePtr(i, j * 2 + k) = 0; + } + } + } mask.free(); // The OR mask. - f.seek(kMouseSize * 2 * (which - 1) + 134 * 2); + f.seek(kMouseSize * 2 * which + 134 * 2); mask = _vm->_graphics->loadPictureGraphic(f); - for (byte j = 0; j < mask.h; j++) - for (byte i = 0; i < mask.w; i++) + for (byte j = 0; j < mask.h; j++) { + for (byte i = 0; i < mask.w; i++) { for (byte k = 0; k < 2; k++) { byte pixel = *(byte *)mask.getBasePtr(i, j); if (pixel != 0) *(byte *)cursor.getBasePtr(i, j * 2 + k) = pixel; } + } + } mask.free(); f.close(); - CursorMan.replaceCursor(cursor.getPixels(), 16, 32, kMouseHotSpots[which - 1]._horizontal, kMouseHotSpots[which - 1]._vertical * 2, 255, false); + CursorMan.replaceCursor(cursor.getPixels(), 16, 32, kMouseHotSpots[which]._horizontal, kMouseHotSpots[which]._vertical * 2, 255, false); cursor.free(); } diff --git a/engines/avalanche/lucerna.cpp b/engines/avalanche/lucerna.cpp index 5ba0e70bc9..0450ea9f36 100644 --- a/engines/avalanche/lucerna.cpp +++ b/engines/avalanche/lucerna.cpp @@ -387,7 +387,7 @@ void Lucerna::enterNewTown() { if ((_vm->_gyro->_roomCount[kRoomRobins] > 0) && (_vm->_gyro->_beenTiedUp) && (!_vm->_gyro->_takenMushroom)) _vm->_gyro->_mushroomGrowing = true; break; - case kRoomWiseWomans: { // Entry into Argent. + case kRoomWiseWomans: // Entry into Argent. if (_vm->_gyro->_talkedToCrapulus && (!_vm->_gyro->_lustieIsAsleep)) { _vm->_gyro->_spludwickAtHome = !((_vm->_gyro->_roomCount[kRoomWiseWomans] % 3) == 1); _vm->_gyro->_crapulusWillTell = !_vm->_gyro->_spludwickAtHome; @@ -397,8 +397,7 @@ void Lucerna::enterNewTown() { } if (_vm->_gyro->_boxContent == Gyro::kObjectWine) _vm->_gyro->_wineState = 3; // Vinegar - } - break; + break; } if (_vm->_gyro->_room != kRoomOutsideDucks) { @@ -627,21 +626,18 @@ void Lucerna::enterRoom(byte room, byte ped) { if ((ped == 0) || (ped == 3) || (ped == 5) || (ped == 6)) { switch (ped) { - case 3: { // Enter from oubliette + case 3: // Enter from oubliette _vm->_gyro->_catacombX = 8; _vm->_gyro->_catacombY = 4; - } - break; - case 5: { // Enter from du Lustie's + break; + case 5: // Enter from du Lustie's _vm->_gyro->_catacombX = 8; _vm->_gyro->_catacombY = 7; - } - break; - case 6: { // Enter from Geida's + break; + case 6: // Enter from Geida's _vm->_gyro->_catacombX = 4; _vm->_gyro->_catacombY = 1; - } - break; + break; } _vm->_gyro->_enterCatacombsFromLustiesRoom = true; diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 9be66ef1cf..e2667b1fc7 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -93,11 +93,10 @@ void Parser::handleReturn() { void Parser::handleFunctionKey(const Common::Event &event) { switch (event.kbd.keycode) { - case Common::KEYCODE_F5: { + case Common::KEYCODE_F5: _vm->_acci->_person = _vm->_acci->kPardon; _vm->_acci->_thing = _vm->_acci->kPardon; _vm->_lucerna->callVerb(_vm->_gyro->f5Does()[0]); - } break; case Common::KEYCODE_F7: _vm->_lucerna->callVerb(Acci::kVerbCodeOpen); diff --git a/engines/avalanche/scrolls.cpp b/engines/avalanche/scrolls.cpp index 26aea4bd37..3e277c997c 100644 --- a/engines/avalanche/scrolls.cpp +++ b/engines/avalanche/scrolls.cpp @@ -90,13 +90,11 @@ void Scrolls::say(int16 x, int16 y, Common::String z) { int16 i = 0; for (byte xx = 0; xx < lz; xx++) { switch (z[xx]) { - case kControlRoman: { + case kControlRoman: _currentFont = kFontStyleRoman; - } break; - case kControlItalic: { + case kControlItalic: _currentFont = kFontStyleItalic; - } break; default: { for (byte yy = 0; yy < 12; yy++) @@ -370,15 +368,13 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { case 0: iconIndent = 0; break; // No icon. - case 34: { + case 34: drawSign("about", 28, 76, 15); iconIndent = 0; - } break; - case 35: { + case 35: drawSign("gameover", 52, 59, 71); iconIndent = 0; - } break; } @@ -391,17 +387,15 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { for (byte i = 0; i < _vm->_gyro->_scrollNum; i++) { if (!_vm->_gyro->_scroll[i].empty()) switch (_vm->_gyro->_scroll[i][_vm->_gyro->_scroll[i].size() - 1]) { - case kControlCenter: { + case kControlCenter: centre = true; _vm->_gyro->_scroll[i].deleteLastChar(); - } break; - case kControlLeftJustified: { + case kControlLeftJustified: centre = false; _vm->_gyro->_scroll[i].deleteLastChar(); - } break; - case kControlQuestion: { + case kControlQuestion: //settextjustify(1, 1); _shadowBoxX = mx + lx; _shadowBoxY = my + ly; @@ -410,7 +404,6 @@ void Scrolls::drawScroll(ScrollsFunctionType modeFunc) { // inc(diy,14); _vm->_gyro->drawShadowBox(_shadowBoxX - 65, _shadowBoxY - 24, _shadowBoxX - 5, _shadowBoxY - 10, "Yes."); _vm->_gyro->drawShadowBox(_shadowBoxX + 5, _shadowBoxY - 24, _shadowBoxX + 65, _shadowBoxY - 10, "No."); - } break; } @@ -618,10 +611,9 @@ void Scrolls::callScrollDriver() { case kControlSpeechBubble: case kControlQuestion: break; // ^B = speech (B)ubble, ^Q = (Q)uestion in dialogue box - default: { + default: + _vm->_gyro->_buffer[_vm->_gyro->_bufSize] = kControlParagraph; _vm->_gyro->_bufSize++; - _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = kControlParagraph; - } } uint16 size = _vm->_gyro->_bufSize; @@ -638,7 +630,7 @@ void Scrolls::callScrollDriver() { mouthnext = false; } else { switch (_vm->_gyro->_buffer[i]) { - case kControlParagraph: { + case kControlParagraph: if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) break; @@ -652,12 +644,11 @@ void Scrolls::callScrollDriver() { if (_vm->_gyro->_scReturn) return; - } - break; + break; case kControlBell: _vm->_gyro->_scrollBells++; break; // #7 = "Bel" - case kControlSpeechBubble: { + case kControlSpeechBubble: if ((_vm->_gyro->_scrollNum == 1) && (_vm->_gyro->_scroll[0].empty())) break; @@ -695,8 +686,7 @@ void Scrolls::callScrollDriver() { if (_vm->_gyro->_scReturn) return; - } - break; + break; // CHECME: The whole kControlNegative block seems completely unused, as the only use (the easter egg check) is a false positive case kControlNegative: @@ -760,8 +750,8 @@ void Scrolls::callScrollDriver() { _vm->_lucerna->spriteRun(); call_spriterun = false; + _vm->_gyro->_scroll[_vm->_gyro->_scrollNum] = kControlQuestion; _vm->_gyro->_scrollNum++; - _vm->_gyro->_scroll[_vm->_gyro->_scrollNum - 1] = kControlQuestion; drawScroll(&Avalanche::Scrolls::scrollModeDialogue); resetScroll(); @@ -834,8 +824,8 @@ void Scrolls::unSkrimble() { } void Scrolls::doTheBubble() { + _vm->_gyro->_buffer[_vm->_gyro->_bufSize] = 2; _vm->_gyro->_bufSize++; - _vm->_gyro->_buffer[_vm->_gyro->_bufSize - 1] = 2; } /** |