Example #1
0
void GameConversations::run(int id) {
	// If another conversation is running, then stop it first
	if (_runningConv)
		stop();

	// Get the next conversation to run
	_runningConv = getConv(id);
	if (!_runningConv)
		error("Specified conversation %d not loaded", id);

	// Initialize needed fields
	_startFrameNumber = _vm->_events->getFrameCounter();
	_playerEnabled = _vm->_game->_player._stepEnabled;
	_inputMode = _vm->_game->_screenObjects._inputMode;
	_heroTrigger = 0;
	_interlocutorTrigger = 0;
	_popupVisible = false;
	_currentMode = CONVMODE_0;
	_verbId = -1;
	_speakerVal = 1;
	_personSpeaking = 1;

	// Initialize speaker arrays
	Common::fill(&_speakerActive[0], &_speakerActive[MAX_SPEAKERS], false);
	Common::fill(&_speakerSeries[0], &_speakerSeries[MAX_SPEAKERS], -1);
	Common::fill(&_speakerFrame[0], &_speakerFrame[MAX_SPEAKERS], 1);
	Common::fill(&_popupX[0], &_popupX[MAX_SPEAKERS], POPUP_CENTER);
	Common::fill(&_popupY[0], &_popupY[MAX_SPEAKERS], POPUP_CENTER);
	Common::fill(&_popupMaxLen[0], &_popupMaxLen[MAX_SPEAKERS], 30);

	// Start the conversation
	start();

	// Setup variables to point to data in the speaker arrays
	setVariable(2, &_speakerVal);
	for (int idx = 0; idx < MAX_SPEAKERS; ++idx) {
		setVariable(3 + idx, &_speakerFrame[idx]);
		setVariable(8 + idx, &_popupX[idx]);
		setVariable(13 + idx, &_popupY[idx]);
		setVariable(18 + idx, &_popupMaxLen[idx]);
	}

	// Load sprite data for speaker portraits
	for (uint idx = 0; idx < _runningConv->_data._speakerCount; ++idx) {
		const Common::String &portraitName = _runningConv->_data._portraits[idx];
		_speakerSeries[idx] = _vm->_game->_scene._sprites.addSprites(portraitName, PALFLAG_RESERVED);

		if (_speakerSeries[idx] > 0) {
			_speakerActive[idx] = true;
			_speakerFrame[idx] = _runningConv->_data._speakerFrame[idx];
		}
	}

	// Refresh colors if needed
	if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE)
		_vm->_palette->refreshSceneColors();
}
Example #2
0
UGen UGenPlugin::constructGraph(UGen const& input)
{    
	UGen wet = getMappedParameterControl(UGenInterface::Parameters::Wet).lag();
	UGen dry = getMappedParameterControl(UGenInterface::Parameters::Dry).lag();

    plug = Plug::AR(UGen::emptyChannels(getNumOutputChannels()));
    
    if(irBuffer.isNull())
        plug.setSource(inputUGen);
    else
        plug.setSource(getConv());
    
    return (plug * wet.dbamp() + input * dry.dbamp());
}
Example #3
0
void UGenPlugin::replaceIR(Buffer const& newIRBuffer)
{
	if (newIRBuffer.isNull()) return;

    bufferLock.enter();
    irBuffer = newIRBuffer.zap().normalise();
    bufferLock.exit();
    
    UGenEditorComponent* editor = static_cast<UGenEditorComponent*> (getActiveEditor());
    
    if (editor != 0)
        editor->setIRDisplay(irBuffer);
    
    UGen conv = getConv();

    const ScopedLock sl(outputLock);
    plug.fadeSourceAndRelease(conv, 0.1f);
}
Example #4
0
void GameConversations::run(int id) {
	// If another conversation is running, then stop it first
	if (_runningConv)
		stop();

	// Get the next conversation to run
	_runningConv = getConv(id);
	if (!_runningConv)
		error("Specified conversation %d not loaded", id);

	// Initialize needed fields
	_startFrameNumber = _vm->_events->getFrameCounter();
	_playerEnabled = _vm->_game->_player._stepEnabled;
	_inputMode = _vm->_game->_screenObjects._inputMode;
	_val1 = _val2 = _val3 = 0;
	_val4 = 0;
	_val5 = -1;

	// Initialize speaker arrays
	Common::fill(&_speakerActive[0], &_speakerActive[MAX_SPEAKERS], false);
	Common::fill(&_speakerPortraits[0], &_speakerPortraits[MAX_SPEAKERS], -1);
	Common::fill(&_speakerExists[0], &_speakerExists[MAX_SPEAKERS], 1);
	Common::fill(&_arr4[0], &_arr4[MAX_SPEAKERS], 0x8000);
	Common::fill(&_arr5[0], &_arr5[MAX_SPEAKERS], 0x8000);
	Common::fill(&_arr6[0], &_arr6[MAX_SPEAKERS], 30);

	// Start the conversation
	start();

	// Set variables
	setVariable(2, 0x4F78);
	setVariable(3, 0x4F50);
	setVariable(4, 0x4F52);
	setVariable(5, 0x4F54);
	setVariable(6, 0x4F56);
	setVariable(7, 0x4F58);
	setVariable(8, 0x4F5A);
	setVariable(9, 0x4F5C);
	setVariable(10, 0x4F5E);
	setVariable(11, 0x4F60);
	setVariable(12, 0x4F62);
	setVariable(13, 0x4F64);
	setVariable(14, 0x4F66);
	setVariable(15, 0x4F68);
	setVariable(16, 0x4F6A);
	setVariable(17, 0x4F6C);
	setVariable(18, 0x4F6E);
	setVariable(19, 0x4F70);
	setVariable(20, 0x4F72);
	setVariable(21, 0x4F74);
	setVariable(22, 0x4F76);

	// Load sprite data for speaker portraits
	for (uint idx = 0; idx < _runningConv->_data._speakerCount; ++idx) {
		const Common::String &portraitName = _runningConv->_data._portraits[idx];
		_speakerPortraits[idx] = _vm->_game->_scene._sprites.addSprites(portraitName, PALFLAG_RESERVED);

		if (_speakerPortraits[idx] > 0) {
			_speakerActive[idx] = true;
			_speakerExists[idx] = _runningConv->_data._speakerExists[idx];
		}
	}

	// Refresh colors if needed
	if (_vm->_game->_kernelMode == KERNEL_ACTIVE_CODE)
		_vm->_palette->refreshSceneColors();
}