Ejemplo n.º 1
0
        public void AddEntity(IEntityG entity)
        {
            switch (entity.Type)
            {
            case EntityGType.line:
                Lines.Add((LineG)entity);
                break;

            case EntityGType.arc:
                Circles.Add((CircleG)entity);
                break;

            case EntityGType.loop:
                Loops.Add((LoopG)entity);
                break;

            case EntityGType.surf:
                Surfaces.Add((PlaneSurface)entity);
                break;

            case EntityGType.phsurf:
                PhySurfaces.Add((PhysicalSurface)entity);
                break;

            case EntityGType.phcurve:
                PhyCurves.Add((PhysicalCurve)entity);
                break;

            case EntityGType.point:
                Points.Add((PointG)entity);
                break;
            }
        }
Ejemplo n.º 2
0
        protected override void LoadChunk(IntPtr ptr, string type, uint size)
        {
            switch (type)
            {
            case "DLID":
            case "GUID":
                break;

            case "fmt ":
                Format = Marshal.PtrToStructure <CK_FMT>(ptr);
                break;

            case "data":
                Addr = (uint)ptr.ToInt64();
                Size = size;
                break;

            case "wsmp":
                Sampler = Marshal.PtrToStructure <CK_WSMP>(ptr);
                ptr    += Marshal.SizeOf <CK_WSMP>();
                for (uint i = 0; i < Sampler.loopCount; ++i)
                {
                    Loops.Add(Marshal.PtrToStructure <WAVE_LOOP>(ptr));
                    ptr += Marshal.SizeOf <WAVE_LOOP>();
                }
                HasLoop = 0 < Sampler.loopCount;
                break;

            default:
                throw new Exception("[WAVE]Unknown ChunkType");
            }
        }
Ejemplo n.º 3
0
        protected override void LoadChunk(IntPtr ptr, string type, uint size)
        {
            switch (type)
            {
            case "rgnh":
                Header = Marshal.PtrToStructure <CK_RGNH>(ptr);
                break;

            case "wlnk":
                WaveLink = Marshal.PtrToStructure <CK_WLNK>(ptr);
                break;

            case "wsmp":
                Sampler = Marshal.PtrToStructure <CK_WSMP>(ptr);
                ptr    += Marshal.SizeOf <CK_WSMP>();
                for (uint i = 0; i < Sampler.loopCount; ++i)
                {
                    Loops.Add(Marshal.PtrToStructure <WAVE_LOOP>(ptr));
                    ptr += Marshal.SizeOf <WAVE_LOOP>();
                }
                HasSampler = true;
                HasLoop    = 0 < Sampler.loopCount;
                break;

            default:
                throw new Exception("[RGN_]Unknown ChunkType");
            }
        }
Ejemplo n.º 4
0
        private List <List <string> > filterPaths(List <List <string> > strPaths)
        {
            List <List <string> > strFilteredPaths = new List <List <string> >();

            foreach (var checkingPath in strPaths)
            {
                int  clearPath = 0; //0: clean, 1: loop start; 2 dirtyPath
                bool firstNode = true;
                foreach (var nodeKey in checkingPath)
                {
                    if (firstNode)
                    {
                        firstNode = false;
                        continue;
                    }

                    //check there's no path starting from this Node key
                    //that should remove loops
                    int index = 0;
                    foreach (var lookupPath in strPaths)
                    {
                        if (lookupPath.Count > 1 && lookupPath[1].Equals(nodeKey))
                        {
                            //this is a loop, skip
                            if (lookupPath.Count < checkingPath.Count)
                            {
                                if (index == 0)
                                {
                                    clearPath = 1;
                                }
                                else
                                {
                                    clearPath = 2;
                                }
                                break;
                            }
                        }
                        index++;
                    }

                    if (clearPath != 0)
                    {
                        break;
                    }
                }

                if (clearPath == 1)
                {
                    //HACK: add to loops Dict
                    Loops.Add(checkingPath, "");
                    strFilteredPaths.Add(checkingPath);
                }
                else if (clearPath == 0)
                {
                    strFilteredPaths.Add(checkingPath);
                }
            }

            return(strFilteredPaths);
        }
Ejemplo n.º 5
0
    private void HandleLoop(Loop loop)
    {
        Loops.Add(loop);
        Command command = ReciveComand(Command.Loop.ToString());

        TranslateCommandToCode(Command.Loop, loop.NumberIterations.ToString());
        GameManager.instance.NextCommandTutoredGameplay();
        GameManager.instance.LoopMode = true;
        LoopButton loopButton = mainPanel.GetComponent <MainPanel>().CommandsPanel.LoopButton.GetComponent <LoopButton>();

        loopButton.ActivateLoopMode();
    }
Ejemplo n.º 6
0
        public SCIView(byte[] data)
        {
            MemoryStream ms         = new MemoryStream(data);
            var          loopsCount = ms.ReadB();

            ms.Position++; // Skip const 80
            var mask = ms.ReadUShortBE();

            ms.Position += 2; // Skip unkown
            var palOffset = ms.ReadUShortBE();

            ushort[] offsets = new ushort[loopsCount];
            for (int i = 0; i < loopsCount; i++)
            {
                offsets[i] = ms.ReadUShortBE();
            }

            for (int i = 0; i < loopsCount; i++)
            {
                var loop = new Loop();
                Loops.Add(loop);

                ms.Position = offsets[i];
                var cellsCount = ms.ReadUShortBE();
                ms.Position += 2; // Skip unknown
                ushort[] cellOffsets = new ushort[cellsCount];
                for (int j = 0; j < cellsCount; j++)
                {
                    cellOffsets[j] = ms.ReadUShortBE();
                }

                for (int j = 0; j < cellsCount; j++)
                {
                    var cell = new Cell();
                    loop.Cells.Add(cell);

                    ms.Position = cellOffsets[j];

                    cell.Width            = ms.ReadUShortBE();
                    cell.Height           = ms.ReadUShortBE();
                    cell.PlacementX       = ms.ReadB();
                    cell.PlacementY       = ms.ReadB();
                    cell.TransparentColor = ms.ReadB();
                    ms.Position++; // Skip unknown

                    // TODO Read RLE
                }
            }

            ms.Position = palOffset + 256 + 4;
            Palette     = ms.ReadBytes(256 * 4);
        }
Ejemplo n.º 7
0
 protected void AddShape(Shape shape)
 {
     shape.Id = Loops.Count;
     Loops.Add(shape);
 }