public override void Execute(BHAV bhav, UIBHAVEditor editor)
 {
     if (Primitive.Type != PrimBoxType.Primitive)
     {
         //do nothing.
     }
     else
     {
         bhav.Instructions[0]      = Primitive.Instruction;
         bhav.Instructions[OldPtr] = Old0.Instruction;
         Primitive.InstPtr         = 0;
         Old0.InstPtr = OldPtr;
         foreach (var prim in FromTrue)
         {
             prim.Instruction.TruePointer = 0;
         }
         foreach (var prim in FromFalse)
         {
             prim.Instruction.FalsePointer = 0;
         }
         foreach (var prim in FromTrue0)
         {
             prim.Instruction.TruePointer = OldPtr;
         }
         foreach (var prim in FromFalse0)
         {
             prim.Instruction.FalsePointer = OldPtr;
         }
         Content.GameContent.Get.Changes.ChunkChanged(bhav);
         SimAntics.VM.BHAVChanged(bhav);
     }
 }
 public PropGridVMData(EditorScope scope, VMEntity ent, VMStackFrame frame, UIBHAVEditor editor)
 {
     Scope  = scope;
     Object = ent;
     Frame  = frame;
     Editor = editor;
 }
        public override void Execute(BHAV bhav, UIBHAVEditor editor)
        {
            if (NewPrimitive.Type != PrimBoxType.Primitive)
            {
                editor.BHAVView.Primitives.Add(NewPrimitive);
                editor.BHAVView.Add(NewPrimitive);
            }
            else
            {
                var newInst = new BHAVInstruction[bhav.Instructions.Length + 1];
                for (int i = 0; i < bhav.Instructions.Length; i++)
                {
                    newInst[i] = bhav.Instructions[i];
                }
                newInst[newInst.Length - 1] = NewPrimitive.Instruction;
                NewPrimitive.InstPtr        = (byte)(newInst.Length - 1);

                bhav.Instructions = newInst;
                editor.BHAVView.AddPrimitive(NewPrimitive);
                NewPrimitive.UpdateDisplay();

                Content.GameContent.Get.Changes.ChunkChanged(bhav);

                SimAntics.VM.BHAVChanged(bhav);
            }
        }
 public override void Undo(BHAV bhav, UIBHAVEditor editor)
 {
     if (Primitive.Type != TREEBoxType.Primitive)
     {
         //do nothing.
     }
     else
     {
         bhav.Instructions[0]      = Old0.Instruction;
         bhav.Instructions[OldPtr] = Primitive.Instruction;
         // TODO
         //Primitive.InstPtr = OldPtr;
         //Old0.InstPtr = 0;
         foreach (var prim in FromTrue)
         {
             prim.Instruction.TruePointer = OldPtr;
         }
         foreach (var prim in FromFalse)
         {
             prim.Instruction.FalsePointer = OldPtr;
         }
         foreach (var prim in FromTrue0)
         {
             prim.Instruction.TruePointer = 0;
         }
         foreach (var prim in FromFalse0)
         {
             prim.Instruction.FalsePointer = 0;
         }
         Content.Content.Get().Changes.ChunkChanged(bhav);
         FSO.SimAntics.VM.BHAVChanged(bhav);
     }
 }
Beispiel #5
0
        public override void Undo(BHAV bhav, UIBHAVEditor editor)
        {
            var tree = editor.GetSavableTree();

            if (TrueBranch)
            {
                if (InstUI.Instruction != null)
                {
                    InstUI.Instruction.TruePointer = (OldDestUI == null) ? (byte)253 : OldDestUI.InstPtr;
                }
                InstUI.TrueUI = OldDestUI;
                InstUI.TreeBox.TruePointer = (OldDestUI == null) ? (short)-1 : OldDestUI.TreeBox.InternalID;
            }
            else
            {
                if (InstUI.Instruction != null)
                {
                    InstUI.Instruction.FalsePointer = (OldDestUI == null) ? (byte)253 : OldDestUI.InstPtr;
                }
                InstUI.FalseUI = OldDestUI;
                InstUI.TreeBox.FalsePointer = (OldDestUI == null) ? (short)-1 : OldDestUI.TreeBox.InternalID;
            }

            if (InstUI.Type == TREEBoxType.Label)
            {
                editor.BHAVView.UpdateLabelPointers(InstUI.TreeBox.InternalID);
            }

            Content.Content.Get().Changes.ChunkChanged(bhav);
            FSO.SimAntics.VM.BHAVChanged(bhav);
            Content.Content.Get().Changes.ChunkChanged(tree);
        }
 public override void Execute(BHAV bhav, UIBHAVEditor editor)
 {
     Prim.Instruction.Operand = NewOp;
     Prim.UpdateDisplay();
     Content.GameContent.Get.Changes.ChunkChanged(bhav);
     SimAntics.VM.BHAVChanged(bhav);
 }
