Visual mode: added "Look Through Selection" action (default key is "Y"). This action places visual camera at the same position as selected/highlighted thing and rotates it to match thing's angle. Special handling is available if targeted thing is AimingCamera, MovingCamera or SecurityCamera.

Script editor: pressing "F1" now opens keyword help instead of program manual.
Linedef edit form, Thing edit form: rewritten script support logic. It should now work in the same manner as the rest of controls.
Thing info panel: thing arguments now have proper labels.
Edit forms, UDMF: fields, which are handled by UI, are no longer shown in "Custom" tab.
Visual mode: fixed a crash when loading a model on a video card without Shader model 2.0 support.
Fixed incorrect argument number and changed most of labels in "Cameras and interpolation" section of zdoom_things.cfg.
This commit is contained in:
MaxED 2013-08-08 11:04:13 +00:00
parent 0a5ff0bdaf
commit 724709e435
39 changed files with 798 additions and 1008 deletions

View file

@ -2647,6 +2647,102 @@ namespace CodeImp.DoomBuilder.BuilderModes
ShowTargetInfo();
}
//mxd
[BeginAction("lookthroughthing")]
public void LookThroughThing() {
List<VisualThing> visualThings = GetSelectedVisualThings(true);
if(visualThings.Count != 1) {
General.Interface.DisplayStatus(StatusType.Warning, "Look Through Selection action requires 1 selected Thing!");
return;
}
//set position and angles
Thing t = visualThings[0].Thing;
if((t.Type == 9072 || t.Type == 9073) && t.Args[3] > 0) { //AimingCamera or MovingCamera with target?
//position
if(t.Type == 9072 && (t.Args[0] > 0 || t.Args[1] > 0)) { //positon MovingCamera at targeted interpolation point
int ipTag = t.Args[0] + (t.Args[1] << 8);
Thing ip = null;
//find interpolation point
foreach(Thing tgt in General.Map.Map.Things) {
if(tgt.Tag == ipTag && tgt.Type == 9070) {
ip = tgt;
break;
}
}
if(ip != null) {
VisualThing vTarget = null;
if(!VisualThingExists(ip))
vTarget = CreateVisualThing(ip);
else
vTarget = GetVisualThing(ip);
Vector3D targetPos = new Vector3D();
if(vTarget == null) {
targetPos = ip.Position;
if(ip.Sector != null) targetPos.z += ip.Sector.FloorHeight;
} else {
targetPos = vTarget.CenterV3D;
}
General.Map.VisualCamera.Position = targetPos; //position at interpolation point
} else {
General.Map.VisualCamera.Position = visualThings[0].CenterV3D; //position at camera
}
}else{
General.Map.VisualCamera.Position = visualThings[0].CenterV3D; //position at camera
}
//angle
Thing target = null;
foreach(Thing tgt in General.Map.Map.Things) {
if(tgt.Tag == t.Args[3]) {
target = tgt;
break;
}
}
if (target == null) {
General.Interface.DisplayStatus(StatusType.Warning, "Camera target with Tag " + t.Args[3] + " does not exist!");
General.Map.VisualCamera.AngleXY = t.Angle - Angle2D.PI;
General.Map.VisualCamera.AngleZ = Angle2D.PI;
} else {
VisualThing vTarget = null;
if (!VisualThingExists(target))
vTarget = CreateVisualThing(target);
else
vTarget = GetVisualThing(target);
Vector3D targetPos = new Vector3D();
if(vTarget == null) {
targetPos = target.Position;
if(target.Sector != null) targetPos.z += target.Sector.FloorHeight;
} else {
targetPos = vTarget.CenterV3D;
}
bool pitch = (t.Args[2] & 4) != 0;
Vector3D delta = General.Map.VisualCamera.Position - targetPos;
General.Map.VisualCamera.AngleXY = delta.GetAngleXY();
General.Map.VisualCamera.AngleZ = pitch ? -delta.GetAngleZ() : Angle2D.PI;
}
} else if((t.Type == 9025 || t.Type == 9073) && t.Args[0] != 0) { //SecurityCamera or AimingCamera with pitch?
General.Map.VisualCamera.Position = visualThings[0].CenterV3D; //position at camera
General.Map.VisualCamera.AngleXY = t.Angle - Angle2D.PI;
General.Map.VisualCamera.AngleZ = Angle2D.PI + Angle2D.DegToRad(t.Args[0]);
} else { //nope, just a generic thing
General.Map.VisualCamera.Position = visualThings[0].CenterV3D; //position at thing
General.Map.VisualCamera.AngleXY = t.Angle - Angle2D.PI;
General.Map.VisualCamera.AngleZ = Angle2D.PI;
}
}
//mxd
[BeginAction("toggleslope")]
public void ToggleSlope() {