Example #1
0
        public void loadWorldMap(Stream map)
        {
            GZipStream gz = new GZipStream(map, CompressionMode.Decompress);

            var areas = new List <KnyttArea>();

            // Area definition starts with an 'x' character
            while (gz.ReadByte() == 'x')
            {
                var area = new KnyttArea(gz, this);
                areas.Add(area);

                this.MinBounds = this.MinBounds.min(area.Position);
                this.MaxBounds = this.MaxBounds.max(area.Position);
            }

            // Set the map
            this.Size = new KnyttPoint((MaxBounds.x - MinBounds.x) + 1, (MaxBounds.y - MinBounds.y) + 1);
            this.Map  = new KnyttArea[this.Size.Area];

            foreach (var area in areas)
            {
                this.Map[getMapIndex(area.Position)] = area;
            }
        }
Example #2
0
 public KnyttWarp(KnyttArea area)
 {
     Area       = area;
     WarpUp     = KnyttPoint.Zero;
     WarpDown   = KnyttPoint.Zero;
     WarpLeft   = KnyttPoint.Zero;
     WarpRight  = KnyttPoint.Zero;
     LoadedWarp = false;
 }
Example #3
0
 public void setVisited(KnyttArea area)
 {
     if (area.Position.x < area.World.MinBounds.x || area.Position.x > area.World.MaxBounds.x ||
         area.Position.y < area.World.MinBounds.y || area.Position.x > area.World.MaxBounds.y)
     {
         return;
     }
     if (VisitedAreas == null)
     {
         VisitedAreas = new BitArray(area.World.Map.Length, false);
     }
     VisitedAreas.Set(area.World.getMapIndex(area.Position), true);
 }
Example #4
0
 public KnyttTrigger(KnyttArea area, KnyttPoint shift_pos, SwitchID id) : this(shift_pos, id, area.ExtraData)
 {
 }
Example #5
0
 public KnyttShift(KnyttArea area, KnyttPoint shift_pos, SwitchID id) : this(area.Position, shift_pos, id, area.ExtraData)
 {
 }
Example #6
0
 public bool isVisited(KnyttArea area)
 {
     return(VisitedAreas.Get(area.World.getMapIndex(area.Position)));
 }