mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
- Fixed mouse boundary to game window for multi-monitor setup in full screen mode (vanilla bug) (by Buggler)
- Freed 'Ctrl+y' hotkey in tactical & laptop screen for other uses (by Buggler) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6407 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -113,7 +113,7 @@ BOOLEAN MessageBoxHandled()
|
||||
|
||||
void RemoveMessageBox( )
|
||||
{
|
||||
FreeMouseCursor( );
|
||||
FreeMouseCursor( FALSE );
|
||||
RemoveButton( iMsgBoxCancel );
|
||||
RemoveButton( iMsgBoxOk );
|
||||
RemoveButton( iMsgBoxBgrnd );
|
||||
|
||||
+3
-3
@@ -1106,7 +1106,7 @@ void ExitLaptop()
|
||||
//}
|
||||
|
||||
// release cursor
|
||||
FreeMouseCursor( );
|
||||
FreeMouseCursor( FALSE );
|
||||
|
||||
// set the fact we are currently not in laptop, for rendering purposes
|
||||
fCurrentlyInLaptop = FALSE;
|
||||
@@ -6029,13 +6029,13 @@ void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 us
|
||||
MarkButtonsDirty( );
|
||||
}
|
||||
}
|
||||
else if( ( ( usEvent == KEY_DOWN ) || ( usEvent == KEY_REPEAT ) ) && ( ( usParam == 'z' ) || ( usParam == 'y' ) ) )
|
||||
else if( ( ( usEvent == KEY_DOWN ) || ( usEvent == KEY_REPEAT ) ) && ( usParam == 'z' ) )
|
||||
{
|
||||
if ( usKeyState & CTRL_DOWN )
|
||||
{
|
||||
if( IsCursorRestricted( ) )
|
||||
{
|
||||
FreeMouseCursor( );
|
||||
FreeMouseCursor( FALSE );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+2
-2
@@ -322,7 +322,7 @@ INT32 DoChatBox( bool bIncludeChatLog, const STR16 zString, UINT32 uiExitScreen,
|
||||
{
|
||||
fCursorLockedToArea = TRUE;
|
||||
GetRestrictedClipCursor( &ChatBoxRestrictedCursorRegion );
|
||||
FreeMouseCursor( );
|
||||
FreeMouseCursor( FALSE );
|
||||
}
|
||||
|
||||
// vars for positioning controls on the chatbox
|
||||
@@ -501,7 +501,7 @@ INT32 DoChatBox( bool bIncludeChatLog, const STR16 zString, UINT32 uiExitScreen,
|
||||
|
||||
// Save mouse restriction region...
|
||||
GetRestrictedClipCursor( &gOldCursorLimitRectangle );
|
||||
FreeMouseCursor( );
|
||||
FreeMouseCursor( FALSE );
|
||||
|
||||
gfNewChatBox = TRUE;
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
||||
{
|
||||
fCursorLockedToArea = TRUE;
|
||||
GetRestrictedClipCursor( &MessageBoxRestrictedCursorRegion );
|
||||
FreeMouseCursor( );
|
||||
FreeMouseCursor( FALSE );
|
||||
}
|
||||
|
||||
// Create four numbered buttons
|
||||
@@ -798,7 +798,7 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
||||
|
||||
// Save mouse restriction region...
|
||||
GetRestrictedClipCursor( &gOldCursorLimitRectangle );
|
||||
FreeMouseCursor( );
|
||||
FreeMouseCursor( FALSE );
|
||||
|
||||
gfNewMessageBox = TRUE;
|
||||
|
||||
|
||||
@@ -50,7 +50,8 @@ extern BOOLEAN gfApplicationActive;
|
||||
BOOLEAN gfKeyState[256]; // TRUE = Pressed, FALSE = Not Pressed
|
||||
BOOLEAN fCursorWasClipped = FALSE;
|
||||
RECT gCursorClipRect;
|
||||
|
||||
extern BOOLEAN gfMouseLockedOnBorder;
|
||||
extern int iWindowedMode;
|
||||
|
||||
|
||||
// The gsKeyTranslationTables basically translates scan codes to our own key value table. Please note that the table is 2 bytes
|
||||
@@ -1590,10 +1591,23 @@ void RestrictMouseCursor(SGPRect *pRectangle)
|
||||
fCursorWasClipped = TRUE;
|
||||
}
|
||||
|
||||
void FreeMouseCursor(void)
|
||||
void FreeMouseCursor( BOOLEAN fLockForTacticalWindowedMode )
|
||||
{
|
||||
ClipCursor(NULL);
|
||||
fCursorWasClipped = FALSE;
|
||||
|
||||
// Buggler: Need to relock for fullscreen mode as ClipCursor release mouse boundary to full desktop resolution on multi-monitor setup &&
|
||||
// for windowed mode, lockscreen only when player activates feature in tactical screen due to mouse restriction applies to desktop too!
|
||||
if ( !iWindowedMode || ( iWindowedMode && gfMouseLockedOnBorder && fLockForTacticalWindowedMode ) )
|
||||
{
|
||||
SGPRect LJDRect;
|
||||
|
||||
LJDRect.iLeft = 0;
|
||||
LJDRect.iTop = 0;
|
||||
LJDRect.iRight = SCREEN_WIDTH;
|
||||
LJDRect.iBottom = SCREEN_HEIGHT;
|
||||
RestrictMouseCursor( &LJDRect );
|
||||
}
|
||||
}
|
||||
|
||||
void RestoreCursorClipRect( void )
|
||||
|
||||
@@ -105,7 +105,7 @@ extern BOOLEAN DequeueSpecificEvent(InputAtom *Event, UINT32 uiMaskFlags );
|
||||
|
||||
extern void RestrictMouseToXYXY(UINT16 usX1, UINT16 usY1, UINT16 usX2, UINT16 usY2);
|
||||
extern void RestrictMouseCursor(SGPRect *pRectangle);
|
||||
extern void FreeMouseCursor(void);
|
||||
extern void FreeMouseCursor( BOOLEAN fLockForTacticalWindowedMode );
|
||||
extern BOOLEAN IsCursorRestricted( void );
|
||||
extern void GetRestrictedClipCursor( SGPRect *pRectangle );
|
||||
extern void RestoreCursorClipRect( void );
|
||||
|
||||
@@ -567,7 +567,7 @@ INT32 FAR PASCAL WindowProcedure(HWND hWindow, UINT16 Message, WPARAM wParam, LP
|
||||
SuspendVideoManager();
|
||||
}
|
||||
gfApplicationActive=FALSE;
|
||||
FreeMouseCursor();
|
||||
FreeMouseCursor( FALSE );
|
||||
#endif
|
||||
// Set a flag to restore surfaces once a WM_ACTIVEATEAPP is received
|
||||
fRestore = TRUE;
|
||||
|
||||
@@ -715,7 +715,7 @@ void ShutdownVideoManager(void)
|
||||
}
|
||||
|
||||
// ATE: Release mouse cursor!
|
||||
FreeMouseCursor( );
|
||||
FreeMouseCursor( FALSE );
|
||||
|
||||
UnRegisterDebugTopic(TOPIC_VIDEO, "Video");
|
||||
}
|
||||
|
||||
@@ -4163,7 +4163,7 @@ void CancelInventoryZoomInput( BOOLEAN fButtonOff )
|
||||
// behave normally.
|
||||
fWaitingForZoomInput = 0;
|
||||
// Free up the mouse!
|
||||
FreeMouseCursor();
|
||||
FreeMouseCursor( FALSE );
|
||||
}
|
||||
|
||||
// HEADROCK HAM 5: This function handles animation from Unzoomed inventory mode to Zoomed inventory mode.
|
||||
|
||||
@@ -14469,7 +14469,7 @@ void ChangeMapScreenMaskCursor( UINT16 usCursor )
|
||||
if ( !InItemStackPopup( ) )
|
||||
{
|
||||
// cancel mouse restriction
|
||||
FreeMouseCursor();
|
||||
FreeMouseCursor( FALSE );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -5528,7 +5528,7 @@ void EndRubberBanding( )
|
||||
{
|
||||
if ( gRubberBandActive )
|
||||
{
|
||||
FreeMouseCursor( );
|
||||
FreeMouseCursor( TRUE );
|
||||
gfIgnoreScrolling = FALSE;
|
||||
|
||||
EndMultiSoldierSelection( TRUE );
|
||||
|
||||
@@ -9440,7 +9440,7 @@ void DeleteItemStackPopup( )
|
||||
EnableSMPanelButtons( TRUE, FALSE );
|
||||
}
|
||||
|
||||
FreeMouseCursor( );
|
||||
FreeMouseCursor( TRUE );
|
||||
|
||||
}
|
||||
|
||||
@@ -9686,7 +9686,7 @@ void DeleteKeyRingPopup( )
|
||||
EnableSMPanelButtons( TRUE, FALSE );
|
||||
}
|
||||
|
||||
FreeMouseCursor( );
|
||||
FreeMouseCursor( TRUE );
|
||||
}
|
||||
|
||||
UINT32 GetInterfaceGraphicForItem( INVTYPE *pItem )
|
||||
|
||||
@@ -3980,7 +3980,7 @@ void SMInvClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
{
|
||||
//the only way to merge items is to pick them up. In SKI when you pick up an item, the cursor is
|
||||
//locked in a region, free it up.
|
||||
FreeMouseCursor();
|
||||
FreeMouseCursor( TRUE );
|
||||
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, Message[ STR_MERGE_ITEMS ], SHOPKEEPER_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, MergeMessageBoxCallBack, NULL );
|
||||
}
|
||||
@@ -7773,7 +7773,7 @@ void SMInvMoneyButtonCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
//if we are in the shop keeper interface, free the cursor
|
||||
if( guiTacticalInterfaceFlags & INTERFACE_SHOPKEEP_INTERFACE )
|
||||
{
|
||||
FreeMouseCursor();
|
||||
FreeMouseCursor( TRUE );
|
||||
}
|
||||
|
||||
DoMessageBox( MSG_BOX_BASIC_STYLE, zText, SHOPKEEPER_SCREEN, ( UINT8 )MSG_BOX_FLAG_YESNO, ConfirmationToDepositMoneyToPlayersAccount, NULL );
|
||||
|
||||
@@ -1333,7 +1333,7 @@ BOOLEAN ExitShopKeeperInterface()
|
||||
DeleteItemDescriptionBox( );
|
||||
}
|
||||
|
||||
FreeMouseCursor();
|
||||
FreeMouseCursor( TRUE );
|
||||
|
||||
//Delete the main shopkeep background
|
||||
DeleteVideoObjectFromIndex( guiMainTradeScreenImage );
|
||||
@@ -4824,7 +4824,7 @@ void SetSkiCursor( UINT16 usCursor )
|
||||
|
||||
SetCurrentCursorFromDatabase( usCursor );
|
||||
|
||||
FreeMouseCursor();
|
||||
FreeMouseCursor( TRUE );
|
||||
|
||||
EnableAllDealersInventorySlots();
|
||||
EnableAllDealersOfferSlots();
|
||||
|
||||
@@ -193,6 +193,9 @@ extern INT16 ITEMDESC_START_Y;
|
||||
BOOLEAN gfMouseLockedOnBorder = FALSE;
|
||||
extern int iWindowedMode;
|
||||
|
||||
extern BOOLEAN gfInItemStackPopup;
|
||||
extern BOOLEAN gfInKeyRingPopup;
|
||||
|
||||
|
||||
//Little functions called by keyboard input
|
||||
void SwapGoggles(SOLDIERTYPE *pTeamSoldier);
|
||||
@@ -1605,25 +1608,26 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
|
||||
// BEGIN: by Lejardo for mouse-locking in game screen
|
||||
// WANNE: If the game runs in windowed mode, the user can "lock" / "unlock" the mouse cursor
|
||||
if (iWindowedMode)
|
||||
if ( iWindowedMode && !gfInKeyRingPopup && !gfInItemStackPopup)
|
||||
{
|
||||
SGPRect LJDRect;
|
||||
if ((InputEvent.usEvent == KEY_DOWN ) && ( InputEvent.usParam == 'z' || InputEvent.usParam == 'y'))
|
||||
if ((InputEvent.usEvent == KEY_DOWN ) && InputEvent.usParam == 'z' )
|
||||
{
|
||||
if( (InputEvent.usKeyState & CTRL_DOWN) && !(InputEvent.usKeyState & ALT_DOWN))
|
||||
{
|
||||
// Unlock the mouse cursor
|
||||
if (gfMouseLockedOnBorder)
|
||||
{
|
||||
FreeMouseCursor();
|
||||
FreeMouseCursor( FALSE );
|
||||
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_WINDOWED_MODE_RELEASE_MOUSE] );
|
||||
}
|
||||
// Lock the mouse cursor
|
||||
else
|
||||
{
|
||||
{
|
||||
SGPRect LJDRect;
|
||||
|
||||
LJDRect.iLeft = 0;
|
||||
LJDRect.iTop = 0;
|
||||
LJDRect.iTop = 0;
|
||||
LJDRect.iRight = SCREEN_WIDTH;
|
||||
LJDRect.iBottom = SCREEN_HEIGHT;
|
||||
RestrictMouseCursor( &LJDRect );
|
||||
@@ -1631,8 +1635,8 @@ void GetKeyboardInput( UINT32 *puiNewEvent )
|
||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, pMessageStrings[MSG_WINDOWED_MODE_LOCK_MOUSE] );
|
||||
}
|
||||
|
||||
gfMouseLockedOnBorder = !gfMouseLockedOnBorder;
|
||||
}
|
||||
gfMouseLockedOnBorder = !gfMouseLockedOnBorder;
|
||||
}
|
||||
}
|
||||
}
|
||||
// END: by Lejardo for mouse-locking in game screen
|
||||
|
||||
Reference in New Issue
Block a user