Esempio n. 1
0
        public static VMPrimitiveExitCode EvaluateCheck(VMContext context, VMEntity entity, VMStackFrame initFrame, VMQueuedAction action, List <VMPieMenuInteraction> actionStrings)
        {
            var temp       = new VMThread(context, entity, 5);
            var forceClone = !context.VM.Scheduler.RunningNow;

            //temps should only persist on check trees running within the vm tick to avoid desyncs.
            if (entity.Thread != null)
            {
                temp.TempRegisters = forceClone?(short[])entity.Thread.TempRegisters.Clone() : entity.Thread.TempRegisters;
                temp.TempXL        = forceClone ? (int[])entity.Thread.TempXL.Clone() : entity.Thread.TempXL;
            }
            temp.IsCheck       = true;
            temp.ActionStrings = actionStrings; //generate and place action strings in here
            temp.Push(initFrame);
            if (action != null)
            {
                temp.Queue.Add(action);                              //this check runs an action. We may need its interaction number, etc.
            }
            while (temp.Stack.Count > 0 && temp.DialogCooldown == 0) //keep going till we're done! idling is for losers!
            {
                temp.Tick();
                temp.ThreadBreak = VMThreadBreakMode.Active; //cannot breakpoint in check trees
            }
            if (context.VM.Aborting)
            {
                return(VMPrimitiveExitCode.ERROR);
            }
            return((temp.DialogCooldown > 0) ? VMPrimitiveExitCode.RETURN_FALSE : temp.LastStackExitCode);
        }
Esempio n. 2
0
 public static VMPrimitiveExitCode EvaluateCheck(VMContext context, VMEntity entity, VMQueuedAction action)
 {
     var temp = new VMThread(context, entity, 5);
     temp.IsCheck = true;
     temp.EnqueueAction(action);
     while (temp.Queue.Count > 0 && temp.DialogCooldown == 0) //keep going till we're done! idling is for losers!
     {
         temp.Tick();
     }
     return (temp.DialogCooldown > 0) ? VMPrimitiveExitCode.ERROR:temp.LastStackExitCode;
 }
Esempio n. 3
0
 public static VMPrimitiveExitCode EvaluateCheck(VMContext context, VMEntity entity, VMStackFrame initFrame, VMQueuedAction action, List<VMPieMenuInteraction> actionStrings)
 {
     var temp = new VMThread(context, entity, 5);
     if (entity.Thread != null)
     {
         temp.TempRegisters = entity.Thread.TempRegisters;
         temp.TempXL = entity.Thread.TempXL;
     }
     temp.IsCheck = true;
     temp.ActionStrings = actionStrings; //generate and place action strings in here
     temp.Push(initFrame);
     if (action != null) temp.Queue.Add(action); //this check runs an action. We may need its interaction number, etc.
     while (temp.Stack.Count > 0 && temp.DialogCooldown == 0) //keep going till we're done! idling is for losers!
     {
         temp.Tick();
         temp.ThreadBreak = VMThreadBreakMode.Active; //cannot breakpoint in check trees
     }
     return (temp.DialogCooldown > 0) ? VMPrimitiveExitCode.ERROR:temp.LastStackExitCode;
 }
Esempio n. 4
0
        public static VMPrimitiveExitCode EvaluateCheck(VMContext context, VMEntity entity, VMQueuedAction action, List <VMPieMenuInteraction> actionStrings)
        {
            var temp = new VMThread(context, entity, 5);

            if (entity.Thread != null)
            {
                temp.TempRegisters = entity.Thread.TempRegisters;
                temp.TempXL        = entity.Thread.TempXL;
            }
            temp.IsCheck       = true;
            temp.ActionStrings = actionStrings;                      //generate and place action strings in here
            temp.EnqueueAction(action);
            while (temp.Queue.Count > 0 && temp.DialogCooldown == 0) //keep going till we're done! idling is for losers!
            {
                temp.Tick();
                temp.ThreadBreak = VMThreadBreakMode.Active; //cannot breakpoint in check trees
            }
            return((temp.DialogCooldown > 0) ? VMPrimitiveExitCode.ERROR:temp.LastStackExitCode);
        }
Esempio n. 5
0
 public VMStackFrame(VMStackFrameMarshal input, VMContext context, VMThread thread)
 {
     Thread = thread;
     Load(input, context);
 }
Esempio n. 6
0
 public VMRoutingFrame(VMStackFrameMarshal input, VMContext context, VMThread thread)
 {
     Thread = thread;
     Load(input, context);
 }
Esempio n. 7
0
        public virtual void Init(VMContext context)
        {
            GenerateTreeByName(context);
            if (!GhostImage) this.Thread = new VMThread(context, this, this.Object.OBJ.StackSize);

            ExecuteEntryPoint(0, context, true); //Init

            if (!GhostImage)
            {
                short[] Args = null;
                VMEntity StackOBJ = null;
                if (MainParam != 0)
                {
                    Args = new short[4];
                    Args[0] = MainParam;
                    MainParam = 0;
                }
                if (MainStackOBJ != 0)
                {
                    StackOBJ = context.VM.GetObjectById(MainStackOBJ);
                    MainStackOBJ = 0;
                }

                ExecuteEntryPoint(1, context, false, StackOBJ, Args); //Main
            }
        }
Esempio n. 8
0
        public virtual void Init(VMContext context)
        {
            GenerateTreeByName(context);
            if (!GhostImage) this.Thread = new VMThread(context, this, this.Object.OBJ.StackSize);

            ExecuteEntryPoint(0, context, true); //Init

            if (!GhostImage)
            {
                short[] Args = null;
                VMEntity StackOBJ = null;
                if (MainParam != 0)
                {
                    Args = new short[4];
                    Args[0] = MainParam;
                    MainParam = 0;
                }
                if (MainStackOBJ != 0)
                {
                    StackOBJ = context.VM.GetObjectById(MainStackOBJ);
                    MainStackOBJ = 0;
                }

                ExecuteEntryPoint(1, context, false, StackOBJ, Args); //Main
            }
            else
            {
                SetValue(VMStackObjectVariable.Room, -1);
                if (this is VMGameObject) ((VMGameObject)this).RefreshLight();
            }
        }