Optimized GameScreen.DrawMap
- Downscaled lightmap, since blurring will make this unnoticeable anyway (TODO: make this optional) - Render LOS in fewer passes by using a shader - Use light volume to calculate LOS - This also means we can use the override texture to render the diving suit obstruct effect - Don't render bunks and labels onto LOS background (TODO: add the option to render back into the LOS background, i.e. just use multiplicative blending as if it was the lightmap) - Prefer SpriteSortMode.Deferred over all others, prefer SamplerState.LinearClamp/PointClamp over all others - Remove shader blur in favor of geometry blur (TODO: improve on this further, right now it has a few artifacts) - Trim light volumes - Do some weird shit with the background particles (use DrawTiled instead of relying on SamplerState.LinearWrap, because that's faster somehow :/ ) - Pressing up/down in the console only returns a typed command now
This commit is contained in:
@@ -13,13 +13,15 @@ namespace Barotrauma
|
||||
{
|
||||
public string Text;
|
||||
public Color Color;
|
||||
public bool IsCommand;
|
||||
|
||||
public readonly string Time;
|
||||
|
||||
public ColoredText(string text, Color color)
|
||||
public ColoredText(string text, Color color, bool isCommand)
|
||||
{
|
||||
this.Text = text;
|
||||
this.Color = color;
|
||||
this.IsCommand = isCommand;
|
||||
|
||||
Time = DateTime.Now.ToString();
|
||||
}
|
||||
@@ -1028,9 +1030,14 @@ namespace Barotrauma
|
||||
|
||||
direction = MathHelper.Clamp(direction, -1, 1);
|
||||
|
||||
selectedIndex += direction;
|
||||
if (selectedIndex < 0) selectedIndex = Messages.Count - 1;
|
||||
selectedIndex = selectedIndex % Messages.Count;
|
||||
int i = 0;
|
||||
do
|
||||
{
|
||||
selectedIndex += direction;
|
||||
if (selectedIndex < 0) selectedIndex = Messages.Count - 1;
|
||||
selectedIndex = selectedIndex % Messages.Count;
|
||||
if (++i >= Messages.Count) break;
|
||||
} while (!Messages[selectedIndex].IsCommand);
|
||||
|
||||
return Messages[selectedIndex].Text;
|
||||
}
|
||||
@@ -1042,7 +1049,7 @@ namespace Barotrauma
|
||||
#if CLIENT
|
||||
activeQuestionText = null;
|
||||
#endif
|
||||
NewMessage(command, Color.White);
|
||||
NewMessage(command, Color.White, true);
|
||||
//reset the variable before invoking the delegate because the method may need to activate another question
|
||||
var temp = activeQuestionCallback;
|
||||
activeQuestionCallback = null;
|
||||
@@ -1056,7 +1063,7 @@ namespace Barotrauma
|
||||
|
||||
if (!splitCommand[0].ToLowerInvariant().Equals("admin"))
|
||||
{
|
||||
NewMessage(command, Color.White);
|
||||
NewMessage(command, Color.White, true);
|
||||
}
|
||||
|
||||
#if !DEBUG && CLIENT
|
||||
@@ -1131,12 +1138,12 @@ namespace Barotrauma
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void NewMessage(string msg, Color color)
|
||||
public static void NewMessage(string msg, Color color, bool isCommand = false)
|
||||
{
|
||||
if (string.IsNullOrEmpty((msg))) return;
|
||||
|
||||
#if SERVER
|
||||
Messages.Add(new ColoredText(msg, color));
|
||||
Messages.Add(new ColoredText(msg, color, isCommand));
|
||||
|
||||
//TODO: REMOVE
|
||||
Console.ForegroundColor = XnaToConsoleColor.Convert(color);
|
||||
@@ -1151,7 +1158,7 @@ namespace Barotrauma
|
||||
#elif CLIENT
|
||||
lock (queuedMessages)
|
||||
{
|
||||
queuedMessages.Enqueue(new ColoredText(msg, color));
|
||||
queuedMessages.Enqueue(new ColoredText(msg, color, isCommand));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1204,7 +1204,7 @@ namespace Barotrauma
|
||||
Color color = Color.Red;
|
||||
if (ic.HasRequiredSkills(character) && ic.HasRequiredItems(character, false)) color = Color.Orange;
|
||||
|
||||
texts.Add(new ColoredText(ic.Msg, color));
|
||||
texts.Add(new ColoredText(ic.Msg, color, false));
|
||||
}
|
||||
|
||||
return texts;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Created by SharpDevelop.
|
||||
* User: Burhan
|
||||
* Date: 17/06/2014
|
||||
@@ -8,31 +8,31 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Copyright 2011 James Humphreys. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY James Humphreys ``AS IS\" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those of the
|
||||
authors and should not be interpreted as representing official policies, either expressed
|
||||
or implied, of James Humphreys.
|
||||
Copyright 2011 James Humphreys. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are
|
||||
permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
of conditions and the following disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY James Humphreys ``AS IS\" AND ANY EXPRESS OR IMPLIED
|
||||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those of the
|
||||
authors and should not be interpreted as representing official policies, either expressed
|
||||
or implied, of James Humphreys.
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -58,63 +58,63 @@ using System.Collections.Generic;
|
||||
namespace Voronoi2
|
||||
{
|
||||
public class Point
|
||||
{
|
||||
public double x, y;
|
||||
|
||||
public void setPoint ( double x, double y )
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
|
||||
// use for sites and vertecies
|
||||
public class Site
|
||||
{
|
||||
public Point coord;
|
||||
public int sitenbr;
|
||||
{
|
||||
public double x, y;
|
||||
|
||||
public void setPoint ( double x, double y )
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
|
||||
// use for sites and vertecies
|
||||
public class Site
|
||||
{
|
||||
public Point coord;
|
||||
public int sitenbr;
|
||||
|
||||
public void SetPoint(Vector2 point)
|
||||
{
|
||||
coord.setPoint(point.X, point.Y);
|
||||
}
|
||||
|
||||
public Site ()
|
||||
{
|
||||
coord = new Point();
|
||||
}
|
||||
}
|
||||
|
||||
public class Edge
|
||||
{
|
||||
public double a = 0, b = 0, c = 0;
|
||||
public Site[] ep;
|
||||
public Site[] reg;
|
||||
public int edgenbr;
|
||||
|
||||
public Edge ()
|
||||
{
|
||||
ep = new Site[2];
|
||||
reg = new Site[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Halfedge
|
||||
{
|
||||
public Halfedge ELleft, ELright;
|
||||
public Edge ELedge;
|
||||
public bool deleted;
|
||||
public int ELpm;
|
||||
public Site vertex;
|
||||
public double ystar;
|
||||
public Halfedge PQnext;
|
||||
|
||||
public Halfedge ()
|
||||
{
|
||||
PQnext = null;
|
||||
}
|
||||
}
|
||||
|
||||
public Site ()
|
||||
{
|
||||
coord = new Point();
|
||||
}
|
||||
}
|
||||
|
||||
public class Edge
|
||||
{
|
||||
public double a = 0, b = 0, c = 0;
|
||||
public Site[] ep;
|
||||
public Site[] reg;
|
||||
public int edgenbr;
|
||||
|
||||
public Edge ()
|
||||
{
|
||||
ep = new Site[2];
|
||||
reg = new Site[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Halfedge
|
||||
{
|
||||
public Halfedge ELleft, ELright;
|
||||
public Edge ELedge;
|
||||
public bool deleted;
|
||||
public int ELpm;
|
||||
public Site vertex;
|
||||
public double ystar;
|
||||
public Halfedge PQnext;
|
||||
|
||||
public Halfedge ()
|
||||
{
|
||||
PQnext = null;
|
||||
}
|
||||
}
|
||||
|
||||
public enum CellType
|
||||
{
|
||||
@@ -187,11 +187,11 @@ namespace Voronoi2
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class GraphEdge
|
||||
{
|
||||
|
||||
public class GraphEdge
|
||||
{
|
||||
public Vector2 point1, point2;
|
||||
public Site site1, site2;
|
||||
public Site site1, site2;
|
||||
public VoronoiCell cell1, cell2;
|
||||
|
||||
public bool isSolid;
|
||||
@@ -239,20 +239,20 @@ namespace Voronoi2
|
||||
|
||||
return normal;
|
||||
}
|
||||
}
|
||||
|
||||
// للترتيب
|
||||
public class SiteSorterYX : IComparer<Site>
|
||||
{
|
||||
public int Compare ( Site p1, Site p2 )
|
||||
{
|
||||
Point s1 = p1.coord;
|
||||
Point s2 = p2.coord;
|
||||
if ( s1.y < s2.y ) return -1;
|
||||
if ( s1.y > s2.y ) return 1;
|
||||
if ( s1.x < s2.x ) return -1;
|
||||
if ( s1.x > s2.x ) return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// للترتيب
|
||||
public class SiteSorterYX : IComparer<Site>
|
||||
{
|
||||
public int Compare ( Site p1, Site p2 )
|
||||
{
|
||||
Point s1 = p1.coord;
|
||||
Point s2 = p2.coord;
|
||||
if ( s1.y < s2.y ) return -1;
|
||||
if ( s1.y > s2.y ) return 1;
|
||||
if ( s1.x < s2.x ) return -1;
|
||||
if ( s1.x > s2.x ) return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,11 +89,11 @@ namespace Barotrauma
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
protected bool ResizeHorizontal
|
||||
public bool ResizeHorizontal
|
||||
{
|
||||
get { return prefab != null && prefab.ResizeHorizontal; }
|
||||
}
|
||||
protected bool ResizeVertical
|
||||
public bool ResizeVertical
|
||||
{
|
||||
get { return prefab != null && prefab.ResizeVertical; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -94,9 +94,9 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
class Key
|
||||
{
|
||||
private bool hit, hitQueue;
|
||||
class Key
|
||||
{
|
||||
private bool hit, hitQueue;
|
||||
private bool held, heldQueue;
|
||||
|
||||
|
||||
@@ -106,23 +106,23 @@ namespace Barotrauma
|
||||
//{
|
||||
// get { return canBeHeld; }
|
||||
//}
|
||||
|
||||
public Key(KeyOrMouse binding)
|
||||
{
|
||||
|
||||
public Key(KeyOrMouse binding)
|
||||
{
|
||||
this.binding = binding;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Hit
|
||||
{
|
||||
get
|
||||
{
|
||||
return hit;
|
||||
}
|
||||
set
|
||||
{
|
||||
hit = value;
|
||||
}
|
||||
}
|
||||
public bool Hit
|
||||
{
|
||||
get
|
||||
{
|
||||
return hit;
|
||||
}
|
||||
set
|
||||
{
|
||||
hit = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Held
|
||||
{
|
||||
@@ -141,14 +141,14 @@ namespace Barotrauma
|
||||
get { return binding; }
|
||||
}
|
||||
|
||||
public void SetState()
|
||||
{
|
||||
hit = binding.IsHit();
|
||||
if (hit) hitQueue = true;
|
||||
public void SetState()
|
||||
{
|
||||
hit = binding.IsHit();
|
||||
if (hit) hitQueue = true;
|
||||
|
||||
held = binding.IsDown();
|
||||
if (held) heldQueue = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetState(bool hit, bool held)
|
||||
{
|
||||
@@ -156,12 +156,12 @@ namespace Barotrauma
|
||||
if (held) heldQueue = true;
|
||||
}
|
||||
|
||||
public bool DequeueHit()
|
||||
{
|
||||
bool value = hitQueue;
|
||||
hitQueue = false;
|
||||
return value;
|
||||
}
|
||||
public bool DequeueHit()
|
||||
{
|
||||
bool value = hitQueue;
|
||||
hitQueue = false;
|
||||
return value;
|
||||
}
|
||||
|
||||
public bool DequeueHeld()
|
||||
{
|
||||
@@ -187,11 +187,11 @@ namespace Barotrauma
|
||||
held = false;
|
||||
}
|
||||
|
||||
public void ResetHit()
|
||||
{
|
||||
hit = false;
|
||||
//stateQueue = false;
|
||||
}
|
||||
public void ResetHit()
|
||||
{
|
||||
hit = false;
|
||||
//stateQueue = false;
|
||||
}
|
||||
|
||||
|
||||
public void ResetHeld()
|
||||
@@ -199,5 +199,5 @@ namespace Barotrauma
|
||||
held = false;
|
||||
//stateQueue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user