Beispiel #7
0
        public override void Undo(BHAV bhav, UIBHAVEditor editor)
        {
            var tree = editor.GetSavableTree();

            if (NewPrimitive.Type != TREEBoxType.Primitive)
            {
                if (NewPrimitive.TreeBox.InternalID != -1)
                {
                    tree.DeleteBox(NewPrimitive.TreeBox);
                }
                editor.BHAVView.Primitives.Remove(NewPrimitive);
                editor.BHAVView.Remove(NewPrimitive);
            }
            else
            {
                //primitive we added should be at the end
                var newInst = new BHAVInstruction[bhav.Instructions.Length - 1];
                for (int i = 0; i < newInst.Length; i++)
                {
                    newInst[i] = bhav.Instructions[i];
                }

                bhav.Instructions = newInst;
                editor.BHAVView.RemovePrimitive(NewPrimitive);
                Content.Content.Get().Changes.ChunkChanged(bhav);
                FSO.SimAntics.VM.BHAVChanged(bhav);
            }
            Content.Content.Get().Changes.ChunkChanged(tree);
        }
 public override void Undo(BHAV bhav, UIBHAVEditor editor)
 {
     Prim.Instruction.Operand = OldOp;
     Prim.RefreshOperand();
     Prim.UpdateDisplay();
     Content.GameContent.Get.Changes.ChunkChanged(bhav);
     SimAntics.VM.BHAVChanged(bhav);
 }
Beispiel #9
0
 public override void Execute(BHAV bhav, UIBHAVEditor editor)
 {
     Old      = editor.BHAVView.EditTarget;
     OldScope = editor.BHAVView.Scope;
     OldFrame = editor.DebugFrame;
     editor.BHAVView.OnSelectedChanged -= SelectCallback;
     editor.SwitchBHAV(Target, TargetScope, Frame);
     editor.BHAVView.OnSelectedChanged += SelectCallback;
 }
Beispiel #10
0
        public override void Undo(BHAV bhav, UIBHAVEditor editor)
        {
            var tree = editor.GetSavableTree();

            Box.SetComment(OldComment);
            Box.ApplyBoxPositionCentered();
            NotifyGotos();
            Content.Content.Get().Changes.ChunkChanged(tree);
        }
        public override void Execute(BHAV bhav, UIBHAVEditor editor)
        {
            var tree = editor.GetSavableTree();

            Box.TreeBox.X      = (short)AfterPos.X;
            Box.TreeBox.Y      = (short)AfterPos.Y;
            Box.TreeBox.Width  = (short)AfterSize.X;
            Box.TreeBox.Height = (short)AfterSize.Y;
            Content.Content.Get().Changes.ChunkChanged(tree);
        }
        public override void Undo(BHAV bhav, UIBHAVEditor editor)
        {
            var tree = editor.GetSavableTree();

            Box.TreeBox.X      = (short)BeforePos.X;
            Box.TreeBox.Y      = (short)BeforePos.Y;
            Box.TreeBox.Width  = (short)BeforeSize.X;
            Box.TreeBox.Height = (short)BeforeSize.Y;
            Box.ApplyBoxPositionCentered();
            Content.Content.Get().Changes.ChunkChanged(tree);
        }
Beispiel #13
0
        private int LastValue;    //used to circumvent the fact that we don't change the value till a while later.

        public VMDataPropertyDescriptor(string name, string description, Attribute[] attrs, VMExtDataType type, int id,
                                        VMEntity obj, VMStackFrame frame, UIBHAVEditor editor)
            : base(name, attrs)
        {
            Type         = type;
            ID           = id;
            Object       = obj;
            Frame        = frame;
            Editor       = editor;
            _Description = description;
        }
