public void InternalTick(uint tickID) { Scheduler.BeginTick(tickID); if (GlobalLink != null) { GlobalLink.Tick(this); } if (EODHost != null) { EODHost.Tick(); } Context.Clock.Tick(); GlobalState[6] = (short)Context.Clock.Seconds; GlobalState[5] = (short)Context.Clock.Minutes; GlobalState[0] = (short)Context.Clock.Hours; GlobalState[4] = (short)Context.Clock.TimeOfDay; Context.Architecture.Tick(); if (!UseSchedule) { var entCpy = Entities.ToArray(); foreach (var obj in entCpy) { Context.NextRandom(1); obj.Tick(); //run object specific tick behaviors, like lockout count decrement #if VM_DESYNC_DEBUG if (obj.Thread != null) { foreach (var item in obj.Thread.Stack) { Context.NextRandom(1); if (item is VMRoutingFrame) { Trace.Trace(obj.ObjectID + "(" + Context.RandomSeed + "): " + "VMRoutingFrame with state: " + ((VMRoutingFrame)item).State.ToString()); } else { var opcode = item.GetCurrentInstruction().Opcode; var primitive = (opcode > 255) ? null : Context.Primitives[opcode]; Trace.Trace(obj.ObjectID + "(" + Context.RandomSeed + "): " + item.Routine.Rti.Name.TrimEnd('\0') + ':' + item.InstructionPointer + " (" + ((primitive == null) ? opcode.ToString() : primitive.Name) + ")"); } } } #endif } } else { Scheduler.RunTick(); } //Context.SetToNextCache.VerifyPositions(); use only for debug! }
public void InternalTick(uint tickID) { Scheduler.BeginTick(tickID); if (GlobalLink != null) { GlobalLink.Tick(this); } if (EODHost != null) { EODHost.Tick(); } if (SpeedMultiplier > 0) { var lastHour = Context.Clock.Hours; Context.Clock.Tick(); if (lastHour != Context.Clock.Hours && Context.Clock.Hours % 6 == 0) { ProcessQTRDay(); } } Context.Architecture.Tick(); if (SpeedMultiplier < 0) { return; } if (!UseSchedule) //scheduleless mode is still useful for desync debug. { var entCpy = Entities.ToArray(); foreach (var obj in entCpy) { //Context.NextRandom(1); obj.Tick(); //run object specific tick behaviors, like lockout count decrement if (obj.Thread != null && Trace != null) { foreach (var item in obj.Thread.Stack) { Context.NextRandom(1); if (item is VMRoutingFrame) { Trace.Trace(obj.ObjectID + "(" + Context.RandomSeed + "): " + "VMRoutingFrame with state: " + ((VMRoutingFrame)item).State.ToString()); } else { var opcode = item.GetCurrentInstruction().Opcode; var primitive = (opcode > 255) ? null : VMContext.Primitives[opcode]; Trace.Trace(obj.ObjectID + "(" + Context.RandomSeed + "): " + item.Routine.Rti.Name.TrimEnd('\0') + ':' + item.InstructionPointer + " (" + ((primitive == null) ? opcode.ToString() : primitive.Name) + ")"); } } } } } else { Scheduler.RunTick(); } if (tickID % Math.Max(1, SpeedMultiplier) == 0) { Context.ProcessLightingChanges(); } //Context.SetToNextCache.VerifyPositions(); use only for debug! }