예제 #1
0
/*
================
G_DoTimeShiftFor

Decide what time to shift everyone back to, and do it
================
*/
void G_DoTimeShiftFor( gentity_t *ent ) {	
	int wpflags[WP_NUM_WEAPONS] = { 0, 0, 2, 4, 0, 0, 8, 16, 0, 0, 0, 32, 0, 64 };

	int wpflag = wpflags[ent->client->ps.weapon];
	int time;

	// don't time shift for mistakes or bots
	if ( !ent->inuse || !ent->client || (ent->r.svFlags & SVF_BOT) ) {
		return;
	}

	// if it's enabled server-side and the client wants it or wants it for this weapon
	if ( g_delagHitscan.integer && ( ent->client->pers.delag & 1 || ent->client->pers.delag & wpflag ) ) {
		// do the full lag compensation, except what the client nudges
		time = ent->client->attackTime + ent->client->pers.cmdTimeNudge;
                //Give the lightning gun some handicap (lag was part of weapon balance in VQ3)
                if(ent->client->ps.weapon == WP_LIGHTNING && g_lagLightning.integer)
                    time+=50;
	}
	else {
		// do just 50ms
		time = level.previousTime + ent->client->frameOffset;
	}

	G_TimeShiftAllClients( time, ent );
}
예제 #2
0
/*
================
G_DoTimeShiftFor

Decide what time to shift everyone back to, and do it
================
*/
void G_DoTimeShiftFor( gentity_t *ent ) {	
#ifndef MISSIONPACK
	int wpflags[WP_NUM_WEAPONS] = { 0, 0, 2, 4, 0, 0, 8, 16, 0, 0, 0 };
#else
	int wpflags[WP_NUM_WEAPONS] = { 0, 0, 2, 4, 0, 0, 8, 16, 0, 0, 0, 32, 0, 64 };
#endif
	int wpflag = wpflags[ent->client->ps.weapon];
	int time;

	// don't time shift for mistakes or bots
	if ( !ent->inuse || !ent->client || (ent->r.svFlags & SVF_BOT) ) {
		return;
	}

	// if it's enabled server-side and the client wants it or wants it for this weapon
	if ( g_unlagged_delagHitscan.integer && ( ent->client->pers.delag & 1 || ent->client->pers.delag & wpflag ) ) {
		// do the full lag compensation, except what the client nudges
		time = ent->client->attackTime + ent->client->pers.cmdTimeNudge;
	}
	else {
		// do just 50ms
		time = level.previousTime + ent->client->frameOffset;
	}

	G_TimeShiftAllClients( time, ent );
}
예제 #3
0
/*
================
G_CalcLagTimeAndShiftAllClients
================
*/
void G_CalcLagTimeAndShiftAllClients( gentity_t	*ent ) {
	// set lag compensation time
	if ( level.delagWeapons && ent->client && !(ent->r.svFlags & SVF_BOT) ) {
		if ( ent->client->pers.cmd.serverTime < level.time - MAX_LAG_COMP ) {
			ent->client->lagTime = level.time - MAX_LAG_COMP;
		} else {
			ent->client->lagTime = ent->client->pers.cmd.serverTime;
		}
	} else {
		ent->client->lagTime = level.time;
	}

    // shift other clients back to the client's idea of the server
    // time to compensate for lag
    if ( level.delagWeapons && ent->client && !(ent->r.svFlags & SVF_BOT) ) {
		G_TimeShiftAllClients( ent->client->lagTime, ent );
	}	
}