New feature (by rftr): Mini events are a feature where the player can receive short text blurbs, and pick one of two outcomes.

Based on game implementations like Gloomhaven (road/city events) or Battletech (travel events).

For more info, see https://thepit.ja-galaxy-forum.com/index.php?t=msg&th=24865&goto=363481&#msg_363481

Requires GameDir >= r2599

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9137 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2021-07-09 19:38:55 +00:00
parent e7251981c0
commit 960bb2d4ba
53 changed files with 1812 additions and 35 deletions
+63
View File
@@ -197,6 +197,19 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
break;
case MSG_BOX_MINIEVENT_STYLE:
ubMercBoxBackground = DIALOG_MERC_POPUP_BACKGROUND;
ubMercBoxBorder = DIALOG_MERC_POPUP_BORDER;
// Add button images
gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\msgboxbuttonwide.sti", -1,0,-1,1,-1 );
ubFontColor = FONT_MCOLOR_WHITE;
ubFontShadowColor = DEFAULT_SHADOW;
usCursor = CURSOR_NORMAL;
break;
default:
ubMercBoxBackground = BASIC_MERC_POPUP_BACKGROUND;
ubMercBoxBorder = BASIC_MERC_POPUP_BORDER;
@@ -267,6 +280,14 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
usMBWidth = MSGBOX_BUTTON_WIDTH * 4;
bFixedWidth = TRUE;
}
// rftr - bigger msg box. I guess these max out the box?
if (usFlags & MSG_BOX_FLAG_BIGGER)
{
heightincrease = 140;
usMBWidth = MSGBOX_BUTTON_WIDTH * 5;
bFixedWidth = TRUE;
}
// Init message box
gMsgBox.iBoxId = PrepareMercPopupBox( iId, ubMercBoxBackground, ubMercBoxBorder, zString, usMBWidth, 40, 10, 30 + heightincrease, &usTextBoxWidth, &usTextBoxHeight, bFixedWidth );
@@ -873,6 +894,31 @@ INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UIN
ForceButtonUnDirty( gMsgBox.uiNOButton );
}
if (usFlags & MSG_BOX_FLAG_WIDE_BUTTONS)
{
sButtonX = 10;//usTextBoxWidth - (MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP);
sButtonY = usTextBoxHeight - 10;
gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton1, FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_LJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY - 5 - MSGBOX_BUTTON_HEIGHT * 2 ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback );
SetButtonCursor(gMsgBox.uiYESButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiYESButton );
gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton2, FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_LJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY - MSGBOX_BUTTON_HEIGHT ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback );
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiNOButton );
}
if ( usFlags & MSG_BOX_FLAG_YESNOLIE )
{
sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3;
@@ -1263,6 +1309,12 @@ UINT32 ExitMsgBox( INT8 ubExitCode )
RemoveButton( gMsgBox.uiYESButton );
RemoveButton( gMsgBox.uiNOButton );
}
if ( gMsgBox.usFlags & MSG_BOX_FLAG_WIDE_BUTTONS )
{
RemoveButton( gMsgBox.uiYESButton );
RemoveButton( gMsgBox.uiNOButton );
}
}
if ( gMsgBox.usFlags & MSG_BOX_FLAG_IMAGE )
@@ -1521,6 +1573,12 @@ UINT32 MessageBoxScreenHandle( )
MarkAButtonDirty( gMsgBox.uiNOButton );
}
if ( gMsgBox.usFlags & MSG_BOX_FLAG_WIDE_BUTTONS )
{
MarkAButtonDirty( gMsgBox.uiYESButton );
MarkAButtonDirty( gMsgBox.uiNOButton );
}
RenderMercPopUpBoxFromIndex( gMsgBox.iBoxId, gMsgBox.sX, gMsgBox.sY, FRAME_BUFFER );
//gMsgBox.fRenderBox = FALSE;
@@ -1725,6 +1783,11 @@ UINT32 MessageBoxScreenShutdown( )
return( FALSE );
}
void DoScreenIndependantMessageBoxFullScreen( const STR16 zString, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback )
{
SGPRect CenteringRect= {0, 0, SCREEN_WIDTH, SCREEN_HEIGHT };
DoScreenIndependantMessageBoxWithRect( zString, usFlags, ReturnCallback, &CenteringRect );
}
// a basic box that don't care what screen we came from
void DoScreenIndependantMessageBox( const STR16 zString, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback )