Example #1
0
 public MoviePlayer(SwordEngine vm, Text textMan, ResMan resMan)
 {
     _vm = vm;
     _textMan = textMan;
     _resMan = resMan;
     _directory = ServiceLocator.FileStorage.GetDirectoryName(_vm.Settings.Game.Path);
 }
Example #2
0
 public MoviePlayer(SwordEngine vm, Text textMan, ResMan resMan)
 {
     _vm        = vm;
     _textMan   = textMan;
     _resMan    = resMan;
     _directory = ServiceLocator.FileStorage.GetDirectoryName(_vm.Settings.Game.Path);
 }
Example #3
0
        public Text(ObjectMan objMan, ResMan resMan, bool czechVersion)
        {
            _objMan = objMan;
            _resMan = resMan;
            _textCount = 0;
            _fontId = (uint)(czechVersion ? SwordRes.CZECH_GAME_FONT : SwordRes.GAME_FONT);
            _font = _resMan.OpenFetchRes(_fontId);

            _joinWidth = (ushort)(CharWidth((byte)' ') - 2 * Overlap);
            _charHeight = _resMan.ReadUInt16(new FrameHeader(_resMan.FetchFrame(_font, 0)).height); // all chars have the same height
        }
Example #4
0
        public Text(ObjectMan objMan, ResMan resMan, bool czechVersion)
        {
            _objMan    = objMan;
            _resMan    = resMan;
            _textCount = 0;
            _fontId    = (uint)(czechVersion ? SwordRes.CZECH_GAME_FONT : SwordRes.GAME_FONT);
            _font      = _resMan.OpenFetchRes(_fontId);

            _joinWidth  = (ushort)(CharWidth((byte)' ') - 2 * Overlap);
            _charHeight = _resMan.ReadUInt16(new FrameHeader(_resMan.FetchFrame(_font, 0)).height); // all chars have the same height
        }
Example #5
0
        public Sound(GameSettings settings, Mixer mixer, ResMan resMan)
        {
            _mixer    = mixer;
            _resMan   = resMan;
            _settings = settings;

            _speechVolL = _speechVolR = _sfxVolL = _sfxVolR = 192;
            _fxQueue    = new QueueElement[MAX_FXQ_LENGTH];
            for (int i = 0; i < _fxQueue.Length; i++)
            {
                _fxQueue[i] = new QueueElement();
            }
        }
Example #6
0
 public ControlButton(ushort x, ushort y, uint resId, ButtonIds id, byte flag, ResMan pResMan, byte[] screenBuf,
     ISystem system)
 {
     _x = x;
     _y = y;
     _id = id;
     _flag = flag;
     _resId = resId;
     _resMan = pResMan;
     _frameIdx = 0;
     _resMan.ResOpen(_resId);
     FrameHeader tmp = new FrameHeader(_resMan.FetchFrame(_resMan.FetchRes(_resId), 0));
     _width = _resMan.ReadUInt16(tmp.width);
     _width = (ushort)((_width > Screen.SCREEN_WIDTH) ? Screen.SCREEN_WIDTH : _width);
     _height = _resMan.ReadUInt16(tmp.height);
     if ((x == 0) && (y == 0))
     { // center the frame (used for panels);
         _x = (ushort)((((640 - _width) / 2) < 0) ? 0 : ((640 - _width) / 2));
         _y = (ushort)((((480 - _height) / 2) < 0) ? 0 : ((480 - _height) / 2));
     }
     _dstBuf = new ByteAccess(screenBuf, _y * Screen.SCREEN_WIDTH + _x);
     _system = system;
 }
Example #7
0
        public ControlButton(ushort x, ushort y, uint resId, ButtonIds id, byte flag, ResMan pResMan, byte[] screenBuf,
                             ISystem system)
        {
            _x        = x;
            _y        = y;
            _id       = id;
            _flag     = flag;
            _resId    = resId;
            _resMan   = pResMan;
            _frameIdx = 0;
            _resMan.ResOpen(_resId);
            FrameHeader tmp = new FrameHeader(_resMan.FetchFrame(_resMan.FetchRes(_resId), 0));

            _width  = _resMan.ReadUInt16(tmp.width);
            _width  = (ushort)((_width > Screen.SCREEN_WIDTH) ? Screen.SCREEN_WIDTH : _width);
            _height = _resMan.ReadUInt16(tmp.height);
            if ((x == 0) && (y == 0))
            { // center the frame (used for panels);
                _x = (ushort)((((640 - _width) / 2) < 0) ? 0 : ((640 - _width) / 2));
                _y = (ushort)((((480 - _height) / 2) < 0) ? 0 : ((480 - _height) / 2));
            }
            _dstBuf = new ByteAccess(screenBuf, _y * Screen.SCREEN_WIDTH + _x);
            _system = system;
        }
