Esempio n. 1
0
        private void reloadAllData()
        {
            mapData = MapConfig.loadMap(curActiveMapNo);
            setPal();
            int videoPageId = curActiveVideo;

            videos = new ImageList[4];
            var chunk = ConfigScript.getVideoChunk(videoPageId);

            for (int i = 0; i < 4; i++)
            {
                videos[i]           = new ImageList();
                videos[i].ImageSize = new Size(16, 16);
                var images = new Image[256];
                for (int t = 0; t < 256; t++)
                {
                    images[t] = UtilsGDI.ResizeBitmap(ConfigScript.videoNes.makeImage(t, chunk, curPal, i), 16, 16);
                }
                videos[i].Images.AddRange(images);
            }

            prepareBlocksPanel();
            mapScreen.Size = new Size(mapData.width * 16, mapData.height * 16);
            mapScreen.Invalidate();
        }
Esempio n. 2
0
        private void reloadAllData()
        {
            mapDatas = MapConfig.loadMap(curActiveMapNo);
            setPal();
            int videoPageId = curActiveVideo;

            videos = new Image[4][];
            var chunk = ConfigScript.getVideoChunk(videoPageId);

            for (int i = 0; i < 4; i++)
            {
                var images = new Image[256];
                for (int t = 0; t < 256; t++)
                {
                    images[t] = UtilsGDI.ResizeBitmap(ConfigScript.videoNes.makeImage(t, chunk, curPal, i), 16, 16);
                }
                videos[i] = images;
            }

            blocksScreen.Invalidate();

            mapScreen.Size = new Size(mapDatas[0].width * 16, mapDatas[0].height * 16);
            mapScreen.Invalidate();

            mapScreen2.Visible  = showSecondNametable;
            mapScreen2.Size     = mapScreen.Size;
            mapScreen2.Location = new Point(mapScreen.Location.X + mapScreen.Width, mapScreen2.Location.Y);
            mapScreen2.Invalidate();
        }
Esempio n. 3
0
        private void exportPictures(string filename)
        {
            //bigBlocksImages = ConfigScript.videoNes.makeBigBlocks(curVideo, curTileset, bigBlockIndexes, curPallete, curViewType, 1, 2.0f, MapViewType.Tiles, false, curHierarchyLevel);
            var result = UtilsGDI.GlueImages(bigBlocksImages, bigBlocksImages.Length, 1);

            result.Save(filename);
        }
Esempio n. 4
0
        protected void setVideo()
        {
            var chunk = ConfigScript.getVideoChunk(curActiveVideo);

            for (int i = 0; i < 4; i++)
            {
                videoSprites[i] = Enumerable.Range(0, 256).Select(t => ((Bitmap)UtilsGDI.ResizeBitmap(ConfigScript.videoNes.makeImage(t, chunk, palette, i), 16, 16))).ToArray();
            }
        }
Esempio n. 5
0
        private void EnemyEditor_Load(object sender, EventArgs e)
        {
            KeyPreview = true;

            if (ConfigScript.usePicturesInstedBlocks)
            {
                //TODO: set big blocks sizes from picture
                bigBlocks = UtilsGDI.setBlocksForPictures();
            }

            reloadPictures();
            fillObjPanel();

            UtilsGui.setCbItemsCount(cbVideoNo, ConfigScript.videoOffset.recCount);
            UtilsGui.setCbItemsCount(cbBigBlockNo, ConfigScript.bigBlocksOffsets[0].recCount);
            UtilsGui.setCbItemsCount(cbBlockNo, ConfigScript.blocksOffset.recCount);
            UtilsGui.setCbItemsCount(cbPaletteNo, ConfigScript.palOffset.recCount);
            UtilsGui.setCbItemsCount(cbScale, 2, 1);
            UtilsGui.setCbIndexWithoutUpdateLevel(cbVideoNo, cbLevel_SelectedIndexChanged, formMain.curActiveVideoNo);
            UtilsGui.setCbIndexWithoutUpdateLevel(cbBlockNo, cbLevel_SelectedIndexChanged, formMain.curActiveBlockNo);
            UtilsGui.setCbIndexWithoutUpdateLevel(cbBigBlockNo, cbLevel_SelectedIndexChanged, formMain.curActiveBigBlockNo);
            UtilsGui.setCbIndexWithoutUpdateLevel(cbPaletteNo, cbLevel_SelectedIndexChanged, formMain.curActivePalleteNo);
            UtilsGui.setCbIndexWithoutUpdateLevel(cbTool, cbTool_SelectedIndexChanged);
            UtilsGui.setCbIndexWithoutUpdateLevel(cbScale, cbLevel_SelectedIndexChanged, 1);
            cbLayoutNo.Items.Clear();
            foreach (var lr in ConfigScript.getLevelRecs())
            {
                cbLayoutNo.Items.Add(String.Format("{0}:0x{1:X} ({2}x{3})", lr.name, lr.layoutAddr, lr.width, lr.height));
            }
            UtilsGui.setCbIndexWithoutUpdateLevel(cbLayoutNo, cbLevel_SelectedIndexChanged);

            bttSave.Enabled = ConfigScript.setObjectsFunc != null;

            btSort.Visible = ConfigScript.sortObjectsFunc != null;

            UtilsGui.setCbItemsCount(cbBigObjectNo, 256, 0, true);
            cbLevel_SelectedIndexChanged(cbLayoutNo, new EventArgs());

            resizeMapScreen();

            cbGroup.Items.Clear();
            foreach (var g in ConfigScript.getGroups())
            {
                cbGroup.Items.Add(g.name);
            }
        }
