|
Link Here
|
| 662 |
|
662 |
|
| 663 |
UIListEntry *p; |
663 |
UIListEntry *p; |
| 664 |
|
664 |
|
| 665 |
p = pList->addEntry(GAMETEXT_DRIVE); p->Text.push_back(m_Config.getString("KeyDrive1")); |
665 |
p = pList->addEntry(GAMETEXT_DRIVE); |
| 666 |
p = pList->addEntry(GAMETEXT_BRAKE); p->Text.push_back(m_Config.getString("KeyBrake1")); |
666 |
p->pvUser = (void*) m_Config.getInteger("KeyDrive1"); |
| 667 |
p = pList->addEntry(GAMETEXT_FLIPLEFT); p->Text.push_back(m_Config.getString("KeyFlipLeft1")); |
667 |
p->Text.push_back(m_InputHandler.keyToString((int) p->pvUser)); |
| 668 |
p = pList->addEntry(GAMETEXT_FLIPRIGHT); p->Text.push_back(m_Config.getString("KeyFlipRight1")); |
668 |
|
| 669 |
p = pList->addEntry(GAMETEXT_CHANGEDIR); p->Text.push_back(m_Config.getString("KeyChangeDir1")); |
669 |
p = pList->addEntry(GAMETEXT_BRAKE); |
|
|
670 |
p->pvUser = (void*) m_Config.getInteger("KeyBrake1"); |
| 671 |
p->Text.push_back(m_InputHandler.keyToString((int) p->pvUser)); |
| 672 |
|
| 673 |
p = pList->addEntry(GAMETEXT_FLIPLEFT); |
| 674 |
p->pvUser = (void*) m_Config.getInteger("KeyFlipLeft1"); |
| 675 |
p->Text.push_back(m_InputHandler.keyToString((int) p->pvUser)); |
| 676 |
|
| 677 |
p = pList->addEntry(GAMETEXT_FLIPRIGHT); |
| 678 |
p->pvUser = (void*) m_Config.getInteger("KeyFlipRight1"); |
| 679 |
p->Text.push_back(m_InputHandler.keyToString((int) p->pvUser)); |
| 680 |
|
| 681 |
p = pList->addEntry(GAMETEXT_CHANGEDIR); |
| 682 |
p->pvUser = (void*) m_Config.getInteger("KeyChangeDir1"); |
| 683 |
p->Text.push_back(m_InputHandler.keyToString((int) p->pvUser)); |
| 670 |
} |
684 |
} |
| 671 |
|
685 |
|
| 672 |
/*=========================================================================== |
686 |
/*=========================================================================== |
|
Link Here
|
| 1277 |
/*=========================================================================== |
1291 |
/*=========================================================================== |
| 1278 |
Change a key config/joystick stuff |
1292 |
Change a key config/joystick stuff |
| 1279 |
===========================================================================*/ |
1293 |
===========================================================================*/ |
| 1280 |
int GameApp::_IsKeyInUse(const std::string &Key) { |
1294 |
int GameApp::_IsKeyInUse(int nKey) { |
| 1281 |
UIList *pActionList = (UIList *)m_pOptionsWindow->getChild("OPTIONS_TABS:CONTROLS_TAB:KEY_ACTION_LIST"); |
1295 |
UIList *pActionList = (UIList *)m_pOptionsWindow->getChild("OPTIONS_TABS:CONTROLS_TAB:KEY_ACTION_LIST"); |
| 1282 |
|
1296 |
|
| 1283 |
for(int i=0;i<pActionList->getEntries().size();i++) { |
1297 |
for(int i=0;i<pActionList->getEntries().size();i++) { |
| 1284 |
if(pActionList->getEntries()[i]->Text[1] == Key) return i; |
1298 |
if(pActionList->getEntries()[i]->pvUser == (void*) nKey) return i; |
| 1285 |
} |
1299 |
} |
| 1286 |
return -1; |
1300 |
return -1; |
| 1287 |
} |
1301 |
} |
|
Link Here
|
| 1329 |
|
1343 |
|
| 1330 |
while(1) { |
1344 |
while(1) { |
| 1331 |
/* Wait for a key */ |
1345 |
/* Wait for a key */ |
| 1332 |
std::string NewKey = m_InputHandler.waitForKey(); |
1346 |
int NewKey = m_InputHandler.waitForKey(); |
| 1333 |
if(NewKey == "<<QUIT>>") { |
1347 |
if(NewKey < 0) { |
| 1334 |
/* Quit! */ |
1348 |
/* Quit! */ |
| 1335 |
quit(); |
1349 |
quit(); |
| 1336 |
} |
1350 |
} |
| 1337 |
else if(NewKey == "<<CANCEL>>" || NewKey == "") { |
1351 |
else if(NewKey == 0) { |
| 1338 |
/* Do nothing */ |
1352 |
/* Do nothing */ |
| 1339 |
break; |
1353 |
break; |
| 1340 |
} |
1354 |
} |
|
Link Here
|
| 1343 |
int nAlreadyUsedBy = _IsKeyInUse(NewKey); |
1357 |
int nAlreadyUsedBy = _IsKeyInUse(NewKey); |
| 1344 |
|
1358 |
|
| 1345 |
if(nAlreadyUsedBy<0 || nAlreadyUsedBy == nSel) { |
1359 |
if(nAlreadyUsedBy<0 || nAlreadyUsedBy == nSel) { |
| 1346 |
pActionList->getEntries()[nSel]->Text[1] = NewKey; |
1360 |
pActionList->getEntries()[nSel]->pvUser = (void*) NewKey; |
|
|
1361 |
pActionList->getEntries()[nSel]->Text[1] = m_InputHandler.keyToString(NewKey); |
| 1347 |
break; |
1362 |
break; |
| 1348 |
} |
1363 |
} |
| 1349 |
else { |
1364 |
else { |
|
Link Here
|
| 1717 |
else if(pJoystickControl->getChecked()) m_Config.setString("ControllerMode1","Joystick1"); |
1732 |
else if(pJoystickControl->getChecked()) m_Config.setString("ControllerMode1","Joystick1"); |
| 1718 |
|
1733 |
|
| 1719 |
for(int i=0;i<pActionList->getEntries().size();i++) { |
1734 |
for(int i=0;i<pActionList->getEntries().size();i++) { |
| 1720 |
if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_DRIVE) m_Config.setString("KeyDrive1",pActionList->getEntries()[i]->Text[1]); |
1735 |
if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_DRIVE) m_Config.setInteger("KeyDrive1",(int) pActionList->getEntries()[i]->pvUser); |
| 1721 |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_BRAKE) m_Config.setString("KeyBrake1",pActionList->getEntries()[i]->Text[1]); |
1736 |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_BRAKE) m_Config.setInteger("KeyBrake1",(int) pActionList->getEntries()[i]->pvUser); |
| 1722 |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_FLIPLEFT) m_Config.setString("KeyFlipLeft1",pActionList->getEntries()[i]->Text[1]); |
1737 |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_FLIPLEFT) m_Config.setInteger("KeyFlipLeft1",(int) pActionList->getEntries()[i]->pvUser); |
| 1723 |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_FLIPRIGHT) m_Config.setString("KeyFlipRight1",pActionList->getEntries()[i]->Text[1]); |
1738 |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_FLIPRIGHT) m_Config.setInteger("KeyFlipRight1",(int) pActionList->getEntries()[i]->pvUser); |
| 1724 |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_CHANGEDIR) m_Config.setString("KeyChangeDir1",pActionList->getEntries()[i]->Text[1]); |
1739 |
else if(pActionList->getEntries()[i]->Text[0] == GAMETEXT_CHANGEDIR) m_Config.setInteger("KeyChangeDir1",(int) pActionList->getEntries()[i]->pvUser); |
| 1725 |
} |
1740 |
} |
| 1726 |
|
1741 |
|
| 1727 |
m_Config.setBool("EngineSoundEnable",pEnableEngineSoundButton->getChecked()); |
1742 |
m_Config.setBool("EngineSoundEnable",pEnableEngineSoundButton->getChecked()); |