Added actions to move the camera up and down in 3D visual modes (no default keys bound)

@ more fixes for auto-aligning hi-res textures: now takes the WorldPanning flag into account
This commit is contained in:
boris_i 2010-05-08 13:14:48 +00:00
parent b1d34b1af5
commit 72d688f8d0
10 changed files with 63 additions and 9 deletions

View file

@ -42,13 +42,14 @@ namespace CodeImp.DoomBuilder.Data
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
// Constructor // Constructor
public HighResImage(string name, int width, int height, float scalex, float scaley) public HighResImage(string name, int width, int height, float scalex, float scaley, bool worldpanning)
{ {
// Initialize // Initialize
this.width = width; this.width = width;
this.height = height; this.height = height;
this.scale.x = scalex; this.scale.x = scalex;
this.scale.y = scaley; this.scale.y = scaley;
this.worldpanning = worldpanning;
this.patches = new List<TexturePatch>(); this.patches = new List<TexturePatch>();
SetName(name); SetName(name);

View file

@ -51,6 +51,7 @@ namespace CodeImp.DoomBuilder.Data
protected int width; protected int width;
protected int height; protected int height;
protected Vector2D scale; protected Vector2D scale;
protected bool worldpanning;
protected bool usecolorcorrection; protected bool usecolorcorrection;
// Loading // Loading
@ -96,6 +97,7 @@ namespace CodeImp.DoomBuilder.Data
public float ScaledWidth { get { return width * scale.x; } } public float ScaledWidth { get { return width * scale.x; } }
public float ScaledHeight { get { return height * scale.y; } } public float ScaledHeight { get { return height * scale.y; } }
public Vector2D Scale { get { return scale; } } public Vector2D Scale { get { return scale; } }
public bool WorldPanning { get { return worldpanning; } }
#endregion #endregion

View file

@ -1548,8 +1548,8 @@ namespace CodeImp.DoomBuilder.Geometry
public static void AutoAlignTextures(Sidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks) public static void AutoAlignTextures(Sidedef start, ImageData texture, bool alignx, bool aligny, bool resetsidemarks)
{ {
Stack<SidedefAlignJob> todo = new Stack<SidedefAlignJob>(50); Stack<SidedefAlignJob> todo = new Stack<SidedefAlignJob>(50);
float scalex = General.Map.Config.ScaledTextureOffsets ? texture.Scale.x : 1.0f; float scalex = (General.Map.Config.ScaledTextureOffsets && !texture.WorldPanning) ? texture.Scale.x : 1.0f;
float scaley = General.Map.Config.ScaledTextureOffsets ? texture.Scale.y : 1.0f; float scaley = (General.Map.Config.ScaledTextureOffsets && !texture.WorldPanning) ? texture.Scale.y : 1.0f;
// Mark all sidedefs false (they will be marked true when the texture is aligned) // Mark all sidedefs false (they will be marked true when the texture is aligned)
if(resetsidemarks) General.Map.Map.ClearMarkedSidedefs(false); if(resetsidemarks) General.Map.Map.ClearMarkedSidedefs(false);

View file

@ -419,6 +419,28 @@ moveright
disregardshift = true; disregardshift = true;
} }
moveup
{
title = "Move Up";
category = "visual";
description = "Moves the camera up in 3D Visual Mode.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
disregardshift = true;
}
movedown
{
title = "Move Down";
category = "visual";
description = "Moves the camera down in 3D Visual Mode.";
allowkeys = true;
allowmouse = true;
allowscroll = true;
disregardshift = true;
}
movedoublespeed movedoublespeed
{ {
title = "Double Speed"; title = "Double Speed";

View file

@ -67,6 +67,8 @@ namespace CodeImp.DoomBuilder.VisualModes
private bool keybackward; private bool keybackward;
private bool keyleft; private bool keyleft;
private bool keyright; private bool keyright;
private bool keyup;
private bool keydown;
private bool doublespeed; private bool doublespeed;
// Map // Map
@ -274,6 +276,30 @@ namespace CodeImp.DoomBuilder.VisualModes
keyright = false; keyright = false;
} }
[BeginAction("moveup", BaseAction = true)]
public virtual void BeginMoveUp()
{
keyup = true;
}
[EndAction("moveup", BaseAction = true)]
public virtual void EndMoveUp()
{
keyup = false;
}
[BeginAction("movedown", BaseAction = true)]
public virtual void BeginMoveDown()
{
keydown = true;
}
[EndAction("movedown", BaseAction = true)]
public virtual void EndMoveDown()
{
keydown = false;
}
[BeginAction("movedoublespeed", BaseAction = true)] [BeginAction("movedoublespeed", BaseAction = true)]
public virtual void BeginDoubleSpeed() public virtual void BeginDoubleSpeed()
{ {
@ -795,6 +821,7 @@ namespace CodeImp.DoomBuilder.VisualModes
Vector3D camvecstrafe = Vector3D.FromAngleXY(General.Map.VisualCamera.AngleXY + Angle2D.PIHALF); Vector3D camvecstrafe = Vector3D.FromAngleXY(General.Map.VisualCamera.AngleXY + Angle2D.PIHALF);
Vector3D cammovemul = General.Map.VisualCamera.MoveMultiplier; Vector3D cammovemul = General.Map.VisualCamera.MoveMultiplier;
Vector3D camdeltapos = new Vector3D(); Vector3D camdeltapos = new Vector3D();
Vector3D upvec = new Vector3D(0.0f, 0.0f, 1.0f);
// Move the camera // Move the camera
if(doublespeed) multiplier = MOVE_SPEED_MULTIPLIER * 2.0f; else multiplier = MOVE_SPEED_MULTIPLIER; if(doublespeed) multiplier = MOVE_SPEED_MULTIPLIER * 2.0f; else multiplier = MOVE_SPEED_MULTIPLIER;
@ -802,6 +829,8 @@ namespace CodeImp.DoomBuilder.VisualModes
if(keybackward) camdeltapos -= camvec * cammovemul * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime); if(keybackward) camdeltapos -= camvec * cammovemul * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime);
if(keyleft) camdeltapos -= camvecstrafe * cammovemul * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime); if(keyleft) camdeltapos -= camvecstrafe * cammovemul * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime);
if(keyright) camdeltapos += camvecstrafe * cammovemul * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime); if(keyright) camdeltapos += camvecstrafe * cammovemul * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime);
if(keyup) camdeltapos += upvec * cammovemul * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime);
if(keydown) camdeltapos += -upvec * cammovemul * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime);
// Move the camera // Move the camera
General.Map.VisualCamera.ProcessMovement(camdeltapos); General.Map.VisualCamera.ProcessMovement(camdeltapos);

