521 unsigned int effects, renderfx;
524 autorotate = anglemod(
cl.
time * 0.1f);
527 autoanim = 2 *
cl.
time / 1000;
529 memset(&ent, 0,
sizeof(ent));
538 effects = s1->effects;
539 renderfx = s1->renderfx;
542 if (effects & EF_ANIM01)
543 ent.frame = autoanim & 1;
544 else if (effects & EF_ANIM23)
545 ent.frame = 2 + (autoanim & 1);
546 else if (effects & EF_ANIM_ALL)
547 ent.frame = autoanim;
548 else if (effects & EF_ANIM_ALLFAST)
549 ent.frame =
cl.
time / 100;
551 ent.frame = s1->frame;
554 if (effects & EF_PENT) {
556 effects |= EF_COLOR_SHELL;
557 renderfx |= RF_SHELL_RED;
560 if (effects & EF_QUAD) {
562 effects |= EF_COLOR_SHELL;
563 renderfx |= RF_SHELL_BLUE;
566 if (effects & EF_DOUBLE) {
567 effects &= ~EF_DOUBLE;
568 effects |= EF_COLOR_SHELL;
569 renderfx |= RF_SHELL_DOUBLE;
572 if (effects & EF_HALF_DAMAGE) {
573 effects &= ~EF_HALF_DAMAGE;
574 effects |= EF_COLOR_SHELL;
575 renderfx |= RF_SHELL_HALF_DAM;
580 renderfx &= ~RF_GLOW;
582 ent.oldframe = cent->
prev.frame;
585 if (renderfx & RF_FRAMELERP) {
588 VectorCopy(cent->
current.origin, ent.origin);
589 VectorCopy(cent->
current.old_origin, ent.oldorigin);
590 }
else if (renderfx & RF_BEAM) {
592 LerpVector(cent->
prev.origin, cent->
current.origin,
594 LerpVector(cent->
prev.old_origin, cent->
current.old_origin,
603 LerpVector(cent->
prev.origin, cent->
current.origin,
605 VectorCopy(ent.origin, ent.oldorigin);
610 if (cent->prev_frame != s1->frame) {
611 int delta =
cl.
time - cent->anim_start;
614 if (delta > BASE_FRAMETIME) {
615 Com_DDPrintf(
"[%d] anim end %d: %d --> %d\n",
617 cent->prev_frame, s1->frame);
618 cent->prev_frame = s1->frame;
620 }
else if (delta > 0) {
621 frac = delta * BASE_1_FRAMETIME;
622 Com_DDPrintf(
"[%d] anim run %d: %d --> %d [%f]\n",
624 cent->prev_frame, s1->frame,
630 ent.oldframe = cent->prev_frame;
631 ent.backlerp = 1.0 - frac;
636 if ((effects & EF_GIB) && !
cl_gibs->integer) {
643 if (renderfx & RF_BEAM) {
646 ent.skinnum = (s1->skinnum >> ((rand() % 4) * 8)) & 0xff;
650 if (s1->modelindex == 255) {
655 ent.model = ci->
model;
656 if (!ent.skin || !ent.model) {
661 if (renderfx & RF_USE_DISGUISE) {
662 char buffer[MAX_QPATH];
665 ent.skin = R_RegisterSkin(buffer);
668 ent.skinnum = s1->skinnum;
672 renderfx |= RF_NOSHADOW;
677 if ((renderfx & RF_TRANSLUCENT) && !(renderfx & RF_BEAM))
681 if ((effects & EF_COLOR_SHELL))
684 ent.flags = renderfx;
687 if (effects & EF_ROTATE) {
689 ent.angles[1] = autorotate;
691 }
else if (effects & EF_SPINNINGLIGHTS) {
696 ent.angles[1] = anglemod(
cl.
time / 2) + s1->angles[1];
700 VectorMA(ent.origin, 64,
forward, start);
705 LerpAngles(cent->
prev.angles, cent->
current.angles,
709 if (s1->modelindex == 255 &&
cl_rollhack->integer) {
710 ent.angles[ROLL] = -ent.angles[ROLL];
714 int base_entity_flags = 0;
717 if (effects & EF_FLAG1)
719 else if (effects & EF_FLAG2)
721 else if (effects & EF_TAGTRAIL)
723 else if (effects & EF_TRACKERTRAIL)
724 V_AddLight(ent.origin, 225, -1.0, -1.0, -1.0);
729 base_entity_flags |= RF_VIEWERMODEL;
738 vec3_t angles = { 0.f, ent.angles[1], 0.f };
742 float offset = -15.f;
743 VectorMA(ent.origin, offset,
forward, ent.origin);
744 VectorMA(ent.oldorigin, offset,
forward, ent.oldorigin);
748 if (!s1->modelindex) {
752 if (effects & EF_BFG) {
753 ent.flags |= RF_TRANSLUCENT;
757 if (effects & EF_PLASMA) {
758 ent.flags |= RF_TRANSLUCENT;
762 if (effects & EF_SPHERETRANS) {
763 ent.flags |= RF_TRANSLUCENT;
764 if (effects & EF_TRACKERTRAIL)
770 ent.flags |= base_entity_flags;
773 if ((effects & EF_COLOR_SHELL) &&
vid_rtx->integer) {
775 ent.flags |= renderfx;
783 if (ent.model && !(ent.model & 0x80000000) &&
786 if (model->model_class == MCLASS_FLARE)
788 float phase = (float)
cl.
time * 0.03f + (
float)ent.id;
789 float anim = sinf(phase);
791 float offset = anim * 1.5f + 5.f;
792 float brightness = anim * 0.2f + 0.8f;
795 VectorCopy(ent.origin,
origin);
798 V_AddLightEx(
origin, 500.f, 1.6f * brightness, 1.0f * brightness, 0.2f * brightness, 5.f);
803 if ((effects & EF_COLOR_SHELL) && !
vid_rtx->integer) {
805 ent.flags = renderfx | RF_TRANSLUCENT | base_entity_flags;
812 ent.flags = base_entity_flags;
816 if (s1->modelindex2) {
817 if (s1->modelindex2 == 255) {
820 i = (s1->skinnum >> 8);
836 ent.flags = RF_TRANSLUCENT;
839 if ((effects & EF_COLOR_SHELL) &&
vid_rtx->integer) {
840 ent.flags |= renderfx;
846 ent.flags = base_entity_flags;
850 if (s1->modelindex3) {
855 if (s1->modelindex4) {
860 if (effects & EF_POWERSCREEN) {
864 ent.flags |= (RF_TRANSLUCENT | RF_SHELL_GREEN);
870 if (effects & ~EF_ROTATE) {
871 if (effects & EF_ROCKET) {
875 V_AddLight(ent.origin, 200, 0.6f, 0.4f, 0.12f);
876 }
else if (effects & EF_BLASTER) {
877 if (effects & EF_TRACKER) {
879 V_AddLight(ent.origin, 200, 0.1f, 0.4f, 0.12f);
882 V_AddLight(ent.origin, 200, 0.6f, 0.4f, 0.12f);
884 }
else if (effects & EF_HYPERBLASTER) {
885 if (effects & EF_TRACKER)
886 V_AddLight(ent.origin, 200, 0.1f, 0.4f, 0.12f);
888 V_AddLight(ent.origin, 200, 0.6f, 0.4f, 0.12f);
889 }
else if (effects & EF_GIB) {
891 }
else if (effects & EF_GRENADE) {
895 }
else if (effects & EF_FLIES) {
897 }
else if (effects & EF_BFG) {
898 if (effects & EF_ANIM_ALLFAST) {
903 static const int bfg_lightramp[6] = {300, 400, 600, 300, 150, 75};
905 i = s1->frame; clamp(i, 0, 5);
906 i = bfg_lightramp[i];
909 const vec3_t nvgreen = { 0.2716f, 0.5795f, 0.04615f };
910 V_AddLightEx(ent.origin, i, nvgreen[0], nvgreen[1], nvgreen[2], 20.f);
911 }
else if (effects & EF_TRAP) {
915 i = (rand() % 100) + 100;
918 }
else if (effects & EF_FLAG1) {
921 }
else if (effects & EF_FLAG2) {
924 }
else if (effects & EF_TAGTRAIL) {
927 }
else if (effects & EF_TRACKERTRAIL) {
928 if (effects & EF_TRACKER) {
937 V_AddLight(ent.origin, 155, -1.0, -1.0, -1.0);
939 }
else if (effects & EF_TRACKER) {
942 }
else if (effects & EF_GREENGIB) {
944 }
else if (effects & EF_IONRIPPER) {
947 }
else if (effects & EF_BLUEHYPERBLASTER) {
949 }
else if (effects & EF_PLASMA) {
950 if (effects & EF_ANIM_ALLFAST) {