incoming limit (-Z flag::default 10MB), blend fix (thanks to Kirin) and velocity test

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5293 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Rafael Barreto
2010-07-06 19:22:27 +00:00
parent 09b09bb146
commit 1344b25410
5 changed files with 38 additions and 11 deletions
+17 -1
View File
@@ -105,6 +105,7 @@ void updatelagtime(playerent *d)
extern void trydisconnect();
VARP(maxrollremote, 0, 1, 1); // bound remote "roll" values by our maxroll?!
VARP(testvel, 0, 0, 1);
void parsepositions(ucharbuf &p)
{
@@ -163,12 +164,27 @@ void parsepositions(ucharbuf &p)
if(!d || seqcolor!=(d->lifesequence&1)) continue;
vec oldpos(d->o);
float oldyaw = d->yaw, oldpitch = d->pitch;
if ( !testvel ) d->vel = vel;
else
{
if ( d->last_pos > totalmillis )
{
loopi(3)
{
d->vel.v[i] = (( o.v[i] + ( i == 2 ? d->eyeheight : 0.0) ) - d->o.v[i]) * 0.4 + d->vel.v[i] * 0.6;
int t = 6 * d->vel.v[i];
d->vel.v[i] = 0.25f * t;
}
}
else loopi(3) d->vel.v[i] = 0.0f;
d->last_pos = totalmillis + 400;
}
// printf("->>>>>> R %d %f %f %f %f %f %f\n",cn,vel.x,vel.y,vel.z,d->vel.x,d->vel.y,d->vel.z);
d->o = o;
d->o.z += d->eyeheight;
d->yaw = yaw;
d->pitch = pitch;
d->roll = roll;
d->vel = vel;
d->strafe = (f&3)==3 ? -1 : f&3;
f >>= 2;
d->move = (f&3)==3 ? -1 : f&3;
+3 -1
View File
@@ -110,9 +110,10 @@ public:
char move, strafe;
uchar state, type;
float eyeheightvel;
int last_pos;
physent() : o(0, 0, 0), deltapos(0, 0, 0), newpos(0, 0, 0), yaw(270), pitch(0), roll(0), pitchvel(0),
crouching(false), crouchedinair(false), trycrouch(false), cancollide(true), stuck(false), lastjump(0), lastsplash(0), state(CS_ALIVE)
crouching(false), crouchedinair(false), trycrouch(false), cancollide(true), stuck(false), lastjump(0), lastsplash(0), state(CS_ALIVE), last_pos(0)
{
reset();
}
@@ -131,6 +132,7 @@ public:
move = strafe = 0;
timeinair = lastjump = lastsplash = 0;
onfloor = onladder = inwater = jumpnext = crouching = crouchedinair = trycrouch = stuck = false;
last_pos = 0;
}
virtual void oncollision() {}
+3 -2
View File
@@ -794,7 +794,7 @@ struct serverconfigfile
struct servercommandline
{
int uprate, serverport, syslogfacility, filethres, syslogthres, maxdemos, maxclients, kickthreshold, banthreshold, verbose;
int uprate, serverport, syslogfacility, filethres, syslogthres, maxdemos, maxclients, kickthreshold, banthreshold, verbose, incoming_limit;
const char *ip, *master, *logident, *serverpassword, *adminpasswd, *demopath, *maprot, *pwdfile, *blfile, *nbfile, *infopath, *motdpath, *forbidden;
bool logtimestamp;
string motd, servdesc_full, servdesc_pre, servdesc_suf, voteperm, mapperm;
@@ -802,7 +802,7 @@ struct servercommandline
vector<const char *> adminonlymaps;
servercommandline() : uprate(0), serverport(CUBE_DEFAULT_SERVER_PORT), syslogfacility(6), filethres(-1), syslogthres(-1), maxdemos(5),
maxclients(DEFAULTCLIENTS), kickthreshold(-5), banthreshold(-6), verbose(0),
maxclients(DEFAULTCLIENTS), kickthreshold(-5), banthreshold(-6), verbose(0), incoming_limit(10),
ip(""), master(NULL), logident(""), serverpassword(""), adminpasswd(""), demopath(""),
maprot("config/maprot.cfg"), pwdfile("config/serverpwd.cfg"), blfile("config/serverblacklist.cfg"), nbfile("config/nicknameblacklist.cfg"),
infopath("config/serverinfo"), motdpath("config/motd"), forbidden("config/forbidden.cfg"),
@@ -863,6 +863,7 @@ struct servercommandline
}
case 'P': concatstring(voteperm, a); break;
case 'M': concatstring(mapperm, a); break;
case 'Z': if(ai >= 0) incoming_limit = ai; break;
case 'V': verbose++; break;
case 'C': if(*a && clfilenesting < 3)
{
+3 -3
View File
@@ -66,10 +66,10 @@ void drawvoteicon(float x, float y, int col, int row, bool noblend)
if(!tex) tex = textureload("packages/misc/voteicons.png", 3);
if(tex)
{
if(noblend||transparency) glDisable(GL_BLEND);
if(transparency) turn_on_transparency();
if(noblend) glDisable(GL_BLEND);
if(transparency && !noblend) turn_on_transparency();
drawicon(tex, x, y, 240, col, row, 1/2.0f);
if(noblend||transparency) glEnable(GL_BLEND);
if(noblend) glEnable(GL_BLEND);
}
}
+12 -4
View File
@@ -34,6 +34,8 @@ int mastermode = MM_OPEN;
static bool autoteam = true;
int matchteamsize = 0;
long int incoming_size = 0;
static bool forceintermission = false;
string servdesc_current;
@@ -43,7 +45,7 @@ bool custom_servdesc = false;
// current game
string smapname, nextmapname;
int smode = 0, nextgamemode;
static int interm = 0, minremain = 0, gamemillis = 0, gamelimit = 0, lmsitemtype = 0, nextsendscore = 0;
static int interm = 0, minremain = 0, gamemillis = 0, gamelimit = 0, /*lmsitemtype = 0,*/ nextsendscore = 0;
mapstats smapstats;
vector<server_entity> sents;
char *maplayout = NULL, *testlayout = NULL;
@@ -1850,7 +1852,7 @@ void startgame(const char *newname, int newmode, int newtime, bool notify)
mapbuffer.setrevision();
logline(ACLOG_INFO, "Map height density information for %s: H = %.2f V = %d, A = %d and MA = %d", smapname, Mheight, Mvolume, Marea, Mopen);
}
else if(isdedicated) sendservmsg("\f3server error: map not found - please start another map");
else if(isdedicated) sendservmsg("\f3server error: map not found - please start another map or send this map to the server");
if(notify)
{
// change map
@@ -2998,7 +3000,7 @@ void process(ENetPacket *packet, int sender, int chan)
int cfgsize = getint(p);
int cfgsizegz = getint(p);
int revision = getint(p);
if(p.remaining() < mapsize + cfgsizegz)
if(p.remaining() < mapsize + cfgsizegz || MAXMAPSENDSIZE < mapsize + cfgsizegz)
{
p.forceoverread();
break;
@@ -3010,6 +3012,11 @@ void process(ENetPacket *packet, int sender, int chan)
defformatstring(msg)("\f3map upload rejected: map %s is readonly", sentmap);
sendservmsg(msg, sender);
}
else if( scl.incoming_limit && ( scl.incoming_limit << 20 ) < incoming_size + mapsize + cfgsizegz )
{
reject = "server incoming achieved its limits";
sendservmsg("\f3server does not support more incomings: limit achieved", sender);
}
else if(mp == MAP_NOTFOUND && !strchr(scl.mapperm, 'c') && cl->role < CR_ADMIN) // default: only admins can create maps
{
reject = "no permission for initial upload";
@@ -3029,10 +3036,11 @@ void process(ENetPacket *packet, int sender, int chan)
{
if(mapbuffer.sendmap(sentmap, mapsize, cfgsize, cfgsizegz, &p.buf[p.len]))
{
incoming_size += mapsize + cfgsizegz;
logline(ACLOG_INFO,"[%s] %s sent map %s, rev %d, %d + %d(%d) bytes written",
clients[sender]->hostname, clients[sender]->name, sentmap, revision, mapsize, cfgsize, cfgsizegz);
defformatstring(msg)("%s (%d) up%sed map %s, rev %d%s", clients[sender]->name, sender, mp == MAP_NOTFOUND ? "load": "dat", sentmap, revision,
strcmp(sentmap, behindpath(smapname)) || smode == GMODE_COOPEDIT ? "" : " (restart game to use new map version)");
/*strcmp(sentmap, behindpath(smapname)) || smode == GMODE_COOPEDIT ? "" :*/ "\f3 (restart game to use new map version)");
sendservmsg(msg);
}
else