public static int TryToGetStateID(TRVersion.Game version, uint objectId, string stateName) { Game game; ItemState entry = new ItemState(); Games.TryGetValue(version.Native(), out game); if (game != null) { entry = game.States.FirstOrDefault(item => item.Item == objectId && item.Name.ToLower().Contains(stateName.ToLower())); } if (entry.Name == null) { foreach (var otherGame in Games.Where(g => g.Key != version.Native())) { entry = otherGame.Value.States.FirstOrDefault(item => item.Item == objectId && item.Name.ToLower().Contains(stateName.ToLower())); if (entry.Name != null) { break; } } } if (entry.Name == null) { return(-1); } else { return((int)entry.State); } }
public ItemType(WadMoveableId moveableId, TRVersion.Game gameVersion = TRVersion.Game.TR4) { IsStatic = false; MoveableId = moveableId; _gameVersion = gameVersion.Native(); StaticId = new WadStaticId(); }
public Prj2SoundsConversionDialog(TRVersion.Game version, List <FileFormatConversions.SoundInfoConversionRow> conversionRows) { _version = version.Native(); _conversionRows = conversionRows; InitializeComponent(); }
public ItemType(WadStaticId staticId, TRVersion.Game gameVersion = TRVersion.Game.TR4) { IsStatic = true; MoveableId = new WadMoveableId(); _gameVersion = gameVersion.Native(); StaticId = staticId; }
public static uint?GetItemIndex(TRVersion.Game version, string name, out bool isMoveable) { Game game; if (!Games.TryGetValue(version.Native(), out game)) { isMoveable = false; return(null); } var entry = game.Moveables.FirstOrDefault(item => item.Value.Names.Any(possibleName => possibleName.Equals(name, StringComparison.InvariantCultureIgnoreCase))); if (entry.Value.Names != null) { isMoveable = true; return(entry.Key); } entry = game.Statics.FirstOrDefault(item => item.Value.Names.Any(possibleName => possibleName.Equals(name, StringComparison.InvariantCultureIgnoreCase))); if (entry.Value.Names != null) { isMoveable = false; return(entry.Key); } entry = game.SpriteSequences.FirstOrDefault(item => item.Value.Names.Any(possibleName => possibleName.Equals(name, StringComparison.InvariantCultureIgnoreCase))); if (entry.Value.Names != null) { isMoveable = false; return(entry.Key); } isMoveable = false; return(null); }
public static int TryGetSoundInfoIdByDescription(TRVersion.Game version, string name) { var sounds = Games[version.Native()].Sounds; foreach (var pair in sounds) { if (pair.Value.Description.Equals(name, StringComparison.InvariantCultureIgnoreCase)) { return((int)pair.Key); } } return(-1); }
public static string GetStateName(TRVersion.Game version, uint objectId, uint stateId) { Game game; ItemState entry = new ItemState(); Games.TryGetValue(version.Native(), out game); if (game != null) { entry = game.States.FirstOrDefault(item => item.Item == objectId && item.State == stateId); } if (entry.Name == null) { var otherGames = Games.Where(g => g.Key != version.Native()).ToList(); otherGames.Reverse(); foreach (var otherGame in otherGames) { entry = otherGame.Value.States.FirstOrDefault(item => item.Item == objectId && item.State == stateId); if (entry.Name != null) { break; } } } if (entry.Name == null) { return("Unknown state " + stateId); } else { return(entry.Name); } }
public static string GetAnimationName(TRVersion.Game version, uint objectId, uint animId) { Game game; ItemAnimation entry = new ItemAnimation(); Games.TryGetValue(version.Native(), out game); if (game != null) { entry = game.Animations.FirstOrDefault(item => item.Item == objectId && item.Animation == animId); } if (entry.Name == null) { var otherGames = Games.Where(g => g.Key != version.Native()).ToList(); otherGames.Reverse(); foreach (var otherGame in otherGames) { entry = otherGame.Value.Animations.FirstOrDefault(item => item.Item == objectId && item.Animation == animId); if (entry.Name != null) { break; } } } if (entry.Name == null) { return("Animation " + animId); } else { return(entry.Name); } }
public static string GetSpriteSequenceTR5MainSlot(TRVersion.Game version, uint id) { Game game; if (!Games.TryGetValue(version.Native(), out game)) { return(""); } Item entry; if (!game.SpriteSequences.TryGetValue(id, out entry)) { return(""); } return(game.SpriteSequences[id].TR5MainSlot); }
public static bool IsSoundFixedByDefault(TRVersion.Game version, uint id) { Game game; if (!Games.TryGetValue(version.Native(), out game)) { return(false); } ItemSound entry; if (!game.Sounds.TryGetValue(id, out entry)) { return(false); } return(game.Sounds[id].FixedByDefault); }
public static string GetSpriteSequenceName(TRVersion.Game version, uint id) { Game game; if (!Games.TryGetValue(version.Native(), out game)) { return("Unknown #" + id); } Item entry; if (!game.SpriteSequences.TryGetValue(id, out entry)) { return("Unknown #" + id); } return(game.SpriteSequences[id].Names.LastOrDefault()); }
public static string GetOriginalSoundName(TRVersion.Game version, uint id) { Game game; if (!Games.TryGetValue(version.Native(), out game)) { return("UNKNOWN_SOUND_" + id); } ItemSound entry; if (!game.Sounds.TryGetValue(id, out entry)) { return("UNKNOWN_SOUND_" + id); } return(game.Sounds[id].Name); }
public static uint GetMoveableSkin(TRVersion.Game version, uint id) { Game game; if (!Games.TryGetValue(version.Native(), out game)) { return(id); } Item entry; if (!game.Moveables.TryGetValue(id, out entry)) { return(id); } return(game.Moveables[id].SkinId); }
public static bool IsStaticShatterable(TRVersion.Game version, uint id) { Game game; if (!Games.TryGetValue(version.Native(), out game)) { return(false); } Item entry; if (!game.Statics.TryGetValue(id, out entry)) { return(false); } return(entry.Shatterable); }
public static bool IsMoveableAI(TRVersion.Game version, uint id) { Game game; if (!Games.TryGetValue(version.Native(), out game)) { return(false); } Item entry; if (!game.Moveables.TryGetValue(id, out entry)) { return(false); } return(entry.AIObject); }
public static uint GetSubstituteID(TRVersion.Game version, uint id) { Game game; if (!Games.TryGetValue(version.Native(), out game)) { return(id); } Item entry; if (!game.Moveables.TryGetValue(id, out entry)) { return(id); } if (game.Moveables[id].SubstituteId == -1) { return(id); } return((uint)game.Moveables[id].SubstituteId); }
public static int PredictSoundMapSize(TRVersion.Game version, bool IsNg, int numDemoData) { switch (version.Native()) { case TRVersion.Game.TR1: return(256); case TRVersion.Game.TR2: case TRVersion.Game.TR3: return(370); case TRVersion.Game.TR4: return(IsNg && numDemoData != 0 ? numDemoData : 370); case TRVersion.Game.TR5: case TRVersion.Game.TR5Main: return(450); default: throw new ArgumentOutOfRangeException("Unknown game version."); } }
public string ToString(TRVersion.Game gameVersion) => Id.ToString(gameVersion.Native());
public bool IsOptics(TRVersion.Game gameVersion) { return((gameVersion.Native() == TRVersion.Game.TR4 && TypeId >= 461 && TypeId <= 462) || (gameVersion.Native() >= TRVersion.Game.TR5 && TypeId >= 456 && TypeId <= 457)); }
public bool IsWaterfall(TRVersion.Game gameVersion) { return((gameVersion.Native() == TRVersion.Game.TR4 && TypeId >= 423 && TypeId <= 425) || (gameVersion.Native() >= TRVersion.Game.TR5 && TypeId >= 410 && TypeId <= 415)); }
public static IDictionary <uint, string> GetAllSpriteSequences(TRVersion.Game version) { return(Games[version.Native()].SpriteSequences.DicSelect(item => item.Value.Names.LastOrDefault())); }
public static IDictionary <uint, string> GetAllSounds(TRVersion.Game version) { return(Games[version.Native()].Sounds.DicSelect(item => item.Value.Name)); }
public static IDictionary <uint, string> GetAllFixedByDefaultSounds(TRVersion.Game version) { return(Games[version.Native()].Sounds .DicWhere(sound => sound.Value.FixedByDefault) .DicSelect(item => item.Value.Name)); }