Source/ThunderBeast/QuakeToon/game/p_weapon.c
void ChangeWeapon (edict_t *ent)
{
	int i;

	if (ent->client->grenade_time)
	{
		ent->client->grenade_time = level.time;
		ent->client->weapon_sound = 0;
		weapon_grenade_fire (ent, false);
		ent->client->grenade_time = 0;
	}

	ent->client->pers.lastweapon = ent->client->pers.weapon;
	ent->client->pers.weapon = ent->client->newweapon;
	ent->client->newweapon = NULL;
	ent->client->machinegun_shots = 0;

	// set visible model
	if (ent->s.modelindex == 255) {
		if (ent->client->pers.weapon)
			i = ((ent->client->pers.weapon->weapmodel & 0xff) << 8);
		else
			i = 0;
		ent->s.skinnum = (ent - g_edicts - 1) | i;
	}

	if (ent->client->pers.weapon && ent->client->pers.weapon->ammo)
		ent->client->ammo_index = ITEM_INDEX(FindItem(ent->client->pers.weapon->ammo));
	else
		ent->client->ammo_index = 0;

	if (!ent->client->pers.weapon)
	{	// dead
		ent->client->ps.gunindex = 0;
		return;
	}

	ent->client->weaponstate = WEAPON_ACTIVATING;
	ent->client->ps.gunframe = 0;
	ent->client->ps.gunindex = gi.modelindex(ent->client->pers.weapon->view_model);

	ent->client->anim_priority = ANIM_PAIN;
	if(ent->client->ps.pmove.pm_flags & PMF_DUCKED)
	{
			ent->s.frame = FRAME_crpain1;
			ent->client->anim_end = FRAME_crpain4;
	}
	else
	{
			ent->s.frame = FRAME_pain301;
			ent->client->anim_end = FRAME_pain304;
			
	}
}
/*
===============
ChangeWeapon

The old weapon has been dropped all the way, so make the new one
current
===============
*/
ChangeWeapon
The old weapon has been dropped all the way, so make the new one
current
ChangeWeapon The old weapon has been dropped all the way so make the new one current
void ChangeWeapon (edict_t *ent)
{
	int i;
	if (ent->client->grenade_time)
	{
		ent->client->grenade_time = level.time;
		ent->client->weapon_sound = 0;
		weapon_grenade_fire (ent, false);
		ent->client->grenade_time = 0;
	}
	ent->client->pers.lastweapon = ent->client->pers.weapon;
	ent->client->pers.weapon = ent->client->newweapon;
	ent->client->newweapon = NULL;
	ent->client->machinegun_shots = 0;
	if (ent->s.modelindex == 255) {
		if (ent->client->pers.weapon)
			i = ((ent->client->pers.weapon->weapmodel & 0xff) << 8);
		else
			i = 0;
		ent->s.skinnum = (ent - g_edicts - 1) | i;
	}
	if (ent->client->pers.weapon && ent->client->pers.weapon->ammo)
		ent->client->ammo_index = ITEM_INDEX(FindItem(ent->client->pers.weapon->ammo));
	else
		ent->client->ammo_index = 0;
	if (!ent->client->pers.weapon)
	{	
		ent->client->ps.gunindex = 0;
		return;
	}
	ent->client->weaponstate = WEAPON_ACTIVATING;
	ent->client->ps.gunframe = 0;
	ent->client->ps.gunindex = gi.modelindex(ent->client->pers.weapon->view_model);
	ent->client->anim_priority = ANIM_PAIN;
	if(ent->client->ps.pmove.pm_flags & PMF_DUCKED)
	{
			ent->s.frame = FRAME_crpain1;
			ent->client->anim_end = FRAME_crpain4;
	}
	else
	{
			ent->s.frame = FRAME_pain301;
			ent->client->anim_end = FRAME_pain304;
	}
}
void ChangeWeapon ( edict_t * ent ) { int i ; if ( ent -> client -> grenade_time ) { ent -> client -> grenade_time = level . time ; ent -> client -> weapon_sound = 0 ; weapon_grenade_fire ( ent , false ) ; ent -> client -> grenade_time = 0 ; } ent -> client -> pers . lastweapon = ent -> client -> pers . weapon ; ent -> client -> pers . weapon = ent -> client -> newweapon ; ent -> client -> newweapon = NULL ; ent -> client -> machinegun_shots = 0 ; if ( ent -> s . modelindex == 255 ) { if ( ent -> client -> pers . weapon ) i = ( ( ent -> client -> pers . weapon -> weapmodel & 0xff ) << 8 ) ; else i = 0 ; ent -> s . skinnum = ( ent - g_edicts - 1 ) | i ; } if ( ent -> client -> pers . weapon && ent -> client -> pers . weapon -> ammo ) ent -> client -> ammo_index = ITEM_INDEX ( FindItem ( ent -> client -> pers . weapon -> ammo ) ) ; else ent -> client -> ammo_index = 0 ; if ( ! ent -> client -> pers . weapon ) { ent -> client -> ps . gunindex = 0 ; return ; } ent -> client -> weaponstate = WEAPON_ACTIVATING ; ent -> client -> ps . gunframe = 0 ; ent -> client -> ps . gunindex = gi . modelindex ( ent -> client -> pers . weapon -> view_model ) ; ent -> client -> anim_priority = ANIM_PAIN ; if ( ent -> client -> ps . pmove . pm_flags & PMF_DUCKED ) { ent -> s . frame = FRAME_crpain1 ; ent -> client -> anim_end = FRAME_crpain4 ; } else { ent -> s . frame = FRAME_pain301 ; ent -> client -> anim_end = FRAME_pain304 ; } }
ChangeWeapon
The old weapon has been dropped all the way, so make the new one
current
ChangeWeapon The old weapon has been dropped all the way so make the new one current
// set visible model // dead