예제 #1
0
 public override void Execute(BHAV bhav, UIBHAVEditor editor)
 {
     Prim.Instruction.Operand = NewOp;
     Prim.UpdateDisplay();
     Content.GameContent.Get.Changes.ChunkChanged(bhav);
     SimAntics.VM.BHAVChanged(bhav);
 }
예제 #2
0
        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);
            }
        }
예제 #3
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);
        }