From f3d19dc1a16e9e240df6e3fafb7cd37678fcef8b Mon Sep 17 00:00:00 2001 From: "Michael \"Z\" Goddard" Date: Mon, 26 Mar 2018 15:32:05 -0400 Subject: [PATCH] Use videoSensing extension for sb2 senseVideoMotion --- src/serialization/sb2.js | 16 ++++++++++++ src/serialization/sb2_specmap.js | 45 +++++++++++++++++++++----------- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index cce5bb04b..2bc0ff3cb 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -562,6 +562,22 @@ const parseBlock = function (sb2block, addBroadcastMsg, getVariableId, extension if (shadowObscured) { fieldValue = 1; } + } else if (expectedArg.inputOp === 'videoSensing.menu.MOTION_DIRECTION') { + if (shadowObscured) { + fieldValue = 1; + } else if (fieldValue === 'motion') { + fieldValue = 1; + } else if (fieldValue === 'direction') { + fieldValue = 2; + } + } else if (expectedArg.inputOp === 'videoSensing.menu.STAGE_SPRITE') { + if (shadowObscured) { + fieldValue = 2; + } else if (fieldValue === 'Stage') { + fieldValue = 1; + } else if (fieldValue === 'this sprite') { + fieldValue = 2; + } } else if (shadowObscured) { // Filled drop-down menu. fieldValue = ''; diff --git a/src/serialization/sb2_specmap.js b/src/serialization/sb2_specmap.js index 637ccbab9..e302b68c4 100644 --- a/src/serialization/sb2_specmap.js +++ b/src/serialization/sb2_specmap.js @@ -609,6 +609,21 @@ const specMap = { } ] }, + 'senseVideoMotion': { + opcode: 'videoSensing.videoOn', + argMap: [ + { + type: 'input', + inputOp: 'videoSensing.menu.MOTION_DIRECTION', + inputName: 'MOTION_DIRECTION' + }, + { + type: 'input', + inputOp: 'videoSensing.menu.STAGE_SPRITE', + inputName: 'STAGE_SPRITE' + } + ] + }, 'whenGreenFlag': { opcode: 'event_whenflagclicked', argMap: [ @@ -905,21 +920,21 @@ const specMap = { argMap: [ ] }, - 'senseVideoMotion': { - opcode: 'sensing_videoon', - argMap: [ - { - type: 'input', - inputOp: 'sensing_videoonmenuone', - inputName: 'VIDEOONMENU1' - }, - { - type: 'input', - inputOp: 'sensing_videoonmenutwo', - inputName: 'VIDEOONMENU2' - } - ] - }, + // 'senseVideoMotion': { + // opcode: 'sensing_videoon', + // argMap: [ + // { + // type: 'input', + // inputOp: 'sensing_videoonmenuone', + // inputName: 'VIDEOONMENU1' + // }, + // { + // type: 'input', + // inputOp: 'sensing_videoonmenutwo', + // inputName: 'VIDEOONMENU2' + // } + // ] + // }, 'setVideoState': { opcode: 'sensing_videotoggle', argMap: [