Here's a good one:

The function int onSaveMapPic() seems to behave erratically, as follows:

Spamming the F5 key, which calls this, during scrolling will copy the dest screen map to the scrollbuf of the screen you are leaving.
Likewise, it can cause the game to become paused, as if the user pressed F3.

Apparently, it can also trigger screen secrets and do other things.

ANy ideas on what the cause might be?

This function is sort of horrible, to begin with.

Here's just the single function, for reference.

Normally with something simple such as drawing the dest screen onto the scrollbuf, I'd suspect a simple error, but with all of these random patterns, it acts as if it's reading and writing to undefined memory.

I feel as if this has something to do with temp_buf, but I have only begun to analyse this issue.

At the least, I might require doing this from the menus, so that the game is paused; or look at the code that generates the spacebar map and see if it doesn't align somewhere. IDR what the function name is that generates the spacebar map, so, that'll be fun to find again. rMBtn() should be the key to that, but a quick search didn't show any calls to rMBtn() or similar Mbtn stuff that actually calls a the function for it.

Looking closer, I think it is an issue with using temp_buf, because that's also used by void draw_screen(mapscr* this_screen, bool showlink).

At least, that'd be the problem with spamming it during scrolling, as it's trying to use that buffer at the same time as other functions. I'm not sure about triggering secrets, or pause states though. That truly sounds like something is uninitialized somewhere, or pointer errors.