2008-05-15 08:25:45 +00:00
|
|
|
|
|
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
|
|
* This program is released under GNU General Public License
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.Text;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
using System.IO;
|
|
|
|
using System.Reflection;
|
2008-05-29 11:54:45 +00:00
|
|
|
using CodeImp.DoomBuilder.Windows;
|
2008-05-15 08:25:45 +00:00
|
|
|
using CodeImp.DoomBuilder.IO;
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
|
|
|
using CodeImp.DoomBuilder.Editing;
|
2008-09-28 21:20:56 +00:00
|
|
|
using CodeImp.DoomBuilder.Actions;
|
2008-11-19 16:18:36 +00:00
|
|
|
using CodeImp.DoomBuilder.VisualModes;
|
2008-05-15 08:25:45 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2008-11-27 13:42:18 +00:00
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
2008-05-15 08:25:45 +00:00
|
|
|
{
|
2008-11-27 13:42:18 +00:00
|
|
|
[EditMode(DisplayName = "Visual Mode",
|
|
|
|
SwitchAction = "visualmode", // Action name used to switch to this mode
|
2008-05-15 08:25:45 +00:00
|
|
|
ButtonImage = "VisualMode.png", // Image resource name for the button
|
2008-11-27 19:25:13 +00:00
|
|
|
ButtonOrder = 0, // Position of the button (lower is more to the left)
|
2009-01-27 15:44:45 +00:00
|
|
|
ButtonGroup = "001_visual",
|
2008-11-27 19:25:13 +00:00
|
|
|
UseByDefault = true)]
|
2008-05-15 08:25:45 +00:00
|
|
|
|
|
|
|
public class BaseVisualMode : VisualMode
|
|
|
|
{
|
|
|
|
#region ================== Constants
|
2008-12-02 15:47:06 +00:00
|
|
|
|
2008-12-31 00:44:04 +00:00
|
|
|
// Object picking
|
2008-12-04 22:35:45 +00:00
|
|
|
private const double PICK_INTERVAL = 100.0d;
|
|
|
|
private const float PICK_RANGE = 0.98f;
|
2008-12-31 00:44:04 +00:00
|
|
|
|
|
|
|
// Gravity
|
|
|
|
private const float GRAVITY = -0.06f;
|
|
|
|
private const float CAMERA_FLOOR_OFFSET = 41f; // same as in doom
|
|
|
|
private const float CAMERA_CEILING_OFFSET = 10f;
|
2008-12-02 15:47:06 +00:00
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
#endregion
|
2008-12-02 15:47:06 +00:00
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
#region ================== Variables
|
2008-12-02 15:47:06 +00:00
|
|
|
|
|
|
|
// Object picking
|
|
|
|
private VisualPickResult target;
|
|
|
|
private double lastpicktime;
|
2008-12-05 06:52:20 +00:00
|
|
|
private bool locktarget;
|
2008-12-02 15:47:06 +00:00
|
|
|
|
2008-12-31 00:44:04 +00:00
|
|
|
// Gravity vector
|
|
|
|
private Vector3D gravity;
|
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
#endregion
|
2008-12-02 15:47:06 +00:00
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
#region ================== Properties
|
|
|
|
|
2009-01-12 22:00:31 +00:00
|
|
|
public IRenderer3D Renderer { get { return renderer; } }
|
2008-12-27 00:22:31 +00:00
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
#endregion
|
2008-12-02 15:47:06 +00:00
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
public BaseVisualMode()
|
|
|
|
{
|
|
|
|
// Initialize
|
2008-12-31 00:44:04 +00:00
|
|
|
this.gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
2008-05-15 08:25:45 +00:00
|
|
|
|
|
|
|
// We have no destructor
|
|
|
|
GC.SuppressFinalize(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Disposer
|
|
|
|
public override void Dispose()
|
|
|
|
{
|
|
|
|
// Not already disposed?
|
|
|
|
if(!isdisposed)
|
|
|
|
{
|
|
|
|
// Clean up
|
|
|
|
|
|
|
|
// Done
|
|
|
|
base.Dispose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
2008-12-02 15:47:06 +00:00
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
#region ================== Methods
|
2008-12-02 15:47:06 +00:00
|
|
|
|
2008-11-25 21:54:50 +00:00
|
|
|
// This creates a visual sector
|
|
|
|
protected override VisualSector CreateVisualSector(Sector s)
|
2008-09-28 21:20:56 +00:00
|
|
|
{
|
2008-12-17 10:58:57 +00:00
|
|
|
BaseVisualSector vs = new BaseVisualSector(this, s);
|
2008-12-10 16:00:34 +00:00
|
|
|
return vs;
|
2008-09-28 21:20:56 +00:00
|
|
|
}
|
|
|
|
|
2008-12-09 15:45:24 +00:00
|
|
|
// This creates a visual thing
|
|
|
|
protected override VisualThing CreateVisualThing(Thing t)
|
|
|
|
{
|
2008-12-17 10:58:57 +00:00
|
|
|
BaseVisualThing vt = new BaseVisualThing(this, t);
|
2008-12-10 16:00:34 +00:00
|
|
|
if(vt.Setup()) return vt; else return null;
|
2008-12-09 15:45:24 +00:00
|
|
|
}
|
|
|
|
|
2008-12-05 06:52:20 +00:00
|
|
|
// This locks the target so that it isn't changed until unlocked
|
|
|
|
public void LockTarget()
|
|
|
|
{
|
|
|
|
locktarget = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// This unlocks the target so that is changes to the aimed geometry again
|
|
|
|
public void UnlockTarget()
|
|
|
|
{
|
|
|
|
locktarget = false;
|
|
|
|
}
|
|
|
|
|
2008-12-17 15:30:50 +00:00
|
|
|
// This picks a new target, if not locked
|
|
|
|
private void PickTargetUnlocked()
|
|
|
|
{
|
|
|
|
if(!locktarget) PickTarget();
|
|
|
|
}
|
|
|
|
|
2008-12-02 15:47:06 +00:00
|
|
|
// This picks a new target
|
|
|
|
private void PickTarget()
|
|
|
|
{
|
2008-12-03 07:04:57 +00:00
|
|
|
// Find the object we are aiming at
|
2009-01-10 00:26:24 +00:00
|
|
|
Vector3D start = General.Map.VisualCamera.Position;
|
|
|
|
Vector3D delta = General.Map.VisualCamera.Target - General.Map.VisualCamera.Position;
|
2008-12-04 22:35:45 +00:00
|
|
|
delta = delta.GetFixedLength(General.Settings.ViewDistance * PICK_RANGE);
|
2008-12-02 15:47:06 +00:00
|
|
|
VisualPickResult newtarget = PickObject(start, start + delta);
|
|
|
|
|
2009-01-04 13:19:18 +00:00
|
|
|
// Should we update the info on panels?
|
|
|
|
bool updateinfo = (newtarget.picked != target.picked);
|
2008-12-02 15:47:06 +00:00
|
|
|
|
|
|
|
// Apply new target
|
|
|
|
target = newtarget;
|
2009-01-04 13:19:18 +00:00
|
|
|
|
|
|
|
// Show target info
|
|
|
|
if(updateinfo) ShowTargetInfo();
|
2008-12-02 15:47:06 +00:00
|
|
|
}
|
2009-01-04 11:43:13 +00:00
|
|
|
|
|
|
|
// This shows the picked target information
|
2009-01-04 12:27:06 +00:00
|
|
|
public void ShowTargetInfo()
|
2009-01-04 11:43:13 +00:00
|
|
|
{
|
|
|
|
// Any result?
|
|
|
|
if(target.picked != null)
|
|
|
|
{
|
|
|
|
// Geometry picked?
|
|
|
|
if(target.picked is VisualGeometry)
|
|
|
|
{
|
|
|
|
VisualGeometry pickedgeo = (target.picked as VisualGeometry);
|
|
|
|
|
|
|
|
if(pickedgeo.Sidedef != null)
|
|
|
|
General.Interface.ShowLinedefInfo(pickedgeo.Sidedef.Line);
|
|
|
|
else if(pickedgeo.Sidedef == null)
|
|
|
|
General.Interface.ShowSectorInfo(pickedgeo.Sector.Sector);
|
|
|
|
else
|
|
|
|
General.Interface.HideInfo();
|
|
|
|
}
|
|
|
|
// Thing picked?
|
|
|
|
if(target.picked is VisualThing)
|
|
|
|
{
|
|
|
|
VisualThing pickedthing = (target.picked as VisualThing);
|
|
|
|
General.Interface.ShowThingInfo(pickedthing.Thing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
General.Interface.HideInfo();
|
|
|
|
}
|
|
|
|
}
|
2008-12-10 16:00:34 +00:00
|
|
|
|
2008-12-02 15:47:06 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Events
|
|
|
|
|
|
|
|
// Processing
|
|
|
|
public override void OnProcess(double deltatime)
|
|
|
|
{
|
2008-12-15 22:13:24 +00:00
|
|
|
// Process things?
|
|
|
|
base.ProcessThings = (BuilderPlug.Me.ShowVisualThings != 0);
|
|
|
|
|
2008-12-31 00:44:04 +00:00
|
|
|
// Setup the move multiplier depending on gravity
|
|
|
|
Vector3D movemultiplier = new Vector3D(1.0f, 1.0f, 1.0f);
|
|
|
|
if(BuilderPlug.Me.UseGravity) movemultiplier.z = 0.0f;
|
2009-01-10 00:26:24 +00:00
|
|
|
General.Map.VisualCamera.MoveMultiplier = movemultiplier;
|
2008-12-31 00:44:04 +00:00
|
|
|
|
|
|
|
// Apply gravity?
|
2009-01-10 00:26:24 +00:00
|
|
|
if(BuilderPlug.Me.UseGravity && (General.Map.VisualCamera.Sector != null))
|
2008-12-31 00:44:04 +00:00
|
|
|
{
|
|
|
|
// Camera below floor level?
|
2009-01-10 00:26:24 +00:00
|
|
|
if(General.Map.VisualCamera.Position.z <= (General.Map.VisualCamera.Sector.FloorHeight + CAMERA_FLOOR_OFFSET + 0.1f))
|
2008-12-31 00:44:04 +00:00
|
|
|
{
|
|
|
|
// Stay above floor
|
|
|
|
gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
2009-01-10 00:26:24 +00:00
|
|
|
General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
|
|
|
|
General.Map.VisualCamera.Position.y,
|
|
|
|
General.Map.VisualCamera.Sector.FloorHeight + CAMERA_FLOOR_OFFSET);
|
2008-12-31 00:44:04 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Fall down
|
|
|
|
gravity += new Vector3D(0.0f, 0.0f, (float)(GRAVITY * deltatime));
|
2009-01-10 00:26:24 +00:00
|
|
|
General.Map.VisualCamera.Position += gravity;
|
2008-12-31 00:44:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Camera above ceiling level?
|
2009-01-10 00:26:24 +00:00
|
|
|
if(General.Map.VisualCamera.Position.z >= (General.Map.VisualCamera.Sector.CeilHeight - CAMERA_CEILING_OFFSET - 0.1f))
|
2008-12-31 00:44:04 +00:00
|
|
|
{
|
|
|
|
// Stay below ceiling
|
2009-01-10 00:26:24 +00:00
|
|
|
General.Map.VisualCamera.Position = new Vector3D(General.Map.VisualCamera.Position.x,
|
|
|
|
General.Map.VisualCamera.Position.y,
|
|
|
|
General.Map.VisualCamera.Sector.CeilHeight - CAMERA_CEILING_OFFSET);
|
2008-12-31 00:44:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gravity = new Vector3D(0.0f, 0.0f, 0.0f);
|
|
|
|
}
|
|
|
|
|
2008-12-02 15:47:06 +00:00
|
|
|
// Do processing
|
|
|
|
base.OnProcess(deltatime);
|
2009-01-09 22:37:11 +00:00
|
|
|
|
|
|
|
// Process visible geometry
|
|
|
|
foreach(IVisualEventReceiver g in visiblegeometry)
|
|
|
|
{
|
|
|
|
g.OnProcess(deltatime);
|
|
|
|
}
|
2008-12-02 15:47:06 +00:00
|
|
|
|
|
|
|
// Time to pick a new target?
|
|
|
|
if(General.Clock.CurrentTime > (lastpicktime + PICK_INTERVAL))
|
|
|
|
{
|
2008-12-17 15:30:50 +00:00
|
|
|
PickTargetUnlocked();
|
2008-12-02 15:47:06 +00:00
|
|
|
lastpicktime = General.Clock.CurrentTime;
|
|
|
|
}
|
2008-12-17 19:35:00 +00:00
|
|
|
|
|
|
|
// The mouse is always in motion
|
|
|
|
MouseEventArgs args = new MouseEventArgs(General.Interface.MouseButtons, 0, 0, 0, 0);
|
|
|
|
OnMouseMove(args);
|
2008-12-02 15:47:06 +00:00
|
|
|
}
|
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
// This draws a frame
|
|
|
|
public override void OnRedrawDisplay()
|
|
|
|
{
|
|
|
|
// Start drawing
|
|
|
|
if(renderer.Start())
|
|
|
|
{
|
2008-12-04 22:35:45 +00:00
|
|
|
// Use fog!
|
|
|
|
renderer.SetFogMode(true);
|
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
// Begin with geometry
|
|
|
|
renderer.StartGeometry();
|
2008-12-15 22:13:24 +00:00
|
|
|
|
|
|
|
// Render all visible sectors
|
|
|
|
foreach(VisualGeometry g in visiblegeometry)
|
|
|
|
renderer.AddSectorGeometry(g);
|
|
|
|
|
|
|
|
if(BuilderPlug.Me.ShowVisualThings != 0)
|
|
|
|
{
|
|
|
|
// Render things in cages?
|
|
|
|
renderer.DrawThingCages = ((BuilderPlug.Me.ShowVisualThings & 2) != 0);
|
|
|
|
|
|
|
|
// Render all visible things
|
|
|
|
foreach(VisualThing t in visiblethings)
|
|
|
|
renderer.AddThingGeometry(t);
|
|
|
|
}
|
2008-12-02 15:47:06 +00:00
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
// Done rendering geometry
|
|
|
|
renderer.FinishGeometry();
|
2008-12-02 15:47:06 +00:00
|
|
|
|
2008-12-03 07:04:57 +00:00
|
|
|
// Render crosshair
|
|
|
|
renderer.RenderCrosshair();
|
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
// Present!
|
|
|
|
renderer.Finish();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-10 22:58:58 +00:00
|
|
|
// After resources were reloaded
|
|
|
|
protected override void ResourcesReloaded()
|
2008-12-06 13:20:47 +00:00
|
|
|
{
|
2008-12-10 22:58:58 +00:00
|
|
|
base.ResourcesReloaded();
|
2008-12-06 13:20:47 +00:00
|
|
|
PickTarget();
|
|
|
|
}
|
2008-12-10 22:58:58 +00:00
|
|
|
|
2008-12-17 15:30:50 +00:00
|
|
|
// Mouse moves
|
|
|
|
public override void OnMouseMove(MouseEventArgs e)
|
|
|
|
{
|
|
|
|
base.OnMouseMove(e);
|
2008-12-17 19:35:00 +00:00
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnMouseMove(e);
|
2008-12-17 15:30:50 +00:00
|
|
|
}
|
|
|
|
|
2008-05-15 08:25:45 +00:00
|
|
|
#endregion
|
2008-12-05 06:52:20 +00:00
|
|
|
|
|
|
|
#region ================== Actions
|
2009-01-04 11:59:24 +00:00
|
|
|
|
2008-12-05 06:52:20 +00:00
|
|
|
[BeginAction("visualselect", BaseAction = true)]
|
|
|
|
public void BeginSelect()
|
|
|
|
{
|
2008-12-17 15:30:50 +00:00
|
|
|
PickTargetUnlocked();
|
2008-12-15 18:32:36 +00:00
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectBegin();
|
2008-12-05 06:52:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[EndAction("visualselect", BaseAction = true)]
|
|
|
|
public void EndSelect()
|
|
|
|
{
|
2008-12-15 18:32:36 +00:00
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectEnd();
|
2008-12-05 06:52:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("visualedit", BaseAction = true)]
|
|
|
|
public void BeginEdit()
|
|
|
|
{
|
2008-12-17 15:30:50 +00:00
|
|
|
PickTargetUnlocked();
|
2008-12-15 18:32:36 +00:00
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnEditBegin();
|
2008-12-05 06:52:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[EndAction("visualedit", BaseAction = true)]
|
|
|
|
public void EndEdit()
|
|
|
|
{
|
2008-12-15 18:32:36 +00:00
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnEditEnd();
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-05 06:52:20 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 00:28:49 +00:00
|
|
|
[BeginAction("raisesector8")]
|
|
|
|
public void RaiseSector8()
|
|
|
|
{
|
2008-12-17 15:30:50 +00:00
|
|
|
PickTargetUnlocked();
|
2008-12-24 14:21:54 +00:00
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetHeight(8);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-06 00:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("lowersector8")]
|
|
|
|
public void LowerSector8()
|
|
|
|
{
|
2008-12-17 15:30:50 +00:00
|
|
|
PickTargetUnlocked();
|
2008-12-24 14:21:54 +00:00
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetHeight(-8);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-06 00:28:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("raisesector1")]
|
|
|
|
public void RaiseSector1()
|
|
|
|
{
|
2008-12-17 15:30:50 +00:00
|
|
|
PickTargetUnlocked();
|
2008-12-24 14:21:54 +00:00
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetHeight(1);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-06 00:28:49 +00:00
|
|
|
}
|
2008-12-17 15:30:50 +00:00
|
|
|
|
2008-12-06 00:28:49 +00:00
|
|
|
[BeginAction("lowersector1")]
|
|
|
|
public void LowerSector1()
|
|
|
|
{
|
2008-12-17 15:30:50 +00:00
|
|
|
PickTargetUnlocked();
|
2008-12-24 14:21:54 +00:00
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetHeight(-1);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-06 00:28:49 +00:00
|
|
|
}
|
2008-12-15 22:13:24 +00:00
|
|
|
|
|
|
|
[BeginAction("showvisualthings")]
|
|
|
|
public void ShowVisualThings()
|
|
|
|
{
|
|
|
|
BuilderPlug.Me.ShowVisualThings++;
|
|
|
|
if(BuilderPlug.Me.ShowVisualThings > 2) BuilderPlug.Me.ShowVisualThings = 0;
|
|
|
|
}
|
2008-12-24 14:21:54 +00:00
|
|
|
|
|
|
|
[BeginAction("raisebrightness8")]
|
|
|
|
public void RaiseBrightness8()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetBrightness(8);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-24 14:21:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("lowerbrightness8")]
|
|
|
|
public void LowerBrightness8()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTargetBrightness(-8);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-24 14:21:54 +00:00
|
|
|
}
|
2008-12-24 18:27:13 +00:00
|
|
|
|
|
|
|
[BeginAction("movetextureleft")]
|
2009-01-09 22:45:29 +00:00
|
|
|
public void MoveTextureLeft1()
|
2008-12-24 18:27:13 +00:00
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTextureOffset(-1, 0);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-24 18:27:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("movetextureright")]
|
2009-01-09 22:45:29 +00:00
|
|
|
public void MoveTextureRight1()
|
2008-12-24 18:27:13 +00:00
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTextureOffset(1, 0);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-24 18:27:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("movetextureup")]
|
2009-01-09 22:45:29 +00:00
|
|
|
public void MoveTextureUp1()
|
2008-12-24 18:27:13 +00:00
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTextureOffset(0, -1);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-24 18:27:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("movetexturedown")]
|
2009-01-09 22:45:29 +00:00
|
|
|
public void MoveTextureDown1()
|
2008-12-24 18:27:13 +00:00
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTextureOffset(0, 1);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-24 18:27:13 +00:00
|
|
|
}
|
2008-12-27 00:22:31 +00:00
|
|
|
|
2009-01-09 22:45:29 +00:00
|
|
|
[BeginAction("movetextureleft8")]
|
|
|
|
public void MoveTextureLeft8()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTextureOffset(-8, 0);
|
|
|
|
ShowTargetInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("movetextureright8")]
|
|
|
|
public void MoveTextureRight8()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTextureOffset(8, 0);
|
|
|
|
ShowTargetInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("movetextureup8")]
|
|
|
|
public void MoveTextureUp8()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTextureOffset(0, -8);
|
|
|
|
ShowTargetInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("movetexturedown8")]
|
|
|
|
public void MoveTextureDown8()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnChangeTextureOffset(0, 8);
|
|
|
|
ShowTargetInfo();
|
|
|
|
}
|
|
|
|
|
2008-12-27 00:22:31 +00:00
|
|
|
[BeginAction("textureselect")]
|
|
|
|
public void TextureSelect()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
renderer.SetCrosshairBusy(true);
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnSelectTexture();
|
|
|
|
renderer.SetCrosshairBusy(false);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-27 00:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("texturecopy")]
|
|
|
|
public void TextureCopy()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnCopyTexture();
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-27 00:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("texturepaste")]
|
|
|
|
public void TexturePaste()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnPasteTexture();
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-27 00:22:31 +00:00
|
|
|
}
|
2008-12-31 00:44:04 +00:00
|
|
|
|
|
|
|
[BeginAction("visualautoalignx")]
|
|
|
|
public void TextureAutoAlignX()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
renderer.SetCrosshairBusy(true);
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnTextureAlign(true, false);
|
|
|
|
renderer.SetCrosshairBusy(false);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-31 00:44:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("visualautoaligny")]
|
|
|
|
public void TextureAutoAlignY()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
renderer.SetCrosshairBusy(true);
|
|
|
|
General.Interface.RedrawDisplay();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnTextureAlign(false, true);
|
|
|
|
renderer.SetCrosshairBusy(false);
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-31 00:44:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("toggleupperunpegged")]
|
|
|
|
public void ToggleUpperUnpegged()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnToggleUpperUnpegged();
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-31 00:44:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("togglelowerunpegged")]
|
|
|
|
public void ToggleLowerUnpegged()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnToggleLowerUnpegged();
|
2009-01-04 12:27:06 +00:00
|
|
|
ShowTargetInfo();
|
2008-12-31 00:44:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("togglegravity")]
|
|
|
|
public void ToggleGravity()
|
|
|
|
{
|
|
|
|
BuilderPlug.Me.UseGravity = !BuilderPlug.Me.UseGravity;
|
|
|
|
}
|
2009-01-04 11:59:24 +00:00
|
|
|
|
|
|
|
[BeginAction("togglebrightness")]
|
|
|
|
public void ToggleBrightness()
|
|
|
|
{
|
|
|
|
renderer.FullBrightness = !renderer.FullBrightness;
|
|
|
|
}
|
2009-01-04 18:51:32 +00:00
|
|
|
|
|
|
|
[BeginAction("resettexture")]
|
|
|
|
public void ResetTexture()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnResetTextureOffset();
|
|
|
|
ShowTargetInfo();
|
|
|
|
}
|
2009-01-12 22:00:31 +00:00
|
|
|
|
|
|
|
[BeginAction("floodfilltextures")]
|
|
|
|
public void FloodfillTextures()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnTextureFloodfill();
|
|
|
|
ShowTargetInfo();
|
|
|
|
}
|
2009-02-16 15:54:57 +00:00
|
|
|
|
|
|
|
[BeginAction("texturecopyoffsets")]
|
|
|
|
public void TextureCopyOffsets()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnCopyTextureOffsets();
|
|
|
|
ShowTargetInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("texturepasteoffsets")]
|
|
|
|
public void TexturePasteOffsets()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnPasteTextureOffsets();
|
|
|
|
ShowTargetInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("copyproperties")]
|
|
|
|
public void CopyProperties()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnCopyProperties();
|
|
|
|
ShowTargetInfo();
|
|
|
|
}
|
|
|
|
|
|
|
|
[BeginAction("pasteproperties")]
|
|
|
|
public void PasteProperties()
|
|
|
|
{
|
|
|
|
PickTargetUnlocked();
|
|
|
|
if(target.picked != null) (target.picked as IVisualEventReceiver).OnPasteProperties();
|
|
|
|
ShowTargetInfo();
|
|
|
|
}
|
2008-12-06 00:28:49 +00:00
|
|
|
|
2008-12-05 06:52:20 +00:00
|
|
|
#endregion
|
2008-05-15 08:25:45 +00:00
|
|
|
}
|
|
|
|
}
|