mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-05-30 08:32:00 +00:00
Replaced massive amount of spaces with (massive amount of tabs / 4)
This commit is contained in:
parent
ead2521451
commit
fc57c3e331
322 changed files with 25397 additions and 25400 deletions
|
@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
ButtonImage = "VisualModeGZ.png", // Image resource name for the button
|
||||
ButtonOrder = 1, // Position of the button (lower is more to the left)
|
||||
ButtonGroup = "001_visual",
|
||||
UseByDefault = true)]
|
||||
UseByDefault = true)]
|
||||
|
||||
public class BaseVisualMode : VisualMode
|
||||
{
|
||||
|
@ -91,11 +91,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// List of selected objects when an action is performed
|
||||
private List<IVisualEventReceiver> selectedobjects;
|
||||
//mxd. Used in Cut/PasteSelection actions
|
||||
private List<ThingCopyData> copyBuffer;
|
||||
//mxd. Used in Cut/PasteSelection actions
|
||||
private List<ThingCopyData> copyBuffer;
|
||||
|
||||
public static bool GZDoomRenderingEffects { get { return gzdoomRenderingEffects; } } //mxd
|
||||
private static bool gzdoomRenderingEffects = true; //mxd
|
||||
private static bool gzdoomRenderingEffects = true; //mxd
|
||||
|
||||
//mxd. Moved here from Tools
|
||||
private struct SidedefAlignJob
|
||||
|
@ -164,8 +164,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Initialize
|
||||
this.gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
||||
this.selectedobjects = new List<IVisualEventReceiver>();
|
||||
//mxd
|
||||
this.copyBuffer = new List<ThingCopyData>();
|
||||
//mxd
|
||||
this.copyBuffer = new List<ThingCopyData>();
|
||||
|
||||
// We have no destructor
|
||||
GC.SuppressFinalize(this);
|
||||
|
@ -194,10 +194,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
return renderer.CalculateBrightness(level);
|
||||
}
|
||||
|
||||
//mxd. This calculates brightness level with doom-style shading
|
||||
internal int CalculateBrightness(int level, Sidedef sd) {
|
||||
return renderer.CalculateBrightness(level, sd);
|
||||
}
|
||||
//mxd. This calculates brightness level with doom-style shading
|
||||
internal int CalculateBrightness(int level, Sidedef sd) {
|
||||
return renderer.CalculateBrightness(level, sd);
|
||||
}
|
||||
|
||||
// This adds a selected object
|
||||
internal void AddSelectedObject(IVisualEventReceiver obj)
|
||||
|
@ -473,7 +473,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// This updates the VisualSectors and VisualThings that have their Changed property set
|
||||
private void UpdateChangedObjects()
|
||||
private void UpdateChangedObjects()
|
||||
{
|
||||
foreach(KeyValuePair<Sector, VisualSector> vs in allsectors)
|
||||
{
|
||||
|
@ -500,81 +500,81 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
protected override void moveSelectedThings(Vector2D direction, bool absolutePosition) {
|
||||
List<VisualThing> visualThings = GetSelectedVisualThings(true);
|
||||
if (visualThings.Count == 0) return;
|
||||
//mxd
|
||||
protected override void moveSelectedThings(Vector2D direction, bool absolutePosition) {
|
||||
List<VisualThing> visualThings = GetSelectedVisualThings(true);
|
||||
if (visualThings.Count == 0) return;
|
||||
|
||||
PreAction(UndoGroup.ThingMove);
|
||||
PreAction(UndoGroup.ThingMove);
|
||||
|
||||
Vector3D[] coords = new Vector3D[visualThings.Count];
|
||||
for (int i = 0; i < visualThings.Count; i++)
|
||||
coords[i] = visualThings[i].Thing.Position;
|
||||
Vector3D[] coords = new Vector3D[visualThings.Count];
|
||||
for (int i = 0; i < visualThings.Count; i++)
|
||||
coords[i] = visualThings[i].Thing.Position;
|
||||
|
||||
//move things...
|
||||
Vector3D[] translatedCoords = translateCoordinates(coords, direction, absolutePosition);
|
||||
for (int i = 0; i < visualThings.Count; i++) {
|
||||
BaseVisualThing t = visualThings[i] as BaseVisualThing;
|
||||
t.OnMove(translatedCoords[i]);
|
||||
}
|
||||
//move things...
|
||||
Vector3D[] translatedCoords = translateCoordinates(coords, direction, absolutePosition);
|
||||
for (int i = 0; i < visualThings.Count; i++) {
|
||||
BaseVisualThing t = visualThings[i] as BaseVisualThing;
|
||||
t.OnMove(translatedCoords[i]);
|
||||
}
|
||||
|
||||
PostAction();
|
||||
}
|
||||
PostAction();
|
||||
}
|
||||
|
||||
//mxd
|
||||
private Vector3D[] translateCoordinates(Vector3D[] coordinates, Vector2D direction, bool absolutePosition) {
|
||||
if (coordinates.Length == 0) return null;
|
||||
//mxd
|
||||
private Vector3D[] translateCoordinates(Vector3D[] coordinates, Vector2D direction, bool absolutePosition) {
|
||||
if (coordinates.Length == 0) return null;
|
||||
|
||||
direction.x = (float)Math.Round(direction.x);
|
||||
direction.y = (float)Math.Round(direction.y);
|
||||
direction.x = (float)Math.Round(direction.x);
|
||||
direction.y = (float)Math.Round(direction.y);
|
||||
|
||||
Vector3D[] translatedCoords = new Vector3D[coordinates.Length];
|
||||
Vector3D[] translatedCoords = new Vector3D[coordinates.Length];
|
||||
|
||||
//move things...
|
||||
if (!absolutePosition) { //...relatively (that's easy)
|
||||
int camAngle = (int)Math.Round(Angle2D.RadToDeg(General.Map.VisualCamera.AngleXY));// * 180 / Math.PI);
|
||||
int sector = General.ClampAngle(camAngle - 45) / 90;
|
||||
direction = direction.GetRotated(sector * Angle2D.PIHALF);
|
||||
//move things...
|
||||
if (!absolutePosition) { //...relatively (that's easy)
|
||||
int camAngle = (int)Math.Round(Angle2D.RadToDeg(General.Map.VisualCamera.AngleXY));// * 180 / Math.PI);
|
||||
int sector = General.ClampAngle(camAngle - 45) / 90;
|
||||
direction = direction.GetRotated(sector * Angle2D.PIHALF);
|
||||
|
||||
for (int i = 0; i < coordinates.Length; i++)
|
||||
translatedCoords[i] = coordinates[i] + new Vector3D(direction);
|
||||
for (int i = 0; i < coordinates.Length; i++)
|
||||
translatedCoords[i] = coordinates[i] + new Vector3D(direction);
|
||||
|
||||
return translatedCoords;
|
||||
}
|
||||
return translatedCoords;
|
||||
}
|
||||
|
||||
//...to specified location preserving relative positioning (that's harder)
|
||||
if (coordinates.Length == 1) {//just move it there
|
||||
translatedCoords[0] = new Vector3D(direction.x, direction.y, coordinates[0].z);
|
||||
return translatedCoords;
|
||||
}
|
||||
//...to specified location preserving relative positioning (that's harder)
|
||||
if (coordinates.Length == 1) {//just move it there
|
||||
translatedCoords[0] = new Vector3D(direction.x, direction.y, coordinates[0].z);
|
||||
return translatedCoords;
|
||||
}
|
||||
|
||||
//we need some reference
|
||||
float minX = coordinates[0].x;
|
||||
float maxX = minX;
|
||||
float minY = coordinates[0].y;
|
||||
float maxY = minY;
|
||||
//we need some reference
|
||||
float minX = coordinates[0].x;
|
||||
float maxX = minX;
|
||||
float minY = coordinates[0].y;
|
||||
float maxY = minY;
|
||||
|
||||
//get bounding coordinates for selected things
|
||||
for (int i = 1; i < coordinates.Length; i++) {
|
||||
if (coordinates[i].x < minX)
|
||||
minX = coordinates[i].x;
|
||||
else if (coordinates[i].x > maxX)
|
||||
maxX = coordinates[i].x;
|
||||
//get bounding coordinates for selected things
|
||||
for (int i = 1; i < coordinates.Length; i++) {
|
||||
if (coordinates[i].x < minX)
|
||||
minX = coordinates[i].x;
|
||||
else if (coordinates[i].x > maxX)
|
||||
maxX = coordinates[i].x;
|
||||
|
||||
if (coordinates[i].y < minY)
|
||||
minY = coordinates[i].y;
|
||||
else if (coordinates[i].y > maxY)
|
||||
maxY = coordinates[i].y;
|
||||
}
|
||||
if (coordinates[i].y < minY)
|
||||
minY = coordinates[i].y;
|
||||
else if (coordinates[i].y > maxY)
|
||||
maxY = coordinates[i].y;
|
||||
}
|
||||
|
||||
Vector2D selectionCenter = new Vector2D(minX + (maxX - minX) / 2, minY + (maxY - minY) / 2);
|
||||
Vector2D selectionCenter = new Vector2D(minX + (maxX - minX) / 2, minY + (maxY - minY) / 2);
|
||||
|
||||
//move them
|
||||
for (int i = 0; i < coordinates.Length; i++)
|
||||
translatedCoords[i] = new Vector3D((float)Math.Round(direction.x - (selectionCenter.x - coordinates[i].x)), (float)Math.Round(direction.y - (selectionCenter.y - coordinates[i].y)), (float)Math.Round(coordinates[i].z));
|
||||
//move them
|
||||
for (int i = 0; i < coordinates.Length; i++)
|
||||
translatedCoords[i] = new Vector3D((float)Math.Round(direction.x - (selectionCenter.x - coordinates[i].x)), (float)Math.Round(direction.y - (selectionCenter.y - coordinates[i].y)), (float)Math.Round(coordinates[i].z));
|
||||
|
||||
return translatedCoords;
|
||||
}
|
||||
return translatedCoords;
|
||||
}
|
||||
|
||||
//mxd
|
||||
internal void SelectSideParts(Sidedef side, bool toggleTop, bool toggleMid, bool toggleBottom, bool select, bool withSameTexture, bool withSameHeight) {
|
||||
|
@ -701,7 +701,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//mxd
|
||||
Sector[] sectorsWithEffects = null;
|
||||
|
||||
if (!gzdoomRenderingEffects) {
|
||||
if (!gzdoomRenderingEffects) {
|
||||
|
||||
//store all sectors with effects
|
||||
if(sectordata != null && sectordata.Count > 0) {
|
||||
|
@ -715,11 +715,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(i is BaseVisualVertex) RemoveSelectedObject(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<int, List<Sector>> sectortags = new Dictionary<int, List<Sector>>();
|
||||
sectordata = new Dictionary<Sector, SectorData>(General.Map.Map.Sectors.Count);
|
||||
thingdata = new Dictionary<Thing, ThingData>(General.Map.Map.Things.Count);
|
||||
Dictionary<int, List<Sector>> sectortags = new Dictionary<int, List<Sector>>();
|
||||
sectordata = new Dictionary<Sector, SectorData>(General.Map.Map.Sectors.Count);
|
||||
thingdata = new Dictionary<Thing, ThingData>(General.Map.Map.Things.Count);
|
||||
|
||||
//mxd. rebuild all sectors with effects
|
||||
if(sectorsWithEffects != null) {
|
||||
|
@ -737,7 +737,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
vertices.Clear();
|
||||
}
|
||||
|
||||
if (!gzdoomRenderingEffects) return; //mxd
|
||||
if (!gzdoomRenderingEffects) return; //mxd
|
||||
|
||||
// Find all sector who's tag is not 0 and hash them so that we can find them quicly
|
||||
foreach(Sector s in General.Map.Map.Sectors)
|
||||
|
@ -978,7 +978,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
v.Selected = true;
|
||||
}
|
||||
|
||||
copyBuffer.Clear(); //mxd
|
||||
copyBuffer.Clear(); //mxd
|
||||
General.Map.Map.Update();
|
||||
}
|
||||
|
||||
|
@ -1081,7 +1081,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
renderer.SetFogMode(true);
|
||||
|
||||
// Set target for highlighting
|
||||
renderer.ShowSelection = General.Settings.GZOldHighlightMode || BuilderPlug.Me.UseHighlight; //mxd
|
||||
renderer.ShowSelection = General.Settings.GZOldHighlightMode || BuilderPlug.Me.UseHighlight; //mxd
|
||||
|
||||
if(BuilderPlug.Me.UseHighlight)
|
||||
renderer.SetHighlightedObject(target.picked);
|
||||
|
@ -1246,17 +1246,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Undo performed
|
||||
public override void OnUndoEnd()
|
||||
{
|
||||
base.OnUndoEnd();
|
||||
base.OnUndoEnd();
|
||||
|
||||
//mxd. Effects may've become invalid
|
||||
//mxd. Effects may've become invalid
|
||||
if(gzdoomRenderingEffects && sectordata != null && sectordata.Count > 0)
|
||||
RebuildElementData();
|
||||
|
||||
//mxd. As well as geometry...
|
||||
foreach(KeyValuePair<Sector, VisualSector> group in visiblesectors){
|
||||
if (group.Value is BaseVisualSector)
|
||||
((BaseVisualSector)group.Value).Rebuild();
|
||||
}
|
||||
foreach(KeyValuePair<Sector, VisualSector> group in visiblesectors){
|
||||
if (group.Value is BaseVisualSector)
|
||||
((BaseVisualSector)group.Value).Rebuild();
|
||||
}
|
||||
|
||||
RebuildSelectedObjectsList();
|
||||
|
||||
|
@ -1277,10 +1277,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
RebuildElementData();
|
||||
|
||||
//mxd. As well as geometry...
|
||||
foreach (KeyValuePair<Sector, VisualSector> group in visiblesectors) {
|
||||
if (group.Value is BaseVisualSector)
|
||||
((BaseVisualSector)group.Value).Rebuild();
|
||||
}
|
||||
foreach (KeyValuePair<Sector, VisualSector> group in visiblesectors) {
|
||||
if (group.Value is BaseVisualSector)
|
||||
((BaseVisualSector)group.Value).Rebuild();
|
||||
}
|
||||
|
||||
RebuildSelectedObjectsList();
|
||||
|
||||
|
@ -1598,38 +1598,38 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
}
|
||||
|
||||
//mxd. Copied from BuilderModes.ThingsMode
|
||||
// This creates a new thing
|
||||
private Thing CreateThing(Vector2D pos) {
|
||||
if (pos.x < General.Map.Config.LeftBoundary || pos.x > General.Map.Config.RightBoundary ||
|
||||
pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Failed to insert thing: outside of map boundaries.");
|
||||
return null;
|
||||
}
|
||||
//mxd. Copied from BuilderModes.ThingsMode
|
||||
// This creates a new thing
|
||||
private Thing CreateThing(Vector2D pos) {
|
||||
if (pos.x < General.Map.Config.LeftBoundary || pos.x > General.Map.Config.RightBoundary ||
|
||||
pos.y > General.Map.Config.TopBoundary || pos.y < General.Map.Config.BottomBoundary) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Failed to insert thing: outside of map boundaries.");
|
||||
return null;
|
||||
}
|
||||
|
||||
// Create thing
|
||||
Thing t = General.Map.Map.CreateThing();
|
||||
if (t != null) {
|
||||
General.Settings.ApplyDefaultThingSettings(t);
|
||||
t.Move(pos);
|
||||
t.UpdateConfiguration();
|
||||
General.Map.IsChanged = true;
|
||||
|
||||
// Update things filter so that it includes this thing
|
||||
General.Map.ThingsFilter.Update();
|
||||
// Create thing
|
||||
Thing t = General.Map.Map.CreateThing();
|
||||
if (t != null) {
|
||||
General.Settings.ApplyDefaultThingSettings(t);
|
||||
t.Move(pos);
|
||||
t.UpdateConfiguration();
|
||||
General.Map.IsChanged = true;
|
||||
|
||||
// Update things filter so that it includes this thing
|
||||
General.Map.ThingsFilter.Update();
|
||||
|
||||
// Snap to grid enabled?
|
||||
if (General.Interface.SnapToGrid) {
|
||||
// Snap to grid
|
||||
t.SnapToGrid();
|
||||
} else {
|
||||
// Snap to map format accuracy
|
||||
t.SnapToAccuracy();
|
||||
}
|
||||
}
|
||||
// Snap to grid enabled?
|
||||
if (General.Interface.SnapToGrid) {
|
||||
// Snap to grid
|
||||
t.SnapToGrid();
|
||||
} else {
|
||||
// Snap to map format accuracy
|
||||
t.SnapToAccuracy();
|
||||
}
|
||||
}
|
||||
|
||||
return t;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -2128,73 +2128,73 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
[BeginAction("movetextureleft")]
|
||||
public void MoveTextureLeft1()
|
||||
{
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(-1, 0, true);
|
||||
PostAction();
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(-1, 0, true);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("movetextureright")]
|
||||
public void MoveTextureRight1()
|
||||
{
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(1, 0, true);
|
||||
PostAction();
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(1, 0, true);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("movetextureup")]
|
||||
public void MoveTextureUp1()
|
||||
{
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, -1, true);
|
||||
PostAction();
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, -1, true);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("movetexturedown")]
|
||||
public void MoveTextureDown1()
|
||||
{
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, 1, true);
|
||||
PostAction();
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, 1, true);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("movetextureleft8")]
|
||||
public void MoveTextureLeft8()
|
||||
{
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(-8, 0, true);
|
||||
PostAction();
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(-8, 0, true);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("movetextureright8")]
|
||||
public void MoveTextureRight8()
|
||||
{
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(8, 0, true);
|
||||
PostAction();
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(8, 0, true);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("movetextureup8")]
|
||||
public void MoveTextureUp8()
|
||||
{
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, -8, true);
|
||||
PostAction();
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, -8, true);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
[BeginAction("movetexturedown8")]
|
||||
public void MoveTextureDown8()
|
||||
{
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
PreAction(UndoGroup.TextureOffsetChange);
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(true, true, false, false);
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, 8, true);
|
||||
PostAction();
|
||||
foreach (IVisualEventReceiver i in objs) i.OnChangeTextureOffset(0, 8, true);
|
||||
PostAction();
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
@ -2498,41 +2498,41 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
PostAction();
|
||||
}
|
||||
|
||||
//mxd. now we can insert things in Visual modes
|
||||
[BeginAction("insertitem", BaseAction = true)]
|
||||
//mxd. now we can insert things in Visual modes
|
||||
[BeginAction("insertitem", BaseAction = true)]
|
||||
public void InsertThing()
|
||||
{
|
||||
Vector2D hitpos = GetHitPosition();
|
||||
Vector2D hitpos = GetHitPosition();
|
||||
|
||||
if (!hitpos.IsFinite()) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Cannot insert thing here!");
|
||||
return;
|
||||
}
|
||||
|
||||
ClearSelection();
|
||||
PreActionNoChange();
|
||||
General.Map.UndoRedo.ClearAllRedos();
|
||||
General.Map.UndoRedo.CreateUndo("Insert thing");
|
||||
if (!hitpos.IsFinite()) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Cannot insert thing here!");
|
||||
return;
|
||||
}
|
||||
|
||||
ClearSelection();
|
||||
PreActionNoChange();
|
||||
General.Map.UndoRedo.ClearAllRedos();
|
||||
General.Map.UndoRedo.CreateUndo("Insert thing");
|
||||
|
||||
Thing t = CreateThing(new Vector2D(hitpos.x, hitpos.y));
|
||||
Thing t = CreateThing(new Vector2D(hitpos.x, hitpos.y));
|
||||
|
||||
if (t == null) {
|
||||
General.Map.UndoRedo.WithdrawUndo();
|
||||
return;
|
||||
}
|
||||
if (t == null) {
|
||||
General.Map.UndoRedo.WithdrawUndo();
|
||||
return;
|
||||
}
|
||||
|
||||
// Edit the thing?
|
||||
if (BuilderPlug.Me.EditNewThing)
|
||||
General.Interface.ShowEditThings(new List<Thing> { t });
|
||||
// Edit the thing?
|
||||
if (BuilderPlug.Me.EditNewThing)
|
||||
General.Interface.ShowEditThings(new List<Thing> { t });
|
||||
|
||||
//add thing to blockmap
|
||||
blockmap.AddThing(t);
|
||||
//add thing to blockmap
|
||||
blockmap.AddThing(t);
|
||||
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Inserted a new thing.");
|
||||
PostAction();
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Inserted a new thing.");
|
||||
PostAction();
|
||||
}
|
||||
|
||||
//mxd
|
||||
//mxd
|
||||
[BeginAction("deleteitem", BaseAction = true)]
|
||||
public void Delete()
|
||||
{
|
||||
|
@ -2544,27 +2544,27 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
ClearSelection();
|
||||
}
|
||||
|
||||
//mxd
|
||||
[BeginAction("copyselection", BaseAction = true)]
|
||||
public void CopySelection() {
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(false, false, true, false);
|
||||
if (objs.Count == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Nothing to copy, select some Things first!");
|
||||
return;
|
||||
}
|
||||
//mxd
|
||||
[BeginAction("copyselection", BaseAction = true)]
|
||||
public void CopySelection() {
|
||||
List<IVisualEventReceiver> objs = GetSelectedObjects(false, false, true, false);
|
||||
if (objs.Count == 0) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Nothing to copy, select some Things first!");
|
||||
return;
|
||||
}
|
||||
|
||||
copyBuffer.Clear();
|
||||
foreach (IVisualEventReceiver i in objs) {
|
||||
VisualThing vt = i as VisualThing;
|
||||
if (vt != null) copyBuffer.Add(new ThingCopyData(vt.Thing));
|
||||
}
|
||||
General.Interface.DisplayStatus(StatusType.Info, "Copied " + copyBuffer.Count + " Things");
|
||||
}
|
||||
copyBuffer.Clear();
|
||||
foreach (IVisualEventReceiver i in objs) {
|
||||
VisualThing vt = i as VisualThing;
|
||||
if (vt != null) copyBuffer.Add(new ThingCopyData(vt.Thing));
|
||||
}
|
||||
General.Interface.DisplayStatus(StatusType.Info, "Copied " + copyBuffer.Count + " Things");
|
||||
}
|
||||
|
||||
//mxd
|
||||
[BeginAction("cutselection", BaseAction = true)]
|
||||
public void CutSelection() {
|
||||
CopySelection();
|
||||
//mxd
|
||||
[BeginAction("cutselection", BaseAction = true)]
|
||||
public void CutSelection() {
|
||||
CopySelection();
|
||||
|
||||
//Create undo
|
||||
string rest = copyBuffer.Count + " thing" + (copyBuffer.Count > 1 ? "s." : ".");
|
||||
|
@ -2581,61 +2581,61 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
General.Map.IsChanged = true;
|
||||
General.Map.ThingsFilter.Update();
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. We'll just use currently selected objects
|
||||
[BeginAction("pasteselection", BaseAction = true)]
|
||||
public void PasteSelection() {
|
||||
if(copyBuffer.Count == 0){
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Nothing to paste, cut or copy some Things first!");
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2D hitpos = GetHitPosition();
|
||||
//mxd. We'll just use currently selected objects
|
||||
[BeginAction("pasteselection", BaseAction = true)]
|
||||
public void PasteSelection() {
|
||||
if(copyBuffer.Count == 0){
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Nothing to paste, cut or copy some Things first!");
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2D hitpos = GetHitPosition();
|
||||
|
||||
if (!hitpos.IsFinite()) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Cannot paste here!");
|
||||
return;
|
||||
}
|
||||
if (!hitpos.IsFinite()) {
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Cannot paste here!");
|
||||
return;
|
||||
}
|
||||
|
||||
string rest = copyBuffer.Count + " thing" + (copyBuffer.Count > 1 ? "s." : ".");
|
||||
string rest = copyBuffer.Count + " thing" + (copyBuffer.Count > 1 ? "s." : ".");
|
||||
General.Map.UndoRedo.CreateUndo("Paste " + rest);
|
||||
General.Interface.DisplayStatus(StatusType.Info, "Pasted " + rest);
|
||||
|
||||
PreActionNoChange();
|
||||
ClearSelection();
|
||||
General.Interface.DisplayStatus(StatusType.Info, "Pasted " + rest);
|
||||
|
||||
PreActionNoChange();
|
||||
ClearSelection();
|
||||
|
||||
//get translated positions
|
||||
Vector3D[] coords = new Vector3D[copyBuffer.Count];
|
||||
for (int i = 0; i < copyBuffer.Count; i++ )
|
||||
coords[i] = copyBuffer[i].Position;
|
||||
//get translated positions
|
||||
Vector3D[] coords = new Vector3D[copyBuffer.Count];
|
||||
for (int i = 0; i < copyBuffer.Count; i++ )
|
||||
coords[i] = copyBuffer[i].Position;
|
||||
|
||||
Vector3D[] translatedCoords = translateCoordinates(coords, hitpos, true);
|
||||
Vector3D[] translatedCoords = translateCoordinates(coords, hitpos, true);
|
||||
|
||||
//create things from copyBuffer
|
||||
for (int i = 0; i < copyBuffer.Count; i++) {
|
||||
Thing t = CreateThing(new Vector2D());
|
||||
if (t != null) {
|
||||
copyBuffer[i].ApplyTo(t);
|
||||
t.Move(translatedCoords[i]);
|
||||
//add thing to blockmap
|
||||
blockmap.AddThing(t);
|
||||
}
|
||||
}
|
||||
PostAction();
|
||||
}
|
||||
//create things from copyBuffer
|
||||
for (int i = 0; i < copyBuffer.Count; i++) {
|
||||
Thing t = CreateThing(new Vector2D());
|
||||
if (t != null) {
|
||||
copyBuffer[i].ApplyTo(t);
|
||||
t.Move(translatedCoords[i]);
|
||||
//add thing to blockmap
|
||||
blockmap.AddThing(t);
|
||||
}
|
||||
}
|
||||
PostAction();
|
||||
}
|
||||
|
||||
//mxd. rotate clockwise
|
||||
[BeginAction("rotatethingscw")]
|
||||
public void RotateCW() {
|
||||
//mxd. rotate clockwise
|
||||
[BeginAction("rotatethingscw")]
|
||||
public void RotateCW() {
|
||||
rotateThingsAndTextures(5);
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. rotate counterclockwise
|
||||
[BeginAction("rotatethingsccw")]
|
||||
public void RotateCCW() {
|
||||
//mxd. rotate counterclockwise
|
||||
[BeginAction("rotatethingsccw")]
|
||||
public void RotateCCW() {
|
||||
rotateThingsAndTextures(-5);
|
||||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
private void rotateThingsAndTextures(int increment) {
|
||||
|
@ -2660,14 +2660,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
PostAction();
|
||||
}
|
||||
|
||||
//mxd
|
||||
[BeginAction("togglegzdoomrenderingeffects")]
|
||||
public void ToggleGZDoomRenderingEffects() {
|
||||
gzdoomRenderingEffects = !gzdoomRenderingEffects;
|
||||
RebuildElementData();
|
||||
UpdateChangedObjects();
|
||||
General.Interface.DisplayStatus(StatusType.Info, "(G)ZDoom rendering effects are " + (gzdoomRenderingEffects ? "ENABLED" : "DISABLED"));
|
||||
}
|
||||
//mxd
|
||||
[BeginAction("togglegzdoomrenderingeffects")]
|
||||
public void ToggleGZDoomRenderingEffects() {
|
||||
gzdoomRenderingEffects = !gzdoomRenderingEffects;
|
||||
RebuildElementData();
|
||||
UpdateChangedObjects();
|
||||
General.Interface.DisplayStatus(StatusType.Info, "(G)ZDoom rendering effects are " + (gzdoomRenderingEffects ? "ENABLED" : "DISABLED"));
|
||||
}
|
||||
|
||||
//mxd
|
||||
[BeginAction("thingaligntowall")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue