@ -1158,7 +1158,7 @@ static void PressKey(int vkey)
if ( sgnTimeoutCurs ! = CURSOR_NONE ) {
if ( sgnTimeoutCurs ! = CURSOR_NONE ) {
return ;
return ;
}
}
keymapper . keyPressed ( vkey , deathflag ) ;
keymapper . keyPressed ( vkey ) ;
if ( vkey = = DVL_VK_RETURN ) {
if ( vkey = = DVL_VK_RETURN ) {
if ( ( GetAsyncKeyState ( DVL_VK_MENU ) & 0x8000 ) ! = 0 )
if ( ( GetAsyncKeyState ( DVL_VK_MENU ) & 0x8000 ) ! = 0 )
dx_reinit ( ) ;
dx_reinit ( ) ;
@ -1190,7 +1190,7 @@ static void PressKey(int vkey)
return ;
return ;
}
}
keymapper . keyPressed ( vkey , deathflag ) ;
keymapper . keyPressed ( vkey ) ;
if ( vkey = = DVL_VK_RETURN ) {
if ( vkey = = DVL_VK_RETURN ) {
if ( ( GetAsyncKeyState ( DVL_VK_MENU ) & 0x8000 ) ! = 0 ) {
if ( ( GetAsyncKeyState ( DVL_VK_MENU ) & 0x8000 ) ! = 0 ) {
@ -2130,23 +2130,31 @@ void spellBookKeyPressed()
invflag = false ;
invflag = false ;
}
}
bool isPlayerDead ( )
{
return plr [ myplr ] . _pmode = = PM_DEATH | | deathflag ;
}
void initKeymapActions ( )
void initKeymapActions ( )
{
{
keymapper . addAction ( {
keymapper . addAction ( {
" Help " ,
" Help " ,
DVL_VK_F1 ,
DVL_VK_F1 ,
helpKeyPressed ,
helpKeyPressed ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
# ifdef _DEBUG
# ifdef _DEBUG
keymapper . addAction ( {
keymapper . addAction ( {
" ItemInfo " ,
" ItemInfo " ,
DVL_VK_INVALID ,
DVL_VK_INVALID ,
itemInfoKeyPressed ,
itemInfoKeyPressed ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
keymapper . addAction ( {
keymapper . addAction ( {
" QuestDebug " ,
" QuestDebug " ,
DVL_VK_INVALID ,
DVL_VK_INVALID ,
PrintDebugQuest ,
PrintDebugQuest ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
# endif
# endif
for ( int i = 0 ; i < 4 ; + + i ) {
for ( int i = 0 ; i < 4 ; + + i ) {
@ -2160,6 +2168,7 @@ void initKeymapActions()
}
}
ToggleSpell ( i ) ;
ToggleSpell ( i ) ;
} ,
} ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
}
}
for ( int i = 0 ; i < 4 ; + + i ) {
for ( int i = 0 ; i < 4 ; + + i ) {
@ -2167,33 +2176,37 @@ void initKeymapActions()
spszMsgNameTbl [ i ] ,
spszMsgNameTbl [ i ] ,
DVL_VK_F9 + i ,
DVL_VK_F9 + i ,
[ i ] ( ) { diablo_hotkey_msg ( i ) ; } ,
[ i ] ( ) { diablo_hotkey_msg ( i ) ; } ,
Keymapper : : Action : : IfDead : : Allow ,
} ) ;
} ) ;
}
}
keymapper . addAction ( {
keymapper . addAction ( {
" DecreaseGamma " ,
" DecreaseGamma " ,
' G ' ,
' G ' ,
DecreaseGamma ,
DecreaseGamma ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
keymapper . addAction ( {
keymapper . addAction ( {
" IncreaseGamma " ,
" IncreaseGamma " ,
' F ' ,
' F ' ,
IncreaseGamma ,
IncreaseGamma ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
keymapper . addAction ( {
keymapper . addAction ( {
" Inventory " ,
" Inventory " ,
' I ' ,
' I ' ,
inventoryKeyPressed ,
inventoryKeyPressed ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
keymapper . addAction ( {
keymapper . addAction ( {
" Character " ,
" Character " ,
' C ' ,
' C ' ,
characterSheetKeyPressed ,
characterSheetKeyPressed ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
keymapper . addAction ( {
keymapper . addAction ( {
" QuestLog " ,
" QuestLog " ,
' Q ' ,
' Q ' ,
questLogKeyPressed ,
questLogKeyPressed ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
keymapper . addAction ( {
keymapper . addAction ( {
" Zoom " ,
" Zoom " ,
@ -2202,16 +2215,19 @@ void initKeymapActions()
zoomflag = ! zoomflag ;
zoomflag = ! zoomflag ;
CalcViewportGeometry ( ) ;
CalcViewportGeometry ( ) ;
} ,
} ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
keymapper . addAction ( {
keymapper . addAction ( {
" DisplaySpells " ,
" DisplaySpells " ,
' S ' ,
' S ' ,
displaySpellsKeyPressed ,
displaySpellsKeyPressed ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
keymapper . addAction ( {
keymapper . addAction ( {
" SpellBook " ,
" SpellBook " ,
' B ' ,
' B ' ,
spellBookKeyPressed ,
spellBookKeyPressed ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
keymapper . addAction ( {
keymapper . addAction ( {
" GameInfo " ,
" GameInfo " ,
@ -2226,6 +2242,7 @@ void initKeymapActions()
strcpy ( pszStr , fmt : : format ( _ ( /* TRANSLATORS: {:s} means: Character Name, Game Version, Game Difficulty. */ " {:s}, version = {:s}, mode = {:s} " ) , gszProductName , PROJECT_VERSION , difficulties [ sgGameInitInfo . nDifficulty ] ) . c_str ( ) ) ;
strcpy ( pszStr , fmt : : format ( _ ( /* TRANSLATORS: {:s} means: Character Name, Game Version, Game Difficulty. */ " {:s}, version = {:s}, mode = {:s} " ) , gszProductName , PROJECT_VERSION , difficulties [ sgGameInitInfo . nDifficulty ] ) . c_str ( ) ) ;
NetSendCmdString ( 1 < < myplr , pszStr ) ;
NetSendCmdString ( 1 < < myplr , pszStr ) ;
} ,
} ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
for ( int i = 0 ; i < 8 ; + + i ) {
for ( int i = 0 ; i < 8 ; + + i ) {
keymapper . addAction ( {
keymapper . addAction ( {
@ -2237,24 +2254,25 @@ void initKeymapActions()
UseInvItem ( myplr , INVITEM_BELT_FIRST + i ) ;
UseInvItem ( myplr , INVITEM_BELT_FIRST + i ) ;
}
}
} ,
} ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
}
}
keymapper . addAction ( {
keymapper . addAction ( {
" QuickSave " ,
" QuickSave " ,
DVL_VK_F2 ,
DVL_VK_F2 ,
[ ] { gamemenu_save_game ( false ) ; } ,
[ ] { gamemenu_save_game ( false ) ; } ,
[ & ] ( ) { return ! gbIsMultiplayer & & ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
keymapper . addAction ( {
keymapper . addAction ( {
" QuickLoad " ,
" QuickLoad " ,
DVL_VK_F3 ,
DVL_VK_F3 ,
[ ] { gamemenu_load_game ( false ) ; } ,
[ ] { gamemenu_load_game ( false ) ; } ,
Keymapper : : Action : : IfDead : : Allow ,
[ & ] ( ) { return ! gbIsMultiplayer & & gbValidSaveFile ; } ,
} ) ;
} ) ;
keymapper . addAction ( {
keymapper . addAction ( {
" QuitGame " ,
" QuitGame " ,
DVL_VK_INVALID ,
DVL_VK_INVALID ,
[ ] { gamemenu_quit_game ( false ) ; } ,
[ ] { gamemenu_quit_game ( false ) ; } ,
Keymapper : : Action : : IfDead : : Allow ,
} ) ;
} ) ;
# ifdef _DEBUG
# ifdef _DEBUG
keymapper . addAction ( {
keymapper . addAction ( {
@ -2266,12 +2284,14 @@ void initKeymapActions()
return ;
return ;
}
}
} ,
} ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
# endif
# endif
keymapper . addAction ( {
keymapper . addAction ( {
" StopHero " ,
" StopHero " ,
DVL_VK_INVALID ,
DVL_VK_INVALID ,
[ ] { plr [ myplr ] . Stop ( ) ; } ,
[ ] { plr [ myplr ] . Stop ( ) ; } ,
[ & ] ( ) { return ! isPlayerDead ( ) ; } ,
} ) ;
} ) ;
}
}