Rearranged/sorted story format engine code

I've consolidated the engine code between Sugarcane/Responsive and
Jonah. All the functions that should be the same in both are
synchronised, and all those that are different have been moved to the
bottom of the script sections in each, in a marked section. This should
make future fixes to the 'general Twine runtime' much easier to apply
across all 3 formats.