示例#1
0
文件: mapchip.cpp 项目: 86400/scummvm
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;
	}
}
示例#2
0
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;
	}
}
示例#3
0
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);
  }
}
示例#4
0
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);
        }
    }
}
示例#5
0
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);
	}
}
示例#6
0
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);
}
示例#7
0
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);
}
示例#8
0
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;
}
示例#9
0
void AGOSEngine::o_inc() {
	// 59: item inc state
	Item *item = getNextItemPtr();
	if (item->state <= 30000) {
		setItemState(item, item->state + 1);
		synchChain(item);
	}
}
示例#10
0
void AGOSEngine::o_dec() {
	// 60: item dec state
	Item *item = getNextItemPtr();
	if (item->state >= 0) {
		setItemState(item, item->state - 1);
		synchChain(item);
	}
}
示例#11
0
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));
}
示例#12
0
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);
}
示例#13
0
文件: bus.cpp 项目: SirAnthony/mpkg
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;
}
示例#14
0
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);
	}
}
示例#15
0
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);
}
示例#16
0
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]);
	}
}
示例#17
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;
}
示例#18
0
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);
}
示例#19
0
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);
}
示例#20
0
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);
}
示例#21
0
文件: mapchip.cpp 项目: 86400/scummvm
MapChip::MapChip(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
		BiochipItem(id, neighborhood, room, direction) {
	g_map = this;
	setItemState(kMapUnavailable);
}
示例#22
0
void KeyCard::removedFromInventory() {
	if (isFlashlightOn())
		setItemState(kFlashlightOff);
}
示例#23
0
void KeyCard::toggleItemState() {
	if (getItemState() == kFlashlightOff)
		setItemState(kFlashlightOn);
	else
		setItemState(kFlashlightOff);
}
示例#24
0
KeyCard::KeyCard(const ItemID id, const NeighborhoodID neighborhood, const RoomID room, const DirectionConstant direction) :
			InventoryItem(id, neighborhood, room, direction) {
	setItemState(kFlashlightOff);
}
示例#25
0
void AirMask::useIdleTime() {
	if (getAirLeft() == 0)
		setItemState(kAirMaskEmptyOff);
	else if (getAirLeft() <= kOxygenLowThreshold)
		setItemState(kAirMaskLowOn);
}