View file

@ -267,7 +267,7 @@ namespace CodeImp.DoomBuilder.ZDoom
if(yscale == 0.0f) scaley = defaultscale; else scaley = 1f / yscale; if(yscale == 0.0f) scaley = defaultscale; else scaley = 1f / yscale;
// Make texture // Make texture
HighResImage tex = new HighResImage(name, width, height, scalex, scaley); HighResImage tex = new HighResImage(name, width, height, scalex, scaley, worldpanning);
// Add patches // Add patches
foreach(PatchStructure p in patches) foreach(PatchStructure p in patches)

View file

@ -114,7 +114,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
t2.y = t1.y + geoheight; t2.y = t1.y + geoheight;
// Apply texture offset // Apply texture offset
if (General.Map.Config.ScaledTextureOffsets) if (General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
{ {
t1 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y); t1 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
t2 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y); t2 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);

View file

@ -135,7 +135,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
t1.y = cliptop; t1.y = cliptop;
t2.y = tsz.y - clipbottom; t2.y = tsz.y - clipbottom;
if (General.Map.Config.ScaledTextureOffsets) if (General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
{ {
t1.x = Sidedef.OffsetX * base.Texture.Scale.x; t1.x = Sidedef.OffsetX * base.Texture.Scale.x;
} }

View file

@ -114,7 +114,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
t2.y = t1.y + geoheight; t2.y = t1.y + geoheight;
// Apply texture offset // Apply texture offset
if (General.Map.Config.ScaledTextureOffsets) if (General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
{ {
t1 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y); t1 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
t2 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y); t2 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);

View file

@ -114,7 +114,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
t2.y = t1.y + geoheight; t2.y = t1.y + geoheight;
// Apply texture offset // Apply texture offset
if (General.Map.Config.ScaledTextureOffsets) if (General.Map.Config.ScaledTextureOffsets && !base.Texture.WorldPanning)
{ {
t1 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y); t1 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);
t2 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y); t2 += new Vector2D(Sidedef.OffsetX * base.Texture.Scale.x, Sidedef.OffsetY * base.Texture.Scale.y);