Jump to content

Home

Shield hit


ensiform

Recommended Posts

You got rid of shields period or just the effect?

 

AFAIK its doable, I can check in the parts of the sp code that we still have for doing some of CoOp.

 

Seems to be gfx/misc/personalshield.

 

This is how they do it in SP, but you'd need to change it to work like the MP way and apply this shader around the player:

 

	// Personal Shields
//------------------------
if ( powerups & ( 1 << PW_BATTLESUIT )) 
{
	float diff = gent->client->ps.powerups[PW_BATTLESUIT] - cg.time;
	float t;

	if ( diff > 0 )
	{
		t = 1.0f - ( diff / (ARMOR_EFFECT_TIME * 2.0f));
		// Only display when we have damage
		if ( t < 0.0f || t > 1.0f ) 
		{
		}
		else
		{
			ent->shaderRGBA[0] = ent->shaderRGBA[1] = ent->shaderRGBA[2] = 255.0f * t;
			ent->shaderRGBA[3] = 255;
			ent->renderfx &= ~RF_ALPHA_FADE;
			ent->renderfx |= RF_RGB_TINT;
			ent->customShader = cgs.media.personalShieldShader;

			cgi_R_AddRefEntityToScene( ent );
		}
	}
}

 

So, it *should* be doable and it seems to work pretty much just like the force powers around the player.

Link to comment
Share on other sites

To make the SP shield work:

 

comment out CG_PlayerHitFX in CG_Player.

 

Between CG_PlayerPowerups call and the force drain section of CG_Player, add:

 

	//[TrueView]
if (cent->damageTime > cg.time && cent->currentState.NPC_class != CLASS_VEHICLE &&
	(cg.renderingThirdPerson || cent->currentState.number != cg.snap->ps.clientNum
	|| cg_trueguns.integer || cg.predictedPlayerState.weapon == WP_SABER
	|| cg.predictedPlayerState.weapon == WP_MELEE))
//[/TrueView]
{
	int alpha = 255.0 * ((cent->damageTime - cg.time) / MIN_SHIELD_TIME) + random()*16;
	if (alpha>255)
		alpha=255;

	legs.shaderRGBA[0] = legs.shaderRGBA[1] = legs.shaderRGBA[2] = alpha;
	legs.shaderRGBA[3] = 255;
	legs.renderfx &= ~RF_FORCE_ENT_ALPHA;
	legs.renderfx &= ~RF_MINLIGHT;
	legs.renderfx &= ~RF_RGB_TINT;

	legs.customShader = cgs.media.playerShieldDamage;

	trap_R_AddRefEntityToScene( &legs );
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...