several fixes

This commit is contained in:
codeimp 2009-01-03 22:18:59 +00:00
parent 3dcf1c5268
commit d174544cd6
12 changed files with 71 additions and 18 deletions

View file

@ -3,9 +3,9 @@ quality over quantity. It is done when it's done.
The order and included items may also change any time.
=========================================================
- Make Directory Resources support
- Create menus for different modes
- Make PK3 Resources support
- Create gradient ceiling/floor heights feature
=========================================================
BETA TESTING STARTS HERE

View file

@ -394,6 +394,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update cached values
General.Map.Map.Update();
// Update the used textures
General.Map.Data.UpdateUsedTextures();
// Map is changed
General.Map.IsChanged = true;
}

View file

@ -333,6 +333,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
editpressed = true;
// Insert a new item and select it for dragging
General.Map.UndoRedo.CreateUndo("Insert thing");
Thing t = InsertThing(mousemappos);
General.Map.Map.ClearSelectedThings();
t.Selected = true;

View file

@ -197,8 +197,8 @@ namespace CodeImp.DoomBuilder.Data
LocalLoadImage();
// Anything changed?
if((oldwidth != width) || (oldheight != height) ||
(oldscaledwidth != scaledwidth) || (oldscaledheight != scaledheight))
//if((oldwidth != width) || (oldheight != height) ||
// (oldscaledwidth != scaledwidth) || (oldscaledheight != scaledheight))
{
// Notify the main thread about the change so that sectors can update their buffers
IntPtr strptr = Marshal.StringToCoTaskMemAuto(this.name);

View file

@ -85,6 +85,9 @@ namespace CodeImp.DoomBuilder.Editing
allmodes = new List<EditModeInfo>();
usedmodes = new List<EditModeInfo>();
// Bind any methods
General.Actions.BindMethods(this);
// Make list of all editing modes we can find
foreach(Plugin p in General.Plugins.Plugins)
{
@ -118,6 +121,9 @@ namespace CodeImp.DoomBuilder.Editing
// Not already disposed?
if(!isdisposed)
{
// Unbind any methods
General.Actions.UnbindMethods(this);
// Clean up
// Done

View file

@ -275,6 +275,7 @@ namespace CodeImp.DoomBuilder
renderer2d.SetViewMode((ViewMode)General.Settings.DefaultViewMode);
// Success
this.changed = false;
General.WriteLogLine("Map creation done");
return true;
}
@ -349,6 +350,7 @@ namespace CodeImp.DoomBuilder
data.Load(configinfo.Resources, options.Resources, maplocation);
// Update structures
map.SnapAllToAccuracy();
map.Update();
thingsfilter.Update();
@ -363,6 +365,7 @@ namespace CodeImp.DoomBuilder
if(General.Editing.Mode is ClassicMode) (General.Editing.Mode as ClassicMode).CenterInScreen();
// Success
this.changed = false;
General.WriteLogLine("Map loading done");
return true;
}
@ -1252,6 +1255,7 @@ namespace CodeImp.DoomBuilder
map.Dispose();
map = newmap;
map.UpdateConfiguration();
map.SnapAllToAccuracy();
map.Update();
thingsfilter.Update();
@ -1293,8 +1297,15 @@ namespace CodeImp.DoomBuilder
// Reload data resources
General.WriteLogLine("Reloading data resources...");
data = new DataManager();
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, false, false);
data.Load(configinfo.Resources, options.Resources, maplocation);
if(!string.IsNullOrEmpty(filepathname))
{
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, false, false);
data.Load(configinfo.Resources, options.Resources, maplocation);
}
else
{
data.Load(configinfo.Resources, options.Resources);
}
// Apply new settings to map elements
map.UpdateConfiguration();

View file

@ -468,6 +468,7 @@ namespace CodeImp.DoomBuilder.Map
// Update required (angle changed)
NeedUpdate();
General.Map.IsChanged = true;
}
// This flips the sidedefs
@ -477,6 +478,8 @@ namespace CodeImp.DoomBuilder.Map
Sidedef sd = front;
front = back;
back = sd;
General.Map.IsChanged = true;
}
// This returns a point for testing on one side
@ -521,6 +524,8 @@ namespace CodeImp.DoomBuilder.Map
flags[General.Map.Config.SingleSidedFlag] = true;
flags[General.Map.Config.DoubleSidedFlag] = false;
}
General.Map.IsChanged = true;
}
// This returns all points at which the line intersects with the grid
@ -697,6 +702,7 @@ namespace CodeImp.DoomBuilder.Map
}
// Return result
General.Map.IsChanged = true;
return nl;
}
@ -867,6 +873,7 @@ namespace CodeImp.DoomBuilder.Map
// I got killed by the other.
this.Dispose();
General.Map.IsChanged = true;
}
// This changes sidedefs (used for joining lines)

View file

