Devilution
Diablo devolved - magic behind the 1996 computer game
Source
track.cpp
Go to the documentation of this file.
1
#include "
all.h
"
2
3
DEVILUTION_BEGIN_NAMESPACE
4
5
static
BYTE
sgbIsScrolling
;
6
static
DWORD
sgdwLastWalk
;
7
static
BOOL
sgbIsWalking
;
8
9
void
track_process
()
10
{
11
if
(!
sgbIsWalking
)
12
return
;
13
14
if
(cursmx < 0 || cursmx >=
MAXDUNX
- 1 || cursmy < 0 || cursmy >=
MAXDUNY
- 1)
15
return
;
16
17
if
(
plr
[
myplr
]._pVar8 <= 6 &&
plr
[
myplr
]._pmode !=
PM_STAND
)
18
return
;
19
20
if
(
cursmx
!=
plr
[
myplr
]._ptargx ||
cursmy
!=
plr
[
myplr
]._ptargy) {
21
DWORD tick = SDL_GetTicks();
22
if
((
int
)(tick -
sgdwLastWalk
) >= 300) {
23
sgdwLastWalk
= tick;
24
NetSendCmdLoc
(TRUE,
CMD_WALKXY
,
cursmx
,
cursmy
);
25
if
(!
sgbIsScrolling
)
26
sgbIsScrolling
= TRUE;
27
}
28
}
29
}
30
31
void
track_repeat_walk
(BOOL rep)
32
{
33
if
(
sgbIsWalking
== rep)
34
return
;
35
36
sgbIsWalking
= rep;
37
if
(rep) {
38
sgbIsScrolling
= 0;
39
sgdwLastWalk
= SDL_GetTicks() - 50;
40
NetSendCmdLoc
(TRUE,
CMD_WALKXY
,
cursmx
,
cursmy
);
41
}
else
if
(
sgbIsScrolling
) {
42
sgbIsScrolling
= FALSE;
43
}
44
}
45
46
BOOL
track_isscrolling
()
47
{
48
return
sgbIsScrolling
;
49
}
50
51
DEVILUTION_END_NAMESPACE
cursmx
int cursmx
Definition:
cursor.cpp:24
track_process
void track_process()
Definition:
track.cpp:9
sgbIsWalking
static BOOL sgbIsWalking
Definition:
track.cpp:7
sgbIsScrolling
static DEVILUTION_BEGIN_NAMESPACE BYTE sgbIsScrolling
Definition:
track.cpp:5
MAXDUNX
#define MAXDUNX
Definition:
defs.h:25
all.h
MAXDUNY
#define MAXDUNY
Definition:
defs.h:26
CMD_WALKXY
@ CMD_WALKXY
Definition:
enums.h:2172
DEVILUTION_END_NAMESPACE
#define DEVILUTION_END_NAMESPACE
Definition:
types.h:10
sgdwLastWalk
static DWORD sgdwLastWalk
Definition:
track.cpp:6
myplr
int myplr
Definition:
player.cpp:9
track_repeat_walk
void track_repeat_walk(BOOL rep)
Definition:
track.cpp:31
cursmy
int cursmy
Definition:
cursor.cpp:25
DEVILUTION_BEGIN_NAMESPACE
Definition:
sha.cpp:10
track_isscrolling
BOOL track_isscrolling()
Definition:
track.cpp:46
PM_STAND
@ PM_STAND
Definition:
enums.h:2043
NetSendCmdLoc
void NetSendCmdLoc(BOOL bHiPri, BYTE bCmd, BYTE x, BYTE y)
Definition:
msg.cpp:640
plr
PlayerStruct plr[MAX_PLRS]
Definition:
player.cpp:10
Generated by
1.8.17