| 753 | |
| 754 | VARP(popdeadplayers, 0, 0, 1); |
| 755 | void rendermodel(const char *mdl, int anim, int tex, float rad, const vec &o, float roll, float yaw, float pitch, float speed, int basetime, playerent *d, modelattach *a, float scale) |
| 756 | { |
| 757 | if(popdeadplayers && d && a) |
| 758 | { |
| 759 | int acv = anim&ANIM_INDEX; |
| 760 | if( acv == ANIM_DECAY || acv == ANIM_LYING_DEAD || acv == ANIM_CROUCH_DEATH || acv == ANIM_DEATH ) return; |
| 761 | } |
| 762 | model *m = loadmodel(mdl); |
| 763 | if(!m || (stenciling && (m->shadowdist <= 0 || anim&ANIM_TRANSLUCENT))) return; |
| 764 | |
| 765 | if(rad >= 0) |
| 766 | { |
| 767 | if(!rad) |
| 768 | { |
| 769 | rad = m->radius; |
| 770 | if(roll != 0 || pitch != 0) rad = max(m->radius, m->zradius); // FIXME: this assumes worst-case even for small angles and should be eased up (especially for lamp posts) |
| 771 | rad *= scale; |
| 772 | } |
| 773 | if(isoccluded(camera1->o.x, camera1->o.y, o.x-rad, o.y-rad, rad*2)) return; |
| 774 | } |
| 775 | |
| 776 | if(stenciling && d && !raycubelos(camera1->o, o, d->radius)) |
| 777 | { |
| 778 | vec target(o); |
| 779 | target.z += d->eyeheight; |
| 780 | if(!raycubelos(camera1->o, target, d->radius)) return; |
| 781 | } |
| 782 | |
| 783 | int varseed = 0; |
| 784 | if(d) switch(anim&ANIM_INDEX) |
| 785 | { |
| 786 | case ANIM_DEATH: |
| 787 | case ANIM_LYING_DEAD: varseed = (int)(size_t)d + d->lastpain; break; |
| 788 | default: varseed = (int)(size_t)d + d->lastaction; break; |
| 789 | } |
| 790 | |
| 791 | if(a) for(int i = 0; a[i].tag; i++) |
| 792 | { |
| 793 | if(a[i].name) a[i].m = loadmodel(a[i].name); |
| 794 | //if(a[i].m && a[i].m->type()!=m->type()) a[i].m = NULL; |
| 795 | } |
| 796 | |
| 797 | if(numbatches>=0) |
| 798 | { |
| 799 | batchedmodel &b = addbatchedmodel(m); |
| 800 | b.o = o; |
| 801 | b.anim = anim; |
| 802 | b.varseed = varseed; |
| 803 | b.tex = tex; |
| 804 | b.roll = roll; |
| 805 | b.yaw = yaw; |
| 806 | b.pitch = pitch; |
| 807 | b.speed = speed; |
| 808 | b.basetime = basetime; |
| 809 | b.d = d; |
| 810 | b.attached = a ? modelattached.length() : -1; |
| 811 | if(a) for(int i = 0;; i++) { modelattached.add(a[i]); if(!a[i].tag) break; } |
| 812 | b.scale = scale; |
no test coverage detected