/* 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 3 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, see . * */ #include "darkseed/darkseed.h" #include "darkseed/usecode.h" #include "darkseed/usecode_tos_tables.h" #include "common/debug.h" namespace Darkseed { UseCode::UseCode(Console *console, Player *player, Objects &objectVar, Inventory &inventory) : _console(console), _player(player), _objectVar(objectVar), _inventory(inventory) {} int Darkseed::UseCode::getHandDescriptionTosIdx(uint16 objNum) { if (objNum >= Objects::MAX_OBJECTS) { error("getHandDescriptionTosIdx: Object Index out of range! %d", objNum); } return handDescriptionsTbl[objNum]; } int16 Darkseed::UseCode::getUseGlovesTosIdx(uint16 objNum) { if (objNum >= Objects::MAX_OBJECTS) { error("getUseGlovesTosIdx: Object Index out of range! %d", objNum); } return glovesTextTbl[objNum]; } int16 Darkseed::UseCode::getUseMoneyTosIdx(uint16 objNum) { if (objNum >= Objects::MAX_OBJECTS) { error("getUseMoneyTosIdx: Object Index out of range! %d", objNum); } return moneyTextTbl[objNum]; } int16 Darkseed::UseCode::getUseCrowbarTosIdx(uint16 objNum) { if (objNum >= Objects::MAX_OBJECTS) { error("getUseCrowbarTosIdx: Object Index out of range! %d", objNum); } return crowBarTextTbl[objNum]; } int16 Darkseed::UseCode::getUseJournalTosIdx(uint16 objNum) { if (objNum >= Objects::MAX_OBJECTS) { error("getUseJournalTosIdx: Object Index out of range! %d", objNum); } return journalTextTbl[objNum]; } int16 Darkseed::UseCode::getUseLibraryCardTosIdx(uint16 objNum) { if (objNum >= Objects::MAX_OBJECTS) { error("getUseLibraryCardTosIdx: Object Index out of range! %d", objNum); } return libraryCardTextTbl[objNum]; } void Darkseed::UseCode::useCode(int objNum) { debug("useCode: objNum = %d", objNum); if (objNum == 141) { _console->addTextLine("You touch Delbert..."); return; } if (objNum == 189) { _console->addTextLine("You touch the cold iron bars."); return; } if (objNum == 42) { switch(_objectVar[42]) { case 0: _console->printTosText(653); break; case 1: _console->printTosText(655); _objectVar[42] = 0; break; case 2: _console->printTosText(660); _inventory.addItem(6); _objectVar[42] = 3; break; case 3: _console->printTosText(655); _objectVar[42] = 4; break; case 4: _console->printTosText(653); } return; } if (objNum == 9) { g_engine->_room->_collisionType = 0; g_engine->_room->removeObjectFromRoom(9); _objectVar.setMoveObjectRoom(9, 100); g_engine->showFullscreenPic(g_engine->isCdVersion() ? "paper_c.pic" : "paper-c.pic"); return; } if (objNum == 35) { _objectVar[35] = 3600; } if (objNum == 47) { _player->loadAnimations("phone.nsp"); if (_objectVar.getObjectRunningCode(47) == 0) { g_engine->setupOtherNspAnimation(2,63); } else { g_engine->setupOtherNspAnimation(0,8); } _player->_direction = 3; } if (objNum == 194) { if (_objectVar[53] == 2) { _console->printTosText(948); for (int i = 0; i < Objects::MAX_MOVED_OBJECTS; i++) { if (_objectVar.getMoveObjectRoom(i) == 252) { _objectVar.setMoveObjectRoom(i, 254); _inventory.addItem(i); } } _objectVar[53] = 3; } else { _console->printTosText(566); } return; } if (objNum == 113) { bool foundMatch = false; for (int i = 0; i < Objects::MAX_MOVED_OBJECTS; i++) { if (_objectVar.getMoveObjectRoom(i) == 250) { _objectVar.setMoveObjectRoom(i, 254); _inventory.addItem(i); foundMatch = true; } } if (foundMatch) { _objectVar[113] = 0; _console->printTosText(948); } else { _console->printTosText(751); } } if (objNum == 123) { if (g_engine->_currentTimeInSeconds < 61200) { _console->printTosText(119); } else { _player->loadAnimations("bedsleep.nsp"); g_engine->setupOtherNspAnimation(1, 5); } return; } if (objNum == 71 && _objectVar[71] == 2) { // car ignition _objectVar[71] = 0; _console->printTosText(949); _inventory.addItem(26); return; } if ((162 < objNum) && (objNum < 169)) { g_engine->playSound(47,5,-1); } if (objNum == 175) { g_engine->playSound(39,5,-1); // while (iVar2 = VOCPlaying(), iVar2 != 0) { // VOCPoll(); // } _console->printTosText(719); return; } if (objNum == 187) { if (_objectVar[187] == 0) { _console->printTosText(856); g_engine->setupOtherNspAnimation(0, 60); } else { g_engine->setupOtherNspAnimation(1, 61); } return; } if (objNum == 137 || objNum == 30) { if (_objectVar[30] == 0) { _objectVar[30] = 1; g_engine->_room->_collisionType = 0; g_engine->_room->removeObjectFromRoom(30); _objectVar.setMoveObjectRoom(30, 100); g_engine->showFullscreenPic(g_engine->isCdVersion() ? "note_c.pic" : "note-c.pic"); } else { _console->printTosText(296); } return; } if (g_engine->_room->_roomNumber == 21 && objNum == 12) { if (_objectVar[12] == 0 && _objectVar[10] == 1) { _objectVar[12] = 1; _inventory.addItem(12); _console->printTosText(568); } else { _console->printTosText(566); } return; } if (objNum == 46) { if (_objectVar[46] == 1) { g_engine->setupOtherNspAnimation(0,19); } else { _console->printTosText(539); } return; } if (objNum != 7 && objNum != 36 && objNum != 37 && objNum != 38 && objNum != 39 && objNum != 40) { int handTosIdx = getHandDescriptionTosIdx(objNum); if (handTosIdx != 0 && handTosIdx < 979) { _console->printTosText(handTosIdx); } else if (handTosIdx > 978) { // TODO genericresponse } if (objNum == 80) { _console->printTosText(553 + (_objectVar[80] & 1)); _objectVar[80] = (_objectVar[80] & 2) + ((_objectVar[80] & 1) == 0 ? 1 : 0); return; } if ((objNum == 59 || objNum == 78) && _objectVar[34] == 0) { return; } if (objNum == 100) { if (_objectVar[100] == 0 || _objectVar[100] == 1 || _objectVar[100] == 3) { _console->printTosText(140); } else if (_objectVar[100] == 2) { _objectVar[100] = 3; _inventory.addItem(10); _objectVar[10] = 254; _console->printTosText(142); } return; } if (objNum == 114) { gancanim(); return; } if ((objNum == 28) && (_objectVar[28] == 2)) { _console->addTextLine("The sergeant says 'Nice gun eh? It's a Browning'"); return; } if (objNum > 103 && objNum < 111) { if (objNum < 110) { _player->loadAnimations("opendrwr.nsp"); if (objNum == 108) { if (_objectVar[108] == 0) { _console->printTosText(383); } else { _console->printTosText(385); } g_engine->setupOtherNspAnimation(0, 52); } else { if (_objectVar[objNum] == 0) { _console->printTosText(371); } else { _console->printTosText(373); } g_engine->setupOtherNspAnimation(0,objNum - 56); } } else { if (_objectVar[objNum] == 0) { _console->printTosText(389); } else { _console->printTosText(391); } _objectVar[objNum] = _objectVar[objNum] == 0 ? 1 : 0; } return; } if (objNum == 111) { // tap _player->loadAnimations("aspirin.nsp"); g_engine->setupOtherNspAnimation(0,30); _console->printTosText(242); return; } if (objNum == 112) { // mirror cabinet _player->loadAnimations("aspirin.nsp"); g_engine->setupOtherNspAnimation(2,32); return; } if (objNum > 30 && objNum < 34) { g_engine->_room->removeObjectFromRoom(objNum); g_engine->getPackageObj(objNum - 30); return; } if ((objNum == 14) && (_objectVar[86] == 0)) { _objectVar[86] = 1; return; } if ((objNum == 102) && (_objectVar[23] == 1)) { _player->loadAnimations("slide.nsp"); g_engine->setupOtherNspAnimation(1, 26); return; } if (objNum == 101) { switch(_objectVar[101]) { case 0: _player->loadAnimations("opendoor.nsp"); g_engine->setupOtherNspAnimation(0,65); g_engine->playSound(31,5,-1); _objectVar[101] = 1; _console->printTosText(733); break; case 1: _player->loadAnimations("opendoor.nsp"); g_engine->setupOtherNspAnimation(0,65); g_engine->playSound(31,5,-1); _objectVar[101] = 0; _console->printTosText(737); break; case 2: _inventory.addItem(5); _console->printTosText(950); _objectVar[101] = 3; return; case 3: _player->loadAnimations("opendoor.nsp"); g_engine->setupOtherNspAnimation(0,65); g_engine->playSound(31,5,-1); _objectVar[101] = 4; _console->printTosText(737); break; case 4: _player->loadAnimations("opendoor.nsp"); g_engine->setupOtherNspAnimation(0,65); g_engine->playSound(31,5,-1); _objectVar[101] = 3; _console->printTosText(733); break; default: break; } } if (objNum == 81) { if (_objectVar[81] == 0) { _console->printTosText(951); for (int i = 0; i < Objects::MAX_MOVED_OBJECTS; i++) { if (_objectVar.getMoveObjectRoom(i) == 251) { _objectVar.setMoveObjectRoom(i, 254); _inventory.addItem(i); } } _objectVar[81] = 1; } else { _console->printTosText(952); } return; } if (objNum == 25) { if (1 < _objectVar[80]) { if (_objectVar[25] == 0) { _objectVar[25] = 1; _console->printTosText(953); _inventory.addItem(25); } else if (_objectVar[25] == 2) { _objectVar[26] = 1; _console->printTosText(954); _inventory.addItem(26); _objectVar[25] = _objectVar[25] + 1; } else if (_objectVar[25] == 1 || _objectVar[25] == 3 || _objectVar[25] == 101 || _objectVar[25] == 103) { _console->printTosText(694); } } return; } if (objNum < 42 && objNum != 22 && (objNum != 7 || _objectVar[7] == 1) && objNum != 31 && objNum != 33 && objNum != 32 && objNum != 86) { _console->printTosText(955); // "You pick up the " _console->addToCurrentLine(Common::String::format("%s.", _objectVar.getObjectName(objNum))); _inventory.addItem(objNum); g_engine->_room->_collisionType = 0; if (((objNum != 25) || (_objectVar[25] == 1)) || (_objectVar[25] == 101)) { g_engine->_room->removeObjectFromRoom(objNum); } _objectVar.setMoveObjectRoom(objNum, 254); if (objNum == 28) { _objectVar[28] = 1; } } else if (objNum == 86) { _objectVar[86] = _objectVar[86] == 0 ? 1 : 0; g_engine->playSound(42,5,-1); } else if (objNum == 22) { if (_objectVar[22] < 4) { _player->loadAnimations("push.nsp"); g_engine->setupOtherNspAnimation(0, 18); } else { _console->printTosText(665); } } else if (objNum == 165) { if (_objectVar[165] == 0) { _objectVar[165] = 1; _console->printTosText(639); _inventory.addItem(13); } else { _console->printTosText(640); } } else if (objNum == 57) { _player->loadAnimations("instrshp.nsp"); if (_objectVar[71] == 2) { _console->printTosText(4); g_engine->setupOtherNspAnimation(1, 44); } else { g_engine->setupOtherNspAnimation(0, 43); } } else if (objNum == 117) { _player->loadAnimations("obslev.nsp"); g_engine->setupOtherNspAnimation(1, 46); } else if (objNum == 62) { if (((_objectVar[49] == 0) || (1 < _objectVar[62])) || (g_engine->_currentDay != 1)) { if (((_objectVar[49] == 0) || (1 < _objectVar[62])) || (g_engine->_currentDay != 2)) { if (((_objectVar[49] == 0) || (1 < _objectVar[62])) || (g_engine->_currentDay != 3)) { if (_objectVar[62] < 101) { // LoadModeSong(9); g_engine->playSound(0,6,-1); _objectVar[62] = 101; _console->addTextLine("You turn on the music."); } else if (_objectVar[62] == 101) { // KillAllSound(); // TerminateRoomSong(); _objectVar[62] = 100; _console->addTextLine("You turn off the music."); } } else { _objectVar[62] = _objectVar[62] + 1; _console->printTosText(921); } } else { _objectVar[62] = _objectVar[62] + 1; _console->printTosText(920); } } else { _objectVar[62] = _objectVar[62] + 1; _console->printTosText(919); } } else if (objNum == 63) { // Ordinal_184(unaff_CS,(int)&_file_name,4192,(int)sg_engine->_room33.nnn_1060_319f); // _Room = 33; // InitRoom(); // LoadRoomAndDumpPic(); // SetHeroSpriteNumber(); } else if (objNum == 83) { // Ordinal_184(unaff_CS,(int)&_file_name,4192,(int)sg_engine->_room28.nnn_1060_31ab); // _Room = 28; // InitRoom(); // LoadRoomAndDumpPic(); // SetHeroSpriteNumber(); } else if (objNum == 82) { if (g_engine->_room->_roomNumber == 41) { g_engine->_room->_roomNumber = 44; _console->printTosText(956); } else { g_engine->_room->_roomNumber = 41; _console->printTosText(957); } // LoadRoomAndDumpPic(); // InitRoom(); // SetHeroSpriteNumber(); } else if (objNum == 52) { // _NoScroll = 0; if (_objectVar[52] == 1) { _player->loadAnimations("shower.nsp"); g_engine->setupOtherNspAnimation(0, 2); _console->printTosText(193); g_engine->playSound(2,4,-1); } else { _console->printTosText(194); } } else if (objNum == 59) { if (_objectVar[59] == 2) { _objectVar[59] = 1; if (g_engine->_room->_roomNumber == 0 || g_engine->_room->_roomNumber == 9) { _console->printTosText(409); } } else { if (g_engine->_room->_roomNumber == 0 || g_engine->_room->_roomNumber == 9) { _console->printTosText(407); } _objectVar[59] = 2; } } else if (objNum == 78) { if (_objectVar[78] == 2) { _objectVar[78] = 1; if (g_engine->_room->_roomNumber == 0 || g_engine->_room->_roomNumber == 9) { _console->printTosText(409); } } else { g_engine->playSound(41,5,-1); if (g_engine->_room->_roomNumber == 0 || g_engine->_room->_roomNumber == 9) { _console->printTosText(32); } _objectVar[78] = 2; } } else if (objNum == 139) { _player->loadAnimations("ltladder.nsp"); g_engine->setupOtherNspAnimation(0,10); } else if (objNum == 76) { // _NoScroll = 0; // Ordinal_184(unaff_CS,(int)&_file_name,4192,(int)sg_engine->_room3.nnn_1060_31e1); // _Room = 3; // LoadRoomAndDumpPic(); // InitRoom(); // SetHeroSpriteNumber(); } else if (objNum == 77) { _player->loadAnimations("rtladder.nsp"); g_engine->setupOtherNspAnimation(0, 12); } else if (objNum == 66 && _objectVar[68] == 0) { if (_objectVar[12] == 2) { g_engine->playSound(5,5,-1); if (_objectVar[66] == 0) { if (_objectVar[67] == 0 && _objectVar[68] == 0) { _objectVar[66] = 1; } else { _objectVar[66] = 2; } } else { _objectVar[66] = 0; } } else { _console->addTextLine("You touch the surface of the ornate sigil."); } } else if (objNum == 67 && _objectVar[68] == 0) { if (_objectVar[12] == 2) { g_engine->playSound(5,5,-1); if (_objectVar[67] == 0) { if (_objectVar[66] == 1 && _objectVar[68] == 0) { _objectVar[67] = 1; } else { _objectVar[67] = 2; } } else { _objectVar[67] = 0; } } else { _console->addTextLine("You touch the surface of the ornate sigil."); } } else if ((objNum == 68) && (_objectVar[68] == 0)) { if (_objectVar[12] == 2) { if (true) { if ((_objectVar[66] == 1) && (_objectVar[67] == 1)) { g_engine->playSound(13,5,-1); _objectVar[68] = 1; g_engine->setupOtherNspAnimation(0,23); } else { _objectVar[68] = 2; } } else { _objectVar[68] = 0; } } else { _console->addTextLine("You touch the surface of the ornate sigil."); } } else if (objNum == 84) { _console->printTosText(566); } // _NoScroll = 0; return; } if (_objectVar[138] == 0) { _console->printTosText(906); } else { _inventory.addItem(objNum); g_engine->_room->removeObjectFromRoom(objNum); _objectVar[138] = 0; g_engine->updateDisplay(); if ((objNum == 7) && g_engine->_currentDay == 1) { _console->printTosText(905); _objectVar[141] = 1; _player->loadAnimations("delstore.nsp"); _objectVar.setMoveObjectPosition(141, {60, 221}); _objectVar.setMoveObjectRoom(7, 100); _objectVar[7] = 1; } } } void Darkseed::UseCode::useCodeGloves(int16 targetObjNum) { if (targetObjNum == 113) { putobjunderpillow(14); return; } int16 tosIdx = getUseGlovesTosIdx(targetObjNum); if (tosIdx != 0) { if (tosIdx < 979) { _console->printTosText(tosIdx); } else { genericresponse(14,targetObjNum, tosIdx); } } if (targetObjNum == 57) { _player->loadAnimations("instrshp.nsp"); g_engine->setupOtherNspAnimation(0, 43); } else if (targetObjNum == 117) { _player->loadAnimations("obslev.nsp"); g_engine->setupOtherNspAnimation(0, 45); } } void Darkseed::UseCode::useCodeMoney(int16 targetObjNum) { if ((targetObjNum != 138) && (targetObjNum != 152)) { int16 tosIdx = getUseMoneyTosIdx(targetObjNum); if (tosIdx == 0) { if (targetObjNum == 7) { _console->printTosText(961); } else if (targetObjNum == 113) { putobjunderpillow(8); } } else if (tosIdx < 979) { _console->printTosText(tosIdx); } else { genericresponse(8, targetObjNum, tosIdx); } return; } if (_objectVar[138] == 0) { _player->loadAnimations("givclerk.nsp"); g_engine->setupOtherNspAnimation(6, 35); } else { _console->addTextLine("Choose an item before giving clerk more money."); } } void Darkseed::UseCode::useCodeJournal(int16 actionObjNum, int16 targetObjNum) { if (targetObjNum == 113) { putobjunderpillow(actionObjNum); } else if ((actionObjNum == 6) && (targetObjNum == 47)) { _console->printTosText(46); } else if ((actionObjNum == 6) && (targetObjNum == 100)) { _console->printTosText(145); } else if ((actionObjNum == 6) && (targetObjNum == 136)) { _console->printTosText(999); } else { int16 tosIdx = getUseJournalTosIdx(targetObjNum); if (tosIdx != 0) { if (tosIdx < 979) { _console->printTosText(tosIdx); } else { genericresponse(6,targetObjNum, tosIdx); } } } } void Darkseed::UseCode::useCodeShopItems(int16 actionObjNum, int16 targetObjNum) { if (actionObjNum == 7) { if (targetObjNum == 44) { _player->loadAnimations("opendoor.nsp"); g_engine->setupOtherNspAnimation(0, 24); _objectVar[44] = 3600; g_engine->playSound(32, 5, -1); _inventory.removeItem(7); _console->printTosText(730); } else if ((targetObjNum == 141) && (_objectVar[141] == 7)) { _objectVar[141] = 8; } else if (targetObjNum == 47) { _console->printTosText(54); } else if (targetObjNum == 127) { _console->printTosText(106); } else if (targetObjNum == 123) { _console->printTosText(129); } else if (targetObjNum == 100) { _console->printTosText(153); } else if (targetObjNum == 143) { _console->printTosText(189); } else if (targetObjNum == 52) { _console->printTosText(202); } else if (targetObjNum == 145) { _console->printTosText(226); } else if (targetObjNum == 137) { _console->printTosText(300); } else if (targetObjNum == 126) { _console->printTosText(312); } else if (targetObjNum == 103 || targetObjNum == 151) { _console->printTosText(362); } else if (targetObjNum == 109) { _console->printTosText(965); } else if (targetObjNum == 61) { _console->printTosText(460); } else if (targetObjNum == 53) { _console->printTosText(489); g_engine->throwmikeinjail(); } else if (targetObjNum == 46) { _console->printTosText(542); } else if (targetObjNum < 87 || 98 < targetObjNum) { if (targetObjNum < 163 || 168 < targetObjNum) { if (targetObjNum == 171) { _console->printTosText(679); } else if (targetObjNum == 129) { genericresponse(7, 129, 998); } else if (targetObjNum == 108) { _console->printTosText(386); } else if (targetObjNum == 110) { _console->printTosText(392); } else if (targetObjNum == 85) { _console->printTosText(434); } else if (targetObjNum == 194) { genericresponse(7, 194, 989); } else if (targetObjNum == 156) { _console->printTosText(550); } else if (targetObjNum == 172) { genericresponse(7, 172, 988); } else if (targetObjNum == 71) { genericresponse(7, 71, 987); } else if (targetObjNum == 101) { genericresponse(7, 101, 986); } else if (targetObjNum == 120) { _console->printTosText(804); } else if (targetObjNum == 184) { genericresponse(7, 184, 980); } else if (targetObjNum == 185) { genericresponse(7, 185, 982); } else if (targetObjNum == 121) { genericresponse(7, 121, 990); } else { genericresponse(7, targetObjNum, 999); } } else { _console->printTosText(632); } } else { _console->printTosText(585); } return; } if (actionObjNum == 38 && targetObjNum == 78) { _console->printTosText(42); return; } if (actionObjNum == 38 && targetObjNum == 47) { _console->printTosText(60); return; } if (actionObjNum == 36 && targetObjNum == 125) { _console->printTosText(77); return; } if (actionObjNum == 38 && targetObjNum == 125) { _console->printTosText(78); return; } if (actionObjNum == 38 && (((((targetObjNum == 126 || targetObjNum == 126) || targetObjNum == 197) || ((targetObjNum == 131 || (targetObjNum == 89)))) || targetObjNum == 171))) { _console->printTosText(89); return; } if (actionObjNum == 37 && targetObjNum == 124) { _console->printTosText(28); } else if (actionObjNum == 38 && targetObjNum == 127) { _console->printTosText(116); } else if ((actionObjNum == 36 || actionObjNum == 37) && targetObjNum == 123) { _console->printTosText(135); } else if (actionObjNum == 38 && (targetObjNum == 123 || targetObjNum == 318)) { _console->printTosText(320); } else if (targetObjNum == 129) { genericresponse(actionObjNum, 129, 998); } else if ((actionObjNum == 37) && ((((((targetObjNum == 142 || (targetObjNum == 124)) || ((targetObjNum == 137 || (((targetObjNum == 148 || (targetObjNum == 109)) || (targetObjNum == 59)))))) || ((targetObjNum == 66 || (targetObjNum == 67)))) || (targetObjNum == 68)) || ((((targetObjNum == 133 || (targetObjNum == 194)) || ((targetObjNum == 46 || (((((targetObjNum == 156 || (targetObjNum == 158)) || (targetObjNum == 159)) || ((targetObjNum == 161 || (targetObjNum == 162)))) || (targetObjNum == 22)))))) || (((targetObjNum == 42 || (targetObjNum == 35)) || ((targetObjNum == 196 || ((((targetObjNum == 170 || (targetObjNum == 172)) || (targetObjNum == 25)) || (((targetObjNum == 71 || (targetObjNum == 101)) || (targetObjNum == 179)))))))))))))) { _console->printTosText(180); } else if ((actionObjNum == 37) && (targetObjNum == 52)) { _console->printTosText(211); } else if ((actionObjNum == 37) && (targetObjNum == 144)) { _console->printTosText(218); } else if ((actionObjNum == 37) && (targetObjNum == 145)) { _console->printTosText(229); } else if ((actionObjNum == 38) && (targetObjNum == 145)) { _console->printTosText(230); } else if (targetObjNum == 112) { genericresponse(actionObjNum, 112, 996); } else if ((actionObjNum == 38) && (targetObjNum == 49)) { _console->printTosText(251); } else if ((targetObjNum == 147) && (actionObjNum != 7)) { _console->printTosText(319); } else if (targetObjNum == 197) { genericresponse(actionObjNum, 197, 993); } else if ((actionObjNum == 38) && (targetObjNum == 150)) { _console->printTosText(354); } else if (targetObjNum == 109) { if (actionObjNum == 38) { _console->printTosText(375); } else { _console->printTosText(374); } } else if (targetObjNum == 130) { genericresponse(actionObjNum, 130, 991); } else if (targetObjNum == 108) { _console->printTosText(386); } else if (targetObjNum == 110) { _console->printTosText(392); } else if ((targetObjNum == 131) && (actionObjNum != 7)) { _console->printTosText(405); } else if (targetObjNum == 85) { _console->printTosText(434); } else if (targetObjNum == 121) { if (actionObjNum == 38) { _console->printTosText(445); } else if (actionObjNum == 40) { _console->printTosText(446); } else { genericresponse(actionObjNum, 121, 990); } } else if ((actionObjNum == 37) && (targetObjNum == 122)) { _console->printTosText(451); } else if ((actionObjNum == 38) || (targetObjNum != 61)) { if ((actionObjNum == 36) && (targetObjNum == 133)) { _console->printTosText(476); } else if (((actionObjNum == 36) || (actionObjNum == 40)) && (targetObjNum == 53)) { _console->printTosText(491); } else if ((actionObjNum == 37) && (targetObjNum == 53)) { _console->printTosText(492); } else if (targetObjNum == 194) { genericresponse(actionObjNum, 194, 989); } else if (targetObjNum == 153) { _console->printTosText(405); } else if ((actionObjNum == 37) && (targetObjNum == 154)) { _console->printTosText(535); } else if ((actionObjNum == 36) && (targetObjNum == 46)) { _console->printTosText(405); } else if ((actionObjNum == 38) && (targetObjNum == 46)) { _console->printTosText(545); } else if ((actionObjNum == 40) && (targetObjNum == 46)) { _console->printTosText(405); } else if (targetObjNum == 156) { _console->printTosText(550); } else if (targetObjNum == 159) { _console->printTosText(577); } else if ((targetObjNum < 87) || (98 < targetObjNum)) { if ((actionObjNum == 37) && ((162 < targetObjNum && (targetObjNum < 169)))) { _console->printTosText(634); } else if ((actionObjNum == 38) && ((162 < targetObjNum && (targetObjNum < 169)))) { _console->printTosText(635); } else if (targetObjNum == 172) { genericresponse(actionObjNum, 172, 988); } else if ((actionObjNum == 37) && (targetObjNum == 174)) { _console->printTosText(690); } else if ((actionObjNum == 38) && (targetObjNum == 25)) { _console->printTosText(696); } else if ((actionObjNum == 40) && (targetObjNum == 26)) { _console->printTosText(700); } else if (targetObjNum == 71) { genericresponse(actionObjNum, 71, 987); } else if ((actionObjNum == 39) && (targetObjNum == 44)) { _console->printTosText(731); } else if (targetObjNum == 101) { genericresponse(actionObjNum, 101, 986); } else if (targetObjNum == 113) { _console->printTosText(753); } else if (targetObjNum == 41) { _console->printTosText(757); } else if ((actionObjNum == 36) && (targetObjNum == 179)) { _console->printTosText(764); } else if ((actionObjNum == 38) && (targetObjNum == 179)) { _console->printTosText(762); } else if ((actionObjNum == 38) && (targetObjNum == 180)) { _console->printTosText(769); } else if (targetObjNum == 120) { _console->printTosText(804); } else if ((actionObjNum == 38) && (targetObjNum == 119)) { _console->printTosText(808); } else if ((actionObjNum == 38) && (targetObjNum == 114)) { genericresponse(38, 114, 984); } else if (targetObjNum == 184) { genericresponse(actionObjNum, 184, 980); } else if (targetObjNum == 185) { genericresponse(actionObjNum, 185, 982); } else if ((actionObjNum == 38) && (targetObjNum == 79)) { _console->printTosText(833); } else if ((targetObjNum == 79) && (actionObjNum != 7)) { _console->printTosText(836); } else if ((actionObjNum == 38) && (targetObjNum == 58)) { _console->printTosText(849); } else { genericresponse(actionObjNum, targetObjNum, 999); } } else { _console->printTosText(587); } } else { _console->printTosText(462); } } void Darkseed::UseCode::useCrowBar(int16 targetObjNum) { int16 tosIdx = getUseCrowbarTosIdx(targetObjNum); if (tosIdx != 0) { if (tosIdx < 979) { _console->printTosText(tosIdx); } else { genericresponse(5,targetObjNum, tosIdx); } } if (targetObjNum == 42) { if ((_objectVar[42] == 0) || (_objectVar[42] == 4)) { _player->loadAnimations("crowbar.nsp"); g_engine->setupOtherNspAnimation(0, 17); } else { _console->printTosText(962); } } } // All this code is unused as you cannot add the newspaper to your inventory. :( I wonder why they didn't add it. It is also missing the inventory icon image. void UseCode::useCodeNewspaper(int16 targetObjNum) { if (targetObjNum == 124) { _console->printTosText(26); } else if (targetObjNum == 126) { _console->printTosText(82); } else if (targetObjNum == 127) { _console->printTosText(112); } else if (targetObjNum == 123) { _console->printTosText(133); } else if (targetObjNum == 100) { _console->printTosText(157); } else if (targetObjNum == 52) { _console->printTosText(207); } else if (targetObjNum == 145) { _console->printTosText(222); } else if (targetObjNum == 124) { // Bug in the original engine. This code is never reachable _console->printTosText(268); // this is a duplicate of tosId: 26 } else if (targetObjNum == 137) { _console->printTosText(299); } else if (targetObjNum == 147) { _console->printTosText(309); } else if (targetObjNum == 197) { _console->printTosText(993); } else if (targetObjNum == 150) { _console->printTosText(352); } else if ((targetObjNum == 103) || (targetObjNum == 151)) { _console->printTosText(367); } else if (targetObjNum == 108) { _console->printTosText(386); } else if (targetObjNum == 110) { _console->printTosText(392); } else if (targetObjNum == 61) { _console->printTosText(455); } else if (targetObjNum == 53) { _console->printTosText(490); } else if (targetObjNum == 156) { _console->printTosText(550); } else if (targetObjNum == 159) { _console->printTosText(577); } else if (targetObjNum == 113) { _console->printTosText(753); } else if (targetObjNum == 120) { _console->printTosText(804); } else if (targetObjNum == 116) { _console->printTosText(832); } else if (targetObjNum == 79) { _console->printTosText(834); } else if (targetObjNum == 185) { genericresponse(9, 185, 982); } else if (targetObjNum == 184) { genericresponse(9, 184, 980); } else if (targetObjNum == 71) { genericresponse(9, 71, 987); } else if (targetObjNum == 101) { genericresponse(9, 101, 986); } else if (targetObjNum == 172) { genericresponse(9, 172, 988); } else if (targetObjNum == 194) { genericresponse(9, 194, 989); } else if (targetObjNum == 121) { genericresponse(9, 121, 990); } else if (targetObjNum == 109) { genericresponse(9, 109, 992); } else if (targetObjNum == 130) { genericresponse(9, 130, 991); } else if (targetObjNum == 129) { genericresponse(9, 129, 998); } else if (targetObjNum == 112) { genericresponse(9, 112, 996); } else { genericresponse(9, targetObjNum, 999); } } void UseCode::useCodeLibraryCard(int16 targetObjNum) { int16 tosIdx = getUseLibraryCardTosIdx(targetObjNum); if (tosIdx != 0) { if (tosIdx < 979) { _console->printTosText(tosIdx); } else { genericresponse(10, targetObjNum, tosIdx); } } if (targetObjNum == 46) { g_engine->_cursor.setCursorType(Pointer); _inventory.removeItem(10); g_engine->libanim(false); _objectVar[10] = 1; } else if (targetObjNum == 113) { putobjunderpillow(10); } } void UseCode::genericresponse(int16 useObjNum, int16 targetObjNum, int16 tosIdx) { // TODO implement me! } void UseCode::putobjunderpillow(int objNum) { // TODO } void UseCode::gancanim() { // TODO } }