Erste Stufe des Aufräumens von cl_newfx.c

This commit is contained in:
Yamagi Burmeister 2009-03-02 17:28:25 +00:00
parent b45c62dbbc
commit e78381ea17
2 changed files with 15 additions and 342 deletions

View file

@ -17,6 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// cl_main.c -- client main loop // cl_main.c -- client main loop
#include "client.h" #include "client.h"
@ -44,25 +45,9 @@ cvar_t *cl_autoskins;
cvar_t *cl_footsteps; cvar_t *cl_footsteps;
cvar_t *cl_timeout; cvar_t *cl_timeout;
cvar_t *cl_predict; cvar_t *cl_predict;
//cvar_t *cl_minfps;
cvar_t *cl_maxfps; cvar_t *cl_maxfps;
cvar_t *cl_drawfps; cvar_t *cl_drawfps;
cvar_t *cl_gun; cvar_t *cl_gun;
#ifdef QMAX
cvar_t *cl_blood;
cvar_t *cl_railred;
cvar_t *cl_railgreen;
cvar_t *cl_railblue;
cvar_t *cl_railtype;
cvar_t *cl_3dcam;
cvar_t *cl_3dcam_angle;
cvar_t *cl_3dcam_chase;
cvar_t *cl_3dcam_dist;
cvar_t *cl_3dcam_alpha;
cvar_t *cl_3dcam_adjust;
#endif
cvar_t *cl_add_particles; cvar_t *cl_add_particles;
cvar_t *cl_add_lights; cvar_t *cl_add_lights;
cvar_t *cl_add_entities; cvar_t *cl_add_entities;
@ -475,7 +460,6 @@ void CL_CheckForResend (void)
// we don't need a challenge on the localhost // we don't need a challenge on the localhost
CL_SendConnectPacket (); CL_SendConnectPacket ();
return; return;
// cls.connect_time = -99999; // CL_CheckForResend() will fire immediately
} }
// resend if we haven't gotten a reply yet // resend if we haven't gotten a reply yet
@ -613,7 +597,7 @@ void CL_ClearState (void)
CL_ClearEffects (); CL_ClearEffects ();
CL_ClearTEnts (); CL_ClearTEnts ();
// wipe the entire cl structure // wipe the entire cl structure
memset (&cl, 0, sizeof(cl)); memset (&cl, 0, sizeof(cl));
memset (&cl_entities, 0, sizeof(cl_entities)); memset (&cl_entities, 0, sizeof(cl_entities));
@ -662,9 +646,9 @@ void CL_Disconnect (void)
// send a disconnect message to the server // send a disconnect message to the server
final[0] = clc_stringcmd; final[0] = clc_stringcmd;
strcpy ((char *)final+1, "disconnect"); strcpy ((char *)final+1, "disconnect");
Netchan_Transmit (&cls.netchan, strlen((char *)final), final); Netchan_Transmit (&cls.netchan, strlen((const char *)final), final);
Netchan_Transmit (&cls.netchan, strlen((char *)final), final); Netchan_Transmit (&cls.netchan, strlen((const char *)final), final);
Netchan_Transmit (&cls.netchan, strlen((char *)final), final); Netchan_Transmit (&cls.netchan, strlen((const char *)final), final);
CL_ClearState (); CL_ClearState ();
@ -834,12 +818,6 @@ void CL_PingServers_f (void)
adr.type = NA_BROADCAST; adr.type = NA_BROADCAST;
adr.port = BigShort(PORT_SERVER); adr.port = BigShort(PORT_SERVER);
Netchan_OutOfBandPrint (NS_CLIENT, adr, va("info %i", PROTOCOL_VERSION)); Netchan_OutOfBandPrint (NS_CLIENT, adr, va("info %i", PROTOCOL_VERSION));
#ifdef HAVE_IPV6
Com_Printf ("pinging multicast...\n");
adr.type = NA_MULTICAST6;
adr.port = BigShort(PORT_SERVER);
Netchan_OutOfBandPrint (NS_CLIENT, adr, va("info %i", PROTOCOL_VERSION));
#endif
} }
noipx = Cvar_Get ("noipx", "0", CVAR_NOSET); noipx = Cvar_Get ("noipx", "0", CVAR_NOSET);
@ -893,7 +871,6 @@ void CL_Skins_f (void)
} }
} }
/* /*
================= =================
CL_ConnectionlessPacket CL_ConnectionlessPacket
@ -1012,7 +989,6 @@ void CL_ReadPackets (void)
{ {
while (NET_GetPacket (NS_CLIENT, &net_from, &net_message)) while (NET_GetPacket (NS_CLIENT, &net_from, &net_message))
{ {
// Com_Printf ("packet\n");
// //
// remote command packet // remote command packet
// //
@ -1150,7 +1126,7 @@ void CL_RequestNextDownload (void)
if (!allow_download->value && precache_check < ENV_CNT) if (!allow_download->value && precache_check < ENV_CNT)
precache_check = ENV_CNT; precache_check = ENV_CNT;
//ZOID //ZOID
if (precache_check == CS_MODELS) { // confirm map if (precache_check == CS_MODELS) { // confirm map
precache_check = CS_MODELS+2; // 0 isn't used precache_check = CS_MODELS+2; // 0 isn't used
if (allow_download_maps->value) if (allow_download_maps->value)
@ -1336,7 +1312,7 @@ void CL_RequestNextDownload (void)
CM_LoadMap (cl.configstrings[CS_MODELS+1], true, &map_checksum); CM_LoadMap (cl.configstrings[CS_MODELS+1], true, &map_checksum);
if (map_checksum != atoi(cl.configstrings[CS_MAPCHECKSUM])) { if (map_checksum != strtoul(cl.configstrings[CS_MAPCHECKSUM], NULL, 10)) {
Com_Error (ERR_DROP, "Local map version differs from server: %i != '%s'\n", Com_Error (ERR_DROP, "Local map version differs from server: %i != '%s'\n",
map_checksum, cl.configstrings[CS_MAPCHECKSUM]); map_checksum, cl.configstrings[CS_MAPCHECKSUM]);
return; return;
@ -1384,7 +1360,7 @@ void CL_RequestNextDownload (void)
precache_check = TEXTURE_CNT+999; precache_check = TEXTURE_CNT+999;
} }
//ZOID //ZOID
CL_RegisterSounds (); CL_RegisterSounds ();
CL_PrepRefresh (); CL_PrepRefresh ();
@ -1444,9 +1420,9 @@ void CL_InitLocal (void)
adr7 = Cvar_Get( "adr7", "", CVAR_ARCHIVE ); adr7 = Cvar_Get( "adr7", "", CVAR_ARCHIVE );
adr8 = Cvar_Get( "adr8", "", CVAR_ARCHIVE ); adr8 = Cvar_Get( "adr8", "", CVAR_ARCHIVE );
// //
// register our variables // register our variables
// //
cl_stereo_separation = Cvar_Get( "cl_stereo_separation", "0.4", CVAR_ARCHIVE ); cl_stereo_separation = Cvar_Get( "cl_stereo_separation", "0.4", CVAR_ARCHIVE );
cl_stereo = Cvar_Get( "cl_stereo", "0", 0 ); cl_stereo = Cvar_Get( "cl_stereo", "0", 0 );
@ -1459,28 +1435,9 @@ void CL_InitLocal (void)
cl_noskins = Cvar_Get ("cl_noskins", "0", 0); cl_noskins = Cvar_Get ("cl_noskins", "0", 0);
cl_autoskins = Cvar_Get ("cl_autoskins", "0", 0); cl_autoskins = Cvar_Get ("cl_autoskins", "0", 0);
cl_predict = Cvar_Get ("cl_predict", "1", 0); cl_predict = Cvar_Get ("cl_predict", "1", 0);
// cl_minfps = Cvar_Get ("cl_minfps", "5", 0);
cl_maxfps = Cvar_Get ("cl_maxfps", "90", 0); cl_maxfps = Cvar_Get ("cl_maxfps", "90", 0);
cl_drawfps = Cvar_Get("cl_drawfps","0",CVAR_ARCHIVE); // FPS hack cl_drawfps = Cvar_Get("cl_drawfps","0",CVAR_ARCHIVE); // FPS hack
#ifdef QMAX
cl_blood = Cvar_Get ("cl_blood", "1", 0);
//psychospaz -- railgun fun
cl_railred = Cvar_Get ("cl_railred", "20", CVAR_ARCHIVE);
cl_railgreen = Cvar_Get ("cl_railgreen", "50", CVAR_ARCHIVE);
cl_railblue = Cvar_Get ("cl_railblue", "175", CVAR_ARCHIVE);
cl_railtype = Cvar_Get ("cl_railtype", "1", CVAR_ARCHIVE);
//3d camera
cl_3dcam = Cvar_Get ("cl_3dcam", "0", CVAR_ARCHIVE);
cl_3dcam_angle = Cvar_Get ("cl_3dcam_angle", "0", CVAR_ARCHIVE);
cl_3dcam_dist = Cvar_Get ("cl_3dcam_dist", "50", CVAR_ARCHIVE);
cl_3dcam_alpha = Cvar_Get ("cl_3dcam_alpha", "1", CVAR_ARCHIVE);
cl_3dcam_chase = Cvar_Get ("cl_3dcam_chase", "1", CVAR_ARCHIVE);
cl_3dcam_adjust = Cvar_Get ("cl_3dcam_adjust", "1", CVAR_ARCHIVE);
//cl_playermodel_default = Cvar_Get ("cl_playermodel_default", DEFAULTSKIN, CVAR_USERINFO);
#endif
cl_upspeed = Cvar_Get ("cl_upspeed", "200", 0); cl_upspeed = Cvar_Get ("cl_upspeed", "200", 0);
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", 0); cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", 0);
cl_sidespeed = Cvar_Get ("cl_sidespeed", "200", 0); cl_sidespeed = Cvar_Get ("cl_sidespeed", "200", 0);
@ -1552,8 +1509,6 @@ void CL_InitLocal (void)
Cmd_AddCommand ("rcon", CL_Rcon_f); Cmd_AddCommand ("rcon", CL_Rcon_f);
// Cmd_AddCommand ("packet", CL_Packet_f); // this is dangerous to leave in
Cmd_AddCommand ("setenv", CL_Setenv_f ); Cmd_AddCommand ("setenv", CL_Setenv_f );
Cmd_AddCommand ("precache", CL_Precache_f); Cmd_AddCommand ("precache", CL_Precache_f);
@ -1587,8 +1542,6 @@ void CL_InitLocal (void)
Cmd_AddCommand ("weapprev", NULL); Cmd_AddCommand ("weapprev", NULL);
} }
/* /*
=============== ===============
CL_WriteConfiguration CL_WriteConfiguration
@ -1744,13 +1697,8 @@ void CL_Frame (int msec)
cls.realtime = curtime; cls.realtime = curtime;
extratime = 0; extratime = 0;
#if 0
if (cls.frametime > (1.0 / cl_minfps->value))
cls.frametime = (1.0 / cl_minfps->value);
#else
if (cls.frametime > (1.0 / 5)) if (cls.frametime > (1.0 / 5))
cls.frametime = (1.0 / 5); cls.frametime = (1.0 / 5);
#endif
// if in the debugger last frame, don't timeout // if in the debugger last frame, don't timeout
if (msec > 5000) if (msec > 5000)
@ -1828,7 +1776,7 @@ void CL_Init (void)
// all archived variables will now be loaded // all archived variables will now be loaded
Con_Init (); Con_Init ();
#if defined __linux__ || defined __FreeBSD__ || defined __sgi #if defined __linux__ || defined __FreeBSD__
S_Init (); S_Init ();
VID_Init (); VID_Init ();
#else #else
@ -1884,4 +1832,3 @@ void CL_Shutdown(void)
VID_Shutdown(); VID_Shutdown();
} }

View file

@ -28,24 +28,6 @@ extern cvar_t *vid_ref;
extern void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up); extern void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up);
#ifdef QMAX
cparticle_t *setupParticle (
float angle0, float angle1, float angle2,
float org0, float org1, float org2,
float vel0, float vel1, float vel2,
float accel0, float accel1, float accel2,
float color0, float color1, float color2,
float colorvel0, float colorvel1, float colorvel2,
float alpha, float alphavel,
float size, float sizevel,
int image,
int flags,
void (*think)(cparticle_t *p, vec3_t org, vec3_t angle, float *alpha, float *size, int *image, float *time),
qboolean thinknext);
#endif
/* /*
====== ======
vectoangles2 - this is duplicated in the game DLL, but I need it here. vectoangles2 - this is duplicated in the game DLL, but I need it here.
@ -131,7 +113,6 @@ void CL_ColorFlash (vec3_t pos, int ent, int intensity, float r, float g, float
dl->color[2] = b; dl->color[2] = b;
} }
/* /*
====== ======
CL_DebugTrail CL_DebugTrail
@ -142,9 +123,7 @@ void CL_DebugTrail (vec3_t start, vec3_t end)
vec3_t move; vec3_t move;
vec3_t vec; vec3_t vec;
float len; float len;
#ifndef QMAX
cparticle_t *p; cparticle_t *p;
#endif
float dec; float dec;
vec3_t right, up; vec3_t right, up;
@ -154,10 +133,6 @@ void CL_DebugTrail (vec3_t start, vec3_t end)
MakeNormalVectors (vec, right, up); MakeNormalVectors (vec, right, up);
// VectorScale(vec, RT2_SKIP, vec);
// dec = 1.0;
// dec = 0.75;
dec = 3; dec = 3;
VectorScale (vec, dec, vec); VectorScale (vec, dec, vec);
VectorCopy (start, move); VectorCopy (start, move);
@ -165,20 +140,6 @@ void CL_DebugTrail (vec3_t start, vec3_t end)
while (len > 0) while (len > 0)
{ {
len -= dec; len -= dec;
#ifdef QMAX
setupParticle (
0, 0, 0,
move[0], move[1], move[2],
0, 0, 0,
0, 0, 0,
50, 50, 255,
0, 0, 0,
1, -0.75,
7.5, 0,
particle_generic,
0,
NULL,0);
#else
if (!free_particles) if (!free_particles)
return; return;
p = free_particles; p = free_particles;
@ -191,18 +152,8 @@ void CL_DebugTrail (vec3_t start, vec3_t end)
VectorClear (p->vel); VectorClear (p->vel);
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -0.1; p->alphavel = -0.1;
// p->alphavel = 0;
p->color = 0x74 + (rand()&7); p->color = 0x74 + (rand()&7);
VectorCopy (move, p->org); VectorCopy (move, p->org);
/*
for (j=0 ; j<3 ; j++)
{
p->org[j] = move[j] + crand()*2;
p->vel[j] = crand()*3;
p->accel[j] = 0;
}
*/
#endif
VectorAdd (move, vec, move); VectorAdd (move, vec, move);
} }
@ -244,9 +195,7 @@ void CL_SmokeTrail (vec3_t start, vec3_t end, int colorStart, int colorRun, int
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1+frand()*0.5); p->alphavel = -1.0 / (1+frand()*0.5);
#ifndef QMAX
p->color = colorStart + (rand() % colorRun); p->color = colorStart + (rand() % colorRun);
#endif
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
p->org[j] = move[j] + crand()*3; p->org[j] = move[j] + crand()*3;
@ -262,12 +211,8 @@ void CL_ForceWall (vec3_t start, vec3_t end, int color8)
{ {
vec3_t move; vec3_t move;
vec3_t vec; vec3_t vec;
#ifdef QMAX
vec3_t color = { color8red(color8), color8green(color8), color8blue(color8)};
#else
int j; int j;
cparticle_t *p; cparticle_t *p;
#endif
float len; float len;
@ -287,20 +232,6 @@ void CL_ForceWall (vec3_t start, vec3_t end, int color8)
if (frand() > 0.3) if (frand() > 0.3)
{ {
#ifdef QMAX
setupParticle (
0, 0, 0,
move[0] + crand()*3, move[1] + crand()*3, move[2] + crand()*3,
0, 0, -40 - (crand()*10),
0, 0, 0,
color[0]+5, color[1]+5, color[2]+5,
0, 0, 0,
1, -1.0 / (3.0+frand()*0.5),
5, 0,
particle_generic,
0,
NULL,0);
#else
p = free_particles; p = free_particles;
free_particles = p->next; free_particles = p->next;
p->next = active_particles; p->next = active_particles;
@ -320,8 +251,6 @@ void CL_ForceWall (vec3_t start, vec3_t end, int color8)
p->vel[0] = 0; p->vel[0] = 0;
p->vel[1] = 0; p->vel[1] = 0;
p->vel[2] = -40 - (crand()*10); p->vel[2] = -40 - (crand()*10);
#endif
} }
VectorAdd (move, vec, move); VectorAdd (move, vec, move);
@ -351,9 +280,7 @@ void CL_FlameEffects (centity_t *ent, vec3_t origin)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1+frand()*0.2); p->alphavel = -1.0 / (1+frand()*0.2);
#ifndef QMAX
p->color = 226 + (rand() % 4); p->color = 226 + (rand() % 4);
#endif
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
p->org[j] = origin[j] + crand()*5; p->org[j] = origin[j] + crand()*5;
@ -379,16 +306,13 @@ void CL_FlameEffects (centity_t *ent, vec3_t origin)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1+frand()*0.5); p->alphavel = -1.0 / (1+frand()*0.5);
#ifndef QMAX
p->color = 0 + (rand() % 4); p->color = 0 + (rand() % 4);
#endif
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
p->org[j] = origin[j] + crand()*3; p->org[j] = origin[j] + crand()*3;
} }
p->vel[2] = 20 + crand()*5; p->vel[2] = 20 + crand()*5;
} }
} }
@ -413,12 +337,10 @@ void CL_GenericParticleEffect (vec3_t org, vec3_t dir, int color, int count, int
active_particles = p; active_particles = p;
p->time = cl.time; p->time = cl.time;
#ifndef QMAX
if (numcolors > 1) if (numcolors > 1)
p->color = color + (rand() & numcolors); p->color = color + (rand() & numcolors);
else else
p->color = color; p->color = color;
#endif
d = rand() & dirspread; d = rand() & dirspread;
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -428,11 +350,9 @@ void CL_GenericParticleEffect (vec3_t org, vec3_t dir, int color, int count, int
p->accel[0] = p->accel[1] = 0; p->accel[0] = p->accel[1] = 0;
p->accel[2] = -PARTICLE_GRAVITY; p->accel[2] = -PARTICLE_GRAVITY;
// VectorCopy (accel, p->accel);
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.5 + frand()*alphavel); p->alphavel = -1.0 / (0.5 + frand()*alphavel);
// p->alphavel = alphavel;
} }
} }
@ -448,10 +368,8 @@ void CL_BubbleTrail2 (vec3_t start, vec3_t end, int dist)
vec3_t vec; vec3_t vec;
float len; float len;
int i; int i;
#ifndef QMAX
int j; int j;
cparticle_t *p; cparticle_t *p;
#endif
float dec; float dec;
VectorCopy (start, move); VectorCopy (start, move);
@ -463,20 +381,6 @@ void CL_BubbleTrail2 (vec3_t start, vec3_t end, int dist)
for (i=0 ; i<len ; i+=dec) for (i=0 ; i<len ; i+=dec)
{ {
#ifdef QMAX
setupParticle (
0, 0, 0,
move[0]+crand()*2, move[1]+crand()*2, move[2]+crand()*2,
crand()*5, crand()*5, crand()*5+6,
0, 0, 0,
255, 255, 255,
0, 0, 0,
0.75, -1.0 / (1 + frand() * 0.2),
(frand()>0.25)? 1 : (frand()>0.5) ? 2 : (frand()>0.75) ? 3 : 4, 1,
particle_bubble,
PART_TRANS|PART_SHADED,
NULL,0);
#else
if (!free_particles) if (!free_particles)
return; return;
@ -497,14 +401,11 @@ void CL_BubbleTrail2 (vec3_t start, vec3_t end, int dist)
p->vel[j] = crand()*10; p->vel[j] = crand()*10;
} }
p->org[2] -= 4; p->org[2] -= 4;
// p->vel[2] += 6;
p->vel[2] += 20; p->vel[2] += 20;
#endif
VectorAdd (move, vec, move); VectorAdd (move, vec, move);
} }
} }
//#define CORKSCREW 1
//#define DOUBLE_SCREW 1 //#define DOUBLE_SCREW 1
#define RINGS 1 #define RINGS 1
//#define SPRAY 1 //#define SPRAY 1
@ -528,7 +429,6 @@ void CL_Heatbeam (vec3_t start, vec3_t end)
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
len = VectorNormalize (vec); len = VectorNormalize (vec);
// MakeNormalVectors (vec, right, up);
VectorCopy (cl.v_right, right); VectorCopy (cl.v_right, right);
VectorCopy (cl.v_up, up); VectorCopy (cl.v_up, up);
VectorMA (move, -1, right, move); VectorMA (move, -1, right, move);
@ -537,7 +437,6 @@ void CL_Heatbeam (vec3_t start, vec3_t end)
VectorScale (vec, step, vec); VectorScale (vec, step, vec);
ltime = (float) cl.time/1000.0; ltime = (float) cl.time/1000.0;
// for (i=0 ; i<len ; i++)
for (i=0 ; i<len ; i+=step) for (i=0 ; i<len ; i+=step)
{ {
d = i * 0.1 - fmod(ltime,16.0)*M_PI; d = i * 0.1 - fmod(ltime,16.0)*M_PI;
@ -561,17 +460,8 @@ void CL_Heatbeam (vec3_t start, vec3_t end)
VectorClear (p->accel); VectorClear (p->accel);
p->alpha = 0.5; p->alpha = 0.5;
// p->alphavel = -1.0 / (1+frand()*0.2);
// only last one frame!
p->alphavel = INSTANT_PARTICLE; p->alphavel = INSTANT_PARTICLE;
// p->color = 0x74 + (rand()&7);
// p->color = 223 - (rand()&7);
#ifndef QMAX
p->color = 223; p->color = 223;
#endif
// p->color = 240;
// trim it so it looks like it's starting at the origin
if (i < 10) if (i < 10)
{ {
VectorScale (right, c*(i/10.0)*k, dir); VectorScale (right, c*(i/10.0)*k, dir);
@ -582,27 +472,11 @@ void CL_Heatbeam (vec3_t start, vec3_t end)
VectorScale (right, c*k, dir); VectorScale (right, c*k, dir);
VectorMA (dir, s*k, up, dir); VectorMA (dir, s*k, up, dir);
} }
#ifdef QMAX
setupParticle (
0, 0, 0,
move[0]+dir[0]*3, move[1]+dir[1]*3, move[2]+dir[2]*3,
0, 0, 0,
0, 0, 0,
200+rand()*50, 200+rand()*25, rand()*50,
0, 0, 0,
0.5, -1000.0,
3, 1,
particle_blaster,
0,
NULL,0);
#else
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
p->org[j] = move[j] + dir[j]*3; p->org[j] = move[j] + dir[j]*3;
// p->vel[j] = dir[j]*6;
p->vel[j] = 0; p->vel[j] = 0;
} }
#endif
#ifdef DOUBLE_SCREW #ifdef DOUBLE_SCREW
} }
#endif #endif
@ -611,7 +485,7 @@ void CL_Heatbeam (vec3_t start, vec3_t end)
} }
#endif #endif
#ifdef RINGS #ifdef RINGS
//void CL_Heatbeam (vec3_t start, vec3_t end)
void CL_Heatbeam (vec3_t start, vec3_t forward) void CL_Heatbeam (vec3_t start, vec3_t forward)
{ {
vec3_t move; vec3_t move;
@ -637,7 +511,6 @@ void CL_Heatbeam (vec3_t start, vec3_t forward)
len = VectorNormalize (vec); len = VectorNormalize (vec);
// FIXME - pmm - these might end up using old values? // FIXME - pmm - these might end up using old values?
// MakeNormalVectors (vec, right, up);
VectorCopy (cl.v_right, right); VectorCopy (cl.v_right, right);
VectorCopy (cl.v_up, up); VectorCopy (cl.v_up, up);
if (vidref_val == VIDREF_GL) if (vidref_val == VIDREF_GL)
@ -653,7 +526,6 @@ void CL_Heatbeam (vec3_t start, vec3_t forward)
VectorScale (vec, step, vec); VectorScale (vec, step, vec);
// Com_Printf ("%f\n", ltime);
rstep = M_PI/10.0; rstep = M_PI/10.0;
for (i=start_pt ; i<len ; i+=step) for (i=start_pt ; i<len ; i+=step)
{ {
@ -673,10 +545,6 @@ void CL_Heatbeam (vec3_t start, vec3_t forward)
p->time = cl.time; p->time = cl.time;
VectorClear (p->accel); VectorClear (p->accel);
// rot+= fmod(ltime, 12.0)*M_PI;
// c = cos(rot)/2.0;
// s = sin(rot)/2.0;
// variance = 0.4 + ((float)rand()/(float)RAND_MAX) *0.2;
variance = 0.5; variance = 0.5;
c = cos(rot)*variance; c = cos(rot)*variance;
s = sin(rot)*variance; s = sin(rot)*variance;
@ -694,16 +562,11 @@ void CL_Heatbeam (vec3_t start, vec3_t forward)
} }
p->alpha = 0.5; p->alpha = 0.5;
// p->alphavel = -1.0 / (1+frand()*0.2);
p->alphavel = -1000.0; p->alphavel = -1000.0;
// p->color = 0x74 + (rand()&7);
#ifndef QMAX
p->color = 223 - (rand()&7); p->color = 223 - (rand()&7);
#endif
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
p->org[j] = move[j] + dir[j]*3; p->org[j] = move[j] + dir[j]*3;
// p->vel[j] = dir[j]*6;
p->vel[j] = 0; p->vel[j] = 0;
} }
} }
@ -732,7 +595,6 @@ void CL_Heatbeam (vec3_t start, vec3_t end)
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
len = VectorNormalize (vec); len = VectorNormalize (vec);
// MakeNormalVectors (vec, right, up);
VectorCopy (cl.v_forward, forward); VectorCopy (cl.v_forward, forward);
VectorCopy (cl.v_right, right); VectorCopy (cl.v_right, right);
VectorCopy (cl.v_up, up); VectorCopy (cl.v_up, up);
@ -758,9 +620,7 @@ void CL_Heatbeam (vec3_t start, vec3_t end)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -5.0 / (1+frand()); p->alphavel = -5.0 / (1+frand());
#ifndef QMAX
p->color = 223 - (rand()&7); p->color = 223 - (rand()&7);
#endif
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
p->org[j] = move[j]; p->org[j] = move[j];
@ -769,68 +629,6 @@ void CL_Heatbeam (vec3_t start, vec3_t end)
VectorMA (p->vel, c, right, p->vel); VectorMA (p->vel, c, right, p->vel);
VectorMA (p->vel, s, up, p->vel); VectorMA (p->vel, s, up, p->vel);
} }
/*
ltime = (float) cl.time/1000.0;
start_pt = fmod(ltime*16.0,step);
VectorMA (move, start_pt, vec, move);
VectorScale (vec, step, vec);
// Com_Printf ("%f\n", ltime);
rstep = M_PI/12.0;
for (i=start_pt ; i<len ; i+=step)
{
if (i>step*5) // don't bother after the 5th ring
break;
for (rot = 0; rot < M_PI*2; rot += rstep)
{
if (!free_particles)
return;
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
p->time = cl.time;
VectorClear (p->accel);
// rot+= fmod(ltime, 12.0)*M_PI;
// c = cos(rot)/2.0;
// s = sin(rot)/2.0;
c = cos(rot)/1.5;
s = sin(rot)/1.5;
// trim it so it looks like it's starting at the origin
if (i < 10)
{
VectorScale (right, c*(i/10.0), dir);
VectorMA (dir, s*(i/10.0), up, dir);
}
else
{
VectorScale (right, c, dir);
VectorMA (dir, s, up, dir);
}
p->alpha = 0.5;
// p->alphavel = -1.0 / (1+frand()*0.2);
p->alphavel = -1000.0;
// p->color = 0x74 + (rand()&7);
#ifndef QMAX
p->color = 223 - (rand()&7);
#endif
for (j=0 ; j<3 ; j++)
{
p->org[j] = move[j] + dir[j]*3;
// p->vel[j] = dir[j]*6;
p->vel[j] = 0;
}
}
VectorAdd (move, vec, move);
}
*/
} }
#endif #endif
@ -848,9 +646,6 @@ void CL_ParticleSteamEffect (vec3_t org, vec3_t dir, int color, int count, int m
float d; float d;
vec3_t r, u; vec3_t r, u;
// vectoangles2 (dir, angle_dir);
// AngleVectors (angle_dir, f, r, u);
MakeNormalVectors (dir, r, u); MakeNormalVectors (dir, r, u);
for (i=0 ; i<count ; i++) for (i=0 ; i<count ; i++)
@ -863,13 +658,10 @@ void CL_ParticleSteamEffect (vec3_t org, vec3_t dir, int color, int count, int m
active_particles = p; active_particles = p;
p->time = cl.time; p->time = cl.time;
#ifndef QMAX
p->color = color + (rand()&7); p->color = color + (rand()&7);
#endif
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
p->org[j] = org[j] + magnitude*0.1*crand(); p->org[j] = org[j] + magnitude*0.1*crand();
// p->vel[j] = dir[j]*magnitude;
} }
VectorScale (dir, magnitude, p->vel); VectorScale (dir, magnitude, p->vel);
d = crand()*magnitude/3; d = crand()*magnitude/3;
@ -886,7 +678,6 @@ void CL_ParticleSteamEffect (vec3_t org, vec3_t dir, int color, int count, int m
} }
void CL_ParticleSteamEffect2 (cl_sustain_t *self) void CL_ParticleSteamEffect2 (cl_sustain_t *self)
//vec3_t org, vec3_t dir, int color, int count, int magnitude)
{ {
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
@ -894,9 +685,6 @@ void CL_ParticleSteamEffect2 (cl_sustain_t *self)
vec3_t r, u; vec3_t r, u;
vec3_t dir; vec3_t dir;
// vectoangles2 (dir, angle_dir);
// AngleVectors (angle_dir, f, r, u);
VectorCopy (self->dir, dir); VectorCopy (self->dir, dir);
MakeNormalVectors (dir, r, u); MakeNormalVectors (dir, r, u);
@ -910,13 +698,11 @@ void CL_ParticleSteamEffect2 (cl_sustain_t *self)
active_particles = p; active_particles = p;
p->time = cl.time; p->time = cl.time;
#ifndef QMAX
p->color = self->color + (rand()&7); p->color = self->color + (rand()&7);
#endif
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
p->org[j] = self->org[j] + self->magnitude*0.1*crand(); p->org[j] = self->org[j] + self->magnitude*0.1*crand();
// p->vel[j] = dir[j]*magnitude;
} }
VectorScale (dir, self->magnitude, p->vel); VectorScale (dir, self->magnitude, p->vel);
d = crand()*self->magnitude/3; d = crand()*self->magnitude/3;
@ -977,14 +763,11 @@ void CL_TrackerTrail (vec3_t start, vec3_t end, int particleColor)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -2.0; p->alphavel = -2.0;
#ifndef QMAX
p->color = particleColor; p->color = particleColor;
#endif
dist = DotProduct(move, forward); dist = DotProduct(move, forward);
VectorMA(move, 8 * cos(dist), up, p->org); VectorMA(move, 8 * cos(dist), up, p->org);
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
// p->org[j] = move[j] + crand();
p->vel[j] = 0; p->vel[j] = 0;
p->accel[j] = 0; p->accel[j] = 0;
} }
@ -1014,9 +797,7 @@ void CL_Tracker_Shell(vec3_t origin)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = INSTANT_PARTICLE; p->alphavel = INSTANT_PARTICLE;
#ifndef QMAX
p->color = 0; p->color = 0;
#endif
dir[0] = crand(); dir[0] = crand();
dir[1] = crand(); dir[1] = crand();
dir[2] = crand(); dir[2] = crand();
@ -1046,16 +827,13 @@ void CL_MonsterPlasma_Shell(vec3_t origin)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = INSTANT_PARTICLE; p->alphavel = INSTANT_PARTICLE;
#ifndef QMAX
p->color = 0xe0; p->color = 0xe0;
#endif
dir[0] = crand(); dir[0] = crand();
dir[1] = crand(); dir[1] = crand();
dir[2] = crand(); dir[2] = crand();
VectorNormalize(dir); VectorNormalize(dir);
VectorMA(origin, 10, dir, p->org); VectorMA(origin, 10, dir, p->org);
// VectorMA(origin, 10*(((rand () & 0x7fff) / ((float)0x7fff))), dir, p->org);
} }
} }
@ -1064,9 +842,7 @@ void CL_Widowbeamout (cl_sustain_t *self)
vec3_t dir; vec3_t dir;
int i; int i;
cparticle_t *p; cparticle_t *p;
#ifndef QMAX
static int colortable[4] = {2*8,13*8,21*8,18*8}; static int colortable[4] = {2*8,13*8,21*8,18*8};
#endif
float ratio; float ratio;
ratio = 1.0 - (((float)self->endtime - (float)cl.time)/2100.0); ratio = 1.0 - (((float)self->endtime - (float)cl.time)/2100.0);
@ -1085,16 +861,13 @@ void CL_Widowbeamout (cl_sustain_t *self)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = INSTANT_PARTICLE; p->alphavel = INSTANT_PARTICLE;
#ifndef QMAX
p->color = colortable[rand()&3]; p->color = colortable[rand()&3];
#endif
dir[0] = crand(); dir[0] = crand();
dir[1] = crand(); dir[1] = crand();
dir[2] = crand(); dir[2] = crand();
VectorNormalize(dir); VectorNormalize(dir);
VectorMA(self->org, (45.0 * ratio), dir, p->org); VectorMA(self->org, (45.0 * ratio), dir, p->org);
// VectorMA(origin, 10*(((rand () & 0x7fff) / ((float)0x7fff))), dir, p->org);
} }
} }
@ -1103,9 +876,7 @@ void CL_Nukeblast (cl_sustain_t *self)
vec3_t dir; vec3_t dir;
int i; int i;
cparticle_t *p; cparticle_t *p;
#ifndef QMAX
static int colortable[4] = {110, 112, 114, 116}; static int colortable[4] = {110, 112, 114, 116};
#endif
float ratio; float ratio;
ratio = 1.0 - (((float)self->endtime - (float)cl.time)/1000.0); ratio = 1.0 - (((float)self->endtime - (float)cl.time)/1000.0);
@ -1124,24 +895,19 @@ void CL_Nukeblast (cl_sustain_t *self)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = INSTANT_PARTICLE; p->alphavel = INSTANT_PARTICLE;
#ifndef QMAX
p->color = colortable[rand()&3]; p->color = colortable[rand()&3];
#endif
dir[0] = crand(); dir[0] = crand();
dir[1] = crand(); dir[1] = crand();
dir[2] = crand(); dir[2] = crand();
VectorNormalize(dir); VectorNormalize(dir);
VectorMA(self->org, (200.0 * ratio), dir, p->org); VectorMA(self->org, (200.0 * ratio), dir, p->org);
// VectorMA(origin, 10*(((rand () & 0x7fff) / ((float)0x7fff))), dir, p->org);
} }
} }
void CL_WidowSplash (vec3_t org) void CL_WidowSplash (vec3_t org)
{ {
#ifndef QMAX
static int colortable[4] = {2*8,13*8,21*8,18*8}; static int colortable[4] = {2*8,13*8,21*8,18*8};
#endif
int i; int i;
cparticle_t *p; cparticle_t *p;
vec3_t dir; vec3_t dir;
@ -1156,9 +922,7 @@ void CL_WidowSplash (vec3_t org)
active_particles = p; active_particles = p;
p->time = cl.time; p->time = cl.time;
#ifndef QMAX
p->color = colortable[rand()&3]; p->color = colortable[rand()&3];
#endif
dir[0] = crand(); dir[0] = crand();
dir[1] = crand(); dir[1] = crand();
dir[2] = crand(); dir[2] = crand();
@ -1194,9 +958,7 @@ void CL_Tracker_Explode(vec3_t origin)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0; p->alphavel = -1.0;
#ifndef QMAX
p->color = 0; p->color = 0;
#endif
dir[0] = crand(); dir[0] = crand();
dir[1] = crand(); dir[1] = crand();
dir[2] = crand(); dir[2] = crand();
@ -1247,9 +1009,7 @@ void CL_TagTrail (vec3_t start, vec3_t end, float color)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.8+frand()*0.2); p->alphavel = -1.0 / (0.8+frand()*0.2);
#ifndef QMAX
p->color = color; p->color = color;
#endif
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
p->org[j] = move[j] + crand()*16; p->org[j] = move[j] + crand()*16;
@ -1269,28 +1029,10 @@ CL_ColorExplosionParticles
void CL_ColorExplosionParticles (vec3_t org, int color8, int run) void CL_ColorExplosionParticles (vec3_t org, int color8, int run)
{ {
int i; int i;
#ifdef QMAX
vec3_t color = { color8red(color8), color8green(color8), color8blue(color8)};
#else
int j; int j;
cparticle_t *p; cparticle_t *p;
#endif
for (i=0 ; i<128 ; i++) for (i=0 ; i<128 ; i++)
{ {
#ifdef QMAX
setupParticle (
0, 0, 0,
org[0] + ((rand()%32)-16), org[1] + ((rand()%32)-16), org[2] + ((rand()%32)-16),
(rand()%256)-128, (rand()%256)-128, (rand()%256)-128,
0, 0, 20,
color[0] + (rand() % run), color[1] + (rand() % run), color[2] + (rand() % run),
0, 0, 0,
1.0, -0.4 / (0.6 + frand()*0.2),
2, 1,
particle_generic,
0,
NULL,0);
#else
if (!free_particles) if (!free_particles)
return; return;
p = free_particles; p = free_particles;
@ -1311,7 +1053,6 @@ setupParticle (
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -0.4 / (0.6 + frand()*0.2); p->alphavel = -0.4 / (0.6 + frand()*0.2);
#endif
} }
} }
@ -1320,14 +1061,6 @@ setupParticle (
CL_ParticleSmokeEffect - like the steam effect, but unaffected by gravity CL_ParticleSmokeEffect - like the steam effect, but unaffected by gravity
=============== ===============
*/ */
#ifdef QMAX
void pRotateThink (cparticle_t *p, vec3_t org, vec3_t angle, float *alpha, float *size, int *image, float *time)
{
angle[2] = angle[0] + *time*angle[1] + *time**time*angle[2];
p->thinknext=true;
}
#endif
void CL_ParticleSmokeEffect (vec3_t org, vec3_t dir, int color, int count, int magnitude) void CL_ParticleSmokeEffect (vec3_t org, vec3_t dir, int color, int count, int magnitude)
{ {
int i, j; int i, j;
@ -1347,13 +1080,10 @@ void CL_ParticleSmokeEffect (vec3_t org, vec3_t dir, int color, int count, int m
active_particles = p; active_particles = p;
p->time = cl.time; p->time = cl.time;
#ifndef QMAX
p->color = color + (rand()&7); p->color = color + (rand()&7);
#endif
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
p->org[j] = org[j] + magnitude*0.1*crand(); p->org[j] = org[j] + magnitude*0.1*crand();
// p->vel[j] = dir[j]*magnitude;
} }
VectorScale (dir, magnitude, p->vel); VectorScale (dir, magnitude, p->vel);
d = crand()*magnitude/3; d = crand()*magnitude/3;
@ -1393,9 +1123,7 @@ void CL_BlasterParticles2 (vec3_t org, vec3_t dir, unsigned int color)
active_particles = p; active_particles = p;
p->time = cl.time; p->time = cl.time;
#ifndef QMAX
p->color = color + (rand()&7); p->color = color + (rand()&7);
#endif
d = rand()&15; d = rand()&15;
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -1451,9 +1179,6 @@ void CL_BlasterTrail2 (vec3_t start, vec3_t end)
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.3+frand()*0.2); p->alphavel = -1.0 / (0.3+frand()*0.2);
#ifndef QMAX
p->color = 0xd0;
#endif
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
p->org[j] = move[j] + crand(); p->org[j] = move[j] + crand();
@ -1464,3 +1189,4 @@ void CL_BlasterTrail2 (vec3_t start, vec3_t end)
VectorAdd (move, vec, move); VectorAdd (move, vec, move);
} }
} }