From 1fd43d8aeb7b81a5e49596b6613067cae0cea40a Mon Sep 17 00:00:00 2001 From: Rafael Barreto Date: Wed, 21 Jul 2010 23:00:34 +0000 Subject: [PATCH] comment, flag fix (related to cover) and reliable lag information git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5434 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- source/src/client.cpp | 4 ++-- source/src/server.cpp | 2 ++ source/src/serverchecks.h | 36 ++++++++++++++++++++---------------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/source/src/client.cpp b/source/src/client.cpp index e83f79f5..f987bff2 100644 --- a/source/src/client.cpp +++ b/source/src/client.cpp @@ -357,7 +357,7 @@ void c2sinfo(playerent *d) // send update to the server dz = dzt - d->vel_t.i[2], // pack rest in 1 int: strafe:2, move:2, onfloor:1, onladder: 1 f = (d->strafe&3) | ((d->move&3)<<2) | (((int)d->onfloor)<<4) | (((int)d->onladder)<<5) | ((d->lifesequence&1)<<6) | (((int)d->crouching)<<7), - g = (dx?1:0) | ((dy?1:0)<<1) | ((dz?1:0)<<2) | ((r?1:0)<<3) | (((int)d->scoping)<<4) | (((int)d->shoot)<<5); + g = (dx?1:0) | ((dy?1:0)<<1) | ((dz?1:0)<<2) | ((r?1:0)<<3) | (((int)d->scoping)<<4) | (((int)d->shoot)<<5); // FIXME please remove this d->shoot in the protocol update d->vel_t.i[0] = dxt; d->vel_t.i[1] = dyt; d->vel_t.i[2] = dzt; @@ -401,7 +401,7 @@ void c2sinfo(playerent *d) // send update to the server b.putbits(1, s == 11 ? 1 : 0); b.putbits(s, z); b.putbits(1, d->scoping ? 1 : 0); - b.putbits(1, d->shoot ? 1 : 0); + b.putbits(1, d->shoot ? 1 : 0); // FIXME please remove this d->shoot in the protocol update } else { // classic POS packet diff --git a/source/src/server.cpp b/source/src/server.cpp index b14ae7fd..3bed0c4b 100644 --- a/source/src/server.cpp +++ b/source/src/server.cpp @@ -679,6 +679,8 @@ struct sflaginfo int lastupdate; int stolentime; short x, y; // flag entity location + + sflaginfo() { actor_cn = -1; } } sflaginfos[2]; void putflaginfo(packetbuf &p, int flag) diff --git a/source/src/serverchecks.h b/source/src/serverchecks.h index c42a52ab..50b7591c 100644 --- a/source/src/serverchecks.h +++ b/source/src/serverchecks.h @@ -1,7 +1,7 @@ inline bool is_lagging(client *cl) { - return ( cl->spj > 80 || cl->ping > 1000 || gamemillis - cl->lmillis > 400 ); + return ( cl->spj > 55 || cl->ping > 500 || cl->ldt > 80 ); // do not change this except if you really know what are you doing } inline float pow2(float x) @@ -377,16 +377,19 @@ void checkcover (client *target, client *actor) testcover(HE_FLAGCOVERED, CTFLCOVPT, actor); } } else if ( m_htf ) { - if ( f.state == CTFF_DROPPED ) { - struct { short x, y; } nf; - nf.x = f.pos[0]; nf.y = f.pos[1]; - CALCCOVER(nf); - testcover(HE_FLAGDEFENDED, HTFLDEFPT, actor); - } - if ( f.state == CTFF_STOLEN && actor->clientnum != f.actor_cn ) { - covered = true; coverid = f.actor_cn; - CALCCOVER(clients[f.actor_cn]->state.o); - testcover(HE_FLAGCOVERED, HTFLCOVPT, actor); + if ( actor->clientnum != f.actor_cn ) + { + if ( f.state == CTFF_DROPPED ) { + struct { short x, y; } nf; + nf.x = f.pos[0]; nf.y = f.pos[1]; + CALCCOVER(nf); + testcover(HE_FLAGDEFENDED, HTFLDEFPT, actor); + } + if ( f.state == CTFF_STOLEN ) { + covered = true; coverid = f.actor_cn; + CALCCOVER(clients[f.actor_cn]->state.o); + testcover(HE_FLAGCOVERED, HTFLCOVPT, actor); + } } } } @@ -506,7 +509,7 @@ inline void checkmove (client *cl) { cl->ldt = gamemillis - cl->lmillis; cl->lmillis = gamemillis; - if ( cl->ldt < 30 ) cl->ldt = 30; + if ( cl->ldt < 40 ) cl->ldt = 40; cl->t += cl->ldt; cl->spj = (( 7 * cl->spj + cl->ldt ) >> 3); @@ -515,14 +518,15 @@ inline void checkmove (client *cl) cl->inputmillis = servmillis; } +#ifdef ACAC + m_engine(cl); +#endif + if ( !cl->upspawnp ) { cl->spawnp = cl->state.o; cl->upspawnp = true; } -#ifdef ACAC - m_engine(cl); -#endif return; } @@ -535,7 +539,7 @@ inline void checkshoot (int cn, gameevent *shot) return; } -bool validdamage (client *target, client *actor, int gun, bool gib) +bool validdamage (client *&target, client *&actor, int &gun, bool &gib) { #ifdef ACAC