Since b393050e55, surface normals were calculated incorrectly because blocking cells were detected as blocking only if they were within the heading of the scout process (see that commit for terminology). This had been true even before that commit but it had had less visible effects because both processes would traverse their neighbours in the same order, which the initial heading approximation code (direction_to_map, removed in this commit) had worked better with.
This commit fixes this by separating information about blocking entirely from information about current heading, as it should be. This fixes a few prism-type saves such as id:1188302, but is also not entirely backwards-compatible, for all saves that are considered broken as far as normal calculation code is concerned (e.g. the surfaces are not long enough or are wobbly) will now be broken differently from before. This affects for example many coalescing laser-type saves such as id:482187 that rely on very specific arrangements of very few particles of reflective material behaving as perfect 45deg mirrors.
Recent changes made to multiple instances of paste placement code caused inconsistencies between what paste previews suggested would happen and what actually happened during pasting. Relevant code factored out.
This makes the *A Win32 API variants work correctly with UTF-8 parameters, which is nice because standard C/C++ facilities use those (because microsoft's libc is a steaming pile of microsoft code). OF COURSE this only works on win10 1903 and above. See https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page
Not useful anymore, it can only fail if the GameSave passed in is nullptr, which this commit guards against.
Also make Simulation::Load and Simulation::Save take block-oriented positions and rects.
This is good enough for now but also more limited than I'd like because if the thumbnail arrives (gets rendered or downloaded) later than the preview is opened, it's never shown.
This also fixes local save thumbnails being resized such that they are just short of filling the space they are supposed to.
Also fix textboxes drawing their borders in the wrong place.
flood_water would occasionally corrupt pmap by moving the pmap entry at i's location even if the entry itself didn't refer to i. pmap updates are tricky, they are best handled by Simulation::move.
Saving blockair/blockairh is nice because RecalculateBlockAirMaps uses the sim rng, which means the sim rng would get advanced in Simulation::Load. Also rename RecalculateBlockAirMaps to ApproximateBlockAirMaps because that's what it is, an approximation, and it's needed only if there are no block air maps in the save.
Simulation::frameCount keeps track of frames elapsed since the beginning of the simulation, zeroed at clear_sim. It overflows when it reaches the 64-bit limit, which means anything that depends on it should either handle this, or not fail catastrophically. sandcolour (the only thing that depends on it as of now) is a good example of the latter: sandcolour has a periodicity of 360 frames, which means that there is one sandcolour period that is cut short by the overflow. This is not "handled" (the period is cut short, which is detectable by users) but is not catastrophic either (it's not a big deal, and it won't ever happen unless someone hacks the save).
Also restrict saves with determinism data to 98.0.