Пример #1
0
/*
================
CG_Respawn

A respawn happened this snapshot
================
*/
void CG_Respawn( void ) {
	// no error decay on player movement
	cg.thisFrameTeleport = qtrue;

	// display weapons available
//	cg.weaponSelectTime = cg.time;
	SetWeaponSelectTime();

	// select the weapon the server says we are using
	if (cg.snap->ps.weapon)
		cg.weaponSelect = cg.snap->ps.weapon;
}
Пример #2
0
/*
================
CG_ItemPickup

A new item was picked up this frame
================
*/
void CG_ItemPickup( int itemNum, qboolean bHadItem ) {
	cg.itemPickup = itemNum;
	cg.itemPickupTime = cg.time;
	cg.itemPickupBlendTime = cg.time;

	if (bg_itemlist[itemNum].classname && bg_itemlist[itemNum].classname[0])
	{ 

		char text[1024], data[1024];
		if (cgi_SP_GetStringTextString("SP_INGAME_PICKUPLINE",text, sizeof(text)) )
		{			
			if ( cgi_SP_GetStringTextString( va("SP_INGAME_%s",bg_itemlist[itemNum].classname ), data, sizeof( data )))
			{
//				Com_Printf("%s %s\n", text, data );
				cgi_Cvar_Set( "cg_WeaponPickupText", va("%s %s\n", text, data));
				cg.weaponPickupTextTime	= cg.time + 5000;
			}
		}
	}
	
	// see if it should be the grabbed weapon
	if ( bg_itemlist[itemNum].giType == IT_WEAPON ) 
	{
		const int nCurWpn = cg.predicted_player_state.weapon;
		const int nNewWpn = bg_itemlist[itemNum].giTag;

		if ( nCurWpn == WP_SABER || bHadItem)
		{//never switch away from the saber!
			return;
		}

		// kef -- check cg_autoswitch...
		//
		// 0 == no switching
		// 1 == automatically switch to best SAFE weapon
		// 2 == automatically switch to best weapon, safe or otherwise
		//
		// NOTE: automatically switching to any weapon you pick up is stupid and annoying and we won't do it.
		//

		if ( nNewWpn == WP_SABER )
		{//always switch to saber
			SetWeaponSelectTime();
			cg.weaponSelect = nNewWpn;
		}
		else if (0 == cg_autoswitch.integer)
		{
			// don't switch
		}
		else if (1 == cg_autoswitch.integer)
		{
			// safe switching
			if (	(nNewWpn > nCurWpn) &&
					!(nNewWpn == WP_DET_PACK) &&
					!(nNewWpn == WP_TRIP_MINE) &&
					!(nNewWpn == WP_THERMAL) &&
					!(nNewWpn == WP_ROCKET_LAUNCHER) &&
					!(nNewWpn == WP_CONCUSSION) )
			{
				// switch to new wpn
//				cg.weaponSelectTime = cg.time;
				SetWeaponSelectTime();
				cg.weaponSelect = nNewWpn;
			}
		}
		else if (2 == cg_autoswitch.integer)
		{
			// best
			if (nNewWpn > nCurWpn)
			{
				// switch to new wpn
//				cg.weaponSelectTime = cg.time;
				SetWeaponSelectTime();
				cg.weaponSelect = nNewWpn;
			}
		}
	}
}