TalkSound() публичный Метод

public TalkSound ( int a, int b, int mode, int channel ) : void
a int
b int
mode int
channel int
Результат void
Пример #1
0
        void DebugMessage(byte[] msg)
        {
            var buffer = new byte[500];

            ConvertMessageToString(msg, buffer, 0);

            if ((buffer[0] != 0xFF))
            {
                Debug.WriteLine("DEBUG: {0}", buffer.GetText());
                return;
            }

            if (buffer[0] == 0xFF && buffer[1] == 10)
            {
                int channel = 0;

                var a = buffer[2] | (buffer[3] << 8) | (buffer[6] << 16) | (buffer[7] << 24);
                var b = buffer[10] | (buffer[11] << 8) | (buffer[14] << 16) | (buffer[15] << 24);

                // Sam and Max uses a caching system, printing empty messages
                // and setting VAR_V6SoundMODE beforehand. See patch 609791.
                if (_game.GameId == Scumm.IO.GameId.SamNMax)
                {
                    channel = Variables[VariableV6SoundMode.Value];
                }

                if (channel != 2)
                {
                    Sound.TalkSound(a, b, 1, channel);
                }
            }
        }
Пример #2
0
        void PlaySpeech(byte[] ptr)
        {
            if (Game.GameId == GameId.Dig && /*(ConfMan.getBool("speech_mute") ||*/ Variables[VariableVoiceMode.Value] == 2)
            {
                return;
            }

            if ((Game.GameId == GameId.Dig || Game.GameId == GameId.CurseOfMonkeyIsland) && ptr[0] != 0)
            {
                var count = Array.IndexOf(ptr, (byte)0);
                if (count < 0)
                {
                    count = ptr.Length - 1;
                }
                var pointer = ptr.GetText(0, count);

                // Play speech
                if (!Game.Features.HasFlag(GameFeatures.Demo) && Game.GameId == GameId.CurseOfMonkeyIsland) // CMI demo does not have .IMX for voice
                {
                    pointer += ".IMX";
                }

                Sound.StopTalkSound();
                IMuseDigital.StopSound(Sound.TalkSoundID);
                IMuseDigital.StartVoice(Sound.TalkSoundID, pointer);
                Sound.TalkSound(0, 0, 2);
            }
        }
Пример #3
0
        internal bool HandleNextCharsetCode(Actor a, ref int code)
        {
            int  color, frme, c = 0, oldy;
            bool endLoop = false;

            var bufferPos = _charsetBufPos;

            while (!endLoop)
            {
                c = _charsetBuffer[bufferPos++];
                if (!(c == 0xFF || (Game.Version <= 6 && c == 0xFE)))
                {
                    break;
                }
                c = _charsetBuffer[bufferPos++];

                if (NewLineCharacter != 0 && c == NewLineCharacter)
                {
                    c = 13;
                    break;
                }

                switch (c)
                {
                case 1:
                    c       = 13; // new line
                    endLoop = true;
                    break;

                case 2:
                    _haveMsg  = 0;
                    _keepText = true;
                    endLoop   = true;
                    break;

                case 3:
                    _haveMsg  = (_game.Version >= 7) ? 1 : 0xFF;
                    _keepText = false;
                    endLoop   = true;
                    break;

                case 8:
                    // Ignore this code here. Occurs e.g. in MI2 when you
                    // talk to the carpenter on scabb island. It works like
                    // code 1 (=newline) in verb texts, but is ignored in
                    // spoken text (i.e. here). Used for very long verb
                    // sentences.
                    break;

                case 9:
                    frme       = _charsetBuffer[bufferPos] | (_charsetBuffer[bufferPos + 1] << 8);
                    bufferPos += 2;
                    if (a != null)
                    {
                        a.StartAnimActor(frme);
                    }
                    break;

                case 10:
                    // Note the similarity to the code in debugMessage()
                {
                    var talkSound_a = (_charsetBuffer[bufferPos] | (_charsetBuffer[bufferPos + 1] << 8) | (_charsetBuffer[bufferPos + 4] << 16) | (_charsetBuffer[bufferPos + 5] << 24));
                    var talkSound_b = (_charsetBuffer[bufferPos + 8] | (_charsetBuffer[bufferPos + 9] << 8) | (_charsetBuffer[bufferPos + 12] << 16) | (_charsetBuffer[bufferPos + 13] << 24));
                    bufferPos += 14;
                    Sound.TalkSound(talkSound_a, talkSound_b, 2);
                    _haveActorSpeechMsg = false;
                }
                break;

                case 12:
                    color      = _charsetBuffer[bufferPos] | (_charsetBuffer[bufferPos + 1] << 8);
                    bufferPos += 2;
                    if (color == 0xFF)
                    {
                        _charset.SetColor(_charsetColor);
                    }
                    else
                    {
                        _charset.SetColor((byte)color);
                    }
                    break;

                case 13:
                    //debug(0, "handleNextCharsetCode: Unknown opcode 13 %d", READ_LE_UINT16(buffer));
                    bufferPos += 2;
                    break;

                case 14:
                    oldy = _charset.GetFontHeight();
                    _charset.SetCurID(_charsetBuffer[bufferPos++]);
                    bufferPos += 2;
                    Array.Copy(_charsetData[_charset.GetCurId()], CharsetColorMap, 4);
                    _nextTop -= _charset.GetFontHeight() - oldy;
                    break;

                default:
                    throw new NotSupportedException(string.Format("handleNextCharsetCode: invalid code {0}", c));
                }
            }
            _charsetBufPos = bufferPos;
            code           = c;
            return(c != 2 && c != 3);
        }