|
resonance 1.0.1
|
One controller's mapping from gameplay actions to buttons. More...
#include <controllerconfig.h>
Public Types | |
| enum | Slot { kSlotRotateRight = 0 , kSlotRotateLeft = 1 , kSlotAdvance = 2 , kSlotLoop = 3 , kSlotPitchRiffFirst = 4 , kSlotErase = 10 , kSlotAxisFX = 11 , kSlotAxisRegister = 12 , kSlotAxisX = 13 , kSlotAxisY = 14 , kSlotButtonPow = 15 , kSlotPlayback = 16 , kSlotCount = 17 } |
| The action slots, in mButtons order. More... | |
Public Member Functions | |
| ControllerConfig () | |
| Start with the default mapping. | |
| void | SetButton (int nRow, int nButtonIndex) |
| Assign one button, by index, to the action one configuration row controls. | |
| int | ActionCode (int nSlot) |
| Report the four-character action code of one slot. | |
| void | Load (IBStream &stream) |
| Read the mapping back. | |
| int | GetButtonIndex (int nRow) |
| Report the button index one configuration row is mapped to. | |
| int | ButtonCode (int nButtonIndex) |
| Translate a button index into its stored button code. | |
| int | ButtonIndex (int nCode) |
| Translate a stored button code into its button index. | |
| int | ActionSlot (int nRow) |
| Translate a configuration row into the slot it controls. | |
| int | RiffIndex (int nSlot) |
| Report which riff a pitch-riff slot belongs to. | |
| void | Save (OBStream &stream) |
| Write the record version 4, the slot count, and every button code. | |
| ControllerConfig & | operator= (const ControllerConfig &other) |
| Copy another mapping. | |
Public Attributes | |
| std::vector< int > | mButtons |
| The button code of each slot. | |
One controller's mapping from gameplay actions to buttons.
The class is not polymorphic and emits no RTTI descriptor. The name is inferred from the labels Controller Config 1 through Controller Config 4 that GlobalSettings::Print() writes for the four instances GlobalSettings embeds. The object is the 12 bytes of its one vector, which the GlobalSettings layout fixes. The destructor is compiler-generated and inline.
mButtons has one entry per action slot. The configuration screen addresses the mapping by row and by button index, and ActionSlot(), ButtonCode(), and ButtonIndex() translate between those and the stored slot and button codes. Codes 100 through 103 are the two analog sticks' axes, and codes 11 and 12 are the two stick presses.
The translation unit also holds three uncalled template library emissions at 0x00164150, 0x001643c8, and 0x001647e8, which are not declared.
The action slots, in mButtons order.
| ControllerConfig::ControllerConfig | ( | ) |
Start with the default mapping.
| void ControllerConfig::SetButton | ( | int | nRow, |
| int | nButtonIndex ) |
Assign one button, by index, to the action one configuration row controls.
Button index 8 or 9 selects a stick rather than a button. Choosing one for the effect row or the register row places that stick on the effect and register slots and the other stick on the power axes, with the matching stick press on kSlotButtonPow. Choosing one for either power-axis row does the same with the sticks swapped. A stick chosen for any other row changes nothing.
| nRow | The configuration row, 0 through 8. |
| nButtonIndex | The button index, 0 through 9. |
| int ControllerConfig::ActionCode | ( | int | nSlot | ) |
Report the four-character action code of one slot.
InputMap::Rebuild() calls it. The body does not read this object.
| nSlot | The slot. |
| void ControllerConfig::Load | ( | IBStream & | stream | ) |
Read the mapping back.
A record older than version 4 is read into a discarded vector, and the mapping keeps its current contents.
| stream | The stream to read from. |
| int ControllerConfig::GetButtonIndex | ( | int | nRow | ) |
Report the button index one configuration row is mapped to.
| nRow | The configuration row, 0 through 8. |
| int ControllerConfig::ButtonCode | ( | int | nButtonIndex | ) |
Translate a button index into its stored button code.
| nButtonIndex | The button index, 0 through 9. |
| int ControllerConfig::ButtonIndex | ( | int | nCode | ) |
Translate a stored button code into its button index.
Both axes of a stick report that stick's index.
| nCode | The code. |
| int ControllerConfig::ActionSlot | ( | int | nRow | ) |
Translate a configuration row into the slot it controls.
| nRow | The configuration row, 0 through 8. |
| int ControllerConfig::RiffIndex | ( | int | nSlot | ) |
Report which riff a pitch-riff slot belongs to.
InputMap::Rebuild() calls it.
| nSlot | The slot. |
| void ControllerConfig::Save | ( | OBStream & | stream | ) |
Write the record version 4, the slot count, and every button code.
| stream | The stream to write to. |
| ControllerConfig & ControllerConfig::operator= | ( | const ControllerConfig & | other | ) |
Copy another mapping.
| other | The mapping to copy. |
| std::vector<int> ControllerConfig::mButtons |
The button code of each slot.
Public because InputMap::Rebuild() walks it. +0x00