Exemplo n.º 1
0
        public Image[] makeBigBlocks(byte[] mapping, byte[] tiles, byte[] palette, int count, MapViewType curViewType = MapViewType.Tiles)
        {
            var result = new Image[count];

            ushort[] m    = Mapper.loadMapping(mapping);
            Color[]  cpal = getPalette(palette);
            for (ushort i = 0; i < count; i++)
            {
                if (!ConfigScript.isBlockSize4x4())
                {
                    var b = getBlock(m, tiles, cpal, i);
                    result[i] = UtilsGDI.ResizeBitmap(b, 32, 32);
                }
                else
                {
                    var b = getBlock4X4(m, tiles, cpal, i);
                    result[i] = UtilsGDI.ResizeBitmap(b, 32, 32);
                }
                if (curViewType == MapViewType.ObjNumbers)
                {
                    result[i] = VideoHelper.addObjNumber(result[i], i);
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        public Image[] makeBigBlocks(int videoNo, int bigBlockNo, BigBlock[] bigBlockIndexes, int palleteNo, MapViewType smallObjectsViewType = MapViewType.Tiles,
                                     MapViewType curViewType = MapViewType.Tiles, int hierarchyLevel = 0)
        {
            int blockCount = ConfigScript.getBigBlocksCount(hierarchyLevel);
            var bigBlocks  = new Image[blockCount];

            Image[] smallBlocksPack;
            if (hierarchyLevel == 0)
            {
                smallBlocksPack = makeObjects(videoNo, bigBlockNo, palleteNo, smallObjectsViewType);
            }
            else
            {
                var bigBlockIndexesPrev = ConfigScript.getBigBlocksRecursive(hierarchyLevel - 1, bigBlockNo);
                smallBlocksPack = makeBigBlocks(videoNo, bigBlockNo, bigBlockIndexesPrev, palleteNo, smallObjectsViewType, curViewType, hierarchyLevel - 1);
            }

            //tt version hardcode
            Image[][] smallBlocksAll = null;

            bool smallBlockHasSubpals = bigBlockIndexes == null ? true : bigBlockIndexes[0].smallBlocksWithPal();

            if (!smallBlockHasSubpals)
            {
                smallBlocksAll = new Image[4][];
                for (int i = 0; i < 4; i++)
                {
                    smallBlocksAll[i] = makeObjects(videoNo, bigBlockNo, palleteNo, smallObjectsViewType, i);
                }
            }
            else
            {
                smallBlocksAll = new Image[4][] { smallBlocksPack, smallBlocksPack, smallBlocksPack, smallBlocksPack };
            }

            for (int btileId = 0; btileId < blockCount; btileId++)
            {
                Image b;
                if (ConfigScript.isBuildScreenFromSmallBlocks())
                {
                    var sb = smallBlocksPack[btileId];
                    //scale for small blocks
                    b = UtilsGDI.ResizeBitmap(sb, (int)(sb.Width * 2), (int)(sb.Height * 2));
                }
                else
                {
                    b = bigBlockIndexes[btileId].makeBigBlock(smallBlocksAll);
                }
                if (curViewType == MapViewType.ObjNumbers)
                {
                    b = VideoHelper.addObjNumber(b, btileId);
                }
                bigBlocks[btileId] = b;
            }
            return(bigBlocks);
        }