[SUG] Allow mouse-controlled frameskips to continue when held

Started by jkapp76, April 25, 2023, 10:25:25 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

jkapp76

I'd like to request a slight change.

I love how the RMB and LMB work similar to the frame-skip forward and back buttons on NeoLemmini.

But, I really would love for the effect to continue if you hold down the button like holding it down on NL works. This would save my mouse button a million clicks.
...Jeremy Kapp

WillLem

If this is possible, then yes. I'm not entirely sure why the mouse-controlled skips don't behave this way, since key-controlled skips do (i.e. when held, the skips continue). I'm tempted to guess that the codebase can happily interpret "mouse is being held" input, since it does so via the panel buttons.

On first investigation, NL's panel skip button also has a slower rate of continuation (when held) than key-controlled skips. If I can find out how to harness this for mouse/key-controlled skips as well, so much the better.




(I've got a feeling that somewhere in here lies the answer to a better Rewind implementation, as well...)

WillLem

I've sorted this one out today. Essentially re-purposed the code for the NL skill panel frameskip half-buttons and applied it directly to the left and right mouse buttons instead.

It took a bit of tweaking to get the values and time checks right, but it works a treat: clicking anywhere but the skill panel/minimap and holding the mouse button results in near-identical behaviour: a single frameskip, followed by a wait of a couple of hundred milliseconds, then repeated frameskips than run at a good enough pace to facilitate proper use. The game must be paused for it to take effect; left mouse button skips forward, and right mouse button skips backwards.

An added bonus is that you can assign a skill to a lemming and then just leave the left mouse button pressed to trigger the repeated forwards skips (again, as long as the game is paused).

Whilst it's great to have this sorted, I do have some reservations. The fact it's now hardcoded to the mouse buttons means it's no longer sensible to assign a hotkey to the right mouse button, so this option would have to be removed from the hotkey config. Also, since it's already possible to simulate the panel button behaviour by pressing and holding a -1 / +1 timeskip-configured keyboard key, I wonder if this feature is really necessary anyway.

Making it optional is, of course, always an option, I suppose... but, I'm currently trying to de-clutter things, so this wouldn't exactly help with that given the scope of the feature and the fact it also needs to mess with hotkey options.

So, I could do with some feedback on this: do you want to be able to configure the right mouse button to something other than a frameskip? Does pressing and holding the mouse buttons as a way of performing repeated skips (rather than repeatedly clicking the buttons) sound like better behaviour to you, or would you prefer to click each time you want to skip?

Any and all thoughts on this welcome. I'm about 50/50 on whether to let this feature through, even if it was nice to get it working.

jkapp76

I personally love the idea of the left and right mouse buttons working exactly as the old panel-skip buttons as the default. (as press-to-hold)
I hope we can still enter pause mode with the first right-click.
This has been my only real complaint with SLX so I'm pretty happy to see it working.
...Jeremy Kapp

Floyd Brannon

I can't think of any better use of the right mouse button than a press and hold to skip.

I've been changing all the keys to be customized but my new fave is the default. I'm just getting tendonitis from all the clicking.

I would agree it's good to remove assigning keys to the right mouse button. Maybe give skip behavior options for the right mouse button instead?

Someone might want keys to also perform these features. I like the < and > also, but the mouse buttons are even better.


Proxima


WillLem

Quote from: jkapp76 on May 16, 2023, 10:28:55 PM
I hope we can still enter pause mode with the first right-click.

Yes, as long as Pause After Backwards Frameskips is checked in the config menu, this still happens.

Quote from: Floyd Brannon on May 16, 2023, 10:49:17 PM
I can't think of any better use of the right mouse button than a press and hold to skip.

:thumbsup:

Quote from: Proxima on May 16, 2023, 10:57:02 PM
I use the right mouse button for highlight lemming.

I see.

There might be a way to keep the RMB assignable (but non-assigned by default), and add a check to see if it has been assigned before running the repeated-frameskips code. That way, it doesn't clutter up the config menu.

WillLem

Quote from: WillLem on May 17, 2023, 12:22:44 AM
There might be a way to keep the RMB assignable (but non-assigned by default), and add a check to see if it has been assigned before running the repeated-frameskips code

Took some doing, but figured this one out. Essentially, a check is now run to see if the RMB has a hotkey assigned to it. If so, then the hard-coded backskips are ignored for just the RMB. Otherwise, default behaviour is that the RMB now performs a -1 skip when clicked, and repeated -1 skips when held.

LMB always does +1 skips when clicked, repeated +1 skips when held.

The mouse button frameskips behaviour is ignored for both buttons if the cursor is over the skill panel or the minimap, and of course is always ignored in Classic Mode.

Implemented in Commit d265f0cc9.