public static ScriptParser Create(GameInfo info) { ScriptParser parser; switch (info.Version) { case 0: parser = new ScriptParser0(info); break; case 3: parser = new ScriptParser3(info); break; case 4: parser = new ScriptParser4(info); break; case 5: parser = new ScriptParser5(info); break; case 6: parser = new ScriptParser6(info); break; case 7: parser = new ScriptParser7(info); break; case 8: parser = new ScriptParser8(info); break; default: throw new NotSupportedException(string.Format("SCUMM version {0} not supported.", info.Version)); } parser.InitOpCodes(); return parser; }
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; } }
protected override void LoadIndex(GameInfo game) { const byte encByte = 0x69; Directory = ServiceLocator.FileStorage.GetDirectoryName(game.Path); using (var file = ServiceLocator.FileStorage.OpenFileRead(game.Path)) { var br = new BinaryReader(new XorStream(file,encByte)); while (br.BaseStream.Position < br.BaseStream.Length) { var block = ToTag(br.ReadBytes(4)); br.ReadUInt32BigEndian(); // size switch (block) { case "RNAM": ReadRoomNames(br); break; case "MAXS": ReadMaxSizes(br); break; case "DROO": var rooms = ReadResTypeList(br); RoomResources = new ReadOnlyCollection<Resource>(rooms); break; case "DSCR": var scripts = ReadResTypeList(br); ScriptResources = new ReadOnlyCollection<Resource>(scripts); break; case "DSOU": var sounds = ReadResTypeList(br); SoundResources = new ReadOnlyCollection<Resource>(sounds); break; case "DCOS": var costumes = ReadResTypeList(br); CostumeResources = new ReadOnlyCollection<Resource>(costumes); break; case "DCHR": var charset = ReadResTypeList(br); CharsetResources = new ReadOnlyCollection<Resource>(charset); break; case "DOBJ": ReadDirectoryOfObjects(br); break; default: // Console.Error.WriteLine("Unknown block {0}", block); break; } } } }
protected override void LoadIndex(GameInfo game) { var encByte = GetEncodingByte(game); Directory = ServiceLocator.FileStorage.GetDirectoryName(game.Path); using (var file = ServiceLocator.FileStorage.OpenFileRead(game.Path)) { var br = new BinaryReader(new XorStream(file, encByte)); while (br.BaseStream.Position < br.BaseStream.Length) { br.ReadUInt32(); var block = br.ReadInt16(); switch (block) { case 0x4E52: ReadRoomNames(br); break; case 0x5230: // 'R0' var rooms = ReadResTypeList(br); RoomResources = new ReadOnlyCollection<Resource>(rooms); break; case 0x5330: // 'S0' var scripts = ReadResTypeList(br); ScriptResources = new ReadOnlyCollection<Resource>(scripts); break; case 0x4E30: // 'N0' var sounds = ReadResTypeList(br); SoundResources = new ReadOnlyCollection<Resource>(sounds); break; case 0x4330: // 'C0' var costumes = ReadResTypeList(br); CostumeResources = new ReadOnlyCollection<Resource>(costumes); break; case 0x4F30: // 'O0' ReadDirectoryOfObjects(br); // Indy3 FM-TOWNS has 32 extra bytes of unknown meaning if (Game.GameId == GameId.Indy3 && Game.Platform == Platform.FMTowns) br.BaseStream.Seek(32, SeekOrigin.Current); break; default: Debug.WriteLine("Unknown block {0:X2}", block); break; } } } }
public ScriptParser4(GameInfo game) : base(game) { var knownVariables = new Dictionary<int,string> { { 27, "VariableScrollScript" }, { 39, "VariableDebugMode" }, { 50, "VariableMainMenu" }, { 51, "VariableFixedDisk" }, { 52, "VariableCursorState" }, { 53, "VariableUserPut" }, { 54, "VariableTalkStringY" } }; AddKnownVariables(knownVariables); }
public ScriptParser0(GameInfo game) : base(game) { KnownVariables = new Dictionary<int, string> { { 0,"VariableEgo" }, { 2,"VariableCameraPosX" }, { 3,"VariableHaveMessage" }, { 4,"VariableRoom" }, { 5,"VariableActiveObject2" }, { 6,"VariableOverride" }, { 8,"VariableIsSoundRunning" }, { 9,"VariableActiveVerb" }, { 10,"VariableCharCount" } }; }
protected override void LoadIndex(GameInfo game) { using (var file = ServiceLocator.FileStorage.OpenFileRead(game.Path)) { var br = new BinaryReader(new XorStream(file,0xFF)); var magic = br.ReadUInt16(); if (magic != 0x0100) throw new NotSupportedException( string.Format("The magic id doesn't match ({0:X2})", magic)); ReadDirectoryOfObjects(br); RoomResources = new ReadOnlyCollection<Resource>(ReadRoomResTypeList(br)); CostumeResources = new ReadOnlyCollection<Resource>(ReadResTypeList(br)); ScriptResources = new ReadOnlyCollection<Resource>(ReadResTypeList(br)); SoundResources = new ReadOnlyCollection<Resource>(ReadResTypeList(br)); } }
public ScriptParser3(GameInfo game) : base(game) { KnownVariables = new Dictionary<int, string> { { 1,"VariableEgo" }, { 2,"VariableCameraPosX" }, { 3,"VariableHaveMessage" }, { 4,"VariableRoom" }, { 5,"VariableOverride" }, { 9,"VariableCurrentLights" }, { 11,"VariableTimer1" }, { 12,"VariableTimer2" }, { 13,"VariableTimer3" }, { 14,"VariableMusicTimer" }, { 17,"VariableCameraMinX" }, { 18,"VariableCameraMaxX" }, { 19,"VariableTimerNext" }, { 20,"VariableVirtualMouseX" }, { 21,"VariableVirtualMouseY" }, { 22,"VariableRoomResource" }, { 24,"VariableCutSceneExitKey" }, { 25,"VariableTalkActor" }, { 26,"VariableCameraFastX" }, { 28,"VariableEntryScript" }, { 29,"VariableEntryScript2" }, { 30,"VariableExitScript" }, { 32,"VariableVerbScript" }, { 33,"VariableSentenceScript" }, { 34,"VariableInventoryScript" }, { 35,"VariableCutSceneStartScript" }, { 36,"VariableCutSceneEndScript" }, { 37,"VariableCharIncrement" }, { 38,"VariableWalkToObject" }, { 40,"VariableHeapSpace" }, { 44,"VariableMouseX" }, { 45,"VariableMouseY" }, { 46,"VariableTimer" }, { 47,"VariableTimerTotal" }, { 48,"VariableSoundcard" }, { 49,"VariableVideoMode" } }; }
public GameInfo GetInfo(string path) { GameInfo info = null; var signature = ServiceLocator.FileStorage.GetSignature(path); var gameMd5 = (from md5 in _doc.Element(Namespace + "NScumm").Elements(Namespace + "MD5") where (string)md5.Attribute("signature") == signature select md5).FirstOrDefault(); if (gameMd5 != null) { var game = (from g in _doc.Element(Namespace + "NScumm").Elements(Namespace + "Game") where (string)g.Attribute("id") == (string)gameMd5.Attribute("gameId") where (string)g.Attribute("variant") == (string)gameMd5.Attribute("variant") select g).FirstOrDefault(); var desc = (from d in _doc.Element(Namespace + "NScumm").Elements(Namespace + "Description") where (string)d.Attribute("gameId") == (string)gameMd5.Attribute("gameId") select (string)d.Attribute("text")).FirstOrDefault(); var attFeatures = gameMd5.Attribute("features"); var platformText = (string)gameMd5.Attribute("platform"); var platform = platformText != null ? (Platform?)Enum.Parse(typeof(Platform), platformText, true) : null; var features = ParseFeatures((string)attFeatures); var attMusic = game.Attribute("music"); var music = ParseMusic((string)attMusic); info = new GameInfo { MD5 = signature, Platform = platform.HasValue ? platform.Value : Platform.DOS, Path = path, Id = (string)game.Attribute("id"), Pattern = (string)game.Attribute("pattern"), GameId = (GameId)Enum.Parse(typeof(GameId), (string)game.Attribute("gameId"), true), Variant = (string)game.Attribute("variant"), Description = desc, Version = (int)game.Attribute("version"), Culture = new CultureInfo((string)gameMd5.Attribute("language")), Features = features, Music = music }; } return info; }
public ScriptParser5(GameInfo game) : base(game) { var knownVariables = new Dictionary<int,string> { { 56, "VariableSoundResult" }, { 57, "VariableTalkStopKey" }, { 59, "VariableFadeDelay" }, { 60, "VariableNoSubtitles" }, { 64, "VariableSoundParam" }, { 65, "VariableSoundParam2" }, { 66, "VariableSoundParam3" }, { 67, "VariableInputMode" }, { 68, "VariableMemoryPerformance" }, { 69, "VariableVideoPerformance" }, { 70, "VariableRoomFlag" }, { 71, "VariableGameLoaded" }, { 72, "VariableNewRoom" } }; AddKnownVariables(knownVariables); }
protected override void LoadIndex(GameInfo game) { using (var file = ServiceLocator.FileStorage.OpenFileRead(game.Path)) { var br = new BinaryReader(new XorStream(file, 0xFF)); var magic = br.ReadUInt16(); switch (magic) { case 0x0A31: // Classic V1 game detected ReadClassicIndexFile(br); break; case 0x0100: // Enhanced V2 game detected ReadEnhancedIndexFile(br); break; default: throw new NotSupportedException( string.Format("The magic id doesn't match ({0:X2})", magic)); } } }
public ResourceFile3_16(GameInfo game, Stream stream) : base(stream) { _game = game; }
protected override void LoadIndex(GameInfo game) { var disk1 = string.Format(game.Pattern, 1); var directory = ServiceLocator.FileStorage.GetDirectoryName(game.Path); var path = ScummHelper.LocatePath(directory, disk1); sectorOffset = game.Platform == Platform.Apple2GS ? AppleSectorOffset : C64SectorOffset; int numGlobalObjects; int numRooms; int numCostumes; int numScripts; int numSounds; if (game.GameId == GameId.Maniac) { numGlobalObjects = 256; numRooms = 55; numCostumes = 25; if (game.Features.HasFlag(GameFeatures.Demo)) { numScripts = 55; numSounds = 40; } else { numScripts = 160; numSounds = 70; } } else { numGlobalObjects = 775; numRooms = 59; numCostumes = 38; numScripts = 155; numSounds = 127; } using (var disk = ServiceLocator.FileStorage.OpenFileRead(path)) { var br = new BinaryReader(disk); if (Game.Platform == Platform.Apple2GS) { br.BaseStream.Seek(142080, SeekOrigin.Begin); } var signature = br.ReadUInt16(); if (signature != 0x0A31) { throw new NotSupportedException(string.Format("Invalid signature '{0:X}' in disk 1", signature)); } // object flags ObjectOwnerTable = new byte[numGlobalObjects]; ObjectStateTable = new byte[numGlobalObjects]; ClassData = new uint[numGlobalObjects]; for (int i = 0; i < numGlobalObjects; i++) { var tmp = br.ReadByte(); ObjectOwnerTable[i] = (byte)(tmp & 0x0F); ObjectStateTable[i] = (byte)(tmp >> 4); } // room offsets for (var i = 0; i < numRooms; i++) { roomDisks[i] = (byte)(br.ReadByte() - '0'); } for (var i = 0; i < numRooms; i++) { roomSectors[i] = br.ReadByte(); roomTracks[i] = br.ReadByte(); } CostumeResources = new ReadOnlyCollection<Resource>(ReadResTypeList(br, numCostumes)); ScriptResources = new ReadOnlyCollection<Resource>(ReadResTypeList(br, numScripts)); SoundResources = new ReadOnlyCollection<Resource>(ReadResTypeList(br, numSounds)); } }
protected virtual byte GetEncodingByte(GameInfo game) { byte encByte = 0; if (!game.Features.HasFlag(GameFeatures.Old256)) { encByte = 0xFF; } return encByte; }
public ScriptParser7(GameInfo game) : base(game) { KnownVariables = new Dictionary<int, string> { { 1, "VariableMouseX" }, { 2, "VariableMouseY" }, { 3, "VariableVirtualMouseX" }, { 4, "VariableVirtualMouseY" }, { 5, "VariableRoomWidth" }, { 6, "VariableRoomHeight" }, { 7, "VariableCameraPosX" }, { 8, "VariableCameraPosY" }, { 9, "VariableOverride" }, { 10, "VariableRoom" }, { 11, "VariableRoomResource" }, { 12, "VariableTalkActor" }, { 13, "VariableHaveMessage" }, { 14, "VariableTimer" }, { 15, "VariableTimerTotal" }, { 16, "VariableTimeDateYear" }, { 17, "VariableTimeDateMonth" }, { 18, "VariableTimeDateDay" }, { 19, "VariableTimeDateHour" }, { 20, "VariableTimeDateMinute" }, { 21, "VariableTimeDateSecond" }, { 22, "VariableLeftButtonDown" }, { 23, "VariableRightButtonDown" }, { 24, "VariableLeftButtonHold" }, { 25, "VariableRightButtonHold" } , { 26, "VariableMemoryPerformance" }, { 27, "VariableVideoPerformance" }, { 29, "VariableGameLoaded" }, { 32, "VariableV6EMSSpace" }, { 33, "VariableVoiceMode" }, { 34, "VariableRandomNumber" }, { 35, "VariableNewRoom" }, { 36, "VariableWalkToObject" }, { 37, "VariableNumGlobalObjs" }, { 38, "VariableCameraDestX" }, { 39, "VariableCameraDestY" }, { 40, "VariableCameraFollowedActor" }, { 50, "VariableScrollScript" }, { 51, "VariableEntryScript" }, { 52, "VariableEntryScript2" }, { 53, "VariableExitScript" }, { 54, "VariableExitScript2" }, { 55, "VariableVerbScript" }, { 56, "VariableSentenceScript" }, { 57, "VariableInventoryScript" }, { 58, "VariableCutSceneStartScript" }, { 59, "VariableCutSceneEndScript" }, { 60, "VariableSaveLoadScript" }, { 61, "VariableSaveLoadScript2" }, { 62, "VariableCutSceneExitKey" }, { 63, "VariableRestartKey" }, { 64, "VariablePauseKey" }, { 65, "VariableMainMenu" }, { 66, "VariableVersionKey" }, { 118, "VariableKeyPress" }, { 97, "VariableTimerNext" }, { 98, "VariableTimer1" }, { 99, "VariableTimer2" }, { 100, "VariableTimer3" }, { 101, "VariableCameraMinX" }, { 102, "VariableCameraMaxX" }, { 103, "VariableCameraMinY" }, { 104, "VariableCameraMaxY" }, { 105, "VariableCameraThresholdX" }, { 106, "VariableCameraThresholdY" }, { 107, "VariableCameraSpeedX" }, { 108, "VariableCameraSpeedY" }, { 109, "VariableCameraAccelX" }, { 110, "VariableCameraAccelY" }, { 111, "VariableEgo" }, { 112, "VariableCursorState" }, { 113, "VariableUserPut" }, { 114, "VariableDefaultTalkDelay" }, { 115, "VariableCharIncrement" }, { 116, "VariableDebugMode" }, { 117, "VariableFadeDelay" }, { 123, "VariableVideoName" }, { 130, "VariableString2Draw" }, { 131, "VariableCustomScaleTable" }, { 133, "VariableBlastAboveText" }, { 135, "VariableMusicBundleLoaded" }, { 136, "VariableVoiceBundleLoaded" }, }; if (game.GameId == GameId.FullThrottle) { KnownVariables.Add(119, "VariableCharsetMask"); } }
protected ResourceManager(GameInfo game) { Game = game; Index = ResourceIndex.Load(game); Directory = ServiceLocator.FileStorage.GetDirectoryName(game.Path); ArrayDefinitions = Index.ArrayDefinitions; }
protected ScummEngine(GameSettings settings, IGraphicsManager gfxManager, IInputManager inputManager, IMixer mixer) { Settings = settings; var game = (GameInfo)settings.Game; _resManager = ResourceManager.Load(game); _game = game; InvalidBox = _game.Version < 5 ? (byte)255 : (byte)0; _gameMD5 = ToMd5Bytes(game.MD5); _gfxManager = gfxManager; _inputManager = inputManager; _inputState = inputManager.GetState(); _strings = new byte[_resManager.NumArray][]; _inventory = new ushort[_resManager.NumInventory]; _invData = new ObjectData[_resManager.NumInventory]; CurrentScript = 0xFF; Mixer = mixer; ScreenWidth = Game.Width; ScreenHeight = Game.Height; AudioCDManager = new DefaultAudioCDManager(this, mixer); Sound = new Sound(this, mixer); SetupMusic(); _variables = new int[_resManager.NumVariables]; _bitVars = new BitArray(_resManager.NumBitVariables); _slots = new ScriptSlot[NumScriptSlot]; for (int i = 0; i < NumScriptSlot; i++) { _slots[i] = new ScriptSlot(); } for (int i = 0; i < 200; i++) { _objs[i] = new ObjectData(); } for (int i = 0; i < 6; i++) { _string[i] = new TextSlot(); if (game.Version != 3) { _string[i].Default.Position = new Point(2, 5); } } _colorCycle = new ColorCycle[16]; for (int i = 0; i < _colorCycle.Length; i++) { _colorCycle[i] = new ColorCycle(); } _nest = new NestedScript[MaxScriptNesting + 1]; for (int i = 0; i < _nest.Length; i++) { _nest[i] = new NestedScript(); } _scaleSlots = new ScaleSlot[20]; for (int i = 0; i < _scaleSlots.Length; i++) { _scaleSlots[i] = new ScaleSlot(); } Gdi = Gdi.Create(this, game); switch (game.Version) { case 0: _costumeLoader = new CostumeLoader0(this); _costumeRenderer = new CostumeRenderer0(this); break; case 7: case 8: _costumeLoader = new AkosCostumeLoader(this); _costumeRenderer = new AkosRenderer(this); break; default: _costumeLoader = new ClassicCostumeLoader(this); _costumeRenderer = new ClassicCostumeRenderer(this); break; } CreateCharset(); ResetCursors(); // Create the text surface var pixelFormat = _game.Features.HasFlag(GameFeatures.Is16BitColor) ? PixelFormat.Rgb16 : PixelFormat.Indexed8; _textSurface = new Surface(ScreenWidth * _textSurfaceMultiplier, ScreenHeight * _textSurfaceMultiplier, PixelFormat.Indexed8, false); ClearTextSurface(); if (Game.Platform == Platform.FMTowns) { _townsScreen = new TownsScreen(_gfxManager, ScreenWidth * _textSurfaceMultiplier, ScreenHeight * _textSurfaceMultiplier, PixelFormat.Rgb16); _townsScreen.SetupLayer(0, ScreenWidth, ScreenHeight, 32767); _townsScreen.SetupLayer(1, ScreenWidth * _textSurfaceMultiplier, ScreenHeight * _textSurfaceMultiplier, 16, _textPalette); } if (Game.Version == 0) { InitScreens(8, 144); } else if ((Game.GameId == GameId.Maniac) && (_game.Version <= 1) && _game.Platform != Platform.NES) { InitScreens(16, 152); } else if (Game.Version >= 7) { InitScreens(0, ScreenHeight); } else { InitScreens(16, 144); } // Allocate gfx compositing buffer (not needed for V7/V8 games). if (Game.Version < 7) { _composite = new Surface(ScreenWidth, ScreenHeight, pixelFormat, false); } InitActors(); OwnerRoom = Game.Version >= 7 ? 0x0FF : 0x0F; if (Game.Version < 7) { Camera.LeftTrigger = 10; Camera.RightTrigger = 30; } InitPalettes(); InitializeVerbs(); // WORKAROUND for bug in boot script of Loom (CD) // The boot script sets the characters of string 21, // before creating the string.resource. if (_game.GameId == GameId.Loom) { _strings[21] = new byte[13]; } }
protected ScriptParser(GameInfo info) { Game = info; }
public ResourceManager3(GameInfo game) : base(game) { }
protected abstract void LoadIndex(GameInfo game);
public static ResourceIndex Load(GameInfo game) { ResourceIndex index; switch (game.Version) { case 0: index = new ResourceIndex0(); break; case 1: if (game.Platform == Platform.C64) { index = new ResourceIndex0(); } else { index = new ResourceIndex2(); } break; case 2: index = new ResourceIndex2(); break; case 3: if (game.IsOldBundle) { index = new ResourceIndex3_16(); } else { index = new ResourceIndex3(); } break; case 4: index = new ResourceIndex4(); break; case 5: index = new ResourceIndex5(); break; case 6: index = new ResourceIndex6(); break; case 7: index = new ResourceIndex7(); break; case 8: index = new ResourceIndex8(); break; default: throw new NotSupportedException("The SCUMM version {0} is not supported."); } index.Game = game; index.LoadIndex(game); return index; }
public Gdi2(ScummEngine vm, GameInfo game) : base(vm, game) { }
public ImageDumper(GameInfo game) { Game = game; }
public static ResourceManager Load(GameInfo game) { switch (game.Version) { case 0: return new ResourceManager0(game); case 1: case 2: return new ResourceManager2(game); case 3: return new ResourceManager3(game); case 4: return new ResourceManager4(game); case 5: return new ResourceManager5(game); case 6: return new ResourceManager6(game); case 7: return new ResourceManager7(game); case 8: return new ResourceManager8(game); default: throw new NotSupportedException(string.Format("ResourceManager {0} is not supported", game.Version)); } }
public ScriptParser6(GameInfo game) : base(game) { KnownVariables = new Dictionary<int, string>(); }
public static Gdi Create(ScummEngine vm, GameInfo game) { Gdi gdi; switch (game.Version) { case 0: case 1: gdi = new Gdi1(vm, game); break; case 2: gdi = new Gdi2(vm, game); break; default: gdi = new Gdi(vm, game); break; } return gdi; }
public ScriptDumper(GameInfo game) { Game = game; }
public ScriptParser8(GameInfo game) : base(game) { KnownVariables = new Dictionary<int, string> { { 1, "VariableRoomWidth" }, { 2, "VariableRoomHeight" }, { 3, "VariableMouseX" }, { 4, "VariableMouseY" }, { 5, "VariableVirtualMouseX" }, { 6, "VariableVirtualMouseY" }, { 7, "VariableCursorState" }, { 8, "VariableUserPut" }, { 9, "VariableCameraPosX" }, { 10, "VariableCameraPosY" }, { 11, "VariableCameraDestX" }, { 12, "VariableCameraDestY" }, { 13, "VariableCameraFollowedActor" }, { 14, "VariableTalkActor" }, { 15, "VariableHaveMessage" }, { 16, "VariableLeftButtonDown" }, { 17, "VariableRightButtonDown" }, { 18, "VariableLeftButtonHold" }, { 19, "VariableRightButtonHold" }, { 24, "VariableTimeDateYear" }, { 25, "VariableTimeDateMonth" }, { 26, "VariableTimeDateDay" }, { 27, "VariableTimeDateHour" }, { 28, "VariableTimeDateMinute" }, { 29, "VariableTimeDateSecond" }, { 30, "VariableOverride" }, { 31, "VariableRoom" }, { 32, "VariableNewRoom" }, { 33, "VariableWalkToObject" }, { 34, "VariableTimer" }, { 39, "VariableVoiceMode" }, { 40, "VariableGameLoaded" }, { 41, "VariableLanguage" }, { 42, "VariableCurrentDisk" }, { 45, "VariableMusicBundleLoaded" }, { 46, "VariableVoiceBundleLoaded" }, { 50, "VariableScrollScript" }, { 51, "VariableEntryScript" }, { 52, "VariableEntryScript2" }, { 53, "VariableExitScript" }, { 54, "VariableExitScript2" }, { 55, "VariableVerbScript" }, { 56, "VariableSentenceScript" }, { 57, "VariableInventoryScript" }, { 58, "VariableCutSceneStartScript" }, { 59, "VariableCutSceneEndScript" }, { 62, "VariableCutSceneExitKey" }, { 64, "VariablePauseKey" }, { 65, "VariableMainMenu" }, { 66, "VariableVersionKey" }, { 67, "VariableTalkStopKey" }, { 111, "VariableCustomScaleTable" }, { 112, "VariableTimerNext" }, { 113, "VariableTimer1" }, { 114, "VariableTimer2" }, { 115, "VariableTimer3" }, { 116, "VariableCameraMinX" }, { 117, "VariableCameraMaxX" }, { 118, "VariableCameraMinY" }, { 119, "VariableCameraMaxY" }, { 120, "VariableCameraSpeedX" }, { 121, "VariableCameraSpeedY" }, { 122, "VariableCameraAccelX" }, { 123, "VariableCameraAccelY" }, { 124, "VariableCameraThresholdX" }, { 125, "VariableCameraThresholdY" }, { 126, "VariableEgo" }, { 128, "VariableDefaultTalkDelay" }, { 129, "VariableCharIncrement" }, { 130, "VariableDebugMode" }, { 132, "VariableKeyPress" }, { 133, "VariableBlastAboveText" }, { 134, "VariableSync" }, }; }
protected override void LoadIndex(GameInfo game) { Directory = ServiceLocator.FileStorage.GetDirectoryName(game.Path); using (var file = ServiceLocator.FileStorage.OpenFileRead(game.Path)) { var br = new BinaryReader(file); while (br.BaseStream.Position < br.BaseStream.Length) { var tag = System.Text.Encoding.UTF8.GetString(br.ReadBytes(4)); br.ReadUInt32BigEndian(); switch (tag) { case "DCHR": case "DIRF": var charset = ReadResTypeList(br); CharsetResources = new ReadOnlyCollection<Resource>(charset); break; case "DOBJ": ReadDirectoryOfObjects(br); break; case "RNAM": ReadRoomNames(br); break; case "DROO": case "DIRR": var rooms = ReadResTypeList(br); RoomResources = new ReadOnlyCollection<Resource>(rooms); break; case "DSCR": case "DIRS": var scripts = ReadResTypeList(br); ScriptResources = new ReadOnlyCollection<Resource>(scripts); break; case "DRSC": var roomScripts = ReadResTypeList(br); RoomScriptResources = new ReadOnlyCollection<Resource>(roomScripts); break; case "DCOS": case "DIRC": var costumes = ReadResTypeList(br); CostumeResources = new ReadOnlyCollection<Resource>(costumes); break; case "MAXS": ReadMaxSizes(br); break; case "DIRN": case "DSOU": var sounds = ReadResTypeList(br); SoundResources = new ReadOnlyCollection<Resource>(sounds); break; case "AARY": ReadArrayFromIndexFile(br); break; case "ANAM": // Used by: The Dig, FT { var num = br.ReadUInt16(); AudioNames = new string[num]; for (int i = 0; i < num; i++) { AudioNames[i] = br.ReadBytes(9).GetText(); } } break; // default: // Console.Error.WriteLine("Unknown tag {0} found in index file directory", tag); // break; } } } }