void startsetMainController(int controller) { IN_SetMainController(controller); if ( !wasPlugged[controller]) { mainControllerDelayedUnplug = 1 << controller; } }
// extern void G_DemoKeypress(); // extern void CG_SkipCredits(void); void IN_CommonJoyPress(int controller, fakeAscii_t button, bool pressed) { // Check for special cases for map hack // This should be #ifdef'd out in FINAL_BUILD, but I really don't care. // If someone wants to copy the retail version to their modded xbox and // edit the config file to turn on maphack, let them. if (Cvar_VariableIntegerValue("cl_maphack")) { if (_UIRunning && button == A_JOY11 && pressed) { // Left trigger -> F1 Sys_QueEvent( 0, SE_KEY, A_F1, pressed, 0, NULL ); return; } else if (_UIRunning && button == A_JOY12 && pressed) { // Right trigger -> F2 Sys_QueEvent( 0, SE_KEY, A_F2, pressed, 0, NULL ); return; } else if (_UIRunning && button == A_JOY4 && pressed) { // Start button -> F3 IN_SetMainController(controller); Sys_QueEvent( 0, SE_KEY, A_F3, pressed, 0, NULL ); return; } } if(IN_GetMainController() == controller || _UIRunning) { // Always map start button to ESCAPE if (!_UIRunning && button == A_JOY4 && cls.state != CA_CINEMATIC) Sys_QueEvent( 0, SE_KEY, A_ESCAPE, pressed, 0, NULL ); #ifdef DEBUG_CONTROLLER if (controller != 3) #endif Sys_QueEvent( 0, SE_KEY, _UIRunning ? UIJoy2Key(button) : button, pressed, 0, NULL ); } #ifdef DEBUG_CONTROLLER if (controller == 3 && pressed) { HandleDebugJoystickPress(button); return; } #endif }
// extern void G_DemoKeypress(); // extern void CG_SkipCredits(void); void IN_CommonJoyPress(int controller, fakeAscii_t button, bool pressed) { // Check for special cases for map hack #ifndef FINAL_BUILD if (Cvar_VariableIntegerValue("cl_maphack")) { if (_UIRunning && button == A_JOY11 && pressed) { // Left trigger -> F1 Sys_QueEvent( 0, SE_KEY, A_F1, pressed, 0, NULL ); return; } else if (_UIRunning && button == A_JOY12 && pressed) { // Right trigger -> F2 Sys_QueEvent( 0, SE_KEY, A_F2, pressed, 0, NULL ); return; } else if (_UIRunning && button == A_JOY4 && pressed) { // Start button -> F3 IN_SetMainController(controller); Sys_QueEvent( 0, SE_KEY, A_F3, pressed, 0, NULL ); return; } } #endif if(IN_GetMainController() == controller || _UIRunning) { // Always map start button to ESCAPE if (!_UIRunning && button == A_JOY4 && cls.state != CA_CINEMATIC) Sys_QueEvent( 0, SE_KEY, A_ESCAPE, pressed, 0, NULL ); #ifndef FINAL_BUILD if (controller != 3 || !cheatPadEnabled) #endif Sys_QueEvent( 0, SE_KEY, _UIRunning ? UIJoy2Key(button) : button, pressed, 0, NULL ); } /* if (pressed) { G_DemoKeypress(); } //Hacky! Skip the credits if start is pressed. if(button == K_JOY4 && pressed) { CG_SkipCredits(); } */ #ifndef FINAL_BUILD if (controller == 3 && pressed && cheatPadEnabled) { HandleDebugJoystickPress(button); return; } #endif /* extern int player1ControllerId; extern int player2ControllerId; extern bool checkForPlayerControllers; extern bool controllerUnplugged; // If the game isn't started yet if ((ClientManager::Shared().cls.cgameStarted == qfalse) && (!controllerUnplugged)) { // and player1 doesnt have a controllerid, then assign client 1 to this controller if (player1ControllerId == -1) { ClientManager::ActivateClient(0); if (ClientManager::ActiveController() != controller) ClientManager::SetActiveController(controller); } // player1 has a controller that is different then input recieved, and player2 doesnt have a controller and there are 2 clients else if (player1ControllerId != controller && player2ControllerId == -1 && ClientManager::NumClients() > 1) { ClientManager::ActivateClient(1); if (ClientManager::ActiveController() != controller) ClientManager::SetActiveController(controller); } } if (ClientManager::ActivateByControllerId(controller)) { #ifdef _XBOX //Check the status of the white or black buttons. if (button == K_JOY9) { ClientManager::ActiveClient().whiteButtonDown = pressed; } else if(button == K_JOY10) { ClientManager::ActiveClient().blackButtonDown = pressed; } //Ignore white/black button presses if inv/force/weap select is up. //This is ugly. It basically says return if the UI isn't running, if //we got a white or black button, and if the inv/force/weapon select is //running. if(!_UIRunning && (button == K_JOY9 || button == K_JOY10) && (ClientManager::ActiveClient().cg.inventorySelectTime + WEAPON_SELECT_TIME > ClientManager::ActiveClient().cg.time || ClientManager::ActiveClient().cg.forcepowerSelectTime + WEAPON_SELECT_TIME > ClientManager::ActiveClient().cg.time || ClientManager::ActiveClient().cg.weaponSelectTime + WEAPON_SELECT_TIME > ClientManager::ActiveClient().cg.time)) { if(!pressed) { //And it just gets hackier! Is that a word? It is now! //If we've released the button and it wasn't down too long... if((button == K_JOY9 && ClientManager::ActiveClient().whiteButtonHoldTime < MAX_WB_HOLD_TIME) || (button == K_JOY10 && ClientManager::ActiveClient().whiteButtonHoldTime < MAX_WB_HOLD_TIME)) { //If we've already let the button press through previously, //just send a release message. Otherwise send both a press //and release. if(ClientManager::ActiveClient().keys[button].down) { Sys_QueEvent( 0, SE_KEY, button, false, 0, NULL ); } else { Sys_QueEvent( 0, SE_KEY, button, true, 0, NULL ); Sys_QueEvent( 0, SE_KEY, button, false, 0, NULL ); } } } return; } #endif if (!_UIRunning) { Sys_QueEvent( 0, SE_KEY, button, pressed, 0, NULL ); } else { // int clientNum = ClientManager::ActiveClientNum(); int clientNum = 0; // VVFIXME int qL = uiQueueLen[clientNum]; if(qL < 5) { uiKeyQueue[clientNum][qL].button = UIJoy2Key(button); uiKeyQueue[clientNum][qL].pressed = pressed; uiQueueLen[clientNum]++; } //Sys_QueEvent(0, SE_KEY, UIJoy2Key(button), pressed, 0, NULL); } */ /* } */ }