Example #1
0
 public Gdi(ScummEngine vm, GameInfo game)
 {
     _vm = vm;
     this.game = game;
     maskBuffer = new byte[4][];
     for (int i = 0; i < maskBuffer.Length; i++)
     {
         maskBuffer[i] = new byte[NumStrips * (200 + 4)];
     }
     IsZBufferEnabled = true;
     _gfxUsageBits = new uint[410 * 3];
     // Increase the number of screen strips by one; needed for smooth scrolling
     if (game.Version >= 7)
     {
         // We now have mostly working smooth scrolling code in place for V7+ games
         // (i.e. The Dig, Full Throttle and COMI). It seems to work very well so far.
         //
         // To understand how we achieve smooth scrolling, first note that with it, the
         // virtual screen strips don't match the display screen strips anymore. To
         // overcome that problem, we simply use a screen pitch that is 8 pixel wider
         // than the actual screen width, and always draw one strip more than needed to
         // the backbuf (thus we have to treat the right border seperately).
         NumStrips += 1;
     }
 }
Example #2
0
        public Player_V2A(ScummEngine scumm, IPlayerMod modPlayer)
        {
            _vm = scumm;

            _mod = modPlayer;
            _mod.SetUpdateProc(UpdateSound, 60);
        }
Example #3
0
        public Player_SID(ScummEngine scumm, IMixer mixer, ISid sid)
        {
            _sid = sid;
            for (int i = 0; i < 7; ++i)
            {
                _soundQueue[i] = -1;
            }

            _mixer = mixer;
            _sampleRate = _mixer.OutputRate;
            _vm = scumm;

            // sound speed is slightly different on NTSC and PAL machines
            // as the SID clock depends on the frame rate.
            // ScummVM does not distinguish between NTSC and PAL targets
            // so we use the NTSC timing here as the music was composed for
            // NTSC systems (music on PAL systems is slower).
            _videoSystem = VideoStandard.Ntsc;

            resStatus[1] = 0;
            resStatus[2] = 0;

            InitSID();
            ResetSID();

            _soundHandle = _mixer.PlayStream(SoundType.Plain, this, -1, Mixer.MaxChannelVolume, 0, false, true);
        }
Example #4
0
        public Player_V2(ScummEngine scumm, IMixer mixer, bool pcjr)
            : base(scumm, mixer, pcjr)
        {
            // Initialize square generator
            _level = 0;

            _RNG = NG_PRESET;

            if (_pcjr)
            {
                _decay = PCJR_DECAY;
                _update_step = (((uint)_sampleRate << FIXP_SHIFT) / (111860 * 2));
            }
            else
            {
                _decay = SPK_DECAY;
                _update_step = (((uint)_sampleRate << FIXP_SHIFT) / (1193000 * 2));
            }

            // Adapt _decay to sample rate.  It must be squared when
            // sample rate doubles.
            for (var i = 0; (_sampleRate << i) < 30000; i++)
                _decay = _decay * _decay / 65536;

            _timer_output = 0;
            for (var i = 0; i < 4; i++)
                _timer_count[i] = 0;

            SetMusicVolume(255);

            _soundHandle = _mixer.PlayStream(SoundType.Plain, this, -1, Mixer.MaxChannelVolume, 0, false, true);
        }
Example #5
0
 public NutRenderer(ScummEngine vm, string filename)
 {
     _vm = vm;
     var directory = ServiceLocator.FileStorage.GetDirectoryName(_vm.Game.Path);
     var path = ScummHelper.LocatePath(directory, filename);
     LoadFont(path);
 }
Example #6
0
        public Player_V3A(ScummEngine scumm, IPlayerMod mod)
        {
            _vm = scumm;
            for (var i = 0; i < V3A_MAXMUS; i++)
            {
                _mus[i].id = 0;
                _mus[i].dur = 0;
            }
            for (var i = 0; i < V3A_MAXSFX; i++)
            {
                _sfx[i].id = 0;
                _sfx[i].dur = 0;
            }

            _curSong = 0;
            _songData = null;
            _songPtr = 0;
            _songDelay = 0;

            _music_timer = 0;

            _isinit = false;

            _mod = mod;
            _mod.SetUpdateProc(playMusic, 60);
        }
