mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
working on visual mode
This commit is contained in:
parent
7a081986f2
commit
569c95064c
2 changed files with 75 additions and 45 deletions
|
@ -380,6 +380,7 @@ moveforward
|
|||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
disregardshift = true;
|
||||
}
|
||||
|
||||
movebackward
|
||||
|
@ -390,6 +391,7 @@ movebackward
|
|||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
disregardshift = true;
|
||||
}
|
||||
|
||||
moveleft
|
||||
|
@ -400,6 +402,7 @@ moveleft
|
|||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
disregardshift = true;
|
||||
}
|
||||
|
||||
moveright
|
||||
|
@ -410,6 +413,18 @@ moveright
|
|||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
disregardshift = true;
|
||||
}
|
||||
|
||||
movedoublespeed
|
||||
{
|
||||
title = "Double Speed";
|
||||
category = "visual";
|
||||
description = "Double the movement speed for the Move actions in visual mode while holding this button.";
|
||||
allowkeys = true;
|
||||
allowmouse = true;
|
||||
allowscroll = true;
|
||||
disregardshift = true;
|
||||
}
|
||||
|
||||
testmap
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
private const float ANGLE_FROM_MOUSE = 0.0001f;
|
||||
public const float MAX_ANGLEZ_LOW = 100f / Angle2D.PIDEG;
|
||||
public const float MAX_ANGLEZ_HIGH = (360f - 100f) / Angle2D.PIDEG;
|
||||
private const float CAMERA_SPEED = 6f;
|
||||
private const double MOVE_SPEED_MULTIPLIER = 0.001d;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -72,6 +72,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
private bool keybackward;
|
||||
private bool keyleft;
|
||||
private bool keyright;
|
||||
private bool doublespeed;
|
||||
|
||||
// Map
|
||||
protected VisualBlockMap blockmap;
|
||||
|
@ -269,6 +270,18 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
{
|
||||
keyright = false;
|
||||
}
|
||||
|
||||
[BeginAction("movedoublespeed", BaseAction = true)]
|
||||
public virtual void BeginDoubleSpeed()
|
||||
{
|
||||
doublespeed = true;
|
||||
}
|
||||
|
||||
[EndAction("movedoublespeed", BaseAction = true)]
|
||||
public virtual void EndDoubleSpeed()
|
||||
{
|
||||
doublespeed = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -403,50 +416,6 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
|
||||
#endregion
|
||||
|
||||
#region ================== Processing
|
||||
|
||||
// This creates a visual sector
|
||||
protected abstract VisualSector CreateVisualSector(Sector s);
|
||||
|
||||
// This fills the blockmap
|
||||
protected virtual void FillBlockMap()
|
||||
{
|
||||
blockmap.AddLinedefsSet(General.Map.Map.Linedefs);
|
||||
}
|
||||
|
||||
// Processing
|
||||
public override void OnProcess(double deltatime)
|
||||
{
|
||||
Vector3D camvec;
|
||||
Vector3D camvecstrafe;
|
||||
|
||||
base.OnProcess(deltatime);
|
||||
|
||||
// Calculate camera direction vectors
|
||||
camvec = Vector3D.FromAngleXYZ(camanglexy, camanglez);
|
||||
camvecstrafe = Vector3D.FromAngleXY(camanglexy + Angle2D.PIHALF);
|
||||
|
||||
// Move the camera
|
||||
if(keyforward) campos += camvec * CAMERA_SPEED;
|
||||
if(keybackward) campos -= camvec * CAMERA_SPEED;
|
||||
if(keyleft) campos -= camvecstrafe * CAMERA_SPEED;
|
||||
if(keyright) campos += camvecstrafe * CAMERA_SPEED;
|
||||
|
||||
// Target the camera
|
||||
camtarget = campos + camvec;
|
||||
|
||||
// Apply new camera matrices
|
||||
renderer.PositionAndLookAt(campos, camtarget);
|
||||
|
||||
// Visibility culling
|
||||
DoCulling();
|
||||
|
||||
// Now redraw
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Object Picking
|
||||
|
||||
// This picks an object from the scene
|
||||
|
@ -593,6 +562,52 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
|
||||
#endregion
|
||||
|
||||
#region ================== Processing
|
||||
|
||||
// This creates a visual sector
|
||||
protected abstract VisualSector CreateVisualSector(Sector s);
|
||||
|
||||
// This fills the blockmap
|
||||
protected virtual void FillBlockMap()
|
||||
{
|
||||
blockmap.AddLinedefsSet(General.Map.Map.Linedefs);
|
||||
}
|
||||
|
||||
// Processing
|
||||
public override void OnProcess(double deltatime)
|
||||
{
|
||||
Vector3D camvec;
|
||||
Vector3D camvecstrafe;
|
||||
double multiplier;
|
||||
|
||||
base.OnProcess(deltatime);
|
||||
|
||||
// Calculate camera direction vectors
|
||||
camvec = Vector3D.FromAngleXYZ(camanglexy, camanglez);
|
||||
camvecstrafe = Vector3D.FromAngleXY(camanglexy + Angle2D.PIHALF);
|
||||
|
||||
// Move the camera
|
||||
if(doublespeed) multiplier = MOVE_SPEED_MULTIPLIER * 2.0f; else multiplier = MOVE_SPEED_MULTIPLIER;
|
||||
if(keyforward) campos += camvec * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime);
|
||||
if(keybackward) campos -= camvec * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime);
|
||||
if(keyleft) campos -= camvecstrafe * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime);
|
||||
if(keyright) campos += camvecstrafe * (float)((double)General.Settings.MoveSpeed * multiplier * deltatime);
|
||||
|
||||
// Target the camera
|
||||
camtarget = campos + camvec;
|
||||
|
||||
// Apply new camera matrices
|
||||
renderer.PositionAndLookAt(campos, camtarget);
|
||||
|
||||
// Visibility culling
|
||||
DoCulling();
|
||||
|
||||
// Now redraw
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Rendering
|
||||
|
||||
// Call this to simply render all visible sectors
|
||||
|
|
Loading…
Reference in a new issue