regions 
The whole-body markings canvas.
Every pixel of paint belongs to a region, so every tool, the eraser included, stays inside the regions. Fill stops at region edges and Clear works on one region. markings_context and emissive are zone-keyed maps here; replace transactions swap them whole, so undo restores them.
Vars | |
| locked | Region characters no tool may change right now, such as regions worn clothing covers. |
|---|---|
| region_map | Direction -> row strings naming the region that owns each pixel, "0" for none. |
| resets | Zone -> views ("2" -> TRUE) that Clear, an import or a restoration replaced outright. Paint other limbs cover there goes too. |
Procs | |
| all_points_allowed | Its regions decide which pixels each tool may change. |
| apply_replacement | Also swaps which regions the step replaced outright. |
| apply_replacement_emissive | Region replacements record only the regions whose emission they change, so undo leaves later toggles elsewhere alone. |
| clear_region | Erases one region's pixels in one view as a single undoable step. |
| is_point_allowed | Pixels of unlocked regions inside the view's bounds. Unlike other drawings, the eraser stays inside them too. |
| load_frames | Fills the canvas as a draft opens, without history. |
| prepare_selection_move | A move can't carry paint out of a locked region. Destinations are already checked through is_point_allowed(). |
| preprocess_new_transaction | Fill floods only the region under the clicked pixel; other regions are boundaries. |
| region_at | The region character at a canvas pixel in one view, "0" when no region owns it. |
| replace_frames | Replaces the canvas, the per-region base markings and emission as one undoable action. |
| update_palette | Regions may hold more than CUSTOM_SPRITE_MAX_COLORS colors between them, as saves and imports can; only new colors wait for room. |
Var Details
locked 
Region characters no tool may change right now, such as regions worn clothing covers.
region_map 
Direction -> row strings naming the region that owns each pixel, "0" for none.
resets 
Zone -> views ("2" -> TRUE) that Clear, an import or a restoration replaced outright. Paint other limbs cover there goes too.
Proc Details
all_points_allowed
Its regions decide which pixels each tool may change.
apply_replacement
Also swaps which regions the step replaced outright.
apply_replacement_emissive
Region replacements record only the regions whose emission they change, so undo leaves later toggles elsewhere alone.
clear_region
Erases one region's pixels in one view as a single undoable step.
With covered_zone, that region's saved paint under other limbs in this view goes too when it saves.
is_point_allowed
Pixels of unlocked regions inside the view's bounds. Unlike other drawings, the eraser stays inside them too.
load_frames
Fills the canvas as a draft opens, without history.
prepare_selection_move
A move can't carry paint out of a locked region. Destinations are already checked through is_point_allowed().
preprocess_new_transaction
Fill floods only the region under the clicked pixel; other regions are boundaries.
region_at
The region character at a canvas pixel in one view, "0" when no region owns it.
replace_frames
Replaces the canvas, the per-region base markings and emission as one undoable action.
new_resets, when given, also changes which regions are replaced outright in which views.
Returns TRUE, replaced or already identical: regions may hold more than CUSTOM_SPRITE_MAX_COLORS colors between them (see update_palette()), so no replacement is refused for its colors.
update_palette
Regions may hold more than CUSTOM_SPRITE_MAX_COLORS colors between them, as saves and imports can; only new colors wait for room.