Example #8
0
 public Router(ObjectMan objMan, ResMan resMan)
 {
     _objMan = objMan;
     _resMan = resMan;
 }
Example #9
0
 public Mouse(ISystem system, ResMan resMan, ObjectMan objectMan)
 {
     _resMan = resMan;
     _objMan = objectMan;
     _system = system;
 }
Example #10
0
 public ObjectMan(ResMan pResourceMan)
 {
     _resMan = pResourceMan;
 }
Example #11
0
        public Sound(GameSettings settings, Mixer mixer, ResMan resMan)
        {
            _mixer = mixer;
            _resMan = resMan;
            _settings = settings;

            _speechVolL = _speechVolR = _sfxVolL = _sfxVolR = 192;
            _fxQueue = new QueueElement[MAX_FXQ_LENGTH];
            for (int i = 0; i < _fxQueue.Length; i++)
            {
                _fxQueue[i] = new QueueElement();
            }
        }
Example #12
0
 public Screen(string directory, ISystem system, ResMan resMan, ObjectMan objMan)
 {
     _directory = directory;
     _system = system;
     _resMan = resMan;
     _objMan = objMan;
     _currentScreen = 0xFFFF;
     for (int i = 0; i < _sortList.Length; i++)
     {
         _sortList[i] = new SortSpr();
     }
     _psxCache = new PSXDataCache();
 }
Example #13
0
 public ObjectMan(ResMan pResourceMan)
 {
     _resMan = pResourceMan;
 }
Example #14
0
        public SwordEngine(GameSettings settings, IGraphicsManager gfxManager, IInputManager inputManager,
            IAudioOutput output, ISaveFileManager saveFileManager, bool debugMode)
        {
            Settings = settings;
            GraphicsManager = gfxManager;
            _mixer = new Mixer(44100);
            // HACK:
            _mixer.Read(new byte[0], 0);
            output.SetSampleProvider(_mixer);
            System = new SwordSystem(gfxManager, inputManager, saveFileManager);

            var gameId = ((SwordGameDescriptor)settings.Game).GameId;
            _features = gameId == SwordGameId.Sword1Demo || gameId == SwordGameId.Sword1MacDemo ||
                        gameId == SwordGameId.Sword1PsxDemo
                ? 1U
                : 0;

            // TODO: debug
            // _console = new SwordConsole(this);

            SystemVars.Platform = settings.Game.Platform;

            // TODO:
            // CheckCdFiles();

            // TODO: debug(5, "Starting resource manager");
            var directory = ServiceLocator.FileStorage.GetDirectoryName(settings.Game.Path);
            var path = ServiceLocator.FileStorage.Combine(directory, "swordres.rif");
            _resMan = new ResMan(directory, path, SystemVars.Platform == Platform.Macintosh);
            // TODO: debug(5, "Starting object manager");

            _objectMan = new ObjectMan(_resMan);
            _mouse = new Mouse(System, _resMan, _objectMan);
            _screen = new Screen(directory, System, _resMan, _objectMan);
            _music = new Music(Mixer, directory);
            _sound = new Sound(settings, _mixer, _resMan);
            _menu = new Menu(_screen, _mouse);
            _logic = new Logic(this, _objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, Mixer);
            _mouse.UseLogicAndMenu(_logic, _menu);

            // TODO:
            //SyncSoundSettings();

            SystemVars.JustRestoredGame = 0;
            SystemVars.CurrentCd = 0;
            SystemVars.ControlPanelMode = ControlPanelMode.CP_NEWGAME;
            SystemVars.ForceRestart = false;
            SystemVars.WantFade = true;
            //_systemVars.realLanguage = Common::parseLanguage(ConfMan.get("language"));
            SystemVars.RealLanguage = new CultureInfo("en-GB");

            //switch (SystemVars.RealLanguage.TwoLetterISOLanguageName)
            //{
            //    case "de":
            //        SystemVars.Language = Language.BS1_GERMAN;
            //        break;
            //    case "fr":
            //        SystemVars.Language = Language.BS1_FRENCH;
            //        break;
            //    case "it":
            //        SystemVars.Language = Language.BS1_ITALIAN;
            //        break;
            //    case "es":
            //        SystemVars.Language = Language.BS1_SPANISH;
            //        break;
            //    case "pt":
            //        SystemVars.Language = Language.BS1_PORT;
            //        break;
            //    case "cz":
            //        SystemVars.Language = Language.BS1_CZECH;
            //        break;
            //    default:
            //        SystemVars.Language = Language.BS1_ENGLISH;
            //        break;
            //}

            // TODO:
            //_systemVars.showText = ConfMan.getBool("subtitles");

            SystemVars.PlaySpeech = 1;
            _mouseState = 0;

            // Some Mac versions use big endian for the speech files but not all of them.
            if (SystemVars.Platform == Platform.Macintosh)
                _sound.CheckSpeechFileEndianness();

            _logic.Initialize();
            _objectMan.Initialize();
            _mouse.Initialize();
            _control = new Control(saveFileManager, _resMan, _objectMan, System, _mouse, _sound, _music);
        }
