You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.1 KiB

/**
* @file track.cpp
*
* Implementation of functionality tracking what the mouse cursor is pointing at.
*/
#include "all.h"
#include "../3rdParty/Storm/Source/storm.h"
8 years ago
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 = TRUE;
}
}
}
void track_repeat_walk(BOOL rep)
{
if (sgbIsWalking == rep)
return;
sgbIsWalking = rep;
if (rep) {
6 years ago
sgbIsScrolling = FALSE;
sgdwLastWalk = GetTickCount() - 50;
NetSendCmdLoc(TRUE, CMD_WALKXY, cursmx, cursmy);
} else if (sgbIsScrolling) {
sgbIsScrolling = FALSE;
}
}
BOOL track_isscrolling()
{
return sgbIsScrolling;
}