bool CSTimeConsole::Cmd_InvItem(int argc, const char **argv) { if (argc < 3) { DebugPrintf("Usage: invItem <id> <0 or 1>\n"); return true; } if (atoi(argv[2])) { _vm->addEvent(CSTimeEvent(kCSTimeEventDropItemInInventory, 0xffff, atoi(argv[1]))); } else { _vm->addEvent(CSTimeEvent(kCSTimeEventRemoveItemFromInventory, 0xffff, atoi(argv[1]))); } return false; }
void CSTimeHelp::end(bool runEvents) { _state = (uint)~0; _currHover = 0xffff; _vm->getInterface()->clearDialogArea(); _vm->getInterface()->getInventoryDisplay()->show(); if (noHelperChanges()) return; _vm->addEvent(CSTimeEvent(kCSTimeEventCharSetState, _vm->getCase()->getCurrScene()->getHelperId(), 1)); _vm->addEvent(CSTimeEvent(kCSTimeEventCharSomeNIS55, _vm->getCase()->getCurrScene()->getHelperId(), 1)); }
void CSTimeHelp::start() { if (_vm->getInterface()->getInventoryDisplay()->getState() == 4) return; _state = 2; uint16 speech = 5900 + _vm->_rnd->getRandomNumberRng(0, 2); _vm->addEvent(CSTimeEvent(kCSTimeEventCharStartFlapping, _vm->getCase()->getCurrScene()->getHelperId(), speech)); if (noHelperChanges()) return; // Play a NIS, making sure the Good Guide is disabled. _vm->addEvent(CSTimeEvent(kCSTimeEventCharSetState, _vm->getCase()->getCurrScene()->getHelperId(), 0)); _vm->addEvent(CSTimeEvent(kCSTimeEventCharPlayNIS, _vm->getCase()->getCurrScene()->getHelperId(), 0)); _vm->addEvent(CSTimeEvent(kCSTimeEventCharSetState, _vm->getCase()->getCurrScene()->getHelperId(), 0)); }
bool CSTimeConsole::Cmd_ChangeScene(int argc, const char **argv) { if (argc < 2) { DebugPrintf("Usage: changeScene <value>\n"); return true; } _vm->addEvent(CSTimeEvent(kCSTimeEventNewScene, 0xffff, atoi(argv[1]))); return false; }
void CSTimeHelp::mouseUp(Common::Point &pos) { if (_currEntry == 0xffff || _qars[_currEntry].speech == 0) { _vm->getInterface()->cursorSetShape(1); end(); return; } Common::Rect thisRect = _vm->getInterface()->_dialogTextRect; thisRect.top += 1 + _currEntry*15; thisRect.bottom = thisRect.top + 15; if (!thisRect.contains(pos)) return; _vm->addEvent(CSTimeEvent(kCSTimeEventCharStartFlapping, _vm->getCase()->getCurrScene()->getHelperId(), 5900 + _qars[_currEntry].speech)); _nextToProcess = _currEntry; _askedAlready.push_back(_qars[_currEntry].text); }
void MohawkEngine_CSTime::nextScene() { _case->setCurrScene(_nextSceneId); CSTimeScene *scene = _case->getCurrScene(); // TODO: scene->setState(1); scene->_visitCount++; scene->installGroup(); _interface->draw(); scene->buildScene(); scene->setupAmbientAnims(); _interface->cursorSetShape(1, false); addEvent(CSTimeEvent(kCSTimeEventWait, 0xffff, 500)); scene->idleAmbientAnims(); // TODO: startEnvironmentSound(); if (scene->_visitCount == 1) { addEventList(scene->getEvents(false)); } else { addEventList(scene->getEvents(true)); } _view->idleView(); // TODO: maybe startMusic(); }
void CSTimeCarmenNote::addPiece(uint16 piece, uint16 speech) { uint i; for (i = 0; i < NUM_NOTE_PIECES; i++) { if (_pieces[i] == 0xffff) { _pieces[i] = piece; break; } } if (i == NUM_NOTE_PIECES) error("addPiece couldn't add piece to carmen note"); // Get the Good Guide to say something. if (i == 2) speech = 9900; // Found the third piece. if (speech != 0xffff) _vm->addEvent(CSTimeEvent(kCSTimeEventCharStartFlapping, _vm->getCase()->getCurrScene()->getHelperId(), speech)); // Remove the note feature, if any. uint16 noteFeatureId = _vm->getCase()->getNoteFeatureId(piece); if (noteFeatureId != 0xffff) _vm->addEvent(CSTimeEvent(kCSTimeEventDisableFeature, 0xffff, noteFeatureId)); _vm->addEvent(CSTimeEvent(kCSTimeEventShowBigNote, 0xffff, 0xffff)); if (i != 2) return; // TODO: special-casing for case 5 _vm->addEvent(CSTimeEvent(kCSTimeEventCharPlayNIS, _vm->getCase()->getCurrScene()->getHelperId(), 3)); // TODO: special-casing for case 5 _vm->addEvent(CSTimeEvent(kCSTimeEventCharStartFlapping, _vm->getCase()->getCurrScene()->getHelperId(), 9901)); _vm->addEvent(CSTimeEvent(kCSTimeEventActivateCuffs, 0xffff, 0xffff)); }
void CSTimeInterface::stopDragging() { CSTimeScene *scene = _vm->getCase()->getCurrScene(); CSTimeInventoryObject *invObj = _vm->getCase()->_inventoryObjs[_draggedItem]; Common::Point mousePos = _vm->_system->getEventManager()->getMousePos(); _state = kCSTimeInterfaceStateNormal; if (_sceneRect.contains(mousePos)) scene->setCursorForCurrentPoint(); else setCursorForCurrentPoint(); // Find the inventory object hotspot which is topmost for this drop, if any. uint16 foundInvObjHotspot = 0xffff; const Common::Array<CSTimeHotspot> &hotspots = scene->getHotspots(); for (uint i = 0; i < hotspots.size(); i++) { if (hotspots[i].state != 1) continue; if (!hotspots[i].region.containsPoint(mousePos)) continue; for (uint j = 0; j < invObj->hotspots.size(); j++) { if (invObj->hotspots[j].sceneId != scene->getId()) continue; if (invObj->hotspots[j].hotspotId != i) continue; if (foundInvObjHotspot != 0xffff && invObj->hotspots[foundInvObjHotspot].hotspotId < invObj->hotspots[j].hotspotId) continue; foundInvObjHotspot = j; } } // Work out if we're going to consume (nom-nom) the object after the drop. bool consumeObj = false; bool runConsumeEvents = false; if (foundInvObjHotspot != 0xffff) { CSTimeInventoryHotspot &hotspot = invObj->hotspots[foundInvObjHotspot]; clearTextLine(); for (uint i = 0; i < invObj->locations.size(); i++) { if (invObj->locations[i].sceneId != hotspot.sceneId) continue; if (invObj->locations[i].hotspotId != hotspot.hotspotId) continue; consumeObj = true; break; } if (_draggedItem == TIME_CUFFS_ID && !_inventoryDisplay->getCuffsState()) { consumeObj = false; // Nuh-uh, they're not activated yet. _vm->addEvent(CSTimeEvent(kCSTimeEventCharStartFlapping, _vm->getCase()->getCurrScene()->getHelperId(), 9902)); } else { // FIXME: ding(); runConsumeEvents = true; } } // Deal with the actual drop. if (grabbedFromInventory()) { if (!consumeObj) { _vm->getView()->dragFeature((NewFeature *)invObj->feature, mousePos, 2, 0x800, NULL); // TODO: playSound(151); } else if (_draggedItem != TIME_CUFFS_ID) { _vm->getView()->dragFeature((NewFeature *)invObj->feature, mousePos, 2, 0x600, NULL); _vm->_haveInvItem[_draggedItem] = 0; invObj->feature = NULL; invObj->featureDisabled = true; _inventoryDisplay->removeItem(_draggedItem); } else if (!_inventoryDisplay->getCuffsState()) { // Inactive cuffs. // TODO: We never actually get here? Which would explain why it makes no sense. _vm->getView()->dragFeature((NewFeature *)invObj->feature, mousePos, 2, 0x800, NULL); invObj->feature = NULL; } else { // Active cuffs. _vm->getView()->dragFeature((NewFeature *)invObj->feature, mousePos, 2, 0x600, NULL); _vm->_haveInvItem[_draggedItem] = 0; invObj->feature = NULL; invObj->featureDisabled = true; } if (runConsumeEvents) { _vm->addEventList(invObj->hotspots[foundInvObjHotspot].events); } _inventoryDisplay->draw(); } else { uint32 dragFlags = 0x600; _vm->getView()->dragFeature((NewFeature *)invObj->feature, mousePos, 2, dragFlags, NULL); if (_inventoryDisplay->_invRect.contains(mousePos)) { // Dropped into the inventory. invObj->feature = NULL; if (invObj->canTake) { dropItemInInventory(_draggedItem); if (invObj->hotspotId) _vm->addEvent(CSTimeEvent(kCSTimeEventDisableHotspot, 0xffff, invObj->hotspotId)); } else { if (invObj->featureId) _vm->addEvent(CSTimeEvent(kCSTimeEventAddFeature, 0xffff, invObj->featureId)); } for (uint i = 0; i < invObj->hotspots.size(); i++) { if (invObj->hotspots[i].sceneId != scene->getId()) continue; if (invObj->hotspots[i].hotspotId != 0xffff) continue; _vm->addEventList(invObj->hotspots[i].events); } } else { // Dropped into the scene. CSTimeEvent event; event.param1 = 0xffff; if (consumeObj) { invObj->feature = NULL; invObj->featureDisabled = true; event.type = kCSTimeEventDisableHotspot; event.param2 = invObj->hotspotId; } else { invObj->feature = NULL; event.type = kCSTimeEventAddFeature; event.param2 = invObj->featureId; } _vm->addEvent(event); if (runConsumeEvents) { _vm->addEventList(invObj->hotspots[foundInvObjHotspot].events); } else { for (uint i = 0; i < invObj->hotspots.size(); i++) { if (invObj->hotspots[i].sceneId != scene->getId()) continue; if (invObj->hotspots[i].hotspotId != 0xfffe) continue; _vm->addEventList(invObj->hotspots[i].events); } } } } if (_vm->getCase()->getId() == 1 && _vm->getCase()->getCurrScene()->getId() == 4) { // Hardcoded behaviour for torches in the dark tomb, in the first case. if (_draggedItem == 1 && foundInvObjHotspot == 0xffff) { // Trying to drag an unlit torch around? _vm->addEvent(CSTimeEvent(kCSTimeEventCharStartFlapping, 0, 16352)); } else if (_draggedItem == 2 && _vm->_caseVariable[2] == 1) { // This the first time we tried dragging the lit torch around. _vm->addEvent(CSTimeEvent(kCSTimeEventCharStartFlapping, 0, 16354)); } } // TODO: Is this necessary? _draggedItem = 0xffff; }