コード例 #1
0
        private void ParseScripts(bint *hdr, int[] sizes)
        {
            Script             s = null;
            int                size, count;
            bint *             actionOffset;
            List <List <int> > list;

            //Collect offsets first

            size = sizes[4];
            for (int i = 4; i < 6; i++)
            {
                if (hdr[i] < 0)
                {
                    continue;
                }
                actionOffset = (bint *)Address(hdr[i]);
                for (int x = 0; x < size / 4; x++)
                {
                    _root._scriptOffsets[0][i - 4].Add(actionOffset[x]);
                }
            }
            List <uint> flags1 = new List <uint>(), flags2 = new List <uint>();

            size = _root.GetSize(hdr[6]);
            if (hdr[6] > 0)
            {
                actionOffset = (bint *)Address(hdr[6]);
                for (int x = 0; x < size / 8; x++)
                {
                    _root._scriptOffsets[3][0].Add(actionOffset[x * 2]);
                    flags1.Add((uint)(int)actionOffset[x * 2 + 1]);
                }
            }
            size = _root.GetSize(hdr[20]);
            if (hdr[20] > 0)
            {
                actionOffset = (bint *)Address(hdr[20]);
                for (int x = 0; x < size / 8; x++)
                {
                    _root._scriptOffsets[4][0].Add(actionOffset[x * 2]);
                    flags2.Add((uint)(int)actionOffset[x * 2 + 1]);
                }
            }

            //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++)
            {
                _root.Actions.Add(ag = new ActionEntry(new sActionFlags(), i, i));
                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);
                }
            }

            _flashOverlays = new BindingList <CommonAction>();
            _screenTints   = new BindingList <CommonAction>();

            CommonAction ca;

            list  = _root._scriptOffsets[3];
            count = list[0].Count;
            for (int i = 0; i < count; i++)
            {
                if (i < list[0].Count && list[0][i] > 0)
                {
                    ca = Parse <CommonAction>(list[0][i], flags1[i]);
                }
                else
                {
                    ca = new CommonAction(flags1[i]);
                }
                ca._index = i;
                _flashOverlays.Add(ca);
            }
            list  = _root._scriptOffsets[4];
            count = list[0].Count;
            for (int i = 0; i < count; i++)
            {
                if (i < list[0].Count && list[0][i] > 0)
                {
                    ca = Parse <CommonAction>(list[0][i], flags2[i]);
                }
                else
                {
                    ca = new CommonAction(flags2[i]);
                }
                ca._index = i;
                _screenTints.Add(ca);
            }
        }
コード例 #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);
                }
            }
        }