devilutionX/Source/track.cpp
Anders Jenbo 39999791b3 Revamp ini options and sync in multiplayer
[NetMsg]
F12=Now you DIE!
F11=Here's something for you.
F10=Follow me.
F9=I need help! Come Here!

[Game]
Speed=50
Fast Walk=1
Grab Input=0
Theo Quest=0
Cow Quest=0

[Audio]
Sound Volume=0
Music Volume=0
Walking Sound=1

[Graphics]
Fullscreen=1
Fit to Screen=1
Scaling Quality=2
Integer Scaling=0
Vertical Sync=1
Blended Transparency=1
Gamma Correction=100
Color Cycling=1

[Diablo]
Intro=0

[Hellfire]
Intro=0
SItem=

[Phone Book]
Entry1=127.0.0.1

[Network]
Bind Address=0.0.0.0
2021-03-01 11:52:26 +01:00

60 lines
1.2 KiB
C++

/**
* @file track.cpp
*
* Implementation of functionality tracking what the mouse cursor is pointing at.
*/
#include "all.h"
DEVILUTION_BEGIN_NAMESPACE
namespace {
BYTE sgbIsScrolling;
Uint32 sgdwLastWalk;
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) {
Uint32 tick = SDL_GetTicks();
if ((int)(tick - sgdwLastWalk) >= gnTickDelay * 6) {
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) {
sgbIsScrolling = false;
sgdwLastWalk = SDL_GetTicks() - gnTickDelay;
NetSendCmdLoc(true, CMD_WALKXY, cursmx, cursmy);
} else if (sgbIsScrolling) {
sgbIsScrolling = false;
}
}
bool track_isscrolling()
{
return sgbIsScrolling;
}
DEVILUTION_END_NAMESPACE