Commit graph

545 commits

Author SHA1 Message Date
Paul Kaplan
6531dbc2fe Add logger (thanks linter) 2017-03-27 15:12:25 -04:00
Paul Kaplan
df44134e1c Use costume loading from importer in public costume and backdrop loader 2017-03-27 15:04:44 -04:00
Eric Rosenbaum
b74c03dbbd Loudness returns -1 if no audio engine exists
To match Scratch 2.0 behavior
2017-03-27 13:20:44 -04:00
Eric Rosenbaum
1ec1165905 Audio engine decodes sounds 2017-03-27 11:56:28 -04:00
Eric Rosenbaum
2303a1abc5 Remove call to loadSounds from rendered-target initDrawable 2017-03-27 11:56:28 -04:00
Chris Willis-Ford
c8b4871b19 Merge pull request #498 from cwillisf/use-scratch-storage
Load projects & costumes through scratch-storage
2017-03-23 22:10:25 -07:00
Christopher Willis-Ford
10cb97c52e Report missing storage module as an error 2017-03-23 16:03:32 -07:00
Silly Inventor
77775cdadb Switch to using number directly, instead of toNumber for costume switch (#499) 2017-03-23 18:34:04 -04:00
griffpatch
c754cc7cf8 Remove line break 2017-03-22 09:11:53 +00:00
griffpatch
220d854f28 Merge remote-tracking branch 'refs/remotes/LLK/develop' into optimise/reduceGetBlockCalls
# Conflicts:
#	src/engine/execute.js
2017-03-22 08:58:01 +00:00
griffpatch
25429b1192 Tidy up commit and revert direct member access 2017-03-22 08:48:30 +00:00
griffpatch
a5ce0f60cf Merge remote-tracking branch 'refs/remotes/LLK/develop' into optimise/reduceGetBlockCalls 2017-03-22 07:56:04 +00:00
Eric Rosenbaum
144c587e78 Merge pull request #507 from ericrosenbaum/bugfix/clamp-audio-inputs
Clamp audio inputs
2017-03-21 17:48:10 -04:00
Eric Rosenbaum
b4a94c266f Add loudness block 2017-03-20 17:01:44 -04:00
Eric Rosenbaum
106db6a024 Clamp range for each audio effect 2017-03-20 14:53:04 -04:00
Paul Kaplan
8bbb395b35 Add sprite name incrementing and reserved naming 2017-03-20 12:52:57 -04:00
Paul Kaplan
052ecef91c Add string utils with tests 2017-03-20 12:12:38 -04:00
Paul Kaplan
5d2352e471 Add test for skipping rename on blank input 2017-03-20 11:14:25 -04:00
Eric Rosenbaum
c9338f37ed Clamp tempo range
The function in AudioEngine for change tempo can now be removed
2017-03-17 18:13:33 -04:00
Eric Rosenbaum
f2ac365859 Clamp beat durations for play note, play drum and rest 2017-03-17 17:29:23 -04:00
Eric Rosenbaum
1ba7ad0218 Clamp range for “play note” input
Clamp to 36-96, which is C2-C7.

This is a temporary fix to prevent errors, until we have a new instrument player implementation, which may have a different range.
2017-03-17 17:23:53 -04:00
Chris Willis-Ford
3d7f1187e5 Merge branch 'develop' into use-scratch-storage 2017-03-13 15:48:21 -07:00
Christopher Willis-Ford
c945b37288 Fix lint, missing require 2017-03-13 15:44:13 -07:00
Christopher Willis-Ford
6ad0f3351b Check if storage module is present before using it 2017-03-13 15:06:28 -07:00
Christopher Willis-Ford
e4fd9d57a2 Fix tests involving scratch-storage
- Attach the storage module to the VM for tests which load projects or
  other assets.
- Move `import_sb2.js` from `test/unit/ into `test/integration` since it
  now depends heavily on `scratch-storage`.
- Skip loading costumes when there is no renderer.
2017-03-09 15:50:43 -08:00
Ray Schamp
b03768cad6 Remove filter toolbox utility (#496)
* Revert "Merge pull request #486 from rschamp/fix-filter-tests"

This reverts commit ba00db897f, reversing
changes made to 739c5deb63.

* Revert "Show Categories that use custom code to load (variables, procedures) (#483)"

This reverts commit 739c5deb63.

* Revert "Merge pull request #461 from rschamp/filter-toolbox"

This reverts commit 343b5bfe8e, reversing
changes made to 370f2c6a47.
2017-03-09 16:41:06 -05:00
Christopher Willis-Ford
c23e9c6bf8 Load projects & costumes through scratch-storage
This also sets up the framework to load sounds through scratch-storage,
to be finished in a later change.
2017-03-09 11:25:55 -08:00
Paul Kaplan
2ebb112d30 Merge pull request #495 from paulkaplan/fix-target-id
Add check to make sure `target` exists
2017-03-08 12:13:10 -05:00
Paul Kaplan
8aaadf2fab Add check to make sure target exists 2017-03-08 11:40:02 -05:00
Paul Kaplan
5b82096670 Clear gfx on stop all 2017-03-06 15:54:52 -05:00
Ray Schamp
bf2303f6de Merge pull request #490 from rschamp/dnd
Add methods for dragging and dropping sprites
2017-03-03 09:50:34 -05:00
Ray Schamp
d0cd9cd897 Add methods for dragging and dropping sprites
* Add `getTargetIdForDrawableId` to translate between renderer picks and VM targets
* Add `startDrag` to stop sprite motion while dragging
* Add `stopDrag` to return sprite motion after dragging
2017-03-03 09:43:31 -05:00
Ray Schamp
319f27a060 Merge pull request #487 from rschamp/draggability
Add draggable property to sprites
2017-03-02 15:56:12 -05:00
Ray Schamp
11e28111c5 Activate click hats on mouse up to match 2.0 2017-03-02 11:32:10 -05:00
Andrew Sliwinski
a4578ba086 Default bitmapResolution to 1 if not provided in costume metadata (#485)
* Default bitmapResolution to 1 if not provided in costume metadata. Resolves GH-484
2017-03-02 11:21:01 -05:00
Ray Schamp
8dadc42857 Add draggable property to sprites
This property should be managed by the VM so that it can be displayed in the sprite info panel in the GUI.
2017-03-01 18:49:17 -05:00
Andrew Sliwinski
7042bdb45c Merge pull request #472 from griffpatch/bug/escapeFromConditionalBranches
Bug - escapeFromConditionalBranches
2017-03-01 16:42:30 -05:00
TheBrokenRail
739c5deb63 Show Categories that use custom code to load (variables, procedures) (#483) 2017-03-01 09:25:11 -05:00
Ray Schamp
390b2373e9 Refactor filter methods into util 2017-02-27 12:57:38 -05:00
Ray Schamp
a9b495fced Filter the playground toolbox 2017-02-27 12:57:38 -05:00
Ray Schamp
99e1b24285 Add rudimentary toolbox filtering method 2017-02-27 12:57:38 -05:00
Ray Schamp
370f2c6a47 Merge pull request #459 from griffpatch/feature/FencingAgain
Feature fencing again
2017-02-24 11:27:10 -05:00
Chris Willis-Ford
a56db95aba Merge pull request #446 from magmaboat/hasownproperty
Perform hasOwnProperty validation
2017-02-22 13:55:54 -08:00
griffpatch
c5eb8ece16 Handle actual looping cases
And it starts to get a little less elegant :/
Wondering if this should not be handled better in another part of the
codebase?
We don't want to be duplicating existing code stepping functionality
locally at the end of the promise script really... What do you think?
2017-02-20 09:40:32 +00:00
griffpatch
362a231279 bug - escape from conditional branches
Execution bug: can't escape from conditional branches that end with a
Promise-resolution-terminating command block (see #464)
2017-02-20 08:20:21 +00:00
griffpatch
a141bfb1b9 Fix lint issues 2017-02-16 10:54:17 +00:00
griffpatch
7bc141e76e Feature Fencing
This is a re-comit after the previous pull was reverted.
2017-02-15 15:59:54 +00:00
Ray Schamp
39158c9d48 Revert "Feature fencing" 2017-02-15 09:40:10 -05:00
griffpatch
75e3f6002b Fencing - Take 3
Dependant on scratch-render pull request.
2017-02-14 09:12:35 +00:00
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
griffpatch
75a1542fc3 Merge remote-tracking branch 'refs/remotes/origin/develop' into optimise/reduceGetBlockCalls 2017-02-11 15:39:33 +00:00
griffpatch
9aa81d6776 Merge remote-tracking branch 'refs/remotes/LLK/develop' into feature/fencing 2017-02-11 14:30:59 +00:00
griffpatch
4d63dcac3b Rename fencing method 2017-02-11 14:30:18 +00:00
griffpatch
ea59f8cd66 Reduce calls to getBlock 2017-02-11 14:26:23 +00: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
Magmaboat
85eee4f18e Perform hasOwnProperty validation 2017-02-09 21:12:47 -05: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
464722f7bd Feature - Fencing of sprites
This change requires that the pull request for scratch-render (Feature
fencing #82) be taken first
2017-02-09 10:02:45 +00: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