Beispiel #14
0
        public override void Undo(BHAV bhav, UIBHAVEditor editor)
        {
            if (Primitive.Type != PrimBoxType.Primitive)
            {
                editor.BHAVView.Primitives.Add(Primitive);
                editor.BHAVView.Add(Primitive);
            }
            else
            {
                var  newInst = new BHAVInstruction[bhav.Instructions.Length + 1];
                byte index   = 0;
                for (int i = 0; i < newInst.Length; i++)
                {
                    if (i == Primitive.InstPtr)
                    {
                        newInst[i] = Primitive.Instruction;
                    }
                    else
                    {
                        var inst = bhav.Instructions[index++];
                        newInst[i] = inst;
                        if (inst.TruePointer < 252 && inst.TruePointer >= Primitive.InstPtr)
                        {
                            inst.TruePointer++;
                        }
                        if (inst.FalsePointer < 252 && inst.FalsePointer >= Primitive.InstPtr)
                        {
                            inst.FalsePointer++;
                        }
                    }
                }

                bhav.Instructions = newInst;
                editor.BHAVView.AddPrimitive(Primitive);
            }

            foreach (var prim in FromTrue)
            {
                prim.TrueUI = Primitive;
                prim.Instruction.TruePointer = Primitive.InstPtr;
            }

            foreach (var prim in FromFalse)
            {
                prim.FalseUI = Primitive;
                prim.Instruction.FalsePointer = Primitive.InstPtr;
            }

            Content.GameContent.Get.Changes.ChunkChanged(bhav);
            SimAntics.VM.BHAVChanged(bhav);
        }
Beispiel #15
0
        public override void Execute(BHAV bhav, UIBHAVEditor editor)
        {
            if (TrueBranch)
            {
                InstUI.Instruction.TruePointer = (DestUI == null)?(byte)253:DestUI.InstPtr;
                InstUI.TrueUI = DestUI;
            }
            else
            {
                InstUI.Instruction.FalsePointer = (DestUI == null) ? (byte)253 : DestUI.InstPtr;
                InstUI.FalseUI = DestUI;
            }

            Content.Content.Get().Changes.ChunkChanged(bhav);
            FSO.SimAntics.VM.BHAVChanged(bhav);
        }
Beispiel #16
0
        public override void Undo(BHAV bhav, UIBHAVEditor editor)
        {
            if (TrueBranch)
            {
                InstUI.Instruction.TruePointer = (OldDestUI == null) ? (byte)253 : OldDestUI.InstPtr;
                InstUI.TrueUI = OldDestUI;
            }
            else
            {
                InstUI.Instruction.FalsePointer = (OldDestUI == null) ? (byte)253 : OldDestUI.InstPtr;
                InstUI.FalseUI = OldDestUI;
            }

            Content.GameContent.Get.Changes.ChunkChanged(bhav);
            SimAntics.VM.BHAVChanged(bhav);
        }
Beispiel #17
0
        public override void Execute(BHAV bhav, UIBHAVEditor editor)
        {
            if (Primitive.Type != PrimBoxType.Primitive)
            {
                editor.BHAVView.Primitives.Remove(Primitive);
                editor.BHAVView.Remove(Primitive);
            }
            else
            {
                var  newInst = new BHAVInstruction[bhav.Instructions.Length - 1];
                byte index   = 0;
                for (int i = 0; i < bhav.Instructions.Length; i++)
                {
                    if (i != Primitive.InstPtr)
                    {
                        var inst = bhav.Instructions[i];
                        newInst[index++] = inst;
                        if (inst.TruePointer < 253 && inst.TruePointer > Primitive.InstPtr)
                        {
                            inst.TruePointer--;
                        }
                        if (inst.FalsePointer < 253 && inst.FalsePointer > Primitive.InstPtr)
                        {
                            inst.FalsePointer--;
                        }
                    }
                }

                bhav.Instructions = newInst;
                editor.BHAVView.RemovePrimitive(Primitive);
            }

            foreach (var prim in FromTrue)
            {
                prim.TrueUI = null;
                prim.Instruction.TruePointer = 253;
            }

            foreach (var prim in FromFalse)
            {
                prim.FalseUI = null;
                prim.Instruction.FalsePointer = 253;
            }
            Content.GameContent.Get.Changes.ChunkChanged(bhav);
            SimAntics.VM.BHAVChanged(bhav);
        }
