Jump to content

Home

making efx instant


Cohsty243

Recommended Posts

I didn't think there was a delay. And thats almost impossible for a game to do that, having lag will cause you to lose packets and such a possibility to not see the effects. That being said, this would be an engine issue, not a server-module issue. So the answer is nowhere.

Link to comment
Share on other sites

cg_trueLightning doesn't do anything. That is, in jka anyway.

 

And you still would need to have an event of some-sort.

 

I don't think you would want to mimick the affect of cg_trueLightning anyway, that is more along the lines of a lightning gun or flame thrower, grapple hook etc. Not a single beam. The reason it takes long is because there is a fireTime.

Link to comment
Share on other sites

At the bottom of CG_FireWeapon( centity_t *cent, qboolean altFire )

CG_PredictWeaponEffects( cent );

The magically calculation, renders and functions

void CG_CalculateLinePath( centity_t *cent, vec3_t uMuzzlePoint, vec3_t uForward, vec3_t uRight, vec3_t uUp, vec3_t endPoint, vec3_t uNormal, int entityNum )
{
// Moved the calculation into this function so not only unlagged can use it, but
// other functions such as the lasersight will have access so it too.

trace_t		trace;

// Fetch the muzzle point.
CG_CalcMuzzlePoint( cg.predictedPlayerState.clientNum, uMuzzlePoint );

// Get the foward vector.
AngleVectors( cg.predictedPlayerState.viewangles, uForward, uRight, uUp );

// Trace to what end position we might come.
VectorMA( uMuzzlePoint, 8192, uForward, endPoint );

// Find where the trace ends, for example if we hit a player or not.
CG_Trace( &trace, uMuzzlePoint, vec3_origin, vec3_origin, endPoint, cg.predictedPlayerState.clientNum, CONTENTS_SOLID|CONTENTS_BODY );

// Team ghosting? Predicted effects have to do this manually now i presume.
// Keep looping and looping untill we have been cleared from that entityNum.
while ( 1 )
{
	if ((( trace.fraction < 1.0 || trace.startsolid ) && trace.entityNum < MAX_CLIENTS ) && cgs.clientinfo[trace.entityNum].team != TEAM_FREE && cgs.clientinfo[trace.entityNum].team == cgs.clientinfo[cg.predictedPlayerState.clientNum].team )
	{
		CG_Trace( &trace, trace.endpos, vec3_origin, vec3_origin, endPoint, trace.entityNum, CONTENTS_SOLID|CONTENTS_BODY );
	}
	else
	{
		break;
	}
}

// If you are in first person, we need to alter the position slightly.
if ( !cg.renderingThirdPerson )
{
	// Forward a bit, otherwise i will break it at spawn. (Base working)
	VectorMA( uMuzzlePoint, 18, uForward, uMuzzlePoint );

	// Its at the middle of the screen at this point. Slightly alter it.
	VectorMA( uMuzzlePoint, 2, uRight, uMuzzlePoint );
	VectorMA( uMuzzlePoint, -4, uUp, uMuzzlePoint );

	// Snipers want to have the muzzle slightly altered again, a bit lower.
	if ( cg.predictedPlayerState.zoomMode )
	{
		VectorMA( uMuzzlePoint, -2, uUp, uMuzzlePoint );
	}
}

// Copy the trace end position, whats supposed to be real, to the endPoint.
VectorCopy( trace.endpos, endPoint );

// Copy the plane normal to uNormal so we can render some effects.
VectorCopy( trace.plane.normal, uNormal );

}

void CG_PredictWeaponEffects( centity_t *cent )
{
vec3_t		endPoint, uMuzzlePoint, uForward, uRight, uUp, uNormal;
int			entityNum = -1;

// If the client isn't me, ignore it.
if ( cent->currentState.number != cg.predictedPlayerState.clientNum ) 
{
	return;
}

// Calculate all the positions.
CG_CalculateLinePath( cent, uMuzzlePoint, uForward, uRight, uUp, endPoint, uNormal, entityNum );

// Make a nice effect for when you are sniping.
if ( cg.predictedPlayerState.zoomMode )
{
	FX_DisruptorAltShot( uMuzzlePoint, endPoint, cent->currentState.shouldtarget );
}
// And obviously, do that too, when you're not sniping.
else
{
	FX_DisruptorMainShot( uMuzzlePoint, endPoint ); 
}

// We hit something, can be a client but also an object.
if ( entityNum < MAX_CLIENTS )
{
	FX_DisruptorHitPlayer( endPoint, uNormal, qtrue );
}
// We didn't hit anything.
else
{
	if ( cg.predictedPlayerState.zoomMode )
	{
		FX_DisruptorAltMiss( endPoint, uNormal );
	}
	else
	{
		FX_DisruptorHitWall( endPoint, uNormal );
	}
}

}

 

Credits to Deathspike if you use it please, thank you.

 

NoteNote: This code was written for my mod which had some things such as teamghosting. You're going to have to wreck that part out if you dont want it in the prediction. Also in order to have only one line, you'll need to supress the fire, impact events from the server (which belong to you).

Link to comment
Share on other sites

JK3 does not support qvm anyway and the lcc compiler with jk2 will not work correctly, so don't try it.

 

Anywho, I just made a hack that does team colored always size of alt fire beam when in instagib mode for my mod. Going to be working on a way to toggle if zoom is allowed or not.

 

FYI there is no need to have unlagged anymore than the optimized prediction in the client side. Newer technologies on the server side eliminate the need for the unnecessary ugly hacks :S.

 

I have: Minimal unlagged (took out the G_RunFrame loops and such). Moved the prediction stuff to be done on the pmove itself of the server-side. Added some Antilag features of Wolf:ET, and even merged the recently posted code for antiwarp from ETPro.

 

Hmm deathspike from what I can tell is that its only determining to use the alt fire beam when YOU are using zoom, not the entity. That will cause everyone with a disruptor shot at the time of you scoping to show as that and everyone with a disruptor shot when you are to show up as the normal beam.

Link to comment
Share on other sites

well im going to use qvm for q3 not jk3 lol.

 

oh, where'd you find that antiwarp src code at ? :p

 

i figured out how to make cvars control the fireTimes of weapons a long time ago if anyone is interested.

 

does anyone know where i can find the fireTimes in q3 source, been searching a while but i keep missing it lol.

 

EDIT: found them. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...