| 951 | } |
| 952 | |
| 953 | void renderclient(playerent *d, const char *mdlname, const char *vwepname, int tex) |
| 954 | { |
| 955 | int anim = ANIM_IDLE|ANIM_LOOP; |
| 956 | float speed = 0.0; |
| 957 | vec o(d->o); |
| 958 | o.z -= d->eyeheight; |
| 959 | int basetime = -((int)(size_t)d&0xFFF); |
| 960 | if(d->state==CS_DEAD) |
| 961 | { |
| 962 | if(d==player1 && d->allowmove()) return; |
| 963 | if(d->nocorpse) return; |
| 964 | d->pitch = d->spectatemode == SM_OVERVIEW ? -90 : 0.1f; |
| 965 | anim = ANIM_DEATH; |
| 966 | basetime = d->lastpain; |
| 967 | int t = lastmillis-d->lastpain; |
| 968 | if(t<0 || t>20000) return; |
| 969 | if(t>2000) |
| 970 | { |
| 971 | anim = ANIM_LYING_DEAD|ANIM_NOINTERP|ANIM_LOOP; |
| 972 | basetime += 2000; |
| 973 | t -= 2000; |
| 974 | o.z -= t*t/10000000000.0f*t; |
| 975 | } |
| 976 | } |
| 977 | else if(d->state==CS_EDITING) { anim = ANIM_JUMP|ANIM_END; } |
| 978 | else if(d->state==CS_LAGGED) { anim = ANIM_SALUTE|ANIM_LOOP|ANIM_TRANSLUCENT; } |
| 979 | else if(lastmillis-d->lastpain<300) { anim = d->crouching ? ANIM_CROUCH_PAIN : ANIM_PAIN; speed = 300.0f/4; basetime = d->lastpain; } |
| 980 | else if(d->weaponsel == d->lastattackweapon && lastmillis-d->lastaction < 300 && d->lastpain < d->lastaction && !d->weaponsel->reloading && !d->weaponchanging |
| 981 | && (d->weaponsel->type != GUN_GRENADE || (d == player1 ? ((grenades *)player1->weapons[GUN_GRENADE])->throwmillis : ((grenades *)d->weapons[GUN_GRENADE])->cookingmillis > 0))) |
| 982 | { anim = d->crouching ? ANIM_CROUCH_ATTACK : ANIM_ATTACK; speed = 300.0f/8; basetime = d->lastaction; } |
| 983 | else if(!d->onfloor && d->timeinair>50) { anim = (d->crouching ? ANIM_CROUCH_WALK : ANIM_JUMP)|ANIM_END; } |
| 984 | else if(!d->move && !d->strafe) { anim = (d->crouching ? ANIM_CROUCH_IDLE : ANIM_IDLE)|ANIM_LOOP; } |
| 985 | else { anim = (d->crouching ? ANIM_CROUCH_WALK : ANIM_RUN)|ANIM_LOOP; speed = 1860/d->maxspeed; } |
| 986 | if(d->move < 0) { anim |= ANIM_REVERSE; } |
| 987 | modelattach a[3]; |
| 988 | int numattach = 0; |
| 989 | if(vwepname) |
| 990 | { |
| 991 | a[numattach].name = vwepname; |
| 992 | a[numattach].tag = "tag_weapon"; |
| 993 | numattach++; |
| 994 | } |
| 995 | |
| 996 | if(!stenciling && !reflecting && !refracting) |
| 997 | { |
| 998 | if(d->weaponsel==d->lastattackweapon && lastmillis-d->lastaction < d->weaponsel->flashtime()) |
| 999 | anim |= ANIM_PARTICLE; |
| 1000 | if(d != player1 && d->state==CS_ALIVE) |
| 1001 | { |
| 1002 | d->head = vec(-1, -1, -1); |
| 1003 | a[numattach].tag = "tag_head"; |
| 1004 | a[numattach].pos = &d->head; |
| 1005 | numattach++; |
| 1006 | } |
| 1007 | } |
| 1008 | if(player1->isspectating() && d->clientnum == player1->followplayercn && player1->spectatemode == SM_FOLLOW3RD_TRANSPARENT) |
| 1009 | { |
| 1010 | anim |= ANIM_TRANSLUCENT; // see through followed player |
no test coverage detected