Beispiel #18
0
        public void InitBHAV(BHAV bhav, EditorScope scope, VMEntity debugEnt, VMStackFrame debugFrame, BHAVPrimSelect callback)
        {
            if (FSOUI == null)
            {
                var mainCont = new UIExternalContainer(1024, 768);
                Editor = new UIBHAVEditor(bhav, scope, debugEnt);
                mainCont.Add(Editor);
                GameFacade.Screens.AddExternal(mainCont);

                SetUI(mainCont);
                Editor.BHAVView.OnSelectedChanged += callback;
            }
            else
            {
                //reuse existing
                lock (FSOUI)
                {
                    Editor.QueueCommand(new ChangeBHAVCommand(bhav, scope, debugFrame, callback));
                }
            }
        }
Beispiel #19
0
        public override void Undo(BHAV bhav, UIBHAVEditor editor)
        {
            if (NewPrimitive.Type != PrimBoxType.Primitive)
            {
                editor.BHAVView.Primitives.Remove(NewPrimitive);
                editor.BHAVView.Remove(NewPrimitive);
            }
            else
            {
                //primitive we added should be at the end
                var newInst = new BHAVInstruction[bhav.Instructions.Length - 1];
                for (int i = 0; i < newInst.Length; i++)
                {
                    newInst[i] = bhav.Instructions[i];
                }

                bhav.Instructions = newInst;
                editor.BHAVView.RemovePrimitive(NewPrimitive);
                Content.GameContent.Get.Changes.ChunkChanged(bhav);
                SimAntics.VM.BHAVChanged(bhav);
            }
        }
Beispiel #20
0
        public override void Execute(BHAV bhav, UIBHAVEditor editor)
        {
            var tree = editor.GetSavableTree();

            if (NewPrimitive.Type != TREEBoxType.Primitive)
            {
                var ptr     = NewPrimitive.TreeBox.TruePointer; //if this is a goto, this will contain the label id
                var comment = NewPrimitive.TreeBox.Comment;
                NewPrimitive.SetTreeBox(tree.MakeNewSpecialBox(NewPrimitive.Type));
                NewPrimitive.TreeBox.TruePointer = ptr;
                NewPrimitive.TreeBox.Comment     = comment;
                NewPrimitive.CopyPosToTree();
                editor.BHAVView.Primitives.Add(NewPrimitive);
                editor.BHAVView.Add(NewPrimitive);
            }
            else
            {
                var newInst = new BHAVInstruction[bhav.Instructions.Length + 1];
                for (int i = 0; i < bhav.Instructions.Length; i++)
                {
                    newInst[i] = bhav.Instructions[i];
                }
                newInst[newInst.Length - 1] = NewPrimitive.Instruction;
                NewPrimitive.SetTreeBox(tree.MakeNewPrimitiveBox(TREEBoxType.Primitive));
                NewPrimitive.CopyPosToTree();

                bhav.Instructions = newInst;
                editor.BHAVView.AddPrimitive(NewPrimitive);
                NewPrimitive.UpdateDisplay();

                Content.Content.Get().Changes.ChunkChanged(bhav);

                FSO.SimAntics.VM.BHAVChanged(bhav);
            }
            Content.Content.Get().Changes.ChunkChanged(tree);
        }
Beispiel #21
0
 public abstract void Execute(BHAV bhav, UIBHAVEditor editor);
