merge input symbols

This commit is contained in:
Glenn Maynard
2005-12-28 08:55:13 +00:00
parent 7039cafa9a
commit c294e8eb74
5 changed files with 34 additions and 13 deletions
@@ -253,7 +253,7 @@ void InputHandler_DInput::UpdatePolled(DIDevice &device, const RageTimer &tm)
for( int k = 0; k < 256; ++k )
{
const int key = device.Inputs[k].num;
const DeviceButton key = (DeviceButton) device.Inputs[k].num;
ButtonPressed(DeviceInput(device.dev, key), !!(keys[k] & 0x80));
}
}
@@ -276,14 +276,14 @@ void InputHandler_DInput::UpdatePolled(DIDevice &device, const RageTimer &tm)
{
case in.BUTTON:
{
DeviceInput di(dev, JOY_BUTTON_1 + in.num, -1, tm);
DeviceInput di(dev, (DeviceButton) (JOY_BUTTON_1 + in.num), -1, tm);
ButtonPressed(di, !!state.rgbButtons[in.ofs - DIJOFS_BUTTON0]);
break;
}
case in.AXIS:
{
JoystickButton neg = NUM_JOYSTICK_BUTTONS, pos = NUM_JOYSTICK_BUTTONS;
DeviceButton neg = DeviceButton_Invalid, pos = DeviceButton_Invalid;
int val = 0;
switch(in.ofs)
{
@@ -318,7 +318,7 @@ void InputHandler_DInput::UpdatePolled(DIDevice &device, const RageTimer &tm)
device.JoystickInst.tszProductName, in.ofs );
continue;
}
if( neg != NUM_JOYSTICK_BUTTONS )
if( neg != DeviceButton_Invalid )
{
float l = SCALE( int(val), 0.0f, 100.0f, 0.0f, 1.0f );
ButtonPressed(DeviceInput(dev, neg, max(-l,0), tm), val < -50);
@@ -381,16 +381,16 @@ void InputHandler_DInput::UpdateBuffered(DIDevice &device, const RageTimer &tm)
switch(in.type)
{
case in.KEY:
ButtonPressed(DeviceInput(dev, in.num, -1, tm), !!(evtbuf[i].dwData & 0x80));
ButtonPressed(DeviceInput(dev, (DeviceButton) in.num, -1, tm), !!(evtbuf[i].dwData & 0x80));
break;
case in.BUTTON:
ButtonPressed(DeviceInput(dev, JOY_BUTTON_1 + in.num, -1, tm), !!evtbuf[i].dwData);
ButtonPressed(DeviceInput(dev, (DeviceButton) (JOY_BUTTON_1 + in.num), -1, tm), !!evtbuf[i].dwData);
break;
case in.AXIS:
{
int up = 0, down = 0;
DeviceButton up = DeviceButton_Invalid, down = DeviceButton_Invalid;
switch(in.ofs)
{
case DIJOFS_X: up = JOY_LEFT; down = JOY_RIGHT; break;
@@ -18,7 +18,7 @@ void InputHandler_MonkeyKeyboard::GetDevicesAndDescriptions(vector<InputDevice>&
vDescriptionsOut.push_back( "MonkeyKeyboard" );
}
static const int g_keys[] =
static const DeviceButton g_keys[] =
{
// Some of the default keys for the dance game type
KEY_LEFT, // DANCE_BUTTON_LEFT,
@@ -49,7 +49,7 @@ static const int g_keys[] =
KEY_KP_PLUS, // DANCE_BUTTON_MENUDOWN
};
static int GetRandomKeyboardKey()
static DeviceButton GetRandomKeyboardKey()
{
int index = rand()%ARRAYSIZE(g_keys);
return g_keys[index];
@@ -88,7 +88,7 @@ static void CALLBACK midiCallback( HMIDIIN device, UINT status, DWORD instancePt
if( iType == 144 )
{
DeviceInput di = DeviceInput( DEVICE_MIDI, iChannel );
DeviceInput di = DeviceInput( DEVICE_MIDI, enum_add2(MIDI_FIRST, iChannel) );
di.ts.Touch();
if( iValue > 0 )
((InputHandler_Win32_MIDI *)instancePtr)->SetDev( di, true );
@@ -47,7 +47,7 @@ InputHandler_Win32_Pump::~InputHandler_Win32_Pump()
void InputHandler_Win32_Pump::HandleInput( int iDevice, int iEvent )
{
static const int bits[NUM_PUMP_PAD_BUTTONS] = {
static const int bits[] = {
/* P1 */ (1<<9), (1<<12), (1<<13), (1<<11), (1<<10),
/* ESC */ (1<<16),
/* P1 */ (1<<17), (1<<20), (1<<21), (1<<19), (1<<18),
@@ -55,9 +55,9 @@ void InputHandler_Win32_Pump::HandleInput( int iDevice, int iEvent )
InputDevice id = InputDevice( DEVICE_PUMP1 + iDevice );
for( int iButton = 0; iButton < NUM_PUMP_PAD_BUTTONS; ++iButton )
for( int iButton = 0; iButton < ARRAYSIZE(bits); ++iButton )
{
DeviceInput di( id, iButton );
DeviceInput di( id, enum_add2(JOY_BUTTON_1, iButton) );
/* If we're in a thread, our timestamp is accurate. */
if( InputThread.IsCreated() )
@@ -67,6 +67,26 @@ void InputHandler_Win32_Pump::HandleInput( int iDevice, int iEvent )
}
}
CString InputHandler_Win32_Pump::GetDeviceSpecificInputString( const DeviceInput &di )
{
switch( di.button )
{
case JOY_BUTTON_1: return "UL";
case JOY_BUTTON_2: return "UR";
case JOY_BUTTON_3: return "MID";
case JOY_BUTTON_4: return "DL";
case JOY_BUTTON_5: return "DR";
case JOY_BUTTON_6: return "Esc";
case JOY_BUTTON_7: return "P2 UL";
case JOY_BUTTON_8: return "P2 UR";
case JOY_BUTTON_9: return "P2 MID";
case JOY_BUTTON_10: return "P2 DL";
case JOY_BUTTON_11: return "P2 DR";
}
return InputHandler::GetDeviceSpecificInputString( di );
}
void InputHandler_Win32_Pump::GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut)
{
for(int i = 0; i < NUM_PUMPS; ++i)
@@ -11,6 +11,7 @@ public:
void Update();
InputHandler_Win32_Pump();
~InputHandler_Win32_Pump();
CString GetDeviceSpecificInputString( const DeviceInput &di );
void GetDevicesAndDescriptions( vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut );
private: