mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +02:00
Message boxes can now have the mouse over a default button.
First places this is used are the tactical sector menu (CTRL + .) where "Refill Canteens" is the default and the trap disarm menu where "Disarm" is the default. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7753 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+60
-3
@@ -79,7 +79,7 @@ CHAR16 gzUserDefinedButton[ NUM_CUSTOM_BUTTONS ][ 128 ];
|
||||
// sevenfm: added color for buttons
|
||||
UINT16 gzUserDefinedButtonColor[ NUM_CUSTOM_BUTTONS ];
|
||||
|
||||
INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect )
|
||||
INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect, UINT8 ubDefaultButton )
|
||||
{
|
||||
VSURFACE_DESC vs_desc;
|
||||
UINT16 usTextBoxWidth;
|
||||
@@ -326,10 +326,67 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
||||
{
|
||||
SimulateMouseMovement( ( gMsgBox.sX + ( usTextBoxWidth / 2 ) + 27 ), ( gMsgBox.sY + ( usTextBoxHeight - 10 ) ) );
|
||||
}
|
||||
else
|
||||
// silversurfer: new mouse positions over a default button
|
||||
// This can be expanded for other message box types if the need arises.
|
||||
else if( ubDefaultButton != MSG_BOX_DEFAULT_BUTTON_NONE )
|
||||
{
|
||||
SimulateMouseMovement( gMsgBox.sX + usTextBoxWidth / 2 , gMsgBox.sY + usTextBoxHeight - 4 );
|
||||
if( usFlags & MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS ) // 4 rows, 1 column, medium button size
|
||||
{
|
||||
sButtonX = usTextBoxWidth / 2;
|
||||
sButtonY = usTextBoxHeight - ( (4 - ubDefaultButton) * (MSGBOX_BUTTON_HEIGHT + MSGBOX_SMALL_BUTTON_X_SEP + 5) + 35 );
|
||||
}
|
||||
else if( usFlags & MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS )
|
||||
{
|
||||
if( ubStyle == MSG_BOX_BASIC_MEDIUM_BUTTONS ) // 4 rows, 2 columns, medium button size
|
||||
{
|
||||
// left or right
|
||||
if( ubDefaultButton % 2)
|
||||
sButtonX = usTextBoxWidth / 2 - MSGBOX_BUTTON_WIDTH;
|
||||
else
|
||||
sButtonX = usTextBoxWidth / 2 + MSGBOX_BUTTON_WIDTH;
|
||||
|
||||
sButtonY = usTextBoxHeight - ( (4 - (UINT8)(ubDefaultButton / 2.0f + 0.6f) ) * (MSGBOX_BUTTON_HEIGHT + MSGBOX_SMALL_BUTTON_X_SEP + 5) + 35 );
|
||||
}
|
||||
else // 2 rows, 4 columns, small button size
|
||||
{
|
||||
// left or right
|
||||
if( (UINT8)(ubDefaultButton / 2.0f + 0.6f) % 2 )
|
||||
sButtonX = usTextBoxWidth / 2 - MSGBOX_SMALL_BUTTON_WIDTH / 2 - (ubDefaultButton % 2) * MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
|
||||
else
|
||||
sButtonX = usTextBoxWidth / 2 + MSGBOX_SMALL_BUTTON_WIDTH / 2 + (1 - ubDefaultButton % 2) * MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
|
||||
|
||||
sButtonY = usTextBoxHeight - ( (2 - (UINT8)(ubDefaultButton / 4.0f + 0.8f) ) * (MSGBOX_BUTTON_HEIGHT + 10) + 30 );
|
||||
}
|
||||
}
|
||||
else if( usFlags & MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS )
|
||||
{
|
||||
if( ubStyle == MSG_BOX_BASIC_STYLE ) // 4x4 medium button size
|
||||
{
|
||||
// left or right
|
||||
if( (UINT8)(ubDefaultButton / 2.0f + 0.6f) % 2 )
|
||||
sButtonX = usTextBoxWidth / 2 - MSGBOX_BUTTON_WIDTH / 2 - (ubDefaultButton % 2) * MSGBOX_BUTTON_WIDTH;
|
||||
else
|
||||
sButtonX = usTextBoxWidth / 2 + MSGBOX_BUTTON_WIDTH / 2 + (1 - ubDefaultButton % 2) * MSGBOX_BUTTON_WIDTH;
|
||||
|
||||
sButtonY = usTextBoxHeight - ( (4 - (UINT8)(ubDefaultButton / 4.0f + 0.8f) ) * (MSGBOX_BUTTON_HEIGHT + 5) + 30 );
|
||||
}
|
||||
else // 4x4 small button size
|
||||
{
|
||||
// left or right
|
||||
if( (UINT8)(ubDefaultButton / 2.0f + 0.6f) % 2 )
|
||||
sButtonX = usTextBoxWidth / 2 - MSGBOX_SMALL_BUTTON_WIDTH / 2 - (ubDefaultButton % 2) * MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
|
||||
else
|
||||
sButtonX = usTextBoxWidth / 2 + MSGBOX_SMALL_BUTTON_WIDTH / 2 + (1 - ubDefaultButton % 2) * MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
|
||||
|
||||
sButtonY = usTextBoxHeight - ( (4 - (UINT8)(ubDefaultButton / 4.0f + 0.8f) ) * (MSGBOX_BUTTON_HEIGHT + 10) + 20 );
|
||||
}
|
||||
}
|
||||
|
||||
SimulateMouseMovement( gMsgBox.sX + sButtonX , gMsgBox.sY + sButtonY );
|
||||
}
|
||||
// old default mouse position at bottom center of message box
|
||||
else
|
||||
SimulateMouseMovement( gMsgBox.sX + usTextBoxWidth / 2 , gMsgBox.sY + usTextBoxHeight - 4 );
|
||||
}
|
||||
|
||||
// Add region
|
||||
|
||||
+22
-1
@@ -43,6 +43,27 @@ enum
|
||||
MSG_BOX_BASIC_MEDIUM_BUTTONS,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MSG_BOX_DEFAULT_BUTTON_NONE = 0,
|
||||
|
||||
MSG_BOX_DEFAULT_BUTTON_1,
|
||||
MSG_BOX_DEFAULT_BUTTON_2,
|
||||
MSG_BOX_DEFAULT_BUTTON_3,
|
||||
MSG_BOX_DEFAULT_BUTTON_4,
|
||||
MSG_BOX_DEFAULT_BUTTON_5,
|
||||
MSG_BOX_DEFAULT_BUTTON_6,
|
||||
MSG_BOX_DEFAULT_BUTTON_7,
|
||||
MSG_BOX_DEFAULT_BUTTON_8,
|
||||
MSG_BOX_DEFAULT_BUTTON_9,
|
||||
MSG_BOX_DEFAULT_BUTTON_10,
|
||||
MSG_BOX_DEFAULT_BUTTON_11,
|
||||
MSG_BOX_DEFAULT_BUTTON_12,
|
||||
MSG_BOX_DEFAULT_BUTTON_13,
|
||||
MSG_BOX_DEFAULT_BUTTON_14,
|
||||
MSG_BOX_DEFAULT_BUTTON_15,
|
||||
MSG_BOX_DEFAULT_BUTTON_16,
|
||||
};
|
||||
|
||||
typedef void (*MSGBOX_CALLBACK)( UINT8 bExitValue );
|
||||
|
||||
@@ -106,7 +127,7 @@ extern CHAR16 gszMsgBoxInputString[255];
|
||||
// pCenteringRect Rect to send if MSG_BOX_FLAG_USE_CENTERING_RECT set. Can be NULL
|
||||
////////////////////////////////
|
||||
|
||||
INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect );
|
||||
INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect, UINT8 ubDefaultButton = MSG_BOX_DEFAULT_BUTTON_NONE );
|
||||
void DoScreenIndependantMessageBox( const STR16 zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||
void DoUpperScreenIndependantMessageBox( const STR16 zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||
|
||||
|
||||
@@ -4977,7 +4977,7 @@ void StartTacticalFunctionSelectionMessageBox( SOLDIERTYPE * pSoldier, INT32 sGr
|
||||
wcscpy( gzUserDefinedButton[6], TacticalStr[ UNUSED_STR ] );
|
||||
|
||||
wcscpy( gzUserDefinedButton[7], TacticalStr[ UNUSED_STR ] );
|
||||
DoMessageBox( MSG_BOX_BASIC_MEDIUM_BUTTONS, TacticalStr[ FUNCTION_SELECTION_STR ], GAME_SCREEN, MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS, TacticalFunctionSelectionMessageBoxCallBack, NULL );
|
||||
DoMessageBox( MSG_BOX_BASIC_MEDIUM_BUTTONS, TacticalStr[ FUNCTION_SELECTION_STR ], GAME_SCREEN, MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS, TacticalFunctionSelectionMessageBoxCallBack, NULL, MSG_BOX_DEFAULT_BUTTON_1 );
|
||||
}
|
||||
|
||||
void CleanWeapons( BOOLEAN fEntireTeam )
|
||||
@@ -7075,7 +7075,7 @@ void ExtendedDisarmMessageBox(void)
|
||||
wcscpy( gzUserDefinedButton[2], TacticalStr[ DISARM_DIALOG_REMOVE_BLUEFLAG ] );
|
||||
wcscpy( gzUserDefinedButton[3], TacticalStr[ DISARM_DIALOG_BLOWUP ] );
|
||||
}
|
||||
DoMessageBox( MSG_BOX_BASIC_MEDIUM_BUTTONS, TacticalStr[ DISARM_BOOBYTRAP_PROMPT ], guiCurrentScreen, MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS, ExtendedBoobyTrapMessageBoxCallBack, NULL );
|
||||
DoMessageBox( MSG_BOX_BASIC_MEDIUM_BUTTONS, TacticalStr[ DISARM_BOOBYTRAP_PROMPT ], guiCurrentScreen, MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS, ExtendedBoobyTrapMessageBoxCallBack, NULL, MSG_BOX_DEFAULT_BUTTON_1 );
|
||||
}
|
||||
|
||||
void ExtendedBoobyTrapMessageBoxCallBack( UINT8 ubExitValue )
|
||||
|
||||
Reference in New Issue
Block a user