Browse Source

🚸 Close panels when hitting esc

pull/1075/head
Anders Jenbo 5 years ago
parent
commit
ff0bb98ea2
  1. 59
      Source/diablo.cpp
  2. 2
      Source/diablo.h

59
Source/diablo.cpp

@ -845,43 +845,69 @@ static void ReleaseKey(int vkey)
CaptureScreen();
}
BOOL PressEscKey()
static void ClosePanels()
{
BOOL rv = FALSE;
if (PANELS_COVER) {
if (!chrflag && !questlog && (invflag || sbookflag) && MouseX < 480 && MouseY < PANEL_TOP) {
SetCursorPos(MouseX + 160, MouseY);
} else if (!invflag && !sbookflag && (chrflag || questlog) && MouseX > 160 && MouseY < PANEL_TOP) {
SetCursorPos(MouseX - 160, MouseY);
}
}
invflag = FALSE;
chrflag = FALSE;
sbookflag = FALSE;
questlog = FALSE;
}
bool PressEscKey()
{
bool rv = false;
if (doomflag) {
doom_close();
rv = TRUE;
rv = true;
}
if (helpflag) {
helpflag = FALSE;
rv = TRUE;
rv = true;
}
if (qtextflag) {
qtextflag = FALSE;
stream_stop();
rv = TRUE;
} else if (stextflag) {
rv = true;
}
if (stextflag) {
STextESC();
rv = TRUE;
rv = true;
}
if (msgflag) {
msgdelay = 0;
rv = TRUE;
rv = true;
}
if (talkflag) {
control_reset_talk();
rv = TRUE;
rv = true;
}
if (dropGoldFlag) {
control_drop_gold(DVL_VK_ESCAPE);
rv = TRUE;
rv = true;
}
if (spselflag) {
spselflag = FALSE;
rv = TRUE;
rv = true;
}
if (invflag || chrflag || sbookflag || questlog) {
ClosePanels();
rv = true;
}
return rv;
@ -1074,22 +1100,13 @@ static void PressKey(int vkey)
} else if (vkey == DVL_VK_TAB) {
DoAutoMap();
} else if (vkey == DVL_VK_SPACE) {
if (!chrflag && !questlog && (invflag || sbookflag) && MouseX < 480 && MouseY < PANEL_TOP && PANELS_COVER) {
SetCursorPos(MouseX + 160, MouseY);
}
if (!invflag && !sbookflag && (chrflag || questlog) && MouseX > 160 && MouseY < PANEL_TOP && PANELS_COVER) {
SetCursorPos(MouseX - 160, MouseY);
}
ClosePanels();
helpflag = FALSE;
invflag = FALSE;
chrflag = FALSE;
sbookflag = FALSE;
spselflag = FALSE;
if (qtextflag && leveltype == DTYPE_TOWN) {
qtextflag = FALSE;
stream_stop();
}
questlog = FALSE;
automapflag = FALSE;
msgdelay = 0;
gamemenu_off();

2
Source/diablo.h

@ -80,7 +80,7 @@ void diablo_quit(int exitStatus);
int DiabloMain(int argc, char **argv);
BOOL TryIconCurs();
void diablo_pause_game();
BOOL PressEscKey();
bool PressEscKey();
void DisableInputWndProc(UINT uMsg, WPARAM wParam, LPARAM lParam);
void GM_Game(UINT uMsg, WPARAM wParam, LPARAM lParam);
void LoadGameLevel(BOOL firstflag, int lvldir);

Loading…
Cancel
Save