function CustomDefeatDialogBJ takes player whichPlayer, string message returns nothing
local trigger t = CreateTrigger()
local dialog d = DialogCreate()
call DialogSetMessage( d, message )
if bj_isSinglePlayer then
set t = CreateTrigger()
call TriggerRegisterDialogButtonEvent( t, DialogAddButton( d, GetLocalizedString( "GAMEOVER_RESTART" ), GetLocalizedHotkey("GAMEOVER_RESTART") ) )
call TriggerAddAction( t, function CustomDefeatRestartBJ )
if (GetGameDifficulty() != MAP_DIFFICULTY_EASY) then
set t = CreateTrigger()
call TriggerRegisterDialogButtonEvent( t, DialogAddButton( d, GetLocalizedString( "GAMEOVER_REDUCE_DIFFICULTY" ), GetLocalizedHotkey("GAMEOVER_REDUCE_DIFFICULTY") ) )
call TriggerAddAction( t, function CustomDefeatReduceDifficultyBJ )
endif
set t = CreateTrigger()
call TriggerRegisterDialogButtonEvent( t, DialogAddButton( d, GetLocalizedString( "GAMEOVER_LOAD" ), GetLocalizedHotkey("GAMEOVER_LOAD") ) )
call TriggerAddAction( t, function CustomDefeatLoadBJ )
endif
set t = CreateTrigger()
call TriggerRegisterDialogButtonEvent( t, DialogAddButton( d, GetLocalizedString( "GAMEOVER_QUIT_MISSION" ), GetLocalizedHotkey("GAMEOVER_QUIT_MISSION") ) )
call TriggerAddAction( t, function CustomDefeatQuitBJ )
if (GetLocalPlayer() == whichPlayer) then
call EnableUserControl( true )
if bj_isSinglePlayer then
call PauseGame( true )
endif
call EnableUserUI(false)
endif
call DialogDisplay( whichPlayer, d, true )
call VolumeGroupSetVolumeForPlayerBJ( whichPlayer, SOUND_VOLUMEGROUP_UI, 1.0 )
call StartSoundForPlayerBJ( whichPlayer, bj_defeatDialogSound )
endfunction