Ejemplo n.º 1
0
bool CAutoMusicPlayerBase::ChangeMusicMsg(CChangeMusicMsg *msg) {
	if (_isEnabled && msg->_action == MUSIC_STOP) {
		_isEnabled = false;
		stopAmbientSound(_transition, -1);
	}

	if (!msg->_filename.empty()) {
		_filename = msg->_filename;

		if (_isEnabled) {
			stopAmbientSound(_transition, -1);
			playAmbientSound(_filename, _volumeMode, _initialMute, true, 0,
				Audio::Mixer::kMusicSoundType);
		}
	}

	if (!_isEnabled && msg->_action == MUSIC_START) {
		_isEnabled = true;
		playAmbientSound(_filename, _volumeMode, _initialMute, true, 0,
			Audio::Mixer::kMusicSoundType);
	}

	return true;
}
Ejemplo n.º 2
0
bool CSeasonalMusicPlayer::ChangeMusicMsg(CChangeMusicMsg *msg) {
	if (_isEnabled && msg->_action == MUSIC_STOP) {
		_isEnabled = false;
		stopAmbientSound(_transition, -1);
	}

	if (!msg->_filename.empty()) {
		if (_isSummer) {
			setAmbientSoundVolume(VOL_MUTE, 2, 0);
			setAmbientSoundVolume(VOL_QUIET, 2, 1);
		} else if (_isAutumn) {
			setAmbientSoundVolume(VOL_MUTE, 2, 1);
			setAmbientSoundVolume(VOL_QUIET, 2, 2);
		} else if (_isWinter) {
			setAmbientSoundVolume(VOL_MUTE, 2, 2);
			setAmbientSoundVolume(VOL_QUIET, 2, 3);
		} else if (_isSpring) {
			setAmbientSoundVolume(VOL_MUTE, 2, 3);
			setAmbientSoundVolume(VOL_QUIET, 2, 0);
		}
	}

	if (!_isEnabled && msg->_action == MUSIC_START) {
		_isEnabled = true;
		loadSound(TRANSLATE("c#64.wav", "c#47.wav"));
		loadSound(TRANSLATE("c#63.wav", "c#46.wav"));
		loadSound(TRANSLATE("c#65.wav", "c#48.wav"));
		loadSound(TRANSLATE("c#62.wav", "c#47.wav"));
		playAmbientSound(TRANSLATE("c#64.wav", "c#47.wav"), _springMode, _isSpring, true, 0);
		playAmbientSound(TRANSLATE("c#63.wav", "c#46.wav"), _summerMode, _isSummer, true, 1);
		playAmbientSound(TRANSLATE("c#65.wav", "c#48.wav"), _autumnMode, _isAutumn, true, 2);
		playAmbientSound(TRANSLATE("c#62.wav", "c#47.wav"), _winterMode, _isWinter, true, 3);
	}

	return true;
}
Ejemplo n.º 3
0
bool CAutoMusicPlayerBase::LoadSuccessMsg(CLoadSuccessMsg *msg) {
	if (_isEnabled) {
		// WORKAROUND: A problem was encountered with the EmbLobby music player
		// not getting turned off when room was left, so was turned on again
		// when loading a savegame elsewhere. This guards against it
		CRoomItem *newRoom = getGameManager()->getRoom();
		if (findRoom() != newRoom) {
			_isEnabled = false;
			return true;
		}

		playAmbientSound(_filename, _volumeMode, _initialMute, true, 0,
			Audio::Mixer::kMusicSoundType);
	}

	return true;
}
Ejemplo n.º 4
0
void Area::show() {
	assert(_loaded);

	if (_visible)
		return;

	playAmbientSound();
	playAmbientMusic();

	GfxMan.lockFrame();

	// Show rooms
	for (std::vector<Room *>::iterator r = _rooms.begin(); r != _rooms.end(); ++r)
		(*r)->model->show();

	// Show objects
	for (ObjectList::iterator o = _objects.begin(); o != _objects.end(); ++o)
		(*o)->show();

	GfxMan.unlockFrame();

	_visible = true;
}
Ejemplo n.º 5
0
void Area::show() {
	if (_visible)
		return;

	loadModels();

	GfxMan.lockFrame();

	// Show tiles
	for (std::vector<Tile>::iterator t = _tiles.begin(); t != _tiles.end(); ++t)
		t->model->show();

	// Show objects
	for (ObjectList::iterator o = _objects.begin(); o != _objects.end(); ++o)
		(*o)->show();

	GfxMan.unlockFrame();

	// Play music and sound
	playAmbientSound();
	playAmbientMusic();

	_visible = true;
}