Browse Source

Introduce IsDiabloMsgAvailable and hide msgflag

pull/2712/head
obligaron 5 years ago committed by Anders Jenbo
parent
commit
3c45149cef
  1. 2
      Source/diablo.cpp
  2. 7
      Source/error.cpp
  3. 2
      Source/error.h
  4. 2
      Source/scrollrt.cpp

2
Source/diablo.cpp

@ -1737,7 +1737,7 @@ bool PressEscKey()
rv = true;
}
if (msgflag != EMSG_NONE) {
if (IsDiabloMsgAvailable()) {
msgdelay = 0;
rv = true;
}

7
Source/error.cpp

@ -14,12 +14,12 @@
namespace devilution {
uint32_t msgdelay;
diablo_message msgflag;
namespace {
diablo_message msgtable[MAX_SEND_STR_LEN];
uint8_t msgcnt;
diablo_message msgflag;
} // namespace
@ -99,6 +99,11 @@ void InitDiabloMsg(diablo_message e)
msgdelay = SDL_GetTicks();
}
bool IsDiabloMsgAvailable()
{
return msgflag != EMSG_NONE;
}
void ClrDiabloMsg()
{
for (auto &msg : msgtable)

2
Source/error.h

@ -70,9 +70,9 @@ enum diablo_message : uint8_t {
};
extern uint32_t msgdelay;
extern diablo_message msgflag;
void InitDiabloMsg(diablo_message e);
bool IsDiabloMsgAvailable();
void ClrDiabloMsg();
void DrawDiabloMsg(const Surface &out);

2
Source/scrollrt.cpp

@ -1230,7 +1230,7 @@ void DrawView(const Surface &out, int startX, int startY)
if (HelpFlag) {
DrawHelp(out);
}
if (msgflag != EMSG_NONE) {
if (IsDiabloMsgAvailable()) {
DrawDiabloMsg(out);
}
if (MyPlayerIsDead) {

Loading…
Cancel
Save