Exemplo n.º 1
0
void IMuseDigital::playDigMusic(const char *songName, const imuseDigTable *table, int attribPos, bool sequence) {
	int hookId = 0;

	if (songName != NULL) {
		if ((_attributes[DIG_SEQ_OFFSET + 38]) && (!_attributes[DIG_SEQ_OFFSET + 41])) {
			if ((attribPos == 43) || (attribPos == 44))
				hookId = 3;
		}

		if ((_attributes[DIG_SEQ_OFFSET + 46] != 0) && (_attributes[DIG_SEQ_OFFSET + 48] == 0)) {
			if ((attribPos == 38) || (attribPos == 39))
				hookId = 3;
		}

		if ((_attributes[DIG_SEQ_OFFSET + 53] != 0)) {
			if ((attribPos == 50) || (attribPos == 51))
				hookId = 3;
		}

		if ((attribPos != 0) && (hookId == 0)) {
			if (table->attribPos != 0)
				attribPos = table->attribPos;
			hookId = _attributes[DIG_STATE_OFFSET + attribPos];
			if (table->hookId != 0) {
				if ((hookId != 0) && (table->hookId > 1)) {
					_attributes[DIG_STATE_OFFSET + attribPos] = 2;
				} else {
					_attributes[DIG_STATE_OFFSET + attribPos] = hookId + 1;
					if (table->hookId < hookId + 1)
						_attributes[DIG_STATE_OFFSET + attribPos] = 1;
				}
			}
		}
	}

	if (!songName) {
		fadeOutMusic(120);
		return;
	}

	switch (table->transitionType) {
	case 0:
	case 5:
		break;
	case 3:
	case 4:
		if (table->filename[0] == 0) {
			fadeOutMusic(60);
			return;
		}
		if (table->transitionType == 4)
			_stopingSequence = 1;
		if ((!sequence) && (table->attribPos != 0) &&
				(table->attribPos == _digStateMusicTable[_curMusicState].attribPos)) {
			fadeOutMusicAndStartNew(108, table->filename, table->soundId);
		} else {
			fadeOutMusic(108);
			startMusic(table->filename, table->soundId, hookId, 127);
		}
		break;
	case 6:
		_stopingSequence = 1;
		break;
	}
}
Exemplo n.º 2
0
void IMuseDigital::playComiMusic(const char *songName, const imuseComiTable *table, int attribPos, bool sequence) {
	int hookId = 0;

	if ((songName != NULL) && (attribPos != 0)) {
		if (table->attribPos != 0)
			attribPos = table->attribPos;
		hookId = _attributes[COMI_STATE_OFFSET + attribPos];
		if (table->hookId != 0) {
			if ((hookId != 0) && (table->hookId > 1)) {
				_attributes[COMI_STATE_OFFSET + attribPos] = 2;
			} else {
				_attributes[COMI_STATE_OFFSET + attribPos] = hookId + 1;
				if (table->hookId < hookId + 1)
					_attributes[COMI_STATE_OFFSET + attribPos] = 1;
			}
		}
	}

	if (!songName) {
		fadeOutMusic(120);
		return;
	}

	switch (table->transitionType) {
	case 0:
		break;
	case 8:
		setHookIdForMusic(table->hookId);
		break;
	case 9:
		_stopingSequence = 1;
		setHookIdForMusic(table->hookId);
		break;
	case 2:
	case 3:
	case 4:
	case 12:
		if (table->filename[0] == 0) {
			fadeOutMusic(60);
			return;
		}
		if (getCurMusicSoundId() == table->soundId)
			return;
		if (table->transitionType == 4)
			_stopingSequence = 1;
		if (table->transitionType == 2) {
			fadeOutMusic(table->fadeOutDelay);
			startMusic(table->filename, table->soundId, table->hookId, 127);
			return;
		}
		if ((!sequence) && (table->attribPos != 0) &&
				(table->attribPos == _comiStateMusicTable[_curMusicState].attribPos)) {
			fadeOutMusicAndStartNew(table->fadeOutDelay, table->filename, table->soundId);
		} else if (table->transitionType == 12) {
			TriggerParams trigger;
			strcpy(trigger.marker, "exit"); trigger.fadeOutDelay = table->fadeOutDelay;
			strcpy(trigger.filename, table->filename); trigger.soundId = table->soundId;
			trigger.hookId = table->hookId; trigger.volume = 127;
			setTrigger(&trigger);
		} else {
			fadeOutMusic(table->fadeOutDelay);
			startMusic(table->filename, table->soundId, hookId, 127);
		}
		break;
	}
}
Exemplo n.º 3
0
void Imuse::playMusic(const ImuseTable *table, int atribPos, bool sequence) {
	int hookId = 0;

	if (atribPos) {
		if (table->atribPos)
			atribPos = table->atribPos;
		hookId = _attributes[atribPos];
		if (table->hookId) {
			if (hookId && table->hookId > 1) {
				_attributes[atribPos] = 2;
			} else {
				_attributes[atribPos] = hookId + 1;
				if (table->hookId < hookId + 1)
					_attributes[atribPos] = 1;
			}
		}
	}
	if (hookId == 0)
		hookId = 100;

	if (table->opcode == 0) {
		fadeOutMusic(120);
		return;
	}

	if (table->opcode == 2 || table->opcode == 3) {
		if (table->filename[0] == 0) {
			fadeOutMusic(60);
			return;
		}
		char *soundName = getCurMusicSoundName();
		int pan;

		if (table->pan == 0)
			pan = 64;
		else
			pan = table->pan;
		if (!soundName) {
			startMusic(table->filename, hookId, 0, pan);
			setVolume(table->filename, 0);
			setFadeVolume(table->filename, table->volume, table->fadeOut60TicksDelay);
			return;
		}
		int old_pan = getCurMusicPan();
		int old_vol = getCurMusicVol();
		if (old_pan == -1)
			old_pan = 64;
		if (old_vol == -1)
			old_vol = 127;

		if (table->opcode == 2) {
			fadeOutMusic(table->fadeOut60TicksDelay);
			startMusic(table->filename, hookId, table->volume, pan);
			setVolume(table->filename, 0);
			setFadeVolume(table->filename, table->volume, table->fadeOut60TicksDelay);
			setFadePan(table->filename, pan, table->fadeOut60TicksDelay);
			return;
		}
		if (strcmp(soundName, table->filename) == 0) {
			setFadeVolume(soundName, table->volume, table->fadeOut60TicksDelay);
			setFadePan(soundName, pan, table->fadeOut60TicksDelay);
			return;
		}

		if (!sequence && table->atribPos && table->atribPos == _stateMusicTable[_curMusicState].atribPos) {
			fadeOutMusicAndStartNew(table->fadeOut60TicksDelay, table->filename, hookId, old_vol, old_pan);
			setVolume(table->filename, 0);
			setFadeVolume(table->filename, table->volume, table->fadeOut60TicksDelay);
			setFadePan(table->filename, pan, table->fadeOut60TicksDelay);
		} else {
			fadeOutMusic(table->fadeOut60TicksDelay);
			startMusic(table->filename, hookId, table->volume, pan);
			setVolume(table->filename, 0);
			setFadeVolume(table->filename, table->volume, table->fadeOut60TicksDelay);
		}
	}
}