Ejemplo n.º 1
0
 public ToggleAlternateMusic(EditroidUndoRedoQueue q, Level level, int screenIndex, bool state)
     : base(q, level)
 {
     this.newState    = state;
     this.oldState    = Level.AlternateMusicRooms.Contians((byte)screenIndex);
     this.screenIndex = screenIndex;
 }
Ejemplo n.º 2
0
 public ModifyObject(EditroidUndoRedoQueue q, Screen screen, ObjectInstance obj, int newValue, ObjectModification change)
     : base(q, screen, obj)
 {
     this.change   = change;
     this.newValue = newValue;
     oldValue      = GetValue();
 }
Ejemplo n.º 3
0
        public AddTileToStructure(EditroidUndoRedoQueue q, Level level, int structIndex, int x, int y, byte tile) : base(q, level, structIndex)
        {
            this.x    = x;
            this.y    = y;
            this.tile = tile;

            initialState = GetStruct().Data.CopyData();
        }
Ejemplo n.º 4
0
 public ModifyObject(EditroidUndoRedoQueue q, Screen screen, ObjectInstance obj, Point newLocation)
     : base(q, screen, obj)
 {
     this.change = ObjectModification.Location;
     // The ROM packs object locations into a single byte.
     this.newValue = 0xFF & ((newLocation.X & 0x0F) | (newLocation.Y << 4));
     oldValue      = GetValue();
 }
Ejemplo n.º 5
0
        public OverwritePasswordData(EditroidUndoRedoQueue q, byte[] data)
            : base(q)
        {
            newData = data;
            oldData = new byte[newData.Length];

            Array.Copy(q.Rom.data, PasswordData.DataOffset, oldData, 0, oldData.Length);
        }
Ejemplo n.º 6
0
 public SetPaletteColor(EditroidUndoRedoQueue q, Level level, PaletteType type, int palette, int index, int newValue)
     : base(q, level)
 {
     this.type       = type;
     this.entryIndex = palette * 4 + index;
     this.newValue   = (byte)(newValue & 0xFF);
     this.oldValue   = Palette.GetEntry(entryIndex);
 }
Ejemplo n.º 7
0
        public SetMapRoomDisplay(EditroidUndoRedoQueue q, Point location, bool?alternatePal, int?animationIndex)
            : base(q, location)
        {
            this.newPalValue       = alternatePal;
            this.newAnimationValue = animationIndex;

            oldPalValue       = q.Editor.MapView.GetAltPal(location.X, location.Y);
            oldAnimationValue = q.Editor.MapView.GetAnimation(location.X, location.Y);
        }
Ejemplo n.º 8
0
        public EditItemProperty(EditroidUndoRedoQueue q, Point MapLocation, ItemScreenData screen, ItemData item, ItemProperty prop, int newValue)
            : base(q, MapLocation)
        {
            this.prop   = prop;
            this.item   = item;
            this.screen = screen;

            this.newValue = newValue;
            this.oldValue = GetValue();
        }
Ejemplo n.º 9
0
        public PasswordDataAction(EditroidUndoRedoQueue q, int dataIndex)
            : base(q)
        {
            this.dataIndex = dataIndex;
            PasswordDatum data = GetData();

            oldX     = newX = data.MapX;
            oldY     = newY = data.MapY;
            oldValue = newValue = data.Item;
        }
Ejemplo n.º 10
0
 public EditStructTile(EditroidUndoRedoQueue q, Level level, int structIndex, StructTileEdit[] edits)
     : base(q, level, structIndex)
 {
     this.edits = edits;
     for (int i = 0; i < edits.Length; i++)
     {
         var edit = edits[i];
         edit.oldValue = GetStruct().Data[edit.x, edit.y];
         edits[i]      = edit;
     }
 }
Ejemplo n.º 11
0
        public ModifyCombo(EditroidUndoRedoQueue q, Level level, int combo, int tile, int newValue)
            : base(q, level)
        {
            generationIndex++;
            generation = generationIndex;

            ComboChange change;

            change.index    = (byte)(combo & 0xFF);
            change.tile     = (byte)(tile & 0x03);
            change.newValue = (byte)(newValue & 0xFF);
            change.oldValue = Level.Combos[combo].GetByte(tile);
            changes.Add(change);
        }
Ejemplo n.º 12
0
        public ChangeMapRoomLevel(EditroidUndoRedoQueue q, Point location, LevelIndex newValue)
            : base(q, location)
        {
            this.newValue = newValue;
            oldValue      = q.Editor.MapView.GetLevel(location.X, location.Y);

            // Ensure that the screen index will be valid for the new level
            oldScreenIndex = Queue.Rom.GetScreenIndex(location.X, location.Y);
            newScreenIndex = Math.Min(oldScreenIndex, q.Rom.GetLevel(newValue).Screens.Count - 1);
            if (newValue == LevelIndex.None)
            {
                newScreenIndex = 0xFF;                              // ...FF indicates a blank room
            }
        }
