+ ClearStateToDefault(&cs);
+ cs.active = true;
+ cs.number = e;
+ VectorCopy(ent->v->origin, cs.origin);
+ VectorCopy(ent->v->angles, cs.angles);
+ cs.flags = 0;
+ cs.effects = (int)ent->v->effects;
+ cs.colormap = (qbyte)ent->v->colormap;
+ cs.skin = (qbyte)ent->v->skin;
+ cs.frame = (qbyte)ent->v->frame;
+ cs.viewmodelforclient = GETEDICTFIELDVALUE(ent, eval_viewmodelforclient)->edict;
+ cs.exteriormodelforclient = GETEDICTFIELDVALUE(ent, eval_exteriormodeltoclient)->edict;
+ cs.nodrawtoclient = GETEDICTFIELDVALUE(ent, eval_nodrawtoclient)->edict;
+ cs.drawonlytoclient = GETEDICTFIELDVALUE(ent, eval_drawonlytoclient)->edict;
+ cs.tagentity = GETEDICTFIELDVALUE(ent, eval_tag_entity)->edict;
+ cs.tagindex = (qbyte)GETEDICTFIELDVALUE(ent, eval_tag_index)->_float;
+ i = (int)(GETEDICTFIELDVALUE(ent, eval_glow_size)->_float * 0.25f);
+ cs.glowsize = (qbyte)bound(0, i, 255);
+ if (GETEDICTFIELDVALUE(ent, eval_glow_trail)->_float)
+ cs.flags |= RENDER_GLOWTRAIL;
+
+ cs.modelindex = 0;
+ i = (int)ent->v->modelindex;
+ if (i >= 1 && i < MAX_MODELS && *PR_GetString(ent->v->model))
+ cs.modelindex = i;
+
+
+ cs.alpha = 255;
+ i = (int)(GETEDICTFIELDVALUE(ent, eval_alpha)->_float * 255.0f);
+ if (i)
+ cs.alpha = (qbyte)bound(0, i, 255);
+ // halflife
+ i = (int)(GETEDICTFIELDVALUE(ent, eval_renderamt)->_float);
+ if (i)
+ cs.alpha = (qbyte)bound(0, i, 255);
+
+ cs.scale = 16;
+ i = (int)(GETEDICTFIELDVALUE(ent, eval_scale)->_float * 16.0f);
+ if (i)
+ cs.scale = (qbyte)bound(0, i, 255);
+
+ cs.glowcolor = 254;
+ i = (int)(GETEDICTFIELDVALUE(ent, eval_glow_color)->_float);
+ if (i)
+ cs.glowcolor = i;
+
+ if (GETEDICTFIELDVALUE(ent, eval_fullbright)->_float)
+ cs.effects |= EF_FULLBRIGHT;
+
+ if (ent->v->movetype == MOVETYPE_STEP)
+ cs.flags |= RENDER_STEP;
+ if ((cs.effects & EF_LOWPRECISION) && cs.origin[0] >= -32768 && cs.origin[1] >= -32768 && cs.origin[2] >= -32768 && cs.origin[0] <= 32767 && cs.origin[1] <= 32767 && cs.origin[2] <= 32767)
+ cs.flags |= RENDER_LOWPRECISION;
+ if (ent->v->colormap >= 1024)
+ cs.flags |= RENDER_COLORMAPPED;
+ if (cs.viewmodelforclient)
+ cs.flags |= RENDER_VIEWMODEL; // show relative to the view
+
+ cs.specialvisibilityradius = 0;
+ if (cs.glowsize)
+ cs.specialvisibilityradius = max(cs.specialvisibilityradius, cs.glowsize * 4);
+ if (cs.flags & RENDER_GLOWTRAIL)
+ cs.specialvisibilityradius = max(cs.specialvisibilityradius, 100);
+ if (cs.effects & (EF_BRIGHTFIELD | EF_MUZZLEFLASH | EF_BRIGHTLIGHT | EF_DIMLIGHT | EF_RED | EF_BLUE | EF_FLAME | EF_STARDUST))