@@ -372,42 +372,43 @@ namespace RTE {
372
372
void UInputMan::ForceMouseWithinBox (int x, int y, int width, int height, int whichPlayer) const {
373
373
// Only mess with the mouse if the original mouse position is not above the screen and may be grabbing the title bar of the game window
374
374
if (!m_DisableMouseMoving && !m_TrapMousePos && (whichPlayer == Players::NoPlayer || m_ControlScheme.at (whichPlayer).GetDevice () == InputDevice::DEVICE_MOUSE_KEYB)) {
375
- position_mouse (Limit (mouse_x, x + width * g_FrameMan. GetResMultiplier () , x), Limit (mouse_y, y + height * g_FrameMan. GetResMultiplier () , y));
375
+ position_mouse (Limit (mouse_x, x + width, x), Limit (mouse_y, y + height, y));
376
376
}
377
377
}
378
378
379
379
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
380
380
381
381
void UInputMan::ForceMouseWithinPlayerScreen (int whichPlayer) const {
382
- if (whichPlayer < Players::PlayerOne || whichPlayer >= Players::PlayerFour) {
383
- return ;
384
- }
385
- unsigned int screenWidth = g_FrameMan.GetPlayerFrameBufferWidth (whichPlayer);
386
- unsigned int screenHeight = g_FrameMan.GetPlayerFrameBufferHeight (whichPlayer);
387
-
388
- if (g_FrameMan.GetScreenCount () > 1 ) {
389
- switch (whichPlayer) {
390
- case Players::PlayerOne:
391
- ForceMouseWithinBox (0 , 0 , screenWidth, screenHeight, whichPlayer);
392
- break ;
393
- case Players::PlayerTwo:
394
- if ((g_FrameMan.GetVSplit () && !g_FrameMan.GetHSplit ()) || (g_FrameMan.GetVSplit () && g_FrameMan.GetHSplit ())) {
395
- ForceMouseWithinBox (g_FrameMan.GetResX () / 2 , 0 , screenWidth, screenHeight, whichPlayer);
396
- } else {
397
- ForceMouseWithinBox (0 , g_FrameMan.GetResY () / 2 , screenWidth, screenHeight, whichPlayer);
398
- }
399
- break ;
400
- case Players::PlayerThree:
401
- ForceMouseWithinBox (0 , g_FrameMan.GetResY () / 2 , screenWidth, screenHeight, whichPlayer);
402
- break ;
403
- case Players::PlayerFour:
404
- ForceMouseWithinBox (g_FrameMan.GetResX () / 2 , g_FrameMan.GetResY () / 2 , screenWidth, screenHeight, whichPlayer);
405
- break ;
406
- default :
407
- RTEAbort (" Undefined player value passed in. See Players enumeration for defined values." )
382
+ if (whichPlayer >= Players::PlayerOne && whichPlayer < Players::MaxPlayerCount) {
383
+ int screenWidth = g_FrameMan.GetPlayerFrameBufferWidth (whichPlayer) * g_FrameMan.GetResMultiplier ();
384
+ int screenHeight = g_FrameMan.GetPlayerFrameBufferHeight (whichPlayer) * g_FrameMan.GetResMultiplier ();
385
+ int screenCount = g_FrameMan.GetScreenCount ();
386
+
387
+ if (screenCount > 1 ) {
388
+ switch (g_ActivityMan.GetActivity ()->ScreenOfPlayer (whichPlayer)) {
389
+ case 0 :
390
+ ForceMouseWithinBox (0 , 0 , screenWidth, screenHeight, whichPlayer);
391
+ break ;
392
+ case 1 :
393
+ if (screenCount >= 2 && g_FrameMan.GetVSplit ()) {
394
+ ForceMouseWithinBox (screenWidth, 0 , screenWidth, screenHeight, whichPlayer);
395
+ } else {
396
+ ForceMouseWithinBox (0 , screenHeight, screenWidth, screenHeight, whichPlayer);
397
+ }
398
+ break ;
399
+ case 2 :
400
+ ForceMouseWithinBox (0 , screenHeight, screenWidth, screenHeight, whichPlayer);
401
+ break ;
402
+ case 3 :
403
+ ForceMouseWithinBox (screenWidth, screenHeight, screenWidth, screenHeight, whichPlayer);
404
+ break ;
405
+ default :
406
+ // ScreenOfPlayer will return -1 for inactive player so do nothing.
407
+ break ;
408
+ }
409
+ } else {
410
+ ForceMouseWithinBox (0 , 0 , screenWidth, screenHeight, whichPlayer);
408
411
}
409
- } else {
410
- ForceMouseWithinBox (0 , 0 , screenWidth, screenHeight, whichPlayer);
411
412
}
412
413
}
413
414
0 commit comments