Commit graph

440 commits

Author SHA1 Message Date
Christopher Willis-Ford
18107cde7b Reverse target iteration in allScriptsDo
The `allStacksAndOwnersDo` function in Scratch 2.0 runtime iterates
targets in reverse and projects sometimes rely on that for correct
initialization. If, for example, each sprite runs a "go back 999 layers"
or "go to front" block as its first action, the order of execution will
determine the ordering of the layers.

This change makes Scratch 3.0 match the Scratch 2.0 execution order.
2017-02-13 14:45:29 -08:00
Christopher Willis-Ford
bd76395676 Minor cleanup around cloning methods 2017-02-13 14:44:51 -08:00
Christopher Willis-Ford
243d68f88b Use Webpack to generate the whole playground
The previous configuration mixed Webpack output with static content in
order to create the playground. This change moves that static content
from `/playground/` into `/src/playground/` and adds a Webpack rule to
copy it into the playground as part of the build.

On the surface this might seem unnecessary, but it provides at least two
benefits:
- It's no longer possible to accidentally load stale build output
  through `webpack-dev-server` in the event of a misconfiguration. This
  was very easy in the previous configuration, and might in fact be the
  only way that `webpack-dev-server` ever worked for this repository.
- It's simpler to ensure that various rules apply to the hand-authored
  content and not build outputs. This includes lint rules, `.gitignore`,
  IDE symbol search paths, etc.
