/// <summary> /// Start flare sequence. /// </summary> public void Start() { if (Game.GameTime - timeSinceLastDrop > MaxDropTime + CooldownTime) { RemoveAll(); for (int i = 0; i < sequenceList.Count; i++) { sequenceList[i].Start(); sqFlags |= (SequenceFlags)(1 << i); } if (Player is LocalPlayer) { var soundMgr = ScriptThread.GetOrAddExtension <SoundManager>(); soundMgr.PlayExternalSound(Properties.Resources.flares_equip1); } timeSinceLastDrop = Game.GameTime; bCooldownActive = true; } }
private Set(int elementType, SequenceKind kind, SequenceFlags flags, MemStorage storage) : base(storage) { var pSet = NativeMethods.cvCreateSet(elementType | (int)kind | (int)flags, SeqHelper.SetHeaderSize, MatHelper.GetElemSize(elementType), storage); SetHandle(pSet); }
private Seq(int elementType, SequenceKind kind, SequenceFlags flags, MemStorage storage) : base(true) { owner = storage; var pSeq = NativeMethods.cvCreateSeq(elementType | (int)kind | (int)flags, SeqHelper.SeqHeaderSize, (UIntPtr)MatHelper.GetElemSize((int)elementType), storage); SetHandle(pSeq); }
/// <summary> /// Runs when an active flare sequence has completed. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void OnFlareSequenceCompleted(object sender, EventArgs args) { for (int i = sequenceList.Count; i > -1; i--) { SequenceFlags flag = (SequenceFlags)(1 << i); if (sqFlags.HasFlag(flag)) { sqFlags &= ~flag; break; } } if (!AnySequenceActive && Player is LocalPlayer) { UI.Notify("IR flares recharging."); } }
public Sequence(byte[] raw) { _Name = Encoding.ASCII.GetString(raw, 0, 32).Trim('\0'); _FramesPerSecond = BitConverter.ToSingle(raw, 32); _Flags = (SequenceFlags)BitConverter.ToInt32(raw, 36); _Activity = BitConverter.ToInt32(raw, 40); _ActivityWeight = BitConverter.ToInt32(raw, 44); _Events = new CountOffsetPair(BitConverter.ToInt32(raw, 48), BitConverter.ToInt32(raw, 52)); _EventCollection = new Event[_Events.Count]; _FrameCount = BitConverter.ToInt32(raw, 56); _Pivots = new CountOffsetPair(BitConverter.ToInt32(raw, 60), BitConverter.ToInt32(raw, 64)); _PivotCollection = new Pivot[_Pivots.Count]; _MotionType = (MotionFlags)BitConverter.ToInt32(raw, 68); _MotionBone = BitConverter.ToInt32(raw, 72); _LinearMovement = new Point3D(BitConverter.ToSingle(raw, 76), BitConverter.ToSingle(raw, 80), BitConverter.ToSingle(raw, 84)); _AutomovePositionIndex = BitConverter.ToInt32(raw, 88); _AutomoveAngleIndex = BitConverter.ToInt32(raw, 92); _BoundingBoxMin = new Point3D(BitConverter.ToSingle(raw, 96), BitConverter.ToSingle(raw, 100), BitConverter.ToSingle(raw, 104)); _BoundingBoxMax = new Point3D(BitConverter.ToSingle(raw, 108), BitConverter.ToSingle(raw, 112), BitConverter.ToSingle(raw, 116)); _BlendCount = BitConverter.ToInt32(raw, 120); _AnimationOffset = BitConverter.ToInt32(raw, 124); _BlendType[0] = (MotionFlags)BitConverter.ToInt32(raw, 128); _BlendType[1] = (MotionFlags)BitConverter.ToInt32(raw, 132); _BlendStart[0] = BitConverter.ToSingle(raw, 136); _BlendStart[1] = BitConverter.ToSingle(raw, 140); _BlendEnd[0] = BitConverter.ToSingle(raw, 144); _BlendEnd[1] = BitConverter.ToSingle(raw, 148); _BlendParent = BitConverter.ToInt32(raw, 152); _SequenceGroupIndex = BitConverter.ToInt32(raw, 156); _NodeEntry = BitConverter.ToInt32(raw, 160); _NodeExit = BitConverter.ToInt32(raw, 164); _NodeFlags = (NodeFlags)BitConverter.ToInt32(raw, 168); _Unknown[0] = BitConverter.ToInt32(raw, 172); _Unknown[1] = BitConverter.ToInt32(raw, 176); _Unknown[2] = BitConverter.ToInt32(raw, 180); _Unknown[3] = BitConverter.ToInt32(raw, 184); }
/// <summary> /// Tests whether or not this sequence uses a particular type of animation. /// </summary> /// <param name="flags">The flags to test</param> /// <returns>True if the flag is set, false otherwise.</returns> public bool TestFlags(SequenceFlags flags) { return (Flags & flags) != 0; }
/// <summary> /// Initializes the shape by computing various static information based on the various /// components (sequences, detail levels, etc) that have been loaded. /// </summary> public void Initialize() { int numSubShapes = SubShapeFirstNode.Length; Assert.Fatal(numSubShapes == SubShapeFirstObject.Length, "TSShape.Initialize - Invalid sub shape count."); int i, j; // Set up parent/child relationships on nodes and objects for (i = 0; i < Nodes.Length; i++) Nodes[i].FirstObject = Nodes[i].FirstChild = Nodes[i].NextSibling = -1; for (i = 0; i < Nodes.Length; i++) { int parentIndex = Nodes[i].ParentIndex; if (parentIndex >= 0) { if (Nodes[parentIndex].FirstChild < 0) Nodes[parentIndex].FirstChild = i; else { int child = Nodes[parentIndex].FirstChild; while (Nodes[child].NextSibling >= 0) child = Nodes[child].NextSibling; Nodes[child].NextSibling = i; } } } for (i = 0; i < Objects.Length; i++) { Objects[i].NextSibling = -1; int nodeIndex = Objects[i].NodeIndex; if (nodeIndex >= 0) { if (Nodes[nodeIndex].FirstObject < 0) Nodes[nodeIndex].FirstObject = i; else { int objectIndex = Nodes[nodeIndex].FirstObject; while (Objects[objectIndex].NextSibling >= 0) objectIndex = Objects[objectIndex].NextSibling; Objects[objectIndex].NextSibling = i; } } } Flags = 0; for (i = 0; i < Sequences.Length; i++) { if (!Sequences[i].IsScaleAnimated()) continue; SequenceFlags curVal = Flags & SequenceFlags.AnyScale; SequenceFlags newVal = Sequences[i].Flags & SequenceFlags.AnyScale; Flags &= ~(SequenceFlags.AnyScale); Flags |= (SequenceFlags)Math.Max((uint)curVal, (uint)newVal); // take the larger value (can only convert upwards) } for (i = 0; i < Details.Length; i++) { int count = 0; int ss = Details[i].SubShapeNumber; int od = Details[i].ObjectDetailNumber; if (ss < 0) { // billboard detail... // Note: not implemented, but still need to skip this if shape has one count += 2; continue; } int start = SubShapeFirstObject[ss]; int end = start + SubShapeObjectCount[ss]; for (j = start; j < end; j++) { if (od < Objects[j].MeshCount) { Mesh mesh = Meshes[Objects[j].FirstMesh + od]; count += mesh != null ? mesh.GetNumPolys() : 0; } } Details[i].PolyCount = count; } InitializeMaterialList(); }
/// <summary> /// Initializes a new instance of the <see cref="Seq"/> class with the specified /// element bit <paramref name="depth"/>, <paramref name="channels"/> per element, /// sequence <paramref name="kind"/> and operational <paramref name="flags"/>. /// Memory for the sequence will be allocated from the provided <paramref name="storage"/>. /// </summary> /// <param name="depth">The bit depth of sequence elements.</param> /// <param name="channels">The number of channels per sequence element.</param> /// <param name="kind">The kind of sequence to create.</param> /// <param name="flags">The operational flags for the sequence.</param> /// <param name="storage">The memory storage used to grow the sequence.</param> public Seq(Depth depth, int channels, SequenceKind kind, SequenceFlags flags, MemStorage storage) : this(MatHelper.GetMatType(depth, channels), kind, flags, storage) { }
/// <summary> /// Initializes a new instance of the <see cref="Seq"/> class with the specified /// common element type, sequence <paramref name="kind"/> and operational <paramref name="flags"/>. /// Memory for the sequence will be allocated from the provided <paramref name="storage"/>. /// </summary> /// <param name="elementType">The type of elements in the sequence.</param> /// <param name="kind">The kind of sequence to create.</param> /// <param name="flags">The operational flags for the sequence.</param> /// <param name="storage">The memory storage used to grow the sequence.</param> public Seq(SequenceElementType elementType, SequenceKind kind, SequenceFlags flags, MemStorage storage) : this((int)elementType, kind, flags, storage) { }