mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
@ Fixed a bug in the new way the Things are rendered
Removed code that crashed the script editor and I had no better solution (it was unused code anyway)
This commit is contained in:
parent
8ffd94af92
commit
a8322b7d45
2 changed files with 32 additions and 28 deletions
|
@ -2450,13 +2450,13 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
break;
|
||||
|
||||
case (uint)ScintillaEvents.UserlistSelection:
|
||||
if(UserListSelection != null)
|
||||
UserListSelection(this, scn.listType, System.Runtime.InteropServices.Marshal.PtrToStringAuto(scn.text));
|
||||
//if(UserListSelection != null)
|
||||
// UserListSelection(this, scn.listType, System.Runtime.InteropServices.Marshal.PtrToStringAuto(scn.text));
|
||||
break;
|
||||
|
||||
case (uint)ScintillaEvents.UriDropped:
|
||||
if(URIDropped != null)
|
||||
URIDropped(this, System.Runtime.InteropServices.Marshal.PtrToStringAuto(scn.text));
|
||||
//if(URIDropped != null)
|
||||
// URIDropped(this, System.Runtime.InteropServices.Marshal.PtrToStringAuto(scn.text));
|
||||
break;
|
||||
|
||||
case (uint)ScintillaEvents.DwellStart:
|
||||
|
@ -2525,8 +2525,20 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
if(BeforeDelete != null)
|
||||
BeforeDelete(this, scn.position, scn.length);
|
||||
|
||||
if(Modified != null)
|
||||
Modified(this, scn.position, scn.modificationType, System.Runtime.InteropServices.Marshal.PtrToStringAuto(scn.text), scn.length, scn.linesAdded, scn.line, scn.foldLevelNow, scn.foldLevelPrev);
|
||||
if(Modified != null)
|
||||
{
|
||||
string textstr = null;
|
||||
try
|
||||
{
|
||||
textstr = System.Runtime.InteropServices.Marshal.PtrToStringAuto(scn.text);
|
||||
}
|
||||
catch(IndexOutOfRangeException e)
|
||||
{
|
||||
// I don't know why this is happening, but I don't need the text here anyways
|
||||
}
|
||||
|
||||
Modified(this, scn.position, scn.modificationType, textstr, scn.length, scn.linesAdded, scn.line, scn.foldLevelNow, scn.foldLevelPrev);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
|
|
@ -1000,6 +1000,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
{
|
||||
int thingtextureindex = 0;
|
||||
PixelColor tc;
|
||||
DataStream stream;
|
||||
|
||||
// Anything to render?
|
||||
if(things.Count > 0)
|
||||
|
@ -1029,10 +1030,9 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Begin drawing
|
||||
graphics.Shaders.Things2D.Begin();
|
||||
graphics.Shaders.Things2D.BeginPass(0);
|
||||
|
||||
// Lock buffer
|
||||
|
||||
// Determine next lock size
|
||||
int locksize = (things.Count > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : things.Count;
|
||||
DataStream stream = thingsvertices.Lock(0, locksize * 12 * FlatVertex.Stride, LockFlags.Discard);
|
||||
FlatVertex[] verts = new FlatVertex[THING_BUFFER_SIZE * 12];
|
||||
|
||||
// Go for all things
|
||||
|
@ -1050,38 +1050,30 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
// Buffer filled?
|
||||
if(buffercount == locksize)
|
||||
{
|
||||
// Unlock buffer
|
||||
stream.WriteRange<FlatVertex>(verts, 0, buffercount * 12);
|
||||
// Write to buffer
|
||||
stream = thingsvertices.Lock(0, locksize * 12 * FlatVertex.Stride, LockFlags.Discard);
|
||||
stream.WriteRange(verts, 0, buffercount * 12);
|
||||
thingsvertices.Unlock();
|
||||
stream.Dispose();
|
||||
stream = null;
|
||||
|
||||
// Draw!
|
||||
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, buffercount * 4);
|
||||
buffercount = 0;
|
||||
|
||||
// Do we need to continue drawing?
|
||||
if(totalcount < things.Count)
|
||||
{
|
||||
// Lock buffer
|
||||
locksize = ((things.Count - totalcount) > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : (things.Count - totalcount);
|
||||
stream = thingsvertices.Lock(0, locksize * 12 * FlatVertex.Stride, LockFlags.Discard);
|
||||
}
|
||||
// Determine next lock size
|
||||
locksize = ((things.Count - totalcount) > THING_BUFFER_SIZE) ? THING_BUFFER_SIZE : (things.Count - totalcount);
|
||||
}
|
||||
}
|
||||
|
||||
// Write to buffer
|
||||
stream = thingsvertices.Lock(0, locksize * 12 * FlatVertex.Stride, LockFlags.Discard);
|
||||
if(buffercount > 0) stream.WriteRange(verts, 0, buffercount * 12);
|
||||
thingsvertices.Unlock();
|
||||
stream.Dispose();
|
||||
|
||||
// Draw what's still remaining
|
||||
if(buffercount > 0)
|
||||
{
|
||||
// Unlock buffer
|
||||
stream.WriteRange<FlatVertex>(verts, 0, buffercount * 12);
|
||||
thingsvertices.Unlock();
|
||||
stream.Dispose();
|
||||
stream = null;
|
||||
|
||||
// Draw!
|
||||
graphics.Device.DrawPrimitives(PrimitiveType.TriangleList, 0, buffercount * 4);
|
||||
}
|
||||
|
||||
// Done
|
||||
graphics.Shaders.Things2D.EndPass();
|
||||
|
|
Loading…
Reference in a new issue