Ejemplo n.º 1
0
        public bool Equals(CarGenerator other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Model.Equals(other.Model) &&
                   Position.Equals(other.Position) &&
                   Heading.Equals(other.Heading) &&
                   Color1.Equals(other.Color1) &&
                   Color2.Equals(other.Color2) &&
                   ForceSpawn.Equals(other.ForceSpawn) &&
                   AlarmChance.Equals(other.AlarmChance) &&
                   LockedChance.Equals(other.LockedChance) &&
                   MinDelay.Equals(other.MinDelay) &&
                   MaxDelay.Equals(other.MaxDelay) &&
                   Timer.Equals(other.Timer) &&
                   Handle.Equals(other.Handle) &&
                   Enabled.Equals(other.Enabled) &&
                   IsBlocking.Equals(other.IsBlocking) &&
                   CollisionBoundingMin.Equals(other.CollisionBoundingMin) &&
                   CollisionBoundingMax.Equals(other.CollisionBoundingMax) &&
                   CollisionSize.Equals(other.CollisionSize));
        }
Ejemplo n.º 2
0
        private QuantizedImage GenerateResult(IPixelAccessor imagePixels, int colorCount, Box[] cube)
        {
            List <Color2> pallette = new List <Color2>();

            byte[] pixels           = new byte[imagePixels.Width * imagePixels.Height];
            int    transparentIndex = -1;
            int    width            = imagePixels.Width;
            int    height           = imagePixels.Height;

            for (int k = 0; k < colorCount; k++)
            {
                Mark(cube[k], (byte)k);
                double weight = Volume(cube[k], vwt);
                if (Math.Abs(weight) > Epsilon)
                {
                    byte   r     = (byte)(Volume(cube[k], vmr) / weight);
                    byte   g     = (byte)(Volume(cube[k], vmg) / weight);
                    byte   b     = (byte)(Volume(cube[k], vmb) / weight);
                    byte   a     = (byte)(Volume(cube[k], vma) / weight);
                    Color2 color = Color2.FromArgb(a, r, g, b);
                    if (color.Equals(default(Color2)))
                    {
                        transparentIndex = k;
                    }
                    pallette.Add(color);
                }
                else
                {
                    pallette.Add(default(Color2));
                    transparentIndex = k;
                }
            }
            Parallel.For(0, height, Bootstrapper.instance.ParallelOptions, y => {
                for (int x = 0; x < width; x++)
                {
                    // Expected order r->g->b->a
                    byte[] color = imagePixels[x, y].ToBytes();
                    int r        = color[0] >> (8 - IndexBits);
                    int g        = color[1] >> (8 - IndexBits);
                    int b        = color[2] >> (8 - IndexBits);
                    int a        = color[3] >> (8 - IndexAlphaBits);
                    if (transparentIndex > -1 && color[3] <= Threshold)
                    {
                        pixels[(y * width) + x] = (byte)transparentIndex;
                        continue;
                    }
                    int ind = GetPaletteIndex(r + 1, g + 1, b + 1, a + 1);
                    pixels[(y * width) + x] = tag[ind];
                }
            });
            return(new QuantizedImage(width, height, pallette.ToArray(), pixels, transparentIndex));
        }
Ejemplo n.º 3
0
        public bool Equals(StoredCar other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Model.Equals(other.Model) &&
                   Position.Equals(other.Position) &&
                   Angle.Equals(other.Angle) &&
                   Flags.Equals(other.Flags) &&
                   Color1.Equals(other.Color1) &&
                   Color2.Equals(other.Color2) &&
                   Radio.Equals(other.Radio) &&
                   Extra1.Equals(other.Extra1) &&
                   Extra2.Equals(other.Extra2) &&
                   Bomb.Equals(other.Bomb));
        }
Ejemplo n.º 4
0
        public bool Equals(StoredCar other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Model.Equals(other.Model) &&
                   Position.Equals(other.Position) &&
                   Math.Abs(Heading - other.Heading) < 0.001 &&
                   Math.Abs(Pitch - other.Pitch) < 0.001 &&
                   Traction.Equals(other.Traction) &&
                   Flags.Equals(other.Flags) &&
                   Color1.Equals(other.Color1) &&
                   Color2.Equals(other.Color2) &&
                   Radio.Equals(other.Radio) &&
                   Extra1.Equals(other.Extra1) &&
                   Extra2.Equals(other.Extra2));
        }
Ejemplo n.º 5
0
        public bool Equals(Vehicle other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Type.Equals(other.Type) &&
                   ModelIndex.Equals(other.ModelIndex) &&
                   Handle.Equals(other.Handle) &&
                   Matrix.Equals(other.Matrix) &&
                   EntityType.Equals(other.EntityType) &&
                   EntityStatus.Equals(other.EntityStatus) &&
                   EntityFlags.Equals(other.EntityFlags) &&
                   AutoPilot.Equals(other.AutoPilot) &&
                   Color1.Equals(other.Color1) &&
                   Color2.Equals(other.Color2) &&
                   AlarmState.Equals(other.AlarmState) &&
                   MaxNumPassengers.Equals(other.MaxNumPassengers) &&
                   Field1D0h.Equals(other.Field1D0h) &&
                   Field1D4h.Equals(other.Field1D4h) &&
                   Field1D8h.Equals(other.Field1D8h) &&
                   Field1DCh.Equals(other.Field1DCh) &&
                   SteerAngle.Equals(other.SteerAngle) &&
                   GasPedal.Equals(other.GasPedal) &&
                   BrakePedal.Equals(other.BrakePedal) &&
                   CreatedBy.Equals(other.CreatedBy) &&
                   IsLawEnforcer.Equals(other.IsLawEnforcer) &&
                   IsLockedByScript.Equals(other.IsLockedByScript) &&
                   IsEngineOn.Equals(other.IsEngineOn) &&
                   IsHandbrakeOn.Equals(other.IsHandbrakeOn) &&
                   LightsOn.Equals(other.LightsOn) &&
                   HasFreebies.Equals(other.HasFreebies) &&
                   Health.Equals(other.Health) &&
                   CurrentGear.Equals(other.CurrentGear) &&
                   ChangeGearTime.Equals(other.ChangeGearTime) &&
                   TimeOfDeath.Equals(other.TimeOfDeath) &&
                   BombTimer.Equals(other.BombTimer) &&
                   DoorLock.Equals(other.DoorLock));
        }