Пример #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
// 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
		}
Пример #4
0
//bani - Run a trace without fixups (historical fixups will be done externally)
void G_Trace( 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;

	G_AttachBodyParts( ent );

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

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

	G_DettachBodyParts();
}
Пример #5
0
/**
 * @brief Run a trace without fixups (historical fixups will be done externally)
 * @param[in] ent
 * @param[out] results
 * @param[in] start
 * @param[in] mins
 * @param[in] maxs
 * @param[in] end
 * @param[in] passEntityNum
 * @param[in] contentmask
 * @param[in] ignoreCorpses Skip corpses for bullet tracing (=non gibbing weapons)
 */
void G_Trace(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, qboolean ignoreCorpses)
{
	float  maxsBackup[MAX_CLIENTS];
	vec3_t dir;
	int    res, clientNum, i;

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

	G_AttachBodyParts(ent);

	// ignore bodies for bullet tracing
	if (ignoreCorpses)
	{
		if (g_corpses.integer == 0)
		{
			for (i = 0; i < BODY_QUEUE_SIZE; i++)
			{
				G_TempTraceIgnoreEntity(level.bodyQue[i]);
			}
		}
		else
		{
			for (i = MAX_CLIENTS; i < level.num_entities; i++)  // slower way, improve by time
			{
				if (g_entities[i].s.eType == ET_CORPSE)
				{
					G_TempTraceIgnoreEntity(&g_entities[i]);
				}
			}
		}
	}

	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();
	// ok let the bodies be traced again
	if (ignoreCorpses)
	{
		G_ResetTempTraceIgnoreEnts();
	}
}