Exemple #1
0
bool CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg) {
	_npcFlags |= NPCFLAG_SPEAKING;
	++_field100;

	if (!(_npcFlags & NPCFLAG_8)) {
		if (_speechTimerId)
			stopTimer(_speechTimerId);

		_soundId = msg->_soundId;
		_fieldF0 = getTicksCount();

		if (hasActiveMovie() || (_npcFlags & NPCFLAG_2)) {
			_npcFlags &= ~NPCFLAG_2;
			stopMovie();

			CNPCPlayTalkingAnimationMsg msg1(_soundId, 0, 0);
			msg1.execute(this);

			if (msg1._names) {
				CNPCPlayAnimationMsg msg2(msg1._names, msg1._value1);
				msg2.execute(this);
			}
		}
	}

	return true;
}
Exemple #2
0
bool CTrueTalkNPC::TrueTalkNotifySpeechStartedMsg(CTrueTalkNotifySpeechStartedMsg *msg) {
	debugC(ERROR_DETAILED, kDebugScripts, "%s TrueTalkNotifySpeechStartedMsg flags=%x dialogueId=%d",
		getName().c_str(), _npcFlags, msg->_dialogueId);

	_npcFlags |= NPCFLAG_SPEAKING;
	++_speechCounter;

	if (!(_npcFlags & NPCFLAG_8)) {
		// Stop any previous animation
		if (_speechTimerId)
			stopAnimTimer(_speechTimerId);
		_speechTimerId = 0;

		_speechDuration = msg->_speechDuration;
		_startTicks = getTicksCount();

		if (!hasActiveMovie() || (_npcFlags & NPCFLAG_IDLING)) {
			_npcFlags &= ~NPCFLAG_IDLING;
			stopMovie();

			CNPCPlayTalkingAnimationMsg msg1(_speechDuration, 0, nullptr);
			msg1.execute(this);

			if (msg1._names) {
				CNPCPlayAnimationMsg msg2(msg1._names, msg1._speechDuration);
				msg2.execute(this);
			}
		}
	}

	return true;
}
Exemple #3
0
bool CParrot::FrameMsg(CFrameMsg *msg) {
	if (compareViewNameTo("ParrotLobby.Node 1.N"))
		return false;
	if (_v4)
		return true;

	Point pt = getMousePos();
	CGameObject *dragObject = getDraggingObject();
	int xp = _bounds.left + _bounds.width() / 2;

	if ((_npcFlags & NPCFLAG_400000) && !hasActiveMovie()) {
		_field128 = xp - (_field124 + _bounds.width() / 2);

		if (xp < 64) {
			if (_field134) {
				CActMsg actMsg("PanAwayFromParrot");
				actMsg.execute(_field134);
			}

			_npcFlags &= ~(NPCFLAG_10000 | NPCFLAG_20000 | NPCFLAG_40000
				| NPCFLAG_80000 | NPCFLAG_100000 | NPCFLAG_200000 | NPCFLAG_400000);
			return true;
		}
	}

	bool chickenFlag = dragObject && dragObject->isEquals("Chicken");

	if (_npcFlags & NPCFLAG_1000000) {
		if (!chickenFlag || pt.x > 70 || pt.y < 90 || pt.y > 280) {
			stopMovie();
			loadFrame(0);
			setPosition(Point(-90, _bounds.top));
		}
	} else {
		if (!chickenFlag)
			return false;
	}

	_field128 = CLIP((int)pt.x, 230, 480);
	if ((_npcFlags & NPCFLAG_10000) || hasActiveMovie())
		return true;

	if (_field128 > 64) {
		_npcFlags |= NPCFLAG_10000 | NPCFLAG_20000;

		if (_field128 >= xp) {
			setPosition(Point(_bounds.left + 30, _bounds.top));
			_npcFlags |= NPCFLAG_200000;
			playClip("Walk Right Intro", MOVIE_NOTIFY_OBJECT);
		} else {
			_npcFlags |= NPCFLAG_100000;
			playClip("Walk Left Intro", MOVIE_NOTIFY_OBJECT);
		}
	} else if (chickenFlag && pt.y >= 90 && pt.y <= 280 && !_field12C) {
		CParrotTriesChickenMsg triesMsg;
		triesMsg.execute(dragObject);

		CTrueTalkTriggerActionMsg triggerMsg;
		int id;
		switch (triesMsg._value2) {
		case 1:
			id = 280056 + (triesMsg._value1 ? 234 : 0);
			break;
		case 2:
			id = 280055 + (triesMsg._value1 ? 234 : 0);
			break;
		case 3:
			id = 280054 + (triesMsg._value1 ? 234 : 0);
			break;
		default:
			id = 280053 + (triesMsg._value1 ? 234 : 0);
			break;
		}

		if (id < 280266) {
			if (pt.x < 75) {
				_npcFlags |= NPCFLAG_1000000;
				playClip("Walk Left Intro", MOVIE_STOP_PREVIOUS);
				playClip("Walk Left Loop", MOVIE_NOTIFY_OBJECT);
				movieEvent(236);
				chickenFlag = false;
			} else if ((pt.x - xp) > 15) {
				_npcFlags |= NPCFLAG_800000;
				playClip("Peck At Feet Right", MOVIE_NOTIFY_OBJECT);
				movieEvent(170);
			} else if ((xp - pt.x) > 15) {
				_npcFlags |= NPCFLAG_800000;
				playClip("Peck At Feet Left", MOVIE_NOTIFY_OBJECT);
				movieEvent(142);
			} else {
				_npcFlags |= NPCFLAG_800000;
				playClip("Peck At Feet", MOVIE_NOTIFY_OBJECT);
				movieEvent(157);
			}
		}

		if (chickenFlag) {
			triggerMsg._param2 = 1;
			triggerMsg.execute(this);
			_field12C = 1;
		}
	}

	return true;
}