Source/ThunderBeast/QuakeToon/game/p_weapon.c
void Use_Weapon (edict_t *ent, gitem_t *item)
{
	int			ammo_index;
	gitem_t		*ammo_item;

	// see if we're already using it
	if (item == ent->client->pers.weapon)
		return;

	if (item->ammo && !g_select_empty->value && !(item->flags & IT_AMMO))
	{
		ammo_item = FindItem(item->ammo);
		ammo_index = ITEM_INDEX(ammo_item);

		if (!ent->client->pers.inventory[ammo_index])
		{
			gi.cprintf (ent, PRINT_HIGH, "No %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
			return;
		}

		if (ent->client->pers.inventory[ammo_index] < item->quantity)
		{
			gi.cprintf (ent, PRINT_HIGH, "Not enough %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
			return;
		}
	}

	// change to this weapon when down
	ent->client->newweapon = item;
}
/*
================
Use_Weapon

Make the weapon ready if there is ammo
================
*/
Use_Weapon
Make the weapon ready if there is ammo
Use_Weapon Make the weapon ready if there is ammo
void Use_Weapon (edict_t *ent, gitem_t *item)
{
	int			ammo_index;
	gitem_t		*ammo_item;
	if (item == ent->client->pers.weapon)
		return;
	if (item->ammo && !g_select_empty->value && !(item->flags & IT_AMMO))
	{
		ammo_item = FindItem(item->ammo);
		ammo_index = ITEM_INDEX(ammo_item);
		if (!ent->client->pers.inventory[ammo_index])
		{
			gi.cprintf (ent, PRINT_HIGH, "No %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
			return;
		}
		if (ent->client->pers.inventory[ammo_index] < item->quantity)
		{
			gi.cprintf (ent, PRINT_HIGH, "Not enough %s for %s.\n", ammo_item->pickup_name, item->pickup_name);
			return;
		}
	}
	ent->client->newweapon = item;
}
void Use_Weapon ( edict_t * ent , gitem_t * item ) { int ammo_index ; gitem_t * ammo_item ; if ( item == ent -> client -> pers . weapon ) return ; if ( item -> ammo && ! g_select_empty -> value && ! ( item -> flags & IT_AMMO ) ) { ammo_item = FindItem ( item -> ammo ) ; ammo_index = ITEM_INDEX ( ammo_item ) ; if ( ! ent -> client -> pers . inventory [ ammo_index ] ) { gi . cprintf ( ent , PRINT_HIGH , " \n " , ammo_item -> pickup_name , item -> pickup_name ) ; return ; } if ( ent -> client -> pers . inventory [ ammo_index ] < item -> quantity ) { gi . cprintf ( ent , PRINT_HIGH , " \n " , ammo_item -> pickup_name , item -> pickup_name ) ; return ; } } ent -> client -> newweapon = item ; }
Use_Weapon
Make the weapon ready if there is ammo
Use_Weapon Make the weapon ready if there is ammo
// see if we're already using it // change to this weapon when down