mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Message boxes can have a dropdown. For usage, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=20659&goto=341863&#msg_341863
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7935 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+7
-7
@@ -145,17 +145,17 @@ DropDownBase::Create(UINT16 sX, UINT16 sY)
|
|||||||
|
|
||||||
gDropObj = (void*) this;
|
gDropObj = (void*) this;
|
||||||
|
|
||||||
MSYS_DefineRegion( &mSelectedOpenDropDownRegion, GetX( ) + musWidth, GetY( ), GetX( ) + musWidth + musArrowWidth, GetY( ) + DEF_SCROLL_ARROW_HEIGHT, MSYS_PRIORITY_HIGH,
|
MSYS_DefineRegion( &mSelectedOpenDropDownRegion, GetX( ) + musWidth, GetY( ), GetX( ) + musWidth + musArrowWidth, GetY( ) + DEF_SCROLL_ARROW_HEIGHT, MSYS_PRIORITY_HIGHEST,
|
||||||
CURSOR_WWW, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_OPEN, &DropDownBase::Dummyfunc) );
|
CURSOR_WWW, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_OPEN, &DropDownBase::Dummyfunc) );
|
||||||
MSYS_AddRegion(&mSelectedOpenDropDownRegion);
|
MSYS_AddRegion(&mSelectedOpenDropDownRegion);
|
||||||
|
|
||||||
//click anywhere on the screen to close the window( only when the drop down window is active)
|
//click anywhere on the screen to close the window( only when the drop down window is active)
|
||||||
MSYS_DefineRegion( &mSelectedCloseDropDownRegion, LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y , LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y, MSYS_PRIORITY_HIGH-1,
|
MSYS_DefineRegion( &mSelectedCloseDropDownRegion, LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y, MSYS_PRIORITY_HIGHEST,
|
||||||
CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_CLOSE, &DropDownBase::Dummyfunc) );
|
CURSOR_LAPTOP_SCREEN, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_CLOSE, &DropDownBase::Dummyfunc) );
|
||||||
MSYS_AddRegion(&mSelectedCloseDropDownRegion);
|
MSYS_AddRegion(&mSelectedCloseDropDownRegion);
|
||||||
MSYS_DisableRegion(&mSelectedCloseDropDownRegion);
|
MSYS_DisableRegion(&mSelectedCloseDropDownRegion);
|
||||||
|
|
||||||
MSYS_DefineRegion( &mBubbleHelpRegion, GetX( ), GetY( ), GetX( ) + musWidth, GetY( ) + DEF_SCROLL_ARROW_HEIGHT, MSYS_PRIORITY_HIGH,
|
MSYS_DefineRegion( &mBubbleHelpRegion, GetX( ), GetY( ), GetX( ) + musWidth, GetY( ) + DEF_SCROLL_ARROW_HEIGHT, MSYS_PRIORITY_HIGHEST,
|
||||||
CURSOR_WWW, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
|
CURSOR_WWW, MSYS_NO_CALLBACK, MSYS_NO_CALLBACK );
|
||||||
MSYS_AddRegion(&mBubbleHelpRegion);
|
MSYS_AddRegion(&mBubbleHelpRegion);
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ DropDownBase::Create_Drop()
|
|||||||
|
|
||||||
for ( i = 0; i< mNumDisplayedEntries; ++i )
|
for ( i = 0; i< mNumDisplayedEntries; ++i )
|
||||||
{
|
{
|
||||||
MSYS_DefineRegion( &mDropDownRegion[i], usPosX, (UINT16)(usPosY+4), (UINT16)(usPosX+musWidth-6), (UINT16)(usPosY+musFontHeight+7), MSYS_PRIORITY_HIGH,
|
MSYS_DefineRegion( &mDropDownRegion[i], usPosX, (UINT16)(usPosY + 4), (UINT16)(usPosX + musWidth - 6), (UINT16)(usPosY + musFontHeight + 7), MSYS_PRIORITY_HIGHEST,
|
||||||
CURSOR_WWW, CallBackWrapper((void*) this, DROPDOWN_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_REGION, &DropDownBase::Dummyfunc));
|
CURSOR_WWW, CallBackWrapper((void*) this, DROPDOWN_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_REGION, &DropDownBase::Dummyfunc));
|
||||||
MSYS_AddRegion(&mDropDownRegion[i]);
|
MSYS_AddRegion(&mDropDownRegion[i]);
|
||||||
MSYS_SetRegionUserData( &mDropDownRegion[ i ], 0, i);
|
MSYS_SetRegionUserData( &mDropDownRegion[ i ], 0, i);
|
||||||
@@ -191,7 +191,7 @@ DropDownBase::Create_Drop()
|
|||||||
usPosY = musUpArrowY;
|
usPosY = musUpArrowY;
|
||||||
for(i=0; i<2; ++i)
|
for(i=0; i<2; ++i)
|
||||||
{
|
{
|
||||||
MSYS_DefineRegion( &mgSelectedUpDownArrowOnScrollAreaRegion[i], usPosX, usPosY, (UINT16)(usPosX+musWidth), (UINT16)(usPosY+DEF_SCROLL_ARROW_HEIGHT), MSYS_PRIORITY_HIGH,
|
MSYS_DefineRegion( &mgSelectedUpDownArrowOnScrollAreaRegion[i], usPosX, usPosY, (UINT16)(usPosX + musWidth), (UINT16)(usPosY + DEF_SCROLL_ARROW_HEIGHT), MSYS_PRIORITY_HIGHEST,
|
||||||
CURSOR_WWW, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_ARROW, &DropDownBase::Dummyfunc));
|
CURSOR_WWW, MSYS_NO_CALLBACK, CallBackWrapper((void*) this, DROPDOWN_ARROW, &DropDownBase::Dummyfunc));
|
||||||
MSYS_AddRegion(&mgSelectedUpDownArrowOnScrollAreaRegion[i]);
|
MSYS_AddRegion(&mgSelectedUpDownArrowOnScrollAreaRegion[i]);
|
||||||
MSYS_SetRegionUserData( &mgSelectedUpDownArrowOnScrollAreaRegion[ i ], 0, i);
|
MSYS_SetRegionUserData( &mgSelectedUpDownArrowOnScrollAreaRegion[ i ], 0, i);
|
||||||
@@ -209,7 +209,7 @@ DropDownBase::Create_Drop()
|
|||||||
usHeight = ( musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - 4 ) / (mNumDisplayedEntries);
|
usHeight = ( musAreaHeight - DEF_SCROLL_ARROW_HEIGHT - 4 ) / (mNumDisplayedEntries);
|
||||||
for ( i = 0; i<mNumDisplayedEntries - 1; ++i )
|
for ( i = 0; i<mNumDisplayedEntries - 1; ++i )
|
||||||
{
|
{
|
||||||
MSYS_DefineRegion( &mSelectedScrollAreaDropDownRegion[i], usPosX, usPosY, (UINT16)(usPosX+musWidth), (UINT16)(usPosY+usHeight), MSYS_PRIORITY_HIGH+1,
|
MSYS_DefineRegion( &mSelectedScrollAreaDropDownRegion[i], usPosX, usPosY, (UINT16)(usPosX + musWidth), (UINT16)(usPosY + usHeight), MSYS_PRIORITY_HIGHEST + 1,
|
||||||
CURSOR_LAPTOP_SCREEN, CallBackWrapper((void*) this, DROPDOWN_SCROLL_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_SCROLL_REGION, &DropDownBase::Dummyfunc));
|
CURSOR_LAPTOP_SCREEN, CallBackWrapper((void*) this, DROPDOWN_SCROLL_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_SCROLL_REGION, &DropDownBase::Dummyfunc));
|
||||||
MSYS_AddRegion(&mSelectedScrollAreaDropDownRegion[i]);
|
MSYS_AddRegion(&mSelectedScrollAreaDropDownRegion[i]);
|
||||||
MSYS_SetRegionUserData( &mSelectedScrollAreaDropDownRegion[ i ], 0, i);
|
MSYS_SetRegionUserData( &mSelectedScrollAreaDropDownRegion[ i ], 0, i);
|
||||||
@@ -217,7 +217,7 @@ DropDownBase::Create_Drop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//put the last one down to cover the remaining area
|
//put the last one down to cover the remaining area
|
||||||
MSYS_DefineRegion( &mSelectedScrollAreaDropDownRegion[i], usPosX, usPosY, (UINT16)(usPosX+musWidth), musDownArrowY, MSYS_PRIORITY_HIGH+1,
|
MSYS_DefineRegion( &mSelectedScrollAreaDropDownRegion[i], usPosX, usPosY, (UINT16)(usPosX + musWidth), musDownArrowY, MSYS_PRIORITY_HIGHEST + 1,
|
||||||
CURSOR_LAPTOP_SCREEN, CallBackWrapper((void*) this, DROPDOWN_SCROLL_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_SCROLL_REGION, &DropDownBase::Dummyfunc));
|
CURSOR_LAPTOP_SCREEN, CallBackWrapper((void*) this, DROPDOWN_SCROLL_MOVEMENT, &DropDownBase::Dummyfunc), CallBackWrapper((void*) this, DROPDOWN_SCROLL_REGION, &DropDownBase::Dummyfunc));
|
||||||
MSYS_AddRegion(&mSelectedScrollAreaDropDownRegion[i]);
|
MSYS_AddRegion(&mSelectedScrollAreaDropDownRegion[i]);
|
||||||
MSYS_SetRegionUserData( &mSelectedScrollAreaDropDownRegion[ i ], 0, i);
|
MSYS_SetRegionUserData( &mSelectedScrollAreaDropDownRegion[ i ], 0, i);
|
||||||
|
|||||||
@@ -133,6 +133,8 @@ enum definedDropDowns
|
|||||||
DROPDOWNNR_IMPGEAR_MISC_7,
|
DROPDOWNNR_IMPGEAR_MISC_7,
|
||||||
|
|
||||||
DROPDOWNNR_IMPGEAR_MAX = DROPDOWNNR_IMPGEAR_MISC_7,
|
DROPDOWNNR_IMPGEAR_MAX = DROPDOWNNR_IMPGEAR_MISC_7,
|
||||||
|
|
||||||
|
DROPDOWNNR_MSGBOX,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
+70
-62
@@ -21,6 +21,7 @@
|
|||||||
#include "text.h"
|
#include "text.h"
|
||||||
#include "Text Input.h"
|
#include "Text Input.h"
|
||||||
#include "overhead map.h"
|
#include "overhead map.h"
|
||||||
|
#include "DropDown.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MSGBOX_DEFAULT_WIDTH 300
|
#define MSGBOX_DEFAULT_WIDTH 300
|
||||||
@@ -79,7 +80,7 @@ CHAR16 gzUserDefinedButton[ NUM_CUSTOM_BUTTONS ][ 128 ];
|
|||||||
// sevenfm: added color for buttons
|
// sevenfm: added color for buttons
|
||||||
UINT16 gzUserDefinedButtonColor[ NUM_CUSTOM_BUTTONS ];
|
UINT16 gzUserDefinedButtonColor[ NUM_CUSTOM_BUTTONS ];
|
||||||
|
|
||||||
INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect, UINT8 ubDefaultButton )
|
INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect, UINT8 ubDefaultButton )
|
||||||
{
|
{
|
||||||
VSURFACE_DESC vs_desc;
|
VSURFACE_DESC vs_desc;
|
||||||
UINT16 usTextBoxWidth;
|
UINT16 usTextBoxWidth;
|
||||||
@@ -203,8 +204,7 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
usCursor = CURSOR_NORMAL;
|
usCursor = CURSOR_NORMAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( usFlags & MSG_BOX_FLAG_USE_CENTERING_RECT && pCenteringRect != NULL )
|
if ( usFlags & MSG_BOX_FLAG_USE_CENTERING_RECT && pCenteringRect != NULL )
|
||||||
{
|
{
|
||||||
aRect.iTop = pCenteringRect->iTop;
|
aRect.iTop = pCenteringRect->iTop;
|
||||||
@@ -237,11 +237,15 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
if( ubStyle == MSG_BOX_BASIC_MEDIUM_BUTTONS )
|
if( ubStyle == MSG_BOX_BASIC_MEDIUM_BUTTONS )
|
||||||
heightincrease = 120;
|
heightincrease = 120;
|
||||||
else
|
else
|
||||||
heightincrease = 50;
|
heightincrease = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( usFlags & MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS )
|
if ( usFlags & MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS )
|
||||||
heightincrease = 90;
|
heightincrease = 90;
|
||||||
|
|
||||||
|
if ( usFlags & MSG_BOX_FLAG_DROPDOWN )
|
||||||
|
heightincrease = 130;
|
||||||
|
|
||||||
UINT16 usMBWidth=MSGBOX_DEFAULT_WIDTH;
|
UINT16 usMBWidth=MSGBOX_DEFAULT_WIDTH;
|
||||||
BOOLEAN bFixedWidth = FALSE;
|
BOOLEAN bFixedWidth = FALSE;
|
||||||
// sevenfm: custom width for 16-medium-button messagebox
|
// sevenfm: custom width for 16-medium-button messagebox
|
||||||
@@ -262,9 +266,9 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
|
|
||||||
if( gMsgBox.iBoxId == -1 )
|
if( gMsgBox.iBoxId == -1 )
|
||||||
{
|
{
|
||||||
#ifdef JA2BETAVERSION
|
#ifdef JA2BETAVERSION
|
||||||
AssertMsg( 0, "Failed in DoMessageBox(). Probable reason is because the string was too large to fit in max message box size." );
|
AssertMsg( 0, "Failed in DoMessageBox(). Probable reason is because the string was too large to fit in max message box size." );
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,7 +292,6 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
fMapPanelDirty = TRUE;
|
fMapPanelDirty = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set pending screen
|
// Set pending screen
|
||||||
SetPendingNewScreen( MSG_BOX_SCREEN);
|
SetPendingNewScreen( MSG_BOX_SCREEN);
|
||||||
|
|
||||||
@@ -315,10 +318,9 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
|
|
||||||
UnLockVideoSurface( gMsgBox.uiSaveBuffer );
|
UnLockVideoSurface( gMsgBox.uiSaveBuffer );
|
||||||
UnLockVideoSurface( FRAME_BUFFER );
|
UnLockVideoSurface( FRAME_BUFFER );
|
||||||
|
|
||||||
// Create top-level mouse region
|
// Create top-level mouse region
|
||||||
MSYS_DefineRegion( &(gMsgBox.BackRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST,
|
MSYS_DefineRegion( &(gMsgBox.BackRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST - 1, usCursor, MSYS_NO_CALLBACK, MsgBoxClickCallback );
|
||||||
usCursor, MSYS_NO_CALLBACK, MsgBoxClickCallback );
|
|
||||||
|
|
||||||
if( gGameSettings.fOptions[ TOPTION_DONT_MOVE_MOUSE ] == FALSE )
|
if( gGameSettings.fOptions[ TOPTION_DONT_MOVE_MOUSE ] == FALSE )
|
||||||
{
|
{
|
||||||
@@ -510,39 +512,39 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sBlankSpace = usTextBoxWidth - MSGBOX_SMALL_BUTTON_WIDTH * 4 - MSGBOX_SMALL_BUTTON_X_SEP * 3;
|
sBlankSpace = usTextBoxWidth - MSGBOX_SMALL_BUTTON_WIDTH * 4 - MSGBOX_SMALL_BUTTON_X_SEP * 3;
|
||||||
sButtonX = sBlankSpace / 2;
|
|
||||||
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10 - heightincrease;
|
|
||||||
sButtonY -= MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
|
|
||||||
|
|
||||||
for ( INT8 i = 0; i < 2; ++i)
|
|
||||||
{
|
|
||||||
// new row
|
|
||||||
sButtonY += MSGBOX_SMALL_BUTTON_WIDTH;
|
|
||||||
|
|
||||||
// begin from the front
|
|
||||||
sButtonX = sBlankSpace / 2;
|
sButtonX = sBlankSpace / 2;
|
||||||
|
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10 - heightincrease;
|
||||||
|
sButtonY -= MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
|
||||||
|
|
||||||
for ( INT8 j = 0; j < 4; ++j)
|
for ( INT8 i = 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
INT8 k = 4*i + j;
|
// new row
|
||||||
|
sButtonY += MSGBOX_SMALL_BUTTON_WIDTH;
|
||||||
|
|
||||||
gMsgBox.uiButton[k] = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton[k], FONT12ARIAL,
|
// begin from the front
|
||||||
ubFontColor, ubFontShadowColor,
|
sButtonX = sBlankSpace / 2;
|
||||||
ubFontColor, ubFontShadowColor,
|
|
||||||
TEXT_CJUSTIFIED,
|
|
||||||
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
|
|
||||||
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback );
|
|
||||||
MSYS_SetBtnUserData( gMsgBox.uiButton[k], 0, k+1);
|
|
||||||
SetButtonCursor(gMsgBox.uiButton[k], usCursor);
|
|
||||||
ForceButtonUnDirty( gMsgBox.uiButton[k] );
|
|
||||||
|
|
||||||
//sButtonX += 75 + MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
|
for ( INT8 j = 0; j < 4; ++j)
|
||||||
sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
|
{
|
||||||
|
INT8 k = 4*i + j;
|
||||||
|
|
||||||
|
gMsgBox.uiButton[k] = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton[k], FONT12ARIAL,
|
||||||
|
ubFontColor, ubFontShadowColor,
|
||||||
|
ubFontColor, ubFontShadowColor,
|
||||||
|
TEXT_CJUSTIFIED,
|
||||||
|
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
|
||||||
|
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback );
|
||||||
|
MSYS_SetBtnUserData( gMsgBox.uiButton[k], 0, k+1);
|
||||||
|
SetButtonCursor(gMsgBox.uiButton[k], usCursor);
|
||||||
|
ForceButtonUnDirty( gMsgBox.uiButton[k] );
|
||||||
|
|
||||||
|
//sButtonX += 75 + MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
|
||||||
|
sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// Create sixteen numbered buttons
|
// Create sixteen numbered buttons
|
||||||
else if ( usFlags & MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS )
|
else if ( usFlags & MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS )
|
||||||
{
|
{
|
||||||
@@ -554,10 +556,10 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sBlankSpace = usTextBoxWidth - MSGBOX_SMALL_BUTTON_WIDTH * 4 - MSGBOX_SMALL_BUTTON_X_SEP * 3;
|
sBlankSpace = usTextBoxWidth - MSGBOX_SMALL_BUTTON_WIDTH * 4 - MSGBOX_SMALL_BUTTON_X_SEP * 3;
|
||||||
sButtonX = sBlankSpace / 2;
|
sButtonX = sBlankSpace / 2;
|
||||||
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10 - heightincrease - 6;
|
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10 - heightincrease - 6;
|
||||||
sButtonY -= MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
|
sButtonY -= MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( INT8 i = 0; i < 4; ++i)
|
for ( INT8 i = 0; i < 4; ++i)
|
||||||
@@ -572,9 +574,9 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// new row
|
// new row
|
||||||
sButtonY += MSGBOX_SMALL_BUTTON_WIDTH - 2;// + MSGBOX_SMALL_BUTTON_X_SEP;
|
sButtonY += MSGBOX_SMALL_BUTTON_WIDTH - 2;// + MSGBOX_SMALL_BUTTON_X_SEP;
|
||||||
// begin from the front
|
// begin from the front
|
||||||
sButtonX = sBlankSpace / 2 - MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
|
sButtonX = sBlankSpace / 2 - MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( INT8 j = 0; j < 4; ++j)
|
for ( INT8 j = 0; j < 4; ++j)
|
||||||
@@ -645,12 +647,10 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
// Create text button
|
// Create text button
|
||||||
if ( usFlags & MSG_BOX_FLAG_OK )
|
if ( usFlags & MSG_BOX_FLAG_OK )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
// sButtonX = ( usTextBoxWidth - MSGBOX_BUTTON_WIDTH ) / 2;
|
// sButtonX = ( usTextBoxWidth - MSGBOX_BUTTON_WIDTH ) / 2;
|
||||||
sButtonX = ( usTextBoxWidth - GetMSgBoxButtonWidth( gMsgBox.iButtonImages ) ) / 2;
|
sButtonX = ( usTextBoxWidth - GetMSgBoxButtonWidth( gMsgBox.iButtonImages ) ) / 2;
|
||||||
|
|
||||||
@@ -665,9 +665,7 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
|
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
|
||||||
ForceButtonUnDirty( gMsgBox.uiOKButton );
|
ForceButtonUnDirty( gMsgBox.uiOKButton );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Create text button
|
// Create text button
|
||||||
if ( usFlags & MSG_BOX_FLAG_CANCEL )
|
if ( usFlags & MSG_BOX_FLAG_CANCEL )
|
||||||
{
|
{
|
||||||
@@ -734,7 +732,6 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback );
|
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback );
|
||||||
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
|
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
|
||||||
ForceButtonUnDirty( gMsgBox.uiNOButton );
|
ForceButtonUnDirty( gMsgBox.uiNOButton );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( usFlags & MSG_BOX_FLAG_OKCONTRACT )
|
if ( usFlags & MSG_BOX_FLAG_OKCONTRACT )
|
||||||
@@ -760,7 +757,6 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback );
|
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback );
|
||||||
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
|
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
|
||||||
ForceButtonUnDirty( gMsgBox.uiNOButton );
|
ForceButtonUnDirty( gMsgBox.uiNOButton );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( usFlags & MSG_BOX_FLAG_YESNOCONTRACT )
|
if ( usFlags & MSG_BOX_FLAG_YESNOCONTRACT )
|
||||||
@@ -795,10 +791,8 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback );
|
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback );
|
||||||
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
|
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
|
||||||
ForceButtonUnDirty( gMsgBox.uiOKButton );
|
ForceButtonUnDirty( gMsgBox.uiOKButton );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( usFlags & MSG_BOX_FLAG_GENERICCONTRACT )
|
if ( usFlags & MSG_BOX_FLAG_GENERICCONTRACT )
|
||||||
{
|
{
|
||||||
sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3;
|
sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3;
|
||||||
@@ -831,7 +825,6 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback );
|
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback );
|
||||||
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
|
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
|
||||||
ForceButtonUnDirty( gMsgBox.uiOKButton );
|
ForceButtonUnDirty( gMsgBox.uiOKButton );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( usFlags & MSG_BOX_FLAG_GENERIC_TWO_BUTTONS )
|
if ( usFlags & MSG_BOX_FLAG_GENERIC_TWO_BUTTONS )
|
||||||
@@ -891,7 +884,6 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)LieMsgBoxCallback );
|
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)LieMsgBoxCallback );
|
||||||
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
|
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
|
||||||
ForceButtonUnDirty( gMsgBox.uiOKButton );
|
ForceButtonUnDirty( gMsgBox.uiOKButton );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( usFlags & MSG_BOX_FLAG_OKSKIP )
|
if ( usFlags & MSG_BOX_FLAG_OKSKIP )
|
||||||
@@ -918,7 +910,11 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
|
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
|
||||||
ForceButtonUnDirty( gMsgBox.uiNOButton );
|
ForceButtonUnDirty( gMsgBox.uiNOButton );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( gMsgBox.usFlags & MSG_BOX_FLAG_DROPDOWN )
|
||||||
|
{
|
||||||
|
DropDownTemplate<DROPDOWNNR_MSGBOX>::getInstance( ).Create( (INT16)(gMsgBox.sX + 15), (INT16)(gMsgBox.sY + 30) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -944,6 +940,12 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
|
|||||||
return( iId );
|
return( iId );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this has to be defined. As the MessageBoxScreenHandle() runs all time, there is nothing to do here though
|
||||||
|
template<> void DropDownTemplate<DROPDOWNNR_MSGBOX>::SetRefresh( )
|
||||||
|
{
|
||||||
|
// for now, nothing needed, update happens automatically
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MsgBoxClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
void MsgBoxClickCallback( MOUSE_REGION * pRegion, INT32 iReason )
|
||||||
{
|
{
|
||||||
@@ -1186,7 +1188,11 @@ UINT32 ExitMsgBox( INT8 ubExitCode )
|
|||||||
RemoveButton( gMsgBox.uiYESButton );
|
RemoveButton( gMsgBox.uiYESButton );
|
||||||
RemoveButton( gMsgBox.uiNOButton );
|
RemoveButton( gMsgBox.uiNOButton );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( gMsgBox.usFlags & MSG_BOX_FLAG_DROPDOWN )
|
||||||
|
{
|
||||||
|
DropDownTemplate<DROPDOWNNR_MSGBOX>::getInstance( ).Destroy( );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete button images
|
// Delete button images
|
||||||
@@ -1206,7 +1212,6 @@ UINT32 ExitMsgBox( INT8 ubExitCode )
|
|||||||
// Restore mouse restriction region...
|
// Restore mouse restriction region...
|
||||||
RestrictMouseCursor( &gOldCursorLimitRectangle );
|
RestrictMouseCursor( &gOldCursorLimitRectangle );
|
||||||
|
|
||||||
|
|
||||||
gfInMsgBox = FALSE;
|
gfInMsgBox = FALSE;
|
||||||
|
|
||||||
// Call done callback!
|
// Call done callback!
|
||||||
@@ -1214,8 +1219,7 @@ UINT32 ExitMsgBox( INT8 ubExitCode )
|
|||||||
{
|
{
|
||||||
(*(gMsgBox.ExitCallback))( ubExitCode );
|
(*(gMsgBox.ExitCallback))( ubExitCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//if ur in a non gamescreen and DONT want the msg box to use the save buffer, unset gfDontOverRideSaveBuffer in ur callback
|
//if ur in a non gamescreen and DONT want the msg box to use the save buffer, unset gfDontOverRideSaveBuffer in ur callback
|
||||||
if( ( ( gMsgBox.uiExitScreen != GAME_SCREEN ) || ( fRestoreBackgroundForMessageBox == TRUE ) ) && gfDontOverRideSaveBuffer )
|
if( ( ( gMsgBox.uiExitScreen != GAME_SCREEN ) || ( fRestoreBackgroundForMessageBox == TRUE ) ) && gfDontOverRideSaveBuffer )
|
||||||
{
|
{
|
||||||
@@ -1256,15 +1260,14 @@ UINT32 ExitMsgBox( INT8 ubExitCode )
|
|||||||
|
|
||||||
// Remove save buffer!
|
// Remove save buffer!
|
||||||
DeleteVideoSurfaceFromIndex( gMsgBox.uiSaveBuffer );
|
DeleteVideoSurfaceFromIndex( gMsgBox.uiSaveBuffer );
|
||||||
|
|
||||||
|
|
||||||
switch( gMsgBox.uiExitScreen )
|
switch( gMsgBox.uiExitScreen )
|
||||||
{
|
{
|
||||||
case GAME_SCREEN:
|
case GAME_SCREEN:
|
||||||
|
|
||||||
if ( InOverheadMap( ) )
|
if ( InOverheadMap( ) )
|
||||||
{
|
{
|
||||||
gfOverheadMapDirty = TRUE;
|
gfOverheadMapDirty = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1278,8 +1281,8 @@ UINT32 ExitMsgBox( INT8 ubExitCode )
|
|||||||
|
|
||||||
if ( gfFadeInitialized )
|
if ( gfFadeInitialized )
|
||||||
{
|
{
|
||||||
SetPendingNewScreen(FADE_SCREEN);
|
SetPendingNewScreen(FADE_SCREEN);
|
||||||
return( FADE_SCREEN );
|
return( FADE_SCREEN );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( gMsgBox.uiExitScreen );
|
return( gMsgBox.uiExitScreen );
|
||||||
@@ -1593,6 +1596,11 @@ UINT32 MessageBoxScreenHandle( )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( gMsgBox.usFlags & MSG_BOX_FLAG_DROPDOWN )
|
||||||
|
{
|
||||||
|
DropDownTemplate<DROPDOWNNR_MSGBOX>::getInstance( ).Display( );
|
||||||
|
}
|
||||||
|
|
||||||
if ( gMsgBox.bHandled )
|
if ( gMsgBox.bHandled )
|
||||||
{
|
{
|
||||||
SetRenderFlags( RENDER_FLAG_FULL );
|
SetRenderFlags( RENDER_FLAG_FULL );
|
||||||
|
|||||||
+20
-18
@@ -4,24 +4,26 @@
|
|||||||
#include "mousesystem.h"
|
#include "mousesystem.h"
|
||||||
|
|
||||||
// Message box flags
|
// Message box flags
|
||||||
#define MSG_BOX_FLAG_USE_CENTERING_RECT 0x0001 // Pass in a rect to center in
|
#define MSG_BOX_FLAG_USE_CENTERING_RECT 0x00000001 // Pass in a rect to center in
|
||||||
#define MSG_BOX_FLAG_OK 0x0002 // Displays OK button
|
#define MSG_BOX_FLAG_OK 0x00000002 // Displays OK button
|
||||||
#define MSG_BOX_FLAG_YESNO 0x0004 // Displays YES NO buttons
|
#define MSG_BOX_FLAG_YESNO 0x00000004 // Displays YES NO buttons
|
||||||
#define MSG_BOX_FLAG_CANCEL 0x0008 // Displays YES NO buttons
|
#define MSG_BOX_FLAG_CANCEL 0x00000008 // Displays YES NO buttons
|
||||||
#define MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS 0x0010 // Displays four numbered buttons, 1-4
|
#define MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS 0x00000010 // Displays four numbered buttons, 1-4
|
||||||
#define MSG_BOX_FLAG_YESNOCONTRACT 0x0020 // yes no and contract buttons
|
#define MSG_BOX_FLAG_YESNOCONTRACT 0x00000020 // yes no and contract buttons
|
||||||
#define MSG_BOX_FLAG_OKCONTRACT 0x0040 // ok and contract buttons
|
#define MSG_BOX_FLAG_OKCONTRACT 0x00000040 // ok and contract buttons
|
||||||
#define MSG_BOX_FLAG_YESNOLIE 0x0080 // ok and contract buttons
|
#define MSG_BOX_FLAG_YESNOLIE 0x00000080 // ok and contract buttons
|
||||||
#define MSG_BOX_FLAG_CONTINUESTOP 0x0100 // continue stop box
|
#define MSG_BOX_FLAG_CONTINUESTOP 0x00000100 // continue stop box
|
||||||
#define MSG_BOX_FLAG_OKSKIP 0x0200 // Displays ok or skip (meanwhile) buttons
|
#define MSG_BOX_FLAG_OKSKIP 0x00000200 // Displays ok or skip (meanwhile) buttons
|
||||||
#define MSG_BOX_FLAG_GENERICCONTRACT 0x0400 // displays contract buttoin + 2 user-defined text buttons
|
#define MSG_BOX_FLAG_GENERICCONTRACT 0x00000400 // displays contract buttoin + 2 user-defined text buttons
|
||||||
#define MSG_BOX_FLAG_GENERIC_TWO_BUTTONS 0x0800 // 2 user-defined text buttons
|
#define MSG_BOX_FLAG_GENERIC_TWO_BUTTONS 0x00000800 // 2 user-defined text buttons
|
||||||
// OJW - Adding text chatbox
|
// OJW - Adding text chatbox
|
||||||
#define MSG_BOX_FLAG_INPUTBOX 0x1000 // has a text input field
|
#define MSG_BOX_FLAG_INPUTBOX 0x00001000 // has a text input field
|
||||||
// Flugente - added boxes with multiple buttons that can be renamed easily
|
// Flugente - added boxes with multiple buttons that can be renamed easily
|
||||||
#define MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS 0x2000 // Displays four numbered buttons with definable labels
|
#define MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS 0x00002000 // Displays four numbered buttons with definable labels
|
||||||
#define MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS 0x4000 // Displays eight numbered buttons with definable labels
|
#define MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS 0x00004000 // Displays eight numbered buttons with definable labels
|
||||||
#define MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS 0x8000 // Displays sixteen numbered buttons with definable labels
|
#define MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS 0x00008000 // Displays sixteen numbered buttons with definable labels
|
||||||
|
|
||||||
|
#define MSG_BOX_FLAG_DROPDOWN 0x00010000 // Displays an aditional dropdown box
|
||||||
|
|
||||||
// message box return codes
|
// message box return codes
|
||||||
#define MSG_BOX_RETURN_OK 1 // ENTER or on OK button
|
#define MSG_BOX_RETURN_OK 1 // ENTER or on OK button
|
||||||
@@ -76,7 +78,7 @@ extern UINT16 gzUserDefinedButtonColor[ NUM_CUSTOM_BUTTONS ];
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
UINT16 usFlags;
|
UINT32 usFlags;
|
||||||
UINT32 uiExitScreen;
|
UINT32 uiExitScreen;
|
||||||
MSGBOX_CALLBACK ExitCallback;
|
MSGBOX_CALLBACK ExitCallback;
|
||||||
INT16 sX;
|
INT16 sX;
|
||||||
@@ -127,7 +129,7 @@ extern CHAR16 gszMsgBoxInputString[255];
|
|||||||
// pCenteringRect Rect to send if MSG_BOX_FLAG_USE_CENTERING_RECT set. Can be NULL
|
// 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, UINT8 ubDefaultButton = MSG_BOX_DEFAULT_BUTTON_NONE );
|
INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect, UINT8 ubDefaultButton = MSG_BOX_DEFAULT_BUTTON_NONE );
|
||||||
void DoScreenIndependantMessageBox( const STR16 zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
void DoScreenIndependantMessageBox( const STR16 zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||||
void DoUpperScreenIndependantMessageBox( const STR16 zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
void DoUpperScreenIndependantMessageBox( const STR16 zString, UINT16 usFlags, MSGBOX_CALLBACK ReturnCallback );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user