2017-02-10 14:21:37 -08:00
Eric Rosenbaum
99be466aa7 Merge pull request #444 from ericrosenbaum/bugfix/playnote-volume
Pass volume to audioengine playnote
2017-02-10 14:09:55 -05:00
Ray Schamp
fb181d5ce3 Merge pull request #447 from CSnap/fix_keyPressToUpperCase
Switch From Return Null to Return Empty String in keyCodeToScratchKey
2017-02-10 14:00:50 -05:00
griffpatch
246ff28363 Merge remote-tracking branch 'refs/remotes/LLK/develop' into bug/WhiteSpaceEqualsZero 2017-02-10 08:02:43 +00:00
griffpatch
ad5bc1afbd Pull white space checks into function
Clean up code by pulling white space checks into a seperate helper
function
2017-02-10 08:02:11 +00:00
griffpatch
338b2f3458 Merge remote-tracking branch 'refs/remotes/LLK/develop' into bug/WhiteSpaceEqualsZero 2017-02-10 07:43:44 +00:00
Eric Rosenbaum
cd750b5dda pass volume to audioengine playnote 2017-02-09 14:52:15 -05:00
SillyInventor
8354774fcf Switch from return null to return empty string in keyCodeToScratchKey 2017-02-09 14:09:01 -05:00
Chris Willis-Ford
cde9ebd6bf Merge pull request #442 from griffpatch/bug/PenColorOpacity
Bug pen opacity reset
2017-02-09 07:53:15 -08:00
Andrew Sliwinski
4bb5f30bd8 Merge pull request #410 from griffpatch/optimisation/only-check-for-compatability-once
Optimisation - Only check browser compatability once
2017-02-09 08:17:51 -05:00
Andrew Sliwinski
d650e5393e Merge pull request #439 from griffpatch/bug/StopThisScript
Implement "Stop this script" function
2017-02-09 08:10:00 -05:00
griffpatch
a6c56a6e20 Merge remote-tracking branch 'refs/remotes/LLK/develop' into bug/PenColorOpacity 2017-02-09 08:51:10 +00:00
griffpatch
2ba177aa0f Bug - Return pen opacity to opaque
When setting the pen color using pen blocks, the opacity should be reset
to fully opaque if no alpha is supplied.
2017-02-09 08:50:37 +00:00
griffpatch
276ae82769 Fixes Case Insensitive Broadcast Bug
Broadcasts are case sensitive #433
2017-02-08 10:05:48 +00:00
griffpatch
9cb595312e Implement "Stop this script" function
Existing implementation incorrectly terminates the entire thread.
See: http://llk.github.io/scratch-vm/#144142535
2017-02-08 09:44:10 +00:00
griffpatch
cf215bf0bc Fix for the "Empty or white space strings equal 0" bug
See: Empty or white space strings equal 0 #435
2017-02-08 08:38:50 +00:00
griffpatch
7d69ecc005 Optimisation - Only check browser compatability once
Disable use of more accurate timer temporarilly due to performance.
However, with the rearrange and introduction of the 'nowObj' it turns
out most of the delay is in resolving 'self.performance'... so keeping
this cached in nowObj actually mitigates most of the delay.
2017-02-08 08:11:10 +00:00
griffpatch
57c222e94f Merge remote-tracking branch 'refs/remotes/LLK/develop' into optimisation/only-check-for-compatability-once 2017-02-08 08:04:47 +00:00
Andrew Sliwinski
92ff57de7d Add basic test coverage for the sound blocks 2017-02-03 17:39:36 -05:00
Eric Rosenbaum
9741dc2e35 Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound 2017-02-02 16:37:07 -05:00
Ray Schamp
727fcc7875 Lint for eslint-config-scratch@3 2017-02-01 16:27:55 -05:00
Eric Rosenbaum
0947775a31 Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound 2017-02-01 10:18:01 -05:00
SillyInventor
1ac89f5aa4 Added new util function that sends tan function infinities correctly
Changed mathop to call new math util
Changed sin & cos to round correctly (to get 0)
Added testing for the new math util function
Added testing for the new mathop functions
2017-01-31 19:05:54 -05:00
Eric Rosenbaum
53127f6320 use customstate for sound volume, instrument, effects 2017-01-31 18:33:32 -05:00
Eric Rosenbaum
95e29ed66a move sound-related code out of rendered target 2017-01-31 18:32:46 -05:00
Andrew Sliwinski
fff63e3af2 Merge pull request #414 from thisandagain/bugfix/413
Bugfix - Continue import if opcode is not found during SB2 import
2017-01-30 15:36:24 -05:00
Andrew Sliwinski
c2a488a197 Merge pull request #408 from griffpatch/optimisation/avoid-negative-index-lookups
Optimisation - Avoid negative index lookups #407
2017-01-30 15:06:02 -05:00
Andrew Sliwinski
249c0d6dca Merge pull request #409 from griffpatch/optimisation/remove-redundant-lookups
Optimisation - Remove redunant lookups
2017-01-30 15:04:42 -05:00
Andrew Sliwinski
7c18b33f99 Continue import if opcode is not found during SB2 import. Resolves GH-413 2017-01-30 14:32:32 -05:00
Eric Rosenbaum
2d8491123e Merge branch 'develop' of https://github.com/LLK/scratch-vm into sound 2017-01-30 11:28:52 -05:00
Eric Rosenbaum
dd30e07052 comments on getSoundIndex 2017-01-30 10:56:50 -05:00
Eric Rosenbaum
9d8819ddc7 audio engine handles rest block 2017-01-30 10:56:31 -05:00
Eric Rosenbaum
cb4209b27a target handles playnote via audio engine 2017-01-30 10:56:06 -05:00
Eric Rosenbaum
5966a46bbd target manages instrument setting 2017-01-30 10:54:24 -05:00
Eric Rosenbaum
4e4b0b86e1 target manages audio effect values 2017-01-30 10:53:12 -05:00
Eric Rosenbaum
01e237a2d5 audio engine loads all sounds 2017-01-30 10:50:28 -05:00
Eric Rosenbaum
4e57ab561d move playsound function to target 2017-01-30 10:45:15 -05:00
Eric Rosenbaum
d5e0d433aa include md5 in sprite sound object 2017-01-30 10:43:28 -05:00
griffpatch
fbf2c0c345 Optimisation - Recycle Stack Frame for cosecutive blocks
This saves popping, destroying, recreating, and pushing the stack frame,
and then reassigning the warp mode attribute for every block to block
step in the execution.
2017-01-28 17:06:07 +00:00
griffpatch
bd405ecc4a Optimisation - Only check browser compatability once
This saves doing the checks everytime the time functions are referenced
2017-01-28 16:43:37 +00:00
griffpatch
76c9c993f2 Optimisation - Remove redunant lookups
It's surprising how much time it takes to do an object member lookup, so
reducing these is a great idea.
2017-01-28 16:33:20 +00:00
Andrew Sliwinski
824628220c Merge pull request #406 from griffpatch/bugfix/end-warp-bug
Runtime does not exit warp mode if at end of loop #398
2017-01-28 09:56:04 -05:00
griffpatch
bd9159b9fb More negative index checks 2017-01-28 14:39:22 +00:00
griffpatch
a25e117412 optimisation/avoid negative index lookups #407
Run-time Optimisation

The thread.stackFrames array is accessed all the time to retrieve the
'parent' stack frame. This is done using as index of [this.stack.length
- 1]. However, a lot of the time this evaluated to [-1]. Although this
results in null, which is fine, to get to this javascript actually
defers from a numeric array lookup to an object lookup using the string
"-1". This is roughly 100 times slower to compute and so a simple catch
for negative indexes is well worth the extra check.
2017-01-28 14:38:13 +00:00
griffpatch
c6a872ef4a Fix whitespace issues 2017-01-28 14:11:48 +00:00
griffpatch
5f100129b6 Fix for ending warp bug
When popping down the stack frame it is assumed that you keep using the
previous warp state rather than looking at the warp state of the level
you just popped out to. This causes the loss of screen updates if the
warping block was the last statement in a loop as the loop does not obey
it's 'non warp' status.
2017-01-28 14:03:29 +00:00
Andrew Sliwinski
de4035055b Merge pull request #403 from griffpatch/feature/Support-ARGB-for-pen
Fix for Support ARGB for pen #393
2017-01-27 17:07:43 -05:00
griffpatch
0dcaa46107 Fix lint issues
Had to update the test scripts to handle the alpha channel, also I note
that all the hex tests are using CSS notation, not scratch notation
(which is 0x not #)
2017-01-27 17:05:17 +00:00