The Weapons Factory -


Copyright (C) 1998-2003 Weapons Factory Software


This program is free software; you can redistribute it and/or

modify it under the terms of the GNU General Public License

as published by the Free Software Foundation; either version2

of the License, or (at your option) any later version.


This program is distributed in the hope that it will be useful,

but WITHOUT ANY WARRANTY; without even the implied warranty of



See the GNU General Public License for more details.


You should have received a copy of the GNU General Public License

along with this program; if not, write to the Free Software

Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.


  Modified code by Keith Pase


  wf_feign.c--Disguise/class skin functions


            The Feign and related Feign code is a product of Acrid- designed

            for Weapons Factory, and is available as part of the Weapons Factory

            Source Code or a seperate tutorial.


            This program MUST NOT be sold in ANY form. If you have paid for

            this product, you should contact Acrid- at:






#include "..\game\g_local.h"

#include "..\game\m_player.h"

#include "..\game\gs_pmodels.h"//splitmodels


void feign_on (edict_t *ent)


    static int i;

            i= (i+1)%3;


            //Take some damage

            T_Damage (ent, ent, ent, vec3_origin, ent->s.origin, vec3_origin, 10, 10, DAMAGE_NO_ARMOR, MOD_FEIGN);


            VectorClear (ent->avelocity);

            ent->takedamage = DAMAGE_YES;

            ent->movetype = MOVETYPE_TOSS;//needed _none so pain doesnt start animation//solved elsewhere

            ent->s.modelindex2 =0;      // remove linked weapon model

            ent->s.angles[0] =0;

            ent->s.angles[2] =0;

            ent->s.sound =0;

            ent->r.client->weapon_sound =0;

            ent->r.maxs[2] = -8;

            ent->viewheight =0;



            set knockback flag so grenades and other weapons

            with knockback dont move players view

            used in T_damage code in g_combat.c


            ent->flags |= FL_NO_KNOCKBACK;


            // stop running/footsteps

            VectorClear (ent->velocity);

            //newgrap 5/99

            if (Is_Grappling(ent->r.client))





            //dont keep firing/no model to fire/model removed from player view

            ent->r.client->pers.lastweapon= ent->r.client->pers.weapon;

            ent->r.client->pers.weapon= NULL;// needed?

            ent->r.client->ps.gunindex =0;

            ent->r.client->anim_priority[LOWER] = ANIM_DEATH;

            ent->r.client->anim_priority[UPPER] = ANIM_DEATH;

            ent->r.client->anim_priority[HEAD] = ANIM_DEATH;


            switch (i)


            case 0:

                        ent->r.client->anim[LOWER] = BOTH_DEAD1;

                        ent->r.client->anim[UPPER] = BOTH_DEAD1;

                        ent->r.client->anim[HEAD] =0;



            case 1:

                        ent->r.client->anim[LOWER] = BOTH_DEAD2;

                        ent->r.client->anim[UPPER] = BOTH_DEAD2;

                        ent->r.client->anim[HEAD] =0;



            case 2:

                        ent->r.client->anim[LOWER] = BOTH_DEAD3;

                        ent->r.client->anim[UPPER] = BOTH_DEAD3;

                        ent->r.client->anim[HEAD] =0;



            G_Sound (ent, CHAN_VOICE, trap_SoundIndex (va("*death%i.wav", (rand()%4)+1)),1, ATTN_NORM);


void feign_off(edict_t *ent)



            //relink weapon model

            ent->s.modelindex2 = 255;

            //clear knockback flag

            ent->flags &= ~FL_NO_KNOCKBACK;

            //bring back player view weapon

            ent->r.client->pers.weapon= ent->r.client->pers.lastweapon;


            if (ent->r.client->pers.weapon)

                        ent->r.client->ps.gunindex = trap_ModelIndex(ent->r.client->pers.weapon->view_model);


            ent->r.client->anim_priority[LOWER] = ANIM_BASIC;

            ent->r.client->anim_priority[UPPER] = ANIM_BASIC;

            ent->r.client->anim_priority[HEAD] = ANIM_BASIC;


            ent->r.client->anim[LOWER] = LEGS_STAND;

            ent->r.client->anim[UPPER] = TORSO_STAND;

            ent->r.client->anim[HEAD] = ANIM_NONE;


            ent->r.client->lastsent[LOWER] =0;

            ent->r.client->lastsent[UPPER] =0;

            ent->r.client->lastsent[HEAD] =0;


            ent->s.frame =0;