Script API: get DrawingSurface for the room masks #1031
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For #480.
This is a minor addition, but may have numerous practical uses.
There's already a DrawingSurface interface, and room areas - walkable areas, hotspots, regions and walk-behinds - are represented as 8-bit bitmap masks, so it's trivial to connect these.
The 4 new script functions allow to get corresponding room mask as a DrawingSurface, and do with it whatever a game developer wants.
Surfaces will be 8-bit, and each color index corresponds to an area ID. Color index = 0 is "no area", or eraser.
There are necessary safety tests in the engine to make sure that indexes beyond supported area limit are simply ignored (treated as "no area").
For example, following script will expand walkable area 1:
Changes made this way are not saved between room visit, which is in line with drawing upon a room background (this was done to prevent save data bloat). If user wants these changes to persist, the usual approach is to save custom data, and use it as an instruction, performing drawing on room load event.