Beispiel #1
0
        // This sets up the basic floor and ceiling, as they would be in normal Doom circumstances
        private void BasicSetup()
        {
            //mxd
            if (sector.FloorSlope.GetLengthSq() > 0 && !float.IsNaN(sector.FloorSlopeOffset / sector.FloorSlope.z))
            {
                // Sloped plane
                floor.plane = new Plane(sector.FloorSlope, sector.FloorSlopeOffset);
            }
            else
            {
                // Normal (flat) floor plane
                floor.plane = new Plane(new Vector3D(0, 0, 1), -sector.FloorHeight);
            }

            if (sector.CeilSlope.GetLengthSq() > 0 && !float.IsNaN(sector.CeilSlopeOffset / sector.CeilSlope.z))
            {
                // Sloped plane
                ceiling.plane = new Plane(sector.CeilSlope, sector.CeilSlopeOffset);
            }
            else
            {
                // Normal (flat) ceiling plane
                ceiling.plane = new Plane(new Vector3D(0, 0, -1), sector.CeilHeight);
            }

            // Fetch ZDoom fields
            int color = sector.Fields.GetValue("lightcolor", -1);

            lightfloor           = sector.Fields.GetValue("lightfloor", 0);
            lightfloorabsolute   = sector.Fields.GetValue("lightfloorabsolute", false);
            lightceiling         = sector.Fields.GetValue("lightceiling", 0);
            lightceilingabsolute = sector.Fields.GetValue("lightceilingabsolute", false);
            if (!lightfloorabsolute)
            {
                lightfloor = sector.Brightness + lightfloor;
            }
            if (!lightceilingabsolute)
            {
                lightceiling = sector.Brightness + lightceiling;
            }

            // Determine colors & light levels
            // [ZZ] Doom64 lighting
            //
            // ceiling/floor
            ColorCeiling    = PixelColor.FromInt(sector.Fields.GetValue("color_ceiling", PixelColor.INT_WHITE));
            ColorFloor      = PixelColor.FromInt(sector.Fields.GetValue("color_floor", PixelColor.INT_WHITE));
            ColorSprites    = PixelColor.FromInt(sector.Fields.GetValue("color_sprites", PixelColor.INT_WHITE));
            ColorWallTop    = PixelColor.FromInt(sector.Fields.GetValue("color_walltop", PixelColor.INT_WHITE));
            ColorWallBottom = PixelColor.FromInt(sector.Fields.GetValue("color_wallbottom", PixelColor.INT_WHITE));

            PixelColor floorbrightness   = PixelColor.FromInt(mode.CalculateBrightness(lightfloor));
            PixelColor ceilingbrightness = PixelColor.FromInt(mode.CalculateBrightness(lightceiling));
            PixelColor lightcolor        = PixelColor.FromInt(color);
            PixelColor floorcolor        = PixelColor.Modulate(ColorFloor, PixelColor.Modulate(lightcolor, floorbrightness));
            PixelColor ceilingcolor      = PixelColor.Modulate(ColorCeiling, PixelColor.Modulate(lightcolor, ceilingbrightness));

            floor.color             = floorcolor.WithAlpha(255).ToInt();
            floor.brightnessbelow   = sector.Brightness;
            floor.colorbelow        = lightcolor.WithAlpha(255);
            ceiling.color           = ceilingcolor.WithAlpha(255).ToInt();
            ceiling.brightnessbelow = sector.Brightness;
            ceiling.colorbelow      = lightcolor.WithAlpha(255);

            //mxd. Store a copy of initial settings
            floor.CopyProperties(floorbase);
            ceiling.CopyProperties(ceilingbase);

            //mxd. We need sector brightness here, unaffected by custom ceiling brightness...
            ceilingbase.brightnessbelow = sector.Brightness;
            ceilingbase.color           = PixelColor.FromInt(mode.CalculateBrightness(sector.Brightness)).WithAlpha(255).ToInt();

            //mxd
            glowingflateffect.Update();
        }
Beispiel #2
0
        // This sets up the basic floor and ceiling, as they would be in normal Doom circumstances
        private void BasicSetup()
        {
            //mxd
            if (sector.FloorSlope.GetLengthSq() > 0 && !float.IsNaN(sector.FloorSlopeOffset / sector.FloorSlope.z))
            {
                // Sloped plane
                floor.plane = new Plane(sector.FloorSlope, sector.FloorSlopeOffset);
            }
            else
            {
                // Normal (flat) floor plane
                floor.plane = new Plane(new Vector3D(0, 0, 1), -sector.FloorHeight);
            }

            if (sector.CeilSlope.GetLengthSq() > 0 && !float.IsNaN(sector.CeilSlopeOffset / sector.CeilSlope.z))
            {
                // Sloped plane
                ceiling.plane = new Plane(sector.CeilSlope, sector.CeilSlopeOffset);
            }
            else
            {
                // Normal (flat) ceiling plane
                ceiling.plane = new Plane(new Vector3D(0, 0, -1), sector.CeilHeight);
            }

            // Fetch ZDoom fields
            int  color  = sector.Fields.GetValue("lightcolor", -1);
            int  flight = sector.Fields.GetValue("lightfloor", 0);
            bool fabs   = sector.Fields.GetValue("lightfloorabsolute", false);
            int  clight = sector.Fields.GetValue("lightceiling", 0);
            bool cabs   = sector.Fields.GetValue("lightceilingabsolute", false);

            // Determine colors & light levels
            PixelColor lightcolor = PixelColor.FromInt(color);

            if (!fabs)
            {
                flight = sector.Brightness + flight;
            }
            if (!cabs)
            {
                clight = sector.Brightness + clight;
            }
            PixelColor floorbrightness   = PixelColor.FromInt(mode.CalculateBrightness(flight));
            PixelColor ceilingbrightness = PixelColor.FromInt(mode.CalculateBrightness(clight));
            PixelColor floorcolor        = PixelColor.Modulate(lightcolor, floorbrightness);
            PixelColor ceilingcolor      = PixelColor.Modulate(lightcolor, ceilingbrightness);

            floor.color             = floorcolor.WithAlpha(255).ToInt();
            floor.brightnessbelow   = sector.Brightness;
            floor.colorbelow        = lightcolor.WithAlpha(255);
            ceiling.color           = ceilingcolor.WithAlpha(255).ToInt();
            ceiling.brightnessbelow = sector.Brightness;
            ceiling.colorbelow      = lightcolor.WithAlpha(255);

            //mxd. Store a copy of initial settings
            floor.CopyProperties(floorbase);
            ceiling.CopyProperties(ceilingbase);

            //mxd. We need sector brightness here, unaffected by custom ceiling brightness...
            ceilingbase.brightnessbelow = sector.Brightness;
            ceilingbase.color           = PixelColor.FromInt(mode.CalculateBrightness(sector.Brightness)).WithAlpha(255).ToInt();

            //mxd
            glowingflateffect.Update();
        }