示例#1
0
void EnergyMonitor::restoreLastEnergyValue() {
	PegasusEngine *vm = (PegasusEngine *)g_engine;

	_dontFlash = true;
	setEnergyValue(vm->getSavedEnergyValue());
	vm->resetEnergyDeathReason();
}
示例#2
0
EnergyMonitor::EnergyMonitor() : IdlerAnimation(kEnergyBarID), _energyLight(kWarningLightID) {
	PegasusEngine *vm = (PegasusEngine *)g_engine;

	_stage = kStageNoStage;

	_calibrating = false;
	_dontFlash = false;

	setBounds(338, 48, 434, 54);

	setDisplayOrder(kEnergyBarOrder);
	startDisplaying();

	SpriteFrame *frame = new SpriteFrame();
	frame->initFromPICTResource(vm->_resFork, kLightOffID);
	_energyLight.addFrame(frame, 0, 0);

	frame = new SpriteFrame();
	frame->initFromPICTResource(vm->_resFork, kLightYellowID);
	_energyLight.addFrame(frame, 0, 0);

	frame = new SpriteFrame();
	frame->initFromPICTResource(vm->_resFork, kLightOrangeID);
	_energyLight.addFrame(frame, 0, 0);

	frame = new SpriteFrame();
	frame->initFromPICTResource(vm->_resFork, kLightRedID);
	_energyLight.addFrame(frame, 0, 0);

	_energyLight.setBounds(540, 35, 600, 59);
	_energyLight.setDisplayOrder(kEnergyLightOrder);
	_energyLight.startDisplaying();

	setScale(1);
	setSegment(0, kMaxJMPEnergy);

	setEnergyValue(kCasualEnergy);

	g_energyMonitor = this;
}
示例#3
0
void EnergyMonitor::calibrateEnergyBar() {
	PegasusEngine *vm = (PegasusEngine *)g_engine;

	_calibrating = true;

	vm->setEnergyDeathReason(-1);

	uint32 numFrames = _energyLight.getNumFrames();
	for (uint32 i = 1; i < numFrames; i++) {
		_energyLight.setCurrentFrameIndex(i);
		_energyLight.show();
		vm->delayShell(1, 3);
		_energyLight.hide();
		vm->delayShell(1, 3);
	}

	_energyLight.setCurrentFrameIndex(0);
	_energyLight.hide();

	setEnergyValue(0);
	setEnergyDrainRate(-(int32)kMaxJMPEnergy / 2);
	show();

	// Make sure warning light is hidden...
	_energyLight.hide();
	while (getCurrentEnergy() != (int32)kMaxJMPEnergy) {
		vm->checkCallBacks();
		vm->refreshDisplay();
		g_system->delayMillis(10);
	}

	vm->refreshDisplay();
	setEnergyDrainRate(0);
	hide();

	_calibrating = false;
}
示例#4
0
void ShuttleEnergyMeter::dropEnergyValue(const int32 delta) {
	setEnergyValue(getFaderValue() - delta);
}