public IEnumerable <ITriggerParameter> BuildList(Level level) { Func <int, int, TriggerParameterUshort> formatSounds = (add, i) => { WadSoundInfo info = level?.Settings?.WadTryGetSoundInfo(add + i); if (info != null) { return(new TriggerParameterUshort((ushort)i, (add + i) + ": " + info.Name)); } else { return(new TriggerParameterUshort((ushort)i, (add + i) + ": --- Not present ---")); } }; Func <int, TriggerParameterUshort> formatSounds1 = i => formatSounds(0, i); Func <int, TriggerParameterUshort> formatSounds2 = i => formatSounds(256, i); switch (Kind) { case NgParameterKind.Empty: return(new ITriggerParameter[0]); case NgParameterKind.AnyNumber: return(null); case NgParameterKind.FixedEnumeration: return(FixedEnumeration.Values); case NgParameterKind.LinearModel: NgLinearModel linearModel = LinearModel.Value; return(Enumerable.Range(linearModel.Start, linearModel.EndInclusive + 1 - linearModel.Start) .Select(i => new TriggerParameterUshort((ushort)i, linearModel.ToString((ushort)i)))); case NgParameterKind.Choice: return(Choices.Aggregate( Enumerable.Empty <ITriggerParameter>(), (last, newChoice) => last.Concat(newChoice.BuildList(level)))); case NgParameterKind.MoveablesInLevel: return(level.Rooms.Where(room => room != null).SelectMany(room => room.Objects).OfType <MoveableInstance>()); case NgParameterKind.StaticsInLevel: return(level.Rooms.Where(room => room != null).SelectMany(room => room.Objects).OfType <StaticInstance>()); case NgParameterKind.CamerasInLevel: return(level.Rooms.Where(room => room != null).SelectMany(room => room.Objects).OfType <CameraInstance>()); case NgParameterKind.SinksInLevel: return(level.Rooms.Where(room => room != null).SelectMany(room => room.Objects).OfType <SinkInstance>()); case NgParameterKind.FlybyCamerasInLevel: return(level.Rooms.Where(room => room != null).SelectMany(room => room.Objects).OfType <FlybyCameraInstance>()); case NgParameterKind.Rooms255: return(level.Rooms.Where(room => room != null)); case NgParameterKind.SoundEffectsA: return(Enumerable.Range(0, 256).Select(formatSounds1)); case NgParameterKind.SoundEffectsB: return(Enumerable.Range(0, 114).Select(formatSounds2)); case NgParameterKind.Sfx1024: return(Enumerable.Range(0, 1024).Select(formatSounds1)); case NgParameterKind.PcStringsList: return(LoadStringsFromTxt(level, "PCStrings")); case NgParameterKind.PsxStringsList: return(LoadStringsFromTxt(level, "PSXStrings")); case NgParameterKind.NgStringsList255: return(LoadStringsFromTxt(level, "ExtraNG", 256, 1)); case NgParameterKind.NgStringsAll: return(LoadStringsFromTxt(level, "ExtraNG", 1)); case NgParameterKind.StringsList255: return(LoadStringsFromTxt(level, "Strings", 256)); case NgParameterKind.WadSlots: if (level?.Settings == null) { return(new ITriggerParameter[0]); } return(level.Settings.WadGetAllMoveables().Select(p => new TriggerParameterUshort( checked ((ushort)p.Key.TypeId), p.Value.ToString(level.Settings.GameVersion.Native())))); case NgParameterKind.StaticsSlots: if (level?.Settings == null) { return(new ITriggerParameter[0]); } return(level.Settings.WadGetAllStatics().Select(p => new TriggerParameterUshort( checked ((ushort)p.Key.TypeId), p.Value.ToString(level.Settings.GameVersion.Native())))); case NgParameterKind.LaraStartPosOcb: return(level.Rooms.Where(room => room != null) .SelectMany(room => room.Objects) .OfType <MoveableInstance>().Where(obj => obj.WadObjectId.TypeId == 406) // Lara start pos .Select(obj => new TriggerParameterUshort(unchecked ((ushort)obj.Ocb), obj))); default: throw new ArgumentException("Unknown NgListKind \"" + Kind + "\""); } }