Skip to content

Commit 5b027b9

Browse files
committed
Fix motion_turnleft and motion_turnright missing type casts
1 parent e1ad53e commit 5b027b9

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

src/compiler/irgen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,14 +865,14 @@ class ScriptTreeGenerator {
865865
return new IntermediateStackBlock(StackOpcode.MOTION_DIRECTION_SET, {
866866
direction: new IntermediateInput(InputOpcode.OP_SUBTRACT, InputType.NUMBER, {
867867
left: new IntermediateInput(InputOpcode.MOTION_DIRECTION_GET, InputType.NUMBER),
868-
right: this.descendInputOfBlock(block, 'DEGREES')
868+
right: this.descendInputOfBlock(block, 'DEGREES').toType(InputType.NUMBER)
869869
})
870870
});
871871
case 'motion_turnright':
872872
return new IntermediateStackBlock(StackOpcode.MOTION_DIRECTION_SET, {
873873
direction: new IntermediateInput(InputOpcode.OP_ADD, InputType.NUMBER, {
874874
left: new IntermediateInput(InputOpcode.MOTION_DIRECTION_GET, InputType.NUMBER),
875-
right: this.descendInputOfBlock(block, 'DEGREES')
875+
right: this.descendInputOfBlock(block, 'DEGREES').toType(InputType.NUMBER)
876876
})
877877
});
878878

Binary file not shown.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// TW Snapshot
2+
// Input SHA-256: 0a7a3ee1aac2ba5b063f53b742ef992e395ee668efa9205279f93f1949e8a755
3+
4+
// Sprite1 script
5+
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
6+
const b0 = runtime.getOpcodeFunction("looks_say");
7+
return function* genXYZ () {
8+
yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "e", null);
9+
target.setDirection(90);
10+
target.setDirection((target.direction + 0.25));
11+
target.setDirection((target.direction + 0.25));
12+
if ((target.direction === 90.5)) {
13+
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null);
14+
}
15+
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null);
16+
retire(); return;
17+
}; })
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// TW Snapshot
2+
// Input SHA-256: 0a7a3ee1aac2ba5b063f53b742ef992e395ee668efa9205279f93f1949e8a755
3+
4+
// Sprite1 script
5+
(function factoryXYZ(thread) { const target = thread.target; const runtime = target.runtime; const stage = runtime.getTargetForStage();
6+
const b0 = runtime.getOpcodeFunction("looks_say");
7+
return function* genXYZ () {
8+
yield* executeInCompatibilityLayer({"MESSAGE":"plan 1",}, b0, false, false, "e", null);
9+
target.setDirection(90);
10+
target.setDirection((target.direction + 0.25));
11+
target.setDirection((target.direction + 0.25));
12+
if ((target.direction === 90.5)) {
13+
yield* executeInCompatibilityLayer({"MESSAGE":"pass",}, b0, false, false, "i", null);
14+
}
15+
yield* executeInCompatibilityLayer({"MESSAGE":"end",}, b0, false, false, "h", null);
16+
retire(); return;
17+
}; })

0 commit comments

Comments
 (0)