37 typedef struct clightstyle_s {
44 static clightstyle_t cl_lightstyles[MAX_LIGHTSTYLES];
46 static int cl_lastofs;
48 void CL_ClearLightStyles(
void)
53 for (i = 0, ls = cl_lightstyles; i < MAX_LIGHTSTYLES; i++, ls++) {
54 List_Init(&ls->entry);
62 List_Init(&cl_lightlist);
71 void CL_RunLightStyles(
void)
77 if (ofs == cl_lastofs)
81 LIST_FOR_EACH(clightstyle_t, ls, &cl_lightlist, entry) {
85 ls->value[3] = ls->map[ofs % ls->length];
89 void CL_SetLightStyle(
int index,
const char *s)
94 ls = &cl_lightstyles[index];
95 ls->length = strlen(s);
96 if (ls->length > MAX_QPATH) {
97 Com_Error(ERR_DROP,
"%s: oversize style", __func__);
100 for (i = 0; i < ls->length; i++) {
101 ls->map[i] = (float)(s[i] -
'a') / (float)(
'm' -
'a');
104 if (ls->entry.prev) {
105 List_Delete(&ls->entry);
108 if (ls->length > 1) {
109 List_Append(&cl_lightlist, &ls->entry);
113 if (ls->length == 1) {
117 ls->value[3] = ls->map[0];
132 void CL_AddLightStyles(
void)
137 for (i = 0, ls = cl_lightstyles; i < MAX_LIGHTSTYLES; i++, ls++)
138 V_AddLightStyle(i, ls->value);
153 static cdlight_t cl_dlights[MAX_DLIGHTS];
155 static void CL_ClearDlights(
void)
157 memset(cl_dlights, 0,
sizeof(cl_dlights));
166 cdlight_t *CL_AllocDlight(
int key)
174 for (i = 0; i < MAX_DLIGHTS; i++, dl++) {
175 if (dl->key == key) {
176 memset(dl, 0,
sizeof(*dl));
185 for (i = 0; i < MAX_DLIGHTS; i++, dl++) {
187 memset(dl, 0,
sizeof(*dl));
194 memset(dl, 0,
sizeof(*dl));
205 void CL_RunDLights(
void)
211 for (i = 0; i < MAX_DLIGHTS; i++, dl++) {
224 VectorMA(dl->origin,
cls.
frametime, dl->velosity, dl->origin);
234 void CL_AddDLights(
void)
240 for (i = 0; i < MAX_DLIGHTS; i++, dl++) {
244 dl->color[0], dl->color[1], dl->color[2]);
265 char soundname[MAX_QPATH];
268 if (developer->integer)
269 CL_CheckEntityPresent(
mz.
entity,
"muzzleflash");
276 VectorCopy(pl->
current.origin, dl->origin);
278 VectorMA(dl->origin, 18,
fv, dl->origin);
279 VectorMA(dl->origin, 16, rv, dl->origin);
281 dl->radius = 100 + (rand() & 31);
283 dl->radius = 200 + (rand() & 31);
286 #define DL_COLOR(r, g, b) VectorSet(dl->color, r, g, b)
287 #define DL_RADIUS(r) (dl->radius = r)
288 #define DL_DIE(t) (dl->die = cl.time + t)
290 #define DL_COLOR(r, g, b)
305 case MZ_BLUEHYPERBLASTER:
309 case MZ_HYPERBLASTER:
315 Q_snprintf(soundname,
sizeof(soundname),
"weapons/machgf%ib.wav", (rand() % 5) + 1);
330 Q_snprintf(soundname,
sizeof(soundname),
"weapons/machgf%ib.wav", (rand() % 5) + 1);
337 Q_snprintf(soundname,
sizeof(soundname),
"weapons/machgf%ib.wav", (rand() % 5) + 1);
339 Q_snprintf(soundname,
sizeof(soundname),
"weapons/machgf%ib.wav", (rand() % 5) + 1);
346 Q_snprintf(soundname,
sizeof(soundname),
"weapons/machgf%ib.wav", (rand() % 5) + 1);
348 Q_snprintf(soundname,
sizeof(soundname),
"weapons/machgf%ib.wav", (rand() % 5) + 1);
350 Q_snprintf(soundname,
sizeof(soundname),
"weapons/machgf%ib.wav", (rand() % 5) + 1);
468 char soundname[MAX_QPATH];
480 VectorCopy(
origin, dl->origin);
481 dl->radius = 200 + (rand() & 31);
487 case MZ2_INFANTRY_MACHINEGUN_1:
488 case MZ2_INFANTRY_MACHINEGUN_2:
489 case MZ2_INFANTRY_MACHINEGUN_3:
490 case MZ2_INFANTRY_MACHINEGUN_4:
491 case MZ2_INFANTRY_MACHINEGUN_5:
492 case MZ2_INFANTRY_MACHINEGUN_6:
493 case MZ2_INFANTRY_MACHINEGUN_7:
494 case MZ2_INFANTRY_MACHINEGUN_8:
495 case MZ2_INFANTRY_MACHINEGUN_9:
496 case MZ2_INFANTRY_MACHINEGUN_10:
497 case MZ2_INFANTRY_MACHINEGUN_11:
498 case MZ2_INFANTRY_MACHINEGUN_12:
499 case MZ2_INFANTRY_MACHINEGUN_13:
506 case MZ2_SOLDIER_MACHINEGUN_1:
507 case MZ2_SOLDIER_MACHINEGUN_2:
508 case MZ2_SOLDIER_MACHINEGUN_3:
509 case MZ2_SOLDIER_MACHINEGUN_4:
510 case MZ2_SOLDIER_MACHINEGUN_5:
511 case MZ2_SOLDIER_MACHINEGUN_6:
512 case MZ2_SOLDIER_MACHINEGUN_7:
513 case MZ2_SOLDIER_MACHINEGUN_8:
520 case MZ2_GUNNER_MACHINEGUN_1:
521 case MZ2_GUNNER_MACHINEGUN_2:
522 case MZ2_GUNNER_MACHINEGUN_3:
523 case MZ2_GUNNER_MACHINEGUN_4:
524 case MZ2_GUNNER_MACHINEGUN_5:
525 case MZ2_GUNNER_MACHINEGUN_6:
526 case MZ2_GUNNER_MACHINEGUN_7:
527 case MZ2_GUNNER_MACHINEGUN_8:
534 case MZ2_ACTOR_MACHINEGUN_1:
535 case MZ2_SUPERTANK_MACHINEGUN_1:
536 case MZ2_SUPERTANK_MACHINEGUN_2:
537 case MZ2_SUPERTANK_MACHINEGUN_3:
538 case MZ2_SUPERTANK_MACHINEGUN_4:
539 case MZ2_SUPERTANK_MACHINEGUN_5:
540 case MZ2_SUPERTANK_MACHINEGUN_6:
541 case MZ2_TURRET_MACHINEGUN:
548 case MZ2_BOSS2_MACHINEGUN_L1:
549 case MZ2_BOSS2_MACHINEGUN_L2:
550 case MZ2_BOSS2_MACHINEGUN_L3:
551 case MZ2_BOSS2_MACHINEGUN_L4:
552 case MZ2_BOSS2_MACHINEGUN_L5:
553 case MZ2_CARRIER_MACHINEGUN_L1:
554 case MZ2_CARRIER_MACHINEGUN_L2:
561 case MZ2_SOLDIER_BLASTER_1:
562 case MZ2_SOLDIER_BLASTER_2:
563 case MZ2_SOLDIER_BLASTER_3:
564 case MZ2_SOLDIER_BLASTER_4:
565 case MZ2_SOLDIER_BLASTER_5:
566 case MZ2_SOLDIER_BLASTER_6:
567 case MZ2_SOLDIER_BLASTER_7:
568 case MZ2_SOLDIER_BLASTER_8:
569 case MZ2_TURRET_BLASTER:
574 case MZ2_FLYER_BLASTER_1:
575 case MZ2_FLYER_BLASTER_2:
580 case MZ2_MEDIC_BLASTER_1:
585 case MZ2_HOVER_BLASTER_1:
590 case MZ2_FLOAT_BLASTER_1:
595 case MZ2_SOLDIER_SHOTGUN_1:
596 case MZ2_SOLDIER_SHOTGUN_2:
597 case MZ2_SOLDIER_SHOTGUN_3:
598 case MZ2_SOLDIER_SHOTGUN_4:
599 case MZ2_SOLDIER_SHOTGUN_5:
600 case MZ2_SOLDIER_SHOTGUN_6:
601 case MZ2_SOLDIER_SHOTGUN_7:
602 case MZ2_SOLDIER_SHOTGUN_8:
608 case MZ2_TANK_BLASTER_1:
609 case MZ2_TANK_BLASTER_2:
610 case MZ2_TANK_BLASTER_3:
615 case MZ2_TANK_MACHINEGUN_1:
616 case MZ2_TANK_MACHINEGUN_2:
617 case MZ2_TANK_MACHINEGUN_3:
618 case MZ2_TANK_MACHINEGUN_4:
619 case MZ2_TANK_MACHINEGUN_5:
620 case MZ2_TANK_MACHINEGUN_6:
621 case MZ2_TANK_MACHINEGUN_7:
622 case MZ2_TANK_MACHINEGUN_8:
623 case MZ2_TANK_MACHINEGUN_9:
624 case MZ2_TANK_MACHINEGUN_10:
625 case MZ2_TANK_MACHINEGUN_11:
626 case MZ2_TANK_MACHINEGUN_12:
627 case MZ2_TANK_MACHINEGUN_13:
628 case MZ2_TANK_MACHINEGUN_14:
629 case MZ2_TANK_MACHINEGUN_15:
630 case MZ2_TANK_MACHINEGUN_16:
631 case MZ2_TANK_MACHINEGUN_17:
632 case MZ2_TANK_MACHINEGUN_18:
633 case MZ2_TANK_MACHINEGUN_19:
637 Q_snprintf(soundname,
sizeof(soundname),
"tank/tnkatk2%c.wav",
'a' + rand() % 5);
641 case MZ2_CHICK_ROCKET_1:
642 case MZ2_TURRET_ROCKET:
647 case MZ2_TANK_ROCKET_1:
648 case MZ2_TANK_ROCKET_2:
649 case MZ2_TANK_ROCKET_3:
654 case MZ2_SUPERTANK_ROCKET_1:
655 case MZ2_SUPERTANK_ROCKET_2:
656 case MZ2_SUPERTANK_ROCKET_3:
657 case MZ2_BOSS2_ROCKET_1:
658 case MZ2_BOSS2_ROCKET_2:
659 case MZ2_BOSS2_ROCKET_3:
660 case MZ2_BOSS2_ROCKET_4:
661 case MZ2_CARRIER_ROCKET_1:
669 case MZ2_GUNNER_GRENADE_1:
670 case MZ2_GUNNER_GRENADE_2:
671 case MZ2_GUNNER_GRENADE_3:
672 case MZ2_GUNNER_GRENADE_4:
677 case MZ2_GLADIATOR_RAILGUN_1:
678 case MZ2_CARRIER_RAILGUN:
688 case MZ2_MAKRON_BLASTER_1:
689 case MZ2_MAKRON_BLASTER_2:
690 case MZ2_MAKRON_BLASTER_3:
691 case MZ2_MAKRON_BLASTER_4:
692 case MZ2_MAKRON_BLASTER_5:
693 case MZ2_MAKRON_BLASTER_6:
694 case MZ2_MAKRON_BLASTER_7:
695 case MZ2_MAKRON_BLASTER_8:
696 case MZ2_MAKRON_BLASTER_9:
697 case MZ2_MAKRON_BLASTER_10:
698 case MZ2_MAKRON_BLASTER_11:
699 case MZ2_MAKRON_BLASTER_12:
700 case MZ2_MAKRON_BLASTER_13:
701 case MZ2_MAKRON_BLASTER_14:
702 case MZ2_MAKRON_BLASTER_15:
703 case MZ2_MAKRON_BLASTER_16:
704 case MZ2_MAKRON_BLASTER_17:
709 case MZ2_JORG_MACHINEGUN_L1:
710 case MZ2_JORG_MACHINEGUN_L2:
711 case MZ2_JORG_MACHINEGUN_L3:
712 case MZ2_JORG_MACHINEGUN_L4:
713 case MZ2_JORG_MACHINEGUN_L5:
714 case MZ2_JORG_MACHINEGUN_L6:
721 case MZ2_JORG_MACHINEGUN_R1:
722 case MZ2_JORG_MACHINEGUN_R2:
723 case MZ2_JORG_MACHINEGUN_R3:
724 case MZ2_JORG_MACHINEGUN_R4:
725 case MZ2_JORG_MACHINEGUN_R5:
726 case MZ2_JORG_MACHINEGUN_R6:
736 case MZ2_BOSS2_MACHINEGUN_R1:
737 case MZ2_BOSS2_MACHINEGUN_R2:
738 case MZ2_BOSS2_MACHINEGUN_R3:
739 case MZ2_BOSS2_MACHINEGUN_R4:
740 case MZ2_BOSS2_MACHINEGUN_R5:
741 case MZ2_CARRIER_MACHINEGUN_R1:
742 case MZ2_CARRIER_MACHINEGUN_R2:
748 case MZ2_STALKER_BLASTER:
749 case MZ2_DAEDALUS_BLASTER:
750 case MZ2_MEDIC_BLASTER_2:
751 case MZ2_WIDOW_BLASTER:
752 case MZ2_WIDOW_BLASTER_SWEEP1:
753 case MZ2_WIDOW_BLASTER_SWEEP2:
754 case MZ2_WIDOW_BLASTER_SWEEP3:
755 case MZ2_WIDOW_BLASTER_SWEEP4:
756 case MZ2_WIDOW_BLASTER_SWEEP5:
757 case MZ2_WIDOW_BLASTER_SWEEP6:
758 case MZ2_WIDOW_BLASTER_SWEEP7:
759 case MZ2_WIDOW_BLASTER_SWEEP8:
760 case MZ2_WIDOW_BLASTER_SWEEP9:
761 case MZ2_WIDOW_BLASTER_100:
762 case MZ2_WIDOW_BLASTER_90:
763 case MZ2_WIDOW_BLASTER_80:
764 case MZ2_WIDOW_BLASTER_70:
765 case MZ2_WIDOW_BLASTER_60:
766 case MZ2_WIDOW_BLASTER_50:
767 case MZ2_WIDOW_BLASTER_40:
768 case MZ2_WIDOW_BLASTER_30:
769 case MZ2_WIDOW_BLASTER_20:
770 case MZ2_WIDOW_BLASTER_10:
771 case MZ2_WIDOW_BLASTER_0:
772 case MZ2_WIDOW_BLASTER_10L:
773 case MZ2_WIDOW_BLASTER_20L:
774 case MZ2_WIDOW_BLASTER_30L:
775 case MZ2_WIDOW_BLASTER_40L:
776 case MZ2_WIDOW_BLASTER_50L:
777 case MZ2_WIDOW_BLASTER_60L:
778 case MZ2_WIDOW_BLASTER_70L:
779 case MZ2_WIDOW_RUN_1:
780 case MZ2_WIDOW_RUN_2:
781 case MZ2_WIDOW_RUN_3:
782 case MZ2_WIDOW_RUN_4:
783 case MZ2_WIDOW_RUN_5:
784 case MZ2_WIDOW_RUN_6:
785 case MZ2_WIDOW_RUN_7:
786 case MZ2_WIDOW_RUN_8:
791 case MZ2_WIDOW_DISRUPTOR:
796 case MZ2_WIDOW_PLASMABEAM:
797 case MZ2_WIDOW2_BEAMER_1:
798 case MZ2_WIDOW2_BEAMER_2:
799 case MZ2_WIDOW2_BEAMER_3:
800 case MZ2_WIDOW2_BEAMER_4:
801 case MZ2_WIDOW2_BEAMER_5:
802 case MZ2_WIDOW2_BEAM_SWEEP_1:
803 case MZ2_WIDOW2_BEAM_SWEEP_2:
804 case MZ2_WIDOW2_BEAM_SWEEP_3:
805 case MZ2_WIDOW2_BEAM_SWEEP_4:
806 case MZ2_WIDOW2_BEAM_SWEEP_5:
807 case MZ2_WIDOW2_BEAM_SWEEP_6:
808 case MZ2_WIDOW2_BEAM_SWEEP_7:
809 case MZ2_WIDOW2_BEAM_SWEEP_8:
810 case MZ2_WIDOW2_BEAM_SWEEP_9:
811 case MZ2_WIDOW2_BEAM_SWEEP_10:
812 case MZ2_WIDOW2_BEAM_SWEEP_11:
880 VectorSet(oy, 0.0f, 1.0f, 0.0f);
881 if (fabs(DotProduct(oy, dir)) > 0.95f)
882 VectorSet(oy, 1.0f, 0.0f, 0.0f);
885 CrossProduct(oy, dir, ox);
888 const int spark_count = count / 10;
890 const float dirt_horizontal_spread = 2.0f;
891 const float dirt_vertical_spread = 1.0f;
892 const float dirt_base_velocity = 40.0f;
893 const float dirt_rand_velocity = 70.0f;
895 const float spark_horizontal_spread = 1.0f;
896 const float spark_vertical_spread = 1.0f;
897 const float spark_base_velocity = 50.0f;
898 const float spark_rand_velocity = 130.0f;
900 for (
int i = 0; i < count; i++) {
912 VectorMA(
origin, dirt_horizontal_spread * crand(), ox,
origin);
913 VectorMA(
origin, dirt_horizontal_spread * crand(), oy,
origin);
914 VectorMA(
origin, dirt_vertical_spread * frand() + 1.0f, dir,
origin);
918 VectorSubtract(
origin, org, velocity);
920 VectorScale(velocity, dirt_base_velocity + frand() * dirt_rand_velocity, p->
vel);
926 p->
alphavel = -1.0 / (0.5 + frand() * 0.3);
929 for (
int i = 0; i < spark_count; i++) {
936 p->
color = 0xe0 + (rand() & 7);
941 VectorMA(
origin, spark_horizontal_spread * crand(), ox,
origin);
942 VectorMA(
origin, spark_horizontal_spread * crand(), oy,
origin);
943 VectorMA(
origin, spark_vertical_spread * frand() + 1.0f, dir,
origin);
947 VectorSubtract(
origin, org, velocity);
949 VectorScale(velocity, spark_base_velocity + powf(frand(), 2.0f) * spark_rand_velocity, p->
vel);
955 p->
alphavel = -2.0 / (0.5 + frand() * 0.3);
962 VectorSet(oy, 0.0f, 1.0f, 0.0f);
963 if (fabs(DotProduct(oy, dir)) > 0.95f)
964 VectorSet(oy, 1.0f, 0.0f, 0.0f);
967 CrossProduct(oy, dir, ox);
971 const float water_horizontal_spread = 0.25f;
972 const float water_vertical_spread = 1.0f;
973 const float water_base_velocity = 80.0f;
974 const float water_rand_velocity = 150.0f;
976 for (
int i = 0; i < count; i++) {
988 VectorMA(
origin, water_horizontal_spread * crand(), ox,
origin);
989 VectorMA(
origin, water_horizontal_spread * crand(), oy,
origin);
990 VectorMA(
origin, water_vertical_spread * frand() + 1.0f, dir,
origin);
994 VectorSubtract(
origin, org, velocity);
996 VectorScale(velocity, water_base_velocity + frand() * water_rand_velocity, p->
vel);
1002 p->
alphavel = -1.0 / (0.5 + frand() * 0.3);
1014 .pos = {org[0],org[1],org[2]},
1015 .dir = {dir[0],dir[1],dir[2]},
1020 float a[3] = {dir[1], -dir[2], dir[0]};
1021 float b[3] = {-dir[2], dir[0], dir[1]};
1025 for (i = 0; i < count; i++) {
1035 d = (rand() & 31) * 10.0f;
1036 for (j = 0; j < 3; j++) {
1037 p->
org[j] = org[j] + ((rand() & 7) - 4) + d * (dir[j]
1038 + a[j] * 0.5f*((rand() & 31) / 32.0f - .5f)
1039 + b[j] * 0.5f*((rand() & 31) / 32.0f - .5f));
1041 p->
vel[j] = 10.0f*dir[j] + crand() * 20;
1044 p->
org[2] -= d*d * .001f;
1050 p->
alphavel = -1.0 / (0.5 + frand() * 0.3);
1068 for (i = 0; i < count; i++) {
1079 for (j = 0; j < 3; j++) {
1080 p->
org[j] = org[j] + ((rand() & 7) - 4) + d * dir[j];
1081 p->
vel[j] = crand() * 20;
1088 p->
alphavel = -1.0 / (0.5 + frand() * 0.3);
1105 for (i = 0; i < count; i++) {
1115 for (j = 0; j < 2; j++) {
1116 p->
org[j] = org[j] - 16 + (rand() & 31);
1117 p->
vel[j] = crand() * 14;
1120 p->
org[2] = org[2] - 8 + (rand() & 7);
1121 p->
vel[2] = 80 + (rand() & 7);
1143 for (i = 0; i < 500; i++) {
1151 if (type == MZ_LOGIN)
1152 color = 0xd0 + (rand() & 7);
1153 else if (type == MZ_LOGOUT)
1154 color = 0x40 + (rand() & 7);
1156 color = 0xe0 + (rand() & 7);
1161 p->
org[0] = org[0] - 16 + frand() * 32;
1162 p->
org[1] = org[1] - 16 + frand() * 32;
1163 p->
org[2] = org[2] - 24 + frand() * 56;
1165 for (j = 0; j < 3; j++)
1166 p->
vel[j] = crand() * 20;
1172 p->
alphavel = -1.0 / (1.0 + frand() * 0.3);
1190 for (i = 0; i < count; i++) {
1197 p->
color = 0xd4 + (rand() & 3);
1200 p->
org[0] = org[0] + crand() * 8;
1201 p->
org[1] = org[1] + crand() * 8;
1202 p->
org[2] = org[2] + crand() * 8;
1204 for (j = 0; j < 3; j++)
1205 p->
vel[j] = crand() * 8;
1211 p->
alphavel = -1.0 / (1.0 + frand() * 0.3);
1228 for (i = 0; i < count; i++) {
1235 p->
color = 0xe0 + (rand() & 7);
1238 for (j = 0; j < 3; j++) {
1239 p->
org[j] = org[j] + ((rand() % 32) - 16);
1240 p->
vel[j] = (rand() % 384) - 192;
1247 p->
alphavel = -0.8 / (0.5 + frand() * 0.3);
1258 static const byte colortable[4] = {2 * 8, 13 * 8, 21 * 8, 18 * 8};
1263 for (i = 0; i < 4096; i++) {
1270 p->
color = colortable[rand() & 3];
1273 angle = M_PI * 2 * (rand() & 1023) / 1023.0;
1275 p->
org[0] = org[0] + cos(angle) * dist;
1276 p->
vel[0] = cos(angle) * (70 + (rand() & 63));
1277 p->
accel[0] = -cos(angle) * 100;
1279 p->
org[1] = org[1] + sin(angle) * dist;
1280 p->
vel[1] = sin(angle) * (70 + (rand() & 63));
1281 p->
accel[1] = -sin(angle) * 100;
1283 p->
org[2] = org[2] + 8 + (rand() % 90);
1284 p->
vel[2] = -100 + (rand() & 31);
1288 p->
alphavel = -0.3 / (0.5 + frand() * 0.3);
1308 for (i = 0; i < count; i++) {
1315 p->
color = 0xe0 + (rand() & 7);
1319 for (j = 0; j < 3; j++) {
1320 p->
org[j] = org[j] + ((rand() & 7) - 4) + d * dir[j];
1321 p->
vel[j] = dir[j] * 30 + crand() * 40;
1328 p->
alphavel = -1.0 / (0.5 + frand() * 0.3);
1348 VectorCopy(start, move);
1349 VectorSubtract(end, start, vec);
1353 VectorScale(vec, 5, vec);
1362 VectorClear(p->
accel);
1367 p->
alphavel = -1.0 / (0.3 + frand() * 0.2);
1372 for (j = 0; j < 3; j++) {
1373 p->
org[j] = move[j] + crand();
1374 p->
vel[j] = crand() * 5;
1378 VectorAdd(move, vec, move);
1397 VectorCopy(start, move);
1398 VectorSubtract(end, start, vec);
1402 VectorScale(vec, 5, vec);
1410 VectorClear(p->
accel);
1415 p->
alphavel = -1.0 / (0.8 + frand() * 0.2);
1420 for (j = 0; j < 3; j++) {
1421 p->
org[j] = move[j] + crand() * 16;
1422 p->
vel[j] = crand() * 5;
1426 VectorAdd(move, vec, move);
1445 VectorCopy(start, move);
1446 VectorSubtract(end, start, vec);
1450 VectorScale(vec, 5, vec);
1458 VectorClear(p->
accel);
1463 p->
alphavel = -1.0 / (0.8 + frand() * 0.2);
1468 for (j = 0; j < 3; j++) {
1469 p->
org[j] = move[j] + crand() * 16;
1470 p->
vel[j] = crand() * 5;
1474 VectorAdd(move, vec, move);
1495 VectorCopy(start, move);
1496 VectorSubtract(end, start, vec);
1500 VectorScale(vec, dec, vec);
1521 VectorClear(p->
accel);
1525 if (flags & EF_GIB) {
1527 p->
alphavel = -1.0 / (1 + frand() * 0.4);
1529 p->
color = 0xe8 + (rand() & 7);
1532 for (j = 0; j < 3; j++) {
1533 p->
org[j] = move[j] + crand() * orgscale;
1534 p->
vel[j] = crand() * velscale;
1538 }
else if (flags & EF_GREENGIB) {
1540 p->
alphavel = -1.0 / (1 + frand() * 0.4);
1542 p->
color = 0xdb + (rand() & 7);
1545 for (j = 0; j < 3; j++) {
1546 p->
org[j] = move[j] + crand() * orgscale;
1547 p->
vel[j] = crand() * velscale;
1553 p->
alphavel = -1.0 / (1 + frand() * 0.2);
1555 p->
color = 4 + (rand() & 7);
1558 for (j = 0; j < 3; j++) {
1559 p->
org[j] = move[j] + crand() * orgscale;
1560 p->
vel[j] = crand() * velscale;
1569 VectorAdd(move, vec, move);
1592 VectorCopy(start, move);
1593 VectorSubtract(end, start, vec);
1597 VectorScale(vec, dec, vec);
1602 if ((rand() & 7) == 0) {
1607 VectorClear(p->
accel);
1611 p->
alphavel = -1.0 / (1 + frand() * 0.2);
1613 p->
color = 0xdc + (rand() & 3);
1616 for (j = 0; j < 3; j++) {
1617 p->
org[j] = move[j] + crand() * 5;
1618 p->
vel[j] = crand() * 20;
1622 VectorAdd(move, vec, move);
1646 VectorCopy(
te.
pos1, move);
1650 MakeNormalVectors(vec,
right,
up);
1652 for (i = 0; i < len; i++) {
1658 VectorClear(p->
accel);
1664 VectorScale(
right,
c, dir);
1665 VectorMA(dir, s,
up, dir);
1668 p->
alphavel = -1.0 / (1 + frand() * 0.2);
1670 p->
color = clr + (rand() & 7);
1673 for (j = 0; j < 3; j++) {
1674 p->
org[j] = move[j] + dir[j] * 3;
1675 p->
vel[j] = dir[j] * 6;
1678 VectorAdd(move, vec, move);
1682 VectorScale(vec, dec, vec);
1683 VectorCopy(
te.
pos1, move);
1693 VectorClear(p->
accel);
1696 p->
alphavel = -1.0 / (0.6 + frand() * 0.2);
1698 p->
color = rand() & 15;
1701 for (j = 0; j < 3; j++) {
1702 p->
org[j] = move[j] + crand() * 3;
1703 p->
vel[j] = crand() * 3;
1707 VectorAdd(move, vec, move);
1727 VectorCopy(start, move);
1728 VectorSubtract(end, start, vec);
1732 VectorScale(vec, dec, vec);
1734 for (i = 0; i < len; i += dec) {
1739 VectorClear(p->
accel);
1743 p->
alphavel = -1.0 / (1 + frand() * 0.2);
1745 p->
color = 4 + (rand() & 7);
1748 for (j = 0; j < 3; j++) {
1749 p->
org[j] = move[j] + crand() * 2;
1750 p->
vel[j] = crand() * 5;
1754 VectorAdd(move, vec, move);
1765 #define BEAMLENGTH 16
1772 float sp, sy, cp, cy;
1777 if (count > NUMVERTEXNORMALS)
1778 count = NUMVERTEXNORMALS;
1780 ltime = (float)
cl.
time / 1000.0;
1781 for (i = 0; i < count; i += 2) {
1799 dist = sin(ltime + i) * 64;
1804 VectorClear(p->
vel);
1805 VectorClear(p->
accel);
1830 count = n * 162 / 20000.0;
1834 count = n * 162 / 20000.0;
1852 float sp, sy, cp, cy;
1860 ltime = (float)
cl.
time / 1000.0;
1861 for (i = 0; i < count; i++) {
1879 dist = sin(ltime + i) * 64;
1884 VectorClear(p->
vel);
1885 VectorClear(p->
accel);
1887 VectorSubtract(p->
org, ent->origin, v);
1888 dist = VectorLength(v) / 90.0;
1890 p->
color = floor(0xd0 + dist * 7);
1893 p->
alpha = 1.0 - dist;
1912 for (i = 0; i < count; i++) {
1919 p->
color = 0xd0 + (rand() & 7);
1922 for (j = 0; j < 3; j++) {
1923 p->
org[j] = org[j] + ((rand() % 32) - 16);
1924 p->
vel[j] = (rand() % 384) - 192;
1931 p->
alphavel = -0.8 / (0.5 + frand() * 0.3);
1949 for (i = -16; i <= 16; i += 4)
1950 for (j = -16; j <= 16; j += 4)
1951 for (k = -16; k <= 32; k += 4) {
1958 p->
color = 7 + (rand() & 7);
1962 p->
alphavel = -1.0 / (0.3 + (rand() & 7) * 0.02);
1964 p->
org[0] = org[0] + i + (rand() & 3);
1965 p->
org[1] = org[1] + j + (rand() & 3);
1966 p->
org[2] = org[2] + k + (rand() & 3);
1973 vel = 50 + (rand() & 63);
1974 VectorScale(dir, vel, p->
vel);
1993 float time = 0, time2;
2033 time2 = time * time;
2035 part->origin[0] = p->
org[0] + p->
vel[0] * time + p->
accel[0] * time2;
2036 part->origin[1] = p->
org[1] + p->
vel[1] * time + p->
accel[1] * time2;
2037 part->origin[2] = p->
org[2] + p->
vel[2] * time + p->
accel[2] * time2;
2040 part->rgba.u8[0] = p->
rgba.u8[0];
2041 part->rgba.u8[1] = p->
rgba.u8[1];
2042 part->rgba.u8[2] = p->
rgba.u8[2];
2043 part->rgba.u8[3] = p->
rgba.u8[3] * alpha;
2046 part->color =
color;
2048 part->alpha = alpha;
2079 for (i = 0; i < NUMVERTEXNORMALS; i++)
2080 for (j = 0; j < 3; j++)