File tree Expand file tree Collapse file tree 4 files changed +43
-4
lines changed Expand file tree Collapse file tree 4 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -313,13 +313,17 @@ int Activity::Start() {
313
313
}
314
314
315
315
// Intentionally doing all players, all need controllers
316
+ std::vector<int > playerControlled;
316
317
for (int player = Players::PlayerOne; player < Players::MaxPlayerCount; ++player) {
317
318
m_ViewState[player] = ViewState::Normal;
318
319
319
320
m_PlayerController[player].Reset ();
320
321
m_PlayerController[player].Create (Controller::CIM_PLAYER, player);
321
322
m_PlayerController[player].SetTeam (m_Team[player]);
322
323
324
+ if (m_IsHuman[player]) {
325
+ playerControlled.push_back (player);
326
+ }
323
327
m_MessageTimer[player].Reset ();
324
328
325
329
if (int screenId = ScreenOfPlayer (player); screenId != -1 ) {
@@ -336,6 +340,8 @@ int Activity::Start() {
336
340
}
337
341
}
338
342
343
+ g_UInputMan.CheckMultiMouseKeyboardEnabled (playerControlled);
344
+
339
345
return 0 ;
340
346
}
341
347
Original file line number Diff line number Diff line change @@ -330,6 +330,13 @@ void ActivityMan::ResumeActivity() {
330
330
m_InActivity = true ;
331
331
m_ActivityNeedsResume = false ;
332
332
333
+ std::vector<int > humanPlayers;
334
+ for (int player = 0 ; player < MaxPlayerCount; player++) {
335
+ if (m_Activity->PlayerHuman (player)) {
336
+ humanPlayers.push_back (player);
337
+ }
338
+ }
339
+ g_UInputMan.CheckMultiMouseKeyboardEnabled (humanPlayers);
333
340
PauseActivity (false );
334
341
g_TimerMan.PauseSim (false );
335
342
g_PerformanceMan.ResetPerformanceTimings ();
Original file line number Diff line number Diff line change @@ -426,10 +426,18 @@ bool ScenarioActivityConfigGUI::HandleInputEvents() {
426
426
g_GUISound.BackButtonPressSound ()->Play ();
427
427
SetEnabled (false );
428
428
} else if (guiEvent.GetControl () == m_StartGameButton) {
429
- g_GUISound.ButtonPressSound ()->Play ();
430
- StartGame ();
431
- SetEnabled (false );
432
- return true ;
429
+ // Make sure all players have known input devices if multimouse is enabled.
430
+ std::vector humanPlayers = GetHumanPlayers ();
431
+ if (g_UInputMan.CheckMultiMouseKeyboardEnabled (humanPlayers) && g_UInputMan.AllPlayerInputDevicesKnown (humanPlayers)) {
432
+ g_GUISound.ButtonPressSound ()->Play ();
433
+ StartGame ();
434
+ SetEnabled (false );
435
+ return true ;
436
+ } else {
437
+ // TODO: Show message and device selection.
438
+ g_GUISound.UserErrorSound ()->Play ();
439
+ return false ;
440
+ }
433
441
}
434
442
} else if (guiEvent.GetType () == GUIEvent::Notification) {
435
443
if (guiEvent.GetControl () == m_ActivityDifficultySlider) {
@@ -454,6 +462,21 @@ bool ScenarioActivityConfigGUI::HandleInputEvents() {
454
462
return false ;
455
463
}
456
464
465
+ std::vector<int > ScenarioActivityConfigGUI::GetHumanPlayers () {
466
+ std::vector<int > humanPlayers;
467
+ for (int player = Players::PlayerOne; player < PlayerColumns::PlayerColumnCount; ++player) {
468
+ for (int team = Activity::Teams::TeamOne; team < Activity::Teams::MaxTeamCount; ++team) {
469
+ if (m_PlayerBoxes.at (player).at (team)->GetDrawType () == GUICollectionBox::Image) {
470
+ if (player != PlayerColumns::PlayerCPU) {
471
+ humanPlayers.push_back (player);
472
+ break ;
473
+ }
474
+ }
475
+ }
476
+ }
477
+ return humanPlayers;
478
+ }
479
+
457
480
void ScenarioActivityConfigGUI::Draw () {
458
481
m_GUIControlManager->Draw ();
459
482
Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ namespace RTE {
101
101
// / Fills each team's Tech ComboBox with all valid Tech DataModules.
102
102
void PopulateTechComboBoxes ();
103
103
104
+ // / Helper function for multimouse support. Creates a list of human controlled players.
105
+ std::vector<int > GetHumanPlayers ();
106
+
104
107
// / Resets the configuration screen to the selected Activity's default settings and enables/disables attribute settings accordingly, making the configuration screen ready for interaction.
105
108
void ResetActivityConfigBox ();
106
109
You can’t perform that action at this time.
0 commit comments