Exemplo n.º 1
0
void DialogueManager::nextAnswer() {
	if (_q->_answers[0] == NULL) {
		transitionToState(DIALOGUE_OVER);
		return;
	}

	// try and check if there are any suitable answers,
	// given the current game state.
	addVisibleAnswers(_q);
	if (!_numVisAnswers) {
		// if there are no answers, then chicken out
		transitionToState(DIALOGUE_OVER);
		return;
	}

	if (_visAnswers[0]._a->textIsNull()) {
		// if the first answer is null (it's implied that it's the
		// only one because we already called addVisibleAnswers),
		// then jump to the next question
		_answerId = _visAnswers[0]._index;
		transitionToState(NEXT_QUESTION);
	} else {
		// at this point we are sure there are non-null answers to show
		displayAnswers();
		transitionToState(RUN_ANSWER);
	}
}
Exemplo n.º 2
0
bool DialogueManager::displayAnswers() {

	addVisibleAnswers(_q);
	if (_numVisAnswers == 0) {
		return false;
	}

	// create balloons
	int id;
	for (int i = 0; i < _numVisAnswers; ++i) {
		id = _vm->_balloonMan->setDialogueBalloon(_visAnswers[i]._a->_text.c_str(), 1, BalloonManager::kUnselectedColor);
		assert(id >= 0);
		_visAnswers[i]._balloon = id;

	}

	int mood = 0;
	if (_numVisAnswers == 1) {
		mood = _visAnswers[0]._a->_mood & 0xF;
		_vm->_balloonMan->setBalloonText(_visAnswers[0]._balloon, _visAnswers[0]._a->_text.c_str(), BalloonManager::kNormalColor);
	} else
	if (_numVisAnswers > 1) {
		mood = _visAnswers[0]._a->_mood & 0xF;
		_oldSelection = -1;
		_selection = 0;
	}

	_faceId = _vm->_gfx->setItem(_answerer, _ballonPos._answerChar.x, _ballonPos._answerChar.y);
	_vm->_gfx->setItemFrame(_faceId, mood);

	return true;
}