mirror of
https://github.com/kwsch/NHSE.git
synced 2026-09-27 12:26:35 -05:00
stash
rewritten core side to include tons more metadata/structure need to rewrite renderer to output full map image rather than skipping sea
This commit is contained in:
@@ -88,7 +88,7 @@ private void B_Apply_Click(object sender, EventArgs e)
|
||||
if (sizeY % 2 == 1)
|
||||
sizeY++;
|
||||
|
||||
var ctr = SpawnItems(Editor.SpawnLayer, items, x, y, arrange, sizeX, sizeY, true);
|
||||
var ctr = SpawnItems(Editor.Spawn, items, x, y, arrange, sizeX, sizeY, true);
|
||||
if (ctr == 0)
|
||||
{
|
||||
WinFormsUtil.Alert(MessageStrings.MsgFieldItemModifyNone);
|
||||
@@ -98,7 +98,7 @@ private void B_Apply_Click(object sender, EventArgs e)
|
||||
WinFormsUtil.Alert(string.Format(MessageStrings.MsgFieldItemModifyCount, count));
|
||||
}
|
||||
|
||||
private static int SpawnItems(ItemLayer layer, IReadOnlyList<Item> items, int x, int y, SpawnArrangement arrange, int sizeX, int sizeY, bool noOverwrite)
|
||||
private static int SpawnItems(LayerItem layer, IReadOnlyList<Item> items, int x, int y, SpawnArrangement arrange, int sizeX, int sizeY, bool noOverwrite)
|
||||
{
|
||||
// every {setting} tiles, we jump down to the next available row of tiles.
|
||||
int x0 = x;
|
||||
|
||||
@@ -14,9 +14,11 @@ namespace NHSE.WinForms;
|
||||
public sealed partial class FieldItemEditor : Form, IItemLayerEditor
|
||||
{
|
||||
private readonly MainSave SAV;
|
||||
private readonly MapEditor Editor;
|
||||
|
||||
private MapViewState View => Editor.Mutator.View;
|
||||
private MapTileManager Map => Editor.Mutator.Manager;
|
||||
|
||||
private readonly MapManager Map;
|
||||
private readonly MapViewer View;
|
||||
private readonly bool IsExtendedMap30;
|
||||
|
||||
private bool Loading;
|
||||
@@ -29,7 +31,13 @@ public sealed partial class FieldItemEditor : Form, IItemLayerEditor
|
||||
private bool Dragging;
|
||||
|
||||
public ItemEditor ItemProvider => ItemEdit;
|
||||
public ItemLayer SpawnLayer => Map.CurrentLayer;
|
||||
|
||||
/// <summary>
|
||||
/// Layer to spawn items into.
|
||||
/// </summary>
|
||||
public LayerItem Spawn => CurrentLayer;
|
||||
|
||||
public LayerFieldItem CurrentLayer => Editor.Mutator.CurrentLayer;
|
||||
|
||||
private TerrainBrushEditor? tbeForm;
|
||||
|
||||
@@ -38,11 +46,14 @@ public FieldItemEditor(MainSave sav)
|
||||
InitializeComponent();
|
||||
this.TranslateInterface(GameInfo.CurrentLanguage);
|
||||
|
||||
var scale = (PB_Acre.Width - 2) / FieldItemLayer.TilesPerAcreDim; // 1px border
|
||||
// Read the expected scale from the control.
|
||||
var scale = (PB_Acre.Width - 2) / LayerFieldItem.TilesPerAcreDim; // 1px border
|
||||
SAV = sav;
|
||||
IsExtendedMap30 = sav.FieldItemAcreWidth != 7;
|
||||
Map = new MapManager(sav);
|
||||
View = new MapViewer(Map, scale);
|
||||
Editor = MapEditor.FromSaveFile(sav);
|
||||
Editor.MapScale = scale;
|
||||
Editor.AcreScale = scale;
|
||||
Renderer = new MapRenderer(Editor);
|
||||
|
||||
Loading = true;
|
||||
|
||||
@@ -80,7 +91,7 @@ private void LoadBuildings(MainSave sav)
|
||||
NUD_PlazaX.Value = sav.EventPlazaLeftUpX;
|
||||
NUD_PlazaY.Value = sav.EventPlazaLeftUpZ;
|
||||
|
||||
foreach (var obj in Map.Buildings)
|
||||
foreach (var obj in Editor.Mutator.Manager.LayerBuildings.Buildings)
|
||||
LB_Items.Items.Add(obj.ToString());
|
||||
}
|
||||
|
||||
@@ -193,7 +204,7 @@ private void ResetDrag()
|
||||
|
||||
private void OmniTile(MouseEventArgs e)
|
||||
{
|
||||
var tile = GetTile(Map.CurrentLayer, e, out var x, out var y);
|
||||
var tile = GetTile(CurrentLayer, e, out var x, out var y);
|
||||
OmniTile(tile, x, y);
|
||||
}
|
||||
|
||||
@@ -202,7 +213,7 @@ private void OmniTileTerrain(MouseEventArgs e)
|
||||
SetHoveredItem(e);
|
||||
var x = View.X + HoverX;
|
||||
var y = View.Y + HoverY;
|
||||
var tile = Map.Terrain.GetTile(x / 2, y / 2);
|
||||
TerrainTile tile = Editor.Terrain.GetTile(x / 2, y / 2);
|
||||
if (tbeForm?.IsBrushSelected != true)
|
||||
{
|
||||
OmniTileTerrain(tile);
|
||||
@@ -223,7 +234,7 @@ private void OmniTileTerrain(MouseEventArgs e)
|
||||
for (int j = -radius; j < radius; j++)
|
||||
{
|
||||
if ((i * i) + (j * j) < threshold)
|
||||
selectedTiles.Add(Map.Terrain.GetTile((x / 2) + i, (y / 2) + j));
|
||||
selectedTiles.Add(Editor.Terrain.GetTile((x / 2) + i, (y / 2) + j));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,10 +286,10 @@ private void OmniTileTerrain(TerrainTile tile)
|
||||
}
|
||||
}
|
||||
|
||||
private Item GetTile(FieldItemLayer layer, MouseEventArgs e, out int x, out int y)
|
||||
private Item GetTile(LayerFieldItem layerField, MouseEventArgs e, out int x, out int y)
|
||||
{
|
||||
SetHoveredItem(e);
|
||||
return layer.GetTile(x = View.X + HoverX, y = View.Y + HoverY);
|
||||
return layerField.GetTile(x = View.X + HoverX, y = View.Y + HoverY);
|
||||
}
|
||||
|
||||
private void SetHoveredItem(MouseEventArgs e)
|
||||
@@ -292,15 +303,15 @@ private void SetHoveredItem(MouseEventArgs e)
|
||||
|
||||
private void GetAcreCoordinates(MouseEventArgs e, out int x, out int y)
|
||||
{
|
||||
x = e.X / View.AcreScale;
|
||||
y = e.Y / View.AcreScale;
|
||||
x = e.X / Editor.AcreScale;
|
||||
y = e.Y / Editor.AcreScale;
|
||||
}
|
||||
|
||||
private void PB_Acre_MouseDown(object sender, MouseEventArgs e) => ResetDrag();
|
||||
|
||||
private void PB_Acre_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
var l = Map.CurrentLayer;
|
||||
var l = CurrentLayer;
|
||||
if (e.Button == MouseButtons.Left && CHK_MoveOnDrag.Checked)
|
||||
{
|
||||
MoveDrag(e);
|
||||
@@ -317,8 +328,9 @@ private void PB_Acre_MouseMove(object sender, MouseEventArgs e)
|
||||
return;
|
||||
var str = GameInfo.Strings;
|
||||
var name = str.GetItemName(tile);
|
||||
bool active = Map.Items.GetIsActive(NUD_Layer.Value == 0, x, y);
|
||||
if (active)
|
||||
var flagLayer = NUD_Layer.Value == 0 ? Map.LayerItemFlag0 : Map.LayerItemFlag1;
|
||||
var isActive = flagLayer.GetIsActive(x, y);
|
||||
if (isActive)
|
||||
name = $"{name} [Active]";
|
||||
TT_Hover.SetToolTip(PB_Acre, name);
|
||||
SetCoordinateText(x, y);
|
||||
@@ -367,7 +379,7 @@ private void ViewTile(Item tile, int x, int y)
|
||||
{
|
||||
if (CHK_RedirectExtensionLoad.Checked && tile.IsExtension)
|
||||
{
|
||||
var l = Map.CurrentLayer;
|
||||
var l = CurrentLayer;
|
||||
var rx = Math.Max(0, Math.Min(l.TileInfo.TotalWidth - 1, x - tile.ExtensionX));
|
||||
var ry = Math.Max(0, Math.Min(l.TileInfo.TotalHeight - 1, y - tile.ExtensionY));
|
||||
var redir = l.GetTile(rx, ry);
|
||||
@@ -394,7 +406,7 @@ private void ViewTile(TerrainTile tile)
|
||||
|
||||
private void SetTile(Item tile, int x, int y)
|
||||
{
|
||||
var l = Map.CurrentLayer;
|
||||
var l = CurrentLayer;
|
||||
var pgt = new Item();
|
||||
ItemEdit.SetItem(pgt);
|
||||
|
||||
@@ -429,7 +441,7 @@ private void SetTile(Item tile, int x, int y)
|
||||
|
||||
private void ReplaceTile(Item tile, int x, int y)
|
||||
{
|
||||
var l = Map.CurrentLayer;
|
||||
var l = CurrentLayer;
|
||||
var pgt = new Item();
|
||||
ItemEdit.SetItem(pgt);
|
||||
|
||||
@@ -451,7 +463,7 @@ private void ReplaceTile(Item tile, int x, int y)
|
||||
|
||||
bool wholeMap = (ModifierKeys & Keys.Shift) != 0;
|
||||
var copy = new Item(tile.RawValue);
|
||||
var count = View.ReplaceFieldItems(copy, pgt, wholeMap);
|
||||
var count = Editor.Mutator.ReplaceFieldItems(copy, pgt, wholeMap);
|
||||
if (count == 0)
|
||||
{
|
||||
WinFormsUtil.Alert(MessageStrings.MsgFieldItemModifyNone);
|
||||
@@ -507,13 +519,14 @@ private void DeleteTile(Item tile, int x, int y)
|
||||
{
|
||||
if (CHK_AutoExtension.Checked)
|
||||
{
|
||||
var layer = CurrentLayer;
|
||||
if (!tile.IsRoot)
|
||||
{
|
||||
x -= tile.ExtensionX;
|
||||
y -= tile.ExtensionY;
|
||||
tile = Map.CurrentLayer.GetTile(x, y);
|
||||
tile = layer.GetTile(x, y);
|
||||
}
|
||||
Map.CurrentLayer.DeleteExtensionTiles(tile, x, y);
|
||||
layer.DeleteExtensionTiles(tile, x, y);
|
||||
}
|
||||
|
||||
tile.Delete();
|
||||
@@ -530,8 +543,8 @@ private void DeleteTile(TerrainTile tile)
|
||||
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
var view = View.Map.Items.Layer1.TileInfo;
|
||||
var unsupported = Map.Items.GetUnsupportedTiles(view.TotalWidth, view.TotalHeight);
|
||||
var set = Map.FieldItems;
|
||||
var unsupported = set.GetUnsupportedTiles();
|
||||
if (unsupported.Count != 0)
|
||||
{
|
||||
var err = MessageStrings.MsgFieldItemUnsupportedLayer2Tile;
|
||||
@@ -541,16 +554,9 @@ private void B_Save_Click(object sender, EventArgs e)
|
||||
return;
|
||||
}
|
||||
|
||||
Map.Items.Save();
|
||||
SAV.SetTerrainTiles(Map.Terrain.Tiles);
|
||||
|
||||
SAV.SetAcreBytes(Map.Terrain.BaseAcres.Span);
|
||||
Map.SetManager(SAV);
|
||||
SAV.OutsideFieldTemplateUniqueId = (ushort)NUD_MapAcreTemplateOutside.Value;
|
||||
SAV.MainFieldParamUniqueID = (ushort)NUD_MapAcreTemplateField.Value;
|
||||
|
||||
SAV.Buildings = Map.Buildings;
|
||||
SAV.EventPlazaLeftUpX = Map.PlazaX;
|
||||
SAV.EventPlazaLeftUpZ = Map.PlazaY;
|
||||
Close();
|
||||
}
|
||||
|
||||
@@ -561,12 +567,12 @@ private void Menu_View_Click(object sender, EventArgs e)
|
||||
|
||||
if (RB_Item.Checked)
|
||||
{
|
||||
var tile = Map.CurrentLayer.GetTile(x, y);
|
||||
var tile = CurrentLayer.GetTile(x, y);
|
||||
ViewTile(tile, x, y);
|
||||
}
|
||||
else if (RB_Terrain.Checked)
|
||||
{
|
||||
var tile = Map.Terrain.GetTile(x / 2, y / 2);
|
||||
TerrainTile tile = Editor.Terrain.GetTile(x / 2, y / 2);
|
||||
ViewTile(tile);
|
||||
}
|
||||
}
|
||||
@@ -578,12 +584,12 @@ private void Menu_Set_Click(object sender, EventArgs e)
|
||||
|
||||
if (RB_Item.Checked)
|
||||
{
|
||||
var tile = Map.CurrentLayer.GetTile(x, y);
|
||||
var tile = CurrentLayer.GetTile(x, y);
|
||||
SetTile(tile, x, y);
|
||||
}
|
||||
else if (RB_Terrain.Checked)
|
||||
{
|
||||
var tile = Map.Terrain.GetTile(x / 2, y / 2);
|
||||
var tile = Editor.Terrain.GetTile(x / 2, y / 2);
|
||||
SetTile(tile);
|
||||
}
|
||||
}
|
||||
@@ -595,12 +601,12 @@ private void Menu_Reset_Click(object sender, EventArgs e)
|
||||
|
||||
if (RB_Item.Checked)
|
||||
{
|
||||
var tile = Map.CurrentLayer.GetTile(x, y);
|
||||
var tile = CurrentLayer.GetTile(x, y);
|
||||
DeleteTile(tile, x, y);
|
||||
}
|
||||
else if (RB_Terrain.Checked)
|
||||
{
|
||||
var tile = Map.Terrain.GetTile(x / 2, y / 2);
|
||||
var tile = Editor.Terrain.GetTile(x / 2, y / 2);
|
||||
DeleteTile(tile);
|
||||
}
|
||||
}
|
||||
@@ -617,10 +623,11 @@ private void CM_Click_Opening(object sender, System.ComponentModel.CancelEventAr
|
||||
return;
|
||||
}
|
||||
|
||||
var isBase = NUD_Layer.Value == 0;
|
||||
var x = View.X + HoverX;
|
||||
var y = View.Y + HoverY;
|
||||
Menu_Activate.Text = Map.Items.GetIsActive(isBase, x, y) ? "Inactivate" : "Activate";
|
||||
var flagLayer = NUD_Layer.Value == 0 ? Map.LayerItemFlag0 : Map.LayerItemFlag1;
|
||||
var isActive = flagLayer.GetIsActive(x, y);
|
||||
Menu_Activate.Text = isActive ? "Inactivate" : "Activate";
|
||||
CM_Click.Items.Add(Menu_Activate);
|
||||
hasActivate = true;
|
||||
}
|
||||
@@ -629,14 +636,15 @@ private void Menu_Activate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var x = View.X + HoverX;
|
||||
var y = View.Y + HoverY;
|
||||
var isBase = NUD_Layer.Value == 0;
|
||||
Map.Items.SetIsActive(isBase, x, y, !Map.Items.GetIsActive(isBase, x, y));
|
||||
var flagLayer = NUD_Layer.Value == 0 ? Map.LayerItemFlag0 : Map.LayerItemFlag1;
|
||||
var isActive = flagLayer.GetIsActive(x, y);
|
||||
flagLayer.SetIsActive(x, y, !isActive);
|
||||
}
|
||||
|
||||
private void B_Up_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys == Keys.Shift)
|
||||
CB_Acre.SelectedIndex = Math.Max(0, CB_Acre.SelectedIndex - View.Map.Items.Layer1.TileInfo.Columns);
|
||||
CB_Acre.SelectedIndex = Math.Max(0, CB_Acre.SelectedIndex - Editor.Items.Layer0.TileInfo.Columns);
|
||||
else if (View.ArrowUp())
|
||||
LoadItemGridAcre();
|
||||
}
|
||||
@@ -660,18 +668,18 @@ private void B_Right_Click(object sender, EventArgs e)
|
||||
private void B_Down_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys == Keys.Shift)
|
||||
CB_Acre.SelectedIndex = Math.Min(CB_Acre.SelectedIndex + View.Map.Items.Layer1.TileInfo.Columns, CB_Acre.Items.Count - 1);
|
||||
CB_Acre.SelectedIndex = Math.Min(CB_Acre.SelectedIndex + Editor.Items.Layer0.TileInfo.Columns, CB_Acre.Items.Count - 1);
|
||||
else if (View.ArrowDown())
|
||||
LoadItemGridAcre();
|
||||
}
|
||||
|
||||
private void B_DumpAcre_Click(object sender, EventArgs e) => MapDumpHelper.DumpLayerAcreSingle(Map.CurrentLayer, AcreIndex, CB_Acre.Text, (int)NUD_Layer.Value);
|
||||
private void B_DumpAcre_Click(object sender, EventArgs e) => MapDumpHelper.DumpLayerAcreSingle(CurrentLayer, AcreIndex, CB_Acre.Text, (int)NUD_Layer.Value);
|
||||
|
||||
private void B_DumpAllAcres_Click(object sender, EventArgs e) => MapDumpHelper.DumpLayerAcreAll(Map.CurrentLayer);
|
||||
private void B_DumpAllAcres_Click(object sender, EventArgs e) => MapDumpHelper.DumpLayerAcreAll(CurrentLayer);
|
||||
|
||||
private void B_ImportAcre_Click(object sender, EventArgs e)
|
||||
{
|
||||
var layer = Map.CurrentLayer;
|
||||
var layer = CurrentLayer;
|
||||
if (!MapDumpHelper.ImportToLayerAcreSingle(layer, AcreIndex, CB_Acre.Text, (int)NUD_Layer.Value))
|
||||
return;
|
||||
ChangeViewToAcre(AcreIndex);
|
||||
@@ -680,33 +688,33 @@ private void B_ImportAcre_Click(object sender, EventArgs e)
|
||||
|
||||
private void B_ImportAllAcres_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MapDumpHelper.ImportToLayerAcreAll(Map.CurrentLayer))
|
||||
if (!MapDumpHelper.ImportToLayerAcreAll(CurrentLayer))
|
||||
return;
|
||||
ChangeViewToAcre(AcreIndex);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private void B_DumpBuildings_Click(object sender, EventArgs e) => MapDumpHelper.DumpBuildings(Map.Buildings);
|
||||
private void B_DumpBuildings_Click(object sender, EventArgs e) => MapDumpHelper.DumpBuildings(Editor.Buildings.Buildings);
|
||||
|
||||
private void B_ImportBuildings_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MapDumpHelper.ImportBuildings(Map.Buildings))
|
||||
if (!MapDumpHelper.ImportBuildings(Editor.Buildings.Buildings))
|
||||
return;
|
||||
|
||||
for (int i = 0; i < Map.Buildings.Count; i++)
|
||||
LB_Items.Items[i] = Map.Buildings[i].ToString();
|
||||
for (int i = 0; i < Editor.Buildings.Count; i++)
|
||||
LB_Items.Items[i] = Editor.Buildings[i].ToString();
|
||||
LB_Items.SelectedIndex = 0;
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
ReloadBuildingsTerrain();
|
||||
}
|
||||
|
||||
private void B_DumpTerrainAcre_Click(object sender, EventArgs e) => MapDumpHelper.DumpTerrainAcre(Map.Terrain, AcreIndex, CB_Acre.Text);
|
||||
private void B_DumpTerrainAcre_Click(object sender, EventArgs e) => MapDumpHelper.DumpTerrainAcre(Editor.Terrain, AcreIndex, CB_Acre.Text);
|
||||
|
||||
private void B_DumpTerrainAll_Click(object sender, EventArgs e) => MapDumpHelper.DumpTerrainAll(Map.Terrain);
|
||||
private void B_DumpTerrainAll_Click(object sender, EventArgs e) => MapDumpHelper.DumpTerrainAll(Editor.Terrain);
|
||||
|
||||
private void B_ImportTerrainAcre_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MapDumpHelper.ImportTerrainAcre(Map.Terrain, AcreIndex, CB_Acre.Text))
|
||||
if (!MapDumpHelper.ImportTerrainAcre(Editor.Terrain, AcreIndex, CB_Acre.Text))
|
||||
return;
|
||||
ChangeViewToAcre(AcreIndex);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
@@ -714,7 +722,7 @@ private void B_ImportTerrainAcre_Click(object sender, EventArgs e)
|
||||
|
||||
private void B_ImportTerrainAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MapDumpHelper.ImportTerrainAll(Map.Terrain))
|
||||
if (!MapDumpHelper.ImportTerrainAll(Editor.Terrain))
|
||||
return;
|
||||
ChangeViewToAcre(AcreIndex);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
@@ -769,7 +777,7 @@ private void PB_Map_MouseDown(object sender, MouseEventArgs e)
|
||||
|
||||
private void ClickMapAt(MouseEventArgs e, bool skipLagCheck)
|
||||
{
|
||||
var layer = Map.Items.Layer1;
|
||||
var layer = Editor.Items.Layer0;
|
||||
int mX = e.X;
|
||||
int mY = e.Y;
|
||||
bool centerReticle = CHK_SnapToAcre.Checked;
|
||||
@@ -824,7 +832,7 @@ private void PB_Map_MouseMove(object sender, MouseEventArgs e)
|
||||
|
||||
private void NUD_Layer_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
Map.MapLayer = (int)NUD_Layer.Value - 1;
|
||||
View.ItemLayerIndex = (int)NUD_Layer.Value - 1;
|
||||
LoadItemGridAcre();
|
||||
}
|
||||
|
||||
@@ -837,7 +845,7 @@ private void Remove(ToolStripItem sender, Func<int, int, int, int, int> removal)
|
||||
if (question != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
int count = View.ModifyFieldItems(removal, wholeMap);
|
||||
int count = Editor.Mutator.ModifyFieldItems(removal, wholeMap);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
@@ -857,7 +865,7 @@ private void Modify(ToolStripItem sender, Func<int, int, int, int, int> action)
|
||||
if (question != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
int count = View.ModifyFieldItems(action, wholeMap);
|
||||
int count = Editor.Mutator.ModifyFieldItems(action, wholeMap);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
@@ -868,54 +876,46 @@ private void Modify(ToolStripItem sender, Func<int, int, int, int, int> action)
|
||||
WinFormsUtil.Alert(string.Format(MessageStrings.MsgFieldItemModifyCount, count));
|
||||
}
|
||||
|
||||
private void B_RemoveEditor_Click(object sender, EventArgs e) => Remove(B_RemoveEditor, (min, max, x, y)
|
||||
=> Map.CurrentLayer.RemoveAllLike(min, max, x, y, ItemEdit.SetItem(new Item())));
|
||||
private void B_RemoveEditor_Click(object sender, EventArgs e)
|
||||
{
|
||||
var item = ItemEdit.LoadFieldsToNewItem();
|
||||
var lambda = new Func<int, int, int, int, int>((min, max, x, y)
|
||||
=> CurrentLayer.RemoveAllLike(min, max, x, y, item));
|
||||
Remove(B_RemoveEditor, lambda);
|
||||
}
|
||||
|
||||
private void B_RemoveAllWeeds_Click(object sender, EventArgs e) => Remove(B_RemoveAllWeeds, Map.CurrentLayer.RemoveAllWeeds);
|
||||
private void B_WaterFlowers_Click(object sender, EventArgs e)
|
||||
{
|
||||
var all = (ModifierKeys & Keys.Control) != 0;
|
||||
var lambda = new Func<int, int, int, int, int>((xmin, ymin, width, height)
|
||||
=> CurrentLayer.WaterAllFlowers(xmin, ymin, width, height, all));
|
||||
Modify(B_WaterFlowers, lambda);
|
||||
}
|
||||
|
||||
private void B_RemoveAllTrees_Click(object sender, EventArgs e) => Remove(B_RemoveAllTrees, Map.CurrentLayer.RemoveAllTrees);
|
||||
|
||||
private void B_FillHoles_Click(object sender, EventArgs e) => Remove(B_FillHoles, Map.CurrentLayer.RemoveAllHoles);
|
||||
|
||||
private void B_RemovePlants_Click(object sender, EventArgs e) => Remove(B_RemovePlants, Map.CurrentLayer.RemoveAllPlants);
|
||||
|
||||
private void B_RemoveFences_Click(object sender, EventArgs e) => Remove(B_RemoveFences, Map.CurrentLayer.RemoveAllFences);
|
||||
|
||||
private void B_RemoveObjects_Click(object sender, EventArgs e) => Remove(B_RemoveObjects, Map.CurrentLayer.RemoveAllObjects);
|
||||
|
||||
private void B_RemoveAll_Click(object sender, EventArgs e) => Remove(B_RemoveAll, Map.CurrentLayer.RemoveAll);
|
||||
|
||||
private void B_RemovePlacedItems_Click(object sender, EventArgs e) => Remove(B_RemovePlacedItems, Map.CurrentLayer.RemoveAllPlacedItems);
|
||||
|
||||
private void B_RemoveShells_Click(object sender, EventArgs e) => Remove(B_RemoveShells, Map.CurrentLayer.RemoveAllShells);
|
||||
|
||||
private void B_RemoveBranches_Click(object sender, EventArgs e) => Remove(B_RemoveBranches, Map.CurrentLayer.RemoveAllBranches);
|
||||
|
||||
private void B_RemoveFlowers_Click(object sender, EventArgs e) => Remove(B_RemoveFlowers, Map.CurrentLayer.RemoveAllFlowers);
|
||||
|
||||
private void B_RemoveBushes_Click(object sender, EventArgs e) => Remove(B_RemoveBushes, Map.CurrentLayer.RemoveAllBushes);
|
||||
|
||||
private void B_WaterFlowers_Click(object sender, EventArgs e) => Modify(B_WaterFlowers, (xmin, ymin, width, height)
|
||||
=> Map.CurrentLayer.WaterAllFlowers(xmin, ymin, width, height, (ModifierKeys & Keys.Control) != 0));
|
||||
private void B_RemoveAllWeeds_Click(object sender, EventArgs e) => Remove(B_RemoveAllWeeds, CurrentLayer.RemoveAllWeeds);
|
||||
private void B_RemoveAllTrees_Click(object sender, EventArgs e) => Remove(B_RemoveAllTrees, CurrentLayer.RemoveAllTrees);
|
||||
private void B_FillHoles_Click(object sender, EventArgs e) => Remove(B_FillHoles, CurrentLayer.RemoveAllHoles);
|
||||
private void B_RemovePlants_Click(object sender, EventArgs e) => Remove(B_RemovePlants, CurrentLayer.RemoveAllPlants);
|
||||
private void B_RemoveFences_Click(object sender, EventArgs e) => Remove(B_RemoveFences, CurrentLayer.RemoveAllFences);
|
||||
private void B_RemoveObjects_Click(object sender, EventArgs e) => Remove(B_RemoveObjects, CurrentLayer.RemoveAllObjects);
|
||||
private void B_RemoveAll_Click(object sender, EventArgs e) => Remove(B_RemoveAll, CurrentLayer.RemoveAll);
|
||||
private void B_RemovePlacedItems_Click(object sender, EventArgs e) => Remove(B_RemovePlacedItems, CurrentLayer.RemoveAllPlacedItems);
|
||||
private void B_RemoveShells_Click(object sender, EventArgs e) => Remove(B_RemoveShells, CurrentLayer.RemoveAllShells);
|
||||
private void B_RemoveBranches_Click(object sender, EventArgs e) => Remove(B_RemoveBranches, CurrentLayer.RemoveAllBranches);
|
||||
private void B_RemoveFlowers_Click(object sender, EventArgs e) => Remove(B_RemoveFlowers, CurrentLayer.RemoveAllFlowers);
|
||||
private void B_RemoveBushes_Click(object sender, EventArgs e) => Remove(B_RemoveBushes, CurrentLayer.RemoveAllBushes);
|
||||
|
||||
private static void ShowContextMenuBelow(ToolStripDropDown c, Control n) => c.Show(n.PointToScreen(new Point(0, n.Height)));
|
||||
|
||||
private void B_RemoveItemDropDown_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_Remove, B_RemoveItemDropDown);
|
||||
|
||||
private void B_DumpLoadField_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_DLField, B_DumpLoadField);
|
||||
|
||||
private void B_DumpLoadTerrain_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_DLTerrain, B_DumpLoadTerrain);
|
||||
|
||||
private void B_DumpLoadBuildings_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_DLBuilding, B_DumpLoadBuildings);
|
||||
|
||||
private void B_ModifyAllTerrain_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_Terrain, B_ModifyAllTerrain);
|
||||
|
||||
private void B_DumpLoadAcres_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_DLMapAcres, B_DumpLoadAcres);
|
||||
|
||||
private void TR_Transparency_Scroll(object sender, EventArgs e) => ReloadItems();
|
||||
|
||||
private void TR_BuildingTransparency_Scroll(object sender, EventArgs e) => ReloadBuildingsTerrain();
|
||||
|
||||
private void TR_Terrain_Scroll(object sender, EventArgs e) => ReloadBuildingsTerrain();
|
||||
|
||||
#region Buildings
|
||||
@@ -930,7 +930,7 @@ private void NUD_PlazaX_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Loading)
|
||||
return;
|
||||
Map.PlazaX = (uint)NUD_PlazaX.Value;
|
||||
Map.Plaza.X = (uint)NUD_PlazaX.Value;
|
||||
ReloadBuildingsTerrain();
|
||||
}
|
||||
|
||||
@@ -938,7 +938,7 @@ private void NUD_PlazaY_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Loading)
|
||||
return;
|
||||
Map.PlazaY = (uint)NUD_PlazaY.Value;
|
||||
Map.Plaza.Z = (uint)NUD_PlazaY.Value;
|
||||
ReloadBuildingsTerrain();
|
||||
}
|
||||
|
||||
@@ -957,7 +957,7 @@ private void LoadIndex(int index)
|
||||
{
|
||||
Loading = true;
|
||||
SelectedBuildingIndex = index;
|
||||
var b = Map.Buildings[index];
|
||||
var b = Editor.Buildings[index];
|
||||
NUD_BuildingType.Value = (int)b.BuildingType;
|
||||
NUD_X.Value = b.X;
|
||||
NUD_Y.Value = b.Y;
|
||||
@@ -981,7 +981,7 @@ private void NUD_BuildingType_ValueChanged(object sender, EventArgs e)
|
||||
if (Loading || sender is not NumericUpDown n)
|
||||
return;
|
||||
|
||||
var b = Map.Buildings[SelectedBuildingIndex];
|
||||
var b = Editor.Buildings[SelectedBuildingIndex];
|
||||
if (sender == NUD_BuildingType)
|
||||
b.BuildingType = (BuildingType)n.Value;
|
||||
else if (sender == NUD_X)
|
||||
@@ -999,7 +999,7 @@ private void NUD_BuildingType_ValueChanged(object sender, EventArgs e)
|
||||
else if (sender == NUD_UniqueID)
|
||||
b.UniqueID = (ushort)n.Value;
|
||||
|
||||
LB_Items.Items[SelectedBuildingIndex] = Map.Buildings[SelectedBuildingIndex].ToString();
|
||||
LB_Items.Items[SelectedBuildingIndex] = Editor.Buildings[SelectedBuildingIndex].ToString();
|
||||
ReloadBuildingsTerrain();
|
||||
}
|
||||
|
||||
@@ -1009,7 +1009,7 @@ private void NUD_BuildingType_ValueChanged(object sender, EventArgs e)
|
||||
|
||||
private void CB_MapAcre_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var acre = Map.Terrain.BaseAcres.Span[CB_MapAcre.SelectedIndex * 2];
|
||||
var acre = Editor.Terrain.BaseAcres.Span[CB_MapAcre.SelectedIndex * 2];
|
||||
CB_MapAcreSelect.SelectedValue = (int)acre;
|
||||
|
||||
// Jump view if available
|
||||
@@ -1025,7 +1025,7 @@ private void CB_MapAcreSelect_SelectedValueChanged(object sender, EventArgs e)
|
||||
var index = CB_MapAcre.SelectedIndex;
|
||||
var value = WinFormsUtil.GetIndex(CB_MapAcreSelect);
|
||||
|
||||
var span = Map.Terrain.BaseAcres.Span.Slice(index * 2, 2);
|
||||
var span = Editor.Terrain.BaseAcres.Span.Slice(index * 2, 2);
|
||||
var oldValue = span[0];
|
||||
if (value == oldValue)
|
||||
return;
|
||||
@@ -1036,7 +1036,7 @@ private void CB_MapAcreSelect_SelectedValueChanged(object sender, EventArgs e)
|
||||
|
||||
private void B_DumpMapAcres_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MapDumpHelper.DumpMapAcresAll(Map.Terrain.BaseAcres.Span))
|
||||
if (!MapDumpHelper.DumpMapAcresAll(Editor.Terrain.BaseAcres.Span))
|
||||
return;
|
||||
ReloadBuildingsTerrain();
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
@@ -1044,7 +1044,7 @@ private void B_DumpMapAcres_Click(object sender, EventArgs e)
|
||||
|
||||
private void B_ImportMapAcres_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MapDumpHelper.ImportMapAcresAll(Map.Terrain.BaseAcres.Span))
|
||||
if (!MapDumpHelper.ImportMapAcresAll(Editor.Terrain.BaseAcres.Span))
|
||||
return;
|
||||
ReloadBuildingsTerrain();
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
@@ -1056,7 +1056,7 @@ private void B_ZeroElevation_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MessageStrings.MsgTerrainSetElevation0))
|
||||
return;
|
||||
foreach (var t in Map.Terrain.Tiles)
|
||||
foreach (var t in Editor.Terrain.Tiles)
|
||||
t.Elevation = 0;
|
||||
ReloadBuildingsTerrain();
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
@@ -1069,7 +1069,7 @@ private void B_SetAllTerrain_Click(object sender, EventArgs e)
|
||||
|
||||
var pgt = (TerrainTile)PG_TerrainTile.SelectedObject!;
|
||||
bool interiorOnly = DialogResult.Yes == WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MessageStrings.MsgTerrainSetAllSkipExterior);
|
||||
Map.Terrain.SetAll(pgt, interiorOnly);
|
||||
Editor.Terrain.SetAll(pgt, interiorOnly);
|
||||
|
||||
ReloadBuildingsTerrain();
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
@@ -1082,7 +1082,7 @@ private void B_SetAllRoadTiles_Click(object sender, EventArgs e)
|
||||
|
||||
var pgt = (TerrainTile)PG_TerrainTile.SelectedObject!;
|
||||
bool interiorOnly = DialogResult.Yes == WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MessageStrings.MsgTerrainSetAllSkipExterior);
|
||||
Map.Terrain.SetAllRoad(pgt, interiorOnly);
|
||||
Editor.Terrain.SetAllRoad(pgt, interiorOnly);
|
||||
|
||||
ReloadBuildingsTerrain();
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
@@ -1126,9 +1126,9 @@ private void B_ImportPlacedDesigns_Click(object sender, EventArgs e)
|
||||
|
||||
private void Menu_Bulk_Click(object sender, EventArgs e)
|
||||
{
|
||||
var editor = new BatchEditor(SpawnLayer.Tiles, ItemEdit.SetItem(new Item()));
|
||||
var editor = new BatchEditor(Spawn.Tiles, ItemEdit.SetItem(new Item()));
|
||||
editor.ShowDialog();
|
||||
SpawnLayer.ClearDanglingExtensions(0, 0, SpawnLayer.TileInfo.TotalWidth, SpawnLayer.TileInfo.TotalHeight);
|
||||
Spawn.ClearDanglingExtensions(0, 0, Spawn.TileInfo.TotalWidth, Spawn.TileInfo.TotalHeight);
|
||||
LoadItemGridAcre();
|
||||
}
|
||||
|
||||
@@ -1149,5 +1149,5 @@ public interface IItemLayerEditor
|
||||
void ReloadItems();
|
||||
|
||||
ItemEditor ItemProvider { get; }
|
||||
ItemLayer SpawnLayer { get; }
|
||||
LayerItem Spawn { get; }
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace NHSE.WinForms;
|
||||
|
||||
public static class MapDumpHelper
|
||||
{
|
||||
public static bool ImportToLayerAcreSingle(FieldItemLayer layer, int acreIndex, string acre, int layerIndex)
|
||||
public static bool ImportToLayerAcreSingle(LayerFieldItem layerField, int acreIndex, string acre, int layerIndex)
|
||||
{
|
||||
using var ofd = new OpenFileDialog();
|
||||
ofd.Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*";
|
||||
@@ -19,7 +19,7 @@ public static bool ImportToLayerAcreSingle(FieldItemLayer layer, int acreIndex,
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
|
||||
int expect = layer.TileInfo.ViewCount * Item.SIZE;
|
||||
int expect = layerField.TileInfo.ViewCount * Item.SIZE;
|
||||
if (fi.Length != expect)
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
@@ -27,11 +27,11 @@ public static bool ImportToLayerAcreSingle(FieldItemLayer layer, int acreIndex,
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
layer.ImportAcre(acreIndex, data);
|
||||
layerField.ImportAcre(acreIndex, data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ImportToLayerAcreAll(FieldItemLayer layer)
|
||||
public static bool ImportToLayerAcreAll(LayerFieldItem layerField)
|
||||
{
|
||||
using var ofd = new OpenFileDialog();
|
||||
ofd.Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*";
|
||||
@@ -41,7 +41,7 @@ public static bool ImportToLayerAcreAll(FieldItemLayer layer)
|
||||
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
var expect = layer.TileInfo.TotalCount * Item.SIZE;
|
||||
var expect = layerField.TileInfo.TotalCount * Item.SIZE;
|
||||
if (fi.Length != expect && !FieldItemUpgrade.IsUpdateNeeded(fi.Length, expect))
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
@@ -50,11 +50,11 @@ public static bool ImportToLayerAcreAll(FieldItemLayer layer)
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
FieldItemUpgrade.DetectUpdate(ref data, expect);
|
||||
layer.ImportAll(data);
|
||||
layerField.ImportAll(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void DumpLayerAcreSingle(FieldItemLayer layer, int acreIndex, string acre, int layerIndex)
|
||||
public static void DumpLayerAcreSingle(LayerFieldItem layerField, int acreIndex, string acre, int layerIndex)
|
||||
{
|
||||
using var sfd = new SaveFileDialog();
|
||||
sfd.Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*";
|
||||
@@ -63,11 +63,11 @@ public static void DumpLayerAcreSingle(FieldItemLayer layer, int acreIndex, stri
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
var data = layer.DumpAcre(acreIndex);
|
||||
var data = layerField.DumpAcre(acreIndex);
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
|
||||
public static void DumpLayerAcreAll(FieldItemLayer layer)
|
||||
public static void DumpLayerAcreAll(LayerFieldItem layerField)
|
||||
{
|
||||
using var sfd = new SaveFileDialog();
|
||||
sfd.Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*";
|
||||
@@ -76,11 +76,11 @@ public static void DumpLayerAcreAll(FieldItemLayer layer)
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
var data = layer.DumpAll();
|
||||
var data = layerField.DumpAll();
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
|
||||
public static bool ImportTerrainAcre(TerrainLayer m, int acreIndex, string acre)
|
||||
public static bool ImportTerrainAcre(LayerTerrain m, int acreIndex, string acre)
|
||||
{
|
||||
using var ofd = new OpenFileDialog();
|
||||
ofd.Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*";
|
||||
@@ -103,7 +103,7 @@ public static bool ImportTerrainAcre(TerrainLayer m, int acreIndex, string acre)
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ImportTerrainAll(TerrainLayer m)
|
||||
public static bool ImportTerrainAll(LayerTerrain m)
|
||||
{
|
||||
using var ofd = new OpenFileDialog();
|
||||
ofd.Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*";
|
||||
@@ -126,7 +126,7 @@ public static bool ImportTerrainAll(TerrainLayer m)
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void DumpTerrainAcre(TerrainLayer m, int acreIndex, string acre)
|
||||
public static void DumpTerrainAcre(LayerTerrain m, int acreIndex, string acre)
|
||||
{
|
||||
using var sfd = new SaveFileDialog();
|
||||
sfd.Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*";
|
||||
@@ -139,7 +139,7 @@ public static void DumpTerrainAcre(TerrainLayer m, int acreIndex, string acre)
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
|
||||
public static void DumpTerrainAll(TerrainLayer m)
|
||||
public static void DumpTerrainAll(LayerTerrain m)
|
||||
{
|
||||
using var sfd = new SaveFileDialog();
|
||||
sfd.Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*";
|
||||
|
||||
@@ -12,7 +12,7 @@ public partial class PlayerHouseEditor : Form
|
||||
private readonly MainSave SAV;
|
||||
private readonly IPlayerHouse[] Houses;
|
||||
private readonly IReadOnlyList<Player> Players;
|
||||
private RoomItemManager Manager;
|
||||
private RoomManager Manager;
|
||||
private const int scale = 24;
|
||||
|
||||
private int Index = -1;
|
||||
@@ -25,7 +25,7 @@ public PlayerHouseEditor(IPlayerHouse[] houses, IReadOnlyList<Player> players, M
|
||||
SAV = sav;
|
||||
Houses = houses;
|
||||
Players = players;
|
||||
Manager = new RoomItemManager(houses[0].GetRoom(0));
|
||||
Manager = new RoomManager(houses[0].GetRoom(0));
|
||||
|
||||
var data = GameInfo.Strings.ItemDataSource;
|
||||
ItemEdit.Initialize(data, true);
|
||||
@@ -111,7 +111,7 @@ private void B_EditFlags_Click(object sender, EventArgs e)
|
||||
|
||||
private void PB_Room_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
var l = CurrentLayer;
|
||||
var l = Current;
|
||||
var oldTile = l.GetTile(HoverX, HoverY);
|
||||
var tile = GetTile(l, e, out var x, out var y);
|
||||
if (ReferenceEquals(tile, oldTile))
|
||||
@@ -124,7 +124,7 @@ private void PB_Room_MouseMove(object sender, MouseEventArgs e)
|
||||
|
||||
private void SetCoordinateText(int x, int y, string name) => L_Coordinates.Text = $"({x:000},{y:000}) = {name}";
|
||||
|
||||
private Item GetTile(ItemLayer layer, MouseEventArgs e, out int x, out int y)
|
||||
private Item GetTile(LayerItem layer, MouseEventArgs e, out int x, out int y)
|
||||
{
|
||||
SetHoveredItem(e);
|
||||
return layer.GetTile(x = HoverX, y = HoverY);
|
||||
@@ -157,12 +157,12 @@ private void ReloadManager(IPlayerHouse house)
|
||||
if (unsupported.Count != 0)
|
||||
WinFormsUtil.Alert(MessageStrings.MsgFieldItemUnsupportedLayer2Tile);
|
||||
var room = house.GetRoom(RoomIndex);
|
||||
Manager = new RoomItemManager(room);
|
||||
Manager = new RoomManager(room);
|
||||
}
|
||||
|
||||
private void DrawLayer() => DrawRoom(CurrentLayer);
|
||||
private void DrawLayer() => DrawRoom(Current);
|
||||
|
||||
private void DrawRoom(ItemLayer layer)
|
||||
private void DrawRoom(LayerItem layer)
|
||||
{
|
||||
var w = layer.TileInfo.TotalWidth;
|
||||
var h = layer.TileInfo.TotalHeight;
|
||||
@@ -186,7 +186,7 @@ private void NUD_Layer_ValueChanged(object sender, EventArgs e)
|
||||
|
||||
private void PlayerHouseEditor_Click(object sender, MouseEventArgs e)
|
||||
{
|
||||
var tile = GetTile(CurrentLayer, e, out var x, out var y);
|
||||
var tile = GetTile(Current, e, out var x, out var y);
|
||||
OmniTile(tile, x, y);
|
||||
}
|
||||
|
||||
@@ -211,7 +211,7 @@ private void Menu_View_Click(object sender, EventArgs e)
|
||||
var x = HoverX;
|
||||
var y = HoverY;
|
||||
|
||||
var tile = CurrentLayer.GetTile(x, y);
|
||||
var tile = Current.GetTile(x, y);
|
||||
ViewTile(tile, x, y);
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ private void Menu_Set_Click(object sender, EventArgs e)
|
||||
var x = HoverX;
|
||||
var y = HoverY;
|
||||
|
||||
var tile = CurrentLayer.GetTile(x, y);
|
||||
var tile = Current.GetTile(x, y);
|
||||
SetTile(tile, x, y);
|
||||
}
|
||||
|
||||
@@ -229,17 +229,17 @@ private void Menu_Reset_Click(object sender, EventArgs e)
|
||||
var x = HoverX;
|
||||
var y = HoverY;
|
||||
|
||||
var tile = CurrentLayer.GetTile(x, y);
|
||||
var tile = Current.GetTile(x, y);
|
||||
DeleteTile(tile, x, y);
|
||||
}
|
||||
|
||||
private ItemLayer CurrentLayer => Manager.Layers[(int)NUD_Layer.Value - 1];
|
||||
private LayerItem Current => Manager.Layers[(int)NUD_Layer.Value - 1];
|
||||
|
||||
private void ViewTile(Item tile, int x, int y)
|
||||
{
|
||||
if (CHK_RedirectExtensionLoad.Checked && tile.IsExtension)
|
||||
{
|
||||
var l = CurrentLayer;
|
||||
var l = Current;
|
||||
var rx = Math.Max(0, Math.Min(l.TileInfo.TotalWidth - 1, x - tile.ExtensionX));
|
||||
var ry = Math.Max(0, Math.Min(l.TileInfo.TotalHeight - 1, y - tile.ExtensionY));
|
||||
var redir = l.GetTile(rx, ry);
|
||||
@@ -257,7 +257,7 @@ private void ViewTile(Item tile)
|
||||
|
||||
private void SetTile(Item tile, int x, int y)
|
||||
{
|
||||
var l = CurrentLayer;
|
||||
var l = Current;
|
||||
var pgt = new Item();
|
||||
ItemEdit.SetItem(pgt);
|
||||
var permission = l.IsOccupied(pgt, x, y);
|
||||
@@ -289,9 +289,9 @@ private void DeleteTile(Item tile, int x, int y)
|
||||
{
|
||||
x -= tile.ExtensionX;
|
||||
y -= tile.ExtensionY;
|
||||
tile = CurrentLayer.GetTile(x, y);
|
||||
tile = Current.GetTile(x, y);
|
||||
}
|
||||
CurrentLayer.DeleteExtensionTiles(tile, x, y);
|
||||
Current.DeleteExtensionTiles(tile, x, y);
|
||||
}
|
||||
|
||||
tile.Delete();
|
||||
|
||||
Reference in New Issue
Block a user