mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-31 04:40:55 +00:00
fixed Visual Mode camera placement with shortcut and changed camera-from-thing positioning logic a bit
This commit is contained in:
parent
1f016fc7dc
commit
94c62a34a2
2 changed files with 26 additions and 12 deletions
|
@ -131,7 +131,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
[BeginAction("placevisualstart")]
|
||||
public void PlaceVisualStartThing()
|
||||
{
|
||||
bool onefound = false;
|
||||
Thing thingfound = null;
|
||||
|
||||
// Not during volatile mode
|
||||
if(this.Attributes.Volatile) return;
|
||||
|
@ -145,11 +145,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
if(t.Type == General.Map.Config.Start3DModeThingType)
|
||||
{
|
||||
if(!onefound)
|
||||
if(thingfound == null)
|
||||
{
|
||||
// Move this thing
|
||||
t.Move(mousemappos);
|
||||
onefound = true;
|
||||
thingfound = t;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -160,7 +160,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
// No thing found?
|
||||
if(!onefound)
|
||||
if(thingfound == null)
|
||||
{
|
||||
// Make a new one
|
||||
Thing t = General.Map.Map.CreateThing();
|
||||
|
@ -168,8 +168,22 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
t.Move(mousemappos);
|
||||
t.UpdateConfiguration();
|
||||
General.Map.ThingsFilter.Update();
|
||||
thingfound = t;
|
||||
}
|
||||
|
||||
// Make sure that the found thing is between ceiling and floor
|
||||
thingfound.DetermineSector();
|
||||
if(thingfound.Position.z < 0.0f) thingfound.Move(thingfound.Position.x, thingfound.Position.y, 0.0f);
|
||||
if(thingfound.Sector != null)
|
||||
{
|
||||
if((thingfound.Position.z + 50.0f) > (thingfound.Sector.CeilHeight - thingfound.Sector.FloorHeight))
|
||||
thingfound.Move(thingfound.Position.x, thingfound.Position.y,
|
||||
thingfound.Sector.CeilHeight - thingfound.Sector.FloorHeight - 50.0f);
|
||||
}
|
||||
|
||||
// Update Visual Mode camera
|
||||
General.Map.VisualCamera.PositionAtThing();
|
||||
|
||||
// Redraw display to show changes
|
||||
General.Interface.RedrawDisplay();
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
|
||||
// This applies the position and angle from the 3D Camera Thing
|
||||
// Returns false when it couldn't find a 3D Camera Thing
|
||||
public bool PositionAtThing()
|
||||
public virtual bool PositionAtThing()
|
||||
{
|
||||
Thing modething = null;
|
||||
|
||||
|
@ -105,13 +105,13 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
// Found one?
|
||||
if(modething != null)
|
||||
{
|
||||
int z = 0;
|
||||
if(sector != null)
|
||||
z = (int)position.z - sector.FloorHeight;
|
||||
|
||||
// Position camera here
|
||||
modething.DetermineSector();
|
||||
position = modething.Position + new Vector3D(0.0f, 0.0f, 96.0f);
|
||||
float z = modething.Position.z;
|
||||
if(modething.Sector != null)
|
||||
z = modething.Position.z + (float)modething.Sector.FloorHeight;
|
||||
|
||||
// Position camera here
|
||||
position = new Vector3D(modething.Position.x, modething.Position.y, z + 41.0f);
|
||||
anglexy = modething.Angle + Angle2D.PI;
|
||||
anglez = Angle2D.PI;
|
||||
return true;
|
||||
|
@ -124,7 +124,7 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
|
||||
// This applies the camera position and angle to the 3D Camera Thing
|
||||
// Returns false when it couldn't find a 3D Camera Thing
|
||||
public bool ApplyToThing()
|
||||
public virtual bool ApplyToThing()
|
||||
{
|
||||
Thing modething = null;
|
||||
|
||||
|
|
Loading…
Reference in a new issue