Ejemplo n.º 1
0
void FighterOpponentIvo::update() {
	if (!_field_38 && canInteract(kFightAction1) && !_sequenceIndex2) {

		if (_opponent->getField34() >= 2) {
			switch (rnd(5)) {
			default:
				break;

			case 0:
				setSequenceAndDraw(1, kFightSequenceType0);
				break;

			case 1:
				setSequenceAndDraw(2, kFightSequenceType0);
				break;

			case 2:
				setSequenceAndDraw(1, kFightSequenceType0);
				setSequenceAndDraw(2, kFightSequenceType2);
				break;

			case 3:
				setSequenceAndDraw(0, kFightSequenceType2);
				setSequenceAndDraw(1, kFightSequenceType2);
				break;

			case 4:
				setSequenceAndDraw(0, kFightSequenceType1);
				setSequenceAndDraw(1, kFightSequenceType2);
				break;
			}
		}

		// Update field_38
		_field_38 = 3 * _countdown + (int32)rnd(10);
	}

	if (_frame && checkFrame(2)) {

		if (_opponent->getCountdown() <= 0) {
			setSequenceAndDraw(7, kFightSequenceType1);
			_opponent->setSequenceAndDraw(8, kFightSequenceType1);
			getSoundQueue()->stop(kEntityTables0);

			_opponent->handleAction(kFightActionWin);

			return;
		}

		if (_sequenceIndex == 1 || _sequenceIndex == 2)
			_opponent->handleAction((FightAction)_sequenceIndex);
	}

	Fighter::update();
}
Ejemplo n.º 2
0
void FighterOpponentMilos::update() {
	if (!_field_38 && canInteract(kFightAction1) && !_sequenceIndex2) {

		if (_opponent->getField34() >= 2) {
			switch (rnd(5)) {
			default:
				break;

			case 0:
				setSequenceAndDraw(1, kFightSequenceType0);
				break;

			case 1:
				setSequenceAndDraw(2, kFightSequenceType0);
				break;

			case 2:
				setSequenceAndDraw(2, kFightSequenceType0);
				setSequenceAndDraw(2, kFightSequenceType1);
				break;

			case 3:
				setSequenceAndDraw(1, kFightSequenceType0);
				setSequenceAndDraw(2, kFightSequenceType2);
				break;

			case 4:
				setSequenceAndDraw(1, kFightSequenceType0);
				setSequenceAndDraw(1, kFightSequenceType2);
				break;
			}
		} else {
			setSequenceAndDraw(2, kFightSequenceType0);
		}

		// Update field_38
		if (_opponent->getField34() < 5)
			_field_38 = 6 * (5 - _opponent->getField34());
		else
			_field_38 = 0;
	}

	if (_frame && checkFrame(2)) {
		if (_sequenceIndex == 1 || _sequenceIndex == 2)
			_opponent->handleAction((FightAction)_sequenceIndex);

		if (_opponent->getCountdown() <= 0) {
			getSoundQueue()->removeFromQueue(kEntityTables0);
			handleAction(kFightActionLost);
		}
	}

	Fighter::update();
}
Ejemplo n.º 3
0
void FighterPlayerVesna::update() {
	if (_frame && checkFrame(2)) {

		if (_sequenceIndex == 3)
			_opponent->handleAction(kFightAction3);

		if (_opponent->getCountdown() <= 0) {
			getSoundQueue()->stop(kEntityTables0);
			_fight->bailout(Fight::kFightEndWin);
			return;
		}

		if (_sequenceIndex == 5)
			_opponent->handleAction(kFightAction5);
	}

	Fighter::update();
}
Ejemplo n.º 4
0
void FighterPlayerMilos::update() {
	if (_frame && checkFrame(2)) {

		// Draw sequences
		if (_opponent->getCountdown() <= 0) {
			setSequenceAndDraw(5, kFightSequenceType1);
			_opponent->setSequenceAndDraw(6, kFightSequenceType1);

			getSoundQueue()->removeFromQueue(kEntityTables0);
			getSound()->playSound(kEntityTrain, "MUS029", kFlagDefault);

			handleAction(kFightActionWin);
		}

		if (_sequenceIndex == 4) {
			_opponent->handleAction(kFightAction4);
			_fight->setEndType(Fight::kFightEndLost);
		}
	}

	Fighter::update();
}
Ejemplo n.º 5
0
void FighterPlayerIvo::update() {

	if ((_sequenceIndex == 3 || _sequenceIndex == 4) && !_frameIndex)
		_opponent->handleAction(kFightAction131);

	if (_frame && checkFrame(2)) {

		// Draw sequences
		if (_opponent->getCountdown() <= 0) {
			setSequenceAndDraw(9, kFightSequenceType1);
			_opponent->setSequenceAndDraw(8, kFightSequenceType1);
			getSoundQueue()->stop(kEntityTables0);

			handleAction(kFightActionWin);
			return;
		}

		if (_sequenceIndex == 3 || _sequenceIndex == 4)
			_opponent->handleAction((FightAction)_sequenceIndex);
	}

	Fighter::update();
}
Ejemplo n.º 6
0
void FighterOpponentVesna::update() {
	if (!_field_38 && canInteract(kFightAction1) && !_sequenceIndex2) {

		if (_opponent->getField34() == 1) {
			setSequenceAndDraw(2, kFightSequenceType0);
		} else {
			switch (rnd(6)) {
			default:
				break;

			case 0:
				setSequenceAndDraw(1, kFightSequenceType0);
				break;

			case 1:
				setSequenceAndDraw(1, kFightSequenceType0);
				setSequenceAndDraw(1, kFightSequenceType2);
				break;

			case 2:
				setSequenceAndDraw(2, kFightSequenceType0);
				break;

			case 3:
				setSequenceAndDraw(2, kFightSequenceType0);
				setSequenceAndDraw(2, kFightSequenceType2);
				break;

			case 4:
				setSequenceAndDraw(1, kFightSequenceType0);
				setSequenceAndDraw(2, kFightSequenceType2);
				break;

			case 5:
				setSequenceAndDraw(2, kFightSequenceType0);
				setSequenceAndDraw(1, kFightSequenceType2);
				break;
			}
		}

		// Update field_38
		_field_38 = 4 * _countdown;
	}

	if (_frame && checkFrame(2)) {
		if (_sequenceIndex == 1 || _sequenceIndex == 2 || _sequenceIndex == 5)
			_opponent->handleAction((FightAction)_sequenceIndex);

		if (_opponent->getCountdown() <= 0) {

			switch (_sequenceIndex) {
			default:
				break;

			case 1:
				setSequenceAndDraw(3, kFightSequenceType1);
				break;

			case 2:
				setSequenceAndDraw(4, kFightSequenceType1);
				break;

			case 5:
				setSequenceAndDraw(6, kFightSequenceType1);
				break;
			}

			_opponent->setSequenceAndDraw(4, kFightSequenceType1);

			handleAction(kFightActionLost);
			_opponent->update();
			Fighter::update();

			getSoundQueue()->stop(kEntityTables0);

			// Stop processing
			return;
		}
	}

	Fighter::update();
}
Ejemplo n.º 7
0
void Logic::eventMouse(const Common::Event &ev) {
	bool hotspotHandled = false;

	// Reset mouse flags
	getFlags()->mouseLeftClick = false;
	getFlags()->mouseRightClick = false;

	// Process event flags
	if (ev.type == Common::EVENT_LBUTTONDOWN) {

		if (getFlags()->frameInterval)
			_ignoreFrameInterval = false;

		getFlags()->frameInterval = false;
	}

	if (getFlags()->flag_0) {
		if (ev.type == Common::EVENT_LBUTTONDOWN || ev.type == Common::EVENT_RBUTTONDOWN) {
			getFlags()->flag_0 = false;
			getFlags()->shouldRedraw = true;
			updateCursor(true);
			getFlags()->frameInterval = true;
		}
		return;
	}

	if (_ignoreFrameInterval && getScenes()->checkCurrentPosition(true) && _engine->getCursor()->getStyle() == kCursorForward) {
		getFlags()->shouldRedraw = false;
		getFlags()->flag_0 = true;
		return;
	}

	// Update coordinates
	getGameState()->setCoordinates(ev.mouse);

	// Handle inventory
	getInventory()->handleMouseEvent(ev);

	// Stop processing is inside the menu
	if (getMenu()->isShown())
		return;

	// Handle whistle case
	if (getInventory()->getSelectedItem() == kItemWhistle
	 && !getProgress().isEggOpen
	 && !getEntities()->isPlayerPosition(kCarGreenSleeping, 59)
	 && !getEntities()->isPlayerPosition(kCarGreenSleeping, 76)
	 && !getInventory()->isPortraitHighlighted()
	 && !getInventory()->isOpened()
	 && !getInventory()->isEggHighlighted()
	 && !getInventory()->isMagnifierInUse()) {

		 // Update cursor
		_engine->getCursor()->setStyle(getInventory()->get(kItemWhistle)->cursor);

		// Check if clicked
		if (ev.type == Common::EVENT_LBUTTONUP && !getSoundQueue()->isBuffered("LIB045")) {

			getSound()->playSoundEvent(kEntityPlayer, 45);

			if (getEntities()->isPlayerPosition(kCarGreenSleeping, 26) || getEntities()->isPlayerPosition(kCarGreenSleeping, 25) || getEntities()->isPlayerPosition(kCarGreenSleeping, 23)) {
				getSavePoints()->push(kEntityPlayer, kEntityMertens, kAction226078300);
			} else if (getEntities()->isPlayerPosition(kCarRedSleeping, 26) || getEntities()->isPlayerPosition(kCarRedSleeping, 25) || getEntities()->isPlayerPosition(kCarRedSleeping, 23)) {
				getSavePoints()->push(kEntityPlayer, kEntityCoudert, kAction226078300);
			}

			if (!getState()->sceneUseBackup)
				getInventory()->unselectItem();
		}

		REDRAW_CURSOR()
	}