Example #15
0
        public SwordEngine(GameSettings settings, IGraphicsManager gfxManager, IInputManager inputManager,
                           IAudioOutput output, ISaveFileManager saveFileManager, bool debugMode)
        {
            Settings        = settings;
            GraphicsManager = gfxManager;
            _mixer          = new Mixer(44100);
            // HACK:
            _mixer.Read(new byte[0], 0);
            output.SetSampleProvider(_mixer);
            System = new SwordSystem(gfxManager, inputManager, saveFileManager);

            var gameId = ((SwordGameDescriptor)settings.Game).GameId;

            _features = gameId == SwordGameId.Sword1Demo || gameId == SwordGameId.Sword1MacDemo ||
                        gameId == SwordGameId.Sword1PsxDemo
                ? 1U
                : 0;

            // TODO: debug
            // _console = new SwordConsole(this);

            SystemVars.Platform = settings.Game.Platform;

            // TODO:
            // CheckCdFiles();

            // TODO: debug(5, "Starting resource manager");
            var directory = ServiceLocator.FileStorage.GetDirectoryName(settings.Game.Path);
            var path      = ServiceLocator.FileStorage.Combine(directory, "swordres.rif");

            _resMan = new ResMan(directory, path, SystemVars.Platform == Platform.Macintosh);
            // TODO: debug(5, "Starting object manager");

            _objectMan = new ObjectMan(_resMan);
            _mouse     = new Mouse(System, _resMan, _objectMan);
            _screen    = new Screen(directory, System, _resMan, _objectMan);
            _music     = new Music(Mixer, directory);
            _sound     = new Sound(settings, _mixer, _resMan);
            _menu      = new Menu(_screen, _mouse);
            _logic     = new Logic(this, _objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, Mixer);
            _mouse.UseLogicAndMenu(_logic, _menu);

            // TODO:
            //SyncSoundSettings();

            SystemVars.JustRestoredGame = 0;
            SystemVars.CurrentCd        = 0;
            SystemVars.ControlPanelMode = ControlPanelMode.CP_NEWGAME;
            SystemVars.ForceRestart     = false;
            SystemVars.WantFade         = true;
            //_systemVars.realLanguage = Common::parseLanguage(ConfMan.get("language"));
            SystemVars.RealLanguage = new CultureInfo("en-GB");

            //switch (SystemVars.RealLanguage.TwoLetterISOLanguageName)
            //{
            //    case "de":
            //        SystemVars.Language = Language.BS1_GERMAN;
            //        break;
            //    case "fr":
            //        SystemVars.Language = Language.BS1_FRENCH;
            //        break;
            //    case "it":
            //        SystemVars.Language = Language.BS1_ITALIAN;
            //        break;
            //    case "es":
            //        SystemVars.Language = Language.BS1_SPANISH;
            //        break;
            //    case "pt":
            //        SystemVars.Language = Language.BS1_PORT;
            //        break;
            //    case "cz":
            //        SystemVars.Language = Language.BS1_CZECH;
            //        break;
            //    default:
            //        SystemVars.Language = Language.BS1_ENGLISH;
            //        break;
            //}

            // TODO:
            //_systemVars.showText = ConfMan.getBool("subtitles");

            SystemVars.PlaySpeech = 1;
            _mouseState           = 0;

            // Some Mac versions use big endian for the speech files but not all of them.
            if (SystemVars.Platform == Platform.Macintosh)
            {
                _sound.CheckSpeechFileEndianness();
            }

            _logic.Initialize();
            _objectMan.Initialize();
            _mouse.Initialize();
            _control = new Control(saveFileManager, _resMan, _objectMan, System, _mouse, _sound, _music);
        }
Example #16
0
 public Mouse(ISystem system, ResMan resMan, ObjectMan objectMan)
 {
     _resMan = resMan;
     _objMan = objectMan;
     _system = system;
 }
Example #17
0
 public Control(ISaveFileManager saveFileMan, ResMan resMan, ObjectMan objMan, ISystem system, Mouse mouse, Sound sound, Music music)
 {
     _saveFileMan = saveFileMan;
     _resMan = resMan;
     _objMan = objMan;
     _system = system;
     _mouse = mouse;
     _music = music;
     _sound = sound;
     _lStrings = _languageStrings[(int)SystemVars.Language];
     _selectedButton = 255;
 }