Updated to Beta 5(use download links in the first post)
A bit unexpected, but this is suddenly a larger feature update, complementing improvements to Overlays in this version.
Additionally this update contains a way to set volume for the frame-linked sounds during animation (see below).
Normally this is not a good thing to add so much stuff while the version is already far in Beta, but some of these changes were in plans for 3.6.0 for a while now, and they appeared to be not too difficult to make. At the same time, I believe that's the last of the feature additions for 3.6.0 engine.
Editor: - Fixed extracting room template files (other than the blank template).
- Fixed editor displaying unhandled exception if the room script which user is trying to open was missing. Instead it will now open a blank script.
Compiler: - Support using float literals when defining default values for function arguments.
Script API: - Extended all Animate() commands by adding "volume" parameter, that defines relative volume of the frame-linked sounds for the duration of this animation.
- Added Character.AnimationVolume, defining relative volume of the frame-linked sounds.
- Added Overlay.CreateRoomGraphical and CreateRoomTextual. Use these two functions to create "room overlays": that is - overlays that display a sprite inside the room, sorted among other room objects, characters and walk-behinds.
- Added readonly Overlay.InRoom property that tells if this is a room or screen overlay.
- Extended Overlay.CreateGraphical() with a new "clone" parameter that tells whether to assign a sprite index, or make a sprite's copy owned exclusively by this overlay. The former will save program memory but make overlay update if the sprite is edited later. The latter is meant primarily for backwards compatibility. Overlay.CreateRoomGraphical has the same param. Default is false (don't clone).
- Added Overlay.Graphic property that lets you change overlay's sprite after it's created.
Engine: - Perfomance improvement to overlays: engine will not make a sprite copy when they are created whenever possible (non-dynamic sprites), or when told not to by the script command that creates a custom overlay.
- When reporting script errors, engine will print callstack for all the active script "threads": for example, if there's Wait() function called and error happened in repeatedly_execute_always, then it will print both actual error's location, and Wait() call's location.
- Added "load_latest_save" and "show_fps" options to config (in "[misc]" category).
- Fixed overlay may fail to be created sometimes, if previously another overlay had been forcefully removed when changing rooms (this is an ancient bug which existed for many years).
- Fixes GUI controls not getting redrawn in correct locations if they were moved at runtime.
- Fixed script's String type could be stored in game saves with a wrong length.
- Fixed Game.InputBox() duplicating key input if new key handling mode is active.
NOTES: On OverlaysSo, from this update 3.6.0 allows to dynamically create overlays not only "on screen", among GUIs, but also inside rooms - among the characters and objects. Overlays still remain a simplistic kind of object that does not have any automated behavior, so it won't interact with anything inside the room, but it still may be sorted among other objects there by
manually setting Overlay.ZOrder. So, for example, if you'd like room overlay to change its "baseline" along with its vertical position, you will have to do something like this in rep-exec:
over.ZOrder = over.Y + over.Height;
In overall, I believe that room overlays open new possibilities in making temporary visual effects in the game, and also may help to script custom game elements from ground up (as they have no additional functionality on them).
On overlay's sprite cloning. This may not be well known, but for "historical reasons" (tm) overlays were doing a copy of the sprite when created. This was fine while overlays were limited to 20 in previous versions, but now when they are unlimited this could become an annoyance. So now, firstly, engine may decide when it is safe to not do a sprite copy (normally - when using regular non-dynamic sprites), and secondly Overlay.CreateGraphical now has an additional parameter which tells whether to make a copy of the sprite or not (not by default). This parameter may be used for backwards compatibility with some old scripts, where dynamic sprites are used to create an overlay and then discarded.
After the above change, it now makes sense to have Overlay.Graphic property, similar to Object.Graphic etc. This changes the overlay's sprite without having to recreate overlay.
Note that there's no Animate function for them, but you may script one yourself, using timers, and changing Overlay.Graphic.
NOTES: On Animation volumePreviously there was no way to choose the playback volume of sounds linked to the animation frames. The only related property was Character.ScaleVolume.
Now there are two ways to do this. First of all, there's Character.AnimationVolume. It sets the default relative volume of any frame sounds. For example, here's a primitive example of how you can make the footsteps volume depend on the character's X position in room:
player.AnimationVolume = player.x * 100 / Room.Width;
Secondly, each Animate() function (for Button, Character and Object) now has a "volume" parameter. Passing -1 (default) will ignore this, but when a 0-100 value is passed, that value overrides the frame sound volume.
EDIT: hmm, i just realized that maybe Animate() should not override Character.AnimationVolume, but also be relative to it... According to the idea that character is "sound emitter" with it's volume and Animate() is playing an individual sequence, then the volume of the sequence should not be louder than the volume of the emitter?