public BRESHeader(int size, int numSections)
 {
     _tag = Tag;
     _endian = 0xFEFF;
     _version = 0;
     _fileSize = (uint)size;
     _rootOffset = 0x10;
     _numSections = (ushort)numSections;
 }
        public CHR0v4_3(int version, int size, int frames, int entries, int loop)
        {
            _header._tag = Tag;
            _header._size = size;
            _header._bresOffset = 0;

            _header._version = version;
            _dataOffset = Size;
            _stringOffset = 0;
            _origPathOffset = _scalingRule = 0;
            _numFrames = (ushort)frames;
            _numEntries = (ushort)entries;
            _loop = loop;
        }
        public PLT0v1(int length, WiiPaletteFormat format)
        {
            _bresEntry._tag = Tag;
            _bresEntry._size = (length * 2) + Size;
            _bresEntry._version = 1;
            _bresEntry._bresOffset = 0;

            _headerLen = 0x40;
            _stringOffset = 0;
            _pixelFormat = (uint)format;
            _numEntries = (short)length;
            _pad = 0;
            _origPathOffset = 0;
        }
 public bool this[int index]
 {
     get { return((_data >> index & 1) != 0); }
     set
     {
         if (value)
         {
             _data = (ushort)((ushort)_data | (ushort)(1 << index));
         }
         else
         {
             _data = (ushort)((ushort)_data & ~(ushort)(1 << index));
         }
     }
 }
        //public ushort this[int shift, int mask]
        //{
        //    get { return (ushort)(data >> shift & mask); }
        //    set { data = (ushort)((data & ~(mask << shift)) | ((value & mask) << shift)); }
        //}

        public ushort this[int shift, int bitCount]
        {
            get
            {
                int mask = 0;
                for (int i = 0; i < bitCount; i++)
                {
                    mask |= 1 << i;
                }
                return((ushort)((_data >> shift) & mask));
            }
            set
            {
                int mask = 0;
                for (int i = 0; i < bitCount; i++)
                {
                    mask |= 1 << i;
                }
                _data = (ushort)((_data & ~(mask << shift)) | ((value & mask) << shift));
            }
        }
 public SCN0KeyframesHeader(int entries)
 {
     _numFrames = (ushort)entries;
     _unk = 0;
 }
 public wRGB565Pixel(bushort data)
 {
     _data = data;
 }
 public PrimitiveHeader(WiiPrimitiveType type, int entries)
 {
     Type = type;
     Entries = (ushort)entries;
 }
 public ColPlane(int pInd1, int pInd2, int pLink1, int pLink2, CollisionPlaneType type, CollisionPlaneFlags2 flags2, CollisionPlaneFlags flags, CollisionPlaneMaterial material)
 {
     _point1 = (short)pInd1;
     _point2 = (short)pInd2;
     _link1 = (short)pLink1;
     _link2 = (short)pLink2;
     _magic = -1;
     _type = (ushort)((int)flags2 | (int)type);
     _flags = flags;
     _material = material;
 }
        public void Set(int planeIndex, int planeCount, Vector2 boxMin, Vector2 boxMax, string modelName, string boneName)
        {
            _planeIndex = (short)planeIndex;
            _planeCount = (short)planeCount;
            _unk1 = 0;
            _unk2 = 0;
            _unk3 = 0;
            _flags = 0;
            _boxMin = boxMin;
            _boxMax = boxMax;
            _unk5 = 0;
            _unk6 = 0;

            ModelName = modelName;
            BoneName = boneName;
        }
        public I6Entry(int index, int step, float tangent)
        {
            _data = (ushort)(index << 5);
            _step = (ushort)step;

            tangent *= 256.0f;
            if (tangent < 0.0f)
                tangent -= 0.5f;
            else
                tangent += 0.5f;

            _exp = (short)((int)tangent).Clamp(-32768, 32767);
        }
Beispiel #12
0
 public unsafe MDL0Node3Class(MDL0NodeType3* ptr)
 {
     _id = ptr->_id;
     for (int i = 0; i < ptr->_numEntries; i++)
         _entries.Add(ptr->Entries[i]);
 }
 public Bin16(ushort val)
 {
     _data = val;
 }
 public I12Header(int entries, float frameScale)
 {
     _numFrames = (ushort)entries;
     _pad = 0;
     _frameScale = frameScale;
 }
 public I6Header(int frames, float frameScale, float step, float floor)
 {
     _numFrames = (ushort)frames;
     _unk1 = 0;
     _frameScale = frameScale;
     _step = step;
     _base = floor;
 }
        public ColObject(int planeIndex, int planeCount, int pointOffset, int pointCount, Vector2 boxMin, Vector2 boxMax, string modelName, string boneName,
            int unk1, int unk2, int unk3, int flags, int unk5, int unk6, int boneIndex)
        {
            _planeIndex = (short)planeIndex;
            _planeCount = (short)planeCount;
            _unk1 = unk1;
            _unk2 = unk2;
            _unk3 = unk3;
            _flags = (ushort)flags;
            _unk5 = (short)unk5;
            _boxMin = boxMin;
            _boxMax = boxMax;
            _pointOffset = (short)pointOffset;
            _pointCount = (short)pointCount;
            _unk6 = (short)unk6;
            _boneIndex = (short)boneIndex;

            fixed (byte* p = _modelName)
                SetStr(p, modelName);

            fixed (byte* p = _boneName)
                SetStr(p, boneName);
        }
 public I4Header(int entries, float frameScale, float step, float floor)
 {
     _entries = (ushort)entries;
     _unk = 0;
     _frameScale = frameScale;
     _step = step;
     _base = floor;
 }