Beispiel #22
0
        public override void Undo(BHAV bhav, UIBHAVEditor editor)
        {
            InstUI.Instruction.Breakpoint = !InstUI.Instruction.Breakpoint;

            SimAntics.VM.BHAVChanged(bhav);
        }
        public override void Execute(BHAV bhav, UIBHAVEditor editor)
        {
            var tree = editor.GetSavableTree();

            if (Primitive.Type != TREEBoxType.Primitive)
            {
                if (Primitive.TreeBox.InternalID != -1)
                {
                    tree.DeleteBox(Primitive.TreeBox);
                }
                editor.BHAVView.Primitives.Remove(Primitive);
                editor.BHAVView.Remove(Primitive);
            }
            else
            {
                var  newInst = new BHAVInstruction[bhav.Instructions.Length - 1];
                byte index   = 0;
                for (int i = 0; i < bhav.Instructions.Length; i++)
                {
                    if (i != Primitive.InstPtr)
                    {
                        var inst = bhav.Instructions[i];
                        newInst[index++] = inst;
                        if (inst.TruePointer < 253 && inst.TruePointer > Primitive.InstPtr)
                        {
                            inst.TruePointer--;
                        }
                        if (inst.FalsePointer < 253 && inst.FalsePointer > Primitive.InstPtr)
                        {
                            inst.FalsePointer--;
                        }
                    }
                }

                bhav.Instructions = newInst;
                editor.BHAVView.RemovePrimitive(Primitive);
            }

            foreach (var prim in FromTrue)
            {
                prim.TrueUI = null;
                prim.TreeBox.TruePointer = -1;
                if (prim.Instruction != null)
                {
                    prim.Instruction.TruePointer = 253;
                }
                if (prim.Type == TREEBoxType.Label)
                {
                    editor.BHAVView.UpdateLabelPointers(prim.TreeBox.InternalID);
                }
            }

            foreach (var prim in FromFalse)
            {
                prim.FalseUI = null;
                prim.TreeBox.FalsePointer = -1;
                if (prim.Instruction != null)
                {
                    prim.Instruction.FalsePointer = 253;
                }
                if (prim.Type == TREEBoxType.Label)
                {
                    editor.BHAVView.UpdateLabelPointers(prim.TreeBox.InternalID);
                }
            }
            Content.Content.Get().Changes.ChunkChanged(bhav);
            FSO.SimAntics.VM.BHAVChanged(bhav);
            Content.Content.Get().Changes.ChunkChanged(tree);
        }
        public override void Undo(BHAV bhav, UIBHAVEditor editor)
        {
            var tree = editor.GetSavableTree();

            if (Primitive.Type != TREEBoxType.Primitive)
            {
                //put the tree item back at the end
                if (Primitive.TreeBox.InternalID != -1)
                {
                    tree.InsertRemovedBox(Primitive.TreeBox);
                }
                editor.BHAVView.Primitives.Add(Primitive);
                editor.BHAVView.Add(Primitive);
            }
            else
            {
                var  newInst = new BHAVInstruction[bhav.Instructions.Length + 1];
                byte index   = 0;
                for (int i = 0; i < newInst.Length; i++)
                {
                    if (i == Primitive.InstPtr)
                    {
                        newInst[i] = Primitive.Instruction;
                    }
                    else
                    {
                        var inst = bhav.Instructions[index++];
                        newInst[i] = inst;
                        if (inst.TruePointer < 252 && inst.TruePointer >= Primitive.InstPtr)
                        {
                            inst.TruePointer++;
                        }
                        if (inst.FalsePointer < 252 && inst.FalsePointer >= Primitive.InstPtr)
                        {
                            inst.FalsePointer++;
                        }
                    }
                }

                bhav.Instructions = newInst;
                editor.BHAVView.AddPrimitive(Primitive);
                //insert the tree item
                if (Primitive.TreeBox.InternalID != -1)
                {
                    tree.InsertRemovedBox(Primitive.TreeBox);
                }
            }

            foreach (var prim in FromTrue)
            {
                prim.TrueUI = Primitive;
                prim.TreeBox.TruePointer = Primitive.TreeBox.InternalID;
                if (prim.Instruction != null)
                {
                    prim.Instruction.TruePointer = Primitive.InstPtr;
                }
                if (prim.Type == TREEBoxType.Label)
                {
                    editor.BHAVView.UpdateLabelPointers(prim.TreeBox.InternalID);
                }
            }

            foreach (var prim in FromFalse)
            {
                prim.FalseUI = Primitive;
                prim.TreeBox.FalsePointer = Primitive.TreeBox.InternalID;
                if (prim.Instruction != null)
                {
                    prim.Instruction.FalsePointer = Primitive.InstPtr;
                }
                if (prim.Type == TREEBoxType.Label)
                {
                    editor.BHAVView.UpdateLabelPointers(prim.TreeBox.InternalID);
                }
            }

            Content.Content.Get().Changes.ChunkChanged(bhav);
            FSO.SimAntics.VM.BHAVChanged(bhav);
            Content.Content.Get().Changes.ChunkChanged(tree);
        }
Beispiel #25
0
 public abstract void Undo(BHAV bhav, UIBHAVEditor editor);
Beispiel #26
0
 public override void Undo(BHAV bhav, UIBHAVEditor editor)
 {
     editor.BHAVView.OnSelectedChanged -= SelectCallback;
     editor.SwitchBHAV(Old, OldScope, OldFrame);
     editor.BHAVView.OnSelectedChanged += SelectCallback;
 }