Example #7
0
        protected Player_V2Base(ScummEngine scumm, IMixer mixer, bool pcjr)
        {
            _vm = scumm;
            _mixer = mixer;
            _pcjr = pcjr;
            _sampleRate = _mixer.OutputRate;

            _isV3Game = (scumm.Game.Version >= 3);

            _header_len = scumm.Game.IsOldBundle ? 4 : 6;

            // Initialize sound queue
            _current_nr = _next_nr = 0;
            _current_data = _next_data = null;

            // Initialize channel code
            for (int i = 0; i < 4; ++i)
                ClearChannel(i);

            _next_tick = 0;
            _tick_len = (uint)(_sampleRate << FIXP_SHIFT) / FREQ_HZ;

            // Initialize V3 music timer
            _music_timer_ctr = _music_timer = 0;
            _ticks_per_music_timer = 65535;

            if (_pcjr)
            {
                _freqs_table = pcjr_freq_table;
            }
            else
            {
                _freqs_table = spk_freq_table;
            }
        }
Example #8
0
 public ImuseDigiSndMgr(ScummEngine scumm)
 {
     _vm = scumm;
     _disk = 0;
     _cacheBundleDir = new BundleDirCache();
     BundleCodecs.InitializeImcTables();
 }
Example #9
0
 public SmushFont(ScummEngine vm, string filename, bool use_original_colors, bool new_colors)
     : base(vm, filename)
 {
     _color = -1;
     _new_colors = new_colors;
     _original = use_original_colors;
 }
Example #10
0
 protected Player_Towns(ScummEngine vm, bool isVersion2)
 {
     _vm = vm;
     _v2 = isVersion2;
     _numSoundMax = isVersion2 ? 256 : 200;
     _unkFlags = 0x33;
 }
Example #11
0
 public Player_Towns_v2(ScummEngine vm, IMixer mixer, IIMuse imuse, bool disposeIMuse)
     : base(vm, true)
 {
     _imuse = imuse;
     _imuseDispose = disposeIMuse;
     _soundOverride = new SoundOvrParameters[_numSoundMax];
     _intf = new TownsAudioInterface(mixer, null);
 }
Example #12
0
        public CharsetRenderer2(ScummEngine vm)
            : base(vm)
        {
            _fontHeight = 8;
            CurId = 0;

            byte[] replacementData = null;
            int replacementChars = 0;

            switch (vm.Game.Culture.TwoLetterISOLanguageName)
            {
                case "de":
                    if (vm.Game.Version == 0)
                    {
                        replacementData = germanCharsetDataV0;
                        replacementChars = germanCharsetDataV0.Length / 2;
                    }
                    else
                    {
                        replacementData = germanCharsetDataV2;
                        replacementChars = germanCharsetDataV2.Length / 2;
                    }
                    break;
                case "fr":
                    replacementData = frenchCharsetDataV2;
                    replacementChars = frenchCharsetDataV2.Length / 2;
                    break;
                case "it":
                    replacementData = italianCharsetDataV2;
                    replacementChars = italianCharsetDataV2.Length / 2;
                    break;
                case "es":
                    replacementData = spanishCharsetDataV2;
                    replacementChars = spanishCharsetDataV2.Length / 2;
                    break;
                case "ru":
                    _fontPtr = russianCharsetDataV2;
                    break;
                default:
                    _fontPtr = englishCharsetDataV2;
                    break;
            }

            if (replacementData != null)
            {
                _fontPtr = new byte[englishCharsetDataV2.Length];
                Array.Copy(englishCharsetDataV2, _fontPtr, englishCharsetDataV2.Length);

                for (int i = 0; i < replacementChars; i++)
                {
                    int ch1 = replacementData[2 * i];
                    int ch2 = replacementData[2 * i + 1];

                    Array.Copy(specialCharsetData, 8 * ch2, _fontPtr, 8 * ch1, 8);
                }
            }
        }
Example #13
0
 public Player_AppleII(ScummEngine scumm, IMixer mixer)
 {
     _mixer = mixer;
     _vm = scumm;
     _sampleConverter = new SampleConverter();
     ResetState();
     SetSampleRate(_mixer.OutputRate);
     _soundHandle = _mixer.PlayStream(SoundType.Plain, this, -1, Mixer.MaxChannelVolume, 0, false, true);
 }
