void MapChip::moveToMapLocation(const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant dir) { AirQuality airQuality; if (g_neighborhood) airQuality = g_neighborhood->getAirQuality(room); else airQuality = kAirQualityGood; switch (neighborhood) { case kMarsID: if (airQuality == kAirQualityVacuum) { if (room >= kMars35 && room <= kMars39) { setItemState(kMapEngaged); if (isSelected() && g_AIArea && g_AIArea->getMiddleAreaOwner() == kBiochipSignature) _image.loadGearRoomIfNecessary(); } else { setItemState(kMapEngaged); if (isSelected() && g_AIArea && g_AIArea->getMiddleAreaOwner() == kBiochipSignature) _image.loadMazeIfNecessary(); } _image.moveToMapLocation(neighborhood, room, dir); } else { _image.unloadImage(); setItemState(kMapUnavailable); } break; default: _image.unloadImage(); setItemState(kMapUnavailable); break; } }
void AIChip::clickInAIHotspot(HotSpotID id) { PegasusEngine *vm = (PegasusEngine *)g_engine; Common::String movieName; switch (id) { case kAIBriefingSpotID: movieName = vm->getBriefingMovie(); break; case kAIScanSpotID: movieName = vm->getEnvScanMovie(); break; case kAIHint1SpotID: movieName = vm->getHintMovie(1); break; case kAIHint2SpotID: movieName = vm->getHintMovie(2); break; case kAIHint3SpotID: movieName = vm->getHintMovie(3); break; case kAISolveSpotID: g_neighborhood->doSolve(); break; } ItemState state = getItemState(); if (!movieName.empty()) { _playingMovie = true; uint numSolves; if (GameState.getWalkthroughMode()) { if (vm->canSolve()) numSolves = 2; else numSolves = 1; } else { numSolves = 0; } ItemState newState = s_highlightState[vm->getNumHints()][numSolves][id - kAIHint1SpotID + 1]; if (newState != -1) setItemState(newState); if (g_AIArea) { vm->prepareForAIHint(movieName); g_AIArea->playAIMovie(kRightAreaSignature, movieName, false, kHintInterruption); vm->cleanUpAfterAIHint(movieName); } if (newState != -1) setItemState(state); _playingMovie = false; } }
void SettingsDlg::coreConnectionStateChanged() { for(int i = 0; i < ui.settingsTree->topLevelItemCount(); i++) { QTreeWidgetItem *catItem = ui.settingsTree->topLevelItem(i); for(int j = 0; j < catItem->childCount(); j++) { QTreeWidgetItem *item = catItem->child(j); setItemState(item); } setItemState(catItem); } }
void OpticalChip::setUpOpticalChip() { if (_opticalFlags.getFlag(kOpticalAriesExposed)) { if (_opticalFlags.getFlag(kOpticalMercuryExposed)) { if (_opticalFlags.getFlag(kOpticalPoseidonExposed)) setItemState(kOptical111); else setItemState(kOptical011); } else { if (_opticalFlags.getFlag(kOpticalPoseidonExposed)) setItemState(kOptical101); else setItemState(kOptical001); } } else { if (_opticalFlags.getFlag(kOpticalMercuryExposed)) { if (_opticalFlags.getFlag(kOpticalPoseidonExposed)) setItemState(kOptical110); else setItemState(kOptical010); } else { if (_opticalFlags.getFlag(kOpticalPoseidonExposed)) setItemState(kOptical100); else setItemState(kOptical000); } } }
void AGOSEngine::synchChain(Item *i) { SubChain *c = (SubChain *)findChildOfType(i, kChainType); while (c) { setItemState(derefItem(c->chChained), i->state); c = (SubChain *)nextSub((Child *)c, kChainType); } }
void AirMask::putMaskOn() { AirQuality airQuality; if (g_neighborhood) airQuality = g_neighborhood->getAirQuality(GameState.getCurrentRoom()); else airQuality = kAirQualityGood; uint airLevel = getAirLeft(); ItemState newState = getItemState(); ItemState oldState = newState; if (airLevel == 0) { newState = kAirMaskEmptyFilter; } else if (airLevel <= kOxygenLowThreshold) { if (airQuality == kAirQualityVacuum) newState = kAirMaskLowOn; else newState = kAirMaskLowFilter; } else { if (airQuality == kAirQualityVacuum) newState = kAirMaskFullOn; else newState = kAirMaskFullFilter; } if (newState != oldState) setItemState(newState); }
void SettingsDlg::registerSettingsPage(SettingsPage *sp) { sp->setParent(ui.settingsStack); ui.settingsStack->addWidget(sp); connect(sp, SIGNAL(changed(bool)), this, SLOT(setButtonStates())); QTreeWidgetItem *cat; QList<QTreeWidgetItem *> cats = ui.settingsTree->findItems(sp->category(), Qt::MatchExactly); if (!cats.count()) { cat = new QTreeWidgetItem(ui.settingsTree, QStringList(sp->category())); cat->setExpanded(true); cat->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); } else { cat = cats[0]; } QTreeWidgetItem *item; if (sp->title().isEmpty()) item = cat; else item = new QTreeWidgetItem(cat, QStringList(sp->title())); item->setData(0, SettingsPageRole, QVariant::fromValue<QObject *>(sp)); ui.settingsTree->setMinimumWidth(ui.settingsTree->header()->sectionSizeHint(0) + 5); pageIsLoaded[sp] = false; if (!ui.settingsTree->selectedItems().count()) ui.settingsTree->setCurrentItem(item); setItemState(item); }
AIChip::AIChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) : BiochipItem(id, neighborhood, room, direction), _briefingSpot(kAIBriefingSpotID), _scanSpot(kAIScanSpotID), _hint1Spot(kAIHint1SpotID), _hint2Spot(kAIHint2SpotID), _hint3Spot(kAIHint3SpotID), _solveSpot(kAISolveSpotID) { _briefingSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 10, kAIMiddleAreaTop + 27, kAIMiddleAreaLeft + 10 + 81, kAIMiddleAreaTop + 27 + 31)); _briefingSpot.setHotspotFlags(kAIBiochipSpotFlag); g_allHotspots.push_back(&_briefingSpot); _scanSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 100, kAIMiddleAreaTop + 27, kAIMiddleAreaLeft + 100 + 81, kAIMiddleAreaTop + 27 + 31)); _scanSpot.setHotspotFlags(kAIBiochipSpotFlag); g_allHotspots.push_back(&_scanSpot); _hint1Spot.setArea(Common::Rect(kAIMiddleAreaLeft + 70, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 70 + 21, kAIMiddleAreaTop + 67 + 21)); _hint1Spot.setHotspotFlags(kAIBiochipSpotFlag); g_allHotspots.push_back(&_hint1Spot); _hint2Spot.setArea(Common::Rect(kAIMiddleAreaLeft + 91, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 91 + 20, kAIMiddleAreaTop + 67 + 21)); _hint2Spot.setHotspotFlags(kAIBiochipSpotFlag); g_allHotspots.push_back(&_hint2Spot); _hint3Spot.setArea(Common::Rect(kAIMiddleAreaLeft + 111, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 111 + 20, kAIMiddleAreaTop + 67 + 21)); _hint3Spot.setHotspotFlags(kAIBiochipSpotFlag); g_allHotspots.push_back(&_hint3Spot); _solveSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 131, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 131 + 50, kAIMiddleAreaTop + 67 + 21)); _solveSpot.setHotspotFlags(kAIBiochipSpotFlag); g_allHotspots.push_back(&_solveSpot); _playingMovie = false; setItemState(kAI000); g_AIChip = this; }
void AGOSEngine::o_inc() { // 59: item inc state Item *item = getNextItemPtr(); if (item->state <= 30000) { setItemState(item, item->state + 1); synchChain(item); } }
void AGOSEngine::o_dec() { // 60: item dec state Item *item = getNextItemPtr(); if (item->state >= 0) { setItemState(item, item->state - 1); synchChain(item); } }
AirMask::AirMask(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) : InventoryItem(id, neighborhood, room, direction), _toggleSpot(kAirMaskToggleSpotID) { g_airMask = this; _toggleSpot.setArea(Common::Rect(kAIMiddleAreaLeft + 10, kAIMiddleAreaTop + 17, kAIMiddleAreaLeft + 110, kAIMiddleAreaTop + 57)); _toggleSpot.setHotspotFlags(kAirMaskSpotFlag); g_allHotspots.push_back(&_toggleSpot); setItemState(kAirMaskEmptyOff); _oxygenTimer.primeFuse(0); _oxygenTimer.setFunctor(new Common::Functor0Mem<void, AirMask>(this, &AirMask::airMaskTimerExpired)); }
void AGOSEngine::o_setState() { // 61: item set state Item *item = getNextItemPtr(); int value = getVarOrWord(); if (value < 0) value = 0; if (value > 30000) value = 30000; setItemState(item, value); synchChain(item); }
void ProgressData::resetItems(string action, double __currentProgress, double __maxProgress, int state) { sendEvents = false; for (unsigned int i=0; i<itemName.size(); i++) { setItemState(i, state); setItemCurrentAction(i, action); setItemProgressMaximum(i, __maxProgress); setItemProgress(i,__currentProgress); } sendEvents = true; }
void AirMask::refillAirMask() { switch (getItemState()) { case kAirMaskEmptyOff: case kAirMaskLowOff: setItemState(kAirMaskFullOff); break; case kAirMaskEmptyFilter: case kAirMaskLowFilter: setItemState(kAirMaskFullFilter); break; case kAirMaskLowOn: setItemState(kAirMaskFullOn); break; } if (_oxygenTimer.isFuseLit()) { _oxygenTimer.stopFuse(); _oxygenTimer.primeFuse(kOxyMaskFullTime); _oxygenTimer.lightFuse(); } else { _oxygenTimer.primeFuse(kOxyMaskFullTime); } }
void AirMask::takeMaskOff() { uint airLevel = getAirLeft(); ItemState newState = getItemState(); ItemState oldState = newState; if (airLevel == 0) newState = kAirMaskEmptyOff; else if (airLevel <= kOxygenLowThreshold) newState = kAirMaskLowOff; else newState = kAirMaskFullOff; if (newState != oldState) setItemState(newState); }
void AIChip::setUpAIChip() { if (!_playingMovie) { PegasusEngine *vm = (PegasusEngine *)g_engine; uint numSolves; if (GameState.getWalkthroughMode()) { if (vm->canSolve()) numSolves = 2; else numSolves = 1; } else { numSolves = 0; } setItemState(s_highlightState[vm->getNumHints()][numSolves][0]); } }
OpticalChip::OpticalChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) : BiochipItem(id, neighborhood, room, direction), _ariesHotspot(kAriesSpotID), _mercuryHotspot(kMercurySpotID), _poseidonHotspot(kPoseidonSpotID) { _ariesHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 60, kAIMiddleAreaTop + 27, kAIMiddleAreaLeft + 60 + 121, kAIMiddleAreaTop + 27 + 20)); _ariesHotspot.setHotspotFlags(kOpticalBiochipSpotFlag); g_allHotspots.push_back(&_ariesHotspot); _mercuryHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 60, kAIMiddleAreaTop + 47, kAIMiddleAreaLeft + 60 + 121, kAIMiddleAreaTop + 47 + 20)); _mercuryHotspot.setHotspotFlags(kOpticalBiochipSpotFlag); g_allHotspots.push_back(&_mercuryHotspot); _poseidonHotspot.setArea(Common::Rect(kAIMiddleAreaLeft + 60, kAIMiddleAreaTop + 67, kAIMiddleAreaLeft + 60 + 121, kAIMiddleAreaTop + 67 + 20)); _poseidonHotspot.setHotspotFlags(kOpticalBiochipSpotFlag); g_allHotspots.push_back(&_poseidonHotspot); setItemState(kOptical000); g_opticalChip = this; }
void AIChip::showBriefingClicked() { PegasusEngine *vm = (PegasusEngine *)g_engine; _playingMovie = true; uint numSolves; if (GameState.getWalkthroughMode()) { if (vm->canSolve()) numSolves = 2; else numSolves = 1; } else { numSolves = 0; } ItemState newState = s_highlightState[vm->getNumHints()][numSolves][kAIBriefingSpotID - kAIHint1SpotID + 1]; if (newState != -1) setItemState(newState); }
BiochipItem::BiochipItem(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) : Item(id, neighborhood, room, direction) { PegasusEngine *vm = (PegasusEngine *)g_engine; Common::SeekableReadStream *biochipInfo = vm->_resFork->getResource(MKTAG('B', 'i', 'o', 'I'), kItemBaseResID + id); if (biochipInfo) { _biochipInfoPanelTime = biochipInfo->readUint32BE(); delete biochipInfo; } else { _biochipInfoPanelTime = 0; } Common::SeekableReadStream *rightInfo = vm->_resFork->getResource(MKTAG('R', 'g', 'h', 't'), kItemBaseResID + id); if (!rightInfo) error("Could not find right info for biochip %d", id); _rightAreaInfo = readItemState(rightInfo); delete rightInfo; setItemState(kNormalItem); }
void OpticalChip::playOpMemMovie(HotSpotID id) { Common::String movieName; switch (id) { case kAriesSpotID: movieName = "Images/AI/Globals/OMAI"; break; case kMercurySpotID: movieName = "Images/AI/Globals/OMMI"; break; case kPoseidonSpotID: movieName = "Images/AI/Globals/OMPI"; break; } ItemState state = getItemState(), newState; switch (state) { case kOptical001: newState = kOptical002; break; case kOptical010: newState = kOptical020; break; case kOptical011: if (id == kAriesSpotID) newState = kOptical012; else newState = kOptical021; break; case kOptical100: newState = kOptical200; break; case kOptical101: if (id == kAriesSpotID) newState = kOptical102; else newState = kOptical201; break; case kOptical110: if (id == kMercurySpotID) newState = kOptical120; else newState = kOptical210; break; case kOptical111: if (id == kAriesSpotID) newState = kOptical112; else if (id == kMercurySpotID) newState = kOptical121; else newState = kOptical211; break; case kOptical000: // Can never happen. default: error("Invalid optical chip state"); } setItemState(newState); if (g_AIArea) g_AIArea->playAIMovie(kRightAreaSignature, movieName, false, kOpticalInterruption); setItemState(state); }
MapChip::MapChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) : BiochipItem(id, neighborhood, room, direction) { g_map = this; setItemState(kMapUnavailable); }
void KeyCard::removedFromInventory() { if (isFlashlightOn()) setItemState(kFlashlightOff); }
void KeyCard::toggleItemState() { if (getItemState() == kFlashlightOff) setItemState(kFlashlightOn); else setItemState(kFlashlightOff); }
KeyCard::KeyCard(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) : InventoryItem(id, neighborhood, room, direction) { setItemState(kFlashlightOff); }
void AirMask::useIdleTime() { if (getAirLeft() == 0) setItemState(kAirMaskEmptyOff); else if (getAirLeft() <= kOxygenLowThreshold) setItemState(kAirMaskLowOn); }