|
|
| |
UIListEntry *p; | UIListEntry *p; |
| |
p = pList->addEntry(GAMETEXT_DRIVE); p->Text.push_back(m_Config.getString("KeyDrive1")); |
p = pList->addEntry(GAMETEXT_DRIVE); |
p = pList->addEntry(GAMETEXT_BRAKE); p->Text.push_back(m_Config.getString("KeyBrake1")); |
p->pvUser = (void*) m_Config.getInteger("KeyDrive1"); |
p = pList->addEntry(GAMETEXT_FLIPLEFT); p->Text.push_back(m_Config.getString("KeyFlipLeft1")); |
p->Text.push_back(m_InputHandler.keyToString((int) p->pvUser)); |
p = pList->addEntry(GAMETEXT_FLIPRIGHT); p->Text.push_back(m_Config.getString("KeyFlipRight1")); |
|
p = pList->addEntry(GAMETEXT_CHANGEDIR); p->Text.push_back(m_Config.getString("KeyChangeDir1")); |
p = pList->addEntry(GAMETEXT_BRAKE); |
|
p->pvUser = (void*) m_Config.getInteger("KeyBrake1"); |
|
p->Text.push_back(m_InputHandler.keyToString((int) p->pvUser)); |
|
|
|
p = pList->addEntry(GAMETEXT_FLIPLEFT); |
|
p->pvUser = (void*) m_Config.getInteger("KeyFlipLeft1"); |
|
p->Text.push_back(m_InputHandler.keyToString((int) p->pvUser)); |
|
|
|
p = pList->addEntry(GAMETEXT_FLIPRIGHT); |
|
p->pvUser = (void*) m_Config.getInteger("KeyFlipRight1"); |
|
p->Text.push_back(m_InputHandler.keyToString((int) p->pvUser)); |
|
|
|
p = pList->addEntry(GAMETEXT_CHANGEDIR); |
|
p->pvUser = (void*) m_Config.getInteger("KeyChangeDir1"); |
|
p->Text.push_back(m_InputHandler.keyToString((int) p->pvUser)); |
} | } |
| |
/*=========================================================================== | /*=========================================================================== |
|
|
/*=========================================================================== | /*=========================================================================== |
Change a key config/joystick stuff | Change a key config/joystick stuff |
===========================================================================*/ | ===========================================================================*/ |
int GameApp::_IsKeyInUse(const std::string &Key) { |
int GameApp::_IsKeyInUse(int nKey) { |
UIList *pActionList = (UIList *)m_pOptionsWindow->getChild("OPTIONS_TABS:CONTROLS_TAB:KEY_ACTION_LIST"); | UIList *pActionList = (UIList *)m_pOptionsWindow->getChild("OPTIONS_TABS:CONTROLS_TAB:KEY_ACTION_LIST"); |
| |
for(int i=0;i<pActionList->getEntries().size();i++) { | for(int i=0;i<pActionList->getEntries().size();i++) { |
if(pActionList->getEntries()[i]->Text[1] == Key) return i; |
if(pActionList->getEntries()[i]->pvUser == (void*) nKey) return i; |
} | } |
return -1; | return -1; |
} | } |
|
|
| |
while(1) { | while(1) { |
/* Wait for a key */ | /* Wait for a key */ |
std::string NewKey = m_InputHandler.waitForKey(); |
int NewKey = m_InputHandler.waitForKey(); |
if(NewKey == "<<QUIT>>") { |
if(NewKey < 0) { |
/* Quit! */ | /* Quit! */ |
quit(); | quit(); |
} | } |
else if(NewKey == "<<CANCEL>>" || NewKey == "") { |
else if(NewKey == 0) { |
/* Do nothing */ | /* Do nothing */ |
break; | break; |
} | } |
|
|
int nAlreadyUsedBy = _IsKeyInUse(NewKey); | int nAlreadyUsedBy = _IsKeyInUse(NewKey); |
| |
if(nAlreadyUsedBy<0 || nAlreadyUsedBy == nSel) { | if(nAlreadyUsedBy<0 || nAlreadyUsedBy == nSel) { |
pActionList->getEntries()[nSel]->Text[1] = NewKey; |
pActionList->getEntries()[nSel]->pvUser = (void*) NewKey; |
|
pActionList->getEntries()[nSel]->Text[1] = m_InputHandler.keyToString(NewKey); |
break; | break; |
} | } |
else { | else { |
|
|
else if(pJoystickControl->getChecked()) m_Config.setString("ControllerMode1","Joystick1"); | else if(pJoystickControl->getChecked()) m_Config.setString("ControllerMode1","Joystick1"); |
| |
for(int i=0;i<pActionList->getEntries().size();i++) { | for(int i=0;i<pActionList->getEntries().size();i++) { |
if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_DRIVE) m_Config.setString("KeyDrive1",pActionList->getEntries()[i]->Text[1]); |
if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_DRIVE) m_Config.setInteger("KeyDrive1",(int) pActionList->getEntries()[i]->pvUser); |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_BRAKE) m_Config.setString("KeyBrake1",pActionList->getEntries()[i]->Text[1]); |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_BRAKE) m_Config.setInteger("KeyBrake1",(int) pActionList->getEntries()[i]->pvUser); |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_FLIPLEFT) m_Config.setString("KeyFlipLeft1",pActionList->getEntries()[i]->Text[1]); |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_FLIPLEFT) m_Config.setInteger("KeyFlipLeft1",(int) pActionList->getEntries()[i]->pvUser); |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_FLIPRIGHT) m_Config.setString("KeyFlipRight1",pActionList->getEntries()[i]->Text[1]); |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_FLIPRIGHT) m_Config.setInteger("KeyFlipRight1",(int) pActionList->getEntries()[i]->pvUser); |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_CHANGEDIR) m_Config.setString("KeyChangeDir1",pActionList->getEntries()[i]->Text[1]); |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_CHANGEDIR) m_Config.setInteger("KeyChangeDir1",(int) pActionList->getEntries()[i]->pvUser); |
} | } |
| |
m_Config.setBool("EngineSoundEnable",pEnableEngineSoundButton->getChecked()); | m_Config.setBool("EngineSoundEnable",pEnableEngineSoundButton->getChecked()); |