SDL, the library SRB2 uses, has a "mouse capture" function which allows the software to obtain mouse "events" globally; That is, from anywhere the mouse may be, anything that it does is fed directly to the program, and no other window receives those.
SRB2 uses this to do what it does: Lets you bind actions to mouse buttons, or control the camera via mouse movement. Maybe other stuff. Also prevents the mouse from leaving the window if you were playing on windowed mode, for example.
With this in mind, note that the only events that have to do with mouse buttons come in two flavors: "button down" for when a button is pressed, and "button up" for when a button is released. There's no "button is being held".
The developer then reacts to those by believing the button must be being held after a "button down" event, then released after a "button up" event.
While you're playing in a map, the game normally has the mouse captured to do its mouse stuff, but it gets released when you go out of focus, open a menu, or you open the console.
When the mouse is not captured, SRB2 no longer reacts to mouse events, and this of course includes button events.
This normally is fine, but this means that if a button was held prior to the mouse being released, if you were to release the button now, the game won't register that you did, and thus will think the button is still being held.
The game will only notice the button is up once it receives a "button up" event for it while the mouse is captured, that is, once the """""""held""""""" button is held again then released.
You can reproduce the issue by the following:
Go to any map as Fang (since its easier and faster to notice it with him). Make sure JUMP
is bound to any mouse button.
Start tail bouncing, keep holding JUMP
, then press ESC to go to the menu and go haywire with the buttons if you want.
Release JUMP
, resume the game. Fang will now tail bounce until the end of time.