Esempio n. 1
0
        protected override void OnParse(VoidPtr address)
        {
            sActionFlags *hdr = (sActionFlags *)address;

            flags1 = new Bin32((uint)hdr->_flags1);
            flags2 = new Bin32((uint)hdr->_flags2);
            flags3 = new Bin32((uint)hdr->_flags3);
            flags4 = new Bin32((uint)hdr->_flags4);
        }
Esempio n. 2
0
        protected override void OnWrite(VoidPtr address)
        {
            RebuildAddress = address;

            sActionFlags *header = (sActionFlags *)address;

            header->_flags1 = (int)(uint)flags1;
            header->_flags2 = (int)(uint)flags2;
            header->_flags3 = (int)(uint)flags3;
            header->_flags4 = (int)(uint)flags4;
        }
Esempio n. 3
0
        protected override void OnWrite(VoidPtr address)
        {
            RebuildAddress = address;

            sActionFlags *values = (sActionFlags *)address;

            values->_flags1 = Flags1;
            values->_flags2 = Flags2;
            values->_flags3 = Flags3;
            values->_flags4 = Flags4;
        }
        private void ParseScripts(bint *hdr, int[] sizes)
        {
            Script             s = null;
            int                size, count;
            bint *             actionOffset;
            List <List <int> > list;

            MovesetNode node = _root as MovesetNode;

            sSubActionFlags *sflags = (sSubActionFlags *)Address(hdr[0]);
            sActionFlags *   aflags = (sActionFlags *)Address(hdr[6]);

            //Collect offsets first
            size = sizes[9];
            for (int i = 9; i < 11; i++)
            {
                if (hdr[i] < 0)
                {
                    continue;
                }
                actionOffset = (bint *)Address(hdr[i]);
                for (int x = 0; x < size / 4; x++)
                {
                    node._scriptOffsets[0][i - 9].Add(actionOffset[x]);
                }
            }
            size = sizes[12];
            for (int i = 12; i < 16; i++)
            {
                if (hdr[i] < 0)
                {
                    continue;
                }
                actionOffset = (bint *)Address(hdr[i]);
                for (int x = 0; x < size / 4; x++)
                {
                    node._scriptOffsets[1][i - 12].Add(actionOffset[x]);
                }
            }

            //Now parse scripts using collected offsets
            //The offsets are stored in the root in order to find scripts later

            //Actions first
            ActionEntry ag;

            list          = node._scriptOffsets[0];
            count         = list[0].Count;
            node._actions = new BindingList <ActionEntry>();
            for (int i = 0; i < count; i++)
            {
                sActionFlags flag = aflags[i];
                node.Actions.Add(ag = new ActionEntry(flag, i, i + 274));
                for (int x = 0; x < 2; x++)
                {
                    if (i < list[x].Count && list[x][i] > 0)
                    {
                        s = Parse <Script>(list[x][i]);
                    }
                    else
                    {
                        s = new Script();
                    }
                    ag.SetWithType(x, s);
                }
            }

            //Now subactions
            SubActionEntry sg;

            list        = node._scriptOffsets[1];
            count       = list[0].Count;
            _subActions = new BindingList <SubActionEntry>();
            for (int i = 0; i < count; i++)
            {
                sSubActionFlags flag = sflags[i];
                _subActions.Add(sg = new SubActionEntry(flag, flag._stringOffset > 0 ? new String((sbyte *)Address(flag._stringOffset)) : "<null>", i));
                for (int x = 0; x < 4; x++)
                {
                    if (i < list[x].Count && list[x][i] > 0)
                    {
                        s = Parse <Script>(list[x][i]);
                    }
                    else
                    {
                        s = new Script();
                    }
                    sg.SetWithType(x, s);
                }
            }
        }