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); } }
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(); }
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(); }