Ejemplo n.º 1
0
 public ActionEntry(sActionFlags flags, int i, int id)
 {
     _flags1 = flags._flags1;
     _flags2 = flags._flags2;
     _flags3 = flags._flags3;
     _flags4 = flags._flags4;
     _index  = i;
     _id     = id;
 }
Ejemplo n.º 2
0
        private void ParseScripts(bint *hdr, int[] sizes)
        {
            Script             s = null;
            int                size, count;
            bint *             actionOffset;
            List <List <int> > list;

            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++)
                {
                    _root._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++)
                {
                    _root._scriptOffsets[1][i - 12].Add(actionOffset[x]);
                }
            }

            //Now parse scripts

            ActionEntry ag;

            list          = _root._scriptOffsets[0];
            count         = list[0].Count;
            _root.Actions = new BindingList <ActionEntry>();
            for (int i = 0; i < count; i++)
            {
                sActionFlags flag = aflags[i];
                _root.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);
                }
            }

            SubActionEntry sg;

            list        = _root._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);
                }
            }
        }