r_part.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801
  1. /*
  2. Copyright (C) 1996-1997 Id Software, Inc.
  3. This program is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU General Public License
  5. as published by the Free Software Foundation; either version 2
  6. of the License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. See the GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. */
  15. #include "quakedef.h"
  16. #include "r_local.h"
  17. #define MAX_PARTICLES 2048 // default max # of particles at one
  18. // time
  19. #define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter what's
  20. // on the command line
  21. int ramp1[8] = {0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61};
  22. int ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66};
  23. int ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3};
  24. particle_t *active_particles, *free_particles;
  25. particle_t *particles;
  26. int r_numparticles;
  27. vec3_t r_pright, r_pup, r_ppn;
  28. /*
  29. ===============
  30. R_InitParticles
  31. ===============
  32. */
  33. void R_InitParticles (void)
  34. {
  35. int i;
  36. i = COM_CheckParm ("-particles");
  37. if (i)
  38. {
  39. r_numparticles = (int)(Q_atoi(com_argv[i+1]));
  40. if (r_numparticles < ABSOLUTE_MIN_PARTICLES)
  41. r_numparticles = ABSOLUTE_MIN_PARTICLES;
  42. }
  43. else
  44. {
  45. r_numparticles = MAX_PARTICLES;
  46. }
  47. particles = (particle_t *)
  48. Hunk_AllocName (r_numparticles * sizeof(particle_t), "particles");
  49. }
  50. #ifdef QUAKE2
  51. void R_DarkFieldParticles (entity_t *ent)
  52. {
  53. int i, j, k;
  54. particle_t *p;
  55. float vel;
  56. vec3_t dir;
  57. vec3_t org;
  58. org[0] = ent->origin[0];
  59. org[1] = ent->origin[1];
  60. org[2] = ent->origin[2];
  61. for (i=-16 ; i<16 ; i+=8)
  62. for (j=-16 ; j<16 ; j+=8)
  63. for (k=0 ; k<32 ; k+=8)
  64. {
  65. if (!free_particles)
  66. return;
  67. p = free_particles;
  68. free_particles = p->next;
  69. p->next = active_particles;
  70. active_particles = p;
  71. p->die = cl.time + 0.2 + (rand()&7) * 0.02;
  72. p->color = 150 + rand()%6;
  73. p->type = pt_slowgrav;
  74. dir[0] = j*8;
  75. dir[1] = i*8;
  76. dir[2] = k*8;
  77. p->org[0] = org[0] + i + (rand()&3);
  78. p->org[1] = org[1] + j + (rand()&3);
  79. p->org[2] = org[2] + k + (rand()&3);
  80. VectorNormalize (dir);
  81. vel = 50 + (rand()&63);
  82. VectorScale (dir, vel, p->vel);
  83. }
  84. }
  85. #endif
  86. /*
  87. ===============
  88. R_EntityParticles
  89. ===============
  90. */
  91. #define NUMVERTEXNORMALS 162
  92. extern float r_avertexnormals[NUMVERTEXNORMALS][3];
  93. vec3_t avelocities[NUMVERTEXNORMALS];
  94. float beamlength = 16;
  95. vec3_t avelocity = {23, 7, 3};
  96. float partstep = 0.01;
  97. float timescale = 0.01;
  98. void R_EntityParticles (entity_t *ent)
  99. {
  100. int count;
  101. int i;
  102. particle_t *p;
  103. float angle;
  104. float sr, sp, sy, cr, cp, cy;
  105. vec3_t forward;
  106. float dist;
  107. dist = 64;
  108. count = 50;
  109. if (!avelocities[0][0])
  110. {
  111. for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++)
  112. avelocities[0][i] = (rand()&255) * 0.01;
  113. }
  114. for (i=0 ; i<NUMVERTEXNORMALS ; i++)
  115. {
  116. angle = cl.time * avelocities[i][0];
  117. sy = sin(angle);
  118. cy = cos(angle);
  119. angle = cl.time * avelocities[i][1];
  120. sp = sin(angle);
  121. cp = cos(angle);
  122. angle = cl.time * avelocities[i][2];
  123. sr = sin(angle);
  124. cr = cos(angle);
  125. forward[0] = cp*cy;
  126. forward[1] = cp*sy;
  127. forward[2] = -sp;
  128. if (!free_particles)
  129. return;
  130. p = free_particles;
  131. free_particles = p->next;
  132. p->next = active_particles;
  133. active_particles = p;
  134. p->die = cl.time + 0.01;
  135. p->color = 0x6f;
  136. p->type = pt_explode;
  137. p->org[0] = ent->origin[0] + r_avertexnormals[i][0]*dist + forward[0]*beamlength;
  138. p->org[1] = ent->origin[1] + r_avertexnormals[i][1]*dist + forward[1]*beamlength;
  139. p->org[2] = ent->origin[2] + r_avertexnormals[i][2]*dist + forward[2]*beamlength;
  140. }
  141. }
  142. /*
  143. ===============
  144. R_ClearParticles
  145. ===============
  146. */
  147. void R_ClearParticles (void)
  148. {
  149. int i;
  150. free_particles = &particles[0];
  151. active_particles = NULL;
  152. for (i=0 ;i<r_numparticles ; i++)
  153. particles[i].next = &particles[i+1];
  154. particles[r_numparticles-1].next = NULL;
  155. }
  156. void R_ReadPointFile_f (void)
  157. {
  158. FILE *f;
  159. vec3_t org;
  160. int r;
  161. int c;
  162. particle_t *p;
  163. char name[MAX_OSPATH];
  164. sprintf (name,"maps/%s.pts", sv.name);
  165. COM_FOpenFile (name, &f);
  166. if (!f)
  167. {
  168. Con_Printf ("couldn't open %s\n", name);
  169. return;
  170. }
  171. Con_Printf ("Reading %s...\n", name);
  172. c = 0;
  173. for ( ;; )
  174. {
  175. r = fscanf (f,"%f %f %f\n", &org[0], &org[1], &org[2]);
  176. if (r != 3)
  177. break;
  178. c++;
  179. if (!free_particles)
  180. {
  181. Con_Printf ("Not enough free particles\n");
  182. break;
  183. }
  184. p = free_particles;
  185. free_particles = p->next;
  186. p->next = active_particles;
  187. active_particles = p;
  188. p->die = 99999;
  189. p->color = (-c)&15;
  190. p->type = pt_static;
  191. VectorCopy (vec3_origin, p->vel);
  192. VectorCopy (org, p->org);
  193. }
  194. fclose (f);
  195. Con_Printf ("%i points read\n", c);
  196. }
  197. /*
  198. ===============
  199. R_ParseParticleEffect
  200. Parse an effect out of the server message
  201. ===============
  202. */
  203. void R_ParseParticleEffect (void)
  204. {
  205. vec3_t org, dir;
  206. int i, count, msgcount, color;
  207. for (i=0 ; i<3 ; i++)
  208. org[i] = MSG_ReadCoord ();
  209. for (i=0 ; i<3 ; i++)
  210. dir[i] = MSG_ReadChar () * (1.0/16);
  211. msgcount = MSG_ReadByte ();
  212. color = MSG_ReadByte ();
  213. if (msgcount == 255)
  214. count = 1024;
  215. else
  216. count = msgcount;
  217. R_RunParticleEffect (org, dir, color, count);
  218. }
  219. /*
  220. ===============
  221. R_ParticleExplosion
  222. ===============
  223. */
  224. void R_ParticleExplosion (vec3_t org)
  225. {
  226. int i, j;
  227. particle_t *p;
  228. for (i=0 ; i<1024 ; i++)
  229. {
  230. if (!free_particles)
  231. return;
  232. p = free_particles;
  233. free_particles = p->next;
  234. p->next = active_particles;
  235. active_particles = p;
  236. p->die = cl.time + 5;
  237. p->color = ramp1[0];
  238. p->ramp = rand()&3;
  239. if (i & 1)
  240. {
  241. p->type = pt_explode;
  242. for (j=0 ; j<3 ; j++)
  243. {
  244. p->org[j] = org[j] + ((rand()%32)-16);
  245. p->vel[j] = (rand()%512)-256;
  246. }
  247. }
  248. else
  249. {
  250. p->type = pt_explode2;
  251. for (j=0 ; j<3 ; j++)
  252. {
  253. p->org[j] = org[j] + ((rand()%32)-16);
  254. p->vel[j] = (rand()%512)-256;
  255. }
  256. }
  257. }
  258. }
  259. /*
  260. ===============
  261. R_ParticleExplosion2
  262. ===============
  263. */
  264. void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
  265. {
  266. int i, j;
  267. particle_t *p;
  268. int colorMod = 0;
  269. for (i=0; i<512; i++)
  270. {
  271. if (!free_particles)
  272. return;
  273. p = free_particles;
  274. free_particles = p->next;
  275. p->next = active_particles;
  276. active_particles = p;
  277. p->die = cl.time + 0.3;
  278. p->color = colorStart + (colorMod % colorLength);
  279. colorMod++;
  280. p->type = pt_blob;
  281. for (j=0 ; j<3 ; j++)
  282. {
  283. p->org[j] = org[j] + ((rand()%32)-16);
  284. p->vel[j] = (rand()%512)-256;
  285. }
  286. }
  287. }
  288. /*
  289. ===============
  290. R_BlobExplosion
  291. ===============
  292. */
  293. void R_BlobExplosion (vec3_t org)
  294. {
  295. int i, j;
  296. particle_t *p;
  297. for (i=0 ; i<1024 ; i++)
  298. {
  299. if (!free_particles)
  300. return;
  301. p = free_particles;
  302. free_particles = p->next;
  303. p->next = active_particles;
  304. active_particles = p;
  305. p->die = cl.time + 1 + (rand()&8)*0.05;
  306. if (i & 1)
  307. {
  308. p->type = pt_blob;
  309. p->color = 66 + rand()%6;
  310. for (j=0 ; j<3 ; j++)
  311. {
  312. p->org[j] = org[j] + ((rand()%32)-16);
  313. p->vel[j] = (rand()%512)-256;
  314. }
  315. }
  316. else
  317. {
  318. p->type = pt_blob2;
  319. p->color = 150 + rand()%6;
  320. for (j=0 ; j<3 ; j++)
  321. {
  322. p->org[j] = org[j] + ((rand()%32)-16);
  323. p->vel[j] = (rand()%512)-256;
  324. }
  325. }
  326. }
  327. }
  328. /*
  329. ===============
  330. R_RunParticleEffect
  331. ===============
  332. */
  333. void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
  334. {
  335. int i, j;
  336. particle_t *p;
  337. for (i=0 ; i<count ; i++)
  338. {
  339. if (!free_particles)
  340. return;
  341. p = free_particles;
  342. free_particles = p->next;
  343. p->next = active_particles;
  344. active_particles = p;
  345. if (count == 1024)
  346. { // rocket explosion
  347. p->die = cl.time + 5;
  348. p->color = ramp1[0];
  349. p->ramp = rand()&3;
  350. if (i & 1)
  351. {
  352. p->type = pt_explode;
  353. for (j=0 ; j<3 ; j++)
  354. {
  355. p->org[j] = org[j] + ((rand()%32)-16);
  356. p->vel[j] = (rand()%512)-256;
  357. }
  358. }
  359. else
  360. {
  361. p->type = pt_explode2;
  362. for (j=0 ; j<3 ; j++)
  363. {
  364. p->org[j] = org[j] + ((rand()%32)-16);
  365. p->vel[j] = (rand()%512)-256;
  366. }
  367. }
  368. }
  369. else
  370. {
  371. p->die = cl.time + 0.1*(rand()%5);
  372. p->color = (color&~7) + (rand()&7);
  373. p->type = pt_slowgrav;
  374. for (j=0 ; j<3 ; j++)
  375. {
  376. p->org[j] = org[j] + ((rand()&15)-8);
  377. p->vel[j] = dir[j]*15;// + (rand()%300)-150;
  378. }
  379. }
  380. }
  381. }
  382. /*
  383. ===============
  384. R_LavaSplash
  385. ===============
  386. */
  387. void R_LavaSplash (vec3_t org)
  388. {
  389. int i, j, k;
  390. particle_t *p;
  391. float vel;
  392. vec3_t dir;
  393. for (i=-16 ; i<16 ; i++)
  394. for (j=-16 ; j<16 ; j++)
  395. for (k=0 ; k<1 ; k++)
  396. {
  397. if (!free_particles)
  398. return;
  399. p = free_particles;
  400. free_particles = p->next;
  401. p->next = active_particles;
  402. active_particles = p;
  403. p->die = cl.time + 2 + (rand()&31) * 0.02;
  404. p->color = 224 + (rand()&7);
  405. p->type = pt_slowgrav;
  406. dir[0] = j*8 + (rand()&7);
  407. dir[1] = i*8 + (rand()&7);
  408. dir[2] = 256;
  409. p->org[0] = org[0] + dir[0];
  410. p->org[1] = org[1] + dir[1];
  411. p->org[2] = org[2] + (rand()&63);
  412. VectorNormalize (dir);
  413. vel = 50 + (rand()&63);
  414. VectorScale (dir, vel, p->vel);
  415. }
  416. }
  417. /*
  418. ===============
  419. R_TeleportSplash
  420. ===============
  421. */
  422. void R_TeleportSplash (vec3_t org)
  423. {
  424. int i, j, k;
  425. particle_t *p;
  426. float vel;
  427. vec3_t dir;
  428. for (i=-16 ; i<16 ; i+=4)
  429. for (j=-16 ; j<16 ; j+=4)
  430. for (k=-24 ; k<32 ; k+=4)
  431. {
  432. if (!free_particles)
  433. return;
  434. p = free_particles;
  435. free_particles = p->next;
  436. p->next = active_particles;
  437. active_particles = p;
  438. p->die = cl.time + 0.2 + (rand()&7) * 0.02;
  439. p->color = 7 + (rand()&7);
  440. p->type = pt_slowgrav;
  441. dir[0] = j*8;
  442. dir[1] = i*8;
  443. dir[2] = k*8;
  444. p->org[0] = org[0] + i + (rand()&3);
  445. p->org[1] = org[1] + j + (rand()&3);
  446. p->org[2] = org[2] + k + (rand()&3);
  447. VectorNormalize (dir);
  448. vel = 50 + (rand()&63);
  449. VectorScale (dir, vel, p->vel);
  450. }
  451. }
  452. void R_RocketTrail (vec3_t start, vec3_t end, int type)
  453. {
  454. vec3_t vec;
  455. float len;
  456. int j;
  457. particle_t *p;
  458. int dec;
  459. static int tracercount;
  460. VectorSubtract (end, start, vec);
  461. len = VectorNormalize (vec);
  462. if (type < 128)
  463. dec = 3;
  464. else
  465. {
  466. dec = 1;
  467. type -= 128;
  468. }
  469. while (len > 0)
  470. {
  471. len -= dec;
  472. if (!free_particles)
  473. return;
  474. p = free_particles;
  475. free_particles = p->next;
  476. p->next = active_particles;
  477. active_particles = p;
  478. VectorCopy (vec3_origin, p->vel);
  479. p->die = cl.time + 2;
  480. switch (type)
  481. {
  482. case 0: // rocket trail
  483. p->ramp = (rand()&3);
  484. p->color = ramp3[(int)p->ramp];
  485. p->type = pt_fire;
  486. for (j=0 ; j<3 ; j++)
  487. p->org[j] = start[j] + ((rand()%6)-3);
  488. break;
  489. case 1: // smoke smoke
  490. p->ramp = (rand()&3) + 2;
  491. p->color = ramp3[(int)p->ramp];
  492. p->type = pt_fire;
  493. for (j=0 ; j<3 ; j++)
  494. p->org[j] = start[j] + ((rand()%6)-3);
  495. break;
  496. case 2: // blood
  497. p->type = pt_grav;
  498. p->color = 67 + (rand()&3);
  499. for (j=0 ; j<3 ; j++)
  500. p->org[j] = start[j] + ((rand()%6)-3);
  501. break;
  502. case 3:
  503. case 5: // tracer
  504. p->die = cl.time + 0.5;
  505. p->type = pt_static;
  506. if (type == 3)
  507. p->color = 52 + ((tracercount&4)<<1);
  508. else
  509. p->color = 230 + ((tracercount&4)<<1);
  510. tracercount++;
  511. VectorCopy (start, p->org);
  512. if (tracercount & 1)
  513. {
  514. p->vel[0] = 30*vec[1];
  515. p->vel[1] = 30*-vec[0];
  516. }
  517. else
  518. {
  519. p->vel[0] = 30*-vec[1];
  520. p->vel[1] = 30*vec[0];
  521. }
  522. break;
  523. case 4: // slight blood
  524. p->type = pt_grav;
  525. p->color = 67 + (rand()&3);
  526. for (j=0 ; j<3 ; j++)
  527. p->org[j] = start[j] + ((rand()%6)-3);
  528. len -= 3;
  529. break;
  530. case 6: // voor trail
  531. p->color = 9*16 + 8 + (rand()&3);
  532. p->type = pt_static;
  533. p->die = cl.time + 0.3;
  534. for (j=0 ; j<3 ; j++)
  535. p->org[j] = start[j] + ((rand()&15)-8);
  536. break;
  537. }
  538. VectorAdd (start, vec, start);
  539. }
  540. }
  541. /*
  542. ===============
  543. R_DrawParticles
  544. ===============
  545. */
  546. extern cvar_t sv_gravity;
  547. void R_DrawParticles (void)
  548. {
  549. particle_t *p, *kill;
  550. float grav;
  551. int i;
  552. float time2, time3;
  553. float time1;
  554. float dvel;
  555. float frametime;
  556. #ifdef GLQUAKE
  557. vec3_t up, right;
  558. float scale;
  559. GL_Bind(particletexture);
  560. glEnable (GL_BLEND);
  561. glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
  562. glBegin (GL_TRIANGLES);
  563. VectorScale (vup, 1.5, up);
  564. VectorScale (vright, 1.5, right);
  565. #else
  566. D_StartParticles ();
  567. VectorScale (vright, xscaleshrink, r_pright);
  568. VectorScale (vup, yscaleshrink, r_pup);
  569. VectorCopy (vpn, r_ppn);
  570. #endif
  571. frametime = cl.time - cl.oldtime;
  572. time3 = frametime * 15;
  573. time2 = frametime * 10; // 15;
  574. time1 = frametime * 5;
  575. grav = frametime * sv_gravity.value * 0.05;
  576. dvel = 4*frametime;
  577. for ( ;; )
  578. {
  579. kill = active_particles;
  580. if (kill && kill->die < cl.time)
  581. {
  582. active_particles = kill->next;
  583. kill->next = free_particles;
  584. free_particles = kill;
  585. continue;
  586. }
  587. break;
  588. }
  589. for (p=active_particles ; p ; p=p->next)
  590. {
  591. for ( ;; )
  592. {
  593. kill = p->next;
  594. if (kill && kill->die < cl.time)
  595. {
  596. p->next = kill->next;
  597. kill->next = free_particles;
  598. free_particles = kill;
  599. continue;
  600. }
  601. break;
  602. }
  603. #ifdef GLQUAKE
  604. // hack a scale up to keep particles from disapearing
  605. scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
  606. + (p->org[2] - r_origin[2])*vpn[2];
  607. if (scale < 20)
  608. scale = 1;
  609. else
  610. scale = 1 + scale * 0.004;
  611. glColor3ubv ((byte *)&d_8to24table[(int)p->color]);
  612. glTexCoord2f (0,0);
  613. glVertex3fv (p->org);
  614. glTexCoord2f (1,0);
  615. glVertex3f (p->org[0] + up[0]*scale, p->org[1] + up[1]*scale, p->org[2] + up[2]*scale);
  616. glTexCoord2f (0,1);
  617. glVertex3f (p->org[0] + right[0]*scale, p->org[1] + right[1]*scale, p->org[2] + right[2]*scale);
  618. #else
  619. D_DrawParticle (p);
  620. #endif
  621. p->org[0] += p->vel[0]*frametime;
  622. p->org[1] += p->vel[1]*frametime;
  623. p->org[2] += p->vel[2]*frametime;
  624. switch (p->type)
  625. {
  626. case pt_static:
  627. break;
  628. case pt_fire:
  629. p->ramp += time1;
  630. if (p->ramp >= 6)
  631. p->die = -1;
  632. else
  633. p->color = ramp3[(int)p->ramp];
  634. p->vel[2] += grav;
  635. break;
  636. case pt_explode:
  637. p->ramp += time2;
  638. if (p->ramp >=8)
  639. p->die = -1;
  640. else
  641. p->color = ramp1[(int)p->ramp];
  642. for (i=0 ; i<3 ; i++)
  643. p->vel[i] += p->vel[i]*dvel;
  644. p->vel[2] -= grav;
  645. break;
  646. case pt_explode2:
  647. p->ramp += time3;
  648. if (p->ramp >=8)
  649. p->die = -1;
  650. else
  651. p->color = ramp2[(int)p->ramp];
  652. for (i=0 ; i<3 ; i++)
  653. p->vel[i] -= p->vel[i]*frametime;
  654. p->vel[2] -= grav;
  655. break;
  656. case pt_blob:
  657. for (i=0 ; i<3 ; i++)
  658. p->vel[i] += p->vel[i]*dvel;
  659. p->vel[2] -= grav;
  660. break;
  661. case pt_blob2:
  662. for (i=0 ; i<2 ; i++)
  663. p->vel[i] -= p->vel[i]*dvel;
  664. p->vel[2] -= grav;
  665. break;
  666. case pt_grav:
  667. #ifdef QUAKE2
  668. p->vel[2] -= grav * 20;
  669. break;
  670. #endif
  671. case pt_slowgrav:
  672. p->vel[2] -= grav;
  673. break;
  674. }
  675. }
  676. #ifdef GLQUAKE
  677. glEnd ();
  678. glDisable (GL_BLEND);
  679. glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
  680. #else
  681. D_EndParticles ();
  682. #endif
  683. }