Exemplo n.º 1
0
 protected override int OnGetSize()
 {
     _builder     = new DataBuilder(this);
     _entryLength = 124 + ExtraDataOffsets.GetOffsets(((MovesetNode)_root).Character).Count * 4;
     _childLength = _builder.CalcSize();
     return(_entryLength + _childLength);
 }
        public static void ParseCharacter(CharName name, DataSection data, VoidPtr address)
        {
            OffsetHolder o = ExtraDataOffsets.GetOffsets(name);

            if (o != null)
            {
                o.Parse(data, address);
            }
        }
        protected override void OnParse(VoidPtr address)
        {
            //Initialize lists
            _paramLists = new List <RawParamList>();
            _articles   = new List <ArticleNode>();
            _subActions = new BindingList <SubActionEntry>();

            //Get header values
            _hdr    = *(DataHeader *)address;
            _unk27  = _hdr.Unknown27;
            _unk28  = _hdr.Unknown28;
            _flags1 = _hdr.Flags1;
            _flags2 = _hdr.Flags2;

            bint *v = (bint *)address;

            //Calculate the size of each section using the offsets in order of data appearance
            int[] sizes = SakuraiArchiveNode.CalculateSizes(_root._dataSize, v, 27, true);

            //Parse any data related to scripts
            ParseScripts(v, sizes);

            //Now parse all other data entries for this character.
            //If an offset is 0 (except for the attributes), the entry will be set to null.

            //subaction flags (offset 0) are parsed in ParseScripts
            _modelVis          = Parse <ModelVisibility>(v[1]);
            _attributes        = Parse <AttributeList>(v[2], "Attributes");
            _sseAttributes     = Parse <AttributeList>(v[3]);
            _misc              = Parse <MiscSectionNode>(v[4]);
            _commonActionFlags = Parse <EntryList <ActionFlags> >(v[5], 0x10);
            //action flags (offset 6) are parsed in ParseScripts
            _unknown7         = Parse <EntryList <Unknown7Entry> >(v[7], 8);
            _actionInterrupts = Parse <ActionInterrupts>(v[8]);
            //entry actions (offset 9) are parsed in ParseScripts
            //exit actions (offset 10) are parsed in ParseScripts
            _actionPre = Parse <EntryList <ActionPre> >(v[11], 4);
            //main subactions (offset 12) are parsed in ParseScripts
            //gfx subactions (offset 13) are parsed in ParseScripts
            //sfx subactions (offset 14) are parsed in ParseScripts
            //other subactions (offset 15) are parsed in ParseScripts
            _anchoredItems  = Parse <EntryList <ItemAnchor> >(v[16], sItemAnchor.Size);
            _gooeyBomb      = Parse <EntryList <ItemAnchor> >(v[17], sItemAnchor.Size);
            _boneRef1       = Parse <EntryList <BoneIndexValue> >(v[18], 4, sizes[18] / 4);
            _boneRef2       = Parse <BoneReferences2>(v[19]);
            _entryOverrides = Parse <ActionOverrideList>(v[20]);
            _exitOverrides  = Parse <ActionOverrideList>(v[21]);
            _unknown22      = Parse <Unknown22>(v[22]);
            _samusCannon    = Parse <EntryList <ItemAnchor> >(v[23], sItemAnchor.Size + 4);
            _unknown24      = Parse <Unknown24>(v[24]);

            //Parse extra offsets specific to this character
            //It appears that the module controls this data
            ExtraDataOffsets.ParseCharacter(((MovesetNode)_root).Character, this, address + DataHeader.Size);

            //Sort and set article indices (they are parsed as extra offsets)
            int u = 0;

            _articles = _articles.OrderBy(x => x._offset).ToList();
            foreach (ArticleNode e in _articles)
            {
                e._index = u++;
            }
        }