Den Entityhandler überarbeitet

This commit is contained in:
Yamagi Burmeister 2009-03-01 11:40:49 +00:00
parent 92f0046ad6
commit e548206c18
3 changed files with 193 additions and 163 deletions

View file

@ -132,16 +132,6 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int number, int bi
else if (bits & U_RENDERFX16) else if (bits & U_RENDERFX16)
to->renderfx = MSG_ReadShort(&net_message); to->renderfx = MSG_ReadShort(&net_message);
if (bits & U_MODEL) {
if (to->modelindex == 1 && !to->renderfx & RF_BEAM)
Com_Printf ("WARNING: Entity %d sent modelindex 1!!\n", number);
}
if (number < 40) {
if (to->modelindex2 == 1)
Com_Printf ("HAX\n");
}
if (bits & U_ORIGIN1) if (bits & U_ORIGIN1)
to->origin[0] = MSG_ReadCoord (&net_message); to->origin[0] = MSG_ReadCoord (&net_message);
if (bits & U_ORIGIN2) if (bits & U_ORIGIN2)
@ -871,11 +861,11 @@ void CL_AddPacketEntities (frame_t *frame)
// FIXME: still pass to refresh // FIXME: still pass to refresh
if (effects & EF_FLAG1) if (effects & EF_FLAG1)
V_AddLight (ent.origin, 225, 1.0, 0.1f, 0.1f); V_AddLight (ent.origin, 225, 1.0f, 0.1f, 0.1f);
else if (effects & EF_FLAG2) else if (effects & EF_FLAG2)
V_AddLight (ent.origin, 225, 0.1f, 0.1f, 1.0); V_AddLight (ent.origin, 225, 0.1f, 0.1f, 1.0f);
else if (effects & EF_TAGTRAIL) //PGM else if (effects & EF_TAGTRAIL) //PGM
V_AddLight (ent.origin, 225, 1.0, 1.0, 0.0f); //PGM V_AddLight (ent.origin, 225, 1.0f, 1.0f, 0.0f); //PGM
else if (effects & EF_TRACKERTRAIL) //PGM else if (effects & EF_TRACKERTRAIL) //PGM
V_AddLight (ent.origin, 225, -1.0f, -1.0f, -1.0f); //PGM V_AddLight (ent.origin, 225, -1.0f, -1.0f, -1.0f); //PGM
@ -1082,7 +1072,7 @@ void CL_AddPacketEntities (frame_t *frame)
ent.origin[2] += 32; ent.origin[2] += 32;
CL_TrapParticles (&ent); CL_TrapParticles (&ent);
i = (rand()%100) + 100; i = (rand()%100) + 100;
V_AddLight (ent.origin, i, 1, 0.8f, 0.1); V_AddLight (ent.origin, i, 1, 0.8f, 0.1f);
} }
else if (effects & EF_FLAG1) else if (effects & EF_FLAG1)
{ {
@ -1112,7 +1102,7 @@ void CL_AddPacketEntities (frame_t *frame)
if(vidref_val == VIDREF_GL) if(vidref_val == VIDREF_GL)
V_AddLight (ent.origin, intensity, -1.0, -1.0, -1.0); V_AddLight (ent.origin, intensity, -1.0, -1.0, -1.0);
else else
V_AddLight (ent.origin, -1.0f * intensity, 1.0, 1.0, 1.0); V_AddLight (ent.origin, -1.0f * intensity, 1.0f, 1.0f, 1.0f);
} }
else else
{ {
@ -1164,7 +1154,7 @@ CL_AddViewWeapon
*/ */
void CL_AddViewWeapon (player_state_t *ps, player_state_t *ops) void CL_AddViewWeapon (player_state_t *ps, player_state_t *ops)
{ {
entity_t gun = {0}; // view model entity_t gun = {0}; // view model
int i; int i;
// allow the gun to be completely removed // allow the gun to be completely removed

View file

@ -101,10 +101,7 @@ void CL_SetLightstyle (int i)
s = cl.configstrings[i+CS_LIGHTS]; s = cl.configstrings[i+CS_LIGHTS];
j = strlen (s); j = (int)strlen (s);
if (j >= MAX_QPATH)
Com_Error (ERR_DROP, "svc_lightstyle length=%i", j);
cl_lightstyle[i].length = j; cl_lightstyle[i].length = j;
for (k=0 ; k<j ; k++) for (k=0 ; k<j ; k++)
@ -164,7 +161,6 @@ cdlight_t *CL_AllocDlight (int key)
{ {
if (dl->key == key) if (dl->key == key)
{ {
memset (dl, 0, sizeof(*dl));
dl->key = key; dl->key = key;
return dl; return dl;
} }
@ -177,14 +173,12 @@ cdlight_t *CL_AllocDlight (int key)
{ {
if (dl->die < cl.time) if (dl->die < cl.time)
{ {
memset (dl, 0, sizeof(*dl));
dl->key = key; dl->key = key;
return dl; return dl;
} }
} }
dl = &cl_dlights[0]; dl = &cl_dlights[0];
memset (dl, 0, sizeof(*dl));
dl->key = key; dl->key = key;
return dl; return dl;
} }
@ -266,14 +260,14 @@ void CL_ParseMuzzleFlash (void)
VectorMA (dl->origin, 18, fv, dl->origin); VectorMA (dl->origin, 18, fv, dl->origin);
VectorMA (dl->origin, 16, rv, dl->origin); VectorMA (dl->origin, 16, rv, dl->origin);
if (silenced) if (silenced)
dl->radius = 100 + (rand()&31); dl->radius = 100.0f + (rand()&31);
else else
dl->radius = 200 + (rand()&31); dl->radius = 200.0f + (rand()&31);
dl->minlight = 32; dl->minlight = 32;
dl->die = cl.time; // + 0.1; dl->die = cl.time; // + 0.1;
if (silenced) if (silenced)
volume = 0.2; volume = 0.2f;
else else
volume = 1; volume = 1;
@ -293,43 +287,43 @@ void CL_ParseMuzzleFlash (void)
break; break;
case MZ_MACHINEGUN: case MZ_MACHINEGUN:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
break; break;
case MZ_SHOTGUN: case MZ_SHOTGUN:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/shotgf1b.wav"), volume, ATTN_NORM, 0); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/shotgf1b.wav"), volume, ATTN_NORM, 0);
S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/shotgr1b.wav"), volume, ATTN_NORM, 0.1); S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/shotgr1b.wav"), volume, ATTN_NORM, 0.1f);
break; break;
case MZ_SSHOTGUN: case MZ_SSHOTGUN:
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/sshotf1b.wav"), volume, ATTN_NORM, 0); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/sshotf1b.wav"), volume, ATTN_NORM, 0);
break; break;
case MZ_CHAINGUN1: case MZ_CHAINGUN1:
dl->radius = 200 + (rand()&31); dl->radius = 200.0f + (rand()&31);
dl->color[0] = 1;dl->color[1] = 0.25;dl->color[2] = 0; dl->color[0] = 1;dl->color[1] = 0.25;dl->color[2] = 0;
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
break; break;
case MZ_CHAINGUN2: case MZ_CHAINGUN2:
dl->radius = 225 + (rand()&31); dl->radius = 225.0f + (rand()&31);
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0; dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0;
dl->die = cl.time + 0.1; // long delay dl->die = cl.time + 0.1; // long delay
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.05); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.05);
break; break;
case MZ_CHAINGUN3: case MZ_CHAINGUN3:
dl->radius = 250 + (rand()&31); dl->radius = 250.0f + (rand()&31);
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
dl->die = cl.time + 0.1; // long delay dl->die = cl.time + 0.1; // long delay
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0);
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.033); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.033f);
Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%ib.wav", (rand() % 5) + 1); Com_sprintf(soundname, sizeof(soundname), "weapons/machgf%lub.wav", (rand() % 5) + 1);
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.066); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound(soundname), volume, ATTN_NORM, 0.066f);
break; break;
case MZ_RAILGUN: case MZ_RAILGUN:
dl->color[0] = 0.5;dl->color[1] = 0.5;dl->color[2] = 1.0; dl->color[0] = 0.5;dl->color[1] = 0.5;dl->color[2] = 1.0;
@ -338,12 +332,12 @@ void CL_ParseMuzzleFlash (void)
case MZ_ROCKET: case MZ_ROCKET:
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2; dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/rocklf1a.wav"), volume, ATTN_NORM, 0); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/rocklf1a.wav"), volume, ATTN_NORM, 0);
S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/rocklr1b.wav"), volume, ATTN_NORM, 0.1); S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/rocklr1b.wav"), volume, ATTN_NORM, 0.1f);
break; break;
case MZ_GRENADE: case MZ_GRENADE:
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0; dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), volume, ATTN_NORM, 0); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), volume, ATTN_NORM, 0);
S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/grenlr1b.wav"), volume, ATTN_NORM, 0.1); S_StartSound (NULL, i, CHAN_AUTO, S_RegisterSound("weapons/grenlr1b.wav"), volume, ATTN_NORM, 0.1f);
break; break;
case MZ_BFG: case MZ_BFG:
dl->color[0] = 0;dl->color[1] = 1;dl->color[2] = 0; dl->color[0] = 0;dl->color[1] = 1;dl->color[2] = 0;
@ -352,13 +346,13 @@ void CL_ParseMuzzleFlash (void)
case MZ_LOGIN: case MZ_LOGIN:
dl->color[0] = 0;dl->color[1] = 1; dl->color[2] = 0; dl->color[0] = 0;dl->color[1] = 1; dl->color[2] = 0;
dl->die = cl.time + 1.0; dl->die = cl.time + 1;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
CL_LogoutEffect (pl->current.origin, weapon); CL_LogoutEffect (pl->current.origin, weapon);
break; break;
case MZ_LOGOUT: case MZ_LOGOUT:
dl->color[0] = 1;dl->color[1] = 0; dl->color[2] = 0; dl->color[0] = 1;dl->color[1] = 0; dl->color[2] = 0;
dl->die = cl.time + 1.0; dl->die = cl.time + 1;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/grenlf1a.wav"), 1, ATTN_NORM, 0);
CL_LogoutEffect (pl->current.origin, weapon); CL_LogoutEffect (pl->current.origin, weapon);
break; break;
@ -382,7 +376,7 @@ void CL_ParseMuzzleFlash (void)
// ====================== // ======================
// PGM // PGM
case MZ_ETF_RIFLE: case MZ_ETF_RIFLE:
dl->color[0] = 0.9;dl->color[1] = 0.7;dl->color[2] = 0; dl->color[0] = 0.9f;dl->color[1] = 0.7f;dl->color[2] = 0;
S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/nail1.wav"), volume, ATTN_NORM, 0); S_StartSound (NULL, i, CHAN_WEAPON, S_RegisterSound("weapons/nail1.wav"), volume, ATTN_NORM, 0);
break; break;
case MZ_SHOTGUN2: case MZ_SHOTGUN2:
@ -434,7 +428,7 @@ void CL_ParseMuzzleFlash2 (void)
{ {
int ent; int ent;
vec3_t origin; vec3_t origin;
int flash_number; unsigned flash_number;
cdlight_t *dl; cdlight_t *dl;
vec3_t forward, right; vec3_t forward, right;
char soundname[64]; char soundname[64];
@ -445,6 +439,9 @@ void CL_ParseMuzzleFlash2 (void)
flash_number = MSG_ReadByte (&net_message); flash_number = MSG_ReadByte (&net_message);
if (flash_number > 210)
Com_Error (ERR_DROP, "CL_ParseMuzzleFlash2: bad offset");
// locate the origin // locate the origin
AngleVectors (cl_entities[ent].current.angles, forward, right, NULL); AngleVectors (cl_entities[ent].current.angles, forward, right, NULL);
origin[0] = cl_entities[ent].current.origin[0] + forward[0] * monster_flash_offset[flash_number][0] + right[0] * monster_flash_offset[flash_number][1]; origin[0] = cl_entities[ent].current.origin[0] + forward[0] * monster_flash_offset[flash_number][0] + right[0] * monster_flash_offset[flash_number][1];
@ -453,7 +450,7 @@ void CL_ParseMuzzleFlash2 (void)
dl = CL_AllocDlight (ent); dl = CL_AllocDlight (ent);
VectorCopy (origin, dl->origin); VectorCopy (origin, dl->origin);
dl->radius = 200 + (rand()&31); dl->radius = 200.0f + (rand()&31);
dl->minlight = 32; dl->minlight = 32;
dl->die = cl.time; // + 0.1; dl->die = cl.time; // + 0.1;
@ -611,20 +608,20 @@ void CL_ParseMuzzleFlash2 (void)
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
CL_ParticleEffect (origin, vec3_origin, 0, 40); CL_ParticleEffect (origin, vec3_origin, 0, 40);
CL_SmokeAndFlash(origin); CL_SmokeAndFlash(origin);
Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + rand() % 5); Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + (char) (rand() % 5));
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound(soundname), 1, ATTN_NORM, 0); S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound(soundname), 1, ATTN_NORM, 0);
break; break;
case MZ2_CHICK_ROCKET_1: case MZ2_CHICK_ROCKET_1:
case MZ2_TURRET_ROCKET: // PGM case MZ2_TURRET_ROCKET: // PGM
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2; dl->color[0] = 1;dl->color[1] = 0.5f;dl->color[2] = 0.2f;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("chick/chkatck2.wav"), 1, ATTN_NORM, 0); S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("chick/chkatck2.wav"), 1, ATTN_NORM, 0);
break; break;
case MZ2_TANK_ROCKET_1: case MZ2_TANK_ROCKET_1:
case MZ2_TANK_ROCKET_2: case MZ2_TANK_ROCKET_2:
case MZ2_TANK_ROCKET_3: case MZ2_TANK_ROCKET_3:
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2; dl->color[0] = 1;dl->color[1] = 0.5f;dl->color[2] = 0.2f;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/tnkatck1.wav"), 1, ATTN_NORM, 0); S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/tnkatck1.wav"), 1, ATTN_NORM, 0);
break; break;
@ -636,7 +633,7 @@ void CL_ParseMuzzleFlash2 (void)
case MZ2_BOSS2_ROCKET_3: case MZ2_BOSS2_ROCKET_3:
case MZ2_BOSS2_ROCKET_4: case MZ2_BOSS2_ROCKET_4:
case MZ2_CARRIER_ROCKET_1: case MZ2_CARRIER_ROCKET_1:
dl->color[0] = 1;dl->color[1] = 0.5;dl->color[2] = 0.2; dl->color[0] = 1;dl->color[1] = 0.5f;dl->color[2] = 0.2f;
S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/rocket.wav"), 1, ATTN_NORM, 0); S_StartSound (NULL, ent, CHAN_WEAPON, S_RegisterSound("tank/rocket.wav"), 1, ATTN_NORM, 0);
break; break;
@ -790,7 +787,7 @@ void CL_ParseMuzzleFlash2 (void)
case MZ2_WIDOW2_BEAM_SWEEP_9: case MZ2_WIDOW2_BEAM_SWEEP_9:
case MZ2_WIDOW2_BEAM_SWEEP_10: case MZ2_WIDOW2_BEAM_SWEEP_10:
case MZ2_WIDOW2_BEAM_SWEEP_11: case MZ2_WIDOW2_BEAM_SWEEP_11:
dl->radius = 300 + (rand()&100); dl->radius = 300.0f + (rand()&100);
dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0; dl->color[0] = 1;dl->color[1] = 1;dl->color[2] = 0;
dl->die = cl.time + 200; dl->die = cl.time + 200;
break; break;
@ -823,6 +820,7 @@ void CL_AddDLights (void)
{ {
if (!dl->radius) if (!dl->radius)
continue; continue;
V_AddLight (dl->origin, dl->radius, V_AddLight (dl->origin, dl->radius,
dl->color[0], dl->color[1], dl->color[2]); dl->color[0], dl->color[1], dl->color[2]);
} }
@ -842,6 +840,7 @@ void CL_AddDLights (void)
dl->color[1] = 1; dl->color[1] = 1;
dl->color[2] = 1; dl->color[2] = 1;
} }
V_AddLight (dl->origin, dl->radius, V_AddLight (dl->origin, dl->radius,
dl->color[0], dl->color[1], dl->color[2]); dl->color[0], dl->color[1], dl->color[2]);
} }
@ -908,7 +907,7 @@ void CL_ParticleEffect (vec3_t org, vec3_t dir, int color, int count)
} }
p->accel[0] = p->accel[1] = 0; p->accel[0] = p->accel[1] = 0;
p->accel[2] = -PARTICLE_GRAVITY; p->accel[2] = -PARTICLE_GRAVITY+0.2f;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.5 + frand()*0.3); p->alphavel = -1.0 / (0.5 + frand()*0.3);
@ -926,6 +925,8 @@ void CL_ParticleEffect2 (vec3_t org, vec3_t dir, int color, int count)
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
float d; float d;
float time;
time = (float)cl.time;
for (i=0 ; i<count ; i++) for (i=0 ; i<count ; i++)
{ {
@ -936,8 +937,8 @@ void CL_ParticleEffect2 (vec3_t org, vec3_t dir, int color, int count)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
p->color = color; p->color = color + (rand()&7);
d = rand()&7; d = rand()&7;
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
@ -950,7 +951,7 @@ void CL_ParticleEffect2 (vec3_t org, vec3_t dir, int color, int count)
p->accel[2] = -PARTICLE_GRAVITY; p->accel[2] = -PARTICLE_GRAVITY;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.5 + frand()*0.3); p->alphavel = -1.0f / (0.5f + frand()*0.3f);
} }
} }
@ -966,6 +967,8 @@ void CL_ParticleEffect3 (vec3_t org, vec3_t dir, int color, int count)
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
float d; float d;
float time;
time = (float)cl.time;
for (i=0 ; i<count ; i++) for (i=0 ; i<count ; i++)
{ {
@ -976,7 +979,7 @@ void CL_ParticleEffect3 (vec3_t org, vec3_t dir, int color, int count)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
p->color = color; p->color = color;
d = rand()&7; d = rand()&7;
@ -990,7 +993,7 @@ void CL_ParticleEffect3 (vec3_t org, vec3_t dir, int color, int count)
p->accel[2] = PARTICLE_GRAVITY; p->accel[2] = PARTICLE_GRAVITY;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.5 + frand()*0.3); p->alphavel = -1.0f / (0.5f + frand()*0.3f);
} }
} }
@ -1003,6 +1006,8 @@ void CL_TeleporterParticles (entity_state_t *ent)
{ {
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
float time;
time = (float)cl.time;
for (i=0 ; i<8 ; i++) for (i=0 ; i<8 ; i++)
{ {
@ -1013,7 +1018,7 @@ void CL_TeleporterParticles (entity_state_t *ent)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
p->color = 0xdb; p->color = 0xdb;
for (j=0 ; j<2 ; j++) for (j=0 ; j<2 ; j++)
@ -1044,6 +1049,8 @@ void CL_LogoutEffect (vec3_t org, int type)
{ {
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
float time;
time = (float)cl.time;
for (i=0 ; i<500 ; i++) for (i=0 ; i<500 ; i++)
{ {
@ -1054,7 +1061,7 @@ void CL_LogoutEffect (vec3_t org, int type)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
if (type == MZ_LOGIN) if (type == MZ_LOGIN)
p->color = 0xd0 + (rand()&7); // green p->color = 0xd0 + (rand()&7); // green
@ -1089,6 +1096,8 @@ void CL_ItemRespawnParticles (vec3_t org)
{ {
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
float time;
time = (float)cl.time;
for (i=0 ; i<64 ; i++) for (i=0 ; i<64 ; i++)
{ {
@ -1099,7 +1108,7 @@ void CL_ItemRespawnParticles (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
p->color = 0xd4 + (rand()&3); // green p->color = 0xd4 + (rand()&3); // green
p->org[0] = org[0] + crand()*8; p->org[0] = org[0] + crand()*8;
p->org[1] = org[1] + crand()*8; p->org[1] = org[1] + crand()*8;
@ -1112,7 +1121,7 @@ void CL_ItemRespawnParticles (vec3_t org)
p->accel[2] = -PARTICLE_GRAVITY*0.2; p->accel[2] = -PARTICLE_GRAVITY*0.2;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1.0 + frand()*0.3); p->alphavel = -1.0f / (1.0f + frand()*0.3f);
} }
} }
@ -1126,6 +1135,8 @@ void CL_ExplosionParticles (vec3_t org)
{ {
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
float time;
time = (float)cl.time;
for (i=0 ; i<256 ; i++) for (i=0 ; i<256 ; i++)
{ {
@ -1136,7 +1147,7 @@ void CL_ExplosionParticles (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
p->color = 0xe0 + (rand()&7); p->color = 0xe0 + (rand()&7);
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -1148,7 +1159,7 @@ void CL_ExplosionParticles (vec3_t org)
p->accel[2] = -PARTICLE_GRAVITY; p->accel[2] = -PARTICLE_GRAVITY;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -0.8 / (0.5 + frand()*0.3); p->alphavel = -0.8f / (0.5f + frand()*0.3f);
} }
} }
@ -1161,6 +1172,8 @@ void CL_BigTeleportParticles (vec3_t org)
{ {
int i; int i;
cparticle_t *p; cparticle_t *p;
float time;
time = (float)cl.time;
float angle, dist; float angle, dist;
static int colortable[4] = {2*8,13*8,21*8,18*8}; static int colortable[4] = {2*8,13*8,21*8,18*8};
@ -1173,24 +1186,25 @@ void CL_BigTeleportParticles (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
p->color = colortable[rand()&3]; p->color = colortable[rand()&3];
angle = M_PI*2*(rand()&1023)/1023.0;
dist = rand()&31;
p->org[0] = org[0] + cos(angle)*dist;
p->vel[0] = cos(angle)*(70+(rand()&63));
p->accel[0] = -cos(angle)*100;
p->org[1] = org[1] + sin(angle)*dist; angle = M_PI*2*(rand()&1023)/1023.0f;
p->vel[1] = sin(angle)*(70+(rand()&63)); dist = (float)(rand()&31);
p->accel[1] = -sin(angle)*100; p->org[0] = org[0] + (float)cos(angle)*dist;
p->vel[0] = (float)cos(angle)*(70+(rand()&63));
p->accel[0] = -(float)cos(angle)*100;
p->org[1] = org[1] + (float)sin(angle)*dist;
p->vel[1] = (float)sin(angle)*(70+(rand()&63));
p->accel[1] = -(float)sin(angle)*100;
p->org[2] = org[2] + 8 + (rand()%90); p->org[2] = org[2] + 8 + (rand()%90);
p->vel[2] = -100 + (rand()&31); p->vel[2] = -100 + (rand()&31);
p->accel[2] = PARTICLE_GRAVITY*4; p->accel[2] = PARTICLE_GRAVITY*4;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -0.3 / (0.5 + frand()*0.3); p->alphavel = -0.3f / (0.5f + frand()*0.3f);
} }
} }
@ -1208,6 +1222,8 @@ void CL_BlasterParticles (vec3_t org, vec3_t dir)
cparticle_t *p; cparticle_t *p;
float d; float d;
int count; int count;
float time;
time = (float)cl.time;
count = 40; count = 40;
for (i=0 ; i<count ; i++) for (i=0 ; i<count ; i++)
@ -1219,7 +1235,7 @@ void CL_BlasterParticles (vec3_t org, vec3_t dir)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
p->color = 0xe0 + (rand()&7); p->color = 0xe0 + (rand()&7);
d = rand()&15; d = rand()&15;
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
@ -1232,7 +1248,7 @@ void CL_BlasterParticles (vec3_t org, vec3_t dir)
p->accel[2] = -PARTICLE_GRAVITY; p->accel[2] = -PARTICLE_GRAVITY;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.5 + frand()*0.3); p->alphavel = -1.0f / (0.5f + frand()*0.3f);
} }
} }
@ -1247,14 +1263,16 @@ void CL_BlasterTrail (vec3_t start, vec3_t end)
{ {
vec3_t move; vec3_t move;
vec3_t vec; vec3_t vec;
float len; int len;
int j; int j;
cparticle_t *p; cparticle_t *p;
int dec; int dec;
float time;
time = (float)cl.time;
VectorCopy (start, move); VectorCopy (start, move);
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
len = VectorNormalize (vec); len = (int)VectorNormalize (vec);
dec = 5; dec = 5;
VectorScale (vec, 5, vec); VectorScale (vec, 5, vec);
@ -1272,10 +1290,10 @@ void CL_BlasterTrail (vec3_t start, vec3_t end)
active_particles = p; active_particles = p;
VectorClear (p->accel); VectorClear (p->accel);
p->time = cl.time; p->time = time;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.3+frand()*0.2); p->alphavel = -1.0f / (0.3f+frand()*0.2f);
p->color = 0xe0; p->color = 0xe0;
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -1298,14 +1316,16 @@ void CL_QuadTrail (vec3_t start, vec3_t end)
{ {
vec3_t move; vec3_t move;
vec3_t vec; vec3_t vec;
float len; int len;
int j; int j;
cparticle_t *p; cparticle_t *p;
int dec; int dec;
float time;
time = (float)cl.time;
VectorCopy (start, move); VectorCopy (start, move);
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
len = VectorNormalize (vec); len = (int)VectorNormalize (vec);
dec = 5; dec = 5;
VectorScale (vec, 5, vec); VectorScale (vec, 5, vec);
@ -1322,10 +1342,10 @@ void CL_QuadTrail (vec3_t start, vec3_t end)
active_particles = p; active_particles = p;
VectorClear (p->accel); VectorClear (p->accel);
p->time = cl.time; p->time = time;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.8+frand()*0.2); p->alphavel = -1.0f / (0.8f+frand()*0.2f);
p->color = 115; p->color = 115;
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -1344,18 +1364,20 @@ CL_FlagTrail
=============== ===============
*/ */
void CL_FlagTrail (vec3_t start, vec3_t end, boolean isred) void CL_FlagTrail (vec3_t start, vec3_t end, int color)
{ {
vec3_t move; vec3_t move;
vec3_t vec; vec3_t vec;
float len; int len;
int j; int j;
cparticle_t *p; cparticle_t *p;
int dec; int dec;
float time;
time = (float)cl.time;
VectorCopy (start, move); VectorCopy (start, move);
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
len = VectorNormalize (vec); len = (int)VectorNormalize (vec);
dec = 5; dec = 5;
VectorScale (vec, 5, vec); VectorScale (vec, 5, vec);
@ -1372,10 +1394,10 @@ void CL_FlagTrail (vec3_t start, vec3_t end, boolean isred)
active_particles = p; active_particles = p;
VectorClear (p->accel); VectorClear (p->accel);
p->time = cl.time; p->time = time;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.8+frand()*0.2); p->alphavel = -1.0f / (0.8f+frand()*0.2f);
p->color = color; p->color = color;
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -1398,12 +1420,14 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags)
{ {
vec3_t move; vec3_t move;
vec3_t vec; vec3_t vec;
float len; int len;
int j; int j;
cparticle_t *p; cparticle_t *p;
float dec; float dec;
float orgscale; float orgscale;
float velscale; float velscale;
float time;
time = (float)cl.time;
VectorCopy (start, move); VectorCopy (start, move);
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
@ -1444,12 +1468,12 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags)
active_particles = p; active_particles = p;
VectorClear (p->accel); VectorClear (p->accel);
p->time = cl.time; p->time = time;
if (flags & EF_GIB) if (flags & EF_GIB)
{ {
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1+frand()*0.4); p->alphavel = -1.0f / (1+frand()*0.4f);
p->color = 0xe8 + (rand()&7); p->color = 0xe8 + (rand()&7);
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -1462,7 +1486,7 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags)
else if (flags & EF_GREENGIB) else if (flags & EF_GREENGIB)
{ {
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1+frand()*0.4); p->alphavel = -1.0f / (1+frand()*0.4f);
p->color = 0xdb + (rand()&7); p->color = 0xdb + (rand()&7);
for (j=0; j< 3; j++) for (j=0; j< 3; j++)
{ {
@ -1475,7 +1499,7 @@ void CL_DiminishingTrail (vec3_t start, vec3_t end, centity_t *old, int flags)
else else
{ {
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1+frand()*0.2); p->alphavel = -1.0f / (1+frand()*0.2f);
p->color = 4 + (rand()&7); p->color = 4 + (rand()&7);
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -1519,10 +1543,12 @@ void CL_RocketTrail (vec3_t start, vec3_t end, centity_t *old)
{ {
vec3_t move; vec3_t move;
vec3_t vec; vec3_t vec;
float len; int len;
int j; int j;
cparticle_t *p; cparticle_t *p;
float dec; int dec;
float time;
time = (float)cl.time;
// smoke // smoke
CL_DiminishingTrail (start, end, old, EF_ROCKET); CL_DiminishingTrail (start, end, old, EF_ROCKET);
@ -1530,7 +1556,7 @@ void CL_RocketTrail (vec3_t start, vec3_t end, centity_t *old)
// fire // fire
VectorCopy (start, move); VectorCopy (start, move);
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
len = VectorNormalize (vec); len = (int)VectorNormalize (vec);
dec = 1; dec = 1;
VectorScale (vec, dec, vec); VectorScale (vec, dec, vec);
@ -1550,10 +1576,10 @@ void CL_RocketTrail (vec3_t start, vec3_t end, centity_t *old)
active_particles = p; active_particles = p;
VectorClear (p->accel); VectorClear (p->accel);
p->time = cl.time; p->time = time;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1+frand()*0.2); p->alphavel = -1.0f / (1+frand()*0.2f);
p->color = 0xdc + (rand()&3); p->color = 0xdc + (rand()&3);
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -1576,7 +1602,7 @@ void CL_RailTrail (vec3_t start, vec3_t end)
{ {
vec3_t move; vec3_t move;
vec3_t vec; vec3_t vec;
float len; int len;
int j; int j;
cparticle_t *p; cparticle_t *p;
float dec; float dec;
@ -1585,6 +1611,8 @@ void CL_RailTrail (vec3_t start, vec3_t end)
float d, c, s; float d, c, s;
vec3_t dir; vec3_t dir;
byte clr = 0x74; byte clr = 0x74;
float time;
time = (float)cl.time;
VectorCopy (start, move); VectorCopy (start, move);
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
@ -1602,18 +1630,18 @@ void CL_RailTrail (vec3_t start, vec3_t end)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
VectorClear (p->accel); VectorClear (p->accel);
d = i * 0.1; d = i * 0.1f;
c = cos(d); c = (float)cos(d);
s = sin(d); s = (float)sin(d);
VectorScale (right, c, dir); VectorScale (right, c, dir);
VectorMA (dir, s, up, dir); VectorMA (dir, s, up, dir);
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1+frand()*0.2); p->alphavel = -1.0f / (1+frand()*0.2f);
p->color = clr + (rand()&7); p->color = clr + (rand()&7);
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -1639,11 +1667,11 @@ void CL_RailTrail (vec3_t start, vec3_t end)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
VectorClear (p->accel); VectorClear (p->accel);
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.6+frand()*0.2); p->alphavel = -1.0f / (0.6f+frand()*0.2f);
p->color = 0x0 + (rand()&15); p->color = 0x0 + (rand()&15);
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -1666,15 +1694,17 @@ void CL_IonripperTrail (vec3_t start, vec3_t ent)
{ {
vec3_t move; vec3_t move;
vec3_t vec; vec3_t vec;
float len; int len;
int j; int j;
cparticle_t *p; cparticle_t *p;
int dec; int dec;
int left = 0; int left = 0;
float time;
time = (float)cl.time;
VectorCopy (start, move); VectorCopy (start, move);
VectorSubtract (ent, start, vec); VectorSubtract (ent, start, vec);
len = VectorNormalize (vec); len = (int)VectorNormalize (vec);
dec = 5; dec = 5;
VectorScale (vec, 5, vec); VectorScale (vec, 5, vec);
@ -1691,9 +1721,9 @@ void CL_IonripperTrail (vec3_t start, vec3_t ent)
active_particles = p; active_particles = p;
VectorClear (p->accel); VectorClear (p->accel);
p->time = cl.time; p->time = time;
p->alpha = 0.5; p->alpha = 0.5;
p->alphavel = -1.0 / (0.3 + frand() * 0.2); p->alphavel = -1.0f / (0.3f + frand() * 0.2f);
p->color = 0xe4 + (rand()&3); p->color = 0xe4 + (rand()&3);
for (j=0; j<3; j++) for (j=0; j<3; j++)
{ {
@ -1729,10 +1759,12 @@ void CL_BubbleTrail (vec3_t start, vec3_t end)
{ {
vec3_t move; vec3_t move;
vec3_t vec; vec3_t vec;
float len; int len;
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
float dec; float dec;
float time;
time = (float)cl.time;
VectorCopy (start, move); VectorCopy (start, move);
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
@ -1741,7 +1773,7 @@ void CL_BubbleTrail (vec3_t start, vec3_t end)
dec = 32; dec = 32;
VectorScale (vec, dec, vec); VectorScale (vec, dec, vec);
for (i=0 ; i<len ; i+=dec) for (i=0 ; i<len ; i+=32)
{ {
if (!free_particles) if (!free_particles)
return; return;
@ -1752,10 +1784,10 @@ void CL_BubbleTrail (vec3_t start, vec3_t end)
active_particles = p; active_particles = p;
VectorClear (p->accel); VectorClear (p->accel);
p->time = cl.time; p->time = time;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (1+frand()*0.2); p->alphavel = -1.0f / (1+frand()*0.2f);
p->color = 4 + (rand()&7); p->color = 4 + (rand()&7);
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -1781,11 +1813,13 @@ void CL_FlyParticles (vec3_t origin, int count)
int i; int i;
cparticle_t *p; cparticle_t *p;
float angle; float angle;
float sr, sp, sy, cr, cp, cy; float sp, sy, cp, cy;
vec3_t forward; vec3_t forward;
float dist = 64; float dist = 64;
float ltime; float ltime;
float time;
time = (float)cl.time;
if (count > NUMVERTEXNORMALS) if (count > NUMVERTEXNORMALS)
count = NUMVERTEXNORMALS; count = NUMVERTEXNORMALS;
@ -1793,22 +1827,20 @@ void CL_FlyParticles (vec3_t origin, int count)
if (!avelocities[0][0]) if (!avelocities[0][0])
{ {
for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++) for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++)
avelocities[0][i] = (rand()&255) * 0.01; avelocities[0][i] = (rand()&255) * 0.01f;
} }
ltime = (float)cl.time / 1000.0; ltime = time / 1000.0f;
for (i=0 ; i<count ; i+=2) for (i=0 ; i<count ; i+=2)
{ {
angle = ltime * avelocities[i][0]; angle = ltime * avelocities[i][0];
sy = sin(angle); sy = (float)sin(angle);
cy = cos(angle); cy = (float)cos(angle);
angle = ltime * avelocities[i][1]; angle = ltime * avelocities[i][1];
sp = sin(angle); sp = (float)sin(angle);
cp = cos(angle); cp = (float)cos(angle);
angle = ltime * avelocities[i][2]; angle = ltime * avelocities[i][2];
sr = sin(angle);
cr = cos(angle);
forward[0] = cp*cy; forward[0] = cp*cy;
forward[1] = cp*sy; forward[1] = cp*sy;
@ -1821,9 +1853,9 @@ void CL_FlyParticles (vec3_t origin, int count)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
dist = sin(ltime + i)*64; dist = (float)sin(ltime + i)*64;
p->org[0] = origin[0] + bytedirs[i][0]*dist + forward[0]*BEAMLENGTH; p->org[0] = origin[0] + bytedirs[i][0]*dist + forward[0]*BEAMLENGTH;
p->org[1] = origin[1] + bytedirs[i][1]*dist + forward[1]*BEAMLENGTH; p->org[1] = origin[1] + bytedirs[i][1]*dist + forward[1]*BEAMLENGTH;
p->org[2] = origin[2] + bytedirs[i][2]*dist + forward[2]*BEAMLENGTH; p->org[2] = origin[2] + bytedirs[i][2]*dist + forward[2]*BEAMLENGTH;
@ -1856,12 +1888,12 @@ void CL_FlyEffect (centity_t *ent, vec3_t origin)
n = cl.time - starttime; n = cl.time - starttime;
if (n < 20000) if (n < 20000)
count = n * 162 / 20000.0; count = (int)n * 162 / 20000.0;
else else
{ {
n = ent->fly_stoptime - cl.time; n = ent->fly_stoptime - cl.time;
if (n < 20000) if (n < 20000)
count = n * 162 / 20000.0; count = (int)n * 162 / 20000.0;
else else
count = 162; count = 162;
} }
@ -1882,31 +1914,32 @@ void CL_BfgParticles (entity_t *ent)
int i; int i;
cparticle_t *p; cparticle_t *p;
float angle; float angle;
float sr, sp, sy, cr, cp, cy; float sp, sy, cp, cy;
vec3_t forward; vec3_t forward;
float dist = 64; float dist = 64;
vec3_t v; vec3_t v;
float ltime; float ltime;
float time;
time = (float)cl.time;
if (!avelocities[0][0]) if (!avelocities[0][0])
{ {
for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++) for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++)
avelocities[0][i] = (rand()&255) * 0.01; avelocities[0][i] = (rand()&255) * 0.01f;
} }
ltime = (float)cl.time / 1000.0; ltime = time / 1000.0;
for (i=0 ; i<NUMVERTEXNORMALS ; i++) for (i=0 ; i<NUMVERTEXNORMALS ; i++)
{ {
angle = ltime * avelocities[i][0]; angle = ltime * avelocities[i][0];
sy = sin(angle); sy = (float)sin(angle);
cy = cos(angle); cy = (float)cos(angle);
angle = ltime * avelocities[i][1]; angle = ltime * avelocities[i][1];
sp = sin(angle); sp = (float)sin(angle);
cp = cos(angle); cp = (float)cos(angle);
angle = ltime * avelocities[i][2]; angle = ltime * avelocities[i][2];
sr = sin(angle);
cr = cos(angle);
forward[0] = cp*cy; forward[0] = cp*cy;
forward[1] = cp*sy; forward[1] = cp*sy;
@ -1919,9 +1952,9 @@ void CL_BfgParticles (entity_t *ent)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
dist = sin(ltime + i)*64; dist = (float)sin(ltime + i)*64;
p->org[0] = ent->origin[0] + bytedirs[i][0]*dist + forward[0]*BEAMLENGTH; p->org[0] = ent->origin[0] + bytedirs[i][0]*dist + forward[0]*BEAMLENGTH;
p->org[1] = ent->origin[1] + bytedirs[i][1]*dist + forward[1]*BEAMLENGTH; p->org[1] = ent->origin[1] + bytedirs[i][1]*dist + forward[1]*BEAMLENGTH;
p->org[2] = ent->origin[2] + bytedirs[i][2]*dist + forward[2]*BEAMLENGTH; p->org[2] = ent->origin[2] + bytedirs[i][2]*dist + forward[2]*BEAMLENGTH;
@ -1930,10 +1963,10 @@ void CL_BfgParticles (entity_t *ent)
VectorClear (p->accel); VectorClear (p->accel);
VectorSubtract (p->org, ent->origin, v); VectorSubtract (p->org, ent->origin, v);
dist = VectorLength(v) / 90.0; dist = VectorLength(v) / 90.0f;
p->color = floor (0xd0 + dist * 7); p->color = (int)floor (0xd0 + dist * 7);
p->colorvel = 0; p->colorvel = 0;
p->alpha = 1.0 - dist; p->alpha = 1.0f - dist;
p->alphavel = -100; p->alphavel = -100;
} }
} }
@ -1950,10 +1983,13 @@ void CL_TrapParticles (entity_t *ent)
vec3_t move; vec3_t move;
vec3_t vec; vec3_t vec;
vec3_t start, end; vec3_t start, end;
float len; int len;
int j; int j;
cparticle_t *p; cparticle_t *p;
int dec; int dec;
float time;
time = (float)cl.time;
ent->origin[2]-=14; ent->origin[2]-=14;
VectorCopy (ent->origin, start); VectorCopy (ent->origin, start);
@ -1962,7 +1998,7 @@ void CL_TrapParticles (entity_t *ent)
VectorCopy (start, move); VectorCopy (start, move);
VectorSubtract (end, start, vec); VectorSubtract (end, start, vec);
len = VectorNormalize (vec); len = (int)VectorNormalize (vec);
dec = 5; dec = 5;
VectorScale (vec, 5, vec); VectorScale (vec, 5, vec);
@ -1980,10 +2016,10 @@ void CL_TrapParticles (entity_t *ent)
active_particles = p; active_particles = p;
VectorClear (p->accel); VectorClear (p->accel);
p->time = cl.time; p->time = time;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.3+frand()*0.2); p->alphavel = -1.0f / (0.3f+frand()*0.2f);
p->color = 0xe0; p->color = 0xe0;
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -2021,21 +2057,21 @@ void CL_TrapParticles (entity_t *ent)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
p->color = 0xe0 + (rand()&3); p->color = 0xe0 + (rand()&3);
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.3 + (rand()&7) * 0.02); p->alphavel = -1.0f / (0.3f + (rand()&7) * 0.02f);
p->org[0] = org[0] + i + ((rand()&23) * crand()); p->org[0] = org[0] + i + ((rand()&23) * crand());
p->org[1] = org[1] + j + ((rand()&23) * crand()); p->org[1] = org[1] + j + ((rand()&23) * crand());
p->org[2] = org[2] + k + ((rand()&23) * crand()); p->org[2] = org[2] + k + ((rand()&23) * crand());
dir[0] = j * 8; dir[0] = j * 8.0f;
dir[1] = i * 8; dir[1] = i * 8.0f;
dir[2] = k * 8; dir[2] = k * 8.0f;
VectorNormalize (dir); VectorNormalize (dir);
vel = 50 + (rand()&63); vel = (float)(50 + (rand()&63));
VectorScale (dir, vel, p->vel); VectorScale (dir, vel, p->vel);
p->accel[0] = p->accel[1] = 0; p->accel[0] = p->accel[1] = 0;
@ -2055,6 +2091,8 @@ void CL_BFGExplosionParticles (vec3_t org)
{ {
int i, j; int i, j;
cparticle_t *p; cparticle_t *p;
float time;
time = (float)cl.time;
for (i=0 ; i<256 ; i++) for (i=0 ; i<256 ; i++)
{ {
@ -2065,7 +2103,7 @@ void CL_BFGExplosionParticles (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
p->color = 0xd0 + (rand()&7); p->color = 0xd0 + (rand()&7);
for (j=0 ; j<3 ; j++) for (j=0 ; j<3 ; j++)
{ {
@ -2077,7 +2115,7 @@ void CL_BFGExplosionParticles (vec3_t org)
p->accel[2] = -PARTICLE_GRAVITY; p->accel[2] = -PARTICLE_GRAVITY;
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -0.8 / (0.5 + frand()*0.3); p->alphavel = -0.8f / (0.5f + frand()*0.3f);
} }
} }
@ -2094,6 +2132,8 @@ void CL_TeleportParticles (vec3_t org)
cparticle_t *p; cparticle_t *p;
float vel; float vel;
vec3_t dir; vec3_t dir;
float time;
time = (float)cl.time;
for (i=-16 ; i<=16 ; i+=4) for (i=-16 ; i<=16 ; i+=4)
for (j=-16 ; j<=16 ; j+=4) for (j=-16 ; j<=16 ; j+=4)
@ -2106,21 +2146,21 @@ void CL_TeleportParticles (vec3_t org)
p->next = active_particles; p->next = active_particles;
active_particles = p; active_particles = p;
p->time = cl.time; p->time = time;
p->color = 7 + (rand()&7); p->color = 7 + (rand()&7);
p->alpha = 1.0; p->alpha = 1.0;
p->alphavel = -1.0 / (0.3 + (rand()&7) * 0.02); p->alphavel = -1.0f / (0.3f + (rand()&7) * 0.02f);
p->org[0] = org[0] + i + (rand()&3); p->org[0] = org[0] + i + (rand()&3);
p->org[1] = org[1] + j + (rand()&3); p->org[1] = org[1] + j + (rand()&3);
p->org[2] = org[2] + k + (rand()&3); p->org[2] = org[2] + k + (rand()&3);
dir[0] = j*8; dir[0] = j*8.0f;
dir[1] = i*8; dir[1] = i*8.0f;
dir[2] = k*8; dir[2] = k*8.0f;
VectorNormalize (dir); VectorNormalize (dir);
vel = 50 + (rand()&63); vel = (float)(50 + (rand()&63));
VectorScale (dir, vel, p->vel); VectorScale (dir, vel, p->vel);
p->accel[0] = p->accel[1] = 0; p->accel[0] = p->accel[1] = 0;
@ -2177,7 +2217,7 @@ void CL_AddParticles (void)
tail = p; tail = p;
} }
if (alpha > 1.0) if (alpha > 1.0f)
alpha = 1; alpha = 1;
color = p->color; color = p->color;
time2 = time*time; time2 = time*time;
@ -2235,7 +2275,7 @@ void CL_EntityEvent (entity_state_t *ent)
case EV_FALLFAR: case EV_FALLFAR:
S_StartSound (NULL, ent->number, CHAN_AUTO, S_RegisterSound ("*fall1.wav"), 1, ATTN_NORM, 0); S_StartSound (NULL, ent->number, CHAN_AUTO, S_RegisterSound ("*fall1.wav"), 1, ATTN_NORM, 0);
break; break;
} }
} }
/* /*

View file

@ -466,7 +466,7 @@ void CL_BubbleTrail (vec3_t start, vec3_t end);
#ifdef QMAX #ifdef QMAX
void CL_FlagTrail (vec3_t start, vec3_t end, qboolean isred); void CL_FlagTrail (vec3_t start, vec3_t end, qboolean isred);
#else #else
void CL_FlagTrail (vec3_t start, vec3_t end, float color); void CL_FlagTrail (vec3_t start, vec3_t end, int color);
#endif #endif
// RAFAEL // RAFAEL