2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-09-24 02:55:32 +00:00
|
|
|
#include "ScreenMapControllers.h"
|
|
|
|
|
#include "GameConstantsAndTypes.h"
|
2005-07-20 09:48:19 +00:00
|
|
|
#include "ScreenManager.h"
|
2002-09-24 02:55:32 +00:00
|
|
|
#include "RageLog.h"
|
|
|
|
|
#include "InputMapper.h"
|
|
|
|
|
#include "GameManager.h"
|
|
|
|
|
#include "GameState.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include "ThemeManager.h"
|
2004-07-25 17:07:32 +00:00
|
|
|
#include "Game.h"
|
2004-09-21 06:07:12 +00:00
|
|
|
#include "ScreenDimensions.h"
|
2005-01-26 11:21:43 +00:00
|
|
|
#include "Command.h"
|
2005-09-05 02:26:50 +00:00
|
|
|
#include "InputEventPlus.h"
|
2002-09-24 02:55:32 +00:00
|
|
|
|
2005-12-06 00:34:51 +00:00
|
|
|
#define BUTTONS_TO_MAP THEME->GetMetric( m_sName, "ButtonsToMap" )
|
|
|
|
|
|
2005-01-26 11:21:43 +00:00
|
|
|
static const ThemeMetric<apActorCommands> EVEN_LINE_IN ("ScreenMapControllers","EvenLineIn");
|
|
|
|
|
static const ThemeMetric<apActorCommands> EVEN_LINE_OUT ("ScreenMapControllers","EvenLineOut");
|
|
|
|
|
static const ThemeMetric<apActorCommands> ODD_LINE_IN ("ScreenMapControllers","OddLineIn");
|
|
|
|
|
static const ThemeMetric<apActorCommands> ODD_LINE_OUT ("ScreenMapControllers","OddLineOut");
|
2002-09-24 02:55:32 +00:00
|
|
|
|
2005-12-05 17:00:20 +00:00
|
|
|
static const int FramesToWaitForInput = 2;
|
2002-09-24 02:55:32 +00:00
|
|
|
|
|
|
|
|
// reserve the 3rd slot for hard-coded keys
|
2005-12-05 17:00:20 +00:00
|
|
|
static const int NUM_CHANGABLE_SLOTS = NUM_SHOWN_GAME_TO_DEVICE_SLOTS-1;
|
2002-09-24 02:55:32 +00:00
|
|
|
|
|
|
|
|
|
2005-12-05 17:00:20 +00:00
|
|
|
static const float LINE_START_Y = 64;
|
|
|
|
|
static const float LINE_GAP_Y = 28;
|
|
|
|
|
static const float BUTTON_COLUMN_X[NUM_SHOWN_GAME_TO_DEVICE_SLOTS*MAX_GAME_CONTROLLERS] =
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
|
|
|
|
50, 125, 200, 440, 515, 590
|
|
|
|
|
};
|
|
|
|
|
|
2004-11-26 17:28:47 +00:00
|
|
|
REGISTER_SCREEN_CLASS( ScreenMapControllers );
|
2004-05-01 23:19:33 +00:00
|
|
|
ScreenMapControllers::ScreenMapControllers( CString sClassName ) : ScreenWithMenuElements( sClassName )
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
|
|
|
|
LOG->Trace( "ScreenMapControllers::ScreenMapControllers()" );
|
2005-02-23 06:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ScreenMapControllers::Init()
|
|
|
|
|
{
|
|
|
|
|
ScreenWithMenuElements::Init();
|
2004-09-09 16:12:00 +00:00
|
|
|
|
2005-12-06 00:34:51 +00:00
|
|
|
CString sButtons = BUTTONS_TO_MAP;
|
|
|
|
|
if( sButtons.empty() )
|
|
|
|
|
{
|
|
|
|
|
/* Map all buttons for this game. */
|
|
|
|
|
for( int b=0; b<GAMESTATE->GetCurrentGame()->m_iButtonsPerController; b++ )
|
|
|
|
|
{
|
|
|
|
|
KeyToMap k;
|
|
|
|
|
k.m_GameButton = (GameButton) b;
|
|
|
|
|
m_KeysToMap.push_back( k );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
2005-12-06 00:34:51 +00:00
|
|
|
/* Map the specified buttons. */
|
|
|
|
|
vector<CString> asBits;
|
|
|
|
|
split( sButtons, ",", asBits );
|
|
|
|
|
for( unsigned i=0; i<asBits.size(); ++i )
|
|
|
|
|
{
|
|
|
|
|
KeyToMap k;
|
|
|
|
|
k.m_GameButton = StringToGameButton( GAMESTATE->GetCurrentGame(), asBits[i] );
|
|
|
|
|
m_KeysToMap.push_back( k );
|
|
|
|
|
}
|
2005-12-05 17:49:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for( unsigned b=0; b<m_KeysToMap.size(); b++ )
|
|
|
|
|
{
|
2005-12-06 00:34:51 +00:00
|
|
|
KeyToMap *pKey = &m_KeysToMap[b];
|
|
|
|
|
|
|
|
|
|
BitmapText *pName = new BitmapText;
|
|
|
|
|
pName->SetName( "Title" );
|
|
|
|
|
pName->LoadFromFont( THEME->GetPathF("Common","title") );
|
|
|
|
|
pName->SetXY( SCREEN_CENTER_X, -6 );
|
|
|
|
|
pName->SetText( GAMESTATE->GetCurrentGame()->m_szButtonNames[pKey->m_GameButton] );
|
|
|
|
|
ON_COMMAND( pName );
|
|
|
|
|
m_Line[b].AddChild( pName );
|
|
|
|
|
|
|
|
|
|
BitmapText *pSecondary = new BitmapText;
|
|
|
|
|
pSecondary->SetName( "Secondary" );
|
|
|
|
|
pSecondary->LoadFromFont( THEME->GetPathF("Common","title") );
|
|
|
|
|
pSecondary->SetXY( SCREEN_CENTER_X, +6 );
|
|
|
|
|
CString sText = GAMEMAN->GetMenuButtonSecondaryFunction( GAMESTATE->GetCurrentGame(), pKey->m_GameButton );
|
|
|
|
|
pSecondary->SetText( sText );
|
|
|
|
|
ON_COMMAND( pSecondary );
|
|
|
|
|
m_Line[b].AddChild( pSecondary );
|
2002-09-24 02:55:32 +00:00
|
|
|
|
|
|
|
|
for( int p=0; p<MAX_GAME_CONTROLLERS; p++ )
|
|
|
|
|
{
|
2005-02-20 04:53:57 +00:00
|
|
|
for( int s=0; s<NUM_SHOWN_GAME_TO_DEVICE_SLOTS; s++ )
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
2005-12-06 00:34:51 +00:00
|
|
|
pKey->m_textMappedTo[p][s] = new BitmapText;
|
|
|
|
|
pKey->m_textMappedTo[p][s]->SetName( "MappedTo" );
|
|
|
|
|
pKey->m_textMappedTo[p][s]->LoadFromFont( THEME->GetPathF("ScreenMapControllers","entry") );
|
|
|
|
|
pKey->m_textMappedTo[p][s]->SetXY( BUTTON_COLUMN_X[p*NUM_SHOWN_GAME_TO_DEVICE_SLOTS+s], 0 );
|
|
|
|
|
ON_COMMAND( pKey->m_textMappedTo[p][s] );
|
|
|
|
|
m_Line[b].AddChild( pKey->m_textMappedTo[p][s] );
|
2002-09-24 02:55:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
2005-12-06 00:34:51 +00:00
|
|
|
m_Line[b].DeleteChildrenWhenDone();
|
2003-07-16 03:35:31 +00:00
|
|
|
m_Line[b].SetY( LINE_START_Y + b*LINE_GAP_Y );
|
|
|
|
|
this->AddChild( &m_Line[b] );
|
|
|
|
|
|
2004-12-03 05:19:46 +00:00
|
|
|
m_Line[b].RunCommands( (b%2)? ODD_LINE_IN : EVEN_LINE_IN );
|
2002-09-24 02:55:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_iCurController = 0;
|
|
|
|
|
m_iCurButton = 0;
|
|
|
|
|
m_iCurSlot = 0;
|
|
|
|
|
|
2003-09-11 03:47:13 +00:00
|
|
|
m_iWaitingForPress = 0;
|
2002-09-24 02:55:32 +00:00
|
|
|
|
|
|
|
|
Refresh();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ScreenMapControllers::Update( float fDeltaTime )
|
|
|
|
|
{
|
2005-12-05 17:05:24 +00:00
|
|
|
ScreenWithMenuElements::Update( fDeltaTime );
|
2002-09-24 02:55:32 +00:00
|
|
|
|
2003-09-09 04:57:22 +00:00
|
|
|
|
2003-09-11 03:47:13 +00:00
|
|
|
if( m_iWaitingForPress && m_DeviceIToMap.IsValid() ) // we're going to map an input
|
2003-09-09 04:57:22 +00:00
|
|
|
{
|
2003-09-11 03:47:13 +00:00
|
|
|
--m_iWaitingForPress;
|
|
|
|
|
if( m_iWaitingForPress )
|
|
|
|
|
return; /* keep waiting */
|
|
|
|
|
|
2005-12-05 17:49:25 +00:00
|
|
|
const KeyToMap *pKey = &m_KeysToMap[m_iCurButton];
|
|
|
|
|
|
|
|
|
|
GameInput curGameI( (GameController)m_iCurController, pKey->m_GameButton );
|
2002-09-24 02:55:32 +00:00
|
|
|
|
2003-09-09 04:57:22 +00:00
|
|
|
INPUTMAPPER->SetInputMap( m_DeviceIToMap, curGameI, m_iCurSlot );
|
|
|
|
|
INPUTMAPPER->AddDefaultMappingsForCurrentGameIfUnmapped();
|
2005-04-24 02:03:25 +00:00
|
|
|
|
|
|
|
|
// commit to disk after each change
|
2003-09-09 04:57:22 +00:00
|
|
|
INPUTMAPPER->SaveMappingsToDisk();
|
|
|
|
|
|
2003-09-11 03:18:56 +00:00
|
|
|
Refresh();
|
2002-09-24 02:55:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-09-19 22:54:34 +00:00
|
|
|
/* Note that this isn't necessarily correct. For example, JOY_LEFT might actually be
|
|
|
|
|
* a D-pad and not an axis. All this is actually doing is giving priority to some
|
|
|
|
|
* inputs over others; this function is unsuitable for other use. */
|
2003-09-23 21:44:09 +00:00
|
|
|
static bool IsAxis( const DeviceInput& DeviceI )
|
|
|
|
|
{
|
|
|
|
|
if( !DeviceI.IsJoystick() )
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
static int axes[] =
|
|
|
|
|
{
|
|
|
|
|
JOY_LEFT, JOY_RIGHT, JOY_UP, JOY_DOWN,
|
2004-09-19 22:54:34 +00:00
|
|
|
JOY_LEFT_2, JOY_RIGHT_2, JOY_UP_2, JOY_DOWN_2,
|
2003-09-23 21:44:09 +00:00
|
|
|
JOY_Z_UP, JOY_Z_DOWN,
|
|
|
|
|
JOY_ROT_UP, JOY_ROT_DOWN, JOY_ROT_LEFT, JOY_ROT_RIGHT, JOY_ROT_Z_UP, JOY_ROT_Z_DOWN,
|
|
|
|
|
JOY_HAT_LEFT, JOY_HAT_RIGHT, JOY_HAT_UP, JOY_HAT_DOWN,
|
|
|
|
|
JOY_AUX_1, JOY_AUX_2, JOY_AUX_3, JOY_AUX_4,
|
|
|
|
|
-1
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for( int ax = 0; axes[ax] != -1; ++ax )
|
|
|
|
|
if( DeviceI.button == axes[ax] )
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2005-09-05 02:26:50 +00:00
|
|
|
void ScreenMapControllers::Input( const InputEventPlus &input )
|
2004-09-09 08:50:16 +00:00
|
|
|
{
|
2005-12-05 17:33:56 +00:00
|
|
|
if( input.type != IET_FIRST_PRESS && input.type != IET_SLOW_REPEAT && input.type != IET_FAST_REPEAT )
|
2004-09-09 16:12:00 +00:00
|
|
|
return; // ignore
|
|
|
|
|
|
|
|
|
|
LOG->Trace( "ScreenMapControllers::Input(): device: %d, button: %d",
|
2005-09-05 02:26:50 +00:00
|
|
|
input.DeviceI.device, input.DeviceI.button );
|
2004-09-09 16:12:00 +00:00
|
|
|
|
2005-09-05 02:26:50 +00:00
|
|
|
int button = input.DeviceI.button;
|
2004-09-09 16:12:00 +00:00
|
|
|
|
2004-09-09 08:50:16 +00:00
|
|
|
#ifdef _XBOX
|
2005-09-05 02:26:50 +00:00
|
|
|
if( !m_iWaitingForPress && input.DeviceI.device == DEVICE_JOY1 )
|
2004-09-09 08:50:16 +00:00
|
|
|
{
|
|
|
|
|
// map the xbox controller buttons to the keyboard equivalents
|
2005-09-05 02:26:50 +00:00
|
|
|
if( input.DeviceI.button == JOY_HAT_LEFT )
|
2004-09-09 17:34:57 +00:00
|
|
|
button = KEY_LEFT;
|
2005-09-05 02:26:50 +00:00
|
|
|
else if( input.DeviceI.button == JOY_HAT_RIGHT )
|
2004-09-09 17:34:57 +00:00
|
|
|
button = KEY_RIGHT;
|
2005-09-05 02:26:50 +00:00
|
|
|
else if( input.DeviceI.button == JOY_HAT_UP )
|
2004-09-09 17:34:57 +00:00
|
|
|
button = KEY_UP;
|
2005-09-05 02:26:50 +00:00
|
|
|
else if( input.DeviceI.button == JOY_HAT_DOWN )
|
2004-09-09 17:34:57 +00:00
|
|
|
button = KEY_DOWN;
|
2005-09-05 02:26:50 +00:00
|
|
|
else if( input.DeviceI.button == JOY_AUX_1 )
|
2004-09-09 18:39:17 +00:00
|
|
|
button = KEY_ENTER;
|
2005-09-05 02:26:50 +00:00
|
|
|
else if( input.DeviceI.button == JOY_AUX_2 )
|
2004-09-09 18:39:17 +00:00
|
|
|
button = KEY_ESC;
|
2005-09-12 08:48:16 +00:00
|
|
|
else if( input.DeviceI.button == JOY_BUTTON_1 || input.DeviceI.button == JOY_BUTTON_2 ||
|
|
|
|
|
input.DeviceI.button == JOY_BUTTON_3 || input.DeviceI.button == JOY_BUTTON_4 )
|
2004-09-09 17:34:57 +00:00
|
|
|
button = KEY_DEL;
|
2004-09-09 08:50:16 +00:00
|
|
|
}
|
|
|
|
|
#endif
|
2002-09-24 02:55:32 +00:00
|
|
|
|
2003-09-09 04:57:22 +00:00
|
|
|
//
|
2004-09-19 23:00:46 +00:00
|
|
|
// TRICKY: Some adapters map the PlayStation digital d-pad to both axes and
|
|
|
|
|
// buttons. We want buttons to be used for any mappings where possible because
|
|
|
|
|
// presses of buttons aren't mutually exclusive and presses of axes are (e.g.
|
|
|
|
|
// can't read presses of both Left and Right simultaneously). So, when the user
|
|
|
|
|
// presses a button, we'll wait until the next Update before adding a mapping so
|
|
|
|
|
// that we get a chance to see all input events the user's press of a panel.
|
|
|
|
|
// Prefer non-axis events over axis events.
|
2003-09-09 04:57:22 +00:00
|
|
|
//
|
2003-09-11 03:47:13 +00:00
|
|
|
if( m_iWaitingForPress )
|
2003-09-09 04:57:22 +00:00
|
|
|
{
|
2003-02-12 08:10:58 +00:00
|
|
|
/* Don't allow function keys to be mapped. */
|
2005-09-05 02:26:50 +00:00
|
|
|
if( input.DeviceI.device == DEVICE_KEYBOARD && (input.DeviceI.button >= KEY_F1 && input.DeviceI.button <= KEY_F12) )
|
2003-02-12 06:25:51 +00:00
|
|
|
{
|
2005-12-05 17:10:00 +00:00
|
|
|
SCREENMAN->SystemMessage( "That key can not be mapped." );
|
2004-05-01 23:28:53 +00:00
|
|
|
SCREENMAN->PlayInvalidSound();
|
2003-02-12 06:25:51 +00:00
|
|
|
}
|
2003-09-09 04:57:22 +00:00
|
|
|
else
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
2003-09-23 21:44:09 +00:00
|
|
|
if( m_DeviceIToMap.IsValid() &&
|
|
|
|
|
!IsAxis(m_DeviceIToMap) &&
|
2005-09-05 02:26:50 +00:00
|
|
|
IsAxis(input.DeviceI) )
|
2003-09-23 21:44:09 +00:00
|
|
|
{
|
|
|
|
|
LOG->Trace("Ignored input; non-axis event already received");
|
|
|
|
|
return; // ignore this press
|
|
|
|
|
}
|
|
|
|
|
|
2005-09-05 02:26:50 +00:00
|
|
|
m_DeviceIToMap = input.DeviceI;
|
2002-09-24 02:55:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
2004-09-09 16:12:00 +00:00
|
|
|
#ifdef _XBOX
|
2005-09-05 02:26:50 +00:00
|
|
|
else if( input.DeviceI.device == DEVICE_JOY1 )
|
2004-09-09 16:12:00 +00:00
|
|
|
#else
|
2005-09-05 02:26:50 +00:00
|
|
|
else if( input.DeviceI.device == DEVICE_KEYBOARD )
|
2004-09-09 16:12:00 +00:00
|
|
|
#endif
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
2004-09-09 16:12:00 +00:00
|
|
|
switch( button )
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
|
|
|
|
/* We only advertise space as doing this, but most games
|
|
|
|
|
* use either backspace or delete, and I find them more
|
|
|
|
|
* intuitive, so allow them, too. -gm */
|
2004-09-09 16:12:00 +00:00
|
|
|
|
|
|
|
|
/* XXX: For some reason that eludes me, this function gets sent an
|
2004-09-09 17:34:57 +00:00
|
|
|
* KEY_SPACE button press every time the JOY_HAT_UP button is pressed.
|
2004-09-09 16:12:00 +00:00
|
|
|
* Had to put this in to prevent mappings being erased everytime the user
|
|
|
|
|
* pressed up on the joypad. */
|
|
|
|
|
|
2004-09-09 17:34:57 +00:00
|
|
|
case KEY_DEL:
|
2004-09-09 16:12:00 +00:00
|
|
|
#ifndef _XBOX
|
2004-09-09 17:34:57 +00:00
|
|
|
case KEY_SPACE:
|
|
|
|
|
case KEY_BACK: /* Clear the selected input mapping. */
|
2004-09-09 16:12:00 +00:00
|
|
|
#endif
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
2005-12-05 17:49:25 +00:00
|
|
|
const KeyToMap *pKey = &m_KeysToMap[m_iCurButton];
|
|
|
|
|
GameInput curGameI( (GameController)m_iCurController, pKey->m_GameButton );
|
2002-09-24 02:55:32 +00:00
|
|
|
INPUTMAPPER->ClearFromInputMap( curGameI, m_iCurSlot );
|
|
|
|
|
INPUTMAPPER->AddDefaultMappingsForCurrentGameIfUnmapped();
|
2005-04-24 02:03:25 +00:00
|
|
|
|
|
|
|
|
// commit to disk after each change
|
2002-09-24 02:55:32 +00:00
|
|
|
INPUTMAPPER->SaveMappingsToDisk();
|
|
|
|
|
}
|
|
|
|
|
break;
|
2004-09-09 17:34:57 +00:00
|
|
|
case KEY_LEFT: /* Move the selection left, wrapping up. */
|
2002-09-24 02:55:32 +00:00
|
|
|
if( m_iCurSlot == 0 && m_iCurController == 0 )
|
|
|
|
|
break; // can't go left any more
|
|
|
|
|
m_iCurSlot--;
|
|
|
|
|
if( m_iCurSlot < 0 )
|
|
|
|
|
{
|
|
|
|
|
m_iCurSlot = NUM_CHANGABLE_SLOTS-1;
|
|
|
|
|
m_iCurController--;
|
|
|
|
|
}
|
2004-09-09 16:12:00 +00:00
|
|
|
|
2002-09-24 02:55:32 +00:00
|
|
|
break;
|
2004-09-09 17:34:57 +00:00
|
|
|
case KEY_RIGHT: /* Move the selection right, wrapping down. */
|
2002-09-24 02:55:32 +00:00
|
|
|
if( m_iCurSlot == NUM_CHANGABLE_SLOTS-1 && m_iCurController == MAX_GAME_CONTROLLERS-1 )
|
|
|
|
|
break; // can't go right any more
|
|
|
|
|
m_iCurSlot++;
|
|
|
|
|
if( m_iCurSlot > NUM_CHANGABLE_SLOTS-1 )
|
|
|
|
|
{
|
|
|
|
|
m_iCurSlot = 0;
|
|
|
|
|
m_iCurController++;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2004-09-09 17:34:57 +00:00
|
|
|
case KEY_UP: /* Move the selection up. */
|
2002-09-24 02:55:32 +00:00
|
|
|
if( m_iCurButton == 0 )
|
|
|
|
|
break; // can't go up any more
|
|
|
|
|
m_iCurButton--;
|
|
|
|
|
break;
|
2004-09-09 17:34:57 +00:00
|
|
|
case KEY_DOWN: /* Move the selection down. */
|
2005-12-05 17:49:25 +00:00
|
|
|
if( m_iCurButton == (int) m_KeysToMap.size()-1 )
|
2002-09-24 02:55:32 +00:00
|
|
|
break; // can't go down any more
|
|
|
|
|
m_iCurButton++;
|
|
|
|
|
break;
|
2004-09-09 17:34:57 +00:00
|
|
|
case KEY_ESC: /* Quit the screen. */
|
2005-04-24 02:03:25 +00:00
|
|
|
if( !IsTransitioning() )
|
2003-04-22 22:51:49 +00:00
|
|
|
{
|
2004-05-01 23:28:53 +00:00
|
|
|
SCREENMAN->PlayStartSound();
|
2005-04-24 02:03:25 +00:00
|
|
|
|
|
|
|
|
INPUTMAPPER->SaveMappingsToDisk(); // save changes
|
|
|
|
|
|
2005-10-13 22:17:13 +00:00
|
|
|
StartTransitioningScreen( SM_GoToNextScreen );
|
2003-04-22 22:51:49 +00:00
|
|
|
}
|
2002-09-24 02:55:32 +00:00
|
|
|
break;
|
2004-09-09 17:34:57 +00:00
|
|
|
case KEY_ENTER: /* Change the selection. */
|
|
|
|
|
case KEY_KP_ENTER:
|
2003-09-11 03:47:13 +00:00
|
|
|
m_iWaitingForPress = FramesToWaitForInput;
|
2003-09-09 04:57:22 +00:00
|
|
|
m_DeviceIToMap.MakeInvalid();
|
2002-09-24 02:55:32 +00:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-12-05 17:05:24 +00:00
|
|
|
// ScreenWithMenuElements::Input( input ); // default handler
|
2002-09-24 02:55:32 +00:00
|
|
|
|
|
|
|
|
LOG->Trace( "m_iCurSlot: %d m_iCurController: %d m_iCurButton: %d", m_iCurSlot, m_iCurController, m_iCurButton );
|
|
|
|
|
|
|
|
|
|
Refresh();
|
|
|
|
|
}
|
|
|
|
|
|
2005-12-05 17:03:46 +00:00
|
|
|
void ScreenMapControllers::TweenOffScreen()
|
|
|
|
|
{
|
2005-12-05 17:49:25 +00:00
|
|
|
for( unsigned b=0; b<m_KeysToMap.size(); b++ )
|
2005-12-05 17:03:46 +00:00
|
|
|
m_Line[b].RunCommands( (b%2)? ODD_LINE_OUT:EVEN_LINE_OUT );
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-24 02:55:32 +00:00
|
|
|
void ScreenMapControllers::Refresh()
|
|
|
|
|
{
|
2005-12-06 00:34:51 +00:00
|
|
|
FOREACH_GameController( p )
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
2005-12-05 17:49:25 +00:00
|
|
|
for( unsigned b=0; b<m_KeysToMap.size(); b++ )
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
2005-12-06 00:34:51 +00:00
|
|
|
const KeyToMap *pKey = &m_KeysToMap[b];
|
2005-02-20 04:53:57 +00:00
|
|
|
for( int s=0; s<NUM_SHOWN_GAME_TO_DEVICE_SLOTS; s++ )
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
2005-12-05 17:49:25 +00:00
|
|
|
bool bSelected = p == m_iCurController && (int) b == m_iCurButton && s == m_iCurSlot;
|
2003-09-01 04:21:16 +00:00
|
|
|
|
2005-12-06 00:34:51 +00:00
|
|
|
BitmapText *pText = pKey->m_textMappedTo[p][s];
|
|
|
|
|
GameInput cur_gi( p, pKey->m_GameButton );
|
2002-09-24 02:55:32 +00:00
|
|
|
DeviceInput di;
|
|
|
|
|
if( INPUTMAPPER->GameToDevice( cur_gi, s, di ) )
|
2005-12-05 17:13:42 +00:00
|
|
|
pText->SetText( di.toString() );
|
2002-09-24 02:55:32 +00:00
|
|
|
else
|
2005-12-05 17:13:42 +00:00
|
|
|
pText->SetText( "-----------" );
|
2002-09-24 02:55:32 +00:00
|
|
|
|
2003-09-01 04:21:16 +00:00
|
|
|
if( bSelected )
|
2002-09-24 02:55:32 +00:00
|
|
|
{
|
2003-09-11 03:47:13 +00:00
|
|
|
if( m_iWaitingForPress )
|
2005-12-05 17:24:34 +00:00
|
|
|
pText->PlayCommand( "Waiting" );
|
2002-09-24 02:55:32 +00:00
|
|
|
else
|
2005-12-05 17:24:34 +00:00
|
|
|
pText->PlayCommand( "Selected" );
|
2002-09-24 02:55:32 +00:00
|
|
|
}
|
|
|
|
|
else
|
2005-12-05 17:24:34 +00:00
|
|
|
pText->PlayCommand( "Unselected" );
|
2002-09-24 02:55:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-06-08 05:22:33 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (c) 2001-2004 Chris Danford
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the
|
|
|
|
|
* "Software"), to deal in the Software without restriction, including
|
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
* distribute, and/or sell copies of the Software, and to permit persons to
|
|
|
|
|
* whom the Software is furnished to do so, provided that the above
|
|
|
|
|
* copyright notice(s) and this permission notice appear in all copies of
|
|
|
|
|
* the Software and that both the above copyright notice(s) and this
|
|
|
|
|
* permission notice appear in supporting documentation.
|
|
|
|
|
*
|
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
|
|
|
|
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
|
|
|
|
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
|
|
|
|
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
|
|
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
|
|
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
|
* PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|