Esempio n. 1
0
        void PlayComiMusic(string songName, ImuseComiTable table, int attribPos, bool sequence)
        {
            int hookId = 0;

            if ((songName != null) && (attribPos != 0))
            {
                if (table.AttribPos != 0)
                {
                    attribPos = table.AttribPos;
                }
                hookId = _attributes[ComiStateOffset + attribPos];
                if (table.HookId != 0)
                {
                    if ((hookId != 0) && (table.HookId > 1))
                    {
                        _attributes[ComiStateOffset + attribPos] = 2;
                    }
                    else
                    {
                        _attributes[ComiStateOffset + attribPos] = hookId + 1;
                        if (table.HookId < hookId + 1)
                        {
                            _attributes[ComiStateOffset + attribPos] = 1;
                        }
                    }
                }
            }

            if (string.IsNullOrEmpty(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;
                    trigger.Marker       = "exit";
                    trigger.FadeOutDelay = table.FadeOutDelay;
                    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;
            }
        }
Esempio n. 2
0
        void PlayComiMusic(string songName, ImuseComiTable table, int attribPos, bool sequence)
        {
            int hookId = 0;

            if ((songName != null) && (attribPos != 0))
            {
                if (table.AttribPos != 0)
                    attribPos = table.AttribPos;
                hookId = _attributes[ComiStateOffset + attribPos];
                if (table.HookId != 0)
                {
                    if ((hookId != 0) && (table.HookId > 1))
                    {
                        _attributes[ComiStateOffset + attribPos] = 2;
                    }
                    else
                    {
                        _attributes[ComiStateOffset + attribPos] = hookId + 1;
                        if (table.HookId < hookId + 1)
                            _attributes[ComiStateOffset + attribPos] = 1;
                    }
                }
            }

            if (string.IsNullOrEmpty(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;
                        trigger.Marker = "exit";
                        trigger.FadeOutDelay = table.FadeOutDelay;
                        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;
            }
        }