mirror of
https://github.com/kwsch/NHSE.git
synced 2026-04-22 08:27:28 -05:00
Add more removal options
- remove flowers - remove shells - remove branches Closes #163 rename plazaX/Y to match internal field name
This commit is contained in:
parent
a3357c27c5
commit
203a7c1627
|
|
@ -208,13 +208,13 @@ public ushort MainFieldParamUniqueID
|
|||
set => BitConverter.GetBytes(value).CopyTo(Data, Offsets.OutsideField + AcreSizeAll + 2);
|
||||
}
|
||||
|
||||
public uint PlazaX
|
||||
public uint EventPlazaLeftUpX
|
||||
{
|
||||
get => BitConverter.ToUInt32(Data, Offsets.OutsideField + AcreSizeAll + 4);
|
||||
set => BitConverter.GetBytes(value).CopyTo(Data, Offsets.OutsideField + AcreSizeAll + 4);
|
||||
}
|
||||
|
||||
public uint PlazaY
|
||||
public uint EventPlazaLeftUpZ
|
||||
{
|
||||
get => BitConverter.ToUInt32(Data, Offsets.OutsideField + AcreSizeAll + 8);
|
||||
set => BitConverter.GetBytes(value).CopyTo(Data, Offsets.OutsideField + AcreSizeAll + 8);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace NHSE.Core
|
||||
|
|
@ -64,6 +65,8 @@ public void ImportAcre(int acre, byte[] data)
|
|||
|
||||
public int ClearFieldPlanted(Func<FieldItemKind, bool> criteria) => ClearFieldPlanted(0, 0, MapWidth, MapHeight, criteria);
|
||||
public int RemoveAll(Func<FieldItem, bool> criteria) => RemoveAll(0, 0, MapWidth, MapHeight, criteria);
|
||||
public int RemoveAll(HashSet<ushort> items) => RemoveAll(0, 0, MapWidth, MapHeight, z => items.Contains(z.DisplayItemId));
|
||||
public int RemoveAll(ushort item) => RemoveAll(0, 0, MapWidth, MapHeight, z => z.DisplayItemId == item);
|
||||
|
||||
public int ClearFieldPlanted(int xmin, int ymin, int width, int height, Func<FieldItemKind, bool> criteria)
|
||||
{
|
||||
|
|
@ -116,9 +119,12 @@ public int RemoveAll(int xmin, int ymin, int width, int height, Func<FieldItem,
|
|||
public int RemoveAllWeeds(int xmin, int ymin, int width, int height) => ClearFieldPlanted(xmin, ymin, width, height, z => z.IsWeed());
|
||||
public int RemoveAllPlants(int xmin, int ymin, int width, int height) => ClearFieldPlanted(xmin, ymin, width, height, z => z.IsPlant());
|
||||
public int RemoveAllFences(int xmin, int ymin, int width, int height) => ClearFieldPlanted(xmin, ymin, width, height, z => z.IsFence());
|
||||
public int RemoveAllFlowers(int xmin, int ymin, int width, int height) => ClearFieldPlanted(xmin, ymin, width, height, z => z.IsFlower());
|
||||
public int RemoveAllObjects(int xmin, int ymin, int width, int height) => ClearFieldPlanted(xmin, ymin, width, height, _ => true);
|
||||
|
||||
public int RemoveAll(int xmin, int ymin, int width, int height) => RemoveAll(xmin, ymin, width, height, _ => true);
|
||||
public int RemoveAllShells(int xmin, int ymin, int width, int height) => RemoveAll(xmin, ymin, width, height, z => GameLists.Shells.Contains(z.DisplayItemId));
|
||||
public int RemoveAllBranches(int xmin, int ymin, int width, int height) => RemoveAll(xmin, ymin, width, height, z => z.DisplayItemId == 2500);
|
||||
public int RemoveAllPlacedItems(int xmin, int ymin, int width, int height) => RemoveAll(xmin, ymin, width,
|
||||
height, z => z.DisplayItemId != FieldItem.NONE && !FieldItemList.Items.ContainsKey(z.DisplayItemId));
|
||||
|
||||
|
|
|
|||
|
|
@ -331,5 +331,19 @@ public static class GameLists
|
|||
12625, // mysterious painting
|
||||
12629, // scenic painting (forgery)
|
||||
};
|
||||
|
||||
public static readonly HashSet<ushort> Shells = new HashSet<ushort>
|
||||
{
|
||||
1374, // sea snail
|
||||
1375, // venus comb
|
||||
1376, // conch
|
||||
// 2 unused 1377, 1378
|
||||
1379, // sand dollar
|
||||
1380, // coral
|
||||
1381, // giant clam
|
||||
1382, // cowrie
|
||||
|
||||
5982, // summer shell
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ public MapTerrainStructure(MainSave sav)
|
|||
{
|
||||
Terrain = new TerrainManager(sav.GetTerrainTiles());
|
||||
Buildings = sav.Buildings;
|
||||
PlazaX = sav.PlazaX;
|
||||
PlazaY = sav.PlazaY;
|
||||
PlazaX = sav.EventPlazaLeftUpX;
|
||||
PlazaY = sav.EventPlazaLeftUpZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ public BuildingEditor(MainSave sav)
|
|||
Scale1 = new int[Manager.Terrain.MapWidth * Manager.Terrain.MapHeight];
|
||||
ScaleX = new int[Scale1.Length * scale * scale];
|
||||
Map = new Bitmap(Manager.Terrain.MapWidth * scale, Manager.Terrain.MapHeight * scale);
|
||||
NUD_PlazaX.Value = sav.PlazaX;
|
||||
NUD_PlazaY.Value = sav.PlazaY;
|
||||
NUD_PlazaX.Value = sav.EventPlazaLeftUpX;
|
||||
NUD_PlazaY.Value = sav.EventPlazaLeftUpZ;
|
||||
|
||||
foreach (var obj in Manager.Buildings)
|
||||
LB_Items.Items.Add(obj.ToString());
|
||||
|
|
@ -48,8 +48,8 @@ public BuildingEditor(MainSave sav)
|
|||
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
SAV.PlazaX = (uint)NUD_PlazaX.Value;
|
||||
SAV.PlazaY = (uint)NUD_PlazaY.Value;
|
||||
SAV.EventPlazaLeftUpX = (uint)NUD_PlazaX.Value;
|
||||
SAV.EventPlazaLeftUpZ = (uint)NUD_PlazaY.Value;
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
SAV.Buildings = Manager.Buildings;
|
||||
|
|
|
|||
|
|
@ -120,6 +120,9 @@ private void InitializeComponent()
|
|||
this.RB_Item = new System.Windows.Forms.RadioButton();
|
||||
this.RB_Terrain = new System.Windows.Forms.RadioButton();
|
||||
this.L_TileMode = new System.Windows.Forms.Label();
|
||||
this.B_RemoveBranches = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_RemoveShells = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_RemoveFlowers = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CM_Click.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PB_Map)).BeginInit();
|
||||
this.CM_Picture.SuspendLayout();
|
||||
|
|
@ -425,58 +428,61 @@ private void InitializeComponent()
|
|||
this.B_RemoveObjects,
|
||||
this.B_RemovePlacedItems,
|
||||
this.B_RemoveFences,
|
||||
this.B_RemoveBranches,
|
||||
this.B_RemoveShells,
|
||||
this.B_RemoveFlowers,
|
||||
this.B_FillHoles,
|
||||
this.B_RemoveAll});
|
||||
this.CM_Remove.Name = "CM_Picture";
|
||||
this.CM_Remove.ShowImageMargin = false;
|
||||
this.CM_Remove.Size = new System.Drawing.Size(117, 158);
|
||||
this.CM_Remove.Size = new System.Drawing.Size(156, 246);
|
||||
//
|
||||
// B_RemoveAllWeeds
|
||||
//
|
||||
this.B_RemoveAllWeeds.Name = "B_RemoveAllWeeds";
|
||||
this.B_RemoveAllWeeds.Size = new System.Drawing.Size(116, 22);
|
||||
this.B_RemoveAllWeeds.Size = new System.Drawing.Size(155, 22);
|
||||
this.B_RemoveAllWeeds.Text = "Weeds";
|
||||
this.B_RemoveAllWeeds.Click += new System.EventHandler(this.B_RemoveAllWeeds_Click);
|
||||
//
|
||||
// B_RemovePlants
|
||||
//
|
||||
this.B_RemovePlants.Name = "B_RemovePlants";
|
||||
this.B_RemovePlants.Size = new System.Drawing.Size(116, 22);
|
||||
this.B_RemovePlants.Size = new System.Drawing.Size(155, 22);
|
||||
this.B_RemovePlants.Text = "Plants";
|
||||
this.B_RemovePlants.Click += new System.EventHandler(this.B_RemovePlants_Click);
|
||||
//
|
||||
// B_RemoveObjects
|
||||
//
|
||||
this.B_RemoveObjects.Name = "B_RemoveObjects";
|
||||
this.B_RemoveObjects.Size = new System.Drawing.Size(116, 22);
|
||||
this.B_RemoveObjects.Size = new System.Drawing.Size(155, 22);
|
||||
this.B_RemoveObjects.Text = "Objects";
|
||||
this.B_RemoveObjects.Click += new System.EventHandler(this.B_RemoveObjects_Click);
|
||||
//
|
||||
// B_RemovePlacedItems
|
||||
//
|
||||
this.B_RemovePlacedItems.Name = "B_RemovePlacedItems";
|
||||
this.B_RemovePlacedItems.Size = new System.Drawing.Size(116, 22);
|
||||
this.B_RemovePlacedItems.Size = new System.Drawing.Size(155, 22);
|
||||
this.B_RemovePlacedItems.Text = "Placed Items";
|
||||
this.B_RemovePlacedItems.Click += new System.EventHandler(this.B_RemovePlacedItems_Click);
|
||||
//
|
||||
// B_RemoveFences
|
||||
//
|
||||
this.B_RemoveFences.Name = "B_RemoveFences";
|
||||
this.B_RemoveFences.Size = new System.Drawing.Size(116, 22);
|
||||
this.B_RemoveFences.Size = new System.Drawing.Size(155, 22);
|
||||
this.B_RemoveFences.Text = "Fences";
|
||||
this.B_RemoveFences.Click += new System.EventHandler(this.B_RemoveFences_Click);
|
||||
//
|
||||
// B_FillHoles
|
||||
//
|
||||
this.B_FillHoles.Name = "B_FillHoles";
|
||||
this.B_FillHoles.Size = new System.Drawing.Size(116, 22);
|
||||
this.B_FillHoles.Size = new System.Drawing.Size(155, 22);
|
||||
this.B_FillHoles.Text = "Holes";
|
||||
this.B_FillHoles.Click += new System.EventHandler(this.B_FillHoles_Click);
|
||||
//
|
||||
// B_RemoveAll
|
||||
//
|
||||
this.B_RemoveAll.Name = "B_RemoveAll";
|
||||
this.B_RemoveAll.Size = new System.Drawing.Size(116, 22);
|
||||
this.B_RemoveAll.Size = new System.Drawing.Size(155, 22);
|
||||
this.B_RemoveAll.Text = "All";
|
||||
this.B_RemoveAll.Click += new System.EventHandler(this.B_RemoveAll_Click);
|
||||
//
|
||||
|
|
@ -1080,6 +1086,27 @@ private void InitializeComponent()
|
|||
this.L_TileMode.Text = "Tile Editor Mode";
|
||||
this.L_TileMode.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// B_RemoveBranches
|
||||
//
|
||||
this.B_RemoveBranches.Name = "B_RemoveBranches";
|
||||
this.B_RemoveBranches.Size = new System.Drawing.Size(155, 22);
|
||||
this.B_RemoveBranches.Text = "Branches";
|
||||
this.B_RemoveBranches.Click += new System.EventHandler(this.B_RemoveBranches_Click);
|
||||
//
|
||||
// B_RemoveShells
|
||||
//
|
||||
this.B_RemoveShells.Name = "B_RemoveShells";
|
||||
this.B_RemoveShells.Size = new System.Drawing.Size(155, 22);
|
||||
this.B_RemoveShells.Text = "Shells";
|
||||
this.B_RemoveShells.Click += new System.EventHandler(this.B_RemoveShells_Click);
|
||||
//
|
||||
// B_RemoveFlowers
|
||||
//
|
||||
this.B_RemoveFlowers.Name = "B_RemoveFlowers";
|
||||
this.B_RemoveFlowers.Size = new System.Drawing.Size(155, 22);
|
||||
this.B_RemoveFlowers.Text = "Flowers";
|
||||
this.B_RemoveFlowers.Click += new System.EventHandler(this.B_RemoveFlowers_Click);
|
||||
//
|
||||
// FieldItemEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
|
@ -1238,5 +1265,8 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.Label L_BuildingTransparency;
|
||||
private System.Windows.Forms.Label L_TerrainTileLabelTransparency;
|
||||
private System.Windows.Forms.TrackBar TR_Terrain;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_RemoveBranches;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_RemoveShells;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_RemoveFlowers;
|
||||
}
|
||||
}
|
||||
|
|
@ -33,8 +33,8 @@ public FieldItemEditor(MainSave sav)
|
|||
foreach (var acre in MapGrid.Acres)
|
||||
CB_Acre.Items.Add(acre.Name);
|
||||
|
||||
NUD_PlazaX.Value = sav.PlazaX;
|
||||
NUD_PlazaY.Value = sav.PlazaY;
|
||||
NUD_PlazaX.Value = sav.EventPlazaLeftUpX;
|
||||
NUD_PlazaY.Value = sav.EventPlazaLeftUpZ;
|
||||
|
||||
foreach (var obj in Map.Buildings)
|
||||
LB_Items.Items.Add(obj.ToString());
|
||||
|
|
@ -265,8 +265,8 @@ private void B_Save_Click(object sender, EventArgs e)
|
|||
Map.Items.Save();
|
||||
SAV.SetTerrainTiles(Map.Terrain.Tiles);
|
||||
SAV.Buildings = Map.Buildings;
|
||||
SAV.PlazaX = Map.PlazaX;
|
||||
SAV.PlazaY = Map.PlazaY;
|
||||
SAV.EventPlazaLeftUpX = Map.PlazaX;
|
||||
SAV.EventPlazaLeftUpZ = Map.PlazaY;
|
||||
Close();
|
||||
}
|
||||
|
||||
|
|
@ -517,6 +517,9 @@ private void Remove(ToolStripItem sender, Func<int, int, int, int, int> removal)
|
|||
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 PG_Tile_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) => PG_Tile.SelectedObject = PG_Tile.SelectedObject;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user