Exemple #1
0
        private ImmutableArray <Strip> LoadStrips(BinaryReader reader, int count)
        {
            Strip[] strips = new Strip[count];
            for (int i = 0; i < count; ++i)
            {
                long offset = reader.BaseStream.Position;

                int        indexCount             = reader.ReadInt32();
                int        indexOffset            = reader.ReadInt32();
                int        vertexCount            = reader.ReadInt32();
                int        vertexOffset           = reader.ReadInt32();
                int        boneCount              = reader.ReadUInt16();
                StripFlags flags                  = (StripFlags)reader.ReadByte();
                int        boneStateChangesCount  = reader.ReadInt32();
                long       boneStateChangesOffset = offset + reader.ReadInt32();

                long save = reader.BaseStream.Position;
                reader.BaseStream.Position = boneStateChangesOffset;

                strips[i] = new Strip(indexCount, indexOffset, vertexCount, vertexOffset, boneCount, flags,
                                      LoadBoneStateChanges(reader, boneStateChangesCount));

                reader.BaseStream.Position = save;
            }
            return(new ImmutableArray <Strip>(strips));
        }
        static bool doStripCorpse(RecipeDef def, Thing thing)
        {
            if (!def.autoStripCorpses)
            {
                IStrippable strippable = thing as IStrippable;
                Corpse      corpse     = thing as Corpse;
                Pawn        pawn;
                if (corpse == null)
                {
                    pawn = thing as Pawn;
                }
                else
                {
                    pawn = corpse.InnerPawn;
                }

                StripFlags val = StripFlags.None;
                if (pawn != null)
                {
                    val = Settings.getStripFlags();
                    if (!CompStripChecker.MarkAll(pawn, true, val))
                    {
                        val = StripFlags.None;
                    }
                }

                return(strippable != null && thing.MapHeld != null && (val != StripFlags.None || thing.MapHeld.designationManager.DesignationOn(thing, DesignationDefOf.Strip) != null));
            }
            else
            {
                return(true);
            }
        }
Exemple #3
0
        public static StripFlags getStripFlags()
        {
            StripFlags flags = StripFlags.None;

            if (strip_apparel)
            {
                flags |= StripFlags.Apparel;
            }
            if (strip_equipment)
            {
                flags |= StripFlags.Equipment;
            }
            if (strip_inventory)
            {
                flags |= StripFlags.Inventory;
            }
            if (strip_smeltable)
            {
                flags |= StripFlags.Smeltable;
            }
            if (strip_untainted)
            {
                flags |= StripFlags.Untainted;
            }
            if (!allow_cremate_nonburnable)
            {
                flags |= StripFlags.Unburnable;
            }

            return(flags);
        }
Exemple #4
0
            internal Strip(int indexCount, int indexOffset, int vertexCount, int vertexOffset, int boneCount, StripFlags flags,
                           ImmutableArray <BoneStateChange> boneStateChanges)
            {
                IndexCount  = indexCount;
                IndexOffset = indexOffset;

                VertexCount  = vertexCount;
                VertexOffset = vertexOffset;

                BoneCount = boneCount;

                Flags = flags;

                BoneStateChanges = boneStateChanges;
            }
Exemple #5
0
            internal Strip(int indexCount, int indexOffset, int vertexCount, int vertexOffset, int boneCount, StripFlags flags,
                ImmutableArray<BoneStateChange> boneStateChanges)
            {
                IndexCount = indexCount;
                IndexOffset = indexOffset;

                VertexCount = vertexCount;
                VertexOffset = vertexOffset;

                BoneCount = boneCount;

                Flags = flags;

                BoneStateChanges = boneStateChanges;
            }
        public static bool MarkAll(Pawn pawn, bool val, StripFlags flags = StripFlags.Apparel | StripFlags.Equipment | StripFlags.Inventory)
        {
            bool result = false;

            ThingOwner <Thing> inventory = pawn.inventory == null ? null : pawn.inventory.innerContainer;

            if (!inventory.NullOrEmpty())
            {
                foreach (var t in inventory)
                {
                    if (flagMark(t as ThingWithComps, StripFlags.Inventory, flags))
                    {
                        result |= true;
                        GetChecker(t).ShouldStrip = val;
                    }
                }
            }
            //
            List <ThingWithComps> equipment = pawn.equipment == null ? null : pawn.equipment.AllEquipmentListForReading;

            if (!equipment.NullOrEmpty())
            {
                foreach (var t in equipment)
                {
                    if (flagMark(t as ThingWithComps, StripFlags.Equipment, flags))
                    {
                        result |= true;
                        GetChecker(t).ShouldStrip = val;
                    }
                }
            }
            //
            List <Apparel> apparel = pawn.apparel == null ? null : pawn.apparel.WornApparel;

            if (!equipment.NullOrEmpty())
            {
                foreach (var t in apparel)
                {
                    if (flagMark(t as ThingWithComps, StripFlags.Apparel, flags))
                    {
                        result |= true;
                        GetChecker(t).ShouldStrip = val;
                    }
                }
            }
            //
            return(result);
        }
 static bool flagMark(ThingWithComps thing, StripFlags crossFlags, StripFlags stripFlags)
 {
     if (thing == null || crossFlags.HasFlag(StripFlags.Equipment) && !stripFlags.HasFlag(StripFlags.Unburnable) && thing.Stuff != null && !thing.Stuff.burnableByRecipe)
     {
         return(false);
     }
     if (stripFlags.HasFlag(StripFlags.Inventory) && crossFlags.HasFlag(StripFlags.Inventory) ||
         stripFlags.HasFlag(StripFlags.Equipment) && crossFlags.HasFlag(StripFlags.Equipment) ||
         stripFlags.HasFlag(StripFlags.Apparel) && crossFlags.HasFlag(StripFlags.Apparel) && (!stripFlags.HasFlag(StripFlags.Untainted) || !thing.def.IsApparel || !((Apparel)thing).WornByCorpse) ||
         stripFlags.HasFlag(StripFlags.Smeltable) && (crossFlags.HasFlag(StripFlags.Equipment) || crossFlags.HasFlag(StripFlags.Apparel)) && thing.Smeltable)
     {
         return(true);
     }
     //
     return(false);
 }
Exemple #8
0
 /// <summary>
 ///   Strips extraneous information from a compiled shader or effect.
 /// </summary>
 /// <param name = "flags">Options specifying what to remove from the shader.</param>
 /// <returns>A string containing any errors that may have occurred.</returns>
 /// <unmanaged>HRESULT D3DStripShader([In, Buffer] const void* pShaderBytecode,[In] SIZE_T BytecodeLength,[In] D3DCOMPILER_STRIP_FLAGS uStripFlags,[Out] ID3D10Blob** ppStrippedBlob)</unmanaged>
 public unsafe ShaderBytecode Strip(StripFlags flags)
 {
     Blob blob;
     fixed (void* bufferPtr = Data)
     if (D3D.StripShader((IntPtr)bufferPtr, Data.Length, flags, out blob).Failure)
         return null;
     return new ShaderBytecode(blob);
 }