Пример #1
0
// Run a trace with players in historical positions.
void G_HistoricalTrace( gentity_t* ent, trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask ) {
	int res;
	vec3_t dir;

	if( !g_antilag.integer || !ent->client ) {
		G_AttachBodyParts( ent );

		trap_Trace( results, start, mins, maxs, end, passEntityNum, contentmask );

		res = G_SwitchBodyPartEntity( &g_entities[ results->entityNum ] );
		POSITION_READJUST

		G_DettachBodyParts();
		return;
	}

	G_AdjustClientPositions( ent, ent->client->attackTime, qtrue );

	G_AttachBodyParts( ent ) ;

	trap_Trace( results, start, mins, maxs, end, passEntityNum, contentmask );

	res = G_SwitchBodyPartEntity( &g_entities[ results->entityNum ] );
	POSITION_READJUST

	G_DettachBodyParts();

	G_AdjustClientPositions( ent, 0, qfalse );
}
Пример #2
0
/**
 * @brief Run a trace with players in historical positions.
 * @param[in] ent
 * @param[out] results
 * @param[in] start
 * @param[in] mins
 * @param[in] maxs
 * @param[in] end
 * @param[in] passEntityNum
 * @param[in] contentmask
 */
void G_HistoricalTrace(gentity_t *ent, trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask)
{
	float  maxsBackup[MAX_CLIENTS];
	vec3_t dir;
	int    res, clientNum, i;

	memset(&maxsBackup, 0, sizeof(maxsBackup));

	if (!g_antilag.integer || !ent->client)
	{
		G_AttachBodyParts(ent);

		trap_Trace(results, start, mins, maxs, end, passEntityNum, contentmask);

		res = G_SwitchBodyPartEntity(&g_entities[results->entityNum]);
		POSITION_READJUST

		G_DettachBodyParts();
		return;
	}

	G_AdjustClientPositions(ent, ent->client->pers.cmd.serverTime, qtrue);

	G_AttachBodyParts(ent) ;

	for (i = 0; i < level.numConnectedClients; ++i)
	{
		clientNum = level.sortedClients[i];
		if (&g_entities[clientNum] && g_entities[clientNum].client && g_entities[clientNum].takedamage)
		{
			maxsBackup[clientNum]           = g_entities[clientNum].r.maxs[2];
			g_entities[clientNum].r.maxs[2] = ClientHitboxMaxZ(&g_entities[clientNum]);
		}
	}

	trap_Trace(results, start, mins, maxs, end, passEntityNum, contentmask);

	for (i = 0; i < level.numConnectedClients; ++i)
	{
		clientNum = level.sortedClients[i];
		if (&g_entities[clientNum] && g_entities[clientNum].client && g_entities[clientNum].takedamage)
		{
			g_entities[clientNum].r.maxs[2] = maxsBackup[clientNum];
		}
	}

	res = G_SwitchBodyPartEntity(&g_entities[results->entityNum]);
	POSITION_READJUST

	G_DettachBodyParts();

	G_AdjustClientPositions(ent, 0, qfalse);
}
Пример #3
0
void G_HistoricalTraceEnd( gentity_t *ent ) {
	// forty - don't do this with antilag off
	if(!g_antilag.integer) {
		return;
	}
	G_AdjustClientPositions( ent, 0, qfalse );
}
Пример #4
0
void G_HistoricalTraceBegin( gentity_t *ent ) {
	// forty - don't do this with antilag off
	if(!g_antilag.integer) {
		return;
	}
	G_AdjustClientPositions( ent, ent->client->attackTime, qtrue );
}
Пример #5
0
/**
 * @brief G_HistoricalTraceBegin
 * @param[in] ent
 */
void G_HistoricalTraceBegin(gentity_t *ent)
{
	// don't do this with antilag off
	if (!g_antilag.integer)
	{
		return;
	}
	G_AdjustClientPositions(ent, ent->client->pers.cmd.serverTime, qtrue);
}
Пример #6
0
// Run a trace with players in historical positions.
void G_HistoricalTrace(gentity_t *ent, trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask) {
	trace_t tr;
	gentity_t *other;
	int res;
	vec3_t dir;

	if (!g_antilag.integer || !ent->client) {
		G_AttachBodyParts(ent);

		trap_Trace(results, start, mins, maxs, end, passEntityNum, contentmask);

		res = G_SwitchBodyPartEntity(&g_entities[results->entityNum]);
		POSITION_READJUST

		G_DettachBodyParts();
		return;
	}

	G_AdjustClientPositions(ent, ent->client->pers.cmd.serverTime, qtrue);

	G_AttachBodyParts(ent);

	trap_Trace(results, start, mins, maxs, end, passEntityNum, contentmask);

	res = G_SwitchBodyPartEntity(&g_entities[results->entityNum]);
	POSITION_READJUST

	G_DettachBodyParts();

	G_AdjustClientPositions(ent, 0, qfalse);

	if (results->entityNum >= 0 && results->entityNum < MAX_CLIENTS && (other = &g_entities[results->entityNum])->inuse) {
		G_AttachBodyParts(ent);

		trap_Trace(&tr, start, mins, maxs, other->client->ps.origin, passEntityNum, contentmask);
		res = G_SwitchBodyPartEntity(&g_entities[results->entityNum]);
		POSITION_READJUST

		if (tr.entityNum != results->entityNum) {
			trap_Trace(results, start, mins, maxs, end, passEntityNum, contentmask);
			res = G_SwitchBodyPartEntity(&g_entities[results->entityNum]);
			POSITION_READJUST
		}
Пример #7
0
void G_HistoricalTraceEnd( gentity_t *ent ) {
	G_AdjustClientPositions( ent, 0, false );
}
Пример #8
0
void G_HistoricalTraceBegin( gentity_t *ent ) {
	G_AdjustClientPositions( ent, ent->client->pers.cmd.serverTime, true );
}