} // villsa #endregion #region ================== Constructor / Disposer // Constructor internal Sector(MapSet map, int listindex, int index) { // Initialize this.map = map; this.listindex = listindex; this.sidedefs = new LinkedList <Sidedef>(); this.fixedindex = index; this.floortexname = "-"; this.ceiltexname = "-"; this.longfloortexname = MapSet.EmptyLongName; this.longceiltexname = MapSet.EmptyLongName; this.updateneeded = true; this.triangulationneeded = true; this.surfaceentry = new SurfaceEntry(-1, -1, -1); this.flags = new Dictionary <string, bool>(); // villsa this.ceilColor = new Lights(128, 128, 128, 0); // villsa this.flrColor = new Lights(128, 128, 128, 0); // villsa this.thingColor = new Lights(128, 128, 128, 0); // villsa this.topColor = new Lights(128, 128, 128, 0); // villsa this.lwrColor = new Lights(128, 128, 128, 0); // villsa if (map == General.Map.Map) { General.Map.UndoRedo.RecAddSector(this); } // We have no destructor GC.SuppressFinalize(this); }
private static PixelColor GetFactor(Lights light) { float factor = 1.0f + (General.Settings.LightIntensity / 10.0f); int[] hsv = GetHSV(light.color); hsv[2] = Math.Min((int)((float)hsv[2] * factor), 255); return(GetRGB(hsv)); }
// villsa - new overload method private Lights GetLight(int cindex, Lights[] light) { Lights color; if (cindex >= 256) { cindex -= 256; color = light[cindex]; } else { byte c = (byte)cindex; color = new Lights(c, c, c, 0); } color.color.a = 255; return(color); }
public void Update(Dictionary <string, bool> flags, int hfloor, int hceil, string tfloor, string tceil, int effect, int tag, int[] colors) { BeforePropsChange(); // Apply changes this.flags = new Dictionary <string, bool>(flags); this.floorheight = hfloor; this.ceilheight = hceil; SetFloorTexture(tfloor); SetCeilTexture(tceil); this.effect = effect; this.tag = tag; this.brightness = 255; this.flrColor = GetLight(colors[0]); this.ceilColor = GetLight(colors[1]); this.thingColor = GetLight(colors[2]); this.topColor = GetLight(colors[3]); this.lwrColor = GetLight(colors[4]); updateneeded = true; }
public int UnpegUpperLight(Sidedef s) { int height; Lights c = new Lights(); int sh1; int sh2; Sector front; Sector back; float r1, g1, b1; float r2, g2, b2; Lights ltop, lbottom; if (s.Line.IsFlagSet("67108864")) { ltop = s.Sector.LowerColor; lbottom = s.Sector.TopColor; } else { ltop = s.Sector.TopColor; lbottom = s.Sector.LowerColor; } ltop.color = GetFactor(ltop); lbottom.color = GetFactor(lbottom); if (s.Line.IsFlagSet("2097152")) { return(lbottom.color.ToInt()); } if (s.IsFront) { front = s.Line.Front.Sector; back = s.Line.Back.Sector; } else { front = s.Line.Back.Sector; back = s.Line.Front.Sector; } height = front.CeilHeight - front.FloorHeight; if (height == 0) { return(lbottom.color.ToInt()); } sh1 = back.CeilHeight - front.FloorHeight; sh2 = front.CeilHeight - back.CeilHeight; r1 = ltop.color.r; g1 = ltop.color.g; b1 = ltop.color.b; r2 = lbottom.color.r; g2 = lbottom.color.g; b2 = lbottom.color.b; r1 = ((r1 / height) * sh1); g1 = ((g1 / height) * sh1); b1 = ((b1 / height) * sh1); r2 = ((r2 / height) * sh2); g2 = ((g2 / height) * sh2); b2 = ((b2 / height) * sh2); c.color.r = (byte)Math.Min((int)(r1 + r2), (int)255); c.color.g = (byte)Math.Min((int)(g1 + g2), (int)255); c.color.b = (byte)Math.Min((int)(b1 + b2), (int)255); c.color.a = 255; return(c.color.ToInt()); }
public int GetColor(Lights light) { return(GetFactor(light).ToInt()); }