Esempio n. 1
0
/* Original redscreen palette method - replaces ZDoom method - ML       */
void ST_doPaletteStuff(void)
{
	int		palette;
	byte*	pal;
	float	cnt;
	int		bzc;
	float 	blend[4];
	player_t *plyr = &displayplayer();

	blend[0] = blend[1] = blend[2] = blend[3] = 0;

	SV_AddBlend (BaseBlendR / 255.0f, BaseBlendG / 255.0f, BaseBlendB / 255.0f, BaseBlendA, blend);

	if (!r_underwater && memcmp (blend, st_zdpalette, sizeof(blend))) {
		memcpy (st_zdpalette, blend, sizeof(blend));
		V_SetBlend ((int)(blend[0] * 255.0f), (int)(blend[1] * 255.0f),
					(int)(blend[2] * 255.0f), (int)(blend[3] * 256.0f));
	}

	if (r_underwater)
	{
		palette = 0;

		if (plyr->powers[pw_ironfeet] > 4*32 || plyr->powers[pw_ironfeet]&8)
			SV_AddBlend (0.0f, 1.0f, 0.0f, 0.125f, blend);
		if (plyr->bonuscount) {
			cnt = (float)(plyr->bonuscount << 3);
			SV_AddBlend (0.8431f, 0.7294f, 0.2706f, cnt > 128 ? 0.5f : cnt / 255.0f, blend);
		}

		if (plyr->damagecount < 114)
			cnt = damageToAlpha[(int)(plyr->damagecount*r_painintensity)];
		else
			cnt = damageToAlpha[(int)(113*r_painintensity)];

		if (plyr->powers[pw_strength])
		{
			// slowly fade the berzerk out
			int bzc = 128 - ((plyr->powers[pw_strength]>>3) & (~0x1f));

			if (bzc > cnt)
				cnt = bzc;
		}

		if (cnt)
		{
			if (cnt > 237)
				cnt = 237;

			SV_AddBlend (1.0f, 0.0f, 0.0f, cnt / 255.0f, blend);
		}
	}
Esempio n. 2
0
//updated
void TrailBlendScreen(edict_t *ent)
{

	if (ent->client->resp.toggles & TG_TFLASH)
	{
		int val = ent->client->resp.intblend;

	/*
	1 - Red		 - 0xf0f0f0f0;
	2 - Green	 - 0xd0d0d0d0;
	3 - Blue	 - 0xf3f3f3f3;
	4 - Yellow	 - 0xdddddddd;
	5 - White	 - 0xd7d7d7d7;
	6 - Orange	 - 0xe0e0e0e0;
	7 - Black	 - 0x00000000;
	*/

		if (val == 0xf0f0f0f0)
			SV_AddBlend (.3,0,0,100,ent->client->ps.blend);
		else if (val == 0xd0d0d0d0)
			SV_AddBlend (0,.3,0,100,ent->client->ps.blend);
		else if (val == 0xf3f3f3f3)
			SV_AddBlend (0,0,.3,100,ent->client->ps.blend);
		else if (val == 0xdddddddd)
			SV_AddBlend (.3,.3,0,100,ent->client->ps.blend);
		else if (val == 0xd7d7d7d7)
			SV_AddBlend (.3,.3,.3,100,ent->client->ps.blend);
		else if (val == 0xe0e0e0e0)
			SV_AddBlend (.7,.5,.2,100,ent->client->ps.blend);
		else if (val == 0x01010101)
			SV_AddBlend (0,0,0,100,ent->client->ps.blend);
	}
}
Esempio n. 3
0
/*
=============
SV_CalcBlend
=============
*/
void SV_CalcBlend (edict_t *ent)
{
	int		contents;
	vec3_t	vieworg;

	ent->client->ps.blend[0] = ent->client->ps.blend[1] = 
		ent->client->ps.blend[2] = ent->client->ps.blend[3] = 0;

	// add for contents
	VectorAdd (ent->s.origin, ent->client->ps.viewoffset, vieworg);
	contents = gi.pointcontents (vieworg);
	if (contents & (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER) )
		ent->client->ps.rdflags |= RDF_UNDERWATER;
	else
		ent->client->ps.rdflags &= ~RDF_UNDERWATER;

	if (contents & (CONTENTS_SOLID|CONTENTS_LAVA))
		SV_AddBlend (1.0, 0.3, 0.0, 0.6, ent->client->ps.blend);
	else if (contents & CONTENTS_SLIME)
		SV_AddBlend (0.0, 0.1, 0.05, 0.6, ent->client->ps.blend);
	// JOSEPH 20-MAY-99
	else if (contents & CONTENTS_WATER)
		//SV_AddBlend (0.5, 0.3, 0.2, 0.4, ent->client->ps.blend);
		SV_AddBlend (0.03, 0.04, 0.03, 0.4, ent->client->ps.blend);
	// END JOSEPH	

	// black spectator screen
	if (ent->client->pers.spectator == SPECTATING && no_spec->value
		&& !(ent->client->pers.admin > NOT_ADMIN || ent->client->pers.rconx[0])
		&& level.modeset == MATCH)
		SV_AddBlend (0.0, 0.0, 0.0, 1.0, ent->client->ps.blend);

	// add for damage
	if (ent->client->damage_alpha > 0)
		SV_AddBlend (ent->client->damage_blend[0], ent->client->damage_blend[1],
			ent->client->damage_blend[2], ent->client->damage_alpha, ent->client->ps.blend);

	// drop the damage value
	ent->client->damage_alpha -= 0.06;
	if (ent->client->damage_alpha < 0)
		ent->client->damage_alpha = 0;

	if (ent->client->pers.polyblender) return;

	if (ent->client->bonus_alpha > 0)
		SV_AddBlend (0.85, 0.7, 0.3, ent->client->bonus_alpha, ent->client->ps.blend);

	// drop the bonus value
	ent->client->bonus_alpha -= 0.1;
	if (ent->client->bonus_alpha < 0)
		ent->client->bonus_alpha = 0;
}
Esempio n. 4
0
/*
=============
SV_CalcBlend
=============
*/
void SV_CalcBlend (edict_t *ent)
{
	int		contents;
	vec3_t	vieworg;
	int		remaining;

	ent->client->ps.blend[0] = ent->client->ps.blend[1] = 
		ent->client->ps.blend[2] = ent->client->ps.blend[3] = 0;

	// add for contents
	if (ent->client->chasetoggle)
		VectorCopy (ent->client->chasecam->s.origin, vieworg);
	else
		VectorAdd (ent->s.origin, ent->client->ps.viewoffset, vieworg);

	contents = gi.pointcontents (vieworg);
	if (contents & (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER) )
		ent->client->ps.rdflags |= RDF_UNDERWATER;
	else
		ent->client->ps.rdflags &= ~RDF_UNDERWATER;

	if (contents & CONTENTS_LAVA) //(CONTENTS_SOLID|CONTENTS_LAVA))
		SV_AddBlend (1.0, 0.3, 0.0, 0.6, ent->client->ps.blend);
	else if (contents & CONTENTS_SLIME)
		SV_AddBlend (0.0, 0.1, 0.05, 0.6, ent->client->ps.blend);
	else if (contents & CONTENTS_WATER)
	{
		if(ent->in_mud == 3)
			SV_AddBlend (0.4, 0.3, 0.2, 0.9, ent->client->ps.blend);
		else
			SV_AddBlend (0.5, 0.3, 0.2, 0.4, ent->client->ps.blend);
	}

	// add for powerups

#ifdef JETPACK_MOD
	if ( ent->client->jetpack )
	{
		remaining = ent->client->pers.inventory[fuel_index];
		// beginning to fade if 4 secs or less
		if (remaining > 40)
		{
			if ( ((level.framenum % 6) == 0) && ( level.framenum - ent->client->jetpack_activation > 30 ) )
			{
				if (ent->client->jetpack_thrusting && (level.framenum - ent->client->jetpack_start_thrust > 10))
					gi.sound (ent, CHAN_AUTO, gi.soundindex("jetpack/revrun.wav"), 1, ATTN_NORM, 0);
				gi.sound (ent, CHAN_GIZMO, gi.soundindex("jetpack/running.wav"), 1, ATTN_NORM, 0);
			}
		}
	}
#endif // #ifdef JETPACK_MOD

	if (ent->client->quad_framenum > level.framenum)
	{
		remaining = ent->client->quad_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage2.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (0, 0, 1, 0.08, ent->client->ps.blend);
	}
	else if (ent->client->invincible_framenum > level.framenum)
	{
		remaining = ent->client->invincible_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect2.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (1, 1, 0, 0.08, ent->client->ps.blend);
	}
	else if (ent->client->enviro_framenum > level.framenum)
	{
		remaining = ent->client->enviro_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (0, 1, 0, 0.08, ent->client->ps.blend);
	}
	else if (ent->client->breather_framenum > level.framenum)
	{
		remaining = ent->client->breather_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (0.4, 1, 0.4, 0.04, ent->client->ps.blend);
	}

	if (level.freeze && (level.freezeframes % 30 == 0))
	{
		if (level.freezeframes == (stasis_time->value*10 - 30)) // was 270
			gi.sound(ent,CHAN_ITEM,gi.soundindex("items/stasis_stop.wav"), 1, ATTN_NORM, 0);
		else
			gi.sound(ent,CHAN_ITEM,gi.soundindex("items/stasis.wav"), 1, ATTN_NORM, 0);
	}

	// add for damage
	if (ent->client->damage_alpha > 0)
		SV_AddBlend (ent->client->damage_blend[0],ent->client->damage_blend[1]
		,ent->client->damage_blend[2], ent->client->damage_alpha, ent->client->ps.blend);

	if (ent->client->bonus_alpha > 0)
		SV_AddBlend (0.85, 0.7, 0.3, ent->client->bonus_alpha, ent->client->ps.blend);

	// drop the damage value
	ent->client->damage_alpha -= 0.06;
	if (ent->client->damage_alpha < 0)
		ent->client->damage_alpha = 0;

	// drop the bonus value
	ent->client->bonus_alpha -= 0.1;
	if (ent->client->bonus_alpha < 0)
		ent->client->bonus_alpha = 0;

	// DWH: Screen fade from target_failure or target_fade
	if (ent->client->fadein > 0)
	{
		float alpha;

		// Turn off fade for dead software players or they won't see menu
		if ( (ent->health <= 0) && (stricmp(vid_ref->string,"gl")) && (stricmp(vid_ref->string,"kmgl")) )
			ent->client->fadein = 0;

		if(ent->client->fadein > level.framenum)
		{
			alpha = ent->client->fadealpha*(1.0 - (ent->client->fadein-level.framenum)/(ent->client->fadein-ent->client->fadestart));
			SV_AddBlend (ent->client->fadecolor[0],
				         ent->client->fadecolor[1],
						 ent->client->fadecolor[2],
						 alpha, ent->client->ps.blend);
		}
		else if(ent->client->fadehold > level.framenum)
		{
			SV_AddBlend (ent->client->fadecolor[0],
			             ent->client->fadecolor[1],
						 ent->client->fadecolor[2],
						 ent->client->fadealpha, ent->client->ps.blend);
		}
		else if(ent->client->fadeout > level.framenum)
		{
			alpha = ent->client->fadealpha*((ent->client->fadeout-level.framenum)/(ent->client->fadeout-ent->client->fadehold));
			SV_AddBlend (ent->client->fadecolor[0],
				         ent->client->fadecolor[1],
						 ent->client->fadecolor[2],
						 alpha, ent->client->ps.blend);
		}
		else
			ent->client->fadein = 0;
	}
}
Esempio n. 5
0
void
SV_CalcBlend(edict_t *ent)
{
	int contents;
	vec3_t vieworg;
	int remaining;

  	if (!ent)
	{
		return;
	}

	ent->client->ps.blend[0] = ent->client->ps.blend[1] =
		ent->client->ps.blend[2] = ent->client->ps.blend[3] = 0;

	/* add for contents */
	VectorAdd(ent->s.origin, ent->client->ps.viewoffset, vieworg);
	contents = gi.pointcontents(vieworg);

	if (contents & (CONTENTS_LAVA | CONTENTS_SLIME | CONTENTS_WATER))
	{
		ent->client->ps.rdflags |= RDF_UNDERWATER;
	}
	else
	{
		ent->client->ps.rdflags &= ~RDF_UNDERWATER;
	}

	if (contents & (CONTENTS_SOLID | CONTENTS_LAVA))
	{
		SV_AddBlend(1.0, 0.3, 0.0, 0.6, ent->client->ps.blend);
	}
	else if (contents & CONTENTS_SLIME)
	{
		SV_AddBlend(0.0, 0.1, 0.05, 0.6, ent->client->ps.blend);
	}
	else if (contents & CONTENTS_WATER)
	{
		SV_AddBlend(0.5, 0.3, 0.2, 0.4, ent->client->ps.blend);
	}

	/* add for powerups */
	if (ent->client->quad_framenum > level.framenum)
	{
		remaining = ent->client->quad_framenum - level.framenum;

		if (remaining == 30) /* beginning to fade */
		{
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage2.wav"),
				   	1, ATTN_NORM, 0);
		}

		if ((remaining > 30) || (remaining & 4))
		{
			SV_AddBlend(0, 0, 1, 0.08, ent->client->ps.blend);
		}
	}
	else if (ent->client->quadfire_framenum > level.framenum)
	{
		remaining = ent->client->quadfire_framenum - level.framenum;

		if (remaining == 30) /* beginning to fade */
		{
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/quadfire2.wav"),
				   	1, ATTN_NORM, 0);
		}

		if ((remaining > 30) || (remaining & 4))
		{
			SV_AddBlend(1, 0.2, 0.5, 0.08, ent->client->ps.blend);
		}
	}
	else if (ent->client->invincible_framenum > level.framenum)
	{
		remaining = ent->client->invincible_framenum - level.framenum;

		if (remaining == 30) /* beginning to fade */
		{
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect2.wav"),
				   	1, ATTN_NORM, 0);
		}

		if ((remaining > 30) || (remaining & 4))
		{
			SV_AddBlend(1, 1, 0, 0.08, ent->client->ps.blend);
		}
	}
	else if (ent->client->enviro_framenum > level.framenum)
	{
		remaining = ent->client->enviro_framenum - level.framenum;

		if (remaining == 30) /* beginning to fade */
		{
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"),
				   	1, ATTN_NORM, 0);
		}

		if ((remaining > 30) || (remaining & 4))
		{
			SV_AddBlend(0, 1, 0, 0.08, ent->client->ps.blend);
		}
	}
	else if (ent->client->breather_framenum > level.framenum)
	{
		remaining = ent->client->breather_framenum - level.framenum;

		if (remaining == 30) /* beginning to fade */
		{
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"),
				   	1, ATTN_NORM, 0);
		}

		if ((remaining > 30) || (remaining & 4))
		{
			SV_AddBlend(0.4, 1, 0.4, 0.04, ent->client->ps.blend);
		}
	}

	/* add for damage */
	if (ent->client->damage_alpha > 0)
	{
		SV_AddBlend(ent->client->damage_blend[0],
				ent->client->damage_blend[1],
				ent->client->damage_blend[2],
				ent->client->damage_alpha,
				ent->client->ps.blend);
	}

	if (ent->client->bonus_alpha > 0)
	{
		SV_AddBlend(0.85, 0.7, 0.3, ent->client->bonus_alpha,
				ent->client->ps.blend);
	}

	/* drop the damage value */
	ent->client->damage_alpha -= 0.06;

	if (ent->client->damage_alpha < 0)
	{
		ent->client->damage_alpha = 0;
	}

	/* drop the bonus value */
	ent->client->bonus_alpha -= 0.1;

	if (ent->client->bonus_alpha < 0)
	{
		ent->client->bonus_alpha = 0;
	}
}
Esempio n. 6
0
/*
=============
SV_CalcBlend
=============
*/
void SV_CalcBlend (edict_t *ent)
{
	int		contents;
	vec3_t	vieworg;
	int		remaining;

	ent->client->ps.blend[0] = ent->client->ps.blend[1] = 
		ent->client->ps.blend[2] = ent->client->ps.blend[3] = 0;

	// add for contents
	VectorAdd (ent->s.origin, ent->client->ps.viewoffset, vieworg);
	contents = gi.pointcontents (vieworg);
	if (contents & (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER) )
		ent->client->ps.rdflags |= RDF_UNDERWATER;
	else
		ent->client->ps.rdflags &= ~RDF_UNDERWATER;

	if (contents & (CONTENTS_SOLID|CONTENTS_LAVA))
		SV_AddBlend (1.0, 0.3, 0.0, 0.6, ent->client->ps.blend);
	else if (contents & CONTENTS_SLIME)
		SV_AddBlend (0.0, 0.1, 0.05, 0.6, ent->client->ps.blend);
	else if (contents & CONTENTS_WATER)
		SV_AddBlend (0.5, 0.3, 0.2, 0.4, ent->client->ps.blend);
	//GHz: lowlight vision effect
	if (ent->client->ps.rdflags & RDF_IRGOGGLES)
		SV_AddBlend (1, 0, 0, 0.2, ent->client->ps.blend);
	//K03 Begin
	if (ent->client->cloaking && (ent->svflags & SVF_NOCLIENT))
		SV_AddBlend (-1, -1, -1, 0.3, ent->client->ps.blend);
	if(ent->client->bfg_blend)
		SV_AddBlend (0, 1, 0, 0.3, ent->client->ps.blend);
	//K03 End

	// add for powerups
	if (ent->client->quad_framenum > level.framenum)
	{
		remaining = ent->client->quad_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage2.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (0, 0, 1, 0.08, ent->client->ps.blend);
	}
	// RAFAEL
	else if (ent->client->quadfire_framenum > level.framenum)
	{
		remaining = ent->client->quadfire_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/quadfire2.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (1, 0.2, 0.5, 0.08, ent->client->ps.blend);
	}
	else if (ent->client->invincible_framenum > level.framenum)
	{
		remaining = ent->client->invincible_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect2.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (1, 1, 0, 0.08, ent->client->ps.blend);
	}
	else if (ent->client->enviro_framenum > level.framenum)
	{
		remaining = ent->client->enviro_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (0, 1, 0, 0.08, ent->client->ps.blend);
	}
	else if (ent->client->breather_framenum > level.framenum)
	{
		remaining = ent->client->breather_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4) )
			SV_AddBlend (0.4, 1, 0.4, 0.04, ent->client->ps.blend);
	}

	// add for damage
	if (ent->client->damage_alpha > 0)
		SV_AddBlend (ent->client->damage_blend[0],ent->client->damage_blend[1]
		,ent->client->damage_blend[2], ent->client->damage_alpha, ent->client->ps.blend);

	if (ent->client->bonus_alpha > 0)
		SV_AddBlend (0.85, 0.7, 0.3, ent->client->bonus_alpha, ent->client->ps.blend);

	// drop the damage value
	ent->client->damage_alpha -= 0.06;
	if (ent->client->damage_alpha < 0)
		ent->client->damage_alpha = 0;

	// drop the bonus value
	ent->client->bonus_alpha -= 0.1;
	if (ent->client->bonus_alpha < 0)
		ent->client->bonus_alpha = 0;
}
Esempio n. 7
0
/*
=============
SV_CalcBlend
=============
*/
void SV_CalcBlend (edict_t * ent)
{
	int contents;
	vec3_t vieworg;
	int remaining;


	// enable ir vision if appropriate
	if (ir->value)
	{
		if ((INV_AMMO(ent, BAND_NUM) &&	ent->client->resp.ir == 0) ||
			(ent->client->chase_target != NULL &&
			 ent->client->chase_target->client != NULL &&
			 ent->client->chase_mode == 2 &&
			ent->client->chase_target->client->resp.ir == 0 &&
			INV_AMMO(ent->client->chase_target, BAND_NUM)))
		{
			ent->client->ps.rdflags |= RDF_IRGOGGLES;
		}
		else
		{
			ent->client->ps.rdflags &= ~RDF_IRGOGGLES;
		}
	}

	ent->client->ps.blend[0] = ent->client->ps.blend[1] =
	ent->client->ps.blend[2] = ent->client->ps.blend[3] = 0;

	// add for contents
	VectorAdd (ent->s.origin, ent->client->ps.viewoffset, vieworg);
	contents = gi.pointcontents (vieworg);
	if (contents & (CONTENTS_LAVA | CONTENTS_SLIME | CONTENTS_WATER))
		ent->client->ps.rdflags |= RDF_UNDERWATER;
	else
		ent->client->ps.rdflags &= ~RDF_UNDERWATER;

	if (contents & (CONTENTS_SOLID | CONTENTS_LAVA))
		SV_AddBlend (1.0f, 0.3f, 0.0f, 0.6f, ent->client->ps.blend);
	else if (contents & CONTENTS_SLIME)
		SV_AddBlend (0.0f, 0.1f, 0.05f, 0.6f, ent->client->ps.blend);
	else if (contents & CONTENTS_WATER)
		SV_AddBlend (0.5f, 0.3f, 0.2f, 0.4f, ent->client->ps.blend);

	// AQ2:TNG - Igor[Rock] adding new irvision mode
	if (new_irvision->value && (ent->client->resp.ir == 0)
	&& INV_AMMO(ent, BAND_NUM))
	{
		SV_AddBlend (0.1f, 0.0f, 0.0f, 0.4f, ent->client->ps.blend);
	}
	// AQ2:TNG end of new irvision mode

	// add for powerups
	if (ent->client->quad_framenum > level.framenum)
	{
		remaining = ent->client->quad_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound (ent, CHAN_ITEM, gi.soundindex("items/damage2.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4))
			SV_AddBlend (0, 0, 1, 0.08f, ent->client->ps.blend);
	}
	else if (ent->client->invincible_framenum > level.framenum)
	{
		remaining = ent->client->invincible_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound (ent, CHAN_ITEM, gi.soundindex("items/protect2.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4))
			SV_AddBlend (1, 1, 0, 0.08f, ent->client->ps.blend);
	}
	else if (ent->client->enviro_framenum > level.framenum)
	{
		remaining = ent->client->enviro_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound (ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4))
			SV_AddBlend (0, 1, 0, 0.08f, ent->client->ps.blend);
	}
	else if (ent->client->breather_framenum > level.framenum)
	{
		remaining = ent->client->breather_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
			gi.sound (ent, CHAN_ITEM, gi.soundindex ("items/airout.wav"), 1, ATTN_NORM, 0);
		if (remaining > 30 || (remaining & 4))
			SV_AddBlend (0.4f, 1, 0.4f, 0.04f, ent->client->ps.blend);
	}

	// add for damage
	if (ent->client->damage_alpha > 0)
		SV_AddBlend (ent->client->damage_blend[0], ent->client->damage_blend[1],
	ent->client->damage_blend[2], ent->client->damage_alpha,
	ent->client->ps.blend);

	if (ent->client->bonus_alpha > 0)
		SV_AddBlend (0.85f, 0.7f, 0.3f, ent->client->bonus_alpha,
	ent->client->ps.blend);

	// drop the damage value
	ent->client->damage_alpha -= 0.06f;
	if (ent->client->damage_alpha < 0)
		ent->client->damage_alpha = 0;

	// drop the bonus value
	ent->client->bonus_alpha -= 0.1f;
	if (ent->client->bonus_alpha < 0)
		ent->client->bonus_alpha = 0;
}
Esempio n. 8
0
void
SV_CalcBlend(edict_t *ent)
{
	int		contents;
	vec3_t	vieworg;
	int		remaining;

	if (!ent)
	{
		return;
	}
	ent->client->ps.blend[0] = ent->client->ps.blend[1] = 
		ent->client->ps.blend[2] = ent->client->ps.blend[3] = 0;

	// add for contents
	VectorAdd (ent->s.origin, ent->client->ps.viewoffset, vieworg);
	contents = gi.pointcontents (vieworg);
	if (contents & (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER) )
	{
		ent->client->ps.rdflags |= RDF_UNDERWATER;
	}
	else
	{
		ent->client->ps.rdflags &= ~RDF_UNDERWATER;
	}

	if (contents & (CONTENTS_SOLID|CONTENTS_LAVA))
	{
		SV_AddBlend (1.0, 0.3, 0.0, 0.6, ent->client->ps.blend);
	}
	else if (contents & CONTENTS_SLIME)
	{
		SV_AddBlend (0.0, 0.1, 0.05, 0.6, ent->client->ps.blend);
	}
	else if (contents & CONTENTS_WATER)
	{
		SV_AddBlend (0.5, 0.3, 0.2, 0.4, ent->client->ps.blend);
	}

	// add for powerups
	if (ent->client->quad_framenum > level.framenum)
	{
		remaining = ent->client->quad_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
		{
			gi.sound(ent, CHAN_ITEM, gi.soundindex(
							"items/damage2.wav"), 1, ATTN_NORM, 0);
		}
		if ((remaining > 30) || (remaining & 4))
		{
			SV_AddBlend (0, 0, 1, 0.08, ent->client->ps.blend);
		}
	}
	else if (ent->client->invincible_framenum > level.framenum)
	{
		remaining = ent->client->invincible_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
		{
			gi.sound(ent, CHAN_ITEM, gi.soundindex(
							"items/protect2.wav"), 1, ATTN_NORM, 0);
		}
		if ((remaining > 30) || (remaining & 4))
		{
			SV_AddBlend (1, 1, 0, 0.08, ent->client->ps.blend);
		}
	}
	else if (ent->client->enviro_framenum > level.framenum)
	{
		remaining = ent->client->enviro_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
		{
			gi.sound(ent, CHAN_ITEM, gi.soundindex(
							"items/airout.wav"), 1, ATTN_NORM, 0);
		}
		if ((remaining > 30) || (remaining & 4))
		{
			SV_AddBlend (0, 1, 0, 0.08, ent->client->ps.blend);
		}
	}
	else if (ent->client->breather_framenum > level.framenum)
	{
		remaining = ent->client->breather_framenum - level.framenum;
		if (remaining == 30)	// beginning to fade
		{
			gi.sound(ent, CHAN_ITEM, gi.soundindex(
							"items/airout.wav"), 1, ATTN_NORM, 0);
		}
		if ((remaining > 30) || (remaining & 4))
		{
			SV_AddBlend (0.4, 1, 0.4, 0.04, ent->client->ps.blend);
		}
	}

	/* add for damage */
	if (ent->client->damage_alpha > 0)
	{
		SV_AddBlend(ent->client->damage_blend[0],
				ent->client->damage_blend[1],
				ent->client->damage_blend[2],
				ent->client->damage_alpha,
				ent->client->ps.blend);
	}

	if (ent->client->bonus_alpha > 0)
	{
		SV_AddBlend(0.85, 0.7, 0.3, ent->client->bonus_alpha,
				ent->client->ps.blend);
	}


	// for blinding
	if (ent->client->flashTime > 0)  /* FS: Zaero specific game dll changes */
	{
		float alpha = (float)ent->client->flashTime / (float)ent->client->flashBase;
		if (alpha > 1)
			alpha = 1;
		SV_AddBlend(1, 1, 1, alpha, ent->client->ps.blend);
		ent->client->flashTime--;
	}

	if (ent->client->zCameraStaticFramenum > level.time) /* FS: Zaero specific game dll changes */
	{
		SV_AddBlend(1,1,1,1, ent->client->ps.blend);
	}

	// drop the damage value
	ent->client->damage_alpha -= 0.06;

	if (ent->client->damage_alpha < 0)
	{
		ent->client->damage_alpha = 0;
	}

	// drop the bonus value
	ent->client->bonus_alpha -= 0.1;

	if (ent->client->bonus_alpha < 0)
	{
		ent->client->bonus_alpha = 0;
	}
}
Esempio n. 9
0
/*
 * Called for each player at the end of
 * the server frame and right after spawning
 */
void
ClientEndServerFrame(edict_t *ent)
{
	float	bobtime;
	int		i;

	if (!ent)
	{
		return;
	}

	current_player = ent;
	current_client = ent->client;

	/* If the origin or velocity have changed since ClientThink(),
	   update the pmove values. This will happen when the client
	   is pushed by a bmodel or kicked by an explosion.
	   If it wasn't updated here, the view position would lag a frame
	   behind the body position when pushed -- "sinking into plats" */
	for (i = 0; i < 3; i++)
	{
		current_client->ps.pmove.origin[i] = ent->s.origin[i] * 8.0;
		current_client->ps.pmove.velocity[i] = ent->velocity[i] * 8.0;
	}

	/* If the end of unit layout is displayed, don't give
	   the player any normal movement attributes */
	if (level.intermissiontime)
	{
		// FIXME: add view drifting here?
		current_client->ps.blend[3] = 0;
		current_client->ps.fov = 90;
		G_SetStats (ent);

		if (level.fadeFrames > 0) /* FS: Zaero specific game dll changes */
		{
			float ratio = (float)(50 - level.fadeFrames) / 50.0;
			SV_AddBlend (1, 1, 1, ratio, current_client->ps.blend);
		}

		return;
	}

	AngleVectors(ent->client->v_angle, forward, right, up);

	/* burn from lava, etc */
	P_WorldEffects();

	/* set model angles from view angles so other things in
	   the world can tell which direction you are looking */
	if (ent->client->v_angle[PITCH] > 180)
	{
		ent->s.angles[PITCH] = (-360 + ent->client->v_angle[PITCH]) / 3;
	}
	else
	{
		ent->s.angles[PITCH] = ent->client->v_angle[PITCH] / 3;
	}

	ent->s.angles[YAW] = ent->client->v_angle[YAW];
	ent->s.angles[ROLL] = 0;
	ent->s.angles[ROLL] = SV_CalcRoll(ent->s.angles, ent->velocity) * 4;

	/* calculate speed and cycle to be used for
	   all cyclic walking effects */
	xyspeed = sqrt(
			ent->velocity[0] * ent->velocity[0] + ent->velocity[1] *
			ent->velocity[1]);

	if (xyspeed < 5)
	{
		bobmove = 0;
		current_client->bobtime = 0; /* start at beginning of cycle again */
	}
	else if (ent->groundentity)
	{
		/* so bobbing only cycles when on ground */
		if (xyspeed > 210)
		{
			bobmove = 0.25;
		}
		else if (xyspeed > 100)
		{
			bobmove = 0.125;
		}
		else
		{
			bobmove = 0.0625;
		}
	}

	bobtime = (current_client->bobtime += bobmove);

	if (current_client->ps.pmove.pm_flags & PMF_DUCKED)
	{
		bobtime *= 4;
	}

	bobcycle = (int)bobtime;
	bobfracsin = fabs(sin(bobtime*M_PI));

	// detect hitting the floor
	P_FallingDamage (ent);

	// apply all the damage taken this frame
	P_DamageFeedback (ent);

	// determine the view offsets
	SV_CalcViewOffset (ent);

	// determine the gun offsets
	SV_CalcGunOffset (ent);

	/* determine the full screen color blend
	   must be after viewoffset, so eye contents
	   can be accurately determined */
	SV_CalcBlend(ent);

	/* chase cam stuff */
	if (ent->client->resp.spectator)
	{
		G_SetSpectatorStats(ent);
	}
	else
	{
		G_SetStats(ent);
	}

	G_CheckChaseStats(ent);

	G_SetClientEvent (ent);

	G_SetClientEffects (ent);

	G_SetClientSound (ent);

	G_SetClientFrame (ent);

	VectorCopy (ent->velocity, ent->client->oldvelocity);
	VectorCopy (ent->client->ps.viewangles, ent->client->oldviewangles);

	// clear weapon kicks
	VectorClear (ent->client->kick_origin);
	VectorClear (ent->client->kick_angles);

	if (!(level.framenum & 31))
	{
		/* if the scoreboard is up, update it */
		if (ent->client->showscores)
		{
			if (ent->client->zCameraTrack) /* FS: Zaero specific game dll changes */
			{
				updateVisorHud(ent);
			}
			else
			{
				DeathmatchScoreboardMessage (ent, ent->enemy);
			}
			gi.unicast(ent, false);
		}

		/* if the help computer is up, update it */
		if (ent->client->showhelp)
		{
			ent->client->pers.helpchanged = 0;
			HelpComputer(ent);
			gi.unicast(ent, false);
		}
	}

	// this we want to do regardless
	if (ent->client->zCameraTrack)  /* FS: Zaero specific game dll changes */
	{
		// decrease the visor frame time
		ent->client->pers.visorFrames--;
		if (ent->client->pers.visorFrames == 0)
		{
			stopCamera(ent);
			ent->client->pers.inventory[ITEM_INDEX(FindItem("Visor"))]--;
			ValidateSelectedItem (ent);
		}
	}

	/* if the inventory is up, update it */
	if (ent->client->showinventory)
	{
		InventoryMessage(ent);
		gi.unicast(ent, false);
	}
}
Esempio n. 10
0
/*
=============
SV_CalcBlend
=============
*/
void SV_CalcBlend (edict_t *ent)
{
    int		contents;
    vec3_t	vieworg;
    int		remaining;

    ent->client->ps.blend[0] = ent->client->ps.blend[1] =
                                   ent->client->ps.blend[2] = ent->client->ps.blend[3] = 0;

    // add for contents
    VectorAdd (ent->s.origin, ent->client->ps.viewoffset, vieworg);
    contents = gi.pointcontents (vieworg);
    if (contents & (CONTENTS_LAVA|CONTENTS_SLIME|CONTENTS_WATER) )
        ent->client->ps.rdflags |= RDF_UNDERWATER;
    else
        ent->client->ps.rdflags &= ~RDF_UNDERWATER;

    if (contents & (CONTENTS_SOLID|CONTENTS_LAVA))
        SV_AddBlend (1.0, 0.3, 0.0, 0.6, ent->client->ps.blend);
    else if (contents & CONTENTS_SLIME)
        SV_AddBlend (0.0, 0.1, 0.05, 0.6, ent->client->ps.blend);
    else if (contents & CONTENTS_WATER)
        SV_AddBlend (0.5, 0.3, 0.2, 0.4, ent->client->ps.blend);

    // add for powerups
    if (ent->client->quad_framenum > level.framenum)
    {
        remaining = ent->client->quad_framenum - level.framenum;
        if (remaining == 30)	// beginning to fade
            gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage2.wav"), 1, ATTN_NORM, 0);
        if (remaining > 30 || (remaining & 4) )
            SV_AddBlend (0, 0, 1, 0.08, ent->client->ps.blend);
    }
    // PMM - double damage
    else if (ent->client->double_framenum > level.framenum)
    {
        remaining = ent->client->double_framenum - level.framenum;
        if (remaining == 30)	// beginning to fade
            gi.sound(ent, CHAN_ITEM, gi.soundindex("misc/ddamage2.wav"), 1, ATTN_NORM, 0);
        if (remaining > 30 || (remaining & 4) )
            SV_AddBlend (0.9, 0.7, 0, 0.08, ent->client->ps.blend);
    }
    // PMM
    else if (ent->client->invincible_framenum > level.framenum)
    {
        remaining = ent->client->invincible_framenum - level.framenum;
        if (remaining == 30)	// beginning to fade
            gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect2.wav"), 1, ATTN_NORM, 0);
        if (remaining > 30 || (remaining & 4) )
            SV_AddBlend (1, 1, 0, 0.08, ent->client->ps.blend);
    }
    else if (ent->client->enviro_framenum > level.framenum)
    {
        remaining = ent->client->enviro_framenum - level.framenum;
        if (remaining == 30)	// beginning to fade
            gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0);
        if (remaining > 30 || (remaining & 4) )
            SV_AddBlend (0, 1, 0, 0.08, ent->client->ps.blend);
    }
    else if (ent->client->breather_framenum > level.framenum)
    {
        remaining = ent->client->breather_framenum - level.framenum;
        if (remaining == 30)	// beginning to fade
            gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0);
        if (remaining > 30 || (remaining & 4) )
            SV_AddBlend (0.4, 1, 0.4, 0.04, ent->client->ps.blend);
    }

//PGM
    if(ent->client->nuke_framenum > level.framenum)
    {
        float brightness;
        brightness = (ent->client->nuke_framenum - level.framenum) / 20.0;
        SV_AddBlend (1, 1, 1, brightness, ent->client->ps.blend);
    }
    if (ent->client->ir_framenum > level.framenum)
    {
        remaining = ent->client->ir_framenum - level.framenum;
        if(remaining > 30 || (remaining & 4))
        {
            ent->client->ps.rdflags |= RDF_IRGOGGLES;
            SV_AddBlend (1, 0, 0, 0.2, ent->client->ps.blend);
        }
        else
            ent->client->ps.rdflags &= ~RDF_IRGOGGLES;
    }
    else
    {
        ent->client->ps.rdflags &= ~RDF_IRGOGGLES;
    }
//PGM

    // add for damage
    if (ent->client->damage_alpha > 0)
        SV_AddBlend (ent->client->damage_blend[0],ent->client->damage_blend[1]
                     ,ent->client->damage_blend[2], ent->client->damage_alpha, ent->client->ps.blend);

    if (ent->client->bonus_alpha > 0)
        SV_AddBlend (0.85, 0.7, 0.3, ent->client->bonus_alpha, ent->client->ps.blend);

    // drop the damage value
    ent->client->damage_alpha -= 0.06;
    if (ent->client->damage_alpha < 0)
        ent->client->damage_alpha = 0;

    // drop the bonus value
    ent->client->bonus_alpha -= 0.1;
    if (ent->client->bonus_alpha < 0)
        ent->client->bonus_alpha = 0;
}
Esempio n. 11
0
/*
=============
SV_CalcBlend
=============
*/
void SV_CalcBlend(edict_t *ent)
{
    int     contents;
    vec3_t  vieworg;
    int     remaining;

    ent->client->ps.blend[0] = ent->client->ps.blend[1] =
                                   ent->client->ps.blend[2] = ent->client->ps.blend[3] = 0;

    // add for contents
    VectorAdd(ent->s.origin, ent->client->ps.viewoffset, vieworg);
    contents = gi.pointcontents(vieworg);
    if (contents & (CONTENTS_LAVA | CONTENTS_SLIME | CONTENTS_WATER))
        ent->client->ps.rdflags |= RDF_UNDERWATER;
    else
        ent->client->ps.rdflags &= ~RDF_UNDERWATER;

    if (contents & (CONTENTS_SOLID | CONTENTS_LAVA))
        SV_AddBlend(1.0f, 0.3f, 0.0f, 0.6f, ent->client->ps.blend);
    else if (contents & CONTENTS_SLIME)
        SV_AddBlend(0.0f, 0.1f, 0.05f, 0.6f, ent->client->ps.blend);
    else if (contents & CONTENTS_WATER)
        SV_AddBlend(0.5f, 0.3f, 0.2f, 0.4f, ent->client->ps.blend);

    // add for powerups
    if (ent->client->quad_framenum > level.framenum) {
        remaining = ent->client->quad_framenum - level.framenum;
        if (remaining == 30)    // beginning to fade
            gi.sound(ent, CHAN_ITEM, gi.soundindex("items/damage2.wav"), 1, ATTN_NORM, 0);
        if (remaining > 30 || (remaining & 4))
            SV_AddBlend(0, 0, 1, 0.08f, ent->client->ps.blend);
    } else if (ent->client->invincible_framenum > level.framenum) {
        remaining = ent->client->invincible_framenum - level.framenum;
        if (remaining == 30)    // beginning to fade
            gi.sound(ent, CHAN_ITEM, gi.soundindex("items/protect2.wav"), 1, ATTN_NORM, 0);
        if (remaining > 30 || (remaining & 4))
            SV_AddBlend(1, 1, 0, 0.08f, ent->client->ps.blend);
    } else if (ent->client->enviro_framenum > level.framenum) {
        remaining = ent->client->enviro_framenum - level.framenum;
        if (remaining == 30)    // beginning to fade
            gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0);
        if (remaining > 30 || (remaining & 4))
            SV_AddBlend(0, 1, 0, 0.08f, ent->client->ps.blend);
    } else if (ent->client->breather_framenum > level.framenum) {
        remaining = ent->client->breather_framenum - level.framenum;
        if (remaining == 30)    // beginning to fade
            gi.sound(ent, CHAN_ITEM, gi.soundindex("items/airout.wav"), 1, ATTN_NORM, 0);
        if (remaining > 30 || (remaining & 4))
            SV_AddBlend(0.4f, 1, 0.4f, 0.04f, ent->client->ps.blend);
    }

    // add for damage
    if (ent->client->damage_alpha > 0)
        SV_AddBlend(ent->client->damage_blend[0], ent->client->damage_blend[1]
                    , ent->client->damage_blend[2], ent->client->damage_alpha, ent->client->ps.blend);

    if (ent->client->bonus_alpha > 0)
        SV_AddBlend(0.85f, 0.7f, 0.3f, ent->client->bonus_alpha, ent->client->ps.blend);

    // drop the damage value
    ent->client->damage_alpha -= 0.06f;
    if (ent->client->damage_alpha < 0)
        ent->client->damage_alpha = 0;

    // drop the bonus value
    ent->client->bonus_alpha -= 0.1f;
    if (ent->client->bonus_alpha < 0)
        ent->client->bonus_alpha = 0;
}