Ejemplo n.º 13
0
        public ChangeDoor(EditroidUndoRedoQueue q, Screen screen, DoorSide side, DoorType type)
            : base(q, screen)
        {
            this.side    = side;
            this.newType = type;

            oldType = DoorType.Invalid;
            foreach (DoorInstance d in Screen.Doors)
            {
                if (d.Side == side)
                {
                    oldType = d.Type;
                }
            }
        }
Ejemplo n.º 14
0
        public ReorderObjects(EditroidUndoRedoQueue q, Screen screen, ObjectInstance obj, bool toFront)
            : base(q, screen, obj)
        {
            if (!(obj is StructInstance))
            {
                throw new ArgumentException("Invalid screen item specified for object reorder.", "obj");
            }

            this.toFront = toFront;
            oldIndex     = Screen.GetIndex(obj);
            if (toFront)
            {
                newIndex = Screen.Structs.Count - 1;
            }
            else
            {
                newIndex = 0;
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="q"></param>
        /// <param name="l"></param>
        /// <param name="edit"></param>
        /// <param name="ppuMacroIndex"></param>
        /// <param name="newValue"></param>
        /// <param name="macroByteIndex">Applied only to edits to actual macro data.</param>
        public AdvancedPaletteEdit(EditroidUndoRedoQueue q, Level l, AdvancedPaletteEditType edit, int ppuMacroIndex, int newValue, int macroByteIndex)
            : base(q, l)
        {
            Edit newEdit;

            newEdit.editType       = edit;
            newEdit.newValue       = newValue;
            newEdit.ppuMacroIndex  = ppuMacroIndex;
            newEdit.oldValue       = GetCurrentValue(edit, ppuMacroIndex, macroByteIndex);
            newEdit.macroByteIndex = macroByteIndex;

            edits.Add(newEdit);

            if (edit != AdvancedPaletteEditType.DataOffset)
            {
                var pointer = Level.PalettePointers[ppuMacroIndex];
                if (!pointer.IsLevelBank)
                {
                    throw new InvalidOperationException("Attempted to modify ppu macro data, but the pointer to the data is invalid.");
                }
            }
        }
Ejemplo n.º 16
0
 private AddOrRemoveObject(EditroidUndoRedoQueue q, Screen screen, ObjOperation operation, ObjectInstance data)
     : base(q, screen)
 {
     this.operation = operation;
     this.obj       = data;
 }
Ejemplo n.º 17
0
 public RemoveStructTile(EditroidUndoRedoQueue q, Level level, int structIndex, int x, int y)
     : base(q, level, structIndex, new StructTileEdit(x, y, Structure.EmptyTile))
 {
 }
Ejemplo n.º 18
0
 public EditStructTile(EditroidUndoRedoQueue q, Level level, int structIndex, StructTileEdit edit)
     : base(q, level, structIndex)
 {
     edit.oldValue = GetStruct().Data[edit.x, edit.y];
     edits         = new StructTileEdit[] { edit };
 }
Ejemplo n.º 19
0
 public ModifyObject(EditroidUndoRedoQueue q, Screen screen, ObjectInstance obj, bool newValue, ObjectModification change)
     : this(q, screen, obj, newValue ? -1 : 0, change)
 {
 }
Ejemplo n.º 20
0
 public ChangeColorAttributeTable(EditroidUndoRedoQueue q, Screen screen, int newValue)
     : base(q, screen)
 {
     this.newValue = newValue;
     oldValue      = Screen.ColorAttributeTable;
 }
Ejemplo n.º 21
0
 public AdvancedPaletteEdit(EditroidUndoRedoQueue q, Level l, AdvancedPaletteEditType edit, int ppuMacroIndex, int newValue)
     : this(q, l, edit, ppuMacroIndex, newValue, -1)
 {
 }
Ejemplo n.º 22
0
 public static AddOrRemoveObject RemoveObject(EditroidUndoRedoQueue q, Screen screen, ObjectInstance obj)
 {
     return(new AddOrRemoveObject(q, screen, ObjOperation.Remove, obj));
 }
Ejemplo n.º 23
0
 public SetScreenIndex(EditroidUndoRedoQueue q, Point mapLocation, int screenIndex)
     : base(q, mapLocation)
 {
     oldValue = Queue.Rom.GetScreenIndex(mapLocation.X, mapLocation.Y);
     newValue = screenIndex;
 }
Ejemplo n.º 24
0
 public AddOrRemoveBridge(EditroidUndoRedoQueue q, Screen screen, bool willHaveBridge)
     : base(q, screen)
 {
     newValue = willHaveBridge;
     oldValue = Screen.HasBridge;
 }
Ejemplo n.º 25
0
 public StructureAction(EditroidUndoRedoQueue q, Level level, int index)
     : base(q, level)
 {
     this.structIndex = index;
 }