42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
const float fx = (float)fabs(dx), fy = (float)fabs(dy),
fz = (float)fabs(dz);
if (fx < r && fy < r && fz < rz && d->state != CS_DEAD) {
if (fx < fy)
d->o.y += dy < 0 ? r - fy : -(r - fy); // push aside
else
d->o.x += dx < 0 ? r - fx : -(r - fx);
};
int lagtime = lastmillis - d->lastupdate;
if (lagtime) {
d->plag = (d->plag * 5 + lagtime) / 6;
d->lastupdate = lastmillis;
};
}
void
localservertoclient(
uchar *buf, int len) // processes any updates from the server
{
if (ENET_NET_TO_HOST_16(*(ushort *)buf) != len)
|
<
>
<
>
|
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
const float fx = (float)fabs(dx), fy = (float)fabs(dy),
fz = (float)fabs(dz);
if (fx < r && fy < r && fz < rz && d->state != CS_DEAD) {
if (fx < fy)
d->o.y += dy < 0 ? r - fy : -(r - fy); // push aside
else
d->o.x += dx < 0 ? r - fx : -(r - fx);
}
int lagtime = lastmillis - d->lastupdate;
if (lagtime) {
d->plag = (d->plag * 5 + lagtime) / 6;
d->lastupdate = lastmillis;
}
}
void
localservertoclient(
uchar *buf, int len) // processes any updates from the server
{
if (ENET_NET_TO_HOST_16(*(ushort *)buf) != len)
|
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
case SV_EDITD:
case SV_EDITE: {
int x = getint(p);
int y = getint(p);
int xs = getint(p);
int ys = getint(p);
int v = getint(p);
block b = {x, y, xs, ys};
switch (type) {
case SV_EDITH:
editheightxy(v != 0, getint(p), b);
break;
case SV_EDITT:
edittexxy(v, getint(p), b);
break;
|
|
|
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
case SV_EDITD:
case SV_EDITE: {
int x = getint(p);
int y = getint(p);
int xs = getint(p);
int ys = getint(p);
int v = getint(p);
block b = { x, y, xs, ys };
switch (type) {
case SV_EDITH:
editheightxy(v != 0, getint(p), b);
break;
case SV_EDITT:
edittexxy(v, getint(p), b);
break;
|