Esempio n. 6
0
        private void setBlocks(bool needRebuildBlocks)
        {
            //if using pictures
            if (ConfigScript.usePicturesInstedBlocks)
            {
                if (needRebuildBlocks)
                {
                    //get block size from image
                    layers[0].blockWidth  = ConfigScript.getBlocksPicturesWidth();
                    layers[0].blockHeight = 32;
                    layers[1].blockWidth  = ConfigScript.getBlocksPicturesWidth();
                    layers[1].blockHeight = 32;
                    bigBlocks             = UtilsGDI.setBlocksForPictures(curButtonScale, layers[0].blockWidth, layers[0].blockHeight, curViewType);
                }
                updateBlocksImages();
                return;
            }

            MapViewType smallObjectsType =
                curViewType == MapViewType.SmallObjNumbers ? MapViewType.ObjNumbers :
                curViewType == MapViewType.ObjType ? MapViewType.ObjType : MapViewType.Tiles;

            float smallBlockScaleFactor = curButtonScale;
            int   bigTileIndex          = curActiveBlockNo;

            if (needRebuildBlocks)
            {
                if (ConfigScript.isUseSegaGraphics())
                {
                    bigBlocks = makeSegaBigBlocks();
                }
                else
                {
                    bigBlocks = ConfigScript.videoNes.makeBigBlocks(curActiveVideoNo, curActiveBigBlockNo, bigTileIndex, curActivePalleteNo, smallObjectsType, curViewType, ConfigScript.getbigBlocksHierarchyCount() - 1);
                }
                changeBlocksSize(bigBlocks);
            }
            curActiveBlock = 0;
            updateBlocksImages();
        }
Esempio n. 7
0
        private void setBlocks(bool needRebuildBlocks)
        {
            //if using pictures
            if (ConfigScript.usePicturesInstedBlocks)
            {
                if (needRebuildBlocks)
                {
                    //get block size from image
                    int w = ConfigScript.getBlocksPicturesWidth();
                    int h = 32;
                    bigBlocks = UtilsGDI.setBlocksForPictures(curScale, w, h, curActiveViewType);
                }
            }
            else
            {
                MapViewType smallObjectsType =
                    curActiveViewType == MapViewType.SmallObjNumbers ? MapViewType.ObjNumbers :
                    curActiveViewType == MapViewType.ObjType ? MapViewType.ObjType : MapViewType.Tiles;

                if (needRebuildBlocks)
                {
                    if (ConfigScript.isUseSegaGraphics())
                    {
                        bigBlocks = Globals.makeSegaBigBlocks(curActiveVideoNo, curActiveBigBlockNo, curActivePalleteNo, curActiveViewType);
                    }
                    else if (ConfigScript.isUseGbGraphics())
                    {
                        bigBlocks = Globals.makeGbBigBlocks(curActiveVideoNo, curActiveBigBlockNo, curActivePalleteNo, curActiveViewType);
                    }
                    else
                    {
                        bigBlocks = ConfigScript.videoNes.makeBigBlocks(curActiveVideoNo, curActiveBigBlockNo, curActiveBlockNo, curActivePalleteNo, smallObjectsType, curActiveViewType, ConfigScript.getbigBlocksHierarchyCount() - 1);
                    }
                }
            }

            curActiveBlock = 0;
            updateBlocksImages();
        }