Example #14
0
        public Player_Towns_v1(ScummEngine vm, IMixer mixer)
            : base(vm, false)
        {
            if (_vm.Game.Version == 3)
            {
                _soundOverride = new SoundOvrParameters[_numSoundMax];
            }

            _driver = new TownsEuphonyDriver(mixer);
        }
Example #15
0
        public Player_V1(ScummEngine scumm, IMixer mixer, bool pcjr)
            : base(scumm, mixer, pcjr)
        {
            // Initialize channel code
            for (int i = 0; i < 4; ++i)
                ClearChannel(i);

            _mplex_step = (uint)(_sampleRate << FIXP_SHIFT) / 1193000;
            _next_chunk = _repeat_chunk = 0;
            _forced_level = 0;
            _random_lsr = 0;
        }
Example #16
0
        public Player_Mac(ScummEngine scumm, IMixer mixer, int numberOfChannels, int channelMask, bool fadeNoteEnds)
        {
            _vm = scumm;
            _mixer = mixer;
            _sampleRate = _mixer.OutputRate;
            _soundPlaying = -1;
            _numberOfChannels = numberOfChannels;
            _channelMask = channelMask;
            _fadeNoteEnds = fadeNoteEnds;
            Debug.Assert(scumm != null);
            Debug.Assert(mixer != null);

            Init();
        }
Example #17
0
        public Player_AD(ScummEngine scumm, IMixer mixer)
        {
            _vm = scumm;
            _mixer = mixer;
            _rate = mixer.OutputRate;
            // TODO: vs OPL
            //        _opl2 = OPL::Config::create();
            _opl2 = new DosBoxOPL(OplType.Opl2);
            _opl2.Init(_rate);

            _samplesPerCallback = _rate / AD_CALLBACK_FREQUENCY;
            _samplesPerCallbackRemainder = _rate % AD_CALLBACK_FREQUENCY;
            _samplesTillCallback = 0;
            _samplesTillCallbackRemainder = 0;

            WriteReg(0x01, 0x00);
            WriteReg(0xBD, 0x00);
            WriteReg(0x08, 0x00);
            WriteReg(0x01, 0x20);

            _soundHandle = _mixer.PlayStream(SoundType.Plain, this, -1, Mixer.MaxChannelVolume, 0, false, true);

            _engineMusicTimer = 0;
            _soundPlaying = -1;

            _curOffset = 0;

            _sfxTimer = 4;
            _rndSeed = 1;

            for (int i = 0; i < _sfx.Length; ++i)
            {
                _sfx[i] = new SfxSlot();
                _sfx[i].Resource = -1;
                for (int j = 0; j < _sfx[i].Channels.Length; ++j)
                {
                    _sfx[i].Channels[j].HardwareChannel = -1;
                }
            }

            _numHWChannels = _hwChannels.Length;

            _musicVolume = _sfxVolume = 255;
            _isSeeking = false;
        }
Example #18
0
        public Player_V4A(ScummEngine scumm, IMixer mixer)
        {
            _vm = scumm;
            _mixer = mixer;
            _tfmxMusic = new Tfmx(_mixer.OutputRate, true);
            _tfmxSfx = new Tfmx(_mixer.OutputRate, true);

            Debug.Assert(scumm != null);
            Debug.Assert(mixer != null);
            Debug.Assert(_vm.Game.GameId == GameId.Monkey1);
            _tfmxMusic.SetSignalAction((num, value) =>
                {
                    if (num == 0)
                    {
                        _signal = value;
                    }
                });
        }
Example #19
0
        protected CharsetRenderer(ScummEngine vm)
        {
            Top = 0;
            Left = 0;
            StartLeft = 0;
            Right = 0;

            Color = 0;

            Center = false;
            HasMask = false;
            TextScreen = vm.MainVirtScreen;
            BlitAlso = false;
            FirstChar = false;
            DisableOffsX = false;

            Vm = vm;
            CurId = -1;
        }
Example #20
0
 public ClassicCostumeRenderer(ScummEngine vm)
 {
     _vm = vm;
     _loaded = new ClassicCostumeLoader(vm);
     _palette = new ushort[32];
 }
Example #21
0
 public CharsetRendererNut(ScummEngine vm)
     : base(vm)
 {
 }
