Beispiel #1
0
qboolean G_CanPickupWeapon( weapon_t weapon, gentity_t* ent ) {
	if( ent->client->sess.sessionTeam == TEAM_AXIS ) {
		if( weapon == WP_THOMPSON ) {
			weapon = WP_MP40;
		} else if( weapon == WP_CARBINE ) {
			weapon = WP_KAR98;
		} else if( weapon == WP_GARAND ) {
			weapon = WP_K43;
		}
		
	} else if( ent->client->sess.sessionTeam == TEAM_ALLIES ) {
		if( weapon == WP_MP40 ) {
			weapon = WP_THOMPSON;
		} else if( weapon == WP_KAR98 ) {
			weapon = WP_CARBINE;
		} else if( weapon == WP_K43 ) {
			weapon = WP_GARAND;
		}
	}

	if( ent->client->sess.skill[SK_HEAVY_WEAPONS] >= 4 && ( weapon == WP_THOMPSON || weapon == WP_MP40 ) ) {
		return qfalse;
	}

	return BG_WeaponIsPrimaryForClassAndTeam( ent->client->sess.playerType, ent->client->sess.sessionTeam, weapon );
}
Beispiel #2
0
/**
* @brief Check if a weapon can be picked up.
*/
qboolean G_CanPickupWeapon(weapon_t weapon, gentity_t *ent)
{
    if (ent->client->sess.sessionTeam == TEAM_AXIS)
    {
        switch (weapon)
        {
        case WP_THOMPSON:
            weapon = WP_MP40;
            break;
        case WP_CARBINE:
            weapon = WP_KAR98;
            break;
        case WP_GARAND:
            weapon = WP_K43;
            break;
        case WP_MOBILE_BROWNING:
            weapon = WP_MOBILE_MG42;
            break;
        case WP_MORTAR:
            weapon = WP_MORTAR2;
            break;
        case WP_BAZOOKA:
            weapon = WP_PANZERFAUST;
            break;
        default:
            break;
        }
    }
    else if (ent->client->sess.sessionTeam == TEAM_ALLIES)
    {
        switch (weapon)
        {
        case WP_MP40:
            weapon = WP_THOMPSON;
            break;
        case WP_KAR98:
            weapon = WP_CARBINE;
            break;
        case WP_K43:
            weapon = WP_GARAND;
            break;
        case WP_MOBILE_MG42:
            weapon = WP_MOBILE_BROWNING;
            break;
        case WP_MORTAR2:
            weapon = WP_MORTAR;
            break;
        case WP_PANZERFAUST:
            weapon = WP_BAZOOKA;
            break;
        default:
            break;
        }
    }

    return BG_WeaponIsPrimaryForClassAndTeam(ent->client->sess.playerType, ent->client->sess.sessionTeam, weapon);
}
Beispiel #3
0
/*
==============
Touch_Item
	if other->client->pers.autoActivate == PICKUP_ACTIVATE	(0), he will pick up items only when using +activate
	if other->client->pers.autoActivate == PICKUP_TOUCH		(1), he will pickup items when touched
	if other->client->pers.autoActivate == PICKUP_FORCE		(2), he will pickup the next item when touched (and reset to PICKUP_ACTIVATE when done)
==============
*/
void Touch_Item_Auto( gentity_t *ent, gentity_t *other, trace_t *trace )
{
 	if( other->client->pers.autoActivate == PICKUP_ACTIVATE )
		return;

	if( !ent->active && ent->item->giType == IT_WEAPON ) {
		if( ent->item->giTag != WP_AMMO  && ent->item->giTag != WP_BINOCULARS ) {
			if ( G_GetPrimaryWeaponForClient(other->client) ||
					 (!BG_WeaponIsPrimaryForClassAndTeam( other->client->sess.playerType, TEAM_ALLIES, ent->item->giTag ) &&
						!BG_WeaponIsPrimaryForClassAndTeam( other->client->sess.playerType, TEAM_AXIS, ent->item->giTag )
					 ) ) {
			if( !COM_BitCheck( other->client->ps.weapons, ent->item->giTag ) ) {
				return;	// force activate only
				}
			}
		}
	}

	ent->active = qtrue;
	Touch_Item( ent, other, trace );

	if( other->client->pers.autoActivate == PICKUP_FORCE )		// autoactivate probably forced by the "Cmd_Activate_f()" function
		other->client->pers.autoActivate = PICKUP_ACTIVATE;		// so reset it.
}
Beispiel #4
0
qboolean G_CanPickupWeapon( weapon_t weapon, gentity_t* ent ) {

	// tjw: don't let players pick up a weapon they are
	//      already holding.
	if(COM_BitCheck(ent->client->ps.weapons, weapon))
		return qfalse;

	if( ent->client->sess.sessionTeam == TEAM_AXIS ) {
		if( weapon == WP_THOMPSON ) {
			weapon = WP_MP40;
		} else if( weapon == WP_CARBINE ) {
			weapon = WP_KAR98;
		} else if( weapon == WP_GARAND ) {
			weapon = WP_K43;
		}

	} else if( ent->client->sess.sessionTeam == TEAM_ALLIES ) {
		if( weapon == WP_MP40 ) {
			weapon = WP_THOMPSON;
		} else if( weapon == WP_KAR98 ) {
			weapon = WP_CARBINE;
		} else if( weapon == WP_K43 ) {
			weapon = WP_GARAND;
		}
	}

	if( g_unlockDropWeapons.integer ) {
		return qtrue;
	}

	// tjw: check heavy weapon restrictions
	if(G_IsWeaponDisabled(ent,
		weapon,
		ent->client->sess.sessionTeam,
		qtrue)) {

		return qfalse;
	}

	return BG_WeaponIsPrimaryForClassAndTeam( ent->client->sess.playerType, ent->client->sess.sessionTeam, weapon );
}
Beispiel #5
0
/**
 * @brief Check if a weapon can be picked up.
 * @param[in] weapon
 * @param[in] ent
 * @return
 */
qboolean G_CanPickupWeapon(weapon_t weapon, gentity_t *ent)
{
	// prevent picking up while reloading
	if (ent->client->ps.weaponstate == WEAPON_RELOADING)
	{
		return qfalse;
	}

	// prevent picking up when overheating
	if (ent->client->ps.weaponTime > 0)
	{
		return qfalse;
	}

	// get an equivalent weapon if the cleint team is different of the weapon team, if not keep the current
	if (ent->client->sess.sessionTeam != GetWeaponTableData(weapon)->team && GetWeaponTableData(weapon)->weapEquiv)
	{
		weapon = GetWeaponTableData(weapon)->weapEquiv;
	}

	return BG_WeaponIsPrimaryForClassAndTeam(ent->client->sess.playerType, ent->client->sess.sessionTeam, weapon);
}