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; rv = true;
} }
if (msgflag != EMSG_NONE) { if (IsDiabloMsgAvailable()) {
msgdelay = 0; msgdelay = 0;
rv = true; rv = true;
} }

7
Source/error.cpp

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

2
Source/error.h

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

2
Source/scrollrt.cpp

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

Loading…
Cancel
Save