Example #22
0
 TrsFile GetStrings(ScummEngine vm, string file, bool isEncoded)
 {
     //            Debug.WriteLine("trying to read text resources from {0}", file);
     var filename = ScummHelper.LocatePath(ServiceLocator.FileStorage.GetDirectoryName(_vm.Game.Path), ServiceLocator.FileStorage.GetFileName(file));
     return filename != null ? isEncoded ? TrsFile.LoadEncoded(filename) : TrsFile.Load(filename) : null;
 }
Example #23
0
 protected CharsetRendererCommon(ScummEngine vm)
     : base(vm)
 {
 }
 public CharsetRendererTownsClassic(ScummEngine engine)
     : base(engine)
 {
 }
Example #25
0
 public CharsetRendererClassic(ScummEngine vm)
     : base(vm)
 {
 }
Example #26
0
 public ClassicCostumeLoader(ScummEngine vm)
 {
     _vm = vm;
     Id  = -1;
 }
Example #27
0
 public AkosRenderer(ScummEngine vm)
 {
     this._vm = vm;
 }
Example #28
0
 public DefaultAudioCDManager(ScummEngine vm, IMixer mixer)
 {
     _vm = vm;
     _cd.playing = false;
     _cd.track = 0;
     _cd.start = 0;
     _cd.duration = 0;
     _cd.numLoops = 0;
     _cd.volume = Mixer.MaxChannelVolume;
     _cd.balance = 0;
     _mixer = mixer;
     _emulating = false;
     Debug.Assert(_mixer != null);
 }
Example #29
0
 public CharsetRendererClassic(ScummEngine vm)
     : base(vm)
 {
 }
Example #30
0
 public Gdi2(ScummEngine vm, GameInfo game)
     : base(vm, game)
 {
 }
Example #31
0
 public IEngine Create(GameSettings settings, IGraphicsManager gfxManager, IInputManager inputManager, IAudioOutput output, ISaveFileManager saveFileManager, bool debugMode = false)
 {
     return(ScummEngine.Create(settings, gfxManager, inputManager, output, debugMode));
 }
Example #32
0
 public CostumeRenderer0(ScummEngine vm)
     : base(vm)
 {
     _loaded = new CostumeLoader0(vm);
 }
Example #33
0
 public Gdi1(ScummEngine vm, GameInfo game)
     : base(vm, game)
 {
 }
Example #34
0
        public CharsetRenderer2(ScummEngine vm)
            : base(vm)
        {
            _fontHeight = 8;
            CurId       = 0;

            byte[] replacementData  = null;
            int    replacementChars = 0;

            switch (vm.Game.Culture.TwoLetterISOLanguageName)
            {
            case "de":
                if (vm.Game.Version == 0)
                {
                    replacementData  = germanCharsetDataV0;
                    replacementChars = germanCharsetDataV0.Length / 2;
                }
                else
                {
                    replacementData  = germanCharsetDataV2;
                    replacementChars = germanCharsetDataV2.Length / 2;
                }
                break;

            case "fr":
                replacementData  = frenchCharsetDataV2;
                replacementChars = frenchCharsetDataV2.Length / 2;
                break;

            case "it":
                replacementData  = italianCharsetDataV2;
                replacementChars = italianCharsetDataV2.Length / 2;
                break;

            case "es":
                replacementData  = spanishCharsetDataV2;
                replacementChars = spanishCharsetDataV2.Length / 2;
                break;

            case "ru":
                _fontPtr = russianCharsetDataV2;
                break;

            default:
                _fontPtr = englishCharsetDataV2;
                break;
            }

            if (replacementData != null)
            {
                _fontPtr = new byte[englishCharsetDataV2.Length];
                Array.Copy(englishCharsetDataV2, _fontPtr, englishCharsetDataV2.Length);

                for (int i = 0; i < replacementChars; i++)
                {
                    int ch1 = replacementData[2 * i];
                    int ch2 = replacementData[2 * i + 1];

                    Array.Copy(specialCharsetData, 8 * ch2, _fontPtr, 8 * ch1, 8);
                }
            }
        }
Example #35
0
 protected BaseCostumeRenderer(ScummEngine scumm)
 {
     _vm = scumm;
 }
Example #36
0
 public CostumeLoader0(ScummEngine vm)
 {            
     _vm = vm;
     Id = -1;
 }