Files
devilution/Source/track.cpp
T
Anders JenboandGitHub 20621a0642 add all.h and use in place of diablo.h (#2005)
Now diablo.h is treated in the same way as all other header files of
Source, as it only contains the declarations of global variables and
functions of diablo.cpp.

Besides consistency, this also enables mods to include diablo.h just
like any other header file without having to include every header file
(and without having to include C++ specific aspects of the now all.h).
2020-02-14 13:12:54 +01:00

49 lines
1015 B
C++

#include "all.h"
#include "../3rdParty/Storm/Source/storm.h"
static BYTE sgbIsScrolling;
static DWORD sgdwLastWalk;
static BOOL sgbIsWalking;
void track_process()
{
if (!sgbIsWalking)
return;
if (cursmx < 0 || cursmx >= MAXDUNX - 1 || cursmy < 0 || cursmy >= MAXDUNY - 1)
return;
if (plr[myplr]._pVar8 <= 6 && plr[myplr]._pmode != PM_STAND)
return;
if (cursmx != plr[myplr]._ptargx || cursmy != plr[myplr]._ptargy) {
DWORD tick = GetTickCount();
if ((int)(tick - sgdwLastWalk) >= 300) {
sgdwLastWalk = tick;
NetSendCmdLoc(TRUE, CMD_WALKXY, cursmx, cursmy);
if (!sgbIsScrolling)
sgbIsScrolling = 1;
}
}
}
void track_repeat_walk(BOOL rep)
{
if (sgbIsWalking == rep)
return;
sgbIsWalking = rep;
if (rep) {
sgbIsScrolling = 0;
sgdwLastWalk = GetTickCount() - 50;
NetSendCmdLoc(TRUE, CMD_WALKXY, cursmx, cursmy);
} else if (sgbIsScrolling) {
sgbIsScrolling = 0;
}
}
BOOL track_isscrolling()
{
return sgbIsScrolling;
}