@ -474,6 +474,8 @@ namespace CodeImp.DoomBuilder.Map
// Dispose manually
this.Dispose();
}
General.Map.IsChanged = true;
}
#endregion
@ -500,6 +502,7 @@ namespace CodeImp.DoomBuilder.Map
floortexname = name;
longfloortexname = Lump.MakeLongName(name);
updateneeded = true;
General.Map.IsChanged = true;
}
// This sets texture
@ -508,6 +511,7 @@ namespace CodeImp.DoomBuilder.Map
ceiltexname = name;
longceiltexname = Lump.MakeLongName(name);
updateneeded = true;
General.Map.IsChanged = true;
}
#endregion

View file

@ -241,6 +241,8 @@ namespace CodeImp.DoomBuilder.Map
s.offsetx = offsetx;
s.offsety = offsety;
}
General.Map.IsChanged = true;
}
#endregion
@ -254,18 +256,21 @@ namespace CodeImp.DoomBuilder.Map
{
this.texnamehigh = "-";
this.longtexnamehigh = MapSet.EmptyLongName;
General.Map.IsChanged = true;
}
if(!MiddleRequired() && removemiddle)
{
this.texnamemid = "-";
this.longtexnamemid = MapSet.EmptyLongName;
General.Map.IsChanged = true;
}
if(!LowRequired())
{
this.texnamelow = "-";
this.longtexnamelow = MapSet.EmptyLongName;
General.Map.IsChanged = true;
}
}
@ -326,6 +331,7 @@ namespace CodeImp.DoomBuilder.Map
{
texnamehigh = name;
longtexnamehigh = Lump.MakeLongName(name);
General.Map.IsChanged = true;
}
// This sets texture
@ -333,6 +339,7 @@ namespace CodeImp.DoomBuilder.Map
{
texnamemid = name;
longtexnamemid = Lump.MakeLongName(name);
General.Map.IsChanged = true;
}
// This sets texture
@ -340,6 +347,7 @@ namespace CodeImp.DoomBuilder.Map
{
texnamelow = name;
longtexnamelow = Lump.MakeLongName(name);
General.Map.IsChanged = true;
}
// This changes sector
@ -353,6 +361,8 @@ namespace CodeImp.DoomBuilder.Map
// Attach to sector
sectorlistitem = sector.AttachSidedef(this);
General.Map.IsChanged = true;
}
#endregion

View file

@ -315,6 +315,7 @@ namespace CodeImp.DoomBuilder.Map
{
// Change position
this.pos = newpos;
General.Map.IsChanged = true;
}
// This moves the thing
@ -323,6 +324,7 @@ namespace CodeImp.DoomBuilder.Map
{
// Change position
this.pos = new Vector3D(newpos.x, newpos.y, pos.z);
General.Map.IsChanged = true;
}
// This moves the thing
@ -331,6 +333,7 @@ namespace CodeImp.DoomBuilder.Map
{
// Change position
this.pos = new Vector3D(x, y, zoffset);
General.Map.IsChanged = true;
}
// This rotates the thing
@ -338,6 +341,7 @@ namespace CodeImp.DoomBuilder.Map
{
// Change angle
this.angle = newangle;
General.Map.IsChanged = true;
}
// This updates all properties

View file

@ -188,19 +188,24 @@ namespace CodeImp.DoomBuilder.Map
// This moves the vertex
public void Move(Vector2D newpos)
{
// Change position
pos = newpos;
#if DEBUG
if(float.IsNaN(pos.x) || float.IsNaN(pos.y) ||
float.IsInfinity(pos.x) || float.IsInfinity(pos.y))
// Do we actually move?
if(newpos != pos)
{
General.Fail("Invalid vertex position! The given vertex coordinates cannot be NaN or Infinite.");
// Change position
pos = newpos;
#if DEBUG
if(float.IsNaN(pos.x) || float.IsNaN(pos.y) ||
float.IsInfinity(pos.x) || float.IsInfinity(pos.y))
{
General.Fail("Invalid vertex position! The given vertex coordinates cannot be NaN or Infinite.");
}
#endif
// Let all lines know they need an update
foreach(Linedef l in linedefs) l.NeedUpdate();
General.Map.IsChanged = true;
}
#endif
// Let all lines know they need an update
foreach(Linedef l in linedefs) l.NeedUpdate();
}
// This snaps the vertex to the map format accuracy
@ -247,6 +252,8 @@ namespace CodeImp.DoomBuilder.Map
// Dispose manually
this.Dispose();
}
General.Map.IsChanged = true;
}
#endregion

View file

@ -2029,7 +2029,7 @@ namespace CodeImp.DoomBuilder.Windows
case (int)ThreadMessages.ImageDataLoaded:
string imagename = Marshal.PtrToStringAuto(m.WParam);
Marshal.FreeCoTaskMem(m.WParam);
if(General.Map != null)
if((General.Map != null) && (General.Map.Data != null))
{
ImageData img = General.Map.Data.GetFlatImage(imagename);
if(img != null) ImageDataLoaded(img);