public static void DoUndoArea(Stream s, Vec3S32 min, Vec3S32 max, UndoFormat format, UndoFormatArgs args) { Level lvl = args.Player == null ? null : args.Player.level; string lastMap = null; foreach (UndoFormatEntry P in format.GetEntries(s, args)) { if (P.LevelName != lastMap) { lvl = LevelInfo.FindExact(P.LevelName); } if (lvl == null || P.Time > args.End) { continue; } if (P.X < min.X || P.Y < min.Y || P.Z < min.Z) { continue; } if (P.X > max.X || P.Y > max.Y || P.Z > max.Z) { continue; } UndoBlock(args, lvl, P); } }
public static void DoRedo(Stream s, UndoFormat format, UndoFormatArgs args) { DrawOpBlock block; foreach (UndoFormatEntry P in format.GetEntries(s, args)) { if (P.Time > args.End) { continue; } block.X = P.X; block.Y = P.Y; block.Z = P.Z; block.Block = P.Block; block.ExtBlock = P.ExtBlock; args.Output(block); } }
public static void DoHighlight(Stream s, UndoFormat format, UndoFormatArgs args) { BufferedBlockSender buffer = new BufferedBlockSender(args.Player); Level lvl = args.Player.level; foreach (UndoFormatEntry P in format.GetEntries(s, args)) { byte block = P.Block, newBlock = P.NewBlock; byte highlight = (newBlock == Block.air || Block.Convert(block) == Block.water || block == Block.waterstill || Block.Convert(block) == Block.lava || block == Block.lavastill) ? Block.red : Block.green; buffer.Add(lvl.PosToInt(P.X, P.Y, P.Z), highlight, 0); } buffer.Send(true); }
public static void DoUndo(Stream s, UndoFormat format, UndoFormatArgs args) { Level lvl = args.Player == null ? null : args.Player.level; string lastMap = null; foreach (UndoFormatEntry P in format.GetEntries(s, args)) { if (P.LevelName != lastMap) { lvl = LevelInfo.FindExact(P.LevelName); } if (lvl == null || P.Time > args.End) { continue; } UndoBlock(args, lvl, P); } }