fixed #26 etc
This commit is contained in:
@@ -10,7 +10,7 @@ namespace OpenRa.Game.Graphics
|
||||
{
|
||||
class HardwarePalette : Sheet
|
||||
{
|
||||
const int maxEntries = 8;
|
||||
const int maxEntries = 16;
|
||||
int allocated = 0;
|
||||
|
||||
public HardwarePalette(Renderer renderer, Map map, int rotate)
|
||||
@@ -22,6 +22,8 @@ namespace OpenRa.Game.Graphics
|
||||
foreach (string remap in new string[] { "blue", "red", "orange", "teal", "salmon", "green", "gray" })
|
||||
AddPalette(new Palette(pal, new PaletteRemap(FileSystem.Open(remap + ".rem"))));
|
||||
|
||||
AddPalette(new Palette(pal, new PaletteRemap(Color.FromArgb(178, 0, 0, 0))));
|
||||
|
||||
using (var bitmapCopy = new Bitmap(bitmap))
|
||||
for (int j = 0; j < maxEntries; j++)
|
||||
for (int i = 0; i < 7; i++)
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRa.Game.Graphics
|
||||
|
||||
public static void FastCreateQuad(Vertex[] vertices, ushort[] indices, float2 o, Sprite r, int palette, int nv, int ni)
|
||||
{
|
||||
float2 attrib = new float2(palette / 8.0f, channelSelect[(int)r.channel]);
|
||||
float2 attrib = new float2(palette / 16.0f, channelSelect[(int)r.channel]);
|
||||
|
||||
vertices[nv] = new Vertex(KLerp(o, r.size, 0), r.FastMapTextureCoords(0), attrib);
|
||||
vertices[nv + 1] = new Vertex(KLerp(o, r.size, 1), r.FastMapTextureCoords(1), attrib);
|
||||
|
||||
@@ -53,6 +53,24 @@ namespace OpenRa.Game.Graphics
|
||||
spriteRenderer.DrawSprite(image.First, loc,
|
||||
(owner != null) ? owner.Palette : 0);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSpriteList(RectangleF rect,
|
||||
IEnumerable<Tuple<Sprite, float2, int>> images)
|
||||
{
|
||||
foreach (var image in images)
|
||||
{
|
||||
var loc = image.b;
|
||||
|
||||
if (loc.X > rect.Right || loc.X < rect.Left
|
||||
- image.a.bounds.Width)
|
||||
continue;
|
||||
if (loc.Y > rect.Bottom || loc.Y < rect.Top
|
||||
- image.a.bounds.Height)
|
||||
continue;
|
||||
|
||||
spriteRenderer.DrawSprite(image.a, loc, image.c);
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
@@ -71,7 +89,7 @@ namespace OpenRa.Game.Graphics
|
||||
DrawSpriteList(a.self.Owner, rect, a.RenderRoof(a.self)); /* RUDE HACK */
|
||||
|
||||
foreach (IEffect e in Game.world.Effects)
|
||||
DrawSpriteList(e.Owner, rect, e.Render());
|
||||
DrawSpriteList(rect, e.Render());
|
||||
|
||||
uiOverlay.Draw();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user