Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public static byte[] readLinearBigBlockData(int hierLevel, int bigTileIndex, int tileSize)
        {
            //if tileSize == -1, try read it from config
            if (tileSize == -1)
            {
                tileSize = ConfigScript.isBlockSize4x4() ? 16 : 4;
            }

            int wordSize = ConfigScript.isUseSegaGraphics() ? 2 : 1;
            int size     = ConfigScript.getBigBlocksCount(hierLevel) * tileSize * wordSize;

            byte[] bigBlockIndexes = new byte[size];
            var    bigBlocksAddr   = ConfigScript.getBigTilesAddr(hierLevel, bigTileIndex);

            for (int i = 0; i < size; i++)
            {
                bigBlockIndexes[i] = Globals.romdata[bigBlocksAddr + i];
            }
            return(bigBlockIndexes);
        }