<i>This post was originally made by <b>skyjake</b> on the dengDevs blog. It was posted under the category: Engine.</i>
I have been continuing my work on the player controls, and it seems that the double-activation feature (which in the past has been used for example for opening a door by triggering the Use control by double-clicking the Forward control) may need a new event type.
My current reasoning is that because we are tracking double activation on all types of controls, including numeric and impulse controls, when the double activation is triggered, it needs to generate an event to which any commands can be bound. However, we currently only have device events (keyboard, mouse, joystick). Furthermore, the data for this double activation event should contain the name of the activated control as well as information about how the activation occurred (e.g., "forward-double", "forward-doublenegative"). Naturally the player number also needs to be included with the event.
The alternative to all this is to just generate "regular" double-click events from the devices (key, mouse, joystick). The trouble is that with device axes they require logic that we already have in the device bindings evaluation, and we also have angle events that would need to be separately processed. So, taken these factors into account, it's better to track the activation of the controls themselves for this kind of "double-clicks". Thus I was thinking that one solution might be to introduce a new kind of event called a pseudo event, which is generated at the time when a control is double-activated. It could contain nothing else besides a text string, which could be used as-is in a "bindevent" command.
The alternative is to add an event type that has the player number, control index, and double-activation state as numerical parameters, but that seems a bit more work to bind events against, as it requires also the routines for saving to and restoring bindings from textual format.
Well, I'll think about this and continue it some other day...