@@ -21,6 +21,7 @@ void Compiler::compile(std::shared_ptr<Block> topLevelBlock)
2121 m_bytecode.clear ();
2222 m_procedurePrototype = nullptr ;
2323 m_atomic = true ;
24+ m_warp = false ;
2425
2526 // Add start instruction
2627 addInstruction (OP_START);
@@ -184,12 +185,20 @@ void Compiler::moveToSubstack(std::shared_ptr<Block> substack, SubstackType type
184185/* !
185186 * Adds the vm::OP_BREAK_ATOMIC instruction at the end of the current loop.
186187 * This can be used for example in motion blocks.
188+ * \note Nothing will happen if the script is set to run without screen refresh.
187189 */
188190void Compiler::breakAtomicScript ()
189191{
190192 m_atomic = false ;
191193}
192194
195+ /* ! Makes current script run without screen refresh. */
196+ void Compiler::warp ()
197+ {
198+ m_warp = true ;
199+ addInstruction (vm::OP_WARP);
200+ }
201+
193202/* ! Returns the input with the given ID. */
194203Input *Compiler::input (int id) const
195204{
@@ -231,6 +240,7 @@ unsigned int Compiler::listIndex(std::shared_ptr<IEntity> listEntity)
231240 return m_lists.size () - 1 ;
232241}
233242
243+ /* ! Returns the index of the given constant input value. */
234244unsigned int Compiler::constIndex (InputValue *value)
235245{
236246 auto it = std::find (m_constValues.begin (), m_constValues.end (), value);
@@ -271,7 +281,8 @@ void Compiler::substackEnd()
271281 switch (parent.second ) {
272282 case SubstackType::Loop:
273283 if (!m_atomic) {
274- addInstruction (OP_BREAK_ATOMIC);
284+ if (!m_warp)
285+ addInstruction (OP_BREAK_ATOMIC);
275286 m_atomic = true ;
276287 }
277288 addInstruction (OP_LOOP_END);
0 commit comments